Page 1 of 1

Debugger Startup Commands

Posted: Fri Dec 07, 2012 3:25 pm
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.

Re: Debugger Startup Commands

Posted: Fri Dec 07, 2012 11:39 pm
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

Re: Debugger Startup Commands

Posted: Tue Dec 11, 2012 12:51 pm
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.

Re: Debugger Startup Commands

Posted: Tue Dec 11, 2012 1:49 pm
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

Re: Debugger Startup Commands

Posted: Thu Dec 13, 2012 1:13 am
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

Re: Debugger Startup Commands

Posted: Sun Dec 16, 2012 7:33 pm
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