mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 20:14:27 +01:00
run: create --tmux-program gdb to open gem5 GDB
This commit is contained in:
16
README.adoc
16
README.adoc
@@ -1426,13 +1426,25 @@ Bibliography: https://unix.stackexchange.com/questions/152738/how-to-split-a-new
|
|||||||
|
|
||||||
==== tmux gem5
|
==== tmux gem5
|
||||||
|
|
||||||
If you are using gem5 instead of QEMU, `--tmux` has a different effect: it opens the gem5 terminal instead of the debugger:
|
If you are using gem5 instead of QEMU, `--tmux` has a different effect by default: it opens the gem5 terminal instead of the debugger:
|
||||||
|
|
||||||
....
|
....
|
||||||
./run --emulator gem5 --tmux
|
./run --emulator gem5 --tmux
|
||||||
....
|
....
|
||||||
|
|
||||||
If you also want to use the debugger with gem5, you will need to create new terminals as usual.
|
To open a new pane with GDB instead of the terminal, use:
|
||||||
|
|
||||||
|
....
|
||||||
|
./run --emulator gem5 --gdb-wait --tmux --tmux-program gdb
|
||||||
|
....
|
||||||
|
|
||||||
|
`--tmux-program` implies `--tmux`, so we can just write:
|
||||||
|
|
||||||
|
....
|
||||||
|
./run --emulator gem5 --gdb-wait --tmux-program gdb
|
||||||
|
....
|
||||||
|
|
||||||
|
If you also want to see both GDB and the terminal with gem5, then you will need to open a separate shell manuall as usual with `./gem5-shell`.
|
||||||
|
|
||||||
From inside tmux, you can do that with `Ctrl-B C` or `Ctrl-B %`.
|
From inside tmux, you can do that with `Ctrl-B C` or `Ctrl-B %`.
|
||||||
|
|
||||||
|
|||||||
28
run
28
run
@@ -278,6 +278,15 @@ See: https://github.com/cirosantilli/linux-kernel-module-cheat#tmux
|
|||||||
'--tmux-args',
|
'--tmux-args',
|
||||||
help='''\
|
help='''\
|
||||||
Parameters to pass to the program running on the tmux split. Implies --tmux.
|
Parameters to pass to the program running on the tmux split. Implies --tmux.
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
self.add_argument(
|
||||||
|
'--tmux-program',
|
||||||
|
choices=('gdb', 'shell'),
|
||||||
|
help='''\
|
||||||
|
Which program to run in tmux. Implies --tmux. Defaults:
|
||||||
|
* 'gdb' in qemu
|
||||||
|
* 'shell' in gem5. 'shell' is only supported in gem5 currently.
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
self.add_argument(
|
self.add_argument(
|
||||||
@@ -312,8 +321,13 @@ Extra options to append at the end of the emulator command line.
|
|||||||
kernel_cli_after_dash = ' lkmc_home={}'.format(self.env['guest_lkmc_home'])
|
kernel_cli_after_dash = ' lkmc_home={}'.format(self.env['guest_lkmc_home'])
|
||||||
extra_emulator_args = []
|
extra_emulator_args = []
|
||||||
extra_qemu_args = []
|
extra_qemu_args = []
|
||||||
if self.env['tmux_args'] is not None:
|
if self.env['tmux_args'] is not None or self.env['_args_given']['tmux_program']:
|
||||||
self.env['tmux'] = True
|
self.env['tmux'] = True
|
||||||
|
if not self.env['_args_given']['tmux_program']:
|
||||||
|
if self.env['emulator'] == 'qemu':
|
||||||
|
self.env['tmux_program'] = 'gdb'
|
||||||
|
elif self.env['emulator'] == 'gem5':
|
||||||
|
self.env['tmux_program'] = 'shell'
|
||||||
if self.env['debug_vm'] or self.env['debug_vm_args']:
|
if self.env['debug_vm'] or self.env['debug_vm_args']:
|
||||||
debug_vm = ['gdb', LF, '-q', LF] + self.sh.shlex_split(self.env['debug_vm_args']) + ['--args', LF]
|
debug_vm = ['gdb', LF, '-q', LF] + self.sh.shlex_split(self.env['debug_vm_args']) + ['--args', LF]
|
||||||
else:
|
else:
|
||||||
@@ -659,16 +673,20 @@ Extra options to append at the end of the emulator command line.
|
|||||||
cmd.extend(append)
|
cmd.extend(append)
|
||||||
if self.env['tmux']:
|
if self.env['tmux']:
|
||||||
tmux_args = '--run-id {}'.format(self.env['run_id'])
|
tmux_args = '--run-id {}'.format(self.env['run_id'])
|
||||||
if self.env['emulator'] == 'gem5':
|
if self.env['tmux_program'] == 'shell':
|
||||||
tmux_cmd = './gem5-shell'
|
if self.env['emulator'] == 'gem5':
|
||||||
else:
|
tmux_cmd = './gem5-shell'
|
||||||
|
else:
|
||||||
|
raise Exception('--tmux-program is only supported in gem5 currently.')
|
||||||
|
elif self.env['tmux_program'] == 'gdb':
|
||||||
tmux_cmd = './run-gdb'
|
tmux_cmd = './run-gdb'
|
||||||
# TODO find a nicer way to forward all those args automatically.
|
# TODO find a nicer way to forward all those args automatically.
|
||||||
# Part of me wants to: https://github.com/jonathanslenders/pymux
|
# Part of me wants to: https://github.com/jonathanslenders/pymux
|
||||||
# but it cannot be used as a library properly it seems, and it is
|
# but it cannot be used as a library properly it seems, and it is
|
||||||
# slower than tmux.
|
# slower than tmux.
|
||||||
tmux_args += " --arch {} --linux-build-id '{}' --run-id '{}' --userland-build-id '{}'".format(
|
tmux_args += " --arch {} --emulator '{}' --linux-build-id '{}' --run-id '{}' --userland-build-id '{}'".format(
|
||||||
self.env['arch'],
|
self.env['arch'],
|
||||||
|
self.env['emulator'],
|
||||||
self.env['linux_build_id'],
|
self.env['linux_build_id'],
|
||||||
self.env['run_id'],
|
self.env['run_id'],
|
||||||
self.env['userland_build_id'],
|
self.env['userland_build_id'],
|
||||||
|
|||||||
Reference in New Issue
Block a user