Arrays badly displayed in debugger

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Arrays badly displayed in debugger

964件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mjulier on Wed Nov 06 05:14:23 MST 2013
Hello,

There are several problems with displaying the arrays in the debugger.
I tried with LPCXpresso 6.1.0. I do not know whether they come from Eclipse.

Here's an example, using a pointer:
float * tableau; // points to an array of 256 numbers


Here are the things that work correctly:
tableau        float *   0x2007e7fc
  *tableau     float     2011.57495
tableau[1]     float     2012.07495
&tableau[1]    float *   0x2007e800
  *&tableau[1] float     2012.07495
tableau+1      float *   0x2007e800
  *tableau+1   float     2012.07495


Here are the things that really do not work:

1) using "right-click" and "display as array" (start index=0, length = 256):
tableau                              float [256]  0x2007e7fc    
    [0...99]                         float [100]  0x2007e7fc    
    [100...199]                      float [100]  0x2007eb1c    
        *((tableau)+100)@100[100]    float        2062.7749    
        *((tableau)+100)@100[101]    float        2062.75    
(...)
        *((tableau)+100)@100[154]    float        2068.30005    
        *((tableau)+100)@100[155]    float        2068.3999    
        *((tableau)+100)@100[156]    float        -1.31126478e-006    
(...) 
    [200...255]                      float [56]   0x2007ee3c    

Values [0] to [99] are displayed correctly.
But see that tableau[100] is set at 0x20007eb1c, this is 800 bytes after the beginning 0x20007e7fc, but it should be 400 bytes because float is 4 bytes and I have no special alignment.
As a result: value for tableau[156] is out of the array because it actually displays tableau[256]

2) trying to indicate the array size in the expression, using "(*tableau)@256":
tableau         float *        0x2007e7fc    
    *tableau    float          2011.57495    
(*tableau)@256  float [256]    0x2007e7fc    
    [0...99]    float [100]    0x2007e7fc    
        (*tableau)@256[0]    Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * (*tableau)@256[0] Error message from debugger back end: cannot subscript something of type `int'\ Unable to create variable object    
(...)
    [100...199] float [100]    0x2007e98c    
    [200...255] float [56]     0x2007eb1c    

See that the addresses and types are good, but the values cannot be retrieved.

3) using the expression "tableau@256":
tableau       float *         0x2007e7fc    
    *tableau  float           2011.57495    
tableau@256   float *[256]    0x10006cac
    [0...99]  float *[100]    0x10006cac
         tableau@256[0]Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * tableau@256[0] Error message from debugger back end: cannot subscript something of type `int'\ Unable to create variable object

See: type is wrong, address is wrong, and cannot get values either.

4) trying to cast the pointer to an array type:
tableau                        float *        0x2007e7fc    
    *tableau                   float          2011.57495    
(float[256])tableau            float [256]    0x10006cac    
    [0...99]                   float [100]    0x10006cac    
        (float[256])tableau[0] float [256]    0x2007e7fc    
            [0...99]           float [100]    0x2007e7fc    
            [100...199]        float [100]    0x2007e98c    
            [200...255]        float [56]     0x2007eb1c    
        (float[256])tableau[1] float [256]    0x2007e800    
            [0...99]           float [100]    0x2007e800    
            [100...199]        float [100]    0x2007e990    
            [200...255]        float [56]     0x2007eb20  

See: pure nonsense, displays an array of arrays. Cannot get any value either.

What would also be needed:
Exporting a large array into a file, or copying a large array without cutting each 100 elements.
When trying to view large arrays with Excel, this limit is not convenient.
And more: copying large arrays is painfully slow and somewhat unreliable!

Miguel
0 件の賞賛
返信
1 返信

808件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Nov 06 10:35:34 MST 2013
Yes, this appears to be a bug in Eclipse/CDT (Juno). I cannot find a workaround.

This is fixed in Eclipse Kepler, which we will be moving to in early 2014.
0 件の賞賛
返信