Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 371014 - Doubled variables in Variable view
Summary: Doubled variables in Variable view
Status: CLOSED DUPLICATE of bug 368565
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 17:01 EST by Jason Litton CLA
Modified: 2012-02-23 11:30 EST (History)
3 users (show)

See Also:


Attachments
GDB Traces of problem (13.86 KB, text/plain)
2012-02-09 14:43 EST, Jason Litton CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Litton CLA 2012-02-08 17:01:30 EST
Build Identifier: 8.01

I was debugging hardware (bios) from the reset vector, when trying to set watchpoints in a ram stage debug, and I got doubled variables in the variable view (in the example code below, variable1 would be doubled, one on top of the table and one on bottom of the table). If I try to click on one of these variables in order to set a watchpoint, the highlighting flickers rapidly between the two variables and a watchpoint can't be set. The code being debugged looks like:

void foo(int variable1);

void foo(int variable1)
{
//do stuff
}

Looking at a GDB console, I can see that GDB is only aware of one variable named variable1, so it appears there's something strange in the CDT handling code.

Reproducible: Always

Steps to Reproduce:
1. Attach a debug session through GDB to a remote target.
2. Ensure the target is at or near the reset vector.
3. Let the target run somewhere into early BIOS startup, where there is source code present. (This problem does not happen after the BIOS is loaded).
4. Look at the Variables tab in the debug view, there should be two copies of at least on variable.
5. Left click on one copy of the doubled variable, the highlighting will flicker.
Comment 1 Marc Khouzam CLA 2012-02-09 12:43:05 EST
Could you post the gdb traces?
http://wiki.eclipse.org/CDT/User/FAQ#I.27ve_been_asked_for_.27gdb_traces.27.2C_where_can_I_find_them.3F

Thanks
Comment 2 Jason Litton CLA 2012-02-09 14:43:41 EST
Created attachment 210819 [details]
GDB Traces of problem

Here are the GDB traces as requested. I've taken out some sideband commands that we're sending that don't affect the debugging through GDB and changed file names.
Comment 3 Marc Khouzam CLA 2012-02-09 14:50:43 EST
What is the variable name that is duplicated? There is no 'variable1' in the traces.
Comment 4 Jason Litton CLA 2012-02-09 15:03:06 EST
Apologies. The doubled variable is boot_complete.
Comment 5 Nobody - feel free to take it CLA 2012-02-09 15:41:34 EST
I may be missing something, but according to the trace 'boot_complete' is an argument of 'hardwaremain' function. If this is correct 'boot_complete' should not be reported as a local variable in

960,284 64-stack-list-locals --thread 1 --frame 0 1
960,303 64^done,locals=[{name="lb_mem",value="0x1001fe"},{name="boot_complete",value="0"}]
Comment 6 Marc Khouzam CLA 2012-02-09 16:01:46 EST
(In reply to comment #5)
> I may be missing something, but according to the trace 'boot_complete' is an
> argument of 'hardwaremain' function. If this is correct 'boot_complete' should
> not be reported as a local variable in
> 
> 960,284 64-stack-list-locals --thread 1 --frame 0 1
> 960,303
> 64^done,locals=[{name="lb_mem",value="0x1001fe"},{name="boot_complete",value="0"}]

Unless it is also declared as a local variable, shadowing the argument.  This would explain the double entry in the debug view.  We handle two local variables with the same name by only showing one, but we don't handle one local variable and one argument.
Comment 7 Marc Khouzam CLA 2012-02-09 16:04:38 EST
See bug 368565 comment 2:
"This is related to Bug 210976, except that in your case one variable is an
argument while the other is a local variable."

*** This bug has been marked as a duplicate of bug 368565 ***
Comment 8 Marc Khouzam CLA 2012-02-09 16:05:06 EST
Thanks Mikhail for noticing the variable was also a parameter.