Debugging with GDB - How to get Values
-
- CodeLite Guru
- Posts: 352
- Joined: Sun Nov 29, 2009 7:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Debugging with GDB - How to get Values
My App was crashing, so I decided to Debug using GDB. My app Consists of std::Vector and wxArrayString among others.
I can see the two variables but cant poke to see what is inside. I mean the wxString inside array and the stuffs carried in std::vector.
How do I do that? Any tutorial, if I'm missing?
Thanks (BTW app is working but I just want to know the how-to)
I can see the two variables but cant poke to see what is inside. I mean the wxString inside array and the stuffs carried in std::vector.
How do I do that? Any tutorial, if I'm missing?
Thanks (BTW app is working but I just want to know the how-to)
CodeLite 15.x
CodeLite is awesome, I just Love it!
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
gdb is very limited when it comes to debug complex structures (unlike VC debugger..)
There is no built-in support for this, luckily there is a nice workaround that you can use:
From the menu: 'settings -> debugger settings' and open the tab named 'PreDefined Types'
and add 2 new types:
And close the dialog.
Now, when debugging, whenever you want to query a wxArrayString or vector, position the mouse on top of the variable you want to query and select from the context menu: 'More watches -> watch as 'vector' (or whatever the actual type is)
You will now have a new entry in the watches table, double click it and you will be able to query it in the regular manner of tree format.
Eran
There is no built-in support for this, luckily there is a nice workaround that you can use:
From the menu: 'settings -> debugger settings' and open the tab named 'PreDefined Types'
and add 2 new types:
Code: Select all
Type: wxArrayString
Expression: *($(Variable).m_pItems)@$(Variable).m_nCount
Debugger Command: print
Code: Select all
Type: vector
Expression: *($(Variable)._M_impl._M_start)@$(Variable).size()
Debugger Command: print
Now, when debugging, whenever you want to query a wxArrayString or vector, position the mouse on top of the variable you want to query and select from the context menu: 'More watches -> watch as 'vector' (or whatever the actual type is)
You will now have a new entry in the watches table, double click it and you will be able to query it in the regular manner of tree format.
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Guru
- Posts: 352
- Joined: Sun Nov 29, 2009 7:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
Thanks Eran,
I'm going to do that!
I'm going to do that!
CodeLite 15.x
CodeLite is awesome, I just Love it!
-
- CodeLite Guru
- Posts: 352
- Joined: Sun Nov 29, 2009 7:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
Actually the situation is little complex, The Vector holds wxArrayString. I want to be able to examine contents of wxArrayString I wonder why I cannot even see simple wxArrayString using procedure above.
Last edited by evstevemd on Mon Sep 13, 2010 1:16 pm, edited 1 time in total.
CodeLite 15.x
CodeLite is awesome, I just Love it!
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
Upload the file debuggers.xml (rename it) to this post, and I will have a look.
Also, remember to mention your codelite version and wx version
You should post your local copy of the file (from C:\Document and Settings\User\ApplicatioData\Codelite\config)
Eran
Also, remember to mention your codelite version and wx version
You should post your local copy of the file (from C:\Document and Settings\User\ApplicatioData\Codelite\config)
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Guru
- Posts: 352
- Joined: Sun Nov 29, 2009 7:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
Where is it living?
I can find debuggers.xml.default and nothing else.
CodeLite: 2.7 (I updated yesterday via SVN) and wxWidgets that comes with CL
I can find debuggers.xml.default and nothing else.
CodeLite: 2.7 (I updated yesterday via SVN) and wxWidgets that comes with CL
CodeLite 15.x
CodeLite is awesome, I just Love it!
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
For Win XP, have a look at my previous post.
Win7, C:\Users\<name>\AppData\codelite (or something like that)
Eran
Win7, C:\Users\<name>\AppData\codelite (or something like that)
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Guru
- Posts: 352
- Joined: Sun Nov 29, 2009 7:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
Here it is, zipped file
You do not have the required permissions to view the files attached to this post.
CodeLite 15.x
CodeLite is awesome, I just Love it!
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
Have u tried to double click on the entry in the 'Watches' table?evstevemd wrote:I wonder why I cannot even see simple wxArrayString using procedure above.
Also, to be able to do the same from the 'Locals' view, you need to enable the option (from 'settings -> debugger settings...'):
'Evaluate items in the 'Locals' view based on the 'PreDefined' types where possible'
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Guru
- Posts: 352
- Joined: Sun Nov 29, 2009 7:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debugging with GDB - How to get Values
'Evaluate items in the 'Locals' view based on the 'PreDefined' types where possible'
What do you mean? I don't understand that!
What do you mean? I don't understand that!
CodeLite 15.x
CodeLite is awesome, I just Love it!