54 """Register unwinder in given locus.
56 The unwinder is prepended to the locus's unwinders list. Unwinder
57 name should be unique.
60 locus: Either an objfile, progspace, or None (in which case
61 the unwinder is registered globally).
62 unwinder: An object of a gdb.Unwinder subclass
63 replace: If True, replaces existing unwinder with the same name.
64 Otherwise, raises exception if unwinder with the same
71 RuntimeError: Unwinder name is not unique
72 TypeError: Bad locus type
75 if gdb.parameter(
"verbose"):
76 gdb.write(
"Registering global %s unwinder ...\n" % unwinder.name)
78 elif isinstance(locus, gdb.Objfile)
or isinstance(locus, gdb.Progspace):
79 if gdb.parameter(
"verbose"):
81 "Registering %s unwinder for %s ...\n" % (unwinder.name, locus.filename)
84 raise TypeError(
"locus should be gdb.Objfile or gdb.Progspace or None")
87 for needle
in locus.frame_unwinders:
88 if needle.name == unwinder.name:
90 del locus.frame_unwinders[i]
92 raise RuntimeError(
"Unwinder %s already exists." % unwinder.name)
94 locus.frame_unwinders.insert(0, unwinder)
95 gdb.invalidate_cached_frames()