diff --git a/lab-data/debugging/nfsroot/root/gdb/linked_list.py b/lab-data/debugging/nfsroot/root/gdb/linked_list.py index f0ba5d7659..24db18d949 100644 --- a/lab-data/debugging/nfsroot/root/gdb/linked_list.py +++ b/lab-data/debugging/nfsroot/root/gdb/linked_list.py @@ -1,38 +1,42 @@ import gdb + class StructNamePrinter: - "Print a struct name" + "Print a struct name" + + def __init__(self, val): + self.val = val - def __init__(self, val): - self.val = val + def to_string(self): + return "TODO" - def to_string(self): - return "TODO" def struct_name_lookup_function(val): - if str(val.type) == 'struct name': - return StructNamePrinter(val) + if str(val.type) == 'struct name': + return StructNamePrinter(val) + + return None - return None gdb.pretty_printers.append(struct_name_lookup_function) + class PrintSList (gdb.Command): - def __init__(self): - super(PrintSList, self).__init__("printslist", gdb.COMMAND_USER) + def __init__(self): + super(PrintSList, self).__init__("printslist", gdb.COMMAND_USER) - def invoke(self, arg, from_tty): - args = gdb.string_to_argv(arg) - if len(args) < 2: - print("Usage: printslist ") - return + def invoke(self, arg, from_tty): + args = gdb.string_to_argv(arg) + if len(args) < 2: + print("Usage: printslist ") + return - list = gdb.parse_and_eval(args[0]) - next_field = args[1] - elem = list['slh_first'] - while elem != 0: - print(elem.dereference()) - elem = TODO + list = gdb.parse_and_eval(args[0]) + next_field = args[1] + elem = list['slh_first'] + while elem != 0: + print(elem.dereference()) + elem = TODO -PrintSList() \ No newline at end of file +PrintSList()