aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2020-12-06 19:23:55 +0000
committerKwok Cheung Yeung <kcy@codesourcery.com>2022-06-21 14:11:30 +0100
commit27a14054a8a21b994bb91c624f3306dc24a3888b (patch)
tree04d0d16dc7473f0732d1e75b60715cea4bf90d01 /gcc
parent01bbed294a26942704c0710673b7570e01f84da7 (diff)
downloadgcc-27a14054a8a21b994bb91c624f3306dc24a3888b.zip
gcc-27a14054a8a21b994bb91c624f3306dc24a3888b.tar.gz
gcc-27a14054a8a21b994bb91c624f3306dc24a3888b.tar.bz2
Fix offload dwarf info
Add a notional code range to the notional parent function of offload kernel functions. This is enough to prevent GDB discarding them. gcc/ChangeLog: * dwarf2out.cc (gen_subprogram_die): Add high/low_pc attributes for parents of offload kernels.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.omp5
-rw-r--r--gcc/dwarf2out.cc14
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 444d008..4346ea0 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-12-06 Andrew Stubbs <ams@codesourcery.com>
+
+ * dwarf2out.cc (gen_subprogram_die): Add high/low_pc attributes for
+ parents of offload kernels.
+
2021-01-13 Julian Brown <julian@codesourcery.com>
* doc/tm.texi.in (TARGET_VECTORIZE_PREFER_GATHER_SCATTER): Add
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index d7a3994..dfdc0426 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -23755,6 +23755,20 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
/* We have already generated the labels. */
add_AT_low_high_pc (subr_die, fde->dw_fde_begin,
fde->dw_fde_end, false);
+
+ /* Offload kernel functions are nested within a parent function
+ that doesn't actually exist within the offload object. GDB
+ will ignore the function and everything nested within unless
+ we give it a notional code range (the values aren't
+ important, as long as they are valid). */
+ if (flag_generate_offload
+ && lookup_attribute ("omp target entrypoint",
+ DECL_ATTRIBUTES (decl))
+ && subr_die->die_parent
+ && subr_die->die_parent->die_tag == DW_TAG_subprogram
+ && !get_AT_low_pc (subr_die->die_parent))
+ add_AT_low_high_pc (subr_die->die_parent, fde->dw_fde_begin,
+ fde->dw_fde_end, false);
}
else
{