mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2025-12-23 15:54:21 +01:00
Put PUBLIC lines in Mac symbol files.
Exported symbols on Mach-O binaries are defined in a STABS section. This patch makes stabs_reader handle them, adds support for Extern symbols in the Module class (which are output as PUBLIC lines in symbol files), and the proper processing in stabs_to_module to hook it all up. A=mark R=jimb at http://breakpad.appspot.com/163001 and http://breakpad.appspot.com/267001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@778 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
68b256aed3
commit
bf25801d83
9 changed files with 270 additions and 11 deletions
|
|
@ -55,6 +55,9 @@ Module::~Module() {
|
|||
for (vector<StackFrameEntry *>::iterator it = stack_frame_entries_.begin();
|
||||
it != stack_frame_entries_.end(); it++)
|
||||
delete *it;
|
||||
for (ExternSet::iterator it = externs_.begin();
|
||||
it != externs_.end(); it++)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
void Module::SetLoadAddress(Address address) {
|
||||
|
|
@ -64,7 +67,8 @@ void Module::SetLoadAddress(Address address) {
|
|||
void Module::AddFunction(Function *function) {
|
||||
std::pair<FunctionSet::iterator,bool> ret = functions_.insert(function);
|
||||
if (!ret.second) {
|
||||
// Free the duplicate we failed to insert because we own it.
|
||||
// Free the duplicate that was not inserted because this Module
|
||||
// now owns it.
|
||||
delete function;
|
||||
}
|
||||
}
|
||||
|
|
@ -79,11 +83,25 @@ void Module::AddStackFrameEntry(StackFrameEntry *stack_frame_entry) {
|
|||
stack_frame_entries_.push_back(stack_frame_entry);
|
||||
}
|
||||
|
||||
void Module::AddExtern(Extern *ext) {
|
||||
std::pair<ExternSet::iterator,bool> ret = externs_.insert(ext);
|
||||
if (!ret.second) {
|
||||
// Free the duplicate that was not inserted because this Module
|
||||
// now owns it.
|
||||
delete ext;
|
||||
}
|
||||
}
|
||||
|
||||
void Module::GetFunctions(vector<Function *> *vec,
|
||||
vector<Function *>::iterator i) {
|
||||
vec->insert(i, functions_.begin(), functions_.end());
|
||||
}
|
||||
|
||||
void Module::GetExterns(vector<Extern *> *vec,
|
||||
vector<Extern *>::iterator i) {
|
||||
vec->insert(i, externs_.begin(), externs_.end());
|
||||
}
|
||||
|
||||
Module::File *Module::FindFile(const string &name) {
|
||||
// A tricky bit here. The key of each map entry needs to be a
|
||||
// pointer to the entry's File's name string. This means that we
|
||||
|
|
@ -211,6 +229,16 @@ bool Module::Write(FILE *stream) {
|
|||
return ReportError();
|
||||
}
|
||||
|
||||
// Write out 'PUBLIC' records.
|
||||
for (ExternSet::const_iterator extern_it = externs_.begin();
|
||||
extern_it != externs_.end(); extern_it++) {
|
||||
Extern *ext = *extern_it;
|
||||
if (0 > fprintf(stream, "PUBLIC %llx 0 %s\n",
|
||||
(unsigned long long) (ext->address - load_address_),
|
||||
ext->name.c_str()))
|
||||
return ReportError();
|
||||
}
|
||||
|
||||
// Write out 'STACK CFI INIT' and 'STACK CFI' records.
|
||||
vector<StackFrameEntry *>::const_iterator frame_it;
|
||||
for (frame_it = stack_frame_entries_.begin();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue