]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Allow prologue detection via symbols for Intel compilers.
authorFelix Willgerodt <felix.willgerodt@intel.com>
Thu, 8 Apr 2021 07:16:15 +0000 (09:16 +0200)
committerFelix Willgerodt <felix.willgerodt@intel.com>
Thu, 8 Apr 2021 07:19:57 +0000 (09:19 +0200)
The next-gen Intel Fortran compiler isn't flang-based, but emits
prologue_end in the same manner.  As do the newer Intel C/C++ compilers.
This allows prologue detection based on dwarf for all newer Intel compilers.
The cut-off version was not chosen for any specific reason other than the
effort to test this.

gdb/Changelog:
2021-04-08  Felix Willgerodt  <felix.willgerodt@intel.com>

     * i386-tdep.c (i386_skip_prologue): Use symbol table to find the
     prologue end for Intel compilers.
     * amd64-tdep.c (amd64_skip_prologue): Likewise.
     * producer.c (producer_is_icc_ge_19): New function.
     * producer.h (producer_is_icc_ge_19): New declaration.

gdb/ChangeLog
gdb/amd64-tdep.c
gdb/i386-tdep.c
gdb/producer.c
gdb/producer.h

index 6fc98a74946cb092bd3a7e7db6d3c89a56cd6561..e2fd9122017390d45d7572f28a5e33467b14f426 100644 (file)
@@ -1,3 +1,11 @@
+2021-04-08  Felix Willgerodt  <felix.willgerodt@intel.com>
+
+       * i386-tdep.c (i386_skip_prologue): Use symbol table to find the
+       prologue end for Intel compilers.
+       * amd64-tdep.c (amd64_skip_prologue): Likewise.
+       * producer.c (producer_is_icc_ge_19): New function.
+       * producer.h (producer_is_icc_ge_19): New declaration.
+
 2021-04-08  Felix Willgerodt  <felix.willgerodt@intel.com>
 
        * producer.c: (producer_is_icc): Update for new version scheme.
index 47d00634ed858b396b133bd2a4bdbf043747a1ca..66a7c02f53403a608122d677f5bd14aeb8df74ee 100644 (file)
@@ -2527,13 +2527,14 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
       struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
 
       /* LLVM backend (Clang/Flang) always emits a line note before the
-        prologue and another one after.  We trust clang to emit usable
-        line notes.  */
+        prologue and another one after.  We trust clang and newer Intel
+        compilers to emit usable line notes.  */
       if (post_prologue_pc
          && (cust != NULL
              && COMPUNIT_PRODUCER (cust) != NULL
-             && producer_is_llvm (COMPUNIT_PRODUCER (cust))))
-       return std::max (start_pc, post_prologue_pc);
+             && (producer_is_llvm (COMPUNIT_PRODUCER (cust))
+             || producer_is_icc_ge_19 (COMPUNIT_PRODUCER (cust)))))
+        return std::max (start_pc, post_prologue_pc);
     }
 
   amd64_init_frame_cache (&cache);
index 2649fad08f201404a582ff49db57d9e5d209a581..50fd2767a18292a0dbc21222c8929c768acb835e 100644 (file)
@@ -1847,13 +1847,14 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
       struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
 
       /* LLVM backend (Clang/Flang) always emits a line note before the
-        prologue and another one after.  We trust clang to emit usable
-        line notes.  */
+        prologue and another one after.  We trust clang and newer Intel
+        compilers to emit usable line notes.  */
       if (post_prologue_pc
          && (cust != NULL
              && COMPUNIT_PRODUCER (cust) != NULL
-             && producer_is_llvm (COMPUNIT_PRODUCER (cust))))
-       return std::max (start_pc, post_prologue_pc);
+             && (producer_is_llvm (COMPUNIT_PRODUCER (cust))
+             || producer_is_icc_ge_19 (COMPUNIT_PRODUCER (cust)))))
+        return std::max (start_pc, post_prologue_pc);
     }
  
   cache.locals = -1;
index 1cda48c204ac99be312dbead0c20fa57aba4de01..591509fa85c18e62c6b8360b0eac42e15480817a 100644 (file)
@@ -73,6 +73,18 @@ producer_is_gcc (const char *producer, int *major, int *minor)
   return 0;
 }
 
+/* See producer.h.  */
+
+bool
+producer_is_icc_ge_19 (const char *producer)
+{
+  int major, minor;
+
+  if (! producer_is_icc (producer, &major, &minor))
+    return false;
+
+  return major >= 19;
+}
 
 /* See producer.h.  */
 
index 9cfccd633713c598e48290d7e0a5be1deebd6872..d08062e3e6d00f08b8e9d174621da9d9dc731899 100644 (file)
@@ -30,6 +30,9 @@ extern int producer_is_gcc_ge_4 (const char *producer);
    is NULL or it isn't GCC.  */
 extern int producer_is_gcc (const char *producer, int *major, int *minor);
 
+/* Check for Intel compilers >= 19.0.  */
+extern bool producer_is_icc_ge_19 (const char *producer);
+
 /* Returns true if the given PRODUCER string is Intel or false
    otherwise.  Sets the MAJOR and MINOR versions when not NULL.  */
 extern bool producer_is_icc (const char *producer, int *major, int *minor);