From cc6695e2684ce93cdf8bd2da63d55d2cf49ff076 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Wed, 7 Mar 2012 23:04:02 -0800 Subject: Upgrade elfutils from version 0.97 to 0.138 This upgrade is in preparation for adding perf to the Android tree, where perf needs newer version of elfutils. This particular snapshot also cleans up the current makefile where only the host version of libelf.a (needed by elftree). Additional build targets for libebl.a, libebl_arm.a, and libebl_sh.a are eliminated since they are not used in the tree at all. Changes that build other target modules and associated modifications to work with bionic will be added later. Change-Id: Ifa808ba5ad2881ccb2c0cf44d134931faad801e1 --- tests/dwfl-bug-addr-overflow.c | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 tests/dwfl-bug-addr-overflow.c (limited to 'tests/dwfl-bug-addr-overflow.c') diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c new file mode 100644 index 00000000..0e875dac --- /dev/null +++ b/tests/dwfl-bug-addr-overflow.c @@ -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 + . */ + +#include +#include +#include +#include +#include +#include +#include +#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; +} -- cgit v1.2.3