CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/Debugger/DebugInterface.h
Views: 1401
1
// Copyright (c) 2012- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
#include <string>
20
#include <cstdio>
21
22
#include "Common/CommonTypes.h"
23
#include "Common/Math/expression_parser.h"
24
25
struct MemMap;
26
27
class DebugInterface {
28
public:
29
virtual int getInstructionSize(int instruction) {return 1;}
30
31
virtual bool isAlive() {return true;}
32
virtual bool isBreakpoint(unsigned int address) {return false;}
33
virtual void setBreakpoint(unsigned int address){}
34
virtual void clearBreakpoint(unsigned int address){}
35
virtual void clearAllBreakpoints() {}
36
virtual void toggleBreakpoint(unsigned int address){}
37
virtual unsigned int readMemory(unsigned int address){return 0;}
38
virtual unsigned int getPC() {return 0;}
39
virtual void setPC(unsigned int address) {}
40
virtual void step() {}
41
virtual void runToBreakpoint() {}
42
virtual int getColor(unsigned int address){return 0xFFFFFFFF;}
43
virtual std::string getDescription(unsigned int address) {return "";}
44
virtual bool initExpression(const char* exp, PostfixExpression& dest) { return false; };
45
virtual bool parseExpression(PostfixExpression& exp, u32& dest) { return false; };
46
47
virtual u32 GetHi() { return 0; };
48
virtual u32 GetLo() { return 0; };
49
virtual void SetHi(u32 val) { };
50
virtual void SetLo(u32 val) { };
51
virtual const char *GetName() = 0;
52
virtual u32 GetGPR32Value(int reg) {return 0;}
53
virtual void SetGPR32Value(int reg) {}
54
virtual u32 GetPC() = 0;
55
virtual void SetPC(u32 _pc) = 0;
56
virtual u32 GetLR() {return GetPC();}
57
virtual void DisAsm(u32 pc, char *out, size_t outSize) {
58
snprintf(out, outSize, "[%08x] UNKNOWN", pc);
59
}
60
// More stuff for debugger
61
virtual int GetNumCategories() {return 0;}
62
virtual int GetNumRegsInCategory(int cat) {return 0;}
63
virtual const char *GetCategoryName(int cat) {return 0;}
64
virtual std::string GetRegName(int cat, int index) { return ""; }
65
virtual void PrintRegValue(int cat, int index, char *out, size_t outSize) {
66
snprintf(out, outSize, "%08X", GetGPR32Value(index));
67
}
68
virtual u32 GetRegValue(int cat, int index) {return 0;}
69
virtual void SetRegValue(int cat, int index, u32 value) {}
70
};
71
72