Debug mexFunction of matlab using gdb
2015-10-24 17:34
316 查看
original url:
http://www.mathworks.com/help/matlab/matlab_external/debugging-on-linux-platforms.html
provides complete source code debugging, including the ability to set breakpoints, examine variables, and step through the source code line-by-line.
In this procedure, the MATLAB® command prompt
shown in front of MATLAB commands, and
different prompt. The debugger prompt is
To debug with gdb:
Compile the source MEX file with the
For this example, at the Linux prompt, type:
At the Linux prompt, start the gdb debugger using the
Tell gdb to stop for debugging.
Start MATLAB without the Java® Virtual Machine (JVM™) by using the
flag.
In MATLAB, enable debugging with the
and run your binary MEX file.
You are ready to start debugging.
It is often convenient to set a breakpoint at
routine.
Once you hit one of your breakpoints, you can make full use of any commands the debugger provides to examine variables, display memory, or inspect registers.
To proceed from a breakpoint, type:
After stopping at the last breakpoint, type:
From the MATLAB prompt you can return control to the debugger by typing:
Or, if you are finished running MATLAB, type:
When you are finished with the debugger, type:
You return to the Linux prompt.
Refer to the documentation provided with your debugger for more information on its use.
http://www.mathworks.com/help/matlab/matlab_external/debugging-on-linux-platforms.html
Debugging on Linux Platforms
The GNU® Debugger gdb, available on Linux® systems,provides complete source code debugging, including the ability to set breakpoints, examine variables, and step through the source code line-by-line.
In this procedure, the MATLAB® command prompt
>>is
shown in front of MATLAB commands, and
linux>represents a Linux prompt; your system might show a
different prompt. The debugger prompt is
<gdb>.
To debug with gdb:
Compile the source MEX file with the
-goption, which builds the file with debugging symbols included.
For this example, at the Linux prompt, type:
linux> mex -g yprime.c
At the Linux prompt, start the gdb debugger using the
matlabfunction
-Doption.
linux> matlab -Dgdb
Tell gdb to stop for debugging.
<gdb> handle SIGSEGV SIGBUS nostop noprint
Start MATLAB without the Java® Virtual Machine (JVM™) by using the
-nojvmstartup
flag.
<gdb> run -nojvm
In MATLAB, enable debugging with the
dbmexfunction
and run your binary MEX file.
>> dbmex on >> yprime(1,1:4)
You are ready to start debugging.
It is often convenient to set a breakpoint at
mexFunctionso you stop at the beginning of the gateway
routine.
<gdb> break mexFunction <gdb> r
Once you hit one of your breakpoints, you can make full use of any commands the debugger provides to examine variables, display memory, or inspect registers.
To proceed from a breakpoint, type:
<gdb> continue
After stopping at the last breakpoint, type:
<gdb> continue
yprimefinishes and MATLAB displays:
ans = 2.0000 8.9685 4.0000 -1.0947
From the MATLAB prompt you can return control to the debugger by typing:
>> dbmex stop
Or, if you are finished running MATLAB, type:
>> quit
When you are finished with the debugger, type:
<gdb> quit
You return to the Linux prompt.
Refer to the documentation provided with your debugger for more information on its use.
相关文章推荐
- matlab实现k-means聚类
- MATLAB生成可执行文件(.exe文件)
- matlab与C#混合编程
- 今天MATLAB2015B安装界面
- Science上论文——Clustering by fast search and find of density peaks中人脸实验的复现
- matlab 有约束与无约束优化求解 optimization
- Matlab 并行编程——CUDA
- 面向对象Matlab编程小demo
- 多种图像的颜色/纹理描述子及其matlab代码实现 相似性量测方法
- MatLab2012b/MatLab2013b 分类器大全(svm,knn,随机森林等)
- PCA算法学习(Matlab实现)
- hist 绘制直方图函数
- Matlab 如何绘制复杂曲线的包络线
- matlab中的括号
- matlab笔记
- Matlab数据类型及转换
- 贝叶斯分类器的一个简单应用(matlab)
- MATLAB代码转化成C+opencv时的注意事项
- 基于SIFT特征的图像配准(附Matlab源代码)
- Matlab 1-N之间的unique随机数