33 #define INTERNAL_SIGNAL(x) ((x) == GDB_SIGNAL_TRAP || (x) == GDB_SIGNAL_INT)
55 VEC (gdb_signal_type) *signals_to_be_caught;
83 if (strcmp (result,
"?") == 0)
99 VEC_free (gdb_signal_type, c->signals_to_be_caught);
113 if (c->signals_to_be_caught != NULL)
115 gdb_signal_type iter;
118 VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
120 ++signal_catch_counts[iter];
124 for (i = 0; i < GDB_SIGNAL_LAST; ++i)
127 ++signal_catch_counts[i];
145 if (c->signals_to_be_caught != NULL)
147 gdb_signal_type iter;
150 VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
154 --signal_catch_counts[iter];
159 for (i = 0; i < GDB_SIGNAL_LAST; ++i)
164 --signal_catch_counts[i];
184 gdb_signal_type signal_number;
194 if (c->signals_to_be_caught)
197 gdb_signal_type iter;
200 VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
202 if (signal_number == iter)
221 const char *signal_name;
254 if (c->signals_to_be_caught
255 &&
VEC_length (gdb_signal_type, c->signals_to_be_caught) > 1)
260 if (c->signals_to_be_caught)
263 gdb_signal_type iter;
267 obstack_init (&text);
271 VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
277 obstack_grow (&text,
" ", 1);
278 obstack_grow (&text, name, strlen (name));
280 obstack_grow (&text,
"", 1);
286 c->catch_all ?
"<any signal>" :
"<standard signals>");
301 if (c->signals_to_be_caught)
304 gdb_signal_type iter;
306 if (
VEC_length (gdb_signal_type, c->signals_to_be_caught) > 1)
312 VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
321 else if (c->catch_all)
337 if (c->signals_to_be_caught)
340 gdb_signal_type iter;
343 VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter);
347 else if (c->catch_all)
377 c->signals_to_be_caught = filter;
378 c->catch_all = catch_all;
387 static VEC (gdb_signal_type) *
388 catch_signal_split_args (
char *arg,
int *catch_all)
390 VEC (gdb_signal_type) *result = NULL;
398 gdb_signal_type signal_number;
399 char *one_arg, *endptr;
400 struct cleanup *inner_cleanup;
408 if (strcmp (one_arg,
"all") == 0)
411 if (*arg !=
'\0' || !first)
412 error (
_(
"'all' cannot be caught with other signals"));
423 num = (
int) strtol (one_arg, &endptr, 0);
429 if (signal_number == GDB_SIGNAL_UNKNOWN)
430 error (
_(
"Unknown signal name '%s'."), one_arg);
447 int tempflag, catch_all = 0;
448 VEC (gdb_signal_type) *filter;
461 filter = catch_signal_split_args (arg, &catch_all);
495 signal_catch_counts = XCNEWVEC (
unsigned int, GDB_SIGNAL_LAST);
498 Catch signals by their names and/or numbers.\n\
499 Usage: catch signal [[NAME|NUMBER] [NAME|NUMBER]...|all]\n\
500 Arguments say which signals to catch. If no arguments\n\
501 are given, every \"normal\" signal will be caught.\n\
502 The argument \"all\" means to also catch signals used by GDB.\n\
503 Arguments, if given, should be one or more signal names\n\
504 (if your system supports that), or signal numbers."),
void get_last_target_status(ptid_t *ptidp, struct target_waitstatus *status)
void(* print_recreate)(struct breakpoint *, struct ui_file *fp)
void * get_cmd_context(struct cmd_list_element *cmd)
static unsigned int * signal_catch_counts
static void signal_catchpoint_dtor(struct breakpoint *b)
static int signal_catchpoint_remove_location(struct bp_location *bl)
void signal_catch_update(const unsigned int *info)
enum gdb_signal gdb_signal_from_command(int num)
enum print_stop_action(* print_it)(struct bpstats *bs)
DEF_VEC_I(gdb_signal_type)
char * plongest(LONGEST l)
void annotate_field(int num)
static void signal_catchpoint_print_one(struct breakpoint *b, struct bp_location **last_loc)
int ui_out_is_mi_like_p(struct ui_out *uiout)
void(* print_mention)(struct breakpoint *)
int(* breakpoint_hit)(const struct bp_location *bl, struct address_space *aspace, CORE_ADDR bp_addr, const struct target_waitstatus *ws)
static int signal_catchpoint_breakpoint_hit(const struct bp_location *bl, struct address_space *aspace, CORE_ADDR bp_addr, const struct target_waitstatus *ws)
enum gdb_signal gdb_signal_type
#define VEC_safe_push(T, V, O)
char * skip_spaces(char *chp)
#define INTERNAL_SIGNAL(x)
void add_catch_command(char *name, char *docstring, cmd_sfunc_ftype *sfunc, completer_ftype *completer, void *user_data_catch, void *user_data_tcatch)
void ui_out_text(struct ui_out *uiout, const char *string)
static int signal_catchpoint_explains_signal(struct breakpoint *b, enum gdb_signal sig)
void printf_filtered(const char *format,...)
int(* insert_location)(struct bp_location *)
#define VEC_iterate(T, V, I, P)
void ui_out_field_skip(struct ui_out *uiout, const char *fldname)
int fputc_unfiltered(int c, struct ui_file *stream)
void initialize_file_ftype(void)
void init_catchpoint(struct breakpoint *b, struct gdbarch *gdbarch, int tempflag, char *cond_string, const struct breakpoint_ops *ops)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
union target_waitstatus::@161 value
static const char * signal_to_name_or_int(enum gdb_signal sig)
char * extract_arg(char **arg)
struct gdbarch * get_current_arch(void)
static VEC(gdb_signal_type)
const char * gdb_signal_to_name(enum gdb_signal)
int(* explains_signal)(struct breakpoint *, enum gdb_signal)
struct breakpoint * breakpoint_at
enum gdb_signal gdb_signal_from_name(const char *)
const char const char int
static void signal_catchpoint_print_mention(struct breakpoint *b)
void discard_cleanups(struct cleanup *old_chain)
initialize_file_ftype _initialize_break_catch_sig
void install_breakpoint(int internal, struct breakpoint *b, int update_gll)
static void signal_catchpoint_print_recreate(struct breakpoint *b, struct ui_file *fp)
enum target_waitkind kind
static void catch_signal_command(char *arg, int from_tty, struct cmd_list_element *command)
static enum print_stop_action signal_catchpoint_print_it(bpstat bs)
void get_user_print_options(struct value_print_options *opts)
int(* remove_location)(struct bp_location *)
struct breakpoint_ops base_breakpoint_ops
void initialize_breakpoint_ops(void)
void(* dtor)(struct breakpoint *self)
static int signal_catchpoint_insert_location(struct bp_location *bl)
void ui_out_field_string(struct ui_out *uiout, const char *fldname, const char *string)
void annotate_catchpoint(int num)
struct ui_out * current_uiout
static void create_signal_catchpoint(int tempflag, VEC(gdb_signal_type)*filter, int catch_all)
struct cleanup * make_cleanup_obstack_free(struct obstack *obstack)
static void initialize_signal_catchpoint_ops(void)
struct breakpoint * owner
void(* print_one)(struct breakpoint *, struct bp_location **)
void error(const char *fmt,...)
static struct breakpoint_ops signal_catchpoint_ops
void do_cleanups(struct cleanup *old_chain)