summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_lowpc.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-19 00:46:02 +0200
committerMark Wielaard <[email protected]>2018-05-23 00:31:22 +0200
commit144b73c49acf3ed894e4635aedb9b0d1208ade2e (patch)
tree53ce2f235c75324b4010c419b5d5fe1a524c09ba /libdw/dwarf_lowpc.c
parenta4c74cc67de22cb3208fc768989c509d6837cd77 (diff)
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 <[email protected]>
Diffstat (limited to 'libdw/dwarf_lowpc.c')
-rw-r--r--libdw/dwarf_lowpc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libdw/dwarf_lowpc.c b/libdw/dwarf_lowpc.c
index b3be2b0e..4d743a72 100644
--- a/libdw/dwarf_lowpc.c
+++ b/libdw/dwarf_lowpc.c
@@ -1,7 +1,6 @@
/* Return low PC attribute of DIE.
- Copyright (C) 2003, 2005 Red Hat, Inc.
+ Copyright (C) 2003, 2005, 2018 Red Hat, Inc.
This file is part of elfutils.
- Written by Ulrich Drepper <[email protected]>, 2003.
This file is free software; you can redistribute it and/or modify
it under the terms of either
@@ -38,10 +37,12 @@
int
dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
{
- Dwarf_Attribute attr_mem;
-
- return INTUSE(dwarf_formaddr) (INTUSE(dwarf_attr) (die, DW_AT_low_pc,
- &attr_mem),
- return_addr);
+ Dwarf_Attribute attr_mem, *attr;
+ /* Split compile DIEs inherit low_pc from their skeleton DIE. */
+ if (is_cudie (die) && die->cu->unit_type == DW_UT_split_compile)
+ attr = INTUSE(dwarf_attr_integrate) (die, DW_AT_low_pc, &attr_mem);
+ else
+ attr = INTUSE(dwarf_attr) (die, DW_AT_low_pc, &attr_mem);
+ return INTUSE(dwarf_formaddr) (attr, return_addr);
}
INTDEF(dwarf_lowpc)