Some formatting/nullptr fixes for src/debugger.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3052 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-07 15:52:24 +00:00
parent a9aa84e3a3
commit f54118226c
4 changed files with 32 additions and 44 deletions

View File

@ -114,31 +114,25 @@ Debugger::Debugger(OSystem& osystem, Console& console)
: DialogContainer(osystem),
myConsole(console),
mySystem(console.system()),
myDialog(NULL),
myParser(NULL),
myCartDebug(NULL),
myCpuDebug(NULL),
myRiotDebug(NULL),
myTiaDebug(NULL),
myBreakPoints(NULL),
myReadTraps(NULL),
myWriteTraps(NULL),
myDialog(nullptr),
myBreakPoints(nullptr),
myReadTraps(nullptr),
myWriteTraps(nullptr),
myWidth(DebuggerDialog::kSmallFontMinW),
myHeight(DebuggerDialog::kSmallFontMinH),
myRewindManager(NULL)
myHeight(DebuggerDialog::kSmallFontMinH)
{
// Init parser
myParser = new DebuggerParser(*this, osystem.settings());
myParser = make_ptr<DebuggerParser>(*this, osystem.settings());
// Create debugger subsystems
myCpuDebug = new CpuDebug(*this, myConsole);
myCartDebug = new CartDebug(*this, myConsole, osystem);
myRiotDebug = new RiotDebug(*this, myConsole);
myTiaDebug = new TIADebug(*this, myConsole);
myCpuDebug = make_ptr<CpuDebug>(*this, myConsole);
myCartDebug = make_ptr<CartDebug>(*this, myConsole, osystem);
myRiotDebug = make_ptr<RiotDebug>(*this, myConsole);
myTiaDebug = make_ptr<TIADebug>(*this, myConsole);
myBreakPoints = new PackedBitArray(0x10000);
myReadTraps = new PackedBitArray(0x10000);
myWriteTraps = new PackedBitArray(0x10000);
myReadTraps = new PackedBitArray(0x10000);
myWriteTraps = new PackedBitArray(0x10000);
// Allow access to this object from any class
// Technically this violates pure OO programming, but since I know
@ -150,17 +144,11 @@ Debugger::Debugger(OSystem& osystem, Console& console)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Debugger::~Debugger()
{
delete myParser;
delete myCartDebug;
delete myCpuDebug;
delete myRiotDebug;
delete myTiaDebug;
delete myBreakPoints;
delete myReadTraps;
delete myWriteTraps;
delete myRewindManager;
myStaticDebugger = 0;
myStaticDebugger = nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -179,11 +167,11 @@ void Debugger::initialize()
myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight));
delete myBaseDialog; myBaseDialog = myDialog = NULL;
delete myBaseDialog; myBaseDialog = myDialog = nullptr;
myDialog = new DebuggerDialog(myOSystem, *this, 0, 0, myWidth, myHeight);
myBaseDialog = myDialog;
myRewindManager = new RewindManager(myOSystem, myDialog->rewindButton());
myRewindManager = make_ptr<RewindManager>(myOSystem, myDialog->rewindButton());
myCartDebug->setDebugWidget(&(myDialog->cartDebug()));
}
@ -477,7 +465,7 @@ void Debugger::clearAllBreakPoints()
{
delete myBreakPoints;
myBreakPoints = new PackedBitArray(0x10000);
mySystem.m6502().setBreakPoints(NULL);
mySystem.m6502().setBreakPoints(nullptr);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -487,7 +475,7 @@ void Debugger::clearAllTraps()
delete myWriteTraps;
myReadTraps = new PackedBitArray(0x10000);
myWriteTraps = new PackedBitArray(0x10000);
mySystem.m6502().setTraps(NULL, NULL);
mySystem.m6502().setTraps(nullptr, nullptr);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -675,7 +663,7 @@ Debugger::RewindManager::RewindManager(OSystem& system, ButtonWidget& button)
myTop(0)
{
for(int i = 0; i < MAX_SIZE; ++i)
myStateList[i] = (Serializer*) NULL;
myStateList[i] = nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -689,7 +677,7 @@ Debugger::RewindManager::~RewindManager()
bool Debugger::RewindManager::addState()
{
// Create a new Serializer object if we need one
if(myStateList[myTop] == NULL)
if(myStateList[myTop] == nullptr)
myStateList[myTop] = new Serializer();
Serializer& s = *(myStateList[myTop]);
@ -741,7 +729,7 @@ bool Debugger::RewindManager::isEmpty()
void Debugger::RewindManager::clear()
{
for(int i = 0; i < MAX_SIZE; ++i)
if(myStateList[i] != NULL)
if(myStateList[i] != nullptr)
myStateList[i]->reset();
myTop = mySize = 0;

View File

@ -297,11 +297,11 @@ class Debugger : public DialogContainer
System& mySystem;
DebuggerDialog* myDialog;
DebuggerParser* myParser;
CartDebug* myCartDebug;
CpuDebug* myCpuDebug;
RiotDebug* myRiotDebug;
TIADebug* myTiaDebug;
unique_ptr<DebuggerParser> myParser;
unique_ptr<CartDebug> myCartDebug;
unique_ptr<CpuDebug> myCpuDebug;
unique_ptr<RiotDebug> myRiotDebug;
unique_ptr<TIADebug> myTiaDebug;
PackedBitArray* myBreakPoints;
PackedBitArray* myReadTraps;
@ -338,7 +338,7 @@ class Debugger : public DialogContainer
Serializer* myStateList[MAX_SIZE];
uInt32 mySize, myTop;
};
RewindManager* myRewindManager;
unique_ptr<RewindManager> myRewindManager;
};
#endif

View File

@ -48,7 +48,7 @@ class DebuggerParser
void getCompletions(const char* in, StringList& list) const;
/** Evaluate the given expression using operators, current base, etc */
int decipher_arg(const string &str);
int decipher_arg(const string& str);
/** String representation of all watches currently defined */
string showWatches();
@ -84,7 +84,7 @@ class DebuggerParser
kIN_ARG
};
typedef enum {
enum parameters {
kARG_WORD, // single 16-bit value
kARG_MULTI_WORD, // multiple 16-bit values (must occur last)
kARG_BYTE, // single 8-bit value
@ -94,7 +94,7 @@ class DebuggerParser
kARG_FILE, // filename
kARG_BASE_SPCL, // base specifier: 2, 10, or 16 (or "bin" "dec" "hex")
kARG_END_ARGS // sentinel, occurs at end of list
} parameters;
};
// Pointer to DebuggerParser instance method, no args, returns void.
typedef void (DebuggerParser::*METHOD)();

View File

@ -33,7 +33,7 @@
exactly the same, except that generated data is now redirected to a
DisassemblyList structure rather than being printed.
All 7800-related stuff has been removed, as well as all commandline options.
All 7800-related stuff has been removed, as well as some commandline options.
Over time, some of the configurability of Distella may be added again.
@author Stephen Anthony
@ -44,7 +44,7 @@ class DiStella
// A list of options that can be applied to the disassembly
// This will eventually grow to include all options supported by
// standalone Distella
typedef struct {
struct Settings{
Common::Base::Format gfx_format;
bool resolve_code; // Attempt to detect code vs. data sections
bool show_addresses; // Show PC addresses (always off for external output)
@ -52,7 +52,7 @@ class DiStella
bool fflag; // Forces correct address length (-f in Distella)
bool rflag; // Relocate calls out of address range (-r in Distella)
int bwidth; // Number of bytes to use per line (with .byte xxx)
} Settings;
};
static Settings settings; // Default settings
public: