updates for Bochs debugger

This commit is contained in:
Stanislav Shwartsman 2009-10-29 15:49:50 +00:00
parent 234770395d
commit 98b51805d5
13 changed files with 1953 additions and 1951 deletions

View File

@ -3,7 +3,8 @@ Changes for next bugfix+ release (coming soon):
- CPU and internal debugger
- VMX: Implemented TPR shadow VMEXIT
- Bugfixes for CPU emulation correctness (mostly for VMX support).
- Updates for Bochs internal debugger.
- Bugfixes and updates for Bochs internal debugger
- On SMP system stepN command now affects only current processor
- Memory
- Bugfixes for > 32-bit physical address space.
@ -33,6 +34,7 @@ Changes for next bugfix+ release (coming soon):
[2812948] PIT bug by Derek
- these S.F. bugs were closed/fixed
[2872244] BIOS writes not allowed value to MTRR MSR causing #GP
[2885383] SDL GUI memory leak
[2872290] compilation in AIX5.3 ML10 failes
[2867904] crash with cirrus bx_vga_c::mem_write

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.214 2009-10-15 21:24:22 sshwarts Exp $
// $Id: dbg_main.cc,v 1.215 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -935,7 +935,7 @@ void bx_dbg_info_registers_command(int which_regs_mask)
dbg_printf("rip: 0x%08x:%08x\n", GET32H(reg), GET32L(reg));
#endif
reg = BX_CPU(dbg_cpu)->read_eflags();
dbg_printf("eflags 0x%08x\n", (unsigned) reg);
dbg_printf("eflags 0x%08x: ", (unsigned) reg);
bx_dbg_info_flags();
}
@ -1715,8 +1715,13 @@ one_more:
goto one_more;
}
void bx_dbg_stepN_command(Bit32u count)
void bx_dbg_stepN_command(int cpu, Bit32u count)
{
if (cpu != -1 && cpu >= BX_SMP_PROCESSORS) {
dbg_printf("Error: stepN: unknown cpu=%d\n", cpu);
return;
}
if (count == 0) {
dbg_printf("Error: stepN: count=0\n");
return;
@ -1732,23 +1737,23 @@ void bx_dbg_stepN_command(Bit32u count)
BX_CPU(n)->guard_found.time_tick = bx_pc_system.time_ticks();
}
if (BX_SMP_PROCESSORS == 1) {
if (cpu >= 0 || BX_SUPPORT_SMP==0) {
bx_guard.interrupt_requested = 0;
BX_CPU(0)->guard_found.guard_found = 0;
BX_CPU(0)->cpu_loop(count);
BX_CPU(cpu)->guard_found.guard_found = 0;
BX_CPU(cpu)->cpu_loop(count);
}
#if BX_SUPPORT_SMP
else {
int stop = 0;
// for now, step each CPU one instruction at a time
for (unsigned cycle=0; !stop && cycle < count; cycle++) {
for (unsigned cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) {
for (unsigned ncpu=0; ncpu < BX_SMP_PROCESSORS; ncpu++) {
bx_guard.interrupt_requested = 0;
BX_CPU(cpu)->guard_found.guard_found = 0;
BX_CPU(cpu)->cpu_loop(1);
BX_CPU(ncpu)->guard_found.guard_found = 0;
BX_CPU(ncpu)->cpu_loop(1);
// set stop flag if a guard found other than icount or halted
unsigned found = BX_CPU(cpu)->guard_found.guard_found;
stop_reason_t reason = (stop_reason_t) BX_CPU(cpu)->stop_reason;
unsigned found = BX_CPU(ncpu)->guard_found.guard_found;
stop_reason_t reason = (stop_reason_t) BX_CPU(ncpu)->stop_reason;
if (found || (reason != STOP_NO_REASON && reason != STOP_CPU_HALTED))
stop = 1;
}
@ -2580,24 +2585,6 @@ void bx_dbg_set_symbol_command(const char *symbol, Bit32u val)
else if (!strcmp(symbol, "eflags")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_EFLAGS, val);
}
else if (!strcmp(symbol, "cs")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_CS, val);
}
else if (!strcmp(symbol, "ss")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_SS, val);
}
else if (!strcmp(symbol, "ds")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_DS, val);
}
else if (!strcmp(symbol, "es")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_ES, val);
}
else if (!strcmp(symbol, "fs")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_FS, val);
}
else if (!strcmp(symbol, "gs")) {
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_GS, val);
}
else if (!strcmp(symbol, "cpu")) {
if (val >= BX_SMP_PROCESSORS) {
dbg_printf("invalid cpu id number %d\n", val);
@ -3195,15 +3182,18 @@ void bx_dbg_info_tss_command(void)
bx_dbg_sreg_t tr;
BX_CPU(dbg_cpu)->dbg_get_tr(&tr);
Bit32u laddr = (tr.des_l>>16) |
((tr.des_h<<16)&0x00ff0000) | (tr.des_h & 0xff000000);
bx_address base = (tr.des_l>>16) |
((tr.des_h<<16)&0x00ff0000) | (tr.des_h & 0xff000000);
#if BX_SUPPORT_X86_64
base |= (Bit64u)(tr.dword3) << 32;
#endif
Bit32u len = (tr.des_l & 0xffff) + 1;
dbg_printf("tr:s=0x%x, base=0x%x, valid=%u\n",
(unsigned) tr.sel, laddr, (unsigned) tr.valid);
dbg_printf("tr:s=0x%x, base=0x" FMT_ADDRX ", valid=%u\n",
(unsigned) tr.sel, base, (unsigned) tr.valid);
bx_phy_address paddr = 0;
if (BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(laddr, &paddr)) {
if (BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(base, &paddr)) {
bx_dbg_print_tss(BX_MEM(0)->get_vector(paddr), len);
}
else {
@ -3439,7 +3429,7 @@ void bx_dbg_print_help(void)
dbg_printf(" help, q|quit|exit, set, instrument, show, trace, trace-reg,\n");
dbg_printf(" trace-mem, record, playback, ldsym, slist\n");
dbg_printf("-*- Execution control -*-\n");
dbg_printf(" c|cont|continue, s|step|stepi, p|n|next, modebp\n");
dbg_printf(" c|cont|continue, s|step, 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");
@ -3734,7 +3724,7 @@ void bx_dbg_step_over_command()
case 0xEA:
// jmp short
case 0xEB:
bx_dbg_stepN_command(1);
bx_dbg_stepN_command(dbg_cpu, 1);
return;
// jmp absolute indirect
case 0xFF:
@ -3743,7 +3733,7 @@ void bx_dbg_step_over_command()
case 4:
// far
case 5:
bx_dbg_stepN_command(1);
bx_dbg_stepN_command(dbg_cpu, 1);
return;
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debug.h,v 1.57 2009-10-15 21:15:18 sshwarts Exp $
// $Id: debug.h,v 1.58 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -245,7 +245,7 @@ void bx_dbg_watch(int type, bx_phy_address address);
void bx_dbg_unwatch_all(void);
void bx_dbg_unwatch(bx_phy_address handle);
void bx_dbg_continue_command(void);
void bx_dbg_stepN_command(Bit32u count);
void bx_dbg_stepN_command(int cpu, Bit32u count);
void bx_dbg_set_auto_disassemble(bx_bool enable);
void bx_dbg_disassemble_switch_mode(void);
void bx_dbg_set_disassemble_size(unsigned size);
@ -479,6 +479,9 @@ void bx_dbg_interpret_line(char *cmd);
typedef struct {
Bit16u sel;
Bit32u des_l, des_h, valid;
#if BX_SUPPORT_X86_64
Bit32u dword3;
#endif
} bx_dbg_sreg_t;
typedef struct {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%{
/////////////////////////////////////////////////////////////////////////
// $Id: lexer.l,v 1.31 2009-10-15 20:50:33 sshwarts Exp $
// $Id: lexer.l,v 1.32 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
@ -57,7 +57,6 @@ crc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CRC); }
c |
cont |
continue { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CONTINUE); }
stepi |
step |
s { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STEPN); }
next |
@ -141,6 +140,7 @@ ne2k|ne2000 { bxlval.sval = strdup(bxtext); return(BX_TOKEN_NE2000); }
page { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PAGE); }
vga { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VGA); }
pci { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PCI); }
all { bxlval.sval = strdup(bxtext); return(BX_TOKEN_ALL); }
al { bxlval.uval = BX_DBG_REG8L_AL; return(BX_TOKEN_8BL_REG);}
bl { bxlval.uval = BX_DBG_REG8L_BL; return(BX_TOKEN_8BL_REG);}
cl { bxlval.uval = BX_DBG_REG8L_CL; return(BX_TOKEN_8BL_REG);}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: linux.cc,v 1.10 2009-01-30 21:47:42 sshwarts Exp $
// $Id: linux.cc,v 1.11 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
#include <stdio.h>
@ -16,15 +16,15 @@
#define KERNEL_CS 0x10
#define USER_CS 0x18
void bx_dbg_info_linux_command (void)
void bx_dbg_info_linux_command(void)
{
BX_INFO (("Info linux"));
bx_dbg_sreg_t cs;
Bit32u cr0 = BX_CPU(dbg_cpu)->dbg_get_reg(BX_DBG_REG_CR0);
BX_CPU(dbg_cpu)->dbg_get_sreg(&cs, BX_DBG_SREG_CS);
int cpu_mode = BX_CPU(dbg_cpu)->get_cpu_mode();
int mode;
if (cr0 & 1) {
if (cpu_mode >= BX_MODE_IA32_PROTECTED) {
// protected mode
if (cs.sel == KERNEL_CS) {
mode = 'k';
@ -79,7 +79,7 @@ const char *syscall_names_t::get_name(int n)
syscall_names_t syscall_names;
void bx_dbg_linux_syscall (unsigned which_cpu)
void bx_dbg_linux_syscall(unsigned which_cpu)
{
Bit32u eax = BX_CPU(which_cpu)->get_reg32(BX_32BIT_REG_EAX);
const char *name = syscall_names.get_name(eax);

File diff suppressed because it is too large Load Diff

View File

@ -80,67 +80,68 @@
BX_TOKEN_LDT = 296,
BX_TOKEN_TSS = 297,
BX_TOKEN_TAB = 298,
BX_TOKEN_LINUX = 299,
BX_TOKEN_DEBUG_REGS = 300,
BX_TOKEN_CONTROL_REGS = 301,
BX_TOKEN_SEGMENT_REGS = 302,
BX_TOKEN_EXAMINE = 303,
BX_TOKEN_XFORMAT = 304,
BX_TOKEN_DISFORMAT = 305,
BX_TOKEN_RESTORE = 306,
BX_TOKEN_SETPMEM = 307,
BX_TOKEN_SYMBOLNAME = 308,
BX_TOKEN_QUERY = 309,
BX_TOKEN_PENDING = 310,
BX_TOKEN_TAKE = 311,
BX_TOKEN_DMA = 312,
BX_TOKEN_IRQ = 313,
BX_TOKEN_DISASSEMBLE = 314,
BX_TOKEN_INSTRUMENT = 315,
BX_TOKEN_STRING = 316,
BX_TOKEN_STOP = 317,
BX_TOKEN_DOIT = 318,
BX_TOKEN_CRC = 319,
BX_TOKEN_TRACE = 320,
BX_TOKEN_TRACEREG = 321,
BX_TOKEN_TRACEMEM = 322,
BX_TOKEN_SWITCH_MODE = 323,
BX_TOKEN_SIZE = 324,
BX_TOKEN_PTIME = 325,
BX_TOKEN_TIMEBP_ABSOLUTE = 326,
BX_TOKEN_TIMEBP = 327,
BX_TOKEN_RECORD = 328,
BX_TOKEN_PLAYBACK = 329,
BX_TOKEN_MODEBP = 330,
BX_TOKEN_PRINT_STACK = 331,
BX_TOKEN_WATCH = 332,
BX_TOKEN_UNWATCH = 333,
BX_TOKEN_READ = 334,
BX_TOKEN_WRITE = 335,
BX_TOKEN_SHOW = 336,
BX_TOKEN_LOAD_SYMBOLS = 337,
BX_TOKEN_SYMBOLS = 338,
BX_TOKEN_LIST_SYMBOLS = 339,
BX_TOKEN_GLOBAL = 340,
BX_TOKEN_WHERE = 341,
BX_TOKEN_PRINT_STRING = 342,
BX_TOKEN_NUMERIC = 343,
BX_TOKEN_NE2000 = 344,
BX_TOKEN_PIC = 345,
BX_TOKEN_PAGE = 346,
BX_TOKEN_HELP = 347,
BX_TOKEN_CALC = 348,
BX_TOKEN_VGA = 349,
BX_TOKEN_PCI = 350,
BX_TOKEN_COMMAND = 351,
BX_TOKEN_GENERIC = 352,
BX_TOKEN_RSHIFT = 353,
BX_TOKEN_LSHIFT = 354,
BX_TOKEN_REG_IP = 355,
BX_TOKEN_REG_EIP = 356,
BX_TOKEN_REG_RIP = 357,
NEG = 358,
NOT = 359
BX_TOKEN_ALL = 299,
BX_TOKEN_LINUX = 300,
BX_TOKEN_DEBUG_REGS = 301,
BX_TOKEN_CONTROL_REGS = 302,
BX_TOKEN_SEGMENT_REGS = 303,
BX_TOKEN_EXAMINE = 304,
BX_TOKEN_XFORMAT = 305,
BX_TOKEN_DISFORMAT = 306,
BX_TOKEN_RESTORE = 307,
BX_TOKEN_SETPMEM = 308,
BX_TOKEN_SYMBOLNAME = 309,
BX_TOKEN_QUERY = 310,
BX_TOKEN_PENDING = 311,
BX_TOKEN_TAKE = 312,
BX_TOKEN_DMA = 313,
BX_TOKEN_IRQ = 314,
BX_TOKEN_DISASSEMBLE = 315,
BX_TOKEN_INSTRUMENT = 316,
BX_TOKEN_STRING = 317,
BX_TOKEN_STOP = 318,
BX_TOKEN_DOIT = 319,
BX_TOKEN_CRC = 320,
BX_TOKEN_TRACE = 321,
BX_TOKEN_TRACEREG = 322,
BX_TOKEN_TRACEMEM = 323,
BX_TOKEN_SWITCH_MODE = 324,
BX_TOKEN_SIZE = 325,
BX_TOKEN_PTIME = 326,
BX_TOKEN_TIMEBP_ABSOLUTE = 327,
BX_TOKEN_TIMEBP = 328,
BX_TOKEN_RECORD = 329,
BX_TOKEN_PLAYBACK = 330,
BX_TOKEN_MODEBP = 331,
BX_TOKEN_PRINT_STACK = 332,
BX_TOKEN_WATCH = 333,
BX_TOKEN_UNWATCH = 334,
BX_TOKEN_READ = 335,
BX_TOKEN_WRITE = 336,
BX_TOKEN_SHOW = 337,
BX_TOKEN_LOAD_SYMBOLS = 338,
BX_TOKEN_SYMBOLS = 339,
BX_TOKEN_LIST_SYMBOLS = 340,
BX_TOKEN_GLOBAL = 341,
BX_TOKEN_WHERE = 342,
BX_TOKEN_PRINT_STRING = 343,
BX_TOKEN_NUMERIC = 344,
BX_TOKEN_NE2000 = 345,
BX_TOKEN_PIC = 346,
BX_TOKEN_PAGE = 347,
BX_TOKEN_HELP = 348,
BX_TOKEN_CALC = 349,
BX_TOKEN_VGA = 350,
BX_TOKEN_PCI = 351,
BX_TOKEN_COMMAND = 352,
BX_TOKEN_GENERIC = 353,
BX_TOKEN_RSHIFT = 354,
BX_TOKEN_LSHIFT = 355,
BX_TOKEN_REG_IP = 356,
BX_TOKEN_REG_EIP = 357,
BX_TOKEN_REG_RIP = 358,
NEG = 359,
NOT = 360
};
#endif
/* Tokens. */
@ -185,67 +186,68 @@
#define BX_TOKEN_LDT 296
#define BX_TOKEN_TSS 297
#define BX_TOKEN_TAB 298
#define BX_TOKEN_LINUX 299
#define BX_TOKEN_DEBUG_REGS 300
#define BX_TOKEN_CONTROL_REGS 301
#define BX_TOKEN_SEGMENT_REGS 302
#define BX_TOKEN_EXAMINE 303
#define BX_TOKEN_XFORMAT 304
#define BX_TOKEN_DISFORMAT 305
#define BX_TOKEN_RESTORE 306
#define BX_TOKEN_SETPMEM 307
#define BX_TOKEN_SYMBOLNAME 308
#define BX_TOKEN_QUERY 309
#define BX_TOKEN_PENDING 310
#define BX_TOKEN_TAKE 311
#define BX_TOKEN_DMA 312
#define BX_TOKEN_IRQ 313
#define BX_TOKEN_DISASSEMBLE 314
#define BX_TOKEN_INSTRUMENT 315
#define BX_TOKEN_STRING 316
#define BX_TOKEN_STOP 317
#define BX_TOKEN_DOIT 318
#define BX_TOKEN_CRC 319
#define BX_TOKEN_TRACE 320
#define BX_TOKEN_TRACEREG 321
#define BX_TOKEN_TRACEMEM 322
#define BX_TOKEN_SWITCH_MODE 323
#define BX_TOKEN_SIZE 324
#define BX_TOKEN_PTIME 325
#define BX_TOKEN_TIMEBP_ABSOLUTE 326
#define BX_TOKEN_TIMEBP 327
#define BX_TOKEN_RECORD 328
#define BX_TOKEN_PLAYBACK 329
#define BX_TOKEN_MODEBP 330
#define BX_TOKEN_PRINT_STACK 331
#define BX_TOKEN_WATCH 332
#define BX_TOKEN_UNWATCH 333
#define BX_TOKEN_READ 334
#define BX_TOKEN_WRITE 335
#define BX_TOKEN_SHOW 336
#define BX_TOKEN_LOAD_SYMBOLS 337
#define BX_TOKEN_SYMBOLS 338
#define BX_TOKEN_LIST_SYMBOLS 339
#define BX_TOKEN_GLOBAL 340
#define BX_TOKEN_WHERE 341
#define BX_TOKEN_PRINT_STRING 342
#define BX_TOKEN_NUMERIC 343
#define BX_TOKEN_NE2000 344
#define BX_TOKEN_PIC 345
#define BX_TOKEN_PAGE 346
#define BX_TOKEN_HELP 347
#define BX_TOKEN_CALC 348
#define BX_TOKEN_VGA 349
#define BX_TOKEN_PCI 350
#define BX_TOKEN_COMMAND 351
#define BX_TOKEN_GENERIC 352
#define BX_TOKEN_RSHIFT 353
#define BX_TOKEN_LSHIFT 354
#define BX_TOKEN_REG_IP 355
#define BX_TOKEN_REG_EIP 356
#define BX_TOKEN_REG_RIP 357
#define NEG 358
#define NOT 359
#define BX_TOKEN_ALL 299
#define BX_TOKEN_LINUX 300
#define BX_TOKEN_DEBUG_REGS 301
#define BX_TOKEN_CONTROL_REGS 302
#define BX_TOKEN_SEGMENT_REGS 303
#define BX_TOKEN_EXAMINE 304
#define BX_TOKEN_XFORMAT 305
#define BX_TOKEN_DISFORMAT 306
#define BX_TOKEN_RESTORE 307
#define BX_TOKEN_SETPMEM 308
#define BX_TOKEN_SYMBOLNAME 309
#define BX_TOKEN_QUERY 310
#define BX_TOKEN_PENDING 311
#define BX_TOKEN_TAKE 312
#define BX_TOKEN_DMA 313
#define BX_TOKEN_IRQ 314
#define BX_TOKEN_DISASSEMBLE 315
#define BX_TOKEN_INSTRUMENT 316
#define BX_TOKEN_STRING 317
#define BX_TOKEN_STOP 318
#define BX_TOKEN_DOIT 319
#define BX_TOKEN_CRC 320
#define BX_TOKEN_TRACE 321
#define BX_TOKEN_TRACEREG 322
#define BX_TOKEN_TRACEMEM 323
#define BX_TOKEN_SWITCH_MODE 324
#define BX_TOKEN_SIZE 325
#define BX_TOKEN_PTIME 326
#define BX_TOKEN_TIMEBP_ABSOLUTE 327
#define BX_TOKEN_TIMEBP 328
#define BX_TOKEN_RECORD 329
#define BX_TOKEN_PLAYBACK 330
#define BX_TOKEN_MODEBP 331
#define BX_TOKEN_PRINT_STACK 332
#define BX_TOKEN_WATCH 333
#define BX_TOKEN_UNWATCH 334
#define BX_TOKEN_READ 335
#define BX_TOKEN_WRITE 336
#define BX_TOKEN_SHOW 337
#define BX_TOKEN_LOAD_SYMBOLS 338
#define BX_TOKEN_SYMBOLS 339
#define BX_TOKEN_LIST_SYMBOLS 340
#define BX_TOKEN_GLOBAL 341
#define BX_TOKEN_WHERE 342
#define BX_TOKEN_PRINT_STRING 343
#define BX_TOKEN_NUMERIC 344
#define BX_TOKEN_NE2000 345
#define BX_TOKEN_PIC 346
#define BX_TOKEN_PAGE 347
#define BX_TOKEN_HELP 348
#define BX_TOKEN_CALC 349
#define BX_TOKEN_VGA 350
#define BX_TOKEN_PCI 351
#define BX_TOKEN_COMMAND 352
#define BX_TOKEN_GENERIC 353
#define BX_TOKEN_RSHIFT 354
#define BX_TOKEN_LSHIFT 355
#define BX_TOKEN_REG_IP 356
#define BX_TOKEN_REG_EIP 357
#define BX_TOKEN_REG_RIP 358
#define NEG 359
#define NOT 360
@ -259,7 +261,7 @@ typedef union YYSTYPE
bx_bool bval;
}
/* Line 1489 of yacc.c. */
#line 263 "y.tab.h"
#line 265 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parser.y,v 1.36 2009-10-15 20:50:33 sshwarts Exp $
// $Id: parser.y,v 1.37 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
%{
@ -63,6 +63,7 @@
%token <sval> BX_TOKEN_LDT
%token <sval> BX_TOKEN_TSS
%token <sval> BX_TOKEN_TAB
%token <sval> BX_TOKEN_ALL
%token <sval> BX_TOKEN_LINUX
%token <sval> BX_TOKEN_DEBUG_REGS
%token <sval> BX_TOKEN_CONTROL_REGS
@ -415,12 +416,22 @@ continue_command:
stepN_command:
BX_TOKEN_STEPN '\n'
{
bx_dbg_stepN_command(1);
bx_dbg_stepN_command(dbg_cpu, 1);
free($1);
}
| BX_TOKEN_STEPN BX_TOKEN_NUMERIC '\n'
{
bx_dbg_stepN_command($2);
bx_dbg_stepN_command(dbg_cpu, $2);
free($1);
}
| BX_TOKEN_STEPN BX_TOKEN_ALL BX_TOKEN_NUMERIC '\n'
{
bx_dbg_stepN_command(-1, $2);
free($1); free($2);
}
| BX_TOKEN_STEPN BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
{
bx_dbg_stepN_command($2, $3);
free($1);
}
;
@ -864,7 +875,9 @@ help_command:
}
| BX_TOKEN_HELP BX_TOKEN_STEPN '\n'
{
dbg_printf("s|step|stepi [count] - execute #count instructions (default is one instruction)\n");
dbg_printf("s|step [count] - execute #count instructions on current processor (default is one instruction)\n");
dbg_printf("s|step [cpu] <count> - execute #count instructions on processor #cpu\n");
dbg_printf("s|step all <count> - execute #count instructions on all the processors\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_STEP_OVER '\n'

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.616 2009-10-24 11:17:51 sshwarts Exp $
// $Id: cpu.h,v 1.617 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2761,7 +2761,6 @@ public: // for now...
BX_SMF void dbg_force_interrupt(unsigned vector);
BX_SMF void dbg_take_dma(void);
BX_SMF bx_bool dbg_set_reg(unsigned reg, Bit32u val);
BX_SMF bx_address dbg_get_reg(unsigned reg);
BX_SMF bx_bool dbg_get_sreg(bx_dbg_sreg_t *sreg, unsigned sreg_no);
BX_SMF void dbg_get_tr(bx_dbg_sreg_t *sreg);
BX_SMF void dbg_get_ldtr(bx_dbg_sreg_t *sreg);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debugstuff.cc,v 1.105 2009-04-07 16:12:19 sshwarts Exp $
// $Id: debugstuff.cc,v 1.106 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -273,37 +273,6 @@ void BX_CPU_C::debug(bx_address offset)
#if BX_DEBUGGER
bx_address BX_CPU_C::dbg_get_reg(unsigned reg)
{
Bit32u return_val32;
switch (reg) {
case BX_DBG_REG_EIP: return(EIP);
case BX_DBG_REG_EFLAGS:
return_val32 = BX_CPU_THIS_PTR read_eflags();
return(return_val32);
case BX_DBG_REG_CS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value);
case BX_DBG_REG_SS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value);
case BX_DBG_REG_DS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.value);
case BX_DBG_REG_ES: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.value);
case BX_DBG_REG_FS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value);
case BX_DBG_REG_GS: return(BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value);
case BX_DBG_REG_CR0:
return BX_CPU_THIS_PTR cr0.get32();
case BX_DBG_REG_CR2:
return BX_CPU_THIS_PTR cr2;
case BX_DBG_REG_CR3:
return BX_CPU_THIS_PTR cr3;
#if BX_CPU_LEVEL >= 4
case BX_DBG_REG_CR4:
return BX_CPU_THIS_PTR cr4.get32();
#endif
default:
BX_PANIC(("get_reg: request for unknown register"));
return(0);
}
}
bx_bool BX_CPU_C::dbg_set_reg(unsigned reg, Bit32u val)
{
// returns 1=OK, 0=can't change
@ -311,7 +280,10 @@ bx_bool BX_CPU_C::dbg_set_reg(unsigned reg, Bit32u val)
Bit32u current_sys_bits;
switch (reg) {
case BX_DBG_REG_EIP: EIP = val; return(1);
case BX_DBG_REG_EIP:
EIP = val;
invalidate_prefetch_q();
return(1);
case BX_DBG_REG_EFLAGS:
BX_INFO(("dbg_set_reg: can not handle eflags yet."));
if (val & 0xffff0000) {
@ -337,45 +309,9 @@ bx_bool BX_CPU_C::dbg_set_reg(unsigned reg, Bit32u val)
if (BX_CPU_THIS_PTR get_IF())
BX_CPU_THIS_PTR async_event = 1;
return(1);
case BX_DBG_REG_CS:
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS];
break;
case BX_DBG_REG_SS:
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS];
break;
case BX_DBG_REG_DS:
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS];
break;
case BX_DBG_REG_ES:
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES];
break;
case BX_DBG_REG_FS:
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS];
break;
case BX_DBG_REG_GS:
seg = &BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS];
break;
default:
BX_PANIC(("dbg_set_reg: unrecognized register ID (%u)", reg));
return(0);
}
if (real_mode()) {
seg->selector.value = val;
seg->cache.valid = 1;
seg->cache.p = 1;
seg->cache.dpl = 0;
seg->cache.segment = 1; // regular segment
seg->cache.type = BX_DATA_READ_WRITE_ACCESSED;
seg->cache.u.segment.base = val << 4;
seg->cache.u.segment.limit_scaled = 0xffff;
seg->cache.u.segment.g = 0; // byte granular
seg->cache.u.segment.d_b = 0; // default 16bit size
seg->cache.u.segment.avl = 0;
return(1); // ok
}
return(0); // can't change when not in real mode
return(0);
}
unsigned BX_CPU_C::dbg_query_pending(void)
@ -397,27 +333,36 @@ bx_bool BX_CPU_C::dbg_get_sreg(bx_dbg_sreg_t *sreg, unsigned sreg_no)
{
if (sreg_no > 5)
return(0);
sreg->valid = BX_CPU_THIS_PTR sregs[sreg_no].cache.valid;
sreg->sel = BX_CPU_THIS_PTR sregs[sreg_no].selector.value;
sreg->des_l = get_descriptor_l(&BX_CPU_THIS_PTR sregs[sreg_no].cache);
sreg->des_h = get_descriptor_h(&BX_CPU_THIS_PTR sregs[sreg_no].cache);
sreg->valid = BX_CPU_THIS_PTR sregs[sreg_no].cache.valid;
#if BX_SUPPORT_X86_64
sreg->dword3 = BX_CPU_THIS_PTR sregs[sreg_no].cache.u.segment.base >> 32;
#endif
return(1);
}
void BX_CPU_C::dbg_get_tr(bx_dbg_sreg_t *sreg)
{
sreg->valid = BX_CPU_THIS_PTR tr.cache.valid;
sreg->sel = BX_CPU_THIS_PTR tr.selector.value;
sreg->des_l = get_descriptor_l(&BX_CPU_THIS_PTR tr.cache);
sreg->des_h = get_descriptor_h(&BX_CPU_THIS_PTR tr.cache);
sreg->valid = BX_CPU_THIS_PTR tr.cache.valid;
#if BX_SUPPORT_X86_64
sreg->dword3 = BX_CPU_THIS_PTR tr.cache.u.segment.base >> 32;
#endif
}
void BX_CPU_C::dbg_get_ldtr(bx_dbg_sreg_t *sreg)
{
sreg->valid = BX_CPU_THIS_PTR ldtr.cache.valid;
sreg->sel = BX_CPU_THIS_PTR ldtr.selector.value;
sreg->des_l = get_descriptor_l(&BX_CPU_THIS_PTR ldtr.cache);
sreg->des_h = get_descriptor_h(&BX_CPU_THIS_PTR ldtr.cache);
sreg->valid = BX_CPU_THIS_PTR ldtr.cache.valid;
#if BX_SUPPORT_X86_64
sreg->dword3 = BX_CPU_THIS_PTR ldtr.cache.u.segment.base >> 32;
#endif
}
void BX_CPU_C::dbg_get_gdtr(bx_dbg_global_sreg_t *sreg)

