summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-05-07 18:56:44 -0700
committerRoland McGrath <roland@redhat.com>2009-05-07 18:56:44 -0700
commit17e0bf967dce1b7370ec7a56a826db9c3d6602ce (patch)
tree3fc857222fa87d64c30d5bd7b82ffa88d702d810
parent9658dceb070a1c4c6a501fec9d14bf7f762b1676 (diff)
parent4e5e29e7722e9b6881a685002487f4ca3001c480 (diff)
downloadelfutils-17e0bf967dce1b7370ec7a56a826db9c3d6602ce.tar.gz
Merge branch 'dwarf' into roland/dwarf-macinfo
Conflicts: libdw/dwarf_getmacros.c
-rw-r--r--libdw/ChangeLog11
-rw-r--r--libdw/dwarf_getmacros.c44
-rw-r--r--po/it.po394
-rw-r--r--src/ChangeLog4
-rw-r--r--src/elflint.c11
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/Makefile.am9
-rw-r--r--tests/dwarf-getmacros.c64
-rwxr-xr-xtests/run-dwarf-getmacros.sh296
-rwxr-xr-xtests/testfile51.bz2bin0 -> 4294 bytes
10 files changed, 819 insertions, 22 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 4761d822..bd694639 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -55,6 +55,17 @@
* c++/dwarf: New file.
* Makefile.am (pkginclude_HEADERS): Add it.
+2009-05-07 Roland McGrath <roland@redhat.com>
+
+ * dwarf_getmacros.c (dwarf_getmacros): Use absolute section offset in
+ return value and OFFSET argument, not CU-relative. Only fetch the
+ attribute data when called with OFFSET of 0.
+
+2009-05-07 Petr Machata <pmachata@redhat.com>
+
+ * dwarf_getmacros.c (dwarf_getmacros): Take into account offset in
+ DW_AT_macro_info attribute of CU DIE.
+
2009-04-15 Roland McGrath <roland@redhat.com>
* dwarf.h (DW_CIE_ID): Removed.
diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c
index 5421dfc1..22afbc3f 100644
--- a/libdw/dwarf_getmacros.c
+++ b/libdw/dwarf_getmacros.c
@@ -1,5 +1,5 @@
/* Get macro information.
- Copyright (C) 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
+ Copyright (C) 2002-2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -65,27 +65,36 @@ dwarf_getmacros (die, callback, arg, offset)
void *arg;
ptrdiff_t offset;
{
- /* Get the appropriate attribute. */
- Dwarf_Attribute attr;
- if (INTUSE(dwarf_attr) (die, DW_AT_macro_info, &attr) == NULL)
- return -1;
+ Elf_Data *d = die->cu->dbg->sectiondata[IDX_debug_macinfo];
+ if (unlikely (d == NULL) || unlikely (d->d_buf == NULL))
+ {
+ __libdw_seterrno (DWARF_E_NO_ENTRY);
+ return -1;
+ }
- /* Offset into the .debug_macinfo section. */
- Dwarf_Word macoff;
- if (INTUSE(dwarf_formudata) (&attr, &macoff) != 0)
- return -1;
+ if (offset == 0)
+ {
+ /* Get the appropriate attribute. */
+ Dwarf_Attribute attr;
+ if (INTUSE(dwarf_attr) (die, DW_AT_macro_info, &attr) == NULL)
+ return -1;
- const unsigned char *readp
- = die->cu->dbg->sectiondata[IDX_debug_macinfo]->d_buf + offset;
- const unsigned char *readendp
- = readp + die->cu->dbg->sectiondata[IDX_debug_macinfo]->d_size;
+ /* Offset into the .debug_macinfo section. */
+ Dwarf_Word macoff;
+ if (INTUSE(dwarf_formudata) (&attr, &macoff) != 0)
+ return -1;
+
+ offset = macoff;
+ }
+ if (unlikely (offset > (ptrdiff_t) d->d_size))
+ goto invalid;
+
+ const unsigned char *readp = d->d_buf + offset;
+ const unsigned char *readendp = d->d_buf + d->d_size;
if (readp == readendp)
return 0;
- if (*readp != DW_MACINFO_start_file)
- goto invalid;
-
while (readp < readendp)
{
unsigned int opcode = *readp++;
@@ -142,8 +151,7 @@ dwarf_getmacros (die, callback, arg, offset)
mac.param2.s = str;
if (callback (&mac, arg) != DWARF_CB_OK)
- return readp - ((unsigned char *) die->cu->dbg->sectiondata
- [IDX_debug_macinfo]->d_buf);
+ return readp - (const unsigned char *) d->d_buf;
}
/* If we come here the termination of the data for the CU is not
diff --git a/po/it.po b/po/it.po
new file mode 100644
index 00000000..86d05f9b
--- /dev/null
+++ b/po/it.po
@@ -0,0 +1,394 @@
+# translation of python-fedora.devel.python-fedora.it.po to Italiano
+# Translations template for python-fedora.
+# This file is distributed under the same license as the python-fedora project.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: python-fedora.devel.python-fedora.it\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-03-20 00:04-0700\n"
+"PO-Revision-Date: 2009-04-30 04:24+0200\n"
+"Last-Translator: \n"
+"Language-Team: Italiano <fedora-trans-it@redhat.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.4\n"
+"X-Generator: KBabel 1.11.4\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: fedora/release.py:9
+msgid "Python modules for interacting with Fedora Services"
+msgstr ""
+
+#: fedora/release.py:10
+msgid ""
+"\n"
+"The Fedora Project runs many different services. These services help us "
+"to\n"
+"package software, develop new programs, and generally put together the "
+"distro.\n"
+"This package contains software that helps us do that.\n"
+msgstr ""
+
+#: fedora/accounts/fas2.py:8
+msgid ""
+"fedora.accounts.fas2 has moved to fedora.client.fas2. This location will"
+" disappear in 0.4"
+msgstr ""
+
+#: fedora/client/baseclient.py:84 fedora/client/baseclient.py:203
+#: fedora/client/baseclient.py:222 fedora/client/baseclient.py:234
+msgid "session_cookie is deprecated, use session_id instead"
+msgstr ""
+
+#: fedora/client/baseclient.py:102
+#, python-format
+msgid "Unable to load session from %(file)s"
+msgstr ""
+
+#: fedora/client/baseclient.py:119
+#, python-format
+msgid "Unable to create %(dir)s: %(error)s"
+msgstr ""
+
+#: fedora/client/baseclient.py:131
+#, python-format
+msgid "Unable to write to session file %(session)s: %(error)s"
+msgstr ""
+
+#: fedora/client/baseclient.py:153
+#, python-format
+msgid "No session cached for \"%s\""
+msgstr ""
+
+#: fedora/client/baseclient.py:275
+#, python-format
+msgid "send_request() got an unexpected keyword argument \"%s\""
+msgstr ""
+
+#: fedora/client/baseclient.py:279
+msgid "send_request() got an unexpected keyword argument \"input\""
+msgstr ""
+
+#: fedora/client/baseclient.py:283
+msgid "send_request() got an unexpected keyword argument"
+msgstr ""
+
+#: fedora/client/baseclient.py:287
+msgid "send_request(input) is deprecated. Use send_request(req_params) instead"
+msgstr ""
+
+#: fedora/client/baseclient.py:303
+msgid ""
+"Auth was requested but no way to perform auth was given. Please set "
+"username and password or session_id before calling this function with "
+"auth=True"
+msgstr ""
+
+#: fedora/client/bodhi.py:190
+msgid "You must specify a username"
+msgstr ""
+
+#: fedora/client/bodhi.py:259
+#, python-format
+msgid "Reading from %s "
+msgstr ""
+
+#: fedora/client/fas2.py:187
+#, python-format
+msgid "FAS server unable to retrieve group %s"
+msgstr ""
+
+#: fedora/client/fas2.py:299
+msgid "key must be one of \"id\", \"username\", or \"email\""
+msgstr ""
+
+#: fedora/client/fas2.py:305
+#, python-format
+msgid "%(field)s is not a valid field to filter"
+msgstr ""
+
+#: fedora/client/fas2.py:354
+msgid ""
+"people_by_id() is deprecated and will be removed in 0.4. Please port "
+"your code to use people_by_key(key='id', fields=['human_name', 'email', "
+"'username', 'bugzilla_email']) instead"
+msgstr ""
+
+#: fedora/client/fas2.py:507
+msgid "FAS server unable to retrieve group members"
+msgstr ""
+
+#: fedora/client/fas2.py:529
+msgid "FAS server unable to retrieve user information"
+msgstr ""
+
+#: fedora/client/pkgdb.py:188
+#, python-format
+msgid "PackageDB returned an error creating %(pkg)s: %(msg)s"
+msgstr ""
+
+#: fedora/client/pkgdb.py:193
+#, python-format
+msgid ""
+"Package %(pkg)s does not exist and we do not have enough information to "
+"create it."
+msgstr ""
+
+#: fedora/client/pkgdb.py:230
+#, python-format
+msgid "Unable to save all information for %(pkg)s: %(msg)s"
+msgstr ""
+
+#: fedora/client/pkgdb.py:256
+#, python-format
+msgid "Collection abbreviation %(collection)s is unknown. Use F, FC, EL, or OLPC"
+msgstr ""
+
+#: fedora/client/proxyclient.py:104
+msgid "proxyclient.__init__:entered"
+msgstr ""
+
+#: fedora/client/proxyclient.py:113
+msgid ""
+"Returning cookies from send_request() is deprecated and will be removed "
+"in 0.4. Please port your code to use a session_id instead by calling the"
+" ProxyClient constructor with session_as_cookie=False"
+msgstr ""
+
+#: fedora/client/proxyclient.py:119
+msgid "proxyclient.__init__:exited"
+msgstr ""
+
+#: fedora/client/proxyclient.py:186
+msgid "proxyclient.send_request: entered"
+msgstr ""
+
+#: fedora/client/proxyclient.py:195
+msgid ""
+"Giving a cookie to send_request() to authenticate is deprecated and will "
+"be removed in 0.4. Please port your code to use session_id instead."
+msgstr ""
+
+#: fedora/client/proxyclient.py:205
+msgid "username and password must both be set in auth_params"
+msgstr ""
+
+#: fedora/client/proxyclient.py:208
+msgid ""
+"No known authentication methods specified: set \"cookie\" in auth_params "
+"or set both username and password in auth_params"
+msgstr ""
+
+#: fedora/client/proxyclient.py:269
+#, python-format
+msgid "Creating request %(url)s"
+msgstr ""
+
+#: fedora/client/proxyclient.py:270
+#, python-format
+msgid "Headers: %(header)s"
+msgstr ""
+
+#: fedora/client/proxyclient.py:274
+#, python-format
+msgid "Data: %(data)s"
+msgstr ""
+
+#: fedora/client/proxyclient.py:286
+msgid "Authentication failed logging in"
+msgstr ""
+
+#: fedora/client/proxyclient.py:287
+msgid ""
+"Unable to log into server. Invalid authentication tokens. Send new "
+"username and password"
+msgstr ""
+
+#: fedora/client/proxyclient.py:293
+msgid "Unknown HTTP Server Response"
+msgstr ""
+
+#: fedora/client/proxyclient.py:313
+#, python-format
+msgid "Error returned from simplejson while processing %(url)s: %(err)s"
+msgstr ""
+
+#: fedora/client/proxyclient.py:329
+msgid "proxyclient.send_request: exited"
+msgstr ""
+
+#: fedora/client/wiki.py:56
+#, python-format
+msgid "Login failed: %s"
+msgstr ""
+
+#: fedora/client/wiki.py:64
+#, python-format
+msgid "From %(then)s to %(now)s"
+msgstr ""
+
+#: fedora/client/wiki.py:67
+#, python-format
+msgid "%d wiki changes in the past week"
+msgstr ""
+
+#: fedora/client/wiki.py:69
+msgid ""
+"Warning: Number of changes reaches the API return limit.\n"
+"You will not get the complete list of changes unless\n"
+"you run this script using a 'bot' account."
+msgstr ""
+
+#: fedora/client/wiki.py:79
+msgid ""
+"\n"
+"== Most active wiki users =="
+msgstr ""
+
+#: fedora/client/wiki.py:86
+msgid ""
+"\n"
+"== Most edited pages =="
+msgstr ""
+
+#: fedora/django/auth/models.py:48
+msgid "Loading FAS groups..."
+msgstr ""
+
+#: fedora/django/auth/models.py:55
+msgid "Unable to load FAS groups. Did you set FAS_USERNAME and FAS_PASSWORD?"
+msgstr ""
+
+#: fedora/django/auth/models.py:62
+msgid "FAS groups loaded. Don't forget to unset FAS_USERNAME and FAS_PASSWORD."
+msgstr ""
+
+#: fedora/tg/client.py:8
+msgid ""
+"fedora.tg.client has moved to fedora.client. This location will "
+"disappear in 0.4"
+msgstr ""
+
+#: fedora/tg/controllers.py:58
+#, python-format
+msgid "Welcome, %s"
+msgstr ""
+
+#: fedora/tg/controllers.py:67
+msgid ""
+"The credentials you supplied were not correct or did not grant access to "
+"this resource."
+msgstr ""
+
+#: fedora/tg/controllers.py:70
+msgid "You must provide your credentials before accessing this resource."
+msgstr ""
+
+#: fedora/tg/controllers.py:73
+msgid "Please log in."
+msgstr ""
+
+#: fedora/tg/controllers.py:98
+msgid "You have successfully logged out."
+msgstr ""
+
+#: fedora/tg/util.py:106
+msgid "url() expects a dictionary for query parameters"
+msgstr ""
+
+#: fedora/tg/identity/jsonfasprovider1.py:226
+#: fedora/tg/identity/jsonfasprovider2.py:392
+#, python-format
+msgid "Error logging in %(user)s: %(error)s"
+msgstr ""
+
+#: fedora/tg/identity/jsonfasprovider2.py:59
+msgid ""
+"Cannot enable ssl certificate auth via identity.ssl without setting "
+"fas.usernamme and fas.password for authorization"
+msgstr ""
+
+#: fedora/tg/identity/jsonfasprovider2.py:155
+#, python-format
+msgid "jsonfasprovider, ssl, returned errors from send_request: %s"
+msgstr ""
+
+#: fedora/tg/identity/jsonfasprovider2.py:167
+#, python-format
+msgid "jsonfasprovider returned errors from send_request: %s"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:10
+msgid "Log In"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:14
+msgid "User Name:"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:17
+msgid "Password:"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:21
+#: fedora/tg/templates/genshi/login.html:84
+msgid "Login"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:28
+msgid "CSRF attacks"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:29
+msgid ""
+" are a means for a malicious website to make a request of another\n"
+" web server as the user who contacted the malicious web site. The"
+"\n"
+" purpose of this page is to help protect your account and this "
+"server\n"
+" from attacks from such malicious web sites. By clicking below, "
+"you are\n"
+" proving that you are a person rather than just the web browser\n"
+" forwarding your authentication cookies on behalf of a malicious\n"
+" website."
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:36
+msgid "I am a human"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:41
+msgid "Forgot Password?"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:42
+msgid "Sign Up"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:60
+msgid "Welcome"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:82
+msgid "You are not logged in"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:89
+msgid "CSRF protected"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:91
+msgid "Verify Login"
+msgstr ""
+
+#: fedora/tg/templates/genshi/login.html:97
+msgid "Logout"
+msgstr ""
+
+#: fedora/tg/visit/jsonfasvisit1.py:109 fedora/tg/visit/jsonfasvisit2.py:110
+#, python-format
+msgid "updating visit (%s)"
+msgstr ""
+
diff --git a/src/ChangeLog b/src/ChangeLog
index da77d8c6..85326e09 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -166,6 +166,10 @@
* dwarflint.c: Checking for zero padding and unreferenced bytes.
CU size and padding at the end of CU are now checked.
+2009-04-29 Ulrich Drepper <drepper@redhat.com>
+
+ * elflint.c (check_symtab): Add tests of st_other field.
+
2009-04-23 Ulrich Drepper <drepper@redhat.com>
* Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS).
diff --git a/src/elflint.c b/src/elflint.c
index 7ddf3a9a..c04ae57f 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -976,6 +976,17 @@ section [%2d] '%s': _DYNAMIC symbol size %" PRIu64 " does not match dynamic segm
}
}
}
+
+ if (GELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT
+ && shdr->sh_type == SHT_DYNSYM)
+ ERROR (gettext ("\
+section [%2d] '%s': symbol %zu: symbol in dynamic symbol table with non-default visibility\n"),
+ idx, section_name (ebl, idx), cnt);
+ if ((sym->st_other ^ GELF_ST_VISIBILITY (sym->st_other)) != 0)
+ ERROR (gettext ("\
+section [%2d] '%s': symbol %zu: unknown bit set in st_other\n"),
+ idx, section_name (ebl, idx), cnt);
+
}
}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 5897d9d6..39245f84 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -38,6 +38,14 @@
* run-dwarfcmp-self.sh: New file.
* Makefile.am (TESTS, EXTRA_DIST) Add it.
+2009-05-07 Petr Machata <pmachata@redhat.com>
+
+ * testfile51.bz2: New data file.
+ * dwarf-getmacros.c: New test core.
+ * run-dwarf-getmacros.sh: New test wrapper.
+ * Makefile.am (TESTS, EXTRA_DIST, noinst_PROGRAMS): Add them.
+ (dwarf_getmacros_LDADD): New variable.
+
2009-04-23 Ulrich Drepper <drepper@redhat.com>
* Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS).
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 293bad91..ba950088 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -60,8 +60,7 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
find-prologues funcretval allregs rdwrmmap \
dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \
dwfl-addr-sect dwfl-bug-report early-offscn \
- dwfl-bug-getmodules \
- dwarf-print
+ dwfl-bug-getmodules dwarf-getmacros dwarf-print
# get-ciefde
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -87,7 +86,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
dwfl-bug-fd-leak dwfl-bug-report \
run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \
run-disasm-x86.sh run-disasm-x86-64.sh \
- run-early-offscn.sh \
+ run-early-offscn.sh run-dwarf-getmacros.sh \
run-dwarfcmp-self.sh run-dwarflint-self.sh run-dwarf-attributes.sh
# run-show-ciefde.sh
@@ -121,6 +120,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-find-prologues.sh run-allregs.sh run-native-test.sh \
run-addrname-test.sh run-dwfl-bug-offline-rel.sh \
run-dwfl-addr-sect.sh run-early-offscn.sh \
+ run-dwarf-getmacros.sh \
run-dwarfcmp-self.sh run-dwarflint-self.sh \
run-dwarf-attributes.sh \
testfile15.bz2 testfile15.debug.bz2 \
@@ -145,7 +145,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \
testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \
testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \
- testfile49.bz2 testfile50.bz2
+ testfile49.bz2 testfile50.bz2 testfile51.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
bindir=$(DESTDIR)$(bindir) \
@@ -243,6 +243,7 @@ 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)
+dwarf_getmacros_LDADD = $(libdw)
CLEANFILES = xxx *.gcno *.gcda *gconv
diff --git a/tests/dwarf-getmacros.c b/tests/dwarf-getmacros.c
new file mode 100644
index 00000000..5c380976
--- /dev/null
+++ b/tests/dwarf-getmacros.c
@@ -0,0 +1,64 @@
+/* Test program for dwfl_module_return_value_location.
+ Copyright (C) 2009 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(dw)
+#include <dwarf.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+int
+main (int argc __attribute__ ((unused)), char *argv[])
+{
+ const char *name = argv[1];
+ ptrdiff_t cuoff = strtol (argv[2], NULL, 0);
+
+ int fd = open (name, O_RDONLY);
+ Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
+
+ Dwarf_Die cudie_mem, *cudie = dwarf_offdie (dbg, cuoff, &cudie_mem);
+ int mac (Dwarf_Macro *macro, void *data __attribute__ ((unused)))
+ {
+ unsigned int opcode;
+ dwarf_macro_opcode (macro, &opcode);
+ if (opcode == DW_MACINFO_define)
+ {
+ const char *value;
+ dwarf_macro_param2 (macro, NULL, &value);
+ puts (value);
+ }
+ return DWARF_CB_ABORT;
+ }
+
+ ptrdiff_t off = 0;
+ while ((off = dwarf_getmacros (cudie, mac, NULL, off)) > 0)
+ ;
+
+ return 0;
+}
diff --git a/tests/run-dwarf-getmacros.sh b/tests/run-dwarf-getmacros.sh
new file mode 100755
index 00000000..d29c5349
--- /dev/null
+++ b/tests/run-dwarf-getmacros.sh
@@ -0,0 +1,296 @@
+#! /bin/sh
+# Copyright (C) 2009 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>.
+
+. $srcdir/test-subr.sh
+
+testfiles testfile51
+
+testrun_compare ./dwarf-getmacros testfile51 0xb <<\EOF
+__STDC__ 1
+__STDC_HOSTED__ 1
+__GNUC__ 4
+__GNUC_MINOR__ 3
+__GNUC_PATCHLEVEL__ 2
+__GNUC_RH_RELEASE__ 7
+__SIZE_TYPE__ long unsigned int
+__PTRDIFF_TYPE__ long int
+__WCHAR_TYPE__ int
+__WINT_TYPE__ unsigned int
+__INTMAX_TYPE__ long int
+__UINTMAX_TYPE__ long unsigned int
+__GXX_ABI_VERSION 1002
+__SCHAR_MAX__ 127
+__SHRT_MAX__ 32767
+__INT_MAX__ 2147483647
+__LONG_MAX__ 9223372036854775807L
+__LONG_LONG_MAX__ 9223372036854775807LL
+__WCHAR_MAX__ 2147483647
+__CHAR_BIT__ 8
+__INTMAX_MAX__ 9223372036854775807L
+__FLT_EVAL_METHOD__ 0
+__DEC_EVAL_METHOD__ 2
+__FLT_RADIX__ 2
+__FLT_MANT_DIG__ 24
+__FLT_DIG__ 6
+__FLT_MIN_EXP__ (-125)
+__FLT_MIN_10_EXP__ (-37)
+__FLT_MAX_EXP__ 128
+__FLT_MAX_10_EXP__ 38
+__FLT_MAX__ 3.40282347e+38F
+__FLT_MIN__ 1.17549435e-38F
+__FLT_EPSILON__ 1.19209290e-7F
+__FLT_DENORM_MIN__ 1.40129846e-45F
+__FLT_HAS_DENORM__ 1
+__FLT_HAS_INFINITY__ 1
+__FLT_HAS_QUIET_NAN__ 1
+__DBL_MANT_DIG__ 53
+__DBL_DIG__ 15
+__DBL_MIN_EXP__ (-1021)
+__DBL_MIN_10_EXP__ (-307)
+__DBL_MAX_EXP__ 1024
+__DBL_MAX_10_EXP__ 308
+__DBL_MAX__ 1.7976931348623157e+308
+__DBL_MIN__ 2.2250738585072014e-308
+__DBL_EPSILON__ 2.2204460492503131e-16
+__DBL_DENORM_MIN__ 4.9406564584124654e-324
+__DBL_HAS_DENORM__ 1
+__DBL_HAS_INFINITY__ 1
+__DBL_HAS_QUIET_NAN__ 1
+__LDBL_MANT_DIG__ 64
+__LDBL_DIG__ 18
+__LDBL_MIN_EXP__ (-16381)
+__LDBL_MIN_10_EXP__ (-4931)
+__LDBL_MAX_EXP__ 16384
+__LDBL_MAX_10_EXP__ 4932
+__DECIMAL_DIG__ 21
+__LDBL_MAX__ 1.18973149535723176502e+4932L
+__LDBL_MIN__ 3.36210314311209350626e-4932L
+__LDBL_EPSILON__ 1.08420217248550443401e-19L
+__LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
+__LDBL_HAS_DENORM__ 1
+__LDBL_HAS_INFINITY__ 1
+__LDBL_HAS_QUIET_NAN__ 1
+__DEC32_MANT_DIG__ 7
+__DEC32_MIN_EXP__ (-95)
+__DEC32_MAX_EXP__ 96
+__DEC32_MIN__ 1E-95DF
+__DEC32_MAX__ 9.999999E96DF
+__DEC32_EPSILON__ 1E-6DF
+__DEC32_DEN__ 0.000001E-95DF
+__DEC64_MANT_DIG__ 16
+__DEC64_MIN_EXP__ (-383)
+__DEC64_MAX_EXP__ 384
+__DEC64_MIN__ 1E-383DD
+__DEC64_MAX__ 9.999999999999999E384DD
+__DEC64_EPSILON__ 1E-15DD
+__DEC64_DEN__ 0.000000000000001E-383DD
+__DEC128_MANT_DIG__ 34
+__DEC128_MIN_EXP__ (-6143)
+__DEC128_MAX_EXP__ 6144
+__DEC128_MIN__ 1E-6143DL
+__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
+__DEC128_EPSILON__ 1E-33DL
+__DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL
+__REGISTER_PREFIX__
+__USER_LABEL_PREFIX__
+__VERSION__ "4.3.2 20081105 (Red Hat 4.3.2-7)"
+__GNUC_GNU_INLINE__ 1
+_LP64 1
+__LP64__ 1
+__NO_INLINE__ 1
+__FINITE_MATH_ONLY__ 0
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
+__SIZEOF_INT__ 4
+__SIZEOF_LONG__ 8
+__SIZEOF_LONG_LONG__ 8
+__SIZEOF_SHORT__ 2
+__SIZEOF_FLOAT__ 4
+__SIZEOF_DOUBLE__ 8
+__SIZEOF_LONG_DOUBLE__ 16
+__SIZEOF_SIZE_T__ 8
+__SIZEOF_WCHAR_T__ 4
+__SIZEOF_WINT_T__ 4
+__SIZEOF_PTRDIFF_T__ 8
+__SIZEOF_POINTER__ 8
+__amd64 1
+__amd64__ 1
+__x86_64 1
+__x86_64__ 1
+__k8 1
+__k8__ 1
+__MMX__ 1
+__SSE__ 1
+__SSE2__ 1
+__SSE_MATH__ 1
+__SSE2_MATH__ 1
+__gnu_linux__ 1
+__linux 1
+__linux__ 1
+linux 1
+__unix 1
+__unix__ 1
+unix 1
+__ELF__ 1
+__DECIMAL_BID_FORMAT__ 1
+macro1 ble
+EOF
+
+testrun_compare ./dwarf-getmacros testfile51 0x84 <<\EOF
+__STDC__ 1
+__STDC_HOSTED__ 1
+__GNUC__ 4
+__GNUC_MINOR__ 3
+__GNUC_PATCHLEVEL__ 2
+__GNUC_RH_RELEASE__ 7
+__SIZE_TYPE__ long unsigned int
+__PTRDIFF_TYPE__ long int
+__WCHAR_TYPE__ int
+__WINT_TYPE__ unsigned int
+__INTMAX_TYPE__ long int
+__UINTMAX_TYPE__ long unsigned int
+__GXX_ABI_VERSION 1002
+__SCHAR_MAX__ 127
+__SHRT_MAX__ 32767
+__INT_MAX__ 2147483647
+__LONG_MAX__ 9223372036854775807L
+__LONG_LONG_MAX__ 9223372036854775807LL
+__WCHAR_MAX__ 2147483647
+__CHAR_BIT__ 8
+__INTMAX_MAX__ 9223372036854775807L
+__FLT_EVAL_METHOD__ 0
+__DEC_EVAL_METHOD__ 2
+__FLT_RADIX__ 2
+__FLT_MANT_DIG__ 24
+__FLT_DIG__ 6
+__FLT_MIN_EXP__ (-125)
+__FLT_MIN_10_EXP__ (-37)
+__FLT_MAX_EXP__ 128
+__FLT_MAX_10_EXP__ 38
+__FLT_MAX__ 3.40282347e+38F
+__FLT_MIN__ 1.17549435e-38F
+__FLT_EPSILON__ 1.19209290e-7F
+__FLT_DENORM_MIN__ 1.40129846e-45F
+__FLT_HAS_DENORM__ 1
+__FLT_HAS_INFINITY__ 1
+__FLT_HAS_QUIET_NAN__ 1
+__DBL_MANT_DIG__ 53
+__DBL_DIG__ 15
+__DBL_MIN_EXP__ (-1021)
+__DBL_MIN_10_EXP__ (-307)
+__DBL_MAX_EXP__ 1024
+__DBL_MAX_10_EXP__ 308
+__DBL_MAX__ 1.7976931348623157e+308
+__DBL_MIN__ 2.2250738585072014e-308
+__DBL_EPSILON__ 2.2204460492503131e-16
+__DBL_DENORM_MIN__ 4.9406564584124654e-324
+__DBL_HAS_DENORM__ 1
+__DBL_HAS_INFINITY__ 1
+__DBL_HAS_QUIET_NAN__ 1
+__LDBL_MANT_DIG__ 64
+__LDBL_DIG__ 18
+__LDBL_MIN_EXP__ (-16381)
+__LDBL_MIN_10_EXP__ (-4931)
+__LDBL_MAX_EXP__ 16384
+__LDBL_MAX_10_EXP__ 4932
+__DECIMAL_DIG__ 21
+__LDBL_MAX__ 1.18973149535723176502e+4932L
+__LDBL_MIN__ 3.36210314311209350626e-4932L
+__LDBL_EPSILON__ 1.08420217248550443401e-19L
+__LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
+__LDBL_HAS_DENORM__ 1
+__LDBL_HAS_INFINITY__ 1
+__LDBL_HAS_QUIET_NAN__ 1
+__DEC32_MANT_DIG__ 7
+__DEC32_MIN_EXP__ (-95)
+__DEC32_MAX_EXP__ 96
+__DEC32_MIN__ 1E-95DF
+__DEC32_MAX__ 9.999999E96DF
+__DEC32_EPSILON__ 1E-6DF
+__DEC32_DEN__ 0.000001E-95DF
+__DEC64_MANT_DIG__ 16
+__DEC64_MIN_EXP__ (-383)
+__DEC64_MAX_EXP__ 384
+__DEC64_MIN__ 1E-383DD
+__DEC64_MAX__ 9.999999999999999E384DD
+__DEC64_EPSILON__ 1E-15DD
+__DEC64_DEN__ 0.000000000000001E-383DD
+__DEC128_MANT_DIG__ 34
+__DEC128_MIN_EXP__ (-6143)
+__DEC128_MAX_EXP__ 6144
+__DEC128_MIN__ 1E-6143DL
+__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
+__DEC128_EPSILON__ 1E-33DL
+__DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL
+__REGISTER_PREFIX__
+__USER_LABEL_PREFIX__
+__VERSION__ "4.3.2 20081105 (Red Hat 4.3.2-7)"
+__GNUC_GNU_INLINE__ 1
+_LP64 1
+__LP64__ 1
+__NO_INLINE__ 1
+__FINITE_MATH_ONLY__ 0
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
+__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
+__SIZEOF_INT__ 4
+__SIZEOF_LONG__ 8
+__SIZEOF_LONG_LONG__ 8
+__SIZEOF_SHORT__ 2
+__SIZEOF_FLOAT__ 4
+__SIZEOF_DOUBLE__ 8
+__SIZEOF_LONG_DOUBLE__ 16
+__SIZEOF_SIZE_T__ 8
+__SIZEOF_WCHAR_T__ 4
+__SIZEOF_WINT_T__ 4
+__SIZEOF_PTRDIFF_T__ 8
+__SIZEOF_POINTER__ 8
+__amd64 1
+__amd64__ 1
+__x86_64 1
+__x86_64__ 1
+__k8 1
+__k8__ 1
+__MMX__ 1
+__SSE__ 1
+__SSE2__ 1
+__SSE_MATH__ 1
+__SSE2_MATH__ 1
+__gnu_linux__ 1
+__linux 1
+__linux__ 1
+linux 1
+__unix 1
+__unix__ 1
+unix 1
+__ELF__ 1
+__DECIMAL_BID_FORMAT__ 1
+macro2 ble
+EOF
+
+exit 0
diff --git a/tests/testfile51.bz2 b/tests/testfile51.bz2
new file mode 100755
index 00000000..5ff45c61
--- /dev/null
+++ b/tests/testfile51.bz2
Binary files differ