Frama-C Bug Tracking System

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001431Frama-CGraphical User Interfacepublic2013-05-27 09:422018-01-12 14:28
Assigned Tomaroneze 
PlatformOSOS Version
Product VersionFrama-C Fluorine-20130401 
Target VersionFixed in Version 
Summary0001431: How to use the "Callers ..." context menu item
DescriptionPardon the ignorance, but I couldn't find this on the manual...

I have a program where, after parsing, some warnings of this form are emitted:

"Calling undeclared function __builtin_swap32. Old style K&R code?"

I know there is a missing source file somewhere in my project, but I'd like to know who is calling these functions (since they are never directly called in my code). So I right-click on the function prototype on the GUI, and the last button in the context menu is "Callers ...". If I click on it, the "Launching analysis" window is displayed, with no indication of which analysis to choose.

I suppose the analysis I'd like is "Syntactic callgraph". So I choose it, without customizing any options, click Execute, but nothing changes. The "Callers ..." button is always visible when right-clicking the function declaration.

I noticed that if I choose the "Users" analysis, when right-clicking afterwards there is no more "Callers ..." button on the context menu, but I fail to see how any of the new options (e.g. Dependencies) could help me identify the function callers.

Is there a simpler way, other than by manually parsing the DOT file (the produced graph is too large for me to visually inspect it), to obtain information about function callers?
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
yakobowski (manager)
2013-05-30 14:47

Unfortunately, the functionality you are looking for is currently missing from the GUI. The "Callers..." menu refers to semantic callers, as found by the Value Analysis (including calls through pointers). Basic syntactic callers are not available for the moment. If this functionality is really useful to you, this very simple plugin would do the trick:

let f = "__builtin_swap32"

open Cil_types

class find = object
  inherit Visitor.frama_c_inplace as self

  method vinst i =
    (match i with
    | Call (_, { enode = Lval (Var vi, _)}, _, _) when vi.vname = f ->
      Kernel.result ~current:true "function %s called by %a@."
        f Kernel_function.pretty (Extlib.the self#current_kf);
    | _ -> ()

let () = Db.Main.extend
  (fun () ->
    let ast = Ast.get () in
    Visitor.visitFramacFile (new find) ast
You can change the name of the function you are interested in at the beginning of the file. Start the analysis with frama-c -load-script <your C files>

- Issue History
Date Modified Username Field Change
2013-05-27 09:42 dhekir New Issue
2013-05-30 14:47 yakobowski Note Added: 0003925
2013-05-30 14:47 yakobowski Assigned To => yakobowski
2013-05-30 14:47 yakobowski Severity minor => feature
2013-05-30 14:47 yakobowski Status new => confirmed
2018-01-12 14:28 signoles Assigned To yakobowski => maroneze
2018-01-12 14:28 signoles Status confirmed => assigned
2018-01-12 14:28 signoles Status assigned => confirmed

Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker