public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-10] Fix offload dwarf info
@ 2021-01-15 11:33 Andrew Stubbs
  0 siblings, 0 replies; only message in thread
From: Andrew Stubbs @ 2021-01-15 11:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fdcb23540a2ed663bfca7e81164692aa0661b6d3

commit fdcb23540a2ed663bfca7e81164692aa0661b6d3
Author: Andrew Stubbs <ams@codesourcery.com>
Date:   Sun Dec 6 19:23:55 2020 +0000

    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.c (gen_subprogram_die): Add high/low_pc attributes for
            parents of offload kernels.

Diff:
---
 gcc/dwarf2out.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4d84a9e9607..a4a1b934dc7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -23079,6 +23079,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
 	    {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-15 11:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 11:33 [gcc/devel/omp/gcc-10] Fix offload dwarf info Andrew Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).