Eric Pouech : dbghelp/dwarf: Correctly handle attributes according to 32bit or 64bit format.
Alexandre Julliard
julliard at winehq.org
Tue Sep 14 16:00:14 CDT 2021
Module: wine
Branch: master
Commit: 8241fe3877ce58e88e48043be08ae27fbd6e1b04
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8241fe3877ce58e88e48043be08ae27fbd6e1b04
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Sat Sep 11 10:58:59 2021 +0200
dbghelp/dwarf: Correctly handle attributes according to 32bit or 64bit format.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/dwarf.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 331739899d8..a29bd53f929 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -480,7 +480,7 @@ static void dwarf2_swallow_attribute(dwarf2_traverse_context_t* ctx,
switch (abbrev_attr->form)
{
case DW_FORM_flag_present: step = 0; break;
- case DW_FORM_ref_addr:
+ case DW_FORM_ref_addr: step = (head->version >= 3) ? head->offset_size : head->word_size; break;
case DW_FORM_addr: step = head->word_size; break;
case DW_FORM_flag:
case DW_FORM_data1:
@@ -488,8 +488,8 @@ static void dwarf2_swallow_attribute(dwarf2_traverse_context_t* ctx,
case DW_FORM_data2:
case DW_FORM_ref2: step = 2; break;
case DW_FORM_data4:
- case DW_FORM_ref4:
- case DW_FORM_strp: step = 4; break;
+ case DW_FORM_ref4: step = 4; break;
+ case DW_FORM_strp: step = head->offset_size; break;
case DW_FORM_data8:
case DW_FORM_ref8: step = 8; break;
case DW_FORM_sdata:
@@ -516,6 +516,13 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
switch (attr->form)
{
case DW_FORM_ref_addr:
+ if (ctx->head.version >= 3)
+ attr->u.uvalue = dwarf2_get_addr(data, ctx->head.offset_size);
+ else
+ attr->u.uvalue = dwarf2_get_addr(data, ctx->head.word_size);
+ TRACE("addr<0x%lx>\n", attr->u.uvalue);
+ break;
+
case DW_FORM_addr:
attr->u.uvalue = dwarf2_get_addr(data, ctx->head.word_size);
TRACE("addr<0x%lx>\n", attr->u.uvalue);
@@ -590,13 +597,11 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
break;
case DW_FORM_strp:
- {
- ULONG_PTR offset = dwarf2_get_u4(data);
- attr->u.string = (const char*)ctx->sections[section_string].address + offset;
- }
- TRACE("strp<%s>\n", debugstr_a(attr->u.string));
- break;
-
+ attr->u.string = (const char*)ctx->sections[section_string].address +
+ dwarf2_get_addr(data, ctx->head.offset_size);
+ TRACE("strp<%s>\n", debugstr_a(attr->u.string));
+ break;
+
case DW_FORM_block:
attr->u.block.size = dwarf2_get_leb128_as_unsigned(data, &attr->u.block.ptr);
TRACE("block<%p,%u>\n", attr->u.block.ptr, attr->u.block.size);
More information about the wine-cvs
mailing list