From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104313 invoked by alias); 15 Apr 2015 12:45:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 104302 invoked by uid 89); 15 Apr 2015 12:45:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 15 Apr 2015 12:45:04 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3FCj2eC018645 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 15 Apr 2015 08:45:02 -0400 Received: from blade.nx (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3FCj1IH014320; Wed, 15 Apr 2015 08:45:01 -0400 Received: by blade.nx (Postfix, from userid 1000) id 9BD3F263FB7; Wed, 15 Apr 2015 13:45:00 +0100 (BST) Date: Wed, 15 Apr 2015 12:45:00 -0000 From: Gary Benson To: Eli Zaretskii , Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/7] Use gdb_sysroot for main executable on attach Message-ID: <20150415124500.GB23948@blade.nx> References: <1427887341-31819-1-git-send-email-gbenson@redhat.com> <1427887341-31819-4-git-send-email-gbenson@redhat.com> <83619fsxx2.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83619fsxx2.fsf@gnu.org> X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00560.txt.bz2 Eli Zaretskii wrote: > > From: Gary Benson > > Date: Wed, 1 Apr 2015 12:22:17 +0100 > > > > +* Paths specified by "set sysroot" will be prepended to the path of > > + the main executable when attaching to already-running processes > > + (local and remote) if the path of the main executable is reported > > + to GDB as absolute by the operating system. > > Please don't use "path" when you really mean "file name". > > > +shared library paths will be prefixed with @var{path}; many runtime > > +loaders store the absolute paths to the shared library in the target > > +program's memory. When attaching to already-running processes, their > > +paths will be prefixed with @var{path} if reported to @value{GDBN} as > > +absolute by the operating system. If you use @code{set sysroot} to > > +find executables and shared libraries, they need to be laid out in > > +the same way that they are on the target, with e.g.@: a @file{/bin}, > > +@file{/lib} and @file{/usr/lib} hierarchy under @var{path}. > > Same here. (Yes, I know that the previous text also used "path"). Pedro Alves wrote: > This "When attaching to already-running processes" part confuses me, > as the sysroot is also prepended to paths in the "run" case. How about these replacements for those two chunks: NEWS: +* The system root specified by "set sysroot" will be prepended to the + filename of the main executable (if reported to GDB as absolute by + the operating system) when starting processes remotely, and when + attaching to already-running local or remote processes. gdb.texinfo: Use @var{path} as the system root for the program being debugged. Any absolute shared library paths will be prefixed with @var{path}; many runtime loaders store the absolute paths to the shared library in the -target program's memory. If you use @code{set sysroot} to find shared -libraries, they need to be laid out in the same way that they are on -the target, with e.g.@: a @file{/lib} and @file{/usr/lib} hierarchy -under @var{path}. +target program's memory. When starting processes remotely, and when +attaching to already-running processes (local or remote), their +filenames will be prefixed with @var{path} if reported to @value{GDBN} +as absolute by the operating system. If you use @code{set sysroot} to +find executables and shared libraries, they need to be laid out in the +same way that they are on the target, with e.g.@: a @file{/bin}, +@file{/lib} and @file{/usr/lib} hierarchy under @var{path}. At this point in the series the prefixing only happens when attaching to local processes--attaching to some remote processes appears in patch 5, and attaching to all remote processes and to remote processes we start is patch 7--but I didn't want to jiggle the doc at every step. The above chunks are for the whole thing, which I can leave here in patch 3 or move to patch 7, whatever people prefer. Cheers, Gary -- http://gbenson.net/