diff options
author | Pedro Alves <pedro@palves.net> | 2022-05-23 20:15:18 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2022-06-17 09:41:24 +0100 |
commit | 264f98902f27497f7494933628b0f5c4e117fe59 (patch) | |
tree | 7a56e489f4441c3132a4d2b0b636a64ace58cd7c /gdb/completer.c | |
parent | 14e283ff4e0656327179a5b69954796af3807b66 (diff) | |
download | gdb-264f98902f27497f7494933628b0f5c4e117fe59.zip gdb-264f98902f27497f7494933628b0f5c4e117fe59.tar.gz gdb-264f98902f27497f7494933628b0f5c4e117fe59.tar.bz2 |
event_location -> location_spec
Currently, GDB internally uses the term "location" for both the
location specification the user input (linespec, explicit location, or
an address location), and for actual resolved locations, like the
breakpoint locations, or the result of decoding a location spec to
SaLs. This is expecially confusing in the breakpoints module, as
struct breakpoint has these two fields:
breakpoint::location;
breakpoint::loc;
"location" is the location spec, and "loc" is the resolved locations.
And then, we have a method called "locations()", which returns the
resolved locations as range...
The location spec type is presently called event_location:
/* Location we used to set the breakpoint. */
event_location_up location;
and it is described like this:
/* The base class for all an event locations used to set a stop event
in the inferior. */
struct event_location
{
and even that is incorrect... Location specs are used for finding
actual locations in the program in scenarios that have nothing to do
with stop events. E.g., "list" works with location specs.
To clean all this confusion up, this patch renames "event_location" to
"location_spec" throughout, and then all the variables that hold a
location spec, they are renamed to include "spec" in their name, like
e.g., "location" -> "locspec". Similarly, functions that work with
location specs, and currently have just "location" in their name are
renamed to include "spec" in their name too.
Change-Id: I5814124798aa2b2003e79496e78f95c74e5eddca
Diffstat (limited to 'gdb/completer.c')
-rw-r--r-- | gdb/completer.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gdb/completer.c b/gdb/completer.c index fea3eb9..2ec8d2e 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -707,13 +707,13 @@ string_or_empty (const char *string) static void collect_explicit_location_matches (completion_tracker &tracker, - struct event_location *location, + location_spec *locspec, enum explicit_location_match_type what, const char *word, const struct language_defn *language) { const struct explicit_location *explicit_loc - = get_explicit_location (location); + = get_explicit_location (locspec); /* True if the option expects an argument. */ bool needs_arg = true; @@ -846,19 +846,19 @@ skip_keyword (completion_tracker &tracker, return -1; } -/* A completer function for explicit locations. This function +/* A completer function for explicit location specs. This function completes both options ("-source", "-line", etc) and values. If completing a quoted string, then QUOTED_ARG_START and QUOTED_ARG_END point to the quote characters. LANGUAGE is the current language. */ static void -complete_explicit_location (completion_tracker &tracker, - struct event_location *location, - const char *text, - const language_defn *language, - const char *quoted_arg_start, - const char *quoted_arg_end) +complete_explicit_location_spec (completion_tracker &tracker, + location_spec *locspec, + const char *text, + const language_defn *language, + const char *quoted_arg_start, + const char *quoted_arg_end) { if (*text != '-') return; @@ -916,7 +916,7 @@ complete_explicit_location (completion_tracker &tracker, } /* Now gather matches */ - collect_explicit_location_matches (tracker, location, what, text, + collect_explicit_location_matches (tracker, locspec, what, text, language); } } @@ -943,9 +943,9 @@ location_completer (struct cmd_list_element *ignore, const char *copy = text; explicit_completion_info completion_info; - event_location_up location - = string_to_explicit_location (©, current_language, - &completion_info); + location_spec_up locspec + = string_to_explicit_location_spec (©, current_language, + &completion_info); if (completion_info.quoted_arg_start != NULL && completion_info.quoted_arg_end == NULL) { @@ -954,7 +954,7 @@ location_completer (struct cmd_list_element *ignore, tracker.advance_custom_word_point_by (1); } - if (completion_info.saw_explicit_location_option) + if (completion_info.saw_explicit_location_spec_option) { if (*copy != '\0') { @@ -987,15 +987,15 @@ location_completer (struct cmd_list_element *ignore, - text); text = completion_info.last_option; - complete_explicit_location (tracker, location.get (), text, - current_language, - completion_info.quoted_arg_start, - completion_info.quoted_arg_end); + complete_explicit_location_spec (tracker, locspec.get (), text, + current_language, + completion_info.quoted_arg_start, + completion_info.quoted_arg_end); } } /* This is an address or linespec location. */ - else if (location != NULL) + else if (locspec != nullptr) { /* Handle non-explicit location options. */ @@ -1008,7 +1008,7 @@ location_completer (struct cmd_list_element *ignore, text = copy; symbol_name_match_type match_type - = get_explicit_location (location.get ())->func_name_match_type; + = get_explicit_location (locspec.get ())->func_name_match_type; complete_address_and_linespec_locations (tracker, text, match_type); } } |