Debugger Startup Commands

General questions regarding the usage of CodeLite
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Debugger Startup Commands

Post by HJarausch »

Hi,

I'm using the excellent Eigen matrix/vector template library (http://eigen.tuxfamily.org)
To display the contents of a vector or matrix there is a Python script (plugin for gdb)
which I have put into Settings / Debugger Settings / Startup Commands

And it turns out that this is written to .gdbinit in my home directory as it should

It looks like

Code: Select all

python
import sys
sys.path.insert(0,'/OBJ/Math/Eigen/debug/gdb')
from printers import register_eigen_printers
register_eigen_printers (None)
end
This does work with gdb or ddd on my Linux box, but it does not seem to work with Codelite on the very same box.
Or at least I don't know how to use it. In gdb or ddd just say

Code: Select all

p myvector
works just fine.
What am I missing?

Many thanks for a hint,
Helmut.
User avatar
eranif
CodeLite Plugin
Posts: 6163
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Startup Commands

Post by eranif »

If I understand you correctly, you want the Eigen printer to work from within codelite, am I correct?

You should note that codelite does not use the standard GDB interface, in gdb command line you type:

Code: Select all

p myvector
and it will work, however, codelite uses GDB Machine Interface
Which I am not sure it works well with pretty printers

Never tried that...

Eran
Make sure you have read the HOW TO POST thread
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Startup Commands

Post by HJarausch »

Thanks Eran. It works indeed - at least on Linux.
It works when enter p <Matrix Name> on the debugger input line.
But the (standard) display when show 'locals' doesn't use that pretty-printer.
Is there any means to get this, too?

To check it on Windows I first need to get Python and a version of gdb which is configured for Python on my MinGW.

Helmut.
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Startup Commands

Post by HJarausch »

I'm puzzled!

On one machine it's working just fine. Adding startup commands in Settings->Debugger Settings
copies these lines to $HOME/.gdbinit (which is fine). On this machine it works.

On another machine which is very similar (nearly the same GenToo Linux)
Codelite always clears the file $HOME/.gdbinit instead of copying the
lines from Settings->Debugger Settings to it. And on this machine
it doesn't work which is not surprising.

What could be the reason for that?
Thanks,
Helmut.
P.S. both machine have Codelite 4.1.5770
DavidGH
CodeLite Plugin
Posts: 707
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugger Startup Commands

Post by DavidGH »

Hi,

Thank you for realising that it's CL that's doing this; I'd noticed for a long time that .gdbinit was being cleared but I'd assumed it was a gdb bug.

Looking at the code (DbgGdb::DoLocateGdbExecutable) I'm surprised it doesn't happen on both your machines, as it always tries to do this on wxGTK/wxMac. Fixed in trunk, r6002.

Regards,

David
GravityWell
CodeLite Curious
Posts: 1
Joined: Sun Dec 16, 2012 7:23 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Debugger Startup Commands

Post by GravityWell »

eranif wrote:If I understand you correctly, you want the Eigen printer to work from within codelite, am I correct?

You should note that codelite does not use the standard GDB interface, in gdb command line you type:

Code: Select all

p myvector
and it will work, however, codelite uses GDB Machine Interface
Which I am not sure it works well with pretty printers

Never tried that...

Eran
I also struggled getting the pretty print startup script to be loaded. I finally added the commands from the script to Settings->Debugger Settings->GNU gdb Debugger->Startup commands and that seemed to work.

Much more important is the fact Codelite does not use the Python Pretty Printer for watch variables or the hovers, as mentioned above. The only way to show that it works is to use the debugger console: print varname

Is there any hope of getting this working in Codelite? If this will help, here is a wiki page I wrote for Codeblocks demonstrating the install and use:
http://wiki.codeblocks.org/index.php?ti ... y_Printers
Post Reply