Made variables optimized into registers accessible.

This commit is contained in:
Ove Kaaven 1998-12-07 12:09:55 +00:00 committed by Alexandre Julliard
parent f0bacceb89
commit eee1ddc809
1 changed files with 20 additions and 5 deletions

View File

@ -28,6 +28,14 @@ static char * reg_name[] =
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" "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 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. * 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 ) if( curr_func->local_vars[i].regno != 0 )
{ {
/* /*
* Register variable. We don't know how to treat * Register variable. Point to DEBUG_context field.
* this yet.
*/ */
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; addr->seg = 0;
@ -1323,9 +1335,12 @@ DEBUG_InfoLocals()
if( curr_func->local_vars[i].offset == 0 ) 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, 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 else
{ {