View File

@ -1,7 +1,7 @@
<!--
================================================================
doc/docbook/user/user.dbk
$Id: user.dbk,v 1.265 2009-10-15 20:50:33 sshwarts Exp $
$Id: user.dbk,v 1.266 2009-10-29 15:49:50 sshwarts Exp $
This is the top level file for the Bochs Users Manual.
================================================================
@ -6247,11 +6247,17 @@ From here, you may use the following commands:
<para>
<screen>
c continue executing
cont
continue
s [count] execute count instructions, default is 1
step [count]
stepi [count]
s [cpu] [count] for SMP simulation, execute count instructions on cpu, default is 1
step [cpu] [count]
s all <count> for SMP simulation, execute count instructions on all cpus
step all <count>
Ctrl-C stop execution, and return to command line prompt
Ctrl-D if at empty line on command line, exit

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: enh_dbg.cc,v 1.17 2009-08-14 20:20:45 sshwarts Exp $
// $Id: enh_dbg.cc,v 1.18 2009-10-29 15:49:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// BOCHS ENHANCED DEBUGGER Ver 1.2
@ -2536,7 +2536,7 @@ void doStepN()
PrevStepNSize = i;
AtBreak = FALSE;
StatusChange = TRUE;
bx_dbg_stepN_command(i);
bx_dbg_stepN_command(CurrentCPU, i);
AtBreak = TRUE;
StatusChange = TRUE;
OnBreak();
@ -2761,7 +2761,7 @@ void SetMemLine(int L)
{
// convert the hex to a byte, and try to store the byte in bochs physmem
sscanf (s,"%2X", (unsigned int*)&newval);
if ( bx_mem.dbg_set_mem( (bx_phy_address) h, 1, &newval) == FALSE )
if (bx_mem.dbg_set_mem( (bx_phy_address) h, 1, &newval) == FALSE)
err = 2;
++h; // bump to the next mem address
while (*x == ' ') // scan past whitespace
@ -2990,7 +2990,7 @@ int HotKey (int ww, int Alt, int Shift, int Control)
case VK_F11:
if (AtBreak != FALSE && debug_cmd_ready == FALSE)
{
bx_dbg_stepN_command(1); // singlestep
bx_dbg_stepN_command(CurrentCPU, 1); // singlestep
StatusChange = TRUE;
OnBreak();
}
@ -3033,7 +3033,7 @@ int HotKey (int ww, int Alt, int Shift, int Control)
StatusChange = TRUE;
if (*tmpcb == 0) // Hitting <CR> on a blank line means SINGLESTEP
{
bx_dbg_stepN_command(1); // singlestep
bx_dbg_stepN_command(CurrentCPU, 1); // singlestep
OnBreak();
}
else
@ -3082,7 +3082,7 @@ void ActivateMenuItem (int cmd)
case CMD_STEP1: // step 1
if (AtBreak != FALSE && debug_cmd_ready == FALSE)
{
bx_dbg_stepN_command(1); // singlestep
bx_dbg_stepN_command(CurrentCPU, 1); // singlestep
StatusChange = TRUE;
OnBreak();
}