From 683aecac8c37c11d63203c96455a3d9ecf50bbe9 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 19 Jan 2023 17:37:15 -0700 Subject: 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. --- gdb/rust-lang.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gdb/rust-lang.h') 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; -- cgit v1.1