From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10788 invoked by alias); 6 Jul 2007 15:02:13 -0000 Received: (qmail 10759 invoked by uid 22791); 6 Jul 2007 15:02:04 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,FORGED_RCVD_HELO X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (83.160.170.119) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 06 Jul 2007 15:01:59 +0000 Received: from dijkstra.wildebeest.org ([192.168.1.29]) by gnu.wildebeest.org with esmtp (Exim 4.43) id 1I6pM9-0002N0-6d for frysk@sourceware.org; Fri, 06 Jul 2007 17:04:25 +0200 Subject: [patch] Check for SYSCALL on x86_64 after "spurious" step/trap From: Mark Wielaard To: frysk@sourceware.org Content-Type: multipart/mixed; boundary="=-cE4Liwf8ytv8QA6owT//" Date: Fri, 06 Jul 2007 15:02:00 -0000 Message-Id: <1183734114.3651.82.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.8.3 (2.8.3-2.fc6) X-Spam-Score: -4.4 (----) X-Virus-Checked: Checked by ClamAV on sourceware.org X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00043.txt.bz2 --=-cE4Liwf8ytv8QA6owT// Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 920 Hi, On some x86_64 kernels you will get a trapped event after a step out of a syscall, but the stepping flag isn't set in that case. This is at least the case at least on 2.6.18-8.1.6.el5, but not on any of the Fedora kernels I ever tested with, currently 2.6.20-1.2962.fc6. Luckily the Isa has a way to signal such an event and this patch updates the X86_64 Isa as follows to handle this: 2007-07-06 Mark Wielaard * IsaX8664.java hasExecutedSpuriousTrap): Check for SYSCALL instruction. This makes the following testcases PASS on such kernels and doesn't change the results on any other system I tested on: testSteppingtestHitAndRun(frysk.proc.TestBreakpoints) ...PASS testSteppingtestInsertRemove(frysk.proc.TestBreakpoints) ...PASS testSteppingAddLots(frysk.proc.TestBreakpoints) ...PASS testStepSigReturn(frysk.proc.TestTaskObserverInstructionSigReturn) ...PASS Cheers, Mark --=-cE4Liwf8ytv8QA6owT// Content-Description: Content-Disposition: inline; filename=isa-update.patch Content-Type: text/x-patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 1031 Index: frysk-core/frysk/proc/IsaX8664.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/proc/IsaX8664.java,v retrieving revision 1.18 diff -u -r1.18 IsaX8664.java --- frysk-core/frysk/proc/IsaX8664.java 5 Jul 2007 12:40:28 -0000 1.18 +++ frysk-core/frysk/proc/IsaX8664.java 6 Jul 2007 14:49:25 -0000 @@ -336,12 +336,15 @@ * attributed to entering a signal handler or a normal step * instruction notification. * - * x86_64 doesn't generate spurious trap events and this method - * always returns false on this architecture. + * On some kernels x86_64 doesn't generate spurious trap events (or + * rather doesn't set the stepping flag) after returning from a + * SYSCALL instruction. */ public boolean hasExecutedSpuriousTrap(Task task) { - return false; + long address = pc(task); + return (task.getMemory().getByte(address - 1) == (byte) 0x05 + && task.getMemory().getByte(address - 2) == (byte) 0x0f); } /** --=-cE4Liwf8ytv8QA6owT//--