[SCM] master: swagiaal: DwarfDie.DwarfDie() Changed constructor to take DwflModule

swagiaal@sourceware.org swagiaal@sourceware.org
Thu Dec 6 16:07:00 GMT 2007


The branch, master has been updated
       via  e84fae5b93e545c70551225ae9c14907f1433ad6 (commit)
       via  6b6e12c6d2e496413deed9e819999eac41d5d913 (commit)
       via  02a3f7e9e6fb01704b55fcbb97574c655434ebd7 (commit)
      from  92c63ef33c7b802db6fee1c0f46c091b5a8ba0f4 (commit)

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

- Log -----------------------------------------------------------------
commit e84fae5b93e545c70551225ae9c14907f1433ad6
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Wed Dec 5 14:50:03 2007 -0500

    swagiaal: DwarfDie.DwarfDie() Changed constructor to take DwflModule
    
    frysk-sys/lib/dwfl/ChangeLog
    +2007-12-05  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +       * TestDwarfDie.java (testGetModule): New Test.
    +       * DwarfDie.java (DwarfDie):  Changed constructor to take
    +       DwflModule instead of Dwfl.
    +       * DwarfDieFactory.java: Updated.
    +       * die/Variant.java: Updated.
    +       * die/VariantPart.java: Updated.
    +       * die/VolatileType.java: Updated.
    +       * die/WithStmt.java: Updated.
    +       * die/Label.java: Updated.
    +       * die/LexicalBlock.java: Updated.
    +       * die/LoUser.java: Updated.
    +       * die/Member.java: Updated.
    +       * die/MIPSLoop.java: Updated.
    +       * die/Module.java: Updated.
    +       * die/MutableType.java: Updated.
    +       * die/Namelist.java: Updated.
    +       * die/NamelistItem.java: Updated.
    +       * die/Namespace.java: Updated.
    +       * die/PackedType.java: Updated.
    +       * die/PartialUnit.java: Updated.
    +       * die/PointerType.java: Updated.
    +       * die/PtrToMemberType.java: Updated.
    +       * die/ReferenceType.java: Updated.
    +       * die/RestrictType.java: Updated.
    +       * die/SetType.java: Updated.
    +       * die/SharedType.java: Updated.
    +       * die/StringType.java: Updated.
    +       * die/StructureType.java: Updated.
    +       * die/Subprogram.java: Updated.
    +       * die/SubrangeType.java: Updated.
    +       * die/SubroutineType.java: Updated.
    +       * die/TemplateTypeParameter.java: Updated.
    +       * die/TemplateValueParameter.java: Updated.
    +       * die/ThrownType.java: Updated.
    +       * die/TryBlock.java: Updated.
    +       * die/Typedef.java: Updated.
    +       * die/UnionType.java: Updated.
    +       * die/UnspecifiedParameters.java: Updated.
    +       * die/UnspecifiedType.java: Updated.
    +       * die/Variable.java: Updated.
    +       * die/AccessDeclaration.java: Updated.
    +       * die/ArrayType.java: Updated.
    +       * die/BaseType.java: Updated.
    +       * die/CatchBlock.java: Updated.
    +       * die/ClassTemplate.java: Updated.
    +       * die/ClassType.java: Updated.
    +       * die/CommonBlock.java: Updated.
    +       * die/CommonInclusion.java: Updated.
    +       * die/CompileUnit.java: Updated.
    +       * die/Condition.java: Updated.
    +       * die/Constant.java: Updated.
    +       * die/ConstType.java: Updated.
    +       * die/DwarfProcedure.java: Updated.
    +       * die/EntryPoint.java: Updated.
    +       * die/EnumerationType.java: Updated.
    +       * die/Enumerator.java: Updated.
    +       * die/FileType.java: Updated.
    +       * die/FormalParameter.java: Updated.
    +       * die/FormatLabel.java: Updated.
    +       * die/Friend.java: Updated.
    +       * die/FunctionTemplate.java: Updated.
    +       * die/HiUser.java: Updated.
    +       * die/ImportedDeclaration.java: Updated.
    +       * die/ImportedModule.java: Updated.
    +       * die/ImportedUnit.java: Updated.
    +       * die/Inheritance.java:
    +       * die/InlinedSubroutine.java: Updated.
    +       * die/InterfaceType.java: Updated.
    +

