This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: LocationExpression patch


Sami Wagiaalla wrote:
Cagney, Teresa,

What do you think of the attached path.
This will help me reduce dependence on DwarfDie. If the information can be extracted from DwarfDie at construction time then that will eliminate the need to keep a ref to the die around.


Doesn't phase me.

Andrew

This is an issure for Variable and CompositeType::StatickMember

Sami
------------------------------------------------------------------------

diff --git a/frysk-core/frysk/debuginfo/LocationExpression.java b/frysk-core/frysk/debuginfo/LocationExpression.java
index 48c9258..d61b7c0 100644
--- a/frysk-core/frysk/debuginfo/LocationExpression.java
+++ b/frysk-core/frysk/debuginfo/LocationExpression.java
@@ -39,45 +39,38 @@
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.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();
@@ -162,7 +155,7 @@ public class LocationExpression {
case DwOp.REG31_:
if (locationType == 0) locationType = locationTypeReg;
- Register register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ Register register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister(operator - DwOp.REG0_);
long regval = frame.getRegister(register);
stack.addFirst(new Long(regval));
@@ -201,7 +194,7 @@ public class LocationExpression {
case DwOp.BREG30_:
case DwOp.BREG31_:
locationType = locationTypeRegDisp;
- register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister(operator - DwOp.BREG0_);
regval = frame.getRegister(register);
stack.addFirst(new Long(operand1 + regval));
@@ -209,7 +202,7 @@ public class LocationExpression {
case DwOp.REGX_:
- register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister((int)operand1);
regval = frame.getRegister(register);
stack.addFirst(new Long(regval));
@@ -224,8 +217,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,7 +401,7 @@ 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();
@@ -501,7 +494,7 @@ public class LocationExpression {
case DwOp.REG31_:
if (locationType == 0) locationType = locationTypeReg;
- Register register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ Register register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister(operator - DwOp.REG0_);
// Push the register onto the dwfl stack
stack.addFirst(register);
@@ -540,7 +533,7 @@ public class LocationExpression {
case DwOp.BREG30_:
case DwOp.BREG31_:
locationType = locationTypeRegDisp;
- register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister(operator - DwOp.BREG0_);
long regval = frame.getRegister(register);
stack.addFirst(new Long(operand1 + regval));
@@ -549,14 +542,14 @@ public class LocationExpression {
case DwOp.REGX_:
if (locationType == 0) locationType = locationTypeReg;
- register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister((int)operand1);
stack.addFirst(register);
break;
case DwOp.BREGX_:
locationType = locationTypeRegDisp;
- register = DwarfRegisterMapFactory.getRegisterMap(isa)
+ register = DwarfRegisterMapFactory.getRegisterMap(frame.getTask().getISA())
.getRegister((int)operand1);
regval = frame.getRegister(register);
stack.addFirst(new Long(operand2 + regval));
@@ -571,8 +564,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 +753,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 +767,7 @@ public class LocationExpression {
*/
if (pieces.isEmpty())
{ - addToList (pieces, size);
+ addToList (frame, pieces, size);
} return pieces;
@@ -784,7 +777,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 +796,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_);
}
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]