+2005-08-18 Roland McGrath <roland@redhat.com>
+
+ * dwarf_getscopes.c (dwarf_getscopes): Include the CU itself as
+ outermost scope in the results.
+
2005-08-15 Roland McGrath <roland@redhat.com>
* dwarf_func_inline.c: New file.
if (cudie == NULL)
return -1;
- int n = find_pc (1, cudie, pc, scopes);
- if (likely (n >= -1))
- /* We have an error or a final result. */
+ int n = find_pc (2, cudie, pc, scopes);
+ if (likely (n >= 0))
+ {
+ /* We have a final result. Now store the outermost scope, the CU. */
+ (*scopes)[n++] = *cudie;
+ return n;
+ }
+ if (n == -1)
return n;
/* We have the scopes out to one that is a concrete instance of an
int result = find_die (0, cudie, origin, scopes, n);
if (likely (result > 0))
- return n + result - 1;
+ {
+ n = n + result - 1;
+ (*scopes)[n++] = *cudie;
+ return n;
+ }
if (result == 0) /* No match, shouldn't happen. */
{
2005-08-18 Roland McGrath <roland@redhat.com>
+ * run-addrscopes.sh: New file.
+ * testfile22.bz2: New data file.
+ * Makefile.am (TESTS, EXTRA_DIST): Add them.
+
* addrscopes.c: New file.
* Makefile.am (noinst_PROGRAMS): Add it.
(addrscopes_LDADD): New variable.
run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \
run-strip-test6.sh run-ecp-test.sh run-ecp-test2.sh \
run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \
- run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh
+ run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
+ run-addrscopes.sh
# run-show-ciefde.sh
EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \
run-ranlib-test3.sh run-ranlib-test4.sh \
+ run-addrscopes.sh \
testfile15.bz2 testfile15.debug.bz2 \
testfile16.bz2 testfile16.debug.bz2 \
testfile17.bz2 testfile17.debug.bz2 \
testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \
testfile20.bz2 testfile20.index.bz2 \
- testfile21.bz2 testfile21.index.bz2
+ testfile21.bz2 testfile21.index.bz2 \
+ testfile22.bz2
if MUDFLAP
static_build=yes
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2005 Red Hat, Inc.
+#
+# This program is Open Source software; you can redistribute it and/or
+# modify it under the terms of the Open Software License version 1.0 as
+# published by the Open Source Initiative.
+#
+# You should have received a copy of the Open Software License along
+# with this program; if not, you may obtain a copy of the Open Software
+# License version 1.0 from http://www.opensource.org/licenses/osl.php or
+# by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+# 3001 King Ranch Road, Ukiah, CA 95482.
+set -e
+
+# Don't fail if we cannot decompress the file.
+bunzip2 -c $srcdir/testfile22.bz2 > testfile22 2>/dev/null || exit 0
+
+LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
+ ./addrscopes -e testfile22 0x8048353 >& addrscopes-test.out || :
+
+diff -Bbu addrscopes-test.out - <<\EOF
+0x8048353:
+ tests/foo.c (0x11): 0x8048348 (tests/foo.c:5) .. 0x804837e (tests/foo.c:16)
+ global [ be]
+ function (0x2e): 0x8048348 (tests/foo.c:5) .. 0x804835b (tests/foo.c:14)
+ local [ 8f]
+EOF
+
+rm -f testfile22 addrscopes-test.out
+
+exit 0