From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Phil Muldoon <pmuldoon@redhat.com>
Subject: [PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
Date: Thu, 23 Apr 2015 20:34:00 -0000 [thread overview]
Message-ID: <20150423203402.23140.92757.stgit@host1.jankratochvil.net> (raw)
Hi,
in the mail thread
https://sourceware.org/ml/gdb-patches/2015-04/msg00804.html
the idea of breaking libcc1.so compatibility was rejected.
Therefore this patch series implements full backward/forward GCC/GDB ABI
compatibility.
As discussed in
How to use compile & execute function in GDB
https://sourceware.org/ml/gdb/2015-04/msg00026.html
GDB currently searches for /usr/bin/ARCH-OS-gcc and chooses one but it does not
display which one. It cannot, GCC method set_arguments() does not yet know
whether 'set debug compile' is enabled or not.
Jan
gdb/ChangeLog
2015-04-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile.c (compile_to_object): Conditionally pass
compile_debug to GCC's set_arguments.
include/ChangeLog
2015-04-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1.
(struct gcc_base_vtable): Rename set_arguments to set_arguments_v0.
Update comment for compile. New method set_arguments.
---
gdb/compile/compile.c | 10 ++++++++--
include/gcc-interface.h | 48 ++++++++++++++++++++++++++++++-----------------
2 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 90cfc36..7f4c11d 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -492,8 +492,14 @@ compile_to_object (struct command_line *cmd, char *cmd_string,
get_args (compiler, gdbarch, &argc, &argv);
make_cleanup_freeargv (argv);
- error_message = compiler->fe->ops->set_arguments (compiler->fe, triplet_rx,
- argc, argv);
+ if (compiler->fe->ops->version >= GCC_FE_VERSION_1)
+ error_message = compiler->fe->ops->set_arguments (compiler->fe, triplet_rx,
+ argc, argv,
+ compile_debug);
+ else
+ error_message = compiler->fe->ops->set_arguments_v0 (compiler->fe,
+ triplet_rx, argc,
+ argv);
if (error_message != NULL)
{
make_cleanup (xfree, error_message);
diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index df7db6e..c11b7a1 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -44,7 +44,10 @@ struct gcc_base_context;
enum gcc_base_api_version
{
- GCC_FE_VERSION_0 = 0
+ GCC_FE_VERSION_0 = 0,
+
+ /* Parameter verbose has been moved from compile to set_arguments. */
+ GCC_FE_VERSION_1 = 1,
};
/* The operations defined by the GCC base API. This is the vtable for
@@ -64,20 +67,13 @@ struct gcc_base_vtable
unsigned int version;
- /* Set the compiler's command-line options for the next compilation.
- TRIPLET_REGEXP is a regular expression that is used to match the
- configury triplet prefix to the compiler.
- The arguments are copied by GCC. ARGV need not be
- NULL-terminated. The arguments must be set separately for each
- compilation; that is, after a compile is requested, the
- previously-set arguments cannot be reused.
-
- This returns NULL on success. On failure, returns a malloc()d
- error message. The caller is responsible for freeing it. */
+ /* Deprecated GCC_FE_VERSION_0 variant of the GCC_FE_VERSION_1
+ set_arguments method. GCC_FE_VERSION_0 version did not have the
+ verbose parameter. */
- char *(*set_arguments) (struct gcc_base_context *self,
- const char *triplet_regexp,
- int argc, char **argv);
+ char *(*set_arguments_v0) (struct gcc_base_context *self,
+ const char *triplet_regexp,
+ int argc, char **argv);
/* Set the file name of the program to compile. The string is
copied by the method implementation, but the caller must
@@ -94,9 +90,9 @@ struct gcc_base_vtable
void *datum);
/* Perform the compilation. FILENAME is the name of the resulting
- object file. VERBOSE can be set to cause GCC to print some
- information as it works. Returns true on success, false on
- error. */
+ object file. VERBOSE should be the same value as passed
+ to gcc_base_vtable::set_arguments. Returns true on success, false
+ on error. */
int /* bool */ (*compile) (struct gcc_base_context *self,
const char *filename,
@@ -105,6 +101,24 @@ struct gcc_base_vtable
/* Destroy this object. */
void (*destroy) (struct gcc_base_context *self);
+
+ /* Set the compiler's command-line options for the next compilation.
+ TRIPLET_REGEXP is a regular expression that is used to match the
+ configury triplet prefix to the compiler.
+ The arguments are copied by GCC. ARGV need not be
+ NULL-terminated. The arguments must be set separately for each
+ compilation; that is, after a compile is requested, the
+ previously-set arguments cannot be reused. VERBOSE can be set
+ to cause GCC to print some information as it works.
+
+ This returns NULL on success. On failure, returns a malloc()d
+ error message. The caller is responsible for freeing it.
+
+ This method is only available since GCC_FE_VERSION_1. */
+
+ char *(*set_arguments) (struct gcc_base_context *self,
+ const char *triplet_regexp,
+ int argc, char **argv, int /* bool */ verbose);
};
/* The GCC object. */
next reply other threads:[~2015-04-23 20:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 20:34 Jan Kratochvil [this message]
2015-04-23 20:34 ` [PATCH v2 2/2] compile: Add 'set compile-gcc' Jan Kratochvil
2015-04-23 21:08 ` [PATCH v3 " Jan Kratochvil
2015-04-27 15:47 ` Pedro Alves
2015-04-27 17:54 ` Jan Kratochvil
2015-04-27 19:55 ` Pedro Alves
2015-04-27 15:31 ` [PATCH v2 1/2] compile: set debug compile: Display GCC driver filename Pedro Alves
2015-04-27 16:48 ` Jan Kratochvil
2015-04-27 17:19 ` Pedro Alves
2015-04-27 17:52 ` Jan Kratochvil
2015-04-27 19:17 ` Pedro Alves
2015-04-27 20:44 ` Jan Kratochvil
2015-04-27 20:50 ` Jan Kratochvil
2015-04-27 21:49 ` Phil Muldoon
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=20150423203402.23140.92757.stgit@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.com \
/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