This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] logic change in m2-valprint.c
- From: Daniel Jacobowitz <drow at false dot org>
- To: Michael Snyder <msnyder at sonic dot net>
- Cc: gdb-patches at sourceware dot org, gaius at glam dot ac dot uk
- Date: Sun, 1 Jul 2007 12:02:24 -0400
- Subject: Re: [RFC] logic change in m2-valprint.c
- References: <16087.12.7.175.2.1183076995.squirrel@webmail.sonic.net> <20070701154831.GE10872@caradoc.them.org> <004a01c7bbf8$16a2ccc0$677ba8c0@sonic.net>
On Sun, Jul 01, 2007 at 08:54:19AM -0700, Michael Snyder wrote:
> > It can't be backwards; this is trying to print "1" or "1, 2" but your
> > change would make it print ", 1" and ", 12".
> >
> > I think it's also trying to shorten ranges to "{1..3, 6..7}". The
> > bug's got to be in there somewhere. Why's the code dead? I'm not
> > seeing it... element_seen can be reset by the bit clear case, and then
> > we'll get into the test you're changing again.
>
> 'Cause we're not in a loop, and it's not a static variable.
> The code is serial. At entry we set empty_set to one, and
> then we test to see if it's zero. It can't be zero.
How sure are you sure we're not in a loop? :-)
for (i = low_bound; i <= high_bound; i++)
{
bitval = value_bit_index (TYPE_FIELD_TYPE (type, field),
(TYPE_FIELD_BITPOS (type, field) /
8) +
valaddr + embedded_offset, i);
if (bitval < 0)
error (_("bit test is out of range"));
else if (bitval > 0)
{
previous_high = i;
if (! element_seen)
{
if (! empty_set)
fprintf_filtered (stream, ", ");
--
Daniel Jacobowitz
CodeSourcery