public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Added support for DW_interface_type tags
@ 2008-02-19 20:47 npremji
  0 siblings, 0 replies; only message in thread
From: npremji @ 2008-02-19 20:47 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  4b27cc4c792af62ed4ae2f70ad1f8806180a680f (commit)
      from  32926b7c9ee8ebbbc2cf911847eefab3385a8da1 (commit)

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

- Log -----------------------------------------------------------------
commit 4b27cc4c792af62ed4ae2f70ad1f8806180a680f
Author: Nurdin Premji <npremji@localhost.localdomain>
Date:   Tue Feb 19 15:16:12 2008 -0500

    Added support for DW_interface_type tags

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

Summary of changes:
 frysk-core/ChangeLog                               |    6 ++
 frysk-core/Makefile.am                             |    5 ++
 frysk-core/frysk/debuginfo/ChangeLog               |    9 +++
 frysk-core/frysk/debuginfo/CompilerVersion.java    |    8 +++
 .../frysk/debuginfo/GNURedHatCompilerVersion.java  |   39 +++++++++++++-
 frysk-core/frysk/debuginfo/TypeEntry.java          |   26 +++++++++-
 .../frysk/pkglibdir/FunitSimpleInterface.java      |    9 ++--
 .../FunitSimpleInterfaceTest.java}                 |   21 +++----
 frysk-core/frysk/stack/ChangeLog                   |    4 ++
 frysk-core/frysk/stack/Frame.java                  |    4 ++
 frysk-core/frysk/value/ChangeLog                   |    5 ++
 .../value/{ClassType.java => InterfaceType.java}   |   12 ++---
 frysk-core/frysk/value/TestClass.java              |   17 ++++++
 .../value/{TestClass.java => TestInterface.java}   |   54 +++++--------------
 frysk-core/frysk/value/Variable.java               |    9 +++
 frysk-sys/frysk/junit/ChangeLog                    |    5 ++
 frysk-sys/frysk/junit/TestCase.java                |   56 +++++++++++++++++---
 17 files changed, 212 insertions(+), 77 deletions(-)
 copy frysk-imports/tests/frysk4282/MyProcName.java => frysk-core/frysk/pkglibdir/FunitSimpleInterface.java (97%)
 copy frysk-core/frysk/{symtab/UnknownSymbol.java => pkglibdir/FunitSimpleInterfaceTest.java} (88%)
 copy frysk-core/frysk/value/{ClassType.java => InterfaceType.java} (94%)
 copy frysk-core/frysk/value/{TestClass.java => TestInterface.java} (69%)

First 500 lines of diff:
diff --git a/frysk-core/ChangeLog b/frysk-core/ChangeLog
index 4b2e9eb..0da4c31 100644
--- a/frysk-core/ChangeLog
+++ b/frysk-core/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-19  Nurdin Premji <npremji@redhat.com>
+
+	* Makefile.am (FunitSimpleInterfaceTest): New.
+	* frysk/pkglibdir/FunitSimpleInterface.java: New.
+	* frysk/pkglibdir/FunitSimpleInterfaceTest.java: New.
+
 2008-02-08  Stan Cox  <scox@redhat.com>
 
 	* Makefile.am (frysk_pkglibdir_funit_quicksort_LINK): New.
diff --git a/frysk-core/Makefile.am b/frysk-core/Makefile.am
index 87088e8..21a4cd2 100644
--- a/frysk-core/Makefile.am
+++ b/frysk-core/Makefile.am
@@ -305,3 +305,8 @@ frysk/pkgdatadir/test-core-x8664:
 frysk/pkgdatadir/test-core-x86:
 	mkdir -p `dirname $@`
 	ln -s -f @abs_top_builddir@/../frysk-sys/$@ $@
+
+#FunitSimpleInterfaceTest
+pkglib_PROGRAMS += frysk/pkglibdir/FunitSimpleInterfaceTest
+frysk/pkglibdir/FunitSimpleInterfaceTest:
+	gcj -o $@ -g --main=FunitSimpleInterfaceTest $(srcdir)/frysk/pkglibdir/FunitSimpleInterfaceTest.java $(srcdir)/frysk/pkglibdir/FunitSimpleInterface.java
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index 758d8a7..0e7c84a 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,6 +1,15 @@
+2008-02-19  Nurdin Premji  <npremji@redhat.com>
+
+	* TypeEntry.java (getInterfaceType): Added.
+	(getType): Added support for interface type.
+	* GNURedHatCompilerVersion.java: Made comparable.
+	(supportsInterfaceType): Added.
+	(compareTo): Added.
+
 2008-02-19  Andrew Cagney  <cagney@redhat.com>
 
 	* DebugInfo.java: Update to match lib.dwfl.Elf.
