Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb-patches@sources.redhat.com
Cc: mec@shout.net
Subject: [PATCH] Improve i386 prologue analyzer
Date: Sun, 17 Aug 2003 23:16:00 -0000	[thread overview]
Message-ID: <200308172315.h7HNFeFT040960@elgar.kettenis.dyndns.org> (raw)

Picking some low-hanging fruit :-).  This probably fixes PR
backtrace/1338.  I'll be checking this in on the branch if Michael
confirms that this fixes the bug.  I'll add a testcase shortly.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386-tdep.c (i386_analyze_register_saves): Handle register saves
	at the start of a frameless function.  This probably fixes PR
	backtrace/1338.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.165
diff -u -p -r1.165 i386-tdep.c
--- i386-tdep.c 12 Aug 2003 16:12:33 -0000 1.165
+++ i386-tdep.c 17 Aug 2003 23:11:19 -0000
@@ -571,23 +571,22 @@ static CORE_ADDR
 i386_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
 			     struct i386_frame_cache *cache)
 {
-  if (cache->locals >= 0)
-    {
-      CORE_ADDR offset;
-      unsigned char op;
-      int i;
+  CORE_ADDR offset = 0;
+  unsigned char op;
+  int i;
 
-      offset = - 4 - cache->locals;
-      for (i = 0; i < 8 && pc < current_pc; i++)
-	{
-	  op = read_memory_unsigned_integer (pc, 1);
-	  if (op < 0x50 || op > 0x57)
-	    break;
+  if (cache->locals > 0)
+    offset -= cache->locals;
+  for (i = 0; i < 8 && pc < current_pc; i++)
+    {
+      op = read_memory_unsigned_integer (pc, 1);
+      if (op < 0x50 || op > 0x57)
+	break;
 
-	  cache->saved_regs[op - 0x50] = offset;
-	  offset -= 4;
-	  pc++;
-	}
+      offset -= 4;
+      cache->saved_regs[op - 0x50] = offset;
+      cache->sp_offset += 4;
+      pc++;
     }
 
   return pc;


             reply	other threads:[~2003-08-17 23:16 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-17 23:16 Mark Kettenis [this message]
2003-08-17 23:34 Michael Elizabeth Chastain
2003-08-18  9:42 Michael Elizabeth Chastain
2003-08-18 17:17 ` Mark Kettenis
2004-08-01 21:58 Mark Kettenis
2004-08-02  4:04 ` Eli Zaretskii
2004-08-02 21:19   ` Andrew Cagney
2004-08-03  3:55     ` Eli Zaretskii
2004-08-06 19:33       ` Mark Kettenis
2004-08-06 20:29         ` Andrew Cagney
2004-08-07 15:37           ` Eli Zaretskii
2004-08-07 16:20             ` Andrew Cagney
2004-08-07 17:11               ` Eli Zaretskii
2004-08-07 17:38                 ` Andrew Cagney
2004-08-07 18:30               ` Joel Brobecker
2004-08-07 18:52                 ` Andrew Cagney
2004-08-07 22:41               ` Michael Chastain
2004-08-08  3:57                 ` Eli Zaretskii
2004-08-08 10:24                   ` Michael Chastain
2004-08-08 11:08                     ` Mark Kettenis
2004-08-08 14:08                       ` Andrew Cagney
2004-08-08 15:04                         ` Mark Kettenis
2004-08-08 19:32                         ` Eli Zaretskii
2004-08-09 13:59                           ` Andrew Cagney
2004-08-09 15:07                             ` Mark Kettenis
2004-08-09 16:46                             ` Michael Chastain
2004-08-09 19:09                             ` Eli Zaretskii
2004-08-11  0:02                               ` Andrew Cagney
2004-08-11  3:53                                 ` Eli Zaretskii
2004-08-11 17:13                                   ` Andrew Cagney
2004-08-11 17:55                                     ` Eli Zaretskii
2004-08-12 12:43                                       ` Andrew Cagney
2004-08-12 19:00                                         ` Eli Zaretskii
2004-08-12 21:41                                           ` Andrew Cagney
2004-08-08 19:29                       ` Eli Zaretskii
2004-08-08 19:28                     ` Eli Zaretskii
2004-08-07 15:31         ` Eli Zaretskii

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=200308172315.h7HNFeFT040960@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec@shout.net \
    /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