From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 792 invoked by alias); 17 Mar 2004 19:18: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 785 invoked from network); 17 Mar 2004 19:18:02 -0000 Received: from unknown (HELO faui10.informatik.uni-erlangen.de) (131.188.31.10) by sources.redhat.com with SMTP; 17 Mar 2004 19:18:02 -0000 Received: from faui1d.informatik.uni-erlangen.de (faui1d [131.188.31.34]) by faui10.informatik.uni-erlangen.de (8.9.3p3/8.1.9-FAU) with ESMTP id UAA29250 for ; Wed, 17 Mar 2004 20:18:01 +0100 (CET) From: Ulrich Weigand Received: (from weigand@localhost) by faui1d.informatik.uni-erlangen.de (8.9.3p3/8.1.6-FAU) id UAA09549 for gdb-patches@sources.redhat.com; Wed, 17 Mar 2004 20:18:01 +0100 (CET) Message-Id: <200403171918.UAA09549@faui1d.informatik.uni-erlangen.de> Subject: [PATCH] Fix gdb1476.exp on s390* To: gdb-patches@sources.redhat.com Date: Wed, 17 Mar 2004 19:18:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03.o/txt/msg00399.txt Hello, this patch fixes the gdb.base/gdb1476.exp test case (backtrace from NULL function pointer call). When calling via an invalid function pointer, what we should do is simply unwind the PC from the return address register and continue. This is exactly what is done to unwind from a PLT stub as well, so the patch simply uses the PLT frame unwinder to handle this case as well. Tested with no regressions on s390-ibm-linux and s390x-ibm-linux. Bye, Ulrich ChangeLog: * s390-tdep.c (s390_pltstub_frame_sniffer): Handle invalid function pointer calls like PLT calls. Index: gdb/s390-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/s390-tdep.c,v retrieving revision 1.129 diff -c -p -r1.129 s390-tdep.c *** gdb/s390-tdep.c 26 Feb 2004 23:48:01 -0000 1.129 --- gdb/s390-tdep.c 15 Mar 2004 19:36:47 -0000 *************** static const struct frame_unwind s390_pl *** 2103,2109 **** static const struct frame_unwind * s390_pltstub_frame_sniffer (struct frame_info *next_frame) { ! if (!in_plt_section (frame_pc_unwind (next_frame), NULL)) return NULL; return &s390_pltstub_frame_unwind; --- 2103,2116 ---- static const struct frame_unwind * s390_pltstub_frame_sniffer (struct frame_info *next_frame) { ! CORE_ADDR pc = frame_pc_unwind (next_frame); ! bfd_byte insn[S390_MAX_INSTR_SIZE]; ! ! /* If the current PC points to non-readable memory, we assume we have ! trapped due to an invalid function pointer call. We handle the ! non-existing current function like a PLT stub. */ ! if (!in_plt_section (pc, NULL) ! && s390_readinstruction (insn, pc) > 0) return NULL; return &s390_pltstub_frame_unwind; -- Dr. Ulrich Weigand weigand@informatik.uni-erlangen.de From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 792 invoked by alias); 17 Mar 2004 19:18: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 785 invoked from network); 17 Mar 2004 19:18:02 -0000 Received: from unknown (HELO faui10.informatik.uni-erlangen.de) (131.188.31.10) by sources.redhat.com with SMTP; 17 Mar 2004 19:18:02 -0000 Received: from faui1d.informatik.uni-erlangen.de (faui1d [131.188.31.34]) by faui10.informatik.uni-erlangen.de (8.9.3p3/8.1.9-FAU) with ESMTP id UAA29250 for ; Wed, 17 Mar 2004 20:18:01 +0100 (CET) From: Ulrich Weigand Received: (from weigand@localhost) by faui1d.informatik.uni-erlangen.de (8.9.3p3/8.1.6-FAU) id UAA09549 for gdb-patches@sources.redhat.com; Wed, 17 Mar 2004 20:18:01 +0100 (CET) Message-ID: <200403171918.UAA09549@faui1d.informatik.uni-erlangen.de> Subject: [PATCH] Fix gdb1476.exp on s390* To: gdb-patches@sources.redhat.com Date: Fri, 19 Mar 2004 00:09:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00399.txt.bz2 Message-ID: <20040319000900.Or_PAe4wvKOwxRb5Fy392d40RqUCpE2aJy7_9JWR54Q@z> Hello, this patch fixes the gdb.base/gdb1476.exp test case (backtrace from NULL function pointer call). When calling via an invalid function pointer, what we should do is simply unwind the PC from the return address register and continue. This is exactly what is done to unwind from a PLT stub as well, so the patch simply uses the PLT frame unwinder to handle this case as well. Tested with no regressions on s390-ibm-linux and s390x-ibm-linux. Bye, Ulrich ChangeLog: * s390-tdep.c (s390_pltstub_frame_sniffer): Handle invalid function pointer calls like PLT calls. Index: gdb/s390-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/s390-tdep.c,v retrieving revision 1.129 diff -c -p -r1.129 s390-tdep.c *** gdb/s390-tdep.c 26 Feb 2004 23:48:01 -0000 1.129 --- gdb/s390-tdep.c 15 Mar 2004 19:36:47 -0000 *************** static const struct frame_unwind s390_pl *** 2103,2109 **** static const struct frame_unwind * s390_pltstub_frame_sniffer (struct frame_info *next_frame) { ! if (!in_plt_section (frame_pc_unwind (next_frame), NULL)) return NULL; return &s390_pltstub_frame_unwind; --- 2103,2116 ---- static const struct frame_unwind * s390_pltstub_frame_sniffer (struct frame_info *next_frame) { ! CORE_ADDR pc = frame_pc_unwind (next_frame); ! bfd_byte insn[S390_MAX_INSTR_SIZE]; ! ! /* If the current PC points to non-readable memory, we assume we have ! trapped due to an invalid function pointer call. We handle the ! non-existing current function like a PLT stub. */ ! if (!in_plt_section (pc, NULL) ! && s390_readinstruction (insn, pc) > 0) return NULL; return &s390_pltstub_frame_unwind; -- Dr. Ulrich Weigand weigand@informatik.uni-erlangen.de