From 6149aea959633bda5ec763817d6d2bee4e7d43c3 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 19 Apr 2010 00:48:44 +0000 Subject: PR breakpoints/8554. Implement `save-breakpoints'. gdb/ * breakpoint.c (save_cmdlist): New. (breakpoint_set_cmdlist, breakpoint_show_cmdlist): Moved up close to save_cmdlist. (print_recreate_catch_fork): New. (catch_fork_breakpoint_ops): Install it. (print_recreate_catch_vfork): New. (catch_vfork_breakpoint_ops): Install it. (print_recreate_catch_syscall): New. (catch_syscall_breakpoint_ops): Install it. (print_recreate_catch_exec): New. (catch_exec_breakpoint_ops): Install it. (print_recreate_exception_catchpoint): New. (gnu_v3_exception_catchpoint_ops): Install it. (save_breakpoints): New, based on tracepoint_save_command, but handle all breakpoint types. (save_breakpoints_command): New. (tracepoint_save_command): Rename to... (save_tracepoints_command): ... this, and reimplement using save_breakpoints. (save_command): New. (_initialize_breakpoints): Install the "save" command prefix. Install the "save breakpoints" command. Make "save-tracepoints" a deprecated alias for "save tracepoints". * breakpoint.h (struct breakpoint_ops): New field `print_recreate'. * ada-lang.c (print_recreate_exception): New. (print_recreate_catch_exception): New. (catch_exception_breakpoint_ops): Install it. (print_recreate_catch_exception_unhandled): New. (catch_exception_unhandled_breakpoint_ops): Install it. (print_recreate_catch_assert): New. (catch_assert_breakpoint_ops): Install it. * NEWS: Mention the new `save breakpoints' command. Mention the new `save tracepoints' alias and that `save-tracepoints' is now deprecated. gdb/doc/ * gdb.texinfo (Save Breakpoints): New node. (save-tracepoints): Rename to ... (save tracepoints): ... this. Mention that `save-tracepoints' is a deprecated alias to `save tracepoints'. gdb/testsuite/ * gdb.trace/save-trace.exp: Adjust. --- gdb/ada-lang.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index df92993..bc9ca69 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10348,6 +10348,34 @@ print_mention_exception (enum exception_catchpoint_kind ex, } } +/* Implement the PRINT_RECREATE method in the breakpoint_ops structure + for all exception catchpoint kinds. */ + +static void +print_recreate_exception (enum exception_catchpoint_kind ex, + struct breakpoint *b, struct ui_file *fp) +{ + switch (ex) + { + case ex_catch_exception: + fprintf_filtered (fp, "catch exception"); + if (b->exp_string != NULL) + fprintf_filtered (fp, " %s", b->exp_string); + break; + + case ex_catch_exception_unhandled: + fprintf_filtered (fp, "catch unhandled"); + break; + + case ex_catch_assert: + fprintf_filtered (fp, "catch assert"); + break; + + default: + internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + } +} + /* Virtual table for "catch exception" breakpoints. */ static enum print_stop_action @@ -10368,6 +10396,12 @@ print_mention_catch_exception (struct breakpoint *b) print_mention_exception (ex_catch_exception, b); } +static void +print_recreate_catch_exception (struct breakpoint *b, struct ui_file *fp) +{ + print_recreate_exception (ex_catch_exception, b, fp); +} + static struct breakpoint_ops catch_exception_breakpoint_ops = { NULL, /* insert */ @@ -10375,7 +10409,8 @@ static struct breakpoint_ops catch_exception_breakpoint_ops = NULL, /* breakpoint_hit */ print_it_catch_exception, print_one_catch_exception, - print_mention_catch_exception + print_mention_catch_exception, + print_recreate_catch_exception }; /* Virtual table for "catch exception unhandled" breakpoints. */ @@ -10399,13 +10434,21 @@ print_mention_catch_exception_unhandled (struct breakpoint *b) print_mention_exception (ex_catch_exception_unhandled, b); } +static void +print_recreate_catch_exception_unhandled (struct breakpoint *b, + struct ui_file *fp) +{ + print_recreate_exception (ex_catch_exception_unhandled, b, fp); +} + static struct breakpoint_ops catch_exception_unhandled_breakpoint_ops = { NULL, /* insert */ NULL, /* remove */ NULL, /* breakpoint_hit */ print_it_catch_exception_unhandled, print_one_catch_exception_unhandled, - print_mention_catch_exception_unhandled + print_mention_catch_exception_unhandled, + print_recreate_catch_exception_unhandled }; /* Virtual table for "catch assert" breakpoints. */ @@ -10428,13 +10471,20 @@ print_mention_catch_assert (struct breakpoint *b) print_mention_exception (ex_catch_assert, b); } +static void +print_recreate_catch_assert (struct breakpoint *b, struct ui_file *fp) +{ + print_recreate_exception (ex_catch_assert, b, fp); +} + static struct breakpoint_ops catch_assert_breakpoint_ops = { NULL, /* insert */ NULL, /* remove */ NULL, /* breakpoint_hit */ print_it_catch_assert, print_one_catch_assert, - print_mention_catch_assert + print_mention_catch_assert, + print_recreate_catch_assert }; /* Return non-zero if B is an Ada exception catchpoint. */ -- cgit v1.1