From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5899 invoked by alias); 3 Dec 2007 20:49:07 -0000 Received: (qmail 5887 invoked by uid 22791); 3 Dec 2007 20:49:06 -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; Mon, 03 Dec 2007 20:49:02 +0000 Received: from dijkstra.wildebeest.org ([192.168.1.29]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1IzIDr-0007Lf-Fv; Mon, 03 Dec 2007 21:49:00 +0100 Subject: Re: [SCM] master: Use libunwind cursor to get at CFA. From: Mark Wielaard To: Andrew Cagney Cc: frysk@sourceware.org In-Reply-To: <47542CA6.20509@redhat.com> References: <20071203105946.11374.qmail@sourceware.org> <47542CA6.20509@redhat.com> Content-Type: multipart/mixed; boundary="=-XtcBQZew9y0itLI8xqGt" Date: Mon, 03 Dec 2007 20:49:00 -0000 Message-Id: <1196714939.3072.67.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 (2.12.1-3.fc8) 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-q4/txt/msg00198.txt.bz2 --=-XtcBQZew9y0itLI8xqGt Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1080 Hi Andrew, On Mon, 2007-12-03 at 11:19 -0500, Andrew Cagney wrote: > The confusion comes from what libunwind considers to be the cursor's > CFA. It returns what you're more likely to recognize as the > inner-to-cursor's CFA and not the cursor''s CFA. Effectively the > current frame's SP, in fact: > > case UNW_X86_64_CFA: > case UNW_X86_64_RSP: > if (write) > return -UNW_EREADONLYREG; > *valp = c->dwarf.cfa; > return 0; Nice catch. Well that is somewhat of a bummer. Then we must fall back on the unwind one frame trick and get the SP again. What is somewhat worrying is that none of the tests caught this. So I added one that does fail with my change, and passes with that commit reverted. frysk-core/frysk/pkglibdir/ChangeLog 2007-12-03 Mark Wielaard * funit-stepping-asm.S: Add fifth function and _stepOverPrologue_ marker. frysk-core/frysk/stepping/ChangeLog 2007-12-03 Mark Wielaard * TestStepping.java (testASMFunctionStepOverPrologue): New test. Cheers, Mark --=-XtcBQZew9y0itLI8xqGt Content-Description: Content-Disposition: inline; filename=stepOverPrologue.patch Content-Type: text/x-patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 2508 diff --git a/frysk-core/frysk/pkglibdir/funit-stepping-asm.S b/frysk-core/frysk/pkglibdir/funit-stepping-asm.S index 4af1506..cde2b22 100644 --- a/frysk-core/frysk/pkglibdir/funit-stepping-asm.S +++ b/frysk-core/frysk/pkglibdir/funit-stepping-asm.S @@ -40,10 +40,18 @@ #include "frysk-asm.h" + FUNCTION_BEGIN(fifth,1) + FUNCTION_PROLOGUE(fifth,1) ; NO_OP // _stepOverPrologue_ + FUNCTION_EPILOGUE(fifth,1) + FUNCTION_RETURN(fifth,1) + FUNCTION_END(fifth,1) + + FUNCTION_BEGIN(fourth,0) FUNCTION_PROLOGUE(fourth,0) NO_OP // _stepAdvanceStart_ NO_OP + FUNCTION_CALL(fifth) FUNCTION_EPILOGUE(fourth,0) FUNCTION_RETURN(fourth,0) FUNCTION_END(fourth,0) diff --git a/frysk-core/frysk/stepping/TestStepping.java b/frysk-core/frysk/stepping/TestStepping.java index 7f14ea1..cab4480 100644 --- a/frysk-core/frysk/stepping/TestStepping.java +++ b/frysk-core/frysk/stepping/TestStepping.java @@ -952,6 +952,52 @@ public class TestStepping extends TestLib { cleanup(); } + /** + * Tests that the line stepper steps OK even when stack pointer + * changes. + */ + public void testASMFunctionStepOverPrologue() { + + /** Variable setup */ + String source = Config.getRootSrcDir() + + "frysk-core/frysk/pkglibdir/funit-stepping-asm.S"; + + this.scanner = new TestfileTokenScanner(new File(source)); + + /* The line number where the test begins, prologue of fifth + function. */ + int startLine = this.scanner.findTokenLine("_stepOverPrologue_"); + + /* The line number the test should end up at, still the same + line (only prologue is stepped over, not the NO_OP) */ + int endLine = this.scanner.findTokenLine("_stepOverPrologue_"); + + /* The test process */ + dbae = new DaemonBlockedAtEntry(Config + .getPkgLibFile("funit-stepping-asm")); + + Task theTask = dbae.getMainTask(); + + this.testStarted = false; + + initTaskWithTask(theTask, source, startLine, endLine); + + this.currentTest = new AssertLine(endLine, theTask); + + DebugInfoFrame frame = DebugInfoStackFactory + .createDebugInfoStackTrace(theTask); + assertTrue("Line information present", frame.getLines().length > 0); + + /** The stepping operation */ + this.se.stepOver(theTask, frame); + + this.testStarted = true; + /** Run to completion */ + assertRunUntilStop("Running test"); + cleanup(); + } + + boolean genericUpdate = false; public Task initTask(Offspring process, String source, int startLine, --=-XtcBQZew9y0itLI8xqGt--