|
44 | 44 | #if !defined WITH_LIBDWFL && !defined WITH_LIBUNWIND
|
45 | 45 |
|
46 | 46 | struct sr_core_stacktrace *
|
47 |
| -sr_parse_coredump_maps(const char *coredump_filename, |
48 |
| - const char *executable_filename, |
49 |
| - const char *maps_filename, |
50 |
| - char **error_message) |
| 47 | +sr_parse_coredump(const char *coredump_filename, |
| 48 | + const char *executable_filename, |
| 49 | + char **error_message) |
51 | 50 | {
|
52 | 51 | *error_message = sr_asprintf("satyr is built without unwind support");
|
53 | 52 | return NULL;
|
@@ -168,7 +167,7 @@ touch_module(Dwfl_Module *mod, void **userdata, const char *name,
|
168 | 167 | }
|
169 | 168 |
|
170 | 169 | struct core_handle *
|
171 |
| -open_coredump(const char *elf_file, const char *exe_file, const char *maps_file, char **error_msg) |
| 170 | +open_coredump(const char *elf_file, const char *exe_file, char **error_msg) |
172 | 171 | {
|
173 | 172 | struct core_handle *ch = sr_mallocz(sizeof(*ch));
|
174 | 173 | struct exe_mapping_data *head = NULL, **tail = &head;
|
@@ -203,65 +202,20 @@ open_coredump(const char *elf_file, const char *exe_file, const char *maps_file,
|
203 | 202 | goto fail_elf;
|
204 | 203 | }
|
205 | 204 |
|
206 |
| - if (maps_file) |
207 |
| - { |
208 |
| - executable_file = NULL; |
209 |
| - ch->cb.find_elf = dwfl_linux_proc_find_elf; |
210 |
| - } |
211 |
| - else |
212 |
| - { |
213 |
| - executable_file = exe_file; |
214 |
| - ch->cb.find_elf = find_elf_core; |
215 |
| - } |
216 |
| - |
| 205 | + executable_file = exe_file; |
| 206 | + ch->cb.find_elf = find_elf_core; |
217 | 207 | ch->cb.find_debuginfo = find_debuginfo_none;
|
218 | 208 | ch->cb.section_address = dwfl_offline_section_address;
|
219 | 209 | ch->dwfl = dwfl_begin(&ch->cb);
|
220 | 210 |
|
221 |
| - /* Report the addresses at which the shared libraries are loaded to |
222 |
| - * elfutils. See libdwfl/libdwfl.h in the elfutils source for documentation |
223 |
| - * of the functions used. |
224 |
| - */ |
225 |
| - if (maps_file) |
226 |
| - { |
227 |
| - /* The /proc/PID/maps file was provided - get the library information |
228 |
| - * from there. */ |
229 |
| - FILE *maps = fopen(maps_file, "r"); |
230 |
| - if (!maps) |
231 |
| - { |
232 |
| - set_error("Unable to open '%s': %s", maps_file, strerror(errno)); |
233 |
| - goto fail_dwfl; |
234 |
| - } |
235 |
| - |
236 |
| - int ret = dwfl_linux_proc_maps_report(ch->dwfl, maps); |
237 |
| - fclose(maps); |
238 |
| - |
239 |
| - if (ret < 0) |
240 |
| - { |
241 |
| - set_error_dwfl("dwfl_linux_proc_maps_report"); |
242 |
| - goto fail_dwfl; |
243 |
| - } |
244 |
| - else if (ret > 0) |
245 |
| - { |
246 |
| - set_error("Failed to parse maps file: %s", strerror(ret)); |
247 |
| - goto fail_dwfl; |
248 |
| - } |
249 |
| - } |
250 |
| - else |
251 |
| - { |
252 |
| - /* Elfutils can extract the shared library information from the memory |
253 |
| - * of the dynamic linker. Because it was writable part of the proces |
254 |
| - * image, it might be damaged. |
255 |
| - */ |
256 | 211 | #if _ELFUTILS_PREREQ(0, 158)
|
257 |
| - if (dwfl_core_file_report(ch->dwfl, ch->eh, exe_file) == -1) |
| 212 | + if (dwfl_core_file_report(ch->dwfl, ch->eh, exe_file) == -1) |
258 | 213 | #else
|
259 |
| - if (dwfl_core_file_report(ch->dwfl, ch->eh) == -1) |
| 214 | + if (dwfl_core_file_report(ch->dwfl, ch->eh) == -1) |
260 | 215 | #endif
|
261 |
| - { |
262 |
| - set_error_dwfl("dwfl_core_file_report"); |
263 |
| - goto fail_dwfl; |
264 |
| - } |
| 216 | + { |
| 217 | + set_error_dwfl("dwfl_core_file_report"); |
| 218 | + goto fail_dwfl; |
265 | 219 | }
|
266 | 220 |
|
267 | 221 | if (dwfl_report_end(ch->dwfl, NULL, NULL) != 0)
|
@@ -428,15 +382,14 @@ get_signal_number(Elf *e, const char *elf_file)
|
428 | 382 | }
|
429 | 383 |
|
430 | 384 | struct sr_core_stacktrace *
|
431 |
| -sr_core_stacktrace_from_gdb_maps(const char *gdb_output, const char *core_file, |
432 |
| - const char *exe_file, const char *maps_file, |
433 |
| - char **error_msg) |
| 385 | +sr_core_stacktrace_from_gdb(const char *gdb_output, const char *core_file, |
| 386 | + const char *exe_file, char **error_msg) |
434 | 387 | {
|
435 | 388 | /* Initialize error_msg to 'no error'. */
|
436 | 389 | if (error_msg)
|
437 | 390 | *error_msg = NULL;
|
438 | 391 |
|
439 |
| - struct core_handle *ch = open_coredump(core_file, exe_file, maps_file, error_msg); |
| 392 | + struct core_handle *ch = open_coredump(core_file, exe_file, error_msg); |
440 | 393 | if (*error_msg)
|
441 | 394 | return NULL;
|
442 | 395 |
|
@@ -490,18 +443,3 @@ sr_core_stacktrace_from_gdb_maps(const char *gdb_output, const char *core_file,
|
490 | 443 | sr_gdb_stacktrace_free(gdb_stacktrace);
|
491 | 444 | return core_stacktrace;
|
492 | 445 | }
|
493 |
| - |
494 |
| -struct sr_core_stacktrace * |
495 |
| -sr_core_stacktrace_from_gdb(const char *gdb_output, const char *core_file, |
496 |
| - const char *exe_file, char **error_msg) |
497 |
| -{ |
498 |
| - return sr_core_stacktrace_from_gdb_maps(gdb_output, core_file, exe_file, NULL, error_msg); |
499 |
| -} |
500 |
| - |
501 |
| -struct sr_core_stacktrace * |
502 |
| -sr_parse_coredump(const char *core_file, |
503 |
| - const char *exe_file, |
504 |
| - char **error_msg) |
505 |
| -{ |
506 |
| - return sr_parse_coredump_maps(core_file, exe_file, NULL, error_msg); |
507 |
| -} |
0 commit comments