help-octave
[Top][All Lists]
Advanced

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

Re: Debugging .mex files (Windows)


From: gOS
Subject: Re: Debugging .mex files (Windows)
Date: Mon, 28 Jul 2008 09:50:03 -0700 (PDT)

I was not successful last time I attempted this, so I'm bumping the topic and
posting more information.


Michael Goffioul-2 wrote:
> 
> It *is* possible (for instance I used to debug my java oct-file with
> VS2005),
> but you must compile your mex file with debug enabled (at compile and
> link time). If you use mkoctfile to compile your mex file, use the -v flag
> to see how the compiler is invoked and check whether the debug flags
> are correctly used.
> 

Files used for this example:

http://www.nabble.com/file/p18694671/tfile.csv tfile.csv 

Below the equal sign line is the process I followed to try to debug a .mex
file.
At step 7, the debugger is supposed to kick in and find the break point,
but it does not.

I'm wondering if this has anything to do with it:
'octave.exe': Loaded 'C:\LIB\octave\bin\octave.exe', Binary was not built
with debug information.

===================================================

1) mex -g dlmread.cpp
2) Started Visual Studio 2005, leaving octave open.
3) Debug > Attach To Process...
4) Chose Octave
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
        Ouptut:
                'octave.exe': Loaded 'C:\LIB\octave\bin\octave.exe', Binary was 
not built
with debug information.
                'octave.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', 
Exports loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\octinterp.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\octave.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\cruft.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\liblapack.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\libblas.dll', Exports 
loaded.
                'octave.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\msvcr80.dll',
Exports loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\libfftw3-3.dll', 
Exports loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\libreadline-5.dll', 
Exports
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', 
Exports loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\libncurses-5.dll', 
Exports loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', Exports 
loaded.
                'octave.exe': Loaded
'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\msvcp80.dll',
Exports loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\libhdf5-0.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\LIB\octave\bin\zlib1.dll', Exports 
loaded.
                'octave.exe': Loaded
'C:\LIB\octave\libexec\octave\3.0.1\oct\i686-pc-msdosmsvc\dispatch.oct',
Exports loaded.
                'octave.exe': Loaded
'C:\LIB\octave\libexec\octave\3.0.1\oct\i686-pc-msdosmsvc\cellfun.oct',
Exports loaded.
                'octave.exe': Loaded
'C:\LIB\octave\libexec\octave\3.0.1\oct\i686-pc-msdosmsvc\find.oct', Exports
loaded.
                'octave.exe': Loaded
'C:\LIB\octave\libexec\octave\packages\windows-1.0.5\i686-pc-msdosmsvc-api-v32\__COM__.oct',
Exports loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', 
Exports loaded.
                'octave.exe': Loaded
'C:\LIB\octave\libexec\octave\3.0.1\oct\i686-pc-msdosmsvc\getpwent.oct',
Exports loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', Exports 
loaded.
                'octave.exe': Loaded 'C:\WINDOWS\system32\version.dll', Exports 
loaded.
                The thread 'Win32 Thread' (0x98) has exited with code 0 (0x0).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -     

5) Open dlmread.cpp

6) Right click & set breakpoint at line 40

7) run at terminal: dlmread('tfile.csv')

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -     
        Output:
                'octave.exe': Loaded 'C:\Documents and
Settings\bkirklin\SVN\trunk\octave\lib\dlmread.mex', Exports loaded.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -     

No change

Octave Terminal Output for entire process:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -     

Starting Octave for Compiling Mex Files

Setting environment for using Microsoft Visual Studio 2005 x86 tools.

Attempting to detect a Microsoft Visual Studio installation

Setting environment for using Microsoft Visual Studio 2005 x86 tools.

Targeting Windows XP 32 DEBUG

GNU Octave, version 3.0.1
Copyright (C) 2008 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Octave was configured for "i686-pc-msdosmsvc".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html

Report bugs to <address@hidden> (but first, please read
http://www.octave.org/bugs.html to learn how to write a helpful report).

For information about changes from previous versions, type `news'.

 - Use `pkg list' to see a list of installed packages.
 - SciTE editor installed. Use `edit' to start the editor.
 - MSYS shell available (C:\LIB\Octave\msys).
 - Graphics backend: gnuplot.

 Volume in drive C has no label.
 Volume Serial Number is 3C10-9478

octave:1> cd SRC
octave:2> mex -g -v dlmread.cpp
cc-msvc -d -c -I.  -Ic:/Software/VCLibs/include 
-IC:\LIB\Octave\include\octave-
3.0.1 -IC:\LIB\Octave\include\octave-3.0.1\octave -IC:\LIB\Octave\include 
-O2 -
EHs -MD -g   -I.  dlmread.cpp -o dlmread.o
cl -nologo -c -I. -Ic:/Software/VCLibs/include
-IC:\LIB\Octave\include\octave-3.
0.1 -IC:\LIB\Octave\include\octave-3.0.1\octave -IC:\LIB\Octave\include -O2
-EHs
 -MD -Zi -I. dlmread.cpp -Fodlmread.o
dlmread.cpp
cc-msvc -d -shared  -o dlmread.mex  dlmread.o   -Wl,-export:mexFunction
-LC:\LIB
\Octave\lib\octave-3.0.1 -LC:\LIB\Octave\lib -loctinterp -loctave  -lcruft 
-lla
pack -lblas -lfftw3 -lreadline  -lncurses -lhdf5 -lzlib  -lws2_32 -lkernel32
-lh
df5 -lzlib -lf2c -lkernel32
link -nologo -DLL -out:dlmread.mex dlmread.o -export:mexFunction
-LIBPATH:C:\LIB
\Octave\lib\octave-3.0.1 -LIBPATH:C:\LIB\Octave\lib octinterp.lib octave.lib
cru
ft.lib lapack.lib blas.lib fftw3.lib readline.lib ncurses.lib hdf5.lib
zlib.lib
ws2_32.lib kernel32.lib hdf5.lib zlib.lib f2c.lib kernel32.lib
   Creating library dlmread.lib and object dlmread.exp
mt -nologo -outputresource:dlmread.mex -manifest dlmread.mex.manifest
octave:2> mex dlmread.cpp
dlmread.cpp
   Creating library dlmread.lib and object dlmread.exp
octave:3> cd ..
octave:4> dlmread('tfile.csv')
UL(0,0) BR(5,8)
ans =

   95   76   61   40    5   20    1   41
   23   45   79   93   35   19   74   84
   60    1   92   91   81   60   44   52
   48   82   73   41    0   27   93   20
   89   44   17   89   13   19   46   67

octave:5>
-- 
View this message in context: 
http://www.nabble.com/Debugging-.mex-files-%28Windows%29-tp18322808p18694671.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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