? cvsdiff Index: frysk-core/frysk/debuginfo/DebugInfoEvaluator.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/debuginfo/DebugInfoEvaluator.java,v retrieving revision 1.17 diff -u -r1.17 DebugInfoEvaluator.java --- frysk-core/frysk/debuginfo/DebugInfoEvaluator.java 28 Jun 2007 21:02:43 -0000 1.17 +++ frysk-core/frysk/debuginfo/DebugInfoEvaluator.java 5 Jul 2007 20:54:07 -0000 @@ -57,6 +57,7 @@ import lib.dw.DwarfDie; import lib.dw.Dwfl; import lib.dw.DwflDieBias; +import lib.dw.DwarfDie.DwarfOp; import frysk.dwfl.DwflFactory; import frysk.expr.CppSymTab; import frysk.proc.Isa; @@ -236,8 +237,14 @@ int[] x86regnumbers = { 0, 2, 1, 3, 7, 6, 4, 5 }; pc = currentFrame.getAdjustedAddress(); - - List ops = varDieP.getAddr(); + System.out.println("AccessMemory.getBufferAddr() pc 0x"+Long.toHexString(pc)); + List ops = varDieP.getAddr(); + System.out.println("AccessMemory.getBufferAddr() [1] ops.size() " + ops.size()); + Iterator iterator = ops.iterator(); + while (iterator.hasNext()) { + DwarfOp element = (DwarfOp) iterator.next(); + System.out.println("AccessMemory.getBufferAddr() [1] ops: " + DwOpEncodings.toName(element.operator)); + } if (ops.size() == 0 || ((DwarfDie.DwarfOp)ops.get(0)).operator == -1) throw new NameNotFoundException(); @@ -247,7 +254,10 @@ } long addr = ((DwarfDie.DwarfOp)ops.get(0)).operand1; - ops = varDieP.getFrameBase(pc); + if(ops.size() == 0) + ops = varDieP.getFrameBase(pc); + + System.out.println("AccessMemory.getBufferAddr() ops.size() " + ops.size()); if (ops.size() == 0 || ((DwarfDie.DwarfOp)ops.get(0)).operator == -1) throw new NameNotFoundException(); @@ -265,7 +275,7 @@ else if (isa instanceof frysk.proc.IsaX8664) regval = swapBytes(currentFrame.getReg(reg)); - addr += ((DwarfDie.DwarfOp)ops.get(0)).operand1; +// addr += ((DwarfDie.DwarfOp)ops.get(0)).operand1; addr += regval; return addr; } @@ -290,6 +300,7 @@ public int getInt (DwarfDie varDieP, long offset) throws NameNotFoundException { + System.out.println("AccessMemory.getInt()"); long addr = getBufferAddr(varDieP); return buffer.getInt(addr + offset); } @@ -771,8 +782,7 @@ */ public Value get (DwarfDie varDie) throws NameNotFoundException { - VariableAccessor[] variableAccessor = { new AccessMemory(), - new AccessRegisters() }; + VariableAccessor[] variableAccessor = { new AccessMemory()}; ByteOrder byteorder = task.getIsa().getByteOrder(); if (varDie == null) @@ -798,7 +808,7 @@ case BaseTypes.baseTypeInteger: case BaseTypes.baseTypeUnsignedInteger: { - + System.out.println("DebugInfoEvaluator.get() baseTypeInteger"); int intVal = variableAccessor[i].getInt(varDie, 0); return ArithmeticType.newIntegerValue(intType, s, intVal); } Index: frysk-core/frysk/rt/TestFrameDebugInfo.java =================================================================== RCS file: /cvs/frysk/frysk-core/frysk/rt/TestFrameDebugInfo.java,v retrieving revision 1.14 diff -u -r1.14 TestFrameDebugInfo.java --- frysk-core/frysk/rt/TestFrameDebugInfo.java 5 Jul 2007 03:01:50 -0000 1.14 +++ frysk-core/frysk/rt/TestFrameDebugInfo.java 5 Jul 2007 20:54:07 -0000 @@ -132,11 +132,19 @@ frame = StackFactory.createFrame(task); subprogram = frame.getSubprogram(); - assertEquals("Subprogram name", subprogram.getName(), "third"); - variable = (Variable) subprogram.getParameters().iterator().next(); +// assertEquals("Subprogram name", subprogram.getName(), "third"); +// variable = (Variable) subprogram.getParameters().iterator().next(); +// assertNotNull(variable); +// assertEquals("Name", variable.getVariable().getText(), "param3"); +// assertEquals("Value", variable.getValue(frame).intValue(), 3); + + System.out.println("TestFrameDebugInfo.testValues() frame.getAdjustedAddress 0x" + Long.toHexString(frame.getAdjustedAddress())); + variable = (Variable) subprogram.getVariables().getFirst(); + System.out.println("TestFrameDebugInfo.testValues() variable.getValue(frame) " + variable.getValue(frame)); + System.out.println("TestFrameDebugInfo.testValues() ========================"); assertNotNull(variable); - assertEquals("Name", variable.getVariable().getText(), "param3"); - assertEquals("Value", variable.getValue(frame).intValue(), 3); + assertEquals("Name", variable.getVariable().getText(), "var4"); + assertEquals("Value", variable.getValue(frame).intValue(), 4); } Index: frysk-imports/lib/dw/DwarfDie.java =================================================================== RCS file: /cvs/frysk/frysk-imports/lib/dw/DwarfDie.java,v retrieving revision 1.29 diff -u -r1.29 DwarfDie.java --- frysk-imports/lib/dw/DwarfDie.java 5 Jul 2007 14:56:59 -0000 1.29 +++ frysk-imports/lib/dw/DwarfDie.java 5 Jul 2007 20:54:09 -0000 @@ -335,9 +335,15 @@ */ public List getFrameBase (long pc) { + System.out.println("DwarfDie.getFrameBase() this.scopes " + this.scopes); if(this.scopes == null){ this.scopes = this.getScopesDie(); } + System.out.println("DwarfDie.getFrameBase() this.scopes.length " + this.scopes.length); + + for (int i = 0; i < scopes.length; i++) { + System.out.println("DwarfDie.getFrameBase() " + DwTagEncodings.toName(scopes[i].getTag()) + " name: " + scopes[i].getName()); + } DwarfOps = new ArrayList(); for (int i = this.scopeIndex; i < this.scopes.length; i++) Index: frysk-imports/lib/dw/cni/DwarfDie.cxx =================================================================== RCS file: /cvs/frysk/frysk-imports/lib/dw/cni/DwarfDie.cxx,v retrieving revision 1.29 diff -u -r1.29 DwarfDie.cxx --- frysk-imports/lib/dw/cni/DwarfDie.cxx 5 Jul 2007 14:47:22 -0000 1.29 +++ frysk-imports/lib/dw/cni/DwarfDie.cxx 5 Jul 2007 20:54:09 -0000 @@ -54,6 +54,11 @@ #define DWARF_DIE_POINTER (Dwarf_Die *) this->pointer +#include +//#include +//#include +using namespace std; + jlong lib::dw::DwarfDie::get_lowpc() { @@ -288,19 +293,25 @@ void lib::dw::DwarfDie::get_addr (jlong var_die, jlong pc) { + Dwarf_Die *die = (Dwarf_Die*) var_die; + cout << "CNI: DwarfDie::get_addr die " << die << endl; Dwarf_Attribute loc_attr; Dwarf_Op *fb_expr; size_t fb_len; if (dwarf_attr_integrate (die, DW_AT_location, &loc_attr)) { - int i = 0; + cout << "CNI: DwarfDie::get_addr has DW_AT_location " << endl; + size_t i = 0; int nlocs; if (pc == 0) nlocs = dwarf_getlocation (&loc_attr, &fb_expr, &fb_len); else nlocs = dwarf_getlocation_addr (&loc_attr, pc, &fb_expr, &fb_len, 1); + + cout << "CNI: DwarfDie::get_addr fb_len " << fb_len << endl; + if (nlocs >= 0) do { @@ -308,7 +319,7 @@ fb_expr[i].offset); i += 1; } - while (i < nlocs); + while (i < fb_len); } } @@ -451,7 +462,10 @@ void lib::dw::DwarfDie::get_framebase (jlong var_die, jlong scope_arg, jlong pc) { + cout << "CNI: DwarfDie::get_framebase var_die " << (long)var_die << endl; Dwarf_Die *die = (Dwarf_Die*) var_die; + cout << "CNI: DwarfDie::get_framebase die " << die << endl; + Dwarf_Attribute loc_attr; Dwarf_Op *fb_expr; int code; @@ -460,11 +474,15 @@ if (dwarf_attr_integrate (die, DW_AT_location, &loc_attr) >= 0) { - int i = 0; + cout << "CNI: DwarfDie::get_framebase has DW_AT_location " << endl; + size_t i = 0; code = dwarf_getlocation (&loc_attr, &fb_expr, &fb_len); + cout << "CNI: DwarfDie::get_framebase fb_len " << fb_len << endl; + cout << "CNI: DwarfDie::get_framebase fb_expr[0].atom " << (void*)fb_expr[0].atom << endl; + if (fb_expr[0].atom != DW_OP_fbreg) return; - + cout << "CNI: DwarfDie::get_framebase !DW_OP_fbreg " << endl; fb_attr = dwarf_attr_integrate ((Dwarf_Die*) scope_arg, DW_AT_frame_base, &loc_attr); @@ -477,7 +495,7 @@ fb_expr[i].offset); i += 1; } - while (i < code); + while (i < fb_len); return; } }