commit 6b6e12c6d2e496413deed9e819999eac41d5d913
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Tue Dec 4 12:44:24 2007 -0500

    swagiaal: implemented and tested Dwfl.getCompilationUnitModule.
    
    +2007-12-04  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +       * TestDwfl.java (testGetCompliationUnitModule): New test.
    +       (getCompliationUnitModule): New function.
    +       * cni/Dwfl.cxx: implemented dwfl_cumodule().
    +

commit 02a3f7e9e6fb01704b55fcbb97574c655434ebd7
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Tue Dec 4 11:45:39 2007 -0500

    swagiaal: Added and tested DwarfDie.getCompilationUnit().
    
    frysk-sys/lib/dwfl/ChangeLog
    +2007-12-04  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +       * DwarfDie.java (getCompilationUnit): New.
    +       * TestDwarfDie.java (testGetCompilationUnit): New test.
    +

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

Summary of changes:
 frysk-sys/lib/dwfl/ChangeLog                       |   82 ++++++++++++++++++++
 frysk-sys/lib/dwfl/DwarfDie.java                   |   37 +++++++---
 frysk-sys/lib/dwfl/DwarfDieFactory.java            |    8 +-
 frysk-sys/lib/dwfl/Dwfl.java                       |    8 ++-
 frysk-sys/lib/dwfl/TestDwarfDie.java               |   40 ++++++++++
 frysk-sys/lib/dwfl/TestDwfl.java                   |   18 ++++-
 frysk-sys/lib/dwfl/cni/Dwfl.cxx                    |   12 +++-
 frysk-sys/lib/dwfl/cni/DwflModule.cxx              |    2 +-
 frysk-sys/lib/dwfl/die/AccessDeclaration.java      |    6 +-
 frysk-sys/lib/dwfl/die/ArrayType.java              |    6 +-
 frysk-sys/lib/dwfl/die/BaseType.java               |    6 +-
 frysk-sys/lib/dwfl/die/CatchBlock.java             |    6 +-
 frysk-sys/lib/dwfl/die/ClassTemplate.java          |    6 +-
 frysk-sys/lib/dwfl/die/ClassType.java              |    6 +-
 frysk-sys/lib/dwfl/die/CommonBlock.java            |    6 +-
 frysk-sys/lib/dwfl/die/CommonInclusion.java        |    6 +-
 frysk-sys/lib/dwfl/die/CompileUnit.java            |    6 +-
 frysk-sys/lib/dwfl/die/Condition.java              |    6 +-
 frysk-sys/lib/dwfl/die/ConstType.java              |    6 +-
 frysk-sys/lib/dwfl/die/Constant.java               |    6 +-
 frysk-sys/lib/dwfl/die/DwarfProcedure.java         |    6 +-
 frysk-sys/lib/dwfl/die/EntryPoint.java             |    6 +-
 frysk-sys/lib/dwfl/die/EnumerationType.java        |    6 +-
 frysk-sys/lib/dwfl/die/Enumerator.java             |    6 +-
 frysk-sys/lib/dwfl/die/FileType.java               |    6 +-
 frysk-sys/lib/dwfl/die/FormalParameter.java        |    6 +-
 frysk-sys/lib/dwfl/die/FormatLabel.java            |    6 +-
 frysk-sys/lib/dwfl/die/Friend.java                 |    6 +-
 frysk-sys/lib/dwfl/die/FunctionTemplate.java       |    6 +-
 frysk-sys/lib/dwfl/die/HiUser.java                 |    6 +-
 frysk-sys/lib/dwfl/die/ImportedDeclaration.java    |    6 +-
 frysk-sys/lib/dwfl/die/ImportedModule.java         |    6 +-
 frysk-sys/lib/dwfl/die/ImportedUnit.java           |    6 +-
 frysk-sys/lib/dwfl/die/Inheritance.java            |    6 +-
 frysk-sys/lib/dwfl/die/InlinedSubroutine.java      |    6 +-
 frysk-sys/lib/dwfl/die/InterfaceType.java          |    6 +-
 frysk-sys/lib/dwfl/die/Label.java                  |    6 +-
 frysk-sys/lib/dwfl/die/LexicalBlock.java           |    6 +-
 frysk-sys/lib/dwfl/die/LoUser.java                 |    6 +-
 frysk-sys/lib/dwfl/die/MIPSLoop.java               |    6 +-
 frysk-sys/lib/dwfl/die/Member.java                 |    6 +-
 frysk-sys/lib/dwfl/die/Module.java                 |    6 +-
 frysk-sys/lib/dwfl/die/MutableType.java            |    6 +-
 frysk-sys/lib/dwfl/die/Namelist.java               |    6 +-
 frysk-sys/lib/dwfl/die/NamelistItem.java           |    6 +-
 frysk-sys/lib/dwfl/die/Namespace.java              |    6 +-
 frysk-sys/lib/dwfl/die/PackedType.java             |    6 +-
 frysk-sys/lib/dwfl/die/PartialUnit.java            |    6 +-
 frysk-sys/lib/dwfl/die/PointerType.java            |    6 +-
 frysk-sys/lib/dwfl/die/PtrToMemberType.java        |    6 +-
 frysk-sys/lib/dwfl/die/ReferenceType.java          |    6 +-
 frysk-sys/lib/dwfl/die/RestrictType.java           |    6 +-
 frysk-sys/lib/dwfl/die/SetType.java                |    6 +-
 frysk-sys/lib/dwfl/die/SharedType.java             |    6 +-
 frysk-sys/lib/dwfl/die/StringType.java             |    6 +-
 frysk-sys/lib/dwfl/die/StructureType.java          |    6 +-
 frysk-sys/lib/dwfl/die/Subprogram.java             |    6 +-
 frysk-sys/lib/dwfl/die/SubrangeType.java           |    6 +-
 frysk-sys/lib/dwfl/die/SubroutineType.java         |    6 +-
 frysk-sys/lib/dwfl/die/TemplateTypeParameter.java  |    6 +-
 frysk-sys/lib/dwfl/die/TemplateValueParameter.java |    6 +-
 frysk-sys/lib/dwfl/die/ThrownType.java             |    6 +-
 frysk-sys/lib/dwfl/die/TryBlock.java               |    6 +-
 frysk-sys/lib/dwfl/die/Typedef.java                |    6 +-
 frysk-sys/lib/dwfl/die/UnionType.java              |    6 +-
 frysk-sys/lib/dwfl/die/UnspecifiedParameters.java  |    6 +-
 frysk-sys/lib/dwfl/die/UnspecifiedType.java        |    6 +-
 frysk-sys/lib/dwfl/die/Variable.java               |    6 +-
 frysk-sys/lib/dwfl/die/Variant.java                |    6 +-
 frysk-sys/lib/dwfl/die/VariantPart.java            |    6 +-
 frysk-sys/lib/dwfl/die/VolatileType.java           |    6 +-
 frysk-sys/lib/dwfl/die/WithStmt.java               |    6 +-
 72 files changed, 381 insertions(+), 210 deletions(-)

