From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12825 invoked by alias); 27 Nov 2007 21:31:28 -0000 Received: (qmail 12818 invoked by uid 22791); 27 Nov 2007 21:31:27 -0000 X-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_20,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; Tue, 27 Nov 2007 21:31:23 +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 lARLVLfW031594 for ; Tue, 27 Nov 2007 16:31:21 -0500 Received: from pobox-3.corp.redhat.com (pobox-3.corp.redhat.com [10.11.255.67]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lARLVJRD024842; Tue, 27 Nov 2007 16:31:19 -0500 Received: from toner.toronto.redhat.com (toner.yyz.redhat.com [10.15.16.55]) by pobox-3.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lARLVJKo031584; Tue, 27 Nov 2007 16:31:19 -0500 Message-ID: <474C8CA7.2020305@redhat.com> Date: Tue, 27 Nov 2007 21:31:00 -0000 From: Sami Wagiaalla User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: Andrew Cagney , Teresa Thomas CC: frysk Subject: LocationExpression patch Content-Type: multipart/mixed; boundary="------------060300060603020309080003" X-Virus-Checked: Checked by ClamAV on sourceware.org 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/msg00184.txt.bz2 This is a multi-part message in MIME format. --------------060300060603020309080003 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 317 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. This is an issure for Variable and CompositeType::StatickMember Sami --------------060300060603020309080003 Content-Type: text/x-patch; name="LocationExpression.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="LocationExpression.patch" Content-length: 7000 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_); } } --------------060300060603020309080003--