mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-06 07:12:56 +12:00
Add thread debugger
This commit is contained in:
parent
228068901b
commit
9932e58bf0
10 changed files with 172 additions and 14 deletions
|
@ -127,6 +127,7 @@ class Emulator {
|
|||
Scheduler& getScheduler() { return scheduler; }
|
||||
Memory& getMemory() { return memory; }
|
||||
AudioDeviceInterface& getAudioDevice() { return audioDevice; }
|
||||
Kernel& getKernel() { return kernel; }
|
||||
|
||||
RendererType getRendererType() const { return config.rendererType; }
|
||||
Renderer* getRenderer() { return gpu.getRenderer(); }
|
||||
|
|
|
@ -48,12 +48,12 @@ class Kernel {
|
|||
Handle currentProcess;
|
||||
Handle mainThread;
|
||||
int currentThreadIndex;
|
||||
Handle srvHandle; // Handle for the special service manager port "srv:"
|
||||
Handle errorPortHandle; // Handle for the err:f port used for displaying errors
|
||||
Handle srvHandle; // Handle for the special service manager port "srv:"
|
||||
Handle errorPortHandle; // Handle for the err:f port used for displaying errors
|
||||
|
||||
u32 arbiterCount;
|
||||
u32 threadCount; // How many threads in our thread pool have been used as of now (Up to 32)
|
||||
u32 aliveThreadCount; // How many of these threads are actually alive?
|
||||
u32 threadCount; // How many threads in our thread pool have been used as of now (Up to 32)
|
||||
u32 aliveThreadCount; // How many of these threads are actually alive?
|
||||
ServiceManager serviceManager;
|
||||
|
||||
// Top 8 bits are the major version, bottom 8 are the minor version
|
||||
|
@ -66,10 +66,10 @@ class Kernel {
|
|||
Handle makeProcess(u32 id);
|
||||
Handle makePort(const char* name);
|
||||
Handle makeSession(Handle port);
|
||||
Handle makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg,ThreadStatus status = ThreadStatus::Dormant);
|
||||
Handle makeThread(u32 entrypoint, u32 initialSP, u32 priority, ProcessorID id, u32 arg, ThreadStatus status = ThreadStatus::Dormant);
|
||||
Handle makeMemoryBlock(u32 addr, u32 size, u32 myPermission, u32 otherPermission);
|
||||
|
||||
public:
|
||||
public:
|
||||
// Needs to be public to be accessible to the APT/HID services
|
||||
Handle makeEvent(ResetType resetType, Event::CallbackType callback = Event::CallbackType::None);
|
||||
// Needs to be public to be accessible to the APT/DSP services
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
void closeDirectory(u32 messagePointer, Handle directory);
|
||||
void readDirectory(u32 messagePointer, Handle directory);
|
||||
|
||||
public:
|
||||
public:
|
||||
Kernel(CPU& cpu, Memory& mem, GPU& gpu, const EmulatorConfig& config, LuaManager& lua);
|
||||
void initializeFS() { return serviceManager.initializeFS(); }
|
||||
void setVersion(u8 major, u8 minor);
|
||||
|
@ -225,9 +225,7 @@ public:
|
|||
return handleCounter++;
|
||||
}
|
||||
|
||||
std::vector<KernelObject>& getObjects() {
|
||||
return objects;
|
||||
}
|
||||
std::vector<KernelObject>& getObjects() { return objects; }
|
||||
|
||||
// Get pointer to the object with the specified handle
|
||||
KernelObject* getObject(Handle handle) {
|
||||
|
@ -255,4 +253,14 @@ public:
|
|||
void clearInstructionCache();
|
||||
void clearInstructionCacheRange(u32 start, u32 size);
|
||||
u32 getSharedFontVaddr();
|
||||
|
||||
// For debuggers: Returns information about the main process' (alive) threads in a vector for the frontend to display
|
||||
std::vector<Thread> getMainProcessThreads();
|
||||
|
||||
// For debuggers: Sets the entrypoint and initial SP for the main thread (thread 0) so that the debugger can display them
|
||||
void setMainThreadEntrypointAndSP(u32 entrypoint, u32 initialSP) {
|
||||
auto& t = threads[0];
|
||||
t.entrypoint = entrypoint;
|
||||
t.initialSP = initialSP;
|
||||
}
|
||||
};
|
|
@ -21,6 +21,7 @@
|
|||
#include "panda_qt/screen.hpp"
|
||||
#include "panda_qt/shader_editor.hpp"
|
||||
#include "panda_qt/text_editor.hpp"
|
||||
#include "panda_qt/thread_debugger.hpp"
|
||||
#include "services/hid.hpp"
|
||||
|
||||
struct CheatMessage {
|
||||
|
@ -109,6 +110,7 @@ class MainWindow : public QMainWindow {
|
|||
TextEditorWindow* luaEditor;
|
||||
PatchWindow* patchWindow;
|
||||
ShaderEditorWindow* shaderEditor;
|
||||
ThreadDebugger* threadDebugger;
|
||||
|
||||
// We use SDL's game controller API since it's the sanest API that supports as many controllers as possible
|
||||
SDL_GameController* gameController = nullptr;
|
||||
|
@ -157,4 +159,7 @@ class MainWindow : public QMainWindow {
|
|||
|
||||
void handleScreenResize(u32 width, u32 height);
|
||||
void handleTouchscreenPress(QMouseEvent* event);
|
||||
|
||||
signals:
|
||||
void emulatorPaused();
|
||||
};
|
||||
|
|
28
include/panda_qt/thread_debugger.hpp
Normal file
28
include/panda_qt/thread_debugger.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QTableWidget>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QtWidgets>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "emulator.hpp"
|
||||
|
||||
class ThreadDebugger : public QWidget {
|
||||
Q_OBJECT
|
||||
Emulator* emu;
|
||||
|
||||
QVBoxLayout* mainLayout;
|
||||
QTableWidget* threadTable;
|
||||
|
||||
public:
|
||||
ThreadDebugger(Emulator* emu, QWidget* parent = nullptr);
|
||||
void update();
|
||||
|
||||
private:
|
||||
void setListItem(int row, int column, const QString& str);
|
||||
void setListItem(int row, int column, const std::string& str);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue