没有加载符号:libmex.pdb未加载(throw_segv_longjmp_seh_filter()= EXCEPTION_CONTINUE_SEARCH:C ++异常) [英] No Symbols Loaded: libmex.pdb not loaded (throw_segv_longjmp_seh_filter() = EXCEPTION_CONTINUE_SEARCH : C++ exception)

查看:1945
本文介绍了没有加载符号:libmex.pdb未加载(throw_segv_longjmp_seh_filter()= EXCEPTION_CONTINUE_SEARCH:C ++异常)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了创建一个 MEX函数,并使用我的 MATLAB 代码,如下所示:

  [pow,index] = mx_minimum_power(A11,A12,A13,A22,A23,A33); 

我创建了文件 mx_minimum_power.cpp 并写下以下代码:

  #include< math.h> 
#include< complex>
#includemex.h
#includematrix.h
#includecvm.h
#includeblas.h
#include cfun.h

使用std :: complex;
使用命名空间cvm;

/ *网关功能* /
void mexFunction(int nlhs,mxArray * plhs [],int nrhs,const mxArray * prhs [])
{
const int arraysize = 62172;
const int matrixDimention = 3;
float * inMatrixA11 =(float *)mxGetPr(prhs [0]);
complex< float> * inMatrixA12 =(complex< float> *)mxGetPr(prhs [1]);
complex< float> * inMatrixA13 =(complex< float> *)mxGetPr(prhs [2]);
float * inMatrixA22 =(float *)mxGetPr(prhs [3]);
complex< float> * inMatrixA23 =(complex< float> *)mxGetPr(prhs [4]);
float * inMatrixA33 =(float *)mxGetPr(prhs [5]);
basic_schmatrix< float,complex< float> > A(matrixDimention);
int i = 0; (i = 0; i



但是如果我点击 Step Over 按钮,我会遇到以下消息:





将以下信息添加到输出中:

  MATLAB.exe中0x000007FEFCAE9E5D的第一次异常:Microsoft C ++异常:内存位置0x0000000004022570处的cvm :: cvmexception。 
> throw_segv_longjmp_seh_filter()
throw_segv_longjmp_seh_filter():C ++ exception
< throw_segv_longjmp_seh_filter()= EXCEPTION_CONTINUE_SEARCH



你可以建议我,为什么在这一行需要 libmex.pdb ,我该怎么解决这个问题?






如果我停止调试,我将在 MATLAB命令窗口中获取以下信息

  MEX文件中出现意外的标准异常。 
What()是:第一个索引值0超出[1,4]范围






在按步骤按钮之前,我们为 A11 [0]提供以下值, A12 [0],A13 [0],A22 [0],A23 [0],A33 [0]





MEX 函数:



也许问题是因为矩阵 A 的错误分配,在按步骤之前,按钮。



解决方案

p>出现此问题是因为我们在 cvm.h 文件的第48到53行中有以下代码:

  // 5.7基于0的索引
#if定义(CVM_ZERO_BASED)
#define CVM0 TINT_ZERO //!<索引基数,默认为1,当定义了\c CVM_ZERO_BASED时为0
#else
#define CVM0 TINT_ONE //!<索引基数,默认值为1,如果定义了\c CVM_ZERO_BASED,则为0
#endif

这使得默认情况下 CVM0 = 1 。所以如果我们按指定行两次按 Step Into(F11)按钮,我们将进入文件 cvm.h

  basic_schmatrix& set(tint nRow,tint nCol,TC c)throw(cvmexception)
{
this-> _set_at(nRow - CVM0,nCol - CVM0,c);
return * this;
}

步入(F11) this-> _set_at(nRow - CVM0,nCol - CVM0,c); ,你将去定义函数 _set_at

  //设置两个元素以保持矩阵隐藏,检查范围
// zero based
void _set_at(tint nRow,tint nCol,TC val)throw(cvmexception)
{
_check_lt_ge(CVM_OUTOFRANGE_LTGE1,nRow,CVM0,this-> msize()+ CVM0);
_check_lt_ge(CVM_OUTOFRANGE_LTGE2,nCol,CVM0,this-> nsize()+ CVM0);
if(nRow == nCol&& _abs(val.imag())> basic_cvmMachMin< TR>()){//只有主对角线上的reals
throw cvmexception(CVM_BREAKS_HERMITIANITY,real数);
}
this-> get()[this-> ld()* nCol + nRow] = val;
if(nRow!= nCol){
this-> get()[this-> ld()* nRow + nCol] = _conjugate(val);
}
}

Step Over(F10 )按钮,您将得到结果:





所以为了获得 nRow = 1 nCol = 1 而不是 nRow = 0 nCol = 0 ,超出范围 [1,4] ,你应该写这行代码:

  A.set(2,2,inMatrixA11 [一世]); 


In order to create a MEX function and use it in my MATLAB code, like this:

[pow,index] = mx_minimum_power(A11,A12,A13,A22,A23,A33);  

I've created the file mx_minimum_power.cpp and written the following code in it:

#include <math.h>
#include <complex>
#include "mex.h"
#include "matrix.h"
#include "cvm.h"
#include "blas.h"
#include "cfun.h"

using std::complex;
using namespace cvm;

/* The gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    const int arraysize = 62172;
    const int matrixDimention = 3;
    float *inMatrixA11 = (float *)mxGetPr(prhs[0]);
    complex<float> *inMatrixA12 = (complex<float> *)mxGetPr(prhs[1]);
    complex<float> *inMatrixA13 = (complex<float> *)mxGetPr(prhs[2]);
    float *inMatrixA22 = (float *)mxGetPr(prhs[3]);
    complex<float> *inMatrixA23 = (complex<float> *)mxGetPr(prhs[4]);
    float *inMatrixA33 = (float *)mxGetPr(prhs[5]);
    basic_schmatrix< float, complex<float> > A(matrixDimention);
    int i = 0;
    for (i = 0; i < arraysize; i++)
    {
        A.set(1, 1, inMatrixA11[i]);
        A.set(1, 2, inMatrixA12[i]);
        A.set(1, 3, inMatrixA13[i]);
        A.set(2, 2, inMatrixA22[i]);
        A.set(2, 3, inMatrixA23[i]);
        A.set(3, 3, inMatrixA33[i]);
    }
}  

And then in order to be able to debug the code, I've created the mx_minimum_power.pdb and mx_minimum_power.mexw64 files, using the following code in the Matlab Command Window:

mex -g mx_minimum_power.cpp cvm_em64t_debug.lib  

The files blas.h, cfun.h, cvm.h and cvm_em64t_debug.lib are in the same directory as mx_minimum_power.cpp.
They are the headers and library files of the CVM Class Library.

Then I've attached MATLAB.exe to Visual Studio 2013, using the way explained here.
and have set a breakpoint at line40:

When I run my MATLAB code, there's no error until the specified line.

But if I click on the Step Over button, I'll encounter the following message:

With the following information added to the Output:

First-chance exception at 0x000007FEFCAE9E5D in MATLAB.exe: Microsoft C++ exception: cvm::cvmexception at memory location 0x0000000004022570.
> throw_segv_longjmp_seh_filter()
throw_segv_longjmp_seh_filter(): C++ exception
< throw_segv_longjmp_seh_filter() = EXCEPTION_CONTINUE_SEARCH  

Can you suggest me why libmex.pdb is needed at that line and how should I solve the issue?


If I stop debugging, I'll get the following information in MATLAB Command Window:

Unexpected Standard exception from MEX file.
What() is:First index value 0 is out of [1,4) range  


Right before pressing the step over button, we have the following values for A11[0],A12[0],A13[0],A22[0],A23[0],A33[0]:

that are just right as my expectations, according to what MATLAB passes to the MEX function:

Maybe the problem is because of wrong allocation for matrix A, it is as follows just before pressing the step over button.

解决方案

The problem occurs because we have the following code in lines 48 to 53 of the cvm.h file:

// 5.7 0-based indexing
#if defined (CVM_ZERO_BASED)
#   define CVM0 TINT_ZERO //!< Index base, 1  by default or 0 when \c CVM_ZERO_BASED is defined
#else
#   define CVM0 TINT_ONE  //!< Index base, 1  by default or 0 when \c CVM_ZERO_BASED is defined
#endif  

That makes CVM0 = 1 by default. So if we press the Step Into(F11) button at the specified line two times, we will get into line 34883 of the file cvm.h:

basic_schmatrix& set(tint nRow, tint nCol, TC c) throw(cvmexception)
{
    this->_set_at(nRow - CVM0, nCol - CVM0, c);
    return *this;
}  

Press Step Into(F11) at line this->_set_at(nRow - CVM0, nCol - CVM0, c); and you'll go to the definition of the function _set_at:

// sets both elements to keep matrix hermitian, checks ranges
// zero based
void _set_at(tint nRow, tint nCol, TC val) throw(cvmexception)
{
    _check_lt_ge(CVM_OUTOFRANGE_LTGE1, nRow, CVM0, this->msize() + CVM0);
    _check_lt_ge(CVM_OUTOFRANGE_LTGE2, nCol, CVM0, this->nsize() + CVM0);
    if (nRow == nCol && _abs(val.imag()) > basic_cvmMachMin<TR>()) { // only reals on main diagonal
        throw cvmexception(CVM_BREAKS_HERMITIANITY, "real number");
    }
    this->get()[this->ld() * nCol + nRow] = val;
    if (nRow != nCol) {
        this->get()[this->ld() * nRow + nCol] = _conjugate(val);
    }
}

pressing Step Over(F10) button,you'll get the result:

so in order to get nRow=1 and nCol=1 and not nRow=0 and nCol=0, which is out of the range [1,4), you should write that line of code as:

A.set(2, 2, inMatrixA11[i]);

这篇关于没有加载符号:libmex.pdb未加载(throw_segv_longjmp_seh_filter()= EXCEPTION_CONTINUE_SEARCH:C ++异常)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