113608 Commits

Author SHA1 Message Date
4a5752f31d ld-libs test on alpha-vms
* testsuite/ld-libs/libs.exp: Don't run for alpha-vms.
2023-02-21 16:21:25 +10:30
294540ac96 alpha-*-vms missing libraries
For this:
./ld-new: cannot find -limagelib: No such file or directory
./ld-new: cannot find -lstarlet: No such file or directory
./ld-new: cannot find -lsys$public_vectors: No such file or directory
the logs showed
creating dummy tmpdir/libimagelib:
creating dummy No
creating dummy such
etc.
So rubbish instead of tmpdir/libimagelib.a and the other required libs.

	* testsuite/config/default.exp: Correct regex detecting missing
	libraries automatically searched by alpha-dec-vms-ld.
2023-02-21 16:18:53 +10:30
da4bb410df Automatic date update in version.in 2023-02-21 00:00:24 +00:00
dbe7ee1a87 Redefine FUNCTION in doc.str
FUNCTION is identical to func, so simplify doc.str.

2023-02-17  Tom Tromey  <tom@tromey.com>

	* doc/doc.str (FUNCTION): Call func.
2023-02-20 14:35:15 -07:00
03a7c6eb51 Hoist the SECTION comment in opncls.c
The opening and closing node in BFD starts:

    File: bfd.info, [...]

	 /* Set to N to open the next N BFDs using an alternate id space.  */
	 extern unsigned int bfd_use_reserved_id;

    2.13 Opening and closing BFDs
    =============================

That is, there's a stray C comment and declaration before any other
text or subsections.

This occurs because the code fragment for bfd_use_reserved_id comes
before the SECTION comment.  Hoisting it makes this a little nicer.

2023-02-17  Tom Tromey  <tom@tromey.com>

	* opncls.c: Hoist the SECTION comment.
2023-02-20 14:35:15 -07:00
2070491c1c Don't use chew comments for static functions
I found a few static functions in the BFD manual.  These can't be
called by any user of the library, so I don't think it's useful to put
them in the manual.  This patch removes the chew markup from their
comments.

2023-02-17  Tom Tromey  <tom@tromey.com>

	* opncls.c (bfd_get_debug_link_info_1, separate_debug_file_exists)
	(separate_alt_debug_file_exists, find_separate_debug_file)
	(get_build_id, get_build_id_name, check_build_id_file): Don't use
	chew comments.
2023-02-20 14:35:15 -07:00
ee0e172301 Fix formatting of long function description in chew output
Currently, if a function description spans a line, the resulting info
can look like this:

 -- Function: long bfd_canonicalize_reloc
     (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); Call the
     back end associated with the open BFD ABFD and translate the
     external form of the relocation information attached to SEC into
     the internal canonical form.  Place the table into memory at LOC,

That is, the function prototype runs together with the text in an ugly
way.  This patch fixes this by introducing a new primitive, so that
the generated Texinfo can be a bit nicer.  Now this output looks like:

 -- Function: long bfd_canonicalize_reloc (bfd *abfd, asection *sec,
          arelent **loc, asymbol **syms);
     Call the back end associated with the open BFD ABFD and translate
     the external form of the relocation information attached to SEC

2023-02-17  Tom Tromey  <tom@tromey.com>

	* doc/doc.str (SYNOPSIS): Use collapse_whitespace.
	* doc/chew.c (collapse_whitespace): New function.
	(main): Register collapse_whitespace.
2023-02-20 14:35:15 -07:00
c22ff44927 opcodes: style m68k disassembler output 2023-02-20 19:39:01 +01:00
19005d1989 gdb: revert one erroneous bool-ification change
Commit 42c13555ff88 ("Change value::m_stack to bool") erroneously
changed a `0` to `false` in this call to read_value_memory.  This
parameter is `LONGEST bit_offset`, it should stay `0`.

Change-Id: I128df6834cf8055ec6a7051e237e379978d3d651
2023-02-20 11:53:34 -05:00
a38cd00799 ld/testsuite: handle Windows drive letter in a noinit test
The regexp in "noinit sections (ld -r)" is skipping the file path before
the first ":". However, on Windows, a path can start with "C:". Adjust
the regexp to allow such cases.

ld/ChangeLog:

	* testsuite/ld-elf/noinit-sections-2.l: Allow Windows paths
	(starting with C:).
2023-02-20 15:24:00 +01:00
df937aa12a ld/testsuite: adjust to Windows path separator.
In some tests, the path reported on Windows will have a \ instead of a
/. This occurs when a file is concatened with the search path in
ldfile.c.:  "ld -Ltmpdir -ltext" will result into "tmpdir\libtext.a".

