From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25972 invoked by alias); 18 Dec 2003 19:54:08 -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 25782 invoked from network); 18 Dec 2003 19:54:07 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 18 Dec 2003 19:54:07 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id hBIJs6A15131 for ; Thu, 18 Dec 2003 14:54:06 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id hBIJs6E25682 for ; Thu, 18 Dec 2003 14:54:06 -0500 Received: from localhost.localdomain (vpn50-15.rdu.redhat.com [172.16.50.15]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id hBIJs6Ux030162 for ; Thu, 18 Dec 2003 14:54:06 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id hBIJs0D17245 for gdb-patches@sources.redhat.com; Thu, 18 Dec 2003 12:54:00 -0700 Date: Thu, 18 Dec 2003 19:54:00 -0000 From: Kevin Buettner Message-Id: <1031218195400.ZM17244@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFC] infrun.c: Fix infinite loop caused by breakpoint adjustment MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-12/txt/msg00436.txt.bz2 Any comments on the patch below? It fixes an infinite loop caused by attempting to run to a location to which it's architecturally impossible to set a breakpoint at. (It's quite easy to reproduce this problem on FR-V. Just step into some library code which has been compiled with optimization.) Since it touches infrun.c, and since a lot of developers are on holiday at this time of year, I'll wait until January 15 to commit it. Hopefully, that'll give everyone who'd like to comment on this patch a chance to look at it. Kevin * infrun.c (step_into_function): Account for possible breakpoint adjustment when computing ``stop_func_start''. Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.122 diff -u -p -r1.122 infrun.c --- infrun.c 25 Nov 2003 16:01:36 -0000 1.122 +++ infrun.c 18 Dec 2003 19:34:53 -0000 @@ -2762,6 +2762,18 @@ step_into_function (struct execution_con && ecs->sal.end < ecs->stop_func_end) ecs->stop_func_start = ecs->sal.end; + /* Architectures which require breakpoint adjustment might not be able + to place a breakpoint at the computed address. If so, the test + ``ecs->stop_func_start == stop_pc'' will never succeed. Adjust + ecs->stop_func_start to an address at which a breakpoint may be + legitimately placed. */ + if (gdbarch_adjust_breakpoint_address_p (current_gdbarch)) + { + ecs->stop_func_start + = gdbarch_adjust_breakpoint_address (current_gdbarch, + ecs->stop_func_start); + } + if (ecs->stop_func_start == stop_pc) { /* We are already there: stop now. */