[cfe-dev] Traces of SVal in BugReporterVisitor

Anna Zaks ganna at apple.com
Wed Feb 20 15:31:02 PST 2013


On Feb 20, 2013, at 6:58 AM, gerardjubile <shahar.golan.mail at gmail.com> wrote:

> I am trying to write a new BugReporterVisitor to mark the traces of an SVal.
> This BugReporterVisitor will be created an SVal usage causes a report, and
> it needs to mark the traces of this SVAL.
> 
> In the following example, when checking the function call in line 5, I can
> see that this is an allocation and by looking at the SVal of the argument, I
> see that the allocation is of 0 bytes:
> 
> 1  void *f(int i) {
> 2    int a = 0;
> 3    int b = a/i;
> 4    int c = b;
> 5    return malloc(c);
> 6  }
> 
> In the report for line 5 I would like to mark all the expressions that led
> to the computation of the SVal.
> 
> My questions:
> 1. Can any of the existing BugReporterVisitor assist me?

No, we do not have any visitors that track ALL the expressions that participate in a computation of a particular value. However, marking a symbol as interesting in the BugReport (BugReport::markInteresting) is intended to address this case. Have you tried marking your symbol as interesting? Is it sufficient?

> 2. If not, can anyone suggest guidelines to coding such a
> BugReporterVisitor?

The amount of tracking we can do is bounded by the info recorded in ExplodedNodes. For example, we should be able to identify the ExplodedNode where the value ('0') was first assigned to the symbol which we are tracking, as this information will be recoded in the constraint manager.

See MallocChecker.cpp, BugReporterVisitors.cpp for more info and examples of the visitors.

Cheers,
Anna.
> 
> Thanks, Gerard.
> 
> 
> 
> 
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Traces-of-SVal-in-BugReporterVisitor-tp4030520.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130220/fe95ecfd/attachment.html>


More information about the cfe-dev mailing list