From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8347 invoked by alias); 3 Jan 2006 18:41:26 -0000 Received: (qmail 8340 invoked by uid 22791); 3 Jan 2006 18:41:25 -0000 X-Spam-Check-By: sourceware.org Received: from 203.197.88.2.ILL-PUNE.static.vsnl.net.in (HELO marvin.codito.net) (203.197.88.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 03 Jan 2006 18:41:23 +0000 Received: from zirakzigil.codito.co.in ([220.225.32.98]) (authenticated bits=0) by marvin.codito.net (8.13.5/8.13.5/Debian-3) with ESMTP id k03IF9r4025188 for ; Tue, 3 Jan 2006 23:45:14 +0530 Subject: Fix for PR 1971 . From: Ramana Radhakrishnan Reply-To: ramana.radhakrishnan@codito.com To: gdb-patches@sources.redhat.com Content-Type: multipart/mixed; boundary="=-UGxiGtJOpRntt8G12RS8" Date: Tue, 03 Jan 2006 18:41:00 -0000 Message-Id: <1136312069.8808.24.camel@localhost.localdomain> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00012.txt.bz2 --=-UGxiGtJOpRntt8G12RS8 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 791 Hi , Attached is a fix for PR 1971. This inserts a breakpoint at the return address for a function that does not have a previous frame which is what you have in the case of main. This would however not stop after the return from main because the semantics of the next command would not stop the execution in any place where there is no debug information. Tested on native x86 with today's head as well as 6.4 branch with no extra regressions . Ok to commit with an additional testcase ? cheers Ramana 2006-01-03 Ramana Radhakrishnan PR 1971 * infrun.c (handle_inferior_event): Handle case where previous frame can be NULL. Use insert_step_resume_breakpoint_at_sal instead. -- Ramana Radhakrishnan GNU Tools codito ergo sum (www.codito.com) --=-UGxiGtJOpRntt8G12RS8 Content-Disposition: attachment; filename=patch-pr1971 Content-Type: text/x-patch; name=patch-pr1971; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 1187 Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.208 diff -u -a -u -r1.208 infrun.c --- infrun.c 17 Dec 2005 22:34:01 -0000 1.208 +++ infrun.c 3 Jan 2006 17:48:16 -0000 @@ -2390,8 +2390,22 @@ /* We're doing a "next", set a breakpoint at callee's return address (the address at which the caller will resume). */ - insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ())); - keep_going (ecs); + /* We're doing a "next", set a breakpoint at callee's return + address (the address at which the caller will + resume). */ + if (get_prev_frame ( get_current_frame ())) + { + insert_step_resume_breakpoint_at_frame (get_prev_frame (get_current_frame ())); + } + else + { + struct symtab_and_line sr_sal; + init_sal (&sr_sal); /* initialize to zeros */ + sr_sal.pc = ADDR_BITS_REMOVE (gdbarch_unwind_pc (current_gdbarch,get_current_frame())); + sr_sal.section = find_pc_overlay (sr_sal.pc); + insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id); + } + keep_going (ecs); return; } --=-UGxiGtJOpRntt8G12RS8--