mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
ImDebugger: Add initial HLE module explorer window`
This commit is contained in:
parent
6c64608359
commit
0776ee01a8
@ -162,14 +162,20 @@ void HLEShutdown() {
|
||||
mipsCallActions.clear();
|
||||
}
|
||||
|
||||
void RegisterModule(const char *name, int numFunctions, const HLEFunction *funcTable)
|
||||
{
|
||||
int GetNumRegisteredModules() {
|
||||
return (int)moduleDB.size();
|
||||
}
|
||||
|
||||
void RegisterModule(const char *name, int numFunctions, const HLEFunction *funcTable) {
|
||||
HLEModule module = {name, numFunctions, funcTable};
|
||||
moduleDB.push_back(module);
|
||||
}
|
||||
|
||||
int GetModuleIndex(const char *moduleName)
|
||||
{
|
||||
const HLEModule *GetModuleByIndex(int index) {
|
||||
return &moduleDB[index];
|
||||
}
|
||||
|
||||
int GetModuleIndex(const char *moduleName) {
|
||||
for (size_t i = 0; i < moduleDB.size(); i++)
|
||||
if (strcmp(moduleName, moduleDB[i].name) == 0)
|
||||
return (int)i;
|
||||
|
@ -44,8 +44,7 @@ enum {
|
||||
HLE_KERNEL_SYSCALL = 1 << 11,
|
||||
};
|
||||
|
||||
struct HLEFunction
|
||||
{
|
||||
struct HLEFunction {
|
||||
// This is the id, or nid, of the function (which is how it's linked.)
|
||||
// Generally, the truncated least significant 32 bits of a SHA-1 hash.
|
||||
u32 ID;
|
||||
@ -72,8 +71,7 @@ struct HLEFunction
|
||||
u32 stackBytesToClear;
|
||||
};
|
||||
|
||||
struct HLEModule
|
||||
{
|
||||
struct HLEModule {
|
||||
const char *name;
|
||||
int numFunctions;
|
||||
const HLEFunction *funcTable;
|
||||
@ -81,8 +79,7 @@ struct HLEModule
|
||||
|
||||
typedef char SyscallModuleName[32];
|
||||
|
||||
struct Syscall
|
||||
{
|
||||
struct Syscall {
|
||||
SyscallModuleName moduleName;
|
||||
u32 symAddr;
|
||||
u32 nid;
|
||||
@ -102,6 +99,8 @@ int GetFuncIndex(int moduleIndex, u32 nib);
|
||||
int GetModuleIndex(const char *modulename);
|
||||
|
||||
void RegisterModule(const char *name, int numFunctions, const HLEFunction *funcTable);
|
||||
int GetNumRegisteredModules();
|
||||
const HLEModule *GetModuleByIndex(int index);
|
||||
|
||||
// Run the current thread's callbacks after the syscall finishes.
|
||||
void hleCheckCurrentCallbacks();
|
||||
|
@ -15,6 +15,7 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
@ -176,6 +177,10 @@ namespace MIPSStackWalk {
|
||||
|
||||
u32 prevEntry = INVALIDTARGET;
|
||||
while (pc != threadEntry) {
|
||||
if (!Memory::IsValidAddress(current.pc)) {
|
||||
break;
|
||||
}
|
||||
|
||||
u32 possibleEntry = GuessEntry(current.pc);
|
||||
if (DetermineFrameInfo(current, possibleEntry, threadEntry, ra)) {
|
||||
frames.push_back(current);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "Core/MIPS/MIPSTables.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Common/System/Request.h"
|
||||
|
||||
// Threads window
|
||||
@ -233,6 +234,27 @@ void DrawModules(MIPSDebugInterface *debug, bool *open) {
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void DrawHLEModules(ImConfig &config) {
|
||||
if (!ImGui::Begin("HLE Modules", &config.hleModulesOpen)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
const int moduleCount = GetNumRegisteredModules();
|
||||
for (int i = 0; i < moduleCount; i++) {
|
||||
const HLEModule *module = GetModuleByIndex(i);
|
||||
if (ImGui::TreeNode(module->name)) {
|
||||
for (int j = 0; j < module->numFunctions; j++) {
|
||||
auto &func = module->funcTable[j];
|
||||
ImGui::Text("%s(%s)", func.name, func.argmask);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ImDebugger::Frame(MIPSDebugInterface *mipsDebug) {
|
||||
// Snapshot the coreState to avoid inconsistency.
|
||||
const CoreState coreState = ::coreState;
|
||||
@ -272,40 +294,42 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug) {
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("Window")) {
|
||||
ImGui::Checkbox("Dear ImGUI Demo", &demoOpen_);
|
||||
ImGui::Checkbox("CPU debugger", &disasmOpen_);
|
||||
ImGui::Checkbox("Registers", ®sOpen_);
|
||||
ImGui::Checkbox("Callstacks", &callstackOpen_);
|
||||
ImGui::Checkbox("HLE Modules", &modulesOpen_);
|
||||
ImGui::Checkbox("HLE Threads", &threadsOpen_);
|
||||
ImGui::Checkbox("Dear ImGUI Demo", &cfg_.demoOpen);
|
||||
ImGui::Checkbox("CPU debugger", &cfg_.disasmOpen);
|
||||
ImGui::Checkbox("Registers", &cfg_.regsOpen);
|
||||
ImGui::Checkbox("Callstacks", &cfg_.callstackOpen);
|
||||
ImGui::Checkbox("HLE Modules", &cfg_.modulesOpen);
|
||||
ImGui::Checkbox("HLE Threads", &cfg_.threadsOpen);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
if (demoOpen_) {
|
||||
ImGui::ShowDemoWindow(&demoOpen_);
|
||||
if (cfg_.demoOpen) {
|
||||
ImGui::ShowDemoWindow(&cfg_.demoOpen);
|
||||
}
|
||||
|
||||
if (disasmOpen_) {
|
||||
disasm_.Draw(mipsDebug, &disasmOpen_, coreState);
|
||||
if (cfg_.disasmOpen) {
|
||||
disasm_.Draw(mipsDebug, &cfg_.disasmOpen, coreState);
|
||||
}
|
||||
|
||||
if (regsOpen_) {
|
||||
DrawRegisterView(mipsDebug, ®sOpen_);
|
||||
if (cfg_.regsOpen) {
|
||||
DrawRegisterView(mipsDebug, &cfg_.regsOpen);
|
||||
}
|
||||
|
||||
if (threadsOpen_) {
|
||||
DrawThreadView(&threadsOpen_);
|
||||
if (cfg_.threadsOpen) {
|
||||
DrawThreadView(&cfg_.threadsOpen);
|
||||
}
|
||||
|
||||
if (callstackOpen_) {
|
||||
DrawCallStacks(mipsDebug, &callstackOpen_);
|
||||
if (cfg_.callstackOpen) {
|
||||
DrawCallStacks(mipsDebug, &cfg_.callstackOpen);
|
||||
}
|
||||
|
||||
if (modulesOpen_) {
|
||||
DrawModules(mipsDebug, &modulesOpen_);
|
||||
if (cfg_.modulesOpen) {
|
||||
DrawModules(mipsDebug, &cfg_.modulesOpen);
|
||||
}
|
||||
|
||||
DrawHLEModules(cfg_);
|
||||
}
|
||||
|
||||
void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState coreState) {
|
||||
|
@ -48,6 +48,19 @@ public:
|
||||
// Stub
|
||||
};
|
||||
|
||||
struct ImConfig {
|
||||
bool disasmOpen = true;
|
||||
bool demoOpen = false;
|
||||
bool regsOpen = true;
|
||||
bool threadsOpen = true;
|
||||
bool callstackOpen = true;
|
||||
bool modulesOpen = true;
|
||||
bool hleModulesOpen = true;
|
||||
|
||||
// HLE explorer settings
|
||||
// bool filterByUsed = true;
|
||||
};
|
||||
|
||||
struct ImDebugger {
|
||||
void Frame(MIPSDebugInterface *mipsDebug);
|
||||
|
||||
@ -55,10 +68,5 @@ struct ImDebugger {
|
||||
ImLuaConsole luaConsole_;
|
||||
|
||||
// Open variables.
|
||||
bool disasmOpen_ = true;
|
||||
bool demoOpen_ = false;
|
||||
bool regsOpen_ = true;
|
||||
bool threadsOpen_ = true;
|
||||
bool callstackOpen_ = true;
|
||||
bool modulesOpen_ = true;
|
||||
ImConfig cfg_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user