From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27169 invoked by alias); 1 Mar 2013 09:58:27 -0000 Received: (qmail 27160 invoked by uid 22791); 1 Mar 2013 09:58:26 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,KHOP_SPAMHAUS_DROP,RP_MATCHES_RCVD,TW_EG,TW_GJ 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; Fri, 01 Mar 2013 09:58:22 +0000 Received: from localhost.localdomain (124.207.145.166) by USMAExch2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server (TLS) id 14.0.722.0; Fri, 1 Mar 2013 04:58:21 -0500 Message-ID: <51307BBA.3090202@tilera.com> Date: Fri, 01 Mar 2013 09:58: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: Subject: [RFC/TileGX] fix longjmp bug Content-Type: multipart/mixed; boundary="------------090700010904020600080008" 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-03/txt/msg00006.txt.bz2 --------------090700010904020600080008 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 268 tilegx is lack of get_longjmp_target support. this patch fix this. please review. thanks. gdb/ChangeLog: * tilegx-tdep.c (tilegx_get_longjmp_target): New function. (tilegx_gdbarch_init): Install it. -- Regards, Jiong. Wang Tilera Corporation. --------------090700010904020600080008 Content-Type: text/x-patch; name="fix-longjmp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-longjmp.patch" Content-length: 1681 --- gdb/tilegx-tdep.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index 2c4e349..d9a8ed2 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -785,6 +785,28 @@ tilegx_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } +/* This is the implementation of gdbarch method get_longjmp_target. */ + +static int +tilegx_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) +{ + struct gdbarch *gdbarch = get_frame_arch (frame); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + CORE_ADDR jb_addr; + char buf[8]; + + jb_addr = get_frame_register_unsigned (frame, TILEGX_R0_REGNUM); + + /* TileGX jmp_buf contains 32 elements of type __uint_reg_t which + is size of 8bytes, the return address is stored in the 25th slot. */ + if (target_read_memory (jb_addr + 25 * 8, buf, 8)) + return 0; + + *pc = extract_unsigned_integer (buf, 8, byte_order); + + return 1; +} + /* by assigning the 'faultnum' reg in kernel pt_regs with this value, kernel do_signal will not check r0. see tilegx kernel/signal.c for details. */ @@ -1030,6 +1052,7 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* These values and methods are used when gdb calls a target function. */ set_gdbarch_push_dummy_call (gdbarch, tilegx_push_dummy_call); + set_gdbarch_get_longjmp_target (gdbarch, tilegx_get_longjmp_target); set_gdbarch_write_pc (gdbarch, tilegx_write_pc); set_gdbarch_breakpoint_from_pc (gdbarch, tilegx_breakpoint_from_pc); set_gdbarch_return_value (gdbarch, tilegx_return_value); --------------090700010904020600080008--