Commit 19f97c5f authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp/dwarf: Make use of AT_type if present when parsing an enumeration type.

parent 10a20b2d
...@@ -1835,8 +1835,9 @@ static void dwarf2_parse_enumerator(dwarf2_debug_info_t* di, ...@@ -1835,8 +1835,9 @@ static void dwarf2_parse_enumerator(dwarf2_debug_info_t* di,
static struct symt* dwarf2_parse_enumeration_type(dwarf2_debug_info_t* di) static struct symt* dwarf2_parse_enumeration_type(dwarf2_debug_info_t* di)
{ {
struct attribute name; struct attribute name;
struct attribute size; struct attribute attrtype;
struct symt_basic* basetype; dwarf2_debug_info_t*ditype;
struct symt* type;
struct vector* children; struct vector* children;
dwarf2_debug_info_t*child; dwarf2_debug_info_t*child;
unsigned int i; unsigned int i;
...@@ -1846,20 +1847,28 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_debug_info_t* di) ...@@ -1846,20 +1847,28 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_debug_info_t* di)
TRACE("%s\n", dwarf2_debug_di(di)); TRACE("%s\n", dwarf2_debug_di(di));
if (!dwarf2_find_attribute(di, DW_AT_name, &name)) name.u.string = NULL; if (!dwarf2_find_attribute(di, DW_AT_name, &name)) name.u.string = NULL;
if (!dwarf2_find_attribute(di, DW_AT_byte_size, &size)) size.u.uvalue = 4; if (dwarf2_find_attribute(di, DW_AT_type, &attrtype) && (ditype = dwarf2_jump_to_debug_info(&attrtype)) != NULL)
type = ditype->symt;
switch (size.u.uvalue) /* FIXME: that's wrong */ else /* no type found for this enumeration, construct it from size */
{ {
case 1: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "char", 1); break; struct attribute size;
case 2: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "short", 2); break; struct symt_basic* basetype;
default:
case 4: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "int", 4); break; if (!dwarf2_find_attribute(di, DW_AT_byte_size, &size)) size.u.uvalue = 4;
}
di->symt = &symt_new_enum(di->unit_ctx->module_ctx->module, name.u.string, &basetype->symt)->symt; switch (size.u.uvalue) /* FIXME: that's wrong */
{
case 1: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "char", 1); break;
case 2: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "short", 2); break;
default:
case 4: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "int", 4); break;
}
type = &basetype->symt;
}
di->symt = &symt_new_enum(di->unit_ctx->module_ctx->module, name.u.string, type)->symt;
children = dwarf2_get_di_children(di); children = dwarf2_get_di_children(di);
/* FIXME: should we use the sibling stuff ?? */
if (children) for (i = 0; i < vector_length(children); i++) if (children) for (i = 0; i < vector_length(children); i++)
{ {
child = *(dwarf2_debug_info_t**)vector_at(children, i); child = *(dwarf2_debug_info_t**)vector_at(children, i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment