2000-06-14 Jim Blandy <jimb@redhat.com>

* dwarf2read.c (dump_die): Use the proper printf format for
	printing DW_UNSND values; they're longs now.

	* dwarf2read.c (dump_die): We can read DW_FORM_data8 now, on
	at least some platforms, so print it out too.

2000-06-14  James E. Wilson  <wilson@bletchleypark.cygnus.com>

	* dwarf2read.c (struct attribute): Change unsnd and snd field types
	to long.
	(read_8_bytes): Change return type to long.
	(read_unsigned_leb128): Change return type to long.  Change type of
	local result to long.  Cast argument of left shift to long.
	(read_signed_leb128): Likewise.
This commit is contained in:
Jim Blandy 2000-06-14 23:29:06 +00:00
parent 8e1b6ed697
commit ce5d95e1bc
1 changed files with 15 additions and 14 deletions

View File

@ -228,8 +228,8 @@ struct attribute
{ {
char *str; char *str;
struct dwarf_block *blk; struct dwarf_block *blk;
unsigned int unsnd; unsigned long unsnd;
int snd; long int snd;
CORE_ADDR addr; CORE_ADDR addr;
} }
u; u;
@ -597,7 +597,7 @@ static unsigned int read_2_bytes (bfd *, char *);
static unsigned int read_4_bytes (bfd *, char *); static unsigned int read_4_bytes (bfd *, char *);
static unsigned int read_8_bytes (bfd *, char *); static unsigned long read_8_bytes (bfd *, char *);
static CORE_ADDR read_address (bfd *, char *); static CORE_ADDR read_address (bfd *, char *);
@ -605,9 +605,9 @@ static char *read_n_bytes (bfd *, char *, unsigned int);
static char *read_string (bfd *, char *, unsigned int *); static char *read_string (bfd *, char *, unsigned int *);
static unsigned int read_unsigned_leb128 (bfd *, char *, unsigned int *); static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *);
static int read_signed_leb128 (bfd *, char *, unsigned int *); static long read_signed_leb128 (bfd *, char *, unsigned int *);
static void set_cu_language (unsigned int); static void set_cu_language (unsigned int);
@ -3452,7 +3452,7 @@ read_4_signed_bytes (abfd, buf)
return bfd_get_signed_32 (abfd, (bfd_byte *) buf); return bfd_get_signed_32 (abfd, (bfd_byte *) buf);
} }
static unsigned int static unsigned long
read_8_bytes (abfd, buf) read_8_bytes (abfd, buf)
bfd *abfd; bfd *abfd;
char *buf; char *buf;
@ -3549,13 +3549,14 @@ read_string (abfd, buf, bytes_read_ptr)
#endif #endif
} }
static unsigned int static unsigned long
read_unsigned_leb128 (abfd, buf, bytes_read_ptr) read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
bfd *abfd; bfd *abfd;
char *buf; char *buf;
unsigned int *bytes_read_ptr; unsigned int *bytes_read_ptr;
{ {
unsigned int result, num_read; unsigned long result;
unsigned int num_read;
int i, shift; int i, shift;
unsigned char byte; unsigned char byte;
@ -3568,7 +3569,7 @@ read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
byte = bfd_get_8 (abfd, (bfd_byte *) buf); byte = bfd_get_8 (abfd, (bfd_byte *) buf);
buf++; buf++;
num_read++; num_read++;
result |= ((byte & 127) << shift); result |= ((unsigned long)(byte & 127) << shift);
if ((byte & 128) == 0) if ((byte & 128) == 0)
{ {
break; break;
@ -3579,13 +3580,13 @@ read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
return result; return result;
} }
static int static long
read_signed_leb128 (abfd, buf, bytes_read_ptr) read_signed_leb128 (abfd, buf, bytes_read_ptr)
bfd *abfd; bfd *abfd;
char *buf; char *buf;
unsigned int *bytes_read_ptr; unsigned int *bytes_read_ptr;
{ {
int result; long result;
int i, shift, size, num_read; int i, shift, size, num_read;
unsigned char byte; unsigned char byte;
@ -3599,7 +3600,7 @@ read_signed_leb128 (abfd, buf, bytes_read_ptr)
byte = bfd_get_8 (abfd, (bfd_byte *) buf); byte = bfd_get_8 (abfd, (bfd_byte *) buf);
buf++; buf++;
num_read++; num_read++;
result |= ((byte & 127) << shift); result |= ((long)(byte & 127) << shift);
shift += 7; shift += 7;
if ((byte & 128) == 0) if ((byte & 128) == 0)
{ {
@ -5491,12 +5492,13 @@ dump_die (die)
case DW_FORM_data1: case DW_FORM_data1:
case DW_FORM_data2: case DW_FORM_data2:
case DW_FORM_data4: case DW_FORM_data4:
case DW_FORM_data8:
case DW_FORM_ref1: case DW_FORM_ref1:
case DW_FORM_ref2: case DW_FORM_ref2:
case DW_FORM_ref4: case DW_FORM_ref4:
case DW_FORM_udata: case DW_FORM_udata:
case DW_FORM_sdata: case DW_FORM_sdata:
fprintf (stderr, "constant: %d", DW_UNSND (&die->attrs[i])); fprintf (stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
break; break;
case DW_FORM_string: case DW_FORM_string:
fprintf (stderr, "string: \"%s\"", fprintf (stderr, "string: \"%s\"",
@ -5512,7 +5514,6 @@ dump_die (die)
case DW_FORM_strp: /* we do not support separate string case DW_FORM_strp: /* we do not support separate string
section yet */ section yet */
case DW_FORM_indirect: /* we do not handle indirect yet */ case DW_FORM_indirect: /* we do not handle indirect yet */
case DW_FORM_data8: /* we do not have 64 bit quantities */
default: default:
fprintf (stderr, "unsupported attribute form: %d.", fprintf (stderr, "unsupported attribute form: %d.",
die->attrs[i].form); die->attrs[i].form);