/* Unaligned memory access functionality.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
+ Copyright (C) 2000-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
_v |= (uint64_t) (__b & 0x7f) << (nth * 7); \
if (likely ((__b & 0x80) == 0)) \
{ \
- var = (_v << (64 - (nth * 7) - 7) >> (64 - (nth * 7) - 7)); \
+ var = (_v << (64 - (nth * 7) - 7)) >> (64 - (nth * 7) - 7); \
break; \
} \
else do {} while (0)
{ \
get_sleb128_step (var, *addrp, i, return var); \
} \
- /* Other implementations set VALUE to INT_MAX in this \
- case. So we better do this as well. */ \
- return INT64_MAX; \
+ __b = *(*addrp)++; \
+ if (likely ((__b & 0x80) == 0)) \
+ return var | ((uint64_t) __b << 63); \
+ else \
+ /* Other implementations set VALUE to INT_MAX in this \
+ case. So we better do this as well. */ \
+ return INT64_MAX; \
} while (0)
#ifdef IS_LIBDW
const unsigned char **addrp)
internal_function attribute_hidden;
#else
-static uint64_t
+static inline uint64_t
__attribute__ ((unused))
__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp)
{
unsigned char __b;
get_uleb128_rest_return (acc, i, addrp);
}
-static int64_t
+static inline int64_t
__attribute__ ((unused))
__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp)
{
[DW_TAG_mutable_type] = "mutable_type",
[DW_TAG_condition] = "condition",
[DW_TAG_shared_type] = "shared_type",
+ [DW_TAG_type_unit] = "type_unit",
+ [DW_TAG_rvalue_reference_type] = "rvalue_reference_type",
+ [DW_TAG_template_alias] = "template_alias",
};
const unsigned int nknown_tags = (sizeof (known_tags)
/ sizeof (known_tags[0]));
case DW_OP_plus_uconst:
case DW_OP_constu:;
const unsigned char *start = data;
- unsigned int uleb;
+ uint64_t uleb;
get_uleb128 (uleb, data); /* XXX check overrun */
- printf ("%*s[%4" PRIuMAX "] %s %u\n",
+ printf ("%*s[%4" PRIuMAX "] %s %" PRIu64 "\n",
indent, "", (uintmax_t) offset, known[op], uleb);
len -= data - start;
offset += 1 + (data - start);
case DW_OP_bit_piece:
start = data;
- unsigned int uleb2;
+ uint64_t uleb2;
get_uleb128 (uleb, data); /* XXX check overrun */
get_uleb128 (uleb2, data); /* XXX check overrun */
- printf ("%*s[%4" PRIuMAX "] %s %u, %u\n",
+ printf ("%*s[%4" PRIuMAX "] %s %" PRIu64 ", %" PRIu64 "\n",
indent, "", (uintmax_t) offset, known[op], uleb, uleb2);
len -= data - start;
offset += 1 + (data - start);
case DW_OP_breg0 ... DW_OP_breg31:
case DW_OP_consts:
start = data;
- unsigned int sleb;
+ int64_t sleb;
get_sleb128 (sleb, data); /* XXX check overrun */
- printf ("%*s[%4" PRIuMAX "] %s %d\n",
+ printf ("%*s[%4" PRIuMAX "] %s %" PRId64 "\n",
indent, "", (uintmax_t) offset, known[op], sleb);
len -= data - start;
offset += 1 + (data - start);
start = data;
get_uleb128 (uleb, data); /* XXX check overrun */
get_sleb128 (sleb, data); /* XXX check overrun */
- printf ("%*s[%4" PRIuMAX "] %s %u %d\n",
+ printf ("%*s[%4" PRIuMAX "] %s %" PRIu64 " %" PRId64 "\n",
indent, "", (uintmax_t) offset, known[op], uleb, sleb);
len -= data - start;
offset += 1 + (data - start);
opcode & 0x3f, pc += (opcode & 0x3f) * code_align);
else if (opcode < DW_CFA_restore)
{
- unsigned int offset;
+ uint64_t offset;
// XXX overflow check
get_uleb128 (offset, readp);
- printf (" offset r%u (%s) at cfa%+d\n",
+ printf (" offset r%u (%s) at cfa%+" PRId64 "\n",
opcode & 0x3f, regname (opcode & 0x3f), offset * data_align);
}
else
" Version: %" PRIu16 ", Abbreviation section offset: %"
PRIu64 ", Address size: %" PRIu8 ", Offset size: %" PRIu8
"\n Type signature: %#" PRIx64
- ", Type offset: %" PRIu64 "\n"),
+ ", Type offset: %#" PRIx64 "\n"),
(uint64_t) offset, version, abbroffset, addrsize, offsize,
typesig, (uint64_t) typeoff);
else