<div dir="ltr"><div><div><div><div><div><div><div>Hi guys,<br></div>    Flowdroid uses Heros to do inter-procedural data analysis. I notice that during the process of inter-procedural analysis, Flowdroid can get the calling context of a function, that is to say, where the function is actually called. <br></div>    For example, the API<br>    getReturnFlowFunction(N callSite, M calleeMethod, N exitStmt, N returnSite):<br></div>    callSite is the statement where the function is called.<br><br><br></div>    But in the results of Flowdroid, I can&#39;t get the calling context of a source/sink. <br></div><div>    I want to know how to get that?<br></div><br></div><div>For example.<br><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">ApiTwo sharedApiTwo(ApiOne x)</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">{</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">return</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"> </span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">apiTwo(x);</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">}</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">main(){</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(0,112,192);font-weight:bold;font-style:italic;font-family:&quot;\005b8b\004f53&quot;">// context1</span><span style="color:rgb(0,112,192);font-weight:bold;font-style:italic;font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">a1 = </span><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">apiOne</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">();</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">b1 = </span><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">sharedApiOne</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">(a1);</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">apiThree</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">(b1);</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"> </span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(0,112,192);font-weight:bold;font-style:italic;font-family:&quot;\005b8b\004f53&quot;">// context2</span><span style="color:rgb(0,112,192);font-weight:bold;font-style:italic;font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">a2 = </span><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">apiOne</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">();</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">b2 = </span><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">sharedApiOne</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">(a2);</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:left"><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">apiThree</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">(b2);</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">}</span></p><p class="" style="margin-top:0pt;margin-bottom:0pt"><br><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;"></span></p><p class="" style="margin-top:0pt;margin-bottom:0pt"><br></p>Note that there is a wrapper function sharedApiTwo() for apiTwo().<br></div><div>we will get the following result:<br><table class="" style="border-collapse:collapse"><tbody><tr><td style="width:221,7000pt;padding:0,0000pt 5,4000pt 0,0000pt 5,4000pt;border-left:0,5000pt solid rgb(0,0,0);border-right:0,5000pt solid rgb(0,0,0);border-top:0,5000pt solid rgb(0,0,0);border-bottom:0,5000pt solid rgb(0,0,0)" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-weight:bold;font-family:&quot;Calibri&quot;">Source</span><span style="font-weight:bold;font-family:&quot;Calibri&quot;"></span></p></td><td style="border-left:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-weight:bold;font-family:&quot;Calibri&quot;">Sink</span><span style="font-weight:bold;font-family:&quot;Calibri&quot;"></span></p></td></tr><tr><td style="border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-family:&quot;Calibri&quot;">a1 = </span><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiOne</span><span style="font-family:&quot;Calibri&quot;">();</span><span style="font-family:&quot;Calibri&quot;"></span></p></td><td style="border-left:medium none;border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-family:&quot;Calibri&quot;">return </span><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiTwo</span><span style="font-family:&quot;Calibri&quot;">(x);</span><span style="font-family:&quot;Calibri&quot;"></span></p></td></tr><tr><td style="border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-family:&quot;Calibri&quot;">return </span><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiTwo</span><span style="font-family:&quot;Calibri&quot;">(x);</span><span style="font-family:&quot;Calibri&quot;"></span></p></td><td style="border-left:medium none;border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiThree</span><span style="font-family:&quot;Calibri&quot;">(b1);</span><span style="font-family:&quot;Calibri&quot;"></span></p></td></tr><tr><td style="border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-family:&quot;Calibri&quot;">a2 = </span><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiOne</span><span style="font-family:&quot;Calibri&quot;">();</span><span style="font-family:&quot;Calibri&quot;"></span></p></td><td style="border-left:medium none;border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-family:&quot;Calibri&quot;">return </span><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiTwo</span><span style="font-family:&quot;Calibri&quot;">(x);</span><span style="font-family:&quot;Calibri&quot;"></span></p></td></tr><tr><td style="border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-family:&quot;Calibri&quot;">return </span><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiTwo</span><span style="font-family:&quot;Calibri&quot;">(x);</span><span style="font-family:&quot;Calibri&quot;"></span></p></td><td style="border-left:medium none;border-top:medium none" valign="top" width="295"><p class="" style="margin-top:0pt;margin-bottom:0pt;text-align:center"><span style="font-weight:bold;font-family:&quot;Calibri&quot;">apiThree</span><span style="font-family:&quot;Calibri&quot;">(b2);</span><span style="font-family:&quot;Calibri&quot;"></span></p></td></tr></tbody></table><br></div><div>Take the first source-sink chain for example,<br></div><div>I can&#39;t know the function of the sink &quot;return apiTwo(x)&quot; is called in the statement &quot;<span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">b1 = </span><span style="color:rgb(51,51,51);font-weight:bold;font-family:&quot;\005b8b\004f53&quot;">sharedApiOne</span><span style="color:rgb(51,51,51);font-family:&quot;\005b8b\004f53&quot;">(a1);</span>&quot;<br></div><div><br></div>Thank,<br></div>rainkin<br></div>