Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The print plugin is probably the oldest plugin in BAP, and it was
really crying out for a little bit of attention and love. Not that I
was able to give it what it wants, but here are some tweaks that
hopefully will make our life easier (and nicer). Here is the list of
new features
-dcfg
- will now print graphs of all subroutines as subgraphsenclosed in partitions, as well as print the interprocedural
edges. This will also let
xdot
and other tools that didnt'understand several digraphs in row to work with bap directly, e.g.,
bap ./exe -dcfg | xdot -
-dgraph
is the new outputting format which is basically the sameas
-dcfg
but without the IR terms (i.e., only basic blocks, nodef terms). Also partitioned and with interprocedural edges.
tid numbers are properly escaped now (it looks like that dot or
xdot interprets somehow them even if they are delimited with quotes)
new mechanism for filtering the output, instead of old
--print-symbol
and--print-section
(which are still supported) wenow have a new
--print-matching
filter that accepts<property>:<regex>
format. The<property>
field could be fornow one of
section
,segment
,symbol
, orname
. Wheresymbol
now denotes the name of the symbol take from the filesymbol table or accompanying debugging information, e.g.,
dwarf. Not that symbol that we reconstructed during the
disassembling. And
name
has the same meaning thatsymbol
wasbearing before, i.e., the name of a subroutine. Concerning the
regular expression, the accepted syntax is PCRE with partial
matches, e.g.,
--print-matching=section:text
will match with.text
andtexting
. Use\b
to specify word boundaries, e.g.,--print-matching='symbol:\bmain\b'
will print onlymain
(and not__libc_start_main
). Do not forget to delimit the regex withsingle quotes, to prevent your shell from ringing the bell.
fixes a bug in the ADT representation of Tids.
A Bug in Graphviz
A side note on graphviz dot (and xdot). Due to a 20 years old
bug (supposedly finally fixed in version 2.40) dot is usually unable
to render more or less complex graphs. This bug is triggered randomly
and depends on many variables (like fonts, subroutine names, etc). It
manifests itself as a message (not visible when xdot is used) and
afterwards
dot
(and correspondigly xdot) will just hang up and stalefor infinity
I was using version 2.40 (via docker alpine) and was able to render
some complex graphs, but I believe I'm still hitting this issue on
some graphs even in version 2.40.