From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7281 invoked by alias); 9 Mar 2012 21:01:37 -0000 Received: (qmail 7270 invoked by uid 22791); 9 Mar 2012 21:01:36 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_EG,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, 09 Mar 2012 21:01:22 +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 q29L1MTZ027643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 9 Mar 2012 16:01:22 -0500 Received: from host2.jankratochvil.net (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q29L1H4a021751 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Fri, 9 Mar 2012 16:01:20 -0500 Date: Fri, 09 Mar 2012 21:01:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch 2/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5 Message-ID: <20120309210117.GB30432@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 2012-03/txt/msg00358.txt.bz2 Hi, here is the ON_STACK code again, with fixed alignment for i386 SSE. It is generalized for all OSes on i386/amd64. I can move it to {i386,amd64)-linux-tdep.c but I find this code much more lightweight than i386_push_dummy_call which is already present in i386-tdep. No regressions on {x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for gdbsever non-extended mode. For x86_64-fedora17-linux-gnu it fixes: -FAIL: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler. -FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame +PASS: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler. +PASS: gdb.cp/gdb2495.exp: bt after returning from a popped frame Thanks, Jan gdb/ 2012-03-09 Jan Kratochvil * amd64-dicos-tdep.c (amd64_dicos_push_dummy_code): Remove. (amd64_dicos_init_abi): Remove its installment. * dicos-tdep.c (dicos_init_abi): Remove the set_gdbarch_call_dummy_location call. Update the comment here. * i386-dicos-tdep.c (i386_dicos_push_dummy_code): Remove. (i386_dicos_init_abi): Remove its installment. * i386-tdep.c (i386_push_dummy_code): New function. (i386_gdbarch_init): Call set_gdbarch_call_dummy_location, install i386_push_dummy_code. --- a/gdb/amd64-dicos-tdep.c +++ b/gdb/amd64-dicos-tdep.c @@ -23,24 +23,6 @@ #include "amd64-tdep.h" #include "dicos-tdep.h" -static CORE_ADDR -amd64_dicos_push_dummy_code (struct gdbarch *gdbarch, - CORE_ADDR sp, CORE_ADDR funaddr, - struct value **args, int nargs, - struct type *value_type, - CORE_ADDR *real_pc, CORE_ADDR *bp_addr, - struct regcache *regcache) -{ - int bplen; - CORE_ADDR bppc = sp; - - gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); - *bp_addr = sp - bplen; - *real_pc = funaddr; - - return *bp_addr; -} - static void amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { @@ -49,8 +31,6 @@ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) amd64_init_abi (info, gdbarch); dicos_init_abi (gdbarch); - - set_gdbarch_push_dummy_code (gdbarch, amd64_dicos_push_dummy_code); } static enum gdb_osabi --- a/gdb/dicos-tdep.c +++ b/gdb/dicos-tdep.c @@ -43,8 +43,8 @@ dicos_init_abi (struct gdbarch *gdbarch) /* There's no (standard definition of) entry point or a guaranteed text location with a symbol where to place the call dummy, so we - put it on the stack. */ - set_gdbarch_call_dummy_location (gdbarch, ON_STACK); + need it on the stack. Rely on i386_gdbarch_init used also for + amd64 to set up ON_STACK inferior calls. */ /* DICOS rewinds the PC itself. */ set_gdbarch_decr_pc_after_break (gdbarch, 0); --- a/gdb/i386-dicos-tdep.c +++ b/gdb/i386-dicos-tdep.c @@ -22,32 +22,12 @@ #include "gdb_string.h" #include "dicos-tdep.h" -static CORE_ADDR -i386_dicos_push_dummy_code (struct gdbarch *gdbarch, - CORE_ADDR sp, CORE_ADDR funaddr, - struct value **args, int nargs, - struct type *value_type, - CORE_ADDR *real_pc, CORE_ADDR *bp_addr, - struct regcache *regcache) -{ - int bplen; - CORE_ADDR bppc = sp; - - gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); - *bp_addr = sp - bplen; - *real_pc = funaddr; - - return *bp_addr; -} - static void i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); dicos_init_abi (gdbarch); - - set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code); } static enum gdb_osabi --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2326,6 +2326,30 @@ i386_16_byte_align_p (struct type *type) return 0; } +/* Implementation for set_gdbarch_push_dummy_code. */ + +static CORE_ADDR +i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, + struct value **args, int nargs, struct type *value_type, + CORE_ADDR *real_pc, CORE_ADDR *bp_addr, + struct regcache *regcache) +{ + int bplen; + CORE_ADDR bppc = sp; + + gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); + sp -= bplen; + + /* amd64_push_dummy_call does alignment on its own but i386_push_dummy_call + does not. ABI requires stack alignment for executables using SSE. */ + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + + *bp_addr = sp; + *real_pc = funaddr; + return sp; +} + static CORE_ADDR i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, @@ -7372,6 +7396,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target); /* Call dummy code. */ + set_gdbarch_call_dummy_location (gdbarch, ON_STACK); + set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code); set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call); set_gdbarch_frame_align (gdbarch, i386_frame_align);