Commit Graph

108023 Commits

Author SHA1 Message Date
Mike Frysinger
68c2129ae6 sim: v850: delete old gencode logic
The v850 port used to have a gencode helper, but it was deleted long
ago.  Clean up the settings that no longer make sense w/out it.
2021-10-31 01:49:17 -04:00
Mike Frysinger
2213e33dd2 sim: common: merge multiple clean commands
This provides a minor speedup when cleaning in a multi-target build.
2021-10-31 01:17:10 -04:00
Mike Frysinger
b46621118d sim: m32c: tighten up opc2c build output
Drop the single debugging line that repeats the command line option,
and use the silent build helpers to tighten up output.
2021-10-31 01:11:41 -04:00
Mike Frysinger
9709fa5bcb sim: tighten up build regen rules
Update the makefile & configure related rules to use the silent
build helpers.
2021-10-31 01:08:05 -04:00
Mike Frysinger
4837497a7f sim: tighten up gencode output
Update the gencode rules to use the silent build helpers.
2021-10-31 01:05:27 -04:00
Mike Frysinger
ac9b6df28f sim: igen: tighten up build output
Add a new stamp helper for quiet builds, and don't dump the command
line options when it runs.  That isn't standard tool behavior, and
doesn't really seem necessary in any way.
2021-10-31 00:55:50 -04:00
Mike Frysinger
65f42b88ff sim: tighten up stamp rules
Add a new ECHO_STAMP helper and convert existing stamp code over
to it.  This is mostly common rules and cgen mloop rules.
2021-10-31 00:49:39 -04:00
Mike Frysinger
b6143d3162 sim: silence stamp touch rules
We pretty much never care about these stamp touches, so silence them.
Also switch to using $@ when it makes sense.
2021-10-31 00:46:28 -04:00
Mike Frysinger
4f2b181ecb sim: standardize move-if-change rules
Use the srcroot path and make them all silent.
2021-10-31 00:39:40 -04:00
Mike Frysinger
bdcbd1b67f sim: mips/v850: remove redundant variable setup
The common/Make-common.in fragment already provides these variables.
2021-10-31 00:23:36 -04:00
Orgad Shaneh
1352aabb23 sim: fix compilation on mingw64 [PR sim/28476]
...by reordering includes.

1. sim-utils.c

sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h
which has UserMode as a member. So if sim-main.h is included before winnt.h,
compilation fails.

2. ppc

registers.h defines CR, which is used as a member in winnt.h.

winsock2.h is included by sys/time.h, so sys/time.h has to be included
before registers.h.

Bug: https://sourceware.org/PR28476
2021-10-30 23:50:09 -04:00
Alan Modra
590abc168f Don't include coff/pe.h in coff-x86_64.c
This (and other) code from coffcode.h is broken for x86_64_coff_vec,
and has been ever since support was added in 2006 commit 99ad839030
Here, bfd_coff_aoutsz must match coff_swap_aouthdr_out otherwise we
end up writing garbage.

      /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
	 include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)).  */
      char * buff;
      bfd_size_type amount = bfd_coff_aoutsz (abfd);

      buff = (char *) bfd_malloc (amount);
      if (buff == NULL)
	return false;

      coff_swap_aouthdr_out (abfd, & internal_a, buff);
      amount = bfd_bwrite (buff, amount, abfd);

We have removed support for --target=x86_64-coff, likely because it
never worked properly, but still produce coff-x86_64.o with
--enable-targets=all.  This means objcopy can recognize x86_64 COFF
files but will write garbage to the output file, a fact found by
fuzzers.  I suspect x86_64 COFF is still broken after this fix, and
mention of coff-x86_64.* should be removed from bfd/Makefile.am.

	* coff-x86_64.c: Don't include coff/pe.h.
	(COFF_WITH_pex64): Don't define here.
	* pe-x86_64.c: Include coff/pe.h and other headers.
	(PEI_HEADERS): Define.
2021-10-31 11:42:52 +10:30
Alan Modra
1c5e9d8d8c Re: PR28420, ecoff fuzzing failures
sym_ptr_ptr NULL results in segfaults.

	PR 28420
	* ecoff.c (ecoff_slurp_reloc_table): Don't leave sym_ptr_ptr NULL.
2021-10-31 11:42:08 +10:30
Alan Modra
9216910ed8 ubsan: alpha-vms: undefined shift
* vms-alpha.c (evax_bfd_print_image): Shift left 1u.
2021-10-31 11:41:39 +10:30
Alan Modra
3c8ed65a5d PR28518: signed integer overflow & free on unmalloced address
PR 28518
	* vms-alpha.c (build_module_list): Don't lose malloc buffer address.
	Use unsigned variables.
