Added capability to use the gui debugger output window as a log viewer

This commit is contained in:
Volker Ruppert 2014-01-13 21:31:14 +00:00
parent 05de03bf59
commit 4c6481578d
5 changed files with 35 additions and 6 deletions

View File

@ -8,7 +8,7 @@
// //
// Modified by Bruce Ewing // Modified by Bruce Ewing
// //
// Copyright (C) 2008-2013 The Bochs Project // Copyright (C) 2008-2014 The Bochs Project
#include "config.h" #include "config.h"
@ -76,6 +76,7 @@ bx_bool ignoreNxtT = TRUE; // Do not show "Next at t=" output lines
bx_bool ignSSDisasm = TRUE; // Do not show extra disassembly line at each break bx_bool ignSSDisasm = TRUE; // Do not show extra disassembly line at each break
int UprCase = 0; // 1 = convert all Asm, Register names, Register values to uppercase int UprCase = 0; // 1 = convert all Asm, Register names, Register values to uppercase
int DumpInAsciiMode = 3; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal int DumpInAsciiMode = 3; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal
bx_bool LogView = 0; // Send log to output window
bx_bool isLittleEndian = TRUE; bx_bool isLittleEndian = TRUE;
int DefaultAsmLines = 512; // default # of asm lines disassembled and "cached" int DefaultAsmLines = 512; // default # of asm lines disassembled and "cached"
@ -3382,6 +3383,12 @@ void ActivateMenuItem (int cmd)
ResizeColmns = TRUE; // column widths are font dependent ResizeColmns = TRUE; // column widths are font dependent
if (NewFont() != FALSE) if (NewFont() != FALSE)
VSizeChange(); VSizeChange();
break;
case CMD_LOGVIEW: // Toggle sending log to output window
LogView ^= 1;
SIM->set_log_viewer(LogView);
break;
} }
} }
@ -3419,6 +3426,12 @@ BxEvent *enh_dbg_notify_callback(void *unused, BxEvent *event)
ParseIDText(event->u.logmsg.msg); ParseIDText(event->u.logmsg.msg);
return event; return event;
} }
case BX_ASYNC_EVT_LOG_MSG:
if (LogView) {
ParseIDText(event->u.logmsg.msg);
free((void*)event->u.logmsg.msg);
return event;
}
default: default:
return (*old_callback)(old_callback_arg, event); return (*old_callback)(old_callback_arg, event);
} }

View File

@ -8,7 +8,7 @@
// //
// Modified by Bruce Ewing // Modified by Bruce Ewing
// //
// Copyright (C) 2008-2013 The Bochs Project // Copyright (C) 2008-2014 The Bochs Project
#ifndef BX_ENH_DBG_DEF_H #ifndef BX_ENH_DBG_DEF_H
@ -87,6 +87,7 @@ extern bx_bool vgaw_refresh;
#define CHK_CMD_IGNNT CMD_IGNNT #define CHK_CMD_IGNNT CMD_IGNNT
#define CHK_CMD_RCLR CMD_RCLR #define CHK_CMD_RCLR CMD_RCLR
#define CHK_CMD_EREG CMD_EREG #define CHK_CMD_EREG CMD_EREG
#define CHK_CMD_LOGVIEW CMD_LOGVIEW
#else // GTK+ #else // GTK+
@ -110,6 +111,7 @@ extern bx_bool vgaw_refresh;
#define XMM_R 16 #define XMM_R 16
#define D_REG 17 #define D_REG 17
//#define T_REG 18 //#define T_REG 18
#define LOG_VIEW 19
#define CHK_CMD_MODEB MODE_BRK #define CHK_CMD_MODEB MODE_BRK
#define CHK_CMD_ONECPU ONE_CPU #define CHK_CMD_ONECPU ONE_CPU
@ -123,6 +125,7 @@ extern bx_bool vgaw_refresh;
#define CHK_CMD_IGNNT IGN_NT #define CHK_CMD_IGNNT IGN_NT
#define CHK_CMD_RCLR R_CLR #define CHK_CMD_RCLR R_CLR
#define CHK_CMD_EREG E_REG #define CHK_CMD_EREG E_REG
#define CHK_CMD_LOGVIEW LOG_VIEW
#endif #endif
@ -165,6 +168,7 @@ extern bx_bool ignoreNxtT; // Do not show "Next at t=" output lines
extern bx_bool ignSSDisasm; // Do not show extra disassembly line at each break extern bx_bool ignSSDisasm; // Do not show extra disassembly line at each break
extern int UprCase; // 1 = convert all Asm, Register names, Register values to uppercase extern int UprCase; // 1 = convert all Asm, Register names, Register values to uppercase
extern int DumpInAsciiMode; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal extern int DumpInAsciiMode; // bit 1 = show ASCII in dumps, bit 2 = show hex, value=0 is illegal
extern bx_bool LogView; // Send log to output window
extern bx_bool isLittleEndian; extern bx_bool isLittleEndian;

View File

@ -8,7 +8,7 @@
// //
// Modified by Bruce Ewing // Modified by Bruce Ewing
// //
// Copyright (C) 2008-2013 The Bochs Project // Copyright (C) 2008-2014 The Bochs Project
#include "config.h" #include "config.h"
@ -65,8 +65,8 @@ void ActivateMenuItem (int LW);
void SetMemLine (int L); void SetMemLine (int L);
void MakeBL(TreeParent *tp, bx_param_c *p); void MakeBL(TreeParent *tp, bx_param_c *p);
#define NUM_CHKS 24 // slight overestimate of # of Optmenu items with checkmarks #define NUM_CHKS 25 // slight overestimate of # of Optmenu items with checkmarks
#define WSChkIdx 19 // "checkmark index" of the first "wordsize" menu item #define WSChkIdx 20 // "checkmark index" of the first "wordsize" menu item
// reverse mapping from command indexes to menu item widgets // reverse mapping from command indexes to menu item widgets
GtkWidget *Cmd2MI[CMD_IDX_HI - CMD_IDX_LO + 1]; GtkWidget *Cmd2MI[CMD_IDX_HI - CMD_IDX_LO + 1];
@ -144,6 +144,7 @@ GtkWidget *sep4;
GtkWidget *sep5; GtkWidget *sep5;
GtkWidget *sep6; GtkWidget *sep6;
GtkWidget *sep7; GtkWidget *sep7;
GtkWidget *sep10;
GtkWidget *sep8; // separators around the ListViews GtkWidget *sep8; // separators around the ListViews
GtkWidget *sep9; GtkWidget *sep9;
@ -336,6 +337,7 @@ void InitMenus()
ChkMIs[XMM_R] = gtk_check_menu_item_new_with_label("Show SSE Registers\t\tCtrl+F4"); ChkMIs[XMM_R] = gtk_check_menu_item_new_with_label("Show SSE Registers\t\tCtrl+F4");
ChkMIs[D_REG] = gtk_check_menu_item_new_with_label("Show Debug Registers\t\tShift+F4"); ChkMIs[D_REG] = gtk_check_menu_item_new_with_label("Show Debug Registers\t\tShift+F4");
// ChkMIs[T_REG] = gtk_check_menu_item_new_with_label("Show Test Registers"); // ChkMIs[T_REG] = gtk_check_menu_item_new_with_label("Show Test Registers");
ChkMIs[LOG_VIEW] = gtk_check_menu_item_new_with_label("Show log in output window");
ChkMIs[WSChkIdx] = gtk_check_menu_item_new_with_label("1 byte\t\tAlt+1"); ChkMIs[WSChkIdx] = gtk_check_menu_item_new_with_label("1 byte\t\tAlt+1");
ChkMIs[WSChkIdx+1] = gtk_check_menu_item_new_with_label("2 bytes\t\tAlt+2"); ChkMIs[WSChkIdx+1] = gtk_check_menu_item_new_with_label("2 bytes\t\tAlt+2");
ChkMIs[WSChkIdx+2] = gtk_check_menu_item_new_with_label("4 bytes\t\tAlt+4"); ChkMIs[WSChkIdx+2] = gtk_check_menu_item_new_with_label("4 bytes\t\tAlt+4");
@ -352,6 +354,7 @@ void InitMenus()
sep5 = gtk_separator_menu_item_new(); sep5 = gtk_separator_menu_item_new();
sep6 = gtk_separator_menu_item_new(); sep6 = gtk_separator_menu_item_new();
sep7 = gtk_separator_menu_item_new(); sep7 = gtk_separator_menu_item_new();
sep10 = gtk_separator_menu_item_new();
// insert all the menu items into each menu // insert all the menu items into each menu
gtk_menu_shell_append(GTK_MENU_SHELL(CmdMenu), ContMI); gtk_menu_shell_append(GTK_MENU_SHELL(CmdMenu), ContMI);
@ -405,6 +408,8 @@ void InitMenus()
gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[XMM_R]); gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[XMM_R]);
gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[D_REG]); gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[D_REG]);
// gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[T_REG]); // gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[T_REG]);
gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), sep10);
gtk_menu_shell_append(GTK_MENU_SHELL(OptMenu), ChkMIs[LOG_VIEW]);
gtk_menu_shell_append(GTK_MENU_SHELL(HelpMenu), AboutMI); gtk_menu_shell_append(GTK_MENU_SHELL(HelpMenu), AboutMI);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(WrdSizeMI), WSmenu); // set up popup menu gtk_menu_item_set_submenu(GTK_MENU_ITEM(WrdSizeMI), WSmenu); // set up popup menu
@ -432,6 +437,7 @@ void InitMenus()
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[IGN_SA]), ignSSDisasm); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[IGN_SA]), ignSSDisasm);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[IGN_NT]), ignoreNxtT); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[IGN_NT]), ignoreNxtT);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[R_CLR]), SeeRegColors); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[R_CLR]), SeeRegColors);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[LOG_VIEW]), LogView);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[WSChkIdx]), TRUE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ChkMIs[WSChkIdx]), TRUE);
if (DumpInAsciiMode == 0) // prevent an illegal value if (DumpInAsciiMode == 0) // prevent an illegal value
DumpInAsciiMode = 3; DumpInAsciiMode = 3;
@ -1747,6 +1753,7 @@ void AttachSignals()
Cmd2MI[CMD_DREG - CMD_IDX_LO + 1] = ChkMIs[D_REG]; Cmd2MI[CMD_DREG - CMD_IDX_LO + 1] = ChkMIs[D_REG];
// g_signal_connect (G_OBJECT(ChkMIs[T_REG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_TREG); // g_signal_connect (G_OBJECT(ChkMIs[T_REG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_TREG);
// Cmd2MI[CMD_TREG - CMD_IDX_LO + 1] = ChkMIs[T_REG]; // Cmd2MI[CMD_TREG - CMD_IDX_LO + 1] = ChkMIs[T_REG];
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_LOGVIEW]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_LOGVIEW);
g_signal_connect (G_OBJECT(AboutMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_ABOUT); g_signal_connect (G_OBJECT(AboutMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_ABOUT);

View File

@ -8,6 +8,7 @@
// //
// Modified by Bruce Ewing // Modified by Bruce Ewing
// //
// Copyright (C) 2008-2014 The Bochs Project
#ifndef BX_ENH_DBG_RES_H #ifndef BX_ENH_DBG_RES_H
#define BX_ENH_DBG_RES_H #define BX_ENH_DBG_RES_H
@ -62,7 +63,9 @@
#define CMD_DREG 148 #define CMD_DREG 148
#define CMD_TREG 149 #define CMD_TREG 149
#define CMD_ABOUT 150 #define CMD_LOGVIEW 150
#define CMD_ABOUT 151
// The CMD_WS popup menuID's must be strictly "contiguous" and in-order // The CMD_WS popup menuID's must be strictly "contiguous" and in-order
#define CMD_WS_1 160 #define CMD_WS_1 160

View File

@ -67,6 +67,8 @@ MENU_1 MENU
MENUITEM "Show SSE Registers\tCtrl+F4",CMD_XMMR MENUITEM "Show SSE Registers\tCtrl+F4",CMD_XMMR
MENUITEM "Show Debug Registers\tShift+F4",CMD_DREG MENUITEM "Show Debug Registers\tShift+F4",CMD_DREG
MENUITEM "Show Test Registers",CMD_TREG MENUITEM "Show Test Registers",CMD_TREG
MENUITEM SEPARATOR
MENUITEM "Show log in output window",CMD_LOGVIEW
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN