help-octave
[Top][All Lists]
Advanced

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

Re: Inoltra: Re: debug mex file in octave


From: frank wang
Subject: Re: Inoltra: Re: debug mex file in octave
Date: Wed, 25 Oct 2006 10:12:48 -0700

Hi, John and Riccardo,
 
First thanks for the great help.
 
The trick does work. I can go through my source code now. But I have problems to pring the value of the virable.
 
I complied my code by using command:
mkoctfile --mex -g -v fft_mx512.cpp dspu_fft.cpp rd_cplx.cpp
This will include the debug symbols I think. To answer John's qeustion, then I loaded the file  by:
(gdb) file fft_mx512.mex
(gdb) b fft_mx512.cpp:40
(gdb) run
(gdb) Starting program: path/fft_mx512.mex
breakpoing 1 at oxf5177c: file fft_mx512.cpp, line 40.
warning: shared library handler failed to enable breakpoint
Reading symbols from shared object read from target memory....done.
Loaded system supplied DS0 at 0xf4f000

Program received signal SIGSEGV, Segmentation fault.
0x00000001 in ?? ()
(gdb) where
#0 0x00000001 in ??( )
(gdb)
 
That is all I got.
 
Then I started to try Riccardo's method, it works. I typed gdb octave, then run, in octave I type help fft_mx512. After that I type ctrl+c. In gdb, I set the breakpoint and type c to continue. It will go back octave. In octave, I type y=fft_mx512(x). Then gdb will break at the line in fft_mx512.cpp. The problem is when I type print command in gdb, it complains:
 
(gdb) p nFft
No symbol "nFft" in current context.
(gdb) n
(gdb) p bIsCpx
Variable "bIsCpx" is not avalable.
(gdb) l  (list the code)
nFft=mxGetM(pRhs[0]);
bIsCpx=mxIsComplex(pRhs[0]);
pInRe=mxGetPr(pRhs[0]);
 
So what should I do? Do I need to change mkoctfile? If so, what I need to do?
 
Thanks
 
Frank
 


 
On 10/25/06, John W. Eaton <address@hidden> wrote:
On 25-Oct-2006, Riccardo Corradini wrote:

|     * after the octave prompt appears, display the
| help for your dynamic function. That is, if your
| function is called 'myfunc.oct', call 'help myfunc'.
| This will load your dynamic funtion into octave space
| and gdb without tickling the bug

This part currently works for MEX files but might not in the future
because there is no help message stored in a MEX function, so there is
no point in Octave opening a MEX file to look for help.  For .oct
files, the help message can be stored in the .oct file, so this trick
will continue to work for them.

Also on 25-Oct-2006, frank wang wrote:

> Then gdb got segmentation fault. The message is
> Starting program: path/fft_mx512.mex
> breakpoing 1 at ox36277c: file fft_mx512.cpp, line
> 40.
> warning: shared library handler failed to enable
> breakpoint
> Reading symbols from shared object read from target
> memory....done.
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000001 in ?? ()
> (gdb)

Since you still have a (gdb) prompt, it is probably your program that
encountered the segfault, not gdb.  What does the gdb command "where"
tell you at this point?  If you have compiled with debugging symbols
and haven't stripped them when linking, then you should see some
useful information.  But if you compile without debugging symbols, or
remove them when linking, the debugger can't give you much
information.

Also, this is not really the right forum if what you really want is
help learning how to use gdb.

> However, since building octave for me
> is very difficult(too
> many dependency on external packages), so I decided
> to use the prebuild
> octave for Fedora.

First, if you want to rebuild a package from sources, it should not be
too hard.  Just download the sources for the RPM (or .deb file on
Debian systems) and rebuild using the same commands that the packagers
use.  Usually, this is just one or two commands, then you can install
the resulting RPM (or .deb) file as usual.  Sorry, I don't know
precisely the details.  Maybe someone else can post them.

If you want to build Octave from CVS on a Fedora or Debian system, it
is also relatively easy to install the build dependencies.  Both the
Fedora and Debian package managers maintain lists of build
dependencies, and it is possible to have the package manager install
all the dependencies at once.  Please see

https://www.cae.wisc.edu/pipermail/bug-octave/2006-October/000956.html

for more details.

I guess this needs to go in the FAQ.

jwe


reply via email to

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