aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/call_stack.cpp6
-rw-r--r--src/module.cpp18
-rw-r--r--src/post_mortem.cpp35
3 files changed, 24 insertions, 35 deletions
diff --git a/src/call_stack.cpp b/src/call_stack.cpp
index e69c10d..6e4bd29 100644
--- a/src/call_stack.cpp
+++ b/src/call_stack.cpp
@@ -10,8 +10,8 @@
#include <algorithm>
#include <array>
#include <cstddef>
+#include <format>
#include <ostream>
-#include <sstream>
#include <stdexcept>
#include <string>
#include <system_error>
@@ -21,9 +21,7 @@ namespace {
template <typename T>
static std::string put_between_brackets(const T& x) {
- std::ostringstream oss;
- oss << "[" << x << "]";
- return oss.str();
+ return std::format("[{}]", x);
}
std::string format_address_fallback(Address addr) {
diff --git a/src/module.cpp b/src/module.cpp
index 47d8eaf..ae4a95f 100644
--- a/src/module.cpp
+++ b/src/module.cpp
@@ -7,8 +7,8 @@
#include <winapi/utf8.hpp>
#include <cstring>
+#include <format>
#include <limits>
-#include <sstream>
#include <stdexcept>
#include <string>
@@ -59,17 +59,17 @@ Address Module::translate_online_address(Address online) const {
}
std::string Module::invalid_offline_address(Address offline) const {
- std::ostringstream oss;
- oss << "offline address " << address::format(offline) << " doesn't belong to module "
- << get_name() << " (base offline address " << address::format(get_offline_base()) << ')';
- return oss.str();
+ return std::format("offline address {} doesn't belong to module {} (base offline address {})",
+ address::format(offline),
+ get_name(),
+ address::format(get_offline_base()));
}
std::string Module::invalid_online_address(Address online) const {
- std::ostringstream oss;
- oss << "online address " << address::format(online) << " doesn't belong to module "
- << get_name() << " (base online address " << address::format(get_online_base()) << ')';
- return oss.str();
+ return std::format("online address {} doesn't belong to module {} (base online address {})",
+ address::format(online),
+ get_name(),
+ address::format(get_online_base()));
}
} // namespace winapi
diff --git a/src/post_mortem.cpp b/src/post_mortem.cpp
index 01f180a..2db7ee9 100644
--- a/src/post_mortem.cpp
+++ b/src/post_mortem.cpp
@@ -6,8 +6,8 @@
#include <winapi/debug.hpp>
#include <winapi/file.hpp>
+#include <format>
#include <map>
-#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
@@ -16,42 +16,33 @@ namespace winapi {
namespace {
std::string pdb_already_loaded(Address online_base, const std::string& path) {
- std::ostringstream oss;
- oss << "module with online base address " << address::format(online_base)
- << " has already been loaded: " << path;
- return oss.str();
+ return std::format("module with online base address {} has already been loaded: {}",
+ address::format(online_base),
+ path);
}
std::string pdb_already_loaded(const std::string& path) {
- std::ostringstream oss;
- oss << "module has already been loaded: " << path;
- return oss.str();
+ return std::format("module has already been loaded: {}", path);
}
std::string offline_base_already_used(Address base) {
- std::ostringstream oss;
- oss << "module with offline base address " << address::format(base)
- << " has already been loaded (shouldn't happen)";
- return oss.str();
+ return std::format(
+ "module with offline base address {} has already been loaded (shouldn't happen)",
+ address::format(base));
}
std::string module_not_found(Address base) {
- std::ostringstream oss;
- oss << "module with base address " << address::format(base) << " wasn't found";
- return oss.str();
+ return std::format("module with base address {} wasn't found", address::format(base));
}
std::string guess_module_no_modules(Address pivot) {
- std::ostringstream oss;
- oss << "couldn't select a module for address " << address::format(pivot)
- << ": no modules have been loaded yet";
- return oss.str();
+ return std::format("couldn't select a module for address {}: no modules have been loaded yet",
+ address::format(pivot));
}
std::string guess_module_address_too_low(Address pivot) {
- std::ostringstream oss;
- oss << "couldn't select a module for address " << address::format(pivot) << ": it's too low";
- return oss.str();
+ return std::format("couldn't select a module for address {}: it's too low",
+ address::format(pivot));
}
template <typename Value>