aboutsummaryrefslogtreecommitdiff
path: root/src/processor
diff options
context:
space:
mode:
authorbryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-10-16 18:19:09 +0000
committerbryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-10-16 18:19:09 +0000
commit181f307ffe521026d7344ed58d1545321d352ca6 (patch)
tree95d95a48031f8fd4a7b32e585838782b54b3206f /src/processor
parentImplement a tool to upload symbols on Windows, given an exe or dll file with (diff)
downloadbreakpad-181f307ffe521026d7344ed58d1545321d352ca6.tar.xz
Reduce calls to SymbolSupplier::GetSymbolFile() (#48).
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@40 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor')
-rw-r--r--src/processor/source_line_resolver.cc4
-rw-r--r--src/processor/source_line_resolver.h3
-rw-r--r--src/processor/source_line_resolver_unittest.cc5
-rw-r--r--src/processor/stackwalker.cc9
4 files changed, 16 insertions, 5 deletions
diff --git a/src/processor/source_line_resolver.cc b/src/processor/source_line_resolver.cc
index a81d4690..6d5f219c 100644
--- a/src/processor/source_line_resolver.cc
+++ b/src/processor/source_line_resolver.cc
@@ -165,6 +165,10 @@ bool SourceLineResolver::LoadModule(const string &module_name,
return true;
}
+bool SourceLineResolver::HasModule(const string &module_name) const {
+ return modules_->find(module_name) != modules_->end();
+}
+
void SourceLineResolver::FillSourceLineInfo(StackFrame *frame,
StackFrameInfo *frame_info) const {
ModuleMap::const_iterator it = modules_->find(frame->module_name);
diff --git a/src/processor/source_line_resolver.h b/src/processor/source_line_resolver.h
index 6948a86a..1490f715 100644
--- a/src/processor/source_line_resolver.h
+++ b/src/processor/source_line_resolver.h
@@ -60,6 +60,9 @@ class SourceLineResolver {
// map_file should contain line/address mappings for this module.
bool LoadModule(const string &module_name, const string &map_file);
+ // Returns true if a module with the given name has been loaded.
+ bool HasModule(const string &module_name) const;
+
// Fills in the function_base, function_name, source_file_name,
// and source_line fields of the StackFrame. The instruction and
// module_name fields must already be filled in. Additional debugging
diff --git a/src/processor/source_line_resolver_unittest.cc b/src/processor/source_line_resolver_unittest.cc
index 053bc21e..0b70b43f 100644
--- a/src/processor/source_line_resolver_unittest.cc
+++ b/src/processor/source_line_resolver_unittest.cc
@@ -69,7 +69,9 @@ static bool RunTests() {
SourceLineResolver resolver;
ASSERT_TRUE(resolver.LoadModule("module1", testdata_dir + "/module1.out"));
+ ASSERT_TRUE(resolver.HasModule("module1"));
ASSERT_TRUE(resolver.LoadModule("module2", testdata_dir + "/module2.out"));
+ ASSERT_TRUE(resolver.HasModule("module2"));
StackFrame frame;
StackFrameInfo frame_info;
@@ -112,8 +114,11 @@ static bool RunTests() {
ASSERT_FALSE(resolver.LoadModule("module3",
testdata_dir + "/module3_bad.out"));
+ ASSERT_FALSE(resolver.HasModule("module3"));
ASSERT_FALSE(resolver.LoadModule("module4",
testdata_dir + "/invalid-filename"));
+ ASSERT_FALSE(resolver.HasModule("module4"));
+ ASSERT_FALSE(resolver.HasModule("invalid-module"));
return true;
}
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index 2f74e924..e5c79cc2 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -78,14 +78,13 @@ void Stackwalker::Walk(StackFrames *frames) {
if (module) {
frame->module_name = *(module->GetName());
frame->module_base = module->base_address();
- if (modules_ && supplier_) {
- string symbol_file =
- supplier_->GetSymbolFile(module);
+ if (!resolver.HasModule(frame->module_name) && supplier_) {
+ string symbol_file = supplier_->GetSymbolFile(module);
if (!symbol_file.empty()) {
- resolver.LoadModule(*(module->GetName()), symbol_file);
- resolver.FillSourceLineInfo(frame.get(), frame_info.get());
+ resolver.LoadModule(frame->module_name, symbol_file);
}
}
+ resolver.FillSourceLineInfo(frame.get(), frame_info.get());
}
}