Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-rtfm-klee
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KLEE
cortex-m-rtfm-klee
Commits
7cb1118d
Commit
7cb1118d
authored
7 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
now on optimized
parent
c7529369
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gdb.py
+64
-45
64 additions, 45 deletions
gdb.py
with
64 additions
and
45 deletions
gdb.py
+
64
−
45
View file @
7cb1118d
...
...
@@ -16,7 +16,8 @@ autobuild = True
debug_file
=
"
resource
"
klee_out_folder
=
'
target/x86_64-unknown-linux-gnu/debug/examples/
'
#klee_out_folder = 'target/x86_64-unknown-linux-gnu/debug/examples/'
klee_out_folder
=
'
target/x86_64-unknown-linux-gnu/release/examples/
'
stm_out_folder
=
'
target/thumbv7em-none-eabihf/release/examples/
'
file_list
=
[]
...
...
@@ -32,7 +33,7 @@ file_name = ""
priority
=
0
first
=
True
# [[ Test, Task, Cyccnt, priority/ceiling]
Info
]
# [[ Test, Task, Cyccnt, priority/ceiling]]
outputdata
=
[]
"""
Max number of events guard
"""
...
...
@@ -132,23 +133,23 @@ def stop_event(evt):
global
priority
global
file_name
print
(
"
#### stop event {}
"
.
format
(
file_name
))
print
(
"
evt %r
"
%
evt
)
if
debug
:
print
(
"
Debug: stop event in file {}
"
.
format
(
file_name
))
print
(
"
Debug: evt %r
"
%
evt
)
imm
=
gdb_bkpt_read
()
print
(
"
imm = {}
"
.
format
(
imm
))
if
imm
==
0
:
print
(
"
-- o
rdinary breakpoint, exiting
--
"
)
print
(
"
O
rdinary breakpoint, exiting
!
"
)
sys
.
exit
(
1
)
elif
imm
==
1
or
imm
==
2
:
try
:
ceiling
=
int
(
gdb
.
parse_and_eval
(
"
ceiling
"
).
cast
(
gdb
.
lookup_type
(
'
u8
'
)))
except
:
print
(
"
No ceiling found, exciting
"
)
print
(
"
No ceiling found, exciting
!
"
)
sys
.
exit
(
1
)
if
imm
==
1
:
...
...
@@ -156,23 +157,29 @@ def stop_event(evt):
elif
imm
==
2
:
action
=
"
Exit
"
print
(
"
>>>>>>>>>>>>> Action {}
"
.
format
(
action
))
if
debug
:
print
(
"
Debug: Append action {} at cycle {}
"
.
format
(
action
,
gdb_cyccnt_read
()))
outputdata
.
append
(
[
file_name
,
task_name
,
gdb_cyccnt_read
(),
ceiling
,
action
])
gdb
.
post_event
(
Executor
(
"
continue
"
))
elif
imm
==
3
:
print
(
"
------------- Finished {}
"
.
format
(
gdb_cyccnt_read
()))
if
debug
:
print
(
"
Debug: found finish bkpt_3 at cycle {}
"
.
format
(
gdb_cyccnt_read
()))
gdb
.
post_event
(
Executor
(
"
si
"
))
print
(
"
------------- Finished posting events
"
)
elif
imm
==
4
:
print
(
"
----------- Handle bkpt_4 ----------
"
)
if
debug
:
print
(
"
Debug: found finish bkpt_4 at cycle {}
"
.
format
(
gdb_cyccnt_read
()))
gdb
.
post_event
(
posted_event_init
)
else
:
print
(
"
#### error not bkpt instr ####
"
)
print
(
"
Unexpected stop event, exiting
"
)
sys
.
exit
(
1
)
...
...
@@ -180,10 +187,9 @@ def stop_event(evt):
def
posted_event_init
():
if
debug
:
print
(
"
\n
Debug: Entering posted_event_init
"
)
print
(
"
\n\n\n
Entering posted_event_init
"
)
global
init_done
global
tasks
global
task_name
global
file_name
...
...
@@ -194,22 +200,34 @@ def posted_event_init():
global
priorities
if
file_index_current
<
0
:
print
(
"
Skipped execution to first bkpt_3
"
)
if
debug
:
print
(
"
Debug: Skipped first measurement
"
)
else
:
if
debug
:
print
(
"
Debug: Append Finish action at cycle {}
"
.
format
(
gdb_cyccnt_read
()))
outputdata
.
append
(
[
file_name
,
task_name
,
gdb_cyccnt_read
(),
priority
,
"
Finish
"
])
if
file_index_current
<
len
(
file_list
)
-
1
:
"""
loop to skip to next task *omitting the dummy*
"""
while
True
:
file_index_current
+=
1
# print("Current file: %s" % file_list[file_index_current])
if
file_index_current
==
len
(
file_list
):
"""
finished
"""
break
"""
Load the variable data
"""
task_to_test
=
ktest_setdata
(
file_index_current
)
if
0
<=
task_to_test
<
len
(
tasks
):
"""
next
"""
break
print
(
"
Task task_to_test {}
"
.
format
(
task_to_test
))
if
file_index_current
<
len
(
file_list
):
"""
Load the variable data
"""
if
debug
:
print
(
"
Debug: Task number to test {}
"
.
format
(
task_to_test
))
if
0
<=
task_to_test
<
len
(
tasks
):
print
(
"
!!!!!!!!!!!!!!!!!
"
)
"""
Before the call to the next task, reset the cycle counter
"""
...
...
@@ -226,11 +244,9 @@ def posted_event_init():
tasks
[
task_to_test
]
+
"
()
"
))
gdb
.
execute
(
'
call %s
'
%
"
stub_
"
+
tasks
[
task_to_test
]
+
"
()
"
)
else
:
print
(
"
-- dummy task ---------------------------------------------
"
)
posted_event_init
()
else
:
"""
here we are done, call your analysis here
"""
offset
=
1
print
(
"
\n
Finished all ktest files!
\n
"
)
print
(
"
Claims:
"
)
...
...
@@ -479,7 +495,8 @@ def gdb_bkpt_read():
try
:
return
int
(
gdb
.
execute
(
"
x/i $pc
"
,
False
,
True
).
split
(
"
bkpt
"
)[
1
].
strip
(
"
\t
"
).
strip
(
"
\n
"
),
0
)
except
:
print
(
"
##### error parsing bkpt ######
"
)
if
debug
:
print
(
"
Debug: It is not a bkpt so return 4
"
)
return
4
...
...
@@ -539,11 +556,13 @@ gdb_cyccnt_reset()
"""
Save all ktest files into an array
"""
file_list
=
ktest_iterate
()
print
(
file_list
)
"""
Get all the tasks to jump to
"""
task_list
=
tasklist_get
()
print
(
"
task_list {}
"
.
format
(
task_list
))
if
debug
:
print
(
"
Debug: file_list {}
"
.
format
(
file_list
))
print
(
"
Debug: task_list {}
"
.
format
(
task_list
))
"""
Split into tasks and priorities
"""
for
x
in
task_list
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment