From 4ae3dea975537bb88778d4c367bdea3b0a2a96e5 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: Tue, 22 Jan 2019 00:00:00 +0000 Subject: [PATCH] run: --tmux-args implies --tmux --- README.adoc | 11 +++++------ common.py | 4 +++- run | 6 ++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.adoc b/README.adoc index c27f30c..ac9d9d1 100644 --- a/README.adoc +++ b/README.adoc @@ -968,7 +968,7 @@ This automatically clears the GDB pane, and starts a new one. Pass extra GDB arguments with: .... -./run --wait-gdb --tmux --tmux-args start_kernel +./run --wait-gdb --tmux-args start_kernel .... See the tmux manual for further details: @@ -2994,7 +2994,6 @@ Or alternatively, if you are using <>, do everything in one go with: ./run \ --arch aarch64 \ --userland print_argv \ - --tmux \ --tmux-args main \ --wait-gdb \ -- \ @@ -5127,7 +5126,7 @@ If `CONFIG_KALLSYMS=n`, then addresses are shown on traces instead of symbol plu In v4.16 it does not seem possible to configure that at runtime. GDB step debugging with: .... -./run --eval-after 'insmod /dump_stack.ko' --wait-gdb --tmux --tmux-args dump_stack +./run --eval-after 'insmod /dump_stack.ko' --wait-gdb --tmux-args dump_stack .... shows that traces are printed at `arch/x86/kernel/dumpstack.c`: @@ -10350,13 +10349,13 @@ then on the second shell: Or if you are a <>, do everything in one go with: .... -./run --arch arm --baremetal interactive/prompt --wait-gdb --tmux --tmux-args main +./run --arch arm --baremetal interactive/prompt --wait-gdb --tmux-args main .... Alternatively, to start from the very first executed instruction of our tiny <>: .... -./run --arch arm --baremetal interactive/prompt --wait-gdb --tmux --tmux-args --no-continue +./run --arch arm --baremetal interactive/prompt --wait-gdb --tmux-args --no-continue .... Now you can just `stepi` to when jumping into main to go to the C code in link:baremetal/interactive/prompt.c[]. @@ -10364,7 +10363,7 @@ Now you can just `stepi` to when jumping into main to go to the C code in link:b This is specially interesting for the executables that don't use the bootloader from under `baremetal/arch//no_bootloader/*.S`, e.g.: .... -./run --arch arm --baremetal arch/arm/no_bootloader/semihost_exit --wait-gdb --tmux --tmux-args --no-continue +./run --arch arm --baremetal arch/arm/no_bootloader/semihost_exit --wait-gdb --tmux-args --no-continue .... The cool thing about those examples is that you start at the very first instruction of your program, which gives more control. diff --git a/common.py b/common.py index 6433f0f..ab54e35 100644 --- a/common.py +++ b/common.py @@ -518,7 +518,7 @@ Use gem5 instead of QEMU. Shortcut for `--emulator gem5`. env['rootfs_raw_file'] = env['buildroot_rootfs_raw_file'] env['qcow2_file'] = env['buildroot_qcow2_file'] - # Image. + # Image if env['baremetal'] is None: if env['emulator'] == 'gem5': env['image'] = env['vmlinux'] @@ -547,8 +547,10 @@ Use gem5 instead of QEMU. Shortcut for `--emulator gem5`. env['source_path'] = source_path break env['image'] = path + self.env = env + def add_argument(self, *args, **kwargs): shortname, longname, key, is_option = self.get_key(*args, **kwargs) if key in self._defaults: diff --git a/run b/run index ceb16dc..622801d 100755 --- a/run +++ b/run @@ -64,7 +64,7 @@ See: https://github.com/cirosantilli/linux-kernel-module-cheat#replace-init Pass an extra Linux kernel command line options, and place them before the dash separator `-`. Only options that come before the `-`, i.e. "standard" options, should be passed with this option. -Example: `./run -a arm -e 'init=/poweroff.out'` +Example: `./run --arch arm --kernel-cli 'init=/poweroff.out'` ''' ) self.add_argument( @@ -178,7 +178,7 @@ to use this option: self.add_argument( '--tmux-args', help='''\ -Parameters to pass to the program running on the tmux split. +Parameters to pass to the program running on the tmux split. Implies --tmux. ''' ) self.add_argument( @@ -559,6 +559,8 @@ Run QEMU with VNC instead of the default SDL. Connect to it with: ) if self.env['baremetal'] is None: cmd.extend(append) + if self.env['tmux_args'] is not None: + self.env['tmux'] = True if self.env['tmux']: tmux_args = '--run-id {}'.format(self.env['run_id']) if self.env['emulator'] == 'gem5':