forked from pool/elfutils
554 lines
18 KiB
Diff
554 lines
18 KiB
Diff
From: Roland McGrath <roland@redhat.com>
|
|
Date: Wed, 3 Dec 2008 03:41:58 +0000 (+0000)
|
|
Subject: src/
|
|
X-Git-Url: http://git.fedorahosted.org/git/elfutils.git?p=elfutils.git;a=commitdiff_plain;h=a845f68bf43f90e0670ed6b33154f2aff98ad46b
|
|
|
|
src/
|
|
2008-12-02 Roland McGrath <roland@redhat.com>
|
|
|
|
* readelf.c (count_dwflmod, process_file): Don't presume encoding of
|
|
nonzero OFFSET argument to dwfl_getmodules.
|
|
---
|
|
|
|
diff --git a/backends/Makefile.am b/backends/Makefile.am
|
|
index ebf6b09..5b55294 100644
|
|
--- a/backends/Makefile.am
|
|
+++ b/backends/Makefile.am
|
|
@@ -146,7 +146,7 @@ uninstall: uninstall-am
|
|
done
|
|
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
|
|
|
|
-noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c
|
|
+noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
|
|
EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def)
|
|
|
|
CLEANFILES = *.gcno *.gcda \
|
|
diff --git a/backends/i386_corenote.c b/backends/i386_corenote.c
|
|
index 02d8ec3..c371c4c 100644
|
|
--- a/backends/i386_corenote.c
|
|
+++ b/backends/i386_corenote.c
|
|
@@ -103,9 +103,8 @@ static const Ebl_Register_Location prxfpreg_regs[] =
|
|
#define EXTRA_NOTES \
|
|
EXTRA_REGSET (NT_PRFPXREG, 512, prxfpreg_regs) \
|
|
case NT_386_TLS: \
|
|
- return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items);
|
|
-
|
|
-#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
|
|
+ return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items); \
|
|
+ EXTRA_NOTES_IOPERM
|
|
|
|
static const Ebl_Core_Item tls_items[] =
|
|
{
|
|
@@ -131,4 +130,5 @@ tls_info (GElf_Word descsz, GElf_Word *regs_offset,
|
|
return 1;
|
|
}
|
|
|
|
+#include "x86_corenote.c"
|
|
#include "linux-core-note.c"
|
|
diff --git a/backends/x86_64_corenote.c b/backends/x86_64_corenote.c
|
|
index c2bc72e..552ac88 100644
|
|
--- a/backends/x86_64_corenote.c
|
|
+++ b/backends/x86_64_corenote.c
|
|
@@ -1,5 +1,5 @@
|
|
/* x86-64 specific core note handling.
|
|
- Copyright (C) 2005, 2007 Red Hat, Inc.
|
|
+ Copyright (C) 2005, 2007, 2008 Red Hat, Inc.
|
|
This file is part of Red Hat elfutils.
|
|
|
|
Red Hat elfutils is free software; you can redistribute it and/or modify
|
|
@@ -103,4 +103,7 @@ static const Ebl_Register_Location fpregset_regs[] =
|
|
};
|
|
#define FPREGSET_SIZE 512
|
|
|
|
+#define EXTRA_NOTES EXTRA_NOTES_IOPERM
|
|
+
|
|
+#include "x86_corenote.c"
|
|
#include "linux-core-note.c"
|
|
diff --git a/backends/x86_corenote.c b/backends/x86_corenote.c
|
|
new file mode 100644
|
|
index 0000000..7d55067
|
|
--- /dev/null
|
|
+++ b/backends/x86_corenote.c
|
|
@@ -0,0 +1,47 @@
|
|
+/* x86-specific core note handling, pieces common to x86-64 and i386.
|
|
+ Copyright (C) 2005, 2008 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
|
|
+ <http://www.openinventionnetwork.com>. */
|
|
+
|
|
+#define EXTRA_NOTES_IOPERM \
|
|
+ case NT_386_IOPERM: \
|
|
+ return ioperm_info (descsz, regs_offset, nregloc, reglocs, nitems, items);
|
|
+
|
|
+static int
|
|
+ioperm_info (GElf_Word descsz, GElf_Word *regs_offset,
|
|
+ size_t *nregloc, const Ebl_Register_Location **reglocs,
|
|
+ size_t *nitems, const Ebl_Core_Item **items)
|
|
+{
|
|
+ static const Ebl_Core_Item ioperm_item =
|
|
+ { .type = ELF_T_WORD, .format = 'b', .name = "ioperm" };
|
|
+
|
|
+ if (descsz % 4 != 0)
|
|
+ return 0;
|
|
+
|
|
+ *regs_offset = 0;
|
|
+ *nregloc = 0;
|
|
+ *reglocs = NULL;
|
|
+ *nitems = 1;
|
|
+ *items = &ioperm_item;
|
|
+ return 1;
|
|
+}
|
|
diff --git a/libdwfl/dwfl_getmodules.c b/libdwfl/dwfl_getmodules.c
|
|
index f205b89..7c6ab97 100644
|
|
--- a/libdwfl/dwfl_getmodules.c
|
|
+++ b/libdwfl/dwfl_getmodules.c
|
|
@@ -59,49 +59,55 @@ dwfl_getmodules (Dwfl *dwfl,
|
|
if (dwfl == NULL)
|
|
return -1;
|
|
|
|
+ /* We iterate through the linked list when it's all we have.
|
|
+ But continuing from an offset is slow that way. So when
|
|
+ DWFL->lookup_module is populated, we can instead keep our
|
|
+ place by jumping directly into the array. Since the actions
|
|
+ of a callback could cause it to get populated, we must
|
|
+ choose the style of place-holder when we return an offset,
|
|
+ and we encode the choice in the low bits of that value. */
|
|
+
|
|
Dwfl_Module *m = dwfl->modulelist;
|
|
|
|
- if (unlikely (dwfl->lookup_module == NULL))
|
|
+ if ((offset & 3) == 1)
|
|
{
|
|
+ offset >>= 2;
|
|
for (ptrdiff_t pos = 0; pos < offset; ++pos)
|
|
if (m == NULL)
|
|
return -1;
|
|
else
|
|
m = m->next;
|
|
- while (m != NULL)
|
|
- {
|
|
- ++offset;
|
|
- if ((*callback) (MODCB_ARGS (m), arg) != DWARF_CB_OK)
|
|
- return offset;
|
|
- m = m->next;
|
|
- }
|
|
}
|
|
- else
|
|
+ else if (((offset & 3) == 2) && likely (dwfl->lookup_module != NULL))
|
|
{
|
|
- if (offset > 0)
|
|
- {
|
|
- if ((size_t) offset - 1 == dwfl->lookup_elts)
|
|
- return 0;
|
|
+ offset >>= 2;
|
|
|
|
- if (unlikely ((size_t) offset - 1 > dwfl->lookup_elts))
|
|
- return -1;
|
|
+ if ((size_t) offset - 1 == dwfl->lookup_elts)
|
|
+ return 0;
|
|
|
|
- m = dwfl->lookup_module[offset - 1];
|
|
- if (unlikely (m == NULL))
|
|
- return -1;
|
|
- }
|
|
+ if (unlikely ((size_t) offset - 1 > dwfl->lookup_elts))
|
|
+ return -1;
|
|
|
|
- while (m != NULL)
|
|
- {
|
|
- int ok = (*callback) (MODCB_ARGS (m), arg);
|
|
- m = m->next;
|
|
- if (ok != DWARF_CB_OK)
|
|
- return (m == NULL
|
|
- ? (ptrdiff_t) dwfl->lookup_elts + 1
|
|
- : m->segment + 1);
|
|
- }
|
|
+ m = dwfl->lookup_module[offset - 1];
|
|
+ if (unlikely (m == NULL))
|
|
+ return -1;
|
|
+ }
|
|
+ else if (offset != 0)
|
|
+ {
|
|
+ __libdwfl_seterrno (DWFL_E_BADSTROFF);
|
|
+ return -1;
|
|
}
|
|
|
|
+ while (m != NULL)
|
|
+ {
|
|
+ int ok = (*callback) (MODCB_ARGS (m), arg);
|
|
+ ++offset;
|
|
+ m = m->next;
|
|
+ if (ok != DWARF_CB_OK)
|
|
+ return ((dwfl->lookup_module == NULL) ? ((offset << 2) | 1)
|
|
+ : (((m == NULL ? (ptrdiff_t) dwfl->lookup_elts + 1
|
|
+ : m->segment + 1) << 2) | 2));
|
|
+ }
|
|
return 0;
|
|
}
|
|
INTDEF (dwfl_getmodules)
|
|
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c
|
|
index 903b79c..8725afb 100644
|
|
--- a/libdwfl/dwfl_module_build_id.c
|
|
+++ b/libdwfl/dwfl_module_build_id.c
|
|
@@ -1,5 +1,5 @@
|
|
/* Return build ID information for a module.
|
|
- Copyright (C) 2007 Red Hat, Inc.
|
|
+ Copyright (C) 2007, 2008 Red Hat, Inc.
|
|
This file is part of Red Hat elfutils.
|
|
|
|
Red Hat elfutils is free software; you can redistribute it and/or modify
|
|
@@ -88,7 +88,8 @@ check_notes (Dwfl_Module *mod, bool set, Elf_Data *data, GElf_Addr data_vaddr)
|
|
"GNU", sizeof "GNU"))
|
|
return found_build_id (mod, set,
|
|
data->d_buf + desc_pos, nhdr.n_descsz,
|
|
- data_vaddr == NO_VADDR ? 0 : data_vaddr + pos);
|
|
+ data_vaddr == NO_VADDR ? 0
|
|
+ : data_vaddr + desc_pos);
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c
|
|
index d01932f..9376cf5 100644
|
|
--- a/libebl/eblcorenotetypename.c
|
|
+++ b/libebl/eblcorenotetypename.c
|
|
@@ -56,7 +56,6 @@
|
|
#include <stdio.h>
|
|
#include <libeblP.h>
|
|
|
|
-
|
|
const char *
|
|
ebl_core_note_type_name (ebl, type, buf, len)
|
|
Ebl *ebl;
|
|
@@ -101,6 +100,7 @@ ebl_core_note_type_name (ebl, type, buf, len)
|
|
KNOWNSTYPE (PPC_VMX);
|
|
KNOWNSTYPE (PPC_SPE);
|
|
KNOWNSTYPE (386_TLS);
|
|
+ KNOWNSTYPE (386_IOPERM);
|
|
#undef KNOWNSTYPE
|
|
|
|
default:
|
|
diff --git a/libelf/elf.h b/libelf/elf.h
|
|
index a413446..b4d3475 100644
|
|
--- a/libelf/elf.h
|
|
+++ b/libelf/elf.h
|
|
@@ -608,7 +608,9 @@ typedef struct
|
|
#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */
|
|
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
|
|
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
|
|
+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
|
|
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
|
|
+#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
|
|
|
|
/* Legal values for the note segment descriptor types for object files. */
|
|
|
|
@@ -1397,6 +1399,7 @@ typedef struct
|
|
#define STO_MIPS_INTERNAL 0x1
|
|
#define STO_MIPS_HIDDEN 0x2
|
|
#define STO_MIPS_PROTECTED 0x3
|
|
+#define STO_MIPS_PLT 0x8
|
|
#define STO_MIPS_SC_ALIGN_UNUSED 0xff
|
|
|
|
/* MIPS specific values for `st_info'. */
|
|
@@ -1543,8 +1546,10 @@ typedef struct
|
|
#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
|
|
#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
|
|
#define R_MIPS_GLOB_DAT 51
|
|
+#define R_MIPS_COPY 126
|
|
+#define R_MIPS_JUMP_SLOT 127
|
|
/* Keep this the last entry. */
|
|
-#define R_MIPS_NUM 52
|
|
+#define R_MIPS_NUM 128
|
|
|
|
/* Legal values for p_type field of Elf32_Phdr. */
|
|
|
|
@@ -1610,7 +1615,13 @@ typedef struct
|
|
#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
|
|
#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
|
|
#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
|
|
-#define DT_MIPS_NUM 0x32
|
|
+/* The address of .got.plt in an executable using the new non-PIC ABI. */
|
|
+#define DT_MIPS_PLTGOT 0x70000032
|
|
+/* The base of the PLT in an executable using the new non-PIC ABI if that
|
|
+ PLT is writable. For a non-writable PLT, this is omitted or has a zero
|
|
+ value. */
|
|
+#define DT_MIPS_RWPLT 0x70000034
|
|
+#define DT_MIPS_NUM 0x35
|
|
|
|
/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
|
|
|
|
diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c
|
|
index deeb56d..875b2a1 100644
|
|
--- a/libelf/elf_getarhdr.c
|
|
+++ b/libelf/elf_getarhdr.c
|
|
@@ -1,5 +1,5 @@
|
|
/* Read header of next archive member.
|
|
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
|
|
+ Copyright (C) 1998, 1999, 2000, 2002, 2008 Red Hat, Inc.
|
|
This file is part of Red Hat elfutils.
|
|
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
|
|
|
|
@@ -63,6 +63,9 @@ Elf_Arhdr *
|
|
elf_getarhdr (elf)
|
|
Elf *elf;
|
|
{
|
|
+ if (elf == NULL)
|
|
+ return NULL;
|
|
+
|
|
Elf *parent = elf->parent;
|
|
|
|
/* Calling this function is not ok for any file type but archives. */
|
|
@@ -78,7 +81,6 @@ elf_getarhdr (elf)
|
|
/* Something went wrong. Maybe there is no member left. */
|
|
return NULL;
|
|
|
|
-
|
|
/* We can be sure the parent is an archive. */
|
|
assert (parent->kind == ELF_K_AR);
|
|
|
|
diff --git a/src/ChangeLog b/src/ChangeLog
|
|
index 4ef23a2..fb17835 100644
|
|
--- a/src/ChangeLog
|
|
+++ b/src/ChangeLog
|
|
@@ -1,3 +1,8 @@
|
|
+2008-12-02 Roland McGrath <roland@redhat.com>
|
|
+
|
|
+ * readelf.c (count_dwflmod, process_file): Don't presume encoding of
|
|
+ nonzero OFFSET argument to dwfl_getmodules.
|
|
+
|
|
2008-08-07 Roland McGrath <roland@redhat.com>
|
|
|
|
* addr2line.c (main): Pass string to handle_address.
|
|
diff --git a/src/readelf.c b/src/readelf.c
|
|
index 7b599ec..2797a84 100644
|
|
--- a/src/readelf.c
|
|
+++ b/src/readelf.c
|
|
@@ -459,8 +459,10 @@ count_dwflmod (Dwfl_Module *dwflmod __attribute__ ((unused)),
|
|
Dwarf_Addr base __attribute__ ((unused)),
|
|
void *arg)
|
|
{
|
|
- *(bool *) arg = false;
|
|
- return DWARF_CB_ABORT;
|
|
+ if (*(bool *) arg)
|
|
+ return DWARF_CB_ABORT;
|
|
+ *(bool *) arg = true;
|
|
+ return DWARF_CB_OK;
|
|
}
|
|
|
|
struct process_dwflmod_args
|
|
@@ -548,8 +550,11 @@ process_file (int fd, const char *fname, bool only_one)
|
|
dwfl_report_end (dwfl, NULL, NULL);
|
|
|
|
if (only_one)
|
|
- /* Clear ONLY_ONE if we have multiple modules, from an archive. */
|
|
- dwfl_getmodules (dwfl, &count_dwflmod, &only_one, 1);
|
|
+ {
|
|
+ /* Clear ONLY_ONE if we have multiple modules, from an archive. */
|
|
+ bool seen = false;
|
|
+ only_one = dwfl_getmodules (dwfl, &count_dwflmod, &seen, 0) == 0;
|
|
+ }
|
|
|
|
/* Process the one or more modules gleaned from this file. */
|
|
struct process_dwflmod_args a = { .fd = fd, .only_one = only_one };
|
|
diff --git a/tests/ChangeLog b/tests/ChangeLog
|
|
index 15e3818..b1471c1 100644
|
|
--- a/tests/ChangeLog
|
|
+++ b/tests/ChangeLog
|
|
@@ -1,3 +1,15 @@
|
|
+2008-11-26 Roland McGrath <roland@redhat.com>
|
|
+
|
|
+ * dwfl-bug-getmodules.c: New file.
|
|
+ * Makefile.am (noinst_PROGRAMS): Add it.
|
|
+ (dwfl_bug_getmodules_LDADD): New variable.
|
|
+
|
|
+2008-09-10 Roland McGrath <roland@redhat.com>
|
|
+
|
|
+ * test-subr.sh (LC_ALL): Export it set to "C".
|
|
+ * run-dwfl-addr-sect.sh: Don't do it here.
|
|
+ * run-strings-test.sh: Likewise.
|
|
+
|
|
2008-08-21 Denys Vlasenko <dvlasenk@redhat.com>
|
|
|
|
* run-addrname-test.sh: Add a new case.
|
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
index f57e432..b533521 100644
|
|
--- a/tests/Makefile.am
|
|
+++ b/tests/Makefile.am
|
|
@@ -59,7 +59,8 @@ 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-bug-report early-offscn
|
|
+ dwfl-addr-sect dwfl-bug-report early-offscn \
|
|
+ dwfl-bug-getmodules
|
|
# get-ciefde
|
|
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
|
|
asm-tst6 asm-tst7 asm-tst8 asm-tst9
|
|
@@ -229,6 +230,7 @@ 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_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
|
dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
|
sha1_tst_LDADD = $(libeu) $(libmudflap)
|
|
|
|
diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
|
|
new file mode 100644
|
|
index 0000000..f7042c0
|
|
--- /dev/null
|
|
+++ b/tests/dwfl-bug-getmodules.c
|
|
@@ -0,0 +1,74 @@
|
|
+/* Test program for dwfl_getmodules bug.
|
|
+ Copyright (C) 2008 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
|
|
+ <http://www.openinventionnetwork.com>. */
|
|
+
|
|
+#include <config.h>
|
|
+#include ELFUTILS_HEADER(dwfl)
|
|
+
|
|
+#include <error.h>
|
|
+
|
|
+static const Dwfl_Callbacks callbacks =
|
|
+ {
|
|
+ .find_elf = dwfl_linux_proc_find_elf,
|
|
+ .find_debuginfo = dwfl_standard_find_debuginfo,
|
|
+ };
|
|
+
|
|
+static int
|
|
+iterate (Dwfl_Module *mod __attribute__ ((unused)),
|
|
+ void **userdata __attribute__ ((unused)),
|
|
+ const char *name __attribute__ ((unused)),
|
|
+ Dwarf_Addr base, void *arg)
|
|
+{
|
|
+ if (base != 0x2000)
|
|
+ return DWARF_CB_OK;
|
|
+
|
|
+ if (dwfl_addrmodule (arg, 0x2100) == NULL)
|
|
+ error (1, 0, "dwfl_addrmodule: %s", dwfl_errmsg (-1));
|
|
+
|
|
+ return DWARF_CB_ABORT;
|
|
+}
|
|
+
|
|
+int
|
|
+main (void)
|
|
+{
|
|
+ Dwfl *dwfl = dwfl_begin (&callbacks);
|
|
+
|
|
+ dwfl_report_module (dwfl, "m1", 0, 0x1000);
|
|
+ dwfl_report_module (dwfl, "m2", 0x2000, 0x3000);
|
|
+ dwfl_report_module (dwfl, "m3", 0x4000, 0x5000);
|
|
+
|
|
+ dwfl_report_end (dwfl, NULL, NULL);
|
|
+
|
|
+ ptrdiff_t offset = dwfl_getmodules (dwfl, &iterate, dwfl, 0);
|
|
+ if (offset <= 0)
|
|
+ error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
|
|
+
|
|
+ offset = dwfl_getmodules (dwfl, &iterate, NULL, offset);
|
|
+ if (offset != 0)
|
|
+ error (1, 0, "dwfl_getmodules (%d): %s", (int) offset, dwfl_errmsg (-1));
|
|
+
|
|
+ dwfl_end (dwfl);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
diff --git a/tests/run-dwfl-addr-sect.sh b/tests/run-dwfl-addr-sect.sh
|
|
index 69280f5..98666f3 100755
|
|
--- a/tests/run-dwfl-addr-sect.sh
|
|
+++ b/tests/run-dwfl-addr-sect.sh
|
|
@@ -1,5 +1,5 @@
|
|
#! /bin/sh
|
|
-# Copyright (C) 2007 Red Hat, Inc.
|
|
+# Copyright (C) 2007, 2008 Red Hat, Inc.
|
|
# This file is part of Red Hat elfutils.
|
|
#
|
|
# Red Hat elfutils is free software; you can redistribute it and/or modify
|
|
@@ -27,7 +27,6 @@
|
|
|
|
testfiles testfile43
|
|
|
|
-export LC_ALL=C
|
|
testrun_compare ./dwfl-addr-sect -e testfile43 0x64 0x8 0x98 <<\EOF
|
|
address 0x64 => module "" section 4 + 0
|
|
address 0x8 => module "" section 1 + 0x8
|
|
diff --git a/tests/run-strings-test.sh b/tests/run-strings-test.sh
|
|
index cfd9d23..a5dac63 100755
|
|
--- a/tests/run-strings-test.sh
|
|
+++ b/tests/run-strings-test.sh
|
|
@@ -1,5 +1,5 @@
|
|
#! /bin/sh
|
|
-# Copyright (C) 2005, 2006 Red Hat, Inc.
|
|
+# Copyright (C) 2005, 2006, 2008 Red Hat, Inc.
|
|
# This file is part of Red Hat elfutils.
|
|
# Written by Ulrich Drepper <drepper@redhat.com>, 2005.
|
|
#
|
|
@@ -29,9 +29,6 @@
|
|
files="testfile `seq 2 9 | while read n; do echo testfile$n; done`"
|
|
testfiles $files
|
|
|
|
-LC_ALL=C
|
|
-export LC_ALL
|
|
-
|
|
testrun_compare ../src/strings -tx -f $files <<\EOF
|
|
testfile: f4 /lib/ld-linux.so.2
|
|
testfile: 1c9 __gmon_start__
|
|
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
|
|
index 7fda05a..cb34b93 100644
|
|
--- a/tests/test-subr.sh
|
|
+++ b/tests/test-subr.sh
|
|
@@ -1,5 +1,5 @@
|
|
#! /bin/sh
|
|
-# Copyright (C) 2005, 2007 Red Hat, Inc.
|
|
+# Copyright (C) 2005, 2007, 2008 Red Hat, Inc.
|
|
# This file is part of Red Hat elfutils.
|
|
#
|
|
# Red Hat elfutils is free software; you can redistribute it and/or modify
|
|
@@ -30,6 +30,9 @@
|
|
|
|
set -e
|
|
|
|
+#LC_ALL=C
|
|
+#export LC_ALL
|
|
+
|
|
remove_files=
|
|
trap 'rm -f $remove_files' 0
|
|
|