aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarfread.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-10-06 16:47:32 +0000
committerIan Lance Taylor <ian@airs.com>1994-10-06 16:47:32 +0000
commitb8176214a5bb9810bf6d5244815e9a49c5055dce (patch)
treef85f7b264d7a3748cde6bdf99d131edcaa13da36 /gdb/dwarfread.c
parent97d3151a59022d8d76fd29100052645bd8d99c6b (diff)
downloadfsf-binutils-gdb-b8176214a5bb9810bf6d5244815e9a49c5055dce.zip
fsf-binutils-gdb-b8176214a5bb9810bf6d5244815e9a49c5055dce.tar.gz
fsf-binutils-gdb-b8176214a5bb9810bf6d5244815e9a49c5055dce.tar.bz2
* defs.h: If TARGET_BYTE_ORDER_SELECTABLE is defined by tm.h,
define TARGET_BYTE_ORDER as target_byte_order, and declare target_byte_order as an extern int, and define BITS_BIG_ENDIAN as a test of TARGET_BYTE_ORDER. * top.c: Several additions if TARGET_BYTE_ORDER_SELECTABLE is defined: (endianlist, target_byte_order): New variables. (set_endian, set_endian_big, set_endian_little): New functions. (show_endian): New function. (init_cmd_lists): Initialize endianlist. (init_main): Add commands ``set endian big'', ``set endian little'', and ``show endian''. * a29k-pinsn.c: Rewrite uses of TARGET_BYTE_ORDER and BITS_BIG_ENDIAN to switch at run time rather than at compile time. * coffread.c, dwarfread.c, findvar.c, mips-tdep.c: Likewise. * remote-os9k.c, stabsread.c, valarith.c, valprint.c: Likewise. * values.c: Likewise. * mips-tdep.c: Rewrite uses of GDB_TARGET_IS_MIPS64 to switch at run time rather than at compile time.
Diffstat (limited to 'gdb/dwarfread.c')
-rw-r--r--gdb/dwarfread.c68
1 files changed, 37 insertions, 31 deletions
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 150e1d8..aebe6bf 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -985,9 +985,7 @@ struct_type (dip, thisdie, enddie, objfile)
int n;
struct dieinfo mbr;
char *nextdie;
-#if !BITS_BIG_ENDIAN
int anonymous_size;
-#endif
if ((type = lookup_utype (dip -> die_ref)) == NULL)
{
@@ -1060,39 +1058,47 @@ struct_type (dip, thisdie, enddie, objfile)
list -> field.bitpos = 8 * locval (mbr.at_location);
/* Handle bit fields. */
list -> field.bitsize = mbr.at_bit_size;
-#if BITS_BIG_ENDIAN
- /* For big endian bits, the at_bit_offset gives the additional
- bit offset from the MSB of the containing anonymous object to
- the MSB of the field. We don't have to do anything special
- since we don't need to know the size of the anonymous object. */
- list -> field.bitpos += mbr.at_bit_offset;
-#else
- /* For little endian bits, we need to have a non-zero at_bit_size,
- so that we know we are in fact dealing with a bitfield. Compute
- the bit offset to the MSB of the anonymous object, subtract off
- the number of bits from the MSB of the field to the MSB of the
- object, and then subtract off the number of bits of the field
- itself. The result is the bit offset of the LSB of the field. */
- if (mbr.at_bit_size > 0)
+ if (BITS_BIG_ENDIAN)
{
- if (mbr.has_at_byte_size)
- {
- /* The size of the anonymous object containing the bit field
- is explicit, so use the indicated size (in bytes). */
- anonymous_size = mbr.at_byte_size;
- }
- else
+ /* For big endian bits, the at_bit_offset gives the
+ additional bit offset from the MSB of the containing
+ anonymous object to the MSB of the field. We don't
+ have to do anything special since we don't need to
+ know the size of the anonymous object. */
+ list -> field.bitpos += mbr.at_bit_offset;
+ }
+ else
+ {
+ /* For little endian bits, we need to have a non-zero
+ at_bit_size, so that we know we are in fact dealing
+ with a bitfield. Compute the bit offset to the MSB
+ of the anonymous object, subtract off the number of
+ bits from the MSB of the field to the MSB of the
+ object, and then subtract off the number of bits of
+ the field itself. The result is the bit offset of
+ the LSB of the field. */
+ if (mbr.at_bit_size > 0)
{
- /* The size of the anonymous object containing the bit field
- matches the size of an object of the bit field's type.
- DWARF allows at_byte_size to be left out in such cases,
- as a debug information size optimization. */
- anonymous_size = TYPE_LENGTH (list -> field.type);
+ if (mbr.has_at_byte_size)
+ {
+ /* The size of the anonymous object containing
+ the bit field is explicit, so use the
+ indicated size (in bytes). */
+ anonymous_size = mbr.at_byte_size;
+ }
+ else
+ {
+ /* The size of the anonymous object containing
+ the bit field matches the size of an object
+ of the bit field's type. DWARF allows
+ at_byte_size to be left out in such cases, as
+ a debug information size optimization. */
+ anonymous_size = TYPE_LENGTH (list -> field.type);
+ }
+ list -> field.bitpos +=
+ anonymous_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
}
- list -> field.bitpos +=
- anonymous_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
}
-#endif
nfields++;
break;
default: