]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix printing of global variable stubs if no inferior is running
authorHannes Domani <ssbssa@yahoo.de>
Fri, 8 Dec 2023 18:06:14 +0000 (19:06 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 8 Dec 2023 18:09:21 +0000 (19:09 +0100)
commitbc23ea51f8a83e9524dfb553baa8baacb29e68a9
tree921a599a4fd32bccee0e69febf821a136e8b10bc
parent6af9acfdcd6e8eaadcc9a6a4d55d29883b765272
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)
gdb/cp-namespace.c
gdb/testsuite/gdb.cp/print-global-stub.cc [new file with mode: 0644]
gdb/testsuite/gdb.cp/print-global-stub.exp [new file with mode: 0644]