NJU-ProjectN/nemu

建议将 -fsanitize=address 和 -g 选项联合使用

lovelxc opened this issue · 1 comments

如果只开启 -fsanitize=address,那么检测器只会告诉程序员代码泄露发生在哪个函数。而开启-g后,Asan会提示发生在哪一行中。

CFLAGS_BUILD += $(if $(CONFIG_CC_ASAN),-fsanitize=address -g,) # 增加 -g

感谢指出. 不过还是建议通过menuconfig手动勾选Enable debug information来添加-g, 这样这两个选项不会产生耦合.

已在讲义中添加相关提示.