Commit Graph

100883 Commits

Author SHA1 Message Date
Alan Modra 780f96aed2 readelf large memory allocation
* elfcomm.h (setup_archive): Update prototype.
	* elfcomm.c (setup_archive): Add file_size parameter and sanity
	check longnames_size.
	(setup_nested_archive): Get file size and pass to setup_archive.
	* elfedit.c (process_archive): Likewise.
	* readelf.c (process_archive): Pass filedata->file_size to
	setup_archive.
2020-03-14 17:24:19 +10:30
Alan Modra f761cb13a9 asan: readelf: memory leaks
* readelf.c (dump_section_as_strings): Free memory on error exit.
	(dump_section_as_bytes, process_notes_at): Likewise.
	(get_build_id): Free enote.
2020-03-14 17:24:19 +10:30
Alan Modra 02a8180e6f non-contiguous elf test
This test XPASSes on the generic ELF targets, so adjusting.  I also
made xtensa an xfail instead of a skip, since skip is hiding some
nastiness.

	* testsuite/ld-elf/non-contiguous.d: Don't xfail generic ELF
	targets.  Don't skip xtensa, xfail instead.
2020-03-14 17:24:19 +10:30
Alan Modra 48e81d7f63 BFD_FAKE_SECTIONS formatting
After the ld non-contiguous memory support my regen of bfd-in2.h
didn't match exactly what was committed, so I took the opportunity to
line up all the comments.

	* section.c (BFD_FAKE_SECTIONS): Formatting.
	* bfd-in2.h: Regenerate.
2020-03-14 17:23:56 +10:30
Tom Tromey 426a9c18dd Remove val_print
We can finally remove val_print and various helper functions that are
no longer needed.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* value.h (val_print): Don't declare.
	* valprint.h (val_print_array_elements)
	(val_print_scalar_formatted, generic_val_print): Don't declare.
	* valprint.c (generic_val_print_array): Take a struct value.
	(generic_val_print_ptr, generic_val_print_memberptr)
	(generic_val_print_bool, generic_val_print_int)
	(generic_val_print_char, generic_val_print_complex)
	(generic_val_print): Remove.
	(generic_value_print): Update.
	(do_val_print): Remove unused parameters.  Don't call
	la_val_print.
	(val_print): Remove.
	(common_val_print): Update.  Don't call value_check_printable.
	(val_print_scalar_formatted, val_print_array_elements): Remove.
	* rust-lang.c (rust_val_print): Remove.
	(rust_language_defn): Update.
	* p-valprint.c (pascal_val_print): Remove.
	(pascal_value_print_inner): Update.
	(pascal_object_print_val_fields, pascal_object_print_val):
	Remove.
	(pascal_object_print_static_field): Update.
	* p-lang.h (pascal_val_print): Don't declare.
	* p-lang.c (pascal_language_defn): Update.
	* opencl-lang.c (opencl_language_defn): Update.
	* objc-lang.c (objc_language_defn): Update.
	* m2-valprint.c (m2_print_unbounded_array, m2_val_print): Remove.
	* m2-lang.h (m2_val_print): Don't declare.
	* m2-lang.c (m2_language_defn): Update.
	* language.h (struct language_defn) <la_val_print>: Remove.
	* language.c (unk_lang_value_print_inner): Rename.  Change
	argument types.
	(unknown_language_defn, auto_language_defn): Update.
	* go-valprint.c (go_val_print): Remove.
	* go-lang.h (go_val_print): Don't declare.
	* go-lang.c (go_language_defn): Update.
	* f-valprint.c (f_val_print): Remove.
	* f-lang.h (f_value_print): Don't declare.
	* f-lang.c (f_language_defn): Update.
	* d-valprint.c (d_val_print): Remove.
	* d-lang.h (d_value_print): Don't declare.
	* d-lang.c (d_language_defn): Update.
	* cp-valprint.c (cp_print_value_fields)
	(cp_print_value_fields_rtti, cp_print_value): Remove.
	(cp_print_static_field): Update.
	* c-valprint.c (c_val_print_array, c_val_print_ptr)
	(c_val_print_struct, c_val_print_union, c_val_print_int)
	(c_val_print_memberptr, c_val_print): Remove.
	* c-lang.h (c_val_print_array, cp_print_value_fields)
	(cp_print_value_fields_rtti): Don't declare.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Update.
	* ada-valprint.c (ada_val_print_ptr, ada_val_print_num): Remove.
	(ada_val_print_enum): Take a struct value.
	(ada_val_print_flt, ada_val_print_array, ada_val_print_1)
	(ada_val_print): Remove.
	(ada_value_print_1): Update.
	(printable_val_type): Remove.
	* ada-lang.h (ada_val_print): Don't declare.
	* ada-lang.c (ada_language_defn): Update.
