Page 1 of 1

GDB printing for std::shared_pointer

Posted: Sun Aug 23, 2020 6:46 pm
by JacktheRipperRM
Count value is not getting printed for shared pointers.

Setup :
CodeLite : 14.0.2
GDB : GNU gdb (GDB) 8.1

GDB might not have the issue as i can print this directly from the debug terminal of the CodeLite.

-stack-list-variables --thread 1 --frame 0 --all-values
DEBUG>>-stack-list-variables --thread 1 --frame 0 --all-values
DEBUG>>^done,variables=[{name="p1",value="std::shared_ptr<int> (use count 2, weak count 0) = {get() = 0xf32020}"},{name="p2",value="std::shared_ptr<int> (use count 2, weak count 0) = {get() = 0xf32020}"}]

Please help here.

BR,Rajdeep

Re: GDB printing for std::shared_pointer

Posted: Tue Sep 01, 2020 12:39 pm
by eranif
By looking at CodeLite's source, I can see that this is the command used by CodeLIte to query the locals:

Code: Select all

-stack-list-variables --skip-unavailable 2
What is the result you get when you run this command locally?

EDIT:
I just tested this locally, the problem is like I said: the output displayed by CodeLIte is because CodeLite uses the command above and not the one you printed. iirc, this is because of older gdb versions

You can open a bug for this
Eran

Re: GDB printing for std::shared_pointer

Posted: Wed Sep 02, 2020 11:11 pm
by JacktheRipperRM
Hey Eran,
Here is the printout :

Code: Select all

-stack-list-variables --skip-unavailable 2
DEBUG>>-stack-list-variables --skip-unavailable 2
DEBUG>>^done,variables=[{name="p1",type="std::shared_ptr<int>"},{name="p2",type="std::shared_ptr<int>"}]
One question :
Do you mean to open a bug for codelite or in GDB ?

I haven't done it before. Would you help me ?

-BR,Rajdeep

Re: GDB printing for std::shared_pointer

Posted: Fri Oct 02, 2020 7:06 am
by eranif
This is now fixed in git master
Eran