diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2017-06-28 22:12:14 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2017-06-28 22:12:14 -0400 |
| commit | 980e2f090fb47f7f71a46b03e8c636819f3214ec (patch) | |
| tree | f981eaf7f74eebc382974def5acc997cc9a215bd | |
| parent | c51f3bed6bdef577253feee0e85a71fda1931bd7 (diff) | |
| parent | d3a401da5af8dd471adf842b63c7368c7f8e87d0 (diff) | |
Merging dev to master for linux demo fix -- will not change personal or
commercial builds
| -rw-r--r-- | basicblock.cpp | 9 | ||||
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryninjacore.h | 2 | ||||
| -rw-r--r-- | docs/about/open-source.md | 91 | ||||
| -rw-r--r-- | functiongraphblock.cpp | 1 | ||||
| -rw-r--r-- | python/basicblock.py | 12 | ||||
| -rw-r--r-- | python/function.py | 10 |
7 files changed, 67 insertions, 60 deletions
diff --git a/basicblock.cpp b/basicblock.cpp index 7eb37c57..c2a2bddf 100644 --- a/basicblock.cpp +++ b/basicblock.cpp @@ -125,6 +125,7 @@ vector<BasicBlockEdge> BasicBlock::GetOutgoingEdges() const BasicBlockEdge edge; edge.type = array[i].type; edge.target = array[i].target ? new BasicBlock(BNNewBasicBlockReference(array[i].target)) : nullptr; + edge.backEdge = array[i].backEdge; result.push_back(edge); } @@ -144,6 +145,7 @@ vector<BasicBlockEdge> BasicBlock::GetIncomingEdges() const BasicBlockEdge edge; edge.type = array[i].type; edge.target = array[i].target ? new BasicBlock(BNNewBasicBlockReference(array[i].target)) : nullptr; + edge.backEdge = array[i].backEdge; result.push_back(edge); } @@ -397,5 +399,10 @@ void BasicBlock::SetUserBasicBlockHighlight(uint8_t r, uint8_t g, uint8_t b, uin bool BasicBlock::IsBackEdge(BasicBlock* source, BasicBlock* target) { - return source->GetDominators().count(target) != 0; + for (auto& i : source->GetOutgoingEdges()) + { + if (i.target->GetObject() == target->GetObject()) + return i.backEdge; + } + return false; } diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 5ea6d909..e5ae77f5 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1784,6 +1784,7 @@ namespace BinaryNinja { BNBranchType type; Ref<BasicBlock> target; + bool backEdge; }; class BasicBlock: public CoreRefCountObject<BNBasicBlock, BNNewBasicBlockReference, BNFreeBasicBlock> @@ -2041,6 +2042,7 @@ namespace BinaryNinja BNBranchType type; Ref<BasicBlock> target; std::vector<BNPoint> points; + bool backEdge; }; class FunctionGraphBlock: public CoreRefCountObject<BNFunctionGraphBlock, diff --git a/binaryninjacore.h b/binaryninjacore.h index 8880747c..d053eb2b 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -1021,6 +1021,7 @@ extern "C" { BNBranchType type; BNBasicBlock* target; + bool backEdge; }; struct BNPoint @@ -1035,6 +1036,7 @@ extern "C" BNBasicBlock* target; BNPoint* points; size_t pointCount; + bool backEdge; }; struct BNDisassemblyTextLine diff --git a/docs/about/open-source.md b/docs/about/open-source.md index 60b90635..7feb1b7a 100644 --- a/docs/about/open-source.md +++ b/docs/about/open-source.md @@ -5,29 +5,30 @@ Vector 35 is grateful for the following open source packages that are used in Binary Ninja directly or indirectly: * Documentation - - [mkdocs] ([mkdocs license] - BSD) - - [mkdocs-material] ([mkdocs-material License] - BSD) - - [breathe] ([breathe license] - BSD) - [breathe-rtd-theme] ([breathe-rtd-theme license] - MIT) - - [sphinx] ([sphinx license] - BSD and others) + - [breathe] ([breathe license] - BSD) - [doxygen] ([doxygen license] - GPLv2) + - [mkdocs-material] ([mkdocs-material License] - BSD) + - [mkdocs] ([mkdocs license] - BSD) + - [sphinx] ([sphinx license] - BSD and others) The previous tools are used in the generation of our documentation, but are not distributed themselves and are merely listed here in acknowledgement for the value they provide. * UI + - [dejavusanscode] ([dejavusanscode license] - multiple open licenses) + - [opensans] ([opensans license] - Apache 2.0) - [qt] ([qt license] - LGPLv3 / note, please see our [qt build instructions below](open-source.md#building-qt)) - [sourcecodepro] ([sourcecodepro license] - SIL open font license) - - [opensans] ([opensans license] - Apache 2.0) - - [dejavusanscode] ([dejavusanscode license] - multiple open licenses) * Core + - [discount] ([discount license] - BSD) + - [libcurl] ([libcurl license] - MIT/X derivative) + - [libgit2] ([libgit2 license] - GPLv2 with linking exception) + - [llvm] ([llvm license] - BSD-style) - [lzf] ([lzf license] - BSD) - - [zlib] ([zlib license] - zlib license) - [openssl] ([openssl license] - openssl license) - - [discount] ([discount license] - BSD) - [sqlite] ([sqlite license] - public domain) - - [llvm] ([llvm license] - BSD-style) - - [libgit2] ([libgit2 license] - GPLv2 with linking exception) + - [zlib] ([zlib license] - zlib license) * Other - [yasm] ([yasm license] - 2-clause BSD) @@ -51,45 +52,47 @@ Please note that we offer no support for running Binary Ninja with modified Qt l - On Windows, replace the `Qt5core.dll`, `Qt5Gui.dll`, `Qt5Network.dll`, and `Qt5Widgets.dll` files in `C:\Program Files\Vector35\BinaryNinja\` - On Linux, replace the `libQt5Core.so.5`, `libQt5DBus.so.5`, `libQt5Gui.so.5`, `libQt5Network.so.5`, `libQt5Widgets.so.5`, `libQt5XcbQpa.so.5` files wherever Binary Ninja was extracted -[mkdocs]: http://www.mkdocs.org/ -[mkdocs license]: https://github.com/mkdocs/mkdocs/blob/master/LICENSE -[mkdocs-material]: https://github.com/squidfunk/mkdocs-material -[mkdocs-material license]: https://github.com/squidfunk/mkdocs-material/blob/master/LICENSE -[breathe]: https://github.com/michaeljones/breathe +[Building Qt 5 from Git]: https://wiki.qt.io/Building-Qt-5-from-Git +[Qt 5.6]: https://www.qt.io/qt-licensing-terms/ [breathe license]: https://github.com/michaeljones/breathe/blob/master/LICENSE -[breathe-rtd-theme]: https://github.com/snide/sphinx_rtd_theme/ [breathe-rtd-theme license]: https://github.com/snide/sphinx_rtd_theme/blob/master/LICENSE -[sphinx]: http://www.sphinx-doc.org/en/stable/index.html -[sphinx license]: https://github.com/sphinx-doc/sphinx/blob/master/LICENSE -[doxygen]: http://www.stack.nl/~dimitri/doxygen/ -[doxygen license]: https://github.com/doxygen/doxygen/blob/master/LICENSE -[qt]: https://www.qt.io/download/ -[qt license]: https://www.qt.io/qt-licensing-terms/ -[lzf]: http://oldhome.schmorp.de/marc/liblzf.html -[lzf license]: http://oldhome.schmorp.de/marc/liblzf.html -[discount]: http://www.pell.portland.or.us/~orc/Code/discount/ +[breathe-rtd-theme]: https://github.com/snide/sphinx_rtd_theme/ +[breathe]: https://github.com/michaeljones/breathe +[dejavusanscode license]: https://github.com/SSNikolaevich/DejaVuSansCode/blob/master/LICENSE +[dejavusanscode]: https://github.com/SSNikolaevich/DejaVuSansCode [discount license]: http://www.pell.portland.or.us/~orc/Code/discount/COPYRIGHT.html -[sqlite]: https://www.sqlite.org/index.html -[sqlite license]: https://www.sqlite.org/copyright.html -[llvm]: http://llvm.org/releases/3.8.1/ -[llvm license]: http://llvm.org/releases/3.8.1/LICENSE.TXT -[libgit2]: https://libgit2.github.com/ +[discount]: http://www.pell.portland.or.us/~orc/Code/discount/ +[doxygen license]: https://github.com/doxygen/doxygen/blob/master/LICENSE +[doxygen]: http://www.stack.nl/~dimitri/doxygen/ +[libcurl license]: https://curl.haxx.se/docs/copyright.html +[libcurl]: https://curl.haxx.se/ [libgit2 license]: https://github.com/libgit2/libgit2/blob/master/COPYING -[yasm]: http://yasm.tortall.net/ -[yasm license]: https://github.com/yasm/yasm/blob/master/BSD.txt -[zlib]: http://www.zlib.net/ -[zlib license]: http://www.zlib.net/zlib_license.html -[openssl]: https://www.openssl.org/ +[libgit2]: https://libgit2.github.com/ +[llvm license]: http://llvm.org/releases/3.8.1/LICENSE.TXT +[llvm]: http://llvm.org/releases/3.8.1/ +[lzf license]: http://oldhome.schmorp.de/marc/liblzf.html +[lzf]: http://oldhome.schmorp.de/marc/liblzf.html +[mkdocs license]: https://github.com/mkdocs/mkdocs/blob/master/LICENSE +[mkdocs-material license]: https://github.com/squidfunk/mkdocs-material/blob/master/LICENSE +[mkdocs-material]: https://github.com/squidfunk/mkdocs-material +[mkdocs]: http://www.mkdocs.org/ +[opensans license]: http://www.apache.org/licenses/LICENSE-2.0.html +[opensans]: https://www.google.com/fonts/specimen/Open+Sans [openssl license]: https://www.openssl.org/source/license.html -[tomcrypt]: https://github.com/libtom/libtomcrypt -[tomcrypt license]: https://github.com/libtom/libtomcrypt/blob/develop/LICENSE -[sourcecodepro]: https://github.com/adobe-fonts/source-code-pro +[openssl]: https://www.openssl.org/ +[qt license]: https://www.qt.io/qt-licensing-terms/ +[qt]: https://www.qt.io/download/ [sourcecodepro license]: https://github.com/adobe-fonts/source-code-pro/blob/master/LICENSE.txt -[opensans]: https://www.google.com/fonts/specimen/Open+Sans -[opensans license]: http://www.apache.org/licenses/LICENSE-2.0.html -[dejavusanscode]: https://github.com/SSNikolaevich/DejaVuSansCode -[dejavusanscode license]: https://github.com/SSNikolaevich/DejaVuSansCode/blob/master/LICENSE -[Qt 5.6]: https://www.qt.io/qt-licensing-terms/ -[Building Qt 5 from Git]: https://wiki.qt.io/Building-Qt-5-from-Git +[sourcecodepro]: https://github.com/adobe-fonts/source-code-pro +[sphinx license]: https://github.com/sphinx-doc/sphinx/blob/master/LICENSE +[sphinx]: http://www.sphinx-doc.org/en/stable/index.html +[sqlite license]: https://www.sqlite.org/copyright.html +[sqlite]: https://www.sqlite.org/index.html [tarball]: https://binary.ninja/qt5.6.0.tar.xz +[tomcrypt license]: https://github.com/libtom/libtomcrypt/blob/develop/LICENSE +[tomcrypt]: https://github.com/libtom/libtomcrypt [unsign]: https://github.com/steakknife/unsign +[yasm license]: https://github.com/yasm/yasm/blob/master/BSD.txt +[yasm]: http://yasm.tortall.net/ +[zlib license]: http://www.zlib.net/zlib_license.html +[zlib]: http://www.zlib.net/ diff --git a/functiongraphblock.cpp b/functiongraphblock.cpp index 99ce2e08..938fb635 100644 --- a/functiongraphblock.cpp +++ b/functiongraphblock.cpp @@ -130,6 +130,7 @@ const vector<FunctionGraphEdge>& FunctionGraphBlock::GetOutgoingEdges() edge.type = edges[i].type; edge.target = edges[i].target ? new BasicBlock(BNNewBasicBlockReference(edges[i].target)) : nullptr; edge.points.insert(edge.points.begin(), &edges[i].points[0], &edges[i].points[edges[i].pointCount]); + edge.backEdge = edges[i].backEdge; result.push_back(edge); } diff --git a/python/basicblock.py b/python/basicblock.py index 3dc5b050..7858cc60 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -29,10 +29,11 @@ import function class BasicBlockEdge(object): - def __init__(self, branch_type, source, target): + def __init__(self, branch_type, source, target, back_edge): self.type = branch_type self.source = source self.target = target + self.back_edge = back_edge def __repr__(self): if self.type == BranchType.UnresolvedBranch: @@ -42,11 +43,6 @@ class BasicBlockEdge(object): else: return "<%s: %#x>" % (BranchType(self.type).name, self.target.start) - @property - def back_edge(self): - """Whether the edge is a back edge (end of a loop)""" - return self.target in self.source.dominators - class BasicBlock(object): def __init__(self, view, handle): @@ -114,7 +110,7 @@ class BasicBlock(object): target = BasicBlock(self.view, core.BNNewBasicBlockReference(edges[i].target)) else: target = None - result.append(BasicBlockEdge(branch_type, self, target)) + result.append(BasicBlockEdge(branch_type, self, target, edges[i].backEdge)) core.BNFreeBasicBlockEdgeList(edges, count.value) return result @@ -130,7 +126,7 @@ class BasicBlock(object): target = BasicBlock(self.view, core.BNNewBasicBlockReference(edges[i].target)) else: target = None - result.append(BasicBlockEdge(branch_type, self, target)) + result.append(BasicBlockEdge(branch_type, self, target, edges[i].backEdge)) core.BNFreeBasicBlockEdgeList(edges, count.value) return result diff --git a/python/function.py b/python/function.py index 34511cfa..8beebe66 100644 --- a/python/function.py +++ b/python/function.py @@ -948,20 +948,16 @@ class DisassemblyTextLine(object): class FunctionGraphEdge(object): - def __init__(self, branch_type, source, target, points): + def __init__(self, branch_type, source, target, points, back_edge): self.type = BranchType(branch_type) self.source = source self.target = target self.points = points + self.back_edge = back_edge def __repr__(self): return "<%s: %s>" % (self.type.name, repr(self.target)) - @property - def back_edge(self): - """Whether the edge is a back edge (end of a loop)""" - return self.target in self.source.basic_block.dominators - class FunctionGraphBlock(object): def __init__(self, handle): @@ -1074,7 +1070,7 @@ class FunctionGraphBlock(object): points = [] for j in xrange(0, edges[i].pointCount): points.append((edges[i].points[j].x, edges[i].points[j].y)) - result.append(FunctionGraphEdge(branch_type, self, target, points)) + result.append(FunctionGraphEdge(branch_type, self, target, points, edges[i].backEdge)) core.BNFreeFunctionGraphBlockOutgoingEdgeList(edges, count.value) return result |
