1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-10-31 23:29:26 +01:00

[dwarf] The sword() function in Gexpr.c doesn't do what's intended.

Yes, it casts to signed, but then converts right back to
unsigned via the return type.  Fixed thus.

Signed-off-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
This commit is contained in:
Arun Sharma 2006-07-26 22:12:10 -06:00 committed by David Mosberger-Tang
parent cdb96f333c
commit 11ea1275bd
5 changed files with 5 additions and 12 deletions

View file

@ -45,6 +45,7 @@ extern "C" {
#define UNW_TDEP_CURSOR_LEN 511 #define UNW_TDEP_CURSOR_LEN 511
typedef uint32_t unw_word_t; typedef uint32_t unw_word_t;
typedef int32_t unw_sword_t;
typedef union typedef union
{ {

View file

@ -67,6 +67,7 @@ extern "C" {
#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT) #define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT)
typedef uint64_t unw_word_t; typedef uint64_t unw_word_t;
typedef int64_t unw_sword_t;
/* On IA-64, we want to access the contents of floating-point /* On IA-64, we want to access the contents of floating-point
registers as a pair of "words", but to ensure 16-byte alignment, we registers as a pair of "words", but to ensure 16-byte alignment, we

View file

@ -46,6 +46,7 @@ extern "C" {
#define UNW_TDEP_CURSOR_LEN 127 #define UNW_TDEP_CURSOR_LEN 127
typedef uint32_t unw_word_t; typedef uint32_t unw_word_t;
typedef int32_t unw_sword_t;
typedef long double unw_tdep_fpreg_t; typedef long double unw_tdep_fpreg_t;

View file

@ -48,6 +48,7 @@ extern "C" {
#define UNW_TDEP_CURSOR_LEN 127 #define UNW_TDEP_CURSOR_LEN 127
typedef uint64_t unw_word_t; typedef uint64_t unw_word_t;
typedef int64_t unw_sword_t;
typedef long double unw_tdep_fpreg_t; typedef long double unw_tdep_fpreg_t;

View file

@ -106,18 +106,7 @@ static uint8_t operands[256] =
[DW_OP_call_ref] = OPND1 (OFFSET) [DW_OP_call_ref] = OPND1 (OFFSET)
}; };
static inline unw_word_t #define sword(X) ((unw_sword_t) (X))
sword (unw_word_t val)
{
switch (sizeof (unw_word_t))
{
case 1: return (int8_t) val;
case 2: return (int16_t) val;
case 4: return (int32_t) val;
case 8: return (int64_t) val;
default: abort ();
}
}
static inline unw_word_t static inline unw_word_t
read_operand (unw_addr_space_t as, unw_accessors_t *a, read_operand (unw_addr_space_t as, unw_accessors_t *a,