From ced15480d01bd4e4650619a3c3c0df85d8cfaf50 Mon Sep 17 00:00:00 2001 From: "Theodore A. Roth" Date: Mon, 5 Aug 2002 17:27:55 +0000 Subject: [PATCH] * gdb/avr-tdep.c(avr_skip_prologue): Fix to return the correct pc. --- gdb/ChangeLog | 4 ++++ gdb/avr-tdep.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b999f73..80b4df3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2002-08-05 Theodore A. Roth + + * gdb/avr-tdep.c(avr_skip_prologue): Fix to return the correct pc. + 2002-08-05 Andrew Cagney * mcore-tdep.c (mcore_gdbarch_init): Use diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 21b179c..79d0af1 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -996,7 +996,14 @@ avr_skip_prologue (CORE_ADDR pc) { sal = find_pc_line (func_addr, 0); - if (sal.line != 0 && sal.end < func_end) + /* troth/2002-08-05: For some very simple functions, gcc doesn't + generate a prologue and the sal.end ends up being the 2-byte ``ret'' + instruction at the end of the function, but func_end ends up being + the address of the first instruction of the _next_ function. By + adjusting func_end by 2 bytes, we can catch these functions and not + return sal.end if it is the ``ret'' instruction. */ + + if (sal.line != 0 && sal.end < (func_end-2)) return sal.end; } -- 2.7.4