| OLD | NEW |
| 1 // -*- mode: c++ -*- | 1 // -*- mode: c++ -*- |
| 2 | 2 |
| 3 // Copyright (c) 2010 Google Inc. | 3 // Copyright (c) 2010 Google Inc. |
| 4 // All rights reserved. | 4 // All rights reserved. |
| 5 // | 5 // |
| 6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
| 7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
| 8 // met: | 8 // met: |
| 9 // | 9 // |
| 10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 struct ExternCompare { | 172 struct ExternCompare { |
| 173 bool operator() (const Extern *lhs, | 173 bool operator() (const Extern *lhs, |
| 174 const Extern *rhs) const { | 174 const Extern *rhs) const { |
| 175 return lhs->address < rhs->address; | 175 return lhs->address < rhs->address; |
| 176 } | 176 } |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 // Create a new module with the given name, operating system, | 179 // Create a new module with the given name, operating system, |
| 180 // architecture, and ID string. | 180 // architecture, and ID string. |
| 181 Module(const string &name, const string &os, const string &architecture, | 181 Module(const string &name, const string &os, const string &architecture, |
| 182 const string &id); | 182 const string &id, const string &code_id = ""); |
| 183 ~Module(); | 183 ~Module(); |
| 184 | 184 |
| 185 // Set the module's load address to LOAD_ADDRESS; addresses given | 185 // Set the module's load address to LOAD_ADDRESS; addresses given |
| 186 // for functions and lines will be written to the Breakpad symbol | 186 // for functions and lines will be written to the Breakpad symbol |
| 187 // file as offsets from this address. Construction initializes this | 187 // file as offsets from this address. Construction initializes this |
| 188 // module's load address to zero: addresses written to the symbol | 188 // module's load address to zero: addresses written to the symbol |
| 189 // file will be the same as they appear in the Function, Line, and | 189 // file will be the same as they appear in the Function, Line, and |
| 190 // StackFrameEntry structures. | 190 // StackFrameEntry structures. |
| 191 // | 191 // |
| 192 // Note that this member function has no effect on addresses stored | 192 // Note that this member function has no effect on addresses stored |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // If symbol_data is not NO_CFI then: | 274 // If symbol_data is not NO_CFI then: |
| 275 // - all CFI records. | 275 // - all CFI records. |
| 276 // Addresses in the output are all relative to the load address | 276 // Addresses in the output are all relative to the load address |
| 277 // established by SetLoadAddress. | 277 // established by SetLoadAddress. |
| 278 bool Write(std::ostream &stream, SymbolData symbol_data); | 278 bool Write(std::ostream &stream, SymbolData symbol_data); |
| 279 | 279 |
| 280 string name() const { return name_; } | 280 string name() const { return name_; } |
| 281 string os() const { return os_; } | 281 string os() const { return os_; } |
| 282 string architecture() const { return architecture_; } | 282 string architecture() const { return architecture_; } |
| 283 string identifier() const { return id_; } | 283 string identifier() const { return id_; } |
| 284 string code_identifier() const { return code_id_; } |
| 284 | 285 |
| 285 private: | 286 private: |
| 286 // Report an error that has occurred writing the symbol file, using | 287 // Report an error that has occurred writing the symbol file, using |
| 287 // errno to find the appropriate cause. Return false. | 288 // errno to find the appropriate cause. Return false. |
| 288 static bool ReportError(); | 289 static bool ReportError(); |
| 289 | 290 |
| 290 // Write RULE_MAP to STREAM, in the form appropriate for 'STACK CFI' | 291 // Write RULE_MAP to STREAM, in the form appropriate for 'STACK CFI' |
| 291 // records, without a final newline. Return true if all goes well; | 292 // records, without a final newline. Return true if all goes well; |
| 292 // if an error occurs, return false, and leave errno set. | 293 // if an error occurs, return false, and leave errno set. |
| 293 static bool WriteRuleMap(const RuleMap &rule_map, std::ostream &stream); | 294 static bool WriteRuleMap(const RuleMap &rule_map, std::ostream &stream); |
| 294 | 295 |
| 295 // Module header entries. | 296 // Module header entries. |
| 296 string name_, os_, architecture_, id_; | 297 string name_, os_, architecture_, id_, code_id_; |
| 297 | 298 |
| 298 // The module's nominal load address. Addresses for functions and | 299 // The module's nominal load address. Addresses for functions and |
| 299 // lines are absolute, assuming the module is loaded at this | 300 // lines are absolute, assuming the module is loaded at this |
| 300 // address. | 301 // address. |
| 301 Address load_address_; | 302 Address load_address_; |
| 302 | 303 |
| 303 // Relation for maps whose keys are strings shared with some other | 304 // Relation for maps whose keys are strings shared with some other |
| 304 // structure. | 305 // structure. |
| 305 struct CompareStringPtrs { | 306 struct CompareStringPtrs { |
| 306 bool operator()(const string *x, const string *y) const { return *x < *y; } | 307 bool operator()(const string *x, const string *y) const { return *x < *y; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 327 vector<StackFrameEntry *> stack_frame_entries_; | 328 vector<StackFrameEntry *> stack_frame_entries_; |
| 328 | 329 |
| 329 // The module owns all the externs that have been added to it; | 330 // The module owns all the externs that have been added to it; |
| 330 // destroying the module frees the Externs these point to. | 331 // destroying the module frees the Externs these point to. |
| 331 ExternSet externs_; | 332 ExternSet externs_; |
| 332 }; | 333 }; |
| 333 | 334 |
| 334 } // namespace google_breakpad | 335 } // namespace google_breakpad |
| 335 | 336 |
| 336 #endif // COMMON_LINUX_MODULE_H__ | 337 #endif // COMMON_LINUX_MODULE_H__ |
| OLD | NEW |