From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11289 invoked by alias); 18 Feb 2002 16:47:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10849 invoked from network); 18 Feb 2002 16:46:55 -0000 Received: from unknown (HELO fw-cam.cambridge.arm.com) (193.131.176.3) by sources.redhat.com with SMTP; 18 Feb 2002 16:46:55 -0000 Received: by fw-cam.cambridge.arm.com; id QAA06766; Mon, 18 Feb 2002 16:46:53 GMT Received: from unknown(172.16.1.2) by fw-cam.cambridge.arm.com via smap (V5.5) id xma005959; Mon, 18 Feb 02 16:46:06 GMT Received: from cam-mail2.cambridge.arm.com (localhost [127.0.0.1]) by cam-admin0.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id QAA06907 for ; Mon, 18 Feb 2002 16:46:05 GMT Received: from sun18.cambridge.arm.com (sun18.cambridge.arm.com [172.16.2.18]) by cam-mail2.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id QAA07618; Mon, 18 Feb 2002 16:46:05 GMT Message-Id: <200202181646.QAA07618@cam-mail2.cambridge.arm.com> X-Mailer: exmh version 2.0.2 2/24/98 To: gdb-patches@sources.redhat.com cc: Richard.Earnshaw@arm.com Reply-To: Richard.Earnshaw@arm.com Organization: ARM Ltd. X-Telephone: +44 1223 400569 (direct+voicemail), +44 1223 400400 (switchbd) X-Fax: +44 1223 400410 X-Address: ARM Ltd., 110 Fulbourn Road, Cherry Hinton, Cambridge CB1 9NJ. X-Url: http://www.arm.com/ Subject: PATCH ARM support a multi-arch compatible way of doing call dummys Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_-1021209620" Date: Mon, 18 Feb 2002 08:47:00 -0000 From: Richard Earnshaw X-SW-Source: 2002-02/txt/msg00475.txt.bz2 This is a multipart MIME message. --==_Exmh_-1021209620 Content-Type: text/plain; charset=us-ascii Content-length: 516 Using the Sparc port as precedent, this patch fixes the use of CALL_DUMMY_BREAKPOINT_OFFSET to be multi-arch compatible. It's a bit of a hack, so I may well come back to it at a later date. 2002-02-18 Richard Earnshaw * arm-tdep.c (arm_set_call_dummy_breakpoint_offset): New function. (arm_fix_call_dummy): Call it. (arm_call_dummy_breakpoint_offset): Delete. (arm_gdbarch_init): Initialize call_dummy_breakpoint_offset. * config/arm/tm-arm.h (CALL_DUMMY_BREAKPOINT_OFFSET): Delete. --==_Exmh_-1021209620 Content-Type: text/x-patch ; name="gdb-macdbo.patch"; charset=us-ascii Content-Description: gdb-macdbo.patch Content-Disposition: attachment; filename="gdb-macdbo.patch" Content-length: 3574 Index: arm-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/arm-tdep.c,v retrieving revision 1.45 diff -p -r1.45 arm-tdep.c *** arm-tdep.c 2002/02/18 15:04:17 1.45 --- arm-tdep.c 2002/02/18 16:38:44 *************** static LONGEST arm_call_dummy_words[] = *** 1263,1268 **** --- 1263,1287 ---- 0xe1a0e00f, 0xe1a0f004, 0xe7ffdefe }; + /* Adjust the call_dummy_breakpoint_offset for the bp_call_dummy + breakpoint to the proper address in the call dummy, so that + `finish' after a stop in a call dummy works. + + XXX Tweeking current_gdbarch is not an optimal solution, but the + call to arm_fix_call_dummy is immediately followed by a call to + run_stack_dummy, which is the only function where + call_dummy_breakpoint_offset is actually used. */ + + + static void + arm_set_call_dummy_breakpoint_offset (void) + { + if (caller_is_thumb) + set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 4); + else + set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 8); + } + /* Fix up the call dummy, based on whether the processor is currently in Thumb or ARM mode, and whether the target function is Thumb or ARM. There are three different situations requiring three *************** arm_fix_call_dummy (char *dummy, CORE_AD *** 1292,1297 **** --- 1311,1317 ---- /* Set flag indicating whether the current PC is in a Thumb function. */ caller_is_thumb = arm_pc_is_thumb (read_pc ()); + arm_set_call_dummy_breakpoint_offset (); /* If the target function is Thumb, set the low bit of the function address. And if the CPU is currently in ARM mode, patch the *************** arm_fix_call_dummy (char *dummy, CORE_AD *** 1326,1347 **** write_register (4, fun); } - /* Return the offset in the call dummy of the instruction that needs - to have a breakpoint placed on it. This is the offset of the 'swi - 24' instruction, which is no longer actually used, but simply acts - as a place-holder now. - - This implements the CALL_DUMMY_BREAK_OFFSET macro. */ - - int - arm_call_dummy_breakpoint_offset (void) - { - if (caller_is_thumb) - return 4; - else - return 8; - } - /* Note: ScottB This function does not support passing parameters using the FPA --- 1346,1351 ---- *************** arm_gdbarch_init (struct gdbarch_info in *** 2801,2806 **** --- 2805,2813 ---- /* Call dummy code. */ set_gdbarch_call_dummy_location (gdbarch, ON_STACK); set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + /* We have to give this a value now, even though we will re-set it + during each call to arm_fix_call_dummy. */ + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 8); set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); Index: config/arm/tm-arm.h =================================================================== RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v retrieving revision 1.31 diff -p -r1.31 tm-arm.h *** tm-arm.h 2002/02/18 15:04:19 1.31 --- tm-arm.h 2002/02/18 16:38:46 *************** *** 30,38 **** lexical context are listed after the beginning LBRAC instead of before in the executables list of symbols. */ #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p)) - - /* XXX This is NOT multi-arch compatible. */ - #define CALL_DUMMY_BREAKPOINT_OFFSET arm_call_dummy_breakpoint_offset() - extern int arm_call_dummy_breakpoint_offset (void); #endif /* TM_ARM_H */ --- 30,34 ---- --==_Exmh_-1021209620--