+	
 
 2008-02-12  Andrew Cagney  <cagney@redhat.com>
 
diff --git a/frysk-core/frysk/debuginfo/CompilerVersion.java b/frysk-core/frysk/debuginfo/CompilerVersion.java
index eb50621..8b174c0 100644
--- a/frysk-core/frysk/debuginfo/CompilerVersion.java
+++ b/frysk-core/frysk/debuginfo/CompilerVersion.java
@@ -54,5 +54,13 @@ public class CompilerVersion {
     public boolean supportsClassType() {
 	return false;
     }
+    
+    public boolean supportsInterFaceType() {
+	return false;
+    }
+    
+    public String toString() {
+	return "Compiler: " + compilerString;
+    }
 
 }
diff --git a/frysk-core/frysk/debuginfo/GNURedHatCompilerVersion.java b/frysk-core/frysk/debuginfo/GNURedHatCompilerVersion.java
index cb0ccd1..2853155 100644
--- a/frysk-core/frysk/debuginfo/GNURedHatCompilerVersion.java
+++ b/frysk-core/frysk/debuginfo/GNURedHatCompilerVersion.java
@@ -39,17 +39,29 @@
 
 package frysk.debuginfo;
 
-public class GNURedHatCompilerVersion extends CompilerVersion {
+import frysk.rsl.Log;
+
+public class GNURedHatCompilerVersion extends CompilerVersion implements
+	Comparable {
+    
+    private static Log fine = Log.fine(GNURedHatCompilerVersion.class);
 
     private int version;
     private int minorVersion;
     private int patchLevel;
     private int RHRelease;
 
+    private static GNURedHatCompilerVersion minSupportingClassType = new GNURedHatCompilerVersion(
+	    "GNURedHatCompilerVersionSupportsClassType", 4, 1, 2, 37);
+
+    private static GNURedHatCompilerVersion minSupportingInterfaceType = new GNURedHatCompilerVersion(
+	    "GNURedhatCompilerVersionSupportsInterfaceType", 4, 3, 0, 7);
+
     public GNURedHatCompilerVersion(String string, int version,
 	    int minorVersion, int patchLevel, int RHRelease) {
 	super(string);
 
+	fine.log(this, "Setting up GNU compiler");
 	this.version = version;
 	this.minorVersion = minorVersion;
 	this.patchLevel = patchLevel;
@@ -57,7 +69,28 @@ public class GNURedHatCompilerVersion extends CompilerVersion {
     }
 
     public boolean supportsClassType() {
-	return version >= 4 && minorVersion >= 1 && patchLevel >= 2
-		&& RHRelease >= 37;
+	boolean ret = this.compareTo(minSupportingClassType) >= 0;
+	fine.log(this, "Entering supportsClassType, returning: ", Boolean.valueOf(ret));
+	return ret;
+    }
+
+    public boolean supportsInterfaceType() {
+	return this.compareTo(minSupportingInterfaceType) >= 0;
+    }
+
+    public int compareTo(Object arg0) {
+	fine.log("Entering compareTo, arg: ", arg0);
+	GNURedHatCompilerVersion that = (GNURedHatCompilerVersion) arg0;
+
+	if (this.version != that.version) {
+	    return this.version - that.version;
+	} else if (this.minorVersion != that.minorVersion) {
+	    return this.minorVersion - that.minorVersion;
+	} else if (this.patchLevel != that.patchLevel) {
+	    return this.patchLevel - that.patchLevel;
+	} else {
+	    return this.RHRelease - that.RHRelease;
+	}
     }
+    
 }
diff --git a/frysk-core/frysk/debuginfo/TypeEntry.java b/frysk-core/frysk/debuginfo/TypeEntry.java
index 9633642..520ffa8 100644
--- a/frysk-core/frysk/debuginfo/TypeEntry.java
+++ b/frysk-core/frysk/debuginfo/TypeEntry.java
@@ -52,6 +52,7 @@ import frysk.value.EnumType;
 import frysk.value.FloatingPointType;
 import frysk.value.FunctionType;
 import frysk.value.GccStructOrClassType;
+import frysk.value.InterfaceType;
 import frysk.value.PointerType;
 import frysk.value.ReferenceType;
 import frysk.value.SignedType;
@@ -83,8 +84,10 @@ public class TypeEntry {
     private final HashMap dieHash;
 
     public TypeEntry(ISA isa) {
+	fine.log(this, "Creating TypeEntry, ISA: ", isa);
 	this.byteorder = isa.order();
 	this.dieHash = new HashMap();
+	finest.log(this, "Finished creating TypeEntry");
     }
 
     private int getByteSize(DwarfDie die) {
@@ -235,6 +238,8 @@ public class TypeEntry {
      */
     public CompositeType getGccStructOrClassType(DwarfDie classDie, 
 	    					 String name) {
+	
+	fine.log(this, "Entering getGccStructOrClassType, classDie: ",classDie, " name: ", name);
 	dumpDie("structOrClassDie=", classDie);
 
 	CompositeType type;
@@ -274,7 +279,19 @@ public class TypeEntry {
 	addMembers(classDie, classType);
 	return classType;
     }
+    
+    public InterfaceType getInterfaceType(DwarfDie classDie, String name) {
+	dumpDie("classDie=", classDie);
+
+	InterfaceType interfaceType = new InterfaceType(name,
+		getByteSize(classDie));
 
+	// XXX: may need to cut this method down,
+	// interfaces don't use accessibility.
+	addMembers(classDie, interfaceType);
+	return interfaceType;
+    }
+    
     /**
      * Return true of the given die represents a subprogram or inlined
      * subroutine
@@ -410,7 +427,8 @@ public class TypeEntry {
      * @return a frysk.type for this varDie
      */
     public Type getType(DwarfDie typeDie) {
-
+	fine.log(this,	"Entering getType, DwarfDie: ", typeDie);
+	
 	if (typeDie == null)
 	    return (null);
 
@@ -475,6 +493,12 @@ public class TypeEntry {
 	    returnType = classType;
 	    break;
 	}
+        case DwTag.INTERFACE_TYPE_: {
+           InterfaceType interfaceType = getInterfaceType(type, typeDie.getName());
+           returnType = interfaceType;
+           break;
+        }
+
 	case DwTag.ENUMERATION_TYPE_: {
 	    DwarfDie subrange = type.getChild();
 	    EnumType enumType = new EnumType(typeDie.getName(), byteorder,
diff --git a/frysk-imports/tests/frysk4282/MyProcName.java b/frysk-core/frysk/pkglibdir/FunitSimpleInterface.java
similarity index 97%
copy from frysk-imports/tests/frysk4282/MyProcName.java
copy to frysk-core/frysk/pkglibdir/FunitSimpleInterface.java
index 374bbf1..5f75927 100644
--- a/frysk-imports/tests/frysk4282/MyProcName.java
+++ b/frysk-core/frysk/pkglibdir/FunitSimpleInterface.java
@@ -37,9 +37,8 @@
 // version and license this file solely under the GPL without
 // exception.
 
-package frysk4282;
+public interface FunitSimpleInterface {
 
-public class MyProcName
-{
-   
-}
+    void simpleMethod();
+
+}
\ No newline at end of file
diff --git a/frysk-core/frysk/symtab/UnknownSymbol.java b/frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java
similarity index 88%
copy from frysk-core/frysk/symtab/UnknownSymbol.java
copy to frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java
index 13ca331..dd2504e 100644
--- a/frysk-core/frysk/symtab/UnknownSymbol.java
+++ b/frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java
@@ -37,19 +37,16 @@
 // version and license this file solely under the GPL without
 // exception.
 
-package frysk.symtab;
+public class FunitSimpleInterfaceTest implements FunitSimpleInterface{
 
-/**
- * An unknown-symbol; a singleton.
- */
-
-class UnknownSymbol
-    extends Symbol
-{
-    UnknownSymbol() {
-	super.symbol(0, -1, "[unknown]");
+    public static void main(String[] args) {
+	FunitSimpleInterface inter = new FunitSimpleInterfaceTest();
+	// Crash
+	Object o = null;
+	o.toString();
+	inter.simpleMethod();
     }
-    public String getDemangledName () {
-	return "[unknown]";
+
+    public void simpleMethod() {
     }
 }
diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog
index 2985029..0a471eb 100644
--- a/frysk-core/frysk/stack/ChangeLog
+++ b/frysk-core/frysk/stack/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-19  Nurdin Premji  <npremji@redhat.com>
+
+	* Frame.java: Added some rsl logging.
+
 2008-01-24  Andrew Cagney  <cagney@redhat.com>
 
 	* Frame.java: Update; Register moved to frysk.isa.registers.
diff --git a/frysk-core/frysk/stack/Frame.java b/frysk-core/frysk/stack/Frame.java
index 208c6b6..e676008 100644
--- a/frysk-core/frysk/stack/Frame.java
+++ b/frysk-core/frysk/stack/Frame.java
@@ -47,12 +47,15 @@ import lib.dwfl.DwflModule;
 import frysk.dwfl.DwflCache;
 import frysk.isa.registers.Register;
 import frysk.proc.Task;
+import frysk.rsl.Log;
 import frysk.symtab.Symbol;
 import frysk.symtab.SymbolFactory;
 import frysk.value.ScratchLocation;
 import frysk.value.Value;
 
 public abstract class Frame {
+    
+    private static Log fine = Log.fine(Frame.class);
 
     private final Task task;
     private final Frame inner;
@@ -94,6 +97,7 @@ public abstract class Frame {
      * @return The Task this StackFrame belongs to.
      */
     public final Task getTask() {
+	fine.log("Getting task: ", task);
 	return task;
     }
 
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index a4718b8..d4f5f86 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-19  Nurdin Premji  <npremji@redhat.com>
+
+	* TestInterface.java: New.
+	* InterfaceType.java: New.
+
 2008-02-14  Sami Wagiaalla  <swagiaal@.redhat.com>
 
 	* CompositeType.java: Removed cast to DynamicMember.
diff --git a/frysk-core/frysk/value/ClassType.java b/frysk-core/frysk/value/InterfaceType.java
similarity index 94%
copy from frysk-core/frysk/value/ClassType.java
copy to frysk-core/frysk/value/InterfaceType.java
index b75f63b..62909e5 100644
--- a/frysk-core/frysk/value/ClassType.java
+++ b/frysk-core/frysk/value/InterfaceType.java
@@ -39,16 +39,12 @@
 
 package frysk.value;
 
-/**
- * Type for a class
- */
-public class ClassType
-    extends CompositeType
+public class InterfaceType extends CompositeType
 {
     protected String getPrefix() {
-	return "class";
+	return "interface";
     }
-    public ClassType(String name, int size) {
+    public InterfaceType(String name, int size) {
 	super(name, size);
     }
-}
+}
\ No newline at end of file
diff --git a/frysk-core/frysk/value/TestClass.java b/frysk-core/frysk/value/TestClass.java
index 19620c5..9cd23eb 100644
--- a/frysk-core/frysk/value/TestClass.java
+++ b/frysk-core/frysk/value/TestClass.java
@@ -44,24 +44,39 @@ import frysk.debuginfo.DebugInfoStackFactory;
 import frysk.debuginfo.ObjectDeclarationSearchEngine;
 import frysk.junit.TestCase;
 import frysk.proc.Task;
+import frysk.rsl.Log;
 import frysk.testbed.DaemonBlockedAtSignal;
 
 public class TestClass extends TestCase {
+    
+    private static Log log = Log.fine(TestClass.class);
 
     private CompositeType getType(String program, String variableName) {
 	Task task = (new DaemonBlockedAtSignal(program)).getMainTask();
+	
+	log.log(this, "Got task: ", task);
+	
 	DebugInfoFrame frame = DebugInfoStackFactory
 		.createDebugInfoStackTrace(task);
+	
+	log.log(this, "Got debug frame: ", frame);
 
 	ObjectDeclarationSearchEngine objectDeclarationSearchEngine = new ObjectDeclarationSearchEngine(
 		frame);
+	
+	log.log(this, "Got search engine: ", objectDeclarationSearchEngine);
 
 	Variable variable = (Variable) objectDeclarationSearchEngine
 		.getVariable(variableName);
 
 	assertNotNull("Variable found", variable);
+	
+	log.log(this, "Got variable: ", variable);
 
 	Type type = variable.getType(frame.getTask().getISA());
+	
+	log.log(this, "Got base type: ", type);
+	
 	CompositeType compType = null;
 
 	try {
@@ -69,6 +84,8 @@ public class TestClass extends TestCase {
 	} catch (ClassCastException e) {
 	    fail("Not a composite type");
 	}
+	
+	log.log(this, "Got type: ", compType);
 
 	return compType;
     }
diff --git a/frysk-core/frysk/value/TestClass.java b/frysk-core/frysk/value/TestInterface.java
similarity index 69%
copy from frysk-core/frysk/value/TestClass.java
copy to frysk-core/frysk/value/TestInterface.java
index 19620c5..e5baa2f 100644
--- a/frysk-core/frysk/value/TestClass.java
+++ b/frysk-core/frysk/value/TestInterface.java
@@ -46,7 +46,7 @@ import frysk.junit.TestCase;
 import frysk.proc.Task;
 import frysk.testbed.DaemonBlockedAtSignal;
 
-public class TestClass extends TestCase {
+public class TestInterface extends TestCase {
 
     private CompositeType getType(String program, String variableName) {
 	Task task = (new DaemonBlockedAtSignal(program)).getMainTask();
@@ -65,55 +65,27 @@ public class TestClass extends TestCase {
 	CompositeType compType = null;
 
 	try {
-	    compType = (CompositeType) type;
+	    // Java variables are considered PointerTypes, so follow the
+	    // pointer.
+	    compType = (CompositeType) ((PointerType) type).getType();
 	} catch (ClassCastException e) {
-	    fail("Not a composite type");
+	    fail("Not a composite type" + type);
 	}
 
 	return compType;
     }
 
-    public void testSimpleClass() {
-	CompositeType type = getType("funit-simple-class", "simple");
+    public void testSimpleInterface() {
+	CompositeType type = getType("FunitSimpleInterfaceTest", "inter");
 
-	assertEquals("Variable is a class", type.getPrefix(), "class");
-    }
-
-    public void testComplexClass() {
-	CompositeType type = getType("funit-complex-class", "complex");
-
-	assertEquals("Variable is a class", "class", type.getPrefix());
-    }
-
-    public void testSimpleStruct() {
-	CompositeType type = getType("funit-simple-struct", "simple");
-
-	assertEquals("Variable is a struct", "struct", type.getPrefix());
-    }
-
-    public void testComplexStruct() {
-	CompositeType type = getType("funit-complex-struct", "complex");
-
-	// Check the type of the variable, new compiler says struct, old
-	// compiler says class.
-	if (unresolvedCompilerNoSupportForAT_CLASS())
-	    assertEquals("Variable is considered a class", "class", type
-		    .getPrefix());
-	else
+	if (unresolvedCompilerNoSupportForAT_CLASS()) {
 	    assertEquals("Variable is a struct", "struct", type.getPrefix());
-
-    }
-
-    public void testInheritedStruct() {
-	CompositeType type = getType("funit-inherited-struct", "der");
-
-	// Check the type of the variable, new compiler says struct, old
-	// compiler says class.
-	if (unresolvedCompilerNoSupportForAT_CLASS())
-	    assertEquals("Variable is considered a class", "class", type
+	} else if (unresolvedCompilerNoSupportForAT_INTERFACE()) {
+	    assertEquals("Variable is a class", "class", type.getPrefix());
+	} else {
+	    assertEquals("Variable is an interface", "interface", type
 		    .getPrefix());
-	else
-	    assertEquals("Variable is a struct", "struct", type.getPrefix());
+	}
     }
 
 }
diff --git a/frysk-core/frysk/value/Variable.java b/frysk-core/frysk/value/Variable.java
index 8c05d0e..0d80cca 100644
--- a/frysk-core/frysk/value/Variable.java
+++ b/frysk-core/frysk/value/Variable.java
@@ -51,6 +51,7 @@ import frysk.debuginfo.TypeEntry;
 import frysk.debuginfo.ValueUnavailableException;
 import frysk.debuginfo.VariableOptimizedOutException;
 import frysk.isa.ISA;
+import frysk.rsl.Log;
 import frysk.scopes.SourceLocation;
 
 /**
@@ -60,6 +61,10 @@ import frysk.scopes.SourceLocation;
  */
 
 public class Variable extends ObjectDeclaration{
+    


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


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

only message in thread, other threads:[~2008-02-19 20:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 20:47 [SCM] master: Added support for DW_interface_type tags npremji

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