summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2015-02-03 18:20:49 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2015-02-03 18:20:49 +0100
commitc8b16901e05a15e018394ecefe7348c94b43a4f8 (patch)
treef135c82381c7b7645d7540790e5da0e2aa36a110
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-c8b16901e05a15e018394ecefe7348c94b43a4f8.tar.gz
binutils-gdb-c8b16901e05a15e018394ecefe7348c94b43a4f8.tar.bz2
binutils-gdb-c8b16901e05a15e018394ecefe7348c94b43a4f8.zip
compile: Filter out -fpreprocessed
With global system gcc-5.0 if one also installs ccache (needing a different patch https://bugzilla.samba.org/show_bug.cgi?id=11060 for -fplugin=libcc1plugin) it breaks as GDB will read from inferior DW_AT_producer containing -fpreprocessed (due to ccache used to compile the inferior). <c> DW_AT_producer : (indirect string, offset: 0x52): GNU C11 5.0.0 20150114 (Red Hat 5.0.0-0.1) -fpreprocessed -mtune=generic - march=x86-64 -g It is wrong that gcc puts -fpreprocessed into DW_AT_producer - fixed it in trunk GCCs: https://gcc.gnu.org/ml/gcc-patches/2015-01/msg01495.html But even with that fix there are already built inferiors out there which GDB could be compatible (for the 'compile' mode) with. gdb/ChangeLog 2015-02-03 Jan Kratochvil <jan.kratochvil@redhat.com> Filter out inferior gcc option -fpreprocessed. * compile/compile.c (filter_args): New function. (get_args): Use it.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/compile/compile.c22
2 files changed, 28 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d40e1e0e244..5cca93ef982 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Filter out inferior gcc option -fpreprocessed.
+ * compile/compile.c (filter_args): New function.
+ (get_args): Use it.
+
2015-02-02 Joel Brobecker <brobecker@adacore.com>
PR gdb/17856:
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 70b6d44cd20..c204a135ef2 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -324,6 +324,27 @@ get_selected_pc_producer_options (void)
return cs;
}
+/* Filter out unwanted options from *ARGCP and ARGV. */
+
+static void
+filter_args (int *argcp, char **argv)
+{
+ char **destv;
+
+ for (destv = argv; *argv != NULL; argv++)
+ {
+ /* -fpreprocessed may get in commonly from ccache. */
+ if (strcmp (*argv, "-fpreprocessed") == 0)
+ {
+ xfree (*argv);
+ (*argcp)--;
+ continue;
+ }
+ *destv++ = *argv;
+ }
+ *destv = NULL;
+}
+
/* Produce final vector of GCC compilation options. First element is target
size ("-m64", "-m32" etc.), optionally followed by DW_AT_producer options
and then compile-args string GDB variable. */
@@ -346,6 +367,7 @@ get_args (const struct compile_instance *compiler, struct gdbarch *gdbarch,
char **argv_producer;
build_argc_argv (cs_producer_options, &argc_producer, &argv_producer);
+ filter_args (&argc_producer, argv_producer);
append_args (argcp, argvp, argc_producer, argv_producer);
freeargv (argv_producer);
}