GDB (xrefs)

Classes | Macros | Typedefs | Functions | Variables
py-cmd.c File Reference
`#include "defs.h"`
`#include "arch-utils.h"`
`#include "value.h"`
`#include "python-internal.h"`
`#include "charset.h"`
`#include "gdbcmd.h"`
`#include "cli/cli-decode.h"`
`#include "completer.h"`
`#include "language.h"`
`#include "py-ref.h"`

Go to the source code of this file.

## Classes
struct | cmdpy_completer
struct | cmdpy_object

## Macros
#define | N_COMPLETERS (sizeof (completers) / sizeof (completers[0]))

## Typedefs
typedef struct cmdpy_object | cmdpy_object

## Functions
PyTypeObject cmdpy_object_type | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object")
static PyObject * | cmdpy_dont_repeat (PyObject *self, PyObject *args)
static void | cmdpy_destroyer (struct cmd_list_element *self, void *context)
static void | cmdpy_function (struct cmd_list_element *command, const char *args, int from_tty)
static PyObject * | cmdpy_completer_helper (struct cmd_list_element *command, const char *text, const char *word)
static void | cmdpy_completer_handle_brkchars (struct cmd_list_element *command, completion_tracker &tracker, const char *text, const char *word)
static void | cmdpy_completer (struct cmd_list_element *command, completion_tracker &tracker, const char *text, const char *word)
char * | gdbpy_parse_command_name (const char *name, struct cmd_list_element ***base_list, struct cmd_list_element **start_list)
static int | cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
int | gdbpy_initialize_commands (void)
PyObject * | gdbpy_string_to_argv (PyObject *self, PyObject *args)

## Variables
static const struct cmdpy_completer | completers []
static PyObject * | invoke_cst
static PyObject * | complete_cst
static PyMethodDef | cmdpy_object_methods []
PyTypeObject | cmdpy_object_type

## Macro Definition Documentation

## ◆ N_COMPLETERS

#define N_COMPLETERS (sizeof (completers) / sizeof (completers[0]))

Definition at line 51 of file py-cmd.c.

Referenced by cmdpy_completer(), cmdpy_completer_handle_brkchars(), cmdpy_init(), and gdbpy_initialize_commands().

## Typedef Documentation

## ◆ cmdpy_object

typedef struct cmdpy_object cmdpy_object

Definition at line 70 of file py-cmd.c.

## Function Documentation

## ◆ cmdpy_completer()

static void cmdpy_completer | ( | struct cmd_list_element * | command,
|  | completion_tracker & | tracker,
|  | const char * | text,
|  | const char * | word
| ) |  |
| static

Definition at line 322 of file py-cmd.c.

References completion_tracker::add_completion(), cmdpy_completer_helper(), cmdpy_object::command, cmdpy_completer::completer, completers, current_language, gdb_py_int_as_long(), gdbpy_is_string(), gdb::ref_ptr< T, Policy >::get(), get_current_arch(), N_COMPLETERS, and python_string_to_host_string().

## ◆ cmdpy_completer_handle_brkchars()

static void cmdpy_completer_handle_brkchars | ( | struct cmd_list_element * | command,
|  | completion_tracker & | tracker,
|  | const char * | text,
|  | const char * | word
| ) |  |
| static

Definition at line 279 of file py-cmd.c.

References cmdpy_completer_helper(), cmdpy_object::command, completer_handle_brkchars_func_for_completer(), completers, current_language, gdb_py_int_as_long(), gdb::ref_ptr< T, Policy >::get(), get_current_arch(), and N_COMPLETERS.

Referenced by cmdpy_init().

## ◆ cmdpy_completer_helper()

static PyObject* cmdpy_completer_helper | ( | struct cmd_list_element * | command,
|  | const char * | text,
|  | const char * | word
| ) |  |
| static

Definition at line 227 of file py-cmd.c.

References _, cmdpy_object::command, complete_cst, error(), gdb::ref_ptr< T, Policy >::get(), get_cmd_context(), host_charset(), gdb::ref_ptr< T, Policy >::release(), and gdb::ref_ptr< T, Policy >::reset().

Referenced by cmdpy_completer(), and cmdpy_completer_handle_brkchars().

## ◆ cmdpy_destroyer()

static void cmdpy_destroyer | ( | struct cmd_list_element * | self,
|  | void * | context
| ) |  |
| static

Definition at line 94 of file py-cmd.c.

References current_language, get_current_arch(), and xfree().

Referenced by cmdpy_init().

## ◆ cmdpy_dont_repeat()

static PyObject* cmdpy_dont_repeat | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 83 of file py-cmd.c.

References dont_repeat().

## ◆ cmdpy_function()

static void cmdpy_function | ( | struct cmd_list_element * | command,
|  | const char * | args,
|  | int | from_tty
| ) |  |
| static

Definition at line 112 of file py-cmd.c.

