Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sourceware.org
Subject: Re: Improve end check on rs6000 prologue analyzer
Date: Tue, 17 Apr 2007 02:02:00 -0000	[thread overview]
Message-ID: <je647wz4r3.fsf@sykes.suse.de> (raw)
In-Reply-To: <20070309150504.GA5166@caradoc.them.org> (Daniel Jacobowitz's 	message of "Fri, 9 Mar 2007 10:05:04 -0500")

Daniel Jacobowitz <drow@false.org> writes:

> 2007-03-09  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* rs6000-tdep.c (rs6000_skip_prologue): Use skip_prologue_using_sal.

This is causing a regression when the function is very small.

$ cat prologue.c
int foo ()
{
  return 0;
}

int main (void)
{
  return foo ();
}
$ gcc -O2 -g prologue.c
$ gdb a.out
GNU gdb 6.6.50.20070416-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-suse-linux"...
Using host libthread_db library "/lib/power4/libthread_db.so.1".
(gdb) b foo
Breakpoint 1 at 0x10000490: file prologue.c, line 8.
(gdb) i b
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x10000490 in main at prologue.c:8
(gdb) 

Note that the breakpoint is actually in main, not in foo.  The problem is
that skip_prologue_using_sal does not properly handle a function with only
one sal if the pc of the next line is bigger than the end pc of the
current function.

Andreas.

2007-04-16  Andreas Schwab  <schwab@suse.de>

	* symtab.c (skip_prologue_using_sal): Allow the end of the prologue
	sal to be bigger than the end of the function.

--- gdb/symtab.c.~1.156.~	2007-03-28 12:57:45.000000000 +0200
+++ gdb/symtab.c	2007-04-16 17:39:04.000000000 +0200
@@ -4111,7 +4111,7 @@ skip_prologue_using_sal (CORE_ADDR func_
       /* 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)
+      if (prologue_sal.end >= end_pc)
 	return 0;
       while (prologue_sal.end < end_pc)
 	{

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


  parent reply	other threads:[~2007-04-16 16:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29 21:37 Daniel Jacobowitz
2006-09-30 19:32 ` Mark Kettenis
2006-09-30 20:25   ` Daniel Jacobowitz
2006-10-17 21:21   ` Daniel Jacobowitz
2006-10-17 22:15     ` Mark Kettenis
2006-10-18  5:41     ` Wu Zhou
2006-10-18 14:18       ` Daniel Jacobowitz
2006-10-18 19:58     ` Mark Kettenis
2006-10-18 20:06       ` Daniel Jacobowitz
2006-11-30 20:12         ` Daniel Jacobowitz
2007-02-15 20:20           ` Aman Wardak
2007-03-09 15:05       ` Daniel Jacobowitz
2007-03-11 19:13         ` Mark Kettenis
2007-03-12 12:19           ` Daniel Jacobowitz
2007-03-12 21:02             ` Mark Kettenis
2007-03-12 21:09               ` Daniel Jacobowitz
2007-03-12 23:05                 ` Mark Kettenis
2007-03-13  4:24                   ` Eli Zaretskii
2007-04-10 21:10                     ` Daniel Jacobowitz
2007-04-11  3:35                       ` Eli Zaretskii
2007-04-11 11:11                         ` Daniel Jacobowitz
2007-03-13 17:37                   ` Daniel Jacobowitz
2007-04-17  2:02         ` Andreas Schwab [this message]
2007-04-17 15:02           ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=je647wz4r3.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox