aboutsummaryrefslogtreecommitdiff
path: root/gdb/avr-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/avr-tdep.c')
-rw-r--r--gdb/avr-tdep.c9
1 files changed, 8 insertions, 1 deletions
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;
}