From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24175 invoked by alias); 27 Sep 2007 12:15:20 -0000 Received: (qmail 24043 invoked by uid 22791); 27 Sep 2007 12:15:19 -0000 X-Spam-Check-By: sourceware.org Received: from c1.complang.tuwien.ac.at (HELO c1.complang.tuwien.ac.at) (128.130.173.71) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 27 Sep 2007 12:15:14 +0000 Received: from twisti by c1.complang.tuwien.ac.at with local (Exim 4.63) (envelope-from ) id 1IasGu-0002wu-4q; Thu, 27 Sep 2007 14:15:12 +0200 Subject: Re: Problems with hook-stop From: Christian Thalinger To: Carl Shapiro Cc: gdb@sourceware.org In-Reply-To: <4dcb5abd0709260133h10aede86wb60a22094c8d9884@mail.gmail.com> References: <4dcb5abd0709260133h10aede86wb60a22094c8d9884@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 27 Sep 2007 12:35:00 -0000 Message-Id: <1190895312.11262.7.camel@c1.complang.tuwien.ac.at> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-09/txt/msg00229.txt.bz2 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