This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

src/gdb ChangeLog remote.c remote.h solib.c


CVSROOT:	/cvs/src
Module name:	src
Changes by:	palves@sourceware.org	2013-09-27 15:29:06

Modified files:
	gdb            : ChangeLog remote.c remote.h solib.c 

Log message:
	Fix regular /path/to/directory sysroots and target reported dll paths with drive specs.
	
	I tried debugging a remote Windows program on Linux host, and pointed the
	sysroot to "/some/path/" rather than "remote:", and I found GDB couldn't
	find the dlls in the sysroot.  If the dll name is
	"C:/Windows/system32/ntdll.dll", I end up with the sysroot+in_pathname
	concatenated this way:
	
	(top-gdb) p temp_pathname
	$1 = 0x228b690 "/some/pathC:/Windows/system32/ntdll.dll"
	^^
	
	That is, a directory separator is missing.  This is a regression.
	
	The problem is that solib_find decides that since the target path has
	a drive spec, a separator is not necessary, which is clearly wrong in
	this case.  That check was added in
	<https://sourceware.org/ml/gdb-patches/2013-06/msg00028.html>, to
	handle the case of sysroot being "remote:".  This patch fixes that
	original issue in a different way.  Instead of checking whether the
	path has a drive spec, check whether the sysroot is "remote:".  The
	patch adds a table that helps visualize the cases that need a
	separator.  I also confirmed the original issue is still handled as
	expected.  That is, that "set sysroot remote:" still does the right
	thing.
	
	remote_filename_p returns true if the filename is prefixed with
	"remote:".  In this case, we need to check whether the filename is
	exactly "remote:".  I thought of different ways or either changing
	remote_filename_p or adding another convenience function to remote.c
	to avoid exposing the "remote:" prefix out of remote.c.  But all
	attempts turned out adding lot of over needless complication.  So the
	patch just exposes the prefix behind a new macro, which allows using a
	straighforward strcmp.
	
	gdb/
	2013-09-27  Pedro Alves  <palves@redhat.com>
	
	* remote.h (REMOTE_SYSROOT_PREFIX): New define.
	(remote_filename_p): Add comment.
	* remote.c (remote_filename_p): Adjust to use
	REMOTE_SYSROOT_PREFIX.
	* solib.c (solib_find): When deciding whether we need to add a
	directory separator, check whether the sysroot is "remote:"
	instead of checking whether the patch has a drive spec.  Add
	comments.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.16042&r2=1.16043
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/remote.c.diff?cvsroot=src&r1=1.578&r2=1.579
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/remote.h.diff?cvsroot=src&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/solib.c.diff?cvsroot=src&r1=1.180&r2=1.181


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]