An LLDB plugin and web ui to visualize and debug pointer-based data structure programs written in C/C++.
Project description
visualize-links
An LLDB debugger plugin and web ui to visualize and debug pointer-based data structure programs written in C/C++."
visualize-links provides a python LLDB plugin with custom commands to visualize program variables
and expressions. It also contains an interactive web ui acting as the canvas where generated graphs are shown.
Pointer-based data structures are represented as graphs where each node represents a value and each edge represents directed links between values through member attributes.
Installation
Install LLDB. Note that test scripts are hardcoded to use lldb-19 whenever required.
Install visualize-links package and auto-import it on LLDB session start.
$ pip install visualize-links && echo "command script import visualize_links" >> ~/.lldbinit
Usage
Usage is shown using a sample program that implements the following linked list problem: Reverse Nodes in k-Group.
- Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.
- The example can be found at tests/list_reverse_k_group.cpp and ran as follows.
make launch_test TARGET=list_reverse_k_group
This performs the following tasks:
- Builds the target program:
$(TARGET).cpp - Launches ui in browser:
$ visualize-links-ui - Starts an lldb session:
lldb $(TARGET) - Executes a sample set of lldb commands:
$(TARGET).lldb
The plugin exposes the following lldb commands for visualization.
visualize-expr EXPR- Create a graph starting from
EXPR. Values unreachable fromEXPRare not traced.
- Create a graph starting from
visualize-type TYPE- Create a graph starting from all active variables pointing to a value of type
TYPE.
- Create a graph starting from all active variables pointing to a value of type
visualize-history- Show a list of past graphs generated with the above two commands along with their unique ids. History is also shown on the right pane of the ui.
visualize-diff UID1 UID2- Create an asymmetric difference graph showing how the graphs corresponding to
UID1andUID2differ. Difference graph can be created from the ui directly as well.
- Create an asymmetric difference graph showing how the graphs corresponding to
For demonstration, list_reverse_k_group.lldb is shown below with comments:
(lldb) # add a breakpoint after the initial list l is created [0,1,2,3,4]
(lldb) b list_reverse_k_group.cpp:63
(lldb) # add a breakpoint after l2 points to the intended new list [2,1,0,3,4]
(lldb) b list_reverse_k_group.cpp:66
(lldb) run
(lldb) # visualize the list pointed by l
(lldb) visualize-expr l
(lldb) continue
(lldb) # visualize the new list pointed by l2
(lldb) visualize-expr l2
(lldb) # visualize lists from l & l2
(lldb) visualize-type ListNode
(lldb) # visualize the transformation performed by reverseKGroup()
(lldb) visualize-diff 0 1
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file visualize_links-1.0.1.tar.gz.
File metadata
- Download URL: visualize_links-1.0.1.tar.gz
- Upload date:
- Size: 117.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55e49fc5d524d3dc5148ee49fb5a088769e5a3d35b527e30a9979e4c27dc779f
|
|
| MD5 |
0f71619a60e90bf7744450c9e9cb4903
|
|
| BLAKE2b-256 |
7912afa73298cc1731b76205d6302a7869daf9e1830547e75fc9c1c4377f503f
|
File details
Details for the file visualize_links-1.0.1-py3-none-any.whl.
File metadata
- Download URL: visualize_links-1.0.1-py3-none-any.whl
- Upload date:
- Size: 119.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77428dafe07208f65da1bedee67a172c9606b31c2e3305c33e709eb68a57df69
|
|
| MD5 |
dc7512bb1119e9e3ca168fe26309c296
|
|
| BLAKE2b-256 |
00a3fa9d4fee586e37b38cdd7b07d6368ca47291eb2db8e8c3636adf8f3360bf
|