* RFC (gdb/mi): -stack-list-locals
@ 2003-11-23 0:16 Nick Roberts
2003-11-26 0:48 ` Andrew Cagney
0 siblings, 1 reply; 23+ messages in thread
From: Nick Roberts @ 2003-11-23 0:16 UTC (permalink / raw)
To: gdb-patches
Attached is a patch for -stack-list-locals which roughly modifies this command
as I described previously on gdb@sources.redhat.com (Thu, 6 Nov 2003 22:04:22
+0000). It actually does the following:
1) Display the name, type and value for simple data types.
2) Display the name and type for complex data types.
I don't really know what make_cleanup_ui_out_tuple_begin_end and do_cleanups
do and I've approximated a simple data type to something that isn't
TYPE_CODE_ARRAY or TYPE_CODE_STRUCT so it's probably a pretty gross hack.
The idea is that the user can see the value of simple data types immediately
and can create variable objects for complex data types if he wishes to explore
their values in more detail.
Any comments?
Nick http://www.nick.uklinux.net
*** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
--- mi-cmd-stack.c 2003-11-22 23:49:24.000000000 +0000
***************
*** 273,292 ****
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
! if (values)
! {
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! 2 (struct symtab **) NULL);
! else
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
- do_cleanups (cleanup_tuple);
}
}
}
if (BLOCK_FUNCTION (block))
--- 273,303 ----
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
+ if (values == 2)
+ {
+ type_print (sym2->type, "", stb->stream, -1);
+ ui_out_field_stream (uiout, "type", stb);
+ if (TYPE_CODE (sym2->type) != TYPE_CODE_ARRAY &&
+ TYPE_CODE (sym2->type) != TYPE_CODE_STRUCT)
+ {
+ print_variable_value (sym2, fi, stb->stream);
+ ui_out_field_stream (uiout, "value", stb);
+ }
+ }
+ else if (values)
+ {
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
}
+ if (values) do_cleanups (cleanup_tuple);
}
}
if (BLOCK_FUNCTION (block))
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals
2003-11-23 0:16 RFC (gdb/mi): -stack-list-locals Nick Roberts
@ 2003-11-26 0:48 ` Andrew Cagney
2003-12-02 3:14 ` RFC (gdb/mi): -stack-list-locals + PATCH Nick Roberts
0 siblings, 1 reply; 23+ messages in thread
From: Andrew Cagney @ 2003-11-26 0:48 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
> Attached is a patch for -stack-list-locals which roughly modifies this command
> as I described previously on gdb@sources.redhat.com (Thu, 6 Nov 2003 22:04:22
> +0000). It actually does the following:
>
> 1) Display the name, type and value for simple data types.
> 2) Display the name and type for complex data types.
>
> I don't really know what make_cleanup_ui_out_tuple_begin_end and do_cleanups
> do and I've approximated a simple data type to something that isn't
> TYPE_CODE_ARRAY or TYPE_CODE_STRUCT so it's probably a pretty gross hack.
>
> The idea is that the user can see the value of simple data types immediately
> and can create variable objects for complex data types if he wishes to explore
> their values in more detail.
>
> Any comments?
Looks like its time to cleanup "values" changing it to an enum or
bitmask - too many magic numbers.
Would is_integral_type() give you what you want?
For the cleanups try the restructured form:
{
struct cleanup = cleanups = make_cleanup (NULL, null_cleanup);
..
do_cleanups (cleanups);
}
http://sources.redhat.com/gdb/current/onlinedocs/gdbint_13.html#SEC112
make_cleanup_ui_out_tuple_begin_end opens the tuple and then closes it
via a cleanup (if an error is thrown the tuple under construction is
still finished).
Andrew
> Nick http://www.nick.uklinux.net
>
>
>
> *** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
> --- mi-cmd-stack.c 2003-11-22 23:49:24.000000000 +0000
> ***************
> *** 273,292 ****
> make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
> ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
>
> ! if (values)
> ! {
> ! struct symbol *sym2;
> ! if (!locals)
> ! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
> ! block, VAR_DOMAIN,
> ! (int *) NULL,
> ! 2 (struct symtab **) NULL);
> ! else
> sym2 = sym;
> print_variable_value (sym2, fi, stb->stream);
> ui_out_field_stream (uiout, "value", stb);
> - do_cleanups (cleanup_tuple);
> }
> }
> }
> if (BLOCK_FUNCTION (block))
> --- 273,303 ----
> make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
> ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
>
> ! struct symbol *sym2;
> ! if (!locals)
> ! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
> ! block, VAR_DOMAIN,
> ! (int *) NULL,
> ! (struct symtab **) NULL);
> ! else
> sym2 = sym;
> + if (values == 2)
> + {
> + type_print (sym2->type, "", stb->stream, -1);
> + ui_out_field_stream (uiout, "type", stb);
> + if (TYPE_CODE (sym2->type) != TYPE_CODE_ARRAY &&
> + TYPE_CODE (sym2->type) != TYPE_CODE_STRUCT)
> + {
> + print_variable_value (sym2, fi, stb->stream);
> + ui_out_field_stream (uiout, "value", stb);
> + }
> + }
> + else if (values)
> + {
> print_variable_value (sym2, fi, stb->stream);
> ui_out_field_stream (uiout, "value", stb);
> }
> + if (values) do_cleanups (cleanup_tuple);
> }
> }
> if (BLOCK_FUNCTION (block))
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals + PATCH
2003-11-26 0:48 ` Andrew Cagney
@ 2003-12-02 3:14 ` Nick Roberts
2003-12-09 2:42 ` RFC (gdb/mi): -stack-list-locals + REVISED PATCH Nick Roberts
0 siblings, 1 reply; 23+ messages in thread
From: Nick Roberts @ 2003-12-02 3:14 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
...
> > I don't really know what make_cleanup_ui_out_tuple_begin_end and do_cleanups
> > do and I've approximated a simple data type to something that isn't
> > TYPE_CODE_ARRAY or TYPE_CODE_STRUCT so it's probably a pretty gross hack.
> >
> > The idea is that the user can see the value of simple data types immediately
> > and can create variable objects for complex data types if he wishes to explore
> > their values in more detail.
> >
> > Any comments?
>
> Looks like its time to cleanup "values" changing it to an enum or
> bitmask - too many magic numbers.
I see now that I've also inadvertantly defined "-stack-list-arguments 2". I don't
know what magic numbers are but clearly better structure is desirable.
> Would is_integral_type() give you what you want?
For a simple data type? I don't think so. What about float? Perhaps I'm missing
your point.
>
> For the cleanups try the restructured form:
> {
> struct cleanup = cleanups = make_cleanup (NULL, null_cleanup);
> ..
> do_cleanups (cleanups);
> }
> http://sources.redhat.com/gdb/current/onlinedocs/gdbint_13.html#SEC112
>
> make_cleanup_ui_out_tuple_begin_end opens the tuple and then closes it
> via a cleanup (if an error is thrown the tuple under construction is
> still finished).
I understand make_cleanup_ui_out_tuple_begin_end but not the above
restructured form. Do I have to call make_cleanup (or relatives) each time I
allocated memory i.e for each call to ui_out_field_stream?
While I'm thinking about the above, here is a basic patch for
mi-cmd-stack.c. Currently if -stack-list-locals is invoked then it gives a
segmentation fault (Segmentation fault (core dumped)). This is inconvenient
and the patch changes this to give an output similar to that of cli:
&"No frame selected.\n"
^error,msg="No frame selected."
(gdb)
Nick http://www.nick.uklinux.net
*** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
--- mi-cmd-stack.c 2003-12-02 02:43:04.000000000 +0000
***************
*** 138,147 ****
--- 138,150 ----
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
{
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
+ if (!deprecated_selected_frame)
+ error ("No frame selected.");
+
list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
return MI_CMD_DONE;
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals + REVISED PATCH
2003-12-02 3:14 ` RFC (gdb/mi): -stack-list-locals + PATCH Nick Roberts
@ 2003-12-09 2:42 ` Nick Roberts
2003-12-10 17:56 ` Andrew Cagney
0 siblings, 1 reply; 23+ messages in thread
From: Nick Roberts @ 2003-12-09 2:42 UTC (permalink / raw)
To: gdb-patches
This patch:
1) Follows Jim Ingham's advice of using check_typedef to guard against the
case of TYPE_CODE_TYPEDEF.
2) Avoids a segmentation fault if -stack-list-locals is invoked before the
inferior has started execution.
3) Still introduces "-stack-list-locals 2". I'm not sure how to simplify this
as any change must presumably be beackward compatible. I don't think using
different numbers to mean different things is a problem here as mi commands
are not intended for the user and so don't need to be remembered by
him/her.
Nick http://www.nick.uklinux.net
*** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
--- mi-cmd-stack.c 2003-12-09 02:12:45.000000000 +0000
***************
*** 140,145 ****
--- 140,148 ----
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
+ if (!deprecated_selected_frame)
+ error ("No frame selected.");
+
list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
return MI_CMD_DONE;
}
***************
*** 273,288 ****
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
! if (values)
! {
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
--- 276,304 ----
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
+ if (values == 2)
+ {
+ type_print (sym2->type, "", stb->stream, -1);
+ ui_out_field_stream (uiout, "type", stb);
+ if (TYPE_CODE (check_typedef (sym2->type)) != TYPE_CODE_ARRAY
+ &&
+ TYPE_CODE (check_typedef (sym2->type)) != TYPE_CODE_STRUCT)
+ {
+ print_variable_value (sym2, fi, stb->stream);
+ ui_out_field_stream (uiout, "value", stb);
+ }
+ do_cleanups (cleanup_tuple);
+ }
+ else if (values)
+ {
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals + REVISED PATCH
2003-12-09 2:42 ` RFC (gdb/mi): -stack-list-locals + REVISED PATCH Nick Roberts
@ 2003-12-10 17:56 ` Andrew Cagney
2003-12-10 22:26 ` Jason Molenda
2003-12-12 20:51 ` RFC (gdb/mi): -stack-list-locals Nick Roberts
0 siblings, 2 replies; 23+ messages in thread
From: Andrew Cagney @ 2003-12-10 17:56 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
> This patch:
>
> 1) Follows Jim Ingham's advice of using check_typedef to guard against the
> case of TYPE_CODE_TYPEDEF.
>
> 2) Avoids a segmentation fault if -stack-list-locals is invoked before the
> inferior has started execution.
>
> 3) Still introduces "-stack-list-locals 2". I'm not sure how to simplify this
> as any change must presumably be beackward compatible. I don't think using
> different numbers to mean different things is a problem here as mi commands
> are not intended for the user and so don't need to be remembered by
> him/her.
True, but they also need to be fairly self documenting. Anyway, see below:
> Nick http://www.nick.uklinux.net
>
>
>
> *** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
> --- mi-cmd-stack.c 2003-12-09 02:12:45.000000000 +0000
> ***************
> *** 140,145 ****
> --- 140,148 ----
> if (argc != 1)
> error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
>
> + if (!deprecated_selected_frame)
> + error ("No frame selected.");
struct frame_info *frame;
...
frame = get_selected_frame ();
is better. It throws an error if there is no frame, and follow on code
can use "frame" instead of "deprecated_selected_frame" (and would be a
really appreciated cleanup!).
> list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
I was thinking of something as simple as:
enum print_values {
PRINT_NO_VALUES,
PRINT_ALL_VALUES,
PRINT_SIMPLE_VALUES
};
and then the very mechanical:
enum print_values print_values;
if (strcmp (argv[0], "0") == 0
|| strcmp (argv[0], "no-values") == 0)
print_values = PRINT_NO_VALUES;
else if (strcmp (argv[0], "1") == 0
|| strcmp (argv[0], "all-values") == 0)
print_values = PRINT_ALL_VALUES;
else if (strcmp (argv[0], "simple-values") == 0)
print_values = PRINT_SIMPLE_VALUES;
else
error ("...");
list_args_or_locals (1, print_values, ...);
(the names aren't the best so feel free to improve).
> return MI_CMD_DONE;
> }
> ***************
> *** 273,288 ****
> make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
> ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
>
> ! if (values)
if (values != PRINT_NO_VALUES)
> ! {
> ! struct symbol *sym2;
> ! if (!locals)
> ! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
> ! block, VAR_DOMAIN,
> ! (int *) NULL,
> ! (struct symtab **) NULL);
> ! else
> sym2 = sym;
> print_variable_value (sym2, fi, stb->stream);
> ui_out_field_stream (uiout, "value", stb);
> do_cleanups (cleanup_tuple);
> --- 276,304 ----
> make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
> ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
>
> ! struct symbol *sym2;
> ! if (!locals)
> ! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
Since you're here, I'd change this to SYMBOL_PRINT_NAME. The comment
below, from symtab.h, hopefully explains the difference (I also hope I
picked the correct winner):
/* Now come lots of name accessor macros. Short version as to when to
use which: Use SYMBOL_NATURAL_NAME to refer to the name of the
symbol in the original source code. Use SYMBOL_LINKAGE_NAME if you
want to know what the linker thinks the symbol's name is. Use
SYMBOL_PRINT_NAME for output. Use SYMBOL_DEMANGLED_NAME if you
specifically need to know whether SYMBOL_NATURAL_NAME and
SYMBOL_LINKAGE_NAME are different. Don't use
DEPRECATED_SYMBOL_NAME at all: instances of that macro should be
replaced by SYMBOL_NATURAL_NAME, SYMBOL_LINKAGE_NAME, or perhaps
SYMBOL_PRINT_NAME. */
> ! block, VAR_DOMAIN,
> ! (int *) NULL,
> ! (struct symtab **) NULL);
> ! else
> sym2 = sym;
> + if (values == 2)
if (values == PRINT_SIMPLE_VALUES)
> + {
> + type_print (sym2->type, "", stb->stream, -1);
> + ui_out_field_stream (uiout, "type", stb);
> + if (TYPE_CODE (check_typedef (sym2->type)) != TYPE_CODE_ARRAY
> + &&
> + TYPE_CODE (check_typedef (sym2->type)) != TYPE_CODE_STRUCT)
You may also want to consider TYPE_CODE_UNION? Your choice.
> + {
> + print_variable_value (sym2, fi, stb->stream);
> + ui_out_field_stream (uiout, "value", stb);
> + }
> + do_cleanups (cleanup_tuple);
> + }
> + else if (values)
if (values == PRINT_ALL_VALUES)
> + {
> print_variable_value (sym2, fi, stb->stream);
> ui_out_field_stream (uiout, "value", stb);
> do_cleanups (cleanup_tuple);
>
Anyway, it's basicly there. Just the doco update (which is eli's call)
(and for the assignment to pop up), and testcase. For the testcase,
just edit mi-stack.exp. You don't need to edit mi[12]-stack.exp as
there's no expectation that this new feature will work with old MI versions.
(since I'm traveling, I may be slow in responding, hopefully though,
between my self and elena someone will be able to give a thumbs up and
organize your account).
Andrew
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals + REVISED PATCH
2003-12-10 17:56 ` Andrew Cagney
@ 2003-12-10 22:26 ` Jason Molenda
2003-12-12 20:51 ` RFC (gdb/mi): -stack-list-locals Nick Roberts
1 sibling, 0 replies; 23+ messages in thread
From: Jason Molenda @ 2003-12-10 22:26 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Nick Roberts, gdb-patches
On Dec 10, 2003, at 9:56 AM, Andrew Cagney wrote:
> and then the very mechanical:
>
> enum print_values print_values;
>
> if (strcmp (argv[0], "0") == 0
> || strcmp (argv[0], "no-values") == 0)
> print_values = PRINT_NO_VALUES;
> else if (strcmp (argv[0], "1") == 0
> || strcmp (argv[0], "all-values") == 0)
> print_values = PRINT_ALL_VALUES;
> else if (strcmp (argv[0], "simple-values") == 0)
> print_values = PRINT_SIMPLE_VALUES;
> else
> error ("...");
This would be a help for us at Apple, as well. Right now we have a
non-standard meaning for -stack-list-locals 2, and the FSF gdb will
have a different meaning for 2 with this patch going in. No complaints
or anything, but it's unpleasant. If 1 == all-values and there is a
new 'simple-values' (or whatever) added, we can easily add a
'apple-values' which are the particular things our GUI wants without
fear of conflicting.
Jason
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals
2003-12-10 17:56 ` Andrew Cagney
2003-12-10 22:26 ` Jason Molenda
@ 2003-12-12 20:51 ` Nick Roberts
2003-12-12 21:09 ` David Carlton
2003-12-12 23:01 ` RFC (gdb/mi): -stack-list-locals Jason Molenda
1 sibling, 2 replies; 23+ messages in thread
From: Nick Roberts @ 2003-12-12 20:51 UTC (permalink / raw)
To: Andrew Cagney, jmolenda; +Cc: gdb-patches
These (two) patches uses
1) get_selected_frame instead of deprecated_selected_frame.
2) SYMBOL_PRINT_NAME instead of DEPRECATED_SYMBOL_NAME.
3) enum for print_values.
Jason Molenda writes:
> ...Right now we have a
> non-standard meaning for -stack-list-locals 2, and the FSF gdb will
> have a different meaning for 2 with this patch going in. No complaints
> or anything, but it's unpleasant.
I don't see why both our changes can't be accommodated. This patch uses a
switch statement for each value of print_values. If for some reason Apple need
-stack-list-locals 2, I dont mind using another value. Everybody seems to
want Apple's changes, including their management. Rather than being
unpleasant, perhaps this is an opportunity to make the case to that management
for resources to contribute back to the FSF.
Nick http://www.nick.uklinux.net
*** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
--- mi-cmd-stack.c 2003-12-11 00:53:34.000000000 +0000
***************
*** 29,34 ****
--- 29,35 ----
#include "block.h"
#include "stack.h"
#include "dictionary.h"
+ #include "gdb_string.h"
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
***************
*** 137,146 ****
enum mi_cmd_result
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
{
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
! list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
return MI_CMD_DONE;
}
--- 138,159 ----
enum mi_cmd_result
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
{
+ struct frame_info *frame;
+ enum print_values print_values;
+
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
! frame = get_selected_frame ();
!
! if (strcmp (argv[0], "1") == 0 || strcmp (argv[0], "all-values") == 0)
! print_values = PRINT_ALL_VALUES;
! else if (strcmp (argv[0], "2") == 0 || strcmp (argv[0], "simple-values") == 0)
! print_values = PRINT_SIMPLE_VALUES;
! else
! print_values = PRINT_NO_VALUES;
!
! list_args_or_locals (1, print_values, frame);
return MI_CMD_DONE;
}
***************
*** 218,223 ****
--- 231,237 ----
int nsyms;
struct cleanup *cleanup_list;
static struct ui_stream *stb = NULL;
+ struct type *type;
stb = ui_out_stream_new (uiout);
***************
*** 268,291 ****
if (print_me)
{
struct cleanup *cleanup_tuple = NULL;
! if (values)
cleanup_tuple =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
! ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
! if (values)
! {
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
}
}
}
--- 282,320 ----
if (print_me)
{
struct cleanup *cleanup_tuple = NULL;
! if (values != PRINT_NO_VALUES)
cleanup_tuple =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
! ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (sym));
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (SYMBOL_PRINT_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
+ switch (values)
+ {
+ case PRINT_SIMPLE_VALUES:
+ type = check_typedef (sym2->type);
+ type_print (sym2->type, "", stb->stream, -1);
+ ui_out_field_stream (uiout, "type", stb);
+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY &&
+ TYPE_CODE (type) != TYPE_CODE_STRUCT &&
+ TYPE_CODE (type) != TYPE_CODE_UNION)
+ {
+ print_variable_value (sym2, fi, stb->stream);
+ ui_out_field_stream (uiout, "value", stb);
+ }
+ do_cleanups (cleanup_tuple);
+ break;
+ case PRINT_ALL_VALUES:
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
+ break;
}
}
}
*** mi-cmds.h.~1.10.~ 2003-10-24 22:30:52.000000000 +0100
--- mi-cmds.h 2003-12-10 20:09:22.000000000 +0000
***************
*** 48,53 ****
--- 48,59 ----
MI_CMD_QUIET
};
+ enum print_values {
+ PRINT_NO_VALUES,
+ PRINT_ALL_VALUES,
+ PRINT_SIMPLE_VALUES
+ };
+
typedef enum mi_cmd_result (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
/* Older MI commands have this interface. Retained until all old
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals
2003-12-12 20:51 ` RFC (gdb/mi): -stack-list-locals Nick Roberts
@ 2003-12-12 21:09 ` David Carlton
2003-12-17 2:29 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Nick Roberts
2003-12-12 23:01 ` RFC (gdb/mi): -stack-list-locals Jason Molenda
1 sibling, 1 reply; 23+ messages in thread
From: David Carlton @ 2003-12-12 21:09 UTC (permalink / raw)
To: Nick Roberts; +Cc: Andrew Cagney, jmolenda, gdb-patches
On Fri, 12 Dec 2003 20:43:16 +0000, Nick Roberts <nick@nick.uklinux.net> said:
> 2) SYMBOL_PRINT_NAME instead of DEPRECATED_SYMBOL_NAME.
It should be SYMBOL_NATURAL_NAME. At least for the call to
lookup_symbol; maybe SYMBOL_PRINT_NAME is correct for the
ui_out_field_string call.
David Carlton
carlton@kealia.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: RFC (gdb/mi): -stack-list-locals
2003-12-12 20:51 ` RFC (gdb/mi): -stack-list-locals Nick Roberts
2003-12-12 21:09 ` David Carlton
@ 2003-12-12 23:01 ` Jason Molenda
1 sibling, 0 replies; 23+ messages in thread
From: Jason Molenda @ 2003-12-12 23:01 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
On Dec 12, 2003, at 12:43 PM, Nick Roberts wrote:
> Jason Molenda writes:
>
>> ...Right now we have a
>> non-standard meaning for -stack-list-locals 2, and the FSF gdb will
>> have a different meaning for 2 with this patch going in. No
>> complaints
>> or anything, but it's unpleasant.
>
> I don't see why both our changes can't be accommodated.
Well, if we're both implementing a different meaning for "2" that's a
pretty tough thing to accommodate. :-)
I didn't mean my statement as a criticism of this change or the work
you're doing -- this is the sort of thing we inevitably have come up
when we have lots of changes vs. the mainline. We made our bed, etc.
> This patch uses a
> switch statement for each value of print_values. If for some reason
> Apple need
> -stack-list-locals 2, I dont mind using another value.
"3" would be very nice. :) But really, I think Andrew's suggestion is
a better approach. Instead of numeric values which represent an
arbitrary collection of return values ("2" is "the things Apple's UI
would like to get", "3" is "a smaller set of things that don't involve
so much communication with the inferior"), text strings are a little
less likely to conflict.
> Everybody seems to
> want Apple's changes, including their management. Rather than being
> unpleasant, perhaps this is an opportunity to make the case to that
> management
> for resources to contribute back to the FSF.
Yeah, it's the usual problem. Lots to do, not so much time in which to
do it, sigh.
J
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children
2003-12-12 21:09 ` David Carlton
@ 2003-12-17 2:29 ` Nick Roberts
2003-12-17 2:32 ` David Carlton
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Nick Roberts @ 2003-12-17 2:29 UTC (permalink / raw)
To: gdb-patches
This patch covers four files mi-cmds.h, mi-cmd-stack.c, mi-cmd-var.c
and gdb.texinfo and:
1) Uses SYMBOL_PRINT_NAME instead of DEPRECATED_SYMBOL_NAME for lookup_symbol
(in mi-cmd-stack.c) as advised by David Carlton.
2) Uses a similar syntax to that suggested by Andrew Cagney for
-var-list-children.
AC> I think the syntax should be: -var-list-children --print-values @var{name}
I actually use --novalues and --all-values. This is to give some
consistency with my changes to -stack-list-locals.
Nick http://www.nick.uklinux.net
*** mi-cmds.h.~1.10.~ 2003-10-24 22:30:52.000000000 +0100
--- mi-cmds.h 2003-12-10 20:09:22.000000000 +0000
***************
*** 48,53 ****
--- 48,59 ----
MI_CMD_QUIET
};
+ enum print_values {
+ PRINT_NO_VALUES,
+ PRINT_ALL_VALUES,
+ PRINT_SIMPLE_VALUES
+ };
+
typedef enum mi_cmd_result (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
/* Older MI commands have this interface. Retained until all old
*** mi-cmd-var.c 2003-12-17 02:08:57.000000000 +0000
--- mi-cmd-var.c.~1.17~ 2003-12-17 00:07:15.000000000 +0000
***************
*** 257,285 ****
struct cleanup *cleanup_children;
int numchild;
char *type;
- enum print_values print_values;
! if (argc != 1 && argc != 2)
! error ("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME");
/* Get varobj handle, if a valid var obj name was specified */
! if (argc == 1) var = varobj_get_handle (argv[0]);
! else var = varobj_get_handle (argv[1]);
if (var == NULL)
error ("mi_cmd_var_list_children: Variable object not found");
numchild = varobj_list_children (var, &childlist);
ui_out_field_int (uiout, "numchild", numchild);
- if (argc == 2)
- if (strcmp (argv[0], "0") == 0
- || strcmp (argv[0], "--no-values") == 0)
- print_values = PRINT_NO_VALUES;
- else if (strcmp (argv[0], "1") == 0
- || strcmp (argv[0], "--all-values") == 0)
- print_values = PRINT_ALL_VALUES;
- else
- error ("mi_cmd_var_list_children: Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\"");
- else print_values = PRINT_NO_VALUES;
if (numchild <= 0)
return MI_CMD_DONE;
--- 257,273 ----
struct cleanup *cleanup_children;
int numchild;
char *type;
! if (argc != 1)
! error ("mi_cmd_var_list_children: Usage: NAME.");
/* Get varobj handle, if a valid var obj name was specified */
! var = varobj_get_handle (argv[0]);
if (var == NULL)
error ("mi_cmd_var_list_children: Variable object not found");
numchild = varobj_list_children (var, &childlist);
ui_out_field_int (uiout, "numchild", numchild);
if (numchild <= 0)
return MI_CMD_DONE;
***************
*** 296,303 ****
ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
- if (print_values)
- ui_out_field_string (uiout, "value", varobj_get_value (*cc));
type = varobj_get_type (*cc);
/* C++ pseudo-variables (public, private, protected) do not have a type */
if (type)
--- 284,289 ----
*** gdb.texinfo.~1.185~ 2003-12-17 00:06:41.000000000 +0000
--- gdb.texinfo 2003-12-17 02:13:43.000000000 +0000
***************
*** 17202,17209 ****
@end smallexample
Display the local variable names for the current frame. With an
! argument of 0 prints only the names of the variables, with argument of 1
! prints also their values.
@subsubheading @value{GDBN} Command
--- 17202,17215 ----
@end smallexample
Display the local variable names for the current frame. With an
! argument of 0 or @code{--no-values}, prints only the names of the variables.
! With argument of 1 or @code{--all-values}, prints also their values. With
! argument of 2 or @code{--simple-values}, prints the name, type and value for
! simple data types and the name and type for arrays, structures and
! unions. In this last case, the idea is that the user can see the
! value of simple data types immediately and he can create variable
! objects for other data types if he wishes to explore their values in
! more detail.
@subsubheading @value{GDBN} Command
***************
*** 17216,17224 ****
-stack-list-locals 0
^done,locals=[name="A",name="B",name="C"]
(@value{GDBP})
! -stack-list-locals 1
^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
! @{name="C",value="3"@}]
(@value{GDBP})
@end smallexample
--- 17222,17233 ----
-stack-list-locals 0
^done,locals=[name="A",name="B",name="C"]
(@value{GDBP})
! -stack-list-locals --all-values
^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
! @{name="C",value="@{1, 2, 3@}"@}]
! -stack-list-locals --simple-values
! ^done,locals=[@{name="A",type="int",value="1"@},
! @{name="B",type="int",value="2"@},@{name="C",type="int [3]"@}]
(@value{GDBP})
@end smallexample
***************
*** 18162,18175 ****
@subsubheading Synopsis
@smallexample
! -var-list-children @var{name}
@end smallexample
! Returns a list of the children of the specified variable object:
@smallexample
numchild=@var{n},children=[@{name=@var{name},
numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
@end smallexample
--- 18171,18196 ----
@subsubheading Synopsis
@smallexample
! -var-list-children [@var{print-values}] @var{name}
@end smallexample
! Returns a list of the children of the specified variable object. With
! just the variable object name as an argument or with an optional
! preceding argument of 0 or @code{--no-values}, prints only the names of the
! variables. With an optional preceding argument of 1 or @code{--all-values},
! also prints their values.
!
! @subsubheading Example
@smallexample
+ (@value{GDBP})
+ -var-list-children n
numchild=@var{n},children=[@{name=@var{name},
numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
+ (@value{GDBP})
+ -var-list-children --all-values n
+ numchild=@var{n},children=[@{name=@var{name},
+ numchild=@var{n},value=@var{value},type=@var{type}@},@r{(repeats N times)}]
@end smallexample
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children
2003-12-17 2:29 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Nick Roberts
@ 2003-12-17 2:32 ` David Carlton
2003-12-17 18:51 ` [PATCH: gdb/mi] -stack-list-locals Nick Roberts
2003-12-17 18:05 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Eli Zaretskii
2004-01-05 21:43 ` Andrew Cagney
2 siblings, 1 reply; 23+ messages in thread
From: David Carlton @ 2003-12-17 2:32 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
On Wed, 17 Dec 2003 02:21:25 +0000, Nick Roberts <nick@nick.uklinux.net> said:
> 1) Uses SYMBOL_PRINT_NAME instead of DEPRECATED_SYMBOL_NAME for lookup_symbol
> (in mi-cmd-stack.c) as advised by David Carlton.
I actually suggested SYMBOL_NATURAL_NAME for the call to
lookup_symbol. But it's not in the patch below - I think you left out
that bit of the patch?
David Carlton
carlton@kealia.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children
2003-12-17 2:29 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Nick Roberts
2003-12-17 2:32 ` David Carlton
@ 2003-12-17 18:05 ` Eli Zaretskii
2004-01-05 21:43 ` Andrew Cagney
2 siblings, 0 replies; 23+ messages in thread
From: Eli Zaretskii @ 2003-12-17 18:05 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
> From: Nick Roberts <nick@nick.uklinux.net>
> Date: Wed, 17 Dec 2003 02:21:25 +0000
>
> This patch covers four files mi-cmds.h, mi-cmd-stack.c, mi-cmd-var.c
> and gdb.texinfo and:
Thanks, the documentation patch is approved.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals
2003-12-17 2:32 ` David Carlton
@ 2003-12-17 18:51 ` Nick Roberts
2003-12-17 21:21 ` David Carlton
0 siblings, 1 reply; 23+ messages in thread
From: Nick Roberts @ 2003-12-17 18:51 UTC (permalink / raw)
To: gdb-patches; +Cc: David Carlton
> I actually suggested SYMBOL_NATURAL_NAME for the call to
> lookup_symbol. But it's not in the patch below - I think you left out
> that bit of the patch?
Yes..Oops! I actually had the right macro in the patch but forgot to include
it. I guess the moral is don't send in patches at 2 in the morning! Sorry
about that.
Take 2 on mi-cmd-stack.c:
1) Uses SYMBOL_NATURAL_NAME instead of DEPRECATED_SYMBOL_NAME for lookup_symbol
(in mi-cmd-stack.c) as advised by David Carlton.
2) Shares syntax with earlier changes for -stack-list-locals.
Nick http://www.nick.uklinux.net
*** mi-cmd-stack.c.~1.19.~ 2003-06-12 23:29:37.000000000 +0100
--- mi-cmd-stack.c 2003-12-16 23:14:00.000000000 +0000
***************
*** 29,34 ****
--- 29,35 ----
#include "block.h"
#include "stack.h"
#include "dictionary.h"
+ #include "gdb_string.h"
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
***************
*** 137,146 ****
enum mi_cmd_result
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
{
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
! list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame);
return MI_CMD_DONE;
}
--- 138,163 ----
enum mi_cmd_result
mi_cmd_stack_list_locals (char *command, char **argv, int argc)
{
+ struct frame_info *frame;
+ enum print_values print_values;
+
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
! frame = get_selected_frame ();
!
! if (strcmp (argv[0], "0") == 0
! || strcmp (argv[0], "--no-values") == 0)
! print_values = PRINT_NO_VALUES;
! else if (strcmp (argv[0], "1") == 0
! || strcmp (argv[0], "--all-values") == 0)
! print_values = PRINT_ALL_VALUES;
! else if (strcmp (argv[0], "2") == 0
! || strcmp (argv[0], "--simple-values") == 0)
! print_values = PRINT_SIMPLE_VALUES;
! else
! error ("mi_cmd_stack_list_locals: Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\"");
! list_args_or_locals (1, print_values, frame);
return MI_CMD_DONE;
}
***************
*** 218,223 ****
--- 235,241 ----
int nsyms;
struct cleanup *cleanup_list;
static struct ui_stream *stb = NULL;
+ struct type *type;
stb = ui_out_stream_new (uiout);
***************
*** 268,291 ****
if (print_me)
{
struct cleanup *cleanup_tuple = NULL;
! if (values)
cleanup_tuple =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
! ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
! if (values)
! {
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
}
}
}
--- 286,324 ----
if (print_me)
{
struct cleanup *cleanup_tuple = NULL;
! if (values != PRINT_NO_VALUES)
cleanup_tuple =
make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
! ui_out_field_string (uiout, "name", SYMBOL_PRINT_NAME (sym));
! struct symbol *sym2;
! if (!locals)
! sym2 = lookup_symbol (SYMBOL_NATURAL_NAME (sym),
! block, VAR_DOMAIN,
! (int *) NULL,
! (struct symtab **) NULL);
! else
sym2 = sym;
+ switch (values)
+ {
+ case PRINT_SIMPLE_VALUES:
+ type = check_typedef (sym2->type);
+ type_print (sym2->type, "", stb->stream, -1);
+ ui_out_field_stream (uiout, "type", stb);
+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY &&
+ TYPE_CODE (type) != TYPE_CODE_STRUCT &&
+ TYPE_CODE (type) != TYPE_CODE_UNION)
+ {
+ print_variable_value (sym2, fi, stb->stream);
+ ui_out_field_stream (uiout, "value", stb);
+ }
+ do_cleanups (cleanup_tuple);
+ break;
+ case PRINT_ALL_VALUES:
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
+ break;
}
}
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals
2003-12-17 18:51 ` [PATCH: gdb/mi] -stack-list-locals Nick Roberts
@ 2003-12-17 21:21 ` David Carlton
0 siblings, 0 replies; 23+ messages in thread
From: David Carlton @ 2003-12-17 21:21 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
On Wed, 17 Dec 2003 18:41:01 +0000, Nick Roberts <nick@nick.uklinux.net> said:
> Take 2 on mi-cmd-stack.c:
> 1) Uses SYMBOL_NATURAL_NAME instead of DEPRECATED_SYMBOL_NAME for
> lookup_symbol (in mi-cmd-stack.c) as advised by David Carlton.
Much better, thanks. :-)
David Carlton
carlton@kealia.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children
2003-12-17 2:29 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Nick Roberts
2003-12-17 2:32 ` David Carlton
2003-12-17 18:05 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Eli Zaretskii
@ 2004-01-05 21:43 ` Andrew Cagney
2004-01-06 0:14 ` [PATCH: gdb/mi] -stack-list-locals testcase Nick Roberts
2 siblings, 1 reply; 23+ messages in thread
From: Andrew Cagney @ 2004-01-05 21:43 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
Nick, just the testcase is missing. Suggest tweaking "mi-stack.exp"
(you do not need to tweak mi[12]-stack.exp since they test older protocols).
Andrew
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
2004-01-05 21:43 ` Andrew Cagney
@ 2004-01-06 0:14 ` Nick Roberts
2004-01-06 1:07 ` Andrew Cagney
0 siblings, 1 reply; 23+ messages in thread
From: Nick Roberts @ 2004-01-06 0:14 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> Nick, just the testcase is missing. Suggest tweaking "mi-stack.exp"
> (you do not need to tweak mi[12]-stack.exp since they test older protocols).
mi-stack.exp had three fails to start with. Replacing line=\"7\" with
line=\"8\" and "-exec-next 3" with "-exec-next 4" removed them.
I have added one simple test for `-stack-list-locals 2' that seems to
work. It does not test complex data types but this would require changing
basics.c, which is probably not worth it.
Andrew, if you tell me that this patch does the right thing, then I'll do one
for -var-list-children.
Nick
*** mi-stack.exp.~1.10.~ 2002-11-05 15:43:18.000000000 +0000
--- mi-stack.exp 2004-01-05 23:38:27.000000000 +0000
***************
*** 57,63 ****
# -stack-list-frames 1 3
mi_gdb_test "231-stack-list-frames" \
! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
"stack frame listing"
mi_gdb_test "232-stack-list-frames 1 1" \
"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
--- 57,63 ----
# -stack-list-frames 1 3
mi_gdb_test "231-stack-list-frames" \
! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"7\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
"stack frame listing"
mi_gdb_test "232-stack-list-frames 1 1" \
"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
***************
*** 156,162 ****
"stack locals listing 0"
# step until A, B, C, have some reasonable values.
! send_gdb "-exec-next 3\n"
gdb_expect {
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
pass "next's in callee4"
--- 156,162 ----
"stack locals listing 0"
# step until A, B, C, have some reasonable values.
! send_gdb "-exec-next 4\n"
gdb_expect {
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
pass "next's in callee4"
***************
*** 168,173 ****
--- 168,177 ----
"232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\\\]" \
"stack locals listing 1"
+ mi_gdb_test "232-stack-list-locals 2" \
+ "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\}\\\]" \
+ "stack locals listing 2"
+
mi_gdb_test "234-stack-list-locals" \
"234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
"stack locals listing wrong"
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
2004-01-06 0:14 ` [PATCH: gdb/mi] -stack-list-locals testcase Nick Roberts
@ 2004-01-06 1:07 ` Andrew Cagney
2004-01-07 16:31 ` Andrew Cagney
0 siblings, 1 reply; 23+ messages in thread
From: Andrew Cagney @ 2004-01-06 1:07 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
> > Nick, just the testcase is missing. Suggest tweaking "mi-stack.exp"
> > (you do not need to tweak mi[12]-stack.exp since they test older protocols).
>
> mi-stack.exp had three fails to start with. Replacing line=\"7\" with
> line=\"8\" and "-exec-next 3" with "-exec-next 4" removed them.
>
> I have added one simple test for `-stack-list-locals 2' that seems to
> work. It does not test complex data types but this would require changing
> basics.c, which is probably not worth it.
>
> Andrew, if you tell me that this patch does the right thing, then I'll do one
> for -var-list-children.
>
> Nick
>
>
> *** mi-stack.exp.~1.10.~ 2002-11-05 15:43:18.000000000 +0000
> --- mi-stack.exp 2004-01-05 23:38:27.000000000 +0000
> ***************
> *** 57,63 ****
> # -stack-list-frames 1 3
>
> mi_gdb_test "231-stack-list-frames" \
> ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> "stack frame listing"
> mi_gdb_test "232-stack-list-frames 1 1" \
> "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
> --- 57,63 ----
> # -stack-list-frames 1 3
>
> mi_gdb_test "231-stack-list-frames" \
> ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"7\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> "stack frame listing"
> mi_gdb_test "232-stack-list-frames 1 1" \
> "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
This test (and the rest of mi-stack.exp) is passing on a PPC/NetBSD gcc
2.96 stabs system. We'll need to look at it more carefully (or check
michaelc's test matrix) to see why there's a failure. MI is more strict
with its test results.
> ***************
> *** 156,162 ****
> "stack locals listing 0"
>
> # step until A, B, C, have some reasonable values.
> ! send_gdb "-exec-next 3\n"
> gdb_expect {
> -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
> pass "next's in callee4"
> --- 156,162 ----
> "stack locals listing 0"
>
> # step until A, B, C, have some reasonable values.
> ! send_gdb "-exec-next 4\n"
> gdb_expect {
> -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
> pass "next's in callee4"
> ***************
> *** 168,173 ****
> --- 168,177 ----
> "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\\\]" \
> "stack locals listing 1"
>
> + mi_gdb_test "232-stack-list-locals 2" \
> + "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\}\\\]" \
> + "stack locals listing 2"
> +
Yes, just like that.
Andrew
> mi_gdb_test "234-stack-list-locals" \
> "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
> "stack locals listing wrong"
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
2004-01-06 1:07 ` Andrew Cagney
@ 2004-01-07 16:31 ` Andrew Cagney
2004-01-07 17:34 ` Mark Kettenis
0 siblings, 1 reply; 23+ messages in thread
From: Andrew Cagney @ 2004-01-07 16:31 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb-patches
> *** mi-stack.exp.~1.10.~ 2002-11-05 15:43:18.000000000 +0000
> --- mi-stack.exp 2004-01-05 23:38:27.000000000 +0000
> ***************
> *** 57,63 ****
> # -stack-list-frames 1 3
> mi_gdb_test "231-stack-list-frames" \
> ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> "stack frame listing"
> mi_gdb_test "232-stack-list-frames 1 1" \
> "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
> --- 57,63 ----
> # -stack-list-frames 1 3
> mi_gdb_test "231-stack-list-frames" \
> ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"7\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> "stack frame listing"
> mi_gdb_test "232-stack-list-frames 1 1" \
> "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
>
> This test (and the rest of mi-stack.exp) is passing on a PPC/NetBSD gcc 2.96 stabs system. We'll need to look at it more carefully (or check michaelc's test matrix) to see why there's a failure. MI is more strict with its test results.
Nick, what's your exact system? On amd64 and i386 GNU/Linux systems
(RHEL 3, dwarf 2, gcc 2.3.2 based) mi-stack.exp I'm also seeing this
pass (puzzled).
Andrew
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
2004-01-07 16:31 ` Andrew Cagney
@ 2004-01-07 17:34 ` Mark Kettenis
2004-01-07 17:40 ` Daniel Jacobowitz
0 siblings, 1 reply; 23+ messages in thread
From: Mark Kettenis @ 2004-01-07 17:34 UTC (permalink / raw)
To: cagney; +Cc: nick, gdb-patches
Date: Wed, 07 Jan 2004 11:31:54 -0500
From: Andrew Cagney <cagney@gnu.org>
> *** mi-stack.exp.~1.10.~ 2002-11-05 15:43:18.000000000 +0000
> --- mi-stack.exp 2004-01-05 23:38:27.000000000 +0000
> ***************
> *** 57,63 ****
> # -stack-list-frames 1 3
> mi_gdb_test "231-stack-list-frames" \
> ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> "stack frame listing"
> mi_gdb_test "232-stack-list-frames 1 1" \
> "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
> --- 57,63 ----
> # -stack-list-frames 1 3
> mi_gdb_test "231-stack-list-frames" \
> ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"7\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> "stack frame listing"
> mi_gdb_test "232-stack-list-frames 1 1" \
> "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
>
> This test (and the rest of mi-stack.exp) is passing on a PPC/NetBSD gcc 2.96 stabs system. We'll need to look at it more carefully (or check michaelc's test matrix) to see why there's a failure. MI is more strict with its test results.
Nick, what's your exact system? On amd64 and i386 GNU/Linux systems
(RHEL 3, dwarf 2, gcc 2.3.2 based) mi-stack.exp I'm also seeing this
pass (puzzled).
I think it would be useful if Nick could post the output from "objdump
--stabs" on the generated binary. The output of "gcc -g -S" on the
relevant source file would be even more useful.
I know for a fact that there are serious problems with the way GDB
reads line numbers for stabs. In order to work around the bad
line-number info generated by GCC 2.95.3, we relocate the first
N_SLINE stab, which leads to incorrect behaviour, such as skipping the
first line of a function, with other compilers (such as Sun's) and
when debugging optimized code. It's not unlikely that it influences
non-IA-32 platforms too.
I'll post a more detailed explanation in the near future.
Mark
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
2004-01-07 17:34 ` Mark Kettenis
@ 2004-01-07 17:40 ` Daniel Jacobowitz
0 siblings, 0 replies; 23+ messages in thread
From: Daniel Jacobowitz @ 2004-01-07 17:40 UTC (permalink / raw)
To: gdb-patches
On Wed, Jan 07, 2004 at 06:34:13PM +0100, Mark Kettenis wrote:
> Date: Wed, 07 Jan 2004 11:31:54 -0500
> From: Andrew Cagney <cagney@gnu.org>
>
> > *** mi-stack.exp.~1.10.~ 2002-11-05 15:43:18.000000000 +0000
> > --- mi-stack.exp 2004-01-05 23:38:27.000000000 +0000
> > ***************
> > *** 57,63 ****
> > # -stack-list-frames 1 3
> > mi_gdb_test "231-stack-list-frames" \
> > ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> > "stack frame listing"
> > mi_gdb_test "232-stack-list-frames 1 1" \
> > "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
> > --- 57,63 ----
> > # -stack-list-frames 1 3
> > mi_gdb_test "231-stack-list-frames" \
> > ! "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"7\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> > "stack frame listing"
> > mi_gdb_test "232-stack-list-frames 1 1" \
> > "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
> >
> > This test (and the rest of mi-stack.exp) is passing on a PPC/NetBSD gcc 2.96 stabs system. We'll need to look at it more carefully (or check michaelc's test matrix) to see why there's a failure. MI is more strict with its test results.
>
> Nick, what's your exact system? On amd64 and i386 GNU/Linux systems
> (RHEL 3, dwarf 2, gcc 2.3.2 based) mi-stack.exp I'm also seeing this
> pass (puzzled).
>
> I think it would be useful if Nick could post the output from "objdump
> --stabs" on the generated binary. The output of "gcc -g -S" on the
> relevant source file would be even more useful.
>
> I know for a fact that there are serious problems with the way GDB
> reads line numbers for stabs. In order to work around the bad
> line-number info generated by GCC 2.95.3, we relocate the first
> N_SLINE stab, which leads to incorrect behaviour, such as skipping the
> first line of a function, with other compilers (such as Sun's) and
> when debugging optimized code. It's not unlikely that it influences
> non-IA-32 platforms too.
>
> I'll post a more detailed explanation in the near future.
*sigh* it may be time to remove that hack. I went to a lot of trouble
to get it to work, but lately a number of legitimate inputs have been
getting confused by it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
2004-01-07 21:06 Michael Elizabeth Chastain
@ 2004-01-07 23:47 ` Nick Roberts
0 siblings, 0 replies; 23+ messages in thread
From: Nick Roberts @ 2004-01-07 23:47 UTC (permalink / raw)
To: cagney, Michael Elizabeth Chastain, kettenis; +Cc: gdb-patches
> Nick, what's your exact system? On amd64 and i386 GNU/Linux systems
> (RHEL 3, dwarf 2, gcc 2.3.2 based) mi-stack.exp I'm also seeing this
> pass (puzzled).
gcc 2.3.2?
nick:{nick}44: uname -a
Linux nick.uklinux.net 2.4.19-16mdk #1 Fri Sep 20 18:15:05 CEST 2002 i586 unknown
(Mandrake 9, dwarf-2, gcc 3.2)
> mark> I think it would be useful if Nick could post the output from "objdump
> mark> --stabs" on the generated binary...
I think my system uses dwarf-2 (whatever that is) by default. If I recompile
with `cc -gstabs -o basics basics.c', break callee4 still breaks on line 7
(which is an opening curly bracket, testsuite expects it to break on line 8).
Then:
nick:{nick}21: objdump --stabs basics
basics: file format elf32-i386
Contents of .stab section:
Symnum n_type n_othr n_desc n_value n_strx String
-1 HdrSym 0 62 00000397 1
0 SO 0 0 0804833c 1 basics.c
1 OPT 0 0 00000000 10 gcc2_compiled.
2 LSYM 0 0 00000000 25 int:t(0,1)=r(0,1);-2147483648;2147483647;
3 LSYM 0 0 00000000 67 char:t(0,2)=r(0,2);0;127;
4 LSYM 0 0 00000000 93 long int:t(0,3)=r(0,3);-2147483648;2147483647;
5 LSYM 0 0 00000000 140 unsigned int:t(0,4)=r(0,4);0;-1;
6 LSYM 0 0 00000000 173 long unsigned int:t(0,5)=r(0,5);0;-1;
7 LSYM 0 0 00000000 211 long long int:t(0,6)=r(0,6);0;-1;
8 LSYM 0 0 00000000 245 long long unsigned int:t(0,7)=r(0,7);0;-1;
9 LSYM 0 0 00000000 288 short int:t(0,8)=r(0,8);-32768;32767;
10 LSYM 0 0 00000000 326 short unsigned int:t(0,9)=r(0,9);0;65535;
11 LSYM 0 0 00000000 368 signed char:t(0,10)=r(0,10);-128;127;
12 LSYM 0 0 00000000 406 unsigned char:t(0,11)=r(0,11);0;255;
13 LSYM 0 0 00000000 443 float:t(0,12)=r(0,1);4;0;
14 LSYM 0 0 00000000 469 double:t(0,13)=r(0,1);8;0;
15 LSYM 0 0 00000000 496 long double:t(0,14)=r(0,1);12;0;
16 LSYM 0 0 00000000 529 complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;
17 LSYM 0 0 00000000 586 complex float:t(0,16)=r(0,16);8;0;
18 LSYM 0 0 00000000 621 complex double:t(0,17)=r(0,17);16;0;
19 LSYM 0 0 00000000 658 complex long double:t(0,18)=r(0,18);24;0;
20 LSYM 0 0 00000000 700 __builtin_va_list:t(0,19)=*(0,2)
21 LSYM 0 0 00000000 733 _Bool:t(0,20)=eFalse:0,True:1,;
22 BINCL 0 0 00003137 1 basics.c
23 FUN 0 0 0804833c 765 callee4:F(0,1)
24 SLINE 0 7 00000000 0
25 SLINE 0 8 00000003 0
26 SLINE 0 9 0000000b 0
27 SLINE 0 12 00000013 0
28 SLINE 0 13 0000001e 0
29 SLINE 0 14 00000023 0
30 LSYM 0 0 00000008 780 A:(0,1)
31 LSYM 0 0 00000004 788 B:(0,1)
32 LSYM 0 0 00000000 796 C:(0,1)
33 LBRAC 0 0 00000000 0
34 RBRAC 0 0 00000023 0
35 FUN 0 0 08048364 804 callee3:F(0,1)
36 PSYM 0 0 00000008 819 strarg:p(0,19)
37 SLINE 0 16 00000000 0
38 SLINE 0 17 00000006 0
39 SLINE 0 18 0000000b 0
40 FUN 0 0 08048372 834 callee2:F(0,1)
41 PSYM 0 0 00000008 849 intarg:p(0,1)
42 PSYM 0 0 0000000c 819 strarg:p(0,19)
43 SLINE 0 21 00000000 0
44 SLINE 0 22 00000006 0
45 SLINE 0 23 00000014 0
46 FUN 0 0 08048388 863 callee1:F(0,1)
47 PSYM 0 0 00000008 849 intarg:p(0,1)
48 PSYM 0 0 0000000c 819 strarg:p(0,19)
49 PSYM 0 0 00000010 878 fltarg:p(0,13)
50 SLINE 0 26 00000000 0
51 SLINE 0 27 00000012 0
52 SLINE 0 28 00000023 0
53 LSYM 0 0 fffffff8 893 fltarg:(0,13)
54 FUN 0 0 080483ae 907 main:F(0,1)
55 SLINE 0 31 00000000 0
56 SLINE 0 32 00000010 0
57 SLINE 0 33 00000026 0
58 SLINE 0 35 0000003c 0
59 SLINE 0 37 0000004c 0
60 SLINE 0 38 00000051 0
61 SO 0 0 08048401 0
> mark> ...The output of "gcc -g -S" on the
> mark> relevant source file would be even more useful.
see below (for stabs case).
> Right. Generally, the name and version of the compiler is essential
> information here. (The compiler used to build the test program,
> not the compiler used to build gdb!)
nick:{nick}42: cc --version
cc (GCC) 3.2 (Mandrake Linux 9.0 3.2-1mdk)
Copyright (C) 2002 Free Software Foundation, Inc.
.file "basics.c"
.file 1 "basics.c"
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.section .debug_line,"",@progbits
.Ldebug_line0:
.text
.Ltext0:
.align 2
.globl callee4
.type callee4,@function
callee4:
.LFB1:
.loc 1 7 0
.LBB2:
subl $12, %esp
.LCFI0:
.loc 1 8 0
movl $1, 8(%esp)
.loc 1 9 0
movl $2, 4(%esp)
.loc 1 12 0
movl 4(%esp), %eax
addl 8(%esp), %eax
movl %eax, (%esp)
.loc 1 13 0
movl $0, %eax
.LBE2:
.loc 1 14 0
addl $12, %esp
.LCFI1:
ret
.LFE1:
.Lfe1:
.size callee4,.Lfe1-callee4
.align 2
.globl callee3
.type callee3,@function
callee3:
.LFB2:
.loc 1 16 0
pushl %ebp
.LCFI2:
movl %esp, %ebp
.LCFI3:
subl $8, %esp
.LCFI4:
.loc 1 17 0
call callee4
.loc 1 18 0
leave
ret
.LFE2:
.Lfe2:
.size callee3,.Lfe2-callee3
.align 2
.globl callee2
.type callee2,@function
callee2:
.LFB3:
.loc 1 21 0
pushl %ebp
.LCFI5:
movl %esp, %ebp
.LCFI6:
subl $8, %esp
.LCFI7:
.loc 1 22 0
subl $12, %esp
pushl 12(%ebp)
.LCFI8:
call callee3
addl $16, %esp
.loc 1 23 0
leave
ret
.LFE3:
.Lfe3:
.size callee2,.Lfe3-callee2
.align 2
.globl callee1
.type callee1,@function
callee1:
.LFB4:
.loc 1 26 0
pushl %ebp
.LCFI9:
movl %esp, %ebp
.LCFI10:
subl $8, %esp
.LCFI11:
movl 16(%ebp), %eax
movl 20(%ebp), %edx
movl %eax, -8(%ebp)
movl %edx, -4(%ebp)
.loc 1 27 0
subl $8, %esp
pushl 12(%ebp)
pushl 8(%ebp)
.LCFI12:
call callee2
addl $16, %esp
.loc 1 28 0
leave
ret
.LFE4:
.Lfe4:
.size callee1,.Lfe4-callee1
.section .rodata
.LC0:
.string "A string argument."
.LC1:
.string "Hello, World!"
.text
.align 2
.globl main
.type main,@function
main:
.LFB5:
.loc 1 31 0
pushl %ebp
.LCFI13:
movl %esp, %ebp
.LCFI14:
subl $8, %esp
.LCFI15:
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
.loc 1 32 0
pushl $1074528256
pushl $0
pushl $.LC0
pushl $2
.LCFI16:
call callee1
addl $16, %esp
.loc 1 33 0
pushl $1074528256
pushl $0
pushl $.LC0
pushl $2
call callee1
addl $16, %esp
.loc 1 35 0
subl $12, %esp
pushl $.LC1
call printf
addl $16, %esp
.loc 1 37 0
movl $0, %eax
.loc 1 38 0
leave
ret
.LFE5:
.Lfe5:
.size main,.Lfe5-main
.section .debug_frame,"",@progbits
.Lframe0:
.long .LECIE0-.LSCIE0
.LSCIE0:
.long 0xffffffff
.byte 0x1
.string ""
.uleb128 0x1
.sleb128 -4
.byte 0x8
.byte 0xc
.uleb128 0x4
.uleb128 0x4
.byte 0x88
.uleb128 0x1
.align 4
.LECIE0:
.LSFDE0:
.long .LEFDE0-.LASFDE0
.LASFDE0:
.long .Lframe0
.long .LFB1
.long .LFE1-.LFB1
.byte 0x4
.long .LCFI0-.LFB1
.byte 0xe
.uleb128 0x10
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xe
.uleb128 0x4
.align 4
.LEFDE0:
.LSFDE2:
.long .LEFDE2-.LASFDE2
.LASFDE2:
.long .Lframe0
.long .LFB2
.long .LFE2-.LFB2
.byte 0x4
.long .LCFI2-.LFB2
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI3-.LCFI2
.byte 0xd
.uleb128 0x5
.align 4
.LEFDE2:
.LSFDE4:
.long .LEFDE4-.LASFDE4
.LASFDE4:
.long .Lframe0
.long .LFB3
.long .LFE3-.LFB3
.byte 0x4
.long .LCFI5-.LFB3
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI6-.LCFI5
.byte 0xd
.uleb128 0x5
.byte 0x4
.long .LCFI8-.LCFI6
.byte 0x2e
.uleb128 0x10
.align 4
.LEFDE4:
.LSFDE6:
.long .LEFDE6-.LASFDE6
.LASFDE6:
.long .Lframe0
.long .LFB4
.long .LFE4-.LFB4
.byte 0x4
.long .LCFI9-.LFB4
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI10-.LCFI9
.byte 0xd
.uleb128 0x5
.byte 0x4
.long .LCFI12-.LCFI10
.byte 0x2e
.uleb128 0x10
.align 4
.LEFDE6:
.LSFDE8:
.long .LEFDE8-.LASFDE8
.LASFDE8:
.long .Lframe0
.long .LFB5
.long .LFE5-.LFB5
.byte 0x4
.long .LCFI13-.LFB5
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI14-.LCFI13
.byte 0xd
.uleb128 0x5
.byte 0x4
.long .LCFI16-.LCFI14
.byte 0x2e
.uleb128 0x10
.align 4
.LEFDE8:
.text
.Letext0:
.section .debug_info
.long 0x13b
.value 0x2
.long .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.long .Ldebug_line0
.long .Letext0
.long .Ltext0
.long .LC11
.long .LC12
.long .LC13
.byte 0x1
.uleb128 0x2
.long 0x65
.byte 0x1
.long .LC2
.byte 0x1
.byte 0x7
.byte 0x1
.long 0x65
.long .LFB1
.long .LFE1
.byte 0x1
.byte 0x54
.uleb128 0x3
.string "A"
.byte 0x1
.byte 0x8
.long 0x65
.byte 0x2
.byte 0x91
.sleb128 8
.uleb128 0x3
.string "B"
.byte 0x1
.byte 0x9
.long 0x65
.byte 0x2
.byte 0x91
.sleb128 4
.uleb128 0x3
.string "C"
.byte 0x1
.byte 0xa
.long 0x65
.byte 0x2
.byte 0x91
.sleb128 0
.byte 0x0
.uleb128 0x4
.string "int"
.byte 0x4
.byte 0x5
.uleb128 0x2
.long 0x96
.byte 0x1
.long .LC3
.byte 0x1
.byte 0x10
.byte 0x1
.long 0x65
.long .LFB2
.long .LFE2
.byte 0x1
.byte 0x55
.uleb128 0x5
.long .LC6
.byte 0x1
.byte 0xf
.long 0x96
.byte 0x2
.byte 0x91
.sleb128 8
.byte 0x0
.uleb128 0x6
.byte 0x4
.long 0x9c
.uleb128 0x7
.long .LC4
.byte 0x1
.byte 0x6
.uleb128 0x2
.long 0xdb
.byte 0x1
.long .LC5
.byte 0x1
.byte 0x15
.byte 0x1
.long 0x65
.long .LFB3
.long .LFE3
.byte 0x1
.byte 0x55
.uleb128 0x5
.long .LC7
.byte 0x1
.byte 0x14
.long 0x65
.byte 0x2
.byte 0x91
.sleb128 8
.uleb128 0x5
.long .LC6
.byte 0x1
.byte 0x14
.long 0x96
.byte 0x2
.byte 0x91
.sleb128 12
.byte 0x0
.uleb128 0x2
.long 0x121
.byte 0x1
.long .LC8
.byte 0x1
.byte 0x1a
.byte 0x1
.long 0x65
.long .LFB4
.long .LFE4
.byte 0x1
.byte 0x55
.uleb128 0x5
.long .LC7
.byte 0x1
.byte 0x19
.long 0x65
.byte 0x2
.byte 0x91
.sleb128 8
.uleb128 0x5
.long .LC6
.byte 0x1
.byte 0x19
.long 0x96
.byte 0x2
.byte 0x91
.sleb128 12
.uleb128 0x5
.long .LC9
.byte 0x1
.byte 0x19
.long 0x121
.byte 0x2
.byte 0x91
.sleb128 -8
.byte 0x0
.uleb128 0x7
.long .LC10
.byte 0x8
.byte 0x4
.uleb128 0x8
.byte 0x1
.long .LC14
.byte 0x1
.byte 0x1f
.long 0x65
.long .LFB5
.long .LFE5
.byte 0x1
.byte 0x55
.byte 0x0
.section .debug_abbrev
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x10
.uleb128 0x6
.uleb128 0x12
.uleb128 0x1
.uleb128 0x11
.uleb128 0x1
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.byte 0x0
.byte 0x0
.uleb128 0x2
.uleb128 0x2e
.byte 0x1
.uleb128 0x1
.uleb128 0x13
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.byte 0x0
.byte 0x0
.uleb128 0x3
.uleb128 0x34
.byte 0x0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0xa
.byte 0x0
.byte 0x0
.uleb128 0x4
.uleb128 0x24
.byte 0x0
.uleb128 0x3
.uleb128 0x8
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.byte 0x0
.byte 0x0
.uleb128 0x5
.uleb128 0x5
.byte 0x0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0xa
.byte 0x0
.byte 0x0
.uleb128 0x6
.uleb128 0xf
.byte 0x0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0x0
.byte 0x0
.uleb128 0x7
.uleb128 0x24
.byte 0x0
.uleb128 0x3
.uleb128 0xe
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.byte 0x0
.byte 0x0
.uleb128 0x8
.uleb128 0x2e
.byte 0x0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.byte 0x0
.byte 0x0
.byte 0x0
.section .debug_pubnames,"",@progbits
.long 0x47
.value 0x2
.long .Ldebug_info0
.long 0x13f
.long 0x25
.string "callee4"
.long 0x6c
.string "callee3"
.long 0xa3
.string "callee2"
.long 0xdb
.string "callee1"
.long 0x128
.string "main"
.long 0x0
.section .debug_aranges,"",@progbits
.long 0x1c
.value 0x2
.long .Ldebug_info0
.byte 0x4
.byte 0x0
.value 0x0
.value 0x0
.long .Ltext0
.long .Letext0-.Ltext0
.long 0x0
.long 0x0
.section .debug_str,"MS",@progbits,1
.LC13:
.string "GNU C 3.2 (Mandrake Linux 9.0 3.2-1mdk)"
.LC12:
.string "/home/nick"
.LC7:
.string "intarg"
.LC6:
.string "strarg"
.LC8:
.string "callee1"
.LC5:
.string "callee2"
.LC3:
.string "callee3"
.LC2:
.string "callee4"
.LC11:
.string "basics.c"
.LC14:
.string "main"
.LC4:
.string "char"
.LC9:
.string "fltarg"
.LC10:
.string "double"
.ident "GCC: (GNU) 3.2 (Mandrake Linux 9.0 3.2-1mdk)"
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
@ 2004-01-07 21:06 Michael Elizabeth Chastain
2004-01-07 23:47 ` Nick Roberts
0 siblings, 1 reply; 23+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-07 21:06 UTC (permalink / raw)
To: cagney, kettenis; +Cc: gdb-patches, nick
mark> I think it would be useful if Nick could post the output from "objdump
mark> --stabs" on the generated binary. The output of "gcc -g -S" on the
mark> relevant source file would be even more useful.
Right. Generally, the name and version of the compiler is essential
information here. (The compiler used to build the test program,
not the compiler used to build gdb!)
Michael C
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH: gdb/mi] -stack-list-locals testcase
@ 2004-01-06 1:12 Michael Elizabeth Chastain
0 siblings, 0 replies; 23+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-06 1:12 UTC (permalink / raw)
To: cagney, nick; +Cc: gdb-patches
Line number differences say that gdb stopped on a different line.
Sometimes this is legal gdb behavior, and sometimes it indicates
a problem in gdb or in the debug output of gcc or in the interface
between the two.
Someone has to look closely at the gdb.log and decide which line
number(s) are legal to stop on. If gdb stops on a different line
number than it's supposed to, that is a bug, and it gets a FAIL
or a KFAIL or an XFAIL.
Michael C
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2004-01-07 23:47 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-23 0:16 RFC (gdb/mi): -stack-list-locals Nick Roberts
2003-11-26 0:48 ` Andrew Cagney
2003-12-02 3:14 ` RFC (gdb/mi): -stack-list-locals + PATCH Nick Roberts
2003-12-09 2:42 ` RFC (gdb/mi): -stack-list-locals + REVISED PATCH Nick Roberts
2003-12-10 17:56 ` Andrew Cagney
2003-12-10 22:26 ` Jason Molenda
2003-12-12 20:51 ` RFC (gdb/mi): -stack-list-locals Nick Roberts
2003-12-12 21:09 ` David Carlton
2003-12-17 2:29 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Nick Roberts
2003-12-17 2:32 ` David Carlton
2003-12-17 18:51 ` [PATCH: gdb/mi] -stack-list-locals Nick Roberts
2003-12-17 21:21 ` David Carlton
2003-12-17 18:05 ` [PATCH: gdb/mi + doco] -stack-list-locals and -var-list-children Eli Zaretskii
2004-01-05 21:43 ` Andrew Cagney
2004-01-06 0:14 ` [PATCH: gdb/mi] -stack-list-locals testcase Nick Roberts
2004-01-06 1:07 ` Andrew Cagney
2004-01-07 16:31 ` Andrew Cagney
2004-01-07 17:34 ` Mark Kettenis
2004-01-07 17:40 ` Daniel Jacobowitz
2003-12-12 23:01 ` RFC (gdb/mi): -stack-list-locals Jason Molenda
2004-01-06 1:12 [PATCH: gdb/mi] -stack-list-locals testcase Michael Elizabeth Chastain
2004-01-07 21:06 Michael Elizabeth Chastain
2004-01-07 23:47 ` Nick Roberts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox