From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30747 invoked by alias); 10 Mar 2013 21:07:52 -0000 Received: (qmail 30739 invoked by uid 22791); 10 Mar 2013 21:07:51 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,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, 10 Mar 2013 21:07:42 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2AL7eMw010154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 10 Mar 2013 17:07:40 -0400 Received: from host2.jankratochvil.net (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2AL7Zgs006009 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 10 Mar 2013 17:07:38 -0400 Date: Sun, 10 Mar 2013 21:07:00 -0000 From: Jan Kratochvil To: Aleksandar Ristovski Cc: "gdb-patches@sourceware.org" Subject: [draft patch 0/6] Split FYI and some review notes Message-ID: <20130310210734.GA21130@host2.jankratochvil.net> References: <51278984.3070208@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51278984.3070208@qnx.com> 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: 2013-03/txt/msg00432.txt.bz2 Hello Aleksandar, to send something here is some draft, there will be still some changes. I had first difficulties to apply it to FSF GDB HEAD as it has some conflicts so I had to rebase it first. It is not a normal review as your patch has merged code moves + code modifications which is unreviewable. Moves and modifications need to be in separate patches so that one can see what has changed in the diff. fileio_read_stralloc you have reimplemented for gdbserver; I have rather chosen to generalize the gdb/ variant and call the same common/ code from both gdb and gdbserver. One may ask whether it is not more complicated than its reimplementation, not sure. By moving linux_find_memory_regions_full you have dropped make_cleanup there. Its use from GDB may now leak memory as its called FUNC may throw an exception. I have put there 'void **memory_to_free_ptr' to make it reusable from both gdb and gdbserver. I tried to make the patches similar to your code so that one can diff the result against your patch. There were many code formatting little changes and also needless casts (probably from C++). For the last [draft patch 6/6] - things not done there yet: get_dynamic already parses/scans PHDRs, you introduce new PHDR parser, they should be merged. get_hex_build_id must not be based on soname, moreover playing with realname on it, it is too fragile. It should be based on addresses, you know that l_ld is absolute address inside the library. So find maps/smaps entry containing l_ld, subtract its file offset from vaddr and you have the ELF header address. Do not run get_hex_build_id quadratically - currently for each library you open and scan maps/smaps again. Probably the best approach is to scan all l_ld addresses from r_debug first, then qsort them and then linearly match them to the maps/smaps entries. I am not sure but I guess they still should be returned to GDB in their original order from r_debug for some backward and solib-svr4.c compatibility. Also Gary Benson is working on incremental shlib transfers from gdbserver so that it does not clash too much (it will anyway). While just quadratic computation would be in real world acceptable all the open/read/close syscalls I find really needlessly expensive. PT_NOTE segment contains arbitrary number of notes, up to its size. You check only the first entry there. On Fri, 22 Feb 2013 16:06:44 +0100, Aleksandar Ristovski wrote: > As per Jan's request, this patch adds 'build-id' to the gdbserver > response. The value is hex encoded string representing > .note.gnu.build-id section of the corresponding shared library. gdbserver reports PT_NOTE segment, not any section. gdbserver is dependent on runtime information (segments), it cannot rely on debug/link information (sections). BTW ping me (possibly off-list) whether you plan to work on it now yourself or whether I should be doing more of the changes described above; I sure have also enough other work... Thanks, Jan