diff options
| author | 2015-02-10 23:08:04 -0500 | |
|---|---|---|
| committer | 2015-02-10 23:08:04 -0500 | |
| commit | 2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f (patch) | |
| tree | fca138e8377c4d66bd1fe026a3d2fef54a7f090c /src/core/hle/kernel/thread.cpp | |
| parent | GSP: Fixed typo in SignalInterrupt (diff) | |
| parent | Asserts: break/crash program, fit to style guide; log.h->assert.h (diff) | |
| download | yuzu-2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f.tar.gz yuzu-2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f.tar.xz yuzu-2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f.zip | |
Merge pull request #500 from archshift/assert
Made asserts actually break the debugger, or crash if the program is not in debug mode.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 7f629c20e..f8c834a8d 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -29,7 +29,7 @@ bool Thread::ShouldWait() { | |||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void Thread::Acquire() { | 31 | void Thread::Acquire() { |
| 32 | _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); | 32 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | // Lists all thread ids that aren't deleted/etc. | 35 | // Lists all thread ids that aren't deleted/etc. |
| @@ -144,7 +144,7 @@ void ArbitrateAllThreads(u32 address) { | |||
| 144 | * @param new_thread The thread to switch to | 144 | * @param new_thread The thread to switch to |
| 145 | */ | 145 | */ |
| 146 | static void SwitchContext(Thread* new_thread) { | 146 | static void SwitchContext(Thread* new_thread) { |
| 147 | _dbg_assert_msg_(Kernel, new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running."); | 147 | DEBUG_ASSERT_MSG(new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running."); |
| 148 | 148 | ||
| 149 | Thread* previous_thread = GetCurrentThread(); | 149 | Thread* previous_thread = GetCurrentThread(); |
| 150 | 150 | ||
| @@ -304,14 +304,12 @@ void Thread::ResumeFromWait() { | |||
| 304 | break; | 304 | break; |
| 305 | case THREADSTATUS_RUNNING: | 305 | case THREADSTATUS_RUNNING: |
| 306 | case THREADSTATUS_READY: | 306 | case THREADSTATUS_READY: |
| 307 | LOG_ERROR(Kernel, "Thread with object id %u has already resumed.", GetObjectId()); | 307 | DEBUG_ASSERT_MSG(false, "Thread with object id %u has already resumed.", GetObjectId()); |
| 308 | _dbg_assert_(Kernel, false); | ||
| 309 | return; | 308 | return; |
| 310 | case THREADSTATUS_DEAD: | 309 | case THREADSTATUS_DEAD: |
| 311 | // This should never happen, as threads must complete before being stopped. | 310 | // This should never happen, as threads must complete before being stopped. |
| 312 | LOG_CRITICAL(Kernel, "Thread with object id %u cannot be resumed because it's DEAD.", | 311 | DEBUG_ASSERT_MSG(false, "Thread with object id %u cannot be resumed because it's DEAD.", |
| 313 | GetObjectId()); | 312 | GetObjectId()); |
| 314 | _dbg_assert_(Kernel, false); | ||
| 315 | return; | 313 | return; |
| 316 | } | 314 | } |
| 317 | 315 | ||
| @@ -387,7 +385,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 387 | // TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be returned. | 385 | // TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be returned. |
| 388 | static void ClampPriority(const Thread* thread, s32* priority) { | 386 | static void ClampPriority(const Thread* thread, s32* priority) { |
| 389 | if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) { | 387 | if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) { |
| 390 | _dbg_assert_msg_(Kernel, false, "Application passed an out of range priority. An error should be returned."); | 388 | DEBUG_ASSERT_MSG(false, "Application passed an out of range priority. An error should be returned."); |
| 391 | 389 | ||
| 392 | s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); | 390 | s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST); |
| 393 | LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d", | 391 | LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d", |
| @@ -425,7 +423,7 @@ SharedPtr<Thread> SetupIdleThread() { | |||
| 425 | } | 423 | } |
| 426 | 424 | ||
| 427 | SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) { | 425 | SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) { |
| 428 | _dbg_assert_(Kernel, !GetCurrentThread()); | 426 | DEBUG_ASSERT(!GetCurrentThread()); |
| 429 | 427 | ||
| 430 | // Initialize new "main" thread | 428 | // Initialize new "main" thread |
| 431 | auto thread_res = Thread::Create("main", entry_point, priority, 0, | 429 | auto thread_res = Thread::Create("main", entry_point, priority, 0, |