From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1416 invoked by alias); 25 May 2006 00:29:21 -0000 Received: (qmail 1408 invoked by uid 22791); 25 May 2006 00:29:20 -0000 X-Spam-Check-By: sourceware.org Received: from e31.co.us.ibm.com (HELO e31.co.us.ibm.com) (32.97.110.149) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 25 May 2006 00:29:18 +0000 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e31.co.us.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k4P0TGki020320 for ; Wed, 24 May 2006 20:29:16 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k4P0TG9k181236 for ; Wed, 24 May 2006 18:29:16 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k4P0TGFr030124 for ; Wed, 24 May 2006 18:29:16 -0600 Received: from dufur.beaverton.ibm.com (dufur.beaverton.ibm.com [9.47.22.20]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k4P0TGft030096 for ; Wed, 24 May 2006 18:29:16 -0600 Subject: [patch] Fixes problem setting breakpoint in dynamic loader From: PAUL GILLIAM Reply-To: pgilliam@us.ibm.com To: gdb-patches@sources.redhat.com Content-Type: multipart/mixed; boundary="=-z0a1QHXPsj5sKoA5562L" Date: Thu, 25 May 2006 02:26:00 -0000 Message-Id: <1148513171.315.104.camel@dufur.beaverton.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 (2.2.2-5) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00458.txt.bz2 --=-z0a1QHXPsj5sKoA5562L Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 997 On PowerPC-64, with 64-bit executables, GDB has been giving this message for a while: warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. This is because "enable_break()" in solib-svr4.c was looking for the symbol "._dl_debug_state" in the 64-bit dynamic loader and not finding it. This should not be a surprise because these 'dot' symbols have not been used for a while. The reason that the non-'dot' symbol was also passed by, is that it points into a data section and the existing code only checked code sections. If none of the symbols on the list was found in a code section, the attached patch looks in data sections. When it finds one, and the data section is either '.plt' or '.opd', then the address points to a function descriptor which is then used to find the corresponding code address where the breakpoint can be set. OK to commit? -=# Paul #=- --=-z0a1QHXPsj5sKoA5562L Content-Disposition: attachment; filename=loader_break.diff Content-Type: text/x-patch; name=loader_break.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 4204 2006-05-24 Paul Gilliam = interp_plt_sect_low + && sym_addr + load_addr < interp_plt_sect_high) + { + interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt"); + sect_offset = interp_plt_sect_low - load_addr; + } + else + { + interp_sect = bfd_get_section_by_name (tmp_bfd, ".opd"); + if (interp_sect != 0) + { + sect_offset = bfd_section_vma (tmp_bfd, interp_sect); + if (sym_addr < sect_offset) + interp_sect == 0; + else if (sym_addr - sect_offset >= + bfd_section_size (tmp_bfd, interp_sect)) + interp_sect == 0; + } + } + if (interp_sect != 0) + { + /* Try to convert the function descriptor we found above, into + the address we need. It will be relocated below by adding + "load_addr" to it. */ + char *buf = alloca (sizeof (LONGEST)); + if (bfd_get_section_contents (tmp_bfd, interp_sect, buf, + sym_addr - sect_offset, + sizeof (LONGEST))) + sym_addr = extract_unsigned_integer (buf, sizeof (LONGEST)); + else + sym_addr = 0; + } + } + /* We're done with both the temporary bfd and target. Remember, closing the target closes the underlying bfd. */ target_close (tmp_bfd_target, 0); --=-z0a1QHXPsj5sKoA5562L--