Skip to content

Commit 9f206c3

Browse files
authored
Merge pull request #1 from pdreiter/end-to-end-testing
Minor fix for end-to-end testing and flexible initialization
2 parents bff7426 + dfb4380 commit 9f206c3

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

genprog_decomp_ida.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99

1010
# path to idat binary
1111

12-
IDA_PATH="/home/htay/seclab_ida/ida/idat"
12+
IDA_DEFAULT_PATH=os.environ['HOME']+"/seclab_ida/ida/idat"
13+
if os.environ['IDA_BASE_DIR']:
14+
IDA_PATH=os.environ['IDA_BASE_DIR']+"/idat"
15+
else:
16+
IDA_PATH=IDA_DEFAULT_PATH
1317

1418
# path to defs.h
15-
DEFS_PATH="refs/defs.h"
19+
DEFS_PATH=os.path.dirname(os.path.realpath(__file__))+"/refs/defs.h"
1620

1721
# stub markers for processing
1822

@@ -846,14 +850,6 @@ def generate_wrapper(self, target, funcs, stubMap, dataMap):
846850

847851
print("dataMap", dataMap)
848852
# arguments to wrapper function
849-
for d in dataMap.keys():
850-
print("data", d)
851-
mainStub += "\t\tNULL,\n"
852-
dataDef = d.split(";")[0]
853-
dataDef = dataDef.split("=")[0].strip()
854-
dataType, dataName = self.getTypeAndLabel(dataDef)
855-
wrapperStub += "\tvoid* my%s,\n" % dataName
856-
857853

858854
for s in stubMap.keys():
859855
mainStub += "\t\tNULL,\n"
@@ -864,6 +860,18 @@ def generate_wrapper(self, target, funcs, stubMap, dataMap):
864860
print(s)
865861
print(" - STUBNAME: ", self.get_stub_name(s))
866862

863+
# note from pdr: looks like when data declarations are included, the
864+
# function prototype and funcstubs order of symbol definitions
865+
# are not consistent
866+
for d in dataMap.keys():
867+
print("data", d)
868+
mainStub += "\t\tNULL,\n"
869+
dataDef = d.split(";")[0]
870+
dataDef = dataDef.split("=")[0].strip()
871+
dataType, dataName = self.getTypeAndLabel(dataDef)
872+
wrapperStub += "\tvoid* my%s,\n" % dataName
873+
print(" - DATA DECL: ", dataName)
874+
867875
for argTuple in args:
868876
argType = argTuple[0]
869877
argName = argTuple[1]

0 commit comments

Comments
 (0)