Skip to content

Debugging V8 source code

Vladimir Mutafov edited this page Nov 17, 2019 · 1 revision

In order to "step into" V8's C++ code there are several things which should be done:

  1. Follow the steps in here and make sure to build V8 in debug
  2. After you have patched the V8 inside of the NS Android Runtime, make sure you build the runtime in debug by editing the CMakeLists file.
  3. Edit your Android Studio "Run" configuration and set the paths for debug symbols to <your_ns_runtime_path>/test-app/runtime/build/intermediates/cmake/debug/obj/armeabi-v7a (replace armeabi-v7a with the arch you are deploying to)
  4. Link the source code directory of V8 used to build the debug image to "<your_ns_runtime_path>/test-app/runtime/src/main/cpp/v8/src"
  5. Set a startup LLDB command: settings set target.source-map "./../../src/" "$PROJECT_DIR$/../../../../android_runtime_release/android-runtime/test-app/runtime/src/main/cpp/v8/src" (see the LLDB target.source-map property for more details)
  6. Start the NS app with the patched runtime and if you stop the execution at someplace, you should see V8's stack in the debugger and/or debug V8's code.