This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

local array variables in debugger watch-local window not right...?

local array variables in debugger watch-local window not right...?

I detected a strangeness during function's debugging. Local array in Watch/local window was shows with incorrect Address and values.
Is this IDE's mistake (uVision3 V3.34) or my incompetence?

____________________________________________________
small example:

        a) Programm's source with breakpoint:
        .........................................
        void lcd_print (unsigned char const *string)
        {
            char AAA[5] = "11";
            char * pc;
            pc = AAA;
   -->      while (*pc)
        .........................................

     b) Information in Watch/local window:
        .........................................
        AAA                     |0x4000414[...]
         +--[0]                 |0x00
         +--[1]                 |0x00
         +--[2]                 |0x00
         +--[3]                 |0x00
         +--[4]                 |0x00

        pc                      |0x400043C
         +--*pc                 |0x31


It is incomprehensible:

Why AAA and pc has different addresses?
Why *pc show correct value 0x31 = '1', but AAA[0] - incorrect?

Eugeny

PS. However, function work correctly!!!

  • This looks ok here with uVision 3.50b and
    SARM.DLL V3.04a. The stack frame gets valid once you reach the line 'pc = AAA;' - it is not valid before:

    void lcd_print (unsigned char const *string)  {
      char AAA[5] = "11";
      char *pc;
    
      pc = AAA;       // AAA[] init is actually done here !
      while (*pc++);
    }
    int main (void)  {
      lcd_print ("Tester");
      ...
    }
    
          AAA                     |0x00000308[...]
             +--[0]                 |0x31
             +--[1]                 |0x31
             +--[2]                 |0x00
             +--[3]                 |0x00
             +--[4]                 |0x00
    
            pc                      |0x400043C
             +--*pc                 |0x31
    

  • Thank for answer, Peter!
    As I understood, You check in sumulate mode. I tray this example in sumulate mode too (earlier I works in JTAG-debugging mode with MCBSTR9 Evaluation Board).
    Of course, I check the variables after "pc = AAA;" operator. But uVision 3.34 do not working properly in both modes.

    I get uVision 3.34 with Keil MCBSTR9 Evaluation Board and Keil JTAG-2 adapter in December 2006. Where I can get trial-version uVision 3.50b?