Debug info issue with DW_TAG_lexical_block ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I tried debugging the following function with arm and native C and C++ compiler.

void func(int in)
{
     int a;
     in++;
     {
          int k, j;
    	  k = 10;
    	  j = k + 44;
    	  in = j + 1;
    	  a = in;
     }                  <------      Line 1
     a = in;
     a++;
}           <--------- Line 2

When i try to print the value of 'a' when the execution reaches "line
2" i get the message "No symbol "a" in current context.". Here is the
gdb output:

(gdb) l
15                j = k + 44;
16                in = j + 1;
17                a = in;
18           }
19           a = in;
20           a++;
21      }
22
23      int main()
24      {
(gdb) s
21      }
(gdb) p a
No symbol "a" in current context.
(gdb) p in
$1 = 55
(gdb)

For the same program i am able to view the value of 'a' if i compile
this as a C program. This happens because DW_TAG_lexical_block which
is generated only for in C++ debug info marks the scope of variable
'a' between prologue and epilogue of the code. Since the epilogue is
not present in the scope, the variable cannot be viewed when the
control reaches the closing brace of the function.

Is this an expected behavior?
Since in C i can view the variable at the end of the function is not
logical to have the same behavior for C++ code also?

Regards,
Shafi


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux