diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index f12eef95f..79e3368cd 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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.93 2005-09-20 19:09:10 stephena Exp $ +// $Id: Debugger.cxx,v 1.94 2005-09-23 17:38:26 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -726,6 +726,17 @@ void Debugger::toggleBreakPoint(int bp) { breakPoints->toggle(bp); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Debugger::setBreakPoint(int bp, bool set) +{ + mySystem->m6502().setBreakPoints(breakPoints); + if(bp < 0) bp = myCpuDebug->pc(); + if(set) + breakPoints->set(bp); + else + breakPoints->clear(bp); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Debugger::breakPoint(int bp) { if(bp < 0) bp = myCpuDebug->pc(); diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 86e3f7e7d..43e53eae3 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -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.76 2005-09-20 19:09:10 stephena Exp $ +// $Id: Debugger.hxx,v 1.77 2005-09-23 17:38:26 stephena Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -79,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.76 2005-09-20 19:09:10 stephena Exp $ + @version $Id: Debugger.hxx,v 1.77 2005-09-23 17:38:26 stephena Exp $ */ class Debugger : public DialogContainer { @@ -266,6 +266,8 @@ class Debugger : public DialogContainer int getBank(); int bankCount(); + void setBreakPoint(int bp, bool set); + string loadListFile(string f = ""); const string getSourceLines(int addr); diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index d8212874a..02848ca9b 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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: DebuggerParser.cxx,v 1.78 2005-09-15 19:43:36 stephena Exp $ +// $Id: DebuggerParser.cxx,v 1.79 2005-09-23 17:38:26 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -1328,6 +1328,7 @@ void DebuggerParser::executeBreak() { bp = args[0]; debugger->toggleBreakPoint(bp); + debugger->myRom->invalidate(); if(debugger->breakPoint(bp)) commandResult = "Set"; diff --git a/stella/src/debugger/gui/RomWidget.cxx b/stella/src/debugger/gui/RomWidget.cxx index 85ba4d91f..de21388e3 100644 --- a/stella/src/debugger/gui/RomWidget.cxx +++ b/stella/src/debugger/gui/RomWidget.cxx @@ -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: RomWidget.cxx,v 1.5 2005-09-15 19:43:36 stephena Exp $ +// $Id: RomWidget.cxx,v 1.6 2005-09-23 17:38:27 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -24,6 +24,7 @@ #include "Debugger.hxx" #include "DebuggerParser.hxx" #include "CpuDebug.hxx" +#include "PackedBitArray.hxx" #include "GuiObject.hxx" #include "ContextMenu.hxx" #include "RomListWidget.hxx" @@ -118,6 +119,7 @@ void RomWidget::loadConfig() void RomWidget::initialUpdate() { Debugger& dbg = instance()->debugger(); + PackedBitArray* bp = dbg.breakpoints(); // Fill romlist the current bank of source or disassembly if(mySourceAvailable) @@ -134,7 +136,12 @@ void RomWidget::initialUpdate() // Disassemble entire bank (up to 4096 lines) and invalidate all lines dbg.disassemble(myAddrList, label, data, disasm, 0xf000, 4096); for(unsigned int i = 0; i < data.size(); ++i) - state.push_back(false); + { + if(bp && bp->isSet(myAddrList[i])) + state.push_back(true); + else + state.push_back(false); + } // Create a mapping from addresses to line numbers myLineList.clear(); @@ -154,14 +161,8 @@ void RomWidget::incrementalUpdate(int line, int rows) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RomWidget::setBreak(int data) { - // We don't care about state, as breakpoints are turned on - // and off with the same command - // TODO - at some point, we might want to add 'breakon' - // and 'breakoff' to DebuggerParser, so the states - // don't get out of sync - ostringstream command; - command << "break #" << myAddrList[data]; - instance()->debugger().run(command.str()); + bool state = myRomList->getState(data); + instance()->debugger().setBreakPoint(myAddrList[data], state); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/debugger/gui/RomWidget.hxx b/stella/src/debugger/gui/RomWidget.hxx index 317f90788..bb25107fc 100644 --- a/stella/src/debugger/gui/RomWidget.hxx +++ b/stella/src/debugger/gui/RomWidget.hxx @@ -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: RomWidget.hxx,v 1.4 2005-09-15 19:43:36 stephena Exp $ +// $Id: RomWidget.hxx,v 1.5 2005-09-23 17:38:27 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -64,10 +64,6 @@ class RomWidget : public Widget, public CommandSender /** List of line numbers indexed by address */ AddrToLine myLineList; - /** Indicates whether a given line is valid or not; - Invalid lines need to be disassembled again */ - BoolArray myLineValid; - bool myListIsDirty; bool mySourceAvailable; int myCurrentBank; diff --git a/stella/src/debugger/gui/TiaOutputWidget.cxx b/stella/src/debugger/gui/TiaOutputWidget.cxx index 691f046fa..99f0fd7d6 100644 --- a/stella/src/debugger/gui/TiaOutputWidget.cxx +++ b/stella/src/debugger/gui/TiaOutputWidget.cxx @@ -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: TiaOutputWidget.cxx,v 1.5 2005-09-15 19:43:36 stephena Exp $ +// $Id: TiaOutputWidget.cxx,v 1.6 2005-09-23 17:38:27 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -120,8 +120,14 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in } case 1: - cerr << "Set breakpoint\n"; + { + ostringstream command; + int ystart = atoi(instance()->console().properties().get("Display.YStart").c_str()); + int scanline = myClickY + ystart; + command << "breakif _scan==#" << scanline; + instance()->debugger().parser()->run(command.str()); break; + } case 2: if(myZoom) @@ -135,7 +141,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaOutputWidget::drawWidget(bool hilite) { -//cerr << "TiaOutputWidget::drawWidget\n"; + // FIXME - check if we're in 'greyed out mode' and act accordingly instance()->frameBuffer().refresh(); instance()->frameBuffer().drawMediaSource(); }