This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFA: mi: correct loop printing args or locals
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 3 Feb 2002 20:56:11 -0500 (EST)
- Subject: RFA: mi: correct loop printing args or locals
Without this patch, on platforms using STABS, MI's
-stack-list-arguments command describes frames for `callee1' in
`gdb/testsuite/gdb.mi/basics.c' like this:
frame={level="3",args=[name="intarg",name="strarg",name="fltarg",name="fltarg"]}
Note that `fltarg' appears twice. This is because there is both a
PSYM (parameter symbol) stab and an LSYM (local symbol) stab for
`fltarg', which I'm pretty sure is the standard (and correct) STABS
way to describe such functions. Anyway, the loop is clearly incorrect
for blocks that contain a mix of arguments and non-arguments.
2002-02-03 Jim Blandy <jimb@redhat.com>
* mi-cmd-stack.c (list_args_or_locals): Move declaration of
print_me inside the loop body, so it gets re-initialized every
iteration. The cases for the different symbol kinds leave
print_me unchanged if they don't want the symbol printed.
Index: gdb/mi/mi-cmd-stack.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.11
diff -c -r1.11 mi-cmd-stack.c
*** gdb/mi/mi-cmd-stack.c 2001/10/15 22:15:56 1.11
--- gdb/mi/mi-cmd-stack.c 2002/02/04 01:43:35
***************
*** 216,222 ****
struct block *block;
struct symbol *sym;
int i, nsyms;
- int print_me = 0;
static struct ui_stream *stb = NULL;
stb = ui_out_stream_new (uiout);
--- 216,221 ----
***************
*** 229,234 ****
--- 228,235 ----
{
ALL_BLOCK_SYMBOLS (block, i, sym)
{
+ int print_me = 0;
+
switch (SYMBOL_CLASS (sym))
{
default: