Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: src/processor/basic_code_modules.cc

Issue 2060663002: Server-side workaround to handle overlapping modules. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Fix whitespace. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/processor/basic_code_modules.h ('k') | src/processor/basic_source_line_resolver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/processor/basic_code_modules.cc
diff --git a/src/processor/basic_code_modules.cc b/src/processor/basic_code_modules.cc
index 00dc6fcb7f2f8de67a6d2a6fbbb7998e2c8f4444..48d971677cda184f551ae3ca71ee3a86f3eef081 100644
--- a/src/processor/basic_code_modules.cc
+++ b/src/processor/basic_code_modules.cc
@@ -38,6 +38,8 @@
#include <assert.h>
+#include <vector>
+
#include "google_breakpad/processor/code_module.h"
#include "processor/linked_ptr.h"
#include "processor/logging.h"
@@ -45,31 +47,50 @@
namespace google_breakpad {
+using std::vector;
+
BasicCodeModules::BasicCodeModules(const CodeModules *that)
: main_address_(0), map_() {
BPLOG_IF(ERROR, !that) << "BasicCodeModules::BasicCodeModules requires "
"|that|";
assert(that);
+ map_.SetEnableShrinkDown(that->IsModuleShrinkEnabled());
+
const CodeModule *main_module = that->GetMainModule();
if (main_module)
main_address_ = main_module->base_address();
unsigned int count = that->module_count();
- for (unsigned int module_sequence = 0;
- module_sequence < count;
- ++module_sequence) {
+ for (unsigned int i = 0; i < count; ++i) {
// Make a copy of the module and insert it into the map. Use
// GetModuleAtIndex because ordering is unimportant when slurping the
// entire list, and GetModuleAtIndex may be faster than
// GetModuleAtSequence.
- linked_ptr<const CodeModule> module(
- that->GetModuleAtIndex(module_sequence)->Copy());
+ linked_ptr<const CodeModule> module(that->GetModuleAtIndex(i)->Copy());
if (!map_.StoreRange(module->base_address(), module->size(), module)) {
- BPLOG(ERROR) << "Module " << module->code_file() <<
- " could not be stored";
+ BPLOG(ERROR) << "Module " << module->code_file()
+ << " could not be stored";
+ }
+ }
+
+ // Report modules with shrunk ranges.
+ for (unsigned int i = 0; i < count; ++i) {
+ linked_ptr<const CodeModule> module(that->GetModuleAtIndex(i)->Copy());
+ uint64_t delta = 0;
+ if (map_.RetrieveRange(module->base_address() + module->size() - 1,
+ &module, NULL /* base */, &delta, NULL /* size */) &&
+ delta > 0) {
+ BPLOG(INFO) << "The range for module " << module->code_file()
+ << " was shrunk down by " << HexString(delta) << " bytes.";
+ linked_ptr<CodeModule> shrunk_range_module(module->Copy());
+ shrunk_range_module->SetShrinkDownDelta(delta);
+ shrunk_range_modules_.push_back(shrunk_range_module);
}
}
+
+ // TODO(ivanpe): Report modules with conflicting ranges. The list of such
+ // modules should be copied from |that|.
}
BasicCodeModules::BasicCodeModules() : main_address_(0), map_() { }
@@ -122,4 +143,13 @@ const CodeModules* BasicCodeModules::Copy() const {
return new BasicCodeModules(this);
}
+vector<linked_ptr<const CodeModule> >
+BasicCodeModules::GetShrunkRangeModules() const {
+ return shrunk_range_modules_;
+}
+
+bool BasicCodeModules::IsModuleShrinkEnabled() const {
+ return map_.IsShrinkDownEnabled();
+}
+
} // namespace google_breakpad
« no previous file with comments | « src/processor/basic_code_modules.h ('k') | src/processor/basic_source_line_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698