Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>xdiva-extensionNew to Visual Studio Code? Get it now.
xdiva-extension

xdiva-extension

ncuoolabxdiva

|
80 installs
| (0) | Free
A 3d program visualization plugin, connecting the gdb-plugin, viewer & typemapping program.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

xDIVA Visual Studio Code extension guide

尚未完成的功能

  • 驗證 create virtual object 時,傳入的 permutator python file 的正確性

Setup Environment

  • Install Mingw-w64, GCC for Windows Mingw install when installing, choose the x86_64 architecture instead of i686

  • Make sure that setting global environment variables, e.g., "c:\mingw-w64\mingw64\bin" on Windows after the installation.

  • Install xDIVA

    • Download the xDIVA installer

Install Extension & Settings

  • Install VS code c/c++ extension via Visual Studio Code extensions market. Install cpp-tool extension

  • Install xDIVA extension via Visual Studio Code extensions market. Install xdiva extension

  • After the installation, extension will be activated. We need to set the xDIVA installation path first. Path setting

  • Select the corresponding program folder that xDIVA was installed, e.g., installed the xDIVA in "c:\xDiva" Path setting done

  • When setting was done, click the Apply button.

Introduction

  • Extension Dashboard xDIVA dashboard

  • To open the Config Setting Page or xDIVA Dashboard again, using Ctrl+Shift+P to open VS Code command palette open panel

User Guide

  • To debug C/C++ code in VS Code using VS Code debugger UI, please see [Get Started with C++ and Mingw-w64 in Visual Studio Code].

  • Run the viewer program(on your desktop) first, we will use it later. viewer Viewer Window empty viewer

We provide some examples, please follow them to understand the usage of this extension.

Linked List

#include <stdio.h>
#include <stdlib.h>

#define SIZE 5

struct Node {
    struct Node *next;
    int data;
};

int main() {
    struct Node *head = (struct Node *)malloc(sizeof(struct Node));
    head->data = 1;
    head->next = NULL;

    struct Node *current = head;

    for(int i = 0; i < SIZE; i++) {
        struct Node *next = (struct Node *)malloc(sizeof(struct Node));
        next->data = i * 5;
        next->next = NULL;
        current->next = next;
        current = current->next;
    }

    return 0;
}

Create a file in your working directory called LinkedList.c, then copy above code into file.

  • Switch to the VS code debugger view, then set the breakpoint at line 26 using VS Code debugger UI Linked list debug

  • Using C/C++ tool to start debugging. cpp tool debug

  • Select "gcc" option. select gcc

  • The debugger will stop at line 26. Linked list stop line:26

  • We can fetch the variable using xDIVA Dashboard to visualize it. Let's search the "head" variable in our linked list program and click search button. Search head variable

  • Extension notify us when the data had been updated. Now we have a variable to be observed in xDIVA Watch Window. Fetch variable done

  • We want to fetch all the linked list structure in that variable, so right click the variable in xDIVA Watch Window and click "Memory Explore Variable" option. Linked list memory explore

  • Now we can expand the variable to discover the data in it. Linked list expand variable

  • Then we want to visualize the linked list structure. Click the "Show Mapping Info" button to decide what the linked list should look like. Click the "Go Mapping" button. Linked list show mapping info

  • Select a Sphere_ubvm & line_reference, link each other like this. When you are done, press "Apply" button. Linked list typemapping

  • Note that when mapping is done, the red 'X' would change to green 'V'. Let's click the "Visualize" button! Linked list mapping done

  • In the viewer, we have a linked list now. Use cursor to move or hover the node, it would display the variable's information. Linked list viewer

Binary Search Tree

  • Please copy below code to a file called "BinarySearchTree.c".
#include <stdlib.h>

struct node {
    struct node *l;
    struct node *r;
    int num;
};

void insert(struct node * n, int k)
{
    if (k > n->num) {
        if (n->r)
            insert(n->r, k);
        else {
            struct node * node = (struct node*)malloc(sizeof(struct node));
            node->l = NULL;
            node->r = NULL;
            node->num = k;
            n->r = node;
        }
    } else {
        if (n->l)
            insert(n->l, k);
        else {
            struct node * node = (struct node*)malloc(sizeof(struct node));
            node->l = NULL;
            node->r = NULL;
            node->num = k;
            n->l = node;
        }
    }
}

int main()
{
    struct node* root = (struct node*)malloc(sizeof(struct node));
    root->num = 5;
    root->l = NULL;
    root->r = NULL;
    insert(root, 1);
    insert(root, 3);
    insert(root, 7);
    insert(root, 6);
    insert(root, 8);
    return 0;
}

  • Set breakpoint at line 45. binary search tree breakpoint 45

  • Start debugging using C/C++ extension, debugger will stop at line 45. binary search tree start debug

  • Switch to xDIVA Dashborad page, search the "root" variable. binary search tree search root

  • Memory explore the root variable. binary search tree memory explore

  • Click the "Show Mapping Info" button, then click "Go Mapping" button to map the Node type to be visualized. Imgur

  • Map the structure like this, a little bit complex. Imgur

  • Then click "Visualize" button. bst visualize

  • Now we have a binary search tree in our Viewer window. Drag the node to change the position in Viewer. bst viewer

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft