Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: brobecker@adacore.com
Cc: gdb-patches@sourceware.org, palves@redhat.com, jan.kratochvil@redhat.com
Subject: Re: one week to gdb-7.6 release?
Date: Tue, 02 Apr 2013 18:05:00 -0000	[thread overview]
Message-ID: <83ppycj0s3.fsf@gnu.org> (raw)
In-Reply-To: <83eheywxye.fsf@gnu.org>

> Date: Fri, 29 Mar 2013 08:56:41 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: gdb-patches@sourceware.org, palves@redhat.com, jan.kratochvil@redhat.com, ralf.corsepius@rtems.org, vapier@gentoo.org, joel.sherrill@oarcorp.com
> 
> > Date: Thu, 28 Mar 2013 18:59:24 -0700
> > From: Joel Brobecker <brobecker@adacore.com>
> > Cc: gdb-patches@sourceware.org, palves@redhat.com,
> > 	jan.kratochvil@redhat.com, ralf.corsepius@rtems.org,
> > 	vapier@gentoo.org, joel.sherrill@oarcorp.com
> > 
> > > > The
> > > > code in main.c already does
> > > > 
> > > >   #ifdef __MINGW32__
> > > >     /* On Windows, argv[0] is not necessarily set to absolute form when
> > > >        GDB is found along PATH, without which relocation doesn't work.  */
> > > >     gdb_program_name = windows_get_absolute_argv0 (argv[0]);
> > > >   #else
> > > >     gdb_program_name = xstrdup (argv[0]);
> > > >   #endif
> > > > 
> > > > Is moving that to posix-hdep.c just to avoid an ifdef?
> > > 
> > > The main purpose is to move the code away out of windows-nat, which
> > > is only linked in native debuggers, not cross ones - so that building
> > > a cross debugger hosted on Windows will work again. Basically, your
> > > new function is really only dependent on the host, whereas the -nat
> > > file makes the assumption that host & target are Windows.
> > 
> > I have added this item to the TODO list for the 7.6 release, so as not
> > to forget.
> 
> Thanks.
> 
> > I was wondering if this discussion was stalled, or if it was just
> > a matter of not finding the time to do the implementation.
> 
> The latter.
> 
> > I could possibly take care of it tomorrow if you'd like.
> 
> If you have time, it's fine with me.  Failing that, I will submit the
> changes in a few days.

Here they are.  This is for the trunk; it undoes the previous commit
and moves the code to mingw-hdep.c.

OK to commit, including the branch (which will get a different change,
since there's no need to remove the previous commit there)?

2013-04-02  Eli Zaretskii  <eliz@gnu.org>

	* windows-nat.c (windows_get_absolute_argv0): Move from here...
	* mingw-hdep.c (windows_get_absolute_argv0): ...to here.
	Include main.h.

	* windows-nat.h (windows_get_absolute_argv0): Move prototype from
	here...
	* main.h (windows_get_absolute_argv0): ...to here

--- gdb/windows-nat.c~1	2013-03-21 13:05:21.642985800 +0200
+++ gdb/windows-nat.c	2013-04-02 20:04:56.438612100 +0300
@@ -597,18 +597,6 @@ failed:
   return 0;		/* failure */
 }
 
-/* Return an absolute file name of the running GDB, if possible, or
-   ARGV0 if not.  The return value is in malloc'ed storage.  */
-char *
-windows_get_absolute_argv0 (const char *argv0)
-{
-  char full_name[PATH_MAX];
-
-  if (GetModuleFileName (NULL, full_name, PATH_MAX))
-    return xstrdup (full_name);
-  return xstrdup (argv0);
-}
-
 /* Encapsulate the information required in a call to
    symbol_file_add_args.  */
 struct safe_symbol_file_add_args

--- gdb/windows-nat.h~1	2013-03-21 13:05:19.068969300 +0200
+++ gdb/windows-nat.h	2013-04-02 20:05:15.626735100 +0300
@@ -28,9 +28,5 @@ typedef int (segment_register_p_ftype) (
    whether a given register is a segment register or not.  */
 extern void windows_set_segment_register_p (segment_register_p_ftype *fun);
 
-/* Return argv[0] in absolute form, if possible, or ARGV0 if not.  The
-   return value is in malloc'ed storage.  */
-extern char *windows_get_absolute_argv0 (const char *argv0);
-
 #endif
 

--- gdb/mingw-hdep.c~1	2013-01-01 08:32:47.000000000 +0200
+++ gdb/mingw-hdep.c	2013-04-02 20:26:57.231081900 +0300
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "main.h"
 #include "serial.h"
 #include "event-loop.h"
 
@@ -80,6 +81,19 @@ safe_strerror (int errnum)
   return buffer;
 }
 
