From 0dd6c95b3fcf0bef0a473901e47eb4c23fb30f5b Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 13 Jul 2010 18:14:27 +0000 Subject: Remove duplicate FUNC entries from dump_syms output. Review URL: http://breakpad.appspot.com/128001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@623 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/stabs_to_module.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/common/stabs_to_module.cc') diff --git a/src/common/stabs_to_module.cc b/src/common/stabs_to_module.cc index fbe4c02f..62fcd39e 100644 --- a/src/common/stabs_to_module.cc +++ b/src/common/stabs_to_module.cc @@ -58,7 +58,7 @@ static string Demangle(const string &mangled) { StabsToModule::~StabsToModule() { // Free any functions we've accumulated but not added to the module. - for (vector::iterator func_it = functions_.begin(); + for (vector::const_iterator func_it = functions_.begin(); func_it != functions_.end(); func_it++) delete *func_it; // Free any function that we're currently within. @@ -104,16 +104,8 @@ bool StabsToModule::EndFunction(uint64_t address) { assert(current_function_); // Functions in this compilation unit should have address bigger // than the compilation unit's starting address. There may be a lot - // of duplicated entries for functions in the STABS data; only one - // entry can meet this requirement. - // - // (I don't really understand the above comment; just bringing it along - // from the previous code, and leaving the behavior unchanged. GCC marks - // the end of each function with an N_FUN entry with no name, whose value - // is the size of the function; perhaps this test was concerned with - // skipping those. Now StabsReader interprets them properly. If you know - // the whole story, please patch this comment. --jimb) - // + // of duplicated entries for functions in the STABS data. We will + // count on the Module to remove the duplicates. if (current_function_->address >= comp_unit_base_address_) functions_.push_back(current_function_); else @@ -153,12 +145,13 @@ void StabsToModule::Finalize() { // Sort all functions by address, just for neatness. sort(functions_.begin(), functions_.end(), Module::Function::CompareByAddress); - for (vector::iterator func_it = functions_.begin(); + + for (vector::const_iterator func_it = functions_.begin(); func_it != functions_.end(); func_it++) { Module::Function *f = *func_it; // Compute the function f's size. - vector::iterator boundary + vector::const_iterator boundary = std::upper_bound(boundaries_.begin(), boundaries_.end(), f->address); if (boundary != boundaries_.end()) f->size = *boundary - f->address; -- cgit v1.2.1