From 0a44bb870e90623689cae484f8a8899706480876 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Sun, 3 Jan 2021 11:18:39 +0100 Subject: [PATCH] Add line debug info for virtual thunks There is no full debug info since the DECL_IGNORED_P flag is set on virtual thunks. But instead of no line info at all, emit at least the location of the function decl. 2021-01-03 Bernd Edlinger PR ipa/97937 * final.c (final_start_function_1): Always emit function start line information for dwarf2 debug. (final_end_function): Always call end_function for dwarf2 debug. * varasm.c (assemble_start_function): Always call begin_function for dwarf2 debug. --- gcc/final.c | 9 +++++++-- gcc/varasm.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/final.c b/gcc/final.c index fc9a05e..5a274c1 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1735,7 +1735,12 @@ final_start_function_1 (rtx_insn **firstp, FILE *file, int *seen, last_filename); if (!dwarf2_debug_info_emitted_p (current_function_decl)) - dwarf2out_begin_prologue (0, 0, NULL); + { + if (write_symbols == DWARF2_DEBUG) + dwarf2out_begin_prologue (last_linenum, last_columnnum, last_filename); + else + dwarf2out_begin_prologue (0, 0, NULL); + } #ifdef LEAF_REG_REMAP if (crtl->uses_only_leaf_regs) @@ -1879,7 +1884,7 @@ final_end_function (void) { app_disable (); - if (!DECL_IGNORED_P (current_function_decl)) + if (!DECL_IGNORED_P (current_function_decl) || write_symbols == DWARF2_DEBUG) debug_hooks->end_function (high_function_linenum); /* Finally, output the function epilogue: diff --git a/gcc/varasm.c b/gcc/varasm.c index ce5d449..513922d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1930,7 +1930,7 @@ assemble_start_function (tree decl, const char *fnname) ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname); #endif - if (!DECL_IGNORED_P (decl)) + if (!DECL_IGNORED_P (decl) || write_symbols == DWARF2_DEBUG) (*debug_hooks->begin_function) (decl); /* Make function name accessible from other files, if appropriate. */ -- 1.9.1