aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2017-02-21 13:32:55 -0800
committerSergio Durigan Junior <sergiodj@redhat.com>2017-08-23 11:15:03 -0400
commite68c32d53e44ac0fe9f48637c0113da42b62644a (patch)
treeac71155c327ab46a5bb437684ecb894fbe736b46 /gdb/compile
parentf6a36b0c9e537e4525f3b0687a4f76b4f77bf173 (diff)
downloadgdb-e68c32d53e44ac0fe9f48637c0113da42b62644a.zip
gdb-e68c32d53e44ac0fe9f48637c0113da42b62644a.tar.gz
gdb-e68c32d53e44ac0fe9f48637c0113da42b62644a.tar.bz2
compile: set debug compile: Display GCC driver filename
As discussed in How to use compile & execute function in GDB https://sourceware.org/ml/gdb/2015-04/msg00026.html GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and chooses a match from there. However, it is not currently possible for the user to display which compiler was selected. Up until now, GDB's compiler interface was not up-to-date with GCC's one, which means that it wasn't possible to obtain this information. This patch implements the mechanisms necessary for that. gdb/ChangeLog 2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com> * compile/compile.c (compile_to_object): Conditionally call set_verbose. Conditionally call compile or compile_v0. include/ChangeLog 2017-08-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 compile to compile_v0. Update comment for compile. New methods set_verbose and compile.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 91e084f..36baab3 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -516,6 +516,9 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
get_args (compiler, gdbarch, &argc, &argv);
gdb_argv argv_holder (argv);
+ if (compiler->fe->ops->version >= GCC_FE_VERSION_1)
+ compiler->fe->ops->set_verbose (compiler->fe, compile_debug);
+
error_message = compiler->fe->ops->set_arguments (compiler->fe, triplet_rx,
argc, argv);
if (error_message != NULL)
@@ -556,8 +559,12 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
/* Call the compiler and start the compilation process. */
compiler->fe->ops->set_source_file (compiler->fe, fnames.source_file ());
- if (!compiler->fe->ops->compile (compiler->fe, fnames.object_file (),
- compile_debug))
+ if (compiler->fe->ops->version >= GCC_FE_VERSION_1)
+ ok = compiler->fe->ops->compile (compiler->fe, fnames.object_file ());
+ else
+ ok = compiler->fe->ops->compile_v0 (compiler->fe, fnames.object_file (),
+ compile_debug);
+ if (!ok)
error (_("Compilation failed."));
if (compile_debug)