mirror of https://github.com/stella-emu/stella.git
Added mini message box to debugger, which will be used to inform the
user of debugger-related state information. Reworked breakpoint/trap support to display a message in debugger messagebox indicating what condition caused the debugger to start. This is much better than before, when no feedback was given as to why the debugger started. Some usability fixes to ListWidget/RomWidget. There are still a few more tweaks to do before the final release. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@788 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
b96efe9da8
commit
7fd1a9089b
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.cxx,v 1.92 2005-09-15 19:43:36 stephena Exp $
|
||||
// $Id: Debugger.cxx,v 1.93 2005-09-20 19:09:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -41,6 +41,7 @@
|
|||
#include "TiaInfoWidget.hxx"
|
||||
#include "TiaOutputWidget.hxx"
|
||||
#include "TiaZoomWidget.hxx"
|
||||
#include "EditTextWidget.hxx"
|
||||
|
||||
#include "RomWidget.hxx"
|
||||
#include "Expression.hxx"
|
||||
|
@ -146,6 +147,7 @@ void Debugger::initialize()
|
|||
myTiaOutput = dd->tiaOutput();
|
||||
myTiaZoom = dd->tiaZoom();
|
||||
myRom = dd->rom();
|
||||
myMessage = dd->message();
|
||||
|
||||
// set up any breakpoint that was on the command line
|
||||
// (and remove the key from the settings, so they won't get set again)
|
||||
|
@ -195,9 +197,20 @@ void Debugger::setConsole(Console* console)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::start()
|
||||
bool Debugger::start(const string& message, int address)
|
||||
{
|
||||
return myOSystem->eventHandler().enterDebugMode();
|
||||
bool result = myOSystem->eventHandler().enterDebugMode();
|
||||
|
||||
// This must be done *after* we enter debug mode,
|
||||
// so the message isn't erased
|
||||
ostringstream buf;
|
||||
buf << message;
|
||||
if(address > -1)
|
||||
buf << valueToString(address);
|
||||
|
||||
myMessage->setEditString(buf.str());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.hxx,v 1.75 2005-09-15 19:43:36 stephena Exp $
|
||||
// $Id: Debugger.hxx,v 1.76 2005-09-20 19:09:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -28,6 +28,7 @@ class TIADebug;
|
|||
class TiaInfoWidget;
|
||||
class TiaOutputWidget;
|
||||
class TiaZoomWidget;
|
||||
class EditTextWidget;
|
||||
class RomWidget;
|
||||
class Expression;
|
||||
|
||||
|
@ -78,7 +79,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.75 2005-09-15 19:43:36 stephena Exp $
|
||||
@version $Id: Debugger.hxx,v 1.76 2005-09-20 19:09:10 stephena Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -116,8 +117,11 @@ class Debugger : public DialogContainer
|
|||
/**
|
||||
Wrapper method for EventHandler::enterDebugMode() for those classes
|
||||
that don't have access to EventHandler.
|
||||
|
||||
@param message Message to display when entering debugger
|
||||
@param data An address associated with the message
|
||||
*/
|
||||
bool start();
|
||||
bool start(const string& message = "", int address = -1);
|
||||
|
||||
/**
|
||||
Wrapper method for EventHandler::leaveDebugMode() for those classes
|
||||
|
@ -358,6 +362,7 @@ class Debugger : public DialogContainer
|
|||
TiaOutputWidget* myTiaOutput;
|
||||
TiaZoomWidget* myTiaZoom;
|
||||
RomWidget* myRom;
|
||||
EditTextWidget* myMessage;
|
||||
|
||||
EquateList *equateList;
|
||||
PackedBitArray *breakPoints;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerDialog.cxx,v 1.5 2005-09-15 19:43:36 stephena Exp $
|
||||
// $Id: DebuggerDialog.cxx,v 1.6 2005-09-20 19:09:10 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include "RomWidget.hxx"
|
||||
#include "TiaWidget.hxx"
|
||||
#include "DataGridOpsWidget.hxx"
|
||||
#include "EditTextWidget.hxx"
|
||||
#include "Rect.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "DebuggerParser.hxx"
|
||||
|
@ -75,6 +76,8 @@ void DebuggerDialog::loadConfig()
|
|||
myCpu->loadConfig();
|
||||
myRam->loadConfig();
|
||||
myRom->loadConfig();
|
||||
|
||||
myMessageBox->setEditString("");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -173,6 +176,7 @@ void DebuggerDialog::addTabArea()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::addStatusArea()
|
||||
{
|
||||
const GUI::Font& font = instance()->consoleFont();
|
||||
GUI::Rect r = instance()->debugger().getStatusBounds();
|
||||
int xpos, ypos;
|
||||
|
||||
|
@ -182,6 +186,12 @@ void DebuggerDialog::addStatusArea()
|
|||
ypos += myTiaInfo->getHeight() + 10;
|
||||
myTiaZoom = new TiaZoomWidget(this, xpos+10, ypos);
|
||||
addToFocusList(myTiaZoom->getFocusList());
|
||||
|
||||
xpos += 10; ypos += myTiaZoom->getHeight() + 20;
|
||||
myMessageBox = new EditTextWidget(this, xpos, ypos, myTiaZoom->getWidth(),
|
||||
font.getLineHeight(), "");
|
||||
myMessageBox->setFont(font);
|
||||
myMessageBox->setEditable(false);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerDialog.hxx,v 1.3 2005-09-15 19:43:36 stephena Exp $
|
||||
// $Id: DebuggerDialog.hxx,v 1.4 2005-09-20 19:09:10 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -29,6 +29,7 @@ class CpuWidget;
|
|||
class RamWidget;
|
||||
class RomWidget;
|
||||
class TabWidget;
|
||||
class EditTextWidget;
|
||||
class TiaInfoWidget;
|
||||
class TiaOutputWidget;
|
||||
class TiaZoomWidget;
|
||||
|
@ -43,11 +44,12 @@ class DebuggerDialog : public Dialog
|
|||
int x, int y, int w, int h);
|
||||
~DebuggerDialog();
|
||||
|
||||
PromptWidget* prompt() { return myPrompt; }
|
||||
TiaInfoWidget* tiaInfo() { return myTiaInfo; }
|
||||
TiaOutputWidget* tiaOutput() { return myTiaOutput; }
|
||||
TiaZoomWidget* tiaZoom() { return myTiaZoom; }
|
||||
RomWidget* rom() { return myRom; }
|
||||
PromptWidget* prompt() { return myPrompt; }
|
||||
TiaInfoWidget* tiaInfo() { return myTiaInfo; }
|
||||
TiaOutputWidget* tiaOutput() { return myTiaOutput; }
|
||||
TiaZoomWidget* tiaZoom() { return myTiaZoom; }
|
||||
RomWidget* rom() { return myRom; }
|
||||
EditTextWidget* message() { return myMessageBox; }
|
||||
|
||||
virtual void loadConfig();
|
||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
|
@ -63,6 +65,7 @@ class DebuggerDialog : public Dialog
|
|||
CpuWidget* myCpu;
|
||||
RamWidget* myRam;
|
||||
RomWidget* myRom;
|
||||
EditTextWidget* myMessageBox;
|
||||
|
||||
private:
|
||||
void addTiaArea();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: M6502.cxx,v 1.14 2005-08-24 22:54:30 stephena Exp $
|
||||
// $Id: M6502.cxx,v 1.15 2005-09-20 19:09:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "M6502.hxx"
|
||||
|
@ -29,10 +29,10 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle)
|
|||
mySystemCyclesPerProcessorCycle(systemCyclesPerProcessorCycle)
|
||||
{
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
myDebugger = NULL;
|
||||
breakPoints = NULL;
|
||||
readTraps = NULL;
|
||||
writeTraps = NULL;
|
||||
myDebugger = NULL;
|
||||
myBreakPoints = NULL;
|
||||
myReadTraps = NULL;
|
||||
myWriteTraps = NULL;
|
||||
#endif
|
||||
|
||||
// Compute the BCD lookup table
|
||||
|
@ -368,7 +368,8 @@ unsigned int M6502::addCondBreak(Expression *e, string name)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::delCondBreak(unsigned int brk)
|
||||
{
|
||||
if(brk < myBreakConds.size()) {
|
||||
if(brk < myBreakConds.size())
|
||||
{
|
||||
delete myBreakConds[brk];
|
||||
myBreakConds.remove_at(brk);
|
||||
myBreakCondNames.remove_at(brk);
|
||||
|
@ -393,26 +394,26 @@ const StringList& M6502::getCondBreakNames()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int M6502::evalCondBreaks()
|
||||
{
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++) {
|
||||
Expression *e = myBreakConds[i];
|
||||
if(e->evaluate()) {
|
||||
string name = myBreakCondNames[i]; // TODO: use this
|
||||
cerr << "breakpoint due to condition: " << name << endl;
|
||||
for(unsigned int i=0; i<myBreakConds.size(); i++)
|
||||
{
|
||||
Expression* e = myBreakConds[i];
|
||||
if(e->evaluate())
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // no break hit
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::setBreakPoints(PackedBitArray *bp) {
|
||||
breakPoints = bp;
|
||||
void M6502::setBreakPoints(PackedBitArray *bp)
|
||||
{
|
||||
myBreakPoints = bp;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void M6502::setTraps(PackedBitArray *read, PackedBitArray *write) {
|
||||
readTraps = read;
|
||||
writeTraps = write;
|
||||
void M6502::setTraps(PackedBitArray *read, PackedBitArray *write)
|
||||
{
|
||||
myReadTraps = read;
|
||||
myWriteTraps = write;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: M6502.hxx,v 1.13 2005-08-24 22:54:30 stephena Exp $
|
||||
// $Id: M6502.hxx,v 1.14 2005-09-20 19:09:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef M6502_HXX
|
||||
|
@ -41,7 +41,7 @@ typedef GUI::Array<Expression*> ExpressionList;
|
|||
has a 64K addressing space.
|
||||
|
||||
@author Bradford W. Mott
|
||||
@version $Id: M6502.hxx,v 1.13 2005-08-24 22:54:30 stephena Exp $
|
||||
@version $Id: M6502.hxx,v 1.14 2005-09-20 19:09:10 stephena Exp $
|
||||
*/
|
||||
class M6502
|
||||
{
|
||||
|
@ -229,12 +229,17 @@ class M6502
|
|||
/// Pointer to the debugger for this processor or the null pointer
|
||||
Debugger* myDebugger;
|
||||
|
||||
PackedBitArray *breakPoints;
|
||||
PackedBitArray *readTraps;
|
||||
PackedBitArray *writeTraps;
|
||||
PackedBitArray* myBreakPoints;
|
||||
PackedBitArray* myReadTraps;
|
||||
PackedBitArray* myWriteTraps;
|
||||
|
||||
// did we just now hit a trap?
|
||||
bool justHitTrap;
|
||||
// Did we just now hit a trap?
|
||||
bool myJustHitTrapFlag;
|
||||
struct HitTrapInfo {
|
||||
string message;
|
||||
int address;
|
||||
};
|
||||
HitTrapInfo myHitTrapInfo;
|
||||
|
||||
StringList myBreakCondNames;
|
||||
ExpressionList myBreakConds;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: M6502Hi.cxx,v 1.12 2005-08-24 22:54:30 stephena Exp $
|
||||
// $Id: M6502Hi.cxx,v 1.13 2005-09-20 19:09:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "M6502Hi.hxx"
|
||||
|
@ -34,7 +34,7 @@ M6502High::M6502High(uInt32 systemCyclesPerProcessorCycle)
|
|||
myLastAddress = 0;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
justHitTrap = false;
|
||||
myJustHitTrapFlag = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,12 @@ inline uInt8 M6502High::peek(uInt16 address)
|
|||
mySystem->incrementCycles(mySystemCyclesPerProcessorCycle);
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(readTraps != NULL)
|
||||
if(readTraps->isSet(address))
|
||||
justHitTrap = true;
|
||||
if(myReadTraps != NULL && myReadTraps->isSet(address))
|
||||
{
|
||||
myJustHitTrapFlag = true;
|
||||
myHitTrapInfo.message = "Read trap: ";
|
||||
myHitTrapInfo.address = address;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mySystem->peek(address);
|
||||
|
@ -73,9 +76,12 @@ inline void M6502High::poke(uInt16 address, uInt8 value)
|
|||
mySystem->incrementCycles(mySystemCyclesPerProcessorCycle);
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(writeTraps != NULL)
|
||||
if(writeTraps->isSet(address))
|
||||
justHitTrap = true;
|
||||
if(myWriteTraps != NULL && myWriteTraps->isSet(address))
|
||||
{
|
||||
myJustHitTrapFlag = true;
|
||||
myHitTrapInfo.message = "Write trap: ";
|
||||
myHitTrapInfo.address = address;
|
||||
}
|
||||
#endif
|
||||
|
||||
mySystem->poke(address, value);
|
||||
|
@ -84,6 +90,8 @@ inline void M6502High::poke(uInt16 address, uInt8 value)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool M6502High::execute(uInt32 number)
|
||||
{
|
||||
int cond = -1;
|
||||
|
||||
// Clear all of the execution status bits except for the fatal error bit
|
||||
myExecutionStatus &= FatalErrorBit;
|
||||
|
||||
|
@ -96,28 +104,29 @@ bool M6502High::execute(uInt32 number)
|
|||
uInt8 operand = 0;
|
||||
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
if(justHitTrap)
|
||||
if(myJustHitTrapFlag)
|
||||
{
|
||||
if(myDebugger->start()) {
|
||||
justHitTrap = false;
|
||||
if(myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address))
|
||||
{
|
||||
myJustHitTrapFlag = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(breakPoints != NULL)
|
||||
if(myBreakPoints != NULL)
|
||||
{
|
||||
if(breakPoints->isSet(PC)) {
|
||||
if(myDebugger->start()) {
|
||||
if(myBreakPoints->isSet(PC))
|
||||
{
|
||||
if(myDebugger->start("Breakpoint hit: ", PC))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(evalCondBreaks() > -1)
|
||||
if((cond = evalCondBreaks()) > -1)
|
||||
{
|
||||
if(myDebugger->start()) {
|
||||
string buf = "CBP: " + myBreakCondNames[cond];
|
||||
if(myDebugger->start(buf))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: ListWidget.cxx,v 1.31 2005-09-13 18:27:42 stephena Exp $
|
||||
// $Id: ListWidget.cxx,v 1.32 2005-09-20 19:09:10 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -91,9 +91,9 @@ void ListWidget::setHighlighted(int item)
|
|||
{
|
||||
assert(item >= -1 && item < (int)_list.size());
|
||||
|
||||
if (isEnabled() && _highlightedItem != item)
|
||||
if(isEnabled())
|
||||
{
|
||||
if (_editMode)
|
||||
if(_editMode)
|
||||
abortEditMode();
|
||||
|
||||
_highlightedItem = item;
|
||||
|
@ -133,7 +133,10 @@ void ListWidget::recalc()
|
|||
_currentPos = size - 1;
|
||||
if (_currentPos < 0)
|
||||
_currentPos = 0;
|
||||
_selectedItem = -1;
|
||||
|
||||
if(_selectedItem < 0 || _selectedItem >= size)
|
||||
_selectedItem = 0;
|
||||
|
||||
_editMode = false;
|
||||
scrollBarRecalc();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue