This is cumulative patch for bochs debugger, it is only very first step towards working debugger supporting all new simulator functionalitieS.

- move crc.cc from debugger to bochs folder and make it projct-wide and not local for debugger
 - added new 'info sse' command for debugger
 - extend 'modebp' command to break on any mode change
 - remove unimplemened 'info program' function, it is always printed fixed text
 - move debugger help to parser, cleanup and simplify it
This commit is contained in:
Stanislav Shwartsman 2006-01-24 19:03:55 +00:00
parent f27d342968
commit 18afa9fd2d
16 changed files with 1841 additions and 1444 deletions

View File

@ -146,6 +146,7 @@ NONINLINE_OBJS = \
pc_system.o \
osdep.o \
plugin.o \
crc.o \
@EXTRA_BX_OBJS@
EXTERN_ENVIRONMENT_OBJS = \
@ -248,7 +249,7 @@ $(BX_OBJS): $(BX_INCLUDES)
bxversion.h:
$(RM) -f bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' > bxversion.h
echo '// $$Id: Makefile.in,v 1.176 2006-01-08 17:16:30 vruppert Exp $$' >> bxversion.h
echo '// $$Id: Makefile.in,v 1.177 2006-01-24 19:03:53 sshwarts Exp $$' >> bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' >> bxversion.h
echo '// This file is generated by "make bxversion.h"' >> bxversion.h
echo "#define VER_STRING \"$(VER_STRING)\"" >> bxversion.h
@ -776,3 +777,4 @@ plugin.o: plugin.@CPP_SUFFIX@ bochs.h config.h osdep.h bx_debug/debug.h bxversio
iodev/pit82c54.h iodev/virt_timer.h iodev/serial.h iodev/sb16.h \
iodev/unmapped.h iodev/ne2k.h iodev/guest2host.h iodev/slowdown_timer.h \
iodev/extfpuirq.h iodev/gameport.h
crc.o: crc.@CPP_SUFFIX@ config.h

View File

