0

我收到Segmentation fault我的代码。这是gdb回溯:

(gdb) backtrace 
#0  __copy_m<crest::SymbolicPred* const*, crest::SymbolicPred const**> (__first=<optimized out>, __result=<optimized out>, 
    __last=<optimized out>) at /usr/include/c++/4.4/bits/stl_algobase.h:343
#1  __copy_move_a<false, crest::SymbolicPred* const*, crest::SymbolicPred const**> (__last=<optimized out>, __first=0x0, 
    __result=<optimized out>) at /usr/include/c++/4.4/bits/stl_algobase.h:397
#2  __copy_move_a2<false, __gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > >, crest::SymbolicPred const**> (__first=..., __result=<optimized out>, __last=...)
    at /usr/include/c++/4.4/bits/stl_algobase.h:436
#3  copy<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > >, crest::SymbolicPred const**> (__first=..., __result=<optimized out>, __last=...) at /usr/include/c++/4.4/bits/stl_algobase.h:468
#4  uninitialized_copy<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > >, crest::SymbolicPred const**> (__first=..., __result=<optimized out>, __last=...)
    at /usr/include/c++/4.4/bits/stl_uninitialized.h:93
#5  uninitialized_copy<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > >, crest::SymbolicPred const**> (__first=..., __result=<optimized out>, __last=...)
    at /usr/include/c++/4.4/bits/stl_uninitialized.h:117
#6  __uninitialized_copy_a<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > >, crest::SymbolicPred const**, crest::SymbolicPred const*> (__result=<optimized out>, __first=..., __last=...)
    at /usr/include/c++/4.4/bits/stl_uninitialized.h:257
#7  _M_range_initialize<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > > > (__first=..., __last=..., this=<optimized out>) at /usr/include/c++/4.4/bits/stl_vector.h:1024
#8  _M_initialize_dispatch<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > > > (__last=..., this=<optimized out>, __first=...) at /usr/include/c++/4.4/bits/stl_vector.h:1002
#9  vector<__gnu_cxx::__normal_iterator<crest::SymbolicPred* const*, std::vector<crest::SymbolicPred*, std::allocator<crest::SymbolicPred*> > > > (__a=..., __last=..., __first=..., this=<optimized out>) at /usr/include/c++/4.4/bits/stl_vector.h:303
#10 crest::Search::SolveAtBranch (this=0x839ef80, ex=..., branch_idx=0, input=0xbffff704) at run_crest/concolic_search.cc:325
#11 0x0807efa3 in crest::SharkSearch::makeNextInput (this=0x839ef80, input=0xbffff704) at run_crest/concolic_search.cc:1536
#12 0x080866c0 in crest::SharkSearch::Run (this=0x839ef80) at run_crest/concolic_search.cc:1418
#13 0x0807be4c in main (argc=4, argv=0xbffff834) at run_crest/run_crest.cc:64

这是SolveAtBranch代码的一部分:

bool Search::SolveAtBranch(const SymbolicExecution& ex, size_t branch_idx, vector<value_t>* input) {
  const vector<SymbolicPred*>& constraints = ex.path().constraints();

  vector<const SymbolicPred*> cs(constraints.begin(),
                                 constraints.begin()+branch_idx+1);
  /// ...

错误行 (325) 是vector<const SymbolicPred*> cs(constraints.begin(), constraints.begin()+branch_idx+1);并且在矢量定义中发生错误。

当我修改代码并再次编译时,错误更改和其他 stl 定义会引发错误。我不知道这是什么问题?

4

0 回答 0