dbghelp: dwarf debug info: a few more fixes to dwarf parsing.

This commit is contained in:
Eric Pouech 2010-08-25 21:43:46 +02:00 committed by Alexandre Julliard
parent 1bfd89986c
commit 1e0af22ad2
3 changed files with 21 additions and 1 deletions

View File

@ -132,6 +132,7 @@ enum location_error {loc_err_internal = -1, /* internal while computing */
loc_err_too_complex = -2, /* couldn't compute location (even at runtime) */ loc_err_too_complex = -2, /* couldn't compute location (even at runtime) */
loc_err_out_of_scope = -3, /* variable isn't available at current address */ loc_err_out_of_scope = -3, /* variable isn't available at current address */
loc_err_cant_read = -4, /* couldn't read memory at given address */ loc_err_cant_read = -4, /* couldn't read memory at given address */
loc_err_no_location = -5, /* likely optimized away (by compiler) */
}; };
struct location struct location

View File

@ -1511,6 +1511,22 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
di->symt = &symt_new_constant(subpgm->ctx->module, subpgm->compiland, di->symt = &symt_new_constant(subpgm->ctx->module, subpgm->compiland,
name.u.string, param_type, &v)->symt; name.u.string, param_type, &v)->symt;
} }
else
{
/* variable has been optimiezd away... report anyway */
loc.kind = loc_error;
loc.reg = loc_err_no_location;
if (subpgm->func)
{
symt_add_func_local(subpgm->ctx->module, subpgm->func,
is_pmt ? DataIsParam : DataIsLocal,
&loc, block, param_type, name.u.string);
}
else
{
WARN("dropping global variable %s which has been optimized away\n", name.u.string);
}
}
if (is_pmt && subpgm->func && subpgm->func->type) if (is_pmt && subpgm->func && subpgm->func->type)
symt_add_function_signature_parameter(subpgm->ctx->module, symt_add_function_signature_parameter(subpgm->ctx->module,
(struct symt_function_signature*)subpgm->func->type, (struct symt_function_signature*)subpgm->func->type,

View File

@ -676,7 +676,7 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len)
const struct dbg_internal_var* div; const struct dbg_internal_var* div;
/* negative register values are wine's dbghelp hacks /* negative register values are wine's dbghelp hacks
* see dlls/dbghelp/dbghelp_internal.h for the details * see dlls/dbghelp/dbghelp_private.h for the details
*/ */
switch (regno) switch (regno)
{ {
@ -692,6 +692,9 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len)
case -4: case -4:
if (buffer) snprintf(buffer, len, "<couldn't read memory>"); if (buffer) snprintf(buffer, len, "<couldn't read memory>");
return FALSE; return FALSE;
case -5:
if (buffer) snprintf(buffer, len, "<has been optimized away by compiler>");
return FALSE;
} }
for (div = be_cpu->context_vars; div->name; div++) for (div = be_cpu->context_vars; div->name; div++)