From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9045 invoked by alias); 14 Aug 2011 16:36:08 -0000 Received: (qmail 8889 invoked by uid 22791); 14 Aug 2011 16:36:07 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Aug 2011 16:35:48 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7EGZle0005119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 14 Aug 2011 12:35:47 -0400 Received: from host1.jankratochvil.net (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7EGZjx6026602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 14 Aug 2011 12:35:46 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p7EGZild025514; Sun, 14 Aug 2011 18:35:44 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p7EGZiju025513; Sun, 14 Aug 2011 18:35:44 +0200 Date: Sun, 14 Aug 2011 16:36:00 -0000 From: Jan Kratochvil To: Paul Pluzhnikov Cc: gdb-patches@sourceware.org Subject: Re: [patch] Implement qXfer:libraries for Linux/gdbserver Message-ID: <20110814163543.GA7641@host1.jankratochvil.net> References: <20110808210938.GA19337@host1.jankratochvil.net> <20110808213800.GA21915@host1.jankratochvil.net> <20110809090647.GA21388@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2011-08/txt/msg00291.txt.bz2 On Tue, 09 Aug 2011 18:56:15 +0200, Paul Pluzhnikov wrote: > Side note: SO_NAME_MAX_PATH_SIZE == 512 in solist.h is wrong for Linux; > I am surprised this hasn't bitten anyone yet. Why doesn't it use PATH_MAX ? I agree, that static array is not nice anyway. Regarding design merge of solib-svr4.c XML with solib-target.c XML I have read the threads: [RFC] Add expat to the GDB sources http://sourceware.org/ml/gdb-patches/2006-07/msg00231.html [RFC, take 2] Optional expat http://sourceware.org/ml/gdb-patches/2006-08/msg00048.html and there is opposition by Mark and Eli (and IIRC only by Mark and Eli) against any additional pre-requisites for some minimal native GDB build. I have to agree just because of some minor internal design clean up it may not make sense to break this pre-requisite rule. Sidenote: readline needs to continue being bundled as even latest (=bundled) readline release needs to stay forked at least by: [patch 2/3] readline-6.2: Workaround "ask" regression http://sourceware.org/ml/gdb-patches/2011-05/msg00005.html But work is continuing in general to make the possibility of dropping bundled readline, where it turns from current technical reasons to political reasons. solib-svr4.c should be split etc. but I find it now outside of the scope of this patch. I would therefore find OK to just technically merge the XML parsing in solib-svr4.c and solib-target.c into some solib.c for example to be called from both points (if it still makes sense after the changes requested below). Besides that there are some bugs in the current solib-svr4.c implementation. If you: prelink -R /lib64/libc-2.14.90.so Then it will: Sending packet: $qXfer:libraries:read::0,fff#d5...Packet received: l\n \n \n\n warning: while parsing target library list (at line 2): No segment defined for /lib64/libc.so.6 Which is correct, because `l_addr' being sent as `segment address' is just in-memory vs. in-file-at-program-start-time displacement, on prelinked system l_addr is normally always 0. This also violates the current protocol description: gdb.texinfo @node Library List Format The segment or section bases are start addresses, not relocation offsets; they do not depend on the library's link-time base addresses. So either gdbserver needs to find the real base address of the library (which is IMO possible only by searching /proc/PID/maps for l_ld mapped object and taking its base address). Or a different XML attribute needs to be used. It also needs to pass l_ld address as it is being used by lm_addr_check to match up the host in-file bfd addresses to the target in-memory addresses across various prelink situations. There are 4 different addresses present at the same time during debugging: (1) in-memory target base address where library has been loaded (2) in-file base address the time the library has been loaded, which is contained in ELF data structures in the target memory (3) in-file host base address of library the time debugger has been started (4) in-file host separate .debug file address (which is always 0) gdb.base/break-interp.exp should PASS with it, with working , currently it prints a lot of: warning: while parsing target library list: no element found lm_addr_check currently expects it can read so->lm_info->lm being now NULL with . But lm_addr_check will start to be needed with gdb.base/break-interp.exp so one may hit this problem afterwards. Sorry for the delay, I can return to it in 1-2 weeks (need to push entryval). Thanks, Jan