Fixed a few regressions in the handling of segmented addresses.

This commit is contained in:
Alexandre Julliard 2005-03-03 14:10:17 +00:00
parent 7b261656fd
commit 3f7f290b0b
6 changed files with 30 additions and 16 deletions

View File

@ -204,8 +204,8 @@ set_command:
;
x_command:
tEXAM expr_rvalue { memory_examine((void*)$2, 1, 'x'); }
| tEXAM tFORMAT expr_rvalue { memory_examine((void*)$3, $2 >> 8, $2 & 0xff); }
tEXAM expr_lvalue { memory_examine(&$2, 1, 'x'); }
| tEXAM tFORMAT expr_lvalue { memory_examine(&$3, $2 >> 8, $2 & 0xff); }
;
print_command:
@ -249,7 +249,7 @@ info_command:
| tINFO tSHARE { info_win32_module(0); }
| tINFO tSHARE expr_rvalue { info_win32_module($3); }
| tINFO tREGS { be_cpu->print_context(dbg_curr_thread->handle, &dbg_context); }
| tINFO tSEGMENTS expr_rvalue { info_win32_segments($3, 1); }
| tINFO tSEGMENTS expr_rvalue { info_win32_segments($3 >> 3, 1); }
| tINFO tSEGMENTS { info_win32_segments(0, -1); }
| tINFO tSTACK { stack_info(); }
| tINFO tSYMBOL tSTRING { symbol_info($3); }

View File

@ -306,7 +306,7 @@ extern void info_wine_dbg_channel(BOOL add, const char* chnl, const
/* memory.c */
extern BOOL memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result);
extern BOOL memory_write_value(const struct dbg_lvalue* val, DWORD size, void* value);
extern void memory_examine(void* linear, int count, char format);
extern void memory_examine(const struct dbg_lvalue *lvalue, int count, char format);
extern void memory_report_invalid_addr(const void* addr);
extern void* memory_to_linear_addr(const ADDRESS* address);
extern BOOL memory_get_current_pc(ADDRESS* address);

View File

@ -159,8 +159,7 @@ static void print_one_display(int i)
dbg_printf("(disabled)\n");
else
if (displaypoints[i].format == 'i')
memory_examine((void*)types_extract_as_integer(&lvalue),
displaypoints[i].count, displaypoints[i].format);
memory_examine(&lvalue, displaypoints[i].count, displaypoints[i].format);
else
print_value(&lvalue, displaypoints[i].format, 0);
}

View File

@ -137,14 +137,24 @@ BOOL memory_write_value(const struct dbg_lvalue* lvalue, DWORD size, void* value
*
* Implementation of the 'x' command.
*/
void memory_examine(void* linear, int count, char format)
void memory_examine(const struct dbg_lvalue *lvalue, int count, char format)
{
int i;
char buffer[256];
ADDRESS addr;
void *linear;
if (lvalue->type.id == dbg_itype_none)
{
addr = lvalue->addr;
linear = memory_to_linear_addr( &addr );
}
else
{
linear = types_extract_as_integer( lvalue );
addr.Mode = AddrModeFlat;
addr.Offset = (unsigned long)linear;
}
if (format != 'i' && count > 1)
{

View File

@ -42,22 +42,26 @@ static IMAGEHLP_STACK_FRAME* frames = NULL;
*/
void stack_info(void)
{
ADDRESS addr;
struct dbg_lvalue lvalue;
lvalue.cookie = 0;
lvalue.type.id = dbg_itype_none;
lvalue.type.module = 0;
/* FIXME: we assume stack grows the same way as on i386 */
if (!memory_get_current_stack(&addr))
dbg_printf("Bad segment (%d)\n", addr.Segment);
if (!memory_get_current_stack(&lvalue.addr))
dbg_printf("Bad segment (%d)\n", lvalue.addr.Segment);
dbg_printf("Stack dump:\n");
switch (addr.Mode)
switch (lvalue.addr.Mode)
{
case AddrModeFlat: /* 32-bit mode */
case AddrMode1632: /* 32-bit mode */
memory_examine(memory_to_linear_addr(&addr), 24, 'x');
memory_examine(&lvalue, 24, 'x');
break;
case AddrModeReal: /* 16-bit mode */
case AddrMode1616:
memory_examine(memory_to_linear_addr(&addr), 24, 'w');
memory_examine(&lvalue, 24, 'w');
break;
}
}

View File

@ -472,6 +472,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, DWORD code)
case AddrModeFlat: dbg_printf(" in 32-bit code (0x%08lx)", addr.Offset); break;
case AddrModeReal: dbg_printf(" in vm86 code (%04x:%04lx)", addr.Segment, addr.Offset); break;
case AddrMode1616: dbg_printf(" in 16-bit code (%04x:%04lx)", addr.Segment, addr.Offset); break;
case AddrMode1632: dbg_printf(" in 32-bit code (%04x:%08lx)", addr.Segment, addr.Offset); break;
default: dbg_printf(" bad address");
}
dbg_printf(".\n");
@ -496,7 +497,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, DWORD code)
switch (addr.Mode)
{
case AddrMode1616: name = "16 bit"; break;
case AddrMode1632: name = "X?X??X"; break;
case AddrMode1632: name = "32 bit"; break;
case AddrModeReal: name = "vm86"; break;
case AddrModeFlat: name = "32 bit"; break;
}