Commit Graph

13 Commits

Author SHA1 Message Date
Tom Tromey f04e4012c7 * python/py-prettyprint.c (gdbpy_get_display_hint): Don't use
'hint' if it is NULL.
2010-07-09 20:29:56 +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
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
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
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
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
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
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
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
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