Commit 6eb18ae6 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

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

parent 96ecee32
...@@ -265,6 +265,7 @@ struct dbg_process ...@@ -265,6 +265,7 @@ struct dbg_process
char source_current_file[MAX_PATH]; char source_current_file[MAX_PATH];
int source_start_line; int source_start_line;
int source_end_line; int source_end_line;
const struct data_model* data_model;
}; };
/* describes the way the debugger interacts with a given process */ /* describes the way the debugger interacts with a given process */
...@@ -550,6 +551,9 @@ struct data_model ...@@ -550,6 +551,9 @@ struct data_model
unsigned size; unsigned size;
const WCHAR* name; 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[]; extern struct dbg_internal_var dbg_internal_vars[];
......
...@@ -714,7 +714,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details) ...@@ -714,7 +714,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details)
return TRUE; return TRUE;
} }
static const struct data_model ilp32_data_model[] = { const struct data_model ilp32_data_model[] = {
{btVoid, 0, L"void"}, {btVoid, 0, L"void"},
{btChar, 1, L"char"}, {btChar, 1, L"char"},
{btWChar, 2, L"wchar_t"}, {btWChar, 2, L"wchar_t"},
...@@ -741,7 +741,7 @@ static const struct data_model ilp32_data_model[] = { ...@@ -741,7 +741,7 @@ static const struct data_model ilp32_data_model[] = {
{0, 0, NULL} {0, 0, NULL}
}; };
static const struct data_model llp64_data_model[] = { const struct data_model llp64_data_model[] = {
{btVoid, 0, L"void"}, {btVoid, 0, L"void"},
{btChar, 1, L"char"}, {btChar, 1, L"char"},
{btWChar, 2, L"wchar_t"}, {btWChar, 2, L"wchar_t"},
...@@ -770,7 +770,7 @@ static const struct data_model llp64_data_model[] = { ...@@ -770,7 +770,7 @@ static const struct data_model llp64_data_model[] = {
{0, 0, NULL} {0, 0, NULL}
}; };
static const struct data_model lp64_data_model[] = { const struct data_model lp64_data_model[] = {
{btVoid, 0, L"void"}, {btVoid, 0, L"void"},
{btChar, 1, L"char"}, {btChar, 1, L"char"},
{btWChar, 2, L"wchar_t"}, {btWChar, 2, L"wchar_t"},
...@@ -803,7 +803,9 @@ static const struct data_model* get_data_model(DWORD modaddr) ...@@ -803,7 +803,9 @@ static const struct data_model* get_data_model(DWORD modaddr)
{ {
const struct data_model *model; 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 else
{ {
IMAGEHLP_MODULEW64 mi; IMAGEHLP_MODULEW64 mi;
......
...@@ -284,6 +284,7 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, ...@@ -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_current_file[0] = '\0';
p->source_start_line = -1; p->source_start_line = -1;
p->source_end_line = -1; p->source_end_line = -1;
p->data_model = NULL;
list_add_head(&dbg_process_list, &p->entry); list_add_head(&dbg_process_list, &p->entry);
...@@ -467,6 +468,29 @@ void dbg_set_option(const char* option, const char* val) ...@@ -467,6 +468,29 @@ void dbg_set_option(const char* option, const char* val)
return; 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); else dbg_printf("Unknown option '%s'\n", option);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment