--- mon/src/mon.cpp 2004/02/12 16:42:35 1.23 +++ mon/src/mon.cpp 2010/02/21 11:58:33 1.28 @@ -1,7 +1,7 @@ /* * mon.cpp - cxmon main program * - * cxmon (C) 1997-2003 Christian Bauer, Marc Hellwig + * cxmon (C) Christian Bauer, Marc Hellwig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -258,8 +258,6 @@ void mon_write_word(uintptr adr, uint32 static void read_line(char *prompt) { #ifdef HAVE_LIBREADLINE - static char *line_read = NULL; - if (input) free(input); input = readline(prompt); @@ -277,7 +275,7 @@ static void read_line(char *prompt) in_ptr = input; #else -#define INPUT_LENGTH 256 + static const unsigned INPUT_LENGTH = 256; if (!input) input = (char *)malloc(INPUT_LENGTH); fprintf(monout, prompt); @@ -815,7 +813,7 @@ static void set_var() else { var_map::const_iterator v = vars.begin(), end = vars.end(); for (v=vars.begin(); v!=end; ++v) - fprintf(monout, "%s = %08x\n", v->first.c_str(), v->second); + fprintf(monout, "%s = %08lx\n", v->first.c_str(), v->second); } } else if (mon_token == T_NAME) { @@ -1052,6 +1050,8 @@ void mon_init() mon_add_command("d86", disassemble_80x86_32, "d86 [start [end]] Disassemble 80x86 (32-bit) code\n"); mon_add_command("d8086", disassemble_80x86_16, "d8086 [start [end]] Disassemble 80x86 (16-bit) code\n"); mon_add_command("d8664", disassemble_x86_64, "d8664 [start [end]] Disassemble x86-64 code\n"); + mon_add_command("dm", disassemble_mips, "dm [start [end]] Disassemble MIPS code\n"); + mon_add_command("dmel", disassemble_mipsel, "dmel [start [end]] Disassemble MIPS (little-endian) code\n"); mon_add_command(":", modify, ": start string Modify memory\n"); mon_add_command("f", fill, "f start end string Fill memory\n"); mon_add_command("y", apply_byte, "y[b|h|w] start end expr Apply expression to memory\n"); @@ -1114,7 +1114,7 @@ void mon_exit() * Main function, read-execute loop */ -void mon(int argc, char **argv) +void mon(int argc, const char **argv) { bool done = false, interactive = true; @@ -1189,7 +1189,7 @@ void mon(int argc, char **argv) while (!done) { if (interactive) { char prompt[16]; - sprintf(prompt, "[%0*lx]-> ", 2 * sizeof(mon_dot_address), mon_dot_address); + sprintf(prompt, "[%0*lx]-> ", int(2 * sizeof(mon_dot_address)), mon_dot_address); read_line(prompt); if (!input) { done = true;