diff options
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index f57677636..58d33bb8e 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1244,10 +1244,9 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e | |||
| 1244 | return ERR_INVALID_THREAD_PRIORITY; | 1244 | return ERR_INVALID_THREAD_PRIORITY; |
| 1245 | } | 1245 | } |
| 1246 | 1246 | ||
| 1247 | const std::string name = fmt::format("thread-{:X}", entry_point); | ||
| 1248 | auto& kernel = system.Kernel(); | 1247 | auto& kernel = system.Kernel(); |
| 1249 | CASCADE_RESULT(SharedPtr<Thread> thread, | 1248 | CASCADE_RESULT(SharedPtr<Thread> thread, |
| 1250 | Thread::Create(kernel, name, entry_point, priority, arg, processor_id, stack_top, | 1249 | Thread::Create(kernel, "", entry_point, priority, arg, processor_id, stack_top, |
| 1251 | *current_process)); | 1250 | *current_process)); |
| 1252 | 1251 | ||
| 1253 | const auto new_thread_handle = current_process->GetHandleTable().Create(thread); | 1252 | const auto new_thread_handle = current_process->GetHandleTable().Create(thread); |
| @@ -1258,6 +1257,10 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e | |||
| 1258 | } | 1257 | } |
| 1259 | *out_handle = *new_thread_handle; | 1258 | *out_handle = *new_thread_handle; |
| 1260 | 1259 | ||
| 1260 | // Set the thread name for debugging purposes. | ||
| 1261 | thread->SetName( | ||
| 1262 | fmt::format("thread[entry_point={:X}, handle={:X}]", entry_point, *new_thread_handle)); | ||
| 1263 | |||
| 1261 | system.CpuCore(thread->GetProcessorID()).PrepareReschedule(); | 1264 | system.CpuCore(thread->GetProcessorID()).PrepareReschedule(); |
| 1262 | 1265 | ||
| 1263 | return RESULT_SUCCESS; | 1266 | return RESULT_SUCCESS; |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index e14b84a81..31d48325d 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -102,6 +102,11 @@ public: | |||
| 102 | std::string GetName() const override { | 102 | std::string GetName() const override { |
| 103 | return name; | 103 | return name; |
| 104 | } | 104 | } |
| 105 | |||
| 106 | void SetName(std::string new_name) { | ||
| 107 | name = std::move(new_name); | ||
| 108 | } | ||
| 109 | |||
| 105 | std::string GetTypeName() const override { | 110 | std::string GetTypeName() const override { |
| 106 | return "Thread"; | 111 | return "Thread"; |
| 107 | } | 112 | } |