Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patchv2+7.9] compile: Filter out -fpreprocessed
Date: Sat, 17 Jan 2015 10:02:00 -0000	[thread overview]
Message-ID: <20150117100222.GA19319@host2.jankratochvil.net> (raw)
In-Reply-To: <20150116224234.GA6176@host2.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 85 bytes --]

Hi,

fix-up, I forgot in C one had to free() (or xfree()) some of the strings.


Jan

[-- Attachment #2: filter2.patch --]
[-- Type: text/plain, Size: 1395 bytes --]

gdb/ChangeLog
2015-01-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Filter out inferior gcc option -fpreprocessed.
	* compile/compile.c (filter_args): New function.
	(get_args): Use it.

diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index ccac49d..6cd401d 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);
     }

  reply	other threads:[~2015-01-17 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 22:42 [patch+7.9] " Jan Kratochvil
2015-01-17 10:02 ` Jan Kratochvil [this message]
2015-02-03  7:56   ` [patchv2+7.9] " Joel Brobecker
2015-02-03 17:25     ` [commit+7.9] " Jan Kratochvil
2015-02-03 18:50 ` [patch+7.9] " Doug Evans
2015-02-03 18:59   ` Jan Kratochvil
2015-02-03 19:10     ` Mark Wielaard
2015-02-04 18:15       ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150117100222.GA19319@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox