Fix 64-bit constants on 32-bit hosts.
* dwarf2read.c (read_unsigned_leb128): Change declaration return type
from unsigned long to ULONGEST.
(read_signed_leb128): Change declaration return type from long to
LONGEST.
(dwarf2_const_value_attr): Change declaration parameter value from long
to LONGEST.
(dwarf2_compute_name): Change variable value from long to LONGEST.
(read_unsigned_leb128): Change return type, variable result and some
casts from unsigned long to ULONGEST.
(read_signed_leb128): Change return type, variable result and some
casts from long to LONGEST.
(dwarf2_const_value_data, dwarf2_const_value_attr): Change parameter
value from long to LONGEST.
(dwarf2_const_value): Change variable value from long to LONGEST.
* symmisc.c (print_symbol): Change SYMBOL_VALUE format strings to use
plongest and hex_string.
* symtab.h (struct general_symbol_info): Change ivalue from long to
LONGEST, remove the comment.
* tracepoint.c (validate_actionline, collect_symbol, scope_info):
Change SYMBOL_VALUE format strings to use plongest and hex_string.
+2012-04-18 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix 64-bit constants on 32-bit hosts.
+ * dwarf2read.c (read_unsigned_leb128): Change declaration return type
+ from unsigned long to ULONGEST.
+ (read_signed_leb128): Change declaration return type from long to
+ LONGEST.
+ (dwarf2_const_value_attr): Change declaration parameter value from long
+ to LONGEST.
+ (dwarf2_compute_name): Change variable value from long to LONGEST.
+ (read_unsigned_leb128): Change return type, variable result and some
+ casts from unsigned long to ULONGEST.
+ (read_signed_leb128): Change return type, variable result and some
+ casts from long to LONGEST.
+ (dwarf2_const_value_data, dwarf2_const_value_attr): Change parameter
+ value from long to LONGEST.
+ (dwarf2_const_value): Change variable value from long to LONGEST.
+ * symmisc.c (print_symbol): Change SYMBOL_VALUE format strings to use
+ plongest and hex_string.
+ * symtab.h (struct general_symbol_info): Change ivalue from long to
+ LONGEST, remove the comment.
+ * tracepoint.c (validate_actionline, collect_symbol, scope_info):
+ Change SYMBOL_VALUE format strings to use plongest and hex_string.
+
2012-04-18 Siddhesh Poyarekar <siddhesh@redhat.com>
PR symtab/7259:
const struct comp_unit_head *,
unsigned int *);
-static unsigned long read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *);
+static ULONGEST read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *);
-static long read_signed_leb128 (bfd *, gdb_byte *, unsigned int *);
+static LONGEST read_signed_leb128 (bfd *, gdb_byte *, unsigned int *);
static gdb_byte *skip_leb128 (bfd *, gdb_byte *);
struct type *type,
const char *name,
struct obstack *obstack,
- struct dwarf2_cu *cu, long *value,
+ struct dwarf2_cu *cu, LONGEST *value,
gdb_byte **bytes,
struct dwarf2_locexpr_baton **baton);
for (child = die->child; child != NULL; child = child->sibling)
{
struct type *type;
- long value;
+ LONGEST value;
gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
struct value *v;
return read_indirect_string_at_offset (abfd, str_offset);
}
-static unsigned long
+static ULONGEST
read_unsigned_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{
- unsigned long result;
+ ULONGEST result;
unsigned int num_read;
int i, shift;
unsigned char byte;
byte = bfd_get_8 (abfd, buf);
buf++;
num_read++;
- result |= ((unsigned long)(byte & 127) << shift);
+ result |= ((ULONGEST) (byte & 127) << shift);
if ((byte & 128) == 0)
{
break;
return result;
}
-static long
+static LONGEST
read_signed_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{
- long result;
+ LONGEST result;
int i, shift, num_read;
unsigned char byte;
byte = bfd_get_8 (abfd, buf);
buf++;
num_read++;
- result |= ((long)(byte & 127) << shift);
+ result |= ((LONGEST) (byte & 127) << shift);
shift += 7;
if ((byte & 128) == 0)
{
}
}
if ((shift < 8 * sizeof (result)) && (byte & 0x40))
- result |= -(((long)1) << shift);
+ result |= -(((LONGEST) 1) << shift);
*bytes_read_ptr = num_read;
return result;
}
static gdb_byte *
dwarf2_const_value_data (struct attribute *attr, struct type *type,
const char *name, struct obstack *obstack,
- struct dwarf2_cu *cu, long *value, int bits)
+ struct dwarf2_cu *cu, LONGEST *value, int bits)
{
struct objfile *objfile = cu->objfile;
enum bfd_endian byte_order = bfd_big_endian (objfile->obfd) ?
dwarf2_const_value_attr (struct attribute *attr, struct type *type,
const char *name, struct obstack *obstack,
struct dwarf2_cu *cu,
- long *value, gdb_byte **bytes,
+ LONGEST *value, gdb_byte **bytes,
struct dwarf2_locexpr_baton **baton)
{
struct objfile *objfile = cu->objfile;
{
struct objfile *objfile = cu->objfile;
struct comp_unit_head *cu_header = &cu->header;
- long value;
+ LONGEST value;
gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
switch (SYMBOL_CLASS (symbol))
{
case LOC_CONST:
- fprintf_filtered (outfile, "const %ld (0x%lx)",
- SYMBOL_VALUE (symbol),
- SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "const %s (%s)",
+ plongest (SYMBOL_VALUE (symbol)),
+ hex_string (SYMBOL_VALUE (symbol)));
break;
case LOC_CONST_BYTES:
case LOC_REGISTER:
if (SYMBOL_IS_ARGUMENT (symbol))
- fprintf_filtered (outfile, "parameter register %ld",
- SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "parameter register %s",
+ plongest (SYMBOL_VALUE (symbol)));
else
- fprintf_filtered (outfile, "register %ld", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "register %s",
+ plongest (SYMBOL_VALUE (symbol)));
break;
case LOC_ARG:
- fprintf_filtered (outfile, "arg at offset 0x%lx",
- SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "arg at offset %s",
+ hex_string (SYMBOL_VALUE (symbol)));
break;
case LOC_REF_ARG:
- fprintf_filtered (outfile, "reference arg at 0x%lx", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "reference arg at %s",
+ hex_string (SYMBOL_VALUE (symbol)));
break;
case LOC_REGPARM_ADDR:
- fprintf_filtered (outfile, "address parameter register %ld", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "address parameter register %s",
+ plongest (SYMBOL_VALUE (symbol)));
break;
case LOC_LOCAL:
- fprintf_filtered (outfile, "local at offset 0x%lx",
- SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "local at offset %s",
+ hex_string (SYMBOL_VALUE (symbol)));
break;
case LOC_TYPEDEF:
union
{
- /* The fact that this is a long not a LONGEST mainly limits the
- range of a LOC_CONST. Since LOC_CONST_BYTES exists, I'm not
- sure that is a big deal. */
- long ivalue;
+ LONGEST ivalue;
struct block *block;
{
if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST)
{
- error (_("constant `%s' (value %ld) "
+ error (_("constant `%s' (value %s) "
"will not be collected."),
SYMBOL_PRINT_NAME (exp->elts[2].symbol),
- SYMBOL_VALUE (exp->elts[2].symbol));
+ plongest (SYMBOL_VALUE (exp->elts[2].symbol)));
}
else if (SYMBOL_CLASS (exp->elts[2].symbol)
== LOC_OPTIMIZED_OUT)
SYMBOL_CLASS (sym));
break;
case LOC_CONST:
- printf_filtered ("constant %s (value %ld) will not be collected.\n",
- SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE (sym));
+ printf_filtered ("constant %s (value %s) will not be collected.\n",
+ SYMBOL_PRINT_NAME (sym), plongest (SYMBOL_VALUE (sym)));
break;
case LOC_STATIC:
offset = SYMBOL_VALUE_ADDRESS (sym);
count--; /* Don't count this one. */
continue;
case LOC_CONST:
- printf_filtered ("a constant with value %ld (0x%lx)",
- SYMBOL_VALUE (sym), SYMBOL_VALUE (sym));
+ printf_filtered ("a constant with value %s (%s)",
+ plongest (SYMBOL_VALUE (sym)),
+ hex_string (SYMBOL_VALUE (sym)));
break;
case LOC_CONST_BYTES:
printf_filtered ("constant bytes: ");
gdbarch_register_name (gdbarch, regno));
break;
case LOC_ARG:
- printf_filtered ("an argument at stack/frame offset %ld",
- SYMBOL_VALUE (sym));
+ printf_filtered ("an argument at stack/frame offset %s",
+ plongest (SYMBOL_VALUE (sym)));
break;
case LOC_LOCAL:
- printf_filtered ("a local variable at frame offset %ld",
- SYMBOL_VALUE (sym));
+ printf_filtered ("a local variable at frame offset %s",
+ plongest (SYMBOL_VALUE (sym)));
break;
case LOC_REF_ARG:
- printf_filtered ("a reference argument at offset %ld",
- SYMBOL_VALUE (sym));
+ printf_filtered ("a reference argument at offset %s",
+ plongest (SYMBOL_VALUE (sym)));
break;
case LOC_REGPARM_ADDR:
/* Note comment at LOC_REGISTER. */