From 2b93b18646d53cc9ab3a6342dc8ceea9cc08efbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Wed, 20 Feb 2019 00:00:00 +0000 Subject: [PATCH] run: --trace-insts-stdout --- README.adoc | 17 ++++++++++++++--- run | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index 88158b9..a4084dc 100644 --- a/README.adoc +++ b/README.adoc @@ -3110,7 +3110,7 @@ where `build` builds the whole toolchain for us. `./run --userland` path resolution is analogous to <>. -`./build user-mode-qemu` first builds Buildroot, and then runs `./build-userland`, which is further documented at: <>. +`./build user-mode-qemu` first builds Buildroot, and then runs `./build-userland`, which is further documented at: <>. It also builds QEMU. ==== User mode simulation with glibc @@ -9057,12 +9057,23 @@ Output the trace to stdout instead of a file: --arch aarch64 \ --emulator gem5 \ --eval 'm5 exit' \ - --trace Exec \ + --trace ExecAll \ --trace-stdout \ ; .... -This would produce a lot of output however, so you will likely not want that when tracing a Linux kernel boot instructions. But it can be very convenient for smaller traces. +We also have a shortcut for `--trace ExecAll -trace-stdout` with `--trace-insts-stdout` + +.... +./run \ + --arch aarch64 \ + --emulator gem5 \ + --eval 'm5 exit' \ + --trace-insts-stdout \ +; +.... + +This would produce a lot of output however, so you will likely not want that when tracing a Linux kernel boot instructions. But it can be very convenient for smaller traces such as <>. List all available debug flags: diff --git a/run b/run index 41e7827..897ef6e 100755 --- a/run +++ b/run @@ -160,9 +160,17 @@ rare and don't affect performance, because `./configure ''' ) self.add_argument( - '--trace-stdout', default=False, + '--trace-stdout', + default=False, help='''\ Output trace to stdout instead of a file. Only works for gem5 currently. +''' + ) + self.add_argument( + '--trace-insts-stdout', + default=False, + help='''\ +Trace instructions run to stdout. Shortcut for --trace --trace-stdout. ''' ) self.add_argument( @@ -274,6 +282,12 @@ Run QEMU with VNC instead of the default SDL. Connect to it with: if kernel_cli_after_dash: kernel_cli += " -{}".format(kernel_cli_after_dash) extra_env = {} + if self.env['trace_insts_stdout']: + if self.env['emulator'] == 'qemu': + extra_emulator_args.extend(['-d', 'in_asm', LF]) + elif self.env['emulator'] == 'gem5': + self.env['trace_stdout'] = True + self.env['trace'] = 'ExecAll' if self.env['trace'] is None: do_trace = False # A dummy value that is already turned on by default and does not produce large output,