public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* nodebug and noeh frame unwind tests
@ 2008-01-23 14:33 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2008-01-23 14:33 UTC (permalink / raw)
  To: frysk

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

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  <mwielaard@redhat.com>

    * 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  <mwielaard@redhat.com>

    * 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

[-- Attachment #2: frame-tests.patch --]
[-- Type: text/x-patch, Size: 16039 bytes --]

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-23 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-23 14:33 nodebug and noeh frame unwind tests Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).