This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Problems with hook-stop
- From: Christian Thalinger <twisti at complang dot tuwien dot ac dot at>
- To: Carl Shapiro <carl dot shapiro at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 27 Sep 2007 14:15:12 +0200
- Subject: Re: Problems with hook-stop
- References: <4dcb5abd0709260133h10aede86wb60a22094c8d9884@mail.gmail.com>
On Wed, 2007-09-26 at 01:33 -0700, Carl Shapiro wrote:
> Hi,
>
> I am trying to write a user-defined command hook that automatically
> passes a SIGTRAP to my program. Here is the definition I am working
> with:
>
> define hook-stop
> if (((* (char *) ($pc - 1)) & 0xff) == 0xcc)
> signal SIGTRAP
> end
> end
Hi!
I'm also searching for a solution for that problem. The reason why we
want to use the INT3 instruction on i386 and x86_64 is because we must
be able to replace a machine instruction atomically in our JIT compiler
(where "atomically" reads as "the patching instruction must not be
shorter than the patched one", for obvious reasons). And INT3 is the
only instruction that is suitable.
Right now we're using UD2, but that's only a temporary solution.
- twisti