From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/8] Move rust_language::lookup_symbol_nonlocal
Date: Tue, 22 Aug 2023 09:25:07 -0600 [thread overview]
Message-ID: <20230822-array-and-string-like-v1-1-2dcea29b0567@adacore.com> (raw)
In-Reply-To: <20230822-array-and-string-like-v1-0-2dcea29b0567@adacore.com>
This moves rust_language::lookup_symbol_nonlocal to rust-lang.c.
There's no need to have it in rust-lang.h and moving it lets us avoid
adding new includes in a later patch.
---
gdb/rust-lang.c | 37 +++++++++++++++++++++++++++++++++++++
gdb/rust-lang.h | 32 +-------------------------------
2 files changed, 38 insertions(+), 31 deletions(-)
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 5eb33d0d3b7..f56aa94a48a 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1684,6 +1684,43 @@ rust_language::is_string_type_p (struct type *type) const
&& strcmp (type->name (), "&str") == 0));
}
+/* See language.h. */
+
+struct block_symbol
+rust_language::lookup_symbol_nonlocal
+ (const char *name, const struct block *block,
+ const domain_enum domain) const
+{
+ struct block_symbol result = {};
+
+ const char *scope = block == nullptr ? "" : block->scope ();
+ symbol_lookup_debug_printf
+ ("rust_lookup_symbol_non_local (%s, %s (scope %s), %s)",
+ 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')
+ {
+ if (scope[0] != '\0')
+ {
+ scopedname = std::string (scope) + "::" + name;
+ name = scopedname.c_str ();
+ }
+ else
+ name = NULL;
+ }
+
+ if (name != NULL)
+ {
+ result = lookup_symbol_in_static_block (name, block, domain);
+ if (result.symbol == NULL)
+ result = lookup_global_symbol (name, block, domain);
+ }
+ return result;
+}
+
/* Single instance of the Rust language class. */
static rust_language rust_language_defn;
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index efe721c5707..85c93a9dcec 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -144,37 +144,7 @@ class rust_language : public language_defn
struct block_symbol lookup_symbol_nonlocal
(const char *name, const struct block *block,
- const domain_enum domain) const override
- {
- struct block_symbol result = {};
-
- const char *scope = block == nullptr ? "" : block->scope ();
- symbol_lookup_debug_printf
- ("rust_lookup_symbol_non_local (%s, %s (scope %s), %s)",
- 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')
- {
- if (scope[0] != '\0')
- {
- scopedname = std::string (scope) + "::" + name;
- name = scopedname.c_str ();
- }
- else
- name = NULL;
- }
-
- if (name != NULL)
- {
- result = lookup_symbol_in_static_block (name, block, domain);
- if (result.symbol == NULL)
- result = lookup_global_symbol (name, block, domain);
- }
- return result;
- }
+ const domain_enum domain) const override;
/* See language.h. */
--
2.40.1
next prev parent reply other threads:[~2023-08-22 15:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 15:25 [PATCH 0/8] Handle array- and string-like types in DAP Tom Tromey
2023-08-22 15:25 ` Tom Tromey [this message]
2023-08-22 15:25 ` [PATCH 2/8] Refactor Rust code for slice-to-array operation Tom Tromey
2023-08-22 15:25 ` [PATCH 3/8] Introduce TYPE_SPECIFIC_RUST_STUFF Tom Tromey
2023-08-22 15:25 ` [PATCH 4/8] Use ada_value_subscript in valpy_getitem Tom Tromey
2023-08-22 15:25 ` [PATCH 5/8] Introduce type::is_array_like and value_to_array Tom Tromey
2023-08-22 15:25 ` [PATCH 6/8] Select frame when fetching a frame variable in DAP Tom Tromey
2023-08-22 15:25 ` [PATCH 7/8] Add new Python APIs to support DAP value display Tom Tromey
2023-08-22 15:46 ` Eli Zaretskii
2023-08-22 15:25 ` [PATCH 8/8] Handle array- and string-like values in no-op pretty printers Tom Tromey
2023-09-05 17:22 ` [PATCH 0/8] Handle array- and string-like types in DAP Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230822-array-and-string-like-v1-1-2dcea29b0567@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).