First 500 lines of diff:
diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog
index 1884fc3..4806cc3 100644
--- a/frysk-sys/lib/dwfl/ChangeLog
+++ b/frysk-sys/lib/dwfl/ChangeLog
@@ -1,3 +1,85 @@
+2007-12-05  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* TestDwarfDie.java (testGetModule): New Test.
+	* DwarfDie.java (DwarfDie):  Changed constructor to take
+	DwflModule instead of Dwfl.
+	* DwarfDieFactory.java: Updated.
+	* die/Variant.java: Updated.
+	* die/VariantPart.java: Updated.
+	* die/VolatileType.java: Updated.
+	* die/WithStmt.java: Updated.
+	* die/Label.java: Updated.
+	* die/LexicalBlock.java: Updated.
+	* die/LoUser.java: Updated.
+	* die/Member.java: Updated.
+	* die/MIPSLoop.java: Updated.
+	* die/Module.java: Updated.
+	* die/MutableType.java: Updated.
+	* die/Namelist.java: Updated.
+	* die/NamelistItem.java: Updated.
+	* die/Namespace.java: Updated.
+	* die/PackedType.java: Updated.
+	* die/PartialUnit.java: Updated.
+	* die/PointerType.java: Updated.
+	* die/PtrToMemberType.java: Updated.
+	* die/ReferenceType.java: Updated.
+	* die/RestrictType.java: Updated.
+	* die/SetType.java: Updated.
+	* die/SharedType.java: Updated.
+	* die/StringType.java: Updated.
+	* die/StructureType.java: Updated.
+	* die/Subprogram.java: Updated.
+	* die/SubrangeType.java: Updated.
+	* die/SubroutineType.java: Updated.
+	* die/TemplateTypeParameter.java: Updated.
+	* die/TemplateValueParameter.java: Updated.
+	* die/ThrownType.java: Updated.
+	* die/TryBlock.java: Updated.
+	* die/Typedef.java: Updated.
+	* die/UnionType.java: Updated.
+	* die/UnspecifiedParameters.java: Updated.
+	* die/UnspecifiedType.java: Updated.
+	* die/Variable.java: Updated.
+	* die/AccessDeclaration.java: Updated.
+	* die/ArrayType.java: Updated.
+	* die/BaseType.java: Updated.
+	* die/CatchBlock.java: Updated.
+	* die/ClassTemplate.java: Updated.
+	* die/ClassType.java: Updated.
+	* die/CommonBlock.java: Updated.
+	* die/CommonInclusion.java: Updated.
+	* die/CompileUnit.java: Updated.
+	* die/Condition.java: Updated.
+	* die/Constant.java: Updated.
+	* die/ConstType.java: Updated.
+	* die/DwarfProcedure.java: Updated.
+	* die/EntryPoint.java: Updated.
+	* die/EnumerationType.java: Updated.
+	* die/Enumerator.java: Updated.
+	* die/FileType.java: Updated.
+	* die/FormalParameter.java: Updated.
+	* die/FormatLabel.java: Updated.
+	* die/Friend.java: Updated.
+	* die/FunctionTemplate.java: Updated.
+	* die/HiUser.java: Updated.
+	* die/ImportedDeclaration.java: Updated.
+	* die/ImportedModule.java: Updated.
+	* die/ImportedUnit.java: Updated.
+	* die/Inheritance.java: 
+	* die/InlinedSubroutine.java: Updated.
+	* die/InterfaceType.java: Updated.
+
+2007-12-04  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* TestDwfl.java (testGetCompliationUnitModule): New test.
+	(getCompliationUnitModule): New function.
+	* cni/Dwfl.cxx: implemented dwfl_cumodule().
+
+2007-12-04  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* DwarfDie.java (getCompilationUnit): New.
+	* TestDwarfDie.java (testGetCompilationUnit): New test.
+
 2007-12-03  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	* DwarfDie.java (getDwfl): renamed getParent to getDwfl.
