From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
Subject: Re: [unavailable values part 1, 01/17] base support for unavailable value contents
Date: Mon, 14 Feb 2011 11:59:00 -0000 [thread overview]
Message-ID: <20110214115919.GA2454@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <201102101930.26399.pedro@codesourcery.com>
On Thu, 10 Feb 2011 20:30:26 +0100, Pedro Alves wrote:
> +/* Defines an [OFFSET, OFFSET + LENGTH) range. */
> +
> +struct range
> +{
> + /* Lowest offset in the range. */
> + int offset;
> +
> + /* Length of the range. */
> + int length;
> +};
I would find [LOW, HIGH) fields more readable as the code now still calculates
offset + length back and forth all over the code. FYI, not trying to require
it, though.
> +/* Returns true if RANGES contains any range that overlaps [OFFSET,
> + OFFSET+LENGTH). */
> +
> +static int
> +ranges_contain_p (VEC(range_s) *ranges, int offset, int length)
Couldn't even this function stick with the `overlap' term?
`contain' associates to me:
Returns true if each byte of [OFFSET, OFFSET+LENGTH) is overlapping with any
range in the RANGES list.
(My English association may not be right, though.)
> @@ -206,6 +310,11 @@ struct value
> + /* Unavailable ranges in CONTENTS. We mark unavailable ranges,
> + rather than available, since the common and default case is for a
> + value to be available. This is filled in at value read time. */
> + VEC(range_s) *unavailable;
Was there considered the opposite way to have a list of available ranges?
Besides cleaning up the inversion code implemented by this patchset in
read_value_memory it would also enable storing discontiguous memory with
a value.
Currently if you store inferior C++ object into a $convenience_variable you
cannot do much with it as it can no longer read the virtual method table
- besides it may no longer exist in the inferior the current code will not
even try to read it from the inferior.
I faced it also with archer-jankratochvil-vla - if you have a very large
inferior array printing only some slices/subsets of it - you still have to
store for $convenience_variable the whole range between first byte and last
byte accessed, despite most of the ranges in between get never accessed. You
will mostly print some slices/subsets because the whole array is too large.
So I was considering to turn value->contents into some discontiguous ranges
and this patch could also benefit from it.
> };
>
> +int
> +value_bytes_available (const struct value *value, int offset, int length)
ctags will never find a comment defined in a .h file. I would prefer at least
a stub comment:
/* Function comment present at the declaration. */
Many legacy functions just do not have any comment so one just does not search
more for a comment when there isn't any shown on the ctags-jump.
> + i = VEC_lower_bound (range_s, value->unavailable, &newr, range_lessthan);
> + if (i > 0)
> + {
> + struct range *bef = VEC_index (range_s, value->unavailable, i - i);
While this patch revisiou fixed two bugs
it has introduced a new bug - "i - i" -> "i - 1".
Thanks,
Jan
next prev parent reply other threads:[~2011-02-14 11:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-07 14:28 Pedro Alves
2011-02-07 15:47 ` Tom Tromey
2011-02-10 18:46 ` Pedro Alves
2011-02-10 19:30 ` Pedro Alves
2011-02-14 11:59 ` Jan Kratochvil [this message]
2011-02-14 13:18 ` Pedro Alves
2011-02-14 17:28 ` Jan Kratochvil
2011-02-11 21:11 ` Tom Tromey
2011-02-14 11:45 ` Pedro Alves
2011-02-08 4:17 ` Joel Brobecker
2011-02-10 18:53 ` 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=20110214115919.GA2454@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=tromey@redhat.com \
/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