This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] fix for avr_skip_prologue.
- From: Theodore Roth <troth at verinet dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 5 Aug 2002 11:30:28 -0600 (MDT)
- Subject: [PATCH] fix for avr_skip_prologue.
I've committed this.
Thanks for the review Andrew.
Ted Roth
2002-08-05 Theodore A. Roth <troth@verinet.com>
* gdb/avr-tdep.c(avr_skip_prologue): Fix to return the correct pc.
Index: gdb/avr-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/avr-tdep.c,v
retrieving revision 1.5
diff -u -r1.5 avr-tdep.c
--- gdb/avr-tdep.c 30 Jul 2002 13:45:13 -0000 1.5
+++ gdb/avr-tdep.c 5 Aug 2002 17:25:49 -0000
@@ -996,7 +996,14 @@
{
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;
}