Skip to content

Commit 155357f

Browse files
committed
qemu: document -d -D trace options
1 parent 6d51da5 commit 155357f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.adoc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7013,6 +7013,8 @@ The most interesting are events which show instructions that QEMU ran, for which
70137013
./trace-boot -a x86_64
70147014
....
70157015

7016+
Under the hood, this uses QEMU's `-trace` option.
7017+
70167018
You can then inspect the instructions with:
70177019

70187020
....
@@ -7056,6 +7058,38 @@ Call Trace:
70567058
in which the boot appears to hang for a considerable time.
70577059
* patch QEMU source to remove the `disable` from `exec_tb` in the `trace-events` file. See also: https://rwmj.wordpress.com/2016/03/17/tracing-qemu-guest-execution/
70587060

7061+
==== QEMU -d tracing
7062+
7063+
QEMU also has a second trace mechanism in addition to `-trace`, find out the events with:
7064+
7065+
....
7066+
./run -- -d help
7067+
....
7068+
7069+
Let's pick the one that dumps executed instructions, `in_asm`:
7070+
7071+
....
7072+
./run -E '/poweroff.out' -- -D out/trace.txt -d in_asm
7073+
less out/trace.txt
7074+
....
7075+
7076+
Sample output excerpt:
7077+
7078+
....
7079+
----------------
7080+
IN:
7081+
0xfffffff0: ea 5b e0 00 f0 ljmpw $0xf000:$0xe05b
7082+
7083+
----------------
7084+
IN:
7085+
0x000fe05b: 2e 66 83 3e 88 61 00 cmpl $0, %cs:0x6188
7086+
0x000fe062: 0f 85 7b f0 jne 0xd0e1
7087+
....
7088+
7089+
TODO: after `IN:`, symbol names are meant to show, which is awesome, but I don't get any. I do see them however when running a bare metal example from: https://github.com/cirosantilli/newlib-examples/tree/900a9725947b1f375323c7da54f69e8049158881
7090+
7091+
TODO: what is the point of having two mechanisms, `-trace` and `-d`? `-d` tracing is cool because it does not require a messy recompile, and it can also show symbols.
7092+
70597093
==== Trace source lines
70607094

70617095
We can further use Binutils' `addr2line` to get the line that corresponds to each address:

0 commit comments

Comments
 (0)