It can be reproduced with this source: ``` struct S { S (int); virtual ~S (); int m_i; }; S s (5); int main () { return 0; } ``` And then just debugging the compiled object file: ``` $ g++ -g -c print-global-stub.cc $ gdb -q print-global-stub.o Reading symbols from print-global-stub.o... (gdb) p s This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ```
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=576745e26c0ec76a53ba45b20af464628a50b3e4 commit 576745e26c0ec76a53ba45b20af464628a50b3e4 Author: Hannes Domani <ssbssa@yahoo.de> Date: Fri Dec 8 19:06:14 2023 +0100 Fix printing of global variable stubs if no inferior is running Since 3c45e9f915ae4aeab7312d6fc55a947859057572 gdb crashes when trying to print a global variable stub without a running inferior, because of a missing nullptr-check (the block_scope function took care of that check before it was converted to a method). With this check it works again: ``` (gdb) print s $1 = <incomplete type> ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31128 Approved-By: Tom Tromey <tom@tromey.com>
The gdb-14-branch branch has been updated by Hannes Domani <ssbssa@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bc23ea51f8a83e9524dfb553baa8baacb29e68a9 commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9 Author: Hannes Domani <ssbssa@yahoo.de> Date: Fri Dec 8 19:06:14 2023 +0100 Fix printing of global variable stubs if no inferior is running Since 3c45e9f915ae4aeab7312d6fc55a947859057572 gdb crashes when trying to print a global variable stub without a running inferior, because of a missing nullptr-check (the block_scope function took care of that check before it was converted to a method). With this check it works again: ``` (gdb) print s $1 = <incomplete type> ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31128 Approved-By: Tom Tromey <tom@tromey.com> (cherry picked from commit 576745e26c0ec76a53ba45b20af464628a50b3e4)
Fixed.
*** Bug 31226 has been marked as a duplicate of this bug. ***
*** Bug 31560 has been marked as a duplicate of this bug. ***