winedbg: Added scoped symbol picker, and options to handle it.

This commit is contained in:
Eric Pouech 2008-11-10 15:03:10 +01:00 committed by Alexandre Julliard
parent 508414313e
commit 583e051044
3 changed files with 49 additions and 0 deletions

View File

@ -401,6 +401,8 @@ typedef enum sym_get_lval (*symbol_picker_t)(const char* name, const struct sgv_
extern symbol_picker_t symbol_current_picker;
extern enum sym_get_lval symbol_picker_interactive(const char* name, const struct sgv_data* sgv,
struct dbg_lvalue* rtn);
extern enum sym_get_lval symbol_picker_scoped(const char* name, const struct sgv_data* sgv,
struct dbg_lvalue* rtn);
/* tgt_active.c */
extern void dbg_run_debuggee(const char* args);

View File

@ -251,6 +251,38 @@ enum sym_get_lval symbol_picker_interactive(const char* name, const struct sgv_d
return sglv_found;
}
enum sym_get_lval symbol_picker_scoped(const char* name, const struct sgv_data* sgv,
struct dbg_lvalue* rtn)
{
unsigned i;
int local = -1;
for (i = 0; i < sgv->num; i++)
{
if (sgv->num - sgv->num_thunks > 1 && (sgv->syms[i].flags & SYMFLAG_THUNK) && !DBG_IVAR(AlwaysShowThunks))
continue;
if (sgv->syms[i].flags & SYMFLAG_LOCAL)
{
if (local == -1)
local = i;
else
{
/* FIXME: several locals with same name... which one to pick ?? */
dbg_printf("Several local variables/parameters for %s, aborting\n", name);
return sglv_aborted;
}
}
}
if (local != -1)
{
*rtn = sgv->syms[local].lvalue;
return sglv_found;
}
/* no locals found, multiple globals... abort for now */
dbg_printf("Several global variables for %s, aborting\n", name);
return sglv_aborted;
}
symbol_picker_t symbol_current_picker = symbol_picker_interactive;
/***********************************************************************

View File

@ -517,6 +517,21 @@ void dbg_set_option(const char* option, const char* val)
}
SymSetOptions(opt);
}
else if (!strcasecmp(option, "symbol_picker"))
{
if (!val)
dbg_printf("Option: symbol_picker %s\n",
symbol_current_picker == symbol_picker_interactive ? "interactive" : "scoped");
else if (!strcasecmp(val, "interactive"))
symbol_current_picker = symbol_picker_interactive;
else if (!strcasecmp(val, "scoped"))
symbol_current_picker = symbol_picker_scoped;
else
{
dbg_printf("Syntax: symbol_picker [interactive|scoped]\n");
return;
}
}
else dbg_printf("Unknown option '%s'\n", option);
}