From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26447 invoked by alias); 10 May 2006 15:13:22 -0000 Received: (qmail 26436 invoked by uid 22791); 10 May 2006 15:13:21 -0000 X-Spam-Check-By: sourceware.org Received: from w099.z064220152.sjc-ca.dsl.cnc.net (HELO duck.specifix.com) (64.220.152.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 10 May 2006 15:13:11 +0000 Received: from [::1] (duck.specifix.com [64.220.152.99]) by duck.specifix.com (Postfix) with ESMTP id DB43741EB for ; Wed, 10 May 2006 08:13:09 -0700 (PDT) From: Fred Fish Reply-To: fnf@specifix.com To: gdb-patches@sourceware.org Subject: [RFA] Patch to skip_prologue_using_sal() for oneline stub functions Date: Wed, 10 May 2006 15:13:00 -0000 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605101113.50267.fnf@specifix.com> 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-05/txt/msg00193.txt.bz2 If a function optimizes down to a single return instruction, there is no prologue, and skip_prologue_using_sal will return a PC that is probably the first instruction of the next following function. In this case, we want to return the start_pc, so that the caller will know that it needs to run the architecture specific prologue scanner to figure out what is going on. This fixes the following failures for MIPS: FAIL: gdb.base/break.exp: breakpoint small function, optimized file FAIL: gdb.base/break.exp: run until function breakpoint, optimized file FAIL: gdb.base/break.exp: run until breakpoint set at small function, optimized file -Fred ============================================================================ 2006-05-10 Fred Fish * symtab.c (skip_prologue_using_sal): Handle single line functions like "foo(){}", which may optimize down to a single return inst. Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.146 diff -c -p -r1.146 symtab.c *** symtab.c 17 Dec 2005 22:34:03 -0000 1.146 --- symtab.c 10 May 2006 14:19:07 -0000 *************** skip_prologue_using_sal (CORE_ADDR func_ *** 4030,4035 **** --- 4030,4040 ---- prologue_sal = find_pc_line (start_pc, 0); if (prologue_sal.line != 0) { + /* If there is only one sal that covers the entire function, + then it is probably a single line function, like + "foo(){}". */ + if (prologue_sal.end == end_pc) + return start_pc; while (prologue_sal.end < end_pc) { struct symtab_and_line sal;