Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to debug tensorflow internal c++ code efficiently with IDE(intelJ or Xcode) on mac?

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 .

like image 758
haiy Avatar asked Aug 29 '26 14:08

haiy


1 Answers

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"
        }
    ]
}

vscode debug tf

like image 197
haiy Avatar answered Aug 31 '26 07:08

haiy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!