From 87d4780beb37f265fa89ffd909e77513ef516180 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 16 Jul 2007 22:23:37 +0000 Subject: [PATCH] libdwfl/ 2007-07-16 Roland McGrath * dwfl_module.c (dwfl_report_module): Increment DWFL->nmodules when reviving an existing module. tests/ 2007-07-16 Roland McGrath * dwfl-bug-report.c: New file. * Makefile.am (noinst_PROGRAMS, TESTS): Add it. (dwfl_bug_report_LDADD): New variable. --- libdw/ChangeLog | 5 ++++ libdw/libdw.h | 10 +++++-- libdwfl/ChangeLog | 7 ++++- libdwfl/dwfl_module.c | 1 + libebl/ChangeLog | 7 +++++ libebl/eblobjnote.c | 13 ++++++++- libebl/eblobjnotetypename.c | 4 ++- libelf/ChangeLog | 4 +++ libelf/elf.h | 23 +++++++++++---- tests/ChangeLog | 10 +++++-- tests/Makefile.am | 6 ++-- tests/dwfl-bug-report.c | 57 +++++++++++++++++++++++++++++++++++++ 12 files changed, 133 insertions(+), 14 deletions(-) create mode 100644 tests/dwfl-bug-report.c diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 50dc089eb..78b10528c 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2007-07-03 Roland McGrath + + * libdw.h (__extern_inline): New macro. + [__OPTIMIZE__] (dwarf_whatattr, dwarf_whatform): Use it. + 2007-04-16 Roland McGrath * libdw.map (ELFUTILS_0.127): Add dwfl_module_address_section. diff --git a/libdw/libdw.h b/libdw/libdw.h index 968e73a2d..538531275 100644 --- a/libdw/libdw.h +++ b/libdw/libdw.h @@ -61,6 +61,12 @@ # define __nonnull_attribute__(args...) #endif +#ifdef __GNUC_STDC_INLINE__ +# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) +#else +# define __extern_inline extern __inline +#endif + /* Mode for the session. */ typedef enum @@ -624,14 +630,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 +__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 +__extern_inline unsigned int dwarf_whatform (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->form; diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 53286668a..9df78876e 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,4 +1,9 @@ -2007-06-08 Roland McGrath +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. diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index a47b068a7..b84a0a807 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -149,6 +149,7 @@ dwfl_report_module (Dwfl *dwfl, const char *name, m->next = *tailp; m->gc = false; *tailp = m; + ++dwfl->nmodules; return m; } diff --git a/libebl/ChangeLog b/libebl/ChangeLog index cda50af4f..a48f8e333 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,10 @@ +2007-07-09 Roland McGrath + + * eblobjnotetypename.c (ebl_object_note_type_name): Handle + NT_GNU_HWCAP, NT_GNU_BUILD_ID. + + * eblobjnote.c (ebl_object_note): Handle NT_GNU_BUILD_ID. + 2007-04-22 Roland McGrath * eblcorenotetypename.c (ebl_core_note_type_name): Handle NT_PRXFPREG. diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c index d4b6e1f4f..747fb8e7b 100644 --- a/libebl/eblobjnote.c +++ b/libebl/eblobjnote.c @@ -1,5 +1,5 @@ /* Print contents of object file note. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -70,6 +70,17 @@ ebl_object_note (ebl, name, type, descsz, desc) /* The machine specific function did not know this type. */ switch (type) { + case NT_GNU_BUILD_ID: + if (strcmp (name, "GNU") == 0 && descsz > 0) + { + printf (gettext (" Build ID: ")); + uint_fast32_t i; + for (i = 0; i < descsz - 1; ++i) + printf ("%02" PRIx8, (uint8_t) desc[i]); + printf ("%02" PRIx8 "\n", (uint8_t) desc[i]); + } + break; + case NT_VERSION: if (strcmp (name, "GNU") == 0 && descsz >= 8) { diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c index 6bf905968..ff9330f93 100644 --- a/libebl/eblobjnotetypename.c +++ b/libebl/eblobjnotetypename.c @@ -1,5 +1,5 @@ /* Return note type name. - Copyright (C) 2002 Red Hat, Inc. + Copyright (C) 2002, 2007 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -72,6 +72,8 @@ ebl_object_note_type_name (ebl, type, buf, len) { #define KNOWNSTYPE(name) [NT_##name] = #name KNOWNSTYPE (VERSION), + KNOWNSTYPE (GNU_HWCAP), + KNOWNSTYPE (GNU_BUILD_ID), }; /* Handle standard names. */ diff --git a/libelf/ChangeLog b/libelf/ChangeLog index be1735fbc..37b60730f 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2007-07-09 Roland McGrath + + * elf.h: Update from glibc. + 2007-04-22 Roland McGrath * elf.h: Update from glibc. diff --git a/libelf/elf.h b/libelf/elf.h index 6c2d54c16..6cc547ef6 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -602,8 +602,8 @@ typedef struct #define NT_UTSNAME 15 /* Contains copy of utsname struct */ #define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ #define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/ -#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct*/ +#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ +#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ /* Legal values for the note segment descriptor types for object files. */ @@ -1017,15 +1017,28 @@ typedef struct word 2: minor version of the ABI word 3: subminor version of the ABI */ -#define ELF_NOTE_ABI 1 +#define NT_GNU_ABI_TAG 1 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI - note section entry. */ +/* Known OSes. These values can appear in word 0 of an + NT_GNU_ABI_TAG note section entry. */ #define ELF_NOTE_OS_LINUX 0 #define ELF_NOTE_OS_GNU 1 #define ELF_NOTE_OS_SOLARIS2 2 #define ELF_NOTE_OS_FREEBSD 3 +/* Synthetic hwcap information. The descriptor begins with two words: + word 0: number of entries + word 1: bitmask of enabled entries + Then follow variable-length entries, one byte followed by a + '\0'-terminated hwcap name string. The byte gives the bit + number to test if enabled, (1U << bit) & bitmask. */ +#define NT_GNU_HWCAP 2 + +/* Build ID bits as generated by ld --build-id. + The descriptor consists of any nonzero number of bytes. */ +#define NT_GNU_BUILD_ID 3 + /* Move records. */ typedef struct diff --git a/tests/ChangeLog b/tests/ChangeLog index e21e90da4..9d082c879 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,4 +1,10 @@ -2007-06-06 Roland McGrath +2007-07-16 Roland McGrath + + * dwfl-bug-report.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS): Add it. + (dwfl_bug_report_LDADD): New variable. + +2007-06-06 Roland McGrath * run-unstrip-test.sh: Declare testfile.unstrip for removal. @@ -579,7 +585,7 @@ * show-abbrev.c (main): Adjust for dwarf_getabbrev interface change. -2005-04-04 Roland McGrath +2005-04-04 Roland McGrath * line2addr.c (main): Initialize LINES and NLINES before calling dwarf_getsrc_file, and free LINES afterwards. diff --git a/tests/Makefile.am b/tests/Makefile.am index ec312c32c..86638768b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -59,7 +59,7 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ show-abbrev hash newscn ecp dwflmodtest \ find-prologues funcretval allregs rdwrmmap \ dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \ - dwfl-addr-sect + dwfl-addr-sect dwfl-bug-report # get-ciefde asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ asm-tst6 asm-tst7 asm-tst8 asm-tst9 @@ -78,7 +78,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ run-find-prologues.sh run-allregs.sh run-readelf-test1.sh \ run-native-test.sh run-bug1-test.sh \ - dwfl-bug-addr-overflow run-addrname-test.sh dwfl-bug-fd-leak \ + dwfl-bug-addr-overflow run-addrname-test.sh \ + dwfl-bug-fd-leak dwfl-bug-report \ run-dwfl-bug-offline-rel.sh # run-show-ciefde.sh @@ -210,6 +211,7 @@ rdwrmmap_LDADD = $(libelf) dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl arls_LDADD = $(libelf) $(libmudflap) dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl CLEANFILES = xxx *.gcno *.gcda *gconv diff --git a/tests/dwfl-bug-report.c b/tests/dwfl-bug-report.c new file mode 100644 index 000000000..5f8699ddc --- /dev/null +++ b/tests/dwfl-bug-report.c @@ -0,0 +1,57 @@ +/* Test program for dwfl_report_end bug. + 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. + + 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 + . */ + +#include +#include ELFUTILS_HEADER(dwfl) + +#include +#include +#include +#include +#include +#include + +static const Dwfl_Callbacks callbacks = + { + .find_elf = dwfl_linux_proc_find_elf, + .find_debuginfo = dwfl_standard_find_debuginfo, + }; + +int +main (void) +{ + Dwfl *dwfl = dwfl_begin (&callbacks); + + for (int i = 0; i < 5; ++i) + { + dwfl_report_begin (dwfl); + dwfl_report_module (dwfl, "module1", 0, 10); + dwfl_report_end (dwfl, NULL, NULL); + } + + dwfl_end (dwfl); + + return 0; +} -- 2.47.2