* [PATCH] Remove decode_location_spec_default
@ 2022-09-29 23:35 Tom Tromey
2022-09-29 23:59 ` Simon Marchi
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2022-09-29 23:35 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This removes decode_location_spec_default, inlining it into its sole
caller.
Regression tested on x86-64 Fedora 34.
---
gdb/breakpoint.c | 45 +++++++++++++++------------------------------
1 file changed, 15 insertions(+), 30 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 002f4a935b1..c8c34120aa0 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -100,10 +100,6 @@ static void create_breakpoints_sal (struct gdbarch *,
int,
int, int, int, unsigned);
-static std::vector<symtab_and_line> decode_location_spec_default
- (struct breakpoint *b, struct location_spec *locspec,
- struct program_space *search_pspace);
-
static int can_use_hardware_watchpoint
(const std::vector<value_ref_ptr> &vals);
@@ -11692,7 +11688,21 @@ code_breakpoint::decode_location_spec (location_spec *locspec,
if (locspec->type () == PROBE_LOCATION_SPEC)
return bkpt_probe_decode_location_spec (this, locspec, search_pspace);
- return decode_location_spec_default (this, locspec, search_pspace);
+ struct linespec_result canonical;
+
+ decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace,
+ NULL, 0, &canonical, multiple_symbols_all,
+ filter.get ());
+
+ /* We should get 0 or 1 resulting SALs. */
+ gdb_assert (canonical.lsals.size () < 2);
+
+ if (!canonical.lsals.empty ())
+ {
+ const linespec_sals &lsal = canonical.lsals[0];
+ return std::move (lsal.sals);
+ }
+ return {};
}
/* Virtual table for internal breakpoints. */
@@ -12750,31 +12760,6 @@ create_sals_from_location_spec_default (location_spec *locspec,
parse_breakpoint_sals (locspec, canonical);
}
-/* Decode the line represented by S by calling decode_line_full. This is the
- default function for the `decode_location' method of breakpoint_ops. */
-
-static std::vector<symtab_and_line>
-decode_location_spec_default (struct breakpoint *b,
- location_spec *locspec,
- program_space *search_pspace)
-{
- struct linespec_result canonical;
-
- decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace,
- NULL, 0, &canonical, multiple_symbols_all,
- b->filter.get ());
-
- /* We should get 0 or 1 resulting SALs. */
- gdb_assert (canonical.lsals.size () < 2);
-
- if (!canonical.lsals.empty ())
- {
- const linespec_sals &lsal = canonical.lsals[0];
- return std::move (lsal.sals);
- }
- return {};
-}
-
/* Reset a breakpoint. */
static void
--
2.34.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Remove decode_location_spec_default
2022-09-29 23:35 [PATCH] Remove decode_location_spec_default Tom Tromey
@ 2022-09-29 23:59 ` Simon Marchi
0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2022-09-29 23:59 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2022-09-29 19:35, Tom Tromey wrote:
> This removes decode_location_spec_default, inlining it into its sole
> caller.
>
> Regression tested on x86-64 Fedora 34.
> ---
> gdb/breakpoint.c | 45 +++++++++++++++------------------------------
> 1 file changed, 15 insertions(+), 30 deletions(-)
>
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 002f4a935b1..c8c34120aa0 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -100,10 +100,6 @@ static void create_breakpoints_sal (struct gdbarch *,
> int,
> int, int, int, unsigned);
>
> -static std::vector<symtab_and_line> decode_location_spec_default
> - (struct breakpoint *b, struct location_spec *locspec,
> - struct program_space *search_pspace);
> -
> static int can_use_hardware_watchpoint
> (const std::vector<value_ref_ptr> &vals);
>
> @@ -11692,7 +11688,21 @@ code_breakpoint::decode_location_spec (location_spec *locspec,
> if (locspec->type () == PROBE_LOCATION_SPEC)
> return bkpt_probe_decode_location_spec (this, locspec, search_pspace);
>
> - return decode_location_spec_default (this, locspec, search_pspace);
> + struct linespec_result canonical;
> +
> + decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace,
> + NULL, 0, &canonical, multiple_symbols_all,
> + filter.get ());
> +
> + /* We should get 0 or 1 resulting SALs. */
> + gdb_assert (canonical.lsals.size () < 2);
> +
> + if (!canonical.lsals.empty ())
> + {
> + const linespec_sals &lsal = canonical.lsals[0];
> + return std::move (lsal.sals);
> + }
> + return {};
> }
>
> /* Virtual table for internal breakpoints. */
> @@ -12750,31 +12760,6 @@ create_sals_from_location_spec_default (location_spec *locspec,
> parse_breakpoint_sals (locspec, canonical);
> }
>
> -/* Decode the line represented by S by calling decode_line_full. This is the
> - default function for the `decode_location' method of breakpoint_ops. */
> -
> -static std::vector<symtab_and_line>
> -decode_location_spec_default (struct breakpoint *b,
> - location_spec *locspec,
> - program_space *search_pspace)
> -{
> - struct linespec_result canonical;
> -
> - decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace,
> - NULL, 0, &canonical, multiple_symbols_all,
> - b->filter.get ());
> -
> - /* We should get 0 or 1 resulting SALs. */
> - gdb_assert (canonical.lsals.size () < 2);
> -
> - if (!canonical.lsals.empty ())
> - {
> - const linespec_sals &lsal = canonical.lsals[0];
> - return std::move (lsal.sals);
> - }
> - return {};
> -}
> -
> /* Reset a breakpoint. */
>
> static void
LGTM.
Simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-29 23:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 23:35 [PATCH] Remove decode_location_spec_default Tom Tromey
2022-09-29 23:59 ` Simon Marchi
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).