aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorFelix Willgerodt <felix.willgerodt@intel.com>2021-04-08 09:16:15 +0200
committerFelix Willgerodt <felix.willgerodt@intel.com>2021-04-08 09:19:57 +0200
commit16e311ab6d4d379da18ad03bc5373f621f488f41 (patch)
treeafa98eda1ca8835ff0f8181b360777be8fab8451 /gdb
parentfbb3bcfcd8810ecf25a47e71c2f7d46d7a74a6be (diff)
downloadfsf-binutils-gdb-16e311ab6d4d379da18ad03bc5373f621f488f41.zip
fsf-binutils-gdb-16e311ab6d4d379da18ad03bc5373f621f488f41.tar.gz
fsf-binutils-gdb-16e311ab6d4d379da18ad03bc5373f621f488f41.tar.bz2
gdb: Allow prologue detection via symbols for Intel compilers.
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/amd64-tdep.c9
-rw-r--r--gdb/i386-tdep.c9
-rw-r--r--gdb/producer.c12
-rw-r--r--gdb/producer.h3
5 files changed, 33 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6fc98a7..e2fd912 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
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.
(producer_parsing_tests): Update names and expected results.
* producer.h: (producer_is_icc): Update comment accordingly.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 47d0063..66a7c02 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -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);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 2649fad..50fd276 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -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;
diff --git a/gdb/producer.c b/gdb/producer.c
index 1cda48c..591509f 100644
--- a/gdb/producer.c
+++ b/gdb/producer.c
@@ -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. */
diff --git a/gdb/producer.h b/gdb/producer.h
index 9cfccd6..d08062e 100644
--- a/gdb/producer.h
+++ b/gdb/producer.h
@@ -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);