Merge pull request #1652 from wwylele/kernal-tool

Debugger: implement wait tree widget
This commit is contained in:
bunnei 2016-10-04 23:01:56 -04:00 committed by GitHub
commit 09c3e444d4
12 changed files with 646 additions and 7 deletions

View file

@ -9,12 +9,6 @@
namespace Kernel {
enum class ResetType {
OneShot,
Sticky,
Pulse,
};
class Event final : public WaitObject {
public:
/**

View file

@ -40,6 +40,10 @@ void WaitObject::WakeupAllWaitingThreads() {
HLE::Reschedule(__func__);
}
const std::vector<SharedPtr<Thread>>& WaitObject::GetWaitingThreads() const {
return waiting_threads;
}
HandleTable::HandleTable() {
next_generation = 1;
Clear();

View file

@ -53,6 +53,12 @@ enum {
DEFAULT_STACK_SIZE = 0x4000,
};
enum class ResetType {
OneShot,
Sticky,
Pulse,
};
class Object : NonCopyable {
public:
virtual ~Object() {}
@ -149,6 +155,9 @@ public:
/// Wake up all threads waiting on this object
void WakeupAllWaitingThreads();
/// Get a const reference to the waiting threads list for debug use
const std::vector<SharedPtr<Thread>>& GetWaitingThreads() const;
private:
/// Threads waiting for this object to become available
std::vector<SharedPtr<Thread>> waiting_threads;

View file

@ -665,4 +665,8 @@ void ThreadingShutdown() {
ready_queue.clear();
}
const std::vector<SharedPtr<Thread>>& GetThreadList() {
return thread_list;
}
} // namespace

View file

@ -236,4 +236,9 @@ void ThreadingInit();
*/
void ThreadingShutdown();
/**
* Get a const reference to the thread list for debug use
*/
const std::vector<SharedPtr<Thread>>& GetThreadList();
} // namespace

View file

@ -5,7 +5,6 @@
#pragma once
#include "common/common_types.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/kernel.h"
namespace Kernel {

View file

@ -576,6 +576,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) {
using Kernel::Mutex;
SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0);
mutex->name = Common::StringFromFormat("mutex-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(mutex)));
LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
@ -646,6 +647,7 @@ static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max
using Kernel::Semaphore;
CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count));
semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(semaphore)));
LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X",
@ -702,6 +704,7 @@ static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) {
using Kernel::Event;
SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type));
evt->name = Common::StringFromFormat("event-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt)));
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type,
@ -748,6 +751,7 @@ static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) {
using Kernel::Timer;
SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type));
timer->name = Common::StringFromFormat("timer-%08x", Core::g_app_core->GetReg(14));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer)));
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type,