blob: 7f9258af9581577ee3f998f4393a34cc1a936be9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#!/bin/bash
#isBinaryInDir=`ls | grep $1`;
#echo $isBinaryInDir
#if [[ -n "$isBinaryInDir" ]]
#then
# echo "chosen binary is : "$1;
#else
# echo "couldnt find the binary in the current folder";
# exit 0;
#fi
binaryWithoutExtention=`echo $1 | cut -d '.' -f1`
echo "saving result in : "$binaryWithoutExtention;
ulimit -c 9999
echo "--------------------------"
./$1 ## -c $3 -c SHOULD BE IN THE JAVA CODE AS A NESTED ARGUMENT. This is for manual testing
echo "--------------------------"
checkCoreGen=`ls | grep core`;
if [[ -n "$checkCoreGen" ]]
then
mv ./core errorReports/
else
echo "no core dump generated. Abort";
echo "0" >> errorReports/parsedStackTrace_$2
exit 0;
fi
echo bt | gdb $1 errorReports/core | sed -e 's/(gdb) //' | grep \# | uniq > errorReports/stackTrace_$binaryWithoutExtention
tmp=`cat errorReports/stackTrace_$binaryWithoutExtention | sed 's/.* in //' | cut -d "(" -f1`
echo "function names : "$tmp
functionNameArray=(${tmp// / })
tmp2=`cat errorReports/stackTrace_$binaryWithoutExtention | sed 's/.* at //' | cut -d "(" -f1 | cut -d "#" -f1`
fileNameArray=(${tmp2// / })
lineNumberArray=(${tmp2// / })
cpt=0
for i in "${fileNameArray[@]}"
do
loopVar=$i
fileNameArray[cpt]="${loopVar%:*}"
cpt=$cpt+1
done
echo "file names : " "${fileNameArray[@]}"
cpt=0
for i in "${lineNumberArray[@]}"
do
loopVar=$i
lineNumberArray[cpt]=`echo $loopVar | sed 's/.*://'`
cpt=$cpt+1
done
echo "line numbers : " "${lineNumberArray[@]}"
resultLS=`ls errorReports | grep parsedStackTrace_$2`
if [[ ! -z $resultLS ]]
then
fileExists=1
while [ $fileExists -eq 1 ]
do
var=`shuf -i 1-10000 -n 1`;
resultLS=`ls errorReports | grep parsedStackTrace_$var`
echo $resultLS
if [[ -n "$resultLS" ]]
then
fileExists=1
else
fileExists=0
fi
done
else
var=$2
fi
reportFileName=parsedStackTrace_$var
echo $reportFileName
checkFileExists=`ls errorReports | grep $reportFileName`;
if [[ -n "$checkFileExists" ]]
then
rm errorReports/$reportFileName
fi
touch errorReports/$reportFileName
echo "functionNames:" >> errorReports/$reportFileName
cpt=0
for j in "${functionNameArray[@]}"
do
echo $j"," >> errorReports/$reportFileName
done
echo "fileNames:" >> errorReports/$reportFileName
cpt=0
for j in "${fileNameArray[@]}"
do
echo $j"," >> errorReports/$reportFileName
done
echo "lineNumbers:" >> errorReports/$reportFileName
cpt=0
for j in "${lineNumberArray[@]}"
do
echo $j >> errorReports/$reportFileName
done
echo "end:" >> errorReports/$reportFileName
echo "path:" >> errorReports/$reportFileName
compteur=1;
tmpString="mut_"$compteur
boolean=1
while [ $boolean -eq 1 ]
do
echo ${!tmpString} >> errorReports/$reportFileName
compteur=$((compteur+1))
tmpString="mut_"$compteur
tmpString2=${!tmpString}
if [[ ! -n "$tmpString2" ]]
then
boolean=0
fi
done
echo "endpath:" >> errorReports/$reportFileName
rm errorReports/core
rm errorReports/stackTrace_$binaryWithoutExtention
|