dbghelp: Mostly get rid of symt_cache in dwarf debug information.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-09-02 11:22:32 +02:00 committed by Alexandre Julliard
parent c9b0483689
commit e08b80a752
1 changed files with 3 additions and 28 deletions

View File

@ -164,10 +164,7 @@ typedef struct dwarf2_traverse_context_s
/* symt_cache indexes */ /* symt_cache indexes */
#define sc_void 0 #define sc_void 0
#define sc_int1 1 #define sc_num 1
#define sc_int2 2
#define sc_int4 3
#define sc_num 4
typedef struct dwarf2_parse_context_s typedef struct dwarf2_parse_context_s
{ {
@ -181,7 +178,7 @@ typedef struct dwarf2_parse_context_s
struct sparse_array debug_info_table; struct sparse_array debug_info_table;
ULONG_PTR load_offset; ULONG_PTR load_offset;
ULONG_PTR ref_offset; ULONG_PTR ref_offset;
struct symt* symt_cache[sc_num]; /* void, int1, int2, int4 */ struct symt* symt_cache[sc_num]; /* void */
char* cpp_name; char* cpp_name;
} dwarf2_parse_context_t; } dwarf2_parse_context_t;
@ -1166,7 +1163,6 @@ static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx,
struct attribute size; struct attribute size;
struct attribute encoding; struct attribute encoding;
enum BasicType bt; enum BasicType bt;
int cache_idx = -1;
if (di->symt) return di->symt; if (di->symt) return di->symt;
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di)); TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
@ -1190,24 +1186,6 @@ static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx,
default: bt = btNoType; break; default: bt = btNoType; break;
} }
di->symt = &symt_new_basic(ctx->module, bt, name.u.string, size.u.uvalue)->symt; di->symt = &symt_new_basic(ctx->module, bt, name.u.string, size.u.uvalue)->symt;
switch (bt)
{
case btVoid:
assert(size.u.uvalue == 0);
cache_idx = sc_void;
break;
case btInt:
switch (size.u.uvalue)
{
case 1: cache_idx = sc_int1; break;
case 2: cache_idx = sc_int2; break;
case 4: cache_idx = sc_int4; break;
}
break;
default: break;
}
if (cache_idx != -1 && !ctx->symt_cache[cache_idx])
ctx->symt_cache[cache_idx] = di->symt;
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n"); if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
return di->symt; return di->symt;
@ -1269,7 +1247,7 @@ static struct symt* dwarf2_parse_array_type(dwarf2_parse_context_t* ctx,
{ {
/* fake an array with unknown size */ /* fake an array with unknown size */
/* FIXME: int4 even on 64bit machines??? */ /* FIXME: int4 even on 64bit machines??? */
idx_type = ctx->symt_cache[sc_int4]; idx_type = &symt_new_basic(ctx->module, btInt, "int", 4)->symt;
min.u.uvalue = 0; min.u.uvalue = 0;
cnt.u.uvalue = 0; cnt.u.uvalue = 0;
} }
@ -1347,9 +1325,6 @@ static struct symt* dwarf2_parse_unspecified_type(dwarf2_parse_context_t* ctx,
basic = symt_new_basic(ctx->module, btVoid, name.u.string, size.u.uvalue); basic = symt_new_basic(ctx->module, btVoid, name.u.string, size.u.uvalue);
di->symt = &basic->symt; di->symt = &basic->symt;
if (!ctx->symt_cache[sc_void])
ctx->symt_cache[sc_void] = di->symt;
if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n"); if (dwarf2_get_di_children(ctx, di)) FIXME("Unsupported children\n");
return di->symt; return di->symt;
} }