From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14974 invoked by alias); 18 Jan 2013 17:30:01 -0000 Received: (qmail 14917 invoked by uid 22791); 18 Jan 2013 17:30:00 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_EG 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 Jan 2013 17:29:53 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0IHTpKG015956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Jan 2013 12:29:51 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0IHTmv2030543; Fri, 18 Jan 2013 12:29:49 -0500 Message-ID: <50F9868C.6030905@redhat.com> Date: Fri, 18 Jan 2013 17:30:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Jiong Wang CC: Joel Brobecker , gdb-patches@sourceware.org, Walter Lee Subject: Re: [RFC/TileGX 2/6] simplify the handling of skip prologue for plt stub References: <50F91516.6010204@tilera.com> <20130118131511.GF3564@adacore.com> <50F9664D.2090008@tilera.com> In-Reply-To: <50F9664D.2090008@tilera.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2013-01/txt/msg00442.txt.bz2 On 01/18/2013 03:12 PM, Jiong Wang wrote: > >>> for tilegx, when skip prologue, if the start_pc is a plt stub address, then >>> stop to go further, just return the start_pc. >>> >>> gdb/ChangeLog: >>> >>> * tilegx-tdep.c (tilegx_skip_prologue): simplify the handling for >>> plt stub. >> Can you provide an example where this becomes necessary? I don't >> see a problem with the patch per se, but I don't remember seeing >> other ports doing this... >> > yes, there are some tricky thing. > > for the simple hello.c > > #include > int main(int argc, char **argv) > { > printf("hello, %d\n", argc); > return 0 > } > > without this patch > === > -bash-4.1$ gcc -o hello.tile hello.c > -bash-4.1$ ./gdb hello.tile > (gdb) b printf > Error accessing memory address 0x10a40: Success. > > after this patch > === > (gdb) b printf > Breakpoint 1 at 0x10a40 > > > this is because tilegx skip_prologue will invoke tilegx_analyze_prologue, which > will prefetch 32*8 bytes. > > while for when the address is in plt stub, you can see it near the eh_frame_hdr section > > [14] .plt 0000000000010a00 000a00 0000a0 28 AX 0 0 64 > ... > [16] .eh_frame_hdr 0000000000010ac0 000ac0 000024 00 A 0 0 4 > [17] .eh_frame 0000000000010ae8 000ae8 0000b4 00 A 0 0 8 > > the .eh_frame_hdr aligns to 4, there is a hole between .eh_frame_hdr and .eh_frame, and this > will cause trouble for section_table_xfer_memory_partial. > > after fetch memory starting from 0x10ac0 to 0x10ae4, then the memaddr will be 0x10ae4 in section_table_xfer_memory_partial, > while this function did not consider this hole situation, so goes to line 666, error occured. Right. It's this issue that needs solving. Otherwise you're just papering over the problem. > > for other targets, like x86, I have done a brief exploration, seems they do not have large prefetch window -- Pedro Alves