From c2fd7faea8f2c3a267f276ceb6a95f9f537ea7c1 Mon Sep 17 00:00:00 2001 From: Alok Kumar Sharma Date: Thu, 20 Aug 2020 10:35:27 +0530 Subject: Fix for incorrect breakpoint set in case of flang compiled binary Currently, GDB is not able to set a breakpoint at subprogram post prologue for flang generated binaries. This is due to clang having two line notes one before and another after the prologue. Now the end of prologue is determined using symbol table, which was the way for clang generated binaries already. Since clang and flang both share same back-end it is true for flang as well. gdb/ChangeLog * amd64-tdep.c (amd64_skip_prologue): Using symbol table to find the end of prologue for flang compiled binaries. * arm-tdep.c (arm_skip_prologue): Likewise. * i386-tdep.c (i386_skip_prologue): Likewise. * producer.c (producer_is_llvm): New function. (producer_parsing_tests): Added new tests for clang/flang. * producer.h (producer_is_llvm): New declaration. gdb/testsuite/ChangeLog * gdb.fortran/vla-type.exp: Skip commands not required for the Flang compiled binaries after prologue fix. --- gdb/i386-tdep.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gdb/i386-tdep.c') diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 9b905c1..d9fa2b9 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -65,6 +65,7 @@ #include #include #include +#include "producer.h" /* Register names. */ @@ -1847,12 +1848,13 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) = skip_prologue_using_sal (gdbarch, func_addr); struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr); - /* Clang always emits a line note before the prologue and another - one after. We trust clang to emit usable line notes. */ + /* LLVM backend (Clang/Flang) always emits a line note before the + prologue and another one after. We trust clang to emit usable + line notes. */ if (post_prologue_pc && (cust != NULL && COMPUNIT_PRODUCER (cust) != NULL - && startswith (COMPUNIT_PRODUCER (cust), "clang "))) + && producer_is_llvm (COMPUNIT_PRODUCER (cust)))) return std::max (start_pc, post_prologue_pc); } -- cgit v1.1