我正在使用gdb调试一个程序。但是我看到的情况有点奇怪:
(gdb) bt
0xb59656f8 in globalCallStubClass::addCallContext (**this=0x0**)
at /ccase_enodeb/callp/build_callp/src/test/framework/shared/src/shared_call_context.cc:1962
0xb5b52e64 in rrcStubClass::process_scenario_spontaneous_trigger_RRC_CONNECTION_REQUEST (gcppMsgCtx=...)
at /ccase_enodeb/callp/build_callp/src/test/framework/rrc/src/rrc_connection_request.cc:90
0xb6c3be4c in Gcpp::routeMessage (this=0xb392e9d0) at /ccase_enodeb/callp/build_callp/src/callp_services/gcpp/src/gcpp.cc:1095
0xb6c3b3b0 in Gcpp::loop (this=0xb392e9d0, Default_Method_Ptr=0)
at /ccase_enodeb/callp/build_callp/src/callp_services/gcpp/src/gcpp.cc:925
0xb58d2ae0 in stubBthdEntryPoint () at /ccase_enodeb/callp/build_callp/src/test/framework/root/src/stub_root.cc:314
0x000191f8 in lxb_thd_entry (pCtx=0x68c0f8) at /vobs/onepltf/ltefdd/core/src/lxbase/lxbase.c:3289
0xb575602e in start_thread () from /lib/arm-linux-gnueabi/libpthread.so.0
0xb56d6ab8 in ?? () from /lib/arm-linux-gnueabi/libc.so.6
0xb56d6ab8 in ?? () from /lib/arm-linux-gnueabi/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) print pCallStub
$1 = (globalCallStubClass *) **0x7a1da8**
(gdb) print this
$2 = (globalCallStubClass * const) **0x0**
出现故障的位置在标记为(-->)的行:
if (pCallStub != NULL) {
-->callStubClass* pCallInst = pCallStub->addCallContext();
}
针对对象pCallStub
(已经实例化且不为NULL
),调用函数addCallContext
。当我打印pCallStub
时,可以看到它有一个地址:
(gdb) print pCallStub
$1 = (globalCallStubClass *) 0x7a1da8
但是,this
(应该是pCallStub
)仍然是0x0
:
(gdb) print this
$2 = (globalCallStubClass * const) 0x0
有人可以帮助我吗?
谢谢, Geta
pCallStub
是如何实例化的?它是在不同的线程中实例化的吗? - Alessandro PezzatopCallStub->addCallContext();
时,pCallStub没有正确的值。尝试将volatile
添加到pCallStub
并且不进行任何优化编译。 - Alessandro Pezzato