From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12019 invoked by alias); 20 Apr 2002 21:48:18 -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 12011 invoked from network); 20 Apr 2002 21:48:18 -0000 Received: from unknown (HELO dr-evil.shagadelic.org) (208.176.2.162) by sources.redhat.com with SMTP; 20 Apr 2002 21:48:18 -0000 Received: by dr-evil.shagadelic.org (Postfix, from userid 7518) id CF0779869; Sat, 20 Apr 2002 14:48:17 -0700 (PDT) Date: Sat, 20 Apr 2002 14:48:00 -0000 From: Jason R Thorpe To: gdb-patches@sources.redhat.com Subject: [PATCH/RFA] Fix busted logic in find_saved_register() Message-ID: <20020420144817.W1627@dr-evil.shagadelic.org> Reply-To: thorpej@wasabisystems.com Mail-Followup-To: Jason R Thorpe , gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k3qmt+ucFURmlhDS" Content-Disposition: inline User-Agent: Mutt/1.2.5i Organization: Wasabi Systems, Inc. X-SW-Source: 2002-04/txt/msg00689.txt.bz2 --k3qmt+ucFURmlhDS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 841 find_saved_register() is used by mips_get_saved_register() and the alpha_get_saved_register() in my (updated) multi-arch changes for the Alpha target. While investigating some testsuite failures, it appeared that there is no way thjat find_saved_register() could possibly work on either MIPS or Alpha, since the first thing it does on either of those platforms is dereference a NULL pointer (said pointer is initlaized to NULL at the top of the function). I believe the following patch makes find_saved_register() actually implement the logic it claims to. It certainly fixes the problem I had with GDB dumping core, and fixes the relevant testsuite failures. OK to commit? * frame.c (find_saved_register): Avoid a NULL pointer dereference and actually walk the frame list. -- -- Jason R. Thorpe --k3qmt+ucFURmlhDS Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=frame-patch Content-length: 798 Index: frame.c =================================================================== RCS file: /cvs/src/src/gdb/frame.c,v retrieving revision 1.7 diff -c -r1.7 frame.c *** frame.c 17 Apr 2002 21:55:12 -0000 1.7 --- frame.c 20 Apr 2002 21:30:25 -0000 *************** *** 83,91 **** while (1) { QUIT; ! frame1 = get_next_frame (frame1); ! if (frame1 == 0 || frame1 == frame) break; FRAME_INIT_SAVED_REGS (frame1); if (frame1->saved_regs[regnum]) addr = frame1->saved_regs[regnum]; --- 83,92 ---- while (1) { QUIT; ! frame1 = get_next_frame (frame); ! if (frame1 == 0) break; + frame = frame1; FRAME_INIT_SAVED_REGS (frame1); if (frame1->saved_regs[regnum]) addr = frame1->saved_regs[regnum]; --k3qmt+ucFURmlhDS--