adreuter / tutor

A web-based tutor for teaching and visualizing memory layout of C++ objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Tutor

Setup

This tool requires python3 and the Flask webframework. Furthermore clang-15 is required as a dependency.

Running the Flask app in debug mode

Go into the app folder and run

. venv/bin/activate

to activate the environment. Now you can run the application using

flask run --host=<host-ip-address>

The last step is to set the correct host address inside app/static/js/index.js

Memory layout input syntax

Virtual tables

  • off(number) for offset
  • vptr(number) for virtual table pointer destinations
  • RTTI for return type information
  • method signatures

Record layout

  • hasVptr indicates if the record has a virtual table pointer
  • members contains all members of a record
  • bases and virtual-bases contain the (virtual) bases of a record

Example:

{
    "hasVptr": true,
    "members": {
        "a": "int"
    }
    "bases": {
        "A": {
            ...
        }
    }
    "virtual-bases": {
        ...
    }
}

The outermost curly braces are omitted.

About

A web-based tutor for teaching and visualizing memory layout of C++ objects


Languages

Language:Python 99.5%Language:JavaScript 0.2%Language:PowerShell 0.1%Language:C 0.1%Language:CSS 0.1%Language:HTML 0.0%Language:Shell 0.0%