From 0edf7575cd0009487c8fbe7bd0f4fde31a9322f7 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: Fri, 26 Oct 2018 00:00:05 +0000 Subject: [PATCH] gem5: update to d4b3e064adeeace3c3e7d106801f95c14637c12f Mostly for --param to control debug properly. Less README workarounds, more ./run automation, oh yeah. --- README.adoc | 43 ----------------------- baremetal/arch/arm/no_bootloader/m5exit.S | 3 ++ patches/manual/gem5-wait-gdb.patch | 11 ------ run | 3 ++ submodules/gem5 | 2 +- 5 files changed, 7 insertions(+), 55 deletions(-) create mode 100644 baremetal/arch/arm/no_bootloader/m5exit.S delete mode 100644 patches/manual/gem5-wait-gdb.patch diff --git a/README.adoc b/README.adoc index 58339bc..42b28b8 100644 --- a/README.adoc +++ b/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: <>. -==== 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 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 .... -gem5 step debug requires a patch as mentioned at <>: - -.... -patch -d "$(./getvar gem5_src_dir)" -p 1 < patches/manual/gem5-wait-gdb.patch -.... - and then proceed as usual: .... diff --git a/baremetal/arch/arm/no_bootloader/m5exit.S b/baremetal/arch/arm/no_bootloader/m5exit.S new file mode 100644 index 0000000..4122d2a --- /dev/null +++ b/baremetal/arch/arm/no_bootloader/m5exit.S @@ -0,0 +1,3 @@ +.global mystart +mystart: + mov r0, #0; mov r1, #0; .inst 0xEE000110 | (0x21 << 16); diff --git a/patches/manual/gem5-wait-gdb.patch b/patches/manual/gem5-wait-gdb.patch deleted file mode 100644 index 3c77b57..0000000 --- a/patches/manual/gem5-wait-gdb.patch +++ /dev/null @@ -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) diff --git a/run b/run index 2dcc118..bd67fd1 100755 --- a/run +++ b/run @@ -183,6 +183,9 @@ def main(args, extra_args=None): elif args.gem5_script == 'se': assert(args.exec_image is not None) 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: if not os.path.exists(common.image): raise_image_not_found() diff --git a/submodules/gem5 b/submodules/gem5 index 7bfb7f3..d4b3e06 160000 --- a/submodules/gem5 +++ b/submodules/gem5 @@ -1 +1 @@ -Subproject commit 7bfb7f3a43f382eb49853f47b140bfd6caad0fb8 +Subproject commit d4b3e064adeeace3c3e7d106801f95c14637c12f