From bf25801d837b8fc496bf9c3a34eac525d8a3d8ae Mon Sep 17 00:00:00 2001 From: "ted.mielczarek" Date: Fri, 4 Mar 2011 16:08:39 +0000 Subject: 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 --- src/common/module.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/common/module.h') 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::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 *vec, vector::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 *vec, vector::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 FileByNameMap; + + // A set containing Function structures, sorted by address. typedef set FunctionSet; + // A set containing Extern structures, sorted by address. + typedef set 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 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 -- cgit v1.2.1