diff options
author | Roland McGrath <roland@redhat.com> | 2007-11-16 15:19:09 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2007-11-16 15:19:09 +0000 |
commit | ff8d659689b0aee56d115bdc0f24d68e61ce9a05 (patch) | |
tree | ce6311e3afa4851d0dc087bfed63ce4bda2dce62 /elfutils/libdw | |
parent | 965679e2f32d58a7052caf2b81666d0049ba41f8 (diff) | |
download | elfutils-ff8d659689b0aee56d115bdc0f24d68e61ce9a05.tar.gz |
0.131-10.131-1
- Update to 0.131
- libdw: DW_FORM_ref_addr support; dwarf_formref entry point now deprecated;
bug fixes for oddly-formatted DWARF
- libdwfl: bug fixes in offline archive support, symbol table handling;
apply partial relocations for dwfl_module_address_section on ET_REL
- libebl: powerpc backend support for Altivec registers
Diffstat (limited to 'elfutils/libdw')
-rw-r--r-- | elfutils/libdw/ChangeLog | 96 | ||||
-rw-r--r-- | elfutils/libdw/Makefile.am | 4 | ||||
-rw-r--r-- | elfutils/libdw/Makefile.in | 167 | ||||
-rw-r--r-- | elfutils/libdw/dwarf.h | 4 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_begin_elf.c | 27 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_child.c | 11 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_formref.c | 22 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_formref_die.c | 36 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_getscopes.c | 38 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_getsrcdirs.c | 69 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_getsrclines.c | 24 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_ranges.c | 21 | ||||
-rw-r--r-- | elfutils/libdw/dwarf_siblingof.c | 4 | ||||
-rw-r--r-- | elfutils/libdw/libdw.h | 28 | ||||
-rw-r--r-- | elfutils/libdw/libdw.map | 24 | ||||
-rw-r--r-- | elfutils/libdw/libdwP.h | 11 | ||||
-rw-r--r-- | elfutils/libdw/libdw_findcu.c | 13 | ||||
-rw-r--r-- | elfutils/libdw/libdw_form.c | 7 | ||||
-rw-r--r-- | elfutils/libdw/libdw_visit_scopes.c | 4 |
19 files changed, 462 insertions, 148 deletions
diff --git a/elfutils/libdw/ChangeLog b/elfutils/libdw/ChangeLog index 814299b8..b7cd6285 100644 --- a/elfutils/libdw/ChangeLog +++ b/elfutils/libdw/ChangeLog @@ -1,3 +1,99 @@ +2007-10-17 Roland McGrath <roland@redhat.com> + + * libdw.h (__deprecated_attribute__): New macro. + (dwarf_formref): Mark it deprecated. + * dwarf_formref.c (__libdw_formref): New function, broken out of ... + (dwarf_formref): ... here. Call it. Remove INTDEF. + * libdwP.h: Remove INTDECL. + Declare __libdw_formref. + * dwarf_siblingof.c (dwarf_siblingof): Call __libdw_formref instead. + * dwarf_formref_die.c: Likewise. Handle DW_FORM_ref_addr here. + + * libdw_form.c (__libdw_form_val_len): Fix DW_FORM_ref_addr result, + needs to check CU->version. + + * libdwP.h (struct Dwarf_CU): New member `version'. + * libdw_findcu.c (__libdw_findcu): Initialize it. + + * dwarf_child.c: Return 1 for null entry as first child. + +2007-10-05 Roland McGrath <roland@redhat.com> + + * dwarf_begin_elf.c (check_section): Punt on SHT_NOBITS sections. + + * libdw.h (__extern_inline): Rename to __libdw_extern_inline. + [__OPTIMIZE__] (dwarf_whatattr, dwarf_whatform): Update uses. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.130: Add dwfl_build_id_find_elf + and dwfl_build_id_find_debuginfo. + + * libdw.map (ELFUTILS_0.130): New version set, inherits from + ELFUTILS_0.127. Add dwfl_module_build_id, dwfl_module_report_build_id. + +2007-10-02 Roland McGrath <roland@redhat.com> + + * libdw_visit_scopes.c (classify_die): Return walk for class_type and + structure_type. + +2007-08-07 Roland McGrath <roland@redhat.com> + + * dwarf_getscopes.c (pc_match): Swallow dwarf_haspc error return when + error code is DWARF_E_NOERROR (0). + + * dwarf_getscopes.c (pc_record): Always bail early if DIE->prune. + Fix typo in __libdw_visit_scopes argument. + + * dwarf_getscopes.c (pc_match): Check dwarf_haspc error return, + swallow DWARF_E_NO_DEBUG_RANGES but not other errors. + +2007-07-03 Roland McGrath <roland@redhat.com> + + * libdw.h (__extern_inline): New macro. + [__OPTIMIZE__] (dwarf_whatattr, dwarf_whatform): Use it. + +2007-04-16 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.127): Add dwfl_module_address_section. + +2007-04-05 Roland McGrath <roland@redhat.com> + + * dwarf_getsrcdirs.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare dwarf_getsrcdirs. + * libdw.map (ELFUTILS_0.127): Add it. + + * libdwP.h (struct Dwarf_Files_s): New member ndirs. + * dwarf_getsrclines.c (dwarf_getsrclines): Don't clobber NDIRLIST to + zero before we use it to check for DWARF_E_INVALID_DIR_IDX. + Save DIRARRAY in the Dwarf_Files. + + * dwarf_ranges.c (dwarf_ranges): Don't sign-extend 32-bit BEGIN + address to check for all-ones base address entry. Check directly. + Reported by Sébastien Dugué <sebastien.dugue@bull.net>. + +2007-03-25 Roland McGrath <roland@redhat.com> + + * dwarf_begin_elf.c (check_section): Return Dwarf * instead of void. + Return NULL when freeing RESULT on error. + (global_read, scngrp_read): Check return value from check_section, + break out of loop after it has freed RESULT. + (valid_p): Handle null argument. + +2007-03-12 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.127): Add dwfl_report_begin_add. + +2007-03-04 Roland McGrath <roland@redhat.com> + + * libdw.map (ELFUTILS_0.127): New version set, inherits from + ELFUTILS_0.126. Add dwfl_module_addrsym. + +2007-02-10 Roland McGrath <roland@redhat.com> + + * dwarf.h (DW_OP_fbreg): Comment fix. + 2007-02-03 Roland McGrath <roland@redhat.com> * dwarf_getelf.c (dwarf_getelf): Renamed from dwarf_get_elf. diff --git a/elfutils/libdw/Makefile.am b/elfutils/libdw/Makefile.am index 04d15bbf..62057dc9 100644 --- a/elfutils/libdw/Makefile.am +++ b/elfutils/libdw/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. +## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -73,7 +73,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ dwarf_lineendsequence.c dwarf_lineblock.c \ dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \ dwarf_onesrcline.c dwarf_formblock.c \ - dwarf_getsrcfiles.c dwarf_filesrc.c \ + dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \ dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \ dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \ dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \ diff --git a/elfutils/libdw/Makefile.in b/elfutils/libdw/Makefile.in index 8f68c953..25df03a3 100644 --- a/elfutils/libdw/Makefile.in +++ b/elfutils/libdw/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,15 +16,11 @@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -46,11 +42,11 @@ DIST_COMMON = $(euinclude_HEADERS) $(include_HEADERS) \ $(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -66,9 +62,8 @@ LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libdw_a_AR = $(AR) $(ARFLAGS) -am__DEPENDENCIES_1 = ar -libdw_a_DEPENDENCIES = $(addprefix ../libdwfl/,$(shell \ - $(am__DEPENDENCIES_1) t ../libdwfl/libdwfl.a)) +libdw_a_DEPENDENCIES = $(addprefix ../libdwfl/,$(shell $(AR) t \ + ../libdwfl/libdwfl.a)) am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ dwarf_end.$(OBJEXT) dwarf_getelf.$(OBJEXT) \ dwarf_getpubnames.$(OBJEXT) dwarf_getabbrev.$(OBJEXT) \ @@ -102,20 +97,20 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ dwarf_lineprologueend.$(OBJEXT) \ dwarf_lineepiloguebegin.$(OBJEXT) dwarf_onesrcline.$(OBJEXT) \ dwarf_formblock.$(OBJEXT) dwarf_getsrcfiles.$(OBJEXT) \ - dwarf_filesrc.$(OBJEXT) dwarf_getlocation.$(OBJEXT) \ - dwarf_getstring.$(OBJEXT) dwarf_offabbrev.$(OBJEXT) \ - dwarf_getaranges.$(OBJEXT) dwarf_onearange.$(OBJEXT) \ - dwarf_getarangeinfo.$(OBJEXT) dwarf_getarange_addr.$(OBJEXT) \ - dwarf_getattrs.$(OBJEXT) dwarf_formflag.$(OBJEXT) \ - dwarf_getmacros.$(OBJEXT) dwarf_macro_opcode.$(OBJEXT) \ - dwarf_macro_param1.$(OBJEXT) dwarf_macro_param2.$(OBJEXT) \ - dwarf_addrdie.$(OBJEXT) dwarf_getfuncs.$(OBJEXT) \ - dwarf_decl_file.$(OBJEXT) dwarf_decl_line.$(OBJEXT) \ - dwarf_decl_column.$(OBJEXT) dwarf_func_inline.$(OBJEXT) \ - dwarf_getsrc_file.$(OBJEXT) libdw_findcu.$(OBJEXT) \ - libdw_form.$(OBJEXT) libdw_alloc.$(OBJEXT) \ - memory-access.$(OBJEXT) libdw_visit_scopes.$(OBJEXT) \ - dwarf_entry_breakpoints.$(OBJEXT) + dwarf_filesrc.$(OBJEXT) dwarf_getsrcdirs.$(OBJEXT) \ + dwarf_getlocation.$(OBJEXT) dwarf_getstring.$(OBJEXT) \ + dwarf_offabbrev.$(OBJEXT) dwarf_getaranges.$(OBJEXT) \ + dwarf_onearange.$(OBJEXT) dwarf_getarangeinfo.$(OBJEXT) \ + dwarf_getarange_addr.$(OBJEXT) dwarf_getattrs.$(OBJEXT) \ + dwarf_formflag.$(OBJEXT) dwarf_getmacros.$(OBJEXT) \ + dwarf_macro_opcode.$(OBJEXT) dwarf_macro_param1.$(OBJEXT) \ + dwarf_macro_param2.$(OBJEXT) dwarf_addrdie.$(OBJEXT) \ + dwarf_getfuncs.$(OBJEXT) dwarf_decl_file.$(OBJEXT) \ + dwarf_decl_line.$(OBJEXT) dwarf_decl_column.$(OBJEXT) \ + dwarf_func_inline.$(OBJEXT) dwarf_getsrc_file.$(OBJEXT) \ + libdw_findcu.$(OBJEXT) libdw_form.$(OBJEXT) \ + libdw_alloc.$(OBJEXT) memory-access.$(OBJEXT) \ + libdw_visit_scopes.$(OBJEXT) dwarf_entry_breakpoints.$(OBJEXT) libdw_a_OBJECTS = $(am_libdw_a_OBJECTS) libdw_pic_a_AR = $(AR) $(ARFLAGS) libdw_pic_a_LIBADD = @@ -125,7 +120,7 @@ PROGRAMS = $(noinst_PROGRAMS) am_libdw_so_OBJECTS = libdw_so_OBJECTS = $(am_libdw_so_OBJECTS) libdw_so_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -143,15 +138,11 @@ ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ -BUILD_STATIC_FALSE = @BUILD_STATIC_FALSE@ -BUILD_STATIC_TRUE = @BUILD_STATIC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -164,13 +155,9 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ -GCOV_FALSE = @GCOV_FALSE@ -GCOV_TRUE = @GCOV_TRUE@ GMSGFMT = @GMSGFMT@ -GPROF_FALSE = @GPROF_FALSE@ -GPROF_TRUE = @GPROF_TRUE@ -HAVE_LIBASM_FALSE = @HAVE_LIBASM_FALSE@ -HAVE_LIBASM_TRUE = @HAVE_LIBASM_TRUE@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -185,19 +172,12 @@ LIBS = @LIBS@ LOCALEDIR = @LOCALEDIR@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ MODVERSION = @MODVERSION@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -MUDFLAP_FALSE = @MUDFLAP_FALSE@ -MUDFLAP_TRUE = @MUDFLAP_TRUE@ -NATIVE_LD_FALSE = @NATIVE_LD_FALSE@ -NATIVE_LD_TRUE = @NATIVE_LD_TRUE@ -NEVER_FALSE = @NEVER_FALSE@ -NEVER_TRUE = @NEVER_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -209,20 +189,18 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -STANDALONE_FALSE = @STANDALONE_FALSE@ -STANDALONE_TRUE = @STANDALONE_TRUE@ STRIP = @STRIP@ -TESTS_RPATH_FALSE = @TESTS_RPATH_FALSE@ -TESTS_RPATH_TRUE = @TESTS_RPATH_TRUE@ USE_NLS = @USE_NLS@ VERSION = 1 XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -235,28 +213,39 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Werror -Wshadow \ @MUDFLAP_FALSE@ -Wunused -Wformat=2 -Wextra -std=gnu99 @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Werror \ @@ -293,7 +282,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ dwarf_lineendsequence.c dwarf_lineblock.c \ dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \ dwarf_onesrcline.c dwarf_formblock.c \ - dwarf_getsrcfiles.c dwarf_filesrc.c \ + dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \ dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \ dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \ dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \ @@ -348,7 +337,7 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ @@ -391,7 +380,7 @@ clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) @MUDFLAP_TRUE@libdw.so$(EXEEXT): $(libdw_so_OBJECTS) $(libdw_so_DEPENDENCIES) @MUDFLAP_TRUE@ @rm -f libdw.so$(EXEEXT) -@MUDFLAP_TRUE@ $(LINK) $(libdw_so_LDFLAGS) $(libdw_so_OBJECTS) $(libdw_so_LDADD) $(LIBS) +@MUDFLAP_TRUE@ $(LINK) $(libdw_so_OBJECTS) $(libdw_so_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -451,6 +440,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopevar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrc_die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrc_file.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrcdirs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrcfiles.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrclines.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getstring.Po@am__quote@ @@ -491,22 +481,21 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory-access.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: install-euincludeHEADERS: $(euinclude_HEADERS) @$(NORMAL_INSTALL) - test -z "$(euincludedir)" || $(mkdir_p) "$(DESTDIR)$(euincludedir)" + test -z "$(euincludedir)" || $(MKDIR_P) "$(DESTDIR)$(euincludedir)" @list='$(euinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ @@ -523,7 +512,7 @@ uninstall-euincludeHEADERS: done install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ @@ -588,22 +577,21 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -619,7 +607,7 @@ check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(euincludedir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done @MUDFLAP_TRUE@install: install-am install-exec: install-exec-am @@ -669,12 +657,20 @@ info-am: install-data-am: install-euincludeHEADERS install-includeHEADERS +install-dvi: install-dvi-am + install-exec-am: install-libLIBRARIES +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -695,22 +691,25 @@ ps: ps-am ps-am: uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \ - uninstall-info-am uninstall-libLIBRARIES + uninstall-libLIBRARIES + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES clean-noinstLIBRARIES clean-noinstPROGRAMS \ ctags distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-euincludeHEADERS install-exec install-exec-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-euincludeHEADERS install-exec \ + install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ - install-libLIBRARIES install-man install-strip installcheck \ + install-libLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-euincludeHEADERS \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-libLIBRARIES + uninstall-includeHEADERS uninstall-libLIBRARIES @MUDFLAP_FALSE@libdw.so: $(srcdir)/libdw.map libdw_pic.a \ @MUDFLAP_FALSE@ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \ diff --git a/elfutils/libdw/dwarf.h b/elfutils/libdw/dwarf.h index 7791ca17..4b763ffa 100644 --- a/elfutils/libdw/dwarf.h +++ b/elfutils/libdw/dwarf.h @@ -1,5 +1,5 @@ /* This file defines standard DWARF types, structures, and macros. - Copyright (C) 2000, 2002, 2005, 2006 Red Hat, Inc. + Copyright (C) 2000, 2002, 2005, 2006, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -418,7 +418,7 @@ enum DW_OP_breg30 = 0x8e, /* Base register 30. */ DW_OP_breg31 = 0x8f, /* Base register 31. */ DW_OP_regx = 0x90, /* Unsigned LEB128 register. */ - DW_OP_fbreg = 0x91, /* Signed LEB128 register. */ + DW_OP_fbreg = 0x91, /* Signed LEB128 offset. */ DW_OP_bregx = 0x92, /* ULEB128 register followed by SLEB128 off. */ DW_OP_piece = 0x93, /* ULEB128 size of piece addressed. */ DW_OP_deref_size = 0x94, /* 1-byte size of data retrieved. */ diff --git a/elfutils/libdw/dwarf_begin_elf.c b/elfutils/libdw/dwarf_begin_elf.c index 312164ca..aaac3999 100644 --- a/elfutils/libdw/dwarf_begin_elf.c +++ b/elfutils/libdw/dwarf_begin_elf.c @@ -1,5 +1,5 @@ /* Create descriptor from ELF descriptor for processing file. - Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -84,7 +84,7 @@ static const char dwarf_scnnames[IDX_last][17] = #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0])) -static void +static Dwarf * check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) { GElf_Shdr shdr_mem; @@ -97,6 +97,11 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) wrong in the libelf library. */ abort (); + /* Ignore any SHT_NOBITS sections. Debugging sections should not + have been stripped, but in case of a corrupt file we won't try + to look at the missing data. */ + if (unlikely (shdr->sh_type == SHT_NOBITS)) + return result; /* Make sure the section is part of a section group only iff we really need it. If we are looking for the global (= non-section @@ -105,7 +110,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) a section which isn't part of the section group. */ if (! inscngrp && (shdr->sh_flags & SHF_GROUP) != 0) /* Ignore the section. */ - return; + return result; /* We recognize the DWARF section by their names. This is not very @@ -118,7 +123,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) invalid. */ __libdw_seterrno (DWARF_E_INVALID_ELF); free (result); - return; + return NULL; } @@ -140,6 +145,8 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp) break; } + + return result; } @@ -153,9 +160,11 @@ valid_p (Dwarf *result) XXX Which sections are absolutely necessary? Add tests if necessary. For now we require only .debug_info. Hopefully this is correct. */ - if (unlikely (result->sectiondata[IDX_debug_info] == NULL)) + if (likely (result != NULL) + && unlikely (result->sectiondata[IDX_debug_info] == NULL)) { __libdw_seterrno (DWARF_E_NO_DWARF); + free (result); result = NULL; } @@ -168,8 +177,8 @@ global_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr) { Elf_Scn *scn = NULL; - while ((scn = elf_nextscn (elf, scn)) != NULL) - check_section (result, ehdr, scn, false); + while (result != NULL && (scn = elf_nextscn (elf, scn)) != NULL) + result = check_section (result, ehdr, scn, false); return valid_p (result); } @@ -204,7 +213,9 @@ scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp) return NULL; } - check_section (result, ehdr, scn, true); + result = check_section (result, ehdr, scn, true); + if (result == NULL) + break; } return valid_p (result); diff --git a/elfutils/libdw/dwarf_child.c b/elfutils/libdw/dwarf_child.c index 42b38137..b22b010e 100644 --- a/elfutils/libdw/dwarf_child.c +++ b/elfutils/libdw/dwarf_child.c @@ -1,5 +1,5 @@ /* Return vhild of current DIE. - Copyright (C) 2003, 2004, 2005, 2006 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -177,6 +177,15 @@ dwarf_child (die, result) if (addr == NULL) return -1; + /* It's kosher (just suboptimal) to have a null entry first thing (7.5.3). + So if this starts with ULEB128 of 0 (even with silly encoding of 0), + it is a kosher null entry and we do not really have any children. */ + const unsigned char *code = addr; + while (unlikely (*code == 0x80)) + ++code; + if (unlikely (*code == '\0')) + return 1; + /* RESULT can be the same as DIE. So preserve what we need. */ struct Dwarf_CU *cu = die->cu; diff --git a/elfutils/libdw/dwarf_formref.c b/elfutils/libdw/dwarf_formref.c index ac905c82..7c4fb71a 100644 --- a/elfutils/libdw/dwarf_formref.c +++ b/elfutils/libdw/dwarf_formref.c @@ -1,5 +1,5 @@ /* Return reference offset represented by attribute. - Copyright (C) 2003, 2005 Red Hat, Inc. + Copyright (C) 2003, 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -55,15 +55,11 @@ #include <dwarf.h> #include "libdwP.h" - int -dwarf_formref (attr, return_offset) +__libdw_formref (attr, return_offset) Dwarf_Attribute *attr; Dwarf_Off *return_offset; { - if (attr == NULL) - return -1; - const unsigned char *datap; switch (attr->form) @@ -100,4 +96,16 @@ dwarf_formref (attr, return_offset) return 0; } -INTDEF(dwarf_formref) + +/* This is the old public entry point. + It is now deprecated in favor of dwarf_formref_die. */ +int +dwarf_formref (attr, return_offset) + Dwarf_Attribute *attr; + Dwarf_Off *return_offset; +{ + if (attr == NULL) + return -1; + + return __libdw_formref (attr, return_offset); +} diff --git a/elfutils/libdw/dwarf_formref_die.c b/elfutils/libdw/dwarf_formref_die.c index 18ffe2fb..90a4b2d3 100644 --- a/elfutils/libdw/dwarf_formref_die.c +++ b/elfutils/libdw/dwarf_formref_die.c @@ -1,5 +1,5 @@ /* Look up the DIE in a reference-form attribute. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -52,13 +52,39 @@ #endif #include "libdwP.h" +#include <dwarf.h> + Dwarf_Die * -dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem) +dwarf_formref_die (attr, die_mem) + Dwarf_Attribute *attr; + Dwarf_Die *die_mem; { + if (attr == NULL) + return NULL; + Dwarf_Off offset; - return (unlikely (INTUSE(dwarf_formref) (attr, &offset) != 0) ? NULL - : INTUSE(dwarf_offdie) (attr->cu->dbg, attr->cu->start + offset, - die_mem)); + if (attr->form == DW_FORM_ref_addr) + { + /* This has an absolute offset. */ + + uint8_t ref_size = (attr->cu->version == 2 + ? attr->cu->address_size + : attr->cu->offset_size); + + if (ref_size == 8) + offset = read_8ubyte_unaligned (attr->cu->dbg, attr->valp); + else + offset = read_4ubyte_unaligned (attr->cu->dbg, attr->valp); + } + else + { + /* Other forms produce an offset from the CU. */ + if (unlikely (__libdw_formref (attr, &offset) != 0)) + return NULL; + offset += attr->cu->start; + } + + return INTUSE(dwarf_offdie) (attr->cu->dbg, offset, die_mem); } INTDEF (dwarf_formref_die) diff --git a/elfutils/libdw/dwarf_getscopes.c b/elfutils/libdw/dwarf_getscopes.c index f9fa5132..73431ba7 100644 --- a/elfutils/libdw/dwarf_getscopes.c +++ b/elfutils/libdw/dwarf_getscopes.c @@ -1,5 +1,5 @@ /* Return scope DIEs containing PC address. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -71,10 +71,32 @@ pc_match (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) { struct args *a = arg; - if (a->scopes != NULL || INTUSE(dwarf_haspc) (&die->die, a->pc) <= 0) + if (a->scopes != NULL) die->prune = true; - else if (INTUSE (dwarf_tag) (&die->die) == DW_TAG_inlined_subroutine) - a->inlined = depth; + else + { + /* dwarf_haspc returns an error if there are no appropriate attributes. + But we use it indiscriminantly instead of presuming which tags can + have PC attributes. So when it fails for that reason, treat it just + as a nonmatching return. */ + int result = INTUSE(dwarf_haspc) (&die->die, a->pc); + if (result < 0) + { + int error = INTUSE(dwarf_errno) (); + if (error != DWARF_E_NOERROR && error != DWARF_E_NO_DEBUG_RANGES) + { + __libdw_seterrno (error); + return -1; + } + result = 0; + } + if (result == 0) + die->prune = true; + + if (!die->prune + && INTUSE (dwarf_tag) (&die->die) == DW_TAG_inlined_subroutine) + a->inlined = depth; + } return 0; } @@ -119,11 +141,11 @@ pc_record (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) { struct args *a = arg; + if (die->prune) + return 0; + if (a->scopes == NULL) { - if (die->prune) - return 0; - /* We have hit the innermost DIE that contains the target PC. */ a->nscopes = depth + 1 - a->inlined; @@ -175,7 +197,7 @@ pc_record (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg) If we don't find it, return to search the containing scope. If we do find it, the nonzero return value will bail us out of the postorder traversal. */ - return __libdw_visit_scopes (depth, die, &origin_match, NULL, &a); + return __libdw_visit_scopes (depth, die, &origin_match, NULL, a); } diff --git a/elfutils/libdw/dwarf_getsrcdirs.c b/elfutils/libdw/dwarf_getsrcdirs.c new file mode 100644 index 00000000..74786dd0 --- /dev/null +++ b/elfutils/libdw/dwarf_getsrcdirs.c @@ -0,0 +1,69 @@ +/* Find include directories in source file information. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdwP.h" + + +int +dwarf_getsrcdirs (files, result, ndirs) + Dwarf_Files *files; + const char *const **result; + size_t *ndirs; +{ + if (files == NULL) + return -1; + + *result = (void *) &files->info[files->nfiles]; + *ndirs = files->ndirs; + return 0; +} diff --git a/elfutils/libdw/dwarf_getsrclines.c b/elfutils/libdw/dwarf_getsrclines.c index 2aed5d93..666cca22 100644 --- a/elfutils/libdw/dwarf_getsrclines.c +++ b/elfutils/libdw/dwarf_getsrclines.c @@ -1,5 +1,5 @@ /* Return line number information of CU. - Copyright (C) 2004, 2005 Red Hat, Inc. + Copyright (C) 2004, 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -256,13 +256,10 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* Rearrange the list in array form. */ struct dirlist **dirarray = (struct dirlist **) alloca (ndirlist * sizeof (*dirarray)); - while (ndirlist-- > 0) - { - dirarray[ndirlist] = dirlist; - dirlist = dirlist->next; - } + for (unsigned int n = ndirlist; n-- > 0; dirlist = dirlist->next) + dirarray[n] = dirlist; - /* Now read the files. */ + /* Now read the files. */ struct filelist null_file = { .info = @@ -618,8 +615,11 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) /* Put all the files in an array. */ Dwarf_Files *files = libdw_alloc (dbg, Dwarf_Files, sizeof (Dwarf_Files) - + nfilelist * sizeof (Dwarf_Fileinfo), - 1); + + nfilelist * sizeof (Dwarf_Fileinfo) + + (ndirlist + 1) * sizeof (char *), + 1); + const char **dirs = (void *) &files->info[nfilelist]; + files->nfiles = nfilelist; while (nfilelist-- > 0) { @@ -628,6 +628,12 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) } assert (filelist == NULL); + /* Put all the directory strings in an array. */ + files->ndirs = ndirlist; + for (unsigned int i = 0; i < ndirlist; ++i) + dirs[i] = dirarray[i]->dir; + dirs[ndirlist] = NULL; + /* Remember the debugging descriptor. */ files->dbg = dbg; diff --git a/elfutils/libdw/dwarf_ranges.c b/elfutils/libdw/dwarf_ranges.c index 57788da0..89da0af4 100644 --- a/elfutils/libdw/dwarf_ranges.c +++ b/elfutils/libdw/dwarf_ranges.c @@ -1,5 +1,5 @@ /* Enumerate the PC ranges covered by a DIE. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -141,18 +141,21 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, { begin = read_8ubyte_unaligned_inc (die->cu->dbg, readp); end = read_8ubyte_unaligned_inc (die->cu->dbg, readp); + if (begin == (uint64_t) -1l) /* Base address entry. */ + { + *basep = end; + goto next; + } } else { - begin = (Dwarf_Sword) read_4sbyte_unaligned_inc (die->cu->dbg, - readp); + begin = read_4ubyte_unaligned_inc (die->cu->dbg, readp); end = read_4ubyte_unaligned_inc (die->cu->dbg, readp); - } - - if (begin == (Dwarf_Addr) -1l) /* Base address entry. */ - { - *basep = end; - goto next; + if (begin == (uint32_t) -1) /* Base address entry. */ + { + *basep = end; + goto next; + } } if (begin == 0 && end == 0) /* End of list entry. */ diff --git a/elfutils/libdw/dwarf_siblingof.c b/elfutils/libdw/dwarf_siblingof.c index 00e5a1c7..a6cca394 100644 --- a/elfutils/libdw/dwarf_siblingof.c +++ b/elfutils/libdw/dwarf_siblingof.c @@ -1,5 +1,5 @@ /* Return sibling of given DIE. - Copyright (C) 2003, 2004, 2005 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -92,7 +92,7 @@ dwarf_siblingof (die, result) { Dwarf_Off offset; sibattr.valp = addr; - if (INTUSE(dwarf_formref) (&sibattr, &offset) != 0) + if (__libdw_formref (&sibattr, &offset) != 0) /* Something went wrong. */ return -1; diff --git a/elfutils/libdw/libdw.h b/elfutils/libdw/libdw.h index d44f427d..6242d04f 100644 --- a/elfutils/libdw/libdw.h +++ b/elfutils/libdw/libdw.h @@ -1,5 +1,5 @@ /* Interfaces for libdw. - Copyright (C) 2002, 2004, 2005, 2006 Red Hat, Inc. + Copyright (C) 2002, 2004, 2005, 2006, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -57,8 +57,17 @@ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__))) +# define __deprecated_attribute__ __attribute__ ((__deprecated__)) #else # define __nonnull_attribute__(args...) +# define __deprecated_attribute__ +#endif + + +#ifdef __GNUC_STDC_INLINE__ +# define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__)) +#else +# define __libdw_extern_inline extern __inline #endif @@ -304,9 +313,10 @@ extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval) extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); -/* Return reference offset represented by attribute. */ +/* This function is deprecated. Always use dwarf_formref_die instead. + Return reference offset represented by attribute. */ extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset) - __nonnull_attribute__ (2); + __nonnull_attribute__ (2) __deprecated_attribute__; /* Look up the DIE in a reference-form attribute. */ extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem) @@ -473,6 +483,14 @@ extern const char *dwarf_linesrc (Dwarf_Line *line, extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx, Dwarf_Word *mtime, Dwarf_Word *length); +/* Return the directory list used in the file information extracted. + (*RESULT)[0] is the CU's DW_AT_comp_dir value, and may be null. + (*RESULT)[0..*NDIRS-1] are the compile-time include directory path + encoded by the compiler. */ +extern int dwarf_getsrcdirs (Dwarf_Files *files, + const char *const **result, size_t *ndirs) + __nonnull_attribute__ (2, 3); + /* Return location expression, decoded as a list of operations. */ extern int dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **expr, @@ -616,14 +634,14 @@ extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler); /* Inline optimizations. */ #ifdef __OPTIMIZE__ /* Return attribute code of given attribute. */ -extern inline unsigned int +__libdw_extern_inline unsigned int dwarf_whatattr (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->code; } /* Return attribute code of given attribute. */ -extern inline unsigned int +__libdw_extern_inline unsigned int dwarf_whatform (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->form; diff --git a/elfutils/libdw/libdw.map b/elfutils/libdw/libdw.map index 71e9f50f..8ef5f633 100644 --- a/elfutils/libdw/libdw.map +++ b/elfutils/libdw/libdw.map @@ -145,6 +145,7 @@ ELFUTILS_0.122 { local: *; } ELFUTILS_0; + ELFUTILS_0.126 { global: dwarf_getelf; @@ -152,3 +153,26 @@ ELFUTILS_0.126 { local: *; } ELFUTILS_0.122; + +ELFUTILS_0.127 { + global: + dwarf_getsrcdirs; + + dwfl_module_addrsym; + dwfl_report_begin_add; + dwfl_module_address_section; + + local: + *; +} ELFUTILS_0.126; + +ELFUTILS_0.130 { + global: + dwfl_build_id_find_elf; + dwfl_build_id_find_debuginfo; + dwfl_module_build_id; + dwfl_module_report_build_id; + + local: + *; +} ELFUTILS_0.127; diff --git a/elfutils/libdw/libdwP.h b/elfutils/libdw/libdwP.h index 8baa3fa3..78fd5ce7 100644 --- a/elfutils/libdw/libdwP.h +++ b/elfutils/libdw/libdwP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwarf. - Copyright (C) 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -209,6 +209,7 @@ struct Dwarf_Abbrev struct Dwarf_Files_s { Dwarf *dbg; + unsigned int ndirs; unsigned int nfiles; struct Dwarf_Fileinfo_s { @@ -216,6 +217,7 @@ struct Dwarf_Files_s Dwarf_Word mtime; Dwarf_Word length; } info[0]; + /* nfiles of those, followed by char *[ndirs]. */ }; typedef struct Dwarf_Fileinfo_s Dwarf_Fileinfo; @@ -265,6 +267,7 @@ struct Dwarf_CU Dwarf_Off end; uint8_t address_size; uint8_t offset_size; + uint16_t version; /* Hash table for the abbreviations. */ Dwarf_Abbrev_Hash abbrev_hash; @@ -363,6 +366,11 @@ extern size_t __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, const unsigned char *valp) __nonnull_attribute__ (1, 2, 4) internal_function; +/* Helper function for DW_FORM_ref* handling. */ +extern int __libdw_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset) + __nonnull_attribute__ (1, 2) internal_function; + + /* Helper function to locate attribute. */ extern unsigned char *__libdw_find_attr (Dwarf_Die *die, unsigned int search_name, @@ -409,7 +417,6 @@ INTDECL (dwarf_entrypc) INTDECL (dwarf_errmsg) INTDECL (dwarf_formaddr) INTDECL (dwarf_formblock) -INTDECL (dwarf_formref) INTDECL (dwarf_formref_die) INTDECL (dwarf_formsdata) INTDECL (dwarf_formstring) diff --git a/elfutils/libdw/libdw_findcu.c b/elfutils/libdw/libdw_findcu.c index e6259d49..afff6d3a 100644 --- a/elfutils/libdw/libdw_findcu.c +++ b/elfutils/libdw/libdw_findcu.c @@ -1,5 +1,5 @@ /* Find CU for given offset. - Copyright (C) 2003, 2004, 2005 Red Hat, Inc. + Copyright (C) 2003, 2004, 2005, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -97,6 +97,7 @@ __libdw_findcu (dbg, start) if (start < dbg->next_cu_offset) { + invalid: __libdw_seterrno (DWARF_E_INVALID_DWARF); return NULL; } @@ -115,6 +116,15 @@ __libdw_findcu (dbg, start) /* No more entries. */ return NULL; + /* XXX We need the version number but dwarf_nextcu swallows it. */ + const char *bytes = (dbg->sectiondata[IDX_debug_info]->d_buf + oldoff + + (2 * offset_size - 4)); + uint16_t version = read_2ubyte_unaligned (dbg, bytes); + + /* We only know how to handle the DWARF version 2 and 3 formats. */ + if (unlikely (version != 2) && unlikely (version != 3)) + goto invalid; + /* Create an entry for this CU. */ struct Dwarf_CU *newp = libdw_typed_alloc (dbg, struct Dwarf_CU); @@ -123,6 +133,7 @@ __libdw_findcu (dbg, start) newp->end = dbg->next_cu_offset; newp->address_size = address_size; newp->offset_size = offset_size; + newp->version = version; Dwarf_Abbrev_Hash_init (&newp->abbrev_hash, 41); newp->orig_abbrev_offset = newp->last_abbrev_offset = abbrev_offset; newp->lines = NULL; diff --git a/elfutils/libdw/libdw_form.c b/elfutils/libdw/libdw_form.c index 779b6c0e..ad78f4b4 100644 --- a/elfutils/libdw/libdw_form.c +++ b/elfutils/libdw/libdw_form.c @@ -1,5 +1,5 @@ /* Helper functions for form handling. - Copyright (C) 2003, 2004, 2006 Red Hat, Inc. + Copyright (C) 2003, 2004, 2006, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -73,8 +73,11 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form, result = cu->address_size; break; - case DW_FORM_strp: case DW_FORM_ref_addr: + result = cu->version == 2 ? cu->address_size : cu->offset_size; + break; + + case DW_FORM_strp: result = cu->offset_size; break; diff --git a/elfutils/libdw/libdw_visit_scopes.c b/elfutils/libdw/libdw_visit_scopes.c index a7b6994a..9c7c3789 100644 --- a/elfutils/libdw/libdw_visit_scopes.c +++ b/elfutils/libdw/libdw_visit_scopes.c @@ -1,5 +1,5 @@ /* Helper functions to descend DWARF scope trees. - Copyright (C) 2005,2006 Red Hat, Inc. + Copyright (C) 2005,2006,2007 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -80,6 +80,8 @@ classify_die (Dwarf_Die *die) /* DIEs without addresses that can own DIEs with addresses. */ case DW_TAG_namespace: + case DW_TAG_class_type: + case DW_TAG_structure_type: return walk; /* Special indirection required. */ |