ld/ChangeLog:

	* testsuite/ld-elf/retain5.map: Allow \ path separator.
	* testsuite/ld-plugin/plugin-10.d: Likewise.
	* testsuite/ld-plugin/plugin-11.d: Likewise.
	* testsuite/ld-plugin/plugin-18.d: Likewise.
	* testsuite/ld-plugin/plugin-19.d: Likewise.
	* testsuite/ld-plugin/plugin-20.d: Likewise.
	* testsuite/ld-plugin/plugin-22.d: Likewise.
2023-02-20 15:23:56 +01:00
a5b6347b66 gdb/doc: Consistency fixes for GDB/MI documentation
I noticed two inconsistencies in the GDB/MI documentation, which this
commit addresses:

  1. Each MI command is introduced like this:

     @subheading The @code{-command-name} Command

     Except for a few of the tracing command, which just use:

     @subheading -command-name

     In this commit I've updated all these trace commands to use the
     more common format.

  2. Each MI command starts with a @subheading, and then the details
     of that command are split up using multiple @subsubheading
     entries.

     Except for a few commands which use @subheading for the top-level
     command, and then continue to use @subheading for each part of
     the command description.

     In this commit I've updated these to use @subsubheading where
     appropriate.
2023-02-20 14:18:03 +00:00
c9802aca6d So the linker from producing an export data table when run with --exclude-all-symbols.
PR 30004 * pe-dll.c (pe_dll_build_sections): Do not build an edata section if all symbols are being excluded.
2023-02-20 11:32:52 +00:00
868014341a [gdb/symtab] Trust epilogue unwind info for unknown or non-gcc producer
Currently we only trust epilogue unwind info only for gcc >= 4.5.0.

This has the effect that we don't trust epilogue unwind info for:
- unknown producers (CU without DW_AT_producer attribute)
- non-gcc producers (say, clang).

Instead, only distrust epilogue unwind info only for gcc < 4.5.0.
2023-02-20 12:20:14 +01:00
8908d9c45c [gdb/symtab] Trust epilogue unwind info for unknown producer (-g0 case)
For a -g0 -fasynchronous-unwind-tables exec (without .debug_info but with
.eh_frame section), start using the dwarf2 unwinder instead of the
"amd64 epilogue override" unwinder, by returning true in
compunit_epilogue_unwind_valid for cust == nullptr.

This has effect both on the amd64 and i386 targets, but only add amd64
test-case gdb.base/unwind-on-each-insn-amd64-2.exp.
2023-02-20 12:20:14 +01:00
5aca7eaa2b [gdb/tdep] Add amd64/i386 epilogue override unwinders
For amd64 the current frame-unwinders are:
...
$ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders"
The target architecture is set to "i386:x86-64".
dummy                   DUMMY_FRAME
dwarf2 tailcall         TAILCALL_FRAME
inline                  INLINE_FRAME
python                  NORMAL_FRAME
amd64 epilogue          NORMAL_FRAME
dwarf2                  NORMAL_FRAME
dwarf2 signal           SIGTRAMP_FRAME
amd64 sigtramp          SIGTRAMP_FRAME
amd64 prologue          NORMAL_FRAME
...

For a -g0 -fasynchronous-unwind-tables exec (without .debug_info but with
.eh_frame section), we'd like to start using the dwarf2 unwinder instead of
the "amd64 epilogue" unwinder, by returning true in
compunit_epilogue_unwind_valid for cust == nullptr.

But we'd run into the following problem for a -g0
-fno-asynchronous-unwind-tables (without .debug_info and .eh_frame section)
exec:
- the "amd64 epilogue" unwinder would not run
  (because compunit_epilogue_unwind_valid () == true)
