[PATCH] Support DW_FORM_strx1, _strx2, _strx3, _strx4 forms.

Tom Tromey tom@tromey.com
Wed May 27 15:01:50 GMT 2020


>>>>> "Ali" == Ali Tamur via gdb-patches <gdb-patches@sourceware.org> writes:

Resurrecting a thread from a year ago...

Ali> +static unsigned int
Ali> +read_3_bytes (bfd *abfd, const gdb_byte *buf)
Ali> +{
Ali> +  unsigned int result = 0;
Ali> +  for (int i = 0; i < 3; ++i)
Ali> +    {
Ali> +      unsigned char byte = bfd_get_8 (abfd, buf);
Ali> +      buf++;
Ali> +      result |= ((unsigned int) byte << (i * 8));
Ali> +    }
Ali> +  return result;

I missed this at the time, but why does this require little-endian?
Other read_*_bytes functions use the BFD's endian-ness.
I couldn't find anything in the DWARF standard saying that this was an
exception -- but then again, maybe I missed it.

I note that BFD does have a bfd_get_24 macro that could readily be used
here, but I wanted to ask about this before proceeding.

thanks,
Tom


More information about the Gdb-patches mailing list