Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tcf-dev] negative input number for unsigned ints

Hi,

 

I’m not sure, but I potentially found a bug:

Let’s assume your C code to debug contains an “unsigned int” variable. If you change the value of this variable to “-9” in the _expression_/variables view, it finally outputs 0xf7, but should read 0xfffffff7.

I tracked down the issue in file:

./plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java

 

Function:

     public static byte[] toByteArray(String s, int radix, boolean fp, int size, boolean signed, boolean big_endian) with arguments:

     s          => "-9"

     radix      => 10

     fp => false

     size       4

     signed => false

     big_endian => false

 

will produce the byte array:

     [ -9, 0, 0, 0 ]

 

should produce the byte array:

     [ -9, -1, -1, -1 ]

 

What do you think?

 

Cheers,

Conny

 

 


Back to the top