Asserts: break/crash program, fit to style guide; log.h->assert.h

Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
This commit is contained in:
archshift 2015-01-20 17:16:47 -08:00
parent 168eb27aee
commit ef24e72b26
88 changed files with 135 additions and 217 deletions

View file

@ -963,4 +963,4 @@ Opcode ARM_Disasm::DecodeALU(uint32_t insn) {
}
// Unreachable
return OP_INVALID;
}
}

View file

@ -4,6 +4,7 @@
#include <assert.h>
#include "common/logging/log.h"
#include "core/arm/skyeye_common/armdefs.h"
void switch_mode(arm_core_t *core, uint32_t mode) {

View file

@ -7,8 +7,8 @@
#include <mutex>
#include <vector>
#include "common/assert.h"
#include "common/chunk_file.h"
#include "common/log.h"
#include "core/arm/arm_interface.h"
#include "core/core.h"

View file

@ -3,7 +3,7 @@
// Refer to the license.txt file included.
#include "common/common_types.h"
#include "common/log.h"
#include "common/logging/log.h"
#include "core/hle/config_mem.h"

View file

@ -45,7 +45,7 @@ void CallSVC(u32 opcode) {
}
void Reschedule(const char *reason) {
_dbg_assert_msg_(Kernel, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
// TODO(bunnei): It seems that games depend on some CPU execution time elapsing during HLE
// routines. This simulates that time by artificially advancing the number of CPU "ticks".

View file

@ -32,7 +32,7 @@ bool Event::ShouldWait() {
}
void Event::Acquire() {
_assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
ASSERT_MSG(!ShouldWait(), "object unavailable!");
// Release the event if it's not sticky...
if (reset_type != RESETTYPE_STICKY)

View file

@ -52,7 +52,7 @@ void WaitObject::WakeupAllWaitingThreads() {
for (auto thread : waiting_threads_copy)
thread->ReleaseWaitObject(this);
_assert_msg_(Kernel, waiting_threads.empty(), "failed to awaken all waiting threads!");
ASSERT_MSG(waiting_threads.empty(), "failed to awaken all waiting threads!");
}
HandleTable::HandleTable() {
@ -61,7 +61,7 @@ HandleTable::HandleTable() {
}
ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
_dbg_assert_(Kernel, obj != nullptr);
DEBUG_ASSERT(obj != nullptr);
u16 slot = next_free_slot;
if (slot >= generations.size()) {

View file

@ -64,7 +64,7 @@ void Mutex::Acquire() {
}
void Mutex::Acquire(SharedPtr<Thread> thread) {
_assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
ASSERT_MSG(!ShouldWait(), "object unavailable!");
// Actually "acquire" the mutex only if we don't already have it...
if (lock_count == 0) {

View file

@ -36,7 +36,7 @@ bool Semaphore::ShouldWait() {
}
void Semaphore::Acquire() {
_assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
ASSERT_MSG(!ShouldWait(), "object unavailable!");
--available_count;
}

View file

@ -66,7 +66,7 @@ public:
}
void Acquire() override {
_assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
};

View file

@ -29,7 +29,7 @@ bool Thread::ShouldWait() {
}
void Thread::Acquire() {
_assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
ASSERT_MSG(!ShouldWait(), "object unavailable!");
}
// Lists all thread ids that aren't deleted/etc.
@ -144,7 +144,7 @@ void ArbitrateAllThreads(u32 address) {
* @param new_thread The thread to switch to
*/
static void SwitchContext(Thread* new_thread) {
_dbg_assert_msg_(Kernel, new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running.");
DEBUG_ASSERT_MSG(new_thread->status == THREADSTATUS_READY, "Thread must be ready to become running.");
Thread* previous_thread = GetCurrentThread();
@ -304,14 +304,12 @@ void Thread::ResumeFromWait() {
break;
case THREADSTATUS_RUNNING:
case THREADSTATUS_READY:
LOG_ERROR(Kernel, "Thread with object id %u has already resumed.", GetObjectId());
_dbg_assert_(Kernel, false);
DEBUG_ASSERT_MSG(false, "Thread with object id %u has already resumed.", GetObjectId());
return;
case THREADSTATUS_DEAD:
// This should never happen, as threads must complete before being stopped.
LOG_CRITICAL(Kernel, "Thread with object id %u cannot be resumed because it's DEAD.",
DEBUG_ASSERT_MSG(false, "Thread with object id %u cannot be resumed because it's DEAD.",
GetObjectId());
_dbg_assert_(Kernel, false);
return;
}
@ -387,7 +385,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
// TODO(peachum): Remove this. Range checking should be done, and an appropriate error should be returned.
static void ClampPriority(const Thread* thread, s32* priority) {
if (*priority < THREADPRIO_HIGHEST || *priority > THREADPRIO_LOWEST) {
_dbg_assert_msg_(Kernel, false, "Application passed an out of range priority. An error should be returned.");
DEBUG_ASSERT_MSG(false, "Application passed an out of range priority. An error should be returned.");
s32 new_priority = CLAMP(*priority, THREADPRIO_HIGHEST, THREADPRIO_LOWEST);
LOG_WARNING(Kernel_SVC, "(name=%s): invalid priority=%d, clamping to %d",
@ -425,7 +423,7 @@ SharedPtr<Thread> SetupIdleThread() {
}
SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) {
_dbg_assert_(Kernel, !GetCurrentThread());
DEBUG_ASSERT(!GetCurrentThread());
// Initialize new "main" thread
auto thread_res = Thread::Create("main", entry_point, priority, 0,

View file

@ -38,7 +38,7 @@ bool Timer::ShouldWait() {
}
void Timer::Acquire() {
_assert_msg_(Kernel, !ShouldWait(), "object unavailable!");
ASSERT_MSG( !ShouldWait(), "object unavailable!");
}
void Timer::Set(s64 initial, s64 interval) {

View file

@ -363,7 +363,7 @@ public:
/// Asserts that the result succeeded and returns a reference to it.
T& Unwrap() {
// TODO(yuriks): Should be a release assert
_assert_msg_(Common, Succeeded(), "Tried to Unwrap empty ResultVal");
ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
return **this;
}

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "common/logging/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ac_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/act_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/am_app.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/am_net.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/am_sys.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/apt_a.h"

View file

@ -79,7 +79,7 @@ void Initialize(Service::Interface* self) {
notification_event->Clear();
pause_event->Signal(); // Fire start event
_assert_msg_(KERNEL, (nullptr != lock), "Cannot initialize without lock");
ASSERT_MSG((nullptr != lock), "Cannot initialize without lock");
lock->Release();
cmd_buff[1] = RESULT_SUCCESS.raw; // No error

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/boss_p.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/boss_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/cam_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/cecd_s.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/cecd_u.h"

View file

@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include <algorithm>
#include "common/log.h"
#include "common/make_unique.h"
#include "core/file_sys/archive_systemsavedata.h"
#include "core/hle/service/cfg/cfg.h"
@ -109,7 +108,7 @@ ResultCode UpdateConfigNANDSavegame() {
mode.create_flag = 1;
FileSys::Path path("config");
auto file = cfg_system_save_data->OpenFile(path, mode);
_assert_msg_(Service_CFG, file != nullptr, "could not open file");
ASSERT_MSG(file != nullptr, "could not open file");
file->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data());
return RESULT_SUCCESS;
}

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/cfg/cfg.h"
#include "core/hle/service/cfg/cfg_i.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/cfg/cfg.h"
#include "core/hle/service/cfg/cfg_s.h"

View file

@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include "common/file_util.h"
#include "common/log.h"
#include "common/string_util.h"
#include "core/settings.h"
#include "core/file_sys/archive_systemsavedata.h"
@ -84,7 +83,7 @@ static void GetCountryCodeID(Service::Interface* self) {
u16 country_code_id = 0;
// The following algorithm will fail if the first country code isn't 0.
_dbg_assert_(Service_CFG, country_codes[0] == 0);
DEBUG_ASSERT(country_codes[0] == 0);
for (size_t id = 0; id < country_codes.size(); ++id) {
if (country_codes[id] == country_code) {

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/csnd_snd.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/event.h"
#include "core/hle/service/dsp_dsp.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/err_f.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/frd_a.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/frd_u.h"

View file

@ -261,7 +261,7 @@ ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factor
auto result = id_code_map.emplace(id_code, std::move(factory));
bool inserted = result.second;
_assert_msg_(Service_FS, inserted, "Tried to register more than one archive with same id code");
ASSERT_MSG(inserted, "Tried to register more than one archive with same id code");
auto& archive = result.first->second;
LOG_DEBUG(Service_FS, "Registered archive %s with id code 0x%08X", archive->GetName().c_str(), id_code);

View file

@ -2,8 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "common/bit_field.h"
#include "core/mem_map.h"
@ -36,7 +34,7 @@ static inline u8* GetCommandBuffer(u32 thread_id) {
}
static inline FrameBufferUpdate* GetFrameBufferInfo(u32 thread_id, u32 screen_index) {
_dbg_assert_msg_(Service_GSP, screen_index < 2, "Invalid screen index");
DEBUG_ASSERT_MSG(screen_index < 2, "Invalid screen index");
// For each thread there are two FrameBufferUpdate fields
u32 offset = 0x200 + (2 * thread_id + screen_index) * sizeof(FrameBufferUpdate);
@ -186,7 +184,7 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
u32 flags = cmd_buff[1];
g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]);
_assert_msg_(GSP, (g_interrupt_event != nullptr), "handle is not valid!");
ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!");
g_shared_memory = Kernel::SharedMemory::Create("GSPSharedMem");
Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom();

View file

@ -2,8 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "common/bit_field.h"
#include "core/hle/service/gsp_lcd.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/hid/hid_spvr.h"

View file

@ -2,8 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/shared_memory.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/http_c.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ir_rst.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ir_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ldr_ro.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/mic_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/news_s.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/news_u.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/nim_aoc.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/nwm_uds.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/pm_app.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ptm_play.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "common/make_unique.h"
#include "core/file_sys/archive_extsavedata.h"
#include "core/hle/hle.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "common/make_unique.h"
#include "core/hle/hle.h"
@ -148,7 +147,7 @@ Interface::Interface() {
Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
// Open it again to get a valid archive now that the folder exists
archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);
_assert_msg_(Service_PTM, archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!");
FileSys::Path gamecoin_path("gamecoin.dat");
FileSys::Mode open_mode = {};

View file

@ -29,7 +29,6 @@
#include <poll.h>
#endif
#include "common/log.h"
#include "common/scope_exit.h"
#include "core/hle/hle.h"
#include "core/hle/service/soc_u.h"
@ -259,7 +258,7 @@ union CTRSockAddr {
break;
}
default:
_dbg_assert_msg_(Service_SOC, false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform");
ASSERT_MSG(false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform");
break;
}
return result;
@ -280,7 +279,7 @@ union CTRSockAddr {
break;
}
default:
_dbg_assert_msg_(Service_SOC, false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform");
ASSERT_MSG(false, "Unhandled address family (sa_family) in CTRSockAddr::ToPlatform");
break;
}
return result;

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/service/ssl_c.h"

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/log.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/event.h"
#include "core/hle/service/y2r_u.h"

View file

@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include "common/common_types.h"
#include "common/log.h"
#include "core/core.h"
#include "core/mem_map.h"

View file

@ -175,7 +175,7 @@ static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_cou
// NOTE: on real hardware, there is no nullptr check for 'out' (tested with firmware 4.4). If
// this happens, the running application will crash.
_assert_msg_(Kernel, out != nullptr, "invalid output pointer specified!");
ASSERT_MSG(out != nullptr, "invalid output pointer specified!");
// Check if 'handle_count' is invalid
if (handle_count < 0)

View file

@ -88,4 +88,4 @@ void Shutdown() {
LOG_DEBUG(HW, "shutdown OK");
}
}
}

View file

@ -136,9 +136,9 @@ inline void Write(const VAddr vaddr, const T data) {
*(T*)&g_dsp_mem[vaddr - DSP_MEMORY_VADDR] = data;
//} else if ((vaddr & 0xFFFF0000) == 0x1FF80000) {
// _assert_msg_(MEMMAP, false, "umimplemented write to Configuration Memory");
// ASSERT_MSG(MEMMAP, false, "umimplemented write to Configuration Memory");
//} else if ((vaddr & 0xFFFFF000) == 0x1FF81000) {
// _assert_msg_(MEMMAP, false, "umimplemented write to shared page");
// ASSERT_MSG(MEMMAP, false, "umimplemented write to shared page");
// Error out...
} else {