public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: swagiaal: fixed broken tests.
@ 2008-06-03 18:09 swagiaal
  0 siblings, 0 replies; only message in thread
From: swagiaal @ 2008-06-03 18:09 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  e6a47641818cfc898f84505e7d1252e9c0f4a6b2 (commit)
      from  93b19c557bbbf3e77df8259633ec034b97ad20de (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit e6a47641818cfc898f84505e7d1252e9c0f4a6b2
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Mon Jun 2 17:19:42 2008 -0400

    swagiaal: fixed broken tests.
    
    frysk-core/frysk/debuginfo/ChangeLog
    +2008-06-02  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* TestFrameDebugInfo.java (testVirtualStackTraceWithLocals): New test.
    +	* DebugInfoFrame.java (printScope): Now prints
    +	all scopes (bug fix).
    +
    
    frysk-core/frysk/scopes/ChangeLog
    +2008-06-02  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* Function.java: Now explores referenced dies.
    +	* Scope.java: Ditto.
    +

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    1 +
 frysk-core/frysk/debuginfo/ChangeLog               |    6 ++
 frysk-core/frysk/debuginfo/DebugInfoFrame.java     |   14 +++--
 frysk-core/frysk/debuginfo/TestFrameDebugInfo.java |   26 +++++++-
 frysk-core/frysk/scopes/ChangeLog                  |    5 ++
 frysk-core/frysk/scopes/Function.java              |   20 ++++--
 frysk-core/frysk/scopes/Scope.java                 |   71 ++++++++++---------
 7 files changed, 96 insertions(+), 47 deletions(-)

First 500 lines of diff:
diff --git a/.gitignore b/.gitignore
index dfb8077..958f102 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ config.sub
 files.base
 files.jnixx
 *~
+*.class
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index b45342a..b6a1ad5 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-02  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* TestFrameDebugInfo.java (testVirtualStackTraceWithLocals): New test.
+	* DebugInfoFrame.java (printScope): Now prints 
+	all scopes (bug fix).
+
 2008-05-21  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	* ObjectDeclarationSearchEngine.java
diff --git a/frysk-core/frysk/debuginfo/DebugInfoFrame.java b/frysk-core/frysk/debuginfo/DebugInfoFrame.java
index 91e6e12..39305e6 100644
--- a/frysk-core/frysk/debuginfo/DebugInfoFrame.java
+++ b/frysk-core/frysk/debuginfo/DebugInfoFrame.java
@@ -40,6 +40,7 @@
 package frysk.debuginfo;
 
 import java.io.PrintWriter;
+import java.util.Iterator;
 import java.util.LinkedList;
 
 import lib.dwfl.DwarfDie;
@@ -221,17 +222,20 @@ public class DebugInfoFrame extends FrameDecorator {
         }
     }
     
