aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-04-28 18:16:00 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-04-28 18:16:00 +0000
commit56e7a3c65df2a89cd35ee13800284dc29fb90aad (patch)
treea3ad44d4d36cbc3999f5cdcd03ce9633d9850e5f /src
parentBreakpad Dumper: Move CFI register names to DwarfCFIToModule class. (diff)
downloadbreakpad-56e7a3c65df2a89cd35ee13800284dc29fb90aad.tar.xz
Breakpad Linux Dumper: Have DumpStabsHandler free accumulated functions if Finalize is not called
The DumpStabsHandler class creates Module::Function objects as it processes data from the StabsReader, but waits to add the Functions to the Module until all parsing is complete and its Finalize member function is called, so that it can compute line and function end addresses that the STABS data may have left implicit. If the DumpStabsHandler is destructed before its Finalize method is called, it fails to free the Functions it has created, but not yet added to the Module. (Adding a Function to a Module transfers ownership of the Function to the Module.) This adds a destructor to DumpStabsHandler which takes care of freeing any Functions that it still owns. a=jimblandy, r=thestig git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@576 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r--src/common/dump_stabs.cc9
-rw-r--r--src/common/dump_stabs.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/common/dump_stabs.cc b/src/common/dump_stabs.cc
index 436b6215..e4ae1e1b 100644
--- a/src/common/dump_stabs.cc
+++ b/src/common/dump_stabs.cc
@@ -56,6 +56,15 @@ static string Demangle(const string &mangled) {
return string(mangled);
}
+DumpStabsHandler::~DumpStabsHandler() {
+ // Free any functions we've accumulated but not added to the module.
+ for (vector<Module::Function *>::iterator func_it = functions_.begin();
+ func_it != functions_.end(); func_it++)
+ delete *func_it;
+ // Free any function that we're currently within.
+ delete current_function_;
+}
+
bool DumpStabsHandler::StartCompilationUnit(const char *name, uint64_t address,
const char *build_directory) {
assert(!in_compilation_unit_);
diff --git a/src/common/dump_stabs.h b/src/common/dump_stabs.h
index e5c34409..36d773e8 100644
--- a/src/common/dump_stabs.h
+++ b/src/common/dump_stabs.h
@@ -68,6 +68,7 @@ class DumpStabsHandler: public google_breakpad::StabsHandler {
current_function_(NULL),
current_source_file_(NULL),
current_source_file_name_(NULL) { }
+ ~DumpStabsHandler();
// The standard StabsHandler virtual member functions.
bool StartCompilationUnit(const char *name, uint64_t address,