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 21 matching lines...) Expand all Loading... |
32 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> | 32 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> |
33 | 33 |
34 // Add DWARF debugging information to a Breakpad symbol file. This | 34 // Add DWARF debugging information to a Breakpad symbol file. This |
35 // file defines the DwarfCUToModule class, which accepts parsed DWARF | 35 // file defines the DwarfCUToModule class, which accepts parsed DWARF |
36 // data and populates a google_breakpad::Module with the results; the | 36 // data and populates a google_breakpad::Module with the results; the |
37 // Module can then write its contents as a Breakpad symbol file. | 37 // Module can then write its contents as a Breakpad symbol file. |
38 | 38 |
39 #ifndef COMMON_LINUX_DWARF_CU_TO_MODULE_H__ | 39 #ifndef COMMON_LINUX_DWARF_CU_TO_MODULE_H__ |
40 #define COMMON_LINUX_DWARF_CU_TO_MODULE_H__ | 40 #define COMMON_LINUX_DWARF_CU_TO_MODULE_H__ |
41 | 41 |
| 42 #include <stdint.h> |
| 43 |
42 #include <string> | 44 #include <string> |
43 | 45 |
44 #include "common/language.h" | 46 #include "common/language.h" |
45 #include "common/module.h" | 47 #include "common/module.h" |
46 #include "common/dwarf/bytereader.h" | 48 #include "common/dwarf/bytereader.h" |
47 #include "common/dwarf/dwarf2diehandler.h" | 49 #include "common/dwarf/dwarf2diehandler.h" |
48 #include "common/dwarf/dwarf2reader.h" | 50 #include "common/dwarf/dwarf2reader.h" |
49 #include "common/scoped_ptr.h" | 51 #include "common/scoped_ptr.h" |
50 #include "common/using_std_string.h" | 52 #include "common/using_std_string.h" |
51 | 53 |
(...skipping 25 matching lines...) Expand all Loading... |
77 // to true to handle debugging symbols with DW_FORM_ref_addr entries. | 79 // to true to handle debugging symbols with DW_FORM_ref_addr entries. |
78 class FileContext { | 80 class FileContext { |
79 public: | 81 public: |
80 FileContext(const string &filename, | 82 FileContext(const string &filename, |
81 Module *module, | 83 Module *module, |
82 bool handle_inter_cu_refs); | 84 bool handle_inter_cu_refs); |
83 ~FileContext(); | 85 ~FileContext(); |
84 | 86 |
85 // Add CONTENTS of size LENGTH to the section map as NAME. | 87 // Add CONTENTS of size LENGTH to the section map as NAME. |
86 void AddSectionToSectionMap(const string& name, | 88 void AddSectionToSectionMap(const string& name, |
87 const char* contents, | 89 const uint8_t *contents, |
88 uint64 length); | 90 uint64 length); |
89 | 91 |
90 // Clear the section map for testing. | 92 // Clear the section map for testing. |
91 void ClearSectionMapForTest(); | 93 void ClearSectionMapForTest(); |
92 | 94 |
93 const dwarf2reader::SectionMap& section_map() const; | 95 const dwarf2reader::SectionMap& section_map() const; |
94 | 96 |
95 private: | 97 private: |
96 friend class DwarfCUToModule; | 98 friend class DwarfCUToModule; |
97 | 99 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // Called at the beginning of a new compilation unit, prior to calling | 135 // Called at the beginning of a new compilation unit, prior to calling |
134 // ReadProgram(). compilation_dir will indicate the path that the | 136 // ReadProgram(). compilation_dir will indicate the path that the |
135 // current compilation unit was compiled in, consistent with the | 137 // current compilation unit was compiled in, consistent with the |
136 // DW_AT_comp_dir DIE. | 138 // DW_AT_comp_dir DIE. |
137 virtual void StartCompilationUnit(const string& compilation_dir) = 0; | 139 virtual void StartCompilationUnit(const string& compilation_dir) = 0; |
138 | 140 |
139 // Populate MODULE and LINES with source file names and code/line | 141 // Populate MODULE and LINES with source file names and code/line |
140 // mappings, given a pointer to some DWARF line number data | 142 // mappings, given a pointer to some DWARF line number data |
141 // PROGRAM, and an overestimate of its size. Add no zero-length | 143 // PROGRAM, and an overestimate of its size. Add no zero-length |
142 // lines to LINES. | 144 // lines to LINES. |
143 virtual void ReadProgram(const char *program, uint64 length, | 145 virtual void ReadProgram(const uint8_t *program, uint64 length, |
144 Module *module, vector<Module::Line> *lines) = 0; | 146 Module *module, vector<Module::Line> *lines) = 0; |
145 }; | 147 }; |
146 | 148 |
147 // The interface DwarfCUToModule uses to report warnings. The member | 149 // The interface DwarfCUToModule uses to report warnings. The member |
148 // function definitions for this class write messages to stderr, but | 150 // function definitions for this class write messages to stderr, but |
149 // you can override them if you'd like to detect or report these | 151 // you can override them if you'd like to detect or report these |
150 // conditions yourself. | 152 // conditions yourself. |
151 class WarningReporter { | 153 class WarningReporter { |
152 public: | 154 public: |
153 // Warn about problems in the DWARF file FILENAME, in the | 155 // Warn about problems in the DWARF file FILENAME, in the |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 311 |
310 // The line numbers we have seen thus far. We accumulate these here | 312 // The line numbers we have seen thus far. We accumulate these here |
311 // during parsing. Then, in Finish, we call AssignLinesToFunctions | 313 // during parsing. Then, in Finish, we call AssignLinesToFunctions |
312 // to dole them out to the appropriate functions. | 314 // to dole them out to the appropriate functions. |
313 vector<Module::Line> lines_; | 315 vector<Module::Line> lines_; |
314 }; | 316 }; |
315 | 317 |
316 } // namespace google_breakpad | 318 } // namespace google_breakpad |
317 | 319 |
318 #endif // COMMON_LINUX_DWARF_CU_TO_MODULE_H__ | 320 #endif // COMMON_LINUX_DWARF_CU_TO_MODULE_H__ |
OLD | NEW |