23 return re.compile(exp)
25 raise SyntaxError(
"Invalid %s regexp: %s." % (idstring, exp))
29 """Internal utility to parse unwinder command argv.
32 arg: The arguments to the command. The format is:
33 [locus-regexp [name-regexp]]
36 A 2-tuple of compiled regular expressions.
39 SyntaxError: an error processing ARG
42 argv = gdb.string_to_argv(arg)
45 raise SyntaxError(
"Too many arguments.")
49 locus_regexp = argv[0]
57 """GDB command to list unwinders.
59 Usage: info unwinder [locus-regexp [name-regexp]]
61 LOCUS-REGEXP is a regular expression matching the location of the
62 unwinder. If it is omitted, all registered unwinders from all
63 loci are listed. A locus can be 'global', 'progspace' to list
64 the unwinders from the current progspace, or a regular expression
65 matching filenames of objfiles.
67 NAME-REGEXP is a regular expression to filter unwinder names. If
68 this omitted for a specified locus, then all registered unwinders
69 in the locus are listed.
73 super(InfoUnwinder, self).
__init__(
"info unwinder",
77 """Lists the unwinders whose name matches regexp.
80 title: The line to print before the list.
81 unwinders: The list of the unwinders.
82 name_re: unwinder name filter.
87 for unwinder
in unwinders:
88 if name_re.match(unwinder.name):
89 print(
" %s%s" % (unwinder.name,
90 "" if unwinder.enabled
else " [disabled]"))
94 if locus_re.match(
"global"):
97 if locus_re.match(
"progspace"):
98 cp = gdb.current_progspace()
100 cp.frame_unwinders, name_re)
101 for objfile
in gdb.objfiles():
102 if locus_re.match(objfile.filename):
104 objfile.frame_unwinders, name_re)
108 """Enable/disable unwinders whose names match given regex.
111 unwinders: The list of unwinders.
112 name_re: Unwinder name filter.
113 flag: Enable/disable.
116 The number of unwinders affected.
119 for unwinder
in unwinders:
120 if name_re.match(unwinder.name):
121 unwinder.enabled = flag
127 """Enable/disable unwinder(s)."""
130 if locus_re.match(
"global"):
132 if locus_re.match(
"progspace"):
135 for objfile
in gdb.objfiles():
136 if locus_re.match(objfile.filename):
139 print(
"%d unwinder%s %s" % (total,
"" if total == 1
else "s",
140 "enabled" if flag
else "disabled"))
144 """GDB command to enable unwinders.
146 Usage: enable unwinder [locus-regexp [name-regexp]]
148 LOCUS-REGEXP is a regular expression specifying the unwinders to
149 enable. It can 'global', 'progspace', or the name of an objfile
150 within that progspace.
152 NAME_REGEXP is a regular expression to filter unwinder names. If
153 this omitted for a specified locus, then all registered unwinders
154 in the locus are affected.
159 super(EnableUnwinder, self).
__init__(
"enable unwinder",
163 """GDB calls this to perform the command."""
168 """GDB command to disable the specified unwinder.
170 Usage: disable unwinder [locus-regexp [name-regexp]]
172 LOCUS-REGEXP is a regular expression specifying the unwinders to
173 disable. It can 'global', 'progspace', or the name of an objfile
174 within that progspace.
176 NAME_REGEXP is a regular expression to filter unwinder names. If
177 this omitted for a specified locus, then all registered unwinders
178 in the locus are affected.
183 super(DisableUnwinder, self).
__init__(
"disable unwinder",
187 """GDB calls this to perform the command."""
192 """Installs the unwinder commands."""
def invoke(self, arg, from_tty)
def validate_regexp(exp, idstring)
def invoke(self, arg, from_tty)
def do_enable_unwinder(arg, flag)
def parse_unwinder_command_args(arg)
def invoke(self, arg, from_tty)
def list_unwinders(self, title, unwinders, name_re)
def register_unwinder_commands()
def do_enable_unwinder1(unwinders, name_re, flag)
const ULONGEST const LONGEST len