[SCM] master: Move type printing for ptrs from EvalCommands.java to PointerType.java

tthomas@sourceware.org tthomas@sourceware.org
Tue Nov 27 20:08:00 GMT 2007


The branch, master has been updated
       via  1dca1ef2a1df6c2b88e4e4279e051041d806096d (commit)
      from  e2e6135d1b8db0d4b46a2e6901bbb4cd1139fea3 (commit)

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

- Log -----------------------------------------------------------------
commit 1dca1ef2a1df6c2b88e4e4279e051041d806096d
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Tue Nov 27 15:02:27 2007 -0500

    Move type printing for ptrs from EvalCommands.java to PointerType.java
    
    frysk-core/frysk/value/ChangeLog
    2007-11-27  Teresa Thomas  <tthomas@redhat.com>
    
    	* PointerType.java (toPrint): Add type printing.
    	* TestPointer.java (testCharPointer): Update.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-11-27  Teresa Thomas  <tthomas@redhat.com>
    
    	* EvalCommands.java (Printer..print): Remove type printing
    	for pointers.

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

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog          |    7 ++++++-
 frysk-core/frysk/hpd/EvalCommands.java  |    9 ---------
 frysk-core/frysk/value/ChangeLog        |    5 +++++
 frysk-core/frysk/value/PointerType.java |    4 ++++
 frysk-core/frysk/value/TestPointer.java |    2 +-
 5 files changed, 16 insertions(+), 11 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 6386fb4..79e9b2b 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,10 +1,15 @@
+2007-11-27  Teresa Thomas  <tthomas@redhat.com>
+	
+	* EvalCommands.java (Printer..print): Remove type printing
+	for pointers.
+	
 2007-11-27  Tim Moore  <timoore@redhat.com>
 
 	* CLI.java (doAttach): Wrap await call inside loop in order to
 	disregard InterruptedException.
 	* QuitCommand.java (interpret): ditto
 	* RunCommand.java (run): ditto
-
+	
 2007-11-22  Rick Moseley  <rmoseley@redhat.com>
 
 	* TestPeekCommand.java: Fix bz #5396; added test for when
diff --git a/frysk-core/frysk/hpd/EvalCommands.java b/frysk-core/frysk/hpd/EvalCommands.java
index b63e3bf..d318040 100644
--- a/frysk-core/frysk/hpd/EvalCommands.java
+++ b/frysk-core/frysk/hpd/EvalCommands.java
@@ -43,8 +43,6 @@ import inua.eio.ByteBuffer;
 import frysk.value.Format;
 import java.util.Iterator;
 import frysk.proc.Task;
-import frysk.value.PointerType;
-import frysk.value.Type;
 import java.util.List;
 import frysk.expr.Expression;
 import java.io.PrintWriter;
@@ -59,13 +57,6 @@ abstract class EvalCommands extends ParameterizedCommand {
 	static final Printer VALUE = new Printer() {
 		void print(Expression e, PrintWriter writer, Format format,
 			   ByteBuffer memory) {
-		    // XXX: Should be in type?
-		    Type t = e.getType();
-		    if (t instanceof PointerType) {
-			writer.print("(");
-			t.toPrint(writer, 0);
-			writer.print(") ");
-		    }	
 		    e.getValue().toPrint(writer, memory, format, 0);
 		    writer.println();
 		}
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index 151002a..aac4a06 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-27  Teresa Thomas  <tthomas@redhat.com>
+
+	* PointerType.java (toPrint): Add type printing.
+	* TestPointer.java (testCharPointer): Update.	
+
 2007-11-26  Teresa Thomas  <tthomas@redhat.com>
 
 	* PointerType.java (toPrint): Return on null ptr.
diff --git a/frysk-core/frysk/value/PointerType.java b/frysk-core/frysk/value/PointerType.java
index 9cd1e8b..43e5d97 100644
--- a/frysk-core/frysk/value/PointerType.java
+++ b/frysk-core/frysk/value/PointerType.java
@@ -78,6 +78,10 @@ public class PointerType
     
     void toPrint(PrintWriter writer, Location location, ByteBuffer memory,
 		 Format format, int indent) {
+	// Print type of pointer
+	writer.print("(");
+	this.toPrint(writer, 0);
+	writer.print(") ");	
 	format.print(writer, location, this);
 	if (type instanceof CharType) {
 	    // XXX: ByteBuffer.slice wants longs.
diff --git a/frysk-core/frysk/value/TestPointer.java b/frysk-core/frysk/value/TestPointer.java
index 5e266a5..062b17f 100644
--- a/frysk-core/frysk/value/TestPointer.java
+++ b/frysk-core/frysk/value/TestPointer.java
@@ -58,7 +58,7 @@ public class TestPointer
 					      1, true));
 	// Construct the pointer and try it.
 	Location l = new ScratchLocation(new byte[] { 4 });
-	assertEquals("toPrint", "0x4 \"Hello World\"",
+	assertEquals("toPrint", "(char *) 0x4 \"Hello World\"",
 		     t.toPrint(l, memory, Format.NATURAL));
     }
     


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



More information about the Frysk-cvs mailing list