summaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-08-01 04:06:27 +0000
committerDaniel Jacobowitz <drow@false.org>2005-08-01 04:06:27 +0000
commit77e0b926c11f74a3f7d4029dcdde8e5e722f0cae (patch)
tree2ac46260c5832bb5b252f1f236201271c2bde83f /gdb/dwarf2read.c
parent3ffbc0a50081df3ef17811030bad04db8c9bac98 (diff)
downloadbinutils-gdb-77e0b926c11f74a3f7d4029dcdde8e5e722f0cae.tar.gz
* dwarf2-frame.c (read_signed_leb128): Handle values that do not
fit in 32 bits. * dwarf2read.c (read_signed_leb128): Likewise.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index eb6cec91f61..ae85ef3554b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -6032,12 +6032,11 @@ static long
read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
{
long result;
- int i, shift, size, num_read;
+ int i, shift, num_read;
unsigned char byte;
result = 0;
shift = 0;
- size = 32;
num_read = 0;
i = 0;
while (1)
@@ -6052,10 +6051,8 @@ read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
break;
}
}
- if ((shift < size) && (byte & 0x40))
- {
- result |= -(1 << shift);
- }
+ if ((shift < 8 * sizeof (result)) && (byte & 0x40))
+ result |= -(((long)1) << shift);
*bytes_read_ptr = num_read;
return result;
}