GDB printing for std::shared_pointer

CodeLite installation/troubleshooting forum
JacktheRipperRM
CodeLite Curious
Posts: 2
Joined: Thu Dec 05, 2019 1:28 am
Genuine User: Yes
IDE Question: C++
Contact:

GDB printing for std::shared_pointer

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: GDB printing for std::shared_pointer

Post 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
Make sure you have read the HOW TO POST thread
JacktheRipperRM
CodeLite Curious
Posts: 2
Joined: Thu Dec 05, 2019 1:28 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: GDB printing for std::shared_pointer

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: GDB printing for std::shared_pointer

Post by eranif »

This is now fixed in git master
Eran
Make sure you have read the HOW TO POST thread
Post Reply