1
0
Fork 0
forked from suyu/suyu

yuzu: debugger: Ignore HLE threads.

This commit is contained in:
bunnei 2021-01-24 22:55:08 -08:00
parent 3856564727
commit 10738839ad
3 changed files with 21 additions and 9 deletions

View file

@ -101,11 +101,12 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
UNREACHABLE_MSG("KThread::Initialize: Unknown ThreadType {}", static_cast<u32>(type));
break;
}
thread_type_for_debugging = type;
// Set the ideal core ID and affinity mask.
virtual_ideal_core_id = virt_core;
physical_ideal_core_id = phys_core;
virtual_affinity_mask = (static_cast<u64>(1) << virt_core);
virtual_affinity_mask = 1ULL << virt_core;
physical_affinity_mask.SetAffinity(phys_core, true);
// Set the thread state.
@ -353,7 +354,7 @@ void KThread::Unpin() {
// Enable core migration.
ASSERT(num_core_migration_disables == 1);
{
--num_core_migration_disables;
num_core_migration_disables--;
// Restore our original state.
const KAffinityMask old_mask = physical_affinity_mask;
@ -494,8 +495,8 @@ ResultCode KThread::SetCoreMask(s32 core_id, u64 v_affinity_mask) {
// Update the pinned waiter list.
{
bool retry_update = false;
bool thread_is_pinned = false;
bool retry_update{};
bool thread_is_pinned{};
do {
// Lock the scheduler.
KScopedSchedulerLock sl{kernel};
@ -507,7 +508,7 @@ ResultCode KThread::SetCoreMask(s32 core_id, u64 v_affinity_mask) {
retry_update = false;
// Check if the thread is currently running.
bool thread_is_current = false;
bool thread_is_current{};
s32 thread_core;
for (thread_core = 0; thread_core < static_cast<s32>(Core::Hardware::NUM_CPU_CORES);
++thread_core) {
@ -683,8 +684,8 @@ ResultCode KThread::SetActivity(Svc::ThreadActivity activity) {
// If the thread is now paused, update the pinned waiter list.
if (activity == Svc::ThreadActivity::Paused) {
bool thread_is_pinned = false;
bool thread_is_current;
bool thread_is_pinned{};
bool thread_is_current{};
do {
// Lock the scheduler.
KScopedSchedulerLock sl{kernel};

View file

@ -534,6 +534,10 @@ public:
return wait_reason_for_debugging;
}
[[nodiscard]] ThreadType GetThreadTypeForDebugging() const {
return thread_type_for_debugging;
}
void SetWaitObjectsForDebugging(const std::span<KSynchronizationObject*>& objects) {
wait_objects_for_debugging.clear();
wait_objects_for_debugging.reserve(objects.size());
@ -721,6 +725,7 @@ private:
std::vector<KSynchronizationObject*> wait_objects_for_debugging;
VAddr mutex_wait_address_for_debugging{};
ThreadWaitReasonForDebugging wait_reason_for_debugging{};
ThreadType thread_type_for_debugging{};
std::string name;
public:

View file

@ -93,8 +93,10 @@ std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList()
std::size_t row = 0;
auto add_threads = [&](const std::vector<std::shared_ptr<Kernel::KThread>>& threads) {
for (std::size_t i = 0; i < threads.size(); ++i) {
item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i]));
item_list.back()->row = row;
if (threads[i]->GetThreadTypeForDebugging() == Kernel::ThreadType::User) {
item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i]));
item_list.back()->row = row;
}
++row;
}
};
@ -148,6 +150,10 @@ QString WaitTreeCallstack::GetText() const {
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list;
if (thread.GetThreadTypeForDebugging() != Kernel::ThreadType::User) {
return list;
}
if (thread.GetOwnerProcess() == nullptr || !thread.GetOwnerProcess()->Is64BitProcess()) {
return list;
}