I am going crazy with gem5. When I run a program that just outputs "Hello, world". Only set debug=Exec in gem5. I saw the operation of thousands of lines of assembly instructions. How can I only see the execution process of my own code?

1

There are 1 answers

3
Ciro Santilli On

Is running ExecAll which enables ExecSymbol which shows the current function name good enough? E.g. with this I see the first instruction on main as:

58852000: system.cpu: A0 T0 : 0x3fffd94f70 @__end__+274871107384    :   blr   x3                 : IntAlu :  D=0x0000003fffd94f74  flags=(IsInteger|IsControl|IsIndirectControl|IsUncondControl|IsCall)
58852500: system.cpu: A0 T0 : 0x4006f0 @main    : stp 

If you really don't want to log the instructions before main, you can also do a first run that determines the timestamp of the start of main (58852500 on the above run) and then use:

gem5.opt --debug-start=58852500

I don't know any method that does not require an initial run to determine the timestamp. It would be cool to add something to gem5 that enables logging based on the symbol name, I've wanted that before.