2021-10-31 10:57:52 +10:30
GDB Administrator
fb9f44d410 Automatic date update in version.in 2021-10-31 00:00:09 +00:00
Simon Marchi
311d36251d gdb: fix gdb.gdb/unittest.exp with C++17 compiler
On a machine with gcc 11, I get:

    FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_v" (second tab) (timeout)
    FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_vie" (timeout)

That's because when compiling with C++ >= 17, we use the standard
version of string_view, and don't have a selftest for it.  So the list
of selftests shown by the tab completion when completing "string_v"
differs.

Change the test to use the copy_* tests instead.

Change-Id: I85f6aa44ee5fc9652b9bd4451e0506b89773526b
2021-10-29 22:17:07 -04:00
Aaron Merey
3ea44f2129 gdb.texinfo: Expand documentation for debuginfod
Add section describing GDB's usage of debuginfod.

Refer to this new section in the description of the '--with-debuginfod'
configure option.

Mention debuginfod in the 'Separate Debug Files' section.
2021-10-29 20:58:21 -04:00
Aaron Merey
7811fa5995 gdb: add set/show commands for managing debuginfod
Add 'set debuginfod' command.  Accepts 'on', 'off' or 'ask' as an
argument.  'on' enables debuginfod for the current session.  'off'
disables debuginfod for the current session.  'ask' will prompt
the user to either enable or disable debuginfod when the next query
is about to be performed:

    This GDB supports auto-downloading debuginfo from the following URLs:
    <URL1> <URL2> ...
    Enable debuginfod for this session? (y or [n]) y
    Debuginfod has been enabled.
    To make this setting permanent, add 'set debuginfod on' to .gdbinit.

For interactive sessions, 'ask' is the default.  For non-interactive
sessions, 'off' is the default.

Add 'show debuginfod status' command.  Displays whether debuginfod
is set to 'on', 'off' or 'ask'.

Add 'set/show debuginfod urls' commands. Accepts a string of
space-separated debuginfod server URLs to be queried.  The default
value is copied from the DEBUGINFOD_URLS environment variable.

Finally add 'set/show debuginfod verbose' commands to control whether
debuginfod-related output is displayed.  Verbose output is enabled
by default.

    (gdb) run
    Starting program: /bin/sleep 5
    Download failed: No route to host.  Continuing without debug info for /lib64/libc.so.6.

If GDB is not built with debuginfod then these commands will just display

    Support for debuginfod is not compiled into GDB.
2021-10-29 20:58:21 -04:00
GDB Administrator
4a3a56c5f3 Automatic date update in version.in 2021-10-30 00:00:26 +00:00
Simon Marchi
51e36a3aaa gdb: remove TYPE_FIELD_DWARF_BLOCK
Remove TYPE_FIELD_DWARF_BLOCK, replace with type::field +
field::loc_dwarf_block.

Change-Id: I10af9410bb5f46d342b8358a7956998c7e804b64
2021-10-29 16:44:45 -04:00
Simon Marchi
e06c3e112e gdb: remove TYPE_FIELD_STATIC_PHYSADDR
Remove TYPE_FIELD_STATIC_PHYSADDR replace with type::field +
field::loc_physaddr.

Change-Id: Ica9bc4a48f34750ec82ec86c298d3ecece81bcbd
2021-10-29 16:44:45 -04:00
Simon Marchi
fcbbbd90f0 gdb: remove TYPE_FIELD_STATIC_PHYSNAME
Remove TYPE_FIELD_STATIC_PHYSNAME, replace with type::field +
field::loc_physname.

Change-Id: Ie35d446b67dd1d02f39998b406001bdb7e6d5abb
2021-10-29 16:44:45 -04:00
Simon Marchi
970db51860 gdb: remove TYPE_FIELD_ENUMVAL
Remove TYPE_FIELD_ENUMVAL, replace with type::field +
field::loc_enumval.

Change-Id: I2ada73e4635aad3363ce2eb22c1dc52698ee2072
2021-10-29 16:44:45 -04:00
Simon Marchi
b610c04548 gdb: remove TYPE_FIELD_BITPOS
Remove TYPE_FIELD_BITPOS, replace its uses with type::field +
field::loc_bitpos.

Change-Id: Iccd8d5a77e5352843a837babaa6bd284162e0320
2021-10-29 16:44:44 -04:00
Simon Marchi
2ad53ea10c gdb: remove TYPE_FIELD_LOC_KIND
Remove TYPE_FIELD_LOC_KIND, replace its uses with type::field +
field::loc_kind.

Change-Id: Ib124a26365df82ac1d23df7962d954192913bd90
2021-10-29 16:44:21 -04:00
Simon Marchi
d8557c3d22 gdb: remove FIELD_DWARF_BLOCK macro
Remove FIELD_DWARF_BLOCK, replace its uses with field::loc_dwarf_block.

