From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [unavailable values part 1, 00/17] introduction
Date: Mon, 07 Feb 2011 14:26:00 -0000 [thread overview]
Message-ID: <201102071426.12328.pedro@codesourcery.com> (raw)
In the context of tracepoints, I've been working on
adding support for partial/incomplete objects. That is, say, when
printing an array where only a few elements have been collected,
print what you can, and print something like "<unavailable>"
(like <optimized out>) for what has not been collected. E.g., with:
struct foo {
int a, b;
int array[10000];
void *ptr;
};
struct foo2 {
int d, ef;
struct foo foo;
};
struct foo2 foo2;
and a tracepoint that just collects "foo2.foo.array[0]",
when printing foo2 while inspecting the corresponding collected
traceframe, currently we get:
(gdb) p foo2
Cannot access memory at address 0x601080
This is GDB trying to read [&foo2, &foo2+sizeof foo2) for an lval_memory
value representing "foo2" and the read failing because required
memory is not "available" (it was not collected).
vs afterwards, after all the necessary changes, we'll get something like:
(gdb) p foo2
$1 = {d = <unavailable>, ef = <unavailable>, foo = {a = <unavailable>, b =
<unavailable>, array = {12345678,
<unavailable> <repeats 9999 times>}, ptr = <unavailable>}}
That is, we will still print what is available.
This requires marking chunks of a value's contents buffer as "unavailable"
at value read time, and, at value print time, check whether the value
contents chunk being printed is "available". The "unavailable"-ness of
the contents needs to be part of the struct value itself, given that when
printing a value from the value history, you still want to know what is
or isn't available, without consulting the target (which may not
exist anymore). The "unavailable"-ness of the contents is independent
of the backend lval_type (and implementation) behind a given
struct value, as it describes a "run-time"-ish property of the
value.
This series implements the base unavailable-value support, and
glues it with memory-based objects. Then, it fixes the printing
machinery to know how to print unavailable values in assorted
situations, and adds base tests.
Unavailable/uncollected function locals and arguments won't
be printing gracefully yet after this series, as
the glue between unavailable register / frame / values will
only come in a follow up series. After all that,
frame unwinding will also be taught to terminate gracefully
when not enough (stack/registers) data has been collected,
instead of printing errors, as currently.
I'd appreciate comments and extra eyeballs on all of this.
Pending objections, I'd like to commit this after a
reasonable wait.
I've regtested the series as a whole against current
mainline, and I saw no regressions.
--
Pedro Alves
next reply other threads:[~2011-02-07 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-07 14:26 Pedro Alves [this message]
2011-02-07 16:21 ` Tom Tromey
2011-02-08 4:45 ` Joel Brobecker
2011-02-14 11:50 ` Pedro Alves
2011-03-18 19:29 ` Pedro Alves
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=201102071426.12328.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/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