[RFA/RFC Prec] Add process record skip 1/6 (breakpoint)
Hui Zhu
teawater@gmail.com
Wed Aug 19 08:08:00 GMT 2009
This patch add two new breakpoint bp_record_skip_start and bp_record_skip_end.
When bp_record_skip_start, infrun.c will call
record_skip_breakpoint_handler to record and start record skip.
When bp_record_skip_end, infrun.c will call
record_skip_breakpoint_handler to stop record skip.
2008-08-19 Hui Zhu <teawater@gmail.com>
* breakpoint.c (bpstat_what): Add support for
bp_record_skip_start and bp_record_skip_start.
(allocate_bp_location): Ditto.
(create_record_skip_breakpoint): New function.
(remove_record_skip_breakpoint): New function.
* breakpoint.h (bptype): Add bp_record_skip_start and
bp_record_skip_stop.
(bpstat_what): Add record_skip.
(create_record_skip_breakpoint): Extern.
(remove_record_skip_breakpoint): Extern.
---
breakpoint.c | 27 +++++++++++++++++++++++++++
breakpoint.h | 15 +++++++++++++++
2 files changed, 42 insertions(+)
--- a/breakpoint.c
+++ b/breakpoint.c
@@ -3404,6 +3404,7 @@ bpstat_what (bpstat bs)
struct bpstat_what retval;
retval.call_dummy = 0;
+ retval.record_skip = bp_none;
for (; bs != NULL; bs = bs->next)
{
enum class bs_class = no_effect;
@@ -3501,6 +3502,11 @@ bpstat_what (bpstat bs)
internal_error (__FILE__, __LINE__,
_("bpstat_what: bp_tracepoint encountered"));
break;
+ case bp_record_skip_start:
+ case bp_record_skip_stop:
+ bs_class = bp_nostop;
+ retval.record_skip = bs->breakpoint_at->owner->type;
+ break;
}
current_action = table[(int) bs_class][(int) current_action];
}
@@ -4376,6 +4382,8 @@ allocate_bp_location (struct breakpoint
case bp_thread_event:
case bp_overlay_event:
case bp_longjmp_master:
+ case bp_record_skip_start:
+ case bp_record_skip_stop:
loc->loc_type = bp_loc_software_breakpoint;
break;
case bp_hardware_breakpoint:
@@ -4752,6 +4760,25 @@ disable_breakpoints_in_unloaded_shlib (s
}
}
+struct breakpoint *
+create_record_skip_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address,
+ enum bptype type)
+{
+ return create_internal_breakpoint (gdbarch, address, type);
+}
+
+void
+remove_record_skip_breakpoint (CORE_ADDR address, int all)
+{
+ struct breakpoint *b, *temp;
+
+ ALL_BREAKPOINTS_SAFE (b, temp)
+ if ((b->type == bp_record_skip_start
+ || b->type == bp_record_skip_stop)
+ && (all || b->loc->requested_address == address))
+ delete_breakpoint (b);
+}
+
/* FORK & VFORK catchpoints. */
/* Implement the "insert" breakpoint_ops method for fork catchpoints. */
--- a/breakpoint.h
+++ b/breakpoint.h
@@ -120,6 +120,13 @@ enum bptype
bp_catchpoint,
bp_tracepoint,
+
+ /* When inferior is broken by breakpoint bp_record_skip_start,
+ process record and replay function is enable and GDB is in
+ record mode, GDB will stop record the execute log until
+ inferior is broken by bp_record_skip_stop. */
+ bp_record_skip_start,
+ bp_record_skip_stop,
};
/* States of enablement of breakpoint. */
@@ -567,6 +574,8 @@ struct bpstat_what
continuing from a call dummy without popping the frame is not a
useful one). */
int call_dummy;
+
+ enum bptype record_skip;
};
/* The possible return values for print_bpstat, print_it_normal,
@@ -877,6 +886,12 @@ extern void remove_thread_event_breakpoi
extern void disable_breakpoints_in_shlibs (void);
+extern struct breakpoint *create_record_skip_breakpoint
+ (struct gdbarch *gdbarch, CORE_ADDR address,
+ enum bptype type);
+
+extern void remove_record_skip_breakpoint (CORE_ADDR address, int all);
+
/* This function returns TRUE if ep is a catchpoint. */
extern int ep_is_catchpoint (struct breakpoint *);
-------------- next part --------------
---
breakpoint.c | 27 +++++++++++++++++++++++++++
breakpoint.h | 15 +++++++++++++++
2 files changed, 42 insertions(+)
--- a/breakpoint.c
+++ b/breakpoint.c
@@ -3404,6 +3404,7 @@ bpstat_what (bpstat bs)
struct bpstat_what retval;
retval.call_dummy = 0;
+ retval.record_skip = bp_none;
for (; bs != NULL; bs = bs->next)
{
enum class bs_class = no_effect;
@@ -3501,6 +3502,11 @@ bpstat_what (bpstat bs)
internal_error (__FILE__, __LINE__,
_("bpstat_what: bp_tracepoint encountered"));
break;
+ case bp_record_skip_start:
+ case bp_record_skip_stop:
+ bs_class = bp_nostop;
+ retval.record_skip = bs->breakpoint_at->owner->type;
+ break;
}
current_action = table[(int) bs_class][(int) current_action];
}
@@ -4376,6 +4382,8 @@ allocate_bp_location (struct breakpoint
case bp_thread_event:
case bp_overlay_event:
case bp_longjmp_master:
+ case bp_record_skip_start:
+ case bp_record_skip_stop:
loc->loc_type = bp_loc_software_breakpoint;
break;
case bp_hardware_breakpoint:
@@ -4752,6 +4760,25 @@ disable_breakpoints_in_unloaded_shlib (s
}
}
+struct breakpoint *
+create_record_skip_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address,
+ enum bptype type)
+{
+ return create_internal_breakpoint (gdbarch, address, type);
+}
+
+void
+remove_record_skip_breakpoint (CORE_ADDR address, int all)
+{
+ struct breakpoint *b, *temp;
+
+ ALL_BREAKPOINTS_SAFE (b, temp)
+ if ((b->type == bp_record_skip_start
+ || b->type == bp_record_skip_stop)
+ && (all || b->loc->requested_address == address))
+ delete_breakpoint (b);
+}
+
/* FORK & VFORK catchpoints. */
/* Implement the "insert" breakpoint_ops method for fork catchpoints. */
--- a/breakpoint.h
+++ b/breakpoint.h
@@ -120,6 +120,13 @@ enum bptype
bp_catchpoint,
bp_tracepoint,
+
+ /* When inferior is broken by breakpoint bp_record_skip_start,
+ process record and replay function is enable and GDB is in
+ record mode, GDB will stop record the execute log until
+ inferior is broken by bp_record_skip_stop. */
+ bp_record_skip_start,
+ bp_record_skip_stop,
};
/* States of enablement of breakpoint. */
@@ -567,6 +574,8 @@ struct bpstat_what
continuing from a call dummy without popping the frame is not a
useful one). */
int call_dummy;
+
+ enum bptype record_skip;
};
/* The possible return values for print_bpstat, print_it_normal,
@@ -877,6 +886,12 @@ extern void remove_thread_event_breakpoi
extern void disable_breakpoints_in_shlibs (void);
+extern struct breakpoint *create_record_skip_breakpoint
+ (struct gdbarch *gdbarch, CORE_ADDR address,
+ enum bptype type);
+
+extern void remove_record_skip_breakpoint (CORE_ADDR address, int all);
+
/* This function returns TRUE if ep is a catchpoint. */
extern int ep_is_catchpoint (struct breakpoint *);
More information about the Gdb-patches
mailing list