Mike Frysinger [Tue, 23 Jun 2015 16:32:47 +0000 (22:17 +0545)]
sim: common: add align_{up,down} to match gdb
We have ALIGN_{8,16,PAGE} and FLOOR_PAGE macros (where PAGE is defined as
4k) which were imported from the ppc sim. But no other sim utilizes these
and hardcoding the sizes in the name is a bit limiting.
Let's delete these and import the two general macros that gdb uses:
align_up(addr, bytes)
align_down(addr, bytes)
This in turn allows us to cut over the Blackfin code immediately.
GDB Administrator [Sun, 3 Jan 2021 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Hannes Domani [Sat, 2 Jan 2021 16:35:25 +0000 (17:35 +0100)]
Fix pretty printer of main_type.flds_bnds.bounds
In struct dynamic_prop the members kind and data were renamed to m_kind and
m_data.
And flag_upper_bound_is_count is actually in bounds directly, not in its
high member.
gdb/ChangeLog:
2021-01-02 Hannes Domani <ssbssa@yahoo.de>
* gdb-gdb.py.in: Fix main_type.flds_bnds.bounds pretty printer.
GDB Administrator [Sat, 2 Jan 2021 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Fri, 1 Jan 2021 08:08:28 +0000 (12:08 +0400)]
Manual updates of copyright year range not covered by gdb/copyright.py
gdb/ChangeLog:
* gdbarch.sh: Update copyright year range.
gdb/doc/ChangeLog:
* gdb.texinfo, refcard.tex: Update copyright year range.
Joel Brobecker [Fri, 1 Jan 2021 08:03:39 +0000 (12:03 +0400)]
Update copyright year range in all GDB files
This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...
gdb/ChangeLog
Update copyright year range in copyright header of all GDB files.
Joel Brobecker [Fri, 1 Jan 2021 07:56:12 +0000 (11:56 +0400)]
gdb/copyright.py: Also update sources in "gdbserver" and "gdbsupport"
This commit adjusts GDB's copyright.py script, following two past changes:
- gdb/gdbserver/ being move to the toplevel directory;
- gdb/common/ being renamed to gdbsupport/.
gdb/ChangeLog:
* copyright.py (get_update_list): Add "gdbserver" and "gdbsupport"
to the list of directories to update.
Joel Brobecker [Fri, 1 Jan 2021 07:53:14 +0000 (11:53 +0400)]
Update copyright year in version message for gdb, gdbserver and gdbreplay
gdb/ChangeLog:
* top.c (print_gdb_version): Update copyright year.
gdbserver/ChangeLog:
* server.cc (gdbserver_version): Update copyright year.
* gdbreplay.cc (gdbreplay_version): Likewise.
Joel Brobecker [Fri, 1 Jan 2021 07:45:58 +0000 (11:45 +0400)]
Rotate gdb/ChangeLog
As a results of the rotation, this introduces a new file which
needed to be added to DJGPP's fnchange.lst.
gdb/ChangeLog
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2020.
Alan Modra [Fri, 1 Jan 2021 03:51:52 +0000 (14:21 +1030)]
PR27116, Spelling errors found by Debian style checker
PR 27116
bfd/
* xcofflink.c: Correct spelling in comments.
binutils/
* coffgrok.c (do_type): Correct spelling of auxiliary in errors.
* doc/binutils.texi: Correct grammar.
* readelf.c (process_version_sections): Correct spelling of auxiliary
in warning.
* testsuite/binutils-all/vax/objdump.exp: Comment grammar fix.
config/
* override.m4: Correct comment grammar.
gas/
* config/tc-i386.c: Correct comment spelling.
* config/tc-riscv.c: Likewise.
* config/tc-s390.c: Correct comment grammar.
* doc/c-i386.texi: Correct spelling.
* doc/c-s390.texi: Correct grammar.
gold/
* tilegx.cc: Correct comment spelling.
gprof/
* README: Correct grammar.
* gprof.texi: Likewise.
include/
* coff/internal.h: Correct comment spelling.
* coff/sym.h: Likewise.
* opcode/aarch64.h: Likewise.
ld/
* configure.tgt: Correct comment grammar.
* emultempl/m68hc1xelf.em: Likewise.
* ld.texi: Correct grammar.
Alan Modra [Thu, 31 Dec 2020 22:58:58 +0000 (09:28 +1030)]
Update year range in copyright notice of binutils files
Alan Modra [Thu, 31 Dec 2020 22:53:40 +0000 (09:23 +1030)]
Add libctf to update-copyright.py
Alan Modra [Thu, 31 Dec 2020 22:47:13 +0000 (09:17 +1030)]
ChangeLog rotation
GDB Administrator [Fri, 1 Jan 2021 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Hans-Peter Nilsson [Thu, 31 Dec 2020 23:47:36 +0000 (00:47 +0100)]
gas: Change to "swym 0" as canonical nop insn for MMIX
While "set $0, $0" works, that's not the documented instruction to do
nothing for MMIX. However, I'm not changing it for "nop_type 5" as
seen in gas.exp and org-1.s, because "set $0, $0" seems like it could
be re-used there, for some future ISA.
gas/
* config/tc-mmix.h (md_single_noop_insn): Change to "swym 0".
Tom Tromey [Thu, 31 Dec 2020 21:55:27 +0000 (14:55 -0700)]
Update gdb.rust tests for Rust 1.49
Rust 1.49 was released today, and it includes some library changes
which caused some gdb.rust tests to fail. This patch adapts the test
suite to the new output. I also verified that this continues to work
with Rust 1.48.
gdb/testsuite/ChangeLog
2020-12-31 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Update output for Rust 1.49.
Alan Modra [Wed, 30 Dec 2020 11:30:57 +0000 (22:00 +1030)]
PR27128, nm -P portable output format regression
binutils/
PR 27128
* nm.c (print_symname): Append version string to symbol name
before printing the lot under control of "form". Append version
to demangled names too.
ld/
PR 27128
* testsuite/ld-elf/pr27128.s: New file.
* testsuite/ld-elf/pr27128.t: Likewise.
* testsuite/ld-elf/pr27128a.d: Likewise.
* testsuite/ld-elf/pr27128b.d: Likewise.
* testsuite/ld-elf/pr27128c.d: Likewise.
* testsuite/ld-elf/pr27128d.d: Likewise.
* testsuite/ld-elf/pr27128e.d: Likewise.
Bernd Edlinger [Tue, 3 Nov 2020 17:41:43 +0000 (18:41 +0100)]
Fix passing debug options for gcc
Fix a bug in the test where we were missing "additional_flags=",
causing -gstatement-frontiers not to be passed to the compiler.
The issue was introduced in
eb24648c453c28f2898fb599311ba004394a8b41 ("Fix gdb.cp/step-and-next-inline.exp with Clang").
gdb/testsuite:
2020-12-31 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gdb.cp/step-and-next-inline.exp: Fix test case.
Simon Marchi [Thu, 31 Dec 2020 04:45:36 +0000 (23:45 -0500)]
gdb/testsuite: de-duplicate test names in gdb.python/py-frame-args.exp
Use with_test_prefix to de-duplicate test names.
gdb/testsuite/ChangeLog:
* gdb.python/py-frame-args.exp: De-duplicate test names.
Change-Id: I5cc8bee692a0d071cb78258aca80ea642e00e7a8
Pavel I. Kryukov [Thu, 31 Dec 2020 04:14:36 +0000 (08:14 +0400)]
sim/mips/sim-main.c: Include <stdlib.h> (for abort() declaration)
sim/mips/ChangeLog:
* sim-main.c: Include <stdlib.h>.
GDB Administrator [Thu, 31 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 30 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 29 Dec 2020 18:37:24 +0000 (10:37 -0800)]
elfedit: Pass osabi to reconcat
Pass osabi to reconcat to get
Usage: elfedit <option(s)> elffile(s)
...
--input-osabi [none|HPUX|NetBSD|GNU|Linux|Solaris|AIX|Irix|FreeBSD|TRU64|Modesto|OpenBSD|OpenVMS|NSK|AROS|FenixOS]
Set input OSABI
instead of
--input-osabi [|FenixOS]
Set input OSABI
* elfedit (usage): Pass osabi to reconcat.
Hannes Domani [Tue, 29 Dec 2020 16:18:22 +0000 (17:18 +0100)]
Fix wrong method name
The objects returned by FrameDecorator.frame_args need to implement a
method named symbol, not argument.
gdb/doc/ChangeLog:
2020-12-29 Hannes Domani <ssbssa@yahoo.de>
* python.texi (Frame Decorator API): Fix method name.
GDB Administrator [Tue, 29 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 28 Dec 2020 18:44:28 +0000 (10:44 -0800)]
binutils: Use the newly built assembler and linker
Use the newly built assembler and linker in test_gnu_debuglink by passing
$gcc_gas_flag to target_compile.
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Pass
$gcc_gas_flag to target_compile.
GDB Administrator [Mon, 28 Dec 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 27 Dec 2020 20:36:55 +0000 (13:36 -0700)]
Simplify MULTI_SUBSCRIPT implementation
The MULTI_SUBSCRIPT code in evaluate_subexp_standard has a comment
saying that perhaps the EVAL_SKIP handling is incorrect. This patch
simplifies this code. In particular, it precomputes all the indices
in a separate loop and removes some complicated flow-control.
Tested using the gdb.modula2 and gdb.dlang test suites, as these are
the only parsers that emit MULTI_SUBSCRIPT.
gdb/ChangeLog
2020-12-27 Tom Tromey <tom@tromey.com>
* eval.c (evaluate_subexp_standard) <case MULTI_SUBSCRIPT>:
Simplify.
GDB Administrator [Sun, 27 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 26 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 25 Dec 2020 13:56:36 +0000 (05:56 -0800)]
gas: Update 80387 floating point 's' suffix
Update 80387 floating point 's' suffix to read:
* Integer constructors are '.word', '.long' or '.int', and '.quad'
for the 16-, 32-, and 64-bit integer formats. The corresponding
instruction mnemonic suffixes are 's' (short), 'l' (long), and 'q'
(quad).
instead of 's' (single).
PR gas/27106
* doc/c-i386.texi: Update 80387 floating point 's' suffix
GDB Administrator [Fri, 25 Dec 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 18 Dec 2020 11:59:54 +0000 (11:59 +0000)]
gdb: avoid resolving dynamic properties for non-allocated arrays
In PR gdb/27059 an issue was discovered where GDB would sometimes
trigger undefined behaviour in the form of signed integer overflow.
The problem here is that GDB was reading random garbage from the
inferior memory space, assuming this data was valid, and performing
arithmetic on it.
This bug raises an interesting general problem with GDB's DWARF
expression evaluator, which is this:
We currently assume that the DWARF expressions being evaluated are
well formed, and well behaving. As an example, this is the expression
that the bug was running into problems on, this was used as the
expression for a DW_AT_byte_stride of a DW_TAG_subrange_type:
DW_OP_push_object_address;
DW_OP_plus_uconst: 88;
DW_OP_deref;
DW_OP_push_object_address;
DW_OP_plus_uconst: 32;
DW_OP_deref;
DW_OP_mul
Two values are read from the inferior and multiplied together. GDB
should not assume that any value read from the inferior is in any way
sane, as such the implementation of DW_OP_mul should be guarding
against overflow and doing something semi-sane here.
However, it turns out that the original bug PR gdb/27059, is hitting a
more specific case, which doesn't require changes to the DWARF
expression evaluator, so I'm going to leave the above issue for
another day.
In the test mentioned in the bug GDB is actually trying to resolve the
dynamic type of a Fortran array that is NOT allocated. A
non-allocated Fortran array is one that does not have any data
allocated for it yet, and even the upper and lower bounds of the array
are not yet known.
It turns out that, at least for gfortran compiled code, the data
fields that describe the byte-stride are not initialised until the
array is allocated.
This leads me to the following conclusion: GDB should not try to
resolve the bounds, or stride information for an array that is not
allocated (or not associated, a similar, but slightly different
Fortran feature). Instead, each of these properties should be set to
undefined if the array is not allocated (or associated).
That is what this commit does. There's a new flag that is passed
around during the dynamic array resolution. When this flag is true
the dynamic properties are resolved using the DWARF expressions as
they currently are, but when this flag is false the expressions are
not evaluated, and instead the properties are set to undefined.
gdb/ChangeLog:
PR gdb/27059
* eval.c (evaluate_subexp_for_sizeof): Handle not allocated and
not associated arrays.
* f-lang.c (fortran_adjust_dynamic_array_base_address_hack): Don't
adjust arrays that are not allocated/associated.
* gdbtypes.c (resolve_dynamic_range): Update header comment. Add
new parameter which is used to sometimes set dynamic properties to
undefined.
(resolve_dynamic_array_or_string): Update header comment. Add new
parameter which is used to guard evaluating dynamic properties.
Resolve allocated/associated properties first.
gdb/testsuite/ChangeLog:
PR gdb/27059
* gdb.dwarf2/dyn-type-unallocated.c: New file.
* gdb.dwarf2/dyn-type-unallocated.exp: New file.
Andrew Burgess [Fri, 18 Dec 2020 18:15:06 +0000 (18:15 +0000)]
gdb: include allocated/associated properties in 'maint print type'
Adds the allocated and associated dynamic properties into the output
of the 'maintenance print type' command.
gdb/ChangeLog:
* gdbtypes (recursive_dump_type): Include allocated and associated
properties.
Lancelot SIX [Thu, 24 Dec 2020 16:01:21 +0000 (11:01 -0500)]
gdb/gdbtypes.h: Fix comparison of uninitialized values
When called with an array type of unknown dimensions,
is_scalar_type_recursive ended up comparing uninitialized values.
This was picked up by the following compiler warning:
CXX gdbtypes.o
/binutils-gdb/gdb/gdbtypes.c: In function int is_scalar_type_recursive(type*):
/binutils-gdb/gdb/gdbtypes.c:3670:38: warning: high_bound may be used uninitialized in this function [-Wmaybe-uninitialized]
3670 | return high_bound == low_bound && is_scalar_type_recursive (elt_type);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/binutils-gdb/gdb/gdbtypes.c:3670:38: warning: low_bound may be used uninitialized in this function [-Wmaybe-uninitialized]
This patch makes sure that when dealing with an array of unknown size
(or an array of more than 1 element), is_scalar_type_recursive returns
false.
gdb/ChangeLog:
* gdbtypes.c (is_scalar_type_recursive): Prevent comparison
between uninitialized values.
Change-Id: Ifc005ced166aa7a065fef3e652977bae67625bf4
Alan Modra [Thu, 24 Dec 2020 12:22:51 +0000 (22:52 +1030)]
SHF_GNU_RETAIN 7a and 7b tests
* testsuite/ld-elf/retain7a.d: Don't run on hppa-linux.
* testsuite/ld-elf/retain7b.d: Correct name. Don't run on tic6x.
Allow OSABI FreeBSD.
Alan Modra [Thu, 24 Dec 2020 05:41:03 +0000 (16:11 +1030)]
asan: print_vms_time signed integer overflow
I really don't think anyone cares about underflow of vms time values,
but the potential segfault on a gmtime failure is worth fixing.
* readelf.c (INT64_MIN): Define if not already defined.
(print_vms_time): Catch 64-bit overflow when converting from
vms time to posix time. Don't segfault if gmtime returns NULL.
Alan Modra [Thu, 24 Dec 2020 05:26:23 +0000 (15:56 +1030)]
PR27100, final link failed: bad value
The failure on this PR is due to using the same bfd section for
multiple output sections. Commit
21401fc7bf67 managed to create
duplicate linker script output section statements, but not the actual
bfd sections.
PR 27100
* ldlang.h (lang_output_section_statement_type): Add dup_output.
* ldlang.c (lang_output_section_statement_lookup): Set dup_output.
(init_os): Test dup_output rather than constraint.
* testsuite/ld-scripts/pr27100.d,
* testsuite/ld-scripts/pr27100.s,
* testsuite/ld-scripts/pr27100.t: New test.
* testsuite/ld-scripts/data.exp: Run it. Don't exclude aout here.
* testsuite/ld-scripts/data.d: Do so here instead.
* testsuite/ld-scripts/fill.d: Likewise.
* testsuite/ld-scripts/fill16.d: Likewise.
GDB Administrator [Thu, 24 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Alex Bennée [Wed, 23 Dec 2020 21:36:16 +0000 (16:36 -0500)]
Clarify language for the '?' packet
Both QEMU and kgdb make the assumption that the '?' packet is only
sent during the initial setup of a gdbstub connection. Both use that
knowledge to reset breakpoints and ensure the gdbstub is in a
clean-state on a resumed connection. This can cause confusion for
others implementing clients that speak to gdbstub devices. To avoid
that make the language clearer that this is a start-up query packet
that you only expect to see once.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
gdb/doc/ChangeLog:
* gdb.texinfo (Packets): Clarify language for ? packet.
Change-Id: Iae25d3110fe28b8d2467704962a6889e55224ca5
H.J. Lu [Wed, 23 Dec 2020 21:00:39 +0000 (13:00 -0800)]
x86-64: Add Intel LAM property support
Add Intel Linear Address Masking (LAM) property support. LAM modifies
the checking that is applied to 64-bit linear addresses, allowing
software to use of the untranslated address bits for metadata.
bfd/
* elf-linker-x86.h (elf_x86_cet_report): Renamed to ...
(elf_x86_prop_report): This.
(elf_linker_x86_params): Add lam_u48, lam_u57, lam_u48_report
and lam_u57_report.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Support
GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
GNU_PROPERTY_X86_FEATURE_1_LAM_U57.
(_bfd_x86_elf_link_fixup_gnu_properties): Keep LAM features only
for 64-bit output.
binutils/
* NEWS: Mention LAM_U48 and LAM_U57 support.
* elfedit.c (elf_x86_feature): Support lam_u48 and lam_u57.
(usage): Add lam_u48 and lam_u57.
* readelf.c (decode_x86_feature_1): Support LAM_U48 and LAM_U57.
* doc/binutils.texi: Update elfedit with lam_u48 and lam_u57
support.
* testsuite/binutils-all/x86-64/lam-u48.d: New file.
* testsuite/binutils-all/x86-64/lam-u48.s: Likewise.
* testsuite/binutils-all/x86-64/lam-u57.d: Likewise.
* testsuite/binutils-all/x86-64/lam-u57.s: Likewise.
include/
* elf/common.h (GNU_PROPERTY_X86_FEATURE_1_LAM_U48): New.
(GNU_PROPERTY_X86_FEATURE_1_LAM_U57): Likewise.
ld/
* NEWS: Mention LAM_U48 and LAM_U57 support.
* ld.texi: Document LAM_U48 and LAM_U57 support.
* emulparams/cet.sh: Updated.
* emulparams/elf_x86_64.sh: Source x86-64-lam.sh.
* emulparams/x86-64-lam.sh: New file.
* testsuite/ld-x86-64/property-x86-lam-u48-1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48-1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48-2.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48-3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48-3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48-4.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u48.s: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-2.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-4.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-lam-u57.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run LAM tests.
Andrew Burgess [Thu, 19 Nov 2020 17:52:00 +0000 (17:52 +0000)]
gdb: remove some uses of LA_PRINT_STRING
This commit removes some, but not all, uses of LA_PRINT_STRING. In
this commit I've removed those uses where there is an obvious language
object on which I can instead call the printstr method.
In the remaining 3 uses it is harder to know if the correct thing is
to call printstr on the current language, or on a specific language.
Currently obviously, we always call on the current language (as that's
what LA_PRINT_STRING does), and clearly this behaviour is good enough
right now, but is it "right"? I've left them for now and will give
them more thought in the future.
gdb/ChangeLog:
* expprint.c (print_subexp_standard): Replace uses of
LA_PRINT_STRING.
* f-valprint.c (f_language::value_print_inner): Likewise.
* guile/scm-pretty-print.c (ppscm_print_string_repr): Likewise.
* p-valprint.c (pascal_language::value_print_inner): Likewise.
* python/py-prettyprint.c (print_string_repr): Likewise.
Andrew Burgess [Fri, 30 Oct 2020 15:09:35 +0000 (15:09 +0000)]
gdb: move rust_language into rust-lang.h
Move the rust_language class declaration into the rust-lang.h header
file. This allows for the function implementations called directly in
rust-lang.c and rust-exp.y without the need for trampoline functions.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* rust-exp.y (rust_parse): Rename to...
(rust_language::parser): ...this.
* rust-lang.c (-rust_printstr): Rename to...
(rust_language::printstr): ...this.
(rust_value_print_inner): Delete declaration.
(val_print_struct): Rename to...
(rust_language::val_print_struct): ...this. Update calls to
member functions.
(rust_print_enum): Rename to...
(rust_language::print_enum): ...this. Update calls to member
functions.
(rust_value_print_inner): Rename to...
(rust_language::value_print_inner): ...this. Update calls to
member functions.
(exp_descriptor_rust): Rename to...
(rust_language::exp_descriptor_tab): ...this.
(class rust_language): Move to rust-lang.h.
(rust_language::language_arch_info): Implementation moved to here
from class declaration.
(rust_language::print_type): Likewise.
(rust_language::emitchar): Likewise.
(rust_language::is_string_type_p): Likewise.
* rust-lang.h: Add 'demangle.h', 'language.h', 'value.h', and
'c-lang.h' includes.
(rust_parse): Delete declaration.
(class rust_language): Class declaration moved here from
rust-lang.c.
Andrew Burgess [Fri, 30 Oct 2020 14:35:47 +0000 (14:35 +0000)]
gdb/objc: fix bug in objc_language::opcode_print_table
In this commit:
commit
b7c6e27dbbbbe678b2e2f0bf617605e055e1b378
Date: Tue Aug 4 17:07:59 2020 +0100
gdb: Convert language_data::la_op_print_tab to a method
A bug was introduced, the objc language now returns the wrong op_print
table. Fixed in this commit.
gdb/ChangeLog:
* objc-lang.c (objc_language::opcode_print_table): Return
objc_op_print_tab.
Andrew Burgess [Wed, 28 Oct 2020 18:10:01 +0000 (18:10 +0000)]
gdb: move pascal_language into p-lang.h
Move the pascal_language class declaration into the p-lang.h header
file. This allows for the function implementations to be spread over
the different p-*.c files without the need for global trampoline
functions.
As a consequence of this change many of the Pascal value and type
printing helper functions have become member functions within the
pascal_language class.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* p-exp.y (exp): Update call to pascal_is_string_type.
(pascal_parse): Rename to...
(pascal_language::parser): ...this.
* p-lang.c (is_pascal_string_type): Rename to...
(pascal_is_string_type): ...this.
(pascal_one_char): Rename to...
(pascal_language::print_one_char): ...this.
(pascal_printchar): Rename to...
(pascal_language::printchar): ...this. Update call to
print_one_char member function.
(pascal_op_print_tab): Rename to...
(pascal_language::op_print_tab): ...this.
(class pascal_language): Moved to p-lang.h.
(pascal_language::language_arch_info): Function implementation
moved out of class declaration.
(pascal_language::printstr): Likewise.
* p-lang.h (pascal_parse): Delete declaration.
(pascal_is_string_type): Declare.
(pascal_print_type): Delete declaration.
(pascal_print_typedef): Delete declaration.
(pascal_value_print_inner): Delete declaration.
(pascal_value_print): Delete declaration.
(pascal_type_print_method_args): Delete declaration.
(is_pascal_string_type): Delete declaration.
(pascal_printchar): Delete declaration.
(pascal_builtin_types): Delete declaration.
(pascal_type_print_base): Delete declaration.
(pascal_type_print_varspec_prefix): Delete declaration.
(class pascal_language): Moved here from p-lang.c.
* p-typeprint.c (pascal_type_print_varspec_suffix): Delete
declaration.
(pascal_type_print_derivation_info): Delete declaration.
(pascal_print_type): Rename to...
(pascal_language::print_type): ...this. Update calls to member
functions.
(pascal_print_typedef): Rename to...
(pascal_language::print_typedef): ...this. Update calls to member
functions.
(pascal_type_print_derivation_info): Rename to...
(pascal_language::type_print_derivation_info): ...this.
(pascal_type_print_method_args): Rename to...
(pascal_language::type_print_method_args): ...this.
(pascal_type_print_varspec_prefix): Rename to...
(pascal_language::type_print_varspec_prefix): ...this. Update
calls to member functions.
(pascal_print_func_args): Rename to...
(pascal_language::print_func_args): ...this. Update calls to
member functions.
(pascal_type_print_func_varspec_suffix): Rename to...
(pascal_language::type_print_func_varspec_suffix): ...this.
Update calls to member functions.
(pascal_type_print_varspec_suffix): Rename to...
(pascal_language::type_print_varspec_suffix): ...this. Update
calls to member functions.
(pascal_type_print_base): Rename to...
(pascal_language::type_print_base): ...this. Update calls to
member functions.
* p-valprint.c (pascal_value_print_inner): Rename to...
(pascal_language::value_print_inner): ...this. Update calls to
member functions.
(pascal_value_print): Rename to...
(pascal_language::value_print): ...this. Update calls to member
functions.
Andrew Burgess [Tue, 20 Oct 2020 13:03:42 +0000 (14:03 +0100)]
gdb: move go_language class declaration into header file
Move the go_language class into go-lang.h, this allows us to have
member functions implemented directly in the different go-*.c files
instead of having to trampoline out to global functions.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* go-exp.y (go_parse): Rename to...
(go_language::parser): ...this.
* go-lang.c (go_demangle): Rename to...
(go_language::demangle_symbol): ...this.
(go_language::expression_ops): Implementation moved here out of
class declaration.
(go_op_print_tab): Rename to...
(go_language::op_print_tab): ...this, update comment.
(class go_language): Declaration moved to go-lang.h.
(go_language::language_arch_info): Implementation moved here out
of class declaration.
* go-lang.h (go_parse): Delete declaration.
(go_demangle): Delete declaration.
(go_print_type): Delete declaration.
(go_value_print_inner): Delete declaration.
(class go_language): Declaration moved here from go-lang.c.
* go-typeprint.c (go_print_type): Rename to...
(go_language::print_type): ...this.
* go-valprint.c (go_value_print_inner): Rename to...
(go_language::value_print_inner): ...this.
* symtab.c (demangle_for_lookup): Call demangle_symbol method on
the go_language object.
Andrew Burgess [Tue, 20 Oct 2020 12:41:18 +0000 (13:41 +0100)]
gdb: remove LA_EMIT_CHAR macro
Now that every use of the LA_EMIT_CHAR macro is within a language_defn
member function we can simply call the emitchar member function
directly instead of using the LA_EMIT_CHAR macro.
If we are ever inside a language object, for example, cplus_language,
while current_language points at something other than cplus_language
then this commit will result in a change in behaviour. However, I
believe if we did have such a difference then this would be a bug in
GDB. AS such I'm going to claim there _should_ be no user visible
changes from this commit.
gdb/ChangeLog:
* c-lang.c (language_defn::printchar): Call emitchar, not
LA_EMIT_CHAR.
* f-lang.h (f_language::printchar): Likewise.
* language.h (LA_EMIT_CHAR): Delete macro.
* rust-lang.c (rust_language::printchar): Call emitchar, not
LA_EMIT_CHAR.
Andrew Burgess [Tue, 20 Oct 2020 12:33:36 +0000 (13:33 +0100)]
gdb: rename c_printchar as language_defn::printchar
This commit removes the global function c_printchar and moves the
implementation into language_defn::printchar.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* c-lang.c (c_printchar): Rename to...
(language_defn::printchar): ...this.
* c-lang.h (c_printchar): Delete declaration.
* language.c (language_defn::printchar): Delete this
implementation. Is now implemented in c-lang.c.
Andrew Burgess [Tue, 20 Oct 2020 11:38:42 +0000 (12:38 +0100)]
gdb: avoid accessing global C++ language implementation functions
The function c_printchar is called from two places; it provides the
implementation of language_defn::printchar and it is called from
dwarf2_compute_name.
It would be nice to rename c_printchar as language_defn::printchar and
so avoid the trampoline.
To achieve this, instead of calling c_printchar directly from the
DWARF code, I lookup the C++ language object and call the printchar
member function.
In a later commit I can then rename c_printchar.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* dwarf2/read.c (dwarf2_compute_name): Call methods on C++
language object instead of calling global functions directly.
Andrew Burgess [Mon, 19 Oct 2020 16:44:15 +0000 (17:44 +0100)]
gdb: delete unused function print_char_chars
Spotted that print_char_chars appears to be unused, delete it. There
should be no user visible changes after this commit.
gdb/ChangeLog:
* valprint.c (print_char_chars): Delete definition.
* valprint.h (print_char_chars): Delete declaration.
Samuel Thibault [Wed, 23 Dec 2020 17:21:18 +0000 (17:21 +0000)]
Add myself to gdb/MAINTAINERS
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add myself.
Samuel Thibault [Wed, 23 Dec 2020 17:18:49 +0000 (17:18 +0000)]
hurd: Add changelog for
dca11eb872c9
Samuel Thibault [Mon, 21 Dec 2020 16:01:07 +0000 (16:01 +0000)]
hurd: Fix getting VM_MIN/MAX_ADDRESS
gnu-nat.c was getting the inclusion of vm_param.h only by luck. We need
to explicitly include it to be sure to get the definitions of
VM_MIN/MAX_ADDRESS.
gdb/ChangeLog:
* gnu-nat.c: Include <mach/vm_param.h>.
GDB Administrator [Wed, 23 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Shahab Vahedi [Tue, 22 Dec 2020 17:08:41 +0000 (18:08 +0100)]
Remove trailing white spaces in gdb/frame.{c,h}
gdb/ChangeLog:
* frame.c: Remove trailing white spaces.
* frame.h: Likewise.
Shahab Vahedi [Tue, 22 Dec 2020 11:27:00 +0000 (12:27 +0100)]
arc: Make variable name in comments uppercase
The word "regnum" in comments should be uppercase, because it
reflects a variable name in the code.
gdb/ChangeLog
* arc-linux-tdep.c: Replace "regnum" with "REGNUM" in comments.
Anton Kolesov [Fri, 14 Feb 2014 07:56:23 +0000 (11:56 +0400)]
gdb: Add native support for ARC in GNU/Linux
With this patch in place it is possible to build a GDB that
can run on ARC (GNU/Linux) hosts for debugging ARC targets.
The "arc-linux-nat.c" is a rather small one that mostly deals
with registers and a few thread related hooks.
v2 [1]:
- Remove "void" from the input of "_initialize_arc_linux_nat ()"
[1] Tom's remark after the first patch
https://sourceware.org/pipermail/gdb-patches/2020-November/173223.html
gdb/ChangeLog:
* Makefile.in (ALLDEPFILES): Add arc-linux-nat.c.
* configure.host (host to gdb names): Add arc*-*-linux*.
* configure.nat (gdb_host_cpu): Add arc.
* arc-linux-nat.c: New.
Shahab Vahedi [Tue, 10 Nov 2020 18:34:57 +0000 (19:34 +0100)]
arc: Take into account the REGNUM in supply/collect gdb hooks
All the arc_linux_supply_*() target operations and the
arc_linux_collect_v2_regset() in arc-linux-tdep.c were
supplying/collecting all the registers in regcache as if the
REGNUM was set to -1.
The more efficient behavior is to examine the REGNUM and act
accordingly. That is what this patch does.
gdb/ChangeLog:
* arc-linux-tdep.c (supply_register): New.
(arc_linux_supply_gregset, arc_linux_supply_v2_regset,
arc_linux_collect_v2_regset): Consider REGNUM.
Anton Kolesov [Thu, 22 Dec 2016 18:52:16 +0000 (21:52 +0300)]
arc: Add support for signal frames for Linux targets
Implement functions needed to unwind signal frames on ARC Linux targets.
gdb/ChangeLog
* arc-linux-tdep.c (arc_linux_sc_reg_offsets): New static variable.
(arc_linux_is_sigtramp): New function.
(arc_linux_sigcontext_addr): Likewise.
(arc_linux_init_osabi): Use them.
Anton Kolesov [Mon, 22 Aug 2016 16:39:46 +0000 (19:39 +0300)]
arc: Add support for signal handlers
This patch adds the necessary infrastructure to handle signal frames for
ARC architecture. It is fairly similar to what any other architecture
would have. Linux specific parts will be in a separate patch.
v2 [1]:
- Make the logic of "arc_sigtramp_frame_sniffer ()" simpler.
[1] Tom's remark for the first version
https://sourceware.org/pipermail/gdb-patches/2020-November/173221.html
gdb/ChangeLog:
* arc-tdep.c (arc_make_sigtramp_frame_cache): New function.
(arc_sigtramp_frame_this_id): Likewise.
(arc_sigtramp_frame_prev_register): Likewise.
(arc_sigtramp_frame_sniffer): Likewise.
(arc_siftramp_frame_unwind): New global variable.
(arc_gdbarch_init): Use sigtramp capabilities.
(arc_dump_tdep): Print sigtramp fields.
* arc-tdep.h (gdbarch_tdep): Add sigtramp fields.
GDB Administrator [Tue, 22 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 21 Nov 2020 15:49:10 +0000 (08:49 -0700)]
Move enum noside earlier in expression.h
For the expression rewrite series, I needed to move enum noside
earlier in expression.h. Because this is a pure move, and because it
seems harmless and uncontroversial to move an enum definition earlier
in a file, I'm pushing it in early, to reduce the size of that series.
Tested by rebuilding.
gdb/ChangeLog
2020-12-21 Tom Tromey <tom@tromey.com>
* expression.h (enum noside): Move earlier.
Peter Waller [Mon, 21 Dec 2020 14:38:07 +0000 (09:38 -0500)]
Preserve gdb_std{out, err, log, targ, targerr} across interpreter_exec_cmd
Calls through interpreter_exec_cmd can cause the output state to be modified in
a way which doesn't get back after the execution.
It looks like the intent is that interp::resume should put things back how they
should be, however, mi_interp::resume modifies gdb_stdout and nothing currently
restores it to the previous state.
To see the broken behaviour:
gdb -ex starti -ex bt -ex 'interpreter-exec mi echo' -ex bt -ex q echo <<<''
Prior to this patch, on a terminal environment, the first backtrace is
coloured, and the second backtrace is not. The reason is that
stdio_file::can_emit_style_escape becomes false, because the gdb_stdout gets
overwritten in mi_interp::resume and not replaced.
gdb/ChangeLog:
* interps.c (interpreter_exec_cmd): Restore streams pointers.
gdb/testsuite/ChangeLog:
* gdb.base/style-interp-exec-mi.exp: New.
* gdb.base/style-interp-exec-mi.c: New.
Signed-off-by: Peter Waller <p@pwaller.net>
Change-Id: Id87423b262d058857ea9dca5866ca6471741e512
Simon Marchi [Mon, 21 Dec 2020 14:16:28 +0000 (09:16 -0500)]
gdb/testsuite: use gdb_test in gdb.base/list.exp
Use gdb_test instead of send_gdb + gdb_expect. Use proc_with_prefix to
help with name uniqueness.
gdb/testsuite/ChangeLog:
* gdb.base/list.exp: Replace send_gdb + gdb_expect with
gdb_test. Use proc_with_prefix.
Change-Id: Ieee8fb2c80f596f60397fab7633773a7f8c8c879
Markus Metzger [Fri, 4 Dec 2020 09:29:06 +0000 (10:29 +0100)]
testsuite, gdb.btrace: fix 32-bit PIE false positives
For 32-bit position independent executables, GCC generates an extra call to
__x86.get_pc_thunk.<reg>
which appears in the function call history. It is correct to appear there
but this confuses the tests, which check for an expected sequence of
functions.
Build with nopie to avoid this complication.
gdb/testsuite/ChangeLog:
2020-12-04 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/exception.exp: Build with nopie.
* gdb.btrace/function_call_history.exp: Likewise.
* gdb.btrace/unknown_functions.exp: Likewise.
Markus Metzger [Fri, 11 Dec 2020 08:55:50 +0000 (09:55 +0100)]
testsuite, gdb.btrace: skip multi-inferior.exp on gdbserver targets
The gdb.btrace/multi-inferior.exp test creates multiple inferiors to check
that recording is per-inferior.
When run with the native-gdbserver board, this test hangs when trying to
add the second inferior over the remote connection. Skip the test.
Note that the test runs fine with the native-extended-gdbserver board file
and we want to keep testing that configuration.
gdb/testsuite/ChangeLog:
2020-12-11 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/multi-inferior.exp: Skip if use_gdb_stub.
Markus Metzger [Mon, 14 Dec 2020 13:04:33 +0000 (14:04 +0100)]
testsuite, gdb.python: make py-record-*.exp test names unique
gdb/testsuite/ChangeLog:
2020-12-14 Markus Metzger <markus.t.metzger@intel.com>
* gdb.python/py-record-btrace.exp: Make test names unique.
* gdb.python/py-record-full.exp: Likewise.
Markus Metzger [Fri, 4 Dec 2020 09:01:29 +0000 (10:01 +0100)]
testsuite, gdb.btrace: make test names unique
gdb/testsuite/ChangeLog:
2020-12-04 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/data.exp: Make test names unique.
* gdb.btrace/delta.exp: Likewise.
* gdb.btrace/enable.exp: Likewise.
* gdb.btrace/function_call_history.exp: Likewise.
* gdb.btrace/nohist.exp: Likewise.
* gdb.btrace/non-stop.exp: Likewise.
* gdb.btrace/rn-dl-bind.exp: Likewise.
* gdb.btrace/step.exp: Likewise.
* gdb.btrace/stepi.exp: Likewise.
* gdb.btrace/tailcall.exp: Likewise.
Markus Metzger [Thu, 3 Dec 2020 16:04:29 +0000 (17:04 +0100)]
gdb, record: rephrase the 'not recording' error message
When trying to use one of the record commands without having enabled
recording first, GDB gives the error message:
(gdb) record function-call-history
No record target is currently active.
Use one of the "target record-<TAB><TAB>" commands first.
In the record help, however, we say:
(gdb) help record
record, rec
Start recording.
List of record subcommands:
record btrace, record b -- Start branch trace recording.
record delete, record del, record d -- Delete the rest of execution log and start recording it anew.
record full -- Start full execution recording.
record function-call-history -- Prints the execution history at function granularity.
record goto -- Restore the program to its state at instruction number N.
record instruction-history -- Print disassembled instructions stored in the execution log.
record save -- Save the execution log to a file.
record stop, record s -- Stop the record/replay target.
Change the above error message to
(gdb) record function-call-history
No recording is currently active.
Use the "record full" or "record btrace" command first.
to align with the help text.
gdb/ChangeLog:
2020-12-03 Markus Metzger <markus.t.metzger@intel.com>
* record.c (require_record_target): Rephrase error message.
(info_record_command): Likewise.
gdb/testsuite/ChangeLog:
2020-12-03 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/enable.exp: Update error message.
* gdb.btrace/multi-inferior.exp: Likewise.
* gdb.btrace/reconnect.exp: Likewise.
* gdb.python/py-record-btrace.exp: Likewise.
* gdb.python/py-record-full.exp: Likewise.
Joel Brobecker [Mon, 21 Dec 2020 02:21:41 +0000 (06:21 +0400)]
gdb.texinfo: Document GMP as mandatory requirement to build GDB
gdb/doc/ChangeLog
* gdb.texinfo (Requirements): Add GMP to list of requirements.
GDB Administrator [Mon, 21 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Sun, 20 Dec 2020 08:35:36 +0000 (09:35 +0100)]
[gdb/testsuite] Add save_target_board_info
Add a proc save_target_board_info, similar to save_vars, such that we can do:
...
save_target_board_info { multilib_flags } {
global board
set board [target_info name]
unset_board_info multilib_flags
set_board_info multilib_flags "$override_multilib_flags"
...
}
...
and use it in gdb_compile_shlib.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-12-20 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (save_target_board_info): New proc.
(gdb_compile_shlib): Use save_target_board_info.
GDB Administrator [Sun, 20 Dec 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 19 Dec 2020 21:30:39 +0000 (13:30 -0800)]
gold: Move sym declaration just before use
Move sym declaration just before use to avoid -Wmaybe-uninitialized
warning from GCC 11.
PR gold/27097
* incremental.cc (Sized_relobj_incr::do_add_symbols): Move sym
declaration just before use.
(Sized_incr_dynobj::do_add_symbols): Likewise.
* plugin.cc (Sized_pluginobj::do_add_symbols): Likewise.
Tom de Vries [Sat, 19 Dec 2020 15:43:17 +0000 (16:43 +0100)]
[gdb/testsuite] Introduce supports_scalar_storage_order_attribute
Introduce support test procs:
- supports_scalar_storage_order_attribute, and
- supports_gnuc
and use them in test-case gdb.base/endianity.exp.
Tested on x86_64-linux with gcc-7.5.0, gcc-4.8.5, and clang 10.0.1.
gdb/testsuite/ChangeLog:
2020-12-19 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (supports_scalar_storage_order_attribute)
(supports_gnuc): New proc.
* gdb.base/endianity.exp: Define TEST_SSO. Eliminate
test_compiler_info calls. Add unsupported message.
* gdb.base/endianity.c: Use TEST_SSO.
Hannes Domani [Mon, 14 Dec 2020 18:06:38 +0000 (19:06 +0100)]
Don't compare types of enum fields
Comparing types of enum fields results in a crash, because they don't
have a type.
It can be reproduced by comparing the types of 2 instances of the same
enum type in different objects:
enum.h:
enum e
{
zero,
one,
};
enum-1.c:
#include <enum.h>
int func();
enum e e1;
int main()
{
return e1 + func();
}
enum-2.c:
#include <enum.h>
enum e e2;
int func()
{
return e2;
}
$ gcc -g -oenum enum-1.c enum-2.c
$ gdb -q enum.exe
Reading symbols from enum.exe...
(gdb) py print(gdb.parse_and_eval("e1").type==gdb.parse_and_eval("e2").type)
Thread 1 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 6184.0x1cc4]
check_typedef (type=0x0) at C:/src/repos/binutils-gdb.git/gdb/gdbtypes.c:2745
2745 while (type->code () == TYPE_CODE_TYPEDEF)
gdb/ChangeLog:
2020-12-19 Hannes Domani <ssbssa@yahoo.de>
PR exp/27070
* gdbtypes.c (check_types_equal): Don't compare types of enum fields.
gdb/testsuite/ChangeLog:
2020-12-19 Hannes Domani <ssbssa@yahoo.de>
PR exp/27070
* gdb.python/compare-enum-type-a.c: New test.
* gdb.python/compare-enum-type-b.c: New test.
* gdb.python/compare-enum-type.exp: New file.
* gdb.python/compare-enum-type.h: New test.
Bernd Edlinger [Wed, 16 Dec 2020 18:47:18 +0000 (19:47 +0100)]
Warn about static libs vs. source-highlight only when necessary
Avoid the error message when source-highlight is actually available.
2020-12-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
* configure.ac: Move the static libs vs. source-highlight
error message to a better place.
* configure: Regenerate.
GDB Administrator [Sat, 19 Dec 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Hannes Domani [Fri, 18 Dec 2020 17:35:31 +0000 (18:35 +0100)]
Fix name of main_type field type in pretty printer
It was renamed from type to m_type.
gdb/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* gdb-gdb.py.in: Fix main_type field name.
Hannes Domani [Fri, 18 Dec 2020 17:31:52 +0000 (18:31 +0100)]
Remove erroneous 'a' in gdb.register_window_type documentation
gdb/doc/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* python.texi (TUI Windows In Python): Remove erroneous 'a'.
Hannes Domani [Fri, 18 Dec 2020 16:23:06 +0000 (17:23 +0100)]
Add address keyword to Value.format_string
This makes it possible to disable the address in the result string:
const char *str = "alpha";
(gdb) py print(gdb.parse_and_eval("str").format_string())
0x404000 "alpha"
(gdb) py print(gdb.parse_and_eval("str").format_string(address=False))
"alpha"
gdb/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* python/py-value.c (valpy_format_string): Implement address keyword.
gdb/doc/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* python.texi (Values From Inferior): Document the address keyword.
gdb/testsuite/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* gdb.python/py-format-string.exp: Add tests for address keyword.
Hannes Domani [Fri, 18 Dec 2020 15:17:46 +0000 (16:17 +0100)]
Fix accessing a method's fields from Python
Considering this example:
struct C
{
int func() { return 1; }
} c;
int main()
{
return c.func();
}
Accessing the fields of C::func, when requesting the function by its
type, works:
(gdb) py print(gdb.parse_and_eval('C::func').type.fields()[0].type)
C * const
But when trying to do the same via a class instance, it fails:
(gdb) py print(gdb.parse_and_eval('c')['func'].type.fields()[0].type)
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: Type is not a structure, union, enum, or function type.
Error while executing Python code.
The difference is that in the former the function type is TYPE_CODE_FUNC:
(gdb) py print(gdb.parse_and_eval('C::func').type.code == gdb.TYPE_CODE_FUNC)
True
And in the latter the function type is TYPE_CODE_METHOD:
(gdb) py print(gdb.parse_and_eval('c')['func'].type.code == gdb.TYPE_CODE_METHOD)
True
So this adds the functionality for TYPE_CODE_METHOD as well.
gdb/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* python/py-type.c (typy_get_composite): Add TYPE_CODE_METHOD.
gdb/testsuite/ChangeLog:
2020-12-18 Hannes Domani <ssbssa@yahoo.de>
* gdb.python/py-type.exp: Add tests for TYPE_CODE_METHOD.
Jameson Nash [Fri, 18 Dec 2020 19:08:53 +0000 (14:08 -0500)]
gdb: define COFF file offsets with file_ptr
The arguments to these functions are file_ptr, so these declarations
were accidentally implicitly down-casting them to signed int. This
allows for reading files between 2 and 4 GB in size in my testing (I
don't have a larger dll currently to test). These may not be natively
supported by Windows, but can appear when using split-dwarf information.
This solves a "can't get string table" error resulting from attempting
to pass a negative offset to bfd_seek. I encountered this occuring while
trying to use a debug file for libLLVM.dll, but searching online reveals
at least one other person may have run into a similar problem with
Firefox?
https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/CA+cU71k2bU0azQxjy4-77ynQj1O+TKmgtaTKe59n7Bjub1y7Tg@mail.gmail.com/
With this patch, the debug file appears to load successfully and I can
see debug information in gdb for the library.
gdb/ChangeLog:
* coffread.c (linetab_offset): Change type to file_ptr.
(linetab_size): Likewise.
(enter_linenos): Change parameter type to file_ptr.
(init_lineno): Likewise.
(init_stringtab): Likewise.
(coff_symtab_read): Likewise.
(coff_symfile_read): Change variable types to file_ptr.
Change-Id: I6ae3bf31efc51c826734ade6731ea6b1c32129f3
Tom Tromey [Fri, 18 Dec 2020 15:48:36 +0000 (08:48 -0700)]
Run fixed_points.exp with -fgnat-encodings=minimal
This changes the test case gdb.ada/fixed_points.exp to also be run
with -fgnat-encodings=minimal. This change pointed out that the test
case had a few incorrect expected outputs; these are fixed as well.
Note that the Overprecise_Object test only uses the non-legacy output
with GCC trunk.
gdb/testsuite/ChangeLog
2020-12-18 Tom Tromey <tromey@adacore.com>
* gdb.ada/fixed_points.exp: Also run with
-fgnat-encodings=minimal. Update expected output.
H.J. Lu [Fri, 18 Dec 2020 12:30:47 +0000 (04:30 -0800)]
ld: Build and install only unversioned libdep
Build only unversioned libdep and remove the installed libdep.la since
only a single libdep.so is needed.
PR ld/27082
* Makefile.am
(libdep_la_LDFLAGS): Add -module -avoid-version.
(libdep_la_LINK): New.
(install-data-local): Depend on $(install-bfdpluginLTLIBRARIES)
and remove libdep.la.
H.J. Lu [Fri, 18 Dec 2020 12:24:26 +0000 (04:24 -0800)]
elf: Copy elf_gnu_osabi_retain only for relocatable link
Copy elf_gnu_osabi_retain from input only for relocatable link since
SHF_GNU_RETAIN has no impact on non-relocatable outputs.
bfd/
PR ld/27091
* elflink.c (elf_link_input_bfd): Copy elf_gnu_osabi_retain
from input only for relocatable link.
ld/
PR ld/27091
* testsuite/ld-elf/retain7.s: New file.
* testsuite/ld-elf/retain7a.d: Likewise.
* testsuite/ld-elf/retain7b.d: Likewise.
Alan Modra [Thu, 17 Dec 2020 23:08:00 +0000 (09:38 +1030)]
Assorted tidies
bfd/
* elf32-microblaze.c (dbg): Delete unused variable.
* elf32-nds32.c (relax_group_section_id_list): Make static.
* som.c (reloc_queue): Make static.
* xtensa-isa.c (xtisa_errno, xtisa_error_msg): Make static.
include/
* xtensa-isa-internal.h (xtisa_errno, xtisa_error_msg): Delete.
Alan Modra [Thu, 17 Dec 2020 12:51:11 +0000 (23:21 +1030)]
Remove some static buffers
Fixes possible overflow of a static buffer for powerpc with translated
messages, and on v850 when symbol names are large.
* archive.c (_bfd_ar_spacepad, _bfd_ar_sizepad): Use auto buf.
* coff-mcore.c (coff_mcore_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_unhandled_reloc): Use asprintf in place
of fixed size and possibly too small buf for translated message.
* elf64-ppc.c (ppc64_elf_unhandled_reloc): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
* ecoff.c (ecoff_type_to_string): Pass in return string buff rather
than using static buffer2. Delete dead code. Remove unnecessary
parentheses.
(_bfd_ecoff_print_symbol): Pass auto buff to ecoff_type_to_string.
* elf32-rx.c (describe_flags): Pass in return string buf rather
than using static buf.
(rx_elf_merge_private_bfd_data): Pass buf to describe_flags.
(rx_elf_print_private_bfd_data): Likewise.
* mach-o.c (cpusubtype): Pass in return string buffer rather than
using static buffer.
(bfd_mach_o_bfd_print_private_bfd_data): Pass buff to cpusubtype.
* opncls.c (separate_debug_file_exists): Make buffer an auto var.
(bfd_fill_in_gnu_debuglink_section): Likewise.
* peXXigen.c (rsrc_resource_name): Pass in return string buffer
rather than using static buffer.
(rsrc_sort_entries): Pass buff to rsrc_resource_name.
* vms-alpha.c (_bfd_vms_write_emh): Pass tbuf to get_vms_time_string.
* vms-misc.c (get_vms_time_string): Pass in return string tbuf
rather than using static tbuf.
* vms.h (get_vms_time_string): Update prototype.
Alan Modra [Wed, 16 Dec 2020 22:03:39 +0000 (08:33 +1030)]
Constify more arrays
bfd/
* coff-z80.c (bfd_howto_type): Make typedef const.
* elf32-z80.c (bfd_howto_type): Likewise.
* elf32-m32c.c (EncodingTable): Likewise.
* elf32-csky.c (csky_arch_for_merge): Likewise.
(csky_archs): Use typedef.
* elf32-m68hc11.c (m68hc11_direct_relax_table): Make const.
(find_relaxable_insn, m68hc11_elf_relax_section): Adjust to suit.
* elf32-ppc.c (ppc_alt_plt): Make const.
* elf32-rl78.c (relax_addr16): Likewise.
* targets.c (_bfd_associated_vector): Likewise.
(bfd_target_vector, bfd_associated_vector): Likewise.
* libbfd-in.h (bfd_target_vector, bfd_associated_vector): Likewise.
* libbfd.h: Regenerate.
include/
* opcode/arc-attrs.h (CONFLICT_LIST): Make const.
Alan Modra [Wed, 16 Dec 2020 21:14:48 +0000 (07:44 +1030)]
Statically initialise target common sections
This tidies initialisation of target common sections, doing so using a
static initialiser rather than via code and deleting unnecessary
symbol_ptr_ptr variables (the one in asection is used instead).
The patch also initialises ecoff.c:bfd_debug_section using
BFD_FAKE_SECTION. That does change bfd_debug_section slightly,
output_section was NULL now bfd_debug_section, and symbol_ptr_ptr
was NULL now &bfd_debug_section.symbol, but I believe those changes
are safe.
bfd/
* ecoff.c (bfd_debug_section): Init using BFD_FAKE_SECTION.
(ecoff_scom_section, ecoff_scom_symbol): Statically init using
BFD_FAKE_SECTION and GLOBAL_SYM_INIT. Delete initialisation code.
(ecoff_scom_symbol_ptr): Delete.
* elf32-m32r.c (m32r_elf_scom_section, m32r_elf_scom_symbol),
(m32r_elf_scom_symbol_ptr),
* elf32-score.c (score_elf_scom_section, score_elf_scom_symbol),
(score_elf_scom_symbol_ptr),
* elf32-score7.c (score_elf_scom_section, score_elf_scom_symbol),
(score_elf_scom_symbol_ptr),
* elf32-tic6x.c (tic6x_elf_scom_section, tic6x_elf_scom_symbol),
(tic6x_elf_scom_symbol_ptr),
* elf32-v850.c (v850_elf_scom_section, v850_elf_scom_symbol),
(v850_elf_scom_symbol_ptr),
(v850_elf_tcom_section, v850_elf_tcom_symbol),
(v850_elf_tcom_symbol_ptr),
(v850_elf_zcom_section, v850_elf_zcom_symbol),
(v850_elf_zcom_symbol_ptr),
* elf64-mmix.c (mmix_elf_reg_section, mmix_elf_reg_section_symbol),
(mmix_elf_reg_section_symbol_ptr),
* elfxx-mips.c (mips_elf_scom_section, mips_elf_scom_symbol),
(mips_elf_scom_symbol_ptr): Likewise.
gas/
* ecoff.c (ecoff_frob_symbol): Rename scom_section to
ecoff_scom_section and statically initialise.
GDB Administrator [Fri, 18 Dec 2020 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Thu, 17 Dec 2020 20:37:20 +0000 (13:37 -0700)]
Remove a use of n_spaces
While removing printfi_filtered, I found a spot that used n_spaces
where the now-ordinary "%*s" approach would do. This patch makes this
change.
Tested on x86-64 Fedora 32.
gdb/ChangeLog
2020-12-17 Tom Tromey <tromey@adacore.com>
* printcmd.c (print_variable_and_value): Don't use n_spaces.
Tom Tromey [Thu, 17 Dec 2020 20:29:38 +0000 (13:29 -0700)]
Remove printfi_filtered and fprintfi_filtered
After seeing Simon's patch, I thought maybe it was finally time to
remove printfi_filtered and fprintfi_filtered, in favor of using the
"%*s" approach to indenting.
In this patch I took the straightforward approach of always adding a
leading "%*s", even when the format already started with "%s", to
avoid the trickier form of:
printf ("%*s", -indent, string)
Regression tested on x86-64 Fedora 32.
Let me know what you think.
gdb/ChangeLog
2020-12-17 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (print_args, dump_fn_fieldlists, print_cplus_stuff)
(print_gnat_stuff, print_fixed_point_type_info)
(recursive_dump_type): Update.
* go32-nat.c (go32_sysinfo, display_descriptor): Update.
* c-typeprint.c (c_type_print_base_struct_union)
(c_type_print_base_1): Update.
* rust-lang.c (rust_internal_print_type): Update.
* f-typeprint.c (f_language::f_type_print_base): Update.
* utils.h (fprintfi_filtered, printfi_filtered): Remove.
* m2-typeprint.c (m2_record_fields): Update.
* p-typeprint.c (pascal_type_print_base): Update.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(do_compile_dwarf_expr_to_c): Update.
* utils.c (fprintfi_filtered, printfi_filtered): Remove.
Simon Marchi [Thu, 17 Dec 2020 14:39:33 +0000 (09:39 -0500)]
gdb/doc: fix "show check range" command name
gdb/doc/ChangeLog:
PR gdb/27088
* gdb.texinfo (Range Checking): Fix "show check range" command
name.
Change-Id: I0248ef76d205ac49ed71b813aafe3e630c2ffc2e
Tom Tromey [Wed, 16 Dec 2020 22:49:40 +0000 (15:49 -0700)]
Change parameters to language_defn::post_parser
In the expression rewrite, Ada type resolution will be done at parse
time rather than in a post-parse pass. At this point,
language_defn::post_parser will be removed. However, for this to
work, the information available to post_parser must be made available
during the actual parse.
This patch refactors this code slightly to make this possible. In
particular, "void_context_p" is passed to the parser_state
constructor, and the parser state is then passed to the post_parser
method.
gdb/ChangeLog
2020-12-16 Tom Tromey <tom@tromey.com>
* rust-exp.y (rust_lex_tests): Update.
* parser-defs.h (parser_state): Add void_p parameter.
<void_context_p>: New member.
* parse.c (parse_exp_in_context): Update.
* language.h (language_defn::post_parser): Remove void_context_p,
completing, tracker parameters. Add parser state.
* ada-lang.c (ada_language::post_parser): Update.
GDB Administrator [Thu, 17 Dec 2020 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 16 Dec 2020 22:12:55 +0000 (15:12 -0700)]
Change void_context_p to bool
This patch changes void_context_p to bool, as a prerequisite to the
change to post_parser that I submitted here:
https://sourceware.org/pipermail/gdb-patches/2020-December/174080.html
Tested by rebuilding.
Note that nothing in-tree passes true here. I don't know why this is,
but there is a use of this internally in AdaCore's tree. I will try
to submit that patch, if it is needed. (And if not, I will come back
around and remove this.)
gdb/ChangeLog
2020-12-16 Tom Tromey <tom@tromey.com>
* parse.c (parse_exp_1, parse_expression_for_completion): Update.
(parse_exp_in_context): Change void_context_p to bool.
* language.h (struct language_defn) <post_parser>: Change
void_context_p to bool.
* ada-lang.c (class ada_language) <post_parser>: Update.
Simon Marchi [Wed, 16 Dec 2020 21:43:18 +0000 (16:43 -0500)]
gdb/testsuite: make some tests in gdb.base enable non-stop using GDBFLAGS
For the same reason as explained in commit
7cb2893dfab1 ("gdb/testsuite:
gdb.mi/mi-nonstop-exit.exp: enable non-stop using GDBFLAGS").
Note that the use of
set GDBFLAGS "$GDBFLAGS ..."
instead of
append GDBFLAGS "..."
is intentional. "append" is silent when appending to a non-existent
variable. So if this code if moved to a proc (as is the case already
for step-sw-breakpoint-adjust-pc.exp) and we forget to add "global
GDBFLAGS", the flag won't be added to the global GDBFLAGS, and we won't
actually enable non-stop, and it might go unnoticed. Using the "set"
version will turn into an error if we forget the "global".
This makes these test work correctly with native-extended-gdbserver.
Some of them were silently failing because we runto_main is silent when
it fails.
gdb/testsuite/ChangeLog:
* gdb.base/async-shell.exp: Enable non-stop through GDBFLAGS.
* gdb.base/continue-all-already-running.exp: Likewise.
* gdb.base/moribund-step.exp: Likewise.
* gdb.base/step-sw-breakpoint-adjust-pc.exp: Likewise.
Change-Id: I19ef05d07a0ec4a9c9476af2ba6e1ea1159ee437
H.J. Lu [Wed, 16 Dec 2020 21:40:42 +0000 (13:40 -0800)]
ld: Skip libdep plugin if not all plugin hooks are available
Skip plugin if not all required plugin hooks are available.
2020-12-16 Howard Chu <hyc@symas.com>
H.J. Lu <hongjiu.lu@intel.com>
PR ld/27081
* libdep_plugin.c (onload): Skip if not all required plugin hooks
are available.
* testsuite/config/default.exp (dep_plug_opt): New.
* testsuite/ld-elf/elf.exp: Pass $dep_plug_opt to nm.
* testsuite/ld-elf/pr26391.fd: New file.
Tom de Vries [Wed, 16 Dec 2020 20:32:59 +0000 (21:32 +0100)]
[gdb/testsuite] Fix prompt regexp in batch-preserve-term-settings.exp
On openSUSE Leap 15.2, when running test-case
gdb.base/batch-preserve-term-settings.exp I get:
...
spawn /bin/sh^M
PS1="gdb-subshell$ "^M
sh-4.4$ PS1="gdb-subshell$ "^M
gdb-subshell$ PASS: gdb.base/batch-preserve-term-settings.exp: batch run: \
spawn shell
...
but on Ubuntu 18.04.5, I get instead:
...
spawn /bin/sh^M
PS1="gdb-subshell$ "^M
$ gdb-subshell$ FAIL: gdb.base/batch-preserve-term-settings.exp: batch run: \
spawn shell (timeout)
...
Fix this by making the regexp recognize the second pattern as well.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-12-16 Tom de Vries <tdevries@suse.de>
* gdb.base/batch-preserve-term-settings.exp: