OLD | NEW |
1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // returns -1. |out_file_name_size| is the size of the file name buffer | 131 // returns -1. |out_file_name_size| is the size of the file name buffer |
132 // (including the null-terminator). | 132 // (including the null-terminator). |
133 typedef int (*SymbolizeOpenObjectFileCallback)(uint64_t pc, | 133 typedef int (*SymbolizeOpenObjectFileCallback)(uint64_t pc, |
134 uint64_t &start_address, | 134 uint64_t &start_address, |
135 uint64_t &base_address, | 135 uint64_t &base_address, |
136 char *out_file_name, | 136 char *out_file_name, |
137 int out_file_name_size); | 137 int out_file_name_size); |
138 void InstallSymbolizeOpenObjectFileCallback( | 138 void InstallSymbolizeOpenObjectFileCallback( |
139 SymbolizeOpenObjectFileCallback callback); | 139 SymbolizeOpenObjectFileCallback callback); |
140 | 140 |
| 141 // Parsed /proc/maps entry; used by FindMappedRegion() below. |
| 142 struct MappedRegion { |
| 143 uint64_t start_address; |
| 144 uint64_t end_address; |
| 145 const char* flags; |
| 146 uint64_t file_offset; |
| 147 const char* name; |
| 148 }; |
| 149 |
| 150 // Iteratively parses /proc/self/maps and calls |callback| for each entry |
| 151 // until it returns 'true'. |
| 152 // Returns 'true' itself only if iteration was stopped by the callback. |
| 153 // The function is async-signal-safe. |
| 154 bool FindMappedRegion( |
| 155 void* callback_data, |
| 156 bool (*callback)(void* data, const MappedRegion& region)); |
| 157 |
141 _END_GOOGLE_NAMESPACE_ | 158 _END_GOOGLE_NAMESPACE_ |
142 | 159 |
143 #endif | 160 #endif |
144 | 161 |
145 _START_GOOGLE_NAMESPACE_ | 162 _START_GOOGLE_NAMESPACE_ |
146 | 163 |
147 // Symbolizes a program counter. On success, returns true and write the | 164 // Symbolizes a program counter. On success, returns true and write the |
148 // symbol name to "out". The symbol name is demangled if possible | 165 // symbol name to "out". The symbol name is demangled if possible |
149 // (supports symbols generated by GCC 3.x or newer). Otherwise, | 166 // (supports symbols generated by GCC 3.x or newer). Otherwise, |
150 // returns false. | 167 // returns false. |
151 bool Symbolize(void *pc, char *out, int out_size); | 168 bool Symbolize(void *pc, char *out, int out_size); |
152 | 169 |
153 _END_GOOGLE_NAMESPACE_ | 170 _END_GOOGLE_NAMESPACE_ |
154 | 171 |
155 #endif // BASE_SYMBOLIZE_H_ | 172 #endif // BASE_SYMBOLIZE_H_ |
OLD | NEW |