GithubHelp home page GithubHelp logo

Comments (2)

axt avatar axt commented on June 15, 2024

Sorry, I will not have time for this probably, untill end of May.

from angr-utils.

axt avatar axt commented on June 15, 2024

Hi! Sorry again for my late answer!

This behavior is caused by the context sensitivity level setting of CFGEmulated. If it is higher than 0, and the same function is called from multiple locations, it will have multiple nodes in the generated CFG, because in this case, nodes are identified by their callstack key, not just by their address, as in case of CFGFast, while the filtering is done only by address:

As you can see in this picture, the function f0 is called from two locations, the callstack key is different for the two graphs of the function:
https://imgur.com/PJ7F3QL

Since in the case of CFGEmulated the discovered CFG of a function can be different for different calls, I don't think, that this behavior is a bug.

You could use a context sensitivity level of 0, if you don't need a higher one, or solve the issue from the outside (angr-utils is just a high-level interface, for some common plots, on bingraphvis level you can do more filtering, annotations, etc)

from bingraphvis.angr import *
from bingraphvis import DotOutput

def safehex(x):
    return "%x" % x if x is not None else "none"

# get the unique callstack keys
cskeys = set([i.callstack_key for i in cfg.nodes()])

for cskey in cskeys:

        # last element of callstack key is the function address
        func = cfg.kb.functions[cskey[-1]]

        # create the default cfg plotting pipeline, include the callstack key in the output file name
        vis = AngrVisFactory().default_cfg_pipeline(cfg, asminst=True, vexinst=False, comments=True)
        vis.set_output(DotOutput("%s_%s_cfg" % (func.name, ":".join(map(safehex,cskey))), format="raw"))

        # if you want debug info
        vis.add_content(AngrCFGDebugInfo())

        # filter explicitly for the current callstack key
        vis.process(cfg.graph, filter=lambda node: node.obj.callstack_key == cskey)

from angr-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.