如何在Mac上使用IDE(intelJ或Xcode)有效调试Tensorflow内部C ++代码? [英] how to debug tensorflow internal c++ code efficiently with IDE(intelJ or Xcode) on mac?
问题描述
我想调试tensorflow的c ++源代码,例如tensorflow/c/c_api.cc.我已经找到了一些有关如何使用gdb调试c ++代码的答案,但我想知道是否可以使用像Xcode这样的ide对其进行调试,这对于编辑和调试非常方便.谢谢.
经过大量搜索和挖掘,我终于以可接受的方式成功调试了tensorflow c ++源代码.我在Mac上使用了bazel + vscode + lldb.>
bazel :构建目标(也可以通过vscode完成).
Visual Studio代码:调试和读取代码
lldb :调试后端
我的vscode lanch.json是:
{"version":"0.2.0",配置":[{"name":(lldb)启动","type":"cppdbg","request":启动",程序":"$ {workspaceRoot}/bazel-out/darwin_x86_64-dbg/bin/tensorflow/cc/example/example",参数":[],"stopAtEntry":否,"cwd":"$ {workspaceRoot}",环境": [],"externalConsole":是的,"MIMode":"lldb"}]}
I want to debug the c++ source code of tensorflow, e.g tensorflow/c/c_api.cc . I've found some answers about how to debug the c++ code with gdb,but I want to know if it's possible to debug it with ide like Xcode, which can be very comfortable for editing and debug.Thanks .
After much search and dig, I finally succeed to debug the tensorflow c++ source code in an acceptable way.I used bazel+vscode+lldb on mac.
bazel: build the target(Also can be done by vscode).
visual studio code: debug and read code
lldb : debug backend
my vscode lanch.json is :
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/bazel-out/darwin_x86_64-dbg/bin/tensorflow/cc/example/example",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb"
}
]
}
这篇关于如何在Mac上使用IDE(intelJ或Xcode)有效调试Tensorflow内部C ++代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!