summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/call_stack.cpp5
-rw-r--r--src/dbghelp.cpp10
-rw-r--r--src/post_mortem.cpp8
3 files changed, 12 insertions, 11 deletions
diff --git a/src/call_stack.cpp b/src/call_stack.cpp
index 6e4bd29..b79a32b 100644
--- a/src/call_stack.cpp
+++ b/src/call_stack.cpp
@@ -14,6 +14,7 @@
#include <ostream>
#include <stdexcept>
#include <string>
+#include <string_view>
#include <system_error>
namespace winapi {
@@ -28,11 +29,11 @@ std::string format_address_fallback(Address addr) {
return put_between_brackets(address::format(addr));
}
-std::string offset_from(const std::string& thing, Address offset) {
+std::string offset_from(std::string_view thing, Address offset) {
if (offset == 0)
return put_between_brackets(thing);
else
- return put_between_brackets(thing + "+" + address::format(offset));
+ return put_between_brackets(std::format("{}+{}", thing, "+", address::format(offset)));
}
std::string offset_from_module(const ModuleInfo& module, Address addr) {
diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp
index 46905c5..20f23c3 100644
--- a/src/dbghelp.cpp
+++ b/src/dbghelp.cpp
@@ -81,7 +81,7 @@ BOOL CALLBACK enum_symbols_callback(SYMBOL_INFOW* info, ULONG, VOID* raw_callbac
void enum_symbols(HANDLE id,
Address module_base,
- const std::string& mask,
+ std::string_view mask,
const DbgHelp::OnSymbol& callback) {
if (!SymEnumSymbolsW(id,
module_base,
@@ -123,7 +123,7 @@ void DbgHelp::close() {
clean_up(id);
}
-ModuleInfo DbgHelp::load_pdb(const std::string& path) const {
+ModuleInfo DbgHelp::load_pdb(std::string_view path) const {
DWORD size = 0;
{
@@ -160,7 +160,7 @@ ModuleInfo DbgHelp::resolve_module(Address offline) const {
}
void DbgHelp::enum_symbols(const ModuleInfo& module,
- const std::string& mask,
+ std::string_view mask,
const OnSymbol& callback) const {
winapi::enum_symbols(id, module.get_offline_base(), mask, callback);
}
@@ -169,7 +169,7 @@ void DbgHelp::enum_symbols(const ModuleInfo& module, const OnSymbol& callback) c
enum_symbols(module, all_symbols, callback);
}
-void DbgHelp::enum_symbols(const std::string& mask, const OnSymbol& callback) const {
+void DbgHelp::enum_symbols(std::string_view mask, const OnSymbol& callback) const {
winapi::enum_symbols(id, 0, mask, callback);
}
@@ -188,7 +188,7 @@ SymbolInfo DbgHelp::resolve_symbol(Address offline) const {
return symbol;
}
-SymbolInfo DbgHelp::resolve_symbol(const std::string& name) const {
+SymbolInfo DbgHelp::resolve_symbol(std::string_view name) const {
SymbolInfo symbol;
if (!SymFromNameW(id, winapi::widen(name).c_str(), &static_cast<SYMBOL_INFOW&>(symbol)))
diff --git a/src/post_mortem.cpp b/src/post_mortem.cpp
index 2db7ee9..84da809 100644
--- a/src/post_mortem.cpp
+++ b/src/post_mortem.cpp
@@ -15,13 +15,13 @@
namespace winapi {
namespace {
-std::string pdb_already_loaded(Address online_base, const std::string& path) {
+std::string pdb_already_loaded(Address online_base, std::string_view path) {
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::string pdb_already_loaded(std::string_view path) {
return std::format("module has already been loaded: {}", path);
}
@@ -77,7 +77,7 @@ const Module& guess_module(const std::map<Address, Value>& modules, Address pivo
} // namespace
-Address PostMortem::add_pdb(Address online_base, const std::string& path) {
+Address PostMortem::add_pdb(Address online_base, std::string_view path) {
if (online_bases.find(online_base) != online_bases.cend())
throw std::runtime_error{pdb_already_loaded(online_base, path)};
@@ -119,7 +119,7 @@ Symbol PostMortem::resolve_symbol(Address online) const {
return symbol_from_buffer(dbghelp.resolve_symbol(address_online_to_offline(online)));
}
-Symbol PostMortem::resolve_symbol(const std::string& name) const {
+Symbol PostMortem::resolve_symbol(std::string_view name) const {
return symbol_from_buffer(dbghelp.resolve_symbol(name));
}