2020-03-13 18:03:42 -06:00
Tom Tromey 42331a1ea2 Change extension language pretty-printers to use value API
This changes the extension language pretty-printers to use the value
API.

Note that new functions were needed, for both Guile and Python.
Currently both languages always wrap values by removing the values
from the value chain.  This makes sense to avoid strange behavior with
watchpoints, and to avoid excessive memory use.  However, when
printing, it's important to leave the passed-in value untouched, in
case pretty-printing does nothing -- that way the caller can still
access it.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (do_val_print): Update.
	* python/python-internal.h (gdbpy_apply_val_pretty_printer): Take
	a struct value.
	(value_to_value_object_no_release): Declare.
	* python/py-value.c (value_to_value_object_no_release): New
	function.
	* python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Take a
	struct value.
	* guile/scm-value.c (vlscm_scm_from_value_no_release): New
	function.
	* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Take
	a struct value.
	* guile/guile-internal.h (vlscm_scm_from_value_no_release):
	Declare.
	(gdbscm_apply_val_pretty_printer): Take a struct value.
	* extension.h (apply_ext_lang_val_pretty_printer): Take a struct
	value.
	* extension.c (apply_ext_lang_val_pretty_printer): Take a struct
	value.
	* extension-priv.h (struct extension_language_ops)
	<apply_val_pretty_printer>: Take a struct value.
	* cp-valprint.c (cp_print_value): Create a struct value.
	(cp_print_value): Update.
2020-03-13 18:03:42 -06:00
Tom Tromey 3a916a9757 Change print_field_values to use value-based API
This converts print_field_values to use the value-based API, by having
it call common_val_print rather than val_print.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (print_field_values): Call common_val_print.
2020-03-13 18:03:42 -06:00
Tom Tromey b59eac3732 Introduce ada_value_print_array
This adds ada_value_print_array, a value-based analogue of
ada_val_print_array.  It also removes some unused parameters from a
couple of helper functions.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (val_print_packed_array_elements): Remove
	bitoffset and val parameters.  Call common_val_print.
	(ada_val_print_string): Remove offset, address, and original_value
	parameters.
	(ada_val_print_array): Update.
	(ada_value_print_array): New function.
	(ada_value_print_1): Call it.
2020-03-13 18:03:42 -06:00
Tom Tromey 0337112903 Convert ada_value_print to value-based API
This converts ada_value_print to the value-based API by using
common_val_print rather than val_print.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_value_print): Use common_val_print.
2020-03-13 18:03:42 -06:00
Tom Tromey 2e088f8b6e Convert ada_val_print_ref to value-based API
This converts ada_val_print_ref to the value-based API by using
common_val_print rather than val_print.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_val_print_ref): Use common_val_print.
2020-03-13 18:03:42 -06:00
Tom Tromey 39ef85a896 Introduce ada_value_print_num
This adds ada_value_print_num, a value-based analogue of
ada_val_print_num.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_value_print_num): New function.
	(ada_value_print_1): Use it.
2020-03-13 18:03:42 -06:00
Tom Tromey b9fa6e0798 Rewrite ada_value_print_1 floating point case
This rewrites the TYPE_CODE_FLT case in ada_value_print_1 to be purely
value-based.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_value_print_1) <TYPE_CODE_FLT>: Rewrite.
2020-03-13 18:03:42 -06:00
Tom Tromey 416595d640 Introduce ada_value_print_ptr
This adds ada_value_print_ptr, a value-based analogue of
ada_val_print_ptr.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_value_print_ptr): New function.
	(ada_value_print_1): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey 5b5e15ecdd Rewrite ada_value_print_inner
This rewrites ada_value_print_inner, introducing a new
ada_value_print_1, an analogue of ada_val_print_1.  Because it was
simple to do, this also converts ada_val_print_gnat_array to be
valued-based and updates the uses.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_val_print_gnat_array): Take a struct value;
	call common_val_print.
	(ada_val_print_1): Update.
	(ada_value_print_1): New function.
	(ada_value_print_inner): Rewrite.
2020-03-13 18:03:41 -06:00
Tom Tromey fbf54e7554 Introduce cp_print_value
This adds cp_print_value, a value-based analogue of cp_print_val, and
changes cp_print_value_fields to use it.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* cp-valprint.c (cp_print_value_fields): Update.
	(cp_print_value): New function.
2020-03-13 18:03:41 -06:00
Tom Tromey 64b653ca70 Introduce cp_print_value_fields and c_value_print_struct
This adds cp_print_value_fields and c_value_print_struct, value-based
analogues of the corresponding val-printing functions.  Note that the
Modula-2 printing code also calls cp_print_val_fields, and so is
updated to call the function function.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* m2-valprint.c (m2_value_print_inner): Use
	cp_print_value_fields.
	* cp-valprint.c	(cp_print_value_fields): New function.
	* c-valprint.c (c_value_print_struct): New function.
	(c_value_print_inner): Use c_value_print_struct.
	* c-lang.h (cp_print_value_fields): Declare.
2020-03-13 18:03:41 -06:00
Tom Tromey 6999f067c1 Introduce c_value_print_array
This adds c_value_print_array, a value-based analogue of
c_val_print_array.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* c-valprint.c (c_value_print_array): New function.
	(c_value_print_inner): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey ce80b8bd37 Introduce c_value_print_memberptr
This adds c_value_print_memberptr, a value-based analogue of
c_val_print_memberptr.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* c-valprint.c (c_value_print_memberptr): New function.
	(c_value_print_inner): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey 2faac269d5 Introduce c_value_print_int
This adds c_value_print_int, a value-based analogue of
c_val_print_int.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* c-valprint.c (c_value_print_int): New function.
	(c_value_print_inner): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey da3e2c2923 Introduce c_value_print_ptr
This adds c_value_print_ptr, a value-based analogue of
c_val_print_ptr.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* c-valprint.c (c_value_print_ptr): New function.
	(c_value_print_inner): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey 5083623134 Rewrite c_value_print_inner
This rewrites c_value_print_inner, copying in the body of
c_val_print_inner and adusting as needed.  This will form the base of
future changes to fully convert this to using the value-based API

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* c-valprint.c (c_value_print_inner): Rewrite.
2020-03-13 18:03:41 -06:00
Tom Tromey 4f412b6e31 Introduce generic_value_print_complex
This adds generic_value_print_complex, a value-based analogue of
generic_val_print_complex.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_value_print_complex): New function.
	(generic_value_print): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey f535400886 Simplify generic_val_print_float
This changes generic_val_print_float not to call
val_print_scalar_formatted.  This lets generic_value_print then use
value_print_scalar_formatted instead.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_val_print_float): Don't call
	val_print_scalar_formatted.
	(generic_val_print, generic_value_print): Update.
2020-03-13 18:03:41 -06:00
Tom Tromey 3eec3b05b9 Introduce generic_value_print_char
This adds generic_value_print_char, a value-based analogue of
generic_val_print_char.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_value_print_char): New function
	(generic_value_print): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey fdddfccba1 Introduce generic_value_print_int
This adds generic_value_print_int, a value-based analogue of
generic_val_print_int.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_value_print_int): New function.
	(generic_value_print): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey 6dde752183 Introduce generic_value_print_bool
This adds generic_value_print_bool, a value-based analogue of
generic_val_print_bool.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_value_print_bool): New function.
	(generic_value_print): Use it.
2020-03-13 18:03:41 -06:00
Tom Tromey 4112d2e602 Simplify generic_val_print_func
This removes the call to val_print_scalar_formatted from
generic_val_print_func, allowing generic_value_print to call the
value-based variant instead.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_val_print_func): Simplify.
	(generic_val_print, generic_value_print): Update.
2020-03-13 18:03:41 -06:00
Tom Tromey 65786af626 Remove generic_val_print_flags
This remove generic_val_print_flags in favor of using the value-based
API where possible.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_val_print_flags): Remove.
	(generic_val_print, generic_value_print): Update.
	(val_print_type_code_flags): Add original_value parameter.
2020-03-13 18:03:41 -06:00
Tom Tromey 40f3ce189e Fix generic_val_print_enum for value-based printing
This removes a call to val_print_scalar_formatted from
generic_val_print_enum, preferring to do the work in the callers.
This lets generic_value_print use the value-based API.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_val_print): Update.
	(generic_value_print): Update.
	* valprint.c (generic_val_print_enum): Don't call
	val_print_scalar_formatted.
2020-03-13 18:03:41 -06:00
Tom Tromey 2a5b130bcb Introduce generic_value_print_ptr
This introduces generic_value_print_ptr, a value-based analogue of
generic_val_print_ptr, and changes generic_value_print to use it.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_value_print): Call generic_value_print_ptr.
	* valprint.c (generic_value_print_ptr): New function.
2020-03-13 18:03:41 -06:00
Tom Tromey abc66ce95e Initial rewrite of generic_value_print
This rewrites generic_value_print, by copying in the body of
generic_val_print and making the needed adjustments.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_value_print): Rewrite.
2020-03-13 18:03:41 -06:00
Tom Tromey 07a328583d Convert Pascal to value-based API
This finishes the conversion of Pascal to the value-based API, by
introducing two more value-based analogues of existing val-print
functions.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* p-valprint.c (pascal_object_print_value_fields)
	(pascal_object_print_value): New functions.
2020-03-13 18:03:40 -06:00
Tom Tromey 64d64d3a76 Rewrite pascal_value_print_inner
This rewrites pascal_value_print_inner, copying in the body of
pascal_val_print_inner and adusting as needed.  This will form the
base of future changes to fully convert this to using the value-based
API.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* p-valprint.c (pascal_value_print_inner): Rewrite.
2020-03-13 18:03:40 -06:00
Tom Tromey 6a95a1f58d Convert Fortran printing to value-based API
This finishes the conversion of the Fortran printing code to the
value-based API.  The body of f_val_print is copied into
f_value_print_innner, and then modified as needed to use the value
API.

Note that not all calls must be updated.  For example, f77_print_array
remains "val-like", because it does not result in any calls to
val_print (f77_print_array_1 calls common_val_print, which is
nominally value-based).

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* f-valprint.c (f_value_print_innner): Rewrite.
2020-03-13 18:03:40 -06:00
Tom Tromey 59fcdac646 Convert Modula-2 printing to value-based API
This finishes the conversion of Modula-2 printing to the value-based
API.  It does so by copying the body of m2_val_print into
m2_value_print_inner, and then introducing new functions as needed to
use the value API.

The "val_" API code continues to exist, because it's still possible
for it to be called via some paths.  This code will all be removed at
the end of the series.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* m2-valprint.c (m2_print_unbounded_array): New overload.
	(m2_print_unbounded_array): Update.
	(m2_print_array_contents): Take a struct value.
	(m2_value_print_inner): Rewrite.
2020-03-13 18:03:40 -06:00
Tom Tromey d133c3e1a8 Convert D printing to value-based API
As with Rust and Go, it was straightforward to convert D to the
value-based API directly.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* d-valprint.c (dynamic_array_type): Call d_value_print_inner.
	(d_value_print_inner): New function.
	* d-lang.h (d_value_print_inner): Declare.
	* d-lang.c (d_language_defn): Use d_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 23b0f06be4 Convert Go printing to value-based API
This introduces go_value_print_inner, a modified copy of go_val_print.
Unlike some of the other languages, Go was straightforward to convert
to the value-based API all at once, so this patch takes that approach.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* go-valprint.c (go_value_print_inner): New function.
	* go-lang.h (go_value_print_inner): Declare.
	* go-lang.c (go_language_defn): Use go_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 5f56f7cbd2 Convert Rust printing to value-based API
For Rust, it was simple to convert the printing code to the
value-based API all at once.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* rust-lang.c (val_print_struct, rust_print_enum): Use the value
	API.
	(rust_val_print): Rewrite.
	(rust_value_print_inner): New function, from rust_val_print.
	(rust_language_defn): Use rust_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 26792ee034 Introduce ada_value_print_inner
This introduces ada_value_print_inner.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* ada-valprint.c (ada_value_print_inner): New function.
	* ada-lang.h (ada_value_print_inner): Declare.
	* ada-lang.c (ada_language_defn): Use ada_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 24051bbe84 Introduce f_value_print_innner
This introduces f_value_print_innner.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* f-valprint.c (f_value_print_innner): New function.
	* f-lang.h (f_value_print_innner): Declare.
	* f-lang.c (f_language_defn): Use f_value_print_innner.
