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]
59 """GDB command to list unwinders.
61 Usage: info unwinder [LOCUS-REGEXP [NAME-REGEXP]]
63 LOCUS-REGEXP is a regular expression matching the location of the
64 unwinder. If it is omitted, all registered unwinders from all
65 loci are listed. A locus can be 'global', 'progspace' to list
66 the unwinders from the current progspace, or a regular expression
67 matching filenames of objfiles.
69 NAME-REGEXP is a regular expression to filter unwinder names. If
70 this omitted for a specified locus, then all registered unwinders
71 in the locus are listed."""
74 super(InfoUnwinder, self).
__init__(
"info unwinder", gdb.COMMAND_STACK)
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):
91 % (unwinder.name,
"" if unwinder.enabled
else " [disabled]")
96 if locus_re.match(
"global"):
98 if locus_re.match(
"progspace"):
101 "Progspace %s:" % cp.filename, cp.frame_unwinders, name_re
104 if locus_re.match(objfile.filename):
106 "Objfile %s:" % objfile.filename, objfile.frame_unwinders, name_re
111 """Enable/disable unwinders whose names match given regex.
114 unwinders: The list of unwinders.
115 name_re: Unwinder name filter.
116 flag: Enable/disable.
119 The number of unwinders affected.
122 for unwinder
in unwinders:
123 if name_re.match(unwinder.name):
124 unwinder.enabled = flag
130 """Enable/disable unwinder(s)."""
133 if locus_re.match(
"global"):
135 if locus_re.match(
"progspace"):
140 if locus_re.match(objfile.filename):
143 gdb.invalidate_cached_frames()
146 % (total,
"" if total == 1
else "s",
"enabled" if flag
else "disabled")
151 """GDB command to enable unwinders.
153 Usage: enable unwinder [LOCUS-REGEXP [NAME-REGEXP]]
155 LOCUS-REGEXP is a regular expression specifying the unwinders to
156 enable. It can 'global', 'progspace', or the name of an objfile
157 within that progspace.
159 NAME_REGEXP is a regular expression to filter unwinder names. If
160 this omitted for a specified locus, then all registered unwinders
161 in the locus are affected."""
164 super(EnableUnwinder, self).
__init__(
"enable unwinder", gdb.COMMAND_STACK)
167 """GDB calls this to perform the command."""
172 """GDB command to disable the specified unwinder.
174 Usage: disable unwinder [LOCUS-REGEXP [NAME-REGEXP]]
176 LOCUS-REGEXP is a regular expression specifying the unwinders to
177 disable. It can 'global', 'progspace', or the name of an objfile
178 within that progspace.
180 NAME_REGEXP is a regular expression to filter unwinder names. If
181 this omitted for a specified locus, then all registered unwinders
182 in the locus are affected."""
185 super(DisableUnwinder, self).
__init__(
"disable unwinder", gdb.COMMAND_STACK)
188 """GDB calls this to perform the command."""
193 """Installs the unwinder commands."""
invoke(self, arg, from_tty)
invoke(self, arg, from_tty)
list_unwinders(self, title, unwinders, name_re)
invoke(self, arg, from_tty)
validate_regexp(exp, idstring)
do_enable_unwinder1(unwinders, name_re, flag)
register_unwinder_commands()
parse_unwinder_command_args(arg)
do_enable_unwinder(arg, flag)