--- a/NEWS +++ b/NEWS @@ -27,6 +27,9 @@ show remote trace-status-packet ** The -trace-save MI command can optionally save trace buffer in Common Trace Format now. + ** The new option -s of the MI command -break-insert sets a dynamic + printf breakpoint. + *** Changes in GDB 7.6 * Target record has been renamed to record-full. --- a/doc/gdb.texinfo +++ b/doc/gdb.texinfo @@ -28745,7 +28745,9 @@ N.A. @smallexample -break-insert [ -t ] [ -h ] [ -f ] [ -d ] [ -a ] [ -c @var{condition} ] [ -i @var{ignore-count} ] - [ -p @var{thread-id} ] [ @var{location} ] + [ -p @var{thread-id} ] + [ -s "@var{template},@var{expression}[,@var{expression}@dots{}]" ] + [ @var{location} ] @end smallexample @noindent @@ -28785,6 +28787,29 @@ Make the breakpoint conditional on @var{ Initialize the @var{ignore-count}. @item -p @var{thread-id} Restrict the breakpoint to the specified @var{thread-id}. +@item -s "@var{template},@var{expression}[,@var{expression}@dots{}]" +Set a dynamic printf breakpoint, described in @ref{Dynamic Printf}. +The @var{template} and @var{expression} should be within double +quotes and be escaped by being preceded with a backslash. + +@smallexample +(gdb) +4-break-insert -s "\"At foo entry\\n\"" foo +4^done,bkpt=@{number="1",type="dprintf",disp="keep",enabled="y", +addr="0x000000000040061b",func="foo",file="mi-dprintf.c", +fullname="mi-dprintf.c",line="25",thread-groups=["i1"], +times="0",script=@{"printf \"At foo entry\\n\"","continue"@}, +original-location="foo"@} +(gdb) +5-break-insert -s "\"arg=%d, g=%d\\n\", arg, g" 26 +5^done,bkpt=@{number="2",type="dprintf",disp="keep",enabled="y", +addr="0x000000000040062a",func="foo",file="mi-dprintf.c", +fullname="mi-dprintf.c",line="26",thread-groups=["i1"], +times="0",script=@{"printf \"arg=%d, g=%d\\n\", arg, g","continue"@}, +original-location="mi-dprintf.c:26"@} +(gdb) +@end smallexample + @end table @subsubheading Result