mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 01:33:45 +01:00
ImDebugger: Show per-thread current directory in threads view
This commit is contained in:
1 parent
8a26e39792
commit
b3a2178a5c
4 files changed
+20
-8
No files matched your search
@@ -175,6 +175,14 @@ IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string MetaFileSystem::GetCurrentDirForThread(int threadID) const {
|
||||
auto iter = currentDir.find(threadID);
|
||||
if (iter == currentDir.end()) {
|
||||
return "";
|
||||
}
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
int MetaFileSystem::MapFilePath(std::string_view _inpath, std::string *outpath, MountPoint **system) {
|
||||
int error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
std::lock_guard<std::recursive_mutex> guard(lock);
|
||||
@@ -204,7 +212,7 @@ int MetaFileSystem::MapFilePath(std::string_view _inpath, std::string *outpath,
|
||||
|
||||
// Hm, does this make sense? Doesn't each drive has its own currentDir per thread, or maybe not?
|
||||
int currentThread = __KernelGetCurThread();
|
||||
currentDir_t::iterator it = currentDir.find(currentThread);
|
||||
auto it = currentDir.find(currentThread);
|
||||
if (it == currentDir.end()) {
|
||||
// Attempt to emulate SCE_KERNEL_ERROR_NOCWD / 8002032C: may break things requiring fixes elsewhere
|
||||
if (inpath.find(':') == std::string::npos /* means path is relative */) {
|
||||
|
||||
@@ -44,8 +44,7 @@ private:
|
||||
// The order of this vector is meaningful - lookups are always a linear search from the start.
|
||||
std::vector<MountPoint> fileSystems;
|
||||
|
||||
typedef std::map<int, std::string> currentDir_t;
|
||||
currentDir_t currentDir;
|
||||
std::map<int, std::string> currentDir;
|
||||
|
||||
std::string startingDirectory;
|
||||
mutable std::recursive_mutex lock; // must be recursive. TODO: fix that
|
||||
@@ -88,6 +87,8 @@ public:
|
||||
void ThreadEnded(int threadID);
|
||||
void Shutdown();
|
||||
|
||||
std::string GetCurrentDirForThread(int threadID) const;
|
||||
|
||||
u32 GetNewHandle() override {
|
||||
u32 res = current++;
|
||||
if (current < 0) {
|
||||
|
||||
@@ -712,8 +712,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting, const char
|
||||
if (shouldHLE && GetHLEFunc(func.moduleName, func.nid)) {
|
||||
if (reimporting && Memory::Read_Instruction(func.stubAddr + 4) != GetSyscallOp(func.moduleName, func.nid)) {
|
||||
const char *name = GetHLEFuncName(func.moduleName, func.nid);
|
||||
char temp[256];
|
||||
if (temp) {
|
||||
if (name) {
|
||||
WARN_LOG(Log::Loader, "Reimporting updated syscall from %s: %s", func.moduleName, name);
|
||||
} else {
|
||||
WARN_LOG(Log::Loader, "Reimporting updated syscall from %s: zz_%08x", func.moduleName, func.nid);
|
||||
|
||||
@@ -419,15 +419,16 @@ void DrawThreadView(ImConfig &cfg, ImControl &control) {
|
||||
}
|
||||
|
||||
std::vector<DebugThreadInfo> info = GetThreadsInfo();
|
||||
if (ImGui::BeginTable("threads", 8, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
|
||||
if (ImGui::BeginTable("threads", 9, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
|
||||
ImGui::TableSetupColumn("Id", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("PC", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Entry", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Priority", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("State", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Wait Type", ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn("Wait ID", ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn("Wait Type", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Wait ID", ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Cur Dir", ImGuiTableColumnFlags_WidthStretch);
|
||||
// .initialStack, .stackSize, etc
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
@@ -459,6 +460,9 @@ void DrawThreadView(ImConfig &cfg, ImControl &control) {
|
||||
char temp[64];
|
||||
WaitIDToString(thread.waitType, thread.waitID, temp, sizeof(temp));
|
||||
ImGui::TextUnformatted(temp);
|
||||
std::string curDir = pspFileSystem.GetCurrentDirForThread(thread.id);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(curDir.empty() ? "N/A" : curDir.c_str());
|
||||
if (ImGui::BeginPopup("threadPopup")) {
|
||||
DebugThreadInfo &thread = info[i];
|
||||
ImGui::Text("Thread: %s", thread.name);
|
||||
|
||||
Reference in new issue
Block a user