This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Add another sequence that fallback_backtrace() for i386 recognises as a function prologue
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 19 Aug 2006 21:09:42 +0530
- Subject: FYI: Add another sequence that fallback_backtrace() for i386 recognises as a function prologue
- Openpgp: url=http://ranjitmathew.hostingzero.com/aa_6C114B8F.txt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Based on Olivier Parisy's initial bug report and subsequent
confirmation of the utility of a suggested patch:
http://gcc.gnu.org/ml/java/2006-08/msg00068.html
I've committed the attached patch to the trunk to make
fallback_backtrace() recognise another sequence of bytes
as an encoding for "pushl %ebp; movl %esp, %ebp".
Tested via an i686-pc-linux-gnu to i686-pc-mingw32
cross-compiler.
Thanks,
Ranjit.
- --
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://rmathew.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE5zC9Yb1hx2wRS48RAve1AKCET9ACZ58FubxTcIwfGbphiZLsFQCgojs1
Bsxx9vCv8f7V08AC0epwQbM=
=dg+e
-----END PGP SIGNATURE-----
Index: ChangeLog
from Ranjit Mathew <rmathew@gcc.gnu.org>
* sysdep/i386/backtrace.h (fallback_backtrace): Add "0x55 0x8B 0xEC"
as another sequence that can indicate a "pushl %ebp; movl %esp, %ebp"
function prologue.
Index: sysdep/i386/backtrace.h
===================================================================
--- sysdep/i386/backtrace.h (revision 116257)
+++ sysdep/i386/backtrace.h (working copy)
@@ -71,8 +71,9 @@ fallback_backtrace (_Unwind_Trace_Fn tra
/* Try to locate a "pushl %ebp; movl %esp, %ebp" function prologue
by scanning backwards at even addresses below the return address.
- This instruction sequence is encoded as 0x55 0x89 0xE5. We give up
- if we do not find this sequence even after scanning 1024K of memory.
+ This instruction sequence is encoded either as 0x55 0x89 0xE5 or as
+ 0x55 0x8B 0xEC. We give up if we do not find this sequence even
+ after scanning 1024K of memory.
FIXME: This is not robust and will probably give us false positives,
but this is about the best we can do if we do not have DWARF-2 unwind
information based exception handling. */
@@ -83,8 +84,9 @@ fallback_backtrace (_Unwind_Trace_Fn tra
for ( ; scan_addr >= limit_addr; scan_addr -= 2)
{
unsigned char *scan_bytes = (unsigned char *)scan_addr;
- if (scan_bytes[0] == 0x55 && scan_bytes[1] == 0x89
- && scan_bytes[2] == 0xE5)
+ if (scan_bytes[0] == 0x55
+ && ((scan_bytes[1] == 0x89 && scan_bytes[2] == 0xE5)
+ || (scan_bytes[1] == 0x8B && scan_bytes[2] == 0xEC)))
{
ctx.meth_addr = scan_addr;
break;