mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
gem5: update to d4b3e064adeeace3c3e7d106801f95c14637c12f
Mostly for --param to control debug properly. Less README workarounds, more ./run automation, oh yeah.
This commit is contained in:
43
README.adoc
43
README.adoc
@@ -8947,43 +8947,6 @@ When you want to break, just do a `Ctrl-C` on GDB shell, and then `continue`.
|
|||||||
|
|
||||||
And we now see the boot messages, and then get a shell. Now try the `/count.sh` procedure described for QEMU: <<gdb-step-debug-kernel-post-boot>>.
|
And we now see the boot messages, and then get a shell. Now try the `/count.sh` procedure described for QEMU: <<gdb-step-debug-kernel-post-boot>>.
|
||||||
|
|
||||||
==== gem5 wait for GDB to connect before running
|
|
||||||
|
|
||||||
By default, gem5 does not wait for GDB to connect, which means that you might go past your point of interest.
|
|
||||||
|
|
||||||
This can however be enabled with the `wait_for_remote_gdb` option:
|
|
||||||
|
|
||||||
....
|
|
||||||
patch -d "$(./getvar gem5_src_dir)" -p 1 < patches/manual/gem5-wait-gdb.patch
|
|
||||||
....
|
|
||||||
|
|
||||||
Just just proceed as usual:
|
|
||||||
|
|
||||||
....
|
|
||||||
./run --gem5
|
|
||||||
....
|
|
||||||
|
|
||||||
TODO why is this required, on another shell:
|
|
||||||
|
|
||||||
....
|
|
||||||
./gem5-shell
|
|
||||||
....
|
|
||||||
|
|
||||||
and finally:
|
|
||||||
|
|
||||||
....
|
|
||||||
./run-gdb --gem5 start_kernel
|
|
||||||
....
|
|
||||||
|
|
||||||
If I don't connect to the other shell on baremetal, the simulation breaks with:
|
|
||||||
|
|
||||||
....
|
|
||||||
....
|
|
||||||
|
|
||||||
You have to remove the patch if you want to go back to running without waiting for GDB to connect.
|
|
||||||
|
|
||||||
Bibliography: https://stackoverflow.com/questions/49296092/how-to-make-gem5-wait-for-gdb-to-connect-to-reliably-break-at-start-kernel-of-th
|
|
||||||
|
|
||||||
===== gem5 GDB step debug kernel aarch64
|
===== gem5 GDB step debug kernel aarch64
|
||||||
|
|
||||||
TODO: GDB fails with:
|
TODO: GDB fails with:
|
||||||
@@ -10027,12 +9990,6 @@ Alternatively, skip directly to the C program main function with:
|
|||||||
./run-gdb --arch arm --baremetal prompt main
|
./run-gdb --arch arm --baremetal prompt main
|
||||||
....
|
....
|
||||||
|
|
||||||
gem5 step debug requires a patch as mentioned at <<gem5-wait-for-gdb-to-connect-before-running>>:
|
|
||||||
|
|
||||||
....
|
|
||||||
patch -d "$(./getvar gem5_src_dir)" -p 1 < patches/manual/gem5-wait-gdb.patch
|
|
||||||
....
|
|
||||||
|
|
||||||
and then proceed as usual:
|
and then proceed as usual:
|
||||||
|
|
||||||
....
|
....
|
||||||
|
|||||||
3
baremetal/arch/arm/no_bootloader/m5exit.S
Normal file
3
baremetal/arch/arm/no_bootloader/m5exit.S
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.global mystart
|
||||||
|
mystart:
|
||||||
|
mov r0, #0; mov r1, #0; .inst 0xEE000110 | (0x21 << 16);
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
diff --git a/configs/example/fs.py b/configs/example/fs.py
|
|
||||||
index 3997ed76c..b4267ebc0 100644
|
|
||||||
--- a/configs/example/fs.py
|
|
||||||
+++ b/configs/example/fs.py
|
|
||||||
@@ -376,5 +376,6 @@ if buildEnv['TARGET_ISA'] == "arm" and options.generate_dtb:
|
|
||||||
sys = getattr(root, sysname)
|
|
||||||
sys.dtb_filename = create_dtb_for_system(sys, '%s.dtb' % sysname)
|
|
||||||
|
|
||||||
+test_sys.cpu[0].wait_for_remote_gdb = True
|
|
||||||
Simulation.setWorkCountOptions(test_sys, options)
|
|
||||||
Simulation.run(options, root, test_sys, FutureClass)
|
|
||||||
3
run
3
run
@@ -183,6 +183,9 @@ def main(args, extra_args=None):
|
|||||||
elif args.gem5_script == 'se':
|
elif args.gem5_script == 'se':
|
||||||
assert(args.exec_image is not None)
|
assert(args.exec_image is not None)
|
||||||
cmd += [common.gem5_se_file, '-c', args.exec_image]
|
cmd += [common.gem5_se_file, '-c', args.exec_image]
|
||||||
|
if args.debug_guest:
|
||||||
|
# https://stackoverflow.com/questions/49296092/how-to-make-gem5-wait-for-gdb-to-connect-to-reliably-break-at-start-kernel-of-th
|
||||||
|
cmd += ['--param', 'system.cpu[0].wait_for_remote_gdb = True']
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(common.image):
|
if not os.path.exists(common.image):
|
||||||
raise_image_not_found()
|
raise_image_not_found()
|
||||||
|
|||||||
Submodule submodules/gem5 updated: 7bfb7f3a43...d4b3e064ad
Reference in New Issue
Block a user