17 """ Extended prompt library functions.""" 23 "The current working directory." 27 """Internal worker for fetching GDB attributes.""" 33 return '<no %s>' % what
34 if hasattr(obj, attr):
35 result = getattr(obj, attr)
40 return '<no attribute %s on current %s>' % (attr, what)
43 "The selected frame; an argument names a frame parameter." 47 "The selected thread; an argument names a thread parameter." 71 "A parameter's value; the argument names the parameter." 72 return gdb.parameter(attr)
75 "Begins a sequence of non-printing characters." 79 "Ends a sequence of non-printing characters." 82 prompt_substitutions = {
92 '[': _prompt_noprint_begin,
93 ']': _prompt_noprint_end
97 """Generate help dynamically from the __doc__ strings of attribute 101 keys = sorted (prompt_substitutions.keys())
103 result +=
' \\%s\t%s\n' % (key, prompt_substitutions[key].__doc__)
105 A substitution can be used in a simple form, like "\\f". 106 An argument can also be passed to it, like "\\f{name}". 107 The meaning of the argument depends on the particular substitution.""" 111 "Perform substitutions on PROMPT." 117 if prompt[i] ==
'\\':
123 if cmdch
in prompt_substitutions:
124 cmd = prompt_substitutions[cmdch]
126 if i + 1 < plen
and prompt[i + 1] ==
'{':
128 while j < plen
and prompt[j] !=
'}':
131 if j >= plen
or prompt[j] !=
'}':
134 arg = prompt[i + 2 : j]
138 result += str(cmd(arg))
def _prompt_noprint_begin(attr)
def _prompt_noprint_end(attr)
def _prompt_version(attr)
def _prompt_object_attr(func, what, attr, nattr)
def substitute_prompt(prompt)