From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30745 invoked by alias); 21 Dec 2012 21:12:08 -0000 Received: (qmail 30722 invoked by uid 22791); 21 Dec 2012 21:12:06 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from na3sys009aog138.obsmtp.com (HELO na3sys009aog138.obsmtp.com) (74.125.149.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 21:12:00 +0000 Received: from mx20.qnx.com ([72.1.200.103]) (using TLSv1) by na3sys009aob138.postini.com ([74.125.148.12]) with SMTP ID DSNKUNTQnFhSTF/++cRKGBBGhfJE828HsqJX@postini.com; Fri, 21 Dec 2012 13:12:00 PST Received: by mx20.qnx.com (Postfix, from userid 500) id A53E2210FB; Fri, 21 Dec 2012 16:11:55 -0500 (EST) Received: from exhts.ott.qnx.com (exhts2 [10.222.2.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx20.qnx.com (Postfix) with ESMTPS id EC81220E58; Fri, 21 Dec 2012 16:11:54 -0500 (EST) Received: from [10.222.161.182] (10.222.161.182) by exhts2.ott.qnx.com (10.222.2.25) with Microsoft SMTP Server id 14.2.318.1; Fri, 21 Dec 2012 16:11:55 -0500 Message-ID: <50D4D099.3030601@qnx.com> Date: Fri, 21 Dec 2012 21:12:00 -0000 From: Aleksandar Ristovski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 Newsgroups: gmane.comp.gdb.devel To: Jan Kratochvil CC: Raphael Zulliger , Subject: Re: Ensure correct symbol-file when attaching to a (remote) process References: <50D3FC31.1020103@indel.ch> <20121221161114.GA32638@host2.jankratochvil.net> In-Reply-To: <20121221161114.GA32638@host2.jankratochvil.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-12/txt/msg00073.txt.bz2 On 12-12-21 11:11 AM, Jan Kratochvil wrote: > On Fri, 21 Dec 2012 07:05:37 +0100, Raphael Zulliger wrote: >> Is there really no such mechanism in GDB? > > There is no such reliable mechanism in general. > > One could verify build-id in the target, probably that the build-id note is at > the same VMA as present in the local symbol file. > > But then also many binaries/compilers do not provide build-id by default (ld > option --build-id). Interesting timing. I have just posted http://sourceware.org/ml/gdb-patches/2012-12/msg00776.html addressing this issue. The check is not exhaustive, but for most practical purposes it should suffice. It verifies that in-memory elf header and pheaders match those found in the bfd. Of course it will not detect difference in all cases, e.g. very small changes that do not affect loadable segment size. Example: - static int foo; - static int bar; + static int bar; + static int foo; Still, it should be much better than no check at all. --- Aleksandar