| Summary: | Local variables don't show up in Local variables window | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Marco Lazzaroni <motumboe> |
| Component: | cdt-autotools | Assignee: | Jeff Johnston <jjohnstn> |
| Status: | CLOSED DUPLICATE | QA Contact: | Jeff Johnston <jjohnstn> |
| Severity: | minor | ||
| Priority: | P3 | CC: | akurtakov, cdtdoug |
| Version: | 8.1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Marco Lazzaroni
Also, the hover feature (the one that lets you see in a tooltip the value of a variable while debugging) doesn't work here. (In reply to comment #1) > Also, the hover feature (the one that lets you see in a tooltip the value of a > variable while debugging) doesn't work here. The problems is dependent on the same underlying issue which is the compilation options used. The default options picked by autotools (the autotools themselves and not the plug-in) are "-g -O2". Note the optimization level. Let's take the following modified hello world program: int main(void) { int a = 3; puts("Hello World"); printf("a is %d\n", a); return 0; } In this example, I printed the value of "a" so that "a" is actually used and so won't be totally optimized away. Please confirm that your hovering issue is due to the variable not being used and thus completely optimized away. If not, open a separate bug. For this program, -O2 optimizes out the int a = 3; line altogether. Trying to debug, the first line in the program becomes the puts line. This is to be expected. If I hover over the variable a in the debug source window, I do in fact see it is 3. Likewise, if I click on gdb in the debug window to switch to the gdb executable, I can then type in the Console window: print a gdb responds: $1 = 3 Now, as you have correctly noted, the variable is not shown in the local variables window. I am opening an upstream CDT bug against this as it is not specific to Autotools projects. If I create a non-autotools Hello World program (Executable option in new C project) and I fiddle with the optimization level in the Build Settings to be -O2, the same behaviour occurs. The local variable is not shown, though gdb knows about it. To workaround this problem for the time-being, you can override the default CFLAGS used. One way to do this is to put the following line in your configure.ac file: CFLAGS="-g -O0" You can pick -O1 if you prefer. Or you can use the gdb console trick to have gdb tell you what the variable is if you prefer to stick with -O2. *** This bug has been marked as a duplicate of bug 336405 *** |