In the development of Linux under the GEM5 program, you need to start GEM5, and then use Telnet to connect the GEM5 to see the serial port information. Because of the number of steps, so write a script to run GEM5 and Telnet program, and two programs to listen, after any one exit, the other will also exit.
Originally, the Termination commands for two processes used kill-9 to exit. However, in the course of use, it is found that after the GEM5 run, sometimes stats.txt files are generated, sometimes not. After analysis, it is found that only the first exit GEM5, the Stats.txt file will be generated.
Analysis of the phenomenon, concluded: GEM5 need to use CTRL + C to exit, using kill-9 to exit will affect the production of stats.txt log. After querying, CTRL + C sends the signal number 2, and all the Kill commands signal as follows:
[Email protected] ~$ kill-l 1) SIGHUP 2) SIGINT 3) Sigquit 4) Sigill 5) SIGTRAP 6) SIGABRT 7) Sigemt 8) SIGFPE 9) SIGKILL SIGBUS11) SIGSEGV12) SIGSYS13) SIGPIPE14) SIGALRM15) SIGTERM16) SIGURG17) SIGSTOP18) SIGTSTP19) SIGCONT20) SIGCHLD21) SIGTTIN22) SIGTTOU23) SIGIO24) SIGXCPU25) SIGXFSZ26) SIGVTALRM27) SIGPROF28) SIGWINCH29) SIGINFO30) SIGUSR131) SIGUSR2
Therefore, modify the script to determine if Telnet has exited, then use Kill-s SIGINT ${pid} to exit the GEM5, you can normally get to the Stats.txt file.
Use of the KILL command while the GEM5 emulator is running