From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26705 invoked by alias); 14 Jan 2010 22:07:38 -0000 Received: (qmail 26685 invoked by uid 22791); 14 Jan 2010 22:07:36 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Jan 2010 22:07:31 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 74D011312F for ; Thu, 14 Jan 2010 14:07:30 -0800 (PST) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost3.vmware.com (Postfix) with ESMTP id 6BA35CD905 for ; Thu, 14 Jan 2010 14:07:30 -0800 (PST) Message-ID: <4B4F95C3.5080209@vmware.com> Date: Thu, 14 Jan 2010 22:07:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20090624) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [RFC] problem in solib-svr4/enable_break Content-Type: multipart/mixed; boundary="------------050809040005020907000507" 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/msg00394.txt.bz2 This is a multi-part message in MIME format. --------------050809040005020907000507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 933 The attached patch isn't for submission, but just to help illustrate the problem. It fixes a symptom but seems kludgy to me (and not well understood). Here's the problem. I have a kernel image which is statically linked and PIE. When it gets to enable_break, it succeeds in finding "debug_base", but "debug_base" is in the text section of the main executable (ie. not in the dynamic loader, which is not actually present). Therefore we compute info->interp_text_sect_low and info->interp_text_sect_high as the start and end of the text section of the main executable. And therefore whenever we call in_solib_dynsym_resolve_code(), it returns TRUE, and therefore source level stepping won't work. This simple patch just checks to see whether "tmp_bfd" (which is supposed to be the dynamic loader) matches exec_bfd, and if so, lets interp_text_sect_low and interp_text_sect_high remain zero. Anybody got a better suggestion? --------------050809040005020907000507 Content-Type: text/plain; name="svr4.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="svr4.txt" Content-length: 706 Index: solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.110 diff -u -p -r1.110 solib-svr4.c --- solib-svr4.c 8 Jan 2010 22:52:03 -0000 1.110 +++ solib-svr4.c 14 Jan 2010 21:57:37 -0000 @@ -1312,7 +1312,10 @@ enable_break (struct svr4_info *info, in os->objfile->sect_index_text); interp_sect = bfd_get_section_by_name (tmp_bfd, ".text"); - if (interp_sect) + + /* Skip if tmp_bfd points to main executable. */ + if (interp_sect + && strcmp (tmp_bfd->filename, exec_bfd->filename) != 0) { info->interp_text_sect_low = bfd_section_vma (tmp_bfd, interp_sect) + load_addr; --------------050809040005020907000507--