我在 mips 多核系统中有一个程序,我从核心得到了一个回溯,真的很难弄清楚(至少对我来说),我想也许其他核心之一写入了 mem 但并不是所有的堆栈都被破坏了是什么原因造成的更让我困惑。
在第 2 帧中这是 NULL,在第 0 帧中也是 NULL(核心转储的原因)。
这是(部分)回溯:
#0 E::m (this=0x0, string=0x562f148 "", size=202) 在 E.cc:315
#1 0x00000000105c773c in P::e (this=0x361ecd00, string=0x562f148 "", size=202, offset=28) at P.cc:137
#2 0x00000000105c8c5c in M::e (this=0x0, id=7 '\a', r=2, string=0x562f148 "", size=202, oneClass=0x562f148 "", secondClass=0x14eff439 "",
偏移=28) 在 M.cc:75
#3 0x0000000010596354 in m::find (this=0x4431fd70, string=0x562f148 "", size=202, oneClass=0x14eff438 "", secondClass=0x14eff439 "",
up=false) 在 A.cc:458
#4 0x0000000010597364 in A::trigger (this=0x4431fd70, triggerType=ONE, string=0x562f148 "", size=0, up=true) at A.cc:2084
#5 0x000000001059bcf0 in A::findOne (this=0x4431fd70, index=2, budget=0x562f148 "", size=202, up=true) at A.cc:1155
#6 0x000000001059c934 in A::shouldpathNow (this=0x4431fd70, index=2, budget=0x562f148 "", size=202, up=false, startAt=0x0, short=)
在 A.cc:783
#7 0x00000000105a385c in A::shouldpath (this=0x4431fd70, index=2, rbudget=, rsize=, up=false,
直接 =) 在 A.cc:1104
关于 m::find 函数
442 m_t m::find(无符号字符常量*字符串,无符号整数大小,
第443话
第444话
445
446
447 const Iterator &it=arr_[getIndex()]->getSearchIterator((char const*)value,len);
448
449 unsigned int const offset = value - engine_->getData();
450 451 int ret=未知;
452 M*p;
第 453 章
454 ret == UNKNOWN && match != NULL;
第455话
456 p = (M*) 匹配;
第 457 章
第 458 章
this=0x0实际上很容易发生。例如:
E *instance = NULL;
instance->method();
Run Code Online (Sandbox Code Playgroud)
this内将为 NULL method。
无需假设内存已损坏或堆栈已被覆盖。事实上,如果堆栈的其余内容似乎有意义(并且您似乎认为它们有意义),那么堆栈可能没问题。
不必寻找内存损坏,而是检查您的逻辑以查看您是否有未初始化的 (NULL) 指针或引用。