News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

gdb, shared_ptr and code::blocks

Started by babis, January 19, 2016, 12:13:12 AM

Previous topic - Next topic

babis

Hi,

I'm using code::blocks 13.12 in Linux Mint.
I have both gdb 7.10.1 and 7.7.1, and I've downloaded the python code for pretty printing -- both exhibit the below problem.
Sometimes, when I'm trying to print a shared_ptr ( using either "print (*ptr.get())" or "print *ptr" or "print *ptr._M_ptr") I get no output; it just halts there and I have to kill gdb, sometimes code::blocks too. I've tried the same thing in Eclipse, but I didn't get such a problem. The structure that I'm trying to print (or equivalently, display in the watch window) is complex; several STL vectors and sets and maps and so on.

I created a test application with a shared_ptr of a very simple structure, and it works as expected.
If I print a variable within the structure, it also works ok.
I'm suspecting a "maximum size" of sorts, that I'm exceeding.

Anybody have any ideas?

Thanks.

oBFusCATed

If the vectors are containing lots of data then probably this is causing the problem.
At the moment nothing could be done as far as I know.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

babis

Thanks! Quick and spot on :)

I'm pretty sure I've seen a post somewhere to add some line in the python code to clamp the displayed number of elements, but I've lost it now dammit...

babis

Ok, for reference, it's fixed by just setting a limit to how many elements shall be printed, for example using the below:

set print elements 100

in .gdbinit or the debugger initialization commands