2002-08-19 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / avr-tdep.c
index 21b179c1c5aa256b72404174eac3e86a179832dd..79d0af19df3efec2e995f852b0487575f745d34c 100644 (file)
@@ -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;
     }
 
This page took 0.023913 seconds and 4 git commands to generate.