Skip to content

Debuggin On Belief Propagation

WYK edited this page Nov 26, 2022 · 4 revisions

Introduction

Debugging a program using Belief Propagation does not rely on other passing/failing runs. It aims to couple human-like reasoning with program semantics based analysis. This technique model the debugging processs as a probabilitistic inference problem. For more detials, please refer to the paper

Step-By-Step Guileline

The following are the step by step guileline on how to debug using Belief Propagation

  1. Ensure that there is a trace in the Trace View, because Microbat will only analize the trace in the Trace View.

  1. Since our belief propagation is implemented using python, you need to start the python server.

    1. Open microbat\microbat\Python_Server\BeliefPropagation_Server\BP_Server.ipynb using Jupyter Notebook
    2. Run every cell in BP_Server.ipynb, make sure that the startServer() function is running:

  2. Provide the information of the input and output variables.

    • Input variables are the variable that you sure that is correct.
    • Output variable are the variable that you sure that is wrong.
    • For example, for the assertion such as assertEquals(0, function(x)), the input variable will be x and the output variable will be the return value of function(x)

    Select Input Variables

    • Enter the trace node that contain the input variables
    • Check all the variable that you think is correct in the Debug Feedback View
    • Click the Inputs button to submit the selection

    Select Output Variables

    • Enter the trace node that contain the output variables
    • Check all the variable that you think is wrong in the Debug Feedback View
    • Click the Outputs button to submit the selection

    Check Selected Variables

    • There is a IO button in Debug Feedback View and it will print out the selected input and output variables in console after you click it.

    Clear Selected Variables

    • There is a Clear IO button in Debug Feedback View. If you select the variable mistakenly, you need to erase all the variable by clicking this button and select again.

  3. After selecting the input and output variable, you may click the green button on toolbar to run the belief propagation:

  4. After getting result from the python server, Microbat will jump to the node that belief propagation think is the most posible node to be the root cause. Please give the feedback accordingly:

    • Correct: If the node is correct, please check the yes button and click the Baseline button to submit the feedback.
    • Wrong Path: If the node is in the wrong flow, please check the Wrong-Flow button and click the Baseline button to submit the feedback.
    • Wrong Variable: If the node contain wrong variable, please check out those wrong variable in Variable List and also check the Wrong-Var button. Finally, please click the Baseline button to submit the feedback
    • Root Cause Found: If the node turned out to be the root cause that cause the error, please click the Root Cause button to end the debugging process.

    After giving the feedback, please wait for the next result and give the feedback again if needed.

Important Note

If you are trying to re-run the Beleif Propagation, please make sure to generate the trace again, instead of clicking the green button again. Since the implementation of Beleif Propagation may change the details of trace node, running it twice continuously may cause error.

Reference

  1. Xu, Zhaogui, et al. "Debugging with intelligence via probabilistic inference." Proceedings of the 40th International Conference on Software Engineering. 2018.
  2. Our implementation of belief propagation is based on krashkov
Clone this wiki locally