计算化学公社

标题: gdb debug问题 以及c++查错 [打印本页]

作者
Author:
最爱喵星人    时间: 2017-7-23 17:27
标题: gdb debug问题 以及c++查错
最近新接触gdb, 还用得不是很熟,请问大家:

我往现有的代码里添加了一小段我的代码,结果运行报错Segmentation fault (core dumped), 然后程序就call error-message 函数,最后就abort了。像是这样:

Segmentation fault (core dumped)

finished by error termination in CP-SCF
Calling Command: cpscf H2O.cpscf.tmp
[file tools/qcmsg.cpp, line 432]:
  .... aborting the run


然后用gdb的话也没看出什么有用的信息。请问该怎么解决这个问题?

公式为 sum_j {2*(ia|jj)-(ij|aj)}                                                         // i j are indices of occupied MO; a is the index of virtual MO
伪码如下:
1 f=fopen(PertInp,"wb");
2 Loop over batches of the Integral list (pq|rs)                                //pqrs are indices of artbitrary MO
        for (i=all occ MO; i++)                                                            //i is the index of occupied MO
                 for(a=all vir MO; a++)                                                    //a is the index of virtual MO
                        temp1=0.0, temp2=0.0, P(a,i)=0.0;                         // the data structure of P is self-defined.
                        for(j=all occ MO; j++ )                                           //j is the index of occupied MO
                              if[integral type == (ia|jj) && r==s==j]            
                                    temp1+=integral_value*2.0
                             if[integral type == (ij|aj) && q==s==j]
                                     temp2-=x
                              P(a,i)+=temp1+temp2;                                         
                              fwrite(&P(a,i),f);


作者
Author:
万里云    时间: 2017-7-24 09:44
gdb不是可以载入coredump么?从中可以看到在哪一步出错。




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3