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;
};
struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data;
CORE_ADDR addr;
- struct explicit_location explicit_loc;
bp_objfile_data = get_breakpoint_objfile_data (objfile);
addr = bp_objfile_data->overlay_msym.value_address ();
b = create_internal_breakpoint (objfile->arch (), addr,
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_function (func_name);
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;
}
struct breakpoint *b;
const char *func_name;
CORE_ADDR addr;
- struct explicit_location explicit_loc;
if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym))
continue;
addr = bp_objfile_data->longjmp_msym[i].value_address ();
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_function (func_name);
b->enable_state = bp_disabled;
installed_bp++;
}
{
struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data;
- struct explicit_location explicit_loc;
bp_objfile_data = get_breakpoint_objfile_data (objfile);
addr = bp_objfile_data->terminate_msym.value_address ();
b = create_internal_breakpoint (objfile->arch (), addr,
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_function (func_name);
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;
}
struct gdbarch *gdbarch;
struct breakpoint_objfile_data *bp_objfile_data;
CORE_ADDR addr;
- struct explicit_location explicit_loc;
bp_objfile_data = get_breakpoint_objfile_data (objfile);
addr = gdbarch_convert_from_func_ptr_addr
(gdbarch, addr, current_inferior ()->top_target ());
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_function (func_name);
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 && b->locspec->empty_p ());
}
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 != nullptr
+ ? canonical->locspec->clone ()
+ : nullptr);
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 = as_linespec_location_spec (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 = as_linespec_location_spec (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 = locspec->clone ();
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 = as_linespec_location_spec (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 = canonical->locspec->clone ();
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 = as_linespec_location_spec (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,
};
struct symbol *sym;
struct static_tracepoint_marker *tpmarker;
struct ui_out *uiout = current_uiout;
- struct explicit_location explicit_loc;
tpmarker = &markers[0];
b->loc->line_number = sal2.line;
b->loc->symtab = sym != NULL ? sal2.symtab : NULL;
- b->location.reset (NULL);
- 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);
+ std::unique_ptr<explicit_location_spec> els
+ (new explicit_location_spec ());
+ els->source_filename
+ = xstrdup (symtab_to_filename_for_display (sal2.symtab));
+ els->line_offset.offset = b->loc->line_number;
+ els->line_offset.sign = LINE_OFFSET_NONE;
+
+ b->locspec = std::move (els);
/* 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,