+2020-05-08 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_decl_file.c (dwarf_decl_file): Use attr CU instead of DIE
+ CU to resolve file name.
+ * dwarf_ranges.c(dwarf_ranges): Document which CU we use when.
+ * libdw.h (dwarf_attr_integrate): Extend documentation.
+
2020-04-25 Mark Wielaard <mark@klomp.org>
* libdw_alloc.c (__libdw_alloc_tail): Call Dwarf oom_handler()
}
/* Get the array of source files for the CU. */
- struct Dwarf_CU *cu = die->cu;
+ struct Dwarf_CU *cu = attr_mem.cu;
if (cu->lines == NULL)
{
Dwarf_Lines *lines;
Dwarf_Attribute attr_mem;
Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_ranges,
&attr_mem);
+ /* Note that above we use dwarf_attr, not dwarf_attr_integrate.
+ The only case where the ranges can come from another DIE
+ attribute are the split CU case. In that case we also have a
+ different CU to check against. But that is already set up
+ above using __libdw_find_split_unit. */
if (attr == NULL
&& is_cudie (die)
&& die->cu->unit_type == DW_UT_split_compile)
extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name);
/* These are the same as dwarf_attr and dwarf_hasattr, respectively,
- but they resolve an indirect attribute through DW_AT_abstract_origin. */
+ but they resolve an indirect attribute through
+ DW_AT_abstract_origin, DW_AT_specification or, if the DIE is a
+ top-level split CU, the skeleton DIE. Note that the attribute
+ might come from a DIE in a different CU (possibly from a different
+ Dwarf file). In that case all attribute information needs to be
+ resolved through the CU associated with the returned
+ Dwarf_Attribute. The dwarf_form functions already do this
+ automatically. */
extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die,
unsigned int search_name,
Dwarf_Attribute *result)
+2020-05-05 Mark Wielaard <mark@klomp.org>
+
+ * testfile-lto-gcc10.bz2: New test file.
+ * Makefile.am (EXTRA_DIST): Add testfile-lto-gcc10.bz2.
+ * run-allfcts.sh: Add testfile-lto-gcc10 test.
+
2020-04-17 Mark Wielaard <mark@klomp.org>
* test-subr.sh (testrun_on_self_obj): New function.
testfile9.bz2 testfile10.bz2 testfile11.bz2 testfile12.bz2 \
testfile13.bz2 run-strip-test3.sh run-allfcts.sh \
testfile_class_func.bz2 testfile_nested_funcs.bz2 \
+ testfile-lto-gcc10.bz2 \
run-line2addr.sh run-elflint-test.sh testfile14.bz2 \
run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \
/home/mark/src/tests/nested/class_func.cxx:13:main
EOF
+# = testfile-lto.h =
+# struct t
+# {
+# int *p;
+# int c;
+# };
+#
+# extern int foo (int i, struct t *t);
+
+# = testfile-lto-func.c =
+# #include "testfile-lto.h"
+#
+# int
+# foo (int i, struct t *t)
+# {
+# int j, res = 0;
+# for (j = 0; j < i && j < t->c; j++)
+# res += t->p[j];
+#
+# return res;
+# }
+
+# = testfile-lto-main.c =
+# #include "testfile-lto.h"
+#
+# static struct t g;
+#
+# int
+# main (int argc, char **argv)
+# {
+# int i;
+# int j[argc];
+# g.c = argc;
+# g.p = j;
+# for (i = 0; i < argc; i++)
+# j[i] = (int) argv[i][0];
+# return foo (3, &g);
+# }
+
+# Using gcc (GCC) 10.0.1 20200430 (Red Hat 10.0.1-0.13)
+# gcc -g -O2 -flto -c testfile-lto-func.c
+# gcc -g -O2 -flto -c testfile-lto-main.c
+# gcc -g -O2 -flto -o testfile-lto-gcc10 testfile-lto-func.o testfile-lto-main.o
+
+testfiles testfile-lto-gcc10
+
+testrun_compare ${abs_builddir}/allfcts testfile-lto-gcc10 <<\EOF
+/home/mark/src/tests/testfile-lto-main.c:6:main
+/home/mark/src/tests/testfile-lto-func.c:4:foo
+/home/mark/src/tests/testfile-lto-main.c:6:main
+EOF
+
exit 0