summaryrefslogtreecommitdiff
path: root/libdw/dwarf_highpc.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-05-19 00:46:02 +0200
committerMark Wielaard <mark@klomp.org>2018-05-23 00:31:22 +0200
commit144b73c49acf3ed894e4635aedb9b0d1208ade2e (patch)
tree53ce2f235c75324b4010c419b5d5fe1a524c09ba /libdw/dwarf_highpc.c
parenta4c74cc67de22cb3208fc768989c509d6837cd77 (diff)
downloadelfutils-144b73c49acf3ed894e4635aedb9b0d1208ade2e.tar.gz
libdw: Handle GNU DebugFission split ranges.
GNU DebugFission split dwarf handles DW_FORM_sec_offset specially for attributes that point to ranges. The .debug_ranges section is not in the .dwo file, but in the main/skeleton object file. The sec_offset is not relocated (in the ELF file), but is an offset against the skeleton DIE DW_AT_GNU_ranges_base attribute. dwarf_formudata is changed so it still looks like a normal offset ptr into the .debug_ranges section. dwarf_ranges is adapted to look for the .debug_ranges in the main object file. dwarf_highpc and dwarf_lowpc now handle the highpc and lowpc attributes being inherited for the split unit DIE from the skeleton. A new testcase is added to iterate over all ranges in a split GNU DebugFission file. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw/dwarf_highpc.c')
-rw-r--r--libdw/dwarf_highpc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libdw/dwarf_highpc.c b/libdw/dwarf_highpc.c
index 20702545..1baffa7e 100644
--- a/libdw/dwarf_highpc.c
+++ b/libdw/dwarf_highpc.c
@@ -1,7 +1,6 @@
/* Return high PC attribute of DIE.
- Copyright (C) 2003, 2005, 2012 Red Hat, Inc.
+ Copyright (C) 2003, 2005, 2012, 2018 Red Hat, Inc.
This file is part of elfutils.
- Written by Ulrich Drepper <drepper@redhat.com>, 2003.
This file is free software; you can redistribute it and/or modify
it under the terms of either
@@ -39,8 +38,14 @@ int
dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
{
Dwarf_Attribute attr_high_mem;
- Dwarf_Attribute *attr_high = INTUSE(dwarf_attr) (die, DW_AT_high_pc,
- &attr_high_mem);
+ Dwarf_Attribute *attr_high;
+ /* Split compile DIEs inherit high_pc from their skeleton DIE. */
+ if (is_cudie (die) && die->cu->unit_type == DW_UT_split_compile)
+ attr_high = INTUSE(dwarf_attr_integrate) (die, DW_AT_high_pc,
+ &attr_high_mem);
+ else
+ attr_high = INTUSE(dwarf_attr) (die, DW_AT_high_pc, &attr_high_mem);
+
if (attr_high == NULL)
return -1;
@@ -48,10 +53,7 @@ dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
return INTUSE(dwarf_formaddr) (attr_high, return_addr);
/* DWARF 4 allows high_pc to be a constant offset from low_pc. */
- Dwarf_Attribute attr_low_mem;
- if (INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_low_pc,
- &attr_low_mem),
- return_addr) == 0)
+ if (INTUSE(dwarf_lowpc) (die, return_addr) == 0)
{
Dwarf_Word uval;
if (INTUSE(dwarf_formudata) (attr_high, &uval) == 0)