- the dwarf2 unwinder would also not run
  (because there's no .eh_frame info).

Fix this by:
- renaming the "amd64 epilogue" unwinder to "amd64 epilogue override", and
- adding a fallback "amd64 epilogue" after the dwarf unwinders,
while making sure that only one of the two is active.  Likewise for i386.  NFC.

For amd64, this results in this change:
...
 $ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders"
 The target architecture is set to "i386:x86-64".
 dummy                   DUMMY_FRAME
 dwarf2 tailcall         TAILCALL_FRAME
 inline                  INLINE_FRAME
 python                  NORMAL_FRAME
-amd64 epilogue          NORMAL_FRAME
+amd64 epilogue override NORMAL_FRAME
 dwarf2                  NORMAL_FRAME
 dwarf2 signal           SIGTRAMP_FRAME
+amd64 epilogue          NORMAL_FRAME
 amd64 sigtramp          SIGTRAMP_FRAME
 amd64 prologue          NORMAL_FRAME
...

And for i386:
...
 $ gdb -q -batch -ex "set arch i386" -ex "maint info frame-unwinders"
 The target architecture is set to "i386".
 dummy                   DUMMY_FRAME
 dwarf2 tailcall         TAILCALL_FRAME
 iline                  INLINE_FRAME
-i386 epilogue           NORMAL_FRAME
+i386 epilogue override  NORMAL_FRAME
 dwarf2                  NORMAL_FRAME
 dwarf2 signal           SIGTRAMP_FRAME
+i386 epilogue           NORMAL_FRAME
 i386 stack tramp        NORMAL_FRAME
 i386 sigtramp           SIGTRAMP_FRAME
 i386 prologue           NORMAL_FRAME
...
2023-02-20 12:20:14 +01:00
2f9f989c2b [gdb/tdep] Fix amd64/i386_stack_frame_destroyed_p
The use of compunit_epilogue_unwind_valid in both amd64_stack_frame_destroyed_p
and i386_stack_frame_destroyed_p is problematic, in the sense that the
functions no longer match their documented behaviour.

Fix this by moving the use of compunit_epilogue_unwind_valid to
amd64_epilogue_frame_sniffer and i386_epilogue_frame_sniffer.  No functional
changes.
2023-02-20 12:20:14 +01:00
cb911672fb [gdb/symtab] Factor out compunit_epilogue_unwind_valid
Factor out compunit_epilogue_unwind_valid from both
amd64_stack_frame_destroyed_p and i386_stack_frame_destroyed_p.  No functional
changes.

Also add a comment in the new function about the assumption that in absence of
producer information, epilogue unwind info is invalid.

Approved-By: Tom Tromey <tom@tromey.com>
2023-02-20 12:20:14 +01:00
1bcaeecb7f [gdb/testsuite] Add xfail case in gdb.python/py-record-btrace.exp
I came across:
...
gdb) PASS: gdb.python/py-record-btrace.exp: prepare record: stepi 100
python insn = r.instruction_history^M
warning: Non-contiguous trace at instruction 1 (offset = 0x3e10).^M
(gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: python insn = r.i\
nstruction_history
...

I'm assuming it's the same root cause as for the already present XFAIL.

Fix this by recognizing above warning in the xfail regexp.

Tested on x86_64-linux, although sofar I was not able to trigger the warning
again.

Approved-By: Markus T. Metzger <markus.t.metzger@intel.com>
2023-02-20 11:16:02 +01:00
13d4a4bd5a [gdb/testsuite] Fix gdb.threads/schedlock.exp for gcc 4.8.5
Since commit 9af467b8240 ("[gdb/testsuite] Fix gdb.threads/schedlock.exp on
fast cpu"), the test-case fails for gcc 4.8.5.

The problem is that for gcc 4.8.5, the commit turned a two-line loop:
...
(gdb) next
78          while (*myp > 0)
(gdb) next
81              MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
(gdb) next
78          while (*myp > 0)
...
into a three-line loop:
...
(gdb) next
83              MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
(gdb) next
84              cnt++;
(gdb) next
85            }
(gdb) next
83              MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
(gdb)
...
and the test-case doesn't expect this.

Fix this by reverting back to the original loop shape as much as possible by:
- removing the cnt++ line
- replacing "while (1)" with "while (one)", where one is a volatile variable
  set to 1.

Tested on x86_64-linux, using compilers:
- gcc 4.8.5, 7.5.0, 12.2.1
- clang 4.0.1, 13.0.1
2023-02-20 11:16:02 +01:00
c50e4ced39 In-memory nested archives
alpha-linuxecoff has compressed archives that are decompressed to a
bfd-in-memory.  We'd need to handle quite a lot of corner cases to
support nesting of such archives, so just stop it before we run into
segfaults later.

	* opncls.c (_bfd_new_bfd_contained_in): Prohibit nested
	archives in memory.
2023-02-20 11:21:36 +10:30
9a7f501ec3 Automatic date update in version.in 2023-02-20 00:00:14 +00:00
0d1912950e Convert contained_in to method
This converts contained_in to be a method of block.
2023-02-19 12:51:06 -07:00
b32797e8b9 Make block members 'private'
This changes block to make the data members 'private'.
2023-02-19 12:51:06 -07:00
522553837b Remove allocate_block and allocate_global_block
This removes allocate_block and allocate_global_block in favor of
simply calling 'new'.
2023-02-19 12:51:06 -07:00
56c0cd6158 Have global_block inherit from block
This changes global_block to inherit from block, which is what was
always intended.
2023-02-19 12:51:06 -07:00
44bb9f9e7a Use 'new' for block and global_block
This changes block and global_block to add initializers, and then to
use 'new' for allocation.
2023-02-19 12:51:06 -07:00
69fb3874a7 Fix memory leak in mdebugread.c
mdebugread.c allocates blocks on the heap.  However, this is a memory
leak if the corresponding objfile is ever destroyed.

This patch changes this code to use allocate_block instead, fixing a
FIXME from 2003.

I don't know how to test this patch.
2023-02-19 12:51:06 -07:00
548a89df23 Remove ALL_BLOCK_SYMBOLS
This removes ALL_BLOCK_SYMBOLS in favor of foreach.
2023-02-19 12:51:06 -07:00
a1b294260f Remove ALL_BLOCK_SYMBOLS_WITH_NAME
This removes ALL_BLOCK_SYMBOLS_WITH_NAME in favor of foreach.
2023-02-19 12:51:06 -07:00
1c49bb455c Convert explicit iterator uses to foreach
This converts most existing explicit uses of block_iterator to use
foreach with the range iterator instead.
2023-02-19 12:51:06 -07:00
0f50815c89 Introduce a block iterator wrapper
This introduces a C++-style iterator that wraps the existing
block_iterator.  It also adds a range adapter.  These will be used in
a later patch.
2023-02-19 12:51:06 -07:00
81326ac076 Combine both styles of block iterator
This merges the two styles of block iterator, having the
initialization API decide which to use based on an optional parameter.
2023-02-19 12:51:06 -07:00
0688bf443c Store 'name' in block_iterator
This changes the block_iterator to store the 'name' that is used by
block_iter_match_next.  This avoids any problem where the name could
be passed inconsistently, and also makes the subsequent patches easier
to understand.
2023-02-19 12:51:06 -07:00
7bf30a4447 Convert block_static_link to method
This converts block_static_link to be a method.  This was mostly
written by script.
2023-02-19 12:51:06 -07:00
cade9c8a45 Convert set_block_compunit_symtab to method
This converts set_block_compunit_symtab to be a method.  This was
mostly written by script.
2023-02-19 12:51:06 -07:00
d24e14a0c6 Convert block_static_block and block_global_block to methods
This converts block_static_block and block_global_block to be methods.
This was mostly written by script.  It was simpler to convert them at
the same time because they're often used near each other.
2023-02-19 12:51:06 -07:00
99f3dfd0f9 Convert block_containing_function to method
This converts block_containing_function to be a method.  This was
mostly written by script.
2023-02-19 12:51:06 -07:00
3c9d050626 Convert block_linkage_function to method
This converts block_linkage_function to be a method.  This was mostly
written by script.
2023-02-19 12:51:05 -07:00
3c45e9f915 Convert more block functions to methods
This converts block_scope, block_set_scope, block_using, and
block_set_using to be methods.  These are all done at once to make it
easier to also convert block_initialize_namespace at the same time.
This was mostly written by script.
2023-02-19 12:51:05 -07:00
a4dfe74756 Convert block_inlined_p to method
This converts block_inlined_p to be a method.  This was mostly written
by script.
2023-02-19 12:51:05 -07:00
7f5937df01 Convert block_gdbarch to method
This converts block_gdbarch to be a method.  This was mostly written
by script.
2023-02-19 12:51:05 -07:00
46baa3c6cf Convert block_objfile to method
This converts block_objfile to be a method.  This was mostly written
by script.
2023-02-19 12:51:05 -07:00
8f14fd1120 Don't allow NULL as an argument to block_global_block
block_global_block has special behavior when the block is NULL.
Remove this and patch up the callers instead.
2023-02-19 12:51:05 -07:00
7800409613 Don't allow NULL as an argument to block_static_block
block_static_block has special behavior when the block is NULL.
Remove this and patch up the callers instead.
2023-02-19 12:51:05 -07:00
392c1cbd74 Don't allow NULL as an argument to block_using
block_using has special behavior when the block is NULL.
Remove this.  No caller seems to be affected.
2023-02-19 12:51:05 -07:00
683aecac8c Don't allow NULL as an argument to block_scope
block_scope has special behavior when the block is NULL.
Remove this and patch up the callers instead.
2023-02-19 12:51:05 -07:00
f52688890e Avoid extra allocations in block
block_set_scope and block_set_using unconditionally allocate the block
namespace object.  However, this isn't truly needed, so arrange to
only allocate when it is.
2023-02-19 12:51:05 -07:00
4aabc41664 Rearrange block.c to avoid a forward declaration
Moving block_initialize_namespace before its callers lets us avoid a
forward declaration.
2023-02-19 12:51:05 -07:00
0ea8d78bd3 Buffer overflow in evax_bfd_print_eobj
* vms-alpha.c (evax_bfd_print_eobj): Rewrite header handling,
	sanity checking rec_len.  Check bfd_malloc return.
2023-02-19 13:17:41 +10:30