struct breakpoint *b = (struct breakpoint *) args;
int val = -1;
- switch (b->type)
- {
- case bp_catchpoint:
- gdb_assert (b->ops != NULL && b->ops->insert != NULL);
- b->ops->insert (b);
- break;
- case bp_catch_exec:
- target_insert_exec_catchpoint (PIDGET (inferior_ptid));
- break;
- default:
- internal_error (__FILE__, __LINE__, _("unknown breakpoint type"));
- break;
- }
+ gdb_assert (b->type == bp_catchpoint);
+ gdb_assert (b->ops != NULL && b->ops->insert != NULL);
+
+ b->ops->insert (b);
}
static int
bpt->inserted = (val != -1);
}
- else if (bpt->owner->type == bp_catchpoint
- || bpt->owner->type == bp_catch_exec)
+ else if (bpt->owner->type == bp_catchpoint)
{
struct gdb_exception e = catch_exception (uiout, insert_catchpoint,
bpt->owner, RETURN_MASK_ERROR);
continue;
}
- /* Don't delete an exec catchpoint, because else the inferior
- won't stop when it ought! */
- if (b->type == bp_catch_exec)
- {
- continue;
- }
-
/* bp_finish is a special case. The only way we ought to be able
to see one of these when an exec() has happened, is if the user
caught a vfork, and then said "finish". Ordinarily a finish just
return val;
b->inserted = (is == mark_inserted);
}
- else if (b->owner->type == bp_catch_exec
- && breakpoint_enabled (b->owner)
- && !b->duplicate)
- {
- val = -1;
- switch (b->owner->type)
- {
- case bp_catch_exec:
- val = target_remove_exec_catchpoint (PIDGET (inferior_ptid));
- break;
- default:
- warning (_("Internal error, %s line %d."), __FILE__, __LINE__);
- break;
- }
- if (val)
- return val;
- b->inserted = (is == mark_inserted);
- }
return 0;
}
{
return (ep->type == bp_catchpoint)
|| (ep->type == bp_catch_load)
- || (ep->type == bp_catch_unload)
- || (ep->type == bp_catch_exec);
+ || (ep->type == bp_catch_unload);
/* ??rehrauer: Add more kinds here, as are implemented... */
}
return PRINT_SRC_AND_LOC;
break;
- case bp_catch_exec:
- annotate_catchpoint (b->number);
- printf_filtered (_("\nCatchpoint %d (exec'd %s), "),
- b->number,
- b->exec_pathname);
- return PRINT_SRC_AND_LOC;
- break;
-
case bp_watchpoint:
case bp_hardware_watchpoint:
annotate_watchpoint (b->number);
&& b->type != bp_read_watchpoint
&& b->type != bp_access_watchpoint
&& b->type != bp_hardware_breakpoint
- && b->type != bp_catchpoint
- && b->type != bp_catch_exec) /* a non-watchpoint bp */
+ && b->type != bp_catchpoint) /* a non-watchpoint bp */
{
if (bl->address != bp_addr) /* address doesn't match */
return 0;
return 0;
}
- if ((b->type == bp_catch_exec)
- && !inferior_has_execd (inferior_ptid, &b->exec_pathname))
- return 0;
-
return 1;
}
bs_class = no_effect;
break;
case bp_catchpoint:
- case bp_catch_exec:
if (bs->stop)
{
if (bs->print)
{bp_overlay_event, "overlay events"},
{bp_catchpoint, "catchpoint"},
{bp_catch_load, "catch load"},
- {bp_catch_unload, "catch unload"},
- {bp_catch_exec, "catch exec"}
+ {bp_catch_unload, "catch unload"}
};
static char bpenables[] = "nynny";
}
break;
- case bp_catch_exec:
- /* Field 4, the address, is omitted (which makes the columns
- not line up too nicely with the headers, but the effect
- is relatively readable). */
- if (opts.addressprint)
- ui_out_field_skip (uiout, "addr");
- annotate_field (5);
- if (b->exec_pathname != NULL)
- {
- ui_out_text (uiout, "program \"");
- ui_out_field_string (uiout, "what", b->exec_pathname);
- ui_out_text (uiout, "\" ");
- }
- break;
-
case bp_breakpoint:
case bp_hardware_breakpoint:
case bp_until:
|| b->type == bp_catchpoint
|| b->type == bp_catch_load
|| b->type == bp_catch_unload
- || b->type == bp_catch_exec
|| b->type == bp_hardware_breakpoint
|| b->type == bp_watchpoint
|| b->type == bp_read_watchpoint
bp_hardware_watchpoint
bp_read_watchpoint
bp_access_watchpoint
- bp_catchpoint
- bp_catch_exec */
+ bp_catchpoint */
static int
breakpoint_address_is_meaningful (struct breakpoint *bpt)
&& type != bp_hardware_watchpoint
&& type != bp_read_watchpoint
&& type != bp_access_watchpoint
- && type != bp_catchpoint
- && type != bp_catch_exec);
+ && type != bp_catchpoint);
}
/* Rescan breakpoints at the same address and section as BPT,
|| bptype == bp_hardware_watchpoint
|| bptype == bp_read_watchpoint
|| bptype == bp_access_watchpoint
- || bptype == bp_catchpoint
- || bptype == bp_catch_exec)
+ || bptype == bp_catchpoint)
{
/* Watchpoints and the various bp_catch_* eventpoints should not
have their addresses modified. */
break;
case bp_watchpoint:
case bp_catchpoint:
- case bp_catch_exec:
loc->loc_type = bp_loc_other;
break;
default:
b->forked_inferior_pid = null_ptid;
}
+/* Exec catchpoints. */
+
static void
-create_exec_event_catchpoint (int tempflag, char *cond_string)
+insert_catch_exec (struct breakpoint *b)
{
- struct symtab_and_line sal;
- struct breakpoint *b;
- int thread = -1; /* All threads. */
+ target_insert_exec_catchpoint (PIDGET (inferior_ptid));
+}
- init_sal (&sal);
- sal.pc = 0;
- sal.symtab = NULL;
- sal.line = 0;
+static int
+remove_catch_exec (struct breakpoint *b)
+{
+ return target_remove_exec_catchpoint (PIDGET (inferior_ptid));
+}
- b = set_raw_breakpoint (sal, bp_catch_exec);
- set_breakpoint_count (breakpoint_count + 1);
- b->number = breakpoint_count;
- b->cond_string = (cond_string == NULL) ?
- NULL : savestring (cond_string, strlen (cond_string));
- b->thread = thread;
- b->addr_string = NULL;
- b->enable_state = bp_enabled;
- b->disposition = tempflag ? disp_del : disp_donttouch;
- update_global_location_list (1);
+static int
+breakpoint_hit_catch_exec (struct breakpoint *b)
+{
+ return inferior_has_execd (inferior_ptid, &b->exec_pathname);
+}
- mention (b);
+static enum print_stop_action
+print_it_catch_exec (struct breakpoint *b)
+{
+ annotate_catchpoint (b->number);
+ printf_filtered (_("\nCatchpoint %d (exec'd %s), "), b->number,
+ b->exec_pathname);
+ return PRINT_SRC_AND_LOC;
}
+static void
+print_one_catch_exec (struct breakpoint *b, CORE_ADDR *last_addr)
+{
+ struct value_print_options opts;
+
+ get_user_print_options (&opts);
+
+ /* Field 4, the address, is omitted (which makes the columns
+ not line up too nicely with the headers, but the effect
+ is relatively readable). */
+ if (opts.addressprint)
+ ui_out_field_skip (uiout, "addr");
+ annotate_field (5);
+ ui_out_text (uiout, "exec");
+ if (b->exec_pathname != NULL)
+ {
+ ui_out_text (uiout, ", program \"");
+ ui_out_field_string (uiout, "what", b->exec_pathname);
+ ui_out_text (uiout, "\" ");
+ }
+}
+
+static void
+print_mention_catch_exec (struct breakpoint *b)
+{
+ printf_filtered (_("Catchpoint %d (exec)"), b->number);
+}
+
+static struct breakpoint_ops catch_exec_breakpoint_ops =
+{
+ insert_catch_exec,
+ remove_catch_exec,
+ breakpoint_hit_catch_exec,
+ print_it_catch_exec,
+ print_one_catch_exec,
+ print_mention_catch_exec
+};
+
static int
hw_breakpoint_used_count (void)
{
(b->dll_pathname != NULL) ?
b->dll_pathname : "<any library>");
break;
- case bp_catch_exec:
- printf_filtered (_("Catchpoint %d (exec)"),
- b->number);
- break;
case bp_until:
case bp_finish:
/* If this target supports it, create an exec catchpoint
and enable reporting of such events. */
- create_exec_event_catchpoint (tempflag, cond_string);
+ create_catchpoint (tempflag, cond_string, &catch_exec_breakpoint_ops);
}
static void
that requests them is unaffected by e.g., new libraries being
loaded. */
case bp_catchpoint:
- case bp_catch_exec:
break;
default:
case bp_catchpoint:
case bp_catch_load:
case bp_catch_unload:
- case bp_catch_exec:
case bp_hardware_breakpoint:
case bp_watchpoint:
case bp_hardware_watchpoint:
case bp_catchpoint:
case bp_catch_load:
case bp_catch_unload:
- case bp_catch_exec:
case bp_hardware_breakpoint:
case bp_watchpoint:
case bp_hardware_watchpoint: