Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
German Leon
Carol-fi
Commits
cc607270
Commit
cc607270
authored
Dec 18, 2020
by
German Leon
Browse files
Merge branch 'master' of
ssh://lorca.act.uji.es:2222/leon/mycarol-fi
Me he hecho un lio:w
parents
7d501a81
2b26a42d
Changes
4
Show whitespace changes
Inline
Side-by-side
classes/BitFlip.py
View file @
cc607270
...
...
@@ -22,6 +22,7 @@ class BitFlip:
self
.
__fault_model
=
kwargs
.
get
(
'fault_model'
)
self
.
__logging
=
kwargs
.
get
(
'logging'
)
self
.
__injection_site
=
kwargs
.
get
(
'injection_site'
)
self
.
__maxregs
=
kwargs
.
get
(
'max_regs'
)
self
.
fault_injected
=
False
"""
...
...
@@ -200,17 +201,17 @@ class BitFlip:
def
__select_register
(
self
):
# Start on 1 to consider R0
max_num_register
=
0
#
max_num_register =
# registers_list.popleft()
registers_list
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"info registers"
)
for
line
in
registers_list
:
m
=
re
.
match
(
r
".*R.*0x([0-9a-fA-F]+).*"
,
line
)
if
m
and
m
.
group
(
1
)
!=
'0'
:
#
registers_list = cf.execute_command(gdb=gdb, to_execute="info registers")
#
for line in registers_list:
#
m = re.match(r".*R.*0x([0-9a-fA-F]+).*", line)
#
if m and m.group(1) != '0':
#self.__logging.info ("LIne salida:{}".format(m.group(1))
max_num_register
+=
1
#
max_num_register += 1
#self.__logging.info("LIne entrada {}--max{}".format(line,max_num_register))
self
.
__register
=
"R{}"
.
format
(
random
.
randint
(
0
,
max_num_register
-
1
))
self
.
__logging
.
info
(
"MAX_NUM_REGISTER:{}"
.
format
(
max_num_register
))
self
.
__register
=
"R{}"
.
format
(
random
.
randint
(
0
,
self
.
__maxregs
-
1
))
self
.
__logging
.
info
(
"MAX_NUM_REGISTER:{}"
.
format
(
self
.
__maxregs
))
"""
Instruction injector
"""
...
...
fault_injector.py
View file @
cc607270
...
...
@@ -333,6 +333,7 @@ def gdb_inject_fault(**kwargs):
seq_signals
=
kwargs
.
get
(
'seq_signals'
)
init_sleep
=
kwargs
.
get
(
'init_sleep'
)
sdc_check_script
=
kwargs
.
get
(
'gold_check_script'
)
maxregs
=
kwargs
.
get
(
'max_regs'
).
# signalCmd
signal_cmd
=
kwargs
.
get
(
"signal_cmd"
)
...
...
@@ -356,7 +357,7 @@ def gdb_inject_fault(**kwargs):
logging
.
info
(
"Starting GDB script"
)
# Generate configuration file for specific test
gdb_env_string
=
"{}|{}|{}|{}|{}|file {}; set args {}|{}"
.
format
(
gdb_kernel
,
os
.
getpid
(),
","
.
join
(
str
(
i
)
for
i
in
bits_to_flip
),
fault_model
,
gdb_env_string
=
"{}|{}|{}|{}|{}|
{}|
file {}; set args {}|{}"
.
format
(
gdb_kernel
,
os
.
getpid
(),
max_regs
,
","
.
join
(
str
(
i
)
for
i
in
bits_to_flip
),
fault_model
,
flip_log_file
,
benchmark_binary
,
benchmark_args
,
injection_site
)
...
...
@@ -694,6 +695,7 @@ def main():
'fault_models'
:
[
int
(
i
)
for
i
in
str
(
conf
.
get
(
'DEFAULT'
,
'faultModel'
)).
split
(
','
)],
'max_time'
:
float
(
kernel_info_dict
[
'max_time'
])
*
float
(
conf
.
get
(
'DEFAULT'
,
'maxWaitTimes'
)),
'end_time'
:
float
(
kernel_info_dict
[
'max_time_kernel'
]),
'max_regs'
:
int
(
kernel_info_dict
[
'max_regs'
]),
'iterations'
:
each_thread_iterations
,
'benchmark_binary'
:
benchmark_binary
,
'benchmark_args'
:
conf
.
get
(
'DEFAULT'
,
'benchmarkArgs'
),
...
...
@@ -728,7 +730,7 @@ def main():
cf
.
printf
(
"Fault injection finished, results can be found in {}"
.
format
(
csv_file
))
########################################################################
return
re
s
return
re
t
########################################################################
# Main #
########################################################################
...
...
flip_value.py
View file @
cc607270
...
...
@@ -74,7 +74,7 @@ def main():
# Get variables values from environment
# Firsn parse line
[
kernel
,
pid
,
bits_to_flip
,
fault_model
,
flip_log_file
,
[
kernel
,
pid
,
max_regs
,
bits_to_flip
,
fault_model
,
flip_log_file
,
gdb_init_strings
,
injection_site
]
=
arg0
.
split
(
'|'
)
# Logging
...
...
@@ -91,7 +91,7 @@ def main():
# Set Breakpoint attributes to be use
bits_to_flip
=
[
i
for
i
in
bits_to_flip
.
split
(
","
)]
fault_model
=
int
(
fault_model
)
bit_flip
=
BitFlip
(
bits_to_flip
=
bits_to_flip
,
fault_model
=
fault_model
,
bit_flip
=
BitFlip
(
bits_to_flip
=
bits_to_flip
,
fault_model
=
fault_model
,
max_regs
=
max_regs
,
logging
=
global_logging
,
injection_site
=
cp
.
INJECTION_SITES
[
injection_site
])
# Start app execution
...
...
prueba.py
View file @
cc607270
import
os
import
re
import
gdb
import
time
import
common_functions
as
cf
def
exit_handler
(
event
):
global
nosalir
nosalir
=
False
...
...
@@ -18,8 +20,42 @@ Handler that will put a breakpoint on the kernel after
signal
"""
def
selectrd
():
linea
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"x/1i $pc"
)
print
(
linea
)
#+"-"+str(len(linea))+"-"+linea[0])
print
(
"============"
)
lista
=
re
.
findall
(
r
"R(\d+)"
,
linea
[
0
])
#Si no hay nexti
listareg
=
[
" R{} "
.
format
(
x
)
for
x
in
lista
]
strlistareg
=
"info registers "
for
x
in
listareg
:
strlistareg
+=
x
;
print
(
strlistareg
)
valores
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
strlistareg
)
print
(
"===========VALORES=========="
)
regs
=
{}
for
x
in
valores
:
print
(
x
)
m
=
re
.
match
(
r
".*R(\d+).*0x([0-9a-fA-F]+).*"
,
x
)
if
m
:
regs
[
m
.
group
(
1
)]
=
m
.
group
(
2
)
print
(
str
(
m
.
group
(
0
))
+
" "
+
str
(
m
.
group
(
1
)))
#Loop----
gdb
.
execute
(
"nexti"
)
linea
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"x/1i $pc"
)
valores
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
strlistareg
)
regdst
=
{}
for
x
in
valores
:
print
(
x
)
m
=
re
.
match
(
r
".*R(\d+).*0x([0-9a-fA-F]+).*"
,
x
)
if
m
:
if
(
regs
[
m
.
group
(
1
)]
!=
m
.
group
(
2
))
regdst
.
add
(
m
.
group
(
1
))
print
(
type
(
lista
))
print
(
lista
)
def
set_event
(
event
):
global
trun
,
ocurrencias
,
t
if
(
isinstance
(
event
,
gdb
.
BreakpointEvent
)):
...
...
@@ -47,10 +83,16 @@ def main():
# Connecting to a stop signal event
gdb
.
events
.
stop
.
connect
(
set_event
)
gdb
.
execute
(
"file ~/rodinia_3.1/cuda/lud/cuda/lud_cuda"
)
gdb
.
execute
(
"set arg -s 10000"
)
gdb
.
execute
(
"break lud_cuda"
)
#gdb.execute("file ~/rodinia_3.1/cuda/lud/cuda/lud_cuda")
#gdb.execute("set arg -s 10000")
#gdb.execute("break lud_cuda")
gdb
.
execute
(
"file codes/mmElem/matrixMul"
)
gdb
.
execute
(
"set arg -wA=16384 -hA=16384 -hB=16384 -wB=16384"
)
gdb
.
execute
(
"set cuda break_on_launch application"
)
gdb
.
execute
(
'r'
)
selectrd
()
nosalir
=
True
while
nosalir
:
gdb
.
execute
(
"finish"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment