public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: swagiaal@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: swagiaal: Removed frame requirement from LocationExpression constructor
Date: Wed, 28 Nov 2007 18:07:00 -0000	[thread overview]
Message-ID: <20071128180732.9646.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  83b71d8dbfed32527d4bace5f13fb7827fcff409 (commit)
      from  06c524cb3ec657e014e7aa1d796a9f5945fc3093 (commit)

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

- Log -----------------------------------------------------------------
commit 83b71d8dbfed32527d4bace5f13fb7827fcff409
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Wed Nov 28 10:42:40 2007 -0500

    swagiaal: Removed frame requirement from LocationExpression constructor
    
    frysk-core/frysk/debuginfo/ChangeLog
    +2007-11-28  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +       * LocationExpression.java: Removed frame requirement from constructor
    +       to be passed as an argument to decoding functions.
    +       * TestAddress.java: Updated.
    +       * TestLocationExpression.java: Updated.
    +
    
    frysk-core/frysk/value/ChangeLog
    +2007-11-28  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +       LocationExpression.java: Removed frame requirement from constructor
    +       to be passed as an argument to decoding functions.
    +       * Variable.java: Updated.
    +

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

Summary of changes:
 frysk-core/frysk/debuginfo/ChangeLog               |    7 ++
 frysk-core/frysk/debuginfo/LocationExpression.java |   68 ++++++++------------
 frysk-core/frysk/debuginfo/TestAddress.java        |    9 ++-
 .../frysk/debuginfo/TestLocationExpression.java    |    4 +-
 frysk-core/frysk/value/ChangeLog                   |    6 ++
 frysk-core/frysk/value/Variable.java               |    4 +-
 6 files changed, 50 insertions(+), 48 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index 63a81b7..1308ae6 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-28  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* LocationExpression.java: Removed frame requirement from constructor
+	to be passed as an argument to decoding functions.
+	* TestAddress.java: Updated.
+	* TestLocationExpression.java: Updated.
+
 2007-11-26  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	Added a boolean for printing source	libraries to Frame.toPrint().
diff --git a/frysk-core/frysk/debuginfo/LocationExpression.java b/frysk-core/frysk/debuginfo/LocationExpression.java
index 48c9258..b1e3d81 100644
--- a/frysk-core/frysk/debuginfo/LocationExpression.java
+++ b/frysk-core/frysk/debuginfo/LocationExpression.java
@@ -39,48 +39,43 @@
 
 package frysk.debuginfo;
 
-import java.lang.Math;
-
-import java.util.LinkedList;
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
-import frysk.isa.ISA;
-import frysk.isa.Register;
-import frysk.stack.Frame;
+import lib.dwfl.DwAt;
+import lib.dwfl.DwOp;
 import lib.dwfl.DwarfDie;
 import lib.dwfl.DwarfOp;
