Commit 3f7f290b authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed a few regressions in the handling of segmented addresses.

parent 7b261656
...@@ -204,8 +204,8 @@ set_command: ...@@ -204,8 +204,8 @@ set_command:
; ;
x_command: x_command:
tEXAM expr_rvalue { memory_examine((void*)$2, 1, 'x'); } tEXAM expr_lvalue { memory_examine(&$2, 1, 'x'); }
| tEXAM tFORMAT expr_rvalue { memory_examine((void*)$3, $2 >> 8, $2 & 0xff); } | tEXAM tFORMAT expr_lvalue { memory_examine(&$3, $2 >> 8, $2 & 0xff); }
; ;
print_command: print_command:
...@@ -249,7 +249,7 @@ info_command: ...@@ -249,7 +249,7 @@ info_command:
| tINFO tSHARE { info_win32_module(0); } | tINFO tSHARE { info_win32_module(0); }
| tINFO tSHARE expr_rvalue { info_win32_module($3); } | tINFO tSHARE expr_rvalue { info_win32_module($3); }
| tINFO tREGS { be_cpu->print_context(dbg_curr_thread->handle, &dbg_context); } | 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 tSEGMENTS { info_win32_segments(0, -1); }
| tINFO tSTACK { stack_info(); } | tINFO tSTACK { stack_info(); }
| tINFO tSYMBOL tSTRING { symbol_info($3); } | tINFO tSYMBOL tSTRING { symbol_info($3); }
......
...@@ -306,7 +306,7 @@ extern void info_wine_dbg_channel(BOOL add, const char* chnl, const ...@@ -306,7 +306,7 @@ extern void info_wine_dbg_channel(BOOL add, const char* chnl, const
/* memory.c */ /* memory.c */
extern BOOL memory_read_value(const struct dbg_lvalue* lvalue, DWORD size, void* result); 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 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_report_invalid_addr(const void* addr);
extern void* memory_to_linear_addr(const ADDRESS* address); extern void* memory_to_linear_addr(const ADDRESS* address);
extern BOOL memory_get_current_pc(ADDRESS* address); extern BOOL memory_get_current_pc(ADDRESS* address);
......
...@@ -159,8 +159,7 @@ static void print_one_display(int i) ...@@ -159,8 +159,7 @@ static void print_one_display(int i)
dbg_printf("(disabled)\n"); dbg_printf("(disabled)\n");
else else
if (displaypoints[i].format == 'i') if (displaypoints[i].format == 'i')
memory_examine((void*)types_extract_as_integer(&lvalue), memory_examine(&lvalue, displaypoints[i].count, displaypoints[i].format);
displaypoints[i].count, displaypoints[i].format);
else else
print_value(&lvalue, displaypoints[i].format, 0); print_value(&lvalue, displaypoints[i].format, 0);
} }
......
...@@ -137,14 +137,24 @@ BOOL memory_write_value(const struct dbg_lvalue* lvalue, DWORD size, void* value ...@@ -137,14 +137,24 @@ BOOL memory_write_value(const struct dbg_lvalue* lvalue, DWORD size, void* value
* *
* Implementation of the 'x' command. * 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; int i;
char buffer[256]; char buffer[256];
ADDRESS addr; ADDRESS addr;
void *linear;
addr.Mode = AddrModeFlat; if (lvalue->type.id == dbg_itype_none)
addr.Offset = (unsigned long)linear; {
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) if (format != 'i' && count > 1)
{ {
......
...@@ -42,22 +42,26 @@ static IMAGEHLP_STACK_FRAME* frames = NULL; ...@@ -42,22 +42,26 @@ static IMAGEHLP_STACK_FRAME* frames = NULL;
*/ */
void stack_info(void) 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 */ /* FIXME: we assume stack grows the same way as on i386 */
if (!memory_get_current_stack(&addr)) if (!memory_get_current_stack(&lvalue.addr))
dbg_printf("Bad segment (%d)\n", addr.Segment); dbg_printf("Bad segment (%d)\n", lvalue.addr.Segment);
dbg_printf("Stack dump:\n"); dbg_printf("Stack dump:\n");
switch (addr.Mode) switch (lvalue.addr.Mode)
{ {
case AddrModeFlat: /* 32-bit mode */ case AddrModeFlat: /* 32-bit mode */
case AddrMode1632: /* 32-bit mode */ case AddrMode1632: /* 32-bit mode */
memory_examine(memory_to_linear_addr(&addr), 24, 'x'); memory_examine(&lvalue, 24, 'x');
break; break;
case AddrModeReal: /* 16-bit mode */ case AddrModeReal: /* 16-bit mode */
case AddrMode1616: case AddrMode1616:
memory_examine(memory_to_linear_addr(&addr), 24, 'w'); memory_examine(&lvalue, 24, 'w');
break; break;
} }
} }
......
...@@ -472,6 +472,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, DWORD code) ...@@ -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 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 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 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"); default: dbg_printf(" bad address");
} }
dbg_printf(".\n"); dbg_printf(".\n");
...@@ -496,7 +497,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, DWORD code) ...@@ -496,7 +497,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, DWORD code)
switch (addr.Mode) switch (addr.Mode)
{ {
case AddrMode1616: name = "16 bit"; break; 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 AddrModeReal: name = "vm86"; break;
case AddrModeFlat: name = "32 bit"; break; case AddrModeFlat: name = "32 bit"; break;
} }
......
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