From eee1ddc809fa3377105fe226d9af05647674e0b4 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Mon, 7 Dec 1998 12:09:55 +0000 Subject: [PATCH] Made variables optimized into registers accessible. --- debugger/hash.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/debugger/hash.c b/debugger/hash.c index 19f2a77cf0a..bdcf0f2d3ee 100644 --- a/debugger/hash.c +++ b/debugger/hash.c @@ -28,6 +28,14 @@ static char * reg_name[] = "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" }; +static unsigned reg_ofs[] = +{ + FIELD_OFFSET(CONTEXT, Eax), FIELD_OFFSET(CONTEXT, Ecx), + FIELD_OFFSET(CONTEXT, Edx), FIELD_OFFSET(CONTEXT, Ebx), + FIELD_OFFSET(CONTEXT, Esp), FIELD_OFFSET(CONTEXT, Ebp), + FIELD_OFFSET(CONTEXT, Esi), FIELD_OFFSET(CONTEXT, Edi) +}; + struct name_hash { @@ -1267,13 +1275,17 @@ BOOL32 DEBUG_GetStackSymbolValue( const char * name, DBG_ADDR *addr ) /* * OK, we found it. Now figure out what to do with this. */ + /* FIXME: what if regno == 0 ($eax) */ if( curr_func->local_vars[i].regno != 0 ) { /* - * Register variable. We don't know how to treat - * this yet. + * Register variable. Point to DEBUG_context field. */ - return FALSE; + addr->seg = 0; + addr->off = ((DWORD)&DEBUG_context) + reg_ofs[curr_func->local_vars[i].regno]; + addr->type = curr_func->local_vars[i].type; + + return TRUE; } addr->seg = 0; @@ -1323,9 +1335,12 @@ DEBUG_InfoLocals() if( curr_func->local_vars[i].offset == 0 ) { - fprintf(stderr, "%s:%s optimized into register $%s \n", + ptr = (unsigned int *) (((DWORD)&DEBUG_context) + + reg_ofs[curr_func->local_vars[i].regno]); + fprintf(stderr, "%s:%s (optimized into register $%s) == 0x%8.8x\n", curr_func->name, curr_func->local_vars[i].name, - reg_name[curr_func->local_vars[i].regno]); + reg_name[curr_func->local_vars[i].regno], + *ptr); } else {