1 |
|
/* |
2 |
|
* mon.cpp - cxmon main program |
3 |
|
* |
4 |
< |
* cxmon (C) 1997-2003 Christian Bauer, Marc Hellwig |
4 |
> |
* cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
258 |
|
static void read_line(char *prompt) |
259 |
|
{ |
260 |
|
#ifdef HAVE_LIBREADLINE |
261 |
– |
static char *line_read = NULL; |
262 |
– |
|
261 |
|
if (input) |
262 |
|
free(input); |
263 |
|
input = readline(prompt); |
275 |
|
|
276 |
|
in_ptr = input; |
277 |
|
#else |
278 |
< |
#define INPUT_LENGTH 256 |
278 |
> |
static const unsigned INPUT_LENGTH = 256; |
279 |
|
if (!input) |
280 |
|
input = (char *)malloc(INPUT_LENGTH); |
281 |
|
fprintf(monout, prompt); |
813 |
|
else { |
814 |
|
var_map::const_iterator v = vars.begin(), end = vars.end(); |
815 |
|
for (v=vars.begin(); v!=end; ++v) |
816 |
< |
fprintf(monout, "%s = %08x\n", v->first.c_str(), v->second); |
816 |
> |
fprintf(monout, "%s = %08lx\n", v->first.c_str(), v->second); |
817 |
|
} |
818 |
|
|
819 |
|
} else if (mon_token == T_NAME) { |
1050 |
|
mon_add_command("d86", disassemble_80x86_32, "d86 [start [end]] Disassemble 80x86 (32-bit) code\n"); |
1051 |
|
mon_add_command("d8086", disassemble_80x86_16, "d8086 [start [end]] Disassemble 80x86 (16-bit) code\n"); |
1052 |
|
mon_add_command("d8664", disassemble_x86_64, "d8664 [start [end]] Disassemble x86-64 code\n"); |
1053 |
+ |
mon_add_command("dm", disassemble_mips, "dm [start [end]] Disassemble MIPS code\n"); |
1054 |
+ |
mon_add_command("dmel", disassemble_mipsel, "dmel [start [end]] Disassemble MIPS (little-endian) code\n"); |
1055 |
|
mon_add_command(":", modify, ": start string Modify memory\n"); |
1056 |
|
mon_add_command("f", fill, "f start end string Fill memory\n"); |
1057 |
|
mon_add_command("y", apply_byte, "y[b|h|w] start end expr Apply expression to memory\n"); |
1189 |
|
while (!done) { |
1190 |
|
if (interactive) { |
1191 |
|
char prompt[16]; |
1192 |
< |
sprintf(prompt, "[%0*lx]-> ", 2 * sizeof(mon_dot_address), mon_dot_address); |
1192 |
> |
sprintf(prompt, "[%0*lx]-> ", int(2 * sizeof(mon_dot_address)), mon_dot_address); |
1193 |
|
read_line(prompt); |
1194 |
|
if (!input) { |
1195 |
|
done = true; |