Support for 64-bit registers set reg = expr command

Print found guard cs_eip in more nice way, it was too mane leading zeroes in x86-64 mode ON
This commit is contained in:
Stanislav Shwartsman 2006-02-13 18:28:14 +00:00
parent 4bd442e80e
commit d37f62d2b4
7 changed files with 2722 additions and 2193 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.55 2006-02-12 20:43:01 sshwarts Exp $
// $Id: dbg_main.cc,v 1.56 2006-02-13 18:28:13 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -834,6 +834,21 @@ void bx_dbg_print_string_command(bx_address start_addr)
dbg_printf("\n");
}
static void dbg_print_guard_found(unsigned cpu_mode, Bit32u cs, bx_address eip, bx_address laddr)
{
#if BX_SUPPORT_X86_64
if (cpu_mode == BX_MODE_LONG_64) {
dbg_printf("0x%04x:" FMT_ADDRX " (0x" FMT_ADDRX ")", cs, eip, laddr);
return;
}
#endif
if (cpu_mode >= BX_MODE_IA32_PROTECTED)
dbg_printf("%04x:%08x (0x%08x)", cs, (unsigned) eip, (unsigned) laddr);
else // real or v8086 mode
dbg_printf("%04x:%04x (0x%08x)", cs, (unsigned) eip, (unsigned) laddr);
}
unsigned dbg_show_mask = 0;
#define BX_DBG_SHOW_CALLRET (Flag_call|Flag_ret)
@ -1005,31 +1020,31 @@ int bx_dbg_show_symbolic(void)
/* interrupts */
if (dbg_show_mask & BX_DBG_SHOW_SOFTINT) {
if(BX_CPU(dbg_cpu)->show_flag & Flag_softint) {
dbg_printf (FMT_TICK ": softint 0x%04x:" FMT_ADDRX " (0x" FMT_ADDRX ")\n",
bx_pc_system.time_ticks(),
BX_CPU(dbg_cpu)->guard_found.cs,
BX_CPU(dbg_cpu)->guard_found.eip,
dbg_printf(FMT_TICK ": softint ", bx_pc_system.time_ticks());
dbg_print_guard_found(BX_CPU(dbg_cpu)->get_cpu_mode(),
BX_CPU(dbg_cpu)->guard_found.cs, BX_CPU(dbg_cpu)->guard_found.eip,
BX_CPU(dbg_cpu)->guard_found.laddr);
dbg_printf("\n");
}
}
if (dbg_show_mask & BX_DBG_SHOW_EXTINT) {
if((BX_CPU(dbg_cpu)->show_flag & Flag_intsig) && !(BX_CPU(dbg_cpu)->show_flag & Flag_softint)) {
dbg_printf (FMT_TICK ": exception (not softint) 0x%04x:" FMT_ADDRX " (0x" FMT_ADDRX ")\n",
bx_pc_system.time_ticks(),
BX_CPU(dbg_cpu)->guard_found.cs,
BX_CPU(dbg_cpu)->guard_found.eip,
dbg_printf(FMT_TICK ": exception (not softint) ", bx_pc_system.time_ticks());
dbg_print_guard_found(BX_CPU(dbg_cpu)->get_cpu_mode(),
BX_CPU(dbg_cpu)->guard_found.cs, BX_CPU(dbg_cpu)->guard_found.eip,
BX_CPU(dbg_cpu)->guard_found.laddr);
dbg_printf("\n");
}
}
if (dbg_show_mask & BX_DBG_SHOW_IRET) {
if(BX_CPU(dbg_cpu)->show_flag & Flag_iret) {
dbg_printf (FMT_TICK ": iret 0x%04x:" FMT_ADDRX " (0x" FMT_ADDRX ")\n",
bx_pc_system.time_ticks(),
BX_CPU(dbg_cpu)->guard_found.cs,
BX_CPU(dbg_cpu)->guard_found.eip,
dbg_printf(FMT_TICK ": iret ", bx_pc_system.time_ticks());
dbg_print_guard_found(BX_CPU(dbg_cpu)->get_cpu_mode(),
BX_CPU(dbg_cpu)->guard_found.cs, BX_CPU(dbg_cpu)->guard_found.eip,
BX_CPU(dbg_cpu)->guard_found.laddr);
dbg_printf("\n");
}
}
@ -1041,16 +1056,17 @@ int bx_dbg_show_symbolic(void)
bx_bool valid;
BX_CPU(dbg_cpu)->dbg_xlate_linear2phy(BX_CPU(dbg_cpu)->guard_found.laddr, &phy, &valid);
dbg_printf (FMT_TICK ": call 0x%04x:" FMT_ADDRX " 0x" FMT_ADDRX " (%08x) %s",
bx_pc_system.time_ticks(),
BX_CPU(dbg_cpu)->guard_found.cs,
BX_CPU(dbg_cpu)->guard_found.eip,
BX_CPU(dbg_cpu)->guard_found.laddr,
phy,
dbg_printf(FMT_TICK ": call ", bx_pc_system.time_ticks());
dbg_print_guard_found(BX_CPU(dbg_cpu)->get_cpu_mode(),
BX_CPU(dbg_cpu)->guard_found.cs, BX_CPU(dbg_cpu)->guard_found.eip,
BX_CPU(dbg_cpu)->guard_found.laddr);
if (!valid) dbg_printf(" phys not valid");
else {
dbg_printf(" (phy: 0x%08x) %s", phy,
bx_dbg_symbolic_address(BX_CPU(dbg_cpu)->cr3,
BX_CPU(dbg_cpu)->guard_found.eip,
BX_CPU(dbg_cpu)->guard_found.laddr - BX_CPU(dbg_cpu)->guard_found.eip));
if(!valid) dbg_printf(" phys not valid");
}
dbg_printf("\n");
}
}
@ -1385,12 +1401,11 @@ void bx_dbg_print_guard_results(void)
#if BX_DBG_SUPPORT_VIR_BPOINT
else if (found & BX_DBG_GUARD_IADDR_VIR) {
i = BX_CPU(cpu)->guard_found.iaddr_index;
dbg_printf("(%u) Breakpoint %u, " FMT_ADDRX " (0x%04x:" FMT_ADDRX ")\n",
cpu,
bx_guard.iaddr.vir[i].bpoint_id,
BX_CPU(cpu)->guard_found.laddr,
BX_CPU(cpu)->guard_found.cs,
BX_CPU(cpu)->guard_found.eip);
dbg_printf("(%u) Breakpoint %u, in ");
dbg_print_guard_found(BX_CPU(dbg_cpu)->get_cpu_mode(),
BX_CPU(cpu)->guard_found.cs, BX_CPU(cpu)->guard_found.eip,
BX_CPU(cpu)->guard_found.laddr);
dbg_printf("\n");
}
#endif
#if BX_DBG_SUPPORT_LIN_BPOINT
@ -3279,7 +3294,7 @@ Bit8u bx_dbg_get_reg8l_value(unsigned reg)
if (reg < BX_GENERAL_REGISTERS)
return BX_CPU(dbg_cpu)->get_reg8l(reg);
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 8BL register [%d] !!!\n", reg);
return 0;
}
@ -3288,7 +3303,7 @@ Bit8u bx_dbg_get_reg8h_value(unsigned reg)
if (reg < BX_GENERAL_REGISTERS)
return BX_CPU(dbg_cpu)->get_reg8h(reg);
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 8BH register [%d] !!!\n", reg);
return 0;
}
@ -3297,7 +3312,7 @@ Bit16u bx_dbg_get_reg16_value(unsigned reg)
if (reg < BX_GENERAL_REGISTERS)
return BX_CPU(dbg_cpu)->get_reg16(reg);
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 16B register [%d] !!!\n", reg);
return 0;
}
@ -3306,7 +3321,18 @@ Bit32u bx_dbg_get_reg32_value(unsigned reg)
if (reg < BX_GENERAL_REGISTERS)
return BX_CPU(dbg_cpu)->get_reg32(reg);
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 32B register [%d] !!!\n", reg);
return 0;
}
Bit64u bx_dbg_get_reg64_value(unsigned reg)
{
#if BX_SUPPORT_X86_64
if (reg < BX_GENERAL_REGISTERS)
return BX_CPU(dbg_cpu)->get_reg64(reg);
#endif
dbg_printf("Unknown 64B register [%d] !!!\n", reg);
return 0;
}
@ -3315,7 +3341,7 @@ void bx_dbg_set_reg8l_value(unsigned reg, Bit8u value)
if (reg < BX_GENERAL_REGISTERS)
BX_CPU(dbg_cpu)->set_reg8l(reg, value);
else
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 8BL register [%d] !!!\n", reg);
}
void bx_dbg_set_reg8h_value(unsigned reg, Bit8u value)
@ -3323,7 +3349,7 @@ void bx_dbg_set_reg8h_value(unsigned reg, Bit8u value)
if (reg < BX_GENERAL_REGISTERS)
BX_CPU(dbg_cpu)->set_reg8h(reg, value);
else
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 8BH register [%d] !!!\n", reg);
}
void bx_dbg_set_reg16_value(unsigned reg, Bit16u value)
@ -3331,7 +3357,7 @@ void bx_dbg_set_reg16_value(unsigned reg, Bit16u value)
if (reg < BX_GENERAL_REGISTERS)
BX_CPU(dbg_cpu)->set_reg16(reg, value);
else
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 16B register [%d] !!!\n", reg);
}
void bx_dbg_set_reg32_value(unsigned reg, Bit32u value)
@ -3339,7 +3365,17 @@ void bx_dbg_set_reg32_value(unsigned reg, Bit32u value)
if (reg < BX_GENERAL_REGISTERS)
BX_CPU(dbg_cpu)->set_reg32(reg, value);
else
fprintf(stderr, "Unknown register [%d] !!!\n", reg);
dbg_printf("Unknown 32B register [%d] !!!\n", reg);
}
void bx_dbg_set_reg64_value(unsigned reg, Bit64u value)
{
#if BX_SUPPORT_X86_64
if (reg < BX_GENERAL_REGISTERS)
BX_CPU(dbg_cpu)->set_reg64(reg, value);
else
#endif
dbg_printf("Unknown 64B register [%d] !!!\n", reg);
}
Bit16u bx_dbg_get_selector_value(unsigned int seg_no)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debug.h,v 1.20 2006-02-12 20:21:36 sshwarts Exp $
// $Id: debug.h,v 1.21 2006-02-13 18:28:13 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -220,15 +220,17 @@ typedef struct {
Bit16u bx_dbg_get_selector_value(unsigned int seg_no);
Bit16u bx_dbg_get_ip (void);
Bit32u bx_dbg_get_eip(void);
bx_address bx_dbg_get_intruction_pointer(void);
bx_address bx_dbg_get_instruction_pointer(void);
Bit8u bx_dbg_get_reg8l_value(unsigned reg);
Bit8u bx_dbg_get_reg8h_value(unsigned reg);
Bit16u bx_dbg_get_reg16_value(unsigned reg);
Bit32u bx_dbg_get_reg32_value(unsigned reg);
Bit64u bx_dbg_get_reg64_value(unsigned reg);
void bx_dbg_set_reg8l_value(unsigned reg, Bit8u value);
void bx_dbg_set_reg8h_value(unsigned reg, Bit8u value);
void bx_dbg_set_reg16_value(unsigned reg, Bit16u value);
void bx_dbg_set_reg32_value(unsigned reg, Bit32u value);
void bx_dbg_set_reg64_value(unsigned reg, Bit64u value);
Bit32u bx_dbg_get_laddr(Bit16u sel, Bit32u ofs);
void bx_dbg_step_over_command(void);
bx_num_range make_num_range (Bit64s from, Bit64s to);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%{
/////////////////////////////////////////////////////////////////////////
// $Id: lexer.l,v 1.14 2006-02-11 21:19:22 sshwarts Exp $
// $Id: lexer.l,v 1.15 2006-02-13 18:28:14 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
@ -10,13 +10,33 @@
#include "parser.h"
int bx_yyinput(char *buf, int max_size);
#undef YY_INPUT
#define YY_INPUT(buf, ret, max_size) (ret = bx_yyinput(buf, max_size))
static char *lex_input_ptr = NULL;
static unsigned lex_input_size = 0;
#if BX_SUPPORT_X86_64
#define LONG_MODE_8BL_REG(reg) \
{ bxlval.uval = reg; return(BX_TOKEN_8BL_REG); }
#define LONG_MODE_16B_REG(reg) \
{ bxlval.uval = reg; return(BX_TOKEN_16B_REG); }
#define LONG_MODE_32B_REG(reg) \
{ bxlval.uval = reg; return(BX_TOKEN_32B_REG); }
#define LONG_MODE_64B_REG(reg) \
{ bxlval.uval = reg; return(BX_TOKEN_64B_REG); }
#else
#define LONG_MODE_8BL_REG(reg) \
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERERIC); }
#define LONG_MODE_16B_REG(reg) \
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERERIC); }
#define LONG_MODE_32B_REG(reg) \
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERERIC); }
#define LONG_MODE_64B_REG(reg) \
{ bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERERIC); }
#endif
%}
%x EXAMINE
@ -38,10 +58,8 @@ next |
n |
p { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STEP_OVER); }
blist { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LIST_BREAK); }
vb |
vbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VBREAKPOINT); }
lb |
lbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LBREAKPOINT); }
vb|vbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_VBREAKPOINT); }
lb|lbreak { bxlval.sval = strdup(bxtext); return(BX_TOKEN_LBREAKPOINT); }
break |
b |
pb |
@ -116,32 +134,77 @@ print-string { bxlval.sval = strdup(bxtext); return(BX_TOKEN_PRINT_STRING); }
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); }
al { bxlval.uval = BX_DBG_REG8L_AL; return(BX_TOKEN_REG_AL);}
bl { bxlval.uval = BX_DBG_REG8L_BL; return(BX_TOKEN_REG_BL);}
cl { bxlval.uval = BX_DBG_REG8L_CL; return(BX_TOKEN_REG_CL);}
dl { bxlval.uval = BX_DBG_REG8L_DL; return(BX_TOKEN_REG_DL);}
ah { bxlval.uval = BX_DBG_REG8H_AH; return(BX_TOKEN_REG_AH);}
bh { bxlval.uval = BX_DBG_REG8H_BH; return(BX_TOKEN_REG_BH);}
ch { bxlval.uval = BX_DBG_REG8H_CH; return(BX_TOKEN_REG_CH);}
dh { bxlval.uval = BX_DBG_REG8H_DH; return(BX_TOKEN_REG_DH);}
ax { bxlval.uval = BX_DBG_REG16_AX; return(BX_TOKEN_REG_AX);}
bx { bxlval.uval = BX_DBG_REG16_BX; return(BX_TOKEN_REG_BX);}
cx { bxlval.uval = BX_DBG_REG16_CX; return(BX_TOKEN_REG_CX);}
dx { bxlval.uval = BX_DBG_REG16_DX; return(BX_TOKEN_REG_DX);}
si { bxlval.uval = BX_DBG_REG16_SI; return(BX_TOKEN_REG_SI);}
di { bxlval.uval = BX_DBG_REG16_DI; return(BX_TOKEN_REG_DI);}
bp { bxlval.uval = BX_DBG_REG16_BP; return(BX_TOKEN_REG_BP);}
sp { bxlval.uval = BX_DBG_REG16_SP; return(BX_TOKEN_REG_SP);}
ip { bxlval.uval = BX_DBG_GEN_REGISTERS; return(BX_TOKEN_REG_IP);}
eax { bxlval.uval = BX_DBG_REG32_EAX; return(BX_TOKEN_REG_EAX);}
ebx { bxlval.uval = BX_DBG_REG32_EBX; return(BX_TOKEN_REG_EBX);}
ecx { bxlval.uval = BX_DBG_REG32_ECX; return(BX_TOKEN_REG_ECX);}
edx { bxlval.uval = BX_DBG_REG32_EDX; return(BX_TOKEN_REG_EDX);}
esi { bxlval.uval = BX_DBG_REG32_ESI; return(BX_TOKEN_REG_ESI);}
edi { bxlval.uval = BX_DBG_REG32_ESI; return(BX_TOKEN_REG_EDI);}
ebp { bxlval.uval = BX_DBG_REG32_EBP; return(BX_TOKEN_REG_EBP);}
esp { bxlval.uval = BX_DBG_REG32_ESP; return(BX_TOKEN_REG_ESP);}
eip { bxlval.uval = BX_DBG_GEN_REGISTERS; return(BX_TOKEN_REG_EIP);}
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);}
dl { bxlval.uval = BX_DBG_REG8L_DL; return(BX_TOKEN_8BL_REG);}
sil { LONG_MODE_8BL_REG(BX_DBG_REG8L_SIL); }
dil { LONG_MODE_8BL_REG(BX_DBG_REG8L_DIL); }
spl { LONG_MODE_8BL_REG(BX_DBG_REG8L_SPL); }
bpl { LONG_MODE_8BL_REG(BX_DBG_REG8L_BPL); }
r8b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R8); }
r9b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R9); }
r10b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R10); }
r11b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R11); }
r12b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R12); }
r13b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R13); }
r14b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R14); }
r15b { LONG_MODE_8BL_REG(BX_DBG_REG8L_R15); }
ah { bxlval.uval = BX_DBG_REG8H_AH; return(BX_TOKEN_8BH_REG);}
bh { bxlval.uval = BX_DBG_REG8H_BH; return(BX_TOKEN_8BH_REG);}
ch { bxlval.uval = BX_DBG_REG8H_CH; return(BX_TOKEN_8BH_REG);}
dh { bxlval.uval = BX_DBG_REG8H_DH; return(BX_TOKEN_8BH_REG);}
ax { bxlval.uval = BX_DBG_REG16_AX; return(BX_TOKEN_16B_REG);}
bx { bxlval.uval = BX_DBG_REG16_BX; return(BX_TOKEN_16B_REG);}
cx { bxlval.uval = BX_DBG_REG16_CX; return(BX_TOKEN_16B_REG);}
dx { bxlval.uval = BX_DBG_REG16_DX; return(BX_TOKEN_16B_REG);}
si { bxlval.uval = BX_DBG_REG16_SI; return(BX_TOKEN_16B_REG);}
di { bxlval.uval = BX_DBG_REG16_DI; return(BX_TOKEN_16B_REG);}
bp { bxlval.uval = BX_DBG_REG16_BP; return(BX_TOKEN_16B_REG);}
sp { bxlval.uval = BX_DBG_REG16_SP; return(BX_TOKEN_16B_REG);}
r8w { LONG_MODE_16B_REG(BX_DBG_REG16_R8); }
r9w { LONG_MODE_16B_REG(BX_DBG_REG16_R9); }
r10w { LONG_MODE_16B_REG(BX_DBG_REG16_R10); }
r11w { LONG_MODE_16B_REG(BX_DBG_REG16_R11); }
r12w { LONG_MODE_16B_REG(BX_DBG_REG16_R12); }
r13w { LONG_MODE_16B_REG(BX_DBG_REG16_R13); }
r14w { LONG_MODE_16B_REG(BX_DBG_REG16_R14); }
r15w { LONG_MODE_16B_REG(BX_DBG_REG16_R15); }
eax { bxlval.uval = BX_DBG_REG32_EAX; return(BX_TOKEN_32B_REG);}
ebx { bxlval.uval = BX_DBG_REG32_EBX; return(BX_TOKEN_32B_REG);}
ecx { bxlval.uval = BX_DBG_REG32_ECX; return(BX_TOKEN_32B_REG);}
edx { bxlval.uval = BX_DBG_REG32_EDX; return(BX_TOKEN_32B_REG);}
esi { bxlval.uval = BX_DBG_REG32_ESI; return(BX_TOKEN_32B_REG);}
edi { bxlval.uval = BX_DBG_REG32_ESI; return(BX_TOKEN_32B_REG);}
ebp { bxlval.uval = BX_DBG_REG32_EBP; return(BX_TOKEN_32B_REG);}
esp { bxlval.uval = BX_DBG_REG32_ESP; return(BX_TOKEN_32B_REG);}
r8d { LONG_MODE_32B_REG(BX_DBG_REG32_R8); }
r9d { LONG_MODE_32B_REG(BX_DBG_REG32_R9); }
r10d { LONG_MODE_32B_REG(BX_DBG_REG32_R10); }
r11d { LONG_MODE_32B_REG(BX_DBG_REG32_R11); }
r12d { LONG_MODE_32B_REG(BX_DBG_REG32_R12); }
r13d { LONG_MODE_32B_REG(BX_DBG_REG32_R13); }
r14d { LONG_MODE_32B_REG(BX_DBG_REG32_R14); }
r15d { LONG_MODE_32B_REG(BX_DBG_REG32_R15); }
rax { LONG_MODE_64B_REG(BX_DBG_REG64_RAX); }
rbx { LONG_MODE_64B_REG(BX_DBG_REG64_RBX); }
rcx { LONG_MODE_64B_REG(BX_DBG_REG64_RCX); }
rdx { LONG_MODE_64B_REG(BX_DBG_REG64_RDX); }
rsi { LONG_MODE_64B_REG(BX_DBG_REG64_RSI); }
rdi { LONG_MODE_64B_REG(BX_DBG_REG64_RDI); }
rsp { LONG_MODE_64B_REG(BX_DBG_REG64_RSP); }
rbp { LONG_MODE_64B_REG(BX_DBG_REG64_RBP); }
r8 { LONG_MODE_64B_REG(BX_DBG_REG64_R8); }
r9 { LONG_MODE_64B_REG(BX_DBG_REG64_R9); }
r10 { LONG_MODE_64B_REG(BX_DBG_REG64_R10); }
r11 { LONG_MODE_64B_REG(BX_DBG_REG64_R11); }
r12 { LONG_MODE_64B_REG(BX_DBG_REG64_R12); }
r13 { LONG_MODE_64B_REG(BX_DBG_REG64_R13); }
r14 { LONG_MODE_64B_REG(BX_DBG_REG64_R14); }
r15 { LONG_MODE_64B_REG(BX_DBG_REG64_R15); }
ip { return(BX_TOKEN_REG_IP); }
eip { return(BX_TOKEN_REG_EIP);}
rip { return(BX_TOKEN_REG_RIP);}
cs { bxlval.uval = BX_DBG_SREG_CS; return(BX_TOKEN_CS); }
es { bxlval.uval = BX_DBG_SREG_ES; return(BX_TOKEN_ES); }
ss { bxlval.uval = BX_DBG_SREG_SS; return(BX_TOKEN_SS); }
@ -171,10 +234,10 @@ calc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CALC); }
\"([^\\\"\n]|(\\.))*\" { bxlval.sval = strdup(bxtext); return(BX_TOKEN_STRING); }
0x[0-9a-fA-F]+ { bxlval.uval = strtoul(bxtext+2, NULL, 16); return(BX_TOKEN_NUMERIC); }
0[0-7]+ { bxlval.uval = strtoul(bxtext+1, NULL, 8); return(BX_TOKEN_NUMERIC); }
[0-9]+L { bxlval.ulval = strtoull(bxtext, NULL, 10); return(BX_TOKEN_LONG_NUMERIC); }
[0-9]+ { bxlval.uval = strtoul(bxtext, NULL, 10); return(BX_TOKEN_NUMERIC); }
[a-z]+ { bxlval.sval = strdup(bxtext); return(BX_TOKEN_COMMAND); }
$[a-zA-Z_][a-zA-Z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOLNAME); }
[A-Za-z_][A-Za-z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
<*>";" { return ('\n'); }
<*>\n { return ('\n'); }
[#][^\n]* ; // eat up comments '//'
@ -182,8 +245,6 @@ $[a-zA-Z_][a-zA-Z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_SYMBOLNA
<EXAMINE,DISASM>. { BEGIN(INITIAL); unput(*bxtext); }
%%
// [A-Za-z_][A-Za-z0-9_]* { bxlval.sval = strdup(bxtext); return(BX_TOKEN_GENERIC); }
int
bx_yyinput(char *buf, int max_size)
{

File diff suppressed because it is too large Load Diff

View File

@ -29,242 +29,206 @@
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
BX_TOKEN_REG_AL = 258,
BX_TOKEN_REG_BL = 259,
BX_TOKEN_REG_CL = 260,
BX_TOKEN_REG_DL = 261,
BX_TOKEN_REG_AH = 262,
BX_TOKEN_REG_BH = 263,
BX_TOKEN_REG_CH = 264,
BX_TOKEN_REG_DH = 265,
BX_TOKEN_REG_AX = 266,
BX_TOKEN_REG_BX = 267,
BX_TOKEN_REG_CX = 268,
BX_TOKEN_REG_DX = 269,
BX_TOKEN_REG_EAX = 270,
BX_TOKEN_REG_EBX = 271,
BX_TOKEN_REG_ECX = 272,
BX_TOKEN_REG_EDX = 273,
BX_TOKEN_REG_SI = 274,
BX_TOKEN_REG_DI = 275,
BX_TOKEN_REG_BP = 276,
BX_TOKEN_REG_SP = 277,
BX_TOKEN_REG_IP = 278,
BX_TOKEN_REG_ESI = 279,
BX_TOKEN_REG_EDI = 280,
BX_TOKEN_REG_EBP = 281,
BX_TOKEN_REG_ESP = 282,
BX_TOKEN_REG_EIP = 283,
BX_TOKEN_CS = 284,
BX_TOKEN_ES = 285,
BX_TOKEN_SS = 286,
BX_TOKEN_DS = 287,
BX_TOKEN_FS = 288,
BX_TOKEN_GS = 289,
BX_TOKEN_FLAGS = 290,
BX_TOKEN_ON = 291,
BX_TOKEN_OFF = 292,
BX_TOKEN_CONTINUE = 293,
BX_TOKEN_STEPN = 294,
BX_TOKEN_STEP_OVER = 295,
BX_TOKEN_NEXT_STEP = 296,
BX_TOKEN_SET = 297,
BX_TOKEN_DEBUGGER = 298,
BX_TOKEN_LIST_BREAK = 299,
BX_TOKEN_VBREAKPOINT = 300,
BX_TOKEN_LBREAKPOINT = 301,
BX_TOKEN_PBREAKPOINT = 302,
BX_TOKEN_DEL_BREAKPOINT = 303,
BX_TOKEN_ENABLE_BREAKPOINT = 304,
BX_TOKEN_DISABLE_BREAKPOINT = 305,
BX_TOKEN_INFO = 306,
BX_TOKEN_QUIT = 307,
BX_TOKEN_REGISTERS = 308,
BX_TOKEN_CPU = 309,
BX_TOKEN_FPU = 310,
BX_TOKEN_SSE = 311,
BX_TOKEN_ALL = 312,
BX_TOKEN_IDT = 313,
BX_TOKEN_IVT = 314,
BX_TOKEN_GDT = 315,
BX_TOKEN_LDT = 316,
BX_TOKEN_TSS = 317,
BX_TOKEN_TAB = 318,
BX_TOKEN_DIRTY = 319,
BX_TOKEN_LINUX = 320,
BX_TOKEN_CONTROL_REGS = 321,
BX_TOKEN_EXAMINE = 322,
BX_TOKEN_XFORMAT = 323,
BX_TOKEN_DISFORMAT = 324,
BX_TOKEN_SETPMEM = 325,
BX_TOKEN_SYMBOLNAME = 326,
BX_TOKEN_QUERY = 327,
BX_TOKEN_PENDING = 328,
BX_TOKEN_TAKE = 329,
BX_TOKEN_DMA = 330,
BX_TOKEN_IRQ = 331,
BX_TOKEN_DUMP_CPU = 332,
BX_TOKEN_SET_CPU = 333,
BX_TOKEN_DISASSEMBLE = 334,
BX_TOKEN_INSTRUMENT = 335,
BX_TOKEN_STRING = 336,
BX_TOKEN_STOP = 337,
BX_TOKEN_DOIT = 338,
BX_TOKEN_CRC = 339,
BX_TOKEN_TRACE = 340,
BX_TOKEN_TRACEREG = 341,
BX_TOKEN_SWITCH_MODE = 342,
BX_TOKEN_SIZE = 343,
BX_TOKEN_PTIME = 344,
BX_TOKEN_TIMEBP_ABSOLUTE = 345,
BX_TOKEN_TIMEBP = 346,
BX_TOKEN_RECORD = 347,
BX_TOKEN_PLAYBACK = 348,
BX_TOKEN_MODEBP = 349,
BX_TOKEN_PRINT_STACK = 350,
BX_TOKEN_WATCH = 351,
BX_TOKEN_UNWATCH = 352,
BX_TOKEN_READ = 353,
BX_TOKEN_WRITE = 354,
BX_TOKEN_SHOW = 355,
BX_TOKEN_LOAD_SYMBOLS = 356,
BX_TOKEN_SYMBOLS = 357,
BX_TOKEN_LIST_SYMBOLS = 358,
BX_TOKEN_GLOBAL = 359,
BX_TOKEN_WHERE = 360,
BX_TOKEN_PRINT_STRING = 361,
BX_TOKEN_NUMERIC = 362,
BX_TOKEN_LONG_NUMERIC = 363,
BX_TOKEN_NE2000 = 364,
BX_TOKEN_PIC = 365,
BX_TOKEN_PAGE = 366,
BX_TOKEN_HELP = 367,
BX_TOKEN_CALC = 368,
BX_TOKEN_VGA = 369,
BX_TOKEN_COMMAND = 370,
BX_TOKEN_RSHIFT = 371,
BX_TOKEN_LSHIFT = 372,
NEG = 373,
NOT = 374
BX_TOKEN_8BH_REG = 258,
BX_TOKEN_8BL_REG = 259,
BX_TOKEN_16B_REG = 260,
BX_TOKEN_32B_REG = 261,
BX_TOKEN_64B_REG = 262,
BX_TOKEN_CS = 263,
BX_TOKEN_ES = 264,
BX_TOKEN_SS = 265,
BX_TOKEN_DS = 266,
BX_TOKEN_FS = 267,
BX_TOKEN_GS = 268,
BX_TOKEN_FLAGS = 269,
BX_TOKEN_ON = 270,
BX_TOKEN_OFF = 271,
BX_TOKEN_CONTINUE = 272,
BX_TOKEN_STEPN = 273,
BX_TOKEN_STEP_OVER = 274,
BX_TOKEN_NEXT_STEP = 275,
BX_TOKEN_SET = 276,
BX_TOKEN_DEBUGGER = 277,
BX_TOKEN_LIST_BREAK = 278,
BX_TOKEN_VBREAKPOINT = 279,
BX_TOKEN_LBREAKPOINT = 280,
BX_TOKEN_PBREAKPOINT = 281,
BX_TOKEN_DEL_BREAKPOINT = 282,
BX_TOKEN_ENABLE_BREAKPOINT = 283,
BX_TOKEN_DISABLE_BREAKPOINT = 284,
BX_TOKEN_INFO = 285,
BX_TOKEN_QUIT = 286,
BX_TOKEN_REGISTERS = 287,
BX_TOKEN_CPU = 288,
BX_TOKEN_FPU = 289,
BX_TOKEN_SSE = 290,
BX_TOKEN_ALL = 291,
BX_TOKEN_IDT = 292,
BX_TOKEN_IVT = 293,
BX_TOKEN_GDT = 294,
BX_TOKEN_LDT = 295,
BX_TOKEN_TSS = 296,
BX_TOKEN_TAB = 297,
BX_TOKEN_DIRTY = 298,
BX_TOKEN_LINUX = 299,
BX_TOKEN_CONTROL_REGS = 300,
BX_TOKEN_EXAMINE = 301,
BX_TOKEN_XFORMAT = 302,
BX_TOKEN_DISFORMAT = 303,
BX_TOKEN_SETPMEM = 304,
BX_TOKEN_SYMBOLNAME = 305,
BX_TOKEN_QUERY = 306,
BX_TOKEN_PENDING = 307,
BX_TOKEN_TAKE = 308,
BX_TOKEN_DMA = 309,
BX_TOKEN_IRQ = 310,
BX_TOKEN_DUMP_CPU = 311,
BX_TOKEN_SET_CPU = 312,
BX_TOKEN_DISASSEMBLE = 313,
BX_TOKEN_INSTRUMENT = 314,
BX_TOKEN_STRING = 315,
BX_TOKEN_STOP = 316,
BX_TOKEN_DOIT = 317,
BX_TOKEN_CRC = 318,
BX_TOKEN_TRACE = 319,
BX_TOKEN_TRACEREG = 320,
BX_TOKEN_SWITCH_MODE = 321,
BX_TOKEN_SIZE = 322,
BX_TOKEN_PTIME = 323,
BX_TOKEN_TIMEBP_ABSOLUTE = 324,
BX_TOKEN_TIMEBP = 325,
BX_TOKEN_RECORD = 326,
BX_TOKEN_PLAYBACK = 327,
BX_TOKEN_MODEBP = 328,
BX_TOKEN_PRINT_STACK = 329,
BX_TOKEN_WATCH = 330,
BX_TOKEN_UNWATCH = 331,
BX_TOKEN_READ = 332,
BX_TOKEN_WRITE = 333,
BX_TOKEN_SHOW = 334,
BX_TOKEN_LOAD_SYMBOLS = 335,
BX_TOKEN_SYMBOLS = 336,
BX_TOKEN_LIST_SYMBOLS = 337,
BX_TOKEN_GLOBAL = 338,
BX_TOKEN_WHERE = 339,
BX_TOKEN_PRINT_STRING = 340,
BX_TOKEN_NUMERIC = 341,
BX_TOKEN_NE2000 = 342,
BX_TOKEN_PIC = 343,
BX_TOKEN_PAGE = 344,
BX_TOKEN_HELP = 345,
BX_TOKEN_CALC = 346,
BX_TOKEN_VGA = 347,
BX_TOKEN_COMMAND = 348,
BX_TOKEN_GENERIC = 349,
BX_TOKEN_RSHIFT = 350,
BX_TOKEN_LSHIFT = 351,
BX_TOKEN_REG_IP = 352,
BX_TOKEN_REG_EIP = 353,
BX_TOKEN_REG_RIP = 354,
NEG = 355,
NOT = 356
};
#endif
#define BX_TOKEN_REG_AL 258
#define BX_TOKEN_REG_BL 259
#define BX_TOKEN_REG_CL 260
#define BX_TOKEN_REG_DL 261
#define BX_TOKEN_REG_AH 262
#define BX_TOKEN_REG_BH 263
#define BX_TOKEN_REG_CH 264
#define BX_TOKEN_REG_DH 265
#define BX_TOKEN_REG_AX 266
#define BX_TOKEN_REG_BX 267
#define BX_TOKEN_REG_CX 268
#define BX_TOKEN_REG_DX 269
#define BX_TOKEN_REG_EAX 270
#define BX_TOKEN_REG_EBX 271
#define BX_TOKEN_REG_ECX 272
#define BX_TOKEN_REG_EDX 273
#define BX_TOKEN_REG_SI 274
#define BX_TOKEN_REG_DI 275
#define BX_TOKEN_REG_BP 276
#define BX_TOKEN_REG_SP 277
#define BX_TOKEN_REG_IP 278
#define BX_TOKEN_REG_ESI 279
#define BX_TOKEN_REG_EDI 280
#define BX_TOKEN_REG_EBP 281
#define BX_TOKEN_REG_ESP 282
#define BX_TOKEN_REG_EIP 283
#define BX_TOKEN_CS 284
#define BX_TOKEN_ES 285
#define BX_TOKEN_SS 286
#define BX_TOKEN_DS 287
#define BX_TOKEN_FS 288
#define BX_TOKEN_GS 289
#define BX_TOKEN_FLAGS 290
#define BX_TOKEN_ON 291
#define BX_TOKEN_OFF 292
#define BX_TOKEN_CONTINUE 293
#define BX_TOKEN_STEPN 294
#define BX_TOKEN_STEP_OVER 295
#define BX_TOKEN_NEXT_STEP 296
#define BX_TOKEN_SET 297
#define BX_TOKEN_DEBUGGER 298
#define BX_TOKEN_LIST_BREAK 299
#define BX_TOKEN_VBREAKPOINT 300
#define BX_TOKEN_LBREAKPOINT 301
#define BX_TOKEN_PBREAKPOINT 302
#define BX_TOKEN_DEL_BREAKPOINT 303
#define BX_TOKEN_ENABLE_BREAKPOINT 304
#define BX_TOKEN_DISABLE_BREAKPOINT 305
#define BX_TOKEN_INFO 306
#define BX_TOKEN_QUIT 307
#define BX_TOKEN_REGISTERS 308
#define BX_TOKEN_CPU 309
#define BX_TOKEN_FPU 310
#define BX_TOKEN_SSE 311
#define BX_TOKEN_ALL 312
#define BX_TOKEN_IDT 313
#define BX_TOKEN_IVT 314
#define BX_TOKEN_GDT 315
#define BX_TOKEN_LDT 316
#define BX_TOKEN_TSS 317
#define BX_TOKEN_TAB 318
#define BX_TOKEN_DIRTY 319
#define BX_TOKEN_LINUX 320
#define BX_TOKEN_CONTROL_REGS 321
#define BX_TOKEN_EXAMINE 322
#define BX_TOKEN_XFORMAT 323
#define BX_TOKEN_DISFORMAT 324
#define BX_TOKEN_SETPMEM 325
#define BX_TOKEN_SYMBOLNAME 326
#define BX_TOKEN_QUERY 327
#define BX_TOKEN_PENDING 328
#define BX_TOKEN_TAKE 329
#define BX_TOKEN_DMA 330
#define BX_TOKEN_IRQ 331
#define BX_TOKEN_DUMP_CPU 332
#define BX_TOKEN_SET_CPU 333
#define BX_TOKEN_DISASSEMBLE 334
#define BX_TOKEN_INSTRUMENT 335
#define BX_TOKEN_STRING 336
#define BX_TOKEN_STOP 337
#define BX_TOKEN_DOIT 338
#define BX_TOKEN_CRC 339
#define BX_TOKEN_TRACE 340
#define BX_TOKEN_TRACEREG 341
#define BX_TOKEN_SWITCH_MODE 342
#define BX_TOKEN_SIZE 343
#define BX_TOKEN_PTIME 344
#define BX_TOKEN_TIMEBP_ABSOLUTE 345
#define BX_TOKEN_TIMEBP 346
#define BX_TOKEN_RECORD 347
#define BX_TOKEN_PLAYBACK 348
#define BX_TOKEN_MODEBP 349
#define BX_TOKEN_PRINT_STACK 350
#define BX_TOKEN_WATCH 351
#define BX_TOKEN_UNWATCH 352
#define BX_TOKEN_READ 353
#define BX_TOKEN_WRITE 354
#define BX_TOKEN_SHOW 355
#define BX_TOKEN_LOAD_SYMBOLS 356
#define BX_TOKEN_SYMBOLS 357
#define BX_TOKEN_LIST_SYMBOLS 358
#define BX_TOKEN_GLOBAL 359
#define BX_TOKEN_WHERE 360
#define BX_TOKEN_PRINT_STRING 361
#define BX_TOKEN_NUMERIC 362
#define BX_TOKEN_LONG_NUMERIC 363
#define BX_TOKEN_NE2000 364
#define BX_TOKEN_PIC 365
#define BX_TOKEN_PAGE 366
#define BX_TOKEN_HELP 367
#define BX_TOKEN_CALC 368
#define BX_TOKEN_VGA 369
#define BX_TOKEN_COMMAND 370
#define BX_TOKEN_RSHIFT 371
#define BX_TOKEN_LSHIFT 372
#define NEG 373
#define NOT 374
#define BX_TOKEN_8BH_REG 258
#define BX_TOKEN_8BL_REG 259
#define BX_TOKEN_16B_REG 260
#define BX_TOKEN_32B_REG 261
#define BX_TOKEN_64B_REG 262
#define BX_TOKEN_CS 263
#define BX_TOKEN_ES 264
#define BX_TOKEN_SS 265
#define BX_TOKEN_DS 266
#define BX_TOKEN_FS 267
#define BX_TOKEN_GS 268
#define BX_TOKEN_FLAGS 269
#define BX_TOKEN_ON 270
#define BX_TOKEN_OFF 271
#define BX_TOKEN_CONTINUE 272
#define BX_TOKEN_STEPN 273
#define BX_TOKEN_STEP_OVER 274
#define BX_TOKEN_NEXT_STEP 275
#define BX_TOKEN_SET 276
#define BX_TOKEN_DEBUGGER 277
#define BX_TOKEN_LIST_BREAK 278
#define BX_TOKEN_VBREAKPOINT 279
#define BX_TOKEN_LBREAKPOINT 280
#define BX_TOKEN_PBREAKPOINT 281
#define BX_TOKEN_DEL_BREAKPOINT 282
#define BX_TOKEN_ENABLE_BREAKPOINT 283
#define BX_TOKEN_DISABLE_BREAKPOINT 284
#define BX_TOKEN_INFO 285
#define BX_TOKEN_QUIT 286
#define BX_TOKEN_REGISTERS 287
#define BX_TOKEN_CPU 288
#define BX_TOKEN_FPU 289
#define BX_TOKEN_SSE 290
#define BX_TOKEN_ALL 291
#define BX_TOKEN_IDT 292
#define BX_TOKEN_IVT 293
#define BX_TOKEN_GDT 294
#define BX_TOKEN_LDT 295
#define BX_TOKEN_TSS 296
#define BX_TOKEN_TAB 297
#define BX_TOKEN_DIRTY 298
#define BX_TOKEN_LINUX 299
#define BX_TOKEN_CONTROL_REGS 300
#define BX_TOKEN_EXAMINE 301
#define BX_TOKEN_XFORMAT 302
#define BX_TOKEN_DISFORMAT 303
#define BX_TOKEN_SETPMEM 304
#define BX_TOKEN_SYMBOLNAME 305
#define BX_TOKEN_QUERY 306
#define BX_TOKEN_PENDING 307
#define BX_TOKEN_TAKE 308
#define BX_TOKEN_DMA 309
#define BX_TOKEN_IRQ 310
#define BX_TOKEN_DUMP_CPU 311
#define BX_TOKEN_SET_CPU 312
#define BX_TOKEN_DISASSEMBLE 313
#define BX_TOKEN_INSTRUMENT 314
#define BX_TOKEN_STRING 315
#define BX_TOKEN_STOP 316
#define BX_TOKEN_DOIT 317
#define BX_TOKEN_CRC 318
#define BX_TOKEN_TRACE 319
#define BX_TOKEN_TRACEREG 320
#define BX_TOKEN_SWITCH_MODE 321
#define BX_TOKEN_SIZE 322
#define BX_TOKEN_PTIME 323
#define BX_TOKEN_TIMEBP_ABSOLUTE 324
#define BX_TOKEN_TIMEBP 325
#define BX_TOKEN_RECORD 326
#define BX_TOKEN_PLAYBACK 327
#define BX_TOKEN_MODEBP 328
#define BX_TOKEN_PRINT_STACK 329
#define BX_TOKEN_WATCH 330
#define BX_TOKEN_UNWATCH 331
#define BX_TOKEN_READ 332
#define BX_TOKEN_WRITE 333
#define BX_TOKEN_SHOW 334
#define BX_TOKEN_LOAD_SYMBOLS 335
#define BX_TOKEN_SYMBOLS 336
#define BX_TOKEN_LIST_SYMBOLS 337
#define BX_TOKEN_GLOBAL 338
#define BX_TOKEN_WHERE 339
#define BX_TOKEN_PRINT_STRING 340
#define BX_TOKEN_NUMERIC 341
#define BX_TOKEN_NE2000 342
#define BX_TOKEN_PIC 343
#define BX_TOKEN_PAGE 344
#define BX_TOKEN_HELP 345
#define BX_TOKEN_CALC 346
#define BX_TOKEN_VGA 347
#define BX_TOKEN_COMMAND 348
#define BX_TOKEN_GENERIC 349
#define BX_TOKEN_RSHIFT 350
#define BX_TOKEN_LSHIFT 351
#define BX_TOKEN_REG_IP 352
#define BX_TOKEN_REG_EIP 353
#define BX_TOKEN_REG_RIP 354
#define NEG 355
#define NOT 356
@ -273,13 +237,12 @@
#line 19 "parser.y"
typedef union YYSTYPE {
char *sval;
Bit32u uval;
Bit64u ulval;
Bit64u uval;
bx_bool bval;
bx_num_range uval_range;
} YYSTYPE;
/* Line 1252 of yacc.c. */
#line 283 "y.tab.h"
#line 246 "y.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parser.y,v 1.13 2006-02-12 20:21:36 sshwarts Exp $
// $Id: parser.y,v 1.14 2006-02-13 18:28:14 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
%{
@ -18,47 +18,21 @@
%union {
char *sval;
Bit32u uval;
Bit64u ulval;
Bit64u uval;
bx_bool bval;
bx_num_range uval_range;
}
// Common registers
%type <uval> BX_TOKEN_8BH_REG
%type <uval> BX_TOKEN_8BL_REG
%type <uval> BX_TOKEN_16B_REG
%type <uval> BX_TOKEN_32B_REG
%type <uval> BX_TOKEN_NONSEG_REG
%type <uval> BX_TOKEN_SEGREG
%type <bval> BX_TOKEN_TOGGLE_ON_OFF
%token <uval> BX_TOKEN_REG_AL
%token <uval> BX_TOKEN_REG_BL
%token <uval> BX_TOKEN_REG_CL
%token <uval> BX_TOKEN_REG_DL
%token <uval> BX_TOKEN_REG_AH
%token <uval> BX_TOKEN_REG_BH
%token <uval> BX_TOKEN_REG_CH
%token <uval> BX_TOKEN_REG_DH
%token <uval> BX_TOKEN_REG_AX
%token <uval> BX_TOKEN_REG_BX
%token <uval> BX_TOKEN_REG_CX
%token <uval> BX_TOKEN_REG_DX
%token <uval> BX_TOKEN_REG_EAX
%token <uval> BX_TOKEN_REG_EBX
%token <uval> BX_TOKEN_REG_ECX
%token <uval> BX_TOKEN_REG_EDX
%token <uval> BX_TOKEN_REG_SI
%token <uval> BX_TOKEN_REG_DI
%token <uval> BX_TOKEN_REG_BP
%token <uval> BX_TOKEN_REG_SP
%token <uval> BX_TOKEN_REG_IP
%token <uval> BX_TOKEN_REG_ESI
%token <uval> BX_TOKEN_REG_EDI
%token <uval> BX_TOKEN_REG_EBP
%token <uval> BX_TOKEN_REG_ESP
%token <uval> BX_TOKEN_REG_EIP
%token <uval> BX_TOKEN_8BH_REG
%token <uval> BX_TOKEN_8BL_REG
%token <uval> BX_TOKEN_16B_REG
%token <uval> BX_TOKEN_32B_REG
%token <uval> BX_TOKEN_64B_REG
%token <uval> BX_TOKEN_CS
%token <uval> BX_TOKEN_ES
%token <uval> BX_TOKEN_SS
@ -138,7 +112,6 @@
%token <sval> BX_TOKEN_WHERE
%token <sval> BX_TOKEN_PRINT_STRING
%token <uval> BX_TOKEN_NUMERIC
%token <ulval> BX_TOKEN_LONG_NUMERIC
%token <sval> BX_TOKEN_NE2000
%token <sval> BX_TOKEN_PIC
%token <sval> BX_TOKEN_PAGE
@ -146,12 +119,16 @@
%token <sval> BX_TOKEN_CALC
%token <sval> BX_TOKEN_VGA
%token <sval> BX_TOKEN_COMMAND
%token <sval> BX_TOKEN_GENERIC
%token BX_TOKEN_RSHIFT
%token BX_TOKEN_LSHIFT
%token BX_TOKEN_REG_IP
%token BX_TOKEN_REG_EIP
%token BX_TOKEN_REG_RIP
%type <uval> optional_numeric
%type <uval_range> numeric_range optional_numeric_range
%type <ulval> vexpression
%type <ulval> expression
%type <uval> vexpression
%type <uval> expression
%left '+' '-' '|' '^'
%left '*' '/' '&' BX_TOKEN_LSHIFT BX_TOKEN_RSHIFT
@ -227,12 +204,12 @@ BX_TOKEN_SEGREG:
;
timebp_command:
BX_TOKEN_TIMEBP BX_TOKEN_LONG_NUMERIC '\n'
BX_TOKEN_TIMEBP BX_TOKEN_NUMERIC '\n'
{
bx_dbg_timebp_command(0, $2);
free($1);
}
| BX_TOKEN_TIMEBP_ABSOLUTE BX_TOKEN_LONG_NUMERIC '\n'
| BX_TOKEN_TIMEBP_ABSOLUTE BX_TOKEN_NUMERIC '\n'
{
bx_dbg_timebp_command(1, $2);
free($1);
@ -448,6 +425,10 @@ set_command:
{
bx_dbg_set_reg32_value($2, $4);
}
| BX_TOKEN_SET BX_TOKEN_64B_REG '=' expression '\n'
{
bx_dbg_set_reg64_value($2, $4);
}
;
breakpoint_command:
@ -1061,65 +1042,27 @@ calc_command:
}
;
BX_TOKEN_8BH_REG:
BX_TOKEN_REG_AH
| BX_TOKEN_REG_BH
| BX_TOKEN_REG_CH
| BX_TOKEN_REG_DH
{ $$=$1; }
;
BX_TOKEN_8BL_REG:
BX_TOKEN_REG_AL
| BX_TOKEN_REG_BL
| BX_TOKEN_REG_CL
| BX_TOKEN_REG_DL
{ $$=$1; }
;
BX_TOKEN_16B_REG:
BX_TOKEN_REG_AX
| BX_TOKEN_REG_BX
| BX_TOKEN_REG_CX
| BX_TOKEN_REG_DX
| BX_TOKEN_REG_SI
| BX_TOKEN_REG_DI
| BX_TOKEN_REG_BP
| BX_TOKEN_REG_SP
{ $$=$1; }
;
BX_TOKEN_32B_REG:
BX_TOKEN_REG_EAX
| BX_TOKEN_REG_EBX
| BX_TOKEN_REG_ECX
| BX_TOKEN_REG_EDX
| BX_TOKEN_REG_ESI
| BX_TOKEN_REG_EDI
| BX_TOKEN_REG_EBP
| BX_TOKEN_REG_ESP
{ $$=$1; }
;
BX_TOKEN_NONSEG_REG:
BX_TOKEN_8BL_REG
| BX_TOKEN_8BH_REG
| BX_TOKEN_16B_REG
| BX_TOKEN_32B_REG
| BX_TOKEN_64B_REG
{ $$=$1; }
;
/* Arithmetic expression for vbreak command */
vexpression:
BX_TOKEN_NUMERIC { $$ = $1; }
| BX_TOKEN_LONG_NUMERIC { $$ = $1; }
| BX_TOKEN_8BL_REG { $$ = bx_dbg_get_reg8l_value($1); }
| BX_TOKEN_8BH_REG { $$ = bx_dbg_get_reg8h_value($1); }
| BX_TOKEN_16B_REG { $$ = bx_dbg_get_reg16_value($1); }
| BX_TOKEN_32B_REG { $$ = bx_dbg_get_reg32_value($1); }
| BX_TOKEN_64B_REG { $$ = bx_dbg_get_reg64_value($1); }
| BX_TOKEN_SEGREG { $$ = bx_dbg_get_selector_value($1); }
| BX_TOKEN_REG_IP { $$ = bx_dbg_get_ip (); }
| BX_TOKEN_REG_EIP { $$ = bx_dbg_get_eip(); }
| BX_TOKEN_REG_RIP { $$ = bx_dbg_get_instruction_pointer(); }
| vexpression '+' vexpression { $$ = $1 + $3; }
| vexpression '-' vexpression { $$ = $1 - $3; }
| vexpression '*' vexpression { $$ = $1 * $3; }
@ -1137,15 +1080,16 @@ vexpression:
/* Same as vexpression but includes the ':' operator - used in most commands */
expression:
BX_TOKEN_NUMERIC { $$ = $1; }
| BX_TOKEN_LONG_NUMERIC { $$ = $1; }
| BX_TOKEN_STRING { $$ = bx_dbg_get_symbol_value($1); free($1);}
| BX_TOKEN_8BL_REG { $$ = bx_dbg_get_reg8l_value($1); }
| BX_TOKEN_8BH_REG { $$ = bx_dbg_get_reg8h_value($1); }
| BX_TOKEN_16B_REG { $$ = bx_dbg_get_reg16_value($1); }
| BX_TOKEN_32B_REG { $$ = bx_dbg_get_reg32_value($1); }
| BX_TOKEN_64B_REG { $$ = bx_dbg_get_reg64_value($1); }
| BX_TOKEN_SEGREG { $$ = bx_dbg_get_selector_value($1); }
| BX_TOKEN_REG_IP { $$ = bx_dbg_get_ip (); }
| BX_TOKEN_REG_EIP { $$ = bx_dbg_get_eip(); }
| BX_TOKEN_REG_RIP { $$ = bx_dbg_get_instruction_pointer(); }
| expression ':' expression { $$ = bx_dbg_get_laddr ($1, $3); }
| expression '+' expression { $$ = $1 + $3; }
| expression '-' expression { $$ = $1 - $3; }