Skip to content

User Guide

jingling edited this page May 31, 2024 · 3 revisions

Quick Start

Install RUPTA following the instructions in the setup guide.

Running

On a single file

The RUPTA executable pta analyzes a single Rust file:

pta [RUPTA OPTIONS] example.rs

You can run pta as if it were rustc, because it is essentially rustc with an added plugin.

On a crate

To run RUPTA on a crate, use the command in the crate directory:

cargo pta -- [RUPTA OPTIONS]

RUPTA Options

General PTA Options

Option Meaning
--entry-func <func-name> Specifies the name of the entry function from which the pointer analysis begins. RUPTA performs a whole program analysis, starting from the given entry function and analyzing all functions reachable from that point. If not explicitly specified, the main function of a binary crate is used as the entry point.
--entry-id <func-id> Specifies the def-id of the entry function from which the pointer analysis begins (similar to the --entry-func option).
--pta-type <pta-type> Specifies the type of pointer analysis to be performed. Currently, Andersen (ander) and callsite-sensitive pointer analyses (cs) are supported.
--context-depth <depth> Specifies the context depth limit for a context-sensitive pointer analysis (default: 1).

Output Options

Option Meaning
--dump-call-graph <path> Dump the call graph in dot format for the analyzed program.
--dump-pts <path> Dump the points-to results for the analyzed program.
--dump-mir <path> Dump the mir of reachable functions for the analyzed program.

PTA Statistics

RUPTA prints the analysis statistics to the console by default.

Below is the output after analyzing exa (version 753150d3) using 1-callsite-sensitive pointer analysis by running cargo pta in its root directory:

##########################################################
Call Graph Statistics: 
#Reachable functions (CS): 23761
#Reachable functions (CI): 10819
#Reachable unmonomorphized functions (CI): 3291
#Call graph edges (CS): 49073
#Call graph edges (CI): 23760
#Statically resolved calls: 23575
#Dynamically resolved calls: 44, #call graph edges: 185
	#Dynamic dispatch calls: 33, #call graph edges: 125
	#Fnptr calls: 7, #call graph edges: 47
	#Dynamic Fn* trait calls: 4, #call graph edges: 13
----------------------------------------------------------
CS Points-to Statistics: 
#Pointers: 89983
#Points-to relations: 1824614
#Avg points-to size: 20.27731904915373
CI Points-to Statistics: 
#Pointers: 46519
#Points-to relations: 271576
#Avg points-to size: 5.837958683548657
##########################################################
Used Memory Before Analysis: 168 MB
Max Memory in Analysis: 621 MB