Joel Brobecker
b14285f60e
Add support for gdb.PYTHONDIR as $gdb_datadir/python.
...
Python scripts to be used by GDB can be stored in that directory,
and will be automatically found by the interpreter when importing them.
This patch also sets up <gdb_pythondir>/gdb as the directory where gdb
submodules can be stored. For now, there is nothing there, but it can
now be added easily without further code changes.
gdb/ChangeLog:
2010-06-24 Joel Brobecker <brobecker@adacore.com>
* python/python.c (_initialize_python): Add new "constant"
PYTHONDIR in gdb module. Insert this path at the head of
sys.path. Set gdb.__path__ to gdb.PYTHONDIR + '/gdb' and
exec its __init__.py script if it exists in that directory.
2010-06-24 22:52:04 +00:00
Tom Tromey
0e03807e1c
gdb
...
PR gdb/9977, PR exp/11636:
* value.h (value_offset): Update.
(struct lval_funcs) <check_validity>: New field.
<copy_closure>: Make argument const.
(value_computed_closure): Update.
(value_contents_for_printing): Declare.
(value_bits_valid): Likewise.
(val_print): Likewise.
(set_value_component_location): Update.
(value_entirely_optimized_out): Declare.
* value.c (value_offset): Argument now const.
(require_not_optimized_out): New function.
(value_contents_for_printing): New function.
(value_contents_all): Call require_not_optimized_out.
(value_contents): Likewise.
(value_bits_valid): New function.
(value_computed_closure): Argument now const.
(set_value_component_location): Make 'whole' argument const.
(value_entirely_optimized_out): New function.
(value_bitsize): Argument now 'const'.
(value_bitpos): Likewise.
(value_type): Likewise.
* valprint.h (val_print_array_elements): Update.
* valprint.c (val_print): Add 'val' argument. Use
valprint_check_validity.
(valprint_check_validity): New function.
(value_check_printable): Use value_entirely_optimized_out.
(common_val_print): Update.
(value_print): Likewise.
(val_print_array_elements): Add 'val' argument.
* valops.c (value_fetch_lazy): Use value_contents_for_printing,
value_bits_valid. Reinit frame cache for lval_computed.
* sh64-tdep.c (sh64_do_register): Update.
* scm-valprint.c (scm_val_print): Add 'val' argument.
* scm-lang.h (scm_val_print): Update.
* python/python.h (apply_val_pretty_printer): Update.
* python/py-prettyprint.c (apply_val_pretty_printer): Add 'val'
argument. Call set_value_component_location.
* printcmd.c (print_scalar_formatted): Update.
* p-valprint.c (pascal_val_print): Add 'val' argument.
(pascal_object_print_value_fields): Likewise.
(pascal_object_print_value): Likewise.
(pascal_object_print_static_field): Update.
* p-lang.h (pascal_val_print): Update.
(pascal_object_print_value_fields): Update.
* mt-tdep.c (mt_registers_info): Update.
* mi/mi-main.c (get_register): Update.
(mi_cmd_data_evaluate_expression): Use common_val_print.
* m2-valprint.c (m2_print_array_contents): Add 'val' argument.
(m2_print_unbounded_array): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* language.h (struct language_defn) <la_val_print>: Add 'val'
argument.
(LA_VAL_PRINT): Likewise.
* language.c (unk_lang_val_print): Add 'val' argument.
* jv-valprint.c (java_print_value_fields): Add 'val' argument.
(java_val_print): Likewise.
* jv-lang.h (java_val_print): Add 'val' argument.
* infcmd.c (default_print_registers_info): Update.
* f-valprint.c (f77_print_array_1): Add 'val' argument.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Add 'val' argument.
* dwarf2loc.c (read_pieced_value): Use value_bitsize and
value_bitpos.
<DWARF_VALUE_OPTIMIZED_OUT>: Don't print warning. Call
set_value_optimized_out.
(write_pieced_value): Use value_bitsize and value_bitpos.
<default>: Don't exit loop.
(check_pieced_value_validity): New function.
(pieced_value_funcs): Reference check_pieced_value_validity,
check_pieced_value_invalid.
(copy_pieced_value_closure): Update.
(check_pieced_value_bits): New function.
(check_pieced_value_invalid): New function.
* d-valprint.c (dynamic_array_type): Add 'val' argument.
(d_val_print): Likewise.
* d-lang.h (d_val_print): Update.
* cp-valprint.c (cp_print_value_fields): Add 'val' argument.
(cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
(cp_print_static_field): Update.
* c-valprint.c (c_val_print): Add 'val' argument.
(c_value_print): Update.
* c-lang.h (c_val_print): Update.
(cp_print_value_fields): Likewise.
(cp_print_value_fields_rtti): Likewise.
* ada-valprint.c (struct ada_val_print_args): Remove.
(val_print_packed_array_elements): Add 'val' argument.
(ada_val_print): Likewise. Rewrite.
(ada_val_print_stub): Remove.
(ada_val_print_array): Add 'val' argument.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Update.
(print_record): Add 'val' argument.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print): Update.
gdb/testsuite
PR gdb/9977, PR exp/11636::
* gdb.dwarf2/pieces.exp (pieces_test_f3): Remove kfail.
(pieces_test_f6): Update expected output.
2010-06-11 15:36:10 +00:00
Doug Evans
967cf47793
Add support for enabling/disabling individual pretty-printers.
...
* python/py-prettyprint.c (search_pp_list): Skip disabled printers.
* python/python-internal.h (gdbpy_enabled_cst): Declare.
* python/python.c (gdbpy_enabled_cst): Define.
(_initialize_python): Initialize gdbpy_enabled_cst.
* NEWS: Add entry.
doc/
* gdb.texinfo (Python API): New node `Disabling Pretty-Printers'.
testsuite/
* gdb.python/py-prettyprint.exp: Add new test for enabled and
disabled printers.
* gdb.python/py-prettyprint.py (disable_lookup_function): New function.
(enable_lookup_function): New function.
2010-06-04 18:18:28 +00:00
Doug Evans
0c4a40633c
Allow python to find its files if moved from original location.
...
* acinclude.m4 (GDB_AC_DEFINE_RELOCATABLE): New function.
(GDB_AC_WITH_DIR): Call it.
* configure.ac: Define WITH_PYTHON_PATH if we can find the
python installation directory.
* config.in: Regenerate.
* configure: Regenerate.
* defs.h (python_libdir): Declare.
* main.c (python_libdir): Define.
(captured_main): Initialize python_libdir.
* python/python.c (_initialize_python): #ifdef WITH_PYTHON_PATH,
call Py_SetProgramName to make sure python can find its libraries
and modules.
2010-05-27 03:40:45 +00:00
Doug Evans
ec685c5eca
* configure.ac: Try to use python's distutils to fetch compilation
...
parameters.
* configure: Regenerate.
* python/python-config.py: New file.
2010-05-27 01:36:22 +00:00
Doug Evans
07ca107c2d
Add python gdb.GdbError and gdb.string_to_argv.
...
* NEWS: Document them.
* python/py-cmd.c (cmdpy_function): Don't print a traceback if
the exception is gdb.GdbError. Print a second traceback if there's
an error computing the error message.
(gdbpy_string_to_argv): New function.
* python/py-utils.c (gdbpy_obj_to_string): New function.
(gdbpy_exception_to_string): New function.
* python/python-internal.h (gdbpy_string_to_argv): Declare.
(gdbpy_obj_to_string, gdbpy_exception_to_string): Declare.
(gdbpy_gdberror_exc): Declare.
* python/python.c (gdbpy_gdberror_exc): New global.
(_initialize_python): Initialize gdbpy_gdberror_exc and create
gdb.GdbError.
(GdbMethods): Add string_to_argv.
doc/
* gdb.texinfo (Exception Handling): Document gdb.GdbError.
(Commands In Python): Document gdb.string_to_argv.
testsuite/
* gdb.python/py-cmd.exp: Add tests for gdb.GdbError and
gdb.string_to_argv.
2010-05-25 15:27:17 +00:00
Doug Evans
0bf0f8c4cd
* python.c (gdbpy_print_stack): Ensure output ends with a newline.
2010-05-19 23:32:24 +00:00
Doug Evans
3a1d4620d6
* python.c (source_python_script): Add comment.
...
(source_python_script_for_objfile): Remove unnecessary call to
gdbpy_print_stack.
2010-05-19 21:57:24 +00:00
Michael Snyder
d59b6f6c38
2010-05-17 Michael Snyder <msnyder@vmware.com>
...
* python/py-auto-load.c: White space.
* python/py-block.c: White space.
* python/py-breakpoint.c: White space.
* python/py-cmd.c: White space.
* python/py-function.c: White space.
* python/py-lazy-string.c: White space.
* python/py-objfile.c: White space.
* python/py-param.c: White space.
* python/py-prettyprint.c: White space.
* python/py-progspace.c: White space.
* python/py-symtab.c: White space.
* python/python.c: White space.
* python/py-type.c: White space.
* python/py-utils.c: White space.
* python/py-value.c: White space.
2010-05-17 21:23:25 +00:00
Phil Muldoon
88d4aea747
2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
...
PR python/11482
* python/py-value.c (valpy_hash): New function.
(value_object_type): Register valpy_hash.
2010-05-14 Phil Muldoon <pmuldoon@redhat.com>
PR python/11482
* gdb.python/py-value.exp (test_value_hash): New function
2010-05-14 11:11:28 +00:00
Michael Snyder
f92adf3ccc
2010-05-07 Michael Snyder <msnyder@vmware.com>
...
* python/python.c (execute_gdb_command): Remove unused variables.
* python/py-block.c (gdbpy_block_for_pc): Remove unused variable.
* python/py-breakpoint.c (gdbpy_breakpoint_created):
Remove unused variable.
* python/py-cmd.c (cmdpy_function): Remove unused variable.
(cmdpy_completer): Remove unused variable.
* python/py-frame.c (frapy_find_sal): Remove unused variable.
* python/py-function.c (fnpy_call): Remove unused variable.
* python/py-objfile.c (objfile_to_objfile_object):
Remove unused variable.
* python/py-param.c (parmpy_init): Remove unused variable.
* python/py-prettyprint.c (apply_varobj_pretty_printer):
Remove unused variable.
(gdbpy_default_visualizer): Remove unused variable.
* python/py-progspace.c (pspace_to_pspace_object):
Remove unused variable.
* python/py-symtab.c (symtab_and_line_to_sal_object):
Remove unused variable.
* python/py-type.c (typy_template_argument):
Remove unused variable.
* python/py-value.c (valpy_string): Remove unused variable.
(convert_value_from_python): Remove unused variables.
2010-05-07 19:26:30 +00:00
Pierre Muller
3c0ee1a464
* python/py-param.c (parm_constants): Avoid ARI warning
...
by adding ARI comment.
(parmpy_init): Likewise.
2010-04-30 16:22:42 +00:00
Phil Muldoon
d7b32ed3ab
2010-04-29 Phil Muldoon <pmuldoon@redhat.com>
...
Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-parameter.
(SUBDIR_PYTHON_SRCS): Likewise.
(py-parameter.o): New rule.
* python/py-parameter.c: New file.
* python/python-internal.h (gdbpy_initialize_parameter)
(gdbpy_parameter, gdbpy_parameter_value)
(gdbpy_parse_command_name): Declare.
* python/py-cmd.c (parse_command_name): Rename to
gdbpy_parse_command_name.
(gdbpy_parse_command_name): Accept a starting list parameter and
use over cmdlist.
(cmdpy_init): Use gdbpy_parse_command_name.
* python/python.c (parameter_to_python): Rename to
gdbpy_parameter_to_python. Accept enum var_types and value.
(gdbpy_parameter): Use gdbpy_parameter_value.
(_initialize_python): Call gdbpy_initialize_parameters.
2010-04-29 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-param.exp: New File.
2010-04-29 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.texinfo (Parameters In Python): New Node.
2010-04-29 15:45:57 +00:00
Joel Brobecker
e78f4312c5
ARI warning fix.
...
* python/py-auto-load.c (source_section_scripts): Remove trailing
new-line in i18n string.
2010-04-27 16:36:02 +00:00
Doug Evans
88a1906b0d
* configure.ac (CONFIG_SRCS): Add py-auto-load.o even if not using
...
python.
* configure: Regenerate.
* main.c: #include "python/python.h".
(captured_main): Defer loading auto-loaded scripts until after
local_gdbinit has been sourced.
* python/py-auto-load.c (gdbpy_global_auto_load): New global.
(load_auto_scripts_for_objfile): New function.
(auto_load_new_objfile): Call it.
* python/python.h (gdbpy_global_auto_load): Declare.
(load_auto_scripts_for_objfile): Declare.
2010-04-23 18:09:16 +00:00
Doug Evans
8a1ea21f7e
Add support for auto-loading scripts from .debug_gdb_scripts section.
...
* NEWS: Add entry for .debug_gdb_scripts.
* Makefile.in SUBDIR_PYTHON_OBS): Add py-auto-load.o.
(SUBDIR_PYTHON_SRCS): Add py-auto-load.c.
(py-auto-load.o): New rule.
* cli/cli-cmds.c (find_and_open_script): Make externally visible.
* cli/cli-cmds.h (find_and_open_script): Update prototype.
* python/py-auto-load.c: New file.
* python/python-internal.h: #include <stdio.h>.
(set_python_list, show_python_list): Declare.
(gdbpy_initialize_auto_load): Declare.
(source_python_script_for_objfile): Declare.
* python/python.c: Remove #include of observer.h.
(gdbpy_auto_load): Moved to py-auto-load.c.
(GDBPY_AUTO_FILENAME): Ditto.
(gdbpy_new_objfile): Delete.
(source_python_script_for_objfile): New function.
(set_python_list, show_python_list): Make externally visible.
(_initialize_python): Move "auto-load" command to py-auto-load.c
and observer_attach_new_objfile to py-auto-load.c.
doc/
* gdb.texinfo (Python): Move Auto-loading section here ...
(Python API): from here.
(Auto-loading): Add docs for .debug_gdb_scripts auto-loaded scripts.
(Maintenance Commands): Add docs for "maint print section-scripts".
testsuite/
* gdb.python/py-section-script.c: New file.
* gdb.python/py-section-script.exp: New file.
* gdb.python/py-section-script.py: New file.
2010-04-23 16:20:13 +00:00
Doug Evans
fa33c3cd05
* NEWS: Add entry for python program space support.
...
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-progspace.o.
(SUBDIR_PYTHON_SRCS): Add py-progspace.c.
(py-progspace.o): New rule.
* python/py-prettyprint.c (find_pretty_printer_from_objfiles): New
function.
(find_pretty_printer_from_progspace): New function.
(find_pretty_printer_from_gdb): New function.
(find_pretty_printer): Rewrite.
* python/py-progspace.c: New file.
* python/python-internal.h (program_space): Add forward decl.
(pspace_to_pspace_object, pspy_get_printers): Declare.
(gdbpy_initialize_pspace): Declare.
* python/python.c: #include "progspace.h".
(gdbpy_get_current_progspace, gdbpy_progspaces): New functions.
(_initialize_python): Call gdbpy_initialize_pspace.
(GdbMethods): Add current_progspace, progspaces.
doc/
* gdb.texinfo (Python API): Add progspaces section.
(Selecting Pretty-Printers): Progspace pretty-printers are
searched too.
(Progspaces In Python): New section.
testsuite/
* gdb.python/py-progspace.c: New file.
* gdb.python/py-progspace.exp: New file.
2010-04-15 19:54:13 +00:00
Doug Evans
3f7b2faa4b
Add -s option to source command.
...
* NEWS: Document new option.
* cli/cli-cmds.c (find_and_open_script): Add function comment.
Delete from_tty and cleanupp args. Split filep arg into file and
full_pathp. New arg search_path.
(source_script_from_stream): New function.
(source_script_with_search): New function.
(source_script): Rewrite.
(source_command): Parse "-s" option.
(init_cli_cmds): Add "-s" docs to source command help, and reformat.
* python/python.c (source_python_script): Make file arg a const char *.
Don't call fclose, leave for caller.
* python/python.h (source_python_script): Update.
testsuite/
* gdb.base/source-test.gdb: New file.
* gdb.base/source.exp: Add tests for "source -s".
doc/
* gdb.texinfo (Command Files): Add docs for new "source -s" option.
2010-04-15 17:45:57 +00:00
Phil Muldoon
044c0f87fe
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
...
* python/py-block.c (gdbpy_block_for_pc): Use i8n to encompass
error/warning messages. Capitalize and use complete sentences.
(blpy_block_syms_iternext): Likewise.
* python/py-cmd.c (parse_command_name, cmdpy_init): Likewise.
* python/py-frame.c (FRAPY_REQUIRE_VALID, frapy_block)
(frame_info_to_frame_object, frapy_read_var)
(gdbpy_frame_stop_reason_string): Likewise.
* python/py-lazy-string.c (stpy_convert_to_value)
(gdbpy_create_lazy_string_object): Likewise.
* python/py-objfile.c (objfpy_set_printers): Likewise.
* python/py-prettyprint.c (gdbpy_default_visualizer): Likewise.
* python/python.c (parameter_to_python): Likewise.
* python/py-type.c (typy_range, typy_target): Likewise.
* python/py-value.c (valpy_cast, valpy_length, valpy_getitem)
(valpy_richcompare, valpy_int, valpy_long, valpy_float): Likewise.
2010-04-14 13:18:55 +00:00
Phil Muldoon
79f283fe85
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
...
PR python/11381
* python/py-prettyprint.c (pretty_print_one_value): Test for
Py_None.
(print_string_repr): Test for Py_None. Set flags accordingly.
Return value depending on return type.
(print_children): Take a value indicating whether data was printed
before this function was called. Alter output accordingly.
(apply_val_pretty_printer): Capture return value from
print_string_repr and pass to print_children.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
* gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
* gdb.python/py-prettyprint.exp: New test for to_string returning None.
* gdb.python/py-mi.exp: New test for to_string returning None.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Pretty Printing): Document behaviour when to_string
returns None.
2010-04-14 12:02:46 +00:00
Phil Muldoon
adc368187c
2010-04-09 Phil Muldoon <pmuldoon@redhat.com>
...
Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey <tromey@redhat.com>
* breakpoint.c (condition_command): Simplify. Move condition
setting code to ...
(set_breakpoint_condition): ... here. New function.
* breakpoint.h (set_breakpoint_condition): Declare.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-breakpoint.
(SUBDIR_PYTHON_SRCS): Likewise.
(py-breakpoint.o): New rule.
* python/py-breakpoint.c: New file.
* python/python-internal.h (gdbpy_breakpoints)
(gdbpy_initialize_breakpoints): Declare.
(GDB_PY_SET_HANDLE_EXCEPTION) Define.
2010-04-09 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: New File.
* gdb.python/py-breakpoint.C: Ditto.
2010-04-09 Phil Muldoon <pmuldoon@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Breakpoints In Python): New Node.
2010-04-09 09:41:43 +00:00
Phil Muldoon
f5f8b5baf4
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
...
* python/py-lazy-string.c (stpy_convert_to_value): Add i8n to error string.
2010-04-08 10:47:56 +00:00
Phil Muldoon
fff5cc649e
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
...
PR python/11417
* python/py-lazy-string.c (stpy_convert_to_value): Check for
a NULL address.
(gdbpy_create_lazy_string_object): Allow strings with a NULL
address and a zero length.
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value: Add null string variable.
(test_lazy_string): Test zero length, NULL address lazy
strings.
2010-04-08 10:28:42 +00:00
Doug Evans
eb5cda8649
* python/python.c (source_python_script): Use ensure_python_env
...
to prepare environment for script.
2010-04-08 04:57:25 +00:00
Pierre Muller
9cb74f47a1
* python/python-internal.h: Include symtab.h.
2010-03-09 17:12:40 +00:00
Tom Tromey
f870a310ee
gdb
...
2010-03-05 Corinna Vinschen <vinschen@redhat.com>
Tom Tromey <tromey@redhat.com>
* utils.c (host_char_to_target): Add 'gdbarch' argument.
(parse_escape): Likewise.
* python/py-utils.c (unicode_to_target_string): Update.
(unicode_to_target_python_string): Update.
(target_string_to_unicode): Update.
* printcmd.c (printf_command): Update.
* p-exp.y (yylex): Update.
* objc-exp.y (yylex): Update.
* mi/mi-parse.c: Include charset.h.
(mi_parse_escape): New function.
(mi_parse_argv): Use it.
* jv-exp.y (yylex): Update.
* i386-cygwin-tdep.c (i386_cygwin_auto_wide_charset): New
function.
(i386_cygwin_init_abi): Call set_gdbarch_auto_wide_charset.
* gdbarch.sh (auto_charset, auto_wide_charset): New.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* defs.h (parse_escape): Update.
* cli/cli-setshow.c: Include arch-utils.h.
(do_setshow_command): Update.
* cli/cli-cmds.c (echo_command): Update.
* charset.h (target_charset, target_wide_charset): Update.
* charset.c: Include arch-utils.h.
(target_charset_name): Default to "auto".
(target_wide_charset_name): Likewise.
(show_target_charset_name): Handle "auto".
(show_target_wide_charset_name): Likewise.
(be_le_arch): New global.
(set_be_le_names): Add 'gdbarch' argument.
(validate): Likewise. Don't call set_be_le_names.
(set_charset_sfunc, set_host_charset_sfunc)
(set_target_charset_sfunc, set_target_wide_charset_sfunc):
Update.
(target_charset): Add 'gdbarch' argument.
(target_wide_charset): Likewise. Remove 'byte_order' argument.
(auto_target_charset_name): New global.
(default_auto_charset, default_auto_wide_charset): New functions.
(_initialize_charset): Set auto_target_charset_name. Allow "auto"
for target charsets. Copy result of nl_langinfo. Use GetACP if
USE_WIN32API.
* c-lang.c (charset_for_string_type): Add 'gdbarch' argument,
remove 'byte_order' argument. Update.
(classify_type): Likewise.
(c_emit_char): Update.
(c_printchar): Update.
(c_printstr): Update.
(c_get_string): Update.
(evaluate_subexp_c): Update.
* arch-utils.h (default_auto_charset, default_auto_wide_charset):
Declare.
* python/python.c (gdbpy_target_charset): New function.
(gdbpy_target_wide_charset): Likewise.
(GdbMethods): Update.
* NEWS: Update.
gdb/doc
* gdb.texinfo (Basic Python): Document target_charset and
target_wide_charset.
gdb/testsuite
* gdb.python/py-prettyprint.py (pp_nullstr.to_string): Use
gdb.target_charset.
(pp_ns.to_string): Likewise.
2010-03-05 20:18:19 +00:00
Ulrich Weigand
aab48ede09
* python/py-lazy-string.c (gdbpy_extract_lazy_string): Extract
...
address as UnsignedLongLong, not LongLong.
2010-03-05 19:28:13 +00:00
Phil Muldoon
dc00d89fd0
2010-02-28 Phil Muldoon <pmuldoon@redhat.com>
...
PR python/11036
* python/py-frame.c (frapy_read_var): Add block argument and logic
to cope with user provided blocks.
2010-02-28 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Frames In Python): Add block parameter and
description to read_var text.
2010-02-28 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-frame.exp: Add read_var block tests.
* gdb.python/py-frame.c (block): New function.
2010-02-28 21:56:50 +00:00
Phil Muldoon
5107b1496b
2010-02-26 Phil Muldoon <pmuldoon@redhat.com>
...
Tom Tromey <tromey@redhat.com>
* python/py-type.c (typy_lookup_typename): Add in block argument.
If provided restrict lookup to specified blocks.
(gdbpy_lookup_type): Likewise.
(typy_lookup_type): Likewise.
2010-02-26 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Types In Python): Describe block argument in
template_argument and gdb.lookup_type.
2010-02-26 09:08:10 +00:00
Phil Muldoon
f3e9a8177c
2010-02-24 Phil Muldoon <pmuldoon@redhat.com>
...
Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* python/python.c (_initialize_python): Call
gdbpy_initialize_symtabs, gdbpy_initialize_symbols and
gdbpy_initialize_blocks.
* python/python-internal.h: Declare struct symbol, block and
symtab_and_line. Declare block_object_type and
symbol_object_type
(gdbpy_lookup_symbol gdbpy_block_for_pc)
(symtab_and_line_to_sal_object, symtab_to_symtab_object)
(symbol_to_symbol_object, block_to_block_object)
(gdbpy_initialize_symtabs,gdbpy_initialize_symbols)
(gdbpy_initialize_blocks ): Declare.
* python/py-frame.c (frapy_block, frapy_function, frapy_find_sal)
(frapy_select): Add methods.
(frapy_read_var): Add symbol branch.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-symbol, py-symtab,
py-block.
(SUBDIR_PYTHON_SRCS): Likewise.
(py-symbol.o): New rule.
(py-symtab.o): Likewise.
(py-block.o): Likewise.
* python/py-symbol.c: New file.
* python/py-symtab.c: Likewise.
* python/py-block.c: Likewise.
2010-02-24 Phil Muldoon <pmuldoon@redhat.com>
* Makefile.in: Add py-block and py-symbol.
* gdb.python/py-symbol.exp: New File.
* gdb.python/py-symtab.exp: New File.
* gdb.python/py-block.exp: New File.
* gdb.python/py-symbol.c: New File.
* gdb.python/py-block.c: New File.
2010-02-24 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Frames In Python): Add block, find_sal, function
and select method descriptions.
(Python API): Add Blocks In Python, Symbols in Python and Symbol
Tables in Python to menu.
(Blocks In Python): New node.
(Symbols In Python): New node.
(Symbol Tables in Python): New node.
2010-02-24 21:18:28 +00:00
Ulrich Weigand
548a926afa
* python/python-internal.h [!WITH_THREAD] (PyGILState_Release,
...
PyThreadState_Swap): Avoid "statement with no effect" warning.
2010-02-17 14:58:54 +00:00
Tom Tromey
edf3d5f3f8
gdb
...
PR c++/11226, PR c++/9629, PR c++/9688, PR c++/8890:
* valops.c (search_struct_field): Compute nbases after calling
CHECK_TYPEDEF.
(check_field): Call CHECK_TYPEDEF.
* cp-valprint.c (cp_print_value): Pass correct address to
baseclass_offset. Fix check for virtual base past the end of the
object. Don't offset address passed to cp_print_value_fields or
apply_val_pretty_printer.
(cp_print_value_fields): Fix call to val_print.
(cp_print_value_fields_rtti): New function.
* c-valprint.c (c_val_print): Use cp_print_value_fields_rtti.
* p-valprint.c (pascal_object_print_value_fields): Fix call to
val_print.
* python/py-prettyprint.c (apply_val_pretty_printer): Add embedded
offset to address.
* language.h (struct language_defn) <la_val_print>: Document.
* c-lang.h (cp_print_value_fields_rtti): Declare.
gdb/testsuite
PR c++/11226, PR c++/9629, PR c++/9688, PR c++/8890:
* gdb.cp/virtbase.cc: New file.
* gdb.cp/virtbase.exp: New file.
* gdb.cp/userdef.exp: Allow 'struct' or 'class'.
2010-02-02 16:45:17 +00:00
Joel Brobecker
d9c57d9ff1
Fix build failure when building without Python support.
...
* python/python.c: Always include exceptions.h, even when HAVE_PYTHON
is not defined.
2010-01-18 10:50:45 +00:00
Joel Brobecker
973817a313
Allow "source" to load python scripts.
...
* exceptions.h (enum errors): Add UNSUPPORTED_ERROR.
* python/python.c (source_python_script): New function.
* python/python.h (source_python_script): Add declaration.
* cli/cli-cmds.c: #include exceptions.h and python/python.h.
(script_ext_off, script_ext_soft, script_ext_strict)
(script_ext_enums, script_ext_mode): New static constants.
(show_script_ext_mode, find_and_open_script): New functions.
(source_script): Enhance to handle Python scripts.
(init_cli_cmds): Add set/show script-extension commands.
2010-01-18 06:25:22 +00:00
Phil Muldoon
be759fcf73
2010-01-13 Phil Muldoon <pmuldoon@redhat.com>
...
PR python/10705
* python/python-internal.h: Add lazy_string_object_type
definition.
(create_lazy_string_object, gdbpy_initialize_lazy_string)
(gdbpy_is_lazystring, gdbpy_extract_lazy_string): Define.
* python/py-value.c (valpy_lazy_string): New function.
(convert_value_from_python): Add lazy string conversion.
* python/py-prettyprint.c (pretty_print_one_value): Check if
return is also a lazy string.
(print_string_repr): Add lazy string printing branch.
(print_children): Likewise.
* python/py-lazy-string.c: New file. Implement lazy strings.
* python/python.c (_initialize_python): Call
gdbpy_initialize_lazy_string.
* varobj.c (value_get_print_value): Add lazy string printing
branch. Account for encoding.
* c-lang.c (c_printstr): Account for new encoding argument. If
encoding is NULL, find encoding suited for type, otherwise use
user encoding.
* language.h (language_defn): Add encoding argument.
(LA_PRINT_STRING): Likewise.
* language.c (unk_lang_printstr): Update to reflect new encoding
argument to language_defn.
* ada-lang.h (ada_printstr): Likewise.
* c-lang.h (c_printstr): Likewise.
* p-lang.h (pascal_printstr);
* f-lang.c (f_printstr): Likewise.
* m2-lang.c (m2_printstr): Likewise.
* objc-lang.c (objc_printstr): Likewise.
* p-lang.c (pascal_printstr): Likewise.
* scm-lang.c (scm_printstr): Likewise.
* c-valprint.c (c_val_print): Update LA_PRINT_STRING call for
encoding argument.
* ada-valprint.c (ada_printstr): Likewise.
* f-valprint.c (f_val_print): Likewise
* m2-valprint.c (m2_val_print): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
* expprint.c (print_subexp_standard): Likewise.
* valprint.c (val_print_string): Likewise.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-lazy-string.
(SUBDIR_PYTHON_SRCS): Likewise.
(py-lazy-string.o): New rule.
2010-01-13 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Values From Inferior): Document lazy_string value
method.
(Python API): Add Lazy strings menu item.
(Lazy Strings In Python): New node.
2010-01-13 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value.exp (test_lazy_strings): Add lazy string test.
* gdb.python/py-prettyprint.py (pp_ls): New printer.
* gdb.python/py-prettyprint.exp (run_lang_tests): Add lazy string
test.
* gdb.python/py-prettyprint.c: Define lazystring test structure.
* gdb.python/py-mi.exp: Add lazy string test.
2010-01-14 08:03:37 +00:00
Joel Brobecker
4c38e0a4fc
Update copyright year in most headers.
...
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Phil Muldoon
8d099ae953
2009-12-09 Phil Muldoon <pmuldoon@redhat.com>
...
* python/py-type.c (typy_range): Initialize variables to zero.
2009-12-09 07:49:31 +00:00
Phil Muldoon
361ae04250
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
...
PR python/10804
* python/py-type.c (typy_range): New Function.
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-type.exp (test_range): New test.
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Types In Python): Describe range function.
2009-12-08 14:06:04 +00:00
Phil Muldoon
bfd31e7118
2009-12-03 Richard Ward <richard.j.ward1@googlemail.com>
...
* python/py-type.c (convert_field): New attribute "is_base_class".
doc/
2009-12-03 Richard Ward <richard.j.ward1@googlemail.com>
* gdb.texinfo (Types In Python): Describe "is_base_class".
testsuite/
2009-12-03 Phil Muldoon <pmuldoon@redhat.com>
PR python/10805
* gdb.python/py-type.exp: New file.
* gdb.python/py-type.c: New file.
* Makefile.in: Add py-type.
2009-12-03 21:19:49 +00:00
Tom Tromey
57a1d73695
gdb
...
* python/python.c (gdbpy_parse_and_eval): New function.
(GdbMethods): Add "parse_and_eval".
gdb/testsuite
* gdb.python/py-value.exp (test_parse_and_eval): New
function.
gdb/doc
* gdb.texinfo (Basic Python): Document gdb.parse_and_eval.
2009-12-03 18:30:02 +00:00
Paul Pluzhnikov
269f82e5eb
gdb/ChangeLog:
...
2009-11-13 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/py-prettyprint.c (print_string_repr): Suppress
address printing
testsuite/ChangeLog:
2009-11-13 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.python/py-prettyprint.exp: Adjust.
2009-11-13 17:17:57 +00:00
Tom Tromey
86c6265d62
* python/python.c (execute_gdb_command): Copy the argument text.
2009-11-09 18:29:12 +00:00
Tom Tromey
31158f0e2a
* python/py-value.c (valpy_string): NULL-terminate 'keywords'.
2009-09-29 15:13:45 +00:00
Tom Tromey
96c07c5b96
gdb
...
PR python/10664:
* language.h (struct language_defn) <la_get_string>: Add
'char_type' argument.
(LA_GET_STRING): Likewise.
(default_get_string, c_get_string): Update.
* language.c (default_get_string): Add 'char_type' argument.
* c-valprint.c (c_textual_element_type): Rename from
textual_element_type. No longer static. Update callers.
* c-lang.h (c_textual_element_type): Declare.
* c-lang.c (c_get_string): Add 'char_type' argument.
gdb/testsuite
PR python/10664:
* gdb.base/charset.exp: Test utf-16 strings with Python.
2009-09-25 21:39:53 +00:00
Tom Tromey
89fa5381cb
PR gdb/10583:
...
* python/py-value.c (valpy_int): Use PyLong_FromLongLong.
(valpy_long): Likewise.
2009-09-22 21:14:58 +00:00
Tom Tromey
ce0420dced
2009-09-21 Jason Orendorff <jason.orendorff@gmail.com>
...
PR python/10666:
* python/py-function.c (fnpy_init): Use xstrdup.
2009-09-21 16:18:42 +00:00
Phil Muldoon
2e4d963fb2
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
...
* python/py-value.c (valpy_getitem): Test value before allowing
subscript operation.
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value.exp (test_subscript_regression): New
function. Test for invalid subscripts.
* gdb.python/py-value.c (main): Add test array, and pointer to it.
(ptr_ref): New function.
2009-09-21 09:32:28 +00:00
Doug Evans
c1bd65d042
* objfiles.c (struct objfile_data): Delete member cleanup and replace
...
with save, free.
(register_objfile_data_with_cleanup): Delete arg cleanup and replace
with save, free. All callers updated.
(clear_objfile_data): Replace cleanup loop with separate save and
free loops.
* objfiles.h (register_objfile_data_with_cleanup): Update.
* arm-tdep.c (arm_objfile_data_free): Renamed from
arm_objfile_data_cleanup, all callers updated.
* dwarf2read.c (dwarf2_per_objfile_free): Renamed from
dwarf2_per_objfile_cleanup, all callers updated.
* python/py-objfile.c (py_free_objfile): Renamed from clean_up_objfile,
all callers updated.
* python/py-type.c (save_objfile_types): Renamed from
clean_up_objfile_types, all callers updated.
2009-09-11 18:51:31 +00:00
Joel Brobecker
5172aecbd2
Checking in this patch for Thiago: Rename python-* files into py-*,
...
more 8+3 friendly.
gdb/
* Makefile.in (py-cmd.o): Renamed from python-cmd.o. Updated
references.
(py-frame.o): Renamed from python-frame.o. Updated references.
(py-function.o): Renamed from python-function.o. Updated references.
(py-objfile.o): Renamed from python-objfile.o. Updated references.
(py-prettyprint.o): Renamed from python-prettyprint.o. Updated
+references.
(py-type.o): Renamed from python-type.o. Updated references.
(py-utils.o): Renamed from python-utils.o. Updated references.
(py-value.o): Renamed from python-value.o. Updated references.
* py-cmd.o: Renamed from python-cmd.o.
* py-frame.o: Renamed from python-frame.o.
* py-function.o: Renamed from python-function.o.
* py-objfile.o: Renamed from python-objfile.o.
* py-prettyprint.o: Renamed from python-prettyprint.o.
* py-type.o: Renamed from python-type.o.
* py-utils.o: Renamed from python-utils.o.
* py-value.o: Renamed from python-value.o.
gdb/testsuite/
* gdb.python/Makefile.in (EXECUTABLES): Adjust to new executable
names, add missing ones.
* gdb.python/py-cmd.exp: Rename from python-cmd.exp.
* gdb.python/py-frame.c: Rename from python-frame.c.
* gdb.python/py-frame.exp: Rename from python-frame.exp. Adjust
testfile name.
* gdb.python/py-function.exp: Rename from python-function.exp.
* gdb.python/py-mi.exp: Rename from python-mi.exp. Adjust
testfile name.
* gdb.python/py-prettyprint.c: Rename from python-prettyprint.c.
* gdb.python/py-prettyprint.exp: Rename from python-prettyprint.exp.
Adjust testfile name.
* gdb.python/py-prettyprint.py: Rename from python-prettyprint.py.
* gdb.python/py-template.cc: Rename from python-template.cc.
* gdb.python/py-template.exp: Rename from python-template.exp.
Adjust testfile name.
* gdb.python/py-value.c: Rename from python-value.c.
* gdb.python/py-value.exp: Rename from python-value.exp. Adjust
testfile name.
2009-09-09 17:45:42 +00:00
Tom Tromey
f02779d8c5
* python/python-value.c (valpy_richcompare): Don't return from
...
inside a TRY_CATCH.
2009-08-24 18:55:21 +00:00