From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25350 invoked by alias); 11 Jan 2012 17:06:02 -0000 Received: (qmail 25331 invoked by uid 22791); 11 Jan 2012 17:06:00 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from caibbdcaaaaf.dreamhost.com (HELO homiemail-a48.g.dreamhost.com) (208.113.200.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 17:05:47 +0000 Received: from homiemail-a48.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a48.g.dreamhost.com (Postfix) with ESMTP id A92FD4F8056; Wed, 11 Jan 2012 09:05:46 -0800 (PST) Received: from redwood.eagercon.com (c-76-102-3-160.hsd1.ca.comcast.net [76.102.3.160]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: eager@eagerm.com) by homiemail-a48.g.dreamhost.com (Postfix) with ESMTPSA id 24C1E4F805C; Wed, 11 Jan 2012 09:05:44 -0800 (PST) Message-ID: <4F0DC166.2040603@eagerm.com> Date: Wed, 11 Jan 2012 17:06:00 -0000 From: Michael Eager User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 MIME-Version: 1.0 To: Mark Kettenis CC: gdb@sourceware.org Subject: Re: gdbarch_skip_solib_resolver question References: <4F0C9AD3.2000807@eagerm.com> <4e8cbd44794a5d98bc46a882c1379405.squirrel@webmail.xs4all.nl> In-Reply-To: <4e8cbd44794a5d98bc46a882c1379405.squirrel@webmail.xs4all.nl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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-01/txt/msg00042.txt.bz2 On 01/11/2012 12:43 AM, Mark Kettenis wrote: >> I noticed that gdbarch_skip_solib_resolver() invokes >> glibc_skip_solib_resolver() on x86, mips, and sh to identify >> that gdb is stepping into _dl_runtime_resolve. >> >> On PowerPC, gdbarch_skip_solib_resolver() always returns a zero. >> >> I don't see any problem with gdb stopping in _dl_runtime_resolve >> or not stepping over the routine. >> >> So, what does this mean? Is calling glibc_skip_solib_resolver() >> optional? Or is the handle_inferior_event() code so convoluted >> or intelligent that it works even when pieces are missing? >> > > If I remember correctly, gdbarch_skip_solib_resolver() is just an > optimization. If it returns an address where GDB can set a breakpoint > that gets hit upon return from the dynamic linker. If > gdbarch_skip_solib_resolver() returns zero GDB just single-steps through > the dynamic linker, which works, but is a bit slower. This is glibc_skip_solib_resolver(): struct minimal_symbol *resolver = lookup_minimal_symbol_and_objfile ("_dl_runtime_resolve", &objfile); if (resolver) { /* The dynamic linker began using this name in early 2005. */ struct minimal_symbol *fixup = lookup_minimal_symbol ("_dl_fixup", NULL, objfile); ... if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) return frame_unwind_caller_pc (get_current_frame ()); } return 0; Unless I'm reading the code wrong, I don't think this can ever return non-zero. This is called from handle_inferior_event (infrun.c:4754) when in_solib_dynsym_resolve_code() is true. This means that the pc points to the start of a PLT stub. The test to see if it is at _dl_fixup will always fail. It looks to me that this should return the address of _dl_fixup and eliminate the frame_unwind. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077