mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
run: OK, I give in, --debug-vm-file is on
This commit is contained in:
@@ -9922,6 +9922,15 @@ Or for a faster development loop:
|
|||||||
./run --debug-vm-args '-ex "break qemu_add_opts" -ex "run"'
|
./run --debug-vm-args '-ex "break qemu_add_opts" -ex "run"'
|
||||||
....
|
....
|
||||||
|
|
||||||
|
Or if things get really involved and you want a debug script:
|
||||||
|
|
||||||
|
....
|
||||||
|
printf 'break qemu_add_opts
|
||||||
|
run
|
||||||
|
' > data/vm.gdb
|
||||||
|
./run --debug-vm-file data/vm.gdb
|
||||||
|
....
|
||||||
|
|
||||||
Our default emulator builds are optimized with `gcc -O2 -g`. To use `-O0` instead, build and run with:
|
Our default emulator builds are optimized with `gcc -O2 -g`. To use `-O0` instead, build and run with:
|
||||||
|
|
||||||
....
|
....
|
||||||
|
|||||||
17
run
17
run
@@ -38,12 +38,20 @@ Ctrl + C kills the QEMU simulator instead of being passed to the guest.
|
|||||||
help='''\
|
help='''\
|
||||||
Run GDB on the emulator itself.
|
Run GDB on the emulator itself.
|
||||||
For --emulator native, this debugs the target program.
|
For --emulator native, this debugs the target program.
|
||||||
|
See also: https://cirosantilli.com/linux-kernel-module-cheat#debug-the-emulator
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
self.add_argument(
|
self.add_argument(
|
||||||
'--debug-vm-args',
|
'--debug-vm-args',
|
||||||
default='',
|
default='',
|
||||||
help='Pass arguments to GDB. Implies --debug-vm.'
|
help='Like --debug-vm, but also pass arguments to GDB'
|
||||||
|
)
|
||||||
|
self.add_argument(
|
||||||
|
'--debug-vm-file',
|
||||||
|
help='''\
|
||||||
|
Like --debug-vm, but also source this file. Equivalent to
|
||||||
|
--debug-vm-args='-ex "source $file"'.
|
||||||
|
'''
|
||||||
)
|
)
|
||||||
self.add_argument(
|
self.add_argument(
|
||||||
'--debug-vm-rr',
|
'--debug-vm-rr',
|
||||||
@@ -362,8 +370,11 @@ Extra options to append at the end of the emulator command line.
|
|||||||
self.env['tmux'] = True
|
self.env['tmux'] = True
|
||||||
if self.env['debug_vm_rr']:
|
if self.env['debug_vm_rr']:
|
||||||
debug_vm = ['rr', 'record']
|
debug_vm = ['rr', 'record']
|
||||||
elif self.env['debug_vm'] or self.env['debug_vm_args']:
|
elif self.env['debug_vm'] or self.env['debug_vm_args'] or self.env['debug_vm_file']:
|
||||||
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'])
|
||||||
|
if self.env['debug_vm_file'] is not None:
|
||||||
|
debug_vm.extend(['-ex', 'source {}'.format(self.env['debug_vm_file']), LF])
|
||||||
|
debug_vm.extend(['--args', LF])
|
||||||
else:
|
else:
|
||||||
debug_vm = []
|
debug_vm = []
|
||||||
if self.env['gdb_wait']:
|
if self.env['gdb_wait']:
|
||||||
|
|||||||
Reference in New Issue
Block a user