Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
skiavis.py
Go to the documentation of this file.
1# Copyright (c) 2022 Google LLC. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# This contains additional Skia helpers for use with the CodeLLDB debugger extension to VSCode
6# https://github.com/vadimcn/vscode-lldb
7
8# To use these features, run the following command at the (lldb) prompt within VSCode:
9#
10# command script import (your-skia-local-path)/platform_tools/debugging/lldb/skiavis.py
11#
12# This can be automatically enabled at the start of every debugging session by adding that command
13# to the "initCommands" of your launch configuration, as explained here:
14# https://github.com/vadimcn/vscode-lldb/wiki/Data-visualization
15#
16# From my testing, the instance of LLDB that runs within CodeLLDB does not invoke ~/.lldbinit,
17# so adding the command there will not work. (In addition, this script uses modules that won't
18# be present in command-line LLDB).
19
20import lldb
21import debugger
22
23# Helper function to draw an SkPath as an SVG document within VSCode
24# Call it with a string containing the path expression (eg, variable name):
25#
26# ?/py skiavis.show_path('fPath')
27#
28def show_path(path):
29 pathStr = debugger.evaluate('SkParsePath::ToSVGString(' + path +
30 ', SkParsePath::PathEncoding::Absolute)')
31 svg = '<svg><path d="' + pathStr + '"/></svg>'
32 debugger.display_html(svg)
show_path(path)
Definition skiavis.py:28