References _, cmdpy_object::command, current_language, error(), gdbpy_exception_to_string(), gdbpy_gdberror_exc, gdbpy_print_stack(), gdb::ref_ptr< T, Policy >::get(), get_cmd_context(), get_current_arch(), host_charset(), invoke_cst, and printf_filtered().

Referenced by cmdpy_init().

## ◆ cmdpy_init()

static int cmdpy_init | ( | PyObject * | self,
|  | PyObject * | args,
|  | PyObject * | kw
| ) |  |
| static

Definition at line 495 of file py-cmd.c.

References _, add_cmd(), add_prefix_cmd(), cmd_list_element::allow_unknown, CATCH, class_breakpoint, class_files, class_info, class_maintenance, class_obscure, class_run, class_stack, class_support, class_trace, class_user, class_vars, cmdlist, cmdpy_completer_handle_brkchars(), cmdpy_destroyer(), cmdpy_function(), cmdpy_object::command, cmd_list_element::completer, completers, cmd_list_element::destroyer, END_CATCH, cmd_list_element::func, gdb_PyArg_ParseTupleAndKeywords(), gdbpy_doc_cst, gdbpy_is_string(), gdbpy_parse_command_name(), gdb::ref_ptr< T, Policy >::get(), invoke_cst, N_COMPLETERS, name, no_class, Py_DECREF, python_string_to_host_string(), RETURN_MASK_ALL, RETURN_QUIT, set_cmd_completer(), set_cmd_completer_handle_brkchars(), set_cmd_context(), cmdpy_object::sub_list, TRY, xfree(), and xmalloc().

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject cmdpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "cmdpy_object" |  | ) |

## ◆ gdbpy_initialize_commands()

int gdbpy_initialize_commands | ( | void |  | ) |

Definition at line 650 of file py-cmd.c.

References class_breakpoint, class_files, class_info, class_maintenance, class_obscure, class_run, class_stack, class_support, class_trace, class_user, class_vars, cmdpy_object_type, complete_cst, completers, gdb_module, gdb_pymodule_addobject(), invoke_cst, N_COMPLETERS, name, and no_class.

Referenced by do_start_initialization().

## ◆ gdbpy_parse_command_name()

char* gdbpy_parse_command_name | ( | const char * | name,
|  | struct cmd_list_element *** | base_list,
|  | struct cmd_list_element ** | start_list
| ) |  |

Definition at line 405 of file py-cmd.c.

References _, CMD_LIST_AMBIGUOUS, lookup_cmd_1(), name, cmd_list_element::prefixlist, xfree(), and xmalloc().

Referenced by cmdpy_init(), and parmpy_init().

## ◆ gdbpy_string_to_argv()

PyObject* gdbpy_string_to_argv | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |

Definition at line 760 of file py-cmd.c.

References gdb::ref_ptr< T, Policy >::get(), and gdb::ref_ptr< T, Policy >::release().

## Variable Documentation

## ◆ cmdpy_object_methods

PyMethodDef cmdpy_object_methods[]
| static

Initial value:
=
{
{ "dont_repeat", cmdpy_dont_repeat, METH_NOARGS,
"Prevent command repetition when user enters empty line." },
{ 0 }
}
cmdpy_dont_repeat
static PyObject * cmdpy_dont_repeat(PyObject *self, PyObject *args)
Definition: py-cmd.c:83

Definition at line 701 of file py-cmd.c.

## ◆ cmdpy_object_type

PyTypeObject cmdpy_object_type

Definition at line 709 of file py-cmd.c.

Referenced by gdbpy_initialize_commands().

## ◆ complete_cst

PyObject* complete_cst
| static

Definition at line 77 of file py-cmd.c.

Referenced by cmdpy_completer_helper(), and gdbpy_initialize_commands().

## ◆ completers

const struct cmdpy_completer completers[]
| static

Initial value:
=
{
{ "COMPLETE_NONE", noop_completer },
{ "COMPLETE_FILENAME", filename_completer },
{ "COMPLETE_LOCATION", location_completer },
{ "COMPLETE_COMMAND", command_completer },
{ "COMPLETE_SYMBOL", symbol_completer },
{ "COMPLETE_EXPRESSION", expression_completer },
}
filename_completer
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
Definition: completer.c:152
noop_completer
void noop_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *prefix)
Definition: completer.c:143
command_completer
void command_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
Definition: completer.c:1649
symbol_completer
void symbol_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
Definition: completer.c:1111
location_completer
void location_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *)
Definition: completer.c:828
expression_completer
void expression_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
Definition: completer.c:1076

Definition at line 41 of file py-cmd.c.

Referenced by cmdpy_completer(), cmdpy_completer_handle_brkchars(), cmdpy_init(), and gdbpy_initialize_commands().

## ◆ invoke_cst

PyObject* invoke_cst
| static

Definition at line 76 of file py-cmd.c.

Referenced by cmdpy_function(), cmdpy_init(), and gdbpy_initialize_commands().