+/* Return an absolute file name of the running GDB, if possible, or
+   ARGV0 if not.  The return value is in malloc'ed storage.  */
+
+char *
+windows_get_absolute_argv0 (const char *argv0)
+{
+  char full_name[PATH_MAX];
+
+  if (GetModuleFileName (NULL, full_name, PATH_MAX))
+    return xstrdup (full_name);
+  return xstrdup (argv0);
+}
+
 /* Wrapper for select.  On Windows systems, where the select interface
    only works for sockets, this uses the GDB serial abstraction to
    handle sockets, consoles, pipes, and serial ports.

--- gdb/main.c~2	2013-03-21 13:11:43.279038500 +0200
+++ gdb/main.c	2013-04-02 20:07:51.534134500 +0300
@@ -44,9 +44,6 @@
 #include "auto-load.h"
 
 #include "filenames.h"
-#ifdef __MINGW32__
-# include "windows-nat.h"
-#endif
 
 #include "version.h"
 

--- gdb/main.h~1	2013-01-01 08:32:47.000000000 +0200
+++ gdb/main.h	2013-04-02 20:25:41.837731800 +0300
@@ -36,4 +36,10 @@ extern int return_child_result_value;
 extern int batch_silent;
 extern int batch_flag;
 
+/* From mingw-hdep.c, used by main.c.  */
+
+/* Return argv[0] in absolute form, if possible, or ARGV0 if not.  The
+   return value is in malloc'ed storage.  */
+extern char *windows_get_absolute_argv0 (const char *argv0);
+
 #endif


  parent reply	other threads:[~2013-04-02 17:32 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 16:09 Joel Brobecker
2013-03-20 16:14 ` Pedro Alves
2013-03-20 17:06 ` Jan Kratochvil
2013-03-20 17:08 ` Joel Sherrill
2013-03-20 17:20 ` Eli Zaretskii
2013-03-23 22:59   ` Eli Zaretskii
2013-03-24  0:01     ` Joel Brobecker
2013-03-24  0:07       ` Eli Zaretskii
2013-03-25 16:58         ` Joel Brobecker
2013-03-25 17:46           ` Eli Zaretskii
2013-03-25 18:10             ` Joel Brobecker
2013-03-29  8:02               ` Joel Brobecker
2013-03-29 14:03                 ` Eli Zaretskii
2013-03-29 19:53                   ` Joel Brobecker
2013-04-02 18:05                   ` Eli Zaretskii [this message]
2013-04-05 13:03                     ` Eli Zaretskii
2013-04-06  6:16                       ` unbreak Windows hosted cross debugger builds (was: Re: one week to gdb-7.6 release?) Pedro Alves
2013-04-06 15:41                         ` unbreak Windows hosted cross debugger builds " Eli Zaretskii
2013-03-29 15:23                 ` one week to gdb-7.6 release? Ralf Corsepius
2013-03-29 16:42                   ` m32r sim was " Joel Sherrill
2013-03-29 17:18                     ` Mike Frysinger
2013-03-29 19:53                       ` Joel Brobecker
2013-03-29 20:24                         ` Joel Sherrill
2013-03-29 21:44                           ` Joel Brobecker
2013-04-04 13:03                         ` Ralf Corsepius
2013-04-10 15:01                           ` Joel Brobecker
2013-03-25 19:08             ` Mark Kettenis
2013-03-25 19:12               ` Eli Zaretskii
2013-04-06 21:49                 ` Pedro Alves
2013-04-07  3:58                   ` Eli Zaretskii
2013-03-23 23:38   ` Joel Sherrill
2013-03-24  0:12     ` Mike Frysinger
2013-03-20 18:23 ` Ralf Corsepius
2013-04-01 19:56 ` Mike Frysinger
2013-03-29 12:53 Joel Sherrill
2013-03-29 14:15 ` Eli Zaretskii

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=83ppycj0s3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=palves@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