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 | |
| 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')
| -rw-r--r-- | src/core/hle/kernel/event.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/mutex.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/semaphore.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/session.h | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/kernel/timer.cpp | 2 |
7 files changed, 13 insertions, 15 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 898e1c98f..420906ec0 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp | |||
| @@ -32,7 +32,7 @@ bool Event::ShouldWait() { | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | void Event::Acquire() { | 34 | void Event::Acquire() { |
| 35 | _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); | 35 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); |
| 36 | 36 | ||
| 37 | // Release the event if it's not sticky... | 37 | // Release the event if it's not sticky... |
| 38 | if (reset_type != RESETTYPE_STICKY) | 38 | if (reset_type != RESETTYPE_STICKY) |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index a2ffbcdb7..eb61d8ef3 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -52,7 +52,7 @@ void WaitObject::WakeupAllWaitingThreads() { | |||
| 52 | for (auto thread : waiting_threads_copy) | 52 | for (auto thread : waiting_threads_copy) |
| 53 | thread->ReleaseWaitObject(this); | 53 | thread->ReleaseWaitObject(this); |
| 54 | 54 | ||
| 55 | _assert_msg_(Kernel, waiting_threads.empty(), "failed to awaken all waiting threads!"); | 55 | ASSERT_MSG(waiting_threads.empty(), "failed to awaken all waiting threads!"); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | HandleTable::HandleTable() { | 58 | HandleTable::HandleTable() { |
| @@ -61,7 +61,7 @@ HandleTable::HandleTable() { | |||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { | 63 | ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) { |
| 64 | _dbg_assert_(Kernel, obj != nullptr); | 64 | DEBUG_ASSERT(obj != nullptr); |
| 65 | 65 | ||
| 66 | u16 slot = next_free_slot; | 66 | u16 slot = next_free_slot; |
| 67 | if (slot >= generations.size()) { | 67 | if (slot >= generations.size()) { |
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index a811db392..be2c49706 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -64,7 +64,7 @@ void Mutex::Acquire() { | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void Mutex::Acquire(SharedPtr<Thread> thread) { | 66 | void Mutex::Acquire(SharedPtr<Thread> thread) { |
| 67 | _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); | 67 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); |
| 68 | 68 | ||
| 69 | // Actually "acquire" the mutex only if we don't already have it... | 69 | // Actually "acquire" the mutex only if we don't already have it... |
| 70 | if (lock_count == 0) { | 70 | if (lock_count == 0) { |
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index c8cf8b9a2..6aecc24aa 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp | |||
| @@ -36,7 +36,7 @@ bool Semaphore::ShouldWait() { | |||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | void Semaphore::Acquire() { | 38 | void Semaphore::Acquire() { |
| 39 | _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); | 39 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); |
| 40 | --available_count; | 40 | --available_count; |
| 41 | } | 41 | } |
| 42 | 42 | ||
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h index 7cc9332c9..9e9288e0f 100644 --- a/src/core/hle/kernel/session.h +++ b/src/core/hle/kernel/session.h | |||
| @@ -66,7 +66,7 @@ public: | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void Acquire() override { | 68 | void Acquire() override { |
| 69 | _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); | 69 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); |
| 70 | } | 70 | } |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
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, |
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 4352fc99c..aa0afb796 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp | |||
| @@ -38,7 +38,7 @@ bool Timer::ShouldWait() { | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void Timer::Acquire() { | 40 | void Timer::Acquire() { |
| 41 | _assert_msg_(Kernel, !ShouldWait(), "object unavailable!"); | 41 | ASSERT_MSG( !ShouldWait(), "object unavailable!"); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void Timer::Set(s64 initial, s64 interval) { | 44 | void Timer::Set(s64 initial, s64 interval) { |