From: Andrew Cagney <cagney@gnu.org>
To: Nick Roberts <nick@nick.uklinux.net>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFC (gdb/mi): -stack-list-locals
Date: Wed, 26 Nov 2003 00:48:00 -0000 [thread overview]
Message-ID: <3FC3F85F.8050007@gnu.org> (raw)
In-Reply-To: <16319.64137.458928.417189@nick.uklinux.net>
> 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))
>
next prev parent reply other threads:[~2003-11-26 0:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-23 0:16 Nick Roberts
2003-11-26 0:48 ` Andrew Cagney [this message]
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
[not found] <1069611654.20143.ezmlm@sources.redhat.com>
2003-12-01 19:27 ` Jim Ingham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FC3F85F.8050007@gnu.org \
--to=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=nick@nick.uklinux.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox