Open yooocen opened 6 years ago
现在使用intellj的clion来调试比较好,如果用xcode的话,gdb对于mac os 13.x支持不好,还是换成lldb就好了
研究了一种使用vscode来调试的方法,下面是launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/Users/chenyongda/YourOpenJDK/build/macosx-x86_64-normal-serverANDclient-slowdebug/jdk/bin/java",
"args": ["-XXaltjvm=/Users/chenyongda/YourOpenJDK/build/macosx-x86_64-normal-serverANDclient-slowdebug/hotspot/variant-server/libjvm","-Dsun.java.launcher.is_altjvm=true","-cp",".","Hello"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb"
}
]
}
Debug Hotspot with Eclipse (mac os 10.13)
安装gdb
brew install gdb
gdb的代码签名
主要目的是eclipse在debug的时候需要调用gdb,需要gdb有证书 具体的方法可以参照这个博客
安装eclipse adt插件
插件地址 注意在eclipse的安装软件导入链接就可以了
导入整个jdk工程
Run eclipse, choose "import project -> C/C++ -> Existing Code as Makefile Project", then click Next, enter the configuration page of the project:
Right click on hotspot project -> properties -> C/C++ General -> Paths and Symbols -> Source Location -> choose "Add Folder", add
hotspot/src
directoryDebug Configuration
Right click on hotspot project -> "Debug As -> Debug Configurations -> C/C++ Application -> New"
Main tab
Debug tab
选最下面的Select other,选择LLDB-MI 。。。 的那一项