public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0
@ 2015-04-21 21:36 Jan Kratochvil
  2015-04-21 21:36 ` [PATCH 3/4] compile: set debug compile: Display GCC driver filename Jan Kratochvil
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

Hi,

the next [patch 3/4] will change the libcc1.so API.  I am not sure if it gets
approved in GCC land but for such case:
(1) We really need to change GCC_FE_VERSION_0 -> GCC_FE_VERSION_1, this
    feature is there for this purpose.  That is [patch 2/4].
(2) Currently GDB does only dlopen("libcc1.so") and then depending on which
    libcc1.so version it would find first it would succeed/fail.
    I guess it is more convenient to do dlopen("libcc1.so.1") instead
    (where ".1"=".x" corresponds to GCC_FE_VERSION_x).
    That is this patch (with x=0).
(3) Currently there is no backward or forward compatibility although there
    could be one implemented.  Personally I think the 'compile' feature is
    still in experimental stage so that it is OK to require last releases.
    At least in Fedora we can keep GDB<->GCC in sync.

include/* changes are here only FYI, master repository of those files is GCC.

Corresponding GCC part of the patches are going to be sent along to GCC.


Jan


gdb/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* compile/compile-c-support.c (load_libcc): Remove STRINGIFY from
	GCC_C_FE_LIBCC.

include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-c-interface.h (GCC_C_FE_LIBCC): Quote it.  Append
	GCC_FE_VERSION_0.
---
 gdb/compile/compile-c-support.c |    4 ++--
 include/gcc-c-interface.h       |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 1711cda..e3c01f2 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -79,14 +79,14 @@ load_libcc (void)
 
    /* gdb_dlopen will call error () on an error, so no need to check
       value.  */
-  handle = gdb_dlopen (STRINGIFY (GCC_C_FE_LIBCC));
+  handle = gdb_dlopen (GCC_C_FE_LIBCC);
   func = (gcc_c_fe_context_function *) gdb_dlsym (handle,
 						  STRINGIFY (GCC_C_FE_CONTEXT));
 
   if (func == NULL)
     error (_("could not find symbol %s in library %s"),
 	   STRINGIFY (GCC_C_FE_CONTEXT),
-	   STRINGIFY (GCC_C_FE_LIBCC));
+	   GCC_C_FE_LIBCC);
   return func;
 }
 
diff --git a/include/gcc-c-interface.h b/include/gcc-c-interface.h
index 95d0fc9..7108952 100644
--- a/include/gcc-c-interface.h
+++ b/include/gcc-c-interface.h
@@ -197,7 +197,7 @@ struct gcc_c_context
 /* The name of the .so that the compiler builds.  We dlopen this
    later.  */
 
-#define GCC_C_FE_LIBCC libcc1.so
+#define GCC_C_FE_LIBCC "libcc1.so." STRINGIFY (GCC_FE_VERSION_0)
 
 /* The compiler exports a single initialization function.  This macro
    holds its name as a symbol.  */

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/4] compile: set debug compile: Display GCC driver filename
  2015-04-21 21:36 [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
@ 2015-04-21 21:36 ` Jan Kratochvil
  2015-04-23 20:40   ` cancel: " Jan Kratochvil
  2015-04-21 21:36 ` [PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

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  <jan.kratochvil@redhat.com>

	* compile/compile.c (compile_to_object): Pass compile_debug to GCC's
	set_arguments instead of compile.

include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* 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.  */
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1
  2015-04-21 21:36 [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
  2015-04-21 21:36 ` [PATCH 3/4] compile: set debug compile: Display GCC driver filename Jan Kratochvil
@ 2015-04-21 21:36 ` Jan Kratochvil
  2015-04-23 20:40   ` cancel: " Jan Kratochvil
  2015-04-21 21:37 ` [PATCH 4/4] compile: Add 'set compile-gcc' Jan Kratochvil
  2015-04-23 20:40 ` cancel: [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
  3 siblings, 1 reply; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

Hi,

see [patch 1/4], particularly:
(3) Currently there is no backward or forward compatibility although there
    could be one implemented.  Personally I think the 'compile' feature is
    still in experimental stage so that it is OK to require last releases.
    At least in Fedora we can keep GDB<->GCC in sync.

include/* changes are here only FYI, master repository of those files is GCC.


Jan


gdb/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* compile/compile-c-support.c (c_get_compile_context): Use
	GCC_FE_VERSION_1.

include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-c-interface.h (GCC_C_FE_LIBCC): Update it to GCC_FE_VERSION_1.
	* gcc-interface.h (enum gcc_base_api_version): Add GCC_FE_VERSION_1.
---
 gdb/compile/compile-c-support.c |    2 +-
 include/gcc-c-interface.h       |    2 +-
 include/gcc-interface.h         |    3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index e3c01f2..b09e1bf 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -107,7 +107,7 @@ c_get_compile_context (void)
       gdb_assert (func != NULL);
     }
 
-  context = (*func) (GCC_FE_VERSION_0, GCC_C_FE_VERSION_0);
+  context = (*func) (GCC_FE_VERSION_1, GCC_C_FE_VERSION_0);
   if (context == NULL)
     error (_("The loaded version of GCC does not support the required version "
 	     "of the API."));
diff --git a/include/gcc-c-interface.h b/include/gcc-c-interface.h
index 7108952..0eff259 100644
--- a/include/gcc-c-interface.h
+++ b/include/gcc-c-interface.h
@@ -197,7 +197,7 @@ struct gcc_c_context
 /* The name of the .so that the compiler builds.  We dlopen this
    later.  */
 
-#define GCC_C_FE_LIBCC "libcc1.so." STRINGIFY (GCC_FE_VERSION_0)
+#define GCC_C_FE_LIBCC "libcc1.so." STRINGIFY (GCC_FE_VERSION_1)
 
 /* The compiler exports a single initialization function.  This macro
    holds its name as a symbol.  */
diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index df7db6e..1b33e7d 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -44,7 +44,8 @@ struct gcc_base_context;
 
 enum gcc_base_api_version
 {
-  GCC_FE_VERSION_0 = 0
+  GCC_FE_VERSION_0 = 0,
+  GCC_FE_VERSION_1 = 1,
 };
 
 /* The operations defined by the GCC base API.  This is the vtable for

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/4] compile: Add 'set compile-gcc'
  2015-04-21 21:36 [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
  2015-04-21 21:36 ` [PATCH 3/4] compile: set debug compile: Display GCC driver filename Jan Kratochvil
  2015-04-21 21:36 ` [PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
@ 2015-04-21 21:37 ` Jan Kratochvil
  2015-04-22  7:21   ` Eli Zaretskii
  2015-04-23 20:40   ` cancel: " Jan Kratochvil
  2015-04-23 20:40 ` cancel: [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
  3 siblings, 2 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-21 21:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

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 one cannot
override which one.

This patch does not change the libcc1 API as it overloads the triplet_regexp
parameter of GCC's set_arguments.  GCC decides on the meaning of the
triplet_regexp parameter according to the success of:

+  if (access (triplet_regexp, X_OK) == 0)


Jan


gdb/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* compile/compile.c (compile_gcc, show_compile_gcc): New.
	(compile_to_object): Implement compile_gcc.
	(_initialize_compile): Install "set compile-gcc".  Initialize
	compile_gcc.

gdb/doc/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* doc/gdb.texinfo (Compiling and Injecting Code): Add to subsection
	Compiler search for the compile command descriptions of set
	compile-gcc and show compile-gcc.

include/ChangeLog
2015-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gcc-interface.h (enum gcc_base_api_version): Add comment to
	GCC_FE_VERSION_1.
	(struct gcc_base_vtable): Describe triplet_regexp parameter overload
	for set_arguments.

diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index 598fd88..33fc352 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -46,7 +46,9 @@ enum gcc_base_api_version
 {
   GCC_FE_VERSION_0 = 0,

-  /* Parameter verbose has been moved from compile to set_arguments.  */
+  /* Parameter verbose has been moved from compile to set_arguments.
+     Parameter triplet_regexp of set_arguments can be also gcc driver
+     executable.  */
   GCC_FE_VERSION_1 = 1,
 };

@@ -69,7 +71,8 @@ struct gcc_base_vtable

   /* 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.
+     configury triplet prefix to the compiler; TRIPLET_REGEXP can be
+     also absolute filename  to the computer.
      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
---
 gdb/compile/compile.c   |   40 +++++++++++++++++++++++++++++++++-------
 gdb/doc/gdb.texinfo     |   33 ++++++++++++++++++++++++++++-----
 include/gcc-interface.h |    7 +++++--
 3 files changed, 66 insertions(+), 14 deletions(-)

diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index c53d15d..8b1af7f 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -299,6 +299,19 @@ append_args (int *argcp, char ***argvp, int argc, char **argv)
   (*argvp)[(*argcp)] = NULL;
 }
 
+/* String for 'set compile-gcc' and 'show compile-gcc'.  */
+static char *compile_gcc;
+
+/* Implement 'show compile-gcc'.  */
+
+static void
+show_compile_gcc (struct ui_file *file, int from_tty,
+		  struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Compile command GCC driver filename is \"%s\".\n"),
+		    value);
+}
+
 /* Return DW_AT_producer parsed for get_selected_frame () (if any).
    Return NULL otherwise.
 
@@ -430,8 +443,6 @@ compile_to_object (struct command_line *cmd, char *cmd_string,
   int ok;
   FILE *src;
   struct gdbarch *gdbarch = get_current_arch ();
-  const char *os_rx;
-  const char *arch_rx;
   char *triplet_rx;
   char *error_message;
 
@@ -481,12 +492,17 @@ compile_to_object (struct command_line *cmd, char *cmd_string,
   if (compile_debug)
     fprintf_unfiltered (gdb_stdout, "debug output:\n\n%s", code);
 
-  os_rx = osabi_triplet_regexp (gdbarch_osabi (gdbarch));
-  arch_rx = gdbarch_gnu_triplet_regexp (gdbarch);
+  if (compile_gcc[0] != 0)
+    triplet_rx = compile_gcc;
+  else
+    {
+      const char *os_rx = osabi_triplet_regexp (gdbarch_osabi (gdbarch));
+      const char *arch_rx = gdbarch_gnu_triplet_regexp (gdbarch);
 
-  /* Allow triplets with or without vendor set.  */
-  triplet_rx = concat (arch_rx, "(-[^-]*)?-", os_rx, (char *) NULL);
-  make_cleanup (xfree, triplet_rx);
+      /* Allow triplets with or without vendor set.  */
+      triplet_rx = concat (arch_rx, "(-[^-]*)?-", os_rx, (char *) NULL);
+      make_cleanup (xfree, triplet_rx);
+    }
 
   /* Set compiler command-line arguments.  */
   get_args (compiler, gdbarch, &argc, &argv);
@@ -681,4 +697,14 @@ String quoting is parsed like in shell, for example:\n\
 			 " -fno-stack-protector"
   );
   set_compile_args (compile_args, 0, NULL);
+
+  add_setshow_string_cmd ("compile-gcc", class_support,
+			  &compile_gcc,
+			  _("Set compile command GCC driver filename"),
+			  _("Show compile command GCC driver filename"),
+			  _("\
+It should be absolute pathname to the gcc executable.\n\
+If empty the default target triplet will be searched in $PATH."),
+			  NULL, show_compile_gcc, &setlist, &showlist);
+  compile_gcc = xstrdup ("");
 }
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 0410702..8f3777d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17437,11 +17437,13 @@ will print to the console.
 
 @value{GDBN} needs to find @value{NGCC} for the inferior being debugged which
 may not be obvious for remote targets of different architecture than where
-@value{GDBN} is running.  Environment variable @code{PATH} (@code{PATH} from
-shell that executed @value{GDBN}, not the one set by @value{GDBN}
-command @code{set environment}).  @xref{Environment}.  @code{PATH} on
-@value{GDBN} host is searched for @value{NGCC} binary matching the
-target architecture and operating system.
+@value{GDBN} is running.  By default the environment variable
+@code{PATH} (@code{PATH} from shell that executed @value{GDBN}, not the
+one set by @value{GDBN} command @code{set environment}).
+@xref{Environment}.  @code{PATH} on @value{GDBN} host is searched for
+@value{NGCC} binary matching the target architecture and operating
+system.  This search can be overriden by @code{set compile-gcc} @value{GDBN}
+command below.
 
 Specifically @code{PATH} is searched for binaries matching regular expression
 @code{@var{arch}(-[^-]*)?-@var{os}-gcc} according to the inferior target being
@@ -17451,6 +17453,27 @@ example both @code{i386} and @code{x86_64} targets look for pattern
 for pattern @code{s390x?}.  @var{os} is currently supported only for
 pattern @code{linux(-gnu)?}.
 
+Besides the compiler driver @value{GDBN} needs also shared library
+@file{libcc1.so}.  It is searched in default shared library search path
+(overridable with usual environment variable @code{LD_LIBRARY_PATH}),
+unrelated to @code{PATH} or @code{set compile-gcc} settings.  Contrary to it
+@file{libcc1plugin.so} is found according to the installation of the found
+compiler --- as possibly specified by the @code{set compile-gcc} command.
+
+@table @code
+@item set compile-gcc
+@cindex compile command driver filename override
+Set compilation command used for compiling and injecting code with the
+@code{compile} commands.  If this option is not set (it is set to
+an empty string), the search described above will occur --- that is the
+default.
+
+@item show compile-gcc
+Displays the current compile command @value{NGCC} driver filename.
+If set, it is the main command @code{gcc}, found usually for example
+under name @code{x86_64-linux-gnu-gcc}.
+@end table
+
 @node GDB Files
 @chapter @value{GDBN} Files
 
diff --git a/include/gcc-interface.h b/include/gcc-interface.h
index 598fd88..33fc352 100644
--- a/include/gcc-interface.h
+++ b/include/gcc-interface.h
@@ -46,7 +46,9 @@ enum gcc_base_api_version
 {
   GCC_FE_VERSION_0 = 0,
 
-  /* Parameter verbose has been moved from compile to set_arguments.  */
+  /* Parameter verbose has been moved from compile to set_arguments.
+     Parameter triplet_regexp of set_arguments can be also gcc driver
+     executable.  */
   GCC_FE_VERSION_1 = 1,
 };
 
@@ -69,7 +71,8 @@ struct gcc_base_vtable
 
   /* 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.
+     configury triplet prefix to the compiler; TRIPLET_REGEXP can be
+     also absolute filename  to the computer.
      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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] compile: Add 'set compile-gcc'
  2015-04-21 21:37 ` [PATCH 4/4] compile: Add 'set compile-gcc' Jan Kratochvil
@ 2015-04-22  7:21   ` Eli Zaretskii
  2015-04-23 21:09     ` Jan Kratochvil
  2015-04-23 20:40   ` cancel: " Jan Kratochvil
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2015-04-22  7:21 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches, pmuldoon

> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: Phil Muldoon <pmuldoon@redhat.com>
> Date: Tue, 21 Apr 2015 23:36:57 +0200
> 
> parameter of GCC's set_arguments.  GCC decides on the meaning of the
> triplet_regexp parameter according to the success of:
> 
> +  if (access (triplet_regexp, X_OK) == 0)

Does triplet_regexp include the .exe extension on platforms that need
it?  Otherwise, 'access' will fail on those platforms.  (Sorry,
couldn't see where's the actual code, so couldn't verify that myself.)

> +  add_setshow_string_cmd ("compile-gcc", class_support,
> +			  &compile_gcc,
> +			  _("Set compile command GCC driver filename"),
> +			  _("Show compile command GCC driver filename"),
> +			  _("\
> +It should be absolute pathname to the gcc executable.\n\
> +If empty the default target triplet will be searched in $PATH."),
> +			  NULL, show_compile_gcc, &setlist, &showlist);

This doesn't offer file-name completion, does it?  I think it should.

> +                          By default the environment variable
> +@code{PATH} (@code{PATH} from shell that executed @value{GDBN}, not the
> +one set by @value{GDBN} command @code{set environment}).

This sentence is incomplete, I think you need to combine it with the
next one.  (I suggest to say the simple thing first, and then add the
caveat about which PATH is searched, instead of having the caveat in
the middle, making it harder to comprehend.)

> +Besides the compiler driver @value{GDBN} needs also shared library
> +@file{libcc1.so}.  It is searched in default shared library search path
> +(overridable with usual environment variable @code{LD_LIBRARY_PATH}),
> +unrelated to @code{PATH} or @code{set compile-gcc} settings.

This is Unix logic, btw.  On Windows, libcc1.dll will either be in the
same directory where the GCC driver is, or on PATH, or in libexec.  So
maybe you should qualify the above by saying this is on Posix hosts;
we could then amend it when this is supported on Windows (assuming it
isn't for now).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* cancel: [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0
  2015-04-21 21:36 [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
                   ` (2 preceding siblings ...)
  2015-04-21 21:37 ` [PATCH 4/4] compile: Add 'set compile-gcc' Jan Kratochvil
@ 2015-04-23 20:40 ` Jan Kratochvil
  3 siblings, 0 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

obsoleted by:
	[PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
	https://sourceware.org/ml/gdb-patches/2015-04/msg00909.html
	[PATCH v2 2/2] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00910.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* cancel: [PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1
  2015-04-21 21:36 ` [PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
@ 2015-04-23 20:40   ` Jan Kratochvil
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

obsoleted by:
	[PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
	https://sourceware.org/ml/gdb-patches/2015-04/msg00909.html
	[PATCH v2 2/2] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00910.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* cancel: [PATCH 3/4] compile: set debug compile: Display GCC driver filename
  2015-04-21 21:36 ` [PATCH 3/4] compile: set debug compile: Display GCC driver filename Jan Kratochvil
@ 2015-04-23 20:40   ` Jan Kratochvil
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

obsoleted by:
	[PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
	https://sourceware.org/ml/gdb-patches/2015-04/msg00909.html
	[PATCH v2 2/2] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00910.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* cancel: [PATCH 4/4] compile: Add 'set compile-gcc'
  2015-04-21 21:37 ` [PATCH 4/4] compile: Add 'set compile-gcc' Jan Kratochvil
  2015-04-22  7:21   ` Eli Zaretskii
@ 2015-04-23 20:40   ` Jan Kratochvil
  1 sibling, 0 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-23 20:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Phil Muldoon

obsoleted by:
	[PATCH v2 1/2] compile: set debug compile: Display GCC driver filename
	https://sourceware.org/ml/gdb-patches/2015-04/msg00909.html
	[PATCH v2 2/2] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00910.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] compile: Add 'set compile-gcc'
  2015-04-22  7:21   ` Eli Zaretskii
@ 2015-04-23 21:09     ` Jan Kratochvil
  2015-04-24  6:16       ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-23 21:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches, pmuldoon

On Wed, 22 Apr 2015 09:21:14 +0200, Eli Zaretskii wrote:
> > parameter of GCC's set_arguments.  GCC decides on the meaning of the
> > triplet_regexp parameter according to the success of:
> > 
> > +  if (access (triplet_regexp, X_OK) == 0)
> 
> Does triplet_regexp include the .exe extension on platforms that need
> it?  Otherwise, 'access' will fail on those platforms.  (Sorry,
> couldn't see where's the actual code, so couldn't verify that myself.)

Actual code is:
    triplet_rx = compile_gcc;
  add_setshow_string_cmd ("compile-gcc", class_support,
                          &compile_gcc,
so whatever user sets by 'set compile-gcc' GDB command will be passed.


> > +  add_setshow_string_cmd ("compile-gcc", class_support,
> > +			  &compile_gcc,
> 
> This doesn't offer file-name completion, does it?  I think it should.

Fixed.


> > +                          By default the environment variable
> > +@code{PATH} (@code{PATH} from shell that executed @value{GDBN}, not the
> > +one set by @value{GDBN} command @code{set environment}).
> 
> This sentence is incomplete, I think you need to combine it with the
> next one.  (I suggest to say the simple thing first, and then add the
> caveat about which PATH is searched, instead of having the caveat in
> the middle, making it harder to comprehend.)

Changed it all a bit.


> > +Besides the compiler driver @value{GDBN} needs also shared library
> > +@file{libcc1.so}.  It is searched in default shared library search path
> > +(overridable with usual environment variable @code{LD_LIBRARY_PATH}),
> > +unrelated to @code{PATH} or @code{set compile-gcc} settings.
> 
> This is Unix logic, btw.  On Windows, libcc1.dll will either be in the
> same directory where the GCC driver is, or on PATH, or in libexec.  So
> maybe you should qualify the above by saying this is on Posix hosts;
> we could then amend it when this is supported on Windows (assuming it
> isn't for now).

I do not think it would work on MS-Windows host as gcc/libcc1/ uses:
	# If any of these functions are missing, simply don't bother building
	# this plugin.
	GCC_ENABLE_PLUGINS
	AC_CHECK_FUNC(socketpair, , enable_plugin=no)
	AC_CHECK_FUNC(select, , enable_plugin=no)
	AC_CHECK_FUNC(fork, , enable_plugin=no)
	AM_CONDITIONAL(ENABLE_PLUGIN, test $enable_plugin = yes)


New patch is posted at:
	[PATCH v3 2/2] compile: Add 'set compile-gcc'
	https://sourceware.org/ml/gdb-patches/2015-04/msg00915.html
	Message-ID: <20150423210815.GA8626@host1.jankratochvil.net>


Thanks,
Jan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] compile: Add 'set compile-gcc'
  2015-04-23 21:09     ` Jan Kratochvil
@ 2015-04-24  6:16       ` Eli Zaretskii
  2015-04-24  6:19         ` Jan Kratochvil
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2015-04-24  6:16 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches, pmuldoon

> Date: Thu, 23 Apr 2015 23:09:16 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb-patches@sourceware.org, pmuldoon@redhat.com
> 
> > > +Besides the compiler driver @value{GDBN} needs also shared library
> > > +@file{libcc1.so}.  It is searched in default shared library search path
> > > +(overridable with usual environment variable @code{LD_LIBRARY_PATH}),
> > > +unrelated to @code{PATH} or @code{set compile-gcc} settings.
> > 
> > This is Unix logic, btw.  On Windows, libcc1.dll will either be in the
> > same directory where the GCC driver is, or on PATH, or in libexec.  So
> > maybe you should qualify the above by saying this is on Posix hosts;
> > we could then amend it when this is supported on Windows (assuming it
> > isn't for now).
> 
> I do not think it would work on MS-Windows host as gcc/libcc1/ uses:
> 	# If any of these functions are missing, simply don't bother building
> 	# this plugin.
> 	GCC_ENABLE_PLUGINS
> 	AC_CHECK_FUNC(socketpair, , enable_plugin=no)
> 	AC_CHECK_FUNC(select, , enable_plugin=no)
> 	AC_CHECK_FUNC(fork, , enable_plugin=no)
> 	AM_CONDITIONAL(ENABLE_PLUGIN, test $enable_plugin = yes)

You underestimate the hacker power ;-)  Trust me, soon enough this
will work on Windows, and these conditions will then change.  So I
still think we should qualify the above logic by saying that it is
specific to Posix systems.

Thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] compile: Add 'set compile-gcc'
  2015-04-24  6:16       ` Eli Zaretskii
@ 2015-04-24  6:19         ` Jan Kratochvil
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Kratochvil @ 2015-04-24  6:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches, pmuldoon

On Fri, 24 Apr 2015 08:16:28 +0200, Eli Zaretskii wrote:
> > I do not think it would work on MS-Windows host as gcc/libcc1/ uses:
> > 	# If any of these functions are missing, simply don't bother building
> > 	# this plugin.
> > 	GCC_ENABLE_PLUGINS
> > 	AC_CHECK_FUNC(socketpair, , enable_plugin=no)
> > 	AC_CHECK_FUNC(select, , enable_plugin=no)
> > 	AC_CHECK_FUNC(fork, , enable_plugin=no)
> > 	AM_CONDITIONAL(ENABLE_PLUGIN, test $enable_plugin = yes)
> 
> You underestimate the hacker power ;-)  Trust me, soon enough this
> will work on Windows, and these conditions will then change.  So I
> still think we should qualify the above logic by saying that it is
> specific to Posix systems.

Yes, I have changed the text so in the updated patch.


Jan

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-04-24  6:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-21 21:36 [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil
2015-04-21 21:36 ` [PATCH 3/4] compile: set debug compile: Display GCC driver filename Jan Kratochvil
2015-04-23 20:40   ` cancel: " Jan Kratochvil
2015-04-21 21:36 ` [PATCH 2/4] compile: Use libcc1.so.0->libcc1.so.1 Jan Kratochvil
2015-04-23 20:40   ` cancel: " Jan Kratochvil
2015-04-21 21:37 ` [PATCH 4/4] compile: Add 'set compile-gcc' Jan Kratochvil
2015-04-22  7:21   ` Eli Zaretskii
2015-04-23 21:09     ` Jan Kratochvil
2015-04-24  6:16       ` Eli Zaretskii
2015-04-24  6:19         ` Jan Kratochvil
2015-04-23 20:40   ` cancel: " Jan Kratochvil
2015-04-23 20:40 ` cancel: [PATCH 1/4] compile: Use libcc1.so->libcc1.so.0 Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).