From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16629 invoked by alias); 21 Feb 2013 13:40:36 -0000 Received: (qmail 16617 invoked by uid 22791); 21 Feb 2013 13:40:35 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from usmamail.tilera.com (HELO USMAMAIL.TILERA.COM) (12.216.194.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Feb 2013 13:40:26 +0000 Received: from localhost.localdomain (125.39.108.107) by USMAExch2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server (TLS) id 14.0.722.0; Thu, 21 Feb 2013 08:40:24 -0500 Message-ID: <512623BE.2030608@tilera.com> Date: Thu, 21 Feb 2013 13:40:00 -0000 From: Jiong Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Yao Qi CC: Joel Brobecker , , 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> <511F0FE9.8030300@codesourcery.com> <51243991.4040304@tilera.com> <51244CBA.4000009@codesourcery.com> In-Reply-To: <51244CBA.4000009@codesourcery.com> Content-Type: multipart/mixed; boundary="------------070901080509060804020503" 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-02/txt/msg00554.txt.bz2 --------------070901080509060804020503 Content-Type: text/plain; charset="gb18030"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1985 On 02/20/2013 12:10 PM, Yao Qi wrote: > Is it possible that the section layouts on two pages? I mean, if is > possible that NEXT_ADDR is within section FOO and page A, but the end > of section FOO is within page A + 1. If this is true, we need to > check to the min (page boundary, section boundary), otherwise, we > don't have to worry about it. sure, and I guess the page boundary check is for the risk that the next page is not in memory that need to be paged in. but some of the time, we just need to analyze a few instructions then we could get the result, so we only cross a page when necessary, but this do not make sense for disk file access. after a second think, I fell it's reasonable that "section_table_xfer_memory_partial" do not handle those gap between sections, because there is no bit on the disk file for those gap, while if the debuggee is loaded and under running, then target_read_memory will use ptrace to fetch runtime memory, then those gap has physical map in memory, and set to zero. for x86, this is a issue also. for a simple testcase char *fmt = "x%d\n"; int main(int argc, char **argv) { printf(fmt, argc); return 0; } gcc test.c gdb a.out (gdb) x/10 fmt 0x4005c0 <__dso_handle+8>: 174335352 Cannot access memory at address 0x4005c4 (gdb) b main Breakpoint 1 at 0x4004e0 (gdb) r Starting program: /home/jiwang/GDB-TEST/a.out Breakpoint 1, 0x00000000004004e0 in main () (gdb) x/10 fmt 0x4005c0 <__dso_handle+8>: 174335352 0 990059265 44 0x4005d0: 4 -552 72 -236 0x4005e0: 112 -184 so, I think fix this issue by checking section boundary simultaneously is a bit strange, the clean and proper way is to stop skip_prologue analysis when the pc is in plt stub. below is the old patch, any one comments on this? gdb/ChangeLog: * tilegx-tdep.c (tilegx_skip_prologue): simplify the handling for plt stub. -- Regards, Jiong. Wang Tilera Corporation. --------------070901080509060804020503 Content-Type: text/x-patch; name="0001-xx.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-xx.patch" Content-length: 588 --- gdb/tilegx-tdep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index 2c4e349..2452232 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -758,6 +758,10 @@ tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) return max (start_pc, post_prologue_pc); } + /* for plt stub, just return the start pc */ + if (in_plt_section (start_pc, NULL)) + return start_pc; + /* Otherwise, try to skip prologue the hard way. */ return tilegx_analyze_prologue (gdbarch, start_pc, -- 1.7.10.4 --------------070901080509060804020503--