From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21017 invoked by alias); 19 Jul 2002 18:44:29 -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 21008 invoked from network); 19 Jul 2002 18:44:29 -0000 Received: from unknown (HELO io.frii.com) (216.17.222.1) by sources.redhat.com with SMTP; 19 Jul 2002 18:44:29 -0000 Received: from io.frii.com (localhost.frii.com [127.0.0.1]) by io.frii.com (8.12.5/8.12.5) with ESMTP id g6JIiS8C029017 for ; Fri, 19 Jul 2002 12:44:28 -0600 (MDT) Received: from localhost (troth@localhost) by io.frii.com (8.12.5/8.12.5/Submit) with ESMTP id g6JIiS36029014 for ; Fri, 19 Jul 2002 12:44:28 -0600 (MDT) X-Authentication-Warning: io.frii.com: troth owned process doing -bs Date: Fri, 19 Jul 2002 11:52:00 -0000 From: Theodore Roth X-X-Sender: troth@io.frii.com To: gdb-patches@sources.redhat.com Subject: [RFC] fix for avr_skip_prologue() Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-07/txt/msg00420.txt.bz2 Hi, Before I commit this, I wanted to know if this is the correct fix or just an evil hack side-stepping the some other problem. The problem shows up when I set a break point on a simple function as such: (gdb) b foo_simple If foo_simple() has no prologue, the break point is set at the _end_ of the function (effectively the return insn). If this fix is acceptable, is it too late to make it into the 5.2 branch? Ted Roth 2002-07-19 Theodore A. Roth * gdb/avr-tdep.c(avr_skip_prologue): Fix to return the correct pc. Index: gdb/avr-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/avr-tdep.c,v retrieving revision 1.4 diff -u -p -r1.4 avr-tdep.c --- gdb/avr-tdep.c 17 Jun 2002 23:32:27 -0000 1.4 +++ gdb/avr-tdep.c 19 Jul 2002 18:33:30 -0000 @@ -995,7 +995,12 @@ avr_skip_prologue (CORE_ADDR pc) { sal = find_pc_line (func_addr, 0); - if (sal.line != 0 && sal.end < func_end) + /* troth/2002-70-19: For some very simple functions, gcc doesn't + generate a prologue and the sal.end ends up being the insn (2 bytes) + before func_end (the address of the next func). By adjusting + func_end, we can catch these functions and return the correct pc. */ + + if (sal.line != 0 && sal.end < (func_end-2)) return sal.end; }