Skip to content
Snippets Groups Projects
Commit d1fde5db authored by Henrik Tjäder's avatar Henrik Tjäder
Browse files

Started rewrite/cleanup of klee_stm_gdb

parent a763f7ac
No related branches found
No related tags found
No related merge requests found
...@@ -116,23 +116,29 @@ class MainBP(gdb.Breakpoint): ...@@ -116,23 +116,29 @@ class MainBP(gdb.Breakpoint):
global enable_output global enable_output
print("Breakpoint location: %s" % self.location) print("Breakpoint location: %s" % self.location)
if self.location == "main":
if not init_done: if self.location == "idle":
# gdb.prompt_hook = prompt
init_done = 1
gdb.post_event(posted_event_init)
else:
gdb.post_event(gather_data)
elif self.location == "idle":
print("Reached IDLE") print("Reached IDLE")
enable_output = 1 """
When reaching idle() it means all the stubs
has been executed and finished.
Enable output measurements and then proceed calling the
tasks
"""
"""
Prepare the cycle counter
"""
gdb_cyccnt_enable()
gdb_cyccnt_reset() gdb_cyccnt_reset()
enable_output = 1
gdb.prompt_hook = prompt gdb.prompt_hook = prompt
return True return True
""" Needed to actually stop after the breakpoint """
Needed to actually stop after the breakpoint
True: Return prompt True: Return prompt
False: Continue? False: Continue?
""" """
...@@ -144,6 +150,12 @@ class MainBP(gdb.Breakpoint): ...@@ -144,6 +150,12 @@ class MainBP(gdb.Breakpoint):
def stop_event(evt): def stop_event(evt):
# print("#### stop event") # print("#### stop event")
# print("evt %r" % evt) # print("evt %r" % evt)
"""
Every time a breakpoint is hit this function is executed
The MainBP class will also be executed
"""
global outputdata global outputdata
global task_name global task_name
...@@ -240,7 +252,7 @@ def posted_event_init(): ...@@ -240,7 +252,7 @@ def posted_event_init():
""" """
gdb.events.stop.connect(stop_event) gdb.events.stop.connect(stop_event)
# print("Entering posted_event_init") print("Entering posted_event_init")
global init_done global init_done
global tasks global tasks
...@@ -265,10 +277,6 @@ def posted_event_init(): ...@@ -265,10 +277,6 @@ def posted_event_init():
# gdb.post_event(gather_data) # gdb.post_event(gather_data)
return return
"""
Prepare the cycle counter
"""
gdb_cyccnt_enable()
gdb_cyccnt_reset() gdb_cyccnt_reset()
# print("Tasks: ", tasks) # print("Tasks: ", tasks)
...@@ -299,6 +307,9 @@ def gather_data(): ...@@ -299,6 +307,9 @@ def gather_data():
global file_list global file_list
global init_done global init_done
"""
If not all ktest-files done yet, proceed
"""
if file_index_current < len(file_list): if file_index_current < len(file_list):
init_done = 0 init_done = 0
file_index_current += 1 file_index_current += 1
...@@ -583,8 +594,8 @@ gdb.execute("load %s" % (stm_out_folder + example_name)) ...@@ -583,8 +594,8 @@ gdb.execute("load %s" % (stm_out_folder + example_name))
""" Break at main to set variable values """ """ Break at main to set variable values """
# AddBreakpoint("main") # AddBreakpoint("main")
MainBP("main") # MainBP("main")
MainBP("init") # MainBP("init")
""" Tell gdb-dashboard to hide """ """ Tell gdb-dashboard to hide """
...@@ -593,7 +604,6 @@ MainBP("init") ...@@ -593,7 +604,6 @@ MainBP("init")
""" Also break at the idle-loop """ """ Also break at the idle-loop """
MainBP("idle") MainBP("idle")
# MainBP("terminate_execution")
""" Save all ktest files into an array """ """ Save all ktest files into an array """
file_list = ktest_iterate() file_list = ktest_iterate()
...@@ -605,5 +615,10 @@ print("Available tasks:") ...@@ -605,5 +615,10 @@ print("Available tasks:")
for t in tasks: for t in tasks:
print(t) print(t)
"""
Subscribe stop_event to Breakpoint notifications
"""
gdb.events.stop.connect(stop_event)
""" Run until the next breakpoint """ """ Run until the next breakpoint """
gdb.execute("c") gdb.execute("c")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment