Implemented new debugger 'page' command according to feature request

[ bochs-Feature Requests-604221 ] Debugger command: query lin<->phys mapping
This commit is contained in:
Stanislav Shwartsman 2007-09-23 21:10:06 +00:00
parent 208caf109b
commit 6b86091441
5 changed files with 1898 additions and 1488 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.94 2007-07-09 14:57:33 sshwarts Exp $
// $Id: dbg_main.cc,v 1.95 2007-09-23 21:10:06 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -713,7 +713,7 @@ next_page:
}
}
else {
dbg_printf("bx_dbg_read_linear: physical address not available for linear " FMT_ADDRX "\n", laddr);
dbg_printf("bx_dbg_read_linear: physical address not available for linear 0x" FMT_ADDRX "\n", laddr);
return 0;
}
@ -813,6 +813,20 @@ static void dbg_print_guard_found(unsigned cpu_mode, Bit32u cs, bx_address eip,
dbg_printf("%04x:%04x (0x%08x)", cs, (unsigned) eip, (unsigned) laddr);
}
void bx_dbg_xlate_address(bx_lin_address laddr)
{
bx_phy_address paddr;
laddr &= BX_CONST64(0xfffffffffffff000);
bx_bool paddr_valid = BX_CPU(which_cpu)->dbg_xlate_linear2phy(laddr, &paddr);
if (paddr_valid) {
dbg_printf("linear page 0x" FMT_ADDRX " maps to physical page 0x%08x\n", laddr, paddr);
}
else {
dbg_printf("physical address not available for linear 0x" FMT_ADDRX "\n", laddr);
}
}
unsigned dbg_show_mask = 0;
#define BX_DBG_SHOW_CALLRET (Flag_call|Flag_ret)
@ -1227,7 +1241,7 @@ one_more:
// execute. Even this is tricky with SMP because one might
// have hit a breakpoint, while others executed the whole
// quantum.
int max_executed = 0;
Bit32u max_executed = 0;
for (cpu=0; cpu<BX_SMP_PROCESSORS; cpu++) {
if (BX_CPU(cpu)->guard_found.icount > max_executed)
max_executed = BX_CPU(cpu)->guard_found.icount;
@ -2661,7 +2675,6 @@ void bx_dbg_print_descriptor(unsigned char desc[8], int verbose)
{
Bit32u lo = (desc[3] << 24) | (desc[2] << 16) | (desc[1] << 8) | (desc[0]);
Bit32u hi = (desc[7] << 24) | (desc[6] << 16) | (desc[5] << 8) | (desc[4]);
//dbg_printf("Descriptor hi,lo = %08x,%08x\n", hi, lo);
Bit32u base = ((lo >> 16) & 0xffff)
| ((hi << 16) & 0xff0000)
| (hi & 0xff000000);
@ -3220,7 +3233,7 @@ void bx_dbg_dump_table(void)
return;
}
printf("cr3: " FMT_ADDRX "\n", BX_CPU(dbg_cpu)->cr3);
printf("cr3: 0x" FMT_ADDRX "\n", BX_CPU(dbg_cpu)->cr3);
lin = 0;
phy = 0;
@ -3267,7 +3280,7 @@ void bx_dbg_print_help(void)
dbg_printf(" bpe, bpd, d|del|delete\n");
dbg_printf("-*- CPU and memory contents -*-\n");
dbg_printf(" x, xp, u|disasm|disassemble, r|reg|regs|registers, setpmem, crc, info,\n");
dbg_printf(" set, dump_cpu, set_cpu, ptime, print-stack, watch, unwatch, ?|calc\n");
dbg_printf(" page, set, 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.30 2006-10-24 17:53:47 vruppert Exp $
// $Id: debug.h,v 1.31 2007-09-23 21:10:06 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -234,6 +234,7 @@ void bx_dbg_playback_command(char*);
void bx_dbg_modebp_command(void);
void bx_dbg_where_command(void);
void bx_dbg_print_string_command(bx_address addr);
void bx_dbg_xlate_address(bx_lin_address address);
void bx_dbg_show_command(const char*);
void bx_dbg_show_param_command(char *param);
void bx_dbg_print_stack_command(unsigned nwords);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,9 @@
/* A Bison parser, made by GNU Bison 1.875b. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,13 +17,21 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
@ -130,6 +140,7 @@
NOT = 356
};
#endif
/* Tokens. */
#define BX_TOKEN_8BH_REG 258
#define BX_TOKEN_8BL_REG 259
#define BX_TOKEN_16B_REG 260
@ -233,15 +244,17 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 13 "parser.y"
typedef union YYSTYPE {
{
char *sval;
Bit64u uval;
bx_bool bval;
} YYSTYPE;
/* Line 1252 of yacc.c. */
#line 245 "y.tab.h"
}
/* Line 1489 of yacc.c. */
#line 257 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
@ -249,5 +262,3 @@ typedef union YYSTYPE {
extern YYSTYPE bxlval;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parser.y,v 1.20 2006-10-21 21:28:20 sshwarts Exp $
// $Id: parser.y,v 1.21 2007-09-23 21:10:06 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
%{
@ -167,6 +167,7 @@ command:
| modebp_command
| print_stack_command
| watch_point_command
| page_command
| show_command
| symbol_command
| where_command
@ -250,6 +251,14 @@ show_command:
}
;
page_command:
BX_TOKEN_PAGE BX_TOKEN_NUMERIC '\n'
{
bx_dbg_xlate_address($2);
free($1);
}
;
ptime_command:
BX_TOKEN_PTIME '\n'
{
@ -992,6 +1001,11 @@ help_command:
dbg_printf("set u|disasm|disassemble off - same as 'set $auto_disassemble = 0'\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_PAGE '\n'
{
dbg_printf("page <laddr> - show linear to physical xlation for linear address laddr\n");
free($1);free($2);
}
| BX_TOKEN_HELP BX_TOKEN_INFO '\n'
{
dbg_printf("info break - show information about current breakpoint status\n");