17""" Extended prompt library functions."""
24 "The current working directory."
29 """Internal worker for fetching GDB attributes."""
35 return "<no %s>" % what
36 if hasattr(obj, attr):
37 result = getattr(obj, attr)
42 return "<no attribute %s on current %s>" % (attr, what)
46 "The selected frame; an argument names a frame parameter."
51 "The selected thread; an argument names a thread parameter."
81 "A parameter's value; the argument names the parameter."
82 return gdb.parameter(attr)
86 "Begins a sequence of non-printing characters."
91 "Ends a sequence of non-printing characters."
95prompt_substitutions = {
100 "v": _prompt_version,
105 "[": _prompt_noprint_begin,
106 "]": _prompt_noprint_end,
111 """Generate help dynamically from the __doc__ strings of attribute
115 keys = sorted(prompt_substitutions.keys())
117 result +=
" \\%s\t%s\n" % (key, prompt_substitutions[key].__doc__)
119A substitution can be used in a simple form, like "\\f".
120An argument can also be passed to it, like "\\f{name}".
121The meaning of the argument depends on the particular substitution."""
126 "Perform substitutions on PROMPT."
132 if prompt[i] ==
"\\":
138 if cmdch
in prompt_substitutions:
139 cmd = prompt_substitutions[cmdch]
141 if i + 1 < plen
and prompt[i + 1] ==
"{":
143 while j < plen
and prompt[j] !=
"}":
146 if j >= plen
or prompt[j] !=
"}":
149 arg = prompt[i + 2 : j]
153 result += str(cmd(arg))
_prompt_object_attr(func, what, attr, nattr)
substitute_prompt(prompt)
_prompt_noprint_end(attr)
_prompt_noprint_begin(attr)
void(* func)(remote_target *remote, char *)