aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-05-19 05:31:58 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-05-19 05:31:58 +0300
commita8d767a99e4c09975503e092ee4674962b27c3ce (patch)
tree0d341e027a980981e8d719133f785d1eb5dbd702 /utils
parentadd displacement to symbols (diff)
downloadwinapi-debug-a8d767a99e4c09975503e092ee4674962b27c3ce.tar.gz
winapi-debug-a8d767a99e4c09975503e092ee4674962b27c3ce.zip
refactoring
Diffstat (limited to 'utils')
-rw-r--r--utils/addr2name.cpp12
-rw-r--r--utils/name2addr.cpp10
2 files changed, 4 insertions, 18 deletions
diff --git a/utils/addr2name.cpp b/utils/addr2name.cpp
index 9719b60..a564e42 100644
--- a/utils/addr2name.cpp
+++ b/utils/addr2name.cpp
@@ -12,6 +12,7 @@
#include <exception>
#include <iostream>
+#include <sstream>
#include <string>
#include <vector>
@@ -65,20 +66,13 @@ namespace
bool help_flag = false;
};
- std::string format_address(pdb::Address address)
- {
- std::ostringstream oss;
- oss << std::showbase << std::hex << address;
- return oss.str();
- }
-
std::string format_symbol(const pdb::Symbol& symbol)
{
std::ostringstream oss;
oss << symbol.get_name();
const auto displacement = symbol.get_displacement();
if (displacement)
- oss << '+' << format_address(displacement);
+ oss << '+' << pdb::format_address(displacement);
return oss.str();
}
@@ -96,7 +90,7 @@ namespace
catch (const std::exception& e)
{
dump_error(e);
- std::cout << format_address(address) << '\n';
+ std::cout << pdb::format_address(address) << '\n';
}
}
}
diff --git a/utils/name2addr.cpp b/utils/name2addr.cpp
index 055b469..c6602c9 100644
--- a/utils/name2addr.cpp
+++ b/utils/name2addr.cpp
@@ -12,7 +12,6 @@
#include <exception>
#include <iostream>
-#include <sstream>
#include <string>
#include <vector>
@@ -66,13 +65,6 @@ namespace
bool help_flag = false;
};
- std::string format_address(pdb::Address address)
- {
- std::ostringstream oss;
- oss << std::showbase << std::hex << address;
- return oss.str();
- }
-
void dump_error(const std::exception& e)
{
std::cerr << "error: " << e.what() << '\n';
@@ -83,7 +75,7 @@ namespace
try
{
const auto address = repo.resolve_symbol(name).get_online_address();
- std::cout << format_address(address) << '\n';
+ std::cout << pdb::format_address(address) << '\n';
}
catch (const std::exception& e)
{