[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-cvs
Subject: [Bochs-cvs] [12553] trunk/bochs
From: sshwarts () users ! sourceforge ! net
Date: 2014-11-15 22:03:54
Message-ID: E1XplRm-00008o-1Y () sfs-ml-4 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 12553
Author: sshwarts
Date: 2014-11-15 22:03:52 +0000 (Sat, 15 Nov 2014)
Log Message:
-----------
added ability to dump Bochs param tree in XML format
Modified Paths:
--------------
trunk/bochs/bochs.h
trunk/bochs/bx_debug/dbg_main.cc
trunk/bochs/bx_debug/debug.h
trunk/bochs/bx_debug/lexer.c
trunk/bochs/bx_debug/lexer.l
trunk/bochs/bx_debug/parser.c
trunk/bochs/bx_debug/parser.h
trunk/bochs/bx_debug/parser.y
trunk/bochs/main.cc
Modified: trunk/bochs/bochs.h
===================================================================
--- trunk/bochs/bochs.h 2014-11-15 13:33:18 UTC (rev 12552)
+++ trunk/bochs/bochs.h 2014-11-15 22:03:52 UTC (rev 12553)
@@ -133,7 +133,7 @@
Bit32u crc32(const Bit8u *buf, int len);
// used to print param tree from debugger
-void print_tree(bx_param_c *node, int level = 0);
+void print_tree(bx_param_c *node, int level = 0, bx_bool xml = BX_FALSE);
#if BX_ENABLE_STATISTICS
// print statistics
Modified: trunk/bochs/bx_debug/dbg_main.cc
===================================================================
--- trunk/bochs/bx_debug/dbg_main.cc 2014-11-15 13:33:18 UTC (rev 12552)
+++ trunk/bochs/bx_debug/dbg_main.cc 2014-11-15 22:03:52 UTC (rev 12553)
@@ -1468,7 +1468,7 @@
Bit32u index = BX_TLB_INDEX_OF(laddr, 0);
char cpu_param_name[16];
sprintf(cpu_param_name, "TLB.entry%d", index);
- bx_dbg_show_param_command(cpu_param_name);
+ bx_dbg_show_param_command(cpu_param_name, 0);
}
unsigned dbg_show_mask = 0;
@@ -1575,17 +1575,17 @@
}
}
-void bx_dbg_show_param_command(const char *param)
+void bx_dbg_show_param_command(const char *param, bx_bool xml)
{
dbg_printf("show param name: <%s>\n", param);
bx_param_c *node = SIM->get_param(param, SIM->get_bochs_root());
if (node) {
- print_tree(node, 0);
+ print_tree(node, 0, xml);
}
else {
node = SIM->get_param(param, dbg_cpu_list);
if (node)
- print_tree(node, 0);
+ print_tree(node, 0, xml);
else
dbg_printf("can't find param <%s> in global or default CPU tree\n", param);
}
Modified: trunk/bochs/bx_debug/debug.h
===================================================================
--- trunk/bochs/bx_debug/debug.h 2014-11-15 13:33:18 UTC (rev 12552)
+++ trunk/bochs/bx_debug/debug.h 2014-11-15 22:03:52 UTC (rev 12553)
@@ -326,7 +326,7 @@
// commands that work with Bochs param tree
void bx_dbg_restore_command(const char *param_name, const char *path);
-void bx_dbg_show_param_command(const char *param);
+void bx_dbg_show_param_command(const char *param, bx_bool xml);
int bx_dbg_show_symbolic(void);
void bx_dbg_set_symbol_command(const char *symbol, bx_address val);
Modified: trunk/bochs/bx_debug/lexer.c
===================================================================
(Binary files differ)
Modified: trunk/bochs/bx_debug/lexer.l
===================================================================
--- trunk/bochs/bx_debug/lexer.l 2014-11-15 13:33:18 UTC (rev 12552)
+++ trunk/bochs/bx_debug/lexer.l 2014-11-15 22:03:52 UTC (rev 12553)
@@ -228,6 +228,7 @@
gs { bxlval.uval = BX_DBG_SREG_GS; return(BX_TOKEN_GS); }
k[0-7] { EVEX_OPMASK_REG(bxtext[1] - '0'); }
flags|eflags { bxlval.uval = 0; return (BX_TOKEN_FLAGS); }
+xml { bxlval.sval = strdup(bxtext); return(BX_TOKEN_XML); }
h|help { bxlval.sval = strdup(bxtext); return(BX_TOKEN_HELP); }
\? |
calc { bxlval.sval = strdup(bxtext); return(BX_TOKEN_CALC); }
Modified: trunk/bochs/bx_debug/parser.c
===================================================================
(Binary files differ)
Modified: trunk/bochs/bx_debug/parser.h
===================================================================
(Binary files differ)
Modified: trunk/bochs/bx_debug/parser.y
===================================================================
--- trunk/bochs/bx_debug/parser.y 2014-11-15 13:33:18 UTC (rev 12552)
+++ trunk/bochs/bx_debug/parser.y 2014-11-15 22:03:52 UTC (rev 12553)
@@ -116,6 +116,7 @@
%token <uval> BX_TOKEN_NUMERIC
%token <sval> BX_TOKEN_PAGE
%token <sval> BX_TOKEN_HELP
+%token <sval> BX_TOKEN_XML
%token <sval> BX_TOKEN_CALC
%token <sval> BX_TOKEN_DEVICE
%token <sval> BX_TOKEN_GENERIC
@@ -264,9 +265,14 @@
}
| BX_TOKEN_SHOW BX_TOKEN_STRING '\n'
{
- bx_dbg_show_param_command($2);
+ bx_dbg_show_param_command($2, 0);
free($1); free($2);
}
+ | BX_TOKEN_SHOW BX_TOKEN_STRING BX_TOKEN_XML '\n'
+ {
+ bx_dbg_show_param_command($2, 1);
+ free($1); free($2); free($3);
+ }
| BX_TOKEN_SHOW '\n'
{
bx_dbg_show_command(0);
Modified: trunk/bochs/main.cc
===================================================================
--- trunk/bochs/main.cc 2014-11-15 13:33:18 UTC (rev 12552)
+++ trunk/bochs/main.cc 2014-11-15 22:03:52 UTC (rev 12553)
@@ -183,7 +183,7 @@
#endif
#if BX_DEBUGGER
-void print_tree(bx_param_c *node, int level)
+void print_tree(bx_param_c *node, int level, bx_bool xml)
{
int i;
char tmpstr[BX_PATHNAME_LEN];
@@ -194,43 +194,56 @@
dbg_printf("NULL pointer\n");
return;
}
+
+ if (xml)
+ dbg_printf("<%s>", node->get_name());
+ else
+ dbg_printf("%s = ", node->get_name());
+
switch (node->get_type()) {
case BXT_PARAM_NUM:
if (((bx_param_num_c*)node)->get_base() == BASE_DEC) {
- dbg_printf("%s = " FMT_LL "d (number)\n", node->get_name(), \
((bx_param_num_c*)node)->get64()); + dbg_printf("" FMT_LL "d (number)", \
((bx_param_num_c*)node)->get64()); } else {
- dbg_printf("%s = 0x" FMT_LL "x (hex number)\n", node->get_name(), \
((bx_param_num_c*)node)->get64()); + dbg_printf("0x" FMT_LL "x (hex number)", \
((bx_param_num_c*)node)->get64()); }
break;
case BXT_PARAM_BOOL:
- dbg_printf("%s = %s (boolean)\n", node->get_name(), \
((bx_param_bool_c*)node)->get()?"true":"false"); + dbg_printf("%s (boolean)", \
((bx_param_bool_c*)node)->get()?"true":"false"); break;
case BXT_PARAM_ENUM:
- dbg_printf("%s = '%s' (enum)\n", node->get_name(), \
((bx_param_enum_c*)node)->get_selected()); + dbg_printf("'%s' (enum)", \
((bx_param_enum_c*)node)->get_selected()); break;
case BXT_PARAM_STRING:
((bx_param_string_c*)node)->sprint(tmpstr, BX_PATHNAME_LEN, 0);
if (((bx_param_string_c*)node)->get_options() & bx_param_string_c::RAW_BYTES) \
{
- dbg_printf("%s = '%s' (raw byte string)\n", node->get_name(), tmpstr);
+ dbg_printf("'%s' (raw byte string)", tmpstr);
} else {
- dbg_printf("%s = '%s' (string)\n", node->get_name(), tmpstr);
+ dbg_printf("'%s' (string)", tmpstr);
}
break;
case BXT_LIST:
{
- dbg_printf("%s = \n", node->get_name());
+ dbg_printf("\n");
bx_list_c *list = (bx_list_c*)node;
for (i=0; i < list->get_size(); i++) {
- print_tree(list->get(i), level+1);
+ print_tree(list->get(i), level+1, xml);
}
+ if (xml) {
+ for (i=0; i<level; i++)
+ dbg_printf(" ");
+ }
break;
}
case BXT_PARAM_DATA:
- dbg_printf("%s = 'size=%d' (binary data)\n", node->get_name(), \
((bx_shadow_data_c*)node)->get_size()); + dbg_printf("'size=%d' (binary data)", \
((bx_shadow_data_c*)node)->get_size()); break;
default:
- dbg_printf("%s (unknown parameter type)\n", node->get_name());
+ dbg_printf("(unknown parameter type)");
}
+
+ if (xml) dbg_printf("</%s>", node->get_name());
+ dbg_printf("\n");
}
#endif
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic