diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index de6c8b3e438..ac13a28e3ca 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -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[]; diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index f4ee5a011d5..899e7f472b2 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -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; diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index d11b68ec432..8a5c9bc69ed 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -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); }