This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: Breakpoint infrastructure cleanups [3/8] - set type for impl_breakpoints
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 8 Oct 2003 13:07:50 -0400
- Subject: RFA: Breakpoint infrastructure cleanups [3/8] - set type for impl_breakpoints
Sets the type field for impl_breakpoints. There are only four right now:
impl_bp_software_breakpoint
impl_bp_hardware_breakpoint
impl_bp_hardware_watchpoint
impl_bp_other
The others are a grab bag, mostly catchpoints. This will collapse some
lengthy duplicated tests for "is this really implemented by a breakpoint";
it also would let us use hardware breakpoints for things like a solib event
breakpoint if some system had enough hardware breakpoints to do it, by
moving the is-hardware information out of the user-level breakpoint type
field. Towards further object-orientation.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-10-08 Daniel Jacobowitz <drow@mvista.com>
* breakpoint.c (allocate_impl_breakpoint): Take bpt and bp_type
arguments. Initialize owner and type for the new implementation
breakpoint.
(set_raw_breakpoint): Update call to allocate_impl_breakpoint.
Index: gdb/breakpoint.c
===================================================================
--- gdb.orig/breakpoint.c 2003-10-08 12:42:10.000000000 -0400
+++ gdb/breakpoint.c 2003-10-08 12:42:10.000000000 -0400
@@ -3854,13 +3854,53 @@ check_duplicates (struct breakpoint *bpt
/* Allocate a struct impl_breakpoint. */
struct impl_breakpoint *
-allocate_impl_breakpoint (void)
+allocate_impl_breakpoint (struct breakpoint *bpt, enum bptype bp_type)
{
struct impl_breakpoint *impl, *impl_p;
impl = xmalloc (sizeof (struct impl_breakpoint));
memset (impl, 0, sizeof (*impl));
+ impl->owner = bpt;
+
+ switch (bp_type)
+ {
+ case bp_breakpoint:
+ case bp_until:
+ case bp_finish:
+ case bp_longjmp:
+ case bp_longjmp_resume:
+ case bp_step_resume:
+ case bp_through_sigtramp:
+ case bp_watchpoint_scope:
+ case bp_call_dummy:
+ case bp_shlib_event:
+ case bp_thread_event:
+ case bp_overlay_event:
+ case bp_catch_load:
+ case bp_catch_unload:
+ impl->type = impl_bp_software_breakpoint;
+ break;
+ case bp_hardware_breakpoint:
+ impl->type = impl_bp_hardware_breakpoint;
+ break;
+ case bp_hardware_watchpoint:
+ case bp_read_watchpoint:
+ case bp_access_watchpoint:
+ impl->type = impl_bp_hardware_watchpoint;
+ break;
+ case bp_watchpoint:
+ case bp_catch_fork:
+ case bp_catch_vfork:
+ case bp_catch_exec:
+ case bp_catch_catch:
+ case bp_catch_throw:
+ impl->type = impl_bp_other;
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, "unknown breakpoint type");
+ }
+
/* Add this breakpoint to the end of the chain. */
impl_p = impl_breakpoint_chain;
@@ -3898,7 +3938,7 @@ set_raw_breakpoint (struct symtab_and_li
b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
memset (b, 0, sizeof (*b));
- b->impl = allocate_impl_breakpoint ();
+ b->impl = allocate_impl_breakpoint (b, bptype);
b->impl->address = sal.pc;
if (sal.symtab == NULL)
b->source_file = NULL;