From patchwork Tue Apr 21 21:36:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 6375 Received: (qmail 127179 invoked by alias); 21 Apr 2015 21:36:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 127167 invoked by uid 89); 21 Apr 2015 21:36:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 21 Apr 2015 21:36:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3LLaqj4023665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 21 Apr 2015 17:36:52 -0400 Received: from host1.jankratochvil.net (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3LLao4S002452; Tue, 21 Apr 2015 17:36:50 -0400 Subject: [PATCH 3/4] compile: set debug compile: Display GCC driver filename From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Phil Muldoon Date: Tue, 21 Apr 2015 23:36:49 +0200 Message-ID: <20150421213649.14147.79719.stgit@host1.jankratochvil.net> In-Reply-To: <20150421213635.14147.15653.stgit@host1.jankratochvil.net> References: <20150421213635.14147.15653.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes Hi, 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. Unfortunately this changes libcc1 API in an incompatible way. There is a possibility of a hack to keep the API the same - one could pass "-v" option explicitly to set_arguments(), set_arguments() could compare the "-v" string and print the GCC filename accordingly. Then the 'verbose' parameter of compile() would lose its meaning. But I will see what GCC upstream says. Jan gdb/ChangeLog 2015-04-21 Jan Kratochvil * compile/compile.c (compile_to_object): Pass compile_debug to GCC's set_arguments instead of compile. include/ChangeLog 2015-04-21 Jan Kratochvil * gcc-interface.h (enum gcc_base_api_version): Add comment to GCC_FE_VERSION_1. (struct gcc_base_vtable): Move parameter verbose from compile to set_arguments. --- gdb/compile/compile.c | 5 ++--- include/gcc-interface.h | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 90cfc36..c53d15d 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -493,7 +493,7 @@ compile_to_object (struct command_line *cmd, char *cmd_string, make_cleanup_freeargv (argv); error_message = compiler->fe->ops->set_arguments (compiler->fe, triplet_rx, - argc, argv); + argc, argv, compile_debug); if (error_message != NULL) { make_cleanup (xfree, error_message); @@ -529,8 +529,7 @@ compile_to_object (struct command_line *cmd, char *cmd_string, /* Call the compiler and start the compilation process. */ compiler->fe->ops->set_source_file (compiler->fe, source_file); - if (!compiler->fe->ops->compile (compiler->fe, object_file, - compile_debug)) + if (!compiler->fe->ops->compile (compiler->fe, object_file)) error (_("Compilation failed.")); if (compile_debug) diff --git a/include/gcc-interface.h b/include/gcc-interface.h index 1b33e7d..598fd88 100644 --- a/include/gcc-interface.h +++ b/include/gcc-interface.h @@ -45,6 +45,8 @@ struct gcc_base_context; enum gcc_base_api_version { GCC_FE_VERSION_0 = 0, + + /* Parameter verbose has been moved from compile to set_arguments. */ GCC_FE_VERSION_1 = 1, }; @@ -71,14 +73,15 @@ struct gcc_base_vtable 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. + 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. */ char *(*set_arguments) (struct gcc_base_context *self, const char *triplet_regexp, - int argc, char **argv); + int argc, char **argv, int /* bool */ verbose); /* Set the file name of the program to compile. The string is copied by the method implementation, but the caller must @@ -95,13 +98,10 @@ 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. Returns true on success, false on error. */ int /* bool */ (*compile) (struct gcc_base_context *self, - const char *filename, - int /* bool */ verbose); + const char *filename); /* Destroy this object. */