[RFA 3/9] Explicit locations v2 - Locations refactor

Keith Seitz keiths@redhat.com
Thu May 8 18:00:00 GMT 2014


Hi,

This patch is the "big one." It changes the breakpoint methods and 
auxiliary functions (like decode_line_full) to take a "location" (struct 
event_location) instead of an address string.

Unfortunately, this includes using the new location API (from the 
previous patch) to keep everything working regression-free, so it is a 
bit larger than I would have liked, but a lot of it is "simple" 
boilerplate for creating event locations in the various breakpoint commands.

Once again, this patch only supports linespec locations. The following 
patches will introduce other location types (address, probe, explicit).

This patch introduces no new tests. The current test suite does a 
superlative job of testing the status quo.

Keith

ChangeLog
2014-05-08  Keith Seitz  <keiths@redhat.com>

	* ax-gdb.c: Include location.h.
	(agent_command_1)) Use linespec location instead of address
	string.
	* break-catch-throw.c: Include location.h
	(re_set_exception_catchpoint): Use linespec location instead
	of address string.
	* breakpoint.c: Include location.h.
	(create_overlay_event_breakpoint): Use linespec location
	location instead of address string.
	(create_longjmp_master_breakpoint): Likewise.
	(create_std_terminate_master_breakpoint): Likewise.
	(create_exception_master_breakpoint): Likewise.
	(update_breakpoints_after_exec): Likewise.
	(print_breakpoint_location): Use locations and
	event_location_to_string.
	(print_one_breakpoint_location): Likewise.
	(init_raw_breakpoint_without_location): Initialize
	b->location.
	(create_thread_event_breakpoint): Use linespec location instead of
	address string.
	(init_breakpoint_sal): Likewise.
	Only save extra_string if it is non-NULL and not the empty string.
	Use event_location_to_string instead of `addr_string'.
	Constify `p'.
	Use skip_spaces_const/skip_space_const instead of non-const versions.
	Copy the location into the breakpoint.
	If LOCATION is NULL, save the breakpoint address as a linespec location
	instead of an address string.
	(create_breakpoint_sal): Change `addr_string' parameter to a struct
	event_location. All uses updated.
	(create_breakpoints_sal): Likewise for local variable `addr_string'.
	(parse_breakpoint_sals): Use locations instead of address strings.
	Gaurd against NULL address string when not using the default
	breakpoint.
	(create_breakpoint): Change `arg' to a struct event_location and
	rename.
	Remove `copy_arg' and `addr_start'.
	Save the SAVE_SPEC of the location for pending breakpoints.
	For non-linespec locations, pass `extra_string' to
	find_condition_and_thread.
	Copy the location inlto the breakpoint instead of an address string.
	If the breakpoint location's SAVE_SPEC  is not set and there is a
	string representation, save it as the SAVE_SPEC.
	(break_command_1): Use string_to_event_location and pass this to
	create_breakpoint instead of an address string.
	Check against `arg_cp' for a probe linespec.
	(dprintf_command): Use string_to_event_location and pass this to
	create_breakpoint instead of an address string.
	(print_recreate_ranged_breakpoint): Use the location's SAVE_SPEC for
	recreating the breakpoint.
	(break_range_command): Use locations instead of address strings.
	(until_break_command): Likewise.
	(init_ada_exception_breakpoint): Likewise.
	(say_where): Likewise.
	(base_breakpoint_dtor): Delete `location' and `location_range_end' of
	the breakpoint.
	(base_breakpoint_create_sals_from_location): Use struct event_location
	instead of address string.
	Remove `addr_start' and `copy_arg' parameters.
	(base_breakpoint_decode_location): Use struct event_location instead of
	address string.
	(bkpt_re_set): Use locations instead of address strings.
	(bkpt_print_recreate): Use the location's SAVE_SPEC instead of
	an address string.
	(bkpt_create_sals_from_location): Use struct event_location instead of
	address string.
	(bkpt_probe_create_sals_from_location): Likewise.
	(bkpt_probe_decode_location): Use struct event_location instead of
	address string.
	(tracepoint_print_recreate): Use the location's SAVE_SPEC for
	recreating the tracepoint.
	(tracepoint_create_sals_from_location): Use struct event_location
	instead of address string.
	(tracepoint_decode_location): Likewise.
	(tracepoint_probe_decode_location): Likewise.
	(strace_marker_create_sals_from_location): Likewise.
	(strace_marker_create_breakpoints_sal): Likewise.
	(strace_marker_decode_location): Likewise.
	(location_to_sals): Likewise.
	For non-linespec locations, pass `extra_string' to
	find_condition_and_thread.
	When a pending breakpoint has been resolved, set a
	new SAVE_SPEC for the location.
	(breakpoint_re_set_default): Use locations instead of address
	strings.
	(create_sals_from_location_default): Use locations instead of
	address strings.
	(decode_location_default): Use locations instead of address strings.
	(trace_command): Use locations instead of address strings.
	(ftrace_command): Likewise.
	(strace_command): Likewise.
	(create_tracepoint_from_upload): Likewise.
	* breakpoint.h (struct breakpoint_ops) <create_sals_from_location>:
	Use struct event_location instead of address string.
	Update all uses.
	<decode_location>: Likewise.
	(struct breakpoint) <addr_string>: Change to struct event_location
	and rename `location'.
	<addr_string_range_end>: Change to struct event_location and reanme
	`location_range_end'.
	(create_breakpoint): Change `arg' parameter to struct event_location
	and rename `location'.
	* cli/cli-cmds.c: Include location.h.
	(edit_command): Use locations instead of address strings.
	(list_command): Likewise.
	* elfread.c: Include location.h.
	(elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string.
	* linespec.c: Include location.h.
	(canonicalize_linespec): Save a linespec location into `canonical'.
	Save a SAVE_SPEC into `canonical'.
	(linespec_parser_new): Initialize `parser'.
	(event_location_to_sals): New function.
	(decode_line_full): Change `argptr' to a struct event_location and
	rename it `location'.
	Use locations instead of address strings.
	Call event_location_to_sals instead of parse_linespec.
	(decode_line_1): Likewise.
	(decode_line_with_current_source): Use locations instead of
	address strings.
	(decode_line_with_last_displayed): Likewise.
	(decode_objc): Likewise.
	(destroy_linespec_result): Delete the linespec result's location
	instead of freeing the address string.
	* linespec.h (struct linespec_result) <addr_string>: Change to
	struct event_location and rename to ...
	<location>: ... this.
	(decode_line_1): Change `argptr' to struct event_location.
	All callers updated.
	(decode_line_full): Likewise.
	* mi/mi-cmd-break.c: Include langauge.h, location.h, and linespec.h.
	(mi_cmd_break_insert_1): Use locations instead of address strings.
	* probe.c: Include location.h.
	(parse_probes): Change `argptr' to struct event_location.
	Make local variable `arg_start' const.
	Use event locations instead of address strings.
	* probe.h (parse_probes): Change `argptr' to struct event_location.
	* python/py-breakpoint.c: Include location.h.
	(bppy_get_location): Constify local variable `str'.
	Use event_location_to_string.
	(bppy_init): Use locations instead of address strings.
	* python/py-finishbreakpoint.c: Include location.h.
	(bpfinishpy_init): Remove local variable `addr_str'.
	Use locations instead of address strings.
	* python/python.c: Include location.h.
	(gdbpy_decode_line): Use locations instead of address strings.
	* remote.c: Include location.h.
	(remote_download_tracepoint): Use locations instead of address
	strings.
	* spu-tdep.c: Include location.h.
	(spu_catch_start): Remove local variable `buf'.
	Use locations instead of address strings.
	* tracepoint.c: Include location.h.
	(scope_info): Use locations instead of address strings.
	(encode_source_string): Constify parameter `src'.
	* tracepoint.h (encode_source_string): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: explicit-location-refactor.patch
Type: text/x-patch
Size: 77871 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20140508/d495e1e6/attachment.bin>


More information about the Gdb-patches mailing list