Re: [PATCH] Let dprintf can be saved

Hui Zhu
2013-04-20T07:04:59Z

[-- Attachment #1: Type: text/plain, Size: 719 bytes --]

On Sat, Apr 20, 2013 at 12:34 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:
>
> Hui> +static void
> Hui> +dprintf_print_recreate (struct breakpoint *tp, struct ui_file *fp)
>
> This needs a short introductory comment.
> See the other print_recreate methods for examples.

Fixed.

>
> I think this patch could use a test case.
> It could be added wherever the existing "save" tests live.

OK. I will post a patch for it later.

Thanks,
Hui

>
> Tom

2013-04-18 Hui Zhu <hui@codesourcery.com>

PR gdb/15165

* breakpoint.c (dprintf_print_recreate): New.
(save_breakpoints): Let it not save dprintf commands.
(initialize_breakpoint_ops): Set dprintf_print_recreate.

[-- Attachment #2: dprintf-save.txt --]
[-- Type: text/plain, Size: 1180 bytes --]

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13364,6 +13364,16 @@ dprintf_re_set (struct breakpoint *b)
update_dprintf_command_list (b);
}

+/* Implement the "print_recreate" breakpoint_ops method for dprintf. */
+
+static void
+dprintf_print_recreate (struct breakpoint *tp, struct ui_file *fp)
+{
+ fprintf_unfiltered (fp, "dprintf %s%s", tp->addr_string,
+ tp->extra_string);
+ print_recreate_thread (tp, fp);
+}
+
/* The breakpoint_ops structure to be used on static tracepoints with
markers (`-m'). */

@@ -15453,7 +15463,7 @@ save_breakpoints (char *filename, int fr
if (tp->ignore_count)
fprintf_unfiltered (fp, " ignore $bpnum %d\n", tp->ignore_count);

- if (tp->commands)
+ if (tp->type != bp_dprintf && tp->commands)
{
volatile struct gdb_exception ex;

@@ -15859,7 +15869,7 @@ initialize_breakpoint_ops (void)
ops->resources_needed = bkpt_resources_needed;
ops->print_it = bkpt_print_it;
ops->print_mention = bkpt_print_mention;
- ops->print_recreate = bkpt_print_recreate;
+ ops->print_recreate = dprintf_print_recreate;
}

/* Chain containing all defined "enable breakpoint" subcommands. */