mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
Fix printing of global variable stubs if no inferior is running
Since 3c45e9f915 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>
This commit is contained in:
@@ -1027,7 +1027,11 @@ cp_lookup_transparent_type (const char *name)
|
||||
|
||||
/* If that doesn't work and we're within a namespace, look there
|
||||
instead. */
|
||||
scope = get_selected_block (0)->scope ();
|
||||
const block *block = get_selected_block (0);
|
||||
if (block == nullptr)
|
||||
return nullptr;
|
||||
|
||||
scope = block->scope ();
|
||||
|
||||
if (scope[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user