mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-25 20:41:21 -08:00
Merge pull request #453 from Subv/thread_callstack
Qt/WaitTree: Display the callstack for each thread in the wait tree widget
This commit is contained in:
commit
882111c4f2
@ -98,6 +98,30 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WaitTreeCallstack::WaitTreeCallstack(const Kernel::Thread& thread) : thread(thread) {}
|
||||||
|
|
||||||
|
QString WaitTreeCallstack::GetText() const {
|
||||||
|
return tr("Call stack");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() const {
|
||||||
|
std::vector<std::unique_ptr<WaitTreeItem>> list;
|
||||||
|
|
||||||
|
constexpr size_t BaseRegister = 29;
|
||||||
|
u64 base_pointer = thread.context.cpu_registers[BaseRegister];
|
||||||
|
|
||||||
|
while (base_pointer != 0) {
|
||||||
|
u64 lr = Memory::Read64(base_pointer + sizeof(u64));
|
||||||
|
if (lr == 0)
|
||||||
|
break;
|
||||||
|
list.push_back(
|
||||||
|
std::make_unique<WaitTreeText>(tr("0x%1").arg(lr - sizeof(u32), 16, 16, QChar('0'))));
|
||||||
|
base_pointer = Memory::Read64(base_pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
WaitTreeWaitObject::WaitTreeWaitObject(const Kernel::WaitObject& o) : object(o) {}
|
WaitTreeWaitObject::WaitTreeWaitObject(const Kernel::WaitObject& o) : object(o) {}
|
||||||
|
|
||||||
bool WaitTreeExpandableItem::IsExpandable() const {
|
bool WaitTreeExpandableItem::IsExpandable() const {
|
||||||
@ -269,6 +293,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
|
|||||||
thread.IsSleepingOnWaitAll()));
|
thread.IsSleepingOnWaitAll()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.push_back(std::make_unique<WaitTreeCallstack>(thread));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,17 @@ private:
|
|||||||
Kernel::SharedPtr<Kernel::Thread> owner;
|
Kernel::SharedPtr<Kernel::Thread> owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WaitTreeCallstack : public WaitTreeExpandableItem {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit WaitTreeCallstack(const Kernel::Thread& thread);
|
||||||
|
QString GetText() const override;
|
||||||
|
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Kernel::Thread& thread;
|
||||||
|
};
|
||||||
|
|
||||||
class WaitTreeWaitObject : public WaitTreeExpandableItem {
|
class WaitTreeWaitObject : public WaitTreeExpandableItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user