gpt4 book ai didi

c++ - C++ 构造函数中的损坏

转载 作者:行者123 更新时间:2023-11-28 06:44:17 24 4
gpt4 key购买 nike

我在构造函数中面临损坏。有人可以帮助我吗?

    2873            int rc = _db->fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct, HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) p selectConstruct
$1 = {distinct = false, colsToBeSelected = {cols = {<std::_Vector_base<dbCol, std::allocator<dbCol> >> = {_M_impl = {<std::allocator<dbCol>> = {<__gnu_cxx::new_allocator<dbCol>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}}, tableName = {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3dd36f32d8 ""}}, where = {whereExprs = {<std::_Vector_base<whereExpr, std::allocator<whereExpr> >> = {_M_impl = {<std::allocator<whereExpr>> = {<__gnu_cxx::new_allocator<whereExpr>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, ops = {<std::_Vector_base<adjoinOperator, std::allocator<adjoinOperator> >> = {_M_impl = {<std::allocator<adjoinOperator>> = {<__gnu_cxx::new_allocator<adjoinOperator>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, namespaceCounts = {<std::_Vector_base<unsigned int, std::allocator<unsigned int> >> = {_M_impl = {<std::allocator<unsigned int>> = {<__gnu_cxx::new_allocator<unsigned int>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, useAsON = false}, groupBy = {cols = {<std::_Vector_base<dbCol, std::allocator<dbCol> >> = {_M_impl = {<std::allocator<dbCol>> = {<__gnu_cxx::new_allocator<dbCol>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}}, orders = {orders = {<std::_Vector_base<orderingTerm, std::allocator<orderingTerm> >> = {_M_impl = {<std::allocator<orderingTerm>> = {<__gnu_cxx::new_allocator<orderingTerm>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}}, limit = -1}
(gdb) stepi
0x00007ffff0df9b49 2873 int rc = _db- >fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct, HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) stepi
0x00007ffff0df9b50 2873 int rc = _db->fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct, HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) stepi
0x00007ffff0df9b53 2873 int rc = _db->fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct, HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) stepi
0x00007ffff0df9b5b 2873 int rc = _db->fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct, HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) stepi
0x00007ffff0df9b5e 2873 int rc = _db->fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct, HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) stepi
0x00007ffff0da8000 in simpleSelectConstruct::simpleSelectConstruct () from /opt/OV/lbin/OpsAgt/libDMLSegment.so
(gdb) stepi
simpleSelectConstruct::simpleSelectConstruct (this=0x7fffdbffdbb0) at /home/parakkal/COLLABNET_11.10_NEW/hpsw-oa/AgentFramework/cpp/src/include/OpsAgt/DBsupports.h:170
170 class simpleSelectConstruct{
/include/OpsAgt/DBsupports.h:170
170 class simpleSelectConstruct{
(gdb) p *this
$2 = {distinct = false, colsToBeSelected = {cols = {<std::_Vector_base<dbCol, std::allocator<dbCol> >> = {_M_impl = {<std::allocator<dbCol>> = {<__gnu_cxx::new_allocator<dbCol>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}}, tableName = {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}}, where = {whereExprs = {<std::_Vector_base<whereExpr, std::allocator<whereExpr> >> = {_M_impl = {<std::allocator<whereExpr>> = {<__gnu_cxx::new_allocator<whereExpr>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, ops = {<std::_Vector_base<adjoinOperator, std::allocator<adjoinOperator> >> = {_M_impl = {<std::allocator<adjoinOperator>> = {<__gnu_cxx::new_allocator<adjoinOperator>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x3dd34bd704, _M_end_of_storage = 0x7ffff7ca52b0}}, <No data fields>}, namespaceCounts = {<std::_Vector_base<unsigned int, std::allocator<unsigned int> >> = {_M_impl = {<std::allocator<unsigned int>> = {<__gnu_cxx::new_allocator<unsigned int>> = {<No data fields>}, <No data fields>}, _M_start = 0x7fffdbffe910, _M_finish = 0x6, _M_end_of_storage = 0x4e}}, <No data fields>}, useAsON = false}, groupBy = {cols = {<std::_Vector_base<dbCol, std::allocator<dbCol> >> = {_M_impl = {<std::allocator<dbCol>> = {<__gnu_cxx::new_allocator<dbCol>> = {<No data fields>}, <No data fields>}, _M_start = 0x7fffdbffe910, _M_finish = 0x0, _M_end_of_storage = 0x7ffff6f54d1f}}, <No data fields>}}, orders = {orders = {<std::_Vector_base<orderingTerm, std::allocator<orderingTerm> >> = {_M_impl = {<std::allocator<orderingTerm>> = {<__gnu_cxx::new_allocator<orderingTerm>> = {<No data fields>}, <No data fields>}, _M_start = 0x7ffff7ca52b0, _M_finish = 0x7ffff6f5584d, _M_end_of_storage = 0x5509f0}}, <No data fields>}}, limit = -603988688}
(gdb) stepi

如果您看到上面的限制在构造函数中已损坏,_M_start、_M_finish 和 _M_end_of_storage 也是如此。 simpleSelectConstruct 类显示在此处

class simpleSelectConstruct{

public:
DBSupportsInterface simpleSelectConstruct()
{
distinct=false;
limit=-1;
}
bool distinct;
dbCols colsToBeSelected;
string tableName;
whereConstruct where;
dbCols groupBy;
orderBy orders;
int limit;
};

我已将完整信息发布在 https://gcc.gnu.org/ml/gcc-help/2014-08/msg00104.html

最佳答案

(gdb) stepi
0x00007ffff0df9b5e 2873 int rc =
_db->fetch_custom_sql_query(rwc.GetQueryName(),selectConstruct,HandleCustomSqlQueryResponse, (void*)&holder);
(gdb) stepi
0x00007ffff0da8000 in simpleSelectConstruct::simpleSelectConstruct ()
from /opt/OV/lbin/OpsAgt/libDMLSegment.so
(gdb) stepi
simpleSelectConstruct::simpleSelectConstruct (this=0x7fffdbffdbb0)
[SNIP]
(gdb) p *this
[SNIP OUTPUT BEFORE CONSTRUCTOR RUNS]
(gdb) stepi
0x00007ffff0e11892 170 class simpleSelectConstruct{
(gdb) stepi
0x00007ffff0e11894 170 class simpleSelectConstruct{
(gdb) stepi
0x00007ffff0e11896 170 class simpleSelectConstruct{
(gdb) stepi
0x00007ffff0e11898 170 class simpleSelectConstruct{
(gdb) p *this
[SNIP OUTPUT DURING CONSTRUCTOR]
(gdb)
[END OF DEBUGGING SESSION]

我没有看到腐败的证据。我看到你打印出一个未损坏的变量selectConstruct,进入simpleSelectConstruct构造函数,打印即将构造的simpleSelectConstruct,做四步,然后打印simpleSelectConstruct 只构建了一半。 (两者都不是 selectConstruct 变量)。您是否尝试等到构造函数完成之后?

当构造函数开始时:

distinct = false
colsToBeSelected =
cols = ..._M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0 ...
tableName = ..._M_p = 0x0 ...
where =
whereExprs = ..._M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0...
ops = ..._M_start = 0x0, _M_finish = 0x3dd34bd704, _M_end_of_storage = 0x7ffff7ca52b0...
namespaceCounts = ..._M_start = 0x7fffdbffe910, _M_finish = 0x6, _M_end_of_storage = 0x4e...
useAsON = false
groupBy =
cols = ..._M_start = 0x7fffdbffe910, _M_finish = 0x0, _M_end_of_storage = 0x7ffff6f54d1f...
orders = ..._M_start = 0x7ffff7ca52b0, _M_finish = 0x7ffff6f5584d, _M_end_of_storage = 0x5509f0...
limit = -603988688

构造函数中的四步之后:

distinct = false
colsToBeSelected =
cols = ..._M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0 ...
tableName = ..._M_p = 0x0...
where =
whereExprs = ..._M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0...
ops = ..._M_start = 0x0, _M_finish = 0x3dd34bd704, _M_end_of_storage = 0x7ffff7ca52b0...
namespaceCounts = ..._M_start = 0x7fffdbffe910, _M_finish = 0x6, _M_end_of_storage = 0x4e...
useAsON = false
groupBy =
cols = ..._M_start = 0x7fffdbffe910, _M_finish = 0x0, _M_end_of_storage = 0x7ffff6f54d1f...
orders = ..._M_start = 0x7ffff7ca52b0, _M_finish = 0x7ffff6f5584d, _M_end_of_storage = 0x5509f0...
limit = -603988688

构造函数显然还没有执行完。它似乎还处于 build 过程的早期阶段。我会假设这四个操作都是假的,然后是 cols,所以下一步是构造 tableName

关于c++ - C++ 构造函数中的损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25314156/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com