diff --git a/gdb.py b/gdb.py index b6d90b429254a63064d17697234259edd27b3b21..b97279c8ef6614574d24a32b9b1f34c9dc13d007 100644 --- a/gdb.py +++ b/gdb.py @@ -16,7 +16,7 @@ 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/' @@ -147,7 +147,7 @@ def stop_event(evt): try: ceiling = int(gdb.parse_and_eval( "ceiling").cast(gdb.lookup_type('u8'))) - except: + except gdb.error: print("No ceiling found, exciting!") sys.exit(1) @@ -167,13 +167,15 @@ def stop_event(evt): elif imm == 3: if debug: - print("Debug: found finish bkpt_3 at cycle {}".format(gdb_cyccnt_read())) + print("Debug: found finish bkpt_3 at cycle {}" + .format(gdb_cyccnt_read())) gdb.post_event(Executor("si")) elif imm == 4: if debug: - print("Debug: found finish bkpt_4 at cycle {}".format(gdb_cyccnt_read())) + print("Debug: found finish bkpt_4 at cycle {}" + .format(gdb_cyccnt_read())) gdb.post_event(posted_event_init) @@ -204,7 +206,8 @@ def posted_event_init(): else: if debug: - print("Debug: Append Finish action at cycle {}".format(gdb_cyccnt_read())) + print("Debug: Append Finish action at cycle {}" + .format(gdb_cyccnt_read())) outputdata.append( [file_name, task_name, gdb_cyccnt_read(), priority, "Finish"]) @@ -411,7 +414,8 @@ def tasklist_get(): for line in fin: # print(line) if not line == "// autogenerated file\n": - return [x.strip().strip("[]\"").split(' ') for x in line.split(',')] + return [x.strip().strip("[]\"").split(' ') + for x in line.split(',')] """ Run xargo for building """ @@ -420,8 +424,9 @@ def tasklist_get(): def xargo_run(mode): if "klee" in mode: - xargo_cmd = ("xargo build --release --example " + example_name + " --features " + - "klee_mode --target x86_64-unknown-linux-gnu ") + xargo_cmd = ("xargo build --release --example " + example_name + + " --features " + + "klee_mode --target x86_64-unknown-linux-gnu ") elif "stm" in mode: xargo_cmd = ("xargo build --release --example " + example_name + " --features " + @@ -447,7 +452,8 @@ def klee_run(): bc_file = (glob.glob(PWD + "/" + klee_out_folder + - '*.bc', recursive=False))[-1].split('/')[-1].strip('\'') + '*.bc', recursive=False))[-1].split('/')[-1].strip( + '\'') if debug: print(PWD + "/" + klee_out_folder) print(bc_file) @@ -493,8 +499,9 @@ def gdb_cyccnt_write(num): def gdb_bkpt_read(): # Read imm field of the current bkpt try: - return int(gdb.execute("x/i $pc", False, True).split("bkpt")[1].strip("\t").strip("\n"), 0) - except: + return int(gdb.execute("x/i $pc", False, True). + split("bkpt")[1].strip("\t").strip("\n"), 0) + except gdb.error: if debug: print("Debug: It is not a bkpt so return 4") return 4 @@ -581,9 +588,9 @@ for t in priorities: """ Subscribe stop_event_ignore to Breakpoint notifications """ gdb.events.stop.connect(stop_event) -""" - continue until bkpt 3, - this will pick the next task (through a posted_event_init event) +""" + continue until bkpt 3, + this will pick the next task (through a posted_event_init event) """ gdb.execute("continue") @@ -631,7 +638,7 @@ gdb.execute("continue") # -'2' the threshold (ceiling 2) of X # -'Enter' the 'Enter' event # -# after 19 cycles we clam Y, raising treshold to 3 +# after 19 cycles we clam Y, raising threshold to 3 # after 28 cycles we exit the Y claim, threshold 3 *before unlock Y* # after 29 cycles we exit the X claim, threshold 2 *before unlock X* # and finally we finish at 36 clock cycles @@ -651,7 +658,7 @@ gdb.execute("continue") # interarrival = [100, 30, 40] # should match the arrival time of EXTI1, EXTI2, and EXTI3 respectively # you may need to change the order depending or your klee/tasks.txt file -# (in the future interrarrival and deadlines will be in the RTFM model, +# (in the future interarrival and deadlines will be in the RTFM model, # but for now we introduce them by hand) # # Implement function that takes output data and computes the CPU demand @@ -670,10 +677,10 @@ gdb.execute("continue") # Looking up the WCETs from the `output_data`. # (It may be a good idea to make first pass and extract wcet per task) ## -# The total utililization bound allows us to discard task sets that are obviously illegal.debug -# (not the case here though) +# The total utilisation bound allows us to discard task sets that are +# obviously illegal.debug (not the case here though) # -# Assignment3. +# Assignment 3. # # Under SRP response time can be computed by equation 7.22 from # https://doc.lagout.org/science/0_Computer%20Science/2_Algorithms/Hard%20Real-Time%20Computing%20Systems_%20Predictable%20Scheduling%20Algorithms%20and%20Applications%20%283rd%20ed.%29%20%5BButtazzo%202011-09-15%5D.pdf @@ -681,27 +688,31 @@ gdb.execute("continue") # In general the response time is computed as. # Ri = Ci + Bi + Ii # Ci the WCET of task i -# Bi the blockng time task i is exposed to +# Bi the blocking time task i is exposed to # Ii the interference (preemptions) task is exposed to # # where # Pi the priority of task i -# Ai the interrarval of task i +# Ai the interarrival of task i # -# We assign deadline = interrarival and priorties inverse to deadline +# We assign deadline = interarrival and priorities inverse to deadline # (rate monotonic assignment, with fixed/static priorities) # -# Lets start by looking at EXTI2 whith the highest priority, so no interference (preemption) +# Lets start by looking at EXTI2 with the highest priority, +# so no interference (preemption) # R_EXTI2 = 11 + B_EXTI2 + 0 # -# In general Bi is the max time of any lower priority task (EXIT1, EXTI3 in our case) -# holds a resource with a ceiling > Pi (ceileng >= 3 in this case) +# In general Bi is the max time of any lower priority task +# (EXTI1, EXTI3 in our case) +# holds a resource with a ceiling > Pi (ceiling >= 3 in this case) # B_EXTI2 = 10 (EXTI1 holding Y for 10 cycles) # -# Notice 1, single blocking, we can only be blocked ONCE, so bound priority inversion +# Notice 1, single blocking, we can only be blocked ONCE, +# so bound priority inversion # -# Notice 2, `output_data` does not hold info on WHAT exect resource is held -# (merely each 'claim time at a specific ceiling'). However this is sufficient for the analysis. +# Notice 2, `output_data` does not hold info on WHAT exact resource is held +# (merely each 'claim time at a specific ceiling'). +# However this is sufficient for the analysis. # # so # R_EXTI2 = 11 + 10 = 21, well below our 30 cycle margin @@ -711,22 +722,24 @@ gdb.execute("continue") # where I_EXTI3 is the interference (preemptions) # # Here we can undertake a simple approach to start out. -# Assume a deadline equal to our interarraval (50) -# I_EXTI3 is the sum of ALL preemptions until its deadlne. +# Assume a deadline equal to our interarrival (50) +# I_EXTI3 is the sum of ALL preemptions until its deadline. # in this case EXTI2 can preempt us 2 times (40/30 *rounded upwards*) # I_EXTI3 = 2 * 11 # -# The worst case blocking time is 15 (caused by the lower prio task EXTI1 holding X) -# R_EXTI3 = 8 + 2 * 11 + 15 = 45, already here we see that EXTI2 may miss its deadline +# The worst case blocking time is 15 +# (caused by the lower prio task EXTI1 holding X) +# R_EXTI3 = 8 + 2 * 11 + 15 = 45, already here we see that +# EXTI2 may miss its deadline # # EXTI1 (our lowest prio task) # R_EXTI1 = C_EXTI1 + B_EXTI1 + I_EXTI1 # # Here we cannot be blocked (as we have the lowest prio) # I_EXTI1 is the sum of preemptions from EXTI2 and EXTI3 -# our deadline = interarravial is 100 -# we are exposed to 100/30 = 4 (rounded upwards) preepmtions by EXTI2 -# and 100/40 = 3 (rounded upwards) preempions by EXTI3 +# our deadline = interarrival is 100 +# we are exposed to 100/30 = 4 (rounded upwards) preemptions by EXTI2 +# and 100/40 = 3 (rounded upwards) preemptions by EXTI3 # # I_EXTI1 = 37 + 4 * 11 + 3 * 8 = 105 # @@ -735,15 +748,15 @@ gdb.execute("continue") # # Assignment 4. # Looking closer at 7.22 we see that its a recurrent equation. -# Ri(0) indicating the inital value +# Ri(0) indicating the initial value # Ri(0) = Ci + Bi # while # Ri(s) = Ci + Bi + sum ..(Ri(s-1)).. # so Ri(1) is computed from Ri(0) and so forth, -# this requires a recursive or looping implmentation. +# this requires a recursive or looping implementation. # # One can see that as initially setting a "busy period" to Ci+Bi -# and compute a new (longer) "busy period" by taking into accout preemptions. +# and compute a new (longer) "busy period" by taking into account preemptions. # # Termination: # Either Ri(s) = Ri(s-1), we have a fixpoint and have the exact response time @@ -754,8 +767,9 @@ gdb.execute("continue") # Notice, we have not dealt with the case where tasks have equal priorities # in theory this is not a problem (no special case needed) # -# However, for exactly analysing the taskset as it would run on the real hardware -# requires some (minor) modifications. *Not part of this assignment* +# However, for exactly analysing the taskset as it would run on the +# real hardware requires some (minor) modifications. +# *Not part of this assignment* # # Examination for full score. # Make a git repo of your solution. (With reasonable comments) @@ -765,14 +779,14 @@ gdb.execute("continue") # Print response times according to Assignment 3 # Print response times according to Assignment 4 # -# It should work with different assignments of the interrarival vector. +# It should work with different assignments of the interarrival vector. # test it also for # [100, 40, 50] # [80, 30, 40] -# (Verify that your resoults are correct by hand computations) +# (Verify that your results are correct by hand computations) # # Grading # For this part 1/3 of the exam 35 points # Assignment 2, 10 points -# Assingment 3, 10 points -# Assingment 4, 15 points +# Assignment 3, 10 points +# Assignment 4, 15 points