|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Debugging .mex files (Windows)I can't find any documentation for how to do this in Windows. Has anyone succesfully debugged a mex file in Windows? I attempted to attach Octave in Visual Studios 2005, but Visual studios didn't seem to understand that the .mex file and .cpp file were related.
Any help would be appreciated, even if its just to say that its impossible. Thank you, gOS p.s. (please don't tell me to switch operating systems, thank you) |
|
|
Re: Debugging .mex files (Windows)On Mon, Jul 7, 2008 at 8:02 PM, gOS <bkirklin@...> wrote:
> > I can't find any documentation for how to do this in Windows. Has anyone > succesfully debugged a mex file in Windows? I attempted to attach Octave in > Visual Studios 2005, but Visual studios didn't seem to understand that the > .mex file and .cpp file were related. > > Any help would be appreciated, even if its just to say that its impossible. 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. Michael. _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Debugging .mex files (Windows)I was not successful last time I attempted this, so I'm bumping the topic and posting more information.
Files used for this example: 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 <bug@octave.org> (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> |
|
|
Re: Debugging .mex files (Windows) |
|
|
Re: Debugging .mex files (Windows)On Mon, Jul 28, 2008 at 6:50 PM, gOS <bkirklin@...> wrote:
> > I was not successful last time I attempted this, so I'm bumping the topic and > posting more information. [snip] > 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 The link step is missing the debug flag (needed under MVSC, not with gcc). So it seems there's a bug in mkoctfile.exe. For the time being, you can run the link step manually (the "link" command) and add the flag "-debug". Michael. _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Debugging .mex files (Windows)
I've tried doing this in the Visual Studio 2005 Command Prompt, but I've been unsuccessful. I'm very much the novice when it comes to this. I tried: In octave: mkoctfile --mex -g -c dlmread.cpp In VSPrompt: link /DEBUG /OUT:dlmread.mex among other commands all of which did not work, or specifically failed to use the debug flag. Perhaps I've misunderstood what you are suggesting. I looked through mkoctfile.cc.in for more hints as to what might be going on... -g does this: vars["ALL_CFLAGS"] += " -g"; vars["ALL_CXXFLAGS"] += " -g"; vars["ALL_FFLAGS"] += " -g"; If thats all that happens, then it makes sense that the \DEBUG flag is never included for compiling. Command "mkoctfile --mex -g -c dlmread.cpp" produces dlmread.o and vc80.pdb. What is the link step specifically? |
| Free embeddable forum powered by Nabble | Forum Help |