2010-05-04 Roland McGrath * core-file.c (dwfl_core_file_report): Return any nonzero count of modules reported, even if link_map grovelling failed and only sniffing found anything. 2010-04-26 Roland McGrath * relocate.c (relocate_section): Treat R_*_NONE reloc as no reloc. Works around probably-wrong ld -r behavior for case of a DWARF address constant that refers to a discarded SHF_ALLOC section. 2010-04-14 Roland McGrath * link_map.c (report_r_debug): Limit iterations on the l_next chain to an upper bound on sane possible number of elements. 2010-03-11 Roland McGrath * link_map.c (auxv_format_probe): Fix scanning loop, so we really scan the second half for 32-bit matches. 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. If set, find the first index not below ADDR. (dwfl_segment_report_module): Update callers. Pass true when calculating return value. 2010-02-15 Roland McGrath * Makefile.am: Use config/eu.am for common stuff. * find-debuginfo.c (find_debuginfo_in_path): Fix uninitialized variable in failure path. 2010-02-02 Mark Wielaard * dwfl_module_dwarf_cfi.c (dwfl_module_dwarf_cfi): Always set bias. * dwfl_module_eh_cfi.c (dwfl_module_eh_cfi): Likewise 2010-01-07 Roland McGrath * core-file.c (dwfl_core_file_report): Use elf_getphdrnum. * dwfl_module_build_id.c (__libdwfl_find_build_id): Likewise. * dwfl_module_getdwarf.c (open_elf, find_dynsym): Likewise. * dwfl_report_elf.c (__libdwfl_report_elf): Likewise. 2010-01-06 Roland McGrath * relocate.c (relocate_getsym): For SHN_COMMON, zero st_value. (relocate_section): Let unresolved SHN_COMMON symbol stay 0. 2009-11-16 Roland McGrath * relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn. 2009-11-12 Petr Machata * core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if the chunk is both offset-contiguous and vaddr-contiguous. 2009-11-05 Roland McGrath * link_map.c (report_r_debug): Skip entries with l_ld==0. Use dwfl_addrmodule for l_ld lookup, don't bail on lookup failure. 2009-09-04 Roland McGrath * image-header.c (__libdw_image_header): Fix tranposed comparison. 2009-08-27 Roland McGrath * image-header.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwflP.h: Declare __libdw_image_header. * open.c (decompress): Don't consume ELF on failure. (what_kind): New function, broken out of ... (__libdw_open_file): ... here. Call it. If it fails, try __libdw_image_header and then try what_kind again. * gzip.c (unzip): Reuse *WHOLE as first INPUT_BUFFER, leave it behind for next decompressor. * open.c (decompress): Free BUFFER on failure. 2009-08-26 Roland McGrath * gzip.c (find_zImage_payload): New function, broken out of ... (mapped_zImage): ... here. Call it. (find_zImage_payload) [LZMA]: Match LZMA-compressed kernels with stupid method of just trying the decoder. * open.c [USE_LZMA]: Try __libdw_unlzma. * libdwflP.h: Declare it. (DWFL_ERRORS): Add DWFL_E_LZMA. * gzip.c [LZMA]: Implement liblzma version for XZ file format. * lzma.c: New file. * Makefile.am [LZMA] (libdwfl_a_SOURCES): Add it. * gzip.c (mapped_zImage): Limit scan to 32kb. Make this unconditional, support bzip2 kernel images too. (unzip): Use direct inflate method for non-mmap case too. Only zlib uses the stream method. 2009-08-09 Roland McGrath * dwfl_module_build_id.c: Use new macros for versioned definitions. 2009-07-08 Roland McGrath * dwfl_module_dwarf_cfi.c: New file. * dwfl_module_eh_cfi.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add them. * libdwflP.h (struct Dwfl_Module): New members `dwarf_cfi', `eh_cfi. Add INTDECL for dwfl_module_eh_cfi, dwfl_module_dwarf_cfi. 2009-07-08 Roland McGrath * libdwflP.h (struct Dwfl_Module): Reorder members to pack better. 2009-06-18 Mark Wielaard * dwfl_report_elf.c (__libdwfl_report_elf): Return NULL on overlap. 2009-06-13 Ulrich Drepper * derelocate.c: Don't use deprecated libelf functions. * dwfl_module_getdwarf.c: Likewise. * relocate.c: Likewise. 2009-04-23 Ulrich Drepper * dwfl_module_build_id.c: Define versioned symbols only if SHARED is defined. Otherwise just define the latest version. 2009-04-22 Roland McGrath * relocate.c (resolve_symbol): Apply correct bias to st_value found in a non-ET_REL module. * dwfl_module_build_id.c (__libdwfl_find_build_id): Fix last change to adjust properly for non-ET_REL. 2009-04-21 Roland McGrath * dwfl_module_getsym.c: Apply non-ET_REL bias only if SHF_ALLOC. * relocate.c (__libdwfl_relocate_value): Assert that MOD is ET_REL. * derelocate.c (cache_sections): Call __libdwfl_relocate_value only for ET_REL. * dwfl_module_build_id.c (__libdwfl_find_build_id): Likewise. 2009-04-20 Roland McGrath * dwfl_module_getdwarf.c (__libdwfl_getelf): Add internal_function. 2009-04-19 Roland McGrath * dwfl_module_getdwarf.c (find_file): Renamed to ... (__libdwfl_getelf): ... this. Make it global. (find_symtab, find_dw): Update callers. (dwfl_module_getelf): Functions moved ... * dwfl_module_getelf.c: ... here, new file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwflP.h: Declare __libdwfl_getelf. 2009-04-14 Roland McGrath * dwfl_segment_report_module.c: Handle DT_STRTAB value being either absolute (already adjusted in place) or needing load bias adjustment. * core-file.c (dwfl_elf_phdr_memory_callback): Fix return value for gelf_getphdr failure. Fix file size limit checks. * dwfl_segment_report_module.c: Fix underflow in DYNSTRSZ check. 2009-04-08 Roland McGrath * dwfl_module_getsym.c: Don't adjust for bias again after __libdwfl_relocate_value. * relocate.c (__libdwfl_relocate_value): Don't adjust a value from a non-SHF_ALLOC section. (relocate_getsym): Test st_shndx for SHN_* values, not *SHNDX. * dwfl_module_getsym.c (dwfl_module_getsym): Likewise. 2009-03-09 Roland McGrath * dwfl_module_build_id.c (__libdwfl_find_build_id): Move SHSTRNDX variable to outer scope, so we cache it for the loop. * relocate.c (__libdwfl_relocate_value): Add MOD->main.bias to sh_addr. 2009-02-12 Roland McGrath * dwfl_module_build_id.c (__libdwfl_find_build_id): Use __libdwfl_relocate_value to find correct sh_addr value. 2009-02-10 Roland McGrath * dwfl_report_elf.c (__libdwfl_report_elf): Take new arg SANITY. If false, don't fail for NO_PHDR. (dwfl_report_elf): Update caller. * libdwflP.h: Update decl. * offline.c (process_elf): Call it with false, so we don't refuse dubiously-formed objects here. * link_map.c (consider_executable): Don't assert dwfl_addrsegment finds our module. We shouldn't crash when we confuse some guesses. 2009-02-10 Ulrich Drepper * open.c (decompress): Avoid crash with empty input file. 2009-01-27 Roland McGrath * dwfl_report_elf.c (__libdwfl_report_elf): Ignore trailing PT_LOAD with zero vaddr and memsz. 2009-01-22 Roland McGrath * open.c (decompress): Move BUFFER, SIZE decls outside #if. * dwfl_segment_report_module.c (addr_segndx): Remove bogus adjustments after address-matching loop. * segment.c (lookup): Fix fencepost in checking for HINT match. 2009-01-14 Roland McGrath * gzip.c [!BZLIB] (mapped_zImage): New function. (unzip) [!BZLIB]: Grok Linux kernel zImage format. 2009-01-10 Ulrich Drepper * dwfl_error.c: Always use __thread. Remove all !USE_TLS code. 2009-01-08 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Skip subdirectory named "source". (dwfl_linux_kernel_find_elf): Likewise. 2009-01-06 Roland McGrath * linux-kernel-modules.c (check_suffix): New function. Match ".ko", ".ko.gz", and ".ko.bz2" suffixes. (dwfl_linux_kernel_report_offline): Use it. (dwfl_linux_kernel_find_elf): Likewise. 2009-01-05 Roland McGrath * argp-std.c (parse_opt): Use __libdw_open_file for core file. * dwfl_build_id_find_debuginfo.c: Use it to open the file. * dwfl_build_id_find_elf.c: Likewise. * dwfl_module_getdwarf.c (open_elf): Likewise. * dwfl_report_elf.c: Likewise. * find-debuginfo.c (validate): Likewise. * offline.c (__libdwfl_report_offline): Likewise. * libdwflP.h: Declare __libdw_open_file. * open.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * gzip.c: New file. * Makefile.am [ZLIB] (libdwfl_a_SOURCES): Add it. * bzip2.c: New file. * Makefile.am [BZLIB] (libdwfl_a_SOURCES): Add it. * libdwflP.h: Declare __libdw_gunzip, __libdw_bunzip2. 2008-12-16 Roland McGrath * dwfl_module_build_id.c (dwfl_module_build_id): Define with alias and symver magic to bind to ELFUTILS_0.138. (_BUG_COMPAT_dwfl_module_build_id): New function, bug compatible wrapper for ELFUTILS_0.130 version set. 2008-12-18 Roland McGrath * derelocate.c (dwfl_module_relocate_address): Fix last fix: ET_DYN addresses are taken as relative to MOD->low_addr. 2008-12-15 Roland McGrath * derelocate.c (dwfl_module_relocate_address): Apply main.bias, not debug.bias. 2008-12-11 Roland McGrath * offline.c (process_archive): Don't call elf_end and close if returning NULL. Check first elf_begin call and set error code specially for empty archive. Fixes RHBZ#465878. 2008-12-02 Roland McGrath * dwfl_getmodules.c (dwfl_getmodules): Typo fix in last change. 2008-11-26 Roland McGrath * dwfl_getmodules.c (dwfl_getmodules): Encode iteration style in return value, and interpret encoded OFFSET argument. 2008-10-07 Roland McGrath * dwfl_module_build_id.c (check_notes): Fix typo in vaddr calculation. 2008-09-29 Roland McGrath * segment.c (insert): Must realloc DWFL->lookup_module here too. (dwfl_report_segment): Clear DWFL->lookup_module before insert calls. 2008-08-28 Roland McGrath * segment.c (reify_segments): Fix last change. 2008-08-27 Roland McGrath * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM failure from pread64. 2008-08-26 Roland McGrath * segment.c (reify_segments): Insert a trailing segment for a module end that is above the highest current segment. 2008-08-25 Roland McGrath * dwfl_module_getdwarf.c (open_elf): Extract elf_errno () for coded return value, not plain DWFL_E_LIBELF. Return DWFL_E_BADELF if FILE->elf is not ELF_K_ELF. * dwfl_segment_report_module.c: Add a cast. 2008-08-21 Denys Vlasenko * dwfl_module_addrsym.c (dwfl_module_addrsym): Improve logic which decides which symbol is "closest" to a given address. 2008-08-15 Roland McGrath * argp-std.c (offline_callbacks): Use dwfl_build_id_find_elf. (options, parse_opt): Handle --core. * core-file.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwflP.h (dwfl_core_file_report): Declare it. * link_map.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwflP.h (dwfl_link_map_report): Declare it. * libdwflP.h (MIN, MAX): New macros. (Dwfl_Memory_Callback): New typedef. (Dwfl_Module_Callback): New typedef. (dwfl_segment_report_module): Declare it. * dwfl_segment_report_module.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * derelocate.c (dwfl_module_address_section): Add INTDEF. * libdwflP.h: Add INTDECL. * segment.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_addrsegment, dwfl_report_segment. * libdwflP.h (struct Dwfl): New members lookup_elts, lookup_alloc, lookup_addr, lookup_module, lookup_segndx, replace removed members modules, nmodules. (struct Dwfl_Module): New member segment. * dwfl_end.c (dwfl_end): Free the new ones. Iterate via modulelist to each free module. * dwfl_module.c (dwfl_report_begin_add): Do nothing. (dwfl_report_begin): Don't call it. Truncate the segment table instead. (dwfl_report_module): Don't touch DWFL->nmodules. (dwfl_report_end): Don't touch DWFL->modules and DWFL->nmodules. (compare_modules): Function removed. * dwfl_getmodules.c: Rewritten. Add INTDEF. * libdwflP.h: Add INTDECLs. * dwfl_getdwarf.c: Rewritten to call dwfl_getmodules. * dwfl_addrmodule.c: Rewritten to just call dwfl_addrsegment. 2008-08-03 Roland McGrath * linux-kernel-modules.c: Include before . 2008-07-17 Roland McGrath * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Set errno to zero if the failure was only ENOENT. 2008-06-03 Roland McGrath * dwfl_module_addrsym.c (dwfl_module_addrsym): Exclude undefined symbols. 2008-05-22 Petr Machata * dwfl_module_getdwarf.c (open_elf): Bias of ET_EXEC files is always 0. 2008-05-06 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use FTS_LOGICAL here too. (dwfl_linux_kernel_find_elf): Likewise. 2008-04-29 Roland McGrath * find-debuginfo.c (dwfl_standard_find_debuginfo): Try path search based on canonicalize_file_name if it differs from the supplied name. * linux-kernel-modules.c (check_module_notes): Use FTS_LOGICAL so we accept symlinks. 2008-04-27 Roland McGrath * linux-kernel-modules.c (report_kernel): Fix crash when dwfl_report_elf fails. 2008-04-05 Roland McGrath * linux-proc-maps.c (proc_maps_report): Don't leak LAST_FILE. * dwfl_module_getdwarf.c (find_file): Always free build_id_bits. Clear it after freeing. * dwfl_module_report_build_id.c (dwfl_module_report_build_id): Likewise. 2008-03-26 Roland McGrath * dwfl_module_getdwarf.c (load_symtab): Don't return success for SHT_DYNSYM, just set *SYMSCN like the comment says. * dwfl_end.c (dwfl_end): Iterate on modulelist chain, not modules array. * argp-std.c (parse_opt): On failure, call dwfl_end before argp_failure. 2008-03-19 Roland McGrath * dwfl_module_getsrc.c: Adjust address for module bias before search. 2008-03-01 Roland McGrath * libdwflP.h (__libdwfl_seterrno): Remove parameter name from prototype to avoid older compiler's complaint about reuse of the name. (__libdwfl_canon_error): Likewise. 2008-02-19 Roland McGrath * relocate.c (relocate_section): Check for an unhandled relocation type before resolving a reloc's symbol. Lift DWFL_E_BADRELTYPE -> DWFL_E_UNKNOWN_MACHINE check out of loops. * dwfl_module_getdwarf.c (load_dw): Skip relocation if DEBUGFILE->relocated is already set. 2008-01-26 Roland McGrath * dwfl_module_getdwarf.c (open_elf): Open FILE->name if it's non-null. * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Don't clear incoming *FILE_NAME at the start. 2008-01-08 Roland McGrath * Makefile.am (euinclude): Variable removed. (pkginclude_HEADERS): Set this instead of euinclude_HEADERS. 2007-10-23 Roland McGrath * linux-kernel-modules.c (report_kernel_archive): Reorder the kernel module to appear first. 2007-10-20 Roland McGrath * offline.c (process_archive_member): Take FD argument, pass it down to process_file. Return Elf_Cmd, not bool. Call elf_next here, always before elf_end. (process_archive): Update caller. Don't close FD here unless there are no member refs. * dwfl_module.c (free_file): Close fd only when elf_end returns zero. * libdwflP.h (struct dwfl_file): New bool member `relocated'. * dwfl_module_getdwarf.c (dwfl_module_getelf): For ET_REL, apply partial relocation to one or both files. (dwfl_module_getdwarf): For ET_REL, make sure extra sections' relocations have been applied to the debug file if dwfl_module_getelf has been used before. * relocate.c (resolve_symbol): New function. (relocate_section): Call it. * relocate.c (relocate_getsym): Handle null MOD->symfile. (relocate_section): Take new bool arg, PARTIAL. If true, no error for BADRELTYPE/RELUNDEF, instead just skip them and leave only those skipped relocs behind the reloc section. (__libdwfl_relocate_section): Take new arg, pass it down. (__libdwfl_relocate): Take new bool arg, DEBUG. If false, do partial relocation on all sections. * dwfl_module_getdwarf.c (load_dw): Update caller. * libdwflP.h: Update decls. * derelocate.c (dwfl_module_address_section): Pass new argument to __libdwfl_relocate_section, true. * derelocate.c (cache_sections): Don't cache reloc sections when section_address callback is null. 2007-10-19 Roland McGrath * relocate.c (relocate_section): Fix fencepost error in r_offset check. * derelocate.c (struct dwfl_relocation): Add member `relocs'. (struct secref): Likewise. (cache_sections): Cache the relocation section referring to each section we cache, if any. (dwfl_module_address_section): Use __libdwfl_relocate_section as necessary. * relocate.c (struct reloc_symtab_cache): New type. (relocate_getsym): Use it instead of four arguments. (__libdwfl_relocate): Update caller. (relocate_section): New function, broken out of ... (__libdwfl_relocate): ... here. (__libdwfl_relocate_section): New function. * libdwflP.h: Declare it. 2007-10-17 Roland McGrath * dwfl_module_getsym.c (dwfl_module_getsym): Apply MOD->symfile->bias to relocated st_value. * dwfl_report_elf.c (__libdwfl_report_elf): Align initial BASE for ET_REL to 0x100. 2007-10-16 Roland McGrath * dwfl_report_elf.c (__libdwfl_report_elf): Readjust BASE when a later section has larger alignment requirements not met by the original BASE, rather than padding more between sections. * dwfl_report_elf.c (__libdwfl_report_elf): Fix bias calculation. * dwfl_module_build_id.c (__libdwfl_find_build_id): Apply module bias to sh_addr value. * dwfl_report_elf.c (__libdwfl_report_elf): Don't be confused by BASE at zero in ET_REL case. Adjust BASE to necessary alignment. * dwfl_module_build_id.c (check_notes): Take -1, not 0, as stub value for DATA_VADDR. (__libdwfl_find_build_id): Update caller. * relocate.c (__libdwfl_relocate_value): Don't use sh_offset. * dwfl_report_elf.c (__libdwfl_report_elf): Likewise. * offline.c (dwfl_offline_section_address): Bail early if there is separate debug file. * relocate.c (__libdwfl_relocate): Don't return DWFL_E_NO_DWARF. 2007-10-09 Roland McGrath * dwfl_report_elf.c (__libdwfl_report_elf): Clear SHDR->sh_offset when caching SHDR->sh_addr = 0. * offline.c (dwfl_offline_section_address): Never called for sh_addr really at 0, don't check for it. Use MOD->debug directly, not symfile. * dwfl_module_getdwarf.c (load_symtab): Return success properly when we've found SHT_SYMTAB. * relocate.c (relocate_getsym): New function. (__libdwfl_relocate): Use it. (__libdwfl_relocate_value): Take new Elf * argument. Make SYMSHSTRNDX be a pointer instead of value; cache getshstrndx result there. * libdwflP.h: Update decl. * derelocate.c (cache_sections): Update caller. Always work on the main file, not the symfile. (dwfl_module_address_section): Likewise. * dwfl_module_getsym.c (dwfl_module_getsym): Update caller. 2007-10-07 Roland McGrath * offline.c (process_archive): Initialize MOD. * linux-kernel-modules.c (get_release): New function, broken out of ... (report_kernel): ... here. Call it. (try_kernel_name): Take new arg TRY_DEBUG, only try ".debug" if set. (find_kernel_elf): Update caller. (report_kernel_archive): New function. (dwfl_linux_kernel_report_offline): Call it. * offline.c (process_file): Take new arg PREDICATE, pass it down. (process_archive): Likewise. (process_archive_member): Likewise. When nonnull, let the predicate decide whether to use this member. (__libdwfl_report_offline): New function, broken out of ... (dwfl_report_offline): ... here. Call it. * libdwflP.h: Declare it. * offline.c (process_archive, process_archive_member): New functions. (process_elf, process_file): New functions, broken out of ... (dwfl_report_offline): ... here. Call process_file, which recurses on ELF_K_AR files. * dwfl_report_elf.c (__libdwfl_report_elf): New, broken out of ... (dwfl_report_elf): ... here. Call it. * libdwflP.h: Declare it. 2007-10-06 Roland McGrath * derelocate.c (dwfl_module_relocations): Don't call dwfl_module_getdwarf. * derelocate.c (find_section): Use __libdwfl_seterrno, not __libdw_seterrno. * relocate.c (__libdwfl_relocate_value): Abuse sh_offset, not SHF_ALLOC, to cache sh_addr resolved to 0. * dwfl_report_elf.c (dwfl_report_elf): When an ET_REL file has sh_addr values nonzero already, just use its existing layout. * relocate.c (__libdwfl_relocate): Clear size of reloc section in its in-core shdr after applying it. 2007-10-04 Ulrich Drepper * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Fake initialization of notes variable. 2007-10-04 Roland McGrath * linux-kernel-modules.c (intuit_kernel_bounds): Take new arg NOTES, fill in with vaddr of "__start_notes" symbol if found. (check_notes): New function. (check_kernel_notes): New function. (dwfl_linux_kernel_report_kernel): Call it. (check_module_notes): New function. (dwfl_linux_kernel_report_modules): Call it. * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Try dwfl_build_id_find_elf first. * linux-kernel-modules.c (report_kernel): Don't leak FD if !REPORT. Set kernel module e_type to ET_DYN. 2007-10-03 Roland McGrath * find-debuginfo.c (validate): New function, broken out of ... (find_debuginfo_in_path): ... here. New function, broken out of ... (dwfl_standard_find_debuginfo): ... here. Call it, after trying dwfl_build_id_find_debuginfo first. * dwfl_build_id_find_elf.c: New file. * dwfl_build_id_find_debuginfo.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add them. * libdwfl.h: Declare them. * libdwflP.h: Add INTDECLs. * dwfl_module_build_id.c: New file. * dwfl_module_report_build_id.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add them. * libdwfl.h: Declare them. * libdwflP.h (struct Dwfl_Module): New members build_id_bits, build_id_len, build_id_vaddr. Declare __libdwfl_find_build_id. * dwfl_module.c (__libdwfl_module_free): Free MOD->build_id_bits. * dwfl_module_getdwarf.c (find_offsets): New function. (find_dynsym): New function, calls that. (find_symtab): Call it. 2007-09-11 Roland McGrath * dwfl_module_addrsym.c: Prefer a later global symbol at the same address if its st_size is smaller. 2007-08-13 Roland McGrath * dwfl_module_addrsym.c: Add dead initializer for stupid compiler. 2007-08-12 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Don't use FTS_LOGICAL. * elf-from-memory.c (elf_from_remote_memory): Don't reset LOADBASE on a second phdr if it happens to match EHDR_VMA exactly. 2007-08-08 Roland McGrath * dwfl_module_addrsym.c: Don't use STT_SECTION, STT_FILE symbols and those with no names. Rewrite best symbol algorithm not to assume a sorted table and to be smarter handling sizeless symbols. 2007-07-16 Roland McGrath * dwfl_module.c (dwfl_report_module): Increment DWFL->nmodules when reviving an existing module. 2007-06-08 Roland McGrath * libdwflP.h: Fix #ifndef for config.h to use PACKAGE_NAME. 2007-05-17 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Look at whole /lib/modules/VERSION tree, not just /lib/modules/VERSION/kernel. (dwfl_linux_kernel_find_elf): Likewise. * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use getline and sscanf instead of fscanf. 2007-05-08 Roland McGrath * offline.c (dwfl_offline_section_address): Don't assume section numbers match between stripped and debuginfo files. Instead, assume only that the ordering among SHF_ALLOC sections matches. * linux-kernel-modules.c (report_kernel): Change RELEASE argument to pointer to string. (dwfl_linux_kernel_report_offline): Update caller. (dwfl_linux_kernel_report_kernel): Likewise. 2007-04-23 Roland McGrath * argp-std.c (options): Fix group title string. * argp-std.c (parse_opt): Handle ARGP_KEY_ERROR, free the Dwfl. Update via STATE->input every time we set STATE->hook, not only at ARGP_KEY_SUCCESS. * dwfl_module.c (free_file): Free FILE->name. 2007-04-16 Roland McGrath * derelocate.c (cache_sections): Apply bias to sh_addr. (compare_secrefs): Fix address comparison to avoid signed overflow. (find_section): New function, broken out of ... (dwfl_module_relocate_address): ... here, call it. (check_module): New function, broken out of ... (dwfl_module_relocate_address): ... here, call it. (dwfl_module_address_section): New function. * libdwfl.h: Declare it. 2007-03-26 Roland McGrath * dwfl_module.c (__libdwfl_module_free): Free MOD itself. 2007-03-18 Roland McGrath * dwfl_module_getdwarf.c (find_debuglink): New function, broken out of (find_debuginfo): ... here. Call it. Don't return error for libelf errors finding .gnu_debuglink section. 2007-03-12 Roland McGrath * dwfl_module.c (dwfl_report_begin_add): New function broken out of ... (dwfl_report_begin): ... here. Call it. * libdwfl.h: Declare it. * libdwflP.h: Add INTDECL. * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo. * offline.c: Comment typo fix. 2007-03-04 Roland McGrath * linux-kernel-modules.c (KERNEL_MODNAME): New macro for "kernel". (find_kernel_elf): New function, broken out of ... (report_kernel): ... here. Call it. (dwfl_linux_kernel_find_elf): Use it for module named KERNEL_MODNAME. (intuit_kernel_bounds): New function, grovel /proc/kallsyms to guess virtual address bounds of kernel from symbols rounded to page size. (dwfl_linux_kernel_report_kernel): Use that if it works, before resorting to report_kernel. * dwfl_module_getdwarf.c (open_elf): Set MOD->e_type to ET_DYN for an ET_EXEC file with nonzero bias. * dwfl_module_addrname.c (dwfl_module_addrname): Just call dwfl_module_addrsym. Guts moved to ... * dwfl_module_addrsym.c: ... here; new file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_module_addrsym. * libdwflP.h: Add INTDECL. 2007-03-03 Roland McGrath * dwfl_module.c (free_file): New function, broken out of ... (__libdwfl_module_free): ... here. In it, close fd after elf_end. * dwfl_module_getdwarf.c (open_elf): Close fd and reset to -1 on libelf failure. 2007-03-02 Roland McGrath * linux-kernel-modules.c: Fix bogus error test for asprintf call. 2007-02-02 Roland McGrath * dwfl_addrmodule.c (dwfl_addrmodule): Match a module's high boundary address exactly if it's no other module's low boundary. * dwfl_module_addrname.c (dwfl_module_addrname): If no symbol's value and size cover the address, select the closest symbol with st_size==0 that lies in the same section. 2007-01-29 Roland McGrath * dwfl_version.c (dwfl_version): Return PACKAGE_VERSION, not PACKAGE_STRING. 2007-01-20 Roland McGrath * relocate.c (__libdwfl_relocate_value): Treat section_address of -1 as omitted, not 0. * libdwfl.h (Dwfl_Callbacks): Update comment. * derelocate.c (cache_sections): Don't ignore sh_addr == 0 sections. * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address): For ignored missing section, use -1 instead of 0. * offline.c (dwfl_offline_section_address): Expect a call for 0. 2007-01-19 Roland McGrath * argp-std.c (parse_opt): For -e, reset DWFL->offline_next_address to zero so a lone -e foo.so is shown without address bias. 2007-01-10 Roland McGrath * linux-kernel-modules.c (report_kernel): Check asprintf return value directly instead of via side effect, to silence warn_unused_result. (dwfl_linux_kernel_report_offline): Likewise. (dwfl_linux_kernel_find_elf): Likewise. (dwfl_linux_kernel_module_section_address): Likewise. * find-debuginfo.c (try_open): Likewise. * linux-proc-maps.c (find_sysinfo_ehdr): Likewise. (dwfl_linux_proc_report): Likewise. * libdwfl.h (dwfl_begin): Require nonnull argument. 2006-12-27 Roland McGrath * dwfl_module.c (compare_modules): Fix address comparison to avoid signed overflow. Patch by Frank Ch. Eigler . 2006-10-30 Roland McGrath * dwfl_module.c (dwfl_report_module): Comment typo fix. 2006-09-05 Roland McGrath * derelocate.c (cache_sections): Use alloca instead of variable-sized auto array, in function already using alloca. 2006-08-14 Roland McGrath * linux-kernel-modules.c (try_kernel_name): If the call to dwfl_standard_find_debuginfo produces no results, try it again with NULL as DEBUGLINK_FILE to try *FNAME with .debug suffix. * find-debuginfo.c (DEFAULT_DEBUGINFO_PATH): Macro moved ... * libdwflP.h: ... to here. * linux-kernel-modules.c (try_kernel_name): Skip manual open if it repeats the first thing dwfl_standard_find_debuginfo will try. * linux-kernel-modules.c (MODULE_SECT_NAME_LEN): New macro. (dwfl_linux_kernel_module_section_address): If a /sys file is missing and the section name is >= MODULE_SECT_NAME_LEN, try truncating the section name. 2006-07-12 Ulrich Drepper * cu.c: Adjust for internal_function_def removal. * dwfl_error.c: Likewise. * dwfl_module.c: Likewise. * dwfl_module_getdwarf.c: Likewise. * lines.c: Likewise. * relocate.c: Likewise. 2006-07-11 Ulrich Drepper * dwfl_module.c (compare_modules): Don't return GElf_Sxword value, it can overflow the return value type. Patch by Tim Moore . 2006-06-28 Roland McGrath * libdwfl.h: Cosmetic changes. * dwfl_line_comp_dir.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_line_comp_dir. * dwfl_lineinfo.c (dwfl_lineinfo): Remove stray extern in defn. * dwfl_linecu.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_linecu. * libdwflP.h (dwfl_linecu_inline): Function renamed from dwfl_linecu. (dwfl_linecu): Define as macro. * relocate.c (__libdwfl_relocate): Use dwfl_module_getsym. * dwfl_module_getdwarf.c (dwfl_module_getsymtab): New function. (dwfl_module_addrname): Function moved ... * dwfl_module_addrname.c: ... here, new file. * dwfl_module_getsym.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add them. * libdwfl.h: Declare dwfl_module_getsymtab, dwfl_module_getsym. * libdwflP.h: Add INTDECLs. 2006-06-27 Roland McGrath * dwfl_module.c (dwfl_report_end): Whitespace fix. 2006-06-13 Roland McGrath * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo. Use __libdwfl_seterrno for elf_memory failure. 2006-05-22 Roland McGrath * dwfl_module_return_value_location.c (dwfl_module_return_value_location): Use __libdwfl_module_getebl. 2006-05-27 Ulrich Drepper * libdwfl.h: Add extern "C". 2006-05-22 Ulrich Drepper * cu.c (addrarange): Handle files without aranges information. 2006-05-16 Ulrich Drepper * dwfl_addrmodule.c (dwfl_addrmodule): Also return NULL of ->modules is NULL. 2006-02-26 Roland McGrath * dwfl_version.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_version. * offline.c (dwfl_report_offline): Account for dwfl_report_elf having aligned up from DWFL->offline_next_address when checking for overlap. 2005-12-22 Roland McGrath * argp-std.c (parse_opt): Call dwfl_end in failure cases. * linux-proc-maps.c (proc_maps_report): New function, broken out of ... (dwfl_linux_proc_report): ... here. Call it. (dwfl_linux_proc_maps_report): New function. * libdwfl.h: Declare it. * libdwflP.h: Add INTDECL. * argp-std.c (options, parse_opt): Grok -M/--linux-process-map. * dwfl_nextcu.c (dwfl_nextcu): Don't fail when dwfl_module_getdwarf failed with DWFL_E_NO_DWARF. 2005-11-26 Roland McGrath * dwfl_end.c (dwfl_end): Free the DWFL itself. 2005-11-25 Roland McGrath * dwfl_module_getdwarf.c (__libdwfl_module_getebl): New function. (load_dw): Use it. * dwfl_module_register_names.c (dwfl_module_register_names): Likewise. * libdwflP.h: Declare it. * dwfl_module_register_names.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_module_register_names. 2005-11-21 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address): Don't leak malloc'd file name. If a /sys/.../sections file is missing and starts with ".init", try the variant with "_init" too; catches PPC64 kernel braindamage. 2005-11-15 Roland McGrath * libdwfl.h: Comment fixes. * dwfl_module_return_value_location.c: Add unlikely for error case. 2005-11-13 Roland McGrath * dwfl_return_value_location.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_module_return_value_location. * libdwflP.h (DWFL_ERRORS): Add DWFL_E_WEIRD_TYPE. 2005-10-20 Roland McGrath * libdwflP.h (DWFL_ERRORS): New error UNKNOWN_MACHINE. * relocate.c (__libdwfl_relocate): Return DWFL_E_UNKNOWN_MACHINE instead of DWFL_E_BADRELTYPE if ebl_get_elfmachine yields EM_NONE. 2005-10-01 Roland McGrath * linux-kernel-modules.c (report_kernel): Return ENOENT if we fail with errno 0. 2005-09-19 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use PRIx64 instead of PRIi64, lest addresses with high bits set overflow the signed integer reading; they will just have to be in hexadecimal. (dwfl_linux_kernel_module_section_address): Likewise. 2005-08-28 Ulrich Drepper * Makefile.am (%.os): Use COMPILE.os. (COMPILE.os): Filter out gconv options. 2005-08-25 Roland McGrath * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end. * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info. 2005-08-24 Roland McGrath * dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it. * argp-std.c [_MUDFLAP] (__libdwfl_argp_mudflap_options): New function, magic initializer to set -heur-stack-bound option. 2005-08-22 Roland McGrath * dwfl_validate_address.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_validate_address. * derelocate.c (dwfl_module_relocate_address): Add INTDEF. * libdwflP.h: Add INTDECL. * dwfl_module_getdwarf.c (find_symtab): Use elf_getdata instead of elf_rawdata for symbol-related sections. * offline.c (dwfl_report_offline): Move offline_next_address outside module's range, in case it's an ET_EXEC using fixed segment locations. * libdwfl.h: Update comment. * dwfl_report_elf.c (dwfl_report_elf): Align BASE to first segment's required alignment. 2005-08-20 Roland McGrath * linux-kernel-modules.c (report_kernel): Take new argument PREDICATE, function to choose whether to report. (dwfl_linux_kernel_report_offline): Likewise. * libdwfl.h: Update decl. * argp-std.c (parse_opt): Update caller. * dwfl_getsrclines.c: New file. * dwfl_onesrcline.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add them. * libdwfl.h: Declare dwfl_getsrclines, dwfl_onesrcline. * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Don't leak MODULESDIR[0]. Call fts_close on failure. * dwfl_module_getdwarf.c (load_dw): Take dwfl_file * instead of Elf *. Close ET_REL file descriptors after relocation. (find_dw): Update caller. * offline.c (dwfl_report_offline): Get the file into memory and close the file descriptor. * dwfl_module_getdwarf.c (find_debuginfo): Do nothing when MOD->debug.elf is already set. * find-debuginfo.c (try_open): Use TEMP_FAILURE_RETRY. (dwfl_standard_find_debuginfo): Fail on errors not ENOENT or ENOTDIR. * argp-std.c (options, parse_opt): Grok -K/--offline-kernel, use dwfl_linux_kernel_report_offline with offline_callbacks. * linux-kernel-modules.c (report_kernel): New function, broken out of ... (dwfl_linux_kernel_report_kernel): ... here. Use it. (dwfl_linux_kernel_report_offline): New function. * libdwfl.h: Declare it. * libdwflP.h: Add INTDECL. 2005-08-19 Roland McGrath Use standard debuginfo search path to look for vmlinux. * find-debuginfo.c (dwfl_standard_find_debuginfo): Don't check CRC if passed zero. * linux-kernel-modules.c (try_kernel_name): New function, broken out of ... (dwfl_linux_kernel_report_kernel): ... here. Use it. * argp-std.c (offline_callbacks): New variable. (parse_opt): Use it for -e. Allow multiple -e options. * offline.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwfl.h: Declare dwfl_offline_section_address, dwfl_report_offline. * libdwflP.h: Add INTDECLs. (OFFLINE_REDZONE): New macro. (struct Dwfl): New member `offline_next_address'. * dwfl_begin.c (dwfl_begin): Initialize it. * dwfl_module.c (dwfl_report_begin): Likewise. * dwfl_report_elf.c (dwfl_report_elf): Accept all types. When ET_REL, do a nominal absolute section layout starting at BASE. * libdwfl.h: Update comment. 2005-08-18 Roland McGrath * dwfl_module_getsrc_file.c (dwfl_module_getsrc_file): Do dwfl_module_getdwarf if necessary. * dwfl_report_elf.c (dwfl_report_elf): Permit ET_REL with BASE==0. * libdwfl.h: Update comment. * derelocate.c: New file. * Makefile.am (libdwfl_a_SOURCES): Add it. * libdwflP.h (struct Dwfl_Module): isrel -> e_type. * dwfl_report_elf.c (dwfl_report_elf): Initialize it. * dwfl_module_getdwarf.c (open_elf): Update initialization. (load_dw, dwfl_module_addrname): Update uses. * relocate.c (__libdwfl_relocate): Likewise. 2005-08-04 Roland McGrath * libdwfl.h (Dwfl_Callbacks.section_address): Take additional arguments SHNDX, SHDR. (dwfl_linux_kernel_module_section_address): Update prototype. * relocate.c (__libdwfl_relocate_value): Update caller. * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address): Take the new arguments. 2005-08-10 Roland McGrath * relocate.c (__libdwfl_relocate): Take argument DEBUGFILE, use it instead of MOD->debug.file. * libdwflP.h: Update decl. * dwfl_module_getdwarf.c (load_dw): Update caller. Fixes bug #165598. 2005-08-09 Roland McGrath * libdwflP.h: Include ../libdw/libdwP.h for its INTDECLs. * cu.c: Use INTUSE on dwarf_* calls. * dwfl_error.c: Likewise. * dwfl_module.c: Likewise. * dwfl_module_getdwarf.c: Likewise. * dwfl_module_getsrc_file.c: Likewise. * lines.c: Likewise. 2005-08-07 Roland McGrath * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): When module names contain '_' or '-', look for files named either "foo-bar.ko" or "foo_bar.ko". 2005-07-29 Roland McGrath * loc2c.c: File removed. * loc2c.h: File removed. * loc2c-runtime.h: File removed. * test2.c: File removed. * Makefile.am (EXTRA_DIST): Variable removed. (noinst_HEADERS): Remove loc2c.h from here. 2005-07-28 Ulrich Drepper * libdwfl.h: Add a few missing extern for function prototypes. * libdwfl_crc32.c: New file. * libdwfl_crc32_file.c: New file. * libdwflP.h: Declare the new functions. * Makefile.am (libdwfl_a_SOURCES): Add libdwfl_crc32.c and libdwfl_crc32_file.c. * libdwfl/find-debuginfo.c (check_crc): Use __libdwfl_crc32_file instead of crc32_file. 2005-07-28 Roland McGrath * ptest.c: Moved to ../tests/dwflmodtest.c. * Makefile.am (noinst_PROGRAMS): Variable removed. (libdwfl_so_SOURCES, libdwfl_LIBS, libdwfl_so_LDADD): Likewise. (EXTRA_DIST, ptest_LDADD, test2_LDADD): Likewise. (libdwfl): Don't use libdwfl.so any more. (libdwfl.so, install, uninstall): Targets removed. (test2_SOURCES): Define EXTRA_DIST instead of this. * libdwfl.map: File removed. * libdwfl.h: Use "" for libdw.h #include. 2005-07-27 Roland McGrath * libdwfl.map: Add dwfl_getmodules. 2005-07-23 Ulrich Drepper * Makefile.am: Fix rules to allow building with mudflap. 2005-07-21 Roland McGrath * Makefile.am (noinst_HEADERS): Add loc2c.c. * test2.c (main): Check sscanf result to quiet warning. 2005-07-20 Roland McGrath * libdwfl-branch merged, creating this direcotry.