diff --git a/src/runtime/android/Memory.cpp b/src/runtime/android/Memory.cpp index 3ae1d5ef7..e2ce0fb00 100644 --- a/src/runtime/android/Memory.cpp +++ b/src/runtime/android/Memory.cpp @@ -94,10 +94,10 @@ std::string Memory::Chunk::to_string() const { } if (size() == 0) { - return fmt::format("[0x{:016x}, ...]", addr()); + return fmt::format("[{:#018x}, ...]", addr()); } - return fmt::format("[0x{:016x}, 0x{:016x}]", addr(), addr() + size()); + return fmt::format("[{:#018x}, {:#018x}]", addr(), addr() + size()); } std::optional Memory::mmap(size_t size, uint32_t flags, @@ -174,7 +174,7 @@ ok_error_t Memory::mprotect(Memory::Chunk& C, uint32_t flags) { int ret = ::mprotect((void*)pstart, len, posix_flags); if (ret != 0) { - LIEF_ERR("mprotect [0x{:016x}, 0x{:016x}] -> {} ({:04b}) failed: {} ({})", + LIEF_ERR("mprotect [{:#018x}, {:#018x}] -> {} ({:04b}) failed: {} ({})", pstart, pend, perm_str(flags), posix_flags, ret, strerror(errno)); return make_error_code(lief_errors::runtime_error); } diff --git a/src/runtime/android/Module.cpp b/src/runtime/android/Module.cpp index 96488e828..f6d472ed0 100644 --- a/src/runtime/android/Module.cpp +++ b/src/runtime/android/Module.cpp @@ -310,7 +310,7 @@ size_t Module::size() const { } std::string Module::to_string() const { - return fmt::format("0x{:08x}: {}", imagebase(), name()); + return fmt::format("{:#010x}: {}", imagebase(), name()); } modules_t modules() { diff --git a/src/runtime/linux/Memory.cpp b/src/runtime/linux/Memory.cpp index 94e595052..2271dd661 100644 --- a/src/runtime/linux/Memory.cpp +++ b/src/runtime/linux/Memory.cpp @@ -94,10 +94,10 @@ std::string Memory::Chunk::to_string() const { } if (size() == 0) { - return fmt::format("[0x{:016x}, ...]", addr()); + return fmt::format("[{:#018x}, ...]", addr()); } - return fmt::format("[0x{:016x}, 0x{:016x}]", addr(), addr() + size()); + return fmt::format("[{:#018x}, {:#018x}]", addr(), addr() + size()); } std::optional Memory::mmap(size_t size, uint32_t flags, @@ -174,7 +174,7 @@ ok_error_t Memory::mprotect(Memory::Chunk& C, uint32_t flags) { int ret = ::mprotect(reinterpret_cast(pstart), len, posix_flags); if (ret != 0) { - LIEF_ERR("mprotect [0x{:016x}, 0x{:016x}] -> {} ({:04b}) failed: {} ({})", + LIEF_ERR("mprotect [{:#018x}, {:#018x}] -> {} ({:04b}) failed: {} ({})", pstart, pend, perm_str(flags), posix_flags, ret, strerror(errno)); return make_error_code(lief_errors::runtime_error); } diff --git a/src/runtime/osx/Memory.cpp b/src/runtime/osx/Memory.cpp index d72871539..575142718 100644 --- a/src/runtime/osx/Memory.cpp +++ b/src/runtime/osx/Memory.cpp @@ -98,10 +98,10 @@ std::string Memory::Chunk::to_string() const { } if (size() == 0) { - return fmt::format("[0x{:016x}, ...]", addr()); + return fmt::format("[{:#018x}, ...]", addr()); } - return fmt::format("[0x{:016x}, 0x{:016x}]", addr(), addr() + size()); + return fmt::format("[{:#018x}, {:#018x}]", addr(), addr() + size()); } std::optional Memory::mmap(size_t size, uint32_t flags, @@ -180,7 +180,7 @@ ok_error_t Memory::mprotect(Memory::Chunk& C, uint32_t flags) { int ret = ::mprotect((void*)pstart, len, posix_flags); if (ret != 0) { - LIEF_ERR("mprotect [0x{:016x}, 0x{:016x}] -> {} ({:04b}) failed: {} ({})", + LIEF_ERR("mprotect [{:#018x}, {:#018x}] -> {} ({:04b}) failed: {} ({})", pstart, pend, perm_str(flags), posix_flags, ret, strerror(errno)); return make_error_code(lief_errors::runtime_error); } diff --git a/src/runtime/windows/Memory.cpp b/src/runtime/windows/Memory.cpp index d4e3b1781..0a429027e 100644 --- a/src/runtime/windows/Memory.cpp +++ b/src/runtime/windows/Memory.cpp @@ -75,10 +75,10 @@ std::string Memory::Chunk::to_string() const { } if (size() == 0) { - return fmt::format("[0x{:016x}, ...]", addr()); + return fmt::format("[{:#018x}, ...]", addr()); } - return fmt::format("[0x{:016x}, 0x{:016x}]", addr(), addr() + size()); + return fmt::format("[{:#018x}, {:#018x}]", addr(), addr() + size()); } @@ -179,7 +179,7 @@ ok_error_t Memory::mprotect(Memory::Chunk& C, uint32_t flags) { DWORD old_perms = 0; int ret = VirtualProtect((void*)pstart, len, win_perms, &old_perms); if (ret == 0) { - LIEF_ERR("mprotect [0x{:016x}, 0x{:016x}] -> {} ({}) failed: {}", pstart, pend, + LIEF_ERR("mprotect [{:#018x}, {:#018x}] -> {} ({}) failed: {}", pstart, pend, perm_str(flags), win_perms, GetLastError()); return make_error_code(lief_errors::runtime_error); } diff --git a/src/runtime/windows/Module.cpp b/src/runtime/windows/Module.cpp index a54c5491f..8f5e4123d 100644 --- a/src/runtime/windows/Module.cpp +++ b/src/runtime/windows/Module.cpp @@ -389,7 +389,7 @@ void* Module::dlsym(const std::string& name) const { } std::string Module::to_string() const { - return fmt::format("0x{:08x}: {}", imagebase(), name()); + return fmt::format("{:#010x}: {}", imagebase(), name()); } modules_t modules() {