+2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * breakpoint.c (struct longjmp_breakpoint): New struct.
+ (is_tracepoint_type): Change return type to bool.
+ (is_longjmp_type): New function.
+ (new_breakpoint_from_type): Handle longjmp kinds of breakpoints.
+ (set_raw_breakpoint_without_location): Use
+ new_breakpoint_from_type.
+ (set_raw_breakpoint): Likewise.
+
2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
* breakpoint.c (new_breakpoint_from_type): New function.
}
}
+struct longjmp_breakpoint
+{
+ breakpoint base;
+};
+
/* Encapsulate tests for different types of tracepoints. */
-static int
-is_tracepoint_type (enum bptype type)
+static bool
+is_tracepoint_type (bptype type)
{
return (type == bp_tracepoint
|| type == bp_fast_tracepoint
|| type == bp_static_tracepoint);
}
+static bool
+is_longjmp_type (bptype type)
+{
+ return type == bp_longjmp || type == bp_exception;
+}
+
int
is_tracepoint (const struct breakpoint *b)
{
if (is_tracepoint_type (type))
b = (breakpoint *) new tracepoint ();
+ else if (is_longjmp_type (type))
+ b = (breakpoint *) new longjmp_breakpoint ();
else
b = new breakpoint ();
enum bptype bptype,
const struct breakpoint_ops *ops)
{
- struct breakpoint *b = new breakpoint ();
+ std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
- init_raw_breakpoint_without_location (b, gdbarch, bptype, ops);
- add_to_breakpoint_chain (b);
- return b;
+ init_raw_breakpoint_without_location (b.get (), gdbarch, bptype, ops);
+ add_to_breakpoint_chain (b.get ());
+
+ return b.release ();
}
/* Initialize loc->function_name. EXPLICIT_LOC says no indirect function
struct symtab_and_line sal, enum bptype bptype,
const struct breakpoint_ops *ops)
{
- struct breakpoint *b = new breakpoint ();
+ std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
- init_raw_breakpoint (b, gdbarch, sal, bptype, ops);
- add_to_breakpoint_chain (b);
- return b;
+ init_raw_breakpoint (b.get (), gdbarch, sal, bptype, ops);
+ add_to_breakpoint_chain (b.get ());
+
+ return b.release ();
}
/* Call this routine when stepping and nexting to enable a breakpoint