From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CC96F385354C; Wed, 29 Jun 2022 13:43:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC96F385354C From: "robertjenssen at ozemail dot com.au" To: gdb-prs@sourceware.org Subject: [Bug remote/27927] gdb crash with OpenOCD Date: Wed, 29 Jun 2022 13:43:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: remote X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: robertjenssen at ozemail dot com.au X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2022 13:43:47 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27927 Robert Jenssen changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |robertjenssen at ozemail d= ot com.a | |u --- Comment #13 from Robert Jenssen -= -- I have been experimenting with a "Poor Man's Profiler" with openocd-0.11.0, a local build of arm-none-eabi-gdb-12.1 and an STM32F3Discovery evaluation board. See: https://poormansprofiler.org https://interrupt.memfault.com/blog/profiling-firmware-on-cortex-m My system is: $ uname -a Linux morgawr 5.18.6-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 22 13:4= 6:18 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux The gdb version is: $ arm-none-eabi-gdb --version GNU gdb (GDB) 12.1 arm-none-eabi-gdb was built as follows: $ arm-none-eabi-gdb --configuration=20 This GDB was configured as follows: configure --host=3Dx86_64-pc-linux-gnu --target=3Darm-none-eabi --with-auto-load-dir=3D$debugdir:$datadir/auto-load --with-auto-load-safe-path=3D$debugdir:$datadir/auto-load --with-expat --with-gdb-datadir=3D/usr/local/arm-toolchain/share/gdb (relocatable) --with-jit-reader-dir=3D/usr/local/arm-toolchain/lib/gdb (relocatable) --without-libunwind-ia64 --with-lzma --without-babeltrace --with-intel-pt --with-mpfr --without-xxhash --with-python=3D/usr --with-python-libdir=3D/usr/lib --with-debuginfod --without-guile --disable-source-highlight --with-separate-debug-dir=3D/usr/local/arm-toolchain/lib/debug (relocatable) ("Relocatable" means the directory can be moved with the GDB installation tree, and GDB will still find it.) The OpenOCD version is: $ openocd --version Open On-Chip Debugger 0.11.0 OpenOCD was run as follows: openocd -c "source [find board/stm32f3discovery.cfg]; \ stm32f3x.cpu configure -rtos auto" The following shell scrip runs arm-none-eabi-gdb repeatedly: #!/bin/bash # See https://poormansprofiler.org/ # Run in another terminal: # openocd -c "source [find board/stm32f3discovery.cfg]; # stm32f3x.cpu configure -rtos auto" nsamples=3D100 sleeptime=3D1 elf=3Dbin/imu for x in $(seq 1 $nsamples); do arm-none-eabi-gdb -ex "set pagination off" \ -ex "target extended-remote :3333" \ -ex "monitor halt" \ -ex "thread apply all bt" \ -ex "monitor resume" \ -batch $elf sleep $sleeptime done | \ awk ' BEGIN { s =3D ""; } /^Thread/ { print s; s =3D ""; } /^#/ { a if (s !=3D "" ) { if ($3 =3D=3D "in") { s =3D s "," $4 } else { s = =3D s "," $2 }} else { if ($3 =3D=3D "in") { s =3D $4 } else { s =3D $2 } } } END { print s }' | \ sort | uniq -c | sort -r -n -k 1,1 Here is the output from openocd when arm-none-eabi-gdb fails: . . . Info : accepting 'gdb' connection on tcp/3333 target halted due to debug-request, current mode: Thread=20 xPSR: 0x61000000 pc: 0x08013e1c psp: 0x20001a60 Info : dropped 'gdb' connection Info : accepting 'gdb' connection on tcp/3333 target halted due to debug-request, current mode: Thread=20 xPSR: 0x61000000 pc: 0x08013e22 psp: 0x20001a60 Info : dropped 'gdb' connection Info : accepting 'gdb' connection on tcp/3333 target halted due to debug-request, current mode: Thread=20 xPSR: 0x01000000 pc: 0x08014786 psp: 0x20004728 Info : dropped 'gdb' connection Info : accepting 'gdb' connection on tcp/3333 Info : dropped 'gdb' connection Info : accepting 'gdb' connection on tcp/3333 Info : dropped 'gdb' connection Info : accepting 'gdb' connection on tcp/3333 Info : dropped 'gdb' connection Info : accepting 'gdb' connection on tcp/3333 Info : dropped 'gdb' connection . . . Before the failure I get messages from arm-none-eabi-gdb like: warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread Here is an example of the repeated output from arm-none-eabi-gdb after the failure: doc/poor_mans_profiler.sh: line 11: 159394 Aborted (core dumped) arm-none-eabi-gdb -ex "set pagination off" -ex "target extended-remote :3333" -ex "monitor halt" -ex "thread apply all bt" -ex "monitor resume" -batch $elf ../../gdb-12.1/gdb/thread.c:1328: internal-error: switch_to_thread: Assertion `thr !=3D NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x4cd402 gdb_internal_backtrace_1 ../../gdb-12.1/gdb/bt-utils.c:122 0x4cd402 _Z22gdb_internal_backtracev ../../gdb-12.1/gdb/bt-utils.c:168 0x7b6374 internal_vproblem ../../gdb-12.1/gdb/utils.c:394 0x7b65c8 _Z15internal_verrorPKciS0_P13__va_list_tag ../../gdb-12.1/gdb/utils.c:471 0x8e9171 _Z14internal_errorPKciS0_z ../../gdb-12.1/gdbsupport/errors.cc:55 0x776bff _Z16switch_to_threadP11thread_info ../../gdb-12.1/gdb/thread.c:1328 0x776bff _Z16switch_to_threadP11thread_info ../../gdb-12.1/gdb/thread.c:1326 0x6f48eb _ZN13remote_target14start_remote_1Eii ../../gdb-12.1/gdb/remote.c:4938 0x6f4e17 _ZN13remote_target12start_remoteEii ../../gdb-12.1/gdb/remote.c:5050 0x6f4e17 _ZN13remote_target6open_1EPKcii ../../gdb-12.1/gdb/remote.c:5856 0x772780 open_target ../../gdb-12.1/gdb/target.c:853 0x4fe1f4 _Z8cmd_funcP16cmd_list_elementPKci ../../gdb-12.1/gdb/cli/cli-decode.c:2514 0x77e0da _Z15execute_commandPKci ../../gdb-12.1/gdb/top.c:702 0x638f21 catch_command_errors ../../gdb-12.1/gdb/main.c:523 0x638fef execute_cmdargs ../../gdb-12.1/gdb/main.c:618 0x63ad6c captured_main_1 ../../gdb-12.1/gdb/main.c:1320 0x63b7da captured_main ../../gdb-12.1/gdb/main.c:1341 0x63b7da _Z8gdb_mainP18captured_main_args ../../gdb-12.1/gdb/main.c:1366 0x42f1b4 main ../../gdb-12.1/gdb/gdb.c:32 --------------------- This is a bug, please report it. For instructions, see: . --=20 You are receiving this mail because: You are on the CC list for the bug.=