RFA: if/while commands in user-defined command behave differently
Jason Molenda
jmolenda@apple.com
Wed Sep 8 19:30:00 GMT 2004
From the gdb prompt, this is accepted:
(gdb) if(3<4)
>print "hi\n"
>end
$1 = "hi\n"
(gdb)
But the same sequence of commands in a user-defined command will yield
an error:
(gdb) define f
Type commands for definition of "f".
End with a line saying just "end".
>if(3<4)
>print "hi\n"
>end
>end
(gdb) f
Junk after end of expression.
(gdb)
It is hard for a user to figure out what gdb's complaining about.
Luckily we have a really tenacious developer at Apple who tracked it
down and filed a bug report.
Below is a patch to fix this in cli/cli-script.c, and a testsuite
addition to gdb.base/define.exp to test that this isn't regressed. The
cli-script.c change alone does not change the testsuite results on x86
Linux w/ gcc 3.4.0 & dwarf2.
I'm not clear on who needs to approve the CLI patch; Michael should
approve the testsuite change, obviously. OK to commit?
Jason
[gdb/ChangeLog]
2004-09-08 Jason Molenda (jmolenda@apple.com)
* cli/cli-script.c (read_next_line): Accept zero or more
whitespace
chars after 'if' or 'while' commands in user-defined commands.
[gdb/testsuite/ChangeLog]
2004-09-08 Jason Molenda (jmolenda@apple.com)
* gdb.base/define.exp: Two new tests to verify zero space chars
after 'if' and 'while' commands in a user-defined command is
correctly
parsed.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pa.txt
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20040908/14065c30/attachment.txt>
More information about the Gdb-patches
mailing list