我正在调试崩溃,其中我们有一个类似于 - 的代码片段
1184 static void
1185 xyz_delete (<struct type1> *c, <struct type2> **a)
1186 {
...
...
...
...
1196 b = *a;
1197 if (!b) {
1198 return;
1199 }
...
...
1203 prev = b->next;
1204 b->next = NULL;
...
...
1245 free_timer(b->active_timer);
...
...
...
}
Run Code Online (Sandbox Code Playgroud)
我们碰巧看到了崩溃——分段错误;其调用堆栈如下所示 -
#1 0x456789123 in __free [__be___free] (ptr=<optimized out>, saved_caller_pc=0x123456789 , attr=0x0) at free.c:1234
#2 0x345678912 in xyz_delete [__be_xyz_delete...] (c=c@entry=0x234567891, a=a@entry=0x0) at myfile.c:1245
#3 0x455678912 in abc (apple=0x52453545, a=<optimized out>, …Run Code Online (Sandbox Code Playgroud)