winedbg: Add 'set' command to change data model.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-05-10 17:11:08 +02:00 committed by Alexandre Julliard
parent 96ecee3211
commit 6eb18ae692
3 changed files with 34 additions and 4 deletions

View File

@ -265,6 +265,7 @@ struct dbg_process
char source_current_file[MAX_PATH];
int source_start_line;
int source_end_line;
const struct data_model* data_model;
};
/* describes the way the debugger interacts with a given process */
@ -550,6 +551,9 @@ struct data_model
unsigned size;
const WCHAR* name;
};
extern const struct data_model ilp32_data_model[];
extern const struct data_model lp64_data_model[];
extern const struct data_model llp64_data_model[];
extern struct dbg_internal_var dbg_internal_vars[];

View File

@ -714,7 +714,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
return TRUE;
}
static const struct data_model ilp32_data_model[] = {
const struct data_model ilp32_data_model[] = {
{btVoid, 0, L"void"},
{btChar, 1, L"char"},
{btWChar, 2, L"wchar_t"},
@ -741,7 +741,7 @@ static const struct data_model ilp32_data_model[] = {
{0, 0, NULL}
};
static const struct data_model llp64_data_model[] = {
const struct data_model llp64_data_model[] = {
{btVoid, 0, L"void"},
{btChar, 1, L"char"},
{btWChar, 2, L"wchar_t"},
@ -770,7 +770,7 @@ static const struct data_model llp64_data_model[] = {
{0, 0, NULL}
};
static const struct data_model lp64_data_model[] = {
const struct data_model lp64_data_model[] = {
{btVoid, 0, L"void"},
{btChar, 1, L"char"},
{btWChar, 2, L"wchar_t"},
@ -803,7 +803,9 @@ static const struct data_model* get_data_model(DWORD modaddr)
{
const struct data_model *model;
if (ADDRSIZE == 4) model = ilp32_data_model;
if (dbg_curr_process->data_model)
model = dbg_curr_process->data_model;
else if (ADDRSIZE == 4) model = ilp32_data_model;
else
{
IMAGEHLP_MODULEW64 mi;

View File

@ -284,6 +284,7 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
p->source_current_file[0] = '\0';
p->source_start_line = -1;
p->source_end_line = -1;
p->data_model = NULL;
list_add_head(&dbg_process_list, &p->entry);
@ -467,6 +468,29 @@ void dbg_set_option(const char* option, const char* val)
return;
}
}
else if (!strcasecmp(option, "data_model"))
{
if (!dbg_curr_process)
{
dbg_printf("Not attached to a process\n");
return;
}
if (!val)
{
const char* model = "";
if (dbg_curr_process->data_model == NULL) model = "auto";
else if (dbg_curr_process->data_model == ilp32_data_model) model = "ilp32";
else if (dbg_curr_process->data_model == llp64_data_model) model = "llp64";
else if (dbg_curr_process->data_model == lp64_data_model) model = "lp64";
dbg_printf("Option: data_model %s\n", model);
}
else if (!strcasecmp(val, "auto")) dbg_curr_process->data_model = NULL;
else if (!strcasecmp(val, "ilp32")) dbg_curr_process->data_model = ilp32_data_model;
else if (!strcasecmp(val, "llp64")) dbg_curr_process->data_model = llp64_data_model;
else if (!strcasecmp(val, "lp64")) dbg_curr_process->data_model = lp64_data_model;
else
dbg_printf("Unknown data model %s\n", val);
}
else dbg_printf("Unknown option '%s'\n", option);
}