From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14436 invoked by alias); 18 Mar 2011 17:13:02 -0000 Received: (qmail 14421 invoked by uid 22791); 18 Mar 2011 17:13:00 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Mar 2011 17:12:51 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2IHCngK015690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Mar 2011 13:12:49 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2IHClmj005154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Mar 2011 13:12:49 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p2IHClqK013532; Fri, 18 Mar 2011 18:12:47 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p2IHCkN4013528; Fri, 18 Mar 2011 18:12:46 +0100 Date: Fri, 18 Mar 2011 18:28:00 -0000 From: Jan Kratochvil To: Paul Pluzhnikov Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [patch] Fix for PR gdb/12573 Message-ID: <20110318171246.GA13366@host1.jankratochvil.net> References: <20110316235418.34BA7190B17@elbrus2.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-03/txt/msg00926.txt.bz2 On Fri, 18 Mar 2011 18:01:50 +0100, Paul Pluzhnikov wrote: > On Fri, Mar 18, 2011 at 9:29 AM, Tom Tromey wrote: > >>>>>> "Paul" == Paul Pluzhnikov writes: > > > > Paul> Attached patch fixes http://sourceware.org/bugzilla/show_bug.cgi?id=12573 > > Paul> by removing (I believe incorrect) assertion. > > > > See also: > > > > https://bugzilla.redhat.com/show_bug.cgi?id=612253 > > > > And Jan's patch: > > > > http://sourceware.org/ml/gdb-patches/2010-07/msg00533.html > > > > I can't say I fully understand Jan's. > > The patch looks good to me (and I *think* I understand it). I have to review it again but for example it would hide another bug but I do not have a fix for it, it should be pretty straightforward if anyone would like to write it: https://bugzilla.redhat.com/show_bug.cgi?id=612253#c6 One of the problems is that GDB tries to skip prologue even for -O2 -g code. There is no such reason as with -O2 -g the debug info is correct for each instructions. With -O0 -g there are frame-related absolute addresses of autovariables which is the reason GDB needs to skip the prologue to have valid location of such -O0 -g autovariables. -O2 -g code can be detected for a Compilation Unit if there is referenced any location list from that CU (suggested by GCC hackers). In such case skipping prologues should be disabled. Compilation Unit @ offset 0x90398e: <0><903999>: Abbrev Number: 1 (DW_TAG_compile_unit) <90399f> DW_AT_name : ../../gcc/gcc/tree-into-ssa.c <9039a3> DW_AT_comp_dir : /user/inria/fsf/160832/bld-2/gcc <1><91073a>: Abbrev Number: 69 (DW_TAG_subprogram) <91073b> DW_AT_name : add_new_name_mapping <2><910751>: Abbrev Number: 75 (DW_TAG_formal_parameter) <910752> DW_AT_name : new_tree <910759> DW_AT_type : <0x903ea5> <91075d> DW_AT_location : 0x59d960 (location list) ^^^^^^^^^^^^^^^ (gdb) break add_new_name_mapping -> (gdb) p/x original_pc $1 = 0x85be0bd 085be0b0 : 85be0b0: 55 push %ebp 85be0b1: 89 e5 mov %esp,%ebp 85be0b3: 57 push %edi 85be0b4: 56 push %esi 85be0b5: 89 c6 mov %eax,%esi 85be0b7: 53 push %ebx 85be0b8: 89 d3 mov %edx,%ebx 85be0ba: 83 ec 4c sub $0x4c,%esp 85be0bd: 80 3d a0 8c ca 08 00 cmpb $0x0,0x8ca8ca0 ^^^^^^^ There are other problems but this is the first step which should make the problems at least no longer affecting this specific case. Thanks, Jan