From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28897 invoked by alias); 28 Nov 2007 14:55:26 -0000 Received: (qmail 28887 invoked by uid 22791); 28 Nov 2007 14:55:25 -0000 X-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,SPF_HELO_PASS,SPF_PASS,TW_DW,TW_EG X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 28 Nov 2007 14:55:20 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id lASEtITQ015655 for ; Wed, 28 Nov 2007 09:55:19 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lASEtIO1022145; Wed, 28 Nov 2007 09:55:18 -0500 Received: from [127.0.0.1] (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lASEtHGn007125; Wed, 28 Nov 2007 09:55:17 -0500 Message-ID: <474D8157.7030208@redhat.com> Date: Wed, 28 Nov 2007 14:55:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 1.5.0.12 (X11/20070530) MIME-Version: 1.0 To: Sami Wagiaalla CC: Teresa Thomas , frysk Subject: Re: LocationExpression patch References: <474C8CA7.2020305@redhat.com> In-Reply-To: <474C8CA7.2020305@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q4/txt/msg00187.txt.bz2 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_); > } > } >