2020-03-13 18:03:40 -06:00
Tom Tromey c0941be613 Introduce pascal_value_print_inner
This introduces pascal_value_print_inner.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* p-valprint.c (pascal_value_print_inner): New function.
	* p-lang.h (pascal_value_print_inner): Declare.
	* p-lang.c (pascal_language_defn): Use pascal_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 62c4663d3c Introduce m2_value_print_inner
This introduces m2_value_print_inner.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* m2-valprint.c (m2_value_print_inner): New function.
	* m2-lang.h (m2_value_print_inner): Declare.
	* m2-lang.c (m2_language_defn): Use m2_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 6218219002 Introduce c_value_print_inner
This introduces c_value_print_inner, which implements the
la_value_print_inner method for the C family of languages.  In this
patch, it is just a simple wrapper of c_val_print.  However,
subsequent patches will convert it to use the value API.  The
transformation is done this way to make each patch easier to review.

Future patches will apply this same treatment to other languages as
well.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* opencl-lang.c (opencl_language_defn): Use c_value_print_inner.
	* objc-lang.c (objc_language_defn): Use c_value_print_inner.
	* c-valprint.c (c_value_print_inner): New function.
	* c-lang.h (c_value_print_inner): Declare.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Use
	c_value_print_inner.
2020-03-13 18:03:40 -06:00
Tom Tromey 1e592a8ae0 Make pascal_object_print_value_fields static
pascal_object_print_value_fields is only needed in p-valprint.c, so
make it static.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* p-valprint.c (pascal_object_print_value_fields): Now static.
	* p-lang.h (pascal_object_print_value_fields): Don't declare.
2020-03-13 18:03:40 -06:00
Tom Tromey 7fe471e9ae Simplify c_val_print_array
This slightly simplifies c_val_print_array by moving a variable to a
more inner scope and removing a dead assignment.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* c-valprint.c (c_val_print_array): Simplify.
2020-03-13 18:03:40 -06:00
Tom Tromey d121c6ce89 Introduce value_print_array_elements
This introduces value_print_array_elements, which is an analogue of
val_print_array_elements that uses the value API.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (value_print_array_elements): New function.
	* valprint.h (value_print_array_elements): Declare.
2020-03-13 18:03:40 -06:00
Tom Tromey 4dba70eee1 Two simple uses of value_print_scalar_formatted
A couple of spots could be easily converted to use
value_print_scalar_formatted.  This patch makes this change.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* printcmd.c (print_formatted): Use value_print_scalar_formatted.
	* mips-tdep.c (mips_print_register): Use
	value_print_scalar_formatted.
2020-03-13 18:03:40 -06:00
Tom Tromey 4f9ae81013 Introduce value_print_scalar_formatted
This introduces a value_print_scalar_formatted, which is an analogue
of val_print_scalar_formatted that uses the value API.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.h (value_print_scalar_formatted): Declare.
	* valprint.c (value_print_scalar_formatted): New function.
2020-03-13 18:03:40 -06:00
Tom Tromey 156bfec999 Introduce generic_value_print
This introduces generic_value_print, which is a value-based analogue
to generic_val_print.  For now this is unused and simply calls
generic_val_print, but subsequent patches will both change this
function to work using the value API directly, and convert callers of
generic_val_print to call this instead.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.h (generic_value_print): Declare.
	* valprint.c (generic_value_print): New function.
2020-03-13 18:03:40 -06:00
Tom Tromey 2b4e573d62 Introduce la_value_print_inner
The plan for removing val_print is, essentially, to first duplicate
printing code as needed to use the value API; and then remove the
val_print code.  This makes it possible to do the changes
incrementally while keeping everything working.

This adds a new la_value_print_inner function pointer to struct
language_defn.  Eventually this will replace la_val_print.  This patch
also changes printing to prefer this API, when available -- but no
language defines it yet.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

	* valprint.c (do_val_print): Call la_value_print_inner, if
	available.
	* rust-lang.c (rust_language_defn): Update.
	* p-lang.c (pascal_language_defn): Update.
	* opencl-lang.c (opencl_language_defn): Update.
	* objc-lang.c (objc_language_defn): Update.
	* m2-lang.c (m2_language_defn): Update.
	* language.h (struct language_defn) <la_value_print_inner>: New
	member.
	* language.c (unknown_language_defn, auto_language_defn): Update.
	* go-lang.c (go_language_defn): Update.
	* f-lang.c (f_language_defn): Update.
	* d-lang.c (d_language_defn): Update.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Update.
	* ada-lang.c (ada_language_defn): Update.
2020-03-13 18:03:39 -06:00