Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support for generating clang AST from exported JSON #51

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f08a544
ghidra: Start representing high variables as custom operations.
pgoodman Oct 25, 2024
ce54556
ghidra: Add support for parameter variables.
pgoodman Oct 25, 2024
7518bc2
ghidra: Remove happens_after relationship. It's less useful/meaningfu…
pgoodman Oct 29, 2024
8047a04
ghidra: Include constants. Elide some MULTIEQUALs.
pgoodman Oct 29, 2024
e6e9e90
ghidra: Working on resolving unknown inputs/outputs. Resolved call ar…
pgoodman Oct 29, 2024
77690f5
ghidra: Improved progress on local variable recovery via json p-code …
pgoodman Oct 30, 2024
0927e7c
ghidra: Now creating HighLocals where there are stack frame Variables…
pgoodman Nov 1, 2024
c903084
ghidra: Fixed some bugs where duplicate locals were being rendered in…
pgoodman Nov 1, 2024
746e211
treewide: Fix license block.
pgoodman Nov 4, 2024
fd68194
ghidra: Improve JSON serialization. Add Python script to render JSON …
pgoodman Nov 4, 2024
ddb1bed
ghidra: Remove register classification of variables, switch to named …
pgoodman Nov 5, 2024
d9e7e3f
ghidra: Fix DOT digraph generation when dealing with CALLOTHER.
pgoodman Nov 5, 2024
b3a95b4
ghidra: Remove live specific to debugging local_118 var/type resoluti…
pgoodman Nov 6, 2024
473a61c
Add support for global variables to PTRSUB rewriting.
pgoodman Nov 7, 2024
f464b3f
ghidra: Fix issue with parameter declaration counts.
pgoodman Nov 7, 2024
218abc5
ghidra: Added a todo type to handle some stuff later
pgoodman Nov 7, 2024
efc5341
ghidra: Added parameter PTRSUB recovery. Added blacklist of functions…
pgoodman Nov 8, 2024
ac0b08b
ghidra: Fix global reference PTRSUB offsets.
pgoodman Nov 8, 2024
56e57ed
ghidra: Simplify RETURN serialization.
pgoodman Nov 8, 2024
8728335
ghidra: Recover globals and render them in the DOT digraph.
pgoodman Nov 8, 2024
2db5f30
ghidra: Add ADDRESS_OF pseudo op.
pgoodman Nov 11, 2024
344b072
ghidra: Fixup stack pointer-based varnodes in non-PTRSUB PcodeOps. Fo…
pgoodman Nov 12, 2024
706ce1a
ghidra: Fixes for length calculation of string data types. Fixes for …
pgoodman Nov 12, 2024
beb75ce
ghidra: Add flag to calls when the lack of an output signals a void r…
pgoodman Nov 13, 2024
800f11c
ghidra: Added more symbols to blacklist.
pgoodman Nov 13, 2024
8c02d66
ghidra: remove 'VariableClassification.' qualifier in 'case' statements.
pgoodman Nov 14, 2024
64659a7
ghidra: Make entry basic blocks namespaced by the function address so…
pgoodman Nov 15, 2024
dc55a38
Represent CALLOTHER intrinsics as top-level variadic functions with i…
pgoodman Nov 19, 2024
ea637ef
ghidra: add support for lowering multiple functions and update unit test
kumarak Sep 20, 2024
9a59d05
pcode: implement json parser to extract pcode from output file for co…
kumarak Sep 30, 2024
f283735
codegen: deserialize the exported json
kumarak Oct 29, 2024
25bee53
codegen: update json deserializer to add support for more fields
kumarak Nov 1, 2024
bf1bb4c
codegen: update generating ast and support for more opcodes
kumarak Nov 9, 2024
41f40ce
codegen: move type generation to type builder
kumarak Nov 16, 2024
5e44880
fixup! refactor and cleanup
kumarak Nov 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ Checks: "*,\
-llvm-include-order,\
-llvmlibc-*,\
-modernize-use-nodiscard,\
-misc-non-private-member-variables-in-classes"
-misc-non-private-member-variables-in-classes,\
-modernize-use-trailing-return-type,\
-readability-convert-member-functions-to-static, \
-misc-no-recursion, \
-google-build-using-namespace, \
-cppcoreguidelines-owning-memory"
WarningsAsErrors: ''
CheckOptions:
- key: 'bugprone-argument-comment.StrictMode'
Expand Down Expand Up @@ -47,15 +52,15 @@ CheckOptions:
value: 'true'
# These seem to be the most common identifier styles
- key: 'readability-identifier-naming.AbstractClassCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.ClassCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.ClassConstantCase'
value: 'lower_case'
value: 'camelBack'
- key: 'readability-identifier-naming.ClassMemberCase'
value: 'lower_case'
value: 'camelBack'
- key: 'readability-identifier-naming.ClassMethodCase'
value: 'lower_case'
value: 'camelBack'
- key: 'readability-identifier-naming.ConstantCase'
value: 'lower_case'
- key: 'readability-identifier-naming.ConstantMemberCase'
Expand All @@ -71,9 +76,9 @@ CheckOptions:
- key: 'readability-identifier-naming.ConstexprVariableCase'
value: 'lower_case'
- key: 'readability-identifier-naming.EnumCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.EnumConstantCase'
value: 'lower_case'
value: 'UPPER_CASE'
- key: 'readability-identifier-naming.FunctionCase'
value: 'lower_case'
- key: 'readability-identifier-naming.GlobalConstantCase'
Expand Down Expand Up @@ -101,7 +106,7 @@ CheckOptions:
- key: 'readability-identifier-naming.MemberCase'
value: 'lower_case'
- key: 'readability-identifier-naming.MethodCase'
value: 'lower_case'
value: 'camelBack'
- key: 'readability-identifier-naming.NamespaceCase'
value: 'lower_case'
- key: 'readability-identifier-naming.ParameterCase'
Expand All @@ -113,13 +118,13 @@ CheckOptions:
- key: 'readability-identifier-naming.PrivateMemberCase'
value: 'lower_case'
- key: 'readability-identifier-naming.PrivateMemberPrefix'
value: 'm_'
value: ''
- key: 'readability-identifier-naming.PrivateMethodCase'
value: 'lower_case'
- key: 'readability-identifier-naming.ProtectedMemberCase'
value: 'lower_case'
- key: 'readability-identifier-naming.ProtectedMemberPrefix'
value: 'm_'
value: ''
- key: 'readability-identifier-naming.ProtectedMethodCase'
value: 'lower_case'
- key: 'readability-identifier-naming.PublicMemberCase'
Expand All @@ -133,23 +138,23 @@ CheckOptions:
- key: 'readability-identifier-naming.StaticVariableCase'
value: 'lower_case'
- key: 'readability-identifier-naming.StructCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.TemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TemplateTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeAliasCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypedefCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.UnionCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.ValueTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.VariableCase'
value: 'lower_case'
- key: 'readability-identifier-naming.VirtualMethodCase'
value: 'lower_case'
value: 'camelBack'
...
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#
# Copyright (c) 2024, Trail of Bits, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#
# Copyright (c) 2024, Trail of Bits, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#
# Copyright (c) 2024, Trail of Bits, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
Expand Down
20 changes: 16 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2024, Trail of Bits, Inc. All rights reserved. This source code
# is licensed in accordance with the terms specified in the LICENSE file found
# in the root directory of this source tree.
# Copyright (c) 2024, Trail of Bits, Inc.
#
# This source code is licensed in accordance with the terms specified in the
# LICENSE file found in the root directory of this source tree.

cmake_minimum_required(VERSION 3.25)

Expand Down Expand Up @@ -94,6 +95,17 @@ list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")

include(AddMLIR)

find_package(Clang ${LLVM_PACKAGE_VERSION} CONFIG REQUIRED)
message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")

find_package(VAST CONFIG REQUIRED)
message(STATUS "Using VASTConfig.cmake in: ${VAST_DIR}")


find_package(gap CONFIG REQUIRED)
message(STATUS "Using gapConfig.cmake in: ${gap_DIR}")

set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)

Expand Down Expand Up @@ -252,4 +264,4 @@ if (PATCHESTRY_INSTALL)
DESTINATION ${PATCHESTRY_CMAKE_INSTALL_DIR}
)

endif()
endif()
7 changes: 4 additions & 3 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) 2024, Trail of Bits, Inc. All rights reserved. This source code
# is licensed in accordance with the terms specified in the LICENSE file found
# in the root directory of this source tree.
# Copyright (c) 2024, Trail of Bits, Inc.
#
# This source code is licensed in accordance with the terms specified in the
# LICENSE file found in the root directory of this source tree.

add_subdirectory(patchestry)
Loading
Loading