Properly respect a disassemble x,y command (prior behavior would do

y-x instructions, no matter how wide each instruction was).
This commit is contained in:
Jeremy White 2004-12-06 16:35:33 +00:00 committed by Alexandre Julliard
parent 627260f89e
commit 193c83f646
2 changed files with 9 additions and 4 deletions

View File

@ -314,7 +314,7 @@ extern BOOL memory_get_current_stack(ADDRESS* address);
extern BOOL memory_get_current_frame(ADDRESS* address);
extern BOOL memory_get_string(HANDLE hp, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size);
extern BOOL memory_get_string_indirect(HANDLE hp, void* addr, BOOL unicode, char* buffer, int size);
extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int offset);
extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count);
extern BOOL memory_disasm_one_insn(ADDRESS* addr);
extern void print_bare_address(const ADDRESS* addr);
extern void print_address(const ADDRESS* addr, BOOLEAN with_line);

View File

@ -598,9 +598,11 @@ BOOL memory_disasm_one_insn(ADDRESS* addr)
}
void memory_disassemble(const struct dbg_lvalue* xstart,
const struct dbg_lvalue* xend, int offset)
const struct dbg_lvalue* xend, int instruction_count)
{
static ADDRESS last = {0,0,0};
int stop = 0;
int i;
if (!xstart && !xend)
{
@ -613,7 +615,10 @@ void memory_disassemble(const struct dbg_lvalue* xstart,
last.Mode = AddrModeFlat;
last.Offset = types_extract_as_integer(xstart);
}
if (xend) offset = types_extract_as_integer(xend) - last.Offset + 1;
if (xend)
stop = types_extract_as_integer(xend);
}
while (offset-- > 0 && memory_disasm_one_insn(&last));
for (i = 0; (instruction_count == 0 || i < instruction_count) &&
(stop == 0 || last.Offset <= stop); i++)
memory_disasm_one_insn(&last);
}