On 15/01/2021 11:43, Andrew Stubbs wrote:
This patch corrects a problem in which GDB ignores the debug info for offload kernel entry functions because they're represented as nested functions inside a function that does not exist on the accelerator device (only on the host).

Apparently I had a bug in this patch that only showed up after another clean build (not sure what was different).

This patch fixes it. Apparently the flag_generate_offload was wrong.

Committed to OG10. I will squash the two patches when they go to mainline.

Andrew
Correct fix offload dwarf info

The previous patch wasn't quite right, apparently.  Somehow the behaviour
changed after another clean build?  This tweak fixes it.

This patch should be squashed with fdcb23540a2 to go to mainline.

gcc/ChangeLog:

	* dwarf2out.c (gen_subprogram_die): Check offload attributes only.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index dedfeaf865f..61d8a3f574c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -23094,9 +23094,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
 		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))
+	     if (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))

Reply via email to