From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from icp-osb-irony-out6.external.iinet.net.au (icp-osb-irony-out6.external.iinet.net.au [203.59.1.106]) by sourceware.org (Postfix) with ESMTP id B2C5B386F0F1 for ; Mon, 27 Jun 2022 10:50:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2C5B386F0F1 IronPort-SDR: tiXNuGiUz52HXhaF/sy0W9JDWn+IZHGso2nmc/lGZySldVZwOrS28W1ptCkP89tmRbL5hYieD/ MmaUs1IoZfgoZ7YyndL1nXrcAJHQ18cxmuALxvNsAZibgvbeGisUIUC62cjPb3pqI+Qgn2+TYS kRUkjI3PtutcDgohD3iJKRVr7KgARwExd4GFZokvUfEWHjXJZJY4LI4wo4Idt6Uie/FGWn+krK uZTmHeHsECdgcNxUrKBAJjUH6O8DvdkMgR6dqREwfHeIdxObTT22Wh0aIpuNGGKzV1kCOsayGa Lf0= X-SMTP-MATCH: 1 IronPort-Data: A9a23:X3DCUKssD28Zrmol0ZdtPD690efnVLpcMUV32f8akzHdYApBsoF/q tZmKVkyQEty1hlBgm0KGI+zxf6LyZfVzubXKLe1nJ1UZyoiRfDtXLx1FW+teXLIRiH/ZBg/t Z9GNIOfdJlcokL0/X9BDJCw9RGQ6onVHtIQOMacUsymbVY5IMuJoUsLd98R2uaEs/Dga+++k YqaT/nkBbOQ82Uc3lT4Sk60gEgHUPza4Fv0t3RiPqoT5Ae2e3M9VPrzLonpR5f0atUPRLbiH 44vwZnhll418SvBBfv+k6ikX0AmEoXUYwaUlnhrB/CYoDVN83laPqYTbJLwaG9SjC+Gls9ro DlPncXpGUFzZ/SKwbtMFUACS0mSPoUfkFPDCWK4u8GJ00/LdWD3zvNGC1M7OIQZ/qB8BmQI/ OFwxDUlNU7T27zunujiIgVqruQOM+vAIYwZgGN9wmj+M+4DQp/jGJyfsLe02x913KiiB832Y NQUcyFiYQ7bSwZIJ00cBY03hurugWPwGwC0s3rM/PpyuTGKiVUugf20aoKTZsSFRINemUPer 3+uE3nFPyz2/ee3kVKtmk9ATMeW9c8ncOr+zIGFy8M= IronPort-HdrOrdr: A9a23:Wzx9E6iYMt0degLm7FjtGqRuw3BQXj0ji2hC6mlwRA09TyX4rb HWoB11726WtN98YgBDpTniAtjnfZq/z+8Q3WB5B97LN2OLhILPFvAG0WKI+VPd8kPFmdK08M 9bAtAOc6yLfCUK8foTEGSDfurJCrS8gd+VbRWy9QYacemVBpsQnzuQbGygYwVLrXF9dP0E/E z13Kp6T3bMQxUqhvbSPAh3YwD0z+e75q4PlHM9dmkaAPTit0Lg1FbMeyLoqyv3ZV50sMkfGa CpqX2J2k1Y3svLviPh6w== X-IronPort-AV: E=Sophos;i="5.92,226,1650902400"; d="scan'208";a="368460621" Received: from 118-211-179-120.tpgi.com.au (HELO morgawr) ([118.211.179.120]) by icp-osb-irony-out6.iinet.net.au with ESMTP; 27 Jun 2022 18:50:15 +0800 Date: Mon, 27 Jun 2022 20:50:14 +1000 From: Robert Jenssen To: overseers@sourceware.org Subject: Bug 27927 - gdb crash with OpenOCD Message-ID: <20220627205014.577d695e@morgawr> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: overseers@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Overseers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 10:50:24 -0000 Hi, I would like to add a comment to Bug#27927 but require a login to do so. 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 arm-none-eabi-gdb was built as follows: $ arm-none-eabi-gdb --configuration This GDB was configured as follows: configure --host=x86_64-pc-linux-gnu --target=arm-none-eabi --with-auto-load-dir=$debugdir:$datadir/auto-load --with-auto-load-safe-path=$debugdir:$datadir/auto-load --with-expat --with-gdb-datadir=/usr/local/arm-toolchain/share/gdb (relocatable) --with-jit-reader-dir=/usr/local/arm-toolchain/lib/gdb (relocatable) --without-libunwind-ia64 --with-lzma --without-babeltrace --with-intel-pt --with-mpfr --without-xxhash --with-python=/usr --with-python-libdir=/usr/lib --with-debuginfod --without-guile --disable-source-highlight --with-separate-debug-dir=/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.) 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=100 sleeptime=1 elf=bin/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 = ""; } /^Thread/ { print s; s = ""; } /^#/ { a if (s != "" ) { if ($3 == "in") { s = s "," $4 } else { s = s "," $2 }} else { if ($3 == "in") { s = $4 } else { s = $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 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 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 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 != 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: .