There is an intermittent failure caused by the sign extending of DW_OP_breg values in LocationExpression.java at: long regval = frame.getRegister(register); The scenario is: frysk.stack.Frame.getRegister return getRegisterValue(register).asLong() frysk.stack.Frame.getRegisterValue return new Value(register.getType() frysk.value.Value.Value where Location might have values such as: -128, 62, -105, -1 where asLong is: frysk.value.Value.asLong return ((ArithmeticType)type.getUltimateType()).getBigInteger(location).longValue() frysk.value.SignedType.getBigInteger return new BigInteger(location.get(order())) I'm trying to come up with a simple test but here is a small java example showing what is happening above: import java.math.BigInteger; // bigInteger.longValue is -15654349 for bytes = {-1,0x11,0x22,0x33} // bigInteger.longValue is 4279312947 for bytes = {0,-1,0x11,0x22,0x33} public class tstbi { public static void main(String[] args) { BigInteger bigInteger; byte [] bytes = {0,-1,0x11,0x22,0x33}; bigInteger = new BigInteger(bytes); System.out.println("bigInteger=" + bigInteger.longValue()); } }
(fhpd) print argc [0.0] Error: ptrace: Input/output error (op 0x2 (PTRACE_PEEKDATA), pid 1022, addr 0xffffffffff9f5ea0, data 0x0) (fhpd) print argc -location [0.0] Address 0xffffffffff9f5ea0 - 4 byte(s) (fhpd) peek 0xff9f5ea0 [0.0] The value at ff9f5ea0 = 1 (fhpd)
Which register is OP_breg being applied to? long Frame.getRegister(Register) returns the register, converted to a long, based on the register's type. So for pointer registers such as $esp, that results in an unsigned extension, while for general registers (such as $eax) that will be sign-extended due to SignedType. Several questions: -> should that breg be a pointer? -> should there be a Frame method that returns registers as unsigned "Word" values (which is more like what the location expression code expects) -> should the location-expression code be doing word-sized, instead of Long sized, arrithmetic?
Fix sign extension bug with breg operation. frysk-core/frysk/debuginfo/ChangeLog 2008-01-14 Teresa Thomas <tthomas@redhat.com> * TestLocationExpression.java (testOverFlow): New. * LocationExpression.java (decode): Mask out sign extension for BREG locations.