Module: wine Branch: refs/heads/master Commit: 298198c3182bf8803d1246a80f54c3eb432cfccb URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=298198c3182bf8803d1246a8...
Author: Eric Pouech eric.pouech@wanadoo.fr Date: Sun Jun 18 21:32:06 2006 +0200
dbghelp: Dwarf & udt members.
- correctly set size & offsets for regular udt members - first shot at bitfields for udt members
---
dlls/dbghelp/dwarf.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 6618513..347ab3e 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -61,7 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_dwarf * o Debug{Start|End}Point * o CFA * - Udt - * o proper types loading (addresses, bitfield, nesting) + * o proper types loading (nesting) */
#if 0 @@ -817,6 +817,8 @@ static void dwarf2_parse_udt_member(dwar union attribute name; union attribute loc; unsigned long offset = 0; + union attribute bit_size; + union attribute bit_offset;
assert(parent);
@@ -830,8 +832,23 @@ static void dwarf2_parse_udt_member(dwar offset = dwarf2_compute_location(ctx, loc.block, NULL); TRACE("found offset:%lu\n", offset); } - - symt_add_udt_element(ctx->module, parent, name.string, elt_type, offset, 0); + if (!dwarf2_find_attribute(di, DW_AT_bit_size, &bit_size)) bit_size.uvalue = 0; + if (dwarf2_find_attribute(di, DW_AT_bit_offset, &bit_offset)) + { + /* FIXME: we should only do this when implementation is LSB (which is + * the case on i386 processors) + */ + union attribute nbytes; + if (!dwarf2_find_attribute(di, DW_AT_byte_size, &nbytes)) + { + DWORD64 size; + nbytes.uvalue = symt_get_info(elt_type, TI_GET_LENGTH, &size) ? (unsigned long)size : 0; + } + bit_offset.uvalue = nbytes.uvalue * 8 - bit_offset.uvalue - bit_size.uvalue; + } + else bit_offset.uvalue = 0; + symt_add_udt_element(ctx->module, parent, name.string, elt_type, + (offset << 3) + bit_offset.uvalue, bit_size.uvalue);
if (di->abbrev->have_child) FIXME("Unsupported children\n"); }