bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdb bug


From: Gustav Hållberg
Subject: gdb bug
Date: Thu, 26 Jul 2001 15:19:38 +0200

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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]