Kamil Rytarowski [Sat, 14 Mar 2020 12:38:30 +0000 (13:38 +0100)]
Add support for threads in vax_bsd_nat_target
ptrace(2) PT_GETREGS/PT_SETREGS accepts thread id (LWP) as the 4th
argument for threads.
gdb/ChangeLog:
* vax-bsd-nat.c (vaxbsd_supply_gregset): New variable lwp and pass
it to the ptrace call.
* vax-bsd-nat.c (vaxbsd_collect_gregset): Likewise.
Kamil Rytarowski [Sat, 14 Mar 2020 12:33:14 +0000 (13:33 +0100)]
Add explicit cast to fix build of vax-bsd-nat.c
gdb/ChangeLog:
* vax-bsd-nat.c (vaxbsd_supply_gregset): Cast gregs to const gdb_byte *.
* vax-bsd-nat.c (vaxbsd_collect_gregset): Cast gregs to void *.
Kamil Rytarowski [Sat, 14 Mar 2020 12:21:58 +0000 (13:21 +0100)]
Inherit vax_bsd_nat_target from nbsd_nat_target
gdb/ChangeLog:
* vax-bsd-nat.c (vax_bsd_nat_target): Inherit from nbsd_nat_target
instead of inf_ptrace_target.
* vax-bsd-nat.c: Include "nbsd-nat.h", as we are now using
nbsd_nat_target.
Kamil Rytarowski [Sat, 14 Mar 2020 11:54:47 +0000 (12:54 +0100)]
Define _KERNTYPES in mips-nbsd-nat.c
Fixes build on NetBSD. types.h does not define register_t by default.
gdb/ChangeLog:
* mips-nbsd-nat.c: Define _KERNTYPES to get the declaration of
register_t.
Kamil Rytarowski [Sat, 14 Mar 2020 11:51:15 +0000 (12:51 +0100)]
Define _KERNTYPES in ppc-nbsd-nat.c
Fixes build on NetBSD. types.h does not define register_t by default.
gdb/ChangeLog:
* ppc-nbsd-nat.c: Define _KERNTYPES to get the declaration of
register_t.
Kamil Rytarowski [Sat, 14 Mar 2020 11:20:01 +0000 (12:20 +0100)]
Define _KERNTYPES in vax-bsd-nat.c
Fixes build on NetBSD. types.h does not define register_t by default.
gdb/ChangeLog:
* vax-bsd-nat.c: Define _KERNTYPES to get the declaration of
register_t.
Kamil Rytarowski [Sat, 14 Mar 2020 10:50:43 +0000 (11:50 +0100)]
Include netbsd-core.lo for all arm/mips NetBSD targets
bfd/ChangeLog:
* configure.ac: Include netbsd-core.lo for all NetBSD arm and mips
targets.
* configure: Regenerated.
Alan Modra [Sat, 14 Mar 2020 08:28:11 +0000 (18:58 +1030)]
Re: asan: more readelf leaks
In git commit
fd486f32d15e I put some static variables used by
get_symbol_for_build_attribute in a file scope ba_cache struct. This
was to prevent leaks in get_symbol_for_build_attribute, and to tidy up
before readelf exited. The patch wasn't quite right though. When
readelf processes more than one file it was possible to double free
arrays allocated in get_symbol_for_build_attribute.
* readelf.c (process_file): Clean ba_cache.
Tom de Vries [Sat, 14 Mar 2020 09:41:46 +0000 (10:41 +0100)]
[gdb/testsuite] Fix unrecognized debug output level 'statement-frontiers' message
When running testcase gdb.cp/step-and-next-inline.exp, I get:
...
Running src/gdb/testsuite/gdb.cp/step-and-next-inline.exp ...
gdb compile failed, g++: error: unrecognized debug output level \
'statement-frontiers'
gdb compile failed, g++: error: unrecognized debug output level \
'statement-frontiers'
=== gdb Summary ===
# of untested testcases 2
...
Fix this by using a new gdb_caching_proc supports_statement_frontiers.
Tested on x86_64-linux, with gcc 7.5.0 (which does not support
-gstatement-frontiers) and with gcc 8.4.0 (which does support
-gstatement-frontiers).
gdb/testsuite/ChangeLog:
2020-03-14 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (supports_statement_frontiers): New proc.
* gdb.cp/step-and-next-inline.exp: Use supports_statement_frontiers.
Tom de Vries [Sat, 14 Mar 2020 09:17:10 +0000 (10:17 +0100)]
[gdb/testsuite] Fix FAIL in gdb.base/printcmds.exp
With test-case gdb.base/printcmds.exp, I run into:
...
(gdb) print teststring2^M
$563 = (charptr) "more contents"^M
(gdb) FAIL: gdb.base/printcmds.exp: print teststring2
...
The corresponding test is:
...
gdb_test "print teststring2" " = (charptr) \"more contents\""
...
Fix the FAIL by adding the missing quoting for the parentheses around charptr.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-03-14 Tom de Vries <tdevries@suse.de>
* gdb.base/printcmds.exp: Add missing quoting for "print
teststring2".
Alan Modra [Sat, 14 Mar 2020 01:20:22 +0000 (11:50 +1030)]
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.
Alan Modra [Sat, 14 Mar 2020 00:41:28 +0000 (11:11 +1030)]
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.
Alan Modra [Sat, 14 Mar 2020 04:17:15 +0000 (14:47 +1030)]
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.
Alan Modra [Sat, 14 Mar 2020 01:20:57 +0000 (11:50 +1030)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
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.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use common_val_print in c-valprint.c
This changes c_value_print to call common_val_print. This is more
complicated than the usual sort of common_val_print change, due to the
handling of RTTI.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* c-valprint.c (c_value_print): Use common_val_print.
gdb/testsuite/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* gdb.base/printcmds.exp (test_print_strings): Add regression
test.
* gdb.base/printcmds.c (charptr): New typedef.
(teststring2): New global.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use common_val_print in cp-valprint.c
This changes a spot in cp-valprint.c to use common_val_print rather
than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* cp-valprint.c (cp_print_static_field): Use common_val_print.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use common_val_print in f-valprint.c
This changes a couple spots in f-valprint.c to use common_val_print
rather than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* f-valprint.c (f77_print_array_1, f_val_print): Use
common_val_print.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use common_val_print in riscv-tdep.c
This changes some spots in riscv-tdep.c to use common_val_print rather
than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* riscv-tdep.c (riscv_print_one_register_info): Use
common_val_print.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use common_val_print in mi-main.c
This changes a spot in mi-main.c to use common_val_print rather than
val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (output_register): Use common_val_print.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use common_val_print in infcmd.c
This changes some spots in infcmd.c to use common_val_print (which,
despite its name, is a value-based API) rather than val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* infcmd.c (default_print_one_register_info): Use
common_val_print.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Introduce common_val_print_checked
A (much) later patch will remove the call to value_check_printable
from common_val_print. This will needed to preserve some details of
how optimized-out structures are printed.
However, doing this will also break dw2-op-out-param.exp. Making the
change causes "bt" to print:
However, the test wants to see:
... operand2=<optimized out>
That is, a wholly-optimized out structure should not print its fields.
So, this patch introduces a new common_val_print_checked, which calls
value_check_printable first, and then arranges to use it in the one
spot that affects the test suite.
I was not completely sure if it would be preferable to change the
test. However, I reasoned that, assuming this output was intentional
in the first place, in a backtrace space is at a premium and so this
is a reasonable approach. In other spots calling common_val_print,
this behavior is probably unintended, or at least a "don't care".
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.h (common_val_print_checked): Declare.
* valprint.c (common_val_print_checked): New function.
* stack.c (print_frame_arg): Use common_val_print_checked.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Refactor val_print and common_val_print
This changes val_print and common_val_print to use a new helper
function. A theme in the coming patches is that calls to val_print
itself should be removed. This is the first such patch; at the end of
the series, we'll remove val_print and simplify do_val_print.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (do_val_print): New function, from val_print.
(val_print): Use do_val_print.
(common_val_print): Use do_val_print.
Tom Tromey [Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)]
Use scoped_value_mark in value_print
Switching the low-level printing to use the value API means we will be
using more temporary values. This adds a scoped_value_mark to
value_print, so that these intermediates are destroyed in a timely
way.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (value_print): Use scoped_value_mark.
Andrew Burgess [Fri, 13 Mar 2020 23:28:46 +0000 (23:28 +0000)]
gdb/testsuite: Remove paths and make test names unique
Removes paths from some test names, and make the test names unique in
the gdb.base/break-interp.exp test file.
gdb/testsuite/ChangeLog:
* gdb.base/break-interp.exp: Use the tail of the filename, not the
full path in the test name.
(test_ld): Add some with_test_prefix blocks to make test names
unique.
Kamil Rytarowski [Fri, 13 Mar 2020 22:37:10 +0000 (23:37 +0100)]
Implement NT_NETBSDCORE_LWPSTATUS (NetBSD-Core)
bfd/ChangeLog:
* elf.c (elfcore_grok_netbsd_note): Add support for
NT_NETBSDCORE_LWPSTATUS notes.
binutils/ChangeLog:
* readelf.c (get_netbsd_elfcore_note_type): Add support for
NT_NETBSDCORE_LWPSTATUS notes.
include/ChangeLog:
* elf/common.h (NT_NETBSDCORE_LWPSTATUS): New define.
Kamil Rytarowski [Fri, 13 Mar 2020 20:27:40 +0000 (21:27 +0100)]
Register NT_NETBSDCORE_AUXV (NetBSD-Core)
* elf/common.h (NT_NETBSDCORE_AUXV): New define.
Christophe Lyon [Mon, 25 Nov 2019 08:55:37 +0000 (08:55 +0000)]
Add support for non-contiguous memory regions
2020-01-06 Christophe Lyon <christophe.lyon@linaro.org>
bfd/
* bfd-in2.h: Regenerate.
* section.c (asection): Add already_assigned field.
(BFD_FAKE_SECTION): Add default initializer for it.
* ecoff.c (bfd_debug_section): Initialize already_assigned field.
* elf32-arm.c (arm_build_one_stub): Add support for
non_contiguous_regions.
* elf32-csky.c (csky_build_one_stub): Likewise.
* elf32-hppa.c (hppa_build_one_stub): Likewise.
* elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
* elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
* elf32-metag.c (metag_build_one_stub): Likewise.
* elf32-nios2.c (nios2_build_one_stub): Likewise.
* elf64-ppc.c (ppc_build_one_stub): Likewise.
(ppc_size_one_stub): Likewise.
* elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
* elflink.c (elf_link_input_bfd): Likewise.
include/
* bfdlink.h (bfd_link_info): Add non_contiguous_regions and
non_contiguous_regions_warnings fields.
ld/
* ldlang.c (lang_add_section): Add support for
non_contiguous_regions.
(size_input_section): Likewise.
(lang_size_sections_1): Likewise.
(process_insert_statements): Likewise.
* ldlex.h (option_values): Add OPTION_NON_CONTIGUOUS_REGIONS and
OPTION_NON_CONTIGUOUS_REGIONS_WARNINGS.
* lexsup.c (ld_options): Add entries for
--enable-non-contiguous-regions and
--enable-non-contiguous-regions-warnings.
(parse_args): Handle it.
* NEWS: Add --enable-non-contiguous-regions and
--enable-non-contiguous-regions-warnings.
* ld.texi: Add --enable-non-contiguous-regions and
--enable-non-contiguous-regions-warnings documentation.
* emultempl/armelf.em (elf32_arm_add_stub_section): Add
SEC_LINKER_CREATED flag.
* emultempl/xtensaelf.em (ld_build_required_section_dependence):
Emit an error when --enable-non-contiguous-regions is used.
* testsuite/ld-elf/non-contiguous.d: New.
* testsuite/ld-elf/non-contiguous.ld: New.
* testsuite/ld-elf/non-contiguous.s: New.
* testsuite/ld-arm/arm-elf.exp: Run the new tests.
* testsuite/ld-arm/arm-elf/non-contiguous-arm.s: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm.d: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm.ld: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm2.d: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm3.ld: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm3.d: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm3.ld: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm4.d: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm4.ld: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm5.d: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm5.ld: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm6.d: New.
* testsuite/ld-arm/arm-elf/non-contiguous-arm6.ld: New.
* testsuite/ld-powerpc/powerpc.exp: Run new tests.
* testsuite/ld-powerpc/non-contiguous-powerpc.d: New.
* testsuite/ld-powerpc/non-contiguous-powerpc.ld: New.
* testsuite/ld-powerpc/non-contiguous-powerpc.sd: New.
* testsuite/ld-powerpc/non-contiguous-powerpc64.d: New.
H.J. Lu [Fri, 13 Mar 2020 14:34:56 +0000 (07:34 -0700)]
x86: Check static link of dynamic objects
On Linux/x86, when -static is passed to gcc, gcc passes it to linker
before all input files suitable for creating static executable. X86
linker will report error for dynamic input objects if -static is passed
at command-line before all input files without --dynamic-linker unless
--no-dynamic-linker is used.
bfd/
PR ld/24920
* elf-linker-x86.h (elf_linker_x86_params): Add
static_before_all_inputs and has_dynamic_linker.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
dynamic input objects if -static is passed at command-line
before all input files without --dynamic-linker unless
--no-dynamic-linker is used.
ld/
PR ld/24920
* emulparams/elf32_x86_64.sh: Use static.sh.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/static.sh: New file.
* emultempl/elf-x86.em: Include "ldlex.h".
* testsuite/ld-elf/pr24920.err: New file.
* testsuite/ld-elf/linux-x86.exp: Run ld/24920 tests.
Tom de Vries [Fri, 13 Mar 2020 14:38:19 +0000 (15:38 +0100)]
[gdb/testsuite] Fix buffer full errors in gdb.mi/mi-sym-info.exp
With debug info packages for system libs installed, I run into buffer full
errors with test-case gdb.mi/mi-sym-info.exp. Fix these using exp_continue.
This exposes timeouts due to gdb taking a long time before starting to print
output. Fix these using with_timeout_factor.
Tested on x86_64-linux, with make targets check and check-read1.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Fix buffer full errors, and timeouts.
Tom de Vries [Fri, 13 Mar 2020 13:43:03 +0000 (14:43 +0100)]
[gdb/testsuite] Fix mi-sym-info.exp matching FAILs (2)
With debug info packages for system libraries installed, I currently run into
some "internal buffer is full" errors with test-case gdb.mi/mi-sym-info.exp,
but if I disable the corresponding tests, I get further-on:
...
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching pattern f3 \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching type void \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: List all variables matching type float \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 1 \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 2 \
(unexpected output)
...
Fix this by making the matching more precise.
Tested on x86_64-linux.
Also tested with an extra:
...
mi_gdb_test "set debug-file-directory"
...
to prevent gdb from finding the debug info for system libraries.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Make matching more precise.
Andre Vieira [Fri, 13 Mar 2020 13:31:56 +0000 (13:31 +0000)]
gas, arm: PR25660L Fix vadd/vsub with lt and le condition codes for MVE
As explained in the PR, the addition of MVE makes the parser strip 't' and 'e'
as suffixes when MVE is enabled. This leads to vadd and vsub in it blocks with
lt and le conditions to be initially parsed as vaddl and vsubl. This means the
operand parsing for these must allow for the same operands as the scalar vadd
and vsub. I had forgotten to do this and this patch remedies that oversight.
gas/ChangeLog:
2020-03-13 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25660
* config/tc-arm.c (operand_parse_code): Add OP_RNSDMQR and OP_oRNSDMQ.
(parse_operands): Handle new operand codes.
(do_neon_dyadic_long): Make shape check accept the scalar variants.
(asm_opcode_insns): Fix operand codes for vaddl and vsubl.
* testsuite/gas/arm/mve-vaddsub-it.s: New test.
* testsuite/gas/arm/mve-vaddsub-it.d: New test.
* testsuite/gas/arm/mve-vaddsub-it-bad.s: New test.
* testsuite/gas/arm/mve-vaddsub-it-bad.l: New test.
* testsuite/gas/arm/mve-vaddsub-it-bad.d: New test.
* testsuite/gas/arm/nomve-vaddsub-it.d: New test.
Kamil Rytarowski [Fri, 13 Mar 2020 13:16:35 +0000 (14:16 +0100)]
Recognize aarch64 PT_GETREGS and PT_GETFPREGS notes on NetBSD
* elf.c (elfcore_grok_netbsd_note): Add support for aarch64.
Jan Beulich [Fri, 13 Mar 2020 08:57:10 +0000 (09:57 +0100)]
x86-64: correct mis-named X86_64_0D enumerator
This is for major opcode 0E, so name it accordingly.
Tom de Vries [Fri, 13 Mar 2020 07:50:51 +0000 (08:50 +0100)]
[gdb/symtab] Fix partial unit psymtabs
Consider test-case gdb.dwarf2/imported-unit.exp.
It contains a CU with type int:
...
<0><129>: Abbrev Number: 2 (DW_TAG_compile_unit)
<12a> DW_AT_language : 4 (C++)
<12b> DW_AT_name : imported_unit.c
<1><13b>: Abbrev Number: 3 (DW_TAG_base_type)
<13c> DW_AT_byte_size : 4
<13d> DW_AT_encoding : 5 (signed)
<13e> DW_AT_name : int
...
which is imported in another CU:
...
<0><d2>: Abbrev Number: 2 (DW_TAG_compile_unit)
<d3> DW_AT_language : 4 (C++)
<d4> DW_AT_name : <artificial>
<1><e1>: Abbrev Number: 3 (DW_TAG_imported_unit)
<e2> DW_AT_import : <0x129> [Abbrev Number: 2]
...
However, if we print the partial symbols:
...
$ gdb -batch imported-unit -ex "maint print psymbols"
...
we see type int both in the importing CU:
...
Partial symtab for source file <artificial>@0xc7 (object 0x29f9b80)
...
Depends on 1 other partial symtabs.
0 0x2a24240 imported_unit.c
Global partial symbols:
`main', function, 0x4004b2
Static partial symbols:
`int', type, 0x0
...
and in the imported CU:
...
Partial symtab for source file imported_unit.c (object 0x2a24240)
...
Depends on 0 other partial symtabs.
Shared partial symtab with user 0x29f9b80
Static partial symbols:
`int', type, 0x0
...
This is an artefact resulting from the fact that all CUs in an objfile
share the same storage array for static partial symbols (and another array for
global partial symbols), using a range to describe their symbols.
Then when scanning the partial symbols of a CU and encountering an import, either:
- the referred CU has not been parsed yet, and will be parsed, and the range of
static partial symbols of the referred CU will be a subrange of the range of
static partial symbols of this CU, or
- the referred CU has already been parsed, and the range of static partial
symbols of the referred CU will not be a subrange of the range of static
partial symbols of this CU.
This is inconsistent handling, and confuses the notion of a symbol belonging to
a single symtab.
Furthermore, it might slow down searches, given that the symbol needs to be
skipped twice.
Finally, the same issue holds for global partial symbols, where the range of a
CU is sorted after parsing is finished. Obviously sorting the range of a CU
may invalidate subranges, effectively moving symbols in and out of imported
CUs.
Fix this for both static and global partial symbols, by gathering partial
symbols in a per-CU vector, and adding those symbols to the per-objfile
storage only once complete.
Tested on x86_64-linux, with native and board cc-with-dwz and cc-with-dwz-m.
gdb/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
PR symtab/25646
* psymtab.c (partial_symtab::partial_symtab): Don't set
globals_offset and statics_offset. Push element onto
current_global_psymbols and current_static_psymbols stacks.
(concat): New function.
(end_psymtab_common): Set globals_offset and statics_offset. Pop
element from current_global_psymbols and current_static_psymbols
stacks. Concat popped elements to global_psymbols and
static_symbols.
(add_psymbol_to_list): Use current_global_psymbols and
current_static_psymbols stacks.
* psymtab.h (class psymtab_storage): Add current_global_psymbols and
current_static_psymbols fields.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
PR symtab/25646
* gdb.dwarf2/imported-unit.exp: Add test.
Christian Eggers [Mon, 2 Mar 2020 20:17:00 +0000 (20:17 +0000)]
Fix several mix up between octets and bytes in ELF program headers
Fixes additional locations not handled in the first patch.
When converting between addresses in ELF headers [octets] and bfd
LMA/VMA [bytes], the number of octets per byte needs to be incorporated.
include/
* bfdlink.h (struct bfd_link_order): Add unit (bytes/octets) to
offset and size members.
* elf/internal.h (struct elf_internal_phdr): Likewise for
p_align member.
(struct elf_segment_map): Likewise for p_paddr and p_size
members
bfd/
* bfd.c (bfd_record_phdr): New local "opb". Fix assignment of
"p_paddr" from "at".
* elfcode.h (bfd_from_remote_memory): Add units to several
parameters. New local "opb". Fix usage of p_align. Fix
calculation of "localbase" from "ehdr_vma" and "p_vaddr". Fix
call of target_read_memory.
* elflink.c (elf_fixup_link_order): Fix scope of "s" local. Fix
calculation of "offset" and "output_offset".
(bfd_elf_final_link): New local "opb". Fix calculation of "size"
from "offset" and fix calculation of "end" from "vma+size". Fix
comparison between "sh_addr" and "vma"/"output_offset".
(bfd_elf_discard_info): Fix calculation of "eh_alignment".
* elf-bfd.h (struct elf_link_hash_table): Add unit to tls_size
member.
* elf.c (_bfd_elf_map_sections_to_segments): Add unit (bytes/
octets) to "wrap_to2 and "phdr_size" locals. Fix calculation of
"wrap_to" value. Add unit (bytes) to phdr_lma variable. Fix
assignment of p_paddr from phdr_lma. Fix comparison between
"lma+size" and "next->lma".
(elf_sort_segments): Fix assignment from p_paddr to lma.
(assign_file_positions_for_load_sections): Add unit (bytes) to
local "align". Fix calculation of local "off_adjust". Fix
calculation of local "filehdr_vaddr".
(assign_file_positions_for_non_load_sections): New local "opb".
Fix calculation of "end" from "p_size". Fix comparison between
"vma+SECTION_SIZE" and "start". Fix calculation of "p_memsz"
from "end" and "p_vaddr".
(rewrite_elf_program_header): Fix comparison between p_vaddr and
vma. Fix assignment to p_paddr from lma. Fix comparison between
p_paddr and lma. Fix assignment to p_paddr from lma.
* merge.c (sec_merge_emit): New local "opb". Convert
"alignment_power" to octets.
(_bfd_add_merge_section): New locals "alignment_power" and
"opb". Fix comparison between "alignment_power" and
"sizeof(align)".
(_bfd_merge_sections): New local "opb". Divide size by opb
before checking align mask.
Christian Eggers [Mon, 2 Mar 2020 20:11:00 +0000 (20:11 +0000)]
Fix several mix up between octets and bytes in ELF program headers
When converting between addresses in ELF headers [octets] and bfd
LMA/VMA [bytes], the number of octets per byte needs to be
incorporated.
In ld, the SIZEOF_HEADERS linker script statement must be resolved to
bytes instead of octets.
include/
* elf/internal.h (struct elf_internal_phdr): Add unit (octets)
to several member field comments.
(Elf_Internal_Shdr): likewise.
bfd/
* elf.c (_bfd_elf_make_section_from_shdr): Introduce new temp
opb. Divide Elf_Internal_Shdr::sh_addr by opb when setting
section LMA/VMA.
(_bfd_elf_make_section_from_phdr): Similarly.
(elf_fake_sections): Fix calculation of
Elf_Internal_shdr::sh_addr from section VMA.
(_bfd_elf_map_sections_to_segments): Fix mixup between octets
and bytes.
(assign_file_positions_for_load_sections): Fix calculations of
Elf_Internal_shdr::p_vaddr and p_paddr from section LMA/VMA. Fix
comparison between program header address and section LMA.
(assign_file_positions_for_non_load_sections): Likewise.
(rewrite_elf_program_header): Likewise. Introduce new temp opb.
(IS_CONTAINED_BY_VMA): Add parameter opb.
(IS_CONTAINED_BY_LMA,IS_SECTION_IN_INPUT_SEGMENT,
INCLUDE_SECTION_IN_SEGMENT): Likewise.
(copy_elf_program_header): Update call to ELF_SECTION_IN_SEGMENT.
Fix calculations of p_addr_valid and p_vaddr_offset.
* elflink.c (elf_link_add_object_symbols): Multiply section VMA
with octets per byte when comparing against p_vaddr.
ld/
* ldexp.c (fold_name): Return SIZEOF_HEADERS in bytes.
Alan Modra [Fri, 13 Mar 2020 02:51:15 +0000 (13:21 +1030)]
asan: more readelf leaks
* elfcomm.c (get_archive_member_name): Always return malloc'd
string or NULL.
* elfedit.c (process_archive): Tidy memory on all return paths.
* readelf.c (process_archive): Likewise.
(process_symbol_table): Likewise.
(ba_cache): New, replacing ..
(get_symbol_for_build_attribute): ..static vars here. Free
strtab and symtab before loading new ones. Reject symtab without
valid strtab in loop, breaking out of loop on valid symtab.
(process_file): Free ba_cache symtab and strtab here, resetting
ba_cache.
Tom de Vries [Thu, 12 Mar 2020 23:41:44 +0000 (00:41 +0100)]
[gdb/testsuite] Fix mi-sym-info.exp matching FAILs
When running gdb.mi/mi-sym-info.exp on openSUSE Leap 15.1, I get:
...
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching type void \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-variables --max-results 3 \
(unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-types --max-results 4 \
(unexpected output)
...
The executable contains debug info from files other than the source files:
...
$ readelf -wi mi-sym-info | grep "DW_AT_name.*\.[cS]$" | awk '{print $8}'
../sysdeps/x86_64/start.S
init.c
../sysdeps/x86_64/crti.S
src/gdb/testsuite/gdb.mi/mi-sym-info-1.c
src/gdb/testsuite/gdb.mi/mi-sym-info-2.c
elf-init.c
../sysdeps/x86_64/crtn.S
...
The test does not expect this extra info, resulting in matching failures.
Fix this by restricting the failing commands using --name.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info-2.c (another_char_t, another_short_t): New typedef.
(var1, var2): New variable.
* gdb.mi/mi-sym-info.exp: Add --name to various commands to restrict
matching symbols.
Tom de Vries [Thu, 12 Mar 2020 23:31:15 +0000 (00:31 +0100)]
[gdb/testsuite] Fix check-read1 FAIL in gdb.tui/corefile-run.exp
With test-case gdb.tui/corefile-run.exp and make target check-read1, I run
into:
...
FAIL: gdb.tui/corefile-run.exp: run until the end
...
In more detail, using -v:
...
PASS: gdb.tui/corefile-run.exp: load corefile
^M+++ _ctl_0x0d
^[[17d+++ _csi_d <<<17>>>
^[[M+++ _csi_M <<<>>>
^[[24d+++ _csi_d <<<24>>>
(INSERT <<(>>
gINSERT <<g>>
dINSERT <<d>>
bINSERT <<b>>
)INSERT <<)>>
INSERT << >>
FAIL: gdb.tui/corefile-run.exp: run until the end
...
With some debugging code added in wait_for, what happens becomes more clear:
...
if {[regexp -- $wait_for $prev]} {
+ verbose -log "\nwait_for: MATCHED line ($_cur_y): \"$prev\""
+ verbose -log "wait_for: AGAINST regexp: \"$wait_for\""
...
In corefile-run.exp, we execute:
...
Term::command "run"
...
and in proc Term::command, we send the command, and then call wait_for:
...
proc command {cmd} {
send_gdb "$cmd\n"
wait_for [string_to_regexp $cmd]
}
...
which first waits for the command string, and then for the prompt.
In this case however, the matching of the command string triggers on a
previous line:
...
wait_for: MATCHED line (16): \
"(gdb) core-file corefile-run.core[New LWP 6426] <lots-of-spaces>"
wait_for: AGAINST regexp: "run"
...
and from there on things go out of sync, eventually resulting in the FAIL.
Fix this in proc command by more precisely specifying the expected pattern:
adding a ^$gdb_prompt prefix.
Add a command_no_prompt_prefix variant to use for initial terminal commands
where there's no prompt yet.
Tested gdb.tui/*.exp on x86_64-linux, with make target check and check-read1.
gdb/testsuite/ChangeLog:
2020-03-13 Tom de Vries <tdevries@suse.de>
* lib/tuiterm.exp (Term::command_no_prompt_prefix): New proc.
(Term::command): Use prompt prefix.
(Term::enter_tui): Use command_no_prompt_prefix instead of prefix.
* gdb.tui/tui-layout-asm-short-prog.exp: Use
command_no_prompt_prefix instead of prefix.
* gdb.tui/tui-layout-asm.exp: Same.
Christian Biesinger [Fri, 6 Mar 2020 21:21:28 +0000 (15:21 -0600)]
Remove deprecated core file functions
There are no more callers to deprecated_add_core_fns, now that I have
removed the usage from CRIS and ARM/NetBSD. So this patch cleans up
all the related code and makes corelow.c a lot more readable.
gdb/ChangeLog:
2020-03-12 Christian Biesinger <cbiesinger@google.com>
* corelow.c (sniff_core_bfd): Remove.
(class core_target) <m_core_vec>: Remove.
(core_target::core_target): Update.
(core_file_fns): Remove.
(deprecated_add_core_fns): Remove.
(default_core_sniffer): Remove.
(sniff_core_bfd): Remove.
(default_check_format): Remove.
(gdb_check_format): Remove.
(core_target_open): Update.
(core_target::get_core_register_section): Update.
(get_core_registers_cb): Update.
(core_target::fetch_registers): Update.
* gdbcore.h (struct core_fns): Remove.
(deprecated_add_core_fns): Remove.
(default_core_sniffer): Remove.
(default_check_format): Remove.
Tom Tromey [Thu, 12 Mar 2020 19:32:15 +0000 (13:32 -0600)]
Change gdbserver to use existing gdbsupport
This changes the gdbserver build to use the gdbsupport that was built
for gdb.
gdbserver and gdbreplay now must use WIN32APILIBS (aka -lws2_32).
Before this change, gdbserver did not define USE_WIN32API when
building gdbsupport, but now this is always done.
ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def (gdbserver): Depend on gdbsupport.
gdbserver/ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac (GDBSERVER_DEPFILES): Remove srv_selftest_objs.
(WIN32APILIBS): New subst.
* Makefile.in (SFILES, OBS, TAGS, GDBREPLAY_OBS): Remove
gdbsupport files.
(gdbsupport/%.o): Remove target.
(GDBSUPPORT_BUILDDIR, GDBSUPPORT): New variables.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Add GDBSUPPORT.
(WIN32APILIBS): New variable.
(gdbserver$(EXEEXT)): Add WIN32APILIBS.
(gdbreplay$(EXEEXT)): Likewise.
Tom Tromey [Thu, 12 Mar 2020 19:32:15 +0000 (13:32 -0600)]
Change gdbsupport not to rely on BFD
This changes gdbsupport so that it no longer relies on BFD. This is a
precursor to making gdbserver use the already-built gdbsupport,
because building gdbserver should not require BFD to be built.
The most notable change here is that CORE_ADDR is always a 64-bit
type. This makes it so that gdb acts as if it were always built in
64-bit mode.
ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def (gdbsupport): Don't depend on bfd.
gdbsupport/ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* common-types.h: Remove GDBSERVER code.
(gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Redefine.
* common-defs.h: Remove GDBSERVER code.
Tom Tromey [Thu, 12 Mar 2020 19:32:15 +0000 (13:32 -0600)]
Fix gdbserver build when intl already built
gdbserver uses gdb's alloc.c, and this in turn can include headers
from intl via gdbsupport/gdb_locale.h. This can cause build failures
in some situations, for example if you build gdb and gdbserver on
mingw.
This patch restores the gdbsupport dependency on intl, and changes
gdbserver to use ZW_GNU_GETTEXT_SISTER_DIR. This fixes this build
problem.
ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def (gdbsupport): Depend on intl.
gdbserver/ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* config.in, configure: Rebuild.
* configure.ac: Call ZW_GNU_GETTEXT_SISTER_DIR.
* acinclude.m4: Include gettext-sister.m4.
* Makefile.in (top_builddir, INTL, INTL_DEPS, INTL_CFLAGS): New
variables.
(INCLUDE_CFLAGS): Add INTL_CFLAGS.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Use INTL_DEPS, INTL.
Tom Tromey [Thu, 12 Mar 2020 19:32:15 +0000 (13:32 -0600)]
Cast to bfd_vma in arm-tdep.c
Some arm-tdep.c data structures use a bfd_vma. A couple of spots will
warn about an implicit narrowing cast when building a gdb where
CORE_ADDR is 64-bit but bfd_vma is 32-bit.
This patch silences these warnings by changing the types in question
to CORE_ADDR.
gdb/ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* arm-tdep.c (struct arm_mapping_symbol) <value>: Now a
CORE_ADDR.
(struct arm_exidx_entry) <addr>: Now a CORE_ADDR.
Tom Tromey [Thu, 12 Mar 2020 19:32:15 +0000 (13:32 -0600)]
Don't use sprintf_vma for CORE_ADDR
A few spots in gdb use sprintf_vma to print a CORE_ADDR. This will
fail on a 32-bit build once CORE_ADDR is always a 64-bit type.
This patch replaces these calls with phex instead.
gdb/ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* remote.c (remote_target::download_tracepoint)
(remote_target::enable_tracepoint)
(remote_target::disable_tracepoint): Use phex, not sprintf_vma.
* breakpoint.c (print_recreate_masked_watchpoint): Use phex, not
sprintf_vma.
Tom Tromey [Thu, 12 Mar 2020 19:32:15 +0000 (13:32 -0600)]
Fix CORE_ADDR size assertion in symfile-mem.c
symfile-mem.c has some assertions about the size of various types, to
ensure that gdb and BFD don't get out of sync in a way that would
cause bugs.
Once CORE_ADDR is always 64-bit, one of these assertions can fail for
a 32-bit BFD build. However, the real requirement here is just that
CORE_ADDR is wider -- because this code promotes a bfd_vma to a
CORE_ADDR.
This patch corrects the assert.
gdb/ChangeLog
2020-03-12 Tom Tromey <tom@tromey.com>
* symfile-mem.c: Update CORE_ADDR size assert.
Simon Marchi [Thu, 12 Mar 2020 18:34:22 +0000 (14:34 -0400)]
gdb: use foreach_with_prefix in gdb.base/break-interp.exp
Use foreach_with_prefix, instead of foreach and with_test_prefix
separately. Since allows removing some indentation levels, and formats
the test names a bit nicer, in my opinion (or at least, it's more
consistent with the rest of the testsuite):
- PASS: gdb.base/break-interp.exp: LDprelinkNOdebugNO: BINprelinkNOdebugNOpieNO: INNER: core: set verbose on
+ PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: binprelink=NO: binsepdebug=NO: binpie=NO: INNER: set verbose on
Note: this patch is better viewed with "git show -w" to ignore
whitespace changes.
gdb/testsuite/ChangeLog:
* gdb.base/break-interp.exp: Use foreach_with_prefix.
Simon Marchi [Thu, 12 Mar 2020 18:22:23 +0000 (14:22 -0400)]
gdb: make gdb.arch/amd64-disp-step-avx.exp actually test displaced stepping
The test gdb.arch/amd64-disp-step-avx.exp is meant to test that doing a
displaced step of an AVX instruction works correctly. However, I found
(by pure coincidence) that the test instructions are not actually
displaced stepped. Rather, they are inline-stepped, so the test is not
actually testing what it's meant to test.
This is what a portion of the test binary looks like:
0000000000400180 <_start>:
400180: 90 nop
0000000000400181 <main>:
400181: 90 nop
0000000000400182 <test_rip_vex2>:
400182: c5 fb 10 05 0e 00 00 vmovsd 0xe(%rip),%xmm0 # 400198 <ro_var>
400189: 00
000000000040018a <test_rip_vex2_end>:
40018a: 90 nop
The instruction at 0x400182 is the one we want to test a displaced step
for. A breakpoint is placed at 0x400182 and ran to. The execution is
then resumed from there, forcing a step-over (which should normally be a
displaced step) of the breakpoint.
However, the displaced stepping buffer is at the _start label, and that
means a breakpoint is present in the displaced stepping buffer. The
breakpoint_in_range_p check in displaced_step_prepare_throw evaluates to
true, which makes displaced_step_prepare_throw fail, forcing GDB to fall
back on an in-line step.
This can be easily observed by placing a `gdb_assert (false)` inside the
breakpoint_in_range_p condition, in displaced_step_prepare_throw, and
running gdb.arch/amd64-disp-step-avx.exp. The assertion will make the
test fail.
The proposed fix is to pad `_start` with a bunch of nops so that the
test instruction is out of the displaced step buffer.
I also think it would be good to enhance the test to make sure that we
are testing displaced stepping as intended. I did that by enabling "set
debug displaced on" while we step over the interesting instruction, and
matching a message printed only when a displaced step is executed.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-disp-step-avx.S: Add nops after _start.
* gdb.arch/amd64-disp-step-avx.exp: Enable "set debug displaced
on" while stepping over the test instruction, match printed
message.
Simon Marchi [Thu, 12 Mar 2020 18:19:38 +0000 (14:19 -0400)]
Move gdb/selftest.m4 to gdbsupport/selftest.m4
The selftest.m4 file is used by gdb, gdbserver and gdbsupport, I think
it belongs in gdbsupport.
gdb/ChangeLog:
* selftest.m4: Move to gdbsupport/.
* acinclude.m4: Update path to selftest.m4.
gdbserver/ChangeLog:
* acinclude.m4: Update path to selftest.m4.
gdbsupport/ChangeLog:
* selftest.m4: Moved from gdb/.
* acinclude.m4: Update path to selftest.m4.
Simon Marchi [Thu, 12 Mar 2020 18:18:21 +0000 (14:18 -0400)]
Don't include selftests objects in build when unit tests are disabled
While working on the preceding selftests patches, I noticed that some
selftests-specific files are included in the build even when selftests
are disabled, namely disasm-selftest.c and gdbarch-selftests.c. These
files are entirely #if'ed out when building with selftests disabled.
This is not a huge problem, but I think it would make more sense if
these files were simply not built.
With this patch, I propose to put all the selftests-specific source
files into a SELFTESTS_SRCS Makefile variable (even selftest-arch.c,
which is currently added by the configure script).
gdb/ChangeLog:
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Rename to...
(SELFTESTS_SRCS): ... this. Add disasm-selftests.c,
gdbarch-selfselftests.c and selftest-arch.c.
(SUBDIR_UNITTESTS_OBS): Rename to...
(SELFTESTS_OBS): ... this.
(COMMON_SFILES): Remove disasm-selftests.c and
gdbarch-selftests.c.
* configure.ac: Don't add selftest-arch.{c,o} to
CONFIG_{SRCS,OBS}.
* disasm-selftests.c, gdbarch-selftests.c: Remove GDB_SELF_TEST
preprocessor conditions.
Simon Marchi [Thu, 12 Mar 2020 18:18:00 +0000 (14:18 -0400)]
Move sourcing of development.sh to GDB_AC_COMMON
The same is done for gdb, gdbserver and gdbsupport. I therefore think
it makes sense to move that to GDB_AC_COMMON.
It is required to move the call to GDB_AC_COMMON so it is before
GDB_AC_SELFTEST in gdbserver/configure.ac, otherwise the $development
variable isn't set when the code behind GDB_AC_SELFTEST executes.
gdb/ChangeLog:
* configure.ac: Don't source bfd/development.sh.
* selftest.m4: Modify comment.
* configure: Re-generate.
gdbserver/ChangeLog:
* configure.ac: Don't source bfd/development.sh, move
GDB_AC_COMMON higher.
* configure: Re-generate.
gdbsupport/ChangeLog:
* configure.ac: Don't source bfd/development.sh.
* common.m4: Source bfd/development.sh.
* configure: Re-generate.
Simon Marchi [Thu, 12 Mar 2020 18:12:36 +0000 (14:12 -0400)]
gdb/selftest.m4: ensure $development is set
Before commit
3d1e5a43cbe ("gdbsupport/configure.ac: source
development.sh"), the GDB build in non-development mode (turn
development to false in bfd/development.sh if you want to try) was
broken because the gdbsupport configure script didn't source
bfd/development.sh to set the development variable.
Since the GDB_AC_SELFTEST macro relies on the `development` variable, I
propose to modify it such that it errors out if $development does not
have an expected value of "true" or "false". This could prevent a
future similar problem from happening while refactoring the configure
scripts. It would have caught the problem fixed by the patch mentioned
earlier.
gdb/ChangeLog:
* selftest.m4 (GDB_AC_SELFTEST): Error out if $development is
not "true" or "false".
* configure: Re-generate.
gdbserver/ChangeLog:
* configure: Re-generate.
gdbsupport/ChangeLog:
* configure: Re-generate.
Christian Biesinger [Thu, 5 Mar 2020 21:32:54 +0000 (15:32 -0600)]
Remove use of deprecated core functions (in NetBSD/ARM)
This is in preparation for deleting deprecated_add_core_fns and
related code.
As a side-effect, this makes it possible to read NetBSD/ARM
core files on non-NetBSD/ARM platforms, subject to PR corefiles/25638.
I have removed this comment:
- /* This is ok: we're running native... */
Since we are using the gdbarch from the regcache, we should be
guaranteed to be calling the right function here, so it shouldn't
matter whether we are running native.
Tested by reading a NetBSD/ARM core file on Linux/x86-64 and NetBSD/ARM;
the "info registers" output matches the one from the system GDB.
gdb/ChangeLog:
2020-03-12 Christian Biesinger <cbiesinger@google.com>
* Makefile.in (HFILES_NO_SRCDIR): Add new arm-nbsd-tdep.h file.
* arm-nbsd-nat.c (arm_supply_gregset): Moved to arm-nbsd-tdep and
renamed to arm_nbsd_supply_gregset.
(fetch_register): Update to call arm_nbsd_supply_gregset.
(fetch_regs): Remove in favor of fetch_register with a -1 regno.
(arm_netbsd_nat_target::fetch_registers): Update.
(fetch_elfcore_registers): Removed.
(_initialize_arm_netbsd_nat): Removed call to deprecated_add_core_fns.
* arm-nbsd-tdep.c (struct arm_nbsd_reg): New struct.
(arm_nbsd_supply_gregset): Moved from arm-nbsd-nat.c and updated to
not require NetBSD system headers.
(arm_nbsd_regset): New struct.
(arm_nbsd_iterate_over_regset_sections): New function.
(arm_netbsd_init_abi_common): Updated to call
set_gdbarch_iterate_over_regset_sections.
* arm-nbsd-tdep.h: New file.
Kamil Rytarowski [Thu, 12 Mar 2020 14:51:26 +0000 (15:51 +0100)]
sim: ppc: netbsd: Sync signal names with NetBSD 9.99.49
sim/ppc/ChangeLog:
* emul_netbsd.c (netbsd_signal_names): Sync with NetBSD 9.99.49.