Change-Id: I66b7d6a960cb5e341e61e21bd3cc9a6ac26de6a8
2021-10-29 16:44:21 -04:00
Simon Marchi
31a1516a81 gdb: remove FIELD_STATIC_PHYSADDR macro
Remove FIELD_LOC_KIND_PHYSADDR, replace its uses with
field::loc_physaddr.

Change-Id: Ifd8b2bdaad75f42bfb1404ef8c396ffe7e10ac55
2021-10-29 16:44:21 -04:00
Simon Marchi
16654a591a gdb: remove FIELD_STATIC_PHYSNAME macro
Remove FIELD_STATIC_PHYSNAME, replace its uses with field::loc_physname.

Change-Id: Iaa8952410403b4eb5bbd68411feea27e2405d657
2021-10-29 16:44:21 -04:00
Simon Marchi
5d2038e3f5 gdb: remove FIELD_ENUMVAL macro
Remove FIELD_ENUMVAL, replace its uses with field::loc_enumval.

Change-Id: Id4861cee91a8bb583a9836f1aa5da0a320fbf4d9
2021-10-29 16:44:21 -04:00
Simon Marchi
3a543e211e gdb: remove FIELD_BITPOS macro
Remove FIELD_BITPOD, replace its uses with field::loc_bitpos.

Change-Id: Idb99297e0170661254276c206383a7e9bf1a935a
2021-10-29 16:44:21 -04:00
Simon Marchi
8d939e8ea4 gdb: remove FIELD_LOC_KIND macro
Remove FIELD_LOC_KIND, replace its uses with field::loc_kind or
call_site_target::loc_kind.

Change-Id: I0368d8c3ea269d491bb215aa70e32edbdf55f389
2021-10-29 16:44:20 -04:00
Tom Tromey
d3771fe234 Add gdb.Architecture.integer_type Python function
This adds a new Python function, gdb.Architecture.integer_type, which
can be used to look up an integer type of a given size and
signed-ness.  This is useful to avoid dependency on debuginfo when a
particular integer type would be useful.

v2 moves this to be a method on gdb.Architecture and addresses other
review comments.
2021-10-29 07:52:31 -06:00
Tom Tromey
7a72f09da5 Remove ada_value_print_inner
I noticed that the only caller of ada_value_print_inner is
valprint.c:do_val_print (via ada_language::value_print_inner), meaning
that the try/catch logic in this function is redundant.  This patch
removes the wrapper function.

Regression tested on x86-64 Fedora 34.
2021-10-29 07:46:28 -06:00
Tom Tromey
52429bbd71 Document resolve_dynamic_type oddity
Today I re-learned that resolve_dynamic_type can return a type for
which is_dynamic_type returns true.  This can happen for an array
whose elements have dynamic type -- the array is reported as dynamic,
but resolving the elements would be incorrect, because each element
might have a different type after resolution.

You can see the special case in resolve_dynamic_array_or_string:

  if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
...
  else
...

I looked into having the TYPE_CODE_ARRAY case in
is_dynamic_type_internal follow this same logic, but that breaks down
on the gdb.fortran/dynamic-ptype-whatis.exp test case.  In particular
this code in fortran_undetermined::evaluate:

  value *callee = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
  if (noside == EVAL_AVOID_SIDE_EFFECTS
      && is_dynamic_type (value_type (callee)))
    callee = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL);

... relies on is_dynamic_type returning true for such an array.

I wasn't really sure of the best way to fix this, so in the meantime I
wrote this patch, which documents the oddity so that I might have a
chance of remembering this in the future.
2021-10-29 07:33:13 -06:00
Tom Tromey
9e6978753d Avoid self-test failures on x86-linux
The disassembly tests in "maint selftest" will fail on x86-linux.
This happens because opcodes rejects an attempt to disassemble for an
arch with a 64-bit address size when bfd_vma is 32-bit.

This patch avoids this problem by avoiding the test in this case.  I
chose to do it this way because this seems to be the only situation
where opcodes checks the size of bfd_vma.

For v2 of this patch, I've also updated memory_error_test to do the
same thing.  This is needed due to the "improve error reporting from
the disassembler" patch.
2021-10-29 07:23:38 -06:00
Tom de Vries
b88e456f7e [gdb/build] Fix build with --disable-unit-tests
A build with --disable-unit-tests currently run into:
...
ld: maint.o: in function \
  `maintenance_selftest_completer(cmd_list_element*, completion_tracker&,
                                  char const*, char const*)':
src/gdb/maint.c:1183: undefined reference to \
  `selftests::for_each_selftest(
    gdb::function_view<
      void (std::__cxx11::basic_string<char,std::char_traits<char>,
                                       std::allocator<char> > const&)>)'
...

Fix this by guarding the call to selftests::for_each_selftest in
maintenance_selftest_completer with GDB_SELF_TEST, such that the "-verbose"
completion still works.

Rebuild on x86_64-linux and ran gdb.gdb/unittest.exp.
2021-10-29 14:11:08 +02:00
Enze Li
91b7c7e522 Document "memory-tag-violations".
* gdb/doc/gdb.texinfo: (Data): Document	'-memory-tag-violations'.
 (Command Options): Update the example.
2021-10-29 13:31:37 +03:00
Tejas Belagod
09854a8870 Support for a new pacbti unwind opcode.
This patch adds readelf support for decoding the exception table
opcode for restoring the RA_AUTH_CODE pseudo register defined by the
EHABI
(https://github.com/ARM-software/abi-aa/releases/download/2021Q1/ehabi32.pdf
Section 10.3).

	* readelf.c (decode_arm_unwind_bytecode): Add support to decode
	restoring RA_AUTH_CODE pseudo register.
2021-10-29 20:37:17 +10:30
Alan Modra
dd6b67bec8 Re: arm: add unwinder encoding support for PACBTI
Move the gas testsuite files to where they belong.
2021-10-29 19:46:18 +10:30
Alan Modra
c45c3dba8c ELF core file size checks
Catch fuzzed segments where p_offset + p_filesz wraps, and limit error
output.

	* elfcore.h (elf_core_file_p): Rewrite segment checks using
	bfd_get_file_size.  Set read_only on file size errors.
	* elfcode.h (elf_swap_shdr_in): Don't repeat error message.
2021-10-29 17:22:32 +10:30
Alan Modra
c82ebeb7e6 obcopy vs. files with silly section alignment
We already ignore stupid segment alignment when rewriting headers,
ignore section alignment too.

	* elf.c (rewrite_elf_program_header): Ignore section alignment
	power greater than 62.
2021-10-29 15:48:22 +10:30
GDB Administrator
208eb58158 Automatic date update in version.in 2021-10-29 00:00:18 +00:00
Stafford Horne
cb22a7c366 gdb: Add OpenRISC gdbserver and native config news
The previous patches added gdbserver and native debugging support
for OpenRISC targets.  This patch documents that in the news.
2021-10-29 05:54:44 +09:00
Stafford Horne
5729359001 gdb: or1k: add single step for linux native debugging
Needed for single stepping in Linux, this adds the or1k implementation
of or1k_software_single_step.  Most of the implementation is borrowed
from the bare metal single step code from or1k_single_step_through_delay
which has been extracted and shared in helper function
or1k_delay_slot_p.
2021-10-29 05:22:13 +09:00
Stafford Horne
a45b1e66c5 gdb: or1k: add native linux support
This patch adds support for running gdb natively on OpenRISC linux.
Debugging support is provided via the linux PTRACE interface which is
mostly handled by GDB genric code.  This patch provides the logic of how
to read and write the ptrace registers between linux and GDB.

Single stepping is privided in a separate patch.
2021-10-29 05:22:12 +09:00
Stafford Horne
d336377196 gdb: or1k: add generated linux descriptor file 2021-10-29 05:22:12 +09:00
Stafford Horne
d786a34732 gdb: or1k: fixup linux regcache comment
The old comment was not properly updated from the RISC-V example used.
Update it to match OpenRISC.
2021-10-29 05:22:12 +09:00
Stafford Horne
4933265c3f gdb: or1k: implement gdb server
This patch adds gdbserver support for OpenRISC.  This has been used for
debugging the glibc port that in being worked on here:

  https://github.com/openrisc/or1k-glibc/tree/or1k-port-2

Hence the comment about registers definitions being inline with glibc.
2021-10-29 05:22:12 +09:00
Christian Biesinger
cf365c10d0 [sim] Include defs.h in ppc/hw_memory.c
To fix this error (seen on cygwin):
/../../sim/ppc/../common ../../../sim/ppc/hw_memory.c
In file included from ../../gnulib/import/stdlib.h:100,
                 from ../../../sim/ppc/hw_memory.c:28:
../../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
  663 |  #error "Please include config.h first."
      |   ^~~~~
../../gnulib/import/unistd.h:665:24: error: expected ';' before 'extern'
  665 | _GL_INLINE_HEADER_BEGIN
      |                        ^
      |                        ;
../../gnulib/import/unistd.h:2806:22: error: expected ';' before 'extern'
 2806 | _GL_INLINE_HEADER_END
      |                      ^
      |                      ;
2021-10-28 15:09:00 -04:00