help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debugging dynamic functions


From: Braddock Gaskill
Subject: Re: debugging dynamic functions
Date: Wed, 7 Feb 2001 16:28:31 -0500

Okay, I finally think I figured out the right way to debug dynamic
functions.  Maybe this should go in the FAQ or something, because it
makes Octave oh-so-useful for debugging C algorithms.

-Compile your .oct functions with debugging symbols (-g)

-Launch and run octave under gdb (ie, `gdb octave`)

-Call your dynamically linked function once so that the .oct file and
any dependent shared libraries get loaded (is there a way to force loading?).

-ctrl-C to send a trapped break signal to Octave and drop you to the gdb prompt

-type `info shar` at the gdb prompt to see all the dynamically linked
libraries, including your .oct file.  Take note of the "Syms Read"
column..your .oct file should say "No", meaning no symbols have been
loaded (even if they are in the binary)

-type 'share myoctavefunc.oct' to load the debugging symbols, with
proper address translation, into gdb.  Type 'info shar' again to see
that they've been loaded.

-Now add your breakpoints or whatever like your normally would.  Life should be 
good.

This all works for me under Linux Mandrake 7.2 with GDB 5.0.  Note,
btw, that I learned the hard way that the add-symbol-file command in
gdb 5 is known to be broken, so you have to use 'share' and you can't
do it by hand unles you move to a development version of gdb.

BTW, I'm now using a shared lib in my .oct files very nicely with the
mkoctfile -l command as suggested by jwe...thanks!

        Hope this saves people my pain!
        -Braddock

-- 
Invention is 99% perspiration; is it fair to patent the 1% of inspiration? -BG



Attachment: pgpPrR9mx76DK.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]