From 8068e06dd70d08789fafd8d6d22bbb42adbd2e7d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 10 Mar 2010 23:49:13 -0800 Subject: [PATCH] Export dwfl_core_file_report. --- NEWS | 2 ++ libdw/ChangeLog | 4 ++++ libdw/libdw.map | 5 +++++ libdwfl/ChangeLog | 7 +++++++ libdwfl/argp-std.c | 6 ++---- libdwfl/core-file.c | 9 ++++----- libdwfl/libdwfl.h | 11 ++++++++++- libdwfl/libdwflP.h | 6 +----- 8 files changed, 35 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index a59406f..95f72a3 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Version 0.146: +libdwfl: New function dwfl_core_file_report. + Version 0.145: Fix build with --disable-dependency-tracking. diff --git a/libdw/ChangeLog b/libdw/ChangeLog index c21b912..b23cd23 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,7 @@ +2010-03-10 Roland McGrath + + * libdw.map (ELFUTILS_0.146): New set. Add dwfl_core_file_report. + 2010-02-15 Roland McGrath * Makefile.am: Use config/eu.am for common stuff. diff --git a/libdw/libdw.map b/libdw/libdw.map index 8eaeacd..1a9afb1 100644 --- a/libdw/libdw.map +++ b/libdw/libdw.map @@ -232,3 +232,8 @@ ELFUTILS_0.144 { global: dwarf_aggregate_size; } ELFUTILS_0.143; + +ELFUTILS_0.146 { + global: + dwfl_core_file_report; +} ELFUTILS_0.144; diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 7df643e..86cc693 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,10 @@ +2010-03-10 Roland McGrath + + * core-file.c (dwfl_core_file_report): Punt EHDR argument. + * argp-std.c (parse_opt): Update caller. + * libdwfl.h: Declare dwfl_core_file_report. + * libdwflP.h: Don't. + 2010-02-17 Roland McGrath * dwfl_segment_report_module.c (addr_segndx): Take new flag argument. diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c index ce2e20a..e598c6e 100644 --- a/libdwfl/argp-std.c +++ b/libdwfl/argp-std.c @@ -1,5 +1,5 @@ /* Standard argp argument parsers for tools using libdwfl. - Copyright (C) 2005, 2007, 2008, 2009 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -225,9 +225,7 @@ parse_opt (int key, char *arg, struct argp_state *state) return error == DWFL_E_ERRNO ? errno : EIO; } - GElf_Ehdr ehdr; - int result = INTUSE(dwfl_core_file_report) (dwfl, core, - gelf_getehdr (core, &ehdr)); + int result = INTUSE(dwfl_core_file_report) (dwfl, core); if (result < 0) { elf_end (core); diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c index 1872d8a..2f0ca8a 100644 --- a/libdwfl/core-file.c +++ b/libdwfl/core-file.c @@ -403,18 +403,17 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, } int -dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr) +dwfl_core_file_report (Dwfl *dwfl, Elf *elf) { - GElf_Phdr notes_phdr; - size_t phnum; - if (unlikely (ehdr == NULL) || unlikely (elf_getphdrnum (elf, &phnum) != 0)) + if (unlikely (elf_getphdrnum (elf, &phnum) != 0)) { - __libdw_seterrno (DWFL_E_LIBELF); + __libdwfl_seterrno (DWFL_E_LIBELF); return -1; } /* First report each PT_LOAD segment. */ + GElf_Phdr notes_phdr; int ndx = dwfl_report_core_segments (dwfl, elf, phnum, ¬es_phdr); if (unlikely (ndx <= 0)) return ndx; diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h index fafc75e..51e9818 100644 --- a/libdwfl/libdwfl.h +++ b/libdwfl/libdwfl.h @@ -1,5 +1,5 @@ /* Interfaces for libdwfl. - Copyright (C) 2005-2009 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -359,6 +359,15 @@ extern int dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, int (*predicate) (const char *, const char *)); +/* Examine an ET_CORE file and report modules based on its contents. + This can follow a dwfl_report_offline call to bootstrap the + DT_DEBUG method of following the dynamic linker link_map chain, in + case the core file does not contain enough of the executable's text + segment to locate its PT_DYNAMIC in the dump. This might call + dwfl_report_elf on file names found in the dump if reading some + link_map files is the only way to ascertain those modules' addresses. + Returns the number of modules reported, or -1 for errors. */ +extern int dwfl_core_file_report (Dwfl *dwfl, Elf *elf); /* Call dwfl_report_module for each file mapped into the address space of PID. Returns zero on success, -1 if dwfl_report_module failed, diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index d08d8a7..58edacb 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwfl. - Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -400,10 +400,6 @@ extern int dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size, Dwfl_Memory_Callback *memory_callback, void *memory_callback_arg); -/* Examine an ET_CORE file and report modules based on its contents. */ -extern int dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr); - - /* Avoid PLT entries. */ INTDECL (dwfl_begin) -- 2.7.4