-
Notifications
You must be signed in to change notification settings - Fork 15
DebugPilot Basic Knowledge
WYK edited this page Sep 18, 2023
·
1 revision
Data dependency reveal how the value of the variable is assigned during the program execution
int a = 1; // Step 1
int b = a + 1; // Step 2
int c = a + b; // Step 3
From the above example
- Variable
c
is defined by variablea
andb
, making Step 1 and Step 2 is the data dominator of Step 3. - Variable
b
is defined by variablea
, making Step 1 also the data dominator of Step 2.
Control dependency indicate relation between condition predicate and the branch of steps executed
boolean condition = true; // Step 1
if (condition) { // Step 2
function1(); // Step 3
} else {
function2(); // Step 4
}
Variable condition
determine which code is executed (i.e. Step 3). So that Step 2 is the control dominator of Step 3.
Back tracinig is the technique of debugging. Starting from output program, if we trace back via data and control dependency, we can eventually find out the root cause of the bug.