From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9058 invoked by alias); 3 Apr 2002 23:50:44 -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 8806 invoked from network); 3 Apr 2002 23:50:37 -0000 Received: from unknown (HELO mail-out2.apple.com) (17.254.0.51) by sources.redhat.com with SMTP; 3 Apr 2002 23:50:37 -0000 Received: from mailgate1.apple.com (A17-128-100-225.apple.com [17.128.100.225]) by mail-out2.apple.com (8.11.3/8.11.3) with ESMTP id g33NoYs09725 for ; Wed, 3 Apr 2002 15:50:34 -0800 (PST) Received: from scv1.apple.com (scv1.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Wed, 3 Apr 2002 15:50:08 -0800 Received: from inghji (inghji.apple.com [17.202.40.220]) by scv1.apple.com (8.11.3/8.11.3) with ESMTP id g33NoXs17209 for ; Wed, 3 Apr 2002 15:50:34 -0800 (PST) Date: Wed, 03 Apr 2002 15:50:00 -0000 Mime-Version: 1.0 (Apple Message framework v481) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: infrun.c:restore_selected_frame??? From: Jim Ingham To: gdb-patches@sources.redhat.com Content-Transfer-Encoding: 7bit Message-Id: <9637D4C6-475D-11D6-A9CC-000393540DDC@apple.com> X-SW-Source: 2002-04/txt/msg00080.txt.bz2 Hi, all... I am totally confused by restore_selected_frame. Why is it calling find_relative_frame, passing in the current frame and level? Remember, level comes from a stored value of selected_frame_level. selected_frame_level is set in select_frame, and is either an absolute frame level, or -1 if the caller of select_frame was just selecting by frame_info and doesn't care about the level (which is done in a number of places). So it is NOT a relative level at all, certainly not relative to whatever the current frame happens to be except by accident... Since you also have the frame address sitting around in the restore_selected_frame_args, why not use it to find the frame instead? The patch below works for me, and eliminates a bunch of errant kvetching about "Unable to restore selected frame"... Does this seem right? Jim Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.56 diff -c -w -r1.56 infrun.c *** infrun.c 2002/03/18 02:26:31 1.56 --- infrun.c 2002/04/03 23:42:52 *************** *** 4004,4024 **** struct restore_selected_frame_args *fr = (struct restore_selected_frame_args *) args; struct frame_info *frame; int level = fr->level; ! frame = find_relative_frame (get_current_frame (), &level); /* If inf_status->selected_frame_address is NULL, there was no previously selected frame. */ ! if (frame == NULL || ! /* FRAME_FP (frame) != fr->frame_address || */ ! /* elz: deleted this check as a quick fix to the problem that ! for function called by hand gdb creates no internal frame ! structure and the real stack and gdb's idea of stack are ! different if nested calls by hands are made. ! ! mvs: this worries me. */ ! level != 0) { warning ("Unable to restore previously selected frame.\n"); return 0; --- 4004,4017 ---- struct restore_selected_frame_args *fr = (struct restore_selected_frame_args *) args; struct frame_info *frame; + CORE_ADDR frame_address = fr->frame_address; int level = fr->level; ! frame = find_frame_addr_in_frame_chain (frame_address); /* If inf_status->selected_frame_address is NULL, there was no previously selected frame. */ ! if (frame == NULL) { warning ("Unable to restore previously selected frame.\n"); return 0; -- Jim Ingham jingham@apple.com Developer Tools - gdb Apple Computer