aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-lang.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-19 17:37:15 -0700
committerTom Tromey <tom@tromey.com>2023-02-19 12:51:05 -0700
commit683aecac8c37c11d63203c96455a3d9ecf50bbe9 (patch)
treeb6cce224a94fc1f196666c310bfc921705324ca6 /gdb/rust-lang.h
parentf52688890edd7c587ec11cf1d565f235e41a6c43 (diff)
downloadbinutils-683aecac8c37c11d63203c96455a3d9ecf50bbe9.zip
binutils-683aecac8c37c11d63203c96455a3d9ecf50bbe9.tar.gz
binutils-683aecac8c37c11d63203c96455a3d9ecf50bbe9.tar.bz2
Don't allow NULL as an argument to block_scope
block_scope has special behavior when the block is NULL. Remove this and patch up the callers instead.
Diffstat (limited to 'gdb/rust-lang.h')
-rw-r--r--gdb/rust-lang.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index 89e0355..497342d 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -148,17 +148,16 @@ public:
{
struct block_symbol result = {};
+ const char *scope = block == nullptr ? "" : block_scope (block);
symbol_lookup_debug_printf
("rust_lookup_symbol_non_local (%s, %s (scope %s), %s)",
- name, host_address_to_string (block), block_scope (block),
+ name, host_address_to_string (block), scope,
domain_name (domain));
/* Look up bare names in the block's scope. */
std::string scopedname;
if (name[cp_find_first_component (name)] == '\0')
{
- const char *scope = block_scope (block);
-
if (scope[0] != '\0')
{
scopedname = std::string (scope) + "::" + name;