This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[5.1?] [Fwd: gdb bug]


Hello,

Looking at the attached:

> This bug was found on gdb 5.0, compiled with --host=i686-pc-linux-gnu
> and --target=ia64-unknown-linux-gnu
> 
> "info regs" produces erroneous (byteswapped) output when running
> cross-platform with the debug target having larger registers than host
> long:s, and being little endian because of the following completely
> broken code in infcmd.c:
> 
> /* FIXME!  val_print probably can handle all of these cases now...  */
> 
>       /* Else if virtual format is too long for printf,
>          print in hex a byte at a time.  */
>       else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
> 	{
> 	  register int j;
> 	  printf_filtered ("0x");
> 	  for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
> 	    printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
> 	}
> 
> This piece of code will, of course, only work if the virtual buffer
> happens to contain bigendian data.
> 
> As the comment indicates(), val_print does handle this case correctly
> (at least in my i686 - ia64 case), and this whole if-branch can just
> be removed.

I've no quarms about zapping the code from the trunk.  I'm just 
wondering about the 5.1 branch.

Any one with an opinion?

Given it isn't native and fails the ``(gdb) break main; run'' test my 
current leaning is no.

> PS. This must be one of the snotties remarks I've ever read in a
> how-to-report-bugs text (quote from info gdb/gdb bugs):
> 
> 
>> Here are some things that are not necessary:
> 
> :
> 	  :
> 
>> * A guess about what the bug is or what it depends on.
>>
>> Such guesses are usually wrong.  Even we cannot guess right about
>> such things without first using the debugger to find the facts.
> 
> 
> Reading such things really makes one want to help out correcting your
> crappy code (NOT).

Checking Cygnus's old internal repository I've found:

> 1.1          (rich     28-Mar-91): /* FIXME!  val_print probably can handle all of these cases now...  */

and the doco is similar.  Both predate Cygnus making them very old.  I'd 
expect the comment and code to both pre-date the current crop of GDB 
contributors.

Could I suggest getting an FSF assignment so you can contribute to the 
code and, for instance, fix the above documentation bug?

	Andrew






This bug was found on gdb 5.0, compiled with --host=i686-pc-linux-gnu
and --target=ia64-unknown-linux-gnu

"info regs" produces erroneous (byteswapped) output when running
cross-platform with the debug target having larger registers than host
long:s, and being little endian because of the following completely
broken code in infcmd.c:

/* FIXME!  val_print probably can handle all of these cases now...  */

      /* Else if virtual format is too long for printf,
         print in hex a byte at a time.  */
      else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
	{
	  register int j;
	  printf_filtered ("0x");
	  for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
	    printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
	}

This piece of code will, of course, only work if the virtual buffer
happens to contain bigendian data.

As the comment indicates(), val_print does handle this case correctly
(at least in my i686 - ia64 case), and this whole if-branch can just
be removed.

- Gustav

PS. This must be one of the snotties remarks I've ever read in a
how-to-report-bugs text (quote from info gdb/gdb bugs):

>   Here are some things that are not necessary:
          :
	  :
>   * A guess about what the bug is or what it depends on.
>
>     Such guesses are usually wrong.  Even we cannot guess right about
>     such things without first using the debugger to find the facts.

Reading such things really makes one want to help out correcting your
crappy code (NOT).

_______________________________________________
Bug-gdb mailing list
Bug-gdb@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gdb




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]