public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "psmith at gnu dot org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug python/27315] New: Walking threads during frame display pretty-printer causes crashes Date: Tue, 02 Feb 2021 13:40:08 +0000 [thread overview] Message-ID: <bug-27315-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=27315 Bug ID: 27315 Summary: Walking threads during frame display pretty-printer causes crashes Product: gdb Version: 10.1 Status: NEW Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: psmith at gnu dot org Target Milestone: --- Created attachment 13194 --> https://sourceware.org/bugzilla/attachment.cgi?id=13194&action=edit Repro source file I can consistently make GDB either loop continuously during backtrace, or crash showing a frame, by adding a pretty-printer that queries the GDB threads() method on the inferior. Compile the attached foo.cpp file; MUST be compiled with -pthreads! $ g++ -g -ggdb3 -pthread -o foo foo.cpp Now run it to get a core: $ ./foo hiya hiya Aborted (core dumped) Now you can see the backtrace if you use GDB and it works fine: $ gdb -q -batch -ex 'bt' -c core foo [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `./foo hiya'. Program terminated with signal SIGABRT, Aborted. #0 0x00007f28af56a18b in raise () from /lib/x86_64-linux-gnu/libc.so.6 #0 0x00007f28af56a18b in raise () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007f28af549859 in abort () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x000055e3b4dc4203 in foo (f=...) at foo.cpp:13 #3 0x000055e3b4dc4256 in main (argc=2, argv=0x7ffe1045c1c8) at foo.cpp:20 Now try the same thing using the attached pretty-printer: $ gdb -q -x foo.py -batch -ex 'bt' -c core foo On my system this will recursively try to print the backtrace over and over for a while, after which it will either "succeed", or GDB will dump core with: gdb/frame.c:2467: internal-error: bool get_frame_pc_if_available(frame_info*, CORE_ADDR*): Assertion `frame->next != NULL' failed. If you change the pretty-printer implementation from: gdb.selected_inferior().threads() to just: gdb.selected_inferior() it works fine again. Also if I edited gdb/ptyhon/py-inferior.c and removed the update_thread_list() call changing: try { update_thread_list (); } catch (const gdb_exception &except) { to: try { // update_thread_list (); } catch (const gdb_exception &except) { it also works fine. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2021-02-02 13:40 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-02 13:40 psmith at gnu dot org [this message] 2021-02-02 13:40 ` [Bug python/27315] " psmith at gnu dot org 2021-02-02 14:29 ` simark at simark dot ca 2021-02-02 14:37 ` simark at simark dot ca 2022-02-21 1:34 ` psmith at gnu dot org 2023-08-01 18:18 ` tromey at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-27315-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).