X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fbreak-catch-sig.c;h=296f900b5c898f9c152b25050747266c09a7f96c;hb=5809899dad253e2fefcb6f7ae57a6f43cfa4e3c5;hp=02d8b4ab6f9959be0509ecc9f747bec4a6257163;hpb=427cd150eed8c0dd4f0d0a1105448b4ebe36da6d;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 02d8b4ab6f..296f900b5c 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -1,6 +1,6 @@ /* Everything about signal catchpoints, for GDB. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2016 Free Software Foundation, Inc. This file is part of GDB. @@ -23,11 +23,13 @@ #include "breakpoint.h" #include "gdbcmd.h" #include "inferior.h" +#include "infrun.h" #include "annotate.h" #include "valprint.h" #include "cli/cli-utils.h" #include "completer.h" -#include "gdb_obstack.h" + +#include #define INTERNAL_SIGNAL(x) ((x) == GDB_SIGNAL_TRAP || (x) == GDB_SIGNAL_INT) @@ -106,7 +108,7 @@ signal_catchpoint_dtor (struct breakpoint *b) static int signal_catchpoint_insert_location (struct bp_location *bl) { - struct signal_catchpoint *c = (void *) bl->owner; + struct signal_catchpoint *c = (struct signal_catchpoint *) bl->owner; int i; if (c->signals_to_be_caught != NULL) @@ -136,9 +138,10 @@ signal_catchpoint_insert_location (struct bp_location *bl) catchpoints. */ static int -signal_catchpoint_remove_location (struct bp_location *bl) +signal_catchpoint_remove_location (struct bp_location *bl, + enum remove_bp_reason reason) { - struct signal_catchpoint *c = (void *) bl->owner; + struct signal_catchpoint *c = (struct signal_catchpoint *) bl->owner; int i; if (c->signals_to_be_caught != NULL) @@ -179,7 +182,8 @@ signal_catchpoint_breakpoint_hit (const struct bp_location *bl, CORE_ADDR bp_addr, const struct target_waitstatus *ws) { - const struct signal_catchpoint *c = (void *) bl->owner; + const struct signal_catchpoint *c + = (const struct signal_catchpoint *) bl->owner; gdb_signal_type signal_number; if (ws->kind != TARGET_WAITKIND_STOPPED) @@ -218,14 +222,16 @@ signal_catchpoint_print_it (bpstat bs) ptid_t ptid; struct target_waitstatus last; const char *signal_name; + struct ui_out *uiout = current_uiout; get_last_target_status (&ptid, &last); signal_name = signal_to_name_or_int (last.value.sig); annotate_catchpoint (b->number); + maybe_print_thread_hit_breakpoint (uiout); - printf_filtered (_("\nCatchpoint %d (signal %s), "), b->number, signal_name); + printf_filtered (_("Catchpoint %d (signal %s), "), b->number, signal_name); return PRINT_SRC_AND_LOC; } @@ -237,7 +243,7 @@ static void signal_catchpoint_print_one (struct breakpoint *b, struct bp_location **last_loc) { - struct signal_catchpoint *c = (void *) b; + struct signal_catchpoint *c = (struct signal_catchpoint *) b; struct value_print_options opts; struct ui_out *uiout = current_uiout; @@ -260,11 +266,7 @@ signal_catchpoint_print_one (struct breakpoint *b, { int i; gdb_signal_type iter; - struct obstack text; - struct cleanup *cleanup; - - obstack_init (&text); - cleanup = make_cleanup_obstack_free (&text); + std::string text; for (i = 0; VEC_iterate (gdb_signal_type, c->signals_to_be_caught, i, iter); @@ -273,12 +275,10 @@ signal_catchpoint_print_one (struct breakpoint *b, const char *name = signal_to_name_or_int (iter); if (i > 0) - obstack_grow (&text, " ", 1); - obstack_grow (&text, name, strlen (name)); + text += " "; + text += name; } - obstack_grow (&text, "", 1); - ui_out_field_string (uiout, "what", obstack_base (&text)); - do_cleanups (cleanup); + ui_out_field_string (uiout, "what", text.c_str ()); } else ui_out_field_string (uiout, "what", @@ -295,7 +295,7 @@ signal_catchpoint_print_one (struct breakpoint *b, static void signal_catchpoint_print_mention (struct breakpoint *b) { - struct signal_catchpoint *c = (void *) b; + struct signal_catchpoint *c = (struct signal_catchpoint *) b; if (c->signals_to_be_caught) { @@ -329,7 +329,7 @@ signal_catchpoint_print_mention (struct breakpoint *b) static void signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp) { - struct signal_catchpoint *c = (void *) b; + struct signal_catchpoint *c = (struct signal_catchpoint *) b; fprintf_unfiltered (fp, "catch signal"); @@ -345,15 +345,16 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp) } else if (c->catch_all) fprintf_unfiltered (fp, " all"); + fputc_unfiltered ('\n', fp); } /* Implement the "explains_signal" breakpoint_ops method for signal catchpoints. */ -static enum bpstat_signal_value +static int signal_catchpoint_explains_signal (struct breakpoint *b, enum gdb_signal sig) { - return BPSTAT_SIGNAL_PASS; + return 1; } /* Create a new signal catchpoint. TEMPFLAG is true if this should be