Added 'Set Breakpoint' functionality to the TiaOutputWidget in the

contextmenu.  This simply created a conditional breakpoint defined
as 'breakif _scan==XXX', where XXX is the scanline under the mouse
at that point.

Fixed bugs in adding breakpoints to the RomWidget.  Breakpoints
are no longer removed when the list is invalidated, and a
set/clear breakpoint from the prompt automatically updates the
RomWidget breakpoint list.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@790 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-09-23 17:38:27 +00:00
parent b9613ec228
commit 5c1c2fe30c
6 changed files with 39 additions and 22 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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";

View File

@ -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);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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;

View File

@ -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();
}