-import lib.dwfl.DwOp;
-import lib.dwfl.DwAt;
+import frysk.isa.Register;
+import frysk.isa.RegisterMap;
+import frysk.stack.Frame;
 
 public class LocationExpression {
     public final static int locationTypeRegDisp = 1,
     locationTypeAddress = 2,
     locationTypeReg = 3;
-    private final Frame frame;
     DwarfDie die;
     List ops;
     int locationType;
     LinkedList stack;
-    private final ISA isa;
 
-    public LocationExpression(Frame frame, DwarfDie die, List ops) {
+    public LocationExpression(DwarfDie die, List ops) {
 	locationType = 0;
-	this.frame = frame;
 	this.die = die;
 	this.ops = ops;
 	this.stack = null;
-	this.isa = frame.getTask().getISA();
     }
 
     /**
      *  Decode a location list and return the value.
      *
      */
-    public long decode () {
+    public long decode (Frame frame) {
 	stack = new LinkedList();
 	int nops = ops.size();
-
+	RegisterMap registerMap = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA());
+	
 	if (nops == 0)
 	    if (die.getAttrBoolean(DwAt.LOCATION)) 
 		throw new VariableOptimizedOutException();  
@@ -162,8 +157,7 @@ public class LocationExpression {
 	    case DwOp.REG31_:
 		if (locationType == 0) 
 		    locationType = locationTypeReg;
-		Register register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister(operator - DwOp.REG0_);
+		Register register = registerMap.getRegister(operator - DwOp.REG0_);
 		long regval = frame.getRegister(register);
 		stack.addFirst(new Long(regval));
 		break;
@@ -201,16 +195,14 @@ public class LocationExpression {
 	    case DwOp.BREG30_:
 	    case DwOp.BREG31_:
 		locationType = locationTypeRegDisp;
-		register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister(operator - DwOp.BREG0_);
+		register = registerMap.getRegister(operator - DwOp.BREG0_);
 		regval = frame.getRegister(register);
 		stack.addFirst(new Long(operand1 + regval));
 		break;
 
 
 	    case DwOp.REGX_:
-		register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister((int)operand1);
+		register = registerMap.getRegister((int)operand1);
 		regval = frame.getRegister(register);
 		stack.addFirst(new Long(regval));
 		break;
@@ -224,8 +216,8 @@ public class LocationExpression {
 	    case DwOp.FBREG_:
 		locationType = locationTypeRegDisp;
 		long pc = frame.getAdjustedAddress();
-		LocationExpression frameBaseOps = new LocationExpression (frame, die, die.getFrameBase(pc));
-		stack.addFirst(new Long(operand1 + frameBaseOps.decode()));
+		LocationExpression frameBaseOps = new LocationExpression (die, die.getFrameBase(pc));
+		stack.addFirst(new Long(operand1 + frameBaseOps.decode(frame)));
 		break;
 
 		// ??? unsigned not properly handled (use bignum?) See DwarfDie.java
@@ -408,11 +400,11 @@ public class LocationExpression {
      * @param size - Size of variable 
      * @return List of memory or register pieces
      */
-    public List decode (int size)
+    public List decode (Frame frame, int size)
     {
 	stack = new LinkedList();
 	int nops = ops.size();
-
+	RegisterMap registerMap = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA());
 	//pieces will contain a list of MemoryPiece, RegisterPiece or UnavaiablePiece
 	ArrayList pieces = new ArrayList(); 
 
@@ -501,8 +493,7 @@ public class LocationExpression {
 	    case DwOp.REG31_:
 		if (locationType == 0) 
 		    locationType = locationTypeReg;
-		Register register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister(operator - DwOp.REG0_);
+		Register register = registerMap.getRegister(operator - DwOp.REG0_);
 		// Push the register onto the dwfl stack
 		stack.addFirst(register);
 		break;
@@ -540,8 +531,7 @@ public class LocationExpression {
 	    case DwOp.BREG30_:
 	    case DwOp.BREG31_:
 		locationType = locationTypeRegDisp;
-		register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister(operator - DwOp.BREG0_);
+		register = registerMap.getRegister(operator - DwOp.BREG0_);
 		long regval = frame.getRegister(register);
 		stack.addFirst(new Long(operand1 + regval));
 		break;
@@ -549,15 +539,13 @@ public class LocationExpression {
 	    case DwOp.REGX_:
 		if (locationType == 0) 
 		    locationType = locationTypeReg;
-		register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister((int)operand1);
+		register = registerMap.getRegister((int)operand1);
 		stack.addFirst(register);
 		break;
 
 	    case DwOp.BREGX_:
 		locationType = locationTypeRegDisp;
-		register = DwarfRegisterMapFactory.getRegisterMap(isa)
-		.getRegister((int)operand1);
+		register = registerMap.getRegister((int)operand1);
 		regval = frame.getRegister(register);
 		stack.addFirst(new Long(operand2 + regval));
 		break;
@@ -571,8 +559,8 @@ public class LocationExpression {
 	    case DwOp.FBREG_:
 		locationType = locationTypeRegDisp;
 		long pc = frame.getAdjustedAddress();
-		LocationExpression frameBaseOps = new LocationExpression (frame, die, die.getFrameBase(pc));
-		stack.addFirst(new Long(operand1 + frameBaseOps.decode()));
+		LocationExpression frameBaseOps = new LocationExpression (die, die.getFrameBase(pc));
+		stack.addFirst(new Long(operand1 + frameBaseOps.decode(frame)));
 		break;
 
 		// ??? unsigned not properly handled (use bignum?) See DwarfDie.java
@@ -760,7 +748,7 @@ public class LocationExpression {
 		    break;
 		}	
 		// Otherwise, check the type of element on stack top and add to list
-		addToList (pieces, operand1);	
+		addToList (frame, pieces, operand1);	
 		break;
 
 	    default:
@@ -774,7 +762,7 @@ public class LocationExpression {
 	 */
 	if (pieces.isEmpty())
 	{    
-	    addToList (pieces, size);
+	    addToList (frame, pieces, size);
 	}    
 
 	return pieces;
@@ -784,7 +772,7 @@ public class LocationExpression {
      * Function that checks the type of element on the stack top and adds it to the
      * list of location
      */
-    private void addToList (List pieces, long size)
+    private void addToList (Frame frame, List pieces, long size)
     {
 	/*
 	 * If stackTop is a Register, add it as a RegisterPiece to list pieces 
@@ -803,13 +791,13 @@ public class LocationExpression {
      *  Return register number for a one entry DW_OP_regX location list 
      *
      */
-    public Register getRegisterNumber () {
+    public Register getRegisterNumber (Frame frame) {
 	if (ops.size() == 1) {
 	    int operator = ((DwarfOp) ops.get(0)).operator;
 	    if (operator >= DwOp.REG0_
 		    || operator <=  DwOp.REG31_) {
 		locationType = locationTypeReg;
-		return DwarfRegisterMapFactory.getRegisterMap(isa)
+		return DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
 		.getRegister(operator - DwOp.REG0_);
 	    }
 	}
diff --git a/frysk-core/frysk/debuginfo/TestAddress.java b/frysk-core/frysk/debuginfo/TestAddress.java
index 4e8ce65..e2c55d8 100644
--- a/frysk-core/frysk/debuginfo/TestAddress.java
+++ b/frysk-core/frysk/debuginfo/TestAddress.java
@@ -86,8 +86,8 @@ public class TestAddress
 	Variable var = (Variable) declarationSearchEngine.getVariable(variable);
 	DwarfDie varDie = var.getVariableDie();
 	List ops = varDie.getFormData(frame.getAdjustedAddress());
-	LocationExpression locExpr = new LocationExpression(frame, varDie, ops);
-	PieceLocation loc = new PieceLocation(locExpr.decode(var.getType
+	LocationExpression locExpr = new LocationExpression(varDie, ops);
+	PieceLocation loc = new PieceLocation(locExpr.decode(frame,var.getType
 		                              (frame.getTask().getISA()).getSize()));
 
 	 /* Get the value of the address.
@@ -95,8 +95,9 @@ public class TestAddress
 	Variable addr = (Variable) declarationSearchEngine.getVariable(address);
 	DwarfDie addrDie = addr.getVariableDie();
 	List opsAddr = addrDie.getFormData(frame.getAdjustedAddress());
-	LocationExpression locExprAddr = new LocationExpression(frame, addrDie, opsAddr);
-	PieceLocation p = new PieceLocation(locExprAddr.decode(addr.getType
+	LocationExpression locExprAddr = new LocationExpression(
+		addrDie, opsAddr);
+	PieceLocation p = new PieceLocation(locExprAddr.decode(frame, addr.getType
 		                            (frame.getTask().getISA()).getSize()));
 	Value addrVal = new Value(addr.getType(frame.getTask().getISA()), p);
 	
diff --git a/frysk-core/frysk/debuginfo/TestLocationExpression.java b/frysk-core/frysk/debuginfo/TestLocationExpression.java
index cbb52e3..271a3ff 100644
--- a/frysk-core/frysk/debuginfo/TestLocationExpression.java
+++ b/frysk-core/frysk/debuginfo/TestLocationExpression.java
@@ -396,8 +396,8 @@ public class TestLocationExpression
 	Task task = getStoppedTask();
 	Frame frame = StackFactory.createFrame(task);
 	
-	LocationExpression locExp = new LocationExpression(frame, die, ops);
-	List loc = locExp.decode(12);  
+	LocationExpression locExp = new LocationExpression(die, ops);
+	List loc = locExp.decode(frame,12);  
 	
 	assertEquals ("Stack size", stackSize, locExp.getStackSize());
 	compareLocations (loc, expectedLoc);
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index aac4a06..39b20b5 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,3 +1,9 @@
+007-11-28  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	LocationExpression.java: Removed frame requirement from constructor
+	to be passed as an argument to decoding functions.
+	* Variable.java: Updated.
+
 2007-11-27  Teresa Thomas  <tthomas@redhat.com>
 
 	* PointerType.java (toPrint): Add type printing.
diff --git a/frysk-core/frysk/value/Variable.java b/frysk-core/frysk/value/Variable.java
index c8050f6..dc51ff3 100644
--- a/frysk-core/frysk/value/Variable.java
+++ b/frysk-core/frysk/value/Variable.java
@@ -141,9 +141,9 @@ public class Variable extends ObjectDeclaration{
     public Value getValue(DebugInfoFrame frame) {
 	List ops = variableDie.getFormData(frame.getAdjustedAddress());
 	ISA isa = frame.getTask().getISA();
-	LocationExpression locationExpression = new LocationExpression(frame, variableDie, ops);
+	LocationExpression locationExpression = new LocationExpression(variableDie, ops);
 	PieceLocation pieceLocation
-	    = new PieceLocation(locationExpression.decode(this.getType(isa)
+	    = new PieceLocation(locationExpression.decode(frame, this.getType(isa)
 							  .getSize()));
 	Value value = new Value(this.getType(isa), pieceLocation);
 	return value;


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


                 reply	other threads:[~2007-11-28 18:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071128180732.9646.qmail@sourceware.org \
    --to=swagiaal@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).