From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4788 invoked by alias); 26 Jan 2010 20:41:27 -0000 Received: (qmail 4778 invoked by uid 22791); 26 Jan 2010 20:41:26 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jan 2010 20:41:22 +0000 Received: from kpbe14.cbf.corp.google.com (kpbe14.cbf.corp.google.com [172.25.105.78]) by smtp-out.google.com with ESMTP id o0QKfKFM022693 for ; Tue, 26 Jan 2010 12:41:20 -0800 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by kpbe14.cbf.corp.google.com with ESMTP id o0QKfJ7i005650 for ; Tue, 26 Jan 2010 12:41:20 -0800 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 88F5D84414; Tue, 26 Jan 2010 12:41:19 -0800 (PST) To: gdb-patches@sourceware.org Subject: [patch] solib-svr4.c: Document why we need section info of the dynamic linker. Message-Id: <20100126204119.88F5D84414@ruffy.mtv.corp.google.com> Date: Tue, 26 Jan 2010 20:41:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true 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: 2010-01/txt/msg00575.txt.bz2 Hi. This patch is based on info from Daniel on irc. It documents why we don't call create_solib_event_breakpoint (sym_addr) unless we have section info on the dynamic linker. I'll check it in tomorrow if there are no objections. For the ARM case, one *could* try to pass a non-addr_bits_remove'd address to create_solib_event_breakpoint and get that working. Another hacky thought is to fake the necessary section/symbol info when gdb can't find the dynamic linker (which can happen for cross-debugging via gdbserver). That is left for a later pass. This patch just documents what's there today. 2010-01-26 Doug Evans * solib-svr4.c (enable_break): Document why we need section info of the dynamic linker. Index: solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.115 diff -u -p -r1.115 solib-svr4.c --- solib-svr4.c 14 Jan 2010 21:16:52 -0000 1.115 +++ solib-svr4.c 26 Jan 2010 20:36:06 -0000 @@ -1307,6 +1308,26 @@ enable_break (struct svr4_info *info, in sym_addr, ¤t_target)); + /* On at least some versions of Solaris there's a dynamic relocation + on _r_debug.rtld_db_dlactivity (or however it's spelled on Solaris) + and SYM_ADDR may not be relocated yet, e.g., if we get control + before the dynamic linker has self-relocated. Check if SYM_ADDR is + in a known section, if it is assume we can trust its value. + This is just a heuristic though, it could go away or be replaced if + it's getting in the way. + + On ARM we need to know whether the ISA of rtld_db_dlactivity (or + however it's spelled in your particular system) is ARM or Thumb. + That knowledge is encoded in the address, if it's Thumb the low bit + is 1. However, we've stripped that info above and it's not clear + what all the consequences are of passing a non-addr_bits_remove'd + address to create_solib_event_breakpoint. The call to + find_pc_section verifies we know about the address and have some + hope of computing the right kind of breakpoint to use (via + symbol info). It does mean that GDB needs to be pointed at a + non-stripped version of the dynamic linker in order to obtain + information it already knows about. Sigh. */ + os = find_pc_section (sym_addr); if (os != NULL) {