最近在研究 jattach,打算在本地调试项目,发现 CLion 可以正常编译运行代码,却无法断点 Debug。由于笔者对 C/C++ 项目不熟悉,在此记录研究过程中遇到的一些基本问题与解决方法。
文章目录
解决方式
在 Makefile 中的编译命令增加参数 -g
diff --git a/Makefile b/Makefile
index 7ff43df..fb44679 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Darwin)
- CFLAGS ?= -O3 -arch x86_64 -arch arm64 -mmacos-version-min=10.12
+ CFLAGS ?= -g -O3 -arch x86_64 -arch arm64 -mmacos-version-min=10.12
JATTACH_DLL=libjattach.dylib
else
CFLAGS ?= -O3
尝试过的手段
笔者环境为 macOS aarch64。
【未解决】找 Native Debugging Support 相关插件
曾经在 GoLand 使用 Rust 也遇到过无法 Debug 的问题,安装 Native Debugging Support 插件后问题解决。
搜了一下貌似 C 语言没有相关的插件。
【未解决】尝试安装 gdb
brew install gdb
发现 gdb 没有适用于 Apple Silicon 的版本:
gdb: The x86_64 architecture is required for this

2269

被折叠的 条评论
为什么被折叠?



