Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] Don't set dir separator if path has drive spec
Date: Tue, 04 Jun 2013 00:32:00 -0000	[thread overview]
Message-ID: <1370306007-877-1-git-send-email-yao@codesourcery.com> (raw)

Hi,
When I debug a remote Windows program on Linux host, set sysroot to
"remote:", find GDB can't load these dlls from the remote.  If the dll
name is "C:/Windows/system32/ntdll.dll" and GDB add "remote:" prefix
to the path.  The dll name becomes "remote:/C:/Windows/system32/ntdll.dll"
and GDBserver is confused by the name.  The first slash shouldn't be
added.  In solib.c:solib_find,

      need_dir_separator = !IS_DIR_SEPARATOR (in_pathname[0]);

it controls whether to insert dir separator after sysroot.  It works
for UNIX-like file path, but it doesn't work for the DOS-like absolute
path.  This patch is to fix this problem.  Is it OK?

gdb:

2013-06-04  Yao Qi  <yao@codesourcery.com>

	* solib.c (solib_find): Don't need dir separator if path has
	drive spec.
---
 gdb/solib.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gdb/solib.c b/gdb/solib.c
index a3479c5..d0392b4 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -230,7 +230,8 @@ solib_find (char *in_pathname, int *fd)
     {
       int need_dir_separator;
 
-      need_dir_separator = !IS_DIR_SEPARATOR (in_pathname[0]);
+      need_dir_separator = (!IS_DIR_SEPARATOR (in_pathname[0])
+			    && !HAS_TARGET_DRIVE_SPEC (fskind, in_pathname));
 
       /* Cat the prefixed pathname together.  */
       temp_pathname = concat (sysroot,
-- 
1.7.7.6


             reply	other threads:[~2013-06-04  0:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04  0:32 Yao Qi [this message]
2013-06-04  0:48 ` Doug Evans
2013-06-04  1:33   ` Yao Qi
2013-09-27 12:58 ` [PATCH] Fix regular /path/to/directory sysroots and target reported dll paths with drive specs. (was: Re: [PATCH] Don't set dir separator if path has drive spec) Pedro Alves
2013-09-27 14:18   ` [PATCH] Fix regular /path/to/directory sysroots and target reported dll paths with drive specs Yao Qi
2013-09-27 15:29     ` Pedro Alves

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=1370306007-877-1-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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