This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: if/while commands in user-defined command behave differently


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.


Attachment: pa.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]