enable_state = enabled ? bp_enabled : bp_disabled;
disposition = tempflag ? disp_del : disp_donttouch;
- location = string_to_event_location (&addr_string_,
- language_def (language_ada));
+ locspec = string_to_location_spec (&addr_string_,
+ language_def (language_ada));
language = language_ada;
}
{
struct linespec_result canonical;
- event_location_up location
- = new_linespec_location (&exp, symbol_name_match_type::WILD);
- decode_line_full (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
+ location_spec_up locspec
+ = new_linespec_location_spec (&exp, symbol_name_match_type::WILD);
+ decode_line_full (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
NULL, 0, &canonical,
NULL, NULL);
exp = skip_spaces (exp);
/* We first try to use the probe interface. */
try
{
- event_location_up location
- = new_probe_location (exception_functions[kind].probe);
- sals = parse_probes (location.get (), filter_pspace, NULL);
+ location_spec_up locspec
+ = new_probe_location_spec (exception_functions[kind].probe);
+ sals = parse_probes (locspec.get (), filter_pspace, NULL);
}
catch (const gdb_exception_error &e)
{
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name
= ASTRDUP (exception_functions[kind].function);
- event_location_up location = new_explicit_location (&explicit_loc);
- sals = this->decode_location (location.get (), filter_pspace);
+ location_spec_up locspec = new_explicit_location_spec (&explicit_loc);
+ sals = this->decode_location_spec (locspec.get (), filter_pspace);
}
catch (const gdb_exception_error &ex)
{
static void breakpoint_re_set_default (code_breakpoint *);
static void
- create_sals_from_location_default (struct event_location *location,
- struct linespec_result *canonical);
+ create_sals_from_location_spec_default (location_spec *locspec,
+ linespec_result *canonical);
static void create_breakpoints_sal (struct gdbarch *,
struct linespec_result *,
int,
int, int, int, unsigned);
-static std::vector<symtab_and_line> decode_location_default
- (struct breakpoint *b, struct event_location *location,
+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
static void decref_bp_location (struct bp_location **loc);
-static std::vector<symtab_and_line> bkpt_probe_decode_location
+static std::vector<symtab_and_line> bkpt_probe_decode_location_spec
(struct breakpoint *b,
- struct event_location *location,
+ location_spec *locspec,
struct program_space *search_pspace);
static bool bl_address_is_meaningful (bp_location *loc);
static int strace_marker_p (struct breakpoint *b);
-static void bkpt_probe_create_sals_from_location
- (struct event_location *location,
+static void bkpt_probe_create_sals_from_location_spec
+ (location_spec *locspec,
struct linespec_result *canonical);
-static void tracepoint_probe_create_sals_from_location
- (struct event_location *location,
+static void tracepoint_probe_create_sals_from_location_spec
+ (location_spec *locspec,
struct linespec_result *canonical);
const struct breakpoint_ops code_breakpoint_ops =
{
- create_sals_from_location_default,
+ create_sals_from_location_spec_default,
create_breakpoints_sal,
};
/* Breakpoints set on probes. */
static const struct breakpoint_ops bkpt_probe_breakpoint_ops =
{
- bkpt_probe_create_sals_from_location,
+ bkpt_probe_create_sals_from_location_spec,
create_breakpoints_sal,
};
/* Tracepoints set on probes. */
static const struct breakpoint_ops tracepoint_probe_breakpoint_ops =
{
- tracepoint_probe_create_sals_from_location,
+ tracepoint_probe_create_sals_from_location_spec,
create_breakpoints_sal,
};
explicit ranged_breakpoint (struct gdbarch *gdbarch,
const symtab_and_line &sal_start,
int length,
- event_location_up start_location,
- event_location_up end_location)
+ location_spec_up start_locspec,
+ location_spec_up end_locspec)
: ordinary_breakpoint (gdbarch, bp_hardware_breakpoint)
{
bp_location *bl = add_location (sal_start);
disposition = disp_donttouch;
- location = std::move (start_location);
- location_range_end = std::move (end_location);
+ locspec = std::move (start_locspec);
+ locspec_range_end = std::move (end_locspec);
}
int breakpoint_hit (const struct bp_location *bl,
{
using tracepoint::tracepoint;
- std::vector<symtab_and_line> decode_location
- (struct event_location *location,
+ std::vector<symtab_and_line> decode_location_spec
+ (struct location_spec *locspec,
struct program_space *search_pspace) override;
};
bp_overlay_event);
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name);
- b->location = new_explicit_location (&explicit_loc);
+ b->locspec = new_explicit_location_spec (&explicit_loc);
if (overlay_debugging == ovly_auto)
{
b = create_internal_breakpoint (gdbarch,
p->get_relocated_address (objfile),
bp_longjmp_master);
- b->location = new_probe_location ("-probe-stap libc:longjmp");
+ b->locspec = new_probe_location_spec ("-probe-stap libc:longjmp");
b->enable_state = bp_disabled;
}
b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master);
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name);
- b->location = new_explicit_location (&explicit_loc);
+ b->locspec = new_explicit_location_spec (&explicit_loc);
b->enable_state = bp_disabled;
installed_bp++;
}
bp_std_terminate_master);
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name);
- b->location = new_explicit_location (&explicit_loc);
+ b->locspec = new_explicit_location_spec (&explicit_loc);
b->enable_state = bp_disabled;
}
}
b = create_internal_breakpoint (gdbarch,
p->get_relocated_address (objfile),
bp_exception_master);
- b->location = new_probe_location ("-probe-stap libgcc:unwind");
+ b->locspec = new_probe_location_spec ("-probe-stap libgcc:unwind");
b->enable_state = bp_disabled;
}
b = create_internal_breakpoint (gdbarch, addr, bp_exception_master);
initialize_explicit_location (&explicit_loc);
explicit_loc.function_name = ASTRDUP (func_name);
- b->location = new_explicit_location (&explicit_loc);
+ b->locspec = new_explicit_location_spec (&explicit_loc);
b->enable_state = bp_disabled;
return true;
/* Does B have a location spec? */
static int
-breakpoint_event_location_empty_p (const struct breakpoint *b)
+breakpoint_location_spec_empty_p (const struct breakpoint *b)
{
- return b->location != NULL && event_location_empty_p (b->location.get ());
+ return (b->locspec != nullptr
+ && location_spec_empty_p (b->locspec.get ()));
}
void
/* Without a symbolic address, we have little hope of the
pre-exec() address meaning the same thing in the post-exec()
a.out. */
- if (breakpoint_event_location_empty_p (b))
+ if (breakpoint_location_spec_empty_p (b))
{
delete_breakpoint (b);
continue;
set_current_program_space (loc->pspace);
if (b->display_canonical)
- uiout->field_string ("what", event_location_to_string (b->location.get ()));
+ uiout->field_string ("what",
+ location_spec_to_string (b->locspec.get ()));
else if (loc && loc->symtab)
{
const struct symbol *sym = loc->symbol;
else
{
uiout->field_string ("pending",
- event_location_to_string (b->location.get ()));
+ location_spec_to_string (b->locspec.get ()));
/* If extra_string is available, it could be holding a condition
or dprintf arguments. In either case, make sure it is printed,
too, but only for non-MI streams. */
uiout->field_string ("original-location", w->exp_string.get ());
}
- else if (b->location != NULL
- && event_location_to_string (b->location.get ()) != NULL)
- uiout->field_string ("original-location",
- event_location_to_string (b->location.get ()));
+ else if (b->locspec != nullptr)
+ {
+ const char *str = location_spec_to_string (b->locspec.get ());
+ if (str != nullptr)
+ uiout->field_string ("original-location", str);
+ }
}
return result;
b = create_internal_breakpoint (gdbarch, address, bp_thread_event);
b->enable_state = bp_enabled;
- /* location has to be used or breakpoint_re_set will delete me. */
- b->location = new_address_location (b->loc->address, NULL, 0);
+ /* locspec has to be used or breakpoint_re_set will delete me. */
+ b->locspec = new_address_location_spec (b->loc->address, NULL, 0);
update_global_location_list_nothrow (UGLL_MAY_INSERT);
code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
enum bptype type_,
gdb::array_view<const symtab_and_line> sals,
- event_location_up &&location_,
+ location_spec_up &&locspec_,
gdb::unique_xmalloc_ptr<char> filter_,
gdb::unique_xmalloc_ptr<char> cond_string_,
gdb::unique_xmalloc_ptr<char> extra_string_,
{
/* We already know the marker exists, otherwise, we wouldn't
see a sal for it. */
- const char *p = &event_location_to_string (location_.get ())[3];
+ const char *p = &location_spec_to_string (locspec_.get ())[3];
const char *endp;
p = skip_spaces (p);
}
display_canonical = display_canonical_;
- if (location_ != nullptr)
- location = std::move (location_);
+ if (locspec_ != nullptr)
+ locspec = std::move (locspec_);
else
- location = new_address_location (this->loc->address, NULL, 0);
+ locspec = new_address_location_spec (this->loc->address, NULL, 0);
filter = std::move (filter_);
}
static void
create_breakpoint_sal (struct gdbarch *gdbarch,
gdb::array_view<const symtab_and_line> sals,
- event_location_up &&location,
+ location_spec_up &&locspec,
gdb::unique_xmalloc_ptr<char> filter,
gdb::unique_xmalloc_ptr<char> cond_string,
gdb::unique_xmalloc_ptr<char> extra_string,
= new_breakpoint_from_type (gdbarch,
type,
sals,
- std::move (location),
+ std::move (locspec),
std::move (filter),
std::move (cond_string),
std::move (extra_string),
{
/* Note that 'location' can be NULL in the case of a plain
'break', without arguments. */
- event_location_up location
- = (canonical->location != NULL
- ? copy_event_location (canonical->location.get ()) : NULL);
+ location_spec_up locspec
+ = (canonical->locspec != NULL
+ ? copy_location_spec (canonical->locspec.get ()) : NULL);
gdb::unique_xmalloc_ptr<char> filter_string
(lsal.canonical != NULL ? xstrdup (lsal.canonical) : NULL);
create_breakpoint_sal (gdbarch, lsal.sals,
- std::move (location),
+ std::move (locspec),
std::move (filter_string),
std::move (cond_string),
std::move (extra_string),
}
}
-/* Parse LOCATION which is assumed to be a SAL specification possibly
+/* Parse LOCSPEC which is assumed to be a SAL specification possibly
followed by conditionals. On return, SALS contains an array of SAL
- addresses found. LOCATION points to the end of the SAL (for
- linespec locations).
+ addresses found. LOCSPEC points to the end of the SAL (for
+ linespec locspecs).
The array and the line spec strings are allocated on the heap, it is
the caller's responsibility to free them. */
static void
-parse_breakpoint_sals (struct event_location *location,
+parse_breakpoint_sals (location_spec *locspec,
struct linespec_result *canonical)
{
struct symtab_and_line cursal;
- if (event_location_type (location) == LINESPEC_LOCATION)
+ if (location_spec_type (locspec) == LINESPEC_LOCATION_SPEC)
{
- const char *spec = get_linespec_location (location)->spec_string;
+ const char *spec = get_linespec_location (locspec)->spec_string;
if (spec == NULL)
{
{
const char *spec = NULL;
- if (event_location_type (location) == LINESPEC_LOCATION)
- spec = get_linespec_location (location)->spec_string;
+ if (location_spec_type (locspec) == LINESPEC_LOCATION_SPEC)
+ spec = get_linespec_location (locspec)->spec_string;
if (!cursal.symtab
|| (spec != NULL
&& strchr ("+-", spec[0]) != NULL
&& spec[1] != '['))
{
- decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, NULL,
+ decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, NULL,
get_last_displayed_symtab (),
get_last_displayed_line (),
canonical, NULL, NULL);
}
}
- decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, NULL,
+ decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, NULL,
cursal.symtab, cursal.line, canonical, NULL, NULL);
}
according to IS_TRACEPOINT. */
static const struct breakpoint_ops *
-breakpoint_ops_for_event_location_type (enum event_location_type location_type,
- bool is_tracepoint)
+breakpoint_ops_for_location_spec_type (enum location_spec_type locspec_type,
+ bool is_tracepoint)
{
if (is_tracepoint)
{
- if (location_type == PROBE_LOCATION)
+ if (locspec_type == PROBE_LOCATION_SPEC)
return &tracepoint_probe_breakpoint_ops;
else
return &code_breakpoint_ops;
}
else
{
- if (location_type == PROBE_LOCATION)
+ if (locspec_type == PROBE_LOCATION_SPEC)
return &bkpt_probe_breakpoint_ops;
else
return &code_breakpoint_ops;
/* See breakpoint.h. */
const struct breakpoint_ops *
-breakpoint_ops_for_event_location (const struct event_location *location,
- bool is_tracepoint)
+breakpoint_ops_for_location_spec (const location_spec *locspec,
+ bool is_tracepoint)
{
- if (location != nullptr)
- return breakpoint_ops_for_event_location_type
- (event_location_type (location), is_tracepoint);
+ if (locspec != nullptr)
+ return (breakpoint_ops_for_location_spec_type
+ (location_spec_type (locspec), is_tracepoint));
return &code_breakpoint_ops;
}
int
create_breakpoint (struct gdbarch *gdbarch,
- struct event_location *location,
+ location_spec *locspec,
const char *cond_string,
int thread, const char *extra_string,
bool force_condition, int parse_extra,
try
{
- ops->create_sals_from_location (location, &canonical);
+ ops->create_sals_from_location_spec (locspec, &canonical);
}
catch (const gdb_exception_error &e)
{
{
std::unique_ptr <breakpoint> b = new_breakpoint_from_type (gdbarch,
type_wanted);
- b->location = copy_event_location (location);
+ b->locspec = copy_location_spec (locspec);
if (parse_extra)
b->cond_string = NULL;
? bp_hardware_breakpoint
: bp_breakpoint);
- event_location_up location = string_to_event_location (&arg, current_language);
- const struct breakpoint_ops *ops = breakpoint_ops_for_event_location
- (location.get (), false /* is_tracepoint */);
+ location_spec_up locspec = string_to_location_spec (&arg, current_language);
+ const struct breakpoint_ops *ops
+ = breakpoint_ops_for_location_spec (locspec.get (),
+ false /* is_tracepoint */);
create_breakpoint (get_current_arch (),
- location.get (),
+ locspec.get (),
NULL, 0, arg, false, 1 /* parse arg */,
tempflag, type_wanted,
0 /* Ignore count */,
static void
dprintf_command (const char *arg, int from_tty)
{
- event_location_up location = string_to_event_location (&arg, current_language);
+ location_spec_up locspec = string_to_location_spec (&arg, current_language);
/* If non-NULL, ARG should have been advanced past the location;
the next character must be ','. */
}
create_breakpoint (get_current_arch (),
- location.get (),
+ locspec.get (),
NULL, 0, arg, false, 1 /* parse arg */,
0, bp_dprintf,
0 /* Ignore count */,
ranged_breakpoint::print_recreate (struct ui_file *fp) const
{
gdb_printf (fp, "break-range %s, %s",
- event_location_to_string (location.get ()),
- event_location_to_string (location_range_end.get ()));
+ location_spec_to_string (locspec.get ()),
+ location_spec_to_string (locspec_range_end.get ()));
print_recreate_thread (fp);
}
error(_("No address range specified."));
arg_start = arg;
- event_location_up start_location = string_to_event_location (&arg,
- current_language);
- parse_breakpoint_sals (start_location.get (), &canonical_start);
+ location_spec_up start_locspec
+ = string_to_location_spec (&arg, current_language);
+ parse_breakpoint_sals (start_locspec.get (), &canonical_start);
if (arg[0] != ',')
error (_("Too few arguments."));
arg++; /* Skip the comma. */
arg = skip_spaces (arg);
- /* Parse the end location. */
+ /* Parse the end location specification. */
arg_start = arg;
/* We call decode_line_full directly here instead of using
- parse_breakpoint_sals because we need to specify the start location's
- symtab and line as the default symtab and line for the end of the
- range. This makes it possible to have ranges like "foo.c:27, +14",
- where +14 means 14 lines from the start location. */
- event_location_up end_location = string_to_event_location (&arg,
- current_language);
- decode_line_full (end_location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
+ parse_breakpoint_sals because we need to specify the start
+ location spec's symtab and line as the default symtab and line
+ for the end of the range. This makes it possible to have ranges
+ like "foo.c:27, +14", where +14 means 14 lines from the start
+ location spec. */
+ location_spec_up end_locspec
+ = string_to_location_spec (&arg, current_language);
+ decode_line_full (end_locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
sal_start.symtab, sal_start.line,
&canonical_end, NULL, NULL);
std::unique_ptr<breakpoint> br
(new ranged_breakpoint (get_current_arch (),
sal_start, length,
- std::move (start_location),
- std::move (end_location)));
+ std::move (start_locspec),
+ std::move (end_locspec)));
install_breakpoint (false, std::move (br), true);
}
/* Set a breakpoint where the user wants it and at return from
this function. */
- event_location_up location = string_to_event_location (&arg, current_language);
+ location_spec_up locspec = string_to_location_spec (&arg, current_language);
std::vector<symtab_and_line> sals
= (last_displayed_sal_is_valid ()
- ? decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
+ ? decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
get_last_displayed_symtab (),
get_last_displayed_line ())
- : decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE,
+ : decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE,
NULL, NULL, 0));
if (sals.empty ())
if (b->extra_string == NULL)
{
gdb_printf (_(" (%s) pending."),
- event_location_to_string (b->location.get ()));
+ location_spec_to_string (b->locspec.get ()));
}
else if (b->type == bp_dprintf)
{
gdb_printf (_(" (%s,%s) pending."),
- event_location_to_string (b->location.get ()),
+ location_spec_to_string (b->locspec.get ()),
b->extra_string.get ());
}
else
{
gdb_printf (_(" (%s %s) pending."),
- event_location_to_string (b->location.get ()),
+ location_spec_to_string (b->locspec.get ()),
b->extra_string.get ());
}
}
different file name, and this at least reflects the
real situation somewhat. */
gdb_printf (": %s.",
- event_location_to_string (b->location.get ()));
+ location_spec_to_string (b->locspec.get ()));
}
if (b->loc->next)
}
std::vector<symtab_and_line>
-breakpoint::decode_location (struct event_location *location,
- struct program_space *search_pspace)
+breakpoint::decode_location_spec (location_spec *locspec,
+ program_space *search_pspace)
{
internal_error_pure_virtual_called ();
}
code_breakpoint::re_set ()
{
/* FIXME: is this still reachable? */
- if (breakpoint_event_location_empty_p (this))
+ if (breakpoint_location_spec_empty_p (this))
{
/* Anything without a location can't be re-set. */
delete_breakpoint (this);
internal_error (__FILE__, __LINE__,
_("unhandled breakpoint type %d"), (int) type);
- gdb_printf (fp, " %s", event_location_to_string (location.get ()));
+ gdb_printf (fp, " %s", location_spec_to_string (locspec.get ()));
/* Print out extra_string if this breakpoint is pending. It might
contain, for example, conditions that were set by the user. */
}
std::vector<symtab_and_line>
-code_breakpoint::decode_location (struct event_location *location,
- struct program_space *search_pspace)
+code_breakpoint::decode_location_spec (location_spec *locspec,
+ program_space *search_pspace)
{
- if (event_location_type (location) == PROBE_LOCATION)
- return bkpt_probe_decode_location (this, location, search_pspace);
+ if (location_spec_type (locspec) == PROBE_LOCATION_SPEC)
+ return bkpt_probe_decode_location_spec (this, locspec, search_pspace);
- return decode_location_default (this, location, search_pspace);
+ return decode_location_spec_default (this, locspec, search_pspace);
}
/* Virtual table for internal breakpoints. */
}
static void
-bkpt_probe_create_sals_from_location (struct event_location *location,
- struct linespec_result *canonical)
+bkpt_probe_create_sals_from_location_spec (location_spec *locspec,
+ struct linespec_result *canonical)
{
struct linespec_sals lsal;
- lsal.sals = parse_probes (location, NULL, canonical);
+ lsal.sals = parse_probes (locspec, NULL, canonical);
lsal.canonical
- = xstrdup (event_location_to_string (canonical->location.get ()));
+ = xstrdup (location_spec_to_string (canonical->locspec.get ()));
canonical->lsals.push_back (std::move (lsal));
}
static std::vector<symtab_and_line>
-bkpt_probe_decode_location (struct breakpoint *b,
- struct event_location *location,
- struct program_space *search_pspace)
+bkpt_probe_decode_location_spec (struct breakpoint *b,
+ location_spec *locspec,
+ program_space *search_pspace)
{
- std::vector<symtab_and_line> sals = parse_probes (location, search_pspace, NULL);
+ std::vector<symtab_and_line> sals
+ = parse_probes (locspec, search_pspace, NULL);
if (sals.empty ())
error (_("probe not found"));
return sals;
internal_error (__FILE__, __LINE__,
_("unhandled tracepoint type %d"), (int) type);
- gdb_printf (fp, " %s", event_location_to_string (location.get ()));
+ gdb_printf (fp, " %s", location_spec_to_string (locspec.get ()));
print_recreate_thread (fp);
if (pass_count)
/* Virtual table for tracepoints on static probes. */
static void
-tracepoint_probe_create_sals_from_location
- (struct event_location *location,
+tracepoint_probe_create_sals_from_location_spec
+ (location_spec *locspec,
struct linespec_result *canonical)
{
/* We use the same method for breakpoint on probes. */
- bkpt_probe_create_sals_from_location (location, canonical);
+ bkpt_probe_create_sals_from_location_spec (locspec, canonical);
}
void
dprintf_breakpoint::print_recreate (struct ui_file *fp) const
{
gdb_printf (fp, "dprintf %s,%s",
- event_location_to_string (location.get ()),
+ location_spec_to_string (locspec.get ()),
extra_string.get ());
print_recreate_thread (fp);
}
markers (`-m'). */
static void
-strace_marker_create_sals_from_location (struct event_location *location,
- struct linespec_result *canonical)
+strace_marker_create_sals_from_location_spec (location_spec *locspec,
+ struct linespec_result *canonical)
{
struct linespec_sals lsal;
const char *arg_start, *arg;
- arg = arg_start = get_linespec_location (location)->spec_string;
+ arg = arg_start = get_linespec_location (locspec)->spec_string;
lsal.sals = decode_static_tracepoint_spec (&arg);
std::string str (arg_start, arg - arg_start);
const char *ptr = str.c_str ();
- canonical->location
- = new_linespec_location (&ptr, symbol_name_match_type::FULL);
+ canonical->locspec
+ = new_linespec_location_spec (&ptr, symbol_name_match_type::FULL);
lsal.canonical
- = xstrdup (event_location_to_string (canonical->location.get ()));
+ = xstrdup (location_spec_to_string (canonical->locspec.get ()));
canonical->lsals.push_back (std::move (lsal));
}
for (size_t i = 0; i < lsal.sals.size (); i++)
{
- event_location_up location
- = copy_event_location (canonical->location.get ());
+ location_spec_up locspec
+ = copy_location_spec (canonical->locspec.get ());
std::unique_ptr<tracepoint> tp
(new tracepoint (gdbarch,
type_wanted,
lsal.sals[i],
- std::move (location),
+ std::move (locspec),
NULL,
std::move (cond_string),
std::move (extra_string),
}
std::vector<symtab_and_line>
-static_marker_tracepoint::decode_location (struct event_location *location,
- struct program_space *search_pspace)
+static_marker_tracepoint::decode_location_spec (location_spec *locspec,
+ program_space *search_pspace)
{
- const char *s = get_linespec_location (location)->spec_string;
+ const char *s = get_linespec_location (locspec)->spec_string;
std::vector<symtab_and_line> sals = decode_static_tracepoint_spec (&s);
if (sals.size () > static_trace_marker_id_idx)
/* Static tracepoints with marker (`-m'). */
static struct breakpoint_ops strace_marker_breakpoint_ops =
{
- strace_marker_create_sals_from_location,
+ strace_marker_create_sals_from_location_spec,
strace_marker_create_breakpoints_sal,
};
b->loc->line_number = sal2.line;
b->loc->symtab = sym != NULL ? sal2.symtab : NULL;
- b->location.reset (NULL);
+ b->locspec.reset (nullptr);
initialize_explicit_location (&explicit_loc);
explicit_loc.source_filename
= ASTRDUP (symtab_to_filename_for_display (sal2.symtab));
explicit_loc.line_offset.offset = b->loc->line_number;
explicit_loc.line_offset.sign = LINE_OFFSET_NONE;
- b->location = new_explicit_location (&explicit_loc);
+ b->locspec = new_explicit_location_spec (&explicit_loc);
/* Might be nice to check if function changed, and warn if
so. */
gdb::observers::breakpoint_modified.notify (b);
}
-/* Find the SaL locations corresponding to the given LOCATION.
+/* Find the SaL locations corresponding to the given LOCSPEC.
On return, FOUND will be 1 if any SaL was found, zero otherwise. */
static std::vector<symtab_and_line>
-location_to_sals (struct breakpoint *b, struct event_location *location,
- struct program_space *search_pspace, int *found)
+location_spec_to_sals (struct breakpoint *b, location_spec *locspec,
+ struct program_space *search_pspace, int *found)
{
struct gdb_exception exception;
try
{
- sals = b->decode_location (location, search_pspace);
+ sals = b->decode_location_spec (locspec, search_pspace);
}
catch (gdb_exception_error &e)
{
std::vector<symtab_and_line> expanded, expanded_end;
int found;
- std::vector<symtab_and_line> sals = location_to_sals (b, b->location.get (),
- filter_pspace, &found);
+ std::vector<symtab_and_line> sals
+ = location_spec_to_sals (b, b->locspec.get (), filter_pspace, &found);
if (found)
expanded = std::move (sals);
- if (b->location_range_end != NULL)
+ if (b->locspec_range_end != nullptr)
{
std::vector<symtab_and_line> sals_end
- = location_to_sals (b, b->location_range_end.get (),
- filter_pspace, &found);
+ = location_spec_to_sals (b, b->locspec_range_end.get (),
+ filter_pspace, &found);
if (found)
expanded_end = std::move (sals_end);
}
calls parse_breakpoint_sals. Return 1 for success, zero for failure. */
static void
-create_sals_from_location_default (struct event_location *location,
- struct linespec_result *canonical)
+create_sals_from_location_spec_default (location_spec *locspec,
+ struct linespec_result *canonical)
{
- parse_breakpoint_sals (location, canonical);
+ 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_default (struct breakpoint *b,
- struct event_location *location,
- struct program_space *search_pspace)
+decode_location_spec_default (struct breakpoint *b,
+ location_spec *locspec,
+ program_space *search_pspace)
{
struct linespec_result canonical;
- decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, search_pspace,
+ decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace,
NULL, 0, &canonical, multiple_symbols_all,
b->filter.get ());
static void
trace_command (const char *arg, int from_tty)
{
- event_location_up location = string_to_event_location (&arg,
- current_language);
- const struct breakpoint_ops *ops = breakpoint_ops_for_event_location
- (location.get (), true /* is_tracepoint */);
+ location_spec_up locspec = string_to_location_spec (&arg,
+ current_language);
+ const struct breakpoint_ops *ops = breakpoint_ops_for_location_spec
+ (locspec.get (), true /* is_tracepoint */);
create_breakpoint (get_current_arch (),
- location.get (),
+ locspec.get (),
NULL, 0, arg, false, 1 /* parse arg */,
0 /* tempflag */,
bp_tracepoint /* type_wanted */,
static void
ftrace_command (const char *arg, int from_tty)
{
- event_location_up location = string_to_event_location (&arg,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&arg,
+ current_language);
create_breakpoint (get_current_arch (),
- location.get (),
+ locspec.get (),
NULL, 0, arg, false, 1 /* parse arg */,
0 /* tempflag */,
bp_fast_tracepoint /* type_wanted */,
strace_command (const char *arg, int from_tty)
{
const struct breakpoint_ops *ops;
- event_location_up location;
+ location_spec_up locspec;
enum bptype type;
/* Decide if we are dealing with a static tracepoint marker (`-m'),
if (arg && startswith (arg, "-m") && isspace (arg[2]))
{
ops = &strace_marker_breakpoint_ops;
- location = new_linespec_location (&arg, symbol_name_match_type::FULL);
+ locspec = new_linespec_location_spec (&arg,
+ symbol_name_match_type::FULL);
type = bp_static_marker_tracepoint;
}
else
{
ops = &code_breakpoint_ops;
- location = string_to_event_location (&arg, current_language);
+ locspec = string_to_location_spec (&arg, current_language);
type = bp_static_tracepoint;
}
create_breakpoint (get_current_arch (),
- location.get (),
+ locspec.get (),
NULL, 0, arg, false, 1 /* parse arg */,
0 /* tempflag */,
type /* type_wanted */,
"has no source form, ignoring it"),
utp->number);
- event_location_up location = string_to_event_location (&addr_str,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&addr_str,
+ current_language);
if (!create_breakpoint (get_current_arch (),
- location.get (),
+ locspec.get (),
utp->cond_string.get (), -1, addr_str,
false /* force_condition */,
0 /* parse cond/thread */,
/* This help string is used to consolidate all the help string for specifying
locations used by several commands. */
-#define LOCATION_HELP_STRING \
+#define LOCATION_SPEC_HELP_STRING \
"Linespecs are colon-separated lists of location parameters, such as\n\
source filename, function name, label name, and line number.\n\
Example: To specify the start of a label named \"the_top\" in the\n\
\n\
With the \"-force-condition\" flag, the condition is defined even when\n\
it is invalid for all current locations.\n\
-\n" LOCATION_HELP_STRING "\n\n\
+\n" LOCATION_SPEC_HELP_STRING "\n\n\
Multiple breakpoints at one place are permitted, and useful if their\n\
conditions are different.\n\
\n\
\n\
With no argument, clears all breakpoints in the line that the selected frame\n\
is executing in.\n"
-"\n" LOCATION_HELP_STRING "\n\n\
+"\n" LOCATION_SPEC_HELP_STRING "\n\n\
See also the \"delete\" command which clears breakpoints by number."));
add_com_alias ("cl", clear_cmd, class_breakpoint, 1);
by printing the $_sdata variable like any other convenience variable.\n\
\n\
CONDITION is a boolean expression.\n\
-\n" LOCATION_HELP_STRING "\n\n\
+\n" LOCATION_SPEC_HELP_STRING "\n\n\
Multiple tracepoints at one place are permitted, and useful if their\n\
conditions are different.\n\
\n\
Set a dynamic printf at specified location.\n\
dprintf location,format string,arg1,arg2,...\n\
location may be a linespec, explicit, or address location.\n"
-"\n" LOCATION_HELP_STRING));
+"\n" LOCATION_SPEC_HELP_STRING));
set_cmd_completer (c, location_completer);
add_setshow_enum_cmd ("dprintf-style", class_support,
struct symtab *symtab = NULL;
/* The symbol found by the location parser, if any. This may be used to
- ascertain when an event location was set at a different location than
+ ascertain when a location spec was set at a different location than
the one originally selected by parsing, e.g., inlined symbols. */
const struct symbol *symbol = NULL;
struct breakpoint_ops
{
- /* Create SALs from location, storing the result in linespec_result.
+ /* Create SALs from location spec, storing the result in
+ linespec_result.
For an explanation about the arguments, see the function
- `create_sals_from_location_default'.
+ `create_sals_from_location_spec_default'.
This function is called inside `create_breakpoint'. */
- void (*create_sals_from_location) (struct event_location *location,
- struct linespec_result *canonical);
+ void (*create_sals_from_location_spec) (location_spec *locspec,
+ struct linespec_result *canonical);
/* This method will be responsible for creating a breakpoint given its SALs.
Usually, it just calls `create_breakpoints_sal' (for ordinary
/* Print to FP the CLI command that recreates this breakpoint. */
virtual void print_recreate (struct ui_file *fp) const;
- /* Given the location (second parameter), this method decodes it and
- returns the SAL locations related to it. For ordinary
+ /* Given the location spec (second parameter), this method decodes
+ it and returns the SAL locations related to it. For ordinary
breakpoints, it calls `decode_line_full'. If SEARCH_PSPACE is
not NULL, symbol search is restricted to just that program space.
- This function is called inside `location_to_sals'. */
- virtual std::vector<symtab_and_line> decode_location
- (struct event_location *location,
+ This function is called inside `location_spec_to_sals'. */
+ virtual std::vector<symtab_and_line> decode_location_spec
+ (location_spec *locspec,
struct program_space *search_pspace);
/* Return true if this breakpoint explains a signal. See
non-thread-specific ordinary breakpoints this is NULL. */
program_space *pspace = NULL;
- /* Location we used to set the breakpoint. */
- event_location_up location;
+ /* The location specification we used to set the breakpoint. */
+ location_spec_up locspec;
/* The filter that should be passed to decode_line_full when
re-setting this breakpoint. This may be NULL. */
gdb::unique_xmalloc_ptr<char> filter;
- /* For a ranged breakpoint, the location we used to find the end of
- the range. */
- event_location_up location_range_end;
+ /* For a ranged breakpoint, the location specification we used to
+ find the end of the range. */
+ location_spec_up locspec_range_end;
/* Architecture we used to set the breakpoint. */
struct gdbarch *gdbarch;
location" from the address in the SAL. */
code_breakpoint (struct gdbarch *gdbarch, bptype type,
gdb::array_view<const symtab_and_line> sals,
- event_location_up &&location,
+ location_spec_up &&locspec,
gdb::unique_xmalloc_ptr<char> filter,
gdb::unique_xmalloc_ptr<char> cond_string,
gdb::unique_xmalloc_ptr<char> extra_string,
const address_space *aspace,
CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
- std::vector<symtab_and_line> decode_location
- (struct event_location *location,
+ std::vector<symtab_and_line> decode_location_spec
+ (struct location_spec *locspec,
struct program_space *search_pspace) override;
};
extern void install_breakpoint (int internal, std::unique_ptr<breakpoint> &&b,
int update_gll);
-/* Returns the breakpoint ops appropriate for use with with LOCATION and
- according to IS_TRACEPOINT. Use this to ensure, for example, that you pass
- the correct ops to create_breakpoint for probe locations. If LOCATION is
- NULL, returns code_breakpoint_ops. */
+/* Returns the breakpoint ops appropriate for use with with LOCSPEC
+ and according to IS_TRACEPOINT. Use this to ensure, for example,
+ that you pass the correct ops to create_breakpoint for probe
+ location specs. If LOCSPEC is NULL, returns
+ code_breakpoint_ops. */
-extern const struct breakpoint_ops *breakpoint_ops_for_event_location
- (const struct event_location *location, bool is_tracepoint);
+extern const struct breakpoint_ops *breakpoint_ops_for_location_spec
+ (const location_spec *locspec, bool is_tracepoint);
/* Flags that can be passed down to create_breakpoint, etc., to affect
breakpoint creation in several ways. */
CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0
};
-/* Set a breakpoint. This function is shared between CLI and MI functions
- for setting a breakpoint at LOCATION.
+/* Set a breakpoint. This function is shared between CLI and MI
+ functions for setting a breakpoint at LOCSPEC.
This function has two major modes of operations, selected by the
PARSE_EXTRA parameter.
- If PARSE_EXTRA is zero, LOCATION is just the breakpoint's location,
- with condition, thread, and extra string specified by the COND_STRING,
- THREAD, and EXTRA_STRING parameters.
+ If PARSE_EXTRA is zero, LOCSPEC is just the breakpoint's location
+ spec, with condition, thread, and extra string specified by the
+ COND_STRING, THREAD, and EXTRA_STRING parameters.
If PARSE_EXTRA is non-zero, this function will attempt to extract
the condition, thread, and extra string from EXTRA_STRING, ignoring
Returns true if any breakpoint was created; false otherwise. */
extern int create_breakpoint (struct gdbarch *gdbarch,
- struct event_location *location,
+ struct location_spec *locspec,
const char *cond_string, int thread,
const char *extra_string,
bool force_condition,
/* Now should only be one argument -- decode it in SAL. */
arg1 = arg;
- event_location_up location = string_to_event_location (&arg1,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&arg1,
+ current_language);
if (*arg1)
error (_("Junk at end of line specification."));
- std::vector<symtab_and_line> sals = decode_line_1 (location.get (),
+ std::vector<symtab_and_line> sals = decode_line_1 (locspec.get (),
DECODE_LINE_LIST_MODE,
NULL, NULL, 0);
dummy_beg = 1;
else
{
- event_location_up location = string_to_event_location (&arg1,
- current_language);
-
- /* We know that the ARG string is not empty, yet the attempt to parse
- a location from the string consumed no characters. This most
- likely means that the first thing in ARG looks like a location
- condition, and so the string_to_event_location call stopped
- parsing. */
+ location_spec_up locspec
+ = string_to_location_spec (&arg1, current_language);
+
+ /* We know that the ARG string is not empty, yet the attempt to
+ parse a location spec from the string consumed no characters.
+ This most likely means that the first thing in ARG looks like
+ a location spec condition, and so the string_to_location_spec
+ call stopped parsing. */
if (arg1 == arg)
error (_("Junk at end of line specification."));
- sals = decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
+ sals = decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE,
NULL, NULL, 0);
filter_sals (sals);
if (sals.empty ())
know it was ambiguous. */
const char *end_arg = arg1;
- event_location_up location
- = string_to_event_location (&arg1, current_language);
+ location_spec_up locspec
+ = string_to_location_spec (&arg1, current_language);
if (*arg1)
error (_("Junk at end of line specification."));
std::vector<symtab_and_line> sals_end
= (dummy_beg
- ? decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
+ ? decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE,
NULL, NULL, 0)
- : decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
+ : decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE,
NULL, sal.symtab, sal.line));
filter_sals (sals_end);
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;
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;
}
/* Now gather matches */
- collect_explicit_location_matches (tracker, location, what, text,
+ collect_explicit_location_matches (tracker, locspec, what, text,
language);
}
}
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)
{
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')
{
- 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. */
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);
}
}
resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc);
gdb_assert (current_program_space == b->pspace || b->pspace == NULL);
- elf_gnu_ifunc_record_cache (event_location_to_string (b->location.get ()),
- resolved_pc);
+ const char *locspec_str = location_spec_to_string (b->locspec.get ());
+ elf_gnu_ifunc_record_cache (locspec_str, resolved_pc);
b->type = bp_breakpoint;
update_breakpoint_locations (b, current_program_space,
gdbscm_printf (port, " hit:%d", b->hit_count);
gdbscm_printf (port, " ignore:%d", b->ignore_count);
- if (b->location != nullptr)
+ if (b->locspec != nullptr)
{
- const char *str = event_location_to_string (b->location.get ());
+ const char *str = location_spec_to_string (b->locspec.get ());
if (str != nullptr)
gdbscm_printf (port, " @%s", str);
}
pending_breakpoint_scm = self;
location = bp_smob->spec.location;
copy = skip_spaces (location);
- event_location_up eloc
- = string_to_event_location_basic (©,
- current_language,
- symbol_name_match_type::WILD);
+ location_spec_up locspec
+ = string_to_location_spec_basic (©,
+ current_language,
+ symbol_name_match_type::WILD);
try
{
case bp_breakpoint:
{
const breakpoint_ops *ops =
- breakpoint_ops_for_event_location (eloc.get (), false);
+ breakpoint_ops_for_location_spec (locspec.get (), false);
create_breakpoint (get_current_arch (),
- eloc.get (), NULL, -1, NULL, false,
+ locspec.get (), NULL, -1, NULL, false,
0,
temporary, bp_breakpoint,
0,
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- const char *str;
if (bp_smob->bp->type != bp_breakpoint)
return SCM_BOOL_F;
- str = event_location_to_string (bp_smob->bp->location.get ());
- if (! str)
+ const char *str
+ = location_spec_to_string (bp_smob->bp->locspec.get ());
+ if (str == nullptr)
str = "";
return gdbscm_scm_from_c_string (str);
static void
canonicalize_linespec (struct linespec_state *state, const linespec *ls)
{
- struct event_location *canon;
+ location_spec *canon;
struct explicit_location *explicit_loc;
/* If canonicalization was not requested, no need to do anything. */
return;
/* Save everything as an explicit location. */
- state->canonical->location
- = new_explicit_location (&ls->explicit_loc);
- canon = state->canonical->location.get ();
+ state->canonical->locspec
+ = new_explicit_location_spec (&ls->explicit_loc);
+ canon = state->canonical->locspec.get ();
explicit_loc = get_explicit_location (canon);
if (explicit_loc->label_name != NULL)
/* If this location originally came from a linespec, save a string
representation of it for display and saving to file. */
if (state->is_linespec)
- set_event_location_string (canon,
- explicit_location_to_linespec (explicit_loc));
+ set_location_spec_string (canon,
+ explicit_location_to_linespec (explicit_loc));
}
/* Given a line offset in LS, construct the relevant SALs. */
}
/* A helper function for decode_line_full and decode_line_1 to
- turn LOCATION into std::vector<symtab_and_line>. */
+ turn LOCSPEC into std::vector<symtab_and_line>. */
static std::vector<symtab_and_line>
-event_location_to_sals (linespec_parser *parser,
- const struct event_location *location)
+location_spec_to_sals (linespec_parser *parser,
+ const location_spec *locspec)
{
std::vector<symtab_and_line> result;
- switch (event_location_type (location))
+ switch (location_spec_type (locspec))
{
- case LINESPEC_LOCATION:
+ case LINESPEC_LOCATION_SPEC:
{
PARSER_STATE (parser)->is_linespec = 1;
try
{
- const linespec_location *ls = get_linespec_location (location);
+ const linespec_location *ls = get_linespec_location (locspec);
result = parse_linespec (parser,
ls->spec_string, ls->match_type);
}
}
break;
- case ADDRESS_LOCATION:
+ case ADDRESS_LOCATION_SPEC:
{
- const char *addr_string = get_address_string_location (location);
- CORE_ADDR addr = get_address_location (location);
+ const char *addr_string = get_address_string_location (locspec);
+ CORE_ADDR addr = get_address_location (locspec);
if (addr_string != NULL)
{
addr = linespec_expression_to_pc (&addr_string);
if (PARSER_STATE (parser)->canonical != NULL)
- PARSER_STATE (parser)->canonical->location
- = copy_event_location (location);
+ PARSER_STATE (parser)->canonical->locspec
+ = copy_location_spec (locspec);
}
result = convert_address_location_to_sals (PARSER_STATE (parser),
}
break;
- case EXPLICIT_LOCATION:
+ case EXPLICIT_LOCATION_SPEC:
{
const struct explicit_location *explicit_loc;
- explicit_loc = get_explicit_location_const (location);
+ explicit_loc = get_explicit_location_const (locspec);
result = convert_explicit_location_to_sals (PARSER_STATE (parser),
PARSER_RESULT (parser),
explicit_loc);
}
break;
- case PROBE_LOCATION:
+ case PROBE_LOCATION_SPEC:
/* Probes are handled by their own decoders. */
gdb_assert_not_reached ("attempt to decode probe location");
break;
default:
- gdb_assert_not_reached ("unhandled event location type");
+ gdb_assert_not_reached ("unhandled location spec type");
}
return result;
/* See linespec.h. */
void
-decode_line_full (struct event_location *location, int flags,
+decode_line_full (struct location_spec *locspec, int flags,
struct program_space *search_pspace,
struct symtab *default_symtab,
int default_line, struct linespec_result *canonical,
scoped_restore_current_program_space restore_pspace;
- std::vector<symtab_and_line> result = event_location_to_sals (&parser,
- location);
+ std::vector<symtab_and_line> result = location_spec_to_sals (&parser,
+ locspec);
state = PARSER_STATE (&parser);
if (result.size () == 0)
throw_error (NOT_SUPPORTED_ERROR, _("Location %s not available"),
- event_location_to_string (location));
+ location_spec_to_string (locspec));
gdb_assert (result.size () == 1 || canonical->pre_expanded);
canonical->pre_expanded = 1;
/* See linespec.h. */
std::vector<symtab_and_line>
-decode_line_1 (const struct event_location *location, int flags,
+decode_line_1 (const location_spec *locspec, int flags,
struct program_space *search_pspace,
struct symtab *default_symtab,
int default_line)
scoped_restore_current_program_space restore_pspace;
- return event_location_to_sals (&parser, location);
+ return location_spec_to_sals (&parser, locspec);
}
/* See linespec.h. */
and get a default source symtab+line or it will recursively call us! */
symtab_and_line cursal = get_current_source_symtab_and_line ();
- event_location_up location = string_to_event_location (&string,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&string,
+ current_language);
std::vector<symtab_and_line> sals
- = decode_line_1 (location.get (), flags, NULL, cursal.symtab, cursal.line);
+ = decode_line_1 (locspec.get (), flags, NULL, cursal.symtab, cursal.line);
if (*string)
error (_("Junk at end of line specification: %s"), string);
if (string == 0)
error (_("Empty line specification."));
- event_location_up location = string_to_event_location (&string,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&string,
+ current_language);
std::vector<symtab_and_line> sals
= (last_displayed_sal_is_valid ()
- ? decode_line_1 (location.get (), flags, NULL,
+ ? decode_line_1 (locspec.get (), flags, NULL,
get_last_displayed_symtab (),
get_last_displayed_line ())
- : decode_line_1 (location.get (), flags, NULL, NULL, 0));
+ : decode_line_1 (locspec.get (), flags, NULL, NULL, 0));
if (*string)
error (_("Junk at end of line specification: %s"), string);
else
str = saved_arg;
- self->canonical->location
- = new_linespec_location (&str, symbol_name_match_type::FULL);
+ self->canonical->locspec
+ = new_linespec_location_spec (&str, symbol_name_match_type::FULL);
}
}
object. */
bool pre_expanded = false;
- /* If PRE_EXPANDED is non-zero, this is set to the location entered
- by the user. */
- event_location_up location;
+ /* If PRE_EXPANDED is true, this is set to the location spec
+ entered by the user. */
+ location_spec_up locspec;
/* The sals. The vector will be freed by the destructor. */
std::vector<linespec_sals> lsals;
/* Decode a linespec using the provided default symtab and line. */
extern std::vector<symtab_and_line>
- decode_line_1 (const struct event_location *location, int flags,
+ decode_line_1 (const location_spec *locspec, int flags,
struct program_space *search_pspace,
struct symtab *default_symtab, int default_line);
-/* Parse LOCATION and return results. This is the "full"
+/* Parse LOCSPEC and return results. This is the "full"
interface to this module, which handles multiple results
properly.
strcmp sense) to FILTER will be returned; all others will be
filtered out. */
-extern void decode_line_full (struct event_location *location, int flags,
+extern void decode_line_full (struct location_spec *locspec, int flags,
struct program_space *search_pspace,
struct symtab *default_symtab, int default_line,
struct linespec_result *canonical,
-/* Data structures and API for event locations in GDB.
+/* Data structures and API for location specs in GDB.
Copyright (C) 2013-2022 Free Software Foundation, Inc.
This file is part of GDB.
static std::string explicit_location_to_string
(const struct explicit_location *explicit_loc);
-/* The base class for all an event locations used to set a stop event
- in the inferior. */
+/* The base class for all location specs used to match actual
+ locations in the inferior. */
-struct event_location
+struct location_spec
{
- virtual ~event_location () = default;
+ virtual ~location_spec () = default;
/* Clone this object. */
- virtual event_location_up clone () const = 0;
+ virtual location_spec_up clone () const = 0;
- /* Return true if this location is empty, false otherwise. */
+ /* Return true if this location spec is empty, false otherwise. */
virtual bool empty_p () const = 0;
/* Return a string representation of this location. */
return as_string.c_str ();
}
- DISABLE_COPY_AND_ASSIGN (event_location);
+ DISABLE_COPY_AND_ASSIGN (location_spec);
- /* The type of this breakpoint specification. */
- enum event_location_type type;
+ /* The type of this location specification. */
+ enum location_spec_type type;
- /* Cached string representation of this location. This is used,
- e.g., to save stop event locations to file. */
+ /* Cached string representation of this location spec. This is
+ used, e.g., to save location specs to file. */
mutable std::string as_string;
protected:
- explicit event_location (enum event_location_type t)
+ explicit location_spec (enum location_spec_type t)
: type (t)
{
}
- event_location (enum event_location_type t, std::string &&str)
+ location_spec (enum location_spec_type t, std::string &&str)
: type (t),
as_string (std::move (str))
{
}
- explicit event_location (const event_location *to_clone)
+ explicit location_spec (const location_spec *to_clone)
: type (to_clone->type),
as_string (to_clone->as_string)
{
};
/* A probe. */
-struct event_location_probe : public event_location
+struct probe_location_spec : public location_spec
{
- explicit event_location_probe (std::string &&probe)
- : event_location (PROBE_LOCATION, std::move (probe))
+ explicit probe_location_spec (std::string &&probe)
+ : location_spec (PROBE_LOCATION_SPEC, std::move (probe))
{
}
- event_location_up clone () const override
+ location_spec_up clone () const override
{
- return event_location_up (new event_location_probe (this));
+ return location_spec_up (new probe_location_spec (this));
}
bool empty_p () const override
protected:
- explicit event_location_probe (const event_location_probe *to_clone)
- : event_location (to_clone)
+ explicit probe_location_spec (const probe_location_spec *to_clone)
+ : location_spec (to_clone)
{
}
};
/* A "normal" linespec. */
-struct event_location_linespec : public event_location
+struct linespec_location_spec : public location_spec
{
- event_location_linespec (const char **linespec,
- symbol_name_match_type match_type)
- : event_location (LINESPEC_LOCATION)
+ linespec_location_spec (const char **linespec,
+ symbol_name_match_type match_type)
+ : location_spec (LINESPEC_LOCATION_SPEC)
{
linespec_location.match_type = match_type;
if (*linespec != NULL)
}
}
- ~event_location_linespec ()
+ ~linespec_location_spec ()
{
xfree (linespec_location.spec_string);
}
- event_location_up clone () const override
+ location_spec_up clone () const override
{
- return event_location_up (new event_location_linespec (this));
+ return location_spec_up (new linespec_location_spec (this));
}
bool empty_p () const override
protected:
- explicit event_location_linespec (const event_location_linespec *to_clone)
- : event_location (to_clone),
+ explicit linespec_location_spec (const linespec_location_spec *to_clone)
+ : location_spec (to_clone),
linespec_location (to_clone->linespec_location)
{
if (linespec_location.spec_string != nullptr)
};
/* An address in the inferior. */
-struct event_location_address : public event_location
+struct address_location_spec : public location_spec
{
- event_location_address (CORE_ADDR addr, const char *addr_string,
- int addr_string_len)
- : event_location (ADDRESS_LOCATION),
+ address_location_spec (CORE_ADDR addr, const char *addr_string,
+ int addr_string_len)
+ : location_spec (ADDRESS_LOCATION_SPEC),
address (addr)
{
if (addr_string != nullptr)
as_string = std::string (addr_string, addr_string_len);
}
- event_location_up clone () const override
+ location_spec_up clone () const override
{
- return event_location_up (new event_location_address (this));
+ return location_spec_up (new address_location_spec (this));
}
bool empty_p () const override
protected:
- event_location_address (const event_location_address *to_clone)
- : event_location (to_clone),
+ address_location_spec (const address_location_spec *to_clone)
+ : location_spec (to_clone),
address (to_clone->address)
{
}
}
};
-/* An explicit location. */
-struct event_location_explicit : public event_location
+/* An explicit location spec. */
+struct explicit_location_spec : public location_spec
{
- explicit event_location_explicit (const struct explicit_location *loc)
- : event_location (EXPLICIT_LOCATION)
+ explicit explicit_location_spec (const struct explicit_location *loc)
+ : location_spec (EXPLICIT_LOCATION_SPEC)
{
copy_loc (loc);
}
- ~event_location_explicit ()
+ ~explicit_location_spec ()
{
xfree (explicit_loc.source_filename);
xfree (explicit_loc.function_name);
xfree (explicit_loc.label_name);
}
- event_location_up clone () const override
+ location_spec_up clone () const override
{
- return event_location_up (new event_location_explicit (this));
+ return location_spec_up (new explicit_location_spec (this));
}
bool empty_p () const override
protected:
- explicit event_location_explicit (const event_location_explicit *to_clone)
- : event_location (to_clone)
+ explicit explicit_location_spec (const explicit_location_spec *to_clone)
+ : location_spec (to_clone)
{
copy_loc (&to_clone->explicit_loc);
}
/* See description in location.h. */
-enum event_location_type
-event_location_type (const struct event_location *location)
+enum location_spec_type
+location_spec_type (const location_spec *locspec)
{
- return location->type;
+ return locspec->type;
}
/* See description in location.h. */
/* See description in location.h. */
-event_location_up
-new_linespec_location (const char **linespec,
- symbol_name_match_type match_type)
+location_spec_up
+new_linespec_location_spec (const char **linespec,
+ symbol_name_match_type match_type)
{
- return event_location_up (new event_location_linespec (linespec,
- match_type));
+ return location_spec_up (new linespec_location_spec (linespec,
+ match_type));
}
/* See description in location.h. */
const linespec_location *
-get_linespec_location (const struct event_location *location)
+get_linespec_location (const location_spec *locspec)
{
- gdb_assert (location->type == LINESPEC_LOCATION);
- return &((event_location_linespec *) location)->linespec_location;
+ gdb_assert (locspec->type == LINESPEC_LOCATION_SPEC);
+ return &((linespec_location_spec *) locspec)->linespec_location;
}
/* See description in location.h. */
-event_location_up
-new_address_location (CORE_ADDR addr, const char *addr_string,
- int addr_string_len)
+location_spec_up
+new_address_location_spec (CORE_ADDR addr, const char *addr_string,
+ int addr_string_len)
{
- return event_location_up (new event_location_address (addr, addr_string,
- addr_string_len));
+ return location_spec_up (new address_location_spec (addr, addr_string,
+ addr_string_len));
}
/* See description in location.h. */
CORE_ADDR
-get_address_location (const struct event_location *location)
+get_address_location (const location_spec *locspec)
{
- gdb_assert (location->type == ADDRESS_LOCATION);
- return ((event_location_address *) location)->address;
+ gdb_assert (locspec->type == ADDRESS_LOCATION_SPEC);
+ return ((address_location_spec *) locspec)->address;
}
/* See description in location.h. */
const char *
-get_address_string_location (const struct event_location *location)
+get_address_string_location (const location_spec *locspec)
{
- gdb_assert (location->type == ADDRESS_LOCATION);
- return location->to_string ();
+ gdb_assert (locspec->type == ADDRESS_LOCATION_SPEC);
+ return locspec->to_string ();
}
/* See description in location.h. */
-event_location_up
-new_probe_location (std::string &&probe)
+location_spec_up
+new_probe_location_spec (std::string &&probe)
{
- return event_location_up (new event_location_probe (std::move (probe)));
+ return location_spec_up (new probe_location_spec (std::move (probe)));
}
/* See description in location.h. */
const char *
-get_probe_location (const struct event_location *location)
+get_probe_location_spec_string (const location_spec *locspec)
{
- gdb_assert (location->type == PROBE_LOCATION);
- return location->to_string ();
+ gdb_assert (locspec->type == PROBE_LOCATION_SPEC);
+ return locspec->to_string ();
}
/* See description in location.h. */
-event_location_up
-new_explicit_location (const struct explicit_location *explicit_loc)
+location_spec_up
+new_explicit_location_spec (const explicit_location *explicit_loc)
{
- return event_location_up (new event_location_explicit (explicit_loc));
+ return location_spec_up (new explicit_location_spec (explicit_loc));
}
/* See description in location.h. */
struct explicit_location *
-get_explicit_location (struct event_location *location)
+get_explicit_location (location_spec *locspec)
{
- gdb_assert (location->type == EXPLICIT_LOCATION);
- return &((event_location_explicit *) location)->explicit_loc;
+ gdb_assert (locspec->type == EXPLICIT_LOCATION_SPEC);
+ return &((explicit_location_spec *) locspec)->explicit_loc;
}
/* See description in location.h. */
const struct explicit_location *
-get_explicit_location_const (const struct event_location *location)
+get_explicit_location_const (const location_spec *locspec)
{
- gdb_assert (location->type == EXPLICIT_LOCATION);
- return &((event_location_explicit *) location)->explicit_loc;
+ gdb_assert (locspec->type == EXPLICIT_LOCATION_SPEC);
+ return &((explicit_location_spec *) locspec)->explicit_loc;
}
-/* This convenience function returns a malloc'd string which
- represents the location in EXPLICIT_LOC.
+/* Return a string representation of the explicit location spec in
+ EXPLICIT_LOCSPEC.
- AS_LINESPEC is true if this string should be a linespec.
- Otherwise it will be output in explicit form. */
+ AS_LINESPEC is true if this string should be a linespec. Otherwise
+ it will be output in explicit form. */
static std::string
explicit_to_string_internal (bool as_linespec,
/* See description in location.h. */
-event_location_up
-copy_event_location (const struct event_location *src)
+location_spec_up
+copy_location_spec (const location_spec *src)
{
return src->clone ();
}
void
-event_location_deleter::operator() (event_location *location) const
+location_spec_deleter::operator() (location_spec *locspec) const
{
- delete location;
+ delete locspec;
}
/* See description in location.h. */
const char *
-event_location_to_string (struct event_location *location)
+location_spec_to_string (struct location_spec *locspec)
{
- return location->to_string ();
+ return locspec->to_string ();
}
/* Find an instance of the quote character C in the string S that is
return 0;
}
-/* A lexer for explicit locations. This function will advance INP
- past any strings that it lexes. Returns a malloc'd copy of the
+/* A lexer for explicit location specs. This function will advance
+ INP past any strings that it lexes. Returns a malloc'd copy of the
lexed string or NULL if no lexing was done. */
static gdb::unique_xmalloc_ptr<char>
-explicit_location_lex_one (const char **inp,
- const struct language_defn *language,
- explicit_completion_info *completion_info)
+explicit_location_spec_lex_one (const char **inp,
+ const struct language_defn *language,
+ explicit_completion_info *completion_info)
{
const char *start = *inp;
}
/* When scanning the input string looking for the next explicit
- location option/delimiter, we jump to the next option by looking
+ location spec option/delimiter, we jump to the next option by looking
for ",", and "-". Such a character can also appear in C++ symbols
like "operator," and "operator-". So when we find such a
character, we call this function to check if we found such a
return first;
}
-/* A lexer for functions in explicit locations. This function will
+/* A lexer for functions in explicit location specs. This function will
advance INP past a function until the next option, or until end of
string. Returns a malloc'd copy of the lexed string or NULL if no
lexing was done. */
static gdb::unique_xmalloc_ptr<char>
-explicit_location_lex_one_function (const char **inp,
- const struct language_defn *language,
- explicit_completion_info *completion_info)
+explicit_location_spec_lex_one_function
+ (const char **inp,
+ const struct language_defn *language,
+ explicit_completion_info *completion_info)
{
const char *start = *inp;
/* See description in location.h. */
-event_location_up
-string_to_explicit_location (const char **argp,
- const struct language_defn *language,
- explicit_completion_info *completion_info)
+location_spec_up
+string_to_explicit_location_spec (const char **argp,
+ const struct language_defn *language,
+ explicit_completion_info *completion_info)
{
/* It is assumed that input beginning with '-' and a non-digit
character is an explicit location. "-p" is reserved, though,
|| ((*argp)[0] == '-' && (*argp)[1] == 'p'))
return NULL;
- std::unique_ptr<event_location_explicit> location
- (new event_location_explicit ((const explicit_location *) nullptr));
+ std::unique_ptr<explicit_location_spec> locspec
+ (new explicit_location_spec ((const explicit_location *) nullptr));
/* Process option/argument pairs. dprintf_command
requires that processing stop on ','. */
/* Get the option string. */
gdb::unique_xmalloc_ptr<char> opt
- = explicit_location_lex_one (argp, language, NULL);
+ = explicit_location_spec_lex_one (argp, language, NULL);
/* Use the length of the option to allow abbreviations. */
len = strlen (opt.get ());
/* We do this here because the set of options that take
arguments matches the set of explicit location
options. */
- completion_info->saw_explicit_location_option = true;
+ completion_info->saw_explicit_location_spec_option = true;
}
oarg = std::move (arg);
have_oarg = oarg != NULL;
if (strncmp (opt.get (), "-source", len) == 0)
{
- set_oarg (explicit_location_lex_one (argp, language,
- completion_info));
- location->explicit_loc.source_filename = oarg.release ();
+ set_oarg (explicit_location_spec_lex_one (argp, language,
+ completion_info));
+ locspec->explicit_loc.source_filename = oarg.release ();
}
else if (strncmp (opt.get (), "-function", len) == 0)
{
- set_oarg (explicit_location_lex_one_function (argp, language,
- completion_info));
- location->explicit_loc.function_name = oarg.release ();
+ set_oarg (explicit_location_spec_lex_one_function (argp, language,
+ completion_info));
+ locspec->explicit_loc.function_name = oarg.release ();
}
else if (strncmp (opt.get (), "-qualified", len) == 0)
{
- location->explicit_loc.func_name_match_type
+ locspec->explicit_loc.func_name_match_type
= symbol_name_match_type::FULL;
}
else if (strncmp (opt.get (), "-line", len) == 0)
{
- set_oarg (explicit_location_lex_one (argp, language, NULL));
+ set_oarg (explicit_location_spec_lex_one (argp, language, NULL));
*argp = skip_spaces (*argp);
if (have_oarg)
{
- location->explicit_loc.line_offset
+ locspec->explicit_loc.line_offset
= linespec_parse_line_offset (oarg.get ());
continue;
}
}
else if (strncmp (opt.get (), "-label", len) == 0)
{
- set_oarg (explicit_location_lex_one (argp, language, completion_info));
- location->explicit_loc.label_name = oarg.release ();
+ set_oarg (explicit_location_spec_lex_one (argp, language,
+ completion_info));
+ locspec->explicit_loc.label_name = oarg.release ();
}
/* Only emit an "invalid argument" error for options
that look like option strings. */
/* One special error check: If a source filename was given
without offset, function, or label, issue an error. */
- if (location->explicit_loc.source_filename != NULL
- && location->explicit_loc.function_name == NULL
- && location->explicit_loc.label_name == NULL
- && (location->explicit_loc.line_offset.sign == LINE_OFFSET_UNKNOWN)
+ if (locspec->explicit_loc.source_filename != NULL
+ && locspec->explicit_loc.function_name == NULL
+ && locspec->explicit_loc.label_name == NULL
+ && (locspec->explicit_loc.line_offset.sign == LINE_OFFSET_UNKNOWN)
&& completion_info == NULL)
{
error (_("Source filename requires function, label, or "
"line offset."));
}
- return event_location_up (location.release ());
+ return location_spec_up (locspec.release ());
}
/* See description in location.h. */
-event_location_up
-string_to_event_location_basic (const char **stringp,
- const struct language_defn *language,
- symbol_name_match_type match_type)
+location_spec_up
+string_to_location_spec_basic (const char **stringp,
+ const struct language_defn *language,
+ symbol_name_match_type match_type)
{
- event_location_up location;
+ location_spec_up locspec;
const char *cs;
/* Try the input as a probe spec. */
cs = *stringp;
if (cs != NULL && probe_linespec_to_static_ops (&cs) != NULL)
{
- location = new_probe_location (*stringp);
+ locspec = new_probe_location_spec (*stringp);
*stringp += strlen (*stringp);
}
else
{
- /* Try an address location. */
+ /* Try an address location spec. */
if (*stringp != NULL && **stringp == '*')
{
const char *arg, *orig;
orig = arg = *stringp;
addr = linespec_expression_to_pc (&arg);
- location = new_address_location (addr, orig, arg - orig);
+ locspec = new_address_location_spec (addr, orig, arg - orig);
*stringp += arg - orig;
}
else
{
/* Everything else is a linespec. */
- location = new_linespec_location (stringp, match_type);
+ locspec = new_linespec_location_spec (stringp, match_type);
}
}
- return location;
+ return locspec;
}
/* See description in location.h. */
-event_location_up
-string_to_event_location (const char **stringp,
- const struct language_defn *language,
- symbol_name_match_type match_type)
+location_spec_up
+string_to_location_spec (const char **stringp,
+ const struct language_defn *language,
+ symbol_name_match_type match_type)
{
const char *arg, *orig;
- /* Try an explicit location. */
+ /* Try an explicit location spec. */
orig = arg = *stringp;
- event_location_up location = string_to_explicit_location (&arg, language, NULL);
- if (location != NULL)
+ location_spec_up locspec
+ = string_to_explicit_location_spec (&arg, language, NULL);
+ if (locspec != nullptr)
{
/* It was a valid explicit location. Advance STRINGP to
the end of input. */
*stringp += arg - orig;
- /* If the user really specified a location, then we're done. */
- if (!event_location_empty_p (location.get ()))
- return location;
+ /* If the user really specified a location spec, then we're
+ done. */
+ if (!location_spec_empty_p (locspec.get ()))
+ return locspec;
/* Otherwise, the user _only_ specified optional flags like
- "-qualified", otherwise string_to_explicit_location would
- have thrown an error. Save the flags for "basic" linespec
- parsing below and discard the explicit location. */
- event_location_explicit *xloc
- = dynamic_cast<event_location_explicit *> (location.get ());
+ "-qualified", otherwise string_to_explicit_location_spec
+ would have thrown an error. Save the flags for "basic"
+ linespec parsing below and discard the explicit location
+ spec. */
+ explicit_location_spec *xloc
+ = dynamic_cast<explicit_location_spec *> (locspec.get ());
gdb_assert (xloc != nullptr);
match_type = xloc->explicit_loc.func_name_match_type;
}
- /* Everything else is a "basic" linespec, address, or probe
- location. */
- return string_to_event_location_basic (stringp, language, match_type);
+ /* Everything else is a "basic" linespec, address, or probe location
+ spec. */
+ return string_to_location_spec_basic (stringp, language, match_type);
}
/* See description in location.h. */
int
-event_location_empty_p (const struct event_location *location)
+location_spec_empty_p (const location_spec *locspec)
{
- return location->empty_p ();
+ return locspec->empty_p ();
}
/* See description in location.h. */
void
-set_event_location_string (struct event_location *location,
- std::string &&string)
+set_location_spec_string (struct location_spec *locspec,
+ std::string &&string)
{
- location->as_string = std::move (string);
+ locspec->as_string = std::move (string);
}
-/* Data structures and API for event locations in GDB.
+/* Data structures and API for location specs in GDB.
Copyright (C) 2013-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "symtab.h"
struct language_defn;
-struct event_location;
+struct location_spec;
/* An enumeration of possible signs for a line offset. */
enum offset_relative_sign sign;
};
-/* An enumeration of the various ways to specify a stop event
- location (used with create_breakpoint). */
+/* An enumeration of the various ways to specify a location spec. */
-enum event_location_type
+enum location_spec_type
{
/* A traditional linespec. */
- LINESPEC_LOCATION,
+ LINESPEC_LOCATION_SPEC,
- /* An address in the inferior. */
- ADDRESS_LOCATION,
+ /* An address location spec. */
+ ADDRESS_LOCATION_SPEC,
- /* An explicit location. */
- EXPLICIT_LOCATION,
+ /* An explicit location spec. */
+ EXPLICIT_LOCATION_SPEC,
- /* A probe location. */
- PROBE_LOCATION
+ /* A probe location spec. */
+ PROBE_LOCATION_SPEC
};
/* A traditional linespec. */
char *spec_string;
};
-/* An explicit location. This structure is used to bypass the
+/* An explicit location spec. This structure is used to bypass the
parsing done on linespecs. It still has the same requirements
as linespecs, though. For example, source_filename requires
at least one other field. */
struct line_offset line_offset;
};
-/* Return the type of the given event location. */
+/* Return the type of the given location spec. */
-extern enum event_location_type
- event_location_type (const struct event_location *);
+extern enum location_spec_type
+ location_spec_type (const location_spec *);
/* Return a linespec string representation of the given explicit
- location. The location must already be canonicalized/valid. */
+ location spec. The location spec must already be
+ canonicalized/valid. */
-extern std::string
- explicit_location_to_linespec (const struct explicit_location *explicit_loc);
+extern std::string explicit_location_to_linespec
+ (const explicit_location *explicit_locspec);
-/* Return a string representation of the LOCATION.
+/* Return a string representation of LOCSPEC.
This function may return NULL for unspecified linespecs,
- e.g, LINESPEC_LOCATION and spec_string is NULL.
+ e.g, LINESPEC_LOCATION_SPEC and spec_string is NULL.
- The result is cached in LOCATION. */
+ The result is cached in LOCSPEC. */
extern const char *
- event_location_to_string (struct event_location *location);
+ location_spec_to_string (location_spec *locspec);
-/* A deleter for a struct event_location. */
+/* A deleter for a struct location_spec. */
-struct event_location_deleter
+struct location_spec_deleter
{
- void operator() (event_location *location) const;
+ void operator() (location_spec *locspec) const;
};
-/* A unique pointer for event_location. */
-typedef std::unique_ptr<event_location, event_location_deleter>
- event_location_up;
+/* A unique pointer for location_spec. */
+typedef std::unique_ptr<location_spec, location_spec_deleter>
+ location_spec_up;
-/* Create a new linespec location. */
+/* Create a new linespec location spec. */
-extern event_location_up new_linespec_location
+extern location_spec_up new_linespec_location_spec
(const char **linespec, symbol_name_match_type match_type);
-/* Return the linespec location of the given event_location (which
- must be of type LINESPEC_LOCATION). */
+/* Return the linespec location spec of the given location_spec (which
+ must be of type LINESPEC_LOCATION_SPEC). */
extern const linespec_location *
- get_linespec_location (const struct event_location *location);
+ get_linespec_location (const location_spec *locspec);
-/* Create a new address location.
- ADDR is the address corresponding to this event_location.
+/* Create a new address location spec.
+ ADDR is the address corresponding to this location_spec.
ADDR_STRING, a string of ADDR_STRING_LEN characters, is
the expression that was parsed to determine the address ADDR. */
-extern event_location_up new_address_location (CORE_ADDR addr,
- const char *addr_string,
- int addr_string_len);
+extern location_spec_up new_address_location_spec (CORE_ADDR addr,
+ const char *addr_string,
+ int addr_string_len);
-/* Return the address location (a CORE_ADDR) of the given event_location
- (which must be of type ADDRESS_LOCATION). */
+/* Return the address (a CORE_ADDR) of the given location_spec, which
+ must be of type ADDRESS_LOCATION_SPEC. */
extern CORE_ADDR
- get_address_location (const struct event_location *location);
+ get_address_location (const location_spec *locspec);
-/* Return the expression (a string) that was used to compute the address
- of the given event_location (which must be of type ADDRESS_LOCATION). */
+/* Return the expression (a string) that was used to compute the
+ address of the given location_spec, which must be of type
+ ADDRESS_LOCATION_SPEC. */
extern const char *
- get_address_string_location (const struct event_location *location);
+ get_address_string_location (const location_spec *locspec);
/* Create a new probe location. */
-extern event_location_up new_probe_location (std::string &&probe);
+extern location_spec_up new_probe_location_spec (std::string &&probe);
-/* Return the probe location (a string) of the given event_location
- (which must be of type PROBE_LOCATION). */
+/* Return the probe location spec string of the given location_spec,
+ which must be of type PROBE_LOCATION_SPEC. */
extern const char *
- get_probe_location (const struct event_location *location);
+ get_probe_location_spec_string (const location_spec *locspec);
/* Initialize the given explicit location. */
extern void
- initialize_explicit_location (struct explicit_location *explicit_loc);
+ initialize_explicit_location (explicit_location *locspec);
/* Create a new explicit location. If not NULL, EXPLICIT is checked for
validity. If invalid, an exception is thrown. */
-extern event_location_up
- new_explicit_location (const struct explicit_location *explicit_loc);
+extern location_spec_up
+ new_explicit_location_spec (const explicit_location *locspec);
-/* Return the explicit location of the given event_location
- (which must be of type EXPLICIT_LOCATION). */
+/* Return the explicit location spec of the given location_spec, which
+ must be of type EXPLICIT_LOCATION. */
extern struct explicit_location *
- get_explicit_location (struct event_location *location);
+ get_explicit_location (location_spec *locspec);
/* A const version of the above. */
-extern const struct explicit_location *
- get_explicit_location_const (const struct event_location *location);
+extern const explicit_location *
+ get_explicit_location_const (const location_spec *locspec);
-/* Return a copy of the given SRC location. */
+/* Return a copy of the given SRC location spec. */
-extern event_location_up
- copy_event_location (const struct event_location *src);
+extern location_spec_up copy_location_spec (const location_spec *src);
-/* Attempt to convert the input string in *ARGP into an event_location.
+/* Attempt to convert the input string in *ARGP into a location_spec.
ARGP is advanced past any processed input. Always returns a non-nullptr
- event_location unique pointer object.
+ location_spec unique pointer object.
This function may call error() if *ARGP looks like properly formed, but
invalid, input, e.g., if it is called with missing argument parameters
or invalid options.
This function is intended to be used by CLI commands and will parse
- explicit locations in a CLI-centric way. Other interfaces should use
- string_to_event_location_basic if they want to maintain support for
- legacy specifications of probe, address, and linespec locations.
+ explicit location specs in a CLI-centric way. Other interfaces should use
+ string_to_location_spec_basic if they want to maintain support for
+ legacy specifications of probe, address, and linespec location specs.
MATCH_TYPE should be either WILD or FULL. If -q/--qualified is specified
in the input string, it will take precedence over this parameter. */
-extern event_location_up string_to_event_location
+extern location_spec_up string_to_location_spec
(const char **argp, const struct language_defn *language,
symbol_name_match_type match_type = symbol_name_match_type::WILD);
-/* Like string_to_event_location, but does not attempt to parse
- explicit locations. MATCH_TYPE indicates how function names should
- be matched. */
+/* Like string_to_location_spec, but does not attempt to parse
+ explicit location specs. MATCH_TYPE indicates how function names
+ should be matched. */
-extern event_location_up
- string_to_event_location_basic (const char **argp,
- const struct language_defn *language,
- symbol_name_match_type match_type);
+extern location_spec_up
+ string_to_location_spec_basic (const char **argp,
+ const struct language_defn *language,
+ symbol_name_match_type match_type);
-/* Structure filled in by string_to_explicit_location to aid the
+/* Structure filled in by string_to_explicit_location_spec to aid the
completer. */
struct explicit_completion_info
{
const char *quoted_arg_start = NULL;
const char *quoted_arg_end = NULL;
- /* True if we saw an explicit location option, as opposed to only
- flags that affect both explicit locations and linespecs, like
- "-qualified". */
- bool saw_explicit_location_option = false;
+ /* True if we saw an explicit location spec option, as opposed to
+ only flags that affect both explicit location specs and
+ linespecs, like "-qualified". */
+ bool saw_explicit_location_spec_option = false;
};
-/* Attempt to convert the input string in *ARGP into an explicit location.
- ARGP is advanced past any processed input. Returns an event_location
- (malloc'd) if an explicit location was successfully found in *ARGP,
- NULL otherwise.
+/* Attempt to convert the input string in *ARGP into an explicit
+ location spec. ARGP is advanced past any processed input. Returns
+ a location_spec (malloc'd) if an explicit location spec was
+ successfully found in *ARGP, NULL otherwise.
If COMPLETION_INFO is NULL, this function may call error() if *ARGP
looks like improperly formed input, e.g., if it is called with
missing argument parameters or invalid options. If COMPLETION_INFO
is not NULL, this function will not throw any exceptions. */
-extern event_location_up
- string_to_explicit_location (const char **argp,
- const struct language_defn *language,
- explicit_completion_info *completion_info);
+extern location_spec_up
+ string_to_explicit_location_spec (const char **argp,
+ const struct language_defn *language,
+ explicit_completion_info *completion_info);
-/* A convenience function for testing for unset locations. */
+/* A convenience function for testing for unset location specs. */
-extern int event_location_empty_p (const struct event_location *location);
+extern int location_spec_empty_p (const location_spec *locspec);
-/* Set the location's string representation. */
+/* Set the location specs's string representation. */
-extern void
- set_event_location_string (struct event_location *location,
- std::string &&string);
+extern void set_location_spec_string (struct location_spec *locspec,
+ std::string &&string);
#endif /* LOCATION_H */
int tracepoint = 0;
symbol_name_match_type match_type = symbol_name_match_type::WILD;
enum bptype type_wanted;
- event_location_up location;
+ location_spec_up locspec;
const struct breakpoint_ops *ops;
int is_explicit = 0;
struct explicit_location explicit_loc;
A simulator or an emulator could conceivably implement fast
regular non-jump based tracepoints. */
type_wanted = hardware ? bp_fast_tracepoint : bp_tracepoint;
- ops = breakpoint_ops_for_event_location (nullptr, true);
+ ops = breakpoint_ops_for_location_spec (nullptr, true);
}
else if (dprintf)
{
explicit_loc.func_name_match_type = match_type;
- location = new_explicit_location (&explicit_loc);
+ locspec = new_explicit_location_spec (&explicit_loc);
}
else
{
- location = string_to_event_location_basic (&address, current_language,
- match_type);
+ locspec = string_to_location_spec_basic (&address, current_language,
+ match_type);
if (*address)
error (_("Garbage '%s' at end of location"), address);
}
- create_breakpoint (get_current_arch (), location.get (), condition, thread,
+ create_breakpoint (get_current_arch (), locspec.get (), condition, thread,
extra_string.c_str (),
force_condition,
0 /* condition and thread are valid. */,
/* See definition in probe.h. */
std::vector<symtab_and_line>
-parse_probes (const struct event_location *location,
+parse_probes (const location_spec *locspec,
struct program_space *search_pspace,
struct linespec_result *canonical)
{
char *objfile_namestr = NULL, *provider = NULL, *name, *p;
const char *arg_start, *cs;
- gdb_assert (event_location_type (location) == PROBE_LOCATION);
- arg_start = get_probe_location (location);
+ gdb_assert (location_spec_type (locspec) == PROBE_LOCATION_SPEC);
+ arg_start = get_probe_location_spec_string (locspec);
cs = arg_start;
const static_probe_ops *spops = probe_linespec_to_static_ops (&cs);
std::string canon (arg_start, arg_end - arg_start);
canonical->special_display = 1;
canonical->pre_expanded = 1;
- canonical->location = new_probe_location (std::move (canon));
+ canonical->locspec = new_probe_location_spec (std::move (canon));
}
return result;
#include "symtab.h"
-struct event_location;
+struct location_spec;
struct linespec_result;
/* Structure useful for passing the header names in the method
throws an error. */
extern std::vector<symtab_and_line> parse_probes
- (const struct event_location *loc,
+ (const location_spec *locspec,
struct program_space *pspace,
struct linespec_result *canon);
&& obj->bp->type != bp_hardware_breakpoint)
Py_RETURN_NONE;
- const char *str = event_location_to_string (obj->bp->location.get ());
- if (! str)
+ const char *str = location_spec_to_string (obj->bp->locspec.get ());
+ if (str == nullptr)
str = "";
return host_string_to_python_string (str).release ();
}
case bp_breakpoint:
case bp_hardware_breakpoint:
{
- event_location_up location;
+ location_spec_up locspec;
symbol_name_match_type func_name_match_type
= (qualified != NULL && PyObject_IsTrue (qualified)
? symbol_name_match_type::FULL
copy_holder (xstrdup (skip_spaces (spec)));
const char *copy = copy_holder.get ();
- location = string_to_event_location (©,
- current_language,
- func_name_match_type);
+ locspec = string_to_location_spec (©,
+ current_language,
+ func_name_match_type);
}
else
{
explicit_loc.func_name_match_type = func_name_match_type;
- location = new_explicit_location (&explicit_loc);
+ locspec = new_explicit_location_spec (&explicit_loc);
}
- const struct breakpoint_ops *ops =
- breakpoint_ops_for_event_location (location.get (), false);
+ const struct breakpoint_ops *ops
+ = breakpoint_ops_for_location_spec (locspec.get (), false);
create_breakpoint (gdbpy_enter::get_gdbarch (),
- location.get (), NULL, -1, NULL, false,
+ locspec.get (), NULL, -1, NULL, false,
0,
temporary_bp, type,
0,
try
{
/* Set a breakpoint on the return address. */
- event_location_up location
- = new_address_location (get_frame_pc (prev_frame), NULL, 0);
+ location_spec_up locspec
+ = new_address_location_spec (get_frame_pc (prev_frame), NULL, 0);
create_breakpoint (gdbpy_enter::get_gdbarch (),
- location.get (), NULL, thread, NULL, false,
+ locspec.get (), NULL, thread, NULL, false,
0,
1 /*temp_flag*/,
bp_breakpoint,
const char *arg = NULL;
gdbpy_ref<> result;
gdbpy_ref<> unparsed;
- event_location_up location;
+ location_spec_up locspec;
if (! PyArg_ParseTuple (args, "|s", &arg))
return NULL;
}
if (arg != NULL)
- location = string_to_event_location_basic (&arg, current_language,
- symbol_name_match_type::WILD);
+ locspec = string_to_location_spec_basic (&arg, current_language,
+ symbol_name_match_type::WILD);
std::vector<symtab_and_line> decoded_sals;
symtab_and_line def_sal;
gdb::array_view<symtab_and_line> sals;
try
{
- if (location != NULL)
+ if (locspec != NULL)
{
- decoded_sals = decode_line_1 (location.get (), 0, NULL, NULL, 0);
+ decoded_sals = decode_line_1 (locspec.get (), 0, NULL, NULL, 0);
sals = decoded_sals;
}
else
if (packet_support (PACKET_TracepointSource) == PACKET_ENABLE)
{
- if (b->location != NULL)
+ if (b->locspec != nullptr)
{
ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
if (ret < 0 || ret >= buf.size ())
error ("%s", err_msg);
- encode_source_string (b->number, loc->address, "at",
- event_location_to_string (b->location.get ()),
+ const char *str = location_spec_to_string (b->locspec.get ());
+ encode_source_string (b->number, loc->address, "at", str,
buf.data () + strlen (buf.data ()),
buf.size () - strlen (buf.data ()));
putpkt (buf.data ());
error (_("requires an argument (function, "
"line or *addr) to define a scope"));
- event_location_up location = string_to_event_location (&args,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&args,
+ current_language);
std::vector<symtab_and_line> sals
- = decode_line_1 (location.get (), DECODE_LINE_FUNFIRSTLINE,
+ = decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE,
NULL, NULL, 0);
if (sals.empty ())
{