This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Don't set dir separator if path has drive spec
- From: Doug Evans <dje at google dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 3 Jun 2013 17:48:06 -0700
- Subject: Re: [PATCH] Don't set dir separator if path has drive spec
- References: <1370306007-877-1-git-send-email-yao at codesourcery dot com>
On Mon, Jun 3, 2013 at 5:33 PM, Yao Qi <yao@codesourcery.com> wrote:
> 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,
Hi. Looks right to me.