mirror of
https://github.com/lifting-bits/mcsema
synced 2026-06-08 15:31:09 +00:00
2d55d02cc3
* API improvements. Must be used with the api_improvements branch of both Remill and McSema fixes for x86 and running the lifted code with klee * Update dockerfile to clone anvill * update remill commit id * Add python3 to dockerfile * update python3 * disable abi script * Updated cmake to find anvill * Update main.cpp * update find_package for anvill * WIP:updated prebuild cfg * update prebuild cfg files * enable abi build for testsuite * Fix memory leak * install missing package for testcases * frontend: Reflect cfg file changes in dyninst frontend. * frontend: Update local files copyrights to reflect overall change to agplv3. * fix failing testcases * update test cfgs * Fix test failure with local state pointer * set the flag to use local state_ptr in default mode Co-authored-by: kumarak <iit.akshay@gmail.com> Co-authored-by: Lukas Korencik <xkorenc1@fi.muni.cz>
57 lines
2.1 KiB
Python
Executable File
57 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# Copyright (c) 2020 Trail of Bits, Inc.
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
import os.path
|
|
import subprocess
|
|
|
|
def usage(executable):
|
|
print "Usage:"
|
|
print "{} <header file> [header file] [header file] ...".format(executable)
|
|
|
|
def check_prerequisites():
|
|
if not os.path.isdir("cparser"):
|
|
print "[+] cparser project not found, cloning cparser"
|
|
return subprocess.call(["git", "clone", "https://github.com/pgoodman/cparser.git"])
|
|
return 0
|
|
|
|
def process_single_file(filename):
|
|
'''given a filename, runs that file the the preprocessor, post processor, and std def generator.
|
|
Returns the text of the resulting std def'''
|
|
cc_subproc = subprocess.Popen(["cc", "-E", filename], stdout=subprocess.PIPE)
|
|
post_proc = subprocess.Popen(["python", "cparser/post_process_header.py"], stdin=cc_subproc.stdout, stdout=subprocess.PIPE)
|
|
make_def_proc = subprocess.Popen(["python", "cparser/make_std_defs.py"], stdin=post_proc.stdout, stdout=subprocess.PIPE)
|
|
cc_subproc.stdout.close()
|
|
post_proc.stdout.close()
|
|
make_def_stdout = make_def_proc.communicate()[0]
|
|
return make_def_stdout
|
|
|
|
def main(args):
|
|
if len(args) == 1:
|
|
usage(args[0])
|
|
return 1
|
|
if 0 != check_prerequisites():
|
|
print "error checking or installing prerequisites, aborting"
|
|
return 2
|
|
for filename in args[1:]:
|
|
if os.path.isfile(filename):
|
|
print process_single_file(filename)
|
|
return 0
|
|
|
|
if __name__=='__main__':
|
|
import sys
|
|
sys.exit(main(sys.argv))
|