loading...

Live Reverse Debugging in LLDB

vangelists profile image Vangelis Tsiatsianas Updated on ・2 min read

Live reverse debugging (also known as reverse execution) enables the programmer to step backwards and replay the execution of a program during a live debugging session.

In the context of my master’s thesis, I created a proof of concept for live reverse debugging based on the LLDB debugger.

Doing so involved familiarizing myself with the LLDB codebase and directly modifying it to add live reverse debugging capabilities.

GitHub Student Developer Pack

During development, I made sure to closely follow the master branch of the LLVM project's repository, whose LLDB is a part of. However, due to the amount of daily commits in the LLVM project repository, I had a hard time tracking all the changes in LLDB that might affect my project.

As a result, I decided to take advantage of the Student Developer Pack and the Mailgun offer in particular, in order to receive email notifications whenever a commit that modified files belonging to LLDB was pushed to the LLVM project repository.

This was achieved with the help of a lightweight service written in Swift and hosted on Vapor Cloud that receives notifications about all pushed commits via GitHub webhooks, filters the ones that contain modifications to LLDB and emails me through Mailgun information about the commits:

LLDB Commit Notification

This service took about a day to set up and saved me multiple hours during the course of this project (about 10 months) of manually scanning through the commit log for commits related to LLDB and examining one by one for modified files.

Last but not least, the free GitHub Pro subscription offered through the Student Developer Pack enabled me to keep my work private until it was ready for prime time.

Demo Link

Link to Code

GitHub logo vangelists / llvm-project

Proof of Concept for Live Reverse Debugging in LLDB (see wiki)

The LLVM Compiler Infrastructure

This directory and its sub-directories contain source code for LLVM a toolkit for the construction of highly optimized compilers optimizers, and run-time environments.

The README briefly describes how to get started with building LLVM For more information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.

Getting Started with the LLVM System

Taken from https://llvm.org/docs/GettingStarted.html.

Overview

Welcome to the LLVM project!

The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and converts it into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer. It also contains basic regression tests.

C-like languages use the Clang front end. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there…

Discussion

markdown guide