Skip to content

Assignment 1 CPP

MingxiuWang edited this page May 12, 2025 · 3 revisions

Running Tests

Use control + ~ to open a terminal in VSCode and then type the below command line

Your implementation ctest command line
Your reachability analysis ctest -R ass1-icfg -VV
Your points-to analysis ctest -R ass1-pta -VV
Your taint analysis ctest -R ass1-taint -VV
The entire Assignment-1 ctest -R ass1 -VV

- Debugging tips for ICFG.

Add -dump-icfg as an extra option of -icfg for your ass1 executable when debugging your reachability implementation. This will dump ICFG into a dot file to view in VSCode.

- Debugging tips for ConstraintGraph and points-to sets.

Add -print-pts as an extra option of -pta for your ass1 executable when debugging your solveWorklist implementation and you could print out the final points-to set of each node to validate your MAYALIAS and NOALIAS results. You could also use -print-constraint-graph to print out the final constraint graph (edges and nodes) or -dump-constraint-graph to dump it into a dot file to view in VSCode. Retrieve a variable's points-to set, perform union operations or print out the points-to set using these APIs

Constraint Edge Corresponding Color in Dot graphs
(PAG and ConstraintGraph)
ADDR Green
COPY Black or (dashed arrow for interprocedural COPY edges)
LOAD Red
STORE Blue
GEP Purple

Submitting Your Work

  • Upload Assignment-1.cpp to UNSW WebCMS for your submission.

Your implementation will be evaluated against our 10 internal tests. You will get the full marks if your code can pass them all. Our internal tests are private. Here, we only provided a handful test cases under Assignment-1/Tests/testcases. You are encouraged to add more test cases by yourself to validate the correctness of your implementation.

- You will be working on Assignment-1.cpp only and there is NO need to modify other files under the Assignment-1 folder

3. Configuration && debugging

To enable debugging and running, switch your executable by setting the program and args fields as described here or follow the below screenshot.

3.2 Debug your code

From Configure-IDE, we know how to set breakpoint, debug and watch the variables.

If we want to check more complicated data structures like ICFG, ConstraintGraph and Point-to Sets. Please read the following instructions.

Debugging for ICFG

As per debugging-tips-for-icfg

Debugging for ConstraintGraph and points-to-sets

As per debugging-tips-for-constraintgraph-and-points-to-sets


More information about C++

Clone this wiki locally