【发布时间】:2013-04-08 16:10:19
【问题描述】:
在使用稍作修改的 MobileC 构建时,我遇到了一个奇怪的问题。
我在宏中遇到分段错误,但是当我将 printfs 放入代码中时(否则无法调试,因为它被 C 干扰)我无法得到它发生的确切位置。
这是代码:
...
printf("just to check there is no problem accessing "node" %d\n", node);\
printf("this will be printed\n"); \
node_type##_Destroy(node); \
printf("this will not be printed\n"); \
...
而Destroy的代码如下:
int name##_Destroy( name##_p name ) \
{ \
printf("this will not be printed\n"); \
...
我没有修改这部分代码(除了printfs)所以我想没问题。你知道这里会发生什么吗?
【问题讨论】:
-
当您在附加调试器的情况下单步执行代码时会发生什么?段错误发生在哪一行?
-
问题是它是C解释的,所以我不能调试它...
标签: c memory segmentation-fault free