From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9925 invoked by alias); 26 Oct 2007 15:42:11 -0000 Received: (qmail 9916 invoked by uid 22791); 26 Oct 2007 15:42:10 -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, 26 Oct 2007 15:42:07 +0000 Received: from wildebeest.demon.nl ([83.160.170.119] helo=[127.0.0.1]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1IlRK0-0000vs-2G for frysk@sourceware.org; Fri, 26 Oct 2007 17:42:05 +0200 Subject: Find right frame index in TestDebugInfoStackTrace.java From: Mark Wielaard To: frysk Content-Type: multipart/mixed; boundary="=-2HP8Yd+2t/tWOL2BmR/R" Date: Fri, 26 Oct 2007 15:42:00 -0000 Message-Id: <1193413323.2931.15.camel@hermans.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 (2.12.1-3.fc8) X-Spam-Score: -4.1 (----) 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/msg00079.txt.bz2 --=-2HP8Yd+2t/tWOL2BmR/R Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 635 Hi, On a multi-core machine the TestDebugInfoStackTrace would sometimes fail because the "signal_parent" task could still be in kernel, glibc signal or kill helper functions. The following patch tries to find the right index in that thread and uses that for the tests. 2007-10-26 Mark Wielaard * TestDebugInfoStackTrace.java (frameAssertions): Find and use correct thread_parent task frame index. This makes this test reliably pass on my machine now even with different frame index depths. But I found the test really hard to read so I wouldn't mind someone double checking the fix. Cheers, Mark --=-2HP8Yd+2t/tWOL2BmR/R Content-Disposition: attachment; filename=TestDebugInfoStackTrace.patch Content-Type: text/x-patch; name=TestDebugInfoStackTrace.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 3140 diff --git a/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java b/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java index bbeb433..91a697b 100644 --- a/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java +++ b/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2006, Red Hat Inc. +// Copyright 2005, 2006, 2007, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -400,17 +400,28 @@ public class TestDebugInfoStackTrace assertNotNull(this.frameTracker[lowest][8][3]); assertEquals(0, Integer.parseInt(this.frameTracker[lowest][8][4])); - int index = 1; + int index = 0; for (int i = 0; i < 3; i++) { - if (this.frameTracker[i][1][2].equals("signal_parent")) - next = i; - else if (this.frameTracker[i][1][2].equals("kill")) - { - index = 2; - next = i; - break; - } + index = 0; + // We are looking for the thread that has signal_parent, + // but could still be in the kernel/syscall/kill. + String frameName = this.frameTracker[i][index][2]; + + while (frameName == null + || frameName.indexOf("kill") > 0 + || frameName.indexOf("syscall") > 0) + { + index++; + frameName = this.frameTracker[i][index][2]; + } + + if (frameName.equals("signal_parent")) + { + next = i; + break; + } + } /* Second thread assertions */ @@ -470,19 +481,22 @@ public class TestDebugInfoStackTrace assertNotNull(this.frameTracker[last][4][3]); assertEquals(130, Integer.parseInt(this.frameTracker[last][4][4])); - assertEquals("", this.frameTracker[next][2][1]); - assertEquals("start_thread", this.frameTracker[next][2][2]); - assertNotNull(this.frameTracker[next][2][3]); - assertEquals(0, Integer.parseInt(this.frameTracker[next][2][4])); + assertEquals("", this.frameTracker[next][index][1]); + + index--; + assertEquals("start_thread", this.frameTracker[next][index][2]); + assertNotNull(this.frameTracker[next][index][3]); + assertEquals(0, Integer.parseInt(this.frameTracker[next][index][4])); - assertEquals("", this.frameTracker[next][3][1]); + index++; + assertEquals("", this.frameTracker[next][index][1]); // if (MachineType.getMachineType() == MachineType.IA32) // assertEquals("__clone", this.frameTracker[next][3][2]); // if (MachineType.getMachineType() == MachineType.X8664) // assertEquals("(__)?clone", this.frameTracker[next][3][2]); - assertTrue(this.frameTracker[next][3][2].matches("(__)?clone")); - assertNotNull(this.frameTracker[next][3][3]); - assertEquals(0, Integer.parseInt(this.frameTracker[next][3][4])); + assertTrue(this.frameTracker[next][index][2].matches("(__)?clone")); + assertNotNull(this.frameTracker[next][index][3]); + assertEquals(0, Integer.parseInt(this.frameTracker[next][index][4])); Manager.eventLoop.requestStop(); } --=-2HP8Yd+2t/tWOL2BmR/R--