-    void printScopes(PrintWriter writer) {
+    public void printScopes(PrintWriter writer) {
 	printScope(writer, getSubprogram(), " ");
     }
 
     private void printScope(PrintWriter writer, Scope scope, String indentString) {
-	
+
 	if (scope != null) {
-	    writer.print(indentString + "{");
+	    writer.print(indentString + "{"); 
 	    scope.toPrint(this, writer, indentString);
-	    if(!(scope.getInner() instanceof Function && ((Function)scope.getInner()).isInlined())){
-		printScope(writer, scope.getInner(), indentString+" ");
+
+	    Iterator innerScopes = scope.getScopes().iterator();
+	    while (innerScopes.hasNext()) {
+		Scope innerScope = (Scope) innerScopes.next(); 
+		printScope(writer, innerScope, indentString+" ");
 	    }
 	    writer.println(indentString+"}");
 	}
diff --git a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java
index 34cd4bd..3764416 100644
--- a/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java
+++ b/frysk-core/frysk/debuginfo/TestFrameDebugInfo.java
@@ -43,21 +43,23 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Iterator;
 import java.util.LinkedList;
+
 import javax.naming.NameNotFoundException;
+
 import lib.dwfl.DwTag;
 import lib.dwfl.DwarfDie;
 import lib.dwfl.Dwfl;
 import lib.dwfl.DwflDieBias;
 import frysk.dwfl.DwflCache;
 import frysk.proc.Task;
+import frysk.scopes.Function;
 import frysk.scopes.LexicalBlock;
 import frysk.scopes.Scope;
-import frysk.scopes.Function;
+import frysk.scopes.Variable;
 import frysk.stack.Frame;
 import frysk.stack.StackFactory;
 import frysk.testbed.DaemonBlockedAtSignal;
 import frysk.testbed.TestLib;
-import frysk.scopes.Variable;
 
 public class TestFrameDebugInfo extends TestLib {
 
@@ -319,6 +321,26 @@ public class TestFrameDebugInfo extends TestLib {
     assertTrue("contains main", stringWriter.getBuffer().toString().contains("main"));
   }
   
+  public void testVirtualStackTraceWithLocals()
+  {
+    
+      Task task = (new DaemonBlockedAtSignal("funit-stack-inlined")).getMainTask();
+    
+    PrintStackOptions options = new PrintStackOptions();
+    options.setNumberOfFrames(0); 
+    options.setPrintParams(true);
+    options.setPrintLocals(true);
+    options.setPrintFullPaths(true);
+    
+    DebugInfoFrame frame = DebugInfoStackFactory.createVirtualStackTrace(task);
+    frame = frame.getOuterDebugInfoFrame();
+    
+    StringWriter stringWriter = new StringWriter();
+    frame.printScopes(new PrintWriter(stringWriter));
+    
+    assertTrue("Contains var2", stringWriter.getBuffer().toString().contains("var2"));
+  }
+  
   public void testInlinedFunctionDerailment()
   {
     inlinedFunctionDerailment("");
diff --git a/frysk-core/frysk/scopes/ChangeLog b/frysk-core/frysk/scopes/ChangeLog
index 8e08b46..74ffefd 100644
--- a/frysk-core/frysk/scopes/ChangeLog
+++ b/frysk-core/frysk/scopes/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-02  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* Function.java: Now explores referenced dies.
+	* Scope.java: Ditto.
+
 2008-05-16  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	Added frame requirement to 
diff --git a/frysk-core/frysk/scopes/Function.java b/frysk-core/frysk/scopes/Function.java
index 89c225f..71d3f8a 100644
--- a/frysk-core/frysk/scopes/Function.java
+++ b/frysk-core/frysk/scopes/Function.java
@@ -43,6 +43,10 @@ import java.io.PrintWriter;
 import java.util.Iterator;
 import java.util.LinkedList;
 
+import lib.dwfl.DwAt;
+import lib.dwfl.DwInl;
+import lib.dwfl.DwTag;
+import lib.dwfl.DwarfDie;
 import frysk.debuginfo.DebugInfoFrame;
 import frysk.debuginfo.LocationExpression;
 import frysk.debuginfo.PieceLocation;
@@ -52,10 +56,6 @@ import frysk.value.FunctionType;
 import frysk.value.ObjectDeclaration;
 import frysk.value.Type;
 import frysk.value.Value;
-import lib.dwfl.DwAt;
-import lib.dwfl.DwInl;
-import lib.dwfl.DwTag;
-import lib.dwfl.DwarfDie;
 
 /**
  * In DWARF a subroutine is used to refer to an entity that can either be a
@@ -76,7 +76,16 @@ public class Function extends NamedScope {
 	locationExpression = new LocationExpression(die);
 	
 	parameters = new LinkedList();
-	die = die.getChild();
+	
+	DwarfDie tempDie = die.getOriginalDie();
+	if(tempDie != null){
+	    exploreDie(tempDie.getChild());
+	}
+	tempDie = die.getChild();
+	exploreDie(tempDie);
+    }
+
+    private void exploreDie(DwarfDie die){
 	while (die != null) {
 	    
 	    boolean artificial = die.hasAttribute(DwAt.ARTIFICIAL)
@@ -91,7 +100,6 @@ public class Function extends NamedScope {
 	}
 
     }
-
     public LinkedList getParameters ()
     {
       return parameters;
diff --git a/frysk-core/frysk/scopes/Scope.java b/frysk-core/frysk/scopes/Scope.java
index a3e993b..5a8be67 100644
--- a/frysk-core/frysk/scopes/Scope.java
+++ b/frysk-core/frysk/scopes/Scope.java
@@ -104,20 +104,8 @@ public class Scope
   }
   
   public LinkedList getScopes(){
-
       if (this.scopes == null) {
-	  this.scopes = new LinkedList();
-	  DwarfDie die = this.die.getChild();
-	  
-	  while (die != null) {
-	      try{
-		  Scope scope = ScopeFactory.theFactory.getScope(die, typeFactory);
-		  this.scopes.add(scope);
-	      } catch (IllegalArgumentException e) {
-		  // not a scope
-	      }
-	      die = die.getSibling();
-	  }
+	  this.getObjectDeclarations();
       }
       return scopes;
   }
@@ -128,45 +116,61 @@ public class Scope
   
   public LinkedList getVariables() {
       if (this.variables == null) {
-	  this.variables = new LinkedList();
-	  DwarfDie die = this.die.getChild();
-	  
-	  while (die != null) {
-	      
-	      if (die.getTag().equals(DwTag.VARIABLE)) {
-		  Variable variable = new Variable(die);
-		  variables.add(variable);
-	      }
-	      die = die.getSibling();
-	  }
+	  this.getObjectDeclarations();
       }
       return variables;
   }
 
+  /**
+   * Searches for variables, scopes, and object declarations
+   * Variables are variable tags
+   * scopes are scope tags
+   * objectDeclarations are either variables or NamedScopes
+   * @return
+   */
   public LinkedList getObjectDeclarations() {
       if (this.objectDeclarations == null) {
+	  
 	  this.objectDeclarations = new LinkedList();
-	  DwarfDie die = this.die.getChild();
+	  this.variables = new LinkedList();
+	  this.scopes = new LinkedList();
 	  
+	  DwarfDie die = this.die.getOriginalDie();
+	  if(die != null){
+	      exploreDie(die.getChild());
+	  }
+	  die = this.die.getChild();
+	  exploreDie(die);
+      }
+      return objectDeclarations;
+  }
+
+  private void exploreDie(DwarfDie die){
 	  while (die != null) {
-	      
+
 	      try{
 		  Scope scope = ScopeFactory.theFactory.getScope(die, typeFactory);
+		  if (scope instanceof InlinedFunction) {
+		      // skip this and trust that it will be handled by
+		      // the virtual frame corresponding to this inlining.
+		  }else{
+		      scopes.add(scope);
+		  }
 		  if (scope instanceof NamedScope) {
 		      this.objectDeclarations.add(scope);
 		  }
 	      } catch (IllegalArgumentException e) {
+
 		    if (die.getTag().equals(DwTag.VARIABLE)) {
-			Variable variable = new Variable(die);
+			Variable variable = new Variable(die); 
 			objectDeclarations.add(variable);
-		    }
-		}
+			variables.add(variable);
+		    }		    
+	      }
 	      die = die.getSibling();
 	  }
-      }
-      return objectDeclarations;
   }
-
+  
   public SourceLocation getSourceLocation(){
       return this.sourceLocation;
   }
@@ -262,11 +266,10 @@ public class Scope
   }
   
   public void toPrint(DebugInfoFrame frame, PrintWriter writer, String indentString){
-  
     Iterator iterator = this.getVariables().iterator();
     while(iterator.hasNext()){
 	Variable variable = (Variable) iterator.next();
-	writer.println();
+	writer.println(); 
 	writer.print(indentString + " ");
 	variable.toPrint(writer, frame);
 	writer.print(" = ");


hooks/post-receive
--
frysk system monitor/debugger


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

only message in thread, other threads:[~2008-06-03 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-03 18:09 [SCM] master: swagiaal: fixed broken tests swagiaal

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