From 99ab4326f1095f50d2991b6f633337e7d92e1134 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sun, 17 Aug 2003 23:16:44 +0000 Subject: [PATCH] * i386-tdep.c (i386_analyze_register_saves): Handle register saves at the start of a frameless function. This probably fixes PR backtrace/1338. --- gdb/ChangeLog | 6 ++++++ gdb/i386-tdep.c | 29 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f8d0e2c787a..4ac481d4136 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-08-18 Mark Kettenis + + * i386-tdep.c (i386_analyze_register_saves): Handle register saves + at the start of a frameless function. This probably fixes PR + backtrace/1338. + 2003-08-17 Michael Chastain * symfile.c (find_sym_fns): Remove special case for apollo target. diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 2c7afca7a33..9aa20d6e1b8 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -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; -- 2.30.2