3

In gem5, can I step through my code? Like gdb instead of using DPRINTF to print out certain statements in some places?

1、Now,I found I can debug the gem5 through the command like gdb --args gem5.debug --debug-break = 1000. but I still cann't look the code in the real time. When I use the option of -tui,the error occured as "Cannot enable the TUI when output is not a terminal". but when I use the gdb to debug my Hello_world program like gdb -tui hello_world,The error didn't appear. and I can look the code in the real time.

2、moreover,I cann't set the breakpoint in my hello_world program when debug the gem5. when I use the command like b src/cpu/o3/cpu.cc:567,it works. but if I set the breakpoint in my own hello_world program,the error occurred as "No source file named cleanupspec/hello_world".

Gerrie
  • 736
  • 3
  • 18
  • Please try to describe in more detail the problem in the question. E.g., I would move the answer into the question, as it contains an error message. The "Cannot enable the TUI when output is not a terminal" does not look like a gem5 problem, but rather like a weird terminal setup? Does TUI work for a C hello world? And does it work without `--debug-break`? GDB Dashboard is an alternative to TUI that you could also try: https://stackoverflow.com/questions/10115540/gdb-split-view-with-code/51301717#51301717 – Ciro Santilli Sep 28 '20 at 11:27
  • Thanks for your comment and advice. The question has been described again with more detail. I have solved the first question. Can you give me some suggestions for the second question? – Gerrie Sep 29 '20 at 01:32
  • gem5 exposes a GDB server for the guest program at port 7000, then it is exactly like debugging a devboard, see e.g.: https://stackoverflow.com/questions/52732183/how-do-i-perform-a-remote-gdb-session-on-a-pc-for-arm-gdbserver-with-gdb-gui-fro – Ciro Santilli Sep 29 '20 at 08:07

1 Answers1

0

For the first question, I have known the answer. Via layout next command, I can look the code in the real time. But command like layout, layout src, etc. didn't work.

Gerrie
  • 736
  • 3
  • 18