* breakpoint.h (enum bp_loc_type, struct bp_location): New.

(struct breakpoint): Remove address, shadow_contents, inserted,
	and duplicate.  Add a struct bp_location.
	* breakpoint.c (condition_command, read_memory_nobpt)
	(insert_breakpoints, remove_breakpoints, remove_hw_watchpoints)
	(reattach_breakpoints, update_breakpoints_after_exec)
	(detach_breakpoints, remove_breakpoint, mark_breakpoints_out)
	(breakpoint_init_inferior, breakpoint_here_p)
	(breakpoint_inserted_here_p, deprecated_frame_in_dummy)
	(breakpoint_thread_match, bpstat_stop_status)
	(bpstat_have_active_hw_watchpoints, print_one_breakpoint)
	(describe_other_breakpoints, check_duplicates)
	(make_breakpoint_permanent, create_thread_event_breakpoint)
	(disable_breakpoints_in_shlibs, re_enable_berakpoints_in_shlibs)
	(set_longjmp_resume_breakpoint, mention, create_breakpoints)
	(watch_command_1, print_one_exception_catchpoint)
	(clear_command, breakpoint_re_set_one): Adjust member accesses to
	use the breakpoint's ->loc.
	(set_raw_breakpoint): Likewise.  Initialize ->loc.
	(delete_breakpoint): Likewise.  Free ->loc.
This commit is contained in:
Daniel Jacobowitz
2003-11-06 17:24:38 +00:00
parent 0bbf2aa424
commit 5cab636d14
3 changed files with 216 additions and 142 deletions

View File

@ -184,6 +184,72 @@ enum target_hw_bp_type
hw_execute = 3 /* Execute HW breakpoint */
};
/* GDB maintains two types of information about each breakpoint (or
watchpoint, or other related event). The first type corresponds
to struct breakpoint; this is a relatively high-level structure
which contains the source location(s), stopping conditions, user
commands to execute when the breakpoint is hit, and so forth.
The second type of information corresponds to struct bp_location.
Each breakpoint has one or (eventually) more locations associated
with it, which represent target-specific and machine-specific
mechanisms for stopping the program. For instance, a watchpoint
expression may require multiple hardware watchpoints in order to
catch all changes in the value of the expression being watched. */
enum bp_loc_type
{
bp_loc_software_breakpoint,
bp_loc_hardware_breakpoint,
bp_loc_hardware_watchpoint,
bp_loc_other /* Miscellaneous... */
};
struct bp_location
{
/* Type of this breakpoint location. */
enum bp_loc_type loc_type;
/* Each breakpoint location must belong to exactly one higher-level
breakpoint. This and the DUPLICATE flag are more straightforward
than reference counting. */
struct breakpoint *owner;
/* Nonzero if this breakpoint is now inserted. */
char inserted;
/* Nonzero if this is not the first breakpoint in the list
for the given address. */
char duplicate;
/* If we someday support real thread-specific breakpoints, then
the breakpoint location will need a thread identifier. */
/* Data for specific breakpoint types. These could be a union, but
simplicity is more important than memory usage for breakpoints. */
/* Note that zero is a perfectly valid code address on some platforms
(for example, the mn10200 (OBSOLETE) and mn10300 simulators). NULL
is not a special value for this field. Valid for all types except
bp_loc_other. */
CORE_ADDR address;
/* "Real" contents of byte where breakpoint has been inserted.
Valid only when breakpoints are in the program. Under the complete
control of the target insert_breakpoint and remove_breakpoint routines.
No other code should assume anything about the value(s) here.
Valid only for bp_loc_software_breakpoint. */
char shadow_contents[BREAKPOINT_MAX];
/* Address at which breakpoint was requested, either by the user or
by GDB for internal breakpoints. This will usually be the same
as ``address'' (above) except for cases in which
ADJUST_BREAKPOINT_ADDRESS has computed a different address at
which to place the breakpoint in order to comply with a
processor's architectual constraints. */
CORE_ADDR requested_address;
};
/* This structure is a collection of function pointers that, if available,
will be called instead of the performing the default action for this
bptype. */
@ -222,18 +288,8 @@ struct breakpoint
/* Number assigned to distinguish breakpoints. */
int number;
/* Address to break at. Note that zero is a perfectly valid code
address on some platforms (for example, the and mn10300
simulators). NULL is not a special value for this field. */
CORE_ADDR address;
/* Address at which breakpoint was requested, either by the user or
by GDB for internal breakpoints. This will usually be the same
as ``address'' (above) except for cases in which
ADJUST_BREAKPOINT_ADDRESS has computed a different address at
which to place the breakpoint in order to comply with a
processor's architectual constraints. */
CORE_ADDR requested_address;
/* Location(s) associated with this high-level breakpoint. */
struct bp_location *loc;
/* Line number of this address. */
@ -249,16 +305,6 @@ struct breakpoint
/* Number of stops at this breakpoint that should
be continued automatically before really stopping. */
int ignore_count;
/* "Real" contents of byte where breakpoint has been inserted.
Valid only when breakpoints are in the program. Under the complete
control of the target insert_breakpoint and remove_breakpoint routines.
No other code should assume anything about the value(s) here. */
char shadow_contents[BREAKPOINT_MAX];
/* Nonzero if this breakpoint is now inserted. */
char inserted;
/* Nonzero if this is not the first breakpoint in the list
for the given address. */
char duplicate;
/* Chain of command lines to execute when this breakpoint is hit. */
struct command_line *commands;
/* Stack depth (address of frame). If nonzero, break only if fp