From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16173 invoked by alias); 23 Jan 2008 14:33:19 -0000 Received: (qmail 16147 invoked by uid 22791); 23 Jan 2008 14:33:11 -0000 X-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_66 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; Wed, 23 Jan 2008 14:32:36 +0000 Received: from dijkstra.wildebeest.org ([192.168.1.29]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1JHgeV-0005a3-Uo for frysk@sourceware.org; Wed, 23 Jan 2008 15:32:33 +0100 Subject: nodebug and noeh frame unwind tests From: Mark Wielaard To: frysk Content-Type: multipart/mixed; boundary="=-OZffR7Cskbdrt+TkgkcY" Date: Wed, 23 Jan 2008 14:33:00 -0000 Message-Id: <1201098751.3092.17.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.12.2 (2.12.2-3.fc8) X-Spam-Score: -4.2 (----) 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: 2008-q1/txt/msg00039.txt.bz2 --=-OZffR7Cskbdrt+TkgkcY Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1544 Hi, This patch adds semi-automated frame (unwind) tests by adding Makefile rules to generate debug_frame less or eh_frame less versions of various funit-test programs. All tests are now run 3 times, once with all info available, once with only debug_frame available and once with only eh_frame available. This depends on both being available by default because Makefile.rules makes sure gcc gets both the -g and -fasynchronous-unwind-tables flags (the last is the default on various systems like fedora, but is added explicitly in the build for other systems - or if the user might happen to use upstream gcc). frysk-core/ChangeLog: 2008-01-23 Mark Wielaard * Makefile.am: Add rules to create -nodebug and -noeh versions of funit-stacks, funit-empty-functions, funit-stacks-exit, funit-scopes, funit-scopes-workaround, funit-stack-inlined, funit-stacks-values, funit-stacks-linenum and funit-cpp-scopes-class. frysk-core/frysk/debuginfo/ChangeLog: 2008-01-23 Mark Wielaard * TestFrameDebugInfo.java: Add NoDebug and NoEH variants of testFrameDebugInfoStackTrace, testFrameCompilerInlinedFunctions, testFrameAdjustedAddress, testFrameScopes, testDebugInfoFrameScopes, testFrameScopesWorkAround, testGetInlinedSubroutines, testVirtualStackTrace, testInlinedFunctionDerailment, testLineNumbers and testThatArtificialParametersAreIgnored. Various of these tests failed before all the libunwind debug_frame patches were in place. Cheers, Mark --=-OZffR7Cskbdrt+TkgkcY Content-Disposition: inline; filename=frame-tests.patch Content-Type: text/x-patch; name=frame-tests.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 16039 diff --git a/frysk-core/Makefile.am b/frysk-core/Makefile.am index 9f8581b..10d88cc 100644 --- a/frysk-core/Makefile.am +++ b/frysk-core/Makefile.am @@ -97,6 +97,121 @@ installcheck-funit: # Create executables for type tests for TestTypeEntry.java. frysk/debuginfo/TestTypeEntry.java: frysk/pkglibdir/funit-type-entry.c +# Executable without debug_frame and without eh_frame for Frame tests. +# Note that this depends on both being available by default because +# Makefile.rules adds both -g and -fasynchronous-unwind-tables +# WARNING. eh_frames can only be removed if it isn't used during runtime +# of the test program (in particular c++ exceptions). + +# funit-stacks +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-noeh +frysk_pkglibdir_funit_stacks_nodebug_SOURCES = +frysk_pkglibdir_funit_stacks_noeh_SOURCES = +frysk/pkglibdir/funit-stacks-nodebug: frysk/pkglibdir/funit-stacks + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-stacks $@ +frysk/pkglibdir/funit-stacks-noeh: frysk/pkglibdir/funit-stacks + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-stacks $@ + +# funit-empty-functions +pkglib_PROGRAMS += frysk/pkglibdir/funit-empty-functions-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-empty-functions-noeh +frysk_pkglibdir_funit_empty_functions_nodebug_SOURCES = +frysk_pkglibdir_funit_empty_functions_noeh_SOURCES = +frysk/pkglibdir/funit-empty-functions-nodebug: frysk/pkglibdir/funit-empty-functions + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-empty-functions $@ +frysk/pkglibdir/funit-empty-functions-noeh: frysk/pkglibdir/funit-empty-functions + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-empty-functions $@ + +# funit-stacks-exit +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-exit-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-exit-noeh +frysk_pkglibdir_funit_stacks_exit_nodebug_SOURCES = +frysk_pkglibdir_funit_stacks_exit_noeh_SOURCES = +frysk/pkglibdir/funit-stacks-exit-nodebug: frysk/pkglibdir/funit-stacks-exit + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-stacks-exit $@ +frysk/pkglibdir/funit-stacks-exit-noeh: frysk/pkglibdir/funit-stacks-exit + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-stacks-exit $@ + +# funit-scopes +pkglib_PROGRAMS += frysk/pkglibdir/funit-scopes-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-scopes-noeh +frysk_pkglibdir_funit_scopes_nodebug_SOURCES = +frysk_pkglibdir_funit_scopes_noeh_SOURCES = +frysk/pkglibdir/funit-scopes-nodebug: frysk/pkglibdir/funit-scopes + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-scopes $@ +frysk/pkglibdir/funit-scopes-noeh: frysk/pkglibdir/funit-scopes + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-scopes $@ + +# funit-scopes-workaround +pkglib_PROGRAMS += frysk/pkglibdir/funit-scopes-workaround-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-scopes-workaround-noeh +frysk_pkglibdir_funit_scopes_workaround_nodebug_SOURCES = +frysk_pkglibdir_funit_scopes_workaround_noeh_SOURCES = +frysk/pkglibdir/funit-scopes-workaround-nodebug: frysk/pkglibdir/funit-scopes-workaround + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-scopes-workaround $@ +frysk/pkglibdir/funit-scopes-workaround-noeh: frysk/pkglibdir/funit-scopes-workaround + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-scopes-workaround $@ + +# funit-stack-inlined +pkglib_PROGRAMS += frysk/pkglibdir/funit-stack-inlined-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-stack-inlined-noeh +frysk_pkglibdir_funit_stack_inlined_nodebug_SOURCES = +frysk_pkglibdir_funit_stack_inlined_noeh_SOURCES = +frysk/pkglibdir/funit-stack-inlined-nodebug: frysk/pkglibdir/funit-stack-inlined + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-stack-inlined $@ +frysk/pkglibdir/funit-stack-inlined-noeh: frysk/pkglibdir/funit-stack-inlined + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-stack-inlined $@ + +# funit-stacks-values +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-values-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-values-noeh +frysk_pkglibdir_funit_stacks_values_nodebug_SOURCES = +frysk_pkglibdir_funit_stacks_values_noeh_SOURCES = +frysk/pkglibdir/funit-stacks-values-nodebug: frysk/pkglibdir/funit-stacks-values + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-stacks-values $@ +frysk/pkglibdir/funit-stacks-values-noeh: frysk/pkglibdir/funit-stacks-values + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-stacks-values $@ + +# funit-stacks-linenum +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-linenum-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-stacks-linenum-noeh +frysk_pkglibdir_funit_stacks_linenum_nodebug_SOURCES = +frysk_pkglibdir_funit_stacks_linenum_noeh_SOURCES = +frysk/pkglibdir/funit-stacks-linenum-nodebug: frysk/pkglibdir/funit-stacks-linenum + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-stacks-linenum $@ +frysk/pkglibdir/funit-stacks-linenum-noeh: frysk/pkglibdir/funit-stacks-linenum + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-stacks-linenum $@ + +# funit-cpp-scopes-class +pkglib_PROGRAMS += frysk/pkglibdir/funit-cpp-scopes-class-nodebug +pkglib_PROGRAMS += frysk/pkglibdir/funit-cpp-scopes-class-noeh +frysk_pkglibdir_funit_cpp_scopes_class_nodebug_SOURCES = +frysk_pkglibdir_funit_cpp_scopes_class_noeh_SOURCES = +frysk/pkglibdir/funit-cpp-scopes-class-nodebug: frysk/pkglibdir/funit-cpp-scopes-class + objcopy --remove-section=.debug_frame \ + frysk/pkglibdir/funit-cpp-scopes-class $@ +frysk/pkglibdir/funit-cpp-scopes-class-noeh: frysk/pkglibdir/funit-cpp-scopes-class + objcopy --remove-section=.eh_frame_hdr --remove-section=.eh_frame \ + frysk/pkglibdir/funit-cpp-scopes-class $@ + + # Create executables for symbol tests for TestSymbol.java. pkglib_PROGRAMS += frysk/pkglibdir/funit-symbols-nodebug diff --git a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java index 3cf8375..3a8e7a8 100644 --- a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java +++ b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, 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 @@ -69,10 +69,25 @@ public class TestFrameDebugInfo /// I am not looking at what you are typing. I just have to see ya type Logger logger = Logger.getLogger("frysk"); - public void testFrameDebugInfoStackTrace () + public void testFrameDebugInfoStackTrace() + { + frameDebugInfoStackTrace(""); + } + + public void testFrameDebugInfoStackTraceNoDebug() + { + frameDebugInfoStackTrace("-nodebug"); + } + + public void testFrameDebugInfoStackTraceNoEH() + { + frameDebugInfoStackTrace("-noeh"); + } + + public void frameDebugInfoStackTrace(String ext) { - Task task = (new DaemonBlockedAtSignal("funit-stacks")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-stacks" + ext)).getMainTask(); StringWriter stringWriter = new StringWriter(); DebugInfoFrame frame = DebugInfoStackFactory.createDebugInfoStackTrace(task); @@ -86,22 +101,52 @@ public class TestFrameDebugInfo } - public void testFrameCompilerIlinedFucntions () + public void testFrameCompilerInlinedFunctions() + { + frameCompilerInlinedFunctions(""); + } + + public void testFrameCompilerInlinedFunctionsNoDebug() + { + frameCompilerInlinedFunctions("-nodebug"); + } + + public void testFrameCompilerInlinedFunctionsNoEH() + { + frameCompilerInlinedFunctions("-noeh"); + } + + public void frameCompilerInlinedFunctions(String ext) { - Task task = (new DaemonBlockedAtSignal("funit-empty-functions")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-empty-functions" + ext)).getMainTask(); DebugInfoFrame frame = DebugInfoStackFactory.createVirtualStackTrace(task); Subprogram subprogram = frame.getSubprogram(); assertNotNull(subprogram); } - public void testFrameAdjustedAddress () + public void testFrameAdjustedAddress() + { + frameAdjustedAddress(""); + } + + public void testFrameAdjustedAddressNoDebug() + { + frameAdjustedAddress("-nodebug"); + } + + public void testFrameAdjustedAddressNoEH() + { + frameAdjustedAddress("-noeh"); + } + + public void frameAdjustedAddress(String ext) { if(unresolved(4676)) return; - Task task = (new DaemonBlockedAtSignal("funit-stacks-exit")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-stacks-exit" + ext)).getMainTask(); Frame frame = StackFactory.createFrame(task); StringWriter stringWriter = new StringWriter(); @@ -116,10 +161,25 @@ public class TestFrameDebugInfo } - public void testFrameScopes () + public void testFrameScopes() { + frameScopes(""); + } - Task task = (new DaemonBlockedAtSignal("funit-scopes")).getMainTask(); + public void testFrameScopesNoDebug() + { + frameScopes("-nodebug"); + } + + public void testFrameScopesNoEH() + { + frameScopes("-noeh"); + } + + public void frameScopes(String ext) + { + + Task task = (new DaemonBlockedAtSignal("funit-scopes" + ext)).getMainTask(); Frame frame = StackFactory.createFrame(task); @@ -135,10 +195,25 @@ public class TestFrameDebugInfo } - public void testDebugInfoFrameScopes () + public void testDebugInfoFrameScopes() { + debugInfoFrameScopes(""); + } - Task task = (new DaemonBlockedAtSignal("funit-scopes")).getMainTask(); + public void testDebugInfoFrameScopesNoDebug() + { + debugInfoFrameScopes("-nodebug"); + } + + public void testDebugInfoFrameScopesNoEH() + { + debugInfoFrameScopes("-noeh"); + } + + public void debugInfoFrameScopes(String ext) + { + + Task task = (new DaemonBlockedAtSignal("funit-scopes" + ext)).getMainTask(); DebugInfoFrame frame = DebugInfoStackFactory.createDebugInfoStackTrace(task); Scope scope1 = frame.getScopes(); @@ -151,10 +226,25 @@ public class TestFrameDebugInfo } - public void testFrameScopesWorkAround () + public void testFrameScopesWorkAround() + { + frameScopesWorkAround(""); + } + + public void testFrameScopesWorkAroundNoDebug() + { + frameScopesWorkAround("-nodebug"); + } + + public void testFrameScopesWorkAroundNoEH() + { + frameScopesWorkAround("-noeh"); + } + + public void frameScopesWorkAround(String ext) { - Task task = (new DaemonBlockedAtSignal("funit-scopes-workaround")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-scopes-workaround" + ext)).getMainTask(); Frame frame = StackFactory.createFrame(task); Dwfl dwfl = DwflCache.getDwfl(task); @@ -170,10 +260,25 @@ public class TestFrameDebugInfo } - public void testGetInlinedSubroutines () + public void testGetInlinedSubroutines() + { + getInlinedSubroutines(""); + } + + public void testGetInlinedSubroutinesNoDebug() + { + getInlinedSubroutines("-nodebug"); + } + + public void testGetInlinedSubroutinesNoEH() + { + getInlinedSubroutines("-noeh"); + } + + public void getInlinedSubroutines(String ext) { - Task task = (new DaemonBlockedAtSignal("funit-stack-inlined")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-stack-inlined" + ext)).getMainTask(); DebugInfoFrame frame = DebugInfoStackFactory.createDebugInfoStackTrace(task); LinkedList inlinedSubprograms = frame.getInlinedSubprograms(); @@ -182,10 +287,25 @@ public class TestFrameDebugInfo } - public void testVirtualStackTrace () + public void testVirtualStackTrace() + { + virtualStackTrace(""); + } + + public void testVirtualStackTraceNoDebug() + { + virtualStackTrace("-nodebug"); + } + + public void testVirtualStackTraceNoEH() + { + virtualStackTrace("-noeh"); + } + + public void virtualStackTrace(String ext) { - Task task = (new DaemonBlockedAtSignal("funit-stack-inlined")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-stack-inlined" + ext)).getMainTask(); StringWriter stringWriter = new StringWriter(); DebugInfoStackFactory.printVirtualTaskStackTrace(new PrintWriter(stringWriter), task,0, true, true, true); @@ -197,13 +317,28 @@ public class TestFrameDebugInfo assertTrue("contains main", stringWriter.getBuffer().toString().contains("main")); } + public void testInlinedFunctionDerailment() + { + inlinedFunctionDerailment(""); + } + + public void testInlinedFunctionDerailmentNoDebug() + { + inlinedFunctionDerailment("-nodebug"); + } + + public void testInlinedFunctionDerailmentNoEH() + { + inlinedFunctionDerailment("-noeh"); + } + // test that a Subprogram can be retrieved for a function even // if the call stack contains calls to inlined functions inner // to it. - public void testInlinedFunctionDerailment () + public void inlinedFunctionDerailment(String ext) { - Task task = (new DaemonBlockedAtSignal("funit-stack-inlined")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-stack-inlined" + ext)).getMainTask(); DebugInfoFrame frame = DebugInfoStackFactory.createVirtualStackTrace(task); Subprogram subprogram = null; @@ -223,7 +358,22 @@ public class TestFrameDebugInfo public void testValues() throws NameNotFoundException { - Task task = (new DaemonBlockedAtSignal("funit-stacks-values")).getMainTask(); + values(""); + } + + public void testValuesNoDebug() throws NameNotFoundException + { + values("-nodebug"); + } + + public void testValuesNoEH() throws NameNotFoundException + { + values("-noeh"); + } + + public void values(String ext) throws NameNotFoundException + { + Task task = (new DaemonBlockedAtSignal("funit-stacks-values" + ext)).getMainTask(); Subprogram subprogram; DebugInfoFrame frame; Variable variable; @@ -282,8 +432,24 @@ public class TestFrameDebugInfo } - public void testLineNumbers(){ - Task task = (new DaemonBlockedAtSignal("funit-stacks-linenum")).getMainTask(); + public void testLineNumbers() + { + lineNumbers(""); + } + + public void testLineNumbersNoDebug() + { + lineNumbers("-nodebug"); + } + + public void testLineNumbersNoEH() + { + lineNumbers("-noeh"); + } + + public void lineNumbers(String ext) + { + Task task = (new DaemonBlockedAtSignal("funit-stacks-linenum" + ext)).getMainTask(); Subprogram subprogram; DebugInfoFrame frame; @@ -333,9 +499,25 @@ public class TestFrameDebugInfo assertEquals("line number", variable.getLineNumber(), 10); } - public void testThatArtificialParametersAreIgnored() { + public void testThatArtificialParametersAreIgnored() + { + artificialParametersAreIgnored(""); + } + + public void testThatArtificialParametersAreIgnoredNoDebug() + { + artificialParametersAreIgnored("-nodebug"); + } + + public void testThatArtificialParametersAreIgnoredNoEH() + { + artificialParametersAreIgnored("-noeh"); + } + + public void artificialParametersAreIgnored(String ext) + { - Task task = (new DaemonBlockedAtSignal("funit-cpp-scopes-class")).getMainTask(); + Task task = (new DaemonBlockedAtSignal("funit-cpp-scopes-class" + ext)).getMainTask(); DebugInfoFrame frame = DebugInfoStackFactory .createVirtualStackTrace(task); --=-OZffR7Cskbdrt+TkgkcY--