]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
2007-01-10 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 10 Jan 2007 20:44:29 +0000 (20:44 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 10 Jan 2007 20:44:29 +0000 (20:44 +0000)
* dwfl-bug-addr-overflow.c: New file.
* Makefile.am (TESTS): Add it.
(dwfl_bug_addr_overflow_LDADD): New variable.

libdwfl/ChangeLog
libdwfl/libdwfl.h
tests/ChangeLog
tests/Makefile.am
tests/dwfl-bug-addr-overflow.c [new file with mode: 0644]

index 0ee9633e1d692f62e1f78748df4189b311eb6db6..e14cce9cfd079223debcd32c02aed51cde61b887 100644 (file)
@@ -1,3 +1,7 @@
+2007-01-10  Roland McGrath  <roland@redhat.com>
+
+       * libdwfl.h (dwfl_begin): Require nonnull argument.
+
 2006-12-27  Roland McGrath  <roland@redhat.com>
 
        * dwfl_module.c (compare_modules): Fix address comparison to avoid
index a7e8caeefd5307ba26ba1d8085fa2d6c6f1d5175..9fe3dca0e02cf46ccd8579b8770ad3a44025ab21 100644 (file)
@@ -1,5 +1,5 @@
 /* Interfaces for libdwfl.
-   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
@@ -94,7 +94,9 @@ extern "C" {
 #endif
 
 /* Start a new session with the library.  */
-extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks);
+extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks)
+  __nonnull_attribute__ (1);
+
 
 /* End a session.  */
 extern void dwfl_end (Dwfl *);
index 372ff7ebb83fe6c6465970e89c6f768bb39d4395..3a75bd1c7b3777df15e2b3cc408dc9949ebf93c3 100644 (file)
@@ -1,3 +1,9 @@
+2007-01-10  Roland McGrath  <roland@redhat.com>
+
+       * dwfl-bug-addr-overflow.c: New file.
+       * Makefile.am (TESTS): Add it.
+       (dwfl_bug_addr_overflow_LDADD): New variable.
+
 2006-12-17  Roland McGrath  <roland@redhat.com>
 
        * msg_tst.c (libelf_msgs): Fix ELF_E_INVALID_PHDR msg.
index bc46c42e5695efeb5792f06af97d5736f1baca07..93a2f8e309848a790a9f76cb8ea40717bb22dc2a 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 ##
-## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
+## Copyright (C) 1996-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
@@ -58,7 +58,8 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
                  show-die-info get-files get-lines get-pubnames \
                  get-aranges allfcts line2addr addrscopes funcscopes \
                  show-abbrev hash newscn ecp dwflmodtest \
-                 find-prologues funcretval allregs rdwrmmap
+                 find-prologues funcretval allregs rdwrmmap \
+                 dwfl-bug-addr-overflow
 # get-ciefde
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
            asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -75,7 +76,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
        run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
        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
+       run-native-test.sh run-bug1-test.sh \
+       dwfl-bug-addr-overflow
 # run-show-ciefde.sh
 
 if !STANDALONE
@@ -198,6 +200,7 @@ asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
 asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
 dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
 rdwrmmap_LDADD = $(libelf)
+dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
 
 CLEANFILES = xxx *.gcno *.gcda *gconv
 
diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
new file mode 100644 (file)
index 0000000..0e875da
--- /dev/null
@@ -0,0 +1,81 @@
+/* Test program for libdwfl basic module tracking, relocation.
+   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
+   <http://www.openinventionnetwork.com>.  */
+
+#include <config.h>
+#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <error.h>
+#include <locale.h>
+#include ELFUTILS_HEADER(dwfl)
+
+
+static const Dwfl_Callbacks offline_callbacks =
+  {
+    .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo),
+    .section_address = INTUSE(dwfl_offline_section_address),
+  };
+
+
+int
+main (void)
+{
+  /* We use no threads here which can interfere with handling a stream.  */
+  (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER);
+
+  /* Set locale.  */
+  (void) setlocale (LC_ALL, "");
+
+  Dwfl *dwfl = dwfl_begin (&offline_callbacks);
+  assert (dwfl != NULL);
+
+  Dwfl_Module *high = dwfl_report_module (dwfl, "high",
+                                         UINT64_C (0xffffffff00010000),
+                                         UINT64_C (0xffffffff00020000));
+  assert (high);
+  Dwfl_Module *low = dwfl_report_module (dwfl, "low",
+                                        UINT64_C (0x00010000),
+                                        UINT64_C (0x00020000));
+  assert (low);
+  Dwfl_Module *middle = dwfl_report_module (dwfl, "middle",
+                                           UINT64_C (0xffff00010000),
+                                           UINT64_C (0xffff00020000));
+  assert (middle);
+
+  int ret = dwfl_report_end (dwfl, NULL, NULL);
+  assert (ret == 0);
+
+  Dwfl_Module *mod = dwfl_addrmodule (dwfl, UINT64_C (0xffffffff00010123));
+  assert (mod == high);
+  mod = dwfl_addrmodule (dwfl, UINT64_C (0x00010123));
+  assert (mod == low);
+  mod = dwfl_addrmodule (dwfl, UINT64_C (0xffff00010123));
+  assert (mod == middle);
+
+  dwfl_end (dwfl);
+
+  return 0;
+}