diff options
| author | 2018-04-27 11:09:56 -0400 | |
|---|---|---|
| committer | 2018-04-27 11:09:56 -0400 | |
| commit | acede1f1d3309e629b1ddc55ad22f920fe50f681 (patch) | |
| tree | 899731d5c75a7b40a8aa72f5e115f86e10078745 /src/core | |
| parent | Merge pull request #380 from ogniK5377/service-impl (diff) | |
| parent | general: Convert assertion macros over to be fmt-compatible (diff) | |
| download | yuzu-acede1f1d3309e629b1ddc55ad22f920fe50f681.tar.gz yuzu-acede1f1d3309e629b1ddc55ad22f920fe50f681.tar.xz yuzu-acede1f1d3309e629b1ddc55ad22f920fe50f681.zip | |
Merge pull request #409 from lioncash/assert
general: Convert assertion macros over to be fmt-compatible
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic.cpp | 2 | ||||
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 4 | ||||
| -rw-r--r-- | src/core/core_timing.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/object_address_table.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 2 | ||||
| -rw-r--r-- | src/core/memory.cpp | 19 |
11 files changed, 26 insertions, 27 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 3078b64ef..984ad853d 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp | |||
| @@ -76,7 +76,7 @@ public: | |||
| 76 | case Dynarmic::A64::Exception::Yield: | 76 | case Dynarmic::A64::Exception::Yield: |
| 77 | return; | 77 | return; |
| 78 | default: | 78 | default: |
| 79 | ASSERT_MSG(false, "ExceptionRaised(exception = %zu, pc = %" PRIx64 ")", | 79 | ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:X})", |
| 80 | static_cast<size_t>(exception), pc); | 80 | static_cast<size_t>(exception), pc); |
| 81 | } | 81 | } |
| 82 | } | 82 | } |
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index b0cdc2403..4b121edb3 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp | |||
| @@ -30,7 +30,7 @@ LoadDll LoadDll::g_load_dll; | |||
| 30 | #define CHECKED(expr) \ | 30 | #define CHECKED(expr) \ |
| 31 | do { \ | 31 | do { \ |
| 32 | if (auto _cerr = (expr)) { \ | 32 | if (auto _cerr = (expr)) { \ |
| 33 | ASSERT_MSG(false, "Call " #expr " failed with error: %u (%s)\n", _cerr, \ | 33 | ASSERT_MSG(false, "Call " #expr " failed with error: {} ({})\n", _cerr, \ |
| 34 | uc_strerror(_cerr)); \ | 34 | uc_strerror(_cerr)); \ |
| 35 | } \ | 35 | } \ |
| 36 | } while (0) | 36 | } while (0) |
| @@ -53,7 +53,7 @@ static bool UnmappedMemoryHook(uc_engine* uc, uc_mem_type type, u64 addr, int si | |||
| 53 | void* user_data) { | 53 | void* user_data) { |
| 54 | ARM_Interface::ThreadContext ctx{}; | 54 | ARM_Interface::ThreadContext ctx{}; |
| 55 | Core::CPU().SaveContext(ctx); | 55 | Core::CPU().SaveContext(ctx); |
| 56 | ASSERT_MSG(false, "Attempted to read from unmapped memory: 0x%lx, pc=0x%lx, lr=0x%lx", addr, | 56 | ASSERT_MSG(false, "Attempted to read from unmapped memory: {:#X}, pc={:#X}, lr={:#X}", addr, |
| 57 | ctx.pc, ctx.cpu_registers[30]); | 57 | ctx.pc, ctx.cpu_registers[30]); |
| 58 | return {}; | 58 | return {}; |
| 59 | } | 59 | } |
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 9e1bf2d0e..91c93e01f 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -74,7 +74,7 @@ EventType* RegisterEvent(const std::string& name, TimedCallback callback) { | |||
| 74 | // check for existing type with same name. | 74 | // check for existing type with same name. |
| 75 | // we want event type names to remain unique so that we can use them for serialization. | 75 | // we want event type names to remain unique so that we can use them for serialization. |
| 76 | ASSERT_MSG(event_types.find(name) == event_types.end(), | 76 | ASSERT_MSG(event_types.find(name) == event_types.end(), |
| 77 | "CoreTiming Event \"%s\" is already registered. Events should only be registered " | 77 | "CoreTiming Event \"{}\" is already registered. Events should only be registered " |
| 78 | "during Init to avoid breaking save states.", | 78 | "during Init to avoid breaking save states.", |
| 79 | name.c_str()); | 79 | name.c_str()); |
| 80 | 80 | ||
diff --git a/src/core/hle/kernel/object_address_table.cpp b/src/core/hle/kernel/object_address_table.cpp index cd286f85d..b88a90f24 100644 --- a/src/core/hle/kernel/object_address_table.cpp +++ b/src/core/hle/kernel/object_address_table.cpp | |||
| @@ -10,12 +10,12 @@ namespace Kernel { | |||
| 10 | ObjectAddressTable g_object_address_table; | 10 | ObjectAddressTable g_object_address_table; |
| 11 | 11 | ||
| 12 | void ObjectAddressTable::Insert(VAddr addr, SharedPtr<Object> obj) { | 12 | void ObjectAddressTable::Insert(VAddr addr, SharedPtr<Object> obj) { |
| 13 | ASSERT_MSG(objects.find(addr) == objects.end(), "Object already exists with addr=0x%lx", addr); | 13 | ASSERT_MSG(objects.find(addr) == objects.end(), "Object already exists with addr={:#X}", addr); |
| 14 | objects[addr] = obj; | 14 | objects[addr] = obj; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | void ObjectAddressTable::Close(VAddr addr) { | 17 | void ObjectAddressTable::Close(VAddr addr) { |
| 18 | ASSERT_MSG(objects.find(addr) != objects.end(), "Object does not exist with addr=0x%lx", addr); | 18 | ASSERT_MSG(objects.find(addr) != objects.end(), "Object does not exist with addr={:#X}", addr); |
| 19 | objects.erase(addr); | 19 | objects.erase(addr); |
| 20 | } | 20 | } |
| 21 | 21 | ||
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index cb19b1a69..4df38c977 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -539,7 +539,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 539 | processor_id); | 539 | processor_id); |
| 540 | break; | 540 | break; |
| 541 | default: | 541 | default: |
| 542 | ASSERT_MSG(false, "Unsupported thread processor ID: %d", processor_id); | 542 | ASSERT_MSG(false, "Unsupported thread processor ID: {}", processor_id); |
| 543 | break; | 543 | break; |
| 544 | } | 544 | } |
| 545 | 545 | ||
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 4cd57ab25..63790ea00 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -175,11 +175,11 @@ void Thread::ResumeFromWait() { | |||
| 175 | return; | 175 | return; |
| 176 | 176 | ||
| 177 | case THREADSTATUS_RUNNING: | 177 | case THREADSTATUS_RUNNING: |
| 178 | DEBUG_ASSERT_MSG(false, "Thread with object id %u has already resumed.", GetObjectId()); | 178 | DEBUG_ASSERT_MSG(false, "Thread with object id {} has already resumed.", GetObjectId()); |
| 179 | return; | 179 | return; |
| 180 | case THREADSTATUS_DEAD: | 180 | case THREADSTATUS_DEAD: |
| 181 | // This should never happen, as threads must complete before being stopped. | 181 | // This should never happen, as threads must complete before being stopped. |
| 182 | DEBUG_ASSERT_MSG(false, "Thread with object id %u cannot be resumed because it's DEAD.", | 182 | DEBUG_ASSERT_MSG(false, "Thread with object id {} cannot be resumed because it's DEAD.", |
| 183 | GetObjectId()); | 183 | GetObjectId()); |
| 184 | return; | 184 | return; |
| 185 | } | 185 | } |
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index eb2e35eed..7a5231fb7 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -245,8 +245,8 @@ VMManager::VMAIter VMManager::StripIterConstness(const VMAHandle& iter) { | |||
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) { | 247 | ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) { |
| 248 | ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%16" PRIx64, size); | 248 | ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: {:#018X}", size); |
| 249 | ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%016" PRIx64, base); | 249 | ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: {:#018X}", base); |
| 250 | 250 | ||
| 251 | VMAIter vma_handle = StripIterConstness(FindVMA(base)); | 251 | VMAIter vma_handle = StripIterConstness(FindVMA(base)); |
| 252 | if (vma_handle == vma_map.end()) { | 252 | if (vma_handle == vma_map.end()) { |
| @@ -281,8 +281,8 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u64 size) { | |||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) { | 283 | ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) { |
| 284 | ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: 0x%16" PRIx64, size); | 284 | ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: {:#018X}", size); |
| 285 | ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: 0x%016" PRIx64, target); | 285 | ASSERT_MSG((target & Memory::PAGE_MASK) == 0, "non-page aligned base: {:#018X}", target); |
| 286 | 286 | ||
| 287 | VAddr target_end = target + size; | 287 | VAddr target_end = target + size; |
| 288 | ASSERT(target_end >= target); | 288 | ASSERT(target_end >= target); |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 170420418..a6a4ab7d3 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -39,8 +39,8 @@ Module::Module() { | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | u32 Module::Open(std::string device_name) { | 41 | u32 Module::Open(std::string device_name) { |
| 42 | ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device %s", | 42 | ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device {}", |
| 43 | device_name.c_str()); | 43 | device_name); |
| 44 | 44 | ||
| 45 | auto device = devices[device_name]; | 45 | auto device = devices[device_name]; |
| 46 | u32 fd = next_fd++; | 46 | u32 fd = next_fd++; |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 34d691b90..94de21ae1 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -154,7 +154,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co | |||
| 154 | break; | 154 | break; |
| 155 | } | 155 | } |
| 156 | default: | 156 | default: |
| 157 | UNIMPLEMENTED_MSG("command_type=%d", static_cast<int>(context.GetCommandType())); | 157 | UNIMPLEMENTED_MSG("command_type={}", static_cast<int>(context.GetCommandType())); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | context.WriteToOutgoingCommandBuffer(*Kernel::GetCurrentThread()); | 160 | context.WriteToOutgoingCommandBuffer(*Kernel::GetCurrentThread()); |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 1842bae20..138883cc9 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -84,7 +84,7 @@ static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeade | |||
| 84 | reinterpret_cast<char*>(uncompressed_data.data()), compressed_size, header.size); | 84 | reinterpret_cast<char*>(uncompressed_data.data()), compressed_size, header.size); |
| 85 | 85 | ||
| 86 | ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(), | 86 | ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(), |
| 87 | "%d != %u != %zu", bytes_uncompressed, header.size, uncompressed_data.size()); | 87 | "{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size()); |
| 88 | 88 | ||
| 89 | return uncompressed_data; | 89 | return uncompressed_data; |
| 90 | } | 90 | } |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 2afa0916d..5a27fa902 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <cinttypes> | ||
| 8 | #include <cstring> | 7 | #include <cstring> |
| 9 | #include <boost/optional.hpp> | 8 | #include <boost/optional.hpp> |
| 10 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| @@ -47,7 +46,7 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa | |||
| 47 | 46 | ||
| 48 | VAddr end = base + size; | 47 | VAddr end = base + size; |
| 49 | while (base != end) { | 48 | while (base != end) { |
| 50 | ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at %016" PRIX64, base); | 49 | ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at {:016X}", base); |
| 51 | 50 | ||
| 52 | page_table.attributes[base] = type; | 51 | page_table.attributes[base] = type; |
| 53 | page_table.pointers[base] = memory; | 52 | page_table.pointers[base] = memory; |
| @@ -59,14 +58,14 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa | |||
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) { | 60 | void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) { |
| 62 | ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size); | 61 | ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size); |
| 63 | ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base); | 62 | ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base); |
| 64 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, PageType::Memory); | 63 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, target, PageType::Memory); |
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler) { | 66 | void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler) { |
| 68 | ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size); | 67 | ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size); |
| 69 | ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base); | 68 | ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base); |
| 70 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Special); | 69 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Special); |
| 71 | 70 | ||
| 72 | auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1); | 71 | auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1); |
| @@ -75,8 +74,8 @@ void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer | |||
| 75 | } | 74 | } |
| 76 | 75 | ||
| 77 | void UnmapRegion(PageTable& page_table, VAddr base, u64 size) { | 76 | void UnmapRegion(PageTable& page_table, VAddr base, u64 size) { |
| 78 | ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: %016" PRIX64, size); | 77 | ASSERT_MSG((size & PAGE_MASK) == 0, "non-page aligned size: {:016X}", size); |
| 79 | ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: %016" PRIX64, base); | 78 | ASSERT_MSG((base & PAGE_MASK) == 0, "non-page aligned base: {:016X}", base); |
| 80 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Unmapped); | 79 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, nullptr, PageType::Unmapped); |
| 81 | 80 | ||
| 82 | auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1); | 81 | auto interval = boost::icl::discrete_interval<VAddr>::closed(base, base + size - 1); |
| @@ -172,7 +171,7 @@ T Read(const VAddr vaddr) { | |||
| 172 | NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ {:#010X}", sizeof(T) * 8, vaddr); | 171 | NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ {:#010X}", sizeof(T) * 8, vaddr); |
| 173 | return 0; | 172 | return 0; |
| 174 | case PageType::Memory: | 173 | case PageType::Memory: |
| 175 | ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr); | 174 | ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr); |
| 176 | break; | 175 | break; |
| 177 | case PageType::RasterizerCachedMemory: { | 176 | case PageType::RasterizerCachedMemory: { |
| 178 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush); | 177 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush); |
| @@ -205,7 +204,7 @@ void Write(const VAddr vaddr, const T data) { | |||
| 205 | vaddr); | 204 | vaddr); |
| 206 | return; | 205 | return; |
| 207 | case PageType::Memory: | 206 | case PageType::Memory: |
| 208 | ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr); | 207 | ASSERT_MSG(false, "Mapped memory page without a pointer @ {:016X}", vaddr); |
| 209 | break; | 208 | break; |
| 210 | case PageType::RasterizerCachedMemory: { | 209 | case PageType::RasterizerCachedMemory: { |
| 211 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate); | 210 | RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate); |