summaryrefslogtreecommitdiff
path: root/src/format/dwarf/abbrev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/dwarf/abbrev.c')
-rw-r--r--src/format/dwarf/abbrev.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/format/dwarf/abbrev.c b/src/format/dwarf/abbrev.c
index a9fee2c..ba6cfb0 100644
--- a/src/format/dwarf/abbrev.c
+++ b/src/format/dwarf/abbrev.c
@@ -397,11 +397,13 @@ bool _read_dwarf_abbrev_attribute(dwarf_format *format, off_t *pos, DwarfForm fo
uint16_t *val16; /* Données sur 16 bits */
uint32_t *val32; /* Données sur 32 bits */
uint64_t *val64; /* Données sur 64 bits */
+ uint64_t *sval64; /* Données sur 64 bits (signée)*/
bool *boolval; /* Valeur booléenne */
uint8_t tmp8; /* Données sur 8 bits */
uint16_t tmp16; /* Données sur 16 bits */
uint32_t tmp32; /* Données sur 32 bits */
uint64_t tmp64; /* Données sur 64 bits */
+ uint64_t stmp64; /* Données sur 64 bits (signée)*/
uint64_t size_to_read; /* Nombre d'octets à lire */
off_t offset; /* Décallage dans une zone */
char **strval; /* Chaîne de caractères */
@@ -420,8 +422,7 @@ bool _read_dwarf_abbrev_attribute(dwarf_format *format, off_t *pos, DwarfForm fo
{
if (format->format == DWF_32_BITS)
{
- tmp32 = *((uint32_t *)&DBG_FORMAT(format)->content[*pos]);
- //memcpy(&tmp32, &DBG_FORMAT(format)->content[*pos], 4);
+ memcpy(&tmp32, &DBG_FORMAT(format)->content[*pos], 4);
*val64 = tmp32;
}
else memcpy(val64, &DBG_FORMAT(format)->content[*pos], 8);
@@ -571,13 +572,11 @@ bool _read_dwarf_abbrev_attribute(dwarf_format *format, off_t *pos, DwarfForm fo
break;
case DWF_SDATA:
- result = ((*pos + 4) <= DBG_FORMAT(format)->length);
-
- printf("bad\n"); exit(0);
-
+ sval64 = va_arg(ap, int64_t *);
+ if (sval64 == NULL) sval64 = &stmp64;
+ result = read_uleb128(format, pos, sval64, true);
break;
-
case DWF_STRP:
result = read_abbrev_offset(format, pos, &offset);
if (result)
@@ -594,19 +593,16 @@ bool _read_dwarf_abbrev_attribute(dwarf_format *format, off_t *pos, DwarfForm fo
}
break;
-
case DWF_UDATA:
- result = ((*pos + 4) <= DBG_FORMAT(format)->length);
-
- printf("bad\n"); exit(0);
-
+ val64 = va_arg(ap, uint64_t *);
+ if (val64 == NULL) val64 = &tmp64;
+ result = read_uleb128(format, pos, val64, true);
break;
-
case DWF_REF_ADDR:
result = ((*pos + 4) <= DBG_FORMAT(format)->length);
- printf("bad\n"); exit(0);
+ printf("bad at %d\n", __LINE__); exit(0);
break;
@@ -654,7 +650,7 @@ bool _read_dwarf_abbrev_attribute(dwarf_format *format, off_t *pos, DwarfForm fo
case DWF_REF_UDATA:
result = ((*pos + 4) <= DBG_FORMAT(format)->length);
- printf("bad\n"); exit(0);
+ printf("bad at %d\n", __LINE__); exit(0);
break;
@@ -662,7 +658,7 @@ bool _read_dwarf_abbrev_attribute(dwarf_format *format, off_t *pos, DwarfForm fo
case DWF_INDIRECT:
result = ((*pos + 4) <= DBG_FORMAT(format)->length);
- printf("bad\n"); exit(0);
+ printf("bad at %d\n", __LINE__); exit(0);
break;