mpw/bin/debugger.h

157 lines
2.4 KiB
C
Raw Normal View History

#ifndef __debugger_h__
#define __debugger_h__
#include <cstdint>
2013-08-20 02:12:55 +00:00
#include <map>
2013-07-08 03:39:53 +00:00
#include <functional>
#include <string>
// Debugger is a function in MacTypes.h
namespace Debug {
enum {
cmdNull,
cmdContinue,
cmdStep,
cmdRun,
};
enum {
// subtypes
// ; commands
kHexdump = 1,
kInfo,
2013-08-24 03:04:23 +00:00
kList,
kBreak,
kTBreak
};
struct Command {
bool valid;
int action;
uint32_t argc;
uint32_t argv[10];
};
2013-08-18 23:03:32 +00:00
struct Token {
// constructor is not allowable because
// this is a union in the parser.
#if 0
Token():
intValue(0), stringValue(0), subtype(0)
{}
Token(uint32_t i) :
intValue(i), subtype(0)
{}
Token(std::string *s, unsigned st = 0) :
intValue(0), stringValue(s), subtype(st)
{}
#endif
static Token Make()
{
Token t = {0, 0, 0};
return t;
}
static Token Make(uint32_t i)
{
Token t = { i, 0, 0};
return t;
}
static Token Make(std::string *s, uint32_t st)
{
Token t = { 0, s, st};
return t;
}
uint32_t intValue;
std::string *stringValue;
unsigned subtype;
2013-08-24 03:04:23 +00:00
// unsigned range?
// unsigned modifier?
2013-08-18 23:03:32 +00:00
#if 0
Token& operator=(uint32_t rhs)
{
intValue = rhs;
stringValue = 0;
subtype = 0;
return *this;
}
#endif
2013-08-24 03:04:23 +00:00
2013-08-18 23:03:32 +00:00
operator uint32_t() const
{
return intValue;
}
};
bool ParseLine(const char *iter, Command *command);
2013-08-20 02:12:55 +00:00
void LoadTrapFile(const std::string &path, std::map<std::string, uint16_t> &map);
2013-07-08 03:39:53 +00:00
2013-08-18 23:03:32 +00:00
uint32_t VariableGet(const std::string &);
void VariableSet(const std::string &name, uint32_t value);
2013-07-08 03:39:53 +00:00
void Shell();
void Help();
uint32_t ReadLong(uint32_t);
uint16_t ReadWord(uint32_t);
uint8_t ReadByte(uint32_t);
2014-12-30 20:27:34 +00:00
std::string ReadPString(uint32_t);
std::string ReadCString(uint32_t);
void Print(uint32_t value);
void PrintRegisters();
void PrintBackTrace();
2013-08-22 02:40:53 +00:00
void Info(uint32_t address);
void Dump(uint32_t address, int count = 256);
void List(uint32_t address, int count = 20);
void List(uint32_t pc, uint32_t endpc);
void SetARegister(unsigned reg, uint32_t value);
void SetDRegister(unsigned reg, uint32_t value);
void SetXRegister(unsigned reg, uint32_t value);
void ToolBreak(int32_t tool);
2013-07-08 03:39:53 +00:00
void ToolBreak();
void Break(int32_t address);
2013-07-08 03:39:53 +00:00
void Break();
2013-07-13 17:42:19 +00:00
void ReadBreak();
void ReadBreak(int32_t address);
void WriteBreak();
void WriteBreak(int32_t address);
void ReadWriteBreak();
void ReadWriteBreak(int32_t address);
2014-12-30 19:09:07 +00:00
void PrintError(uint32_t value);
void PrintDate(uint32_t value);
2014-12-31 20:45:22 +00:00
void StackCrawl(void);
2014-12-29 21:58:01 +00:00
void ApplyTemplate(int32_t address, const std::string &name);
}
2014-12-30 19:09:07 +00:00
#endif