Skip to content

Commit ee04de6

Browse files
committed
Change the arguments of a dynamic printf with dprintf-args
1 parent 7cc75a1 commit ee04de6

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

gdb/breakpoint.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9645,6 +9645,30 @@ dprintf_command (const char *arg, int from_tty)
96459645
0);
96469646
}
96479647

9648+
static void
9649+
dprintf_args_command (const char *arg, int from_tty)
9650+
{
9651+
const char *p = arg;
9652+
int bpnum = get_number (&p);
9653+
9654+
if (p[0] == '\0')
9655+
error (_("Format string required"));
9656+
9657+
for (breakpoint &b : all_breakpoints ())
9658+
if (b.number == bpnum)
9659+
{
9660+
if (b.type != bp_dprintf)
9661+
error (_("This is not a dprintf brakpoint."));
9662+
9663+
b.extra_string.reset (xstrdup (p));
9664+
update_dprintf_command_list (&b);
9665+
9666+
return;
9667+
}
9668+
9669+
error (_("No breakpoint number %d."), bpnum);
9670+
}
9671+
96489672
static void
96499673
agent_printf_command (const char *arg, int from_tty)
96509674
{
@@ -15322,6 +15346,10 @@ location may be a linespec, explicit, or address location.\n"
1532215346
"\n" LOCATION_SPEC_HELP_STRING));
1532315347
set_cmd_completer (c, location_completer);
1532415348

15349+
c = add_com ("dprintf-args", class_breakpoint, dprintf_args_command, _("\
15350+
Change the arguments of a dynamic printf.\n\
15351+
Usage is `dprintf-args N format-string,arg1,arg2,...`."));
15352+
1532515353
add_setshow_enum_cmd ("dprintf-style", class_support,
1532615354
dprintf_style_enums, &dprintf_style, _("\
1532715355
Set the style of usage for dynamic printf."), _("\

0 commit comments

Comments
 (0)