diff --git a/frysk-sys/lib/dwfl/DwarfDie.java b/frysk-sys/lib/dwfl/DwarfDie.java
index 1693532..909fad7 100644
--- a/frysk-sys/lib/dwfl/DwarfDie.java
+++ b/frysk-sys/lib/dwfl/DwarfDie.java
@@ -47,17 +47,34 @@ abstract public class DwarfDie {
     private long pointer;
     private DwarfDie[] scopes;
     private int scopeIndex;
-    private Dwfl dwfl;
+    private DwflModule module;
 
     protected boolean manageDie = false;
   
-    protected DwarfDie(long pointer, Dwfl parent) {
+    protected DwarfDie(long pointer, DwflModule module) {
 	this.pointer = pointer;
-	this.dwfl = parent;
+	this.module = module;
     }
 
+    protected DwflModule getModule(){
+	return module;
+    }
+    
+    protected DwarfDie getCompilationUnit(){
+	
+	if(this.getTag().equals(DwTag.COMPILE_UNIT)){
+	    return this;
+	}
+	
+	DwarfDie[] scopes = this.getScopesDie();
+	if(!scopes[scopes.length -1].getTag().equals(DwTag.COMPILE_UNIT)){
+	    throw new RuntimeException("Could not retrieve CU of this die ["+this.getTag()+"]");
+	}
+	return scopes[scopes.length -1];
+    }
+    
     protected Dwfl getDwfl () {
-	return this.dwfl;
+	return this.module.getParent();
     }
 
     public long getHighPC () {
@@ -106,7 +123,7 @@ abstract public class DwarfDie {
 	DwarfDieFactory factory = DwarfDieFactory.getFactory();
 	for(int i = 0; i < vals.length; i++)
 	    if(vals[i] != 0)
-		dies[i] = factory.makeDie(vals[i], this.dwfl);
+		dies[i] = factory.makeDie(vals[i], this.module);
 	    else
 		dies[i] = null;
 
@@ -123,7 +140,7 @@ abstract public class DwarfDie {
 	DwarfDieFactory factory = DwarfDieFactory.getFactory();
 	for(int i = 0; i < vals.length; i++) {
 	    if(vals[i] != 0)
-		dies[i] = factory.makeDie(vals[i], this.dwfl);
+		dies[i] = factory.makeDie(vals[i], this.module);
 	    else
 		dies[i] = null;
 	}
@@ -145,7 +162,7 @@ abstract public class DwarfDie {
 	long val = get_scopevar(die_and_scope, vals, variable);
 	if (val >= 0) {
 	    die = DwarfDieFactory.getFactory().makeDie(die_and_scope[0],
-						       this.dwfl);
+						       this.module);
 	    die.scopes = scopes;
 	    die.scopeIndex = (int)die_and_scope[1];
 	}
@@ -222,7 +239,7 @@ abstract public class DwarfDie {
 	DwarfDie die = null;
 	long type = get_type(this.getPointer(), followTypeDef);
 	if (type != 0)
-	    die = DwarfDieFactory.getFactory().makeDie(type, this.dwfl);
+	    die = DwarfDieFactory.getFactory().makeDie(type, this.module);
 	return die;
     }
 
@@ -255,7 +272,7 @@ abstract public class DwarfDie {
 	long child = get_child(this.getPointer());
 	DwarfDie die = null;
 	if (child != 0)
-	    die = DwarfDieFactory.getFactory().makeDie(child, this.dwfl);
+	    die = DwarfDieFactory.getFactory().makeDie(child, this.module);
 	return die;
     }
 
@@ -266,7 +283,7 @@ abstract public class DwarfDie {
 	long sibling = get_sibling(this.getPointer());
 	DwarfDie die = null;
 	if (sibling != 0)
-	    die = DwarfDieFactory.getFactory().makeDie(sibling, this.dwfl);
+	    die = DwarfDieFactory.getFactory().makeDie(sibling, this.module);
 	return die;
     }
   
diff --git a/frysk-sys/lib/dwfl/DwarfDieFactory.java b/frysk-sys/lib/dwfl/DwarfDieFactory.java
index 28f1cee..37bfff0 100644
--- a/frysk-sys/lib/dwfl/DwarfDieFactory.java
+++ b/frysk-sys/lib/dwfl/DwarfDieFactory.java
@@ -77,7 +77,7 @@ public class DwarfDieFactory {
 	Pattern pattern = Pattern.compile("_.");
 	HashMap dieClasses = loadDies();
 	Class[] constructorArgTypes = new Class[] {Long.TYPE,
-						   lib.dwfl.Dwfl.class};
+						   lib.dwfl.DwflModule.class};
 	for (int i = 0; i < tagEncodings.length; i++) {
 	    DwTag tag = tagEncodings[i];
 	    int tagValue = tag.hashCode();
@@ -123,10 +123,10 @@ public class DwarfDieFactory {
      * Create a subclass of DwarfDie based on the tag in the Dwarf_Die object
      * pointed to by pointer.
      * @param pointer raw Dwarf_Die from libdw
-     * @param parent Dwfl object associated with the DIE, if any
+     * @param module Dwfl object associated with the DIE, if any
      * @return subclass of DwarfDie
      */
-    public DwarfDie makeDie(long pointer, Dwfl parent) {
+    public DwarfDie makeDie(long pointer, DwflModule module) {
 	int tag = DwarfDie.get_tag(pointer);
 	Constructor constructor
 	    = (Constructor)constructorMap.get(new Integer(tag));
@@ -135,7 +135,7 @@ public class DwarfDieFactory {
 	}
 	try {
 	    return (DwarfDie)constructor.newInstance(new Object[]
-		{new Long(pointer), parent});
+		{new Long(pointer), module});
 	}
 	catch (InstantiationException e) {
 	    throw new DwarfException("creating tag " + tag, e);
diff --git a/frysk-sys/lib/dwfl/Dwfl.java b/frysk-sys/lib/dwfl/Dwfl.java
index 313a9f5..23aa7ce 100644
--- a/frysk-sys/lib/dwfl/Dwfl.java
+++ b/frysk-sys/lib/dwfl/Dwfl.java
@@ -89,7 +89,13 @@ public class Dwfl {
      * @return The module
      */
     public native DwflModule getModule(long addr);
-
+    
+    public DwflModule getCompliationUnitModule(DwarfDie cuDie){
+	return new DwflModule(dwfl_cumodule(cuDie.getPointer()), this);
+    }
+    
+    private native long dwfl_cumodule(long cuDie);
+    
     public DwflLine getSourceLine (long addr) {
 	long val = 0;
 	try {
diff --git a/frysk-sys/lib/dwfl/TestDwarfDie.java b/frysk-sys/lib/dwfl/TestDwarfDie.java
index de0e3d0..ed2049c 100644
--- a/frysk-sys/lib/dwfl/TestDwarfDie.java
+++ b/frysk-sys/lib/dwfl/TestDwarfDie.java
@@ -61,4 +61,44 @@ public class TestDwarfDie extends TestCase {
 	assertFalse("Does not have location attribute", die
 		.hasAttribute(DwAt.LOCATION));
     }
+    
+    
+    public void testGetCompilationUnit(){
+	long pc = LocalMemory.getCodeAddr();
+	Dwfl dwfl = new Dwfl(Pid.get());
+	assertNotNull(dwfl);
+
+	// get CUDIE
+	DwflDieBias bias = dwfl.getCompilationUnit(pc);
+	assertNotNull(bias);
+	
+	DwarfDie cuDie = bias.die;
+	assertNotNull(cuDie);
+	
+	DwarfDie die = cuDie;
+	
+	assertTrue("cudie returned", die.getCompilationUnit().getName().equals(cuDie.getName()));
+	
+	die = cuDie.getScopes(pc)[0];
+	assertNotNull(die);
+	
+	assertTrue("cudie returned", die.getCompilationUnit().getName().equals(cuDie.getName()));
+    }
+
+    public void testGetModule(){
+	
+	Dwfl dwfl = new Dwfl(Pid.get());
+	assertNotNull(dwfl);
+	long addr = LocalMemory.getCodeAddr();
+
+	DwarfDie cuDie = dwfl.getCompilationUnit(addr).die;
+	assertNotNull(cuDie);
+	    
+	DwarfDie die = cuDie.getScopes(addr)[0];
+	DwflModule dwflModule = die.getModule();
+	assertNotNull(dwflModule);
+	
+	assertTrue("Found correct module", dwflModule.getName().contains("TestRunner"));
+    }
+
 }
diff --git a/frysk-sys/lib/dwfl/TestDwfl.java b/frysk-sys/lib/dwfl/TestDwfl.java
index eb79d18..0236c48 100644
--- a/frysk-sys/lib/dwfl/TestDwfl.java
+++ b/frysk-sys/lib/dwfl/TestDwfl.java
@@ -42,8 +42,9 @@ package lib.dwfl;
 import java.io.File;
 import java.util.Iterator;
 import java.util.List;
-import frysk.junit.TestCase;
+
 import frysk.junit.Runner;
+import frysk.junit.TestCase;
 import frysk.sys.Pid;
 import frysk.testbed.LocalMemory;
 
@@ -216,4 +217,19 @@ public class TestDwfl
       }
     assertTrue(foundAddress);
   }
+  
+  public void testGetCompliationUnitModule() 
+  {
+    Dwfl dwfl = new Dwfl(Pid.get());
+    assertNotNull(dwfl);
+    long addr = LocalMemory.getCodeAddr();
+
+    DwarfDie cuDie = dwfl.getCompilationUnit(addr).die;
+    assertNotNull(cuDie);
+    
+    DwflModule dwflModule = dwfl.getCompliationUnitModule(cuDie);
+
+    assertTrue("Found correct module", dwflModule.getName().contains("TestRunner"));
+  }
+
 }
diff --git a/frysk-sys/lib/dwfl/cni/Dwfl.cxx b/frysk-sys/lib/dwfl/cni/Dwfl.cxx
index dc0c6a1..13418e2 100644
--- a/frysk-sys/lib/dwfl/cni/Dwfl.cxx
+++ b/frysk-sys/lib/dwfl/cni/Dwfl.cxx
@@ -240,7 +240,9 @@ lib::dwfl::Dwfl::dwfl_addrdie(jlong addr){
 		return NULL;
 	
 	lib::dwfl::DwflDieBias *retval = new lib::dwfl::DwflDieBias();
-	retval->die = factory->makeDie((jlong) die, this);
+        
+        lib::dwfl::DwflModule* module = lib::dwfl::Dwfl::getModule(addr);
+	retval->die = factory->makeDie((jlong) die, module);
 	retval->bias = (jlong) bias;
 	
 	return retval;
@@ -260,3 +262,11 @@ lib::dwfl::Dwfl::getModule(jlong addr)
     return 0;
   return new lib::dwfl::DwflModule((jlong)module, this);
 }
+
+jlong
+lib::dwfl::Dwfl::dwfl_cumodule(jlong cudie)
+{
+  Dwfl_Module* module = ::dwfl_cumodule((Dwarf_Die*)cudie);
+  return (jlong)module;
+}
+
diff --git a/frysk-sys/lib/dwfl/cni/DwflModule.cxx b/frysk-sys/lib/dwfl/cni/DwflModule.cxx
index 3a1113c..515632e 100644
--- a/frysk-sys/lib/dwfl/cni/DwflModule.cxx
+++ b/frysk-sys/lib/dwfl/cni/DwflModule.cxx
@@ -216,7 +216,7 @@ callback (Dwarf *dwarf, Dwarf_Global *gl, void* thisObject)
   if (dwarf_offdie (dwarf, gl->die_offset, die) == NULL){
       throw new lib::dwfl::DwarfException(JvNewStringUTF("failed to get object die"));
   }else{        
-    lib::dwfl::DwarfDie* dwarfDie = dwfl->factory->makeDie((jlong)die, dwfl);  
+    lib::dwfl::DwarfDie* dwarfDie = dwfl->factory->makeDie((jlong)die, dwflModule);  
     dwflModule->pubNames->add(dwarfDie);
     
   }
diff --git a/frysk-sys/lib/dwfl/die/AccessDeclaration.java b/frysk-sys/lib/dwfl/die/AccessDeclaration.java
index 1b53aca..e1e5145 100644
--- a/frysk-sys/lib/dwfl/die/AccessDeclaration.java
+++ b/frysk-sys/lib/dwfl/die/AccessDeclaration.java
@@ -39,9 +39,9 @@
 
 package lib.dwfl.die;
 
-import lib.dwfl.DwarfDie;
-import lib.dwfl.Dwfl;
 import lib.dwfl.DieVisitor;
+import lib.dwfl.DwarfDie;
+import lib.dwfl.DwflModule;
 
 /**
  * Wrapper around Dwarf DW_TAG_access_declaration DIE
@@ -49,7 +49,7 @@ import lib.dwfl.DieVisitor;
 public class AccessDeclaration
   extends DwarfDie
 {
-  public AccessDeclaration(long pointer, Dwfl parent)
+  public AccessDeclaration(long pointer, DwflModule parent)
   {
     super(pointer, parent);
   }
diff --git a/frysk-sys/lib/dwfl/die/ArrayType.java b/frysk-sys/lib/dwfl/die/ArrayType.java
index 745ca2b..052a6a0 100644
--- a/frysk-sys/lib/dwfl/die/ArrayType.java
+++ b/frysk-sys/lib/dwfl/die/ArrayType.java
@@ -39,9 +39,9 @@
 
 package lib.dwfl.die;
 
-import lib.dwfl.DwarfDie;
-import lib.dwfl.Dwfl;
 import lib.dwfl.DieVisitor;
+import lib.dwfl.DwarfDie;
+import lib.dwfl.DwflModule;
 
 /**
  * Wrapper around Dwarf DW_TAG_array_type DIE
@@ -49,7 +49,7 @@ import lib.dwfl.DieVisitor;
 public class ArrayType
   extends DwarfDie
 {
-  public ArrayType(long pointer, Dwfl parent)
+  public ArrayType(long pointer, DwflModule parent)
   {
     super(pointer, parent);
   }
diff --git a/frysk-sys/lib/dwfl/die/BaseType.java b/frysk-sys/lib/dwfl/die/BaseType.java
index 5dd6dc9..c8cd92b 100644
--- a/frysk-sys/lib/dwfl/die/BaseType.java
+++ b/frysk-sys/lib/dwfl/die/BaseType.java
@@ -39,9 +39,9 @@
 
 package lib.dwfl.die;
 
-import lib.dwfl.DwarfDie;
-import lib.dwfl.Dwfl;
 import lib.dwfl.DieVisitor;
+import lib.dwfl.DwarfDie;
+import lib.dwfl.DwflModule;
 
 /**
  * Wrapper around Dwarf DW_TAG_base_type DIE
@@ -49,7 +49,7 @@ import lib.dwfl.DieVisitor;
 public class BaseType
   extends DwarfDie
 {
-  public BaseType(long pointer, Dwfl parent)
+  public BaseType(long pointer, DwflModule parent)
   {
     super(pointer, parent);
   }
diff --git a/frysk-sys/lib/dwfl/die/CatchBlock.java b/frysk-sys/lib/dwfl/die/CatchBlock.java
index 0b464c3..902f617 100644
--- a/frysk-sys/lib/dwfl/die/CatchBlock.java
+++ b/frysk-sys/lib/dwfl/die/CatchBlock.java
@@ -39,9 +39,9 @@
 
 package lib.dwfl.die;
 
-import lib.dwfl.DwarfDie;
-import lib.dwfl.Dwfl;
 import lib.dwfl.DieVisitor;
+import lib.dwfl.DwarfDie;
+import lib.dwfl.DwflModule;
 
 /**
  * Wrapper around Dwarf DW_TAG_catch_block DIE
@@ -49,7 +49,7 @@ import lib.dwfl.DieVisitor;
 public class CatchBlock
   extends DwarfDie
 {
-  public CatchBlock(long pointer, Dwfl parent)
+  public CatchBlock(long pointer, DwflModule parent)
   {
     super(pointer, parent);
   }
diff --git a/frysk-sys/lib/dwfl/die/ClassTemplate.java b/frysk-sys/lib/dwfl/die/ClassTemplate.java
index fb004ef..013ae3f 100644
--- a/frysk-sys/lib/dwfl/die/ClassTemplate.java
+++ b/frysk-sys/lib/dwfl/die/ClassTemplate.java
@@ -39,9 +39,9 @@
 
 package lib.dwfl.die;
 
-import lib.dwfl.DwarfDie;
-import lib.dwfl.Dwfl;
 import lib.dwfl.DieVisitor;
+import lib.dwfl.DwarfDie;
+import lib.dwfl.DwflModule;
 
 /**
  * Wrapper around Dwarf DW_TAG_class_template DIE
@@ -49,7 +49,7 @@ import lib.dwfl.DieVisitor;
 public class ClassTemplate
   extends DwarfDie
 {
-  public ClassTemplate(long pointer, Dwfl parent)
+  public ClassTemplate(long pointer, DwflModule parent)
   {
     super(pointer, parent);
   }
diff --git a/frysk-sys/lib/dwfl/die/ClassType.java b/frysk-sys/lib/dwfl/die/ClassType.java
index fcd4293..c04750b 100644
--- a/frysk-sys/lib/dwfl/die/ClassType.java
+++ b/frysk-sys/lib/dwfl/die/ClassType.java
@@ -39,9 +39,9 @@
 
 package lib.dwfl.die;
 
-import lib.dwfl.DwarfDie;
-import lib.dwfl.Dwfl;


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



More information about the Frysk-cvs mailing list