@ -58,7 +58,6 @@ BX_OBJS = \
symbols.o \
cosim.o \
linux.o \
crc.o
BX_PARSER_OBJS = \
parser.o \
@ -120,13 +119,6 @@ lexer.c: lexer.l
###########################################
lexer.o: lexer.c debug.h ../config.h ../osdep.h
parser.o: parser.c debug.h ../config.h ../osdep.h
crc.o: crc.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h \
../bxversion.h ../gui/siminterface.h ../cpu/cpu.h ../cpu/lazy_flags.h \
../cpu/hostasm.h ../cpu/icache.h ../cpu/apic.h ../cpu/i387.h \
../fpu/softfloat.h ../fpu/tag_w.h ../fpu/status_w.h ../fpu/control_w.h \
../cpu/xmm.h ../memory/memory.h ../pc_system.h ../plugin.h \
../extplugin.h ../ltdl.h ../gui/gui.h ../gui/textconfig.h \
../gui/keymap.h ../instrument/stubs/instrument.h
dbg_main.o: dbg_main.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../bx_debug/debug.h ../bxversion.h ../gui/siminterface.h ../cpu/cpu.h \
../cpu/lazy_flags.h ../cpu/hostasm.h ../cpu/icache.h ../cpu/apic.h \

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.36 2006-01-23 21:44:44 sshwarts Exp $
// $Id: dbg_main.cc,v 1.37 2006-01-24 19:03:53 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -893,12 +893,12 @@ void bx_dbg_playback_command(char* path_quoted)
}
}
//toggles vm86 mode switch breakpoint
// toggles vm86 mode switch breakpoint
void bx_dbg_modebp_command()
{
BX_CPU(dbg_cpu)->debug_vm = BX_CPU(dbg_cpu)->getB_VM ();
BX_CPU(dbg_cpu)->dbg_cpu_mode = BX_CPU(dbg_cpu)->get_cpu_mode();
BX_CPU(dbg_cpu)->mode_break = !BX_CPU(dbg_cpu)->mode_break;
dbg_printf ("mode switch break %s\n",
dbg_printf (" mode switch break %s\n",
BX_CPU(dbg_cpu)->mode_break ? "enabled" : "disabled");
}
@ -993,6 +993,8 @@ unsigned int dbg_show_mask = 0;
// 0x40 print interrupts
// 0x20 print calls
extern const char* cpu_mode_string(unsigned cpu_mode);
//BW added. toggles show symbolic info (calls to begin with)
// 0x1 call
// 0x2 return
@ -1085,7 +1087,7 @@ void bx_dbg_show_command(char* arg)
return;
}
} else {
dbg_printf (" show mask is 0x%x\n", dbg_show_mask);
dbg_printf ("show mask is 0x%x\n", dbg_show_mask);
return;
}
@ -1288,6 +1290,7 @@ one_more:
// set stop flag if a guard found other than icount or halted
unsigned long found = BX_CPU(cpu)->guard_found.guard_found;
stop_reason_t reason = (stop_reason_t) BX_CPU(cpu)->stop_reason;
fprintf(stderr, "stop reason %d\n", (unsigned) reason);
if (found == BX_DBG_GUARD_ICOUNT) {
// I expected this guard, don't stop
} else if (found!=0) {
@ -1360,10 +1363,8 @@ void bx_dbg_stepN_command(bx_dbg_icount_t count)
bx_guard.guard_for |= BX_DBG_GUARD_ICOUNT; // looking for icount
bx_guard.guard_for |= BX_DBG_GUARD_CTRL_C; // or Ctrl-C
// for now, step each CPU one BX_DBG_DEFAULT_ICOUNT_QUANTUM at a time
//BX_INFO(("Stepping each CPU a total of %d cycles", count));
for (unsigned cycle=0; cycle < count; cycle++) {
for (unsigned cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) {
//BX_INFO(("Stepping %s", BX_CPU(cpu)->name));
bx_guard.icount = 1;
bx_guard.interrupt_requested = 0;
BX_CPU(cpu)->guard_found.guard_found = 0;
@ -1376,7 +1377,6 @@ void bx_dbg_stepN_command(bx_dbg_icount_t count)
BX_TICK1 ();
#endif
}
//BX_INFO(("Stepped each CPU a total of %d cycles", count));
#endif
BX_INSTR_DEBUG_PROMPT();
@ -1512,8 +1512,8 @@ for (sim=0; sim<BX_SMP_PROCESSORS; sim++) {
} else if (BX_CPU(sim)->stop_reason == STOP_TIME_BREAK_POINT) {
dbg_printf ("(%u) Caught time breakpoint\n", sim);
} else if (BX_CPU(sim)->stop_reason == STOP_MODE_BREAK_POINT) {
dbg_printf ("(%u) Caught vm mode switch breakpoint to %s mode\n",
sim, BX_CPU(sim)->get_VM () ? "virtual 86" : "protected");
dbg_printf ("(%u) Caught mode switch breakpoint switching to '%s'\n",
sim, cpu_mode_string(BX_CPU(sim)->get_cpu_mode()));
} else if (BX_CPU(sim)->stop_reason == STOP_READ_WATCH_POINT) {
dbg_printf ("(%u) Caught read watch point at %08X\n", sim, BX_CPU(sim)->watchpoint);
} else if (BX_CPU(sim)->stop_reason == STOP_WRITE_WATCH_POINT) {
@ -1887,7 +1887,7 @@ void bx_dbg_info_registers_command(int which_regs_mask)
BX_CPU(i)->dbg_get_cpu(&cpu);
#if BX_SUPPORT_SMP
dbg_printf ("%s:\n", BX_CPU(i)->name, i);
dbg_printf ("%s:\n", BX_CPU(i)->name);
#endif
reg = cpu.eax;
dbg_printf ("eax 0x%-8x\t%d\n", (unsigned) reg, (int) reg);
@ -1897,7 +1897,6 @@ void bx_dbg_info_registers_command(int which_regs_mask)
dbg_printf ("edx 0x%-8x\t%d\n", (unsigned) reg, (int) reg);
reg = cpu.ebx;
dbg_printf ("ebx 0x%-8x\t%d\n", (unsigned) reg, (int) reg);
reg = cpu.esp;
dbg_printf ("esp 0x%-8x\t%d\n", (unsigned) reg, (int) reg);
reg = cpu.ebp;
@ -1929,18 +1928,15 @@ void bx_dbg_info_registers_command(int which_regs_mask)
if (which_regs_mask & BX_INFO_FPU_REGS) {
BX_CPU(i)->print_state_FPU ();
}
#endif
#if BX_SUPPORT_SSE
if (which_regs_mask & BX_INFO_SSE_REGS) {
BX_CPU(i)->print_state_SSE ();
}
#endif
}
}
void bx_dbg_info_program_command(void)
{
dbg_printf (" Using the running image of child process -1.\n");
dbg_printf ("Program stopped at 0x0.\n");
dbg_printf ("It stopped at breakpoint 0.\n");
}
void bx_dbg_dump_cpu_command(void)
{
bx_dbg_cpu_t cpu;
@ -2703,7 +2699,7 @@ scanf_error:
void bx_dbg_disassemble_command(const char *format, bx_num_range range)
{
bx_bool paddr_valid;
Bit32u paddr/*, Base */;
Bit32u paddr;
unsigned ilen;
int numlines = INT_MAX;
@ -3154,7 +3150,7 @@ void bx_dbg_info_control_regs_command(void)
dbg_printf (" PCE=performance-monitor counter enable=%d\n", (cr4>>8) & 1);
dbg_printf (" OXFXSR=OS support for FXSAVE/FXRSTOR=%d\n", (cr4>>9) & 1);
dbg_printf (" OSXMMEXCPT=OS support for unmasked SIMD FP exceptions=%d\n", (cr4>>10) & 1);
#endif /* BX_CPU_LEVEL >= 4*/
#endif /* BX_CPU_LEVEL >= 4 */
#else
/* BX_CPU_LEVEL < 2 */
dbg_printf ("CR0-4 register do not exist in cpu level %d", BX_CPU_LEVEL);
@ -3360,8 +3356,7 @@ void bx_dbg_post_dma_reports(void)
// need to output the event header
dbg_printf ("event icount=%u DMA addr=0x%x size=%u op=%s val=0x%x",
(unsigned) bx_dbg_batch_dma.Q[i].icount,
addr, len, (what==BX_READ) ? "read" : "write",
val);
addr, len, (what==BX_READ) ? "read" : "write", val);
print_header = 0;
}
else {
@ -3377,8 +3372,6 @@ void bx_dbg_post_dma_reports(void)
bx_dbg_batch_dma.Qsize = 0;
}
extern const char* cpu_mode_string(unsigned cpu_mode);
int bx_dbg_symbolic_output(void)
{
// BW added. return non zero to cause a stop
@ -3669,302 +3662,22 @@ void bx_dbg_info_ivt_command(bx_num_range r)
dbg_printf("cpu in protected mode, use info idt\n");
}
void bx_dbg_help_command(char* command)
void bx_dbg_print_help(void)
{
char* p;
if (command == NULL)
{
dbg_printf("help - show list of debugger commands\n");
dbg_printf("help \'command\'- show short command description\n");
dbg_printf("help command - show short command description\n");
dbg_printf("-*- Debugger control -*-\n");
dbg_printf(" help, q|quit|exit, set, instrument, show, trace-on, trace-off,\n");
dbg_printf(" record, playback, load-symbols, slist\n");
dbg_printf(" trace-reg-on, trace-reg-off, record, playback,\n");
dbg_printf(" load-symbols, slist\n");
dbg_printf("-*- Execution control -*-\n");
dbg_printf(" c|cont, s|step|stepi, p|n|next, modebp\n");
dbg_printf(" c|cont|continue, s|step|stepi, p|n|next, modebp\n");
dbg_printf("-*- Breakpoint management -*-\n");
dbg_printf(" vb|vbreak, lb|lbreak, pb|pbreak|b|break, sb, sba, blist,\n");
dbg_printf(" bpe, bpd, d|del|delete\n");
dbg_printf("-*- CPU and memory contents -*-\n");
dbg_printf(" x, xp, u|disas|disassemble, r|reg|registers, setpmem, crc, info, dump_cpu,\n");
dbg_printf(" set_cpu, ptime, print-stack, watch, unwatch, ?|calc\n");
}
else
{
p = command;
for (; *p != 0 && *p != '\"' && *p != '\''; p++); p++;
for (; *p != 0 && *p != '\"' && *p != '\''; p++); *p = 0;
p = command;
for (; *p != 0 && *p != '\"' && *p != '\''; p++); p++;
dbg_printf("help %s\n", p);
if (strcmp(p, "help") == 0)
{
bx_dbg_help_command(NULL);
}
else
if ((strcmp(p, "quit") == 0) ||
(strcmp(p, "q") == 0))
{
dbg_printf("%s - quit debugger and execution\n", p);
}
else
if ((strcmp(p, "c") == 0) ||
(strcmp(p, "cont") == 0))
{
dbg_printf("%s - continue executing\n", p);
}
else
if ((strcmp(p, "stepi") == 0) ||
(strcmp(p, "step") == 0) ||
(strcmp(p, "s") == 0))
{
dbg_printf("%s [count] - execute count instructions, default is 1\n", p);
}
else
if ((strcmp(p, "next") == 0) ||
(strcmp(p, "n") == 0) ||
(strcmp(p, "p") == 0))
{
dbg_printf("%s - execute instructions, stepping over subroutines\n", p);
}
else
if ((strcmp(p, "vbreak") == 0) ||
(strcmp(p, "vb") == 0))
{
dbg_printf("%s seg:off - set a virtual address instruction breakpoint\n", p);
}
else
if ((strcmp(p, "lbreak") == 0) ||
(strcmp(p, "lb") == 0))
{
dbg_printf("%s addr - set a linear address instruction breakpoint\n", p);
}
else
if ((strcmp(p, "pbreak") == 0) ||
(strcmp(p, "break") == 0) ||
(strcmp(p, "pb") == 0) ||
(strcmp(p, "b") == 0))
{
dbg_printf("%s [*] addr - set a physical address instruction breakpoint\n", p);
}
else
if ((strcmp(p, "delete") == 0) ||
(strcmp(p, "del") == 0) ||
(strcmp(p, "d") == 0))
{
dbg_printf("%s n - delete a breakpoint\n", p);
}
else
if ((strcmp(p, "bpe") == 0))
{
dbg_printf("%s n - enable a breakpoint\n", p);
}
else
if ((strcmp(p, "bpd") == 0))
{
dbg_printf("%s n - disable a breakpoint\n", p);
}
else
if ((strcmp(p, "blist") == 0))
{
dbg_printf("%s - list all breakpoints (same as 'info break')\n", p);
}
else
if (strcmp(p, "xp") == 0)
{
dbg_printf("%s /nuf addr - examine memory at physical address\n", p);
goto nuf_help;
}
else
if (strcmp(p, "x") == 0)
{
dbg_printf("%s /nuf addr - examine memory at linear address\n", p);
nuf_help:
dbg_printf(" nuf is a sequence of numbers (how much values\n");
dbg_printf(" to display) and one or more of the [mxduotcsibhwg]\n");
dbg_printf(" format specificators:\n");
dbg_printf(" x,d,u,o,t,c,s,i select the format of the output (they stand for\n");
dbg_printf(" hex, decimal, unsigned, octal, binary, char, asciiz, instr)\n");
dbg_printf(" b,h,w,g select the size of a data element (for byte, half-word,\n");
dbg_printf(" word and giant word)\n");
dbg_printf(" m selects an alternative output format (memory dump)\n");
}
else
if ((strcmp(p, "r") == 0)||
(strcmp(p, "reg") == 0)||
(strcmp(p, "registers") == 0))
{
dbg_printf("%s = expression - set register value to expression\n", p);
}
else
if (strcmp(p, "setpmem") == 0)
{
dbg_printf("%s addr datasize val - set physical memory location of size datasize to value val\n", p);
}
else
if (strcmp(p, "crc") == 0)
{
dbg_printf("%s addr1 addr2 - show CRC for physical memory range addr1..addr2\n", p);
}
else
if (strcmp(p, "info") == 0)
{
dbg_printf("%s break - show information about current breakpoint status\n", p);
dbg_printf("%s dirty - show physical pages dirtied (written to) since last display\n", p);
dbg_printf("%s program - execution status of the program\n", p);
dbg_printf("%s r|reg|regs|registers - list of CPU integer registers and their contents\n", p);
dbg_printf("%s cpu - list of CPU registers and their contents\n", p);
dbg_printf("%s fpu - list of FPU registers and their contents\n", p);
dbg_printf("%s idt - show interrupt descriptor table\n", p);
dbg_printf("%s ivt - show interrupt vector table\n", p);
dbg_printf("%s gdt - show global descriptor table\n", p);
dbg_printf("%s tss - show current task state segment\n", p);
dbg_printf("%s cr - show CR0-4 registers\n", p);
dbg_printf("%s flags - show decoded EFLAGS register\n", p);
dbg_printf("%s symbols [string] - list symbols whose prefix is string\n", p);
dbg_printf("%s pic - show PICs registers\n", p);
dbg_printf("%s ne2000 - show NE2000 registers\n", p);
dbg_printf("%s vga - show vga registers\n", p);
}
else
if (strcmp(p, "set") == 0)
{
dbg_printf("%s $reg = val - change CPU register to value val\n", p);
dbg_printf("%s $disassemble_size = n - tell debugger what segment size [16|32] to use\n", p);
dbg_printf("when \"disassemble\" command is used. Default is 32\n");
dbg_printf("%s $auto_disassemble = n - cause debugger to disassemble current instruction\n", p);
dbg_printf("every time execution stops if n = 1. Default is 0\n");
}
else
if (strcmp(p, "dump_cpu") == 0)
{
dbg_printf("%s - dump complete cpu state\n", p);
}
else
if (strcmp(p, "set_cpu") == 0)
{
dbg_printf("%s - set complete cpu state\n", p);
}
else
if ((strcmp(p, "disassemble") == 0) ||
(strcmp(p, "disas") == 0) ||
(strcmp(p, "u") == 0))
{
dbg_printf("%s [/count] start end - disassemble instructions for given linear adress\n", p);
dbg_printf(" Optional 'count' is the number of disassembled instructions\n");
}
else
if (strcmp(p, "instrument") == 0)
{
dbg_printf("%s start - calls bx_instr_start()\n", p);
dbg_printf("%s stop - calls bx_instr_stop()\n", p);
dbg_printf("%s reset - calls bx_instr_reset()\n", p);
dbg_printf("%s print - calls bx_instr_print()\n", p);
}
else
if (strcmp(p, "trace-on") == 0)
{
dbg_printf("%s - disassemble every executed instruction\n", p);
}
else
if (strcmp(p, "trace-off") == 0)
{
dbg_printf("%s - disable tracing\n", p);
}
else
if (strcmp(p, "ptime") == 0)
{
dbg_printf("%s - print current time (number of ticks since start of simulation)\n", p);
}
else
if (strcmp(p, "sb") == 0)
{
dbg_printf("%s delta - insert a time breakpoint delta instruction into the future\n", p);
}
else
if (strcmp(p, "sba") == 0)
{
dbg_printf("%s time - insert a time breakpoint at time\n", p);
}
else
if (strcmp(p, "record") == 0)
{
dbg_printf("%s filename - record console input to file filename\n", p);
}
else
if (strcmp(p, "playback") == 0)
{
dbg_printf("%s filename - playbackconsole input from file filename\n", p);
}
else
if (strcmp(p, "print-stack") == 0)
{
dbg_printf("%s [num_words] - print the num_words top 16 bit words on the stack\n", p);
}
else
if (strcmp(p, "watch") == 0)
{
dbg_printf("%s - print current watch point status\n", p);
dbg_printf("%s stop - stop simulation when a watchpoint is encountred\n", p);
dbg_printf("%s continue - do not stop the simulation when watch point is encountred\n", p);
dbg_printf("%s read addr - insert a read watch point at physical address addr\n", p);
dbg_printf("%s write addr - insert a write watch point at physical address addr\n", p);
}
else
if (strcmp(p, "unwatch") == 0)
{
dbg_printf("%s - remove all watch points\n", p);
dbg_printf("%s read addr - remove a read watch point at physical address addr\n", p);
dbg_printf("%s write addr - remove a write watch point at physical address addr\n", p);
}
else
if (strcmp(p, "load-symbols") == 0)
{
dbg_printf("%s [global] filename [offset] - load symbols from file filename\n", p);
}
else
if ((strcmp(p, "slist") == 0))
{
dbg_printf("%s [string] - list symbols whose preffix is string (same as 'info symbols')\n", p);
}
else
if (strcmp(p, "modebp") == 0)
{
dbg_printf("%s - toggles vm86 mode switch breakpoint\n", p);
}
else
if (strcmp(p, "show") == 0)
{
dbg_printf("%s [string] - toggles show symbolic info (calls to begin with)\n", p);
dbg_printf("%s - shows current show mode\n", p);
dbg_printf("%s \"mode\" - show, when processor switch mode\n", p);
dbg_printf("%s \"int\" - show, when interrupt is happens\n", p);
dbg_printf("%s \"call\" - show, when call is happens\n", p);
dbg_printf("%s \"ret\" - show, when iret is happens\n", p);
dbg_printf("%s \"off\" - toggles off symbolic info\n", p);
dbg_printf("%s \"dbg-all\" - turn on all show flags\n", p);
dbg_printf("%s \"none\" - turn off all show flags\n", p);
dbg_printf("%s \"tab\" - show page tables\n", p);
}
else
if ((strcmp(p, "calc") == 0) ||
(strcmp(p, "?") == 0))
{
dbg_printf("%s expr - calculate a expression and display the result.\n", p);
dbg_printf(" 'expr' can reference any general-purpose and segment\n");
dbg_printf(" registers, use any arithmetic and logic operations, and\n");
dbg_printf(" also the special ':' operator which computes the linear\n");
dbg_printf(" address for a segment:offset (in real and v86 mode) or\n");
dbg_printf(" of a selector:offset (in protected mode) pair.\n");
}
else
{
dbg_printf("%s - unknow command, try help\n", p);
}
}
return;
dbg_printf(" x, xp, u|disasm|disassemble, r|reg|regs|registers, setpmem, crc, info,\n");
dbg_printf(" dump_cpu, set_cpu, ptime, print-stack, watch, unwatch, ?|calc\n");
}
void bx_dbg_calc_command(Bit64u value)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debug.h,v 1.8 2006-01-23 21:44:44 sshwarts Exp $
// $Id: debug.h,v 1.9 2006-01-24 19:03:53 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -47,7 +47,7 @@ void bx_dbg_loader(char *path, bx_loader_misc_t *misc_ptr);
extern Bit32u dbg_cpu;
unsigned long crc32(unsigned char *buf, int len);
Bit32u crc32(const Bit8u *buf, int len);
#if BX_DEBUGGER
@ -56,6 +56,8 @@ unsigned long crc32(unsigned char *buf, int len);
extern "C" {
#endif
void dbg_printf (const char *fmt, ...);
typedef enum
{
rAL, rBL, rCL, rDL,
@ -143,9 +145,9 @@ int bx_dbg_lbreakpoint_symbol_command(char *Symbol);
int bx_dbg_pbreakpoint_command(BreakpointKind bk, Bit32u paddress);
void bx_dbg_info_bpoints_command(void);
void bx_dbg_quit_command(void);
void bx_dbg_info_program_command(void);
#define BX_INFO_CPU_REGS 1 /* choices for bx_dbg_info_registers_command */
#define BX_INFO_CPU_REGS 1 /* bitmasks - choices for bx_dbg_info_registers_command */
#define BX_INFO_FPU_REGS 2
#define BX_INFO_SSE_REGS 4
void bx_dbg_info_registers_command(int);
void bx_dbg_info_dirty_command(void);
void bx_dbg_info_idt_command(bx_num_range);
@ -174,7 +176,7 @@ void bx_dbg_linux_syscall (void);
void bx_dbg_info_ne2k(int page, int reg);
void bx_dbg_info_pic(void);
void bx_dbg_info_vga(void);
void bx_dbg_help_command(char* command);
void bx_dbg_print_help(void);
void bx_dbg_calc_command(Bit64u value);
void bx_dbg_info_ivt_command(bx_num_range);
#ifdef __cplusplus
@ -231,8 +233,6 @@ void bx_dbg_exit(int code);
#define bx_dbg_extensions(command) 0
#endif
void dbg_printf (const char *fmt, ...);
//
// code for guards...
//
@ -434,7 +434,7 @@ typedef struct {
#if BX_USE_LOADER
void (*loader)(char *path, bx_loader_misc_t *misc_ptr);
#endif
bx_bool (*crc32)(unsigned long (*f)(unsigned char *buf, int len),
bx_bool (*crc32)(Bit32u (*f)(const Bit8u *buf, int len),
Bit32u addr1, Bit32u addr2, Bit32u *crc);
} bx_dbg_callback_t;
@ -464,7 +464,6 @@ void bx_dbg_set_INTR(bx_bool b);
void bx_dbg_disassemble_current (int which_cpu, int print_time);
int bx_dbg_symbolic_output(void); /* BW */
char* bx_dbg_symbolic_address(Bit32u context, Bit32u eip, Bit32u base);
char* bx_dbg_symbolic_address_16bit(Bit32u eip, Bit32u cs);
void bx_dbg_symbol_command(char* filename, bx_bool global, Bit32u offset);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%{
/////////////////////////////////////////////////////////////////////////
// $Id: lexer.l,v 1.6 2006-01-23 21:44:44 sshwarts Exp $
// $Id: lexer.l,v 1.7 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
@ -30,7 +30,8 @@ on { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ON); }
off { bxlval.sval = strdup(bxtext); return(BX_TOKEN_OFF); }
crc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CRC); }
c |
cont { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
cont |
continue { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
stepi |
step |
s { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STEPN); }
@ -47,7 +48,6 @@ b |
pb |
pbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PBREAKPOINT); }
info { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INFO); }
program { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PROGRAM); }
cr |
creg |
cregs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTROL_REGS); }
@ -56,6 +56,7 @@ reg |
regs |
registers { bxlval.sval = strdup(bxtext); return(BX_TOKEN_REGISTERS); }
fpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FPU); }
sse { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SSE); }
cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CPU); }
all { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALL); }
idt { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IDT); }
@ -85,7 +86,7 @@ irq { bxlval.sval = strdup(bxtext); return(BX_TOKEN_IRQ); }
pic { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PIC); }
set_cpu { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SET_CPU); }
u |
disas |
disasm |
disassemble { BEGIN(DISASM); bxlval.sval = strdup(bxtext); return(BX_TOKEN_DISASSEMBLE); }
instrument { bxlval.sval = strdup(bxtext); return(BX_TOKEN_INSTRUMENT); }
start { bxlval.sval = strdup(bxtext); return(BX_TOKEN_START); }
@ -111,7 +112,7 @@ read { bxlval.sval = strdup(bxtext); return(BX_TOKEN_READ); }
write { bxlval.sval = strdup(bxtext); return(BX_TOKEN_WRITE); }
continue { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
show { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SHOW); }
load-symbols { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOL); }
load-symbols { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LOAD_SYMBOLS); }
symbols { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOLS); }
slist { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LIST_SYMBOLS); }
global { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GLOBAL); }
@ -159,7 +160,7 @@ ss { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SS); }
ds { bxlval.sval = strdup(bxtext); return(BX_TOKEN_DS); }
fs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FS); }
gs { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GS); }
flags { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FLAGS); }
flags|eflags { bxlval.sval = strdup(bxtext); return(BX_TOKEN_FLAGS); }
force-check { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALWAYS_CHECK); }
help { bxlval.sval = strdup(bxtext); return(BX_TOKEN_HELP); }
\? |

