下载代码
https://github.com/elemeta/elfloader
配置调试配置文件
解压,用vscode打开。
F5 生成 launch.json & tasks.json
根据(makefile和readme.md)修改配置文件(launch.json & tasks.json)
# makefile
all:
gcc -Wall -g -o elfloader elf_loader.c main.c wheelc/list.c -ldl -lpthread
clean:
rm -rf *.o wheelc/*.o elfloader
# readme.md
./elfloader ./hello.so main1
👇👇👇👇
修改
👇👇👇👇
// launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "gcc build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/elfloader ",
"args": [
"${workspaceFolder}/hello.so",
"main1"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "asdf",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
// tasks.json
{
"tasks": [
{
"type": "shell",
"label": "asdf",
"command": "gcc -Wall -g -o elfloader ./elf_loader.c ./main.c ./wheelc/list.c -ldl -lpthread",
"options": {
"cwd": "${workspaceFolder}"
}
}
],
"version": "2.0.0"
}