public inbox for frysk-bugzilla@sourceware.org
help / color / mirror / Atom feed
* [Bug general/5540] New: location expression DW_OP_breg is sign extended
@ 2008-01-03 22:32 scox at redhat dot com
  2008-01-03 23:03 ` [Bug general/5540] " scox at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: scox at redhat dot com @ 2008-01-03 22:32 UTC (permalink / raw)
  To: frysk-bugzilla

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());
  }
}

-- 
           Summary: location expression DW_OP_breg is sign extended
           Product: frysk
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: general
        AssignedTo: frysk-bugzilla at sourceware dot org
        ReportedBy: scox at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5540

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug general/5540] location expression DW_OP_breg is sign extended
  2008-01-03 22:32 [Bug general/5540] New: location expression DW_OP_breg is sign extended scox at redhat dot com
@ 2008-01-03 23:03 ` scox at redhat dot com
  2008-01-11 17:44 ` cagney at redhat dot com
  2008-01-14 21:08 ` tthomas at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: scox at redhat dot com @ 2008-01-03 23:03 UTC (permalink / raw)
  To: frysk-bugzilla


------- Additional Comments From scox at redhat dot com  2008-01-03 23:02 -------
(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) 


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5540

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug general/5540] location expression DW_OP_breg is sign extended
  2008-01-03 22:32 [Bug general/5540] New: location expression DW_OP_breg is sign extended scox at redhat dot com
  2008-01-03 23:03 ` [Bug general/5540] " scox at redhat dot com
@ 2008-01-11 17:44 ` cagney at redhat dot com
  2008-01-14 21:08 ` tthomas at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cagney at redhat dot com @ 2008-01-11 17:44 UTC (permalink / raw)
  To: frysk-bugzilla


------- Additional Comments From cagney at redhat dot com  2008-01-11 17:44 -------
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?

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5540

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug general/5540] location expression DW_OP_breg is sign extended
  2008-01-03 22:32 [Bug general/5540] New: location expression DW_OP_breg is sign extended scox at redhat dot com
  2008-01-03 23:03 ` [Bug general/5540] " scox at redhat dot com
  2008-01-11 17:44 ` cagney at redhat dot com
@ 2008-01-14 21:08 ` tthomas at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tthomas at redhat dot com @ 2008-01-14 21:08 UTC (permalink / raw)
  To: frysk-bugzilla


------- Additional Comments From tthomas at redhat dot com  2008-01-14 21:07 -------
    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.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5540

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-14 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-03 22:32 [Bug general/5540] New: location expression DW_OP_breg is sign extended scox at redhat dot com
2008-01-03 23:03 ` [Bug general/5540] " scox at redhat dot com
2008-01-11 17:44 ` cagney at redhat dot com
2008-01-14 21:08 ` tthomas at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).