File diff suppressed because it is too large Load Diff

View File

@ -70,10 +70,10 @@
BX_TOKEN_DISABLE_BREAKPOINT = 296,
BX_TOKEN_INFO = 297,
BX_TOKEN_QUIT = 298,
BX_TOKEN_PROGRAM = 299,
BX_TOKEN_REGISTERS = 300,
BX_TOKEN_CPU = 301,
BX_TOKEN_FPU = 302,
BX_TOKEN_REGISTERS = 299,
BX_TOKEN_CPU = 300,
BX_TOKEN_FPU = 301,
BX_TOKEN_SSE = 302,
BX_TOKEN_ALL = 303,
BX_TOKEN_IDT = 304,
BX_TOKEN_GDT = 305,
@ -121,7 +121,7 @@
BX_TOKEN_READ = 347,
BX_TOKEN_WRITE = 348,
BX_TOKEN_SHOW = 349,
BX_TOKEN_SYMBOL = 350,
BX_TOKEN_LOAD_SYMBOLS = 350,
BX_TOKEN_SYMBOLS = 351,
BX_TOKEN_LIST_SYMBOLS = 352,
BX_TOKEN_GLOBAL = 353,
@ -199,10 +199,10 @@
#define BX_TOKEN_DISABLE_BREAKPOINT 296
#define BX_TOKEN_INFO 297
#define BX_TOKEN_QUIT 298
#define BX_TOKEN_PROGRAM 299
#define BX_TOKEN_REGISTERS 300
#define BX_TOKEN_CPU 301
#define BX_TOKEN_FPU 302
#define BX_TOKEN_REGISTERS 299
#define BX_TOKEN_CPU 300
#define BX_TOKEN_FPU 301
#define BX_TOKEN_SSE 302
#define BX_TOKEN_ALL 303
#define BX_TOKEN_IDT 304
#define BX_TOKEN_GDT 305
@ -250,7 +250,7 @@
#define BX_TOKEN_READ 347
#define BX_TOKEN_WRITE 348
#define BX_TOKEN_SHOW 349
#define BX_TOKEN_SYMBOL 350
#define BX_TOKEN_LOAD_SYMBOLS 350
#define BX_TOKEN_SYMBOLS 351
#define BX_TOKEN_LIST_SYMBOLS 352
#define BX_TOKEN_GLOBAL 353

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parser.y,v 1.4 2006-01-23 21:44:44 sshwarts Exp $
// $Id: parser.y,v 1.5 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
%{
@ -71,10 +71,10 @@
%token <sval> BX_TOKEN_DISABLE_BREAKPOINT
%token <sval> BX_TOKEN_INFO
%token <sval> BX_TOKEN_QUIT
%token <sval> BX_TOKEN_PROGRAM
%token <sval> BX_TOKEN_REGISTERS
%token <sval> BX_TOKEN_CPU
%token <sval> BX_TOKEN_FPU
%token <sval> BX_TOKEN_SSE
%token <sval> BX_TOKEN_ALL
%token <sval> BX_TOKEN_IDT
%token <sval> BX_TOKEN_GDT
@ -122,7 +122,7 @@
%token <sval> BX_TOKEN_READ
%token <sval> BX_TOKEN_WRITE
%token <sval> BX_TOKEN_SHOW
%token <sval> BX_TOKEN_SYMBOL
%token <sval> BX_TOKEN_LOAD_SYMBOLS
%token <sval> BX_TOKEN_SYMBOLS
%token <sval> BX_TOKEN_LIST_SYMBOLS
%token <sval> BX_TOKEN_GLOBAL
@ -411,17 +411,17 @@ watch_point_command:
;
symbol_command:
BX_TOKEN_SYMBOL BX_TOKEN_STRING '\n'
BX_TOKEN_LOAD_SYMBOLS BX_TOKEN_STRING '\n'
{
bx_dbg_symbol_command($2, 0, 0);
free($1); free($2);
}
| BX_TOKEN_SYMBOL BX_TOKEN_STRING BX_TOKEN_NUMERIC '\n'
| BX_TOKEN_LOAD_SYMBOLS BX_TOKEN_STRING BX_TOKEN_NUMERIC '\n'
{
bx_dbg_symbol_command($2, 0, $3);
free($1); free($2);
}
| BX_TOKEN_SYMBOL BX_TOKEN_GLOBAL BX_TOKEN_STRING BX_TOKEN_NUMERIC '\n'
| BX_TOKEN_LOAD_SYMBOLS BX_TOKEN_GLOBAL BX_TOKEN_STRING BX_TOKEN_NUMERIC '\n'
{
bx_dbg_symbol_command($3, 1, $4);
free($1); free($2); free($3);
@ -566,11 +566,6 @@ info_command:
bx_dbg_dump_cpu_command();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_PROGRAM '\n'
{
bx_dbg_info_program_command();
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_REGISTERS '\n'
{
bx_dbg_info_registers_command(BX_INFO_CPU_REGS);
@ -581,9 +576,14 @@ info_command:
bx_dbg_info_registers_command(BX_INFO_FPU_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_SSE '\n'
{
bx_dbg_info_registers_command(BX_INFO_SSE_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_ALL '\n'
{
bx_dbg_info_registers_command(BX_INFO_CPU_REGS | BX_INFO_FPU_REGS);
bx_dbg_info_registers_command(BX_INFO_CPU_REGS | BX_INFO_FPU_REGS | BX_INFO_SSE_REGS);
free($1); free($2);
}
| BX_TOKEN_INFO BX_TOKEN_DIRTY '\n'
@ -892,14 +892,256 @@ trace_reg_off_command:
;
help_command:
BX_TOKEN_HELP BX_TOKEN_STRING '\n'
BX_TOKEN_HELP BX_TOKEN_QUIT '\n'
{
bx_dbg_help_command($2);
dbg_printf("q|quit|exit - quit debugger and emulator execution\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_CONTINUE '\n'
{
dbg_printf("c|cont|continue - continue executing\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_STEPN '\n'
{
dbg_printf("s|step|stepi [count] - execute #count instructions (default is 1 instruction)\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_STEP_OVER '\n'
{
dbg_printf("n|next|p - execute instruction stepping over subroutines\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_VBREAKPOINT '\n'
{
dbg_printf("vb|vbreak <seg:offset> - set a virtual address instruction breakpoint\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_LBREAKPOINT '\n'
{
dbg_printf("p|pb|break|pbreak <addr> - set a physical address instruction breakpoint\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_DEL_BREAKPOINT '\n'
{
dbg_printf("d|del|delete <n> - delete a breakpoint\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_ENABLE_BREAKPOINT '\n'
{
dbg_printf("bpe <n> - enable a breakpoint\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_DISABLE_BREAKPOINT '\n'
{
dbg_printf("bpd <n> - disable a breakpoint\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_LIST_BREAK '\n'
{
dbg_printf("blist - list all breakpoints (same as 'info break')\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_MODEBP '\n'
{
dbg_printf("modebp - toggles mode switch breakpoint\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_CRC '\n'
{
dbg_printf("crc <addr1> <addr2> - show CRC32 for physical memory range addr1..addr2\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_TRACEON '\n'
{
dbg_printf("trace-on - disassemble every executed instruction\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_TRACEOFF '\n'
{
dbg_printf("trace-off - disable instruction tracing\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_TRACEREGON '\n'
{
dbg_printf("trace-reg-on - print all registers every executed instruction\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_TRACEREGOFF '\n'
{
dbg_printf("trace-reg-off - disable registers state tracing\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_DUMP_CPU '\n'
{
dbg_printf("dump_cpu - dump complete cpu state\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_SET_CPU '\n'
{
dbg_printf("set_cpu - set complete cpu state\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_PTIME '\n'
{
dbg_printf("ptime - print current time (number of ticks since start of simulation)\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_TIMEBP '\n'
{
dbg_printf("sb <delta> - insert a time breakpoint delta instructions into the future\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_TIMEBP_ABSOLUTE '\n'
{
dbg_printf("sba <time> - insert breakpoint at specific time\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_PRINT_STACK '\n'
{
dbg_printf("print-stack [num_words] - print the num_words top 16 bit words on the stack\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_RECORD '\n'
{
dbg_printf("record <filename> - record console input to file filename\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_PLAYBACK '\n'
{
dbg_printf("playback <filename> - playback console input from file filename\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_LOAD_SYMBOLS '\n'
{
dbg_printf("load-symbols [global] <filename> [offset] - load symbols from file\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_LIST_SYMBOLS '\n'
{
dbg_printf("slist [string] - list symbols whose preffix is string (same as 'info symbols')\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_REGISTERS '\n'
{
dbg_printf("r|reg|regs|registers $reg = <expr> - set register value to expression\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_SETPMEM '\n'
{
dbg_printf("setpmem <addr> <datasize> <val> - set physical memory location of size 'datasize' to value 'val'\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_DISASSEMBLE '\n'
{
dbg_printf("u|disasm|disassemble [/count] <start> <end> - disassemble instructions for given linear address\n");
dbg_printf(" Optional 'count' is the number of disassembled instructions\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_WATCH '\n'
{
dbg_printf("watch - print current watch point status\n");
dbg_printf("watch stop - stop simulation when a watchpoint is encountred\n");
dbg_printf("watch continue - do not stop the simulation when watch point is encountred\n");
dbg_printf("watch read addr - insert a read watch point at physical address addr\n");
dbg_printf("watch write addr - insert a write watch point at physical address addr\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_UNWATCH '\n'
{
dbg_printf("unwatch - remove all watch points\n");
dbg_printf("unwatch read addr - remove a read watch point at physical address addr\n");
dbg_printf("unwatch write addr - remove a write watch point at physical address addr\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_EXAMINE '\n'
{
dbg_printf("x /nuf <addr> - examine memory at linear address\n");
dbg_printf("xp /nuf <addr> - examine memory at physical address\n");
dbg_printf(" nuf is a sequence of numbers (how much values to display)\n");
dbg_printf(" and one or more of the [mxduotcsibhwg] format specificators:\n");
dbg_printf(" x,d,u,o,t,c,s,i select the format of the output (they stand for\n");
dbg_printf(" hex, decimal, unsigned, octal, binary, char, asciiz, instr)\n");
dbg_printf(" b,h,w,g select the size of a data element (for byte, half-word,\n");
dbg_printf(" word and giant word)\n");
dbg_printf(" m selects an alternative output format (memory dump)\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_INSTRUMENT '\n'
{
dbg_printf("instrument start - calls bx_instr_start() callback\n");
dbg_printf("instrument stop - calls bx_instr_stop() callback\n");
dbg_printf("instrument reset - calls bx_instr_reset() callback\n");
dbg_printf("instrument print - calls bx_instr_print() callback\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_SET '\n'
{
dbg_printf("set $reg = val - change CPU register to value val\n");
dbg_printf("set $disassemble_size = n - tell debugger what segment size [16|32|64] to use\n");
dbg_printf(" when \"disassemble\" command is used. Default is 32\n");
dbg_printf("set $auto_disassemble = n - cause debugger to disassemble current instruction\n");
dbg_printf(" every time execution stops if n = 1. Default is 0\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_INFO '\n'
{
dbg_printf("info break - show information about current breakpoint status\n");
dbg_printf("info dirty - show physical pages dirtied (written to) since last display\n");
dbg_printf("info r|reg|regs|registers - list of CPU integer registers and their contents\n");
dbg_printf("info cpu - list of CPU registers and their contents\n");
dbg_printf("info fpu - list of FPU registers and their contents\n");
dbg_printf("info sse - list of SSE registers and their contents\n");
dbg_printf("info idt - show interrupt descriptor table\n");
dbg_printf("info ivt - show interrupt vector table\n");
dbg_printf("info gdt - show global descriptor table\n");
dbg_printf("info tss - show current task state segment\n");
dbg_printf("info cr - show CR0-4 registers\n");
dbg_printf("info eflags - show decoded EFLAGS register\n");
dbg_printf("info symbols [string] - list symbols whose prefix is string\n");
dbg_printf("info pic - show PICs registers\n");
dbg_printf("info ne2000 - show NE2000 registers\n");
dbg_printf("info vga - show vga registers\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_SHOW '\n'
{
dbg_printf("show \"string\" - toggles show symbolic info (calls to begin with)\n");
dbg_printf("show - shows current show mode\n");
dbg_printf("show \"mode\" - show, when processor switch mode\n");
dbg_printf("show \"int\" - show, when interrupt is happens\n");
dbg_printf("show \"call\" - show, when call is happens\n");
dbg_printf("show \"ret\" - show, when iret is happens\n");
dbg_printf("show \"off\" - toggles off symbolic info\n");
dbg_printf("show \"dbg-all\" - turn on all show flags\n");
dbg_printf("show \"none\" - turn off all show flags\n");
dbg_printf("show \"tab\" - show page tables\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_CALC '\n'
{
dbg_printf("calc|? <expr> - calculate a expression and display the result.\n");
dbg_printf(" 'expr' can reference any general-purpose and segment\n");
dbg_printf(" registers, use any arithmetic and logic operations, and\n");
dbg_printf(" also the special ':' operator which computes the linear\n");
dbg_printf(" address for a segment:offset (in real and v86 mode) or\n");
dbg_printf(" of a selector:offset (in protected mode) pair.\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_HELP '\n'
{
bx_dbg_print_help();
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_STRING '\n'
{
dbg_printf("unknown command '%s', help is not available\n", $2);
bx_dbg_print_help();
free($1);free($2);
}
| BX_TOKEN_HELP '\n'
{
bx_dbg_help_command(0);
bx_dbg_print_help();
free($1);
}
;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.123 2006-01-19 18:32:39 sshwarts Exp $
// $Id: cpu.cc,v 1.124 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -187,6 +187,7 @@ void BX_CPU_C::cpu_loop(Bit32s max_instr_count)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b,
Is64BitMode()))
{
fprintf(stderr, "back to debugger !!!\n");
return;
}
}
@ -888,23 +889,26 @@ bx_bool BX_CPU_C::dbg_is_begin_instr_bpoint(Bit16u cs, bx_address eip, bx_addres
BX_CPU_THIS_PTR guard_found.is_32bit_code = is_32;
BX_CPU_THIS_PTR guard_found.is_64bit_code = is_64;
// BW mode switch breakpoint
// mode switch breakpoint
// instruction which generate exceptions never reach the end of the
// loop due to a long jump. Thats why we check at start of instr.
// Downside is that we show the instruction about to be executed
// (not the one generating the mode switch).
if (BX_CPU_THIS_PTR mode_break &&
(BX_CPU_THIS_PTR debug_vm != BX_CPU_THIS_PTR getB_VM ())) {
BX_INFO(("Caught vm mode switch breakpoint"));
BX_CPU_THIS_PTR debug_vm = BX_CPU_THIS_PTR getB_VM ();
(BX_CPU_THIS_PTR dbg_cpu_mode != BX_CPU_THIS_PTR get_cpu_mode()))
{
BX_INFO(("[" FMT_LL "d] Caught mode switch breakpoint, switching from '%s' to '%s'",
bx_pc_system.time_ticks(), cpu_mode_string(BX_CPU_THIS_PTR dbg_cpu_mode),
cpu_mode_string(BX_CPU_THIS_PTR get_cpu_mode())));
BX_CPU_THIS_PTR dbg_cpu_mode = BX_CPU_THIS_PTR get_cpu_mode();
BX_CPU_THIS_PTR stop_reason = STOP_MODE_BREAK_POINT;
return 1;
return(1);
}
if( (BX_CPU_THIS_PTR show_flag) & (dbg_show_mask)) {
int rv;
if((rv = bx_dbg_symbolic_output()))
return rv;
return(rv);
}
// see if debugger is looking for iaddr breakpoint of any type

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.254 2006-01-21 12:06:03 sshwarts Exp $
// $Id: cpu.h,v 1.255 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -335,6 +335,8 @@
#define BX_MODE_LONG_COMPAT 0x3 // EFER.LMA = 1, CR0.PE=1, CS.L=0
#define BX_MODE_LONG_64 0x4 // EFER.LMA = 1, CR0.PE=1, CS.L=1
const char* cpu_mode_string(unsigned cpu_mode);
#define BX_CANONICAL_BITS (48)
#if BX_SUPPORT_X86_64
@ -1190,10 +1192,10 @@ public: // for now...
#endif
Bit8u stop_reason;
Bit8u trace_reg;
Bit8u mode_break; /* BW */
bx_bool debug_vm; /* BW contains current mode*/
bx_address show_eip; /* BW record eip at special instr f.ex eip */
Bit8u show_flag; /* BW shows instr class executed */
Bit8u mode_break;
bx_bool dbg_cpu_mode; /* contains current mode */
bx_address show_eip; /* record eip at special instr f.ex eip */
Bit8u show_flag; /* shows instr class executed */
bx_guard_found_t guard_found;
#endif
Bit8u trace;
@ -2915,6 +2917,7 @@ public: // for now...
#if BX_SUPPORT_SSE
BX_SMF void prepareSSE(void);
BX_SMF void check_exceptionsSSE(int);
BX_SMF void print_state_SSE(void);
#endif
#if BX_SUPPORT_FPU

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.80 2006-01-21 12:06:03 sshwarts Exp $
// $Id: init.cc,v 1.81 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -822,6 +822,7 @@ void BX_CPU_C::reset(unsigned source)
#endif
BX_CPU_THIS_PTR stop_reason = STOP_NO_REASON;
BX_CPU_THIS_PTR trace_reg = 0;
BX_CPU_THIS_PTR dbg_cpu_mode = BX_CPU_THIS_PTR cpu_mode;
#endif
BX_CPU_THIS_PTR trace = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_move.cc,v 1.46 2005-09-24 16:56:20 sshwarts Exp $
// $Id: sse_move.cc,v 1.47 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -43,6 +43,16 @@ void BX_CPU_C::prepareSSE(void)
#define BX_MXCSR_REGISTER (BX_CPU_THIS_PTR mxcsr.mxcsr)
void BX_CPU_C::print_state_SSE(void)
{
fprintf(stderr, "MXCSR: %08x\n", BX_MXCSR_REGISTER);
for(unsigned i=0;i<BX_XMM_REGISTERS;i++) {
BxPackedXmmRegister xmm = BX_READ_XMM_REG(i);
fprintf(stderr, "XMM%02u: %08x%08x:%08x%08x\n", i,
xmm.xmm32u(3), xmm.xmm32u(2), xmm.xmm32u(1), xmm.xmm32u(0));
}
}
#endif
/* ************************************ */

49
bochs/bx_debug/crc.cc → bochs/crc.cc Normal file → Executable file
View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: crc.cc,v 1.1 2003-11-28 15:07:25 danielg4 Exp $
// $Id: crc.cc,v 1.1 2006-01-24 19:03:53 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// I grabbed these CRC routines from the following source:
@ -9,8 +9,8 @@
// They are not covered by the license, as they are not my doing.
// My gratitude to the author for offering them on the 'net.
//
// I only changed the u_long to unsigned long, and u_char to unsigned char,
// and gave the functions prototypes.
// I only changed the u_long to Bit32u, and u_char to Bit8u, and gave
// the functions prototypes.
//
// -Kevin
//
@ -26,42 +26,22 @@
// of several of the popular FDDI "MAC" chips.
// **************************************************************************
#include "config.h"
#include "bochs.h"
#if BX_DEBUGGER
unsigned long crc32_table[256];
/* Initialized first time "crc32()" is called. If you prefer, you can
* statically initialize it at compile time. [Another exercise.]
*/
unsigned long crc32(unsigned char *buf, int len);
static void init_crc32(void);
unsigned long crc32(unsigned char *buf, int len)
{
unsigned char *p;
unsigned long crc;
if (!crc32_table[1]) /* if not already done, */
init_crc32(); /* build table */
crc = 0xffffffff; /* preload shift register, per CRC-32 spec */
for (p = buf; len > 0; ++p, --len)
crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
return ~crc; /* transmit complement, per CRC-32 spec */
}
static Bit32u crc32_table[256];
/*
* Build auxiliary table for parallel byte-at-a-time CRC-32.
*/
#define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
void
init_crc32(void)
static void init_crc32(void)
{
int i, j;
unsigned long c;
Bit32u c;
for (i = 0; i < 256; ++i) {
for (c = i << 24, j = 8; j > 0; --j)
@ -69,4 +49,17 @@ init_crc32(void)
crc32_table[i] = c;
}
}
#endif /* if BX_DEBUGGER */
Bit32u crc32(const Bit8u *buf, int len)
{
const Bit8u *p;
Bit32u crc;
if (!crc32_table[1]) /* if not already done, */
init_crc32(); /* build table */
crc = 0xffffffff; /* preload shift register, per CRC-32 spec */
for (p = buf; len > 0; ++p, --len)
crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
return ~crc; /* transmit complement, per CRC-32 spec */
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: memory.h,v 1.27 2006-01-15 19:35:39 sshwarts Exp $
// $Id: memory.h,v 1.28 2006-01-24 19:03:54 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -92,7 +92,7 @@ public:
BX_MEM_SMF bx_bool dbg_fetch_mem(Bit32u addr, unsigned len, Bit8u *buf);
BX_MEM_SMF bx_bool dbg_set_mem(Bit32u addr, unsigned len, Bit8u *buf);
BX_MEM_SMF bx_bool dbg_crc32(
unsigned long (*f)(unsigned char *buf, int len),
Bit32u (*f)(const Bit8u *buf, int len),
Bit32u addr1, Bit32u addr2, Bit32u *crc);
BX_MEM_SMF Bit8u* getHostMemAddr(BX_CPU_C *cpu, Bit32u a20Addr, unsigned op) BX_CPP_AttrRegparmN(3);
BX_MEM_SMF bx_bool registerMemoryHandlers(memory_handler_t read_handler, void *read_param,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: misc_mem.cc,v 1.73 2006-01-18 19:11:05 sshwarts Exp $
// $Id: misc_mem.cc,v 1.74 2006-01-24 19:03:55 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -93,7 +93,7 @@ void BX_MEM_C::init_memory(int memsize)
{
int idx;
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.73 2006-01-18 19:11:05 sshwarts Exp $"));
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.74 2006-01-24 19:03:55 sshwarts Exp $"));
// you can pass 0 if memory has been allocated already through
// the constructor, or the desired size of memory if it hasn't
// BX_INFO(("%.2fMB", (float)(BX_MEM_THIS megabytes) ));
@ -524,7 +524,7 @@ BX_MEM_C::dbg_set_mem(Bit32u addr, unsigned len, Bit8u *buf)
#endif
bx_bool
BX_MEM_C::dbg_crc32(unsigned long (*f)(unsigned char *buf, int len),
BX_MEM_C::dbg_crc32(Bit32u (*f)(const Bit8u *buf, int len),
Bit32u addr1, Bit32u addr2, Bit32u *crc)
{
*crc = 0;