Eric Pouech : dbghelp: Dwarf2 & AT_byte_size.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 20 05:23:22 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 24743774e8fbe08a1742442e5fc39e63e098cc7c
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=24743774e8fbe08a1742442e5fc39e63e098cc7c

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Sun Jun 18 21:30:49 2006 +0200

dbghelp: Dwarf2 & AT_byte_size.

- AT_byte_size can be larger than a single byte (especially for enums)
- added missing enumeration type parsing

---

 dlls/dbghelp/dwarf.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 053f662..3ddefe1 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -2,6 +2,7 @@
  * File dwarf.c - read dwarf2 information from the ELF modules
  *
  * Copyright (C) 2005, Raphael Junqueira
+ * Copyright (C) 2006, Eric Pouech
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -489,6 +490,9 @@ typedef struct dwarf2_parse_context_s {
   unsigned char level;
 } dwarf2_parse_context_t;
 
+/* forward declarations */
+static struct symt_enum* dwarf2_parse_enumeration_type(struct module* module, dwarf2_abbrev_entry_t* entry, dwarf2_parse_context_t* ctx);
+
 static unsigned char dwarf2_parse_byte(dwarf2_parse_context_t* ctx)
 {
   unsigned char uvalue = *(const unsigned char*) ctx->data;
@@ -908,7 +912,7 @@ static struct symt_basic* dwarf2_parse_b
       TRACE("found name %s\n", name);
       break;
     case DW_AT_byte_size:
-      size = dwarf2_parse_byte(ctx);
+      size = dwarf2_parse_attr_as_data(attr, ctx);
       break;
     case DW_AT_encoding:
       encoding = dwarf2_parse_byte(ctx);
@@ -992,7 +996,7 @@ static struct symt_pointer* dwarf2_parse
   for (attr = entry->attrs; NULL != attr; attr = attr->next) {
     switch (attr->attribute) {
     case DW_AT_byte_size:
-      size = dwarf2_parse_byte(ctx);
+      size = dwarf2_parse_attr_as_data(attr, ctx);
       break;
     case DW_AT_type:
       {
@@ -1314,6 +1318,12 @@ static void dwarf2_parse_udt_members(str
       case DW_TAG_member:
 	dwarf2_parse_udt_member(module, entry, ctx, symt);
 	break;
+      case DW_TAG_enumeration_type:
+	{
+	  struct symt_enum* symt = dwarf2_parse_enumeration_type(module, entry, ctx);
+	  dwarf2_add_symt_ref(module, entry_ref, &symt->symt);
+	}
+	break;
       default:
 	{
 	  dwarf2_abbrev_entry_attr_t* attr;
@@ -1349,7 +1359,7 @@ static struct symt_udt* dwarf2_parse_cla
       TRACE("found name %s\n", name);
       break;
     case DW_AT_byte_size:
-      size = dwarf2_parse_byte(ctx);
+      size = dwarf2_parse_attr_as_data(attr, ctx);
       break;
     case DW_AT_decl_file:
     case DW_AT_decl_line:
@@ -1389,7 +1399,7 @@ static struct symt_udt* dwarf2_parse_str
       TRACE("found name %s\n", name);
       break;
     case DW_AT_byte_size:
-      size = dwarf2_parse_byte(ctx);
+      size = dwarf2_parse_attr_as_data(attr, ctx);
       break;
     case DW_AT_decl_file:
     case DW_AT_decl_line:
@@ -1429,7 +1439,7 @@ static struct symt_udt* dwarf2_parse_uni
       TRACE("found name %s\n", name);
       break;
     case DW_AT_byte_size:
-      size = dwarf2_parse_byte(ctx);
+      size = dwarf2_parse_attr_as_data(attr, ctx);
       break;
     case DW_AT_decl_file:
     case DW_AT_decl_line:




More information about the wine-cvs mailing list