This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Improve i386 prologue analyzer
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Cc: mec at shout dot net
- Date: Mon, 18 Aug 2003 01:15:40 +0200 (CEST)
- Subject: [PATCH] Improve i386 prologue analyzer
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;