winedbg: Show dwarf version(s) used for a module.

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-15 10:38:40 +02:00 committed by Alexandre Julliard
parent f7377e5e65
commit 0646e15665
2 changed files with 21 additions and 2 deletions

View File

@ -182,6 +182,7 @@ typedef struct dwarf2_parse_module_context_s
const struct elf_thunk_area*thunks;
struct symt* symt_cache[sc_num]; /* void, unknown */
struct vector unit_contexts;
DWORD cu_versions;
} dwarf2_parse_module_context_t;
enum unit_status
@ -2517,6 +2518,8 @@ static BOOL dwarf2_parse_compilation_unit_head(dwarf2_parse_context_t* ctx,
TRACE("- word_size: %u\n", ctx->head.word_size);
TRACE("- offset_size: %u\n", ctx->head.offset_size);
if (ctx->head.version >= 2)
ctx->module_ctx->cu_versions |= 1 << (ctx->head.version - 2);
if (max_supported_dwarf_version == 0)
{
char* env = getenv("DBGHELP_DWARF_VERSION");
@ -3732,6 +3735,7 @@ BOOL dwarf2_parse(struct module* module, ULONG_PTR load_offset,
module_ctx.symt_cache[sc_void] = &symt_new_basic(module_ctx.module, btVoid, "void", 0)->symt;
module_ctx.symt_cache[sc_unknown] = &symt_new_basic(module_ctx.module, btNoType, "# unknown", 0)->symt;
vector_init(&module_ctx.unit_contexts, sizeof(dwarf2_parse_context_t), 16);
module_ctx.cu_versions = 0;
/* phase I: parse all CU heads */
mod_ctx.data = section[section_debug].address;
@ -3749,7 +3753,11 @@ BOOL dwarf2_parse(struct module* module, ULONG_PTR load_offset,
dwarf2_parse_compilation_unit((dwarf2_parse_context_t*)vector_at(&module_ctx.unit_contexts, i));
dwarf2_modfmt->module->module.SymType = SymDia;
dwarf2_modfmt->module->module.CVSig = 'D' | ('W' << 8) | ('A' << 16) | ('R' << 24);
/* hide dwarf versions in CVSig
* bits 24-31 will be set according to found dwarf version
* different CU can have different dwarf version, so use a bit per version (version 2 => b24)
*/
dwarf2_modfmt->module->module.CVSig = 'D' | ('W' << 8) | ('F' << 16) | ((module_ctx.cu_versions & 0xFF) << 24);
/* FIXME: we could have a finer grain here */
dwarf2_modfmt->module->module.GlobalSymbols = TRUE;
dwarf2_modfmt->module->module.TypeInfo = TRUE;

View File

@ -137,10 +137,21 @@ static const char* get_symtype_str(const IMAGEHLP_MODULE64* mi)
case 'S' | ('T' << 8) | ('A' << 16) | ('B' << 24):
return "Stabs";
case 'D' | ('W' << 8) | ('A' << 16) | ('R' << 24):
/* previous versions of dbghelp used to report this... */
return "Dwarf";
default:
if ((mi->CVSig & 0x00FFFFFF) == ('D' | ('W' << 8) | ('F' << 16)))
{
static char tmp[64];
DWORD versbit = mi->CVSig >> 24;
strcpy(tmp, "Dwarf");
if (versbit & 1) strcat(tmp, "-2");
if (versbit & 2) strcat(tmp, "-3");
if (versbit & 4) strcat(tmp, "-4");
if (versbit & 8) strcat(tmp, "-5");
return tmp;
}
return "DIA";
}
}
}