One of the core features is tracing one or multiple AVR cores in the simulator. To enable the trace feature you have simply to add the -t option to the command line. If the ELF-file you load into the simulator has debug information the trace output will also contain the label information of the ELF-file. This information is printed for all variables in flash, RAM, ext-RAM and also for all known hardware registers. Also all code labels will be written to the trace output.
What is written to trace output:
2000 a.out 0x0026: __do_copy_data LDI R17, 0x00 R17=0x00 2250 a.out 0x0028: __do_copy_data+0x1 LDI R26, 0x60 R26=0x60 X=0x0060 2500 a.out 0x002a: __do_copy_data+0x2 LDI R27, 0x00 R27=0x00 X=0x0060 2750 a.out 0x002c: __do_copy_data+0x3 LDI R30, 0x22 R30=0x22 Z=0x0022 3000 a.out 0x002e: __do_copy_data+0x4 LDI R31, 0x01 R31=0x01 Z=0x0122 3250 a.out 0x0030: __do_copy_data+0x5 RJMP 38 3500 a.out 0x0038: .do_copy_data_start CPU-waitstate 3750 a.out 0x0038: .do_copy_data_start CPI R26, 0x60 SREG=[------Z-] 4000 a.out 0x003a: .do_copy_data_start+0x1 CPC R27, R17 SREG=[------Z-] 4250 a.out 0x003c: __SP_L__ BRNE ->0x0032 .do_copy_data_loop 4500 a.out 0x003e: __SREG__,__SP_H__,__do_clear_bss LDI R17, 0x00 R17=0x00 4750 a.out 0x0040: __SREG__,__SP_H__,__do_clear_bss+0x1 LDI R26, 0x60 R26=0x60 X=0x0060 5000 a.out 0x0042: __SREG__,__SP_H__,__do_clear_bss+0x2 LDI R27, 0x00 R27=0x00 X=0x0060 5250 a.out 0x0044: __SREG__,__SP_H__,__do_clear_bss+0x3 RJMP 48 5500 a.out 0x0048: .do_clear_bss_start CPU-waitstate
What the columns mean:
Attention: If you want to run the simulator in connection to the avr-gdb interface and run the trace in parallel you have to keep in mind that you MUST load the file in avr-gdb and also in the simulator from command-line or script. It is not possible to transfer the symbols from the ELF-file through the avr-gdb interface. For that reason you always must give the same ELF-file for avr-gdb and for simulavr. If you load another ELF-file via the avr-gdb interface to the simulator the symbols for tracing could not be updated which means that the label information in the trace output is wrong. That is not a bug, this is related to the possibilities of the avr-gdb interface.