GDB (xrefs)
|
#include "defs.h"
#include "arch-utils.h"
#include "command.h"
#include "ui-out.h"
#include "cli/cli-script.h"
#include "gdbcmd.h"
#include "progspace.h"
#include "objfiles.h"
#include "value.h"
#include "language.h"
#include "event-loop.h"
#include "serial.h"
#include "readline/tilde.h"
#include "python.h"
#include "extension-priv.h"
#include "cli/cli-utils.h"
#include <ctype.h>
#include "cli/cli-decode.h"
#include "charset.h"
#include "top.h"
#include "solib.h"
#include "python-internal.h"
#include "linespec.h"
#include "source.h"
#include "version.h"
#include "target.h"
#include "gdbthread.h"
#include "interps.h"
#include "event-top.h"
Go to the source code of this file.
Classes | |
struct | python_env |
struct | gdbpy_event |
Functions | |
static void | gdbpy_finish_initialization (const struct extension_language_defn *) |
static int | gdbpy_initialized (const struct extension_language_defn *) |
static void | gdbpy_eval_from_control_command (const struct extension_language_defn *, struct command_line *cmd) |
static void | gdbpy_start_type_printers (const struct extension_language_defn *, struct ext_lang_type_printers *) |
static enum ext_lang_rc | gdbpy_apply_type_printers (const struct extension_language_defn *, const struct ext_lang_type_printers *, struct type *, char **) |
static void | gdbpy_free_type_printers (const struct extension_language_defn *, struct ext_lang_type_printers *) |
static void | gdbpy_clear_quit_flag (const struct extension_language_defn *) |
static void | gdbpy_set_quit_flag (const struct extension_language_defn *) |
static int | gdbpy_check_quit_flag (const struct extension_language_defn *) |
static enum ext_lang_rc | gdbpy_before_prompt_hook (const struct extension_language_defn *, const char *current_gdb_prompt) |
static void | restore_python_env (void *p) |
struct cleanup * | ensure_python_env (struct gdbarch *gdbarch, const struct language_defn *language) |
static int | eval_python_command (const char *command) |
static void | python_interactive_command (char *arg, int from_tty) |
static void | python_run_simple_file (FILE *file, const char *filename) |
static char * | compute_python_string (struct command_line *l) |
static void | python_command (char *arg, int from_tty) |
PyObject * | gdbpy_parameter_value (enum var_types type, void *var) |
PyObject * | gdbpy_parameter (PyObject *self, PyObject *args) |
static PyObject * | gdbpy_target_charset (PyObject *self, PyObject *args) |
static PyObject * | gdbpy_target_wide_charset (PyObject *self, PyObject *args) |
static PyObject * | execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) |
static PyObject * | gdbpy_solib_name (PyObject *self, PyObject *args) |
static PyObject * | gdbpy_decode_line (PyObject *self, PyObject *args) |
static PyObject * | gdbpy_parse_and_eval (PyObject *self, PyObject *args) |
static PyObject * | gdbpy_find_pc_line (PyObject *self, PyObject *args) |
static void | gdbpy_source_script (const struct extension_language_defn *extlang, FILE *file, const char *filename) |
static void | gdbpy_run_events (struct serial *scb, void *context) |
static PyObject * | gdbpy_post_event (PyObject *self, PyObject *args) |
static int | gdbpy_initialize_events (void) |
static PyObject * | gdbpy_write (PyObject *self, PyObject *args, PyObject *kw) |
static PyObject * | gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw) |
int | gdbpy_print_python_errors_p (void) |
void | gdbpy_print_stack (void) |
static PyObject * | gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) |
static PyObject * | gdbpy_progspaces (PyObject *unused1, PyObject *unused2) |
static void | gdbpy_source_objfile_script (const struct extension_language_defn *extlang, struct objfile *objfile, FILE *file, const char *filename) |
static void | gdbpy_execute_objfile_script (const struct extension_language_defn *extlang, struct objfile *objfile, const char *name, const char *script) |
static PyObject * | gdbpy_get_current_objfile (PyObject *unused1, PyObject *unused2) |
static PyObject * | gdbpy_objfiles (PyObject *unused1, PyObject *unused2) |
static void | user_set_python (char *args, int from_tty) |
static void | user_show_python (char *args, int from_tty) |
static void | finalize_python (void *ignore) |
void | _initialize_python (void) |
void _initialize_python | ( | void | ) |
Definition at line 1629 of file python.c.
References _, add_com(), add_com_alias(), add_prefix_cmd(), add_setshow_enum_cmd(), class_obscure, finalize_python(), gdb_module, gdb_pymodule_addobject(), gdb_python_initialized, gdbpy_children_cst, gdbpy_display_hint_cst, gdbpy_doc_cst, gdbpy_enabled_cst, gdbpy_gdb_error, gdbpy_gdb_memory_error, gdbpy_gdberror_exc, gdbpy_initialize_arch(), gdbpy_initialize_auto_load(), gdbpy_initialize_blocks(), gdbpy_initialize_breakpoint_event(), gdbpy_initialize_breakpoints(), gdbpy_initialize_clear_objfiles_event(), gdbpy_initialize_commands(), gdbpy_initialize_continue_event(), gdbpy_initialize_event(), gdbpy_initialize_eventregistry(), gdbpy_initialize_events(), gdbpy_initialize_exited_event(), gdbpy_initialize_finishbreakpoints(), gdbpy_initialize_frames(), gdbpy_initialize_functions(), gdbpy_initialize_gdb_readline(), gdbpy_initialize_inferior(), gdbpy_initialize_inferior_call_post_event(), gdbpy_initialize_inferior_call_pre_event(), gdbpy_initialize_lazy_string(), gdbpy_initialize_linetable(), gdbpy_initialize_memory_changed_event(), gdbpy_initialize_new_objfile_event(), gdbpy_initialize_objfile(), gdbpy_initialize_parameters(), gdbpy_initialize_pspace(), gdbpy_initialize_py_events(), gdbpy_initialize_register_changed_event(), gdbpy_initialize_signal_event(), gdbpy_initialize_stop_event(), gdbpy_initialize_symbols(), gdbpy_initialize_symtabs(), gdbpy_initialize_thread(), gdbpy_initialize_thread_event(), gdbpy_initialize_types(), gdbpy_initialize_unwind(), gdbpy_initialize_values(), gdbpy_initialize_xmethods(), gdbpy_print_stack(), gdbpy_should_print_stack, gdbpy_to_string_cst, gdbpy_value_cst, HAVE_PYTHON, host_name, ldirname(), make_final_cleanup(), no_class, PyEval_InitThreads, PyEval_ReleaseLock, python_command(), python_excp_enums, python_GdbMethods, python_interactive_command(), python_libdir, PyThreadState_Swap, setlist, showlist, SLASH_STRING, target_name, user_set_python(), user_show_python(), and version.
|
static |
Definition at line 420 of file python.c.
References len, command_line::line, command_line::next, size, and xmalloc().
Referenced by gdbpy_eval_from_control_command().
struct cleanup* ensure_python_env | ( | struct gdbarch * | gdbarch, |
const struct language_defn * | language | ||
) |
Definition at line 247 of file python.c.
References _, error(), python_env::error_traceback, python_env::error_type, python_env::error_value, gdb_python_initialized, python_env::gdbarch, python_env::language, make_cleanup(), python_env::previous_active, PyGILState_Ensure, python_gdbarch, python_language, restore_python_env(), set_active_ext_lang(), python_env::state, and xmalloc().
Referenced by add_thread_object(), bpfinishpy_handle_exit(), bpfinishpy_handle_stop(), cmdpy_completer_handle_brkchars(), cmdpy_destroyer(), cmdpy_function(), delete_thread_object(), fnpy_call(), gdbpy_apply_frame_filter(), gdbpy_apply_type_printers(), gdbpy_apply_val_pretty_printer(), gdbpy_before_prompt_hook(), gdbpy_breakpoint_cond_says_stop(), gdbpy_breakpoint_has_cond(), gdbpy_clone_xmethod_worker_data(), gdbpy_eval_from_control_command(), gdbpy_execute_objfile_script(), gdbpy_finish_initialization(), gdbpy_free_type_printers(), gdbpy_free_xmethod_worker_data(), gdbpy_get_matching_xmethod_workers(), gdbpy_get_xmethod_arg_types(), gdbpy_get_xmethod_result_type(), gdbpy_invoke_xmethod(), gdbpy_run_events(), gdbpy_source_objfile_script(), gdbpy_source_script(), gdbpy_start_type_printers(), get_set_value(), get_show_value(), py_free_inferior(), py_free_objfile(), py_free_pspace(), python_command(), python_inferior_exit(), python_interactive_command(), python_new_objfile(), python_on_inferior_call_post(), python_on_inferior_call_pre(), python_on_memory_change(), python_on_normal_stop(), python_on_register_change(), python_on_resume(), pyuw_sniffer(), save_objfile_types(), varobj_ensure_python_env(), and VEC().
Definition at line 301 of file python.c.
References arm-linux::m, and Py_DECREF.
Referenced by python_interactive_command().
|
static |
Definition at line 624 of file python.c.
References bpstat_do_actions(), CATCH, do_cleanups(), END_CATCH, execute_command(), execute_command_to_string(), GDB_PY_HANDLE_EXCEPTION, interpreter_async, make_cleanup(), make_cleanup_restore_integer(), prevent_dont_repeat(), RETURN_MASK_ALL, TRY, and xfree().
|
static |
Definition at line 1601 of file python.c.
References current_language, PyGILState_Ensure, restore_active_ext_lang(), set_active_ext_lang(), and target_gdbarch().
Referenced by _initialize_python().
|
static |
Definition at line 1454 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), EXT_LANG_RC_ERROR, EXT_LANG_RC_NOP, EXT_LANG_RC_OK, func, gdb_python_initialized, gdbpy_print_stack(), get_current_arch(), ext_lang_type_printers::py_type_printers, PyObject_GetAttrString, python_string_to_host_string(), and type_to_type_object().
|
static |
Definition at line 1030 of file python.c.
References _, current_language, do_cleanups(), ensure_python_env(), EXT_LANG_RC_ERROR, EXT_LANG_RC_NOP, EXT_LANG_RC_OK, gdb_python_initialized, gdb_python_module, gdbpy_print_stack(), get_current_arch(), make_cleanup(), make_cleanup_py_decref(), Py_DECREF, PyObject_GetAttrString, PyObject_HasAttrString, python_string_to_host_string(), set_prompt(), and xfree().
|
static |
|
static |
|
static |
Definition at line 721 of file python.c.
References CATCH, decode_line_1(), do_cleanups(), END_CATCH, error(), exception_none, gdbpy_convert_exception(), get_current_source_symtab_and_line(), make_cleanup(), symtabs_and_lines::nelts, null_cleanup(), Py_DECREF, gdb_exception::reason, RETURN_MASK_ALL, symtabs_and_lines::sals, set_default_source_symtab_and_line(), symtab_and_line_to_sal_object(), TRY, and xfree().
|
static |
Definition at line 448 of file python.c.
References _, command_line::body_count, command_line::body_list, compute_python_string(), current_language, do_cleanups(), ensure_python_env(), error(), get_current_arch(), and xfree().
|
static |
Definition at line 1343 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), gdb_python_initialized, and get_objfile_arch().
|
static |
Definition at line 864 of file python.c.
References CATCH, END_CATCH, find_pc_line(), GDB_PY_HANDLE_EXCEPTION, GDB_PY_LLU_ARG, symtab_and_line::pc, RETURN_MASK_ALL, symtab_and_line_to_sal_object(), and TRY.
|
static |
Definition at line 1882 of file python.c.
References _, current_language, do_cleanups(), ensure_python_env(), err, gdb_datadir, gdb_pymodule_addobject(), gdb_python_module, gdbpy_print_stack(), get_current_arch(), L, arm-linux::m, make_cleanup(), Py_DECREF, SLASH_STRING, warning(), and xfree().
|
static |
Definition at line 1158 of file python.c.
References gdb_flush(), gdb_stderr, gdb_stdlog, and gdb_stdout.
|
static |
Definition at line 1523 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), gdb_python_initialized, get_current_arch(), Py_DECREF, and ext_lang_type_printers::py_type_printers.
|
static |
Definition at line 1364 of file python.c.
References objfile_to_objfile_object().
|
static |
Definition at line 1267 of file python.c.
References current_program_space, and pspace_to_pspace_object().
|
static |
Definition at line 1014 of file python.c.
References gdbpy_event_list, gdbpy_run_events(), serial_async(), and serial_pipe().
Referenced by _initialize_python().
|
static |
Definition at line 1965 of file python.c.
References gdb_python_initialized.
|
static |
Definition at line 1380 of file python.c.
References ALL_OBJFILES, objfile_to_objfile_object(), and Py_DECREF.
PyObject* gdbpy_parameter | ( | PyObject * | self, |
PyObject * | args | ||
) |
Definition at line 566 of file python.c.
References _, CATCH, END_CATCH, exception_none, GDB_PY_HANDLE_EXCEPTION, gdbpy_parameter_value(), lookup_cmd_composition(), cmd_list_element::prefix, RETURN_MASK_ALL, TRY, cmd_list_element::var, cmd_list_element::var_type, and xfree().
PyObject* gdbpy_parameter_value | ( | enum var_types | type, |
void * | var | ||
) |
Definition at line 504 of file python.c.
References _, AUTO_BOOLEAN_FALSE, AUTO_BOOLEAN_TRUE, host_charset(), INT_MAX, UINT_MAX, var_auto_boolean, var_boolean, var_enum, var_filename, var_integer, var_optional_filename, var_string, var_string_noescape, var_uinteger, and var_zinteger.
Referenced by gdbpy_parameter(), and get_attr().
|
static |
Definition at line 839 of file python.c.
References CATCH, END_CATCH, GDB_PY_HANDLE_EXCEPTION, parse_and_eval(), RETURN_MASK_ALL, TRY, and value_to_value_object().
|
static |
Definition at line 972 of file python.c.
References _, gdbpy_event::event, func, gdbpy_event::next, and serial_write().
int gdbpy_print_python_errors_p | ( | void | ) |
Definition at line 1189 of file python.c.
References gdbpy_should_print_stack, and python_excp_none.
Referenced by print_children().
void gdbpy_print_stack | ( | void | ) |
Definition at line 1199 of file python.c.
References _, begin_line(), CATCH, END_CATCH, fprintf_filtered(), gdb_stderr, gdbpy_exception_to_string(), gdbpy_obj_to_string(), gdbpy_should_print_stack, python_excp_full, python_excp_none, RETURN_MASK_ALL, TRY, and xfree().
Referenced by _initialize_python(), add_thread_object(), bpfinishpy_detect_out_scope_cb(), bpfinishpy_out_of_scope(), bpfinishpy_post_stop_hook(), bpfinishpy_pre_stop_hook(), cmdpy_function(), construct_visualizer(), evpy_emit_event(), fnpy_call(), gdbpy_apply_frame_filter(), gdbpy_apply_type_printers(), gdbpy_before_prompt_hook(), gdbpy_breakpoint_cond_says_stop(), gdbpy_breakpoint_created(), gdbpy_finish_initialization(), gdbpy_get_display_hint(), gdbpy_get_matching_xmethod_workers(), gdbpy_get_xmethod_arg_types(), gdbpy_get_xmethod_result_type(), gdbpy_invoke_xmethod(), gdbpy_start_type_printers(), get_doc_string(), get_set_value(), get_show_value(), install_default_visualizer(), print_children(), print_stack_unless_memory_error(), py_varobj_get_iterator(), py_varobj_iter_next(), python_inferior_exit(), python_interactive_command(), python_new_objfile(), python_on_inferior_call_post(), python_on_inferior_call_pre(), python_on_memory_change(), python_on_normal_stop(), python_on_register_change(), python_on_resume(), python_run_simple_file(), pyuw_sniffer(), restore_python_env(), varobj_set_visualizer(), and varobj_value_get_print_value().
|
static |
Definition at line 1280 of file python.c.
References ALL_PSPACES, cleanup_check::ps, pspace_to_pspace_object(), and Py_DECREF.
|
static |
Definition at line 934 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), gdbpy_event::event, gdbpy_event_list, get_current_arch(), gdbpy_event::next, Py_DECREF, serial_readchar(), and xfree().
Referenced by gdbpy_initialize_events().
|
static |
|
static |
Definition at line 697 of file python.c.
References current_program_space, GDB_PY_LL_ARG, host_charset(), and solib_name_from_address().
|
static |
Definition at line 1318 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), gdb_python_initialized, get_objfile_arch(), and python_run_simple_file().
|
static |
Definition at line 897 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), get_current_arch(), and python_run_simple_file().
|
static |
Definition at line 1409 of file python.c.
References current_language, do_cleanups(), ensure_python_env(), func, gdb_python_initialized, gdbpy_print_stack(), get_current_arch(), ext_lang_type_printers::py_type_printers, and PyObject_GetAttrString.
|
static |
Definition at line 604 of file python.c.
References host_charset(), and target_charset().
|
static |
Definition at line 614 of file python.c.
References host_charset(), and target_wide_charset().
|
static |
Definition at line 1116 of file python.c.
References cleanup::arg, CATCH, END_CATCH, fprintf_filtered(), GDB_PY_HANDLE_EXCEPTION, gdb_stderr, gdb_stdlog, gdb_stdout, RETURN_MASK_ALL, and TRY.
|
static |
Definition at line 472 of file python.c.
References _, current_language, do_cleanups(), ensure_python_env(), error(), execute_control_command_untraced(), get_command_line(), get_current_arch(), interpreter_async, make_cleanup_free_command_lines(), make_cleanup_restore_integer(), python_control, and skip_spaces().
Referenced by _initialize_python().
|
static |
Definition at line 328 of file python.c.
References _, current_language, do_cleanups(), dont_repeat(), ensure_python_env(), err, error(), eval_python_command(), gdbpy_print_stack(), get_current_arch(), instream, interpreter_async, len, make_cleanup_restore_integer(), skip_spaces(), xfree(), and xmalloc().
Referenced by _initialize_python().
|
static |
Definition at line 383 of file python.c.
References _, do_cleanups(), error(), gdbpy_print_stack(), make_cleanup(), make_cleanup_py_decref(), and xfree().
Referenced by gdbpy_source_objfile_script(), and gdbpy_source_script().
|
static |
Definition at line 217 of file python.c.
References _, python_env::error_traceback, python_env::error_type, python_env::error_value, python_env::gdbarch, gdbpy_print_stack(), python_env::language, python_env::previous_active, PyGILState_Release, restore_active_ext_lang(), python_env::state, warning(), and xfree().
Referenced by ensure_python_env().
|
static |
Definition at line 1579 of file python.c.
References all_commands, gdb_stdout, and help_list().
Referenced by _initialize_python().
|
static |
Definition at line 1588 of file python.c.
References cmd_show_list().
Referenced by _initialize_python().
initialize_file_ftype _initialize_python |
const struct extension_language_defn extension_language_python |
Definition at line 66 of file python.c.
Referenced by info_auto_load_python_scripts(), and new_python_xmethod_worker().
PyObject* gdb_module |
Definition at line 112 of file python.c.
Referenced by _initialize_python(), gdbpy_initialize_arch(), gdbpy_initialize_blocks(), gdbpy_initialize_breakpoints(), gdbpy_initialize_commands(), gdbpy_initialize_event_generic(), gdbpy_initialize_eventregistry(), gdbpy_initialize_finishbreakpoints(), gdbpy_initialize_frames(), gdbpy_initialize_functions(), gdbpy_initialize_inferior(), gdbpy_initialize_linetable(), gdbpy_initialize_objfile(), gdbpy_initialize_parameters(), gdbpy_initialize_pspace(), gdbpy_initialize_py_events(), gdbpy_initialize_symbols(), gdbpy_initialize_symtabs(), gdbpy_initialize_thread(), gdbpy_initialize_types(), gdbpy_initialize_unwind(), and gdbpy_initialize_values().
int gdb_python_initialized |
Definition at line 104 of file python.c.
Referenced by _initialize_python(), add_thread_object(), delete_thread_object(), dynamic_varobj_has_child_method(), ensure_python_env(), gdbpy_apply_frame_filter(), gdbpy_apply_type_printers(), gdbpy_apply_val_pretty_printer(), gdbpy_before_prompt_hook(), gdbpy_execute_objfile_script(), gdbpy_free_type_printers(), gdbpy_initialized(), gdbpy_source_objfile_script(), gdbpy_start_type_printers(), install_new_value_visualizer(), py_free_inferior(), py_varobj_iter_next(), python_inferior_exit(), python_new_objfile(), python_on_normal_stop(), python_on_resume(), save_objfile_types(), varobj_get_display_hint(), varobj_set_visualizer(), and varobj_value_get_print_value().
PyObject* gdb_python_module |
Definition at line 113 of file python.c.
Referenced by find_pretty_printer_from_gdb(), gdbpy_before_prompt_hook(), gdbpy_finish_initialization(), gdbpy_get_matching_xmethod_workers(), and pyuw_sniffer().
PyObject* gdbpy_children_cst |
Definition at line 117 of file python.c.
Referenced by _initialize_python(), dynamic_varobj_has_child_method(), print_children(), and py_varobj_get_iterator().
PyObject* gdbpy_display_hint_cst |
Definition at line 118 of file python.c.
Referenced by _initialize_python(), and gdbpy_get_display_hint().
PyObject* gdbpy_doc_cst |
Definition at line 119 of file python.c.
Referenced by _initialize_python(), cmdpy_init(), and parmpy_init().
PyObject* gdbpy_enabled_cst |
Definition at line 120 of file python.c.
Referenced by _initialize_python(), and search_pp_list().
|
static |
Definition at line 921 of file python.c.
Referenced by gdbpy_initialize_events(), and gdbpy_run_events().
|
static |
|
static |
PyObject* gdbpy_gdb_error |
Definition at line 127 of file python.c.
Referenced by _initialize_python(), and gdbpy_convert_exception().
PyObject* gdbpy_gdb_memory_error |
Definition at line 130 of file python.c.
Referenced by _initialize_python(), gdbpy_convert_exception(), gdbpy_create_lazy_string_object(), print_stack_unless_memory_error(), py_varobj_iter_next(), and stpy_convert_to_value().
PyObject* gdbpy_gdberror_exc |
Definition at line 124 of file python.c.
Referenced by _initialize_python(), cmdpy_function(), and fnpy_call().
|
static |
Definition at line 56 of file python.c.
Referenced by _initialize_python(), gdbpy_print_python_errors_p(), and gdbpy_print_stack().
|
static |
|
static |
PyObject* gdbpy_to_string_cst |
Definition at line 116 of file python.c.
Referenced by _initialize_python(), pretty_print_one_value(), and varobj_value_get_print_value().
PyObject* gdbpy_value_cst |
Definition at line 121 of file python.c.
Referenced by _initialize_python(), and convert_value_from_python().
Definition at line 44 of file python.c.
Referenced by _initialize_python().
|
static |
Definition at line 40 of file python.c.
Referenced by gdbpy_print_stack().
|
static |
Definition at line 39 of file python.c.
Referenced by gdbpy_print_python_errors_p(), and gdbpy_print_stack().
const struct extension_language_ops python_extension_ops |
const struct extension_language_script_ops python_extension_script_ops |
struct gdbarch* python_gdbarch |
Definition at line 201 of file python.c.
Referenced by add_thread_object(), bpfinishpy_init(), bppy_init(), delete_thread_object(), ensure_python_env(), gdbpy_invoke_xmethod(), mbpy_str(), py_free_inferior(), typy_lookup_typename(), unicode_to_target_python_string(), and unicode_to_target_string().
PyMethodDef python_GdbMethods |
Definition at line 1976 of file python.c.
Referenced by _initialize_python().
const struct language_defn* python_language |
Definition at line 202 of file python.c.
Referenced by add_thread_object(), delete_thread_object(), ensure_python_env(), extract_sym(), gdbpy_invoke_xmethod(), py_free_inferior(), typy_lookup_typename(), and valpy_str().
|
static |
|
static |