aboutsummaryrefslogtreecommitdiff
path: root/src/common/module.h
diff options
context:
space:
mode:
authorted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-03-04 16:08:39 +0000
committerted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-03-04 16:08:39 +0000
commitbf25801d837b8fc496bf9c3a34eac525d8a3d8ae (patch)
treeeefc9e418e10864c47cf9055ddf97a79f8a38979 /src/common/module.h
parentUpdating to ints from unsigned ints so -1 will be an acceptable value. (diff)
downloadbreakpad-bf25801d837b8fc496bf9c3a34eac525d8a3d8ae.tar.xz
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
Diffstat (limited to 'src/common/module.h')
-rw-r--r--src/common/module.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/common/module.h b/src/common/module.h
index 8c20cea0..83e8403c 100644
--- a/src/common/module.h
+++ b/src/common/module.h
@@ -65,6 +65,7 @@ class Module {
struct File;
struct Function;
struct Line;
+ struct Extern;
// Addresses appearing in File, Function, and Line structures are
// absolute, not relative to the the module's load address. That
@@ -117,6 +118,12 @@ class Module {
int number; // The source line number.
};
+ // An exported symbol.
+ struct Extern {
+ Address address;
+ string name;
+ };
+
// A map from register names to postfix expressions that recover
// their their values. This can represent a complete set of rules to
// follow at some address, or a set of changes to be applied to an
@@ -155,6 +162,13 @@ class Module {
}
};
+ struct ExternCompare {
+ bool operator() (const Extern *lhs,
+ const Extern *rhs) const {
+ return lhs->address < rhs->address;
+ }
+ };
+
// Create a new module with the given name, operating system,
// architecture, and ID string.
Module(const string &name, const string &os, const string &architecture,
@@ -187,11 +201,15 @@ class Module {
vector<Function *>::iterator end);
// Add STACK_FRAME_ENTRY to the module.
- //
// This module owns all StackFrameEntry objects added with this
// function: destroying the module destroys them as well.
void AddStackFrameEntry(StackFrameEntry *stack_frame_entry);
+ // Add PUBLIC to the module.
+ // This module owns all Extern objects added with this function:
+ // destroying the module destroys them as well.
+ void AddExtern(Extern *ext);
+
// If this module has a file named NAME, return a pointer to it. If
// it has none, then create one and return a pointer to the new
// file. This module owns all File objects created using these
@@ -210,6 +228,13 @@ class Module {
// appropriate interface.)
void GetFunctions(vector<Function *> *vec, vector<Function *>::iterator i);
+ // Insert pointers to the externs added to this module at I in
+ // VEC. The pointed-to Externs are still owned by this module.
+ // (Since this is effectively a copy of the extern list, this is
+ // mostly useful for testing; other uses should probably get a more
+ // appropriate interface.)
+ void GetExterns(vector<Extern *> *vec, vector<Extern *>::iterator i);
+
// Clear VEC and fill it with pointers to the Files added to this
// module, sorted by name. The pointed-to Files are still owned by
// this module. (Since this is effectively a copy of the file list,
@@ -269,8 +294,13 @@ class Module {
// A map from filenames to File structures. The map's keys are
// pointers to the Files' names.
typedef map<const string *, File *, CompareStringPtrs> FileByNameMap;
+
+ // A set containing Function structures, sorted by address.
typedef set<Function *, FunctionCompare> FunctionSet;
+ // A set containing Extern structures, sorted by address.
+ typedef set<Extern *, ExternCompare> ExternSet;
+
// The module owns all the files and functions that have been added
// to it; destroying the module frees the Files and Functions these
// point to.
@@ -280,6 +310,10 @@ class Module {
// The module owns all the call frame info entries that have been
// added to it.
vector<StackFrameEntry *> stack_frame_entries_;
+
+ // The module owns all the externs that have been added to it;
+ // destroying the module frees the Externs these point to.
+ ExternSet externs_;
};
} // namespace google_breakpad