Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] [Major Bug?] CDT creates GDB variables but does not delete them

Hi,

I'm gonna raise a bug if no one has a solution for this. To me this is major
as it has negative impact on remote/embedded debugging and could be seen as
a kind of "memory leak":

CDT creates GDB variables for expressions, registers, etc. to evaluate them.

I added the following watch expression "*(unsigned int*) 0x201234" in the
expressions view.

Verbose example:

3245-var-create - * "*(unsigned int*) 0x201234"
3245^done,name="var92",numchild="0",type="unsigned int"
(gdb) 
3246-var-evaluate-expression var92
3246^done,value="4278865748"
(gdb)

[This causes GDB to read 4 bytes at 0x201234]

Alright. CDT does not delete var92. Now I resume until I hit a breakpoint
again.

Verbose after halt:

3253-var-update var92
3253^done,changelist=[]

[This causes GDB to read 4 bytes at 0x201234]

But now CDT creates another variable for the watch expression !

3256-var-create - * "*(unsigned int*) 0x201234"
3256^done,name="var93",numchild="0",type="unsigned int"
(gdb) 
3257-var-evaluate-expression var93
3257^done,value="4278865748"
(gdb)

[This causes GDB to read 4 bytes at 0x201234]

So this time GDB already has to read 8 bytes in total (twice the same
address).

If I resume again and hit the next breakpoint (or interrupt) CDT will create
ANOTHER variable "var94" and GDB will read 12 bytes.

To sum it up: Every time the target halts, CDT creates a new variable for
every watch expression (and maybe other stuff, too - I don't see any delete)
"-var-create" and updates its previous variables "-var-update". So with
every halt CDT forces GDB to read more memory (4, 8, 12, 16, 20, 24, 28,
...) - every time the same address.

You maybe don't notice this on a local machine. But if you debug a remote
target you will sooner or later notice a slow down.

Even worse: After deleting my watch expression "*(unsigned int*) 0x201234"
CDT still updates its previous variables ("-var-update" which it has created
for that expression. So even if the watch expression does not exist any more
GDB will  still read the memory.

Eclipse RC7 + CDT 3.2 HEAD (1-2 weeks ago or so)

Sascha




Back to the top