packaging: add binutils-libs dependency in build
[platform/upstream/binutils.git] / ChangeLog.git
1 2023-01-14  GDB Administrator  <gdbadmin@sourceware.org>
2
3         Automatic date update in version.in
4
5 2023-01-13  Nick Clifton  <nickc@redhat.com>
6
7         Updated Romainian translation for the bfd sub-directory
8
9 2023-01-13  GDB Administrator  <gdbadmin@sourceware.org>
10
11         Automatic date update in version.in
12
13 2023-01-12  Hans-Peter Nilsson  <hp@axis.com>
14
15         ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
16         Since commit 9833b7757d24, "PR28824, relro security issues",
17         ELF_MAXPAGESIZE matters much more, with regards to layout of
18         the linked file.  That commit fixed an actual bug, but also
19         exposes a problem for targets were that value is too high.
20
21         For example, for ARM(32, a.k.a. "Aarch32") specifically
22         bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU)
23         targets pay an extra amount of up to 60 KiB of bloat in
24         DSO:s and executables.  This matters when there are many
25         such files, and where storage is expensive.
26
27         It's *mostly* bloat when using a Linux kernel, as ARM(32) is
28         a good example of an target where ELF_MAXPAGESIZE is set to
29         an extreme value for an obscure corner-case.  The ARM
30         (32-bit) kernel has 4 KiB pages, has had that value forever,
31         and can't be configured to any other value.  The use-case is
32         IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but
33         not just that, but a setup where the Linux page-size is
34         configured to something other than the *default* 4 KiB.  Not
35         sure there actually any such systems in use, again with
36         both Aarch32 compatibility support and a non-4KiB pagesize,
37         with all the warnings in the kernel config and requiring the
38         "EXPERT" level set on.
39
40         So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only
41         one default max-page-size" and set ELF_MAXPAGESIZE to 4096.
42
43         bfd:
44                 * elf32-arm.c (ELF_MAXPAGESIZE): Always set to 0x1000.
45         (cherry picked from commit 1a26a53a0dee39106ba58fcb15496c5f13074652)
46
47 2023-01-12  Hans-Peter Nilsson  <hp@axis.com>
48
49         ld/testsuite: Adjust for ELF_MAXPAGESIZE 0x1000
50         Many tests reflect a setting of ELF_MAXPAGESIZE to 64 KiB.
51         With ELF_MAXPAGESIZE changed to 4 KiB, layout is sometimes
52         different and symbols end up in other places.  Avoid churn
53         and regexpification of old test patterns by passing the
54         max-page-size setting active at the time.
55
56         ld/testsuite:
57
58                 * testsuite/ld-arm/arm-elf.exp,
59                 testsuite/ld-arm/non-contiguous-arm2.d,
60                 testsuite/ld-arm/non-contiguous-arm3.d,
61                 testsuite/ld-arm/non-contiguous-arm5.d,
62                 testsuite/ld-arm/non-contiguous-arm6.d,
63                 testsuite/ld-arm/thumb-plt-got.d, testsuite/ld-arm/thumb-plt.d:
64                 Pass -z max-page-size=0x10000 explicitly to test that rely on
65                 that value in output-matching patterns.
66         (cherry picked from commit b305015577bb92d3041e55a72ca8cd43f7c05748)
67
68 2023-01-12  Nick Alcock  <nick.alcock@oracle.com>
69
70         libctf: ctf-link outdated input check faulty
71         This check has a pair of faults which, combined, can lead to memory
72         corruption.  Firstly, it assumes that the values of the ctf_link_inputs
73         hash are ctf_dict_t's: they are not, they are ctf_link_input_t's, a much
74         shorter structure.  So the flags check which is the core of this is
75         faulty (but happens, by chance, to give the right output on most
76         architectures, since usually we happen to get a 0 here, so the test that
77         checks this usually passes).  Worse, the warning that is emitted when
78         the test fails is added to the wrong dict -- it's added to the input
79         dict, whose warning list is never consumed, rendering the whole check
80         useless.  But the dict it adds to is still the wrong type, so we end up
81         overwriting something deep in memory (or, much more likely,
82         dereferencing a garbage pointer and crashing).
83
84         Fixing both reveals another problem: the link input is an *archive*
85         consisting of multiple members, so we have to consider whether to check
86         all of them for the outdated-func-info thing we are checking here.
87         However, no compiler exists that emits a mixture of members with this
88         flag on and members with it off, and the linker always reserializes (and
89         upgrades) such things when it sees them: so all members in a given
90         archive must have the same value of the flag, so we only need to check
91         one member per input archive.
92
93         libctf/
94                 PR libctf/29983
95                 * ctf-link.c (ctf_link_warn_outdated_inputs): Get the types of
96                 members of ctf_link_inputs right, fixing a possible spurious
97                 tesst failure / wild pointer deref / overwrite.  Emit the
98                 warning message into the right dict.
99
100 2023-01-12  Nick Clifton  <nickc@redhat.com>
101
102         Ensure that libbacktrace/allocfail.sh is not deleted when creating release tarballs.
103                 * Makefile.am (CLEANFILES): Import patch from upstream to prevent
104                 allocafail.sh from being removed when running 'make clean'.
105
106 2023-01-12  GDB Administrator  <gdbadmin@sourceware.org>
107
108         Automatic date update in version.in
109
110 2023-01-11  Nick Clifton  <nickc@redhat.com>
111
112         Fix a potential illegal memory access in the BFD library when parsing a corrupt DWARF file.
113                 PR 29988
114                 * dwarf2.c (read_indexed_address): Fix check for an out of range
115                 offset.
116
117 2023-01-11  Jan Beulich  <jbeulich@suse.com>
118
119         gas/RISC-V: adjust assembler for opcode table re-ordering
120         PR gas/29940
121
122         With the single-operand JAL entry now sitting ahead of the two-operand
123         one, the parsing of a two-operand insn would first try to parse an 'a'-
124         style operand, resulting in the insertion of bogus (and otherwise
125         unused) undefined symbols in the symbol table, having register names.
126         Since 'a' is used as 1st operand only with J and JAL, and since JAL is
127         the only insn _also_ allowing for a register as 1st operand (and then
128         there being a 2nd one), special case this parsing aspect right there.
129
130         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
131
132 2023-01-11  GDB Administrator  <gdbadmin@sourceware.org>
133
134         Automatic date update in version.in
135
136 2023-01-10  Stefan Schulze Frielinghaus  <stefansf@linux.ibm.com>
137
138         IBM zSystems: Fix offset relative to static TLS
139         For local exec TLS relocations of the form foo@NTPOFF+x the addend was
140         ignored.
141
142         bfd/ChangeLog:
143
144                 * elf32-s390.c (elf_s390_relocate_section): Honor addend for
145                 R_390_TLS_LE32.
146                 * elf64-s390.c (elf_s390_relocate_section): Honor addend for
147                 R_390_TLS_LE64.
148
149         ld/ChangeLog:
150
151                 * testsuite/ld-s390/reloctlsle-1.d: New test.
152                 * testsuite/ld-s390/reloctlsle-1.s: New test.
153
154         (cherry picked from commit aefebe82dc89711384b85329daa48d04c1d3a45b)
155
156 2023-01-10  GDB Administrator  <gdbadmin@sourceware.org>
157
158         Automatic date update in version.in
159
160 2023-01-09  Indu Bhagat  <indu.bhagat@oracle.com>
161
162         sframe: fix the defined SFRAME_FRE_TYPE_*_LIMIT constants
163         An earlier commit 3f107464 defined the SFRAME_FRE_TYPE_*_LIMIT
164         constants.  These constants are used (by gas and libsframe) to pick an
165         SFrame FRE type based on the function size.  Those constants, however,
166         were buggy, causing the generated SFrame sections to be bloated as
167         SFRAME_FRE_TYPE_ADDR2/SFRAME_FRE_TYPE_ADDR4 got chosen more often than
168         necessary.
169
170         gas/
171                 * sframe-opt.c (sframe_estimate_size_before_relax): Use
172                 typecast.
173                 (sframe_convert_frag): Likewise.
174
175         libsframe/
176                 * sframe.c (sframe_calc_fre_type): Use a more appropriate type
177                 for argument.  Adjust the check for SFRAME_FRE_TYPE_ADDR4_LIMIT
178                 to keep it warning-free but meaningful.
179
180         include/
181                 * sframe-api.h (sframe_calc_fre_type): Use a more appropriate
182                 type for the argument.
183                 * sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): Correct the constant.
184                 (SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise.
185                 (SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
186
187         (cherry picked from commit 725a19bfd142c845bf76ae28f6289972fd1cf5db)
188
189 2023-01-09  Indu Bhagat  <indu.bhagat@oracle.com>
190
191         libsframe: adjust an incorrect check in flip_sframe
192         When sframe_encoder_write needs to flip the buffer containing the SFrame
193         section before writing, it is not necessary that the SFrame FDES are in
194         the order of their sfde_func_start_fre_off.  On the contrary, SFrame
195         FDEs will be sorted in the order of their start address.  So, remove
196         this incorrect assumption which is basically assuming that the last
197         sfde_func_start_fre_off seen will help determine the end of the flipped
198         buffer.
199
200         The function now keeps track of the bytes_flipped and then compares it with
201         the expected value.  Also, added two more checks at appropriate places:
202          - check that the SFrame FDE read is within bounds
203          - check that the SFrame FRE read is within bounds
204
205         libsframe/
206
207                 * sframe.c (flip_sframe): Adjust an incorrect check.
208                 Add other checks to ensure reads are within the buffer size.
209
210         (cherry picked from commit cd9aea32cffd8089f6f63f4eb86d4dccfc0b3850)
211
212 2023-01-09  Christophe Lyon  <christophe.lyon@arm.com>
213
214         Skip ld/pr23169 test on arm.
215         The test is already skipped on several targets (including AArch64)
216         because it's invalid.
217
218                 * testsuite/ld-ifunc/ifunc.exp: Skip pr23169 on arm.
219
220 2023-01-09  Christophe Lyon  <christophe.lyon@arm.com>
221
222         Fix PR18841 ifunc relocation ordering
223         In order to get the ifunc relocs properly sorted the correct class
224         needs to be returned.  The code mimics what has been done for AArch64.
225
226         Fixes:
227         FAIL: Run pr18841 with libpr18841b.so
228         FAIL: Run pr18841 with libpr18841c.so
229         FAIL: Run pr18841 with libpr18841bn.so (-z now)
230         FAIL: Run pr18841 with libpr18841cn.so (-z now)
231
232                 bfd/
233                 PR ld/18841
234                 * elf32-arm.c (elf32_arm_reloc_type_class): Return
235                 reloc_class_ifunc for ifunc symbols.
236
237                 ld/testsuite/
238                 * ld-arm/ifunc-12.rd: Update relocations order.
239                 * ld-arm/ifunc-3.rd: Likewise.
240                 * ld-arm/ifunc-4.rd: Likewise.
241
242 2023-01-09  Nick Clifton  <nickc@redhat.com>
243
244         Updated transaltions for the gprof and binutils sub-directories
245
246 2023-01-09  GDB Administrator  <gdbadmin@sourceware.org>
247
248         Automatic date update in version.in
249
250 2023-01-08  Alan Modra  <amodra@gmail.com>
251
252         PR29972, inconsistent format specification in singular form
253                 PR 29972
254                 * readelf.c (process_dynamic_section): Correct format string.
255
256         (cherry picked from commit 02da71ee20ec71f7b3be85cf2266e09c124983bf)
257
258 2023-01-08  GDB Administrator  <gdbadmin@sourceware.org>
259
260         Automatic date update in version.in
261
262 2023-01-07  GDB Administrator  <gdbadmin@sourceware.org>
263
264         Automatic date update in version.in
265
266 2023-01-06  Jan Beulich  <jbeulich@suse.com>
267
268         ld: yet another PDB build fix (or workaround)
269         Older bash looks to improperly deal with backslashes in here-documents,
270         leaving them in place on the escaped double quotes inside the parameter
271         expansion. Convert to a model without using such a construct, by simply
272         splitting the here-documents into three ones.
273
274 2023-01-06  Nick Clifton  <nickc@redhat.com>
275
276         Updated Bulgarian and Russian translations for LD and BFD respectively
277
278 2023-01-06  GDB Administrator  <gdbadmin@sourceware.org>
279
280         Automatic date update in version.in
281
282 2023-01-05  Nick Clifton  <nickc@redhat.com>
283
284         Avoid unaligned pointer reads in PEP idata section
285
286         Updated Bulgarian and Russian translations for the gprof subdirectory
287
288 2023-01-05  GDB Administrator  <gdbadmin@sourceware.org>
289
290         Automatic date update in version.in
291
292 2023-01-04  Alan Modra  <amodra@gmail.com>
293
294         Merge config/picflag.m4 from gcc
295
296         Update some more copyright year ranges
297         These files disappear in commit 3002e78a7d3d but are still on the branch.
298
299         Update year range in gprofng copyright notices
300         This adds 'Innovative Computing Labs' as an external author to
301         update-copyright.py, to cover the copyright notice in
302         gprofng/common/opteron_pcbe.c, and uses that plus another external
303         author 'Oracle and' to update gprofng copyright dates.  I'm not going
304         to commit 'Oracle and' as an accepted author, but that covers the
305         string "Copyright (c) 2006, 2012, Oracle and/or its affiliates. All
306         rights reserved." found in gprofng/testsuite/gprofng.display/jsynprog
307         files.
308
309         Update year range in copyright notice of binutils files
310         The newer update-copyright.py fixes file encoding too, removing cr/lf
311         on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
312         embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
313
314 2023-01-04  Alan Modra  <amodra@gmail.com>
315
316         Update etc/update-copyright.py
317         This picks up some improvements from gcc/contrib.  exceptions must
318         derive from BaseException, port to python3, retain original file mode,
319         fix name of script in examples.
320
321         Adds libsframe to list of default dirs.  I would have added gprofng
322         too but there are some files claiming copyright by authors other than
323         the Free Software Foundation.
324
325 2023-01-04  Andreas K. Huettel  <dilfridge@gentoo.org>
326
327         Fix AArch64 linker testsuite failures triggered by differences in build environments.
328                 PR 29843
329                 * testsuite/ld-aarch64/bti-plt-5.d: Relax regxps slightly to allow
330                 for differences in build environments.
331                 * testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: Likewise.
332
333 2023-01-04  Mark Harmstone  <mark@harmstone.com>
334
335         Avoid unaligned pointer reads in PEP .idata section
336         This is something I discovered when working on aarch64, though it's
337         relevant to x86_64 too.
338
339         The PE32+ imports are located in the .idata section, which starts off
340         with a 20-byte structure for each DLL, containing offsets into the rest
341         of the section. This is the Import Directory Table in
342         https://learn.microsoft.com/en-us/windows/win32/debug/pe-format, which
343         is a concatenation of the .idata$2 sections. This is then followed by an
344         20 zero bytes generated by the linker script, which calls this .idata$3.
345
346         After this comes the .idata$4 entries for each function, which the
347         loader overwrites with the function pointers. Because there's no padding
348         between .idata$3 and .idata$4, this means that if there's an even number
349         of DLLs, the function pointers won't be aligned on an 8-byte boundary.
350
351         Misaligned reads are slower on x86_64, but this is more important on
352         aarch64, as the e.g. `ldr x0, [x0, :lo12:__imp__func]` the compiler
353         might generate requires __imp__func (the .idata$4 entry) to be aligned
354         to 8 bytes. Without this you get IMAGE_REL_ARM64_PAGEOFFSET_12L overflow
355         errors.
356
357 2023-01-04  GDB Administrator  <gdbadmin@sourceware.org>
358
359         Automatic date update in version.in
360
361 2023-01-03  Nick Clifton  <nickc@redhat.com>
362
363         Updated translations for various languages and sub-directories
364
365 2023-01-03  GDB Administrator  <gdbadmin@sourceware.org>
366
367         Automatic date update in version.in
368
369 2023-01-02  GDB Administrator  <gdbadmin@sourceware.org>
370
371         Automatic date update in version.in
372
373 2022-12-31  Nick Clifton  <nickc@redhat.com>
374
375         Update version number and regenerate files
376
377         Add markers for 2.40 branch
378
379         sync libiberty sources with gcc mainline
380
381 2022-12-31  Tom de Vries  <tdevries@suse.de>
382
383         [gdb/cli] Add maintenance ignore-probes
384         There's a command "disable probes", but SystemTap probes, for instance
385         libc:longjmp cannot be disabled:
386         ...
387         $ gdb -q -batch a.out -ex start -ex "disable probes libc ^longjmp$"
388           ...
389         Probe libc:longjmp cannot be disabled.
390         Probe libc:longjmp cannot be disabled.
391         Probe libc:longjmp cannot be disabled.
392         ...
393
394         Add a command "maintenance ignore-probes" that ignores probes during
395         get_probes, such that we can easily pretend to use a libc without the
396         libc:longjmp probe:
397         ...
398         (gdb) maint ignore-probes -verbose libc ^longjmp$
399         ignore-probes filter has been set to:
400         PROVIDER: 'libc'
401         PROBE_NAME: '^longjmp$'
402         OBJNAME: ''
403         (gdb) start ^M
404           ...
405         Ignoring SystemTap probe libc longjmp in /lib64/libc.so.6.^M
406         Ignoring SystemTap probe libc longjmp in /lib64/libc.so.6.^M
407         Ignoring SystemTap probe libc longjmp in /lib64/libc.so.6.^M
408         ...
409
410         The "Ignoring ..." messages can be suppressed by not using -verbose.
411
412         Note that as with "disable probes", running simply "maint ignore-probes"
413         ignores all probes.
414
415         The ignore-probes filter can be reset by using:
416         ...
417         (gdb) maint ignore-probes -reset
418         ignore-probes filter has been reset
419         ...
420
421         For now, the command is only supported for SystemTap probes.
422
423         PR cli/27159
424         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27159
425
426 2022-12-31  Mark Harmstone  <mark@harmstone.com>
427
428         ld/testsuite: Don't add index to sizes in pdb.exp
429
430         ld: Handle LF_VFTABLE types in PDBs
431
432 2022-12-31  Mark Harmstone  <mark@harmstone.com>
433
434         ld: Handle extended-length data structures in PDB types
435         A few fixes to minor issues I've discovered in my PDB patches.
436
437         * If sizes or offsets are greater than 0x8000, they get encoded as
438         extended values in the same way as for enum values - e.g. a LF_ULONG
439         .short followed by a .long.
440
441         * I've managed to coax MSVC to produce another type, LF_VFTABLE, which
442         is seen when dealing with COM. I don't think LLVM emits this. Note that
443         we can't just implement everything in Microsoft's header files, as most
444         of it is obsolete.
445
446         * Fixes a stupid bug in the test program, where I was adding an index to
447         a size. The index was hard-coded to 0, so this didn't cause any actual
448         issues.
449
450 2022-12-31  Nick Clifton  <nickc@redhat.com>
451
452         Updated Romanian translation for the binutils sub-directory
453
454 2022-12-31  Tom de Vries  <tdevries@suse.de>
455
456         [gdb/python] Fix gdb.python/py-finish-breakpoint2.exp for -m32
457         [ Partial resubmission of an earlier submission by Andrew (
458         https://sourceware.org/pipermail/gdb-patches/2012-September/096347.html ), so
459         listing him as co-author. ]
460
461         With x86_64-linux and target board unix/-m32, we have:
462         ...
463         (gdb) continue^M
464         Continuing.^M
465         Exception #10^M
466         ^M
467         Breakpoint 3, throw_exception_1 (e=10) at py-finish-breakpoint2.cc:23^M
468         23        throw new int (e);^M
469         (gdb) FAIL: gdb.python/py-finish-breakpoint2.exp: \
470           check FinishBreakpoint in catch()
471         ...
472
473         The following scenario happens:
474         - set breakpoint in throw_exception_1, a function that throws an exception
475         - continue
476         - hit breakpoint, with call stack main.c:38 -> throw_exception_1
477         - set a finish breakpoint
478         - continue
479         - hit the breakpoint again, with call stack main.c:48 -> throw_exception
480           -> throw_exception_1
481
482         Due to the exception, the function call did not properly terminate, and the
483         finish breakpoint didn't trigger.  This is expected behaviour.
484
485         However, the intention is that gdb detects this situation at the next stop
486         and calls the out_of_scope callback, which would result here in this test-case
487         in a rather confusing "exception did not finish" message.  So the problem is
488         that this message doesn't show up, in other words, the out_of_scope callback
489         is not called.
490
491         [ Note that the fact that the situation is detected only at the next stop
492         (wherever that happens to be) could be improved upon, and the earlier
493         submission did that by setting a longjmp breakpoint.  But I'm considering this
494         problem out-of-scope for this patch. ]
495
496         Note that the message does show up later, at thread exit:
497         ...
498         [Inferior 1 (process 20046) exited with code 0236]^M
499         exception did not finish ...^M
500         ...
501
502         The decision on whether to call the out_of_scope call back is taken in
503         bpfinishpy_detect_out_scope_cb, and the interesting bit is here:
504         ...
505                      if (b->pspace == current_inferior ()->pspace
506                          && (!target_has_registers ()
507                              || frame_find_by_id (b->frame_id) == NULL))
508                        bpfinishpy_out_of_scope (finish_bp);
509         ...
510
511         In the case of the thread exit, the callback triggers because
512         target_has_registers () == 0.
513
514         So why doesn't the callback trigger in the case of the breakpoint?
515
516         Well, the b->frame_id is the frame_id of the frame of main (the frame
517         in which the finish breakpoint is supposed to trigger), so AFAIU
518         frame_find_by_id (b->frame_id) == NULL will only be true once we've
519         left main, at which point I guess we don't stop till thread exit.
520
521         Fix this by saving the frame in which the finish breakpoint was created, and
522         using frame_find_by_id () == NULL on that frame instead, such that we have:
523         ...
524         (gdb) continue^M
525         Continuing.^M
526         Exception #10^M
527         ^M
528         Breakpoint 3, throw_exception_1 (e=10) at py-finish-breakpoint2.cc:23^M
529         23        throw new int (e);^M
530         exception did not finish ...^M
531         (gdb) FAIL: gdb.python/py-finish-breakpoint2.exp: \
532           check FinishBreakpoint in catch()
533         ...
534
535         Still, the test-case is failing because it's setup to match the behaviour that
536         we get on x86_64-linux with target board unix/-m64:
537         ...
538         (gdb) continue^M
539         Continuing.^M
540         Exception #10^M
541         stopped at ExceptionFinishBreakpoint^M
542         (gdb) PASS: gdb.python/py-finish-breakpoint2.exp: \
543           check FinishBreakpoint in catch()
544         ...
545
546         So what happens here?  Again, due to the exception, the function call did not
547         properly terminate, but the finish breakpoint still triggers.  This is somewhat
548         unexpected.  This happens because it just so happens to be that the frame
549         return address at which the breakpoint is set, is also the first instruction
550         after the exception has been handled.  This is a know problem, filed as
551         PR29909, so KFAIL it, and modify the test-case to expect the out_of_scope
552         callback.
553
554         Also add a breakpoint after setting the finish breakpoint but before throwing
555         the exception, to check that we don't call the out_of_scope callback too early.
556
557         Tested on x86_64-linux, with target boards unix/-m32.
558
559         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
560         PR python/27247
561         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27247
562
563 2022-12-31  Tom de Vries  <tdevries@suse.de>
564
565         [gdb/testsuite] Fix gdb.base/print-symbol-loading.exp on ubuntu 22.04.1
566         On ubuntu 22.04.1 x86_64, I run into:
567         ...
568         (gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: \
569           set print symbol-loading off
570         sharedlibrary .*^M
571         Symbols already loaded for /lib/x86_64-linux-gnu/libc.so.6^M
572         Symbols already loaded for /lib/x86_64-linux-gnu/libpthread.so.0^M
573         (gdb) FAIL: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib
574         ...
575
576         The test-case expects the libc.so line, but not the libpthread.so line.
577
578         However, we have:
579         ...
580         $ ldd /lib/x86_64-linux-gnu/libc.so.6
581                 linux-vdso.so.1 (0x00007ffd7f7e7000)
582                 libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f4468c00000)
583                 /lib64/ld-linux-x86-64.so.2 (0x00007f4469193000)
584                 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4468f3e000)
585                 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4468f39000)
586         ...
587         so it's not unexpected that libpthread.so is loaded if libc.so is loaded.
588
589         Fix this by accepting the libpthread.so line.
590
591         Tested on x86_64-linux.
592
593         PR testsuite/29919
594         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29919
595
596 2022-12-31  Tom de Vries  <tdevries@suse.de>
597
598         [gdb/testsuite] Replace deprecated pthread_yield in gdb.threads/watchpoint-fork.exp
599         On Ubuntu 22.04.1 x86_64, with glibc 2.35 I run into:
600         ...
601         watchpoint-fork-mt.c: In function 'start':^M
602         watchpoint-fork-mt.c:67:7: warning: 'pthread_yield' is deprecated: \
603           pthread_yield is deprecated, use sched_yield instead \
604           [-Wdeprecated-declarations]^M
605            67 |       i = pthread_yield ();^M
606               |       ^^M
607         ...
608
609         Fix this as suggested, by using sched_yield instead.
610
611         Tested on x86_64-linux.
612
613 2022-12-31  Tom de Vries  <tdevries@suse.de>
614
615         [gdb/testsuite] Fix gdb.base/corefile.exp with glibc 2.35
616         On Ubuntu 22.04.1 x86_64 (with glibc 2.35), I run into:
617         ...
618         (gdb) PASS: gdb.base/corefile.exp: $_exitcode is void
619         bt^M
620          #0  __pthread_kill_implementation (...) at ./nptl/pthread_kill.c:44^M
621          #1  __pthread_kill_internal (...) at ./nptl/pthread_kill.c:78^M
622          #2  __GI___pthread_kill (...) at ./nptl/pthread_kill.c:89^M
623          #3  0x00007f4985e1a476 in __GI_raise (...) at ../sysdeps/posix/raise.c:26^M
624          #4  0x00007f4985e007f3 in __GI_abort () at ./stdlib/abort.c:79^M
625          #5  0x0000556b4ea4b504 in func2 () at gdb.base/coremaker.c:153^M
626          #6  0x0000556b4ea4b516 in func1 () at gdb.base/coremaker.c:159^M
627          #7  0x0000556b4ea4b578 in main (...) at gdb.base/coremaker.c:171^M
628         (gdb) PASS: gdb.base/corefile.exp: backtrace
629         up^M
630          #1  __pthread_kill_internal (...) at ./nptl/pthread_kill.c:78^M
631          78      in ./nptl/pthread_kill.c^M
632         (gdb) FAIL: gdb.base/corefile.exp: up
633         ...
634
635         The problem is that the regexp used here:
636         ...
637         gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up"
638         ...
639         does not fit the __pthread_kill_internal line which lacks the instruction
640         address due to inlining.
641
642         Fix this by making the regexp less strict.
643
644         Tested on x86_64-linux.
645
646 2022-12-31  GDB Administrator  <gdbadmin@sourceware.org>
647
648         Automatic date update in version.in
649
650 2022-12-30  Tom de Vries  <tdevries@suse.de>
651
652         [gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc
653         On ubuntu 22.04.1 x86_64, I run into:
654         ...
655         (gdb) info probes all rtld rtld_map_complete^M
656         No probes matched.^M
657         (gdb) XFAIL: gdb.threads/dlopen-libpthread.exp: info probes all rtld rtld_map_complete
658         UNTESTED: gdb.threads/dlopen-libpthread.exp: no matching probes
659         ...
660         This has been filed as PR testsuite/17016.
661
662         The problem is that the name rtld_map_complete is used, which was only
663         available in Fedora 17, and upstream the name map_complete was used.
664
665         In the email thread discussing a proposed patch (
666         https://sourceware.org/legacy-ml/gdb-patches/2014-09/msg00712.html ) it was
667         suggested to make the test-case handle both names.
668
669         So, handle both names: map_complete and rtld_map_complete.
670
671         This exposes the following FAIL:
672         ...
673         (gdb) info sharedlibrary^M
674         From To    Syms Read Shared Object Library^M
675         $hex $hex  Yes       /lib64/ld-linux-x86-64.so.2^M
676         $hex $hex  Yes (*)   /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0^M
677         $hex $hex  Yes       /lib/x86_64-linux-gnu/libc.so.6^M
678         $hex $hex  Yes       /lib/x86_64-linux-gnu/libdl.so.2^M
679         $hex $hex  Yes       /lib/x86_64-linux-gnu/libpthread.so.0^M
680         (*): Shared library is missing debugging information.^M
681         (gdb) FAIL: gdb.threads/dlopen-libpthread.exp: libpthread.so not found
682         ...
683         due to using a glibc (v2.35) that has libpthread integrated into libc.
684
685         Fix this by changing the FAIL into UNSUPPORTED.
686
687         Tested on x86_64-linux.
688
689         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17016
690
691 2022-12-30  Tom de Vries  <tdevries@suse.de>
692
693         [gdb/testsuite] Fix gdb.reverse/step-indirect-call-thunk.exp with -fcf-protection
694         On Ubuntu 22.04.1 x86_64, I run into:
695         ...
696         gdb.reverse/step-indirect-call-thunk.c: In function 'inc':^M
697         gdb.reverse/step-indirect-call-thunk.c:22:1: error: '-mindirect-branch' and \
698           '-fcf-protection' are not compatible^M
699            22 | {                /* inc.1 */^M
700               | ^^M
701         ...
702
703         Fix this by forcing -fcf-protection=none, if supported.
704
705         Tested on x86_64-linux.
706
707 2022-12-30  Tom de Vries  <tdevries@suse.de>
708
709         [gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with -fcf-protection
710         On Ubuntu 22.04.1 x86_64, I run into:
711         ...
712         (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: not in inline 1
713         next^M
714         51        if (t != NULL^M
715         (gdb) FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 1
716         ...
717
718         This is due to -fcf-protection, which adds the endbr64 at the start of get_alias_set:
719         ...
720         0000000000001180 <_Z13get_alias_setP4tree>:
721             1180:       f3 0f 1e fa             endbr64
722             1184:       48 85 ff                test   %rdi,%rdi
723         ...
724         so the extra insn gets an is-stmt line number entry:
725         ...
726         INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
727           ...
728         11     50     0x0000000000001180 Y
729         12     50     0x0000000000001180
730         13     51     0x0000000000001184 Y
731         14     54     0x0000000000001184
732         ...
733         and when stepping into get_alias_set we step to line 50:
734         ...
735         (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: in main
736         step^M
737         get_alias_set (t=t@entry=0x555555558018 <xx>) at step-and-next-inline.cc:50^M
738         50      {^M
739         ...
740
741         In contrast, with -fcf-protection=none, we get:
742         ...
743         0000000000001170 <_Z13get_alias_setP4tree>:
744             1170:       48 85 ff                test   %rdi,%rdi
745         ...
746         and:
747         ...
748         INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
749           ...
750         11     50     0x0000000000001170 Y
751         12     51     0x0000000000001170 Y
752         13     54     0x0000000000001170
753         ...
754         so when stepping into get_alias_set we step to line 51:
755         ...
756         (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: in main
757         step^M
758         get_alias_set (t=t@entry=0x555555558018 <xx>) at step-and-next-inline.cc:51^M
759         51        if (t != NULL^M
760         ...
761
762         Fix this by rewriting the gdb_test issuing the step command to check which
763         line the step lands on, and issuing an extra next if needed.
764
765         Tested on x86_64-linux, both with and without -fcf-protection=none.
766
767         PR testsuite/29920
768         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29920
769
770 2022-12-30  Tom de Vries  <tdevries@suse.de>
771
772         [gdb/symtab] Make comp_unit_head.length private
773         Make comp_unit_head.length private, to enforce using accessor functions.
774
775         Replace accessor function get_length with get_length_with_initial and
776         get_length_without_initial, to make it explicit which variant we're using.
777
778         Tested on x86_64-linux.
779
780         PR symtab/29343
781         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29343
782
783 2022-12-30  Alan Modra  <amodra@gmail.com>
784
785         PR29948, heap-buffer-overflow in display_debug_lines_decoded
786         This fixes a couple of places in display_debug_lines_decoded that were
787         off by one in checking DWARF5 .debug_line directory indices.  It also
788         displays the DWARF5 entry 0 for the program current directory rather
789         than "." as is done for pre-DWARF5.  I decided against displaying
790         DW_AT_comp_dir for pre-DWARF5 since I figure it is better for readelf
791         to minimally interpret debug info.
792
793         binutils/
794                 PR 29948
795                 * dwarf.c (display_debug_lines_decoded): Display the given
796                 directory entry 0 for DWARF5.  Properly check directory index
797                 against number of entries in the table.  Revert to using
798                 unsigned int for n_directories and associated variables.
799                 Correct warning messages.
800         gas/
801                 * testsuite/gas/elf/dwarf-5-loc0.d: Update.
802
803 2022-12-30  GDB Administrator  <gdbadmin@sourceware.org>
804
805         Automatic date update in version.in
806
807 2022-12-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
808
809         RISC-V: Simplify riscv_csr_address logic on state enable extensions
810         This commit makes CSR class handling for 'Smstateen' and 'Ssstateen'
811         extensions simpler using fall-throughs (as used in CSR_CLASS_I{,_32}).
812
813         gas/ChangeLog:
814
815                 * config/tc-riscv.c (riscv_csr_address): Simplify the logic for
816                 'Smstateen' and 'Ssstateen' extensions.
817
818 2022-12-29  GDB Administrator  <gdbadmin@sourceware.org>
819
820         Automatic date update in version.in
821
822 2022-12-28  Tom Tromey  <tom@tromey.com>
823
824         Use $decimal in timestamp.exp
825         This patch fixes a review comment by Tom de Vries.  He pointed out
826         that the new timestamp.exp should use the $decimal convenience regexp.
827
828 2022-12-28  Tom Tromey  <tom@tromey.com>
829
830         Fix "set debug timestamp"
831         PR cli/29945 points out that "set debug timestamp 1" stopped working
832         -- this is a regression due to commit b8043d27 ("Remove a ui-related
833         memory leak").
834
835         This patch fixes the bug and adds a regression test.
836
837         I think this should probably be backported to the gdb 13 branch.
838
839         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29945
840
841 2022-12-28  GDB Administrator  <gdbadmin@sourceware.org>
842
843         Automatic date update in version.in
844
845 2022-12-27  H.J. Lu  <hjl.tools@gmail.com>
846
847         x86-64: Allocate input section memory if needed
848         When --no-keep-memory is used, the input section memory may not be cached.
849         Allocate input section memory for -z pack-relative-relocs if needed.
850
851         bfd/
852
853                 PR ld/29939
854                 * elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Allocate
855                 input section memory if needed.
856
857         ld/
858
859                 PR ld/29939
860                 * testsuite/ld-elf/dt-relr-2i.d: New test.
861
862 2022-12-27  Christoph Müllner  <christoph.muellner@vrull.eu>
863
864         RISC-V: Fix T-Head Fmv vendor extension encoding
865         A recent change in the XTheadFmv spec fixed an encoding bug in the
866         document. This patch changes the code to follow this bugfix.
867
868         Spec patch can be found here:
869           https://github.com/T-head-Semi/thead-extension-spec/pull/11
870
871 2022-12-27  Tom Tromey  <tromey@adacore.com>
872
873         Handle SIGSEGV in gdb selftests
874         The gdb.gdb self-tests were timing out for me, which turned out to be
875         PR testsuite/29325.  Looking into it, the problem is that the version
876         of the Boehm GC that is used by Guile on my machine causes a SEGV
877         during stack probing.  This unexpected stop confuses the tests and
878         causes repeated timeouts.
879
880         This patch adapts the two failing tests.  This makes them work for me,
881         and reduces the running time of gdb.gdb from 20 minutes to about 11
882         seconds.
883
884         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29325
885
886 2022-12-27  Mike Frysinger  <vapier@gentoo.org>
887
888         sim: build: clean up unused codegen logic
889         Now that all igen ports are in the top-level makefile, we don't need
890         this logic in any subdirs anymore, so clean it up.
891
892         sim: mips: hoist "multi" igen rules up to common builds
893         Since these are the last mips igen rules, we can clean up a number of
894         bits in the local Makefile.in.
895
896         sim: mips: hoist "m16" igen rules up to common builds
897
898         sim: mips: hoist "single" igen rules up to common builds
899
900         sim: mips: rename "igen" generation mode to "single"
901         The naming in here has grown organically and is confusing to follow.
902         Originally there was only one set of rules for generating code from
903         the igen sources, so calling it "tmp-igen" and such made sense.  But
904         when other multigen modes were added ("m16" & "multi") which also
905         used igen, it's not clear what's common igen and what's specific to
906         this generation  mode.  So rename the set of rules from "igen" to
907         "single" so it's easier to follow.
908
909         sim: mips: hoist itable igen rules up to common builds
910         Since this rule is pretty simple, hoist it up to the common build.
911
912 2022-12-27  Mike Frysinger  <vapier@gentoo.org>
913
914         sim: mips: unify itable generation (a bit)
915         The m16 & multi targets generate itable once even when all the other
916         modules are generated multiple times.  The default igen target will
917         generate itable with everything else out of convenience.  This means
918         flags are passed which don't affect the generated itable there.
919
920         We can unify the itable generation by making sure the right -F/-M
921         filter variables are passed down.  Since there's already a dedicated
922         rule & variable in the multi build mode, generalize that and switch
923         the m16 & igen builds over too.
924
925         I spent a lot of time staring at this code, building for diff mips
926         targets, and exploring all the shell code paths.  I think this is
927         safe, but only time (and users) will really tell.
928
929 2022-12-27  Mike Frysinger  <vapier@gentoo.org>
930
931         sim: mips: rename multi_flags to igen_itable_flags
932         This variable is only used to generate the itable files.  In preparation
933         for merging the itable logic among all ports, rename "multi_flags" to a
934         more appropriate "igen_itable_flags" variable.  There should be no real
935         chagnes here otherwise.
936
937         sim: mips: drop unused micromips igen logic
938         This code appears to be unused since it was first merged.  When
939         micromips was enabled, it was via the "MULTI" config, not the
940         "MICROMIPS" config, and the multi configs have sep vars.  Since
941         nothing sets SIM_MIPS_GEN=MICROMIPS in the config, all of this
942         should be unreachable, so punt it to simplify.  Further, the
943         SIM_MIPS_MICROMIPS16_FLAGS & SIM_MIPS_MICROMIPS_FLAGS settings
944         rely on sim_mips_micromips{,16}_{filter,machine} variables that
945         are never set in the configure script.
946
947 2022-12-27  GDB Administrator  <gdbadmin@sourceware.org>
948
949         Automatic date update in version.in
950
951 2022-12-26  Tom Tromey  <tom@tromey.com>
952
953         Add initializers to comp_unit_head
954         PR symtab/29343 points out that it would be beneficial if
955         comp_unit_head had a constructor and used initializers.  This patch
956         implements this.  I'm unsure if this is sufficient to close the bug,
957         but at least it's a step.
958
959         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29343
960
961 2022-12-26  Alan Modra  <amodra@gmail.com>
962
963         bfd/dwarf2.c: allow use of DWARF5 directory entry 0
964         I think the test for table->files[file].dir being non-zero is wrong
965         for DWARF5 where index zero is allowed and is the current directory of
966         the compilation.  Most times this will be covered by the use of
967         table->comp_dir (from DW_AT_comp_dir) in concat_filename but the point
968         of putting the current dir in .debug_line was so the section could
969         stand alone without .debug_info.
970
971         Also, there is no need to check for table->dirs non-NULL, the
972         table->num_dirs test is sufficient.
973
974                 * dwarf2.c (concat_filename): Correct and simplify tests of
975                 directory index.
976
977 2022-12-26  Flavio Cruz  <flaviocruz@gmail.com>
978
979         Add support for x86_64-*-gnu-* targets to build x86_64 gnumach/hurd
980
981 2022-12-26  GDB Administrator  <gdbadmin@sourceware.org>
982
983         Automatic date update in version.in
984
985 2022-12-25  Mike Frysinger  <vapier@gentoo.org>
986
987         sim: build: drop support for subdir distclean
988         All ports that need to clean things up at distclean time have moved
989         to the top-level build, so we can drop support for this hook.
990
991         sim: mips: move distclean settings to common build
992         This was missed when mips/configure was merged into the top-level.
993
994 2022-12-25  Indu Bhagat  <indu.bhagat@oracle.com>
995
996         libsframe: write out SFrame FRE start address correctly
997         The following test was failing on ppc64 and s390x:
998           "FAIL: encode-1: Encode buffer match"
999
1000         The offending stub was how we memcpy the FRE start address to the buffer
1001         (on-disk format).  When the host is big-endian, the address of the
1002         source buffer for the memcpy needs to point to the uint8_t/uint16_t sized
1003         value of the FRE start addr, not uint32_t sized value; we intend to copy
1004         out only the fre_start_addr_sz number of bytes.
1005
1006         ChangeLog:
1007
1008                 * libsframe/sframe.c (sframe_encoder_write_fre_start_addr): New
1009                 function.
1010                 (sframe_encoder_write_fre): Use it instead of memcpy.
1011
1012 2022-12-25  Mike Frysinger  <vapier@gentoo.org>
1013
1014         sim: smp: plumb igen flag down to all users
1015         While mips has respected sim_igen_smp at configure time (which was
1016         always empty since it defaulted smp to off), no other igen port did.
1017         Move this to a makefile variable and plumb it through the common
1018         IGEN_RUN variable instead so everyone gets it by default.  We also
1019         clean up some redundant -N0 setting with multirun mips.
1020
1021         sim: smp: make option available again
1022         At some point we want this to work, but it's not easy to test if
1023         the configure option isn't available.  Restore it, but keep the
1024         default off.
1025
1026         sim: cpu: change default init to handle all cpus
1027         All the runtimes were only initializing a single CPU.  When SMP is
1028         enabled, things quickly crash as none of the other CPU structs are
1029         setup.  Change the default from 0 to the compile time value.
1030
1031         sim: msp430: add basic SMP cpu init
1032         There's no need to assert there's only 1 CPU when setting them all
1033         up here is trivial.
1034
1035         sim: m32r: fix iterator typo when setting up cpus
1036         This code loops over available cpus with "c", but then looks up the
1037         cpu with "i".  Fix the typo so the code works correctly with smp.
1038
1039         sim: v850: fix SMP compile
1040         The igen tool sets up the SD & CPU defines for code fragments to use,
1041         but v850 was expecting "sd".  Change all the igen related code to use
1042         SD so it actually compiles, and fix a few places to use "CPU" instead
1043         of hardcoding cpu0.
1044
1045         sim: or1k: fix iterator typo when setting up cpus
1046         This code loops over available cpus with "c", but then looks up the
1047         cpu with "i".  Fix the typo so the code works correctly with smp.
1048
1049         sim: mn10300: fix SMP compile
1050         The igen tool sets up the SD define for code fragments to use, but
1051         mn10300 was expecting "sd".  Change all the igen related code to use
1052         SD so it actually compiles.
1053
1054         sim: cpu: fix SMP msg prefix helper
1055         This code fails to compile when SMP is enabled due to some obvious
1056         errors.  Fix those and change the logic to avoid CPP to prevent any
1057         future rot from creeping back in.
1058
1059         sim: mips: clean up a bit after mips/configure removal
1060         Now that there is no subdir configure script, we can clean up some
1061         logic that was spread between the files.
1062
1063         sim: mips: move igen settings to top-level configure
1064         This is the last bit of logic that exists in the mips configure
1065         script, so move it to the top-level configure to kill it off.
1066         We still have to move the Makefile.in igen logic to local.mk,
1067         but this is a required first step for that.
1068
1069         sim: mips: namespace igen configure vars
1070         To prepare moving this logic to the top-level configure, the vars
1071         need to be namespaced.  Do that here to make it easier to review.
1072         Basically sim_xxx -> SIM_MIPS_XXX when a var is exported from the
1073         configure script to the Makefile, and sim_xxx -> sim_mips_xxx when
1074         the var is internal in the configure script.
1075
1076         sim: mips: add igen recursive dep
1077         Make sure the igen tool exists before trying to compile the mips
1078         subdir.  This happens to work when mips has a subconfigure, but
1079         hits a race condition when that is removed.
1080
1081         sim: mips: drop unused ENGINE_ISSUE_POSTFIX_HOOK
1082         Nothing defines this, and it isn't called in all the engine runtimes,
1083         so drop it entirely to avoid confusion.
1084
1085         sim: igen: drop move-if-changed usage
1086         Now that igen itself has this logic, drop these custom build rules
1087         to greatly simplify.
1088
1089         sim: igen: support in-place updates ourself
1090         Every file that igen outputs is then processed with the move-if-changed
1091         shell script.  This creates a lot of boilerplate in the build and not an
1092         insignificant amount of build-time overhead.  Move the simple "is the file
1093         changed" logic into igen itself.
1094
1095         sim: igen: constify itable data structures
1096         These are const data arrays of strings and numbers.  We don't want
1097         or need them to be writable, so mark them all const.
1098
1099 2022-12-25  GDB Administrator  <gdbadmin@sourceware.org>
1100
1101         Automatic date update in version.in
1102
1103 2022-12-24  Andrew Burgess  <aburgess@redhat.com>
1104
1105         gdb/testsuite: fix buffer overflow in gdb.base/signed-builtin-types.exp
1106         In commit:
1107
1108           commit 9f50fe0835850645bd8ea9bb1efe1fe6c48dfb12
1109           Date:   Wed Dec 7 15:55:25 2022 +0000
1110
1111               gdb/testsuite: new test for recent dwarf reader issue
1112
1113         A new test (gdb.base/signed-builtin-types.exp) was added that made use
1114         of 'info sources' to figure out if the debug information for a
1115         particular object file had been fully expanded or not.  Unfortunately
1116         some lines of the 'info sources' output can be very long, this was
1117         observed on some systems where the debug information for the
1118         dynamic-linker was installed, in this case, the list of source files
1119         associated with the dynamic linker was so long it would cause expect's
1120         internal buffer to overflow.
1121
1122         This commit switches from using 'info sources' to 'maint print
1123         objfile', the output from the latter command is more compact, but
1124         also, can be restricted to a single named object file.
1125
1126         With this change in place I am no longer seeing buffer overflow errors
1127         from expect when running gdb.base/signed-builtin-types.exp.
1128
1129 2022-12-24  Mike Frysinger  <vapier@gentoo.org>
1130
1131         sim: or1k: move arch-specific settings to internal header
1132         There's no need for these settings to be in sim-main.h which is shared
1133         with common/ sim code, so move it all out to the existing or1k-sim.h.
1134         Unfortunately, we can't yet drop the or1k-sim.h include from sim-main.h
1135         as many of the generated CGEN files refer only to sim-main.h.  We'll
1136         have to improve the CGEN interface before we can make more progress,
1137         but this is at least a minor improvement.
1138
1139 2022-12-24  GDB Administrator  <gdbadmin@sourceware.org>
1140
1141         Automatic date update in version.in
1142
1143 2022-12-23  Tom Tromey  <tom@tromey.com>
1144
1145         Use bool for dwarf2_has_info
1146         This changes dwarf2_has_info to return bool.
1147
1148 2022-12-23  Indu Bhagat  <indu.bhagat@oracle.com>
1149
1150         libsframe: testsuite: fix memory leaks in testcases
1151         ChangeLog:
1152
1153                 * libsframe/testsuite/libsframe.decode/be-flipping.c: Free
1154                 SFrame buffer.
1155                 * libsframe/testsuite/libsframe.decode/frecnt-1.c: Likewise.
1156                 * libsframe/testsuite/libsframe.decode/frecnt-2.c: Likewise.
1157
1158 2022-12-23  Indu Bhagat  <indu.bhagat@oracle.com>
1159
1160         libsframe: fix a memory leak in sframe_decode
1161         sframe_decode () needs to malloc a temporary buffer of the same size as
1162         the input buffer (containing the SFrame section bytes) when endian
1163         flipping is needed.  The decoder keeps the endian flipped contents in
1164         this buffer for its usage.  This code is necessary when the target
1165         endianneess is not the same as host endianness.
1166
1167         The malloc'd buffer needs to be kept track of, so that it can freed up in
1168         sframe_decoder_free () later.
1169
1170         ChangeLog:
1171
1172                 * libsframe/sframe-impl.h (struct sframe_decoder_ctx): Add new
1173                 member to keep track of the internally malloc'd buffer.
1174                 * libsframe/sframe.c (sframe_decoder_free): Free it up.
1175                 (sframe_decode): Update the reference to the buffer.
1176
1177 2022-12-23  Simon Marchi  <simon.marchi@polymtl.ca>
1178
1179         gdb/testsuite: remove MPFR detection in gdb.base/float128.exp
1180         I see this fail since commit 991180627851 ("Use toplevel configure for
1181         GMP and MPFR for gdb"):
1182
1183             FAIL: gdb.base/float128.exp: show configuration
1184
1185         The test fails to find --with-mpfr or --without-mpfr in the "show
1186         configuration" output.  Since MPFR has become mandatory, we can just
1187         remove that check and simplify the test to assume MPFR support is there.
1188
1189         Change-Id: I4f3458470db0029705b390dfefed3a66dfc0633a
1190         Approved-By: Tom de Vries <tdevries@suse.de>
1191
1192 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1193
1194         sim: m32r: move arch-specific settings to internal header
1195         There's no need for these settings to be in sim-main.h which is shared
1196         with common/ sim code, so move it all out to the existing m32r-sim.h.
1197         Unfortunately, we can't yet drop the m32r-sim.h include from sim-main.h
1198         as many of the generated CGEN files refer only to sim-main.h.  We'll
1199         have to improve the CGEN interface before we can make more progress,
1200         but this is at least a minor improvement.
1201
1202         sim: bfin: move arch-specific settings to internal header
1203         There's no need for these settings to be in sim-main.h which is shared
1204         with common/ sim code, so drop the bfin.h include and move the remaining
1205         bfin-specific settings into it.
1206
1207         sim: m68hc11: move arch-specific settings to internal header
1208         There's no need for these settings to be in sim-main.h which is shared
1209         with common/ sim code, so move it all out to a new header which only
1210         this port will include.
1211
1212         sim: sh: move arch-specific settings to internal header
1213         There's no need for these settings to be in sim-main.h which is shared
1214         with common/ sim code, so move it all out to a new header which only
1215         this port will include.
1216
1217         sim: mcore: move arch-specific settings to internal header
1218         There's no need for these settings to be in sim-main.h which is shared
1219         with common/ sim code, so move it all out to a new header which only
1220         this port will include.
1221
1222         sim: h8300: move arch-specific settings to internal header
1223         There's no need for these settings to be in sim-main.h which is shared
1224         with common/ sim code, so move it all out to a new header which only
1225         this port will include.
1226
1227         sim: pru: move arch-specific settings to internal header
1228         There's no need for these settings to be in sim-main.h which is shared
1229         with common/ sim code, so drop the pru.h include and move the remaining
1230         pru-specific settings into it.
1231
1232 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1233
1234         sim: mn10300: standardize the arch-specific settings a little
1235         Rename mn10300_sim.h to mn10300-sim.h to match other ports, and move most
1236         of the arch-specific content out of sim-main.h to it.  This isn't a big
1237         win though as we still have to include the header in sim-main.h due to the
1238         igen interface: it hardcodes including sim-main.h in its files.  So until
1239         we can fix that, we have to keep bleeding these settings into the common
1240         codes.
1241
1242         Also take the opportunity to purge a lot of unused headers from these.
1243         The local modules should already include the right headers, so there's
1244         no need to force everyone to pull them in.  A lot of this is a hold over
1245         from the pre-igen days of this port.
1246
1247 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1248
1249         sim: microblaze: move arch-specific settings to internal header
1250         There's no need for these settings to be in sim-main.h which is shared
1251         with common/ sim code, so move it all out to a new header which only
1252         this port will include.
1253
1254         sim: example-synacor: move arch-specific settings to internal header
1255         There's no need for these settings to be in sim-main.h which is shared
1256         with common/ sim code, so move it all out to a new header which only
1257         this port will include.
1258
1259         sim: moxie: move arch-specific settings to internal header
1260         There's no need for these settings to be in sim-main.h which is shared
1261         with common/ sim code, so move it all out to a new header which only
1262         this port will include.
1263
1264 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1265
1266         sim: riscv: move arch-specific settings to internal header
1267         There's no need for these settings to be in sim-main.h which is shared
1268         with common/ sim code, so move it all out to a new header which only
1269         this port will include.
1270
1271         We can also move the machs.h include out since the model logic was all
1272         generalized from compile-time to runtime last year.
1273
1274 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1275
1276         sim: v850: standardize the arch-specific settings a little
1277         Rename v850_sim.h to v850-sim.h to match other ports, and move most
1278         of the arch-specific content out of sim-main.h to it.  This isn't a
1279         big win though as we still have to include the header in sim-main.h
1280         due to the igen interface: it hardcodes including sim-main.h in its
1281         files.  So until we can fix that, we have to keep bleeding these
1282         settings into the common codes.
1283
1284 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1285
1286         sim: msp430: move arch-specific settings to internal header
1287         There's no need for these settings to be in sim-main.h which is shared
1288         with common/ sim code, so drop the msp430-sim.h include and move it to
1289         the few files that actually need it.
1290
1291         While we're here, drop redundant includes from sim-main.h:
1292         * sim-config.h & sim-types.h included by sim-basics.h already
1293         * sim-engine.h included by sim-base.h already
1294         And move sim-options.h to the one file that needs it.
1295
1296 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1297
1298         sim: ft32: move arch-specific settings to internal header
1299         There's no need for these settings to be in sim-main.h which is shared
1300         with common/ sim code, so drop the ft32-sim.h include and move it to
1301         the few files that actually need it.
1302
1303 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1304
1305         sim: d10v: move arch-specific settings to internal header
1306         There's no need for these settings to be in sim-main.h which is shared
1307         with common/ sim code, so drop the d10v_sim.h include and move it to
1308         the few files that actually need it.
1309
1310         Also rename the file to standardize it a bit better with other ports.
1311
1312 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1313
1314         sim: cr16: move arch-specific settings to internal header
1315         There's no need for these settings to be in sim-main.h which is shared
1316         with common/ sim code, so drop the cr16_sim.h include and move it to
1317         the few files that actually need it.
1318
1319         Also rename the file to standardize it a bit better with other ports.
1320
1321 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1322
1323         sim: arm: move arch-specific settings to internal header
1324         There's no need for these settings to be in sim-main.h which is shared
1325         with common/ sim code, so move it all out to a new header which only
1326         this port will include.
1327
1328         The BIT override would be better in the place where it's redefined, so
1329         move it to armdefs.h instead.
1330
1331 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1332
1333         sim: aarch64: move arch-specific settings to internal header
1334         There's no need for these settings to be in sim-main.h which is shared
1335         with common/ sim code, so move it all out to a new header which only
1336         this port will include.
1337
1338         While we're here, drop redundant includes from sim-main.h:
1339         * sim-types.h is included by sim-base.h already
1340         * sim-base.h is included twice
1341         * sim-io.h is included by sim-base.h already
1342
1343 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1344
1345         sim: avr: move arch-specific settings to internal header
1346         There's no need for these settings to be in sim-main.h which is shared
1347         with common/ sim code, so move it all out to a new header which only
1348         this port will include.
1349
1350 2022-12-23  Nick Clifton  <nickc@redhat.com>
1351
1352         Fix illegal memory access parsing corrupt DWARF information.
1353                 PR 29936
1354                 * dwarf2.c (concat_filename): Fix check for a directory index off
1355                 the end of the directory table.
1356
1357 2022-12-23  Eli Zaretskii  <eliz@gnu.org>
1358
1359         Fix MinGW build using mingw.org's MinGW
1360         This allows to build GDB even though the default value of
1361         _WIN32_WINNT is lower than the one needed to expose some
1362         new APIs used here, and leave the test for their actual
1363         support to run time.
1364         * gdb/nat/windows-nat.c (EXTENDED_STARTUPINFO_PRESENT): Define if
1365         not defined.
1366         (create_process_wrapper): Use 'gdb_lpproc_thread_attribute_list'
1367         instead of 'PPROC_THREAD_ATTRIBUTE_LIST' (which might not be defined
1368         at compile time).  This fixes compilation error using mingw.org's
1369         MinGW.
1370
1371 2022-12-23  Mark Harmstone  <mark@harmstone.com>
1372
1373         ld: Write linker symbols in PDB
1374
1375         ld: Copy other symbols into PDB file
1376
1377         ld: Write globals stream in PDB
1378
1379         ld: Parse LF_UDT_SRC_LINE records when creating PDB file
1380
1381         ld: Write types into IPI stream of PDB
1382
1383         ld: Write types into TPI stream of PDB
1384
1385         ld: Write DEBUG_S_LINES entries in PDB file
1386
1387         ld: Fix segfault in populate_publics_stream
1388
1389         ld: Write DEBUG_S_FILECHKSMS entries in PDBs
1390
1391         ld: Generate PDB string table
1392
1393 2022-12-23  Alan Modra  <amodra@gmail.com>
1394
1395         pdb build fixes
1396         Enable compilation of ld/pdb.c just for x86, as is done for bfd/pdb.c.
1397         This reduces the size of ld and is necessary with the following
1398         patches that call a COFF-only bfd function from ld/pdb.c.  Without it
1399         we'd break every non-COFF target build.
1400
1401 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1402
1403         sim: lm32/m32r: drop redundant opcode/cgen.h include
1404         The xxx-desc.h header file already includes this, and it's how the
1405         other cgen ports are getting it, so drop it from these two.
1406
1407         sim: ppc: drop unused types from sim-main.h
1408         The common sim headers should define these for us already, so there's
1409         no need for the ppc header to set them up.
1410
1411         sim: cgen: move symcat.h include to where it's used
1412         Move this out of the global sim-main.h and to the few files that
1413         actually use functions from it.  Only the cgen ports were pulling
1414         this, so this makes cgen & non-cgen behave more the same.
1415
1416         sim: cgen: move cgen-types.h include to cgen-defs.h
1417         The cgen-types.h header sets up types that are needed by cgen-defs.h,
1418         so move the include out of sim-main.h and to that header.  It might
1419         be needed in other specific modules, but for now let's kick it out of
1420         sim-main.h to make some progress.  Things still build with just this.
1421
1422 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1423
1424         Revert "sim: mn10300: drop unused sim-main.c"
1425         This reverts commit 681a422b855e4b20086554b170dae051361f00c7.
1426
1427         I missed that this was included via common/sim-inline.c.  I thought
1428         I had grepped the top of the tree, but I must have only done mn10300.
1429
1430         Add a comment to make it clear where/how this file is used.
1431
1432 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1433
1434         sim: mn10300: drop unused sim-main.c
1435         Nothing compiles or references this, so punt it.
1436
1437         sim: endian: move bfd.h from header to source
1438         The bfd APIs are used only by sim-n-endian.h which is only included by
1439         sim-endian.c, so move the bfd.h include there and out of sim-endian.h
1440         which is included by many other modules.
1441
1442 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1443
1444         sim: move bfd.h include out of sim-main.h
1445         Not all arches include this in sim-main.h, and the ones that do don't
1446         actually use bfd defines in the sim-main.h header.  Prune it to make
1447         sim-main.h simpler so we can kill it off entirely in the future.
1448
1449         We add the include to the files that utilize e.g. bfd_vma though.
1450
1451 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1452
1453         sim: mcore: replace custom "word" type with int32_t
1454         This is a 32-bit architecture with 32-bit registers, so replace the
1455         custom "word" long int typedef with an explicit int32_t.  This is
1456         a correctness fix since long will be 64-bits on most 64-bit hosts.
1457
1458         sim: moxie: replace custom "word" type with int32_t
1459         This is a 32-bit architecture with 32-bit registers, so replace the
1460         custom "word" int typedef with an explicit int32_t.  Practically
1461         speaking, this produces the same code, but it should hopefully make
1462         it easier to merge common code in the future.
1463
1464         sim: cr16/d10v/mcore/moxie: clean up unused word & uword types
1465         Nothing actually uses these, so punt them.  Some of the ports are
1466         using local "word" types, but we'll clean those up in a follow up.
1467
1468         sim: mips: trim redundant igen settings
1469         These variables are setting the same value as the defaults.  Trim
1470         this redundant logic to make it easier to see the real differences
1471         so we can try to keep unifying cases.
1472
1473         sim: mips: merge mips64* with existing multi-run build
1474         Change the default (unhandled) mips64* targets to use the existing
1475         mips64 multi-run build.  It already handles the formats, we just
1476         have to list the mips8000 bfd for it.
1477
1478         sim: mips: merge mips64vr5000 with existing multi-run build
1479         The existing mips64vr-* multi-run build already handles mips5000
1480         targets, so reuse that for mips64vr5* targets too.  This moves
1481         more logic from build-time to runtime so we can have a single
1482         binary that supports many targets.
1483
1484 2022-12-23  Nelson Chu  <nelson@rivosinc.com>
1485
1486         RISC-V: Relax the order checking for the architecture string
1487         * riscv-toolchain-conventions,
1488         PR, https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/14
1489         Issue, https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/11
1490
1491         * Refer to the commit afc41ffb,
1492         RISC-V: Reorder the prefixed extensions which are out of order.
1493
1494         In the past we only allow to reorder the prefixed extensions.  But according
1495         to the PR 14 in the riscv-toolchain-convention, we can also relax the order
1496         checking to allow the whole extensions be written out of orders, including
1497         the single standard extensions and the prefixed multi-letter extensions.
1498         Just that we still need to follow the following rules as usual,
1499
1500         1. prefixed extensions need to be seperated with `_'.
1501         2. prefixed extensions need complete <major>.<minor> version if set.
1502
1503         Please see the details in the march-ok-reorder gas testcase.
1504
1505         Passed the riscv-gnu-toolchain regressions.
1506
1507         bfd/
1508             * elfxx-riscv.c (enum riscv_prefix_ext_class): Changed RV_ISA_CLASS_UNKNOWN
1509             to RV_ISA_CLASS_SINGLE, since everything that does not belong to the
1510             multi-keyword will possible be a single extension for the current parser.
1511             (parse_config): Likewise.
1512             (riscv_get_prefix_class): Likewise.
1513             (riscv_compare_subsets): Likewise.
1514             (riscv_parse_std_ext): Removed, and merged with riscv_parse_prefixed_ext
1515             into riscv_parse_extensions.
1516             (riscv_parse_prefixed_ext): Likewise.
1517             (riscv_parse_subset): Only need to call riscv_parse_extensions to parse
1518             both single standard and prefixed extensions.
1519         gas/
1520             * testsuite/gas/riscv/march-fail-order-std.d: Removed since the relaxed
1521             order checking.
1522             * testsuite/gas/riscv/march-fail-order-std.l: Likewise.
1523             * testsuite/gas/riscv/march-fail-order-x-std.d: Likewise.
1524             * testsuite/gas/riscv/march-fail-order-z-std.d: Likewise.
1525             * testsuite/gas/riscv/march-fail-order-zx-std.l: Likewise.
1526             * testsuite/gas/riscv/march-fail-unknown-std.l: Updated.
1527             * testsuite/gas/riscv/march-ok-reorder.d: New testcase.
1528
1529 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1530
1531         sim: drop unused SIM_ADDR type [PR sim/7504]
1532         Now that sim APIs either use 64-bit addresses all the time, or more
1533         appropriate target-specific types, drop this now-unused 32-bit-only
1534         address type.
1535
1536         Bug: https://sourceware.org/PR7504
1537
1538 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1539
1540         sim: mips: switch from SIM_ADDR to address_word
1541         The latter type matches the address size configured for this sim.
1542
1543         Also take the opportunity to simplify printf logic by leveraging
1544         PRI* macros.
1545
1546 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1547
1548         sim: v850: switch from SIM_ADDR to address_word
1549         The latter type matches the address size configured for this sim.
1550
1551 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1552
1553         sim: switch sim_{read,write} APIs to 64-bit all the time [PR sim/7504]
1554         We've been using SIM_ADDR which has always been 32-bit.  This means
1555         the upper 32-bit address range in 64-bit sims is inaccessible.  Use
1556         64-bit addresses all the time since we want the APIs to be stable
1557         regardless of the active arch backend (which can be 32 or 64-bit).
1558
1559         The length is also 64-bit because it's completely feasible to have
1560         a program that is larger than 4 GiB in size/image/runtime.  Forcing
1561         the caller to manually chunk those accesses up into 4 GiB at a time
1562         doesn't seem useful to anyone.
1563
1564         Bug: https://sourceware.org/PR7504
1565
1566 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1567
1568         sim: use bfd_vma when reading start addr from bfd info
1569         Since SIM_ADDR is always 32-bit, it might truncate the address with
1570         64-bit ELFs.  Since we load that addr from the bfd, use the bfd_vma
1571         type which matches the bfd_get_start_address API.
1572
1573         sim: m32r: include sim-hw.h for sim_hw_parse
1574
1575 2022-12-23  Alan Modra  <amodra@gmail.com>
1576
1577         COFF build-id writes uninitialised data to file
1578         1) The first write in write_build_id wrote rubbish past the struct
1579         external_IMAGE_DEBUG_DIRECTORY, which was later overwritten with
1580         correct data.  No user visible problem there, except that tools like
1581         valgrind complain.
1582         2) The size for the pdb name was incorrectly calculated.
1583
1584                 * emultempl/pe.em (write_build_id): Write the debug directory,
1585                 not the entire section contents.
1586                 (setup_build_id): Add size for the base name of pdb_name, not
1587                 the full path.
1588                 * emultempl/pep.em: Likewise.
1589                 * testsuite/ld-pe/pdb2-section-contrib.d: Update.
1590
1591 2022-12-23  Mike Frysinger  <vapier@gentoo.org>
1592
1593         sim: mips: merge mips64vr4300 with existing multi-run build
1594         The existing mips64vr-* multi-run build already handles mips4300
1595         targets, so reuse that for mips64vr43* targets too.  This moves
1596         more logic from build-time to runtime so we can have a single
1597         binary that supports many targets.
1598
1599 2022-12-23  GDB Administrator  <gdbadmin@sourceware.org>
1600
1601         Automatic date update in version.in
1602
1603 2022-12-22  Indu Bhagat  <indu.bhagat@oracle.com>
1604
1605         sframe: doc: update documentation for pauth key in SFrame FDE
1606         ChangeLog:
1607
1608                 * libsframe/doc/sframe-spec.texi
1609
1610 2022-12-22  Indu Bhagat  <indu.bhagat@oracle.com>
1611
1612         gas: sframe: testsuite: add testcase for .cfi_b_key_frame
1613         This is actually a composite test that checks SFrame unwind information
1614         generation for both the .cfi_negate_ra_state and .cfi_b_key_frame
1615         directives on aarch64.
1616
1617         ChangeLog:
1618
1619                 * testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.d:
1620                 New test.
1621                 * testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.s:
1622                 Likewise.
1623                 * testsuite/gas/cfi-sframe/cfi-sframe.exp: Run new test.
1624
1625 2022-12-22  Indu Bhagat  <indu.bhagat@oracle.com>
1626
1627         objdump/readelf: sframe: emit marker for SFrame FDE with B key
1628         ChangeLog:
1629
1630                 * libsframe/sframe-dump.c (is_sframe_abi_arch_aarch64): New
1631                 definition.
1632                 (dump_sframe_func_with_fres): Emit a string if B key is used.
1633
1634 2022-12-22  Indu Bhagat  <indu.bhagat@oracle.com>
1635
1636         gas: sframe: add support for .cfi_b_key_frame
1637         Gather the information from the DWARF FDE on whether frame's return
1638         addresses are signed using the B key or A key.  Reflect the information in
1639         the SFrame counterpart data structure, the SFrame FDE.
1640
1641         ChangeLog:
1642
1643                 * gas/gen-sframe.c (get_dw_fde_pauth_b_key_p): New definition.
1644                 (sframe_v1_set_func_info): Add new argument for pauth_key.
1645                 (sframe_set_func_info): Likewise.
1646                 (output_sframe_funcdesc): Likewise.
1647                 * gas/gen-sframe.h (struct sframe_version_ops): Add new argument
1648                 to the function pointer declaration.
1649                 * gas/sframe-opt.c (sframe_convert_frag): Handle pauth_key.
1650
1651 2022-12-22  Indu Bhagat  <indu.bhagat@oracle.com>
1652
1653         sframe.h: add support for .cfi_b_key_frame
1654         ARM 8.3 provides five separate keys that can be used to authenticate
1655         pointers. There are two key for executable (instruction) pointers. The
1656         enum pointer_auth_key in gas/config/tc-aarch64.h currently holds two keys:
1657           enum pointer_auth_key {
1658             AARCH64_PAUTH_KEY_A,
1659             AARCH64_PAUTH_KEY_B
1660           };
1661
1662         Analogous to the above, in SFrame format V1, a bit is reserved in the SFrame
1663         FDE to indicate which key is used for signing the frame's return addresses:
1664           - SFRAME_AARCH64_PAUTH_KEY_A has a value of 0
1665           - SFRAME_AARCH64_PAUTH_KEY_B has a value of 1
1666
1667         Note that the information in this bit will always be used along with the
1668         mangled_ra_p bit, the latter indicates whether the return addresses are
1669         mangled/contain PAC auth bits.
1670
1671         include/ChangeLog:
1672
1673                 * sframe.h (SFRAME_AARCH64_PAUTH_KEY_A): New definition.
1674                 (SFRAME_AARCH64_PAUTH_KEY_B): Likewise.
1675                 (SFRAME_V1_FUNC_INFO): Adjust to accommodate pauth_key.
1676                 (SFRAME_V1_FUNC_PAUTH_KEY): New macro.
1677                 (SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY): Likewise.
1678
1679 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1680
1681         gas: re-arrange listing output for .irp and alike
1682         It is kind of odd to have the expansions of such constructs ahead of
1683         their definition in listings with macro expansion enabled. Adjust this
1684         by pulling ahead the output of the definition lines, taking care to
1685         avoid producing a listing line for (non-existing) line 0 when the source
1686         is stdin.
1687
1688         Note that with the code movement the conditional operator isn't
1689         necessary anymore - list->line now match up.
1690
1691 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1692
1693         x86: correct/improve TSX controls
1694         TSXLDTRK takes RTM as a prereq. Additionally introduce an umbrella "tsx"
1695         extension option covering both RTM and HLE, paralleling the "abm" one we
1696         already have.
1697
1698 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1699
1700         x86: add dependencies on SVME
1701         SEV-ES is an extension to SVME. SNP in turn is an extension to SEV-ES,
1702         and yet in turn RMPQUERY is a SNP extension.
1703
1704         Note that cpu_arch[] has no SNP entry, so CPU_ANY_SNP_FLAGS remains
1705         unused (just like CPU_SNP_FLAGS already is).
1706
1707 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1708
1709         x86: add dependencies on VMX
1710         Both EPT and VMFUNC are extensions to VMX.
1711
1712 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1713
1714         x86: correct XSAVE* dependencies
1715         Like various other features AMX-TILE takes XSAVE as a prereq.
1716
1717         XSAVES, unconditionally using compacted format, in turn effectively
1718         takes XSAVEC as a prereq (an SDM clarification to this effect is in the
1719         works).
1720
1721 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1722
1723         x86: correct dependencies of a few AVX512 sub-features
1724         Like AVX512-FP16, several other extensions require wider than 16-bit
1725         mask registers. As a result they take AVX512BW as a prereq, not (just)
1726         AVX512F. Which in turn points out wrong expectations in the noavx512-1
1727         testcase.
1728
1729         x86: rework noavx512-1 testcase
1730         So far the set of ".noavx512*" has been accumulating, which isn't ideal.
1731         In particular this hides issues with dependencies between features.
1732         Switch back to the default ISA before disabling a particular subset.
1733         Furthermore limit redundancy by wrapping the repeated block of insns in
1734         an .irp.
1735
1736         x86: add dependencies on AVX2
1737         Like AVX-VNNI both VAES and VPCLMUL take AVX2 as a prereq, for operating
1738         on up to 256-bit packed integer vectors.
1739
1740         x86: correct SSE dependencies
1741         SSE itself takes FXSR as a prereq. Like AES, PCLMUL, and SHA both GFNI
1742         and KL take SSE2 as a prereq, for operating on packed integers. And
1743         while correcting KL also record it as a prereq to WIDEKL.
1744
1745 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1746
1747         x86: correct what gets disabled by certain ".arch .no*"
1748         Features with prereqs as well as features with dependents cannot re-use
1749         CPU_*_MASK for the 3rd argument of SUBARCH() - they need to use
1750         CPU_ANY_*_MASK in order to avoid disabling too many (when there are
1751         prereqs) and/or too few (when there are dependents) features.
1752
1753         Generally any CPU_ANY_*_MASK which exist should not remain unused.
1754         Exceptions are
1755         - FISTTP which has no corresponding entry in cpu_arch[],
1756         - IAMCU which is a base architecture and hence uses ARCH(), not
1757           SUBARCH() (only extensions can be disabled, but unlike for Cpu*86 it
1758           would be a little more clumsy to suppress generating of the #define).
1759
1760 2022-12-22  Jan Beulich  <jbeulich@suse.com>
1761
1762         x86: re-work ISA extension dependency handling
1763         Getting both forward and reverse ISA dependencies right / consistent has
1764         been a permanent source of mistakes. Reduce what needs specifying
1765         manually to just the direct forward dependencies. Transitive forward
1766         dependencies as well as reverse ones are now derived and hence cannot go
1767         out of sync anymore (at least in the vast majority of cases; there are a
1768         few special cases to still take care of manually). In the course of this
1769         several CPU_ANY_*_FLAGS disappear, requiring adjustment to the
1770         assembler's cpu_arch[].
1771
1772         Note that to retain the correct reverse dependency of AVX512F wrt
1773         AVX512-VP2INTERSECT, the latter has the previously missing AVX512F
1774         prereq added.
1775
1776         Note further that to avoid adding the following undue prereqs:
1777         * ATHLON, K8, and AMDFAM10 gain CMOV and FXSR,
1778         * IAMCU gains 387,
1779         auxiliary table entries (including a colon-separated modifier) are
1780         introduced in addition to the ones representing from converting the old
1781         table.
1782
1783         To maintain forward-only dependencies between AVX (XOP) and SSE* (SSE4a)
1784         (i.e. "nosse" not disabling AVX), reverse dependency tracking is
1785         artifically suppressed.
1786
1787         As a side effect disabling of SSE or SSE2 will now also disable AES,
1788         PCLMUL, and SHA (respective elements were missing from
1789         CPU_ANY_SSE2_FLAGS).
1790
1791 2022-12-22  Mike Frysinger  <vapier@gentoo.org>
1792
1793         sim: mips: match target on cpu settings
1794         We don't need to enforce larger target settings when the only thing
1795         the sim should care about is the CPU target.  So reduce most of the
1796         target matches to only check the CPU.
1797
1798         sim: mips: move fpu bitsize defines to top-level configure
1799         This drops support for the --enable-sim-float configure option,
1800         but it's not clear anyone ever actually used that.  Eventually
1801         we'll want this to be a runtime option anyways.
1802
1803         sim: mips: move bitsize defines to top-level configure
1804         Since the msb value is always defined as the wordsize-1, stop
1805         hardcoding that value directly, and use a CPP value instead.
1806
1807         sim: mips: move subtarget defines to top-level configure
1808         We want to kill off mips/configure entirely.  Move this small part
1809         out now to get started.
1810
1811         sim: mips: always resolve active bfd mach dynamically
1812         Don't assume that the default bfd that we configured for is the one
1813         that is always active when running a program.  We already have access
1814         to the real runtime value, so use it directly.  This simplifies the
1815         code quite a bit, and will make it easier to support multiple mach's
1816         in a single binary.
1817
1818         sim: hw-config.h: move generation to top-level
1819         In order to compile arch objects from the top-level, we need to
1820         generate the hw-config.h header, so move that logic up to the top
1821         level first.
1822
1823         sim: build: hoist lists of hw devices up
1824         We need these in the top-level to generate libsim.a, but also in the
1825         subdirs to generate hw-config.h.  Move it to the local.mk, and pass
1826         it down when running recursive make.  This avoids duplication, and
1827         makes it available to both.  We can simplify this once we move the
1828         various steps up to the top-level too.
1829
1830         sim: build: hoist lists of common objects up
1831         In order to create libsim.a in the common dir, we need the list of
1832         objects for each target.  To avoid duplicating the list with the
1833         recursive make in each port, pass it down as a variable.  This is
1834         a temporary hack until the top-level creates libsim.a for ports.
1835
1836 2022-12-22  GDB Administrator  <gdbadmin@sourceware.org>
1837
1838         Automatic date update in version.in
1839
1840 2022-12-21  Alan Modra  <amodra@gmail.com>
1841
1842         PR29925, Memory leak in find_abstract_instance
1843         The testcase in the PR had a variable with both DW_AT_decl_file and
1844         DW_AT_specification, where the DW_AT_specification also specified
1845         DW_AT_decl_file.  This leads to a memory leak as the file name is
1846         malloced and duplicates are not expected.
1847
1848         I've also changed find_abstract_instance to not use a temp for "name",
1849         because that can result in a change in behaviour from the usual last
1850         of duplicate attributes wins.
1851
1852                 PR 29925
1853                 * dwarf2.c (find_abstract_instance): Delete "name" variable.
1854                 Free *filename_ptr before assigning new file name.
1855                 (scan_unit_for_symbols): Similarly free func->file and
1856                 var->file before assigning.
1857
1858 2022-12-21  Andrew Pinski  <apinski@marvell.com>
1859
1860         Fix compiling of top.c
1861         When I moved my last patch forward, somehow I missed removing
1862         the #endif for the HAVE_LIBMPFR case.
1863
1864         Committed as obvious after a quick build.
1865
1866         gdb/ChangeLog:
1867                 * top.c: Remove the extra #endif which was missed.
1868
1869 2022-12-21  Andrew Pinski  <apinski@marvell.com>
1870
1871         Use toplevel configure for GMP and MPFR for gdb
1872         This patch uses the toplevel configure parts for GMP/MPFR for
1873         gdb. The only thing is that gdb now requires MPFR for building.
1874         Before it was a recommended but not required library.
1875         Also this allows building of GMP and MPFR with the toplevel
1876         directory just like how it is done for GCC.
1877         We now error out in the toplevel configure of the version
1878         of GMP and MPFR that is wrong.
1879
1880         OK after GDB 13 branches? Build gdb 3 ways:
1881         with GMP and MPFR in the toplevel (static library used at that point for both)
1882         With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
1883         With neither GMP and MPFR in the toplevel (distro libraries used)
1884
1885         Changes from v1:
1886         * Updated gdb/README and gdb/doc/gdb.texinfo.
1887         * Regenerated using unmodified autoconf-2.69
1888
1889         Thanks,
1890         Andrew Pinski
1891
1892         ChangeLog:
1893                 * Makefile.def: Add configure-gdb dependencies
1894                 on all-gmp and all-mpfr.
1895                 * configure.ac: Split out MPC checking from MPFR.
1896                 Require GMP and MPFR if the gdb directory exist.
1897                 * Makefile.in: Regenerate.
1898                 * configure: Regenerate.
1899
1900         gdb/ChangeLog:
1901
1902                 PR bug/28500
1903                 * configure.ac: Remove AC_LIB_HAVE_LINKFLAGS
1904                 for gmp and mpfr.
1905                 Use GMPLIBS and GMPINC which is provided by the
1906                 toplevel configure.
1907                 * Makefile.in (LIBGMP, LIBMPFR): Remove.
1908                 (GMPLIBS, GMPINC): Add definition.
1909                 (INTERNAL_CFLAGS_BASE): Add GMPINC.
1910                 (CLIBS): Exchange LIBMPFR and LIBGMP
1911                 for GMPLIBS.
1912                 * target-float.c: Make the code conditional on
1913                 HAVE_LIBMPFR unconditional.
1914                 * top.c: Remove code checking HAVE_LIBMPFR.
1915                 * configure: Regenerate.
1916                 * config.in: Regenerate.
1917                 * README: Update GMP/MPFR section of the config
1918                 options.
1919                 * doc/gdb.texinfo: Likewise.
1920
1921         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28500
1922
1923 2022-12-21  Bruno Larsen  <blarsen@redhat.com>
1924
1925         gdb/c++: validate 'using' directives based on the current line
1926         When asking GDB to print a variable from an imported namespace, we only
1927         want to see variables imported in lines that the inferior has already
1928         gone through, as is being tested last in gdb.cp/nsusing.exp. However
1929         with the proposed change to gdb.cp/nsusing.exp, we get the following
1930         failures:
1931
1932         (gdb) PASS: gdb.cp/nsusing.exp: continue to breakpoint: marker10 stop
1933         print x
1934         $9 = 911
1935         (gdb) FAIL: gdb.cp/nsusing.exp: print x, before using statement
1936         next
1937         15        y += x;
1938         (gdb) PASS: gdb.cp/nsusing.exp: using namespace M
1939         print x
1940         $10 = 911
1941         (gdb) PASS: gdb.cp/nsusing.exp: print x, only using M
1942
1943         Showing that the feature wasn't functioning properly, it just so
1944         happened that gcc ordered the namespaces in a convenient way.
1945         This happens because GDB doesn't take into account the line where the
1946         "using namespace" directive is written. So long as it shows up in the
1947         current scope, we assume it is valid.
1948
1949         To fix this, add a new member to struct using_direct, that stores the
1950         line where the directive was written, and a new function that informs if
1951         the using directive is valid already.
1952
1953         Unfortunately, due to a GCC bug, the failure still shows up. Compilers
1954         that set the declaration line of the using directive correctly (such as
1955         Clang) do not show such a bug, so the test includes an XFAIL for gcc
1956         code.
1957
1958         Finally, because the final test of gdb.cp/nsusing.exp has turned into
1959         multiple that all would need XFAILs for older GCCs (<= 4.3), and that
1960         GCC is very old, if it is detected, the test just exits early.
1961
1962         Approved-by: Tom Tromey <tom@tromey.com>
1963
1964 2022-12-21  Nick Clifton  <nickc@redhat.com>
1965
1966         Updated Romanian translation for the BFD sub-directory.
1967
1968         Fix an attempt to allocate an unreasonably large amount of memory when parsing a corrupt ELF file.
1969                 PR  29924
1970                 * objdump.c (load_specific_debug_section): Check for excessively
1971                 large sections.
1972
1973         Keep the .drectve section when performing a relocateable link.
1974                 PR 29900
1975                 * scripttempl/pe.sc: Keep the .drectve section when performing a
1976                 relocateable link.
1977                 * scripttempl/pep.sc: Likewise.
1978
1979 2022-12-21  Jan Beulich  <jbeulich@suse.com>
1980
1981         x86: rename CheckRegSize to CheckOperandSize
1982         While originally indeed used for register size checking only, the
1983         attribute has been used for memory operand size checking as well already
1984         for quite a while, with more such uses recently having been added.
1985
1986         gprofng/testsuite: restrict testing to native configurations
1987         The binaries involved in testing gprofng are native ones, and hence a
1988         cross build of binutils won't really test intended functionality. Since
1989         this testing takes quite a bit of time (typically more than running all
1990         of binutils, gas, and ld testsuites together), restrict the testing to
1991         native configurations only.
1992
1993 2022-12-21  Alan Modra  <amodra@gmail.com>
1994
1995         enable-non-contiguous-regions warnings
1996         The warning about discarded sections in elf_link_input_bfd doesn't
1997         belong there since the code is dealing with symbols.  Multiple symbols
1998         in a discarded section will result in multiple identical warnings
1999         about the section.  Move the warning to a new function in ldlang.c.
2000
2001         The patch also tidies the warning quoting of section and file names,
2002         consistently using `%pA' and `%pB'.  I'm no stickler for one style of
2003         section and file name quoting, but they ought to be consistent within
2004         a warning, eg. see the first one fixed in ldlang.c, and when a warning
2005         is emitted for multiple targets they all ought to use exactly the same
2006         format string to reduce translation work.  elf64-ppc.c loses the
2007         build_one_stub errors since we won't get there before hitting the
2008         fatal errors in size_one_stub.
2009
2010         bfd/
2011                 * elflink.c (elf_link_input_bfd): Don't warn here about
2012                 discarded sections.
2013                 * elf32-arm.c (arm_build_one_stub): Use consistent style in
2014                 --enable-non-contiguous-regions error.
2015                 * elf32-csky.c (csky_build_one_stub): Likewise.
2016                 * elf32-hppa.c (hppa_build_one_stub): Likewise.
2017                 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2018                 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2019                 * elf32-metag.c (metag_build_one_stub): Likewise.
2020                 * elf32-nios2.c (nios2_build_one_stub): Likewise.
2021                 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2022                 * xcofflink.c (xcoff_build_one_stub): Likewise.
2023                 * elf64-ppc.c (ppc_size_one_stub): Likewise.
2024                 (ppc_build_one_stub): Delete dead code.
2025         ld/
2026                 * ldlang.c (lang_add_section): Use consistent style in
2027                 --enable-non-contiguous-regions warnings.
2028                 (size_input_section): Likewise.
2029                 (warn_non_contiguous_discards): New function.
2030                 (lang_process): Call it.
2031                 * testsuite/ld-arm/non-contiguous-arm.d: Update.
2032                 * testsuite/ld-arm/non-contiguous-arm4.d: Update.
2033                 * testsuite/ld-arm/non-contiguous-arm7.d: Add
2034                 --enable-non-contiguous-regions-warnings.
2035                 * testsuite/ld-arm/non-contiguous-arm7.err: New.
2036                 * testsuite/ld-powerpc/non-contiguous-powerpc.d: Update.
2037                 * testsuite/ld-powerpc/non-contiguous-powerpc64.d: Update.
2038
2039 2022-12-21  Alan Modra  <amodra@gmail.com>
2040
2041         PR29922, SHT_NOBITS section avoids section size sanity check
2042                 PR 29922
2043                 * dwarf2.c (find_debug_info): Ignore sections without
2044                 SEC_HAS_CONTENTS.
2045
2046 2022-12-21  Mike Frysinger  <vapier@gentoo.org>
2047
2048         sim: fully merge sim_cpu_base into sim_cpu
2049         Now that all ports have migrated to the new framework, drop support
2050         for the old sim_cpu_base layout.  There's a lot of noise here, so
2051         it's been split into a dedicated commit.
2052
2053         sim: enable common sim_cpu usage everywhere
2054         All ports should be migrated now.  Drop the SIM_HAVE_COMMON_SIM_CPU
2055         knob and require it be used everywhere now.
2056
2057         sim: or1k: invert sim_cpu storage
2058         The cpu.h change is in generated cgen code, but that has been sent
2059         upstream too, so the next regen should include it automatically.
2060
2061         sim: m32r: invert sim_cpu storage
2062         The cpu*.h changes are in generated cgen code, but that has been sent
2063         upstream too, so the next regen should include it automatically.
2064
2065         sim: lm32: invert sim_cpu storage
2066         The cpu.h change is in generated cgen code, but that has been sent
2067         upstream too, so the next regen should include it automatically.
2068
2069         sim: iq2000: invert sim_cpu storage
2070         The cpu.h change is in generated cgen code, but that has been sent
2071         upstream too, so the next regen should include it automatically.
2072
2073         sim: frv: invert sim_cpu storage
2074         The cpu.h change is in generated cgen code, but that has been sent
2075         upstream too, so the next regen should include it automatically.
2076
2077         sim: cris: invert sim_cpu storage
2078         The cpu*.h changes are in generated cgen code, but that has been sent
2079         upstream too, so the next regen should include it automatically.
2080
2081         sim: bpf: invert sim_cpu storage
2082         The cpu.h change is in generated cgen code, but that has been sent
2083         upstream too, so the next regen should include it automatically.
2084
2085         sim: cgen: prep for inverting sim_cpu storage
2086         Some common cgen code changes to allow cgen ports to invert their
2087         sim_cpu storage one-by-one.
2088
2089         sim: riscv: invert sim_cpu storage
2090
2091         sim: pru: invert sim_cpu storage
2092
2093         sim: example-synacor: invert sim_cpu storage
2094
2095         sim: h8300: invert sim_cpu storage
2096
2097         sim: m68hc11: invert sim_cpu storage
2098
2099         sim: mips: invert sim_cpu storage
2100
2101         sim: v850: invert sim_cpu storage
2102
2103         sim: mcore: invert sim_cpu storage
2104
2105         sim: aarch64: invert sim_cpu storage
2106
2107         sim: microblaze: invert sim_cpu storage
2108
2109         sim: avr: invert sim_cpu storage
2110
2111         sim: moxie: invert sim_cpu storage
2112
2113         sim: msp430: invert sim_cpu storage
2114
2115         sim: ft32: invert sim_cpu storage
2116
2117         sim: bfin: invert sim_cpu storage
2118
2119 2022-12-21  Mike Frysinger  <vapier@gentoo.org>
2120
2121         sim: sim_cpu: invert sim_cpu storage
2122         Currently all ports have to declare sim_cpu themselves in their
2123         sim-main.h and then embed the common sim_cpu_base in it.  This
2124         dynamic makes it impossible to share common object code among
2125         multiple ports because the core data structure is always different.
2126
2127         Let's invert this relationship: common code declares sim_cpu, and
2128         the port uses the new arch_data field for its per-cpu state.
2129
2130         This is the first in a series of changes: it adds a define to select
2131         between the old & new layouts, then converts all the ports that don't
2132         need custom state over to the new layout.  This includes mn10300 that,
2133         while it defines custom fields in its cpu struct, never uses them.
2134
2135 2022-12-21  Mike Frysinger  <vapier@gentoo.org>
2136
2137         sim: move register headers into sim/ namespace [PR sim/29869]
2138         These headers define the register numbers for each port to implement
2139         the sim_fetch_register & sim_store_register interfaces.  While gdb
2140         uses these, the APIs are part of the sim, not gdb.  Move the headers
2141         out of the gdb/ include namespace and into sim/ instead.
2142
2143         sim: ppc: drop old dgen.c generator
2144         The spreg.[ch] files live in the source tree now and are created
2145         with the dgen.py script, so we don't need this old tool anymore.
2146
2147 2022-12-21  Mike Frysinger  <vapier@gentoo.org>
2148
2149         sim: ppc: move spreg.[ch] files to the source tree
2150         Simplify the build by moving the generation of these files from
2151         build-time (via dgen.c that we have to compile & execute on the
2152         build system) to maintainer/release mode (via spreg-gen.py that
2153         we only ever execute when the spreg table actually changes).  It
2154         speeds up the build process and makes it easier for us to reason
2155         about & review changes to the code generator.
2156
2157         The tool is renamed from "dgen" because it's hardcoded to only
2158         generated spreg files.  It isn't a generalized tool for creating
2159         lookup tables.
2160
2161 2022-12-21  GDB Administrator  <gdbadmin@sourceware.org>
2162
2163         Automatic date update in version.in
2164
2165 2022-12-20  Hannes Domani  <ssbssa@yahoo.de>
2166
2167         Fix install-strip target
2168         The libtool patch broke install-strip of gdb:
2169
2170         /bin/sh ../../gdb/../mkinstalldirs /src/gdb/inst/share/gdb/python/gdb
2171         transformed_name=`t='s,y,y,'; \
2172                           echo gdb | sed -e "$t"` ; \
2173                 if test "x$transformed_name" = x; then \
2174                   transformed_name=gdb ; \
2175                 else \
2176                   true ; \
2177                 fi ; \
2178                 /bin/sh ../../gdb/../mkinstalldirs /src/gdb/inst/bin ; \
2179                 /bin/sh ./libtool --mode=install STRIPPROG='strip' /bin/sh /src/gdb/gdb.git/install-sh -c -s \
2180                         gdb \
2181                         /src/gdb/inst/bin/$transformed_name ; \
2182                 /bin/sh ../../gdb/../mkinstalldirs /src/gdb/inst/include/gdb ; \
2183                 /usr/bin/install -c -m 644 jit-reader.h /src/gdb/inst/include/gdb/jit-reader.h
2184         libtool: install: `/src/gdb/inst/bin/gdb' is not a directory
2185         libtool: install: Try `libtool --help --mode=install' for more information.
2186
2187         Since INSTALL_PROGRAM_ENV is no longer at the beginning of the command, the
2188         gdb executable is not installed with install-strip.
2189
2190 2022-12-20  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
2191
2192         bfd: Discard symbol regardless of warning flag
2193         The discard of symbols should be performed whether the warning for
2194         the discard is enabled or not.
2195         Without this patch, ld would segfault in bfd_section_removed_from_list,
2196         called in the if-statement right after this block, as the argument
2197         isec->output_section can be NULL.
2198
2199         Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
2200
2201 2022-12-20  Alan Modra  <amodra@gmail.com>
2202
2203         PR29915, bfdio.c does not compile with mingw.org's MinGW
2204                 PR 29915
2205                 * configure.ac: Add AC_CHECK_DECLS test ___lc_codepage_func.
2206                 * configure: Regenerate.
2207                 * config.in: Regenerate.
2208                 * bfdio.c (___lc_codepage_func): Move declaration to..
2209                 (_bfd_real_fopen): ..here, and use !HAVE_DECL____LC_CODEPAGE_FUNC.
2210
2211         Re: x86: remove i386-opc.c
2212         Regen opcodes/po/POTFILES.in
2213
2214 2022-12-20  Mike Frysinger  <vapier@gentoo.org>
2215
2216         sim: ppc: change spreg switch table generation to compile-time
2217         Simplify the generator by always outputting the switch tables, and
2218         leave the choice of whether to use them to the compiler via a -D
2219         flag.
2220
2221 2022-12-20  Mike Frysinger  <vapier@gentoo.org>
2222
2223         sim: dv-core: add hw_detach_address method [PR sim/25211]
2224         The core device has an attach address method as the root of the tree
2225         which calls out to the sim API.  But it doesn't have a corresponding
2226         detach method which means we just crash if anything tries to detach
2227         itself from the core.  In practice, the m68hc11 is the only model
2228         that actually tries to detach itself on the fly, so no one noticed
2229         earlier.
2230
2231         With this in place, we can delete the existing detach code from the
2232         m68hc11 model since it defaults to "passthru" callback which will in
2233         turn call the dv-core detach, and they have the same behavior -- call
2234         the sim core API to detach from the address space.
2235
2236         Bug: https://sourceware.org/PR25211
2237
2238 2022-12-20  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
2239
2240         gprofng: PR29646 Various warnings
2241         gprofng/ChangeLog
2242         2022-12-19  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
2243
2244                 PR gprofng/29646
2245                 * common/core_pcbe.c: Fix missingReturn warning.
2246                 * libcollector/iolib.c: Fix -Waddress warnings.
2247                 * src/Settings.cc: Likewise.
2248                 * src/checks.cc: Likewise.
2249                 * libcollector/linetrace.c: Likewise.
2250                 * libcollector/iotrace.c: Fix va_end_missing error.
2251                 * libcollector/libcol_util.c: Fix uninitvar warning.
2252                 * src/Command.cc: Fix arrayIndexOutOfBounds error.
2253                 * src/Function.cc: Fix uninitStructMember warning.
2254                 * src/ipc.cc: Fix -Wwrite-strings warnings.
2255
2256 2022-12-20  GDB Administrator  <gdbadmin@sourceware.org>
2257
2258         Automatic date update in version.in
2259
2260 2022-12-19  Tom Tromey  <tromey@adacore.com>
2261
2262         Avoid compiler warning in dwarf-do-refresh
2263         The Emacs 28 compiler warns about dwarf-mode.el:
2264
2265         Warning (comp): dwarf-mode.el:180:32: Warning: Unused lexical argument `ignore'
2266
2267         This is easily fixed by prepending "_" to the parameter's name.
2268
2269         binutils/ChangeLog
2270         2022-12-19  Tom Tromey  <tromey@adacore.com>
2271
2272                 * dwarf-mode.el (dwarf-do-refresh): Avoid compiler warning.
2273
2274 2022-12-19  Tom Tromey  <tom@tromey.com>
2275
2276         Use bool in bpstat
2277         This changes bpstat to use 'bool' rather than 'char', and updates the
2278         uses.
2279
2280         Use bool constants for value_print_options
2281         This changes the uses of value_print_options to use 'true' and 'false'
2282         rather than integers.
2283
2284         Remove quick_symbol_functions::relocated
2285         quick_symbol_functions::relocated is only needed for psymtabs, and
2286         there it is only needed for Rust.  However, because we've switched the
2287         DWARF reader away from psymtabs, this means there's no longer a need
2288         for this method at all.
2289
2290 2022-12-19  Tom Tromey  <tom@tromey.com>
2291
2292         Remove MI version 1
2293         MI version 1 is long since obsolete.  Several years ago, I filed
2294         PR mi/23170 for this.  I think it's finally time to remove this.
2295         Any users of MI 1 can and should upgrade to a newer version.
2296
2297         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23170
2298
2299 2022-12-19  Tom Tromey  <tom@tromey.com>
2300
2301         Remove vestiges of MI version 0
2302         I found a few vestiges of MI version 0 in the test suite.  This patch
2303         removes them.
2304
2305 2022-12-19  Alan Modra  <amodra@gmail.com>
2306
2307         Tidy PR29893 and PR29908 fix
2308                 PR 29893
2309                 PR 29908
2310                 * dwarf.c (display_debug_addr): Combine dwarf5 unit_length checks.
2311                 Delete dead code.
2312
2313 2022-12-19  Jan Vrany  <jan.vrany@labware.com>
2314
2315         gdb: fix command lookup in execute_command ()
2316         Commit b5661ff2 ("gdb: fix possible use-after-free when
2317         executing commands") used lookup_cmd_exact () to lookup
2318         command again after its execution to avoid possible
2319         use-after-free error.
2320
2321         However this change broke test gdb.base/define.exp which
2322         defines a post-hook for subcommand ("target testsuite").
2323         In this case,  lookup_cmd_exact () returned NULL because
2324         there's no command 'testsuite' in top-level commands.
2325
2326         This commit fixes this case by looking up the command again
2327         using the original command line via lookup_cmd ().
2328
2329         Approved-By: Simon Marchi <simon.marchi@efficios.com>
2330
2331 2022-12-19  Nick Clifton  <nickc@redhat.com>
2332
2333         Fix potential illegal memory accesses when parsing corrupt DWARF data.
2334                 PR 29914
2335                 * dwarf.c (fetch_indexed_value): Fail if the section is not big
2336                 enough to contain a header size field.
2337                 (display_debug_addr): Fail if the computed address size is too big
2338                 or too small.
2339
2340         New Romainian translation for the GOLD subdirectory.
2341
2342 2022-12-19  Jan Beulich  <jbeulich@suse.com>
2343
2344         gprofng/testsuite: skip Java test without JDK
2345         There's no point in even trying the Java test when gprofng was built
2346         without Java support, and when the building of the constituents of the
2347         testcase also would fail. On such systems this converts the respective
2348         tests from "unresolved" to "unsupported", making the overall testsuite
2349         run no longer report failure just because of this.
2350
2351         gprofng/testsuite: eliminate bogus casts
2352         Casting pointers to unsigned int is generally problematic and hence
2353         compilers tend to warn about such. While here they're used only in
2354         fprintf(), it still seems better to omit such casts, even if only to
2355         avoid setting bad precedents.
2356
2357         gprofng/testsuite: correct line continuation in endcases.c
2358         A backslash used to indicate line continuation (in a macro definition
2359         here) is not supposed to be followed by blanks or other white space; the
2360         end-of-line indicator is to follow immediately.
2361
2362         gprofng/testsuite: correct names for signal handling tests
2363         The signal handling tests spend most of their time in the signal
2364         handlers, and hence for profile output to match anything in program
2365         output, the respective name fields need to hold the handler function
2366         names. This converts both respective tests from "unresolved" to actually
2367         succeeding.
2368
2369         gprofng/testsuite: adjust linking of synprog
2370         In order for so_syn.so and so_syx.so to be able to access the main
2371         program's "testtime" variable, that variable needs exposing in the
2372         dynamic symbol table. Since this is a test program only, do it the brute
2373         force way and simply expose all global symbols.
2374
2375         Arm: break gas dependency on libopcodes
2376         gas doesn't use anything from libopcodes (anymore?) - suppress linking
2377         in that library.
2378
2379         x86: omit Cpu prefixes from opcode table
2380         These enumerators can be used in only one specific field, and hence the
2381         Cpu prefix isn't needed ther for disambiguation / name space separation.
2382
2383 2022-12-19  GDB Administrator  <gdbadmin@sourceware.org>
2384
2385         Automatic date update in version.in
2386
2387 2022-12-18  Alan Modra  <amodra@gmail.com>
2388
2389         Comment bfd_get_section_limit_octets and bfd_get_section_alloc_size
2390                 * bfd.c (bfd_get_section_limit_octets): Add comment.
2391                 (bfd_get_section_alloc_size): Likewise.
2392                 * libbfd.c (_bfd_generic_get_section_contents): Use
2393                 bfd_get_section_limit_octets.
2394                 * section.c (bfd_get_section_contents): Likewise.
2395                 * bfd-in2.h: Regenerate.
2396
2397 2022-12-18  Alan Modra  <amodra@gmail.com>
2398
2399         ld bootstrap test in build dir with path containing symlinks
2400         This allows the bootstrap test to run if you have a symlink somewhere
2401         in the build path directory.  $ld depends on $base_dir which is set
2402         via tcl [pwd], collapsing the symlink like /usr/bin/pwd, while $objdir
2403         contains the symlink.
2404
2405                 * testsuite/ld-bootstrap/bootstrap.exp: Normalize paths when
2406                 checking for ld build directory.
2407
2408 2022-12-18  Joel Brobecker  <brobecker@adacore.com>
2409
2410         Update gdb/NEWS after GDB 13 branch creation.
2411         This commit a new section for the next release branch, and renames
2412         the section of the current branch, now that it has been cut.
2413
2414 2022-12-18  Joel Brobecker  <brobecker@adacore.com>
2415
2416         Bump version to 14.0.50.DATE-git.
2417         Now that the GDB 13 branch has been created,
2418         this commit bumps the version number in gdb/version.in to
2419         14.0.50.DATE-git
2420
2421         For the record, the GDB 13 branch was created
2422         from commit 71c90666e601c511a5f495827ca9ba545e4cb463.
2423
2424         Also, as a result of the version bump, the following changes
2425         have been made in gdb/testsuite:
2426
2427                 * gdb.base/default.exp: Change $_gdb_major to 14.
2428
2429 2022-12-18  GDB Administrator  <gdbadmin@sourceware.org>
2430
2431         Automatic date update in version.in
2432
2433 2022-12-17  Alan Modra  <amodra@gmail.com>
2434
2435         bfd_get_relocated_section_contents allow NULL data buffer
2436         This patch removes the bfd_malloc in default_indirect_link_order and
2437         bfd_simple_get_relocated_section_contents, pushing the allocation down
2438         to bfd_get_relocated_section_contents.  The idea is to make use of the
2439         allocation done with sanity checking in bfd_get_full_section_contents,
2440         which is called by bfd_generic_get_relocated_section_contents.
2441
2442         Doing this exposed a bug in bfd_get_full_section_contents.  With
2443         relaxation it is possible that an input section rawsize is different
2444         to the section size.  In that case we want to use the larger of
2445         rawsize (the on-disk size for input sections) and size.
2446
2447                 * reloc.c (bfd_generic_get_relocated_section_contents),
2448                 * reloc16.c (bfd_coff_reloc16_get_relocated_section_contents),
2449                 * coff-alpha.c (alpha_ecoff_get_relocated_section_contents),
2450                 * coff-sh.c (sh_coff_get_relocated_section_contents),
2451                 * elf-m10200.c (mn10200_elf_get_relocated_section_contents),
2452                 * elf-m10300.c (mn10300_elf_get_relocated_section_contents),
2453                 * elf32-avr.c (elf32_avr_get_relocated_section_contents),
2454                 * elf32-cr16.c (elf32_cr16_get_relocated_section_contents),
2455                 * elf32-crx.c (elf32_crx_get_relocated_section_contents),
2456                 * elf32-h8300.c (elf32_h8_get_relocated_section_contents),
2457                 * elf32-nds32.c (nds32_elf_get_relocated_section_contents),
2458                 * elf32-sh.c (sh_elf_get_relocated_section_contents),
2459                 * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents):
2460                 Handle NULL data buffer.
2461                 * bfd.c (bfd_get_section_alloc_size): New function.
2462                 * bfd-in2.h: Regenerate.
2463                 * compress.c (bfd_get_full_section_contents): Correct section
2464                 malloc size.
2465                 * linker.c (default_indirect_link_order): Don't malloc memory
2466                 here before calling bfd_get_relocated_section_contents.
2467                 * simple.c (bfd_simple_get_relocated_section_contents): Likewise.
2468
2469 2022-12-17  Alan Modra  <amodra@gmail.com>
2470
2471         asan: elf.c:12621:18: applying zero offset to null pointer
2472         That's this line in elf_parse_notes:
2473           while (p < buf + size)
2474
2475                 * elf.c (_bfd_elf_make_section_from_shdr): Don't call
2476                 elf_parse_notes when sh_size is zero.
2477
2478 2022-12-17  Alan Modra  <amodra@gmail.com>
2479
2480         Re: The problem with warning in elf_object_p
2481         Commit 5aa0f10c424e added a per_xvec_warn array to provide support for
2482         warnings from elf_object_p (and a later patch for warnings from
2483         pe_bfd_object_p) to be cached and then only printed if the target
2484         matches.  It was quite limited in the style of message supported, only
2485         one message could be printed, and didn't really meet the stated aim of
2486         only warning when a target matches:  There are many other errors and
2487         warnings that can be emitted by functions called from elf_object_p.
2488
2489         So this patch extends the error handler functions to support printing
2490         to a string buffer, extends per_xvec_warn to support multiple errors/
2491         warnings, and hooks this all into bfd_check_format_matches.  If
2492         bfd_check_format_matches succeeds then any errors/warnings are printed
2493         for the matching target.  If bfd_check_format_matches fails either due
2494         to no match or to multiple matches and only one target vector produced
2495         errors, then those errors are printed.
2496
2497                 * bfd.c (MAX_ARGS): Define, use throughout.
2498                 (print_func): New typedef.
2499                 (_bfd_doprnt): Add new print param.  Replace calls to fprintf
2500                 with print.
2501                 (PRINT_TYPE): Similarly.
2502                 (error_handler_fprintf): Renamed from error_handler_internal.
2503                 Use _bfd_get_error_program_name.  Add fprintf arg.  Move code
2504                 setting up args..
2505                 (_bfd_doprnt_scan): ..to here.  Add ap param.
2506                 (struct buf_stream): New.
2507                 (err_sprintf): New function.
2508                 (error_handler_bfd): New static variable.
2509                 (error_handler_sprintf): New function.
2510                 (_bfd_set_error_handler_caching): New function.
2511                 (_bfd_get_error_program_name): New function.
2512                 * elfcode.h (elf_swap_shdr_in): Use _bfd_error_handler in
2513                 warning messages.
2514                 (elf_object_p): Likewise.
2515                 * format.c (print_warnmsg): New function.
2516                 (clear_warnmsg): Rewrite.
2517                 (null_error_handler): New function.
2518                 (bfd_check_format_matches): Ignore warnings from recursive calls
2519                 checking first element of an archive.  Use caching error handler
2520                 otherwise.  Print warnings on successful match, or when only one
2521                 target has emitted warnings/errors.
2522                 * peicode.h (pe_bfd_object_p): Use _bfd_error_handler in
2523                 warning messages.
2524                 * targets.c (per_xvec_warn): Change type of array elements.
2525                 (struct per_xvec_message): New.
2526                 (_bfd_per_xvec_warn): Rewrite.
2527                 * Makefile.am (LIBBFD_H_FILES): Add bfd.c.
2528                 * Makefile.in: Regenerate.
2529                 * bfd-in2.h: Regenerate.
2530                 * libbfd.h: Regenerate.
2531
2532 2022-12-17  Indu Bhagat  <indu.bhagat@oracle.com>
2533
2534         sframe: doc: update spec for the mangled-RA bit in FRE
2535         ChangeLog:
2536
2537                 * libsframe/doc/sframe-spec.texi
2538
2539 2022-12-17  Indu Bhagat  <indu.bhagat@oracle.com>
2540
2541         gas: sframe: testsuite: add testcase for .cfi_negate_ra_state
2542         Add a new test to check that .cfi_negate_ra_state on aarch64 is handled
2543         well (a non-empty SFrame section with valid SFrame FREs is generated).
2544
2545         ChangeLog:
2546
2547                 * testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d: New test.
2548                 * testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s: Likewise.
2549                 * testsuite/gas/cfi-sframe/cfi-sframe.exp: Adjust the list
2550                 accordingly.
2551
2552 2022-12-17  Indu Bhagat  <indu.bhagat@oracle.com>
2553
2554         objdump/readelf: sframe: emit marker for FREs with mangled RA
2555         In the textual dump of the SFrame section, when an SFrame FRE recovers a
2556         mangled RA, use string "[s]" in the output to indicate that the return
2557         address is a signed (mangled) one.
2558
2559         ChangeLog:
2560
2561                 * libsframe/sframe-dump.c (dump_sframe_func_with_fres): Postfix
2562                 with "[s]" if RA is signed with authorization code.
2563
2564 2022-12-17  Indu Bhagat  <indu.bhagat@oracle.com>
2565
2566         libsframe: provide new access API for mangled RA bit
2567         include/ChangeLog:
2568
2569                 * sframe-api.h (sframe_fre_get_ra_mangled_p): New declaration.
2570
2571         ChangeLog:
2572
2573                 * libsframe/sframe.c (sframe_get_fre_ra_mangled_p): New
2574                 definition.
2575                 (sframe_fre_get_ra_mangled_p): New static function.
2576
2577 2022-12-17  Indu Bhagat  <indu.bhagat@oracle.com>
2578
2579         gas: sframe: add support for .cfi_negate_ra_state
2580         DW_CFA_AARCH64_negate_ra_state in aarch64 is multiplexed with
2581         DW_CFA_GNU_window_save in the DWARF format.
2582
2583         Remove the common-empty-4 testcase because the generated SFrame section
2584         will not be be empty anymore.  A relevant test will be added in a later
2585         commit.
2586
2587         ChangeLog:
2588
2589                 * gas/gen-sframe.c (sframe_v1_set_fre_info): Add new argument
2590                 for mangled_ra_p.
2591                 (sframe_set_fre_info): Likewise.
2592                 (output_sframe_row_entry): Handle mangled_ra_p.
2593                 (sframe_row_entry_new): Reset mangled_ra_p.
2594                 (sframe_row_entry_initialize): Initialize mangled_ra_p.
2595                 (sframe_xlate_do_gnu_window_save): New definition.
2596                 (sframe_do_cfi_insn): Handle DW_CFA_GNU_window_save.
2597                 * gas/gen-sframe.h (struct sframe_row_entry): New member.
2598                 (struct sframe_version_ops): Add a new argument for
2599                 mangled_ra_p.
2600                 * gas/testsuite/gas/cfi-sframe/cfi-sframe.exp: Remove test.
2601                 * gas/testsuite/gas/cfi-sframe/common-empty-4.d: Removed.
2602                 * gas/testsuite/gas/cfi-sframe/common-empty-4.s: Removed.
2603
2604 2022-12-17  Indu Bhagat  <indu.bhagat@oracle.com>
2605
2606         sframe.h: add support for .cfi_negate_ra_state
2607         Use the last remaining bit in the 'SFrame FRE info' word to store whether
2608         the RA is signed/unsigned with PAC authorization code: this bit is named
2609         as the "mangled RA" bit.  This bit is still unused for x86-64.
2610
2611         The behaviour of the mangled-RA info bit in SFrame format closely
2612         follows the behaviour of DW_CFA_AARCH64_negate_ra_state in DWARF.  During
2613         unwinding, whenever an SFrame FRE with non-zero "mangled RA" bit is
2614         encountered, it means the upper bits of the return address contain Pointer
2615         Authentication code.  The unwinder, hence, must use appropriate means to
2616         restore LR correctly in such cases.
2617
2618         include/ChangeLog:
2619
2620                 * sframe.h (SFRAME_V1_FRE_INFO_UPDATE_MANGLED_RA_P): New macro.
2621                 (SFRAME_V1_FRE_MANGLED_RA_P): Likewise.
2622
2623 2022-12-17  GDB Administrator  <gdbadmin@sourceware.org>
2624
2625         Automatic date update in version.in
2626
2627 2022-12-16  Pedro Alves  <pedro@palves.net>
2628
2629         Delay checking whether /proc/pid/mem is writable (PR gdb/29907)
2630         As of 1bcb0708f229 ("gdb/linux-nat: Check whether /proc/pid/mem is
2631         writable"), GDB checks if /proc/pid/mem is writable.  This is done
2632         early at GDB startup, in order to get a consistent warning, instead of
2633         a warning that depends on whenever GDB writes to inferior memory.
2634
2635         PR gdb/29907 points out that some build systems (like QEMU's,
2636         apparently) may call 'gdb --version' to check GDB's presence & its
2637         version on the system, and that Gentoo's build process has sandboxing
2638         which blocks the /proc/pid/mem access and thus GDB warns, which
2639         results in build fails.
2640
2641         To help with that, this patch delays the /proc/pid/mem check until we
2642         start or attach to an inferior.  Ends up potentially emiting a warning
2643         close where we already emit other ptrace- and /proc- related warnings,
2644         which just Feels Right.
2645
2646         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29907
2647         Change-Id: I5537653ecfbbe76a04ab035e40e59d09b4980763
2648
2649 2022-12-16  Nick Clifton  <nickc@redhat.com>
2650
2651         Fix previous delta to allow for compilation on 32-bit systems
2652
2653 2022-12-16  Tom de Vries  <tdevries@suse.de>
2654
2655         [gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp
2656         Once in a while I run into:
2657         ...
2658         FAIL: gdb.threads/detach-step-over.exp: \
2659           breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \
2660           displaced=off: iter 1: all threads running
2661         ...
2662
2663         In can easily reproduce this by doing:
2664         ...
2665              # Wait a bit, to give time for the threads to hit the
2666              # breakpoint.
2667         -    sleep 1
2668
2669              return true
2670         ...
2671
2672         Fix this by counting the running threads in a loop, effectively allowing 10
2673         seconds (instead of 1) for the threads to start running, but only sleeping if
2674         needed.
2675
2676         Reduces total execution time from 1m27s to 56s.
2677
2678         Tested on x86_64-linux.
2679
2680 2022-12-16  Andrew Burgess  <aburgess@redhat.com>
2681
2682         gdb: fix crash when getting the value of a label symbol
2683         When the source program contains a goto label, it turns out it's
2684         actually pretty hard for a user to find out more about that label.
2685         For example:
2686
2687           (gdb) p some_label
2688           No symbol "some_label" in current context.
2689           (gdb) disassemble some_label
2690           No symbol "some_label" in current context.
2691           (gdb) x/10i some_label
2692           No symbol "some_label" in current context.
2693           (gdb) break some_label
2694           Breakpoint 2 at 0x401135: file /tmp/py-label-symbol-value.c, line 35.
2695
2696         In all cases, some_label is a goto label within the current frame.
2697         Only placing a breakpoint on the label worked.
2698
2699         This all seems a little strange to me, it feels like asking about a
2700         goto label would not be an unreasonable thing for a user to do.
2701
2702         This commit doesn't fix any of the above issues, I mention them just
2703         to provide a little context for why the following issue has probably
2704         not been seen before.
2705
2706         It turns out there is one way a user can access the symbol for a goto
2707         label, through the Python API:
2708
2709           python frame = gdb.selected_frame()
2710           python frame_pc = frame.pc()
2711           python block = gdb.current_progspace().block_for_pc(frame_pc)
2712           python symbol,_ = gdb.lookup_symbol('some_label', block, gdb.SYMBOL_LABEL_DOMAIN)
2713           python print(str(symbol.value()))
2714           ../../src/gdb/findvar.c:204: internal-error: store_typed_address: Assertion `type->is_pointer_or_reference ()' failed.
2715
2716         The problem is that label symbols are created using the
2717         builtin_core_addr type, which is a pure integer type.
2718
2719         When GDB tries to fetch the value of a label symbol then we end up in
2720         findvar.c, in the function language_defn::read_var_value, in the
2721         LOC_LABEL case.  From here store_typed_address is called to store the
2722         address of the label into a value object with builtin_core_addr type.
2723
2724         The problem is that store_typed_address requires that the destination
2725         type be a pointer or reference, which the builtin_core_addr type is
2726         not.
2727
2728         Now it's not clear what type a goto label address should have, but
2729         GCC has an extension that allows users to take the address of a goto
2730         label (using &&), in that case the result is of type 'void *'.
2731
2732         I propose that when we convert the CORE_ADDR value to a GDB value
2733         object, we use builtin_func_ptr type instead of builtin_core_addr,
2734         this means the result will be of type 'void (*) ()'.  The benefit of
2735         this approach is that when gdbarch_address_to_pointer is called the
2736         target type will be correctly identified as a pointer to code, which
2737         should mean any architecture specific adjustments are done correctly.
2738
2739         We can then cast the new value to 'void *' type with a call to
2740         value_cast_pointer, this should not change the values bit
2741         representation, but will just update the type.
2742
2743         After this asking for the value of a label symbol works just fine:
2744
2745           (gdb) python print(str(symbol.value()))
2746           0x401135 <main+35>
2747
2748         And the type is maybe what we'd expect:
2749
2750           (gdb) python print(str(symbol.value().type))
2751           void *
2752
2753 2022-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
2754
2755         gdb: convert linux-osdata.c from buffer to std::string
2756         Replace the use of struct buffer in linux-osdata.c with std::string.
2757         There is no change in the logic, so there should be no user-visible
2758         change.
2759
2760         Change-Id: I27f53165d401650bbd0bebe8ed88221e25545b3f
2761         Approved-By: Pedro Alves <pedro@palves.net>
2762
2763 2022-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
2764
2765         gdbsupport: add string_xml_appendf
2766         Add a version of buffer_xml_printf (defined in gdbsupport/buffer.{c,h})
2767         that appends to an std::string, rather than a struct buffer.  Call it
2768         "string" rather than "buffer" since it operates on an std::string rather
2769         than a buffer.  And call it "appendf" rather than "printf", since it
2770         appends to and does not replace the string's content.  This mirrors
2771         string_appendf.
2772
2773         Place the new version in gdbsupport/xml-utils.h.
2774
2775         The code is a direct copy of buffer_xml_printf.  The old version is
2776         going to disappear at some point, which is why I didn't do any effort to
2777         share code.
2778
2779         Change-Id: I30e030627ab4970fd0b9eba3b7e8cec78fa561ba
2780         Approved-By: Pedro Alves <pedro@palves.net>
2781
2782 2022-12-16  Andrew Burgess  <aburgess@redhat.com>
2783
2784         gdb: clean up some inefficient std::string usage
2785         This commit:
2786
2787           commit 53cf95c3389a3ecd97276d322e4a60fe3396a201
2788           Date:   Wed Dec 14 14:17:44 2022 +0000
2789
2790               gdb: make more use of make_target_connection_string
2791
2792         Introduced a couple of inefficient uses of std::string, both of which
2793         are fixed in this commit.
2794
2795         There should be no user visible changes after this commit.
2796
2797         Approved-By: Simon Marchi <simon.marchi@efficios.com>
2798
2799 2022-12-16  Nick Clifton  <nickc@redhat.com>
2800
2801         Fix a potential illegal memory access when parsing corrupt DWARF information.
2802                 PR 29908
2803                 * dwarf.c (display_debug_addr): Check for corrupt header lengths.
2804
2805 2022-12-16  Jan Vrany  <jan.vrany@labware.com>
2806
2807         gdb/testsuite: add test for Python commands redefining itself
2808         This commit adds a test that creates a Python command that redefines
2809         itself during its execution. This is to test use-after-free in
2810         execute_command ().
2811
2812         This test needs run with ASan enabled in order to fail when it
2813         should.
2814
2815         Approved-By: Simon Marchi <simon.marchi@efficios.com>
2816
2817 2022-12-16  Luis Machado  <luis.machado@arm.com>
2818
2819         [aarch64] Fix removal of non-address bits for PAuth
2820         PR gdb/28947
2821
2822         The address_significant gdbarch setting was introduced as a way to remove
2823         non-address bits from pointers, and it is specified by a constant.  This
2824         constant represents the number of address bits in a pointer.
2825
2826         Right now AArch64 is the only architecture that uses it, and 56 was a
2827         correct option so far.
2828
2829         But if we are using Pointer Authentication (PAuth), we might use up to 2 bytes
2830         from the address space to store the required information.  We could also have
2831         cases where we're using both PAuth and MTE.
2832
2833         We could adjust the constant to 48 to cover those cases, but this doesn't
2834         cover the case where GDB needs to sign-extend kernel addresses after removal
2835         of the non-address bits.
2836
2837         This has worked so far because bit 55 is used to select between kernel-space
2838         and user-space addresses.  But trying to clear a range of bits crossing the
2839         bit 55 boundary requires the hook to be smarter.
2840
2841         The following patch renames the gdbarch hook from significant_addr_bit to
2842         remove_non_address_bits and passes a pointer as opposed to the number of
2843         bits.  The hook is now responsible for removing the required non-address bits
2844         and sign-extending the address if needed.
2845
2846         While at it, make GDB and GDBServer share some more code for aarch64 and add a
2847         new arch-specific testcase gdb.arch/aarch64-non-address-bits.exp.
2848
2849         Bug-url: https://sourceware.org/bugzilla/show_bug.cgi?id=28947
2850
2851         Approved-By: Simon Marchi <simon.marchi@efficios.com>
2852
2853 2022-12-16  Jan Beulich  <jbeulich@suse.com>
2854
2855         gas: restore Dwarf info generation after macro diagnostic adjustments
2856         While 6fdb723799e2 ("gas: re-work line number tracking for macros and
2857         their expansions") was meant to leave generated Dwarf as is, it really
2858         didn't (and the testcase intended to catch that wasn't covering the case
2859         which broke). Its adjustment to buffer_and_nest() didn't go far enough,
2860         leading to the "linefile" directive inserted at the top to also be
2861         processed later in the PR gas/16908 workaround (which clearly isn't
2862         intended - it's being put there for processing during macro expansion
2863         only). That unnoticed flaw in turn led me to work around it by a
2864         (suspicious to me already at the time) conditional in as_where().
2865
2866         x86: change representation of extension opcode
2867         Having a "None" field in the vast majority of entries is needlessly
2868         cluttering the overall table. Instead of this being a separate field,
2869         use a representation matching that of Intel SDM and AMD PM for the main
2870         use of the field: Append the value after a / as the separator.
2871
2872 2022-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
2873
2874         gdbsupport: change xml_escape_text_append's parameter from pointer to reference
2875         The passed in string can't be nullptr, it makes more sense to pass in a
2876         reference.
2877
2878         Change-Id: Idc8bd38abe1d6d9b44aa227d7856956848c233b3
2879
2880 2022-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
2881
2882         gdb: remove static buffer in command_line_input
2883         [I sent this earlier today, but I don't see it in the archives.
2884         Resending it through a different computer / SMTP.]
2885
2886         The use of the static buffer in command_line_input is becoming
2887         problematic, as explained here [1].  In short, with this patch [2] that
2888         attempt to fix a post-hook bug, when running gdb.base/commands.exp, we
2889         hit a case where we read a "define" command line from a script file
2890         using command_command_line_input.  The command line is stored in
2891         command_line_input's static buffer.  Inside the define command's
2892         execution, we read the lines inside the define using command_line_input,
2893         which overwrites the define command, in command_line_input's static
2894         buffer.  After the execution of the define command, execute_command does
2895         a command look up to see if a post-hook is registered.  For that, it
2896         uses a now stale pointer that used to point to the define command, in
2897         the static buffer, causing a use-after-free.  Note that the pointer in
2898         execute_command points to the dynamically-allocated buffer help by the
2899         static buffer in command_line_input, not to the static object itself,
2900         hence why we see a use-after-free.
2901
2902         Fix that by removing the static buffer.  I initially changed
2903         command_line_input and other related functions to return an std::string,
2904         which is the obvious but naive solution.  The thing is that some callees
2905         don't need to return an allocated string, so this this an unnecessary
2906         pessimization.  I changed it to passing in a reference to an std::string
2907         buffer, which the callee can use if it needs to return
2908         dynamically-allocated content.  It fills the buffer and returns a
2909         pointers to the C string inside.  The callees that don't need to return
2910         dynamically-allocated content simply don't use it.
2911
2912         So, it started with modifying command_line_input as described above, all
2913         the other changes derive directly from that.
2914
2915         One slightly shady thing is in handle_line_of_input, where we now pass a
2916         pointer to an std::string's internal buffer to readline's history_value
2917         function, which takes a `char *`.  I'm pretty sure that this function
2918         does not modify the input string, because I was able to change it (with
2919         enough massaging) to take a `const char *`.
2920
2921         A subtle change is that we now clear a UI's line buffer using a
2922         SCOPE_EXIT in command_line_handler, after executing the command.
2923         This was previously done by this line in handle_line_of_input:
2924
2925           /* We have a complete command line now.  Prepare for the next
2926              command, but leave ownership of memory to the buffer .  */
2927           cmd_line_buffer->used_size = 0;
2928
2929         I think the new way is clearer.
2930
2931         [1] https://inbox.sourceware.org/gdb-patches/becb8438-81ef-8ad8-cc42-fcbfaea8cddd@simark.ca/
2932         [2] https://inbox.sourceware.org/gdb-patches/20221213112241.621889-1-jan.vrany@labware.com/
2933
2934         Change-Id: I8fc89b1c69870c7fc7ad9c1705724bd493596300
2935         Reviewed-By: Tom Tromey <tom@tromey.com>
2936
2937 2022-12-16  GDB Administrator  <gdbadmin@sourceware.org>
2938
2939         Automatic date update in version.in
2940
2941 2022-12-15  Indu Bhagat  <indu.bhagat@oracle.com>
2942
2943         libsframe asan: avoid generating misaligned loads
2944         There are two places where unaligned loads were seen on aarch64:
2945           - #1. access to the SFrame FRE stack offsets in the in-memory
2946             representation/abstraction provided by libsframe.
2947           - #2. access to the SFrame FRE start address in the on-disk representation
2948             of the frame row entry.
2949
2950         For #1, we can fix this by reordering the struct members of
2951         sframe_frame_row_entry in libsframe/sframe-api.h.
2952
2953         For #2, we need to default to using memcpy instead, and copy out the bytes
2954         to a location for output.
2955
2956         SFrame format is an unaligned on-disk format. As such, there are other blobs
2957         of memory in the on-disk SFrame FRE that are on not on their natural
2958         boundaries.  But that does not pose further problems yet, because the users
2959         are provided access to the on-disk SFrame FRE data via libsframe's
2960         sframe_frame_row_entry, the latter has its' struct members aligned on their
2961         respective natural boundaries (and initialized using memcpy).
2962
2963         PR 29856 libsframe asan: load misaligned at sframe.c:516
2964
2965         ChangeLog:
2966
2967                 PR libsframe/29856
2968                 * bfd/elf64-x86-64.c: Adjust as the struct members have been
2969                 reordered.
2970                 * libsframe/sframe.c (sframe_decode_fre_start_address): Use
2971                 memcpy to perform 16-bit/32-bit reads.
2972                 * libsframe/testsuite/libsframe.encode/encode-1.c: Adjust as the
2973                 struct members have been reordered.
2974
2975         include/ChangeLog:
2976
2977                 PR libsframe/29856
2978                 * sframe-api.h: Reorder fre_offsets for natural alignment.
2979
2980 2022-12-15  Simon Marchi  <simon.marchi@polymtl.ca>
2981
2982         gdb/testsuite: don't delete command files in gdb.base/commands.exp
2983         Don't delete the runtime-generated command files.  This makes it easier
2984         to reproduce tests by hand.
2985
2986         Change-Id: I4e53484eea216512f1c5d7dfcb5c464b36950946
2987         Approved-By: Tom Tromey <tom@tromey.com>
2988
2989 2022-12-15  Tom Tromey  <tromey@adacore.com>
2990
2991         Move streq and compare_cstrings to gdbsupport
2992         It seems to me that streq and compare_cstrings belong near the other
2993         string utility functions in common-utils.h; and furthermore that streq
2994         ought to be inlined.  This patch makes this change.
2995
2996         Approved-By: Simon Marchi <simon.marchi@efficios.com>
2997
2998 2022-12-15  Tom Tromey  <tromey@adacore.com>
2999
3000         Remove subset_compare
3001         I stumbled across subset_compare today, and after looking at the
3002         callers I realized it could be removed and replaced with calls to
3003         startswith.
3004
3005         Approved-By: Simon Marchi <simon.marchi@efficios.com>
3006
3007 2022-12-15  Andrew Burgess  <aburgess@redhat.com>
3008
3009         gdb: use gdb_assert not internal_error
3010         Spotted a couple of places in findvar.c where we use:
3011
3012           if ( ! CONDITION )
3013             internal_error ("...");
3014
3015         this commit changes these to be:
3016
3017           gdb_assert ( CONDITION );
3018
3019         which I think is better.
3020
3021         Unless we happen to hit the internal_error calls (which was bad) there
3022         should be no user visible changes after this commit.
3023
3024 2022-12-15  Andrew Burgess  <aburgess@redhat.com>
3025
3026         gdb: some int to bool conversion in remote-sim.c
3027         Some obvious int to bool conversion in remote-sim.c, there should be
3028         no user visible changes after this commit.
3029
3030 2022-12-15  Andrew Burgess  <aburgess@redhat.com>
3031
3032         gdb: make more use of make_target_connection_string
3033         I noticed that we have a function make_target_connection_string which
3034         wraps all the logic for creating a string that describes a target
3035         connection - but in some places we are not calling this function,
3036         instead we duplicate the function's logic.
3037
3038         This commit cleans this up, and calls make_target_connection_string
3039         where possible.
3040
3041         There should be no user visible changes after this commit.
3042
3043 2022-12-15  Andrew Burgess  <aburgess@redhat.com>
3044
3045         gdb: int to bool conversion in tracefile.c
3046         Some obvious int to bool conversion in tracefile.c.
3047
3048         Should be no user visible changes after this commit.
3049
3050 2022-12-15  Tom de Vries  <tdevries@suse.de>
3051
3052         [gdb/testsuite] Fix gdb.base/condbreak-multi-context.exp with gcc 4.8.5
3053         With gcc 4.8.5, I run into:
3054         ...
3055         Running gdb.base/condbreak-multi-context.exp ...
3056         gdb compile failed, condbreak-multi-context.cc:21:11: warning: non-static \
3057           data member initializers only available with -std=c++11 or -std=gnu++11 \
3058           [enabled by default]
3059            int b = 20;
3060                    ^
3061         ...
3062
3063         Fix this by making it a static const.
3064
3065         Tested on x86_64-linux, with gcc 4.8.5, 7.5.0 and clang 13.0.1.
3066
3067 2022-12-15  GDB Administrator  <gdbadmin@sourceware.org>
3068
3069         Automatic date update in version.in
3070
3071 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3072
3073         gdb/maint: add core file name to 'maint info program-spaces' output
3074         Each program space can have an associated core file.  Include this
3075         information in the output of 'maint info program-spaces'.
3076
3077 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3078
3079         gdb: ensure all targets are popped before an inferior is destructed
3080         Now that the inferiors target_stack automatically manages target
3081         reference counts, we might think that we don't need to unpush targets
3082         when an inferior is deleted...
3083
3084         ...unfortunately that is not the case.  The inferior::unpush function
3085         can do some work depending on the type of target, so it is important
3086         that we still pass through this function.
3087
3088         To ensure that this is the case, in this commit I've added an assert
3089         to inferior::~inferior that ensures the inferior's target_stack is
3090         empty (except for the ever present dummy_target).
3091
3092         I've then added a pop_all_targets call to delete_inferior, otherwise
3093         the new assert will fire in, e.g. the gdb.python/py-inferior.exp test.
3094
3095 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3096
3097         gdb: remove the pop_all_targets (and friends) global functions
3098         This commit removes the global functions pop_all_targets,
3099         pop_all_targets_above, and pop_all_targets_at_and_above, and makes
3100         them methods on the inferior class.
3101
3102         As the pop_all_targets functions will unpush each target, which
3103         decrements the targets reference count, it is possible that the target
3104         might be closed.
3105
3106         Right now, closing a target, in some cases, depends on the current
3107         inferior being set correctly, that is, to the inferior from which the
3108         target was popped.
3109
3110         To facilitate this I have used switch_to_inferior_no_thread within the
3111         new methods.  Previously it was the responsibility of the caller to
3112         ensure that the correct inferior was selected.
3113
3114         In a couple of places (event-top.c and top.c) I have been able to
3115         remove a previous switch_to_inferior_no_thread call.
3116
3117         In remote_unpush_target (remote.c) I have left the
3118         switch_to_inferior_no_thread call as it is required for the
3119         generic_mourn_inferior call.
3120
3121 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3122
3123         gdb: remove decref_target
3124         The decref_target function is not really needed.  Calling
3125         target_ops::decref will just redirect to decref_target anyway, so why
3126         not just rename decref_target to target_ops::decref?
3127
3128         That's what this commit does.
3129
3130         It's not exactly renaming to target_ops::decref, because the decref
3131         functionality is handled by a policy class, so the new name is now
3132         target_ops_ref_policy::decref.
3133
3134         There should be no user visible change after this commit.
3135
3136 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3137
3138         gdb: have target_stack automate reference count handling
3139         This commit changes the target_stack class from using a C style array
3140         of 'target_ops *' to using a C++ std::array<target_ops_ref, ...>.  The
3141         benefit of this change is that some of the reference counting of
3142         target_ops objects is now done automatically.
3143
3144         This commit fixes a crash in gdb.python/py-inferior.exp where GDB
3145         crashes at exit, leaving a core file behind.
3146
3147         The crash occurs in connpy_connection_dealloc, and is actually
3148         triggered by this assert:
3149
3150         gdb_assert (conn_obj->target == nullptr);
3151
3152         Now a little aside...
3153
3154             ... the assert is never actually printed, instead GDB crashes due
3155             to calling a pure virtual function.  The backtrace at the point of
3156             crash looks like this:
3157
3158               #7  0x00007fef7e2cf747 in std::terminate() () from /lib64/libstdc++.so.6
3159               #8  0x00007fef7e2d0515 in __cxa_pure_virtual () from /lib64/libstdc++.so.6
3160               #9  0x0000000000de334d in target_stack::find_beneath (this=0x4934d78, t=0x2bda270 <the_dummy_target>) at ../../s>
3161               #10 0x0000000000df4380 in inferior::find_target_beneath (this=0x4934b50, t=0x2bda270 <the_dummy_target>) at ../.>
3162               #11 0x0000000000de2381 in target_ops::beneath (this=0x2bda270 <the_dummy_target>) at ../../src/gdb/target.c:3047
3163               #12 0x0000000000de68aa in target_ops::supports_terminal_ours (this=0x2bda270 <the_dummy_target>) at ../../src/gd>
3164               #13 0x0000000000dde6b9 in target_supports_terminal_ours () at ../../src/gdb/target.c:1112
3165               #14 0x0000000000ee55f1 in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_li>
3166
3167             Notice in frame #12 we called target_ops::supports_terminal_ours,
3168             however, this is the_dummy_target, which is of type dummy_target,
3169             and so we should have called dummy_target::supports_terminal_ours.
3170             I believe the reason we ended up in the wrong implementation of
3171             supports_terminal_ours (which is a virtual function) is because we
3172             made the call during GDB's shut-down, and, I suspect, the vtables
3173             were in a weird state.
3174
3175             Anyway, the point of this patch is not to fix GDB's ability to
3176             print an assert during exit, but to address the root cause of the
3177             assert.  With that aside out of the way, we can return to the main
3178             story...
3179
3180         Connections are represented in Python with gdb.TargetConnection
3181         objects (or its sub-classes).  The assert in question confirms that
3182         when a gdb.TargetConnection is deallocated, the underlying GDB
3183         connection has itself been removed from GDB.  If this is not true then
3184         we risk creating multiple different gdb.TargetConnection objects for
3185         the same connection, which would be bad.
3186
3187         To ensure that we have one gdb.TargetConnection object for each
3188         connection, the all_connection_objects map exists, this maps the
3189         process_stratum_target object (the connection) to the
3190         gdb.TargetConnection object that represents the connection.
3191
3192         When a connection is removed in GDB the connection_removed observer
3193         fires, which we catch with connpy_connection_removed, this function
3194         then sets conn_obj->target to nullptr, and removes the corresponding
3195         entry from the all_connection_objects map.
3196
3197         The first issue here is that connpy_connection_dealloc is being called
3198         as part of GDB's exit code, which is run after the Python interpreter
3199         has been shut down.  The connpy_connection_dealloc function is used to
3200         deallocate the gdb.TargetConnection Python object.  Surely it is
3201         wrong for us to be deallocating Python objects after the interpreter
3202         has been shut down.
3203
3204         The reason why connpy_connection_dealloc is called during GDB's exit
3205         is that the global all_connection_objects map is still holding a
3206         reference to the gdb.TargetConnection object.  When the map is
3207         destroyed during GDB's exit, the gdb.TargetConnection objects within
3208         the map can finally be deallocated.
3209
3210         The reason why all_connection_objects has contents when GDB exits, and
3211         the reason the assert fires, is that, when GDB exits, there are still
3212         some connections that have not yet been removed from GDB, that is,
3213         they have a non-zero reference count.
3214
3215         If we take a look at quit_force (top.c) you can see that, for each
3216         inferior, we call pop_all_targets before we (later in the function)
3217         call do_final_cleanups.  It is the do_final_cleanups call that is
3218         responsible for shutting down the Python interpreter.  The
3219         pop_all_targets calls should, in theory, cause all the connections to
3220         be removed from GDB.
3221
3222         That this isn't working indicates that some targets have a non-zero
3223         reference count even after this final pop_all_targets call, and
3224         indeed, when I debug GDB, that is what I see.
3225
3226         I tracked the problem down to delete_inferior where we do some house
3227         keeping, and then delete the inferior object, which calls
3228         inferior::~inferior.
3229
3230         In neither delete_inferior or inferior::~inferior do we call
3231         pop_all_targets, and it is this missing call that means we leak some
3232         references to the target_ops objects on the inferior's target_stack.
3233
3234         In this commit I will provide a partial fix for the problem.  I say
3235         partial fix, but this will actually be enough to resolve the crash.
3236         In a later commit I will provide the final part of the fix.
3237
3238         As mentioned at the start of the commit message, this commit changes
3239         the m_stack in target_stack to hold target_ops_ref objects.  This
3240         means that when inferior::~inferior is called, and m_stack is
3241         released, we automatically decrement the target_ops reference count.
3242         With this change in place we no longer leak any references, and now,
3243         in quit_force the final pop_all_targets calls will release the final
3244         references.  This means that the targets will be correctly closed at
3245         this point, which means the connections will be removed from GDB and
3246         the Python objects deallocated before the Python interpreter shuts
3247         down.
3248
3249         There's a slight oddity in target_stack::unpush, where we std::move
3250         the reference out of m_stack like this:
3251
3252           auto ref = std::move (m_stack[stratum]);
3253
3254         the `ref' isn't used explicitly, but it serves to hold the
3255         target_ops_ref until the end of the scope while allowing the m_stack
3256         entry to be reset back to nullptr.  The alternative would be to
3257         directly set the m_stack entry to nullptr, like this:
3258
3259           m_stack[stratum] = nullptr;
3260
3261         The problem here is that when we set the m_stack entry to nullptr we
3262         first decrement the target_ops reference count, and then set the array
3263         entry to nullptr.
3264
3265         If the decrement means that the target_ops object reaches a zero
3266         reference count then the target_ops object will be closed by calling
3267         target_close.  In target_close we ensure that the target being closed
3268         is not in any inferiors target_stack.
3269
3270         As we decrement before clearing, then this check in target_close will
3271         fail, and an assert will trigger.
3272
3273         By using std::move to move the reference out of m_stack, this clears
3274         the m_stack entry, meaning the inferior no longer contains the
3275         target_ops in its target_stack.  Now when the REF object goes out of
3276         scope and the reference count is decremented, target_close can run
3277         successfully.
3278
3279         I've made use of the Python connection_removed listener API to add a
3280         test for this issue.  The test installs a listener and then causes
3281         delete_inferior to be called, we can then see that the connection is
3282         then correctly removed (because the listener triggers).
3283
3284 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3285
3286         gdb/remote: remove some manual reference count handling
3287         While working on some other target_ops reference count related code, I
3288         spotted that in remote.c we do some manual reference count handling,
3289         i.e. we call target_ops::incref and decref_target (which wraps
3290         target_ops::decref).
3291
3292         I think it would be better to make use of gdb::ref_ptr to automate the
3293         reference count management.
3294
3295         So, this commit updates scoped_mark_target_starting in two ways,
3296         first, I use gdb::ref_ptr to handle the reference counts.  Then,
3297         instead of using the scoped_mark_target_starting constructor and
3298         destructor to set and reset the starting_up flag, I now use a
3299         scoped_restore_tmpl object to set and restore the flag.
3300
3301         The above changes mean that the scoped_mark_target_starting destructor
3302         can be completely removed, and the constructor body is now empty.
3303
3304         I've also fixed a typo in the class comment.
3305
3306         The only change in behaviour after this commit is that previously we
3307         didn't care what the value of starting_up was, we just set it to true
3308         in the constructor and false in the destructor.
3309
3310         Now, I assert that the flag is initially false, then set the flag true
3311         when the scoped_mark_target_starting is created.
3312
3313         As the starting_up flag is initialized to false then, for the assert
3314         to fire, we would need to recursively enter
3315         remote_target::start_remote_1, which I don't think is something we
3316         should be doing, so I think the new assert is an improvement.
3317
3318 2022-12-14  Alan Modra  <amodra@gmail.com>
3319
3320         Re: ld, gold: remove support for -z bndplt (MPX prefix)
3321         Don't attempt to run gold tests with -z bndplt
3322
3323                 * testsuite/Makefile.am (exception_x86_64_bnd_test, bnd_plt_1.sh),
3324                 (bnd_ifunc_1.sh, bnd_ifunc_2.sh): Delete rules.
3325                 * testsuite/Makefile.in: Regenerate.
3326                 * testsuite/bnd_ifunc_1.s: Delete.
3327                 * testsuite/bnd_ifunc_1.sh: Delete.
3328                 * testsuite/bnd_ifunc_2.s: Delete.
3329                 * testsuite/bnd_ifunc_2.sh: Delete.
3330                 * testsuite/bnd_plt_1.s: Delete.
3331                 * testsuite/bnd_plt_1.sh: Delete.
3332
3333 2022-12-14  Alan Modra  <amodra@gmail.com>
3334
3335         asan: buffer overflow in sh_reloc
3336                 * coff-sh.c (sh_reloc): Use bfd_reloc_offset_in_range.
3337
3338 2022-12-14  Alan Modra  <amodra@gmail.com>
3339
3340         Fix haiku ld dependencies
3341         I noticed after commit 8ad93045ed, "ld, gold: remove support for -z
3342         bndplt (MPX prefix)", that some of my builds were failing with
3343
3344         eelf_x86_64_haiku.c:650:9: error: no member named 'bndplt' in 'struct elf_linker_x86_params'
3345                 params.bndplt = true;
3346                 ~~~~~~ ^
3347
3348                 * emulparams/aarch64haiku.sh: Use "source_sh" rather than ".".
3349                 * emulparams/armelf_haiku.sh: Likewise.
3350                 * emulparams/elf32ppchaiku.sh: Likewise.
3351                 * emulparams/elf_mipsel_haiku.sh: Likewise.
3352                 * emulparams/elf_x86_64_haiku.sh: Likewise.
3353
3354 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3355
3356         gdb: add SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT
3357         After the previous commit converted symbol-lookup debug to use the new
3358         debug scheme, this commit adds SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT.
3359
3360         The previous commit didn't add SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT
3361         because symbol-lookup debug is controlled by an 'unsigned int' rather
3362         than a 'bool' control variable, we use the numeric value to offer
3363         different levels of verbosity for symbol-lookup debug.
3364
3365         The *_SCOPED_DEBUG_ENTER_EXIT mechanism currently relies on capturing
3366         a reference to the bool control variable, and evaluating the variable
3367         both on entry, and at exit, this is done in the scoped_debug_start_end
3368         class (see gdbsupport/common-debug.h).
3369
3370         This commit templates scoped_debug_start_end so that the class can
3371         accept either a 'bool &' or an invokable object, e.g. a lambda
3372         function, or a function pointer.
3373
3374         The existing scoped_debug_start_end and scoped_debug_enter_exit macros
3375         in common-debug.h are updated to support scoped_debug_enter_exit being
3376         templated, however, nothing outside of common-debug.h needs to change.
3377
3378         I've then added SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT in symtab.h, and
3379         added a couple of token uses in symtab.c.  I didn't want to add too
3380         much in this first commit, this is really about updating
3381         common-debug.h to support this new functionality.
3382
3383         Within symtab.h I created a couple of global functions that can be
3384         used to query the status of the symbol_lookup_debug control variable,
3385         these functions are then used within the two existing macros:
3386
3387           symbol_lookup_debug_printf
3388           symbol_lookup_debug_printf_v
3389
3390         and also in the new SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT macro.
3391
3392 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3393
3394         gdb: convert 'set debug symbol-lookup' to new debug printing scheme
3395         Convert the implementation of 'set debug symbol-lookup' to the new
3396         debug printing scheme.
3397
3398         In a few places I've updated the debug output to remove places where
3399         the printed debug message included the function name, the new debug
3400         scheme already adds that, but I haven't done all the possible updates.
3401
3402 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3403
3404         gdb/testsuite: new test for recent dwarf reader issue
3405         This commit provides a test for this commit:
3406
3407           commit 55fc1623f942fba10362cb199f9356d75ca5835b
3408           Date:   Thu Nov 3 13:49:17 2022 -0600
3409
3410               Add name canonicalization for C
3411
3412         Which resolves PR gdb/29105.  My reason for writing this test was a
3413         desire to better understand the above commit, my process was to study
3414         the commit until I thought I understood it, then write a test to
3415         expose the issue.  As the original commit didn't have a test, I
3416         thought it wouldn't hurt to commit this upstream.
3417
3418         The problem tested for here is already described in the above commit,
3419         but I'll give a brief description here.  This description describes
3420         GDB prior to the above commit:
3421
3422           - Builtin types are added to GDB using their canonical name,
3423             e.g. "short", not "signed short",
3424
3425           - When the user does something like 'p sizeof(short)', then this is
3426             handled in c-exp.y, and results in a call to lookup_signed_type
3427             for the name "int".  The "int" here is actually being looked up as
3428             the type for the result of the 'sizeof' expression,
3429
3430           - In lookup_signed_type GDB first adds a 'signed' and looks for that
3431             type, so in this case 'signed int', and, if that lookup fails, GDB
3432             then looks up 'int',
3433
3434           - The problem is that 'signed int' is not the canonical name for a
3435             signed int, so no builtin type with that name will be found, GDB
3436             will then go to each object file in turn looking for a matching
3437             type,
3438
3439           - When checking each object file, GDB will first check the partial
3440             symtab to see if the full symtab should be expanded or not.
3441             Remember, at this point GDB is looking for 'signed int', there
3442             will be no partial symbols with that name, so GDB will not expand
3443             anything,
3444
3445           - However, GDB checks each partial symbol using multiple languages,
3446             not just the current language (C in this case), so, when GDB
3447             checks using the C++ language, the symbol name is first
3448             canonicalized (the code that does this can be found
3449             lookup_name_info::language_lookup_name).  As the canonical form of
3450             'signed int' is just 'int', GDB then looks for any symbols with
3451             the name 'int', most partial symtabs will contain such a symbol,
3452             so GDB ends up expanding pretty much every symtab.
3453
3454         The above commit fixes this by avoiding the use of non-canonical names
3455         with C, now the initial builtin type lookup will succeed, and GDB
3456         never even considers whether to expand any additional symtabs.
3457
3458         The test case creates a library that includes char, short, int, and
3459         long types, and a test program that links against the library.
3460
3461         In the test script we start the inferior, but don't allow it to
3462         progress far enough that the debug information for the library has
3463         been fully expanded yet.
3464
3465         Then we evaluate some 'sizeof(TYPE)' expressions.
3466
3467         In the buggy version of GDB this would cause the debug information
3468         for the library to be fully expanded, while in the fixed version of
3469         GDB this will not be the case.
3470
3471         We use 'info sources' to determine if the debug information has been
3472         fully expanded or not.
3473
3474         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29105
3475
3476 2022-12-14  Andrew Burgess  <aburgess@redhat.com>
3477
3478         gdb/testsuite: fix readnow detection
3479         The following commit broke the readnow detection in the testsuite:
3480
3481           commit dfaa040b440084dd73ebd359326752d5f44fc02c
3482           Date:   Mon Mar 29 18:31:31 2021 -0600
3483
3484               Remove some "OBJF_READNOW" code from dwarf2_debug_names_index
3485
3486         The testsuite checks if GDB was started with the -readnow flag by
3487         using the 'maintenance print objfiles' command, and looking for the
3488         string 'faked for "readnow"' in the output.  This is implemented in
3489         two helper procs `readnow` (gdb.exp) and `mi_readnow` (mi-support.exp).
3490
3491         The following tests all currently depend on this detection:
3492
3493           gdb.base/maint.exp
3494           gdb.cp/nsalias.exp
3495           gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
3496           gdb.dwarf2/dw2-stack-boundary.exp
3497           gdb.dwarf2/dw2-zero-range.exp
3498           gdb.dwarf2/gdb-index-nodebug.exp
3499           gdb.mi/mi-info-sources.exp
3500           gdb.python/py-symbol.exp
3501           gdb.rust/traits.exp
3502
3503         The following test also includes detection of 'readnow', but does the
3504         detection itself by checking $::GDBFLAGS for the readnow flag:
3505
3506           gdb.opt/break-on-_exit.exp
3507
3508         The above commit removed from GDB the code that produced the 'faked
3509         for "readnow"' string, as a consequence the testsuite can no longer
3510         correctly spot when readnow is in use, and many of the above tests
3511         will fail (at least partially).
3512
3513         When looking at the above tests, I noticed that gdb.rust/traits.exp
3514         does call `readnow`, but doesn't actually use the result, so I've
3515         removed the readnow call, this simplifies the next part of this patch
3516         as gdb.rust/traits.exp was the only place an extra regexp was passed
3517         to the readnow call.
3518
3519         Next I have rewritten `readnow` to check the $GDBFLAGS for the
3520         -readnow flag, and removed the `maintenance print objfiles` check.  At
3521         least for all the tests above, when using the readnow board, this is
3522         good enough to get everything passing again.
3523
3524         For the `mi_readnow` proc, I changed this to just call `readnow` from
3525         gdb.exp, I left the mi_readnow name in place - in the future it might
3526         be the case that we want to do some different checks here.
3527
3528         Finally, I updated gdb.opt/break-on-_exit.exp to call the `readnow`
3529         proc.
3530
3531         With these changes, all of the tests listed above now pass correctly
3532         when using the readnow board.
3533
3534 2022-12-14  Li Xu  <xuli1@eswincomputing.com>
3535
3536         RISC-V: Add string length check for operands in AS
3537         The current AS accepts invalid operands due to miss of operands length check.
3538         For example, "e6" is an invalid operand in (vsetvli a0, a1, e6, mf8, tu, ma),
3539         but it's still accepted by assembler.  In detail, the condition check "strncmp
3540         (array[i], *s, len) == 0" in arg_lookup function passes with "strncmp ("e64",
3541         "e6", 2)" in the case above.  So the generated encoding is same as that of
3542         (vsetvli a0, a1, e64, mf8, tu, ma).
3543
3544         This patch fixes issue above by prompting an error in such case and also adds
3545         a new testcase.
3546
3547         gas/ChangeLog:
3548
3549                 * config/tc-riscv.c (arg_lookup): Add string length check for operands.
3550                 * testsuite/gas/riscv/vector-insns-fail-vsew.d: New testcase for an illegal vsew.
3551                 * testsuite/gas/riscv/vector-insns-fail-vsew.l: Likewise.
3552                 * testsuite/gas/riscv/vector-insns-fail-vsew.s: Likewise.
3553
3554 2022-12-14  Jan Beulich  <jbeulich@suse.com>
3555
3556         x86: adjust type checking constructs
3557         As Alan points out, ASAN takes issue with these constructs, for
3558         current_templates being NULL. Wrap them in sizeof(), so the expressions
3559         aren't actually evaluated.
3560
3561 2022-12-14  Martin Liska  <mliska@suse.cz>
3562
3563         ld, gold: remove support for -z bndplt (MPX prefix)
3564         bfd/ChangeLog:
3565
3566                 * elf-linker-x86.h (struct elf_linker_x86_params): Remove
3567                 bndplt.
3568                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Ignore
3569                 R_X86_64_PLT32_BND.
3570                 (elf_x86_64_relocate_section): Similarly here.
3571                 (elf_x86_64_link_setup_gnu_properties): Ignore bndplt.
3572                 * elfxx-x86.c: Likewise.
3573                 * elfxx-x86.h: Likewise.
3574
3575         gold/ChangeLog:
3576
3577                 * NEWS: Document -z bndplt.
3578                 * options.h (class General_options): Remove bndplt option.
3579                 * x86_64.cc (class Output_data_plt_x86_64_bnd): Remove.
3580                 (Target_x86_64::do_make_data_plt): Do not use
3581                 Output_data_plt_x86_64_bnd.
3582                 (Target_x86_64::Scan::get_reference_flags): Likewise.
3583                 (Target_x86_64::Scan::check_non_pic): Likewise.
3584                 (Target_x86_64::Scan::local): Likewise.
3585                 (Target_x86_64::Scan::global): Likewise.
3586
3587         ld/ChangeLog:
3588
3589                 * NEWS: Document -z bndplt.
3590                 * emulparams/elf_x86_64.sh: Remove bndplt option.
3591                 * ld.texi: Likewise.
3592                 * testsuite/ld-x86-64/x86-64.exp:
3593                 * testsuite/ld-x86-64/bnd-branch-1-now.d: Removed.
3594                 * testsuite/ld-x86-64/bnd-branch-1.d: Removed.
3595                 * testsuite/ld-x86-64/bnd-branch-1.s: Removed.
3596                 * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Removed.
3597                 * testsuite/ld-x86-64/bnd-ifunc-1.d: Removed.
3598                 * testsuite/ld-x86-64/bnd-ifunc-1.s: Removed.
3599                 * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Removed.
3600                 * testsuite/ld-x86-64/bnd-ifunc-2.d: Removed.
3601                 * testsuite/ld-x86-64/bnd-ifunc-2.s: Removed.
3602                 * testsuite/ld-x86-64/bnd-plt-1-now.d: Removed.
3603                 * testsuite/ld-x86-64/bnd-plt-1.d: Removed.
3604                 * testsuite/ld-x86-64/mpx.exp: Removed.
3605                 * testsuite/ld-x86-64/mpx1.out: Removed.
3606                 * testsuite/ld-x86-64/mpx1a.c: Removed.
3607                 * testsuite/ld-x86-64/mpx1a.rd: Removed.
3608                 * testsuite/ld-x86-64/mpx1b.c: Removed.
3609                 * testsuite/ld-x86-64/mpx1c.c: Removed.
3610                 * testsuite/ld-x86-64/mpx1c.rd: Removed.
3611                 * testsuite/ld-x86-64/mpx2.out: Removed.
3612                 * testsuite/ld-x86-64/mpx2a.c: Removed.
3613                 * testsuite/ld-x86-64/mpx2a.rd: Removed.
3614                 * testsuite/ld-x86-64/mpx2b.c: Removed.
3615                 * testsuite/ld-x86-64/mpx2c.c: Removed.
3616                 * testsuite/ld-x86-64/mpx2c.rd: Removed.
3617                 * testsuite/ld-x86-64/mpx3.dd: Removed.
3618                 * testsuite/ld-x86-64/mpx3a.s: Removed.
3619                 * testsuite/ld-x86-64/mpx3b.s: Removed.
3620                 * testsuite/ld-x86-64/mpx3n.dd: Removed.
3621                 * testsuite/ld-x86-64/mpx4.dd: Removed.
3622                 * testsuite/ld-x86-64/mpx4a.s: Removed.
3623                 * testsuite/ld-x86-64/mpx4b.s: Removed.
3624                 * testsuite/ld-x86-64/mpx4n.dd: Removed.
3625                 * testsuite/ld-x86-64/pr20800a.S: Removed.
3626                 * testsuite/ld-x86-64/pr20800b.S: Removed.
3627                 * testsuite/ld-x86-64/pr21038a-now.d: Removed.
3628                 * testsuite/ld-x86-64/pr21038a.d: Removed.
3629                 * testsuite/ld-x86-64/pr21038a.s: Removed.
3630                 * testsuite/ld-x86-64/pr21038b-now.d: Removed.
3631                 * testsuite/ld-x86-64/pr21038b.d: Removed.
3632                 * testsuite/ld-x86-64/pr21038b.s: Removed.
3633                 * testsuite/ld-x86-64/pr21038c-now.d: Removed.
3634                 * testsuite/ld-x86-64/pr21038c.d: Removed.
3635                 * testsuite/ld-x86-64/pr21038c.s: Removed.
3636
3637 2022-12-14  Alan Modra  <amodra@gmail.com>
3638
3639         asan: signed integer overflow in display_debug_frames
3640                 * dwarf.c (struct Frame_Chunk): Make col_offset an int64_t.
3641                 Adjust all places allocating col_offset and col_type to use
3642                 the size of the array element rather than the size of a type.
3643                 (frame_display_row): Adjust printing of col_offset.
3644                 (display_debug_frames): Factor out multiplication by
3645                 code_factor and data_factor.  Avoid signed overflow.  Use
3646                 64-bit variables.
3647
3648 2022-12-14  Alan Modra  <amodra@gmail.com>
3649
3650         Don't access freed memory printing objcopy warning
3651         abfd->filename will be freed if bfd_close gets far enough to delete
3652         the bfd.  It's possible to have an error from fclose at this point.
3653
3654                 * objcopy.c (copy_archive): Dup filename before closing bfd for
3655                 potential use in bfd_nonfatal_message.
3656
3657 2022-12-14  GDB Administrator  <gdbadmin@sourceware.org>
3658
3659         Automatic date update in version.in
3660
3661 2022-12-13  Tom Tromey  <tromey@adacore.com>
3662
3663         Fix control-c handling on Windows
3664         As Hannes pointed out, the Windows target-async patches broke C-c
3665         handling there.  Looking into this, I found a few oddities, fixed
3666         here.
3667
3668         First, windows_nat_target::interrupt calls GenerateConsoleCtrlEvent.
3669         I think this event can be ignored by the inferior, so it's not a great
3670         way to interrupt.  Instead, using DebugBreakProcess (or a more
3671         complicated thing for Wow64) seems better.
3672
3673         Second, windows_nat_target did not implement the pass_ctrlc method.
3674         Implementing this lets us remove the special code to call
3675         SetConsoleCtrlHandler and instead integrate into gdb's approach to C-c
3676         handling.  I believe that this should also fix the race that's
3677         described in the comment that's being removed.
3678
3679         Initially, I thought a simpler version of this patch would work.
3680         However, I think what happens is that some other library (I'm not sure
3681         what) calls SetConsoleCtrlHandler while gdb is running, and this
3682         intercepts and handles C-c -- so that the gdb SIGINT handler is not
3683         called.  C-break continues to work, presumably because whatever
3684         handler is installed ignores it.
3685
3686         This patch works around this issue by ensuring that the gdb handler
3687         always comes first.
3688
3689 2022-12-13  Tom Tromey  <tromey@adacore.com>
3690
3691         Refactor code to check for terminal sharing
3692         This refactors the code to check for terminal sharing.
3693         is_gdb_terminal is exported, and sharing_input_terminal_1 is renamed,
3694         slightly refactored, and moved to posix-hdep.c.  A new
3695         Windows-specific implementation of this function is added to
3696         mingw-hdep.c.
3697
3698         MSDN has a warning about GetConsoleProcessList
3699
3700             This API is not recommended and does not have a virtual terminal
3701             equivalent. [...] Applications remoting via cross-platform
3702             utilities and transports like SSH may not work as expected if
3703             using this API.
3704
3705         However, we believe this isn't likely to be an issue for gdb.
3706
3707 2022-12-13  Tom Tromey  <tromey@adacore.com>
3708
3709         Use gdb::optional for sigint_ours
3710         sigint_ours (and sigquit_ours) can be used without being set.  Avoid
3711         this problem by changing them to gdb::optional and checking that they
3712         are in fact set before using the value.
3713
3714         Rename install_sigint_handler
3715         A subsequent patch will introduce a global 'install_sigint_handler'
3716         function, so first rename the static one in extension.c.
3717
3718 2022-12-13  Tom de Vries  <tdevries@suse.de>
3719
3720         [gdb/tdep] Fix s390_linux_nat_target::stopped_by_watchpoint
3721         On s390x-linux, I run into:
3722         ...
3723         (gdb) continue^M
3724         Continuing.^M
3725         breakpoint.c:5784: internal-error: bpstat_stop_status_nowatch: \
3726           Assertion `!target_stopped_by_watchpoint ()' failed.^M
3727         A problem internal to GDB has been detected,^M
3728         further debugging may prove unreliable.^M
3729         FAIL: gdb.threads/watchpoint-fork.exp: parent: singlethreaded: \
3730           breakpoint after the first fork (GDB internal error)
3731         ...
3732
3733         What happens is the follow:
3734         - a watchpoint event triggers
3735         - the event is processed, s390_linux_nat_target::stopped_by_watchpoint is called and
3736           it returns true, as expected
3737         - the watchpoint event is reported by gdb, and gdb stops
3738         - we issue a continue command
3739         - a fork event triggers
3740         - the event is processed, and during processing that event
3741           s390_linux_nat_target::stopped_by_watchpoint is called again, and returns
3742           true
3743         - the assertion fails, because the function is expected to return false
3744
3745         The function s390_linux_nat_target::stopped_by_watchpoint returns true the
3746         second time, because it looks at the exact same data that was looked at when
3747         it was called the first time, and that data hasn't changed.
3748
3749         There's code in the same function that intends to prevent that from happening:
3750         ...
3751               /* Do not report this watchpoint again.  */
3752               memset (&per_lowcore, 0, sizeof (per_lowcore));
3753               if (ptrace (PTRACE_POKEUSR_AREA, s390_inferior_tid (), &parea, 0) < 0)
3754                perror_with_name (_("Couldn't clear watchpoint status"));
3755         ...
3756         and that probably used to work for older kernels, but no longer does since
3757         linux kernel commit 5e9a26928f55 ("[S390] ptrace cleanup").
3758
3759         Fix this by copying this:
3760         ...
3761           siginfo_t siginfo;
3762           if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
3763             return false;
3764           if (siginfo.si_signo != SIGTRAP
3765               || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
3766             return false;
3767         ...
3768         from aarch64_linux_nat_target::stopped_data_address and remove the
3769         obsolete watchpoint status clearing code.
3770
3771         Tested on s390x-linux.
3772
3773         Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
3774
3775 2022-12-13  H.J. Lu  <hjl.tools@gmail.com>
3776
3777         gold: Remove BND from 64-bit x86-64 IBT PLT
3778         Since MPX support has been removed from x86-64 psABI, remove BND from
3779         64-bit IBT PLT by using 32-bit IBT PLT.
3780
3781                 PR gold/29851
3782                 * x86_64.cc (Output_data_plt_x86_64_ibt<32>::first_plt_entry):
3783                 Renamed to ...
3784                 (Output_data_plt_x86_64_ibt<size>::first_plt_entry): This.
3785                 (Output_data_plt_x86_64_ibt<64>::first_plt_entry): Removed.
3786                 (Output_data_plt_x86_64_ibt<size>::do_fill_first_plt_entry):
3787                 Drop the size == 32 check.
3788                 (Output_data_plt_x86_64_ibt<32>::plt_entry): Renamed to ...
3789                 (Output_data_plt_x86_64_ibt<size>::plt_entry): This.
3790                 (Output_data_plt_x86_64_ibt<64>::plt_entry): Removed.
3791                 (Output_data_plt_x86_64_ibt<32>::aplt_entry): Renamed to ...
3792                 (Output_data_plt_x86_64_ibt<size>::aplt_entry): This.
3793                 (Output_data_plt_x86_64_ibt<64>::aplt_entry): Removed.
3794                 (Output_data_plt_x86_64_ibt<size>::do_fill_plt_entry): Drop the
3795                 size == 32 check.
3796                 (Output_data_plt_x86_64_ibt<size>::fill_aplt_entry): Likewise.
3797
3798 2022-12-13  Tom Tromey  <tromey@adacore.com>
3799
3800         Remove two unnecessary casts
3801         A couple of calls to parse_probe_linespec had an unnecessary cast.  I
3802         suspect this cast was never needed, but once commands were changed to
3803         take a 'const' argument, they became completely obsolete.  Tested by
3804         rebuilding.
3805
3806 2022-12-13  Andrew Burgess  <aburgess@redhat.com>
3807
3808         gdb/testsuite: avoid creating temp file in gdb/testsuite/ directory
3809         After this commit:
3810
3811           commit 33c1395cf5e9deec7733691ba32c450e5c27f757
3812           Date:   Fri Nov 11 15:26:46 2022 +0000
3813
3814               gdb/testsuite: fix gdb.trace/unavailable-dwarf-piece.exp with Clang
3815
3816         The gdb.trace/unavailable-dwarf-piece.exp test script was creating a
3817         temporary file in the build/gdb/testsuite/ directory, instead of in
3818         the expected place in the outputs directory.
3819
3820         Fix this by adding a call to standard_output_file.
3821
3822 2022-12-13  Tom de Vries  <tdevries@suse.de>
3823
3824         [gdb/testsuite] Fix gdb.python/py-disasm.exp on s390x
3825         On s390x-linux, I run into:
3826         ...
3827         (gdb) disassemble test^M
3828         Dump of assembler code for function test:^M
3829            0x0000000001000638 <+0>:     stg     %r11,88(%r15)^M
3830            0x000000000100063e <+6>:     lgr     %r11,%r15^M
3831            0x0000000001000642 <+10>:    nop     0^M
3832         => 0x0000000001000646 <+14>:    nop     0^M
3833            0x000000000100064a <+18>:    nop     0^M
3834            0x000000000100064e <+22>:    lhi     %r1,0^M
3835            0x0000000001000652 <+26>:    lgfr    %r1,%r1^M
3836            0x0000000001000656 <+30>:    lgr     %r2,%r1^M
3837            0x000000000100065a <+34>:    lg      %r11,88(%r11)^M
3838            0x0000000001000660 <+40>:    br      %r14^M
3839         End of assembler dump.^M
3840         (gdb) FAIL: gdb.python/py-disasm.exp: global_disassembler=: disassemble test
3841         ...
3842
3843         The problem is that the test-case expects "nop" but on s390x we have instead
3844         "nop\t0".
3845
3846         Fix this by allowing the insn.
3847
3848         Tested on s390x-linux and x86_64-linux.
3849
3850 2022-12-13  Jan Beulich  <jbeulich@suse.com>
3851
3852         gas: re-work line number tracking for macros and their expansions
3853         The PR gas/16908 workaround aimed at uniformly reporting line numbers
3854         to reference macro invocation sites. As mentioned in a comment this may
3855         be desirable for small macros, but often isn't for larger ones. As a
3856         first step improve diagnostics to report both locations, while aiming at
3857         leaving generated debug info unaltered.
3858
3859         Note that macro invocation context is lost for any diagnostics issued
3860         only after all input was processed (or more generally for any use of
3861         as_*_where(), as the functions can't know whether the passed in location
3862         is related to [part of] the present stack of locations). To maintain the
3863         intended workaround behavior for PR gas/16908, a new as_where() is
3864         introduced to "look through" macro invocations, while the existing
3865         as_where() is renamed (and used in only very few places for now). Down
3866         the road as_where() will likely want to return a list of (file,line)
3867         pairs.
3868
3869 2022-12-13  Jan Beulich  <jbeulich@suse.com>
3870
3871         Arm: avoid unhelpful uses of .macro in testsuite
3872         Macros with just a single use site are a little pointless to have, and
3873         even in further cases .irp is more suitable for the purpose. Expand such
3874         inline, avoiding the need to touch the testcases when diagnostics are
3875         changed for code resulting from macro expansion.
3876
3877         While there also make what was "iter_mla" in sp-usage-thumb2-relax cover
3878         smlatt as well, rather than testing smlabt twice.
3879
3880 2022-12-13  Tom Tromey  <tom@tromey.com>
3881
3882         Fix crash in is_nocall_function
3883         is_nocall_function anticipates only being called for a function or a
3884         method.  However, PR gdb/29871 points out a situation where an unusual
3885         expression -- but one that parses to a valid, if extremely weird,
3886         function call -- breaks this assumption.
3887
3888         This patch changes is_nocall_function to remove this assert and
3889         instead simply return 'false' in this case.
3890
3891         Approved-By: Simon Marchi <simon.marchi@efficios.com>
3892         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29871
3893
3894 2022-12-13  Johnson Sun  <j3.soon777@gmail.com>
3895
3896         Replace gdbpy_should_stop with gdbpy_breakpoint_cond_says_stop
3897         In 2014, the function `gdbpy_should_stop' has been replaced with
3898         `gdbpy_breakpoint_cond_says_stop'
3899
3900         This replaces `gdbpy_should_stop' with `gdbpy_breakpoint_cond_says_stop' in the
3901         comments.
3902
3903         Since `gdbpy_should_stop' has been renamed as noted in `gdb/ChangeLog-2014':
3904
3905                 * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed
3906                 from gdbpy_should_stop.  Change result type to enum scr_bp_stop.
3907
3908         Change-Id: I0ef3491ce5e057c5e75ef8b569803b30a5838575
3909         Approved-By: Simon Marchi <simon.marchi@efficios.com>
3910
3911 2022-12-13  Alan Modra  <amodra@gmail.com>
3912
3913         asan: mips_hi16_list segfault in bfd_get_section_limit_octets
3914         static variables like mips_hi16_list are nasty for applications using
3915         bfd.  It is possible when opening and closing bfds with mis-matched
3916         hi/lo relocs to leave a stale section pointer on the list.  That can
3917         cause a segfault if multiple bfds are being processed.
3918
3919         Tidying the list when closing is sufficient to stop this happening
3920         (and fixes small memory leaks).  This patch goes further and moves
3921         mips_hi16_list to where it belongs in the bfd tdata.
3922
3923                 * elf32-mips.c (bfd_elf32_close_and_cleanup(: Define.
3924                 * elf64-mips.c (bfd_elf64_close_and_cleanup): Define.
3925                 * elfn32-mips.c (bfd_elf32_close_and_cleanup(: Define.
3926                 * elfxx-mips.c (struct mips_hi16): Move earlier.
3927                 (mips_hi16_list): Move to..
3928                 (struct mips_elf_obj_tdata): ..here.
3929                 (_bfd_mips_elf_close_and_cleanup): New function.
3930                 (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_lo16_reloc),
3931                 (_bfd_elf_mips_get_relocated_section_contents): Adjust uses of
3932                 mips_hi16_list.
3933                 * elfxx-mips.h (_bfd_mips_elf_close_and_cleanup): Declare.
3934
3935 2022-12-13  GDB Administrator  <gdbadmin@sourceware.org>
3936
3937         Automatic date update in version.in
3938
3939 2022-12-12  Indu Bhagat  <indu.bhagat@oracle.com>
3940
3941         libctf: remove unnecessary zstd constructs
3942         This patch is essentially a revert of
3943         commit-id: 8818c80cbd4116ef5af171ec47c61167179e225c
3944         (libctf: Add ZSTD_LIBS to LIBS so that ac_cv_libctf_bfd_elf can be true)
3945
3946         As the specific configure check now uses libtool, this explicit mention of the
3947         dependency $ZSTD_LIBS is not needed anymore.
3948
3949         ChangeLog:
3950
3951                 * libctf/Makefile.in: Regenerated.
3952                 * libctf/aclocal.m4: Likewise.
3953                 * libctf/config.h.in: Likewise.
3954                 * libctf/configure: Likewise.
3955                 * libctf/configure.ac: Remove ZSTD_LIBS from LIBS.  Cleanup
3956                 unused AC_ZSTD.
3957
3958 2022-12-12  Indu Bhagat  <indu.bhagat@oracle.com>
3959
3960         libctf: remove AC_CONFIG_MACRO_DIR
3961         ACLOCAL_AMFLAGS is being set already.  So using AC_CONFIG_MACRO_DIR is
3962         unnecessary.
3963
3964         ChangeLog:
3965
3966                 * libctf/configure: Regenerated.
3967                 * libctf/configure.ac: remove AC_CONFIG_MACRO_DIR usage.
3968
3969 2022-12-12  Indu Bhagat  <indu.bhagat@oracle.com>
3970
3971         libctf: remove unnecessary zlib constructs
3972         This dependency is managed via libtool.  So explicit addition to LDFLAGS
3973         and LIBS is not necessary anymore.
3974
3975         ChangeLog:
3976
3977                 * libctf/configure: Regenerated.
3978                 * libctf/configure.ac: remove zlib from LDFLAGS and LIBS.
3979
3980 2022-12-12  Tom de Vries  <tdevries@suse.de>
3981
3982         [gdb/testsuite] Fix PR20630 regression test in gdb.base/printcmds.exp
3983         On s390x-linux, I run into:
3984         ...
3985         (gdb) print {unsigned char}{65}^M
3986         $749 = 0 '\000'^M
3987         (gdb) FAIL: gdb.base/printcmds.exp: print {unsigned char}{65}
3988         ...
3989
3990         In contrast, on x86_64-linux, we have:
3991         ...
3992         (gdb) print {unsigned char}{65}^M
3993         $749 = 65 'A'^M
3994         (gdb) PASS: gdb.base/printcmds.exp: print {unsigned char}{65}
3995         ...
3996
3997         The first problem here is that the test is supposed to be a regression test
3998         for PR20630, which can be reproduced (for an unfixed gdb) like this:
3999         ...
4000         (gdb) p {unsigned char[]}{0x17}
4001         gdbtypes.c:4641: internal-error: copy_type: \
4002           Assertion `TYPE_OBJFILE_OWNED (type)' failed.
4003         ...
4004         but it's not due to insufficient quoting (note the dropped '[]').
4005
4006         That's easy to fix, but after that we have on s390 (big endian):
4007         ...
4008         (gdb) print {unsigned char[]}{65}^M
4009         $749 = ""^M
4010         ...
4011         and on x86_64 (little endian):
4012         ...
4013         (gdb) print {unsigned char[]}{65}^M
4014         $749 = "A"^M
4015         ...
4016
4017         Fix this by using 0xffffffff, such that in both cases we have:
4018         ...
4019         (gdb) print {unsigned char[]}{0xffffffff}^M
4020         $749 = "\377\377\377\377"^M
4021         ...
4022
4023         Tested on x86_64-linux and s390x-linux.
4024
4025 2022-12-12  Alan Modra  <amodra@gmail.com>
4026
4027         PR29893, buffer overflow in display_debug_addr
4028                 PR 29893
4029                 * dwarf.c (display_debug_addr): Sanity check dwarf5 unit_length
4030                 field.  Don't read past end.
4031
4032 2022-12-12  Tom Tromey  <tom@tromey.com>
4033
4034         Another Rust operator precedence bug
4035         My earlier patch to fix PR rust/29859 introduced a new operator
4036         precedence bug in the Rust parser.  Assignment operators are
4037         right-associative in Rust.  And, while this doesn't often matter, as
4038         Rust assignments always have the value (), still as a matter of
4039         principle we should get this correct.
4040
4041         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29859
4042
4043 2022-12-12  Tom de Vries  <tdevries@suse.de>
4044
4045         [gdb/testsuite] Fix gdb.base/write_mem.exp for big endian
4046         On s390x-linux (big endian), I run into:
4047         ...
4048         (gdb) x /xh main^M
4049         0x1000638 <main>:       0x0000^M
4050         (gdb) FAIL: gdb.base/write_mem.exp: x /xh main
4051         ...
4052
4053         In contrast, on x86_64-linux (little endian), we have the expected:
4054         ...
4055         (gdb) x /xh main^M
4056         0x4004a7 <main>:        0x4242^M
4057         (gdb) PASS: gdb.base/write_mem.exp: x /xh main
4058         ...
4059
4060         The problem is that the test-case hard-codes expectations about endiannes by
4061         writing an int-sized value (4 bytes in this case) and then printing only a
4062         halfword by using "/h" (so, two bytes).
4063
4064         If we print 4 bytes, we have for s390x:
4065         ...
4066         0x1000638 <main>:       0x00004242^M
4067         ...
4068         and for x86_64:
4069         ...
4070         0x4004a7 <main>:        0x00004242^M
4071         ...
4072
4073         Fix this by removing the "/h".
4074
4075         Tested on x86_64-linux and s390x-linux.
4076
4077 2022-12-12  Jan Vrany  <jan.vrany@labware.com>
4078
4079         gdb: fix possible use-after-free when executing commands
4080         In principle, `execute_command()` does following:
4081
4082            struct cmd_list_element *c;
4083            c = lookup_cmd ( ... );
4084            ...
4085            /* If this command has been pre-hooked, run the hook first.  */
4086            execute_cmd_pre_hook (c);
4087            ...
4088            /* ...execute the command `c` ...*/
4089            ...
4090            execute_cmd_post_hook (c);
4091
4092         This may lead into use-after-free error.  Imagine the command
4093         being executed is a user-defined Python command that redefines
4094         itself.  In that case, struct `cmd_list_element` pointed to by
4095         `c` is deallocated during its execution so it is no longer valid
4096         when post hook is executed.
4097
4098         To fix this case, this commit looks up the command once again
4099         after it is executed to get pointer to (possibly newly allocated)
4100         `cmd_list_element`.
4101
4102 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4103
4104         x86: further re-work insn/suffix recognition to also cover MOVSX
4105         PR gas/29524
4106
4107         Having templates with a suffix explicitly present has always been
4108         quirky. After prior adjustment all that's left to also eliminate the
4109         anomaly from move-with-sign-extend is to consolidate the insn templates
4110         and to make may_need_pass2() cope (plus extend testsuite coverage).
4111
4112 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4113
4114         x86: drop (now) stray IsString
4115         The need for them on the operand-less string insns has gone away with
4116         the removal of maybe_adjust_templates() and associated logic. Since
4117         i386_index_check() needs adjustment then anyway, take the opportunity
4118         and also simplify it, possible again as a result of said removal (plus
4119         the opcode template adjustments done here).
4120
4121 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4122
4123         x86: move bad-use-of-TLS-reloc check
4124         Having it in match_template() is unhelpful. Neither does looking for the
4125         next template to possibly match make any sense in that case, nor is the
4126         resulting diagnostic making clear what the problem is.
4127
4128         While moving the check, also generalize it to include all SIMD and VEX-
4129         encoded insns. This way an existing conditional can be re-used in
4130         md_assemble(). Note though that this still leaves a lof of insns which
4131         are also wrong to use with these relocations.
4132
4133         Further fold the remaining check (BFD_RELOC_386_GOT32) with the XRELEASE
4134         related one a few lines down. This again allows re-using an existing
4135         conditional.
4136
4137 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4138
4139         x86-64: allow HLE store of accumulator to absolute 32-bit address
4140         In commit 1212781b35c9 ("ix86: allow HLE store of accumulator to
4141         absolute address") I was wrong to exclude 64-bit code. Dropping the
4142         check also leads to better diagnostics in 64-bit code ("MOV", after
4143         all, isn't invalid with "XRELEASE").
4144
4145         While there also limit the amount of further checks done: The operand
4146         type checks that were there were effectively redundant with other ones
4147         anyway, plus it's quite fine to also have "xrelease mov <disp>, %eax"
4148         look for the next MOV template (in fact again also improving
4149         diagnostics).
4150
4151 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4152
4153         ix86: don't recognize/derive Q suffix in the common case
4154         Have its use, except where actually legitimate, result in the same "only
4155         supported in 64-bit mode" diagnostic as emitted for other 64-bit only
4156         insns. Also suppress deriving of the suffix in Intel mode except in the
4157         legitimate cases. This in exchange allows dropping the respective code
4158         from match_template().
4159
4160         To maintain reasonable diagnostics (in particular to avoid "`mov' is
4161         only supported in 64-bit mode" on the SIMD forms of MOVQ) we need to
4162         defer parse_insn()'s emitting of errors unrelated to prefix parsing.
4163         Utilize i.error just like match_template() does.
4164
4165         Oddly enough despite gcc's preference towards FILDQ and FIST{,T}Q we
4166         had no testcase whatsoever for these. Therefore such tests are being
4167         added. Note that the removed line in the x86-64-lfence-load testcase
4168         was redundant with the exact same one a few lines up.
4169
4170 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4171
4172         x86: re-work insn/suffix recognition
4173         Having templates with a suffix explicitly present has always been
4174         quirky. Introduce a 2nd matching pass in case the 1st one couldn't find
4175         a suitable template _and_ didn't itself already need to trim off a
4176         suffix to find a match at all. This requires error reporting adjustments
4177         (albeit luckily fewer than I was afraid might be necessary), as errors
4178         previously reported during matching now need deferring until after the
4179         2nd pass (because, obviously, we must not emit any error if the 2nd pass
4180         succeeds). While also related to PR gas/29524, it was requested that
4181         move-with-sign-extend be left as broken as it always was.
4182
4183         PR gas/29525
4184         Note that with the dropped CMPSD and MOVSD Intel Syntax string insn
4185         templates taking operands, mixed IsString/non-IsString template groups
4186         (with memory operands) cannot occur anymore. With that
4187         maybe_adjust_templates() becomes unnecessary (and is hence being
4188         removed).
4189
4190         PR gas/29526
4191         Note further that while the additions to the intel16 testcase aren't
4192         really proper Intel syntax, we've been permitting all of those except
4193         for the MOVD variant. The test therefore is to avoid re-introducing such
4194         an inconsistency.
4195
4196 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4197
4198         x86: constify parse_insn()'s input
4199         The function doesn't alter its input buffer: Reflect this in its
4200         prototype. To avoid using any kind of cast, simply calculate the update
4201         of "line" from the function's input and output.
4202
4203         x86: revert disassembler parts of "x86: Allow 16-bit register source for LAR and LSL"
4204         This reverts the disassembler parts of 859aa2c86dc9 ("x86: Allow 16-bit
4205         register source for LAR and LSL"), adjusting testcases as necessary.
4206         That change was itself a partial revert of c9f5b96bdab0 ("x86: correct
4207         handling of LAR and LSL"), without actually saying so. While the earlier
4208         commit was properly agreed upon, the partial revert was not, and hence
4209         should not have been committed. This is even more so that the revert
4210         part of that change wasn't even necessary to address PR gas/29844.
4211
4212 2022-12-12  Alan Modra  <amodra@gmail.com>
4213
4214         PR29892, Field file_table of struct module is uninitialized
4215                 PR 29892
4216                 * vms-alphs.c (new_module): Use bfd_zmalloc to alloc file_table.
4217                 (parse_module): Rewrite file_table reallocation code and clear.
4218
4219         Lack of bounds checking in vms-alpha.c parse_module
4220                 PR 29873
4221                 PR 29874
4222                 PR 29875
4223                 PR 29876
4224                 PR 29877
4225                 PR 29878
4226                 PR 29879
4227                 PR 29880
4228                 PR 29881
4229                 PR 29882
4230                 PR 29883
4231                 PR 29884
4232                 PR 29885
4233                 PR 29886
4234                 PR 29887
4235                 PR 29888
4236                 PR 29889
4237                 PR 29890
4238                 PR 29891
4239                 * vms-alpha.c (parse_module): Make length param bfd_size_type.
4240                 Delete length == -1 checks.  Sanity check record_length.
4241                 Sanity check DST__K_MODBEG, DST__K_RTNBEG, DST__K_RTNEND lengths.
4242                 Sanity check DST__K_SOURCE and DST__K_LINE_NUM elements
4243                 before accessing.
4244                 (build_module_list): Pass dst_section size to parse_module.
4245
4246 2022-12-12  Alan Modra  <amodra@gmail.com>
4247
4248         PR29872, uninitialised value in display_debug_lines_decoded dwarf.c:5413
4249         Plus segvs if the C-library doesn't handle printf %s of NULL.
4250
4251                 PR 29872
4252                 * dwarf.c (null_name): New function.
4253                 (process_debug_info): Use it here..
4254                 (display_debug_lines_raw): ..and here..
4255                 (display_debug_lines_decoded): ..and here.  xcalloc directory_table.
4256                 Simplify xcalloc of file_table.
4257
4258 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4259
4260         gas/codeview: avoid "shadowing" of glibc function name
4261         While not "index" this time, old enough glibc also has an (unguarded)
4262         declaration of fileno() in stdio.h, which triggers a "shadows a global
4263         declaration" warning with our choice of warning level and with at least
4264         some gcc versions.
4265
4266         x86: generate template sets data at build time
4267         Speed up gas startup by avoiding runtime allocation of the instances of
4268         type "templates". At the same time cut the memory requirement to just
4269         very little over half (not even accounting for any overhead
4270         notes_alloc() may incur) by reusing the "end" slot of a preceding entry
4271         for the "start" slot of the subsequent one.
4272
4273         x86: drop sentinel from i386_optab[]
4274         Now that the table is local to gas, ARRAY_SIZE() can be used to
4275         determine the end of the table. Re-arrange the processing loop in
4276         md_begin() accordingly, at the same time folding the two calls to
4277         notes_alloc() into just one.
4278
4279         x86: add generated tables dependency check to gas
4280         As requested by H.J., just for the sake of people potentially building
4281         in gas/ alone, add a check that the generated files in opcodes/ are
4282         actually up-to-date. Personally I think this should at best be a
4283         warning, but I can see how this may not be easily noticable among other
4284         make output (depending in particular on the verbosity level).
4285
4286         x86: break gas dependency on libopcodes
4287         gas doesn't use anything from libopcodes anymore - suppress linking in
4288         that library.
4289
4290         x86: remove i386-opc.c
4291         Remove the now empty i386-opc.c. To compensate, tie table generation in
4292         opcodes/ to the building of i386-dis.o, despite the file not really
4293         depending on the generated data.
4294
4295 2022-12-12  Jan Beulich  <jbeulich@suse.com>
4296
4297         x86: instantiate i386_{op,reg}tab[] in gas instead of in libopcodes
4298         Unlike many other architectures, x86 does not share an opcode table
4299         between assembly and disassembly. Any consumer of libopcodes would only
4300         ever access one of the two. Since gas is the only consumer of the
4301         assembly data, move it there. While doing so mark respective entities
4302         "static" in i386-gen (we may want to do away with i386_regtab_size
4303         altogether).
4304
4305         This also shrinks the number of relocations to be processed for
4306         libopcodes.so by about 30%.
4307
4308 2022-12-12  GDB Administrator  <gdbadmin@sourceware.org>
4309
4310         Automatic date update in version.in
4311
4312 2022-12-11  Alan Modra  <amodra@gmail.com>
4313
4314         PR29870, objdump SEGV in display_debug_lines_decoded dwarf.c:5524
4315         DWARF5 directory and file table allow more opportunity for fuzzers
4316         to break things.  There are likely other places in dwarf.c that should
4317         be fixed too.
4318
4319                 PR 29870
4320                 * dwarf.c (display_debug_lines_decoded): Handle NULL file_table
4321                 name entry.
4322
4323 2022-12-11  GDB Administrator  <gdbadmin@sourceware.org>
4324
4325         Automatic date update in version.in
4326
4327 2022-12-10  Tom de Vries  <tdevries@suse.de>
4328
4329         [gdb/tdep] Fix larl handling in s390_displaced_step_fixup
4330         On s390x-linux with target board unix/-m31, I run into:
4331         ...
4332         (gdb) PASS: gdb.guile/scm-lazy-string.exp: bad length
4333         print ptr^M
4334         $1 = 0x804006b0 <error: Cannot access memory at address 0x804006b0>^M
4335         (gdb) FAIL: gdb.guile/scm-lazy-string.exp: ptr: print ptr
4336         ...
4337
4338         A minimal example is:
4339         ...
4340         $ gdb -q -batch -ex "set trace-commands on" -x gdb.in
4341         +file scm-lazy-string
4342         +break main
4343         Breakpoint 1 at 0x4005d2: file scm-lazy-string.c, line 23.
4344         +run
4345
4346         Breakpoint 1, main () at scm-lazy-string.c:23
4347         23        const char *ptr = "pointer";
4348         +step
4349         24        const char array[] = "array";
4350         +print ptr
4351         $1 = 0x804006b0 <error: Cannot access memory at address 0x804006b0>
4352         ...
4353
4354         If we delete the breakpoint after running to it, we have instead the expected:
4355         ...
4356         +delete
4357         +step
4358         24        const char array[] = "array";
4359         +print ptr
4360         $1 = 0x4006b0 "pointer"
4361         ...
4362
4363         The problem is in displaced stepping, forced by the presence of the breakpoint,
4364         when stepping over this insn:
4365         ...
4366           0x4005d2 <main+10>      larl    %r1,0x4006b0
4367         ...
4368
4369         With normal stepping we have:
4370         ...
4371         (gdb) p /x $r1
4372         $2 = 0x3ff004006b0
4373         ...
4374         but with displaced stepping we have instead (note the 0x80000000 difference):
4375         ...
4376         (gdb) p /x $r1
4377         $1 = 0x3ff804006b0
4378         (gdb)
4379         ...
4380
4381         The difference comes from this code in s390_displaced_step_fixup:
4382         ...
4383           /* Handle LOAD ADDRESS RELATIVE LONG.  */
4384           else if (is_ril (insn, op1_larl, op2_larl, &r1, &i2))
4385             {
4386               /* Update PC.  */
4387               regcache_write_pc (regs, from + insnlen);
4388               /* Recompute output address in R1.  */
4389               regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
4390                                               amode | (from + i2 * 2));
4391             }
4392         ...
4393         where the "amode |" adds the 0x80000000.
4394
4395         Fix this by removing the "amode |".
4396
4397         Tested on s390-linux, with native and target board unix/-m31.
4398
4399         Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
4400
4401 2022-12-10  GDB Administrator  <gdbadmin@sourceware.org>
4402
4403         Automatic date update in version.in
4404
4405 2022-12-09  Indu Bhagat  <indu.bhagat@oracle.com>
4406
4407         objdump: sframe: fix memory leaks
4408         ChangeLog:
4409
4410                 * binutils/objdump.c (dump_section_sframe): free up contents and
4411                 SFrame decoder context on exit.
4412
4413 2022-12-09  Indu Bhagat  <indu.bhagat@oracle.com>
4414
4415         libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_info
4416         The new name better reflects the purpose of the function.
4417
4418         ChangeLog:
4419
4420                 * bfd/elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Use new
4421                 name.
4422                 * libsframe/sframe.c (sframe_fde_create_func_info): Rename
4423                 sframe_fde_func_info to this.
4424                 * libsframe/testsuite/libsframe.encode/encode-1.c: Use new name.
4425
4426         include/ChangeLog:
4427
4428                 * sframe-api.h (sframe_fde_create_func_info): Rename
4429                 sframe_fde_func_info to this.
4430
4431 2022-12-09  Indu Bhagat  <indu.bhagat@oracle.com>
4432
4433         gas: sframe: fine tune the fragment fixup for SFrame func info
4434         SFrame function info is an unsigned 8-bit field comprising of the following
4435         (from LSB to MSB):
4436           - 4-bits: FRE type
4437           - 1-bit: FRE start address encoding
4438           - 3-bits: Unused
4439
4440         At the moment, the most-significat 4-bits are zero (The FRE start
4441         address encoding of SFRAME_FDE_TYPE_PCINC has a value of zero, and the upper
4442         3-bits are unused). So the current implementation works without this patch.
4443
4444         To be precise, however, the fragment fixup logic is meant to fixup only the
4445         least-significant 4-bits (i.e., only the FRE type needs to be updated
4446         according to the function size).
4447
4448         This patch makes the gas implementation a bit more resilient: In the
4449         future, when the format does evolve to make use of the currently unused
4450         3-bits in various ways, the values in those 3-bits can be propagated
4451         unchanged while the fragment fixup continues to update the lowermost
4452         4-bits to indicate the selected FRE type.
4453
4454         ChangeLog:
4455
4456                 * gas/gen-sframe.c (create_func_info_exp): New definition.
4457                 (output_sframe_funcdesc): Call create_func_info_exp.
4458                 * gas/sframe-opt.c (sframe_estimate_size_before_relax): The
4459                 associated fragment uses O_modulus now.
4460                 (sframe_convert_frag): Adjust the fragment fixup code according
4461                 to the new composite exp.
4462
4463 2022-12-09  Indu Bhagat  <indu.bhagat@oracle.com>
4464
4465         sframe: gas: libsframe: define constants and remove magic numbers
4466         Define constants in sframe.h for the various limits associated with the
4467         range of offsets that can be encoded in the start address of an SFrame
4468         FRE. E.g., sframe_frame_row_entry_addr1 is used when start address
4469         offset can be encoded as 1-byte unsigned value.
4470
4471         Update the code in gas to use these defined constants as it checks for
4472         these limits, and remove the usage of magic numbers.
4473
4474         ChangeLog:
4475
4476                 * gas/sframe-opt.c (sframe_estimate_size_before_relax):
4477                 (sframe_convert_frag): Do not use magic numbers.
4478                 * libsframe/sframe.c (sframe_calc_fre_type): Likewise.
4479
4480         include/ChangeLog:
4481
4482                 * sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): New constant.
4483                 (SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise.
4484                 (SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
4485
4486 2022-12-09  Indu Bhagat  <indu.bhagat@oracle.com>
4487
4488         sframe.h: make some macros more precise
4489         include/ChangeLog:
4490
4491                 * sframe.h (SFRAME_V1_FUNC_INFO): Use specific bits only.
4492                 (SFRAME_V1_FRE_INFO): Likewise.
4493
4494 2022-12-09  Indu Bhagat  <indu.bhagat@oracle.com>
4495
4496         libsframe: minor formatting nits
4497         ChangeLog:
4498
4499                 * libsframe/sframe.c: Fix formatting nits.
4500
4501 2022-12-09  Luis Machado  <luis.machado@arm.com>
4502
4503         [aarch64] Add TPIDR2 register support for Linux
4504         With the AArch64 Scalable Matrix Extension we have a new TPIDR2 register, and
4505         it will be added to the existing NT_ARM_TLS register set. Kernel patches are
4506         being reviewed here:
4507
4508         https://lore.kernel.org/linux-arm-kernel/20220818170111.351889-1-broonie@kernel.org/
4509
4510         From GDB's perspective, we handle it in a similar way to the existing TPIDR
4511         register. But we need to consider cases of systems that only have TPIDR and
4512         systems that have both TPIDR and TPIDR2.
4513
4514         With that in mind, the following patch adds the required code to support
4515         TPIDR2 and turns the org.gnu.gdb.aarch64.tls feature into a
4516         dynamically-generated target description as opposed to a static target
4517         description containing only TPIDR.
4518
4519         That means we can remove the gdb/features/aarch64-tls.xml file and replace the
4520         existing gdb/features/aarch64-tls.c auto-generated file with a new file that
4521         dynamically generates the target description containing either TPIDR alone or
4522         TPIDR and TPIDR2.
4523
4524         In the future, when *BSD's start to support this register, they can just
4525         enable it as is being done for the AArch64 Linux target.
4526
4527         The core file read/write code has been updated to support TPIDR2 as well.
4528
4529         On GDBserver's side, there is a small change to the find_regno function to
4530         expose a non-throwing version of it.
4531
4532         It always seemed strange to me how find_regno causes the whole operation to
4533         abort if it doesn't find a particular register name. The patch moves code
4534         from find_regno into find_regno_no_throw and makes find_regno call
4535         find_regno_no_throw instead.
4536
4537         This allows us to do register name lookups to find a particular register
4538         number without risking erroring out if nothing is found.
4539
4540         The patch also adjusts the feature detection code for aarch64-fbsd, since
4541         the infrastructure is shared amongst all aarch64 targets. I haven't added
4542         code to support TPIDR2 in aarch64-fbsd though, as I'm not sure when/if
4543         that will happen.
4544
4545 2022-12-09  Alan Modra  <amodra@gmail.com>
4546
4547         PR28306, segfault in _bfd_mips_elf_reloc_unshuffle
4548         Access to section data during relocation processing should be bounds
4549         checked, as it is in bfd_perform_relocation.  bfd_perform_relocation
4550         does these checks after any special_function is called.  So a reloc
4551         special_function needs to do its own bounds checking before accessing
4552         section data.  This patch adds many such checks to the mips backend.
4553
4554         Checking mips relocs is not without some difficulty.  See the comment
4555         in _bfd_mips_reloc_offset_in_range.  In a multitple reloc sequence
4556         applied to the same location, relocs that may appear somewhere other
4557         than the last one of the sequence need to be treated specially since
4558         they apply to the addend for the next relocation rather than the
4559         section contents.  If the addend is in the section then it needs to be
4560         checked but not when the addend is in the reloc.  check_inplace
4561         handles this situation.  _bfd_mips_reloc_offset_in_range with
4562         check_shuffle handles the case where contents are shuffled before
4563         applying the relocation.
4564
4565                 PR 28306
4566                 * elf32-mips.c (_bfd_mips_elf32_gprel16_reloc): Check reloc
4567                 address using _bfd_mips_reloc_offset_in_range.
4568                 (gprel32_with_gp, mips16_gprel_reloc): Likewise.
4569                 * elf64-mips.c (mips_elf64_gprel32_reloc): Likewise.
4570                 (mips16_gprel_reloc): Likewise.
4571                 * elfn32-mips.c (mips16_gprel_reloc): Likewise.
4572                 (gprel32_with_gp): Check reloc address using
4573                 bfd_reloc_offset_in_range.
4574                 * elfxx-mips.h (enum reloc_check): Define.
4575                 (_bfd_mips_reloc_offset_in_range): Declare.
4576                 * elfxx-mips.c (needs_shuffle): New function.
4577                 (_bfd_mips_elf_reloc_unshuffle, _bfd_mips_elf_reloc_shuffle): Use it.
4578                 (_bfd_mips_reloc_offset_in_range): New function.
4579                 (_bfd_mips_elf_gprel16_with_gp): Move reloc address checks to
4580                 partial_inplace handling.  Use bfd_reloc_offset_in_range.
4581                 (_bfd_mips_elf_lo16_reloc): Check reloc address using
4582                 bfd_reloc_offset_in_range.
4583                 (_bfd_mips_elf_generic_reloc): Check reloc address using
4584                 _bfd_mips_reloc_offset_in_range.
4585                 (mips_elf_calculate_relocation): Check reloc address before calling
4586                 mips_elf_nullify_got_load.
4587                 (_bfd_mips_elf_check_relocs): Likewise.
4588                 (mips_elf_read_rel_addend): Add sec param, check reloc address
4589                 before reading.  Adjust callers.
4590                 (mips_elf_add_lo16_rel_addend): Add sec param, adjust callers.
4591
4592 2022-12-09  Tom de Vries  <tdevries@suse.de>
4593
4594         [gdb/testsuite] Fix gdb.guile/scm-symtab.exp for ppc64le
4595         On powerpc64le-linux, I run into:
4596         ...
4597         (gdb) PASS: gdb.guile/scm-symtab.exp: step out of func2
4598         guile (print (> (sal-line (find-pc-line (frame-pc (selected-frame)))) line))^M
4599         = #f^M
4600         (gdb) FAIL: gdb.guile/scm-symtab.exp: test find-pc-line with resume address
4601         ...
4602
4603         The problem is as follows: the instructions for the call to func2 are:
4604         ...
4605             1000070c:   39 00 00 48     bl      10000744 <func1>
4606             10000710:   00 00 00 60     nop
4607             10000714:   59 00 00 48     bl      1000076c <func2>
4608             10000718:   00 00 00 60     nop
4609             1000071c:   00 00 20 39     li      r9,0
4610         ...
4611         and the corresponding line number info is:
4612         ...
4613         scm-symtab.c:
4614         File name     Line number    Starting address    View    Stmt
4615         scm-symtab.c           42          0x1000070c               x
4616         scm-symtab.c           43          0x10000714               x
4617         scm-symtab.c           44          0x1000071c               x
4618         ...
4619
4620         The test-case looks at the line numbers for two insns:
4621         - the insn of the call to func2 (0x10000714), and
4622         - the insn after that (0x10000718),
4623         and expects the line number of the latter to be greater than the line number
4624         of the former.
4625
4626         However, both insns have the same line number: 43.
4627
4628         Fix this by replacing ">" with ">=".
4629
4630         Tested on x86_64-linux and powerpc64le-linux.
4631
4632 2022-12-09  GDB Administrator  <gdbadmin@sourceware.org>
4633
4634         Automatic date update in version.in
4635
4636 2022-12-08  H.J. Lu  <hjl.tools@gmail.com>
4637
4638         x86-64: Remove BND from 64-bit IBT PLT
4639         Since MPX support has been removed from x86-64 psABI, remove BND from
4640         64-bit IBT PLT by using x32 IBT PLT.
4641
4642         bfd/
4643
4644                 PR ld/29851
4645                 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Also check
4646                 x32 IBT PLT for 64-bit.
4647                 (elf_x86_64_link_setup_gnu_properties): Always use x32 IBT PLT.
4648
4649         ld/
4650
4651                 PR ld/29851
4652                 * testsuite/ld-x86-64/ibt-plt-1.d: Updated.
4653                 * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
4654                 * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise.
4655                 * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
4656                 * testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
4657                 * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
4658                 * testsuite/ld-x86-64/ibt-plt-3b.d: Likewise.
4659                 * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
4660                 * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
4661                 * testsuite/ld-x86-64/plt-main-ibt-x32.dd: Moved to ...
4662                 * testsuite/ld-x86-64/plt-main-ibt.dd: This.
4663                 * testsuite/ld-x86-64/x86-64.exp: Don't use plt-main-ibt-x32.dd.
4664
4665 2022-12-08  Tom de Vries  <tdevries@suse.de>
4666
4667         [gdb/testsuite] Require debug info for gdb.tui/tui-layout-asm-short-prog.exp
4668         When running test-case gdb.tui/tui-layout-asm-short-prog.exp on SLE-12-SP3
4669         aarch64, I run into:
4670         ...
4671         FAIL: gdb.tui/tui-layout-asm-short-prog.exp: check asm box contents
4672         FAIL: gdb.tui/tui-layout-asm-short-prog.exp: check asm box contents again
4673         ...
4674         due to:
4675         ...
4676         (gdb) file tui-layout-asm-short-prog^M
4677         Reading symbols from tui-layout-asm-short-prog...^M
4678         (No debugging symbols found in tui-layout-asm-short-prog)^M
4679         ...
4680
4681         I managed to reproduce the same behaviour on openSUSE Leap 15.4 x86_64, by
4682         removing the debug option.
4683
4684         Fix this by making the test-case unsupported if no debug info is found.
4685
4686         Tested on x86_64-linux.
4687
4688 2022-12-08  Enze Li  <enze.li@hotmail.com>
4689
4690         gdb/testsuite: update a pattern in gdb_file_cmd
4691         When building GDB with the following CFLAGS and CXXFLAGS as part of
4692         configure line:
4693
4694             CFLAGS=-std=gnu11 CXXFLAGS=-std=gnu++11
4695
4696         Then run the selftest.exp, I see:
4697
4698         ======
4699         Running /home/lee/dev/binutils-gdb/gdb/testsuite/gdb.gdb/selftest.exp
4700         ...
4701         FAIL: gdb.gdb/selftest.exp: run until breakpoint at captured_main
4702         WARNING: Couldn't test self
4703
4704                         === gdb Summary ===
4705
4706          # of unexpected failures        1
4707         /home/lee/dev/binutils-gdb/gdb/gdb version  13.0.50.20221206-git -nw -nx
4708         -iex "set height 0" -iex "set width 0" -data-directory
4709         /home/lee/dev/binutils-gdb/gdb/testsuite/../data-directory
4710         ======
4711
4712         It is the fact that when I use the previously mentioned CFLAGS and
4713         CXXFLAGS as part of the configuration line, the default value (-O2 -g)
4714         is overridden, then GDB has no debug information.  When there's no debug
4715         information, GDB should not run the testcase in selftest.exp.
4716
4717         The root cause of this FAIL is that the $gdb_file_cmd_debug_info didn't
4718         get the right value ("nodebug") during the gdb_file_cmd procedure.
4719
4720         That's because in this commit,
4721
4722           commit 3453e7e409f44a79ac6695589836edb8a49bfb08
4723           Date:   Sat May 19 11:25:20 2018 -0600
4724
4725             Clean up "Reading symbols" output
4726
4727         It changed "no debugging..." to "No debugging..." which causes the above
4728         problem.  This patch only updates the corresponding pattern to fix this
4729         issue.
4730
4731         With this patch applied, I see:
4732
4733         ======
4734         Running /home/lee/dev/binutils-gdb/gdb/testsuite/gdb.gdb/selftest.exp
4735         ...
4736
4737                         === gdb Summary ===
4738
4739          # of untested testcases         1
4740         /home/lee/dev/binutils-gdb/gdb/gdb version  13.0.50.20221206-git -nw -nx
4741         -iex "set height 0" -iex "set width 0" -data-directory
4742         /home/lee/dev/binutils-gdb/gdb/testsuite/../data-directory
4743         ======
4744
4745         Tested on x86_64-linux.
4746
4747         Approved-By: Simon Marchi <simon.marchi@efficios.com>
4748
4749 2022-12-08  Nick Clifton  <nickc@redhat.com>
4750
4751         Update the description of the linker script's TYPE directive.
4752                 PR 29861
4753                 * ld.texi (Output Section Type): Note that setting the output
4754                 section type only works if the section contains untyped data.
4755
4756 2022-12-08  Jan Vrany  <jan.vrany@labware.com>
4757
4758         gdb: skip objfiles with no BFD in DWARF unwinder
4759         While playing with JIT reader I experienced GDB to crash on null-pointer
4760         dereference when stepping through non-jitted code.
4761
4762         The problem was that dwarf2_frame_find_fde () assumed that all objfiles
4763         have BFD but that's not always true. To address this problem, this
4764         commit skips such objfiles.
4765
4766         To test the fix we put breakpoint in jit_function_add (). The JIT reader
4767         does not know how unwind this function so unwinding eventually falls
4768         back to DWARF unwinder which in turn iterates over objfiles. Since the
4769         the code is jitted, it is guaranteed it would eventually process JIT
4770         objfile.
4771
4772         Approved-By: Simon Marchi <simon.marchi@efficios.com>
4773
4774 2022-12-08  Alan Modra  <amodra@gmail.com>
4775
4776         libctf: avoid potential double free
4777                 * ctf-link.c (ctf_link_add_cu_mapping): Set t NULL after free.
4778
4779 2022-12-08  GDB Administrator  <gdbadmin@sourceware.org>
4780
4781         Automatic date update in version.in
4782
4783 2022-12-07  Peter Bergner  <bergner@linux.ibm.com>
4784
4785         PowerPC: Add support for RFC02655 - Saturating Subtract Instruction
4786         opcodes/
4787                 * ppc-opc.c (XOL): New define.
4788                 (XOL_MASK): Likewise.
4789                 (powerpc_opcodes): Add subfus, subfus., subwus, subwus., subdus, subdus.
4790
4791         gas/
4792                 * testsuite/gas/ppc/rfc02655.s: New test.
4793                 * testsuite/gas/ppc/rfc02655.d: Likewise
4794                 * testsuite/gas/ppc/future-raw.s: Likewise.
4795                 * testsuite/gas/ppc/future-raw.d: Likewise.
4796                 * testsuite/gas/ppc/ppc.exp: Run them.
4797
4798 2022-12-07  Peter Bergner  <bergner@linux.ibm.com>
4799
4800         PowerPC: Add support for RFC02656 - Enhanced Load Store with Length Instructions
4801         opcodes/
4802                 * ppc-opc.c (PPCVSXF): New define.
4803                 (powerpc_opcodes): Add lxvrl, lxvrll, lxvprl, lxvprll, stxvrl,
4804                 stxvrll, stxvprl, stxvprl.
4805
4806         gas/
4807                 * testsuite/gas/ppc/rfc02656.s: New test.
4808                 * testsuite/gas/ppc/rfc02656.d: Likewise.
4809                 * testsuite/gas/ppc/ppc.exp: Run it.
4810
4811 2022-12-07  Simon Marchi  <simon.marchi@polymtl.ca>
4812
4813         gdb: add invalidate_selected_frame function
4814         Instead of using `select_frame (nullptr)` to invalidate the selected
4815         frame, introduce a function to do that.  There is no change in behavior,
4816         but it makes the intent a bit clearer.  It also allows adding an assert
4817         in select_frame that fi is not nullptr, so it avoids passing nullptr by
4818         mistake.
4819
4820         Change-Id: I61643f46bc8eca428334513ebdaadab63997bdd0
4821         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
4822
4823 2022-12-07  Tom de Vries  <tdevries@suse.de>
4824
4825         [gdb/testsuite] Add KFAILs in gdb.base/longjmp.exp
4826         Add KFAILs in test-case gdb.base/longjmp.exp for PR gdb/26967, covering
4827         various ways that gdb is unable to recover the longjmp target if the libc
4828         probe is not supported.
4829
4830         Tested on x86_64-linux.
4831
4832         Approved-By: Simon Marchi <simon.marchi@efficios.com>
4833
4834 2022-12-07  Tom Tromey  <tromey@adacore.com>
4835
4836         Remove unnecessary xstrdup from bppy_init
4837         I saw that bppy_init used a non-const "char *".  Fixing this revealed
4838         that the xstrdup here was also unnecessary, so this patch removes it.
4839
4840 2022-12-07  Alan Modra  <amodra@gmail.com>
4841
4842         coff make_a_section_from_file tidy
4843         Also support compressing a few more sections.
4844
4845                 * coffgen.c (make_a_section_from_file): Rename return_section
4846                 to newsect.  Don't try to be clever matching section name.
4847                 Compress .gnu.debuglto_.debug_ and .gnu.linkonce.wi. too.
4848                 Only rename debug sections when decompressing for linker.
4849
4850 2022-12-07  Alan Modra  <amodra@gmail.com>
4851
4852         gas compress_debug tidy
4853                 * write.c (compress_debug): Don't set up "ob" until after
4854                 seginfo NULL check.  Simplify SEC_CONTENTS test.  Localise
4855                 variables.  Use bfd_debug_name_to_zdebug.
4856
4857         _bfd_elf_slurp_secondary_reloc_section sanity check
4858                 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check
4859                 section header against file size.  Avoid overflow in
4860                 reloc_count.
4861
4862         bfd_compress_section_contents access to elf_section_data
4863                 * compress.c (bfd_compress_section_contents): Don't access
4864                 elf_section_data for non-ELF.
4865
4866 2022-12-07  Alan Modra  <amodra@gmail.com>
4867
4868         Compression tidy and fixes
4869         Tidies:
4870         - Move stuff from bfd-in.h and libbfd.c to compress.c
4871         - Delete COMPRESS_DEBUG from enum compressed_debug_section_type
4872         - Move compress_debug field out of link_info to ld_config.
4873         Fixes:
4874         - Correct test in bfd_convert_section_setup to use obfd flags,
4875           not ibfd.
4876         - Apply bfd_applicable_file_flags to compression bfd flags added
4877           by gas and ld to the output bfd.
4878
4879         bfd/
4880                 * bfd-in.h (enum compressed_debug_section_type),
4881                 (struct compressed_type_tuple),
4882                 (bfd_get_compression_algorithm),
4883                 (bfd_get_compression_algorithm_name),
4884                 * libbfd.c (compressed_debug_section_names),
4885                 (bfd_get_compression_algorithm),
4886                 (bfd_get_compression_algorithm_name): Move..
4887                 * compress.c: ..to here, deleting COMPRESS_DEBUG from
4888                 enum compressed_debug_section_type.
4889                 (bfd_convert_section_setup): Test obfd flags not ibfd for
4890                 compression flags.
4891                 * elf.c (elf_fake_sections): Replace link_info->compress_debug
4892                 test with abfd->flags test.
4893                 * bfd-in2.h: Regenerate.
4894         binutils/
4895                 * objcopy.c (copy_file): Tidy setting of bfd compress flags.
4896                 Expand comment.
4897         gas/
4898                 * write.c (compress_debug): Test bfd compress flags rather than
4899                 flag_compress_debug.
4900                 (write_object_file): Apply bfd_applicable_file_flags to compress
4901                 debug flags added to output bfd.
4902         include/
4903                 * bfdlink.h (struct bfd_link_info): Delete compress_debug.
4904         ld/
4905                 * ld.h (ld_config_type): Add compress_debug.
4906                 * emultempl/elf.em: Replace references to link_info.compress_debug
4907                 with config.compress_debug.
4908                 * lexsup.c (elf_static_list_options): Likewise.
4909                 * ldmain.c (main): Likewise.  Apply bfd_applicable_file_flags
4910                 to compress debug flags added to output bfd.
4911
4912 2022-12-07  GDB Administrator  <gdbadmin@sourceware.org>
4913
4914         Automatic date update in version.in
4915
4916 2022-12-06  H.J. Lu  <hjl.tools@gmail.com>
4917
4918         bfd: Avoid signed overflow for new_size adjustment
4919         When bfd_size_type is unsigned 64-bit integer and sizeof is unsigned
4920         32-bit integer, subtraction in
4921
4922         *new_size += sizeof (Elf32_External_Chdr) - sizeof (Elf64_External_Chdr);
4923
4924         will overflow.  Use
4925
4926         *new_size -= sizeof (Elf64_External_Chdr) - sizeof (Elf32_External_Chdr);
4927
4928         to avoid overflow.
4929
4930                 PR binutils/29860
4931                 * compress.c (bfd_convert_section_setup): Avoid signed overflow
4932                 for new_size adjustment.
4933
4934 2022-12-06  Tom Tromey  <tromey@adacore.com>
4935
4936         Cosmetic fix in ppc-sysv-tdep.c
4937         This is just a couple of cosmetic fixes in ppc-sysv-tdep.c: fixing
4938         some formatting and correcting a typo.
4939
4940         Fix operator precedence bug in Rust parser
4941         PR rust/29859 points out an operator precedence bug in the Rust
4942         parser.  This patch fixes it and adds a regression test.
4943
4944 2022-12-06  Nick Clifton  <nickc@redhat.com>
4945
4946         Fix a dereference of NULL when scanning the symbol hashes array in the ARM linker.
4947                 PR 29852
4948                 * elf32-arm.c (cmse_scan): Check for NULL entries in the
4949                 sym_hashes array.
4950                 (elf32_arm_gc_mark_extra_sections): Likewise.
4951
4952 2022-12-06  Tom de Vries  <tdevries@suse.de>
4953
4954         [gdb/testsuite] Fix test names in gdb.base/longjmp.exp
4955         When running test-case gdb.base/longjmp.exp, we have:
4956         ...
4957         PASS: gdb.base/longjmp.exp: next over setjmp (1)
4958           ...
4959         PASS: gdb.base/longjmp.exp: next over setjmp (2)
4960         ...
4961
4962         The trailing " (1)" and " (2)" are interpreted as comments rather than parts
4963         of the test name, and therefore this is a duplicate, which is currently not
4964         detected by our duplicate detection mechanism (PR testsuite/29772).
4965
4966         Fix the duplicate by using with_test_prefix.
4967
4968         Tested on x86_64-linux.
4969
4970 2022-12-06  Tom de Vries  <tdevries@suse.de>
4971
4972         [gdb/testsuite] Make gdb.base/longjmp.exp FAIL more stable across archs
4973         When running test-case gdb.base/longjmp.exp on x86_64-linux, the master
4974         longjmp breakpoint is set using probes and the test-case passes:
4975         ...
4976         (gdb) PASS: gdb.base/longjmp.exp: next to longjmp (1)
4977         next^M
4978         0x00000000004005cc      49        if (setjmp (env) == 0) /* patt1 */^M
4979         (gdb) PASS: gdb.base/longjmp.exp: next over longjmp(1)
4980         next^M
4981         56            resumes++;^M
4982         (gdb) PASS: gdb.base/longjmp.exp: next into else block (1)
4983         ...
4984
4985         However, if I disable
4986         create_longjmp_master_breakpoint_probe, we have instead:
4987         ...
4988         (gdb) PASS: gdb.base/longjmp.exp: next to longjmp (1)
4989         next^M
4990         56            resumes++;^M
4991         (gdb) FAIL: gdb.base/longjmp.exp: next over longjmp(1)
4992         ...
4993
4994         At first glance, the failure mode doesn't look too bad: we stop
4995         a few insns later than the passing scenario.
4996
4997         For contrast, if we do the same on powerpc64le, the failure mode is:
4998         ...
4999         (gdb) PASS: gdb.base/longjmp.exp: next to longjmp (1)
5000         next^M
5001         ^M
5002         Breakpoint 3, main () at longjmp.c:59^M
5003         59        i = 1; /* miss_step_1 */^M
5004         (gdb) FAIL: gdb.base/longjmp.exp: next over longjmp(1)
5005         ...
5006         Here we only stop because of running into the safety net breakpoint at
5007         miss_step_1.
5008
5009         So, how does this happen on x86_64?  Let's look at the code:
5010         ...
5011         4005c7: e8 94 fe ff ff    call 400460 <_setjmp@plt>
5012         4005cc: 85 c0             test %eax,%eax
5013         4005ce: 75 1e             jne  4005ee <main+0x3b>
5014         4005d0: 8b 05 8e 0a 20 00 mov  0x200a8e(%rip),%eax # 601064 <longjmps>
5015         4005d6: 83 c0 01          add  $0x1,%eax
5016         4005d9: 89 05 85 0a 20 00 mov  %eax,0x200a85(%rip) # 601064 <longjmps>
5017         4005df: be 01 00 00 00    mov  $0x1,%esi
5018         4005e4: bf 80 10 60 00    mov  $0x601080,%edi
5019         4005e9: e8 82 fe ff ff    call 400470 <longjmp@plt>
5020         4005ee: 8b 05 74 0a 20 00 mov  0x200a74(%rip),%eax # 601068 <resumes>
5021         ...
5022         The next over the longjmp call at 4005e9 is supposed to stop at the longjmp
5023         target at 4005cc, but instead we stop at 4005ee, where we have the step-resume
5024         breakpoint inserted by the next.  In other words, we accidentally "return"
5025         from the longjmp call to the insn immediately after it (even though
5026         a longjmp is a noreturn function).
5027
5028         Try to avoid this accident and make the failure mode on x86_64 the same as on
5029         powerpc64le, by switching the then and else branch.
5030
5031         Tested on x86_64-linux.
5032
5033 2022-12-06  Xiao Zeng  <zengxiao@eswincomputing.com>
5034
5035         gdb/riscv: correct dwarf to gdb register number mapping
5036         According to the riscv psabi, the mapping relationship between the
5037         DWARF registers and the machine registers is as follows:
5038
5039           DWARF Number | Register Name | Description
5040           0 - 31       | x0 - x31      | Integer Registers
5041           32 - 63      | f0 - f31      | Floating-point Registers
5042
5043         This is not modelled quite right in riscv_dwarf_reg_to_regnum, the
5044         DWARF register numbers 31 and 63 are not handled correctly due to a
5045         use of '<' instead of '<='.  This commit fixes this issue.
5046
5047 2022-12-06  Haochen Jiang  <haochen.jiang@intel.com>
5048
5049         x86: Remove unnecessary vex.w check for xh_mode in disassembler
5050         For all the xh_mode usage in table, they are all using %XH, which will
5051         print "{bad}" while EVEX.W=1. This makes this vex.w check unnecessary.
5052
5053         opcodes/ChangeLog:
5054
5055                 * i386-dis.c (OP_E_memory): Remove vex.w check for xh_mode.
5056
5057 2022-12-06  Alan Modra  <amodra@gmail.com>
5058
5059         Get rid of SEC_ELF_COMPRESS
5060         This flag also isn't needed, except for some sanity checks which we
5061         can omit.
5062
5063                 * elf.c (elf_fake_sections): Don't set SEC_ELF_COMPRESS for
5064                 compressed debug sections, just leave sh_name as -1.
5065                 (assign_file_positions_for_non_load_sections),
5066                 (assign_file_positions_except_relocs): Decide whether a section
5067                 needs compressing and thus should not have its file offset set
5068                 by looking at sh_name.
5069                 (_bfd_elf_assign_file_positions_for_non_load): Similarly decide
5070                 which sections need compressing.
5071                 * elflink.c (bfd_elf_final_link): Don't test SEC_ELF_COMPRESS.
5072                 * merge.c (_bfd_write_merged_section): Likewise.
5073                 * section.c (SEC_ELF_COMPRESS): Don't define.
5074                 (SEC_ELF_PURECODE): Renumber.
5075                 * bfd-in2.h: Regenerate.
5076
5077 2022-12-06  Alan Modra  <amodra@gmail.com>
5078
5079         Get rid of SEC_ELF_RENAME
5080         SEC_ELF_RENAME is a flag used to effect section name changes when
5081         compressing/decompressing zlib-gnu debug sections.  This can be
5082         accomplished more directly in one of the objcopy specific bfd
5083         functions.  Renaming for ld input is simplified too.  Ld input object
5084         files always have BFD_DECOMPRESS set.
5085
5086         bfd/
5087                 * compress.c (bfd_convert_section_size): Rename to..
5088                 (bfd_convert_section_setup): ..this.  Handle objcopy renaming
5089                 of compressed/decompressed debug sections.
5090                 * elf.c (_bfd_elf_make_section_from_shdr): Only rename zdebug
5091                 input for linker.
5092                 (elf_fake_sections): Don't handle renaming of debug sections for
5093                 objcopy here.
5094                 * section.c (SEC_ELF_RENAME): Delete.
5095                 * bfd-in2.h: Regenerate.
5096         binutils/
5097                 * objcopy.c (setup_section): Call bfd_convert_section_setup.
5098                 Don't call bfd_convert_section_size.
5099
5100 2022-12-06  Alan Modra  <amodra@gmail.com>
5101
5102         Compression header enum
5103         Define an enum instead of using ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD
5104         in bfd and binutils, and move some functions from bfd.c to compress.c.
5105         When looking at the COFF/PE debug compression support, I wondered
5106         about extending it to support zstd.  I likely won't do that, but
5107         the compression header ch_type field isn't just ELF specific if these
5108         headers are to be used in COFF/PE too.
5109
5110         bfd/
5111                 * bfd.c (bfd_update_compression_header),
5112                 (bfd_check_compression_header, bfd_get_compression_header_size),
5113                 (bfd_convert_section_size, bfd_convert_section_contents): Move to..
5114                 * compress.c: ..here.
5115                 (enum compression_type): New.  Use it throughout file.
5116                 * elf.c (_bfd_elf_make_section_from_shdr): Replace uses of
5117                 ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD with ch_compress_zlib and
5118                 ch_compress_zstd.
5119                 * bfd-in2.h: Regenerate.
5120         binutils/
5121                 * readelf.c (process_section_headers, dump_section_as_strings),
5122                 (dump_section_as_bytes, load_specific_debug_section): Replace
5123                 uses of ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD with
5124                 ch_compress_zlib and ch_compress_zstd.
5125
5126 2022-12-06  mengqinggang  <mengqinggang@loongson.cn>
5127
5128         LoongArch: Fix dynamic reloc not generated bug in some cases.
5129         bfd/ChangeLog:
5130
5131                 * elfnn-loongarch.c (loongarch_elf_relocate_section): Likewise.
5132
5133 2022-12-06  Alan Modra  <amodra@gmail.com>
5134
5135         PR29855, ch_type in bfd_init_section_decompress_status can be uninitialized
5136                 PR 29855
5137                 * compress.c (bfd_init_section_decompress_status): Set ch_type
5138                 to zero for zlib-gnu case.
5139
5140 2022-12-06  GDB Administrator  <gdbadmin@sourceware.org>
5141
5142         Automatic date update in version.in
5143
5144 2022-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
5145
5146         gdb/linux-nat: add ptid parameter to linux_xfer_siginfo
5147         Make the inferior_ptid bubble up to linux_nat_target::xfer_partial.
5148
5149         Change-Id: I62dbc5734c26648bb465f449c2003c73751cd812
5150
5151 2022-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
5152
5153         gdb/linux-nat: use l linux_nat_get_siginfo in linux_xfer_siginfo
5154         I noticed we could reduce duplication a bit here.
5155
5156         Change-Id: If24e54d1dac71b46f7c1f68a18a073d4c084b644
5157
5158 2022-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
5159
5160         gdb/linux-nat: check ptrace return value in linux_nat_get_siginfo
5161         Not a big deal, but it seems strange to check errno instead of the
5162         ptrace return value to know whether it succeeded.
5163
5164         Change-Id: If0a6d0280ab0e5ecb077e546af0d6fe489c5b9fd
5165
5166 2022-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
5167
5168         gdb/linux-nat: don't memset siginfo on failure in linux_nat_get_siginfo
5169         No caller cares about the value of *SIGINFO on failure.  It's also
5170         documented in the function doc that *SIGINFO is uninitialized (I
5171         understand "untouched") on failure.
5172
5173         Change-Id: I5ef38a5f58e3635e109b919ddf6f827f38f1225a
5174
5175 2022-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
5176
5177         gdb/linux-nat: bool-ify linux_nat_get_siginfo
5178         Change return type to bool.
5179
5180         Change-Id: I1bf0360bfdd1b5994cd0f96c268d806f96fe51a4
5181
5182 2022-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
5183
5184         gdb/linux-nat: use get_ptrace_pid in two spots
5185         No behavior change expected.
5186
5187         Change-Id: Ifaa64ecd619483646b024fd7c62e571e92a8eedb
5188
5189 2022-12-05  Simon Marchi  <simon.marchi@efficios.com>
5190
5191         gdb/testsuite: remove perror calls when failing to run
5192         I noticed that when running these two tests in sequence:
5193
5194             Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/arrayptr.exp ...
5195             ERROR: GDB process no longer exists
5196             ERROR: Couldn't run foo-all
5197             Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/assign_1.exp ...
5198
5199         The results in gdb.sum are:
5200
5201             Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/arrayptr.exp ...
5202             PASS: gdb.ada/arrayptr.exp: scenario=all: compilation foo.adb
5203             ERROR: GDB process no longer exists
5204             UNRESOLVED: gdb.ada/arrayptr.exp: scenario=all: gdb_breakpoint: set breakpoint at foo.adb:40 (eof)
5205             ERROR: Couldn't run foo-all
5206             Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/assign_1.exp ...
5207             UNRESOLVED: gdb.ada/assign_1.exp: changing the language to ada
5208             PASS: gdb.ada/assign_1.exp: set convenience variable $xxx to 1
5209
5210         The UNRESOLVED for arrayptr.exp is fine, as GDB crashes in that test,
5211         while trying to run to main.  However, the UNRESOLVED in assign_1.exp
5212         doesn't make sense, GDB behaves as expected in that test:
5213
5214             (gdb) set lang ada^M
5215             (gdb) UNRESOLVED: gdb.ada/assign_1.exp: changing the language to ada
5216             print $xxx := 1^M
5217             $1 = 1^M
5218             (gdb) PASS: gdb.ada/assign_1.exp: set convenience variable $xxx to 1
5219
5220         The problem is that arrayptr.exp calls perror when failing to run to
5221         main, then returns.  perror makes it so that the next test (as in
5222         pass/fail) will be recorded as UNRESOLVED.  However, here, the next test
5223         (as in pass/fail) is in the next test (as in .exp).  Hence the spurious
5224         UNRESOLVED in assign_1.exp.
5225
5226         These perror when failing to run to X are not really useful, especially
5227         since runto records a FAIL on error, by default.  Remove all the
5228         perrors on runto failure I could find.
5229
5230         When there wasn't one already, add a return statement when failing to
5231         run, to avoid running the test of the test unnecessarily.
5232
5233         I thought of adding a check ran between test (in gdb_finish
5234         probably) where we would emit a warning if errcnt > 0, meaning a test
5235         quit and left a perror "active".  However, reading that variable would
5236         poke into the DejaGNU internals, not sure it's a good idea.
5237
5238         Change-Id: I2203df6d06e199540b36f56470d1c5f1dc988f7b
5239
5240 2022-12-05  Luis Machado  <luis.machado@arm.com>
5241
5242         Add missing newline to gdbarch_tdep debugging output
5243         The missing newline causes testsuite issues because the gdb prompt gets output
5244         to an unexpected location.
5245
5246 2022-12-05  Nick Clifton  <nickc@redhat.com>
5247
5248         Prevent an illegal memory access when comparing the prefix of a section name regexp.
5249                 PR 29849
5250                 * ldlang.c (spec_match): Check that there is sufficient length in
5251                 the target name to match the spec's prefix.
5252
5253 2022-12-05  Martin Liska  <mliska@suse.cz>
5254
5255         testsuite: support mold linker
5256         Mold linker demotes symbols like main to be local and the patch
5257         adjusts expected output from nm.
5258
5259         Moreover, simplify the regex patterns.
5260
5261 2022-12-05  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
5262
5263         gdbarch.py: Fix indentation in the generated set_gdbarch_* definitions
5264         Use as many tabs as possible for indentation and pad with spaces to keep
5265         the argument aligned to the opening parenthesis in the line above.
5266
5267         Co-developed-by: Simon Marchi <simon.marchi@efficios.com>
5268         Approved-By: Simon Marchi <simon.marchi@efficios.com>
5269
5270 2022-12-05  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
5271
5272         gdbarch.py: Fix indentation in the generated gdbarch_dump function
5273         Use tab for the first eight spaces of indentation, and align the gdb_printf
5274         arguments to the open parenthesis of the function call.
5275
5276         Approved-By: Simon Marchi <simon.marchi@efficios.com>
5277
5278 2022-12-05  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
5279
5280         gdb: Update my email address in MAINTAINERS
5281
5282 2022-12-05  Jan Beulich  <jbeulich@suse.com>
5283
5284         gas: add Dwarf line number test for .macro expansions
5285         Before fiddling with the code let's put in place a test covering what
5286         PR/gas 16908 aimed at.
5287
5288         gas: squash (some) .linefile from listings
5289         Not so long ago we started to insert these artificially when expanding
5290         certain macro-like constructs; zap them as cluttering what actually
5291         results from user input.
5292
5293 2022-12-05  Jan Beulich  <jbeulich@suse.com>
5294
5295         gas: avoid inserting extra newline in buffer_and_nest()
5296         In "-alm" listings I've noticed an odd blank line following the inserted
5297         .linefile one. This results from the explicit NL inserted being
5298         redundant with the one left in place from the original input line by all
5299         respective callers. Note that we need to compensate for the removed line
5300         by bumping the directive argument (which in turn is decremented again in
5301         s_linefile() before calling new_logical_line_flags(), and I have to
5302         confess that when putting together the original change I was a little
5303         puzzled by the imbalance of increments/decrements, but then I forgot to
5304         actually go look for the cause).
5305
5306         While there also switch to sb_add_string() instead of effectively open-
5307         coding it to some degree.
5308
5309 2022-12-05  Jan Beulich  <jbeulich@suse.com>
5310
5311         Arm: .noinit and .persistent are not supported for Linux targets
5312         Respective tests being run means guaranteed failures.
5313
5314 2022-12-05  Nick Clifton  <nickc@redhat.com>
5315
5316         Fix an illegal memory access when parsing a corrupt VMS Alpha file.
5317                 PR 29848
5318                 * vms-alpha.c (parse_module): Fix potential out of bounds memory
5319                 access.
5320
5321 2022-12-05  Andrew Burgess  <aburgess@redhat.com>
5322
5323         libopcodes/mips: add support for disassembler styling
5324         This commit adds disassembler styling support for MIPS.  After this
5325         commit objdump and GDB will style disassembler output.
5326
5327         This is a pretty straight forward change, we switch to use the
5328         disassemble_info::fprintf_styled_func callback, and pass an
5329         appropriate style through as needed.  No additional tricks were
5330         needed (compared to say i386, or ARM).
5331
5332         Tested by running all of the objdump commands used by the gas
5333         testsuite and manually inspecting the styled output, everything looks
5334         reasonable, though I'm not a MIPS expert, so it is possible that I've
5335         missed some corner cases.  Worst case though is that something will be
5336         styled incorrectly, the actual content should be unchanged.
5337
5338         All the gas, ld, and binutils tests still pass for me.
5339
5340 2022-12-05  Andrew Burgess  <aburgess@redhat.com>
5341
5342         opcodes/mips: use .word/.short for undefined instructions
5343         While working on disassembler styling for MIPS, I noticed that
5344         undefined instructions are printed by the disassembler as raw number
5345         with no assembler directive prefix (e.g. without .word or .short).
5346
5347         I think adding something like .word, or .short, helps to make it
5348         clearer the size of the value that is being displayed, and is inline
5349         with what many of the other libopcode disassemblers do.
5350
5351         In this commit I've added the .word and .short directives, and updated
5352         all the tests that I spotted that failed as a result.
5353
5354 2022-12-05  Alan Modra  <amodra@gmail.com>
5355
5356         Re: Renaming .debug to .zdebug and vice versa
5357                 * compress.c (bfd_debug_name_to_zdebug): Fix C++ compile error.
5358                 (bfd_zdebug_name_to_debug): Likewise.
5359                 * bfd-in2.h: Regenerate.
5360
5361 2022-12-05  GDB Administrator  <gdbadmin@sourceware.org>
5362
5363         Automatic date update in version.in
5364
5365 2022-12-04  Alan Modra  <amodra@gmail.com>
5366
5367         PR29846, segmentation fault in objdump.c compare_symbols
5368         Fixes a fuzzed object file problem where plt relocs were manipulated
5369         in such a way that two synthetic symbols were generated at the same
5370         plt location.  Won't occur in real object files.
5371
5372                 PR 29846
5373                 PR 20337
5374                 * objdump.c (compare_symbols): Test symbol flags to exclude
5375                 section and synthetic symbols before attempting to check flavour.
5376
5377 2022-12-04  Alan Modra  <amodra@gmail.com>
5378
5379         COFF compressed debug support
5380         Since commit 4bea06d73c04 COFF support for compressed debug sections
5381         has been broken due to the "flags" variable not getting SEC_HAS_CONTENTS.
5382
5383                 * coffgen.c (make_a_section_from_file): Correct section flags
5384                 handling.  Delete extraneous condition.  Update error messages
5385                 to be the same as in elf.c.
5386
5387 2022-12-04  Alan Modra  <amodra@gmail.com>
5388
5389         Renaming .debug to .zdebug and vice versa
5390         Move a couple of elf.c functions to compress.c.
5391
5392                 * compress.c (bfd_debug_name_to_zdebug): New inline function.
5393                 (bfd_zdebug_name_to_debug): Likewise.
5394                 * elf.c (convert_debug_to_zdebug, convert_zdebug_to_debug): Delete.
5395                 (_bfd_elf_make_section_from_shdr, elf_fake_sections),
5396                 (_bfd_elf_assign_file_positions_for_non_load): Adjust to suit.
5397                 * coffgen.c (make_a_section_from_file): Use new inlines here.
5398
5399 2022-12-04  GDB Administrator  <gdbadmin@sourceware.org>
5400
5401         Automatic date update in version.in
5402
5403 2022-12-03  H.J. Lu  <hjl.tools@gmail.com>
5404
5405         Revert "ld: Add .note.GNU-stack to ld-plugin/dummy.s"
5406         This reverts commit 44e59b5a7d8a874f6546a1471b8a003911853aa0.
5407
5408         It works only for ELF targets.
5409
5410 2022-12-03  H.J. Lu  <hjl.tools@gmail.com>
5411
5412         ld: Add .note.GNU-stack to ld-plugin/dummy.s
5413                 * testsuite/ld-plugin/dummy.s: Add .note.GNU-stack.
5414
5415 2022-12-03  H.J. Lu  <hjl.tools@gmail.com>
5416
5417         x86: Allow 16-bit register source for LAR and LSL
5418         Since LAR and LSL only access 16 bits of the source operand, regardless
5419         of operand size, allow 16-bit register source for LAR and LSL, and always
5420         disassemble LAR and LSL with 16-bit source operand.
5421
5422         gas/
5423
5424                 PR gas/29844
5425                 * testsuite/gas/i386/i386.s: Add tests for LAR and LSL.
5426                 * testsuite/gas/i386/x86_64.s: Likewise.
5427                 * testsuite/gas/i386/intelbad.s: Remove "lar/lsl eax, ax".
5428                 * testsuite/gas/i386/i386-intel.d: Updated.
5429                 * testsuite/gas/i386/i386.d: Likewise.
5430                 * testsuite/gas/i386/intel-intel.d: Likewise.
5431                 * testsuite/gas/i386/intel.d: Likewise.
5432                 * testsuite/gas/i386/intelbad.l: Likewise.
5433                 * testsuite/gas/i386/x86_64-intel.d: Likewise.
5434                 * testsuite/gas/i386/x86_64.d: Likewise.
5435
5436         opcodes/
5437
5438                 PR gas/29844
5439                 * i386-dis.c (MOD_0F02): Removed.
5440                 (MOD_0F03): Likewise.
5441                 (dis386_twobyte): Restore larS and lslS.
5442                 (mod_table): Remove MOD_0F02 and MOD_0F03.
5443                 * i386-opc.tbl: Allow 16-bit register source for LAR and LSL.
5444                 * i386-tbl.h: Regenerated.
5445
5446 2022-12-03  GDB Administrator  <gdbadmin@sourceware.org>
5447
5448         Automatic date update in version.in
5449
5450 2022-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
5451
5452         gdb/linux-nat: add pid parameter to linux_proc_xfer_memory_partial
5453         Add a pid parameter to linux_proc_xfer_memory_partial, making the
5454         inferior_ptid reference bubble up close to the target_ops::xfer_partial
5455         boundary.  No behavior change expected.
5456
5457         Change-Id: I58171b00ee1bba1ea22efdbb5dcab8b1ab3aac4c
5458
5459 2022-12-02  Simon Marchi  <simon.marchi@efficios.com>
5460
5461         gdb: add some debug statements to solib-svr4.c
5462         Add a few debug statements that were useful to me when debugging why the
5463         glibc probes interface wasn't getting used.
5464
5465         Change-Id: Ic20744f9fc80a90f196896b0829949411620c540
5466
5467 2022-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
5468
5469         gdb: merge solib-frv aix-solib debug options into "set/show debug solib"
5470         solib implementations are typically used one at a time.  So it will be
5471         rare that you will want to enable debug for one solib kind, and
5472         absolutely want to keep the others disabled.  To make things simpler,
5473         instead of adding separate variables / macros / commands for each solib
5474         implementation, merge the existing ones (frv and aix) into a unified
5475         "set/show debug solib", with the solib_debug_printf macro.
5476
5477         Change-Id: I6e18bbc7401724f37ae66681badb079d75ecf7fa
5478
5479 2022-12-02  Nick Clifton  <nickc@redhat.com>
5480
5481         Add Jan Beulich as an x86_64 maintainer.
5482
5483 2022-12-02  Jan Beulich  <jbeulich@suse.com>
5484
5485         x86: drop most OPERAND_TYPE_* (and rework the rest)
5486         With the general use of C99 there's no need anymore to have i386-gen
5487         produce these. For more frequently used ones introduce local #define-s,
5488         while others are simply spelled out directly. While doing this move
5489         some static constants into more narrow scopes.
5490
5491         Note that as a "side effect" this corrects type_names[]'es imm8s entry.
5492
5493 2022-12-02  Jan Beulich  <jbeulich@suse.com>
5494
5495         x86: simplify and slightly correct XCHG vs NOP checking
5496         For one, because of CheckRegSize, there's no need to check the size of
5497         both (register) operands. And then in process_suffix() check opcode
5498         space rather than the (potentially ambiguous) extension opcode.
5499
5500         x86: also use D for XCHG and TEST
5501         Leverage the C (commutative) attribute to also reduce the number of XCHG
5502         and TEST templates we have. This way the reg <-> r/m (and reg <-> reg for
5503         XCHG) forms can also be folded into a single template each, utilizing D.
5504
5505 2022-12-02  Tom de Vries  <tdevries@suse.de>
5506
5507         [gdb/testsuite] Prevent timeout in gdb.ada/float-bits.exp
5508         Recent commit 32a5aa26256 ("[gdb/testsuite] Fix gdb.ada/float-bits.exp
5509         for powerpc64le") started using command "maint print architecture", which
5510         produces ~275 lines.
5511
5512         Rewrite the corresponding gdb_test_multiple to read line-by-line, to prevent
5513         timeouts on slower test setups.
5514
5515         Note that this doesn't fix a timeout in the test-case on aarch64 due to:
5516         ...
5517         gdbarch_dump: read_core_file_mappings = <0x817438>
5518         (gdb) aarch64_dump_tdep: Lowest pc = 0x0x8000
5519         ...
5520
5521         Tested on x86_64-linux.
5522
5523 2022-12-02  GDB Administrator  <gdbadmin@sourceware.org>
5524
5525         Automatic date update in version.in
5526
5527 2022-12-01  Carl Love  <cel@us.ibm.com>
5528
5529         PowerPC, fix gdb.reverse/finish-reverse-bkpt.exp and gdb.reverse/next-reverse-bkpt-over-sr.exp
5530         The tests set a break point with the command break *func.  This sets a
5531         breakpoint on the first instruction of the function.  PowerPC uses
5532         Global Entry Points (GEP) and Local Entry Points (LEP).  The first
5533         instruction in the function is the GEP.  The GEP sets up register
5534         r2 before reaching the LEP.  When the function is called with func() the
5535         function is entered via the LEP and the test fails because GDB does not
5536         see the breakpoint on the GEP.  However, if the function is called via a
5537         function pointer, execution begins at the GEP as the test expects.
5538
5539         Currently finish-reverse-bkpt.exp uses source file finish-reverse.c and
5540         next-reverse-bpkt-over-sr.exp uses source file step-reverse.c  A new
5541         source file was created for tests finish-reverse-bkpt.exp and
5542         next-reverse-bkpt-over-sr.exp.  The new files use the new function
5543         pointer method to call the functions so the tests will work correctly on
5544         both PowerPC with a GEP and LEP as well as on other systems.  The GEP is
5545         the same as the LEP on non PowerPC systems.
5546
5547         The expect files were changed to use the new source files and to set the
5548         initial break point for the rest of the test on the function pointer call
5549         for the function.
5550
5551         This patch fixes two PowerPC test failures in each of the tests
5552         gdb.reverse/finish-reverse-bkpt.exp and
5553         gdb.reverse/next-reverse-bkpt-over-sr.exp.
5554
5555         Patch tested on PowerPC and Intel X86-64 with no regressions.
5556
5557         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
5558
5559 2022-12-01  Tom Tromey  <tromey@adacore.com>
5560
5561         Remove call to registers_changed from windows-nat.c
5562         I noticed that windows_nat_target::interrupt calls registers_changed.
5563         However, I don't think there's any reason to do this, because this
5564         will happen automatically when the inferior stop is processed.
5565
5566         Approved-By: Simon Marchi <simon.marchi@efficios.com>
5567
5568 2022-12-01  Tom Tromey  <tromey@adacore.com>
5569
5570         Remove the_windows_nat_target global
5571         I belatedly realized that the "the_windows_nat_target" global isn't
5572         really necessary.  It's only used in one place, where 'this' would be
5573         simpler and clearer.  This patch removes the global entirely.
5574
5575         Approved-By: Simon Marchi <simon.marchi@efficios.com>
5576
5577 2022-12-01  Simon Marchi  <simon.marchi@polymtl.ca>
5578
5579         gdb: make frame_register static
5580         It is only used inside frame.c.
5581
5582         Change-Id: I44eb46a5992412f8f8b4954b2284b0ef3b549504
5583
5584 2022-12-01  Tom Tromey  <tromey@adacore.com>
5585
5586         Add name canonicalization for C
5587         PR symtab/29105 shows a number of situations where symbol lookup can
5588         result in the expansion of too many CUs.
5589
5590         What happens is that lookup_signed_typename will try to look up a type
5591         like "signed int".  In cooked_index_functions::expand_symtabs_matching,
5592         when looping over languages, the C++ case will canonicalize this type
5593         name to be "int" instead.  Then this method will proceed to expand
5594         every CU that has an entry for "int" -- i.e., nearly all of them.  A
5595         crucial component of this is that the caller, objfile::lookup_symbol,
5596         does not do this canonicalization, so when it tries to find the symbol
5597         for "signed int", it fails -- causing the loop to continue.
5598
5599         This patch fixes the problem by introducing name canonicalization for
5600         C.  The idea here is that, by making C and C++ agree on the canonical
5601         name when a symbol name can have multiple spellings, we avoid the bad
5602         behavior in objfile::lookup_symbol (and any other such code -- I don't
5603         know if there is any).
5604
5605         Unlike C++, C only has a few situations where canonicalization is
5606         needed.  And, in particular, due to the lack of overloading (thus
5607         avoiding any issues in linespec) and due to the way c-exp.y works, I
5608         think that no canonicalization is needed during symbol lookup -- only
5609         during symtab construction.  This explains why lookup_name_info is not
5610         touched.
5611
5612         The stabs reader is modified on a "best effort" basis.
5613
5614         The DWARF reader needed one small tweak in dwarf2_name to avoid a
5615         regression in dw2-unusual-field-names.exp.  I think this is adequately
5616         explained by the comment, but basically this is a scenario that should
5617         not occur in real code, only the gdb test suite.
5618
5619         lookup_signed_typename is simplified.  It used to search for two
5620         different type names, but now gdb can search just for the canonical
5621         form.
5622
5623         gdb.dwarf2/enum-type.exp needed a small tweak, because the
5624         canonicalizer turns "unsigned integer" into "unsigned int integer".
5625         It seems better here to use the correct C type name.
5626
5627         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29105
5628         Tested-by: Simon Marchi <simark@simark.ca>
5629         Reviewed-by: Andrew Burgess <aburgess@redhat.com>
5630
5631 2022-12-01  Tom Tromey  <tromey@adacore.com>
5632
5633         Refactor cooked_index::do_finalize
5634         This refactors cooked_index::do_finalize, reordering an 'if' to make
5635         it a little less redundant.  This change makes a subsequent patch
5636         easier to read.
5637
5638         Reviewed-by: Andrew Burgess <aburgess@redhat.com>
5639
5640 2022-12-01  Tom Tromey  <tromey@adacore.com>
5641
5642         Remove language check from dwarf2_compute_name
5643         dwarf2_compute_name has a redundant check of the CU's language -- this
5644         is also checked in dwarf2_canonicalize_name.  Removing this slightly
5645         simplifies a future patch.
5646
5647         Reviewed-by: Andrew Burgess <aburgess@redhat.com>
5648
5649 2022-12-01  Simon Marchi  <simon.marchi@efficios.com>
5650
5651         gdb/dwarf: add some QUIT macros
5652         While testing the fix for PR 29105, I noticed I couldn't ctrl-C my way
5653         out of GDB expanding many symtabs.  GDB was busy in a loop in
5654         cooked_index_functions::expand_symtabs_matching.  Add a QUIT there.  I
5655         also happened to see a spot in
5656         cooked_index_functions::expand_matching_symbols where a QUIT would be
5657         useful too, since we iterate over a potentially big number of index
5658         entries and expand CUs in the loop.  Add one there too.
5659
5660         Change-Id: Ie1d650381df7f944c16d841b3e592d2dce7306c3
5661         Approved-By: Kevin Buettner <kevinb@redhat.com>
5662
5663 2022-12-01  Simon Marchi  <simon.marchi@efficios.com>
5664
5665         gdb: remove prune_threads in thread_db_target::update_thread_list
5666         Pedro mentioned that this prune_threads call in
5667         thread_db_target::update_thread_list was not needed, and it was probably
5668         an oversight to leave it there in the work following commit e8032dde10b
5669         ("Push pruning old threads down to the target").  That commit changed
5670         the "find new threads" target operation to "update thread list", making
5671         the target responsible of adding new threads and removing exited
5672         threads, rather than just adding new threads.  Commit e8032dde10b moved
5673         the prune_threads calls previously done in common code into each
5674         target's update_thread_list method, in order to keep the existing
5675         behavior, which is why this prune_threads call ended up there.
5676
5677         In the mean time, the linux-nat target was taught to update_thread_list,
5678         and thread_db_target::update_thread_list defers to that for any live
5679         inferior, so the prune_threads call is not needed there.  Otherwise, the
5680         thread_db_target::update_thread_list implementation based on
5681         td_ta_thr_iter_p only knows how to add new threads, not how to delete
5682         exited threads, but that is only used for non-live inferiors, where
5683         threads can't exit anyway.  So the prune_threads call is not needed for
5684         that case either.
5685
5686         Change-Id: I127fd4f84c25086f97853dadf34c5cec6816840d
5687         Approved-By: Pedro Alves <pedro@palves.net>
5688
5689 2022-12-01  H.J. Lu  <hjl.tools@gmail.com>
5690
5691         opcodes: Remove i386-init.h and i386-tbl.h from HFILES
5692         i386-init.h and i386-tbl.h are generated files.  There is nothing to
5693         translate.  Remove them from HFILES (POTFILES).
5694
5695                 * Makefile.am (HFILES): Remove i386-init.h and i386-tbl.h.
5696                 * Makefile.in: Regenerated.
5697                 * po/POTFILES.in: Likewise.
5698
5699 2022-12-01  Tom Tromey  <tromey@adacore.com>
5700
5701         Avoid timeouts in gdb.compile
5702         PR compile/29541 points out that some of the C++ tests in gdb.compile
5703         will time out when the glibc debuginfo is installed.  This was
5704         interfering with my hacking on gdb by making test runs extremely long,
5705         so I looked into it.
5706
5707         Internally the bug seems to be that gdb tries to convert multiple
5708         symbols named "var" via the compiler interface; one such symbol (I
5709         didn't track it down too far) causes the C++ compiler plugin to crash.
5710
5711         Unfortunately, the crash is reported as a timeout, as the gdb side of
5712         the plugin simply hangs.  This seems like a bug in the plugin RPC
5713         mechanism and, worse, apparently when I wrote this stuff I didn't
5714         really consider error reporting very much at all, so gdb can't really
5715         detect failures in the first place.
5716
5717         Anyway... this patch works around the timeout by compiling a simple
5718         test that should provoke this bug, and then using "untested" if it
5719         notices a GCC crash.
5720
5721         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29541
5722
5723 2022-12-01  Tom Tromey  <tromey@adacore.com>
5724
5725         Remove obsolete check from skip_compile_feature_tests
5726         skip_compile_feature_tests checks for "Command not supported on this
5727         host", but this error was removed by commit e8d8cce6 ("Import mkdtemp
5728         gnulib module, fix mingw build").  This patch removes the obsolete
5729         test.
5730
5731         Remove one copy of skip_compile_feature_tests
5732         I noticed that there are two identical copies of
5733         skip_compile_feature_tests in the test suite.  This removes one from
5734         gdb.exp, in favor of the one in compile-support.exp.
5735
5736 2022-12-01  Clément Chigot  <chigot@adacore.com>
5737
5738         binutils: improve holes detection in .debug_loclists.
5739         The previous warnings about holes in .debug_loclists sections don't
5740         take into account the headers of each CU and could include the locviews
5741         if they precede the loclist.
5742
5743         The following warning can be triggered between two CU.
5744             ... <previous CU views> ...
5745             0000001d <End of list>
5746
5747             0000002a v000000000000000 v000000000000000 location view pair
5748             0000002c v000000000000000 v000000000000000 location view pair
5749
5750         readelf: Warning: There is a hole [0x1e - 0x2e] in .debug_loclists section.
5751             0000002e v000000000000000 v000000000000000 views at 0000002a for:
5752             ...
5753
5754         But [0x1e - 0x2a] corresponds to the CU header and  [0x2a - 0x2e] are
5755         the locviews.  Thus there is no hole here.
5756
5757         binutils/ChangeLog:
5758
5759                 * dwarf.c (display_debug_loc): Adjust holes detections for
5760                 headers and locviews.
5761
5762 2022-12-01  Nick Clifton  <nickc@redhat.com>
5763
5764         Fix verilog output when the width is > 1.
5765                 PR 25202
5766         bfd     * bfd.c (VerilogDataEndianness): New variable.
5767                 (verilog_write_record): Use VerilogDataEndianness, if set, to
5768                 choose the endianness of the output.
5769                 (verilog_write_section): Adjust the address by the data width.
5770
5771         binutils* objcopy.c (copy_object): Set VerilogDataEndianness to the
5772                 endianness of the input file.
5773                 (copy_main): Verifiy the value set by the --verilog-data-width
5774                 option.
5775                 * testsuite/binutils-all/objcopy.exp: Add tests of the new behaviour.
5776                 * testsuite/binutils-all/verilog-I4.hex: New file.
5777
5778 2022-12-01  Jan Beulich  <jbeulich@suse.com>
5779
5780         x86: rework of match_template()'s suffix checking
5781         (Ab)using i386_opcode_modifier for this has been overkill, as the logic
5782         doesn't really require the full structure. With the removal of
5783         LONG_DOUBLE_MNEM_SUFFIX and No_ldSuf there's no good reason at all
5784         anymore to pull out such a loop invariant: We're dealing a check of a
5785         bit in the loop for a simple comparison. Do the original compares inside
5786         the loop, thus also making it easier to understand what is actually
5787         being checked.
5788
5789         x86: drop No_ldSuf
5790         With LONG_DOUBLE_MNEM_SUFFIX gone there'salso no use for No_ldSuf
5791         anymore.
5792
5793         x86/Intel: drop LONG_DOUBLE_MNEM_SUFFIX
5794         With the removal of its use for FPU insns the suffix is now finally
5795         properly misnamed. Drop its use altogether, replacing it by a separate
5796         boolean instead.
5797
5798         x86/Intel: restrict use of LONG_DOUBLE_MNEM_SUFFIX
5799         As a comment near the top of match_template() already says: We really
5800         only need this pseudo-suffix for far branch handling. Stop "deriving" it
5801         for floating point insns. (Don't bother renaming the now properly
5802         misnamed LONG_DOUBLE_MNEM_SUFFIX, to e.g. FAR_BRANCH_SUFFIX - it's going
5803         to disappear anyway.)
5804
5805 2022-12-01  Tom de Vries  <tdevries@suse.de>
5806
5807         [gdb/testsuite] Wait longer for core generation
5808         When I run the gdb testsuite on a powerpc64le-linux system with (slow) nfs
5809         file system, I run into timeouts due to core generation, like for instance:
5810         ...
5811         (gdb) gcore $outputs/gdb.ada/task_switch_in_core/crash.gcore^M
5812         FAIL: gdb.ada/task_switch_in_core.exp: save a corefile (timeout)
5813         ...
5814
5815         Fix this by using with_timeout_factor 3 in gdb_gcore_cmd.
5816
5817         Tested on powerpc64le-linux.
5818         Approved-By: Tom Tromey <tom@tromey.com>
5819
5820 2022-12-01  Tom de Vries  <tdevries@suse.de>
5821
5822         [gdb/testsuite] Fix gdb.ada/float-bits.exp for powerpc64le
5823         On powerpc64le-linux, I run into:
5824         ...
5825         (gdb) print 16llf#4000921fb54442d18469898cc51701b8#^M
5826         $9 = <invalid float value>^M
5827         (gdb) FAIL: gdb.ada/float-bits.exp: print \
5828           16llf#4000921fb54442d18469898cc51701b8#
5829         ...
5830
5831         The problem is that we're using a hex string for the 128-bit IEEE quad long
5832         double format, but the actual long double float format is:
5833         ...
5834         gdbarch_dump: long_double_format = floatformat_ibm_long_double_little^M
5835         ...
5836
5837         Fix this by using the hex string obtained by compiling test.c:
5838         ...
5839         long double a = 5.0e+25L;
5840         ...
5841         like so:
5842         ...
5843         $ gcc -mlittle test.c -c -g
5844         ...
5845         and running gdb:
5846         ...
5847         $ gdb -q -batch test.o -ex "p /x a"
5848         $1 = 0xc1e1c000000000004544adf4b7320335
5849         ...
5850         and likewise for -mbig:
5851         ...
5852         $ gdb -q -batch test.o -ex "p /x a"
5853         $1 = 0x4544adf4b7320335c1e1c00000000000
5854         ...
5855
5856         Tested on powerpc64le-linux.
5857
5858         I excercised the case of floatformat_ibm_long_double_big by
5859         using "set endian big" in the test-case.
5860
5861         Note that for this patch to work correctly, recent commit aaa79cd62b8 ("[gdb]
5862         Improve printing of float formats") is required.
5863
5864         PR testsuite/29816
5865         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29816
5866         Approved-By: Tom Tromey <tom@tromey.com>
5867
5868 2022-12-01  GDB Administrator  <gdbadmin@sourceware.org>
5869
5870         Automatic date update in version.in
5871
5872 2022-11-30  Tom de Vries  <tdevries@suse.de>
5873
5874         [gdb/testsuite] Fix DUPLICATEs in s390-multiarch.exp
5875         On s390x-linux, I run into:
5876         ...
5877         DUPLICATE: gdb.arch/s390-multiarch.exp: Linux v2
5878         DUPLICATE: gdb.arch/s390-multiarch.exp: Linux v2
5879         DUPLICATE: gdb.arch/s390-multiarch.exp: Linux v2
5880         ...
5881
5882         Fix this by using with_test_prefix.
5883
5884         Tested on s390x-linux.
5885
5886 2022-11-30  Tom de Vries  <tdevries@suse.de>
5887
5888         [gdb/testsuite] Enable gdb.arch/s390-disassembler-options.exp for --enable-targets=all
5889         On s390x-linux, I run into:
5890         ...
5891         DUPLICATE: gdb.arch/s390-disassembler-options.exp: \
5892           show disassembler-options esa
5893         ...
5894
5895         First, reproduce this on x86_64-linux with --enable-targets=all, by replacing
5896         the test for 'istarget "s390*-*-*"' with a test for 'get_set_option_choices
5897         "set architecture" "s390"'.
5898
5899         Fix the DUPLICATE by using with_test_prefix.
5900
5901         Also modernize the test-case by using clean_restart instead of gdb_exit/gdb_start.
5902
5903         Tested on x86_64-linux.
5904
5905 2022-11-30  Michael Matz  <matz@suse.de>
5906
5907         section-select: Fix exclude-file-3
5908         this testcase wasn't correctly testing everything, it passed, even
5909         though sections from an excluded file were included.  Fixing this
5910         reveals a problem in the new section selector.  This fixes that as
5911         well.
5912
5913         section-select: Remove unused code
5914         walk_wild_file, hence walk_wild_section and walk_wild_section_handler
5915         aren't called with the prefix tree.  Hence initialization of the latter
5916         and all potential special cases for it aren't used anymore.  That also
5917         removes the need to handler_data[] and some associated helper functions.
5918         So, remove all of that.
5919
5920 2022-11-30  Michael Matz  <matz@suse.de>
5921
5922         section-select: Implement a prefix-tree
5923         Now that we have a list of potentially matching sections per wild
5924         statement we can actually pre-fill that one by going once over all input
5925         sections and match their names against a prefix-tree that points to the
5926         potentially matching wild statements.
5927
5928         So instead of looking at all sections names for each glob for each wild
5929         statement we now look at the sections only once and then only check
5930         against those globs that have a possibility of a match at all (usually
5931         only one or two).
5932
5933         This pushes the whole section selection off the profiles.
5934
5935 2022-11-30  Michael Matz  <matz@suse.de>
5936
5937         section-select: Completely rebuild matches
5938         The check_relocs callback (and others) might have created new
5939         section behind our back and some of them (e.g. on powerpc the
5940         "linker stubs" .got) need to come in front of all others, despite
5941         being created late (a symptom would be "TOC opt*" failing on powerpc).
5942
5943         This resets all section matches before updating for newly created
5944         sections (i.e. completely rebuilds the matches).
5945
5946 2022-11-30  Michael Matz  <matz@suse.de>
5947
5948         section-select: Lazily resolve section matches
5949         and remember the results.  Before this the order of section matching
5950         is basically:
5951
5952           foreach script-wild-stmt S
5953             foreach pattern P of S
5954               foreach inputfile I
5955                 foreach section S of I
5956                   match S against P
5957                     if match: do action for S
5958
5959         And this process is done three or four times: for each top-level call to
5960         walk_wild() or wild(), that is: check_input_sections, lang_gc_sections,
5961         lang_find_relro_sections and of course map_input_to_output_sections.
5962
5963         So we iterate over all sections of all files many many times (for each
5964         glob).  Reality is a bit more complicated (some special glob types don't
5965         need the full iteration over all sections, only over all files), but
5966         that's the gist of it.
5967
5968         For future work this shuffles the whole ordering a bit by lazily doing
5969         the matching process and memoizing results, trading a little memory for
5970         a 75% speedup of the overall section selection process.
5971
5972         This lazy resolution introduces a problem with sections added late
5973         that's corrected in the next patch.
5974
5975 2022-11-30  Tom Tromey  <tromey@adacore.com>
5976
5977         Bounds check access to Ada task state names
5978         While looking into Ada tasking a little, I noticed that no bounds
5979         checking is done on accesses to the Ada task state names arrays.  This
5980         isn't a problem currently, but if the runtime ever added numbers -- or
5981         if there was some kind of runtime corruption -- it could cause a gdb
5982         crash.
5983
5984         This patch adds range checking.  It also adds a missing _() call when
5985         printing from the 'task_states' array.
5986
5987 2022-11-30  Tom Tromey  <tromey@adacore.com>
5988
5989         Use ui_file_up in mi_interp
5990         This changes mi_interp to use ui_file_up rather than explicit
5991         management.
5992
5993         Approved-By: Simon Marchi <simon.marchi@efficios.com>
5994
5995 2022-11-30  Tom Tromey  <tromey@adacore.com>
5996
5997         Rename fields of cli_interp_base::saved_output_files
5998         This renames the fields of cli_interp_base::saved_output_files, as
5999         requested by Simon.  I tried to choose names that more obviously
6000         reflect what the field is used for.  I also added a couple of
6001         comments.
6002
6003         Approved-By: Simon Marchi <simon.marchi@efficios.com>
6004
6005 2022-11-30  Tom de Vries  <tdevries@suse.de>
6006
6007         [gdb] Improve printing of float formats
6008         Currently, on x86_64, a little endian target, I get:
6009         ...
6010         $ gdb -q -batch -ex "maint print architecture" | grep " = floatformat"
6011         gdbarch_dump: bfloat16_format = floatformat_bfloat16_big
6012         gdbarch_dump: double_format = floatformat_ieee_double_big
6013         gdbarch_dump: float_format = floatformat_ieee_single_big
6014         gdbarch_dump: half_format = floatformat_ieee_half_big
6015         gdbarch_dump: long_double_format = floatformat_i387_ext
6016         ...
6017         which suggests big endian.
6018
6019         This is due to this bit of code in pformat:
6020         ...
6021             /* Just print out one of them - this is only for diagnostics.  */
6022             return format[0]->name;
6023         ...
6024
6025         Fix this by using gdbarch_byte_order to pick the appropriate index, such that
6026         we have the more accurate:
6027         ...
6028         gdbarch_dump: bfloat16_format = floatformat_bfloat16_little
6029         gdbarch_dump: half_format = floatformat_ieee_half_little
6030         gdbarch_dump: float_format = floatformat_ieee_single_little
6031         gdbarch_dump: double_format = floatformat_ieee_double_little
6032         gdbarch_dump: long_double_format = floatformat_i387_ext
6033         ...
6034
6035         Tested on x86_64-linux.
6036
6037 2022-11-30  Alan Modra  <amodra@gmail.com>
6038
6039         Correct ordering problem in comm-data.exp
6040                 * testsuite/ld-elf/comm-data.exp: Build libcomm-data.so before
6041                 attempting to read it to set ELF64.
6042
6043         regen SRC-POTFILES.in
6044
6045 2022-11-30  Jan Beulich  <jbeulich@suse.com>
6046
6047         x86/Intel: adjustment to restricted suffix derivation
6048         In "x86/Intel: restrict suffix derivation" I think I screwed up
6049         slightly, bringing a piece of code out of sync with its comment, and
6050         resulting in a suffix potentially being derived when one isn't needed.
6051
6052 2022-11-30  Jan Beulich  <jbeulich@suse.com>
6053
6054         x86: clean up after removal of support for gcc <= 2.8.1
6055         At the very least a comment in process_operands() is stale. Beyond that
6056         there are effectively two options:
6057         1) It is possible that FADDP and FMULP were mistakenly not marked as
6058            being in need of dealing with the compiler anomaly, and hence the
6059            respective templates weren't removed at the time when they should
6060            have been.
6061         2) It is also possible that there are indeed uses known beyond compiler
6062            generated output for these two commutative opcodes, and hence the
6063            templates need to stay.
6064         To be on the safe side assume 2: Update the comment and fold the
6065         templates into their "normal" ones (utilizing D), adjusting consuming
6066         code accordingly.
6067
6068         For FMULP also add a comment paralleling a similar one FADDP has.
6069
6070 2022-11-30  Jan Beulich  <jbeulich@suse.com>
6071
6072         x86: drop FloatR
6073         There are just 4 templates using it, which can be easily identified by
6074         other means, as D is set only on a very limited number of FPU templates.
6075         Also move the respective conditional out of the code path taken by all
6076         "reverse match" insns (it probably should have been this way already
6077         before, to avoid the one conditional in the common case).
6078
6079         With this the templates which had FloatR dropped no longer differ from
6080         their AT&T syntax + mnemonic counterparts - the only difference is now
6081         which of the two would be recognized. For this, however, we don't need
6082         two templates - we can simply arrange the condition for setting
6083         Opcode_FloatR accordingly.
6084
6085 2022-11-30  Jan Beulich  <jbeulich@suse.com>
6086
6087         x86: extend FPU test coverage for AT&T / Intel mnemonic differences
6088         Before touching the templates, let's ensure we actually cover things:
6089         For one FSUB{,R} and FDIV{,R} would better be tested with operands in
6090         both possible orders. And then -mmnemonic=intel wasn't tested at all.
6091
6092 2022-11-30  Joel Brobecker  <brobecker@adacore.com>
6093
6094         src-release.sh: Fix gdb source tarball build failure due to libsframe
6095         This script was recently changed as follow:
6096
6097             | commit e619dddb3a45780ae66d762756882a3b896b617d
6098             | Date:   Tue Nov 15 15:07:13 2022 -0800
6099             | Subject: src-release.sh: Add libsframe
6100             |
6101             | Add libsframe to the list of top level directories that will be included
6102             | in a release.
6103
6104         Since then, the gdb source tarball has been failing with the error
6105         below during the "make configure-host configure-target" phase:
6106
6107             | make[3]: *** No rule to make target '../libsframe/libsframe.la',
6108             |     needed by 'libbfd.la'.  Stop.
6109             | make[3]: Leaving directory '/tmp/gdb-public/bfd'
6110
6111         This patch fixes the issue by adding libsframe to the list of
6112         GDB_SUPPORT_DIRS, similar to what was done for BINUTILS.
6113
6114         ChangeLog:
6115
6116                 * src-release.sh (GDB_SUPPORT_DIRS): Add libsframe.
6117
6118 2022-11-30  GDB Administrator  <gdbadmin@sourceware.org>
6119
6120         Automatic date update in version.in
6121
6122 2022-11-29  Tom de Vries  <tdevries@suse.de>
6123
6124         [gdb/testsuite] Fix gdb.base/vla-optimized-out.exp for ppc64le
6125         On powerpc64le-linux, I run into:
6126         ...
6127         (gdb) PASS: gdb.base/vla-optimized-out.exp: o1: printed optimized out vla
6128         p sizeof (a)^M
6129         $2 = <optimized out>^M
6130         (gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: \
6131           printed size of optimized out vla
6132         ...
6133
6134         The problem happens as follows.
6135
6136         In order to find the size of the optimized out vla, gdb needs to evaluate:
6137         ...
6138         <155> DW_AT_upper_bound : 13 byte block: f3 1 53 23 1 8 20 24 8 20 26 31 1c \
6139           (DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)); DW_OP_plus_uconst: 1;
6140            DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_lit1;
6141            DW_OP_minus)
6142         ...
6143
6144         When trying to evaluate DW_OP_GNU_entry_value, it looks for a call site
6145         matching the pc, but doesn't find it:
6146         ...
6147         $ gdb -q -batch outputs/gdb.base/vla-optimized-out/vla-optimized-out-o1 \
6148           -ex "break f1" -ex run -ex "set debug entry-values 1" -ex "print sizeof (a)"
6149         Breakpoint 1 at 0x1000067c: file vla-optimized-out.c, line 34.
6150
6151         Breakpoint 1, f1 (i=5) at vla-optimized-out.c:34
6152         34      }
6153         DW_OP_entry_value resolving cannot find DW_TAG_call_site 0x100006b0 in main
6154         $1 = <optimized out>
6155         ....
6156
6157         The call site lookup fails because the call site label .LVL4:
6158         ...
6159                 bl f1    # 11   *call_value_nonlocal_aixdi      [length = 8]
6160                 nop
6161         .LVL4:
6162         ...
6163         is not placed directly after the bl insn.  This is gcc PR target/107909.
6164
6165         However, after manually fixing the .s file we have instead:
6166         ...
6167         Cannot find matching parameter at DW_TAG_call_site 0x10000690 at main
6168         $1 = <optimized out>
6169         ...
6170         due to the fact that the call site has no call site parameters.
6171
6172         The call site does have a reference to the corresponding function f1, with
6173         parameter i, for which we find location list entries:
6174         ...
6175           0037 1000067c 10000680 (DW_OP_reg3 (r3))
6176           004a 10000680 10000690 (DW_OP_GNU_entry_value: (DW_OP_reg3 (r3));
6177                                   DW_OP_stack_value)
6178         ...
6179         and we could use the fact that the current pc is in the 1000067c-10000680
6180         range, and that that the range starts at the start of the function, to deduce
6181         that DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)) == DW_OP_reg3 (r3).
6182         But that's a non-trivial enhancement, filed as enhancement PR symtab/29836.
6183
6184         Fix this by allowing <optimized out> for target powerpc and the gcc compiler.
6185
6186         Reviewed-By: Carl Love <cel@us.ibm.com>
6187         Tested-By: Carl Love <cel@us.ibm.com>
6188         PR testsuite/29813
6189         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29813
6190
6191 2022-11-29  Simon Marchi  <simon.marchi@polymtl.ca>
6192
6193         gdb/testsuite: make gdb_unload use gdb_test_multiple
6194         In the failure seen by Philippe here:
6195
6196           https://inbox.sourceware.org/gdb-patches/20221120173024.3647464-1-philippe.waroquiers@skynet.be/
6197
6198         gdb_unload crashed GDB, leaving no trace in the test results.  Change it
6199         to use gdb_test_multiple, so that it leaves an UNRESOLVED result.  I
6200         think it is good practice anyway.
6201
6202         Make it return the result of gdb_test_multiple directly, change
6203         gdb.python/py-objfile.exp accordingly.
6204
6205         Change gdb.base/endian.exp as well to avoid duplicate test names.
6206
6207         Change gdb.base/gnu-debugdata.exp to avoid recording a test result,
6208         since gdb_unload does it already now.
6209
6210         Change-Id: I59a1e4947691330797e6ce23277942547c437a48
6211         Approved-By: Tom de Vries <tdevries@suse.de>
6212
6213 2022-11-29  Simon Marchi  <simon.marchi@polymtl.ca>
6214
6215         gdb/testsuite: make gdb_test_multiple return immediately if send_gdb fails
6216         In the failure seen by Philippe here:
6217
6218           https://inbox.sourceware.org/gdb-patches/20221120173024.3647464-1-philippe.waroquiers@skynet.be/
6219
6220         ... the testsuite only outputs PASSes, and an ERROR, resulting from an
6221         uncaught exception.  This is a bit sneaky, because ERRORs are not
6222         reported in the test summary.  In certain circumstances, it can be easy
6223         to miss.
6224
6225         Normally, gdb_test_multiple outputs an UNRESOLVED when GDB crashes.  But
6226         this is only if it manages to send the command, and it's that command
6227         that crashes GDB.  Here, the ERROR is due to the fact that GDB had
6228         already crashed by the time we entered gdb_test_multiple and tried to
6229         send a command.  GDB was crashed by the previous "file" command, sent by
6230         gdb_unload.  Because gdb_unload uses bare expect, it didn't record a
6231         test failure when crashing GDB (this will be addressed separately).
6232
6233         In this patch, I propose to make gdb_test_multiple call unresolved
6234         directly and return -1 send_gdb fails.  This way, if GDB is already
6235         crashed by the time we enter gdb_test_multiple, it will leave a trace in
6236         the test results in the form of an UNRESOLVED.  It will also spare us
6237         the not-so-useful-in-my-opinion TCL backtrace.
6238
6239         Before, it looks like:
6240
6241             ERROR: Couldn't send python print(objfile.filename) to GDB.
6242             ERROR: : spawn id exp9 not open
6243                 while executing
6244             "expect {
6245             -i exp9 -timeout 10
6246                     -re ".*A problem internal to GDB has been detected" {
6247                         fail "$message (GDB internal error)"
6248                         gdb_internal_error..."
6249                 ("uplevel" body line 1)
6250                 invoked from within
6251             "uplevel $body" NONE : spawn id exp9 not open
6252
6253         And after:
6254
6255             Couldn't send python print(objfile.filename) to GDB.
6256             UNRESOLVED: gdb.python/py-objfile.exp: objfile.filename after objfile is unloaded
6257
6258         Change-Id: I72af8dc0d687826fc3f76911c27a9e5f91b677ba
6259         Approved-By: Tom de Vries <tdevries@suse.de>
6260
6261 2022-11-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
6262
6263         gprofng: remove unused gprofng/src/DbeSession.cc.1
6264
6265 2022-11-29  Max Filippov  <jcmvbkbc@gmail.com>
6266
6267         xtensa: allow dynamic configuration
6268         Import include/xtensa-dynconfig.h that defines XCHAL_* macros as fields
6269         of a structure returned from the xtensa_get_config_v<x> function call.
6270         Define that structure and fill it with default parameter values
6271         specified in the include/xtensa-config.h.
6272         Define reusable function xtensa_load_config that tries to load
6273         configuration and return an address of an exported object from it.
6274         Define functions xtensa_get_config_v{1,2} that use xtensa_load_config
6275         to get structures xtensa_config_v{1,2}, either dynamically configured
6276         or the default.
6277
6278         bfd/
6279                 * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Append
6280                 xtensa-dynconfig.c.
6281                 * Makefile.in: Regenerate.
6282                 * configure: Regenerate.
6283                 * configure.ac (xtensa_elf32_be_vec, xtensa_elf32_le_vec): Add
6284                 xtensa-dynconfig.lo to the tb.
6285                 * elf32-xtensa.c (xtensa-config.h): Replace #include with
6286                 xtensa-dynconfig.h.
6287                 (XSHAL_ABI, XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): Remove
6288                 definitions.
6289                 * xtensa-dynconfig.c: New file.
6290                 * xtensa-isa.c (xtensa-dynconfig.h): New #include.
6291                 (xtensa_get_modules): New function.
6292                 (xtensa_isa_init): Call xtensa_get_modules instead of taking
6293                 address of global xtensa_modules.
6294
6295         gas/
6296                 * config/tc-xtensa.c (xtensa-config.h): Replace #include with
6297                 xtensa-dynconfig.h.
6298                 (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0, XTENSA_MARCH_EARLIEST):
6299                 Remove definitions.
6300                 * config/tc-xtensa.h (xtensa-config.h): Replace #include with
6301                 xtensa-dynconfig.h.
6302                 * config/xtensa-relax.c (xtensa-config.h): Replace #include with
6303                 xtensa-dynconfig.h.
6304                 (XCHAL_HAVE_WIDE_BRANCHES): Remove definition.
6305
6306         include/
6307                 * xtensa-dynconfig.h: New file.
6308
6309         ld/
6310                 * emultempl/xtensaelf.em (xtensa-config.h): Replace #include
6311                 with xtensa-dynconfig.h.
6312                 (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): Remove definitions.
6313
6314 2022-11-29  GDB Administrator  <gdbadmin@sourceware.org>
6315
6316         Automatic date update in version.in
6317
6318 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6319
6320         gdb/testsuite: remove use of then keyword from library files
6321         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6322         still a bunch of places in the testsuite where we make use of the
6323         'then' keyword, and sometimes these get copies into new tests, which
6324         just spreads poor practice.
6325
6326         This commit removes all use of the 'then' keyword from the testsuite
6327         library files (in boards/, config/, and lib/).  Previous commits have
6328         removed all uses of the 'then' keyword from the test script files,
6329         this commit just cleans up the library files.
6330
6331         There should be no changes in what is tested after this commit.
6332
6333 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6334
6335         gdb/testsuite: remove use of then keyword from gdb.*/*.exp scripts
6336         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6337         still a bunch of places in the testsuite where we make use of the
6338         'then' keyword, and sometimes these get copies into new tests, which
6339         just spreads poor practice.
6340
6341         This commit removes all use of the 'then' keyword from the remaining
6342         gdb.*/*.exp scripts.  Previous commits have done the bulk of this
6343         removal, this commit just handles the remaining directories that each
6344         contain a low number of instances.
6345
6346         There should be no changes in what is tested after this commit.
6347
6348 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6349
6350         gdb/testsuite: remove use of then keyword from gdb.multi/*.exp
6351         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6352         still a bunch of places in the testsuite where we make use of the
6353         'then' keyword, and sometimes these get copies into new tests, which
6354         just spreads poor practice.
6355
6356         This commit removes all use of the 'then' keyword from the gdb.multi/
6357         test script directory.
6358
6359         There should be no changes in what is tested after this commit.
6360
6361 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6362
6363         gdb/testsuite: remove use of then keyword from gdb.fortran/*.exp
6364         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6365         still a bunch of places in the testsuite where we make use of the
6366         'then' keyword, and sometimes these get copies into new tests, which
6367         just spreads poor practice.
6368
6369         This commit removes all use of the 'then' keyword from the gdb.fortran/
6370         test script directory.
6371
6372         There should be no changes in what is tested after this commit.
6373
6374 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6375
6376         gdb/testsuite: remove use of then keyword from gdb.disasm/*.exp
6377         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6378         still a bunch of places in the testsuite where we make use of the
6379         'then' keyword, and sometimes these get copies into new tests, which
6380         just spreads poor practice.
6381
6382         This commit removes all use of the 'then' keyword from the gdb.disasm/
6383         test script directory.
6384
6385         There should be no changes in what is tested after this commit.
6386
6387 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6388
6389         gdb/testsuite: remove use of then keyword from gdb.reverse/*.exp
6390         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6391         still a bunch of places in the testsuite where we make use of the
6392         'then' keyword, and sometimes these get copies into new tests, which
6393         just spreads poor practice.
6394
6395         This commit removes all use of the 'then' keyword from the gdb.reverse/
6396         test script directory.
6397
6398         There should be no changes in what is tested after this commit.
6399
6400 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6401
6402         gdb/testsuite: remove use of then keyword from gdb.trace/*.exp
6403         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6404         still a bunch of places in the testsuite where we make use of the
6405         'then' keyword, and sometimes these get copies into new tests, which
6406         just spreads poor practice.
6407
6408         This commit removes all use of the 'then' keyword from the gdb.trace/
6409         test script directory.
6410
6411         There should be no changes in what is tested after this commit.
6412
6413 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6414
6415         gdb/testsuite: remove use of then keyword from gdb.threads/*.exp
6416         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6417         still a bunch of places in the testsuite where we make use of the
6418         'then' keyword, and sometimes these get copies into new tests, which
6419         just spreads poor practice.
6420
6421         This commit removes all use of the 'then' keyword from the gdb.threads/
6422         test script directory.
6423
6424         There should be no changes in what is tested after this commit.
6425
6426 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6427
6428         gdb/testsuite: remove use of then keyword from gdb.python/*.exp
6429         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6430         still a bunch of places in the testsuite where we make use of the
6431         'then' keyword, and sometimes these get copies into new tests, which
6432         just spreads poor practice.
6433
6434         This commit removes all use of the 'then' keyword from the gdb.python/
6435         test script directory.
6436
6437         There should be no changes in what is tested after this commit.
6438
6439 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6440
6441         gdb/testsuite: remove use of then keyword from gdb.cp/*.exp
6442         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6443         still a bunch of places in the testsuite where we make use of the
6444         'then' keyword, and sometimes these get copies into new tests, which
6445         just spreads poor practice.
6446
6447         This commit removes all use of the 'then' keyword from the gdb.cp/
6448         test script directory.
6449
6450         There should be no changes in what is tested after this commit.
6451
6452 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6453
6454         gdb/testsuite: remove use of then keyword from gdb.arch/*.exp
6455         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6456         still a bunch of places in the testsuite where we make use of the
6457         'then' keyword, and sometimes these get copies into new tests, which
6458         just spreads poor practice.
6459
6460         This commit removes all use of the 'then' keyword from the gdb.arch/
6461         test script directory.
6462
6463         There should be no changes in what is tested after this commit.
6464
6465 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6466
6467         gdb/testsuite: remove use of then keyword from gdb.base/*.exp
6468         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6469         still a bunch of places in the testsuite where we make use of the
6470         'then' keyword, and sometimes these get copies into new tests, which
6471         just spreads poor practice.
6472
6473         This commit removes all use of the 'then' keyword from the gdb.base/
6474         test script directory.
6475
6476         There should be no changes in what is tested after this commit.
6477
6478 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6479
6480         gdb/testsuite: remove use of then keyword from gdb.ada/*.exp
6481         The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
6482         still a bunch of places in the testsuite where we make use of the
6483         'then' keyword, and sometimes these get copies into new tests, which
6484         just spreads poor practice.
6485
6486         This commit removes all use of the 'then' keyword from the gdb.ada/
6487         test script directory.
6488
6489         There should be no changes in what is tested after this commit.
6490
6491 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6492
6493         gdb/testsuite: remove DOS line endings from a test script
6494         The gdb.fortran/nested-funcs.exp test script has DOS line endings.  I
6495         can see no reason why this script needs DOS line endings.
6496
6497         Convert to UNIX line endings.
6498
6499         There should be no change in what is tested after this commit.
6500
6501 2022-11-28  Tom Tromey  <tromey@adacore.com>
6502
6503         Don't let gdb_stdlog use pager
6504         When using the "set logging" commands, cli_interp_base::set_logging
6505         will send gdb_stdlog output (among others) to the tee it makes for
6506         gdb_stdout.  However, this has the side effect of also causing logging
6507         to use the pager.  This is PR gdb/29787.
6508
6509         This patch fixes the problem by keeping stderr and stdlog separate
6510         from stdout, preserving the rule that only gdb_stdout should page.
6511
6512         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29787
6513
6514 2022-11-28  Tom Tromey  <tromey@adacore.com>
6515
6516         Don't let tee_file own a stream
6517         Right now, tee_file owns the second stream it writes to.  This is done
6518         for the convenience of the users.  In a subsequent patch, this will no
6519         longer be convenient, so this patch moves the responsibility for
6520         ownership to the users of tee_file.
6521
6522         Remove 'saved_output' global
6523         CLI redirect uses a global variable, 'saved_output'.  However, globals
6524         are generally bad, and there is no need for this one -- it can be a
6525         member of cli_interp_base.  This patch makes this change.
6526
6527 2022-11-28  Hannes Domani  <ssbssa@yahoo.de>
6528
6529         Remove no longer used jump label
6530         The out label is unused since wait_for_debug_event is in a different thread.
6531
6532         Actually set m_is_async to current async mode
6533         Looks like this was missed in the async mode implementation.
6534
6535 2022-11-28  Hannes Domani  <ssbssa@yahoo.de>
6536
6537         Don't use auto for lambda parameter
6538         Older gcc versions (here 4.9.2) can't handle auto for a lambda parameter:
6539
6540         ../../gdb/windows-nat.c: In member function 'void windows_nat_target::delete_thread(ptid_t, DWORD, bool)':
6541         ../../gdb/windows-nat.c:629:12: error: use of 'auto' in lambda parameter declaration only available with -std=c++1y or -std=gnu++1y [-Werror]
6542                 [=] (auto &th)
6543                     ^
6544
6545 2022-11-28  Hannes Domani  <ssbssa@yahoo.de>
6546
6547         Fix calling convention of thread entry point
6548         For i686 the CreateThread entry point function needs the WINAPI (stdcall)
6549         calling convention:
6550
6551         ../../gdb/windows-nat.c: In constructor 'windows_nat_target::windows_nat_target()':
6552         ../../gdb/windows-nat.c:450:56: error: invalid user-defined conversion from 'windows_nat_target::windows_nat_target()::<lambda(LPVOID)>' to 'LPTHREAD_START_ROUTINE' {aka 'long unsigned int (__attribute__((stdcall)) *)(void*)'} [-fpermissive]
6553           450 |   HANDLE bg_thread = CreateThread (nullptr, 64 * 1024, fn, this, 0, nullptr);
6554               |                                                        ^~
6555         ../../gdb/windows-nat.c:444:13: note: candidate is: 'constexpr windows_nat_target::windows_nat_target()::<lambda(LPVOID)>::operator DWORD (*)(LPVOID)() const' (near match)
6556           444 |   auto fn = [] (LPVOID self) -> DWORD
6557               |             ^
6558         ../../gdb/windows-nat.c:444:13: note:   no known conversion from 'DWORD (*)(LPVOID)' {aka 'long unsigned int (*)(void*)'} to 'LPTHREAD_START_ROUTINE' {aka 'long unsigned int (__attribute__((stdcall)) *)(void*)'}
6559
6560         Since it's not possible to change the calling convention of a lambda, I've
6561         moved it to a separate function.
6562
6563 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6564
6565         gdb: mark disassembler function callback types as noexcept
6566         In disasm.h we define a set of types that are used by the various
6567         disassembler classes to hold callback functions before passing the
6568         callbacks into libopcodes.
6569
6570         Because libopcodes is C code, and on some (many?) targets, C code is
6571         compiled without exception support, it is important that GDB not try
6572         to throw an exception over libopcode code.
6573
6574         In the previous commit all the existing callbacks were marked as
6575         noexcept, however, this doesn't protect us from a future change to GDB
6576         either adding a new callback that is not noexcept, or removing the
6577         noexcept keyword from an existing callback.
6578
6579         In this commit I mark all the callback types as noexcept.  This means
6580         that GDB's disassembler classes will no longer compile if we try to
6581         pass a callback that is not marked as noexcept.
6582
6583         At least, that's the idea.  Unfortunately, it's not that easy.
6584
6585         Before C++17, the noexcept keyword on a function typedef would be
6586         ignored, thus:
6587
6588           using func_type = void (*) (void) noexcept;
6589
6590           void
6591           a_func ()
6592           {
6593             throw 123;
6594           }
6595
6596           void
6597           some_func (func_type f)
6598           {
6599             f ();
6600           }
6601
6602           int
6603           main ()
6604           {
6605             some_func (a_func);
6606             return 0;
6607           }
6608
6609         Will compile just fine for C++11 and C++14 with GCC.  Clang on the
6610         other hand complains that 'noexcept' should not appear on function
6611         types, but then does appear to correctly complain that passing a_func
6612         is a mismatch in the set of exceptions that could be thrown.
6613
6614         Switching to C++17 and both GCC and Clang correctly point out that
6615         passing a_func is an invalid conversion relating to the noexcept
6616         keyword.  Changing a_func to:
6617
6618           void
6619           a_func () noexcept
6620           { /* Nothing.  */ }
6621
6622         And for C++17 both GCC and Clang compile this just fine.
6623
6624         My conclusion then is that adding the noexcept keyword to the function
6625         types is pointless while GDB is not compiled as C++17, and silencing
6626         the warnings would require us to jump through a bunch of hoops.
6627
6628         And so, in this commit, I define a macro LIBOPCODE_CALLBACK_NOEXCEPT,
6629         this macro expands to noexcept when compiling for C++17, but otherwise
6630         expands to nothing.  I then add this macro to the function types.
6631
6632         I've compiled GDB as the default C++11 and also forced the compile to
6633         C++17.  When compiling as C++17 I spotted a few additional places
6634         where callbacks needed to be marked noexcept (these fixes were merged
6635         into the previous commit, but this confirmed to be that the macro is
6636         working as expected).
6637
6638 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6639
6640         gdb/disasm: mark functions passed to the disassembler noexcept
6641         While working on another patch, Simon pointed out that GDB could be
6642         improved by marking the functions passed to the disassembler as
6643         noexcept.
6644
6645           https://sourceware.org/pipermail/gdb-patches/2022-October/193084.html
6646
6647         The reason this is important is the on some hosts, libopcodes, being C
6648         code, will not be compiled with support for handling exceptions.  As
6649         such, an attempt to throw an exception over libopcodes code will cause
6650         GDB to terminate.
6651
6652         See bug gdb/29712 for an example of when this happened.
6653
6654         In this commit all the functions that are passed to the disassembler,
6655         and which might be used as callbacks by libopcodes are marked
6656         noexcept.
6657
6658         Ideally, I would have liked to change these typedefs:
6659
6660           using read_memory_ftype = decltype (disassemble_info::read_memory_func);
6661           using memory_error_ftype = decltype (disassemble_info::memory_error_func);
6662           using print_address_ftype = decltype (disassemble_info::print_address_func);
6663           using fprintf_ftype = decltype (disassemble_info::fprintf_func);
6664           using fprintf_styled_ftype = decltype (disassemble_info::fprintf_styled_func);
6665
6666         which are declared in disasm.h, as including the noexcept keyword.
6667         However, when I tried this, I ran into this warning/error:
6668
6669           In file included from ../../src/gdb/disasm.c:25:
6670           ../../src/gdb/disasm.h: In constructor ‘gdb_printing_disassembler::gdb_printing_disassembler(gdbarch*, ui_file*, gdb_disassemble_info::read_memory_ftype, gdb_disassemble_info::memory_error_ftype, gdb_disassemble_info::print_address_ftype)’:
6671           ../../src/gdb/disasm.h:116:3: error: mangled name for ‘gdb_printing_disassembler::gdb_printing_disassembler(gdbarch*, ui_file*, gdb_disassemble_info::read_memory_ftype, gdb_disassemble_info::memory_error_ftype, gdb_disassemble_info::print_address_ftype)’ will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
6672             116 |   gdb_printing_disassembler (struct gdbarch *gdbarch,
6673                 |   ^~~~~~~~~~~~~~~~~~~~~~~~~
6674
6675         So I've left that change out.  This does mean that if somebody adds a
6676         new use of the disassembler classes in the future, and forgets to mark
6677         the callbacks as noexcept, this will compile fine.  We'll just have to
6678         manually check for that during review.
6679
6680 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6681
6682         gdb/python: avoid throwing an exception over libopcodes code
6683         Bug gdb/29712 identifies a problem with the Python disassembler API.
6684         In some cases GDB will try to throw an exception through the
6685         libopcodes disassembler code, however, not all targets include
6686         exception unwind information when compiling C code, for targets that
6687         don't include this information GDB will terminate when trying to pass
6688         the exception through libopcodes.
6689
6690         To explain what GDB is trying to do, consider the following trivial
6691         use of the Python disassembler API:
6692
6693           class ExampleDisassembler(gdb.disassembler.Disassembler):
6694
6695               class MyInfo(gdb.disassembler.DisassembleInfo):
6696                   def __init__(self, info):
6697                       super().__init__(info)
6698
6699                   def read_memory(self, length, offset):
6700                       return super().read_memory(length, offset)
6701
6702               def __init__(self):
6703                   super().__init__("ExampleDisassembler")
6704
6705               def __call__(self, info):
6706                   info = self.MyInfo(info)
6707                   return gdb.disassembler.builtin_disassemble(info)
6708
6709         This disassembler doesn't add any value, it defers back to GDB to do
6710         all the actual work, but it serves to allow us to discuss the problem.
6711
6712         The problem occurs when a Python exception is raised by the
6713         MyInfo.read_memory method.  The MyInfo.read_memory method is called
6714         from the C++ function gdbpy_disassembler::read_memory_func.  The C++
6715         stack at the point this function is called looks like this:
6716
6717           #0  gdbpy_disassembler::read_memory_func (memaddr=4198805, buff=0x7fff9ab9d2a8 "\220ӹ\232\377\177", len=1, info=0x7fff9ab9d558) at ../../src/gdb/python/py-disasm.c:510
6718           #1  0x000000000104ba06 in fetch_data (info=0x7fff9ab9d558, addr=0x7fff9ab9d2a9 "ӹ\232\377\177") at ../../src/opcodes/i386-dis.c:305
6719           #2  0x000000000104badb in ckprefix (ins=0x7fff9ab9d100) at ../../src/opcodes/i386-dis.c:8571
6720           #3  0x000000000104e28e in print_insn (pc=4198805, info=0x7fff9ab9d558, intel_syntax=-1) at ../../src/opcodes/i386-dis.c:9548
6721           #4  0x000000000104f4d4 in print_insn_i386 (pc=4198805, info=0x7fff9ab9d558) at ../../src/opcodes/i386-dis.c:9949
6722           #5  0x00000000004fa7ea in default_print_insn (memaddr=4198805, info=0x7fff9ab9d558) at ../../src/gdb/arch-utils.c:1033
6723           #6  0x000000000094fe5e in i386_print_insn (pc=4198805, info=0x7fff9ab9d558) at ../../src/gdb/i386-tdep.c:4072
6724           #7  0x0000000000503d49 in gdbarch_print_insn (gdbarch=0x5335560, vma=4198805, info=0x7fff9ab9d558) at ../../src/gdb/gdbarch.c:3351
6725           #8  0x0000000000bcc8c6 in disasmpy_builtin_disassemble (self=0x7f2ab07f54d0, args=0x7f2ab0789790, kw=0x0) at ../../src/gdb/python/py-disasm.c:324
6726
6727           ### ... snip lots of frames as we pass through Python itself ...
6728
6729           #22 0x0000000000bcd860 in gdbpy_print_insn (gdbarch=0x5335560, memaddr=0x401195, info=0x7fff9ab9e3c8) at ../../src/gdb/python/py-disasm.c:783
6730           #23 0x00000000008995a5 in ext_lang_print_insn (gdbarch=0x5335560, address=0x401195, info=0x7fff9ab9e3c8) at ../../src/gdb/extension.c:939
6731           #24 0x0000000000741aaa in gdb_print_insn_1 (gdbarch=0x5335560, vma=0x401195, info=0x7fff9ab9e3c8) at ../../src/gdb/disasm.c:1078
6732           #25 0x0000000000741bab in gdb_disassembler::print_insn (this=0x7fff9ab9e3c0, memaddr=0x401195, branch_delay_insns=0x0) at ../../src/gdb/disasm.c:1101
6733
6734         So gdbpy_disassembler::read_memory_func is called from the libopcodes
6735         disassembler to read memory, this C++ function then calls into user
6736         supplied Python code to do the work.
6737
6738         If the user supplied Python code raises an gdb.MemoryError exception
6739         indicating the memory read failed, this is fine.  The C++ code
6740         converts this exception back into a return value that libopcodes can
6741         understand, and returns to libopcodes.
6742
6743         However, if the user supplied Python code raises some other exception,
6744         what we want is for this exception to propagate through GDB and appear
6745         as if raised by the call to gdb.disassembler.builtin_disassemble.  To
6746         achieve this, when gdbpy_disassembler::read_memory_func spots an
6747         unknown Python exception, we must pass the information about this
6748         exception from frame #0 to frame #8 in the above backtrace.  Frame #8
6749         is the C++ implementation of gdb.disassembler.builtin_disassemble, and
6750         so it is this function that we want to re-raise the unknown Python
6751         exception, so the user can, if they want, catch the exception in their
6752         code.
6753
6754         The previous mechanism by which the exception was passed was to pack
6755         the details of the Python exception into a C++ exception, then throw
6756         the exception from frame #0, and catch the exception in frame #8,
6757         unpack the details of the Python exception, and re-raise it.
6758
6759         However, this relies on the exception passing through frames #1 to #7,
6760         some of which are in libopcodes, which is C code, and so, might not be
6761         compiled with exception support.
6762
6763         This commit proposes an alternative solution that does not rely on
6764         throwing a C++ exception.
6765
6766         When we spot an unhandled Python exception in frame #0, we will store
6767         the details of this exception within the gdbpy_disassembler object
6768         currently in use.  Then we return to libopcodes a value indicating
6769         that the memory_read failed.
6770
6771         libopcodes will now continue to disassemble as though that memory read
6772         failed (with one special case described below), then, when we
6773         eventually return to disasmpy_builtin_disassemble we check to see if
6774         there is an exception stored in the gdbpy_disassembler object.  If
6775         there is then this exception can immediately be installed, and then we
6776         return back to Python, when the user will be able to catch the
6777         exception.
6778
6779         There is one extra change in gdbpy_disassembler::read_memory_func.
6780         After the first call that results in an exception being stored on the
6781         gdbpy_disassembler object, any future calls to the ::read_memory_func
6782         function will immediately return as if the read failed.  This avoids
6783         any additional calls into user supplied Python code.
6784
6785         My thinking here is that should the first call fail with some unknown
6786         error, GDB should not keep trying with any additional calls.  This
6787         maintains the illusion that the exception raised from
6788         MyInfo.read_memory is immediately raised by
6789         gdb.disassembler.builtin_disassemble.  I have no tests for this change
6790         though - to trigger this issue would rely on a libopcodes disassembler
6791         that will try to read further memory even after the first failed
6792         read.  I'm not aware of any such disassembler that currently does
6793         this, but that doesn't mean such a disassembler couldn't exist in the
6794         future.
6795
6796         With this change in place the gdb.python/py-disasm.exp test should now
6797         pass on AArch64.
6798
6799         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29712
6800
6801         Approved-By: Simon Marchi <simon.marchi@efficios.com>
6802
6803 2022-11-28  Tom Tromey  <tom@tromey.com>
6804
6805         Remove reset_ecs and execution_control_state::reset
6806         I noticed that execution_control_state has a 'reset' method, and
6807         there's also a 'reset_ecs' function that calls it.  This patch cleans
6808         this area up a little by adding a parameter to the constructor and (a
6809         change Simon suggested) removing the reset method.  Some extraneous
6810         variables are also removed, like:
6811
6812         -      struct execution_control_state ecss;
6813         -      struct execution_control_state *ecs = &ecss;
6814
6815         Here 'ecs' is never changed, so this patch removes it entirely in
6816         favor of just using the object everywhere.
6817
6818         Regression tested on x86-64 Fedora 34.
6819
6820         Approved-By: Simon Marchi <simon.marchi@efficios.com>
6821
6822 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
6823
6824         gdb: relax requirement for the map_failed stap probe to be present
6825         From glibc 2.35 and later, the "map_failed" stap probe is no longer
6826         included in glibc.  The removal of the probe looks like an accident,
6827         but it was caused by a glibc commit which meant that the "map_failed"
6828         probe could no longer be reached; the compiler then helpfully
6829         optimised out the probe.
6830
6831         In GDB, in solib-svr4.c, we have a list of probes that we look for
6832         related to the shared library loading detection.  If any of these
6833         probes are missing then GDB will fall back to the non-probe based
6834         mechanism for detecting shared library loading.  The "map_failed"
6835         probe is include in the list of required probes.
6836
6837         This means that on glibc 2.35 (or later) systems, GDB is going to
6838         always fall back to the non-probes based mechanism for detecting
6839         shared library loading.
6840
6841         I raised a glibc bug to discuss this issue:
6842
6843           https://sourceware.org/bugzilla/show_bug.cgi?id=29818
6844
6845         But, whatever the ultimate decision from the glibc team, given there
6846         are version of glibc in the wild without the "map_failed" probe, we
6847         probably should update GDB to handle this situation.
6848
6849         The "map_failed" probe is already a little strange, very early
6850         versions of glibc didn't include this probe, so, in some cases, if
6851         this probe is missing GDB is happy to ignore it.  This is fine, the
6852         action associated with this probe inside GDB is DO_NOTHING, this means
6853         the probe isn't actually required in order for GDB to correctly detect
6854         the loading of shared libraries.
6855
6856         In this commit I propose changing the rules so that any probe whose
6857         action is DO_NOTHING, is optional.
6858
6859         There is one possible downside to this change, and that concerns 'set
6860         stop-on-solib-events on'.  If a probe is removed from glibc, but the
6861         old style breakpoint based mechanism is still in place within glibc
6862         for that same event, then GDB will stop when using the old style
6863         non-probe based mechanism, but not when using the probes based
6864         mechanism.
6865
6866         For the map_failed case this is not a problem, both the map_failed
6867         probe, and the call to the old style breakpoint location were
6868         optimised out, and so neither event (probes based, or breakpoint
6869         based) will trigger.  This would only become an issue if glibc removed
6870         a probe, but left the breakpoint in place (this would almost certainly
6871         be a bug in glibc).
6872
6873         For now, I'm proposing that we just don't worry about this.  Because
6874         some probes have actions that are not DO_NOTHING, then we know the
6875         user will always seem _some_ stops when a shared library is
6876         loaded/unloaded, and (I'm guessing), in most cases, that's all they
6877         care about.  I figure when someone complains then we can figure out
6878         what the right solution is then.
6879
6880         With this commit in place, then, when using a glibc 2.35 or later
6881         system, GDB will once again use the stap probes for shared library
6882         detection.
6883
6884         Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
6885
6886 2022-11-28  Tom de Vries  <tdevries@suse.de>
6887
6888         [gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp
6889         On powerpc64le-linux I run into:
6890         ...
6891         (gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting breakpoint
6892         watch -location value task 3^M
6893         Watchpoint 2: -location value^M
6894         (gdb) PASS: gdb.ada/task_watch.exp: watch -location value task 3
6895         continue^M
6896         Continuing.^M
6897         [Thread 0x7ffff7ccf170 (LWP 65550) exited]^M
6898         [Thread 0x7ffff7abf170 (LWP 65551) exited]^M
6899         FAIL: gdb.ada/task_watch.exp: continue to watchpoint (timeout)
6900         ...
6901
6902         On x86_64-linux (where the test-case passes), a hardware watchpoint is used:
6903         ...
6904         (gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting breakpoint
6905         watch -location value task 3^M
6906         Hardware watchpoint 2: -location value^M
6907         ...
6908         and after forcing "set can-use-hw-watchpoints 0" we can intermittently
6909         reproduce the same failure.
6910
6911         In the gdb documentation related to watchpoints in multi-threaded programs, we
6912         read:
6913         ...
6914         Warning: In multi-threaded programs, software watchpoints have only limited
6915         usefulness.  If GDB creates a software watchpoint, it can only watch the value
6916         of an expression in a single thread.  If you are confident that the expression
6917         can only change due to the current thread’s activity (and if you are also
6918         confident that no other thread can become current), then you can use software
6919         watchpoints as usual.  However, GDB may not notice when a non-current thread’s
6920         activity changes the expression.  (Hardware watchpoints, in contrast, watch an
6921         expression in all threads.)
6922         ...
6923
6924         Since the ada task construct is mapped onto threads, it seems that the
6925         same limitation holds for tasks.
6926
6927         Fix this by using skip_hw_watchpoint_tests.
6928
6929         Tested on powerpc64-linux.
6930         Tested-By: Carl Love <cel@us.ibm.com>
6931
6932 2022-11-28  Tom de Vries  <tdevries@suse.de>
6933
6934         [gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp for ppc64le
6935         On powerpc64le-linux, with test-case gdb.ada/out_of_line_in_inlined.exp I run
6936         into:
6937         ...
6938         (gdb) run ^M
6939         Starting program: foo_o224_021-all ^M
6940         ^M
6941         Breakpoint 1, 0x0000000010002f48 in foo_o224_021.child1.child2 (s=...) at \
6942           foo_o224_021.adb:24^M
6943         24              function Child2 (S : String) return Boolean is -- STOP^M
6944         (gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
6945           run to foo_o224_021.child1.child2
6946         ...
6947
6948         The breakpoint is correctly set at the local entry point, and given that the
6949         local entry point doesn't correspond to a line number entry, the instruction
6950         address of the breakpoint is shown.
6951
6952         The problem is that test-case doesn't expect the breakpoint address.
6953
6954         Fix this by allowing the breakpoint address to occur.
6955
6956         Tested on powerpc64le-linux.
6957
6958 2022-11-28  Michael Matz  <matz@suse.de>
6959
6960         Only use wild_sort_fast
6961         there's no reason why the tree-based variant can't always be used
6962         when sorting is required, it merely needs to also support filename
6963         sorting and have a fast path for insertion at end (aka rightmost tree
6964         leaf).
6965
6966         The filename sorting isn't tested anywhere and the only scripttempl
6967         that uses it is avr (for 'SORT(*)(.ctors)'), and I believe even there it
6968         was a mistake.  Either way, this adds a testcase for filename sorting as
6969         well.
6970
6971         Then the non-BST based sorting can be simplified to only support
6972         the fast case of no sorting required at all (at the same time renaming
6973         the two variants to _sort and _nosort).
6974
6975 2022-11-28  Michael Matz  <matz@suse.de>
6976
6977         Special case more simple patterns
6978         fnmatch is slow, so avoiding it in more cases is good.  This implements
6979         a more generic version of match_simple_wild which needs some
6980         pre-processing of patterns.  In particular it supports patterns of the
6981         form PREFIX*SUFFIX (where all parts are optional), i.e. a super set of
6982         what's handled now.  Most section matchers of this form and hence don't
6983         need any calls to fnmatch anymore.
6984
6985         We retain the implementation of match_simple_wild for the filename
6986         matchers (they aren't called often enough to matter).
6987
6988 2022-11-28  Simon Marchi  <simon.marchi@polymtl.ca>
6989
6990         gdb/testsuite: fail if gdb_start_cmd fails
6991         I broke gdb.ada/start.exp, and did not notice it, because it outputs an
6992         UNTESTED if gdb_start_cmd fails.  I don't really see when start would
6993         fail and it's not a problem that should be looked at.  Change all spots
6994         that call untested after a gdb_start_cmd failure, use fail instead.
6995
6996         Doing so caused some failures with the native-gdbserver board.  Some
6997         tests that use "start" were relying on the fact that start would fail
6998         with that board to just return with "untested".  Change them to add an
6999         early return if use_gdb_stub returns true.
7000
7001         Some gdb.pascal tests also failed with native-gdbserver, because they
7002         did use gdb_start_cmd to start the inferior, for no good reason.
7003         Convert them to use runto_main instead, which does the right thing if
7004         the target is a stub.
7005
7006         A further refactoring could be to make gdb_start_cmd match the expected
7007         breakpoint hit and the prompt, which it doesn't do currently (it leaves
7008         that to the callers, but not all of them do).
7009
7010         Change-Id: I097370851213e798ff29fb6cf8ba25ef7d2be007
7011         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
7012         Approved-By: Andrew Burgess <aburgess@redhat.com>
7013
7014 2022-11-28  Tom Tromey  <tromey@adacore.com>
7015
7016         Fix range type signed-ness heuristic
7017         The code to create a range type has a heuristic to decide whether the
7018         range is unsigned.  However, this heuristic can fail if the upper
7019         bound of the range has its high bit set, because the test is done
7020         using LONGEST.
7021
7022         With this patch, if the underlying type of a range is unsigned, then
7023         the range will always be unsigned.  A new test is included.
7024
7025         Regression tested on x86-64 Fedora 34.  We've also been using this
7026         internally at AdaCore for a while.
7027
7028 2022-11-28  Simon Marchi  <simon.marchi@efficios.com>
7029
7030         gdb: disable commit resumed in target_kill
7031         New in this version:
7032
7033          - Better comment in target_kill
7034          - Uncomment line in test to avoid hanging when exiting, when testing on
7035            native-extended-gdbserver
7036
7037         PR 28275 shows that doing a sequence of:
7038
7039          - Run inferior in background (run &)
7040          - kill that inferior
7041          - Run again
7042
7043         We get into this assertion:
7044
7045             /home/smarchi/src/binutils-gdb/gdb/target.c:2590: internal-error: target_wait: Assertion `!proc_target->commit_resumed_state' failed.
7046
7047             #0  internal_error_loc (file=0x5606b344e740 "/home/smarchi/src/binutils-gdb/gdb/target.c", line=2590, fmt=0x5606b344d6a0 "%s: Assertion `%s' failed.") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:54
7048             #1  0x00005606b6296475 in target_wait (ptid=..., status=0x7fffb9390630, options=...) at /home/smarchi/src/binutils-gdb/gdb/target.c:2590
7049             #2  0x00005606b5767a98 in startup_inferior (proc_target=0x5606bfccb2a0 <the_amd64_linux_nat_target>, pid=3884857, ntraps=1, last_waitstatus=0x0, last_ptid=0x0) at /home/smarchi/src/binutils-gdb/gdb/nat/fork-inferior.c:482
7050             #3  0x00005606b4e6c9c5 in gdb_startup_inferior (pid=3884857, num_traps=1) at /home/smarchi/src/binutils-gdb/gdb/fork-child.c:132
7051             #4  0x00005606b50f14a5 in inf_ptrace_target::create_inferior (this=0x5606bfccb2a0 <the_amd64_linux_nat_target>, exec_file=0x604000039f50 "/home/smarchi/build/binutils-gdb/gdb/test", allargs="", env=0x61500000a580, from_tty=1)
7052                 at /home/smarchi/src/binutils-gdb/gdb/inf-ptrace.c:105
7053             #5  0x00005606b53b6d23 in linux_nat_target::create_inferior (this=0x5606bfccb2a0 <the_amd64_linux_nat_target>, exec_file=0x604000039f50 "/home/smarchi/build/binutils-gdb/gdb/test", allargs="", env=0x61500000a580, from_tty=1)
7054                 at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:978
7055             #6  0x00005606b512b79b in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at /home/smarchi/src/binutils-gdb/gdb/infcmd.c:468
7056             #7  0x00005606b512c236 in run_command (args=0x0, from_tty=1) at /home/smarchi/src/binutils-gdb/gdb/infcmd.c:526
7057
7058         When running the kill command, commit_resumed_state for the
7059         process_stratum_target (linux-nat, here) is true.  After the kill, when
7060         there are no more threads, commit_resumed_state is still true, as
7061         nothing touches this flag during the kill operation.  During the
7062         subsequent run command, run_command_1 does:
7063
7064             scoped_disable_commit_resumed disable_commit_resumed ("running");
7065
7066         We would think that this would clear the commit_resumed_state flag of
7067         our native target, but that's not the case, because
7068         scoped_disable_commit_resumed iterates on non-exited inferiors in order
7069         to find active process targets.  And after the kill, the inferior is
7070         exited, and the native target was unpushed from it anyway.  So
7071         scoped_disable_commit_resumed doesn't touch the commit_resumed_state
7072         flag of the native target, it stays true.  When reaching target_wait, in
7073         startup_inferior (to consume the initial expect stop events while the
7074         inferior is starting up and working its way through the shell),
7075         commit_resumed_state is true, breaking the contract saying that
7076         commit_resumed_state is always false when calling the targets' wait
7077         method.
7078
7079         (note: to be correct, I think that startup_inferior should toggle
7080         commit_resumed between the target_wait and target_resume calls, but I'll
7081         ignore that for now)
7082
7083         I can see multiple ways to fix this.  In the end, we need
7084         commit_resumed_state to be cleared by the time we get to that
7085         target_wait.  It could be done at the end of the kill command, or at the
7086         beginning of the run command.
7087
7088         To keep things in a coherent state, I'd like to make it so that after
7089         the kill command, when the target is left with no threads, its
7090         commit_resumed_state flag is left to false.  This way, we can keep
7091         working with the assumption that a target with no threads (and therefore
7092         no running threads) has commit_resumed_state == false.
7093
7094         Do this by adding a scoped_disable_commit_resumed in target_kill.  It
7095         clears the target's commit_resumed_state on entry, and leaves it false
7096         if the target does not have any resumed thread on exit.  That means,
7097         even if the target has another inferior with stopped threads,
7098         commit_resumed_state will be left to false, which makes sense.
7099
7100         Add a test that tries to cover various combinations of actions done
7101         while an inferior is running (and therefore while commit_resumed_state
7102         is true on the process target).
7103
7104         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28275
7105         Change-Id: I8e6fe6dc1f475055921520e58cab68024039a1e9
7106         Approved-By: Andrew Burgess <aburgess@redhat.com>
7107
7108 2022-11-28  Simon Marchi  <simon.marchi@efficios.com>
7109
7110         gdbserver: switch to right process in find_one_thread
7111         New in this version: add a dedicated test.
7112
7113         When I do this:
7114
7115             $ ./gdb -nx --data-directory=data-directory -q \
7116                 /bin/sleep \
7117                 -ex "maint set target-non-stop on" \
7118                 -ex "tar ext :1234" \
7119                 -ex "set remote exec-file /bin/sleep" \
7120                 -ex "run 1231 &" \
7121                 -ex add-inferior \
7122                 -ex "inferior 2"
7123             Reading symbols from /bin/sleep...
7124             (No debugging symbols found in /bin/sleep)
7125             Remote debugging using :1234
7126             Starting program: /bin/sleep 1231
7127             Reading /lib64/ld-linux-x86-64.so.2 from remote target...
7128             warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
7129             Reading /lib64/ld-linux-x86-64.so.2 from remote target...
7130             Reading /usr/lib/debug/.build-id/a6/7a1408f18db3576757eea210d07ba3fc560dff.debug from remote target...
7131             [New inferior 2]
7132             Added inferior 2 on connection 1 (extended-remote :1234)
7133             [Switching to inferior 2 [<null>] (<noexec>)]
7134             (gdb) Reading /lib/x86_64-linux-gnu/libc.so.6 from remote target...
7135             attach 3659848
7136             Attaching to process 3659848
7137             /home/smarchi/src/binutils-gdb/gdb/thread.c:85: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed.
7138
7139         Note the "attach" command just above.  When doing it on the command-line
7140         with a -ex switch, the bug doesn't trigger.
7141
7142         The internal error of GDB is actually caused by GDBserver crashing, and
7143         the error recovery of GDB is not on point.  This patch aims to fix just
7144         the GDBserver crash, not the GDB problem.
7145
7146         GDBserver crashes with a segfault here:
7147
7148             (gdb) bt
7149             #0  0x00005555557fb3f4 in find_one_thread (ptid=...) at /home/smarchi/src/binutils-gdb/gdbserver/thread-db.cc:177
7150             #1  0x00005555557fd5cf in thread_db_thread_handle (ptid=<error reading variable: Cannot access memory at address 0xffffffffffffffa0>, handle=0x7fffffffc400, handle_len=0x7fffffffc3f0)
7151                 at /home/smarchi/src/binutils-gdb/gdbserver/thread-db.cc:461
7152             #2  0x000055555578a0b6 in linux_process_target::thread_handle (this=0x5555558a64c0 <the_x86_target>, ptid=<error reading variable: Cannot access memory at address 0xffffffffffffffa0>, handle=0x7fffffffc400,
7153                 handle_len=0x7fffffffc3f0) at /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:6905
7154             #3  0x00005555556dfcc6 in handle_qxfer_threads_worker (thread=0x60b000000510, buffer=0x7fffffffc8a0) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1645
7155             #4  0x00005555556e00e6 in operator() (__closure=0x7fffffffc5e0, thread=0x60b000000510) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1696
7156             #5  0x00005555556f54be in for_each_thread<handle_qxfer_threads_proper(buffer*)::<lambda(thread_info*)> >(struct {...}) (func=...) at /home/smarchi/src/binutils-gdb/gdbserver/gdbthread.h:159
7157             #6  0x00005555556e0242 in handle_qxfer_threads_proper (buffer=0x7fffffffc8a0) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1694
7158             #7  0x00005555556e04ba in handle_qxfer_threads (annex=0x629000000213 "", readbuf=0x621000019100 '\276' <repeats 200 times>..., writebuf=0x0, offset=0, len=4097)
7159                 at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1732
7160             #8  0x00005555556e1989 in handle_qxfer (own_buf=0x629000000200 "qXfer:threads", packet_len=26, new_packet_len_p=0x7fffffffd630) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:2045
7161             #9  0x00005555556e720a in handle_query (own_buf=0x629000000200 "qXfer:threads", packet_len=26, new_packet_len_p=0x7fffffffd630) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:2685
7162             #10 0x00005555556f1a01 in process_serial_event () at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4176
7163             #11 0x00005555556f4457 in handle_serial_event (err=0, client_data=0x0) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4514
7164             #12 0x0000555555820f56 in handle_file_event (file_ptr=0x607000000250, ready_mask=1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:573
7165             #13 0x0000555555821895 in gdb_wait_for_event (block=1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:694
7166             #14 0x000055555581f533 in gdb_do_one_event (mstimeout=-1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:264
7167             #15 0x00005555556ec9fb in start_event_loop () at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3512
7168             #16 0x00005555556f0769 in captured_main (argc=4, argv=0x7fffffffe0d8) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3992
7169             #17 0x00005555556f0e3f in main (argc=4, argv=0x7fffffffe0d8) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4078
7170
7171         The reason is a wrong current process when find_one_thread is called.
7172         The current process is the 2nd one, which was just attached.  It does
7173         not yet have thread_db data (proc->priv->thread_db is nullptr).  As we
7174         iterate on all threads of all process to fulfull the qxfer:threads:read
7175         request, we get to a thread of process 1 for which we haven't read
7176         thread_db information yet (lwp_info::thread_known is false), so we get
7177         into find_one_thread.  find_one_thread uses
7178         `current_process ()->priv->thread_db`, assuming the current process
7179         matches the ptid passed as a parameter, which is wrong.  A segfault
7180         happens when trying to dereference that thread_db pointer.
7181
7182         Fix this by making find_one_thread not assume what the current process /
7183         current thread is.  If it needs to call into libthread_db, which we know
7184         will try to read memory from the current process, then temporarily set
7185         the current process.
7186
7187         In the case where the thread is already know and we return early, we
7188         don't need to switch process.
7189
7190         Add a test to reproduce this specific situation.
7191
7192         Change-Id: I09b00883e8b73b7e5f89d0f47cb4e9c0f3d6caaa
7193         Approved-By: Andrew Burgess <aburgess@redhat.com>
7194
7195 2022-11-28  Tom Tromey  <tromey@adacore.com>
7196
7197         Fix crash in "document" command
7198         PR cli/29800 points out that "document" will now crash when the
7199         argument is an undefined command.  This is a regression due to the
7200         "document user-defined aliases" patch.
7201
7202         Approved-By: Joel Brobecker <brobecker@adacore.com>
7203         Reviewed-By: Philippe Waroquiers <philippe.waroquiers@skynet.be>
7204         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29800
7205
7206 2022-11-28  Tom de Vries  <tdevries@suse.de>
7207
7208         [gdb/testsuite] Fix gdb.opt/solib-intra-step.exp for powerpc64le
7209         On powerpc64le-linux, I run into:
7210         ...
7211         (gdb) PASS: gdb.opt/solib-intra-step.exp: first-hit
7212         step^M
7213         28      { /* first-retry */^M
7214         (gdb) FAIL: gdb.opt/solib-intra-step.exp: second-hit
7215         ...
7216
7217         It's a bit easier to understand what happens if we do a full stepping session:
7218         ...
7219         Temporary breakpoint 1, main ()
7220             at solib-intra-step-main.c:23
7221         23        shlib_first ();
7222         (gdb) step
7223         shlib_first () at solib-intra-step-lib.c:29
7224         29        shlib_second (0); /* first-hit */
7225         (gdb) step
7226         28      { /* first-retry */
7227         (gdb) step
7228         29        shlib_second (0); /* first-hit */
7229         (gdb) step
7230         shlib_second (dummy=0)
7231             at solib-intra-step-lib.c:23
7232         23        abort (); /* second-hit */
7233         ...
7234         and compare that to the line info:
7235         ...
7236         CU: solib-intra-step-lib.c:
7237         File name                    Line number    Starting address    View    Stmt
7238         solib-intra-step-lib.c                22               0x710               x
7239         solib-intra-step-lib.c                23               0x724               x
7240         solib-intra-step-lib.c                28               0x740               x
7241         solib-intra-step-lib.c                29               0x74c               x
7242         solib-intra-step-lib.c                28               0x750               x
7243         solib-intra-step-lib.c                29               0x758               x
7244         solib-intra-step-lib.c                30               0x760               x
7245         solib-intra-step-lib.c                 -               0x77c
7246         ...
7247
7248         So we step from line 29 to line 28, and back to line 29, which is behaviour
7249         that matches the line table.  The peculiar order is due to using optimization.
7250         The problem is that the test-case doesn't expect this order.
7251
7252         Fix this by allowing this order in the test-case.
7253
7254         Tested on powerpc64le-linux.
7255
7256         PR testsuite/29792
7257         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29792
7258
7259 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
7260
7261         gdb: fix assert when quitting GDB while a thread is stepping
7262         This commit addresses one of the issues identified in PR gdb/28275.
7263
7264         Bug gdb/28275 identifies a number of situations in which this assert:
7265
7266           Assertion `!proc_target->commit_resumed_state' failed.
7267
7268         could be triggered.  There's actually a number of similar places where
7269         this assert is found in GDB, the two of interest in gdb/28275 are in
7270         target_wait and target_stop.
7271
7272         In one of the comments:
7273
7274           https://sourceware.org/bugzilla/show_bug.cgi?id=28275#c1
7275
7276         steps to trigger the assertion within target_stop were identified when
7277         using a modified version of the gdb.threads/detach-step-over.exp test
7278         script.
7279
7280         In the gdb.threads/detach-step-over.exp test, we attach to a
7281         multi-threaded inferior, and continue the inferior in asynchronous
7282         (background) mode.  Each thread is continuously hitting a conditional
7283         breakpoint where the condition is always false.  While the inferior is
7284         running we detach.  The goal is that we detach while GDB is performing a
7285         step-over for the conditional breakpoint in at least one thread.
7286
7287         While detaching, if a step-over is in progress, then GDB has to
7288         complete the step over before we can detach.  This involves calling
7289         target_stop and target_wait (see prepare_for_detach).
7290
7291         As far as gdb/28275 is concerned, the interesting part here, is the
7292         the process_stratum_target::commit_resumed_state variable must be
7293         false when target_stop and target_wait are called.
7294
7295         This is currently ensured because, in detach_command (infrun.c), we
7296         create an instance of scoped_disable_commit_resumed, this ensures that
7297         when target_detach is called, ::commit_resumed_state will be false.
7298
7299         The modification to the test that I propose here, and which exposed
7300         the bug, is that, instead of using "detach" to detach from the
7301         inferior, we instead use "quit".  Quitting GDB after attaching to an
7302         inferior will cause GDB to first detach, and then exit.
7303
7304         When we quit GDB we end up calling target_detach via a different code
7305         path, the stack looks like:
7306
7307           #0 target_detach
7308           #1 kill_or_detach
7309           #2 quit_force
7310           #3 quit_command
7311
7312         Along this path there is no scoped_disable_commit_resumed created.
7313         ::commit_resumed_state can be true when we reach prepare_for_detach,
7314         which calls target_wait and target_stop, so the assertion will trigger.
7315
7316         In this commit, I propose fixing this by adding the creation of a
7317         scoped_disable_commit_resumed into target_detach.  This will ensure
7318         that ::commit_resumed_state is false when calling prepare_for_detach
7319         from within target_detach.
7320
7321         I did consider placing the scoped_disable_commit_resumed in
7322         prepare_for_detach, however, placing it in target_detach ensures that
7323         the target's commit_resumed_state flag is left to false if the detached
7324         inferior was the last one for that target.  It's the same rationale as
7325         for patch "gdb: disable commit resumed in target_kill" that comes later
7326         in this series, but for detach instead of kill.
7327
7328         detach_command still includes a scoped_disable_commit_resumed too, but I
7329         think it is still relevant to cover the resumption at the end of the
7330         function.
7331
7332         Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
7333         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28275
7334         Change-Id: Ie128f7aba6ef0e018859275eca372e6ea738e96f
7335
7336 2022-11-28  Andrew Burgess  <aburgess@redhat.com>
7337
7338         gdb/testsuite: refactor gdb.threads/detach-step-over.exp
7339         Factor out some bits of gdb.threads/detach-step-over.exp to procs in
7340         preparation to adding some new variations of the test.  Rename the
7341         existing "test" proc and make it use proc_with_prefix.
7342
7343         Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
7344         Change-Id: Ib4412545c81c8556029e0f7bfa9dd48d7a9f3189
7345
7346 2022-11-28  Simon Marchi  <simon.marchi@efficios.com>
7347
7348         gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.exp
7349         Before doing further changes to this file, change to use the :: notation
7350         instead of declaring global variables with the `global` keyword.
7351
7352         Change-Id: I72301fd8f4693fea61aac054ba17245a1f4442fb
7353         Approved-By: Andrew Burgess <aburgess@redhat.com>
7354
7355 2022-11-28  Tom de Vries  <tdevries@suse.de>
7356
7357         [gdb/testsuite] Fix gdb.arch/altivec-regs.exp with gcc 4.8.5
7358         On powerpc64le-linux, using gcc 4.8.5, I run into:
7359         ...
7360         (gdb) PASS: gdb.arch/altivec-regs.exp: next (1)
7361         next^M
7362         11        c = vec_add (a, b);^M
7363         (gdb) PASS: gdb.arch/altivec-regs.exp: next (2)
7364         print/x a^M
7365         $67 = {0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe}^M
7366         (gdb) FAIL: gdb.arch/altivec-regs.exp: print vector parameter a
7367         ...
7368
7369         Looking at the disassembly and the debug info, it's clear why there's
7370         a FAIL.
7371
7372         The debug info says that the variable can be found at some stack location, but
7373         the instructions don't seem to be writing there.
7374
7375         We can work around this by marking variable a volatile.  Likewise for b.
7376
7377         Note that marking the variables as volatile doesn't change the location
7378         information.
7379
7380         Tested on power64le-linux.
7381
7382 2022-11-28  Tom de Vries  <tdevries@suse.de>
7383
7384         [gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le
7385         With test-case gdb.base/msym-bp-shl.exp on powerpc64le-linux, I run into:
7386         ...
7387         (gdb) PASS: gdb.base/msym-bp-shl.exp: debug=0: before run: break foo
7388         info breakpoint^M
7389         Num     Type           Disp Enb Address            What^M
7390         1       breakpoint     keep y   <MULTIPLE>         ^M
7391         1.1                         y   0x00000000000008d4 <foo+12>^M
7392         1.2                         y   0x0000000000000a34 crti.S:88^M
7393         (gdb) FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: info breakpoint
7394         ...
7395
7396         The problem is that the prologue skipper walks from foo@plt at 0xa28 to 0xa34:
7397         ...
7398         0000000000000a28 <foo@plt>:
7399          a28:   c0 ff ff 4b     b       9e8 <__glink_PLTresolve>
7400
7401         Disassembly of section .fini:
7402
7403         0000000000000a2c <_fini>:
7404          a2c:   02 00 4c 3c     addis   r2,r12,2
7405          a30:   d4 74 42 38     addi    r2,r2,29908
7406          a34:   a6 02 08 7c     mflr    r0
7407         ...
7408
7409         This is caused by ppc_elfv2_elf_make_msymbol_special which marks foo@plt as
7410         having a local entry point, due to incorrectly accessing an asymbol struct
7411         using a (larger) elf_symbol_type.
7412
7413         Fix this by simply ignoring artificial symbols in
7414         ppc_elfv2_elf_make_msymbol_special.
7415
7416         Tested on powerpc64le.
7417
7418         Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
7419         Reviewed-By: Carl Love <cel@us.ibm.com>
7420         Tested-By: Carl Love <cel@us.ibm.com>
7421         PR tdep/29814
7422         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29814
7423
7424 2022-11-28  Alan Modra  <amodra@gmail.com>
7425
7426         PR10368, ISO 8859 mentioned as 7bit encoding in strings documentation
7427                 PR 10368
7428                 * doc/binutils.texi (strings): Delete example of 7-bit encoding.
7429
7430         Use bfd_rename_section in msp430.em
7431                 * emultempl/msp430.em (add_region_prefix <REGION_EITHER>): Use
7432                 bfd_rename_section.
7433                 * testsuite/ld-msp430-elf/msp430-tiny-rom.ld: Handle varian data
7434                 and bss input sections.
7435
7436         asan: pef: buffer overflow
7437                 * pef.c (bfd_pef_parse_traceback_table): Correct size moved when
7438                 stripping leading dot.
7439
7440         regen gas/Makefile.in
7441
7442 2022-11-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
7443
7444         RISC-V: Allow merging 'H' extension
7445         Because riscv_merge_std_ext function did not merge the 'H' extension, linked
7446         executables lacked 'H' extension when multiple objects are merged.
7447
7448         This issue is found while building OpenSBI with 'H' extension (resulting
7449         ELF files did not contain "h1p0" in "Tag_RISCV_arch" even if *all* linked
7450         object files contained it).
7451
7452         This commit adds 'h' to standard_exts variable to merge 'H' extension.
7453
7454         bfd/ChangeLog:
7455
7456                 * elfnn-riscv.c (riscv_merge_std_ext): Add 'H' extension merging.
7457
7458 2022-11-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
7459
7460         RISC-V: Better support for long instructions (tests)
7461         This commit tests both (assembler and disassembler) fixes of "Better support
7462         for long instructions".
7463
7464         gas/ChangeLog:
7465
7466                 * testsuite/gas/riscv/insn.s: Add testcases such that big number
7467                 handling is required and should be disassembled as long ".byte"
7468                 sequence with correct instruction bits.
7469                 * testsuite/gas/riscv/insn.d: Likewise.
7470                 * testsuite/gas/riscv/insn-na.d: Likewise.
7471                 * testsuite/gas/riscv/insn-dwarf.d: Likewise.
7472
7473 2022-11-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
7474
7475         RISC-V: Better support for long instructions (assembler)
7476         Commit bb996692bd96 ("RISC-V/gas: allow generating up to 176-bit
7477         instructions with .insn") tried to start supporting long instructions but
7478         it was insufficient.
7479
7480         1.  It heavily depended on the bignum internals (radix of 2^16),
7481         2.  It generates "value conflicts with instruction length" even if a big
7482             number instruction encoding does not exceed its expected length and
7483         3.  Because long opcode was handled separately (from struct riscv_cl_insn),
7484             some information like DWARF line number correspondence was missing.
7485
7486         To resolve these problems, this commit:
7487
7488         1.  Handles bignum (and its encodings) precisely and
7489         2.  Incorporates long opcode handling into regular instruction handling.
7490
7491         This commit will be tested on the separate commit.
7492
7493         gas/ChangeLog:
7494
7495                 * config/tc-riscv.c (struct riscv_cl_insn): Add long opcode field.
7496                 (create_insn) Clear long opcode marker.
7497                 (install_insn) Install longer opcode as well.
7498                 (s_riscv_insn) Likewise.
7499                 (riscv_ip_hardcode): Make big number handling stricter. Length and
7500                 the value conflicts only if the bignum size exceeds the expected
7501                 maximum length.
7502
7503 2022-11-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
7504
7505         RISC-V: Better support for long instructions (disassembler)
7506         Commit bb996692bd96 ("RISC-V/gas: allow generating up to 176-bit
7507         instructions with .insn") tried to start supporting long instructions but
7508         it was insufficient.
7509
7510         On the disassembler, correct ".byte" output was limited to the first 64-bits
7511         of an instruction.  After that, zeroes are incorrectly printed.
7512
7513         Note that, it only happens on ".byte" output (instruction part) and not on
7514         hexdump (data) part.  For example, before this commit, hexdump and ".byte"
7515         produces different values:
7516
7517         Assembly:
7518           .insn 22, 0xfedcba98765432100123456789abcdef55aa33cc607f
7519         objdump output example (before the fix):
7520           10:   607f 33cc 55aa cdef     .byte   0x7f, 0x60, 0xcc, 0x33, 0xaa, 0x55, 0xef, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
7521           18:   89ab 4567 0123 3210
7522           20:   7654 ba98 fedc
7523
7524         Note that, after 0xcd (after first 64-bits of the target instruction), all
7525         ".byte" values are incorrectly printed as zero while hexdump prints correct
7526         instruction bits.
7527
7528         To resolve this, this commit adds "packet" argument to support dumping
7529         instructions longer than 64-bits (to print correct instruction bits on
7530         ".byte").  This commit will be tested on the separate commit.
7531
7532         Assembly:
7533           .insn 22, 0xfedcba98765432100123456789abcdef55aa33cc607f
7534         objdump output example (after the fix):
7535           10:   607f 33cc 55aa cdef     .byte   0x7f, 0x60, 0xcc, 0x33, 0xaa, 0x55, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe
7536           18:   89ab 4567 0123 3210
7537           20:   7654 ba98 fedc
7538
7539         opcodes/ChangeLog:
7540
7541                 * riscv-dis.c (riscv_disassemble_insn): Print unknown instruction
7542                 using the new argument packet.
7543                 (riscv_disassemble_data): Add unused argument packet.
7544                 (print_insn_riscv): Pass packet to the disassemble function.
7545
7546 2022-11-28  GDB Administrator  <gdbadmin@sourceware.org>
7547
7548         Automatic date update in version.in
7549
7550 2022-11-27  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
7551
7552         Fix leak in the dwarf reader
7553         Valgrind reports a leak in the dwarf reader (see details below).
7554         The function dw2_get_file_names_reader is interning in the per_objfile
7555         all the file names it finds, except the name of 'fnd file name and directory'.
7556         Instead, it was xstrdup-ing the name.
7557         Fix the leaks by also interning the name.
7558
7559         This was validated running the tests natively, and under valgrind.
7560         Leaks have decreased as mentionned below.
7561         Valgrind detected no error such as double free or use after free.
7562
7563         Stack trace of the leak:
7564         ==4113266== 490,735 bytes in 17,500 blocks are definitely lost in loss record 7,061 of 7,074
7565         ==4113266==    at 0x483979B: malloc (vg_replace_malloc.c:393)
7566         ==4113266==    by 0x25A454: xmalloc (alloc.c:57)
7567         ==4113266==    by 0x7D1E1E: xstrdup (xstrdup.c:34)
7568         ==4113266==    by 0x39D141: dw2_get_file_names_reader (read.c:2825)
7569         ==4113266==    by 0x39D141: dw2_get_file_names(dwarf2_per_cu_data*, dwarf2_per_objfile*) (read.c:2851)
7570         ==4113266==    by 0x39DD6C: dw_expand_symtabs_matching_file_matcher(dwarf2_per_objfile*, gdb::function_view<bool (char const*, bool)>) (read.c:4149)
7571         ==4113266==    by 0x3BC8B5: cooked_index_functions::expand_symtabs_matching(objfile*, gdb::function_view<bool (char const*, bool)>, lookup_name_info const*, gdb::function_view<bool (char const*)>, gdb::function_view<bool (compunit_symtab*)>, enum_flags<block_search_flag_values>, domain_enum, search_domain) (read.c:18688)
7572         ==4113266==    by 0x5DD1EA: objfile::map_symtabs_matching_filename(char const*, char const*, gdb::function_view<bool (symtab*)>) (symfile-debug.c:207)
7573         ==4113266==    by 0x5F04CC: iterate_over_symtabs(char const*, gdb::function_view<bool (symtab*)>) (symtab.c:633)
7574         ==4113266==    by 0x477EE3: collect_symtabs_from_filename(char const*, program_space*) (linespec.c:3712)
7575         ==4113266==    by 0x477FC1: symtabs_from_filename(char const*, program_space*) (linespec.c:3726)
7576         ==4113266==    by 0x47A9B8: convert_explicit_location_spec_to_linespec(linespec_state*, linespec*, char const*, char const*, symbol_name_match_type, char const*, line_offset) (linespec.c:2329)
7577         ==4113266==    by 0x47E86E: convert_explicit_location_spec_to_sals (linespec.c:2388)
7578         ==4113266==    by 0x47E86E: location_spec_to_sals(linespec_parser*, location_spec const*) (linespec.c:3104)
7579         ==4113266==    by 0x47EDAC: decode_line_full(location_spec*, int, program_space*, symtab*, int, linespec_result*, char const*, char const*) (linespec.c:3149)
7580         ...
7581
7582         Without the fix, the top 10 leaks are:
7583         ./gdb/testsuite/outputs/gdb.base/condbreak-bad/gdb.log:345:==3213924==    definitely lost: 130,937 bytes in 5,409 blocks
7584         ./gdb/testsuite/outputs/gdb.base/hbreak2/gdb.log:619:==3758919==    definitely lost: 173,323 bytes in 7,204 blocks
7585         ./gdb/testsuite/outputs/gdb.mi/mi-var-cp/gdb.log:1320:==4152873==    definitely lost: 172,826 bytes in 7,207 blocks
7586         ./gdb/testsuite/outputs/gdb.base/advance-until-multiple-locations/gdb.log:398:==2992643==    definitely lost: 172,965 bytes in 7,211 blocks
7587         ./gdb/testsuite/outputs/gdb.mi/mi-var-cmd/gdb.log:2302:==4159476==    definitely lost: 173,129 bytes in 7,211 blocks
7588         ./gdb/testsuite/outputs/gdb.cp/gdb2384/gdb.log:222:==3811851==    definitely lost: 218,106 bytes in 7,761 blocks
7589         ./gdb/testsuite/outputs/gdb.cp/mb-templates/gdb.log:310:==3787344==    definitely lost: 290,311 bytes in 10,340 blocks
7590         ./gdb/testsuite/outputs/gdb.mi/mi-var-rtti/gdb.log:2568:==4158350==    definitely lost: 435,427 bytes in 15,507 blocks
7591         ./gdb/testsuite/outputs/gdb.mi/mi-catch-cpp-exceptions/gdb.log:1704:==4119722==    definitely lost: 435,405 bytes in 15,510 blocks
7592         ./gdb/testsuite/outputs/gdb.mi/mi-vla-fortran/gdb.log:768:==4113266==    definitely lost: 508,585 bytes in 18,109 blocks
7593
7594         With the fix:
7595         ./gdb/testsuite/outputs/gdb.base/fork-running-state/gdb.log:1536:==2924193==    indirectly lost: 13,848 bytes in 98 blocks
7596         ./gdb/testsuite/outputs/gdb.base/fork-running-state/gdb.log:1675:==2928777==    indirectly lost: 13,848 bytes in 98 blocks
7597         ./gdb/testsuite/outputs/gdb.python/py-inferior-leak/gdb.log:4729:==3353335==    definitely lost: 3,360 bytes in 140 blocks
7598         ./gdb/testsuite/outputs/gdb.base/kill-detach-inferiors-cmd/gdb.log:210:==2746927==    indirectly lost: 13,246 bytes in 154 blocks
7599         ./gdb/testsuite/outputs/gdb.base/inferior-clone/gdb.log:179:==3034984==    indirectly lost: 12,921 bytes in 161 blocks
7600         ./gdb/testsuite/outputs/gdb.base/interrupt-daemon/gdb.log:209:==3006248==    indirectly lost: 20,683 bytes in 174 blocks
7601         ./gdb/testsuite/outputs/gdb.threads/watchpoint-fork/gdb.log:714:==3512403==    indirectly lost: 20,707 bytes in 175 blocks
7602         ./gdb/testsuite/outputs/gdb.threads/watchpoint-fork/gdb.log:962:==3514498==    indirectly lost: 20,851 bytes in 178 blocks
7603         ./gdb/testsuite/outputs/gdb.base/multi-forks/gdb.log:336:==2585839==    indirectly lost: 53,630 bytes in 386 blocks
7604         ./gdb/testsuite/outputs/gdb.base/multi-forks/gdb.log:1338:==2592417==    indirectly lost: 100,008 bytes in 1,154 blocks
7605
7606         Approved-By: Simon Marchi <simon.marchi@efficios.com>
7607
7608 2022-11-27  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
7609
7610         fix leak in gdb_environ
7611         valgrind reports a leak when assigning a gdb_environ to another gdb_environ.
7612         The memory allocated for the target gdb_environ env variables is not released.
7613         The gdb_environ selftest reproduces the leak (see below).
7614         Fix the leak by clearing the target gdb_environ before std::move-ing the
7615         members.
7616
7617         Tested natively and re-running all tests under valgrind.
7618
7619         ==3261873== 4,842 bytes in 69 blocks are definitely lost in loss record 6,772 of 6,839
7620         ==3261873==    at 0x483979B: malloc (vg_replace_malloc.c:393)
7621         ==3261873==    by 0x25A454: xmalloc (alloc.c:57)
7622         ==3261873==    by 0x7D1E4E: xstrdup (xstrdup.c:34)
7623         ==3261873==    by 0x7E2A51: gdb_environ::from_host_environ() (environ.cc:56)
7624         ==3261873==    by 0x66F1C8: test_reinit_from_host_environ (environ-selftests.c:78)
7625         ==3261873==    by 0x66F1C8: selftests::gdb_environ_tests::run_tests() (environ-selftests.c:285)
7626         ==3261873==    by 0x7EFC43: operator() (std_function.h:622)
7627         =
7628
7629         Approved-By: Simon Marchi <simon.marchi@efficios.com>
7630
7631 2022-11-27  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
7632
7633         Use false/true for some inferior class members instead of 0/1
7634         Some class members were changed to bool, but there was
7635         still some assignments or comparisons using 0/1.
7636
7637         Approved-By: Simon Marchi <simon.marchi@efficios.com>
7638
7639 2022-11-27  Tom de Vries  <tdevries@suse.de>
7640
7641         [gdb/server] Emit warning for SIGINT failure
7642         Consider the executable from test-case gdb.base/interrupt-daemon.exp.
7643
7644         When starting it using gdbserver:
7645         ...
7646         $ ./build/gdbserver/gdbserver localhost:2345 \
7647           ./outputs/gdb.base/interrupt-daemon/interrupt-daemon
7648         ...
7649         and connecting to it using gdb:
7650         ...
7651         $ gdb -q -ex "target remote localhost:2345" \
7652             -ex "set follow-fork-mode child" \
7653             -ex "break daemon_main" -ex cont
7654         ...
7655         we are setup to do the same as in the test-case: interrupt a running inferior
7656         using ^C.
7657
7658         So let's try:
7659         ...
7660         (gdb) continue
7661         Continuing.
7662         ^C
7663         ...
7664         After pressing ^C, nothing happens.  This a known problem, filed as
7665         PR remote/18772.
7666
7667         The problem is that in linux_process_target::request_interrupt, a kill is used
7668         to send a SIGINT, but it fails.  And it fails silently.
7669
7670         Make the failure verbose by adding a warning, such that the gdbserver output
7671         becomes more helpful:
7672         ...
7673         Process interrupt-daemon created; pid = 15068
7674         Listening on port 2345
7675         Remote debugging from host ::1, port 35148
7676         Detaching from process 15068
7677         Detaching from process 15085
7678         gdbserver: Sending SIGINT to process group of pid 15068 failed: \
7679           No such process
7680         ...
7681
7682         Note that the failure can easily be reproduced using the test-case and target
7683         board native-gdbserver:
7684         ...
7685         (gdb) continue^M
7686         Continuing.^M
7687         PASS: gdb.base/interrupt-daemon.exp: fg: continue
7688         ^CFAIL: gdb.base/interrupt-daemon.exp: fg: ctrl-c stops process (timeout)
7689         ...
7690         as reported in PR server/23382.
7691
7692         Tested on x86_64-linux.
7693         Approved-By: Simon Marchi <simon.marchi@efficios.com>
7694
7695 2022-11-27  GDB Administrator  <gdbadmin@sourceware.org>
7696
7697         Automatic date update in version.in
7698
7699 2022-11-26  Tom de Vries  <tdevries@suse.de>
7700
7701         [gdb/testsuite] Don't generate core in gdb.base/bt-on-fatal-signal.exp
7702         When running test-case gdb.base/bt-on-fatal-signal.exp on powerpc64le-linux I
7703         noticed:
7704         ...
7705         FAIL: gdb.base/bt-on-fatal-signal.exp: SEGV: scan for backtrace (timeout)
7706         ...
7707
7708         The timeout is 10 seconds, but generating the core file takes more than a
7709         minute, probably due to slow NFS.
7710
7711         I managed to reproduce this behaviour independently of gdb, by compiling
7712         "int main (void) { __builtin_abort (); }" and running it, which took 1.5
7713         seconds for a core file 50 times smaller than the one for gdb.
7714
7715         Fix this by preventing the core file from being generated, using a wrapper
7716         around gdb that does "ulimit -c 0".
7717
7718         Tested on x86_64-linux.
7719
7720 2022-11-26  Tom de Vries  <tdevries@suse.de>
7721
7722         [gdb/symtab] Handle failure to open .gnu_debugaltlink file
7723         If we instrument cc-with-tweaks.sh to remove the .gnu_debugaltlink file after
7724         dwz has created it, with test-case
7725         gdb.threads/access-mem-running-thread-exit.exp and target board cc-with-dwz-m
7726         we run into:
7727         ...
7728         (gdb) file access-mem-running-thread-exit^M
7729         Reading symbols from access-mem-running-thread-exit...^M
7730         could not find '.gnu_debugaltlink' file for access-mem-running-thread-exit^M
7731         ...
7732         followed a bit later by:
7733         ...
7734         (gdb) file access-mem-running-thread-exit^M
7735         Reading symbols from access-mem-running-thread-exit...^M
7736         gdb/dwarf2/read.c:7284: internal-error: create_all_units: \
7737           Assertion `per_objfile->per_bfd->all_units.empty ()' failed.^M
7738         ...
7739
7740         The problem is that create_units does not catch the error thrown by
7741         dwarf2_get_dwz_file.
7742
7743         Fix this by catching the error and performing the necessary cleanup, getting
7744         the same result for the first and second file command.
7745
7746         PR symtab/29805
7747         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29805
7748
7749 2022-11-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
7750
7751         Fix jump on uninit producer_is_clang bit of cu.h dwarf2_cu struct.
7752         Valgrind reports a "jump on unitialised bit error" when running
7753             e.g. gdb.base/macro-source-path.exp (see details below).
7754
7755             Fix this by initializing producer_is_clang member variable of dwarf2_cu.
7756
7757             Tested on amd64/debian11 and re-running gdb.base/macro-source-path.exp
7758             under valgrind.
7759
7760             ==2140965== Conditional jump or move depends on uninitialised value(s)
7761             ==2140965==    at 0x5211F7: dwarf_decode_macro_bytes(dwarf2_per_objfile*, buildsym_compunit*, bfd*, unsigned char const*, unsigned char const*, macro_source_file*, line_header const*, dwarf2_section_info const*, int, int, unsigned int, dwarf2_section_info*, dwarf2_section_info*, gdb::optional<unsigned long>, htab*, dwarf2_cu*) (macro.c:676)
7762             ==2140965==    by 0x52158A: dwarf_decode_macros(dwarf2_per_objfile*, buildsym_compunit*, dwarf2_section_info const*, line_header const*, unsigned int, unsigned int, dwarf2_section_info*, dwarf2_section_info*, gdb::optional<unsigned long>, int, dwarf2_cu*) (macro.c:967)
7763             ==2140965==    by 0x523BC4: dwarf_decode_macros(dwarf2_cu*, unsigned int, int) (read.c:23379)
7764             ==2140965==    by 0x552AB5: read_file_scope(die_info*, dwarf2_cu*) (read.c:9687)
7765             ==2140965==    by 0x54F7B2: process_die(die_info*, dwarf2_cu*) (read.c:8660)
7766             ==2140965==    by 0x5569C7: process_full_comp_unit (read.c:8429)
7767             ==2140965==    by 0x5569C7: process_queue (read.c:7675)
7768             ==2140965==    by 0x5569C7: dw2_do_instantiate_symtab (read.c:2063)
7769             ==2140965==    by 0x5569C7: dw2_instantiate_symtab(dwarf2_per_cu_data*, dwarf2_per_objfile*, bool) (read.c:2085)
7770             ==2140965==    by 0x55700B: dw2_expand_symtabs_matching_one(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb::function_view<bool (char const*, bool)>, gdb::function_view<bool (compunit_symtab*)>) (read.c:3984)
7771             ==2140965==    by 0x557EA3: cooked_index_functions::expand_symtabs_matching(objfile*, gdb::function_view<bool (char const*, bool)>, lookup_name_info const*, gdb::function_view<bool (char const*)>, gdb::function_view<bool (compunit_symtab*)>, enum_flags<block_search_flag_values>, domain_enum, search_domain) (read.c:18781)
7772             ==2140965==    by 0x778977: objfile::lookup_symbol(block_enum, char const*, domain_enum) (symfile-debug.c:276)
7773             ....
7774             ==2140965==  Uninitialised value was created by a heap allocation
7775             ==2140965==    at 0x4839F01: operator new(unsigned long) (vg_replace_malloc.c:434)
7776             ==2140965==    by 0x533A64: cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) (read.c:6264)
7777             ==2140965==    by 0x5340C2: load_full_comp_unit(dwarf2_per_cu_data*, dwarf2_per_objfile*, dwarf2_cu*, bool, language) (read.c:7729)
7778             ==2140965==    by 0x548338: load_cu(dwarf2_per_cu_data*, dwarf2_per_objfile*, bool) (read.c:2021)
7779             ==2140965==    by 0x55634C: dw2_do_instantiate_symtab (read.c:2048)
7780             ==2140965==    by 0x55634C: dw2_instantiate_symtab(dwarf2_per_cu_data*, dwarf2_per_objfile*, bool) (read.c:2085)
7781             ==2140965==    by 0x55700B: dw2_expand_symtabs_matching_one(dwarf2_per_cu_data*, dwarf2_per_objfile*, gdb::function_view<bool (char const*, bool)>, gdb::function_view<bool (compunit_symtab*)>) (read.c:3984)
7782             ==2140965==    by 0x557EA3: cooked_index_functions::expand_symtabs_matching(objfile*, gdb::function_view<bool (char const*, bool)>, lookup_name_info const*, gdb::function_view<bool (char const*)>, gdb::function_view<bool (compunit_symtab*)>, enum_flags<block_search_flag_values>, domain_enum, search_domain) (read.c:18781)
7783             ==2140965==    by 0x778977: objfile::lookup_symbol(block_enum, char const*, domain_enum) (symfile-debug.c:276)
7784             ....
7785
7786 2022-11-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
7787
7788         remove the declared but undefined/unused method find_partial_die
7789         The method
7790                struct partial_die_info *find_partial_die (sect_offset sect_off);
7791         in cu.h is defined, but is used nowhere and not implemented.
7792
7793 2022-11-26  GDB Administrator  <gdbadmin@sourceware.org>
7794
7795         Automatic date update in version.in
7796
7797 2022-11-25  Martin Liska  <mliska@suse.cz>
7798
7799         Revert "readelf: Do not require EI_OSABI for IFUNC."
7800         This reverts commit ffbbab0b3a1000f862b6d4ce3d9a76ed14f08801.
7801
7802 2022-11-25  Christoph Müllner  <christoph.muellner@vrull.eu>
7803
7804         riscv: Add AIA extension support (Smaia, Ssaia)
7805         This commit adds the AIA extensions (Smaia and Ssaia) CSRs.
7806
7807         bfd/ChangeLog:
7808
7809                 * elfxx-riscv.c: Add 'smaia' and 'ssaia' to the list
7810                 of known standard extensions.
7811
7812         gas/ChangeLog:
7813
7814                 * config/tc-riscv.c (enum riscv_csr_class):
7815                 (riscv_csr_address): Add CSR classes for Smaia/Ssaia.
7816                 * testsuite/gas/riscv/csr-dw-regnums.d: Add new CSRs.
7817                 * testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
7818                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
7819                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
7820                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
7821                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
7822                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
7823                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
7824                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
7825                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
7826                 * testsuite/gas/riscv/csr.s: Likewise.
7827
7828         include/ChangeLog:
7829
7830                 * opcode/riscv-opc.h (CSR_MISELECT): New CSR macro.
7831                 (CSR_MIREG): Likewise.
7832                 (CSR_MTOPEI): Likewise.
7833                 (CSR_MTOPI): Likewise.
7834                 (CSR_MVIEN): Likewise.
7835                 (CSR_MVIP): Likewise.
7836                 (CSR_MIDELEGH): Likewise.
7837                 (CSR_MIEH): Likewise.
7838                 (CSR_MVIENH): Likewise.
7839                 (CSR_MVIPH): Likewise.
7840                 (CSR_MIPH): Likewise.
7841                 (CSR_SISELECT): Likewise.
7842                 (CSR_SIREG): Likewise.
7843                 (CSR_STOPEI): Likewise.
7844                 (CSR_STOPI): Likewise.
7845                 (CSR_SIEH): Likewise.
7846                 (CSR_SIPH): Likewise.
7847                 (CSR_HVIEN): Likewise.
7848                 (CSR_HVICTL): Likewise.
7849                 (CSR_HVIPRIO1): Likewise.
7850                 (CSR_HVIPRIO2): Likewise.
7851                 (CSR_VSISELECT): Likewise.
7852                 (CSR_VSIREG): Likewise.
7853                 (CSR_VSTOPEI): Likewise.
7854                 (CSR_VSTOPI): Likewise.
7855                 (CSR_HIDELEGH): Likewise.
7856                 (CSR_HVIENH): Likewise.
7857                 (CSR_HVIPH): Likewise.
7858                 (CSR_HVIPRIO1H): Likewise.
7859                 (CSR_HVIPRIO2H): Likewise.
7860                 (CSR_VSIEH): Likewise.
7861                 (CSR_VSIPH): Likewise.
7862                 (DECLARE_CSR): Add CSRs for Smaia and Ssaia.
7863
7864         Changes for v3:
7865         - Imply ssaia for smaia
7866         - Imply zicsr for ssaia (and transitively smaia)
7867         - Move hypervisor CSRs to Ssaia+H
7868         - Rebase on upstream/master
7869
7870         Changes for v2:
7871         - Add hypervisor and VS CSRs
7872         - Fix whitespace issue
7873
7874 2022-11-25  GDB Administrator  <gdbadmin@sourceware.org>
7875
7876         Automatic date update in version.in
7877
7878 2022-11-24  Indu Bhagat  <indu.bhagat@oracle.com>
7879
7880         sframe/doc: remove usage of xrefautomaticsectiontitle
7881         xrefautomaticsectiontitle appears to be available from texinfo 5.0 or
7882         greater.  As such, it is not worthwhile to add requirement for a minimum
7883         necessary makeinfo version.  So remove the usage of it.
7884
7885         Also align node name with section title where possible.
7886
7887         ChangeLog:
7888
7889                 * libsframe/doc/sframe-spec.texi: Remove usage of
7890                 xrefautomaticsectiontitle.
7891
7892 2022-11-24  Andrew Burgess  <aburgess@redhat.com>
7893
7894         gdb: fix typo in debug output message
7895         Spotted a minor type, a missing ')', in a debug message.
7896
7897 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7898
7899         gdb/testsuite/gdb.base/break.exp: split test_break
7900         Move all the remaining tests to a single test_break proc.  It's a bit
7901         big, but all of these are kind of tied together.  The procs starts by
7902         setting breakpoints, checks that we can see them in "info breakpoints",
7903         and tries stopping on them.
7904
7905         Move all the "set bp_locationX" calls together at the top.
7906
7907         Change-Id: Id05f98957e1a3462532d2dbd577cd0a7c7263900
7908         Approved-By: Kevin Buettner <kevinb@redhat.com>
7909
7910 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7911
7912         gdb/testsuite/gdb.base/break.exp: split test_tbreak
7913         Leave setting bp_location11 in the global scope, so that it's accessible
7914         to other procs.
7915
7916         Change-Id: I8928f01640d3a1e993649b2168b9eda0724ee1d9
7917         Approved-By: Kevin Buettner <kevinb@redhat.com>
7918
7919 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7920
7921         gdb/testsuite/gdb.base/break.exp: split test_no_break_on_catchpoint
7922         Change-Id: Ifa7070943f1de22c2839fedf5f346d6591bb5a76
7923         Approved-By: Kevin Buettner <kevinb@redhat.com>
7924
7925         gdb/testsuite/gdb.base/break.exp: split test_break_nonexistent_line
7926         Change-Id: I4390dd5da23bae83ccc513ad0de0169ddff7df12
7927         Approved-By: Kevin Buettner <kevinb@redhat.com>
7928
7929 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7930
7931         gdb/testsuite/gdb.base/break.exp: split test_break_default
7932         One special thing here is that the part just above this one, that sets
7933         catchpoints and verifies they are not hit, requires that we resume
7934         execution to verify that the catchpoints are indeed not hit.   I guess
7935         it was previously achieved by the until command, but it doesn't happen
7936         now that the until is moved into test_break_default.  Add a
7937         gdb_continue_to_end after setting the catchpoints.  If any catchpoint
7938         were to be hit, it would catch the problem.
7939
7940         Change-Id: I5d4b43da91886b1beda9f6e56b05aa04331a9c05
7941         Approved-By: Kevin Buettner <kevinb@redhat.com>
7942
7943 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7944
7945         gdb/testsuite/gdb.base/break.exp: split test_break_silent_and_more
7946         This one is a bit tricky.  The clear tests seem to depend on the various
7947         breakpoints that have been set before, starting with the "silent"
7948         breakpoints.  So, move all this in a single chunk, it can always be
7949         split later if needed.
7950
7951         Change-Id: I7ba61a5b130ade63eda0c4790534840339f8a72f
7952         Approved-By: Kevin Buettner <kevinb@redhat.com>
7953
7954 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7955
7956         gdb/testsuite/gdb.base/break.exp: split test_break_line_convenience_var
7957         Change-Id: I593002373da971a0a4d6b5355d3fe321873479ab
7958         Approved-By: Kevin Buettner <kevinb@redhat.com>
7959
7960         gdb/testsuite/gdb.base/break.exp: split test_break_user_call
7961         Change-Id: I9151ce9db9435722b758f41c6606b461bf15f320
7962         Approved-By: Kevin Buettner <kevinb@redhat.com>
7963
7964         gdb/testsuite/gdb.base/break.exp: split test_finish_arguments
7965         Change-Id: Id84babed1eeb3ce7d14b94ff332795964e8ead51
7966         Approved-By: Kevin Buettner <kevinb@redhat.com>
7967
7968 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7969
7970         gdb/testsuite/gdb.base/break.exp: use proc_with_prefix for test_next_with_recursion
7971         This one is already in a proc, just make the proc use proc_with_prefix,
7972         for consistency.
7973
7974         Change-Id: I313ecf5097ff04526c29396529baeba84e37df5a
7975         Approved-By: Kevin Buettner <kevinb@redhat.com>
7976
7977 2022-11-24  Simon Marchi  <simon.marchi@polymtl.ca>
7978
7979         gdb/testsuite/gdb.base/break.exp: split test_break_optimized_prologue
7980         Change-Id: Ibf17033c8ce72aa5cfe1b739be2902e84a5e945d
7981         Approved-By: Kevin Buettner <kevinb@redhat.com>
7982
7983         gdb/testsuite/gdb.base/break.exp: split test_rbreak_shlib
7984         Change-Id: I130e8914c2713095aab03e84aba1481b4c7af978
7985         Approved-By: Kevin Buettner <kevinb@redhat.com>
7986
7987         gdb/testsuite/gdb.base/break.exp: split test_break_file_line_convenience_var
7988         Change-Id: I0c31b037669b2917e062bf431372fb6531f8f53c
7989         Approved-By: Kevin Buettner <kevinb@redhat.com>
7990
7991         gdb/testsuite/gdb.base/break.exp: split test_break_commands_clear
7992         Change-Id: Ia58f90117d52fc419fc494836d9b4ed5d902fe9b
7993         Approved-By: Kevin Buettner <kevinb@redhat.com>
7994
7995 2022-11-24  Nick Clifton  <nickc@redhat.com>
7996
7997         Impport libiberty commit: 885b6660c17f from gcc mainline.  Fix gas's acinclude.m4 to stop a potwntial configure time warning message.
7998
7999 2022-11-24  Martin Liska  <mliska@suse.cz>
8000
8001         readelf: Do not require EI_OSABI for IFUNC.
8002                 PR 29718
8003
8004         binutils/ChangeLog:
8005
8006                 * readelf.c (get_symbol_type): Consider STT_GNU_IFUNC as
8007                 reserved name.
8008
8009 2022-11-24  Jan Beulich  <jbeulich@suse.com>
8010
8011         x86: widen applicability and use of CheckRegSize
8012         First of all make operand_type_register_match() apply to all sized
8013         operands, i.e. in Intel Syntax also to respective memory ones. This
8014         addresses gas wrongly accepting certain SIMD insns where register and
8015         memory operand sizes should match but don't. This apparently has
8016         affected all templates with one memory-only operand and one or more
8017         register ones, both permitting at least two sizes, due to CheckRegSize
8018         not taking effect.
8019
8020         Then also add CheckRegSize to a couple of non-SIMD templates matching
8021         that same pattern of memory-only vs register operands. This replaces
8022         bogus (for Intel Syntax) diagnostics referring to a wrong suffix (when
8023         none was used at all) by "type mismatch" ones, just like already emitted
8024         for insns where the template allows a register operand alongside a
8025         memory one at any particular position.
8026
8027         This also is a prereq to limiting (ideally eliminating in the long run)
8028         suffix "derivation" in Intel Syntax mode.
8029
8030         While making the code adjustment also flip order of checks to do the
8031         cheaper one first in both cases.
8032
8033 2022-11-24  Jan Beulich  <jbeulich@suse.com>
8034
8035         x86: add missing CheckRegSize
8036         To properly and predictably determine operand size encoding (operand
8037         size or REX.W prefixes), consistent operand sizes need to be specified.
8038         Add CheckRegSize where this was previously missing.
8039
8040         x86: correct handling of LAR and LSL
8041         Both uniformly only ever take 16-bit memory operands while at the same
8042         time requiring matching (in size) register operands, which then also
8043         should disassemble that way. This in particular requires splitting each
8044         of the templates for the assembler and separating decode of the
8045         register and memory forms in the disassembler.
8046
8047 2022-11-24  Alan Modra  <amodra@gmail.com>
8048
8049         Tidy objdump printing of section size
8050                 * objdump.c (load_specific_debug_section): Use PRIx64 format.
8051
8052         Constify nm format array
8053                 * nm.c (formats, format): Make const.
8054
8055 2022-11-24  Alan Modra  <amodra@gmail.com>
8056
8057         PR16995, m68k coldfire emac immediate to macsr incorrect disassembly
8058         Mode/reg bits for these insns are 000 Dy, 001 Ay, and 111 100 for the
8059         move immediate.
8060
8061                 * m68k-opc.c (m68k_opcodes): Only accept 000 and 001 as mode
8062                 for move reg to macsr/mask insns.
8063
8064 2022-11-24  Mark Harmstone  <mark@harmstone.com>
8065
8066         gas: Disable --gcodeview on PE targets with no O_secrel
8067
8068 2022-11-24  GDB Administrator  <gdbadmin@sourceware.org>
8069
8070         Automatic date update in version.in
8071
8072 2022-11-23  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
8073
8074         gdb/arm: Include FType bit in EXC_RETURN pattern on v8m
8075         For v8m, the EXC_RETURN pattern, without security extension, consists of
8076         FType, Mode and SPSEL.  These are the same bits that are used in v7m.
8077         This patch extends the list of patterns to include also the FType bit
8078         and not just Mode and SPSEL bits for v8m targets without security
8079         extension.
8080
8081 2022-11-23  Alan Modra  <amodra@gmail.com>
8082
8083         regen POTFILES.in
8084
8085 2022-11-23  Alan Modra  <amodra@gmail.com>
8086
8087         PR22509 - Null pointer dereference on coff_slurp_reloc_table
8088         This extends the commit 4581a1c7d304 fix to more targets, which
8089         hardens BFD a little.  I think the real underlying problem was the
8090         bfd_canonicalize_reloc call in load_specific_debug_section which
8091         passed a NULL for "symbols".  Fix that too.
8092
8093                 PR 22509
8094         bfd/
8095                 * aoutx.h (swap_ext_reloc_out): Gracefully handle NULL symbols.
8096                 * i386lynx.c (swap_ext_reloc_out): Likewise.
8097                 * pdp11.c (pdp11_aout_swap_reloc_out): Likewise.
8098                 * coff-tic30.c (reloc_processing): Likewise.
8099                 * coff-tic4x.c (tic4x_reloc_processing): Likewise.
8100                 * coff-tic54x.c (tic54x_reloc_processing): Likewise.
8101                 * coff-z80.c (reloc_processing): Likewise.
8102                 * coff-z8k.c (reloc_processing): Likewise.
8103                 * ecoff.c (ecoff_slurp_reloc_table): Likewise.
8104                 * som.c (som_set_reloc_info): Likewise.
8105         binutils/
8106                 * objdump.c (load_specific_debug_section): Pass syms to
8107                 bfd_canonicalize_reloc.
8108
8109 2022-11-23  Alan Modra  <amodra@gmail.com>
8110
8111         asan: NULL deref in filter_symbols
8112         If tdata->symbols is NULL, make tdata->symcount zero too.  This makes
8113         wasm_get_symtab_upper_bound return the proper result and stops
8114         cascading errors.
8115
8116                 * wasm-module.c (wasm_scan_name_function_section): Clear
8117                 tdata->symcount on error.
8118
8119 2022-11-23  Luis Machado  <luis.machado@arm.com>
8120
8121         Document the memory_tagged argument for memory region callbacks
8122         There were no comments in some instances (gdb/defs.h, gdb/core.c and
8123         gdb/linux-tdep.c), so address that by adding comments where those are missing.
8124
8125 2022-11-23  Tom de Vries  <tdevries@loganberry-1.arch.suse.de>
8126
8127         Fix gdb.cp/gdb2495.exp on powerpc64le
8128         On powerpc64le-linux I ran into this FAIL:
8129         ...
8130         (gdb) p exceptions.throw_function()^M
8131         terminate called after throwing an instance of 'int'^M
8132         ^M
8133         Program received signal SIGABRT, Aborted.^M
8134         0x00007ffff7979838 in raise () from /lib64/libc.so.6^M
8135         The program being debugged was signaled while in a function called from GDB.^M
8136         GDB remains in the frame where the signal was received.^M
8137         To change this behavior use "set unwindonsignal on".^M
8138         Evaluation of the expression containing the function^M
8139         (SimpleException::throw_function()) will be abandoned.^M
8140         When the function is done executing, GDB will silently stop.^M
8141         (gdb) FAIL: gdb.cp/gdb2495.exp: call a function that raises an exception \
8142           without a handler.
8143         ...
8144
8145         The following happens:
8146         - we start an inferior call
8147         - an internal breakpoint is set on the global entry point of std::terminate
8148         - the inferior call uses the local entry point
8149         - the breakpoint is not triggered
8150         - we run into std::terminate
8151
8152         We can fix this by simply adding the missing gdbarch_skip_entrypoint call in
8153         create_std_terminate_master_breakpoint, but we try to do this a bit more
8154         generic, by:
8155         - adding a variant of function create_internal_breakpoint which takes a
8156           minimal symbol instead of an address as argument
8157         - in the new function:
8158           - using both gdbarch_convert_from_func_ptr_addr and gdbarch_skip_entrypoint
8159           - documenting why we don't need to use gdbarch_addr_bits_remove
8160           - adding a note about possibly
8161             needing gdbarch_deprecated_function_start_offset.
8162         - using the new function in:
8163           - create_std_terminate_master_breakpoint
8164           - create_exception_master_breakpoint_hook, which currently uses only
8165             gdbarch_convert_from_func_ptr_addr.
8166
8167         Note: we could use the new function in more locations in breakpoint.c, but
8168         as we're not aware of any related failures, we declare this out of scope for
8169         this patch.
8170
8171         Tested on x86_64-linux, powerpc64le-linux.
8172
8173         Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com>
8174         Tested-by: Carl Love <cel@us.ibm.com>
8175         PR tdep/29793
8176         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29793
8177
8178 2022-11-23  Xiao Zeng  <zengxiao@eswincomputing.com>
8179
8180         RISC-V: Make R_RISCV_SUB6 conforms to riscv ABI standard
8181         According to the riscv psabi, R_RISCV_SUB6 only allows 6 least significant
8182         bits are valid, but since binutils implementation, we usually get 8 bits
8183         field for it.  That means, the high 2 bits could be other field and have
8184         different purpose.  Therefore, we should filter the 8 bits to 6 bits before
8185         calculate, and then only encode the valid 6 bits back.  By the way, we also
8186         need the out-of-range check for R_RISCV_SUB6, and the overflow checks for
8187         all R_RISCV_ADD/SUB/SET relocations, but we can add them in the future patches.
8188
8189         Passing riscv-gnu-toolchain regressions.
8190
8191         bfd/ChangeLog:
8192
8193                 * elfnn-riscv.c (riscv_elf_relocate_section): Take the R_RISCV_SUB6
8194                 lower 6 bits as the significant bit.
8195                 * elfxx-riscv.c (riscv_elf_add_sub_reloc): Likewise.
8196
8197 2022-11-23  Mark Harmstone  <mark@harmstone.com>
8198
8199         gas: Add --gcodeview option
8200
8201         ld: Add section contributions substream to PDB files
8202
8203 2022-11-23  GDB Administrator  <gdbadmin@sourceware.org>
8204
8205         Automatic date update in version.in
8206
8207 2022-11-22  John Baldwin  <jhb@FreeBSD.org>
8208
8209         aarch64-fbsd: Use a static regset for the TLS register set.
8210         This uses custom collect/supply regset handlers which pass the TLS
8211         register number from the gdbarch_tdep as the base register number.
8212
8213         Approved-By: Simon Marchi <simon.marchi@efficios.com>
8214
8215 2022-11-22  John Baldwin  <jhb@FreeBSD.org>
8216
8217         arm-fbsd: Use a static regset for the TLS register set.
8218         This uses custom collect/supply regset handlers which pass the TLS
8219         register number from the gdbarch_tdep as the base register number.
8220
8221         Approved-By: Simon Marchi <simon.marchi@efficios.com>
8222
8223 2022-11-22  John Baldwin  <jhb@FreeBSD.org>
8224
8225         fbsd-nat: Pass an optional register base to the register set helpers.
8226         This is needed to permit using the helpers for register sets with a
8227         variable base.  In particular regnum needs to be converted into a
8228         relative register number before passed to regcache_map_supplies.
8229
8230         Approved-By: Simon Marchi <simon.marchi@efficios.com>
8231
8232 2022-11-22  John Baldwin  <jhb@FreeBSD.org>
8233
8234         fbsd-nat: Use regset supply/collect methods.
8235         fbsd-nat includes various helper routines for fetching and storing
8236         register sets via ptrace where the register set is described by a
8237         regset.  These helper routines directly invoke the
8238         supply/collect_regset regcache methods which doesn't permit a regset
8239         to provide custom logic when fetching or storing a register set.
8240         Instead, just use the function pointers from the struct regset
8241         directly.
8242
8243         Approved-By: Simon Marchi <simon.marchi@efficios.com>
8244
8245 2022-11-22  John Baldwin  <jhb@FreeBSD.org>
8246
8247         regcache: Add collect/supply_regset variants that accept a register base.
8248         Some register sets described by an array of regcache_map_entry
8249         structures do not have fixed register numbers in their associated
8250         architecture but do describe a block of registers whose numbers are at
8251         fixed offsets relative to some base register value.  An example of
8252         this are the TLS register sets for the ARM and AArch64 architectures.
8253
8254         Currently OS-specific architectures create register maps and register
8255         sets dynamically using the register base number.  However, this
8256         requires duplicating the code to create the register map and register
8257         set.  To reduce duplication, add variants of the collect_regset and
8258         supply_regset regcache methods which accept a base register number.
8259         For valid register map entries (i.e. not REGCACHE_MAP_SKIP), add this
8260         base register number to the value from the map entry to determine the
8261         final register number.
8262
8263         Approved-By: Simon Marchi <simon.marchi@efficios.com>
8264
8265 2022-11-22  H.J. Lu  <hjl.tools@gmail.com>
8266
8267         x86: Don't define _TLS_MODULE_BASE_ for ld -r
8268         bfd/
8269
8270                 PR ld/29820
8271                 * elfxx-x86.c (_bfd_x86_elf_always_size_sections): Don't define
8272                  _TLS_MODULE_BASE_ for ld -r.
8273
8274         ld/
8275
8276                 PR ld/29820
8277                 * testsuite/ld-x86-64/pr29820.d: New file.
8278                 * testsuite/ld-x86-64/pr29820.s: Likewise.
8279                 * testsuite/ld-x86-64/x86-64.ex: Run pr29820.
8280
8281 2022-11-22  Alan Modra  <amodra@gmail.com>
8282
8283         Don't use "long" in readelf for file offsets
8284         The aim here is to improve readelf handling of large 64-bit object
8285         files on LLP64 hosts (Windows) where long is only 32 bits.  The patch
8286         changes more than just file offsets.  Addresses and sizes are also
8287         changed to avoid "long".  Most places get to use uint64_t even where
8288         size_t may be more appropriate, because that allows some overflow
8289         checks to be implemented easily (*alloc changes).
8290
8291                 * dwarf.c (cmalloc, xcmalloc, xcrealloc, xcalloc2): Make nmemb
8292                 parameter uint64_t.
8293                 * dwarf.h: Update prototypes.
8294                 (struct dwarf_section): Make num_relocs uint64_t.
8295                 * elfcomm.c (setup_archive): Update error format.
8296                 * elfcomm.h (struct archive_info): Make sym_size, longnames_size,
8297                 nested_member_origin, next_arhdr_offset uint64_t.
8298                 * readelf.c (struct filedata): Make archive_file_offset,
8299                 archive_file_size, string_table_length, dynamic_addr,
8300                 dynamic_nent, dynamic_strings_length, num_dynamic_syms,
8301                 dynamic_syminfo_offset uint64_t.
8302                 (many functions): Replace uses of "unsigned long" with
8303                 "uint64_t" or "size_t".
8304
8305 2022-11-22  Alan Modra  <amodra@gmail.com>
8306
8307         Re: readelf: use fseeko64 or fseeko if possible
8308         Replace the macros with a small wrapper function that verifies the fseek
8309         offset arg isn't overlarge.
8310
8311                 * readelf.c (FSEEK_FUNC): Delete, replace uses with..
8312                 (fseek64): ..this new function.
8313                 (process_program_headers): Don't cast p_offset to long.
8314
8315 2022-11-22  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
8316
8317         gdb/arm: Fix obvious typo in b0b23e06c3a
8318         As part of the rebase of the patch, I managed to loose the local
8319         changes I had for the comments from Tomas in
8320         https://sourceware.org/pipermail/gdb-patches/2022-November/193413.html
8321         This patch corrects the obvious two typos.
8322
8323 2022-11-22  Michael Matz  <matz@suse.de>
8324
8325         binutils/configure.ac: integrate last change
8326         Integrate back checks for fseeko{,64} into configure.ac, so
8327         that regeneration works.
8328
8329         binutils/
8330                 * configure.ac: Add fseeko, fseeko64 checks.
8331                 * configure: Regenerate.
8332
8333 2022-11-22  Shahab Vahedi  <shahab@synopsys.com>
8334
8335         opcodes: Correct address for ARC's "isa_config" aux reg
8336         This patch changes the address for "isa_config" auxiliary register
8337         from 0xC2 to the correct value 0xC1.  Moreover, it only exists in
8338         arc700+ and not all ARCs.
8339
8340         opcodes/ChangeLog:
8341
8342                 * arc-regs.h: Change isa_config address to 0xc1.
8343                 isa_config exists for ARC700 and ARCV2 and not ARCALL.
8344
8345 2022-11-22  Bruno Larsen  <blarsen@redhat.com>
8346
8347         gdb/testsuite: remove gcc restriction from gdb.dwarf2/clang-cli-macro.exp
8348         With the recent changes to the dwarf assembler, there is no longer a
8349         need to test for gcc in gdb.dwarf2/clang-cli-macro.exp and mark it as
8350         untested. This commit removes that logic.
8351
8352 2022-11-22  Jan Beulich  <jbeulich@suse.com>
8353
8354         gas/sframe: avoid "shadowing" of glibc function name
8355         Once again: Old enough glibc has an (unguarded) declaration of index()
8356         in string.h, which triggers a "shadows a global declaration" warning
8357         with our choice of wanring level and with at least some gcc versions.
8358
8359 2022-11-22  GDB Administrator  <gdbadmin@sourceware.org>
8360
8361         Automatic date update in version.in
8362
8363 2022-11-21  Brett Werling  <bwerl.dev@gmail.com>
8364
8365         readelf: use fseeko64 or fseeko if possible
8366         Changes readelf to make use first of fseeko64 and then fseeko,
8367         depending on which of those is available. If neither is available,
8368         reverts to the previous behavior of using fseek.
8369
8370         This is necessary when building readelf for LLP64 systems, where a
8371         long will only be 32 bits wide. If the elf file in question is >= 2 GiB,
8372         that is greater than the max long value and therefore fseek will fail
8373         indicating that the offset is negative. On such systems, making use of
8374         fseeko64 or fseeko will result in the ability so seek past the 2 GiB
8375         max long boundary.
8376
8377         Note that large archive handling in readelf remains to be fixed.
8378
8379 2022-11-21  Alan Modra  <amodra@gmail.com>
8380
8381         PR29807, SIGSEGV when linking fuzzed PE object
8382                 PR 29807
8383                 * cofflink.c (_bfd_coff_generic_relocate_section): Skip relocs
8384                 against symbols with a NULL section.
8385
8386 2022-11-21  Alan Modra  <amodra@gmail.com>
8387
8388         Re: ld: Always output local symbol for relocatable link
8389         Remove this code dating back to commit 98790d3a95fc entirely, what it
8390         was trying to do is done elsewhere.
8391
8392                 PR ld/29761
8393                 * elflink.c (elf_link_output_symstrtab): Don't handle symbols
8394                 in SEC_EXCLUDE sections here.
8395
8396 2022-11-21  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
8397
8398         When getting the locno of a bpstat, handle the case of bp with null locations.
8399         The test py-objfile.exp unloads the current file while debugging the process.
8400         This results in bpstat bs->b->loc to become nullptr.
8401         Handle this case in breakpoint.c:bpstat_locno.
8402
8403         Note: GDB crashes on this problem with an internal error,
8404         but the end of gdb summary shows:
8405           ...
8406                           === gdb Summary ===
8407
8408           # of expected passes          36
8409
8410         The output also does not contain a 'FAIL:'.
8411         After the fix, the nr of expected passes increased.
8412
8413         In the gdb.log output, one can see:
8414           ...
8415           Fatal signal: Segmentation fault
8416           ----- Backtrace -----
8417           0x55698905c5b9 gdb_internal_backtrace_1
8418                   ../../binutils-gdb/gdb/bt-utils.c:122
8419           0x55698905c5b9 _Z22gdb_internal_backtracev
8420           ...
8421
8422           ERROR: Couldn't send python print(objfile.filename) to GDB.
8423           ERROR: : spawn id exp9 not open
8424               while executing
8425           "expect {
8426           -i exp9 -timeout 10
8427                   -re ".*A problem internal to GDB has been detected" {
8428                       fail "$message (GDB internal error)"
8429                       gdb_internal_error..."
8430               ("uplevel" body line 1)
8431               invoked from within
8432           ....
8433
8434         Wondering if it might be possible to improve gdb_test to have
8435           gdb_test "python print(objfile.filename)" "None" \
8436               "objfile.filename after objfile is unloaded"
8437         reporting a failed result instead of just producing the internal error.
8438
8439 2022-11-21  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
8440
8441         Fix use after free introduced by $_hit_bpnum/$_hit_locno variables.
8442         If the commands of the bpstat bs contain commands such as step or next or
8443         continue, the BS and its commands are freed by execute_control_command.
8444
8445         So, we cannot remember the BS that was printed. Instead, remember
8446         the bpnum and locno.
8447
8448         Regtested on debian/amd64 and re-run a few tests under valgrind.
8449
8450 2022-11-21  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
8451
8452         Fix step-over-syscall.exp matching regexp for $bpnum.$locno matching
8453         step-over-syscall.exp has some specific tests for gdbserver.
8454         The regexp matching breakpoint hit must take the added locno into account.
8455
8456         Test re-run in 3 modes (normal, native-gdbserver and native-extended-gdbserver).
8457
8458 2022-11-21  Nick Clifton  <nickc@redhat.com>
8459
8460         Fix ARM and AArch64 assembler tests to work in a multi-arch environment.
8461                 PR 29764
8462         gas     * testsuite/gas/arm/cpu-cortex-a76ae.d: Add arm prefix to the -m
8463                 option passed to objdump.
8464                 * testsuite/gas/arm/cpu-cortex-a77.d: Likewise.
8465                 * testsuite/gas/aarch64/cpu-cortex-a76ae.d: Add aarch64 prefix to
8466                 the -m option passed to objdump.
8467                 * testsuite/gas/aarch64/cpu-cortex-a77.d: Likewise.
8468
8469         bfd     * cpu-arm.c (scan): Accept machine names prefixed with "arm:".
8470                 * cpu-aarch64.c (scan): Accept machine names prefixed with "aarch64:".
8471
8472         bin     * doc/binutils.texi (objdump): Note that the -m option supports
8473                 the <architecture>:<machine> syntax.
8474
8475 2022-11-21  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
8476
8477         gdb/arm: Ensure that stack pointers are in sync
8478         For targets with secext, msp and psp can be seen as an alias for one
8479         of msp_s, msp_ns, psp_s or psp_ns.
8480         Without this patch, sp might be secure, but msp or psp is non-secure
8481         (this state can not happen in the hardware).
8482
8483         gdb/arm: Update active msp/psp when switching stack
8484         For targets with secext, msp and psp can be seen as an alias for one
8485         of msp_s, msp_ns, psp_s or psp_ns. When switching active sp, the
8486         corresponding msp/psp needs to be switched too.
8487
8488 2022-11-21  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
8489
8490         gdb/csky just return type from csky_vector_type() for vector resgisters
8491         Some gdb stubs may not describe the type for vector registers in the
8492         tdesc-xml and only send bitsize="128", gdb can't deal with a reg
8493         with default type int with bitsize==128. So Just return csky_vector_type()
8494         for vector resgisters.
8495
8496         gdb/csky return type int32 for float and vector pseudo regs
8497         When reg_nr is one of the float and vector pseudo registers,
8498         return builtin_type (gdbarch)->builtin_int32 for it.
8499
8500 2022-11-21  GDB Administrator  <gdbadmin@sourceware.org>
8501
8502         Automatic date update in version.in
8503
8504 2022-11-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8505
8506         [PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris
8507         gdbsupport compilation badly fails with GCC 12 on Solaris, with errors
8508         like
8509
8510         ../gnulib/config.h:1693:72: error: ‘malloc’ attribute argument 1 is ambiguous
8511          1693 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
8512               |                                                                        ^
8513         ../gnulib/config.h:1693:72: note: use a cast to the expected type to disambiguate
8514
8515         We've not yet been able to determine where the ambiguity actually lies,
8516         so this patch works around the issue by disabling _GL_ATTRIBUTE_DEALLOC
8517         on Solaris, at least as a workaround for GDB 13.
8518
8519         As Tom suggested in the PR, this is done using our infrastructure for
8520         local gnulib patches.
8521
8522         Tested on sparcv9-sun-solaris2.11, amd64-pc-solaris2.11, and
8523         x86_64-pc-linux-gnu.
8524
8525         Approved-By: Simon Marchi <simon.marchi@efficios.com>
8526
8527 2022-11-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8528
8529         Fix sol-thread.c compilation on 32-bit Solaris
8530         sol-thread.c fails to compile on 32-bit Solaris: there are several
8531         instances of
8532
8533         In file included from /vol/src/gnu/gdb/hg/master/local/gdb/../gdbsupport/common-defs.h:203,
8534                          from /vol/src/gnu/gdb/hg/master/local/gdb/defs.h:28,
8535                          from /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:51:
8536         /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c: In member function ‘virtual void sol_thread_target::resume(ptid_t, int, gdb_signal)’:
8537         /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:416:20: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘ULONGEST’ {aka ‘long long unsigned int’} [-Werror=format=]
8538           416 |         warning (_("Specified thread %ld seems to have terminated"),
8539               |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8540         /vol/src/gnu/gdb/hg/master/local/gdb/../gdbsupport/gdb_locale.h:28:29:
8541         note: in definition of macro ‘_’
8542            28 | # define _(String) gettext (String)
8543               |                             ^~~~~~
8544         /vol/src/gnu/gdb/hg/master/local/gdb/sol-thread.c:416:40: note: format
8545         string is defined here
8546           416 |         warning (_("Specified thread %ld seems to have terminated"),
8547               |                                      ~~^
8548               |                                        |
8549               |                                        long int
8550               |                                      %lld
8551
8552         Fixed by using pulongest () instead.
8553
8554         Tested on i386-pc-solaris2.11, amd64-pc-solaris2.11,
8555         sparc-sun-solaris2.11, and sparcv9-sun-solaris2.11 (together with
8556         Simon's patch for PR build/29798).
8557
8558 2022-11-20  GDB Administrator  <gdbadmin@sourceware.org>
8559
8560         Automatic date update in version.in
8561
8562 2022-11-19  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
8563
8564         Add missing gdb_prompt in ctxobj.exp to avoid random failure, fix typo.
8565         ctxobj.exp fails randomly when computer is loaded.
8566         With the addition of $gdb_prompt in the regexp testing for breakpoint hit,
8567         I could not make it fail anymore.
8568
8569         Also fixed a typo in a comment.
8570
8571 2022-11-19  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
8572
8573         Show locno for 'multi location' breakpoint hit msg+conv var $_hit_bbnum $_hit_locno PR breakpoints/12464
8574         This implements the request given in PR breakpoints/12464.
8575
8576         Before this patch, when a breakpoint that has multiple locations is reached,
8577         GDB printed:
8578           Thread 1 "zeoes" hit Breakpoint 1, some_func () at somefunc1.c:5
8579
8580         This patch changes the message so that bkpt_print_id prints the precise
8581         encountered breakpoint:
8582           Thread 1 "zeoes" hit Breakpoint 1.2, some_func () at somefunc1.c:5
8583
8584         In mi mode, bkpt_print_id also (optionally) prints a new table field "locno":
8585           locno is printed when the breakpoint hit has more than one location.
8586         Note that according to the GDB user manual node 'GDB/MI Development and Front
8587         Ends', it is ok to add new fields without changing the MI version.
8588
8589         Also, when a breakpoint is reached, the convenience variables
8590         $_hit_bpnum and $_hit_locno are set to the encountered breakpoint number
8591         and location number.
8592
8593         $_hit_bpnum and $_hit_locno can a.o. be used in the command list of a
8594         breakpoint, to disable the specific encountered breakpoint, e.g.
8595            disable $_hit_bpnum.$_hit_locno
8596
8597         In case the breakpoint has only one location, $_hit_locno is set to
8598         the value 1, so as to allow a command such as:
8599           disable $_hit_bpnum.$_hit_locno
8600         to disable the breakpoint even when the breakpoint has only one location.
8601
8602         This also fixes a strange behaviour: when a breakpoint X has only
8603         one location,
8604           enable|disable X.1
8605         is accepted but transforms the breakpoint in a multiple locations
8606         breakpoint having only one location.
8607
8608         The changes in RFA v4 handle the comments of Tom Tromey:
8609          - Changed convenience var names from $bkptno/$locno to
8610            $_hit_bpnum/$_hit_locno.
8611          - updated the tests and user manual accordingly.
8612            User manual also explictly describes that $_hit_locno is set to 1
8613            for a breakpoint with a single location.
8614          - The variable values are now set in bpstat_do_actions_1 so that
8615            they are set for silent breakpoints, and when several breakpoints
8616            are hit at the same time, that the variables are set to the printed
8617            breakpoint.
8618
8619         The changes in RFA v3 handle the additional comments of Eli:
8620          GDB/NEW:
8621           - Use max 80-column
8622           - Use 'code location' instead of 'location'.
8623           - Fix typo $bkpno
8624           - Ensure that disable $bkptno and disable $bkptno.$locno have
8625             each their explanation inthe example
8626           - Reworded the 'breakpoint-hit' paragraph.
8627          gdb.texinfo:
8628           - Use 'code location' instead of 'location'.
8629           - Add a note to clarify the distinction between $bkptno and $bpnum.
8630           - Use @kbd instead of examples with only one command.
8631
8632         Compared to RFA v1, the changes in v2 handle the comments given by
8633         Keith Seitz and Eli Zaretskii:
8634           - Use %s for the result of paddress
8635           - Use bkptno_numopt_re instead of 2 different -re cases
8636           - use C@t{++}
8637           - Add index entries for $bkptno and $locno
8638           - Added an example for "locno" in the mi interface
8639           - Added examples in the Break command manual.
8640
8641 2022-11-19  Tsukasa OI  <research_trasio@irq.a4lg.com>
8642
8643         RISC-V: Add 'Ssstateen' extension and its CSRs
8644         This commit adds 'Ssstateen' extension, which is a supervisor-visible view
8645         of the 'Smstateen' extension.  It means, this extension implements sstateen*
8646         and hstateen* CSRs of the 'Smstateen' extension.
8647
8648         Note that 'Smstateen' extension itself is unchanged but due to
8649         implementation simplicity, it is implemented so that 'Smstateen' implies
8650         'Ssstateen' (just like 'M' implies 'Zmmul').
8651
8652         This is based on the latest version of RISC-V Profiles
8653         (version 0.9-draft, Frozen):
8654         <https://github.com/riscv/riscv-profiles/commit/226b7f643067b29abc6723fac60d5f6d3f9eb901>
8655
8656         bfd/ChangeLog:
8657
8658                 * elfxx-riscv.c (riscv_implicit_subsets): Update implication rules.
8659                 (riscv_supported_std_s_ext) Add 'Ssstateen' extension.
8660
8661         gas/ChangeLog:
8662
8663                 * config/tc-riscv.c (enum riscv_csr_class): Rename
8664                 CSR_CLASS_SMSTATEEN_AND_H{,_32} to CSR_CLASS_SSSTATEEN_...
8665                 Add CSR_CLASS_SSSTATEEN.
8666                 (riscv_csr_address): Support new/renamed CSR classes.
8667                 * testsuite/gas/riscv/csr.s: Add 'Ssstateen' extension to comment.
8668                 * testsuite/gas/riscv/csr-version-1p9p1.l: Reflect changes to
8669                 error messages.
8670                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
8671                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
8672                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
8673                 * testsuite/gas/riscv/ssstateen-csr.s: Test for 'Ssstateen' CSRs.
8674                 * testsuite/gas/riscv/ssstateen-csr.d: Likewise.
8675                 * testsuite/gas/riscv/smstateen-csr-s.d: Test to make sure that
8676                 supervisor/hypervisor part of 'Smstateen' CSRs are accessible from
8677                 'RV32IH_Smstateen', not just from 'RV32IH_Ssstateen' that is tested
8678                 in ssstateen-csr.d.
8679
8680         include/ChangeLog:
8681
8682                 * opcode/riscv-opc.h: Update DECLARE_CSR declarations with
8683                 new CSR classes.
8684
8685 2022-11-19  GDB Administrator  <gdbadmin@sourceware.org>
8686
8687         Automatic date update in version.in
8688
8689 2022-11-18  Simon Marchi  <simon.marchi@efficios.com>
8690
8691         gdbserver/linux-x86: move lwp declaration out of __x86_64__ region
8692         Commit 4855cbdc3d8f ("gdbserver/linux-x86: make is_64bit_tdesc accept
8693         thread as a parameter") caused this when building in 32 bits / i386
8694         mode:
8695
8696               CXX    linux-x86-low.o
8697             In file included from /home/smarchi/src/binutils-gdb/gdbserver/linux-x86-low.cc:24:
8698             /home/smarchi/src/binutils-gdb/gdbserver/linux-x86-low.cc: In member function ‘virtual int x86_target::low_get_thread_area(int, CORE_ADDR*)’:
8699             /home/smarchi/src/binutils-gdb/gdbserver/linux-x86-low.cc:357:47: error: ‘lwp’ was not declared in this scope
8700               357 |     struct thread_info *thr = get_lwp_thread (lwp);
8701                   |                                               ^~~
8702             /home/smarchi/src/binutils-gdb/gdbserver/linux-low.h:709:31: note: in definition of macro ‘get_lwp_thread’
8703               709 | #define get_lwp_thread(lwp) ((lwp)->thread)
8704                   |                               ^~~
8705
8706         This is because it moved the lwp variable declaration inside the
8707         __x86_64__ guard, making it unavailable when building in 32 bits mode.
8708         Move the lwp variable outside of the __x86_64__ region.
8709
8710         Change-Id: I7fa3938c6b44b345c27a52c8b8d3ea12aba53e05
8711
8712 2022-11-18  Simon Marchi  <simon.marchi@efficios.com>
8713
8714         gdbserver: use current_process in ps_getpid
8715         The following patch ("gdbserver: switch to right process in
8716         find_one_thread") makes it so find_one_thread calls into libthread_db
8717         with a current process but no current thread.  This tripped on ps_getpid
8718         using current_thread in order to get the process' pid.  Get the pid from
8719         `current_process ()` instead, which removes the need to have a current
8720         thread.  Eventually, it would be good to get it from the
8721         gdb_ps_prochandle_t structure, to avoid the need for a current process
8722         as well.
8723
8724         Reviewed-By: Andrew Burgess <aburgess@redhat.com>
8725         Change-Id: I9d2fae266419199a2fbc2fde0a5104c6e0dbd2d5
8726
8727 2022-11-18  Simon Marchi  <simon.marchi@efficios.com>
8728
8729         gdbserver/linux-x86: make is_64bit_tdesc accept thread as a parameter
8730         ps_get_thread_area receives as a parameter the lwpid it must work on.
8731         It then calls is_64bit_tdesc, which uses the current_thread as the
8732         thread to work on.  However, it is not said that both are the same.
8733
8734         This became a problem when working in a following patch that makes
8735         find_one_thread switch to a process but to no thread (current_thread ==
8736         nullptr).  When libthread_db needed to get the thread area,
8737         is_64bit_tdesc would try to get the regcache of a nullptr thread.
8738
8739         Fix that by making is_64bit_tdesc accept the thread to work on as a
8740         parameter.  Find the right thread from the context, when possible (when
8741         we know the lwpid to work on).  Otherwise, pass "current_thread", to
8742         retain the existing behavior.
8743
8744         Reviewed-By: Andrew Burgess <aburgess@redhat.com>
8745         Change-Id: I44394d6be92392fa28de71982fd04517ce8a3007
8746
8747 2022-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
8748
8749         gdbserver/linux: take condition out of callback in find_lwp_pid
8750         Just a small optimization, it's not necessary to recompute lwp at each
8751         iteration.
8752
8753         While at it, change the variable type to long, as ptid_t::lwp returns a
8754         long.
8755
8756         Reviewed-By: Andrew Burgess <aburgess@redhat.com>
8757         Change-Id: I181670ce1f90b59cb09ea4899367750be2ad9105
8758
8759 2022-11-18  Johnson Sun  <j3.soon777@gmail.com>
8760
8761         Fix deletion of FinishBreakpoints
8762         Currently, FinishBreakpoints are set at the return address of a frame based on
8763         the `finish' command, and are meant to be temporary breakpoints. However, they
8764         are not being cleaned up after use, as reported in PR python/18655. This was
8765         happening because the disposition of the breakpoint was not being set
8766         correctly.
8767
8768         This commit fixes this issue by correctly setting the disposition in the
8769         post-stop hook of the breakpoint. It also adds a test to ensure this feature
8770         isn't regressed in the future.
8771
8772         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18655
8773
8774 2022-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
8775
8776         gdb: fix symtab.c build on 32 bit targets
8777         When building on Ubuntu 22.04, gcc 12, x86-64 with -m32 and -O2, I get:
8778
8779               CXX    symtab.o
8780             /home/smarchi/src/binutils-gdb/gdb/symtab.c: In member function â€˜std::vector<symbol_search> global_symbol_searcher::search() const’:
8781             /home/smarchi/src/binutils-gdb/gdb/symtab.c:4961:44: error: â€˜__builtin___sprintf_chk’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
8782              4961 |               sprintf (tmp, "operator%.*s%s", fix, " ", opname);
8783                   |                                            ^
8784             In file included from /usr/include/stdio.h:894,
8785                              from ../gnulib/import/stdio.h:43,
8786                              from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/common-defs.h:86,
8787                              from /home/smarchi/src/binutils-gdb/gdb/defs.h:28,
8788                              from /home/smarchi/src/binutils-gdb/gdb/symtab.c:20:
8789             In function â€˜int sprintf(char*, const char*, ...)’,
8790                 inlined from â€˜std::vector<symbol_search> global_symbol_searcher::search() const’ at /home/smarchi/src/binutils-gdb/gdb/symtab.c:4961:16:
8791             /usr/include/i386-linux-gnu/bits/stdio2.h:38:34: note: â€˜__builtin___sprintf_chk’ output between 9 and 2147483648 bytes into a destination of size 2147483647
8792                38 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
8793                   |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8794                39 |                                   __glibc_objsize (__s), __fmt,
8795                   |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8796                40 |                                   __va_arg_pack ());
8797                   |                                   ~~~~~~~~~~~~~~~~~
8798
8799         PR build/29798 shows a similar error message but on Solaris.
8800
8801         Work around that by using string_printf.  It is a good thing to get rid
8802         of the alloca anyway.
8803
8804         Change-Id: Ifbac11fee3062ad7f134d596b4e2229dc5d166f9
8805         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29798
8806
8807 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
8808
8809         gdb/testsuite: rewrite gdb.cp/call-method-register.exp with dwarf assembler
8810         Convert the gdb.cp/call-method-register.exp test to make use of the
8811         DWARF assembler.
8812
8813         The existing gdb.cp/call-method-register.exp test relies on a GCC
8814         extension - forcing a local variable into a particular named register.
8815
8816         This means that the test will only work with Clang, and, as we have to
8817         name the register into which the variable will be placed, will only
8818         work for those targets where we've selected a suitable register,
8819         currently this is x86-64, i386, and ppc64.
8820
8821         By switching to the DWARF assembler, the test will work with gcc and
8822         clang, and should work on most, if not all, architectures.
8823
8824         The test creates a small structure, something that can fit within a
8825         register, and then tries to call a method on the structure from within
8826         GDB.  This should fail because GDB can't take the address of the in
8827         register structure (for the `this` pointer).
8828
8829         As the test is for a failure case, then we don't really care _which_
8830         register the structure is in, and I take advantage of this for the
8831         DWARF assembler test, I just declare that the variable is in
8832         DW_OP_reg0, whatever that might be.  I've tested the new test on
8833         x86-64, ppc, aarch64, and risc-v, and the test runs, and passes on all
8834         these architectures, which is already more than we used to cover.
8835
8836         Additionally, on x86-64, I've tested with Clang and gcc, and the test
8837         runs and passed with both compilers.
8838
8839         Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
8840
8841 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
8842
8843         gdb/testsuite: fix gdb.debuginfod/fetch_src_and_symbols.exp with Clang
8844         The gdb.debuginfod/fetch_src_and_symbols.exp test is showing a single
8845         failure when run with some older versions of Clang, e.g. 9.0.1.
8846
8847         The problem appears to be with Clang's generated line table.  The test
8848         source looks like this:
8849
8850           int
8851           main()
8852           {
8853             asm ("main_label: .globl main_label");
8854             return 0;
8855           }
8856
8857         In GDB, when we 'start', we expect to stop at the 'return 0;' line.
8858         This is the behaviour when the compiler is gcc, or later versions of
8859         Clang.
8860
8861         However, with Clang 9.0.2, I see GDB stop on the 'asm' line.
8862
8863         In this commit I'll fix this issue by placing a breakpoint on the
8864         return line, and then using gdb_continue_to_breakpoint to ensure we
8865         have stopped in the correct place.
8866
8867         Of course, using gdb_continue_to_breakpoint will only work if we are
8868         not already stopped at the breakpoint location, so I've added some
8869         filler work before the 'return 0;' line.  With this done we can use
8870         gdb_continue_to_breakpoint in all cases.
8871
8872         As a result of adding the new filler work, one of the later tests,
8873         that used the 'list' command, no longer see the correct expected
8874         output (the top line of the source file is no longer included in the
8875         output).  I've fixed this by listing a known specific line, the test
8876         is checking that GDB managed to find the source file, it doesn't
8877         matter which source line we list, as long as we can list something.
8878
8879 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
8880
8881         gdb/testsuite: rename source file gdb.debuginfod/main.c
8882         The test gdb.debuginfod/fetch_src_and_symbols.exp uses a source file
8883         named main.c.  I can't see any particular reason why the file is named
8884         as such.
8885
8886         Usually test source files are named after the test script.
8887
8888         This commit just renames the source file inline with the test script,
8889         and updates the call to standard_testfile (removing the reference to
8890         main.c).
8891
8892         There's no particular reason for this change other than seeing the
8893         file named main.c made me thing that the source file must be shared
8894         with some other test (it isn't).
8895
8896         There should be no change in what is tested after this commit.
8897
8898 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
8899
8900         gdb/testsuite: add (and use) a new build-id compile option
8901         I noticed that the gdb.debuginfod/fetch_src_and_symbols.exp test was
8902         failing when run with Clang as the compiler.
8903
8904         This test relies on the compiled binaries having a build-id within
8905         them.  For GCC, really GNU ld, the default is to always include a
8906         build-id.
8907
8908         When compiling with Clang though, the default is for no build-id.
8909
8910         I did consider *always* turning on the build-id feature when the
8911         compiler is Clang, but that felt a little weird.
8912
8913         Instead, I propose that we add a new 'build-id' compiler option to
8914         gdb_compile, this flag indicates that the test _requires_ a build-id.
8915         In gcc_compile we can then add the required flags if the compiler is
8916         Clang so that we do get a build-id.
8917
8918         With this change the gdb.debuginfod/fetch_src_and_symbols.exp test
8919         now (mostly) passes with Clang 9.0.1 and 15.0.2, and still passes with
8920         gcc.  The 'mostly' part is an unrelated issue, and will be addressed
8921         in a later commit in this series.
8922
8923         Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
8924
8925 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
8926
8927         gdb/testsuite: fix gdb.compile/compile-ops.exp with clang
8928         I noticed that the gdb.compile/compile-ops.exp test was failing when
8929         run with Clang as the compiler.
8930
8931         This test makes use of the DWARF assembler, and, it turns out, uses
8932         a technique which is not portable to Clang.   This problem is
8933         described in the comment on the function_range proc in lib/dwarf.exp,
8934         the explanation is:
8935
8936           # If the compiler is gcc, we can do the following to get function start
8937           # and end address too:
8938           #
8939           # asm ("func_start: .globl func_start");
8940           # static void func (void) {}
8941           # asm ("func_end: .globl func_end");
8942           #
8943           # however, this isn't portable, because other compilers, such as clang,
8944           # may not guarantee the order of global asms and function.  The code
8945           # becomes:
8946           #
8947           # asm ("func_start: .globl func_start");
8948           # asm ("func_end: .globl func_end");
8949           # static void func (void) {}
8950
8951         These start/end labels are used for computing the function start, end,
8952         and length.  The portable solution is to place a label within the
8953         function, like this:
8954
8955           #  int main (void)
8956           #  {
8957           #    asm ("main_label: .globl main_label");
8958           #    return 0;
8959           #  }
8960
8961         And make use of 'proc function_range' (from lib/dwarf.exp).
8962
8963         So, that's what I do in this commit.
8964
8965         One consequence of this change is that we need to compile the source
8966         file, and have it loaded into a GDB session, before calling
8967         function_range, so I've added an early call to prepare_for_testing.
8968
8969         Additionally, this test script was generating the DWARF assembler into
8970         a file called gdbjit-ops.S, I suspect a copy and paste issue there, so
8971         I've switched this to use compile-ops-dbg.S instead, which is more
8972         inline with what other DWARF assembler tests do.
8973
8974         The only other change, which might be a problem, is that I also
8975         deleted these two lines from the source file:
8976
8977           asm (".section \".text\"");
8978           asm (".balign 8");
8979
8980         These lines were setting the alignment of the .text section.  What I
8981         don't know is whether this was significant or not.  If it is
8982         significant, then I can't see why.
8983
8984         On x86-64, the test still passes fine without these lines, but that
8985         doesn't mean the test wont start failing on some other architecture.
8986
8987         Still, I figure, lets remove them, then, if/when we find a test that
8988         starts failing, we can add the lines back, along with an explanation
8989         for why the extra alignment is required.
8990
8991         But, if people would prefer to be more conservative, then I'm happy to
8992         just add the lines back.
8993
8994         Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
8995
8996 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
8997
8998         gdb/testsuite: fix gdb.trace/unavailable-dwarf-piece.exp with Clang
8999         I noticed that the test gdb.trace/unavailable-dwarf-piece.exp was
9000         failing when run with Clang.  Or rather, the test was not running as
9001         the test executable failed to compile.
9002
9003         The problem is that Clang was emitting this warning:
9004
9005           warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument]
9006
9007         This warning is emitted when compiling the assembler file generated
9008         by the DWARF assembler.
9009
9010         Most DWARF assembler tests generate the assembler file into a file
9011         with the '.S' extension.  However, this particular test uses a '.s'
9012         extension.
9013
9014         Now a .S file will be passed through the preprocessor, while a .s will
9015         be sent straight to the assembler.  My guess is that Clang doesn't
9016         support the -fdiagnostics-color=never option for the assembler, but
9017         does for the preprocessor.
9018
9019         That's a little annoying, but easily worked around.  We don't care if
9020         our assembler file is passed through the preprocessor, so, in this
9021         commit, I just change the file extension from .s to .S, and the
9022         problem is fixed.
9023
9024         Currently, the unavailable-dwarf-piece.exp script names the assembler
9025         file using standard_output_file, in this commit I've switched to make
9026         use of standard_testfile, as that seems to be the more common way of
9027         doing this sort of thing.
9028
9029         With these changes the test now passes with Clang 9.0.1 and 15.0.2,
9030         and also still passes with gcc.
9031
9032         Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
9033
9034 2022-11-18  Andrew Burgess  <aburgess@redhat.com>
9035
9036         gdb/testsuite: don't avoid DWARF assembler tests with Clang
9037         Two tests make the claim that the DWARF assembler requires gcc,
9038         however, this isn't true.  I think at one point, when the DWARF
9039         assembler was first added, we did use some techniques that were not
9040         portable (see the comments in lib/dwarf.exp on function_range for
9041         details), however, I think most DWARF assembler tests will now work
9042         fine with Clang.
9043
9044         The two tests that I modify in this commit both work fine with Clang,
9045         at least, I've tested with Clang 9.0.1 and 15.0.2, and don't see any
9046         problems, so I'm removing the early return logic that stops these
9047         tests from running with Clang.
9048
9049         Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
9050
9051 2022-11-18  Zac Walker  <zac.walker@linaro.org>
9052
9053         GAS fix alignment for aarch64-pe
9054         Fixes issue where various values of '.align' causes writing of COFF files to fail.
9055         Specific to the aarch64-pe target.
9056
9057 2022-11-18  Alan Modra  <amodra@gmail.com>
9058
9059         PR29799 heap buffer overflow in display_gdb_index dwarf.c:10548
9060                 PR 29799
9061                 * dwarf.c (display_gdb_index): Typo fix.
9062
9063         go32 sanity check
9064                 * coff-stgo32 (go32exe_check_format): Sanity check stubsize against
9065                 filesize before malloc.
9066
9067         Regen potfiles for sframe
9068
9069 2022-11-18  GDB Administrator  <gdbadmin@sourceware.org>
9070
9071         Automatic date update in version.in
9072
9073 2022-11-17  Indu Bhagat  <indu.bhagat@oracle.com>
9074
9075         [gas, aarch64]: fix build breakage for aarch64-pe
9076         SFrame is supported for ELF only.  Keep the definitions and declarations
9077         guarded with OBJ_ELF consistently.
9078
9079         ChangeLog:
9080
9081                 * gas/config/tc-aarch64.h:  Guard SFrame related definitions
9082                   with OBJ_ELF.
9083
9084 2022-11-17  Tom Tromey  <tromey@adacore.com>
9085
9086         Fix static initialization order problem in windows-nat.c
9087         This patch fixes a static initialization order problem in
9088         windows-nat.c that was pointed out by Jon Turney.  The underlying
9089         problem is that the windows_nat_target constructor relies on
9090         serial_logfile already being constructed, but this is not enforced by
9091         C++ rules.  This patch fixes the problem by initializing the global
9092         windows_nat_target later.
9093
9094 2022-11-17  H.J. Lu  <hjl.tools@gmail.com>
9095
9096         opcodes: Define NoSuf in i386-opc.tbl
9097         Use NoSuf to replace No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf
9098         and add the explicit NoSuf to AddrPrefixOpReg in templates.
9099
9100                 * i386-opc.tbl (NoSuf): New macro.
9101                 (AddrPrefixOpReg): Remove No_?Suf.
9102                 Replace No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf with
9103                 NoSuf in templates.
9104                 Add NoSuf to AddrPrefixOpReg in templates.
9105
9106 2022-11-17  H.J. Lu  <hjl.tools@gmail.com>
9107
9108         i386: Move i386_seg_prefixes to gas
9109         gas/
9110
9111                 * config/tc-i386.c (i386_seg_prefixes): New. Moved from opcodes.
9112
9113         opcodes/
9114
9115                 * i386-opc.c (i386_seg_prefixes): Removed.
9116                 * i386-opc.h (i386_seg_prefixes): Likewise.
9117
9118 2022-11-17  Carl Love  <cel@us.ibm.com>
9119
9120         PowerPC, fix gdb.base/retval-large-struct.exp
9121         Support for printining non-trivial return values was recently added in
9122         commit:
9123
9124           commit a0eda3df5b750ae32576a9be092b361281a41787
9125           Author: Carl Love <cel@us.ibm.com>
9126           Date:   Mon Nov 14 16:22:37 2022 -0500
9127
9128             PowerPC, fix support for printing the function return value for non-trivial values.
9129
9130         The functionality can now be used to fix gdb.base/retval-large-struct.exp.
9131         The test just needs to be compiled with -fvar-tracking to enable GDB to
9132         determine the address off the return buffer when the function is called.
9133
9134         The current output from the test:
9135
9136         34        return big_struct;
9137         (gdb) PASS: gdb.base/retval-large-struct.exp: continue to breakpoint: Break in print_large_struct
9138         finish
9139         warning: Cannot determine the function return value.
9140         Try compiling with -fvar-tracking.
9141         Run till exit from #0  return_large_struct () at binutils-gdb-current/gdb/testsuite/gdb.base/retval-large-struct.c:34
9142         main (argc=1, argv=0x7fffffffcd58) at binutils-gdb-current/gdb/testsuite/gdb.base/retval-large-struct.c:44
9143         44        return 0;
9144         Value returned has type: struct big_struct_t. Cannot determine contents
9145         (gdb) FAIL: gdb.base/retval-large-struct.exp: finish from return_large_struct
9146         testcase binutils-gdb-current/gdb/testsuite/gdb.base/retval-large-struct.exp completed in 1 seconds
9147
9148         This patch adds the command line argument -fvar-tracking to enable gdb to
9149         determine the return vaule and thus fixing the test.
9150
9151         Patch tested on Power 10 with no regressions.
9152
9153 2022-11-17  Tom Tromey  <tromey@adacore.com>
9154
9155         Use boolean literals for pagination_enabled
9156         I noticed a couple of spots that used '0' rather than 'false' when
9157         modifying pagination_enabled.  This patch cleans these up.
9158
9159 2022-11-17  Carl Love  <cel@us.ibm.com>
9160
9161         Change NULL to nullptr in gdb/infcmd.c and gdb/infrun.c
9162         The GDB coding standard specifies that nullptr should be used instead of
9163         NULL.  There are numerous uses of NULL and nullptr in files infcmd.c and
9164         infrun.c.  This patch replaces the various uses of NULL with nullptr in
9165         the source files.  The use of NULL in the comments was not changed.
9166
9167         The patch does not introduce any functional changes.
9168
9169         The patch has been tested on PowerPC and Intel X86_64 with no new unexpected
9170         test failures, unresolved tests, new core files etc.
9171
9172 2022-11-17  H.J. Lu  <hjl.tools@gmail.com>
9173
9174         ld: Always call elf_backend_output_arch_local_syms
9175         Always call elf_backend_output_arch_local_syms since only the backend
9176         knows if elf_backend_output_arch_local_syms is needed when all symbols
9177         are striped.  elf_backend_output_arch_local_syms is defined only for
9178         x86, ARM and AARCH64.  On x86, elf_backend_output_arch_local_syms must
9179         be called to handle local IFUNC symbols even if all symbols are striped.
9180         Update ARM and AARCH64 to skip elf_backend_output_arch_local_syms when
9181         symbols aren't needed.
9182
9183         bfd/
9184
9185                 PR ld/29797
9186                 * elf32-arm.c (elf32_arm_output_arch_local_syms): Skip if symbols
9187                 aren't needed.
9188                 * elfnn-aarch64.c (elfNN_aarch64_output_arch_local_syms):
9189                 Likewise.
9190                 * elflink.c (bfd_elf_final_link): Always call
9191                 elf_backend_output_arch_local_syms if available.
9192
9193         ld/
9194
9195                 PR ld/29797
9196                 * testsuite/ld-elf/linux-x86.exp: Run PR ld/29797 test.
9197                 * testsuite/ld-elf/pr29797.c: New file.
9198
9199 2022-11-17  Andrew Burgess  <aburgess@redhat.com>
9200
9201         gdb: new $_inferior_thread_count convenience variable
9202         Add a new convenience variable $_inferior_thread_count that contains
9203         the number of live (non-exited) threads in the current inferior.  This
9204         can be used in command scripts, or breakpoint conditions, etc to
9205         adjust the behaviour for multi-threaded inferiors.
9206
9207         This value is only stable in all-stop mode.  In non-stop mode, where
9208         new threads can be started, and existing threads exit, at any time,
9209         this convenience variable can give a different value each time it is
9210         evaluated.
9211
9212 2022-11-17  Tom Tromey  <tromey@adacore.com>
9213
9214         Remove two obsolete declarations
9215         I happened to find a couple of obsolete declarations in cli-interp.h.
9216         This patch removes them.  Tested by rebuilding.
9217
9218 2022-11-17  Andrew Burgess  <aburgess@redhat.com>
9219
9220         gdb/testsuite: fix failure in gdb.python/py-send-packet.exp
9221         While working on another patch I noticed that, when run on an AArch64
9222         target, the test gdb.python/py-send-packet.exp was failing:
9223
9224           Traceback (most recent call last):
9225             File "<string>", line 1, in <module>
9226             File "/tmp/build/gdb/testsuite/outputs/gdb.python/py-send-packet/py-send-packet.py",
9227           line 106, in run_auxv_send_packet_test
9228               assert string == expected_result
9229           AssertionError
9230           Error while executing Python code.
9231           (gdb) FAIL: gdb.python/py-send-packet.exp: call python run_auxv_send_packet_test function
9232
9233         The test uses 'maint packet ...' to send a packet to gdbserver, and
9234         then captures the output in TCL.  This output is then passed through
9235         to a Python function, which performs some actions using the Python
9236         API, and compares the results from the Python API to the results
9237         captured in TCL from 'maint packet ...'.
9238
9239         The problem is that the output captured in TCL contains lots of things
9240         like '\x000', when this is passed through to Python the '\x' causes
9241         this to be treated as an escape code, which isn't what we want - we
9242         want the actual string "\x000".
9243
9244         So, in the TCL part of the test we were expanding '\x' to '\\x', this
9245         seemed to work fine for my testing on x86-64.
9246
9247         However, on AArch64 what I see is that the results from 'maint packet
9248         ...' contain a literal '\' character followed by a literal 'x'
9249         character.  When GDB prints this in the 'maint packet' output, GDB
9250         escapes the '\' for us, thus we get '\\x' printed by 'maint packet'.
9251
9252         However, now our TCL test script kicks in and tries to "fix" the '\x',
9253         this means we now have '\\\x', which isn't correct.
9254
9255         The problem is that in the TCL script we are too restrictive, we
9256         expand '\x' to '\\x', but really, we should be expanding all '\'
9257         characters, regardless of what follows them.  This is what this patch
9258         does.
9259
9260         After this the gdb.python/py-send-packet.exp test passes on AArch64
9261         for me.
9262
9263 2022-11-17  Aditya Vidyadhar Kamath  <Aditya.Kamath1@ibm.com>
9264
9265         Fix call functions command bug in 64 bits programs for AIX
9266         In AIX for 64 bit programs we need to zero extend variables
9267         of integer or enum or char data type.
9268
9269         Otherwise a zero will get dumped in the register as we memset
9270         our word to 0 and we copy non zero extended contents to the cache.
9271
9272 2022-11-17  Andrew Burgess  <aburgess@redhat.com>
9273
9274         gdb/fortran/testsuite: print values and types of string variables
9275         While looking through the Fortran tests, I couldn't find a test of GDB
9276         printing the value and type of a Fortran string defined using the
9277         'character*SIZE' notation.
9278
9279         This works fine in GDB right now, but I thought it wouldn't hurt to
9280         have a test for this, so this commit adds such a test.
9281
9282         The test also includes printing a string that includes some embedded
9283         special characters: \n \r \t \000 - that's right, as Fortran strings
9284         are stored as an address and length, it is fine to include an embedded
9285         null, so this test includes an example of that.
9286
9287         Standard Fortran doesn't support backslash escape sequences within
9288         strings, the special characters must be generated using the `achar`
9289         function.  However, when GDB prints the strings we currently print
9290         using the standard C like backslash sequences.
9291
9292         I'm not currently proposing to change that behaviour, the backslash
9293         sequences are more compact than the standard Fortran way of doing
9294         things, and are so widely used that I suspect most Fortran programmers
9295         will understand them.
9296
9297 2022-11-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9298
9299         Fix various procfs.c compilation errors
9300         procfs.c has accumulated several compilation errors lately (some of them
9301         new with GCC 12), which are fixed by this patch:
9302
9303         * auxv_parse gets:
9304
9305         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:144:7: error: \91int
9306         procfs_target::auxv_parse(gdb_byte**, gdb_byte*, CORE_ADDR*, CORE_ADDR*)\92
9307         marked \91override\92, but does not override
9308           144 |   int auxv_parse (gdb_byte **readptr,
9309               |       ^~~~~~~~~~
9310
9311           Obviouly, procfs.c was missed in the auxv_parse constification.
9312
9313         * dead_procinfo has:
9314
9315         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In function \91void
9316         dead_procinfo(procinfo*, const char*, int)\92:
9317         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:563:11: warning: the address
9318         of \91procinfo::pathname\92 will never be NULL [-Waddress]
9319           563 |   if (pi->pathname)
9320               |       ~~~~^~~~~~~~
9321         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:238:8: note:
9322         \91procinfo::pathname\92 declared here
9323           238 |   char pathname[MAX_PROC_NAME_SIZE];    /* Pathname to /proc entry */
9324               |        ^~~~~~~~
9325
9326           The warning is correct, so the code can lose support for the NULL
9327           pathname case.
9328
9329         * create_inferior has this ugly warning:
9330
9331         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In member function \91virtual void procfs_target::create_inferior(const char*, const std::string&, char**, int)\92:
9332         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:2815:19: warning: \91char* std::strncpy(char*, const char*, size_t)\92 output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
9333          2815 |           strncpy (tryname, p, len);
9334               |           ~~~~~~~~^~~~~~~~~~~~~~~~~
9335         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:2814:26: note: length computed here
9336          2814 |             len = strlen (p);
9337               |                   ~~~~~~~^~~
9338
9339           It seems that this is another case of GCC PR middle-end/88059, which
9340           Martin Sebor refuses to fix.  So I'm using the hack suggested in the
9341           PR to use memcpy instead of strncpy.
9342
9343         * find_memory_regions_callback fails with
9344
9345         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c: In function \91int find_memory_regions_callback(prmap*, find_memory_region_ftype, void*)\92:
9346         /vol/src/gnu/gdb/hg/master/dist/gdb/procfs.c:3167:18: error: too few arguments to function
9347          3167 |   return (*func) ((CORE_ADDR) map->pr_vaddr,
9348               |          ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
9349          3168 |                   map->pr_size,
9350               |                   ~~~~~~~~~~~~~
9351          3169 |                   (map->pr_mflags & MA_READ) != 0,
9352               |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9353          3170 |                   (map->pr_mflags & MA_WRITE) != 0,
9354               |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9355          3171 |                   (map->pr_mflags & MA_EXEC) != 0,
9356               |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9357          3172 |                   1, /* MODIFIED is unknown, pass it as true.  */
9358               |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9359          3173 |                   data);
9360               |                   ~~~~~
9361
9362           Again, procfs.c was overlooked when adding the new memory_tagged arg.
9363           Unfortunately, it wasn't even documented in gdb/defs.h when it was
9364           added in
9365
9366         commit 68cffbbd4406b4efe1aa6e18460b1d7ca02549f1
9367         Author: Luis Machado <luis.machado@arm.com>
9368         Date:   Thu Mar 31 11:42:35 2022 +0100
9369
9370             [AArch64] MTE corefile support
9371
9372         With those changes, procfs.c compiles again.  Together with the hack
9373         from the Solaris gdbsupport breakage reported in PR build/29791, I was
9374         able to build and test gdb on both amd64-pc-solaris2.11 and
9375         sparcv9-sun-solaris2.11.
9376
9377         Approved-By: Simon Marchi <simon.marchi@efficios.com>
9378
9379 2022-11-17  Christoph Müllner  <christoph.muellner@vrull.eu>
9380
9381         RISC-V: Add T-Head Int vendor extension
9382         This patch adds the XTheadInt extension, which provides interrupt
9383         stack management instructions.
9384
9385         The XTheadFmv extension is documented in the RISC-V toolchain
9386         contentions:
9387           https://github.com/riscv-non-isa/riscv-toolchain-conventions
9388
9389         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
9390
9391 2022-11-17  Christoph Müllner  <christoph.muellner@vrull.eu>
9392
9393         RISC-V: Add T-Head Fmv vendor extension
9394         This patch adds the XTheadFmv extension, which allows to access the
9395         upper 32 bits of a double-precision floating-point register in RV32.
9396
9397         The XTheadFmv extension is documented in the RISC-V toolchain
9398         contentions:
9399           https://github.com/riscv-non-isa/riscv-toolchain-conventions
9400
9401         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
9402
9403 2022-11-17  Tom de Vries  <tdevries@jostaberry-8.arch.suse.de>
9404
9405         [gdb/testsuite] Fix DUPLICATE in gdb.arch/ppc-fp.exp
9406         I noticed:
9407         ...
9408         DUPLICATE: gdb.arch/ppc-fp.exp: next
9409         ...
9410
9411         Fix this by adding unique test names.
9412
9413         Tested on powerpc64le-linux.
9414
9415 2022-11-17  GDB Administrator  <gdbadmin@sourceware.org>
9416
9417         Automatic date update in version.in
9418
9419 2022-11-16  Kévin Le Gouguec  <legouguec@adacore.com>
9420
9421         Add myself to the gdb/MAINTAINERS write-after-approval list
9422
9423 2022-11-16  Kévin Le Gouguec  <legouguec@adacore.com>
9424
9425         Guard against frame.c destructors running before frame-info.c's
9426         On x86_64-windows, since 04e2ac7b2a7, we observe this internal error:
9427
9428           [...]/gdbsupport/intrusive_list.h:458: internal-error: erase_element:
9429           Assertion `elem_node->prev != INTRUSIVE_LIST_UNLINKED_VALUE' failed.
9430
9431         Breaking in the destructors for intrusive_list and frame_info_ptr shows that
9432         in this configuration, the destructors for frame.c's statically-stored
9433         objects are run before frame-info.c's:
9434
9435           Thread 1 hit Breakpoint 7, intrusive_list<frame_info_ptr,
9436           intrusive_base_node<frame_info_ptr> >::~intrusive_list (this=0x7ff69c418c90
9437           <frame_info_ptr::frame_list>, __in_chrg=<optimized out>)
9438           [...]/../gdbsupport/intrusive_list.h:250
9439           250       clear ();
9440           (gdb) bt
9441           #0  intrusive_list<frame_info_ptr, intrusive_base_node<frame_info_ptr> >
9442               ::~intrusive_list (this=0x7ff69c418c90 <frame_info_ptr::frame_list>,
9443               __in_chrg=<optimized out>) [...]/../gdbsupport/intrusive_list.h:250
9444           #1  0x00007ff69b78edba in __tcf_1 () [...]/frame-info.c:27
9445           #2  0x00007ff9c457aa9f in msvcrt!_initterm_e ()
9446               from C:\Windows\System32\msvcrt.dll
9447           #3  0x00007ff69b8246a6 in captured_main_1 (context=0x5ffe00)
9448               [...]/main.c:1111
9449           #4  0x00007ff69b825149 in captured_main (data=0x5ffe00) [...]/main.c:1320
9450           #5  0x00007ff69b8251b1 in gdb_main (args=0x5ffe00) [...]/main.c:1345
9451           #6  0x00007ff69b5d1730 in main (argc=2, argv=0x751730) [...]/gdb.c:32
9452           (gdb) c
9453           Continuing.
9454
9455           Thread 1 hit Breakpoint 8, frame_info_ptr::~frame_info_ptr
9456           (this=0x7ff69c418e20 <selected_frame>, __in_chrg=<optimized out>)
9457           [...]/frame-info.h:74
9458           74        if (is_linked ())
9459           (gdb) bt
9460           #0  frame_info_ptr::~frame_info_ptr (this=0x7ff69c418e20 <selected_frame>,
9461               __in_chrg=<optimized out>) [...]/frame-info.h:74
9462           #1  0x00007ff69b79a643 in __tcf_1 () [...]/frame.c:1675
9463           #2  0x00007ff9c457aa9f in msvcrt!_initterm_e () from
9464               C:\Windows\System32\msvcrt.dll
9465           #3  0x00007ff69b8246a6 in captured_main_1 (context=0x5ffe00)
9466               [...]/main.c:1111
9467           #4  0x00007ff69b825149 in captured_main (data=0x5ffe00) [...]/main.c:1320
9468           #5  0x00007ff69b8251b1 in gdb_main (args=0x5ffe00) [...]/main.c:1345
9469           #6  0x00007ff69b5d1730 in main (argc=2, argv=0x751730) [...]/gdb.c:32
9470
9471         Approved-By: Simon Marchi <simon.marchi@efficios.com>
9472
9473 2022-11-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
9474
9475         PR29788, gprofng cannot display Java's generated assembly code
9476         gprofng/ChangeLog
9477         2022-11-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
9478
9479                 PR gprofng/29788
9480                 * src/Experiment.h: Declare dyntext_name.
9481                 * src/Experiment.cc: Use dyntext_name to initialize img_fname.
9482
9483 2022-11-16  Tom de Vries  <tdevries@suse.de>
9484
9485         [gdb/testsuite] Use gdb_gcore_cmd in gdb.threads/gcore-thread.exp
9486         I noticed a plain gcore command in test-case gdb.threads/gcore-thread.exp:
9487         ...
9488             gdb_test "gcore $core0file" "Saved corefile .*" \
9489               "save a zeroed-threads corefile"
9490         ...
9491
9492         Use gdb_gcore_cmd instead.
9493
9494         Tested on x86_64-linux.
9495
9496 2022-11-16  Carl Love  <cel@us.ibm.com>
9497
9498         Bug fix in commit for printing the function return value for non-trivial values
9499         The recent commit:
9500
9501           commit a0eda3df5b750ae32576a9be092b361281a41787
9502           Author: Carl Love <cel@us.ibm.com>
9503           Date:   Mon Nov 14 16:22:37 2022 -0500
9504
9505             PowerPC, fix support for printing the function return value for non-trivial values.
9506
9507         Is generating a segmentation fault on x86_64-linux.
9508
9509           segfault:
9510           ...
9511           PASS: gdb.asm/asm-source.exp: info source asmsrc1.s
9512           ERROR: GDB process no longer exists
9513           UNRESOLVED: gdb.asm/asm-source.exp: finish from foo3
9514           ...
9515
9516           Reproduced on command line:
9517           ...
9518           $ gdb -q -batch -x outputs/gdb.asm/asm-source/gdb.in.1
9519           ...
9520
9521           The problem seems to be that:
9522           ...
9523           Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
9524           0x000000000043de7a in symbol::type (this=0x0) at
9525           .../gdb_versions/devel/src/gdb/symtab.h:1287
9526           1287        return m_type;
9527           ...
9528           because:
9529           ...
9530           (gdb) up
9531           #1  0x0000000000852d94 in finish_command (arg=0x0, from_tty=0)
9532              at .../gdb_versions/devel/src/gdb/infcmd.c:1887
9533           1887        = check_typedef (sm->function->type ()->target_type ());
9534           (gdb) p sm->function
9535           $1 = (symbol *) 0x0
9536
9537         The code is not checking if sm->function is NULL.  If sm->function is NULL
9538         the check for the return buffer should be skipped.
9539
9540 2022-11-16  Tom Tromey  <tromey@adacore.com>
9541
9542         Update Ada tasks documentation
9543         My co-worker Kévin noticed that the Ada tasks documentation is
9544         slightly out of date -- it does not document all the states that can
9545         be reported by ada-tasks.c.
9546
9547         This patch adds the missing states to the appropriate node, and
9548         updates one state to reflect a change made some time ago.
9549
9550 2022-11-16  Pedro Alves  <palves@redhat.com>
9551
9552         gdb: add "set style tui-current-position on|off", default to off
9553         As discussed at:
9554
9555          https://sourceware.org/pipermail/gdb-patches/2020-June/169519.html
9556
9557         this patch disables source and assembly code highlighting for the
9558         text highlighted by the TUI's current position indicator, and adds a
9559         command to enable it back.
9560
9561 2022-11-16  Tom de Vries  <tdevries@suse.de>
9562
9563         [gdb/testsuite] Modernize gdb.arch/i386-biarch-core.exp
9564         I noticed in test-case gdb.arch/i386-biarch-core.exp that we run into the
9565         completion limit for "complete set gnutarget":
9566         ...
9567         set gnutarget vms-libtxt^M
9568         set gnutarget  *** List may be truncated, max-completions reached. ***^M
9569         (gdb) PASS: gdb.arch/i386-biarch-core.exp: complete set gnutarget
9570         ...
9571
9572         Fix this by using get_set_option_choices.
9573
9574         Also use get_set_option_choices for "complete set architecture i386", which
9575         required extending get_set_option_choices to accept a second argument, such
9576         that we can do:
9577         ...
9578         set archs [get_set_option_choices "set architecture" "i386"]
9579         ...
9580         because this returns an empty list:
9581         ...
9582         set archs [get_set_option_choices "set architecture i386"]
9583         ...
9584         because it does "complete set architecture i386 ".
9585
9586         Also clean up the explicit gdb_exit/gdb_start and use clean_restart instead.
9587
9588         Tested on x86_64-linux.
9589
9590 2022-11-16  Tom de Vries  <tdevries@suse.de>
9591
9592         [gdb/testsuite] Fix gdb.arch/ppc64-symtab-cordic.exp without bzip2
9593         After de-installing bzip2, I run into:
9594         ...
9595         Running ppc64-symtab-cordic.exp ...
9596         sh: bzip2: command not found
9597         PATH: gdb.arch/ppc64-symtab-cordic.exp: failed bzip2 for \
9598           src/gdb/testsuite/gdb.arch/cordic.ko.bz2
9599         ...
9600
9601         Fix these by:
9602         - using remote_exec instead of catch system, and
9603         - using file tail in the untested message.
9604
9605         I've tried making output redirection work with remote_exec, but that seems to
9606         be broken, so we now:
9607         - copy the file $f.bz2 into the desired location $dir/$f.bz2, and
9608         - decompress the bz2 file using "bzip2 -df $dir/$f.bz2", resulting in a file
9609           $dir/$f.
9610
9611         Factor out new function decompress_bz2 to make the test-case less verbose, and
9612         also use it in gdb.arch/i386-biarch-core.exp.
9613
9614         Tested on x86_64-linux, without and with bzip2 installed.
9615
9616 2022-11-16  GDB Administrator  <gdbadmin@sourceware.org>
9617
9618         Automatic date update in version.in
9619
9620 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9621
9622         doc: add SFrame spec file
9623         ChangeLog:
9624
9625                 * libsframe/Makefile.am: Add info-in-builddir to
9626                   AUTOMAKE_OPTIONS. Include doc/local.mk.
9627                 * libsframe/Makefile.in: Regenerated.
9628                 * libsframe/configure: Likewise.
9629                 * libsframe/configure.ac: Check for makeinfo and set BUILD_INFO.
9630                 * libsframe/doc/local.mk: New file.
9631                 * libsframe/doc/sframe-spec.texi: Likewise.
9632
9633 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9634
9635         gas/NEWS: add text about new command line option and SFrame support
9636         ChangeLog:
9637
9638                 * gas/NEWS: Add SFrame related news.
9639
9640 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9641
9642         binutils/NEWS: add text for SFrame support
9643         ChangeLog:
9644
9645                 * binutils/NEWS: Add item for SFrame support.
9646
9647 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9648
9649         src-release.sh: Add libsframe
9650         Add libsframe to the list of top level directories that will be included
9651         in a release.
9652
9653         ChangeLog:
9654
9655                 * src-release.sh: Add libsframe
9656
9657 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9658
9659         readelf/objdump: support for SFrame section
9660         This patch adds support for SFrame in readelf and objdump. The arguments
9661         of --sframe are optional for both readelf and objdump.
9662
9663         include/ChangeLog:
9664
9665                 * sframe-api.h (dump_sframe): New function declaration.
9666
9667         ChangeLog:
9668
9669                 * binutils/Makefile.am: Add dependency on libsframe for
9670                 readelf and objdump.
9671                 * binutils/Makefile.in: Regenerate.
9672                 * binutils/doc/binutils.texi: Document --sframe=[section].
9673                 * binutils/doc/sframe.options.texi: New file.
9674                 * binutils/objdump.c: Add support for SFrame format.
9675                 * binutils/readelf.c: Likewise.
9676                 * include/sframe-api.h: Add new API for dumping .sframe
9677                 section.
9678                 * libsframe/Makefile.am: Add sframe-dump.c.
9679                 * libsframe/Makefile.in: Regenerate.
9680                 * libsframe/sframe-dump.c: New file.
9681
9682 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9683
9684         bfd: linker: merge .sframe sections
9685         The linker merges all the input .sframe sections.  When merging, the
9686         linker verifies that all the input .sframe sections have the same
9687         abi/arch.
9688
9689         The linker uses libsframe library to perform key actions on the
9690         .sframe sections - decode, read, and create output data.  This
9691         implies buildsystem changes to make and install libsframe before
9692         libbfd.
9693
9694         The linker places the output .sframe section in a new segment of its
9695         own: PT_GNU_SFRAME.  A new segment is not added, however, if the
9696         generated .sframe section is empty.
9697
9698         When a section is discarded from the final link, the corresponding
9699         entries in the .sframe section for those functions are also deleted.
9700
9701         The linker sorts the SFrame FDEs on start address by default and sets
9702         the SFRAME_F_FDE_SORTED flag in the .sframe section.
9703
9704         This patch also adds support for generation of SFrame unwind
9705         information for the .plt* sections on x86_64.  SFrame unwind info is
9706         generated for IBT enabled PLT, lazy/non-lazy PLT.
9707
9708         The existing linker option --no-ld-generated-unwind-info has been
9709         adapted to include the control of whether .sframe unwind information
9710         will be generated for the linker generated sections like PLT.
9711
9712         Changes to the linker script have been made as necessary.
9713
9714         ChangeLog:
9715
9716                 * Makefile.def: Add install dependency on libsframe for libbfd.
9717                 * Makefile.in: Regenerated.
9718                 * bfd/Makefile.am: Add elf-sframe.c
9719                 * bfd/Makefile.in: Regenerated.
9720                 * bfd/bfd-in2.h (SEC_INFO_TYPE_SFRAME): Regenerated.
9721                 * bfd/configure: Regenerate.
9722                 * bfd/configure.ac: Add elf-sframe.lo.
9723                 * bfd/elf-bfd.h (struct sframe_func_bfdinfo): New struct.
9724                 (struct sframe_dec_info): Likewise.
9725                 (struct sframe_enc_info): Likewise.
9726                 (struct elf_link_hash_table): New member for encoded .sframe
9727                 object.
9728                 (struct output_elf_obj_tdata): New member.
9729                 (elf_sframe): New access macro.
9730                 (_bfd_elf_set_section_sframe): New declaration.
9731                 * bfd/elf.c (get_segment_type): Handle new segment
9732                 PT_GNU_SFRAME.
9733                 (bfd_section_from_phdr): Likewise.
9734                 (get_program_header_size): Likewise.
9735                 (_bfd_elf_map_sections_to_segments): Likewise.
9736                 * bfd/elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Add
9737                 contents to the .sframe sections or .plt* entries.
9738                 * bfd/elflink.c (elf_section_ignore_discarded_relocs): Handle
9739                 SEC_INFO_TYPE_SFRAME.
9740                 (_bfd_elf_default_action_discarded): Handle .sframe section.
9741                 (elf_link_input_bfd): Merge .sframe section.
9742                 (bfd_elf_final_link): Write the output .sframe section.
9743                 (bfd_elf_discard_info): Handle discarding .sframe section.
9744                 * bfd/elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Create
9745                 .sframe section for .plt and .plt.sec.
9746                 (_bfd_x86_elf_finish_dynamic_sections): Handle .sframe from
9747                 .plt* sections.
9748                 * bfd/elfxx-x86.h (PLT_SFRAME_FDE_START_OFFSET): New
9749                 definition.
9750                 (SFRAME_PLT0_MAX_NUM_FRES): Likewise.
9751                 (SFRAME_PLTN_MAX_NUM_FRES): Likewise.
9752                 (struct elf_x86_sframe_plt): New structure.
9753                 (struct elf_x86_link_hash_table): New member.
9754                 (struct elf_x86_init_table): New members for .sframe
9755                 creation.
9756                 * bfd/section.c: Add new definition SEC_INFO_TYPE_SFRAME.
9757                 * binutils/readelf.c (get_segment_type): Handle new segment
9758                 PT_GNU_SFRAME.
9759                 * ld/ld.texi: Update documentation for
9760                 --no-ld-generated-unwind-info.
9761                 * ld/scripttempl/elf.sc: Support .sframe sections.
9762                 * ld/Makefile.am (TESTSFRAMELIB): Use it.
9763                 (check-DEJAGNU): Likewise.
9764                 * ld/Makefile.in: Regenerated.
9765                 * ld/configure.ac (TESTSFRAMELIB): Set to the .so or .a like TESTBFDLIB.
9766                 * ld/configure: Regenerated.
9767                 * bfd/elf-sframe.c: New file.
9768
9769         include/ChangeLog:
9770
9771                 * elf/common.h (PT_GNU_SFRAME): New definition.
9772                 * elf/internal.h (struct elf_segment_map): Handle new segment
9773                 type PT_GNU_SFRAME.
9774
9775         ld/testsuite/ChangeLog:
9776
9777                 * ld/testsuite/ld-bootstrap/bootstrap.exp: Add SFRAMELIB.
9778                 * ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test
9779                   sframe-simple-1.
9780                 * ld/testsuite/ld-aarch64/sframe-bar.s: New file.
9781                 * ld/testsuite/ld-aarch64/sframe-foo.s: Likewise.
9782                 * ld/testsuite/ld-aarch64/sframe-simple-1.d: Likewise.
9783                 * ld/testsuite/ld-sframe/sframe-empty.d: New test.
9784                 * ld/testsuite/ld-sframe/sframe-empty.s: New file.
9785                 * ld/testsuite/ld-sframe/sframe.exp: New testsuite.
9786                 * ld/testsuite/ld-x86-64/sframe-bar.s: New file.
9787                 * ld/testsuite/ld-x86-64/sframe-foo.s: Likewise.
9788                 * ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise.
9789                 * ld/testsuite/ld-x86-64/sframe-plt-1.d: Likewise.
9790                 * ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise.
9791                 * ld/testsuite/ld-x86-64/x86-64.exp: Add new tests -
9792                   sframe-simple-1, sframe-plt-1.
9793                 * ld/testsuite/lib/ld-lib.exp: Add new proc to check if
9794                   assembler supports SFrame section.
9795                 * ld/testsuite/ld-sframe/discard.d: New file.
9796                 * ld/testsuite/ld-sframe/discard.ld: Likewise.
9797                 * ld/testsuite/ld-sframe/discard.s: Likewise.
9798
9799 2022-11-15  Weimin Pan  <weimin.pan@oracle.com>
9800
9801         libsframe: add the SFrame library
9802         libsframe is a library that allows you to:
9803         - decode a .sframe section
9804         - probe and inspect a .sframe section
9805         - encode (and eventually write) a .sframe section.
9806
9807         This library is currently being used by the linker, readelf, objdump.
9808         This library will also be used by the SFrame unwinder which is still
9809         to be upstream'd.
9810
9811         The file include/sframe-api.h defines the user-facing APIs for decoding,
9812         encoding and probing .sframe sections. A set of error codes together
9813         with their error message strings are also defined.
9814
9815         Endian flipping is performed automatically at read and write time, if
9816         cross-endianness is detected.
9817
9818         ChangeLog:
9819
9820                 * Makefile.def: Add libsframe as new module with its
9821                 dependencies.
9822                 * Makefile.in: Regenerated.
9823                 * binutils/Makefile.am: Add libsframe.
9824                 * binutils/Makefile.in: Regenerated.
9825                 * configure: Regenerated
9826                 * configure.ac: Add libsframe to host_libs.
9827                 * libsframe/Makefile.am: New file.
9828                 * libsframe/Makefile.in: New file.
9829                 * libsframe/aclocal.m4: New file.
9830                 * libsframe/config.h.in: New file.
9831                 * libsframe/configure: New file.
9832                 * libsframe/configure.ac: New file.
9833                 * libsframe/sframe-error.c: New file.
9834                 * libsframe/sframe-impl.h: New file.
9835                 * libsframe/sframe.c: New file.
9836
9837         include/ChangeLog:
9838
9839                 * sframe-api.h: New file.
9840
9841         testsuite/ChangeLog:
9842
9843                 * libsframe/testsuite/Makefile.am: New file.
9844                 * libsframe/testsuite/Makefile.in: Regenerated.
9845                 * libsframe/testsuite/libsframe.decode/Makefile.am: New
9846                   file.
9847                 * libsframe/testsuite/libsframe.decode/Makefile.in:
9848                   Regenerated.
9849                 * libsframe/testsuite/libsframe.decode/decode.exp: New file.
9850                 * libsframe/testsuite/libsframe.encode/Makefile.am:
9851                   Likewise.
9852                 * libsframe/testsuite/libsframe.encode/Makefile.in:
9853                   Regenerated.
9854                 * libsframe/testsuite/libsframe.encode/encode.exp: New file.
9855                 * libsframe/testsuite/libsframe.encode/encode-1.c: Likewise.
9856                 * libsframe/testsuite/libsframe.decode/be-flipping.c: Likewise.
9857                 * libsframe/testsuite/libsframe.decode/frecnt-1.c: Likewise.
9858                 * libsframe/testsuite/libsframe.decode/frecnt-2.c: Likewise.
9859                 * libsframe/testsuite/libsframe.decode/DATA-BE: New file.
9860                 * libsframe/testsuite/libsframe.decode/DATA1: Likewise.
9861                 * libsframe/testsuite/libsframe.decode/DATA2: Likewise.
9862
9863 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9864
9865         gas: testsuite: add new tests for SFrame unwind info
9866         Earlier these tests were in the same commit as previous which adds the
9867         support in GNU assembler to generate .sframe section from CFI
9868         directives.  Splitting this out here for ease of applying and testing.
9869
9870         ChangeLog:
9871
9872                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d: New file.
9873                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s: Likewise.
9874                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d: Likewise.
9875                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s: Likewise.
9876                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d: Likewise.
9877                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s: Likewise.
9878                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d: Likewise.
9879                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s: Likewise.
9880                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d: Likewise.
9881                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s: Likewise.
9882                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
9883                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s: Likewise.
9884                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
9885                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s: Likewise.
9886                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
9887                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s: Likewise.
9888                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
9889                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s: Likewise.
9890                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d: Likewise.
9891                 * gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s: Likewise.
9892                 * gas/testsuite/gas/cfi-sframe/cfi-sframe.exp: Likewise.
9893                 * gas/testsuite/gas/cfi-sframe/common-empty-1.d: Likewise.
9894                 * gas/testsuite/gas/cfi-sframe/common-empty-1.s: Likewise.
9895                 * gas/testsuite/gas/cfi-sframe/common-empty-2.d: Likewise.
9896                 * gas/testsuite/gas/cfi-sframe/common-empty-2.s: Likewise.
9897                 * gas/testsuite/gas/cfi-sframe/common-empty-3.d: Likewise.
9898                 * gas/testsuite/gas/cfi-sframe/common-empty-3.s: Likewise.
9899                 * gas/testsuite/gas/cfi-sframe/common-empty-4.d: Likewise.
9900                 * gas/testsuite/gas/cfi-sframe/common-empty-4.s: Likewise.
9901
9902 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
9903
9904         gas: generate .sframe from CFI directives
9905         Currently supported for x86_64 and aarch64 only.
9906
9907         [PS: Currently, the compiler has not been adapted to generate
9908         ".cfi_sections" with ".sframe" in it.  The newly added command line
9909         option of --gsframe provides an easy way to try out .sframe support
9910         in the toolchain.]
9911
9912         gas interprets the CFI directives to generate DWARF-based .eh_frame
9913         info.  These internal DWARF structures are now consumed by
9914         gen-sframe.[ch] sub-system to, in turn, create the SFrame unwind
9915         information.  These internal DWARF structures are read-only for the
9916         purpose of SFrame unwind info generation.
9917
9918         SFrame unwind info generation does not impact .eh_frame unwind info
9919         generation.  Both .eh_frame and .sframe can co-exist in an ELF file,
9920         if so desired by the user.
9921
9922         Recall that SFrame unwind information only contains the minimal
9923         necessary information to generate backtraces and does not provide
9924         information to recover all callee-saved registers.  The reason being
9925         that callee-saved registers other than FP are not needed for stack
9926         unwinding, and hence are not included in the .sframe section.
9927
9928         Consequently, gen-sframe.[ch] only needs to interpret a subset of
9929         DWARF opcodes in gas.  More details follow.
9930
9931         [Set 1, Interpreted] The following opcodes are interpreted:
9932         - DW_CFA_advance_loc
9933         - DW_CFA_def_cfa
9934         - DW_CFA_def_cfa_register
9935         - DW_CFA_def_cfa_offset
9936         - DW_CFA_offset
9937         - DW_CFA_remember_state
9938         - DW_CFA_restore_state
9939         - DW_CFA_restore
9940
9941         [Set 2, Bypassed] The following opcodes are acknowledged but are not
9942         necessary for generating SFrame unwind info:
9943         - DW_CFA_undefined
9944         - DW_CFA_same_value
9945
9946         Anything else apart from the two above-mentioned sets is skipped
9947         altogether.  This means that any function containing a CFI directive not
9948         in Set 1 or Set 2 above, will not have any SFrame unwind information
9949         generated for them.  Holes in instructions covered by FREs of a single
9950         FDE are not representable in the SFrame unwind format.
9951
9952         As few examples, following opcodes are not processed for .sframe
9953         generation, and are skipped:
9954         - .cfi_personality*
9955         - .cfi_*lsda
9956         - .cfi_escape
9957         - .cfi_negate_ra_state
9958         - ...
9959
9960         Not processing .cfi_escape, .cfi_negate_ra_state will cause SFrame
9961         unwind information to be absent for SFrame FDEs that contain these CFI
9962         directives, hence affecting the asynchronicity.
9963
9964         x86-64 and aarch64 backends need to have a few new definitions and
9965         functions for .sframe generation.  These provide gas with architecture
9966         specific information like the SP/FP/RA register numbers and an
9967         SFrame-specific ABI marker.
9968
9969         Lastly, the patch also implements an optimization for size, where
9970         specific fragments containing SFrame FRE start address and SFrame FDE
9971         function are fixed up.  This is similar to other similar optimizations
9972         in gas, where fragments are sized and fixed up when the associated
9973         symbols can be resolved.  This optimization is controlled by a #define
9974         SFRAME_FRE_TYPE_SELECTION_OPT and should be easy to turn off if needed.
9975         The optimization is on by default for both x86_64 and aarch64.
9976
9977         ChangeLog:
9978
9979                 * gas/Makefile.am: Include gen-sframe.c and sframe-opt.c.
9980                 * gas/Makefile.in: Regenerated.
9981                 * gas/as.h (enum _relax_state): Add new state rs_sframe.
9982                 (sframe_estimate_size_before_relax): New function.
9983                 (sframe_relax_frag): Likewise.
9984                 (sframe_convert_frag): Likewise.
9985                 * gas/config/tc-aarch64.c (aarch64_support_sframe_p): New
9986                 definition.
9987                 (aarch64_sframe_ra_tracking_p): Likewise.
9988                 (aarch64_sframe_cfa_ra_offset): Likewise.
9989                 (aarch64_sframe_get_abi_arch): Likewise.
9990                 (md_begin): Set values of sp/fp/ra registers.
9991                 * gas/config/tc-aarch64.h (aarch64_support_sframe_p): New
9992                 declaration.
9993                 (support_sframe_p): Likewise.
9994                 (SFRAME_CFA_SP_REG): Likewise.
9995                 (SFRAME_CFA_FP_REG): Likewise.
9996                 (SFRAME_CFA_RA_REG): Likewise.
9997                 (aarch64_sframe_ra_tracking_p): Likewise.
9998                 (sframe_ra_tracking_p): Likewise.
9999                 (aarch64_sframe_cfa_ra_offset): Likewise.
10000                 (sframe_cfa_ra_offset): Likewise.
10001                 (aarch64_sframe_get_abi_arch): Likewise.
10002                 (sframe_get_abi_arch): Likewise.
10003                 * gas/config/tc-i386.c (x86_support_sframe_p): New definition.
10004                 (x86_sframe_ra_tracking_p): Likewise.
10005                 (x86_sframe_cfa_ra_offset): Likewise.
10006                 (x86_sframe_get_abi_arch): Likewise.
10007                 * gas/config/tc-i386.h (x86_support_sframe_p): New declaration.
10008                 (support_sframe_p): Likewise.
10009                 (SFRAME_CFA_SP_REG): Likewise.
10010                 (SFRAME_CFA_FP_REG): Likewise.
10011                 (x86_sframe_ra_tracking_p): Likewise.
10012                 (sframe_ra_tracking_p): Likewise.
10013                 (x86_sframe_cfa_ra_offset): Likewise.
10014                 (sframe_cfa_ra_offset): Likewise.
10015                 (x86_sframe_get_abi_arch): Likewise.
10016                 (sframe_get_abi_arch): Likewise.
10017                 * gas/config/tc-xtensa.c (unrelaxed_frag_max_size): Add case for
10018                 rs_sframe.
10019                 * gas/doc/as.texi: Add .sframe to the documentation for
10020                 .cfi_sections.
10021                 * gas/dw2gencfi.c (cfi_finish): Create a .sframe section.
10022                 * gas/dw2gencfi.h (CFI_EMIT_sframe): New definition.
10023                 * gas/write.c (cvt_frag_to_fill): Handle rs_sframe.
10024                 (relax_segment): Likewise.
10025                 * gas/gen-sframe.c: New file.
10026                 * gas/gen-sframe.h: New file.
10027                 * gas/sframe-opt.c: New file.
10028
10029 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
10030
10031         gas: add new command line option --gsframe
10032         When --gsframe is specified, the assembler will generate a .sframe
10033         section from the CFI directives in the assembly.
10034
10035         ChangeLog:
10036
10037                 * gas/as.c (parse_args): Parse args and set flag_gen_sframe.
10038                 * gas/as.h: Introduce skeleton for --gsframe.
10039                 * gas/doc/as.texi: document --gsframe.
10040
10041 2022-11-15  Indu Bhagat  <indu.bhagat@oracle.com>
10042
10043         sframe.h: Add SFrame format definition
10044         The header sframe.h defines the SFrame format.
10045
10046         The SFrame format is the Simple Frame format.  It can be used to
10047         represent the minimal necessary unwind information required for
10048         backtracing.  The current version supports AMD64 and AARCH64.
10049
10050         More details of the SFrame format are included in the documentation
10051         of the header file in this patch.
10052
10053         include/ChangeLog:
10054                 * sframe.h: New file.
10055
10056 2022-11-15  Alan Modra  <amodra@gmail.com>
10057
10058         Re: [gas] arm: Add support for new unwinder directive ".pacspval".
10059                 * testsuite/gas/arm/ehabi-pacbti-m.d: Limit test to ELF.
10060
10061 2022-11-15  Alan Modra  <amodra@gmail.com>
10062
10063         aarch64-pe can't fill 16 bytes in section .text
10064         Without commit b66e671854, this:
10065          .p2align 4
10066          nop
10067          .p2align 3
10068          nop
10069         results in an error when coff_frob_section attempts to pad out the
10070         section to a 16-byte boundary.  Due to miscalculating the pad pattern
10071         repeat count, write.c:write_contents attempts to shove 16 bytes of
10072         padding into the remaining 4 bytes of the .text section.
10073
10074                 * config/obj-coff.c (coff_frob_section): Correct fill count.
10075                 Don't pad after errors.
10076
10077 2022-11-15  Jose E. Marchesi  <jose.marchesi@oracle.com>
10078
10079         gdb/configure: regenerate
10080         The commit bbaabc767a4293492817a0840819aef2768cce90 introduced an
10081         incorrect thunk for the `configure' script.  This patch regenerates
10082         configure by calling autoreconf.
10083
10084 2022-11-15  Jose E. Marchesi  <jose.marchesi@oracle.com>
10085
10086         gdb: use libtool in GDB_AC_CHECK_BFD
10087         The GDB_AC_CHECK_BFD macro defined in gdb/acinclude.m4 uses the
10088         AC_LINK_IFELSE autoconf macro in order to link a simple program to
10089         check features of libbfd.
10090
10091         If libbfd's link dependencies change, it was necessary to reflect them
10092         either in the definition of the macro, or as a consequence of checking
10093         for them with an autoconf macro resulting in an addition to LIBS.
10094
10095         This patch modifies the definition of the GDB_CHECK_BFD macro in order
10096         to use libtool to perform the test link.  This makes it possible to
10097         not have to list dependencies of libbfd (which are indirect to GDB) at
10098         all.
10099
10100         After this patch:
10101
10102           configure:28553: checking for ELF support in BFD
10103           configure:28573: ./libtool --quiet --mode=link gcc -o conftest \
10104                            -I../../gdb/../include -I../bfd \
10105                            -I../../gdb/../bfd -g -O2 \
10106                            -L../bfd -L../libiberty conftest.c -lbfd -liberty \
10107                            -lncursesw -lm -ldl  >&5
10108           configure:28573: $? = 0
10109           configure:28583: result: yes
10110
10111         Tests performed:
10112
10113         - Configure --with-system-zlib and --without-system-zlib.
10114         - Check link dependencies of installed GDB with both --enable-shared
10115           and --disable-shared.
10116         - Run installed GDB in both cases.
10117
10118         Approved-By: Simon Marchi <simon.marchi@efficios.com>
10119
10120 2022-11-15  Tom Tromey  <tromey@adacore.com>
10121
10122         Fix crash in ada_print_type
10123         The "varstring" paramter to ada_print_type can be null, but one spot
10124         failed to check this.  This could cause a crash in some situations.
10125
10126         As this is Ada-specific, and we've been using it internally at AdaCore
10127         for a while, I am going to push it.
10128
10129 2022-11-15  Tejas Joshi  <TejasSanjay.Joshi@amd.com>
10130
10131         Add AMD znver4 processor support
10132         2022-09-28  Tejas Joshi <TejasSanjay.Joshi@amd.com>
10133
10134         gas/
10135
10136                 * config/tc-i386.c (cpu_arch): Add znver4 ARCH and rmpquery SUBARCH.
10137                 (md_assemble): Expand comment before swap_operands() with rmpquery.
10138                 * doc/c-i386.texi: Add znver4.
10139                 * testsuite/gas/i386/arch-14-1.d: New.
10140                 * testsuite/gas/i386/arch-14-1.s: New.
10141                 * testsuite/gas/i386/arch-14-znver4.d: New.
10142                 * testsuite/gas/i386/i386.exp: Add new znver4 test cases.
10143                 * testsuite/gas/i386/rmpquery.d: New.
10144                 * testsuite/gas/i386/rmpquery.s: New.
10145                 * testsuite/gas/i386/x86-64-arch-4-1.d: New.
10146                 * testsuite/gas/i386/x86-64-arch-4-1.s: New.
10147                 * testsuite/gas/i386/x86-64-arch-4-znver4.d: New.
10148
10149         opcodes/
10150
10151                 * i386-dis.c (x86_64_table): Add rmpquery.
10152                 * i386-gen.c (cpu_flag_init): Add CPU_ZNVER4_FLAGS and
10153                 CPU_RMPQUERY_FLAGS.
10154                 (cpu_flags): Add CpuRMPQUERY.
10155                 * i386-opc.h (enum): Add CpuRMPQUERY.
10156                 (i386_cpu_flags): Add cpurmpquery.
10157                 * i386-opc.tbl: Add rmpquery insn.
10158                 * i386-init.h: Re-generated.
10159                 * i386-tbl.h: Re-generated.
10160
10161 2022-11-15  Simon Marchi  <simon.marchi@polymtl.ca>
10162
10163         gdb/testsuite: get_set_option_choices: expect \r\n after each item
10164         I get some random failures since commit 8d45c3a82a0e ("[gdb/testsuite]
10165         Set completions to unlimited in get_set_option_choices"), which can be
10166         reproduced with:
10167
10168             $ make check-read1 TESTS="gdb.base/parse_number.exp"
10169
10170         For instance:
10171
10172             set architecture A^M
10173             Ambiguous item "A".^M
10174             (gdb) FAIL: gdb.base/parse_number.exp: arch=A: set architecture A
10175
10176         The problem is the regexp in get_set_option_choices, it is possible that
10177         is only matches part of a completion result.  With check-read1, that is
10178         always one letter.
10179
10180         Fix this by expecting the \r\n at the end of the line, so we only match
10181         entire results.  Use ^ in match patterns to ensure we don't miss any
10182         output.
10183
10184         Approved-By: Tom de Vries <tdevries@suse.de>
10185         Change-Id: Ib1733737feab7dde0f7095866e089081a891054e
10186
10187 2022-11-15  Andre Vieira  <andre.simoesdiasvieira@arm.com>
10188
10189         aarch64, testsuite: Fixed recently added cssc.d
10190         Fixed wrong paste in cssc.d.
10191
10192         gas/ChangeLog:
10193
10194                 * testsuite/gas/aarch64/cssc.d: Removed duplicate head.
10195
10196 2022-11-15  Tom de Vries  <tdevries@suse.de>
10197
10198         [gdb/testsuite] Normalize gdbserver path name
10199         Currently for the target board remote-gdbserver-on-localhost we use the
10200         gdbserver file on build, using a file name which includes "/../".
10201
10202         Fix this by using a normalized file name instead.
10203
10204         This allows us to be more restrictive about which files REMOTE_TARGET_USERNAME
10205         can access:
10206         ...
10207         -    remote_exec build "chmod go-rx $objdir/outputs"
10208         +    remote_exec build "chmod go-rx $objdir"
10209         ...
10210
10211         Tested on x86_64-linux.
10212
10213 2022-11-15  Tom de Vries  <tdevries@suse.de>
10214
10215         [gdb/testsuite] Fix gdb.base/jit-elf-so.exp for remote target
10216         With test-case gdb.base/jit-elf-so.exp and target board
10217         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
10218         failures.
10219
10220         Fix these by:
10221         - setting jit_libname with the name as returned by gdb_load_shlib
10222         - allowing the libraries to be prefixed with the remote target directory.
10223
10224         Tested on x86_64-linux.
10225
10226         Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10227
10228 2022-11-15  Tom de Vries  <tdevries@suse.de>
10229
10230         [gdb/testsuite] Fix gdb.base/jit-reader-exec.exp for remote target
10231         With test-case gdb.base/jit-reader-exec.exp and target board
10232         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
10233         failures.
10234
10235         Fix this by adding the missing gdb_remote_download.
10236
10237         Tested on x86_64-linux.
10238
10239         Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10240
10241 2022-11-15  Tom de Vries  <tdevries@suse.de>
10242
10243         [gdb/testsuite] Fix gdb.base/info-shared.exp for remote target
10244         With test-case gdb.base/info-shared.exp and target board
10245         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
10246         failures.
10247
10248         Fix these by adding the missing gdb_load_shlib.
10249
10250         Tested on x86_64-linux.
10251
10252         Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10253
10254 2022-11-15  Tom de Vries  <tdevries@suse.de>
10255
10256         [gdb/testsuite] Fix gdb.base/solib-vanish.exp for remote target
10257         When running test-case gdb.base/solib-vanish.exp with target board
10258         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
10259         failures.
10260
10261         Fix these by adding the missing gdb_load_shlib.
10262
10263         Tested on x86_64-linux.
10264
10265         Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10266
10267 2022-11-15  Tom de Vries  <tdevries@suse.de>
10268
10269         [gdb/testsuite] Fix gdb.base/infcall-exec.exp for remote target
10270         When running test-case gdb.base/infcall-exec.exp with target board
10271         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into:
10272         ...
10273         (gdb) call (int) execlp ("$outputs/gdb.base/infcall-exec/infcall-exec2", \
10274           "$outputs/gdb.base/infcall-exec/infcall-exec2", (char *)0)^M
10275         $1 = -1^M
10276         (gdb) FAIL: gdb.base/infcall-exec.exp: call execlp
10277         ...
10278
10279         Fix this by using just:
10280         ...
10281         (gdb) call (int) execlp ("infcall-exec2", "infcall-exec2", (char *)0)^M
10282         ...
10283         and using putenv ("PATH=...") to allow infcall-exec to exec infcall-exec2
10284         if it's available alongside.
10285
10286         Also fix the exec name in the test-case, such that we can successfully
10287         run the test-case:
10288         ...
10289         $ ./outputs/gdb.base/infcall-exec/infcall-exec
10290         PATH SETTING: 'PATH=./outputs/gdb.base/infcall-exec'
10291         $
10292         ...
10293
10294         Tested on x86_64-linux.
10295
10296         Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10297
10298 2022-11-15  Tom de Vries  <tdevries@suse.de>
10299
10300         [gdb/testsuite] Fix gdb.base/print-file-var.exp for remote target
10301         When running test-case gdb.base/print-file-var.exp with target board
10302         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
10303         failures.
10304
10305         Fix these by using the name of a shared lib as returned by gdb_load_shlib.
10306
10307         This required splitting up the gdb_load_shlib functionality, which is now
10308         defined as:
10309         ...
10310         proc gdb_load_shlib { file } {
10311             set dest [gdb_download_shlib $file]
10312             gdb_locate_shlib $file
10313             return $dest
10314         }
10315         ...
10316         such that we can do gdb_download_shlib before gdb is started.
10317
10318         Tested on x86_64-linux.
10319
10320         Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10321
10322 2022-11-15  Tom de Vries  <tdevries@suse.de>
10323
10324         [gdb/testsuite] Add REMOTE_TARGET_USERNAME in remote-gdbserver-on-localhost.exp
10325         As reported here
10326         ( https://sourceware.org/pipermail/gdb-patches/2022-October/193147.html ) a
10327         number of test-cases fails with a remote target setup, for instance test-case
10328         gdb.base/print-file-var.exp.
10329
10330         So, why don't we see these fails with our remote target boards in
10331         gdb/testsuite/boards, say remote-gdbserver-on-localhost.exp?
10332
10333         The problem is that the target board uses the same machine and user for
10334         both (by-definition-local) build and remote target, and when using absolute
10335         pathnames to refer to files on build, we can access those files on target,
10336         which in a real remote target setup wouldn't be the case: we'd have to
10337         download them to target first, and then the filename would also be different.
10338
10339         For aforementioned test-case, this happens when the name of a shared library is
10340         passed as absolute file name to gcc:
10341         ...
10342         gcc ...  -DSHLIB_NAME="$outputs/gdb.base/print-file-var/\
10343           print-file-var-lib2-hidden0-dlopen1-version_id_main0_c.so"
10344         ...
10345
10346         Make these problems visible with remote-gdbserver-on-localhost.exp by
10347         adding an option to specify a test account (still on the same machine)
10348         using REMOTE_TARGET_USERNAME.
10349
10350         We make sure by restricting file permissions, that the test account cannot see
10351         the build files on the $USER account, and that the $USER account cannot see
10352         the target files on the test account.
10353
10354         And so we can reproduce the reported fails:
10355         ...
10356         $ cd build/gdb
10357         $ tc="gdb.base/print-file-var.exp"
10358         $ tb="--target_board remote-gdbserver-on-localhost"
10359         $ tbu="REMOTE_TARGET_USERNAME=remote-target"
10360         $ make check RUNTESTFLAGS="$tb $tbu $tc"
10361            ...
10362         FAIL: gdb.base/print-file-var.exp: lang=c: hidden=0: dlopen=1: \
10363           version_id_main=0: continue to STOP marker
10364         ...
10365
10366         Tested on x86_64-linux.
10367
10368         Reported-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>
10369
10370 2022-11-15  Tom de Vries  <tdevries@suse.de>
10371
10372         [gdb/testsuite] Fix gdb.base/info_sources_2.exp for remote target
10373         With test-case gdb.base/info_sources_2.exp and target board
10374         remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
10375         failures.
10376
10377         Fix these by adding the missing gdb_load_shlib.
10378
10379         Tested on x86_64-linux.
10380
10381 2022-11-15  Tom de Vries  <tdevries@suse.de>
10382
10383         [gdb/testsuite] Fix gdb.base/foll-exec.exp for remote target
10384         When running test-case gdb.base/foll-exec.exp with target board
10385         remote-gdbserver-on-localhost.exp, I run into:
10386         ...
10387         (gdb) PASS: gdb.base/foll-exec.exp: insert first exec catchpoint
10388         continue^M
10389         Continuing.^M
10390         [Inferior 1 (process 4476) exited normally]^M
10391         (gdb) FAIL: gdb.base/foll-exec.exp: continue to first exec catchpoint (the program e\
10392         xited)
10393         ...
10394
10395         The problem is that the foll-exec executable expects the exec-ed executable
10396         execd-prog alongside it, but it's missing.
10397
10398         Fix this by adding the missing gdb_remote_download.
10399
10400         Likewise in a few other test-cases.
10401
10402         Tested on x86_64-linux.
10403
10404 2022-11-15  Tom de Vries  <tdevries@suse.de>
10405
10406         [gdb/testssuite] Skip aarch64 in skip_gdbserver_test if no xml support
10407         On aarch64-linux, with a gdb build without libexpat, so without xml support, I
10408         run into:
10409         ...
10410         (gdb) builtin_spawn attach-no-multi-process^M
10411         attach 26808^M
10412         Attaching to Remote target^M
10413         warning: Can not parse XML target description; XML support was disabled at \
10414           compile time^M
10415         Reading symbols from attach-no-multi-process...^M
10416         Remote 'g' packet reply is too long (expected 788 bytes, got 796 bytes): ... ^M
10417         ...
10418
10419         The test-case checks for skip_gdbserver_tests and that one contains a check
10420         for xml support:
10421         ...
10422             # If GDB is lack of XML support, and targets, like arm, have
10423             # multiple target descriptions, GDB doesn't know which target
10424             # description GDBserver uses, and may fail to parse 'g' packet
10425             # after connection.
10426             if { [gdb_skip_xml_test]
10427                  && ([istarget "arm*-*-linux*"]
10428                       || [istarget "mips*-*-linux*"]
10429                       || [istarget "powerpc*-*-linux*"]
10430                       || [istarget "s390*-*-linux*"]
10431                       || [istarget "x86_64-*-linux*"]
10432                       || [istarget "i\[34567\]86-*-linux*"]) } {
10433                 return 1
10434             }
10435         ...
10436         but it doesn't trigger because aarch64 is missing.
10437
10438         Fix this by adding istarget "aarch64*-*-linux*".
10439
10440         Tested on aarch64-linux.
10441
10442         Approved-By: Luis Machado <luis.machado@arm.com>
10443
10444 2022-11-15  Aditya Vidyadhar Kamath  <Aditya.Kamath1@ibm.com>
10445
10446         Enable multi-process debugging for AIX
10447         This patch adds multi-process debugging feature in AIX.
10448
10449         Till now AIX supported debugging only one inferior at a time,
10450         now we can be able to debug multi process.  Users can use set
10451         follow fork mode in child or parent and set detach on fork on
10452         or off to enable/disable simultaneous debugging of parent/child.
10453
10454 2022-11-15  GDB Administrator  <gdbadmin@sourceware.org>
10455
10456         Automatic date update in version.in
10457
10458 2022-11-14  Carl Love  <cel@us.ibm.com>
10459
10460         PowerPC, fix support for printing the function return value for non-trivial values.
10461         Currently, a non-trivial return value from a function cannot currently be
10462         reliably determined on PowerPC.  This is due to the fact that the PowerPC
10463         ABI uses register r3 to store the address of the buffer containing the
10464         non-trivial return value when the function is called.  The PowerPC ABI
10465         does not guarantee the value in register r3 is not modified in the
10466         function.  Thus the value in r3 cannot be reliably used to obtain the
10467         return addreses on exit from the function.
10468
10469         This patch adds a new gdbarch method to allow PowerPC to access the value
10470         of r3 on entry to a function. On PowerPC, the new gdbarch method attempts
10471         to use the DW_OP_entry_value for the DWARF entries, when exiting the
10472         function, to determine the value of r3 on entry to the function.  This
10473         requires the use of the -fvar-tracking compiler option to compile the
10474         user application thus generating the DW_OP_entry_value in the binary.  The
10475         DW_OP_entry_value entries in the binary file allows GDB to resolve the
10476         DW_TAG_call_site entries.  This new gdbarch method is used to get the
10477         return buffer address, in the case of a function returning a nontrivial
10478         data type, on exit from the function.  The GDB function should_stop checks
10479         to see if RETURN_BUF is non-zero.  By default, RETURN_BUF will be set to
10480         zero by the new gdbarch method call for all architectures except PowerPC.
10481         The get_return_value function will be used to obtain the return value on
10482         all other architectures as is currently being done if RETURN_BUF is zero.
10483         On PowerPC, the new gdbarch method will return a nonzero address in
10484         RETURN_BUF if the value can be determined.  The value_at function uses the
10485         return buffer address to get the return value.
10486
10487         This patch fixes five testcase failures in gdb.cp/non-trivial-retval.exp.
10488         The correct function return values are now reported.
10489
10490         Note this patch is dependent on patch: "PowerPC, function
10491         ppc64_sysv_abi_return_value add missing return value convention".
10492
10493         This patch has been tested on Power 10 and x86-64 with no regressions.
10494
10495 2022-11-14  Carl Love  <cel@us.ibm.com>
10496
10497         PowerPC, function ppc64_sysv_abi_return_value add missing return value convention
10498         This patch address five testcase failures in gdb.cp/non-trivial-retval.exp.
10499         The following commit resulted in the five testcases failures on PowerPC.
10500         The value returned by the function is being reported incorrectly.
10501
10502           commit b1718fcdd1d2a5c514f8ee504ba07fb3f42b8608
10503           Author: Andrew Burgess <aburgess@redhat.com>
10504           Date:   Mon Dec 13 16:56:16 2021 +0000
10505
10506               gdb: on x86-64 non-trivial C++ objects are returned in memory
10507
10508               Fixes PR gdb/28681.  It was observed that after using the `finish`
10509               command an incorrect value was displayed in some cases.  Specifically,
10510               this behaviour was observed on an x86-64 target.
10511
10512         The function:
10513
10514           enum return_value_convention
10515           ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
10516                                        struct type *valtype, struct regcache *regcache,
10517                                        gdb_byte *readbuf, const gdb_byte *writebuf)
10518
10519         should return RETURN_VALUE_STRUCT_CONVENTION if the valtype->code() is
10520         TYPE_CODE_STRUCT and if the language_pass_by_reference is not
10521         trivially_copyable.
10522
10523         This patch adds the needed code to return the value
10524         RETURN_VALUE_STRUCT_CONVENTION in this case.
10525
10526         With this patch, the five test cases still fail but with the message "Value
10527         returned has type: A. Cannot determine contents".  The PowerPC ABI stores
10528         the address of the buffer containing the function return value in register
10529         r3 on entry to the function.  However, the PowerPC ABI does not guarentee
10530         that r3 will not be modified in the function.  So when the function returns,
10531         the return buffer address cannot be reliably obtained from register r3.
10532         Thus the message "Cannot determine contents" is appropriate in this case.
10533
10534 2022-11-14  Tom Tromey  <tromey@adacore.com>
10535
10536         Remove dump_prefix_expression
10537         Since the expression rewrite, dump_prefix_expression has been
10538         misnamed.  This patch cleans this up by removing the function, turning
10539         it into a method on struct expression.
10540
10541 2022-11-14  Andre Vieira  <andre.simoesdiasvieira@arm.com>
10542
10543         aarch64: Add support for Common Short Sequence Compression extension
10544         This patch adds support for the CSSC extension and its corresponding
10545         instructions: ABS, CNT, CTZ, SMAX, UMAX, SMIN, UMIN.
10546
10547         gas/ChangeLog:
10548
10549                 * config/tc-aarch64.c (parse_operands): Handle new operand types.
10550                 * doc/c-aarch64.texi: Document new extension.
10551                 * testsuite/gas/aarch64/cssc.d: New test.
10552                 * testsuite/gas/aarch64/cssc.s: New test.
10553
10554         include/ChangeLog:
10555
10556                 * opcode/aarch64.h (AARCH64_FEATURE_CSSC): New feature Macro.
10557                 (enum aarch64_opnd): New operand types.
10558                 (enum aarch64_insn_class): New instruction class.
10559
10560         opcodes/ChangeLog:
10561
10562                 * aarch64-asm-2.c: Regenerate.
10563                 * aarch64-dis-2.c: Regenerate.
10564                 * aarch64-opc-2.c: Regenerate.
10565                 * aarch64-opc.c (operand_general_constraint_met_p): Update for new
10566                 operand types.
10567                 (aarch64_print_operand): Likewise.
10568                 * aarch64-opc.h (enum aarch64_field_kind): Declare FLD_CSSC_imm8 field.
10569                 * aarch64-tbl.h (aarch64_feature_cssc): Define new feature set.
10570                 (CSSC): Define new feature set Macro.
10571                 (CSSC_INSN): Define new instruction type.
10572                 (aarch64_opcode_table): Add new instructions.
10573
10574 2022-11-14  Jan Beulich  <jbeulich@suse.com>
10575
10576         x86: fold special-operand insn attributes into a single enum
10577         Attributes which aren't used together in any single insn template can be
10578         converted from individual booleans to a single enum, as was done for a few
10579         other attributes before. This is more space efficient. Collect together
10580         all attributes which express special operand constraints (and which fit
10581         the criteria for folding).
10582
10583 2022-11-14  Dimitar Dimitrov  <dimitar@dinux.eu>
10584
10585         pru: bfd: Correct default to no execstack
10586         Data and instruction memories are strictly separated, so it is not
10587         possible to execute instructions from the stack memory on PRU.
10588
10589         I don't see any difference in testsuite results with or without this
10590         change.
10591
10592         bfd/ChangeLog:
10593
10594                 * elf32-pru.c (elf_backend_default_execstack): Define as 0.
10595
10596         ld/ChangeLog:
10597
10598                 * testsuite/ld-elf/elf.exp (target_defaults_to_execstack):
10599                 Return 0 for pru.
10600
10601 2022-11-14  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10602
10603         [gas] arm: Add support for new unwinder directive ".pacspval".
10604         This patch adds the assembler support for the new unwinder
10605         directive ".pacspval" and encodes this directives with opcode
10606         "0xb5". This opcode indicates the unwinder to use effective
10607         vsp as modifier for PAC validation.
10608
10609         gas/ChangeLog:
10610
10611         2022-11-07  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10612
10613                 * doc/c-arm.texi: Document directive.
10614                 * config/tc-arm.c (s_arm_unwind_pacspval): Define function.
10615                 (md_pseudo_table): Add entry for pacspval directive.
10616                 * testsuite/gas/arm/ehabi-pacbti-m.d: New test.
10617                 * testsuite/gas/arm/ehabi-pacbti-m.s: Likewise.
10618
10619 2022-11-14  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10620
10621         [readelf] arm: Support for new pacbti unwind opcode 0xb5.
10622         This patch adds readelf support for decoding the exception
10623         table opcode "0xb5", which indicates to use effective vsp
10624         as modifier for PAC validation as defined by EHABI
10625         (https://github.com/ARM-software/abi-aa/releases/download/2022Q3/ehabi32.pdf
10626         Section 10.3).
10627
10628         binutils/ChangeLog:
10629
10630         2022-11-07  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10631
10632                 * readelf.c (decode_arm_unwind_bytecode): Add entry to decode opcode 0xb5.
10633
10634 2022-11-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
10635
10636         gdb/unittests: PR28413, suppress warnings generated by Gnulib
10637         Gnulib generates a warning if the system version of certain functions
10638         are used (to redirect the developer to use Gnulib version).  It caused a
10639         compiler error when...
10640
10641         -   Compiled with Clang
10642         -   -Werror is specified (by default)
10643         -   C++ standard used by Clang is before C++17 (by default as of 15.0.0)
10644             when this unit test is activated.
10645
10646         This issue is raised as PR28413.
10647
10648         However, previous proposal to fix this issue (a "fix" to Gnulib):
10649         <https://lists.gnu.org/archive/html/bug-gnulib/2021-10/msg00003.html>
10650         was rejected because it ruins the intent of Gnulib warnings.
10651
10652         So, we need a Binutils/GDB-side solution.
10653
10654         This commit tries to address this issue on the GDB side.  We have
10655         "include/diagnostics.h" to disable certain warnings only when necessary.
10656
10657         This commit suppresses the Gnulib warnings by surrounding entire #include
10658         block with DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS to disable Gnulib-
10659         generated warnings on all standard C++ header files.
10660
10661         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28413
10662         Approved-By: Simon Marchi <simon.marchi@efficios.com>
10663         Change-Id: Ieeb5a31a6902808d4c7263a2868ae19a35e0ccaa
10664
10665 2022-11-14  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10666
10667         arm: Add support for Cortex-X1C CPU.
10668         This patch adds support for Cortex-X1C CPU in Arm.
10669
10670         bfd/ChangeLog:
10671
10672         2022-11-09  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10673
10674                 * cpu-arm.c (processors): Add Cortex-X1C CPU entry.
10675
10676         gas/ChangeLog:
10677
10678         2022-11-09  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
10679
10680                 * NEWS: Update docs.
10681                 * config/tc-arm.c (arm_cpus): Add cortex-x1c to -mcpu.
10682                 * doc/c-arm.texi: Update docs.
10683                 * testsuite/gas/arm/cpu-cortex-x1c.d: New test.
10684
10685 2022-11-14  Tom de Vries  <tdevries@suse.de>
10686
10687         [gdb/testsuite] Run gdb.arch/ppc64-symtab-cordic.exp for --enable-targets=all
10688         While looking at test-case gdb.arch/ppc64-symtab-cordic.exp I realized that
10689         the test-case is too restrictive here:
10690         ...
10691         if {![istarget "powerpc*"] || ![is_lp64_target]} {
10692             verbose "Skipping powerpc64 separate debug file symtab test."
10693             return
10694         }
10695         ...
10696         and can also be run on x86_64-linux, if "set arch powerpc:common64" is
10697         supported, which is the case if we've build gdb with --enable-targets=all.
10698
10699         Fix this by instead checking if powerpc:common64 is in the completion list for
10700         "set arch".
10701
10702         This allows us to remove the 'untested "powerpc:common64 is not supported"'.
10703
10704         While we're at it, clean up the test-case by using clean_restart.
10705
10706         Tested on x86_64-linux.
10707
10708 2022-11-14  Tom de Vries  <tdevries@suse.de>
10709
10710         [gdb/testsuite] Handle with_set arch
10711         I realized that the more irregular output of show arch:
10712         ...
10713         (gdb) show arch^M
10714         The target architecture is set to "auto" (currently "i386").^M
10715         ...
10716         would be a problem for something like:
10717         ...
10718         with_set arch powerpc:common64 {}
10719         ...
10720         and indeed:
10721         ...
10722         (gdb) set arch powerpc:common64^M
10723         The target architecture is set to "powerpc:common64".^M
10724         (gdb) FAIL: gdb.base/foo.exp: set arch powerpc:common64
10725         ...
10726         and:
10727         ...
10728         (gdb) set arch set to "auto" (currently "i386")^M
10729         Undefined item: "set".^M
10730         ...
10731
10732         Fix this in with_set by handling this type of output.
10733
10734         Tested on x86_64-linux.
10735
10736 2022-11-14  Tom de Vries  <tdevries@suse.de>
10737
10738         [gdb/testsuite] Set completions to unlimited in get_set_option_choices
10739         In some test-case I tried to use get_set_option_choices "set architecture" and
10740         ran into max-completions:
10741         ...
10742         set architecture simple^M
10743         set architecture tomcat^M
10744         set architecture xscale^M
10745         set architecture  *** List may be truncated, max-completions reached. ***^M
10746         (gdb) PASS: gdb.base/foo.exp: complete set architecture
10747         ...
10748
10749         There's only one test-case using this currently: gdb.base/parse_number.exp,
10750         and it locally sets max-completions to unlimited.
10751
10752         Fix this by:
10753         - factoring out a new proc with_set out of proc with_complaints, and
10754         - using it to temporarily set max-completions to unlimited in
10755           get_set_option_choice.
10756
10757         Tested on x86_64-linux, by running test-cases that excercise
10758         get_set_option_choice and with_complaints.
10759
10760 2022-11-14  Alan Modra  <amodra@gmail.com>
10761
10762         Re: objcopy renaming section with explicit flags
10763         For now, xfail the new test.  Some header/aux-header rewriting is
10764         required at the very least.
10765
10766                 * testsuite/binutils-all/rename-section-01.d: xfail xcoff.
10767
10768 2022-11-14  Alan Modra  <amodra@gmail.com>
10769
10770         objcopy renaming section with explicit flags
10771         This tidies SEC_RELOC handling in bfd, in the process fixing a bug
10772         with objcopy when renaming sections.
10773
10774         bfd/
10775                 * reloc.c (_bfd_generic_set_reloc): Set/clear SEC_RELOC depending
10776                 on reloc count.
10777                 * elf64-sparc.c (elf64_sparc_set_reloc): Likewise.
10778         binutils/
10779                 * objcopy.c (copy_relocations_in_section): Remove now unnecessary
10780                 clearing of SEC_RELOC.
10781                 * testsuite/binutils-all/rename-section-01.d: New test.
10782                 * testsuite/binutils-all/objcopy.exp: Run it.
10783         gas/
10784                 * write.c (size_seg): Remove unneccesary twiddle of SEC_RELOC.
10785                 (write_relocs): Likewise.  Always call bfd_set_reloc.
10786
10787 2022-11-14  GDB Administrator  <gdbadmin@sourceware.org>
10788
10789         Automatic date update in version.in
10790
10791 2022-11-13  Jon Turney  <jon.turney@dronecode.org.uk>
10792
10793         Fix Cygwin build after 02d04eac
10794         Commit 02d04eac "Use strwinerror in gdb/windows-nat.c" also moves
10795         strwinerror() under the USE_WIN32API conditional, which is not defined
10796         for Cygwin (and looks like it shouldn't be, as appears to imply
10797         non-POSIX and MiNGW and WinSock...)
10798
10799         Also enable the declaration and definition of strwinerror() when
10800         __CYGWIN__ is defined.
10801
10802 2022-11-13  Jon Turney  <jon.turney@dronecode.org.uk>
10803
10804         Drop apparently unneeded include of winsock2.h
10805         Commit d08bae3d ("Implement target async for Windows") unconditionally
10806         includes winsock2.h.  We don't want to do that on Cygwin, since
10807         including both winsock2.h and sys/select.h causes incompatible
10808         redefinition problems.
10809
10810         Since that include is apparently unneeded, just drop it.
10811
10812         Fixes: d08bae3d
10813
10814 2022-11-13  GDB Administrator  <gdbadmin@sourceware.org>
10815
10816         Automatic date update in version.in
10817
10818 2022-11-12  Dimitar Dimitrov  <dimitar@dinux.eu>
10819
10820         sim: pru: Fix behaviour when loop count is zero
10821         If the counter for LOOP instruction is provided by a register with
10822         value zero, then the instruction must cause a PC jump directly to the
10823         loop end.  But in that particular case simulator must not initialize
10824         its internal loop variables, because loop body will not be executed.
10825         Instead, simulator must obtain the loop's end address directly from
10826         the LOOP instruction.
10827
10828 2022-11-12  Alan Modra  <amodra@gmail.com>
10829
10830         PowerPC64 paddi -Mraw
10831         On a testcase like
10832          pla 8,foo@pcrel
10833         disassembled with -Mpower10 results in
10834            0:   00 00 10 06     pla     r8,0    # 0
10835            4:   00 00 00 39
10836                                 0: R_PPC64_PCREL34      foo
10837         but with -Mpower10 -Mraw
10838            0:   00 00 10 06     .long 0x6100000
10839                                 0: R_PPC64_PCREL34      foo
10840            4:   00 00 00 39     addi    r8,0,0
10841
10842         The instruction is unrecognised due to the hack we have in
10843         extract_pcrel0 in order to disassemble paddi with RA0=0 and R=1 as
10844         pla.  I could have just added "&& !(dialect & PPC_OPCODE_RAW)" to the
10845         condition in extract_pcrel0 under which *invalid is set, but went for
10846         this larger patch that reorders the extended insn pla to the more
10847         usual place before its underlying machine insn.  (la is after addi
10848         because we never disassemble to la.)
10849
10850         gas/
10851                 * testsuite/gas/ppc/raw.d,
10852                 * testsuite/gas/ppc/raw.s: Add pla.
10853         opcodes/
10854                 * ppc-opc.c (extract_pcrel1): Rename from extract_pcrel0 and
10855                 invert *invalid logic.
10856                 (PCREL1): Rename from PCREL0.
10857                 (prefix_opcodes): Sort pla before paddi, adjusting R operand
10858                 for pla, paddi and psubi.
10859
10860 2022-11-12  Indu Bhagat  <indu.bhagat@oracle.com>
10861
10862         libctf: use libtool for link test in configure
10863         The configure check for ELF support in BFD uses the AC_TRY_LINK.  If
10864         libbfd's dependencies change, this macro will need to be updated
10865         manually with explicit additions to LDFLAGS and LIBS.
10866
10867         This patch updates the check to use libtool instead.
10868
10869         ChangeLog:
10870
10871                 * libctf/configure.ac: Use libtool instead.
10872                 * libctf/configure: Regenerated.
10873
10874 2022-11-12  GDB Administrator  <gdbadmin@sourceware.org>
10875
10876         Automatic date update in version.in
10877
10878 2022-11-11  Simon Marchi  <simon.marchi@polymtl.ca>
10879
10880         gdb: fix start breakpoint expression not working in some languages
10881         Commit 0be837be9fb4 ("gdb: make "start" breakpoint inferior-specific")
10882         regresses gdb.ada/start.exp:
10883
10884             (gdb) start
10885             Error in expression, near `1'.
10886             (gdb) UNTESTED: gdb.ada/start.exp: start failed to land inside the right procedure
10887
10888         This is because in Ada, the equality operator is =, not ==.
10889
10890         I checked the other languages supported by GDB, these other languages
10891         use = for equality:
10892
10893          - Pascal: tests like gdb.pascal/hello.exp are affected too
10894          - Modula-2: I tried building a Modula-2 hello world using gm2, but it
10895            seems like the generated DWARF doesn't specify the Modula-2 language
10896            in the CUs, it's C++ and C, so the selected language isn't
10897            "modula-2".  But if I manually do "set language modula-2" on a dummy
10898            program and then "start", I get the same error.
10899
10900         Other languages all use ==.
10901
10902         So, a short term fix would be to use = or == in the expression, based on
10903         the current language.  If this was meant to be permanent, I would
10904         suggest adding something like an "equality_operator" method to
10905         language_defn, that returns the right equality operator for the
10906         language.  But the goal is to replace all this with proper
10907         inferior-specific breakpoints, so I hope all this is temporary.
10908
10909         Approved-By: Tom de Vries <tdevries@suse.de>
10910         Change-Id: Id4d38e14a80e6bbbb1ad2b2277f974dd55192969
10911
10912 2022-11-11  Mike Frysinger  <vapier@gentoo.org>
10913
10914         sim: igen: cleanup archaic pointer-to-long printf casts
10915         Use proper %p to printf a pointer instead of casting it to long and
10916         using 0x%lx.  It's cleaner, more correct, and doesn't break on LLP64.
10917
10918 2022-11-11  Tom de Vries  <tdevries@suse.de>
10919
10920         [gdb/testsuite] Don't timeout on prompt in gdb_start_cmd
10921         We're currently running into a timeout at:
10922         ...
10923         (gdb) start ^M
10924         Error in expression, near `1'.^M
10925         (gdb) UNTESTED: gdb.ada/start.exp: start failed to land inside the right \
10926           procedure
10927         ...
10928         due to the fact that gdb_start_cmd doesn't handle a prompt as reaction to
10929         the start command.
10930
10931         Fix this by handling the prompt.  Reduces execution time of the test-case from
10932         1m1s to 1s.
10933
10934         Tested on x86_64-linux.
10935
10936 2022-11-11  Tom de Vries  <tdevries@suse.de>
10937
10938         [gdb/testsuite] Better error checking in has_hw_wp_support
10939         With gdb 12.1, on powerpc64le I ran into ERRORs related to has_hw_wp_support
10940         usage, which was already fixed on trunk by commits:
10941         - 13f72372413 ("gdb/testsuite: fix gdb.base/break-idempotent.exp on ppc"), and
10942         - 01a32ee0b8c ("PowerPC, fix gdb.base/watchpoint.exp on Power 9")
10943
10944         While looking into these ERRORs and the commits that fix them, it occurred to
10945         me that while the commits fix the root cause, the failure mode is not great.
10946
10947         The test-cases expect a running instance of gdb upon return, which is not
10948         there, so there's an long stream of ERRORs generated as a result.
10949
10950         Fix this at the start of has_hw_wp_support, by (instead of accomodating a
10951         running gdb instance by calling gdb_exit), checking whether it's called
10952         without a running gdb instance, and erroring out otherwise.  This way, there's
10953         just one error.
10954
10955         I also noticed that in case we do an early exit due to !runto_main, we don't
10956         clean up, so copy the missing cleanups (gdb_exit and $obj file deletion) from
10957         the regular exit.
10958
10959         Tested on x86_64-linux, using has_hw_wp_support for x86_64 in
10960         skip_hw_watchpoint_tests.
10961
10962 2022-11-11  Lancelot SIX  <lancelot.six@amd.com>
10963
10964         gdb/py-inferior: Keep inferior threads in a map
10965         The python code maintains a list of threads for each inferior.  This
10966         list is implemented as a linked list.  When the number of threads grows
10967         high, this implementation can begin to be a performance bottleneck as
10968         finding a particular thread_object in the list has a complexity of O(N).
10969
10970         We see this in ROCgdb[1], a downstream port of GDB for AMDGUP.  On
10971         AMDGPU devices, the number of threads can get significantly higher than
10972         on usual GDB workloads.
10973
10974         In some situations, we can reach the end of the inferior process with
10975         GDB still having a substantial list of known threads.  While running
10976         target_mourn_inferior, we end up in inferior::clear_thread_list which
10977         iterates over all remaining threads and marks each thread exited.  This
10978         fires the gdb::observers::thread_exit observer and eventually
10979         py-inferior.c:set_thread_exited gets called.  This function searches in
10980         the linked list with poor performances.
10981
10982         This patch proposes to change the linked list that keeps the per
10983         inferior_object list of thread_objects into a std::unordered_map.  This
10984         allows to have the search operation complexity be O(1) on average
10985         instead of O(N).
10986
10987         With this patch, we can complete clear_thread_list in about 2.5 seconds
10988         compared to 10 minutes without it.
10989
10990         Except for the performance change, no user visible change is expected.
10991
10992         Regression tested on Ubuntu-22.04 x86_64.
10993
10994         [1] https://github.com/ROCm-Developer-Tools/ROCgdb
10995
10996 2022-11-11  Luis Machado  <luis.machado@arm.com>
10997
10998         Make sure a copy_insn_closure is available when we have a match in copy_insn_closure_by_addr
10999         PR gdb/29272
11000
11001         Investigating PR29272, it was mentioned a particular test used to work on
11002         GDB 10, but it started failing with GDB 11 onwards. I tracked it down to
11003         some displaced stepping improvements on commit
11004         187b041e2514827b9d86190ed2471c4c7a352874.
11005
11006         In particular, one of the corner cases using copy_insn_closure_by_addr got
11007         silently broken. It is hard to spot because it doesn't have any good tests
11008         for it, and the situation is quite specific to the Arm target.
11009
11010         Essentially, the change from the displaced stepping improvements made it so
11011         we could still invoke copy_insn_closure_by_addr correctly to return the
11012         pointer to a copy_insn_closure, but it always returned nullptr due to
11013         the order of the statements in displaced_step_buffer::prepare.
11014
11015         The way it is now, we first write the address of the displaced step buffer
11016         to PC and then save the copy_insn_closure pointer.
11017
11018         The problem is that writing to PC for the Arm target requires figuring
11019         out if the new PC is thumb mode or not.
11020
11021         With no copy_insn_closure data, the logic to determine the thumb mode
11022         during displaced stepping doesn't work, and gives random results that
11023         are difficult to track (SIGILL, SIGSEGV etc).
11024
11025         Fix this by reordering the PC write in displaced_step_buffer::prepare
11026         and, for safety, add an assertion to
11027         displaced_step_buffer::copy_insn_closure_by_addr so GDB stops right
11028         when it sees this invalid situation. If this gets broken again in the
11029         future, it will be easier to spot.
11030
11031         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29272
11032
11033         Approved-By: Simon Marchi <simon.marchi@efficios.com>
11034
11035 2022-11-11  Felix Willgerodt  <felix.willgerodt@intel.com>
11036
11037         gdb, btrace: Fix rn-dl-bind.exp for new icx remark.
11038         When running the test with the latest Intel compiler:
11039
11040         Running gdb/gdb/testsuite/gdb.btrace/rn-dl-bind.exp ...
11041         gdb compile failed, icpx: warning: treating 'c' input as 'c++' when
11042         in C++ mode, this behavior is deprecated [-Wdeprecated]
11043
11044         The test doesn't seem to test something specifically for C++,
11045         so I removed the C++ compilation option. Alternatively we could rename
11046         rn-dl-bind.exp.c to rn-dl-bind.exp.cc.
11047
11048 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11049
11050         gdb/testsuite: disable gdb.cp/call-method-register.exp when not using gcc
11051         The test gdb.cp/call-method-register.exp assumes that the class will be
11052         placed on a register. However, this keyword has been deprecated since
11053         C++11, and Clang, for instance, does not feel the need to follow it.
11054         Since this test is not usable without this working, this commit marks
11055         this test as untested.
11056
11057         Approved-by: Tom Tromey <tom@tromey.com>
11058
11059 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11060
11061         gdb/testsuite: remove XFAIL on gdb.cp/temargs.exp
11062         gdb.cp/temargs.exp last 2 tests always setup an XFAILs, despite checking
11063         for old gcc versions.  However, Clang does not fail in this test,
11064         turning into XPASSes and slighty annoying when comparing between
11065         compilers.  To change this, make the xfails only happen if we using gcc.
11066
11067         Approved-by: Tom Tromey <tom@tromey.com>
11068
11069 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11070
11071         gdb/testsuite: disable some tests of gdb.cp/typeid.exp when using Clang
11072         Since Clang chooses to not add any debug information for base types,
11073         expecting it to be included with libraries' informations, gdb.cp/typeid.exp
11074         will always fail if the program hasn't started.  This commit fixes that by
11075         making it so when using Clang, the base type variables aren't tested.
11076
11077         Approved-by: Tom Tromey <tom@tromey.com>
11078
11079 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11080
11081         gdb/testsuite: skip gdb.cp/anon-struct.exp when using Clang
11082         When Clang compiles anonymous structures, it does not add linkage names in
11083         their dwarf representations. This is compounded by Clang not adding linkage
11084         names to subprograms of those anonymous structs (for instance, the
11085         constructor). With these 2 things together, GDB is unable to refer to
11086         any of them, so there is no way to pass any of the tests of
11087         gdb.cp/anon-struct.exp
11088
11089         Since this isn't a bug on Clang or GDB according to the DWARF
11090         specifications as DW_AT_name is optional for all DIEs, the test was marked
11091         as untested.
11092
11093         Since I was already touching the file, I also added a comment at the top
11094         of the file explaining what it is testing for.
11095
11096         Approved-by: Tom Tromey <tom@tromey.com>
11097
11098 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11099
11100         gdb/testsuite: allow for Clang style destructors on gdb.cp/m-static.exp
11101         when running gdb.cp/m-static.exp using Clang, we get the following
11102         failures:
11103
11104             print test1.~gnu_obj_1^M
11105             $6 = {void (gnu_obj_1 * const)} 0x555555555470 <gnu_obj_1::~gnu_obj_1()>^M
11106             (gdb) FAIL: gdb.cp/m-static.exp: simple object instance, print destructor
11107             ptype test1.~gnu_obj_1^M
11108             type = void (gnu_obj_1 * const)^M
11109             (gdb) FAIL: gdb.cp/m-static.exp: simple object instance, ptype destructor
11110             print test1.'~gnu_obj_1'^M
11111             $7 = {void (gnu_obj_1 * const)} 0x555555555470 <gnu_obj_1::~gnu_obj_1()>^M
11112             (gdb) FAIL: gdb.cp/m-static.exp: simple object instance, print quoted destructor
11113
11114         This is because the test is expecting an extra integer parameter on the
11115         destructor. Looking at the debuginfo, it seems that there is nothing
11116         actually wrong with this output, so these tests were changed to test
11117         multiple possible regexps.
11118
11119         Approved-by: Tom Tromey <tom@tromey.com>
11120
11121 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11122
11123         gdb/testsuite: add XFAIL to gdb.cp/derivation.exp when using Clang
11124         When running gdb.cp/derivation.exp using Clang, we get an unexpected
11125         failure when printing the type of a class with an internal typedef. This
11126         happens because Clang doesn't add accessibility information for typedefs
11127         inside classes (see https://github.com/llvm/llvm-project/issues/57608
11128         for more info). To help with Clang testing, an XFAIL was added to this
11129         test.
11130
11131         Approved-by: Tom Tromey <tom@tromey.com>
11132
11133 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11134
11135         gdb/testsuite: account for clang's nested destructor calls on gdb.cp/mb-ctor.exp
11136         When compiling virtual classes's destructors, two versions are compiled,
11137         one with a single parameter (this) and the other with 2 parameters (this
11138         and vtt).
11139
11140         GCC's compilation makes it so either the version with 1
11141         parameter or the one with 2 parameters is called, depending on whether
11142         the destructor is being called by the class itself or by an inherited
11143         class. On the test gdb.cp/mb-ctor.exp, this means that the breakpoint
11144         set at the destructor will be hit 4 times.
11145
11146         Clang, on the other hand, makes the single-parameter version call the 2
11147         parameter version, probably in an attempt to reduce the size of the
11148         resulting executable. This means that the gdb.cp/mb-ctor.exp will hit 6
11149         breakpoints before finishing, and is the reason why this test was
11150         failing. To make this test stop failing, a compiler check is added and
11151         another "continue" instruction is issued to account for this difference.
11152
11153         Approved-by: Tom Tromey <tom@tromey.com>
11154
11155 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11156
11157         gdb/testsuite: enable running gdb.cp/classes.exp with clang
11158         When attempting to run the gdb.cp/classes.exp test using Clang++, the
11159         test fails to prepare with -Wnon-c-typedef-for-linkage like the
11160         previously fixed gdb.cp/class2.exp. Upon fixing this, the test shows 5
11161         unexpected failures. One such failures is:
11162
11163         ptype/r class class_with_public_typedef
11164         type = class class_with_public_typedef {
11165           private:
11166             int a;
11167           public:
11168             class_with_public_typedef::INT b;
11169
11170           private:
11171             typedef int INT;
11172         }
11173         (gdb) FAIL: gdb.cp/classes.exp: ptype class class_with_public_typedef // wrong access specifier for typedef: private
11174
11175         While g++ provided the following output:
11176
11177         ptype/r class class_with_public_typedef
11178         type = class class_with_public_typedef {
11179           private:
11180             int a;
11181           public:
11182             class_with_public_typedef::INT b;
11183
11184             typedef int INT;
11185         }
11186         (gdb) PASS: gdb.cp/classes.exp: ptype class class_with_public_typedef
11187
11188         This error happens because Clang does not add DW_AT_accessibility to
11189         typedefs inside classes, and without this information GDB defaults to
11190         assuming the typedef is private.  Since there is nothing that GDB can do
11191         about this, these tests have been set as xfails, and Clang bug 57608 has
11192         been filed.
11193
11194         Bug: https://github.com/llvm/llvm-project/issues/57608
11195         Approved-by: Tom Tromey <tom@tromey.com>
11196
11197 2022-11-11  Bruno Larsen  <blarsen@redhat.com>
11198
11199         gdb/testsuite: ignore Non-C-typedefs for gdb.cp/class2.exp
11200         When attempting to test gdb.cp/class2.exp using Clang, it fails to
11201         prepare with the following error:
11202
11203         Executing on host: clang++    -fdiagnostics-color=never -Wno-unknown-warning-option  -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsuite/outputs/gdb.cp/class2/class20.o /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc    (timeout = 300)
11204         builtin_spawn -ignore SIGHUP clang++ -fdiagnostics-color=never -Wno-unknown-warning-option -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsuite/outputs/gdb.cp/class2/class20.o /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc
11205         /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:53:14: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
11206         typedef class {
11207                      ^
11208                       Dbase
11209         /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:54:2: note: type is not C-compatible due to this member declaration
11210          public:
11211          ^~~~~~~
11212         /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:58:3: note: type is given name 'Dbase' for linkage purposes by this typedef declaration
11213         } Dbase;
11214           ^
11215         1 warning generated.
11216         gdb compile failed, /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:53:14: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
11217         typedef class {
11218                      ^
11219                       Dbase
11220         /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:54:2: note: type is not C-compatible due to this member declaration
11221          public:
11222          ^~~~~~~
11223         /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.cp/class2.cc:58:3: note: type is given name 'Dbase' for linkage purposes by this typedef declaration
11224         } Dbase;
11225           ^
11226         1 warning generated.
11227         UNTESTED: gdb.cp/class2.exp: failed to prepare
11228
11229         This can be silenced by adding -Wno-non-c-typedef-for-linkage for Clang
11230         11 or later.  The test shows no failures with this change.
11231
11232         Approved-by: Tom Tromey <tom@tromey.com>
11233
11234 2022-11-11  Jan Beulich  <jbeulich@suse.com>
11235
11236         gas: accept custom ".linefile <n> ."
11237         While .linefile is generally intended for gas internal use only, its use
11238         in a source file would better not result in an internal error. Give use
11239         of it outside of any macro(-like) construct the meaning of restoring the
11240         original (physical) input file name.
11241
11242         x86: drop stray IsString from PadLock insns
11243         The need for IsString on the PadLock insns went away with the
11244         introduction of RepPrefixOk. Drop these leftovers.
11245
11246         x86: drop duplicate sse4a entry from cpu_arch[]
11247         Of the two instances the first is correct in using ANY_SSE4A as 3rd
11248         argument to SUBARCH(), so drop the wrong/redundant/dead 2nd one.
11249
11250 2022-11-11  Alan Modra  <amodra@gmail.com>
11251
11252         PR28834, PR26946 sanity checking section size
11253         This patch provides a new function to sanity check section sizes.
11254         It's mostly extracted from what we had in bfd_get_full_section_contents
11255         but also handles compressed debug sections.
11256         Improvements are:
11257         - section file offset is taken into account,
11258         - added checks that a compressed section can be read from file.
11259
11260         The function is then used when handling multiple .debug_* sections
11261         that need to be read into a single buffer, to sanity check sizes
11262         before allocating the buffer.
11263
11264                 PR 26946, PR 28834
11265                 * Makefile.am (LIBBFD_H_FILES): Add section.c.
11266                 * compress.c (bfd_get_full_section_contents): Move section size
11267                 sanity checks..
11268                 * section.c (_bfd_section_size_insane): ..to here.  New function.
11269                 * dwarf2.c (read_section): Use _bfd_section_size_insane.
11270                 (_bfd_dwarf2_slurp_debug_info): Likewise.
11271                 * Makefile.in: Regenerate.
11272                 * libbfd.h: Regenerate.
11273
11274 2022-11-11  Alan Modra  <amodra@gmail.com>
11275
11276         Sanity check SHT_MIPS_OPTIONS size
11277                 * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Use
11278                 bfd_malloc_and_get_section to read contents of .MIPS.options.
11279
11280         Re: gold: add --compress-debug-sections=zstd [PR 29641]
11281         Fix the following:
11282         compressed_output.cc:86:8: error: assignment of read-only variable ‘size’
11283            86 |   size = ZSTD_compress(*compressed_data + header_size, size, uncompressed_data,
11284
11285 2022-11-11  Fangrui Song  <maskray@google.com>
11286
11287         gold: add --compress-debug-sections=zstd [PR 29641]
11288         This option compresses output debug sections with zstd and sets ch_type
11289         to ELFCOMPRESS_ZSTD.  Latest gdb and lldb support ELFCOMPRESS_ZSTD.
11290
11291         There will be an error if zstd is not enabled at configure time.
11292
11293             error: --compress-debug-sections=zstd: gold is not built with zstd support
11294
11295 2022-11-11  Fangrui Song  <maskray@google.com>
11296
11297         gold, dwp: support zstd compressed input debug sections [PR 29641]
11298         This feature is enabled if config/zstd.m4 uses zstd.
11299
11300 2022-11-11  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
11301
11302         gprofng: fix typo in configure.ac
11303         gprofng/ChangeLog
11304         2022-11-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
11305
11306                 * configure.ac: Fix typo in redirect operator.
11307                 * configure: Rebuild.
11308
11309 2022-11-11  Vladislav Khmelevsky  <och95@yandex.ru>
11310
11311         Fix adrp distance check
11312         gold/
11313                 * aarch64.cc (aarch64_valid_for_adrp_p): Shift offset
11314                 as a signed number.
11315
11316 2022-11-11  GDB Administrator  <gdbadmin@sourceware.org>
11317
11318         Automatic date update in version.in
11319
11320 2022-11-10  Mike Frysinger  <vapier@gentoo.org>
11321
11322         sim: v850: rename v850.dc to align with other ports
11323         Other arches use the .dc extension for the instruction decode table.
11324
11325         sim: igen: fix hang when decoding boolean rule constants
11326         The parser for boolean rules fails to skip over the , separator in
11327         the options which makes it hang forever.  No dc files in the tree
11328         use boolean rules atm which is why no one noticed.
11329
11330         sim: igen: mark error func as noreturn since it exits
11331
11332         sim: igen: mark output funcs with printf attribute
11333         ... and fix the legitimate bug that it catches.
11334
11335         sim: igen: constify various func arguments
11336
11337         sim: ppc: rename ppc-instructions to powerpc.igen
11338         To make it clear this is an input to the igen tool, rename it with an
11339         igen extension.  This matches the other files in the ppc dir (altivec
11340         & e500 igen files), and the other igen ports (mips, mn10300, v850).
11341
11342 2022-11-10  H.J. Lu  <hjl.tools@gmail.com>
11343
11344         i386: Check invalid (%dx) usage
11345         (%dx) isn't a valid memory address in any modes.  It is used as a special
11346         memory operand for input/output port address in AT&T syntax and should
11347         only be used with input/output instructions.  Update i386_att_operand to
11348         set i.input_output_operand to true for (%dx) and issue an error if (%dx)
11349         is used with non-input/output instructions.
11350
11351                 PR gas/29751
11352                 * config/tc-i386.c (_i386_insn): Add input_output_operand.
11353                 (md_assemble): Issue an error if input/output memory operand is
11354                 used with non-input/output instructions.
11355                 (i386_att_operand): Set i.input_output_operand to true for
11356                 (%dx).
11357                 * testsuite/gas/i386/inval.l: Updated.
11358                 * testsuite/gas/i386/x86-64-inval.l: Likewise.
11359                 * testsuite/gas/i386/inval.s: Add tests for invalid (%dx) usage.
11360                 * testsuite/gas/i386/x86-64-inval.s: Likewise.
11361
11362 2022-11-10  Simon Marchi  <simon.marchi@efficios.com>
11363
11364         gdb: make "start" breakpoint inferior-specific
11365         I saw this failure on a CI:
11366
11367             (gdb) add-inferior
11368             [New inferior 2]
11369             Added inferior 2
11370             (gdb) PASS: gdb.threads/vfork-multi-inferior.exp: method=non-stop: add-inferior
11371             inferior 2
11372             [Switching to inferior 2 [<null>] (<noexec>)]
11373             (gdb) PASS: gdb.threads/vfork-multi-inferior.exp: method=non-stop: inferior 2
11374             kill
11375             The program is not being run.
11376             (gdb) file /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/tmp/tmp.GYATAXR8Ku/gdb/testsuite/outputs/gdb.threads/vfork-multi-inferior/vfork-multi-inferior-sleep
11377             Reading symbols from /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/tmp/tmp.GYATAXR8Ku/gdb/testsuite/outputs/gdb.threads/vfork-multi-inferior/vfork-multi-inferior-sleep...
11378             (gdb) run &
11379             Starting program: /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/tmp/tmp.GYATAXR8Ku/gdb/testsuite/outputs/gdb.threads/vfork-multi-inferior/vfork-multi-inferior-sleep
11380             (gdb) PASS: gdb.threads/vfork-multi-inferior.exp: method=non-stop: run inferior 2
11381             inferior 1
11382             [Switching to inferior 1 [<null>] (<noexec>)]
11383             (gdb) PASS: gdb.threads/vfork-multi-inferior.exp: method=non-stop: inferior 1
11384             kill
11385             The program is not being run.
11386             (gdb) file /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/tmp/tmp.GYATAXR8Ku/gdb/testsuite/outputs/gdb.threads/vfork-multi-inferior/vfork-multi-inferior
11387             Reading symbols from /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/tmp/tmp.GYATAXR8Ku/gdb/testsuite/outputs/gdb.threads/vfork-multi-inferior/vfork-multi-inferior...
11388             (gdb) break should_break_here
11389             Breakpoint 1 at 0x11b1: file /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/src/binutils-gdb/gdb/testsuite/gdb.threads/vfork-multi-inferior.c, line 25.
11390             (gdb) PASS: gdb.threads/vfork-multi-inferior.exp: method=non-stop: break should_break_here
11391             [Thread debugging using libthread_db enabled]
11392             Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
11393             start
11394             Temporary breakpoint 2 at 0x11c0: -qualified main. (2 locations)
11395             Starting program: /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/tmp/tmp.GYATAXR8Ku/gdb/testsuite/outputs/gdb.threads/vfork-multi-inferior/vfork-multi-inferior
11396             [Thread debugging using libthread_db enabled]
11397             Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
11398
11399             Thread 2.1 "vfork-multi-inf" hit Temporary breakpoint 2, main () at /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/src/binutils-gdb/gdb/testsuite/gdb.threads/vfork-multi-inferior-sleep.c:23
11400             23    sleep (30);
11401             (gdb) FAIL: gdb.threads/vfork-multi-inferior.exp: method=non-stop: start inferior 1
11402
11403         What happens is:
11404
11405          1. We start inferior 2 with "run&", it runs very slowly, takes time to
11406             get to main
11407          2. We switch to inferior 1, and run "start"
11408          3. The temporary breakpoint inserted by "start" applies to all inferiors
11409          4. Inferior 2 hits that breakpoint and GDB reports that hit
11410
11411         To avoid this, breakpoints inserted by "start" should be
11412         inferior-specific.  However, we don't have a nice way to make
11413         inferior-specific breakpoints yet.  It's possible to make
11414         pspace-specific breakpoints (for example how the internal_breakpoint
11415         constructor does) by creating a symtab_and_line manually.  However,
11416         inferiors can share program spaces (usually on particular embedded
11417         targets), so we could have a situation where two inferiors run the same
11418         code in the same program space.  In that case, it would just not be
11419         possible to insert a breakpoint in one inferior but not the other.
11420
11421         A simple solution that should work all the time is to add a condition to
11422         the breakpoint inserted by "start", to check the inferior reporting the
11423         hit is the expected one.  This is what this patch implements.
11424
11425         Add a test that does:
11426
11427          - start in background inferior 1 that sleeps before reaching its main
11428            function (using a sleep in a global C++ object's constructor)
11429          - start inferior 2 with the "start" command, which also sleeps before
11430            reaching its main function
11431          - validate that we hit the breakpoint in inferior 2
11432
11433         Without the fix, we hit the breakpoint in inferior 1 pretty much all the
11434         time.  There could be some unfortunate scheduling causing the test not
11435         to catch the bug, for instance if the scheduler decides not to schedule
11436         inferior 1 for a long time, but it would be really rare.  If the bug is
11437         re-introduced, the test will catch it much more often than not, so it
11438         will be noticed.
11439
11440         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11441         Approved-By: Pedro Alves <pedro@palves.net>
11442         Change-Id: Ib0148498a476bfa634ed62353c95f163623c686a
11443
11444 2022-11-10  Bruno Larsen  <blarsen@redhat.com>
11445
11446         gdb: Fix regressions caused by 041de3d73aa121f2ff0c077213598963bfb34b79
11447         Commit 041de3d73aa changed the output format of all error messages when
11448         GDB couldn't determine a compatible overload for a given function, but
11449         it was only supposed to change if the failure happened due to incomplete
11450         types. This commit removes the stray . that was added
11451
11452 2022-11-10  Aaron Merey  <amerey@redhat.com>
11453
11454         gdb/debuginfod: Improve progress updates
11455         If the download size is known, a progress bar is displayed along with
11456         the percentage of completion and the total download size.
11457
11458           Downloading separate debug info for /lib/libxyz.so
11459           [############                                      ]  25% (10.01 M)
11460
11461         If the download size is not known, a progress indicator is displayed
11462         with a ticker ("###") that moves across the screen at a rate of 1 tick
11463         every 0.5 seconds.
11464
11465           Downloading separate debug info for /lib/libxyz.so
11466           [         ###                                                      ]
11467
11468         If the output stream is not a tty, batch mode is enabled, the screen is
11469         too narrow or width has been set to 'unlimited', then only a static
11470         description of the download is printed. No bar or ticker is displayed.
11471
11472           Downloading separate debug info for /lib/libxyz.so...
11473
11474         In any case, if the size of the download is known at the time the
11475         description is printed then it will be included in the description.
11476
11477           Downloading 10.01 MB separate debug info for /lib/libxyz.so...
11478
11479 2022-11-10  Simon Marchi  <simon.marchi@efficios.com>
11480
11481         gdb: add special handling for frame level 0 in frame_info_ptr
11482         I noticed this problem while preparing the initial submission for the
11483         ROCm GDB port.  One particularity of this patch set is that it does not
11484         support unwinding frames, that requires support of some DWARF extensions
11485         that will come later.  It was still possible to run to a breakpoint and
11486         print frame #0, though.
11487
11488         When rebasing on top of the frame_info_ptr work, GDB started tripping on
11489         a prepare_reinflate call, making it not possible anymore to event print
11490         the frame when stopping on a breakpoint.  One thing to know about frame
11491         0 is that its id is lazily computed when something requests it through
11492         get_frame_id.  See:
11493
11494           https://gitlab.com/gnutools/binutils-gdb/-/blob/23912acd402f5af9caf91b257e5209ec4c58a09c/gdb/frame.c#L2070-2080
11495
11496         So, up to that prepare_reinflate call, frame 0's id was not computed,
11497         and prepare_reinflate, calling get_frame_id, forces it to be computed.
11498         Computing the frame id generally requires unwinding the previous frame,
11499         which with my ROCm GDB patch fails.  An exception is thrown and the
11500         printing of the frame is simply abandonned.
11501
11502         Regardless of this ROCm GDB problem (which is admittedly temporary, it
11503         will be possible to unwind with subsequent patches), we want to avoid
11504         prepare_reinflate to force the computing of the frame id, for the same
11505         reasons we lazily compute it in the first place.
11506
11507         In addition, frame 0's id is subject to change across a frame cache
11508         reset.  This is why save_selected_frame and restore_selected_frame have
11509         special handling for frame 0:
11510
11511           https://gitlab.com/gnutools/binutils-gdb/-/blob/23912acd402f5af9caf91b257e5209ec4c58a09c/gdb/frame.c#L1841-1863
11512
11513         For this last reason, we also need to handle frame 0 specially in
11514         prepare_reinflate / reinflate.  Because the frame id of frame 0 can
11515         change across a frame cache reset, we must not rely on the frame id from
11516         that frame to reinflate it.  We should instead just re-fetch the current
11517         frame at that point.
11518
11519         This patch adds a frame_info_ptr::m_cached_level field, set in
11520         frame_info_ptr::prepare_reinflate, so we can tell if a frame is frame 0.
11521         There are cases where a frame_info_ptr object wraps a sentinel frame,
11522         for which frame_relative_level returns -1, so I have chosen the value -2
11523         to represent "invalid frame level", for when the frame_info_ptr object
11524         is empty.
11525
11526         In frame_info_ptr::prepare_reinflate, only cache the frame id if the
11527         frame level is not 0.  It's fine to cache the frame id for the sentinel
11528         frame, it will be properly handled by frame_find_by_id later.
11529
11530         In frame_info_ptr::reinflate, if the frame level is 0, call
11531         get_current_frame to get the target's current frame.  Otherwise, use
11532         frame_find_by_id just as before.
11533
11534         This patch should not have user-visible changes with upstream GDB.  But
11535         it will avoid forcing the computation of frame 0's when calling
11536         prepare_reinflate.  And, well, it fixes the upcoming ROCm GDB patch
11537         series.
11538
11539         Change-Id: I176ed7ee9317ddbb190acee8366e087e08e4d266
11540         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11541
11542 2022-11-10  Simon Marchi  <simon.marchi@polymtl.ca>
11543
11544         gdb: add missing prepare_reinflate call in print_frame_info
11545         print_frame_info calls frame_info_ptr::reinflate, but not
11546         frame_info_ptr::prepare_reinflate, add the call to prepare_reinflate.
11547         It works right now, because all callers of print_frame_info that could
11548         possibly lead to the pretty printers being called, and the frame_info
11549         objects being invalidated, do call prepare_reinflate themselves.  And
11550         since the cached frame id is copied when passing a frame_info_ptr by
11551         value, print_frame_info does have a cached frame id on entry.  So
11552         technically, this change isn't needed.  But I don't think it's good for
11553         a function to rely on its callers to have called prepare_reinflate, if
11554         it intends to call reinflate.
11555
11556         Change-Id: Ie332b2d5479aef46f83fdc1120c7c83f4e84d1b0
11557         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11558
11559 2022-11-10  Simon Marchi  <simon.marchi@efficios.com>
11560
11561         gdb: use frame_id_p instead of comparing to null_frame_id in frame_info_ptr::reinflate
11562         The assertion
11563
11564             gdb_assert (m_cached_id != null_frame_id);
11565
11566         is always true, as comparing equal to null_frame_id is always false
11567         (it's the first case in frame_id::operator==, not sure why it's not this
11568         way, but that's what it is).
11569
11570         Replace the comparison with a call to frame_id_p.
11571
11572         Approved-By: Tom Tromey <tom@tromey.com>
11573         Change-Id: I93986e6a85ac56353690792552e5b3b4cedec7fb
11574
11575 2022-11-10  Simon Marchi  <simon.marchi@efficios.com>
11576
11577         gdb: remove manual frame_info reinflation code in backtrace_command_1
11578         With the following patch applied (gdb: use frame_id_p instead of
11579         comparing to null_frame_id in frame_info_ptr::reinflate), I would get:
11580
11581             $ ./gdb -q -nx --data-directory=data-directory testsuite/outputs/gdb.base/bt-selected-frame/bt-selected-frame -ex "b breakpt" -ex r -ex "bt full"
11582             Reading symbols from testsuite/outputs/gdb.base/bt-selected-frame/bt-selected-frame...
11583             Breakpoint 1 at 0x1131: file /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/bt-selected-frame.c, line 22.
11584             Starting program: /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/bt-selected-frame/bt-selected-frame
11585             [Thread debugging using libthread_db enabled]
11586             Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
11587
11588             Breakpoint 1, breakpt () at /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/bt-selected-frame.c:22
11589             22      }
11590             #0  breakpt () at /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/bt-selected-frame.c:22
11591             No locals.
11592             /home/smarchi/src/binutils-gdb/gdb/frame-info.c:42: internal-error: reinflate: Assertion `frame_id_p (m_cached_id)' failed.
11593
11594         This is because the code in backtrace_command_1 to manually reinflate
11595         `fi` steps overs frame_info_ptr's toes.
11596
11597         When calling
11598
11599             fi.prepare_reinflate ();
11600
11601         `fi` gets properly filled with the cached frame id.  But when this
11602         happens:
11603
11604             fi = frame_find_by_id (frame_id);
11605
11606         `fi` gets replaced by a brand new frame_info_ptr that doesn't have a
11607         cached frame id.  Then this is called without a cached frame id:
11608
11609             fi.reinflate ();
11610
11611         That doesn't cause any problem currently, since
11612
11613          - the gdb_assert in the reinflate method doesn't actually do anything
11614            (the following patch fixes that)
11615          - `fi.m_ptr` will always be non-nullptr, since we just got it from
11616            frame_find_by_id, so reinflate will not do anything, it won't try to
11617            use m_cached_id
11618
11619         Fix that by removing the code to manually re-fetch the frame.  That
11620         should be taken care of by frame_info_ptr::reinflate.
11621
11622         Note that the old code checked if we successfully re-inflated the frame
11623         or not, and if not it did emit a warning.  The equivalent in
11624         frame_info_ptr::reinflate asserts that the frame has been successfully
11625         re-inflated.  It's not clear if / when this can happen, but if it can
11626         happen, we'll need to find a solution to this problem globally
11627         (everywhere a frame_info_ptr can be re-inflated), not just here.  So I
11628         propose to leave it like this, until it does become a problem.
11629
11630         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11631         Change-Id: I07b783d94e2853e0a2d058fe7deaf04eddf24835
11632
11633 2022-11-10  Simon Marchi  <simon.marchi@polymtl.ca>
11634
11635         gdb: move frame_info_ptr method implementations to frame-info.c
11636         I don't see any particular reason why the implementations of the
11637         frame_info_ptr object are in the header file.  It only seems to add some
11638         complexity.  Since we can't include frame.h in frame-info.h, we have to
11639         add declarations of functions defined in frame.c, in frame-info.h.  By
11640         moving the implementations to a new frame-info.c, we can avoid that.
11641
11642         Change-Id: I435c828f81b8a3392c43ef018af31effddf6be9c
11643         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11644         Reviewed-By: Tom Tromey <tom@tromey.com>
11645
11646 2022-11-10  Simon Marchi  <simon.marchi@polymtl.ca>
11647
11648         gdb: add prepare_reinflate/reinflate around print_frame_args in info_frame_command_core
11649         I noticed this crash:
11650
11651             $ ./gdb --data-directory=data-directory -nx -q \
11652                   testsuite/outputs/gdb.python/pretty-print-call-by-hand/pretty-print-call-by-hand \
11653                   -x testsuite/outputs/gdb.python/pretty-print-call-by-hand/pretty-print-call-by-hand.py \
11654                   -ex "b g" -ex r
11655             (gdb) info frame
11656             Stack level 0, frame at 0x7fffffffdd80:
11657              rip = 0x555555555160 in g
11658                 (/home/simark/src/binutils-gdb/gdb/testsuite/gdb.python/pretty-print-call-by-hand.c:41); saved rip = 0x5555555551a3
11659              called by frame at 0x7fffffffdda0
11660              source language c.
11661              Arglist at 0x7fffffffdd70, args: mt=mytype is 0x555555556004 "hello world",
11662                 depth=10
11663
11664             Fatal signal: Segmentation fault
11665
11666         This is another case of frame_info being invalidated under a function's
11667         feet.  The stack trace when the frame_info get invalidated looks like:
11668
11669             ... many frames to pretty print the arg, that eventually invalidate the frame_infos ...
11670             #35 0x00005568d0a8ab24 in print_frame_arg (fp_opts=..., arg=0x7ffc3216bcb0) at /home/simark/src/binutils-gdb/gdb/stack.c:489
11671             #36 0x00005568d0a8cc75 in print_frame_args (fp_opts=..., func=0x621000233210, frame=..., num=-1, stream=0x60b000000300)
11672                 at /home/simark/src/binutils-gdb/gdb/stack.c:898
11673             #37 0x00005568d0a9536d in info_frame_command_core (fi=..., selected_frame_p=true) at /home/simark/src/binutils-gdb/gdb/stack.c:1682
11674
11675         print_frame_args knows that print_frame_arg can invalidate frame_info
11676         objects, and therefore calls prepare_reinflate/reinflate.  However,
11677         info_frame_command_core has a separate frame_info_ptr instance (it is
11678         passed by value / copy).  So info_frame_command_core needs to know that
11679         print_frame_args can invalidate frame_info objects, and therefore needs
11680         to prepare_reinflate/reinflate as well.  Add those calls, and enhance
11681         the gdb.python/pretty-print-call-by-hand.exp test to test that command.
11682
11683         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11684         Change-Id: I9edaae06d62e97ffdb30938d364437737238a960
11685
11686 2022-11-10  Simon Marchi  <simon.marchi@polymtl.ca>
11687
11688         gdb: clear other.m_cached_id in frame_info_ptr's move ctor
11689         We do it in the move assignment operator, so I think it makes sense to
11690         do it here too for consistency.  I don't think it's absolutely necessary
11691         to clear the other object's fields (in other words, copy constructor and
11692         move constructor could be the same), as there is no exclusive resource
11693         being transfered.  The important thing is to leave the moved-from object
11694         in an unknown, but valid state.  But still, I think that clearing the
11695         fields of the moved-from object is not a bad idea, it helps ensure we
11696         don't rely on the moved-from object after.
11697
11698         Change-Id: Iee900ff9d25dad51d62765d694f2e01524351340
11699         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11700
11701 2022-11-10  Bruno Larsen  <blarsen@redhat.com>
11702
11703         gdb/c++: Improve error messages in overload resolution
11704         When resolving overloaded functions, GDB relies on knowing relationships
11705         between types, i.e. if a type inherits from another. However, some
11706         compilers may not add complete information for given types as a way to
11707         reduce unnecessary debug information. In these cases, GDB would just say
11708         that it couldn't resolve the method or function, with no extra
11709         information.
11710
11711         The problem is that sometimes the user may not know that the type
11712         information is incomplete, and may just assume that there is a bug in
11713         GDB. To improve the user experience, we attempt to detect if the
11714         overload match failed because of an incomplete type, and warn the user
11715         of this.
11716
11717         This commit also adds a testcase confirming that the message is only
11718         triggered in the correct scenario. This test was not developed as an
11719         expansion of gdb.cp/overload.cc because it needed the dwarf assembler,
11720         and porting all of overload.cc seemed unnecessary.
11721
11722         Approved-By: Tom Tromey <tom@tromey.com>
11723
11724 2022-11-10  Bruno Larsen  <blarsen@redhat.com>
11725
11726         gdb/testsuite: allowed for function_range to deal with mangled functions
11727         When calling get_func_info inside a test case, it would cause failures
11728         if the function was printed using a C++ style mangled name. The current
11729         patch fixes this by allowing for mangled names along with the current
11730         rules.
11731
11732         Approved-By: Tom Tromey <tom@tromey.com>
11733
11734 2022-11-10  Clément Chigot  <chigot@adacore.com>
11735
11736         ld/testsuite: skip ld-size when -shared is not supported
11737         ld/ChangeLog:
11738
11739                 * testsuite/ld-size/size.exp: Skip when -shared is not
11740                 supported.
11741
11742 2022-11-10  Alan Modra  <amodra@gmail.com>
11743
11744         mach-o reloc size overflow
11745                 * mach-o.c (bfd_mach_o_canonicalize_reloc): Set bfd_error on
11746                 multiply overflow.
11747
11748 2022-11-10  Alan Modra  <amodra@gmail.com>
11749
11750         Sanity check reloc count in get_reloc_upper_bound
11751         The idea here is the stop tools from allocating up to 32G per section
11752         for the arelent pointer array, only to find a little later that the
11753         section reloc count was fuzzed.  This usually doesn't hurt much (on
11754         systems that allow malloc overcommit) except when compiled with asan.
11755
11756         We already do this for ELF targets, and while fixing the logic
11757         recently I decided other targets ought to do the same.
11758
11759                 * elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Sanity check
11760                 section reloc count against file size.
11761                 * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
11762                 * aoutx.h (get_reloc_upper_bound): Likewise, and don't duplicate
11763                 check done in bfd_get_reloc_upper_bound.
11764                 * pdp11.c (get_reloc_upper_bound): Likewise.
11765                 * coffgen.c (coff_get_reloc_upper_bound): Likewise.
11766
11767 2022-11-10  Lancelot SIX  <lancelot.six@amd.com>
11768
11769         gdb/testsuite: Fix rtld-step-nodebugsym.exp
11770         The test case introduced in bafcc335266 (Fix stepping in rtld without
11771         debug symbol) fails on some systems as reported by PR/29768.  This can
11772         be seen if the system does not have debug info for the libc:
11773
11774           (gdb) step^M
11775           Single stepping until exit from function main,^M
11776           which has no line number information.^M
11777           hello world[Inferior 1 (process 48203) exited normally]^M
11778           (gdb) PASS: gdb.base/rtld-step-nodebugsym.exp: step
11779           continue^M
11780           The program is not being run.^M
11781           (gdb) FAIL: gdb.base/rtld-step-nodebugsym.exp: continue until exit (the program is no longer running)
11782
11783         Without glibc debug info, GDB steps until the program finishes, and
11784         then "gdb_continue_to_end" fails.
11785
11786         As this test was designed to check that GDB does not crash in the "step"
11787         command, the continue does not carry real meaning to the test.
11788
11789         Replace it by "print 0" so we still check that after the step command
11790         GDB is still alive, which is what we care about.
11791
11792         Tested on Ubuntu-22.04 x86_64, with and without libc6-dbg.
11793
11794         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29768
11795         Approved-By: Simon Marchi <simon.marchi@efficios.com>
11796
11797 2022-11-10  Mike Frysinger  <vapier@gentoo.org>
11798
11799         sim: ppc: drop old makefile fragment
11800         Support for these files was dropped almost 30 years ago, but the ppc
11801         arch was missed.  Clean that up now too.
11802
11803         sim: ppc: drop support for dgen -L option
11804         Nothing passes this to dgen, and even if it did, nothing would happen
11805         because the generated spreg.[ch] files don't include any references
11806         back to the original data table.  So drop it to simplify.
11807
11808         sim: ppc: collapse is_readonly & length switch tables heavily
11809         Since we know we'll return 0 by default, we don't have to output case
11810         statements for readonly or length fields whose values are also zero.
11811         This is the most common case by far and thus generates a much smaller
11812         switch table in the end.
11813
11814 2022-11-10  Mike Frysinger  <vapier@gentoo.org>
11815
11816         sim: ppc: collapse is_valid switch table more
11817         Instead of writing:
11818           case 1:
11819             return 1;
11820           case 2:
11821             return 1;
11822           ...etc...
11823
11824         Output a single return so we get:
11825           case 1:
11826           case 2:
11827           case ...
11828             return 1;
11829
11830         This saves ~100 lines of code.  Hopefully the compiler was already
11831         smart enough to optimize to the same code, but if not, this probably
11832         helps there too :).
11833
11834 2022-11-10  Mike Frysinger  <vapier@gentoo.org>
11835
11836         sim: ppc: pull default switch return out
11837         This saves a single line for the same result.  By itself, it's not
11838         interesting, but we can further optimize the generated output and
11839         completely omit the switch table in some cases.  Which we'll do in
11840         follow up commits.
11841
11842         sim: ppc: constify spreg table
11843         This internal table is only ever read, so constify it.
11844
11845 2022-11-10  Mark Harmstone  <mark@harmstone.com>
11846
11847         ld: Add module information substream to PDB files
11848
11849 2022-11-10  Luis Machado  <luis.machado@arm.com>
11850
11851         [opcodes/arm] Fix potential null pointer dereferences
11852           PR tdep/29598
11853
11854           As pointed out in the bug ticket, we have a couple potential null pointer
11855           dereferencing situations. Harden those.
11856
11857           Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29598
11858
11859 2022-11-10  Luis Machado  <luis.machado@arm.com>
11860
11861         [gdb/aarch64] Use safer memory read routines
11862           PR tdep/28796
11863
11864           As reported, we are using some memory read routines that don't handle read
11865           errors gracefully. Convert those to use the safe_* versions if available.
11866
11867           This allows the code to handle those read errors in a more sensible way.
11868
11869           Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28796
11870
11871 2022-11-10  GDB Administrator  <gdbadmin@sourceware.org>
11872
11873         Automatic date update in version.in
11874
11875 2022-11-09  Lancelot SIX  <lancelot.six@amd.com>
11876
11877         Fix stepping in rtld without debug symbol
11878         Commit be6276e0aed "Allow debugging of runtime loader / dynamic linker"
11879         introduced a small regression when stepping into the runtime loader /
11880         dynamic linker from function we do not have debug information for.  This
11881         is reported in PR/29747.
11882
11883         This can be shown by the following example (given by Simon Marchi in
11884         buzilla bug report):
11885
11886             $ cat test.c
11887             #include <stdio.h>
11888
11889             int main()
11890             {
11891               printf("Hi\n");
11892               return 0;
11893             }
11894             $ gcc test.c -O0 -o test
11895             $ ./gdb -q -nx --data-directory=data-directory test -ex start -ex s
11896             Reading symbols from test...
11897             (No debugging symbols found in test)
11898             Temporary breakpoint 1 at 0x1151
11899             Starting program: .../binutils-gdb/gdb/test
11900             [Thread debugging using libthread_db enabled]
11901             Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
11902
11903             Temporary breakpoint 1, 0x0000555555555151 in main ()
11904             Single stepping until exit from function main,
11905             which has no line number information.
11906             /home/smarchi/src/binutils-gdb/gdb/infrun.c:6960:64: runtime error: member call on null pointer of type 'struct symbol'
11907
11908             The crash happens here:
11909
11910             #0  __sanitizer::Die () at ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:50
11911             #1  0x00007ffff5dd7128 in __ubsan::__ubsan_handle_type_mismatch_v1_abort (Data=<optimized out>, Pointer=<optimized out>) at ../../../../src/libsanitizer/ubsan/ubsan_handlers.cpp:148
11912             #2  0x000055556183e1a7 in process_event_stop_test (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:6960
11913             #3  0x0000555561838ea4 in handle_signal_stop (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:6615
11914             #4  0x000055556182f77b in handle_inferior_event (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:5866
11915
11916         When evaluating:
11917
11918             6956   if (execution_direction != EXEC_REVERSE
11919             6957       && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
11920             6958       && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
11921             6959       && !in_solib_dynsym_resolve_code (
11922             6961          ecs->event_thread->control.step_start_function->value_block ()
11923             6962              ->entry_pc ()))
11924
11925         we dereference, ecs->event_thread->control.step_start_function which is
11926         nullptr.
11927
11928         This patch changes this condition so it evaluates to true if
11929         ecs->event_thread->control.step_start_function is nullptr since this
11930         matches the behaviour before be6276e0aed.
11931
11932         Tested on ubuntu-22.04 x86_64.
11933
11934         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29747
11935         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
11936         Approved-By: Kevin Buettner <kevinb@redhat.com>
11937
11938 2022-11-09  Mike Frysinger  <vapier@gentoo.org>
11939
11940         sim: igen: add missing newline to various error messages
11941         The error() function expects a trailing newline in its message.
11942         Most callers do this already, so adding it to the few that don't.
11943
11944         sim: restore lstat & mkdir func checks
11945         When merging ppc configure checks into the top-level, these 2 funcs
11946         were accidentally dropped (probably due to incorrect resolution of
11947         conflicts).  Restore them since the ppc code utilizes them both.
11948
11949         sim: ppc: drop obsolete USE_WIN32API check
11950         This controls only one thing: how to call mkdir().  The gnulib code
11951         already has a mkdir module that provides this exact logic for us, so
11952         punt the code entirely.
11953
11954 2022-11-09  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
11955
11956         gdbserver: do not report btrace support if target does not announce it
11957         Gdbserver unconditionally reports support for btrace packets.  Do not
11958         report the support, if the underlying target does not say it supports
11959         it.  Otherwise GDB would query the server with btrace-related packets
11960         unnecessarily.
11961
11962 2022-11-09  Tom Tromey  <tromey@adacore.com>
11963
11964         Allow 'ptype/o' for assembly
11965         PR exp/28359 points out that 'ptype/o' does not work when the current
11966         language is "asm".
11967
11968         I tracked this down to a hard-coded list of languages in typeprint.c.
11969         This patch replaces this list with a method on 'language_defn'
11970         instead.  If all languages are ever updated to have this feature, the
11971         method could be removed; but in the meantime this lets each language
11972         control what happens.
11973
11974         I looked at having each print_type method simply modify the flags
11975         itself, but this doesn't work very well with the feature that disables
11976         method-printing by default (but allows it via a flag).
11977
11978         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28359
11979         Approved-By: Andrew Burgess <aburgess@redhat.com>
11980         Approved-By: Keith Seitz <keiths@redhat.com>
11981
11982 2022-11-09  Mike Frysinger  <vapier@gentoo.org>
11983
11984         sim: ppc: add missing parens with e500 macro
11985         This macro expansion was missing a set of outer-most parenthesis which
11986         some compilers would complain about depending on how the macro is used.
11987         This is just standard good macro hygiene too.
11988
11989         sim: ppc: drop useless linking of helper tools
11990         We've never run these helper programs directly.  The igen program
11991         includes the relevant source files directly and runs the code that
11992         way.  So stop wasting developer CPU time linking programs that are
11993         never run.  We leave the rules in place for people who need to test
11994         and debug the specific bits of code every now & then.
11995
11996 2022-11-09  Jan Beulich  <jbeulich@suse.com>
11997
11998         x86/Intel: don't accept malformed EXTRQ / INSERTQ
11999         Operand swapping was mistakenly suppressed when the first two operands
12000         were immediate ones, not taking into account overall operand count. This
12001         way EXTRQ / INSERTQ would have been accepted also with kind-of-AT&T
12002         operand order.
12003
12004         For the testcase being extended, in order to not move around "GAS
12005         LISTING" expectations, suppress pagination.
12006
12007 2022-11-09  Alan Modra  <amodra@gmail.com>
12008
12009         Re: Fuzzed files in archives
12010         Like commit ffbe89531c2e this avoids more silliness writing output
12011         that is going to be deleted.  bfd_close and bfd_close_all_done differ
12012         in that only the former calls _bfd_write_contents.
12013
12014                 * objcopy.c (copy_archive): Don't call bfd_close for elements
12015                 that are going to be deleted, call bfd_close_all_done instead.
12016                 Do the same for the archive itself.
12017
12018 2022-11-09  Christoph Müllner  <christoph.muellner@vrull.eu>
12019
12020         RISC-V: xtheadfmemidx: Use fp register in mnemonics
12021         Although the encoding for scalar and fp registers is identical,
12022         we should follow common pratice and use fp register names
12023         when referencing fp registers.
12024
12025         The xtheadmemidx extension consists of indirect load/store instructions
12026         which all load to or store from fp registers.
12027         Let's use fp register names in this case and adjust the test cases
12028         accordingly.
12029
12030         gas/
12031             * testsuite/gas/riscv/x-thead-fmemidx-fail.l: Updated since rd need to
12032             be float register.
12033             * testsuite/gas/riscv/x-thead-fmemidx-fail.s: Likewise.
12034             * testsuite/gas/riscv/x-thead-fmemidx.d: Likewise.
12035             * testsuite/gas/riscv/x-thead-fmemidx.s: Likewise.
12036         opcodes/
12037             * riscv-opc.c (riscv_opcodes): Updated since rd need to be float register.
12038
12039 2022-11-09  H.J. Lu  <hjl.tools@gmail.com>
12040
12041         ld: Always output local symbol for relocatable link
12042                 PR ld/29761
12043                 * elflink.c (elf_link_output_symstrtab): Don't skip local symbol
12044                 in SEC_EXCLUDE section for relocatable link.
12045
12046 2022-11-09  GDB Administrator  <gdbadmin@sourceware.org>
12047
12048         Automatic date update in version.in
12049
12050 2022-11-08  Simon Marchi  <simon.marchi@efficios.com>
12051
12052         gdb/linux-nat: get core count using /sys/devices/system/cpu/possible
12053         I get this test failure on my CI;
12054
12055           FAIL: gdb.base/info-os.exp: get process list
12056
12057         The particularity of this setup is that builds are done in containers
12058         who are allocated 4 CPUs on a machine that has 40.  The code in
12059         nat/linux-osdata.c fails to properly fetch the core number for each
12060         task.
12061
12062         linux_xfer_osdata_processes uses `sysconf (_SC_NPROCESSORS_ONLN)`, which
12063         returns 4, so it allocates an array of 4 integers.  However, the core
12064         numbers read from /proc/pid/task/tid/stat, by function
12065         linux_common_core_of_thread, returns a value anywhere between 0 and 39.
12066         The core numbers above 3 are therefore ignored, many processes end up
12067         with no core value, and the regexp in the test doesn't match (it
12068         requires an integer as the core field).
12069
12070         The way this the CPUs are exposed to the container is that the container
12071         sees 40 CPUs "present" and "possible", but only 4 arbitrary CPUs
12072         actually online:
12073
12074             root@ci-node-jammy-amd64-04-08:~# cat /sys/devices/system/cpu/present
12075             0-39
12076             root@ci-node-jammy-amd64-04-08:~# cat /sys/devices/system/cpu/online
12077             5,11,24,31
12078             root@ci-node-jammy-amd64-04-08:~# cat /sys/devices/system/cpu/possible
12079             0-39
12080
12081         The solution proposed in this patch is to find out the number of
12082         possible CPUs using /sys/devices/system/cpu/possible.  In practice, this
12083         will probably always contain `0-N`, where N is the number of CPUs, minus
12084         one.  But the documentation [1] doesn't such guarantee, so I'll assume
12085         that it can contain a more complex range list such as `2,4-31,32-63`,
12086         like the other files in that directory can have.  The solution is to
12087         iterate over these numbers to find the highest possible CPU id, and
12088         use that that value plus one as the size of the array to allocate.
12089
12090         [1] https://www.kernel.org/doc/Documentation/admin-guide/cputopology.rst
12091
12092         Change-Id: I7abce2e43b000c1327fa94cd7b99d46e49d7ccf3
12093
12094 2022-11-08  Simon Marchi  <simon.marchi@efficios.com>
12095
12096         gdbsupport, gdb: add read_text_file_to_string, use it in linux_common_core_of_thread
12097         I would like to add more code to nat/linux-osdata.c that reads an entire
12098         file from /proc or /sys and processes it as a string afterwards.  I
12099         would like to avoid duplicating the somewhat error-prone code that reads
12100         an entire file to a buffer.  I think we should have a utility function
12101         that does that.
12102
12103         Add read_file_to_string to gdbsupport/filestuff.{c,h}, and make
12104         linux_common_core_of_thread use it.  I want to make the new function
12105         return an std::string, and because strtok doesn't play well with
12106         std::string (it requires a `char *`, std::string::c_str returns a `const
12107         char *`), change linux_common_core_of_thread to use std::string methods
12108         instead.
12109
12110         Approved-By: Tom Tromey <tom@tromey.com>
12111         Change-Id: I1793fda72a82969c28b944a84acb953f74c9230a
12112
12113 2022-11-08  Peter Bergner  <bergner@linux.ibm.com>
12114
12115         PowerPC: Add XSP operand define
12116         opcodes/
12117                 * ppc-opc.c (XSP): New define.
12118                 (powerpc_opcodes) <stxvp, stxvpx, pstxvp>: Use it.
12119
12120 2022-11-08  Tom de Vries  <tdevries@suse.de>
12121
12122         [gdb/cli] Make quit really quit after remote connection closed
12123         Consider a hello world a.out, started using gdbserver:
12124         ...
12125         $ gdbserver --once 127.0.0.1:2345 ./a.out
12126         Process ./a.out created; pid = 15743
12127         Listening on port 2345
12128         ...
12129         that we can connect to using gdb:
12130         ...
12131         $ gdb -ex "target remote 127.0.0.1:2345"
12132         Remote debugging using 127.0.0.1:2345
12133         Reading /home/vries/a.out from remote target...
12134           ...
12135         0x00007ffff7dd4550 in _start () from target:/lib64/ld-linux-x86-64.so.2
12136         (gdb)
12137         ...
12138
12139         After that, we can for instance quit with confirmation:
12140         ...
12141         (gdb) quit
12142         A debugging session is active.
12143
12144                 Inferior 1 [process 16691] will be killed.
12145
12146         Quit anyway? (y or n) y
12147         $
12148         ...
12149
12150         Or, kill with confirmation and quit:
12151         ...
12152         (gdb) kill
12153         Kill the program being debugged? (y or n) y
12154         [Inferior 1 (process 16829) killed]
12155         (gdb) quit
12156         $
12157         ...
12158
12159         Or, monitor exit, kill with confirmation, and quit:
12160         ...
12161         (gdb) monitor exit
12162         (gdb) kill
12163         Kill the program being debugged? (y or n) y
12164         Remote connection closed
12165         (gdb) quit
12166         $
12167         ...
12168
12169         But when doing monitor exit followed by quit with confirmation, we get the gdb
12170         prompt back, requiring us to do quit once more:
12171         ...
12172         (gdb) monitor exit
12173         (gdb) quit
12174         A debugging session is active.
12175
12176                 Inferior 1 [process 16944] will be killed.
12177
12178         Quit anyway? (y or n) y
12179         Remote connection closed
12180         (gdb) quit
12181         $
12182         ...
12183
12184         So, the first quit didn't quit.  This happens as follows:
12185         - quit_command calls query_if_trace_running
12186         - a TARGET_CLOSE_ERROR is thrown
12187         - it's caught in remote_target::get_trace_status, but then
12188           rethrown because it's TARGET_CLOSE_ERROR
12189         - catch_command_errors catches the error, at which point the quit command
12190           has been aborted.
12191
12192         The TARGET_CLOSE_ERROR is defined as:
12193         ...
12194           /* Target throwing an error has been closed.  Current command should be
12195              aborted as the inferior state is no longer valid.  */
12196           TARGET_CLOSE_ERROR,
12197         ...
12198         so in a way this is expected behaviour.  But aborting quit because the inferior
12199         state (which we've already confirmed we're not interested in) is no longer
12200         valid, and having to type quit again seems pointless.
12201
12202         Furthermore, the purpose of not catching errors thrown by
12203         query_if_trace_running as per commit 2f9d54cfcef ("make -gdb-exit call
12204         disconnect_tracing too, and don't lose history if the target errors on
12205         "quit""), was to make sure that error (_("Not confirmed.") had effect.
12206
12207         Fix this in quit_command by catching only the TARGET_CLOSE_ERROR exception
12208         during query_if_trace_running and reporting it:
12209         ...
12210         (gdb) monitor exit
12211         (gdb) quit
12212         A debugging session is active.
12213
12214                 Inferior 1 [process 19219] will be killed.
12215
12216         Quit anyway? (y or n) y
12217         Remote connection closed
12218         $
12219         ...
12220
12221         Tested on x86_64-linux.
12222
12223         PR server/15746
12224         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=15746
12225         Approved-By: Tom Tromey <tom@tromey.com>
12226
12227 2022-11-08  Tom de Vries  <tdevries@suse.de>
12228
12229         [gdb/testsuite] Remove test-case from test name
12230         Remove test-cases from test-names, such that we don't have the redundant:
12231         ...
12232         PASS: gdb.base/corefile.exp: backtrace in corefile.exp
12233         ...
12234         but simply:
12235         ...
12236         PASS: gdb.base/corefile.exp: backtrace
12237         ...
12238
12239         Fixed all instances found using:
12240         ...
12241         $ grep ":.*:.*\.exp" gdb.sum
12242         ...
12243
12244         Tested on x86_64-linux.
12245
12246 2022-11-08  Tom de Vries  <tdevries@suse.de>
12247
12248         [gdb/testsuite] Fix find_core_file for core named core
12249         With test-case gdb.base/bigcore.exp I run into:
12250         ...
12251         (gdb) PASS: gdb.base/bigcore.exp: get inferior pid
12252         signal SIGABRT^M
12253         Continuing with signal SIGABRT.^M
12254         ^M
12255         Program terminated with signal SIGABRT, Aborted.^M
12256         The program no longer exists.^M
12257         (gdb) PASS: gdb.base/bigcore.exp: signal SIGABRT
12258         UNTESTED: gdb.base/bigcore.exp: can't generate a core file
12259         ...
12260         due to find_core_file returning "".
12261
12262         There is a core file name core:
12263         ...
12264         $ ls ./outputs/gdb.base/bigcore
12265         bigcore  bigcore.corefile  core  gdb.cmd.1  gdb.in.1  gdbserver.cmd.1
12266         ...
12267         but it's not found.
12268
12269         The problem is this statement:
12270         ...
12271             lappend files [list ${::testfile}.core core]
12272         ...
12273         which adds a single list item "${::testfile}.core core".
12274
12275         Fix this in the most readable way:
12276         ...
12277             lappend files ${::testfile}.core
12278             lappend files core
12279         ...
12280
12281         Tested on x86_64-linux.
12282
12283 2022-11-08  Mike Frysinger  <vapier@gentoo.org>
12284
12285         sim: mips: call Unpredictable instead of setting bogus values [PR sim/29276]
12286         The intention of this code seems to be to indicate that this insn
12287         should not be used and produces undefined behavior, so instead of
12288         setting registers to bogus values, call Unpredictable.  This fixes
12289         build warnings due to 32-bit/64-bit type conversions, and outputs
12290         a log message for users at runtime instead of silent corruption.
12291
12292         Bug: https://sourceware.org/PR29276
12293
12294 2022-11-08  Mike Frysinger  <vapier@gentoo.org>
12295
12296         sim: drop unused CORE_ADDR_TYPE
12297         This hasn't been used by gdb in decades, and doesn't make sense with
12298         a standalone sim program/library where the ABI is fixed.  So punt it
12299         to simplify the code.
12300
12301 2022-11-08  Haochen Jiang  <haochen.jiang@intel.com>
12302
12303         x86: Correct wrong comments in vex_w_table
12304         Hi all,
12305
12306         This wrong comment was introduced by previous AVX-VNNI-INT8 commit.
12307
12308         Committed as obvious fix.
12309
12310         BRs,
12311         Haochen
12312
12313         opcodes/ChangeLog:
12314
12315                 * i386-dis.c (VEX_W_0F3851): Corrected from
12316                 VEX_W_0F3851_P_0.
12317
12318 2022-11-08  Kong Lingling  <lingling.kong@intel.com>
12319
12320         Support Intel RAO-INT
12321         gas/ChangeLog:
12322
12323                 * NEWS: Support Intel RAO-INT.
12324                 * config/tc-i386.c: Add raoint.
12325                 * doc/c-i386.texi: Document .raoint.
12326                 * testsuite/gas/i386/i386.exp: Run RAO_INT tests.
12327                 * testsuite/gas/i386/raoint-intel.d: New test.
12328                 * testsuite/gas/i386/raoint.d: Ditto.
12329                 * testsuite/gas/i386/raoint.s: Ditto.
12330                 * testsuite/gas/i386/x86-64-raoint-intel.d: Ditto.
12331                 * testsuite/gas/i386/x86-64-raoint.d: Ditto.
12332                 * testsuite/gas/i386/x86-64-raoint.s: Ditto.
12333
12334         opcodes/ChangeLog:
12335
12336                 * i386-dis.c (PREFIX_0F38FC): New.
12337                 (prefix_table): Add PREFIX_0F38FC.
12338                 * i386-gen.c: (cpu_flag_init): Add CPU_RAO_INT_FLAGS and
12339                 CPU_ANY_RAO_INT_FLAGS.
12340                 * i386-init.h: Regenerated.
12341                 * i386-opc.h: (CpuRAO_INT): New.
12342                 (i386_cpu_flags): Add cpuraoint.
12343                 * i386-opc.tbl: Add RAO_INT instructions.
12344                 * i386-tbl.h: Regenerated.
12345
12346 2022-11-08  GDB Administrator  <gdbadmin@sourceware.org>
12347
12348         Automatic date update in version.in
12349
12350 2022-11-07  Tom Tromey  <tromey@adacore.com>
12351
12352         Silence libtool during link
12353         The switch to linking with libtool now shows a very long link line
12354         even when V=0.  This patch arranges to silence libtool in this
12355         situation.
12356
12357         Approved-By: Simon Marchi <simon.marchi@efficios.com>
12358
12359 2022-11-07  Simon Marchi  <simon.marchi@efficios.com>
12360
12361         gdb: make lookup_selected_frame static
12362         Change-Id: Ide2749a34333110c7f0112b25852c78cace0d2b4
12363
12364 2022-11-07  Mike Frysinger  <vapier@gentoo.org>
12365
12366         sim: riscv: add missing AC_MSG_RESULT call
12367         Previous commit in here forgot to include this.
12368
12369         sim: v850: drop subdir configure logic
12370         We've been using this only to set the default word size to 32.  We
12371         can easily move this into the makefile via a -D compiler flag and
12372         clean up the build logic quite a bit.
12373
12374         sim: mn10300: drop subdir configure logic
12375         We've been using this only to set the default word size to 32.  We
12376         can easily move this into the makefile via a -D compiler flag and
12377         clean up the build logic quite a bit.
12378
12379         sim: or1k: drop subdir configure logic
12380         We've been using this only to set the default word size to 32.  We
12381         can easily move this into the makefile via a -D compiler flag and
12382         clean up the build logic quite a bit.
12383
12384         sim: bpf: drop subdir configure logic
12385         We've been using this only to set the default word size to 64.  We
12386         can easily move this into the makefile via a -D compiler flag and
12387         clean up the build logic quite a bit.
12388
12389         sim: riscv: drop subdir configure logic
12390         We've been using this only to set the default word size to 32-vs-64
12391         based on the $target.  We can easily merge this with the top-level
12392         configure script to clean things up a bit.
12393
12394 2022-11-07  Jose E. Marchesi  <jose.marchesi@oracle.com>
12395
12396         gdb: link executables with libtool
12397         This patch changes the GDB build system in order to use libtool to
12398         link the several built executables.  This makes it possible to refer
12399         to libtool libraries (.la files) in CLIBS.
12400
12401         As an application of the above,
12402
12403           BFD              now refers to ../libbfd/libbfd.la
12404           OPCODES          now refers to ../opcodes/libopcodes.la
12405           LIBBACKTRACE_LIB now refers to ../libbacktrace/libbacktrace.la
12406           LIBCTF           now refers to ../libctf/libctf.la
12407
12408         NOTE1: The addition of libtool adds a few new configure-time options
12409                to GDB.  Among these, --enable-shared and --disable-shared, which were
12410                previously ignored.  Now GDB shall honor these options when linking,
12411                picking up the right version of the referred libtool libraries
12412                automagically.
12413
12414         NOTE2: I have not tested the insight build.
12415
12416         NOTE3: For regenerating configure I used an environment with Autoconf
12417                2.69 and Automake 1.15.1.  This should match the previously
12418                used version as announced in the configure script.
12419
12420         NOTE4: Now the installed shared objects libbfd.so, libopcodes.so and
12421                libctf.so are used by gdb if binutils is installed with
12422                --enable-shared.
12423
12424         Testing performed:
12425
12426         - --enable-shared and --disable-shared (the default in binutils) work
12427           as expected: the linked executables link with the archive or shared
12428           libraries transparently.
12429
12430         - Makefile.in modified for EXEEXT = .exe.  It installs the binaries
12431           just fine.  The installed gdb.exe runs fine.
12432
12433         - Native build regtested in x86_64. No regressions found.
12434
12435         - Cross build for aarch64-linux-gnu built to exercise
12436           program_transform_name and friends.  The installed
12437           aarch64-linux-gnu-gdb runs fine.
12438
12439         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29372
12440         Approved-By: Simon Marchi <simon.marchi@efficios.com>
12441
12442 2022-11-07  Simon Marchi  <simon.marchi@polymtl.ca>
12443
12444         gdb/testsuite: use a more unique name in gdb.mi/mi-breakpoint-multiple-locations.exp
12445         I see failures in this test, due to the function name "add" being too
12446         generic, and unexpected breakpoint locations being found in my
12447         libstdc++, such as (wrapped for readability):
12448
12449             {
12450                 number="2.4",enabled="y",addr="0x00007ffff7d67e68",
12451                 func="(anonymous namespace)::fast_float::bigint::add",
12452                 file="/usr/src/debug/gcc/libstdc++-v3/src/c++17/fast_float/fast_float.h",
12453                 fullname="/usr/src/debug/gcc/libstdc++-v3/src/c++17/fast_float/fast_float.h",
12454                 line="1815", thread-groups=["i1"]
12455             }
12456
12457         Change the test to use a more unique name.
12458
12459         Change-Id: I91de781be62d246eb41c73eaa410ebdd12633d1d
12460
12461 2022-11-07  Pedro Alves  <pedro@palves.net>
12462
12463         Don't explicitly set clone child ptrace options
12464         linux_handle_extended_wait calls target_post_attach if we're handling
12465         a PTRACE_EVENT_CLONE, and libthread_db.so isn't active.
12466         target_post_attach just calls linux_init_ptrace_procfs to set the
12467         lwp's ptrace options.  However, this is completely unnecessary,
12468         because, as man ptrace [1] says, options are inherited:
12469
12470           "Flags are inherited by new tracees created and "auto-attached" via
12471            active PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK, or PTRACE_O_TRACECLONE
12472            options."
12473
12474         This removes the unnecessary call.
12475
12476         [1] - https://man7.org/linux/man-pages/man2/ptrace.2.html
12477
12478         Approved-By: Simon Marchi <simon.marchi@efficios.com>
12479         Change-Id: I533eaa60b700f7e40760311fc0d344d0b3f19a78
12480
12481 2022-11-07  Mike Frysinger  <vapier@gentoo.org>
12482
12483         sim: .gdbinit: generate for all arch subdirs
12484         This was being skipped for ports that had a recursive configure,
12485         but we want it for them too.
12486
12487         sim: build: add a proper var for enabled arches
12488         The install code was using $SUBDIRS to track all enabled arches.  This
12489         works, but isn't great if we want to add a subdir that isn't an arch
12490         port, or as we merge the subdirs into the top-level.  Create a new var
12491         explicitly to track the list of enabled arches instead.
12492
12493 2022-11-07  Christophe Lyon  <christophe.lyon@arm.com>
12494
12495         configure: require libzstd >= 1.4.0
12496         gas uses ZSTD_compressStream2 which is only available with libzstd >=
12497         1.4.0, leading to build errors when an older version is installed.
12498
12499         This patch updates the check libzstd presence to check its version is
12500         >= 1.4.0. However, since gas seems to be the only component requiring
12501         such a recent version this may imply that we disable ZSTD support for
12502         all components although some would still benefit from an older
12503         version.
12504
12505         I ran 'autoreconf -f' in all directories containing a configure.ac
12506         file, using vanilla autoconf-2.69 and automake-1.15.1. I noticed
12507         several errors from autoheader in readline, as well as warnings in
12508         intl, but they are unrelated to this patch.
12509
12510         This should fix some of the buildbots.
12511
12512         OK for trunk?
12513
12514         Thanks,
12515
12516         Christophe
12517
12518 2022-11-07  Clément Chigot  <chigot@adacore.com>
12519
12520         ld/testsuite: skip tests related to -shared when disabled
12521         Call the helper function "check_shared_lib_support" to ensure -shared
12522         is enabled before launching ld-shared, ld-elfweak and ld-elfvers.
12523         This allows to catch custom targets explicitly disabling it.
12524
12525         ld/ChangeLog:
12526
12527                 * testsuite/ld-elfvers/vers.exp: Call check_shared_lib_support.
12528                 * testsuite/ld-elfweak/elfweak.exp: Likewise.
12529                 * testsuite/ld-shared/shared.exp: Likewise.
12530
12531 2022-11-07  Tsukasa OI  <research_trasio@irq.a4lg.com>
12532
12533         RISC-V: Remove RV32EF conflict
12534         Despite that the RISC-V ISA Manual version 2.2 prohibited "RV32EF", later
12535         versions beginning with the version 20190608-Base-Ratified removed this
12536         restriction.  Because the 'E' extension is still a draft, the author chose
12537         to *just* remove the conflict (not checking the ISA version).
12538
12539         Note that, because RV32E is only used with a soft-float calling convention,
12540         there's no valid official ABI for RV32EF.  It means, even if we can assemble
12541         a program with -march=rv32ef -mabi=ilp32e, floating-point registers are kept
12542         in an unmanaged state (outside ABI management).
12543
12544         The purpose of this commit is to suppress unnecessary errors while parsing
12545         an ISA string and/or disassembling, not to allow hard-float with RVE.
12546
12547         bfd/ChangeLog:
12548
12549                 * elfxx-riscv.c (riscv_parse_check_conflicts): Accept RV32EF
12550                 because only older specifications disallowed it.
12551
12552         gas/ChangeLog:
12553
12554                 * testsuite/gas/riscv/march-fail-rv32ef.d: Remove as not directly
12555                 prohibited.
12556                 * testsuite/gas/riscv/march-fail-rv32ef.l: Likewise.
12557
12558 2022-11-07  GDB Administrator  <gdbadmin@sourceware.org>
12559
12560         Automatic date update in version.in
12561
12562 2022-11-06  Mike Frysinger  <vapier@gentoo.org>
12563
12564         sim: build: respect AM_MAKEFLAGS when entering subdirs
12565         This doesn't matter right now, but it will as we add more flags to
12566         the recursive make step to pass state down.
12567
12568         sim: build: stop passing down SIM_PRIMARY_TARGET
12569         This was needed when the install step was run in subdirs, but now
12570         that we process that entirely in the top-level, we don't need to
12571         pass this down, so drop it.
12572
12573 2022-11-06  GDB Administrator  <gdbadmin@sourceware.org>
12574
12575         Automatic date update in version.in
12576
12577 2022-11-05  Tom Tromey  <tom@tromey.com>
12578
12579         Deprecate MI version 1
12580         MI version 1 is long since obsolete.  Rather than remove it
12581         immediately (though I did send a patch for that), instead let's
12582         deprecate it in GDB 13 and then remove it for GDB 14.
12583
12584         This version of the patch incorporates Simon's warning change, and
12585         Luis' recommendation to mention the gdb versions here.
12586
12587 2022-11-05  Mike Frysinger  <vapier@gentoo.org>
12588
12589         sim: fix readline linkage
12590         Now that we link programs in the top dir instead of the arch subdir,
12591         update the readline library path to be relative to the top dir.
12592
12593         sim: use libtool to install programs
12594         Now that we use libtool to link, we have to use it to install instead
12595         of keeping the manual logic so we don't install wrapper shell scripts.
12596
12597         sim: bfin: move linux-fixed-code.h to top-level
12598
12599 2022-11-05  Mike Frysinger  <vapier@gentoo.org>
12600
12601         sim: run: move linking into top-level
12602         Automake will run each subdir individually before moving on to the next
12603         one.  This means that the linking phase, a single threaded process, will
12604         not run in parallel with anything else.  When we have to link ~32 ports,
12605         that's 32 link steps that don't take advantage of parallel systems.  On
12606         my really old 4-core system, this cuts a multi-target build from ~60 sec
12607         to ~30 sec.  We eventually want to move all compile+link steps to this
12608         common dir anyways, so might as well move linking now for a nice speedup.
12609
12610         We use noinst_PROGRAMS instead of bin_PROGRAMS because we're taking care
12611         of the install ourselves rather than letting automake process it.
12612
12613 2022-11-05  Mike Frysinger  <vapier@gentoo.org>
12614
12615         sim: build: add uninstall support
12616         This never worked before, but adding it to the common top-level dir
12617         is pretty easy to do now that we're unified.
12618
12619         sim: build: move install steps to the top-level
12620         We still have to maintain custom install rules due to how we rename
12621         arch-specific files with an arch prefix in their name, but we can at
12622         least unify the logic in the common dir.
12623
12624         sim: cris: move rvdummy linking to top-level
12625         This is only used by `make check`, so we can move it out of the
12626         default build too.
12627
12628         sim: build: add SIM_HW_CFLAGS to top-level build too
12629         This matches what we do with targets already.
12630
12631         sim: drop unused SIM_HARDWARE variable
12632         This hasn't been used since the refactor way back in commit
12633         f872d0d643968c1101bb8c07b252edd54f626da2 ("Only enable H/W
12634         on some mips targets."), so punt it.
12635
12636         sim: adjust sim_hw options style
12637         We use uppercase for other variables, and are already turning it to
12638         uppercase in the arch-subdir.mk, so convert it in the configure step.
12639
12640         sim: ppc: drop unused /dev/zero logic
12641         Nothing in the tree checks this option, or has checked for decades.
12642         The pre-cvs-import ChangeLog suggests this was added & removed back
12643         then, but can't be sure as that history doesn't exist in the VCS.
12644
12645         sim: ppc: delete unused host bitsize settings
12646         Nothing checks this define anywhere, so drop all the logic.  We don't
12647         want this to be a configure option in the first place as all such usage
12648         should be automatic & following proper types.
12649
12650         sim: ppc: inline the sim-packages option
12651         This has only ever had a single option that's enabled by default.
12652         The objects it adds are pretty small and don't add overhead at
12653         runtime if it isn't used, so just enable it all the time to make
12654         the build code simpler.
12655
12656 2022-11-05  GDB Administrator  <gdbadmin@sourceware.org>
12657
12658         Automatic date update in version.in
12659
12660 2022-11-04  H.J. Lu  <hjl.tools@gmail.com>
12661
12662         binutils: Run PR binutils/26160 test
12663         Update expected PR binutils/26160 test output for readelf out change
12664         and run PR binutils/26160 test.
12665
12666                 PR binutils/26160
12667                 * testsuite/binutils-all/pr26160.r: Updated.
12668                 * testsuite/binutils-all/readelf.exp: Run PR binutils/26160 test.
12669
12670 2022-11-04  Lancelot SIX  <lancelot.six@amd.com>
12671
12672         [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach
12673         One test name in gdb.base/dlmopen.exp changes from run to run
12674         since it includes a process id:
12675
12676             PASS: gdb.base/dlmopen.exp: attach 3442682
12677
12678         This is not convenient do diff gdb.sum files to compare test runs.
12679
12680         Fix by using gdb_attach helper function to handle attaching to the
12681         process as it produce a constant test name.
12682
12683         While at it also check gdb_attach's return value to only run the
12684         rest of the test if the attach was successful.
12685
12686         Approved-By: Simon Marchi <simon.marchi@efficios.com>
12687
12688 2022-11-04  Carl Love  <cel@us.ibm.com>
12689
12690         PowerPC update comments for the MMA instruction name changes.
12691         The mnemonics for the pmxvf16ger*, pmxvf32ger*,pmxvf64ger*, pmxvi4ger8*,
12692         pmxvi8ger4*, and pmxvi16ger2* instructions were officially changed to
12693         pmdmxbf16ger*, pmdmxvf32ger*, pmdmxvf64ger*, pmdmxvi4ger8*, pmdmxvi8ger4*,
12694         pmdmxvi16ger* respectively.  The old mnemonics are still supported by the
12695         assembler as extended mnemonics.  The disassembler generates the new
12696         mnemonics.  The name changes occurred in commit:
12697
12698           commit bb98553cad4e017f1851153fa5de91f2cee98fb2
12699           Author: Peter Bergner <bergner@linux.ibm.com>
12700           Date:   Sat Oct 8 16:19:51 2022 -0500
12701
12702             PowerPC: Add support for RFC02658 - MMA+ Outer-Product Instructions
12703
12704             gas/
12705                     * config/tc-ppc.c (md_assemble): Only check for prefix opcodes.
12706                     * testsuite/gas/ppc/rfc02658.s: New test.
12707                     * testsuite/gas/ppc/rfc02658.d: Likewise.
12708                     * testsuite/gas/ppc/ppc.exp: Run it.
12709
12710             opcodes/
12711                     * ppc-opc.c (XMSK8, P_GERX4_MASK, P_GERX2_MASK, XX3GERX_MASK): New.
12712                     (powerpc_opcodes): Add dmxvi8gerx4pp, dmxvi8gerx4, dmxvf16gerx2pp,
12713                     dmxvf16gerx2, dmxvbf16gerx2pp, dmxvf16gerx2np, dmxvbf16gerx2,
12714                     dmxvi8gerx4spp, dmxvbf16gerx2np, dmxvf16gerx2pn, dmxvbf16gerx2pn,
12715                     dmxvf16gerx2nn, dmxvbf16gerx2nn, pmdmxvi8gerx4pp, pmdmxvi8gerx4,
12716                     pmdmxvf16gerx2pp, pmdmxvf16gerx2, pmdmxvbf16gerx2pp, pmdmxvf16gerx2np,
12717                     pmdmxvbf16gerx2, pmdmxvi8gerx4spp, pmdmxvbf16gerx2np, pmdmxvf16gerx2pn,
12718                     pmdmxvbf16gerx2pn, pmdmxvf16gerx2nn, pmdmxvbf16gerx2nn.
12719
12720         This patch updates the comments in the various gdb files to reflect the
12721         name changes.  There are no functional changes made by this patch.
12722
12723         The older instruction names are still used in the test
12724         gdb.reverse/ppc_record_test_isa_3_1.exp for backwards compatibility.
12725
12726         Patch has been tested on Power 10 with no regressions.
12727
12728 2022-11-04  Carl Love  <cel@us.ibm.com>
12729
12730         PowerPC fix for the gdb.arch/powerpc-power10.exp test.
12731         The mnemonics for the pmxvf16ger*, pmxvf32ger*,pmxvf64ger*, pmxvi4ger8*,
12732         pmxvi8ger4*, pmxvi16ger2* instructions were officially changed to
12733         pmdmxvf16ger*, pmdmxvf32ger*, pmdmxvf64ger*, pmdmxvi4ger8*, pmdmxvi8ger4*,
12734         pmdmxvi16ger* respectively.  The old mnemonics are still supported by the
12735         assembler as extended mnemonics.  The disassembler generates the new
12736         mnemonics.  The name changes occurred in commit:
12737
12738           commit bb98553cad4e017f1851153fa5de91f2cee98fb2
12739           Author: Peter Bergner <bergner@linux.ibm.com>
12740           Date:   Sat Oct 8 16:19:51 2022 -0500
12741
12742             PowerPC: Add support for RFC02658 - MMA+ Outer-Product Instructions
12743
12744             gas/
12745                     * config/tc-ppc.c (md_assemble): Only check for prefix opcodes.
12746                     * testsuite/gas/ppc/rfc02658.s: New test.
12747                     * testsuite/gas/ppc/rfc02658.d: Likewise.
12748                     * testsuite/gas/ppc/ppc.exp: Run it.
12749
12750             opcodes/
12751                     * ppc-opc.c (XMSK8, P_GERX4_MASK, P_GERX2_MASK, XX3GERX_MASK): New.
12752                     (powerpc_opcodes): Add dmxvi8gerx4pp, dmxvi8gerx4, dmxvf16gerx2pp,
12753                     dmxvf16gerx2, dmxvbf16gerx2pp, dmxvf16gerx2np, dmxvbf16gerx2,
12754                     dmxvi8gerx4spp, dmxvbf16gerx2np, dmxvf16gerx2pn, dmxvbf16gerx2pn,
12755                     dmxvf16gerx2nn, dmxvbf16gerx2nn, pmdmxvi8gerx4pp, pmdmxvi8gerx4,
12756                     pmdmxvf16gerx2pp, pmdmxvf16gerx2, pmdmxvbf16gerx2pp, pmdmxvf16gerx2np,
12757                     pmdmxvbf16gerx2, pmdmxvi8gerx4spp, pmdmxvbf16gerx2np, pmdmxvf16gerx2pn,
12758                     pmdmxvbf16gerx2pn, pmdmxvf16gerx2nn, pmdmxvbf16gerx2nn.
12759
12760         The above commit results in about 224 failures on Power 10 since the
12761         disassembled names do not match the expected names in the test.  This
12762         patch updates the expected names in the test to match the values produced
12763         by the disassembler.
12764
12765         This patch updates file gdb.arch/powerpc-power10.exp with the new expected
12766         values to the instructions.  The comment giving the name of the instruction
12767         for each binary value in the file gdb.arch/powerpc-power10.c is updated
12768         with the new name.   There are no functional changes in file
12769         gdb.arch/powerpc-power10.c.
12770
12771 2022-11-04  Carl Love  <cel@us.ibm.com>
12772
12773         Powerpc fix for gdb.base/unwind-on-each-insn.exp
12774         The test disassembles function foo and searches for the line
12775         "End of assembler dump" to determing the last address in the function.  The
12776         assumption is the last instruction will be given right before the line
12777         "End of assembler dump".  This assumption fails on PowerPC.
12778
12779         The PowerPC disassembly of the function foo looks like:
12780          Dump of assembler code for function foo:
12781         #  => 0x00000000100006dc <+0>:     std     r31,-8(r1)
12782         #     0x00000000100006e0 <+4>:     stdu    r1,-48(r1)
12783         #     0x00000000100006e4 <+8>:     mr      r31,r1
12784         #     0x00000000100006e8 <+12>:    nop
12785         #     0x00000000100006ec <+16>:    addi    r1,r31,48
12786         #     0x00000000100006f0 <+20>:    ld      r31,-8(r1)
12787         #     0x00000000100006f4 <+24>:    blr
12788         #     0x00000000100006f8 <+28>:    .long 0x0
12789         #     0x00000000100006fc <+32>:    .long 0x0
12790         #     0x0000000010000700 <+36>:    .long 0x1000180
12791         #     End of assembler dump.
12792
12793         The blr instruction is the last instruction in function foo.  The lines
12794         with .long following the blr instruction need to be ignored.
12795
12796         This patch adds a new condition to the gdb_test_multiple "disassemble foo"
12797         test to ignore the lines with the .long.
12798
12799         The patch has been tested on PowerPC and Intel X86-64.
12800
12801 2022-11-04  Jan Beulich  <jbeulich@suse.com>
12802
12803         x86: adjust recently introduced testcases
12804         The issue addressed by 2c02c72c62d2 ("re: Support Intel AMX-FP16") has
12805         been introduced once again in a number of new tests.
12806
12807 2022-11-04  Nick Clifton  <nickc@redhat.com>
12808
12809         Update release documentation with regard to uploading gprofng docs
12810
12811 2022-11-04  Bruno Larsen  <blarsen@redhat.com>
12812
12813         gdb/testsuite: add KFAILs to gdb.reverse/step-reverse.exp
12814         Recent changes to gdb.reverse/step-reverse.exp revealed the latent bug
12815         PR record/29745, where we can't skip one funcion forward if we're using
12816         native-gdbserver. This commit just adds kfails to the test.
12817
12818         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29745
12819         Approved-By: Simon Marchi <simon.marchi@efficios.com>
12820
12821 2022-11-04  Andrew Burgess  <aburgess@redhat.com>
12822
12823         opcodes/arm: silence compiler warning about uninitialized variable use
12824         After this commit:
12825
12826           commit 6576bffe6cbbb53c5756b2fccd2593ba69b74cdf
12827           Date:   Thu Jul 7 13:43:45 2022 +0100
12828
12829               opcodes/arm: add disassembler styling for arm
12830
12831         Some people were seeing their builds failing with complaints about a
12832         possible uninitialized variable usage.  I previously fixed an instance
12833         of this issue in this commit:
12834
12835           commit 2df82cd4b459fbc32120e0ad1ce19e26349506fe
12836           Date:   Tue Nov 1 10:36:59 2022 +0000
12837
12838               opcodes/arm: silence compiler warning about uninitialized variable use
12839
12840         which did fix the build problems that the sourceware buildbot was
12841         hitting, however, an additional instance of the same problem was
12842         brought to my attention, and that is fixed in this commit.
12843
12844         Where commit 2df82cd4b4 fixed the uninitialized variable problem in
12845         print_mve_unpredictable, this commit fixes the same problem in
12846         print_mve_undefined.
12847
12848         As with the previous commit, I don't believe we could really ever get
12849         an uninitialized variable usage, based on the current usage of the
12850         function, so I have just initialized the reason variable to "??".
12851
12852 2022-11-04  Mike Frysinger  <vapier@gentoo.org>
12853
12854         sim: rx: drop unused $arch setting
12855         This is only needed for CGEN ports which RX isn't, so drop it.
12856
12857 2022-11-04  Mike Frysinger  <vapier@gentoo.org>
12858
12859         sim: build: remove various obsolete generation dep variables
12860         These manual settings were necessary when we weren't doing automatic
12861         header dependency tracking.  That was changed a while ago, and we use
12862         automake now to do it all for us.  As a result, many of these vars
12863         aren't even referenced anymore.
12864
12865         Further, some of the source file generation (e.g. .c files, or igen,
12866         or cgen outputs) were moved to the common automake build, and it takes
12867         care of dependency tracking for us with the object files.
12868
12869 2022-11-04  Mike Frysinger  <vapier@gentoo.org>
12870
12871         sim: don't hardcode -ldl for SDL support
12872         Since we use AC_SEARCH_LIBS to find dlopen, we don't need to hardcode
12873         -ldl when using SDL ourselves.
12874
12875 2022-11-04  konglin1  <lingling.kong@intel.com>
12876
12877         Support Intel AVX-NE-CONVERT
12878         gas/ChangeLog:
12879
12880                 * NEWS: Support Intel AVX-NE-CONVERT.
12881                 * config/tc-i386.c: Add avx_ne_convert.
12882                 * doc/c-i386.texi: Document .avx_ne_convert.
12883                 * testsuite/gas/i386/i386.exp: Run AVX NE CONVERT tests.
12884                 * testsuite/gas/i386/avx-ne-convert-intel.d: New test.
12885                 * testsuite/gas/i386/avx-ne-convert.d: Ditto.
12886                 * testsuite/gas/i386/avx-ne-convert.s: Ditto.
12887                 * testsuite/gas/i386/x86-64-avx-ne-convert-intel.d: Ditto.
12888                 * testsuite/gas/i386/x86-64-avx-ne-convert.d: Ditto.
12889                 * testsuite/gas/i386/x86-64-avx-ne-convert.s: Ditto.
12890
12891         opcodes/ChangeLog:
12892
12893                 * i386-dis.c (Mw): New.
12894                 (PREFIX_VEX_0F3872): Ditto.
12895                 (PREFIX_VEX_0F38B0_W_0): Ditto.
12896                 (PREFIX_VEX_0F38B1_W_0): Ditto.
12897                 (VEX_W_0F3872_P_1): Ditto.
12898                 (VEX_W_0F38B0): Ditto.
12899                 (VEX_W_0F38B1): Ditto.
12900                 (prefix_table): Add PREFIX_VEX_0F3872, PREFIX_VEX_0F38B0_W_0,
12901                 PREFIX_VEX_0F38B1_W_0.
12902                 (vex_w_table): Add VEX_W_0F3872_P_1, VEX_W_0F38B0, VEX_W_0F38B1.
12903                 * i386-gen.c (cpu_flag_init): Add CPU_AVX_NE_CONVERT_FLGAS and
12904                 CPU_ANY_AVX_NE_CONVERT_FLAGS.
12905                 (cpu_flags): Add CpuAVX_NE_CONVERT.
12906                 * i386-init.h: Regenerated.
12907                 * i386-opc.h (CpuAVX_NE CONVERT): New.
12908                 (i386_cpu_flags): Add cpuavx_ne_convert.
12909                 * i386-opc.tbl: Add Intel AVX-NE-CONVERT instructions.
12910                 * i386-tbl.h: Regenerated.
12911
12912 2022-11-04  konglin1  <lingling.kong@intel.com>
12913
12914         i386: Rename <xy> template.
12915         opcodes/
12916                     * i386-opc.tbl: Rename <xy> template for VEX insn with x/y suffix to <Vxy>.
12917                     Rename <xy> for EVEX insn with x/y suffix to <Exy>.
12918
12919 2022-11-04  Jojo R  <rjiejie@linux.alibaba.com>
12920
12921         Support multiple .eh_frame sections
12922                 This patch is based on MULTIPLE_FRAME_SECTIONS and EH_FRAME_LINKONCE,
12923                 it allows backend to enable this feature and use '--gc-sections' simply.
12924
12925                 * gas/dw2gencfi.h (TARGET_MULTIPLE_EH_FRAME_SECTIONS): New.
12926                 (MULTIPLE_FRAME_SECTIONS): Add TARGET_MULTIPLE_EH_FRAME_SECTIONS.
12927                 * gas/dw2gencfi.c (EH_FRAME_LINKONCE): Add TARGET_MULTIPLE_EH_FRAME_SECTIONS.
12928                 (is_now_linkonce_segment): Likewise.
12929                 (get_cfi_seg): Create relocation info between .eh_frame.* and .text.* section.
12930
12931                 * bfd/elf-bfd.h (elf_backend_can_make_multiple_eh_frame): New.
12932                 * bfd/elfxx-target.h (elf_backend_can_make_multiple_eh_frame): Likewise.
12933                 * bfd/elflink.c (_bfd_elf_default_action_discarded): Add checking for
12934                 elf_backend_can_make_multiple_eh_frame.
12935
12936 2022-11-04  Jojo R  <rjiejie@linux.alibaba.com>
12937
12938         gas/doc/internals.texi: fix typo
12939                 * gas/doc/internals.texi (md_emit_single_noop_insn):
12940                 fix '@var missing closing brace'
12941                 * gas/doc/internals.texi (Hash tables):
12942                 fix '@menu reference to nonexistent node `Hash tables''
12943
12944 2022-11-04  Mike Frysinger  <vapier@gentoo.org>
12945
12946         sim: drop -lm from SIM_EXTRA_LIBS
12947         We have configure tests for this in the top-level configure script
12948         to link this when necessary, so we don't need to explicitly list it
12949         for specific ports.
12950
12951         sim: build: change AC_CHECK_LIB to AC_SEARCH_LIBS
12952         With more C libraries moving functions entirely into the main -lc,
12953         change the AC_CHECK_LIB calls to AC_SEARCH_LIBS so we look in there
12954         first and avoid extra linkage when possible.
12955
12956         sim: build: drop duplicate $(LIBS) usage
12957         COMMON_LIBS is set to $(LIBS), and CONFIG_LIBS is set to that plus
12958         @LIBS@.  This leds to the values being used twice.  Inline the
12959         CONFIG_LIBS variable without @LIBS@ since it's used only once.
12960
12961         sim: build: switch to bfd & opcodes libtool linker scripts
12962         Now that we use libtool to link, we don't need to duplicate all the
12963         libs that bfd itself uses.  This simplifies the configure & Makefile.
12964
12965         sim: build: switch to libtool for linking
12966         The top-level already sets up a libtool script for the host, so use
12967         that when linking rather than invoking CC directly.  This will also
12968         happen when we (someday) move the building to pure automake.
12969
12970 2022-11-04  GDB Administrator  <gdbadmin@sourceware.org>
12971
12972         Automatic date update in version.in
12973
12974 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
12975
12976         sim: testsuite: fix cris stat3 in diff setups
12977         This test uses the test itself as an input to stating regular files.
12978         This gets funky though: when we run check in parallel, the output
12979         object dir is the subdir that matches the .exp file.  When we run
12980         with -j1, the output object dir is the sim builddir itself.
12981
12982         The old test would append argv[0] to find the file, while the new
12983         test uses basename on it.  Each method works in only one of the
12984         aforementioned build scenarios.  Rather than complicate this any
12985         more, switch to a different file that we know will always exist:
12986         the Makefile.
12987
12988 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
12989
12990         sim: testsuite: fix cris badarch in multi-target builds
12991         This test assumes that /bin/sh will never be a CRIS ELF by way of
12992         assuming that the current bfd cannot load it (since a basic cris
12993         cross-compiler only understands CRIS ELFs).  In a multi-target
12994         build though, bfd understands just about every ELF out there, so
12995         we're able to read the /bin/sh format before failing at a diff
12996         point in the cris code.
12997
12998         Let's switch to using / instead since it'll fail for a similar
12999         reason (at least similar enough for what this test is testing).
13000
13001 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
13002
13003         sim: cleanup unused SIM_EXTRA_CFLAGS
13004         We want to eventually delete this, so at least drop the empty ones.
13005
13006         sim: m32c/rx: drop useless $(ENDLIST)
13007         This is used to allow for dangling \ in object lists, but these are the
13008         only ports that do it, and it isn't really necessary.  Punt it to keep
13009         the various makefiles harmonized.
13010
13011         sim: mips: simplify fpu configure logic
13012         The configure code always defaults to HARD_FLOATING_POINT, so inline
13013         that value and drop redundant target checks as a result.
13014
13015 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
13016
13017         sim: erc32: link sis to run program
13018         The erc32 sim does a lot itself, including handling of the CLI.  It
13019         used to provide a run-compatible interface in the pre-nrun days, but
13020         it was dropped when the old run interface was punted.  Since the old
13021         commit 465fb143c87076b6416a8d0d5dd79bb016060fe3 ("sim: make nrun the
13022         default run program"), the erc32 run & sis programs have been the
13023         same, and erc32 hasn't provide a real run-compatible interface.
13024
13025         Simplify this by linking the two programs via ln/cp instead of running
13026         the linking phase twice to produce the same result.  If/when we fix up
13027         the erc32 port to have a proper run interface, it should be easy to
13028         split these back apart into real programs.
13029
13030         Note: the interf.o reference in here is a bit of a misdirect.  Since
13031         that object is placed into libsim.a, it's never been linked into the
13032         programs since the linker ignores objects that aren't referenced, and
13033         only gdb uses those symbols.
13034
13035 2022-11-03  Nick Clifton  <nickc@redhat.com>
13036
13037         V850 Linker: do not complain about RWX segments.
13038                 PR 29748
13039                 * configure.tgt (ac_default_ld_warn_rwx_segments): Set to 0 for
13040                 the V850.
13041
13042 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
13043
13044         sim: v850: switch to standard (high-level) trace defines
13045         The v850 port uses -DDEBUG to control whether to enable internal tracing.
13046         We already have such options via the common trace framework, and those
13047         can be controlled at build time via configure flags (which the v850 code
13048         currently cannot).  So switch it over to WITH_TRACE_ANY_P to simplify the
13049         v850 build code even if it doesn't (yet) respect any other trace options.
13050
13051         sim: ppc: include copyright & license in --version
13052         This makes it match the other sim run programs and GNU tools.
13053
13054         sim: update --version copyright year
13055         Probably should have done this 11 months ago ...
13056
13057         sim: ppc: drop use of DATE & TIME
13058         No other tool does this, sim or otherwise, and it makes the ppc build
13059         non-reproducible.  Drop it to simplify & make reproducible.
13060
13061 2022-11-03  Bruno Larsen  <blarsen@redhat.com>
13062
13063         gdb: Fix issue with Clang CLI macros
13064         Clang up to version 15 (current) adds macros that were defined in the
13065         command line or by "other means", according to the Dwarf specification,
13066         after the last DW_MACRO_end_file, instead of before the first
13067         DW_MACRO_start_file, as the specification dictates.  When GDB reads the
13068         macros after the last file is closed, the macros never end up "in scope"
13069         and so we can't print them.  This has been submitted as a bug to Clang
13070         developers (https://github.com/llvm/llvm-project/issues/54506), and PR
13071         macros/29034 was opened for GDB to keep track of this.
13072
13073         Seeing as there is no expected date for it to be fixed, add a workaround
13074         for all current versions of Clang.  The workaround detects when
13075         the main file would be closed and if the producer is Clang, and turns
13076         that operation into a noop, so we keep a reference to the current_file
13077         as those macros are read.
13078
13079         A test case was added to confirm the functionality, and the KFAIL for
13080         running gdb.base/macro-source-path when using clang.
13081
13082         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29034
13083         Approved-By: Simon Marchi <simon.marchi@efficios.com>
13084
13085 2022-11-03  Nick Clifton  <nickc@redhat.com>
13086
13087         AVR Linker: Allow the start of the data region to be specified on the linker command line.  [Fix PR number in ChangeLog entry]
13088                 PR 29741
13089                 * scripttempl/avr.sc (__DATA_REGION_ORIGIN__): Define.  If a value
13090                 has not been provided on the command line then use DATA_ORIGIN.
13091                 (MEMORY): Use __DATA_REGION_ORIGIN__ as the start of the data region.
13092
13093         AVR Linker: Allow the start of the data region to specified on the command line.
13094                 PR 29471
13095                 * scripttempl/avr.sc (__DATA_REGION_ORIGIN__): Define.  If a value
13096                 has not been provided on the command line then use DATA_ORIGIN.
13097                 (MEMORY): Use __DATA_REGION_ORIGIN__ as the start of the data region.
13098
13099 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
13100
13101         sim: move common flags to default AM_CPPFLAGS
13102         Since all host files we compile use these settings, move them out of
13103         libcommon.a and into the default AM_CPPFLAGS.  This has the effect of
13104         dropping the custom per-target automake rules.  Currently it saves us
13105         ~150 lines, but since it's about ~8 lines per object, the overhead
13106         will increase quite a bit as we merge more files into a single build.
13107
13108         This also changes the object output names, so we have to tweak the
13109         rules that were pulling in the common objects when linking.
13110
13111 2022-11-03  Mike Frysinger  <vapier@gentoo.org>
13112
13113         sim: merge gnulib logic into the top-level
13114         We aren't using this just yet, but we will, so make it available to
13115         building of common sim files.
13116
13117         sim: common: remove unused include paths
13118         A bunch of these paths don't include any headers, and most likely
13119         never will, so there's no real need to keep them.  This will let
13120         us harmonize paths with the top-level Makefile more easily, which
13121         will in turn make it easier to move more compile steps there.
13122
13123 2022-11-03  GDB Administrator  <gdbadmin@sourceware.org>
13124
13125         Automatic date update in version.in
13126
13127 2022-11-02  Christophe Lyon  <christophe.lyon@arm.com>
13128
13129         arm: PR 29739 Fix typo where ';' should not have been replaced with '@'
13130         ';' does not always indicate the start of a comment, and commit
13131         8cb6e17571f3fb66ccd4fa19f881602542cd06fc incorrectly replaced 3
13132         instances of ';' with '@' in expected diagnostics, leading to tests
13133         failures.
13134
13135         This patch restores the original ';' as needed in these testcases.
13136
13137         Fixes bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29739
13138
13139 2022-11-02  Mike Frysinger  <vapier@gentoo.org>
13140
13141         sim: split CPPFLAGS between build & host
13142         In order to merge more common/ files into the top-level, we need to
13143         add more host flags to CPPFLAGS, and that conflicts with our current
13144         use with build-time tools.  So split them apart like we do with all
13145         other build flags to avoid the issue.
13146
13147         sim: h8300: switch to cpu for state
13148         Rather than rely on pulling out the first cpu from the sim state
13149         for cpu state, pass down the active cpu that's already available.
13150
13151         sim: common: change sim_{fetch,store}_register helpers to use void* buffers
13152         When reading/writing arbitrary data to the system's memory, the unsigned
13153         char pointer type doesn't make that much sense.  Switch it to void so we
13154         align a bit with standard C library read/write functions, and to avoid
13155         having to sprinkle casts everywhere.
13156
13157 2022-11-02  Jon Turney  <jon.turney@dronecode.org.uk>
13158
13159         Fix Cygwin build after 20489cca
13160         Update code under __CYGWIN__ which accesses inferior process information
13161         which is now stored in windows_process_info rather than globals.
13162
13163 2022-11-02  Jon Turney  <jon.turney@dronecode.org.uk>
13164
13165         Fix Cygwin build after bcb9251f
13166         Absent _UNICODE being defined (which gdb's Makefile doesn't do),
13167         windows.h will always define STARTUPINFO is as STARTUPINFOA, so this
13168         cast isn't correct when create_process expects a STARTUPINFOW
13169         parameter (i.e. in a Cygwin build).
13170
13171         Instead write this as &info_ex.StartupInfo (which is always of the
13172         correct type).
13173
13174 2022-11-02  Jan Beulich  <jbeulich@suse.com>
13175
13176         x86: drop bogus Tbyte
13177         Prior to commit 1cb0ab18ad24 ("x86/Intel: restrict suffix derivation")
13178         the Tbyte modifier on the FLDT and FSTPT templates was pointless, as
13179         No_ldSuf would have prevented it being accepted. Due to the special
13180         nature of LONG_DOUBLE_MNEM_SUFFIX said commit, however, has led to these
13181         insns being accepted in Intel syntax mode even when "tbyte ptr" was
13182         present. Restore original behavior by dropping Tbyte there. (Note that
13183         these insns in principle should by marked AT&T syntax only, but since
13184         they haven't been so far we probably shouldn't change that.)
13185
13186         x86: simplify expressions in update_imm()
13187         Comparing the sum of the relevant .imm<N> fields against a constant imo
13188         makes more obvious what is actually meant. It allows dropping of two
13189         static variables, with a 3rd drop requiring two more minor adjustments
13190         elsewhere, utilizing that "i" is zeroed first thing in md_assemble().
13191         This also increases the chances of the compiler doing the calculations
13192         all in registers.
13193
13194 2022-11-02  Nelson Chu  <nelson@rivosinc.com>
13195
13196         RISC-V: Fixed the missing $x+arch when adding odd paddings for alignment.
13197         Consider the case,
13198
13199         .option arch, rv32i
13200         .option norelax
13201         .option arch, +c
13202         .byte   1
13203         .align  2
13204         addi    a0, zero, 1
13205
13206         Assembler adds $d for the odd .byte, and then adds $x+arch for the
13207         alignment.  Since norelax, riscv_add_odd_padding_symbol will add the
13208         $d and $x for the odd alignment, but accidently remove the $x+arch because
13209         it has the same address as $d.  Therefore, we will get the unexpected result
13210         before applying this patch,
13211
13212         .byte   1            # $d
13213         .align  2            # odd alignment, $xrv32ic replaced by $d + $x
13214
13215         After this patch, the expected result should be,
13216
13217         .byte   1            # $d
13218         .align  2            # odd alignment, $xrv32ic replaced by $d + $xrv32ic
13219
13220         gas/
13221             * config/tc-riscv.c (make_mapping_symbol): If we are adding mapping symbol
13222             for odd alignment, then we probably will remove the $x+arch by accidently
13223             when it has the same address of $d.  Try to add the removed $x+arch back
13224             after the $d rather than just $x.
13225             (riscv_mapping_state): Updated since parameters of make_mapping_symbol are
13226             changed.
13227             (riscv_add_odd_padding_symbol): Likewise.
13228             (riscv_remove_mapping_symbol): Removed and moved the code into the
13229             riscv_check_mapping_symbols.
13230             (riscv_check_mapping_symbols): Updated.
13231             * testsuite/gas/riscv/mapping-dis.d: Updated and added new testcase.
13232             * testsuite/gas/riscv/mapping-symbols.d: Likewise.
13233             * testsuite/gas/riscv/mapping.s: Likewise.
13234
13235 2022-11-02  Hu, Lin1  <lin1.hu@intel.com>
13236
13237         Support Intel MSRLIST
13238         gas/ChangeLog:
13239
13240                 * NEWS: Support Intel MSRLIST.
13241                 * config/tc-i386.c: Add msrlist.
13242                 * doc/c-i386.texi: Document .msrlist.
13243                 * testsuite/gas/i386/i386.exp: Add MSRLIST tests.
13244                 * testsuite/gas/i386/msrlist-inval.l: New test.
13245                 * testsuite/gas/i386/msrlist-inval.s: Ditto.
13246                 * testsuite/gas/i386/x86-64-msrlist-intel.d: Ditto.
13247                 * testsuite/gas/i386/x86-64-msrlist.d: Ditto.
13248                 * testsuite/gas/i386/x86-64-msrlist.s: Ditto.
13249
13250         opcodes/ChangeLog:
13251
13252                 * i386-dis.c (X86_64_0F01_REG_0_MOD_3_RM_6_P_1): New.
13253                 (X86_64_0F01_REG_0_MOD_3_RM_6_P_3): Ditto.
13254                 (prefix_table): New entry for msrlist.
13255                 (x86_64_table): Add X86_64_0F01_REG_0_MOD_3_RM_6_P_1
13256                 and X86_64_0F01_REG_0_MOD_3_RM_6_P_3.
13257                 * i386-gen.c (cpu_flag_init): Add CPU_MSRLIST_FLAGS
13258                 and CPU_ANY_MSRLIST_FLAGS.
13259                 * i386-init.h: Regenerated.
13260                 * i386-opc.h (CpuMSRLIST): New.
13261                 (i386_cpu_flags): Add cpumsrlist.
13262                 * i386-opc.tbl: Add MSRLIST instructions.
13263                 * i386-tbl.h: Regenerated.
13264
13265 2022-11-02  Hu, Lin1  <lin1.hu@intel.com>
13266
13267         Support Intel WRMSRNS
13268         gas/ChangeLog:
13269
13270                 * NEWS: Support Intel WRMSRNS.
13271                 * config/tc-i386.c: Add wrmsrns.
13272                 * doc/c-i386.texi: Document .wrmsrns.
13273                 * testsuite/gas/i386/i386.exp: Add WRMSRNS tests.
13274                 * testsuite/gas/i386/wrmsrns-intel.d: New test.
13275                 * testsuite/gas/i386/wrmsrns.d: Ditto.
13276                 * testsuite/gas/i386/wrmsrns.s: Ditto.
13277                 * testsuite/gas/i386/x86-64-wrmsrns-intel.d: Ditto.
13278                 * testsuite/gas/i386/x86-64-wrmsrns.d: Ditto.
13279
13280         opcodes/ChangeLog:
13281
13282                 * i386-dis.c (PREFIX_0F01_REG_0_MOD_3_RM_6): New.
13283                 (prefix_table): Add PREFIX_0F01_REG_0_MOD_3_RM_6.
13284                 (rm_table): New entry for wrmsrns.
13285                 * i386-gen.c (cpu_flag_init): Add CPU_WRMSRNS_FLAGS
13286                 and CPU_ANY_WRMSRNS_FLAGS.
13287                 (cpu_flags): Add CpuWRMSRNS.
13288                 * i386-init.h: Regenerated.
13289                 * i386-opc.h (CpuWRMSRNS): New.
13290                 (i386_cpu_flags): Add cpuwrmsrns.
13291                 * i386-opc.tbl: Add WRMSRNS instructions.
13292                 * i386-tbl.h: Regenerated.
13293
13294 2022-11-02  Kong Lingling  <lingling.kong@intel.com>
13295
13296         Add handler for more i386_cpu_flags
13297         gas/ChangeLog:
13298
13299                 * config/tc-i386.c (cpu_flags_all_zero): Add new ARRAY_SIZE handle.
13300                 (cpu_flags_equal): Ditto.
13301                 (cpu_flags_and): Ditto.
13302                 (cpu_flags_or): Ditto.
13303                 (cpu_flags_and_not): Ditto.
13304
13305 2022-11-02  Haochen Jiang  <haochen.jiang@intel.com>
13306
13307         Support Intel CMPccXADD
13308         gas/ChangeLog:
13309
13310                 * NEWS: Support Intel CMPccXADD.
13311                 * config/tc-i386.c: Add cmpccxadd.
13312                 (build_modrm_byte): Add operations for Vex.VVVV reg
13313                 on operand 0 while have memory operand.
13314                 * doc/c-i386.texi: Document .cmpccxadd.
13315                 * testsuite/gas/i386/i386.exp: Run CMPccXADD tests.
13316                 * testsuite/gas/i386/cmpccxadd-inval.s: New test.
13317                 * testsuite/gas/i386/cmpccxadd-inval.l: Ditto.
13318                 * testsuite/gas/i386/x86-64-cmpccxadd-intel.d: Ditto.
13319                 * testsuite/gas/i386/x86-64-cmpccxadd.s: Ditto.
13320                 * testsuite/gas/i386/x86-64-cmpccxadd.d: Ditto.
13321
13322         opcodes/ChangeLog:
13323
13324                 * i386-dis.c (Mdq): New.
13325                 (X86_64_VEX_0F38E0): Ditto.
13326                 (X86_64_VEX_0F38E1): Ditto.
13327                 (X86_64_VEX_0F38E2): Ditto.
13328                 (X86_64_VEX_0F38E3): Ditto.
13329                 (X86_64_VEX_0F38E4): Ditto.
13330                 (X86_64_VEX_0F38E5): Ditto.
13331                 (X86_64_VEX_0F38E6): Ditto.
13332                 (X86_64_VEX_0F38E7): Ditto.
13333                 (X86_64_VEX_0F38E8): Ditto.
13334                 (X86_64_VEX_0F38E9): Ditto.
13335                 (X86_64_VEX_0F38EA): Ditto.
13336                 (X86_64_VEX_0F38EB): Ditto.
13337                 (X86_64_VEX_0F38EC): Ditto.
13338                 (X86_64_VEX_0F38ED): Ditto.
13339                 (X86_64_VEX_0F38EE): Ditto.
13340                 (X86_64_VEX_0F38EF): Ditto.
13341                 (x86_64_table): Add X86_64_VEX_0F38E0, X86_64_VEX_0F38E1,
13342                 X86_64_VEX_0F38E2, X86_64_VEX_0F38E3, X86_64_VEX_0F38E4,
13343                 X86_64_VEX_0F38E5, X86_64_VEX_0F38E6, X86_64_VEX_0F38E7,
13344                 X86_64_VEX_0F38E8, X86_64_VEX_0F38E9, X86_64_VEX_0F38EA,
13345                 X86_64_VEX_0F38EB, X86_64_VEX_0F38EC, X86_64_VEX_0F38ED,
13346                 X86_64_VEX_0F38EE, X86_64_VEX_0F38EF.
13347                 * i386-gen.c (cpu_flag_init): Add CPU_CMPCCXADD_FLAGS and
13348                 CPU_ANY_CMPCCXADD_FLAGS.
13349                 (cpu_flags): Add CpuCMPCCXADD.
13350                 * i386-init.h: Regenerated.
13351                 * i386-opc.h (CpuCMPCCXADD): New.
13352                 (i386_cpu_flags): Add cpucmpccxadd. Comment unused for it is actually 0.
13353                 * i386-opc.tbl: Add Intel CMPccXADD instructions.
13354                 * i386-tbl.h: Regenerated.
13355
13356 2022-11-02  Cui,Lili  <lili.cui@intel.com>
13357
13358         Support Intel AVX-VNNI-INT8
13359         gas/
13360                 * NEWS: Support Intel AVX-VNNI-INT8.
13361                 * config/tc-i386.c: Add avx_vnni_int8.
13362                 * doc/c-i386.texi: Document avx_vnni_int8.
13363                 * testsuite/gas/i386/avx-vnni-int8-intel.d: New file.
13364                 * testsuite/gas/i386/avx-vnni-int8.d: Likewise.
13365                 * testsuite/gas/i386/avx-vnni-int8.s: Likewise.
13366                 * testsuite/gas/i386/x86-64-avx-vnni-int8-intel.d: Likewise.
13367                 * testsuite/gas/i386/x86-64-avx-vnni-int8.d: Likewise.
13368                 * testsuite/gas/i386/x86-64-avx-vnni-int8.s: Likewise.
13369                 * testsuite/gas/i386/i386.exp: Run AVX VNNI INT8 tests.
13370
13371         opcodes/
13372                 * i386-dis.c: (PREFIX_VEX_0F3850) New.
13373                 (PREFIX_VEX_0F3851): Likewise.
13374                 (VEX_W_0F3850_P_0): Likewise.
13375                 (VEX_W_0F3850_P_1): Likewise.
13376                 (VEX_W_0F3850_P_2): Likewise.
13377                 (VEX_W_0F3850_P_3): Likewise.
13378                 (VEX_W_0F3851_P_0): Likewise.
13379                 (VEX_W_0F3851_P_1): Likewise.
13380                 (VEX_W_0F3851_P_2): Likewise.
13381                 (VEX_W_0F3851_P_3): Likewise.
13382                 (VEX_W_0F3850): Delete.
13383                 (VEX_W_0F3851): Likewise.
13384                 (prefix_table): Add PREFIX_VEX_0F3850 and PREFIX_VEX_0F3851.
13385                 (vex_table): Add PREFIX_VEX_0F3850 and PREFIX_VEX_0F3851,
13386                 delete VEX_W_0F3850 and VEX_W_0F3851.
13387                 (vex_w_table): Add VEX_W_0F3850_P_0, VEX_W_0F3850_P_1, VEX_W_0F3850_P_2
13388                 VEX_W_0F3850_P_3, VEX_W_0F3851_P_0, VEX_W_0F3851_P_1, VEX_W_0F3851_P_2
13389                 and VEX_W_0F3851_P_3, delete VEX_W_0F3850 and VEX_W_0F3851.
13390                 * i386-gen.c: (cpu_flag_init): Add CPU_AVX_VNNI_INT8_FLAGS
13391                 and CPU_ANY_AVX_VNNI_INT8_FLAGS.
13392                 (cpu_flags): Add CpuAVX_VNNI_INT8.
13393                 * i386-opc.h (CpuAVX_VNNI_INT8): New.
13394                 * i386-opc.tbl: Add Intel AVX_VNNI_INT8 instructions.
13395                 * i386-init.h: Regenerated.
13396                 * i386-tbl.h: Likewise.
13397
13398 2022-11-02  Hongyu Wang  <hongyu.wang@intel.com>
13399             Haochen Jiang  <haochen.jiang@intel.com>
13400
13401         Support Intel AVX-IFMA
13402         x86: Support Intel AVX-IFMA
13403
13404         Intel AVX IFMA instructions are marked with CpuVEX_PREFIX, which is
13405         cleared by default.  Without {vex} pseudo prefix, Intel IFMA instructions
13406         are encoded with EVEX prefix.  {vex} pseudo prefix will turn on VEX
13407         encoding for Intel IFMA instructions.
13408
13409         gas/
13410
13411                 * NEWS: Support Intel AVX-IFMA.
13412                 * config/tc-i386.c (cpu_arch): Add avx_ifma.
13413                 * doc/c-i386.texi: Document .avx_ifma.
13414                 * testsuite/gas/i386/avx-ifma.d: New file.
13415                 * testsuite/gas/i386/avx-ifma-intel.d: Likewise.
13416                 * testsuite/gas/i386/avx-ifma.s: Likewise.
13417                 * testsuite/gas/i386/x86-64-avx-ifma.d: Likewise.
13418                 * testsuite/gas/i386/x86-64-avx-ifma-intel.d: Likewise.
13419                 * testsuite/gas/i386/x86-64-avx-ifma.s: Likewise.
13420                 * testsuite/gas/i386/i386.exp: Run AVX IFMA tests.
13421
13422         opcodes/
13423
13424                 * i386-dis.c (PREFIX_VEX_0F38B4): New.
13425                 (PREFIX_VEX_0F38B5): Likewise.
13426                 (VEX_W_0F38B4_P_2): Likewise.
13427                 (VEX_W_0F38B5_P_2): Likewise.
13428                 (prefix_table): Add PREFIX_VEX_0F38B4 and PREFIX_VEX_0F38B5.
13429                 (vex_table): Add VEX_W_0F38B4_P_2 and VEX_W_0F38B5_P_2.
13430                 * i386-dis-evex.h: Fold AVX512IFMA entries to AVX-IFMA.
13431                 * i386-gen.c (cpu_flag_init): Clear the CpuAVX_IFMA bit in
13432                 CPU_UNKNOWN_FLAGS. Add CPU_AVX_IFMA_FLGAS and
13433                 CPU_ANY_AVX_IFMA_FLAGS. Add CpuAVX_IFMA to CPU_AVX2_FLAGS.
13434                 (cpu_flags): Add CpuAVX_IFMA.
13435                 * i386-opc.h (CpuAVX_IFMA): New.
13436                 (i386_cpu_flags): Add cpuavx_ifma.
13437                 * i386-opc.tbl: Add Intel AVX IFMA instructions.
13438                 * i386-init.h: Regenerated.
13439                 * i386-tbl.h: Likewise.
13440
13441 2022-11-02  GDB Administrator  <gdbadmin@sourceware.org>
13442
13443         Automatic date update in version.in
13444
13445 2022-11-01  Andrew Burgess  <aburgess@redhat.com>
13446
13447         opcodes/arm: don't pass non-string literal to printf like function
13448         The earlier commit:
13449
13450           commit 6576bffe6cbbb53c5756b2fccd2593ba69b74cdf
13451           Date:   Thu Jul 7 13:43:45 2022 +0100
13452
13453               opcodes/arm: add disassembler styling for arm
13454
13455         introduced two places where a register name was passed as the format
13456         string to the disassembler's fprintf_styled_func callback.  This will
13457         cause a warning from some compilers, like this:
13458
13459           ../../binutils-gdb/opcodes/arm-dis.c: In function ‘print_mve_vld_str_addr’:
13460           ../../binutils-gdb/opcodes/arm-dis.c:6005:3: error: format not a string literal and no format arguments [-Werror=format-security]
13461            6005 |   func (stream, dis_style_register, arm_regnames[gpr]);
13462                 |   ^~~~
13463
13464         This commit fixes these by using "%s" as the format string.
13465
13466 2022-11-01  Andrew Burgess  <aburgess@redhat.com>
13467
13468         opcodes/arm: silence compiler warning about uninitialized variable use
13469         The earlier commit:
13470
13471           commit 6576bffe6cbbb53c5756b2fccd2593ba69b74cdf
13472           Date:   Thu Jul 7 13:43:45 2022 +0100
13473
13474               opcodes/arm: add disassembler styling for arm
13475
13476         was causing a compiler warning about a possible uninitialized variable
13477         usage within opcodes/arm-dis.c.
13478
13479         The problem is in print_mve_unpredictable, and relates to the reason
13480         variable, which is set by a switch table.
13481
13482         Currently the switch table does cover every valid value, though there
13483         is no default case.  The variable switched on is passed in as an
13484         argument to the print_mve_unpredictable function.
13485
13486         Looking at how print_mve_unpredictable is used, there is only one use,
13487         the second argument is the one that is used for the switch table,
13488         looking at how this argument is set, I don't believe it is possible
13489         for this argument to take an invalid value.
13490
13491         So, I think the compiler warning is a false positive.  As such, my
13492         proposed solution is to initialize the reason variable to the string
13493         "??", this will silence the warning, and the "??" string should never
13494         end up being printed.
13495
13496 2022-11-01  Andrew Burgess  <aburgess@redhat.com>
13497
13498         opcodes/arm: add disassembler styling for arm
13499         This commit adds disassembler styling for the ARM architecture.
13500
13501         The ARM disassembler is driven by several instruction tables,
13502         e.g. cde_opcodes, coprocessor_opcodes, neon_opcodes, etc
13503
13504         The type for elements in each table can vary, but they all have one
13505         thing in common, a 'const char *assembler' field.  This field
13506         contains a string that describes the assembler syntax of the
13507         instruction.
13508
13509         Embedded within that assembler syntax are various escape characters,
13510         prefixed with a '%'.  Here's an example of a very simple instruction
13511         from the arm_opcodes table:
13512
13513           "pld\t%a"
13514
13515         The '%a' indicates a particular type of operand, the function
13516         print_insn_arm processes the arm_opcodes table, and includes a switch
13517         statement that handles the '%a' operand, and takes care of printing
13518         the correct value for that instruction operand.
13519
13520         It is worth noting that there are many print_* functions, each
13521         function handles a single *_opcodes table, and includes its own switch
13522         statement for operand handling.  As a result, every *_opcodes table
13523         uses a different mapping for the operand escape sequences.  This means
13524         that '%a' might print an address for one *_opcodes table, but in a
13525         different *_opcodes table '%a' might print a register operand.
13526
13527         Notice as well that in our example above, the instruction mnemonic
13528         'pld' is embedded within the assembler string.  Some instructions also
13529         include comments within the assembler string, for example, also from
13530         the arm_opcodes table:
13531
13532           "nop\t\t\t@ (mov r0, r0)"
13533
13534         here, everything after the '@' is a comment that is displayed at the
13535         end of the instruction disassembly.
13536
13537         The next complexity is that the meaning of some escape sequences is
13538         not necessarily fixed.  Consider these two examples from arm_opcodes:
13539
13540           "ldrex%c\tr%12-15d, [%16-19R]"
13541           "setpan\t#%9-9d"
13542
13543         Here, the '%d' escape is used with a bitfield modifier, '%12-15d' in
13544         the first instruction, and '%9-9d' in the second instruction, but,
13545         both of these are the '%d' escape.
13546
13547         However, in the first instruction, the '%d' is used to print a
13548         register number, notice the 'r' immediately before the '%d'.  In the
13549         second instruction the '%d' is used to print an immediate, notice the
13550         '#' just before the '%d'.
13551
13552         We have two problems here, first, the '%d' needs to know if it should
13553         use register style or immediate style, and secondly, the 'r' and '#'
13554         characters also need to be styled appropriately.
13555
13556         The final thing we must consider is that some escape codes result in
13557         more than just a single operand being printed, for example, the '%q'
13558         operand as used in arm_opcodes ends up calling arm_decode_shift, which
13559         can print a register name, a shift type, and a shift amount, this
13560         could end up using register, sub-mnemonic, and immediate styles, as
13561         well as the text style for things like ',' between the different
13562         parts.
13563
13564         I propose a three layer approach to adding styling:
13565
13566         (1) Basic state machine:
13567
13568             When we start printing an instruction we should maintain the idea
13569             of a 'base_style'.  Every character from the assembler string will
13570             be printed using the base_style.
13571
13572            The base_style will start as mnemonic, as each instruction starts
13573            with an instruction mnemonic.  When we encounter the first '\t'
13574            character, the base_style will change to text.  When we encounter
13575            the first '@' the base_style will change to comment_start.
13576
13577            This simple state machine ensures that for simple instructions the
13578            basic parts, except for the operands themselves, will be printed in
13579            the correct style.
13580
13581         (2) Simple operand styling:
13582
13583             For operands that only have a single meaning, or which expand to
13584             multiple parts, all of which have a consistent meaning, then I
13585             will simply update the operand printing code to print the operand
13586             with the correct style.  This will cover a large number of the
13587             operands, and is the most consistent with how styling has been
13588             added to previous architectures.
13589
13590         (3) New styling syntax in assembler strings:
13591
13592             For cases like the '%d' that I describe above, I propose adding a
13593             new extension to the assembler syntax.  This extension will allow
13594             me to temporarily change the base_style.  Operands like '%d', will
13595             then print using the base_style rather than using a fixed style.
13596
13597             Here are the two examples from above that use '%d', updated with
13598             the new syntax extension:
13599
13600               "ldrex%c\t%{R:r%12-15d%}, [%16-19R]"
13601               "setpan\t%{I:#%9-9d%}"
13602
13603             The syntax has the general form '%{X:....%}' where the 'X'
13604             character changes to indicate a different style.  In the first
13605             instruction I use '%{R:...%}' to change base_style to the register
13606             style, and in the second '%{I:...%}' changes base_style to
13607             immediate style.
13608
13609             Notice that the 'r' and '#' characters are included within the new
13610             style group, this ensures that these characters are printed with
13611             the correct style rather than as text.
13612
13613             The function decode_base_style maps from character to style.  I've
13614             included a character for each style for completeness, though only
13615             a small number of styles are currently used.
13616
13617         I have updated arm-dis.c to the above scheme, and checked all of the
13618         tests in gas/testsuite/gas/arm/, and the styling looks reasonable.
13619
13620         There are no regressions on the ARM gas/binutils/ld tests that I can
13621         see, so I don't believe I've changed the output layout at all.  There
13622         were two binutils tests for which I needed to force the disassembler
13623         styling off.
13624
13625         I can't guarantee that I've not missed some untested corners of the
13626         disassembler, or that I might have just missed some incorrectly styled
13627         output when reviewing the test results, but I don't believe I've
13628         introduced any changes that could break the disassembler - the worst
13629         should be some aspect is not styled correctly.
13630
13631 2022-11-01  Andrew Burgess  <aburgess@redhat.com>
13632
13633         opcodes/arm: use '@' consistently for the comment character
13634         Looking at the ARM disassembler output, every comment seems to start
13635         with a ';' character, so I assumed this was the correct character to
13636         start an assembler comment.
13637
13638         I then spotted a couple of places where there was no ';', but instead,
13639         just a '@' character.  I thought that this was a case of a missing
13640         ';', and proposed a patch to add the missing ';' characters.
13641
13642         Turns out I was wrong, '@' is actually the ARM assembler comment
13643         character, while ';' is the statement separator.  Thus this:
13644
13645             nop    ;@ comment
13646
13647         is two statements, the first is the 'nop' instruction, while the
13648         second contains no instructions, just the '@ comment' comment text.
13649
13650         This:
13651
13652             nop    @ comment
13653
13654         is a single 'nop' instruction followed by a comment.  And finally,
13655         this:
13656
13657             nop    ; comment
13658
13659         is two statements, the first contains the 'nop' instruction, while the
13660         second contains the instruction 'comment', which obviously isn't
13661         actually an instruction at all.
13662
13663         Why this matters is that, in the next commit, I would like to add
13664         libopcodes syntax styling support for ARM.
13665
13666         The question then is how should the disassembler style the three cases
13667         above?
13668
13669         As '@' is the actual comment start character then clearly the '@' and
13670         anything after it can be styled as a comment.  But what about ';' in
13671         the second example?  Style as text?  Style as a comment?
13672
13673         And the third example is even harder, what about the 'comment' text?
13674         Style as an instruction mnemonic?  Style as text?  Style as a comment?
13675
13676         I think the only sensible answer is to move the disassembler to use
13677         '@' consistently as its comment character, and remove all the uses of
13678         ';'.
13679
13680         Then, in the next commit, it's obvious what to do.
13681
13682         There's obviously a *lot* of tests that get updated by this commit,
13683         the only actual code changes are in opcodes/arm-dis.c.
13684
13685 2022-11-01  GDB Administrator  <gdbadmin@sourceware.org>
13686
13687         Automatic date update in version.in
13688
13689 2022-10-31  Tom Tromey  <tromey@adacore.com>
13690
13691         Add missing TYPE_CODE_* constants to Python
13692         A user noticed that TYPE_CODE_FIXED_POINT was not exported by the gdb
13693         Python layer.  This patch fixes the bug, and prevents future
13694         occurences of this type of bug.
13695
13696 2022-10-31  Carl Love  <cel@us.ibm.com>
13697
13698         Remove REPARSE condition to force hardware resource checking when updating watchpoints
13699         Currently the resource checking is done if REPARSE is true.  The hardware
13700         watchpoint resource checking in update_watchpoint needs to be redone on
13701         each call to function update_watchpoints as the value chain may have
13702         changed.  The number of hardware registers needed for a watchpoint can
13703         change if the variable being watched changes.  This situation occurs in
13704         this test when watching variable **global_ptr_ptr.  Initially when the
13705         watch command is issued, only two addresses need to be watched as
13706         **global_ptr_ptr has not yet been initialized.  Once the value of
13707         **global_ptr_ptr is initialized the locations to be tracked increase to
13708         three addresses.  However, update_watchpoints is not called again with
13709         REPARSE set to 1 to force the resource checking to be redone.  When the
13710         test is run on Power 10, an internal gdb error occurs when the PowerPC
13711         routine tries to setup the three hardware watchpoint address since the hw
13712         only has two hardware watchpoint registers.  The error occurs because the
13713         resource checking was not redone in update_watchpoints after
13714         **global_ptr_ptr changed.
13715
13716         The following descibes the situation in detail that occurs on Power 10 with
13717         gdb running on the binary for gdb.base/watchpoint.c.
13718
13719         1 break func4
13720         2 run
13721         3 watch *global_ptr
13722         4 next      execute source code:   buf[0] = 3;
13723         5 next      execute source code:   global_ptr = buf;
13724         6 next      execute source code:   buf[0] = 7;
13725         7 delete 2  (delete watch *global_ptr)
13726         8 watch **global_ptr_ptr
13727         9 next       execute source code:   buf[1] = 5;
13728         10 next      global_ptr_ptr = &global_ptr;
13729         11 next      buf[0] = 9;
13730
13731         In step 8, the the watch **global_ptr_prt command calls update_watchpoint
13732         in breakpoint.c with REPARSE set to 1.  The function update_watchpoint
13733         calls can_use_hardware_watchpoint to see if there are enough
13734         resources available to add the watchpoint since REPARSE is set to 1.  At
13735         this point, **global_ptr_ptr has not been initialized so only two addresses
13736         are watched.  The val_chain contains the address for **global_ptr_ptr and 0
13737         since **global_ptr_ptr has not been initialized.  The update_watchpoint
13738         updates the breakpoint list as follows:
13739
13740           breakpoint 0
13741            loc 0: b->address = 0x100009c0
13742           breakpoint 1
13743            loc 1: b->address = 0x7ffff7f838a0
13744           breakpoint 2
13745            loc 2: b->address = 0x7ffff7b7fc54
13746           breakpoint 3
13747            loc 3: b->address = 0x7ffff7a5788c
13748           breakpoint 4
13749            loc 4: b->address = 0x0         <-- location pointed to by global_ptr_ptr
13750            loc 5: b->address = 0x100200b8  <-- global_ptr_ptr watchpoint
13751           breakpoint 5
13752            loc 6: b->address = 0x7ffff7b7fc54
13753
13754         In step 10, the next command executes the source code
13755         global_ptr_ptr = &global_ptr.  This changes the set of locations to be
13756         watched for the watchpoint **global_ptr_prt.  The list of addresses for the
13757         breakpoint consist of the address for global_ptr_prt, global_ptr and buf.
13758         The breakpoint list gets updated by update_watchpoint as follows:
13759
13760           breakpoint 0
13761            loc 0: b->address = 0x100009c0
13762           breakpoint 1
13763            loc 1: b->address = 0x7ffff7f838a0
13764           breakpoint 2
13765            loc 2: b->address = 0x7ffff7b7fc54
13766           breakpoint 3
13767            loc 3: b->address = 0x7ffff7a5788c
13768           breakpoint 4
13769            loc 4: b->address = 0x10020050           buf
13770            loc 5: b->address = 0x100200b0           watch *global_ptr
13771            loc 6: b->address = 0x100200b8           watch **global_ptr_ptr
13772           breakpoint 5
13773            loc 7: b->address = 0x7ffff7b7fc54
13774           breakpoint 6
13775
13776         However, the hardware resource checking was not redone because
13777         update_breakpoint was called with REPARSE equal to  0.
13778
13779         Step 11, execute the third next command.  The function
13780         ppc_linux_nat_target::low_prepare_to_resume() attempts a ptrace
13781         call to setup each of the three address for breakpoint 4.  The slot
13782         value returned for the third ptrace call is -1 indicating an error
13783         because there are only two hardware watchpoint registers available on
13784         Power 10.
13785
13786         This patch removes just the statement "if (reparse)" in function
13787         update_watchpoint to force the resources to be rechecked on every call to
13788         the function.  This ensures that any changes to the val_chain resulting
13789         in needing more resources then available will be caught.
13790
13791         The patch has been tested on Power 8, Power 10 and X86-64.  Note the patch
13792         has no effect on Power 9 since hardware watchpoint support is disabled on
13793         that processor.
13794
13795 2022-10-31  Carl Love  <cel@us.ibm.com>
13796
13797         PowerPC, add support for recording pipe2 system call.
13798         Test gdb.reverse/pipe-reverse.exp fails on Power 10 running the fedora 36
13799         distro.  The gdb record error message is:
13800
13801           Process record and replay target doesn't support syscall number 317.
13802
13803         System call 317 on PowerPC maps to the pipe2 system call.
13804
13805         This patch adds support for the missing pipe2 system call for PowerPC.
13806
13807         Patch fixes the test failure in gdb.reverse/pipe-reverse.exp.
13808
13809         The patch has been tested on Power 10 with no regression failures.
13810
13811 2022-10-31  Jan Beulich  <jbeulich@suse.com>
13812
13813         x86: minor improvements to optimize_imm() (part III)
13814         Earlier tidying still missed an opportunity: There's no need for the
13815         "anyimm" static variable. Instead of using it in the loop to mask
13816         "allowed" (which is necessary to satisfy operand_type_or()'s assertions)
13817         simply use "mask", requiring it to be calculated first. That way the
13818         post-loop masking by "mask" ahead of the operand_type_all_zero() can be
13819         dropped.
13820
13821 2022-10-31  Mike Frysinger  <vapier@gentoo.org>
13822
13823         sim: reg: constify store helper
13824         These functions only read from memory, so mark the pointer as const.
13825
13826         sim: constify various integer readers
13827         These functions only read from memory, so mark the pointer as const.
13828
13829         sim: cgen: constify GETT helpers
13830         These functions only read from memory, so mark the pointer as const.
13831
13832         sim: common: change sim_read & sim_write to use void* buffers
13833         When reading/writing arbitrary data to the system's memory, the unsigned
13834         char pointer type doesn't make that much sense.  Switch it to void so we
13835         align a bit with standard C library read/write functions, and to avoid
13836         having to sprinkle casts everywhere.
13837
13838 2022-10-31  H.J. Lu  <hjl.tools@gmail.com>
13839
13840         x86: Silence GCC 12 warning on tc-i386.c
13841         Silence GCC 12 warning on tc-i386.c:
13842
13843         gas/config/tc-i386.c: In function ‘md_assemble’:
13844         gas/config/tc-i386.c:5039:16: error: too many arguments for format [-Werror=format-extra-args]
13845          5039 |     as_warn (_("only support RIP-relative address"), i.tm.name);
13846
13847                 * config/tc-i386.c (md_assemble): Print mnemonic in RIP-relative
13848                 warning.
13849                 * estsuite/gas/i386/x86-64-prefetchi-warn.l: Updated.
13850
13851 2022-10-31  Tom Tromey  <tromey@adacore.com>
13852
13853         Use enum for gdbarch's call_dummy_location
13854         This changes gdbarch to use an enum for call_dummy_location, providing
13855         a little more type safety.
13856
13857         Inline initialization of gdbarch members
13858         This changes gdbarch to use the "predefault" to initialize its members
13859         inline.  This required changing a couple of the Value instantiations
13860         to avoid a use of "gdbarch" during initialization, but on the whole I
13861         think this is better -- it removes a hidden ordering dependency.
13862
13863 2022-10-31  Tom Tromey  <tromey@adacore.com>
13864
13865         Fix regression in pointer-to-member printing
13866         PR c++/29243 points out that "info func" on a certain C++ executable
13867         will cause an infinite loop in gdb.
13868
13869         I tracked this down to a bug introduced by commit 6b5a7bc76 ("Handle
13870         member pointers directly in generic_value_print").  Before this
13871         commit, the C++ code to print a member pointer would wind up calling
13872         value_print_scalar_formatted; but afterward it simply calls
13873         generic_value_print and gets into a loop.
13874
13875         This patch restores the previous behavior and adds a regression test.
13876
13877 2022-10-31  Nick Clifton  <nickc@redhat.com>
13878
13879         Updated Romainain translation for the binutils sub-directory and Swedish translations for the ld and opcodes sub-directories.
13880
13881 2022-10-31  Cui, Lili  <lili.cui@intel.com>
13882
13883         Support Intel PREFETCHI
13884         gas/ChangeLog:
13885
13886                 * NEWS: Add support for Intel PREFETCHI instruction.
13887                 * config/tc-i386.c (load_insn_p): Use prefetch* to fold all prefetches.
13888                 (md_assemble): Add warning for illegal input of PREFETCHI.
13889                 * doc/c-i386.texi: Document .prefetchi.
13890                 * testsuite/gas/i386/i386.exp: Run PREFETCHI tests.
13891                 * testsuite/gas/i386/x86-64-lfence-load.d: Add PREFETCHI.
13892                 * testsuite/gas/i386/x86-64-lfence-load.s: Likewise.
13893                 * testsuite/gas/i386/x86-64-prefetch.d: New test.
13894                 * testsuite/gas/i386/x86-64-prefetchi-intel.d: Likewise.
13895                 * testsuite/gas/i386/x86-64-prefetchi-inval-register.d: Likewise..
13896                 * testsuite/gas/i386/x86-64-prefetchi-inval-register.s: Likewise.
13897                 * testsuite/gas/i386/x86-64-prefetchi-warn.l: Likewise.
13898                 * testsuite/gas/i386/x86-64-prefetchi-warn.s: Likewise.
13899                 * testsuite/gas/i386/x86-64-prefetchi.d: Likewise.
13900                 * testsuite/gas/i386/x86-64-prefetchi.s: Likewise.
13901
13902         opcodes/ChangeLog:
13903
13904                 * i386-dis.c (reg_table): Add MOD_0F18_REG_6 and MOD_0F18_REG_7
13905                 (x86_64_table): Add X86_64_0F18_REG_6_MOD_0 and X86_64_0F18_REG_7_MOD_0.
13906                 (mod_table): Add MOD_0F18_REG_6 and MOD_0F18_REG_7.
13907                 (prefix_table): Add PREFIX_0F18_REG_6_MOD_0_X86_64 and
13908                 PREFIX_0F18_REG_7_MOD_0_X86_64.
13909                 (PREFETCHI_Fixup): New.
13910                 * i386-gen.c (cpu_flag_init): Add CPU_PREFETCHI_FLAGS.
13911                 (cpu_flags): Add CpuPREFETCHI.
13912                 * i386-opc.h (CpuPREFETCHI): New.
13913                 (i386_cpu_flags): Add cpuprefetchi.
13914                 * i386-opc.tbl: Add Intel PREFETCHI instructions.
13915                 * i386-init.h: Regenerated.
13916                 * i386-tbl.h: Likewise.
13917
13918 2022-10-31  Bruno Larsen  <blarsen@redhat.com>
13919
13920         gdb/testsuite: fix gdb.cp/converts.exp to run with clang
13921         Clang attempts to minimize the size of the debug-info by not adding
13922         complete information about types that aren't constructed in a given
13923         file.  Specifically, this meant that there was minimal information about
13924         class B in the test gdb.cp/converts.exp.  To fix this, we just need to
13925         construct any object of type B in that file.
13926
13927         Approved-By: Andrew Burgess <aburgess@redhat.com>
13928
13929 2022-10-31  Bruno Larsen  <blarsen@redhat.com>
13930
13931         gdb/testsuite: add XFAIL to gdb.cp/ptype-flags.exp when using clang
13932         When running gdb.cp/ptype-flags.exp using Clang, we get an unexpected
13933         failure when printing the type of a class with an internal typedef. This
13934         happens because Clang doesn't add accessibility information for typedefs
13935         inside classes (see https://github.com/llvm/llvm-project/issues/57608
13936         for more info). To help with Clang testing, an XFAIL was added to this
13937         test.
13938
13939 2022-10-31  Yoshinori Sato  <ysato@users.sourceforge.jp>
13940
13941         RX assembler: switch arguments of thw MVTACGU insn.
13942
13943 2022-10-31  Nick Clifton  <nickc@redhat.com>
13944
13945         objdump: Add configure time option to enable colored disassembly output by default.
13946                 PR 29457
13947                 * configure.ac: Add --enable-colored-disassembly.
13948                 * objdump.c: Add --disassembler-color=terminal.
13949                 * doc/binutils.texi (objdump): Document the new option.
13950                 * NEWS: Mention new feature.
13951                 * config.in: Regenerate in.
13952                 * configure: Regenerate.
13953
13954 2022-10-31  Mark Harmstone  <mark@harmstone.com>
13955
13956         ld: Add publics stream to PDB files
13957
13958         ld: Add section header stream to PDB files
13959
13960         ld: Use %E in einfo in pdb.c
13961         Resubmission, taking into account
13962         https://sourceware.org/pipermail/binutils/2022-October/123948.html.
13963
13964 2022-10-31  GDB Administrator  <gdbadmin@sourceware.org>
13965
13966         Automatic date update in version.in
13967
13968 2022-10-30  Alan Modra  <amodra@gmail.com>
13969
13970         Pool section entries for DWP version 1
13971         Ref: https://gcc.gnu.org/wiki/DebugFissionDWP?action=recall&rev=3
13972
13973         Fuzzers have found a weakness in the code stashing pool section
13974         entries.  With random nonsensical values in the index entries (rather
13975         than each index pointing to its own set distinct from other sets),
13976         it's possible to overflow the space allocated, losing the NULL
13977         terminator.  Without a terminator, find_section_in_set can run off the
13978         end of the shndx_pool buffer.  Fix this by scanning the pool directly.
13979
13980         binutils/
13981                 * dwarf.c (add_shndx_to_cu_tu_entry): Delete range check.
13982                 (end_cu_tu_entry): Likewise.
13983                 (process_cu_tu_index): Fill shndx_pool by directly scanning
13984                 pool, rather than indirectly from index entries.
13985
13986 2022-10-30  GDB Administrator  <gdbadmin@sourceware.org>
13987
13988         Automatic date update in version.in
13989
13990 2022-10-29  Maciej W. Rozycki  <macro@embecosm.com>
13991
13992         gdb/testsuite: Wrap `param_integer_error' in gdb.guile/scm-parameter.exp
13993         Wrap an overlong line in the definition of `param_integer_error' in
13994         gdb.guile/scm-parameter.exp.  No functional change.
13995
13996 2022-10-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
13997
13998         sim/sh: Remove redundant function declaration
13999         Clang generates a warning if there is a function declaration/definition
14000         with zero arguments.  Such declarations/definitions without a prototype (an
14001         argument list) are deprecated forms of indefinite arguments
14002         ("-Wdeprecated-non-prototype").  On the default configuration, it causes a
14003         build failure (unless "--disable-werror" is specified).
14004
14005         But there is another issue.  This function declaration in sim/sh/interp.c
14006         is completely redundant.  This commit just removes that declaration.
14007
14008 2022-10-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
14009
14010         sim/m32r: Initialize "list" variable
14011         The variable "list" is only initialized when arg1 > 0 and when arg1 == 0,
14012         an uninitialized value is passed to translate_endian_h2t function.
14013
14014         Although this behavior is harmless, this commit adds initialization to avoid
14015         a GCC warning ("-Wmaybe-uninitialized").
14016
14017 2022-10-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
14018
14019         sim/erc32: Use int32_t as IRQ callback argument
14020         Clang generates a warning if an argument is passed to a function without
14021         prototype (zero arguments, even without (void)).  Such calls are deprecated
14022         forms of indefinite arguments passing ("-Wdeprecated-non-prototype").
14023         On the default configuration, it (somehow) doesn't cause a build failure but
14024         a warning is generated.
14025
14026         But because the cause is the same as the issue the author fixed in
14027         "sim/erc32: Use int32_t as event callback argument", it would be better to
14028         fix it now to prevent problems in the future.
14029
14030         To fix the issue, this commit makes struct irqcall to use int32_t as a
14031         callback (callback) argument of an IRQ.
14032
14033 2022-10-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
14034
14035         sim/erc32: Use int32_t as event callback argument
14036         Clang generates a warning if an argument is passed to a function without
14037         prototype (zero arguments, even without (void)).  Such calls are deprecated
14038         forms of indefinite arguments passing ("-Wdeprecated-non-prototype").
14039         On the default configuration, it causes a build failure (unless
14040         "--disable-werror" is specified).
14041
14042         To fix that, this commit makes struct evcell to use int32_t as a callback
14043         (cfunc) argument of an event.  int32_t is chosen because "event" function
14044         accepts "int32_t arg".
14045
14046 2022-10-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
14047
14048         sim/erc32: Insert void parameter
14049         Clang generates a warning if there is a function declaration/definition
14050         with zero arguments.  Such declarations/definitions without a prototype (an
14051         argument list) are deprecated forms of indefinite arguments
14052         ("-Wdeprecated-non-prototype").  On the default configuration, it causes a
14053         build failure (unless "--disable-werror" is specified).
14054
14055         This commit replaces () with (void) to avoid this warning.
14056
14057 2022-10-29  Tom de Vries  <tdevries@suse.de>
14058
14059         [gdb/testsuite] Use ssh -t in remote-*.exp
14060         When running test-case gdb.server/multi-ui-errors.exp on target board
14061         remote-gdbserver-on-localhost.exp, I run into:
14062         ...
14063         (gdb) PASS: gdb.server/multi-ui-errors.exp: connect to gdbserver
14064         continue^M
14065         Continuing.^M
14066         PASS: gdb.server/multi-ui-errors.exp: continue - extra UI
14067         Remote debugging from host ::1, port 35466^M
14068         FAIL: gdb.server/multi-ui-errors.exp: ensure inferior is running
14069         ...
14070
14071         The problem is that the target board uses ssh -T, which fails to guarantee
14072         that output from the inferior will be available.
14073
14074         Fix this by copying proc ${board}_spawn from local-remote-host.exp, which
14075         ensures using ssh -t.  [ It would be nice to define an ssh base board to
14076         get rid of the copies, but I'm not addressing that in this commit. ]
14077
14078         Likewise for target board remote-stdio-gdbserver.exp.
14079
14080         Tested on x86_64-linux.
14081
14082 2022-10-29  Tom de Vries  <tdevries@suse.de>
14083
14084         [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp with local-remote-host-notty
14085         With test-case gdb.server/multi-ui-errors.exp and host board
14086         local-remote-host-notty, I run into:
14087         ...
14088         (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI
14089         Executing on target: kill -9 29666    (timeout = 300)
14090         builtin_spawn -ignore SIGHUP kill -9 29666^M
14091         echo^M
14092         Remote connection closed^M
14093         (gdb) (gdb) FAIL: gdb.server/multi-ui-errors.exp: \
14094           main UI, prompt after gdbserver dies (timeout)
14095         ...
14096
14097         In contrast, with local-remote-host (so, everything the same but editing off):
14098         ...
14099         (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI
14100         Executing on target: kill -9 31245    (timeout = 300)
14101         builtin_spawn -ignore SIGHUP kill -9 31245^M
14102         Remote connection closed^M
14103         (gdb) echo^M
14104         (gdb) PASS: gdb.server/multi-ui-errors.exp: main UI, prompt after gdbserver dies
14105         ...
14106
14107         The test-case issues a kill, which results in a "Remote connection closed"
14108         message and a prompt.
14109
14110         The problem is that the prompt is not consumed, so the subsequent echo may be
14111         issued before that prompt, which causes a mismatch when matching the result
14112         of the echo.
14113
14114         Fix this by consuming the "Remote connection closed" message and prompt.
14115
14116         Tested on x86_64-linux.
14117
14118 2022-10-29  Tom de Vries  <tdevries@suse.de>
14119
14120         [gdb/testsuite] Consume output asap in gdb.server/multi-ui-errors.exp
14121         With test-case gdb.server/multi-ui-errors.exp we see:
14122         ...
14123         (gdb) PASS: multi-ui-errors.exp: main UI, prompt after gdbserver dies
14124         continue^M
14125         Continuing.^M
14126         echo^M
14127         (gdb) PASS: multi-ui-errors.exp: extra UI, prompt after gdbserver dies
14128         ...
14129
14130         The continue is issued earlier in the test-case, but the output has not been
14131         consumed, which makes it show up much later.
14132
14133         Consume the continue output asap, to make it clear when the continue is issued:
14134         ...
14135         (gdb) PASS: gdb.server/multi-ui-errors.exp: connect to gdbserver
14136         continue^M
14137         Continuing.^M
14138         PASS: gdb.server/multi-ui-errors.exp: continue - extra UI
14139         ...
14140
14141         Tested on x86_64-linux.
14142
14143 2022-10-29  Tom de Vries  <tdevries@suse.de>
14144
14145         [gdb/testsuite] Remove REMOTE_PORTNUM in remote-stdio-gdbserver.exp
14146         The usage for board remote-stdio-gdbserver.exp is advertised as:
14147         ...
14148          # bash$ make check RUNTESTFLAGS="--target_board=remote-stdio-gdbserver \
14149          #    REMOTE_USERNAME=... REMOTE_HOSTNAME=... REMOTE_PORTNUM=... \
14150          #    [REMOTE_TMPDIR=${remote_dir}] [GDBSERVER=${remote_gdbserver}]"
14151         ...
14152         but when adding REMOTE_PORTNUM=22, I run into:
14153         ...
14154         Running stop-reply-no-thread-multi.exp ...
14155         ERROR: tcl error sourcing stop-reply-no-thread-multi.exp.
14156         ERROR: couldn't execute "/usr/bin/ssh -p22": no such file or directory
14157             while executing
14158         "builtin_spawn {/usr/bin/ssh -p22} -l vries localhost {/usr/bin/gdbserver \
14159           --once localhost:2346 \
14160           /home/vries/gdb_versions/devel/build/gdb/testsuite/outp..."
14161         ...
14162
14163         Fix this by simply removing REMOTE_PORTNUM.
14164
14165         Tested on x86_64-linux.
14166
14167 2022-10-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
14168
14169         sim, sim/{m32c,ppc,rl78}: Use getopt_long
14170         Because of a Libiberty hack, getopt on GNU libc (2.25 or earlier) is
14171         currently unusable on sim, causing a regression on CentOS 7.
14172
14173         This is caused as follows:
14174
14175         1.  If HAVE_DECL_GETOPT is defined (getopt declaration with known prototype
14176             is detected while configuration), a declaration of getopt in
14177             "include/getopt.h" is suppressed.
14178             The author started to define HAVE_DECL_GETOPT in sim with the commit
14179             340aa4f6872c ("sim: Check known getopt definition existence").
14180         2.  GNU libc (2.25 or earlier)'s <unistd.h> includes <getopt.h> with a
14181             special purpose macro defined to declare only getopt function but due
14182             to include path (not tested while configuration), it causes <unistd.h>
14183             to include Libiberty's "include/getopt.h".
14184         3.  If both 1. and 2. are satisfied, despite that <unistd.h> tries to
14185             declare getopt by including <getopt.h>, "include/getopt.h" does not do
14186             so, causing getopt function undeclared.
14187
14188         Getting rid of "include/getopt.h" (e.g. renaming this header file) is the
14189         best solution to avoid hacking but as a short-term solution, this commit
14190         replaces getopt with getopt_long under sim/.
14191
14192 2022-10-29  Alan Modra  <amodra@gmail.com>
14193
14194         pef: sanity check before malloc
14195         And do the sanity check in a way that can't overflow.
14196
14197                 * pef.c (bfd_pef_parse_function_stubs): Sanity check header
14198                 imported_library_count and total_imported_symbol_count before
14199                 allocating memory.
14200
14201 2022-10-29  Alan Modra  <amodra@gmail.com>
14202
14203         Fix small objcopy memory leak
14204                 * objcopy.c (copy_archive): Free l->name.
14205
14206 2022-10-29  Alan Modra  <amodra@gmail.com>
14207
14208         NULL dereference read in som_write_object_contents
14209         objcopy copy_object may omit the call to bfd_copy_private_bfd_data for
14210         various conditions deemed non-fatal, in which case obj_som_exec_data
14211         will be NULL for the output file.
14212
14213                 * som.c (som_finish_writing): Don't dereference NULL
14214                 obj_som_exec_data.
14215
14216 2022-10-29  Nelson Chu  <nelson@rivosinc.com>
14217
14218         RISC-V: Always generate mapping symbols at the start of the sections.
14219         Before figuring out the suppress rule of mapping symbol with architecture
14220         (changed back to $x), always generate them at the start of the sections.
14221
14222         gas/
14223             * config/tc-riscv.c (need_arch_map_symbol): Removed.
14224             (riscv_mapping_state): Updated.
14225             (riscv_check_mapping_symbols): Updated.
14226             * testsuite/gas/riscv/mapping-non-arch.d: Removed.
14227             * testsuite/gas/riscv/mapping-non-arch.s: Likewise.
14228
14229 2022-10-29  GDB Administrator  <gdbadmin@sourceware.org>
14230
14231         Automatic date update in version.in
14232
14233 2022-10-28  Palmer Dabbelt  <palmer@rivosinc.com>
14234
14235         gas: NEWS: Note support for RISC-V Zawrs
14236         This has been supported since eb668e50036 ("RISC-V: Add Zawrs ISA
14237         extension support").
14238
14239         gas: NEWS: Add a missing newline
14240
14241 2022-10-28  Tom Tromey  <tom@tromey.com>
14242
14243         Convert compunit_language to a method
14244         This changes compunit_language to be a method on compunit_symtab.
14245
14246         Approved-By: Simon Marchi <simon.marchi@efficios.com>
14247
14248 2022-10-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
14249
14250         RISC-V: Improve "bits undefined" diagnostics
14251         This commit improves internal error message
14252         "internal: bad RISC-V opcode (bits 0x%lx undefined): %s %s"
14253         to display actual unused bits (excluding non-instruction bits).
14254
14255         gas/ChangeLog:
14256
14257                 * config/tc-riscv.c (validate_riscv_insn): Exclude non-
14258                 instruction bits from displaying internal diagnostics.
14259                 Change error message slightly.
14260
14261 2022-10-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
14262
14263         RISC-V: Fallback for instructions longer than 64b
14264         We don't support instructions longer than 64-bits yet.  Still, we can
14265         modify validate_riscv_insn function to prevent unexpected behavior by
14266         limiting the "length" of an instruction to 64-bit (or less).
14267
14268         gas/ChangeLog:
14269
14270                 * config/tc-riscv.c (validate_riscv_insn): Fix function
14271                 description comment based on current spec.  Limit instruction
14272                 length up to 64-bit for now.  Make sure that required_bits does
14273                 not corrupt even if unsigned long long is longer than 64-bit.
14274
14275 2022-10-28  Jan Beulich  <jbeulich@suse.com>
14276
14277         RISC-V/gas: fix build with certain gcc versions
14278         Some versions of gcc warn by default about shadowed outer-scope
14279         declarations. This affects frag_align_code, which is declared in
14280         frags.h. Rename the offending function parameter. While there also
14281         switch to using true/false at the function call sites.
14282
14283 2022-10-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
14284
14285         RISC-V: Fix build failure for -Werror=maybe-uninitialized
14286         Commit 40f1a1a4564b ("RISC-V: Output mapping symbols with ISA string.")
14287         caused a build failure on GCC 12 as follows:
14288
14289         make[3]: Entering directory '$(builddir)/gas'
14290           CC       config/tc-riscv.o
14291         In file included from $(srcdir)/gas/config/tc-riscv.c:23:
14292         $(srcdir)/gas/as.h: In function ‘make_mapping_symbol’:
14293         $(srcdir)/gas/as.h:123:15: error: ‘buff’ may be used uninitialized [-Werror=maybe-uninitialized]
14294           123 | #define xfree free
14295               |               ^~~~
14296         $(srcdir)/gas/config/tc-riscv.c:487:9: note: ‘buff’ was declared here
14297           487 |   char *buff;
14298               |         ^~~~
14299         cc1: all warnings being treated as errors
14300         make[3]: *** [Makefile:1425: config/tc-riscv.o] Error 1
14301
14302         This is caused by a false positive of "maybe uninitialized" variable
14303         detection (-Wmaybe-uninitialized).  To avoid this error, this commit
14304         initializes the local variable buff to NULL first in all cases.
14305
14306         gas/ChangeLog:
14307
14308                 * config/tc-riscv.c (make_mapping_symbol): Initialize variable
14309                 buff with NULL to avoid build failure caused by a GCC's false
14310                 positive of maybe uninitialized variable detection.
14311
14312 2022-10-28  Markus Metzger  <markus.t.metzger@intel.com>
14313
14314         gdb, btrace: fix family and model computation
14315         In gdb/nat/linux-btrace.c:btrace_this_cpu() we initialize the cpu
14316         structure given to the libipt btrace decoder.
14317
14318         We only consider the extended model field for family 0x6 and forget about
14319         family 0xf and we don't consider the extended family field.  Fix it.
14320
14321 2022-10-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
14322
14323         include: Define macro to ignore -Wdeprecated-declarations on GCC
14324         "-Wdeprecated-declarations" warning option can be helpful to track
14325         deprecated function delarations but sometimes we need to disable this
14326         warning for a good reason.
14327
14328         DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS is an existing macro but only
14329         defined on Clang.  Since "-Wdeprecated-declarations" is also available on
14330         GCC (>= 3.4.0), this commit adds equivalent definition as Clang.
14331
14332         __GNUC__ and __GNUC_MINOR__ are not checked because this header file seems
14333         to assume GCC >= 4.6 (with "GCC diagnostic push/pop").
14334
14335         include/ChangeLog:
14336
14337                 * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS):
14338                 Define also on GCC.
14339
14340 2022-10-28  Nelson Chu  <nelson@rivosinc.com>
14341
14342         RISC-V: Output mapping symbols with ISA string.
14343         RISC-V Psabi pr196,
14344         https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/196
14345
14346         bfd/
14347             * elfxx-riscv.c (riscv_release_subset_list): Free arch_str if needed.
14348             (riscv_copy_subset_list): Copy arch_str as well.
14349             * elfxx-riscv.h (riscv_subset_list_t): Store arch_str for each subset list.
14350         gas/
14351             * config/tc-riscv.c (riscv_reset_subsets_list_arch_str): Update the
14352             architecture string in the subset_list.
14353             (riscv_set_arch): Call riscv_reset_subsets_list_arch_str after parsing new
14354             architecture string.
14355             (s_riscv_option): Likewise.
14356             (need_arch_map_symbol): New boolean, used to indicate if .option
14357             directives do affect instructions.
14358             (make_mapping_symbol): New boolean parameter reset_seg_arch_str.  Need to
14359             generate $x+arch for MAP_INSN, and then store it into tc_segment_info_data
14360             if reset_seg_arch_str is true.
14361             (riscv_mapping_state): Decide if we need to add $x+arch for MAP_INSN.  For
14362             now, only add $x+arch if the architecture strings in subset list and segment
14363             are different.  Besides, always add $x+arch at the start of section, and do
14364             not add $x+arch for code alignment, since rvc for alignment can be judged
14365             from addend of R_RISCV_ALIGN.
14366             (riscv_remove_mapping_symbol): If current and previous mapping symbol have
14367             same value, then remove the current $x only if the previous is $x+arch;
14368             Otherwise, always remove previous.
14369             (riscv_add_odd_padding_symbol): Updated.
14370             (riscv_check_mapping_symbols): Don't need to add any $x+arch if
14371             need_arch_map_symbol is false, so changed them to $x.
14372             (riscv_frag_align_code): Updated since riscv_mapping_state is changed.
14373             (riscv_init_frag): Likewise.
14374             (s_riscv_insn): Likewise.
14375             (riscv_elf_final_processing): Call riscv_release_subset_list to release
14376             subset_list of riscv_rps_as, rather than only release arch_str in the
14377             riscv_write_out_attrs.
14378             (riscv_write_out_attrs): No need to call riscv_arch_str, just get arch_str
14379             from subset_list of riscv_rps_as.
14380             * config/tc-riscv.h (riscv_segment_info_type): Record current $x+arch mapping
14381             symbol of each segment.
14382             * testsuite/gas/riscv/mapping-0*: Merged and replaced by mapping.s.
14383             * testsuite/gas/riscv/mapping.s: New testcase, to test most of the cases in
14384             one file.
14385             * testsuite/gas/riscv/mapping-symbols.d: Likewise.
14386             * testsuite/gas/riscv/mapping-dis.d: Likewise.
14387             * testsuite/gas/riscv/mapping-non-arch.s: New testcase for the case that
14388             does need any $x+arch.
14389             * testsuite/gas/riscv/mapping-non-arch.d: Likewise.
14390             * testsuite/gas/riscv/option-arch-01a.d: Updated.
14391         opcodes/
14392             * riscv-dis.c (riscv_disassemble_insn): Set riscv_fpr_names back to
14393             riscv_fpr_names_abi or riscv_fpr_names_numeric when zfinx is disabled
14394             for some specfic code region.
14395             (riscv_get_map_state): Recognized mapping symbols $x+arch, and then reset
14396             the architecture string once the ISA is different.
14397
14398 2022-10-28  Lifang Xia  <lifang_xia@linux.alibaba.com>
14399
14400         binutils: Update my e-mail and Yunhai's e-mail
14401         binutils/
14402                 * MAINTAINERS(C-SKY): update e-mails of Lifang & Yunhai.
14403
14404 2022-10-28  Peter Bergner  <bergner@linux.ibm.com>
14405
14406         PowerPC: Add support for RFC02658 - MMA+ Outer-Product Instructions
14407         gas/
14408                 * config/tc-ppc.c (md_assemble): Only check for prefix opcodes.
14409                 * testsuite/gas/ppc/rfc02658.s: New test.
14410                 * testsuite/gas/ppc/rfc02658.d: Likewise.
14411                 * testsuite/gas/ppc/ppc.exp: Run it.
14412
14413         opcodes/
14414                 * ppc-opc.c (XMSK8, P_GERX4_MASK, P_GERX2_MASK, XX3GERX_MASK): New.
14415                 (powerpc_opcodes): Add dmxvi8gerx4pp, dmxvi8gerx4, dmxvf16gerx2pp,
14416                 dmxvf16gerx2, dmxvbf16gerx2pp, dmxvf16gerx2np, dmxvbf16gerx2,
14417                 dmxvi8gerx4spp, dmxvbf16gerx2np, dmxvf16gerx2pn, dmxvbf16gerx2pn,
14418                 dmxvf16gerx2nn, dmxvbf16gerx2nn, pmdmxvi8gerx4pp, pmdmxvi8gerx4,
14419                 pmdmxvf16gerx2pp, pmdmxvf16gerx2, pmdmxvbf16gerx2pp, pmdmxvf16gerx2np,
14420                 pmdmxvbf16gerx2, pmdmxvi8gerx4spp, pmdmxvbf16gerx2np, pmdmxvf16gerx2pn,
14421                 pmdmxvbf16gerx2pn, pmdmxvf16gerx2nn, pmdmxvbf16gerx2nn.
14422
14423 2022-10-28  Peter Bergner  <bergner@linux.ibm.com>
14424
14425         PowerPC: Add support for RFC02653 - Dense Math Facility
14426         gas/
14427                 * config/tc-ppc.c (pre_defined_registers): Add dense math registers.
14428                 (md_assemble): Check dmr specified in correct operand.
14429                 * testsuite/gas/ppc/outerprod.s <dmsetaccz, dmxvbf16ger2,
14430                 dmxvbf16ger2nn, dmxvbf16ger2np, dmxvbf16ger2pn, dmxvbf16ger2pp,
14431                 dmxvf16ger2, dmxvf16ger2nn, dmxvf16ger2np, dmxvf16ger2pn, dmxvf16ger2pp,
14432                 dmxvf32ger, dmxvf32gernn, dmxvf32gernp, dmxvf32gerpn, dmxvf32gerpp,
14433                 dmxvf64ger, dmxvf64gernn, dmxvf64gernp, dmxvf64gerpn, dmxvf64gerpp,
14434                 dmxvi16ger2, dmxvi16ger2pp, dmxvi16ger2s, dmxvi16ger2spp, dmxvi4ger8,
14435                 dmxvi4ger8pp, dmxvi8ger4, dmxvi8ger4pp, dmxvi8ger4spp, dmxxmfacc,
14436                 dmxxmtacc, pmdmxvbf16ger2, pmdmxvbf16ger2nn, pmdmxvbf16ger2np,
14437                 pmdmxvbf16ger2pn, pmdmxvbf16ger2pp, pmdmxvf16ger2, pmdmxvf16ger2nn,
14438                 pmdmxvf16ger2np, pmdmxvf16ger2pn, pmdmxvf16ger2pp, pmdmxvf32ger,
14439                 pmdmxvf32gernn, pmdmxvf32gernp, pmdmxvf32gerpn, pmdmxvf32gerpp,
14440                 pmdmxvf64ger, pmdmxvf64gernn, pmdmxvf64gernp, pmdmxvf64gerpn,
14441                 pmdmxvf64gerpp, pmdmxvi16ger2, pmdmxvi16ger2pp, pmdmxvi16ger2s,
14442                 pmdmxvi16ger2spp, pmdmxvi4ger8, pmdmxvi4ger8pp, pmdmxvi8ger4,
14443                 pmdmxvi8ger4pp, pmdmxvi8ger4spp>: Add new tests.
14444                 * testsuite/gas/ppc/outerprod.d: Likewise.
14445                 * testsuite/gas/ppc/rfc02653.s: New test.
14446                 * testsuite/gas/ppc/rfc02653.d: Likewise.
14447                 * testsuite/gas/ppc/ppc.exp: Run it.
14448
14449         include/
14450                 * opcode/ppc.h (PPC_OPERAND_DMR): Define.  Renumber following
14451                 PPC_OPERAND defines.
14452
14453         opcodes/
14454                 * ppc-dis.c (print_insn_powerpc): Prepend 'dm' when printing DMR regs.
14455                 * ppc-opc.c (insert_p2, (extract_p2, (insert_xa5, (extract_xa5,
14456                 insert_xb5, (extract_xb5): New functions.
14457                 (insert_xa6a, extract_xa6a, insert_xb6a, extract_xb6a): Disallow
14458                 operand overlap only on Power10.
14459                 (DMR, DMRAB, P1, P2, XA5p, XB5p, XDMR_MASK, XDMRDMR_MASK, XX2ACC_MASK,
14460                 XX2DMR_MASK, XX3DMR_MASK): New defines.
14461                 (powerpc_opcodes): Add dmmr, dmsetaccz, dmsetdmrz, dmxor, dmxvbf16ger2,
14462                 dmxvbf16ger2nn, dmxvbf16ger2np, dmxvbf16ger2pn, dmxvbf16ger2pp,
14463                 dmxvf16ger2, dmxvf16ger2nn, dmxvf16ger2np, dmxvf16ger2pn, dmxvf16ger2pp,
14464                 dmxvf32ger, dmxvf32gernn, dmxvf32gernp, dmxvf32gerpn, dmxvf32gerpp,
14465                 dmxvf64ger, dmxvf64gernn, dmxvf64gernp, dmxvf64gerpn, dmxvf64gerpp,
14466                 dmxvi16ger2, dmxvi16ger2pp, dmxvi16ger2s, dmxvi16ger2spp, dmxvi4ger8,
14467                 dmxvi4ger8pp, dmxvi8ger4, dmxvi8ger4pp, dmxvi8ger4spp, dmxxextfdmr256,
14468                 dmxxextfdmr512, dmxxinstdmr256, dmxxinstdmr512, dmxxmfacc, dmxxmtacc,
14469                 pmdmxvbf16ger2, pmdmxvbf16ger2nn, pmdmxvbf16ger2np, pmdmxvbf16ger2pn,
14470                 pmdmxvbf16ger2pp, pmdmxvf16ger2, pmdmxvf16ger2nn, pmdmxvf16ger2np,
14471                 pmdmxvf16ger2pn, pmdmxvf16ger2pp, pmdmxvf32ger, pmdmxvf32gernn,
14472                 pmdmxvf32gernp, pmdmxvf32gerpn, pmdmxvf32gerpp, pmdmxvf64ger,
14473                 pmdmxvf64gernn, pmdmxvf64gernp, pmdmxvf64gerpn, pmdmxvf64gerpp,
14474                 pmdmxvi16ger2, pmdmxvi16ger2pp, pmdmxvi16ger2s, pmdmxvi16ger2spp,
14475                 pmdmxvi4ger8, pmdmxvi4ger8pp, pmdmxvi8ger4, pmdmxvi8ger4pp,
14476                 pmdmxvi8ger4spp.
14477
14478 2022-10-28  GDB Administrator  <gdbadmin@sourceware.org>
14479
14480         Automatic date update in version.in
14481
14482 2022-10-27  Andrew Burgess  <aburgess@redhat.com>
14483
14484         sim/cgen: initialize variable at creation in engine_run_n
14485         Zero initialize engine_fns entirely at creation, then override those
14486         fields we intend to use, rather than zero just initializing the unused
14487         fields later on.
14488
14489         There should be no user visible changes after this commit.
14490
14491 2022-10-27  Tom de Vries  <tdevries@suse.de>
14492
14493         [gdb/testsuite] Remove address from test names
14494         I noticed an address in a test name:
14495         ...
14496         PASS: gdb.base/eh_return.exp: gdb_breakpoint: \
14497           set breakpoint at *0x000000000040071b
14498         ...
14499
14500         Stabilize the test name by using "set breakpoint on address" instead.
14501
14502         Likewise in two other test-cases.
14503
14504         Tested on x86_64-linux.
14505
14506 2022-10-27  Tom de Vries  <tdevries@suse.de>
14507
14508         [gdb/testsuite] Disable styling in host board local-remote-host-native.exp
14509         Propagate fix from commit 17c68d98f74 ("[gdb/testsuite] Disable styling in host
14510         board local-remote-host.exp") to local-remote-host-native.exp.
14511
14512         Tested on x86_64-linux.
14513
14514 2022-10-27  Tom de Vries  <tdevries@suse.de>
14515
14516         [gdb/testsuite] Fix silent timeouts in gdb.mi/mi-exec-run.exp with remote host
14517         I noticed that running test-case gdb.mi/mi-exec-run.exp with host board
14518         local-remote-host.exp takes about 44 seconds.
14519
14520         I found two silent timeouts responsible for this.
14521
14522         The first is in mi_gdb_exit, where we have:
14523         ...
14524             if { [is_remote host] && [board_info host exists fileid] } {
14525                 send_gdb "999-gdb-exit\n"
14526                 gdb_expect 10 {
14527                     -re "y or n" {
14528                         send_gdb "y\n"
14529                         exp_continue
14530                     }
14531                     -re "Undefined command.*$gdb_prompt $" {
14532                         send_gdb "quit\n"
14533                         exp_continue
14534                     }
14535                     -re "DOSEXIT code" { }
14536                 }
14537             }
14538         ...
14539         so in gdb.log we see:
14540         ...
14541         999-gdb-exit^M
14542         999^exit^M
14543         =thread-exited,id="1",group-id="i1"^M
14544         =thread-group-exited,id="i1"^M
14545         ...
14546         after which expect just waits for the timeout.
14547
14548         Fix this by adding a gdb_expect clause to parse the exit:
14549         ...
14550                     -re "\r\n999\\^exit\r\n" { }
14551         ...
14552
14553         Note that we're not parsing the thread-exited/thread-group-exited messages, because
14554         they may not be present:
14555         ...
14556         $ gdb -i=mi
14557         =thread-group-added,id="i1"
14558         (gdb)
14559         999-gdb-exit
14560         999^exit
14561         $
14562         ...
14563
14564         After fixing that, we have:
14565         ...
14566         (gdb) ^M
14567         saw mi error
14568         PASS: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: \
14569           force-fail=1: run failure detected
14570         quit^M
14571         &"quit\n"^M
14572         ...
14573
14574         What seems to be happening is that default_gdb_exit sends a cli interpreter
14575         quit command to an mi interpreter, after which again expect just waits for the
14576         timeout.
14577
14578         Fix this by adding mi_gdb_exit to the end of the test-case, as in many other
14579         gdb.mi/*.exp test-cases.
14580
14581         After these two fixes, the test-case takes about 4 seconds.
14582
14583         Tested on x86_64-linux.
14584
14585 2022-10-27  Tom de Vries  <tdevries@suse.de>
14586
14587         [gdb/testsuite] Use remote_exec chmod instead of remote_spawn
14588         I build gdb using -O2, and ran the testsuite using taskset -c 0, and ran into:
14589         ...
14590         (gdb) PASS: gdb.server/connect-with-no-symbol-file.exp: sysroot=: \
14591           action=delete: setup: adjust sysroot
14592         builtin_spawn gdbserver --once localhost:2385 /connect-with-no-symbol-file^M
14593         /bin/bash: connect-with-no-symbol-file: Permission denied^M
14594         /bin/bash: line 0: exec: connect-with-no-symbol-file: cannot execute: \
14595           Permission denied^M
14596         During startup program exited with code 126.^M
14597         Exiting^M
14598         target remote localhost:2385^M
14599         `connect-with-no-symbol-file' has disappeared; keeping its symbols.^M
14600         localhost:2385: Connection timed out.^M
14601         (gdb) FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=: \
14602           action=delete: connection to GDBserver succeeded
14603         ...
14604
14605         The expected series of events is (skipping disconnect and detach as I don't
14606         think they're relevant to the problem):
14607         - enter scenario "permission"
14608         - cp $exec.bak $exec
14609         - gdbserver start with $exec
14610         - chmod 000 $exec
14611         - connect to gdbserver
14612         - enter scenario "delete"
14613         - cp $exec.bak $exec
14614         - gdbserver start with $exec
14615         - delete $exec
14616         - connect to gdbserver
14617
14618         The problem is that the chmod is executed using remote_spawn:
14619         ...
14620                } elseif { $action == "permission" } {
14621                  remote_spawn target "chmod 000 $target_exec"
14622                }
14623         ...
14624         without waiting on the resulting spawn id, so we're not sure when the
14625         chmod will have effect.
14626
14627         The FAIL we're seeing above is explained by the chmod having effect during the
14628         delete scenario, after the "cp $exec.bak $exec" and before the "gdbserver
14629         start with $exec".
14630
14631         Fix this by using remote_exec instead.
14632
14633         Likewise, fix a similar case in gdb.mi/mi-exec-run.exp.
14634
14635         Tested on x86_64-linux.
14636
14637         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29726
14638
14639 2022-10-27  Nelson Chu  <nelson@rivosinc.com>
14640
14641         RISC-V: Fix build failures for -Werror=sign-compare.
14642         elfnn-riscv.c: In function ‘riscv_relax_resolve_delete_relocs’:
14643         elfnn-riscv.c:4256:30: error: operand of ‘?:’ changes signedness from ‘int’ to ‘unsigned int’ due to unsignedness of other operand [-Werror=sign-compare]
14644
14645         So make the operands unsigned could resolve problem.
14646
14647         bfd/
14648             * elfnn-riscv.c (riscv_relax_resolve_delete_relocs): Fixed build
14649             failures for -Werror=sign-compare.
14650
14651 2022-10-27  Alan Modra  <amodra@gmail.com>
14652
14653         Fuzzed files in archives
14654         Given a fuzzed object file in an archive with section size exceeding
14655         file size, objcopy will report an error like "section size (0xfeffffff
14656         bytes) is larger than file size (0x17a bytes)" but will create a copy
14657         of the object laid out for the large section.  That means a large
14658         temporary file on disk that is read back and written to the output
14659         archive, which can take a while.  The output archive is then deleted
14660         due to the error.  Avoid some of this silliness.
14661
14662                 * objcopy.c (copy_section): If section contents cannot be read
14663                 set output section size to zero.
14664
14665 2022-10-27  Martin Liska  <mliska@suse.cz>
14666
14667         tests: use canonical option name
14668         ld/ChangeLog:
14669
14670                 * testsuite/ld-size/size.exp: Use canonical option name.
14671
14672 2022-10-27  Alan Modra  <amodra@gmail.com>
14673
14674         re: Support Intel AMX-FP16
14675         Fix these fails due to the target padding out sections with nops.
14676         x86_64-w64-mingw32  +FAIL: x86_64 AMX-FP16 insns
14677         x86_64-w64-mingw32  +FAIL: x86_64 AMX-FP16 insns (Intel disassembly)
14678
14679                 * testsuite/gas/i386/x86-64-amx-fp16-intel.d: Accept trailing nops.
14680                 * testsuite/gas/i386/x86-64-amx-fp16.d: Likewise.
14681
14682 2022-10-27  Alan Modra  <amodra@gmail.com>
14683
14684         Re: ld/testsuite: adjust ld-arm to run shared tests only when supported
14685         commit 67527cffcd enabled previously disabled tests unresolved-1-dyn,
14686         thumb-plt and thumb-plt-got for nacl.  The first fails due to trying
14687         to link against mixed-lib.so which isn't compiled for nacl.  The last
14688         two fail with
14689         objdump: tmpdir/dump(.rel.plt): relocation 0 has invalid symbol index 14885104
14690         and
14691         readelf: Error:  bad symbol index: 00e320f0 in reloc
14692
14693         Relocation section '.rel.plt' at offset 0x128 contains 1 entry:
14694          Offset     Info    Type                Sym. Value  Symbol's Name
14695         e320f000  e320f000 R_ARM_NONE
14696
14697                 * testsuite/ld-arm/arm-elf.exp: Disable unresolved-1-dyn,
14698                 thumb-plt and thumb-plt-got for nacl.
14699
14700 2022-10-27  GDB Administrator  <gdbadmin@sourceware.org>
14701
14702         Automatic date update in version.in
14703
14704 2022-10-26  Simon Marchi  <simon.marchi@efficios.com>
14705
14706         gdb/testsuite: fix gdb.guile/scm-parameter.exp "wrong type argument" test pattern for Guile >= 2.2
14707         Since commit 90319cefe3 ("GDB/Guile: Don't assert that an integer value
14708         is boolean"), I see:
14709
14710             FAIL: gdb.guile/scm-parameter.exp: kind=PARAM_ZINTEGER: test-PARAM_ZINTEGER-param: guile (set-parameter-value! test-PARAM_ZINTEGER-param #:unlimited)
14711             FAIL: gdb.guile/scm-parameter.exp: kind=PARAM_ZUINTEGER: test-PARAM_ZUINTEGER-param: guile (set-parameter-value! test-PARAM_ZUINTEGER-param #:unlimited)
14712
14713         This comes from the fact that GDB outputs this:
14714
14715             ERROR: In procedure set-parameter-value!:
14716             In procedure gdbscm_set_parameter_value_x: Wrong type argument in position 2 (expecting integer): #:unlimited
14717             Error while executing Scheme code.
14718
14719         while the test expects an additional "ERROR:" on the second line,
14720         something like this:
14721
14722             ERROR: In procedure set-parameter-value!:
14723             ERROR: In procedure gdbscm_set_parameter_value_x: Wrong type argument in position 2 (expecting integer): #:unlimited
14724             Error while executing Scheme code.
14725
14726         Guile 2.0 outputs the `ERROR:` on the second line, while later versions
14727         do not.  Change the pattern to accept both outputs.  This is similar to
14728         commit 6bbe1a929c6 ("[gdb/testsuite] Fix gdb.guile/scm-breakpoint.exp
14729         with guile 3.0").
14730
14731         Change-Id: I9dc45e7492a4f08340cad974610242ed689de959
14732
14733 2022-10-26  Luis Machado  <luis.machado@arm.com>
14734
14735         gdb/arm: Fix M-profile EXC_RETURN
14736         Arm v8-M Architecture Reference Manual,
14737         D1.2.95 EXC_RETURN, Exception Return Payload
14738         describes ES bit:
14739
14740         "ES, bit [0]
14741              Exception Secure. The security domain the exception was taken to.
14742              The possible values of this bit are:
14743                0 Non-secure.
14744                1 Secure"
14745
14746         arm-tdep.c:3443, arm_m_exception_cache () function tests this bit:
14747
14748           exception_domain_is_secure = (bit (lr, 0) == 0);
14749
14750         The test is negated!
14751
14752         Later on line 3553, the condition evaluates if an additional state
14753         context is stacked:
14754
14755           /* With the Security extension, the hardware saves R4..R11 too.  */
14756           if (tdep->have_sec_ext && secure_stack_used
14757               && (!default_callee_register_stacking || exception_domain_is_secure))
14758
14759         RM, B3.19 Exception entry, context stacking
14760         reads:
14761         RPLHM "In a PE with the Security Extension, on taking an exception,
14762         the PE hardware:
14763           ...
14764           2. If exception entry requires a transition from Secure state to
14765              Non-secure state, the PE hardware extends the stack frame and also
14766              saves additional state context."
14767
14768         So we should test for !exception_domain_is_secure instead of non-negated
14769         value!
14770         These two bugs compensate each other so unstacking works correctly.
14771
14772         But another test of exception_domain_is_secure (negated due to the
14773         first bug) prevents arm_unwind_secure_frames to work as expected:
14774
14775           /* Unwinding from non-secure to secure can trip security
14776              measures.  In order to avoid the debugger being
14777              intrusive, rely on the user to configure the requested
14778              mode.  */
14779           if (secure_stack_used && !exception_domain_is_secure
14780               && !arm_unwind_secure_frames)
14781
14782         Test with GNU gdb (GDB) 13.0.50.20221016-git.
14783         Stopped in a non-secure handler:
14784
14785          (gdb) set arm unwind-secure-frames 0
14786          (gdb) bt
14787          #0  HAL_SYSTICK_Callback () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/NonSecure/Src/nsmain.c:490
14788          #1  0x0804081c in SysTick_Handler ()
14789              at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/NonSecure/Src/nsstm32l5xx_it.c:134
14790          #2  <signal handler called>
14791          #3  HAL_GPIO_ReadPin (GPIOx=0x52020800, GPIO_Pin=8192)
14792              at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Drivers/STM32L5xx_HAL_Driver/Src/stm32l5xx_hal_gpio.c:386
14793          #4  0x0c000338 in SECURE_Mode () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/main.c:86
14794          #5  0x080403f2 in main () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/NonSecure/Src/nsmain.c:278
14795          Backtrace stopped: previous frame inner to this frame (corrupt stack?)
14796
14797         The frames #3 and #4 are secure. backtrace should stop before #3.
14798
14799         Stopped in a secure handler:
14800
14801          (gdb) bt
14802          #0  HAL_SYSTICK_Callback () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/main.c:425
14803          #1  0x0c000b6a in SysTick_Handler ()
14804              at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/stm32l5xx_it.c:234
14805          warning: Non-secure to secure stack unwinding disabled.
14806          #2  <signal handler called>
14807
14808         The exception from secure to secure erroneously stops unwinding. It should
14809         continue as far as the security unlimited backtrace:
14810
14811          (gdb) set arm unwind-secure-frames 1
14812          (gdb) si <-- used to rebuild frame cache after change of unwind-secure-frames
14813          0x0c0008e6      425       if (SecureTimingDelay != 0U)
14814          (gdb) bt
14815          #0  0x0c0008e6 in HAL_SYSTICK_Callback () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/main.c:425
14816          #1  0x0c000b6a in SysTick_Handler ()
14817              at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/stm32l5xx_it.c:234
14818          #2  <signal handler called>
14819          #3  0x0c000328 in SECURE_Mode () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/main.c:88
14820          #4  0x080403f2 in main () at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/NonSecure/Src/nsmain.c:278
14821
14822          Backtrace stopped: previous frame inner to this frame (corrupt stack?)
14823
14824         Set exception_domain_is_secure to the value expected by its name.
14825         Fix exception_domain_is_secure usage in the additional state context
14826         stacking condition.
14827
14828 2022-10-26  Luis Machado  <luis.machado@arm.com>
14829
14830         gdb/arm: fix IPSR field test in arm_m_exception_cache ()
14831         Arm v8-M Architecture Reference Manual,
14832         D1.2.141 IPSR, Interrupt Program Status Register reads
14833         "Exception, bits [8:0]"
14834
14835         9 bits, not 8! It is uncommon but true!
14836
14837 2022-10-26  Luis Machado  <luis.machado@arm.com>
14838
14839         gdb/arm: Terminate frame unwinding in M-profile lockup
14840         In the lockup state the PC value of the the outer frame is irreversibly
14841         lost. The other registers are intact so LR likely contains
14842         PC of some frame next to the outer one, but we cannot analyze
14843         the nearest outer frame without knowing its PC
14844         therefore we do not know SP fixup for this frame.
14845
14846         The frame unwinder possibly gets mad due to the wrong SP value.
14847         To prevent problems terminate unwinding if PC contains the magic
14848         value of the lockup state.
14849
14850         Example session wihtout this change,
14851         Cortex-M33 CPU in lockup, gdb 13.0.50.20221016-git:
14852         ----------------
14853           (gdb) c
14854           Continuing.
14855
14856           Program received signal SIGINT, Interrupt.
14857           0xeffffffe in ?? ()
14858           (gdb) bt
14859           #0  0xeffffffe in ?? ()
14860           #1  0x0c000a9c in HardFault_Handler ()
14861               at C:/dvl/stm32l5trustzone/GPIO_IOToggle_TrustZone/Secure/Src/stm32l5xx_it.c:99
14862           #2  0x2002ffd8 in ?? ()
14863           Backtrace stopped: previous frame identical to this frame (corrupt stack?)
14864           (gdb)
14865         ----------------
14866         The frame #1 is at correct PC taken from LR, #2 is a total nonsense.
14867
14868         With the change:
14869         ----------------
14870           (gdb) c
14871           Continuing.
14872
14873           Program received signal SIGINT, Interrupt.
14874           warning: ARM M in lockup state, stack unwinding terminated.
14875           <signal handler called>
14876           (gdb) bt
14877           #0  <signal handler called>
14878           (gdb)
14879         ----------------
14880
14881         There is a visible drawback of emitting a warning in a cache buildnig routine
14882         as introduced in Torbjörn SVENSSON's
14883         [PATCH v4] gdb/arm: Stop unwinding on error, but do not assert
14884         The warning is printed just once and not repeated on each backtrace command.
14885
14886 2022-10-26  Mike Frysinger  <vapier@gentoo.org>
14887
14888         gdb: copyright: make file header scan a bit more pythonic
14889         Should be functionally the same, but uses more pythonic idioms to get
14890         fewer lines of code, and to make sure to not leak open file handles.
14891
14892         Approved-By: Simon Marchi <simon.marchi@efficios.com>
14893
14894 2022-10-26  Mike Frysinger  <vapier@gentoo.org>
14895
14896         gdb: make copyright.py interface a bit nicer
14897         This way people can run `./copyright.py --help` and get some info as
14898         to what this does without it going and modifying the tree.
14899
14900         sim: testsuite: improve parallel test processing
14901         The current logic limits itself to a maxdepth of 4 when looking for
14902         results.  This wouldn't be a problem if cris didn't have a testsuite
14903         at a depth of 5 which we end up ignoring when summarizing.  Rather
14904         than bump the number from 4 to 5, rework the code so that we gather
14905         the exact set of tests that we tried to run.
14906
14907 2022-10-26  Alan Modra  <amodra@gmail.com>
14908
14909         buffer overflow in _bfd_XX_print_ce_compressed_pdata
14910         More fuzzed fun.
14911
14912                 * peXXigen.c (_bfd_XX_print_ce_compressed_pdata): Use smaller of
14913                 virt_size and bfd section size as limit of function table.
14914
14915 2022-10-26  Alan Modra  <amodra@gmail.com>
14916
14917         Correct ELF reloc size sanity check
14918         The external reloc size check was wrong.  Here asect is the code/data
14919         section, not the reloc section.  So using this_hdr gave the size of
14920         the code/data section.
14921
14922                 * elf.c (_bfd_elf_get_reloc_upper_bound): Properly get
14923                 external size from reloc headers.
14924
14925 2022-10-26  Alan Modra  <amodra@gmail.com>
14926
14927         segfault in objdump.c reloc_at
14928         bfd_canonicalize_reloc returns -1L on errors.
14929
14930                 * objdump.c (load_specific_debug_section): Properly handle
14931                 error return from bfd_canonicalize_reloc.
14932
14933 2022-10-26  Alan Modra  <amodra@gmail.com>
14934
14935         som.c reloc sanity checking
14936         This patch checks that relocations emitted in som_write_fixups have
14937         offsets that are monotonic and within a section.  To do that properly
14938         using bfd_reloc_offset_in_range it is necessary to set the reloc howto
14939         size field, which isn't used otherwise by the som backend.  Note that
14940         the sizes used are not exactly those in the old sizing switch
14941         statement deleted from som_write_fixups, but all relocs handled by the
14942         main switch statement there get the same size.  Most unhandled relocs
14943         get a zero size (exceptions being R_RELOCATION, R_SPACE_REF,
14944         R_MILLI_REL, R_BREAKPOINT which all involve writing one word according
14945         to my SOM reference).  I figure it doesn't matter since any unhandled
14946         reloc is converted to 0xff R_RESERVED, and a default of zero is better
14947         for a "don't know" reloc.
14948
14949         Besides tidying the code, stringizing name from type in SOM_HOWTO
14950         fixes R_REPEATED_INIT name.
14951
14952                 * som.c (SOM_HOWTO): Add SIZE arg, delete NAME.  Stringize type
14953                 to name.
14954                 (som_hppa_howto_table): Update with sizes.
14955                 (som_write_fixups): Delete sizing switch statement.  Sanity check
14956                 bfd_reloc address against subsection size.
14957
14958 2022-10-26  Alan Modra  <amodra@gmail.com>
14959
14960         som.c buffer overflow
14961         Fuzzed object files can put random values in bfd_reloc->address,
14962         leading to large som_reloc_skip output.
14963
14964                 * som.c (som_write_fixups): Allow for maximal som_reloc_skip.
14965
14966 2022-10-26  Alan Modra  <amodra@gmail.com>
14967
14968         PR29720, objdump -S crashes if build-id is missing
14969                 PR 29720
14970                 * objdump.c (slurp_file): Don't call debuginfod_find_source
14971                 when build_id is NULL.
14972
14973 2022-10-26  GDB Administrator  <gdbadmin@sourceware.org>
14974
14975         Automatic date update in version.in
14976
14977 2022-10-25  Simon Marchi  <simon.marchi@efficios.com>
14978
14979         gdb: remove spurious spaces after frame_info_ptr
14980         Fix some whitespace issues introduced with the frame_info_ptr patch.
14981
14982         Change-Id: I158d30d8108c97564276c647fc98283ff7b12163
14983
14984 2022-10-25  Michael Matz  <matz@suse.de>
14985
14986         x86-64: Use only one default max-page-size
14987         On x86-64 the default ELF_MAXPAGESIZE depends on a configure
14988         option (--disable-separate-code).  Since 9833b775
14989         ("PR28824, relro security issues") we use max-page-size for relro
14990         alignment (with a short interval, from 31b4d3a ("PR28824, relro
14991         security issues, x86 keep COMMONPAGESIZE relro") to its revert
14992         a1faa5ea, where x86-64 only used COMMONPAGESIZE as relro alignment
14993         target).
14994
14995         But that means that a linker configured with --disable-separate-code
14996         behaves different from one configured with --enable-separate-code
14997         (the default), _even if using "-z {no,}separate-code" option to use
14998         the non-configured behaviour_ .  In particular it means that when
14999         configuring with --disable-separate-code the linker will produce
15000         binaries aligned to 2MB pages on disk, and hence generate 2MB
15001         executables for a hello world (and even 6MB when linked with
15002         "-z separate-code").
15003
15004         Generally we can't have constants that ultimately land in static
15005         variables be depending on configure options if those only influence
15006         behaviour that is overridable by command line options.
15007
15008         So, do away with that, make the default MAXPAGESIZE be 4k (as is default
15009         for most x86-64 configs anyway, as most people won't configure with
15010         --disable-separate-code).  If people need more they can use the
15011         "-z max-page-size" (with would have been required right now for a
15012         default configure binutils).
15013
15014         bfd/
15015                 * elf64-x86-64.c (ELF_MAXPAGESIZE): Don't depend on
15016                 DEFAULT_LD_Z_SEPARATE_CODE.
15017
15018 2022-10-25  Simon Marchi  <simon.marchi@efficios.com>
15019
15020         gdb/testsuite: make sure to consume the prompt in gdb.base/unwind-on-each-insn.exp
15021         This test fails quite reliably for me when ran as:
15022
15023             $ taskset -c 1 make check TESTS="gdb.base/unwind-on-each-insn.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
15024
15025         or more simply:
15026
15027             $ make check-read1 TESTS="gdb.base/unwind-on-each-insn.exp"
15028
15029         The problem is that the gdb_test_multiple call that grabs the frame id
15030         from "maint print frame-id" does not consume the prompt.  Well, it does
15031         sometimes due to the trailing .*, but not always.  If the prompt is not
15032         consumed, the tests that follow get confused:
15033
15034             FAIL: gdb.base/unwind-on-each-insn.exp: gdb_breakpoint: set breakpoint at *foo
15035             FAIL: gdb.base/unwind-on-each-insn.exp: disassemble foo
15036             FAIL: gdb.base/unwind-on-each-insn.exp: get $sp and frame base in foo: get hexadecimal valueof "$sp"
15037             ... many more ...
15038
15039         Use -wrap to make gdb_test_multiple consume the prompt.
15040
15041         While at it, remove the bit that consumes the command name and do
15042         exp_continue, it's not really necessary.  And for consistency, do the
15043         same changes to the gdb_test_multiple that consumes the stack address,
15044         although that one was fine, it did consume the prompt explicitly.
15045
15046         Change-Id: I2b7328c8844c7e98921ea494c4c05107162619fc
15047         Reviewed-By: Bruno Larsen <blarsen@redhat.com>
15048
15049 2022-10-25  Tom de Vries  <tdevries@suse.de>
15050
15051         [gdb/testsuite] Handle missing .note.GNU-stack
15052         On openSUSE Tumbleweed I run into this for the dwarf assembly test-cases, and
15053         some hardcoded assembly test-cases:
15054         ...
15055          Running gdb.dwarf2/fission-absolute-dwo.exp ...
15056          gdb compile failed, ld: warning: fission-absolute-dwo.o: \
15057            missing .note.GNU-stack section implies executable stack
15058          ld: NOTE: This behaviour is deprecated and will be removed in a future \
15059            version of the linker
15060
15061                          === gdb Summary ===
15062
15063          # of untested testcases         1
15064         ...
15065
15066         Fix the dwarf assembly test-cases by adding the missing .note.GNU-stack in
15067         proc Dwarf::assemble.
15068
15069         Fix the hard-coded test-cases using this command:
15070         ...
15071         $ for f in $(find gdb/testsuite/gdb.* -name *.S); do
15072             if ! grep -q note.GNU-stack $f; then
15073               echo -e "\t.section\t.note.GNU-stack,\"\",@progbits" >> $f;
15074             fi;
15075           done
15076         ...
15077
15078         Likewise for .s files, and gdb/testsuite/lib/my-syscalls.S.
15079
15080         The idiom for arm seems to be to use %progbits instead, see commit 9a5911c08be
15081         ("gdb/testsuite/gdb.dwarf2: Replace @ with % for ARM compatability"), so
15082         hand-edit gdb/testsuite/gdb.arch/arm-disp-step.S to use %progbits instead.
15083
15084         Note that dwarf assembly testcases use %progbits as decided by proc _section.
15085
15086         Tested on x86_64-linux.
15087
15088         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29674
15089
15090 2022-10-25  Tom de Vries  <tdevries@suse.de>
15091
15092         [gdb/testsuite] Add missing skip_gdbserver_tests in gdb.multi/attach-no-multi-process.exp
15093         I build gdb without gdbserver, and ran into:
15094         ...
15095         (gdb) PASS: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: \
15096           switch to inferior 2
15097         spawn of  --once --multi localhost:2346 failed
15098         ERROR: tcl error sourcing attach-no-multi-process.exp.
15099         ERROR: tcl error code NONE
15100         ERROR: Timeout waiting for gdbserver response.
15101         ...
15102
15103         Add the missing skip_gdbserver_tests.
15104
15105         Tested on x86_64-linux.
15106
15107 2022-10-25  Tom de Vries  <tdevries@suse.de>
15108
15109         [gdb] Rewrite RETHROW_ON_TARGET_CLOSE_ERROR into function
15110         Recent commit b2829fcf9b5 ("[gdb] Fix rethrow exception slicing in
15111         insert_bp_location") introduced macro RETHROW_ON_TARGET_CLOSE_ERROR.
15112
15113         I wrote this as a macro in order to have the rethrowing throw be part of the
15114         same function as the catch, but as it turns out that's not necessary.
15115
15116         Rewrite into a function.
15117
15118         Tested on x86_64-linux.
15119
15120 2022-10-25  Simon Marchi  <simon.marchi@polymtl.ca>
15121
15122         gdb: internal_error -> internal_error_loc in gdb-gdb.gdb.in
15123         Commit f34652de0b ("internal_error: remove need to pass
15124         __FILE__/__LINE__") renamed the internal_error function to
15125         internal_error_loc.  Change gdb-gdb.gdb.in accordingly.
15126
15127         Change-Id: I876e1623607b6becf74ade53d102ead53a74ed86
15128
15129 2022-10-25  Nelson Chu  <nelson@rivosinc.com>
15130
15131         RISC-V: Should reset `again' flag for _bfd_riscv_relax_pc.
15132         The R_RISCV_DELETE relocations are no longer deleted at another relax pass,
15133         so we should reset 'again' flag to true for _bfd_riscv_relax_pc, while the
15134         deleted bytes are marked as R_RISCV_DELETE.
15135
15136         bfd/
15137             * elfnn-riscv.c (_bfd_riscv_relax_pc): Set `again' to true while the
15138             deleted bytes are marked as R_RISCV_DELETE.
15139
15140 2022-10-25  Patrick O'Neill  <patrick@rivosinc.com>
15141
15142         RISC-V: Improve link time complexity.
15143         The riscv port does deletion and symbol table update for each relocation
15144         while relaxing, so we are moving section bytes and scanning symbol table once
15145         for each relocation.  Compared to microblaze port, they record the relaxation
15146         changes into a table, then do the deletion and symbol table update once per
15147         section, rather than per relocation.  Therefore, they should have better link
15148         time complexity than us.
15149
15150         To improve the link time complexity, this patch try to make the deletion in
15151         linear time.  Compared to record the relaxation changes into a table, we
15152         replace the unused relocation with R_RISCV_DELETE for the deleted bytes, and
15153         then resolve them at the end of the section.  Assuming the number of
15154         R_RISCV_DELETE is m, and the number of symbols is n, the total link complexity
15155         should be O(m) for moving section bytes, and O(m*n^2) for symbol table update.
15156         If we record the relaxation changes into the table, and then sort the symbol
15157         table by values, then probably can reduce the time complexity to O(m*n*log(n))
15158         for updating symbol table, but it doesn't seem worth it for now.
15159
15160         bfd/
15161             * elfnn-riscv.c (_riscv_relax_delete_bytes): Renamed from
15162             riscv_relax_delete_bytes, updated to reduce the tiem complexity to O(m)
15163             for memmove.
15164             (typedef relax_delete_t): Function pointer declaration of delete functions.
15165             (riscv_relax_delete_bytes): Can choose to use _riscv_relax_delete_piecewise
15166             or _riscv_relax_delete_immediate for deletion.
15167             (_riscv_relax_delete_piecewise): Just mark the deleted bytes as R_RISCV_DELETE.
15168             (_riscv_relax_delete_immediate): Delete some bytes from a section while
15169             relaxing.
15170             (riscv_relax_resolve_delete_relocs): Delete the bytes for R_RISCV_DELETE
15171             relocations from a section, at the end of _bfd_riscv_relax_section.
15172             (_bfd_riscv_relax_call): Mark deleted bytes as R_RISCV_DELETE by reusing
15173             R_RISCV_RELAX.
15174             (_bfd_riscv_relax_lui): Likewise, but reuse R_RISCV_HI20 for lui, and reuse
15175             R_RISCV_RELAX for c.lui.
15176             (_bfd_riscv_relax_tls_le): Likewise, but resue R_RISCV_TPREL_HI20 and
15177             R_RISCV_TPREL_ADD.
15178             (_bfd_riscv_relax_pc): Likewise, but resue R_RISCV_PCREL_HI20 for auipc.
15179             (_bfd_riscv_relax_align): Updated, don't need to resue relocation since
15180             calling _riscv_relax_delete_immediate.
15181             (_bfd_riscv_relax_delete): Removed.
15182             (_bfd_riscv_relax_section): Set riscv_relax_delete_bytes for each relax_func,
15183             to delete bytes immediately or later.  Call riscv_relax_resolve_delete_relocs
15184             to delete bytes for DELETE relocations from a section.
15185
15186 2022-10-25  GDB Administrator  <gdbadmin@sourceware.org>
15187
15188         Automatic date update in version.in
15189
15190 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15191
15192         gdb/doc: reword description of DisassembleInfo.read_memory
15193         While reading the documentation of DisassembleInfo.read_memory I
15194         spotted the word 'available' in one sentence where it didn't make
15195         sense.
15196
15197 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15198
15199         sim/lm32: fix some missing function declaration warnings
15200         In the lm32 simulator, I was seeing some warnings about missing
15201         function declarations.
15202
15203         The lm32 simulator has a weird header structure, in order to pull in
15204         the full cpu.h header we need to define WANT_CPU_LM32BF.  This is done
15205         in some files, but not in others.  Critically, it's not done in some
15206         files that then use functions declared in cpu.h
15207
15208         In this commit I added the missing #define so that the full cpu.h can
15209         be included.
15210
15211         After doing this there are still a few functions that are used
15212         undeclared, these functions appear to be missing any declarations at
15213         all, so I've added some to cpu.h.
15214
15215         With this done all the warnings when compiling lm32 are resolved for
15216         both gcc and clang, so I've removed the SIM_WERROR_CFLAGS line from
15217         Makefile.in, this allows lm32 to build with -Werror.
15218
15219 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15220
15221         sim/h8300: avoid self assignment
15222         There are two places in the h8300 simulator where we assign a variable
15223         to itself.  Clang gives a warning for this, which is converted into an
15224         error by -Werror.
15225
15226         Silence the warning by removing the self assignments.  As these
15227         assignments were in a complex if/then/else tree, rather than try to
15228         adjust all the conditions, I've just replaced the self assignments
15229         with a comment and an empty statement.
15230
15231 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15232
15233         sim/aarch64: remove two unused functions
15234         These functions are not used.  Clang warns about the unused functions,
15235         which is then converted into an error by -Werror.
15236
15237         Delete the unused functions.
15238
15239 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15240
15241         sim/ppc: fix for operator precedence warning from clang
15242         In the ppc simulator, clang was warning about some code like this:
15243
15244           busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
15245
15246         The warning was:
15247
15248           operator '?:' has lower precedence than '+'; '+' will be evaluated first
15249
15250         I suspect that this is not the original authors intention.
15251         PPC_ONE_BIT_SET_P is going to be 0 or 1, so if we evaluate the '+'
15252         first, the condition will always be non-zero, so true.  The whole
15253         expression could then be simplified to just '1', which doesn't make
15254         much sense.
15255
15256         I suspect the answer the author was expecting was either 2 or 3.  Why
15257         they didn't just write:
15258
15259           busy_ptr->nr_writebacks = (PPC_ONE_BIT_SET_P(out_vmask)) ? 2 : 3;
15260
15261         I have no clue, however, to keep the structure of the code unchanged,
15262         I've updated things to:
15263
15264           busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P (out_vmask) ? 1 : 2);
15265
15266         which silences the warning from clang, and is, I am guessing, what the
15267         original author intended.
15268
15269 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15270
15271         sim/ppc: initialize a memory buffer in all cases
15272         In the ppc simulator's do_fstat function, which provides the fstat
15273         call for the simulator, if the fstat is going to fail then we
15274         currently write an uninitialized buffer into the simulated target.
15275
15276         In theory, I think this is fine, we also write the error status into
15277         the simulated target, so, given that the fstat has failed, the target
15278         shouldn't be relying on the buffer contents.
15279
15280         However, writing an uninitialized buffer means we might leak simulator
15281         private data into the simulated target, which is probably a bad thing.
15282         Plus it probably makes life easier if something consistent, like all
15283         zeros, is written rather than random junk, which might look like a
15284         successful call (except for the error code).
15285
15286         So, in this commit, I initialize the stat buffer to zero before
15287         it is potentially used.  If the stat call is not made then the buffer
15288         will be left initialized as all zeros.
15289
15290 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15291
15292         sim/ppc: don't try to print an uninitialized variable
15293         The ppc simulator, in sim_create_inferior, tries to print the function
15294         local entry_point variable before the variable is initialized.
15295
15296         In this commit, I defer the debug print line until the variable has
15297         been initialized.
15298
15299 2022-10-24  Andrew Burgess  <aburgess@redhat.com>
15300
15301         sim/sh: use fabs instead of abs
15302         The sh simulator incorrectly uses integer abs instead of the floating
15303         point fabs on some floating point values, fixed in this commit.
15304
15305 2022-10-24  Tom de Vries  <tdevries@suse.de>
15306
15307         [gdb] Fix rethrow exception slicing in insert_bp_location
15308         The preferred way of rethrowing an exception is by using throw without
15309         expression, because it avoids object slicing of the exception [1].
15310
15311         Fix this in insert_bp_location.
15312
15313         Tested on x86_64-linux.
15314
15315         [1] https://en.cppreference.com/w/cpp/language/throw
15316
15317         Approved-By: Andrew Burgess <aburgess@redhat.com>
15318
15319 2022-10-24  Tom de Vries  <tdevries@suse.de>
15320
15321         [gdb] Fix rethrow exception slicing in pretty_print_insn
15322         The preferred way of rethrowing an exception is by using throw without
15323         expression, because it avoids object slicing of the exception [1].
15324
15325         Fix this in gdb_pretty_print_disassembler::pretty_print_insn.
15326
15327         Tested on x86_64-linux.
15328
15329         [1] https://en.cppreference.com/w/cpp/language/throw
15330
15331         Approved-By: Andrew Burgess <aburgess@redhat.com>
15332
15333 2022-10-24  Clément Chigot  <chigot@adacore.com>
15334
15335         ld/testsuite: adjust ld-arm to run shared tests only when supported
15336         If a custom arm-elf target is disabling the shared support, a lot of
15337         failures are reported by the testsuite.
15338         Moreover, some tests try to access libraries which have been explicitly
15339         skipped earlier (eg mixed-lib.so).
15340
15341         ld/ChangeLog:
15342
15343                 * testsuite/ld-arm/arm-elf.exp: Separate tests needing shared
15344                 lib support.
15345
15346 2022-10-24  Clément Chigot  <chigot@adacore.com>
15347
15348         ld/testsuite: skip ld-elf/exclude when -shared is not supported
15349         ld/ChangeLog:
15350
15351                 * testsuite/ld-elf/exclude.exp: Call check_shared_lib_support.
15352                 to skip for all targets without shared lib support.
15353
15354 2022-10-24  Jan Beulich  <jbeulich@suse.com>
15355
15356         x86: consolidate VPCLMUL tests
15357         There's little point in having Intel syntax disassembler tests when the
15358         purpose of a test is assembler functionality: Drop all
15359         *avx512*_vpclmulqdq-wig1-intel.
15360
15361         For *avx512*_vpclmulqdq-wig1 share source with *avx512*_vpclmulqdq.
15362
15363         Finally put in place similar tests for -mvexwig=1.
15364
15365 2022-10-24  Jan Beulich  <jbeulich@suse.com>
15366
15367         x86: consolidate VAES tests
15368         There's little point in having Intel syntax disassembler tests when the
15369         purpose of a test is assembler functionality: Drop all
15370         *avx512*_vaes-wig1-intel.
15371
15372         For *avx512*_vaes-wig1 share source with *avx512*_vaes. This in
15373         particular makes sure that the 32-bit VL test actually tests any EVEX
15374         encodings in the first place.
15375
15376         Finally put in place similar tests for -mvexwig=1.
15377
15378 2022-10-24  Jan Beulich  <jbeulich@suse.com>
15379
15380         x86: emit {evex} prefix when disassembling ambiguous AVX512VL insns
15381         When no AVX512-specific functionality is in use, the disassembly of
15382         AVX512VL insns is indistinguishable from their AVX counterparts (if such
15383         exist). Emit the {evex} pseudo-prefix in such cases.
15384
15385         Where applicable drop stray uses of PREFIX_OPCODE from table entries.
15386
15387 2022-10-24  Tom de Vries  <tdevries@suse.de>
15388
15389         [gdb/testsuite] Add skip_python_tests in gdb.python/tui-window-names.exp
15390         I did a gdb build without python support, and during testing ran into FAILs in
15391         test-case gdb.python/tui-window-names.exp.
15392
15393         Fix this by adding the missing skip_python_test.
15394
15395         Tested on x86_64-linux.
15396
15397 2022-10-24  GDB Administrator  <gdbadmin@sourceware.org>
15398
15399         Automatic date update in version.in
15400
15401 2022-10-23  Mike Frysinger  <vapier@gentoo.org>
15402
15403         sim: testsuite: update ignored .exp files [PR sim/29596]
15404         Now that we run `check/foo.exp` instead of `check/./foo.exp`,
15405         update the config/ & lib/ exceptions to cover both paths.
15406
15407         Bug: https://sourceware.org/PR29596
15408
15409 2022-10-23  Mike Frysinger  <vapier@gentoo.org>
15410
15411         sim: testsuite: tweak parallel find invocation [PR sim/29596]
15412         Make sure we invoke runtest with the same exp filenames when running in
15413         parallel as it will find when run single threaded.  When `runtest` finds
15414         files itself, it will use paths like "aarch64/allinsn.exp".  When we run
15415         `find .` with the %p option, it produces "./aarch64/allinsn.exp".  Switch
15416         to %P to get "aarch64/allinsn.exp".
15417
15418         Bug: https://sourceware.org/PR29596
15419
15420 2022-10-23  Mike Frysinger  <vapier@gentoo.org>
15421
15422         sim: mips/ppc/riscv: re-add AC_CANONICAL_SYSTEM [PR sim/29439]
15423         These configure scripts check $target and change behavior.  They
15424         shouldn't be doing that, but until we can rework the sim to change
15425         behavior based on the input ELF, restore AC_CANONICAL_SYSTEM to
15426         these so that $target is correctly populated.
15427
15428         This was lost in the d3562f83a7b8a1ae6e333cd5561419d3da18fcb4
15429         ("sim: unify toolchain probing logic") refactor as the logic was
15430         hoisted up to the common code.  But the fact the vars weren't
15431         passed down to the sub-configure scripts was missed.
15432
15433         Bug: https://sourceware.org/PR29439
15434
15435 2022-10-23  GDB Administrator  <gdbadmin@sourceware.org>
15436
15437         Automatic date update in version.in
15438
15439 2022-10-22  Simon Marchi  <simon.marchi@polymtl.ca>
15440
15441         gdb/testsuite: add max number of instructions check in gdb.base/unwind-on-each-insn.exp
15442         This test sends my CI in an infinite loop of failures.   We expect to
15443         have a handful of iterations (5 on my development machine, where the
15444         test passes fine)but the log shows that it went up to 104340 iterations:
15445
15446             FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: maint print frame-id
15447             DUPLICATE: gdb.base/unwind-on-each-insn.exp - instruction 104340: maint print frame-id
15448             FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: [string equal $fid $main_fid]
15449             FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: get hexadecimal valueof "$pc"
15450
15451         Add a max instruction check, exit the loop if we reach 100 iterations.
15452         This should allow the test to fail fast if there's a problem, but 100
15453         iterations should be more than enough for when things are working.
15454
15455         Change-Id: I77978d593aca046068f9209272d82e1675ba17c2
15456
15457 2022-10-22  GDB Administrator  <gdbadmin@sourceware.org>
15458
15459         Automatic date update in version.in
15460
15461 2022-10-21  Pedro Alves  <pedro@palves.net>
15462
15463         Improve Python Unwinders documentation
15464         - avoid "GDB proper" to refer to global locus, as object files and
15465           program spaces are also GDB proper.
15466
15467         - gdb.register_unwinder does not accept locus=gdb.
15468
15469         - "a unwinder" -> "an unwinder"
15470
15471         Approved-by: Eli Zaretskii <eliz@gnu.org>
15472         Change-Id: I98c1b1000e1063815238e945ca71ec6f37b5702e
15473
15474 2022-10-21  Simon Marchi  <simon.marchi@polymtl.ca>
15475
15476         gdb: make inherit_abstract_dies use vector iterators
15477         Small cleanup to use std::vector iterators rather than raw pointers.
15478
15479         Approved-By: Tom Tromey <tom@tromey.com>
15480         Change-Id: I8d50dbb3f2d8dad7ff94066a578d523f1f31b590
15481
15482 2022-10-21  Simon Marchi  <simon.marchi@polymtl.ca>
15483
15484         gdb: check for empty offsets vector in inherit_abstract_dies
15485         When building GDB with clang and --enable-ubsan, I get:
15486
15487           UNRESOLVED: gdb.dwarf2/frame-inlined-in-outer-frame.exp: starti prompt
15488
15489         The cause being:
15490
15491             $ ./gdb --data-directory=data-directory -nx -q -readnow testsuite/outputs/gdb.dwarf2/frame-inlined-in-outer-frame/frame-inlined-in-outer-frame
15492             Reading symbols from testsuite/outputs/gdb.dwarf2/frame-inlined-in-outer-frame/frame-inlined-in-outer-frame...
15493             Expanding full symbols from testsuite/outputs/gdb.dwarf2/frame-inlined-in-outer-frame/frame-inlined-in-outer-frame...
15494             /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:11954:47: runtime error: applying non-zero offset 8 to null pointer
15495
15496         I found this to happen with ld-linux on at least Arch Linux and Ubuntu
15497         22.04:
15498
15499             $ ./gdb --data-directory=data-directory -nx -q -readnow -iex "set debuginfod enabled on" /lib64/ld-linux-x86-64.so.2
15500             Reading symbols from /lib64/ld-linux-x86-64.so.2...
15501             Reading symbols from /home/simark/.cache/debuginfod_client/22bd7a2c03d8cfc05ef7092bfae5932223189bc1/debuginfo...
15502             Expanding full symbols from /home/simark/.cache/debuginfod_client/22bd7a2c03d8cfc05ef7092bfae5932223189bc1/debuginfo...
15503             /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:11954:47: runtime error: applying non-zero offset 8 to null pointer
15504
15505         The problem happens when doing this:
15506
15507             sect_offset *offsetp = offsets.data () + 1
15508
15509         When `offsets` is an empty vector, `offsets.data ()` returns nullptr.
15510         Fix it by wrapping that in a `!offsets.empty ()` check.
15511
15512         Change-Id: I6d29ba2fe80ba4308f68effd9c57d4ee8d67c29f
15513         Approved-By: Tom Tromey <tom@tromey.com>
15514
15515 2022-10-21  Fangrui Song  <maskray@google.com>
15516
15517         readelf: support zstd compressed debug sections [PR 29640]
15518
15519 2022-10-21  Tom Tromey  <tromey@adacore.com>
15520
15521         Fix incorrect .gdb_index with new DWARF scanner
15522         PR symtab/29694 points out a regression caused by the new DWARF
15523         scanner when the cc-with-gdb-index target board is used.
15524
15525         What happens here is that an older version of gdb will make an index
15526         describing the "A" type as:
15527
15528         [737] A: 1 [global, type]
15529
15530         whereas the new gdb says:
15531
15532         [1008] A: 0 [global, type]
15533
15534         Here the old one is correct because the A in CU 0 is just a
15535         declaration without a size:
15536
15537          <1><45>: Abbrev Number: 10 (DW_TAG_structure_type)
15538             <46>   DW_AT_name        : A
15539             <48>   DW_AT_declaration : 1
15540             <48>   DW_AT_sibling     : <0x6d>
15541
15542         This patch fixes the problem by introducing the idea of a "type
15543         declaration".  I think gdb still needs to recurse into these types,
15544         searching for methods, but by marking the type itself as a
15545         declaration, gdb can skip this type during lookups and when writing
15546         the index.
15547
15548         Regression tested on x86-64 using the cc-with-gdb-index board.
15549
15550         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29694
15551
15552 2022-10-21  Tom Tromey  <tromey@adacore.com>
15553
15554         Fix crash in value_print_array_elements
15555         A user noticed that gdb would crash when printing a packed array after
15556         doing "set lang c".  Packed arrays don't exist in C, but it's
15557         occasionally useful to print things in C mode when working in a non-C
15558         language -- this lets you see under the hood a little bit.
15559
15560         The bug here is that generic value printing does not handle packed
15561         arrays at all.  This patch fixes the bug by introducing a new function
15562         to extract a value from a bit offset and width.
15563
15564         The new function includes a hack to avoid problems with some existing
15565         test cases when using -fgnat-encodings=all.  Cleaning up this code
15566         looked difficult, and since "all" is effectively deprecated, I thought
15567         it made sense to simply work around the problems.
15568
15569 2022-10-21  Tom Tromey  <tromey@adacore.com>
15570
15571         Fix bug in Ada packed array handling
15572         A user found a bug where an array of packed arrays was printed
15573         incorrectly.  The bug here is that the packed array has a bit stride,
15574         but the outer array does not -- and should not.  However,
15575         update_static_array_size does not distinguish between an array of
15576         packed arrays and a multi-dimensional packed array, and for the
15577         latter, only the innermost array will end up with a stride.
15578
15579         This patch fixes the problem by adding a flag to indicate whether a
15580         given array type is a constituent of a multi-dimensional array.
15581
15582 2022-10-21  Simon Marchi  <simon.marchi@polymtl.ca>
15583
15584         gdb: declare variables on first use in inherit_abstract_dies
15585         Move variable declarations to where they are first use, plus some random
15586         style fixes.
15587
15588         Change-Id: Idf40d60f9034996fa6a234165cd989a721eb4148
15589
15590 2022-10-21  Nick Clifton  <nickc@redhat.com>
15591
15592         Add a -w option to the linker to suppress warning and error messages.
15593                 PR 29654
15594                 * ld.h (struct ld_config_type): Add no_warnings field.
15595                 * ldlex.h (enum option_values): Add OPTION_NO_WARNINGS.
15596                 * lexsup.c (ld_options): Add --no-warnings.
15597                 (parse_args): Add support for -w and --no-warnings.
15598                 * ldmisc.c (vfinfo): Return early if the message is a warning and
15599                 -w has been enabled.
15600                 * ld.texi (options): Document new command line option.
15601                 * NEWS: Mention the new feature.
15602
15603         Add a note to the binutils/NEWS file about DCO signed contributions.
15604
15605 2022-10-21  Bruno Larsen  <blarsen@redhat.com>
15606
15607         gdb/reverse: Fix stepping over recursive functions
15608         Currently, when using GDB to do reverse debugging, if we try to use the
15609         command "reverse next" to skip a recursive function, instead of skipping
15610         all of the recursive calls and stopping in the previous line, we stop at
15611         the second to last recursive call, and need to manually step backwards
15612         until we leave the first call.  This is well documented in PR gdb/16678.
15613
15614         This bug happens because when GDB notices that a reverse step has
15615         entered into a function, GDB will add a step_resume_breakpoint at the
15616         start of the function, then single step out of the prologue once that
15617         breakpoint is hit.  The problem was happening because GDB wouldn't give
15618         that step_resume_breakpoint a frame-id, so the first time the breakpoint
15619         was hit, the inferior would be stopped.  This is fixed by giving the
15620         current frame-id to the breakpoint.
15621
15622         This commit also changes gdb.reverse/step-reverse.c to contain a
15623         recursive function and attempt to both, skip it altogether, and to skip
15624         the second call from inside the first call, as this setup broke a
15625         previous version of the patch.
15626
15627 2022-10-21  Bruno Larsen  <blarsen@redhat.com>
15628
15629         Change calculation of frame_id by amd64 epilogue unwinder
15630         When GDB is stopped at a ret instruction and no debug information is
15631         available for unwinding, GDB defaults to the amd64 epilogue unwinder, to
15632         be able to generate a decent backtrace. However, when calculating the
15633         frame id, the epilogue unwinder generates information as if the return
15634         instruction was the whole frame.
15635
15636         This was an issue especially when attempting to reverse debug, as GDB
15637         would place a step_resume_breakpoint from the epilogue of a function if
15638         we were to attempt to skip that function, and this breakpoint should
15639         ideally have the current function's frame_id to avoid other problems
15640         such as PR record/16678.
15641
15642         This commit changes the frame_id calculation for the amd64 epilogue,
15643         so that it is always the same as the dwarf2 unwinder's frame_id.
15644
15645         It also adds a test to confirm that the frame_id will be the same,
15646         regardless of using the epilogue unwinder or not, thanks to Andrew
15647         Burgess.
15648
15649         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
15650
15651 2022-10-21  Nick Clifton  <nickc@redhat.com>
15652
15653         Updated Hungarian translation for the gprof sub-directory.
15654                 * po/hu.po: Updated Hungarian translation.
15655
15656 2022-10-21  Maciej W. Rozycki  <macro@embecosm.com>
15657
15658         GDB/Python: Make `None' stand for `unlimited' in setting integer parameters
15659         Similarly to booleans and following the fix for PR python/29217 make
15660         `gdb.parameter' accept `None' for `unlimited' with parameters of the
15661         PARAM_UINTEGER, PARAM_INTEGER, and PARAM_ZUINTEGER_UNLIMITED types, as
15662         `None' is already returned by parameters of the two former types, so
15663         one might expect to be able to feed it back.  It also makes it possible
15664         to avoid the need to know what the internal integer representation is
15665         for the special setting of `unlimited'.
15666
15667         Expand the testsuite accordingly.
15668
15669         Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
15670
15671 2022-10-21  Maciej W. Rozycki  <macro@embecosm.com>
15672
15673         GDB/testsuite: Expand Python integer parameter coverage across all types
15674         Also verify PARAM_UINTEGER, PARAM_INTEGER, and PARAM_ZINTEGER parameter
15675         types, in addition to PARAM_ZUINTEGER and PARAM_ZUINTEGER_UNLIMITED
15676         already covered, and verify a choice of existing GDB parameters.  Add
15677         verification for reading parameters via `<parameter>.value' in addition
15678         to `gdb.parameter('<parameter>')' as this covers different code paths.
15679
15680         Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
15681
15682 2022-10-21  Maciej W. Rozycki  <macro@embecosm.com>
15683
15684         GDB/Guile: Don't assert that an integer value is boolean
15685         Do not assert that a value intended for an integer parameter, of either
15686         the PARAM_UINTEGER or the PARAM_ZUINTEGER_UNLIMITED type, is boolean,
15687         causing error messages such as:
15688
15689         ERROR: In procedure make-parameter:
15690         ERROR: In procedure gdbscm_make_parameter: Wrong type argument in position 15 (expecting integer or #:unlimited): 3
15691         Error while executing Scheme code.
15692
15693         when initialization with a number is attempted.  Instead assert that it
15694         is integer.  Keep matching `#:unlimited' keyword as an alternative.  Add
15695         suitable test cases.
15696
15697         Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
15698
15699 2022-10-21  Tom de Vries  <tdevries@suse.de>
15700
15701         [gdb/testsuite] Silence compilation fail in gdb.base/rtld-step.exp
15702         With gcc 7.5.0 and test-case gdb.base/rtld-step.exp, I run into:
15703         ...
15704         gdb compile failed, gcc: error: unrecognized command line option \
15705           '-static-pie'; did you mean '-static'?
15706         ...
15707
15708         Silence this by checking in the test-case that -static-pie is supported, and
15709         emitting instead:
15710         ...
15711         UNTESTED: gdb.base/rtld-step.exp: \
15712           failed to compile (-static-pie not supported or static libc missing)
15713         ...
15714
15715         Tested on x86_64-linux, with:
15716         - gcc 7.5.0: UNTESTED
15717         - gcc 12.2.1 with static glibc not installed: UNTESTED
15718         - gcc 12.2.1 with static glibc installed: PASS
15719
15720 2022-10-21  Cui,Lili  <lili.cui@intel.com>
15721
15722         Support Intel AMX-FP16
15723         gas/
15724
15725                 * NEWS: Add support for Intel AMX-FP16 instruction.
15726                 * config/tc-i386.c: Add amx_fp16.
15727                 * doc/c-i386.texi: Document .amx_fp16.
15728                 * testsuite/gas/i386/i386.exp: Add AMX-FP16 tests.
15729                 * testsuite/gas/i386/x86-64-amx-fp16-intel.d: New test.
15730                 * testsuite/gas/i386/x86-64-amx-fp16.d: Likewise.
15731                 * testsuite/gas/i386/x86-64-amx-fp16.s: Likewise.
15732                 * testsuite/gas/i386/x86-64-amx-fp16-bad.d: Likewise.
15733                 * testsuite/gas/i386/x86-64-amx-fp16-bad.s: Likewise.
15734
15735         opcodes/
15736
15737                 * i386-dis.c (MOD_VEX_0F385C_X86_64_P_3_W_0): New.
15738                 (VEX_LEN_0F385C_X86_64_P_3_W_0_M_0): Likewise.
15739                 (VEX_W_0F385C_X86_64_P_3): Likewise.
15740                 (prefix_table): Add VEX_W_0F385C_X86_64_P_3.
15741                 (vex_len_table): Add VEX_LEN_0F385C_X86_64_P_3_W_0_M_0.
15742                 (vex_w_table): Add VEX_W_0F385C_X86_64_P_3.
15743                 (mod_table): Add MOD_VEX_0F385C_X86_64_P_3_W_0.
15744                 * i386-gen.c (cpu_flag_init): Add AMX-FP16_FLAGS.
15745                 (CPU_ANY_AMX_TILE_FLAGS): Add CpuAMX_FP16.
15746                 (cpu_flags): Add CpuAMX-FP16.
15747                 * i386-opc.h (enum): Add CpuAMX-FP16.
15748                 (i386_cpu_flags): Add cpuamx_fp16.
15749                 * i386-opc.tbl: Add Intel AMX-FP16 instruction.
15750                 * i386-init.h: Regenerate.
15751                 * i386-tbl.h: Likewise.
15752
15753 2022-10-21  Tsukasa OI  <research_trasio@irq.a4lg.com>
15754
15755         sim: Remove unused CXXFLAGS substitution
15756         Not only that sim/configure.ac does not AC_SUBST CXXFLAGS,
15757         unless we need C++ compiler like CXX, substitution @CXXFLAGS@ is useless.
15758         Because of this, this commit removes this substitution.
15759
15760 2022-10-21  GDB Administrator  <gdbadmin@sourceware.org>
15761
15762         Automatic date update in version.in
15763
15764 2022-10-20  H.J. Lu  <hjl.tools@gmail.com>
15765
15766         x86: Check VEX/EVEX encoding before checking vector operands
15767         Since
15768
15769         commit 837e225ba1992f9745e5bbbd5e8443243a7f475f
15770         Author: Jan Beulich <jbeulich@suse.com>
15771         Date:   Thu Oct 20 10:01:12 2022 +0200
15772
15773             x86: re-work AVX-VNNI support
15774
15775         moved AVX-VNNI after AVX512-VNNI, vector Disp8 is applied even when VEX
15776         encoding is selected.  Check VEX/EVEX encoding before checking vector
15777         operands to avoid vector Disp8 with VEX encoding.
15778
15779                 PR gas/29708
15780                 * config/tc-i386.c (match_template): Check VEX/EVEX encoding
15781                 before checking vector operands.
15782                 * testsuite/gas/i386/avx-vnni.d: Updated.
15783                 * testsuite/gas/i386/x86-64-avx-vnni.d: Likewise.
15784                 * testsuite/gas/i386/avx-vnni.s: Add a Disp32 test.
15785                 * testsuite/gas/i386/x86-64-avx-vnni.s: Likewise.
15786
15787 2022-10-20  Andrew Burgess  <aburgess@redhat.com>
15788
15789         gdb/python: break more dependencies between gdbpy_initialize_* functions
15790         In a later commit in this series I will propose removing all of the
15791         explicit gdbpy_initialize_* calls from python.c and replace these
15792         calls with a more generic mechanism.
15793
15794         One of the side effects of this generic mechanism is that the order in
15795         which the various Python sub-systems within GDB are initialized is no
15796         longer guaranteed.
15797
15798         On the whole I don't think this matters, most of the sub-systems are
15799         independent of each other, though testing did reveal a few places
15800         where we did have dependencies, though I don't think those
15801         dependencies were explicitly documented in comment anywhere.
15802
15803         This commit is similar to the previous one, and fixes the second
15804         dependency issue that I found.
15805
15806         In this case the finish_breakpoint_object_type uses the
15807         breakpoint_object_type as its tp_base, this means that
15808         breakpoint_object_type must have been initialized with a call to
15809         PyType_Ready before finish_breakpoint_object_type can be initialized.
15810
15811         Previously we depended on the ordering of calls to
15812         gdbpy_initialize_breakpoints and gdbpy_initialize_finishbreakpoints in
15813         python.c.
15814
15815         After this commit a new function gdbpy_breakpoint_init_breakpoint_type
15816         exists, this function ensures that breakpoint_object_type has been
15817         initialized, and can be called from any gdbpy_initialize_* function.
15818
15819         I feel that this change makes the dependency explicit, which I think
15820         is a good thing.
15821
15822         There should be no user visible changes after this commit.
15823
15824 2022-10-20  Andrew Burgess  <aburgess@redhat.com>
15825
15826         gdb/python: break dependencies between gdbpy_initialize_* functions
15827         In a later commit in this series I will propose removing all of the
15828         explicit gdbpy_initialize_* calls from python.c and replace these
15829         calls with a more generic mechanism.
15830
15831         One of the side effects of this generic mechanism is that the order in
15832         which the various Python sub-systems within GDB are initialized is no
15833         longer guaranteed.
15834
15835         On the whole I don't think this matters, most of the sub-systems are
15836         independent of each other, though testing did reveal a few places
15837         where we did have dependencies, though I don't think those
15838         dependencies were explicitly documented in a comment anywhere.
15839
15840         This commit removes the first dependency issue, with this and the next
15841         commit, all of the implicit inter-sub-system dependencies will be
15842         replaced by explicit dependencies, which will allow me to, I think,
15843         clean up how the sub-systems are initialized.
15844
15845         The dependency is around the py_insn_type.  This type is setup in
15846         gdbpy_initialize_instruction and used in gdbpy_initialize_record.
15847         Rather than depend on the calls to these two functions being in a
15848         particular order, in this commit I propose adding a new function
15849         py_insn_get_insn_type.  This function will take care of setting up the
15850         py_insn_type type and calling PyType_Ready.  This helper function can
15851         be called from gdbpy_initialize_record and
15852         gdbpy_initialize_instruction, and the py_insn_type will be initialized
15853         just once.
15854
15855         To me this is better, the dependency is now really obvious, but also,
15856         we no longer care in which order gdbpy_initialize_record and
15857         gdbpy_initialize_instruction are called.
15858
15859         There should be no user visible changes after this commit.
15860
15861 2022-10-20  Andrew Burgess  <aburgess@redhat.com>
15862
15863         gdb: some int to bool conversion in breakpoint.c
15864         Some int to bool conversion in breakpoint.c.  I've only updated the
15865         function signatures of static functions, but I've updated some
15866         function local variables throughout the file.
15867
15868         There should be no user visible changes after this commit.
15869
15870         Approved-By: Simon Marchi <simon.marchi@efficios.com>
15871
15872 2022-10-20  Andrew Burgess  <aburgess@redhat.com>
15873
15874         gdb: make use of scoped_restore in unduplicated_should_be_inserted
15875         I noticed that we could make use of a scoped_restore in the function
15876         unduplicated_should_be_inserted.  I've also converted the function
15877         return type from int to bool.
15878
15879         This change shouldn't make any difference, as I don't think anything
15880         within should_be_inserted could throw an exception, but the change
15881         doesn't hurt, and will help keep us safe if anything ever changes in
15882         the future.
15883
15884         Approved-By: Simon Marchi <simon.marchi@efficios.com>
15885
15886 2022-10-20  Andrew Burgess  <aburgess@redhat.com>
15887
15888         gdb: used scoped_restore_frame in update_watchpoint
15889         I was doing some int to bool cleanup in update_watchpoint, and I
15890         noticed a manual version of scoped_restore_selected_frame.  As always
15891         when these things are done manually, there is the chance that, in an
15892         error case, we might leave the wrong frame selected.
15893
15894         This commit updates things to use scoped_restore_selected_frame, and
15895         also converts a local variable from int to bool.
15896
15897         The only user visible change after this commit is in the case where
15898         update_watchpoint throws an error - we should now correctly restore
15899         the previously selected frame.  Otherwise, this commit should be
15900         invisible to the user.
15901
15902         Approved-By: Simon Marchi <simon.marchi@efficios.com>
15903
15904 2022-10-20  Andrew Burgess  <aburgess@redhat.com>
15905
15906         gdb: make some bp_location arguments const in breakpoint.c
15907         I spotted a few places where I could make some 'bp_location *'
15908         arguments constant in breakpoint.c.
15909
15910         There should be no user visible changes after this commit.
15911
15912         Approved-By: Simon Marchi <simon.marchi@efficios.com>
15913
15914 2022-10-20  Дилян Палаузов  <dilyan.palauzov@aegee.org>
15915
15916         Reapply "Don't build readline/libreadline.a, when --with-system-readline is supplied"
15917         Commit 228cf97dd3c8 ("Merge configure.ac from gcc project") undid the
15918         change originally done in commit 69961a84c9b ("Don't build
15919         readline/libreadline.a, when --with-system-readline is supplied").
15920         Re-apply it.
15921
15922         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18632
15923
15924 2022-10-20  Jan Beulich  <jbeulich@suse.com>
15925
15926         x86: re-work AVX-VNNI support
15927         By putting the templates after their AVX512 counterparts, the AVX512
15928         flavors will be picked by default. That way the need to always use {vex}
15929         ceases to exist once respective CPU features (AVX512-VNNI or AVX512VL as
15930         a whole) have been disabled. This way the need for the PseudoVexPrefix
15931         attribute also disappears.
15932
15933 2022-10-20  Tom de Vries  <tdevries@suse.de>
15934
15935         [gdb/testsuite] Fix gdb.debuginfod/fetch_src_and_symbols.exp with check-read1
15936         With test-case gdb.debuginfod/fetch_src_and_symbols.exp and check-read1, I run
15937         into:
15938         ...
15939         (gdb) FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: \
15940           file fetch_src_and_symbols (got interactive prompt)
15941         ...
15942
15943         The problem is that this output:
15944         ...
15945         Enable debuginfod for this session? (y or [n]) y^M
15946         ...
15947         is matched using regexp "Enable debuginfod?.*" with matches only the first two
15948         words of the output, after which an implicit clause in gdb_test_multiple triggers
15949         on the second part containing the interactive prompt.
15950
15951         Fix this by included the interactive prompt in the regexp.
15952
15953         Tested on x86_64-linux.
15954
15955 2022-10-20  Tom de Vries  <tdevries@suse.de>
15956
15957         [gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with check-read1
15958         With test-case gdb.mi/mi-disassemble.exp and check-read1 I run into:
15959         ...
15960         FAIL: gdb.mi/mi-disassemble.exp: disassemble /b main
15961         FAIL: gdb.mi/mi-disassemble.exp: get valueof "*((unsigned char *) 0x400549)"
15962         ...
15963
15964         The problem for both FAILs is that the output is parsed using
15965         gdb_test_multiple, which has implicit clauses using $gdb_prompt, which can
15966         match before the explicit clauses using $mi_gdb_prompt.
15967
15968         Fix this by passing -prompt "$mi_gdb_prompt$" to gdb_test_multiple.
15969
15970         Tested on x86-64-linux.
15971
15972 2022-10-20  Alan Modra  <amodra@gmail.com>
15973
15974         Re: aarch64-pe support for LD, GAS and BFD
15975         Fix dependencies for eaarch64pe.c.  Generated files aren't handled
15976         fully automatically.
15977
15978 2022-10-20  Mark Harmstone  <mark@harmstone.com>
15979
15980         ld: Add minimal pdb generation
15981
15982         ld: Add --pdb option
15983         Second patch incorporates fixes for endian and UB issues in calc_hash, as per
15984         https://sourceware.org/pipermail/binutils/2022-October/123514.html.
15985
15986 2022-10-20  Kevin Buettner  <kevinb@redhat.com>
15987
15988         Test stepping within a runtime loader / dynamic linker
15989         See the remarks in rtld-step.exp for a description of what this
15990         test is about.
15991
15992         This test case has been tested using gcc on the following x86-64 Linux
15993         distributions/releases:
15994
15995             Fedora 28
15996             Fedora 32
15997             Fedora 33
15998             Fedora 34
15999             Fedora 35
16000             Fedora 36
16001             Fedora 37
16002             rawhide (f38)
16003             RHEL 9.1
16004             Ubuntu 22.04.1 LTS
16005
16006         It's also been tested (and found to be working) with
16007         RUNTESTFLAGS="CC_FOR_TARGET=clang" on all of the above expect for
16008         Fedora 28.  The (old) version of clang available on F28 did not
16009         accept the -static-pie option.
16010
16011         I also tried to make this test work on FreeBSD 13.1.  While I think I
16012         made significant progress, I was ultimately stymied by this message
16013         which occurs when attempting to run the main program which has been
16014         set to use the fake/pretend RTLD as the ELF interpreter:
16015
16016         ELF interpreter /path/to/rtld-step-rtld not found, error 22
16017
16018         I have left one of the flags (-static) in place which I believe
16019         to be needed for FreeBSD (though since I never got it to work, I
16020         don't know for sure.)  I've also left some declarations needed
16021         for FreeBSD in rtld-step-rtld.c.  They're currently disabled via
16022         a #if 0; you'll need to enable them if you want to try to make
16023         it work on FreeBSD.
16024
16025 2022-10-20  Kevin Buettner  <kevinb@redhat.com>
16026
16027         Allow debugging of runtime loader / dynamic linker
16028         At present, GDB does not allow for the debugging of the runtime loader
16029         and/or dynamic linker.  Much of the time, this makes sense.  An
16030         application programmer doesn't normally want to see symbol resolution
16031         code when stepping into a function that hasn't been resolved yet.
16032
16033         But someone who wishes to debug the runtime loader / dynamic linker
16034         might place a breakpoint in that code and then wish to debug it
16035         as normal.  At the moment, this is not possible.  Attempting to step
16036         will cause GDB to internally step (and not stop) until code
16037         unrelated to the dynamic linker is reached.
16038
16039         This commit makes a minor change to infrun.c which allows the dynamic
16040         loader / linker to be debugged in the case where a step, next, etc.
16041         is initiated from within that code.
16042
16043         While developing this fix, I tried some approaches which weren't quite
16044         right.  The GDB testusite definitely contains tests which FAIL when
16045         it's done incorrectly.  (At one point, I saw 17 regressions!) This
16046         commit has been tested on x86-64 linux with no regressions.
16047
16048 2022-10-20  Tsukasa OI  <research_trasio@irq.a4lg.com>
16049
16050         binutils: Remove unused substitution PROGRAM
16051         Unlike other substitution, this substitution of @PROGRAM@ was done in
16052         binutils/Makefile and it was intended for binutils/cxxfilt.man.  @PROGRAM@
16053         in binutils/cxxfilt.man is removed in the commit 0285c67df190 ("Automate
16054         generate on man pages") in 2001 and @PROGRAM@ is ineffective since then.
16055
16056         Because PROGRAM substitution does nothing, removing this manual
16057         substitution should be completely safe.
16058
16059         binutils/ChangeLog:
16060
16061                 * doc/local.mk: Remove unused substitution PROGRAM.
16062                 * Makefile.in: Regenerate.
16063
16064 2022-10-20  GDB Administrator  <gdbadmin@sourceware.org>
16065
16066         Automatic date update in version.in
16067
16068 2022-10-20  Alan Modra  <amodra@gmail.com>
16069
16070         Obsolete beos
16071                 * config.bfd: Obsolete *-*-beos*.  Simplify x86 beos match.
16072
16073         Regen ld/po/BLD-POTFILES.in
16074
16075 2022-10-19  Tom de Vries  <tdevries@suse.de>
16076
16077         [gdb] Fix assert in handle_jit_event
16078         With the cc-with-tweaks.sh patch submitted here (
16079         https://sourceware.org/pipermail/gdb-patches/2022-October/192586.html ) we run
16080         with:
16081         ...
16082         $ export STRIP_ARGS_STRIP_DEBUG=--strip-all
16083         $ make check RUNTESTFLAGS="gdb.base/jit-reader.exp \
16084             --target_board cc-with-gnu-debuglink"
16085         ...
16086         into the following assert:
16087         ...
16088         (gdb) run ^M
16089         Starting program: jit-reader ^M
16090         gdb/jit.c:1247: internal-error: jit_event_handler: \
16091           Assertion `jiter->jiter_data != nullptr' failed.^M
16092         ...
16093
16094         Fix this by handling the
16095         jit_bp_sym.objfile->separate_debug_objfile_backlink != nullptr case in
16096         handle_jit_event.
16097
16098         Tested on x86_64-linux.
16099
16100         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29277
16101
16102 2022-10-19  Pedro Alves  <pedro@palves.net>
16103
16104         internal_error: remove need to pass __FILE__/__LINE__
16105         Currently, every internal_error call must be passed __FILE__/__LINE__
16106         explicitly, like:
16107
16108           internal_error (__FILE__, __LINE__, "foo %d", var);
16109
16110         The need to pass in explicit __FILE__/__LINE__ is there probably
16111         because the function predates widespread and portable variadic macros
16112         availability.  We can use variadic macros nowadays, and in fact, we
16113         already use them in several places, including the related
16114         gdb_assert_not_reached.
16115
16116         So this patch renames the internal_error function to something else,
16117         and then reimplements internal_error as a variadic macro that expands
16118         __FILE__/__LINE__ itself.
16119
16120         The result is that we now should call internal_error like so:
16121
16122           internal_error ("foo %d", var);
16123
16124         Likewise for internal_warning.
16125
16126         The patch adjusts all calls sites.  99% of the adjustments were done
16127         with a perl/sed script.
16128
16129         The non-mechanical changes are in gdbsupport/errors.h,
16130         gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
16131
16132         Approved-By: Simon Marchi <simon.marchi@efficios.com>
16133         Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
16134
16135 2022-10-19  Nick Clifton  <nickc@redhat.com>
16136
16137         Fix an illegal memory access when parsing an ELF file containing corrupt symbol version information.
16138                 PR 29699
16139                 * elf.c (_bfd_elf_slurp_version_tables): Fail if the sh_info field
16140                 of the section header is zero.
16141
16142 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16143
16144         sim/iq2000: silence pointer-sign warnings
16145         When building the iq2000 simulator I see a few warnings like this:
16146
16147           /tmp/build/sim/../../src/sim/iq2000/iq2000.c: In function ‘fetch_str’:
16148           /tmp/build/sim/../../src/sim/iq2000/iq2000.c:50:54: error: pointer targets in passing argument 3 of ‘sim_read’ differ in signedness [-Werror=pointer-sign]
16149              50 |   sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr);
16150                 |                                                      ^~~
16151                 |                                                      |
16152                 |                                                      char *
16153
16154         I've silenced these warnings by casting buf to 'unsigned char *'.
16155         With this change I now see no warnings when compiling iq2000.c, so
16156         I've removed the line from Makefile.in that disables -Werror.
16157
16158         Makefile.in was also disabling -Werror when compiling mloop.c,
16159         however, I'm not seeing any warnings when compiling that file, so I've
16160         removed the -Werror disable in that case too.
16161
16162 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16163
16164         sim/erc32: avoid dereferencing type-punned pointer warnings
16165         When building the erc32 simulator I get a few warnings like this:
16166
16167           /tmp/build/sim/../../src/sim/erc32/exec.c:1377:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
16168            1377 |   sregs->fs[rd] = *((float32 *) & ddata[0]);
16169                 |                    ~^~~~~~~~~~~~~~~~~~~~~~~
16170
16171         The type of '& ddata[0]' will be 'uint32_t *', which is what triggers
16172         the warning.
16173
16174         This commit makes use of memcpy when performing the type-punning,
16175         which resolves the above warnings.
16176
16177         With this change, I now see no warnings when compiling exec.c, which
16178         means that the line in Makefile.in that disables -Werror can be
16179         removed.
16180
16181         There should be no change in behaviour after this commit.
16182
16183 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16184
16185         sim/ppc: mark device_error function as ATTRIBUTE_NORETURN
16186         The device_error function always ends up calling the error function,
16187         which is itself marked as ATTRIBUTE_NORETURN, so it makes sense that
16188         device_error should also be marked ATTRIBUTE_NORETURN.
16189
16190         Doing this resolves a few warnings from hw_ide.c about possibly
16191         uninitialized variables - the variables are only uninitialized after
16192         passing through a call to device_error, which obviously means the
16193         variables are never really used uninitialized, the simulation will
16194         terminate with the device_error call.
16195
16196 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16197
16198         sim/ppc: fix warnings related to printf format strings
16199         This commit is a follow on to:
16200
16201           commit 182421c9d2eea8c4877d983a2124e591f0aca710
16202           Date:   Tue Oct 11 15:02:08 2022 +0100
16203
16204               sim/ppc: fixes for arguments to printf style functions
16205
16206         where commit 182421c9d2ee addressed issues with printf format
16207         arguments that were causing the compiler to give an error, this commit
16208         addresses issues that caused the compiler to emit a warning.
16209
16210         This commit is mostly either changing the format string to match the
16211         argument, or in some cases, excess, unused arguments are removed.
16212
16213 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16214
16215         sim/cgen: mask uninitialized variable warning in cgen-run.c
16216         I see an uninitialized variable warning (with gcc 9.3.1) from
16217         cgen-run.c, like this:
16218
16219           /tmp/build/sim/../../src/sim/cris/../common/cgen-run.c: In function ‘sim_resume’:
16220           /tmp/build/sim/../../src/sim/cris/../common/cgen-run.c:259:5: warning: ‘engine_fns$’ may be used uninitialized in this function [-Wmaybe-uninitialized]
16221             259 |    (* engine_fns[next_cpu_nr]) (cpu);
16222                 |    ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16223           /tmp/build/sim/../../src/sim/cris/../common/cgen-run.c:232:14: note: ‘engine_fns$’ was declared here
16224             232 |   ENGINE_FN *engine_fns[MAX_NR_PROCESSORS];
16225                 |              ^~~~~~~~~~
16226
16227         This is a false positive - we over allocate engine_fn, and then only
16228         initialize the nr_cpus entries which we will later go on to use.
16229
16230         However, we can easily silence this warning by initializing the unused
16231         entries in engine_fns to NULL, this might also help if anyone ever
16232         looks at engine_fns in a debugger, it should now be obvious which
16233         entries are in use, and which are not.
16234
16235         With this change the warning is gone.
16236
16237         There should be no change in behaviour with this commit.
16238
16239 2022-10-19  Alan Modra  <amodra@gmail.com>
16240
16241         Fix addr2line test for ppc64 elfv1 and mingw
16242                 * testsuite/binutils-all/addr2line.exp: Tidy.  For powerpc64
16243                 arrange to pass --synthetic to nm, and extract .main and .fn
16244                 symbol address for addr2line test.  Handle default executable
16245                 extension on cygwin/mingw compilers.
16246
16247 2022-10-19  Nick Clifton  <nickc@redhat.com>
16248
16249         Update MAINTAINERS file with details about accepting DCO signed contributions.
16250                 * MAINTAINERS: Add section on patches, copyright and DCO.
16251
16252 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16253
16254         gdb/testsuite: avoid temporary file in gdb/testsuite (unittest.exp)
16255         I spotted that the gdb.gdb/unittest.exp script causes a temporary file
16256         inserters_extractors-2.txt to be created in build/gdb/testsuite/
16257         instead of in build/gdb/testsuite/output/gdb.gdb/unittest/.
16258
16259         This is because some of the 'maint selftest' tests create temporary
16260         files in GDB's current directory, specifically, the two source files:
16261
16262           gdb/unittests/basic_string_view/inserters/wchar_t/2.cc
16263           gdb/unittests/basic_string_view/inserters/char/2.cc
16264
16265         both create a temporary file called inserters_extractors-2.txt, though
16266         we only run the second of these as part of GDB's selftests.
16267
16268         I initially proposed just using GDB's 'cd' command in unittest.exp to
16269         switch to the test output directory before running the selftests,
16270         however, Pedro pointed out that there was a risk here that, if GDB
16271         crashed during shutdown, the generated core file would be left in the
16272         test output directory rather than in the testsuite directory.  As a
16273         result, our clever core file spotting logic would fail to spot the
16274         core file and alert the user.
16275
16276         Instead, I propose this slightly more involved solution.  I've added a
16277         new with_gdb_cwd directory proc, used like this:
16278
16279           with_gdb_cwd $directory {
16280             # Tests here...
16281           }
16282
16283         The new proc temporarily switches to $directory and then runs the
16284         tests within the block.  After running the tests the previous current
16285         working directory is restored.
16286
16287         Additionally, after switching back to the previous cwd, we check that
16288         GDB is still responsive.  This means that if GDB crashed immediately
16289         prior to restoring the previous directory, and left the core file in
16290         the wrong place, then the responsiveness check will fail, and a FAIL
16291         will be emitted, this should be enough to alert the user that
16292         something has gone wrong.
16293
16294         With this commit in place the unittest.exp script now leaves its
16295         temporary file in the test output directory.
16296
16297 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16298
16299         gdb/testsuite: avoid creating files in gdb/testsuite directory
16300         I spotted that the test gdb.dwarf2/dw2-using-debug-str.exp was
16301         creating an output file called debug_str_section in the root
16302         build/gdb/testsuite directory instead of using the
16303         build/gdb/testsuite/output/gdb.dwarf2/dw2-using-debug-str/ directory.
16304
16305         This appears to be caused by a missing '$' character.  We setup a
16306         variable debug_str_section which contains a path within the output
16307         directory, but then when we build the objcopy command we use
16308         'debug_str_section' without a '$' prefix, as a result, we create the
16309         debug_str_section file.
16310
16311         This commit adds the missing '$', the file is now created in the
16312         output directory.
16313
16314 2022-10-19  Andrew Burgess  <aburgess@redhat.com>
16315
16316         bfd: fix undefined references to aarch64_pe_le_vec
16317         After commit:
16318
16319           commit c60b3806799abf1d7f6cf5108a1b0e733a950b13
16320           Date:   Wed Oct 19 10:57:12 2022 +0200
16321
16322               aarch64-pe support for LD, GAS and BFD
16323
16324         It appears that bfd/Makefile.in and bfd/configure were not regenerated
16325         correctly.  The differences in the configure file are only whitespace,
16326         but in Makefile.in a critical reference to pe-aarch64.lo was missing.
16327
16328 2022-10-19  Jedidiah Thompson  <wej22007@outlook.com>
16329             Jedidiah Thompson  <wej22007@outlook.com>
16330             Zac Walker  <zac.walker@linaro.org>
16331
16332         aarch64-pe support for LD, GAS and BFD
16333         Allows aarch64-pe to be targeted natively, not having to use objcopy to convert it from ELF to PE.
16334         Based on initial work by Jedidiah Thompson
16335
16336 2022-10-19  rupesh potharla  <rupesh.potharla@amd.com>
16337
16338         Binutils: Adding new testcase for addr2line.
16339         * binutils/testsuite/config/default.exp: Set ADDR2LINE and ADDR2LINEFLAGS.
16340         * binutils/testsuite/binutils-all/addr2line.exp: New file.
16341
16342 2022-10-19  Tom de Vries  <tdevries@suse.de>
16343
16344         [gdb/testsuite] Fix ERROR in gdb.python/py-breakpoint.exp
16345         With test-case gdb.python/py-breakpoint.exp I run into:
16346         ...
16347         (gdb) ERROR: tcl error sourcing gdb.python/py-breakpoint.exp.
16348         ERROR: can't read "skip_hw_watchpoint_tests_p": no such variable
16349             while executing
16350         "if {$skip_hw_watchpoint_tests_p} {
16351                 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
16352             }"
16353         ...
16354
16355         Fix this by adding the missing "global skip_hw_watchpoint_tests_p" in two
16356         procs.
16357
16358         Tested on x86_64-linux.
16359
16360 2022-10-19  Andreas Krebbel  <krebbel@linux.ibm.com>
16361
16362         IBM zSystems: Issue error for *DBL relocs on misaligned symbols
16363         Relocs like PC32DBL require a right shift of the symbol value.  There
16364         is no situation where dropping symbol value bits with the right shift
16365         is a good thing.  Hence we now issue an error to detect such problems.
16366
16367 2022-10-19  Simon Marchi  <simon.marchi@efficios.com>
16368
16369         gdb: check for groups with duplicate names in reggroups:add
16370         In the downstream ROCm GDB port, we would create multiple register
16371         groups with duplicate names.  While it did not really hurt, it certainly
16372         wasn't the intent.  And I don't think it ever makes sense to do so.
16373
16374         To catch these, change the assert in reggroups::add to check for
16375         duplicate names.  It's no longer necessary to check for duplicate
16376         reggroup pointers, because adding the same group twice would be caught
16377         by the duplicate name check.
16378
16379         Change-Id: Id216a58acf91f1b314d3cba2d02de73656f8851d
16380         Approved-By: Tom Tromey <tom@tromey.com>
16381
16382 2022-10-19  GDB Administrator  <gdbadmin@sourceware.org>
16383
16384         Automatic date update in version.in
16385
16386 2022-10-18  H.J. Lu  <hjl.tools@gmail.com>
16387
16388         x86: Disable AVX-VNNI when disabling AVX2
16389         Since AVX-VNNI requires AVX2, disable AVX-VNNI when disabling AVX2.
16390
16391                 * i386-gen.c (cpu_flag_init): Add CpuAVX_VNNI to
16392                 CPU_ANY_AVX2_FLAGS.
16393                 * i386-init.h: Regenerate.
16394
16395 2022-10-18  Tom Tromey  <tom@tromey.com>
16396
16397         Remove dead code from py-finishbreakpoint.c
16398         PR python/16324 points out that comparing a frame id to null_frame_id
16399         can never succeed, and proposes simply removing the dead code.  That
16400         is what this patch does.
16401
16402         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16324
16403
16404 2022-10-18  Carl Love  <cel@us.ibm.com>
16405
16406         Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support.
16407         The hardware watchpoint check has been updated in a couple of recent
16408         patches.  This patch updates the hardware watchpoint test in the remaining
16409         gdb tests.
16410
16411         The issue is the PowerPC processors support hardware watchpoints with the
16412         exception of Power 9. The hardware watchpoint support is disabled on
16413         Power 9.  The test skip_hw_watchpoint_tests must be used to correctly
16414         determine if the PowerPC processor supports hardware watchpoints.
16415
16416         This patch fixes 6 test failures in test gdb.threads/watchpoint-fork.exp.
16417
16418         Test gdb.base/watch-vfork.exp runs with can-use-hw-watchpoints set to
16419         true and false.  When the test is run with can-use-hw-watchpoints set to
16420         true, gdb just falls back to using software watchpoints.  The
16421         patch reduces the number of expected passes by 2 since because it now
16422         only runs once with can-use-hw-watchpoints set to false.
16423
16424         Test gdb.mi/mi-watch.exp runs the test with argument hw and sw.  If the
16425         argument is hw and hardware watchpoints are not supported the test exits.
16426         The number of expected passes is cut in half with the patch as it now only
16427         runs the test using software breakpoints.  Previously the pass to use
16428         hardware watchpoints was not skipped and the test actually ran using
16429         software watchpoints.
16430
16431         The following tests run the same with and without the patch.  The tests
16432         are supposed to execute the gdb command "set can-use-hw-watchpoints 0" if
16433         the processor does not support hardware bwatchpoints.  However the command
16434         was not being executed and gdb was falling back to using software
16435         watchpoints since the Power 9 watchpoint resource check fails.  With the
16436         patch, the tests now execute the command and the test runs using software
16437         watchpoints as it did previously.  The tests are:
16438
16439         gdb.base/commands.exp
16440         gdb.base/cond-eval-mode.exp
16441         gdb.base/display.exp
16442         gdb.base/gdb11531.exp
16443         gdb.base/recurse.exp
16444         gdb.base/value-double-free.exp
16445         gdb.base/watch-bitfields.exp
16446         gdb.base/watch-cond-infcall.exp
16447         gdb.base/watch-cond.exp
16448         gdb.base/watchpoint-solib.exp
16449         gdb.base/watchpoints.exp
16450
16451         The following two tests are not supported on the Power 9 system used to
16452         test the changes.  The patch does not change the tests results for these
16453         tests:
16454
16455         gdb.python/py-breakpoint.exp
16456         gdb.mi/mi-watch-nonstop.exp
16457
16458 2022-10-18  Tom de Vries  <tdevries@suse.de>
16459
16460         [gdb/testsuite] Handle header files with local-remote-host.exp
16461         With test-case gdb.base/included.exp and host board local-remote-host.exp with
16462         tentative fix for PR29697 I run into:
16463         ...
16464         included.c:18:10: fatal error: included.h: No such file or directory
16465          #include "included.h"
16466                   ^~~~~~~~~~~~
16467         compilation terminated.
16468         ...
16469
16470         Fix this by adding the missing gdb_remote_download calls.
16471
16472         Likewise in a few other test-cases.
16473
16474         Tested on x86_64-linux.
16475
16476 2022-10-18  Tom de Vries  <tdevries@suse.de>
16477
16478         [gdb/testsuite] Fix gdb.server/no-thread-db.exp with local-remote-host.exp
16479         With test-case gdb.server/no-thread-db.exp and host board local-remote-host.exp
16480         with a tentative fix for PR29697 I run into:
16481         ...
16482         (gdb) print foo^M
16483         Cannot find thread-local storage for Thread 29613.29613, executable file \
16484           $HOME/no-thread-db:^M
16485         Remote target failed to process qGetTLSAddr request^M
16486         (gdb) FAIL: gdb.server/no-thread-db.exp: print foo
16487         ...
16488
16489         The regexp in the test-case expects the full $binfile pathname, but we have
16490         instead $HOME/no-thread-db.
16491
16492         Fix this by making the regexp less strict.
16493
16494         Tested on x86_64-linux.
16495
16496 2022-10-18  Tom de Vries  <tdevries@suse.de>
16497
16498         [gdb/testsuite] Fix gdb.base/return-nodebug.exp with local-remote-host.exp
16499         With host board local-remote-host.exp and test-case
16500         gdb.base/return-nodebug.exp, I run into:
16501         ...
16502         Executing on host: gcc -fno-stack-protector -fdiagnostics-color=never \
16503           -DTYPE=signed\ char -c -g  -o return-nodebug-signed-char0.o  \
16504           /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/return-nodebug.c \
16505           (timeout = 300)
16506         builtin_spawn [open ...]^M
16507         gcc: error: char: No such file or directory
16508         ...
16509
16510         Avoid the quoting problem by not using spaces in the define.
16511
16512         Tested on x86_64-linux.
16513
16514 2022-10-18  Tom de Vries  <tdevries@suse.de>
16515
16516         [gdb/testsuite] Fix gdb.server/file-transfer.exp with local-remote-host.exp
16517         When running test-case gdb.server/file-transfer.exp with host
16518         board local-remote-host.exp, I get:
16519         ...
16520         Executing on host: cmp -s $outputs/gdb.server/file-transfer/file-transfer \
16521           down-server    (timeout = 300)
16522         builtin_spawn [open ...]^M
16523         XYZ2ZYX
16524         FAIL: gdb.server/file-transfer.exp: compare intermediate binary file
16525         ...
16526
16527         The remote host and remote target cases are handled here together here in proc
16528         test_file_transfer:
16529         ...
16530             if {![is_remote host] && ![is_remote target]} {
16531                set up_server [standard_output_file $up_server]
16532                set down_server [standard_output_file $down_server]
16533             }
16534         ...
16535
16536         Fix this by handling them separately.
16537
16538         Tested on x86_64-linux.
16539
16540 2022-10-18  Tom de Vries  <tdevries@suse.de>
16541
16542         [gdb/testsuite] Update boards/README
16543         Update gdb/testsuite/boards/README to reflect recent commit c4c8c27263d
16544         ("[gdb/testsuite] Fix host board local-remote-host-notty.exp timeouts"), which
16545         means the board now uses a pseudo-tty, but with editing disabled.
16546
16547 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16548
16549         gdb, solib-svr4: support namespaces in DSO iteration
16550         When looking up names, GDB needs to stay within one linker namespace to
16551         find the correct instance in case the same name is provided in more than
16552         one namespace.
16553
16554         Modify svr4_iterate_over_objfiles_in_search_order() to stay within the
16555         namespace of the current_objfile argument.  If no current_objfile is
16556         provided (i.e. it is nullptr), iterate over objfiles in the initial
16557         namespace.
16558
16559         For objfiles that do not have a corresponding so_list to provide the
16560         namespace, assume that the objfile was loaded into the initial namespace.
16561         This would cover the main executable objfile (which is indeed loaded into
16562         the initial namespace) as well as manually added symbol files.
16563
16564         Expected fails:
16565
16566           - gdb.base/non-lazy-array-index.exp: the expression parser may lookup
16567             global symbols, which may result in xfers to read auxv for determining
16568             the debug base as part of svr4_iterate_over_objfiles_in_search_order().
16569
16570           - gdb.server/non-lazy-array-index.exp: symbol lookup may access the
16571             target to read AUXV in order to determine the debug base for SVR4
16572             linker namespaces.
16573
16574         Known issues:
16575
16576           - get_symbol_address() and get_msymbol_address() search objfiles for a
16577             'better' match.  This was introduced by
16578
16579                 4b610737f02 Handle copy relocations
16580
16581             to handle copy relocations but it now causes a wrong address to be
16582             read after symbol lookup actually cound the correct symbol.  This can
16583             be seen, for example, with gdb.base/dlmopen.exp when compiled with
16584             clang.
16585
16586           - gnu ifuncs are only looked up in the initial namespace.
16587
16588           - lookup_minimal_symbol() and lookup_minimal_symbol_text() directly
16589             iterate over objfiles and are not aware of linker namespaces.
16590
16591 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16592
16593         gdb: update gnu ifunc resolve
16594         Update elf_gnu_ifunc_resolve_by_cache() and elf_gnu_ifunc_resolve_by_got()
16595         to use gdbarch_iterate_over_objfiles_in_search_order() in order to
16596         restrict the objfile traversal to the initial namespace.
16597
16598         In order to extend this to other namespaces, we'd need to provide context,
16599         e.g. via an objfile inside that namespace.
16600
16601 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16602
16603         gdb, symtab: inline find_quick_global_symbol_language
16604         There is only one use of find_quick_global_symbol_language that calls it
16605         for the special symbol "main".
16606
16607         Inline the function as it is probably not correct in the general case
16608         where we may have multiple instances of global symbols with the same name
16609         but different languages in different libraries in different linker
16610         namespaces.
16611
16612         Further, change the objfiles iteration into a call to
16613         gdbarch_iterate_over_objfiles_in_search_order, which would only search the
16614         initial linker namespace, where we expect "main" to be located.
16615
16616 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16617
16618         gdb, hppa: remove unused hppa_lookup_stub_minimal_symbol
16619         I stumbled over this while reviewing all objfiles traversals with regards
16620         to impact of linker namespaces.
16621
16622         Recursive grep only finds two occurrences of hppa_lookup_stub_minimal_symbol:
16623           - the declaration in hppa-tdep.h.
16624           - the definition in hppa-tdep.c.
16625
16626         There appear to be no calls to this function.  Remove it.
16627
16628 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16629
16630         gdb, cp: update add_symbol_overload_list_qualified
16631         Iterate over objfiles in search order using the objfile of the selected
16632         block as current_objfile so the iteration can stay inside the block's
16633         linker namespace.
16634
16635         fixup! gdb, ada: update ada_lookup_simple_minsym
16636         remove get_selected_block()
16637
16638         gdb, ada: update ada_lookup_simple_minsym
16639         Iterate over objfile in search order using the objfile of the context
16640         block as current_objfile so the iteration can stay inside the block's
16641         linker namespace.
16642
16643         gdb, ada: collect standard exceptions in all objfiles
16644         When searching for standard exceptions for Ada, we lookup the minimal
16645         symbol of each exception.  With linker namespaces there can be multiple
16646         instances in different namespaces.  Collect them all.
16647
16648 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16649
16650         gdb, python: use gdbarch_iterate_over_objfiles_in_search_order
16651         The implementation of gdb.lookup_objfile() iterates over all objfiles and
16652         compares their name or build id to the user-provided search string.
16653
16654         This will cause problems when supporting linker namespaces as the first
16655         objfile in any namespace will be found.  Instead, use
16656         gdbarch_iterate_over_objfiles_in_search_order to only consider the
16657         namespace of gdb.current_objfile() for the search, which defaults to the
16658         initial namespace when gdb.current_objfile() is None.
16659
16660 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16661
16662         gdb, compile: unlink objfile stored in module
16663         When cleaning up after a compile command, we iterate over all objfiles and
16664         unlink the first objfile with the same name as the one we compiled.
16665
16666         Since we already store a pointer to that objfile in the module and use it
16667         to get the name we're comparing against, there's no reason to iterate, at
16668         all.  We can simply use that objfile.
16669
16670         This further avoids potential issues when an objfile with the same name is
16671         loaded into a different linker namespace.
16672
16673 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16674
16675         gdb, gdbserver: extend RSP to support namespaces
16676         Introduce a new qXfer:libraries-svr4:read annex key/value pair
16677
16678             lmid=<namespace identifier>
16679
16680         to be used together with start and prev to provide the namespace of start
16681         and prev to gdbserver.
16682
16683         Unknown key/value pairs are ignored by gdbserver so no new supports check
16684         is needed.
16685
16686         Introduce a new library-list-svr4 library attribute
16687
16688             lmid
16689
16690         to provide the namespace of a library entry to GDB.
16691
16692         This implementation uses the address of a namespace's r_debug object as
16693         namespace identifier.
16694
16695         This should have incremented the minor version but since unknown XML
16696         attributes are ignored, anyway, and since changing the version results in
16697         a warning from GDB, the version is left at 1.0.
16698
16699 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16700
16701         gdbserver: move main_lm handling into caller
16702         When listing SVR4 shared libraries, special care has to be taken about the
16703         first library in the default namespace as that refers to the main
16704         executable.  The load map address of this main executable is provided in
16705         an attribute of the library-list-svr4 element.
16706
16707         Move that code from where we enumerate libraries inside a single namespace
16708         to where we generate the rest of the library-list-svr4 element.  This
16709         allows us to complete the library-list-svr4 element inside one function.
16710
16711         There should be no functional change.
16712
16713 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16714             Lu, Hongjiu  <hongjiu.lu@intel.com>
16715
16716         gdb, gdbserver: support dlmopen()
16717         In glibc, the r_debug structure contains (amongst others) the following
16718         fields:
16719
16720           int r_version:
16721             Version number for this protocol.  It should be greater than 0.
16722
16723         If r_version is 2, struct r_debug is extended to struct r_debug_extended
16724         with one additional field:
16725
16726           struct r_debug_extended *r_next;
16727             Link to the next r_debug_extended structure.  Each r_debug_extended
16728             structure represents a different namespace.  The first r_debug_extended
16729             structure is for the default namespace.
16730
16731         1. Change solib_svr4_r_map argument to take the debug base.
16732         2. Add solib_svr4_r_next to find the link map in the next namespace from
16733         the r_next field.
16734         3. Update svr4_current_sos_direct to get the link map in the next namespace
16735         from the r_next field.
16736         4. Don't check shared libraries in other namespaces when updating shared
16737         libraries in a new namespace.
16738         5. Update svr4_same to check the load offset in addition to the name
16739         6. Update svr4_default_sos to also set l_addr_inferior
16740         7. Change the flat solib_list into a per-namespace list using the
16741         namespace's r_debug address to identify the namespace.
16742
16743         Add gdb.base/dlmopen.exp to test this.
16744
16745         To remain backwards compatible with older gdbserver, we reserve the
16746         namespace zero for a flat list of solibs from all namespaces.  Subsequent
16747         patches will extend RSP to allow listing libraries grouped by namespace.
16748
16749         This fixes PR 11839.
16750
16751 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16752
16753         gdb, solib-svr4: remove locate_base()
16754         Whenever we call locate_base(), we clear info->debug_base directly before
16755         the call.  Thus, we never cache the base location as locate_base() had
16756         intended.
16757
16758         Move the svr4_have_link_map_offsets() check into elf_locate_base(), inline
16759         locate_base() at all call sites, and remove it.
16760
16761 2022-10-18  Markus Metzger  <markus.t.metzger@intel.com>
16762
16763         gdb, testsuite: extend gdb_test_multiple checks
16764         Check for
16765
16766             warning: Corrupted shared library list
16767
16768         and for
16769
16770             Invalid cast.
16771             warning: Probes-based dynamic linker interface failed.
16772             Reverting to original interface.
16773
16774         in gdb_test_multiple.
16775
16776 2022-10-18  Jan Beulich  <jbeulich@suse.com>
16777
16778         x86: generalize gas documentation for disabling of ISA extensions
16779         As of commit ae89daecb132 ("x86: generalize disabling of sub-
16780         architectures") there's no arbitrary subset of ISAs which can also be
16781         disabled. This should have been reflected in documentation right away.
16782         Since I failed to do so, correct this now.
16783
16784         x86: correct CPU_AMX_{BF16,INT8}_FLAGS
16785         AMX-TILE is a prereq to these, as already correctly expressed by
16786         CPU_ANY_AMX_TILE_FLAGS. Express the dependency also in the reverse
16787         ("positive") direction.
16788
16789 2022-10-18  GDB Administrator  <gdbadmin@sourceware.org>
16790
16791         Automatic date update in version.in
16792
16793 2022-10-17  Tom Tromey  <tromey@adacore.com>
16794
16795         kfail an Ada test for GCC < 12
16796         I noticed one particular Ada test was failing on Fedora 34, but works
16797         when I switch to GCC 12.  This patch arranges to kfail the test when
16798         an older compiler is used.
16799
16800         I tested this with GCC 11, 12, and 13.  I'm going to check it in.
16801
16802 2022-10-17  Tom Tromey  <tromey@adacore.com>
16803
16804         Remove a nullptr check in DWARF scanner
16805         In scan_attributes, The DWARF scanner checks whether maybe_defer is
16806         nullptr, but this can never happen.  This patch removes the check.
16807
16808 2022-10-17  Pedro Alves  <pedro@palves.net>
16809
16810         gdbarch-components.py: Remove spurious space from "frame_info_ptr " params
16811         If you run gdbarch.py today, you'll get local modifications compared
16812         to what's in the tree, like:
16813
16814          --- c/gdb/gdbarch-gen.h
16815          +++ w/gdb/gdbarch-gen.h
16816          @@ -315,8 +315,8 @@ extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register
16817              should match the address at which the breakpoint was set in the dummy
16818              frame. */
16819
16820          -typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, frame_info_ptr this_frame);
16821          -extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame);
16822          +typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, frame_info_ptr  this_frame);
16823          +extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr  this_frame);
16824           extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
16825
16826         etc.
16827
16828         The extra space comes from the "frame_info_ptr " param that appears in
16829         a number of gdbarch methods in gdbarch-components.py.  With the extra
16830         space removed, running ./gdbarch.py generates the exact code that's in
16831         the tree already.
16832
16833         Change-Id: If7d20b8c6b2fd9ff466142a01bd2611c9ef9f53e
16834
16835 2022-10-17  Tom Tromey  <tromey@adacore.com>
16836
16837         Change .gdb_index de-duplication implementation
16838         While investigating PR symtab/29179, I found that one Ada test failed
16839         because, although a certain symbol was present in the index, with the
16840         new DWARF reader it pointed to a different CU than was chosen by
16841         earlier versions of gdb.
16842
16843         This patch changes how symbol de-duplication is done, deferring the
16844         process until the entire symbol table has been constructed.  This way,
16845         it's possible to always choose the lower-numbered CU among duplicates,
16846         which is how gdb (implicitly) previously worked.
16847
16848         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
16849
16850 2022-10-17  Tom Tromey  <tromey@adacore.com>
16851
16852         Improve Ada support in .gdb_index
16853         The cooked index work changed how .gdb_index is constructed, and in
16854         the process broke .gdb_index support.  This is PR symtab/29179.
16855
16856         This patch partially fixes the problem.  It arranges for Ada names to
16857         be encoded in the form expected by the index code.  In particular,
16858         linkage names for Ada are emitted, including the "main" name; names
16859         are Ada-encoded; and names are no longer case-folded, something that
16860         prevented operator names from round-tripping correctly.
16861
16862         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
16863
16864 2022-10-17  Tom Tromey  <tromey@adacore.com>
16865
16866         Don't add type linkage names to cooked index
16867         The compiler will sometimes emit a linkage name for a type, like:
16868
16869             <1d3>   DW_AT_linkage_name: (indirect string, offset: 0x106f): 11__mbstate_t
16870
16871         These names aren't very useful, and this patch changes the DWARF
16872         reader so that they are ignored by the cooked index.
16873
16874 2022-10-17  Tom Tromey  <tromey@adacore.com>
16875
16876         Fix regression in c-linkage-name.exp with gdb index
16877         c-linkage-name.exp started failing with the gdb-index target board due
16878         to an earlier patch.  The problem here is that some linkage names must
16879         be in the index -- but, based on inspection, not C++ linkage names.
16880         This patch updates the code to exclude only these.
16881
16882 2022-10-17  TaiseiIto  <taisei1212@outlook.jp>
16883
16884         Fix null pointer representations
16885         Since "NULL" and "0" are used to represent invalid address in function
16886         "gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c", I modified
16887         them to "nullptr".
16888
16889 2022-10-17  Simon Marchi  <simon.marchi@efficios.com>
16890
16891         gdb: silence unused-but-set-variable warning about yynerrs in cp-name-parser.y
16892         When building with clang 15 on Ubuntu 20.04, I get:
16893
16894               CXX    cp-name-parser.o
16895             cp-name-parser.c.tmp:1777:9: error: variable 'cpnameyynerrs' set but not used [-Werror,-Wunused-but-set-variable]
16896                 int yynerrs;
16897                     ^
16898             /home/smarchi/src/binutils-gdb/gdb/yy-remap.h:58:18: note: expanded from macro 'yynerrs'
16899             #define yynerrs         GDB_YY_REMAP (yynerrs)
16900                                     ^
16901             /home/smarchi/src/binutils-gdb/gdb/yy-remap.h:40:29: note: expanded from macro 'GDB_YY_REMAP'
16902             #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
16903                                         ^
16904             /home/smarchi/src/binutils-gdb/gdb/yy-remap.h:39:39: note: expanded from macro 'GDB_YY_REMAP_1'
16905             #define GDB_YY_REMAP_1(PREFIX, YYSYM) GDB_YY_REMAP_2 (PREFIX, YYSYM)
16906                                                   ^
16907             /home/smarchi/src/binutils-gdb/gdb/yy-remap.h:38:39: note: expanded from macro 'GDB_YY_REMAP_2'
16908             #define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
16909                                                   ^
16910             <scratch space>:45:1: note: expanded from here
16911             cpnameyynerrs
16912             ^
16913
16914         This is because clang 15 warns for something like this:
16915
16916             int n;
16917             n = 0;
16918             ++n;
16919
16920         whereas previous versions do not.
16921
16922         yynerrs is defined in yyparse and is there for actions to use.  Since
16923         the actions in cp-name-parser.y don't use it, we get a warning.  We see
16924         this problem on this particular .y file because it uses `%pure-parser`
16925         [1], which makes yynerrs a local rather than a global.
16926
16927         I initially fixed this by using
16928         DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE (like in commit f7aa1a5acc5
16929         ("gold: Suppress "unused" variable warning on Clang")), but then I
16930         realized we could suppress the warning in a more fine-grained way using
16931         this in a rule:
16932
16933             (void) yynerrs;
16934
16935         [1] https://www.gnu.org/software/bison/manual/html_node/Error-Reporting-Function.html
16936
16937         Change-Id: I6cae7a4207c19fe1b719e2ac19be69122ebe3af1
16938
16939 2022-10-17  Clément Chigot  <chigot@adacore.com>
16940
16941         ld/testsuite: consistently add board_ldflags when linking with GCC
16942         Currently, the functions checking if the compiler is available or if a
16943         feature is available add both board_cflags and board_ldflags.
16944         However, functions running the tests only retrieve board_cflags. This
16945         can lead to unexpected errors when mandaratory flags are defined in
16946         board_ldflags and not board_cflags.
16947
16948         ld/ChangeLog:
16949
16950                 * testsuite/ld-unique/unique.exp: Add board_ldflags when
16951                 linking with GCC.
16952                 * testsuite/lib/ld-lib.exp: Likewise.
16953
16954 2022-10-17  CaiJingtao  <caijingtao@huawei.com>
16955
16956         Allow explicit size specifier for predicate operand of {sq, uq, }{incp, decp}
16957         Omitting predicate size specifier in vector form of {sq, uq, }{decp, incp} is deprecated and will be prohibited in a future release of the aarch64,
16958         see https://developer.arm.com/documentation/ddi0602/2021-09/SVE-Instructions/DECP--vector---Decrement-vector-by-count-of-true-predicate-elements-.
16959
16960         This allows explicit size specifier, e.g. `decp z0.h, p0.h`, for predicate operand of these SVE instructions.
16961         The existing behaviour of not requiring the specifier is preserved.
16962         And the disasembly is with the specifier with this patch.
16963
16964         The GAS tests passed under our local tests.
16965
16966         opcodes/
16967                 * aarch64-asm.c: Modify `sve_size_hsd` encoding.
16968                 * aarch64-tbl.h (aarch64_opcode_table): Add QUALS's type OP_SVE_Vv_HSD
16969                 for decp, incp, sqdecp, sqincp, uqdecp and uqincp.
16970
16971         gas/
16972                 * testsuite/gas/aarch64/sve-movprfx_23.s: Update movprfx_23 testcase's
16973                 test_sametwo macro, where take the predicate size specifier.
16974                 * testsuite/gas/aarch64/sve-movprfx_23.d: Update movprfx_23 testcase's
16975                 expected disassembly.
16976                 * testsuite/gas/aarch64/sve-movprfx_23.l: Update movprfx_23 testcase's
16977                 expected assembler messages.
16978                 * testsuite/gas/aarch64/sve.s: Add sve testcase's instructions for
16979                 decp, incp, sqdecp, sqincp, uqdecp and uqincp, which take the
16980                 predicate size specifier.
16981                 * testsuite/gas/aarch64/sve.d: Update sve testcase's expected
16982                 disassembly.
16983
16984 2022-10-17  Richard Sandiford  <richard.sandiford@arm.com>
16985
16986         aarch64: Tweak handling of F_STRICT
16987         Current F_STRICT qualifier checking is enforced after the fact
16988         rather than as part of the match.  This makes it impossible to
16989         have, e.g.:
16990
16991            QLF2(S_D, S_D)
16992            QLF2(S_D, NIL)
16993
16994         in the same list.
16995
16996         opcodes/
16997                 * aarch64-opc.c (aarch64_find_best_match): Handle F_STRICT here
16998                 rather than...
16999                 (match_operands_qualifier): ...here.
17000
17001 2022-10-17  Jan Beulich  <jbeulich@suse.com>
17002
17003         x86: properly decode EVEX.W for AVX512_4{FMAPS,VNNIW} insns
17004         These require EVEX.W=0. Use %XS to facilitate the checking, even if for
17005         the AVX512_4VNNIW ones this is kind of an abuse (as 's' there stands for
17006         "signed", not "single").
17007
17008         While there also correct the 3rd operand for the AVX512_4VNNIW entries:
17009         Only the memory form is allowed (just like for AVX512_4FMAPS, where the
17010         correct type is already in use).
17011
17012 2022-10-17  Jan Beulich  <jbeulich@suse.com>
17013
17014         x86: fold AVX512-VNNI disassembler entries with AVX-VNNI ones
17015         Make %XV also print the separating blank in the VEX case, while making
17016         it do nothing for EVEX-encoded insns. This way the AVX-VNNI entries
17017         can be re-used for AVX512-VNNI, at the same time fixing the lack of
17018         EVEX.W decoding.
17019
17020         For the AVX-VNNI ones further make sure only VEX.66 forms are actually
17021         decoded.
17022
17023 2022-10-17  GDB Administrator  <gdbadmin@sourceware.org>
17024
17025         Automatic date update in version.in
17026
17027 2022-10-16  Tom Tromey  <tom@tromey.com>
17028
17029         More uses of checked_static_cast
17030         This patch changes a few more uses of static_cast to use
17031         checked_static_cast.  In this patch, cast-to-references are converted
17032         by moving the dereference outside of the cast, as checked_static_cast
17033         only handles pointers.
17034
17035 2022-10-16  Tom Tromey  <tom@tromey.com>
17036
17037         Use checked_static_cast in more places
17038         I looked through all the uses of static_cast<... *> in gdb and
17039         converted many of them to checked_static_cast.
17040
17041         I couldn't test a few of these changes.
17042
17043 2022-10-16  Alan Modra  <amodra@gmail.com>
17044
17045         PowerPC se_rfmci and VLE, SPE2 and LSP insns with -many
17046         I noticed recently that se_rfmci, a VLE mode instruction, was being
17047         accepted by non-VLE cpus, and also that se_rfmci by itself in a
17048         section did not cause SHF_PPC_VLE to be set.  ie. both testcases added
17049         by this patch fail without the changes to tc-ppc.c here.
17050
17051         Also, VLE, SPE2 and LSP insns were not accepted by the assembler with
17052         -many nor were SPE2 and LSP being disassembled with -Many.
17053
17054         gas/
17055                 * config/tc-ppc.c (ppc_setup_opcodes): Wrap long lines.  Add
17056                 vle_opcodes when PPC_OPCODE_VLE or PPC_OPCODE_ANY.  Simplify
17057                 disassembler index segment checks.  Add LSP and SPE2 opcodes
17058                 when PPC_OPCODE_ANY too.
17059                 (md_assemble): Correct logic adding PPC_APUINFO_VLE and
17060                 SHF_PPC_VLE.
17061                 * testsuite/gas/ppc/se_rfmci.s
17062                 * testsuite/gas/ppc/se_rfmci.d,
17063                 * testsuite/gas/ppc/se_rfmci_bad.d: New tests.
17064                 * testsuite/gas/ppc/ppc.exp: Run them.
17065         opcodes/
17066                 * ppc-dis.c (print_insn_powerpc): Disassemble SPE2 and LSP insn
17067                 when -Many.
17068                 * ppc-opc.c (vle_opcodes <se_rfmci>): Comment.
17069
17070 2022-10-16  Alan Modra  <amodra@gmail.com>
17071
17072         zlib-gabi to zstd woes
17073         So we had a zlib-gabi .debug_info section that increased in size with
17074         zstd, so much so that it was better to leave the section
17075         uncompressed.  Things went horribly wrong when the section was read
17076         again later.  The section was read again off disk using the
17077         uncompressed size.  So you get the zlib section again with some
17078         garbage at the end.  Fix that particular problem by setting the
17079         section flag SEC_IN_MEMORY.  Any future read will get sec->contents.
17080
17081         Also, if the section is to be left uncompressed, the input
17082         SHF_COMPRESSED flag needs to be reset otherwise objcopy will copy it
17083         to output.
17084
17085         Finally, bfd_convert_section_contents needed a small update to handle
17086         zstd compressed sections, and I've deleted bfd_cache_section_contents.
17087
17088                 * bfd.c (bfd_convert_section_contents): Handle zstd.
17089                 * compress.c (bfd_compress_section_contents): When section
17090                 contents are uncompressed set SEC_IN_MEMORY flag,
17091                 compress_status to COMRESS_SECTION_NONE, and clear
17092                 SHF_COMPRESSED.  Set SEC_IN_MEMORY for compressed contents.
17093                 (bfd_get_full_section_contents): Don't check section size
17094                 against file size when SEC_IN_MEMORY.
17095                 (bfd_cache_section_contents): Delete function.
17096                 * elf32-arm.c (elf32_arm_get_synthetic_symtab): Expand
17097                 bfd_cache_section_contents here.
17098                 * bfd-in2.h: Regenerate.
17099
17100 2022-10-16  GDB Administrator  <gdbadmin@sourceware.org>
17101
17102         Automatic date update in version.in
17103
17104 2022-10-15  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
17105
17106         gdb/arm: Don't rely on loop detection to stop unwinding
17107         Setting SP of the next frame to the same address as the current frame
17108         is an ugly way to stop the unwinding.  A cleaner way is to rely on
17109         the frame_unwind_stop_reason function to return UNWIND_OUTERMOST.
17110
17111 2022-10-15  GDB Administrator  <gdbadmin@sourceware.org>
17112
17113         Automatic date update in version.in
17114
17115 2022-10-14  Tom de Vries  <tdevries@suse.de>
17116
17117         [gdb/testsuite] Add boards/README
17118         Add a file gdb/testsuite/boards/README, to make it easier to get a high-level
17119         overview of the various boards.
17120
17121 2022-10-14  Tom de Vries  <tdevries@suse.de>
17122
17123         [gdb/contrib] Handle STRIP_ARGS_{STRIP,KEEP}_DEBUG in cc-with-tweaks.sh
17124         Handle new environment variable STRIP_ARGS_STRIP_DEBUG, defaulting to
17125         --strip-debug in gdb/contrib/cc-with-tweaks.sh, such that we can easily
17126         reproduce the PR29277 assert using:
17127         ...
17128         $ export STRIP_ARGS_STRIP_DEBUG=--strip-all
17129         $ make check RUNTESTFLAGS="gdb.base/jit-reader.exp \
17130             --target_board cc-with-gnu-debuglink"
17131         ...
17132
17133         For completeness sake and to avoid confusion about which of the two used strip
17134         invocations the passed args apply to, likewise add STRIP_ARGS_KEEP_DEBUG,
17135         defaulting to --only-keep-debug.
17136
17137         Script checked with shellcheck, no new warnings added.
17138
17139         Tested on x86_64-linux.
17140
17141 2022-10-14  Tom de Vries  <tdevries@suse.de>
17142
17143         [gdb] Fix heap-buffer-overflow in find_program_interpreter
17144         With the test-case included in this patch, we run into:
17145         ...
17146         (gdb) target remote localhost:2347^M
17147         `target:twice-connect' has disappeared; keeping its symbols.^M
17148         Remote debugging using localhost:2347^M
17149         warning: Unable to find dynamic linker breakpoint function.^M
17150         GDB will be unable to debug shared library initializers^M
17151         and track explicitly loaded dynamic code.^M
17152         Reading /usr/lib/debug/.build-id/$hex/$hex.debug from remote target...^M
17153         0x00007ffff7dd4550 in ?? ()^M
17154         (gdb) PASS: gdb.server/twice-connect.exp: session=second: gdbserver started
17155         FAIL: gdb.server/twice-connect.exp: found interpreter
17156         ...
17157
17158         The problem originates in find_program_interpreter, where
17159         bfd_get_section_contents is called to read .interp, but fails.  The function
17160         returns false but the result is ignored, so find_program_interpreter returns
17161         some random string.
17162
17163         Fix this by checking the result of the call to bfd_get_section_contents.
17164
17165         Tested on x86_64-linux.
17166
17167         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29652
17168
17169 2022-10-14  Tom de Vries  <tdevries@suse.de>
17170
17171         [gdb/testsuite] Fix gdb.server/unittest.exp with host board local-remote-host.exp
17172         With test-case gdb.server/unittest.exp and host board local-remote-host.exp I
17173         run into:
17174         ...
17175         builtin_spawn build/gdbserver/gdbserver --selftest^M
17176         ERROR: : spawn id exp7 not open
17177             while executing
17178         "expect {
17179         -i exp7 -timeout 10
17180             -i $server_spawn_id
17181             -re "Ran ($decimal) unit tests, 0 failed" {
17182                 set num_ran $expect_out(1,string)
17183                 gdb_assert "..."
17184             ("uplevel" body line 1)
17185             invoked from within
17186         "uplevel $body" NONE : spawn id exp7 not open
17187         UNRESOLVED: gdb.server/unittest.exp: unit tests
17188         ...
17189
17190         The problem is (as fixed for avr in commit df5b8876083 ("gdb/testsuite: better
17191         handle failures in simavr board, reap simavr process")), that gdb_expect through
17192         remote_expect adds a "-i <gdb spawn id> -timeout 10", which is the one causing
17193         the error.
17194
17195         As in aforementioned commit, fix this by using expect instead.
17196
17197         Tested on x86_64-linux.
17198
17199 2022-10-14  Tom de Vries  <tdevries@suse.de>
17200
17201         [gdb/testsuite] Fix host board local-remote-host-notty.exp timeouts
17202         With test-case gdb.server/stop-reply-no-thread-multi.exp and host board
17203         local-remote-host-notty.exp we occasionally run into a silent out, due to
17204         getting:
17205         ...
17206         (gdb) kill^M
17207         (gdb) The program is not being run.^M
17208         ...
17209         instead of the expected:
17210         ...
17211         (gdb) kill^M
17212         The program is not being run.^M
17213         (gdb)
17214         ...
17215
17216         Likewise, we occasionally run into a nonsilent timeout:
17217         ...
17218         (gdb) disconnect^M
17219         (gdb) You can't do that when your target is `exec'^M
17220         FAIL: gdb.server/stop-reply-no-thread.exp: to_disable=Tthread: t_nonstop=on: \
17221           disconnect (timeout)
17222         ...
17223
17224         Typically, this results in the test-case taking more than two minutes to run.
17225
17226         The problem can be reproduced using just:
17227         ...
17228         $ ssh -l $USER 127.0.0.1 gdb -q -ex kill
17229         ...
17230
17231         Note that ssh by default uses -T which disables pseudo-tty allocation (as
17232         opposed to -t which forces pseudo-tty allocation):
17233         ...
17234         $ ssh -l $USER 127.0.0.1 -T tty
17235         not a tty
17236         $ ssh -l $USER 127.0.0.1 -t tty
17237         /dev/pts/5
17238         Connection to 127.0.0.1 closed.
17239         ...
17240         and according to https://stackoverflow.com/a/63241102 the behaviour we're
17241         seeing is specific to using '-T'.
17242
17243         The related host board local-remote-host.exp does use '-t', and the only
17244         difference between the two boards mentioned is whether editing is on or off.
17245
17246         Fix this by:
17247         - moving the content of local-remote-host-notty.exp into
17248           local-remote-host.exp
17249         - consequently, extending the copyright years in local-remote-host.exp
17250         - including local-remote-host.exp in local-remote-host-notty.exp
17251           (making local-remote-host-notty.exp use '-t')
17252         - adding -iex "set editing off" to GDBFLAGS in local-remote-host-notty.exp
17253
17254         This results in the test-case taking just 6 seconds to run.
17255
17256         Tested on x86_64-linux.
17257
17258         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29669
17259
17260 2022-10-14  Tom de Vries  <tdevries@suse.de>
17261
17262         [gdb/testsuite] Disable styling in host board local-remote-host.exp
17263         With test-case gdb.server/stop-reply-no-thread.exp and host board
17264         local-remote-host.exp, I run into:
17265         ...
17266         Breakpoint 1, ^[[33mmain^[[m () at ^[[32mstop-reply-no-thread.c^[[m:21^M
17267         21        ^[[01;34mreturn^[[m ^[[35m0^[[m^[[31m;^[[m^M
17268         (gdb) FAIL: gdb.server/stop-reply-no-thread.exp: to_disable=: t_nonstop=off: \
17269           continue to main
17270         ...
17271
17272         The problem is that styling is enabled, and that is causing a regexp mismatch.
17273
17274         With native, styling is disabled in default_gdb_init by doing
17275         'setenv TERM "dumb"', but that only has effect because the build (where we
17276         execute runtest, and consequently the setenv) and the host (where we execute
17277         gdb) are the same.  For this host board however, gdb executes on a remote
17278         host, and the setenv has no effect.
17279
17280         We could try to make some generic way to set TERM on the host, but for the
17281         purposes of this test-case it seems sufficient to just add:
17282         ...
17283         set GDBFLAGS "${GDBFLAGS} -iex \"set style enabled off\""
17284         ...
17285         so let's go with that for now.
17286
17287         Tested on x86_64-linux.
17288
17289 2022-10-14  Tom Tromey  <tromey@adacore.com>
17290
17291         Use scoped_value_mark in more places
17292         I looked at all the spots using value_mark, and converted all the
17293         straightforward ones to use scoped_value_mark instead.
17294
17295         Regression tested on x86-64 Fedora 34.
17296
17297 2022-10-14  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
17298
17299         gdb/arm: Stop unwinding on error, but do not assert
17300         When it's impossible to read the FPCCR and XPSR, the unwinding is
17301         unpredictable as the it's not possible to determine the correct
17302         frame size or padding.
17303         The only sane thing to do in this condition is to stop the unwinding.
17304
17305         Example session without this patch:
17306
17307           (gdb) bt
17308           #0  SVC_Handler () at .../GPIO/GPIO_EXTI/Src/stm32f4xx_it.c:112
17309           .../gdb/arm-tdep.c:3594: internal-error: arm_m_exception_cache: Assertion `safe_read_memory_unsigned_integer (FPCCR, ARM_INT_REGISTER_SIZE, byte_order, &fpccr)' failed.
17310           A problem internal to GDB has been detected,
17311           further debugging may prove unreliable.
17312           ----- Backtrace -----
17313           0x5583bfb2a157 gdb_internal_backtrace_1
17314           ...
17315           ---------------------
17316
17317           This is a bug, please report it.  For instructions, see:
17318           <https://www.gnu.org/software/gdb/bugs/>.
17319
17320           Aborted (core dumped)
17321
17322         Example session with this patch:
17323
17324           (gdb) bt
17325           #0  SVC_Handler () at .../GPIO/GPIO_EXTI/Src/stm32f4xx_it.c:112
17326           warning: Could not fetch required FPCCR content.  Further unwind is impossible.
17327           #1  <signal handler called>
17328           (gdb)
17329
17330         Reviewed-by: Pedro Alves <pedro@palves.net>
17331
17332 2022-10-14  Alan Modra  <amodra@gmail.com>
17333
17334         PowerPC SPE disassembly and tests
17335         Where sub and subf forms of an instruction exist we generally
17336         disassemble to the extended insn sub form rather than the underlying
17337         machine subf instruction.  Do so for SPE evsubw and evsubiw too.
17338
17339         spe_ambiguous.d always was a bit too optimistic.  There is no sensible
17340         way to disassemble identical bytes back to different and original
17341         source.  Instead change the test to check -Mraw results.
17342
17343         gas/
17344                 * testsuite/gas/ppc/ppc.exp: Run spe_ambiguous test.
17345                 * testsuite/gas/ppc/spe.d: Expect evsubw and evsubiw rather than
17346                 evsubfw and evsubifw.
17347                 * testsuite/gas/ppc/spe_ambiguous.s: Test evnor form equivalent
17348                 to evnot.
17349                 * testsuite/gas/ppc/spe_ambiguous.d: Test Mraw.
17350         opcodes/
17351                 * ppc-opc.c (powerpc_opcodes): Move evsubw before evsubfw and
17352                 evsubiw before evsubifw and mark EXT.
17353
17354 2022-10-14  Alan Modra  <amodra@gmail.com>
17355
17356         e200 LSP support
17357         It has bothered me for a long time that we have disabled LSP (and SPE)
17358         tests.  Also the LSP test comment indicating there is something wrong
17359         with get_powerpc_dialect.  I don't think there is.  Decoding of a VLE
17360         instruction depends on whether the processor is in VLE mode (some
17361         processors support both VLE and standard PPC) which we flag per
17362         section with SHF_PPC_VLE for decoding when disassembling.
17363
17364         Background: Some versions of powerpc e200 have "Lightweight Signal
17365         Processing" support, examples being e200z215 and e200z425.  As far as
17366         I can tell, LSP and SPE are mutually exclusive.  This seems to be
17367         borne out by insn encoding, for example LSP "zvaddih" and SPE "evaddw"
17368         have the same encoding.  So none of the processor descriptions in
17369         ppc_opts ought to have both PPC_OPCODE_LSP and PPC_OPCODE_SPE/2, if we
17370         want disassembly to work.  I also could not find anything to suggest
17371         that the LSP insns are enabled only in VLE mode, which means the LSP
17372         insns should not be in vle_opcodes.
17373
17374         Fix all this by moving the LSP insns to their own table, and add a new
17375         e200z2 cpu entry with LSP support, removing LSP from -me200z4 and from
17376         -mvle.  (Yes, I know, as I said above some of the e200z4 processors
17377         have LSP.  Others have SPE.  It's hard to choose good options.  Think
17378         of z2 as meaning earlier, z4 as later.)  Also add -mlsp to allow
17379         adding the LSP insn set.
17380
17381         include/
17382                 * opcode/ppc.h (lsp_opcodes, lsp_num_opcodes): Declare.
17383                 (LSP_OP_TO_SEG): Define.
17384         binutils/
17385                 * doc/binutils.texi: Update ppc docs.
17386         gas/
17387                 * config/tc-ppc.c (ppc_setup_opcodes): Add lsp opcodes to ppc_hash.
17388                 * doc/c-ppc.texi: Document e200 and lsp.
17389                 * testsuite/gas/ppc/lsp-checks.d: Assemble with -me200z2.
17390                 * testsuite/gas/ppc/lsp.d: Likewise, disassembly too.
17391                 * testsuite/gas/ppc/ppc.exp: Don't xfail lsp test.
17392         opcodes/
17393                 * ppc-dis.c (ppc_opts): Add e200z2 and lsp.  Don't set
17394                 PPC_OPCODE_LSP for e200z4 or vle.
17395                 (ppc_parse_cpu): Mutually exclude LSP and SPE.
17396                 (LSP_OPCD_SEGS): Define.
17397                 (lsp_opcd_indices): New array.
17398                 (disassemble_init_powerpc): Init lsp_opcd_indices.
17399                 (lookup_lsp): New function.
17400                 (print_insn_powerpc): Call it.
17401                 * ppc-opc.c: Include libiberty.h for ARRAY_SIZE and use throughout.
17402                 (vle_opcodes): Move LSP opcodes to..
17403                 (lsp_opcodes): ..here, and sort.
17404                 (lsp_num_opcodes): New.
17405
17406 2022-10-14  Alan Modra  <amodra@gmail.com>
17407
17408         PR29677, Field `the_bfd` of `asymbol` is uninitialised
17409         Besides not initialising the_bfd of synthetic symbols, counting
17410         symbols when sizing didn't match symbols created if there were any
17411         dynsyms named "".  We don't want synthetic symbols without names
17412         anyway, so get rid of them.  Also, simplify and correct sanity checks.
17413
17414                 PR 29677
17415                 * mach-o.c (bfd_mach_o_get_synthetic_symtab): Rewrite.
17416
17417 2022-10-14  Tom de Vries  <tdevries@suse.de>
17418
17419         [gdb/testsuite] Drop unnecessary -Wl,-soname in gdb.base/skip-solib.exp
17420         I noticed in gdb.base/skip-solib.exp:
17421         ...
17422         if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} \
17423                 [list debug -Wl,-soname,${libname}.so]] != ""} {
17424             return -1
17425         }
17426         ...
17427         that the -Wl,-soname argument is missing an ldflags= prefix, but adding it
17428         gives us a duplicate:
17429         ...
17430         Executing on host: gcc -fno-stack-protector \
17431           outputs/gdb.base/skip-solib/skip-solib-lib.c.o  -fdiagnostics-color=never \
17432           -shared -g  -Wl,-soname,libskip-solib.so -Wl,-soname,libskip-solib.so -lm \
17433           -o outputs/gdb.base/skip-solib/libskip-solib.so    (timeout = 300)
17434         ...
17435         so apparently it's taken care of by gdb_compile_shlib.
17436
17437         Drop the inactive and also unnecessary -Wl,-soname,${libname}.so from the
17438         flags list for the gdb_compile_shlib call.
17439
17440         Tested on x86_64-linux.
17441
17442 2022-10-14  Tom de Vries  <tdevries@suse.de>
17443
17444         [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with PIE
17445         With test-case gdb.base/infoline-reloc-main-from-zero.exp and target board
17446         unix/-fPIE/-pie I run into:
17447         ...
17448         gdb compile failed, ld: infoline-reloc-main-from-zero: error: \
17449           PHDR segment not covered by LOAD segment
17450         collect2: error: ld returned 1 exit status
17451         ...
17452
17453         When running with native, I find that the executable is static:
17454         ...
17455         $ file infoline-reloc-main-from-zero
17456         infoline-reloc-main-from-zero: ELF 64-bit LSB executable, x86-64, \
17457           version 1 (SYSV), statically linked, BuildID[sha1]=$hex, with debug_info, \
17458           not stripped
17459         ...
17460         despite not having been compiled with -static.
17461
17462         Fix the compilation by adding -static to the compilation flags.
17463
17464         Tested on x86_64-linux.
17465
17466 2022-10-14  Tom de Vries  <tdevries@suse.de>
17467
17468         [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with clang
17469         With test-case gdb.base/infoline-reloc-main-from-zero.exp and clang I run into:
17470         ...
17471         gdb compile failed, clang-13.0: warning: -e main: 'linker' input unused \
17472           [-Wunused-command-line-argument]
17473         clang-13.0: warning: -Wl,-Ttext=0x00: 'linker' input unused \
17474           [-Wunused-command-line-argument]
17475         clang-13.0: warning: -Wl,-N: 'linker' input unused \
17476           [-Wunused-command-line-argument]
17477         UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: \
17478           infoline-reloc-main-from-zero.exp
17479         UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: failed to compile
17480         ...
17481
17482         Fix this by using ldflags instead of additional_flags.
17483
17484         Likewise, fix all occurrences of:
17485         ...
17486         $ find gdb/testsuite -name *.exp | xargs grep additional_flags.*Wl
17487         ...
17488
17489         Tested on x86_64-linux.
17490
17491 2022-10-14  Tom de Vries  <tdevries@suse.de>
17492
17493         [gdb/testsuite] Fix nopie test-cases with target board unix/-fPIE/-pie
17494         Compilers default to either PIE or no-PIE executables.
17495
17496         In order to test PIE executables with a compiler that produces non-PIE by
17497         default, we can use target board unix/-fPIE/-pie, which set the multilib_flags
17498         of the target board to "-fPIE -pie".
17499
17500         Likewise, we can use target board unix/-fno-PIE/-no-pie with a compiler that
17501         produces PIE by default.
17502
17503         The target board unix/-fno-PIE/-no-pie has a potential problem when compiling
17504         shared libs, because the multilib_flags will override the attempts of
17505         gdb_compile_shlib to compile with -fPIC.  This is taken care of by running the
17506         body of gdb_compile_shlib wrapped in with_PIE_multilib_flags_filtered.
17507
17508         The target board unix/-fPIE/-pie has a problem with nopie compilations.  The
17509         current approach is to do the compilation hoping for the best, and if we find
17510         out that the resulting executable is PIE despite specifying nopie, we error
17511         out with the standard error message "nopie failed to prevent PIE executable".
17512
17513         That however does not work for hard-coded assembly nopie test-cases, which will
17514         just noisily refuse to compile:
17515         ...
17516         ld: amd64-disp-step0.o: relocation R_X86_64_32S against `.text' can not be \
17517           used when making a PIE object; recompile with -fPIE^M
17518         ...
17519
17520         Fix this in gdb_compile by filtering out the PIE settings in the target board
17521         multilib_flags when pie or nopie is specified.
17522
17523         Tested on x86_64-linux.
17524
17525 2022-10-14  Tom de Vries  <tdevries@suse.de>
17526
17527         [gdb/testsuite] Factor out with_PIE_multilib_flags_filtered
17528         Factor out new procs with_PIE_multilib_flags_filtered and
17529         with_multilib_flags_filtered from proc gdb_compile_shlib.
17530
17531         Tested on x86_64-linux.
17532
17533 2022-10-14  Tom de Vries  <tdevries@suse.de>
17534
17535         [gdb/testsuite] Add cond_wrap proc
17536         Add a new proc cond_wrap, that can be used to replace the repetitive:
17537         ...
17538             if { $cond } {
17539                 wrap {
17540                     <body>
17541                 }
17542             } else {
17543                 <body>
17544             }
17545         ...
17546         with the shorter:
17547         ...
17548             cond_wrap $cond wrap {
17549                 <body>
17550             }
17551         ...
17552
17553         Tested on x86_64-linux.
17554
17555 2022-10-14  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
17556
17557         gdb: add Torbjörn Svensson to gdb/MAINTAINERS
17558
17559 2022-10-14  Jan Beulich  <jbeulich@suse.com>
17560
17561         RISC-V: Zicbo{m,p,z} adjustments to riscv_multi_subset_supports_ext()
17562         The lack thereof did caused gas to issue "internal: unreachable
17563         INSN_CLASS_*" errors when trying to assemble respective insns without
17564         the feature(s) enabled via e.g. ".option arch, ...". Of course a proper
17565         hint towards the missing extension then wasn't given either.
17566
17567 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17568
17569         RISC-V: Imply 'Zicsr' from privileged extensions with CSRs
17570         'H', 'Smstateen', 'Sscofpmf' and 'Sstc' are four privileged extensions with
17571         their CSR definitions and 'Smepmp' is a privileged extension with additional
17572         CSR bits.
17573
17574         Volume II: Privileged Architecture of the RISC-V ISA Manual states that the
17575         privileged architecture requires the 'Zicsr' extension.  However, current
17576         GNU Binutils has no direct way whether the program has dependency to the
17577         privileged architecture itself.
17578
17579         As a workaround, we should add implications from privileged extensions that
17580         either add new CSRs, extend existing CSRs or depends on using CSRs.
17581
17582         This commit adds such implications for existing privileged extensions that
17583         satisfy this condition.
17584
17585         gas/ChangeLog:
17586
17587                 * testsuite/gas/riscv/march-imply-h.d: New test, at least for 'H'.
17588
17589         bfd/ChangeLog:
17590
17591                 * elfxx-riscv.c (riscv_implicit_subsets): Add 'Zicsr'
17592                 implicications for privileged extensions 'H', 'Smstateen',
17593                 'Sscofpmf', 'Sstc' and 'Smepmp'.
17594
17595 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17596
17597         opcodes/riscv-dis.c: Remove last_map_state
17598         Before changing the core disassembler, we take care of minor code clarity
17599         issues and improve readability.
17600
17601         This commit removes unused variable last_map_state (set by the
17602         print_insn_riscv function but not read anywhere else).
17603
17604         opcodes/ChangeLog:
17605
17606                 * riscv-dis.c (last_map_state): Remove.
17607                 (print_insn_riscv): Remove setting last_map_state.
17608
17609 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17610
17611         opcodes/riscv-dis.c: Make XLEN variable static
17612         Before changing the core disassembler, we take care of minor code clarity
17613         issues and improve readability.
17614
17615         Since xlen variable is not (and should not) used outside riscv-dis.c,
17616         this commit makes this variable static.
17617
17618         opcodes/ChangeLog:
17619
17620                 * riscv-dis.c (xlen): Make this variable static.
17621
17622 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17623
17624         opcodes/riscv-dis.c: Use bool type whenever possible
17625         Before changing the core disassembler, we take care of minor code clarity
17626         issues and improve readability.
17627
17628         This commit replaces uses of int with bool whenever possible.
17629
17630         opcodes/ChangeLog:
17631
17632                 * riscv-dis.c (no_aliases) Change type to bool.
17633                 (set_default_riscv_dis_options): Use boolean.
17634                 (parse_riscv_dis_option_without_args): Likewise.
17635                 (riscv_disassemble_insn): Use boolean keywords.
17636
17637 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17638
17639         opcodes/riscv-dis.c: Tidying with spacing
17640         Before changing the core disassembler, we take care of minor code clarity
17641         issues and improve readability.
17642
17643         This commit takes care of improper spacing for code clarity.
17644
17645         opcodes/ChangeLog:
17646
17647                 * riscv-dis.c (riscv_disassemble_insn): Tidying with spacing.
17648
17649 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17650
17651         opcodes/riscv-dis.c: Tidying with comments/clarity
17652         Before changing the core disassembler, we take care of minor code clarity
17653         issues and improve readability.
17654
17655         First, we need to clarify the roles of variables and code portions.
17656
17657         opcodes/ChangeLog:
17658
17659                 * riscv-dis.c (xlen): Move before default_isa_spec. Add comment.
17660                 (default_isa_spec, default_priv_spec): Add comment.
17661                 (riscv_gpr_names, riscv_fpr_names): Likewise.
17662                 (parse_riscv_dis_option_without_args): Likewise.
17663                 (parse_riscv_dis_option, parse_riscv_dis_options): Likewise.
17664                 (maybe_print_address): Likewise.
17665                 (riscv_disassemble_insn): Fix comment about the Zfinx "extension".
17666                 Add comment about the riscv_multi_subset_supports call.
17667
17668 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17669
17670         RISC-V: Test DWARF register number for "fp"
17671         This commit adds "fp" (x8 or s0) to dw-regnums.{s,d}.
17672
17673         gas/ChangeLog:
17674
17675                 * testsuite/gas/riscv/dw-regnums.s: Add "fp".
17676                 * testsuite/gas/riscv/dw-regnums.d: Likewise.
17677
17678 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17679
17680         RISC-V: Move standard hints before all instructions
17681         Because all standard hints must be placed before corresponding instruction
17682         for the disassembler, they may taint basic RVI instruction section.
17683
17684         This commit moves all standard hints before all basic RVI instructions
17685         to improve maintainability.
17686
17687         opcodes/ChangeLog:
17688
17689                 * riscv-opc.c (riscv_opcodes): Move all standard hints before all
17690                 standard instructions.
17691
17692 2022-10-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
17693
17694         RISC-V: Move certain arrays to riscv-opc.c
17695         This is a part of small tidying (declare tables in riscv-opc.c).
17696
17697         include/ChangeLog:
17698
17699                 * opcode/riscv.h (riscv_rm, riscv_pred_succ): Move declarations to
17700                 opcodes/riscv-opc.c.  New non-static definitions.
17701
17702         opcodes/ChangeLog:
17703
17704                 * riscv-opc.c (riscv_rm, riscv_pred_succ): Move from
17705                 include/opcode/riscv.h.  Add description.
17706
17707 2022-10-14  Fangrui Song  <i@maskray.me>
17708
17709         ld: Add --undefined-version
17710         This cancels a previous --no-undefined-version.
17711         gold has had --undefined-version for a long time.
17712
17713 2022-10-14  GDB Administrator  <gdbadmin@sourceware.org>
17714
17715         Automatic date update in version.in
17716
17717 2022-10-13  Carl Love  <cel@us.ibm.com>
17718
17719         PowerPC, fix gdb.base/watchpoint.exp on Power 9
17720         Test gdb.base/watchpoint.exp generates 4 test errors on Power 9.  The
17721         test uses the test [target_info exists gdb,no_hardware_watchpoints] to
17722         determine if the processor supports hardware watchpoints.  The check
17723         only examines the processor type to determine if it supports hardware
17724         watchpoints.
17725
17726         The PowerPC processors support hardware watchpoints with the
17727         exception of Power 9. The hardware watchpoint support is disabled on
17728         Power 9.  The test skip_hw_watchpoint_tests must be used to correctly
17729         determine if the PowerPC processor supports hardware watchpoints.
17730
17731         This patch replaces the [target_info exists gdb,no_hardware_watchpoints]
17732         with the skip_hw_watchpoint_tests_p check.  With the patch, the test runs
17733         on Power 9 with hardware watchpoint force-disabled.  The test runs on
17734         all other PowerPC processors with and without hardware watchpoints
17735         enabled.
17736
17737         The patch has been tested on Power 9 to verify the test only runs with
17738         hardware breakpoints disabled.  The patch has been tested on X86-64 with
17739         no regression failures.  The test fails on Power 10 due to an internal GDB
17740         error due to resource management.  The resource management issue will be
17741         addressed in another patch.
17742
17743 2022-10-13  Tom de Vries  <tdevries@suse.de>
17744
17745         [gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32
17746         With test-case gdb.dwarf2/macro-source-path.exp and target board unix/-m32, I
17747         run into:
17748         ...
17749         as: macro-source-path-gcc11-ld238-dw5-filename-641.o: \
17750           unsupported relocation type: 0x1^M
17751         ...
17752
17753         The problem is that we have 64-bit dwarf so the debug_line offset in the
17754         .debug_macro section is an 8-byte entity, emitted using ".8byte":
17755         ...
17756                 .section .debug_macro
17757         .Lcu_macros4:
17758                 .2byte        5                 /* version */
17759                 .byte        3                  /* flags */
17760                 .8byte        .LLlines3         /* debug_line offset */
17761         ...
17762         but the linker doesn't support 8-byte relocation types on a 32-bit architecture.
17763
17764         This is similar to what was fixed in commit a5ac8e7fa3b
17765         ("[gdb/testsuite] Fix 64-bit dwarf test-cases with -m32") for for instance
17766         .debug_abbrev.
17767
17768         Fix this in the same way, by using _op_offset to emit the debug_line offset.
17769
17770         Tested on x86_64-linux with native and target board unix/-m32.
17771
17772 2022-10-13  Tom de Vries  <tdevries@suse.de>
17773
17774         [gdb/testsuite] Fix gdb.dwarf2/entry-value-typedef.exp with -m32
17775         With test-case gdb.dwarf2/entry-value-typedef.exp and target board unix/-m32,
17776         I run into:
17777         ...
17778         builtin_spawn -ignore SIGHUP g++ -fno-stack-protector \
17779           gdb/testsuite/gdb.dwarf2/entry-value-typedef-amd64.S \
17780           -fdiagnostics-color=never -Lbuild/libiberty -lm -m32 \
17781           -o outputs/gdb.dwarf2/entry-value-typedef/entry-value-typedef^M
17782         entry-value-typedef.cpp: Assembler messages:^M
17783         entry-value-typedef.cpp:38: Error: bad register name `%rbp'^M
17784         ...
17785
17786         The problem is that the test-cases selects an amd64 .S file based on the check:
17787         ...
17788         if { [istarget "x86_64-*-linux*"] } {
17789         ...
17790         which is also true for target board unix/-m32 on x86_64-linux.
17791
17792         Fix this by adding the missing is_lp64_target check.
17793
17794         Tested on x86_64-linux, using native and target board unix/-m32.
17795
17796 2022-10-13  Tom de Vries  <tdevries@suse.de>
17797
17798         [gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with -m32
17799         With target board unix/-m32 and test-case gdb.mi/mi-disassemble.exp we have:
17800         ...
17801         (gdb) ^M
17802         print/x *((unsigned char *) 0x8048485)^M
17803         &"print/x *((unsigned char *) 0x8048485)\n"^M
17804         ~"$9 = 0x83\n"^M
17805         ^done^M
17806         (gdb) ^M
17807         PASS: gdb.mi/mi-disassemble.exp: get valueof "*((unsigned char *) 0x8048485)"
17808         FAIL: gdb.mi/mi-disassemble.exp: byte at 0x8048485 matches
17809         ...
17810         The test-case passes with native.
17811
17812         With native we see in gdb.log that variable longest_insn_bytes is:
17813         ...
17814         Longest instruction at 0x0000000000400549 with bytes '48 8b 05 20 01 00 00'
17815         ...
17816         and variable split_bytes (added debug puts) ends up as:
17817         ...
17818         SPLIT_BYTES: 48 8b 05 20 01 00 00
17819         ...
17820
17821         But with unix/-m32 we have longest_insn_byte:
17822         ...
17823         Longest instruction at 0x08048481 with bytes '8d 4c 24 04        '
17824         ...
17825         and split_bytes ends up as:
17826         ...
17827         SPLIT_BYTES: 8d 4c 24 04 {} {} {} {} {} {} {} {}
17828         ...
17829         so the trailing whitespace is translated by split to empty bytes, and the
17830         mismatch FAILs are generated for those.
17831
17832         Fix this by stripping the whitespace, which makes us end up with a different
17833         and indeed longer insn:
17834         ...
17835         Longest instruction at 0x08048492 with bytes 'dd 05 98 85 04 08'
17836         ...
17837
17838         Tested on x86_64-linux, with native and target board unix/-m32.
17839
17840 2022-10-13  GDB Administrator  <gdbadmin@sourceware.org>
17841
17842         Automatic date update in version.in
17843
17844 2022-10-12  Carl Love  <cel@us.ibm.com>
17845
17846         PowerPC, fix test gdb.base/watchpoint-stops-at-right-insn.exp
17847         Test gdb.base/watchpoint-stops-at-right-insn.exp generates 4 test errors
17848         on Power 9.  The test uses the test [target_info exists gdb,
17849         no_hardware_watchpoints] to determine if the processor supports hardware
17850         watchpoints.  The check only examines the processor type to determine if
17851         it supports hardware watchpoints.  Note, the test works fine on Power 10.
17852
17853         The PowerPC processors support hardware watchpoints with the
17854         exception of Power 9. The hardware watchpoint support is disabled on
17855         Power 9.  The test skip_hw_watchpoint_tests must be used to correctly
17856         determine if the PowerPC processor supports hardware watchpoints.
17857
17858         This patch replaces the [target_info exists gdb,no_hardware_watchpoints]
17859         with the skip_hw_watchpoint_tests_p check.  With the patch, the test is
17860         disabled on Power 9 but runs on all other PowerPC processors.
17861
17862         The patch has been tested on Power 9, Power 10 and X86-64 with no
17863         regression failures.
17864
17865 2022-10-12  Jan Beulich  <jbeulich@suse.com>
17866
17867         x86: drop "regmask" static variable
17868         Replace its two uses by more direct checks, paralleling what's already
17869         there for SIMD registers.
17870
17871 2022-10-12  Tom de Vries  <tdevries@suse.de>
17872
17873         [gdb/symtab] Factor out elf_symfile_read_dwarf2
17874         Factor out elf_symfile_read_dwarf2 from elf_symfile_read.  NFC.
17875
17876         Tested on x86_64-linux.
17877
17878 2022-10-12  Tom de Vries  <tdevries@suse.de>
17879
17880         [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed
17881         When running test-case gdb.base/ctf-constvars.exp on openSUSE Tumbleweed (with
17882         system gcc version 12, providing gcc -gctf support, enabling the ctf test-cases
17883         in the gdb testsuite), I run into:
17884         ...
17885         (gdb) print vox^M
17886         'vox' has unknown type; cast it to its declared type^M
17887         (gdb) FAIL: gdb.base/ctf-constvars.exp: print vox
17888         ...
17889
17890         There are two causes for this:
17891         - the linker flags are missing --ctf-variables, so the information for variable
17892           vox is missing (reported in PR29468), and
17893         - the executable contains some dwarf2 due to some linked-in glibc objects,
17894           so the ctf info is ignored (reported in PR29160).
17895
17896         By using:
17897         - -Wl,--ctf-variable,
17898         - -Wl,--strip-debug, and
17899         we can make the test-case and some similar test-cases pass.
17900
17901         Tested on x86_64-linux.
17902
17903         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29160
17904         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29468
17905
17906 2022-10-12  Tom de Vries  <tdevries@suse.de>
17907
17908         [gdb/testsuite] Silence warnings about obsolete -gstabs
17909         When running test-case gdb.base/gdbindex-stabs.exp on openSUSE Tumbleweed (with
17910         gcc 12) I get:
17911         ...
17912         gdb compile failed, gdb/testsuite/gdb.base/gdbindex-stabs.c: warning: \
17913           STABS debugging information is obsolete and not supported anymore
17914         ...
17915
17916         Silence the warning by passing quiet to gdb_compile.  Likewise in two other
17917         test-cases.
17918
17919 2022-10-12  Tom de Vries  <tdevries@suse.de>
17920
17921         [gdb/testsuite] Replace remaining -gt with -gctf
17922         With test-cases gdb.base/cvexpr.exp and gdb.base/whatis.exp I run into:
17923         ...
17924         gdb compile failed, gcc: error: unrecognized debug output level 't'
17925         ...
17926
17927         This is due to using additional_flags=-gt.
17928
17929         Commit ffb3f587933 ("CTF: multi-CU and archive support") replaced
17930         additional_flags=-gt with additional_flags=-gctf in gdb.ctf/*.exp and
17931         gdb.base/ctf-*.exp.
17932
17933         Do the same in these two test-cases.
17934
17935         Tested on x86_64-linux.
17936
17937 2022-10-12  Tom de Vries  <tdevries@suse.de>
17938
17939         [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with recent ld
17940         On openSUSE Tumbleweed (with ld 2.39) and test-case
17941         gdb.base/infoline-reloc-main-from-zero.exp, I get:
17942         ...
17943         gdb compile failed, ld: warning: infoline-reloc-main-from-zero has a LOAD \
17944           segment with RWX permissions
17945         UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: \
17946           infoline-reloc-main-from-zero.exp
17947         ...
17948
17949         Fix this by compiling with -Wl,--no-warn-rwx-segments.
17950
17951         Tested on x86_64-linux.
17952
17953 2022-10-12  Tom de Vries  <tdevries@suse.de>
17954
17955         [gdb/testsuite] Fix gdb.base/nested-subp{2,3}.exp with recent ld
17956         On openSUSE Tumbleweed (with ld 2.39) I get for test-case
17957         gdb.base/nested-subp2.exp:
17958         ...
17959         gdb compile failed, ld: warning: tmp.o: requires executable stack \
17960           (because the .note.GNU-stack section is executable)
17961         ...
17962
17963         Fix this by compiling with -Wl,--no-warn-execstack.
17964
17965         Likewise in gdb.base/nested-subp3.exp
17966
17967         Tested on x86_64-linux.
17968
17969 2022-10-12  Tom de Vries  <tdevries@suse.de>
17970
17971         [gdb/testsuite] Remove unnecessary perror in some test-cases
17972         On openSUSE Tumbleweed I noticed:
17973         ...
17974         UNTESTED: gdb.dwarf2/fission-absolute-dwo.exp: fission-absolute-dwo.exp
17975         ERROR: failed to compile fission-absolute-dwo
17976         ...
17977
17978         The ERROR is unnecessary, given that an UNTESTED is already emitted.
17979
17980         Furthermore, it could be argued that it is incorrect because it's not a
17981         testsuite error to not be able to compile something, and UNTESTED or
17982         UNSUPPORTED is more appropriate.
17983
17984         Remove the perror call, likewise in fission-relative-dwo.exp.
17985
17986         Tested on x86_64-linux.
17987
17988 2022-10-12  Nick Clifton  <nickc@redhat.com>
17989
17990         Fix objcopy's error message when it cannot add a .gnu_debuglink section because the section already exists.
17991                 PR 29665
17992                 * objcopy.c (copy_object): Use the input filename when
17993                 reporting that a .gnu_debuglink section already exists.
17994
17995 2022-10-12  Tsukasa OI  <research_trasio@irq.a4lg.com>
17996
17997         sim/ppc: Fix core_find_mapping diagnostics
17998         Because "%p" is the pointer conversion specifier to print a pointer in an
17999         implementation-defined manner, the result with format string containing
18000         "0x%p" can be strange.  For instance, core_map_find_mapping prints error
18001         containing "0x0x...." (processor is not NULL) or "0x(null)" (processor is
18002         NULL) on glibc.
18003
18004         This commit replaces "0x%p" with "%p" to prevent unpredictable behavior.
18005
18006 2022-10-12  Andrew Burgess  <aburgess@redhat.com>
18007
18008         sim/ppc: fixes for arguments to printf style functions
18009         After the recent series of fixes to mark more functions in the
18010         simulator with ATTRIBUTE_PRINTF, there were some build failures in the
18011         ppc sim due, in some cases, to bugs with the arguments being passed,
18012         and in other cases, the issues were (maybe) less serious, with
18013         arguments being the wrong size, or type, for the printf format being
18014         used.
18015
18016         This commit fixes all of the issues that I ran into.
18017
18018         In each case I selected the easiest solution to the problem, which is
18019         usually just casting the argument to the correct type.  If anyone
18020         later on thinks the print format should change, please feel free to do
18021         that.  What we have here should keep the simulator basically working
18022         as it does currently, which is my goal with this commit.
18023
18024 2022-10-12  Tom de Vries  <tdevries@suse.de>
18025
18026         [gdb/contrib] Use OBJCOPY everywhere in cc-with-tweaks.sh
18027         I noticed that the $want_gnu_debuglink code in gdb/contrib/cc-with-tweaks.sh
18028         uses objcopy instead of $OBJCOPY.  Fix this.
18029
18030         Script checked with shellcheck, no new warnings added.
18031
18032         Tested on x86_64-linux.
18033
18034 2022-10-12  Simon Marchi  <simon.marchi@efficios.com>
18035
18036         Re-apply "Pass PKG_CONFIG_PATH down from top-level Makefile"
18037         Commit 228cf97dd3c8 ("Merge configure.ac from gcc project") undid the
18038         change originally done in de83289ef32e ("Pass PKG_CONFIG_PATH down from
18039         top-level Makefile").  Re-apply it.
18040
18041         Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
18042
18043 2022-10-12  Simon Marchi  <simon.marchi@polymtl.ca>
18044
18045         gdb: rename target_read_auxv(target_ops *) to target_read_auxv_raw
18046         Having two overloads of target_read_auxv that don't have the same goals
18047         is confusing.  Rename the one that reads from an explicit target_ops to
18048         target_read_auxv_raw.  Also, it occured to me that the non-raw version
18049         could use the raw version, that reduces duplication a bit.
18050
18051         Change-Id: I28e5f7cecbfcacd0174d4686efb3e4a23b4ad491
18052
18053 2022-10-12  GDB Administrator  <gdbadmin@sourceware.org>
18054
18055         Automatic date update in version.in
18056
18057 2022-10-12  Alan Modra  <amodra@gmail.com>
18058
18059         Re: Merge configure.ac from gcc project
18060         Also copy over config.acx.m4, and regenerate.
18061
18062 2022-10-11  Simon Marchi  <simon.marchi@polymtl.ca>
18063
18064         gdb: fix auxv caching
18065         There's a flaw in the interaction of the auxv caching and the fact that
18066         target_auxv_search allows reading auxv from an arbitrary target_ops
18067         (passed in as a parameter).  This has consequences as explained in this
18068         thread:
18069
18070           https://inbox.sourceware.org/gdb-patches/20220719144542.1478037-1-luis.machado@arm.com/
18071
18072         In summary, when loading an AArch64 core file with MTE support by
18073         passing the executable and core file names directly to GDB, we see the
18074         MTE info:
18075
18076             $ ./gdb -nx --data-directory=data-directory -q aarch64-mte-gcore aarch64-mte-gcore.core
18077             ...
18078             Program terminated with signal SIGSEGV, Segmentation fault
18079             Memory tag violation while accessing address 0x0000ffff8ef5e000
18080             Allocation tag 0x1
18081             Logical tag 0x0.
18082             #0  0x0000aaaade3d0b4c in ?? ()
18083             (gdb)
18084
18085         But if we do it as two separate commands (file and core) we don't:
18086
18087             $ ./gdb -nx --data-directory=data-directory -q -ex "file aarch64-mte-gcore" -ex "core aarch64-mte-gcore.core"
18088             ...
18089             Program terminated with signal SIGSEGV, Segmentation fault.
18090             #0  0x0000aaaade3d0b4c in ?? ()
18091             (gdb)
18092
18093         The problem with the latter is that auxv data gets improperly cached
18094         between the two commands.  When executing the file command, auxv gets
18095         first queried here, when loading the executable:
18096
18097             #0  target_auxv_search (ops=0x55555b842400 <exec_ops>, match=0x9, valp=0x7fffffffc5d0) at /home/simark/src/binutils-gdb/gdb/auxv.c:383
18098             #1  0x0000555557e576f2 in svr4_exec_displacement (displacementp=0x7fffffffc8c0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2482
18099             #2  0x0000555557e594d1 in svr4_relocate_main_executable () at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2878
18100             #3  0x0000555557e5989e in svr4_solib_create_inferior_hook (from_tty=1) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2933
18101             #4  0x0000555557e6e49f in solib_create_inferior_hook (from_tty=1) at /home/simark/src/binutils-gdb/gdb/solib.c:1253
18102             #5  0x0000555557f33e29 in symbol_file_command (args=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1) at /home/simark/src/binutils-gdb/gdb/symfile.c:1655
18103             #6  0x00005555573319c3 in file_command (arg=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1) at /home/simark/src/binutils-gdb/gdb/exec.c:555
18104             #7  0x0000555556e47185 in do_simple_func (args=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1, c=0x612000047740) at /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:95
18105             #8  0x0000555556e551c9 in cmd_func (cmd=0x612000047740, args=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1) at /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:2543
18106             #9  0x00005555580e63fd in execute_command (p=0x7fffffffe02c "e", from_tty=1) at /home/simark/src/binutils-gdb/gdb/top.c:692
18107             #10 0x0000555557771913 in catch_command_errors (command=0x5555580e55ad <execute_command(char const*, int)>, arg=0x7fffffffe017 "file aarch64-mte-gcore", from_tty=1, do_bp_actions=true) at /home/simark/src/binutils-gdb/gdb/main.c:513
18108             #11 0x0000555557771fba in execute_cmdargs (cmdarg_vec=0x7fffffffd570, file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND, ret=0x7fffffffd230) at /home/simark/src/binutils-gdb/gdb/main.c:608
18109             #12 0x00005555577755ac in captured_main_1 (context=0x7fffffffda10) at /home/simark/src/binutils-gdb/gdb/main.c:1299
18110             #13 0x0000555557775c2d in captured_main (data=0x7fffffffda10) at /home/simark/src/binutils-gdb/gdb/main.c:1320
18111             #14 0x0000555557775cc2 in gdb_main (args=0x7fffffffda10) at /home/simark/src/binutils-gdb/gdb/main.c:1345
18112             #15 0x00005555568bdcbe in main (argc=10, argv=0x7fffffffdba8) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
18113
18114         Here, target_auxv_search is called on the inferior's target stack.  The
18115         target stack only contains the exec target, so the query returns empty
18116         auxv data.  This gets cached for that inferior in `auxv_inferior_data`.
18117
18118         In its constructor (before it is pushed to the inferior's target stack),
18119         the core_target needs to identify the right target description from the
18120         core, and for that asks the gdbarch to read a target description from
18121         the core file.  Because some implementations of
18122         gdbarch_core_read_description (such as AArch64's) need to read auxv data
18123         from the core in order to determine the right target description, the
18124         core_target passes a pointer to itself, allowing implementations to call
18125         target_auxv_search it.  However, because we have previously cached
18126         (empty) auxv data for that inferior, target_auxv_search searched that
18127         cached (empty) auxv data, not auxv data read from the core.  Remember
18128         that this data was obtained by reading auxv on the inferior's target
18129         stack, which only contained an exec target.
18130
18131         The problem I see is that while target_auxv_search offers the
18132         flexibility of reading from an arbitrary (passed as an argument) target,
18133         the caching doesn't do the distinction of which target is being queried,
18134         and where the cached data came from.  So, you could read auxv from a
18135         target A, it gets cached, then you try to read auxv from a target B, and
18136         it returns the cached data from target A.  That sounds wrong.  In our
18137         case, we expect to read different auxv data from the core target than
18138         what we have read from the target stack earlier, so it doesn't make
18139         sense to hit the cache in this case.
18140
18141         To fix this, I propose splitting the code paths that read auxv data from
18142         an inferior's target stack and those that read from a passed-in target.
18143         The code path that reads from the target stack will keep caching,
18144         whereas the one that reads from a passed-in target won't.  And since,
18145         searching in auxv data is independent from where this data came from,
18146         split the "read" part from the "search" part.
18147
18148         From what I understand, auxv caching was introduced mostly to reduce
18149         latency on remote connections, when doing many queries.  With the change
18150         I propose, only the queries done while constructing the core_target
18151         end up not using cached auxv data.  This is fine, because there are just
18152         a handful of queries max, done at this point, and reading core files is
18153         local.
18154
18155         The changes to auxv functions are:
18156
18157          - Introduce 2 target_read_auxv functions.  One reads from an explicit
18158            target_ops and doesn't do caching (to be used in
18159            gdbarch_core_read_description context).  The other takes no argument,
18160            reads from the current inferior's target stack (it looks just like a
18161            standard target function wrapper) and does caching.
18162
18163            The first target_read_auxv actually replaces get_auxv_inferior_data,
18164            since it became a trivial wrapper around it.
18165
18166          - Change the existing target_auxv_search to not read auxv data from the
18167            target, but to accept it as a parameter (a gdb::byte_vector).  This
18168            function doesn't care where the data came from, it just searches in
18169            it.  It still needs to take a target_ops and gdbarch to know how to
18170            parse auxv entries.
18171
18172          - Add a convenience target_auxv_search overload that reads auxv
18173            data from the inferior's target stack and searches in it.  This
18174            overload is useful to replace the exist target_auxv_search calls that
18175            passed the `current_inferior ()->top_target ()` target and keep the
18176            call sites short.
18177
18178          - Modify parse_auxv to accept a target_ops and gdbarch to use for
18179            parsing entries.  Not strictly related to the rest of this change,
18180            but it seems like a good change in the context.
18181
18182         Changes in architecture-specific files (tdep and nat):
18183
18184          - In linux-tdep, linux_get_hwcap and linux_get_hwcap2 get split in two,
18185            similar to target_auxv_search.  One version receives auxv data,
18186            target and arch as parameters.  The other gets everything from the
18187            current inferior.  The latter is for convenience, to avoid making
18188            call sites too ugly.
18189
18190          - Call sites of linux_get_hwcap and linux_get_hwcap2 are adjusted to
18191            use either of the new versions.  The call sites in
18192            gdbarch_core_read_description context explicitly read auxv data from
18193            the passed-in target and call the linux_get_hwcap{,2} function with
18194            parameters.  Other call sites use the versions without parameters.
18195
18196          - Same idea for arm_fbsd_read_description_auxv.
18197
18198          - Call sites of target_auxv_search that passed
18199            `current_inferior ()->top_target ()` are changed to use the
18200            target_auxv_search overload that works in the current inferior.
18201
18202         Reviewed-By: John Baldwin <jhb@FreeBSD.org>
18203         Reviewed-By: Luis Machado <luis.machado@arm.com>
18204         Change-Id: Ib775a220cf1e76443fb7da2fdff8fc631128fe66
18205
18206 2022-10-11  Tom de Vries  <tdevries@suse.de>
18207
18208         [gdb/testsuite] Fix gdb.debuginfod/fetch_src_and_symbols.exp with native-gdbserver
18209         When running test-case gdb.debuginfod/fetch_src_and_symbols.exp with target
18210         board native-gdbserver, I get:
18211         ...
18212         Running gdb.debuginfod/fetch_src_and_symbols.exp ...
18213         ERROR: tcl error sourcing gdb.debuginfod/fetch_src_and_symbols.exp.
18214         ERROR: gdbserver does not support start without extended-remote
18215             while executing
18216         "error "gdbserver does not support $command without extended-remote""
18217             (procedure "gdb_test_multiple" line 51)
18218             invoked from within
18219         "gdb_test_multiple $command $message {*}$opts $user_code"
18220             (procedure "gdb_test" line 56)
18221             invoked from within
18222         "gdb_test "start" "Temporary breakpoint.*""
18223         ...
18224
18225         Fix this by replacing gdb_test "start" with runto_main.
18226
18227         Tested on x86_64-linux.
18228
18229 2022-10-11  Nick Clifton  <nickc@redhat.com>
18230
18231         Re: Error: attempt to get value of unresolved symbol `L0'
18232                 * symbols.c (S_GET_VALUE): If the unresolved symbol is the fake
18233                 label provide a more helpful error message to the user.
18234                 (S_GET_VALUE_WHERE): Like S_GET_VALUE, but includes a file/line
18235                 number for error reporting purposes.
18236                 * symbols.h (S_GET_VALUE_WHERE): Prototype.
18237                 * write.c (fixup_segment): Use S_GET_VALUE_WHERE.
18238
18239 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18240
18241         sim: Initialize pbb_br_* by default
18242         On the files generated by sim/common/genmloop.sh, variables pbb_br_type and
18243         pbb_br_npc are declared uninitialized and passed to other functions in some
18244         cases.  Despite that those are harmless, they will generate GCC warnings
18245         ("-Wmaybe-uninitialized").
18246
18247         This commit ensures that pbb_br_type and pbb_br_npc variables are
18248         initialized to a harmless value.
18249
18250 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18251
18252         sim: Check known getopt definition existence
18253         Clang generates a warning if there is a function declaration/definition
18254         with zero arguments.  Such declarations/definitions without a prototype (an
18255         argument list) are deprecated forms of indefinite arguments
18256         ("-Wdeprecated-non-prototype").  On the default configuration, it causes a
18257         build failure (unless "--disable-werror" is specified).
18258
18259         include/getopt.h defines some getopt function definitions but one of them
18260         has a form "extern int getopt ();".  If this form is selected in
18261         include/getopt.h, Clang generates a warning and the build fails by default.
18262
18263         In really old environments, this getopt definition with no arguments is
18264         necessary (because the definition may change between environments).
18265         However, this definition is now a cause of problems on modern environments.
18266
18267         A good news is, this definition is not always selected (e.g. if used by
18268         binutils/*.c).  This is because configuration scripts of binutils, gas,
18269         gprof and ld tries to find known definition of getopt function is used and
18270         defines HAVE_DECL_GETOPT macro.  If this macro is defined when getopt.h is
18271         included, a good form of getopt is used and Clang won't generate warnings.
18272
18273         This commit adds a modified portion of ld/configure.ac to find the known
18274         getopt definition.  If we could find one (and we *will* in most modern
18275         environments), we don't need to rely on the deprecated definition.
18276
18277 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18278             Andrew Burgess  <aburgess@redhat.com>
18279
18280         sim: Suppress non-literal printf warning
18281         Clang generates a warning if the format string of a printf-like function is
18282         not a literal ("-Wformat-nonliteral"). On the default configuration, it
18283         causes a build failure (unless "--disable-werror" is specified).
18284
18285         To avoid this warning, this commit now uses vsnprintf to format error
18286         message and pass the message to sim_engine_abort function with another
18287         printf-style formatting.
18288
18289         This patch is mostly authored by Andrew Burgess and slightly modified by
18290         Tsukasa OI.
18291
18292 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18293
18294         sim: Make WITH_{TRACE,PROFILE}-based macros bool
18295         Clang generates a warning if there is an ambiguous expression (possibly a
18296         bitwise operation (& or |), but a logical operator (&& or ||) is used;
18297         "-Wconstant-logical-operand").  On the default configuration, it causes a
18298         build failure (unless "--disable-werror" is specified).
18299
18300         This is caused by predicate macros that use the form (base_variable & flag).
18301         Clang considers them as regular integer values (not boolean) and
18302         generates that warning.
18303
18304         This commit makes Clang think those predicate macros to be boolean.
18305
18306 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18307
18308         sim: Remove self-assignments
18309         Clang generates a warning if there is a redundant self-assignment
18310         ("-Wself-assign").  On the default configuration, it causes a build failure
18311         (unless "--disable-werror" is specified).
18312
18313         This commit removes redundant self-assignments from two files.
18314
18315 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18316
18317         sim/rl78: Add ATTRIBUTE_PRINTF
18318         Clang generates a warning if the format string of a printf-like function is
18319         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18320         causes a build failure (unless "--disable-werror" is specified).
18321
18322         To avoid warnings on the printf-like wrapper, it requires proper
18323         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18324
18325         This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
18326
18327 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18328
18329         sim/ppc: Add ATTRIBUTE_PRINTF
18330         Clang generates a warning if the format string of a printf-like function is
18331         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18332         causes a build failure (unless "--disable-werror" is specified).
18333
18334         To avoid warnings on the printf-like wrapper, it requires proper
18335         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18336
18337         This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
18338
18339         For the error function defined in sim_calls.c, the ATTRIBUTE_NORETURN
18340         has been moved to the function declaration.
18341
18342 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18343
18344         sim/m68hc11: Add ATTRIBUTE_PRINTF
18345         Clang generates a warning if the format string of a printf-like function is
18346         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18347         causes a build failure (unless "--disable-werror" is specified).
18348
18349         To avoid warnings on the printf-like wrapper, it requires proper
18350         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18351
18352         This commit adds ATTRIBUTE_PRINTF to a printf-like function.
18353
18354 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18355
18356         sim/m32c: Add ATTRIBUTE_PRINTF
18357         Clang generates a warning if the format string of a printf-like function is
18358         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18359         causes a build failure (unless "--disable-werror" is specified).
18360
18361         To avoid warnings on the printf-like wrapper, it requires proper
18362         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18363
18364         This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
18365
18366 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18367
18368         sim/erc32: Add ATTRIBUTE_PRINTF
18369         Clang generates a warning if the format string of a printf-like function is
18370         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18371         causes a build failure (unless "--disable-werror" is specified).
18372
18373         To avoid warnings on the printf-like wrapper, it requires proper
18374         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18375
18376         This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
18377
18378 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18379
18380         sim/cris: Add ATTRIBUTE_PRINTF
18381         Clang generates a warning if the format string of a printf-like function is
18382         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18383         causes a build failure (unless "--disable-werror" is specified).
18384
18385         To avoid warnings on the printf-like wrapper, it requires proper
18386         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18387
18388         This commit adds ATTRIBUTE_PRINTF to a printf-like function.
18389
18390 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18391
18392         sim/common: Add ATTRIBUTE_PRINTF
18393         Clang generates a warning if the format string of a printf-like function is
18394         not a literal ("-Wformat-nonliteral").  On the default configuration, it
18395         causes a build failure (unless "--disable-werror" is specified).
18396
18397         To avoid warnings on the printf-like wrapper, it requires proper
18398         __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason.
18399
18400         This commit adds ATTRIBUTE_PRINTF to a printf-like function.
18401
18402 2022-10-11  Martin Liska  <mliska@suse.cz>
18403
18404         fix compressed_debug_section_names definition for "zlib"
18405         bfd/ChangeLog:
18406
18407                 * libbfd.c: Set COMPRESS_DEBUG_GABI_ZLIB for "zlib" value.
18408
18409 2022-10-11  Martin Liska  <mliska@suse.cz>
18410
18411         add --enable-default-compressed-debug-sections-algorithm configure option
18412         ChangeLog:
18413
18414                 * configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
18415                 * configure: Regenerate.
18416
18417         gas/ChangeLog:
18418
18419                 * NEWS: Document the new option.
18420                 * as.c (flag_compress_debug): Set default algorithm based
18421                 on the configure option.
18422                 * configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
18423                 * configure: Regenerate.
18424                 * config.in: Likewise.
18425
18426         ld/ChangeLog:
18427
18428                 * NEWS: Document the new option.
18429                 * configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
18430                 * configure: Regenerate.
18431                 * config.in: Likewise.
18432                 * ldmain.c: Set default algorithm based
18433                 on the configure option.
18434
18435 2022-10-11  Martin Liska  <mliska@suse.cz>
18436
18437         refactor usage of compressed_debug_section_type
18438         bfd/ChangeLog:
18439
18440                 * bfd-in.h (bfd_hash_set_default_size): Add COMPRESS_UNKNOWN
18441                   enum value.
18442                 (struct compressed_type_tuple): New.
18443                 * bfd-in2.h (bfd_hash_set_default_size): Regenerate.
18444                 (struct compressed_type_tuple): Likewise.
18445                 * libbfd.c (ARRAY_SIZE): New macro.
18446                 (bfd_get_compression_algorithm): New function.
18447                 (bfd_get_compression_algorithm_name): Likewise.
18448
18449         gas/ChangeLog:
18450
18451                 * as.c: Do not special-case, use the new functions.
18452
18453         ld/ChangeLog:
18454
18455                 * emultempl/elf.em: Do not special-case, use the new functions.
18456                 * lexsup.c (elf_static_list_options): Likewise.
18457
18458 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18459
18460         sim/riscv: fix multiply instructions on simulator
18461         After this commit:
18462
18463           commit 0938b032daa52129b4215d8e0eedb6c9804f5280
18464           Date:   Wed Feb 2 10:06:15 2022 +0900
18465
18466               RISC-V: Add 'Zmmul' extension in assembler.
18467
18468         some instructions in the RISC-V simulator stopped working as a new
18469         instruction class 'INSN_CLASS_ZMMUL' was added, and some existing
18470         instructions were moved into this class.
18471
18472         The simulator doesn't currently handle this instruction class, and so
18473         the instructions will now cause an illegal instruction trap.
18474
18475         This commit adds support for INSN_CLASS_ZMMUL, and adds a test that
18476         ensures the affected instructions can be executed by the simulator.
18477
18478         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
18479         Reviewed-by: Andrew Burgess <aburgess@redhat.com>
18480
18481 2022-10-11  Nick Clifton  <nickc@redhat.com>
18482
18483         Error: attempt to get value of unresolved symbol `L0'
18484                 * symbols.c (S_GET_VALUE): If the unresolved symbol is the fake
18485                 label provide a more helpful error message to the user.
18486
18487 2022-10-11  Tsukasa OI  <research_trasio@irq.a4lg.com>
18488
18489         sim/moxie: add custom directory stamp rule
18490         Because sim/moxie/moxie-gdb.dtb is neither a program nor a library, automake
18491         does not generate dirstamp file ($builddir/sim/moxie/.dirstamp) for it.
18492
18493         When maintainer mode is enabled, it tries to rebuild sim/moxie/moxie-gdb.dtb
18494         but fails because there's no rules for automake-generated dirstamp file
18495         which moxie-gdb.dtb depends.
18496
18497         This commit adds its own rule for the directory stamp (modified copy of the
18498         automake output) and adds the directory stamp file to DISTCLEANFILES to
18499         mimic automake-generated behavior (although "make distclean" does not work
18500         when maintainer mode is enabled).
18501
18502 2022-10-11  Bruno Larsen  <blarsen@redhat.com>
18503
18504         gdb/testsuite: Fix formatting of python script
18505         The python black formatter was complaining about formatting on the
18506         script gdb.python/pretty-print-call-by-hand.py.  This commit changed
18507         the offending lines to make the formatter happy.
18508
18509 2022-10-11  Tom de Vries  <tdevries@suse.de>
18510
18511         [gdb/testsuite] Fix prompt parsing in capture_command_output
18512         I noticed in capture_command_output that the output of a single command is
18513         matched using two gdb_test_multiples:
18514         - the first one matching the echoed command and skipping an optional prefix,
18515         - the second one matching the output and the prompt.
18516
18517         This is error-prone, because the first gdb_test_multiple has implicit
18518         clauses which may consume the prompt.
18519
18520         The problem is easy to spot with an example.  First consider:
18521         ...
18522         set output [capture_command_output "print 1" "\\\$1 = "]
18523         gdb_assert { [string equal $output "1"] }
18524         ...
18525         for which we get:
18526         ...
18527         PASS: [string equal $output "1"]
18528         ...
18529
18530         If we change the prefix string to a no-match, say "1 = ", and update the
18531         output string match accordingly, we get instead:
18532         ...
18533         FAIL: capture_command_output for print 1
18534         FAIL: [string equal $output "\$1 = 1"]
18535         ...
18536
18537         The first FAIL is produced by the first gdb_test_multiple, consuming the prompt.
18538
18539         The second gdb_test_multiple then silently times out waiting for another prompt,
18540         after which the second FAIL is produced.  Note that the timeout is silent
18541         because the gdb_test_multiple is called with an empty message argument.
18542
18543         The second FAIL is because capture_command_output returns "", given that all
18544         the command output was consumed by the first gdb_test_multiple.
18545
18546         Fix this by rewriting capture_command_output to use only a single
18547         gdb_test_multiple.
18548
18549         Tested on x86_64-linux.
18550
18551 2022-10-11  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
18552
18553         gprofng: no need to build version.texi
18554         gprofng/ChangeLog
18555         2022-10-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
18556
18557                 PR gprofng/29465
18558                 PR gprofng/29667
18559                 * doc/Makefile.am: No need to build version.texi.
18560                 * doc/Makefile.in: Rebuild.
18561
18562 2022-10-11  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
18563
18564         gprofng: use the --libdir path to find libraries
18565         gprofng/ChangeLog
18566         2022-10-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
18567
18568                 PR gprofng/29663
18569                 * src/Makefile.am: Add -DLIBDIR to CPPFLAGS.
18570                 * src/Makefile.in: Rebuild.
18571                 * src/envsets.cc (putenv_libcollector_ld_misc): Use LIBDIR to find
18572                 the gprofng libraries.
18573
18574 2022-10-11  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
18575
18576         gprofng: run tests without installation
18577         gprofng/ChangeLog
18578         2022-10-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
18579
18580                 PR gprofng/29107
18581                 * testsuite/config/default.exp: Set up environment to run gprofng tests
18582                 without installation.
18583                 * testsuite/lib/Makefile.skel: Likewise.
18584                 * testsuite/lib/display-lib.exp: Likewise.
18585
18586 2022-10-11  Simon Marchi  <simon.marchi@polymtl.ca>
18587
18588         gdb/testsuite: fix race in gdb.base/async-shell.exp
18589         I see some random failures in this test:
18590
18591             FAIL: gdb.base/async-shell.exp: run & (timeout)
18592
18593         It can be reliably reproduced on a recent enough GNU/Linux with this
18594         change:
18595
18596             diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
18597             index 44cc28b30051..2a3c8253ba5a 100644
18598             --- a/gdb/testsuite/lib/gdb.exp
18599             +++ b/gdb/testsuite/lib/gdb.exp
18600             @@ -1301,6 +1301,7 @@ proc gdb_test_multiple { command message args } {
18601                  }
18602                  set gdb_test_name "$message"
18603
18604             +    sleep 2
18605                  set result 0
18606                  set code [catch {gdb_expect $code} string]
18607
18608         "recent enough" means a system where libpthread.so was merged with
18609         libc.so, so at least glibc 2.34.
18610
18611         The problem is that the `run &` command prints some things after the
18612         prompt:
18613
18614             (gdb) [Thread debugging using libthread_db enabled]
18615             Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1".
18616
18617         If expect is quick enough, it will consume only up to the prompt.  But
18618         if it is slow enough, it will consume those messages at the same time as
18619         the prompt, in which case the gdb_test used for "run &" won't match.  By
18620         default, the prompt used by gdb_test uses a `$` to anchor the match at
18621         the end of the buffer.  If there's anything following the prompt, it
18622         won't match.
18623
18624         The diff above adds a delay between sending the command and consuming
18625         the output, giving GDB more time to output the messages, giving a good
18626         chance that expect consumes them at the same time as the prompt.
18627
18628         This is normally handled by using gdb_test_multiple and specifying a
18629         pattern that ends with "$gdb_prompt", but not a trailing $.  I think
18630         this is common enough that it deserves its own gdb_test option.
18631         Therefore, add the -no-anchor-prompt option to gdb_test, and
18632         gdb_test_no_output for completeness.  Use it in
18633         gdb.base/async-shell.exp.
18634
18635         Change-Id: I9051d8800d1c10a2e95db1a575991f7723492f1b
18636         Approved-By: Tom de Vries <tdevries@suse.de>
18637
18638 2022-10-11  GDB Administrator  <gdbadmin@sourceware.org>
18639
18640         Automatic date update in version.in
18641
18642 2022-10-10  Tom Tromey  <tom@tromey.com>
18643
18644         Fix a latent bug in print_wchar
18645         print_wchar keeps track of when escape sequences are emitted, to force
18646         an escape sequence if needed by a subsequent character.  For example
18647         for the string concatenation "\0" "1", gdb will print "\000\061" --
18648         because printing "\0001" might be confusing.
18649
18650         However, this code has two errors.  First, this logic is not needed
18651         for octal escapes, because there is a length limit of 3 for octal
18652         escapes, and gdb always prints these with "%.3o".  Second, though,
18653         this *is* needed for hex escapes, because those do not have a length
18654         limit.
18655
18656         This patch fixes these problems and adds the appropriate tests.
18657
18658 2022-10-10  Tom Tromey  <tom@tromey.com>
18659
18660         Don't use wchar_printable in print_wchar
18661         print_wchar uses wchar_printable, but this isn't needed -- all the
18662         relevant cases are already handled by the 'switch'.  This changes the
18663         code to use gdb_iswprint, and removes a somewhat confusing comment
18664         related to this code.
18665
18666         Remove c_printstr
18667         This renames c_printstr, removing a layer of indirection.
18668
18669         Remove c_emit_char
18670         This renames c_emit_char, removing a layer of indirection.
18671
18672         Boolify need_escape in generic_emit_char
18673         This changes 'need_escape' in generic_emit_char to be of type bool,
18674         rather than int.
18675
18676 2022-10-10  Tom Tromey  <tom@tromey.com>
18677             Andrew Burgess  <aburgess@redhat.com>
18678
18679         Fix latent quote char bug in generic_printstr
18680         generic_printstr prints an empty string like:
18681
18682               fputs_filtered ("\"\"", stream);
18683
18684         However, this seems wrong to me if the quote character is something
18685         other than double quote.  This patch fixes this latent bug.  Thanks to
18686         Andrew for the test case.
18687
18688 2022-10-10  Tom Tromey  <tromey@adacore.com>
18689
18690         Fix the guile build
18691         The frame_info_ptr patches broke the build with Guile.  This patch
18692         fixes the problem.  In mos cases I chose to preserve the use of
18693         frame_info_ptr, at least where I could be sure that the object
18694         lifetime did not interact with Guile's longjmp-based exception scheme.
18695
18696         Tested on x86-64 Fedora 34.
18697
18698 2022-10-10  Tom de Vries  <tdevries@suse.de>
18699
18700         [gdb/testsuite] Detect trailing ^C/^D in command
18701         Detect a trailing ^C/^D in the command argument of gdb_test_multiple, and
18702         error out.
18703
18704         Tested on x86_64-linux.
18705
18706 2022-10-10  Tom de Vries  <tdevries@suse.de>
18707
18708         [gdb/testsuite] Fix error message for cmd with trailing newline
18709         I noticed that the error message in gdb_test_multiple about trailing newline
18710         in a command does not mention the offending command, nor the word command:
18711         ...
18712             if [string match "*\[\r\n\]" $command] {
18713                 error "Invalid trailing newline in \"$message\" test"
18714             }
18715         ...
18716
18717         Fix this by using instead:
18718         ...
18719                 error "Invalid trailing newline in \"$command\" command"
18720         ...
18721
18722         Also add a test-case to trigger this: gdb.testsuite/gdb-test.exp.
18723
18724         Tested on x86_64-linux.
18725
18726 2022-10-10  Andrew Burgess  <aburgess@redhat.com>
18727
18728         gdb: include the base address in in-memory bfd filenames
18729         The struct target_buffer (in gdb_bfd.c) is used to hold information
18730         about an in-memory BFD object created by GDB.  For now this mechanism
18731         is used by GDB when loading information about JIT symfiles.
18732
18733         This commit updates target_buffer (in gdb_bfd.c) to be more C++ like,
18734         and, at the same time, adds the base address of the symfile into the
18735         BFD filename.
18736
18737         Right now, every in-memory BFD is given the filename "<in-memory>".
18738         This filename is visible in things like 'maint info symtabs' and
18739         'maint info line-table'.  If there are multiple in-memory BFD objects
18740         then it can be hard to match keep track if which BFD is which.  This
18741         commit changes the name to be "<in-memory@ADDRESS>" where ADDRESS is
18742         replaced with the base address for where the in-memory symbol file was
18743         read from.
18744
18745         As an example of how this is useful, here's the output of 'maint info
18746         jit' showing a single loaded JIT symfile:
18747
18748           (gdb) maintenance info jit
18749           jit_code_entry address symfile address    symfile size
18750           0x00000000004056b0     0x0000000007000000 17320
18751
18752         And here's part of the output from 'maint info symtabs':
18753
18754           (gdb) maintenance info symtabs
18755           ...snip...
18756           { objfile <in-memory@0x7000000> ((struct objfile *) 0x5258250)
18757             { ((struct compunit_symtab *) 0x4f0afb0)
18758               debugformat DWARF 4
18759               producer GNU C17 9.3.1 20200408 (Red Hat 9.3.1-2) -mtune=generic -march=x86-64 -g -fno-stack-protector -fpic
18760               name jit-elf-solib.c
18761               dirname /tmp/binutils-gdb/build/gdb/testsuite
18762               blockvector ((struct blockvector *) 0x5477850)
18763               user ((struct compunit_symtab *) (null))
18764                 { symtab /tmp/binutils-gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/jit-elf-solib.c ((struct symtab *) 0x4f0b030)
18765                   fullname (null)
18766                   linetable ((struct linetable *) 0x5477880)
18767                 }
18768             }
18769           }
18770
18771         I've added a new test that checks the new in-memory file names are
18772         generated correctly, and also checks that the in-memory JIT files can
18773         be dumped back out using 'dump binary memory'.
18774
18775 2022-10-10  Andrew Burgess  <aburgess@redhat.com>
18776
18777         gdb: remove filename arg from gdb_bfd_open_from_target_memory
18778         The filename argument to gdb_bfd_open_from_target_memory was never
18779         used; this argument had a default value of nullptr, and the only call
18780         to this function, in jit.c, relied on the default value.
18781
18782         In the next commit I'm going to make some changes to the
18783         gdb_bfd_open_from_target_memory function, and, though I could take
18784         account of a filename parameter, it seems pointless to maintain an
18785         unused argument.
18786
18787         This commit removes the filename argument.
18788
18789         There should be no user visible changes after this commit.
18790
18791 2022-10-10  Andrew Burgess  <aburgess@redhat.com>
18792
18793         gdb: add infcall specific debugging
18794         Add two new commands:
18795
18796           set debug infcall on|off
18797           show debug infcall
18798
18799         These enable some new debugging related to when GDB makes inferior
18800         function calls.  I've added some basic debugging for what I think are
18801         the major steps in the inferior function call process, but I'm sure we
18802         might want to add more later.
18803
18804 2022-10-10  Andrew Burgess  <aburgess@redhat.com>
18805
18806         gdb: extra debug output in thread.c
18807         Add some extra 'threads' debug in a couple of places in thread.c.
18808         I've also added an additional gdb_assert in one case.
18809
18810         gdb: improve infrun_debug_show_threads output
18811         This commit switches to use INFRUN_SCOPED_DEBUG_START_END in the
18812         infrun_debug_show_threads function, which means the output will get an
18813         extra level of indentation, this looks a little nicer I think.
18814
18815 2022-10-10  Nick Clifton  <nickc@redhat.com>
18816
18817         Add ability to create reproducible source tarballs.
18818                 * src-release.sh: Add "-r <date>" option to create reproducible
18819                 tarballs based upon a fixed timestamp of <date>.
18820                 * binutils/README-how-to-make-a-release: Add a line showing how to
18821                 use -r <date> when creating a binutils release.
18822
18823 2022-10-10  Bruno Larsen  <blarsen@redhat.com>
18824
18825         gdb/frame: Add reinflation method for frame_info_ptr
18826         Currently, despite having a smart pointer for frame_infos, GDB may
18827         attempt to use an invalidated frame_info_ptr, which would cause internal
18828         errors to happen.  One such example has been documented as PR
18829         python/28856, that happened when printing frame arguments calls an
18830         inferior function.
18831
18832         To avoid failures, the smart wrapper was changed to also cache the frame
18833         id, so the pointer can be reinflated later.  For this to work, the
18834         frame-id stuff had to be moved to their own .h file, which is included
18835         by frame-info.h.
18836
18837         Frame_id caching is done explicitly using the prepare_reinflate method.
18838         Caching is done manually so that only the pointers that need to be saved
18839         will be, and reinflating has to be done manually using the reinflate
18840         method because the get method and the -> operator must not change
18841         the internals of the class.  Finally, attempting to reinflate when the
18842         pointer is being invalidated causes the following assertion errors:
18843
18844         check_ptrace_stopped_lwp_gone: assertion `lp->stopped` failed.
18845         get_frame_pc: Assertion `frame->next != NULL` failed.
18846
18847         As for performance concerns, my personal testing with `time make
18848         chec-perf GDB_PERFTEST_MODE=run` showed an actual reduction of around
18849         10% of time running.
18850
18851         This commit also adds a testcase that exercises the python/28856 bug with
18852         7 different triggers, run, continue, step, backtrace, finish, up and down.
18853         Some of them can seem to be testing the same thing twice, but since this
18854         test relies on stale pointers, there is always a chance that GDB got lucky
18855         when testing, so better to test extra.
18856
18857         Regression tested on x86_64, using both gcc and clang.
18858
18859         Approved-by: Tom Tomey <tom@tromey.com>
18860
18861 2022-10-10  Tom Tromey  <tom@tromey.com>
18862
18863         Change GDB to use frame_info_ptr
18864         This changes GDB to use frame_info_ptr instead of frame_info *
18865         The substitution was done with multiple sequential `sed` commands:
18866
18867         sed 's/^struct frame_info;/class frame_info_ptr;/'
18868         sed 's/struct frame_info \*/frame_info_ptr /g' - which left some
18869             issues in a few files, that were manually fixed.
18870         sed 's/\<frame_info \*/frame_info_ptr /g'
18871         sed 's/frame_info_ptr $/frame_info_ptr/g' - used to remove whitespace
18872             problems.
18873
18874         The changed files were then manually checked and some 'sed' changes
18875         undone, some constructors and some gets were added, according to what
18876         made sense, and what Tromey originally did
18877
18878         Co-Authored-By: Bruno Larsen <blarsen@redhat.com>
18879         Approved-by: Tom Tomey <tom@tromey.com>
18880
18881 2022-10-10  Tom Tromey  <tom@tromey.com>
18882
18883         Introduce frame_info_ptr smart pointer class
18884         This adds frame_info_ptr, a smart pointer class.  Every instance of
18885         the class is kept on an intrusive list.  When reinit_frame_cache is
18886         called, the list is traversed and all the pointers are invalidated.
18887         This should help catch the typical GDB bug of keeping a frame_info
18888         pointer alive where a frame ID was needed instead.
18889
18890         Co-Authored-By: Bruno Larsen <blarsen@redhat.com>
18891         Approved-by: Tom Tomey <tom@tromey.com>
18892
18893 2022-10-10  Tom Tromey  <tom@tromey.com>
18894
18895         Remove frame_id_eq
18896         This replaces frame_id_eq with operator== and operator!=.  I wrote
18897         this for a version of this series that I later abandoned; but since it
18898         simplifies the code, I left this patch in.
18899
18900         Approved-by: Tom Tomey <tom@tromey.com>
18901
18902 2022-10-10  Andrew Burgess  <aburgess@redhat.com>
18903
18904         gdb/testsuite: use 'end' at the end of python blocks
18905         Within the testsuite, use the keyword 'end' to terminate blocks of
18906         Python code being sent to GDB, rather than sending \004.  I could only
18907         find three instances of this, all in tests that I originally wrote.  I
18908         have no memory of there being any special reason why I used \004
18909         instead of 'end' - I assume I copied this from somewhere else that has
18910         since changed.
18911
18912         Non of the tests being changed here are specifically about whether
18913         \004 can be used to terminate a Python block, so I think switching to
18914         the more standard 'end' keyword is the right choice.
18915
18916 2022-10-10  Simon Marchi  <simon.marchi@polymtl.ca>
18917
18918         gdbsupport: re-generate configure
18919         I get this diff when re-generating configure, probably leftover from
18920         67d1991b785 ("egrep in binutils").
18921
18922         Change-Id: I759c88c2bad648736d33ff98089db45c9b686356
18923
18924 2022-10-10  Alan Modra  <amodra@gmail.com>
18925
18926         Merge configure.ac from gcc project
18927         To merge with gcc's copy of configure.ac we need to revert changes to
18928         configure.ac in the following gcc commits:
18929         dc832fb39fc0 2022-08-25
18930         fc259b522c0f 2022-06-25
18931         Then reapply configure.ac changes in binutils from these binutils
18932         commits:
18933         50ad1254d503 2021-01-09
18934         bb368aad297f 2022-03-11
18935         e5f2f7d901ee 2022-07-26
18936         2cac01e3ffff 2022-09-26
18937         Plus copy over gcc's config/ax_cxx_compile_stdcxx.m4, then regenerate
18938         configure.
18939
18940 2022-10-10  GDB Administrator  <gdbadmin@sourceware.org>
18941
18942         Automatic date update in version.in
18943
18944 2022-10-09  GDB Administrator  <gdbadmin@sourceware.org>
18945
18946         Automatic date update in version.in
18947
18948 2022-10-08  Tom Tromey  <tom@tromey.com>
18949
18950         Merge both implementations of debug_names::insert
18951         The class debug_names has two 'insert' overloads, but only one of them
18952         is ever called externally, and it simply forwards to the other
18953         implementation.  It seems cleaner to me to have a single method, so
18954         this patch merges the two.
18955
18956 2022-10-08  Tom de Vries  <tdevries@suse.de>
18957
18958         [gdb/testsuite] Fix silent fail in gdb.server/connect-with-no-symbol-file.exp
18959         With native and target boards native-gdbserver, remote-gdbserver-on-localhost and
18960         remote-stdio-gdbserver I have for gdb.server/connect-with-no-symbol-file.exp:
18961         ...
18962          # of expected passes            8
18963         ...
18964         but with native-extended-gdbserver I have instead:
18965         ...
18966          # of expected passes            8
18967          # of unexpected failures        4
18968         ...
18969
18970         The extra FAILs are of the form:
18971         ...
18972         (gdb) detach^M
18973         Detaching from pid process 28985^M
18974         [Inferior 1 (process 28985) detached]^M
18975         (gdb) FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=: \
18976           action=permission: connection to GDBserver succeeded
18977         ...
18978         and are due to the fact that the actual gdb output doesn't match the regexp:
18979         ...
18980             gdb_test "detach" \
18981                ".*Detaching from program: , process.*Ending remote debugging.*" \
18982                "connection to GDBserver succeeded"
18983         ...
18984
18985         With native, the actual gdb output is:
18986         ...
18987         (gdb) detach^M
18988         Detaching from pid process 29657^M
18989         Ending remote debugging.^M
18990         [Inferior 1 (process 29657) detached]^M
18991         (gdb) Remote debugging from host ::1, port 51028^M
18992         ...
18993         and because the regexp doesn't match, it triggers an implicit clause for
18994         "Ending remote debugging" in gdb_test_multiple, which has the consequence
18995         that the FAIL is silent.
18996
18997         Fix:
18998         - the regexp by making it less strict
18999         - the silent fail by rewriting into a gdb_test_multiple, and adding an
19000           explicit fail clause.
19001
19002         Tested on x86_64-linux, using native and aforementioned target boards.
19003
19004 2022-10-08  GDB Administrator  <gdbadmin@sourceware.org>
19005
19006         Automatic date update in version.in
19007
19008 2022-10-07  Lancelot SIX  <lancelot.six@amd.com>
19009
19010         gdb/testsuite: fix gdb.threads/linux-dp.exp regex
19011         On ubuntu 22.04 with the libc6-dbg package installed, I have the
19012         following failure:
19013
19014             where
19015             #0  print_philosopher (n=3, left=33 '!', right=33 '!') at .../gdb/testsuite/gdb.threads/linux-dp.c:105
19016             #1  0x000055555555576a in philosopher (data=0x55555555937c) at .../gdb/testsuite/gdb.threads/linux-dp.c:148
19017             #2  0x00007ffff7e11b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
19018             #3  0x00007ffff7ea3a00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
19019             (gdb) FAIL: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit
19020
19021         The regex for this test accounts for different situations (with /
19022         without debug symbol) but assumes that if debug info is present the
19023         backtrace shows execution under pthread_create.  However, for the
19024         implementation under test, we are under start_thread.
19025
19026         Update the regex to accept start_thread.
19027
19028         Tested on Ubuntu-22.04 x86_64 with and without libc6-dbg debug symbols
19029         available.
19030
19031         Change-Id: I1e1536279890bca2cd07f038e026b41e46af44e0
19032
19033 2022-10-07  Tom de Vries  <tdevries@suse.de>
19034
19035         [gdb/testsuite] Handle host cleanfiles
19036         When running test-case gdb.server/abspath.exp with host board
19037         local-remote-host-notty, I get:
19038         ...
19039         $ git sti
19040           ...
19041                 deleted:    gdb/testsuite/gdb.xml/trivial.xml
19042         ...
19043
19044         This happens as follows.  The test-case calls skip_gdbserver_test, which calls
19045         gdb_skip_xml_test, which does:
19046         ...
19047             set xml_file [gdb_remote_download host "${srcdir}/gdb.xml/trivial.xml"]
19048         ...
19049
19050         Then proc gdb_remote_download appends $xml_file (which for this particular
19051         host board happens to be ${srcdir}/gdb.xml/trivial.xml) to cleanfiles, which
19052         ends up being handled in gdb_finish by:
19053         ...
19054                eval remote_file target delete $cleanfiles
19055         ...
19056
19057         The problem is that a host file is deleted using target delete.
19058
19059         Fix this by splitting cleanfiles up in cleanfiles_target and cleanfiles_host.
19060
19061         Tested on x86_64-linux.
19062
19063 2022-10-07  Tom de Vries  <tdevries@suse.de>
19064
19065         [gdb/testsuite] Remove unnecessary warning in gdb.base/default.exp
19066         When running test-case gdb.base/default.exp with target board
19067         native-gdbserver, we get:
19068         ...
19069         WARNING: Skipping backtrace and break tests because of GDB stub.
19070         ...
19071
19072         There's no need for such a warning, so remove it.
19073
19074         Tested on x86_64-linux with native and target board native-gdbserver.
19075
19076 2022-10-07  Tom de Vries  <tdevries@suse.de>
19077
19078         [gdb/testsuite] Fix have_mpx with remote-gdbserver-on-localhost
19079         With target board remote-gdbserver-on-localhost and gdb.arch/i386-mpx-call.exp
19080         I run into:
19081         ...
19082         FAIL: gdb.arch/i386-mpx-call.exp: upper_bnd0: continue to a bnd violation
19083         ...
19084
19085         This is due to the have_mpx test which should return 0, but instead returns 1
19086         because the captured output:
19087         ...
19088         No MPX support
19089         No MPX support
19090         ...
19091         does not match the used regexp:
19092         ...
19093             set status [expr ($status == 0) \
19094                            && ![regexp "^No MPX support\r\n" $output]]
19095         ...
19096         which does match the captured output with native:
19097         ...
19098         No MPX support^M
19099         No MPX support^M
19100         ...
19101
19102         Fix this by making the \r in the regexp optional.
19103
19104         Tested on x86_64-linux, with native and target board
19105         remote-gdbserver-on-localhost.
19106
19107 2022-10-07  Tom de Vries  <tdevries@suse.de>
19108
19109         [gdb/testsuite] Fix DUPLICATEs with remote-gdbserver-on-localhost
19110         Fix some DUPLICATEs that we run into with target board
19111         remote-gdbserver-on-localhost, by using test_with_prefix.
19112
19113         Tested on x86_64-linux, with native and target board
19114         remote-gdbserver-on-localhost.
19115
19116 2022-10-07  Tom de Vries  <tdevries@suse.de>
19117
19118         [gdb/testsuite] Fix path in test name in gdb_load_shlib
19119         When running test-case gdb.server/solib-list.exp with target board
19120         remote-gdbserver-on-localhost, I run into:
19121         ...
19122         (gdb) set solib-search-path $outputs/gdb.server/solib-list^M
19123         (gdb) PASS: gdb.server/solib-list.exp: non-stop 0: \
19124           set solib-search-path $outputs/gdb.server/solib-list
19125         PATH: gdb.server/solib-list.exp: non-stop 0: \
19126           set solib-search-path $outputs/gdb.server/solib-list
19127         ...
19128
19129         This is due to this code in gdb_load_shlib:
19130         ...
19131                gdb_test "set solib-search-path [file dirname $file]" "" ""
19132         ...
19133
19134         Fix this by setting an explicit test name.
19135
19136         Tested on x86_64-linux, with native and target boards
19137         remote-gdbserver-on-localhost, native-gdbserver and native-extended-gdbserver.
19138
19139 2022-10-07  Alan Modra  <amodra@gmail.com>
19140
19141         PR29653, objcopy/strip: fuzzed small input file induces large output file
19142         _bfd_check_format functions should not print errors or warnings if
19143         they return NULL.  A NULL return means the particular target under
19144         test does not match, so there isn't any reason to make a complaint
19145         about the target.  In fact there isn't a good reason to warn even if
19146         the target matches, except via the _bfd_per_xvec_warn mechanism; Some
19147         other target might be a better match.
19148
19149         This patch tidies pe_bfd_object_p with the above in mind, and
19150         restricts the PE optional header SectionAlignment and FileAlignment
19151         fields somewhat.  I chose to warn on nonsense values rather than
19152         refusing to match.  Refusing to match would be OK too.
19153
19154                 PR 29653
19155                 * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Don't emit error about
19156                 invalid NumberOfRvaAndSizes here.  Limit loop copying data
19157                 directory to IMAGE_NUMBEROF_DIRECTORY_ENTRIES.
19158                 * peicode.h (pe_bfd_object_p): Don't clear and test bfd_error
19159                 around bfd_coff_swap_aouthdr_in.  Warn on invalid SectionAlignment,
19160                 FileAlignment and NumberOfRvaAndSizes.  Don't return NULL on
19161                 invalid NumberOfRvaAndSizes.
19162
19163 2022-10-07  GDB Administrator  <gdbadmin@sourceware.org>
19164
19165         Automatic date update in version.in
19166
19167 2022-10-06  Tom Tromey  <tromey@adacore.com>
19168
19169         Fix indentation in riscv-tdep.c
19170         This just fixes some indentation in riscv-tdep.c.
19171
19172 2022-10-06  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
19173
19174         gdb/arm: Handle lazy FPU state preservation
19175         Read LSPEN, ASPEN and LSPACT bits from FPCCR and use them together
19176         with FPCAR to identify if lazy FPU state preservation is active for
19177         the current frame.  See "Lazy context save of FP state", in B1.5.7,
19178         also ARM AN298, supported by Cortex-M4F architecture for details on
19179         lazy FPU register stacking.  The same conditions are valid for other
19180         Cortex-M cores with FPU.
19181
19182         This patch has been verified on a STM32F4-Discovery board by:
19183         a) writing a non-zero value (lets use 0x1122334455667788 as an
19184            example) to all the D-registers in the main function
19185         b) configured the SysTick to fire
19186         c) in the SysTick_Handler, write some other value (lets use
19187            0x0022446688aaccee as an example) to one of the D-registers (D0 as
19188            an example) and then do "SVC #0"
19189         d) in the SVC_Handler, write some other value (lets use
19190            0x0099aabbccddeeff) to one of the D-registers (D0 as an example)
19191
19192         In GDB, suspend the execution in the SVC_Handler function and compare
19193         the value of the D-registers for the SVC_handler frame and the
19194         SysTick_Handler frame.  With the patch, the value of the modified
19195         D-register (D0) should be the new value (0x009..eff) on the
19196         SVC_Handler frame, and the intermediate value (0x002..cee) for the
19197         SysTick_Handler frame.  Now compare the D-register value for the
19198         SysTick_Handler frame and the main frame.  The main frame should
19199         have the initial value (0x112..788).
19200
19201 2022-10-06  Tom de Vries  <tdevries@suse.de>
19202
19203         [gdb/symtab] Factor out have_complaint
19204         After committing 8ba677d3560 ("[gdb/symtab] Don't complain about function
19205         decls") I noticed that quite a bit of code in read_func_scope is used to decide
19206         whether to issue the "cannot get low and high bounds for subprogram DIE at
19207         $hex" complaint, which executes unnecessarily if we have the default
19208         "set complaints 0".
19209
19210         Fix this by (NFC):
19211         - factoring out new static function have_complaint from macro complaint, and
19212         - using it to wrap the relevant code in read_func_scope.
19213
19214         Tested on x86_64-linux.
19215
19216 2022-10-06  Andrew Burgess  <aburgess@redhat.com>
19217
19218         gdb: add missing nullptr checks in bpstat_check_breakpoint_conditions
19219         Add a couple of missing nullptr checks in the function
19220         bpstat_check_breakpoint_conditions.
19221
19222         No user visible change after this commit.
19223
19224 2022-10-06  Andrew Burgess  <aburgess@redhat.com>
19225
19226         gdb: more infrun debug from breakpoint.c
19227         This commit adds additional infrun debug from the breakpoint.c file.
19228         The new debug output all relates to breakpoint condition evaluation.
19229
19230         There is already some infrun debug emitted from the breakpoint.c file,
19231         so hopefully, adding more will not be contentious.  I think the
19232         functions being instrumented make sense as part of the infrun process,
19233         the inferior stops, evaluates the condition, and then either stops or
19234         continues.  This new debug gives more insight into that process.
19235
19236         I had to make the bp_location* argument to find_loc_num_by_location
19237         const, and add a declaration for find_loc_num_by_location.
19238
19239         There should be no user visible changes unless they turn on debug
19240         output.
19241
19242 2022-10-06  Andrew Burgess  <aburgess@redhat.com>
19243
19244         gdb: add some additional debug in mark_async_event_handler
19245         Extend the existing debug printf call to include the previous state of
19246         the async_event_handler object.
19247
19248 2022-10-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
19249
19250         RISC-V: Print XTheadMemPair literal as "immediate"
19251         The operand type "Xl(...)" denotes that (...) is a literal.  Specifically,
19252         they are intended to be a constant immediate value.
19253
19254         This commit prints "Xl(...)" operand with dis_style_immediate style,
19255         not dis_style_text.
19256
19257         opcodes/ChangeLog:
19258
19259                 * riscv-dis.c (print_insn_args): Use dis_style_immediate on
19260                 the constant literal of the "Xl..." operand.
19261
19262 2022-10-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
19263
19264         RISC-V: Fix T-Head immediate types on printing
19265         This commit fixes two minor typing-related issues for
19266         T-Head immediate operands.
19267
19268         1.  A signed type must be specified when printing with %i.
19269         2.  unsigned/signed int is not portable enough for max 32-bit immediates.
19270             Instead, we should use unsigned/signed long.
19271             The format string is changed accordingly.
19272
19273         opcodes/ChangeLog:
19274
19275                 * riscv-dis.c (print_insn_args): Fix T-Head immediate types on
19276                 printing.
19277
19278 2022-10-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
19279
19280         RISC-V: Print comma and tabs as the "text" style
19281         On the RISC-V disassembler, some separators have non-text style when
19282         printed with another word with another style.
19283
19284         This commit splits those, making sure that those comma and tabs are printed
19285         with the "text" style.
19286
19287         opcodes/ChangeLog:
19288
19289                 * riscv-dis.c (print_insn_args): Split and print the comma as
19290                 text.  (riscv_disassemble_insn): Split and print tabs as text.
19291                 (riscv_disassemble_data): Likewise.
19292
19293 2022-10-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
19294
19295         RISC-V: Optimize riscv_disassemble_data printf
19296         This commit makes types of printf arguments on riscv_disassemble_data
19297         as small as possible (as long as we can preserve the portability) to reduce
19298         the cost of printf (especially on 32-bit host).
19299
19300         opcodes/ChangeLog:
19301
19302                 * riscv-dis.c (riscv_disassemble_data): Use smallest possible type
19303                 to printing data.
19304
19305 2022-10-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
19306
19307         RISC-V: Fix printf argument types corresponding %x
19308         "%x" format specifier requires unsigned type, not int.  This commit
19309         fixes this issue on the RISC-V disassembler.
19310
19311         opcodes/ChangeLog:
19312
19313                 * riscv-dis.c (print_insn_args): Fix printf argument types where
19314                 the format specifier is "%x".
19315
19316 2022-10-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
19317
19318         RISC-V: Fix immediates to have "immediate" style
19319         This commit fixes certain print calls on immediate operands to have
19320         dis_style_immediate.
19321
19322         opcodes/ChangeLog:
19323
19324                 * riscv-dis.c (print_insn_args): Fix immediates to have
19325                 "immediate" style.  (riscv_disassemble_data): Likewise.
19326
19327 2022-10-06  GDB Administrator  <gdbadmin@sourceware.org>
19328
19329         Automatic date update in version.in
19330
19331 2022-10-06  Alan Modra  <amodra@gmail.com>
19332
19333         Re: bfd BLD-POTFILES.in dependencies
19334         Removing $BLD_POTFILES from BFD-POTFILES.in was correct, but left a
19335         hole in dependencies.
19336         make[4]: Entering directory '/home/alan/build/gas/all/bfd/po'
19337         make[4]: *** No rule to make target '../elf32-aarch64.c', needed by '/home/alan/src/binutils-gdb/bfd/po/bfd.pot'.  Stop.
19338
19339                 * Makefile.am (BUILT_SOURCES): Add BUILD_CFILES.
19340                 * Makefile.in: Regenerate.
19341
19342 2022-10-05  Jan Beulich  <jbeulich@suse.com>
19343
19344         x86/gas: support quoted address scale factor in AT&T syntax
19345         An earlier attempt (e68c3d59acd0 ["x86: better respect quotes in
19346         parse_operands()"]) needed undoing (cc0f96357e0b ["x86: permit
19347         parenthesized expressions again as addressing scale factor"]) as far its
19348         effect here went. As indicated back then, the issue is the backwards
19349         scanning of the operand string to find the matching opening parenthesis.
19350         Switch to forward scanning, finding the last outermost unquoted opening
19351         parenthesis (which is the one matching the trailing closing one).
19352
19353         Arm64: support CLEARBHB alias
19354         While the Arm v8 ARM (rev I-a) still doesn't mention this alias, it is
19355         (typically via a macro) already in use in kernels and alike.
19356
19357 2022-10-05  Alan Modra  <amodra@gmail.com>
19358
19359         PR29647, objdump -S looping
19360         Fuzzed input with this in .debug_line
19361           [0x0000003b]  Special opcode 115: advance Address by 8 to 0x401180 and Line by -2 to -1
19362
19363                 PR 29647
19364                 * objdump.c (print_line): Don't decrement line number here..
19365                 (dump_lines): ..do so here instead, ensuring loop terminates.
19366
19367 2022-10-05  Alan Modra  <amodra@gmail.com>
19368
19369         Re: stab nearest_line bfd_malloc_and_get_section
19370         It didn't take long for the fuzzers to avoid size checks in
19371         bfd_malloc_and_get_section.  Plug this hole.
19372
19373                 * syms.c (_bfd_stab_section_find_nearest_line): Ignore fuzzed
19374                 sections with no contents.
19375
19376 2022-10-05  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
19377
19378         gprofng: fix build with --enable-pgo-build=lto
19379         gprofng/ChangeLog
19380         2022-10-04  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
19381
19382                 PR gprofng/29579
19383                 * libcollector/dispatcher.c: Fix the symbol version in SYMVER_ATTRIBUTE.
19384                 * libcollector/iotrace.c: Likewise.
19385                 * libcollector/linetrace.c: Likewise.
19386                 * libcollector/mmaptrace.c: Likewise.
19387                 * libcollector/synctrace.c: Likewise.
19388
19389 2022-10-05  GDB Administrator  <gdbadmin@sourceware.org>
19390
19391         Automatic date update in version.in
19392
19393 2022-10-04  Tom Tromey  <tom@tromey.com>
19394
19395         Remove decode_location_spec_default
19396         This removes decode_location_spec_default, inlining it into its sole
19397         caller.
19398
19399         Regression tested on x86-64 Fedora 34.
19400
19401 2022-10-04  Palmer Dabbelt  <palmer@rivosinc.com>
19402
19403         gas: NEWS: Mention the T-Head extensions that were recently added
19404
19405 2022-10-04  Tom de Vries  <tdevries@suse.de>
19406
19407         [gdb/symtab] Don't complain about function decls
19408         [ Requires "[gdb/symtab] Don't complain about inlined functions" as
19409         submitted here (
19410         https://sourceware.org/pipermail/gdb-patches/2022-September/191762.html ). ]
19411
19412         With the test-case included in this patch, we get:
19413         ...
19414         (gdb) ptype main^M
19415         During symbol reading: cannot get low and high bounds for subprogram DIE \
19416           at 0xc1^M
19417         type = int (void)^M
19418         (gdb) FAIL: gdb.dwarf2/anon-ns-fn.exp: ptype main without complaints
19419         ...
19420
19421         The DIE causing the complaint is a function declaration:
19422         ...
19423          <2><c1>: Abbrev Number: 3 (DW_TAG_subprogram)
19424             <c2>   DW_AT_name        : foo
19425             <c8>   DW_AT_declaration : 1
19426         ...
19427         which is referred to from the DIE representing the function definition:
19428         ...
19429          <1><f4>: Abbrev Number: 7 (DW_TAG_subprogram)
19430             <f5>   DW_AT_specification: <0xc1>
19431             <f9>   DW_AT_low_pc      : 0x4004c7
19432             <101>   DW_AT_high_pc     : 0x7
19433         ...
19434         which does contain the low and high bounds.
19435
19436         Fix this by not complaining about function declarations.
19437
19438         Tested on x86_64-linux.
19439
19440 2022-10-04  Tom de Vries  <tdevries@suse.de>
19441
19442         [gdb/symtab] Don't complain about inlined functions
19443         With the test-case included in this patch, we get:
19444         ...
19445         (gdb) ptype main^M
19446         During symbol reading: cannot get low and high bounds for subprogram DIE \
19447           at 0x113^M
19448         During symbol reading: cannot get low and high bounds for subprogram DIE \
19449           at 0x11f^M
19450         type = int (void)^M
19451         (gdb) FAIL: gdb.dwarf2/inline.exp: ptype main
19452         ...
19453
19454         The complaints are about foo, with DW_AT_inline == DW_INL_inlined:
19455         ...
19456          <1><11f>: Abbrev Number: 6 (DW_TAG_subprogram)
19457             <120>   DW_AT_name        : foo
19458             <126>   DW_AT_prototyped  : 1
19459             <126>   DW_AT_type        : <0x10c>
19460             <12a>   DW_AT_inline      : 1       (inlined)
19461         ...
19462         and foo2, with DW_AT_inline == DW_INL_declared_inlined:
19463         ...
19464          <1><113>: Abbrev Number: 5 (DW_TAG_subprogram)
19465             <114>   DW_AT_name        : foo2
19466             <11a>   DW_AT_prototyped  : 1
19467             <11a>   DW_AT_type        : <0x10c>
19468             <11e>   DW_AT_inline      : 3       (declared as inline and inlined)
19469         ...
19470
19471         Fix this by not complaining about inlined functions.
19472
19473         Tested on x86_64-linux.
19474
19475 2022-10-04  Tsukasa OI  <research_trasio@irq.a4lg.com>
19476
19477         gdb/riscv: Partial support for instructions up to 176-bit
19478         Because riscv_insn_length started to support instructions up to 176-bit,
19479         we need to increase buf size to 176-bit in size.
19480
19481         Also, that would break an assumption in riscv_insn::decode so this commit
19482         fixes it, noting that instructions longer than 64-bit are not fully
19483         supported yet.
19484
19485 2022-10-04  Tsukasa OI  <research_trasio@irq.a4lg.com>
19486
19487         RISC-V: Fix buffer overflow on print_insn_riscv
19488         Because riscv_insn_length started to support instructions up to 176-bit,
19489         we need to increase packet buffer size to 176-bit in size.
19490
19491         include/ChangeLog:
19492
19493                 * opcode/riscv.h (RISCV_MAX_INSN_LEN): Max instruction length for
19494                 use in buffer size.
19495
19496         opcodes/ChangeLog:
19497
19498                 * riscv-dis.c (print_insn_riscv): Increase buffer size for max
19499                 176-bit length instructions.
19500
19501 2022-10-04  Nelson Chu  <nelson@rivosinc.com>
19502
19503         RISC-V: Renamed INSN_CLASS for floating point in integer extensions.
19504         Just added suffix _INX for those INSN_CLASS should be enough to represent
19505         their fpr can be replaced by gpr.
19506
19507 2022-10-04  Nick Clifton  <nickc@redhat.com>
19508
19509         Note that at least dejagnu version 1.5.3 is required in order to be ale to run the testsuites.
19510                 * README-maintainer-mode: Add a minimum version of dejagnu
19511                 requirement.
19512
19513 2022-10-04  Andrew Burgess  <aburgess@redhat.com>
19514
19515         opcodes/riscv: style csr names as registers
19516         While reviewing another patch I noticed that RISC-V CSR names are
19517         given the text style, not the register style.  This patch fixes this
19518         mistake.
19519
19520 2022-10-04  Luis Machado  <luis.machado@arm.com>
19521
19522         [AArch64] Update FPSR/FPCR fields for FPU and SVE
19523         I noticed some missing flags/fields from FPSR and FPCR registers in
19524         both the FPU and SVE target descriptions.
19525
19526         This patch adds those and makes the SVE versions of FPSR and FPCR
19527         use the proper flags/bitfields types.
19528
19529 2022-10-04  Alan Modra  <amodra@gmail.com>
19530
19531         Support objcopy changing compression to or from zstd
19532         Commit 2cac01e3ffff lacked support for objcopy changing compression
19533         style.  Add that support, which meant a rewrite of
19534         bfd_compress_section_contents.  In the process I've fixed some memory
19535         leaks.
19536
19537                 * compress.c (bfd_is_section_compressed_info): Rename from
19538                 bfd_is_section_compressed_with_header and add ch_type param
19539                 to return compression header ch_type field.
19540                 Update all callers.
19541                 (decompress_section_contents): Remove buffer and size params.
19542                 Rewrite.  Update callers.
19543                 (bfd_init_section_compress_status): Free contents on failure.
19544                 (bfd_compress_section): Likewise.
19545                 * elf.c (_bfd_elf_make_section_from_shdr): Support objcopy
19546                 changing between any of the three compression schemes.  Report
19547                 "unable to compress/decompress" rather than "unable to
19548                 initialize compress/decompress status" on compress/decompress
19549                 failures.
19550                 * bfd-in2.h: Regenerate.
19551
19552 2022-10-04  Alan Modra  <amodra@gmail.com>
19553
19554         Re: compress .gnu.debuglto_.debug_* sections if requested
19555         Enable zlib-gnu compression for .gnu.debuglto_.debug_*.  This differs
19556         from zlib-gnu for .debug_* where the name is changed to .zdebug_*.
19557         The name change isn't really needed.
19558
19559         bfd/
19560                 * elf.c (elf_fake_sections): Replace "." with ".z" in debug
19561                 section names only when name was ".d*", ie. ".debug_*".
19562                 (_bfd_elf_assign_file_positions_for_non_load): Likewise.
19563         gas/
19564                 * write.c (compress_debug): Compress .gnu.debuglto_.debug_*
19565                 for zlib-gnu too.  Compress .gnu.linkonce.wi.*.
19566
19567 2022-10-04  Martin Liska  <mliska@suse.cz>
19568
19569         compress .gnu.debuglto_.debug_* sections if requested
19570         Right now, when using LTO, the intermediate object files do contain
19571         debug info in sections starting with .gnu.debuglto_ prefix and are
19572         not compressed when --compress-debug-sections is used.
19573
19574         It's a mistake and we can save quite some disk space. The following
19575         example comes from tramp3d when the corresponding LTO sections
19576         are compressed with zlib:
19577
19578         $ bloaty tramp3d-v4-v2.o -- tramp3d-v4.o
19579             FILE SIZE        VM SIZE
19580          --------------  --------------
19581            +83%     +10  [ = ]       0    [Unmapped]
19582          -68.0%    -441  [ = ]       0    .gnu.debuglto_.debug_line
19583          -52.3%    -759  [ = ]       0    .gnu.debuglto_.debug_line_str
19584          -62.4% -3.24Ki  [ = ]       0    .gnu.debuglto_.debug_abbrev
19585          -64.8% -1.12Mi  [ = ]       0    .gnu.debuglto_.debug_info
19586          -88.8% -4.58Mi  [ = ]       0    .gnu.debuglto_.debug_str
19587          -27.7% -5.70Mi  [ = ]       0    TOTAL
19588
19589         bfd/ChangeLog:
19590
19591                 * elf.c (_bfd_elf_make_section_from_shdr): Compress all debug
19592                   info sections.
19593
19594         gas/ChangeLog:
19595
19596                 * write.c (compress_debug): Compress also ".gnu.debuglto_.debug_"
19597                 if the compression algorithm is different from zlib-gnu.
19598
19599 2022-10-04  Jan Beulich  <jbeulich@suse.com>
19600
19601         RISC-V/gas: allow generating up to 176-bit instructions with .insn
19602         For the time being simply utilize O_big to avoid widening other fields,
19603         bypassing append_insn() etc.
19604
19605         RISC-V/gas: don't open-code insn_length()
19606         Use the helper when it can be used.
19607
19608         RISC-V/gas: drop stray call to install_insn()
19609         add_fixed_insn(), by calling move_insn(), already invokes install_insn().
19610
19611         RISC-V/gas: drop riscv_subsets static variable
19612         It's fully redundant with the subset_list member of riscv_rps_as.
19613
19614         RISC-V: don't cast expressions' X_add_number to long in diagnostics
19615         There's no need for such workarounds anymore now that we use C99
19616         uniformly. This addresses several testsuite failures encountered when
19617         (cross-)building on a 32-bit host.
19618
19619 2022-10-04  Potharla, Rupesh  <Rupesh.Potharla@amd.com>
19620
19621         ignore DWARF debug information for -gsplit-dwarf with dwarf-5
19622         Skip dwo_id for split dwarf.
19623
19624         * dwarf2.c (parse_comp_unit): Skip DWO_id for DW_UT_skeleton.
19625
19626 2022-10-04  GDB Administrator  <gdbadmin@sourceware.org>
19627
19628         Automatic date update in version.in
19629
19630 2022-10-03  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
19631
19632         Fix self-move warning check for GCC 13+
19633         GCC 13 got the self-move warning (0abb78dda084a14b3d955757c6431fff71c263f3),
19634         but that warning is only checked for clang, resulting in:
19635
19636         /usr/lib/gcc-snapshot/bin/g++ -x c++    -I. -I. -I./config -DLOCALEDIR="\"/tmp/gdb-m68k-linux/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/readline/.. -I./../zlib  -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./../gnulib/import -I../gnulib/import -I./.. -I.. -I./../libbacktrace/ -I../libbacktrace/  -DTUI=1    -I./.. -pthread  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral -Werror -g -O2   -c -o unittests/environ-selftests.o -MT unittests/environ-selftests.o -MMD -MP -MF unittests/.deps/environ-selftests.Tpo unittests/environ-selftests.c
19637         unittests/environ-selftests.c: In function 'void selftests::gdb_environ_tests::test_self_move()':
19638         unittests/environ-selftests.c:228:7: error: moving 'env' of type 'gdb_environ' to itself [-Werror=self-move]
19639           228 |   env = std::move (env);
19640               |   ~~~~^~~~~~~~~~~~~~~~~
19641         unittests/environ-selftests.c:228:7: note: remove 'std::move' call
19642         cc1plus: all warnings being treated as errors
19643         make[1]: *** [Makefile:1896: unittests/environ-selftests.o] Error 1
19644         make[1]: Leaving directory '/var/lib/laminar/run/gdb-m68k-linux/3/binutils-gdb/gdb'
19645         make: *** [Makefile:13193: all-gdb] Error 2
19646
19647 2022-10-03  Simon Marchi  <simon.marchi@polymtl.ca>
19648
19649         gdb: constify inferior::target_is_pushed
19650         Change-Id: Ia4143b9c63cb76e2c824ba773c66f5c5cd94b2aa
19651
19652 2022-10-03  Luis Machado  <luis.machado@arm.com>
19653
19654         [AArch64] Handle W registers as pseudo-registers instead of aliases of X registers
19655         The aarch64 port handles W registers as aliases of X registers. This is
19656         incorrect because X registers are 64-bit and W registers are 32-bit.
19657
19658         This patch teaches GDB how to handle W registers as pseudo-registers of
19659         32-bit, the bottom half of the X registers.
19660
19661         Testcase included.
19662
19663 2022-10-03  Luis Machado  <luis.machado@arm.com>
19664
19665         [AArch64] Fix pseudo-register numbering in the presence of unexpected additional registers
19666         When using AArch64 GDB with the QEMU debugging stub (in user mode), we get
19667         additional system registers that GDB doesn't particularly care about, so
19668         it doesn't number those explicitly.
19669
19670         But given the pseudo-register numbers are above the number of real registers,
19671         we need to setup/account for the real registers first before going ahead and
19672         numbering the pseudo-registers.  This has to happen at the end of
19673         aarch64_gdbarch_init, after the call to tdesc_use_registers, as that
19674         updates the total number of real registers.
19675
19676         This is in preparation to supporting pointer authentication for bare metal
19677         aarch64 (QEMU).
19678
19679 2022-10-03  Nick Clifton  <nickc@redhat.com>
19680
19681         readelf: DO not load section headers from file offset zero
19682                 * readelf.c (get_32bit_section_headers): Return false if the
19683                 e_shoff field is zero.
19684                 (get_64bit_section_headers): Likewise.
19685
19686 2022-10-03  Tsukasa OI  <research_trasio@irq.a4lg.com>
19687
19688         RISC-V: Move supervisor instructions after all unprivileged ones
19689         This location of supervisor instructions is out of place (because many other
19690         privileged instructions are located at the tail but after the supervisor
19691         instructions, we have many unprivileged instructions including bit
19692         manipulation / crypto / vector instructions).
19693
19694         Not only that, this is harmful to implement pseudoinstructions in the latest
19695         'P'-extension proposal (CLROV and RDOV).  This commit moves supervisor
19696         instructions after all unprivileged instructions.
19697
19698         opcodes/ChangeLog:
19699
19700                 * riscv-opc.c (riscv_opcodes): Adjust indents.  Move supervisor
19701                 instructions after all unprivileged instructions.
19702
19703 2022-10-03  Bruno Larsen  <blarsen@redhat.com>
19704
19705         Improve GDB's baseclass detection with typedefs
19706         When a class inherits from a typedef'd baseclass, GDB may be unable to
19707         find the baseclass if the user is not using the typedef'd name, as is
19708         tested on gdb.cp/virtbase2.exp; the reason that test case is working
19709         under gcc is that the dwarf generated by gcc links the class to the
19710         original definition of the baseclass, not to the typedef.  If the
19711         inheritance is linked to the typedef, such as how clang does it,
19712         gdb.cp/virtbase2.exp starts failing.
19713
19714         This can also be seen in gdb.cp/impl-this.exp, when attempting to print
19715         D::Bint::i, and GDB not being able to find the baseclass Bint.
19716
19717         This happens because searching for baseclasses only uses the macro
19718         TYPE_BASECLASS_NAME, which returns the typedef'd name. However, we can't
19719         switch that macro to checking for typedefs, otherwise we wouldn't be
19720         able to find the typedef'd name anymore. This is fixed by searching for
19721         members or baseclasses by name, we check both the saved name and the
19722         name after checking for typedefs.
19723
19724         This also fixes said long-standing bug in gdb.cp/impl-this.exp when the
19725         compiler adds information about typedefs in the debuginfo.
19726
19727 2022-10-03  Tsukasa OI  <research_trasio@irq.a4lg.com>
19728
19729         RISC-V: Assign DWARF numbers to vector registers
19730         This commit assigns DWARF register numbers to vector registers (v0-v31:
19731         96..127) to implement RISC-V DWARF Specification version 1.0-rc4
19732         (now in the frozen state):
19733
19734         https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/tag/v1.0-rc4
19735
19736         binutils/ChangeLog:
19737
19738                 * dwarf.c (dwarf_regnames_riscv): Assign DWARF register numbers
19739                 96..127 to vector registers v0-v31.
19740
19741         gas/ChangeLog:
19742
19743                 * config/tc-riscv.c (tc_riscv_regname_to_dw2regnum): Support
19744                 vector registers.
19745                 * testsuite/gas/riscv/dw-regnums.s: Add vector registers to the
19746                 DWARF register number test.
19747                 * testsuite/gas/riscv/dw-regnums.d: Likewise.
19748
19749 2022-10-03  Tsukasa OI  <research_trasio@irq.a4lg.com>
19750
19751         RISC-V: Add testcase for DWARF register numbers
19752         Although it had csr-dw-regnums.d (for CSRs), it didn't have DWARF register
19753         number test for GPRs/FPRs.
19754
19755         This commit adds dw-regnums.{s,d} to test such registers.
19756
19757         gas/ChangeLog:
19758
19759                 * testsuite/gas/riscv/dw-regnums.s: New DWARF register number test
19760                 for GPRs/FPRs.
19761                 * testsuite/gas/riscv/dw-regnums.d: Likewise.
19762
19763 2022-10-03  GDB Administrator  <gdbadmin@sourceware.org>
19764
19765         Automatic date update in version.in
19766
19767 2022-10-02  Tom de Vries  <tdevries@suse.de>
19768
19769         [gdb/testsuite] Fix waitpid testing in next-fork-other-thread.c
19770         In next-fork-other-thread.c, there's this loop:
19771         ...
19772               do
19773                 {
19774                   ret = waitpid (pid, &stat, 0);
19775                 } while (ret == EINTR);
19776         ...
19777
19778         The loop condition tests for "ret == EINTR" but waitpid signals EINTR by
19779         returning -1 and setting errno to EINTR.
19780
19781         Fix this by changing the loop condition to "ret == -1 && errno == EINTR".
19782
19783         Tested on x86_64-linux.
19784
19785 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
19786
19787         gdb/testsuite: handle invalid .exp names passed in TESTS
19788         I ran some tests like:
19789
19790           $ make check-gdb TESTS="gdb.base/break.exp"
19791
19792         then, then I went to rerun the tests later, I managed to corrupt the
19793         command line, like this:
19794
19795           $ make check-gdb TESTS="gdb.base/breakff.exp"
19796
19797         the make command did exit with an error, but DejaGnu appeared to
19798         report that every test passed!  The tail end of the output looks like
19799         this:
19800
19801           Illegal Argument "no-matching-tests-found"
19802           try "runtest --help" for option list
19803                         === gdb Summary ===
19804
19805           # of expected passes          115
19806           /tmp/build/gdb/gdb version  13.0.50.20220831-git -nw -nx -iex "set height 0" -iex "set width 0" -data-directory /tmp/build/gdb/testsuite/../data-directory
19807
19808           make[3]: *** [Makefile:212: check-single] Error 1
19809           make[3]: Leaving directory '/tmp/build/gdb/testsuite'
19810           make[2]: *** [Makefile:161: check] Error 2
19811           make[2]: Leaving directory '/tmp/build/gdb/testsuite'
19812           make[1]: *** [Makefile:1916: check] Error 2
19813           make[1]: Leaving directory '/tmp/build/gdb'
19814           make: *** [Makefile:13565: check-gdb] Error 2
19815
19816         For a while, I didn't spot that DejaGnu had failed at all, I saw the
19817         115 passes, and thought everything had run correctly - though I was
19818         puzzled that make was reporting an error.
19819
19820         What happens is that in gdb/testsuite/Makefile, in the check-single
19821         rule, we first run DejaGnu, then run the dg-add-core-file-count.sh
19822         script, and finally, we use sed to extract the results from the
19823         gdb.sum file.
19824
19825         In my case, with the invalid test name, DejaGnu fails, but the
19826         following steps are still run, the final result, the 115 passes, is
19827         then extracted from the pre-existing gdb.sum file.
19828
19829         If I use 'make -jN' then the 'check-parallel' rule, rather than the
19830         'check-single' rule is used.  In this case the behaviour is slightly
19831         different, the tail end of the output now looks like this:
19832
19833           No matching tests found.
19834
19835           make[4]: Leaving directory '/tmp/build/gdb/testsuite'
19836           find: ‘outputs’: No such file or directory
19837           Usage: ../../../src/gdb/testsuite/../../contrib/dg-extract-results.py [-t tool] [-l variant-list] [-L] log-or-sum-file ...
19838
19839               tool           The tool (e.g. g++, libffi) for which to create a
19840                              new test summary file.  If not specified then output
19841                              is created for all tools.
19842               variant-list   One or more test variant names.  If the list is
19843                              not specified then one is constructed from all
19844                              variants in the files for <tool>.
19845               sum-file       A test summary file with the format of those
19846                              created by runtest from DejaGnu.
19847               If -L is used, merge *.log files instead of *.sum.  In this
19848               mode the exact order of lines may not be preserved, just different
19849               Running *.exp chunks should be in correct order.
19850           find: ‘outputs’: No such file or directory
19851           Usage: ../../../src/gdb/testsuite/../../contrib/dg-extract-results.py [-t tool] [-l variant-list] [-L] log-or-sum-file ...
19852
19853               tool           The tool (e.g. g++, libffi) for which to create a
19854                              new test summary file.  If not specified then output
19855                              is created for all tools.
19856               variant-list   One or more test variant names.  If the list is
19857                              not specified then one is constructed from all
19858                              variants in the files for <tool>.
19859               sum-file       A test summary file with the format of those
19860                              created by runtest from DejaGnu.
19861               If -L is used, merge *.log files instead of *.sum.  In this
19862               mode the exact order of lines may not be preserved, just different
19863               Running *.exp chunks should be in correct order.
19864           make[3]: Leaving directory '/tmp/build/gdb/testsuite'
19865           make[2]: Leaving directory '/tmp/build/gdb/testsuite'
19866           make[1]: Leaving directory '/tmp/build/gdb'
19867
19868         Rather than DejaGnu failing, we now get a nice 'No matching tests
19869         found' message, followed by some other noise.  This other noise is
19870         first `find` failing, followed by the dg-extract-results.py script
19871         failing.
19872
19873         What happens here is that, in the check-parallel rule, the outputs
19874         directory is deleted before DejaGnu is invoked.  Then we try to run
19875         all the tests, and finally we use find and dg-extract-results.py to
19876         combine all the separate .sun and .log files together.  However, if
19877         there are no tests run then the outputs/ directory is never created,
19878         so the find command and consequently the dg-extract-results.py script,
19879         fail.
19880
19881         This commit aims to fix the following issues:
19882
19883          (1) For check-single and check-parallel rules, don't run any of the
19884          post-processing steps if DejaGnu failed to run.  This will avoid all
19885          the noise after the initial failure of DejaGnu,
19886
19887          (2) For check-single ensure that we don't accidentally report
19888          previous results, this is related to the above, but is worth calling
19889          out as a separate point, and
19890
19891          (3) For check-single, print the 'No matching tests found' message
19892          just like we do for a parallel test run.  This makes the parallel and
19893          non-parallel testing behaviour more similar, and I think is clearer
19894          than the current 'Illegal Argument' error message.
19895
19896         Points (1) and (2) will be handled by moving the post processing steps
19897         inside an if block within the recipe.  For check-single I propose
19898         deleting the gdb.sum and gdb.log files before running DejaGnu, this is
19899         similar (I think) to how we delete the outputs/ directory in the
19900         check-parallel rule.
19901
19902         For point (3) I plan to split the check-single rule in two, the
19903         existing check-single will be renamed do-check-single, then a new
19904         check-single rule will be added.  The new check-single rule can either
19905         depend on the new do-check-single, or will ensure the 'No matching
19906         tests found' message is printed when appropriate.
19907
19908 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
19909
19910         gdb/disasm: better intel flavour disassembly styling with Pygments
19911         This commit was inspired by this stackoverflow post:
19912
19913           https://stackoverflow.com/questions/73491793/why-is-there-a-%C2%B1-in-lea-rax-rip-%C2%B1-0xeb3
19914
19915         One of the comments helpfully links to this Python test case:
19916
19917           from pygments import formatters, lexers, highlight
19918
19919           def colorize_disasm(content, gdbarch):
19920               try:
19921                   lexer = lexers.get_lexer_by_name("asm")
19922                   formatter = formatters.TerminalFormatter()
19923                   return highlight(content, lexer, formatter).rstrip().encode()
19924               except:
19925                   return None
19926
19927           print(colorize_disasm("lea [rip+0x211]  # COMMENT", None).decode())
19928
19929         Run the test case and you should see that the '+' character is
19930         underlined, and could be confused with a combined +/- symbol.
19931
19932         What's happening is that Pygments is failing to parse the input text,
19933         and the '+' is actually being marked in the error style.  The error
19934         style is red and underlined.
19935
19936         It is worth noting that the assembly instruction being disassembled
19937         here is an x86-64 instruction in the 'intel' disassembly style, rather
19938         than the default att style.  Clearly the Pygments module expects the
19939         att syntax by default.
19940
19941         If we change the test case to this:
19942
19943           from pygments import formatters, lexers, highlight
19944
19945           def colorize_disasm(content, gdbarch):
19946               try:
19947                   lexer = lexers.get_lexer_by_name("asm")
19948                   lexer.add_filter('raiseonerror')
19949                   formatter = formatters.TerminalFormatter()
19950                   return highlight(content, lexer, formatter).rstrip().encode()
19951               except:
19952                   return None
19953
19954           res = colorize_disasm("lea rax,[rip+0xeb3] # COMMENT", None)
19955           if res:
19956               print(res.decode())
19957           else:
19958               print("No result!")
19959
19960         Here I've added the call: lexer.add_filter('raiseonerror'), and I am
19961         now checking to see if the result is None or not.  Running this and
19962         the test now print 'No result!' - instead of styling the '+' in the
19963         error style, we instead give up on the styling attempt.
19964
19965         There are two things we need to fix relating to this disassembly
19966         text.  First, Pygments is expecting att style disassembly, not the
19967         intel style that this example uses.  Fortunately, Pygments also
19968         supports the intel style, all we need to do is use the 'nasm' lexer
19969         instead of the 'asm' lexer.
19970
19971         However, this leads to the second problem; in our disassembler line we
19972         have '# COMMENT'.  The "official" Intel disassembler style uses ';'
19973         for its comment character, however, gas and libopcodes use '#' as the
19974         comment character, as gas uses ';' for an instruction separator.
19975
19976         Unfortunately, Pygments expects ';' as the comment character, and
19977         treats '#' as an error, which means, with the addition of the
19978         'raiseonerror' filter, that any line containing a '#' comment, will
19979         not get styled correctly.
19980
19981         However, as the i386 disassembler never produces a '#' character other
19982         than for comments, we can easily "fix" Pygments parsing of the
19983         disassembly line.  This is done by creating a filter.  This filter
19984         looks for an Error token with the value '#', we then change this into
19985         a comment token.  Every token after this (until the end of the line)
19986         is also converted into a comment.
19987
19988         In this commit I do the following:
19989
19990           1. Check the 'disassembly-flavor' setting and select between the
19991           'asm' and 'nasm' lexers based on the setting.  If the setting is not
19992           available then the 'asm' lexer is used by default,
19993
19994           2. Use "add_filter('raiseonerror')" to ensure that the formatted
19995           output will not include any error text, which would be underlined,
19996           and might be confusing,
19997
19998           3. If the 'nasm' lexer is selected, then add an additional filter
19999           that will format '#' and all other text on the line, as a comment,
20000           and
20001
20002           4. If Pygments throws an exception, instead of returning None,
20003           return the original, unmodified content.  This will mean that this
20004           one instruction is printed without styling, but GDB will continue to
20005           call into the Python code to style later instructions.
20006
20007         I haven't included a test specifically for the above error case,
20008         though I have manually check that the above case now styles
20009         correctly (with no underline).  The existing style tests check that
20010         the disassembler styling still works though, so I know I've not
20011         generally broken things.
20012
20013         One final thought I have after looking at this issue is that I wonder
20014         now if using Pygments for styling disassembly from every architecture
20015         is actually a good idea?
20016
20017         Clearly, the 'asm' lexer is OK with att style x86-64, but not OK with
20018         intel style x86-64, so who knows how well it will handle other random
20019         architectures?
20020
20021         When I first added this feature I tested it against some random
20022         RISC-V, ARM, and X86-64 (att style) code, and it seemed fine, but I
20023         never tried to make an exhaustive check of all instructions, so its
20024         quite possible that there are corner cases where things are styled
20025         incorrectly.
20026
20027         With the above changes I think that things should be a bit better
20028         now.  If a particular instruction doesn't parse correctly then our
20029         Pygments based styling code will just not style that one instruction.
20030         This is combined with the fact that many architectures are now moving
20031         to libopcodes based styling, which is much more reliable.
20032
20033         So, I think it is fine to keep using Pygments as a fallback mechanism
20034         for styling all architectures, even if we know it might not be perfect
20035         in all cases.
20036
20037 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20038
20039         gdb: improve disassembler styling when Pygments raises an exception
20040         While working on another issue relating to GDB's use of the Python
20041         Pygments package for disassembly styling I noticed an issue in the
20042         case where the Pygments package raises an exception.
20043
20044         The intention of the current code is that, should the Pygments package
20045         raise an exception, GDB will disable future attempts to call into the
20046         Pygments code.  This was intended to prevent repeated errors during
20047         disassembly if, for some reason, the Pygments code isn't working.
20048
20049         Since the Pygments based styling was added, GDB now supports
20050         disassembly styling using libopcodes, but this is only available for
20051         some architectures.  For architectures not covered by libopcodes
20052         Pygments is still the only option.
20053
20054         What I observed is that, if I disable the libopcodes styling, then
20055         setup GDB so that the Pygments based styling code will indicate an
20056         error (by returning None), GDB does, as expected, stop using the
20057         Pygments based styling.  However, the libopcodes based styling will
20058         instead be used, despite this feature having been disabled.
20059
20060         The problem is that the disassembler output is produced into a
20061         string_file buffer.  When we are using Pygments, this buffer is
20062         created without styling support.  However, when Pygments fails, we
20063         recreate the buffer with styling support.
20064
20065         The problem is that we should only recreate the buffer with styling
20066         support only if libopcodes styling is enabled.  This was an oversight
20067         in commit:
20068
20069           commit 4cbe4ca5da5cd7e1e6331ce11f024bf3c07b9744
20070           Date:   Mon Feb 14 14:40:52 2022 +0000
20071
20072               gdb: add support for disassembler styling using libopcodes
20073
20074         This commit:
20075
20076           1. Factors out some of the condition checking logic into two new
20077           helper functions use_ext_lang_for_styling and
20078           use_libopcodes_for_styling,
20079
20080           2. Reorders gdb_disassembler::m_buffer and gdb_disassembler::m_dest,
20081           this allows these fields to be initialised m_dest first, which means
20082           that the new condition checking functions can rely on m_dest being
20083           set, even when called from the gdb_disassembler constructor,
20084
20085           3. Make use of the new condition checking functions each time
20086           m_buffer is initialised,
20087
20088           4. Add a new test that forces the Python disassembler styling
20089           function to return None, this will cause GDB to disable use of
20090           Pygments for styling, and
20091
20092           5. When we reinitialise m_buffer, and re-disassemble the
20093           instruction, call reset the in-comment flag.  If the instruction
20094           being disassembler ends in a comment then the first disassembly pass
20095           will have set the in-comment flag to true.  This shouldn't be a
20096           problem as we will only be using Pygments, and thus performing a
20097           re-disassembly pass, if libopcodes is disabled, so the in-comment
20098           flag will never be checked, even if it is set incorrectly.  However,
20099           I think that having the flag set correctly is a good thing, even if
20100           we don't check it (you never know what future uses might come up).
20101
20102 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20103
20104         gdb/testsuite: extend styling test for libopcodes styling
20105         This commit extends the gdb.base/style.exp test to cover disassembler
20106         styling using libopcodes (where available).
20107
20108         The test will try to enable libopcode based styling, if this
20109         works (because such styling is available) then some tests are run to
20110         check that the output is styled, and that the styling can be disabled
20111         using 'set style disassembler enabled off'.  If libopcodes styling is
20112         not available on the current architecture then these new tests will be
20113         skipped.
20114
20115         I've moved the Python Pygments module check inside the
20116         test_disable_disassembler_styling function now, so that the test will
20117         be run even when Python Pygments is not available, this allows the new
20118         tests discussed above.
20119
20120         If the Pygments module is not available then the Pygments based tests
20121         will be skipped just as they were before.
20122
20123 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20124
20125         gdb: update now gdbarch_register_name doesn't return nullptr
20126         After the previous few commit, gdbarch_register_name no longer returns
20127         nullptr.  This commit audits all the calls to gdbarch_register_name
20128         and removes any code that checks the result against nullptr.
20129
20130         There should be no visible change after this commit.
20131
20132 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20133
20134         gdb: final cleanup of various gdbarch_register_name methods
20135         Building on the previous commits, this commit goes through the various
20136         gdbarch_register_name methods and removes all the remaining 'return
20137         NULL' cases, I claim that these either couldn't be hit, or should be
20138         returning the empty string.
20139
20140         In all cases the return of NULL was used if the register number being
20141         passed to gdbarch_register_name was "invalid", i.e. negative, or
20142         greater than the total number of declared registers.  I don't believe
20143         either of these cases can occur, and the previous commit asserts that
20144         this is the case.  As a result we can simplify the code by removing
20145         these checks.  In many cases, where the register names are held in an
20146         array, I was able to add a static assert that the array contains the
20147         correct number of strings, after that, a direct access into the array
20148         is fine.
20149
20150         I don't have any means of testing these changes.
20151
20152 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20153
20154         gdb/csky: remove nullptr return from csky_pseudo_register_name
20155         Building on the previous commits, in this commit I remove two
20156         instances of 'return NULL' from csky_pseudo_register_name, and replace
20157         them with a return of the empty string.
20158
20159         These two are particularly interesting, and worth pulling into their
20160         own commit, because these returns of NULL appear to be depended on
20161         within other parts of the csky code.
20162
20163         In csky-linux-tdep.c in the register collect/supply code, GDB checks
20164         for the register name being nullptr in order to decide if a target
20165         supports a particular feature or not.  I've updated the code to check
20166         for the empty string.
20167
20168         I have no way of testing this change.
20169
20170 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20171
20172         gdb: add asserts to gdbarch_register_name
20173         This commit adds asserts to gdbarch_register_name that validate the
20174         parameters, and the return value.
20175
20176         The interesting thing here is that gdbarch_register_name is generated
20177         by gdbarch.py, and so, to add these asserts, I need to update the
20178         generation script.
20179
20180         I've added two new arguments for Functions and Methods (as declared in
20181         gdbarch-components.py), these arguments are 'param_checks' and
20182         'result_checks'.  Each of these new arguments can be used to list some
20183         expressions that are then used within gdb_assert calls in the
20184         generated code.
20185
20186         The asserts that validate the API as described in the comment I added
20187         to gdbarch_register_name a few commits back; the register number
20188         passed in needs to be a valid cooked register number, and the result
20189         being returned should not be nullptr.
20190
20191 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20192
20193         gdb: check for duplicate register names in selftest
20194         Building on the previous commit, this commit extends the register_name
20195         selftest to check for duplicate register names.
20196
20197         If two registers in the cooked register set (real + pseudo registers)
20198         have the same name, then this will show up as duplicate registers in
20199         the 'info all-registers' output, but the user will only be able to
20200         interact with one copy of the register.
20201
20202         In this commit I extend the selftest that I added in the previous
20203         commit to check for duplicate register names, I didn't include this
20204         functionality in the previous commit because one architecture needed
20205         fixing, and I wanted to keep those fixes separate from the fixes in
20206         the previous commit.
20207
20208         The problematic architecture(s) are powerpc:750 and powerpc:604.  In
20209         both of these cases the 'dabr' register appears twice, there's a
20210         definition of dabr in power-oea.xml which is included into both
20211         powerpc-604.xml and powerpc-750.xml.  Both of these later two xml
20212         files also define the dabr register.
20213
20214         I'm hopeful that this change shouldn't break anything, but I don't
20215         have the ability to actually test this change, however:
20216
20217         On the gdbserver side, neither powerpc-604.xml nor powerpc-750.xml are
20218         mentioned in gdbserver/configure.srv, which I think means that
20219         gdbserver will never use these descriptions, and,
20220
20221         Within GDB the problematic descriptions are held in the variables
20222         tdesc_powerpc_604 and tdesc_powerpc_750, which are only mentioned in
20223         the variants array in rs6000-tdep.c, this is used when looking up a
20224         description based on the architecture.
20225
20226         For a native Linux target however, this will not be used as
20227         ppc_linux_nat_target::read_description exists, which calls
20228         ppc_linux_match_description, which I don't believe can return either
20229         of the problematic descriptions.
20230
20231         This leaves the other native targets, FreeBSD, AIX, etc.  These don't
20232         appear to override the ::read_description method, so will potentially
20233         return the problematic descriptions, but, in each case I think the
20234         ::fetch_registers and ::store_registers methods will ignore the dabr
20235         register, which will leave the register as <unavailable>.
20236
20237         So, my proposed solution is to just remove the duplicate register from
20238         each of powerpc-604.xml and powerpc-750.xml, then regenerate the
20239         corresponding C++ source file.  With this change made, the selftest
20240         now passes for all architectures.
20241
20242 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20243
20244         gdb: add a gdbarch_register_name self test, and fix some architectures
20245         This commit adds a self-test that checks that gdbarch_register_name
20246         never returns nullptr for any valid register number.
20247
20248         Most architectures already met this requirement, there were just 6
20249         that failed the new selftest, and are updated in this commit.
20250
20251         Beyond the self-tests I don't have any facilities to test that the
20252         architectures I've adjusted still work correctly.
20253
20254         If you review all the various gdbarch_register_name implementations
20255         then you will see that there are far more architectures that seem like
20256         they might return nullptr in some situations, e.g. alpha, avr, bpf,
20257         etc.  This commit doesn't attempt to address these cases as non of
20258         them are hit during the selftest.  Many of these cases can never be
20259         hit, for example, in alpha_register_name GDB checks for a register
20260         number less than zero, this case can't happen and could be changed
20261         into an assert.
20262
20263         A later commit in this series will have a general cleanup of all the
20264         various register_name methods, and remove all references to NULL from
20265         their code, however, as that commit will be mostly adjusting code that
20266         is never hit, I want to keep those changes separate.
20267
20268         The selftest has been tested on x86-64, but I don't have access to
20269         suitable systems to fully test any of the *-tdep.c code I've changed
20270         in this commit.
20271
20272 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20273
20274         gdb/gdbarch: add a comment to gdbarch_register_name
20275         After the previous commit, this commit sets out to formalise the API
20276         for gdbarch_register_name.  Not every architecture is actually in
20277         compliance with the API I set out here, but I believe that most are.
20278
20279         I think architectures that don't comply with the API laid out here
20280         will fail the gdb.base/completion.exp test.
20281
20282         The claims in the comment are I feel, best demonstrated with the
20283         asserts in this code:
20284
20285           const char *
20286           gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
20287           {
20288             gdb_assert (regnr >= 0);
20289             gdb_assert (regnr < gdbarch_num_cooked_regs (gdbarch));
20290
20291             const char *name = gdbarch->register_name (gdbarch, regnr);
20292
20293             gdb_assert (name != nullptr);
20294
20295             return name;
20296           }
20297
20298         Like I said, I don't believe every architecture follows these rules
20299         right now, which is why I'm not actually adding any asserts.  Instead,
20300         this commit adds a comment to gdbarch_register_name, this comment is
20301         where I'd like to get to, rather than where we are right now.
20302
20303         Subsequent commits will fix all targets to be in compliance with this
20304         comment, and will even add the asserts shown above to
20305         gdbarch_register_name.
20306
20307 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20308
20309         gdb/riscv: fix failure in gdb.base/completion.exp
20310         I noticed a test failure in gdb.base/completion.exp for RISC-V on
20311         a native Linux target, this is the failure:
20312
20313           (gdb) FAIL: gdb.base/completion.exp: complete 'info registers '
20314
20315         The problem is caused by a mismatch in the output of 'maint print
20316         registers' and the completion list for 'info registers'.  The 'info
20317         registers' completion list contains less registers than
20318         expected. Additionally, the list of registers extracted from the
20319         'maint print registers' list was wrong too, in some cases the test was
20320         grabbing the register number, rather than a register name,
20321
20322         Both of these problems have the same root cause, riscv_register_name
20323         returns nullptr for some registers when it should return an empty
20324         string.
20325
20326         The gdbarch_register_name API is not clearly documented anywhere, and
20327         at first glance it would appear that the function can return either
20328         nullptr, or an empty string to indicate that a register is not
20329         available on the current target.  Indeed, there are plenty of places
20330         in GDB where we compare the output of gdbarch_register_name to both
20331         nullptr and '\0' in order to see if a register is supported or not,
20332         and there are plenty of targets that return empty string in some
20333         cases, and nullptr in others.
20334
20335         However, the 'info registers' completion code (reg_or_group_completer)
20336         clearly depends on user_reg_map_regnum_to_name only returning nullptr
20337         when the passed in regnum is greater than the maximum possible
20338         register number (i.e. after all physical registers, pseudo-registers,
20339         and user-registers), this means that gdbarch_register_name should not
20340         be returning nullptr.
20341
20342         I did consider "fixing" user_reg_map_regnum_to_name, if
20343         gdbarch_register_name returns nullptr, I could convert to an empty
20344         string at this point, but that felt like a real hack, so I discarded
20345         that plan.
20346
20347         The next possibility I considered was "fixing" reg_or_group_completer
20348         to not rely on nullptr to indicate the end marker.  Or rather, I could
20349         have reg_or_group_completer use gdbarch_num_cooked_regs, we know that
20350         we should check at least that many register numbers.  Then, once we're
20351         passed that limit, we keep checking until we hit a nullptr.  This
20352         would absolutely work, and didn't actually feel that bad, but, it
20353         still felt a little weird that gdbarch_register_name could return
20354         nullptr OR the empty string to mean the same thing, so I wondered if
20355         the "right" solution was to have gdbarch_register_name not return
20356         nullptr.  With this in mind I tried an experiment:
20357
20358         I added a self-test that, for each architecture, calls
20359         gdbarch_register_name for every register number up to the
20360         gdbarch_num_cooked_regs limit, and checks that the name is not
20361         nullptr.
20362
20363         Only a handful of architectures failed this test, RISC-V being one of
20364         them.
20365
20366         This seems to suggest that most architectures agree that the correct
20367         API for gdbarch_register_name is to return an empty string for
20368         registers that are not supported on the current target, and that
20369         returning nullptr is really a mistake.
20370
20371         In this commit I will update the RISC-V target so that GDB no longer
20372         returns nullptr from riscv_register_name, instead we return the empty
20373         string.
20374
20375         In subsequent commits I will add the selftest that I mention above,
20376         and will fix the targets that fail the selftest.
20377
20378         With this change the gdb.base/completion.exp test now passes.
20379
20380 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20381
20382         gdb/testsuite: rewrite capture_command_output proc
20383         I noticed a test failure in gdb.base/completion.exp for RISC-V on a
20384         native Linux target.  Upon investigation I discovered a couple of
20385         reasons for the failure, this commit addresses one of them.  A later
20386         commit will address the other issue.
20387
20388         The completion.exp test makes use of the capture_command_output proc
20389         to collect the output of the 'maint print registers' command.  For
20390         RISC-V this command produces a lot of output.
20391
20392         Currently the capture_command_output proc tries to collect the
20393         complete command output in a single expect buffer, and what I see is
20394         an error caused by the expect buffer becoming full.
20395
20396         This commit rewrites capture_command_output to make use of
20397         gdb_test_multiple to collect the command output line at a time, in
20398         this way we avoid overflowing the expect buffer.
20399
20400         The capture_command_output proc has some logic for skipping a prefix
20401         pattern, which is passed in to the proc as an argument.  In order to
20402         handle this correctly (only matching the prefix at the start of the
20403         command output), I use two gdb_test_multiple calls, the first spots
20404         and discards the echoed command and the (optional) prefix pattern, the
20405         second gdb_test_multiple call then collects the rest of the command
20406         output line at a time until a prompt is seen.
20407
20408         There is one slight oddity with the current implementation, which I
20409         have changed in my rewrite, this does, slightly, change the behaviour
20410         of the proc.
20411
20412         The current implementation uses this pattern:
20413
20414           -re "[string_to_regexp ${command}]\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $"
20415
20416         Now a typical command output will look like this:
20417
20418           output here\r\n
20419           (gdb)
20420
20421         As the TCL regexp matching is greedy, TCL will try to match as much as
20422         possible in one part of the pattern before moving on to the next.
20423         Thus, when this matches against (.*)[\r\n]+, the (.*) will end up
20424         matching against 'output here\r' and the [\r\n]+ will match '\n' only.
20425
20426         In short the previous implementation would leave the '\r' on the end
20427         of the returned text, but not the final trailing '\n'.
20428
20429         Now clearly I could make a new version of capture_command_output that
20430         maintained this behaviour, but I couldn't see any reason to do this.
20431         So, my new implementation drops the final '\r\n' completely, in our
20432         example above we now return 'output here' with no '\r'.
20433
20434         This change doesn't seem to affect any of the existing tests, but I
20435         thought it was worth mentioning.
20436
20437 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20438
20439         gdb/mi: new options for -data-disassemble command
20440         Now that the disassembler has two different strategies for laying out
20441         the opcode bytes of an instruction (see /r vs /b for the disassemble
20442         command), I wanted to add support for this to the MI disassemble
20443         command.
20444
20445         Currently the -data-disassemble command takes a single 'mode' value,
20446         which currently has 6 different values (0 -> 5), 3 of these modes
20447         relate to opcode display.
20448
20449         So, clearly I should just add an additional 3 modes to handle the new
20450         opcode format, right?
20451
20452         No, I didn't think that was a great idea either.
20453
20454         So, I wonder, could I adjust the -data-disassemble command in a
20455         backward compatible way, that would allow GDB to move away from using
20456         the mode value altogether?
20457
20458         I think we can.
20459
20460         In this commit, I propose adding two new options to -data-disassemble,
20461         these are:
20462
20463           --opcodes none|bytes|display
20464           --source
20465
20466         Additionally, I will make the mode optional, and default to mode 0 if
20467         no mode value is given.  Mode 0 is the simplest, no source code, no
20468         opcodes disassembly mode.
20469
20470         The two new options are only valid for mode 0, if they are used with
20471         any other mode then an error is thrown.
20472
20473         The --opcodes option can add opcodes to the result, with 'bytes' being
20474         equivalent to 'disassemble /b' and 'display' being 'disassemble /r'.
20475
20476         The --source option will enable the /s style source code display, this
20477         is equivalent to modes 4 and 5.  There is no way, using the new
20478         command options to get the now deprecated /m style source code
20479         display, that is mode 1 and 3.
20480
20481         My hope is that new users of the MI will not use the mode at all, and
20482         instead will just use the new options to achieve the output they need.
20483         Existing MI users can continue to use the mode, and will not need to
20484         be updated to use the new options.
20485
20486 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20487
20488         gdb/mi: some int to bool conversion
20489         Just some simple int to bool conversion in mi_cmd_disassemble.  There
20490         should be no user visible changes after this commit.
20491
20492 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20493
20494         gdb/doc: update syntax of -data-disassemble command arguments
20495         The argument documentation for -data-disassemble looks like this:
20496
20497            -data-disassemble
20498               [ -s @var{start-addr} -e @var{end-addr} ]
20499             | [ -a @var{addr} ]
20500             | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
20501             -- @var{mode}
20502
20503         However, I believe, according to the 'Notation and Terminology'
20504         section, this means that the there are 3 optional location
20505         specification argument groups for the command, followed by a
20506         non-optional '-- mode'.
20507
20508         However, this is not true, one of the location specifications must be
20509         given, i.e. we can't choose to give NO location specification, which
20510         is what the above implies.
20511
20512         I propose that we change this to instead be:
20513
20514            -data-disassemble
20515             ( -s @var{start-addr} -e @var{end-addr}
20516             | -a @var{addr}
20517             | -f @var{filename} -l @var{linenum} [ -n @var{lines} ] )
20518             -- @var{mode}
20519
20520         By placing all the location specifications within '( ... )' we
20521         indication that these are a group, from which one of the options,
20522         separated by '|', must be selected.
20523
20524         However, the 'Notation and Terminology' section only describes two
20525         uses for parenthesis: '( GROUP )*' and '( GROUP )+', in the first case
20526         GROUP is repeated zero or more times, and in the second GROUP is
20527         repeated 1 or more times.
20528
20529         Neither of those exactly describe what I want, which is GROUP must
20530         appear exactly once.  I propose to extend 'Notation and Terminology'
20531         to include '( GROUP )' which means that GROUP should appear exactly
20532         once.
20533
20534         This change is important because, in a later commit, I want to add
20535         additional optional arguments to the -data-disassemble command, and
20536         things start to get confusing with the original syntax.
20537
20538 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20539
20540         gdb: make gdb_disassembly_flag unsigned
20541         In a later commit I want to use operator~ on a gdb_disassembly_flag
20542         flag value.  This is currently not possible as gdb_disassembly_flag
20543         is, by default, signed.
20544
20545         This commit just makes this enum unsigned.
20546
20547         There should be no user visible changes after this commit.
20548
20549 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20550
20551         gdb: disassembler opcode display formatting
20552         This commit changes the format of 'disassemble /r' to match GNU
20553         objdump.  Specifically, GDB will now display the instruction bytes in
20554         as 'objdump --wide --disassemble' does.
20555
20556         Here is an example for RISC-V before this patch:
20557
20558           (gdb) disassemble /r 0x0001018e,0x0001019e
20559           Dump of assembler code from 0x1018e to 0x1019e:
20560              0x0001018e <call_me+66>:     03 26 84 fe     lw      a2,-24(s0)
20561              0x00010192 <call_me+70>:     83 25 c4 fe     lw      a1,-20(s0)
20562              0x00010196 <call_me+74>:     61 65   lui     a0,0x18
20563              0x00010198 <call_me+76>:     13 05 85 6a     addi    a0,a0,1704
20564              0x0001019c <call_me+80>:     f1 22   jal     0x10368 <printf>
20565           End of assembler dump.
20566
20567         And here's an example after this patch:
20568
20569           (gdb) disassemble /r 0x0001018e,0x0001019e
20570           Dump of assembler code from 0x1018e to 0x1019e:
20571              0x0001018e <call_me+66>:     fe842603                lw      a2,-24(s0)
20572              0x00010192 <call_me+70>:     fec42583                lw      a1,-20(s0)
20573              0x00010196 <call_me+74>:     6561                    lui     a0,0x18
20574              0x00010198 <call_me+76>:     6a850513                addi    a0,a0,1704
20575              0x0001019c <call_me+80>:     22f1                    jal     0x10368 <printf>
20576           End of assembler dump.
20577
20578         There are two differences here.  First, the instruction bytes after
20579         the patch are grouped based on the size of the instruction, and are
20580         byte-swapped to little-endian order.
20581
20582         Second, after the patch, GDB now uses the bytes-per-line hint from
20583         libopcodes to add whitespace padding after the opcode bytes, this
20584         means that in most cases the instructions are nicely aligned.
20585
20586         It is still possible for a very long instruction to intrude into the
20587         disassembled text space.  The next example is x86-64, before the
20588         patch:
20589
20590           (gdb) disassemble /r main
20591           Dump of assembler code for function main:
20592              0x0000000000401106 <+0>:     55      push   %rbp
20593              0x0000000000401107 <+1>:     48 89 e5        mov    %rsp,%rbp
20594              0x000000000040110a <+4>:     c7 87 d8 00 00 00 01 00 00 00   movl   $0x1,0xd8(%rdi)
20595              0x0000000000401114 <+14>:    b8 00 00 00 00  mov    $0x0,%eax
20596              0x0000000000401119 <+19>:    5d      pop    %rbp
20597              0x000000000040111a <+20>:    c3      ret
20598           End of assembler dump.
20599
20600         And after the patch:
20601
20602           (gdb) disassemble /r main
20603           Dump of assembler code for function main:
20604              0x0000000000401106 <+0>:     55                      push   %rbp
20605              0x0000000000401107 <+1>:     48 89 e5                mov    %rsp,%rbp
20606              0x000000000040110a <+4>:     c7 87 d8 00 00 00 01 00 00 00   movl   $0x1,0xd8(%rdi)
20607              0x0000000000401114 <+14>:    b8 00 00 00 00          mov    $0x0,%eax
20608              0x0000000000401119 <+19>:    5d                      pop    %rbp
20609              0x000000000040111a <+20>:    c3                      ret
20610           End of assembler dump.
20611
20612         Most instructions are aligned, except for the very long instruction.
20613         Notice too that for x86-64 libopcodes doesn't request that GDB group
20614         the instruction bytes.  This matches the behaviour of objdump.
20615
20616         In case the user really wants the old behaviour, I have added a new
20617         modifier 'disassemble /b', this displays the instruction byte at a
20618         time.  For x86-64, which never groups instruction bytes, /b and /r are
20619         equivalent, but for RISC-V, using /b gets the old layout back (except
20620         that the whitespace for alignment is still present).  Consider our
20621         original RISC-V example, this time using /b:
20622
20623           (gdb) disassemble /b 0x0001018e,0x0001019e
20624           Dump of assembler code from 0x1018e to 0x1019e:
20625              0x0001018e <call_me+66>:     03 26 84 fe             lw      a2,-24(s0)
20626              0x00010192 <call_me+70>:     83 25 c4 fe             lw      a1,-20(s0)
20627              0x00010196 <call_me+74>:     61 65                   lui     a0,0x18
20628              0x00010198 <call_me+76>:     13 05 85 6a             addi    a0,a0,1704
20629              0x0001019c <call_me+80>:     f1 22                   jal     0x10368 <printf>
20630           End of assembler dump.
20631
20632         Obviously, this patch is a potentially significant change to the
20633         behaviour or /r.  I could have added /b with the new behaviour and
20634         left /r alone.  However, personally, I feel the new behaviour is
20635         significantly better than the old, hence, I made /r be what I consider
20636         the "better" behaviour.
20637
20638         The reason I prefer the new behaviour is that, when I use /r, I almost
20639         always want to manually decode the instruction for some reason, and
20640         having the bytes displayed in "instruction order" rather than memory
20641         order, just makes this easier.
20642
20643         The 'record instruction-history' command also takes a /r modifier, and
20644         has been modified in the same way as disassemble; /r gets the new
20645         behaviour, and /b has been added to retain the old behaviour.
20646
20647         Finally, the MI command -data-disassemble, is unchanged in behaviour,
20648         this command now requests the raw bytes of the instruction, which is
20649         equivalent to the /b modifier.  This means that the MI output will
20650         remain backward compatible.
20651
20652 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20653
20654         gdb/disasm: read opcodes bytes with a single read_code call
20655         This commit reduces the number of times we call read_code when
20656         printing the instruction opcode bytes during disassembly.
20657
20658         I've added a new gdb::byte_vector within the
20659         gdb_pretty_print_disassembler class, in line with all the other
20660         buffers that gdb_pretty_print_disassembler needs.  This byte_vector is
20661         then resized as needed, and filled with a single read_code call for
20662         each instruction.
20663
20664         There should be no user visible changes after this commit.
20665
20666 2022-10-02  Andrew Burgess  <aburgess@redhat.com>
20667
20668         gdb/testsuite: new test for -data-disassemble opcodes format
20669         Add another test for the output of MI command -data-disassemble.  The
20670         new check validates the format of the 'opcodes' field, specifically,
20671         this test checks that the field contains a series of bytes, separated
20672         by a single space.
20673
20674         We also check that the bytes are in the correct order, that is, the
20675         first byte is from the lowest address, and subsequent bytes are from
20676         increasing addresses.
20677
20678         The motivation for this test (besides more tests being generally good)
20679         is that I plan to make changes to how opcode bytes are displayed in
20680         the disassembler output, and I want to ensure that I don't break any
20681         existing MI behaviour.
20682
20683         There should be no user visible changes to GDB after this commit.
20684
20685 2022-10-02  GDB Administrator  <gdbadmin@sourceware.org>
20686
20687         Automatic date update in version.in
20688
20689 2022-10-01  GDB Administrator  <gdbadmin@sourceware.org>
20690
20691         Automatic date update in version.in
20692
20693 2022-09-30  Tsukasa OI  <research_trasio@irq.a4lg.com>
20694
20695         RISC-V: Relax "fmv.[sdq]" requirements
20696         This commit relaxes requirements to "fmv.s" instructions from 'F' to ('F'
20697         or 'Zfinx').  The same applies to "fmv.d" and "fmv.q".  Note that 'Zhinx'
20698         extension already contains "fmv.h" instruction (as well as 'Zfh').
20699
20700         gas/ChangeLog:
20701
20702                 * testsuite/gas/riscv/zfinx.s: Add "fmv.s" instruction.
20703                 * testsuite/gas/riscv/zfinx.d: Likewise.
20704                 * testsuite/gas/riscv/zdinx.s: Add "fmv.d" instruction.
20705                 * testsuite/gas/riscv/zdinx.d: Likewise.
20706                 * testsuite/gas/riscv/zqinx.d: Add "fmv.q" instruction.
20707                 * testsuite/gas/riscv/zqinx.s: Likewise.
20708
20709         opcodes/ChangeLog:
20710
20711                 * riscv-opc.c (riscv_opcodes): Relax requirements to "fmv.[sdq]"
20712                 instructions to support those in 'Zfinx'/'Zdinx'/'Zqinx'.
20713
20714 2022-09-30  Tsukasa OI  <research_trasio@irq.a4lg.com>
20715
20716         RISC-V: Reorganize and enhance 'Zfinx' tests
20717         This commit adds certain test cases for 'Zfinx'/'Zdinx'/'Zqinx' extensions
20718         and reorganizes them, fixing coding style while improving coverage.
20719         This is partially based on jiawei's 'Zhinx' testcases.
20720
20721         gas/ChangeLog:
20722
20723                 * testsuite/gas/riscv/zfinx.s: Use different registers for
20724                 better encode space testing.  Make indentation consistent.
20725                 Add tests for instruction with rounding mode.  Change march
20726                 to minimum required extensions.  Remove source line.
20727                 * testsuite/gas/riscv/zfinx.d: Likewise.
20728                 * testsuite/gas/riscv/zdinx.s: Likewise.
20729                 * testsuite/gas/riscv/zdinx.d: Likewise.
20730                 * testsuite/gas/riscv/zqinx.s: Likewise.
20731                 Also use even-numbered registers to use valid register pairs.
20732                 * testsuite/gas/riscv/zqinx.d: Likewise.
20733
20734 2022-09-30  Christoph Müllner  <christoph.muellner@vrull.eu>
20735
20736         RISC-V: Eliminate long-casts of X_add_number in diagnostics
20737         There is no need for casts to (signed/unsigned) long, as we can use
20738         C99's PRId64/PRIu64 format specifiers.
20739
20740 2022-09-30  Jan Beulich  <jbeulich@suse.com>
20741
20742         RISC-V: fallout from "re-arrange opcode table for consistent alias handling"
20743         Several new testcasee have appeared since the submission of said change,
20744         some of which now also need adjustment.
20745
20746         RISC-V: fix build after "Add support for arbitrary immediate encoding formats"
20747         Pre- and post-increment/decrement are side effects, the behavior of
20748         which is undefined when combined with passing an address of the accessed
20749         variable in the same function invocation. There's no need for the
20750         increments here - simply adding 1 achieves the intended effect without
20751         triggering compiler diagnostics (which are fatal with -Werror).
20752
20753         objcopy: avoid "shadowing" of remove() function name
20754         remove() is a standard library function (declared in stdio.h), which
20755         triggers a "shadows a global declaration" warning with some gcc versions.
20756
20757         RISC-V: drop stray INSN_ALIAS flags
20758         FENCE.TSO isn't an alias. ZIP and UNZIP in the long run likely are, but
20759         presently they aren't. This fixes disassembly of these insns with
20760         -Mno-aliases.
20761
20762 2022-09-30  Jan Beulich  <jbeulich@suse.com>
20763
20764         RISC-V: re-arrange opcode table for consistent alias handling
20765         For disassembly to pick up aliases in favor of underlying insns (helping
20766         readability in the common case), the aliases need to come ahead of the
20767         "base" insns. Slightly more code movement is needed because of insns
20768         with the same name needing to stay next to each other.
20769
20770         Note that the "rorw" alias entry also has the missing INSN_ALIAS added
20771         here.
20772
20773         Clone a few testcases to exercise -Mno-aliases some more, better
20774         covering the differences between the default and that disassembly mode.
20775
20776 2022-09-30  Jan Beulich  <jbeulich@suse.com>
20777
20778         x86: correct build dependencies in opcodes/
20779         With the command in the rule merely being "echo", i386-tbl.h won't be
20780         rebuilt if missing, when at the same time i386-init.h is present and
20781         up-to-date. Use a pattern rule instead to express the multiple targets
20782         correctly (the &: rule separator is supported only by GNU make 4.3 and
20783         newer). Note that now, for the opposite case to work (i386-tbl.h is
20784         up-to-date but i386-init.h is missing), i386-init.h also needs
20785         mentioning as a dependency somewhere: Add a fake dependency for
20786         i386-opc.lo ("fake" because i386-opc.c doesn't include that header).
20787
20788         At the same time use $(AM_V_GEN) in the actual rule, replacing the
20789         earlier (open-coded) "echo". And while there also drop a duplicate
20790         dependency of i386-gen.o on i386-opc.h.
20791
20792 2022-09-30  Jan Beulich  <jbeulich@suse.com>
20793
20794         x86: improve match_template()'s diagnostics
20795         At the example of
20796
20797                 extractps $0, %xmm0, %xmm0
20798                 insertps $0, %xmm0, %eax
20799
20800         (both having respectively the same mistake of using the wrong kind of
20801         destination register) it is easy to see that current behavior is far
20802         from ideal: The former results in "unsupported instruction" for 32-bit
20803         code simply because the 2nd template we have is a Cpu64 one. Instead we
20804         should aim at emitting the "best" possible error, which will typically
20805         be the one where we passed the largest number of checks. Generalize the
20806         original "specific_error" approach by making it apply to the entire
20807         matching loop, utilizing that line numbers increase as we pass further
20808         checks.
20809
20810 2022-09-30  Jan Beulich  <jbeulich@suse.com>
20811
20812         x86/Intel: restrict suffix derivation
20813         While in some cases deriving an AT&T-style suffix from an Intel syntax
20814         memory operand size specifier is necessary, in many cases this is not
20815         only pointless, but has led to the introduction of various workarounds:
20816         Excessive use of IgnoreSize and NoRex64 as well as the ToDword and
20817         ToQword attributes. Suppress suffix derivation when we can clearly tell
20818         that the memory operand's size isn't going to be needed to infer the
20819         possible need for the low byte/word opcode bit or an operand size prefix
20820         (0x66 or REX.W).
20821
20822         As a result ToDword and ToQword can be dropped entirely, plus a fair
20823         number of IgnoreSize and NoRex64 can also be got rid of. Note that
20824         IgnoreSize needs to remain on legacy encoded SIMD insns with GPR
20825         operand, to avoid emitting an operand size prefix in 16-bit mode. (Since
20826         16-bit code using SIMD insns isn't well tested, clone an existing
20827         testcase just enough to cover a few insns which are potentially
20828         problematic but are being touched here.)
20829
20830         Note that while folding the VCVT{,T}S{S,D}2SI templates, VCVT{,T}SH2SI
20831         isn't included there. This is to fulfill the request of not allowing L
20832         and Q suffixes there, despite the inconsistency with VCVT{,T}S{S,D}2SI.
20833
20834 2022-09-30  liuzhensong  <liuzhensong@loongson.cn>
20835
20836         LoongArch: Update ELF e_flags handling according to specification.
20837           Update handling of e_flags according to the documentation
20838           update [1] (discussions [2][3]).
20839
20840           Object file bitness is now represented in the EI_CLASS byte.
20841           The e_flags field is now interpreted as follows:
20842
20843           e_flags[2:0]: Base ABI modifier
20844
20845           - 0x1: soft-float
20846           - 0x2: single-precision hard-float
20847           - 0x3: double-precision hard-float
20848
20849           e_flags[7:6]: ELF object ABI version
20850
20851           - 0x0: v0
20852           - 0x1: v1
20853
20854           [1]: https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-ELF-ABI-EN.adoc#e_flags-identifies-abi-type-and-version
20855           [2]: https://github.com/loongson/LoongArch-Documentation/pull/61
20856           [3]: https://github.com/loongson/LoongArch-Documentation/pull/47
20857
20858 2022-09-30  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
20859
20860         gprofng: fix cppcheck warnings
20861         gprofng/ChangeLog
20862         2022-09-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
20863
20864                 * common/hwcdrv.c: Fix cppcheck warning.
20865                 * src/ABS.h: Likewise.
20866                 * src/CompCom.cc: Likewise.
20867
20868 2022-09-30  Tom de Vries  <tdevries@suse.de>
20869
20870         [gdb/testsuite] Fix gdb.mi/mi-sym-info.exp on openSUSE Tumbleweed
20871         On openSUSE Tumbleweed, I run into:
20872         ...
20873         FAIL: gdb.mi/mi-sym-info.exp: List all functions from debug information only
20874         ...
20875
20876         The problem is in matching this string:
20877         ...
20878         {name="_start",type="void (void)",description="void _start(void);"}
20879         ...
20880         using regexp fun_re, which requires a line field:
20881         ...
20882         set fun_re \
20883             "\{line=\"$decimal\",name=${qstr},type=${qstr},description=${qstr}\}"
20884         ...
20885
20886         Fix this by making the line field optional in fun_re.
20887
20888         Tested on x86_64-linux.
20889
20890 2022-09-30  Tsukasa OI  <research_trasio@irq.a4lg.com>
20891
20892         RISC-V: Add privileged extensions without instructions/CSRs
20893         Currently, GNU Binutils does not support following privileged extensions:
20894
20895         -   'Smepmp'
20896         -   'Svnapot'
20897         -   'Svpbmt'
20898
20899         as they do not provide new CSRs or new instructions ('Smepmp' extends the
20900         privileged architecture CSRs but does not define the CSR itself).  However,
20901         adding them might be useful as we no longer have to "filter" ISA strings
20902         just for toolchains (if full ISA string is given by a vendor, we can
20903         straightly use it).
20904
20905         And there's a fact that supports this theory: there's already an
20906         (unprivileged) extension which does not provide CSRs or instructions (but
20907         only an architectural guarantee): 'Zkt' (constant timing guarantee for
20908         certain subset of RISC-V instructions).
20909
20910         This simple commit simply adds three privileged extensions listed above.
20911
20912         bfd/ChangeLog:
20913
20914                 * elfxx-riscv.c (riscv_supported_std_s_ext): Add 'Smepmp',
20915                 'Svnapot' and 'Svpbmt' extensions.
20916
20917 2022-09-30  Tsukasa OI  <research_trasio@irq.a4lg.com>
20918
20919         gdb: Remove unused extra_lines variable
20920         Clang generates a warning if there is a variable that is set but not used
20921         otherwise ("-Wunused-but-set-variable").  On the default configuration, it
20922         causes a build failure (unless "--disable-werror" is specified).
20923
20924         The only extra_lines use in arrange_linetable function is removed on the
20925         commit 558802e4d1c5dcbd0df7d2c6ef62a6deac247a2f
20926         ("gdb: change subfile::line_vector to an std::vector").  So, this variable
20927         should be removed to prevent a build failure.
20928
20929 2022-09-30  Tom de Vries  <tdevries@suse.de>
20930
20931         [gdb/testsuite] Add aranges to gdb.dwarf2/dw2-dir-file-name.exp
20932         Since commit 52b920c5d20 ("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp
20933         for ppc64le"), the test-case fails with target board cc-with-debug-names, due
20934         to missing .debug_aranges info.
20935
20936         Add the missing .debug_aranges info.
20937
20938         Also add a file_id option to Dwarf::assemble, to make it possible to contribute
20939         to an already open file.
20940
20941         Tested on x86_64-linux.
20942
20943 2022-09-30  Tom de Vries  <tdevries@suse.de>
20944
20945         [gdb/c++] Print destructor the same for gcc and clang
20946         Consider the test-case contained in this patch.
20947
20948         With g++ (7.5.0) we have for "ptype A":
20949         ...
20950         type = class A {
20951           public:
20952             int a;
20953
20954             A(void);
20955             ~A();
20956         }
20957         ...
20958         and with clang++ (13.0.1):
20959         ...
20960         type = class A {
20961           public:
20962             int a;
20963
20964             A(void);
20965             ~A(void);
20966         }
20967         ...
20968         and we observe that the destructor is printed differently.
20969
20970         There's a difference in debug info between the two cases: in the clang case,
20971         there's one artificial parameter, but in the g++ case, there are two, and
20972         these similar cases are handled differently in cp_type_print_method_args.
20973
20974         This is due to this slightly convoluted bit of code:
20975         ...
20976           i = staticp ? 0 : 1;
20977           if (nargs > i)
20978             {
20979               while (i < nargs)
20980                 ...
20981             }
20982           else if (varargs)
20983             gdb_printf (stream, "...");
20984           else if (language == language_cplus)
20985             gdb_printf (stream, "void");
20986         ...
20987
20988         The purpose of "i = staticp ? 0 : 1" is to skip the printing of the implicit
20989         this parameter.
20990
20991         In commit 5f4d1085085 ("c++/8218: Destructors w/arguments"), skipping of other
20992         artificial parameters was added, but using a different method: rather than
20993         adjusting the potential loop start, it skips the parameter in the loop.
20994
20995         The observed difference in printing is explained by whether we enter the loop:
20996         - in the clang case, the loop is not entered and we print "void".
20997         - in the gcc case, the loop is entered, and nothing is printed.
20998
20999         Fix this by rewriting the code to:
21000         - always enter the loop
21001         - handle whether arguments need printing in the loop
21002         - keep track of how many arguments are printed, and
21003           use that after the loop to print void etc.
21004         such that we have the same for both gcc and clang:
21005         ...
21006             A(void);
21007             ~A(void);
21008         ...
21009
21010         Note that I consider the discussion of whether we want to print:
21011         - A(void) / ~A(void), or
21012         - A() / ~A()
21013         out-of-scope for this patch.
21014
21015         Tested on x86_64-linux.
21016
21017 2022-09-30  Alan Modra  <amodra@gmail.com>
21018
21019         PR29626, Segfault when disassembling ARM code
21020                 PR 29626
21021                 * arm-dis.c (mapping_symbol_for_insn): Return false on zero
21022                 symtab_size.  Delete later symtab_size test.
21023
21024 2022-09-30  GDB Administrator  <gdbadmin@sourceware.org>
21025
21026         Automatic date update in version.in
21027
21028 2022-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
21029
21030         gdb: make target_auxv_parse static and rename
21031         It is only used in auxv.c.  Also, given it is not strictly a wrapper
21032         around target_ops::auxv (since 27a48a9223d0 "Add auxv parsing to the
21033         architecture vector."), I think that the name prefixed with target is a
21034         bit misleading.  Rename to just parse_auxv.
21035
21036         Change-Id: I41cca055b92c8ede37c258ba6583746a07d8f77e
21037
21038 2022-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
21039
21040         gdb: make fprint_target_auxv static
21041         It's only used in auxv.c.
21042
21043         Change-Id: I4992d9aae37b6631a074ab99bbab2f619725b642
21044
21045 2022-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
21046
21047         gdb: constify auxv parse functions
21048         Constify the input parameters of the various auxv parse functions, they
21049         don't need to modify the raw auxv data.
21050
21051         Change-Id: I13eacd5ab8e925ec2b5c1f7722cbab39c41516ec
21052
21053 2022-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
21054
21055         gdb: constify target_stack::is_pushed
21056         The target_ops parameters here can be made const.
21057
21058         Change-Id: Ibc18b17d6b21d06145251a03e68aca90538117d6
21059
21060 2022-09-29  Keith Seitz  <keiths@redhat.com>
21061
21062         Constify target_desc declarations
21063         This patch changes various global target_desc declarations to const, thereby
21064         correcting a prominent source of ODR violations in PowerPC-related target code.
21065         The majority of files/changes are mechanical const-ifications accomplished by
21066         regenerating the C files in features/.
21067
21068         This also required manually updating mips-linux-tdep.h,  s390-linux-tdep.h,
21069         nios2-tdep.h, s390-tdep.h, arch/ppc-linux-tdesc.h, arch/ppc-linux-common.c,
21070         and rs6000-tdep.c.
21071
21072         Patch tested against the sourceware trybot, and fully regression tested against
21073         our (Red Hat's) internal  test infrastructure on Rawhide aarch64, s390x, x86_64,
21074         and powerpcle.
21075
21076         With this patch, I can finally enable LTO in our GDB package builds. [Tested
21077         with a rawhide scratch build containing this patch.]
21078
21079         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
21080         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24835
21081
21082 2022-09-29  Keith Seitz  <keiths@redhat.com>
21083
21084         cleanup: Add missing feature/ XML files to Makefile
21085         This patch adds some missing .xml files to features/Makefile so that when the
21086         directory's C files are regenerated, all files are appropriately remade.
21087
21088         This has demonstrated that there have been several "misses" in regenerating
21089         files in this directory. Namely, arm-secext.c and sparc{32,64}-solaris.c. For
21090         the former case, there was what essentially amounts to a typo regarding the
21091         create feature function's name. In the later case, this file has missed at least
21092         one important update in July, 2020, when allocate_target_description was
21093         changed to return a unique pointer.
21094
21095         Those corrections are included.
21096
21097 2022-09-29  Nick Clifton  <nickc@redhat.com>
21098
21099         Add -B to the help output from gprof, and add suitable documentation.
21100                 PR 29627
21101                 * gprof.c (usage): Add -B.
21102                 * gprof.texi (synopsis): Add -B.
21103                 (Output Options): Add entry for -B.
21104
21105 2022-09-29  GDB Administrator  <gdbadmin@sourceware.org>
21106
21107         Automatic date update in version.in
21108
21109 2022-09-28  Pedro Alves  <pedro@palves.net>
21110
21111         Fix GDB build: ELF support check & -lzstd
21112         GDB fails to build for me, on Ubuntu 20.04.  I get:
21113
21114          ...
21115            CXXLD  gdb
21116          /usr/bin/ld: linux-tdep.o: in function `linux_corefile_thread(thread_info*, linux_corefile_thread_data*)':
21117          /home/pedro/gdb/binutils-gdb/src/gdb/linux-tdep.c:1831: undefined reference to `gcore_elf_build_thread_register_notes(gdbarch*, thread_info*, gdb_signal, bfd*, std::unique_ptr<char, gdb::xfree_deleter<char> >*, int*)'
21118          /usr/bin/ld: linux-tdep.o: in function `linux_make_corefile_notes(gdbarch*, bfd*, int*)':
21119          /home/pedro/gdb/binutils-gdb/src/gdb/linux-tdep.c:2117: undefined reference to `gcore_elf_make_tdesc_note(bfd*, std::unique_ptr<char, gdb::xfree_deleter<char> >*, int*)'
21120          collect2: error: ld returned 1 exit status
21121          make[2]: *** [Makefile:2149: gdb] Error 1
21122          make[2]: Leaving directory '/home/pedro/gdb/binutils-gdb/build/gdb'
21123          make[1]: *** [Makefile:11847: all-gdb] Error 2
21124          make[1]: Leaving directory '/home/pedro/gdb/binutils-gdb/build'
21125          make: *** [Makefile:1004: all] Error 2
21126
21127         Those undefined functions exist in gdb/gcore-elf.c, which is only
21128         included in the build if GDB's configure thinks that the target you're
21129         configuring for is an ELF target.  GDB's configure thinks my system
21130         isn't ELF, which is incorrect.
21131
21132         For the ELF support check, gdb/config.log shows:
21133
21134          configure:17387: checking for ELF support in BFD
21135          configure:17407: gcc -o conftest -I/home/pedro/gdb/binutils-gdb/src/gdb/../include -I../bfd -I/home/pedro/gdb/binutils-gdb/src/gdb/../bfd -g3 -O0      -L../bfd -L../libiberty  -lzstd   conftest.c -lbfd -liberty -lz  -lncursesw -lm -ldl  >&5
21136          /usr/bin/ld: ../bfd/libbfd.a(compress.o): in function `decompress_contents':
21137          /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:42: undefined reference to `ZSTD_decompress'
21138          /usr/bin/ld: /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:44: undefined reference to `ZSTD_isError'
21139          /usr/bin/ld: ../bfd/libbfd.a(compress.o): in function `bfd_compress_section_contents':
21140          /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:195: undefined reference to `ZSTD_compress'
21141          /usr/bin/ld: /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:198: undefined reference to `ZSTD_isError'
21142          collect2: error: ld returned 1 exit status
21143          configure:17407: $? = 1
21144          ...
21145          configure:17417: result: no
21146
21147         Note how above, in the gcc command line, "-lzstd" appears before
21148         "-lbfd".  That explain the link failure.  It should appear after, like
21149         -lz does.
21150
21151         This commit fixes it, by moving ZSTD_LIBS from LDFLAGS to LIBS, next
21152         to -lz, in GDB_AC_CHECK_BFD, and regenerating gdb/configure.
21153
21154         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29630
21155         Change-Id: I1f4128dde634e8ea04c9002904f1005a8b3a6863
21156
21157 2022-09-28  Simon Marchi  <simon.marchi@efficios.com>
21158
21159         gdb: remove trailing spaces in README
21160         Change-Id: Ic7f8e415acd1bff6194cf08ed646bff45571f165
21161
21162 2022-09-28  Tom Tromey  <tromey@adacore.com>
21163
21164         Treat Character as a discrete type in Ada
21165         A user noticed that gdb would assert when printing a certain array
21166         with array-indexes enabled.  This turned out to be caused by the array
21167         having an index type of Character, which is completely valid in Ada.
21168         This patch changes the Ada support to recognize Character as a
21169         discrete type, and adds some tests.
21170
21171         Because this is Ada-specific and was also reviewed internally, I am
21172         checking it in.
21173
21174 2022-09-28  Nick Clifton  <nickc@redhat.com>
21175
21176         The help document of size misses an option.
21177                 PR 29628
21178                 * size.c (usage): Add -f.
21179                 * doc/binutils.texi (size): Add -f.
21180
21181 2022-09-28  Clément Chigot  <chigot@adacore.com>
21182
21183         ld/testsuite: force warnings when dealing with execstack tests
21184         Binutils can be configured to avoid printing the execstack or RWD
21185         segment warnings. In this case, the first test of PR ld/29072 will fail.
21186         Fix that by always manually forcing the warnings for it.
21187
21188         ld/ChangeLog:
21189
21190                 * testsuite/ld-elf/elf.exp (PR ld/29072): Force execstack and
21191                 RWD segment warnings.
21192
21193 2022-09-28  Alan Modra  <amodra@gmail.com>
21194
21195         Re: egrep in binutils
21196         Multi-line patterns for grep are not supported on some old versions
21197         of grep.
21198
21199         binutils/
21200                 * embedspu.sh: Replace multi-line grep with sed.
21201         ld/
21202                 * testsuite/ld-elfvers/vers.exp: Replace multi-line grep with sed.
21203
21204 2022-09-28  Pedro Alves  <pedro@palves.net>
21205
21206         Renenerate {gdb,gdbserver}/configure
21207         Pick up config/lib-ld.m4 changes from:
21208
21209          commit 67d1991b785bdfef1d70cddfa0202b99b43ccce9
21210          Author:     Alan Modra <amodra@gmail.com>
21211          AuthorDate: Wed Sep 28 13:37:31 2022 +0930
21212          Commit:     Alan Modra <amodra@gmail.com>
21213          CommitDate: Wed Sep 28 13:37:31 2022 +0930
21214
21215              egrep in binutils
21216
21217         Change-Id: Ifc84d30f1fca015e80bafa80f9a35616b0077220
21218
21219 2022-09-28  Nick Clifton  <nickc@redhat.com>
21220
21221         The help document of as misses some many options
21222                 PR 29623
21223                 * as.c (show_usage): Document the --dump-config,
21224                 --gdwarf-cie-version, --hash-size, --multibyte-handling,
21225                 and --reduce-memory-overheads options.
21226                 * config/tc-i386.c (md_show_usage): Document the -O option.
21227                 * doc/as.texi: Document the --dump-config, --emulation,
21228                 --hash-size, and --reduce-memory-overheads options.
21229
21230 2022-09-28  Alan Modra  <amodra@gmail.com>
21231
21232         egrep in binutils
21233         Apparently some distros have a nagging egrep that helpfully tells you
21234         egrep is deprecated and to use "grep -E".  The nag message causes a ld
21235         testsuite failure.  What's more the advice isn't that good.  The "-E"
21236         flag may not be available with older versions of grep.
21237
21238         This patch fixes bare invocation of egrep within binutils, replacing
21239         it with the autoconf $EGREP or with grep.
21240
21241         config/
21242                 * lib-ld.m4 (AC_LIB_PROG_LD_GNU): Require AC_PROG_EGREP and
21243                 invoke $EGREP.
21244                 (AC_LIB_PROG_LD): Likewise.
21245         binutils/
21246                 * configure: Regenerate.
21247                 * embedspu.sh: Replace egrep with grep.
21248         gold/
21249                 * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
21250                 Replace egrep with grep.
21251                 * testsuite/Makefile.in: Regenerate.
21252                 * testsuite/bnd_ifunc_1.sh: Replace egrep with $EGREP.
21253                 * testsuite/bnd_ifunc_2.sh: Likewise.
21254                 * testsuite/bnd_plt_1.sh: Likewise.
21255                 * testsuite/discard_locals_test.sh: Likewise.
21256                 * testsuite/gnu_property_test.sh: Likewise.
21257                 * testsuite/no_version_test.sh: Likewise.
21258                 * testsuite/pr18689.sh: Likewise.
21259                 * testsuite/pr26936.sh: Likewise.
21260                 * testsuite/retain.sh: Likewise.
21261                 * testsuite/split_i386.sh: Likewise.
21262                 * testsuite/split_s390.sh: Likewise.
21263                 * testsuite/split_x32.sh: Likewise.
21264                 * testsuite/split_x86_64.sh: Likewise.
21265                 * testsuite/ver_test_pr16504.sh: Likewise.
21266         intl/
21267                 * configure: Regenerate.
21268         ld/
21269                 * testsuite/ld-elfvers/vers.exp (test_ar): Replace egrep with grep.
21270
21271 2022-09-28  Alan Modra  <amodra@gmail.com>
21272
21273         regen bfd/configure
21274
21275 2022-09-28  Alan Modra  <amodra@gmail.com>
21276
21277         asan: _bfd_stab_section_find_nearest_line segv
21278         The segv was on "info->strs[strsize - 1] = 0;" with strsize zero.  OK,
21279         if strsize is zero we don't have any filenames in stabs so no useful
21280         info.
21281
21282                 * syms.c (_bfd_stab_section_find_nearest_line): Exit if either
21283                 stabsize or strsize is zero.
21284
21285 2022-09-28  Alan Modra  <amodra@gmail.com>
21286
21287         asan: segv in _bfd_archive_close_and_cleanup
21288         Uninitialised arelt_data->parent_cache led to this segv.
21289
21290                 * pdb.c (pdb_get_elt_at_index): Clear arelt_data.
21291
21292 2022-09-28  GDB Administrator  <gdbadmin@sourceware.org>
21293
21294         Automatic date update in version.in
21295
21296 2022-09-27  Fangrui Song  <maskray@google.com>
21297
21298         sim: Link ZSTD_LIBS
21299         This fixes linker errors in a `../../configure --enable-targets
21300         --enable-sim; make all-gdb` build.
21301
21302 2022-09-27  Tsukasa OI  <research_trasio@irq.a4lg.com>
21303
21304         gold: Suppress "unused" variable warning on Clang
21305         Clang generates a warning if there is a variable that is set but not used
21306         otherwise ("-Wunused-but-set-variable").  On the default configuration, it
21307         causes a build failure (unless "--disable-werror" is specified).
21308
21309         Because the cause of this error is in the Bison-generated code
21310         ($(srcdir)/gold/yyscript.y -> $(builddir)/gold/yyscript.c),
21311         this commit suppresses this warning ("-Wunused-but-set-variable") by placing
21312         DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE macro at the end of user
21313         prologue on yyscript.y.
21314
21315                 * yyscript.y: Suppress -Wunused-but-set-variable warning on
21316                 the Bison-generated code.
21317
21318 2022-09-27  Fangrui Song  <i@maskray.me>
21319
21320         libctf: Add ZSTD_LIBS to LIBS so that ac_cv_libctf_bfd_elf can be true
21321
21322 2022-09-27  Fangrui Song  <maskray@google.com>
21323
21324         binutils, gdb: support zstd compressed debug sections
21325         PR29397 PR29563: Add new configure option --with-zstd which defaults to
21326         auto.  If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support
21327         zstd compressed debug sections for most tools.
21328
21329         * bfd: for addr2line, objdump --dwarf, gdb, etc
21330         * gas: support --compress-debug-sections=zstd
21331         * ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd
21332         * objcopy: support ELFCOMPRESS_ZSTD input for
21333           --decompress-debug-sections and --compress-debug-sections=zstd
21334         * gdb: support ELFCOMPRESS_ZSTD input.  The bfd change references zstd
21335           symbols, so gdb has to link against -lzstd in this patch.
21336
21337         If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error.  We
21338         can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this
21339         is too heavyweight, so don't do it for now.
21340
21341         ```
21342         % ld/ld-new a.o
21343         ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support
21344         ...
21345
21346         % ld/ld-new a.o --compress-debug-sections=zstd
21347         ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support
21348
21349         % binutils/objcopy --compress-debug-sections=zstd a.o b.o
21350         binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with zstd support
21351
21352         % binutils/objcopy b.o --decompress-debug-sections
21353         binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support
21354         ...
21355         ```
21356
21357 2022-09-27  Alan Modra  <amodra@gmail.com>
21358
21359         PR29617, ld segfaults when bfd_close fails
21360                 PR 29617
21361                 * ldmain.c (main): Don't access output_bfd after bfd_close.
21362
21363 2022-09-27  GDB Administrator  <gdbadmin@sourceware.org>
21364
21365         Automatic date update in version.in
21366
21367 2022-09-26  Simon Marchi  <simon.marchi@polymtl.ca>
21368
21369         gdb/testsuite: update field names in gdb-gdb.py.in
21370         Patches that renamed the type::length and type::target_type fields
21371         didn't update gdb-gdb.py.in accordingly, do that.
21372
21373         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29599
21374         Change-Id: I0f3f37a94d43497789156b0ded4d2f2dd5b89496
21375
21376 2022-09-26  Simon Marchi  <simon.marchi@polymtl.ca>
21377
21378         gdb/testsuite: use gdb_test in gdb.gdb/python-helper.exp
21379         If some command in there gives the wrong answer, we currently have to
21380         wait for a timeout for the test to continue.  For instance, I currently
21381         see:
21382
21383             print *val->type
21384             $1 = Python Exception <class 'gdb.error'>: Cannot take address of method length.
21385
21386             (outer-gdb) FAIL: gdb.gdb/python-helper.exp: pretty print type (timeout)
21387
21388         We can avoid this and modernize the test at the same time by using the
21389         -prompt option of gdb_test.
21390
21391         gdb_test_no_output currently accepts a -prompt_re option (the variable
21392         name passed to parse_args defines the option name), but I think
21393         it's a typo.  It's supposed to be -prompt, like gdb_test.  I can't find
21394         anything using -prompt_re using grep.  Change it to just "prompt".
21395
21396         Change-Id: Icc0a9a0ef482e62460c708bccdd544c11d711eca
21397
21398 2022-09-26  Simon Marchi  <simon.marchi@polymtl.ca>
21399
21400         gdb/testsuite: bump duration for the whole test in do_self_tests
21401         When running gdb.gdb/python-helper.exp, I get some timeouts:
21402
21403             continue
21404             Continuing.
21405             print 1
21406
21407             FAIL: gdb.gdb/python-helper.exp: hit breakpoint in outer gdb (timeout)
21408
21409         At this time, GDB is actually processing the stop and reading in some
21410         CUs.  selftest_setup does bump the timeout, but it's not for the whole
21411         test.
21412
21413         Since debugging GDB with GDB is (unfortunately) a bit slow, bump the
21414         timeout for the whole duration of the setup and body.  On my optimized
21415         build, the command takes just a bit more than the current timeout of 10
21416         seconds.  But it's much slower if running the test on an unoptimized
21417         build, so I think it's necessary to bump the timeout for that in any
21418         case.
21419
21420         Change-Id: I4d38285870e76c94f9d0bfdb60648a2e7f2cfa5d
21421
21422 2022-09-26  Clément Chigot  <chigot@adacore.com>
21423
21424         binutils/testsuite: handle the different install names of c++filt
21425         c++filt is always named cxxfilt in a build directory, but in a install
21426         directory it would be named either cxxfilt or c++filt (depending on
21427         the host).  Handle this last case in testsuite.
21428
21429         binutils/ChangeLog:
21430                 *  testsuite/config/default.exp (CXXFILE): if cxxfilt not found,
21431                 try c++filt.
21432
21433 2022-09-26  Clément Chigot  <chigot@adacore.com>
21434
21435         binutils/testsuite: skip gentestdlls related tests if missing
21436         When launching the testsuite through runtest outside the build tree,
21437         gentestdlls might not be available, this binary being created by make
21438         check.
21439         Simply untested the related tests instead of crashing.
21440
21441         binutils/ChangeLog:
21442
21443                 * testsuite/binutils-all/objdump.exp: Skip dotnet tests if
21444                 gentestdlls is not available.
21445
21446 2022-09-26  Tom de Vries  <tdevries@suse.de>
21447
21448         [gdb/testsuite] Fix gdb.dwarf2/dw2-unspecified-type-foo.c with -m32
21449         When running test-case gdb.dwarf2/dw2-unspecified-type-foo.c with target board
21450         unix/-m32, I run into:
21451         ...
21452         (gdb) PASS: gdb.dwarf2/dw2-unspecified-type.exp: ptype foo
21453         p ((int (*) ()) foo) ()^M
21454         $1 = -135698472^M
21455         ...
21456
21457         Add the missing "return 0" in foo, which fixes this.
21458
21459         Tested on x86_64-linux.
21460
21461 2022-09-26  Alan Modra  <amodra@gmail.com>
21462
21463         PR29613, use of uninitialized value in objcopy
21464                 PR 29613
21465                 * elf.c (_bfd_elf_write_secondary_reloc_section): Trim sh_size
21466                 back to relocs written.  Use better types for vars.
21467
21468 2022-09-26  Alan Modra  <amodra@gmail.com>
21469
21470         PR29542, PowerPC gold internal error in get_output_view,
21471         We were attempting to set a BSS style section contents.
21472
21473                 PR 29542
21474                 * powerpc.cc (Output_data_plt_powerpc::do_write): Don't set .plt,
21475                 .iplt or .lplt section contents when position independent.
21476
21477 2022-09-26  Alan Modra  <amodra@gmail.com>
21478
21479         stab nearest_line bfd_malloc_and_get_section
21480         bfd_malloc_and_get_section performs some sanity checks on the section
21481         size before allocating memory.  This patch avails the stab
21482         nearest_line code of that sanity checking, and tidies up memory
21483         afterward.
21484
21485                 * coffgen.c (_bfd_coff_close_and_cleanup): Call _bfd_stab_cleanup.
21486                 * elf.c (_bfd_elf_close_and_cleanup): Likewise.
21487                 * syms.c (_bfd_stab_section_find_nearest_line): Set *pinfo earlier.
21488                 Use bfd_malloc_and_get_section.  Free malloc'd buffers on failure.
21489                 Malloc indextable.
21490                 (_bfd_stab_cleanup): New function.
21491                 * libbfd-in.h (_bfd_stab_cleanup): Declare.
21492                 * libbfd.h: Regnerate.
21493
21494 2022-09-26  Alan Modra  <amodra@gmail.com>
21495
21496         PKG_CHECK_MODULES for msgpack and jansson
21497         Using AS_IF rather than shell "if" is recommended for conditionals
21498         that contain non-trivial autoconf macros, because autoconf will emit
21499         any AC_REQUIREd autoconf macro expansions outside of the conditional.
21500         This makes them available elsewhere in the configure script.
21501
21502         binutils/
21503                 * configure.ac (msgpack): Use "AS_IF" rather than "if".
21504                 * configure: Regenerate.
21505         ld/
21506                 * configure.ac (jansson): Use "AS_IF" rather than "if".
21507                 * configure: Regenerate.
21508
21509 2022-09-26  GDB Administrator  <gdbadmin@sourceware.org>
21510
21511         Automatic date update in version.in
21512
21513 2022-09-25  GDB Administrator  <gdbadmin@sourceware.org>
21514
21515         Automatic date update in version.in
21516
21517 2022-09-24  Magne Hov  <mhov@undo.io>
21518
21519         gdb/source.c: Fix undefined behaviour dereferencing empty string
21520         When a source file's dirname is solely made up of directory separators
21521         we end up trying to dereference the last character of an empty string
21522         with std::string::back, which results in undefined behaviour. A typical
21523         use case where this can happen is when the root directory "/" is used as
21524         a compilation directory.
21525
21526         With libstdc++.so.6.0.28 we get no out-of-bounds checks and the byte
21527         preceding the storage of the empty string is returned. The character
21528         value of this byte depends on heap implementation and usage, but when
21529         this byte happens to hold the value of the directory separator character
21530         we go on to call std::string::pop_back on the empty string which results
21531         in an out_of_range exception which terminates GDB.
21532
21533         Fix this by using path_join. prepare_path_for_appending ensures that the
21534         filename component is relative.
21535
21536         The testsuite has been run before and after the change and no
21537         regressions were found.
21538
21539 2022-09-24  Enze Li  <enze.li@hotmail.com>
21540
21541         gdbserver: remove unused for loop
21542         In this commit,
21543
21544           commit cf6c1e710ee162a5adb0ae47acb731f2bfecc956
21545           Date:   Mon Jul 11 20:53:48 2022 +0800
21546
21547             gdbserver: remove unused variable
21548
21549         I removed an unused variable in handle_v_run.  Pedro then pointed out
21550         that the for loop after it was also unused.  After a period of smoke
21551         testing, no exceptions were found.
21552
21553         Tested on x86_64-linux.
21554
21555 2022-09-24  Alan Modra  <amodra@gmail.com>
21556
21557         The problem with warning in elf_object_p
21558         elfcode.h can emit three warnings in elf_object_p for various things,
21559         "section extending past end of file", "corrupt string table index",
21560         and "program header with invalid alignment".  The problem with doing
21561         this is that the warning can be emitted for multiple possible targets
21562         as each one is tried.  I was looking at a fuzzer testcase that had an
21563         object file with 6144 program headers, 5316 of which had invalid
21564         alignment.  It would be bad enough to get 5316 messages all the same,
21565         but this object was contained in an archive and resulted in 4975776
21566         repeats.
21567
21568         Some trimming can be done by not warning if the bfd is already marked
21569         read_only, as is done for the "section extending past end of file"
21570         warning, but that still results in an unacceptable number of
21571         warnings for object files in archives.  Besides that, it is just wrong
21572         to warn about a problem detected by a target elf_object_p other than
21573         the one that actually matches.  At some point we might have more
21574         target specific warnings.
21575
21576         So what to do?  One obvious solution is to remove the warnings.
21577         Another is to poke any warning strings into the target xvec, emitting
21578         them if that xvec is the final one chosen.  This also has the benefit
21579         of solving the archive problem.  A warning when recursing into
21580         _bfd_check_format for the first element of the archive (to find the
21581         correct target for the archive) will still be on the xvec at the point
21582         that target is chosen for the archive.  However, target xvecs are
21583         read-only.  Thus the need for per_xvec_warn to logically extend
21584         bfd_target with a writable field.  I've made per_xvec_warn one larger
21585         than bfd_target_vector to provide one place for user code that makes
21586         private copies of target xvecs.
21587
21588                 * elfcode.h (elf_swap_shdr_in, elf_object_p): Stash potential
21589                 warnings in _bfd_per_xvec_warn location.
21590                 * format.c (clear_warnmsg): New function.
21591                 (bfd_check_format_matches): Call clear_warnmsg before trying
21592                 a new xvec.  Print warnings for the successful non-archive
21593                 match.
21594                 * targets.c: Include libiberty.h.
21595                 (_bfd_target_vector_entries): Use ARRAY_SIZE.
21596                 (per_xvec_warn): New.
21597                 (_bfd_per_xvec_warn): New function.
21598                 * Makefile.am (LIBBFD_H_FILES): Add targets.c.
21599                 * Makefile.in: Regenerate.
21600                 * libbfd.h: Regenerate.
21601
21602 2022-09-24  Alan Modra  <amodra@gmail.com>
21603
21604         Re: bfd_cleanup for object_p
21605         Bits still missing from commit cb001c0d283d.
21606
21607                 * aoutx.h (aout_@var{size}_some_aout_object_p): Correct synopsis.
21608                 * i386lynx.c (lynx_core_file_p): Correct return type.
21609                 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
21610
21611 2022-09-24  GDB Administrator  <gdbadmin@sourceware.org>
21612
21613         Automatic date update in version.in
21614
21615 2022-09-23  John Baldwin  <jhb@FreeBSD.org>
21616
21617         Support AT_USRSTACKBASE and AT_USRSTACKLIM.
21618         FreeBSD's kernel has recently added two new ELF auxiliary vector
21619         entries to describe the location of the user stack for the initial
21620         thread in a process.
21621
21622         This change displays the proper name and description of these entries
21623         in 'info auxv'.
21624
21625 2022-09-23  Christoph Müllner  <christoph.muellner@vrull.eu>
21626
21627         RISC-V: Add Zawrs ISA extension support
21628         This patch adds support for the Zawrs ISA extension
21629         ("wrs.nto" and "wrs.sto" instructions).
21630
21631         The specification can be found here:
21632         https://github.com/riscv/riscv-zawrs/blob/main/zawrs.adoc
21633
21634 2022-09-23  Simon Marchi  <simon.marchi@polymtl.ca>
21635
21636         gdb/testsuite/tui: start GDB with "set filename-display basename"
21637         The test gdb.tui/tui-missing-src.exp fails on my CI machine, and I
21638         concluded that it is caused by the long source directory name:
21639
21640           /home/jenkins/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/src/binutils-gdb
21641
21642         The long name causes some particular redrawing that doesn't happen for
21643         shorter directories, and causes a Term::command call to return too
21644         early.
21645
21646         This can be reproduced by cloning the binutils-gdb repo in a directory
21647         with a name similar to the one shown above.
21648
21649             $ pwd
21650             /home/simark/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd64/target_board/unix/src/binutils-gdb/build/gdb
21651             $ make check-read1 TESTS="gdb.tui/tui-missing-src.exp"
21652             FAIL: gdb.tui/tui-missing-src.exp: checking if inside f2 ()
21653             FAIL: gdb.tui/tui-missing-src.exp: f2.c must be displayed in source window
21654             FAIL: gdb.tui/tui-missing-src.exp: check source box is empty after return
21655             FAIL: gdb.tui/tui-missing-src.exp: Back in main
21656
21657         Note that using "make check" instead of "make check-read1" only shows
21658         the last 2 failures for me.
21659
21660         When running gdb.tui/tui-missing-src.exp in a directory with a shorter
21661         name, the terminal looks like this by the time the "checking if inside
21662         f2" test runs:
21663
21664             Screen Dump (size 80 columns x 24 rows, cursor at column 6, row 23):
21665                 0 +-...ld/binutils-gdb-noasan/gdb/testsuite/outputs/gdb.tui/tui-missing-src/f2.c-+
21666                 1 |        1                                                                     |
21667                 2 |        2  int                                                                |
21668                 3 |        3  f2 (int x)                                                         |
21669                 4 |        4  {                                                                  |
21670                 5 |  >     5    x <<= 1;                                                         |
21671                 6 |        6    return x+5;                                                      |
21672                 7 |        7  }                                                                  |
21673                 8 |        8                                                                     |
21674                 9 |        9                                                                     |
21675                10 |       10                                                                     |
21676                11 |       11                                                                     |
21677                12 |       12                                                                     |
21678                13 |       13                                                                     |
21679                14 +------------------------------------------------------------------------------+
21680                15 multi-thre Thread 0x7ffff7cc07 In: f2                  L5    PC: 0x555555555143
21681                16     at /home/simark/build/binutils-gdb-noasan/gdb/testsuite/outputs/gdb.tui/tui-
21682                17 missing-src/main.c:6
21683                18 (gdb) next
21684                19 (gdb) step
21685                20 f2 (x=4)
21686                21     at /home/simark/build/binutils-gdb-noasan/gdb/testsuite/outputs/gdb.tui/tui-
21687                22 missing-src/f2.c:5
21688                23 (gdb)
21689             PASS: gdb.tui/tui-missing-src.exp: checking if inside f2 ()
21690
21691         When running the `Term::command "step"` just before, GDB writes the
21692         "step", which makes the `wait_for` proc go in the "looking for the
21693         prompt" mode, to know when the command's execution is complete.  As some
21694         new output appears, lines that must disappear are deleted using the
21695         "Delete Line" operation [1] and some new ones are drawn.  The source
21696         window gets redrawn with the contents of the f2.c file.  Then, GDB
21697         writes the prompt (at line 23 above), which satisfies `wait_for`, which
21698         then returns.  The state of the terminal is therefore correct for the
21699         "check if inside f2" and "f2.c must be displayed in the source window"
21700         tests.
21701
21702         In the non-working case, the terminal looks like this by the time the
21703         "check if inside f2" test runs:
21704
21705              Screen Dump (size 80 columns x 24 rows, cursor at column 6, row 17):
21706                 0 +------------------------------------------------------------------------------+
21707                 1 |                                                                              |
21708                 2 |                                                                              |
21709                 3 |                                                                              |
21710                 4 |                                                                              |
21711                 5 |                                                                              |
21712                 6 |                                                                              |
21713                 7 |               [ No Source Available ]                                        |
21714                 8 |                                                                              |
21715                 9 |                                                                              |
21716                10 |                                                                              |
21717                11 |                                                                              |
21718                12 |                                                                              |
21719                13 |                                                                              |
21720                14 +------------------------------------------------------------------------------+
21721                15 multi-thre Thread 0x7ffff7cc1b In: main                L7    PC: 0x555555555128
21722                16 sing-src/main.c:6
21723                17 (gdb) ary breakpoint 1, main ()
21724                18     at /home/simark/workspace/binutils-gdb_master_linuxbuild/platform/jammy-amd6
21725                19 4/target_board/unix/src/binutils-gdb/build/gdb/testsuite/outputs/gdb.tui/tui-mis
21726                20 sing-src/main.c:6
21727                21 (gdb) next
21728                22 (gdb) step
21729                23
21730             FAIL: gdb.tui/tui-missing-src.exp: checking if inside f2 ()
21731
21732         What happened is: GDB wrote the "step" command, which make the
21733         `wait_for` proc go in its "looking for the prompt" mode.  However,
21734         curses decided to redraw whatever scrolled up to line 17 using some
21735         standard character insertion operations:
21736
21737             +++ Cursor Down (1), cursor: (16, 0) -> (17, 0)
21738             +++ Inserting string '('
21739             +++   Inserted char '(', cursor: (17, 0) -> (17, 1)
21740             +++ Inserted string '(', cursor: (17, 0) -> (17, 1)
21741             +++ Inserting string 'g'
21742             +++   Inserted char 'g', cursor: (17, 1) -> (17, 2)
21743             +++ Inserted string 'g', cursor: (17, 1) -> (17, 2)
21744             +++ Inserting string 'd'
21745             +++   Inserted char 'd', cursor: (17, 2) -> (17, 3)
21746             +++ Inserted string 'd', cursor: (17, 2) -> (17, 3)
21747             +++ Inserting string 'b'
21748             +++   Inserted char 'b', cursor: (17, 3) -> (17, 4)
21749             +++ Inserted string 'b', cursor: (17, 3) -> (17, 4)
21750             +++ Inserting string ')'
21751             +++   Inserted char ')', cursor: (17, 4) -> (17, 5)
21752             +++ Inserted string ')', cursor: (17, 4) -> (17, 5)
21753             +++ Inserting string ' '
21754             +++   Inserted char ' ', cursor: (17, 5) -> (17, 6)
21755             +++ Inserted string ' ', cursor: (17, 5) -> (17, 6)
21756
21757         And that causes `wait_for` to think the "step" command is complete.
21758         This is wrong, as the prompt at line 17 isn't the prompt drawn after the
21759         completion of the "step" command.  The subsequent tests now run with a
21760         partially updated screen (what is shown above) and obviously fail.
21761
21762         The ideal way to fix this would be for `wait_for` to be smarter, to
21763         avoid it confusing the different prompts drawn.
21764
21765         However, I would also like to reduce the variations in TUI test results
21766         due to the directories (source and build) in which tests are ran.  TUI
21767         tests are more prone to differences in test results due to variations in
21768         directory names than other tests, as it makes curses take different
21769         redrawing decisions.  So in this patch, I propose to make TUI tests use
21770         "set filename-display basename", which makes GDB omit directory names
21771         when it prints file names.  This way, regardless of where you run the
21772         tests, you should get the same results (all other things being equal).
21773
21774         Doing this happens to fix my failures and makes my CI happy (which in
21775         turns makes me happy).  To be clear, I understand that this does not fix
21776         the root issue of `proc wait_for` being confused.  However, it makes TUI
21777         test runs be more similar for everyone, such that there's less chance of
21778         TUI tests randomly failing for somebody.  If some other change triggers
21779         the `wait_for` problem again in the future, hopefully everybody will see
21780         the problem and we can work on getting it fixed more easily than if just
21781         one unlucky person sees the problem.
21782
21783         Note that there are other reasons why TUI tests could vary, like
21784         different curses library versions taking different re-drawing decisions.
21785         However, I think my change is a good step towards more stable test
21786         results.
21787
21788         [1] https://vt100.net/docs/vt510-rm/DL.html
21789
21790         Change-Id: Ib18da83317e7b78a46f77892af0d2e39bd261bf5
21791
21792 2022-09-23  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
21793
21794         gdb/csky add cskyv2-linux.xml for cskyv2-linux.c
21795         Add cskyv2-linux.xml for re-generating cskyv2-linux.c if needed.
21796         Also update cskyv2-linux.c.
21797
21798 2022-09-23  Alan Modra  <amodra@gmail.com>
21799
21800         pdb: _bfd_generic_close_and_cleanup
21801         Every format that might appear inside a generic archive needs to call
21802         _bfd_generic_close_and_cleanup, so that the archive element lookup
21803         htab can be tidied on closing an element.  Otherwise you get stale
21804         entries in the htab pointing at freed and perhaps reused memory,
21805         resulting in segfaults when the archive is closed.
21806
21807         Calling _bfd_generic_close_and_cleanup on close means tdata needs to
21808         be set up too, since pdb claims to be of format bfd_archive.
21809
21810                 * pdb.c (pdb_close_and_cleanup): Define as
21811                 _bfd_generic_close_and_cleanup.
21812                 (pdb_archive_p): Set up tdata for bfd_archive format.
21813
21814 2022-09-23  Alan Modra  <amodra@gmail.com>
21815
21816         Don't attempt to compress bss sections
21817         It doesn't make sense to try to compress a section without contents
21818         since those sections take no space on disk.  Compression can only
21819         increase the disk image size.
21820
21821                 * coffgen.c (make_a_section_from_file): Exclude !SEC_HAS_CONTENTS
21822                 sections from compression and decompression.
21823                 * elf.c (_bfd_elf_make_section_from_shdr): Likewise.
21824
21825 2022-09-23  GDB Administrator  <gdbadmin@sourceware.org>
21826
21827         Automatic date update in version.in
21828
21829 2022-09-22  Lancelot SIX  <lancelot.six@amd.com>
21830
21831         gdb/testsuite/lib/future.exp: follow dejagnu default_target_compile
21832         GDB's testsuite can override dejagnu's default_target_compile if the
21833         system provided dejagnu installation does not provide support to compile
21834         languages GDB needs.
21835
21836         Recent version of dejagnu (1.6.3, installed on RHEL-9) includes ba60272
21837         "Establish a default C compiler by evaluating [find_gcc] if no other
21838         compiler is given."[1].  This commit removed calls such as
21839         `set_board_info compiler  "[find_gcc]"` from the various baseboards
21840         and has default_target_compile call `find_gcc` itself to find a compiler
21841         if none was specified by the board description.
21842
21843         On systems with dejagnu-1.6.3, if GDB's overrides is needed to support
21844         languages still unknown to dejagnu, we end up in the following
21845         situation:
21846           - The system board files do not set the C compiler anymore,
21847           - GDB's replacement for default_target_compile assumes that the
21848             compiler should have been set up by the board file.
21849
21850         In this situation, no one sets the C compiler for the board and as a
21851         result many test are not compiled and not executed:
21852
21853             [...]
21854             Running .../gdb/testsuite/gdb.base/bt-on-error-and-warning.exp ...
21855             gdb compile failed, default_target_compile: No compiler to compile with
21856             Running .../gdb/testsuite/gdb.base/dprintf-non-stop.exp ...
21857             gdb compile failed, default_target_compile: No compiler to compile with
21858             Running .../gdb/testsuite/gdb.base/structs3.exp ...
21859             gdb compile failed, default_target_compile: No compiler to compile with
21860             [...]
21861
21862         We are observing this error with ROCgdb[2], a downstream port of GDB
21863         supporting AMD GPUs.  This port needs to use GDB's override of
21864         default_target_compile to compile HIP programs since dejagnu does not
21865         provide support for this language yet.
21866
21867         This patch changes gdb_default_target_compile_1 in a similar way
21868         default_target_compile has been updated so both implementations remain
21869         compatible.  Even if this is not strictly required by GDB just yet,
21870         I believe keeping both implementations in sync desirable.
21871
21872         Using board files provided with dejagnu <=1.6.2 is still supported: if
21873         the compiler is set by the board file, gdb_default_target_compile_1 uses
21874         it and does not need `find_gcc`.
21875
21876         Patch tested on x86_64 RHEL-9 and ubuntu-20.04 on top of GDB and ROCgdb.
21877
21878         [1] http://git.savannah.gnu.org/gitweb/?p=dejagnu.git;a=commit;h=ba60272a5ac6f6a7012acca03f596a6ed003f044
21879         [2] https://github.com/ROCm-Developer-Tools/ROCgdb
21880
21881         Change-Id: Ibff52684d9cab8243a7c6748ecbd29f50c37e669
21882
21883 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21884
21885         RISC-V: Add T-Head MemPair vendor extension
21886         T-Head has a range of vendor-specific instructions.
21887         Therefore it makes sense to group them into smaller chunks
21888         in form of vendor extensions.
21889
21890         This patch adds the XTheadMemPair extension, a collection of T-Head specific
21891         two-GP-register memory operations.
21892         The 'th' prefix and the "XTheadMemPair" extension are documented in a PR
21893         for the RISC-V toolchain conventions ([1]).
21894
21895         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
21896
21897         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21898
21899 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21900
21901         RISC-V: Add support for literal instruction arguments
21902         This patch introduces support for arbitrary literal instruction
21903         arguments, that are not encoded in the opcode.
21904
21905         A typical use case for this feature would be an instruction that
21906         applies an implicit shift by a constant value on an immediate
21907         (that is a real operand). With this patch it is possible to make
21908         this shift visible in the dissasembly and support such artificial
21909         parameter as part of the asssembly code.
21910
21911         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21912
21913 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21914
21915         RISC-V: Add T-Head MemIdx vendor extension
21916         T-Head has a range of vendor-specific instructions.
21917         Therefore it makes sense to group them into smaller chunks
21918         in form of vendor extensions.
21919
21920         This patch adds the XTheadMemIdx extension, a collection of T-Head specific
21921         GPR memory access instructions.
21922         The 'th' prefix and the "XTheadMemIdx" extension are documented in a PR
21923         for the RISC-V toolchain conventions ([1]).
21924
21925         In total XTheadCmo introduces the following 44 instructions
21926         (BU,HU,WU only for loads (zero-extend instead of sign-extend)):
21927
21928         * {L,S}{D,W,WU,H,HU,B,BU}{IA,IB} rd, rs1, imm5, imm2
21929         * {L,S}R{D,W,WU,H,HU,B,BU} rd, rs1, rs2, imm2
21930         * {L,S}UR{D,W,WU,H,HU,B,BU} rd, rs1, rs2, imm2
21931
21932         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
21933
21934         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21935
21936 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21937
21938         RISC-V: Add T-Head FMemIdx vendor extension
21939         T-Head has a range of vendor-specific instructions.
21940         Therefore it makes sense to group them into smaller chunks
21941         in form of vendor extensions.
21942
21943         This patch adds the XTheadFMemIdx extension, a collection of
21944         T-Head-specific floating-point memory access instructions.
21945         The 'th' prefix and the "XTheadFMemIdx" extension are documented
21946         in a PR for the RISC-V toolchain conventions ([1]).
21947
21948         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
21949
21950         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21951
21952 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21953
21954         RISC-V: Add T-Head MAC vendor extension
21955         T-Head has a range of vendor-specific instructions.
21956         Therefore it makes sense to group them into smaller chunks
21957         in form of vendor extensions.
21958
21959         This patch adds the XTheadMac extension, a collection of
21960         T-Head-specific multiply-accumulate instructions.
21961         The 'th' prefix and the "XTheadMac" extension are documented
21962         in a PR for the RISC-V toolchain conventions ([1]).
21963
21964         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
21965
21966         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21967
21968 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21969
21970         RISC-V: Add T-Head CondMov vendor extension
21971         T-Head has a range of vendor-specific instructions.
21972         Therefore it makes sense to group them into smaller chunks
21973         in form of vendor extensions.
21974
21975         This patch adds the XTheadCondMov extension, a collection of
21976         T-Head-specific conditional move instructions.
21977         The 'th' prefix and the "XTheadCondMov" extension are documented
21978         in a PR for the RISC-V toolchain conventions ([1]).
21979
21980         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
21981
21982         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21983
21984 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
21985
21986         RISC-V: Add T-Head Bitmanip vendor extension
21987         T-Head has a range of vendor-specific instructions.
21988         Therefore it makes sense to group them into smaller chunks
21989         in form of vendor extensions.
21990
21991         This patch adds the XThead{Ba,Bb,Bs} extensions, a collection of
21992         T-Head-specific bitmanipulation instructions.
21993         The 'th' prefix and the "XThead{Ba,Bb,Bs}" extension are documented
21994         in a PR for the RISC-V toolchain conventions ([1]).
21995
21996         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
21997
21998         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
21999
22000 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
22001
22002         RISC-V: Add support for arbitrary immediate encoding formats
22003         This patch introduces support for arbitrary signed or unsigned immediate
22004         encoding formats. The formats have the form "XsN@S" and "XuN@S" with N
22005         being the number of bits and S the LSB position.
22006
22007         For example an immediate field of 5 bytes that encodes a signed value
22008         and is stored in the bits 24-20 of the instruction word can use the
22009         format specifier "Xs5@20".
22010
22011         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
22012
22013 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
22014
22015         RISC-V: Add T-Head SYNC vendor extension
22016         T-Head has a range of vendor-specific instructions.
22017         Therefore it makes sense to group them into smaller chunks
22018         in form of vendor extensions.
22019
22020         This patch adds the XTheadSync extension, a collection of
22021         T-Head-specific multi-processor synchronization instructions.
22022         The 'th' prefix and the "XTheadSync" extension are documented in a PR
22023         for the RISC-V toolchain conventions ([1]).
22024
22025         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
22026
22027         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
22028
22029 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
22030
22031         RISC-V: Add T-Head CMO vendor extension
22032         T-Head has a range of vendor-specific instructions.
22033         Therefore it makes sense to group them into smaller chunks
22034         in form of vendor extensions.
22035
22036         This patch adds the XTheadCmo extension, a collection of T-Head specific
22037         cache management operations.
22038         The 'th' prefix and the "XTheadCmo" extension are documented in a PR
22039         for the RISC-V toolchain conventions ([1]).
22040
22041         In total XTheadCmo introduces the following 21 instructions:
22042
22043         * DCACHE.{C,CI,I}ALL
22044         * DCACHE.{C,CI,I}{PA,VA,SW} rs1
22045         * DCACHE.C{PAL1,VAL1} rs1
22046         * ICACHE.I{ALL,ALLS}
22047         * ICACHE.I{PA,VA} rs1
22048         * L2CACHE.{C,CI,I}ALL
22049
22050         Contrary to Zicbom, the XTheadCmo instructions don't have a constant
22051         displacement, therefore we have a different syntax for the arguments.
22052         To clarify this is intended behaviour, there is a set of negative test
22053         for Zicbom-style arguments in x-thead-cmo-fail.s.
22054
22055         [1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
22056
22057         v2:
22058         - Add missing DECLARE_INSN() list
22059         - Fix ordering
22060
22061         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
22062
22063 2022-09-22  Christoph Müllner  <christoph.muellner@vrull.eu>
22064
22065         RISC-V: Add generic support for vendor extensions
22066         This patch introduces changes that allow the integration of vendor ISA
22067         extensions:
22068         * Define a list of vendor extensions (riscv_supported_vendor_x_ext)
22069           where vendor extensions can be added
22070         * Introduce a section with a table in the documentation where vendor
22071           extensions can be added
22072
22073         To add a vendor extension that consists of instructions only,
22074         the following things need to be done:
22075         * Add the extension to the riscv_supported_vendor_x_ext list
22076         * Add lookup entry in riscv_multi_subset_supports
22077         * Documenting the extension in c-riscv.texti
22078         * Add test cases for all instructions
22079         * Add MATCH*/MASK* constants and DECLARE_INSN() for all instructions
22080         * Add new instruction class to enum riscv_insn_class
22081         * Define the instructions in riscv_opcodes
22082         * Additional changes if necessary (depending on the instructions)
22083
22084         Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
22085
22086 2022-09-22  Tom de Vries  <tdevries@suse.de>
22087
22088         [gdb/symtab] Add all_comp_units/all_type_units views on all_units
22089         Add all_comp_units/all_type_units views on all_units.
22090
22091         Having the views allows us to:
22092         - easily get the number of CUs or TUs in all_units, and
22093         - easily access the nth CU or TU.
22094
22095         This minimizes the use of tu_stats.nr_tus.
22096
22097         Tested on x86_64-linux.
22098
22099 2022-09-22  Tom de Vries  <tdevries@suse.de>
22100
22101         [gdb/symtab] Rename all_comp_units to all_units
22102         Mechanically rename all_comp_units to all_units:
22103         ...
22104         $ sed -i 's/all_comp_units/all_units/' gdb/dwarf2/*
22105         ...
22106
22107         Tested on x86_64-linux.
22108
22109 2022-09-22  Yoshinori Sato  <ysato@users.sourceforge.jp>
22110
22111         opcodes: SH fix bank register disassemble.
22112                 * sh-dis.c (print_insn_sh): Enforce bit7 of LDC Rm,Rn_BANK and STC
22113                 Rm_BANK,Rn is always 1.
22114
22115 2022-09-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
22116
22117         include: Add macro to ignore -Wunused-but-set-variable
22118         "-Wunused-but-set-variable" warning option can be helpful to track variables
22119         that are written but not read thereafter.  But it can be harmful if some of
22120         the code is auto-generated and we have no ways to deal with it.
22121
22122         The particular example is Bison-generated code.
22123
22124         The new DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE macro can be helpful on
22125         such cases. A typical use of this macro is to place this macro before the
22126         end of user prologues on Bison (.y) files.
22127
22128         include/ChangeLog:
22129
22130             * diagnostics.h (DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE): New.
22131
22132 2022-09-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
22133
22134         include: Add macro to ignore -Wuser-defined-warnings
22135         User-defined warnings (on Clang, "-Wuser-defined-warnings") can be harmful
22136         if we have specified "-Werror" and we have no control to disable the warning
22137         ourself.  The particular example is Gnulib.
22138
22139         Gnulib generates a warning if the system version of certain functions
22140         are used (to redirect the developer to use Gnulib version).  However,
22141         it can be harmful if we cannot easily replace them (e.g. the target is in
22142         the standard C++ library).
22143
22144         The new DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS macro can be helpful on such
22145         cases.  A typical use of this macro is to place this macro before including
22146         certain system headers.
22147
22148         include/ChangeLog:
22149
22150                 * diagnostics.h (DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS): New.
22151
22152 2022-09-22  Andrew Burgess  <aburgess@redhat.com>
22153
22154         gdb/python: restrict the names accepted by gdb.register_window_type
22155         I noticed that, from Python, I could register a new TUI window that
22156         had whitespace in its name, like this:
22157
22158           gdb.register_window_type('my window', MyWindowType)
22159
22160         however, it is not possible to then use this window in a new TUI
22161         layout, e.g.:
22162
22163           (gdb) tui new-layout foo my window 1 cmd 1
22164           Unknown window "my"
22165           (gdb) tui new-layout foo "my window" 1 cmd 1
22166           Unknown window ""my"
22167           (gdb) tui new-layout foo my\ window 1 cmd 1
22168           Unknown window "my\"
22169
22170         GDB clearly uses the whitespace to split the incoming command line.
22171
22172         I could fix this by trying to add a mechanism by which we can use
22173         whitespace within a window name, but it seems like an easier solution
22174         if we just forbid whitespace within a window name.  Not only is this
22175         easier, but I think this is probably the better solution, identifier
22176         names with spaces in would mean we'd need to audit all the places a
22177         window name could be printed and ensure that the use of a space didn't
22178         make the output ambiguous.
22179
22180         So, having decided to disallow whitespace, I then thought about other
22181         special characters.  We currently accept anything as a window name,
22182         and I wondered if this was a good idea.
22183
22184         My concerns were about how special characters used in a window name
22185         might cause confusion, for example, we allow '$' in window names,
22186         which is maybe fine now, but what if one day we wanted to allow
22187         variable expansion when creating new layouts?  Or what about starting
22188         a window name with '-'?  We already support a '-horizontal' option,
22189         what if we want to add more in the future?  Or use of the special
22190         character '{' which has special meaning within a new layout?
22191
22192         In the end I figured it might make sense to place some restrictive
22193         rules in place, and then relax the rules later if/when users complain,
22194         we can consider each relaxation as its requested.
22195
22196         So, I propose that window names should match this regular expression:
22197
22198           [a-zA-Z][-_.a-zA-Z0-9]*
22199
22200         There is a chance that there is user code in the wild which will break
22201         with the addition of this change, but hopefully adapting to the new
22202         restrictions shouldn't be too difficult.
22203
22204 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22205
22206         gdb/testsuite: Add test to step through function epilogue
22207         The testsuite implicitly tests GDB's ability to step through epilogues
22208         in multiple tests, without doing it explicitly anywhere.  This is
22209         unfortunate, as clang does not emit epilogue information, so using clang
22210         on our testsuite makes many tests fail.  This patch adds a central,
22211         explicit test for walking through the epilogue so we can safely remove
22212         this from other tests and have them working with clang.
22213
22214         The test created attempts to step through a simple epilogue, an
22215         epilogue that ends on another epilogue, and epilogues leading to other
22216         function calls.
22217
22218 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22219
22220         gdb.base/skip.exp: Use finish to exit functions
22221         gdb.base/skip.exp was making use of a fixed number of step commands to
22222         exit some functions.  This caused some problems when using clang to test
22223         GDB, as GDB would need fewer steps to reach the desired spots.  For
22224         instance, when testing in the section "step after disabling 3", the log
22225         looks like this:
22226
22227             Breakpoint 4, main () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:32
22228             32        x = baz ((bar (), foo ()));
22229             (gdb) step
22230             bar () at binutils-gdb/gdb/testsuite/gdb.base/skip1.c:21
22231             21        return 1;
22232             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: step 1
22233             step
22234             foo () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:42
22235             42        return 0;
22236             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: step 2
22237             step
22238             main () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:34
22239             34        test_skip_file_and_function ();
22240             (gdb) step
22241             test_skip_file_and_function () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:59
22242             59        test_skip ();
22243             (gdb) FAIL: gdb.base/skip.exp: step after disabling 3: step 3
22244             step
22245             test_skip () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:48
22246             48      }
22247             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: step 4
22248             step
22249             test_skip_file_and_function () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:60
22250             60        skip1_test_skip_file_and_function ();
22251             (gdb) FAIL: gdb.base/skip.exp: step after disabling 3: step 5
22252
22253         This shows that the feature is working but because the inferior lands in
22254         a different location, it registers as a failure.  Seeing as along with
22255         this difference, there are also some differences that depend on gcc
22256         versions (where gdb might stop back at line 32 before entering foo), it
22257         would not be easy to test for this behavior using steps and analzing
22258         where the inferior stops at each point. On the other hand, using
22259         gdb_step_until is not feasible because we'd possibly gloss over stepping
22260         into baz and rendering the whole test useless.  Instead, skip.exp now
22261         uses finish to leave functions, synchronizing through compilers and
22262         compiler versions.  Some test names were also changed to be a bit more
22263         descriptive.  The new log looks like this, independently of compiler used:
22264
22265             Breakpoint 4, main () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:32
22266             32        x = baz ((bar (), foo ()));
22267             (gdb) step
22268             bar () at binutils-gdb/gdb/testsuite/gdb.base/skip1.c:21
22269             21        return 1;
22270             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: step into bar
22271             finish
22272             Run till exit from #0  bar () at binutils-gdb/gdb/testsuite/gdb.base/skip1.c:21
22273             main () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:32
22274             32        x = baz ((bar (), foo ()));
22275             Value returned is $2 = 1
22276             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: return from bar
22277             step
22278             foo () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:42
22279             42        return 0;
22280             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: step into foo
22281             finish
22282             Run till exit from #0  foo () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:42
22283             main () at binutils-gdb/gdb/testsuite/gdb.base/skip.c:32
22284             32        x = baz ((bar (), foo ()));
22285             Value returned is $3 = 0
22286             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: Return from foo
22287             step
22288             34        test_skip_file_and_function ();
22289             (gdb) PASS: gdb.base/skip.exp: step after disabling 3: step and skip baz
22290
22291 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22292
22293         fix gdb.base/jit-elf.exp when testing with clang
22294         When using clang as the compiler for the target, gdb.base/jit-elf.exp
22295         was failing because the filename displayed when GDB attached to the
22296         inferior was only showing up as with a relative path, like so:
22297
22298                (gdb) attach 3674146
22299                Attaching to program: /home/blarsen/Documents/gdb-build/gdb/testsuite/outputs/gdb.base/jit-elf/jit-elf-main, process 3674146
22300                Reading symbols from /lib64/libm.so.6...
22301                Reading symbols from .gnu_debugdata for /lib64/libm.so.6...
22302                (No debugging symbols found in .gnu_debugdata for /lib64/libm.so.6)
22303                Reading symbols from /lib64/libc.so.6...
22304                (No debugging symbols found in /lib64/libc.so.6)
22305                Reading symbols from /lib64/ld-linux-x86-64.so.2...
22306                [Thread debugging using libthread_db enabled]
22307                Using host libthread_db library "/lib64/libthread_db.so.1".
22308                0x00000000004013ff in main (argc=3, argv=0x7fffffffd820) at ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/jit-elf-main.c:118
22309                118|  WAIT_FOR_GDB; i = 0;  /* gdb break here 1 */
22310                (gdb) FAIL: gdb.base/jit-elf.exp: attach: one_jit_test-2: break here 1: attach
22311
22312         While gcc's output is as follows:
22313
22314                (gdb) attach 3592961
22315                Attaching to program: /home/blarsen/Documents/gdb-build/gdb/testsuite/outputs/gdb.base/jit-elf/jit-elf-main, process 3592961
22316                Reading symbols from /lib64/libm.so.6...
22317                Reading symbols from .gnu_debugdata for /lib64/libm.so.6...
22318                (No debugging symbols found in .gnu_debugdata for /lib64/libm.so.6)
22319                Reading symbols from /lib64/libc.so.6...
22320                (No debugging symbols found in /lib64/libc.so.6)
22321                Reading symbols from /lib64/ld-linux-x86-64.so.2...
22322                [Thread debugging using libthread_db enabled]
22323                Using host libthread_db library "/lib64/libthread_db.so.1".
22324                main (argc=3, argv=0x7fffffffd860) at /home/blarsen/Documents/gdb-build/gdb/testsuite/../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/jit-elf-main.c:118
22325                118|  WAIT_FOR_GDB; i = 0;  /* gdb break here 1 */
22326                (gdb) PASS: gdb.base/jit-elf.exp: attach: one_jit_test-2: break here 1: attach
22327
22328         This difference only happens when GDB's configure is ran using a
22329         relative path, but seeing as testing the full path is not important for
22330         this specific test, it feels worth fixing anyway.  To fix the false
22331         positive, the regexp for checking where gdb has stopped was relaxed a
22332         little to allow the relative path.
22333
22334 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22335
22336         gdb/testsuite: fix gdb.base/msym-bp-shl when running with Clang
22337         When trying to test gdb.base/msym-bp-shl.exp using clang, it would have
22338         many failures because one of the version of the foo function was being
22339         optimized away. Adding __attribute__ ((used)) to it fixed this.
22340
22341 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22342
22343         gdb/testsuite: fix testing gdb.base/skip-inline.exp with clang
22344         When testing gdb.base/skip-inline.exp using clang, we get failures
22345         when trying to step out of functions, since clang requires one fewer
22346         step when compared to gcc.  The inferior gets increasingly out of sync
22347         as the test continues because of this difference, which generates those
22348         failures.
22349
22350         This commit fixes this by switching those hardcoded steps to
22351         gdb_step_until, to guarantee that the inferior is always synced to what
22352         the test expects.  This approach does not work for the parts that use
22353         step 2 or step 3, so when we identify that clang is being used, those
22354         tests are skipped.
22355
22356 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22357
22358         Change gdb.base/skip-solib.exp deal with lack of epilogue information
22359         When running gdb.base/skip-solib.exp, the backtrace tests could fail with
22360         compilers that associated epilogue instructions with the last statement
22361         line of the function, instead of associating it with the closing brace,
22362         despite the feature being fully functional.  As an example, when testing
22363         skipping the function square, the testsuite would show
22364
22365         Breakpoint 1, main () at (...)/binutils-gdb/gdb/testsuite/gdb.base/skip-solib-main.c:5
22366         5         return square(0);
22367         (gdb) step
22368         0x00007ffff7cef560 in __libc_start_call_main () from /lib64/libc.so.6
22369         (gdb) PASS: gdb.base/skip-solib.exp: ignoring solib file: step
22370         bt
22371          #0  0x00007ffff7cef560 in __libc_start_call_main () from /lib64/libc.so.6
22372          #1  0x00007ffff7cef60c in __libc_start_main_impl () from /lib64/libc.so.6
22373          #2  0x0000000000401065 in _start ()
22374         (gdb) FAIL: gdb.base/skip-solib.exp: ignoring solib file: bt
22375
22376         Which means that the feature is working, the testsuite is just
22377         mis-identifying it.  To avoid this problem, the skipped function calls
22378         have been sent to a line before `return`, so epilogues won't factor in.
22379
22380 2022-09-22  Bruno Larsen  <blarsen@redhat.com>
22381
22382         gdb/testsuite: Add a proc to test where compiler links the epilogue
22383         Different compilers link the epilogue of functions to different lines.
22384         As an example, gcc links it to the closing brace of the function,
22385         whereas clang links it to the last statement of the function.  This
22386         difference is important for the testsuite, since the where GDB will land
22387         after a step can be wildly different.  Where possible, this dependency
22388         should be side-stepped in the testsuite, but it isn't always possible,
22389         so this commit adds a gdb_caching_proc that is able to detect where the
22390         epilogue is linked, so tests can react accordingly.
22391
22392 2022-09-22  Clément Chigot  <chigot@adacore.com>
22393
22394         ld/testsuite: allow to force another directory for gcc linker
22395         Add a new variable "ld_testsuite_tmpdir" to enable manual configuration
22396         of the -B flag added to gcc calls. This flag ensure that gcc is invoking
22397         the linker and the assembler we want to test.
22398
22399         When launching the testsuite outside of the build tree, the links made
22400         by the testsuite in tmpdir/ld will point to nothing. Thus, even with the
22401         PATH correctly setup towards the linker directory, gcc might end up
22402         falling back to its default linker. Hence this variable to ensure that
22403         gcc, whatever happens, is using the linker we want.
22404
22405         ld/ChangeLog:
22406
22407                 * testsuite/config/default.exp: Allow to change -B flag with
22408                 ld_testsuite_bindir variable.
22409
22410 2022-09-22  Clément Chigot  <chigot@adacore.com>
22411
22412         ld/testsuite: skip bootstrap.exp when OFILES are missing
22413         OFILES are normally provided through an environment variable set by
22414         Makefiles. However, when launching the testsuite directly through
22415         runtest outside the build tree, it can be hard to retrieve them.
22416         Thus, they can be missing.
22417         Instead of letting tcl raise an error when trying to access this
22418         OFILES variable, skip bootstrap.exp if it doesn't exist.
22419
22420         ld/ChangeLog:
22421
22422                 * testsuite/ld-bootstrap/bootstrap.exp: Skip if OFILES is
22423                 missing
22424
22425 2022-09-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
22426
22427         RISC-V: Remove "b" operand type from disassembler
22428         There are a few operand types not used by any RISC-V instructions.
22429
22430         -   Cx
22431         -   Vf
22432         -   Ve
22433         -   [
22434         -   ]
22435         -   b
22436
22437         But most of them has a reasoning to keep them:
22438
22439         -   Cx     : Same as "Ct" except it has a constraint to have rd == rs2
22440                      (similar to "Cw").  Although it hasn't used, its role is clear
22441                      enough to implement a new instruction with this operand type.
22442         -   Vf, Ve : Used by vector AMO instructions (not ratified and real
22443                      instructions are not upstreamed yet).
22444         -   [, ]   : Unused tokenization symbols.  Reserving them is not harmful
22445                      and a vendor may use this symbol for special purposes.
22446
22447         ... except "b".  I could not have found any reference to this operand type
22448         except it works like the "s" operand type.  Historically, it seems... it's
22449         just unused from the beginning.  Its role is not clear either.
22450
22451         On such cases, we should vacate this room for the new operand type with
22452         much clearer roles.
22453
22454         opcodes/ChangeLog:
22455
22456                 * riscv-dis.c (print_insn_args): Remove 'b' operand type.
22457
22458 2022-09-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
22459
22460         RISC-V: Add macro-only operands to validate_riscv_insn
22461         Although they are not (and should not be) reachable, following macro-only
22462         operands are parsed in the `validate_riscv_insn' function and ignored.
22463         That function also notes that they are macro-only.
22464
22465         -   "A"
22466         -   "B"
22467         -   "I"
22468
22469         Following this convention, this commit adds three remaining macro-only
22470         operands to this function.  By doing this, we could instead choose to reject
22471         those operands from appearing in regular instructions later.
22472
22473         -   "c"   (used by call, tail and jump macros)
22474         -   "VM"  (used by vmsge.vx and vmsgeu.vx macros)
22475         -   "VT"  (likewise)
22476
22477         gas/ChangeLog:
22478
22479                 * config/tc-riscv.c (validate_riscv_insn): Add "c", "VM" and "VT"
22480                 macro-only operand types.
22481
22482 2022-09-22  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
22483
22484         gprofng: fix -Wduplicated-cond warning
22485         gprofng/ChangeLog
22486         2022-09-21  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
22487
22488                 * src/collctrl.cc: Fix -Wduplicated-cond warning.
22489
22490 2022-09-22  GDB Administrator  <gdbadmin@sourceware.org>
22491
22492         Automatic date update in version.in
22493
22494 2022-09-21  Alan Modra  <amodra@gmail.com>
22495
22496         bfd BLD-POTFILES.in dependencies
22497         A file that consists of a list of files doesn't depend on those files
22498         being built.  This patch came from trying to avoid a maintainer-mode
22499         make -j bug, where the recipe for targmatch.h was being run twice in
22500         parallel.  Typical output shown below.
22501
22502         make[2]: Entering directory '/build/gas/all/bfd'
22503           GEN      bfdver.h
22504           GEN      elf32-target.h
22505           GEN      elf64-target.h
22506           GEN      targmatch.h
22507         Making info in po
22508         make[3]: Entering directory '/build/gas/all/bfd/po'
22509         cd .. && make po/SRC-POTFILES.in
22510         cd .. && make po/BLD-POTFILES.in
22511         make[4]: Entering directory '/build/gas/all/bfd'
22512           GEN      elf32-aarch64.c
22513           GEN      elf64-aarch64.c
22514           GEN      elf32-ia64.c
22515           GEN      elf64-ia64.c
22516           GEN      elf32-loongarch.c
22517           GEN      elf64-loongarch.c
22518           GEN      elf32-riscv.c
22519           GEN      elf64-riscv.c
22520           GEN      peigen.c
22521           GEN      pepigen.c
22522           GEN      pex64igen.c
22523           GEN      pe-aarch64igen.c
22524           GEN      targmatch.h
22525         make[4]: Entering directory '/build/gas/all/bfd'
22526           CCLD     doc/chew.stamp
22527         mv: cannot stat 'targmatch.new': No such file or directory
22528         make[4]: *** [Makefile:2325: targmatch.h] Error 1
22529
22530                 * Makefile.am (po/BLD-POTFILES.in): Don't depend on $(BLD_POTFILES).
22531                 (po/SRC-POTFILES.in): Don't depend on $(SRC_POTFILES).
22532
22533 2022-09-21  Simon Marchi  <simon.marchi@polymtl.ca>
22534
22535         gdbsupport: move fileio_errno_to_host to fileio.{h,cc} and rename
22536         gdb_bfd.c and remote.c contain identical implementations of a
22537         fileio_error -> errno function.  Factor that out to
22538         gdbsupport/fileio.{h,cc}.
22539
22540         Rename it fileio_error_to_host, for symmetry with host_to_fileio_error.
22541
22542         Change-Id: Ib9b8807683de2f809c94a5303e708acc2251a0df
22543
22544 2022-09-21  Simon Marchi  <simon.marchi@efficios.com>
22545
22546         gdbsupport: convert FILEIO_* macros to an enum
22547         Converting from free-form macros to an enum gives a bit of type-safety.
22548         This caught places where we would assign host error numbers to what
22549         should contain a target fileio error number, for instance in
22550         target_fileio_pread.
22551
22552         I added the FILEIO_SUCCESS enumerator, because
22553         remote.c:remote_hostio_parse_result initializes the remote_errno output
22554         variable to 0.  It seems better to have an explicit enumerator than to
22555         assign a value for which there is no enumerator.  I considered
22556         initializing this variable to FILEIO_EUNKNOWN instead, such that if the
22557         remote side replies with an error and omits the errno value, we'll get
22558         an errno that represents an error instead of 0 (which reprensents no
22559         error).  But it's not clear what the consequences of that change would
22560         be, so I prefer to err on the side of caution and just keep the existing
22561         behavior (there is no intended change in behavior with this patch).
22562
22563         Note that remote_hostio_parse_resul still reads blindly what the remote
22564         side sends as a target errno into this variable, so we can still end up
22565         with a nonsensical value here.  It's not good, but out of the scope of
22566         this patch.
22567
22568         Convert host_to_fileio_error and fileio_errno_to_host to return / accept
22569         a fileio_error instead of an int, and cascade the change in the whole
22570         chain that uses that.
22571
22572         Change-Id: I454b0e3fcf0732447bc872252fa8e57d138b0e03
22573
22574 2022-09-21  Simon Marchi  <simon.marchi@efficios.com>
22575
22576         gdbsupport: move include/gdb/fileio.h contents to fileio.h
22577         I don't see why include/gdb/fileio.h is placed there.  It's not
22578         installed by "make install", and it's not included by anything outside
22579         of gdb/gdbserver/gdbsupport.
22580
22581         Move its content back to gdbsupport/fileio.h.  I have omitted the bits
22582         inside an `#if 0`, since it's obviously not used, as well as the
22583         "limits" constants, which are also unused.
22584
22585         Change-Id: I6fbc2ea10fbe4cfcf15f9f76006b31b99c20e5a9
22586
22587 2022-09-21  Simon Marchi  <simon.marchi@efficios.com>
22588
22589         gdbsupport: change path_join parameter to array_view<const char *>
22590         When a GDB built with -D_GLIBCXX_DEBUG=1 reads a binary with a single
22591         character name, we hit this assertion failure:
22592
22593             $ ./gdb -q --data-directory=data-directory -nx ./x
22594             /usr/include/c++/12.1.0/string_view:239: constexpr const std::basic_string_view<_CharT, _Traits>::value_type& std::basic_string_view<_CharT, _Traits>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; const_reference = const char&; size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed.
22595
22596         The backtrace:
22597
22598             #3  0x00007ffff6c0f002 in std::__glibcxx_assert_fail (file=<optimized out>, line=<optimized out>, function=<optimized out>, condition=<optimized out>) at /usr/src/debug/gcc/libstdc++-v3/src/c++11/debug.cc:60
22599             #4  0x000055555da8a864 in std::basic_string_view<char, std::char_traits<char> >::operator[] (this=0x7fffffffcc30, __pos=1) at /usr/include/c++/12.1.0/string_view:239
22600             #5  0x00005555609dcb88 in path_join[abi:cxx11](gdb::array_view<std::basic_string_view<char, std::char_traits<char> > const>) (paths=...) at /home/simark/src/binutils-gdb/gdbsupport/pathstuff.cc:203
22601             #6  0x000055555e0443f4 in path_join<char const*, char const*> () at /home/simark/src/binutils-gdb/gdb/../gdbsupport/pathstuff.h:84
22602             #7  0x00005555609dc336 in gdb_realpath_keepfile[abi:cxx11](char const*) (filename=0x6060000a8d40 "/home/simark/build/binutils-gdb-one-target/gdb/./x") at /home/simark/src/binutils-gdb/gdbsupport/pathstuff.cc:122
22603             #8  0x000055555ebd2794 in exec_file_attach (filename=0x7fffffffe0f9 "./x", from_tty=1) at /home/simark/src/binutils-gdb/gdb/exec.c:471
22604             #9  0x000055555f2b3fb0 in catch_command_errors (command=0x55555ebd1ab6 <exec_file_attach(char const*, int)>, arg=0x7fffffffe0f9 "./x", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:513
22605             #10 0x000055555f2b7e11 in captured_main_1 (context=0x7fffffffdb60) at /home/simark/src/binutils-gdb/gdb/main.c:1209
22606             #11 0x000055555f2b9144 in captured_main (data=0x7fffffffdb60) at /home/simark/src/binutils-gdb/gdb/main.c:1319
22607             #12 0x000055555f2b9226 in gdb_main (args=0x7fffffffdb60) at /home/simark/src/binutils-gdb/gdb/main.c:1344
22608             #13 0x000055555d938c5e in main (argc=5, argv=0x7fffffffdcf8) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
22609
22610         The problem is this line in path_join:
22611
22612             gdb_assert (strlen (path) == 0 || !IS_ABSOLUTE_PATH (path));
22613
22614         ... where `path` is "x".  IS_ABSOLUTE_PATH eventually calls
22615         HAS_DRIVE_SPEC_1:
22616
22617             #define HAS_DRIVE_SPEC_1(dos_based, f)                  \
22618               ((f)[0] && ((f)[1] == ':') && (dos_based))
22619
22620         This macro accesses indices 0 and 1 of the input string.  However, `f`
22621         is a string_view of length 1, so it's incorrect to try to access index
22622         1.  We know that the string_view's underlying object is a null-terminated
22623         string, so in practice there's no harm.  But as far as the string_view
22624         is concerned, index 1 is considered out of bounds.
22625
22626         This patch makes the easy fix, that is to change the path_join parameter
22627         from a vector of to a vector of `const char *`.  Another solution would
22628         be to introduce a non-standard gdb::cstring_view class, which would be a
22629         view over a null-terminated string.  With that class, it would be
22630         correct to access index 1, it would yield the NUL character.  If there
22631         is interest in having this class (it has been mentioned a few times in
22632         the past) I can do it and use it here.
22633
22634         This was found by running tests such as gdb.ada/arrayidx.exp, which
22635         produce 1-char long filenames, so adding a new test is not necessary.
22636
22637         Change-Id: Ia41a16c7243614636b18754fd98a41860756f7af
22638
22639 2022-09-21  Simon Marchi  <simon.marchi@polymtl.ca>
22640
22641         gdb: remove TYPE_LENGTH
22642         Remove the macro, replace all uses with calls to type::length.
22643
22644         Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
22645
22646 2022-09-21  Simon Marchi  <simon.marchi@polymtl.ca>
22647
22648         gdb: add type::length / type::set_length
22649         Add the `length` and `set_length` methods on `struct type`, in order to remove
22650         the `TYPE_LENGTH` macro.  In this patch, the macro is changed to use the
22651         getter, so all the call sites of the macro that are used as a setter are
22652         changed to use the setter method directly.  The next patch will remove the
22653         macro completely.
22654
22655         Change-Id: Id1090244f15c9856969b9be5006aefe8d8897ca4
22656
22657 2022-09-21  Simon Marchi  <simon.marchi@polymtl.ca>
22658
22659         gdb: remove TYPE_TARGET_TYPE
22660         Remove the macro, replace all uses by calls to type::target_type.
22661
22662         Change-Id: Ie51d3e1e22f94130176d6abd723255282bb6d1ed
22663
22664 2022-09-21  Simon Marchi  <simon.marchi@polymtl.ca>
22665
22666         gdb: add type::target_type / type::set_target_type
22667         Add the `target_type` and `set_target_type` methods on `struct type`, in order
22668         to remove the `TYPE_TARGET_TYPE` macro.  In this patch, the macro is changed to
22669         use the getter, so all the call sites of the macro that are used as a setter
22670         are changed to use the setter method directly.  The next patch will remove the
22671         macro completely.
22672
22673         Change-Id: I85ce24d847763badd34fdee3e14b8c8c14cb3161
22674
22675 2022-09-21  Tsukasa OI  <research_trasio@irq.a4lg.com>
22676
22677         RISC-V: Fix riscv_set_tso declaration
22678         To avoid -Werror=strict-prototypes, this commit changes () to (void).
22679         This is because "()" possibly means a function prototype with indeterminate
22680         arguments on old C standards.
22681
22682         gas/ChangeLog:
22683
22684                 * config/tc-riscv.c (riscv_set_tso): Fix declaration.
22685
22686 2022-09-21  Alan Modra  <amodra@gmail.com>
22687
22688         PR29566, objdump -p considers an empty .gnu.version_r invalid
22689         Allow and ignore an empty section.
22690
22691                 PR 29566
22692                 * elf.c (bfd_section_from_shdr): Don't set elf_dynverdef or
22693                 elf_dynverref for empty sections.
22694                 (_bfd_elf_slurp_version_tables): Remove now redundant tests.
22695
22696 2022-09-21  Tsukasa OI  <research_trasio@irq.a4lg.com>
22697
22698         RISC-V: Set EF_RISCV_TSO also on .option arch
22699         This is a minor fix to commit 96462b012988d35ebb1137a2ad9fd0a96547d79a
22700         ("RISC-V: Implement Ztso extension").  Currently, it sets EF_RISCV_TSO ELF
22701         flag when initial ISA string contains the 'Ztso' extension.  However, GAS
22702         has a way to update the ISA string: ".option arch".
22703
22704         When the architecture is updated by ".option arch", EF_RISCV_RVC ELF flag
22705         is set when the 'C' extension is detected.  Analogously, this commit sets
22706         the EF_RISCV_TSO when the 'Ztso' extension is detected.
22707
22708         gas/ChangeLog:
22709
22710                 * config/tc-riscv.c (s_riscv_option): Set TSO ELF flag if the
22711                 'Ztso' extension is specified via ".option arch" directive.
22712
22713 2022-09-21  Alan Modra  <amodra@gmail.com>
22714
22715         PR29573, addr2line doesn't display file/line for local symbols
22716         The DWARF standard is clear that DW_AT_linkage_name is optional.
22717         Compilers may not provide the attribute on functions and variables,
22718         even though the language mangles names.  g++ does not for local
22719         variables and functions.  Without DW_AT_linkage_name, mangled object
22720         file symbols can't be directly matched against the source-level
22721         DW_AT_name in DWARF info.  One possibility is demangling the object
22722         file symbols, but that comes with its own set of problems:
22723         1) A demangler might not be available for the compiler/language.
22724         2) Demangling doesn't give the source function name as stored in
22725            DW_AT_name.  Class and template parameters must be stripped at
22726            least.
22727
22728         So this patch takes a simpler approach.  A symbol matches DWARF info
22729         if the DWARF address matches the symbol address, and if the symbol
22730         name contains the DWARF name as a sub-string.  Very likely the name
22731         matching is entirely superfluous.
22732
22733                 PR 29573
22734                 * dwarf.c (lookup_symbol_in_function_table): Match a symbol
22735                 containing the DWARF source name as a substring.
22736                 (lookup_symbol_in_variable_table): Likewise.
22737                 (_bfd_dwarf2_find_nearest_line_with_alt): If stash_find_line_fast
22738                 returns false, fall back to comp_unit_find_line.
22739
22740 2022-09-21  Alan Modra  <amodra@gmail.com>
22741
22742         dwarf2.c: simplify best_fit_len tests
22743                 * dwarf2.c (lookup_address_in_function_table): Simplify
22744                 best_fit_len test.
22745                 (info_hash_lookup_funcinfo): Likewise.
22746                 (lookup_symbol_in_function_table): Likewise, also reorder tests
22747                 and check "file" is set.
22748                 (lookup_symbol_in_variable_table): Reorder tests.
22749
22750 2022-09-21  Alan Modra  <amodra@gmail.com>
22751
22752         dwarf2.c: mangle_style
22753         non_mangled incorrectly returned "true" for Ada.  Correct that, and
22754         add a few more non-mangled entries.  Return a value suitable for
22755         passing to cplus_demangle to control demangling.
22756
22757                 * dwarf2.c: Include demangle.h.
22758                 (mangle_style): Rename from non_mangled.  Return DMGL_* value
22759                 to suit lang.  Adjust all callers.
22760
22761 2022-09-21  Alan Modra  <amodra@gmail.com>
22762
22763         dwarf2.c remove varinfo and funcinfo sec field
22764         The "sec" field in these structures is only set and used in lookup
22765         functions.  It always starts off as NULL.  So the only possible effect
22766         of the field is to modify the return of the lookup, which was its
22767         purpose back in 2005 when HJ fixed PR990.  Since then we solved the
22768         problem of relocatable object files with the fix for PR2338, so this
22769         field is now redundant.
22770
22771                 * dwarf.c (struct funcinfo, struct varinfo): Remove "sec" field.
22772                 (lookup_symbol_in_function_table): Don't set or test "sec".
22773                 (lookup_symbol_in_variable_table): Likewise.
22774                 (info_hash_lookup_funcinfo, info_hash_lookup_varinfo): Likewise.
22775
22776 2022-09-21  Tsukasa OI  <research_trasio@irq.a4lg.com>
22777
22778         configure: Pass CPPFLAGS_FOR_BUILD to subdirs
22779         Because CPPFLAGS_FOR_BUILD is used in some subdirectories (through
22780         bfd/warning.m4), not AC_SUBSTing the variable causes minor issues.
22781
22782         Fortunately, it didn't cause severe errors but error messages related to
22783         @CPPFLAGS_FOR_BUILD@ (not AC_SUBSTed CPPFLAGS_FOR_BUILD variable passed
22784         to subdirectories through Makefile) remain in config.log.
22785
22786         To avoid invalid invocation of preprocessor for build environment, we
22787         need to set proper CPPFLAGS_FOR_BUILD (may be empty) and pass it to
22788         subdirectories that need it.  This is what this commit does.
22789
22790         ChangeLog:
22791
22792                 * configure.ac: Pass CPPFLAGS_FOR_BUILD to subdirectories.
22793                 * configure: Regenerate.
22794
22795 2022-09-21  Shihua  <shihua@iscas.ac.cn>
22796
22797         RISC-V: Implement Ztso extension
22798         This patch support ZTSO extension. It will turn on the tso flag for elf_flags
22799         once we have enabled Ztso extension.  This is intended to implement v0.1 of
22800         the proposed specification which can be found in Chapter 25 of,
22801         https://github.com/riscv/riscv-isa-manual/releases/download/draft-20220723-10eea63/riscv-spec.pdf.
22802
22803         bfd\ChangeLog:
22804
22805                 * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Set TSO flag.
22806                 * elfxx-riscv.c: Add Ztso's arch.
22807
22808         binutils\ChangeLog:
22809
22810                 * readelf.c (get_machine_flags): Set TSO flag.
22811
22812         gas\ChangeLog:
22813
22814                 * config/tc-riscv.c (riscv_set_tso): Ditto.
22815                 (riscv_set_arch): Ditto.
22816                 * testsuite/gas/riscv/ztso.d: New test.
22817
22818         include\ChangeLog:
22819
22820                 * elf/riscv.h (EF_RISCV_TSO): Ditto.
22821
22822 2022-09-21  Nelson Chu  <nelson@rivosinc.com>
22823
22824         RISC-V: Always generate R_RISCV_CALL_PLT reloc for call in assembler.
22825         Since we have the same behaviors of CALL and CALL_PLT relocs in linker for now,
22826         https://github.com/bminor/binutils-gdb/commit/3b1450b38c644f99aa2e211747b428b9f8d15cca
22827
22828         And the psabi already deprecate the CALL reloc,
22829         https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0
22830
22831         Therefore, we should always generate R_RISCV_CALL_PLT reloc for call, even if
22832         it has @plt postfix.  I believe LLVM (https://reviews.llvm.org/D132530) already
22833         support this, so GNU as should do the same thing.
22834
22835         gas/
22836                 * config/tc-riscv.c (riscv_ip): Always generate CALL_PLT reloc for
22837                 call, even if it has @plt postfix.
22838                 * testsuite/gas/riscv/no-relax-reloc.d: Updated CALL to CALL_PLT.
22839                 * testsuite/gas/riscv/relax-reloc.d: Likewise.
22840         ld/
22841                 * testsuite/ld-riscv-elf/variant_cc-r.d: Updated CALL to CALL_PLT.
22842
22843 2022-09-21  GDB Administrator  <gdbadmin@sourceware.org>
22844
22845         Automatic date update in version.in
22846
22847 2022-09-21  Alan Modra  <amodra@gmail.com>
22848
22849         Re: PowerPC64 pcrel got relocs against local symbols
22850         The last patch wasn't all that shiny.  There are rather a lot more
22851         relocations that can hit the assertion in md_apply_fix if the symbol
22852         is local or absolute.  Fix them all.
22853
22854                 * config/tc-ppc.c (ppc_force_relocation): Add all relocs that
22855                 expect a symbol in md_apply_fix.  Remove tls pcrel relocs
22856                 already covered in general tls match range.
22857
22858 2022-09-21  Alan Modra  <amodra@gmail.com>
22859
22860         looping in alpha_vms_slurp_relocs
22861         The direct cause for the looping was failing to test for error return
22862         from _bfd_vms_get_object_record inside a while(1) loop.  Fix that.
22863         Also record status of first alpha_vms_slurp_relocs call and return
22864         that for all subsequent calls.  (The object format has one set of
22865         relocation records for all sections.)  If the first call fails, all
22866         others should too.
22867
22868                 * vms-alpha.c (struct vms_private_data_struct): Make reloc_done
22869                 a tri-state int.
22870                 (alpha_vms_slurp_relocs): Set reloc_done to 1 on success, -1 on
22871                 failure.  Return that status on subsequent calls.  Check
22872                 _bfd_vms_get_object_record return status.
22873                 (alpha_vms_get_reloc_upper_bound): Return status from
22874                 alpha_vms_slurp_relocs.
22875                 (alpha_vms_write_exec): Exclude sections with contents NULL due
22876                 to previous errors from layout, and don't try to write them.
22877
22878 2022-09-20  Dmitry Selyutin  <ghostmansd@gmail.com>
22879
22880         ppc/svp64: test setvl ms operand
22881
22882 2022-09-20  Tom Tromey  <tom@tromey.com>
22883
22884         Make stdin_event_handler static
22885         I noticed that stdin_event_handler is only used in event-top.c, so
22886         this patch changes it to be 'static'.
22887
22888 2022-09-20  Tom Tromey  <tromey@adacore.com>
22889
22890         Constify some target_so_ops instances
22891         This changes some target_so_ops instances to be const.  This makes
22892         their use a little more obvious (they can't be mutated) and also
22893         allows for the removal of some initialization code.
22894
22895         Move solib_ops into gdbarch
22896         This changs solib_ops to be an ordinary gdbarch value and updates all
22897         the uses.  This removes a longstanding FIXME and makes the code
22898         somewhat cleaner as well.
22899
22900         Remove current_target_so_ops
22901         current_target_so_ops is only set in a single place.  It seems better
22902         to simply remove it.
22903
22904 2022-09-20  Andrew Burgess  <aburgess@redhat.com>
22905
22906         gdb/testsuite: add a debuginfod-support.exp helper library
22907         We currently have a single test for GDB's debuginfod support, this is
22908         gdb.debuginfod/fetch_src_and_symbols.exp, this script does all the
22909         setup, starts debuginfod, and then does the testing.
22910
22911         This commit tries to split the existing script in two, there is a new
22912         library lib/debuginfod-support.exp, which contains a helper functions
22913         related to running debuginfod tests.  All the code in the new library
22914         is basically copied from the existing test case (which is why I
22915         retained the copyright date range on the new library), with some minor
22916         adjustments to try and make the code a little more generic.
22917
22918         One change I made, for example, is the library offers functions to
22919         shut down debuginfod, previously we just relied on expect shutting
22920         down debuginfod when dejagnu completed.
22921
22922         The existing test script is updated to make use of the new library
22923         code, and this test is still passing for me.  The only change in the
22924         test results is a single test where I changed the name to remove the
22925         port number from the test name - the port number can change from run
22926         to run, so could make it hard to compare test results.
22927
22928         I have also done a little light house keeping on the original test
22929         script, updating and adding new comments, and making use of
22930         proc_with_prefix in a couple of places.
22931
22932 2022-09-20  liuzhensong  <liuzhensong@loongson.cn>
22933
22934         LoongArch: Set macro SUB_SEGMENT_ALIGN to 0.
22935
22936 2022-09-20  Nick Clifton  <nickc@redhat.com>
22937
22938         Stop strip from complaining about empty note sections when stripping a binary for a second time.
22939                 * objcopy.c (copy_object): Do not issue a warning message when
22940                 encountering empty .gnu.build.attribute sections.
22941
22942         New Serbian translations for various binutils sub-directories.
22943
22944 2022-09-20  Zeke Lu  <lvzecai@gmail.com>
22945
22946         Bug 29580 - typo in warning message: .note.gnu.build-id data size is too bug
22947
22948 2022-09-20  Xi Ruoyao  <xry111@xry111.site>
22949
22950         LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs
22951         loongarch_elf_finish_dynamic_symbol is called after elf_link_sort_relocs
22952         if -z combreloc.  elf_link_sort_relocs redistributes the contents of
22953         .rela.* sections those would be merged into .rela.dyn, so the slot for
22954         R_LARCH_IRELATIVE may be out of relplt->contents now.
22955
22956         To make things worse, the boundary check
22957
22958             dyn < dyn + relplt->size / sizeof (*dyn)
22959
22960         is obviously wrong ("x + 10 < x"? :), causing the issue undetected
22961         during the linking process and the resulted executable suddenly crashes
22962         at runtime.
22963
22964         The issue was found during an attempt to add static-pie support to the
22965         toolchain.
22966
22967         Fix it by iterating through the inputs of .rela.dyn to find the slot.
22968
22969 2022-09-20  Xi Ruoyao  <xry111@xry111.site>
22970
22971         LoongArch: Don't write into GOT for local ifunc
22972         Local ifuncs are always resolved at runtime via R_LARCH_IRELATIVE, so
22973         there is no need to write anything into GOT.  And when we write the GOT
22974         we actually trigger a heap-buffer-overflow: If a and b are different
22975         sections, we cannot access something in b with "a->contents + (offset
22976         from a)" because "a->contents" and "b->contents" are heap buffers
22977         allocated separately, not slices of a large buffer.
22978
22979         So stop writing into GOT for local ifunc now.
22980
22981 2022-09-20  GDB Administrator  <gdbadmin@sourceware.org>
22982
22983         Automatic date update in version.in
22984
22985 2022-09-19  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
22986
22987         gprofng: build documentation only if BUILD_MAN is true
22988         gprofng/ChangeLog
22989         2022-09-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
22990
22991                 PR gprofng/29476
22992                 * gprofng/Makefile.am: Build documentation only if BUILD_MAN is true
22993                 * gprofng/Makefile.in: Rebuild.
22994                 * gprofng/configure: Rebuild.
22995
22996 2022-09-19  Enze Li  <enze.li@hotmail.com>
22997
22998         gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler
22999         I see this error when building with clang,
23000
23001           CXX    gdb_bfd.o
23002         gdb_bfd.c:1180:43: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
23003           const std::string str = string_vprintf (fmt, ap_copy);
23004                                                   ^~~
23005         1 error generated.
23006
23007         This patch adds missing ATTRIBUTE_PRINTF to fix the error.
23008
23009         Tested on x86_64-linux with gcc 12 and clang 14.
23010
23011 2022-09-19  GDB Administrator  <gdbadmin@sourceware.org>
23012
23013         Automatic date update in version.in
23014
23015 2022-09-18  GDB Administrator  <gdbadmin@sourceware.org>
23016
23017         Automatic date update in version.in
23018
23019 2022-09-17  Tom de Vries  <tdevries@suse.de>
23020
23021         [gdb/symtab] Fix "file index out of range" complaint
23022         With the test-case included in this commit, we run into this FAIL:
23023         ...
23024         (gdb) p var^M
23025         During symbol reading: file index out of range^M
23026         $1 = 0^M
23027         (gdb) FAIL: gdb.dwarf2/dw2-no-code-cu.exp: p var with no complaints
23028         ...
23029
23030         This is a regression since commit 6d263fe46e0 ("Avoid bad breakpoints with
23031         --gc-sections"), which contains this change in read_file_scope:
23032         ...
23033         -  handle_DW_AT_stmt_list (die, cu, fnd, lowpc);
23034         +  if (lowpc != highpc)
23035         +    handle_DW_AT_stmt_list (die, cu, fnd, lowpc);
23036         ...
23037
23038         The change intends to avoid a problem with a check in
23039         lnp_state_machine::check_line_address, but also prevents the file and dir
23040         tables from being read, which causes the complaint.
23041
23042         Fix the FAIL by reducing the scope of the "lowpc != highpc" condition to the
23043         call to dwarf_decode_lines in handle_DW_AT_stmt_list.
23044
23045         Tested on x86_64-linux.
23046
23047         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29561
23048
23049 2022-09-17  GDB Administrator  <gdbadmin@sourceware.org>
23050
23051         Automatic date update in version.in
23052
23053 2022-09-17  Kevin Buettner  <kevinb@redhat.com>
23054
23055         BFD error message suppression test case
23056         This commit adds a GDB test case which tests GDB's BFD error handler
23057         hook for suppressing output of all but the first identical messages.
23058
23059         See the comment at the beginning of bfd-errors.exp for details about
23060         this new test.
23061
23062         I've tested this test for both 32- and 64-bit ELF files and also
23063         on both little endian and big endian machines.  It also works for
23064         both native and remote targets.  The only major restriction is that
23065         it only works for ELF targets.
23066
23067 2022-09-17  Kevin Buettner  <kevinb@redhat.com>
23068
23069         Suppress printing of superfluous BFD error messages
23070         This commit adds a hook to the BFD error handler for suppressing
23071         identical messages which have been output once already.
23072
23073         It's motivated by this Fedora bug...
23074
23075         https://bugzilla.redhat.com/show_bug.cgi?id=2083315
23076
23077         ...in which over 900,000 BFD error messages are output when attaching
23078         to firefox.  From the bug report, the messages all say:
23079
23080         BFD: /usr/lib/debug/usr/lib64/firefox/libxul.so-100.0-2.fc35.x86_64.debug: attempt to load strings from a non-string section (number 38)
23081
23082         Since there's no (additional) context which might assist the user in
23083         determining what's wrong, there's really no point in outputting more
23084         than one message.  Of course, if BFD should output some
23085         other/different message, it should be output too, but all future
23086         messages identical to those already output should be suppressed.
23087
23088         For the firefox problem, it turned out that there were only 37
23089         sections, but something was referring to section #38.  I haven't
23090         investigated further to find out how this came to be.
23091
23092         Despite this problem, useful debugging might still be done, especially
23093         if the user doesn't care about debugging the problematic library.
23094
23095         If it turns out that knowing the quantity of messages might be useful,
23096         I've implemented the suppression mechanism by keeping a count of each
23097         identical message.  A new GDB command, perhaps a 'maintenance'
23098         command, could be added to print out each message along with the
23099         count.  I haven't implemented this though because I'm not convinced of
23100         its utility.  Also, the BFD message printer has support for BFD-
23101         specific format specifiers.  The BFD message strings that GDB stores
23102         in its map are sufficient for distinguishing messages from each
23103         other, but are not identical to those output by BFD's default error
23104         handler.  So, that problem would need to be solved too.
23105
23106 2022-09-16  Tom de Vries  <tdevries@suse.de>
23107
23108         [gdb/symtab] Handle named DW_TAG_unspecified_type DIE
23109         With the test-case included in the patch, we run into:
23110         ...
23111         (gdb) info types -q std::nullptr_t^M
23112         During symbol reading: unsupported tag: 'DW_TAG_unspecified_type'^M
23113         ^M
23114         File /usr/include/c++/7/x86_64-suse-linux/bits/c++config.h:^M
23115         2198:   typedef decltype(nullptr) std::nullptr_t;^M
23116         (gdb) FAIL: gdb.dwarf2/nullptr_t.exp: info types -q std::nullptr_t \
23117           without complaint
23118         ...
23119
23120         Fix the complaint by handling DW_TAG_unspecified_type in new_symbol, and verify
23121         in the test-case using "maint print symbols" that the symbol exists.
23122
23123         Tested on x86_64-linux, with gcc 7.5.0 and clang 13.0.
23124
23125         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17271
23126
23127 2022-09-16  Tom de Vries  <tdevries@suse.de>
23128
23129         [gdb/tdep] Fix PowerPC IEEE 128-bit format arg passing
23130         On a powerpc system with gcc 12 built to default to 128-bit IEEE long double,
23131         I run into:
23132         ...
23133         (gdb) print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)^M
23134         $8 = 0 + 0i^M
23135         (gdb) FAIL: gdb.base/varargs.exp: print \
23136           find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)
23137         ...
23138
23139         This is due to incorrect handling of the argument in ppc64_sysv_abi_push_param.
23140
23141         Fix this and similar cases, and expand the test-case to test handling of
23142         homogeneous aggregates.
23143
23144         Tested on ppc64le-linux, power 10.
23145
23146         Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com>
23147         Tested-by: Carl Love <cel@us.ibm.com>
23148         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29543
23149
23150 2022-09-16  Tom de Vries  <tdevries@suse.de>
23151
23152         [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64
23153         [ Another attempt at fixing the problem described in commit cd919f5533c
23154         ("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp"). ]
23155
23156         When running the test-case gdb.dwarf2/dw2-dir-file-name.exp with
23157         aarch64-linux, we run into:
23158         ...
23159         (gdb) continue^M
23160         Continuing.^M
23161         ^M
23162         Breakpoint 2, compdir_missing__ldir_missing__file_basename () at \
23163           tmp-dw2-dir-file-name.c:999^M
23164         (gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
23165           compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
23166           compdir_missing__ldir_missing__file_basename
23167         ...
23168
23169         The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
23170         address 0x400608 starts at a line entry:
23171         ...
23172         CU: tmp-dw2-dir-file-name.c:
23173         File name                    Line number    Starting address    View    Stmt
23174         tmp-dw2-dir-file-name.c              999            0x400608               x
23175         tmp-dw2-dir-file-name.c             1000            0x40062c               x
23176         tmp-dw2-dir-file-name.c                -            0x40062c
23177         ...
23178         and therefore the breakpoint is printed without instruction address.
23179
23180         In contrast, for x86_64-linux, we have the breakpoint printed with instruction
23181         address:
23182         ...
23183         (gdb) continue^M
23184         Continuing.^M
23185         ^M
23186         Breakpoint 2, 0x004004c1 in compdir_missing__ldir_missing__file_basename () \
23187           at tmp-dw2-dir-file-name.c:999^M
23188         (gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \
23189           compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
23190           compdir_missing__ldir_missing__file_basename
23191         ...
23192
23193         The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
23194         address 0x004004c1 doesn't start at a line entry:
23195         ...
23196         CU: tmp-dw2-dir-file-name.c:
23197         File name                    Line number    Starting address    View    Stmt
23198         tmp-dw2-dir-file-name.c              999            0x4004bd               x
23199         tmp-dw2-dir-file-name.c             1000            0x4004d3               x
23200         tmp-dw2-dir-file-name.c                -            0x4004d3
23201         ...
23202
23203         Fix this by:
23204         - unifying behaviour between the archs by adding an explicit line number entry
23205           for the address compdir_missing__ldir_missing__file_basename_label, making
23206           the FAIL reproducible on x86_64-linux.
23207         - expecting the breakpoint to be printed without instruction address.
23208
23209         Tested on x86_64-linux and aarch64-linux.
23210
23211 2022-09-16  Tom de Vries  <tdevries@suse.de>
23212
23213         [gdb] Handle pending ^C after rl_callback_read_char
23214         In completion tests in various test-cases, we've been running into these
23215         "clearing input line" timeouts:
23216         ...
23217         (gdb) $cmd^GPASS: gdb.gdb/unittest.exp: tab complete "$cmd"
23218         FAIL: gdb.gdb/unittest.exp: tab complete "$cmd" (clearing input line) (timeout)
23219         ...
23220         where $cmd == "maintenance selftest name_that_does_not_exist".
23221
23222         AFAIU, the following scenario happens:
23223         - expect sends "$cmd\t"
23224         - gdb detects the stdin event, and calls rl_callback_read_char until it
23225           comes to handle \t
23226         - readline interprets the \t as completion, tries to complete, fails to do so,
23227           outputs a bell (^G)
23228         - expect sees the bell, and proceeds to send ^C
23229         - readline is still in the call to rl_callback_read_char, and stores the
23230           signal in _rl_caught_signal
23231         - readline returns from the call to rl_callback_read_char, without having
23232           handled _rl_caught_signal
23233         - gdb goes to wait for the next event
23234         - expect times out waiting for "Quit", the expected reaction for ^C
23235
23236         Fix this by handling pending signals after each call to rl_callback_read_char.
23237
23238         The fix is only available for readline 8.x, if --with-system-readline provides
23239         an older version, then the fix is disabled due to missing function
23240         rl_check_signals.
23241
23242         Tested on x86_64-linux.
23243
23244         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27813
23245
23246 2022-09-16  Alan Modra  <amodra@gmail.com>
23247
23248         PowerPC64 pcrel got relocs against local symbols
23249         Not that anyone would want to indirect via the GOT when an address can
23250         be loaded directly with pla, the following:
23251
23252          pld 3,x@got@pcrel
23253         x:
23254
23255         leads to "Internal error in md_apply_fix", because the generic parts
23256         of assembler fixup handling convert the fx_pcrel fixup to one without
23257         a symbol.  Stop that happening.
23258
23259                 * config/tc-ppc.c (ppc_force_relocation): Add PLT_PCREL34 and
23260                 assorted GOT_PCREL34 relocs.
23261
23262 2022-09-16  Alan Modra  <amodra@gmail.com>
23263
23264         pdb sanity check block_size
23265                 * pdb.c (pdb_get_elt_at_index): Only allow block_size to be
23266                 512, 1024, 2048, or 4096.
23267
23268 2022-09-16  Nelson Chu  <nelson@rivosinc.com>
23269
23270         RISC-V: Make g imply zmmul extension.
23271         bfd/
23272                 * elfxx-riscv.c (riscv_implicit_subset): Moved entry of m after g,
23273                 so that g can imply zmmul.
23274         gas/
23275                 * testsuite/gas/riscv/attribute-01.d: Updated.
23276                 * testsuite/gas/riscv/attribute-02.d: Likewise.
23277                 * testsuite/gas/riscv/attribute-03.d: Likewise.
23278                 * testsuite/gas/riscv/attribute-04.d: Likewise.
23279                 * testsuite/gas/riscv/attribute-05.d: Likewise.
23280                 * testsuite/gas/riscv/attribute-10.d: Likewise.
23281                 * testsuite/gas/riscv/march-imply-g.d: Likewise.
23282                 * testsuite/gas/riscv/march-imply-unsupported.d: Likewise.
23283
23284 2022-09-16  GDB Administrator  <gdbadmin@sourceware.org>
23285
23286         Automatic date update in version.in
23287
23288 2022-09-15  Tsukasa OI  <research_trasio@irq.a4lg.com>
23289
23290         bfd, binutils, gas: Remove/mark unused variables
23291         Clang generates a warning on unused (technically, written but not read
23292         thereafter) variables.  By the default configuration (with "-Werror"), it
23293         causes a build failure (unless "--disable-werror" is specified).
23294
23295         This commit adds ATTRIBUTE_UNUSED attribute to some of them, which means
23296         they are *possibly* unused (can be used but no warnings occur when
23297         unused) and removes others.
23298
23299         bfd/ChangeLog:
23300
23301                 * elf32-lm32.c (lm32_elf_size_dynamic_sections): Mark unused
23302                 rgot_count variable.
23303                 * elf32-nds32.c (elf32_nds32_unify_relax_group): Remove unused
23304                 count variable.
23305                 * mmo.c (mmo_scan): Mark unused lineno variable.
23306
23307         binutils/ChangeLog:
23308
23309                 * windmc.c (write_rc): Remove unused i variable.
23310
23311         gas/ChangeLog:
23312
23313                 * config/tc-riscv.c (riscv_ip): Remove unused argnum variable.
23314
23315         ld/ChangeLog:
23316
23317                 * pe-dll.c (generate_reloc): Remove unused bi and page_count
23318                 variables.
23319
23320 2022-09-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
23321
23322         gprofng: fix build issues on musl
23323         gprofng/ChangeLog
23324         2022-09-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
23325
23326                 PR gprofng/29477
23327                 * configure.ac: Set __MUSL_LIBC.
23328                 * configure: Rebuild.
23329                 * common/config.h.in: Rebuild.
23330                 * src/collector_module.h: Fix compiler errors because mmap64, open64,
23331                 pwrite64 are macros and getcontext() is absent on musl.
23332                 * libcollector/collector.c: Likewise.
23333                 * libcollector/hwprofile.c: Likewise.
23334                 * libcollector/iolib.c: Likewise.
23335                 * libcollector/libcol_util.c: Likewise.
23336                 * libcollector/linetrace.c: Likewise.
23337                 * libcollector/memmgr.c: Likewise.
23338                 * libcollector/profile.c: Likewise.
23339                 * libcollector/unwind.c: Likewise.
23340                 * libcollector/dispatcher.c: Likewise.
23341                 * src/Experiment.cc: Likewise.
23342                 * libcollector/collector.h: Use dlsym() because dlvsym() is not defined
23343                 on musl.
23344                 * libcollector/iotrace.c: Remove interposition of versioned functions.
23345                 * libcollector/mmaptrace.c: Likewise.
23346                 * libcollector/libcol_util.h: Fix -Wint-to-pointer-cast warnings.
23347                 * libcollector/jprofile.c: Likewise.
23348                 * libcollector/synctrace.c: Include "collector.h".
23349                 * src/Print.cc: Use get_basename() because basename() is not defined
23350                 on musl.
23351                 * common/hwcdrv.c: Fix -Wformat= warnings.
23352
23353 2022-09-15  GDB Administrator  <gdbadmin@sourceware.org>
23354
23355         Automatic date update in version.in
23356
23357 2022-09-14  Rupesh Potharla  <Rupesh.Potharla@amd.com>
23358
23359         Binutils: Readelf testcase failing with clang
23360                 * testsuite/binutils-all/readelf.exp (readelf_wi_test): Extend
23361                 regexps to allow for output genreated by the Clang compiler.
23362
23363 2022-09-14  Alan Modra  <amodra@gmail.com>
23364
23365         looping in bfd_mach_o_fat_openr_next_archived_file
23366         mach-o.c doesn't sanity check mach-o-fat archives, making it easy for
23367         fuzzers to create an archive with mach_o_fat_archentry headers that
23368         point to the same offset.  bfd_mach_o_fat_openr_next_archived_file
23369         uses the previous element offset to find its header, and thus the next
23370         element.  If two offsets are the same, any tool reading the archive
23371         will get stuck.  This patch rejects such archives, and any with
23372         overlapping elements.
23373
23374                 * mach-o.c (overlap_previous): New function.
23375                 (bfd_mach_o_fat_archive_p): Sanity check that elements do not
23376                 overlap each other or the file and archive headers.
23377
23378 2022-09-14  Alan Modra  <amodra@gmail.com>
23379
23380         regen pofiles
23381
23382 2022-09-14  Tsukasa OI  <research_trasio@irq.a4lg.com>
23383
23384         bfd: Stop using -Wstack-usage=262144 when built with Clang
23385         Some components of GNU Binutils will pass "-Wstack-usage=262144" when
23386         "GCC >= 5.0" is detected.  However, Clang does not support "-Wstack-usage",
23387         despite that related configuration part in bfd/warning.m4 handles the latest
23388         Clang (15.0.0 as of this writing) as "GCC >= 5.0".
23389
23390         The option "-Wstack-usage" was ignored when the first version of Clang is
23391         released but even this "ignoring" behavior is removed before Clang 4.0.0.
23392         So, if we give Clang "-Wstack-usage=262144", it generates a warning, making
23393         the build failure.
23394
23395         This commit checks "__clang__" macro to prevent adding the option if the
23396         compiler is identified as Clang.
23397
23398         bfd/ChangeLog:
23399
23400                 * warning.m4: Stop appending "-Wstack-usage=262144" option when
23401                 compiled with Clang.
23402                 * configure: Regenerate.
23403
23404         binutils/ChangeLog:
23405
23406                 * configure: Regenerate.
23407
23408         gas/ChangeLog:
23409
23410                 * configure: Regenerate.
23411
23412         gold/ChangeLog:
23413
23414                 * configure: Regenerate.
23415
23416         gprof/ChangeLog:
23417
23418                 * configure: Regenerate.
23419
23420         ld/ChangeLog:
23421
23422                 * configure: Regenerate.
23423
23424         opcodes/ChangeLog:
23425
23426                 * configure: Regenerate.
23427
23428 2022-09-14  Alan Modra  <amodra@gmail.com>
23429
23430         Modify ld-ctf test files to suit ARM
23431         The "@" char starts a comment on ARM.
23432
23433                 * testsuite/ld-ctf/diag-ctf-version-0.s: Replace @progbits with
23434                 %progbits.
23435                 * testsuite/ld-ctf/diag-ctf-version-2-unsupported-feature.s: Likewise.
23436                 * testsuite/ld-ctf/diag-ctf-version-f.s: Likewise.
23437                 * testsuite/ld-ctf/diag-cttname-invalid.s: Likewise.
23438                 * testsuite/ld-ctf/diag-cttname-null.s: Likewise.
23439                 * testsuite/ld-ctf/diag-cuname.s: Likewise.
23440                 * testsuite/ld-ctf/diag-decompression-failure.s: Likewise.
23441                 * testsuite/ld-ctf/diag-parlabel.s: Likewise.
23442                 * testsuite/ld-ctf/diag-parname.s: Likewise.
23443                 * testsuite/ld-ctf/diag-strlen-invalid.s: Likewise.
23444                 * testsuite/ld-ctf/diag-unsupported-flag.s: Likewise.
23445                 * testsuite/ld-ctf/diag-wrong-magic-number.s: Likewise.
23446
23447 2022-09-14  Alan Modra  <amodra@gmail.com>
23448
23449         asan: som_set_reloc_info heap buffer overflow
23450         Also a bugfix.  The first time the section was read, the contents
23451         didn't supply an addend.
23452
23453                 * som.c (som_set_reloc_info): Sanity check offset.  Do process
23454                 contents after reading.  Tidy section->contents after freeing.
23455
23456 2022-09-14  Alan Modra  <amodra@gmail.com>
23457
23458         ubsan: som_is_space null dereference
23459         On objcopy of fuzzed file.
23460
23461                 * som.c (som_write_fixups): Exit loop if space sections all
23462                 processed.
23463
23464 2022-09-14  Alan Modra  <amodra@gmail.com>
23465
23466         msan: vms-alpha use-of-uninitialized-value in dst_retrieve_location
23467                 * vms-alpha.c (dst_define_location): Init any unused entries.
23468
23469 2022-09-14  Alan Modra  <amodra@gmail.com>
23470
23471         ubsan: arm-dis.c index out of bounds
23472         We are way off in the weeds with this one, and will be printing
23473         <UNPREDICTABLE> for S > 10.
23474
23475                 * arm-dis.c (print_insn_cde): Wrap 'T' value.
23476
23477 2022-09-14  Alan Modra  <amodra@gmail.com>
23478
23479         PR29540, R_PPC64_NONE in .rela.dyn when linking Linux vdso
23480                 PR 29540
23481                 * elf64-ppc.c (allocate_dynrelocs): Don't alloc space for relocs
23482                 against discarded sections.
23483                 (ppc64_elf_size_dynamic_sections): Use standard test for discarded
23484                 sections.
23485                 * elf32-ppc.c (allocate_dynrelocs): Don't alloc space for relocs
23486                 against discarded sections.
23487                 (ppc_elf_size_dynamic_sections): Use standard test for discarded
23488                 sections.
23489
23490 2022-09-14  GDB Administrator  <gdbadmin@sourceware.org>
23491
23492         Automatic date update in version.in
23493
23494 2022-09-13  Aaron Merey  <amerey@redhat.com>
23495
23496         objdump: '-S' should trigger search for separate debuginfo.
23497         Add with_source_code to the command line options that trigger
23498         might_need_separate_debug_info and dump_any_debugging.  This helps
23499         'objdump -S' download missing files via debuginfod without the need for
23500         specifying extra command line options like '-L'.
23501
23502 2022-09-13  Bruno Larsen  <blarsen@redhat.com>
23503
23504         gdb/testsuite: Update gdb.base/so-impl-ld.exp
23505         gdb.base/so-impl-ld.exp was setup assuming that the compiler would add
23506         epilogue information and that GDB would stop in the } line.  This would
23507         make clang tests fail like so:
23508
23509          step^M
23510          solib_main (arg=10000) at ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/solib1.c:7^M
23511          7|__  return arg*arg;|__|___/* HERE */^M
23512          (gdb) PASS: gdb.base/so-impl-ld.exp: step into solib call
23513          next^M
23514          main () at ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/so-impl-ld.c:22^M
23515          22|_  return 0;^M
23516          (gdb) FAIL: gdb.base/so-impl-ld.exp: step in solib call
23517          next^M
23518          0x00007ffff7cef560 in __libc_start_call_main () from /lib64/libc.so.6^M
23519          (gdb) FAIL: gdb.base/so-impl-ld.exp: step out of solib call
23520
23521         This patch changes it so solib_main has 2 lines where GDB can stop
23522         regardless of compiler choices, and updates the exp file to
23523         generically deal with unknown number of steps until leaving that
23524         function.
23525
23526 2022-09-13  Bruno Larsen  <blarsen@redhat.com>
23527
23528         gdb/testsuite: introduce gdb_step_until
23529         Currently, GDB's testsuite uses a set amount of step commands to exit
23530         functions. This is a problem if a compiler emits different epilogue
23531         information from gcc, or emits no epilogue information at all. It was
23532         most noticeable if Clang was used to test GDB.
23533
23534         To fix this unreliability, this commit introduces a new proc that will
23535         step the inferior until it is stopped at a line that matches the given
23536         regexp, or until it steps too many times - defined as an optional
23537         argument. If the line is found, it shows up as a single PASS in the
23538         test, and if the line is not found, a single FAIL is emitted.
23539
23540         This patch only introduces this proc, but does not add it to any
23541         existing tests, these will be introduced in the following commit.
23542
23543 2022-09-13  Bruno Larsen  <blarsen@redhat.com>
23544
23545         explicitly test for stderr in gdb.base/dprintf.exp
23546         Not all compilers add stderr debug information when compiling a
23547         program. Clang, for instance, prefers to add nothing from standard
23548         libraries and let an external debug package have this information.
23549         Because of this, gdb.base/dprintf.exp was failing when GDB attempted to
23550         use dprintf as a call to fprintf(stderrr, ...), like this:
23551
23552          (gdb) PASS: gdb.base/dprintf.exp: call: fprintf: set dprintf style to call
23553          continue
23554          Continuing.
23555          kickoff 1234
23556          also to stderr 1234
23557          'stderr' has unknown type; cast it to its declared type
23558          (gdb) FAIL: gdb.base/dprintf.exp: call: fprintf: 1st dprintf (timeout)
23559
23560         To avoid this false positive, we explicitly test to see if
23561         the compiler has added information about stderr at all, and abort
23562         testing dprintf as an fprintf call if it is unavailable.
23563
23564 2022-09-13  Mark Harmstone  <mark@harmstone.com>
23565
23566         Add pdb archive format
23567         Resubmitted with changes in
23568         https://sourceware.org/pipermail/binutils/2022-September/122791.html
23569         made.
23570
23571 2022-09-13  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
23572
23573         gdb/csky rm csky_print_registers_info
23574         The reason for implementing this interface is that we want to print
23575         GPR, PC, EPC, PSR and EPSR when the "info register" command
23576         is executed.
23577
23578         A prev patch has added PC, EPC, PSR and EPSR to reggroup
23579         general_group, the purpose has been achieved, so this function is
23580         no longer required.
23581
23582 2022-09-13  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
23583
23584         gdb/csky rm csky_memory_insert/remove_breakpoint
23585         Software breakpoints are inserted or removed by the gdb stub via
23586         remote protocol, these two functions are no longer needed.
23587
23588 2022-09-13  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
23589
23590         gdb/csky add unwinder for long branch cases
23591         There are two sequences of instructions for long branch:
23592         1. jmpi [pc+4]    //insn code: 0xeac00001
23593            .long addr
23594
23595         2. lrw t1, [pc+8] //insn code: 0xea8d0002
23596            jmp t1         //insn code: 0x7834
23597            nop            //insn code: 0x6c03
23598            .long addr
23599
23600 2022-09-13  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
23601
23602         gdbserver/csky add csky gdbserver support
23603         Add new files:
23604           gdb/arch/csky.c
23605           gdb/arch/csky.h
23606           gdb/features/cskyv2-linux.c
23607           gdbserver/linux-csky-low.cc
23608
23609         1. In gdb/arch/csky.c file, add function "csky_create_target_description()"
23610         for csky_target::low_arch_setup(). later, it can be used for csky native gdb.
23611
23612         2. In gdb/features/cskyv2-linux.c file, create target_tdesc for csky, include
23613         gprs, pc, hi, lo, float, vector and float control registers.
23614
23615         3. In gdbserver/linux-csky-low.cc file, using PTRACE_GET/SET_RGESET to
23616         get/set registers. The main data structures in asm/ptrace.h are:
23617         struct pt_regs {
23618             unsigned long   tls;
23619             unsigned long   lr;
23620             unsigned long   pc;
23621             unsigned long   sr;
23622             unsigned long   usp;
23623
23624             /*
23625              * a0, a1, a2, a3:
23626              * r0, r1, r2, r3
23627              */
23628             unsigned long   orig_a0;
23629             unsigned long   a0;
23630             unsigned long   a1;
23631             unsigned long   a2;
23632             unsigned long   a3;
23633
23634             /*
23635              * r4 ~ r13
23636              */
23637             unsigned long   regs[10];
23638
23639             /* r16 ~ r30 */
23640             unsigned long   exregs[15];
23641
23642             unsigned long   rhi;
23643             unsigned long   rlo;
23644             unsigned long   dcsr;
23645         };
23646
23647         struct user_fp {
23648             unsigned long   vr[96];
23649             unsigned long   fcr;
23650             unsigned long   fesr;
23651             unsigned long   fid;
23652             unsigned long   reserved;
23653         };
23654
23655 2022-09-13  GDB Administrator  <gdbadmin@sourceware.org>
23656
23657         Automatic date update in version.in
23658
23659 2022-09-12  Tom Tromey  <tromey@adacore.com>
23660
23661         Use checked_static_cast in more places
23662         I went through all the uses of dynamic_cast<> in gdb, looking for ones
23663         that could be replaced with checked_static_cast.  This patch is the
23664         result.  Regression tested on x86-64 Fedora 34.
23665
23666 2022-09-12  Peter Bergner  <bergner@linux.ibm.com>
23667
23668         ppc: Document the -mfuture and -Mfuture options and make them usable
23669         The -mfuture and -Mfuture options which are used for adding potential
23670         new ISA instructions were not documented.  They also lacked a bitmask
23671         so new instructions could not be enabled by those options.  Fixed.
23672
23673         binutils/
23674                 * doc/binutils.texi: Document -Mfuture.
23675
23676         gas/
23677                 * config/tc-ppc.c: Document -mfuture
23678                 * doc/c-ppc.texi: Likewise.
23679
23680         include/
23681                 * opcode/ppc.h (PPC_OPCODE_FUTURE): Define.
23682
23683         opcodes/
23684                 * ppc-dis.c (ppc_opts) <future>: Use it.
23685                 * ppc-opc.c (FUTURE): Define.
23686
23687 2022-09-12  Bruno Larsen  <blarsen@redhat.com>
23688
23689         add xfails to gdb.base/complex-parts.exp when testing with clang
23690         clang doesn't add encoding to the name of complex variables, only says
23691         that the type name is complex, making the relevant tests fail.
23692         This patch adds the xfails to the tests that expect the variable name to
23693         include it.
23694
23695 2022-09-12  Bruno Larsen  <blarsen@redhat.com>
23696
23697         Fix gdb.base/call-ar-st to work with Clang
23698         When running gdb.base/call-ar-st.exp against Clang, we see one FAIL,
23699         like so:
23700
23701          print_all_arrays (array_i=<main.integer_array>, array_c=<main.char_array> "ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa
23702          ZaZaZaZaZaZaZaZaZaZaZaZa", array_f=<main.float_array>, array_d=<main.double_array>) at ../../../src/gdb/testsuite/gdb.base/call-ar-st.c:274
23703          274       print_int_array(array_i);     /* -step1- */
23704          (gdb) FAIL: gdb.base/call-ar-st.exp: step inside print_all_arrays
23705
23706         With GCC we instead see:
23707
23708          print_all_arrays (array_i=<integer_array>, array_c=<char_array> "ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa", array_f=<float_array>, array_d=<double_array>) at /home/pedro/gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/call-ar-st.c:274
23709          274       print_int_array(array_i);     /* -step1- */
23710          (gdb) PASS: gdb.base/call-ar-st.exp: step inside print_all_arrays
23711
23712         The difference is that with Clang we get:
23713
23714          array_i=<main.integer_array>, ...
23715
23716         instead of
23717
23718          array_i = <integer_array>, ...
23719
23720         These symbols are local static variables, and "main" is the name of
23721         the function they are defined in.  GCC instead appends a sequence
23722         number to the linkage name:
23723
23724          $ nm -A call-ar-st.gcc | grep integer_
23725          call-ar-st/call-ar-st:00000000000061a0 b integer_array.3968
23726
23727          $ nm -A call-ar-st.clang | grep integer_
23728          call-ar-st:00000000004061a0 b main.integer_array
23729
23730         This commit changes the testcase to accept both outputs, as they are
23731         functionally identical.
23732
23733         Co-Authored-By: Pedro Alves <pedro@palves.net>
23734         Change-Id: Iaf2ccdb9d5996e0268ed12f595a6e04b368bfcb4
23735
23736 2022-09-12  Bruno Larsen  <blarsen@redhat.com>
23737
23738         fix gdb.base/access-mem-running.exp for clang testing
23739         Clang was optimizing global_var away because it was not being used
23740         anywhere. this commit fixes that by adding the attribute used it.
23741
23742         update gdb.base/info-program.exp to not fail with clang
23743         The test specifically mentions that it doesn't care where the program
23744         stops, however it was still testing for a specific location.  The clang
23745         compiler emits different line information for epilogue, so GDB reports a
23746         different stopping location, depending on the used compiler.  With this
23747         patch the test works even with clang.
23748
23749 2022-09-12  Bruno Larsen  <blarsen@redhat.com>
23750
23751         gdb/testsuite: change gdb.base/nodebug.exp to not fail with clang
23752         Clang organizes the variables differently to gcc in the original version
23753         of this code, leading to the following differences when testing
23754         p (int*) &dataglobal + 1
23755
23756         gcc:
23757         $16 = (int *) 0x404034 <datalocal>
23758
23759         clang:
23760         $16 = (int *) 0x404034 <dataglobal8>
23761
23762         However, since the important part of this test doesn't seem to be which
23763         symbol is linked, but rather if GDB is correctly increasing the
23764         address. This test was changed to actually measure address changes,
23765         instead of assuming the ordering and naming of symbols.
23766
23767         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
23768
23769 2022-09-12  Martin Storsjö  <martin@martin.st>
23770
23771         ld: pe: Apply review suggestions on the existing exports/imports arrays
23772         Use a separate explicit max_exports/imports field, instead of
23773         deducing it from the number of allocated elements. Use a named
23774         constant for the incremental growth of the array.
23775
23776         Use bool instead of int for boolean values.
23777
23778         Remove an unnecessary if statement/scope in the def_file_free
23779         function.
23780
23781         Add more verbose comments about parameters, and about insertion
23782         into an array of structs.
23783
23784         Generally use unsigned integers for all array indices and sizes.
23785         The num_exports/imports fields are kept as is as signed integers,
23786         since changing them to unsigned would require a disproportionate
23787         amount of changes ti pe-dll.c to avoid comparisons between signed
23788         and unsigned.
23789
23790         Simply use xrealloc instead of a check and xmalloc/xrealloc;
23791         xrealloc can take NULL as the first parameter (and does a similar
23792         check internally). (This wasn't requested in review though,
23793         but noticed while working on the code.)
23794
23795 2022-09-12  Martin Storsjö  <martin@martin.st>
23796
23797         ld: pe: Improve performance of object file exclude symbol directives
23798         Store the list of excluded symbols in a sorted list, speeding up
23799         checking for duplicates when inserting new entries.
23800
23801         This is done in the same way as is done for exports and imports
23802         (while the previous implementation was done with a linked list,
23803         based on the implementation for aligncomm).
23804
23805         When linking object files with excluded symbols, there can potentially
23806         be very large numbers of excluded symbols (just like builds with
23807         exports can have a large number of exported symbols).
23808
23809         This improves the link performance somewhat, when linking with large
23810         numbers of excluded symbols.
23811
23812         The later actual use of the excluded symbols within pe-dll.c
23813         handles them via an unordered linked list still, though.
23814
23815 2022-09-12  Tom de Vries  <tdevries@suse.de>
23816
23817         [gdb] Fix abort in selftest run_on_main_thread with ^C
23818         When running selftest run_on_main_thread and pressing ^C, we can run into:
23819         ...
23820         Running selftest run_on_main_thread.
23821         terminate called without an active exception
23822
23823         Fatal signal: Aborted
23824         ...
23825
23826         The selftest function looks like this:
23827         ...
23828         static void
23829         run_tests ()
23830         {
23831           std::thread thread;
23832
23833           done = false;
23834
23835           {
23836             gdb::block_signals blocker;
23837
23838             thread = std::thread (set_done);
23839           }
23840
23841           while (!done && gdb_do_one_event () >= 0)
23842             ;
23843
23844           /* Actually the test will just hang, but we want to test
23845              something.  */
23846           SELF_CHECK (done);
23847
23848           thread.join ();
23849         }
23850         ...
23851
23852         The error message we see is due to the destructor of thread being called while
23853         thread is joinable.
23854
23855         This is supposed to be taken care of by thread.join (), but the ^C prevents
23856         that one from being called, while the destructor is still called.
23857
23858         Fix this by ensuring thread.join () is called (if indeed required) before the
23859         destructor using SCOPE_EXIT.
23860
23861         Tested on x86_64-linux.
23862
23863         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29549
23864
23865 2022-09-12  Tom de Vries  <tdevries@suse.de>
23866
23867         [gdb/symtab] Support .gdb_index section with TUs in .debug_info
23868         The .gdb_index variant of commit d878bb39e41 ("[gdb/symtab] Support
23869         .debug_names section with TUs in .debug_info").
23870
23871         Tested on x86_64-linux.
23872
23873 2022-09-12  Tom de Vries  <tdevries@suse.de>
23874
23875         [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for ppc64le
23876         In commit cd919f5533c ("[gdb/testsuite] Fix
23877         gdb.dwarf2/dw2-dir-file-name.exp"), I made gdb.dwarf2/dw2-dir-file-name.exp
23878         independent of prologue analyzers, using this change:
23879         ...
23880         -       gdb_breakpoint $func
23881         +       gdb_breakpoint *$func
23882         ...
23883
23884         That however caused a regression on ppc64le.  For PowerPC, as described in the
23885         ELFv2 ABI, a function can have a global and local entry point.
23886
23887         Setting a breakpoint on *$func effectively creates a breakpoint for the global
23888         entry point, so if the function is entered through the local entry point, the
23889         breakpoint doesn't trigger.
23890
23891         Fix this by reverting commit cd919f5533c, and setting the breakpoint on
23892         ${func}_label instead.
23893
23894         Tested on x86_64-linux and ppc64le-linux.
23895
23896 2022-09-12  Tom de Vries  <tdevries@suse.de>
23897
23898         [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp with clang
23899         When running test-case gdb.dwarf2/dw2-dir-file-name.exp with clang, we run
23900         into:
23901         ...
23902         (gdb) break *compdir_missing__ldir_missing__file_basename^M
23903         Breakpoint 2 at 0x400580^M
23904         (gdb) continue^M
23905         Continuing.^M
23906         ^M
23907         Breakpoint 2, 0x0000000000400580 in \
23908           compdir_missing.ldir_missing.file_basename ()^M
23909         (gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
23910           compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
23911           compdir_missing__ldir_missing__file_basename
23912         ...
23913
23914         The problem is that the test-case uses labels outside functions, which is know
23915         to cause problem with clang, as documented in the comment for proc
23916         function_range.
23917
23918         Fix this by using get_func_info instead.
23919
23920         Tested on x86_64-linux, with both gcc 7.5.0 and clang 13.0.0.
23921
23922 2022-09-12  Jan Beulich  <jbeulich@suse.com>
23923
23924         x86: avoid i386_dis_printf()'s staging area for a fair part of output
23925         While PR binutils/29483 has now been addressed differently, this
23926         originally proposed change still has its merits: Avoiding vsnprintf()
23927         for typically far more than half of the overall output results in a 2-3%
23928         performance gain in my testing (with debug builds of objdump, libbfd,
23929         and libopcodes).
23930
23931         With that part of output no longer using staging_area[], the array also
23932         doesn't need to be quite as large anymore (the largest presently used
23933         size is 27, from "64-bit address is disabled").
23934
23935         While limiting the scope of "res" it became apparent that
23936         - no caller cares about the function's return value,
23937         - the comment about the return value was wrong,
23938         - a particular positive return value would have been meaningless to the
23939           caller.
23940         Therefore convert the function to return "void" at the same time.
23941
23942 2022-09-12  Nelson Chu  <nelson@rivosinc.com>
23943
23944         RISC-V: PR28509, the default visibility symbol cannot be referenced by R_RISCV_JAL.
23945         When generating the shared object, the default visibility symbols may bind
23946         externally, which means they will be exported to the dynamic symbol table,
23947         and are preemptible by default.  These symbols cannot be referenced by the
23948         non-pic R_RISCV_JAL and R_RISCV_RVC_JUMP.  However, consider that linker
23949         may relax the R_RISCV_CALL relocations to R_RISCV_JAL or R_RISCV_RVC_JUMP,
23950         if these relocations are relocated to the plt entries, then we won't report
23951         error for them.  Perhaps we also need the similar checks for the
23952         R_RISCV_BRANCH and R_RISCV_RVC_BRANCH relocations.
23953
23954         After applying this patch, and revert the following glibc patch,
23955         riscv: Fix incorrect jal with HIDDEN_JUMPTARGET
23956         https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b
23957
23958         I get the expected errors as follows,
23959         ld: relocation R_RISCV_RVC_JUMP against `__sigsetjmp' which may bind externally can not be used when making a shared object; recompile with -fPIC
23960         ld: relocation R_RISCV_JAL against `exit' which may bind externally can not be used when making a shared object; recompile with -fPIC
23961
23962         Besides, we also have similar changes for libgcc,
23963         RISC-V: jal cannot refer to a default visibility symbol for shared object
23964         https://github.com/gcc-mirror/gcc/commit/45116f342057b7facecd3d05c2091ce3a77eda59
23965
23966         bfd/
23967                 pr 28509
23968                 * elfnn-riscv.c (riscv_elf_relocate_section): Report errors when
23969                 makeing a shard object, and the referenced symbols of R_RISCV_JAL
23970                 relocations are default visibility.  Besides, we should handle most
23971                 of the cases here, so don't need the unresolvable check later for
23972                 R_RISCV_JAL and R_RISCV_RVC_JUMP.
23973         ld/
23974                 pr 28509
23975                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
23976                 * testsuite/ld-riscv-elf/lib-nopic-01a.s: Removed.
23977                 * testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise.
23978                 * testsuite/ld-riscv-elf/lib-nopic-01b.s: Likewise.
23979                 * testsuite/ld-riscv-elf/shared-lib-nopic-01.d: New testcase.
23980                 * testsuite/ld-riscv-elf/shared-lib-nopic-01.s: Likewise.
23981                 * testsuite/ld-riscv-elf/shared-lib-nopic-02.d: Likewise.
23982                 * testsuite/ld-riscv-elf/shared-lib-nopic-02.s: Likewise.
23983                 * testsuite/ld-riscv-elf/shared-lib-nopic-03.d: Likewise.
23984                 * testsuite/ld-riscv-elf/shared-lib-nopic-03.s: Likewise.
23985                 * testsuite/ld-riscv-elf/shared-lib-nopic-04.d: Likewise.
23986                 * testsuite/ld-riscv-elf/shared-lib-nopic-04.s: Likewise.
23987
23988 2022-09-12  GDB Administrator  <gdbadmin@sourceware.org>
23989
23990         Automatic date update in version.in
23991
23992 2022-09-11  Tom de Vries  <tdevries@suse.de>
23993
23994         [gdb/symtab] Fix handling of DW_TAG_unspecified_type
23995         Currently, the test-case contained in this patch fails:
23996         ...
23997         (gdb) p (int) foo ()^M
23998         Invalid cast.^M
23999         (gdb) FAIL: gdb.dwarf2/dw2-unspecified-type.exp: p (int) foo ()
24000         ...
24001         because DW_TAG_unspecified_type is translated as void.
24002
24003         There's some code in read_unspecified_type that marks the type as stub, but
24004         that's only active for ada:
24005         ...
24006           if (cu->lang () == language_ada)
24007             type->set_is_stub (true);
24008         ...
24009
24010         Fix this by:
24011         - marking the type as a stub for all languages, and
24012         - handling the stub return type case in call_function_by_hand_dummy.
24013
24014         Tested on x86_64-linux.
24015
24016         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29558
24017
24018 2022-09-11  GDB Administrator  <gdbadmin@sourceware.org>
24019
24020         Automatic date update in version.in
24021
24022 2022-09-10  Alan Modra  <amodra@gmail.com>
24023
24024         Re: PR29466, APP/NO_APP with linefile
24025         It looks like I copied the SIZE init across from
24026         binutils/testsuite/config/default.exp without some necessary editing.
24027
24028                 * testsuite/config/default.exp (SIZE): Adjust relative path.
24029
24030 2022-09-10  GDB Administrator  <gdbadmin@sourceware.org>
24031
24032         Automatic date update in version.in
24033
24034 2022-09-09  Nick Clifton  <nickc@redhat.com>
24035
24036         Support debuginfo files with empty group sections.
24037                 PR 29532
24038         bfd     * elf.c (setup_group): Do not return false if there is no group
24039                 information available.
24040
24041         bionutils* objcopy.c (setup_section): Leave group sections intact when
24042                 creating separate debuginfo files.
24043
24044 2022-09-09  Tsukasa OI  <research_trasio@irq.a4lg.com>
24045
24046         RISC-V: Fix vector CSR requirements
24047         Vector CSRs are also required on smaller vector subsets.
24048
24049         Not only that the most of vector CSRs are general purpose (and must be
24050         accessible for every vector subsets), current minimum vector subset 'Zve32x'
24051         requires fixed point arithmetic, making remaining non-general purpose
24052         (fixed point arithmetic only) CSRs mandatory for such subsets.
24053
24054         So, those CSRs must be accessible from 'Zve32x', not just from 'V'.
24055         This commit fixes this issue which caused CSR accessibility warnings.
24056
24057         gas/ChangeLog:
24058
24059                 * config/tc-riscv.c (riscv_csr_address): Change vector CSR
24060                 requirement from 'V' to 'Zve32x'.
24061                 * testsuite/gas/riscv/csr-version-1p9p1.l: Change vector CSR
24062                 requirement from 'V' to 'Zve32x'.
24063                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
24064                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
24065                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
24066
24067 2022-09-09  GDB Administrator  <gdbadmin@sourceware.org>
24068
24069         Automatic date update in version.in
24070
24071 2022-09-08  Carl Love  <cel@us.ibm.com>
24072
24073         Fix hardware watchpoint check in test gdb.base/watchpoint-reuse-slot.exp
24074         This test generates 48 failures on Power 9 when testing with HW watchpoints
24075         enabled.  Note HW watchpoint support is disabled on Power 9 due to a HW bug.
24076         The skip_hw_watchpoint_tests proc must be used to correctly determine
24077         if the processor supports HW watchpoints.
24078
24079         This patch replaces the [target_info exists gdb,no_hardware_watchpoints]
24080         with the skip_hw_watchpoint_tests check.
24081
24082         This patch was tested on Power 9, Power 10 and X86-64 with no regressions.
24083
24084 2022-09-08  Nick Clifton  <nickc@redhat.com>
24085
24086         Gas generated incorrect debug info (top-level DW_TAG_unspecified_type DIE)
24087                 PR 29559
24088                 * dwarf2dbg.c (out_debug_info): Place DW_TAG_unspecified_type at
24089                 the end of the list of children, not at the start of the CU
24090                 information.
24091                 * testsuite/gas/elf/dwarf-3-func.d: Update expected output.
24092                 * testsuite/gas/elf/dwarf-5-func-global.d: Likewise.
24093                 * testsuite/gas/elf/dwarf-5-func-local.d: Likewise.
24094                 * testsuite/gas/elf/dwarf-5-func.d: Likewise.
24095
24096 2022-09-08  Tsukasa OI  <research_trasio@irq.a4lg.com>
24097
24098         gdbsupport: Fix config.status dependency
24099         Commit 171fba11ab27 ("Make GDBserver abort on internal error in development mode")
24100         created a new substitution CONFIG_STATUS_DEPENDENCIES but this is used by
24101         Makefile.in (which is not regenerated by that commit).  After regenerating
24102         it, it is found that CONFIG_STATUS_DEPENDENCIES value is not valid, making
24103         gdbsupport fail to build.
24104
24105         Since the CONFIG_STATUS_DEPENDENCIES value is used in the Makefile, macro
24106         substitution must have a Makefile format but commit 171fba11ab27 used shell
24107         format "$srcdir/../bfd/development.sh".
24108
24109         This commit fixes this issue by substituting "$srcdir" (shell format) to
24110         "$(srcdir)" (Makefile format).  It preserves the dependency as Pedro
24111         intended and fixes the build problem.
24112
24113         It also regenerates corresponding files with the maintainer mode.
24114
24115         gdbsupport/ChangeLog:
24116
24117                 * configure.ac: Fix config.status dependency.
24118                 * Makefile.in: Regenerate.
24119                 * configure: Regenerate.
24120
24121 2022-09-08  Nick Clifton  <nickc@redhat.com>
24122
24123         Maintainer mode: wrong gettext version?
24124                 * README-maintainer-mode: Update minimum version  of gettext
24125                 required.
24126
24127         i686-w64-mingw32-objdump -WL returns incorrect file paths
24128                 PR 29523
24129                 * dwarf.c (display_debug_lines_decoded): Correctly handle DWARF-5
24130                 directory and filename tables.
24131
24132 2022-09-08  GDB Administrator  <gdbadmin@sourceware.org>
24133
24134         Automatic date update in version.in
24135
24136 2022-09-07  Tom de Vries  <tdevries@suse.de>
24137
24138         [gdb/testsuite] xfail gdb.ada/O2_float_param.exp for aarch64 and gcc 7.5.0
24139         On aarch64-linux, with gcc 7.5.0, we run into:
24140         ...
24141          (gdb) frame^M
24142          #0  callee.increment (val=99.0, val@entry=9.18340949e-41, msg=...) at \
24143            callee.adb:21^M
24144          21            if Val > 200.0 then^M
24145          (gdb) FAIL: gdb.ada/O2_float_param.exp: scenario=all: frame
24146         ...
24147
24148         The problem is a GCC bug, filed as "PR98148 - [AArch64] Wrong location
24149         expression for function entry values" (
24150         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98148 ).
24151
24152         Xfail the test for aarch64 and gcc 7.
24153
24154         Tested on x86_64-linux and aarch64-linux.
24155
24156         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29418
24157
24158 2022-09-07  Tom de Vries  <tdevries@suse.de>
24159
24160         [gdb/testsuite] Fix gdb.ada/access_tagged_param.exp for aarch64
24161         On aarch64-linux, I run into:
24162         ...
24163         Breakpoint 2, pck.inspect (obj=0x430eb0 \
24164           <system.pool_global.global_pool_object>, <objL>=0) at pck.adb:17^M
24165         17         procedure Inspect (Obj: access Top_T'Class) is^M
24166         (gdb) FAIL: gdb.ada/access_tagged_param.exp: continue
24167         ...
24168         while on x86_64-linux, I see:
24169         ...
24170         Breakpoint 2, pck.inspect (obj=0x62b2a0, <objL>=2) at pck.adb:19^M
24171         19            null;^M
24172         (gdb) PASS: gdb.ada/access_tagged_param.exp: continue
24173         ...
24174         Note the different line numbers, 17 vs 19.
24175
24176         The difference comes from the gdbarch_skip_prologue implementation.
24177
24178         The amd64_skip_prologue implementation doesn't use gcc line numbers, and falls
24179         back to the architecture-specific prologue analyzer, which correctly skips
24180         past the prologue, to address 0x4022f7:
24181         ...
24182         00000000004022ec <pck__inspect>:
24183           4022ec:       55                      push   %rbp
24184           4022ed:       48 89 e5                mov    %rsp,%rbp
24185           4022f0:       48 89 7d f8             mov    %rdi,-0x8(%rbp)
24186           4022f4:       89 75 f4                mov    %esi,-0xc(%rbp)
24187           4022f7:       90                      nop
24188           4022f8:       90                      nop
24189           4022f9:       5d                      pop    %rbp
24190           4022fa:       c3                      ret
24191         ...
24192
24193         The aarch64_skip_prologue implementation does use gcc line numbers, which are:
24194         ...
24195         File name                    Line number    Starting address    View    Stmt
24196         pck.adb                               17            0x402580               x
24197         pck.adb                               17            0x402580       1       x
24198         pck.adb                               19            0x40258c               x
24199         pck.adb                               20            0x402590               x
24200         ...
24201         and which are represented like this internally in gdb:
24202         ...
24203         INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
24204         0      17     0x0000000000402580 Y
24205         1      17     0x0000000000402580 Y
24206         2      19     0x000000000040258c Y
24207         3      20     0x0000000000402590 Y
24208         4      END    0x00000000004025a0 Y
24209         ...
24210
24211         The second entry is interpreted as end-of-prologue, so 0x402580 is used, while
24212         the actual end of the prologue is at 0x40258c:
24213         ...
24214         0000000000402580 <pck__inspect>:
24215           402580:       d10043ff        sub     sp, sp, #0x10
24216           402584:       f90007e0        str     x0, [sp, #8]
24217           402588:       b90007e1        str     w1, [sp, #4]
24218           40258c:       d503201f        nop
24219           402590:       d503201f        nop
24220           402594:       910043ff        add     sp, sp, #0x10
24221           402598:       d65f03c0        ret
24222           40259c:       d503201f        nop
24223         ...
24224
24225         Note that the architecture-specific prologue analyzer would have gotten this
24226         right:
24227         ...
24228         (gdb) p /x aarch64_analyze_prologue (gdbarch, pc, pc + 128, 0)
24229         $2 = 0x40258c
24230         ...
24231
24232         Fix the FAIL by making the test-case more robust against problems in prologue
24233         skipping, by setting the breakpoint on line 19 instead.
24234
24235         Likewise in a few similar test-cases.
24236
24237         Tested on x86_64-linux and aarch64-linux.
24238
24239 2022-09-07  Luis Machado  <luis.machado@arm.com>
24240             Tom de Vries  <tdevries@suse.de>
24241
24242         Fix endianness handling for arm record self tests
24243         v2:
24244
24245         - Add 32-bit Arm instruction selftest
24246         - Refactored abstract memory reader into abstract instruction reader
24247         - Adjusted code to use templated type and to use host endianness as
24248           opposed to target endianness.
24249
24250         The arm record tests handle 16-bit and 32-bit thumb instructions, but the
24251         code is laid out in a way that handles the 32-bit thumb instructions as
24252         two 16-bit parts.
24253
24254         This is fine, but it is prone to host-endianness issues given how the two
24255         16-bit parts are stored and how they are accessed later on. Arm is
24256         little-endian by default, so running this test with a GDB built with
24257         --enable-targets=all and on a big endian host will run into the following:
24258
24259         Running selftest arm-record.
24260         Process record and replay target doesn't support syscall number -2036195
24261         Process record does not support instruction 0x7f70ee1d at address 0x0.
24262         Self test failed: self-test failed at ../../binutils-gdb/gdb/arm-tdep.c:14482
24263
24264         It turns out the abstract memory reader class is more generic than it needs to
24265         be, and we can simplify the code a bit by assuming we have a simple instruction
24266         reader that only reads up to 4 bytes, which is the length of a 32-bit
24267         instruction.
24268
24269         Instead of returning a bool, we return instead the instruction that has been
24270         read. This way we avoid having to deal with the endianness conversion, and use
24271         the host endianness instead. The Arm selftests can be executed on non-Arm
24272         hosts.
24273
24274         While at it, Tom suggested adding a 32-bit Arm instruction selftest to increase
24275         the coverage of the selftests.
24276
24277         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29432
24278
24279 2022-09-07  Tom de Vries  <tdevries@suse.de>
24280
24281         [gdb/testsuite] Use prototype to call libc functions
24282         On openSUSE Tumbleweed (using glibc 2.36), I run into:
24283         ...
24284         (gdb) print /d (int) munmap (4198400, 4096)^M
24285         Invalid cast.^M
24286         (gdb) FAIL: gdb.base/break-main-file-remove-fail.exp: cmdline: \
24287           get integer valueof "(int) munmap (4198400, 4096)"
24288         ...
24289
24290         The problem is that after starting the executable, the symbol has type
24291         "void (*) (void)":
24292         ...
24293         (gdb) p munmap
24294         $1 = {<text variable, no debug info>} 0x401030 <munmap@plt>
24295         (gdb) start
24296           ...
24297         (gdb) p munmap
24298         $2 = {void (void)} 0x7ffff7feb9a0 <__GI_munmap>
24299         ...
24300         which causes the "Invalid cast" error.
24301
24302         Looking at the debug info for glibc for symbol __GI_munmap:
24303         ...
24304          <0><189683>: Abbrev Number: 1 (DW_TAG_compile_unit)
24305             <189691>   DW_AT_name        : ../sysdeps/unix/syscall-template.S
24306             <189699>   DW_AT_producer    : GNU AS 2.39.0
24307         <1><1896ae>: Abbrev Number: 2 (DW_TAG_subprogram)
24308             <1896af>   DW_AT_name        : __GI___munmap
24309             <1896b3>   DW_AT_external    : 1
24310             <1896b4>   DW_AT_low_pc      : 0x10cad0
24311             <1896bc>   DW_AT_high_pc     : 37
24312         ...
24313         that's probably caused by this bit (or similar bits for other munmap aliases).
24314
24315         This is fixed in gas on trunk by commit 5578fbf672e ("GAS: Add a return type
24316         tag to DWARF DIEs generated for function symbols").
24317
24318         Work around this (for say gas 2.39) by explicitly specifying the prototype for
24319         munmap.
24320
24321         Likewise for getpid in a couple of other test-cases.
24322
24323         Tested on x86_64-linux.
24324
24325 2022-09-07  mengqinggang  <mengqinggang@loongson.cn>
24326
24327         LoongArch: fix gas BFD_RELOC_8/16/24 bug
24328         If fixP->fx_subsy is NULL, BFD_RELOC_8/16/24 can't convert to
24329         BFD_RELOC_LARCH_xxx.
24330
24331         gas/config/tc-loongarch.c
24332
24333 2022-09-07  GDB Administrator  <gdbadmin@sourceware.org>
24334
24335         Automatic date update in version.in
24336
24337 2022-09-06  Aaron Merey  <amerey@redhat.com>
24338             Nick Clifton  <nickc@redhat.com>
24339
24340         Add debuginfod support for objdump -S
24341         Currently objdump -S is not able to make use files downloaded from debuginfod.
24342         This is due to bfd_find_nearest_line_discriminator being unable to locate any
24343         separate debuginfo files in the debuginfod cache. Additionally objdump lacked
24344         a call to debuginfod_find_source in order to download missing source files.
24345
24346         Fix this by using bfd_find_nearest_line_with_alt instead of
24347         bfd_find_nearest_line_discriminator. Also add a call to
24348         debuginfod_find_source in order to download missing source files.
24349
24350 2022-09-06  Aaron Merey  <amerey@redhat.com>
24351
24352         bfd: Add bfd_find_nearest_line_with_alt
24353         bfd_find_nearest_line_with_alt functions like bfd_find_nearest_line with
24354         the addition of a parameter for specifying the filename of a supplementary
24355         debug file such as one referenced by .gnu_debugaltlink or .debug_sup.
24356
24357         This patch focuses on implementing bfd_find_nearest_line_with_alt
24358         support for ELF/DWARF2 .gnu_debugaltlink. For other targets this
24359         function simply sets the invalid_operation bfd_error.
24360
24361 2022-09-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
24362
24363         gdb: add Tsukasa Oi to gdb/MAINTAINERS
24364
24365 2022-09-06  Andrew Burgess  <aburgess@redhat.com>
24366
24367         gdb: move a write after approval entry into the correct place
24368         Noticed in passing that an entry in the MAINTAINERS write after
24369         approval list was in the wrong place.
24370
24371 2022-09-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
24372
24373         gdb: Add non-enum disassembler options
24374         This is paired with "opcodes: Add non-enum disassembler options".
24375
24376         There is a portable mechanism for disassembler options and used on some
24377         architectures:
24378
24379         -   ARC
24380         -   Arm
24381         -   MIPS
24382         -   PowerPC
24383         -   RISC-V
24384         -   S/390
24385
24386         However, it only supports following forms:
24387
24388         -   [NAME]
24389         -   [NAME]=[ENUM_VALUE]
24390
24391         Valid values for [ENUM_VALUE] must be predefined in
24392         disasm_option_arg_t.values. For instance, for -M cpu=[CPU] in ARC
24393         architecture, opcodes/arc-dis.c builds valid CPU model list from
24394         include/elf/arc-cpu.def.
24395
24396         In this commit, it adds following format:
24397
24398         -   [NAME]=[ARBITRARY_VALUE] (cannot contain "," though)
24399
24400         This is identified by NULL value of disasm_option_arg_t.values
24401         (normally, this is a non-NULL pointer to a NULL-terminated list).
24402
24403         gdb/ChangeLog:
24404
24405                 * gdb/disasm.c (set_disassembler_options): Add support for
24406                 non-enum disassembler options.
24407                 (show_disassembler_options_sfunc): Likewise.
24408
24409 2022-09-06  Tom de Vries  <tdevries@suse.de>
24410
24411         [gdb/symtab] Support .debug_names section with TUs in .debug_info
24412         When running test-case gdb.cp/cpexprs-debug-types.exp on target board
24413         cc-with-debug-names/gdb:debug_flags=-gdwarf-5, we get an executable with
24414         a .debug_names section, but no .debug_types section.  For dwarf-5, the TUs
24415         are no longer put in a separate unit, but instead they're put in the
24416         .debug_info section.
24417
24418         When loading the executable, the .debug_names section is silently ignored
24419         because of this check in dwarf2_read_debug_names:
24420         ...
24421           if (map->tu_count != 0)
24422             {
24423               /* We can only handle a single .debug_types when we have an
24424                  index.  */
24425               if (per_bfd->types.size () != 1)
24426                 return false;
24427         ...
24428         which triggers because per_bfd->types.size () == 0.
24429
24430         The intention of the check is to make sure we don't have more that one
24431         .debug_types section, as can happen in a object file (see PR12984):
24432         ...
24433         $ grep "\.debug_types" 11.s
24434                 .section        .debug_types,"G",@progbits,wt.75c042c23a9a07ee,comdat
24435                 .section        .debug_types,"G",@progbits,wt.c59c413bf50a4607,comdat
24436         ...
24437
24438         Fix this by:
24439         - changing the check condition to "per_bfd->types.size () > 1", and
24440         - handling per_bfd->types.size () == 0.
24441
24442         Tested on x86_64-linux.
24443
24444         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29385
24445
24446 2022-09-06  Tom de Vries  <tdevries@suse.de>
24447
24448         [gdb/testsuite] Add gdb.dwarf2/debug-names-bad-cu-index.exp
24449         Add test-case gdb.dwarf2/debug-names-bad-cu-index.exp, a regression test for
24450         commit 2fe9a3c41fa ("[gdb/symtab] Fix bad compile unit index complaint").
24451
24452         Tested on x86_64-linux.
24453
24454 2022-09-06  Tom de Vries  <tdevries@suse.de>
24455
24456         [gdb/testsuite] Add gdb.dwarf2/debug-names-tu.exp
24457         Add a test-case gdb.dwarf2/debug-names-tu.exp, that uses the dwarf assembler
24458         to specify a .debug_names index with the TU list referring to a TU from the
24459         .debug_types section.
24460
24461         This is intended to produce something similar to:
24462         ...
24463         $ gcc -g -fdebug-types-section ~/hello.c -gdwarf-4
24464         $ gdb-add-index -dwarf-5 a.out
24465         ...
24466
24467         Tested on x86_64-linux.
24468
24469 2022-09-06  Tsukasa OI  <research_trasio@irq.a4lg.com>
24470
24471         opcodes: Add non-enum disassembler options
24472         This is paired with "gdb: Add non-enum disassembler options".
24473
24474         There is a portable mechanism for disassembler options and used on some
24475         architectures:
24476
24477         -   ARC
24478         -   Arm
24479         -   MIPS
24480         -   PowerPC
24481         -   RISC-V
24482         -   S/390
24483
24484         However, it only supports following forms:
24485
24486         -   [NAME]
24487         -   [NAME]=[ENUM_VALUE]
24488
24489         Valid values for [ENUM_VALUE] must be predefined in
24490         disasm_option_arg_t.values. For instance, for -M cpu=[CPU] in ARC
24491         architecture, opcodes/arc-dis.c builds valid CPU model list from
24492         include/elf/arc-cpu.def.
24493
24494         In this commit, it adds following format:
24495
24496         -   [NAME]=[ARBITRARY_VALUE] (cannot contain "," though)
24497
24498         This is identified by NULL value of disasm_option_arg_t.values
24499         (normally, this is a non-NULL pointer to a NULL-terminated list).
24500
24501         include/ChangeLog:
24502
24503                 * dis-asm.h (disasm_option_arg_t): Update comment of values
24504                 to allow non-enum disassembler options.
24505
24506         opcodes/ChangeLog:
24507
24508                 * riscv-dis.c (print_riscv_disassembler_options): Support
24509                 non-enum disassembler options on printing disassembler help.
24510                 * arc-dis.c (print_arc_disassembler_options): Likewise.
24511                 * mips-dis.c (print_mips_disassembler_options): Likewise.
24512
24513 2022-09-06  GDB Administrator  <gdbadmin@sourceware.org>
24514
24515         Automatic date update in version.in
24516
24517 2022-09-05  Tsukasa OI  <research_trasio@irq.a4lg.com>
24518
24519         sim/riscv: Complete tidying up with SBREAK
24520         This commit removes SBREAK-related references on the simulator as it's
24521         renamed to EBREAK in 2016 (the RISC-V ISA, version 2.1).
24522
24523         sim/ChangeLog:
24524
24525                 * riscv/sim-main.c (execute_i): Use "ebreak" instead of "sbreak".
24526
24527 2022-09-05  GDB Administrator  <gdbadmin@sourceware.org>
24528
24529         Automatic date update in version.in
24530
24531 2022-09-04  Andrew Burgess  <aburgess@redhat.com>
24532
24533         sim/erc32: fix gdb with simulator build
24534         In commit:
24535
24536           commit 7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1
24537           Date:   Mon Apr 4 22:38:04 2022 +0100
24538
24539               sim: fixes for libopcodes styled disassembler
24540
24541         changes were made to the simulator source to handle the new libopcodes
24542         disassembler styling API.
24543
24544         Unfortunately, these changes broke building GDB with the erc32 (sparc)
24545         simulator, like this:
24546
24547           ../src/configure --target=sparc-linux
24548           make all-gdb
24549           ....
24550           /usr/bin/ld: ../sim/erc32/libsim.a(interf.o): in function `sim_open':
24551           /tmp/build/sim/../../src/sim/erc32/interf.c:247: undefined reference to `fprintf_styled'
24552           collect2: error: ld returned 1 exit status
24553
24554         The problem is that in commit 7b01c1cc1d11 the fprintf_styled function
24555         was added into sis.c.  This file is only used when building the 'run'
24556         binary, that is, the standalone simulator, and is not included in the
24557         libsim.a library.
24558
24559         Now, the obvious fix would be to move fprintf_styled into libsim.a,
24560         however, that turns out to be tricky.
24561
24562         The erc32 simulator currently has two copies of the function run_sim,
24563         one in sis.c, and one in interf.c, both of these copies are global.
24564
24565         Currently, the 'run' binary links fine, though I suspect this might be
24566         pure luck.  When I tried moving fprintf_styled into interf.c, I ran
24567         into multiple-definition (of run_sim) errors.  I suspect that by
24568         requiring the linker to pull in fprintf_styled from libsim.a I was
24569         changing the order in which symbols were loaded, and the linker was
24570         now seeing both copies of run_sim, while currently we only see one
24571         copy.
24572
24573         The ideal solution of course, would be to merge the two similar, but
24574         slightly different copies of run_sim, and just use the one copy.  Then
24575         we could safely move fprintf_styled into interf.c too, and all would
24576         be good.
24577
24578         But I don't have time right now to start debugging the erc32
24579         simulator, so I wanted a solution that fixes the build without
24580         introducing multiple definition errors.
24581
24582         The easiest solution I think is to just have two copies of
24583         fprintf_styled, one in sis.c, and one in interf.c.  Unlike run_sim,
24584         these two copies are both static, so we will not run into multiple
24585         definition issues with this function.  The functions themselves are
24586         not very big, so it's not a huge amount of duplicate code.
24587
24588         I am very aware that this is not an ideal solution, and I would
24589         welcome anyone who wants to take on fixing the run_sim problem
24590         properly, and then cleanup the fprintf_styled duplication.
24591
24592 2022-09-04  GDB Administrator  <gdbadmin@sourceware.org>
24593
24594         Automatic date update in version.in
24595
24596 2022-09-03  GDB Administrator  <gdbadmin@sourceware.org>
24597
24598         Automatic date update in version.in
24599
24600 2022-09-02  Max Filippov  <jcmvbkbc@gmail.com>
24601
24602         xtensa: bfd: fix TLS relocations generated for PIE
24603         When generating TLS dynamic relocations the existing xtensa BFD code
24604         treats linking to a PIE exactly as linking to a shared object, resulting
24605         in generation of wrong relocations for TLS entries. Fix that and add
24606         tests.
24607
24608         bfd/
24609                 * elf32-xtensa.c (elf_xtensa_check_relocs): Use bfd_link_dll
24610                 instead of bfd_link_pic. Add elf_xtensa_dynamic_symbol_p test
24611                 when generating GOT entries.
24612                 (elf_xtensa_relocate_section): Use bfd_link_dll instead of
24613                 bfd_link_pic.
24614         ld/
24615                 * testsuite/ld-xtensa/tlspie.dd: New file.
24616                 * testsuite/ld-xtensa/tlspie.rd: New file.
24617                 * testsuite/ld-xtensa/tlspie.sd: New file.
24618                 * testsuite/ld-xtensa/tlspie.td: New file.
24619                 * testsuite/ld-xtensa/xtensa-linux.exp (TLS PIE transitions):
24620                 New test.
24621
24622 2022-09-02  Max Filippov  <jcmvbkbc@gmail.com>
24623
24624         xtensa: adjust expected output in ld TLS tests
24625         objdump output for l32r opcode was changed in commit b3ea76397a07
24626         ("opcodes: xtensa: display loaded literal value"), but xtensa linker TLS
24627         relaxation tests weren't adjusted accordingly.
24628         readelf output was changed in commit 23356397449a ("Adjust readelf's
24629         output so that section symbols without a name as shown with their
24630         section name."), but xtensa linker TLS relaxation tests weren't adjusted
24631         accordingly.
24632         Fix expected output changes in xtensa ld TLS relaxation tests.
24633
24634         ld/
24635                 * testsuite/ld-xtensa/tlsbin.dd: Adjust expected output for l32r
24636                 opcodes.
24637                 * testsuite/ld-xtensa/tlsbin.rd: Adjust expected output to allow
24638                 for named section symbols.
24639                 * testsuite/ld-xtensa/tlspic.dd: Adjust expected output for l32r
24640                 opcodes.
24641                 * testsuite/ld-xtensa/tlspic.rd: Adjust expected output to allow
24642                 for named section symbols.
24643
24644 2022-09-02  Frederic Cambus  <fred@statdns.com>
24645
24646         Add OpenBSD ARM Little Endian BFD support.
24647                 * config.bfd (arm-*-openbsd*): Restore target.
24648
24649 2022-09-02  Tsukasa OI  <research_trasio@irq.a4lg.com>
24650
24651         RISC-V: Print highest address (-1) on the disassembler
24652         This patch makes possible to print the highest address (-1) and the addresses
24653         related to gp which value is -1.  This is particularly useful if the highest
24654         address space is used for I/O registers and corresponding symbols are defined.
24655         Besides, despite that it is very rare to have GP the highest address, it would
24656         be nice because we enabled highest address printing on regular cases.
24657
24658         gas/ChangeLog:
24659
24660                 * testsuite/gas/riscv/dis-addr-topaddr.s: New test for the top
24661                 address (-1) printing.
24662                 * testsuite/gas/riscv/dis-addr-topaddr-32.d: Likewise.
24663                 * testsuite/gas/riscv/dis-addr-topaddr-64.d: Likewise.
24664                 * testsuite/gas/riscv/dis-addr-topaddr-gp.s: New test for
24665                 GP-relative addressing when GP is the highest address (-1).
24666                 * testsuite/gas/riscv/dis-addr-topaddr-gp-32.d: Likewise.
24667                 * testsuite/gas/riscv/dis-addr-topaddr-gp-64.d: Likewise.
24668
24669         opcodes/ChangeLog:
24670
24671                 * riscv-dis.c (struct riscv_private_data): Add `to_print_addr' to
24672                 enable printing the highest address.
24673                 (maybe_print_address): Utilize `to_print_addr'.
24674                 (riscv_disassemble_insn): Likewise.
24675
24676 2022-09-02  Tsukasa OI  <research_trasio@irq.a4lg.com>
24677
24678         RISC-V: PR29342, Fix RV32 disassembler address computation
24679         If either the base register is `zero', `tp' or `gp' and XLEN is 32, an
24680         incorrectly sign-extended address is produced when printing.  This commit
24681         fixes this by fitting an address into a 32-bit value on RV32.
24682
24683         Besides, H. Peter Anvin discovered that we have wrong address computation
24684         for JALR instruction (the initial bug is back in 2018).  This commit also
24685         fixes that based on the idea of Palmer Dabbelt.
24686
24687         gas/
24688                 pr29342
24689                 * testsuite/gas/riscv/lla32.d: Reflect RV32 address computation fix.
24690                 * testsuite/gas/riscv/dis-addr-overflow.s: New testcase.
24691                 * testsuite/gas/riscv/dis-addr-overflow-32.d: Likewise.
24692                 * testsuite/gas/riscv/dis-addr-overflow-64.d: Likewise.
24693         opcodes/
24694                 pr29342
24695                 * riscv-dis.c (maybe_print_address): Fit address into 32-bit on RV32.
24696                 (print_insn_args): Fix JALR address by adding EXTRACT_ITYPE_IMM.
24697
24698 2022-09-02  Tsukasa OI  <research_trasio@irq.a4lg.com>
24699
24700         RISC-V: Add address printer tests with ADDIW
24701         Address sequences involving ADDIW/C.ADDIW instructions require special
24702         handling to sign-extend lower 32-bits of the original result.
24703
24704         This commit tests whether this sign-extension works.
24705
24706         gas/ChangeLog:
24707
24708                 * testsuite/gas/riscv/dis-addr-addiw.s: New to test the address
24709                 computation with sign extension as used in ADDIW/C.ADDIW.
24710                 * testsuite/gas/riscv/dis-addr-addiw-a.d: Test PC sign bit 0.
24711                 * testsuite/gas/riscv/dis-addr-addiw-b.d: Test PC sign bit 1.
24712
24713         gas/ChangeLog:
24714
24715                 * testsuite/gas/riscv/dis-addr-addiw-a.d: New test.
24716                 * testsuite/gas/riscv/dis-addr-addiw-b.d: New test.
24717                 * testsuite/gas/riscv/dis-addr-addiw.s: New test.
24718
24719 2022-09-02  GDB Administrator  <gdbadmin@sourceware.org>
24720
24721         Automatic date update in version.in
24722
24723 2022-09-01  Tsukasa OI  <research_trasio@irq.a4lg.com>
24724
24725         sim: Update mailing list address
24726         The commit bf1102165389 "* MAINTAINERS: Perform some obvious fixups."
24727         back in 2009 changed the mailing list address gdb-patches@sources.redhat.com
24728         to gdb-patches@sourceware.org.
24729
24730         This commit does the same to sim/MAINTAINERS.
24731
24732         sim/ChangeLog:
24733
24734                 * MAINTAINERS: Update mailing list address.
24735
24736         Change-Id: I56c6bf21a4bddfb35ffc3336ffcba7ff9b39926e
24737
24738 2022-09-01  Nick Clifton  <nickc@redhat.com>
24739
24740         dllwrap, windres and dlltools use mktemp, which should be avoided
24741                 PR 29534
24742                 * dllwrap.c: Replace uses of choose_temp_base() with
24743                 make_temp_file().
24744                 * dlltool.c: Likewise.
24745                 * resrc.c: Likewise.
24746
24747 2022-09-01  Maciej W. Rozycki  <macro@embecosm.com>
24748
24749         GDB/doc: Document the Guile `#:unlimited' keyword
24750         Document the Guile `#:unlimited' keyword and deprecate the internal
24751         integer representation it corresponds to for integer parameters.
24752
24753 2022-09-01  Lancelot SIX  <lancelot.six@amd.com>
24754
24755         gdb/python-config: replace deprecated distutils.sysconfig
24756         When running the gdb/configure script on ubuntu 22.04 with
24757         python-3.10.4, I see:
24758
24759             checking for python... no
24760             checking for python3... /usr/bin/python3
24761             [...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
24762               from distutils import sysconfig
24763             [...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
24764               from distutils import sysconfig
24765             [...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
24766               from distutils import sysconfig
24767             [...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
24768               from distutils import sysconfig
24769             [...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
24770               from distutils import sysconfig
24771             [...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
24772               from distutils import sysconfig
24773             checking for python... yes
24774
24775         The distutils module is deprecated as per the PEP 632[1] and will be
24776         removed in python-3.12.
24777
24778         This patch migrates gdb/python/python-config.py from distutils.sysconfig
24779         to the sysconfig module[2].
24780
24781         The sysconfig module has has been introduced in the standard library in
24782         python 3.2.  Given that support for python < 3.2 has been removed by
24783         edae3fd6600f: "gdb/python: remove Python 2 support", this patch does not
24784         need to support both implementations for backward compatibility.
24785
24786         Tested on ubuntu-22.04 and ubuntu 20.04.
24787
24788         [1] https://peps.python.org/pep-0632/
24789         [2] https://docs.python.org/3/library/sysconfig.html
24790
24791         Change-Id: Id0df2baf3ee6ce68bd01c236b829ab4c0a4526f6
24792
24793 2022-09-01  GDB Administrator  <gdbadmin@sourceware.org>
24794
24795         Automatic date update in version.in
24796
24797 2022-08-31  Tom Tromey  <tromey@adacore.com>
24798
24799         Fix interpreter-exec crash
24800         PR mi/10347 points out that using interpreter-exec inside of a
24801         "define" command will crash gdb.  The bug here is that
24802         gdb_setup_readline doesn't check for the case where instream==nullptr.
24803
24804         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=10347
24805
24806 2022-08-31  Tom Tromey  <tromey@adacore.com>
24807
24808         Fix "source" with interpreter-exec
24809         PR mi/15811 points out that "source"ing a file that uses
24810         interpreter-exec will put gdb in a weird state, where the CLI stops
24811         working.  The bug is that tui_interp::suspend does not unregister the
24812         event file descriptor.
24813
24814         The test case is from Andrew Burgess.
24815
24816         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=15811
24817
24818 2022-08-31  Tom Tromey  <tromey@adacore.com>
24819
24820         Remove a call to clear_interpreter_hooks
24821         mi_interp::resume does not need to call clear_interpreter_hooks,
24822         because this is already done by interp_set.
24823
24824         TUI stdout buffering cleanup
24825         The TUI checks against gdb_stdout to decide when to buffer.  It seems
24826         much cleaner to me to simply record this as an attribute of the stream
24827         itself.
24828
24829         Remove a ui-related memory leak
24830         gdb_setup_readline makes new streams and assigns to the various stream
24831         members of struct ui.  However, these assignments cause the previous
24832         values to leak.  As far as I can, this code is simply unnecessary and
24833         can be removed -- with the exception of the assignment to gdb_stdtarg,
24834         which is not initialized anywhere else.
24835
24836         Remove tui_out_new
24837         tui_out_new is just a simple wrapper for 'new' and can be removed,
24838         simplifying gdb a tiny bit.
24839
24840         Use scoped_restore in safe_parse_type
24841         This changes safe_parse_type to use scoped_restore rather than
24842         explicit assignments.
24843
24844         Use member initialization in 'struct ui'
24845         This changes 'struct ui' to use member initialization.  This is
24846         simpler to understand.
24847
24848         Remove two unused members from mi_interp
24849         These members of mi_interp aren't used and can be removed.
24850
24851         Remove obsolete filtering comment
24852         top.h has an obsolete comment about the use of _unfiltered.
24853
24854         Remove the "for moment" comments
24855         A few spots setting some gdb output stream variables have a "for
24856         moment" comment.  These comments aren't useful and I think the moment
24857         has passed -- these are permanent now.
24858
24859         Use ui_out_redirect_pop in more places
24860         This changes ui_out_redirect_pop to also perform the redirection, and
24861         then updates several sites to use this, rather than explicit
24862         redirects.
24863
24864         Free ui::line_buffer
24865         A ui initializes its line_buffer, but never calls buffer_free on it.
24866         This patch fixes the oversight.  I found this by inspection.
24867
24868         Remove some dead code
24869         This patch removes some dead code and an old FIXME.  These no longer
24870         seem useful, even for documentation purposes.
24871
24872         Let ui::input_fd be -1
24873         This changes gdb so that, if ui::input_fd is set to -1, then it will
24874         not be registered with the event loop.  This is useful for the DAP
24875         support code I wrote, but as it turns out to also be useful to
24876         Insight, it seems best to check it in separately.
24877
24878 2022-08-31  Andrew Burgess  <aburgess@redhat.com>
24879
24880         gdb/riscv: better support for fflags and frm registers
24881         First, some background on the RISC-V registers fflags, frm, and fcsr.
24882
24883         These three registers all relate to the floating-point status and
24884         control mechanism on RISC-V.  The fcsr is the floatint-point control
24885         status register, and consists of two parts, the flags (bits 0 to 4)
24886         and the rounding-mode (bits 5 to 7).
24887
24888         The fcsr register is just one of many control/status registers (or
24889         CSRs) available on RISC-V.  The fflags and frm registers are also
24890         CSRs.  These CSRs are aliases for the relevant parts of the fcsr
24891         register.  So fflags is an alias for bits 0 to 4 of fcsr, and frm is
24892         an alias for bits 5 to 7 of fcsr.
24893
24894         This means that a user can change the floating-point rounding mode
24895         either, by writing a complete new value into fcsr, or by writing just
24896         the rounding mode into frm.
24897
24898         How this impacts on GDB is like this: a target description could,
24899         legitimately include all three registers, fcsr, fflags, and frm.  The
24900         QEMU target currently does this, and this makes sense.  The target is
24901         emulating the complete system, and has all three CSRs available, so
24902         why not tell GDB about this.
24903
24904         In contrast, the RISC-V native Linux target only has access to the
24905         fcsr.  This is because the ptrace data structure that the kernel uses
24906         for reading and writing floating point state only contains a copy of
24907         the fcsr, after all, this one field really contains both the fflags
24908         and frm fields, so why carry around duplicate data.
24909
24910         So, we might expect that the target description for the RISC-V native
24911         Linux GDB would only contain the fcsr register.  Unfortunately, this
24912         is not the case.  The RISC-V native Linux target uses GDB's builtin
24913         target descriptions by calling riscv_lookup_target_description, this
24914         will then add an fpu feature from gdb/features/riscv, either
24915         32bit-fpu.xml or 64bit-fpu.xml.  The problem, is that these features
24916         include an entry for fcsr, fflags, and frm.  This means that GDB
24917         expects the target to handle reading and writing these registers.  And
24918         the RISC-V native Linux target currently doesn't.
24919
24920         In riscv_linux_nat_target::store_registers and
24921         riscv_linux_nat_target::fetch_registers only the fcsr register is
24922         handled, this means that, for RISC-V native Linux, the fflags and frm
24923         registers always show up as <unavailable> - they are present in the
24924         target description, but the target doesn't know how to access the
24925         registers.
24926
24927         A final complication relating to these floating pointer CSRs is which
24928         target description feature the registers appear in.
24929
24930         These registers are CSRs, so it would seem sensible that these
24931         registers should appear in the CSR target description feature.
24932
24933         However, when I first added RISC-V target description support, I was
24934         using a RISC-V simulator that didn't support any CSRs other than the
24935         floating point related ones.  This simulator bundled all the float
24936         related CSRs into the fpu target feature.  This didn't feel completely
24937         unreasonable to me, and so I had GDB check for these registers in
24938         either target feature.
24939
24940         In this commit I make some changes relating to how GDB handles the
24941         three floating point CSR:
24942
24943         1. Remove fflags and frm from 32bit-fpu.xml and 64bit-fpu.xml.  This
24944         means that the default RISC-V target description (which RISC-V native
24945         FreeBSD), and the target descriptions created for RISC-V native Linux,
24946         will not include these registers.  There's nothing stopping some other
24947         target (e.g. QEMU) from continuing to include all three of these CSRs,
24948         the code in riscv-tdep.c continues to check for all three of these
24949         registers, and will handle them correctly if they are present.
24950
24951         2. If a target supplied fcsr, but does not supply fflags and/or frm,
24952         then RISC-V GDB will now create two pseudo registers in order to
24953         emulate the two missing CSRs.  These new pseudo-registers do the
24954         obvious thing of just reading and writing the fcsr register.
24955
24956         3. With the new pseudo-registers we can no longer make use of the GDB
24957         register numbers RISCV_CSR_FFLAGS_REGNUM and RISCV_CSR_FRM_REGNUM.
24958         These will be the numbers used if the target supplies the registers in
24959         its target description, but, if GDB falls back to using
24960         pseudo-registers, then new, unique numbers will be used.  To handle
24961         this I've added riscv_gdbarch_tdep::fflags_regnum and
24962         riscv_gdbarch_tdep::frm_regnum, I've then updated the RISC-V code to
24963         compare against these fields.
24964
24965         When adding the pseudo-register support, it is important that the
24966         pseudo-register numbers are calculated after the call to
24967         tdesc_use_registers.  This is because we don't know the total number
24968         of physical registers until after this call, and the psuedo-register
24969         numbers must follow on from the real (target supplied) registers.
24970
24971         I've updated some tests to include more testing of the fflags and frm
24972         registers, as well as adding a new test.
24973
24974 2022-08-31  Andrew Burgess  <aburgess@redhat.com>
24975
24976         gdb: Add tdesc_found_register function to tdesc API
24977         This commit adds a new function to the target description API within
24978         GDB.  This new function is not used in this commit, but will be used
24979         in the next commit, I'm splitting it out into a separate patch for
24980         easier review.
24981
24982         What I want to do in the next commit is check to see if a target
24983         description supplied a particular register, however, the register in
24984         question could appear in one of two possible features.
24985
24986         The new function allows me to ask the tdesc_arch_data whether a
24987         register was found and assigned a particular GDB register number once
24988         all of the features have been checked.  I think this is a much simpler
24989         solution than adding code such that, while checking each feature, I
24990         spot if the register I'm processing is the one I care about.
24991
24992         No tests here as the new code is not used, but this code will be
24993         exercised in the next commit.
24994
24995 2022-08-31  Andrew Burgess  <aburgess@redhat.com>
24996
24997         gdb/riscv: improve (and fix) display of frm field in 'info registers'
24998         On RISC-V the FCSR (float control/status register) is split into two
24999         parts, FFLAGS (the flags) and FRM (the rounding mode).  Both of these
25000         two fields are part of the FCSR register, but can also be accessed as
25001         separate registers in their own right.  And so, we have three separate
25002         registers, $fflags, $frm, and $fcsr, with the last of these being the
25003         combination of the first two.
25004
25005         Here's how the bits of FCSR are split between FRM and FFLAGS:
25006
25007                  ,--------- FFLAGS
25008                |---|
25009             76543210 <----- FCSR
25010             |-|
25011              '--------------FRM
25012
25013         Here's how GDB currently displays these registers:
25014
25015           (gdb) info registers $fflags $frm $fcsr
25016           fflags         0x0      RD:0 NV:0 DZ:0 OF:0 UF:0 NX:0
25017           frm            0x0      FRM:0 [RNE (round to nearest; ties to even)]
25018           fcsr           0x0      RD:0 NV:0 DZ:0 OF:0 UF:0 NX:0 FRM:0 [RNE (round to nearest; ties to even)]
25019
25020         Notice the 'RD' field which is present in both $fflags and $fcsr.
25021         This field contains the value of the FRM field, which makes sense when
25022         displaying the $fcsr, but makes no sense when displaying $fflags, as
25023         the $fflags doesn't include the FRM field.
25024
25025         Additionally, the $fcsr already includes an FRM field, so the
25026         information in 'RD' is duplicated.  Consider this:
25027
25028           (gdb) set $frm = 0x3
25029           (gdb) info registers $fflags $frm $fcsr                             │
25030           fflags         0x0      RD:0 NV:0 DZ:0 OF:0 UF:0 NX:0
25031           frm            0x3      FRM:3 [RUP (Round up towards +INF)]
25032           fcsr           0x60     RD:3 NV:0 DZ:0 OF:0 UF:0 NX:0 FRM:3 [RUP (Round up towards +INF)]
25033
25034         See how the 'RD' field in $fflags still displays 0, while the 'RD' and
25035         'FRM' fields in $fcsr show the same information.
25036
25037         The first change I propose in this commit is to remove the 'RD'
25038         field.  After this change the output now looks like this:
25039
25040           (gdb) info registers $fflags $frm $fcsr
25041           fflags         0x0      NV:0 DZ:0 OF:0 UF:0 NX:0
25042           frm            0x0      FRM:0 [RNE (round to nearest; ties to even)]
25043           fcsr           0x0      NV:0 DZ:0 OF:0 UF:0 NX:0 FRM:0 [RNE (round to nearest; ties to even)]
25044
25045         Next, I spotted that the text that goes along with the 'FRM' field was
25046         not wrapped in the i18n markers for internationalisation, so I added
25047         those.
25048
25049         Next, I spotted that:
25050
25051           (gdb) set $frm=0x7
25052           (gdb) info registers $fflags $frm $fcsr
25053           fflags         0x0      RD:0 NV:0 DZ:0 OF:0 UF:0 NX:0
25054           frm            0x7      FRM:3 [RUP (Round up towards +INF)]
25055           fcsr           0xe0     RD:7 NV:0 DZ:0 OF:0 UF:0 NX:0 FRM:3 [RUP (Round up towards +INF)]
25056
25057         Notice that despite being a 3-bit field, FRM masks to 2-bits.
25058         Checking the manual I can see that the FRM field is 3-bits, and is
25059         defined for all 8 values.  That GDB masks to 2-bits is just a bug I
25060         think, so I've fixed this.
25061
25062         Finally, the 'FRM' text for value 0x7 is wrong.  Currently we use the
25063         text 'dynamic rounding mode' for value 0x7.  However, this is not
25064         really correct.
25065
25066         A RISC-V instruction can either encode the rounding mode within the
25067         instruction, or a RISC-V instruction can choose to use a global,
25068         dynamic rounding mode.
25069
25070         So, for the rounding-mode field of an _instruction_ the value 0x7
25071         indicates "dynamic round mode", the instruction should defer to the
25072         rounding mode held in the FRM field of the $fcsr.
25073
25074         But it makes no sense for the FRM of $fcsr to itself be set to
25075         0x7 (dynamic rounding mode), and indeed, section 11.2, "Floating-Point
25076         Control and Status Register" of the RISC-V manual, says that a value
25077         of 0x7 in the $fcsr FRM field is invalid, and if an instruction has
25078         _its_ round-mode set to dynamic, and the FRM field is also set to 0x7,
25079         then an illegal instruction exception is raised.
25080
25081         And so, I propose changing the text for value 0x7 of the FRM field to
25082         be "INVALID[7] (Dynamic rounding mode)".  We already use the text
25083         "INVALID[5]" and "INVALID[6]" for the two other invalid fields,
25084         however, I think adding the extra "Dynamic round mode" hint might be
25085         helpful.
25086
25087         I've added a new test that uses 'info registers' to check what GDB
25088         prints for the three registers related to this patch.  There is one
25089         slight oddity with this test - for the fflags and frm registers, the
25090         test accepts both the "normal" output (as described above), but also
25091         allows these registers to be reported as '<unavailable>'.
25092
25093         The reason why I accept <unavailable> is that currently, the RISC-V,
25094         native Linux target advertises these registers in its target
25095         description, but then doesn't support reading or writing of these
25096         registers, this results in the registers being reported as
25097         unavailable.
25098
25099         A later patch in this series will address this issue, and will remove
25100         this check for <unavailable>.
25101
25102 2022-08-31  Frederic Cambus  <fred@statdns.com>
25103
25104         Add OpenBSD AArch64 GAS support.
25105                 * configure.tgt (aarch64*-*-openbsd*): Add target.
25106
25107 2022-08-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
25108
25109         gdb, dwarf: create symbols for template tags without names
25110         The following GDB behavior was also reported as a GDB bug in
25111
25112           https://sourceware.org/bugzilla/show_bug.cgi?id=28396
25113
25114         I will reiterate the problem a bit and give some more information here.
25115         This patch closes the above mentioned bug.
25116
25117         The DWARF 5 standard 2.23 'Template Parameters' reads:
25118
25119            A template type parameter is represented by a debugging information
25120            entry with the tag DW_TAG_template_type_parameter.  A template value
25121            parameter is represented by a debugging information entry with the tag
25122            DW_TAG_template_value_parameter.  The actual template parameter entries
25123            appear in the same order as the corresponding template formal
25124            parameter declarations in the source progam.
25125
25126            A type or value parameter entry may have a DW_AT_name attribute, whose
25127            value is a null-terminated string containing the name of the
25128            corresponding formal parameter.
25129
25130         So the DW_AT_name attribute for DW_TAG_template_type_parameter and
25131         DW_TAG_template_value_parameter is optional.
25132
25133         Within GDB, creating a new symbol from some read DIE usually requires the
25134         presence of a DW_AT_name for the DIE (an exception here is the case of
25135         unnamed namespaces or the existence of a linkage name).
25136
25137         This patch makes the presence of the DW_AT_name for template value/type
25138         tags optional, similar to the unnamed namespaces.
25139
25140         For unnamed namespaces dwarf2_name simply returns the constant string
25141         CP_ANONYMOUS_NAMESPACE_STR '(anonymous namespace)'.  For template tags a
25142         case was added to the switch statement calling the
25143         unnamed_template_tag_name helper.  Within the scope of parent which
25144         the template parameter is a child of, the helper counts the position
25145         of the template tag within the unnamed template tags and returns
25146         '<unnamedNUMBER>' where NUMBER is its position.  This way we end up with
25147         unique names within the respective scope of the function/class/struct
25148         (these are the only currenltly supported template kinds within GDB and
25149         usually the compilers) where we discovered the template tags in.
25150
25151         While I do not know of a way to bring GCC to emit template tags without
25152         names there is one for clang/icpx.  Consider the following example
25153
25154           template<typename A, typename B, typename C>
25155           class Foo {};
25156
25157           template<typename, typename B, typename>
25158           class Foo;
25159
25160           int main () {
25161             Foo<double, int, float> f;
25162             return 0;
25163           }
25164
25165         The forward declaration for 'Foo' with the missing template type names
25166         'A' and 'C' makes clang emit a bunch of template tags without names:
25167
25168          ...
25169           <2><43>: Abbrev Number: 3 (DW_TAG_variable)
25170             <44>   DW_AT_location    : 2 byte block: 91 78      (DW_OP_fbreg: -8)
25171             <47>   DW_AT_name        : (indirect string, offset: 0x63): f
25172             <4b>   DW_AT_decl_file   : 1
25173             <4c>   DW_AT_decl_line   : 8
25174             <4d>   DW_AT_type        : <0x59>
25175          ...
25176          <1><59>: Abbrev Number: 5 (DW_TAG_class_type)
25177             <5a>   DW_AT_calling_convention: 5  (pass by value)
25178             <5b>   DW_AT_name        : (indirect string, offset: 0x74): Foo<double, int, float>
25179             <5f>   DW_AT_byte_size   : 1
25180             <60>   DW_AT_decl_file   : 1
25181             <61>   DW_AT_decl_line   : 2
25182          <2><62>: Abbrev Number: 6 (DW_TAG_template_type_param)
25183             <63>   DW_AT_type        : <0x76>
25184          <2><67>: Abbrev Number: 7 (DW_TAG_template_type_param)
25185             <68>   DW_AT_type        : <0x52>
25186             <6c>   DW_AT_name        : (indirect string, offset: 0x6c): B
25187          <2><70>: Abbrev Number: 6 (DW_TAG_template_type_param)
25188             <71>   DW_AT_type        : <0x7d>
25189          ...
25190
25191         Befor this patch, GDB would not create any symbols for the read template
25192         tag DIEs and thus lose knowledge about them.  Breaking at the return
25193         statement and printing f's type would read
25194
25195           (gdb) ptype f
25196           type = class Foo<double, int, float> [with B = int] {
25197               <no data fields>
25198           }
25199
25200         After this patch GDB does generate symbols from the DWARF (with their
25201         artificial names:
25202
25203           (gdb) ptype f
25204           type = class Foo<double, int, float> [with <unnamed0> = double, B = int,
25205           <unnamed1> = float] {
25206               <no data fields>
25207           }
25208
25209         The same principle theoretically applies to template functions.  Also
25210         here, GDB would not record unnamed template TAGs but I know of no visual
25211         way to trigger and test this changed behavior.  Template functions do
25212         not emit a '[with...]' list and their name generation also does not
25213         suffer from template tags without names.  GDB does not check whether or
25214         not a template tag has a name in 'dwarf2_compute_name' and thus, the
25215         names of the template functions are created independently of whether or
25216         not the template TAGs have a DW_TAT_name attribute.  A testcase has
25217         been added in the gdb.dwarf2 for template classes and structs.
25218
25219         Bug:  https://sourceware.org/bugzilla/show_bug.cgi?id=28396
25220
25221 2022-08-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
25222
25223         gdb, testsuite: adapt function_range expected name
25224         When writing a dwarf testcase for some C++ code I wanted to use the
25225         MACRO_AT_range which in turn uses the function_range proc in dwarf.exp
25226         to extract the bounds of 'main'.
25227
25228         However, the macro failed as GDB prints the C++ 'main' with its
25229         arguments as 'main(int, char**)' or 'main()'.
25230
25231         The reason for this is that in read.c::dwarf2_compute_name we call
25232         c_type_print_args on C++ functions and append their arguments to the
25233         function name.  This happens to all C++ functions, but is only visible
25234         when the function doesn't have a linkage name.
25235
25236         An example might make this more clear.  Given the following code
25237
25238           >> cat c.cpp
25239           int foo (int a, float b)
25240           {
25241             return 0;
25242           }
25243
25244           int main (int argc, char **argv)
25245           {
25246             return 0;
25247           }
25248
25249         which is legal in both languages, C and C++, and compiling it with
25250         e.g. clang or gcc will make the disassemble command look like:
25251
25252           >> clang --version
25253           clang version 10.0.0-4ubuntu1
25254           ...
25255           >> clang -O0 -g ./c.cpp
25256           >> gdb -q ./a.out -ex "start"
25257           ...
25258           (gdb) disassemble main
25259           Dump of assembler code for function main(int, char**):
25260              0x0000000000401120 <+0>:     push   %rbp
25261              0x0000000000401121 <+1>:     mov    %rsp,%rbp
25262           ...
25263              0x0000000000401135 <+21>:    ret
25264           End of assembler dump.
25265           (gdb) disassemble foo
25266           Dump of assembler code for function _Z3fooif:
25267              0x0000000000401110 <+0>:     push   %rbp
25268              0x0000000000401111 <+1>:     mov    %rsp,%rbp
25269           ...
25270              0x000000000040111f <+15>:    ret
25271           End of assembler dump.
25272
25273         Note, that main is emitted with its arguments while for foo the linkage
25274         name is being printed, as also visible in its DWARF:
25275
25276           >> objdump ./a.out --dwarf=info | grep "foo" -A3 -B3
25277               <2b>   DW_AT_low_pc      : 0x401110
25278               <33>   DW_AT_high_pc     : 0x10
25279               <37>   DW_AT_frame_base  : 1 byte block: 56         (DW_OP_reg6 (rbp))
25280               <39>   DW_AT_linkage_name: (indirect string, offset: 0x39): _Z3fooif
25281               <3d>   DW_AT_name        : (indirect string, offset: 0x42): foo
25282               <41>   DW_AT_decl_file   : 1
25283               <42>   DW_AT_decl_line   : 1
25284               <43>   DW_AT_type        : <0x9a>
25285
25286         Now, let's rename the C++ file and compile it as C:
25287
25288           >> mv c.cpp c.c
25289           >> clang -O0 -g ./c.c
25290           >> gdb -q ./a.out -ex "start'
25291           ...
25292           (gdb) disassemble main
25293           Dump of assembler code for function main:
25294              0x0000000000401120 <+0>:     push   %rbp
25295              0x0000000000401121 <+1>:     mov    %rsp,%rbp
25296           ...
25297              0x0000000000401135 <+21>:    ret
25298           End of assembler dump.
25299           (gdb) disassemble foo
25300           Dump of assembler code for function foo:
25301              0x0000000000401110 <+0>:     push   %rbp
25302              0x0000000000401111 <+1>:     mov    %rsp,%rbp
25303           ...
25304              0x000000000040111f <+15>:    ret
25305           End of assembler dump.
25306
25307         Note, for foo we did not get a linkage name emitted in DWARF, so
25308         it is printed by its name:
25309
25310           >> objdump --dwarf=info ./a.out | grep foo -A3 -B3
25311               <2b>   DW_AT_low_pc      : 0x401110
25312               <33>   DW_AT_high_pc     : 0x10
25313               <37>   DW_AT_frame_base  : 1 byte block: 56         (DW_OP_reg6 (rbp))
25314               <39>   DW_AT_name        : (indirect string, offset: 0x37): foo
25315               <3d>   DW_AT_decl_file   : 1
25316               <3e>   DW_AT_decl_line   : 1
25317               <3f>   DW_AT_prototyped  : 1
25318
25319         To make the macro and proc work with C++ as well, an optional argument
25320         list was added to the regex matching the function name in the
25321         disassemble command in function_range.  This does not change any used
25322         behavior as currently, there exists no C++ test using the proc
25323         function_range.
25324
25325 2022-08-31  Aaron Merey  <amerey@redhat.com>
25326
25327         gdb/elfread.c: Use bfd filename instead of objfile->original_name
25328         The call to debuginfod_debuginfo_query in elf_symfile_read is given
25329         objfile->original_name as the filename to print when downloading the
25330         objfile's debuginfo.
25331
25332         In some cases original_name is prefixed with gdb's working directory
25333         even though the objfile is not located in the working directory. This
25334         causes debuginfod to display the wrong path of the objfile during a download.
25335
25336         Fix this by using the objfile's bfd filename instead.
25337
25338 2022-08-31  GDB Administrator  <gdbadmin@sourceware.org>
25339
25340         Automatic date update in version.in
25341
25342 2022-08-30  Martin Storsjö  <martin@martin.st>
25343
25344         ld: pe: Fix linking against Microsoft import libraries with multiple DLLs
25345         Initially, since c6c37250e98f113755e0d787f7070e2ac80ce77e (in 1999),
25346         in order to fix linking against Microsoft import libraries, ld did
25347         internally rename members of such libraries. At that point, the
25348         criteria for being considered a Microsoft import library was that
25349         every archive member had the same name (no regard for exactly what
25350         that name was).
25351
25352         This was later amended in 44dbf3639f127af46d569ad96b6242dfbc4c0a89
25353         (in 2003) to allow for Microsoft import libraries with intermixed
25354         static object files. At this point, the criteria were extended, so
25355         that all members following the first member named *.dll either had
25356         the exact same member name, or be named *.obj. (Curiously, this would
25357         allow members with any name if it precedes the first one named *.dll.)
25358
25359         In practice, Microsoft style import libraries can contain
25360         members for linking against more than one DLL (built by merging
25361         multiple regular import libraries into one).
25362
25363         Instead of trying to do validation of the whole archive before
25364         considering it a Microsoft style import library, relax the criteria
25365         for doing the member renaming: If an archive member is named *.dll
25366         and it contains .idata sections, assume that that member is a
25367         Microsoft import file, and apply the renaming scheme.
25368
25369         This works for imports for any number of DLLs in the same library,
25370         intermixed with other static object files (regardless of their
25371         names), and vastly simplifies the code.
25372
25373         LLVM generates Microsoft style import libraries, and Rust builds
25374         seem to bundle up multiple import libraries together with some
25375         Rust specific static objects. This fixes linking directly against
25376         them with ld.bfd.
25377
25378 2022-08-30  Simon Marchi  <simon.marchi@polymtl.ca>
25379
25380         gdbsupport: add wrapper around result_of and invoke_result
25381         When building with Clang 14 (using gcc 12 libstdc++ headers), I get:
25382
25383               CXX    dwarf2/read.o
25384             In file included from /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:94:
25385             /home/simark/src/binutils-gdb/gdb/../gdbsupport/parallel-for.h:142:21: error: 'result_of<(lambda at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7124:5) (__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> *, std::__cxx1998::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>>, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>, std::random_access_iterator_tag>, __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> *, std::__cxx1998::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>>, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>, std::random_access_iterator_tag>)>' is deprecated: use 'std::invoke_result' instead [-Werror,-Wdeprecated-declarations]
25386                 = typename std::result_of<RangeFunction (RandomIt, RandomIt)>::type;
25387                                 ^
25388             /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7122:14: note: in instantiation of function template specialization 'gdb::parallel_for_each<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> *, std::__cxx1998::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>>, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>, std::random_access_iterator_tag>, (lambda at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7124:5)>' requested here
25389                   = gdb::parallel_for_each (1, per_bfd->all_comp_units.begin (),
25390                          ^
25391             /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../include/c++/12.1.1/type_traits:2597:9: note: 'result_of<(lambda at /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:7124:5) (__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> *, std::__cxx1998::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>>, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>, std::random_access_iterator_tag>, __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> *, std::__cxx1998::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>>, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>>, std::random_access_iterator_tag>)>' has been explicitly marked deprecated here
25392                 { } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result");
25393                     ^
25394             /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../include/c++/12.1.1/x86_64-pc-linux-gnu/bits/c++config.h:120:45: note: expanded from macro '_GLIBCXX17_DEPRECATED_SUGGEST'
25395             # define _GLIBCXX17_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT)
25396                                                         ^
25397             /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../include/c++/12.1.1/x86_64-pc-linux-gnu/bits/c++config.h:96:19: note: expanded from macro '_GLIBCXX_DEPRECATED_SUGGEST'
25398               __attribute__ ((__deprecated__ ("use '" ALT "' instead")))
25399                               ^
25400
25401         It complains about the use of std::result_of, which is deprecated in
25402         C++17 and removed in C++20:
25403
25404           https://en.cppreference.com/w/cpp/types/result_of
25405
25406         Given we'll have to transition to std::invoke_result eventually, make a
25407         GDB wrapper to mimimc std::invoke_result, which uses std::invoke_result
25408         for C++ >= 17 and std::result_of otherwise.  This way, it will be easy
25409         to remove the wrapper in the future, just replace gdb:: with std::.
25410
25411         Tested by building with gcc 12 in -std=c++11 and -std=c++17 mode, and
25412         clang in -std=c++17 mode (I did not test fully with clang in -std=c++11
25413         mode because there are other unrelated issues).
25414
25415         Change-Id: I50debde0a3307a7bc67fcf8fceefda51860efc1d
25416
25417 2022-08-30  Tom Tromey  <tromey@adacore.com>
25418
25419         Fix flush for sys.stderr
25420         GDB overwrites Python's sys.stdout and sys.stderr, but does not
25421         properly implement the 'flush' method -- it only ever will flush
25422         stdout.  This patch fixes the bug.  I couldn't find a straightforward
25423         way to write a test for this.
25424
25425         Fix gdb.flush documentation
25426         The gdb.flush documentation does not mention the 'stream' argument in
25427         the function signature, only in the description.  This patch fixes the
25428         oversight.
25429
25430 2022-08-30  Nick Clifton  <nickc@redhat.com>
25431
25432         BFD library: Use entry 0 in directory and filename tables of DWARF-5 debug info.
25433                 PR 29529
25434                 * dwarf2.c (struct line_info_table): Add new field:
25435                 use_dir_and_file_0.
25436                 (concat_filename): Use new field to help select the correct table
25437                 slot.
25438                 (read_formatted_entries): Do not skip entry 0.
25439                 (decode_line_info): Set new field depending upon the version of
25440                 DWARF being parsed.  Initialise filename based upon the setting of
25441                 the new field.
25442
25443 2022-08-30  Enze Li  <enze.li@hotmail.com>
25444
25445         gdb: update ranged_breakpoint::print_one_detail in comments
25446         The print_one_detail_ranged_breakpoint has been renamed to
25447         ranged_breakpoint::print_one_detail in this commit:
25448
25449           commit ec45bb676c9c69c30783bcf35ffdac8280f3b8bc
25450           Date:   Sat Jan 15 16:34:51 2022 -0700
25451
25452             Convert ranged breakpoints to vtable ops
25453
25454         So their comments should be updated as well.
25455
25456 2022-08-30  Nick Clifton  <nickc@redhat.com>
25457
25458         Add a testcase for PR 29494.
25459                 PR 29494
25460                 * testsuite/gas/arm/pr29494.s: New test source file.
25461                 * testsuite/gas/arm/pr29494.d: New test driver.
25462
25463 2022-08-30  liuzhensong  <liuzhensong@loongson.cn>
25464
25465         LoongArch: Fix redefinition of "PACKAGE".
25466           Running configure and make in binutils-gdb.
25467
25468           $ ./configure
25469           $ make
25470         In file included from ./as.h:37,
25471                          from ./config/loongarch-lex.l:21,
25472                          from config/loongarch-lex-wrapper.c:20:
25473         ./config.h:206: error: “PACKAGE” redefined [-Werror]
25474          #define PACKAGE "gas"
25475         ...
25476
25477           gas/config
25478           *  loongarch-lex-wrapper.c
25479
25480 2022-08-30  Tsukasa OI  <research_trasio@irq.a4lg.com>
25481
25482         RISC-V: Add 'Zmmul' extension in assembler.
25483         Three-part patch set from Tsukasa OI to support zmmul in assembler.
25484
25485         The 'Zmmul' is a RISC-V extension consisting of only multiply instructions
25486         (a subset of 'M' which has multiply and divide instructions).
25487
25488         bfd/
25489                 * elfxx-riscv.c (riscv_implicit_subsets): Add 'Zmmul' implied by 'M'.
25490                 (riscv_supported_std_z_ext): Add 'Zmmul' extension.
25491                 (riscv_multi_subset_supports): Add handling for new instruction class.
25492         gas/
25493                 * testsuite/gas/riscv/attribute-09.d: Updated implicit 'Zmmul' by 'M'.
25494                 * testsuite/gas/riscv/option-arch-02.d: Likewise.
25495                 * testsuite/gas/riscv/m-ext.s: New test.
25496                 * testsuite/gas/riscv/m-ext-32.d: New test (RV32).
25497                 * testsuite/gas/riscv/m-ext-64.d: New test (RV64).
25498                 * testsuite/gas/riscv/zmmul-32.d: New expected output.
25499                 * testsuite/gas/riscv/zmmul-64.d: Likewise.
25500                 * testsuite/gas/riscv/m-ext-fail-xlen-32.d: New test (failure
25501                 by using RV64-only instructions in RV32).
25502                 * testsuite/gas/riscv/m-ext-fail-xlen-32.l: Likewise.
25503                 * testsuite/gas/riscv/m-ext-fail-zmmul-32.d: New failure test
25504                 (RV32 + Zmmul but with no M).
25505                 * testsuite/gas/riscv/m-ext-fail-zmmul-32.l: Likewise.
25506                 * testsuite/gas/riscv/m-ext-fail-zmmul-64.d: New failure test
25507                 (RV64 + Zmmul but with no M).
25508                 * testsuite/gas/riscv/m-ext-fail-zmmul-64.l: Likewise.
25509                 * testsuite/gas/riscv/m-ext-fail-noarch-64.d: New failure test
25510                 (no Zmmul or M).
25511                 * testsuite/gas/riscv/m-ext-fail-noarch-64.l: Likewise.
25512         include/
25513                 * opcode/riscv.h (enum riscv_insn_class): Added INSN_CLASS_ZMMUL.
25514         ld/
25515                 * testsuite/ld-riscv-elf/attr-merge-arch-01.d: We don't care zmmul in
25516                 these testcases, so just replaced m by a.
25517                 * testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise.
25518                 * testsuite/ld-riscv-elf/attr-merge-arch-01b.s: Likewise.
25519                 * testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
25520                 * testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise.
25521                 * testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise.
25522                 * testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise.
25523                 * testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: Likewise.
25524                 * testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i2p1_a2p0.s: Renamed.
25525                 * testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i2p1_a2p1.s: Renamed.
25526         opcodes/
25527                 * riscv-opc.c (riscv_opcodes): Updated multiply instructions to zmmul.
25528
25529 2022-08-30  Tom de Vries  <tdevries@suse.de>
25530
25531         [gdb/symtab] Fix assert in set_length
25532         When running the included test-case, we run into:
25533         ...
25534         (gdb) break _start^M
25535         read.h:309: internal-error: set_length: \
25536           Assertion `m_length == length' failed.^M
25537         ...
25538
25539         The problem is that while there are two CUs:
25540         ...
25541         $ readelf -wi debug-names-missing-cu | grep @
25542           Compilation Unit @ offset 0x0:
25543           Compilation Unit @ offset 0x2d:
25544         ...
25545         the CU table in the .debug_names section only contains the first one:
25546         ...
25547         CU table:
25548         [  0] 0x0
25549         ...
25550
25551         The incomplete CU table makes create_cus_from_debug_names_list set the size of
25552         the CU at 0x0 to the actual size of both CUs combined.
25553
25554         This eventually leads to the assert, when we read the actual size from the CU
25555         header.
25556
25557         While having an incomplete CU table in a .debug_names section is incorrect,
25558         we need a better failure mode than asserting.
25559
25560         The easiest way to fix this is to set the length to 0 (meaning: unkown) in
25561         create_cus_from_debug_names_list.
25562
25563         This makes the failure mode to accept the incomplete CU table, but to ignore
25564         the missing CU.
25565
25566         It would be nice to instead reject the .debug_names index, and build a
25567         complete CU list, but the point where we find this out is well after
25568         dwarf2_initialize_objfile, so it looks rather intrusive to restart at that
25569         point.
25570
25571         Tested on x86_64-linux.
25572
25573         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29453
25574
25575 2022-08-30  Tom de Vries  <tdevries@suse.de>
25576
25577         [gdb/tdep] Declare score-*-* target obsolete
25578         I tried out the script gdb/gdb_mbuild.sh, and ran into:
25579         ...
25580         score-elf ...
25581         ... configure --target=score-elf
25582         ... make score-elf
25583         ... run score-elf
25584         score-elf: gdb dumped core
25585         Terminated
25586         ...
25587
25588         Gdb runs into this internal error in initialize_current_architecture:
25589         ...
25590           if (! gdbarch_update_p (info))
25591             internal_error (__FILE__, __LINE__,
25592                             _("initialize_current_architecture: Selection of "
25593                               "initial architecture failed"));
25594         ...
25595
25596         The call to gdbarch_update_p fails because commit 575b4c298a6 ("gdb: Remove
25597         support for S+core") removed support for the architecture.
25598
25599         Fix this by adding score-*-* to the list of obsolete targets in
25600         gdb/configure.tgt, such that we're no longer able to build the configuration:
25601         ...
25602         *** Configuration score-unknown-elf is obsolete.
25603         *** Support has been REMOVED.
25604         make: *** [Makefile:12806: configure-gdb] Error 1
25605         ...
25606
25607         Also remove the related line from the "Target Instruction Set Architectures"
25608         list in gdb/MAINTAINERS, such that gdb/gdb_mbuild.sh no longer tries to build
25609         it.
25610
25611 2022-08-30  GDB Administrator  <gdbadmin@sourceware.org>
25612
25613         Automatic date update in version.in
25614
25615 2022-08-29  GDB Administrator  <gdbadmin@sourceware.org>
25616
25617         Automatic date update in version.in
25618
25619 2022-08-28  Alan Modra  <amodra@gmail.com>
25620
25621         PR29494 Trailing jump table on ARM
25622         out_inc_line_addr and relax_inc_line_addr are passed INT_MAX as
25623         line_delta to flag end of section.  This filters its way down to
25624         size_inc_line_addr and emit_inc_line_addr.  Pass line_delta on to
25625         scale_addr_delta where it can be used to omit an unaligned opcode
25626         error.
25627
25628                 PR 29494
25629                 * dwarf2dbg.c (scale_addr_delta): Delete unnecessary forward decl.
25630                 Add line_delta param.  Don't print error at end of section, just
25631                 round the address down.
25632                 (size_inc_line_addr, emit_inc_line_addr): Adjust calls.
25633
25634 2022-08-28  GDB Administrator  <gdbadmin@sourceware.org>
25635
25636         Automatic date update in version.in
25637
25638 2022-08-27  rupothar  <rupesh.potharla@amd.com>
25639
25640         bfd: Fix minor bug in read_indexed_address function.
25641         read_indexed_address function is using offset_size instead of
25642         addr_size while reading addrx forms.
25643
25644 2022-08-27  GDB Administrator  <gdbadmin@sourceware.org>
25645
25646         Automatic date update in version.in
25647
25648 2022-08-26  Simon Marchi  <simon.marchi@polymtl.ca>
25649
25650         gdbsupport: fix gdb::optional compilation with C++11 && _GLIBCXX_DEBUG
25651         Similar to 911438f9f4 ("gdbsupport: fix array-view compilation with
25652         c++11 && _GLIBCXX_DEBUG"), but for gdb::optional.
25653
25654         I get this error when building with Clang 14 and -std=c++11:
25655
25656               CXX      agent.o
25657             In file included from /home/simark/src/binutils-gdb/gdbsupport/agent.cc:20:
25658             In file included from /home/simark/src/binutils-gdb/gdbsupport/common-defs.h:210:
25659             In file included from /home/simark/src/binutils-gdb/gdbsupport/common-debug.h:23:
25660             /home/simark/src/binutils-gdb/gdbsupport/../gdbsupport/gdb_optional.h:213:5: error: use of this statement in a constexpr function is a C++14 extension [-Werror,-Wc++14-extensions]
25661                 gdb_assert (this->has_value ());
25662                 ^
25663             /home/simark/src/binutils-gdb/gdbsupport/gdb_assert.h:35:3: note: expanded from macro 'gdb_assert'
25664               ((void) ((expr) ? 0 :                                                       \
25665               ^
25666
25667         Change-Id: If0cf55607fc9dbd1925ccb97cd9abbf8993ff264
25668
25669 2022-08-26  Simon Marchi  <simon.marchi@polymtl.ca>
25670
25671         gdb: change bpstat_print's kind parameter to target_waitkind
25672         Change from int to target_waitkind,  which is really what is is.  While
25673         at it, remove some outdated doc.  The return value is described by a
25674         relatively self-describing enum, not a numerical value like the doc
25675         says.
25676
25677         Change-Id: Id899c853a857c7891c45e5b1639024067d5b59cd
25678
25679 2022-08-26  Simon Marchi  <simon.marchi@efficios.com>
25680
25681         gdb, gdbsupport: configure: factor out yes/no/auto value checking
25682         Factor out the code that checks that a value is yes/no or yes/no/auto.
25683         Add two macros to gdbsupport/common.m4 and use them in gdb/configure.ac
25684
25685         I inspected the changes to configure.  Other than whitespace changes, we
25686         have some benign changes to the error messages (one of them had an error
25687         actually).  There are changes to the --enable-source-highlight and
25688         --enable-libbacktrace handling, but setting enable_source_highlight /
25689         enable_libbacktrace was not really useful anyway, they already had the
25690         right value.
25691
25692         Change-Id: I92587aec36874309e1605e2d60244649f09a757a
25693
25694 2022-08-26  Alan Modra  <amodra@gmail.com>
25695
25696         PR12265, Compiling ld/ fails on Solaris 8
25697         The fail was due to -Werror and headers included by dlfcn.h and
25698         elf-bfd.h disagreeing about AT_DCACHEBSIZE and other AT_*.  Not a
25699         serious problem obviously, since release versions of binutils don't
25700         enable -Werror and the defines are not used.  Anyway, reduce the
25701         number of files that might hit this problem by only including dlfcn.h
25702         where it is needed.
25703
25704                 PR 12265
25705                 * sysdep.h: Don't include dlfcn.h here.
25706                 * plugin.c: Include it here.
25707
25708 2022-08-26  GDB Administrator  <gdbadmin@sourceware.org>
25709
25710         Automatic date update in version.in
25711
25712 2022-08-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
25713
25714         Allow to document user-defined aliases.
25715         Compared to the previous version, this version fixes the comments reported by
25716         Tom Tromey and ensures that the 'help some-user-documented-alias'
25717         shows the alias definition to ensure the user understands this is an
25718         alias even if specifically documented.
25719
25720         When using 'help ALIASNAME', GDB shows the help of the aliased command.
25721         This is a good default behaviour.
25722
25723         However, GDB alias command allows to define aliases with arguments
25724         possibly changing or tuning significantly the behaviour of
25725         the aliased command.  In such a case, showing the help of the aliased
25726         command might not be ideal.
25727
25728         This is particularly true when defining an alias as a set of
25729         nested 'with' followed by a last command to launch, such as:
25730           (gdb) alias pp10 = with print pretty -- with print elements 10 -- print
25731         Asking 'help pp10' shows the help of the 'with' command, which is
25732         not particularly useful:
25733           (gdb) help pp10
25734           with, pp10, w
25735             alias pp10 = with print pretty -- with print elements 10 -- print
25736           Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
25737           Usage: with SETTING [VALUE] [-- COMMAND]
25738           ....
25739
25740         Such an alias can now be documented by the user:
25741           (gdb) document pp10
25742           >Pretty printing an expressiong, printing 10 elements.
25743           >Usage: pp10 [PRINT-COMMAND-OPTIONS] EXP
25744           >See 'help print' for more information.
25745           >end
25746           (gdb) help pp10
25747             alias pp10 = with print pretty -- with print elements 10 -- print
25748           Pretty printing an expressiong, printing 10 elements.
25749           Usage: pp10 [PRINT-COMMAND-OPTIONS] EXP
25750           See 'help print' for more information.
25751           (gdb)
25752
25753         When a user-defined alias is documented specifically, help and apropos
25754         use the provided alias documentation instead of the documentation of
25755         the aliased command.
25756
25757         Such a documented alias is also not shown anymore in the help of the
25758         aliased command, and the alias is not listed anymore in the help
25759         of the aliased command.  In particular for cases such as pp10 example above,
25760         indicating that pp10 is an alias of the 'with' command is confusing.
25761
25762 2022-08-25  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
25763
25764         sim/aarch64: Fix aarch64_get_CPSR_bits() declaration
25765         Noticed while doing mass builds with a very recent GCC:
25766
25767         /usr/lib/gcc-snapshot/bin/gcc  -DHAVE_CONFIG_H   -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wno-error=maybe-uninitialized -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wpointer-sign -Wold-style-declaration -Werror  -I. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64 -I../common -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../common -I../../include -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../include -I../../bfd -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../bfd -I../../opcodes -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../opcodes -I../..  -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../gnulib/import -I../../gnulib/import  -g -O2   -c -o cpustate.o -MT cpustate.o -MMD -MP -MF .deps/cpustate.Tpo cpustate.c
25768         cpustate.c:270:1: error: conflicting types for 'aarch64_get_CPSR_bits' due to enum/integer mismatch; have 'uint32_t(sim_cpu *, FlagMask)' {aka 'unsigned int(struct _sim_cpu *, FlagMask)'} [-Werror=enum-int-mismatch]
25769           270 | aarch64_get_CPSR_bits (sim_cpu *cpu, FlagMask mask)
25770               | ^~~~~~~~~~~~~~~~~~~~~
25771         In file included from sim-main.h:30,
25772                          from cpustate.c:28:
25773         cpustate.h:310:20: note: previous declaration of 'aarch64_get_CPSR_bits' with type 'uint32_t(sim_cpu *, uint32_t)' {aka 'unsigned int(struct _sim_cpu *, unsigned int)'}
25774           310 | extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
25775               |                    ^~~~~~~~~~~~~~~~~~~~~
25776         cc1: all warnings being treated as errors
25777
25778 2022-08-25  H.J. Lu  <hjl.tools@gmail.com>
25779
25780         x86: Ignore protected visibility in shared libraries on Solaris
25781         On x86, the PLT entry in executable may be used as function address for
25782         functions in shared libraries.  If functions are protected, the function
25783         address used in executable can be different from the function address
25784         used in shared library.  This will lead to incorrect run-time behavior
25785         if function pointer equality is needed.  By default, x86 linker issues
25786         an error in this case.
25787
25788         On Solaris, linker issued an error for
25789
25790         struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt);
25791
25792         where gmtime is a protected function in libc.so.  Use gmtime's PLT entry
25793         in executable as function address is safe since function pointer equality
25794         isn't needed.  Ignore protected visibility in shared libraries on Solaris
25795         to disable linker error.  If function pointer equality is needed, linker
25796         will silently generate executable with incorrect run-time behavior on
25797         Solaris.
25798
25799                 PR ld/29512
25800                 * elf32-i386.c (elf_i386_scan_relocs): Ignore protected
25801                 visibility in shared libraries on Solaris.
25802                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
25803
25804 2022-08-25  Nick Clifton  <nickc@redhat.com>
25805
25806         GAS: Add a return type tag to DWARF DIEs generated for function symbols.
25807                 PR 29517
25808                 * dwarf2dbg.c (GAS_ABBREV_COMP_UNIT): New defined constant.
25809                 (GAS_ABBREV_SUBPROG): New defined constant.
25810                 (GAS_ABBREV_NO_TYPE): New defined constant.
25811                 (out_debug_abbrev): Use the new defined constants when emitting
25812                 abbreviation numbers.  Generate an abbreviation for an unspecified
25813                 type.
25814                 (out_debug_info): Use the new defined constants when referring to
25815                 abbreviations.  Generate a use of the no_type abbreviation.
25816                 Reference the use when generating DIEs for functions.
25817                 * testsuite/gas/elf/dwarf-3-func.d: Update to allow for newly
25818                 extended output from the assembler.
25819                 * testsuite/gas/elf/dwarf-5-func-global.d: Likewise.
25820                 * testsuite/gas/elf/dwarf-5-func-local.d: Likewise.
25821                 * testsuite/gas/elf/dwarf-5-func.d: Likewise.
25822
25823         GAS: Allow AArch64 pseudo-ops to accept the command line separator character.
25824                 PR 29519
25825                 * config/tc-aarch64.c (s_unreq): Use find_end_of_line().
25826                 (s_aarch64_cpu): Likewise.
25827                 (s_aarch64_arch): Likewise.
25828                 (s_aarch64_arch_extension): Likewise.
25829                 * testsuite/gas/aarch64/pr29519.d: New test driver file.
25830                 * testsuite/gas/aarch64/pr29519.s: New test source file.
25831
25832 2022-08-25  Palmer Dabbelt  <palmer@rivosinc.com>
25833
25834         gas: NEWS: Add the RISC-V features for 2.39
25835
25836         gas: NEWS: Add the RISC-V features for 2.38
25837
25838         gas: NEWS: Add the RISC-V features for 2.37
25839
25840         gas: NEWS: Add the RISC-V features for 2.36
25841
25842         gas: NEWS: Add the RISC-V features for 2.35
25843
25844         gas: NEWS: Add the RISC-V features for 2.31
25845
25846 2022-08-25  Alan Modra  <amodra@gmail.com>
25847
25848         PR11290, avr-ld "out of range error" is confusing
25849         Don't overload bfd_reloc_outofrange with what is really a domain error
25850         (target at odd address), or an overflow.
25851
25852                 PR 11290
25853                 * reloc.c (bfd_reloc_other): Correct comment.
25854                 * elf32-avr.c (avr_final_link_relocate): Return bfd_reloc_other
25855                 for unaligned reloc target values.  Return bfd_reloc_overflow
25856                 when stubs are too far away and when R_AVR_LDS_STS_16,
25857                 R_AVR_PORT6, or R_AVR_PORT5 overflow.
25858                 (elf32_avr_relocate_section): Report more descriptive relocation
25859                 errors.
25860                 * bfd-in2.h: Regenerate.
25861
25862 2022-08-25  Martin Storsjö  <martin@martin.st>
25863
25864         ld: pe: Move the return type to a separate line from the function name
25865         This fixes the coding style of an old, preexisting function.
25866
25867 2022-08-25  Alan Modra  <amodra@gmail.com>
25868
25869         PR10372, SH: ld test with sim/sh/run fails always
25870                 PR 10372
25871                 * testsuite/ld-sh/start.s: Add _start sym.  Use trapa 34.  Create
25872                 an alloc .stack section.
25873
25874 2022-08-25  Alan Modra  <amodra@gmail.com>
25875
25876         Re: LoongArch: ld: Fix bug not generate plt when link a dso
25877         Fixes loongarch32-elf  +FAIL: medium jirl plt
25878
25879                 * testsuite/ld-loongarch-elf/cmodel.exp: Don't run test when
25880                 no shared library support.
25881
25882 2022-08-25  GDB Administrator  <gdbadmin@sourceware.org>
25883
25884         Automatic date update in version.in
25885
25886 2022-08-24  Martin Storsjö  <martin@martin.st>
25887
25888         ld: pe: Make archive member file extension comparisons case insensitive when cross compiling too
25889         On Windows, filename_cmp is case insensitive, but when cross compiling
25890         with libraries that may contain members with uppercase file names, we
25891         should keep those comparisons case insensitive when running the build
25892         tools on other OSes too.
25893
25894         Also make the check for .def consistent with the other ones, fixing
25895         out of bounds reads if file names are shorter than 4 characters.
25896
25897 2022-08-24  Richard Earnshaw  <rearnsha@arm.com>
25898
25899         gas: arm: handle multiple .directives on a single line (PR29519)
25900         There's been a long-standing bug in the arm backend where
25901         target-specific directives did not correctly handle lines with
25902         multiple statements.  This patch fixes the issue for all the cases
25903         I've been able to find.
25904
25905         It does result in a slight change in behaviour when errors are
25906         encountered: where, previously,
25907
25908           .cpu arm6 bar
25909
25910         would result in the error "junk at end of line, first unrecognized
25911         character is `b'", we now get "unknown cpu `arm6 bar'", which I think
25912         is slightly more helpful anyway.  Similar errors are generated for
25913         other directives.
25914
25915 2022-08-24  Andrew Burgess  <aburgess@redhat.com>
25916
25917         gdb: new 'maint print frame-id' command
25918         When debugging a certain class of GDB bug, I often end up wanting to
25919         know what GDB thinks the frame-id is in a particular frame.  It's
25920         not too hard to pull this from some debug output, but I thought it
25921         might be nice if there was a maintenance command that could tell us.
25922
25923         This commit adds 'maint print frame-id' which prints the frame-id of
25924         the currently selected frame.  You can also pass a frame level number
25925         to find the frame-id for a specific frame.
25926
25927         There's a new test too.
25928
25929 2022-08-24  liuzhensong  <liuzhensong@loongson.cn>
25930
25931         LoongArch: ld: Fix bug not generate plt when link a dso
25932           Fix the bug that can not generate func@plt
25933           when linking a undefined function with cmodel=medium.
25934           Add testcase.
25935
25936           bfd/
25937             * elfnn-loongarch.c
25938           ld/testsuite/ld-loongarch-elf/
25939             * cmodel-libjirl.dd
25940             * cmodel.exp
25941             * libjirl.s
25942
25943 2022-08-24  GDB Administrator  <gdbadmin@sourceware.org>
25944
25945         Automatic date update in version.in
25946
25947 2022-08-23  Alan Modra  <amodra@gmail.com>
25948
25949         SHT_RELR sh_link and sh_info
25950         I don't think it makes any sense for a SHT_RELR section to specify a
25951         symbol table with sh_link.  SHT_RELR relocations don't use symbols.
25952         There is no real need to specify sh_info either, SHT_RELR is not for
25953         relocatable object files.  Anyway, fuzzers of course don't restrict
25954         themselves to even half-sensible objects.  So they found a hole in
25955         objcopy using a non-alloc SHT_RELR in an ET_EXEC.  In that case BFD
25956         set up the SHT_RELR section as if it were a SHT_REL against the
25957         sh_info target section.  When it came to reading in the target section
25958         relocs, the count was horribly wrong which caused a buffer overflow.
25959
25960                 * elf.c (bfd_section_from_shdr <SHT_RELR>): Always just make a
25961                 normal section, don't treat it as a reloc section.
25962
25963 2022-08-23  Alan Modra  <amodra@gmail.com>
25964
25965         Re: bfd_elf_set_group_contents assertion
25966         Further to commit 7744e3278b9f.
25967
25968                 * elf.c (bfd_elf_set_group_contents): Restrict loc in loop writing
25969                 contents, and add another assertion.
25970
25971 2022-08-23  Nick Clifton  <nickc@redhat.com>
25972
25973         Add an option to dlltool to allow the creation of deterministic libraries.
25974                 PR 29489
25975                 * dlltool.c (deterministic): New variable.
25976                 (gen_lib_file): If deterministic is true set the
25977                 BFD_DETERMINISTIC_OUTPUT flag.
25978                 (usage): Mention --deterministic-libraries and
25979                 --non-deterministic-libraries.
25980                 (long_options): Add new options.
25981                 (main): Parse new options.
25982                 * doc/binutils.texi: Document the new options.
25983                 * NEWS: Mention the new feature.
25984
25985 2022-08-23  Nelson Chu  <nelson@rivosinc.com>
25986
25987         binutils: Updated my email address.
25988         binutils/
25989             * MAINTAINERS (RISC-V): Updated my email address.
25990
25991 2022-08-23  GDB Administrator  <gdbadmin@sourceware.org>
25992
25993         Automatic date update in version.in
25994
25995 2022-08-22  Tom Tromey  <tromey@adacore.com>
25996
25997         Implement target async for Windows
25998         This implements target async for Windows.  The basic idea is to have
25999         the worker thread block in WaitForDebugEvent, then notify the event
26000         loop when an event is seen.  In a few situations, this blocking
26001         behavior is undesirable, so the functions passed to do_synchronously
26002         are changed to return a boolean indicating which behavior is needed.
26003
26004 2022-08-22  Tom Tromey  <tromey@adacore.com>
26005
26006         Move some Windows operations to worker thread
26007         On Windows, certain debugging APIs can only be called from the thread
26008         that started (or attached) to the inferior.  Also, there is no way on
26009         Windows to wait for a debug event in addition to other events.
26010         Therefore, in order to implement target async for Windows, gdb will
26011         have to call some functions in a worker thread.
26012
26013         This patch implements the worker thread and moves the necessary
26014         operations there.  Target async isn't yet implemented, so this patch
26015         does not cause any visible changes.
26016
26017 2022-08-22  Tom Tromey  <tromey@adacore.com>
26018
26019         Avoid crash with Ravenscar tasks
26020         When using Ravenscar, gdb can crash if the user sets a breakpoint very
26021         early in task startup.  This happens because gdb thinks the runtime is
26022         initialized, but in practice the particular task isn't sufficiently
26023         initialized.  This patch avoids the issue by turning an assertion into
26024         an early return.
26025
26026         I tested this using the AdaCore internal test suite.  I don't know how
26027         to test Ravenscar using the FSF test suite.
26028
26029 2022-08-22  Nick Clifton  <nickc@redhat.com>
26030
26031         Fix compile time warning from Clang about error messages not being printed safely.
26032
26033         Have readelf warn users if it is asked to decode a LLVM bitcode file or a golang object file.
26034                 * readelf.c (check_magic_number): New function.  Checks the magic
26035                 bytes at the start of a file.  If they are not the ELF format
26036                 magic values, then attempts to generate a helpful error message.
26037                 (process_file_header): Call check_magic_number.
26038
26039 2022-08-22  Frederic Cambus  <fred@statdns.com>
26040
26041         Add OpenBSD AArch64 Little Endian BFD support.
26042                 * config.bfd (aarch64-*-openbsd*): Add target.
26043
26044 2022-08-22  tangxiaolin  <tangxiaolin@loongson.cn>
26045
26046         LoongArch: gas: add support using constant variable in instructions.
26047                 Instructions that can load immediate support using constant
26048                 variable like ".equ var, 123    li.w/d resgister, var".
26049
26050         gas/
26051                 * config/loongarch-parse.y
26052                 * config/tc-loongarch.c
26053
26054                 Add four testcases.One is a program using constant variable,
26055                 one test using label is unsupported, and another two test
26056                 almost instructions that can load immediate.
26057
26058         gas/
26059                 * testsuite/gas/loongarch/li.d
26060                 * testsuite/gas/loongarch/li.s
26061                 * testsuite/gas/loongarch/imm_ins_label-fail.d
26062                 * testsuite/gas/loongarch/imm_ins_label-fail.l
26063                 * testsuite/gas/loongarch/imm_ins_label-fail.s
26064                 * testsuite/gas/loongarch/imm_ins.d
26065                 * testsuite/gas/loongarch/imm_ins.s
26066                 * testsuite/gas/loongarch/imm_ins_32.d
26067                 * testsuite/gas/loongarch/imm_ins_32.s
26068
26069 2022-08-22  GDB Administrator  <gdbadmin@sourceware.org>
26070
26071         Automatic date update in version.in
26072
26073 2022-08-21  Tom Tromey  <tom@tromey.com>
26074
26075         Fix crash in gdbpy_parse_register_id
26076         I noticed that gdbpy_parse_register_id would assert if passed a Python
26077         object of a type it was not expecting.  The included test case shows
26078         this crash.  This patch fixes the problem and also changes
26079         gdbpy_parse_register_id to be more "Python-like" -- it always ensures
26080         the Python error is set when it fails, and the callers now simply
26081         propagate the existing exception.
26082
26083 2022-08-21  GDB Administrator  <gdbadmin@sourceware.org>
26084
26085         Automatic date update in version.in
26086
26087 2022-08-20  Alan Modra  <amodra@gmail.com>
26088
26089         symbols for bfd_simple_get_relocated_section_contents
26090         If symbols are provided by the caller of this function they are
26091         passed on to bfd_get_relocated_section_contents.  No surprises there.
26092         It gets a little weird if they are not provided.  In that case they
26093         are read from the bfd by _bfd_generic_link_add_symbols, and global
26094         symbols are added to the generic linker hash table.  Global symbols
26095         are not added to the linker hash table if symbols *are* provided.  Now
26096         the linker hash table symbols are not used by the generic
26097         bfd_get_relocated_section_conents, and also not by most target
26098         versions when called from bfd_simple_get_relocated_section_contents
26099         except for symbols like "_gp".  So it mostly doesn't matter whether
26100         symbols are in the linker hash table, but it's odd that there is a
26101         difference.  We could always add them, but I'm inclined to think that
26102         is unnecessary work so this patch always leaves them out.
26103
26104         Also, symbols are canonicalized and written into a malloc'd buffer.
26105         The buffer isn't freed, see commit 8e16317ca5eb.  I don't know whether
26106         that matters any more, but in any case I can't see why we need another
26107         copy of the symbols when _bfd_generic_link_read_symbols has already
26108         cached symbols.
26109
26110                 * simple.c (bfd_simple_get_relocated_section_contents): If not
26111                 provided, read symbols via bfd_generic_link_read_symbols.  Do
26112                 not create another copy of symbols.  Tidy failure exits.
26113                 Minor tidy of bfd_get_relocated_section_contents and
26114                 bfd_get_full_section_contents arguments.
26115
26116 2022-08-20  Alan Modra  <amodra@gmail.com>
26117
26118         Re: Missing linking test case for pe dll using a def file
26119         Fixes this when cross-compiling from x86_64-linux
26120         x86_64-w64-mingw32  +FAIL: compiling shared lib fastcall/stdcall
26121
26122                 * testsuite/ld-pe/pe-run2-def.exp (test_direct2_link_dll_def):
26123                 Use CC_FOR_TARGET and CFLAGS_FOR_TARGET rather than CC and CFLAGS.
26124
26125 2022-08-20  GDB Administrator  <gdbadmin@sourceware.org>
26126
26127         Automatic date update in version.in
26128
26129 2022-08-19  Patrick Monnerat  <patrick@monnerat.net>
26130
26131         gdb_do_one_event: use integer test syntax
26132         Timeout is an int, not a bool.
26133
26134 2022-08-19  Tom Tromey  <tom@tromey.com>
26135
26136         Remove two initialization functions
26137         I noticed a couple of initialization functions that aren't really
26138         needed, and that currently require explicit calls in gdb_init.  This
26139         patch removes these functions, simplifying gdb a little.
26140
26141         Regression tested on x86-64 Fedora 34.
26142
26143 2022-08-19  Simon Marchi  <simon.marchi@efficios.com>
26144
26145         gdb/testsuite: re-compile entry-value-typedef .S files with -fPIE
26146         As Luis pointed out here [1], the AArch64 variant of the test doesn't
26147         work on systems that use PIE by default.  For example, on this Debian
26148         11:
26149
26150             $ make check TESTS="gdb.dwarf2/entry-value-typedef.exp"
26151             gdb compile failed, /usr/bin/ld: /tmp/ccJE8ZSr.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZNSsD1Ev@@GLIBCXX_3.4' which may bind externally can not be used when making a shared object; recompile with -fPIC
26152             /usr/bin/ld: /tmp/ccJE8ZSr.o(.text+0x38): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `_ZNSsD1Ev@@GLIBCXX_3.4'
26153
26154         This is because entry-value-typedef-aarch64.S was generated on an old
26155         system that does not generate position-independent code by default, but
26156         the system the test runs on tries to link the test executable as
26157         position-independent.  Fix this by regenerating the same binary on the
26158         same system as the original one, but with -fPIE this time.  Do the same
26159         for the amd64 binary, although this one was already position-independent
26160         so the generated code doesn't change.
26161
26162         With this patch applied, the test passes on the Debian 11 AArch64
26163         system.
26164
26165         [1] https://sourceware.org/pipermail/gdb-patches/2022-August/191462.html
26166
26167         Change-Id: I68d55adaa56a7a3eddb0c13980b1a98b791f8144
26168
26169 2022-08-19  Felix Willgerodt  <felix.willgerodt@intel.com>
26170
26171         gdb, testsuite: Adapt gdb.base/callfuncs.exp for new clang warning.
26172         Clang 15.0.0 enabled the warning for deprecated non-prototype functions
26173         by default: https://reviews.llvm.org/D122895
26174         Callfuncs.exp is impacted and won't run due to new warnings:
26175
26176         callfuncs.c:339:5: warning: a function declaration without a prototype is
26177         deprecated in all versions of C and is not supported in C2x
26178         [-Wdeprecated-non-prototype]
26179         int t_float_values (float_arg1, float_arg2)
26180
26181         This patch disables those warnings with -Wno-deprecated-non-prototype.
26182         Removing the test for deprecated syntax would also be an option. But I will
26183         leave that up for others to decide/implement.
26184
26185 2022-08-19  Felix Willgerodt  <felix.willgerodt@intel.com>
26186
26187         gdb, testsuite: Enable testcases that suppress specific warnings, for icc/icx.
26188         To cite gdb.exp:
26189         Some C/C++ testcases unconditionally pass -Wno-foo as additional
26190         options to disable some warning.  That is OK with GCC, because
26191         by design, GCC accepts any -Wno-foo option, even if it doesn't
26192         support -Wfoo.  Clang however warns about unknown -Wno-foo by
26193         default, unless you pass -Wno-unknown-warning-option as well.
26194         We do that here, so that individual testcases don't have to
26195         worry about it.
26196
26197         This patch adds the same option that already exists for clang for icx and
26198         adds the equivalent icc option.
26199
26200 2022-08-19  Tiezhu Yang  <yangtiezhu@loongson.cn>
26201
26202         gdb: LoongArch: Handle variadic arguments
26203         According to LoongArch ELF ABI specification [1], variadic arguments
26204         are passed in GARs in the same manner as named arguments. And after
26205         a variadic argument has been passed on the stack, all future arguments
26206         will also be passed on the stack, i.e., the last argument register may
26207         be left unused due to the aligned register pair rule. long double data
26208         tpye is passed in an aligned GAR pair, the first register in the pair
26209         is even-numbered.
26210
26211         [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
26212
26213 2022-08-19  Alan Modra  <amodra@gmail.com>
26214
26215         loongarch64_pei_vec garbage in objcopy'd relocs
26216         Like commit a9c09a3667cc, but for loongarch64.
26217
26218                 * coff-loongarch64.c (SWAP_IN_RELOC_OFFSET): Define.
26219                 (SWAP_OUT_RELOC_OFFSET): Define.
26220
26221 2022-08-19  GDB Administrator  <gdbadmin@sourceware.org>
26222
26223         Automatic date update in version.in
26224
26225 2022-08-18  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
26226
26227         gprofng: fix bug 29479 Collection fails when built without java support
26228         gprofng/ChangeLog
26229         2022-08-17  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
26230
26231                 PR gprofng/29479
26232                 * libcollector/collector.c: Add #if defined(GPROFNG_JAVA_PROFILING) for
26233                 java specific code.
26234                 * libcollector/unwind.c: Likewise.
26235
26236 2022-08-18  Simon Marchi  <simon.marchi@polymtl.ca>
26237
26238         gdb: call check_typedef at beginning of dwarf_expr_context::fetch_result
26239         Bug 29374 shows this crash:
26240
26241             $ ./gdb -nx --data-directory=data-directory -q -batch -ex "catch throw" -ex r -ex bt a.out
26242             ...
26243             /home/simark/src/binutils-gdb/gdb/../gdbsupport/array-view.h:217: internal-error: copy: Assertion `dest.size () == src.size ()' failed.
26244
26245         The backtrace is:
26246
26247             #0  internal_error (file=0x5555606504c0 "/home/simark/src/binutils-gdb/gdb/../gdbsupport/array-view.h", line=217, fmt=0x55556064b700 "%s: Assertion `%s' failed.") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:51
26248             #1  0x000055555d41c0bb in gdb::copy<unsigned char const, unsigned char> (src=..., dest=...) at /home/simark/src/binutils-gdb/gdb/../gdbsupport/array-view.h:217
26249             #2  0x000055555deef28c in dwarf_expr_context::fetch_result (this=0x7fffffffb830, type=0x621007a86830, subobj_type=0x621007a86830, subobj_offset=0, as_lval=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/expr.c:1040
26250             #3  0x000055555def0015 in dwarf_expr_context::evaluate (this=0x7fffffffb830, addr=0x62f00004313e "0", len=1, as_lval=false, per_cu=0x60b000069550, frame=0x621007c9e910, addr_info=0x0, type=0x621007a86830, subobj_type=0x621007a86830, subobj_offset=0) at /home/simark/src/binutils-gdb/gdb/dwarf2/expr.c:1091
26251             #4  0x000055555e084327 in dwarf2_evaluate_loc_desc_full (type=0x621007a86830, frame=0x621007c9e910, data=0x62f00004313e "0", size=1, per_cu=0x60b000069550, per_objfile=0x613000006080, subobj_type=0x621007a86830, subobj_byte_offset=0, as_lval=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1485
26252             #5  0x000055555e0849e2 in dwarf2_evaluate_loc_desc (type=0x621007a86830, frame=0x621007c9e910, data=0x62f00004313e "0", size=1, per_cu=0x60b000069550, per_objfile=0x613000006080, as_lval=false) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1529
26253             #6  0x000055555e0828c6 in dwarf_entry_parameter_to_value (parameter=0x621007a96e58, deref_size=0x0, type=0x621007a86830, caller_frame=0x621007c9e910, per_cu=0x60b000069550, per_objfile=0x613000006080) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1235
26254             #7  0x000055555e082f55 in value_of_dwarf_reg_entry (type=0x621007a86890, frame=0x621007acc510, kind=CALL_SITE_PARAMETER_DWARF_REG, kind_u=...) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1332
26255             #8  0x000055555e083449 in value_of_dwarf_block_entry (type=0x621007a86890, frame=0x621007acc510, block=0x61e000033568 "T\004\205\001\240\004\004\243\001T\237\004\240\004\261\004\001T\004\261\004\304\005\004\243\001T\237\004\304\005\310\005\001T\004\310\005\311\005\004\243\001T\237", block_len=1) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:1365
26256             #9  0x000055555e094d40 in loclist_read_variable_at_entry (symbol=0x621007a99bd0, frame=0x621007acc510) at /home/simark/src/binutils-gdb/gdb/dwarf2/loc.c:3889
26257             #10 0x000055555f5192e0 in read_frame_arg (fp_opts=..., sym=0x621007a99bd0, frame=0x621007acc510, argp=0x7fffffffbf20, entryargp=0x7fffffffbf60) at /home/simark/src/binutils-gdb/gdb/stack.c:559
26258             #11 0x000055555f51c352 in print_frame_args (fp_opts=..., func=0x621007a99ad0, frame=0x621007acc510, num=-1, stream=0x6030000bad90) at /home/simark/src/binutils-gdb/gdb/stack.c:887
26259             #12 0x000055555f521919 in print_frame (fp_opts=..., frame=0x621007acc510, print_level=1, print_what=LOCATION, print_args=1, sal=...) at /home/simark/src/binutils-gdb/gdb/stack.c:1390
26260             #13 0x000055555f51f22e in print_frame_info (fp_opts=..., frame=0x621007acc510, print_level=1, print_what=LOCATION, print_args=1, set_current_sal=0) at /home/simark/src/binutils-gdb/gdb/stack.c:1116
26261             #14 0x000055555f526c6d in backtrace_command_1 (fp_opts=..., bt_opts=..., count_exp=0x0, from_tty=0) at /home/simark/src/binutils-gdb/gdb/stack.c:2079
26262             #15 0x000055555f527ae5 in backtrace_command (arg=0x0, from_tty=0) at /home/simark/src/binutils-gdb/gdb/stack.c:2198
26263
26264         The problem is that the type that gets passed down to
26265         dwarf_expr_context::fetch_result (the type of a variable of which we're
26266         trying to read the entry value) is a typedef whose size has never been
26267         computed yet (check_typedef has never been called on it).  As we get in
26268         the DWARF_VALUE_STACK case (line 1028 of dwarf2/expr.c), the `len`
26269         variable is therefore set to 0, instead of the actual type length.  We
26270         then call allocate_value on subobj_type, which does call check_typedef,
26271         so the length of the typedef gets filled in at that point.  We end up
26272         passing to the copy function a source array view of length 0 and a
26273         target array view of length 4, and the assertion fails.
26274
26275         Fix this by calling check_typedef on both type and subobj_type at the
26276         beginning of fetch_result.
26277
26278         I tried writing a test for this using the DWARF assembler, but I haven't
26279         succeeded.  It's possible that we need to get into this specific code
26280         path (value_of_dwarf_reg_entry and all) to manage to get to
26281         dwarf_expr_context::fetch_result with a typedef type that has never been
26282         resolved.  In all my attempts, the typedef would always be resolved
26283         already, so the bug wouldn't show up.
26284
26285         As a fallback, I made a gdb.dwarf2 test with compiler-generated .S
26286         files.  I don't particularly like those, but I think it's better than no
26287         test.  The .cpp source code is the smallest reproducer I am able to make
26288         from the reproducer given in the bug (thanks to Pedro for suggestions on
26289         how to minimize it further than I had).  Since I tested on both amd64
26290         and aarch64, I added versions of the test for these two architectures.
26291
26292         Change-Id: I182733ad08e34df40d8bcc47af72c482fabf4900
26293         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29374
26294
26295 2022-08-18  Luis Machado  <luis.machado@arm.com>
26296
26297         [aarch64] Remove handling of ADR/ADRP from prologue analyzer
26298         As reported by Tom in https://sourceware.org/pipermail/gdb-patches/2022-August/191357.html,
26299         the aarch64 prologue analyzer considers the adrp instruction in the
26300         gdb.dwarf2/dw2-dir-file-name.exp testcase to be part of a prologue.
26301
26302         The function has no prologue though, and it only loads the volatile variable
26303         from memory.  GDB should not skip any instructions in this case.
26304
26305         Doing some archaeology, it seems handling for adr/adrp in prologues was
26306         included with the original aarch64 port.  It might've been an oversight.
26307
26308         In the particular case of gdb.dwarf2/dw2-dir-file-name.exp, the analyzer skips
26309         a couple instructions and leaves us in a nice spot where the address to the
26310         variable "v" is already in w0. But no prologues exists.
26311
26312         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29481
26313
26314 2022-08-18  Tom Tromey  <tom@tromey.com>
26315
26316         Change bookmark allocation
26317         This changes how bookmarks are allocated and stored, replacing a
26318         linked list with a vector and removing some ALL_* iterator macros.
26319         Regression tested on x86-64 Fedora 34.
26320
26321 2022-08-18  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
26322
26323         Add test for AArch64 Scalable Vector Extension
26324         It exercises a bug that GDB previously had where it would lose track of
26325         some registers when the inferior changed its vector length.
26326
26327         It also checks that the vg register and the size of the z0-z31 registers
26328         correctly reflect the new vector length.
26329
26330 2022-08-18  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
26331
26332         Fix thread's gdbarch when SVE vector length changes
26333         When the inferior program changes the SVE length, GDB can stop tracking
26334         some registers as it obtains the new gdbarch that corresponds to the
26335         updated length:
26336
26337           Breakpoint 1, do_sve_ioctl_test () at sve-ioctls.c:44
26338           44              res = prctl(PR_SVE_SET_VL, i, 0, 0, 0, 0);
26339           (gdb) print i
26340           $2 = 32
26341           (gdb) info registers
26342                   ⋮
26343           [ snip registers x0 to x30 ]
26344                   ⋮
26345           sp             0xffffffffeff0      0xffffffffeff0
26346           pc             0xaaaaaaaaa8ac      0xaaaaaaaaa8ac <do_sve_ioctl_test+112>
26347           cpsr           0x60000000          [ EL=0 BTYPE=0 C Z ]
26348           fpsr           0x0                 0
26349           fpcr           0x0                 0
26350           vg             0x8                 8
26351           tpidr          0xfffff7fcb320      0xfffff7fcb320
26352           (gdb) next
26353           45              if (res < 0) {
26354           (gdb) info registers
26355                   ⋮
26356           [ snip registers x0 to x30 ]
26357                   ⋮
26358           sp             0xffffffffeff0      0xffffffffeff0
26359           pc             0xaaaaaaaaa8cc      0xaaaaaaaaa8cc <do_sve_ioctl_test+144>
26360           cpsr           0x200000            [ EL=0 BTYPE=0 SS ]
26361           fpsr           0x0                 0
26362           fpcr           0x0                 0
26363           vg             0x4                 4
26364           (gdb)
26365
26366         Notice that register tpidr disappeared when vg (which holds the vector
26367         length) changed from 8 to 4.  The tpidr register is provided by the
26368         org.gnu.gdb.aarch64.tls feature.
26369
26370         This happens because the code that searches for a new gdbarch to match the
26371         new vector length in aarch64_linux_nat_target::thread_architecture doesn't
26372         take into account the features present in the target description associated
26373         with the previous gdbarch.  This patch makes it do that.
26374
26375         Since the id member of struct gdbarch_info is now unused, it's removed.
26376
26377 2022-08-18  Ralf Habacker  <ralf.habacker@freenet.de>
26378
26379         Missing linking test case for pe dll using a def file.
26380                 PR 28362
26381                 * testsuite/ld-pe/pe-run2-def.exp: New file.
26382
26383 2022-08-18  Patrick Monnerat  <patrick@monnerat.net>
26384
26385         gdbsupport/event-loop: add a timeout parameter to gdb_do_one_event
26386         Since commit b2d8657, having a per-interpreter event/command loop is not
26387         possible anymore.
26388
26389         As Insight uses a GUI that has its own event loop, gdb and GUI event
26390         loops have then to be "merged" (i.e.: work together). But this is
26391         problematic as gdb_do_one_event is not aware of this alternate event
26392         loop and thus may wait forever.
26393
26394         A solution is to delegate GUI events handling to the gdb events handler.
26395         Insight uses Tck/Tk as GUI and the latter offers a "notifier" feature to
26396         implement such a delegation. The Tcl notifier spec requires the event wait
26397         function to support a timeout parameter. Unfortunately gdb_do_one_event
26398         does not feature such a parameter.
26399         This timeout cannot be implemented externally with a gdb timer, because
26400         it would become an event by itself and thus can cause a legitimate event to
26401         be missed if the timeout is 0.
26402         Tcl implements "idle events" that are (internally) triggered only when no
26403         other event is pending. For this reason, it can call the event wait function
26404         with a 0 timeout quite often.
26405
26406         This patch implements a wait timeout to gdb_do_one_event. The initial
26407         pending events monitoring is performed as before without the possibility
26408         to enter a wait state. If no pending event has been found during this
26409         phase, a timer is then created for the given timeout in order to re-use
26410         the implemented timeout logic and the event wait is then performed.
26411         This "internal" timer only limits the wait time and should never be triggered.
26412         It is deleted upon gdb_do_one_event exit.
26413
26414         The new parameter defaults to "no timeout" (-1): as it is used by Insight
26415         only, there is no need to update calls from the gdb source tree.
26416
26417 2022-08-18  Patrick Monnerat  <patrick@monnerat.net>
26418
26419         gdb: add Patrick Monnerat to gdb/MAINTAINERS
26420
26421 2022-08-18  Jan Beulich  <jbeulich@suse.com>
26422
26423         x86: move / quiesce pre-386 non-16-bit warning
26424         Emitting this warning for every insn, including ones having actual
26425         errors, is annoying. Introduce a boolean variable to emit the warning
26426         just once on the first insn after .arch may have changed the things, and
26427         move the warning to output_insn(). (I didn't want to go as far as
26428         checking whether the .arch actually turned off the i386 bit, but doing
26429         so would be an option.)
26430
26431         x86: insert "no error" enumerator in i386_error enumeration
26432         The value of zero would better not indicate any error, but rather hit
26433         the abort() at the top of the consuming switch().
26434
26435 2022-08-18  GDB Administrator  <gdbadmin@sourceware.org>
26436
26437         Automatic date update in version.in
26438
26439 2022-08-17  Maciej W. Rozycki  <macro@embecosm.com>
26440
26441         GDB/testsuite: Fix PARAM_ZUINTEGER reported for PARAM_ZUINTEGER_UNLIMITED
26442         Correctly report PARAM_ZUINTEGER_UNLIMITED rather than PARAM_ZUINTEGER
26443         in testing a Python parameter of the PARAM_ZUINTEGER_UNLIMITED type.
26444
26445 2022-08-17  Alan Modra  <amodra@gmail.com>
26446
26447         bfd_elf_set_group_contents assertion
26448         objcopy of broken SHT_GROUP sections shouldn't write garbage.
26449
26450                 * elf.c (bfd_elf_set_group_contents): If number of entries is
26451                 unexpected, fill out section with zeros.
26452
26453 2022-08-17  Alan Modra  <amodra@gmail.com>
26454
26455         timeout in mmo_get_symbols
26456         Fix mmo_get_byte to return a fail-safe value, not just on the first
26457         call with a read error but on subsequent calls too.
26458
26459                 * mmo.c (mmo_get_byte): Return the fail-safe value on every
26460                 call after a read error.
26461
26462 2022-08-17  Alan Modra  <amodra@gmail.com>
26463
26464         mmo.c leak in mmo_make_section
26465                 * mmo.c (mmo_make_section): Alloc name using bfd_alloc.  Use
26466                 bfd_error_no_memory.
26467                 (mmo_decide_section): Check for NULL return from mmo_make_section.
26468
26469 2022-08-17  Alan Modra  <amodra@gmail.com>
26470
26471         asan: heap buffer overflow in mmo_scan
26472         mmo_get_loc needs to handle arbitrary vma and size chunks.  Fuzzers
26473         found that it wasn't working so well when the end of chunks were
26474         getting close to address wrap-around.
26475
26476                 * mmo.c (mmo_get_loc): Make "size" unsigned.  Avoid arithmetic
26477                 overflow when calculating whether range hits an existing chunk.
26478
26479 2022-08-17  Alan Modra  <amodra@gmail.com>
26480
26481         elf.c tidy
26482         Swap params of is_note, so they are section, segment like others used
26483         in rewrite_elf_program_header.  Whitespace fixes, plus wrapping of
26484         overlong lines.
26485
26486 2022-08-17  GDB Administrator  <gdbadmin@sourceware.org>
26487
26488         Automatic date update in version.in
26489
26490 2022-08-16  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
26491
26492         bfd: Define ___lc_codepage_func prototype for older MinGW-w64
26493         In commit 68e80d96a84282d547f3b3c1234c99009521630c, the usage of
26494         ___lc_codepage_func was introduced to determine the current encoding.
26495
26496         Prior to version 9.0 of MinGW-w64, the function prototype for
26497         ___lc_codepage_func was missing and trying to build BFD caused the
26498         following error:
26499
26500         error: implicit declaration of function ‘___lc_codepage_func’
26501
26502         This changeset adds a conditonal definition of
26503         ___lc_codepage_func to allow a sucessful build with MinGW-w64.
26504
26505 2022-08-16  H.J. Lu  <hjl.tools@gmail.com>
26506
26507         i386: Add MAX_OPERAND_BUFFER_SIZE
26508         When displaying operands, invalid opcodes may overflow operand buffer
26509         due to additional styling characters.  Each style is encoded with 3
26510         bytes.  Define MAX_OPERAND_BUFFER_SIZE for operand buffer size and
26511         increase it from 100 bytes to 128 bytes to accommodate 9 sets of styles
26512         in an operand.
26513
26514         gas/
26515
26516                 PR binutils/29483
26517                 * testsuite/gas/i386/i386.exp: Run pr29483.
26518                 * testsuite/gas/i386/pr29483.d: New file.
26519                 * testsuite/gas/i386/pr29483.s: Likewise.
26520
26521         opcodes/
26522
26523                 PR binutils/29483
26524                 * i386-dis.c (MAX_OPERAND_BUFFER_SIZE): New.
26525                 (obuf): Replace 100 with MAX_OPERAND_BUFFER_SIZE.
26526                 (staging_area): Likewise.
26527                 (op_out): Likewise.
26528
26529 2022-08-16  Andrew Burgess  <aburgess@redhat.com>
26530
26531         gdb/riscv: fix gdb.arch/riscv-unwind-long-insn.exp on RV64
26532         I noticed that the gdb.arch/riscv-unwind-long-insn.exp test was
26533         failing when run on a 64-bit RISC-V target.
26534
26535         The problem was that GDB was failing to stop after a finish command,
26536         and was then running to an unexpected location.
26537
26538         The reason GDB failed to stop at the finish breakpoint was that the
26539         frame-id of the inferior, when we reached the finish breakpoint,
26540         didn't match the expected frame-id that was stored on the breakpoint.
26541
26542         The reason for this mismatch was that the assembler code that is
26543         included in this test, was written only taking 32-bit RISC-V into
26544         account, as a result, the $fp register was being corrupted, and this
26545         was causing the frame-id mismatch.
26546
26547         Specifically, the $fp register would end up being sign-extended from
26548         32 to 64 bits.  If the expected $fp value has some significant bits
26549         above bit 31 then the computed and expected frame-ids would not match.
26550
26551         To fix this I propose merging the two .s files into a single .S file,
26552         and making use of preprocessor macros to specialise the file for the
26553         correct size of $fp.  There are plenty of existing tests that already
26554         make use of preprocessor macros in assembler files, so I assume this
26555         approach is fine.
26556
26557         Once I'd decided to make use of preprocessor macros to solve the 32/64
26558         bit issue, then I figured I might as well merge the two test assembler
26559         files, they only differed by a single instruction.
26560
26561         With this change in place I now see this test fully passing on 32 and
26562         64 bit RISC-V targets.
26563
26564 2022-08-16  Simon Marchi  <simon.marchi@polymtl.ca>
26565
26566         gdb/testsuite: fix breakpoint script output in gdb.mi/mi-break.exp
26567         Commit 9db0d8536dbc ("gdb/mi: fix breakpoint script field output") fixed
26568         the output of the script key in the MI breakpoint output, from
26569
26570           script={"print 10","continue"}
26571
26572         to
26573
26574           script=["print 10","continue"]
26575
26576         However, it missed updating this test case, which still tests for the
26577         old (broken) form, causing:
26578
26579             FAIL: gdb.mi/mi-break.exp: mi-mode=main: test_breakpoint_commands: breakpoint commands: check that commands are set (unexpected output)
26580             FAIL: gdb.mi/mi-break.exp: mi-mode=separate: test_breakpoint_commands: breakpoint commands: check that commands are set (unexpected output)
26581
26582         Update the test to expect the new form.
26583
26584         Change-Id: I174919d4eea53e96d914ca9bd1cf6f01c8de30b8
26585
26586 2022-08-16  Tom Tromey  <tromey@adacore.com>
26587
26588         Use strwinerror in gdb/windows-nat.c
26589         When working on windows-nat.c, it's useful to see an error message in
26590         addition to the error number given by GetLastError.  This patch moves
26591         strwinerror from gdbserver to gdbsupport, and then updates
26592         windows-nat.c to use it.  A couple of minor changes to strwinerror
26593         (constify the return type and use the ARRAY_SIZE macro) are also
26594         included.
26595
26596 2022-08-16  Tom Tromey  <tom@tromey.com>
26597
26598         Remove register_gdbarch_init
26599         This removes the deprecated register_gdbarch_init in favor a default
26600         argument to gdbarch_register.  Regression tested on x86-64 Fedora 34.
26601
26602 2022-08-16  Alan Modra  <amodra@gmail.com>
26603
26604         PR29495, rewrite_elf_program_header looping
26605         This patch, in order of significance:
26606         1) Replaces some macros with inline functions.
26607         2) Those inline functions catch and avoid arithmetic overflows when
26608            comparing addresses.
26609         3) When assigning sections to segments (IS_SECTION_IN_INPUT_SEGMENT)
26610            use bed->want_p_paddr_set_to_zero to decide whether lma vs p_paddr
26611            or vma vs p_vaddr should be tested.  When remapping, use the same
26612            test, and use is_note rather than the more restrictive
26613            IS_COREFILE_NOTE.
26614
26615         It's important that the later tests not be more restrictive.  If they
26616         are it can lead to the situation triggered by the testcases, where a
26617         section seemingly didn't fit and thus needed a new mapping.  It didn't
26618         fit the new mapping either, and this repeated until memory exhausted.
26619
26620                 PR 29495
26621                 * elf.c (SEGMENT_END, SECTION_SIZE, IS_CONTAINED_BY_VMA): Delete.
26622                 (IS_CONTAINED_BY_LMA, IS_NOTE, IS_COREFILE_NOTE): Delete.
26623                 (segment_size, segment_end, section_size): New inline function.
26624                 (is_contained_by, is_note): Likewise.
26625                 (rewrite_elf_program_header): Use new functions.
26626
26627 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26628
26629         x86: shorten certain template names
26630         Now that we can purge templates, let's use this to improve readability a
26631         little by shortening a few of their names, making functionally similar
26632         ones also have identical names in their multiple incarnations.
26633
26634 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26635
26636         x86: template-ize certain vector conversion insns
26637         Many of the vector conversion insns come with X/Y/Z suffixed forms, for
26638         disambiguation purposes in AT&T syntax. All of these gorups follow
26639         certain patterns. Introduce "xy" and "xyz" templates to reduce
26640         redundancy.
26641
26642         To facilitate using a uniform name for both AVX and AVX512, further
26643         introduce a means to purge a previously defined template: A standalone
26644         <name> will be recognized to have this effect.
26645
26646         Note that in the course of the conversion VFPCLASSPH is properly split
26647         to separate AT&T and Intel syntax forms, matching VFPCLASSP{S,D} and
26648         yielding the intended "ambiguous operand size" diagnostic in Intel mode.
26649
26650 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26651
26652         x86: template-ize vector packed byte/word integer insns
26653         Many of the vector integer insns come in byte/word element pairs. Most
26654         of these pairs follow certain encoding patterns. Introduce a "bw"
26655         template to reduce redundancy.
26656
26657         Note that in the course of the conversion
26658         - the AVX VPEXTRW template which is not being touched needs to remain
26659           ahead of the new "combined" ones, as (a) this should be tried first
26660           when matching insns against templates and (b) its Load attributes
26661           requires it to be first,
26662         - this add a benign/meaningless IgnoreSize attribute to the memory form
26663           of PEXTRB; it didn't seem worth avoiding this.
26664
26665 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26666
26667         x86: re-order AVX512 S/G templates
26668         The AVX2 gather ones are nicely grouped - do the same for the various
26669         AVX512 scatter/gather ones. On the moved lines also convert EVex=<n> to
26670         EVex<N>.
26671
26672 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26673
26674         x86: template-ize vector packed dword/qword integer insns
26675         Many of the vector integer insns come in dword/qword element pairs. Most
26676         of these pairs follow certain encoding patterns. Introduce a "dq"
26677         template to reduce redundancy.
26678
26679         Note that in the course of the conversion
26680         - a few otherwise untouched templates are moved, so they end up next to
26681           their siblings),
26682         - drop an unhelpful Cpu64 from the GPR form of VPBROADCASTQ, matching
26683           what we already have for KMOVQ - the diagnostic is better this way for
26684           insns with multiple forms (i.e. the same Cpu64 attributes on {,V}MOVQ,
26685           {,V}PEXTRQ, and  {,V}PINSRQ are useful to keep),
26686         - this adds benign/meaningless IgnoreSize attributes to the GPR forms of
26687           KMOVD and VPBROADCASTD; it didn't seem worth avoiding this.
26688
26689 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26690
26691         x86: template-ize packed/scalar vector floating point insns
26692         The vast majority of vector FP insns comes in single/double pairs. Many
26693         pairs follow certain encoding patterns. Introduce an "sd" template to
26694         reduce redundancy. Similarly, to further cover similarities between
26695         AVX512F and AVX512-FP16, introduce an "sdh" template.
26696
26697         For element-size Disp8 shift generalize i386-gen's broadcast size
26698         determination, allowing Disp8MemShift to be specified without an operand
26699         in the affected templated templates. While doing the adjustment also
26700         eliminate an unhelpful (lost information) diagnostic combined with a use
26701         after free in what is now get_element_size().
26702
26703         Note that in the course of the conversion
26704         - the AVX512F form of VMOVUPD has a stray (leftover) Load attribute
26705           dropped,
26706         - VMOVSH has a benign IgnoreSize added (the attribute is still strictly
26707           necessary for VMOVSD, and necessary for VMOVSS as long as we permit
26708           strange combinations like "-march=i286+avx"),
26709         - VFPCLASSPH is properly split to separate AT&T and Intel syntax forms,
26710           matching VFPCLASSP{S,D}.
26711
26712 2022-08-16  Jan Beulich  <jbeulich@suse.com>
26713
26714         revert "x86: Also pass -P to $(CPP) when processing i386-opc.tbl"
26715         This reverts commit 384f368958f2a5bb083660e58e5f8a010e6ad429, which
26716         broke i386-gen's emitting of diagnostics. As a replacement to address
26717         the original issue of newer gcc no longer splicing lines when dropping
26718         the line continuation backslashes, switch to using + as the line
26719         continuation character, doing the line splicing in i386-gen.
26720
26721 2022-08-16  GDB Administrator  <gdbadmin@sourceware.org>
26722
26723         Automatic date update in version.in
26724
26725 2022-08-15  Alan Modra  <amodra@gmail.com>
26726
26727         PR29362, some binutils memory leaks
26728         2022-08-16  Alan Modra  <amodra@gmail.com>
26729                     Cunlong Li  <shenxiaogll@163.com>
26730
26731                 PR 29362
26732                 * dwarf.c (free_debug_information): New function, extracted..
26733                 (free_debug_memory): ..from here.
26734                 (process_debug_info): Use it when before clearing out unit
26735                 debug_information.  Clear all fields.
26736                 * objcopy.c (delete_symbol_htabs): New function.
26737                 (main): Call it via xatexit.
26738                 (copy_archive): Free "dir".
26739                 * objdump.c (free_debug_section): Free reloc_info.
26740
26741 2022-08-15  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
26742
26743         gdb/csky add unwinder for sigtramp frame when kernel 4.x and later
26744         When kernel veriosn >= V4.x, the characteristic values used to
26745         determine whether it is a signal function call are:
26746             movi r7, 139
26747             trap 0
26748
26749         Registers are saved at (sp + CSKY_SIGINFO_OFFSET + CSKY_SIGINFO_SIZE
26750         + CSKY_UCONTEXT_SIGCONTEXT + CSKY_SIGCONTEXT_PT_REGS_TLS). The order
26751         is described in csky_linux_rt_sigreturn_init_pt_regs.
26752
26753 2022-08-15  Alan Modra  <amodra@gmail.com>
26754
26755         aarch64_pei_vec
26756         I know this target is just a skeleton, but let's not write out relocs
26757         with uninitialised garbage.
26758
26759                 * coff-aarch64.c (SWAP_IN_RELOC_OFFSET): Define.
26760                 (SWAP_OUT_RELOC_OFFSET): Define.
26761
26762 2022-08-15  GDB Administrator  <gdbadmin@sourceware.org>
26763
26764         Automatic date update in version.in
26765
26766 2022-08-14  Andrew Burgess  <aburgess@redhat.com>
26767
26768         gdb/riscv: improve a comment about fcsr, fflags, and frm registers
26769         There's a comment in riscv-tdep.c that explains some of the background
26770         about how we check for the fcsr, fflags, and frm registers within a
26771         riscv target description.
26772
26773         This comment (and the functionality it describes) relates to how QEMU
26774         advertises these registers within its target description.
26775
26776         Unfortunately, QEMU includes these three registers in both the fpu and
26777         crs target description features.  To work around this GDB uses one of
26778         the register declarations, and ignores the other, this means the GDB
26779         user sees a single copy of each register, and things just work.
26780
26781         When I originally wrote the comment I thought it didn't matter which
26782         copy of the register GDB selected, the fpu copy or the csr copy, so
26783         long as we just used one of them.  The comment reflected this belief.
26784
26785         Upon further investigation, it turns out I was wrong.  GDB has to use
26786         the csr copy of the register.  If GDB tries to use the register from
26787         the fpu feature then QEMU will return an error when GDB tries to read
26788         or write the register.
26789
26790         Luckily, the code within GDB (currently) will always select the csr
26791         copy of the register, so nothing is broken, but the comment is wrong.
26792         This commit updates the comment to better describe what is actually
26793         going on.
26794
26795         Of course, I should probably also send a patch to QEMU to fix up the
26796         target description that is sent to GDB.
26797
26798 2022-08-14  Andrew Burgess  <aburgess@redhat.com>
26799
26800         gdb/nds32: update features/nds32.c
26801         After this commit:
26802
26803           commit 7b7c365c5c663ffdfb2b3f696db35c23cdccd921
26804           Date:   Wed Sep 15 10:10:46 2021 +0200
26805
26806               [bfd] Ensure unique printable names for bfd archs
26807
26808         The printable name field of the default nds32 bfd_arch_info changed
26809         from 'n1h' to 'n1'.  As a consequence the generated feature file
26810         within GDB should have been recreated.  Recreate it now.
26811
26812 2022-08-14  Tom Tromey  <tom@tromey.com>
26813
26814         Move decode_location_spec to code_breakpoint
26815         breakpoint::decode_location_spec just asserts if called.  It turned
26816         out to be relatively easy to remove this method from breakpoint and
26817         instead move the base implementation to code_breakpoint.
26818
26819         Change location_spec_to_sals to a method
26820         location_spec_to_sals is only ever called for code breakpoints, so
26821         make it a protected method there.
26822
26823         Change breakpoint_re_set_default to a method
26824         breakpoint_re_set_default is only ever called from breakpoint re_set
26825         methods, so make it a protected method on code_breakpoint.
26826
26827 2022-08-14  GDB Administrator  <gdbadmin@sourceware.org>
26828
26829         Automatic date update in version.in
26830
26831 2022-08-13  Alan Modra  <amodra@gmail.com>
26832
26833         PR29482 - strip: heap-buffer-overflow
26834                 PR 29482
26835                 * coffcode.h (coff_set_section_contents): Sanity check _LIB.
26836
26837         asan: NULL dereference in spu_elf_object_p
26838                 * elf32-spu.c (spu_elf_object_p): Don't dereference NULL
26839                 shdr->bfd_section.
26840
26841         ubsan: undefined shift in sign_extend
26842                 * libhppa.h (sign_extend): Avoid undefined behaviour.
26843
26844         asan: NULL dereference in som_set_reloc_info
26845                 * som.c (som_set_reloc_info): Ignore non-existent previous
26846                 fixup references.
26847
26848         readelf: print 0x0 as 0, and remove trailing spaces
26849         This changes readelf output a little, removing the 0x prefix on hex
26850         output when the value is 0, except in cases where a fixed field
26851         width is shown.  %#010x is not a good replacement for 0x%08x.
26852
26853         Make dwarf_vma uint64_t
26854         This replaces dwarf_vma, dwarf_size_type and dwarf_signed_vma with
26855         uint64_t and int64_t everywhere.  The patch also gets rid of
26856         DWARF_VMA_FMT since we can't use that with uint64_t, and all of the
26857         configure support for deciding the flavour of HOST_WIDEST_INT.
26858         dwarf_vmatoa also disappears, replacing most uses with one of
26859         PRIx64, PRId64 or PRIu64.  Printing of size_t and ptrdiff_t values
26860         now use %z and %t rather than by casting to unsigned long.  Also,
26861         most warning messages that used 0x%lx or similar now use %#lx and a
26862         few that didn't print the 0x hex prefix now also use %#.  The patch
26863         doesn't change normal readelf output, except in odd cases where values
26864         previously might have been truncated.
26865
26866         Don't use bfd_vma in readelf.c
26867         This replaces bfd_vma with uint64_t in readelf, defines BFD64
26868         unconditionally, removes tests of BFD64 and sizeof (bfd_vma), and
26869         removes quite a few now unnecessary casts.
26870
26871         Don't use bfd_size_type in readelf.c and dwarf.c
26872         Replacing bfd_size_type with dwarf_size_type or uint64_t is mostly
26873         cosmetic.  The point of the change is to avoid use of a BFD type
26874         in readelf, where we'd like to keep as independent of BFD as
26875         possible.  Also, the patch is a step towards using standard types.
26876
26877         Replace elf_vma with uint64_t
26878         This patch replaces all uses of elf_vma with uint64_t, removes
26879         tests of sizeof (elf_vma), and does a little tidying of
26880         byte_get_little_endian and byte_get_big_endian.
26881
26882 2022-08-13  GDB Administrator  <gdbadmin@sourceware.org>
26883
26884         Automatic date update in version.in
26885
26886 2022-08-12  Tom de Vries  <tdevries@suse.de>
26887
26888         [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp
26889         When running test-case gdb.dwarf2/dw2-dir-file-name.exp on x86_64-linux, we
26890         have:
26891         ...
26892         (gdb) break compdir_missing__ldir_missing__file_basename^M
26893         Breakpoint 2 at 0x4004c4: file tmp-dw2-dir-file-name.c, line 999.^M
26894         (gdb) continue^M
26895         Continuing.^M
26896         ^M
26897         Breakpoint 2, 0x00000000004004c4 in \
26898           compdir_missing__ldir_missing__file_basename () \
26899           at tmp-dw2-dir-file-name.c:999^M
26900         (gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \
26901           compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
26902           compdir_missing__ldir_missing__file_basename
26903         ...
26904
26905         When trying to set a breakpoint on
26906         compdir_missing__ldir_missing__file_basename, the architecture-specific
26907         prologue skipper starts at 0x4004c0 and skips past two insns, to 0x4004c4:
26908         ...
26909         00000000004004c0 <compdir_missing__ldir_missing__file_basename>:
26910           4004c0: 55                      push   %rbp
26911           4004c1: 48 89 e5                mov    %rsp,%rbp
26912           4004c4: 8b 05 72 1b 20 00       mov    0x201b72(%rip),%eax        # 60203c <v>
26913           4004ca: 83 c0 01                add    $0x1,%eax
26914           4004cd: 89 05 69 1b 20 00       mov    %eax,0x201b69(%rip)        # 60203c <v>
26915           4004d3: 90                      nop
26916           4004d4: 5d                      pop    %rbp
26917           4004d5: c3                      ret
26918         ...
26919
26920         And because the line table info is rudamentary:
26921         ...
26922         CU: tmp-dw2-dir-file-name.c:
26923         File name                    Line number    Starting address    View    Stmt
26924         tmp-dw2-dir-file-name.c              999            0x4004c0               x
26925         tmp-dw2-dir-file-name.c             1000            0x4004d6               x
26926         tmp-dw2-dir-file-name.c                -            0x4004d6
26927         ...
26928         the address does not fall at an actual line, so the breakpoint is shown with
26929         address, both when setting it and hitting it.
26930
26931         when running the test-case with aarch64-linux, we have similarly:
26932         ...
26933         (gdb) break compdir_missing__ldir_missing__file_basename^M
26934         Breakpoint 2 at 0x400618: file tmp-dw2-dir-file-name.c, line 999.^M
26935         ...
26936         due to the architecture-specific prologue skipper starting at 0x400610 and
26937         skipping past two insns, to 0x400618:
26938         ...
26939         0000000000400610 <compdir_missing__ldir_missing__file_basename>:
26940           400610:       90000100        adrp    x0, 420000 <__libc_start_main@GLIBC_2.17>
26941           400614:       9100b000        add     x0, x0, #0x2c
26942           400618:       b9400000        ldr     w0, [x0]
26943           40061c:       11000401        add     w1, w0, #0x1
26944           400620:       90000100        adrp    x0, 420000 <__libc_start_main@GLIBC_2.17>
26945           400624:       9100b000        add     x0, x0, #0x2c
26946           400628:       b9000001        str     w1, [x0]
26947           40062c:       d503201f        nop
26948           400630:       d65f03c0        ret
26949         ...
26950
26951         But interestingly, the aarch64 architecture-specific prologue skipper is
26952         wrong.  There is no prologue, and the breakpoint should be set at 0x400610.
26953
26954         By using "break *compdir_missing__ldir_missing__file_basename"
26955         we can get the breakpoint set at 0x400610:
26956         ...
26957         (gdb) break *compdir_missing__ldir_missing__file_basename^M
26958         Breakpoint 2 at 0x400610: file tmp-dw2-dir-file-name.c, line 999.^M
26959         ...
26960         and make the test-case independent of prologue analysis.
26961
26962         This requires us to update the expected patterns.
26963
26964         The fix ensures that once the aarch64 architecture-specific prologue skipper
26965         will be fixed, this test-case won't start failing.
26966
26967         Tested on x86_64-linux.
26968
26969 2022-08-12  GDB Administrator  <gdbadmin@sourceware.org>
26970
26971         Automatic date update in version.in
26972
26973 2022-08-11  Lancelot SIX  <lancelot.six@amd.com>
26974
26975         gdb/varobj: Only re-evaluate invalid globals during re_set
26976         When doing varobj_re_set, we currently try to recreate floating varobj.
26977         This was introduced by 4e969b4f0128 "Re-evaluate floating varobj as part
26978         of varobj_invalidate" to deal with use a after free issue.  However
26979         since bc20e562ec0 "Fix use after free in varobj" we now ensure that we
26980         never have dangling pointers so this all recreation is not strictly
26981         needed anymore for floating varobjs.
26982
26983         This commit proposes to remove this recreation process for floating
26984         varobjs.
26985
26986         Tested on x86_64-linux.
26987
26988 2022-08-11  Tom de Vries  <tdevries@suse.de>
26989             Lancelot SIX  <lancelot.six@amd.com>
26990
26991         gdb/varobj: Reset varobj after relocations have been computed
26992         [This patch is a followup to the discussion in
26993         https://sourceware.org/pipermail/gdb-patches/2022-August/191188.html]
26994
26995         PR/29426 shows failures when running the gdb.mi/mi-var-invalidate-shlib
26996         test when using a compiler which does not produce a PIE executable by
26997         default.
26998
26999         In the testcase, a varobj is created to track a global variable, and
27000         then the main binary is reloaded in GDB (using the file command).
27001
27002         During the load of the new binary, GDB tries to recreate the varobj to
27003         track the global in the new binary (varobj_invalidate_iter).  At this
27004         point, the old process is still in flight.  So when we try to access to
27005         the value of the global, in a PIE executable we only have access to the
27006         unrelocated address (the objfile's text_section_offset () is 0).  As a
27007         consequence down the line read_value_memory fails to read the unrelated
27008         address, so cannot evaluate the value of the global.  Note that the
27009         expression used to access to the global’s value is valid, so the varobj
27010         can be created.  When using a non PIE executable, the address of the
27011         global GDB knows about at this point does not need relocation, so
27012         read_value_memory can access the (old binary’s) value.
27013
27014         So at this point, in the case of a non-PIE executable the value field is
27015         set, while it is cleared in the case of PIE executable.  Later when the
27016         test issues a "-var-update global_var", the command sees no change in
27017         the case of the non-PIE executable, while in the case of the PIE
27018         executable install_new_value sees that value changes, leading to a
27019         different output.
27020
27021         This patch makes sure that, as we do for breakpoints, we wait until
27022         relocation has happened before we try to recreate varobjs.  This way we
27023         have a consistent behavior between PIE and non-PIE binaries.
27024
27025         Tested on x86_64-linux.
27026
27027         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29426
27028
27029 2022-08-11  Lancelot SIX  <lancelot.six@amd.com>
27030
27031         gdb/varobj: Do not invalidate locals in varobj_invalidate_iter
27032         The varobj_invalidate_iter function has logic to invalidate any local
27033         varobj it can find.  However since bc20e562ec0 "gdb/varobj: Fix use
27034         after free in varobj" all varobj containing references to an objfile are
27035         cleared when the objfile goes out of scope.  This means that at this
27036         point any local varobj seen by varobj_invalidate_iter either has
27037         already been invalidated by varobj_invalidate_if_uses_objfile or only
27038         contains valid references and there is no reason to invalidate it.
27039
27040         This patch proposes to remove this unnecessary invalidation and adds a
27041         testcase which exercises a scenario where a local varobj can legitimately
27042         survive a call to varobj_invalidate_iter.
27043
27044         At this point the varobj_invalidate and varobj_invalidate_iter seem
27045         misnamed since they deal with re-creating invalid objects and do not do
27046         invalidation, but this will be fixed in a following patch.
27047
27048         Tested on x86_64-linux.
27049
27050 2022-08-11  Dmitry Selyutin  <ghostmansd@gmail.com>
27051
27052         ppc/svp64: support svindex instruction
27053         https://libre-soc.org/openpower/sv/
27054         https://libre-soc.org/openpower/sv/remap/#svindex
27055         https://libre-soc.org/openpower/isa/simplev/
27056
27057         ppc/svp64: support svremap instruction
27058         https://libre-soc.org/openpower/sv/
27059         https://libre-soc.org/openpower/sv/remap/#svremap
27060         https://libre-soc.org/openpower/isa/simplev/
27061
27062         ppc/svp64: support svshape instruction
27063         https://libre-soc.org/openpower/sv/
27064         https://libre-soc.org/openpower/sv/remap/#svshape
27065         https://libre-soc.org/openpower/isa/simplev/
27066
27067         ppc/svp64: support svstep instructions
27068         https://libre-soc.org/openpower/sv/
27069         https://libre-soc.org/openpower/sv/svstep/
27070         https://libre-soc.org/openpower/isa/simplev/
27071
27072         ppc/svp64: support setvl instructions
27073         https://libre-soc.org/openpower/sv/
27074         https://libre-soc.org/openpower/sv/setvl/
27075         https://libre-soc.org/openpower/isa/simplev/
27076
27077         ppc/svp64: introduce non-zero operand flag
27078         svstep and svshape instructions subtract 1 before encoding some of the
27079         operands. Obviously zero is not supported for these operands. Whilst
27080         PPC_OPERAND_PLUS1 fits perfectly to mark that maximal value should be
27081         incremented, there is no flag which marks the fact that zero values are
27082         not allowed. This patch adds a new flag, PPC_OPERAND_NONZERO, for this
27083         purpose.
27084
27085 2022-08-11  Dmitry Selyutin  <ghostmansd@gmail.com>
27086
27087         ppc/svp64: support LibreSOC architecture
27088         This patch adds support for LibreSOC machine and SVP64 extension flag
27089         for PowerPC architecture. SV (Simple-V) is a strict RISC-paradigm
27090         Scalable Vector Extension for the Power ISA. SVP64 is the 64-bit
27091         Prefixed instruction format implementing SV. Funded by NLnet through EU
27092         Grants No: 825310 and 825322, SV is in DRAFT form and is to be publicly
27093         submitted via the OpenPOWER Foundation ISA Working Group via the
27094         newly-created External RFC Process.
27095
27096         For more details, visit https://libre-soc.org.
27097
27098 2022-08-11  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
27099
27100         [Arm] Cleanup arm_m_exception_cache
27101         With this change, only valid contents of LR are accepted when unwinding
27102         exception frames for m-profile targets.
27103
27104         If the contents of LR are anything but EXC_RETURN or FNC_RETURN, it
27105         will cause GDB to print an error and/or abort unwinding of the frame as
27106         it's an invalid state for the unwinder.
27107
27108         The FNC_RETURN pattern requires Security Extensions to be enabled.
27109
27110 2022-08-11  Fangrui Song  <maskray@google.com>
27111
27112         RISC-V: Remove R_RISCV_GNU_VTINHERIT/R_RISCV_GNU_VTENTRY
27113         They were legacy relocation types copied from other ports.  The related
27114         -fvtable-gc was removed from GCC in 2003.
27115
27116         The associated assembler directives (.vtable_inherit and .vtable_entry)
27117         have never been supported by the RISC-V port.  Remove related ld code.
27118
27119         Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/323
27120
27121 2022-08-11  Alan Modra  <amodra@gmail.com>
27122
27123         PR29466, APP/NO_APP with .linefile
27124         Commit 53f2b36a54b9 exposed a bug in sb_scrub_and_add_sb that could
27125         result in losing input.  If scrubbing results in expansion past the
27126         holding capacity of do_scrub_chars output buffer, then do_scrub_chars
27127         stashes the extra input for the next call.  That call never came
27128         because sb_scrub_and_add_sb wrongly decided it was done.  Fix that by
27129         allowing sb_scrub_and_add_sb to see whether there is pending input.
27130         Also allow a little extra space so that in most cases we won't need
27131         to resize the output buffer.
27132
27133         sb_scrub_and_add_sb also limited output to the size of the input,
27134         rather than the actual output buffer size.  Fixing that resulted in a
27135         fail of gas/testsuite/macros/dot with an extra warning: "end of file
27136         not at end of a line; newline inserted".  OK, so the macro in dot.s
27137         really does finish without end-of-line.  Apparently the macro
27138         expansion code relied on do_scrub_chars returning early.  So fix that
27139         too by adding a newline if needed in macro_expand_body.
27140
27141                 PR 29466
27142                 * app.c (do_scrub_pending): New function.
27143                 * as.h: Declare it.
27144                 * input-scrub.c (input_scrub_include_sb): Add extra space for
27145                 two .linefile directives.
27146                 * sb.c (sb_scrub_and_add_sb): Take into account pending input.
27147                 Allow output to max.
27148                 * macro.c (macro_expand_body): Add terminating newline.
27149                 * testsuite/config/default.exp (SIZE, SIZEFLAGS): Define.
27150                 * testsuite/gas/macros/app5.d,
27151                 * testsuite/gas/macros/app5.s: New test.
27152                 * testsuite/gas/macros/macros.exp: Run it.
27153
27154 2022-08-11  Alan Modra  <amodra@gmail.com>
27155
27156         regen potfiles
27157
27158 2022-08-11  GDB Administrator  <gdbadmin@sourceware.org>
27159
27160         Automatic date update in version.in
27161
27162 2022-08-10  Simon Marchi  <simon.marchi@polymtl.ca>
27163
27164         gdb/mi: fix breakpoint script field output
27165         The "script" field, output whenever information about a breakpoint with
27166         commands is output, uses wrong MI syntax.
27167
27168             $ ./gdb -nx -q --data-directory=data-directory -x script -i mi
27169             =thread-group-added,id="i1"
27170             =breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000000111d",func="main",file="test.c",fullname="/home/simark/build/binutils-gdb-one-target/gdb/test.c",line="3",thread-groups=["i1"],times="0",original-location="main"}
27171             =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000000111d",func="main",file="test.c",fullname="/home/simark/build/binutils-gdb-one-target/gdb/test.c",line="3",thread-groups=["i1"],times="0",script={"aaa","bbb","ccc"},original-location="main"}
27172             (gdb)
27173             -break-info
27174             ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000000111d",func="main",file="test.c",fullname="/home/simark/build/binutils-gdb-one-target/gdb/test.c",line="3",thread-groups=["i1"],times="0",script={"aaa","bbb","ccc"},original-location="main"}]}
27175             (gdb)
27176
27177         In both the =breakpoint-modified and -break-info output, we have:
27178
27179              script={"aaa","bbb","ccc"}
27180
27181         According to the output syntax [1], curly braces means tuple, and a
27182         tuple contains key=value pairs.  This looks like it should be a list,
27183         but uses curly braces by mistake.  This would make more sense:
27184
27185             script=["aaa","bbb","ccc"]
27186
27187         Fix it, keeping the backwards compatibility by introducing a new MI
27188         version (MI4), in exactly the same way as was done when fixing
27189         multi-locations breakpoint output in [2].
27190
27191          - Add a fix_breakpoint_script_output uiout flag.  MI uiouts will use
27192            this flag if the version is >= 4.
27193          - Add a fix_breakpoint_script_output_globally variable and the
27194            -fix-breakpoint-script-output MI command to set it, if frontends want
27195            to use the fixed output for this without using the newer MI version.
27196          - When emitting the script field, use list instead of tuple, if we want
27197            the fixed output (depending on the two criteria above)
27198          -
27199
27200         [1] https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax
27201         [2] https://gitlab.com/gnutools/binutils-gdb/-/commit/b4be1b0648608a2578bbed39841c8ee411773edd
27202
27203         Change-Id: I7113c6892832c8d6805badb06ce42496677e2242
27204         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24285
27205
27206 2022-08-10  Andrew Burgess  <aburgess@redhat.com>
27207
27208         objdump: fix extended (256) disassembler colors
27209         After commit:
27210
27211           commit a88c79b77036e4778e70d62081c3cfd1044bb8e3
27212           Date:   Tue Aug 9 14:57:48 2022 +0100
27213
27214               Default to enabling colored disassembly if output is to a terminal.
27215
27216         The 256 extended-color support for --disassembler-color was broken.
27217         This is fixed in this commit.
27218
27219                 PR 29457
27220                 * objdump (objdump_styled_sprintf): Check disassembler_color
27221                 against an enum value, don't treat it as a bool.
27222
27223 2022-08-10  mga-sc  <mark.goncharov@syntacore.com>
27224
27225         gdb/riscv: implement cannot_store_register gdbarch method
27226         The x0 (zero) register is read-only on RISC-V.  Implement the
27227         cannot_store_register gdbarch method to tell GDB this.
27228
27229         Without this method GDB will try to write to x0, and relies on the
27230         target to ignore such writes.  If you are using a target that
27231         complains (or throws an error) when writing to x0, this change will
27232         prevent this from happening.
27233
27234         The gdb.arch/riscv-reg-aliases.exp test exercises writing to x0, and
27235         will show the errors when using a suitable target.
27236
27237 2022-08-10  Luis Machado  <luis.machado@arm.com>
27238
27239         Disable year 2038 support on 32-bit hosts by default
27240         With a recent import of gnulib, code has been pulled that tests and enables
27241         64-bit time_t by default on 32-bit hosts that support it.
27242
27243         Although gdb can use the gnulib support, bfd doesn't use gnulib and currently
27244         doesn't do these checks.
27245
27246         As a consequence, if we have a 32-bit host that supports 64-bit time_t, we'll
27247         have a mismatch between gdb's notion of time_t and bfd's notion of time_t.
27248
27249         This will lead to mismatches in the struct stat size, leading to memory
27250         corruption and crashes.
27251
27252         This patch disables the year 2038 check for now, which makes things work
27253         reliably again.
27254
27255         I'd consider this a temporary fix until we have proper bfd checks for the year
27256         2038, if it makes sense.  64-bit hosts seems to be more common these days, so
27257         I'm not sure how important it is to have this support enabled and how soon
27258         we want to enable it.
27259
27260         Thoughts?
27261
27262 2022-08-10  Jan Beulich  <jbeulich@suse.com>
27263
27264         gas/Dwarf: properly skip zero-size functions
27265         PR gas/29451
27266
27267         While out_debug_abbrev() properly skips such functions, out_debug_info()
27268         mistakenly didn't. It needs to calculate the high_pc expression ahead of
27269         time, in order to skip emitting any data for the function if the value
27270         is zero.
27271
27272         The one case which would still leave a zero-size entry is when
27273         symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can
27274         expect that to not be the case, otherwise we'd need to have a way to
27275         post-process .debug_info contents between resolving expressions and
27276         actually writing the data out to the file. Even then it wouldn't be
27277         entirely obvious in which way to alter the data.
27278
27279 2022-08-10  Alan Modra  <amodra@gmail.com>
27280
27281         PR29462, internal error in relocate, at powerpc.cc:10796
27282         Prior to the inline plt call support (commit 08be322439), the only
27283         local syms with plt entries were local ifunc symbols.  There shouldn't
27284         be stubs for other local symbols so don't look for them.  The patch
27285         also fixes minor bugs in get_reference_flags; Many relocs are valid
27286         only for ppc64 and a couple only for ppc32.
27287
27288                 PR 29462
27289                 * powerpc.cc (Target_powerpc::Relocate::relocate): Rename
27290                 use_plt_offset to pltcal_to_direct, invert logic.  For relocs
27291                 not used with inline plt sequences against local symbols, only
27292                 look for stubs when the symbol is an ifunc.
27293                 (Target_powerpc::Scan::get_reference_flags): Correct reloc
27294                 handling for relocs not valid for both 32-bit and 64-bit.
27295
27296 2022-08-10  Youling Tang  <tangyouling@loongson.cn>
27297
27298         bfd: Add support for LoongArch64 EFI (efi-*-loongarch64).
27299         This adds support for efi-loongarch64 by virtue of adding a new PEI target
27300         pei-loongarch64.  This is not a full target and only exists to support EFI at
27301         this time.
27302
27303         This means that this target does not support relocation processing and is mostly
27304         a container format.  This format has been added to elf based loongarch64 targets
27305         such that efi images can be made natively on Linux.
27306
27307         However this target is not valid for use with gas but only with objcopy.
27308
27309         We should't limit addresses to 32-bits for 64-bit vma, otherwise there will be
27310         "RVA truncated" error when using objcopy on loongarch64.
27311
27312         With these changes the resulting file is recognized as an efi image.
27313
27314         Any magic number is based on the Microsoft PE specification [1].
27315
27316         The test results are as follows:
27317         $ make check-binutils RUNTESTFLAGS='loongarch64.exp'
27318           PASS: Check if efi app format is recognized
27319
27320         $ objdump -h -f tmpdir/loongarch64copy.o
27321           tmpdir/loongarch64copy.o:     file format pei-loongarch64
27322           architecture: Loongarch64, flags 0x00000132:
27323           EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED
27324           start address 0x0000000000000000
27325
27326           Sections:
27327           Idx Name          Size      VMA               LMA               File off  Algn
27328             0 .text         0000003c  00000000200000b0  00000000200000b0  00000200  2**2
27329                             CONTENTS, ALLOC, LOAD, READONLY, CODE
27330
27331         [1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
27332
27333         bfd:
27334           * .gitignore (pe-loongarch64igen.c): New.
27335           * Makefile.am (pei-loongarch64.lo, pe-loongarch64igen.lo, pei-loongarch64.c,
27336           pe-loongarch64igen.c): Add support.
27337           * Makefile.in: Likewise.
27338           * bfd.c (bfd_get_sign_extend_vma): Add pei-loongarch64.
27339           * coff-loongarch64.c: New file.
27340           * coffcode.h (coff_set_arch_mach_hook, coff_set_flags,
27341           coff_write_object_contents) Add loongarch64 (loongarch64_pei_vec) support.
27342           * config.bfd: Likewise.
27343           * configure: Likewise.
27344           * configure.ac: Likewise.
27345           * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE,
27346           GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE,
27347           GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT,
27348           GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE,
27349           GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT,
27350           GET_PDATA_ENTRY, _bfd_peLoongArch64_bfd_copy_private_bfd_data_common,
27351           _bfd_peLoongArch64_bfd_copy_private_section_data,
27352           _bfd_peLoongArch64_get_symbol_info, _bfd_peLoongArch64_only_swap_filehdr_out,
27353           _bfd_peLoongArch64_print_private_bfd_data_common,
27354           _bfd_peLoongArch64i_final_link_postscript,
27355           _bfd_peLoongArch64i_only_swap_filehdr_out, _bfd_peLoongArch64i_swap_aouthdr_in,
27356           _bfd_peLoongArch64i_swap_aouthdr_out, _bfd_peLoongArch64i_swap_aux_in,
27357           _bfd_peLoongArch64i_swap_aux_out, _bfd_peLoongArch64i_swap_lineno_in,
27358           _bfd_peLoongArch64i_swap_lineno_out, _bfd_peLoongArch64i_swap_scnhdr_out,
27359           _bfd_peLoongArch64i_swap_sym_in, _bfd_peLoongArch64i_swap_sym_out,
27360           _bfd_peLoongArch64i_swap_debugdir_in, _bfd_peLoongArch64i_swap_debugdir_out,
27361           _bfd_peLoongArch64i_write_codeview_record,
27362           _bfd_peLoongArch64i_slurp_codeview_record,
27363           _bfd_peLoongArch64_print_ce_compressed_pdata): New.
27364           * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out,
27365           _bfd_XXi_swap_scnhdr_out, pe_print_pdata, _bfd_XX_print_private_bfd_data_common,
27366           _bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript):
27367           Support COFF_WITH_peLoongArch64,
27368           * pei-loongarch64.c: New file.
27369           * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p):
27370           Support COFF_WITH_peLoongArch64.
27371           (jtab): Add dummy entry that traps.
27372           * targets.c (loongarch64_pei_vec): New.
27373
27374         binutils
27375           * testsuite/binutils-all/loongarch64/loongarch64.exp: New file.
27376           * testsuite/binutils-all/loongarch64/pei-loongarch64.d: New test.
27377           * testsuite/binutils-all/loongarch64/pei-loongarch64.s: New test.
27378
27379         include
27380           * coff/loongarch64.h: New file.
27381           * coff/pe.h (IMAGE_FILE_MACHINE_LOONGARCH64): New.
27382
27383 2022-08-10  GDB Administrator  <gdbadmin@sourceware.org>
27384
27385         Automatic date update in version.in
27386
27387 2022-08-09  Andrew Burgess  <aburgess@redhat.com>
27388
27389         gdb/riscv/testsuite: fix failures in gdb.arch/riscv-reg-aliases.exp
27390         When running on a native RISC-V Linux target I currently see failures
27391         in the gdb.arch/riscv-reg-aliases.exp test like this:
27392
27393           set $ft0.float = 501
27394           (gdb) PASS: gdb.arch/riscv-reg-aliases.exp: write non-zero value to ft0
27395           p/d $ft0.float
27396           $263 = 1140490240
27397           (gdb) FAIL: gdb.arch/riscv-reg-aliases.exp: read ft0 after non-zero write to ft0
27398
27399         This test started failing after this commit:
27400
27401           commit 56262a931b7ca8ee3ec9104bc7e9e0b40cf3d64e
27402           Date:   Thu Feb 17 13:43:59 2022 -0700
27403
27404               Change how "print/x" displays floating-point value
27405
27406         The problem is that when 501 is written to $ft0.float the value is
27407         converted to floating point format and stored in the register.  Prior
27408         to the above commit printing with /x and /d would first extract the
27409         value as a float, and then convert the value to an integer for
27410         display.  After the above commit GDB now uses the raw register value
27411         when displaying /x and /d, and so we see this behaviour:
27412
27413           (gdb) info registers $ft0
27414           ft0            {float = 501, double = 5.6347704700123827e-315}        (raw 0x0000000043fa8000)
27415           (gdb) p/f $ft0.float
27416           $1 = 501
27417           (gdb) p/d $ft0.float
27418           $2 = 1140490240
27419           (gdb) p/x $ft0.float
27420           $3 = 0x43fa8000
27421
27422         To fix this test I now print the float registers using the /f format
27423         rather than /d.  With this change the test now passes.
27424
27425 2022-08-09  Stepan Nemec  <stepnem@gmail.com>
27426
27427         Another gas manual typo correction.
27428
27429         Fix typos in assembler documentation.
27430
27431 2022-08-09  Feiyang Chen  <chenfeiyang@loongson.cn>
27432
27433         gdb/gdbserver: LoongArch: Improve implementation of fcc registers
27434         The current implementation of the fcc register is referenced to the
27435         user_fp_state structure of the kernel uapi [1].
27436
27437         struct user_fp_state {
27438                 uint64_t    fpr[32];
27439                 uint64_t    fcc;
27440                 uint32_t    fcsr;
27441         };
27442
27443         But it is mistakenly defined as a 64-bit fputype register, resulting
27444         in a confusing output of "info register".
27445
27446         (gdb) info register
27447         ...
27448         fcc            {f = 0x0, d = 0x0}  {f = 0, d = 0}
27449         ...
27450
27451         According to "Condition Flag Register" in "LoongArch Reference Manual"
27452         [2], there are 8 condition flag registers of size 1. Use 8 registers of
27453         uint8 to make it easier for users to view the fcc register groups.
27454
27455         (gdb) info register
27456         ...
27457         fcc0           0x1                 1
27458         fcc1           0x0                 0
27459         fcc2           0x0                 0
27460         fcc3           0x0                 0
27461         fcc4           0x0                 0
27462         fcc5           0x0                 0
27463         fcc6           0x0                 0
27464         fcc7           0x0                 0
27465         ...
27466
27467         [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/uapi/asm/ptrace.h
27468         [2] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_condition_flag_register
27469
27470 2022-08-09  Nick Clifton  <nickc@redhat.com>
27471
27472         Default to enabling colored disassembly if output is to a terminal.
27473                 PR 29457
27474                 * objdump.c (disassembler_color): Change type to an enum.
27475                 (disassembler_extended_color): Remove.
27476                 (usage): Update.
27477                 (objdump_color_for_assembler_style): Update.
27478                 (main): Update initialisation of disassembler_color.  If not
27479                 initialised via a command line option, set based upon terminal
27480                 output.
27481                 * doc/binutils.texi: Update description of disassmbler-color
27482                 option.
27483                 * testsuite/binutils-all/arc/objdump.exp: Add
27484                 --disassembler-color=off option when disassembling.
27485                 * testsuite/binutils-all/arm/objdump.exp: Likewise.
27486
27487 2022-08-09  Aditya Vidyadhar Kamath  <Aditya.Kamath1@ibm.com>
27488
27489         Fix-for-multiple-thread-detection-in-AIX.
27490         In AIX multiple threads were not added. This patch is a fix for the same
27491
27492         When we create a pthread debug session we have callbacks to read
27493         symbols and memory.  One of those call backs is pdc_read_data.
27494
27495         Before we come into aix-thread wait() we switch to no thread and
27496         therefore the current thread is null.
27497
27498         When we get into pdc_read_data we have a dependency that we need to
27499         be in the correct current thread that has caused an event of new
27500         thread, inorder to read memory.
27501
27502         Hence we switch to the correct thread.
27503
27504         This is done by passing the pid in the pthdb_user_t user_current_pid
27505         parameter in every call back.
27506
27507 2022-08-09  Tom de Vries  <tdevries@suse.de>
27508
27509         [gdb/testsuite] Fix gdb.dwarf2/debug-names.exp
27510         When running test-case gdb.dwarf2/debug-names.exp on openSUSE Tumbleweed, I
27511         run into:
27512         ...
27513         (gdb) maint info symtabs^M
27514           ...
27515         ERROR: internal buffer is full.
27516         UNRESOLVED: gdb.dwarf2/debug-names.exp: break _start expanded symtab
27517         ...
27518
27519         Fix this by simplifying the test-case to print _start rather running to it.
27520
27521         Tested on x86_64-linux.
27522
27523 2022-08-09  Andrew Burgess  <aburgess@redhat.com>
27524
27525         gdb/riscv: use register name enum values in riscv-linux-nat.c
27526         There were a few places where we were using integer values rather than
27527         the RISCV_*_REGNUM constants defined in riscv-tdep.h.  This commit
27528         replaces 0 with RISCV_ZERO_REGNUM and 32 with RISCV_PC_REGNUM in a few
27529         places.
27530
27531         There should be no user visible changes after this commit.
27532
27533 2022-08-09  Jan Beulich  <jbeulich@suse.com>
27534
27535         x86-64: adjust MOVQ to/from SReg attributes
27536         It is unclear to me why the corresponding MOV (no Q suffix) can be
27537         issued without REX.W, but MOVQ has to have that prefix (bit). Add
27538         NoRex64 and in exchange drop Size64.
27539
27540         x86: adjust MOVSD attributes
27541         The non-SSE2AVX form of the SIMD variant of the instruction needlessly
27542         has the (still multi-purpose) IgnoreSize attribute. All other similar
27543         SSE2 insns use NoRex64 instead. Make this consistent, noting that the
27544         SSE2AVX form can't have the same change made - there the memory operand
27545         doesn't at the same time permit RegXMM (which logic uses when deciding
27546         whether a Q suffix is okay outside of 64-bit mode).
27547
27548         x86: fold AVX VGATHERDPD / VPGATHERDQ
27549         While the other three variants each differ in attributes and hence can't
27550         be folded, these two pairs actually can be (and were previously
27551         overlooked). This effectively matches their AVX512VL counterparts, which
27552         are also expressed as a single template.
27553
27554         x86: allow use of broadcast with X/Y/Z-suffixed AVX512-FP16 insns
27555         While the x/y/z suffix isn't necessary to use in this case, it is still
27556         odd that these forms don't support broadcast (unlike their AVX512F /
27557         AVX512DQ counterparts). The lack thereof can e.g. make macro-ized
27558         programming more difficult.
27559
27560         x86/Intel: split certain AVX512-FP16 VCVT*2PH templates
27561         One more place where pre-existing templates should have been taken as a
27562         basis: In Intel syntax we want to consistently issue an "ambiguous
27563         operand size" error when a size-less memory operand is specified for an
27564         insn where register use alone isn't sufficient for disambiguation.
27565
27566 2022-08-09  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
27567
27568         gdb/csky fix build error in ubuntu20_04
27569         build error in: https://builder.sourceware.org/buildbot/#/builders/170/builds/246
27570         ...
27571         ../../binutils-gdb/gdb/csky-linux-tdep.c: In function ‘void
27572         csky_supply_fregset(const regset*, regcache*, int, const void*, size_t)’:
27573         ../../binutils-gdb/gdb/csky-linux-tdep.c:194:18: error: format ‘%ld’
27574         expects argument of type ‘long int’, but argument 2 has type ‘size_t’
27575         {aka ‘unsigned int’} [-Werror=format=]
27576            194 |       warning (_("Unknow size %ld of section .reg2, can not get
27577         value"
27578                |
27579         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27580            195 |    " of float registers."), len);
27581         ...
27582
27583         Fix it via using %s vs pulongest suggested by Tom.
27584
27585 2022-08-09  GDB Administrator  <gdbadmin@sourceware.org>
27586
27587         Automatic date update in version.in
27588
27589 2022-08-08  Tom Tromey  <tromey@adacore.com>
27590
27591         Fix regression from gdbarch registry change
27592         The gdbarch registry patch introduced a regression that could cause a
27593         crash when opening files in gdb.  The bug is that, previously, the
27594         solib ops would default to current_target_so_ops; but the patch
27595         changed this code to default to nullptr.  This patch fixes the bug by
27596         reintroducing the earlier behavior.  This is PR gdb/29449.
27597
27598         I managed to reproduce the bug with a riscv-elf build and then
27599         verified that this fixes the problem.
27600
27601         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29449
27602
27603 2022-08-08  Martin Liska  <mliska@suse.cz>
27604
27605         add splay tree for info_ptr -> CU mapping
27606         While using perf top for MozillaThunderbird I noticed quite some slow
27607         dissably call with source code involved. E.g.
27608
27609         time ./objdump --start-address=0x0000000004e0dcd0 --stop-address=0x0000000004e0df8b -l -d --no-show-raw-insn -S -C /usr/lib64/thunderbird/libxul.so
27610
27611         took 2.071s and I noticed quite some time is spent in
27612         find_abstract_instance:
27613
27614             33.46%  objdump  objdump               [.] find_abstract_instance
27615             18.22%  objdump  objdump               [.] arange_add
27616             13.77%  objdump  objdump               [.] read_attribute_value
27617              4.82%  objdump  objdump               [.] comp_unit_maybe_decode_line_info
27618              3.10%  objdump  libc.so.6             [.] __memset_avx2_unaligned_erms
27619
27620         where linked list of CU is iterated when searing for where info_ptr
27621         belongs to:
27622
27623                  : 3452   for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
27624             0.00 :   4c61f7: mov    0x10(%rbx),%rax
27625             0.00 :   4c61fb: test   %rax,%rax
27626             0.00 :   4c61fe: je     4c6215 <find_abstract_instance+0x365>
27627                  : 3453   if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
27628             0.00 :   4c6200: cmp    0x60(%rax),%rdx
27629            83.20 :   4c6204: jb     4c620c <find_abstract_instance+0x35c>
27630             0.00 :   4c6206: cmp    0x78(%rax),%rdx
27631             6.89 :   4c620a: jb     4c6270 <find_abstract_instance+0x3c0>
27632                  : 3452   for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
27633             0.00 :   4c620c: mov    0x10(%rax),%rax
27634             7.90 :   4c6210: test   %rax,%rax
27635             0.00 :   4c6213: jne    4c6200 <find_abstract_instance+0x350>
27636
27637         The following scan can be replaced with search in a splay tree and with
27638         that I can get to 1.5s and there are other symbols where the difference
27639         is even bigger.
27640
27641         bfd/ChangeLog:
27642
27643                 PR 29081
27644                 * dwarf2.c (struct addr_range): New.
27645                 (addr_range_intersects): Likewise.
27646                 (splay_tree_compare_addr_range): Likewise.
27647                 (splay_tree_free_addr_range): Likewise.
27648                 (struct dwarf2_debug_file): Add comp_unit_tree.
27649                 (find_abstract_instance): Use the splay tree when searching
27650                 for a info_ptr.
27651                 (stash_comp_unit): Insert to the splay tree.
27652                 (_bfd_dwarf2_cleanup_debug_info): Clean up the splay tree.
27653
27654 2022-08-08  Martin Liska  <mliska@suse.cz>
27655
27656         dwarf: use find_abstract_instance for vars and DW_AT_specification
27657         The following simple test case fails when dwz is used:
27658
27659         $ cat demo.C
27660         namespace std {
27661           enum { _S_fixed, _S_floatfield = _S_fixed };
27662           struct {
27663             struct {};
27664           }
27665           __ioinit;
27666         }
27667
27668         int main() {
27669           return 0;
27670         }
27671
27672         $ g++ demo.C -g && cp a.out b.out && dwz -m xxx.so a.out b.out && objdump -S a.out >/dev/null
27673         objdump: DWARF error: could not find variable specification at offset 0x3d3
27674
27675         As seen the reference is defined in xxx.so shared part:
27676
27677         $ eu-readelf -w -N a.out | grep -A3 -B3 3d3
27678                      decl_column          (data1) 11
27679                      sibling              (ref_udata) [   387]
27680          [   387]    variable             abbrev: 30
27681                      specification        (GNU_ref_alt) [   3d3]
27682                      location             (exprloc)
27683                       [ 0] addr 0x404019
27684          [   396]    subprogram           abbrev: 32
27685
27686         $ eu-readelf -w -N a.out | less
27687
27688         ...
27689
27690          Compilation unit at offset 920:
27691          Version: 5, Abbreviation section offset: 0, Address size: 8, Offset size: 4
27692          Unit type: partial (3)
27693         ...
27694          [   3d3]      variable             abbrev: 31
27695                        name                 (strp) "__ioinit"
27696                        decl_file            (data1) demo.C (10)
27697                        decl_line            (data1) 6
27698                        decl_column          (data1) 3
27699                        type                 (ref_udata) [   3c4]
27700                        declaration          (flag_present) yes
27701
27702         With the patch the same output is emitted as before usage of dwz.
27703
27704         bfd/ChangeLog:
27705
27706                 PR 29442
27707                 * dwarf2.c (struct varinfo): Use const char * type.
27708                 (scan_unit_for_symbols): Call find_abstract_instance for
27709                 DW_AT_specification for variables that can be in a different CU
27710                 (e.g. done by dwz)
27711
27712 2022-08-08  Tsukasa OI  <research_trasio@irq.a4lg.com>
27713
27714         Mach-O: i18n enablement on some error messages.
27715                 * config/obj-macho.c (obj_mach_o_get_section_names): Wrap two
27716                 string literals within with gettext macro.
27717
27718 2022-08-08  Martin Liska  <mliska@suse.cz>
27719
27720         ld: fix NEWS typos
27721         ld/ChangeLog:
27722
27723                 * NEWS: Fix 2 typos.
27724
27725 2022-08-08  Nick Clifton  <nickc@redhat.com>
27726
27727         Add a link to the NEWS files in the release announcement email.
27728
27729 2022-08-08  Jiangshuai Li  <jiangshuai_li@linux.alibaba.com>
27730
27731         gdb/csky support .reg2 for kernel 4.x and later
27732         When kernel's version >= 4.x, the size of .reg2 section will be 400.
27733         Contents of .reg2 are {
27734             unsigned long vr[96];
27735             unsigned long fcr;
27736             unsigned long fesr;
27737             unsigned long fid;
27738             unsigned long reserved;
27739         };
27740
27741         VR[96] means: (vr0~vr15) + (fr16~fr31), each Vector register is
27742         128-bits, each Float register is 64 bits, the total size is
27743         (4*96).
27744
27745         In addition, for fr0~fr15, each FRx is the lower 64 bits of the
27746         corresponding VRx. So fr0~fr15 and vr0~vr15 regisetrs use the same
27747         offset.
27748
27749 2022-08-08  GDB Administrator  <gdbadmin@sourceware.org>
27750
27751         Automatic date update in version.in
27752
27753 2022-08-07  Tom de Vries  <tdevries@suse.de>
27754
27755         [gdb/build] Fix build with gcc 4.8.5
27756         When building with gcc 4.8.5, I run into:
27757         ...
27758         user-regs.c:85:1: error: could not convert \
27759           ‘{0l, (& builtin_user_regs.gdb_user_regs::first)}’ from \
27760           ‘<brace-enclosed initializer list>’ to ‘gdb_user_regs’
27761          };
27762          ^
27763         ...
27764
27765         Fix this by removing the initialization and handling regs.last == nullptr in
27766         append_user_reg.
27767
27768         Tested on x86_64-linux.
27769
27770 2022-08-07  Tom de Vries  <tdevries@suse.de>
27771
27772         [gdb/symtab] Fix assert in read_addrmap_from_aranges
27773         When loading the debug-names-duplicate-cu executable included in this
27774         test-case, we run into:
27775         ...
27776         (gdb) file debug-names-duplicate-cu^M
27777         Reading symbols from debug-names-duplicate-cu...^M
27778         src/gdb/dwarf2/read.c:2353: internal-error: read_addrmap_from_aranges: \
27779           Assertion `insertpair.second' failed.^M
27780         ...
27781
27782         This assert was added in recent commit 75337cbc147 ("[gdb/symtab] Fix
27783         .debug_aranges duplicate offset warning").
27784
27785         The assert triggers because the CU table in the .debug_names section contains
27786         a duplicate:
27787         ...
27788         Version 5
27789         Augmentation string: 47 44 42 00  ("GDB")
27790         CU table:
27791         [  0] 0x0
27792         [  1] 0x0
27793         ...
27794
27795         Fix this by rejecting the .debug_names index:
27796         ...
27797         (gdb) file debug-names-duplicate-cu^M
27798         Reading symbols from debug-names-duplicate-cu...^M
27799         warning: Section .debug_names has duplicate entry in CU table, \
27800           ignoring .debug_names.^M
27801         ...
27802
27803         Likewise for the case where the CU table is not sorted by increasing offset.
27804
27805         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29436
27806
27807 2022-08-07  Tom de Vries  <tdevries@suse.de>
27808
27809         [gdb/testsuite] Add support for .debug_names in dwarf assembler
27810         Add:
27811         - support for a per-module .debug_names section in the dwarf assembler, and
27812         - a test-case excercising this new functionality.
27813
27814         A per-module .debug_names section needs to have an entry in the CU list for
27815         each CU in the module, which is made more difficult by two things:
27816         - linking in other objects, which may contain additional CUs
27817           (typically the case on openSUSE), and
27818         - adding dummy CUs in the dwarf assembler.
27819         We handle this by:
27820         - compiling with -nostartfiles (so the test-case contains _start rather than
27821           main), and
27822         - disabling the dummy CU generation for the test-case.
27823
27824         I've kept things simple by having the test-case specify the hash value, rather
27825         than adding that functionality in the dwarf assembler.
27826
27827         Also I've kept the bucket count to 1, which makes it trivial to satisfy the
27828         requirement that "the symbol is entered into a bucket whose index is the hash
27829         value modulo bucket_count".
27830
27831         The readelf dump of the .debug_names section from the test-case looks like:
27832         ...
27833         Version 5
27834         Augmentation string: 47 44 42 00  ("GDB")
27835         CU table:
27836         [  0] 0x0
27837
27838         TU table:
27839
27840         Foreign TU table:
27841
27842         Used 1 of 1 bucket.
27843         Out of 2 items there are 1 bucket clashes (longest of 1 entries).
27844
27845         Symbol table:
27846         [  0] #eddb6232 _start: <1> DW_TAG_subprogram DW_IDX_compile_unit=0
27847         [  1] #0b888030 int: <2> DW_TAG_base_type DW_IDX_compile_unit=0
27848         ...
27849
27850         Tested on x86_64-linux.
27851
27852 2022-08-07  GDB Administrator  <gdbadmin@sourceware.org>
27853
27854         Automatic date update in version.in
27855
27856 2022-08-06  Alan Modra  <amodra@gmail.com>
27857
27858         asan: heap buffer overflow in _bfd_error_handler
27859         On coff_slurp_symbol_table printing "unrecognized storage class"
27860         for a symbol error.  If the symbol name is the last string in its
27861         section and not terminated, we run off the end of the buffer.
27862
27863                 * coffgen.c (build_debug_section): Terminate the section with
27864                 an extra 0.
27865
27866 2022-08-06  Alan Modra  <amodra@gmail.com>
27867
27868         asan: segfault in coff_write_auxent_fname
27869         More fuzzed input file nonsense.
27870
27871                 * coffgen.c (coff_write_symbol): Don't call coff_write_auxent_fname
27872                 when extrap is NULL.
27873
27874 2022-08-06  Alan Modra  <amodra@gmail.com>
27875
27876         msan: bfd_mach_o_layout_commands use of uninitialised value
27877         Catches fuzzed input with unterminated strings that later run off the
27878         end of their buffers when calling strlen.
27879
27880                 * mach-o.c: Use size_t vars where approprite.
27881                 (bfd_mach_o_alloc_and_read): Add "extra" param.  Allocate that
27882                 much extra and clear.  Update all callers, those that set up
27883                 strings with one extra byte.
27884
27885 2022-08-06  Alan Modra  <amodra@gmail.com>
27886
27887         objcopy section alignment
27888         bfd_set_section_alignment currently always returns true.  This patch
27889         changes it to return false on silly alignment values, avoiding yet
27890         another way to trigger ubsan errors like coffcode.h:3192:12: runtime
27891         error: shift exponent 299 is too large for 32-bit type 'int'.  We'll
27892         catch that one in objcopy.c:setup_sections.  However, setup_sections
27893         gives up on other setup operations that are necessary even after an
27894         error of some sort.  Change that to keep going, which might change the
27895         error message but that shouldn't matter in the least.
27896
27897         bfd/
27898                 * section.c (bfd_set_section_alignment): Return false and
27899                 don't set alignment_power for stupidly large alignments.
27900                 * bfd-in2.h: Regenerate.
27901                 * coffcode.h (coff_compute_section_file_positions): Don't use
27902                 an int constant when calculating alignment.
27903         binutils/
27904                 * objcopy.c (setup_section): Keep on going after hitting
27905                 non-fatal errors.
27906
27907 2022-08-06  Alan Modra  <amodra@gmail.com>
27908
27909         ubsan: som.c undefined shift in som_set_reloc_info
27910         Do the shift using unsigned variables to avoid UB on << 8.
27911
27912                 * som.c (som_set_reloc_info): Make v unsigned.  Localise some
27913                 variables to their blocks.
27914
27915 2022-08-06  GDB Administrator  <gdbadmin@sourceware.org>
27916
27917         Automatic date update in version.in
27918
27919 2022-08-05  Alan Modra  <amodra@gmail.com>
27920
27921         Get rid of BFD_VMA_FMT
27922         Remove the BFD_VMA_FMT defines in bfd.h and configure support.
27923
27924                 * bfd-in.h (BFD_VMA_FMT): Don't define.
27925                 * configure.ac (BFD_INT64_FMT): Remove configure test.
27926                 * configure.com: Likewise.
27927                 * Makefile.in: Regenerate.
27928                 * bfd-in2.h: Regenerate.
27929                 * configure: Regenerate.
27930
27931 2022-08-05  Alan Modra  <amodra@gmail.com>
27932
27933         Don't use BFD_VMA_FMT in gdb and sim
27934         Like commit b82817674f, this replaces BFD_VMA_FMT "x" in sim/ with
27935         PRIx64 and casts to promote bfd_vma to uint64_t.  The one file using
27936         BFD_VMA_FMT in gdb/ instead now uses hex_string, and a typo in the
27937         warning message is fixed.
27938
27939 2022-08-05  Tom de Vries  <tdevries@suse.de>
27940
27941         [gdb/build] Fix build breaker in language.c with gcc 7.5.0
27942         When building gdb on openSUSE Leap 15.3, using gcc 7.5.0, I run into:
27943         ...
27944         gdb/language.c: In constructor ‘constexpr language_gdbarch::language_gdbarch()’:
27945         gdb/language.c:921:8: error: use of deleted function \
27946           ‘language_arch_info::language_arch_info(const language_arch_info&)’
27947          struct language_gdbarch
27948                 ^~~~~~~~~~~~~~~~
27949         In file included from gdbsupport/common-defs.h:104:0,
27950                          from gdb/defs.h:28,
27951                          from gdb/language.c:31:
27952         gdb/language.h:95:28: note: declared here
27953            DISABLE_COPY_AND_ASSIGN (language_arch_info);
27954                                     ^
27955         include/ansidecl.h:342:3: note: in definition of macro \
27956           ‘DISABLE_COPY_AND_ASSIGN’
27957            TYPE (const TYPE&) = delete;   \
27958            ^~~~
27959         gdb/language.c: In function ‘language_gdbarch* get_language_gdbarch(gdbarch*)’:
27960         gdb/language.c:936:22: note: synthesized method ‘constexpr \
27961           language_gdbarch::language_gdbarch()’ first required here
27962                l = new struct language_gdbarch;
27963                               ^~~~~~~~~~~~~~~~
27964         ...
27965
27966         This seems to be fixed by this change in the struct language_gdbarch
27967         definition:
27968         ...
27969         -  struct language_arch_info arch_info[nr_languages] {};
27970         +  struct language_arch_info arch_info[nr_languages];
27971         ...
27972
27973         Tested on x86_64-linux.
27974
27975 2022-08-05  Tom de Vries  <tdevries@suse.de>
27976
27977         [gdb] Add unit test for gdb::sequential_for_each
27978         With commit 18a5766d09c ("[gdbsupport] Add sequential_for_each") I added a
27979         drop-in replacement for gdb::parallel_for_each, but there's nothing making
27980         sure that the two remain in sync.
27981
27982         Extend the unit test for gdb::parallel_for_each to test both.
27983
27984         Do this using a slightly unusual file-self-inclusion.  Doing so keep things
27985         readable and maintainable, and avoids macrofying functions.
27986
27987         Tested on x86_64-linux.
27988
27989 2022-08-05  Tom de Vries  <tdevries@suse.de>
27990
27991         [gdb/symtab] Use task size in parallel_for_each in dwarf2_build_psymtabs_hard
27992         In dwarf2_build_psymtabs_hard, we use a parallel_for_each to distribute CUs
27993         over threads.
27994
27995         Ensuring a fair distribution over the worker threads and main thread in terms
27996         of number of CUs might not be the most efficient way, given that CUs can vary
27997         in size.
27998
27999         Fix this by using per_cu->get_length () as the task size.
28000
28001         I've used this experiment to verify the performance impact:
28002         ...
28003         $ for n in $(seq 1 10); do \
28004             time gdb -q -batch ~/firefox/libxul.so-93.0-1.1.x86_64.debug \
28005             2>&1 \
28006             | grep "real:"; \
28007           done
28008         ...
28009         and without the patch got:
28010         ...
28011         real: 4.71
28012         real: 4.88
28013         real: 4.29
28014         real: 4.30
28015         real: 4.65
28016         real: 4.27
28017         real: 4.27
28018         real: 4.27
28019         real: 4.75
28020         real: 4.41
28021         ...
28022         and with the patch:
28023         ...
28024         real: 3.68
28025         real: 3.81
28026         real: 3.80
28027         real: 3.68
28028         real: 3.75
28029         real: 3.69
28030         real: 3.69
28031         real: 3.74
28032         real: 3.67
28033         real: 3.74
28034         ...
28035         so that seems a reasonable improvement.
28036
28037         With parallel_for_each_debug set to true, we get some more detail about
28038         the difference in behaviour.  Without the patch we have:
28039         ...
28040         Parallel for: n_elements: 2818
28041         Parallel for: minimum elements per thread: 1
28042         Parallel for: elts_per_thread: 704
28043         Parallel for: elements on worker thread 0       : 705
28044         Parallel for: elements on worker thread 1       : 705
28045         Parallel for: elements on worker thread 2       : 704
28046         Parallel for: elements on worker thread 3       : 0
28047         Parallel for: elements on main thread           : 704
28048         ...
28049         and with the patch:
28050         ...
28051         Parallel for: n_elements: 2818
28052         Parallel for: total_size: 1483674865
28053         Parallel for: size_per_thread: 370918716
28054         Parallel for: elements on worker thread 0       : 752   (size: 371811790)
28055         Parallel for: elements on worker thread 1       : 360   (size: 371509370)
28056         Parallel for: elements on worker thread 2       : 1130  (size: 372681710)
28057         Parallel for: elements on worker thread 3       : 0     (size: 0)
28058         Parallel for: elements on main thread           : 576   (size: 367671995)
28059         ...
28060
28061         Tested on x86_64-linux.
28062
28063 2022-08-05  Tom de Vries  <tdevries@suse.de>
28064
28065         [gdbsupport] Add task size parameter in parallel_for_each
28066         Add a task_size parameter to parallel_for_each, defaulting to nullptr, and use
28067         the task size to distribute similarly-sized chunks to the threads.
28068
28069         Tested on x86_64-linux.
28070
28071 2022-08-05  Pedro Alves  <pedro@palves.net>
28072
28073         Introduce gdb::make_function_view
28074         This adds gdb::make_function_view, which lets you create a function
28075         view from a callable without specifying the function_view's template
28076         parameter.  For example, this:
28077
28078             auto lambda = [&] (int) { ... };
28079             auto fv = gdb::make_function_view (lambda);
28080
28081         instead of:
28082
28083             auto lambda = [&] (int) { ... };
28084             gdb::function_view<void (int)> fv = lambda;
28085
28086         It is particularly useful if you have a template function with an
28087         optional function_view parameter, whose type depends on the function's
28088         template parameters.  Like:
28089
28090             template<typename T>
28091             void my_function (T v, gdb::function_view<void(T)> callback = nullptr);
28092
28093         For such a function, the type of the callback argument you pass must
28094         already be a function_view.  I.e., this wouldn't compile:
28095
28096             auto lambda = [&] (int) { ... };
28097             my_function (1, lambda);
28098
28099         With gdb::make_function_view, you can write the call like so:
28100
28101             auto lambda = [&] (int) { ... };
28102             my_function (1, gdb::make_function_view (lambda));
28103
28104         Unit tests included.
28105
28106         Tested by building with GCC 9.4, Clang 10, and GCC 4.8.5, on x86_64
28107         GNU/Linux, and running the unit tests.
28108
28109         Change-Id: I5c4b3b4455ed6f0d8878cf1be189bea3ee63f626
28110
28111 2022-08-05  Nick Clifton  <nickc@redhat.com>
28112
28113         Update following 2.39 release
28114
28115 2022-08-05  Alan Modra  <amodra@gmail.com>
28116
28117         asan: ppc64_elf_get_synthetic_symtab heap buffer overflow
28118         Fuzzed input files with sizes of .dynamic not a multiple of dynamic
28119         tag size can result in reading past the end of the buffer with the
28120         current simple checks.  Fix that, and use the same check in other
28121         files that process input object .dynamic section.  (There is no need
28122         for buffer overflow checks in the linker's generated .dynamic
28123         section.)
28124
28125                 * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Sanity check
28126                 .dynamic content buffer reads.
28127                 * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.
28128                 * elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Likewise.
28129                 * elf.c (_bfd_elf_print_private_bfd_data): Simplify .dynamic
28130                 buffer sanity checks.
28131                 * elflink.c (elf_link_add_object_symbols): Avoid possible UB
28132                 subtracting sizeof_dyn from pointer.
28133
28134 2022-08-05  Alan Modra  <amodra@gmail.com>
28135
28136         Sanity check loc_offsets index
28137         Fixes a segfault found by the fuzzers.
28138
28139                 * dwarf.c (fetch_indexed_value): Return -1 on error.
28140                 (read_and_display_attr_value): Don't display string when
28141                 fetch_indexed_value returns an error.  Sanity check loc_offsets
28142                 index.
28143
28144 2022-08-05  Jan Beulich  <jbeulich@suse.com>
28145
28146         binutils/Dwarf: avoid "shadowing" of glibc function name
28147         As before: Old enough glibc has an (unguarded) declaration of index()
28148         in string.h, which triggers a "shadows a global declaration" warning.
28149
28150 2022-08-05  Tsukasa OI  <research_trasio@irq.a4lg.com>
28151
28152         gas: fix a testcase broken by new ZSTD support
28153         The commit 1369522f36eece1b37139a81f7f2139ba3915172 ("Recognize the new ELF
28154         compression type for ZSTD.") added the new ELF compression type but it
28155         accidentally broke a GAS testcase.  Since testing for the section type
28156         "2048" (SHF_COMPRESSED) is not going to be portable in the long term, it
28157         now tests SHF_LINK_ORDER ("128") instead.
28158
28159         Using SHF_LINK_ORDER (with possibly sh_link == 0) is an idea by Jan Beulich.
28160
28161         gas/ChangeLog:
28162
28163                 * testsuite/gas/elf/section10.s: Use SHF_LINK_ORDER to test
28164                 mixed numeric and alpha values.
28165                 * testsuite/gas/elf/section10.d: Reflect the change above.
28166
28167 2022-08-05  Nick Clifton  <nickc@redhat.com>
28168
28169         When gas/read.c calls mbstowcs with a NULL destination, it should set size to 0
28170                 PR 29447
28171                 * read.c (read_symbol_name): Pass 0 as the length parameter when
28172                 invoking mbstowc in order to check the validity of a wide string.
28173
28174 2022-08-05  Tom de Vries  <tdevries@suse.de>
28175
28176         [gdb] Add debug_{exp,val}
28177         When debugging cc1 I heavily rely on simple one-parameter debug functions
28178         that allow me to inspect a variable of a common type, like:
28179         - debug_generic_expr
28180         - debug_gimple_stmt
28181         - debug_rtx
28182         and I miss similar functions in gdb.
28183
28184         Add functions to dump variables of types 'value' and 'expression':
28185         - debug_exp, and
28186         - debug_val.
28187
28188         Tested on x86_64-linux, by breaking on varobj_create, and doing:
28189         ...
28190         (gdb) call debug_exp (var->root->exp.get ())
28191         &"Operation: OP_VAR_VALUE\n"
28192         &" Block symbol:\n"
28193         &"  Symbol: aaa\n"
28194         &"  Block: 0x2d064f0\n"
28195         (gdb)
28196         ...
28197         and:
28198         ...
28199         (gdb) call debug_val (value)
28200         &"5"
28201         (gdb)
28202         ...
28203
28204 2022-08-05  Luca Boccassi  <bluca@debian.org>
28205
28206         Add gold support for --package-metadata option.
28207         Following the same format as the implementation in ld:
28208         9e2bb0cb5e74aed4158f08495534922d7108f928
28209
28210         Generate a .note.package FDO package metadata ELF note, following
28211         the spec: https://systemd.io/ELF_PACKAGE_METADATA/
28212
28213         If the jansson library is available at build time (and it is explicitly
28214         enabled), link ld to it, and use it to validate that the input is
28215         correct JSON, to avoid writing garbage to the file. The
28216         configure option --enable-jansson has to be used to explicitly enable
28217         it (error out when not found). This allows bootstrappers (or others who
28218         are not interested) to seamlessly skip it without issues.
28219
28220         elfcpp/
28221                 * elfcpp.h: Add FDO_PACKAGING_METADATA note type.
28222
28223         gold/
28224                 * Makefile.am: Add jansson flags and libraries.
28225                 * configure.ac: Check for jansson library.
28226                 * layout.cc (Layout::create_notes): Call create_package_metadata().
28227                 (Layout::create_package_metadata): New function.
28228                 * layout.h (Layout::create_package_metadata): New function.
28229                 (Layout::package_metadata_note_): New data member.
28230                 * options.h (class General_options): Add --package-metadata option.
28231                 * testsuite/Makefile.am (object_unittest): Add jansson libraries.
28232                 (binary_unittest): Likewise.
28233                 (leb128_unittest): Likewise.
28234                 (overflow_unittest): Likewise.
28235                 (package_metadata_test): New test.
28236                 * testsuite/package_metadata_main.c: New test source.
28237
28238 2022-08-05  Cary Coutant  <ccoutant@gmail.com>
28239
28240         Recognize the new ELF compression type for ZSTD.
28241         There is more work to be done to actually support compression and
28242         decompression using the zstd library, but I will leave that to the
28243         champions of the new compression option.
28244
28245         binutils/
28246                 * binutils/readelf.c (process_section_headers): Add support for
28247                 ELFCOMPRESS_ZSTD.
28248
28249 2022-08-05  GDB Administrator  <gdbadmin@sourceware.org>
28250
28251         Automatic date update in version.in
28252
28253 2022-08-04  Tom Tromey  <tom@tromey.com>
28254
28255         Use registry in gdbarch
28256         gdbarch implements its own registry-like approach.  This patch changes
28257         it to instead use registry.h.  It's a rather large patch but largely
28258         uninteresting -- it's mostly a straightforward conversion from the old
28259         approach to the new one.
28260
28261         The main benefit of this change is that it introduces type safety to
28262         the gdbarch registry.  It also removes a bunch of code.
28263
28264         One possible drawback is that, previously, the gdbarch registry
28265         differentiated between pre- and post-initialization setup.  This
28266         doesn't seem very important to me, though.
28267
28268 2022-08-04  Tom Tromey  <tom@tromey.com>
28269
28270         Allow registry to refer to const types
28271         So far, the registry hasn't been used to refer to a 'const' type, but
28272         this changes with the gdbarch change.  This patch arranges to let the
28273         registry store a pointer-to-const, by removing const in the 'set'
28274         method.
28275
28276         Use new and delete for gdbarch
28277         This changes gdbarch to use new and delete.
28278
28279         Use bool in gdbarch
28280         This changes gdbarch to use bool for initialized_p.
28281
28282 2022-08-04  Tom de Vries  <tdevries@suse.de>
28283
28284         [gdb/testsuite] Fix .debug_aranges in gdb.dwarf2/fission-loclists.S
28285         When running test-case gdb.dwarf2/fission-loclists.exp, I noticed:
28286         ...
28287         warning: Section .debug_aranges in fission-loclists has duplicate \
28288           debug_info_offset 0x8f, ignoring .debug_aranges.^M
28289         ...
28290
28291         Fix this by removing the duplicate .debug_aranges entry.
28292
28293         Tested on x86_64-linux.
28294
28295 2022-08-04  Tom de Vries  <tdevries@suse.de>
28296
28297         [gdb/testsuite] Fix ERROR in gdb.base/watchpoint-unaligned.exp
28298         In PR23888 an error is reported:
28299         ...
28300         ERROR: tcl error sourcing watchpoint-unaligned.exp.
28301         ERROR: expected boolean value but got ""
28302             while executing
28303         "if {$wpnum} {
28304         ...
28305
28306         This presumably happens when:
28307         - skip_hw_watchpoint_tests returns 0 meaning hw watchpoints are supported
28308         - gdb fails to set a hw watchpoint and instead sets a sw watchpoint
28309
28310         That particular situation is handled for arm:
28311         ...
28312             -re "Watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
28313                 if {[istarget "arm*-*-*"]} {
28314                     untested $test
28315                     set wpnum 0
28316                 }
28317             }
28318         ...
28319         but not for any other targets so wpnum remains "", triggering the ERROR.
28320
28321         Possibly this has been fixed for powerpc by commit 8d4e4d13afb ("gdb Power 9
28322         add test for HW watchpoint support."), but it's still possible for other
28323         targets.
28324
28325         Fix this by:
28326         - initializing wpnum to 0 instead of ""
28327         - signalling the failure to set a hw watchpoint by a fail
28328
28329         Tested on x86_64-linux, also by adding:
28330         ...
28331         gdb_test_no_output "set can-use-hw-watchpoints 0"
28332         ...
28333         and verifying that it triggers the fail.
28334
28335         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23888
28336
28337 2022-08-04  Tom de Vries  <tdevries@suse.de>
28338
28339         [gdb/tdep] Fix gdb.base/large-frame.exp for aarch64
28340         On aarch64, I run into:
28341         ...
28342         FAIL: gdb.base/large-frame.exp: optimize=-O0: backtrace
28343         ...
28344
28345         The problem is that the architecture-specific prologue analyzer fails to
28346         handle the first two insns in the prologue properly:
28347         ...
28348         0000000000400610 <func>:
28349           400610:       d2880210        mov     x16, #0x4010
28350           400614:       cb3063ff        sub     sp, sp, x16
28351           400618:       a9007bfd        stp     x29, x30, [sp]
28352           40061c:       910003fd        mov     x29, sp
28353           400620:       910043a0        add     x0, x29, #0x10
28354           400624:       97fffff0        bl      4005e4 <blah>
28355         ...
28356         so we get:
28357         ...
28358         $ gdb -q -batch ./outputs/gdb.base/large-frame/large-frame-O0 -ex "b func"
28359         Breakpoint 1 at 0x400614
28360         ...
28361
28362         Fix this by:
28363         - fixing the support for the first insn to extract the immediate operand, and
28364         - adding support for the second insn,
28365         such that we have:
28366         ...
28367         Breakpoint 1 at 0x400624
28368         ...
28369         Note that we're overshooting by one insn (0x400620 is the first insn after the
28370         prologue), but that's a pre-existing problem.
28371
28372         Tested on aarch64-linux.
28373
28374         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29408
28375
28376 2022-08-04  Alan Modra  <amodra@gmail.com>
28377
28378         Don't use BFD_VMA_FMT in binutils
28379         BFD_VMA_FMT can't be used in format strings that need to be
28380         translated, because the translation won't work when the type of
28381         bfd_vma differs from the machine used to compile .pot files.  We've
28382         known about this for a long time, but patches slip through review.
28383
28384         So just get rid of BFD_VMA_FMT, instead using the appropriate PRId64,
28385         PRIu64, PRIx64 or PRIo64 and SCN variants for scanf.  The patch is
28386         mostly mechanical, the only thing requiring any thought is casts
28387         needed to preserve PRId64 output from bfd_vma values, or to preserve
28388         one of the unsigned output formats from bfd_signed_vma values.
28389
28390 2022-08-04  Alan Modra  <amodra@gmail.com>
28391
28392         Re: Get rid of fprintf_vma and sprintf_vma
28393         Commit f493c2174e messed the formatting in linker map files,
28394         particularly for 32-bit builds where a number of tests using map files
28395         regressed.  I should have noticed the BFD64 conditional printing of
28396         spaces to line up output due to the original %V printing hex vmas with
28397         16 digits when BFD64 and 8 digits when not.  Besides that, it is nicer
28398         to print 32-bit vmas for 32-bit targets.  So change %V back to be
28399         target dependent, now using bfd_sprintf_vma.  Since minfo doesn't
28400         return the number of chars printed, that means some places that
28401         currently use %V must instead sprintf to a buffer in order to find the
28402         length printed.
28403
28404                 * ldmisc.h (print_spaces): Declare.
28405                 (print_space): Change to a macro.
28406                 * ldmisc.c (vfinfo): Use bfd_sprintf_vma for %V.  Tidy %W case.
28407                 (print_space): Delete.
28408                 (print_spaces): New function.
28409                 * emultempl/aix.em (print_symbol): Use print_spaces.
28410                 * ldctor.c (ldctor_build_sets): Likewise.
28411                 * ldmain.c (add_archive_element): Likewise.
28412                 * ldlang.c (print_one_symbol, lang_print_asneeded): Likewise.
28413                 (print_output_section_statement, print_data_statement): Likewise.
28414                 (print_reloc_statement, print_padding_statement): Likewise.
28415                 (print_assignment): Likewise.  Also replace %V printing of vmas
28416                 with printing to a buffer in order to properly format output.
28417                 (print_input_section, lang_one_common): Likewise.
28418
28419 2022-08-04  Alan Modra  <amodra@gmail.com>
28420
28421         MIPS: Use R_MIPS_REL16 for BFD_RELOC_16
28422         R_MIPS_REL16 isn't a pc-relative reloc as the name might indicate.
28423
28424                 * elf64-mips.c (mips_reloc_map): Map BFD_RELOC_16 to R_MIPS_REL16.
28425                 * elfn32-mips.c (mips_reloc_map): Likewise.
28426
28427 2022-08-04  GDB Administrator  <gdbadmin@sourceware.org>
28428
28429         Automatic date update in version.in
28430
28431 2022-08-03  H.J. Lu  <hjl.tools@gmail.com>
28432
28433         elf: Reset alignment for each PT_LOAD segment
28434         Reset alignment for each PT_LOAD segment to avoid using alignment from
28435         the previous PT_LOAD segment.
28436
28437         bfd/
28438
28439                 PR ld/29435
28440                 * elf.c (assign_file_positions_for_load_sections): Reset
28441                 alignment for each PT_LOAD segment.
28442
28443         ld/
28444
28445                 PR ld/29435
28446                 * testsuite/ld-elf/pr29435.d: New file.
28447                 * testsuite/ld-elf/pr29435.s: Likewise.
28448
28449 2022-08-03  Tom Tromey  <tom@tromey.com>
28450
28451         Use unique_ptr to destroy per-bfd object
28452         In some cases, the objfile owns the per-bfd object.  This is yet
28453         another object that can sometimes be destroyed before the registry is
28454         destroyed, possibly reslting in a use-after-free.  Also, I noticed
28455         that the condition for deleting the object is not the same as the
28456         condition used to create it -- so it could possibly result in a memory
28457         leak in some situations.  This patch fixes the problem by introducing
28458         a new unique_ptr that holds this object when necessary.
28459
28460         Use auto_obstack in objfile
28461         This changes objfile to use an auto_obstack.  This helps prevent
28462         use-after-free bugs, because it ensures that anything allocated on the
28463         objfile obstack will live past the point at which the registry object
28464         is destroyed.
28465
28466         Use gdb_bfd_ref_ptr in objfile
28467         This changes struct objfile to use a gdb_bfd_ref_ptr.  In addition to
28468         removing some manual memory management, this fixes a use-after-free
28469         that was introduced by the registry rewrite series.  The issue there
28470         was that, in some cases, registry shutdown could refer to memory that
28471         had already been freed.  This help fix the bug by delaying the
28472         destruction of the BFD reference (and thus the per-bfd object) until
28473         after the registry has been shut down.
28474
28475 2022-08-03  Ruud van der Pas  <ruud.vanderpas@oracle.com>
28476
28477         gprofng: fix bug 29410 - Argument "&nbsp;0." isn't numeric in numeric gt (>)
28478         gprofng/Changelog:
28479         2022-08-02  Ruud van der Pas  <ruud.vanderpas@oracle.com>
28480
28481                 PR gprofng/29410
28482                 * gp-display-html/gp-display-html.in: Remove non-breaking spaces.
28483
28484 2022-08-03  Alan Modra  <amodra@gmail.com>
28485
28486         Fix a conflict between the linker's need to rename some PE format input libraries and the BFD library's file caching mechanism.
28487                 PR 29389
28488         bfd     * bfd.c (BFD_CLOSED_BY_CACHE): New bfd flag.
28489                 * cache.c (bfd_cache_delete): Set BFD_CLOSED_BY_DELETE on the
28490                 closed bfd.
28491                 (bfd_cache_lookup_worker): Clear BFD_CLOSED_BY_DELETE on the newly
28492                 reopened bfd.
28493                 * opncls.c (bfd_set_filename): Refuse to change the name of a bfd
28494                 that has been closed by bfd_cache_delete.  Mark changed bfds as
28495                 uncacheable.
28496                 * bfd-in2.h: Regenerate.
28497
28498         ld      * ldlang.h (lang_input_statement_struct): Add sort_key field.
28499                 * emultempl/pe.em (after_open): If multiple import libraries refer
28500                 to the same bfd, store their names in the sort_key field.
28501                 * emultempl/pep.em (after_open): Likewise.
28502                 * ldlang.c (sort_filename): New function.  Returns the filename to
28503                 be used when sorting input files.
28504                 (wild_sort): Use the sort_filename function.
28505
28506 2022-08-03  Enze Li  <enze.li@hotmail.com>
28507
28508         gdb/amd64: clean up unused variable
28509         When building with clang 15, I got this,
28510
28511           CXX    amd64-tdep.o
28512         amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-Werror,-Wunused-but-set-variable]
28513             gdb_byte *insn = insn_details->raw_insn + modrm_offset;
28514                         ^
28515         1 error generated.
28516
28517         The function that uses this variable has been removed in this commit,
28518
28519         commit 870f88f7551b0f2d6aaaa36fb684b5ff8f468107
28520         Date:   Mon Apr 18 13:16:27 2016 -0400
28521
28522             remove trivialy unused variables
28523
28524         Fix this by removing unused variable.
28525
28526         Tested by rebuilding on x86_64-linux with clang 15 and gcc 12.
28527
28528 2022-08-03  Lancelot SIX  <lancelot.six@amd.com>
28529
28530         gdb: Fix regression in varobj recreation
28531         Commit bc20e562ec0 "Fix use after free in varobj" introduced a
28532         regression.  This commit makes sure that the varobj object does not
28533         keeps stale references to object being freed when we unload an objfile.
28534         This includes the "valid_block" field which is reset to nullptr if the
28535         pointed to block is tied to an objfile being freed.
28536
28537         However, at some point varobj_invalidate_iter might try to recreate
28538         varobjs tracking either floating or globals.  Varobj tracking globals
28539         are identified as having the "valid_block" field set nullptr, but as
28540         bc20e562ec0 might clear this field, we have lost the ability to
28541         distinguish between varobj referring to globals and non globals.
28542
28543         Fix this by introducing a "global" flag which tracks if a given varobj
28544         was initially created as tracking a global.
28545
28546         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29426
28547
28548 2022-08-03  Alan Modra  <amodra@gmail.com>
28549
28550         Re: PE objdump -x
28551         All of these buffer overrun tests are better written as a comparison
28552         against size remaining, due to ISO C 9899 standard 6.5.2 para 8
28553         regarding adding a constant to a pointer:
28554
28555         "If both the pointer operand and the result point to elements of the
28556         same array object, or one past the last element of the array object,
28557         the evaluation shall not produce an overflow; otherwise, the behavior
28558         is undefined."
28559
28560         So "ex_dta + 4" might be undefined behaviour, if you interpret "the
28561         array object" in this case to be the malloc'd section contents!
28562
28563                 * pei-x86_64.c (pex64_get_unwind_info): Tidy sanity checks.
28564                 (pex64_xdata_print_uwd_codes): Likewise.
28565
28566 2022-08-03  Jan Beulich  <jbeulich@suse.com>
28567
28568         x86: improve/shorten vector zeroing-idiom optimization conditional
28569         - Drop the rounding type check: We're past template matching, and none
28570           of the involved insns support embedded rounding.
28571         - Drop the extension opcode check: None of the involved opcodes have
28572           variants with it being other than None.
28573         - Instead check opcode space, even if just to be on the safe side going
28574           forward.
28575         - Reduce the number of comparisons by folding two groups.
28576
28577         x86: properly mark i386-only insns
28578         Just like all Size64 insns are marked Cpu64, all Size32 insns ought to
28579         be marked Cpu386.
28580
28581         x86: also use D for MOVBE
28582         First of all rename the meanwhile misleading Opcode_SIMD_FloatD, as it
28583         has also been used for KMOV* and BNDMOV. Then simplify the condition
28584         selecting which form if "reversing" to use - except for the MOV to/from
28585         control/debug/test registers all extended opcode space insns use bit 0
28586         (rather than bit 1) to indicate the direction (from/to memory) of an
28587         operation. With that, D can simply be set on the first of the two
28588         templates, while the other can be dropped.
28589
28590 2022-08-03  GDB Administrator  <gdbadmin@sourceware.org>
28591
28592         Automatic date update in version.in
28593
28594 2022-08-03  Cary Coutant  <ccoutant@gmail.com>
28595
28596         Add ELFCOMPRESS_ZSTD.
28597         include/elf/
28598                 * common.h: Add ELFCOMPRESS_ZSTD.
28599
28600 2022-08-02  John Baldwin  <jhb@FreeBSD.org>
28601
28602         fbsd-nat: Correct the return type of the have_regset method.
28603         During the development of 40c23d880386d6e8202567eaa2a6b041feb1a652,
28604         the return value of fbsd_nat_target::have_regset was changed from a
28605         simple boolean to returning the size of the register set.  The
28606         comments and callers were all updated for this change, but the actual
28607         return type was accidentally left as a bool.  This change fixes the
28608         return type to be a size_t.
28609
28610         Current callers of this only checked the value against 0 and thus
28611         still worked correctly.
28612
28613 2022-08-02  Jan Beulich  <jbeulich@suse.com>
28614
28615         ELF: emit symbol table when there are relocations
28616         Even when there are no symbols (e.g. all relocations being against
28617         absolute values), a symbol table (with just the first placeholder entry)
28618         needs to be emitted. Otherwise tools like objdump won't properly process
28619         the relocations. The respective checks in assign_section_numbers() and
28620         _bfd_elf_compute_section_file_positions() support also this view. Oddly
28621         enough so far HAS_RELOC was only set when reading in an object file, but
28622         not when generating one anew; the flag would only have been cleared when
28623         no relocations were found (anymore).
28624
28625         While there also amend the affected function's leading comment to also
28626         mention gas.
28627
28628 2022-08-02  Matthew Malcomson  <hardenedapple@gmail.com>
28629
28630         ld: aarch64: Adjust TLS relaxation condition
28631         In aarch64_tls_transition_without_check and elfNN_aarch64_tls_relax we
28632         choose whether to perform a relaxation to an IE access model or an LE
28633         access model based on whether the symbol itself is marked as local (i.e.
28634         `h == NULL`).
28635
28636         This is problematic in two ways.  The first is that sometimes a global
28637         dynamic access can be relaxed to an initial exec access when creating a
28638         shared library, and if that happens on a local symbol then we currently
28639         relax it to a local exec access instead.  This usually does not happen
28640         since we only relax an access if aarch64_can_relax_tls returns true and
28641         aarch64_can_relax_tls does not have the same problem.  However, it can
28642         happen when we have seen both an IE and GD access on the same symbol.
28643         This case is exercised in the newly added testcase tls-relax-gd-ie-2.
28644
28645         The second problem is that deciding based on whether the symbol is local
28646         misses the case when the symbol is global but is still non-interposable
28647         and known to be located in the executable.  This happens on all global
28648         symbols in executables.
28649         This case is exercised in the newly added testcase tls-relax-ie-le-4.
28650
28651         Here we adjust the condition we base our relaxation on so that we relax
28652         to local-exec if we are creating an executable and the relevant symbol
28653         we're accessing is stored inside that executable.
28654
28655         -- Updating tests for new relaxation criteria
28656
28657         Many of the tests added to check our relaxation to IE were implemented
28658         by taking advantage of the fact that we did not relax a global symbol
28659         defined in an executable.
28660
28661         Since a global symbol defined in an executable is still not
28662         interposable, we know that a TLS version of such a symbol will be in the
28663         main TLS block.  This means that we can perform a stronger relaxation on
28664         such symbols and relax their accesses to a local-exec access.
28665
28666         Hence we have to update all tests that relied on the older suboptimal
28667         decision making.
28668
28669         The two cases when we still would want to relax a general dynamic access
28670         to an initial exec one are:
28671         1) When in a shared library and accessing a symbol which we have already
28672            seen accessed with an initial exec access sequence.
28673         2) When in an executable and accessing a symbol defined in a shared
28674            library.
28675
28676         Both of these require shared library support, which means that these
28677         tests are now only available on targets with that.
28678
28679         I have chosen to switch the existing testcases from a plain executable
28680         to one dynamically linked to a shared object as that doesn't require
28681         changing the testcases quite so much (just requires accessing a
28682         different variable rather than requiring adding another code sequence).
28683
28684         The tls-relax-all testcase was an outlier to the above approach, since
28685         it included a general dynamic access to both a local and global symbol
28686         and inspected for the difference accordingly.
28687
28688 2022-08-02  Matthew Malcomson  <hardenedapple@gmail.com>
28689
28690         ld: aarch64: Update test linker scripts relocs.ld and relocs-ilp32.ld
28691         The updates are to ensure that the .data section exists.  This means
28692         that we always have a data section.  That means that we don't create a
28693         RWX segment and avoid the corresponding warning.
28694
28695         We get this warning when testing aarch64-none-elf with -mcmodel=tiny.
28696         N.b. this changes quite a few testcases from fail to pass.
28697
28698 2022-08-02  Victor Do Nascimento  <Victor.DoNascimento@arm.com>
28699
28700         arm: Add cfi expression support for ra_auth_code
28701         This patch extends assembler support for the use of register names to
28702         allow for pseudo-registers, e.g. ra_auth_code register.
28703         This is done particularly with CFI directives in mind, allowing for
28704         expressions of the type:
28705
28706             .cfi_register ra_auth_code, 12
28707
28708         gas/Changelog:
28709
28710                 * config/tc-arm.c (tc_arm_regname_to_dw2regnum): Add
28711                 REG_TYPE_PSEUDO handling.
28712                 * testsuite/gas/arm/cfi-pacbti-m-readelf.d: New.
28713                 * testsuite/gas/arm/cfi-pacbti-m.s: New.
28714
28715 2022-08-02  Victor Do Nascimento  <Victor.DoNascimento@arm.com>
28716
28717         arm: Use DWARF numbering convention for pseudo-register representation
28718         This patch modifies the internal `struct reg_entry' numbering of DWARF
28719         pseudo-registers to match values assigned in DWARF standards (see "4.1
28720         DWARF register names" in [1])so ra_auth_code goes from 12 to 143 and
28721         amends the unwinder .save directive-processing code to correctly handle
28722         mixed register-type save directives.
28723
28724         The mechanism for splitting the register list is also re-written to
28725         comply with register ordering on push statements, being that registers
28726         are stored on the stack in numerical order, with the lowest numbered
28727         register at the lowest address [2].
28728
28729         Consequently, the parsing of the hypothetical directive
28730
28731                 .save{r4-r7, r10, ra_auth_core, lr}
28732
28733         has been changed such as rather than producing
28734
28735                 .save{r4-r7, r10}
28736                 .save{ra_auth_code}
28737                 .save{lr}
28738
28739         as was the case with previous implementation, now produces:
28740
28741                 .save{lr}
28742                 .save{ra_auth_code}
28743                 .save{r4-r7, r10}
28744
28745         [1] <https://github.com/ARM-software/abi-aa/blob/main/aadwarf32/aadwarf32.rst>
28746         [2] <https://developer.arm.com/documentation/dui0473/j/arm-and-thumb-instructions/push>
28747
28748         gas/Changelog:
28749
28750                 * config/tc-arm.c (REG_RA_AUTH_CODE): New.
28751                 (parse_dot_save): Likewise.
28752                 (parse_reg_list): Remove obsolete code.
28753                 (reg_names): Set ra_auth_code to 143.
28754                 (s_arm_unwind_save): Handle core and pseudo-register lists via
28755                 parse_dot_save.
28756                 (s_arm_unwind_save_mixed): Deleted.
28757                 (s_arm_unwind_save_pseudo): Handle one register at a time.
28758                 * testsuite/gas/arm/unwind-pacbti-m-readelf.d: Fix test.
28759                 * testsuite/gas/arm/unwind-pacbti-m.d: Likewise.
28760
28761 2022-08-02  Alan Modra  <amodra@gmail.com>
28762
28763         PE objdump -x
28764         objdump -x on PE executables produces lots of "xdata section corrupt"
28765         and "corrupt unwind data" warnings, and refuses to dump that info.  It
28766         turns out that the sanity checks were bad, not the data.  Fix them.
28767
28768                 * pei-x86_64.c (pex64_get_unwind_info): Correct buffer overrun
28769                 sanity checks.
28770                 (pex64_xdata_print_uwd_codes): Similarly.
28771
28772 2022-08-02  Jan Beulich  <jbeulich@suse.com>
28773
28774         x86: XOP shift insns don't really allow B suffix
28775         By mistake it was permitted to be used from the very introduction of XOP
28776         support.
28777
28778 2022-08-02  GDB Administrator  <gdbadmin@sourceware.org>
28779
28780         Automatic date update in version.in
28781
28782 2022-08-01  Martin Storsjö  <martin@martin.st>
28783
28784         ld: Support the -exclude-symbols option via COFF def files, with the EXCLUDE_SYMBOLS keyword
28785         This was requested in review.
28786
28787         ld: Add support for a new option, -exclude-symbols, in COFF object file directives
28788         This maps to the same as ld's --exclude-symbols command line option,
28789         but allowing specifying the option via directives embedded in the
28790         object files instead of passed manually on the command line.
28791
28792 2022-08-01  Tom de Vries  <tdevries@suse.de>
28793
28794         [gdb/symtab] Fix .debug_aranges duplicate offset warning
28795         The function read_addrmap_from_aranges contains code to issue a warning:
28796         ...
28797               if (!insertpair.second)
28798                {
28799                  warning (_("Section .debug_aranges in %s has duplicate "
28800                             "debug_info_offset %s, ignoring .debug_aranges."),
28801                           objfile_name (objfile), sect_offset_str (per_cu->sect_off));
28802                  return false;
28803                }
28804         ...
28805         but the warning is in fact activated when all_comp_units has duplicate
28806         entries, which is very misleading.
28807
28808         Fix this by:
28809         - adding a test-case that should trigger the warning,
28810         - replacing the current implementation of the warning with an
28811           assert that all_comp_units should not contain duplicates, and
28812         - properly re-implementing the warning, such that it is triggered
28813           by the test-case.
28814
28815         Tested on x86_64-linux.
28816
28817         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29381
28818
28819 2022-08-01  Jan Beulich  <jbeulich@suse.com>
28820
28821         x86: SKINIT with operand needs IgnoreSize
28822         Without it in 16-bit mode a pointless operand size prefix would be
28823         emitted.
28824
28825 2022-08-01  WANG Xuerui  <git@xen0n.name>
28826
28827         opcodes: LoongArch: add "ret" instruction to reduce typing
28828         This syntactic sugar is present in both classical and emerging
28829         architectures, like Alpha, SPARC and RISC-V, and assembler macros
28830         doing the same thing can already be found in the wild e.g. [1], proving
28831         the feature's popularity. It's better to provide support directly in the
28832         assembler so downstream users wouldn't have to re-invent this over and
28833         over again.
28834
28835         [1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/loongarch/sysdep.h;h=c586df819cd90;hb=HEAD#l28
28836
28837 2022-08-01  WANG Xuerui  <git@xen0n.name>
28838
28839         opcodes: LoongArch: make all non-native jumps desugar to canonical b{lt/ge}[u] forms
28840         Also re-order the jump/branch opcodes while at it, so that insns are
28841         sorted in ascending order according to opcodes, and the label form
28842         preceding the real definition.
28843
28844 2022-08-01  Alan Modra  <amodra@gmail.com>
28845
28846         Get rid of fprintf_vma and sprintf_vma
28847         These two macros print either a 16 digit hex number or an 8 digit
28848         hex number.  Unfortunately they depend on both target and host, which
28849         means that the output for 32-bit targets may be either 8 or 16 hex
28850         digits.
28851
28852         Replace them in most cases with code that prints a bfd_vma using
28853         PRIx64.  In some cases, deliberately lose the leading zeros.
28854         This change some output, notably in base/offset fields of m68k
28855         disassembly which I think looks better that way, and in error
28856         messages.  I've kept leading zeros in symbol dumps (objdump -t)
28857         and in PE header dumps.
28858
28859         bfd/
28860                 * bfd-in.h (fprintf_vma, sprintf_vma, printf_vma): Delete.
28861                 * bfd-in2.h: Regenerate.
28862                 * bfd.c (bfd_sprintf_vma): Don't use sprintf_vma.
28863                 (bfd_fprintf_vma): Don't use fprintf_vma.
28864                 * coff-rs6000.c (xcoff_reloc_type_tls): Don't use sprintf_vma.
28865                 Instead use PRIx64 to print bfd_vma values.
28866                 (xcoff_ppc_relocate_section): Likewise.
28867                 * cofflink.c (_bfd_coff_write_global_sym): Likewise.
28868                 * mmo.c (mmo_write_symbols_and_terminator): Likewise.
28869                 * srec.c (srec_write_symbols): Likewise.
28870                 * elf32-xtensa.c (print_r_reloc): Similarly for fprintf_vma.
28871                 * pei-x86_64.c (pex64_dump_xdata): Likewise.
28872                 (pex64_bfd_print_pdata_section): Likewise.
28873                 * som.c (som_print_symbol): Likewise.
28874                 * ecoff.c (_bfd_ecoff_print_symbol): Use bfd_fprintf_vma.
28875         opcodes/
28876                 * dis-buf.c (perror_memory, generic_print_address): Don't use
28877                 sprintf_vma.  Instead use PRIx64 to print bfd_vma values.
28878                 * i386-dis.c (print_operand_value, print_displacement): Likewise.
28879                 * m68k-dis.c (print_base, print_indexed): Likewise.
28880                 * ns32k-dis.c (print_insn_arg): Likewise.
28881                 * ia64-gen.c (_opcode_int64_low, _opcode_int64_high): Delete.
28882                 (opcode_fprintf_vma): Delete.
28883                 (print_main_table): Use PRIx64 to print opcode.
28884         binutils/
28885                 * od-macho.c: Replace all uses of printf_vma with bfd_printf_vma.
28886                 * objcopy.c (copy_object): Don't use sprintf_vma.  Instead use
28887                 PRIx64 to print bfd_vma values.
28888                 (copy_main): Likewise.
28889                 * readelf.c (CHECK_ENTSIZE_VALUES): Likewise.
28890                 (dynamic_section_mips_val): Likewise.
28891                 (print_vma): Don't use printf_vma.  Instead use PRIx64 to print
28892                 bfd_vma values.
28893                 (dump_ia64_vms_dynamic_fixups): Likewise.
28894                 (process_version_sections): Likewise.
28895                 * rddbg.c (stab_context): Likewise.
28896         gas/
28897                 * config/tc-i386.c (offset_in_range): Don't use sprintf_vma.
28898                 Instead use PRIx64 to print bfd_vma values.
28899                 (md_assemble): Likewise.
28900                 * config/tc-mips.c (load_register, macro): Likewise.
28901                 * messages.c (as_internal_value_out_of_range): Likewise.
28902                 * read.c (emit_expr_with_reloc): Likewise.
28903                 * config/tc-ia64.c (note_register_values): Don't use fprintf_vma.
28904                 Instead use PRIx64 to print bfd_vma values.
28905                 (print_dependency): Likewise.
28906                 * listing.c (list_symbol_table): Use bfd_sprintf_vma.
28907                 * symbols.c (print_symbol_value_1): Use %p to print pointers.
28908                 (print_binary): Likewise.
28909                 (print_expr_1): Use PRIx64 to print bfd_vma values.
28910                 * write.c (print_fixup): Use %p to print pointers.  Don't use
28911                 fprintf_vma.
28912                 * testsuite/gas/all/overflow.l: Update expected output.
28913                 * testsuite/gas/m68k/mcf-mov3q.d: Likewise.
28914                 * testsuite/gas/m68k/operands.d: Likewise.
28915                 * testsuite/gas/s12z/truncated.d: Likewise.
28916         ld/
28917                 * deffilep.y (def_file_print): Don't use fprintf_vma.  Instead
28918                 use PRIx64 to print bfd_vma values.
28919                 * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Don't use
28920                 sprintf_vma.  Instead use PRIx64 to print bfd_vma values.
28921                 * emultempl/pe.em (gld${EMULATION_NAME}_finish): Likewise.
28922                 * ldlang.c (lang_map): Use %V to print region origin.
28923                 (lang_one_common): Don't use sprintf_vma.
28924                 * ldmisc.c (vfinfo): Don't use fprintf_vma or sprintf_vma.
28925                 * pe-dll.c (pe_dll_generate_def_file): Likewise.
28926         gdb/
28927                 * remote.c (remote_target::trace_set_readonly_regions): Replace
28928                 uses of sprintf_vma with bfd_sprintf_vma.
28929
28930 2022-08-01  liuzhensong  <liuzhensong@loongson.cn>
28931
28932         LoongArch: Set defaults to exec stack 0.
28933
28934 2022-08-01  Alan Modra  <amodra@gmail.com>
28935
28936         libctf: Avoid use of uninitialised variables
28937                 * ctf-link.c (ctf_link_add_ctf_internal): Don't free uninitialised
28938                 pointers.
28939
28940 2022-08-01  Alan Modra  <amodra@gmail.com>
28941
28942         PR29348, BFD_VMA_FMT wrong
28943         There is a problem with my commit 0e3c1eebb2, which replaced
28944         bfd_uint64_t with uint64_t: Some hosts typedef int64_t to long long
28945         even when long is the same size as long long.  That confuses the code
28946         choosing one of "l", "ll", or "I64" for BFD_VMA_FMT, and results in
28947         warnings.
28948
28949         Write a direct configure test for the printf int64_t style instead.
28950         This removes the last use of BFD_HOST_64BIT_LONG, so delete that.
28951         Note that the changes to configure.com are pure guesswork.
28952
28953                 PR 29348
28954                 * bfd-in.h (BFD_HOST_64BIT_LONG): Don't define.
28955                 (BFD_VMA_FMT): Define using BFD_INT64_FMT when 64-bit.
28956                 (bfd_vma, bfd_signed_vma): Move comments to 64-bit typedefs.
28957                 * configure.ac (BFD_HOST_64BIT_LONG): Delete.
28958                 (BFD_INT64_FMT): New config test.
28959                 * configure.com: Update similarly.
28960                 * Makefile.in: Regenerate.
28961                 * bfd-in2.h: Regenerate.
28962                 * configure: Regenerate.
28963
28964 2022-08-01  GDB Administrator  <gdbadmin@sourceware.org>
28965
28966         Automatic date update in version.in
28967
28968 2022-07-31  GDB Administrator  <gdbadmin@sourceware.org>
28969
28970         Automatic date update in version.in
28971
28972 2022-07-30  Tom de Vries  <tdevries@suse.de>
28973
28974         [gdb/testsuite] Fix gdb.ada/literals.exp with aarch64
28975         On aarch64-linux, I run into:
28976         ...
28977         (gdb) print 16#ffffffffffffffff#^M
28978         $7 = 18446744073709551615^M
28979         (gdb) FAIL: gdb.ada/literals.exp: print 16#ffffffffffffffff#
28980         ...
28981         while on x86_64-linux instead, I get:
28982         ...
28983         (gdb) print 16#ffffffffffffffff#^M
28984         $7 = -1^M
28985         (gdb) PASS: gdb.ada/literals.exp: print 16#ffffffffffffffff#
28986         ...
28987
28988         We can easily reproduce this on x86_64-linux using:
28989         ...
28990         $ gdb -q -batch -ex "set lang ada" -ex "set arch i386" \
28991           -ex "print 16#ffffffffffffffff#"
28992         $1 = -1
28993         $ gdb -q -batch -ex "set lang ada" -ex "set arch aarch64" \
28994           -ex "print 16#ffffffffffffffff#"
28995         $1 = 18446744073709551615
28996         ...
28997
28998         With i386, we have:
28999         ...
29000         (gdb) p int_bits
29001         $3 = 32
29002         (gdb) p long_bits
29003         $4 = 32
29004         (gdb) p long_long_bits
29005         $5 = 64
29006         ...
29007         and so in processInt we hit the fits-in-unsigned-long-long case where we use
29008         as type long long:
29009         ...
29010               /* Note: Interprets ULLONG_MAX as -1.  */
29011               yylval.typed_val.type = type_long_long (par_state);
29012         ...
29013
29014         With aarch64, we have instead:
29015         ...
29016         (gdb) p int_bits
29017         $1 = 32
29018         (gdb) p long_bits
29019         $2 = 64
29020         (gdb) p long_long_bits
29021         $3 = 64
29022         ...
29023         and so in processInt we hit the fits-in-unsigned-long case where we use
29024         as type unsigned long:
29025         ...
29026               yylval.typed_val.type
29027                 = builtin_type (par_state->gdbarch ())->builtin_unsigned_long;
29028         ...
29029
29030         It's not clear why for ada we're using long long for the
29031         fits-in-unsigned-long-long case.
29032
29033         Fix this by using unsigned long long for the fits-in-unsigned-long-long case,
29034         meaning the new reference output is 18446744073709551615 instead of -1.
29035
29036         Tested on x86_64-linux.
29037
29038         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29416
29039
29040 2022-07-30  Simon Marchi  <simon.marchi@efficios.com>
29041
29042         gdb/testsuite: add macros test for source files compiled in various ways
29043         Using different ways of passing source file paths to compilers results n
29044         different file and directory paths in the line header.  For example:
29045
29046           - gcc foo.c
29047           - gcc ./foo.c
29048           - gcc ../cwd/foo.c
29049           - gcc $PWD/foo.c
29050
29051         Because of this, GDB sometimes failed to look up macros.  The previous
29052         patch fixed that as much as possible.  This patch adds the corresponding
29053         tests.
29054
29055         Add both a DWARF assembler-based test and a regular test.  The DWARF
29056         assembled-based one tests some hard-coded debug info based on what I
29057         have observed some specific versions of gcc and clang generate.  We want
29058         to make sure that GDB keeps handling all these cases correctly, even if
29059         it's not always clear whether they are really valid DWARF.  Also, they
29060         will be tested no matter what the current target compiler is for a given
29061         test run.
29062
29063         The regular test is compiled using the target compiler, so it may help
29064         find bugs when testing against some other toolchains than what was used
29065         to generate the DWARF assembler-based test.
29066
29067         For the DWARF assembler-based test, add to testsuite/lib/dwarf.exp the
29068         necessary code to generate a DWARF5 .debug_macro section.  The design of
29069         the new procs is based on what was done for rnglists and loclists.
29070
29071         To test against a specific compiler one can use this command, for
29072         example:
29073
29074             $ make check TESTS="gdb.base/macro-source-path.exp" RUNTESTFLAGS="CC_FOR_TARGET=clang --target_board unix/gdb:debug_flags=-gdwarf-5"
29075
29076         Change-Id: Iab8da498e57d10cc2a3d09ea136685d9278cfcf6
29077
29078 2022-07-30  Simon Marchi  <simon.marchi@polymtl.ca>
29079
29080         gdb: remove code to prepend comp dir in buildsym_compunit::start_subfile
29081         The bit of code removed by this patch was introduced to fix the same
29082         kind of problem that the previous patch fixes.  That is, to try to match
29083         existing subfiles when different name forms are used to refer to a same
29084         file.
29085
29086         The thread for the patch that introduced this code is:
29087
29088           https://pi.simark.ca/gdb-patches/45F8CBDF.9090501@hq.tensilica.com/
29089
29090         The important bits are that the compiler produced a compilation unit
29091         with:
29092
29093             DW_AT_name : test.c
29094             DW_AT_comp_dir : /home/maxim/W/BadgerPass/PR_14999
29095
29096         and DWARF v2 line table with:
29097
29098             The Directory Table:
29099             /home/maxim/W/BadgerPass/PR_14999
29100
29101             The File Name Table:
29102             Entry Dir Time Size Name
29103             1 1 1173897037 152 test.c
29104
29105         Because the main symtab was created with only DW_AT_name, it was named
29106         "test.c".  And because the path built from the line header contained the
29107         "directory" part, it was "/home/maxim/W/BadgerPass/PR_14999/test.c".
29108         Because of this mismatch, thing didn't work, so they added this code to
29109         prepend the compilation directory to the existing subfile names, so that
29110         this specific case would work.
29111
29112         With the changes done earlier in this series, where subfiles are
29113         identified using the "most complete path possible", this case would be
29114         handled.  The main subfile's would be
29115         "/home/maxim/W/BadgerPass/PR_14999/test.c" from the start
29116         (DW_AT_comp_dir + DW_AT_name).  It's not so different from some DWARF 5
29117         cases actually, which make the compilation directory explicit in the
29118         line table header.
29119
29120         I therefore think that this code is no longer needed.  It does feel like
29121         a quick hack to make one specific case work, and we have a more general
29122         solution now.  Also, this code was introduced to work around a problem
29123         in the DWARF debug info or the DWARF debug info reader.  In general, I
29124         think it's preferable for these hacks to be located in the specific
29125         debug info reader code, rather than in the common code.
29126
29127         Even though this code was added to work around a DWARF reader problem,
29128         it's possible that some other debug info reader has started taking
29129         advantage of this code in the mean time.  It's very difficult to
29130         know or verify, but I think the likelyhood is quite small, so I'm
29131         proposing to get rid of it to simplify things a little bit.
29132
29133         Change-Id: I710b8ec0d449d1b110d67ddf9fcbdb2b37108306
29134
29135 2022-07-30  Simon Marchi  <simon.marchi@efficios.com>
29136
29137         gdb: add "id" fields to identify symtabs and subfiles
29138         Printing macros defined in the main source file doesn't work reliably
29139         using various toolchains, especially when DWARF 5 is used.  For example,
29140         using the binaries produced by either of these commands:
29141
29142             $ gcc --version
29143             gcc (GCC) 11.2.0
29144             $ ld --version
29145             GNU ld (GNU Binutils) 2.38
29146             $ gcc test.c -g3 -gdwarf-5
29147
29148             $ clang --version
29149             clang version 13.0.1
29150             $ clang test.c -gdwarf-5 -fdebug-macro
29151
29152         I get:
29153
29154             $ ./gdb -nx -q --data-directory=data-directory a.out
29155             (gdb) start
29156             Temporary breakpoint 1 at 0x111d: file test.c, line 6.
29157             Starting program: /home/simark/build/binutils-gdb-one-target/gdb/a.out
29158
29159             Temporary breakpoint 1, main () at test.c:6
29160             6         return ZERO;
29161             (gdb) p ZERO
29162             No symbol "ZERO" in current context.
29163
29164         When starting to investigate this (taking the gcc-compiled binary as an
29165         example), we see that GDB fails to look up the appropriate macro scope
29166         when evaluating the expression.  While stopped in
29167         macro_lookup_inclusion:
29168
29169             (top-gdb) p name
29170             $1 = 0x62100011a980 "test.c"
29171             (top-gdb) p source.filename
29172             $2 = 0x62100011a9a0 "/home/simark/build/binutils-gdb-one-target/gdb/test.c"
29173
29174         `source` is the macro_source_file that we would expect GDB to find.
29175         `name` comes from the symtab::filename field of the symtab we are
29176         stopped in.  GDB doesn't find the appropriate macro_source_file because
29177         the name of the macro_source_file doesn't match exactly the name of the
29178         symtab.
29179
29180         The name of the main symtab comes from the compilation unit's
29181         DW_AT_name, passed to the buildsym_compunit's constructor:
29182
29183           https://gitlab.com/gnutools/binutils-gdb/-/blob/4815d6125ec580cc02a1094d61b8c9d1cc83c0a1/gdb/dwarf2/read.c#L10627-10630
29184
29185         The contents of DW_AT_name, in this case, is "test.c".  It is typically
29186         (what I witnessed all compilers do) the same string that was passed to
29187         the compiler on the command-line.
29188
29189         The name of the macro_source_file comes from the line number program
29190         header's file table, from the call to the line_header::file_file_name
29191         method:
29192
29193           https://gitlab.com/gnutools/binutils-gdb/-/blob/4815d6125ec580cc02a1094d61b8c9d1cc83c0a1/gdb/dwarf2/macro.c#L54-65
29194
29195         line_header::file_file_name prepends the directory path that the file
29196         entry refers to, in the file table (if the file name is not already
29197         absolute).  In this case, the file name is "test.c", appended to the
29198         directory "/home/simark/build/binutils-gdb-one-target/gdb".
29199
29200         Because the symtab's name is not created the same way as the
29201         macro_source_file's name is created, we get this mismatch.  GDB fails to
29202         find the appropriate macro scope for the symtab, and we can't print
29203         macros when stopped in that symtab.
29204
29205         To make this work, we must ensure that paths produced in these two ways
29206         end up identical.  This can be tricky because of the different ways a
29207         path can be passed to the compiler by the user.
29208
29209         Another thing to consider is that while the main symtab's name (or
29210         subfile, before it becomes a symtab) is created using DW_AT_name, the
29211         main symtab is also referred to using its entry in the line table
29212         header's file table, when processing the line table.  We must therefore
29213         ensure that the same name is produced in both cases, so that a call to
29214         "start_subfile" for the main subfile will correctly find the
29215         already-created subfile, created by buildsym_compunit's constructor.  If
29216         we fail to do that, things still often work, because of a fallback: the
29217         watch_main_source_file_lossage method.  This method determines that if
29218         the main subfile has no symbols but there exists another subfile with
29219         the same basename (e.g. "test.c") that does have symbols, it's probably
29220         because there was some filename mismatch.  So it replaces the main
29221         subfile with that other subfile.  I think that heuristic is useful as a
29222         last effort to work around any bug or bad debug info, but I don't think
29223         we should design things such as to rely on it.  It's a heuristic, it can
29224         get things wrong.  So in my search for a fix, it is important that given
29225         some good debug info, we don't end up relying on that for things to
29226         work.
29227
29228         A first attempt at fixing this was to try to prepend the compilation
29229         directory here or not prepend it there.  In practice, because of all the
29230         possible combinations of debug info the compilers produce, it was not
29231         possible to get something that would produce reliable, consistent paths.
29232
29233         Another attempt at fixing this was to make both macro_source_file
29234         objects and symtab objects use the most complete form of path possible.
29235         That means to prepend directories at least until we get an absolute
29236         path.  In theory, we should end up with the same path in all cases.
29237         This generally worked, but because it changed the symtab names, it
29238         resulted in user-visible changes (for example, paths to source files in
29239         Breakpoint hit messages becoming always absolute).  I didn't find this
29240         very good, first because there is a "set filename-display" setting that
29241         lets the user control how they want the paths to be displayed, and that
29242         would suddenly make this setting completely ineffective (although even
29243         today, it is a bit dependent on the debug info).  Second, it would
29244         require a good amount of testsuite tweaks to make tests accept these
29245         suddenly absolute paths.
29246
29247         This new patch is a slight variation of that: it adds a new field called
29248         "filename_for_id" in struct symtab and struct subfile, next to the
29249         existing filename field. The goal is to separate the internal ids used
29250         for finding objects from the names used for presentation.  This field is
29251         used for identifying subfiles, symtabs and macro_source_files
29252         internally.  For DWARF symtabs, this new field is meant to contain the
29253         "most complete possible" path, as discussed above.  So for a given file,
29254         it must always be in the same form, everywhere.  The existing
29255         symtab::filename field remains the one used for printing to the user, so
29256         there shouldn't be any change in how paths are printed.
29257
29258         Changes in the core symtab files are:
29259
29260          - Add "name_for_id" and "filename_for_id" fields to "struct subfile"
29261            and "struct symtab", next to existing "name" and "filename" fields.
29262          - Make buildsym_compunit::buildsym_compunit and
29263            buildsym_compunit::start_subfile accept a "name_for_id" parameter
29264            next to the existing "name" ones.
29265          - Make buildsym_compunit::start_subfile use "name_for_id" for looking
29266            up existing subfiles.  This is the key thing for making calls
29267            to start_subfile for the main source file look up the existing
29268            subfile successfully, and avoid relying on
29269            watch_main_source_file_lossage.
29270          - Make sal_macro_scope pass "filename_for_id", rather than "filename",
29271            to macro_lookup_inclusion.  This is the key thing to making the
29272            lookup work and macro printing work.
29273
29274         Changes in the DWARF files are:
29275
29276          - Make line_header::file_file_name return the "most complete possible"
29277            name.  The only pre-existing user of this method is the macro code,
29278            to give the macro_source_file objects their name.  And we now want
29279            them to have this "most complete possible" name, which will match the
29280            corresponding symtab's "filename_for_id".
29281          - Make dwarf2_cu::start_compunit_symtab pass the "most complete
29282            possible" name for the main symtab's "filename_for_id".  In this
29283            context, where the info comes from the compilation unit's DW_AT_name
29284            / DW_AT_comp_dir, it means prepending DW_AT_comp_dir to DW_AT_name if
29285            DW_AT_name is not already absolute.
29286          - Change dwarf2_start_subfile to build a name_for_id for the subfile
29287            being started.  The simplest way is to re-use
29288            line_header::file_file_name, since the callers always have a
29289            file_entry handy.  This ensures that it will get the exact same path
29290            representation as the macro code does, for the same file (since it
29291            also uses line_header::file_file_name).
29292          - Update calls to allocate_symtab to pass the "name_for_id" from the
29293            subfile.
29294
29295         Tests exercising all this are added by the following patch.
29296
29297         Of all the cases I tried, the only one I found that ends up relying on
29298         watch_main_source_file_lossage is the following one:
29299
29300             $ clang --version
29301             clang version 13.0.1
29302             Target: x86_64-pc-linux-gnu
29303             Thread model: posix
29304             InstalledDir: /usr/bin
29305             $ clang  ./test.c -g3 -O0 -gdwarf-4
29306             $ ./gdb -nx --data-directory=data-directory -q -readnow -iex "set debug symtab-create 1"  a.out
29307             ...
29308             [symtab-create] start_subfile: name = test.c, name_for_id = /home/simark/build/binutils-gdb-one-target/gdb/test.c
29309             [symtab-create] start_subfile: name = ./test.c, name_for_id = /home/simark/build/binutils-gdb-one-target/gdb/./test.c
29310             [symtab-create] start_subfile: name = ./test.c, name_for_id = /home/simark/build/binutils-gdb-one-target/gdb/./test.c
29311             [symtab-create] start_subfile: found existing symtab with name_for_id /home/simark/build/binutils-gdb-one-target/gdb/./test.c (/home/simark/build/binutils-gdb-one-target/gdb/./test.c)
29312             [symtab-create] watch_main_source_file_lossage: using subfile ./test.c as the main subfile
29313
29314         As we can see, there are two forms used for "test.c", one with a "." and
29315         one without.  This comes from the fact that the compilation unit DIE
29316         contains:
29317
29318             DW_AT_name ("test.c")
29319             DW_AT_comp_dir ("/home/simark/build/binutils-gdb-one-target/gdb")
29320
29321         without a ".", and the line table for that file contains:
29322
29323             include_directories[  1] = "."
29324             file_names[  1]:
29325                        name: "test.c"
29326                   dir_index: 1
29327
29328         When assembling the filename from that entry, we get a ".".
29329
29330         It is a bit unexpected that the main filename resulting from the line
29331         table header does not match exactly the name in the compilation unit.
29332         For instance, gcc uses "./test.c" for the DW_AT_name, which gives
29333         identical paths in the compilation unit and in the line table header.
29334
29335         Similarly, with DWARF 5:
29336
29337             $ clang  ./test.c -g3 -O0 -gdwarf-5
29338
29339         clang create two entries that refer to the same file but are of in a different
29340         form.
29341
29342             include_directories[  0] = "/home/simark/build/binutils-gdb-one-target/gdb"
29343             include_directories[  1] = "."
29344             file_names[  0]:
29345                        name: "test.c"
29346                   dir_index: 0
29347             file_names[  1]:
29348                        name: "test.c"
29349                   dir_index: 1
29350
29351         The first file name produces a path without a "." while the second does.
29352         This is not caught by watch_main_source_file_lossage, because of
29353         dwarf_decode_lines that creates a symtab for each file entry in the line
29354         table.  It therefore appears as "non-empty" to
29355         watch_main_source_file_lossage.  This results in two symtabs:
29356
29357             (gdb) maintenance info symtabs
29358             { objfile /home/simark/build/binutils-gdb-one-target/gdb/a.out ((struct objfile *) 0x613000005d00)
29359               { ((struct compunit_symtab *) 0x62100011aca0)
29360                 debugformat DWARF 5
29361                 producer clang version 13.0.1
29362                 name test.c
29363                 dirname /home/simark/build/binutils-gdb-one-target/gdb
29364                 blockvector ((struct blockvector *) 0x621000129ec0)
29365                 user ((struct compunit_symtab *) (null))
29366                     { symtab test.c ((struct symtab *) 0x62100011ad20)
29367                       fullname (null)
29368                       linetable ((struct linetable *) 0x0)
29369                     }
29370                     { symtab ./test.c ((struct symtab *) 0x62100011ad60)
29371                       fullname (null)
29372                       linetable ((struct linetable *) 0x621000129ef0)
29373                     }
29374               }
29375             }
29376
29377         I am not sure what is the consequence of this, but this is also what
29378         happens before my patch, so I think its acceptable to leave it as-is.
29379
29380         To handle these two cases nicely, I think we will need a function that
29381         removes the unnecessary "." from path names, something that can be done
29382         later.
29383
29384         Finally, I made a change in find_file_and_directory is necessary to
29385         avoid breaking test
29386
29387             gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc42
29388
29389         Without that change, we would get:
29390
29391             (gdb) info source
29392             Current source file is /dir/d/dw2-compdir-oldgcc42.S
29393             Compilation directory is /dir/d
29394
29395         whereas the expected result is:
29396
29397             (gdb) info source
29398             Current source file is dw2-compdir-oldgcc42.S
29399             Compilation directory is /dir/d
29400
29401         This test was added here:
29402
29403           https://sourceware.org/pipermail/gdb-patches/2012-November/098144.html
29404
29405         Long story short, GCC <= 4.2 apparently had a bug where it would
29406         generate a DW_AT_name with a full path ("/dir/d/dw2-compdir-oldgcc42.S")
29407         and no DW_AT_comp_dir.  The line table has one entry with filename
29408         "dw2-compdir-oldgcc42.S", which refers to directory 0.  Directory 0
29409         normally refers to the compilation unit's comp dir, but it is
29410         non-existent in this case.
29411
29412         This caused some symtab lookup problems, and to work around them, some
29413         workaround was added, which today reads as:
29414
29415             if (res.get_comp_dir () == nullptr
29416                 && producer_is_gcc_lt_4_3 (cu)
29417                 && res.get_name () != nullptr
29418                 && IS_ABSOLUTE_PATH (res.get_name ()))
29419               res.set_comp_dir (ldirname (res.get_name ()));
29420
29421         Source: https://gitlab.com/gnutools/binutils-gdb/-/blob/6577f365ebdee7dda71cb996efa29d3714cbccd0/gdb/dwarf2/read.c#L9428-9432
29422
29423         It extracts an artificial DW_AT_comp_dir from DW_AT_name, if there is no
29424         DW_AT_comp_dir and DW_AT_name is absolute.
29425
29426         Prior to my patch, a subfile would get created with filename
29427         "/dir/d/dw2-compdir-oldgcc42.S", from DW_AT_name, and another would get
29428         created with filename "dw2-compdir-oldgcc42.S" from the line table's
29429         file table.  Then watch_main_source_file_lossage would kick in and merge
29430         them, keeping only the "dw2-compdir-oldgcc42.S" one:
29431
29432             [symtab-create] start_subfile: name = /dir/d/dw2-compdir-oldgcc42.S
29433             [symtab-create] start_subfile: name = dw2-compdir-oldgcc42.S
29434             [symtab-create] start_subfile: name = dw2-compdir-oldgcc42.S
29435             [symtab-create] start_subfile: found existing symtab with name dw2-compdir-oldgcc42.S (dw2-compdir-oldgcc42.S)
29436             [symtab-create] watch_main_source_file_lossage: using subfile dw2-compdir-oldgcc42.S as the main subfile
29437
29438         And so "info source" would show "dw2-compdir-oldgcc42.S" as the
29439         filename.
29440
29441         With my patch applied, but without the change in
29442         find_file_and_directory, both DW_AT_name and the line table would try to
29443         start a subfile with the same filename_for_id, and there was no need for
29444         watch_main_source_file_lossage - which is what we want:
29445
29446         [symtab-create] start_subfile: name = /dir/d/dw2-compdir-oldgcc42.S, name_for_id = /dir/d/dw2-compdir-oldgcc42.S
29447         [symtab-create] start_subfile: name = dw2-compdir-oldgcc42.S, name_for_id = /dir/d/dw2-compdir-oldgcc42.S
29448         [symtab-create] start_subfile: found existing symtab with name_for_id /dir/d/dw2-compdir-oldgcc42.S (/dir/d/dw2-compdir-oldgcc42.S)
29449         [symtab-create] start_subfile: name = dw2-compdir-oldgcc42.S, name_for_id = /dir/d/dw2-compdir-oldgcc42.S
29450         [symtab-create] start_subfile: found existing symtab with name_for_id /dir/d/dw2-compdir-oldgcc42.S (/dir/d/dw2-compdir-oldgcc42.S)
29451
29452         But since the one with name == "/dir/d/dw2-compdir-oldgcc42.S", coming
29453         from DW_AT_name, gets created first, it wins, and the symtab ends up
29454         with "/dir/d/dw2-compdir-oldgcc42.S" as the name, "info source" shows
29455         "/dir/d/dw2-compdir-oldgcc42.S" and the test breaks.
29456
29457         This is not wrong per-se, after all DW_AT_name is
29458         "/dir/d/dw2-compdir-oldgcc42.S", so it wouldn't be wrong to report the
29459         current source file as "/dir/d/dw2-compdir-oldgcc42.S".  If you compile
29460         a file passing "/an/absolute/path.c", DW_AT_name typically contains (at
29461         least with GCC) "/an/absolute/path.c" and GDB tells you that the source
29462         file is "/an/absolute/path.c".  But we can also keep the existing
29463         behavior fairly easily with a little change in find_file_and_directory.
29464         When extracting an artificial DW_AT_comp_dir from DW_AT_name, we now
29465         modify the name to just keep the file part.  The result is coherent with
29466         what compilers do when you compile a file by just passing its filename
29467         ("gcc path.c -g"):
29468
29469               DW_AT_name        ("path.c")
29470               DW_AT_comp_dir    ("/home/simark/build/binutils-gdb-one-target/gdb")
29471
29472         With this change, filename_for_id is still the full name,
29473         "/dir/d/dw2-compdir-oldgcc42.S", but the filename of the subfile /
29474         symtab (what ends up shown by "info source") is just
29475         "dw2-compdir-oldgcc42.S", and that makes the test happy.
29476
29477         Change-Id: I8b5cc4bb3052afdb172ee815c051187290566307
29478
29479 2022-07-30  Simon Marchi  <simon.marchi@polymtl.ca>
29480
29481         gdb/dwarf: pass a file_entry to line_header::file_file_name
29482         In the following patch, there will be some callers of file_file_name
29483         that will already have access to the file_entry object for which they
29484         want the file name.  It would be inefficient to have them pass an index,
29485         only for line_header::file_file_name to re-lookup the same file_entry
29486         object.  Change line_header::file_file_name to accept a file_entry
29487         object reference, instead of an index to look up.
29488
29489         I think this change makes sense in any case.  Callers that have an index
29490         can first obtain a file_entry using line_header::file_name_at or
29491         line_header::file_names.
29492
29493         When passing a file_entry object, we can assume that the file_entry's
29494         index is valid, unlike when passing an index.  So, push the special case
29495         about an invalid index to the sole current caller of file_file_name,
29496         macro_start_file.  I think that error belongs there anyway, since it
29497         specifically talks about "bad file number in macro information".
29498
29499         This requires recording the file index in the file_entry structure, so
29500         add that.
29501
29502         Change-Id: Ic6e44c407539d92b7863d7ba82405ade17f384ad
29503
29504 2022-07-30  Simon Marchi  <simon.marchi@polymtl.ca>
29505
29506         gdb/dwarf: pass compilation directory to line header
29507         The following patch changes line_header::file_file_name to prepend the
29508         compilation directory to the file name, if needed.  For that, the line
29509         header needs to know about the compilation directory.  Prepare for that
29510         by adding a constructor that takes it as a parameter, and passing the
29511         value down everywhere needed.  Add a second constructor for the special
29512         case of building a line_header for doing a hash table lookup, since that
29513         case doesn't require a compilation directory value.
29514
29515         Change-Id: Iba3ba0293e4e2d13a64b257cf9a3094684d54330
29516
29517 2022-07-30  Simon Marchi  <simon.marchi@polymtl.ca>
29518
29519         gdb: add debug prints in buildsym.c
29520         Add a few debug prints in buildsym.c that were helpful to me in writing
29521         this series.
29522
29523         Change-Id: If10a818feaee3ce1b78a2a254013b62dd578002b
29524
29525 2022-07-30  Simon Marchi  <simon.marchi@polymtl.ca>
29526
29527         gdb: introduce symtab_create_debug_printf
29528         Introduce symtab_create_debug_printf and symtab_create_debug_printf_v,
29529         to print the debug messages enabled by "set debug symtab-create".
29530
29531         Change-Id: I442500903f72d4635c2dd9eaef770111f317dc04
29532
29533 2022-07-30  GDB Administrator  <gdbadmin@sourceware.org>
29534
29535         Automatic date update in version.in
29536
29537 2022-07-29  Tom de Vries  <tdevries@suse.de>
29538
29539         [gdb/testsuite] Fix gdb.ada/convvar_comp.exp with broken debug info
29540         On aarch64-linux I run into this failure with gcc 7.5.0:
29541         ...
29542         (gdb) print $item.started^M
29543         $1 = (-5312, 65535, 4202476)^M
29544         (gdb) FAIL: gdb.ada/convvar_comp.exp: print $item.started
29545         ...
29546
29547         The test-case expects (0, 0, 0), but we're getting another value due to
29548         incorrect location information.
29549
29550         Work around this by:
29551         - first printing the value, and then
29552         - verifying that the convenience variable matches the printed value.
29553
29554         I've verified that the test-case still checks what it should by disabling
29555         the fix from commit cc0e770c0d0 ("memory error printing component of record
29556         from convenience variable") and observing the test-case fail.
29557
29558         Tested on x86_64-linux and aarch64-linux.
29559
29560         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29420
29561
29562 2022-07-29  Alan Modra  <amodra@gmail.com>
29563
29564         Re: PR16005, avr linker crash on a particular instruction sequence with --relax
29565         The last patch wasn't so clever.  The contents in fact have already
29566         been read, just not cached where relax_delete_bytes expects them.
29567         relax_delete_bytes also modifies relocs and syms, so they should be
29568         cached too.
29569
29570                 PR 16005
29571                 * elf32-avr.c (elf32_avr_relax_delete_bytes): Revert last change.
29572                 (elf32_avr_relax_section): Cache contents, relocs and syms
29573                 before calling relax_delete_bytes.
29574
29575 2022-07-29  Andrew Burgess  <aburgess@redhat.com>
29576
29577         libopcodes/aarch64: add support for disassembler styling
29578         This commit enables disassembler styling for AArch64.  After this
29579         commit it is possible to have objdump style AArch64 disassembler
29580         output (using --disassembler-color option).  Once the required GDB
29581         patches are merged, GDB will also style the disassembler output.
29582
29583         The changes to support styling are mostly split between two files
29584         opcodes/aarch64-dis.c and opcodes/aarch64-opc.c.
29585
29586         The entry point for the AArch64 disassembler can be found in
29587         aarch64-dis.c, this file handles printing the instruction mnemonics,
29588         and assembler directives (e.g. '.byte', '.word', etc).  Some operands,
29589         mostly relating to assembler directives are also printed from this
29590         file.  This commit changes all of this to pass through suitable
29591         styling information.
29592
29593         However, for most "normal" instructions, the instruction operands are
29594         printed using a two step process.  From aarch64-dis.c, in the
29595         print_operands function, the function aarch64_print_operand is called,
29596         this function is in aarch64-opc.c, and converts an instruction operand
29597         into a string.  Then, back in print_operands (aarch64-dis.c), the
29598         operand string is printed.
29599
29600         Unfortunately, the string returned by aarch64_print_operand can be
29601         quite complex, it will include syntax elements, like '[' and ']', in
29602         addition to register names and immediate values.  In some cases, a
29603         single operand will expand into what will appear (to the user) as
29604         multiple operands separated with a ','.
29605
29606         This makes the task of styling more complex, all these different
29607         components need to by styled differently, so we need to get the
29608         styling information out of aarch64_print_operand in some way.
29609
29610         The solution that I propose here is similar to the solution that I
29611         used for the i386 disassembler.
29612
29613         Currently, aarch64_print_operand uses snprintf to write the operand
29614         text into a buffer provided by the caller.
29615
29616         What I propose is that we pass an extra argument to the
29617         aarch64_print_operand function, this argument will be a structure, the
29618         structure contains a callback function and some state.
29619
29620         When aarch64_print_operand needs to format part of its output this can
29621         be done by using the callback function within the new structure, this
29622         callback returns a string with special embedded markers that indicate
29623         which mode should be used for each piece of text.  Back in
29624         aarch64-dis.c we can spot these special style markers and use this to
29625         split the disassembler output up and apply the correct style to each
29626         piece.
29627
29628         To make aarch64-opc.c clearer a series of new static functions have
29629         been added, e.g. 'style_reg', 'style_imm', etc.  Each of these
29630         functions formats a piece of text in a different style, 'register' and
29631         'immediate' in this case.
29632
29633         Here's an example taken from aarch64-opc.c of the new functions in
29634         use:
29635
29636             snprintf (buf, size, "[%s, %s]!",
29637                       style_reg (styler, base),
29638                       style_imm (styler, "#%d", opnd->addr.offset.imm));
29639
29640         The aarch64_print_operand function is also called from the assembler
29641         to aid in printing diagnostic messages.  Right now I have no plans to
29642         add styling to the assembler output, and so, the callback function
29643         used in the assembler ignores the styling information and just returns
29644         an plain string.
29645
29646         I've used the source files in gas/testsuite/gas/aarch64/ for testing,
29647         and have manually gone through and checked that the styling looks
29648         reasonable, however, I'm not an AArch64 expert, so it is possible that
29649         the odd piece is styled incorrectly.  Please point out any mistakes
29650         I've made.
29651
29652         With objdump disassembler color turned off, there should be no change
29653         in the output after this commit.
29654
29655 2022-07-29  Nick Clifton  <nickc@redhat.com>
29656
29657         Stop the linker from complaining about unrecognised DW_FORM-rnglistx and DW_FORM_loclistx format attributes.
29658                 PR 29424
29659                 * dwarf2.c (read_attribute_value): Handle DW_FORM_rnglistx and
29660                 DW_FORM_loclistx.
29661
29662 2022-07-29  Alan Modra  <amodra@gmail.com>
29663
29664         PR16005, avr linker crash on a particular instruction sequence with --relax
29665         It's possible for relax_delete_bytes to be called with section
29666         contents NULL, as demonstrated by the testcase in this PR.
29667
29668                 PR 16005
29669                 * elf32-avr.c (elf32_avr_relax_delete_bytes): Get section contents
29670                 if not already available.
29671
29672 2022-07-29  Jan Beulich  <jbeulich@suse.com>
29673
29674         x86: drop stray NoRex64 from KeyLocker insns
29675         It's entirely unclear why some of the KeyLocker insns had NoRex64 on
29676         them - there's nothing here which could cause emission of REX.W (except
29677         of course a user-specified "rex.w", which we ought to honor anyway).
29678
29679 2022-07-29  Jan Beulich  <jbeulich@suse.com>
29680
29681         Arm64: re-work PR gas/27217 fix
29682         The original approach has resulted in anomalies when . is involved in an
29683         operand of one of the affected insns. We cannot leave . unresolved, or
29684         else it'll be resolved at the end of assembly, then pointing to the
29685         address of a section rather than at the insn of interest. Undo part of
29686         the original change and instead check whether a relocation cannot be
29687         omitted in md_apply_fix().
29688
29689         By resolving the expressions again, equates (see the adjustment of the
29690         respective testcase) will now be evaluated, and hence relocations
29691         against absolute addresses be emitted. This ought to be okay as long as
29692         the equates aren't global (and hence can't be overridden). If a need
29693         for such arises, quite likely the only way to address this would be to
29694         invent yet another expression evaluation mode, leaving everything
29695         _except_ . un-evaluated.
29696
29697         There's a further anomaly in how transitive equates are handled. In
29698
29699                 .set x, 0x12345678
29700                 .eqv bar, x
29701         foo:
29702                 adrp    x0, x
29703                 add     x0, x0, :lo12:x
29704
29705                 adrp    x0, bar
29706                 add     x0, x0, :lo12:bar
29707
29708         the first two relocations are now against *ABS*:0x12345678 (as said
29709         above), whereas the latter two relocations would be against x. (Before
29710         the change here, the first two relocations are against x and the latter
29711         two against bar.) But this is an issue seen elsewhere as well, and would
29712         likely require adjustments in the target-independent parts of the
29713         assembler instead of trying to hack around this for every target.
29714
29715 2022-07-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
29716
29717         ld: Extend ac_default_ld_warn_rwx_segments to all SPARC targets [PR29411]
29718         As discussed in PR ld/29411, the ld warning
29719
29720                 [...] has a LOAD segment with RWX permissions
29721
29722         needs to be disabled on all SPARC targets, not just Solaris/SPARC: the
29723         .plt section is required to be RWX by the 32-bit SPARC ELF psABI and the
29724         64-bit SPARC Compliance Definition 2.4.1.  Given that ld only supports
29725         SPARC ELF targets, this patch implements this.
29726
29727         Tested on sparc64-unknown-linux-gnu and sparc-sun-solaris2.11.
29728
29729         2022-07-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
29730
29731                 ld:
29732                 PR ld/29411
29733                 * configure.tgt (ac_default_ld_warn_rwx_segments): Extend to all
29734                 sparc targets.  Expand comment.
29735
29736 2022-07-29  Tom de Vries  <tdevries@suse.de>
29737
29738         [gdb/testsuite] Fix gdb.threads/killed-outside.exp on aarch64
29739         On aarch64 (and likewise on arm), I run into:
29740         ...
29741         (gdb) PASS: gdb.threads/killed-outside.exp: get pid of inferior
29742         Executing on target: kill -9 11516    (timeout = 300)
29743         builtin_spawn -ignore SIGHUP kill -9 11516^M
29744         continue^M
29745         Continuing.^M
29746         Unable to fetch general registers: No such process.^M
29747         (gdb) [Thread 0xfffff7d511e0 (LWP 11518) exited]^M
29748         ^M
29749         Program terminated with signal SIGKILL, Killed.^M
29750         The program no longer exists.^M
29751         FAIL: gdb.threads/killed-outside.exp: prompt after first continue (timeout)
29752         ...
29753         due to a mismatch between the actual "No such process" line and the expected
29754         one:
29755         ...
29756         set no_such_process_msg "Couldn't get registers: No such process\."
29757         ...
29758
29759         Fix this by updating the regexp.
29760
29761         Tested on aarch64-linux, and x86_64-linux.
29762
29763 2022-07-29  Tsukasa OI  <research_trasio@irq.a4lg.com>
29764
29765         RISC-V: Add `OP_V' to .insn named opcodes
29766         This commit adds `OP_V' (OP-V: vector instruction opcode for now
29767         ratified `V' extension) to .insn opcode name list.  Although vector
29768         instruction encoding is not implemented in `.insn' directive, it will
29769         help future implementation of custom vector `.insn'.
29770
29771         gas/ChangeLog:
29772
29773                 * config/tc-riscv.c (opcode_name_list): Add `OP_V'.
29774                 * testsuite/gas/riscv/insn.s: Add testcase.
29775                 * testsuite/gas/riscv/insn.d: Likewise.
29776                 * testsuite/gas/riscv/insn-dwarf.d: Reflect insn.s update.
29777
29778 2022-07-29  GDB Administrator  <gdbadmin@sourceware.org>
29779
29780         Automatic date update in version.in
29781
29782 2022-07-28  Tom Tromey  <tom@tromey.com>
29783
29784         Remove some unneeded checks in Guile code
29785         The Guile code generally checks to see if an htab is non-null before
29786         destroying it.  However, the registry code already ensures this, so we
29787         can change these checks to asserts and simplify the code a little.
29788
29789         Change registry to use less memory
29790         The registry code creates "registry_data" objects that hold the free
29791         function and the index; then the registry keys refer to this object.
29792         However, only the index is really useful, and now that registries have
29793         a private implementation, just the index can be stored and we can
29794         reduce the memory use of registries a little bit.  This also
29795         simplifies the code somewhat.
29796
29797 2022-07-28  Tom Tromey  <tom@tromey.com>
29798
29799         Rewrite registry.h
29800         This rewrites registry.h, removing all the macros and replacing it
29801         with relatively ordinary template classes.  The result is less code
29802         than the previous setup.  It replaces large macros with a relatively
29803         straightforward C++ class, and now manages its own cleanup.
29804
29805         The existing type-safe "key" class is replaced with the equivalent
29806         template class.  This approach ended up requiring relatively few
29807         changes to the users of the registry code in gdb -- code using the key
29808         system just required a small change to the key's declaration.
29809
29810         All existing users of the old C-like API are now converted to use the
29811         type-safe API.  This mostly involved changing explicit deletion
29812         functions to be an operator() in a deleter class.
29813
29814         The old "save/free" two-phase process is removed, and replaced with a
29815         single "free" phase.  No existing code used both phases.
29816
29817         The old "free" callbacks took a parameter for the enclosing container
29818         object.  However, this wasn't truly needed and is removed here as
29819         well.
29820
29821 2022-07-28  Tom Tromey  <tom@tromey.com>
29822
29823         Remove some unused functions from guile code
29824         The guile code has a couple of unused functions that touch on the
29825         registry API.  This patch removes them.
29826
29827 2022-07-28  Tom Tromey  <tom@tromey.com>
29828
29829         Change allocation of type-copying hash table
29830         When an objfile is destroyed, types that are still in use and
29831         allocated on that objfile are copied.  A temporary hash map is created
29832         during this process, and it is allocated on the destroyed objfile's
29833         obstack -- which normally is fine, as that is going to be destroyed
29834         shortly anyway.
29835
29836         However, this approach requires that the objfile be passed to registry
29837         destruction, and this won't be possible in the rewritten registry.
29838         This patch changes the copied type hash table to simply use the heap
29839         instead.  It also removes the 'objfile' parameter from
29840         copy_type_recursive, to make this all more clear.
29841
29842         This patch also fixes an apparent bug in copy_type_recursive.
29843         Previously it was copying the dynamic property list to the dying
29844         objfile's obstack:
29845
29846         -      = copy_dynamic_prop_list (&objfile->objfile_obstack,
29847
29848         However I think this is incorrect -- that obstack is about to be
29849         destroyed.
29850
29851 2022-07-28  Tom Tromey  <tom@tromey.com>
29852
29853         Change address_space to use new and delete
29854         This changes address_space to use new and delete, and makes some other
29855         small C++-ification changes as well, like changing address_space_num
29856         to be a method.
29857
29858         This patch was needed for the subsequent patch to rewrite the registry
29859         system.
29860
29861 2022-07-28  Simon Farre  <simon.farre.cx@gmail.com>
29862
29863         gdb/python: Add BreakpointLocation type
29864         PR python/18385
29865
29866         v7:
29867         This version addresses the issues pointed out by Tom.
29868
29869         Added nullchecks for Python object creations.
29870
29871         Changed from using PyLong_FromLong to the gdb_py-versions.
29872
29873         Re-factored some code to make it look more cohesive.
29874
29875         Also added the more safe Python reference count decrement PY_XDECREF,
29876         even though the BreakpointLocation type is never instantiated by the
29877         user (explicitly documented in the docs) decrementing < 0 is made
29878         impossible with the safe call.
29879
29880         Tom pointed out that using the policy class explicitly to decrement a
29881         reference counted object was not the way to go, so this has instead been
29882         wrapped in a ref_ptr that handles that for us in blocpy_dealloc.
29883
29884         Moved macro from py-internal to py-breakpoint.c.
29885
29886         Renamed section at the bottom of commit message "Patch Description".
29887
29888         v6:
29889         This version addresses the points Pedro gave in review to this patch.
29890
29891         Added the attributes `function`, `fullname` and `thread_groups`
29892         as per request by Pedro with the argument that it more resembles the
29893         output of the MI-command "-break-list".  Added documentation for these attributes.
29894
29895         Cleaned up left overs from copy+paste in test suite, removed hard coding
29896         of line numbers where possible.
29897
29898         Refactored some code to use more c++-y style range for loops
29899         wrt to breakpoint locations.
29900
29901         Changed terminology, naming was very inconsistent. Used a variety of "parent",
29902         "owner". Now "owner" is the only term used, and the field in the
29903         gdb_breakpoint_location_object now also called "owner".
29904
29905         v5:
29906
29907         Changes in response to review by Tom Tromey:
29908         - Replaced manual INCREF/DECREF calls with
29909           gdbpy_ref ptrs in places where possible.
29910         - Fixed non-gdb style conforming formatting
29911         - Get parent of bploc increases ref count of parent.
29912         - moved bploc Python definition to py-breakpoint.c
29913
29914         The INCREF of self in bppy_get_locations is due
29915         to the individual locations holding a reference to
29916         it's owner. This is decremented at de-alloc time.
29917
29918         The reason why this needs to be here is, if the user writes
29919         for instance;
29920
29921         py loc = gdb.breakpoints()[X].locations[Y]
29922
29923         The breakpoint owner object is immediately going
29924         out of scope (GC'd/dealloced), and the location
29925         object requires it to be alive for as long as it is alive.
29926
29927         Thanks for your review, Tom!
29928
29929         v4:
29930         Fixed remaining doc issues as per request
29931         by Eli.
29932
29933         v3:
29934         Rewritten commit message, shortened + reworded,
29935         added tests.
29936
29937         Patch Description
29938
29939         Currently, the Python API lacks the ability to
29940         query breakpoints for their installed locations,
29941         and subsequently, can't query any information about them, or
29942         enable/disable individual locations.
29943
29944         This patch solves this by adding Python type gdb.BreakpointLocation.
29945         The type is never instantiated by the user of the Python API directly,
29946         but is produced by the gdb.Breakpoint.locations attribute returning
29947         a list of gdb.BreakpointLocation.
29948
29949         gdb.Breakpoint.locations:
29950         The attribute for retrieving the currently installed breakpoint
29951         locations for gdb.Breakpoint. Matches behavior of
29952         the "info breakpoints" command in that it only
29953         returns the last known or currently inserted breakpoint locations.
29954
29955         BreakpointLocation contains 7 attributes
29956
29957         6 read-only attributes:
29958         owner: location owner's Python companion object
29959         source: file path and line number tuple: (string, long) / None
29960         address: installed address of the location
29961         function: function name where location was set
29962         fullname: fullname where location was set
29963         thread_groups: thread groups (inferiors) where location was set.
29964
29965         1 writeable attribute:
29966         enabled: get/set enable/disable this location (bool)
29967
29968         Access/calls to these, can all throw Python exceptions (documented in
29969         the online documentation), and that's due to the nature
29970         of how breakpoint locations can be invalidated
29971         "behind the scenes", either by them being removed
29972         from the original breakpoint or changed,
29973         like for instance when a new symbol file is loaded, at
29974         which point all breakpoint locations are re-created by GDB.
29975         Therefore this patch has chosen to be non-intrusive:
29976         it's up to the Python user to re-request the locations if
29977         they become invalid.
29978
29979         Also there's event handlers that handle new object files etc, if a Python
29980         user is storing breakpoint locations in some larger state they've
29981         built up, refreshing the locations is easy and it only comes
29982         with runtime overhead when the Python user wants to use them.
29983
29984         gdb.BreakpointLocation Python type
29985         struct "gdbpy_breakpoint_location_object" is found in python-internal.h
29986
29987         Its definition, layout, methods and functions
29988         are found in the same file as gdb.Breakpoint (py-breakpoint.c)
29989
29990         1 change was also made to breakpoint.h/c to make it possible
29991         to enable and disable a bp_location* specifically,
29992         without having its LOC_NUM, as this number
29993         also can change arbitrarily behind the scenes.
29994
29995         Updated docs & news file as per request.
29996
29997         Testsuite: tests the .source attribute and the disabling of
29998         individual locations.
29999
30000         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18385
30001
30002
30003         Change-Id: I302c1c50a557ad59d5d18c88ca19014731d736b0
30004
30005 2022-07-28  yaowenbin  <yaowenbin1@huawei.com>
30006
30007         gdb/gdb_mbuild.sh: use return instead of continue to avoid shellcheck error
30008         Fix:
30009
30010             In gdb_mbuild.sh line 174:
30011                         continue
30012                         ^------^ SC2104 (error): In functions, use return instead of continue.
30013
30014         Change-Id: I5ce95b01359c5cfbb1612f2f48b80bfeea66c96c
30015
30016 2022-07-28  GDB Administrator  <gdbadmin@sourceware.org>
30017
30018         Automatic date update in version.in
30019
30020 2022-07-27  GDB Administrator  <gdbadmin@sourceware.org>
30021
30022         Automatic date update in version.in
30023
30024 2022-07-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
30025
30026         gprofng: check for the makeinfo version
30027         gprofng/ChangeLog
30028         2022-07-25  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
30029
30030                 PR gprofng/29368
30031                 * configure.ac: Check for the makeinfo version.
30032                 * configure: Rebuild.
30033
30034 2022-07-26  Keith Seitz  <keiths@redhat.com>
30035
30036         gdb/linux_nat: Write memory using ptrace if /proc/pid/mem is not writable
30037         Commit 05c06f318fd9a112529dfc313e6512b399a645e4 enabled GDB to access
30038         memory while threads are running.  It did this by accessing
30039         /proc/PID/task/LWP/mem.
30040
30041         Unfortunately, this interface is not implemented for writing in older
30042         kernels (such as RHEL6).  This means that GDB is unable to insert
30043         breakpoints on these hosts:
30044
30045          $ ./gdb -q gdb -ex start
30046          Reading symbols from gdb...
30047          Temporary breakpoint 1 at 0x40fdd5: file ../../src/gdb/gdb.c, line 28.
30048          Starting program: /home/rhel6/fsf/linux/gdb/gdb
30049          Warning:
30050          Cannot insert breakpoint 1.
30051          Cannot access memory at address 0x40fdd5
30052
30053          (gdb)
30054
30055         Before this patch, linux_proc_xfer_memory_partial (previously called
30056         linux_proc_xfer_partial) would return TARGET_XFER_EOF if the write to
30057         /proc/PID/mem failed. [More specifically, linux_proc_xfer_partial
30058         would not "bother for one word," but the effect is the essentially
30059         same.]
30060
30061         This status was checked by linux_nat_target::xfer_partial, which would
30062         then fallback to using ptrace to perform the operation.
30063
30064         This is the specific hunk that removed the fallback:
30065
30066         -  xfer = linux_proc_xfer_partial (object, annex, readbuf, writebuf,
30067         -                                 offset, len, xfered_len);
30068         -  if (xfer != TARGET_XFER_EOF)
30069         -    return xfer;
30070         +      return linux_proc_xfer_memory_partial (readbuf, writebuf,
30071         +                                            offset, len, xfered_len);
30072         +    }
30073
30074            return inf_ptrace_target::xfer_partial (object, annex, readbuf, writebuf,
30075                                                   offset, len, xfered_len);
30076
30077         This patch makes linux_nat_target::xfer_partial go straight to writing
30078         memory via ptrace if writing via /proc/pid/mem is not possible in the
30079         running kernel, enabling GDB to insert breakpoints on these older
30080         kernels.  Note that a recent patch changed the return status from
30081         TARGET_XFER_EOF to TARGET_XFER_E_IO.
30082
30083         Tested on {unix,native-gdbserver,native-extended-gdbserver}/-m{32,64}
30084         on x86_64, s390x, aarch64, and ppc64le.
30085
30086         Change-Id: If1d884278e8c4ea71d8836bedd56e6a6c242a415
30087
30088 2022-07-26  Pedro Alves  <pedro@palves.net>
30089
30090         gdb/linux-nat: Check whether /proc/pid/mem is writable
30091         Probe whether /proc/pid/mem is writable, by using it to write to a GDB
30092         variable.  This will be used in the following patch to avoid falling
30093         back to writing to inferior memory with ptrace if /proc/pid/mem _is_
30094         writable.
30095
30096         Change-Id: If87eff0b46cbe5e32a583e2977a9e17d29d0ed3e
30097
30098 2022-07-26  Tiezhu Yang  <yangtiezhu@loongson.cn>
30099
30100         gdb: LoongArch: Handle the function return value
30101         According to LoongArch ELF ABI specification [1], handle the function
30102         return value of various types.
30103
30104         [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_return_values
30105
30106 2022-07-26  Tiezhu Yang  <yangtiezhu@loongson.cn>
30107
30108         gdb: LoongArch: Fix code style issues
30109         Fix some code style issues suggested by Tom Tromey and Andrew Burgess,
30110         thank you.
30111
30112         (1) Put an introductory comment to explain the purpose for some functions.
30113
30114         (2) Modify the the attribute code to make it portable.
30115
30116         (3) Remove globals and pass pointers to locals.
30117
30118         (4) Remove "*" in the subsequent comment lines.
30119
30120         (5) Put two spaces before "{" and "}".
30121
30122 2022-07-26  Nick Clifton  <nickc@redhat.com>
30123
30124         Stop the linker from complaining about RWX segments in sparc-solaris targets.
30125                 PR 29411
30126                 * configure.tgt (ac_default_ld_warn_rwx_segments): Disable for
30127                 sparc-solaris configurations.
30128
30129 2022-07-26  Tom de Vries  <tdevries@suse.de>
30130
30131         [gdb/testsuite] Fix gdb.opt/inline-small-func.exp with clang
30132         When running test-case gdb.opt/inline-small-func.exp with clang 12.0.1, I run
30133         into:
30134         ...
30135         gdb compile failed, /usr/bin/ld: inline-small-func0.o: in function `main':
30136         inline-small-func.c:21: undefined reference to `callee'
30137         clang-12.0: error: linker command failed with exit code 1 \
30138           (use -v to see invocation)
30139         UNTESTED: gdb.opt/inline-small-func.exp: failed to prepare
30140         ...
30141
30142         Fix this by using __attribute__((always_inline)).
30143
30144         Tested on x86_64-linux.
30145
30146 2022-07-26  Alan Modra  <amodra@gmail.com>
30147
30148         PowerPC32 ld test fails with --enable-targets=all
30149         Three pppc32 ld tests fail when spe support is included in the linker
30150         due to this snippet in ld/emulparams/elf32ppc.sh.
30151
30152         if grep -q 'ld_elf32_spu_emulation' ldemul-list.h; then
30153           DATA_START_SYMBOLS="${RELOCATING+*crt1.o(.data .data.* .gnu.linkonce.d.*)
30154             PROVIDE (__spe_handle = .);
30155             *(.data.spehandle)
30156             . += 4 * (DEFINED (__spe_handle) || . != 0);}"
30157         fi
30158
30159                 * testsuite/ld-powerpc/tlsexe32.r: Pass with .data section present.
30160                 * testsuite/ld-powerpc/tlsexe32no.r: Likewise.
30161                 * testsuite/ld-powerpc/tlsso32.r: Likewise.
30162
30163 2022-07-26  Enze Li  <enze.li@hotmail.com>
30164
30165         gdb/hurd: pass memory_tagged as false to find_memory_region_ftype
30166         I tried building GDB on GNU/Hurd, and ran into this error:
30167
30168           CXX    gnu-nat.o
30169         gnu-nat.c: In member function ‘virtual int gnu_nat_target::find_memory_regions(find_memory_region_ftype, void*)’:
30170         gnu-nat.c:2620:21: error: too few arguments to function
30171          2620 |             (*func) (last_region_address,
30172               |             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
30173          2621 |                      last_region_end - last_region_address,
30174               |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30175          2622 |                      last_protection & VM_PROT_READ,
30176               |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30177          2623 |                      last_protection & VM_PROT_WRITE,
30178               |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30179          2624 |                      last_protection & VM_PROT_EXECUTE,
30180               |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30181          2625 |                      1, /* MODIFIED is unknown, pass it as true.  */
30182               |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30183          2626 |                      data);
30184               |                      ~~~~~
30185         gnu-nat.c:2635:13: error: too few arguments to function
30186          2635 |     (*func) (last_region_address, last_region_end - last_region_address,
30187               |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30188          2636 |              last_protection & VM_PROT_READ,
30189               |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30190          2637 |              last_protection & VM_PROT_WRITE,
30191               |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30192          2638 |              last_protection & VM_PROT_EXECUTE,
30193               |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30194          2639 |              1, /* MODIFIED is unknown, pass it as true.  */
30195               |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30196          2640 |              data);
30197               |              ~~~~~
30198         make[2]: *** [Makefile:1926: gnu-nat.o] Error 1
30199
30200         This is because in this commit:
30201
30202           commit 68cffbbd4406b4efe1aa6e18460b1d7ca02549f1
30203           Date:   Thu Mar 31 11:42:35 2022 +0100
30204
30205               [AArch64] MTE corefile support
30206
30207         Added a new argument to find_memory_region_ftype, but did not pass it to
30208         the function in gnu-nat.c.  Fix this by passing memory_tagged as false.
30209
30210         As Luis pointed out, similar bugs may also appear on FreeBSD and NetBSD,
30211         and I have reproduced them on both systems.  This patch fixes them
30212         incidentally.
30213
30214         Tested by rebuilding on GNU/Hurd, FreeBSD/amd64 and NetBSD/amd64.
30215
30216 2022-07-26  Enze Li  <enze.li@hotmail.com>
30217
30218         gdb/netbsd: add missing header file
30219         I ran into this error when building GDB on NetBSD:
30220
30221           CXX    netbsd-nat.o
30222         netbsd-nat.c: In member function 'virtual bool nbsd_nat_target::info_proc(const char*, info_proc_what)':
30223         netbsd-nat.c:314:3: error: 'gdb_argv' was not declared in this scope
30224            gdb_argv built_argv (args);
30225            ^~~~~~~~
30226         netbsd-nat.c:314:3: note: suggested alternative: 'gdbarch'
30227            gdb_argv built_argv (args);
30228            ^~~~~~~~
30229            gdbarch
30230         netbsd-nat.c:315:7: error: 'built_argv' was not declared in this scope
30231            if (built_argv.count () == 0)
30232                ^~~~~~~~~~
30233         netbsd-nat.c:315:7: note: suggested alternative: 'buildargv'
30234            if (built_argv.count () == 0)
30235                ^~~~~~~~~~
30236                buildargv
30237         gmake[2]: *** [Makefile:1893: netbsd-nat.o] Error 1
30238
30239         Fix this by adding the missing header file, as it is obvious.
30240
30241         Tested by rebuilding on NetBSD/amd64.
30242
30243 2022-07-26  Nick Clifton  <nickc@redhat.com>
30244
30245         Updated translations for various sub-directories
30246
30247 2022-07-26  Andrew Burgess  <aburgess@redhat.com>
30248
30249         gdb: rename gdbarch_tdep struct to fix g++ 4.8 build
30250         After the commit:
30251
30252           commit 08106042d9f5fdff60c129bf33190639f1a98b2a
30253           Date:   Thu May 19 13:20:17 2022 +0100
30254
30255               gdb: move the type cast into gdbarch_tdep
30256
30257         GDB would no longer build using g++ 4.8.  The issue appears to be some
30258         confusion caused by GDB having 'struct gdbarch_tdep', but also a
30259         templated function called 'gdbarch_tdep'.  Prior to the above commit
30260         the gdbarch_tdep function was not templated, and this compiled just
30261         fine.  Note that the above commit compiles just fine with later
30262         versions of g++, so this issue was clearly fixed at some point, though
30263         I've not tried to track down exactly when.
30264
30265         In this commit I propose to fix the g++ 4.8 build problem by renaming
30266         'struct gdbarch_tdep' to 'struct gdbarch_tdep_base'.  This rename
30267         better represents that the struct is only ever used as a base class,
30268         and removes the overloading of the name, which allows GDB to build
30269         with g++ 4.8.
30270
30271         I've also updated the comment on 'struct gdbarch_tdep_base' to fix a
30272         typo, and the comment on the 'gdbarch_tdep' function, to mention that
30273         in maintainer mode a run-time type check is performed.
30274
30275 2022-07-26  Nick Clifton  <nickc@redhat.com>
30276
30277         Fix indentation in loongarch code, preventing a compile time warning.
30278
30279 2022-07-26  Lancelot SIX  <lancelot.six@amd.com>
30280
30281         gdb/varobj: Fix varobj_invalidate_iter
30282         The varobj_invalidate function is meant to be called when restarting a
30283         process, and check at this point if some of the previously existing
30284         varobj can be recreated in the context of the new process.
30285
30286         Two kind of varobj are subject to re-creation:  global varobj (i.e.
30287         varobj which reference a global variable), and floating varobj (i.e.
30288         varobj which are always re-evaluated in the context of whatever is
30289         the currently selected frame at the time of evaluation).
30290
30291         However, in the re-creation process, the varobj_invalidate_iter
30292         recreates floating varobj as non-floating, due to an invalid parameter.
30293         This patches fixes this and adds an assertion to check that if a varobj
30294         is indeed recreated, it matches the original varobj "floating" property.
30295
30296         Another issue is that if at this recreation time the expression watched
30297         by the floating varobj is not in scope, then the varobj is marked as
30298         invalid.  If later the user selects a frame where the expression becomes
30299         valid, the varobj remains invalid and this is wrong.  This patch also
30300         make sure that floating varobj are not invalidated if they cannot be
30301         evaluated.
30302
30303         The last important thing to note is that due to the previous patch, when
30304         varobj_invalidate is executed (in the context of a new process), any
30305         global var have already been invalidated (this has been done when the
30306         objfile it referred to got invalidated).  As a consequence,
30307         varobj_invalidate tries to recreate vars which are already marked as
30308         invalid.  This does not entirely feels right, but I keep this behavior
30309         for backward compatibility.
30310
30311         Tested on x86_64-linux
30312
30313 2022-07-26  Lancelot SIX  <lancelot.six@amd.com>
30314
30315         gdb/varobj: Fix use after free in varobj
30316         Varobj object contains references to types, variables (i.e. struct
30317         variable) and expression.  All of those can reference data on an
30318         objfile's obstack.  It is possible for this objfile to be deleted (and
30319         the obstack to be feed), while the varobj remains valid.  Later, if the
30320         user uses the varobj, this will result in a use-after-free error.  With
30321         address sanitizer build, this leads to a plain error.  For non address
30322         sanitizer build we might see undefined behaviour, which manifest
30323         themself as assertion failures when accessing data backed by feed
30324         memory.
30325
30326         This can be observed if we create a varobj that refers to ta symbol in a
30327         shared library, after either the objfile gets reloaded (using the `file`
30328         command) or after the shared library is unloaded (with a call to dlclose
30329         for example).
30330
30331         This patch fixes those issues by:
30332
30333         - Adding cleanup procedure to the free_objfile observable.  When
30334           activated this observer clears expressions referencing the objfile
30335           being freed, and removes references to blocks belonging to this
30336           objfile.
30337         - Adding varobj support in the `preserve_values` (gdb.value.c).  This
30338           ensures that before the objfile is unloaded, any type owned by the
30339           objfile referenced by the varobj is replaced by an equivalent type
30340           not owned by the objfile.  This process is done here instead of in the
30341           free_objfile observer in order to reuse the type hash table already
30342           used for similar purpose when replacing types of values kept in the
30343           value history.
30344
30345         This patch also makes sure to keep a reference to the expression's
30346         gdbarch and language_defn members when the varobj->root->exp is
30347         initialized.  Those structures outlive the objfile, so this is safe.
30348         This is done because those references might be used initialize a python
30349         context even after exp is invalidated.  Another approach could have been
30350         to initialize the python context with default gdbarch and language_defn
30351         (i.e. nullptr) if expr is NULL, but since we might still try to display
30352         the value which was obtained by evaluating exp when it was still valid,
30353         keeping track of the context which was used at this time seems
30354         reasonable.
30355
30356         Tested on x86_64-Linux.
30357
30358         Co-Authored-By: Pedro Alves <pedro@palves.net>
30359
30360 2022-07-26  Pedro Alves  <pedro@palves.net>
30361
30362         MI: mi_runto -pending
30363         With the CLI testsuite's runto proc, we can pass "allow-pending" as an
30364         option, like:
30365
30366           runto func allow-pending
30367
30368         That is currently not possible with MI's mi_runto, however.  This
30369         patch makes it possible, by adding a new "-pending" option to
30370         mi_runto.
30371
30372         A pending breakpoint shows different MI attributes compared to a
30373         breakpoint with a location, so the regexp returned by
30374         mi_make_breakpoint isn't suitable.  Thus, add a new
30375         mi_make_breakpoint_pending proc for pending breakpoints.
30376
30377         Tweak mi_runto to let it take and pass down arguments.
30378
30379         Change-Id: I185fef00ab545a1df2ce12b4dbc3da908783a37c
30380
30381 2022-07-26  GDB Administrator  <gdbadmin@sourceware.org>
30382
30383         Automatic date update in version.in
30384
30385 2022-07-25  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30386
30387         gprofng: fix bug 29356 - Execution fails if gprofng is not included in PATH
30388         gprofng/Changelog:
30389         2022-07-22  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30390
30391                 PR gprofng/29356
30392                 * gp-display-html/gp-display-html.in: fixed a problem to execute
30393                 gp-display-text in case gprofng is not included in the search
30394                 path.
30395
30396 2022-07-25  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30397
30398         gprofng: fix bug 29392 - Unexpected line format in summary file
30399         gprofng/Changelog:
30400         2022-07-22  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30401
30402                 PR gprofng/29392
30403                 * gp-display-html/gp-display-html.in: modified a regex, plus the
30404                 code to handle the results; renamed a variable to improve the
30405                 consistency in naming.
30406
30407 2022-07-25  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30408
30409         gprofng: fix bug 29353 - Fix a lay-out issue in the html disassembly files
30410         gprofng/Changelog:
30411         2022-07-22  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30412
30413                 PR gprofng/29353
30414                 * gp-display-html/gp-display-html.in: fixed a problem in the
30415                 generation of html for the disassembly where instructions
30416                 without arguments were not handled correctly.
30417
30418 2022-07-25  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30419
30420         gprofng: fix bug 29352 - Fix the message Hexadecimal number > 0xffffffff non-portable
30421         gprofng/Changelog:
30422         2022-07-22  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30423
30424                 PR gprofng/29352
30425                 * gp-display-html/gp-display-html.in: the hex subroutine from
30426                 the bigint module is now used.
30427
30428 2022-07-25  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30429
30430         gprofng: fix bug 29351 - Move dynamic loading of modules to a later stage
30431         gprofng/Changelog:
30432         2022-07-22  Ruud van der Pas  <ruud.vanderpas@oracle.com>
30433
30434                 PR gprofng/29351
30435                 * gp-display-html/gp-display-html.in: the dynamic loading of
30436                 modules occurred too early, resulting in the generation of the
30437                 man page to fail in case a module is missing; the loading part is
30438                 now done somewhat later in the execution to avoid this problem.
30439
30440 2022-07-25  Kevin Buettner  <kevinb@redhat.com>
30441
30442         set/show python dont-write-bytecode fixes
30443         GDB uses the environment variable PYTHONDONTWRITEBYTECODE to
30444         determine whether or not to write the result of byte-compiling
30445         python modules when the "python dont-write-bytecode" setting
30446         is "auto".  Simon noticed that GDB's implementation doesn't
30447         follow the Python documentation.
30448
30449         At present, GDB only checks for the existence of this environment
30450         variable.  That is not sufficient though.  Regarding
30451         PYTHONDONTWRITEBYTECODE, this document...
30452
30453             https://docs.python.org/3/using/cmdline.html
30454
30455         ...says:
30456
30457             If this is set to a non-empty string, Python won't try to write
30458             .pyc files on the import of source modules.
30459
30460         This commit fixes GDB's handling of PYTHONDONTWRITEBYTECODE by adding
30461         an empty string check.
30462
30463         This commit also corrects the set/show command documentation for
30464         "python dont-write-bytecode".  The current doc was just a copy
30465         of that for set/show python ignore-environment.
30466
30467         During his review of an earlier version of this patch, Eli Zaretskii
30468         asked that the help text that I proposed for "set/show python
30469         dont-write-bytecode" be expanded.  I've done that in addition to
30470         clarifying the documentation of this option in the GDB manual.
30471
30472 2022-07-25  Andrew Burgess  <aburgess@redhat.com>
30473
30474         gdb/python: fix invalid use disassemble_info::stream
30475         After this commit:
30476
30477           commit 81384924cdcc9eb2676dd9084b76845d7d0e0759
30478           Date:   Tue Apr 5 11:06:16 2022 +0100
30479
30480               gdb: have gdb_disassemble_info carry 'this' in its stream pointer
30481
30482         The disassemble_info::stream field will no longer be a ui_file*.  That
30483         commit failed to update one location in py-disasm.c though.
30484
30485         While running some tests using the Python disassembler API, I
30486         triggered a call to gdbpy_disassembler::print_address_func, and, as I
30487         had compiled GDB with the undefined behaviour sanitizer, GDB crashed
30488         as the code currently (incorrectly) casts the stream field to be a
30489         ui_file*.
30490
30491         In this commit I fix this error.
30492
30493         In order to test this case I had to tweak the existing test case a
30494         little.  I also spotted some debug printf statements in py-disasm.py,
30495         which I have removed.
30496
30497 2022-07-25  Andrew Burgess  <aburgess@redhat.com>
30498
30499         gdb: fix use of uninitialised gdb_printing_disassembler::m_in_comment
30500         Simon pointed out that gdb_printing_disassembler::m_in_comment can be
30501         used uninitialised by the Python disassembler API code.  This issue
30502         was spotted when GDB was built with the undefined behaviour sanitizer,
30503         and causes the gdb.python/py-disasm.exp test to fail like this:
30504
30505           (gdb) PASS: gdb.python/py-disasm.exp: global_disassembler=GlobalPreInfoDisassembler: python add_global_disassembler(GlobalPreInfoDisassembler)
30506           disassemble main
30507           Dump of assembler code for function main:
30508              0x0000555555555119 <+0>:     push   %rbp
30509              0x000055555555511a <+1>:     mov    %rsp,%rbp
30510              0x000055555555511d <+4>:     nop
30511           /home/user/src/binutils-gdb/gdb/disasm.h:144:12: runtime error: load of value 118, which is not a valid value for type 'bool'
30512
30513         The problem is that in disasmpy_builtin_disassemble we create a new
30514         instance of gdbpy_disassembler, which is a sub-class of
30515         gdb_printing_disassembler, however, the m_in_comment field is never
30516         initialised.
30517
30518         This commit fixes the issue by providing a default initialisation
30519         value for m_in_comment in disasm.h.  As we only ever disassemble a
30520         single instruction in disasmpy_builtin_disassemble then we don't need
30521         to worry about reseting m_in_comment back to false after the single
30522         instruction has been disassembled.
30523
30524         With this commit the above issue is resolved and
30525         gdb.python/py-disasm.exp now passes.
30526
30527 2022-07-25  H.J. Lu  <hjl.tools@gmail.com>
30528
30529         ld: Compile 2 CTF tests with -O2
30530         When GCC 12 is used to build binutils with -O0, the following 2 tests
30531         failed:
30532
30533         FAIL: Conflicted data syms, partially indexed, stripped, with variables
30534         FAIL: Conflicted data syms, partially indexed, stripped
30535
30536         Compile 2 tests with -O2 to avoid test failures.
30537
30538                 PR ld/29378
30539                 * testsuite/ld-ctf/data-func-conflicted-vars.d: Compile with -O2.
30540                 * testsuite/ld-ctf/data-func-conflicted.d: Likewise.
30541
30542 2022-07-25  Pedro Alves  <pedro@palves.net>
30543
30544         struct packed: Add fallback byte array implementation
30545         Attribute gcc_struct is not implemented in Clang targeting Windows, so
30546         add a fallback standard-conforming implementation based on arrays.
30547
30548         I ran the testsuite on x86_64 GNU/Linux with this implementation
30549         forced, and saw no regressions.
30550
30551         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29373
30552
30553         Change-Id: I023315ee03622c59c397bf4affc0b68179c32374
30554
30555 2022-07-25  Pedro Alves  <pedro@palves.net>
30556
30557         struct packed: Unit tests and more operators
30558         For PR gdb/29373, I wrote an alternative implementation of struct
30559         packed that uses a gdb_byte array for internal representation, needed
30560         for mingw+clang.  While adding that, I wrote some unit tests to make
30561         sure both implementations behave the same.  While at it, I implemented
30562         all relational operators.  This commit adds said unit tests and
30563         relational operators.  The alternative gdb_byte array implementation
30564         will come next.
30565
30566         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29373
30567
30568         Change-Id: I023315ee03622c59c397bf4affc0b68179c32374
30569
30570 2022-07-25  Pedro Alves  <pedro@palves.net>
30571
30572         struct packed: Use gcc_struct on Windows
30573         Building GDB on mingw/gcc hosts is currently broken, due to a static
30574         assertion failure in gdbsupport/packed.h:
30575
30576           In file included from ../../../../../binutils-gdb/gdb/../gdbsupport/common-defs.h:201,
30577                            from ../../../../../binutils-gdb/gdb/defs.h:28,
30578                            from ../../../../../binutils-gdb/gdb/dwarf2/read.c:31:
30579           ../../../../../binutils-gdb/gdb/../gdbsupport/packed.h: In instantiation of 'packed<T, Bytes>::packed(T) [with T = dwarf_unit_type; long long unsigned int Bytes = 1]':
30580           ../../../../../binutils-gdb/gdb/dwarf2/read.h:181:74:   required from here
30581           ../../../../../binutils-gdb/gdb/../gdbsupport/packed.h:41:40: error: static assertion failed
30582              41 |     gdb_static_assert (sizeof (packed) == Bytes);
30583                 |                        ~~~~~~~~~~~~~~~~^~~~~~~~
30584           ../../../../../binutils-gdb/gdb/../gdbsupport/gdb_assert.h:27:48: note: in definition of macro 'gdb_static_assert'
30585              27 | #define gdb_static_assert(expr) static_assert (expr, "")
30586                 |                                                ^~~~
30587           ../../../../../binutils-gdb/gdb/../gdbsupport/packed.h:41:40: note: the comparison reduces to '(4 == 1)'
30588              41 |     gdb_static_assert (sizeof (packed) == Bytes);
30589                 |                        ~~~~~~~~~~~~~~~~^~~~~~~~
30590
30591
30592         The issue is that mingw gcc defaults to "-mms-bitfields", which
30593         affects how bitfields are laid out.  We can however tell GCC that we
30594         want the regular GCC layout instead using attribute gcc_struct.
30595
30596         Attribute gcc_struct is not implemented in "clang -target
30597         x86_64-pc-windows-gnu", so that will need a different fix.
30598
30599         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29373
30600
30601         Change-Id: I023315ee03622c59c397bf4affc0b68179c32374
30602
30603 2022-07-25  Andrew Burgess  <aburgess@redhat.com>
30604
30605         binutils-gdb/git: highlight whitespace errors in source files
30606         For a long time I've had this in my ~/.gitconfig:
30607
30608           [core]
30609                   whitespace = space-before-tab,indent-with-non-tab,trailing-space
30610
30611         which causes git to show me if I muck up and use spaces instead of
30612         tabs, or leave in trailing whitespace.  I find this really useful.
30613
30614         I recently proposed adding something like this to the .gitattributes
30615         files for the GDB sub-directories (gdb, gdbsupport, and gdbserver)[1],
30616         however, the question was asked - couldn't this be done at the top
30617         level?
30618
30619         So, in this commit, I propose to update the top-level .gitattributes
30620         file, after this commit, any git diff on a C, C++, Expect, or TCL
30621         source file, will highlight the following whitespace errors:
30622
30623           (a) Use a space before a tab at the start of a line,
30624
30625           (b) Use of spaces where a tab could be used at the start of a line,
30626           and
30627
30628           (c) Any trailing whitespace.
30629
30630         Errors are only highlighted in the diff on new or modified lines, so
30631         you don't get spammed for errors on context lines that you haven't
30632         modified.
30633
30634         The only downside I see to adding this at the top level is if there
30635         are any sub-directories that don't follow the tabs/spaces indentation
30636         rules very well already, in those directories you'll end up hitting
30637         issues any time you edit a line.  For GDB we're usually pretty good,
30638         so having this highlighting isn't an issue.
30639
30640         [1] https://sourceware.org/pipermail/gdb-patches/2022-July/190843.html
30641
30642 2022-07-25  Yvan Roux  <yvan.roux@foss.st.com>
30643
30644         gdb/arm: Sync sp with other *sp registers
30645         For Arm Cortex-M33 with security extensions, there are 4 different
30646         stack pointers (msp_s, msp_ns, psp_s, psp_ns), without security
30647         extensions and for other Cortex-M targets, there are 2 different
30648         stack pointers (msp and psp).
30649
30650         With this patch, sp will always be in sync with one of the real stack
30651         pointers on Arm targets that contain more than one stack pointer.
30652
30653 2022-07-25  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
30654
30655         gdb/arm: Use if-else if instead of switch
30656         As the register numbers for the alternative Arm SP registers are not
30657         constant, it's not possible to use switch statement to define the
30658         rules.  In order to not have a mix, replace the few existing
30659         switch statements with regular if-else if statements
30660
30661 2022-07-25  Tom Tromey  <tromey@adacore.com>
30662
30663         Remove dead code from windows_nat_target::detach
30664         windows_nat_target::detach has a variable 'detached' that is only set
30665         after a call to 'error'.  However, this can't happen because 'error'
30666         throws an exception.
30667
30668         This patch removes the dead code.
30669
30670 2022-07-25  Andrew Burgess  <aburgess@redhat.com>
30671
30672         gdb: handle dis_style_sub_mnemonic disassembler style
30673         In commit:
30674
30675           commit 4f46c0bc36471b725de0253bfec1a42a36e2c5c5
30676           Date:   Mon Jul 4 17:45:25 2022 +0100
30677
30678               opcodes: add new sub-mnemonic disassembler style
30679
30680         I added a new disassembler style dis_style_sub_mnemonic, but forgot to
30681         add GDB support for this style.  Fix this oversight in this commit.
30682
30683 2022-07-25  Andrew Burgess  <aburgess@redhat.com>
30684
30685         libopcodes/ppc: add support for disassembler styling
30686         This commit adds disassembler styling to the libopcodes ppc
30687         disassembler.  This conversion was pretty straight forward, I just
30688         converted the fprintf_func calls to fprintf_styled_func calls and
30689         added an appropriate style.
30690
30691         For testing the new styling I just assembled then disassembled the
30692         source files in gas/testsuite/gas/ppc and manually checked that the
30693         styling looked reasonable.
30694
30695         I think the only slightly weird case was how things like '4*cr1+eq'
30696         are styled.  As best I can tell, this construct, used for example in
30697         this instruction:
30698
30699           crand   4*cr1+lt,4*cr1+gt,4*cr1+eq
30700
30701         is used to access a field of a control register.  I initially tried
30702         styling this whole construct as a register[1], but during review it
30703         was suggested that instead different parts of the text should have
30704         different styles.  In this commit I propose styling '4*cr1+lt' like
30705         this:
30706
30707           4    - immediate,
30708           *    - text,
30709           cr1  - register
30710           +    - text
30711           lt   - sub-mnemonic
30712
30713         If the user does not request styled output from objdump, then there
30714         should be no change in the disassembler output after this commit.
30715
30716         [1] https://sourceware.org/pipermail/binutils/2022-July/121771.html
30717
30718 2022-07-25  Andrew Burgess  <aburgess@redhat.com>
30719
30720         opcodes: add new sub-mnemonic disassembler style
30721         When adding libopcodes disassembler styling support for AArch64, it
30722         feels like the results would be improved by having a new sub-mnemonic
30723         style.  This will be used in cases like:
30724
30725           add    w16, w7, w1, uxtb #2
30726                               ^^^^----- Here
30727
30728         And:
30729
30730           cinc   w0, w1, ne
30731                          ^^----- Here
30732
30733         This commit just adds the new style, and prepares objdump to handle
30734         the style.  A later commit will add AArch64 styling, and will actually
30735         make use of the style.
30736
30737         As this style is currently unused, there should be no user visible
30738         changes after this commit.
30739
30740 2022-07-25  liuzhensong  <liuzhensong@loongson.cn>
30741
30742         LoongArch: Add testcases for new relocate types.
30743           gas/testsuite/gas/all/
30744             gas.exp
30745           gas/testsuite/gas/loongarch/
30746             jmp_op.d
30747             jmp_op.s
30748             macro_op.d
30749             macro_op.s
30750             macro_op_32.d
30751             macro_op_32.s
30752             macro_op_large_abs.d
30753             macro_op_large_abs.s
30754             macro_op_large_pc.d
30755             macro_op_large_pc.s
30756             reloc.d
30757             reloc.s
30758
30759           ld/testsuite/ld-elf/
30760             pr26936.d
30761             shared.exp
30762           ld/testsuite/ld-loongarch-elf/
30763             attr-ifunc-4.c
30764             attr-ifunc-4.out
30765             disas-jirl.d
30766             ifunc.exp
30767             jmp_op.d
30768             jmp_op.s
30769             libnopic-global.s
30770             macro_op.d
30771             macro_op.s
30772             macro_op_32.d
30773             macro_op_32.s
30774             nopic-global-so.rd
30775             nopic-global-so.sd
30776             nopic-global.out
30777             nopic-global.s
30778             nopic-global.sd
30779             nopic-global.xd
30780             nopic-local.out
30781             nopic-local.rd
30782             nopic-local.s
30783             nopic-local.sd
30784             nopic-local.xd
30785             nopic-weak-global-so.rd
30786             nopic-weak-global-so.sd
30787             nopic-weak-global.out
30788             nopic-weak-global.s
30789             nopic-weak-global.sd
30790             nopic-weak-global.xd
30791             nopic-weak-local.out
30792             nopic-weak-local.rd
30793             nopic-weak-local.s
30794             nopic-weak-local.sd
30795             nopic-weak-local.xd
30796             pic.exp
30797             pic.ld
30798
30799 2022-07-25  liuzhensong  <liuzhensong@loongson.cn>
30800
30801         bfd: Delete R_LARCH_NONE from dyn info of LoongArch.
30802           Some R_LARCH_64 in section .eh_frame will to generate
30803           R_LARCH_NONE, we change relocation to R_LARCH_32_PCREL
30804           from R_LARCH_64 in setction .eh_frame and not generate
30805           dynamic relocation for R_LARCH_32_PCREL.
30806
30807           Add New relocate type R_LARCH_32_PCREL for .eh_frame.
30808
30809           include/elf/
30810             loongarch.h
30811
30812           bfd/
30813             bfd/bfd-in2.h
30814             libbfd.h
30815             reloc.c
30816             elfxx-loongarch.c
30817             elfnn-loongarch.c
30818
30819           gas/config/
30820             tc-loongarch.c
30821
30822           binutils/
30823             readelf.c
30824
30825           ld/testsuite/ld-elf/
30826             eh5.d
30827
30828 2022-07-25  liuzhensong  <liuzhensong@loongson.cn>
30829
30830         LoongArch: Move ifunc info to rela.dyn from rela.plt.
30831           Delete R_LARCH_IRELATIVE from dynamic loader (glibc ld.so) when
30832           loading lazy function (rela.plt section).
30833
30834           In dynamic programes, move ifunc dynamic relocate info to section
30835           srelgot from srelplt.
30836
30837           bfd/
30838             elfnn-loongarch.c
30839
30840 2022-07-25  liuzhensong  <liuzhensong@loongson.cn>
30841
30842         LoongArch: gas: Add new reloc types.
30843           Generate new relocate types while use new macro insns.
30844
30845           gas/config/
30846             loongarch-lex.h
30847             loongarch-parse.y
30848             tc-loongarch.c
30849             tc-loongarch.h
30850
30851 2022-07-25  liuzhensong  <liuzhensong@loongson.cn>
30852
30853         LoongArch:opcodes: Add new reloc types.
30854           opcodes: Replace old insns with news and generate new relocate types
30855           while macro insns expanding.
30856
30857           opcodes/
30858             loongarch-opc.c
30859
30860 2022-07-25  liuzhensong  <liuzhensong@loongson.cn>
30861
30862         bfd: Add supported for LoongArch new relocations.
30863           Define new reloc types according to linker needs.
30864
30865           include/elf/
30866             loongarch.h
30867
30868           bfd/
30869             bfd-in2.h
30870             libbfd.h
30871             reloc.c
30872             elfnn-loongarch.c
30873             elfxx-loongarch.c
30874             elfxx-loongarch.h
30875
30876 2022-07-25  Alan Modra  <amodra@gmail.com>
30877
30878         Re: PowerPC64 .branch_lt address
30879         On seeing PR29369 my suspicion was naturally on a recent powerpc64
30880         change, commit 0ab80031430e.  Without a reproducer, I spent time
30881         wondering what could have gone wrong, and while I doubt this patch
30882         would have fixed the PR, there are some improvements that can be made
30883         to cater for user silliness.
30884
30885         I also noticed that when -z relro -z now sections are created out of
30886         order, with .got before .plt in the section headers but .got is laid
30887         out at a higher address.  That's due to the address expression for
30888         .branch_lt referencing SIZEOF(.got) and so calling init_os (which
30889         creates a bfd section) for .got before the .plt section is created.
30890         Fix that by ignoring SIZEOF in exp_init_os.  Unlike ADDR and LOADADDR
30891         which need to reference section vma and lma respectively, SIZEOF can
30892         and does cope with a missing bfd section by returning zero for its
30893         size, which of course is correct.
30894
30895                 PR 29369
30896                 * ldlang.c (exp_init_os): Don't create a bfd section for SIZEOF.
30897                 * emulparams/elf64ppc.sh (OTHER_RELRO_SECTIONS_2): Revise
30898                 .branch_lt address to take into account possible user sections
30899                 with alignment larger than 8 bytes.
30900
30901 2022-07-25  GDB Administrator  <gdbadmin@sourceware.org>
30902
30903         Automatic date update in version.in
30904
30905 2022-07-24  Enze Li  <enze.li@hotmail.com>
30906
30907         gdb/testsuite: add a clear test to py-breakpoint.exp
30908         This patch adds a test case to try to clear an internal python
30909         breakpoint using the clear command.
30910
30911         This was suggested by Pedro during a code review of the following
30912         commit.
30913
30914           commit a5c69b1e49bae4d0dcb20f324cebb310c63495c6
30915           Date:   Sun Apr 17 15:09:46 2022 +0800
30916
30917             gdb: fix using clear command to delete non-user breakpoints(PR cli/7161)
30918
30919         Tested on x86_64 openSUSE Tumbleweed.
30920
30921 2022-07-24  Enze Li  <enze.li@hotmail.com>
30922
30923         gdb/testsuite: rename get_maint_bp_addr and move it to gdb-utils.exp
30924         The get_maint_bp_addr procedure will be shared by other test suite, so
30925         move it to gdb-utils.exp.
30926
30927         Following Andrew's suggestion, I renamed get_maint_bp_addr to
30928         gdb_get_bp_addr, since it would have handled normal breakpoints in
30929         addition to the internal ones.  Note that there is still room for
30930         improvement in this procedure, which I indicated in comments nearby.
30931
30932 2022-07-24  GDB Administrator  <gdbadmin@sourceware.org>
30933
30934         Automatic date update in version.in
30935
30936 2022-07-23  GDB Administrator  <gdbadmin@sourceware.org>
30937
30938         Automatic date update in version.in
30939
30940 2022-07-22  Tom de Vries  <tdevries@suse.de>
30941
30942         [gdb/symtab] Fix duplicate CUs in all_comp_units
30943         When running test-case gdb.cp/cpexprs-debug-types.exp with target board
30944         cc-with-debug-names on a system with gcc 12.1.1 (defaulting to dwarf 5), I
30945         run into:
30946         ...
30947         (gdb) file cpexprs-debug-types^M
30948         Reading symbols from cpexprs-debug-types...^M
30949         warning: Section .debug_aranges in cpexprs-debug-types has duplicate \
30950           debug_info_offset 0x0, ignoring .debug_aranges.^M
30951         gdb/dwarf2/read.h:309: internal-error: set_length: \
30952           Assertion `m_length == length' failed.^M
30953         ...
30954
30955         The exec contains a .debug_names section, which gdb rejects due to
30956         .debug_names containing a list of TUs, while the exec doesn't contain a
30957         .debug_types section (which is what you'd expect for dwarf 4).
30958
30959         Gdb then falls back onto the cooked index, which calls create_all_comp_units
30960         to create all_comp_units.  However, the failed index reading left some
30961         elements in all_comp_units, so we end up with duplicates in all_comp_units,
30962         which causes the misleading complaint and the assert.
30963
30964         Fix this by:
30965         - asserting at the start of create_all_comp_units that all_comp_units is empty,
30966           as we do in create_cus_from_index and create_cus_from_debug_names, and
30967         - cleaning up all_comp_units when failing in dwarf2_read_debug_names.
30968
30969         Add a similar cleanup in dwarf2_read_gdb_index.
30970
30971         Tested on x86_64-linux.
30972
30973         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29381
30974
30975 2022-07-22  Simon Marchi  <simon.marchi@polymtl.ca>
30976
30977         gdb/testsuite: give binaries distinct names in Ada tests
30978         Some Ada tests repeat their test sequence with different gnat-encodings,
30979         typically "all" and "minimal".  However, they give the same name to both
30980         binaries, meaning the second run overwrites the binary of the first run.
30981         This makes it difficult and confusing when trying to reproduce problems
30982         manually with the test artifacts.  Change those tests to use unique
30983         names for each pass.
30984
30985         Change-Id: Iaa3c9f041241249a7d67392e785c31aa189dcc88
30986
30987 2022-07-22  Tom Tromey  <tromey@adacore.com>
30988
30989         Change target_ops::async to accept bool
30990         This changes the parameter of target_ops::async from int to bool.
30991         Regression tested on x86-64 Fedora 34.
30992
30993         Fix typo in windows-nat.c
30994         I noticed a typo in a printf in windows-nat.c.  This fixes it.
30995
30996 2022-07-22  Tom de Vries  <tdevries@suse.de>
30997
30998         [gdb] Add empty range unit test for gdb::parallel_for_each
30999         Add a unit test that verifies that we can call gdb::parallel_for_each with an
31000         empty range.
31001
31002         Tested on x86_64-linux.
31003
31004 2022-07-22  Alan Modra  <amodra@gmail.com>
31005
31006         PR17122, OSX 10.9 build failure
31007         sbrk hasn't been used in binutils/ or ld/ for quite some time (so the
31008         PR was fixed a while ago).  Tidy up configury.
31009
31010                 PR 17122
31011         binutils/
31012                 * configure.ac: Don't check for sbrk.
31013                 * sysdep.h (sbrk): Don't supply fallback declaration.
31014                 * config.in: Regenerate.
31015                 * configure: Regenerate.
31016         ld/
31017                 * configure.ac: Don't check for sbrk.
31018                 * config.in: Regenerate.
31019                 * configure: Regenerate.
31020
31021 2022-07-22  Jiangshuai Li  <jiangshuai_li@linux.alibaba-inc.com>
31022
31023         gdb/csky modify registers list for general_reggroup
31024         There are two modification points here:
31025         1. For the debugging of csky architecture, after executing "info register",
31026            we hope to print out GPRs, PC and the registers related to exceptions.
31027         2. With tdesc-xml, users can view the register groups described in XML.
31028
31029 2022-07-22  Alan Modra  <amodra@gmail.com>
31030
31031         PR15951, binutils testsuite builds status wrapper unconditionally
31032                 PR 15951
31033                 * testsuite/binutils-all/objcopy.exp: Build testglue.o when
31034                 needs_status_wrapper.
31035
31036 2022-07-22  GDB Administrator  <gdbadmin@sourceware.org>
31037
31038         Automatic date update in version.in
31039
31040 2022-07-21  Peter Bergner  <bergner@linux.ibm.com>
31041
31042         Add ChangeLog entry from previous commit
31043
31044 2022-07-21  Peter Bergner  <bergner@linux.ibm.com>
31045
31046         PowerPC: Create new MMA instruction masks and use them
31047         The MMA instructions use XX3_MASK|3<<21 as an instruction mask, but that
31048         misses the RC bit/bit 31, so if we disassemble a .long that represents an
31049         MMA instruction except that it also has bit 31 set, we will erroneously
31050         disassemble it to that MMA instruction.  We create new masks defines that
31051         contain bit 31 so that doesn't happen anymore.
31052
31053         opcodes/
31054                 * ppc-opc.c (XACC_MASK, XX3ACC_MASK): New defines.
31055                 (P_GER_MASK, xxmfacc, xxmtacc, xxsetaccz, xvi8ger4pp, xvi8ger4,
31056                 xvf16ger2pp, xvf16ger2, xvf32gerpp, xvf32ger, xvi4ger8pp, xvi4ger8,
31057                 xvi16ger2spp, xvi16ger2s, xvbf16ger2pp, xvbf16ger2, xvf64gerpp,
31058                 xvf64ger, xvi16ger2, xvf16ger2np, xvf32gernp, xvi8ger4spp, xvi16ger2pp,
31059                 xvbf16ger2np, xvf64gernp, xvf16ger2pn, xvf32gerpn, xvbf16ger2pn,
31060                 xvf64gerpn, xvf16ger2nn, xvf32gernn, xvbf16ger2nn, xvf64gernn: Use them.
31061
31062 2022-07-21  H.J. Lu  <hjl.tools@gmail.com>
31063
31064         i386: Don't allow GOTOFF relocation against IFUNC symbol for PIC
31065         We can't use the PLT entry as the function address for PIC since the PIC
31066         register may not be set up properly for indirect call.
31067
31068         bfd/
31069
31070                 PR ld/27998
31071                 * elf32-i386.c (elf_i386_relocate_section): Don't allow GOTOFF
31072                 relocation against IFUNC symbol for PIC.
31073
31074         ld/
31075
31076                 PR ld/27998
31077                 * testsuite/ld-i386/pr27998a.d: Replace -shared with -e bar.
31078                 * testsuite/ld-i386/pr27998b.d: Expect a linker error.
31079                 * testsuite/ld-ifunc/ifunc-2-i386-now.d: Updated.
31080                 * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
31081                 * testsuite/ld-ifunc/ifunc-2-i386.s: Replace @GOTOFF with @GOT.
31082                 * testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise.
31083
31084 2022-07-21  Andrew Burgess  <aburgess@redhat.com>
31085
31086         gdb: ensure the cast in gdbarch_tdep is valid
31087         This commit makes use of gdb::checked_static_cast when casting the
31088         generic gdbarch_tdep pointer to a specific sub-class type.  This means
31089         that, when compiled in developer mode, GDB will validate that the cast
31090         is correct.
31091
31092         In order to use gdb::checked_static_cast the types involved must have
31093         RTTI, which is why the gdbarch_tdep base class now has a virtual
31094         destructor.
31095
31096         Assuming there are no bugs in GDB where we cast a gdbarch_tdep pointer
31097         to the wrong type, then there should be no changes after this commit.
31098
31099         If any bugs do exist, then GDB will now assert (in a developer build).
31100
31101 2022-07-21  Andrew Burgess  <aburgess@redhat.com>
31102
31103         gdbsupport: add checked_static_cast
31104         This commit was inspired by these mailing list posts:
31105
31106           https://sourceware.org/pipermail/gdb-patches/2022-June/190323.html
31107           https://sourceware.org/pipermail/gdb-patches/2022-April/188098.html
31108
31109         The idea is to add a new function gdb::checked_static_cast, which can,
31110         in some cases, be used as a drop-in replacement for static_cast.  And
31111         so, if I previously wrote this:
31112
31113           BaseClass *base = get_base_class_pointer ();
31114           DerivedClass *derived = static_cast<DerivedClass *> (base);
31115
31116         I can now write:
31117
31118           BaseClass *base = get_base_class_pointer ();
31119           DerivedClass *derived = gdb::checked_static_cast<DerivedClass *> (base);
31120
31121         The requirement is that BaseClass and DerivedClass must be
31122         polymorphic.
31123
31124         The benefit of making this change is that, when GDB is built in
31125         developer mode, a run-time check will be made to ensure that `base`
31126         really is of type DerivedClass before the cast is performed.  If
31127         `base` is not of type DerivedClass then GDB will assert.
31128
31129         In a non-developer build gdb::checked_static_cast is equivalent to a
31130         static_cast, and there should be no performance difference.
31131
31132         This commit adds the support function, but does not make use of this
31133         function, a use will be added in the next commit.
31134
31135         Co-Authored-By: Pedro Alves <pedro@palves.net>
31136         Co-Authored-By: Tom Tromey <tom@tromey.com>
31137
31138 2022-07-21  Andrew Burgess  <aburgess@redhat.com>
31139
31140         gdb: move the type cast into gdbarch_tdep
31141         I built GDB for all targets on a x86-64/GNU-Linux system, and
31142         then (accidentally) passed GDB a RISC-V binary, and asked GDB to "run"
31143         the binary on the native target.  I got this error:
31144
31145           (gdb) show architecture
31146           The target architecture is set to "auto" (currently "i386").
31147           (gdb) file /tmp/hello.rv32.exe
31148           Reading symbols from /tmp/hello.rv32.exe...
31149           (gdb) show architecture
31150           The target architecture is set to "auto" (currently "riscv:rv32").
31151           (gdb) run
31152           Starting program: /tmp/hello.rv32.exe
31153           ../../src/gdb/i387-tdep.c:596: internal-error: i387_supply_fxsave: Assertion `tdep->st0_regnum >= I386_ST0_REGNUM' failed.
31154
31155         What's going on here is this; initially the architecture is i386, this
31156         is based on the default architecture, which is set based on the native
31157         target.  After loading the RISC-V executable the architecture of the
31158         current inferior is updated based on the architecture of the
31159         executable.
31160
31161         When we "run", GDB does a fork & exec, with the inferior being
31162         controlled through ptrace.  GDB sees an initial stop from the inferior
31163         as soon as the inferior comes to life.  In response to this stop GDB
31164         ends up calling save_stop_reason (linux-nat.c), which ends up trying
31165         to read register from the inferior, to do this we end up calling
31166         target_ops::fetch_registers, which, for the x86-64 native target,
31167         calls amd64_linux_nat_target::fetch_registers.
31168
31169         After this I eventually end up in i387_supply_fxsave, different x86
31170         based targets will end in different functions to fetch registers, but
31171         it doesn't really matter which function we end up in, the problem is
31172         this line, which is repeated in many places:
31173
31174           i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
31175
31176         The problem here is that the ARCH in this line comes from the current
31177         inferior, which, as we discussed above, will be a RISC-V gdbarch, the
31178         tdep field will actually be of type riscv_gdbarch_tdep, not
31179         i386_gdbarch_tdep.  After this cast we are relying on undefined
31180         behaviour, in my case I happen to trigger an assert, but this might
31181         not always be the case.
31182
31183         The thing I tried that exposed this problem was of course, trying to
31184         start an executable of the wrong architecture on a native target.  I
31185         don't think that the correct solution for this problem is to detect,
31186         at the point of cast, that the gdbarch_tdep object is of the wrong
31187         type, but, I did wonder, is there a way that we could protect
31188         ourselves from incorrectly casting the gdbarch_tdep object?
31189
31190         I think that there is something we can do here, and this commit is the
31191         first step in that direction, though no actual check is added by this
31192         commit.
31193
31194         This commit can be split into two parts:
31195
31196          (1) In gdbarch.h and arch-utils.c.  In these files I have modified
31197          gdbarch_tdep (the function) so that it now takes a template argument,
31198          like this:
31199
31200             template<typename TDepType>
31201             static inline TDepType *
31202             gdbarch_tdep (struct gdbarch *gdbarch)
31203             {
31204               struct gdbarch_tdep *tdep = gdbarch_tdep_1 (gdbarch);
31205               return static_cast<TDepType *> (tdep);
31206             }
31207
31208           After this change we are no better protected, but the cast is now
31209           done within the gdbarch_tdep function rather than at the call sites,
31210           this leads to the second, much larger change in this commit,
31211
31212           (2) Everywhere gdbarch_tdep is called, we make changes like this:
31213
31214             -  i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
31215             +  i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
31216
31217         There should be no functional change after this commit.
31218
31219         In the next commit I will build on this change to add an assertion in
31220         gdbarch_tdep that checks we are casting to the correct type.
31221
31222 2022-07-21  Andrew Burgess  <aburgess@redhat.com>
31223
31224         gdb: select suitable thread for gdbarch_adjust_breakpoint_address
31225         The three targets that implement gdbarch_adjust_breakpoint_address are
31226         arm, frv, and mips.  In each of these targets the adjust breakpoint
31227         address function does some combination of reading the symbol table, or
31228         reading memory at the location the breakpoint could be placed.
31229
31230         The problem is that performing these actions requires that the current
31231         inferior and program space be the one in which the breakpoint will be
31232         placed, and this is not currently always the case.
31233
31234         Consider a GDB session with multiple inferiors.  One inferior might be
31235         a native target while another could be a remote target of a completely
31236         different architecture.  Alternatively, if we consider ARM and
31237         AArch64, one native inferior might be AArch64, while a second native
31238         inferior could be ARM.
31239
31240         In these cases it is possible, and valid, for a user to have one
31241         inferior selected, and place a breakpoint in the other inferior by
31242         placing a breakpoint on a particular symbol.
31243
31244         If this happens, then currently, when
31245         gdbarch_adjust_breakpoint_address is called, the wrong inferior (and
31246         program space) will be selected, and memory reads, and symbol look
31247         ups, will not return the expected results, this could lead to
31248         breakpoints being placed in the wrong location.
31249
31250         There are currently two places where gdbarch_adjust_breakpoint_address
31251         is called:
31252
31253           1. In infrun.c, in the function handle_step_into_function.  In this
31254           case, I believe that the correct inferior and program space will
31255           already be selected as this is called as part of the stop event
31256           handling, so I don't think we need to worry about this case, and
31257
31258           2. In breakpoint.c, in the function adjust_breakpoint_address, which
31259           is itself called from code_breakpoint::add_location and
31260           watch_command_1.
31261
31262           The watch_command_1 case I don't think we need to worry about, this
31263           is for when a local watch expression is created, which can only be
31264           in the currently selected inferior, so this case should be fine.
31265
31266           The code_breakpoint::add_location case is the one that needs fixing,
31267           this is what allows a breakpoint to be created between inferiors.
31268
31269         To fix the code_breakpoint::add_location case, I propose that we pass
31270         the "correct" program_space (i.e. the program space in which the
31271         breakpoint will be created) to the adjust_breakpoint_address function.
31272         Then in adjust_breakpoint_address we can make use of
31273         switch_to_program_space_and_thread to switch program_space and
31274         inferior before calling gdbarch_adjust_breakpoint_address.
31275
31276         I discovered this issue while working on a later patch in this
31277         series.  This later patch will detect when we cast the result of
31278         gdbarch_tdep to the wrong type.
31279
31280         With this later patch in place I ran gdb.multi/multi-arch.exp on an
31281         AArch64 target.  In this situation, two inferiors are created, an
31282         AArch64 inferior, and an ARM inferior.  The test selected the AArch64
31283         inferior and tries to create a breakpoint in the ARM inferior.
31284
31285         As a result of this we end up in arm_adjust_breakpoint_address, which
31286         calls arm_pc_is_thumb.  Before this commit the AArch64 inferior would
31287         be current.  As a result, all of the checks in arm_pc_is_thumb would
31288         fail (they rely on reading symbols from the current program space),
31289         and so, at the end of arm_pc_is_thumb we would call
31290         arm_frame_is_thumb.  However, remember, at this point the current
31291         inferior is the AArch64 inferior, so the current frame is an AArch64
31292         frame.
31293
31294         In arm_frame_is_thumb we call arm_psr_thumb_bit, which calls
31295         gdbarch_tdep and casts the result to arm_gdbarch_tdep.  This is wrong,
31296         the tdep field is of type aarch64_gdbarch_tdep.  After this we have
31297         undefined behaviour.
31298
31299         With this patch in place, we will have switched to a thread in the ARM
31300         program space before calling arm_adjust_breakpoint_address.  As a
31301         result, we now succeed in looking up the required symbols in
31302         arm_pc_is_thumb, and so we never call arm_frame_is_thumb.
31303
31304         However, in the worst case scenario, if we did end up calling
31305         arm_frame_is_thumb, as the current inferior should now be the ARM
31306         inferior, the current frame should be an ARM frame, so we still should
31307         not hit undefined behaviour.
31308
31309         I have added an assert to arm_frame_is_thumb.
31310
31311 2022-07-21  Andrew Burgess  <aburgess@redhat.com>
31312
31313         gdb/mips: rewrite show_mask_address
31314         This commit is similar to the previous commit, but in this case GDB is
31315         actually relying on undefined behaviour.
31316
31317         Consider building GDB for all targets on x86-64/GNU-Linux, then doing
31318         this:
31319
31320           (gdb) show mips mask-address
31321           Zeroing of upper 32 bits of 64-bit addresses is auto.
31322           The 32 bit address mask is set automatically.  Currently disabled
31323           (gdb)
31324
31325         The 'show mips mask-address' command ends up in show_mask_address in
31326         mips-tdep.c, and this function does this:
31327
31328           mips_gdbarch_tdep *tdep
31329             = (mips_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
31330
31331         Later we might pass TDEP to mips_mask_address_p.  However, in my
31332         example above, on an x86-64 native target, the current target
31333         architecture will be an x86-64 gdbarch, and the tdep field within the
31334         gdbarch will be of type i386_gdbarch_tdep, not of type
31335         mips_gdbarch_tdep, as a result the cast above was incorrect, and TDEP
31336         is not pointing at what it thinks it is.
31337
31338         I also think the current output is a little confusing, we appear to
31339         have two lines that show the same information, but using different
31340         words.
31341
31342         The first line comes from calling deprecated_show_value_hack, while
31343         the second line is printed directly from show_mask_address.  However,
31344         both of these lines are printing the same mask_address_var value.  I
31345         don't think the two lines actually adds any value here.
31346
31347         Finally, none of the text in this function is passed through the
31348         internationalisation mechanism.
31349
31350         It would be nice to remove another use of deprecated_show_value_hack
31351         if possible, so this commit does a complete rewrite of
31352         show_mask_address.
31353
31354         After this commit the output of the above example command, still on my
31355         x86-64 native target is:
31356
31357             (gdb) show mips mask-address
31358             Zeroing of upper 32 bits of 64-bit addresses is "auto" (current architecture is not MIPS).
31359
31360         The 'current architecture is not MIPS' text is only displayed when the
31361         current architecture is not MIPS.  If the architecture is mips then we
31362         get the more commonly seen 'currently "on"' or 'currently "off"', like
31363         this:
31364
31365           (gdb) set architecture mips
31366           The target architecture is set to "mips".
31367           (gdb) show mips mask-address
31368           Zeroing of upper 32 bits of 64-bit addresses is "auto" (currently "off").
31369           (gdb)
31370
31371         All the text is passed through the internationalisation mechanism, and
31372         we only call gdbarch_tdep when we know the gdbarch architecture is
31373         bfd_arch_mips.
31374
31375 2022-07-21  Andrew Burgess  <aburgess@redhat.com>
31376
31377         gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope
31378         This is a small refactor to resolve an issue before it becomes a
31379         problem in a later commit.
31380
31381         Move the fetching of an arm_gdbarch_tdep into a more inner scope
31382         within two functions in arm-tdep.c.
31383
31384         The problem with the current code is that the functions in question
31385         are used as the callbacks for two set/show parameters.  These set/show
31386         parameters are available no matter the current architecture, but are
31387         really about controlling an ARM architecture specific setting.  And
31388         so, if I build GDB for all targets on an x86-64/GNU-Linux system, I
31389         can still do this:
31390
31391           (gdb) show arm fpu
31392           (gdb) show arm abi
31393
31394         After these calls we end up in show_fp_model and arm_show_abi
31395         respectively, where we unconditionally do this:
31396
31397           arm_gdbarch_tdep *tdep
31398             = (arm_gdbarch_tdep *) gdbarch_tdep (target_gdbarch ());
31399
31400         However, the gdbarch_tdep() result will only be a arm_gdbarch_tdep if
31401         the current architecture is ARM, otherwise the result will actually be
31402         of some other type.
31403
31404         This isn't actually a problem, as in both cases the use of tdep is
31405         guarded by a later check that the gdbarch architecture is
31406         bfd_arch_arm.
31407
31408         This commit just moves the call to gdbarch_tdep() after the
31409         architecture check.
31410
31411         In a later commit gdbarch_tdep() will be able to spot when we are
31412         casting the result to the wrong type, and this function will trigger
31413         assertion failures if things are not fixed.
31414
31415         There should be not user visible changes after this commit.
31416
31417 2022-07-21  Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
31418
31419         [arm] Rename arm_cache_is_sp_register to arm_is_alternative_sp_register
31420         All usages of this helper are really made to check if the register is
31421         one of the alternative SP registers (MSP/MSP_S/MSP_NS/PSP/PSP_S/PSP_NS)
31422         with the ARM_SP_REGNUM case being handled separately.
31423
31424 2022-07-21  Tom de Vries  <tdevries@suse.de>
31425
31426         [gdb/python] Fix typo in test_python
31427         Fix typo in ref_output_0 variable in test_python.
31428
31429         Tested by running the selftest on x86_64-linux with python 3.11.
31430
31431 2022-07-21  Tom de Vries  <tdevries@suse.de>
31432
31433         [gdb/python] Fix python selftest with python 3.11
31434         With python 3.11 I noticed:
31435         ...
31436         $ gdb -q -batch -ex "maint selftest python"
31437         Running selftest python.
31438         Self test failed: self-test failed at gdb/python/python.c:2246
31439         Ran 1 unit tests, 1 failed
31440         ...
31441
31442         In more detail:
31443         ...
31444         (gdb) p output
31445         $5 = "Traceback (most recent call last):\n  File \"<string>\", line 0, \
31446           in <module>\nKeyboardInterrupt\n"
31447         (gdb) p ref_output
31448         $6 = "Traceback (most recent call last):\n  File \"<string>\", line 1, \
31449           in <module>\nKeyboardInterrupt\n"
31450         ...
31451
31452         Fix this by also allowing line number 0.
31453
31454         Tested on x86_64-linux.
31455
31456         This should hopefully fix buildbot builder gdb-rawhide-x86_64.
31457
31458 2022-07-21  Tom de Vries  <tdevries@suse.de>
31459
31460         [gdbsupport] Fix type of parallel_for_each_debug
31461         When I changed the initialization of parallel_for_each_debug from 0 to false,
31462         I forgot to change the type from int to bool.  Fix this.
31463
31464         Tested by rebuilding on x86_64-linux.
31465
31466 2022-07-21  Tom de Vries  <tdevries@suse.de>
31467
31468         [gdb/symtab] Fix bad compile unit index complaint
31469         I noticed this code in dw2_debug_names_iterator::next:
31470         ...
31471                 case DW_IDX_compile_unit:
31472                   /* Don't crash on bad data.  */
31473                   if (ull >= per_bfd->all_comp_units.size ())
31474                     {
31475                       complaint (_(".debug_names entry has bad CU index %s"
31476                                    " [in module %s]"),
31477                                  pulongest (ull),
31478                                  objfile_name (objfile));
31479                       continue;
31480                     }
31481                   per_cu = per_bfd->get_cu (ull);
31482                   break;
31483         ...
31484
31485         This code used to DTRT, before we started keeping both CUs and TUs in
31486         all_comp_units.
31487
31488         Fix by using "per_bfd->all_comp_units.size () - per_bfd->tu_stats.nr_tus"
31489         instead.
31490
31491         It's hard to produce a test-case for this, but let's try at least to trigger
31492         the complaint somehow.  We start out by creating an exec with .debug_types and
31493         .debug_names:
31494         ...
31495         $ gcc -g ~/hello.c -fdebug-types-section
31496         $ gdb-add-index -dwarf-5 a.out
31497         ...
31498         and verify that we don't see any complaints:
31499         ...
31500         $ gdb -q -batch -iex "set complaints 100" ./a.out
31501         ...
31502
31503         We look at the CU and TU table using readelf -w and conclude that we have
31504         nr_cus == 6 and nr_tus == 1.
31505
31506         Now override ull in dw2_debug_names_iterator::next for the DW_IDX_compile_unit
31507         case to 6, and we have:
31508         ...
31509         $ gdb -q -batch -iex "set complaints 100" ./a.out
31510         During symbol reading: .debug_names entry has bad CU index 6 [in module a.out]
31511         ...
31512
31513         After this, it still crashes because this code in
31514         dw2_debug_names_iterator::next:
31515         ...
31516           /* Skip if already read in.  */
31517           if (m_per_objfile->symtab_set_p (per_cu))
31518             goto again;
31519         ...
31520         is called with per_cu == nullptr.
31521
31522         Fix this by skipping the entry if per_cu == nullptr.
31523
31524         Now revert the fix and observe that the complaint disappears, so we've
31525         confirmed that the fix is required.
31526
31527         A somewhat similar issue for .gdb_index in dw2_symtab_iter_next has been filed
31528         as PR29367.
31529
31530         Tested on x86_64-linux, with native and target board cc-with-debug-names.
31531
31532         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29336
31533
31534 2022-07-21  Jan Beulich  <jbeulich@suse.com>
31535
31536         x86: replace wrong attributes on VCVTDQ2PH{X,Y}
31537         A standalone (without SAE) StaticRounding attribute is meaningless, and
31538         indeed all other similar insns have ATTSyntax there instead. I can only
31539         assume this was some strange copy-and-paste mistake.
31540
31541         x86/Intel: correct AVX512F scatter insn element sizes
31542         I clearly screwed up in 6ff00b5e12e7 ("x86/Intel: correct permitted
31543         operand sizes for AVX512 scatter/gather") giving all AVX512F scatter
31544         insns Dword element size. Update testcases (also their gather parts),
31545         utilizing that there previously were two identical lines each (for no
31546         apparent reason).
31547
31548 2022-07-21  Alan Modra  <amodra@gmail.com>
31549
31550         PR29390, DW_CFA_AARCH64_negate_ra_state vs. DW_CFA_GNU_window_save
31551                 PR 29390
31552         binutils/
31553                 * dwarf.c (is_aarch64, DW_CFA_GNU_window_save_name): New.
31554                 (display_debug_frames): Use them.
31555                 (init_dwarf_regnames_aarch64): Set is_aarch64.
31556                 (init_dwarf_regnames_by_elf_machine_code): Clear is_aarch64.
31557                 (init_dwarf_regnames_by_bfd_arch_and_mach): Likewise.
31558         gas/
31559                 * testsuite/gas/aarch64/pac_ab_key.d: Adjust expected output.
31560                 * testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.
31561
31562 2022-07-21  Alan Modra  <amodra@gmail.com>
31563
31564         PR29337, readelf CU/TU mixup in .gdb_index
31565         Commit 244e19c79111 changed a number of variables in display_gdb_index
31566         to count entries rather than words.
31567
31568                 PR 29337
31569                 * dwarf.c (display_gdb_index): Correct use of cu_list_elements.
31570
31571 2022-07-21  Alan Modra  <amodra@gmail.com>
31572
31573         PR29370, infinite loop in display_debug_abbrev
31574         The PR29370 testcase is a fuzzed object file with multiple
31575         .trace_abbrev sections.  Multiple .trace_abbrev or .debug_abbrev
31576         sections are not a violation of the DWARF standard.  The DWARF5
31577         standard even gives an example of multiple .debug_abbrev sections
31578         contained in groups.  Caching and lookup of processed abbrevs thus
31579         needs to be done by section and offset rather than base and offset.
31580         (Why base anyway?)  Or, since section contents are kept, by a pointer
31581         into the contents.
31582
31583                 PR 29370
31584                 * dwarf.c (struct abbrev_list): Replace abbrev_base and
31585                 abbrev_offset with raw field.
31586                 (find_abbrev_list_by_abbrev_offset): Delete.
31587                 (find_abbrev_list_by_raw_abbrev): New function.
31588                 (process_abbrev_set): Set list->raw and list->next.
31589                 (find_and_process_abbrev_set): Replace abbrev list lookup with
31590                 new function.  Don't set list abbrev_base, abbrev_offset or next.
31591
31592 2022-07-21  Alan Modra  <amodra@gmail.com>
31593
31594         binutils/dwarf.c: abbrev caching
31595         I'm inclined to think that abbrev caching is counter-productive.  The
31596         time taken to search the list of abbrevs converted to internal form is
31597         non-zero, and it's easy to decode the raw abbrevs.  It's especially
31598         silly to cache empty lists of decoded abbrevs (happens with zero
31599         padding in .debug_abbrev), or abbrevs as they are displayed when there
31600         is no further use of those abbrevs.  This patch stops caching in those
31601         cases.
31602
31603                 * dwarf.c (record_abbrev_list_for_cu): Add free_list param.
31604                 Put abbrevs on abbrev_lists here.
31605                 (new_abbrev_list): Delete function.
31606                 (process_abbrev_set): Return newly allocated list.  Move
31607                 abbrev base, offset and size checking to..
31608                 (find_and_process_abbrev_set): ..here, new function.  Handle
31609                 lookup of cached abbrevs here, and calculate start and end
31610                 for process_abbrev_set.  Return free_list if newly alloc'd.
31611                 (process_debug_info): Consolidate cached list lookup, new list
31612                 alloc and processing into find_and_process_abbrev_set call.
31613                 Free list when not cached.
31614                 (display_debug_abbrev): Similarly.
31615
31616 2022-07-21  Alan Modra  <amodra@gmail.com>
31617
31618         miscellaneous dwarf.c tidies
31619                 * dwarf.c: Leading and trailing whitespace fixes.
31620                 (free_abbrev_list): New function.
31621                 (free_all_abbrevs): Use the above.  Free cu_abbrev_map here too.
31622                 (process_abbrev_set): Print actual section name on error.
31623                 (get_type_abbrev_from_form): Add overflow check.
31624                 (free_debug_memory): Don't free cu_abbrev_map here..
31625                 (process_debug_info): ..or here.  Warn on another case of not
31626                 finding a neeeded abbrev.
31627
31628 2022-07-21  Alan Modra  <amodra@gmail.com>
31629
31630         PowerPC64: fix build error on 32-bit hosts
31631         elf64-ppc.c:11673:33: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘bfd_vma’ {aka ‘long long unsigned int’} [-Werror=format=]
31632         11673 |   fprintf (stderr, "offset = %#lx:", stub_entry->stub_offset);
31633               |                              ~~~^    ~~~~~~~~~~~~~~~~~~~~~~~
31634               |                                 |              |
31635               |                                 |              bfd_vma {aka long long unsigned int}
31636               |                                 long unsigned int
31637               |                              %#llx
31638
31639                 * elf64-ppc.c (dump_stub): Use BFD_VMA_FMT.
31640
31641 2022-07-21  Kevin Buettner  <kevinb@redhat.com>
31642
31643         Wrap python_write_bytecode with HAVE_PYTHON ifdef
31644         This commit fixes a build error on machines lacking python headers
31645         and/or libraries.
31646
31647 2022-07-21  GDB Administrator  <gdbadmin@sourceware.org>
31648
31649         Automatic date update in version.in
31650
31651 2022-07-20  Kevin Buettner  <kevinb@redhat.com>
31652
31653         Handle Python 3.11 deprecation of PySys_SetPath and Py_SetProgramName
31654         Python 3.11 deprecates PySys_SetPath and Py_SetProgramName.  The
31655         PyConfig API replaces these and other functions.  This commit uses the
31656         PyConfig API to provide equivalent functionality while also preserving
31657         support for older versions of Python, i.e. those before Python 3.8.
31658
31659         A beta version of Python 3.11 is available in Fedora Rawhide.  Both
31660         Fedora 35 and Fedora 36 use Python 3.10, while Fedora 34 still used
31661         Python 3.9.  I've tested these changes on Fedora 34, Fedora 36, and
31662         rawhide, though complete testing was not possible on rawhide due to
31663         a kernel bug.  That being the case, I decided to enable the newer
31664         PyConfig API by testing PY_VERSION_HEX against 0x030a0000.  This
31665         corresponds to Python 3.10.
31666
31667         We could try to use the PyConfig API for Python versions as early as 3.8,
31668         but I'm reluctant to do this as there may have been PyConfig related
31669         bugs in earlier versions which have since been fixed.  Recent linux
31670         distributions should have support for Python 3.10.  This should be
31671         more than adequate for testing the new Python initialization code in
31672         GDB.
31673
31674         Information about the PyConfig API as well as the motivation behind
31675         deprecating the old interface can be found at these links:
31676
31677         https://github.com/python/cpython/issues/88279
31678         https://peps.python.org/pep-0587/
31679         https://docs.python.org/3.11/c-api/init_config.html
31680
31681         The v2 commit also addresses several problems that Simon found in
31682         the v1 version.
31683
31684         In v1, I had used Py_DontWriteBytecodeFlag in the new initialization
31685         code, but Simon pointed out that this global configuration variable
31686         will be deprecated in Python 3.12.  This version of the patch no longer
31687         uses Py_DontWriteBytecodeFlag in the new initialization code.
31688         Additionally, both Py_DontWriteBytecodeFlag and Py_IgnoreEnvironmentFlag
31689         will no longer be used when building GDB against Python 3.10 or higher.
31690         While it's true that both of these global configuration variables are
31691         deprecated in Python 3.12, it makes sense to disable their use for
31692         gdb builds against 3.10 and higher since those are the versions for
31693         which the PyConfig API is now being used by GDB.  (The PyConfig API
31694         includes different mechanisms for making the same settings afforded
31695         by use of the soon-to-be deprecated global configuration variables.)
31696
31697         Simon also noted that PyConfig_Clear() would not have be called for
31698         one of the failure paths.  I've fixed that problem and also made the
31699         rest of the "bail out" code more direct.  In particular,
31700         PyConfig_Clear() will always be called, both for success and failure.
31701
31702         The v3 patch addresses some rebase conflicts related to module
31703         initialization .  Commit 3acd9a692dd ("Make 'import gdb.events' work")
31704         uses PyImport_ExtendInittab instead of PyImport_AppendInittab.  That
31705         commit also initializes a struct for each module to import.  Both the
31706         initialization and the call to were moved ahead of the ifdefs to avoid
31707         having to replicate (at least some of) the code three times in various
31708         portions of the ifdefs.
31709
31710         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28668
31711         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29287
31712
31713 2022-07-20  Christopher Di Bella  <cjdb@google.com>
31714
31715         gdb/value.c: add several headers to the include list
31716         Building GDB currently fails to build with libc++, because libc++ is
31717         stricter about which headers "leak" entities they're not guaranteed
31718         to support. The following headers have been added:
31719
31720         * `<iterator>`, to support `std::back_inserter`
31721         * `<utility>`, to support `std::move` and `std::swap`
31722         * `<vector>`, to support `std::vector`
31723
31724         Change-Id: Iaeb15057c5fbb43217df77ce34d4e54446dbcf3d
31725
31726 2022-07-20  Pedro Alves  <pedro@palves.net>
31727
31728         Don't stop all threads prematurely after first step of "step N"
31729         In all-stop mode, when the target is itself in non-stop mode (like
31730         GNU/Linux), if you use the "step N" (or "stepi/next/nexti N") to step
31731         a thread a number of times:
31732
31733          (gdb) help step
31734          step, s
31735          Step program until it reaches a different source line.
31736          Usage: step [N]
31737          Argument N means step N times (or till program stops for another reason).
31738
31739         ... GDB prematurely stops all threads after the first step, and
31740         doesn't re-resume them for the subsequent N-1 steps.  It's as if for
31741         the 2nd and subsequent steps, the command was running with
31742         scheduler-locking enabled.
31743
31744         This can be observed with the testcase added by this commit, which
31745         looks like this:
31746
31747          static pthread_barrier_t barrier;
31748
31749          static void *
31750          thread_func (void *arg)
31751          {
31752            pthread_barrier_wait (&barrier);
31753            return NULL;
31754          }
31755
31756          int
31757          main ()
31758          {
31759            pthread_t thread;
31760            int ret;
31761
31762            pthread_barrier_init (&barrier, NULL, 2);
31763
31764            /* We run to this line below, and then issue "next 3".  That should
31765               step over the 3 lines below and land on the return statement.  If
31766               GDB prematurely stops the thread_func thread after the first of
31767               the 3 nexts (and never resumes it again), then the join won't
31768               ever return.  */
31769            pthread_create (&thread, NULL, thread_func, NULL); /* set break here */
31770            pthread_barrier_wait (&barrier);
31771            pthread_join (thread, NULL);
31772
31773            return 0;
31774          }
31775
31776         The test hangs and times out without the GDB fix:
31777
31778          (gdb) next 3
31779          [New Thread 0x7ffff7d89700 (LWP 525772)]
31780          FAIL: gdb.threads/step-N-all-progress.exp: non-stop=off: target-non-stop=on: next 3 (timeout)
31781
31782         The problem is a core gdb bug.
31783
31784         When you do "step/stepi/next/nexti N", GDB internally creates a
31785         thread_fsm object and associates it with the stepping thread.  For the
31786         stepping commands, the FSM's class is step_command_fsm.  That object
31787         is what keeps track of how many steps are left to make.  When one step
31788         finishes, handle_inferior_event calls stop_waiting and returns, and
31789         then fetch_inferior_event calls the "should_stop" method of the event
31790         thread's FSM.  The implementation of that method decrements the
31791         steps-left counter.  If the counter is 0, it returns true and we
31792         proceed to presenting the stop to the user.  If it isn't 0 yet, then
31793         the method returns false, indicating to fetch_inferior_event to "keep
31794         going".
31795
31796         Focusing now on when the first step finishes -- we're in "all-stop"
31797         mode, with the target in non-stop mode.  When a step finishes,
31798         handle_inferior_event calls stop_waiting, which itself calls
31799         stop_all_threads to stop everything.  I.e., after the first step
31800         completes, all threads are stopped, before handle_inferior_event
31801         returns.  And after that, now in fetch_inferior_event, we consult the
31802         thread's thread_fsm::should_stop, which as we've seen, for the first
31803         step returns false -- i.e., we need to keep_going for another step.
31804         However, since the target is in non-stop mode, keep_going resumes
31805         _only_ the current thread.  All the other threads remain stopped,
31806         inadvertently.
31807
31808         If the target is in non-stop mode, we don't actually need to stop all
31809         threads right after each step finishes, and then re-resume them again.
31810         We can instead defer stopping all threads until all the steps are
31811         completed.
31812
31813         So fix this by delaying the stopping of all threads until after we
31814         called the FSM's "should_stop" method.  I.e., move it from
31815         stop_waiting, to handle_inferior_events's callers,
31816         fetch_inferior_event and wait_for_inferior.
31817
31818         New test included.  Tested on x86-64 GNU/Linux native and gdbserver.
31819
31820         Change-Id: Iaad50dcfea4464c84bdbac853a89df92ade6ae01
31821
31822 2022-07-20  Alan Modra  <amodra@gmail.com>
31823
31824         Re: opcodes/arc: Implement style support in the disassembler
31825                 * arc-dis.c (print_insn_arc): Fix thinko.
31826
31827 2022-07-20  Dmitry Selyutin  <ghostmansd@gmail.com>
31828
31829         gas/symbols: introduce md_resolve_symbol
31830         Assuming GMSD is a special operand, marked as O_md1, the code:
31831
31832             .set VREG, GMSD
31833             .set REG, VREG
31834             extsw REG, 2
31835
31836         ...fails upon attempts to resolve the value of the symbol. This happens
31837         since machine-dependent values are not handled in the giant op switch.
31838         We introduce a custom md_resolve_symbol macro; the ports can use this
31839         macro to customize the behavior when resolve_symbol_value hits O_md
31840         operand.
31841
31842 2022-07-20  GDB Administrator  <gdbadmin@sourceware.org>
31843
31844         Automatic date update in version.in
31845
31846 2022-07-19  H.J. Lu  <hjl.tools@gmail.com>
31847
31848         x86: Disallow invalid relocations against protected symbols
31849         Since glibc 2.36 will issue warnings for copy relocation against
31850         protected symbols and non-canonical reference to canonical protected
31851         functions, change the linker to always disallow such relocations.
31852
31853         bfd/
31854
31855                 * elf32-i386.c (elf_i386_scan_relocs): Remove check for
31856                 elf_has_indirect_extern_access.
31857                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
31858                 (elf_x86_64_relocate_section): Remove check for
31859                 elf_has_no_copy_on_protected.
31860                 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check for building
31861                 executable instead of elf_has_no_copy_on_protected.
31862                 (_bfd_x86_elf_adjust_dynamic_symbol): Disallow copy relocation
31863                 against non-copyable protected symbol.
31864                 * elfxx-x86.h (SYMBOL_NO_COPYRELOC): Remove check for
31865                 elf_has_no_copy_on_protected.
31866
31867         ld/
31868
31869                 * testsuite/ld-i386/i386.exp: Expect linker error for PR ld/17709
31870                 test.
31871                 * testsuite/ld-i386/pr17709.rd: Removed.
31872                 * testsuite/ld-i386/pr17709.err: New file.
31873                 * testsuite/ld-x86-64/pr17709.rd: Removed.
31874                 * testsuite/ld-x86-64/pr17709.err: New file.
31875                 * testsuite/ld-x86-64/pr28875-func.err: Updated.
31876                 * testsuite/ld-x86-64/x86-64.exp: Expect linker error for PR
31877                 ld/17709 test.  Add tests for function pointer against protected
31878                 function.
31879
31880 2022-07-19  Fangrui Song  <i@maskray.me>
31881
31882         x86: Make protected symbols local for -shared
31883         Call _bfd_elf_symbol_refs_local_p with local_protected==true.  This has
31884         2 noticeable effects for -shared:
31885
31886         * GOT-generating relocations referencing a protected data symbol no
31887           longer lead to a GLOB_DAT (similar to a hidden symbol).
31888         * Direct access relocations (e.g. R_X86_64_PC32) no longer has the
31889           confusing diagnostic below.
31890
31891             __attribute__((visibility("protected"))) void *foo() {
31892               return (void *)foo;
31893             }
31894
31895             // gcc -fpic -shared -fuse-ld=bfd
31896             relocation R_X86_64_PC32 against protected symbol `foo' can not be used when making a shared object
31897
31898         The new behavior matches arm, aarch64 (commit
31899         83c325007c5599fa9b60b8d5f7b84842160e1d1b), and powerpc ports, and other
31900         linkers: gold and ld.lld.
31901
31902         Note: if some code tries to use direct access relocations to take the
31903         address of foo, the pointer equality will break, but the error should be
31904         reported on the executable link, not on the innocent shared object link.
31905         glibc 2.36 will give a warning at relocation resolving time.
31906
31907         With this change, `#define elf_backend_extern_protected_data 1` is no
31908         longer effective.  Just remove it.
31909
31910         Remove the test "Run protected-func-1 without PIE" since -fno-pic
31911         address taken operation in the executable doesn't work with protected
31912         symbol in a shared object by default.  Similarly, remove
31913         protected-data-1a and protected-data-1b.  protected-data-1b can be made
31914         working by removing HAVE_LD_PIE_COPYRELOC from GCC
31915         (https://sourceware.org/pipermail/gcc-patches/2022-June/596678.html).
31916
31917 2022-07-19  Luis Machado  <luis.machado@arm.com>
31918
31919         Reformat gdbarch-components.py to fix deviations
31920         Reformat to make sure we have a clean file with no deviations
31921         from the expected python code format.
31922
31923 2022-07-19  Luis Machado  <luis.machado@arm.com>
31924
31925         [AArch64] MTE corefile support
31926         Teach GDB how to dump memory tags for AArch64 when using the gcore command
31927         and how to read memory tag data back from a core file generated by GDB
31928         (via gcore) or by the Linux kernel.
31929
31930         The format is documented in the Linux Kernel documentation [1].
31931
31932         Each tagged memory range (listed in /proc/<pid>/smaps) gets dumped to its
31933         own PT_AARCH64_MEMTAG_MTE segment. A section named ".memtag" is created for each
31934         of those segments when reading the core file back.
31935
31936         To save a little bit of space, given MTE tags only take 4 bits, the memory tags
31937         are stored packed as 2 tags per byte.
31938
31939         When reading the data back, the tags are unpacked.
31940
31941         I've added a new testcase to exercise the feature.
31942
31943         Build-tested with --enable-targets=all and regression tested on aarch64-linux
31944         Ubuntu 20.04.
31945
31946         [1] Documentation/arm64/memory-tagging-extension.rst (Core Dump Support)
31947
31948 2022-07-19  Luis Machado  <luis.machado@arm.com>
31949
31950         [AArch64] Support AArch64 MTE memory tag dumps in core files
31951         The Linux kernel can dump memory tag segments to a core file, one segment
31952         per mapped range. The format and documentation can be found in the Linux
31953         kernel tree [1].
31954
31955         The following patch adjusts bfd and binutils so they can handle this new
31956         segment type and display it accordingly. It also adds code required so GDB
31957         can properly read/dump core file data containing memory tags.
31958
31959         Upon reading, each segment that contains memory tags gets mapped to a
31960         section named "memtag". These sections will be used by GDB to lookup the tag
31961         data. There can be multiple such sections with the same name, and they are not
31962         numbered to simplify GDB's handling and lookup.
31963
31964         There is another patch for GDB that enables both reading
31965         and dumping of memory tag segments.
31966
31967         Tested on aarch64-linux Ubuntu 20.04.
31968
31969         [1] Documentation/arm64/memory-tagging-extension.rst (Core Dump Support)
31970
31971 2022-07-19  Luis Machado  <luis.machado@arm.com>
31972
31973         [AArch64] Fix testcase compilation failure
31974         Newer distros carry newer headers that contains MTE definitions.  Account
31975         for that fact in the MTE testcases (gdb.arch/aarch64-mte.exp) and define
31976         constants conditionally to prevent compilation failures.
31977
31978 2022-07-19  H.J. Lu  <hjl.tools@gmail.com>
31979
31980         ld: Pass -nostdlib to compiler with -r
31981         Pass -nostdlib to compiler with -r to avoid unnecessary .o file and
31982         libraries.
31983
31984                 PR ld/29377
31985                 * testsuite/ld-elf/linux-x86.exp: Pass -nostdlib with -r.
31986
31987 2022-07-19  H.J. Lu  <hjl.tools@gmail.com>
31988
31989         x86: Properly check invalid relocation against protected symbol
31990         Only check invalid relocation against protected symbol defined in shared
31991         object.
31992
31993         bfd/
31994
31995                 PR ld/29377
31996                 * elf32-i386.c (elf_i386_scan_relocs): Only check invalid
31997                 relocation against protected symbol defined in shared object.
31998                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
31999
32000         ld/
32001
32002                 PR ld/29377
32003                 * testsuite/ld-elf/linux-x86.exp: Run PR ld/29377 tests.
32004                 * testsuite/ld-elf/pr29377a.c: New file.
32005                 * testsuite/ld-elf/pr29377b.c: Likewise.
32006
32007 2022-07-19  GDB Administrator  <gdbadmin@sourceware.org>
32008
32009         Automatic date update in version.in
32010
32011 2022-07-18  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
32012
32013         gprofng: link libgprofng.so against -lpthread
32014         gprofng/ChangeLog
32015         2022-07-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
32016
32017                 PR gprofng/29364
32018                 * src/Makefile.am (libgprofng_la_LIBADD): Add -lpthread.
32019                 * src/Makefile.in: Rebuild.
32020
32021 2022-07-18  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
32022
32023         gprofng: fix regression in build and a race condition in autoreconf
32024         gprofng/ChangeLog
32025         2022-07-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
32026
32027                 PR gprofng/29338
32028                 * libcollector/configure.ac (AC_CONFIG_HEADERS): Fix a race condition.
32029                 * libcollector/configure: Rebuild.
32030                 * libcollector/Makefile.in: Rebuild.
32031                 * common/config.h.in: Rebuild.
32032                 * common/lib-config.h.in: Created by autoreconf.
32033
32034 2022-07-18  Tom Tromey  <tromey@adacore.com>
32035
32036         Add gdb.free_objfile event registry
32037         Currently, Python code can use event registries to detect when gdb
32038         loads a new objfile, and when gdb clears the objfile list.  However,
32039         there's no way to detect the removal of an objfile, say when the
32040         inferior calls dlclose.
32041
32042         This patch adds a gdb.free_objfile event registry and arranges for an
32043         event to be emitted in this case.
32044
32045 2022-07-18  Pedro Alves  <pedro@palves.net>
32046
32047         Put gdb.base/bt-on-fatal-signal.exp GDB cores in output dir
32048         I noticed that gdb.base/bt-on-fatal-signal.exp was contributing four
32049         core files to the count of unexpected core files:
32050
32051          $ make check TESTS="gdb.base/bt-on-fatal-signal.exp"
32052
32053                          === gdb Summary ===
32054
32055          # of unexpected core files      4
32056          # of expected passes            21
32057
32058         These are GDB core dumps.  They are expected, however, because the
32059         whole point of the testcase is to crash GDB with a signal.
32060
32061         Make GDB change its current directory to the output dir just before
32062         crashing, so that the core files end up there.  The result is now:
32063
32064                          === gdb Summary ===
32065
32066          # of expected passes            25
32067
32068         and:
32069
32070          $ find . -name "core.*"
32071          ./testsuite/outputs/gdb.base/bt-on-fatal-signal/core.gdb.1676506.nelson.1657727692
32072          ./testsuite/outputs/gdb.base/bt-on-fatal-signal/core.gdb.1672585.nelson.1657727671
32073          ./testsuite/outputs/gdb.base/bt-on-fatal-signal/core.gdb.1674833.nelson.1657727683
32074          ./testsuite/outputs/gdb.base/bt-on-fatal-signal/core.gdb.1673709.nelson.1657727676
32075
32076         (Note the test is skipped at the top if on a remote host.)
32077
32078         Change-Id: I79e4fb2e91330279c7a509930b1952194a72e85a
32079
32080 2022-07-18  Tom Tromey  <tromey@adacore.com>
32081
32082         Remove array typedef assumption for Ada
32083         Currently the Ada code assumes that it can distinguish between a
32084         multi-dimensional array and an array of arrays by looking for an
32085         intervening typedef -- that is, for an array of arrays, there will be
32086         a typedef wrapping the innermost array type.
32087
32088         A recent compiler change removes this typedef, which causes a gdb
32089         failure in the internal AdaCore test suite.
32090
32091         This patch handles this case by checking whether the array type in
32092         question has a name.
32093
32094 2022-07-18  Tom Tromey  <tromey@adacore.com>
32095
32096         Remove manual lifetime management from cli_interp
32097         cli_interp manually manages its cli_out object.  This patch changes it
32098         to use a unique_ptr, and also changes cli_uiout to be a private
32099         member.
32100
32101         Remove cli_out_new
32102         cli_out_new is just a small wrapper around 'new'.  This patch removes
32103         it, replacing it with uses of 'new' instead.
32104
32105         Replace input_interactive_p with a method
32106         This replaces the global input_interactive_p function with a new
32107         method ui::input_interactive_p.
32108
32109         Remove ui_register_input_event_handler
32110         This patch removes ui_register_input_event_handler and
32111         ui_unregister_input_event_handler, replacing them with methods on
32112         'ui'.  It also changes gdb to use these methods everywhere, rather
32113         than sometimes reaching in to the ui to manage the file descriptor
32114         directly.
32115
32116 2022-07-18  Claudiu Zissulescu  <claziss@gmail.com>
32117
32118         opcodes/arc: Implement style support in the disassembler
32119         Update the ARC disassembler to supply style information to the
32120         disassembler output. The output formatting remains unchanged.
32121
32122         opcodes/ChangeLog:
32123                 * disassemble.c (disassemble_init_for_target): Set
32124                 created_styled_output for ARC based targets.
32125                 * arc-dis.c (find_format_from_table): Use fprintf_styled_ftype
32126                 instead of fprintf_ftype throughout.
32127                 (find_format): Likewise.
32128                 (print_flags): Likewise.
32129                 (print_insn_arc): Likewise.
32130
32131 2022-07-18  Claudiu Zissulescu  <claziss@synopsys.com>
32132
32133         arc: Update missing cipher.
32134         The ciphers 5,7, and 9 are missing when parsing an assembly
32135         instruction leading to errors when those ciphers are
32136         used.
32137
32138         gas/config
32139                 * tc-arc.c (md_assembly): Update strspn string with the
32140                   missing ciphers.
32141
32142 2022-07-18  Tom de Vries  <tdevries@suse.de>
32143
32144         [gdb/testsuite] Remove duplicate of supports_gnuc
32145         In commit 9d9dd861e98 ("[gdb/testsuite] Fix regression in
32146         step-indirect-call-thunk.exp with gcc 7") I accidentally committed a duplicate
32147         of supports_gnuc, which caused:
32148         ...
32149         DUPLICATE: gdb.base/gdb-caching-proc.exp: supports_gnuc: consistency
32150         ...
32151
32152         Fix this by removing the duplicate.
32153
32154         Tested on x86_64-linux.
32155
32156 2022-07-18  Andrew Burgess  <aburgess@redhat.com>
32157
32158         gdb/python: look for python, then python 3 at configure time
32159         It is possible that a system might have a python3 executable, but no
32160         python executable.  For example, on my Fedora system the python2
32161         package provides /usr/bin/python2, the python3 package provides
32162         /usr/bin/python3, and the python-unversioned-command package provides
32163         /usr/bin/python, which picks between python2 and python3.
32164
32165         It is quite possible to only have python3 available on a system.
32166
32167         Currently, when GDB configures, it looks for a 'python' executable.
32168         If non is found then GDB will be built without python support.  Or the
32169         user needs to configure using --with-python=/usr/bin/python3.
32170
32171         This commit updates GDB's configure.ac script to first look for
32172         'python', and then 'python3'.  Now, on a system that only has a
32173         python3 executable, GDB will automatically find, and use that in order
32174         to provide python support, no user supplied configure arguments are
32175         needed.
32176
32177         I've tested this on my local machine by removing the
32178         python-unversioned-command package, confirming that there is no longer
32179         a 'python' executable in my $PATH, and then rebuilding GDB from
32180         scratch.  GDB with this patch has python support.
32181
32182 2022-07-18  Jan Beulich  <jbeulich@suse.com>
32183
32184         x86: correct VMOVSH attributes
32185         Both forms were missing VexW0 (thus allowing Evex.W=1 to be encoded by
32186         suitable means, which would cause #UD). The memory operand form further
32187         was using the wrong Masking value, thus allowing zeroing-masking to be
32188         encoded for the store form (which would again cause #UD).
32189
32190         x86: re-order insn template fields
32191         This saves quite a number of shift instructions: The "operands" field
32192         can now be retrieved by just masking (no shift), and extracting the
32193         "extension_opcode" field now only requires a (signed) right shift, with
32194         no prereq left one. (Of course there may be architectures where, in a
32195         cross build, there might be no difference at all, e.g. when there are
32196         suitable bitfield extraction insns.)
32197
32198 2022-07-18  Tom de Vries  <tdevries@suse.de>
32199
32200         [gdbsupport] Improve thread scheduling in parallel_for_each
32201         When running a task using parallel_for_each, we get the following
32202         distribution:
32203         ...
32204         Parallel for: n_elements: 7271
32205         Parallel for: minimum elements per thread: 10
32206         Parallel for: elts_per_thread: 1817
32207         Parallel for: elements on worker thread 0       : 1817
32208         Parallel for: elements on worker thread 1       : 1817
32209         Parallel for: elements on worker thread 2       : 1817
32210         Parallel for: elements on worker thread 3       : 0
32211         Parallel for: elements on main thread           : 1820
32212         ...
32213
32214         Note that there are 4 active threads, and scheduling elts_per_thread on each
32215         of those handles 4 * 1817 == 7268, leaving 3 "left over" elements.
32216
32217         These leftovers are currently handled in the main thread.
32218
32219         That doesn't seem to matter much for this example, but for say 10 threads and
32220         99 elements, you'd have 9 threads handling 9 elements and 1 thread handling 18
32221         elements.
32222
32223         Instead, distribute the left over elements over the worker threads, such that
32224         we have:
32225         ...
32226         Parallel for: elements on worker thread 0       : 1818
32227         Parallel for: elements on worker thread 1       : 1818
32228         Parallel for: elements on worker thread 2       : 1818
32229         Parallel for: elements on worker thread 3       : 0
32230         Parallel for: elements on main thread           : 1817
32231         ...
32232
32233         Tested on x86_64-linux.
32234
32235 2022-07-18  Tom de Vries  <tdevries@suse.de>
32236
32237         [gdb/testsuite] Allow override of ASAN_OPTIONS in lib/gdb.exp
32238         Use set_sanitizer_default for ASAN_OPTIONS in lib/gdb.exp.
32239
32240         This allows us to override the default detect_leaks=0 setting, by manually
32241         doing:
32242         ...
32243         $ export ASAN_OPTIONS=detect_leaks=1
32244         $ make check
32245         ...
32246
32247         Tested on x86_64-linux, by building with -fsanitize=address and running
32248         test-case gdb.dwarf2/gdb-add-index.exp with and without
32249         "export ASAN_OPTIONS=detect_leaks=1".
32250
32251 2022-07-18  Tom de Vries  <tdevries@suse.de>
32252
32253         [gdb/testsuite] Fix regression in step-indirect-call-thunk.exp with gcc 7
32254         Since commit 43127ae5714 ("Fix gdb.base/step-indirect-call-thunk.exp") I run
32255         into:
32256         ...
32257         gdb compile failed, gcc: error: unrecognized command line option \
32258           '-fcf-protection=none'; did you mean '-flto-partition=none'?
32259         UNTESTED: gdb.base/step-indirect-call-thunk.exp: failed to prepare
32260         ...
32261
32262         The problem is that -fcf-protection is supported starting gcc 8, but I'm using
32263         system gcc 7.5.0.
32264
32265         Fix this by only adding -fcf-protection=none for gcc 8 and later.
32266
32267         Tested on x86_64-linux, with gcc 7.5.0, 8.2.1 and 12.1.1.
32268
32269 2022-07-18  Tom de Vries  <tdevries@suse.de>
32270
32271         [gdb/testsuite] Fix gdb.arch/i386-mpx.exp
32272         Since commit c4a3dbaf113 ("Expose current 'print' settings to Python") we
32273         have:
32274         ...
32275         (gdb) print /x $bnd0 = {0x10, 0x20}^M
32276         $22 = {lbound = 0x10, ubound = 0x20} : size 0x11^M
32277         (gdb) FAIL: gdb.arch/i386-mpx.exp: verify size for bnd0
32278         ...
32279
32280         The regexp in the test-case expects "size 17".
32281
32282         Fix this by updating the regexp.
32283
32284         Tested on x86_64-linux.
32285
32286 2022-07-18  Tom de Vries  <tdevries@suse.de>
32287
32288         [gdbsupport] Add parallel_for_each_debug
32289         Add a parallel_for_each_debug variable, set to false by default.
32290
32291         With an a.out compiled from hello world, we get with
32292         parallel_for_each_debug == true:
32293         ...
32294         $ gdb -q -batch a.out -ex start
32295           ...
32296         Parallel for: n_elements: 7271
32297         Parallel for: minimum elements per thread: 10
32298         Parallel for: elts_per_thread: 1817
32299         Parallel for: elements on worker thread 0       : 1817
32300         Parallel for: elements on worker thread 1       : 1817
32301         Parallel for: elements on worker thread 2       : 1817
32302         Parallel for: elements on worker thread 3       : 0
32303         Parallel for: elements on main thread           : 1820
32304
32305         Temporary breakpoint 1, main () at /home/vries/hello.c:6
32306         6         printf ("hello\n");
32307         ...
32308
32309         Tested on x86_64-linux.
32310
32311 2022-07-18  GDB Administrator  <gdbadmin@sourceware.org>
32312
32313         Automatic date update in version.in
32314
32315 2022-07-17  GDB Administrator  <gdbadmin@sourceware.org>
32316
32317         Automatic date update in version.in
32318
32319 2022-07-16  GDB Administrator  <gdbadmin@sourceware.org>
32320
32321         Automatic date update in version.in
32322
32323 2022-07-15  Aaron Merey  <amerey@redhat.com>
32324
32325         gdb-add-index always generates an error when libdebuginfod wasn't compiled in
32326         gdb-add-index runs gdb with -iex 'set debuginfod enabled off'.  If gdb
32327         is not compiled against libdebuginfod this causes an unnecessary error
32328         message to be printed to stderr indicating that gdb was not built with
32329         debuginfod support.
32330
32331         Fix this by changing the 'set debuginfod enabled off' command to a
32332         no-op when gdb isn't built with libdebuginfod.
32333
32334 2022-07-15  Bruno Larsen  <blarsen@redhat.com>
32335
32336         gdb/testsuite: modernize gdb.base/maint.exp
32337         gdb.base/maint.exp was using several gdb_expect statements, probably
32338         because this test case predates the existance of gdb_test_multiple. This
32339         commit updates the test case to use gdb_test_multiple, making it more
32340         resilient to internal errors and such.
32341
32342         The only gdb_expect left in the testcase is one that specifically looks
32343         for an internal error being triggered as a PASS.
32344
32345 2022-07-15  Tom Tromey  <tromey@adacore.com>
32346
32347         Add 'nibbles' to gdb.print_options
32348         When I rebased and updated the print_options patch, I forgot to update
32349         print_options to add the new 'nibbles' feature to the result.  This
32350         patch fixes the oversight.  I'm checking this in.
32351
32352 2022-07-15  Carl Love  <cel@us.ibm.com>
32353
32354         PowerPC: Add support for IEEE 128-bit format.
32355         The test gdb.base/infcall-nested-structs-c.exp fails on a gdb assert
32356         in function ppc64_sysv_abi_return_value in file gdb/ppc-sysv-tdep.c.  The
32357         assert is due to the missing IEEE 128-bit support in file
32358         gdb/ppc-sysv-tdep.c.
32359
32360         The IBM long double was the initial float 128-bit support added by IBM
32361         The IEEE 128-bit support, which is similar IBM long double support, was
32362         made the default starting with GCC 12.  The floating point format
32363         differences include the number of bits used to encode the exponent
32364         and significand.  Also, IBM long double values are passed in a pair of
32365         floating point registers.  The  IEEE 128-bit value is passed in a single
32366         vector register.
32367
32368         This patch fixes the gdb_assert (ok); in function
32369         ppc64_sysv_abi_return_value in gdb/ppc-sysv-tdep.c by adding IEEE FLOAT
32370         128-bit type support for PowerPC.
32371
32372         The patch has been tested on Power 10, ELFv2.  It fixes the following list
32373         of regression failures on Power 10:
32374
32375         gdb.base/infcall-nested-structs-c.exp      192
32376         gdb.base/infcall-nested-structs-c++.exp     76
32377         gdb.base/structs.exp                         9
32378
32379         The patch has been tested on Power 8 BE which is ELFv1.
32380
32381 2022-07-15  Tom Tromey  <tromey@adacore.com>
32382
32383         Add 'summary' mode to Value.format_string
32384         This adds a 'summary' mode to Value.format_string and to
32385         gdb.print_options.  For the former, it lets Python code format values
32386         using this mode.  For the latter, it lets a printer potentially detect
32387         if it is being called in a backtrace with 'set print frame-arguments'
32388         set to 'scalars'.
32389
32390         I considered adding a new mode here to let a pretty-printer see
32391         whether it was being called in a 'backtrace' context at all, but I'm
32392         not sure if this is really desirable.
32393
32394 2022-07-15  Tom Tromey  <tromey@adacore.com>
32395
32396         Expose current 'print' settings to Python
32397         PR python/17291 asks for access to the current print options.  While I
32398         think this need is largely satisfied by the existence of
32399         Value.format_string, it seemed to me that a bit more could be done.
32400
32401         First, while Value.format_string uses the user's settings, it does not
32402         react to temporary settings such as "print/x".  This patch changes
32403         this.
32404
32405         Second, there is no good way to examine the current settings (in
32406         particular the temporary ones in effect for just a single "print").
32407         This patch adds this as well.
32408
32409         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17291
32410
32411 2022-07-15  Carl Love  <cel@us.ibm.com>
32412
32413         PowerPC: fix for gdb.base/eh_return.exp
32414         Disable the Traceback Table generation on PowerPC for this test.  The
32415         Traceback Table consists of a series of bit fields to indicate things like
32416         the Traceback Table version, language, and specific information about the
32417         function.  The Traceback Table is generated following the end of the code
32418         for every function by default.  The Traceback Table is defined in the
32419         PowerPC ELF ABI and is intended to support debuggers and exception
32420         handlers.  The Traceback Table is displayed in the disassembly of functions
32421         by default and is part of the function length.  The table is typically
32422         interpreted by the disassembler as data represented by .long xxx entries.
32423
32424         Generation of the Traceback Table is disabled in this test using the
32425         PowerPC specific gcc compiler option -mtraceback=no, the xlc option
32426         additional_flags-qtable=none and the clang optons
32427          -mllvm -xcoff-traceback-table=false.  Disabling the Traceback Table
32428         generation in this test results in the gdb_test_multiple statement
32429         correctly locating the address of the bclr instruction before the statement
32430         "End of assembler dump." in the disassembly output.
32431
32432 2022-07-15  Tom Tromey  <tromey@adacore.com>
32433
32434         Run 'black' on gdb
32435         Running 'black' on gdb fixed a couple of small issues.  This patch is
32436         the result.
32437
32438 2022-07-15  GDB Administrator  <gdbadmin@sourceware.org>
32439
32440         Automatic date update in version.in
32441
32442 2022-07-14  Tom de Vries  <tdevries@suse.de>
32443
32444         [gdb/symtab] Fix data race in cooked_index_functions::expand_symtabs_matching
32445         When building gdb with -fsanitize-threads and running test-case
32446         gdb.ada/char_enum_unicode.exp, I run into:
32447         ...
32448         WARNING: ThreadSanitizer: data race (pid=21301)^M
32449           Write of size 8 at 0x7b2000008080 by main thread:^M
32450             #0 free <null> (libtsan.so.2+0x4c5e2)^M
32451             #1 _dl_close_worker <null> (ld-linux-x86-64.so.2+0x4b7b)^M
32452             #2 convert_between_encodings() charset.c:584^M
32453           ...
32454             #21 cooked_index_functions::expand_symtabs_matching() read.c:18606
32455         ...
32456
32457         This is fixed by making cooked_index_functions::expand_symtabs_matching wait
32458         for the cooked index finalization to be done.
32459
32460         Tested on x86_64-linux.
32461
32462         https://sourceware.org/bugzilla/show_bug.cgi?id=29311
32463         https://sourceware.org/bugzilla/show_bug.cgi?id=29286
32464
32465 2022-07-14  Tom de Vries  <tdevries@suse.de>
32466
32467         [gdbsupport] Add sequential_for_each
32468         Add a sequential_for_each alongside the parallel_for_each, which can be used
32469         as a drop-in replacement.
32470
32471         This can be useful when debugging multi-threading behaviour, and you want to
32472         limit multi-threading in a fine-grained way.
32473
32474         Tested on x86_64-linux, by using it instead of the parallel_for_each in
32475         dwarf2_build_psymtabs_hard.
32476
32477 2022-07-14  Tiezhu Yang  <yangtiezhu@loongson.cn>
32478
32479         gdb: Document floating-point support for LoongArch
32480         Update NEWS and gdb.texinfo to document floating-point support
32481         for LoongArch.
32482
32483 2022-07-14  Tom de Vries  <tdevries@suse.de>
32484
32485         [gdb/build] Fix gdb build with gcc 4.8.5
32486         When building gdb with gcc 4.8.5, we run into:
32487         ...
32488         In file included from /usr/include/c++/4.8/future:43:0,
32489                          from gdbsupport/thread-pool.h:30,
32490                          from gdb/dwarf2/cooked-index.h:33,
32491                          from gdb/dwarf2/read.h:26,
32492                          from gdb/dwarf2/abbrev-cache.c:21:
32493         /usr/include/c++/4.8/atomic: In instantiation of \
32494           ‘_Tp std::atomic<_Tp>::load(std::memory_order) const [with _Tp = \
32495           packed<dwarf_unit_type, 1ul>; std::memory_order = std::memory_order]’:
32496         gdb/dwarf2/read.h:332:44:   required from here
32497         /usr/include/c++/4.8/atomic:208:13: error: no matching function for call to \
32498           ‘packed<dwarf_unit_type, 1ul>::packed()’
32499                  _Tp tmp;
32500                      ^
32501         ...
32502
32503         Fix this by adding the default constructor for packed.
32504
32505         Tested on x86_64-linux, with gdb build with gcc 4.8.5.
32506
32507 2022-07-14  Tom de Vries  <tdevries@suse.de>
32508
32509         [gdb/symtab] Make per_cu->m_lang atomic
32510         When building gdb with -fsanitize=thread and running test-case
32511         gdb.dwarf2/inlined_subroutine-inheritance.exp, we run into a data race
32512         between:
32513         ...
32514           Read of size 1 at 0x7b2000003010 by thread T4:
32515             #0 packed<language, 1ul>::operator language() const packed.h:54
32516             #1 dwarf2_per_cu_data::set_lang(language) read.h:363
32517         ...
32518         and:
32519         ...
32520           Previous write of size 1 at 0x7b2000003010 by main thread:
32521             #0 dwarf2_per_cu_data::set_lang(language) read.h:365
32522         ...
32523
32524         Fix this by making per_cu->m_lang atomic.
32525
32526         Tested on x86_64-linux.
32527
32528         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29286
32529
32530 2022-07-14  Tom de Vries  <tdevries@suse.de>
32531
32532         [gdb/symtab] Make per_cu->unit_type atomic
32533         With gdb with -fsanitize=thread and test-case gdb.ada/array_bounds.exp, I run
32534         into a data race between:
32535         ...
32536           Read of size 1 at 0x7b2000025f0f by main thread:
32537             #0 packed<dwarf_unit_type, 1ul>::operator dwarf_unit_type() const packed.h:54
32538             #1 dwarf2_per_cu_data::set_unit_type(dwarf_unit_type) read.h:339
32539         ...
32540         and:
32541         ...
32542           Previous write of size 1 at 0x7b2000025f0f by thread T3:
32543             #0 dwarf2_per_cu_data::set_unit_type(dwarf_unit_type) read.h:341
32544         ...
32545
32546         Fix this by making per_cu->unit_type atomic.
32547
32548         Tested on x86_64-linux.
32549
32550         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29286
32551
32552 2022-07-14  Tom de Vries  <tdevries@suse.de>
32553
32554         [gdb/symtab] Fix data race in ~charset_vector
32555         When doing:
32556         ...
32557         $ gdb ./outputs/gdb.ada/char_enum_unicode/foo -batch -ex "break foo.adb:26"
32558         ...
32559         with a gdb build with -fsanitize=thread I run into a data race:
32560         ...
32561         WARNING: ThreadSanitizer: data race (pid=30917)
32562           Write of size 8 at 0x7b0400004070 by main thread:
32563             #0 free <null> (libtsan.so.2+0x4c5e2)
32564             #1 xfree<char> gdbsupport/gdb-xfree.h:37 (gdb+0x650f17)
32565             #2 charset_vector::clear() gdb/charset.c:703 (gdb+0x651354)
32566             #3 charset_vector::~charset_vector() gdb/charset.c:697 (gdb+0x6512d3)
32567             #4 <null> <null> (libtsan.so.2+0x32643)
32568             #5 captured_main_1 gdb/main.c:1310 (gdb+0xa3975a)
32569         ...
32570
32571         The problem is that we're freeing the charset_vector elements in the destructor,
32572         which may still be used by a worker thread.
32573
32574         Fix this by not freeing the charset_vector elements in the destructor.
32575
32576         Tested on x86_64-linux.
32577
32578         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29311
32579
32580 2022-07-14  Alan Modra  <amodra@gmail.com>
32581
32582         Re: PowerPC: implement md_operand to parse register names
32583         I meant to make this change before committing, to let compilers know
32584         the code on the false branch of md_parse_name is dead.
32585
32586                 * config/tc-ppc.c (ppc_parse_name): Return void.
32587                 * config/tc-ppc.h (md_parse_name): Always true.
32588                 (ppc_parse_name): Update prototype.
32589
32590 2022-07-14  Alan Modra  <amodra@gmail.com>
32591
32592         PowerPC: implement md_operand to parse register names
32593         Allows register names to appear in symbol assignments, so for example
32594          tocp = %r2
32595          mr %r3,tocp
32596         now assembles.
32597
32598                 * gas/config/tc-ppc.c (REG_NAME_CNT): Delete, replace uses with
32599                 ARRAY_SIZE.
32600                 (register_name): Rename to..
32601                 (md_operand): ..this.  Only handle %reg.
32602                 (cr_names): Rename to..
32603                 (cr_cond): ..this.  Just keep conditions.
32604                 (ppc_parse_name): Add mode param.  Search both cr_cond and
32605                 pre_defined_registers.  Handle absolute and register symbol
32606                 values here rather than in expr.c:operand().
32607                 (md_assemble): Don't special case register name matching in
32608                 operands, except to set cr_operand as appropriate.
32609                 * gas/config/tc-ppc.h (md_operand): Don't define.
32610                 (md_parse_name, ppc_parse_name): Update.
32611                 * read.c (pseudo_set): Copy over entire O_register value.
32612                 * testsuite/gas/ppc/regsyms.d.
32613                 * testsuite/gas/ppc/regsyms.s: New test.
32614                 * testsuite/gas/ppc/ppc.exp: Run it.
32615
32616 2022-07-14  GDB Administrator  <gdbadmin@sourceware.org>
32617
32618         Automatic date update in version.in
32619
32620 2022-07-13  Pedro Alves  <pedro@palves.net>
32621
32622         Tighten gdb.threads/no-unwaited-for-left.exp regexps
32623         A WIP version of a patch
32624         (https://sourceware.org/pipermail/gdb-patches/2022-June/190202.html)
32625         resulted in a bug that went unnoticed by the testuite, like so:
32626
32627          (gdb) PASS: gdb.threads/no-unwaited-for-left.exp: enable scheduler-locking, for main thread
32628          continue
32629          Continuing.
32630          [New Thread 1251861.1251861]
32631          No unwaited-for children left.
32632          (gdb) PASS: gdb.threads/no-unwaited-for-left.exp: continue stops when the main thread exits
32633          info threads
32634            Id   Target Id                                Frame
32635            3    Thread 1251861.1251863 "no-unwaited-for" __pthread_clockjoin_ex (threadid=140737351558976, thread_return=0x0, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>) at pthread_join_common.c:145
32636            4    Thread 1251861.1251861 "no-unwaited-for" <unavailable> in ?? ()
32637
32638          The current thread <Thread ID 1> has terminated.  See `help thread'.
32639          (gdb) PASS: gdb.threads/no-unwaited-for-left.exp: only thread 3 left, main thread terminated
32640
32641         Somehow, above, GDB re-added the zombie leader back before printing
32642         "No unwaited-for children left.".  The "only thread 3 left, main
32643         thread terminated" test should have caught this, but didn't.  That is
32644         because the test's regexp has a ".*" after the part that matches
32645         thread 3.  This commit tightens that regexp to catch such a bug.  It
32646         also tightens the "only main thread left, thread 2 terminated" test's
32647         regexp in the same way.
32648
32649         Change-Id: I8744f327a0aa0e2669d1ddda88247e99b91cefff
32650
32651 2022-07-13  Carl Love  <cel@us.ibm.com>
32652
32653         Fix for gdb.base/stap-probe.c
32654         On PowePC, the test fails on a compile error:
32655
32656           /../binutils-gdb-current/gdb/testsuite/gdb.base/stap-probe.c:107:1: error: expected '=', ',', ';', 'asm' or 'attribute' before 'use_xmm_reg'
32657           107 | use_xmm_reg (int val)
32658           | ^~~~~~~~~~~
32659
32660         Where the source code for stap-probe.c is:
32661
32662           static const char * __attribute__((noinline)) ATTRIBUTE_NOCLONE
32663           use_xmm_reg (int val)                         <-- line 107
32664           {
32665           ...
32666
32667         The issue is the ATTRIBUTE_NOCLONE is not defined as an attribute as
32668         expected.  The #define for ATTRIBUTE_NOCLONE can be found in
32669         ../lib/attributes.h.
32670
32671         This patch adds the missing include statement for the definition of
32672         ATTRIBUTE_NOCLONE.
32673
32674         The patch has been tested and verified on a Power10 system.
32675
32676 2022-07-13  Carl Love  <cel@us.ibm.com>
32677
32678         Add PowerPC support to gdb.cp/call-method-register.cc
32679         This patch adds the needed define ASM_REG for PowerPC.
32680
32681         The patch was run on a Power 10 system.  The gdb Summary for the run lists
32682         2 expected passes, no unexpected failures or untested testcases.
32683
32684         Please let me know if this patch is acceptable for mainline.
32685
32686                                  Carl Love
32687
32688 2022-07-13  Carl Love  <cel@us.ibm.com>
32689
32690         Fix gdb.base/step-indirect-call-thunk.exp
32691         Due to recent changes in the default value of -fcf-protection for gcc, the
32692         test gdb.base/step-indirect-call-thunk.exp fails on Intel X86-64 with the
32693         error:
32694
32695         Executing on host: gcc  -fno-stack-protector  -fdiagnostics-color=never
32696         -mindirect-branch=thunk -mfunction-return=thunk -c -g
32697         -o /.../gdb/testsuite/outputs/gdb.base/step-indirect-call-thunk/step-indirect-call-thunk0.o
32698         /.../gdb/testsuite/gdb.base/step-indirect-call-thunk.c
32699         (timeout = 300) builtin_spawn -ignore SIGHUP gcc -fno-stack-protector
32700         -fdiagnostics-color=never -mindirect-branch=thunk -mfunction-return=thunk -c
32701         -g -o /.../gdb/testsuite/outputs/gdb.base/step-indirect-call-thunk/step-indirect-call-thunk0.o
32702         /.../binutils-gdb-current/gdb/testsuite/gdb.base/step-indirect-call-thunk.c
32703         /.../gdb/testsuite/gdb.base/step-indirect-call-thunk.c:
32704          In function 'inc': /.../gdb/testsuite/gdb.base/step-indirect-call-thunk.c:
32705         22:1: error: '-mindirect-branch' and '-fcf-protection' are not compatible
32706            22 | {                /* inc.1 */
32707
32708         As stated in the error message the default "-fcf-protection" and
32709         "-mindirect-branch' are in compatible.  The fcf-protection argument needs
32710         to be "-fcf-protection=none" for the test to compile on Intel.
32711
32712         The gcc command line "-mindirect-branch' is an Intel specific and will give
32713         an error on other platforms.  A check for X86 is added so the test will
32714         only run on X86 platforms.
32715
32716         The patch has been tested and verified on Power 10 and Intel X86-64 systems
32717         with no regressions.
32718
32719 2022-07-13  Pedro Alves  <pedro@palves.net>
32720
32721         Fix "until LINE" in main, when "until" runs into longjmp
32722         With a test like this:
32723
32724         1       #include <dlfcn.h>
32725         2       int
32726         3       main ()
32727         4       {
32728         5          dlsym (RTLD_DEFAULT, "FOO");
32729         6          return 0;
32730         7       }
32731
32732         and then "start" followed by "until 6", GDB currently incorrectly
32733         stops inside the runtime loader, instead of line 6.  Vis:
32734
32735           ...
32736           Temporary breakpoint 1, main () at until.c:5
32737           4       {
32738           (gdb) until 6
32739           0x00007ffff7f0a90d in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffdb00, operate=<optimized out>, args=0x7ffff7f0a90d <__GI__dl_catch_exception+109>) at dl-error-skeleton.c:206
32740           206     dl-error-skeleton.c: No such file or directory.
32741           (gdb)
32742
32743         The problem is related to longjmp handling -- dlsym internally
32744         longjmps on error.  The testcase can be reduced to this:
32745
32746         1       #include <setjmp.h>
32747         2       void func () {
32748         3         jmp_buf buf;
32749         4         if (setjmp (buf) == 0)
32750         5           longjmp (buf, 1);
32751         6       }
32752         7
32753         8       int main () {
32754         9         func ();
32755         10        return 0; /* until to here */
32756         11      }
32757
32758         and then with "start" followed by "until 10", GDB currently
32759         incorrectly stops at line 4 (returning from setjmp), instead of line
32760         10.
32761
32762         The problem is that the BPSTAT_WHAT_CLEAR_LONGJMP_RESUME code in
32763         infrun.c fails to find the initiating frame, and so infrun thinks that
32764         the longjmp jumped somewhere outer to "until"'s originating frame.
32765
32766         Here:
32767
32768             case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME:
32769               {
32770                 struct frame_info *init_frame;
32771
32772                 /* There are several cases to consider.
32773
32774                    1. The initiating frame no longer exists.  In this case we
32775                    must stop, because the exception or longjmp has gone too
32776                    far.
32777
32778                 ...
32779
32780                 init_frame = frame_find_by_id (ecs->event_thread->initiating_frame);
32781
32782                 if (init_frame)   // this is NULL!
32783                   {
32784                      ...
32785                   }
32786
32787                 /* For Cases 1 and 2, remove the step-resume breakpoint, if it
32788                    exists.  */
32789                 delete_step_resume_breakpoint (ecs->event_thread);
32790
32791                 end_stepping_range (ecs);   // case 1., so we stop.
32792               }
32793
32794         The initiating frame is set by until_break_command ->
32795         set_longjmp_breakpoint.  The initiating frame is supposed to be the
32796         frame that is selected when the command was issued, but
32797         until_break_command instead passes the frame id of the _caller_ frame
32798         by mistake.  When the "until LINE" command is issued from main, the
32799         caller frame is the caller of main.  When later infrun tries to find
32800         that frame by id, it fails to find it, because frame_find_by_id
32801         doesn't unwind past main.
32802
32803         The bug is that we passed the caller frame's id to
32804         set_longjmp_breakpoint.  We should have passed the selected frame's id
32805         instead.
32806
32807         Change-Id: Iaae1af7cdddf296b7c5af82c3b5b7d9b66755b1c
32808
32809 2022-07-13  Enze Li  <enze.li@hotmail.com>
32810
32811         gdbserver: remove unused variable
32812         When building with clang 15, I got this error:
32813
32814           CXX    server.o
32815         server.cc:2985:10: error: variable 'new_argc' set but not used [-Werror,-Wunused-but-set-variable]
32816           int i, new_argc;
32817                      ^
32818         Remove the unused variable to eliminate the error.
32819
32820         Tested by rebuilding on x86_64-linux with clang 15.
32821
32822 2022-07-13  Tom de Vries  <tdevries@suse.de>
32823
32824         [gdb/symtab] Make per_cu->set_lang more strict
32825         We have in per_cu->set_lang this comment:
32826         ...
32827           void set_lang (enum language lang)
32828           {
32829             /* We'd like to be more strict here, similar to what is done in
32830                set_unit_type,  but currently a partial unit can go from unknown to
32831                minimal to ada to c.  */
32832         ...
32833
32834         Fix this by not setting m_lang for partial units.
32835
32836         This requires us to move the m_unit_type initialization to ensure that
32837         m_unit_type is initialized before per_cu->m_lang.
32838
32839         Tested on x86_64-linux, with native and target board cc-with-dwz-m.
32840
32841 2022-07-13  GDB Administrator  <gdbadmin@sourceware.org>
32842
32843         Automatic date update in version.in
32844
32845 2022-07-12  Pedro Alves  <pedro@palves.net>
32846
32847         Improve "set scheduler-locking" documentation
32848         This improves the "set scheduler-locking" documentation in the GDB
32849         manual:
32850
32851          - Use a table to describe the four available modes.
32852
32853          - Describe "step" in terms of "on" and "off".
32854
32855          - Tweak the "replay" mode's description to describe replay first
32856            instead of recording, and also mention how the mode behaves during
32857            normal execution.
32858
32859          - Say what is the default mode.
32860
32861         Change-Id: Ie12140138b37534b7fc1d904da34f0f174aa11ce
32862
32863 2022-07-12  Tom de Vries  <tdevries@suse.de>
32864
32865         [gdb/symtab] Add dwarf2_cu::lang ()
32866         The cu->per_cu->lang field was added to carry information from the initial
32867         partial symtabs phase to the symtab expansion phase, for the benefit of a
32868         particular optimization in process_imported_unit_die.
32869
32870         Other uses have been added, but since the first phase now has been
32871         parallelized, those have become problematic and sources of race conditions.
32872
32873         Fix this by adding dwarf2_cu::lang () and using it where we can to replace
32874         cu->per_cu->lang () with cu->lang ().
32875
32876         Also assert in dwarf2_cu::lang () that we're not returning language_unknown.
32877
32878         Tested on x86_64-linux.
32879
32880 2022-07-12  Martin Liska  <mliska@suse.cz>
32881
32882         LTO plugin: sync header file with GCC
32883         include/ChangeLog:
32884
32885                 * plugin-api.h (enum ld_plugin_tag): Sync with GCC.
32886
32887 2022-07-12  Tom de Vries  <tdevries@suse.de>
32888
32889         [gdb/record] Support recording of getrandom
32890         Add missing support for recording of linux syscall getrandom.
32891
32892         Tested on x86_64-linux with native and target board unix/-m32.
32893
32894         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22081
32895
32896 2022-07-12  Tiezhu Yang  <yangtiezhu@loongson.cn>
32897
32898         gdbserver: LoongArch: Add floating-point support
32899         This commit adds floating-point support for LoongArch gdbserver.
32900
32901         gdb: LoongArch: Add floating-point support
32902         This commit adds floating-point support for LoongArch gdb.
32903
32904 2022-07-12  Tom de Vries  <tdevries@suse.de>
32905
32906         [gdb/testsuite] Run two test-cases with ASAN_OPTIONS=verify_asan_link_order=0
32907         When building gdb with -fsanitize=address we run into:
32908         ...
32909         builtin_spawn gdb -nw -nx -iex set height 0 -iex set width 0 -data-directory \
32910           build/gdb/data-directory^M
32911         ==10637==ASan runtime does not come first in initial library list; you \
32912           should either link runtime to your application or manually preload it with \
32913           LD_PRELOAD.^M
32914         ERROR: GDB process no longer exists
32915         ...
32916
32917         Prevent the ASan runtime error by using
32918         ASAN_OPTIONS=verify_asan_link_order=0.  This makes both test-cases pass.
32919
32920         Tested on x86_64-linux.
32921
32922         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29358
32923
32924 2022-07-12  Tom de Vries  <tdevries@suse.de>
32925
32926         [gdb/testsuite] Add tsan-suppressions.txt
32927         Add a new file tsan-suppressions.txt, to suppress the "unlock unlocked mutex"
32928         problem in ncurses, filed in PR29328.
32929
32930         The file is added to the TSAN_OPTIONS in lib/gdb.exp.
32931
32932         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29328
32933
32934 2022-07-12  Tom de Vries  <tdevries@suse.de>
32935
32936         [gdb/build] Fix build with gcc 4.8.5
32937         When building gdb with gcc 4.8.5, we run into problems due to unconditionally
32938         using:
32939         ...
32940              gdb_static_assert (std::is_trivially_copyable<packed>::value);
32941         ...
32942         in gdbsupport/packed.h.
32943
32944         Fix this by guarding the usage with HAVE_IS_TRIVIALLY_COPYABLE.
32945
32946         Tested by doing a full gdb build with gcc 4.8.5.
32947
32948 2022-07-12  Tom de Vries  <tdevries@suse.de>
32949
32950         Fix -fsanitize=thread for per_cu fields
32951         When building gdb with -fsanitize=thread and gcc 12, and running test-case
32952         gdb.dwarf2/dwz.exp, we run into a data race between:
32953         ...
32954           Read of size 1 at 0x7b200000300d by thread T2:^M
32955             #0 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, \
32956             abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) gdb/dwarf2/read.c:6164 \
32957             (gdb+0x82ec95)^M
32958         ...
32959         and:
32960         ...
32961           Previous write of size 1 at 0x7b200000300d by main thread:^M
32962             #0 prepare_one_comp_unit gdb/dwarf2/read.c:23588 (gdb+0x86f973)^M
32963         ...
32964
32965         In other words, between:
32966         ...
32967           if (this_cu->reading_dwo_directly)
32968         ...
32969         and:
32970         ...
32971             cu->per_cu->lang = pretend_language;
32972         ...
32973
32974         Likewise, we run into a data race between:
32975         ...
32976           Write of size 1 at 0x7b200000300e by thread T4:
32977             #0 process_psymtab_comp_unit gdb/dwarf2/read.c:6789 (gdb+0x830720)
32978         ...
32979         and:
32980         ...
32981           Previous read of size 1 at 0x7b200000300e by main thread:
32982             #0 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, \
32983             abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) gdb/dwarf2/read.c:6164 \
32984             (gdb+0x82edab)
32985         ...
32986
32987         In other words, between:
32988         ...
32989               this_cu->unit_type = DW_UT_partial;
32990         ...
32991         and:
32992         ...
32993           if (this_cu->reading_dwo_directly)
32994         ...
32995
32996         Likewise for the write to addresses_seen in cooked_indexer::check_bounds and a
32997         read from is_dwz in dwarf2_find_containing_comp_unit for test-case
32998         gdb.dwarf2/dw2-dir-file-name.exp and target board cc-with-dwz-m.
32999
33000         The problem is that the written fields are part of the same memory location as
33001         the read fields, so executing a read and write in different threads is
33002         undefined behavour.
33003
33004         Making the written fields separate memory locations, using the new
33005         struct packed template fixes this.
33006
33007         The set of fields has been established experimentally to be the
33008         minimal set to get rid of this type of -fsanitize=thread errors, but
33009         more fields might require the same treatment.
33010
33011         Looking at the properties of the lang field, unlike dwarf_version it's
33012         not available in the unit header, so it will be set the first time
33013         during the parallel cooked index reading.  The same holds for
33014         unit_type, and likewise for addresses_seen.
33015
33016         dwarf2_per_cu_data::addresses_seen is moved so that the bitfields that
33017         currently follow it can be merged in the same memory location as the
33018         bitfields that currently precede it, for better packing.
33019
33020         Tested on x86_64-linux.
33021
33022         Co-Authored-By: Pedro Alves <pedro@palves.net>
33023
33024         Change-Id: Ifa94f0a2cebfae5e8f6ddc73265f05e7fd9e1532
33025
33026 2022-07-12  Pedro Alves  <pedro@palves.net>
33027
33028         Introduce struct packed template
33029         When building gdb with -fsanitize=thread and gcc 12, and running test-case
33030         gdb.dwarf2/dwz.exp, we run into a few data races.  For example, between:
33031
33032          ...
33033            Write of size 1 at 0x7b200000300e by thread T4:
33034              #0 process_psymtab_comp_unit gdb/dwarf2/read.c:6789 (gdb+0x830720)
33035          ...
33036
33037         and:
33038
33039          ...
33040            Previous read of size 1 at 0x7b200000300e by main thread:
33041              #0 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, \
33042              abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) gdb/dwarf2/read.c:6164 \
33043              (gdb+0x82edab)
33044          ...
33045
33046         In other words, between:
33047
33048          ...
33049                this_cu->unit_type = DW_UT_partial;
33050          ...
33051
33052         and:
33053
33054          ...
33055            if (this_cu->reading_dwo_directly)
33056          ...
33057
33058         The problem is that the written fields are part of the same memory
33059         location as the read fields, so executing a read and write in
33060         different threads is undefined behavour.
33061
33062         Making the written fields separate memory locations, like this:
33063
33064         ...
33065           struct {
33066             ENUM_BITFIELD (dwarf_unit_type) unit_type : 8;
33067           };
33068         ...
33069
33070         fixes it, however that also increases the size of struct
33071         dwarf2_per_cu_data, because it introduces padding due to alignment of
33072         these new structs, which align on the natural alignment of the
33073         specified type of their fields.  We can fix that with
33074         __attribute__((packed)), like so:
33075
33076           struct {
33077             ENUM_BITFIELD (dwarf_unit_type) unit_type : 8 __attribute__((packed));
33078           };
33079
33080         but to avoid having to write that in several places and add suitable
33081         comments explaining how that concoction works, introduce a new struct
33082         packed template that wraps/hides this.  Instead of the above, we'll be
33083         able to write:
33084
33085             packed<dwarf_unit_type, 1> unit_type;
33086
33087         Note that we can't change the type of dwarf_unit_type, as that is
33088         defined in include/, and shared with other projects, some of those
33089         written in C.
33090
33091         This patch just adds the struct packed type.  Following patches will
33092         make use of it.  One of those patches will want to wrap a struct
33093         packed in an std::atomic, like:
33094
33095           std::atomic<std::packed<language, 1>> m_lang;
33096
33097         so the new gdbsupport/packed.h header adds some operators to make
33098         comparisions between that std::atomic and the type that the wrapped
33099         struct packed wraps work, like in:
33100
33101            if (m_lang == language_c)
33102
33103         It would be possible to implement struct packed without using
33104         __attribute__((packed)), by having it store an array of bytes of the
33105         appropriate size instead, however that would make it less convenient
33106         to debug GDB.  The way it's implemented, printing a struct packed
33107         variable just prints its field using its natural type, which is
33108         particularly useful if the type is an enum.  I believe that
33109         __attribute__((packed)) is supported by all compilers that are able to
33110         build GDB.  Even a few BFD headers use on ATTRIBUTE_PACKED on external
33111         types:
33112
33113          include/coff/external.h:  } ATTRIBUTE_PACKED
33114          include/coff/external.h:} ATTRIBUTE_PACKED ;
33115          include/coff/external.h:} ATTRIBUTE_PACKED ;
33116          include/coff/pe.h:} ATTRIBUTE_PACKED ;
33117          include/coff/pe.h:} ATTRIBUTE_PACKED;
33118          include/elf/external.h:} ATTRIBUTE_PACKED  Elf_External_Versym;
33119
33120         It is not possible to build GDB with MSVC today, but if it could, that
33121         would be one compiler that doesn't support this attribute.  However,
33122         it supports packing via pragmas, so there's a way to cross that bridge
33123         if we ever get to it.  I believe any compiler worth its salt supports
33124         some way of packing.
33125
33126         In any case, the worse that happens without the attribute is that some
33127         types become larger than ideal.  Regardless, I've added a couple
33128         static assertions to catch such compilers in action:
33129
33130             /* Ensure size and aligment are what we expect.  */
33131             gdb_static_assert (sizeof (packed) == Bytes);
33132             gdb_static_assert (alignof (packed) == 1);
33133
33134         Change-Id: Ifa94f0a2cebfae5e8f6ddc73265f05e7fd9e1532
33135
33136 2022-07-12  Alan Modra  <amodra@gmail.com>
33137
33138         PowerPC md_end: Don't htab_delete(NULL)
33139         It might be possible to hit md_end before md_begin is called, don't
33140         segfault if so.  Also, remove a useless check.
33141
33142                 * gas/config/tc-ppc.c (insn_calloc): Remove needless overflow
33143                 check.
33144                 (ppc_md_end): Check ppc_hash before deleting.  Clear ppc_hash.
33145
33146 2022-07-12  Alan Modra  <amodra@gmail.com>
33147
33148         PR29355, ld segfaults with -r/-q and custom-named section .rela*
33149         The bug testcase uses an output section named .rel or .rela which has
33150         input .data sections mapped to it.  The input .data section has
33151         relocations.  When counting output relocations SHT_REL and SHT_RELA
33152         section reloc_count is ignored, with the justification that reloc
33153         sections themselves can't have relocations and some backends use
33154         reloc_count in reloc sections.  However, the test wrongly used the
33155         output section type (which normally would match input section type).
33156         Fix that.  Note that it is arguably wrong for ld to leave the output
33157         .rel/.rela section type as SHT_REL/SHT_RELA when non-empty non-reloc
33158         sections are written to it, but I'm not going to change that since it
33159         might be useful to hand-craft relocs in a data section that is then
33160         written to a SHT_REL/SHT_RELA output section.
33161
33162                 PR 29355
33163                 * elflink.c (bfd_elf_final_link): Use input section type rather
33164                 than output section type to determine whether to exclude using
33165                 reloc_count from that section.
33166
33167 2022-07-12  Jiangshuai Li  <jiangshuai_li@c-sky.com>
33168
33169         gdb/csky complete csky_dwarf_reg_to_regnum
33170         For csky arch, the correspondence between Dwarf registers and GDB
33171         registers are as follows:
33172         dwarf regnos 0~31 ==> gdb regs r0~r31
33173         dwarf regno  CSKY_HI_REGNUM(36) ==> gdb reg hi
33174         dwarf regno  CSKY_LO_REGNUM(37) ==> gdb reg hi
33175         dwarf regno  CSKY_PC_REGNUM(72) ==> gdb reg pc
33176         dwarf regnos FV_PSEUDO_REGNO_FIRST(74)~FV_PSEUDO_REGNO_LAST(201)
33177         ==>
33178         gdb regs s0~s127 (pseudo regs for float and vector regs)
33179
33180         other dwarf regnos have no corresponding gdb regs to them.
33181
33182 2022-07-12  GDB Administrator  <gdbadmin@sourceware.org>
33183
33184         Automatic date update in version.in
33185
33186 2022-07-11  Pedro Alves  <pedro@palves.net>
33187
33188         Always emit =thread-exited notifications, even if silent
33189         [Note: the testcased added by this commit depends on
33190         https://sourceware.org/pipermail/gdb-patches/2022-June/190259.html,
33191         otherwise GDB just crashes when detaching the core]
33192
33193         Currently, in MI, =thread-created are always emitted, like:
33194
33195          =thread-group-started,id="i1",pid="195680"
33196          =thread-created,id="1",group-id="i1"
33197          ...
33198
33199         but on teardown, if the target uses exit_inferior_silent, then you'll
33200         only see the inferior exit notification (thread-group-exited), no
33201         notification for threads.
33202
33203         The core target is one of the few targets that use
33204         exit_inferior_silent.  Here's an example session:
33205
33206          -target-select core $corefile
33207          =thread-group-started,id="i1",pid="195680"
33208          =thread-created,id="1",group-id="i1"
33209          ...
33210          ^connected,frame=....
33211          (gdb)
33212          -target-detach
33213          =thread-group-exited,id="i1"
33214          ^done
33215          (gdb)
33216
33217         This imbalance of emitting =thread-created but then not =thread-exited
33218         seems off to me.  (And, it complicates changes I want to do to
33219         centralize emitting thread exit notifications for the CLI, which is
33220         why I'm looking at this.)
33221
33222         And then, since most other targets use exit_inferior instead of
33223         exit_inferior_silent, MI is already emitting =thread-exited
33224         notifications when tearing down an inferior, for most targets.
33225
33226         This commit makes MI always emit the =thread-exited notifications,
33227         even for exit_inferior_silent.
33228
33229         Afterwards, when debugging a core, MI outputs:
33230
33231          (gdb)
33232          -target-detach
33233          =thread-exited,id="1",group-id="i1"    << new line
33234          =thread-group-exited,id="i1"
33235          ^done
33236          (gdb)
33237
33238         Surprisingly, there's no MI testcase debugging a core file.  This
33239         commit adds the first.
33240
33241         Change-Id: I5100501a46f07b6bbad3e04d120c2562a51c93a4
33242
33243 2022-07-11  Pedro Alves  <pedro@palves.net>
33244
33245         Fix core-file -> detach -> crash (corefiles/29275)
33246         After loading a core file, you're supposed to be able to use "detach"
33247         to unload the core file.  That unfortunately regressed starting with
33248         GDB 11, with these commits:
33249
33250          1192f124a308 - gdb: generalize commit_resume, avoid commit-resuming when threads have pending statuses
33251          408f66864a1a - detach in all-stop with threads running
33252
33253         resulting in a GDB crash:
33254
33255          ...
33256          Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
33257          0x0000555555e842bf in maybe_set_commit_resumed_all_targets () at ../../src/gdb/infrun.c:2899
33258          2899          if (proc_target->commit_resumed_state)
33259          (top-gdb) bt
33260          #0  0x0000555555e842bf in maybe_set_commit_resumed_all_targets () at ../../src/gdb/infrun.c:2899
33261          #1  0x0000555555e848bf in scoped_disable_commit_resumed::reset (this=0x7fffffffd440) at ../../src/gdb/infrun.c:3023
33262          #2  0x0000555555e84a0c in scoped_disable_commit_resumed::reset_and_commit (this=0x7fffffffd440) at ../../src/gdb/infrun.c:3049
33263          #3  0x0000555555e739cd in detach_command (args=0x0, from_tty=1) at ../../src/gdb/infcmd.c:2791
33264          #4  0x0000555555c0ba46 in do_simple_func (args=0x0, from_tty=1, c=0x55555662a600) at ../../src/gdb/cli/cli-decode.c:95
33265          #5  0x0000555555c112b0 in cmd_func (cmd=0x55555662a600, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:2514
33266          #6  0x0000555556173b1f in execute_command (p=0x5555565c5916 "", from_tty=1) at ../../src/gdb/top.c:699
33267
33268         The code that crashes looks like:
33269
33270          static void
33271          maybe_set_commit_resumed_all_targets ()
33272          {
33273            scoped_restore_current_thread restore_thread;
33274
33275            for (inferior *inf : all_non_exited_inferiors ())
33276              {
33277                process_stratum_target *proc_target = inf->process_target ();
33278
33279                if (proc_target->commit_resumed_state)
33280                    ^^^^^^^^^^^
33281
33282         With 'proc_target' above being null.  all_non_exited_inferiors filters
33283         out inferiors that have pid==0.  We get here at the end of
33284         detach_command, after core_target::detach has already run, at which
33285         point the inferior _should_ have pid==0 and no process target.  It is
33286         clear it no longer has a process target, but, it still has a pid!=0
33287         somehow.
33288
33289         The reason the inferior still has pid!=0, is that core_target::detach
33290         just unpushes, and relies on core_target::close to actually do the
33291         getting rid of the core and exiting the inferior.  The problem with
33292         that is that detach_command grabs an extra strong reference to the
33293         process stratum target, so the unpush_target inside
33294         core_target::detach doesn't actually result in a call to
33295         core_target::close.
33296
33297         Fix this my moving the cleaning up the core inferior to a shared
33298         routine called by both core_target::close and core_target::detach.  We
33299         still need to cleanup the inferior from within core_file::close
33300         because there are paths to it that want to get rid of the core without
33301         going through detach.  E.g., "core-file" -> "run".
33302
33303         This commit includes a new test added to gdb.base/corefile.exp to
33304         cover the "core-file core" -> "detach" scenario.
33305
33306         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29275
33307
33308         Change-Id: Ic42bdd03182166b19f598428b0dbc2ce6f67c893
33309
33310 2022-07-11  Pedro Alves  <pedro@palves.net>
33311
33312         Fix non-existent "@var{thread-id}" in stop reply descriptions
33313         In the description of stop replies, where the "thread" register is
33314         explained, and where the fork and vfork stop reasons are detailed,
33315         there are references to "@var{thread-id}", but such variable does not
33316         actually exist.  This commit fixes it.
33317
33318         Change-Id: If679944aaf15f6f64aabe506339a9e7667864cab
33319
33320 2022-07-11  Luis Machado  <luis.machado@arm.com>
33321
33322         Try a couple PAuth compilation flags for gdb.arch/aarch64-pauth.exp
33323         The -msign-return-address switch has been dropped from GCC, but some
33324         older compiler may still support it.  Make sure we try both
33325         -msign-return-address and -mbranch-protection before bailing out when
33326         running gdb.arch/aarch64-pauth.exp.
33327
33328 2022-07-11  Andrew Burgess  <aburgess@redhat.com>
33329
33330         gdb: add support for disassembler styling using libopcodes
33331         This commit extends GDB to make use of libopcodes styling support
33332         where available, currently this is just i386 based architectures, and
33333         RISC-V.
33334
33335         For architectures that don't support styling using libopcodes GDB will
33336         fall back to using the Python Pygments package, when the package is
33337         available.
33338
33339         The new libopcodes based styling has the disassembler identify parts
33340         of the disassembled instruction, e.g. registers, immediates,
33341         mnemonics, etc, and can style these components differently.
33342         Additionally, as the styling is now done in GDB we can add settings to
33343         allow the user to configure which colours are used right from the GDB
33344         CLI.
33345
33346         There's some new maintenance commands:
33347
33348           maintenance set libopcodes-styling enabled on|off
33349           maintenance show libopcodes-styling
33350
33351         These can be used to manually disable use of libopcodes styling.  This
33352         is a maintenance command as it's not anticipated that a user should
33353         need to do this.  But, this could be useful for testing, or, in some
33354         rare cases, a user might want to override the Python hook used for
33355         disassembler styling, and then disable libopcode styling so that GDB
33356         falls back to using Python.  Right now I would consider this second
33357         use case a rare situation, which is why I think a maintenance command
33358         is appropriate.
33359
33360         When libopcodes is being used for styling then the user can make use
33361         of the following new styles:
33362
33363           set/show style disassembler comment
33364           set/show style disassembler immediate
33365           set/show style disassembler mnemonic
33366           set/show style disassembler register
33367
33368         The disassembler also makes use of the 'address' and 'function'
33369         styles to style some parts of the disassembler output.  I have also
33370         added the following aliases though:
33371
33372           set/show style disassembler address
33373           set/show style disassembler symbol
33374
33375         these are aliases for:
33376
33377           set/show style address
33378           set/show style function
33379
33380         respectively, and exist to make it easier for users to discover
33381         disassembler related style settings.  The 'address' style is used to
33382         style numeric addresses in the disassembler output, while the 'symbol'
33383         or 'function' style is used to style the names of symbols in
33384         disassembler output.
33385
33386         As not every architecture supports libopcodes styling, the maintenance
33387         setting 'libopcodes-styling enabled' has an "auto-off" type behaviour.
33388         Consider this GDB session:
33389
33390           (gdb) show architecture
33391           The target architecture is set to "auto" (currently "i386:x86-64").
33392           (gdb) maintenance show libopcodes-styling enabled
33393           Use of libopcodes styling support is "on".
33394
33395         the setting defaults to "on" for architectures that support libopcodes
33396         based styling.
33397
33398           (gdb) set architecture sparc
33399           The target architecture is set to "sparc".
33400           (gdb) maintenance show libopcodes-styling enabled
33401           Use of libopcodes styling support is "off" (not supported on architecture "sparc")
33402
33403         the setting will show as "off" if the user switches to an architecture
33404         that doesn't support libopcodes styling.  The underlying setting is
33405         still "on" at this point though, if the user switches back to
33406         i386:x86-64 then the setting would go back to being "on".
33407
33408           (gdb) maintenance set libopcodes-styling enabled off
33409           (gdb) maintenance show libopcodes-styling enabled
33410           Use of libopcodes styling support is "off".
33411
33412         now the setting is "off" for everyone, even if the user switches back
33413         to i386:x86-64 the setting will still show as "off".
33414
33415           (gdb) maintenance set libopcodes-styling enabled on
33416           Use of libopcodes styling not supported on architecture "sparc".
33417           (gdb) maintenance show libopcodes-styling enabled
33418           Use of libopcodes styling support is "off".
33419
33420         attempting to switch the setting "on" for an unsupported architecture
33421         will give an error, and the setting will remain "off".
33422
33423           (gdb) set architecture auto
33424           The target architecture is set to "auto" (currently "i386:x86-64").
33425           (gdb) maintenance show libopcodes-styling enabled
33426           Use of libopcodes styling support is "off".
33427           (gdb) maintenance set libopcodes-styling enabled on
33428           (gdb) maintenance show libopcodes-styling enabled
33429           Use of libopcodes styling support is "on".
33430
33431         the user will need to switch back to a supported architecture before
33432         they can one again turn this setting "on".
33433
33434 2022-07-11  Andrew Burgess  <aburgess@redhat.com>
33435
33436         gdb: have gdb_disassemble_info carry 'this' in its stream pointer
33437         The gdb_disassemble_info class is a wrapper around the libopcodes
33438         disassemble_info struct.  The 'stream' field of disassemble_info is
33439         passed as an argument to the fprintf_func and fprintf_styled_func
33440         callbacks when the disassembler wants to print anything.
33441
33442         Previously, GDB would store a pointer to a ui_file object in the
33443         'stream' field, then, when the disassembler wanted to print anything,
33444         the content would be written to the ui_file object.  An example of an
33445         fprintf_func callback, from gdb/disasm.c is:
33446
33447           int
33448           gdb_disassembler::dis_asm_fprintf (void *stream, const char *format, ...)
33449           {
33450             /* Write output to STREAM here.  */
33451           }
33452
33453         This is fine, but has one limitation, within the print callbacks we
33454         only have access to STREAM, we can't access any additional state
33455         stored within the gdb_disassemble_info object.
33456
33457         Right now this isn't a problem, but in a future commit this will
33458         become an issue, how we style the output being written to STREAM will
33459         depend on the state of the gdb_disassemble_info object, and this state
33460         might need to be updated, depending on what is being printed.
33461
33462         In this commit I propose changing the 'stream' field of the
33463         disassemble_info to carry a pointer to the gdb_disassemble_info
33464         sub-class, rather than the stream itself.
33465
33466         We then have the two sub-classes of gdb_disassemble_info to consider,
33467         the gdb_non_printing_disassembler class never cared about the stream,
33468         previously, for this class, the stream was nullptr.  With the change
33469         to make stream be a gdb_disassemble_info pointer, no further updates
33470         are needed for gdb_non_printing_disassembler.
33471
33472         The other sub-class is gdb_printing_disassembler.  In this case the
33473         sub-class now carries around a pointer to the stream object.  The
33474         print callbacks are updated to cast the incoming stream object back to
33475         a gdb_printing_disassembler, and then extract the stream.
33476
33477         This is purely a refactoring commit.  A later commit will add
33478         additional state to the gdb_printing_disassembler, and update the
33479         print callbacks to access this state.
33480
33481         There should be no user visible changes after this commit.
33482
33483 2022-07-11  Tom de Vries  <tdevries@suse.de>
33484
33485         [gdb/symtab] Fix data race in per_cu->length
33486         With gdb build with -fsanitize=thread and test-case
33487         gdb.dwarf2/dw4-sig-types.exp and target board cc-with-dwz-m we run into a data
33488         race between:
33489         ...
33490           Write of size 4 at 0x7b2800002268 by thread T4:^M
33491             #0 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, \
33492             abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) gdb/dwarf2/read.c:6236 \
33493             (gdb+0x82f525)^M
33494         ...
33495         and this read:
33496         ...
33497           Previous read of size 4 at 0x7b2800002268 by thread T1:^M
33498             #0 dwarf2_find_containing_comp_unit gdb/dwarf2/read.c:23444 \
33499             (gdb+0x86e22e)^M
33500         ...
33501
33502         In other words, between this write:
33503         ...
33504                     this_cu->length = cu->header.get_length ();
33505         ...
33506         and this read:
33507         ...
33508                       && mid_cu->sect_off + mid_cu->length > sect_off))
33509         ...
33510         of per_cu->length.
33511
33512         Fix this similar to the per_cu->dwarf_version case, by only setting it if
33513         needed, and otherwise verifying that the same value is used.  [ Note that the
33514         same code is already present in the other cutu_reader constructor. ]
33515
33516         Move this logic into into a member function set_length to make sure it's used
33517         consistenly, and make the field private in order to enforce access through the
33518         member functions, and rename it to m_length.
33519
33520         This exposes (running test-case gdb.dwarf2/fission-reread.exp) that in
33521         fill_in_sig_entry_from_dwo_entry, the m_length field is overwritten.
33522         For now, allow for that exception.
33523
33524         While we're at it, make sure that the length is set before read.
33525
33526         Tested on x86_64-linux.
33527
33528         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29344
33529
33530 2022-07-11  Tom de Vries  <tdevries@suse.de>
33531
33532         [gdb/symtab] Use comp_unit_head::get_length
33533         There's a spot in read_comp_units_from_section where we explictly use
33534         initial_length_size to get the total length:
33535         ...
33536               this_cu->length = cu_header.length + cu_header.initial_length_size;
33537         ...
33538
33539         Instead, just use cu_header.get_length ().
33540
33541         Tested on x86_64-linux.
33542
33543 2022-07-11  GDB Administrator  <gdbadmin@sourceware.org>
33544
33545         Automatic date update in version.in
33546
33547 2022-07-10  Luis Machado  <luis.machado@arm.com>
33548
33549         Fix include guard naming for arch/aarch64-mte-linux.h
33550         It should be ARCH_AARCH64_MTE_LINUX_H as opposed to ARCH_AARCH64_LINUX_H.
33551
33552 2022-07-10  Youling Tang  <tangyouling@loongson.cn>
33553
33554         gdbserver: LoongArch: Add orig_a0 processing
33555         Commit 736918239b16 ("gdb: LoongArch: add orig_a0 into register set")
33556         introduced orig_a0, similar processing needs to be done in gdbserver.
33557
33558         At the same time, add orig_a0 related comments.
33559
33560 2022-07-10  Youling Tang  <tangyouling@loongson.cn>
33561
33562         gdbserver: LoongArch: Simplify code with register number macros
33563         Move "enum loongarch_regnum" to gdb/arch/loongarch.h so that the
33564         macro definitions can be used in gdbserver/linux-loongarch-low.cc
33565         to simplify the code.
33566
33567 2022-07-10  GDB Administrator  <gdbadmin@sourceware.org>
33568
33569         Automatic date update in version.in
33570
33571 2022-07-09  Alan Modra  <amodra@gmail.com>
33572
33573         gas: tc-tic54x.c hash tables
33574         Cleaning up the subsym_hash memory is a real pain.  Keys and values
33575         entered into the table are quite diverse.  In some cases the key is
33576         allocated and thus needs to be freed, in others the key is a const
33577         string.  Values are similar, and in some cases not even a string.
33578         Tidy this by inserting a new subsym_ent_t that describes key/value
33579         type.  This meant the math_hash table was no longer needed.  The patch
33580         also tidies how math functions are called, those that are supposed to
33581         return int now no longer return their value in a float.
33582
33583                 * config/tc-tic54x.c (math_hash): Delete.
33584                 (subsym_proc_entry): Move earlier, make proc a union, merge with..
33585                 (math_proc_entry): ..this.  Delete type.
33586                 (math_procs): Merge into subsym_procs.
33587                 (subsym_ent_t): New.  Use this type in subsym_hash..
33588                 (stag_add_field_symbols, tic54x_var, tic54x_macro_info): ..here..
33589                 (md_begin, subsym_create_or_replace, subsym_lookup): ..and here..
33590                 (subsym_substitute): ..and here.  Adjust subsym_proc_entry
33591                 function calls.  Free replacement when not returned.
33592                 (subsym_get_arg): Adjust subsym_lookup.
33593                 (free_subsym_ent, subsym_htab_create ): New functions, use when
33594                 creating subsym_hash.
33595                 (free_local_label_ent, local_label_htab_create): Similarly.
33596                 (tic54x_remove_local_label): Delete.
33597                 (tic54x_clear_local_labels): Simplify.
33598                 (tic54x_asg): Use notes obstack to dup strings.
33599                 (tic54x_eval): Likewise.
33600                 (subsym_ismember): Likewise.
33601                 (math_cvi, math_int, math_sgn): Return int.
33602                 (tic54x_macro_start): Decrement macro_level before calling as_fatal.
33603                 (tic54x_md_end): New function.
33604                 * config/tc-tic54h.c (tic54x_md_end): Declare.
33605                 (md_end): Define.
33606
33607 2022-07-09  Alan Modra  <amodra@gmail.com>
33608
33609         gas: use notes_calloc in string hash
33610         Using notes_calloc means all of the string hash table memory should
33611         now be freed before gas exits, even though htab_delete isn't called.
33612         This also means that the hash table free_f and del_f must be NULL,
33613         because freeing notes obstack memory results in all more recently
33614         allocated notes memory being freed too.  So hash table resizing won't
33615         free any memory, and will be a little faster.  Also, htab_delete won't
33616         do anything (and be quick about it).
33617
33618         Since htab_traverse can also resize hash tables (to make another
33619         traversal faster if the table is largely empty), stop that happening
33620         when only one traversal is done.
33621
33622                 * as.h: Reorder hash.h after symbols.h for notes_calloc decl.
33623                 * hash.h (str_htab_create): Use notes_calloc.  Do not free.
33624                 * symbols.c (resolve_local_symbol_values): Don't resize
33625                 during hash table traversal.
33626                 * config/obj-elf.c (elf_frob_file_after_relocs): Likewise.
33627                 * config/tc-ia64.c (ia64_adjust_symtab, ia64_frob_file): Likewise.
33628                 * config/tc-nds32.c (nds32_elf_analysis_relax_hint): Likewise.
33629
33630 2022-07-09  Alan Modra  <amodra@gmail.com>
33631
33632         gas: target string hash tables
33633         This allocates entries added to the string hash tables on the notes
33634         obstack, so that at least those do not leak.  A followup patch will
33635         switch over the str_hash allocation to notes_calloc, which is why I
33636         haven't implemented deleting all the target string hash tables.
33637
33638                 * config/obj-coff-seh.c (get_pxdata_name, alloc_pxdata_item): Use
33639                 notes obstack for string hash table entries.
33640                 * config/tc-alpha.c (get_alpha_reloc_tag, md_begin): Likewise.
33641                 * config/tc-h8300.c (md_begin): Likewise.
33642                 * config/tc-ia64.c (dot_rot, dot_pred_rel, dot_alias): Likewise.
33643                 * config/tc-nds32.c (nds32_relax_hint): Likewise.
33644                 * config/tc-riscv.c (riscv_init_csr_hash): Likewise.
33645                 * config/tc-score.c (s3_insert_reg): Likewise.
33646                 (s3_build_score_ops_hsh, s3_build_dependency_insn_hsh): Likewise.
33647                 * config/tc-score7.c (s7_build_score_ops_hsh): Likewise.
33648                 (s7_build_dependency_insn_hsh): Likewise.
33649                 * config/tc-tic4x.c (tic4x_asg): Likewise.
33650
33651 2022-07-09  Alan Modra  <amodra@gmail.com>
33652
33653         arc gas: don't leak arc_opcode_hash memory
33654         The arc opcode hash table has entries that have a realloc'd field.
33655         This doesn't lend itself to obstack allocation, so freeing must be
33656         done with a purpose built hashtab del_f.
33657
33658                 * config/tc-arc.c (arc_opcode_free): New function.
33659                 (md_begin): Pass the above as del_f to htab_create_alloc.
33660                 (arc_md_end): New function.
33661                 * config/tc-arc.h (arc_md_end): Declare.
33662                 (md_end): Define.
33663
33664 2022-07-09  Alan Modra  <amodra@gmail.com>
33665
33666         i386 gas: don't leak op_hash or reg_hash memory
33667         This tidies memory used by the two x86 gas string hash tables before
33668         exiting.  I'm using a two-pronged approach, firstly the obvious call
33669         to htab_delete plus telling the libiberty/hashtab.c infrastructure to
33670         free tuples generated by str_hash_insert, and secondly putting the x86
33671         core_optab memory on the notes obstack.  It would be possible to free
33672         core_optab memory by using a custom hash table del_f on x86, as I do
33673         for arc, but a later patch will move all the string hash memory to the
33674         notes obstack.
33675
33676                 * config/tc-i386.c (md_begin): Use notes_alloc for core_optab.
33677                 (386_md_end): New function.
33678                 * config/tc-i386.h (386_md_end): Declare.
33679                 (md_end): Define.
33680                 * hash.h (str_htab_create): Pass free as del_f.
33681
33682 2022-07-09  Alan Modra  <amodra@gmail.com>
33683
33684         ppc gas: don't leak ppc_hash memory
33685                 * config/tc-ppc.c (insn_obstack): New.
33686                 (insn_calloc): New function.
33687                 (ppc_setup_opcodes): Use insn_obstack for ppc_hash.
33688                 (ppc_md_end): New function.
33689                 * config/tc-ppc.h (ppc_md_end): Declare
33690                 (md_end): Define.
33691
33692 2022-07-09  Alan Modra  <amodra@gmail.com>
33693
33694         gas hash.h tidy
33695         Only inline functions should be defined in hash.h, there's no benefit
33696         in having multiple copies of hash_string_tuple and eq_string_tuple.
33697         Also, use the table alloc_f when allocating tuples to be stored, so
33698         that these functions are usable with different memory allocation
33699         strategies.
33700
33701                 * hash.h (struct string_tuple, string_tuple_t): Move earlier.
33702                 (string_tuple_alloc): Add table param, allocate using table alloc_f.
33703                 (str_hash_insert): Adjust to suit.  Call table->free_f when
33704                 entry is not used.
33705                 (hash_string_tuple, eq_string_tuple): Move to..
33706                 * hash.c: ..here.
33707
33708 2022-07-09  Alan Modra  <amodra@gmail.com>
33709
33710         gas: rename md_end to md_finish
33711         Currently md_end is typically used for some final actions rather than
33712         freeing memory like other *_end functions.  Rename it to md_finish,
33713         and rename target implementation.  The renaming of target functions
33714         makes it possible to find them all with "grep md_finish",
33715         eg. md_mips_end is renamed to mips_md_finish, not md_mips_finish.
33716         This patch leaves a number of md_end functions unchanged, those that
33717         either do nothing or deallocate memory, and calls them late.
33718
33719         The idea here is that target maintainers implement md_end functions to
33720         tidy memory, if anyone cares.  Freeing persistent memory in gas is
33721         not at all important, except that it can hide more important memory
33722         leaks, those that happen once per some frequent gas operation, amongst
33723         these unimportant memory leaks.
33724
33725                 * as.c (main): Rename md_end to md_finish.
33726                 * config/tc-alpha.c, * config/tc-alpha.h,
33727                 * config/tc-arc.c, * config/tc-arc.h,
33728                 * config/tc-arm.c, * config/tc-arm.h,
33729                 * config/tc-csky.c, * config/tc-csky.h,
33730                 * config/tc-ia64.c, * config/tc-ia64.h,
33731                 * config/tc-mcore.c, * config/tc-mcore.h,
33732                 * config/tc-mips.c, * config/tc-mips.h,
33733                 * config/tc-mmix.c, * config/tc-mmix.h,
33734                 * config/tc-msp430.c, * config/tc-msp430.h,
33735                 * config/tc-nds32.c, * config/tc-nds32.h,
33736                 * config/tc-ppc.c, * config/tc-ppc.h,
33737                 * config/tc-pru.c, * config/tc-pru.h,
33738                 * config/tc-riscv.c, * config/tc-riscv.h,
33739                 * config/tc-s390.c, * config/tc-s390.h,
33740                 * config/tc-sparc.c, * config/tc-sparc.h,
33741                 * config/tc-tic4x.c, * config/tc-tic4x.h,
33742                 * config/tc-tic6x.c, * config/tc-tic6x.h,
33743                 * config/tc-v850.c, * config/tc-v850.h,
33744                 * config/tc-xtensa.c, * config/tc-xtensa.h,
33745                 * config/tc-z80.c, * config/tc-z80.h: Similarly.
33746                 * output-file.c (output_file_close): Call md_end.
33747
33748 2022-07-09  Alan Modra  <amodra@gmail.com>
33749
33750         gas: set up notes obstack earlier
33751         So that the notes obstack can be used for persistent storage in
33752         parse_args.
33753
33754                 * as.c (parse_args): Use notes_alloc and notes_strdup.
33755                 (free_notes): New function.
33756                 (main): Init notes obstack, and arrange to be freed on exit.
33757                 * read.c (read_begin): Don't init notes obstack.
33758                 (read_end): Free cond_obstack.
33759                 * subsegs.c (subsegs_end): Don't free cond_obstack or notes.
33760
33761 2022-07-09  Alan Modra  <amodra@gmail.com>
33762
33763         gas: itbl_files
33764         itbl_files seems to be debug code.  Get rid of it.
33765
33766                 * as.c (struct itbl_file_list): Delete.
33767                 (itbl_files): Delete.
33768                 (parse_args): Don't keep itbl_files list.
33769
33770 2022-07-09  Alan Modra  <amodra@gmail.com>
33771
33772         gas: free sy_hash, macro_hash and po_hash
33773                 * macro.c (macro_end): New function.
33774                 * macro.h (macro_end): Declare.
33775                 * read.c (read_end, poend): New functions.
33776                 * read.h (read_end): Declare.
33777                 * symbols.c (symbol_end): New function.
33778                 * symbols.h (symbol_end): Declare.
33779                 * output-file.c (output_file_close): Call new *_end functions.
33780
33781 2022-07-09  Alan Modra  <amodra@gmail.com>
33782
33783         dw2gencfi.c: use notes obstack
33784         Use notes obstack for dwcfi_hash entries, and free table.  Freeing the
33785         table makes memory checkers complain more about "definitely lost"
33786         memory as we've moved some from the "still reachable" category.
33787         That will be fixed with a later patch.
33788
33789                 * dw2gencfi.c (get_debugseg_name): Allocate on notes obstack.
33790                 (alloc_debugseg_item): Likewise.
33791                 (dwcfi_hash_find_or_make): Adjust failure path free.
33792                 (cfi_finish): Delete dwfci_hash.
33793
33794 2022-07-09  Alan Modra  <amodra@gmail.com>
33795
33796         expr.c make_expr_symbol: use notes obstack
33797                 * expr.c (make_expr_symbol): Use notes_alloc.
33798
33799         read.c assign_symbol: use notes obstack for dummy listing frag
33800                 * read.c (assign_symbol): Use notes_calloc for dummy_frag.
33801
33802         read.c s_include: use notes obstack for path
33803                 * read.c (s_include): Use notes obstack for path mem.
33804
33805 2022-07-09  Alan Modra  <amodra@gmail.com>
33806
33807         macro.c: use string hash from hash.h for macro_hash
33808         Another case of duplicated hash.h code, the only minor difference
33809         being that macro->format_hash was created with 7 entries vs. str_hash
33810         with 16 entries.
33811
33812                 * macro.c (macro_init, define_macro): Use str_htab_create.
33813                 (do_formals, define_macro, macro_expand_body): Use str_hash_insert
33814                 (macro_expand_body): Use str_hash_find and str_hash_delete.
33815                 (delete_macro): Likewise.
33816                 (sub_actual, macro_expand, check_macro): Use str_hash_find.
33817                 (expand_irp): Use str_htab_create and str_hash_insert.
33818                 * macro.h (struct macro_struct): Tidy.
33819                 (struct macro_hash_entry, macro_hash_entry_t, hash_macro_entry),
33820                 (eq_macro_entry, macro_entry_alloc, macro_entry_find),
33821                 (struct formal_hash_entry, formal_hash_entry_t),
33822                 (hash_formal_entry, eq_formal_entry, formal_entry_alloc),
33823                 (formal_entry_find): Delete.
33824                 * config/tc-iq2000.c (iq2000_add_macro): Use str_htab_create
33825                 and str_hash_insert.
33826
33827 2022-07-09  Alan Modra  <amodra@gmail.com>
33828
33829         read.c: use string hash from hash.h for po_hash
33830         po_hash code duplicates the str_hash code in hash.h for no good reason.
33831
33832                 * read.c (struct po_entry, po_entry_t): Delete.
33833                 (hash_po_entry, eq_po_entry, po_entry_alloc, po_entry_find): Delete.
33834                 (pop_insert): Use str_hash_insert.
33835                 (pobegin): Use str_htab_create.
33836                 (read_a_source_file, s_macro): Use str_hash_find.
33837
33838 2022-07-09  Alan Modra  <amodra@gmail.com>
33839
33840         free read_symbol_name string
33841         read_symbol_name mallocs the string it returns.  Free it when done.
33842
33843                 * read.c (read_symbol_name): Free name on error path.
33844                 * config/tc-ppc.c (ppc_GNU_visibility): Free name returned from
33845                 read_symbol_name.
33846                 (ppc_extern, ppc_globl, ppc_weak): Likewise.
33847
33848 2022-07-09  Alan Modra  <amodra@gmail.com>
33849
33850         gas: output_file_close
33851         This is mostly a tidy with the aim of being able to free
33852         out_file_name, but it does fix a possible attempt to unlink the output
33853         file twice (not that that matters).
33854
33855                 * as.h (keep_it): New global.
33856                 * as.c (keep_it): Delete.
33857                 (close_output_file): Delete, merged into..
33858                 * output-file.c (output_file_close): ..here.  Delete parameter.
33859                 * output-file.h (output_file_close): Update prototype.
33860
33861 2022-07-09  Alan Modra  <amodra@gmail.com>
33862
33863         gas: utility notes memory alloc functions
33864         Makes it a little easier to use the notes obstack for persistent
33865         storage.
33866
33867                 * as.h (gas_mul_overflow): Define.
33868                 * symbols.h (notes_alloc, notes_calloc, notes_memdup),
33869                 (notes_strdup, notes_concat, notes_free): Declare.
33870                 * symbols.c (notes_alloc, notes_calloc, notes_memdup),
33871                 (notes_strdup, notes_concat, notes_free): New functions.
33872                 (save_symbol_name): Use notes_strdup.
33873                 (symbol_create, local_symbol_make, local_symbol_convert),
33874                 (symbol_clone, decode_local_label_name): Use notes_alloc.
33875
33876 2022-07-09  Alan Modra  <amodra@gmail.com>
33877
33878         gas: arm -mwarn-syms duplicates
33879         arm gas is only supposed to warn once per symbol for -mwarn-syms, but
33880         doesn't because the str_hash_find added with commit 629310abec88
33881         always returns NULL.  That's so because the str_hash_insert inserts a
33882         NULL value for the key,value pair.  Let str_hash_insert do the job
33883         instead.
33884
33885                 * config/tc-arm.c (arm_tc_equal_in_insn): Correct already_warned
33886                 logic.
33887                 * testsuite/gas/arm/pr18347.s: Modify to generate duplicate
33888                 warning without this patch.
33889
33890 2022-07-09  Alan Modra  <amodra@gmail.com>
33891
33892         Regenerate with automake-1.15.1
33893         Until we update the recommended versions of autoconf/automake, files
33894         should be regenerated with automake-1.15.1 and autoconf-2.69.  That's
33895         not because we think those versions are golden, and newer versions are
33896         bad.  It's simply because maintainers want to be able to update
33897         configury files without trouble, and if someone regenerates files with
33898         automake-1.16.5 then --enable-maintainer-mode builds will hit errors:
33899
33900         checking that generated files are newer than configure... configure.ac:26: error: version mismatch.  This is Automake 1.15.1,
33901         configure.ac:26: but the definition used by this AM_INIT_AUTOMAKE
33902         configure.ac:26: comes from Automake 1.16.5.  You should recreate
33903         configure.ac:26: aclocal.m4 with aclocal and run automake again.
33904         WARNING: 'automake-1.15' is probably too old.
33905
33906         Correcting this requires regenerating the files by hand.
33907
33908 2022-07-09  GDB Administrator  <gdbadmin@sourceware.org>
33909
33910         Automatic date update in version.in
33911
33912 2022-07-08  Tom Tromey  <tom@tromey.com>
33913
33914         Accept gdb.Value in more Python APIs
33915         PR python/27000 points out that gdb.block_for_pc will accept a Python
33916         integer, but not a gdb.Value.  This patch corrects this oversight.
33917
33918         I looked at all uses of GDB_PY_LLU_ARG and fixed these up to use
33919         get_addr_from_python instead.  I also looked at uses of GDB_PY_LL_ARG,
33920         but those seemed relatively unlikely to be useful with a gdb.Value, so
33921         I didn't change them.  My thinking here is that a Value will typically
33922         come from inferior memory, and something like a line number is not too
33923         likely to be found this way.
33924
33925         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27000
33926
33927 2022-07-08  Tom Tromey  <tom@tromey.com>
33928
33929         Handle bool specially in gdb.set_parameter
33930         PR python/29217 points out that gdb.parameter will return bool values,
33931         but gdb.set_parameter will not properly accept them.  This patch fixes
33932         the problem by adding a special case to set_parameter.
33933
33934         I looked at a fix involving rewriting set_parameter in C++.  However,
33935         this one is simpler.
33936
33937         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29217
33938
33939 2022-07-08  Ludovic Courtès  <ludo@gnu.org>
33940
33941         [gdb/build] Handle deprecation of scm_install_gmp_memory_functions
33942         When building gdb with guile 3.0.8, we run into:
33943         ...
33944         gdb/guile/guile.c: In function \
33945           'void gdbscm_initialize(const extension_language_defn*)':
33946         gdb/guile/guile.c:680:5: error: 'scm_install_gmp_memory_functions' is \
33947           deprecated [-Werror=deprecated-declarations]
33948           680 |     scm_install_gmp_memory_functions = 0;
33949               |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33950         In file included from /usr/include/guile/3.0/libguile.h:128,
33951                          from gdb/guile/guile-internal.h:30,
33952                          from gdb/guile/guile.c:36:
33953         /usr/include/guile/3.0/libguile/deprecated.h:164:20: note: declared here
33954           164 | SCM_DEPRECATED int scm_install_gmp_memory_functions;
33955               |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33956         cc1plus: all warnings being treated as errors
33957         make[1]: *** [Makefile:1896: guile/guile.o] Error 1
33958         ...
33959
33960         The variable has been deprecated because it no longer has any effect.
33961
33962         Fix this by disabling the specific deprecation warning.
33963
33964         Also handle upcoming guile versions > 3.0, in which the variable will be
33965         removed, by limiting the usage of the variable to guile versions <= 3.0.
33966
33967         This does not break anything.  The variable was merely used to address a
33968         problem present in guile versions <= v3.0.5.
33969
33970         Note that we don't limit the usage of the variable to guile versions <= 3.0.5,
33971         because we want to support f.i. building against 3.0.6 and then using a shared
33972         lib with 3.0.5.
33973
33974         Tested on x86_64-linux.
33975
33976         Co-Authored-By: Tom de Vries <tdevries@suse.de>
33977
33978         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28994
33979
33980 2022-07-08  Tom de Vries  <tdevries@suse.de>
33981
33982         [gdb/symtab] Fix assert in process_imported_unit_die
33983         When running test-case gdb.dwarf2/dw2-symtab-includes.exp with target board
33984         cc-with-debug-names, I run into:
33985         ...
33986         (gdb) maint expand-symtab dw2-symtab-includes.h^M
33987         src/gdb/dwarf2/read.h:311: internal-error: unit_type: \
33988           Assertion `m_unit_type != 0' failed.^M
33989         A problem internal to GDB has been detected,^M
33990         further debugging may prove unreliable.^M
33991         ----- Backtrace -----^M
33992         FAIL: gdb.dwarf2/dw2-symtab-includes.exp: maint expand-symtab \
33993           dw2-symtab-includes.h (GDB internal error)
33994         ...
33995
33996         The assert was recently added in commit 2c474c46943 ("[gdb/symtab] Add get/set
33997         functions for per_cu->lang/unit_type").
33998
33999         The assert is triggered here:
34000         ...
34001             /* We're importing a C++ compilation unit with tag DW_TAG_compile_unit
34002                into another compilation unit, at root level.  Regard this as a hint,
34003                and ignore it.  */
34004             if (die->parent && die->parent->parent == NULL
34005                 && per_cu->unit_type () == DW_UT_compile
34006                 && per_cu->lang () == language_cplus)
34007               return;
34008         ...
34009
34010         We're trying to access unit_type / lang which hasn't been set yet.
34011
34012         Normally, these are set during cooked index creation, but that's not the case
34013         when using an index (or using -readnow).
34014
34015         In other words, this lto binary reading speed optimization only works in the
34016         normal use case.
34017
34018         IWBN to have this working in all use cases, but for now, allow lang () and
34019         unit_type () to return language_unknown and 0 here.
34020
34021         Tested on x86_64-linux.
34022
34023         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29321
34024
34025 2022-07-08  Tom de Vries  <tdevries@suse.de>
34026
34027         [gdb/symtab] Fix segfault in dwarf2_per_objfile::symtab_set_p
34028         When running test-case gdb.cp/cpexprs-debug-types.exp with target board
34029         cc-with-debug-names, I run into:
34030         ...
34031         (gdb) print base::operator new^M
34032         ^M
34033         ^M
34034         Fatal signal: Segmentation fault^M
34035         ----- Backtrace -----^M
34036         0x57ea46 gdb_internal_backtrace_1^M
34037                 /home/vries/gdb_versions/devel/src/gdb/bt-utils.c:122^M
34038         0x57eae9 _Z22gdb_internal_backtracev^M
34039                 /home/vries/gdb_versions/devel/src/gdb/bt-utils.c:168^M
34040         0x75b8ad handle_fatal_signal^M
34041                 /home/vries/gdb_versions/devel/src/gdb/event-top.c:946^M
34042         0x75ba19 handle_sigsegv^M
34043                 /home/vries/gdb_versions/devel/src/gdb/event-top.c:1019^M
34044         0x7f795f46a8bf ???^M
34045         0x6d3cb1 _ZNK18dwarf2_per_objfile12symtab_set_pEPK18dwarf2_per_cu_data^M
34046                 /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:1515^M
34047         ...
34048
34049         The problem is in this piece of code in dw2_debug_names_iterator::next:
34050         ...
34051                 case DW_IDX_type_unit:
34052                   /* Don't crash on bad data.  */
34053                   if (ull >= per_bfd->tu_stats.nr_tus)
34054                     {
34055                       complaint (_(".debug_names entry has bad TU index %s"
34056                                    " [in module %s]"),
34057                                  pulongest (ull),
34058                                  objfile_name (objfile));
34059                       continue;
34060                     }
34061                   per_cu = per_bfd->get_cu (ull + per_bfd->tu_stats.nr_tus);
34062                   break;
34063         ...
34064
34065         The all_comp_units vector (which get_cu accesses) contains both CUs and TUs,
34066         with CUs first.
34067
34068         So to get the nth TU we need the element at "nr_cus + n", but
34069         the code uses "nr_tus + n" instead.
34070
34071         Fix this by using "nr_cus + n".
34072
34073         Tested on x86_64-linux.
34074
34075         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29334
34076
34077 2022-07-08  Enze Li  <enze.li@hotmail.com>
34078
34079         gdb: initialize the data_head variable to eliminate compilation warnings
34080         On a machine with gcc 12, I get this warning:
34081
34082           CXX    nat/linux-btrace.o
34083         In function ‘btrace_error linux_read_bts(btrace_data_bts*, btrace_target_info*, btrace_read_type)’,
34084             inlined from ‘btrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)’ at ../gdb/nat/linux-btrace.c:935:29:
34085         ../gdb/nat/linux-btrace.c:865:21: warning: ‘data_head’ may be used uninitialized [-Wmaybe-uninitialized]
34086           865 |   pevent->last_head = data_head;
34087               |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
34088         ../gdb/nat/linux-btrace.c: In function ‘btrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)’:
34089         ../gdb/nat/linux-btrace.c:792:9: note: ‘data_head’ was declared here
34090           792 |   __u64 data_head, data_tail;
34091               |         ^~~~~~~~~
34092
34093         Fix this by initializing the 'data_head' variable.
34094
34095         Tested by rebuilding on x86_64 openSUSE Tumbleweed with gcc 12.
34096
34097 2022-07-08  Andrew Burgess  <aburgess@redhat.com>
34098
34099         libopcodes/s390: add support for disassembler styling
34100         This commit adds disassembler style to the libopcodes s390
34101         disassembler.  This conversion was pretty straight forward, I just
34102         converted the fprintf_func calls to fprintf_styled_func calls and
34103         added an appropriate style.
34104
34105         For testing the new styling I just assembled then disassembled the
34106         source files in gas/testsuite/gas/s390 and manually checked that the
34107         styling looked reasonable.
34108
34109         If the user does not request styled output from objdump, then there
34110         should be no change in the disassembler output after this commit.
34111
34112 2022-07-08  Nick Clifton  <nickc@redhat.com>
34113
34114         Fix regeneration of ld configure and makefiles
34115
34116         Update release README with new version numbers
34117
34118         Update version to 2.39.50 and regenerate files
34119
34120         Add markers for 2.39 branch
34121
34122 2022-07-08  GDB Administrator  <gdbadmin@sourceware.org>
34123
34124         Automatic date update in version.in
34125
34126 2022-07-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
34127
34128         gprofng: fix regression in testing for not yet installed version
34129         gprofng/ChangeLog
34130         2022-07-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
34131
34132                 * src/Settings.cc (Settings::read_rc): Read environment variable
34133                 GPROFNG_SYSCONFDIR.
34134                 * testsuite/lib/Makefile.skel: Export GPROFNG_SYSCONFDIR.
34135                 * testsuite/gprofng.display/display.exp: Shorten the list of tests.
34136
34137 2022-07-07  Simon Marchi  <simon.marchi@efficios.com>
34138
34139         gdb: fix {rs6000_nat_target,aix_thread_target}::wait to not use inferior_ptid
34140         Trying to run a simple program (empty main) on AIX, I get:
34141
34142             (gdb) run
34143             Starting program: /scratch/simark/build/gdb/a.out
34144             Child process unexpectedly missing: There are no child processes..
34145             ../../src/binutils-gdb/gdb/inferior.c:304: internal-error: find_inferior_pid: Assertion `pid != 0' failed.
34146             A problem internal to GDB has been detected,
34147             further debugging may prove unreliable.
34148             ----- Backtrace -----
34149             0x10ef12a8 gdb_internal_backtrace_1()
34150                     ../../src/binutils-gdb/gdb/bt-utils.c:122
34151             0x10ef1470 gdb_internal_backtrace()
34152                     ../../src/binutils-gdb/gdb/bt-utils.c:168
34153             0x1004d368 internal_vproblem(internal_problem*, char const*, int, char const*, char*)
34154                     ../../src/binutils-gdb/gdb/utils.c:396
34155             0x1004d8a8 internal_verror(char const*, int, char const*, char*)
34156                     ../../src/binutils-gdb/gdb/utils.c:476
34157             0x1004c424 internal_error(char const*, int, char const*, ...)
34158                     ../../src/binutils-gdb/gdbsupport/errors.cc:55
34159             0x102ab344 find_inferior_pid(process_stratum_target*, int)
34160                     ../../src/binutils-gdb/gdb/inferior.c:304
34161             0x102ab4a4 find_inferior_ptid(process_stratum_target*, ptid_t)
34162                     ../../src/binutils-gdb/gdb/inferior.c:318
34163             0x1061bae8 find_thread_ptid(process_stratum_target*, ptid_t)
34164                     ../../src/binutils-gdb/gdb/thread.c:519
34165             0x10319e98 handle_inferior_event(execution_control_state*)
34166                     ../../src/binutils-gdb/gdb/infrun.c:5532
34167             0x10315544 fetch_inferior_event()
34168                     ../../src/binutils-gdb/gdb/infrun.c:4221
34169             0x10952e34 inferior_event_handler(inferior_event_type)
34170                     ../../src/binutils-gdb/gdb/inf-loop.c:41
34171             0x1032640c infrun_async_inferior_event_handler(void*)
34172                     ../../src/binutils-gdb/gdb/infrun.c:9548
34173             0x10673188 check_async_event_handlers()
34174                     ../../src/binutils-gdb/gdb/async-event.c:335
34175             0x1066fce4 gdb_do_one_event()
34176                     ../../src/binutils-gdb/gdbsupport/event-loop.cc:214
34177             0x10001a94 start_event_loop()
34178                     ../../src/binutils-gdb/gdb/main.c:411
34179             0x10001ca0 captured_command_loop()
34180                     ../../src/binutils-gdb/gdb/main.c:471
34181             0x10003d74 captured_main(void*)
34182                     ../../src/binutils-gdb/gdb/main.c:1329
34183             0x10003e48 gdb_main(captured_main_args*)
34184                     ../../src/binutils-gdb/gdb/main.c:1344
34185             0x10000744 main
34186                     ../../src/binutils-gdb/gdb/gdb.c:32
34187             ---------------------
34188             ../../src/binutils-gdb/gdb/inferior.c:304: internal-error: find_inferior_pid: Assertion `pid != 0' failed.
34189             A problem internal to GDB has been detected,
34190             further debugging may prove unreliable.
34191             Quit this debugging session? (y or n)
34192
34193         This is due to some bit-rot in the AIX port, still relying on the entry
34194         value of inferior_ptid in the wait methods.
34195
34196         Problem #1 is in rs6000_nat_target::wait, here:
34197
34198               /* Ignore terminated detached child processes.  */
34199               if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
34200                 pid = -1;
34201
34202         At this point, waitpid has returned an "exited" status for some pid, so
34203         pid is non-zero.  Since inferior_ptid is set to null_ptid on entry, the
34204         pid returned by wait is not equal to `inferior_ptid.pid ()`, so we reset
34205         pid to -1 and go to waiting again.  Since there are not more children to
34206         wait for, waitpid then returns -1 so we get here:
34207
34208               if (pid == -1)
34209                 {
34210                   gdb_printf (gdb_stderr,
34211                               _("Child process unexpectedly missing: %s.\n"),
34212                               safe_strerror (save_errno));
34213
34214                   /* Claim it exited with unknown signal.  */
34215                   ourstatus->set_signalled (GDB_SIGNAL_UNKNOWN);
34216                   return inferior_ptid;
34217                 }
34218
34219         We therefore return a "signalled" status with a null_ptid (again,
34220         inferior_ptid is null_ptid).  This confuses infrun, because if the
34221         target returns a "signalled" status, it should be coupled with a ptid
34222         for an inferior that exists.
34223
34224         So, the first step is to fix the snippets above to not use
34225         inferior_ptid.  In the first snippet, use find_inferior_pid to see if
34226         we know the event process.  If there is no inferior with that pid, we
34227         assume it's a detached child process to we ignore the event.  That
34228         should be enough to fix the problem, because it should make it so we
34229         won't go into the second snippet.  But still, fix the second snippet to
34230         return an "ignore" status.  This is copied from inf_ptrace_target::wait,
34231         which is where rs6000_nat_target::wait appears to be copied from in the
34232         first place.
34233
34234         These changes, are not sufficient, as the aix_thread_target, which sits
34235         on top of rs6000_nat_target, also relies on inferior_ptid.
34236         aix_thread_target::wait, by calling pd_update, assumes that
34237         rs6000_nat_target has set inferior_ptid to the appropriate value (the
34238         ptid of the event thread), but that's not the case.  pd_update
34239         returns inferior_ptid - null_ptid - and therefore
34240         aix_thread_target::wait returns null_ptid too, and we still hit the
34241         assert shown above.
34242
34243         Fix this by changing pd_activate, pd_update, sync_threadlists and
34244         get_signaled_thread to all avoid using inferior_ptid.  Instead, they
34245         accept as a parameter the pid of the process we are working on.
34246
34247         With this patch, I am able to run the program to completion:
34248
34249             (gdb) r
34250             Starting program: /scratch/simark/build/gdb/a.out
34251             [Inferior 1 (process 11010794) exited normally]
34252
34253         As well as break on main:
34254
34255             (gdb) b main
34256             Breakpoint 1 at 0x1000036c
34257             (gdb) r
34258             Starting program: /scratch/simark/build/gdb/a.out
34259
34260             Breakpoint 1, 0x1000036c in main ()
34261             (gdb) c
34262             Continuing.
34263             [Inferior 1 (process 26083688) exited normally]
34264
34265         Change-Id: I7c2613bbefe487d75fa1a0c0994423471d961ee9
34266
34267 2022-07-07  Pedro Alves  <pedro@palves.net>
34268
34269         Fix pedantically invalid DWARF in gdb.trace/unavailable-dwarf-piece.exp
34270         The DWARF spec says:
34271
34272           Any debugging information entry representing the declaration of an object,
34273           module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and
34274           DW_AT_decl_column attributes, each of whose value is an unsigned integer
34275                                                                   ^^^^^^^^
34276           constant.
34277
34278         Grepping around the DWARF-assembler-based testcases, I noticed that
34279         gdb.trace/unavailable-dwarf-piece.exp emits decl_line with
34280         DW_FORM_sdata, a signed integer form.  This commit tweaks it to use
34281         DW_FORM_udata instead.
34282
34283         Unsurprisingly, this:
34284
34285           $ make check \
34286               TESTS="gdb.trace/unavailable-dwarf-piece.exp" \
34287               RUNTESTFLAGS="--target_board=native-gdbserver"
34288
34289         ... still passes cleanly for me after this change.
34290
34291         I've noticed this because current llvm-dwarfdump crashed on an
34292         ROCm-internal DWARF-assembler-based testcase that incorrectly used
34293         signed forms for DW_AT_decl_file/DW_AT_decl_line.
34294
34295         The older llvm-dwarfdump found on Ubuntu 20.04 (LLVM 10) reads the
34296         line numbers with signed forms as "0" instead of crashing.  Here's the
34297         before/after fix for gdb.trace/unavailable-dwarf-piece.exp with that
34298         llvm-dwarfdump version:
34299
34300           $ diff -up before.txt after.txt
34301           --- before.txt    2022-07-07 13:21:28.387690334 +0100
34302           +++ after.txt     2022-07-07 13:21:39.379801092 +0100
34303           @@ -18,7 +18,7 @@
34304                            DW_AT_name     ("s")
34305                            DW_AT_byte_size        (3)
34306                            DW_AT_decl_file        (0)
34307           -                DW_AT_decl_line        (0)
34308           +                DW_AT_decl_line        (1)
34309
34310            0x0000002f:     DW_TAG_member
34311                              DW_AT_name   ("a")
34312           @@ -41,7 +41,7 @@
34313                            DW_AT_name     ("t")
34314                            DW_AT_byte_size        (3)
34315                            DW_AT_decl_file        (0)
34316           -                DW_AT_decl_line        (0)
34317           +                DW_AT_decl_line        (1)
34318
34319            0x00000054:     DW_TAG_member
34320                              DW_AT_name   ("a")
34321
34322         Change-Id: I5c866946356da421ff944019d0eca2607b2b738f
34323
34324 2022-07-07  Tiezhu Yang  <yangtiezhu@loongson.cn>
34325
34326         gdb: LoongArch: Fix typos in code comments
34327         "it’s" should be "it's".
34328
34329 2022-07-07  Maciej W. Rozycki  <macro@embecosm.com>
34330
34331         GDB/testsuite: Add coverage for `print -elements' command
34332         We currently have no coverage for the `print -elements ...' command (or
34333         `p -elements ...' in the shortened form), so add a couple of test cases
34334         mimicking ones using corresponding `set print elements ...' values.
34335
34336 2022-07-07  Tiezhu Yang  <yangtiezhu@loongson.cn>
34337
34338         gdb: LoongArch: Implement the push_dummy_call gdbarch method
34339         According to "Procedure Calling Convention" in "LoongArch ELF ABI
34340         specification" [1], implement the push_dummy_call gdbarch method
34341         as clear as possible.
34342
34343         [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_procedure_calling_convention
34344
34345 2022-07-07  Tsukasa OI  <research_trasio@irq.a4lg.com>
34346
34347         RISC-V: Added Zfhmin and Zhinxmin.
34348         This commit adds Zfhmin and Zhinxmin extensions (subsets of Zfh and
34349         Zhinx extensions, respectively).  In the process supporting Zfhmin and
34350         Zhinxmin extension, this commit also changes how instructions are
34351         categorized considering Zfhmin, Zhinx and Zhinxmin extensions.
34352
34353         Detailed changes,
34354
34355         * From INSN_CLASS_ZFH to INSN_CLASS_ZFHMIN:
34356
34357         flh, fsh, fmv.x.h and fmv.h.x.
34358
34359         * From INSN_CLASS_ZFH to INSN_CLASS_ZFH_OR_ZHINX:
34360
34361         fmv.h.
34362
34363         * From INSN_CLASS_ZFH_OR_ZHINX to INSN_CLASS_ZFH_OR_ZHINX:
34364
34365         fneg.h, fabs.h, fsgnj.h, fsgnjn.h, fsgnjx.h,
34366         fadd.h, fsub.h, fmul.h, fdiv.h, fsqrt.h, fmin.h, fmax.h,
34367         fmadd.h, fnmadd.h, fmsub.h, fnmsub.h,
34368         fcvt.w.h, fcvt.wu.h, fcvt.h.w, fcvt.h.wu,
34369         fcvt.l.h, fcvt.lu.h, fcvt.h.l, fcvt.h.lu,
34370         feq.h, flt.h, fle.h, fgt.h, fge.h,
34371         fclass.h.
34372
34373         * From INSN_CLASS_ZFH_OR_ZHINX to INSN_CLASS_ZFHMIN_OR_ZHINXMIN:
34374
34375         fcvt.s.h and fcvt.h.s.
34376
34377         * From INSN_CLASS_D_AND_ZFH_INX to INSN_CLASS_ZFHMIN_AND_D:
34378
34379         fcvt.d.h and fcvt.h.d.
34380
34381         * From INSN_CLASS_Q_AND_ZFH_INX to INSN_CLASS_ZFHMIN_AND_Q:
34382
34383         fcvt.q.h and fcvt.h.q.
34384
34385         bfd/ChangeLog:
34386
34387                 * elfxx-riscv.c (riscv_implicit_subsets): Change implicit
34388                 subsets.  Zfh->Zicsr is not needed and Zfh->F is replaced with
34389                 Zfh->Zfhmin and Zfhmin->F.  Zhinx->Zicsr is not needed and
34390                 Zhinx->Zfinx is replaced with Zhinx->Zhinxmin and
34391                 Zhinxmin->Zfinx.
34392                 (riscv_supported_std_z_ext): Added zfhmin and zhinxmin.
34393                 (riscv_multi_subset_supports):  Rewrite handling for new
34394                 instruction classes.
34395                 (riscv_multi_subset_supports_ext): Updated.
34396                 (riscv_parse_check_conflicts): Change error message to include
34397                 zfh and zfhmin extensions.
34398
34399         gas/ChangeLog:
34400
34401                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail.s: New complex
34402                 error handling test.
34403                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-1.d: Likewise.
34404                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-1.l: Likewise.
34405                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-2.d: Likewise.
34406                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-2.l: Likewise.
34407                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-3.d: Likewise.
34408                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-3.l: Likewise.
34409                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-4.d: Likewise.
34410                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-4.l: Likewise.
34411                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-5.d: Likewise.
34412                 * testsuite/gas/riscv/zfhmin-d-insn-class-fail-5.l: Likewise.
34413                 * testsuite/gas/riscv/zhinx.d: Renamed from fp-zhinx-insns.d
34414                 and refactored.
34415                 * testsuite/gas/riscv/zhinx.s: Likewise.
34416
34417         include/ChangeLog:
34418
34419                 * opcode/riscv.h (enum riscv_insn_class): Removed INSN_CLASS_ZFH,
34420                 INSN_CLASS_D_AND_ZFH_INX and INSN_CLASS_Q_AND_ZFH_INX.  Added
34421                 INSN_CLASS_ZFHMIN, INSN_CLASS_ZFHMIN_OR_ZHINXMIN,
34422                 INSN_CLASS_ZFHMIN_AND_D and INSN_CLASS_ZFHMIN_AND_Q.
34423
34424         opcodes/ChangeLog:
34425
34426                 * riscv-opc.c (riscv_opcodes): Change instruction classes for
34427                 Zfh and Zfhmin instructions.  Fix `fcvt.h.lu' instruction
34428                 (two operand variant) mask.
34429
34430 2022-07-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
34431
34432         gprofng: adjust GPROFNG_VARIANT
34433         GPROFNG_VARIANT depends on compiler options, not on $(host).
34434
34435         gprofng/ChangeLog
34436         2022-07-06  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
34437
34438                 PR gprofng/29116
34439                 * libcollector/configure.ac: Adjust GPROFNG_VARIANT.
34440                 * libcollector/configure: Rebuild.
34441
34442 2022-07-07  Tsukasa OI  <research_trasio@irq.a4lg.com>
34443
34444         RISC-V: Fix disassembling Zfinx with -M numeric
34445         This commit fixes floating point operand register names from ABI ones
34446         to dynamically set ones.
34447
34448         gas/ChangeLog:
34449
34450                 * testsuite/gas/riscv/zfinx-dis-numeric.s: Test new behavior of
34451                 Zfinx extension and -M numeric disassembler option.
34452                 * testsuite/gas/riscv/zfinx-dis-numeric.d: Likewise.
34453
34454         opcodes/ChangeLog:
34455
34456                 * riscv-dis.c (riscv_disassemble_insn): Use dynamically set GPR
34457                 names to disassemble Zfinx instructions.
34458
34459 2022-07-07  Tsukasa OI  <research_trasio@irq.a4lg.com>
34460
34461         RISC-V: Fix requirement handling on Zhinx+{D,Q}
34462         This commit fixes how instructions are masked on Zhinx+Z{d,q}inx.
34463         fcvt.h.d and fcvt.d.h require ((D&&Zfh)||(Zdinx&&Zhinx)) and
34464         fcvt.h.q and fcvt.q.h require ((Q&&Zfh)||(Zqinx&&Zhinx)).
34465
34466         bfd/ChangeLog:
34467
34468                 * elfxx-riscv.c (riscv_multi_subset_supports): Fix feature gate
34469                 on INSN_CLASS_{D,Q}_AND_ZFH_INX.
34470                 (riscv_multi_subset_supports_ext): Fix feature gate diagnostics
34471                 on INSN_CLASS_{D,Q}_AND_ZFH_INX.
34472
34473         gas/ChangeLog:
34474
34475                 * testsuite/gas/riscv/fp-zhinx-insns.d: Add Zqinx to -march
34476                 for proper testing.
34477
34478 2022-07-07  Alan Modra  <amodra@gmail.com>
34479
34480         PR29320, 'struct obstack' declared inside parameter list
34481                 PR 29320
34482                 * frags.h: Move declaration of struct obstack..
34483                 * as.h: ..to here.
34484
34485 2022-07-07  GDB Administrator  <gdbadmin@sourceware.org>
34486
34487         Automatic date update in version.in
34488
34489 2022-07-06  Ruud van der Pas  <ruud.vanderpas@oracle.com>
34490
34491         gprofng: implement a functional gp-display-html
34492         This patch enables the first support for the "gprofng display html" command.
34493         This command works for C/C++ applications on x86_64. Using one or more gprofng
34494         experiment directories as input, a new directory with html files is created.
34495         Through the index.html file in this directory, the performance results may be
34496         viewed in a browser.
34497
34498         gprofng/Changelog:
34499         2022-06-28  Ruud van der Pas  <ruud.vanderpas@oracle.com>
34500
34501                 * gp-display-html/gp-display-html.in: implement first support for x86_64 and C/C++
34502
34503 2022-07-06  H.J. Lu  <hjl.tools@gmail.com>
34504
34505         elf: Copy p_align of PT_GNU_STACK for stack alignment
34506         commit 74e315dbfe5200c473b226e937935fb8ce391489
34507         Author: H.J. Lu <hjl.tools@gmail.com>
34508         Date:   Mon Dec 13 19:46:04 2021 -0800
34509
34510             elf: Set p_align to the minimum page size if possible
34511
34512         may ignore p_align of PT_GNU_STACK when copying ELF program header if
34513         the maximum page size is larger than p_align of PT_LOAD segments.  Copy
34514         p_align of PT_GNU_STACK since p_align of PT_GNU_STACK describes stack
34515         alignment, not page size,
34516
34517                 PR binutils/29319
34518                 * elf.c (copy_elf_program_header): Copy p_align of PT_GNU_STACK
34519                 for stack alignment.
34520
34521 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34522
34523         x86: make D attribute usable for XOP and FMA4 insns
34524         This once again allows to reduce redundancy in (and size of) the opcode
34525         table.
34526
34527         Don't go as far as also making D work on the two 5-operand XOP insns:
34528         This would significantly complicate the code, as there the first
34529         (immediate) operand would need special treatment in several places.
34530
34531         Note that the .s suffix isn't being enabled to have any effect, for
34532         being deprecated. Whereas neither {load} nor {store} pseudo prefixes
34533         make sense here, as the respective operands are inputs (loads) only
34534         anyway, regardless of order. Hence there is (as before) no way for the
34535         programmer to request the alternative encoding to be used for register-
34536         only insns.
34537
34538         Note further that it is always the first original template which is
34539         retained (and altered), to make sure the same encoding as before is
34540         used for register-only insns. This has the slightly odd (but pre-
34541         existing) effect of XOP register-only insns having XOP.W clear, but FMA4
34542         ones having VEX.W set.
34543
34544 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34545
34546         x86: fold two switch() statements in match_template()
34547         I don't see why two of them were introduced (very long ago) using
34548         similar fall-through logic.
34549
34550 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34551
34552         x86: fix 3-operand insn reverse-matching
34553         The middle operand would have gone entirely unchecked, allowing e.g.
34554
34555                 vmovss          %xmm0, %esp, %xmm2
34556
34557         to assemble successfully, or e.g.
34558
34559                 vmovss          %xmm0, $4, %xmm2
34560
34561         causing an internal error. Alongside dealing with this also drop a
34562         related comment, which hasn't been applicable anymore since the
34563         introduction of 3-operand patterns with D set (and which perhaps never
34564         had been logical to be there, as reverse-matched insns don't make it
34565         there in the first place).
34566
34567 2022-07-06  Bhuvanendra Kumar N  <Bhuvanendra.KumarN@amd.com>
34568
34569         Descriptive DWARF operations dump support for DW_AT_rank
34570         DW_AT_rank is a dwarf-5 feature.
34571
34572 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34573
34574         x86: introduce a state stack for .arch
34575         When using just slightly non-trivial combinations of .arch, it can be
34576         quite useful to be able to go back to prior state without needing to
34577         re-invoke perhaps many earlier directives and without needing to invoke
34578         perhaps many "negative" ones. Like some other architectures allow
34579         saving (pushing) and restoring (popping) present/prior state.
34580
34581         For now require the same .code<N> to be in effect for ".arch pop" that
34582         was in effect for the corresponding ".arch push".
34583
34584         Also change the global "no_cond_jump_promotion" to be bool, to match the
34585         new struct field.
34586
34587 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34588
34589         x86: generalize disabling of sub-architectures
34590         I never really understood upon what basis ".arch .no*" options were made
34591         available. Let's not have any "criteria" at all, and simply allow
34592         disabling of all of them. Then we also have all data for a sub-arch in
34593         a single place, as we now only need a single table.
34594
34595 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34596
34597         x86: permit "default" with .arch
34598         So far there was no way to reset the architecture to that assembly would
34599         start with in the absence of any overrides (command line or directives).
34600         Note that for Intel MCU "default" is merely an alias of "iamcu".
34601
34602         While there also zap a stray @item from the doc section, as noticed
34603         when inspecting the generated output (which still has some quirks, but
34604         those aren't easy to address without re-flowing almost the entire
34605         section).
34606
34607 2022-07-06  Jan Beulich  <jbeulich@suse.com>
34608
34609         x86: don't leak sub-architecture accumulated strings
34610         While it may not be necessary in i386_target_format() (but then setting
34611         the variable to NULL also wouldn't be necessary), at least in the other
34612         cases strings may already have accumulated.
34613
34614 2022-07-06  GDB Administrator  <gdbadmin@sourceware.org>
34615
34616         Automatic date update in version.in
34617
34618 2022-07-05  Tom de Vries  <tdevries@suse.de>
34619
34620         [gdb/exp] Fix internal error when printing C++ pointer-to-member
34621         When running the test-case included with this patch, we run into:
34622         ...
34623         (gdb) print ptm^M
34624         $1 = gdb/gdbtypes.h:695: internal-error: loc_bitpos: \
34625           Assertion `m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.^M
34626         ...
34627         while printing a c++ pointer-to-member.
34628
34629         Fix this by skipping static fields in cp_find_class_member, such that we have:
34630         ...
34631         (gdb) print ptm^M
34632         $1 = &A::i^M
34633         ...
34634
34635         Tested on x86_64-linux.
34636
34637         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29294
34638
34639 2022-07-05  Tom Tromey  <tromey@adacore.com>
34640
34641         Add gdb.Objfile.is_file attribute
34642         Sometimes an objfile comes from memory and not from a file.  It can be
34643         useful to be able to check this from Python, so this patch adds a new
34644         "is_file" attribute.
34645
34646 2022-07-05  Tom Tromey  <tromey@adacore.com>
34647
34648         Make 'import gdb.events' work
34649         Pierre-Marie noticed that, while gdb.events is a Python module, it
34650         can't be imported.  This patch changes how this module is created, so
34651         that it can be imported, while also ensuring that the module is always
34652         visible, just as it was in the past.
34653
34654         This new approach required one non-obvious change -- when running
34655         gdb.base/warning.exp, where --data-directory is intentionally not
34656         found, the event registries can now be nullptr.  Consequently, this
34657         patch probably also requires
34658
34659             https://sourceware.org/pipermail/gdb-patches/2022-June/189796.html
34660
34661         Note that this patch obsoletes
34662
34663             https://sourceware.org/pipermail/gdb-patches/2022-June/189797.html
34664
34665 2022-07-05  Xi Ruoyao  <xry111@xry111.site>
34666
34667         gdb: LoongArch: add orig_a0 into register set
34668         The basic support for LoongArch has been merged into the upstream Linux
34669         kernel since 5.19-rc1 on June 5, 2022.  This commit adds orig_a0 which
34670         is added into struct user_pt_regs [1] to match the upstream kernel, and
34671         then the upstream GDB will work with the upstream kernel.
34672
34673         Note that orig_a0 was added into struct user_pt_regs in the development
34674         cycle for merging LoongArch port into the upstream Linux kernel, so
34675         earlier kernels (notably, the product kernel with version 4.19 used in
34676         distros like UOS and Loongnix) don't have it.  Inspect
34677         arch/loongarch/include/uapi/asm/ptrace.h in the kernel tree to make sure.
34678         To build upstream GDB for a kernel lacking orig_a0, it's necessary to
34679         revert this commit locally.
34680
34681         [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/uapi/asm/ptrace.h#n24
34682
34683 2022-07-05  Bhuvanendra Kumar N  <Bhuvanendra.KumarN@amd.com>
34684
34685         Support for location and range lists for split-dwarf and dwarf-5.
34686         Adding support for location and range lists for split-dwarf and dwarf-5.
34687         Following issues are taken care.
34688         1. Display of the index values for DW_FORM_loclistx and DW_FORM_rnglistx.
34689         2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections.
34690
34691                 * dwarf.c(read_and_display_attr_value): Handle DW_FORM_loclistx
34692                 and DW_FORM_rnglistx for .dwo files.
34693                 (process_debug_info): Load .debug_loclists.dwo and
34694                 .debug_rnglists.dwo if exists.
34695                 (load_separate_debug_files): Load .debug_loclists and
34696                 .debug_rnglists if exists.
34697                 Include 2 entries in debug_displays table.
34698                 * dwarf.h (enum dwarf_section_display_enum): Include 2 entries.
34699
34700 2022-07-05  Jan Beulich  <jbeulich@suse.com>
34701
34702         x86: introduce fake processor type to mark sub-arch entries in cpu_arch[]
34703         This is in preparation of dropping the leading . from the strings.
34704
34705         While there also move PROCESSOR_GENERIC{32,64} from the middle of AMD
34706         entries to near the top.
34707
34708 2022-07-05  Jan Beulich  <jbeulich@suse.com>
34709
34710         x86: macro-ize cpu_arch[] entries
34711         Putting individual elements behind macros, besides (imo) improving
34712         readability, will make subsequent (and likely also future) changes less
34713         intrusive.
34714
34715         Utilize this right away to pack the table a little more tightly, by
34716         converting "skip" to bool and putting it earlier in a group of bitfields
34717         together with "len".
34718
34719 2022-07-05  Jan Beulich  <jbeulich@suse.com>
34720
34721         x86: de-duplicate sub-architecture strings accumulation
34722         Introduce a helper function to replace 4 instances of similar code. Use
34723         reconcat() to cover the previously explicit free().
34724
34725 2022-07-05  GDB Administrator  <gdbadmin@sourceware.org>
34726
34727         Automatic date update in version.in
34728
34729 2022-07-04  Nick Clifton  <nickc@redhat.com>
34730
34731         Fix snafu in rust demangler recursion limit code
34732
34733 2022-07-04  Alan Modra  <amodra@gmail.com>
34734
34735         alloc gas seginfo on notes obstack
34736         Lots of memory used in gas should go on this obstack.  The patch also
34737         frees all the gas obstacks on exit, which isn't a completely trivial
34738         task.
34739
34740                 * subsegs.c (alloc_seginfo): New function.
34741                 (subseg_change, subseg_get): Use it.
34742                 (subsegs_end): New function.
34743                 * as.h (subsegs_end): Declare.
34744                 * output-file.c: Include subsegs.h
34745                 (stash_frchain_obs): New function.
34746                 (output_file_close): Save obstacks attached to output bfd before
34747                 closing.  Call subsegs_end with the array of obstacks.
34748
34749 2022-07-04  Alan Modra  <amodra@gmail.com>
34750
34751         objcopy: bfd_alloc orelocation
34752         This fixes an inconsequential objcopy memory leak.  I'd normally
34753         ignore reports of leaks like this one, that are merely one block or
34754         fewer per section processed, since objcopy soon exits and frees all
34755         memory.  However I thought it worth providing support for allocating
34756         memory on a bfd objalloc in objcopy and other utils.
34757
34758                 PR 29233
34759                 * bucomm.c (bfd_xalloc): New function.
34760                 * bucomm.h (bfd_xalloc): Declare.
34761                 * objcopy.c (copy_relocations_in_section): Use it to allocate
34762                 array of reloc pointers.  Rewrite code stripping relocs to do
34763                 without extra memory allocation.
34764
34765 2022-07-04  Nick Clifton  <nickc@redhat.com>
34766
34767         Synchronize libbierty sources with gcc.
34768
34769 2022-07-04  Bhuvanendra Kumar N  <Bhuvanendra.KumarN@amd.com>
34770
34771         Modified changes for split-dwarf and dwarf-5.
34772                 * dwarf.c(process_debug_info): Include DW_TAG_skeleton_unit.
34773                 (display_debug_str_offsets): While dumping .debug_str_offsets.dwo,
34774                 pass proper str_offsets_base to fetch_indexed_string().
34775                 (load_separate_debug_files): Skip DWO ID dump for dwarf-5.
34776
34777 2022-07-04  Marcus Nilsson  <brainbomb@gmail.com>
34778
34779         opcodes/avr: Implement style support in the disassembler
34780                 * disassemble.c: (disassemble_init_for_target): Set
34781                 created_styled_output for AVR based targets.
34782                 * avr-dis.c: (print_insn_avr): Use fprintf_styled_ftype
34783                 instead of fprintf_ftype throughout.
34784                 (avr_operand): Pass in and fill disassembler_style when
34785                 parsing operands.
34786
34787 2022-07-04  Tom de Vries  <tdevries@suse.de>
34788
34789         [gdb/symtab] Add get/set functions for per_cu->lang/unit_type
34790         The dwarf2_per_cu_data fields lang and unit_type both have a dont-know
34791         initial value (respectively language_unknown and (dwarf_unit_type)0), which
34792         allows us to add certain checks, f.i. checking that that a field is not read
34793         before written.
34794
34795         Add get/set member functions for the two fields as a convenient location to
34796         add such checks, make the fields private to enforce using the member
34797         functions, and add the m_ prefix.
34798
34799         Tested on x86_64-linux.
34800
34801 2022-07-04  Jan Beulich  <jbeulich@suse.com>
34802
34803         gas/testsuite: properly exclude aout in all/weakref1u
34804         Use the (wider) predicate rather than a triplet. This eliminates the sole
34805         i386-msdos failure in the testsuite.
34806
34807 2022-07-04  Jan Beulich  <jbeulich@suse.com>
34808
34809         x86: fold Disp32S and Disp32
34810         The only case where 64-bit code uses non-sign-extended (can also be
34811         considered zero-extended) displacements is when an address size override
34812         is in place for a memory operand (i.e. particularly excluding
34813         displacements of direct branches, which - if at all - are controlled by
34814         operand size, and then are still sign-extended, just from 16 bits).
34815         Hence the distinction in templates is unnecessary, allowing code to be
34816         simplified in a number of places. The only place where logic becomes
34817         more complicated is when signed-ness of relocations is determined in
34818         output_disp().
34819
34820         The other caveat is that Disp64 cannot be specified anymore in an insn
34821         template at the same time as Disp32. Unlike for non-64-bit mode,
34822         templates don't specify displacements for both possible addressing
34823         modes; the necessary adjustment to the expected ones has already been
34824         done in match_template() anyway (but of course the logic there needs
34825         tweaking now). Hence the single template so far doing so is split.
34826
34827 2022-07-04  Jan Beulich  <jbeulich@suse.com>
34828
34829         x86: restore masking of displacement kinds
34830         Commit 7d5e4556a375 rendered the check near the end of what is now
34831         i386_finalize_displacement() entirely dead for AT&T mode, since for
34832         operands involving a displacement .unspecified will always be set. But
34833         the logic there is bogus anyway - Intel syntax operand size specifiers
34834         are of no interest there either. The only thing which matters in the
34835         "displacement only" determination is .baseindex.
34836
34837         Of course when masking displacement kinds we should not at the same time
34838         also mask off other attributes.
34839
34840         Furthermore the type mask returned by lex_got() also needs to be
34841         adjusted: The only case where we want Disp32 (rather than Disp32S) is
34842         when dealing with 32-bit addressing mode in 64-bit code.
34843
34844 2022-07-04  Jan Beulich  <jbeulich@suse.com>
34845
34846         x86-64: improve handling of branches to absolute addresses
34847         There are two related problems here: The use of "addr32" on a direct
34848         branch would, besides causing a warning, result in operands to be
34849         permitted which mistakenly are refused without "addr32". Plus at some
34850         point not too long ago I'm afraid it may have been me who regressed the
34851         relocation addends emitted for such branches. Correct both problems,
34852         adding a testcase to guard against regressing this again.
34853
34854 2022-07-04  Tsukasa OI  <research_trasio@irq.a4lg.com>
34855
34856         RISC-V: Update Zihintpause extension version
34857         Because ratified Zihintpause extension has a version number of 2.0
34858         (not 1.0), we should update the number.
34859
34860         bfd/ChangeLog:
34861
34862                 * elfxx-riscv.c (riscv_supported_std_z_ext): Update version
34863                 number of Zihintpause extension.
34864
34865 2022-07-04  GDB Administrator  <gdbadmin@sourceware.org>
34866
34867         Automatic date update in version.in
34868
34869 2022-07-03  GDB Administrator  <gdbadmin@sourceware.org>
34870
34871         Automatic date update in version.in
34872
34873 2022-07-02  Tom de Vries  <tdevries@suse.de>
34874
34875         [gdb/symtab] Fix data race on per_cu->dwarf_version
34876         When building gdb with -fsanitize=thread and gcc 12, and running test-case
34877         gdb.dwarf2/dwz.exp, we run into a data race between thread T2 and the main
34878         thread in the same write:
34879         ...
34880         Write of size 1 at 0x7b200000300c:^M
34881             #0 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, \
34882             abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) gdb/dwarf2/read.c:6252 \
34883             (gdb+0x82f3b3)^M
34884         ...
34885         which is here:
34886         ...
34887                  this_cu->dwarf_version = cu->header.version;
34888         ...
34889
34890         Both writes are called from the parallel for in dwarf2_build_psymtabs_hard,
34891         this one directly:
34892         ...
34893             #1 process_psymtab_comp_unit gdb/dwarf2/read.c:6774 (gdb+0x8304d7)^M
34894             #2 operator() gdb/dwarf2/read.c:7098 (gdb+0x8317be)^M
34895             #3 operator() gdbsupport/parallel-for.h:163 (gdb+0x872380)^M
34896         ...
34897         and this via the PU import:
34898         ...
34899             #1 cooked_indexer::ensure_cu_exists(cutu_reader*, dwarf2_per_objfile*, \
34900             sect_offset, bool,  bool) gdb/dwarf2/read.c:17964 (gdb+0x85c43b)^M
34901             #2 cooked_indexer::index_imported_unit(cutu_reader*, unsigned char const*, \
34902             abbrev_info const*) gdb/dwarf2/read.c:18248 (gdb+0x85d8ff)^M
34903             #3 cooked_indexer::index_dies(cutu_reader*, unsigned char const*, \
34904             cooked_index_entry const*, bool) gdb/dwarf2/read.c:18302 (gdb+0x85dcdb)^M
34905             #4 cooked_indexer::make_index(cutu_reader*) gdb/dwarf2/read.c:18443 \
34906             (gdb+0x85e68a)^M
34907             #5 process_psymtab_comp_unit gdb/dwarf2/read.c:6812 (gdb+0x830879)^M
34908             #6 operator() gdb/dwarf2/read.c:7098 (gdb+0x8317be)^M
34909             #7 operator() gdbsupport/parallel-for.h:171 (gdb+0x8723e2)^M
34910         ...
34911
34912         Fix this by setting the field earlier, in read_comp_units_from_section.
34913
34914         The write in cutu_reader::cutu_reader() is still needed, in case
34915         read_comp_units_from_section is not used (run the test-case with say, target
34916         board cc-with-gdb-index).
34917
34918         Make the write conditional, such that it doesn't trigger if the field is
34919         already set by read_comp_units_from_section.  Instead, verify that the
34920         field already has the value that we're trying to set it to.
34921
34922         Move this logic into into a member function set_version (in analogy to the
34923         already present member function version) to make sure it's used consistenly,
34924         and make the field private in order to enforce access through the member
34925         functions, and rename it to m_dwarf_version.
34926
34927         While we're at it, make sure that the version is set before read, to avoid
34928         say returning true for "per_cu.version () < 5" if "per_cu.version () == 0".
34929
34930         Tested on x86_64-linux.
34931
34932 2022-07-02  Tom de Vries  <tdevries@suse.de>
34933
34934         [gdb/testsuite] Fix gdb.base/early-init-file.exp with -fsanitize=thread
34935         When building gdb with -fsanitize=thread, I run into:
34936         ...
34937         FAIL: gdb.base/early-init-file.exp: check startup version string has style \
34938           version
34939         ...
34940         due to this:
34941         ...
34942         warning: Found custom handler for signal 7 (Bus error) preinstalled.^M
34943         warning: Found custom handler for signal 8 (Floating point exception) \
34944           preinstalled.^M
34945         warning: Found custom handler for signal 11 (Segmentation fault) \
34946           preinstalled.^M
34947         Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)^M
34948         won't be propagated to spawned programs.^M
34949         ...
34950         appearing before the "GNU gdb (GDB) $version" line.
34951
34952         This is similar to the problem fixed by commit f0bbba7886f
34953         ("gdb.debuginfod/fetch_src_and_symbols.exp: fix when GDB is built with
34954         AddressSanitizer").
34955
34956         In that commit, the problem was fixed by starting gdb with -quiet, but using
34957         that would mean the "GNU gdb (GDB) $version" line that we're trying to check
34958         would disappear.
34959
34960         Fix this instead by updating the regexp to allow the message.
34961
34962         Tested on x86_64-linux.
34963
34964 2022-07-02  GDB Administrator  <gdbadmin@sourceware.org>
34965
34966         Automatic date update in version.in
34967
34968 2022-07-01  Maciej W. Rozycki  <macro@embecosm.com>
34969
34970         GDB/doc: Remove indentation from `print -elements' completion example
34971         Remove indentation from the text of the manual after the example here:
34972
34973         "  Completion will in some cases guide you with a suggestion of what
34974         kind of argument an option expects.  For example:
34975
34976              (gdb) print -elements <TAB><TAB>
34977              NUMBER     unlimited
34978
34979            Here, the option expects a number (e.g., '100'), not literal
34980         'NUMBER'.  Such metasyntactical arguments are always presented in
34981         uppercase."
34982
34983         as this is a continuation of the same paragraph.
34984
34985 2022-07-01  Maciej W. Rozycki  <macro@embecosm.com>
34986
34987         GDB/doc: Remove extraneous spaces from completion examples
34988         Completion results are usually different when the operation is applied
34989         to a word that is or is not followed by a space.  In some cases they are
34990         equivalent, however a space would not be produced if completion was used
34991         earlier on in the word processed.
34992
34993         However in the manual we have completion examples given using a space
34994         that actually prevents the example from working.  E.g.:
34995
34996         (gdb) info bre <TAB>
34997
34998         (nothing) and:
34999
35000         (gdb) info bre <TAB><TAB>
35001         Display all 200 possibilities? (y or n)
35002
35003         as it now goes on to propose the entire symbol table, while:
35004
35005         (gdb) info bre<TAB>
35006         (gdb) info breakpoints
35007
35008         does the right thing, but is not what is shown in the manual.
35009
35010         In other cases an extraneous space is used that does not correspond to
35011         the actual completion pattern shown, which gives an impression of
35012         sloppiness.
35013
35014         Remove extraneous spaces then from completion examples as appropriate.
35015
35016 2022-07-01  Nick Clifton  <nickc@redhat.com>
35017
35018         Add newline to the end of the rnglists displsy.
35019
35020 2022-07-01  GDB Administrator  <gdbadmin@sourceware.org>
35021
35022         Automatic date update in version.in
35023
35024 2022-06-30  Maciej W. Rozycki  <macro@embecosm.com>
35025
35026         GDB: Add `NUMBER' completion to `set' integer commands
35027         Fix a completion consistency issue with `set' commands accepting integer
35028         values and the special `unlimited' keyword:
35029
35030         (gdb) complete print -elements
35031         print -elements NUMBER
35032         print -elements unlimited
35033         (gdb)
35034
35035         vs:
35036
35037         (gdb) complete set print elements
35038         set print elements unlimited
35039         (gdb)
35040
35041         (there is a space entered at the end of both commands, not shown here)
35042         which also means if you strike <Tab> with `set print elements ' input,
35043         it will, annoyingly, complete to `set print elements unlimited' right
35044         away rather than showing a choice between `NUMBER' and `unlimited'.
35045
35046         Add `NUMBER' then as an available completion for such `set' commands:
35047
35048         (gdb) complete set print elements
35049         set print elements NUMBER
35050         set print elements unlimited
35051         (gdb)
35052
35053         Adjust the testsuite accordingly.  Also document the feature in the
35054         Completion section of the manual in addition to the Command Options
35055         section already there.
35056
35057 2022-06-30  Bruno Larsen  <blarsen@redhat.com>
35058
35059         gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation
35060         When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp
35061         only tested objects allocated on the stack. This commit adds a couple of
35062         dynamic allocations and tests if GDB can stop in it as well.
35063
35064 2022-06-30  Nick Clifton  <nickc@redhat.com>
35065
35066         Fix implementation of readelf's -wE and -wN options,
35067                 * dwarf.c (dwarf_select_sections_by_name): If the entry's value is
35068                 zero then clear the corresponding variable.
35069                 (dwarf_select_sections_by_letters): Likewise.
35070                 * testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE
35071                 debuginfod tests to fail.
35072
35073 2022-06-30  Tom de Vries  <tdevries@suse.de>
35074
35075         [gdb] Block SIGTERM in worker threads
35076         With gdb build with gcc-12 and -fsanitize=thread, and test-case
35077         gdb.base/gdb-sigterm.exp, I run into:
35078         ...
35079         WARNING: ThreadSanitizer: data race (pid=9722)^M
35080           Write of size 4 at 0x00000325bc68 by thread T1:^M
35081           #0 handle_sigterm(int) src/gdb/event-top.c:1211 (gdb+0x8ec01f)^M
35082           ...
35083           Previous read of size 4 at 0x00000325bc68 by main thread:^M
35084             [failed to restore the stack]^M
35085         ^M
35086           Location is global 'sync_quit_force_run' of size 4 at \
35087           0x00000325bc68 (gdb+0x325bc68)^M
35088           ...
35089         SUMMARY: ThreadSanitizer: data race gdb/event-top.c:1211 in \
35090           handle_sigterm(int)^M
35091         ...
35092         and 3 more data races involving handle_sigterm and locations:
35093         - active_ext_lang
35094         - quit_flag
35095         - heap block of size 40
35096           (XNEW (async_signal_handler) in create_async_signal_handler)
35097
35098         This was reported in PR29297.
35099
35100         The testcase executes a "kill -TERM $gdb_pid", which generates a
35101         process-directed signal.
35102
35103         A process-directed signal can be delivered to any thread, and what we see
35104         here is the fallout of the signal being delivered to a worker thread rather
35105         than the main thread.
35106
35107         Fix this by blocking SIGTERM in the worker threads.
35108
35109         [ I have not been able to reproduce this after it occurred for the first time,
35110         so unfortunately I cannot confirm that the patch fixes the problem. ]
35111
35112         Tested on x86_64-linux, with and without -fsanitize=thread.
35113
35114         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29297
35115
35116 2022-06-30  Andrew Burgess  <aburgess@redhat.com>
35117
35118         gdb/doc: fix column widths in MI compatibility table
35119         In passing I noticed that the column headings for the table of MI
35120         compatibility and breaking changes, were overlapping, at least when
35121         the PDF is generated on my machine.
35122
35123         I propose giving slightly more space to the two version number
35124         columns, this prevents the headers overlapping for me.
35125
35126 2022-06-30  GDB Administrator  <gdbadmin@sourceware.org>
35127
35128         Automatic date update in version.in
35129
35130 2022-06-29  Pedro Alves  <pedro@palves.net>
35131
35132         Fix GDBserver regression due to change to avoid reading shell registers
35133         Simon reported that the recent change to make GDB and GDBserver avoid
35134         reading shell registers caused a GDBserver regression, caught with
35135         ASan while running gdb.server/non-existing-program.exp:
35136
35137          $ /home/smarchi/build/binutils-gdb/gdb/testsuite/../../gdb/../gdbserver/gdbserver stdio non-existing-program
35138          =================================================================
35139          ==127719==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f0000000e9 at pc 0x55bcbfa301f4 bp 0x7ffd238a7320 sp 0x7ffd238a7310
35140          WRITE of size 1 at 0x60f0000000e9 thread T0
35141              #0 0x55bcbfa301f3 in scoped_restore_tmpl<bool>::~scoped_restore_tmpl() /home/smarchi/src/binutils-gdb/gdbserver/../gdbsupport/scoped_restore.h:86
35142              #1 0x55bcbfa2ffe9 in post_fork_inferior(int, char const*) /home/smarchi/src/binutils-gdb/gdbserver/fork-child.cc:120
35143              #2 0x55bcbf9c9199 in linux_process_target::create_inferior(char const*, std::__debug::vector<char*, std::allocator<char*> > const&) /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:991
35144              #3 0x55bcbf954549 in captured_main /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3941
35145              #4 0x55bcbf9552f0 in main /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4084
35146              #5 0x7ff9d663b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)
35147              #6 0x55bcbf8ef2bd in _start (/home/smarchi/build/binutils-gdb/gdbserver/gdbserver+0x1352bd)
35148
35149          0x60f0000000e9 is located 169 bytes inside of 176-byte region [0x60f000000040,0x60f0000000f0)
35150          freed by thread T0 here:
35151              #0 0x7ff9d6c6f0c7 in operator delete(void*) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:160
35152              #1 0x55bcbf910d00 in remove_process(process_info*) /home/smarchi/src/binutils-gdb/gdbserver/inferiors.cc:164
35153              #2 0x55bcbf9c4ac7 in linux_process_target::remove_linux_process(process_info*) /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:454
35154              #3 0x55bcbf9cdaa6 in linux_process_target::mourn(process_info*) /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:1599
35155              #4 0x55bcbf988dc4 in target_mourn_inferior(ptid_t) /home/smarchi/src/binutils-gdb/gdbserver/target.cc:205
35156              #5 0x55bcbfa32020 in startup_inferior(process_stratum_target*, int, int, target_waitstatus*, ptid_t*) /home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/fork-inferior.c:515
35157              #6 0x55bcbfa2fdeb in post_fork_inferior(int, char const*) /home/smarchi/src/binutils-gdb/gdbserver/fork-child.cc:111
35158              #7 0x55bcbf9c9199 in linux_process_target::create_inferior(char const*, std::__debug::vector<char*, std::allocator<char*> > const&) /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:991
35159              #8 0x55bcbf954549 in captured_main /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3941
35160              #9 0x55bcbf9552f0 in main /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4084
35161              #10 0x7ff9d663b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)
35162
35163          previously allocated by thread T0 here:
35164              #0 0x7ff9d6c6e5a7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
35165              #1 0x55bcbf910ad0 in add_process(int, int) /home/smarchi/src/binutils-gdb/gdbserver/inferiors.cc:144
35166              #2 0x55bcbf9c477d in linux_process_target::add_linux_process_no_mem_file(int, int) /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:425
35167              #3 0x55bcbf9c8f4c in linux_process_target::create_inferior(char const*, std::__debug::vector<char*, std::allocator<char*> > const&) /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:985
35168              #4 0x55bcbf954549 in captured_main /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3941
35169              #5 0x55bcbf9552f0 in main /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4084
35170              #6 0x7ff9d663b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)
35171
35172         Above we see that in the non-existing-program case, the process gets
35173         deleted before the starting_up flag gets restored to false.
35174
35175         This happens because startup_inferior calls target_mourn_inferior
35176         before throwing an error, and in GDBserver, unlike in GDB, mourning
35177         deletes the process.
35178
35179         Fix this by not using a scoped_restore to manage the starting_up flag,
35180         since we should only clear it when startup_inferior doesn't throw.
35181
35182         Change-Id: I67325d6f81c64de4e89e20e4ec4556f57eac7f6c
35183
35184 2022-06-29  Maciej W. Rozycki  <macro@embecosm.com>
35185
35186         GDB/testsuite: Tighten `set print elements' error check
35187         Match the whole error message expected to be given rather than omitting
35188         the part about the "unlimited" keyword.  There's no point in omitting
35189         the missing part first, and second with an upcoming change the part in
35190         parentheses will no longer be a fixed string, so doing a full match will
35191         ensure the algorithm correctly builds the message expected here.  Also
35192         avoid any wildcard matches.
35193
35194 2022-06-29  Maciej W. Rozycki  <macro@embecosm.com>
35195
35196         GDB: Remove extraneous full stops from `set' command error messages
35197         With errors given for bad commands such as `set annotate' or `set width'
35198         we produce an extraneous full stop within parentheses:
35199
35200         (gdb) set annotate
35201         Argument required (integer to set it to.).
35202         (gdb) set width
35203         Argument required (integer to set it to, or "unlimited".).
35204         (gdb)
35205
35206         This is grammatically incorrect, so remove the full stop and adjust the
35207         testsuite accordingly.
35208
35209 2022-06-29  Andrew Burgess  <aburgess@redhat.com>
35210
35211         gdb/doc: improve description of --data-disassemble opcodes output
35212         Extend the description of the MI command --data-disassemble.
35213         Specifically, expand the description of the 'opcodes' field to explain
35214         how the bytes are formatted.
35215
35216 2022-06-29  Yvan Roux  <yvan.roux@foss.st.com>
35217
35218         gdb/arm: Only stack S16..S31 when FPU registers are secure
35219         The FPCCR.TS bit is used to identify if FPU registers are considered
35220         non-secure or secure.  If they are secure, then callee saved registers
35221         (S16 to S31) are stacked on exception entry or otherwise skipped.
35222
35223 2022-06-29  Andrew Burgess  <aburgess@redhat.com>
35224
35225         opcodes/aarch64: split off creation of comment text in disassembler
35226         The function aarch64_print_operand (aarch64-opc.c) is responsible for
35227         converting an instruction operand into the textual representation of
35228         that operand.
35229
35230         In some cases, a comment is included in the operand representation,
35231         though this (currently) only happens for the last operand of the
35232         instruction.
35233
35234         In a future commit I would like to enable the new libopcodes styling
35235         for AArch64, this will allow objdump and GDB[1] to syntax highlight
35236         the disassembler output, however, having operands and comments
35237         combined in a single string like this makes such styling harder.
35238
35239         In this commit, I propose to extend aarch64_print_operand to take a
35240         second buffer.  Any comments for the instruction are written into this
35241         extra buffer.  The two callers of aarch64_print_operand are then
35242         updated to pass an extra buffer, and print any resulting comment.
35243
35244         In this commit no styling is added, that will come later.  However, I
35245         have adjusted the output slightly.  Before this commit some comments
35246         would be separated from the instruction operands with a tab character,
35247         while in other cases the comment was separated with two single spaces.
35248
35249         After this commit I use a single tab character in all cases.  This
35250         means a few test cases needed updated.  If people would prefer me to
35251         move everyone to use the two spaces, then just let me know.  Or maybe
35252         there was a good reason why we used a mix of styles, I could probably
35253         figure out a way to maintain the old output exactly if that is
35254         critical.
35255
35256         Other than that, there should be no user visible changes after this
35257         commit.
35258
35259         [1] GDB patches have not been merged yet, but have been posted to the
35260         GDB mailing list:
35261         https://sourceware.org/pipermail/gdb-patches/2022-June/190142.html
35262
35263 2022-06-29  Carl Love  <cel@us.ibm.com>
35264             Andrew Burgess  <aburgess@redhat.com>
35265
35266         gdb/testsuite: fix gdb.base/break-idempotent.exp on ppc
35267         When running the gdb.base/break-idempotent.exp test on ppc, I was
35268         seeing some test failures (or rather errors), that looked like this:
35269
35270           (gdb) watch local
35271           Hardware watchpoint 2: local
35272
35273           has_hw_wp_support: Hardware watchpoint detected
35274           ERROR: no fileid for gcc2-power8
35275           ERROR: Couldn't send delete breakpoints to GDB.
35276           ERROR OCCURED: can't read "gdb_spawn_id": no such variable
35277               while executing
35278           "expect {
35279           -i 1000 -timeout 100
35280                   -re ".*A problem internal to GDB has been detected" {
35281                       fail "$message (GDB internal error)"
35282                       gdb_internal_erro..."
35283               ("uplevel" body line 1)
35284               invoked from within
35285
35286         What happens is that in break-idempotent.exp we basically do this:
35287
35288             if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} {
35289                 continue
35290             }
35291
35292             # ....
35293
35294             if {![skip_hw_watchpoint_tests]} {
35295                 test_break $always_inserted "watch"
35296             }
35297
35298         The problem with this is that skip_hw_watchpoint_tests, includes this:
35299
35300             if { [istarget "i?86-*-*"]
35301                  || [istarget "x86_64-*-*"]
35302                  || [istarget "ia64-*-*"]
35303                  || [istarget "arm*-*-*"]
35304                  || [istarget "aarch64*-*-*"]
35305                  || ([istarget "powerpc*-*-linux*"] && [has_hw_wp_support])
35306                  || [istarget "s390*-*-*"] } {
35307                 return 0
35308             }
35309
35310         For powerpc only we call has_hw_wp_support.  This is a caching proc
35311         that runs a test within GDB to detect if we have hardware watchpoint
35312         support or not.
35313
35314         Unfortunately, to run this test we restart GDB, and when the test has
35315         completed, we exit GDB.  This means that in break-idempotent.exp, when
35316         we call skip_hw_watchpoint_tests for the first time on powerpc, GDB
35317         will unexpectedly be exited.  When we later call delete_breakpoints we
35318         see the errors I reported above.
35319
35320         The fix is to call skip_hw_watchpoint_tests early, before we start GDB
35321         as part of the break-idempotent.exp script, and store the result in a
35322         variable, we can then check this variable in the script as needed.
35323
35324         After this change break-idempotent.exp runs fine on powerpc.
35325
35326 2022-06-29  Jan Beulich  <jbeulich@suse.com>
35327
35328         x86: drop stray NoRex64 from XBEGIN
35329         Presumably this being there was a result of taking CALL as a reference
35330         when adding the RTM insns. But with No_qSuf the attribute has no effect.
35331
35332 2022-06-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
35333
35334         gprofng: fix build when BUILD_MAN is false
35335         gprofng/ChangeLog
35336         2022-06-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
35337
35338                 PR gprofng/29131
35339                 * gp-display-html/Makefile.am: Set man_MANS only when BUILD_MAN is true.
35340                 * src/Makefile.am: Likewise.
35341                 * gp-display-html/Makefile.in: Rebuild.
35342                 * src/Makefile.in: Rebuild.
35343
35344 2022-06-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
35345
35346         gprofng: use $(sysconfdir) instead $(prefix)/etc
35347         gprofng/ChangeLog
35348         2022-06-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
35349
35350                 PR gprofng/29191
35351                 * src/Makefile.am: Use $(sysconfdir) instead $(prefix)/etc.
35352                 * src/Settings.cc: Likewise.
35353                 * src/Makefile.in: Rebuild.
35354
35355 2022-06-29  Alan Modra  <amodra@gmail.com>
35356
35357         Re: ld/x86: skip p_align-1 tests with unsuitable compiler
35358         commit d0e0f9c87a3e results "ERROR: i586-linux-cc does not exist" if
35359         cross-building an i586-linux target without a target compiler
35360         installed.
35361
35362                 * testsuite/ld-elf/linux-x86.exp (compiler_honours_aligned): New.
35363                 Use it after first testing check_compiler_available.
35364
35365 2022-06-29  GDB Administrator  <gdbadmin@sourceware.org>
35366
35367         Automatic date update in version.in
35368
35369 2022-06-28  Pedro Alves  <pedro@palves.net>
35370
35371         gdb+gdbserver/Linux: avoid reading registers while going through shell
35372         For every stop, Linux GDB and GDBserver save the stopped thread's PC,
35373         in lwp->stop_pc.  This is done in save_stop_reason, in both
35374         gdb/linux-nat.c and gdbserver/linux-low.cc.  However, while we're
35375         going through the shell after "run", in startup_inferior, we shouldn't
35376         be reading registers, as we haven't yet determined the target's
35377         architecture -- the shell's architecture may not even be the same as
35378         the final inferior's.
35379
35380         In gdb/linux-nat.c, lwp->stop_pc is only needed when the thread has
35381         stopped for a breakpoint, and since when going through the shell, no
35382         breakpoint is going to hit, we could simply teach save_stop_reason to
35383         only record the stop pc when the thread stopped for a breakpoint.
35384
35385         However, in gdbserver/linux-low.cc, lwp->stop_pc is used in more cases
35386         than breakpoint hits (e.g., it's used in tracepoints & the
35387         "while-stepping" feature).
35388
35389         So to avoid GDB vs GDBserver divergence, we apply the same approach to
35390         both implementations.
35391
35392         We set a flag in the inferior (process in GDBserver) whenever it is
35393         being nursed through the shell, and when that flag is set,
35394         save_stop_reason bails out early.  While going through the shell,
35395         we'll only ever get process exits (normal or signalled), random
35396         signals, and exec events, so nothing is lost.
35397
35398         Change-Id: If0f01831514d3a74d17efd102875de7d2c6401ad
35399
35400 2022-06-28  Tom de Vries  <tdevries@suse.de>
35401
35402         [gdb/build] Fix gdb build with -fsanitize=thread and gcc 7
35403         When building gdb with system gcc 7.5.0, I run into:
35404         ...
35405         gdb/ia64-tdep.c: In function ‘int is_float_or_hfa_type_recurse(type*, type**)’:
35406         gdb/ia64-tdep.c:3362:1: error: control reaches end of non-void function \
35407           [-Werror=return-type]
35408         ...
35409
35410         This is due to PR gcc/81275 - "-fsanitize=thread produce incorrect
35411         -Wreturn-type warning", which has been fixed in gcc-8.
35412
35413         Work around this by moving the default return outside the switch.
35414
35415         Tested on x86_64-linux.
35416
35417 2022-06-28  Clément Chigot  <chigot@adacore.com>
35418
35419         bfd: handle codepage when opening files on MinGW
35420         Even if MS docs say that CP_UTF8 should always be used on newer
35421         applications, forcing it might produce undefined filename if the
35422         encoding isn't UTF-8.
35423         MinGW seems to call ___lc_codepage_func() in order to retrieve the
35424         current thread codepage.
35425
35426         bfd/ChangeLog:
35427
35428                 * bfdio.c (_bfd_real_fopen): Retrieve codepage with
35429                 ___lc_codepage_func() on MinGW.
35430
35431 2022-06-28  Clément Chigot  <chigot@adacore.com>
35432
35433         windres: add quotes around preprocessor cmd if needed
35434         This patch ensures that the gcc binary called by windres is quoted if
35435         needed. Otherwise, errors can occur if the gcc is under a folder having
35436         a name containing a space (eg "Program Files").
35437
35438         binutils/
35439                 * resrc.c (DEFAULT_PREPROCESSOR): Split into...
35440                 (DEFAULT_PREPROCESSOR_CMD): that...
35441                 (DEFAULT_PREPROCESSOR_ARGS): and that.
35442                 (look_for_default): Add quotes around the command if needed.
35443                 (read_rc_file): Adapt to new defines.
35444
35445 2022-06-28  Nick Clifton  <nickc@redhat.com>
35446
35447         Fix the display of the idnex values for DW_FORM_loclistx and DW_FORM_rnglistx.  Correct the display of .debug.loclists sections.
35448                 PR 29267
35449                 * dwarf.c (display_debug_rnglists): New function, broken out of..
35450                 (display_debug_ranges): ... here.
35451                 (read_and_display_attr_value): Correct calculation of index
35452                 displayed for DW_FORM_loclistx and DW_FORM_rnglistx.
35453                 * testsuite/binutils-all/x86-64/pr26808.dump: Update expected
35454                 output.
35455
35456 2022-06-28  Jan Beulich  <jbeulich@suse.com>
35457
35458         ld/x86: skip p_align-1 tests with unsuitable compiler
35459         When the compiler doesn't properly arrange for foo's alignment, there's
35460         no point even trying these tests. Report the situation as a single
35461         "unsupported" test.
35462
35463 2022-06-28  Alan Modra  <amodra@gmail.com>
35464
35465         PowerPC64: align plt_branch stubs
35466         plt_branch stubs are similar to plt_call stubs in that they branch
35467         via bctr.  Align them too.
35468
35469         bfd/
35470                 * elf64-ppc.c (ppc_size_one_stub): Align plt_branch stubs as for
35471                 plt_call stubs.
35472         ld/
35473                 * testsuite/ld-powerpc/elfv2exe.d: Adjust for plt_branch changes.
35474                 * testsuite/ld-powerpc/notoc.d: Likewise.
35475                 * testsuite/ld-powerpc/notoc.wf: Likewise.
35476                 * testsuite/ld-powerpc/notoc3.d: Likewise.
35477                 * testsuite/ld-powerpc/pr23937.d: Likewise.
35478
35479 2022-06-28  Alan Modra  <amodra@gmail.com>
35480
35481         PowerPC64: plt_stub_pad
35482                 * elf64-ppc.c (plt_stub_pad): Simplify parameters and untangle
35483                 from plt_stub_size.
35484                 (ppc_size_one_stub): Call plt_stub_size before plt_stub_pad to
35485                 provide size.  Recalculate size if it might change.
35486
35487 2022-06-28  Alan Modra  <amodra@gmail.com>
35488
35489         PowerPC64: Tidy stub type changes
35490         It made sense before I started using separate fields for main type and
35491         sub type to add a difference in main type to the type (thus keeping
35492         sub type unchanged).  Not so much now.
35493
35494                 * elf64-ppc.c (ppc_merge_stub): Simplify stub type change.
35495                 (ppc_size_one_stub): Likewise.
35496
35497 2022-06-28  Jiangshuai Li  <jiangshuai_li@c-sky.com>
35498
35499         gdb:csky add pseudo regs for float and vector regs
35500         In the existing CSKY architecture, there are at most 32 floating
35501         and 16 vector registers. Float registers's count can be configured
35502         as 16 or 32. In the future, the vector registers's count may be
35503         extended to 32.
35504
35505         The bit width of floating-point register is 64bits, and the bit
35506         width of vector register is 128bit.
35507
35508         Special points: in fr0~fr15 and vr0~vr15, each FRx is the lower
35509         64 bits of the corresponding VRx.
35510
35511         Here, we will split each floating-point and vector register to
35512         32bits wide, add the corresponding pseudo registers, and finally
35513         use them for the dwarf registers.
35514
35515         There are 128 pseudo registers in total, s0~s127, including:
35516         1. s0 and s1 correspond to fr0, s4 and s5 correspond to fr1, and so on.
35517         Every two separated pseudo registers correspond to a float register.
35518         2. s0, s1, s2 and s3 correspond to vr0; s4, s5, s6 and s7 correspond to vr1,
35519         and so on. Every four pseudo registers corresponds to a vector register.
35520
35521         Therefore, in s64~s127, there are general registers that are not actually
35522         used. This part is to prepare for the expansion of vector registers to 32
35523
35524         Therefore, in s64~s127, half of the registers are actually unused. This
35525         part is to prepare for the expansion of the vector register to 32.
35526
35527 2022-06-28  Pekka Seppänen  <pexu@sourceware.mail.kapsi.fi>
35528
35529         PR29293, elfnn-aarch64.c: def_protected member unintialized
35530                 PR 29293
35531                 * elfnn-aarch64.c (elfNN_aarch64_link_hash_newfunc): Init def_protected.
35532
35533 2022-06-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
35534
35535         RISC-V: Add 'Sstc' extension and its CSRs
35536         This commit adds "stimecmp / vstimecmp" Extension (Sstc) and its CSRs.
35537
35538         bfd/ChangeLog:
35539
35540                 * elfxx-riscv.c (riscv_supported_std_s_ext): Add 'Sstc'
35541                 extension to valid 'S' extension list.
35542
35543         gas/ChangeLog:
35544
35545                 * config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for
35546                 'Sstc' extension. (riscv_csr_address): Add handling for new CSR
35547                 classes.
35548                 * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
35549                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
35550                 * testsuite/gas/riscv/csr.s: Add new CSRs.
35551                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
35552                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
35553                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
35554                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
35555                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
35556                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
35557                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
35558                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
35559
35560         include/ChangeLog:
35561
35562                 * opcode/riscv-opc.h (CSR_STIMECMP, CSR_STIMECMPH,
35563                 CSR_VSTIMECMP, CSR_VSTIMECMPH): New CSR macros.
35564
35565 2022-06-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
35566
35567         RISC-V: Add 'Sscofpmf' extension with its CSRs
35568         This commit adds Count Overflow and Mode-Based Filtering Extension
35569         (Sscofpmf) and its CSRs.
35570
35571         bfd/ChangeLog:
35572
35573                 * elfxx-riscv.c (riscv_supported_std_s_ext): Add 'Sscofpmf'
35574                 extension to valid 'S' extension list.
35575
35576         gas/ChangeLog:
35577
35578                 * config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for
35579                 'Sscofpmf' extension. (riscv_csr_address): Add handling for new
35580                 CSR classes.
35581                 * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
35582                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
35583                 * testsuite/gas/riscv/csr.s: Add new CSRs.
35584                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
35585                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
35586                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
35587                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
35588                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
35589                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
35590                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
35591                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
35592
35593         include/ChangeLog:
35594
35595                 * opcode/riscv-opc.h (CSR_SCOUNTOVF, CSR_MHPMEVENT3H,
35596                 CSR_MHPMEVENT4H, CSR_MHPMEVENT5H, CSR_MHPMEVENT6H,
35597                 CSR_MHPMEVENT7H, CSR_MHPMEVENT8H, CSR_MHPMEVENT9H,
35598                 CSR_MHPMEVENT10H, CSR_MHPMEVENT11H, CSR_MHPMEVENT12H,
35599                 CSR_MHPMEVENT13H, CSR_MHPMEVENT14H, CSR_MHPMEVENT15H,
35600                 CSR_MHPMEVENT16H, CSR_MHPMEVENT17H, CSR_MHPMEVENT18H,
35601                 CSR_MHPMEVENT19H, CSR_MHPMEVENT20H, CSR_MHPMEVENT21H,
35602                 CSR_MHPMEVENT22H, CSR_MHPMEVENT23H, CSR_MHPMEVENT24H,
35603                 CSR_MHPMEVENT25H, CSR_MHPMEVENT26H, CSR_MHPMEVENT27H,
35604                 CSR_MHPMEVENT28H, CSR_MHPMEVENT29H, CSR_MHPMEVENT30H,
35605                 CSR_MHPMEVENT31H): New CSR macros.
35606
35607 2022-06-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
35608
35609         RISC-V: Add 'Smstateen' extension and its CSRs
35610         This commit adds State Enable Extension (Smstateen) and its CSRs.
35611
35612         bfd/ChangeLog:
35613
35614                 * elfxx-riscv.c (riscv_supported_std_s_ext): Add 'Smstateen'
35615                 extension to valid 'S' extension list.
35616
35617         gas/ChangeLog:
35618
35619                 * config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for
35620                 'Smstateen' extension. (riscv_csr_address): Add handling for
35621                 new CSR classes.
35622                 * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
35623                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
35624                 * testsuite/gas/riscv/csr.s: Add new CSRs.
35625                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
35626                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
35627                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
35628                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
35629                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
35630                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
35631                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
35632                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
35633
35634         include/ChangeLog:
35635
35636                 * opcode/riscv-opc.h (CSR_MSTATEEN0, CSR_MSTATEEN1,
35637                 CSR_MSTATEEN2, CSR_MSTATEEN3, CSR_SSTATEEN0, CSR_SSTATEEN1,
35638                 CSR_SSTATEEN2, CSR_SSTATEEN3, CSR_HSTATEEN0, CSR_HSTATEEN1,
35639                 CSR_HSTATEEN2, CSR_HSTATEEN3, CSR_MSTATEEN0H, CSR_MSTATEEN1H,
35640                 CSR_MSTATEEN2H, CSR_MSTATEEN3H, CSR_HSTATEEN0H, CSR_HSTATEEN1H,
35641                 CSR_HSTATEEN2H, CSR_HSTATEEN3H): New CSR macros.
35642
35643 2022-06-28  Tsukasa OI  <research_trasio@irq.a4lg.com>
35644
35645         RISC-V: Add new CSR feature gate handling (RV32,H)
35646         To support feature gate like Smstateen && H, this commit adds certain
35647         CSR feature gate handling.  It also changes how RV32-only CSRs are
35648         handled for cleanliness.
35649
35650         gas/ChangeLog:
35651
35652                 * config/tc-riscv.c (riscv_csr_address): Add CSR feature gate
35653                 handling for H.  Change handling on RV32.
35654
35655 2022-06-28  Alan Modra  <amodra@gmail.com>
35656
35657         Re: Disable execstack and rwx segments warnings for MIPS targets.
35658                 PR 29263
35659                 * configure.ac: Fix typo.
35660                 * testsuite/ld-elf/elf.exp: Add mips to targets that need
35661                 --warn-execstack to pass first pr29072 test.
35662
35663 2022-06-28  GDB Administrator  <gdbadmin@sourceware.org>
35664
35665         Automatic date update in version.in
35666
35667 2022-06-27  Bruno Larsen  <blarsen@redhat.com>
35668
35669         gdb/testsuite: update bug numbers from Gnats to bugzilla
35670         Some tests link to outdated bug numbers when an XFAIL or a KFAIL happen.
35671
35672         gdb.base/macscp.exp was referencing bug number 555, and the bug 7660
35673         mentions that it used to be 555 on the Gnats system and seems to relate
35674         to the issue at hand.
35675
35676         gdb.base/annota1.exp was referencing bug number 1270, and bug 8375
35677         mentions being number 1270 on Gnats, and mentions annota1 specifically,
35678         so it seemed pretty obvious.
35679
35680 2022-06-27  Tom de Vries  <tdevries@suse.de>
35681
35682         [gdb/build] Fix build breaker with --enable-shared
35683         When building gdb with --enable-shared, I run into:
35684         ...
35685         ld: build/zlib/libz.a(libz_a-inffast.o): relocation R_X86_64_32S against \
35686           `.rodata' can not be used when making a shared object; recompile with -fPIC
35687         ld: build/zlib/libz.a(libz_a-inflate.o): warning: relocation against \
35688           `inflateResetKeep' in read-only section `.text'
35689         collect2: error: ld returned 1 exit status
35690         make[3]: *** [libbfd.la] Error 1
35691         ...
35692
35693         This is a regression since commit a08bdb159bb ("[gdb/build] Fix gdbserver
35694         build with -fsanitize=thread").
35695
35696         The problem is that a single case statement in configure is shared to handle
35697         special requirements for both the host libiberty and host zlib, which has the
35698         effect that only one is handled.
35699
35700         Fix this by handling libiberty and zlib each in its own case statement.
35701
35702         Build on x86_64-linux, with and without --enable-shared.
35703
35704         ChangeLog:
35705
35706         2022-06-27  Tom de Vries  <tdevries@suse.de>
35707
35708                 * configure.ac: Set extra_host_libiberty_configure_flags and
35709                 extra_host_zlib_configure_flags in separate case statements.
35710                 * configure: Regenerate.
35711
35712 2022-06-27  Pedro Alves  <pedro@palves.net>
35713
35714         Make GDBserver abort on internal error in development mode
35715         Currently, if GDBserver hits some internal assertion, it exits with
35716         error status, instead of aborting.  This makes it harder to debug
35717         GDBserver, as you can't just debug a core file if GDBserver fails an
35718         assertion.  I've had to hack the code to make GDBserver abort to debug
35719         something several times before.
35720
35721         I believe the reason it exits instead of aborting, is to prevent
35722         potentially littering the filesystem of smaller embedded targets with
35723         core files.  I think I recall Daniel Jacobowitz once saying that many
35724         years ago, but I can't be sure.  Anyhow, that seems reasonable to me.
35725
35726         Since we nowadays have a distinction between development and release
35727         modes, I propose to make GDBserver abort on internal error if in
35728         development mode, while keeping the status quo when in release mode.
35729
35730         Thus, after this patch, in development mode, you get:
35731
35732          $ ../gdbserver/gdbserver
35733          ../../src/gdbserver/server.cc:3711: A problem internal to GDBserver has been detected.
35734          captured_main: Assertion `0' failed.
35735          Aborted (core dumped)
35736          $
35737
35738         while in release mode, you'll continue to get:
35739
35740          $ ../gdbserver/gdbserver
35741          ../../src/gdbserver/server.cc:3711: A problem internal to GDBserver has been detected.
35742          captured_main: Assertion `0' failed.
35743          $ echo $?
35744          1
35745
35746         I do not think that this requires a separate configure switch.
35747
35748         A "--target_board=native-extended-gdbserver" run on Ubuntu 20.04 ends
35749         up with:
35750
35751                          === gdb Summary ===
35752
35753          # of unexpected core files      29
35754          ...
35755
35756         for me, of which 8 are GDBserver core dumps, 7 more than without this
35757         patch.
35758
35759         Change-Id: I6861e08ad71f65a0332c91ec95ca001d130b0e9d
35760
35761 2022-06-27  Nick Clifton  <nickc@redhat.com>
35762
35763         Replace a run-time assertion failure with a warning message when parsing corrupt DWARF data.
35764                 PR 29289
35765                 * dwarf.c (display_debug_names): Replace assert with a warning
35766                 message.
35767
35768         Fix NULL pointer indirection when parsing corrupt DWARF data.
35769                 PR 29290
35770                 * dwarf.c (read_and_display_attr_value): Check that debug_info_p
35771                 is set before dereferencing it.
35772
35773         Have gold's File_read::do_read() function check the start parameter
35774                 PR 23765
35775                 * fileread.cc (File_read::do_read): Check start parameter before
35776                 computing number of bytes to read.
35777
35778 2022-06-27  Yvan Roux  <yvan.roux@foss.st.com>
35779
35780         gdb/arm: Unwind Non-Secure callbacks from Secure
35781         Without this changeset, the unwinding doesn't take into account
35782         Non-Secure to Secure stack unwinding enablement status and
35783         doesn't choose the proper SP to do the unwinding.
35784
35785         This patch only unwinds the stack when Non-Secure to Secure
35786         unwinding is enabled, previous SP is set w/r to the current mode
35787         (Handler -> msp_s, Thread -> psp_s) and then the Secure stack is
35788         unwound.  Ensure thumb bit is set in PSR when needed.  Also, drop
35789         thumb bit from PC if set.
35790
35791 2022-06-27  Nick Clifton  <nickc@redhat.com>
35792
35793         Stop bogus warnings about DWARF indexed string offsets being too big.
35794                 * dwarf.c (fetch_indexed_string): Do not use length of first table
35795                 in string section as the length of every table in the section.
35796                 * testsuite/binutils-all/pr26112.r: Update expected output.
35797
35798 2022-06-27  Tom de Vries  <tdevries@suse.de>
35799
35800         [gdb/testsuite] Handle older python in gdb.python/py-send-packet.py
35801         With python 3.4, I run into:
35802         ...
35803         Traceback (most recent call last):^M
35804           File "<string>", line 1, in <module>^M
35805           File
35806           "outputs/gdb.python/py-send-packet/py-send-packet.py", line 128, in \
35807             run_set_global_var_test^M
35808             res = conn.send_packet(b"X%x,4:\x02\x02\x02\x02" % addr)^M
35809         TypeError: Could not convert Python object: b'X%x,4:\x02\x02\x02\x02'.^M
35810         Error while executing Python code.^M
35811         ...
35812         while with python 3.6 this works fine.
35813
35814         The type of addr is <class 'gdb.Value'>, so the first thing to try is whether
35815         changing it into a string works:
35816         ...
35817             addr_str = "%x" % addr
35818             res = conn.send_packet(b"X%s,4:\x02\x02\x02\x02" % addr_str)
35819         ...
35820         which gets us the more detailed:
35821         ...
35822         TypeError: unsupported operand type(s) for %: 'bytes' and 'str'
35823         ...
35824
35825         Fix this by avoiding the '%' operator in the byte literal, and use instead:
35826         ...
35827         def xpacket_header (addr):
35828             return ("X%x,4:" % addr).encode('ascii')
35829           ...
35830             res = conn.send_packet(xpacket_header(addr) + b"\x02\x02\x02\x02")
35831         ...
35832
35833         Tested on x86_64-linux, with python 3.4 and 3.6, and a backported version was
35834         tested on the gdb-12-branch in combination with python 2.7.
35835
35836 2022-06-27  Tom de Vries  <tdevries@suse.de>
35837
35838         [gdb/testsuite] Fix gdb.reverse/i387-env-reverse.exp for -pie
35839         When running test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux with
35840         target board unix/-m32/-fPIE/-pie, we run into:
35841         ...
35842         (gdb) PASS: gdb.reverse/i387-env-reverse.exp: push st0
35843         info register eax^M
35844         eax            0x56550000          1448411136^M
35845         (gdb) FAIL: gdb.reverse/i387-env-reverse.exp: verify eax == 0x8040000
35846         ...
35847
35848         The problem is that the tested instruction (fstsw) only sets $ax, not $eax.
35849
35850         Fix this by verifying $ax instead of $eax.
35851
35852         Tested on x86_64-linux with target boards unix/-m32 and unix/-m32/-fPIE/-pie.
35853
35854 2022-06-27  Tom de Vries  <tdevries@suse.de>
35855
35856         [gdb/testsuite] Enable some test-cases for x86_64 -m32
35857         When trying to run test-case gdb.reverse/i387-env-reverse.exp for x86_64-linux
35858         with target board unix/-m32, it's skipped.
35859
35860         Fix this by using is_x86_like_target instead of istarget "i?86-*linux*".
35861
35862         This exposes a number of duplicates, fix those by making the test names unique.
35863
35864         Likewise in a couple of other test-cases.
35865
35866         Tested on x86_64-linux with target boards unix/-m32.
35867
35868 2022-06-27  Tom de Vries  <tdevries@suse.de>
35869
35870         [gdb/testsuite] Workaround unnecessary .s file with gfortran 4.8
35871         After running test-case gdb.fortran/namelist.exp with gfortran 4.8.5, I'm left
35872         with:
35873         ...
35874         $ git sti
35875         On branch master
35876         Your branch is up to date with 'origin/master'.
35877
35878         Untracked files:
35879           (use "git add <file>..." to include in what will be committed)
35880                 gdb/testsuite/lib/compiler.s
35881
35882         nothing added to commit but untracked files present (use "git add" to track)
35883         ...
35884
35885         We're running into PR gcc/60447, which was fixed in gcc 4.9.0.
35886
35887         Workaround this by first copying the source file to the temp dir, such that
35888         the .s file is left there instead:
35889         ...
35890         $ ls build/gdb/testsuite/temp/<runtest pid>/
35891         compiler.c  compiler.F90  compiler.s
35892         ...
35893
35894         Tested on x86_64-linux.
35895
35896 2022-06-27  Tom de Vries  <tdevries@suse.de>
35897
35898         [gdb/testsuite] Skip gdb.fortran/namelist.exp for gfortran 4.8
35899         The test-case gdb.fortran/namelist.exp uses a gfortran feature (emitting
35900         DW_TAG_namelist in the debug info) that has been supported since gfortran 4.9,
35901         see PR gcc/37132.
35902
35903         Skip the test for gfortran 4.8 and earlier.  Do this using gcc_major_version,
35904         and update it to be able to handle "gcc_major_version {gfortran-*} f90".
35905
35906         Tested on x86_64-linux, with gfortran 4.8.5, 7.5.0, and 12.1.1.
35907
35908 2022-06-27  Tom de Vries  <tdevries@suse.de>
35909
35910         [gdb/symtab] Fix parsing of .debug_str_offsets header
35911         When running test-case gdb.dwarf2/fission-mix.exp with target board dwarf64
35912         and gcc-12 (defaulting to DWARF5), I run into:
35913         ...
35914         (gdb) break func2^M
35915         Offset from DW_FORM_GNU_str_index or DW_FORM_strx pointing outside of \
35916           .debug_str.dwo section in CU at offset 0x0 [in module fission-mix]^M
35917         (gdb) FAIL: gdb.dwarf2/fission-mix.exp: break func2
35918         ...
35919
35920         The .debug_str_offsets section has version 5, so as per the standard it has
35921         it's own header, with initial length and version:
35922         ...
35923         Contents of the .debug_str_offsets.dwo section (loaded from fission-mix2.dwo):
35924
35925             Length: 0x1c
35926             Version: 0x5
35927                Index   Offset [String]
35928                    0        0 build/gdb/testsuite
35929                    1       33 GNU C17
35930                    2       8f src/gdb/testsuite/gdb.dwarf2/fission-mix-2.c
35931         ...
35932
35933         But when trying to read the string offset at index 0 in the table (which
35934         is 0), we start reading at offset 8, which points in the header, at the last
35935         4 bytes of the initial length (it's 12 bytes because of 64-bit dwarf), as well
35936         at the 2-byte version field and 2 bytes of padding, so we get:
35937         ...
35938         (gdb) p /x str_offset
35939         $1 = 0x500000000
35940         ...
35941         which indeed is an offset that doesn't fit in the .debug_str section.
35942
35943         The offset 8 is based on reader->cu->header.addr_size:
35944         ...
35945         static const char *
35946         read_dwo_str_index (const struct die_reader_specs *reader, ULONGEST str_index)
35947         {
35948          ULONGEST str_offsets_base = reader->cu->header.version >= 5
35949                                      ? reader->cu->header.addr_size : 0;
35950         ...
35951         which doesn't in look in agreement with the standard.
35952
35953         Note that this happens to give the right answer for 32-bit dwarf and
35954         addr_size == 8, because then we have header size ==
35955         (initial length (4) + version (2) + padding (2)) == 8.
35956
35957         Conversely, for 32-bit dwarf and addr_size == 4 (target board unix/-m32)
35958         we run into a similar problem.  It just happens to not trigger the warning,
35959         instead we get the wrong strings, like "func2" for DW_AT_producer and
35960         "build/gdb/testsuite" for DW_AT_name of the DW_TAG_compile_unit DIE.
35961
35962         Fix this by parsing the .debug_str_offsets header in read_dwo_str_index.
35963
35964         Add a FIXME that we should not parse this for every call.
35965
35966         Tested on x86_64-linux.
35967
35968 2022-06-27  Tom de Vries  <tdevries@suse.de>
35969
35970         [gdb/build] Fix gdbserver build with -fsanitize=thread
35971         [ Copied from gcc commit 153689603fd ("[gdb/build] Fix gdbserver build with
35972         -fsanitize=thread"). ]
35973
35974         When building gdbserver with -fsanitize=thread (added to CFLAGS/CXXFLAGS) we
35975         run into:
35976         ...
35977         ld: ../libiberty/libiberty.a(safe-ctype.o): warning: relocation against \
35978           `__tsan_init' in read-only section `.text'
35979         ld: ../libiberty/libiberty.a(safe-ctype.o): relocation R_X86_64_PC32 \
35980           against symbol `__tsan_init' can not be used when making a shared object; \
35981           recompile with -fPIC
35982         ld: final link failed: bad value
35983         collect2: error: ld returned 1 exit status
35984         make[1]: *** [libinproctrace.so] Error 1
35985         ...
35986         which looks similar to what is described in commit 78e49486944 ("[gdb/build]
35987         Fix gdbserver build with -fsanitize=address").
35988
35989         The gdbserver component builds a shared library libinproctrace.so, which uses
35990         libiberty and therefore requires the pic variant.  The gdbserver Makefile is
35991         setup to use this variant, if available, but it's not there.
35992
35993         Fix this by listing gdbserver in the toplevel configure alongside libcc1, as a
35994         component that needs the libiberty pic variant, setting:
35995         ...
35996         extra_host_libiberty_configure_flags=--enable-shared
35997         ...
35998
35999         Tested on x86_64-linux.
36000
36001         ChangeLog:
36002
36003         2022-06-27  Tom de Vries  <tdevries@suse.de>
36004
36005                 * configure.ac: Build libiberty pic variant for gdbserver.
36006                 * configure: Regenerate.
36007
36008 2022-06-27  Nick Clifton  <nickc@redhat.com>
36009
36010         Disable execstack and rwx segments warnings for MIPS targets.
36011                 PR 29263
36012                 * configure.ac: Move HPPA specific code from here...
36013                 * configure.tgt: ... to here.  Add similar code for MIPS.
36014                 Move code for CRIS, MIPS and HPPA to block at start of file.
36015                 * configure: Regenerate.
36016
36017 2022-06-27  Jan Beulich  <jbeulich@suse.com>
36018
36019         bfd: prune config.bfd's setting of targ_archs
36020         The final "match all" case can take care of a few explicit entries:
36021         Purge those. Also move s12z* into proper position (the table is
36022         otherwise sorted, after all).
36023
36024 2022-06-27  Jan Beulich  <jbeulich@suse.com>
36025
36026         drop XC16x bits
36027         Commit 04f096fb9e25 ("Move the xc16x target to the obsolete list") moved
36028         the architecture from the "obsolete but still available" to the
36029         "obsolete / support removed" list in config.bfd, making the architecture
36030         impossible to enable (except maybe via "enable everything" options").
36031
36032         Note that I didn't touch */po/*.po{,t} on the assumption that these
36033         would be updated by some (half)automatic means.
36034
36035 2022-06-27  Bhuvanendra Kumar N  <Bhuvanendra.KumarN@amd.com>
36036
36037         Fix location list offset address dump under DW_AT_location (dwarf-5)
36038         For clang compiled objects with dwarf-5, location list offset address dump
36039         under DW_AT_location is corrected, where DW_FORM_loclistx is used. While
36040         dumping the location list offset, the address dumped is wrong where it was
36041         refering to .debug_addr instead of .debug_loclists
36042
36043               * dwarf.c (fetch_indexed_value): Add base_address as parameter and
36044               use it to access the section offset.
36045               (read_and_display_attr_value): Handle DW_FORM_loclistx form separately.
36046               Pass loclists_base to fetch_indexed_value().
36047
36048 2022-06-27  Alan Modra  <amodra@gmail.com>
36049
36050         PowerPC64 .branch_lt address
36051         .branch_lt is really an extension of .plt, as is .iplt.  We'd like all
36052         of the PLT sections to be fixed relative to .TOC. after stub sizing,
36053         because changes in offset to PLT entries might mean a change in stub
36054         sizes.  When -z relro, the relro layout does this by laying out
36055         sections from the end of the relro segment.  So for example, a change
36056         in .eh_frame (which happens after stub sizing) will keep the same GOT
36057         to PLT offset when -z relro.  Not so when -z norelro, because then the
36058         usual forward layout of section is done and .got is more aligned than
36059         .branch_lt.
36060
36061                 * emulparams/elf64ppc.sh: Set .branch_lt address fixed relative
36062                 to .got.
36063                 * testsuite/ld-powerpc/elfv2exe.d: Adjust to suit.
36064
36065 2022-06-27  Alan Modra  <amodra@gmail.com>
36066
36067         -z relro relaxation and ld script SIZEOF
36068         A number of targets use assignments like:
36069         . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 12 ? 12 : 0, .);
36070         (from i386) in linker scripts to put the end of the relro segment past
36071         the header in .got.plt.  Examination of testcases like those edited by
36072         this patch instead sees the end of the relro segment being placed at
36073         the start of .got.plt.  For the i386 pie1 test:
36074
36075           [ 9] .got.plt          PROGBITS        00002000 001000 00000c 04  WA  0   0  4
36076
36077           GNU_RELRO      0x000f90 0x00001f90 0x00001f90 0x00070 0x00070 R   0x1
36078
36079         A map file shows:
36080
36081         .dynamic        0x0000000000001f90       0x70
36082          *(.dynamic)
36083          .dynamic       0x0000000000001f90       0x70 tmpdir/pie1.o
36084                         0x0000000000001f90                _DYNAMIC
36085
36086         .got            0x0000000000002000        0x0
36087          *(.got)
36088          .got           0x0000000000002000        0x0 tmpdir/pie1.o
36089          *(.igot)
36090                         0x0000000000002ff4                . = DATA_SEGMENT_RELRO_END (., (SIZEOF (.got.plt) >= 0xc)?0xc:0x0)
36091
36092         .got.plt        0x0000000000002000        0xc
36093          *(.got.plt)
36094          .got.plt       0x0000000000002000        0xc tmpdir/pie1.o
36095                         0x0000000000002000                _GLOBAL_OFFSET_TABLE_
36096
36097         The DATA_SEGMENT_RELRO_END value in the map file is weird too.  All of
36098         this is triggered by SIZEOF (.got.plt) being evaluated wrongly as
36099         zero.  Fix it by taking into account the action of
36100         lang_reset_memory_regions during relaxation.
36101
36102                 * ldexp.c (fold_name <SIZEOF>): Use rawsize if size has been reset.
36103                 * ldlang.c (lang_size_sections_1): Don't reset processed_vma here.
36104                 * testsuite/ld-i386/pie1.d: Adjust to suit.
36105                 * testsuite/ld-x86-64/pr20830a.d: Likewise.
36106                 * testsuite/ld-x86-64/pr20830b.d: Likewise.
36107                 * testsuite/ld-x86-64/pr21038a.d: Likewise.
36108                 * testsuite/ld-x86-64/pr21038b.d: Likewise.
36109                 * testsuite/ld-x86-64/pr21038c.d: Likewise.
36110
36111 2022-06-27  GDB Administrator  <gdbadmin@sourceware.org>
36112
36113         Automatic date update in version.in
36114
36115 2022-06-26  GDB Administrator  <gdbadmin@sourceware.org>
36116
36117         Automatic date update in version.in
36118
36119 2022-06-25  Fangrui Song  <i@maskray.me>
36120
36121         arm: Define elf_backend_extern_protected_data to 0 [PR 18705]
36122         Similar to commit 4fb55bf6a9606eb7b626c30a9f4e71d6c2d4fbb2 for aarch64.
36123
36124         Commit b68a20d6675f1360ea4db50a9835c073675b9889 changed ld to produce
36125         R_ARM_GLOB_DAT but that defeated the purpose of protected visibility
36126         as an optimization.  Restore the previous behavior (which matches
36127         ld.lld) by defining elf_backend_extern_protected_data to 0.
36128
36129 2022-06-25  Tom Tromey  <tom@tromey.com>
36130
36131         Fix corrupt DWARF in dw2-double-set-die-type
36132         The dw2-double-set-die-type.exp test case caused an AddressSanitizer
36133         failure in the new DWARF scanner.
36134
36135         The immediate cause was bad DWARF in the test -- in particular, the
36136         the sibling attribute here:
36137
36138              <2><181>: Abbrev Number: 33 (DW_TAG_subprogram)
36139                 <182>   DW_AT_external    : 1
36140                 <183>   DW_AT_name        : address
36141                 <18b>   DW_AT_type        : <0x171>
36142                 <18f>   DW_AT_declaration : 1
36143                 <190>   DW_AT_sibling     : <0x1a1>
36144             ...
36145              <1><1a1>: Abbrev Number: 23 (DW_TAG_pointer_type)
36146                 <1a2>   DW_AT_byte_size   : 4
36147                 <1a3>   DW_AT_type        : <0x1a7>
36148
36149         ...points to a "sibling" DIE that is at a different child depth.
36150
36151         Because this test case doesn't really require sibling attributes, this
36152         patch fixes the problem by removing them from the test.
36153
36154         Note that gdb is not generally robust against malformed DWARF.
36155         Detecting and compensating for this problem would probably be
36156         expensive and, IMO, is better left to some (still hypothetical) DWARF
36157         linter.
36158
36159 2022-06-25  Tom Tromey  <tom@tromey.com>
36160
36161         Fix end of CU calculation in cooked_indexer::index_dies
36162         cooked_indexer::index_dies incorrect computes the end of the current
36163         CU in the .debug_info.  This isn't readily testable without writing
36164         intentionally corrupt DWARF, but it's apparent through observation: it
36165         is currently based on 'info_ptr', which does not always point to the
36166         start of the CU.  This patch fixes the expression.  Tested on x86-64
36167         Fedora 34.
36168
36169 2022-06-25  Tiezhu Yang  <yangtiezhu@loongson.cn>
36170
36171         gdb: LoongArch: Implement loongarch_linux_syscall_next_pc()
36172         When FRAME is at a syscall instruction, return the PC of the next
36173         instruction to be executed.
36174
36175         gdb: LoongArch: Define register numbers and clean up code
36176         This commit defines register numbers of various important registers,
36177         we can use them directly in the related code, and also clean up some
36178         code to make them more clear and readable.
36179
36180 2022-06-25  GDB Administrator  <gdbadmin@sourceware.org>
36181
36182         Automatic date update in version.in
36183
36184 2022-06-24  Pedro Alves  <pedro@palves.net>
36185
36186         Eliminate TUI/CLI observers duplication
36187         For historical reasons, the CLI and the TUI observers are basically
36188         exact duplicates, except for the downcast:
36189
36190          cli:
36191                struct cli_interp *cli = as_cli_interp (interp);
36192          tui:
36193                struct interp *tui = as_tui_interp (interp);
36194
36195         and how they get at the interpreter's ui_out:
36196
36197          cli:
36198                cli->cli_uiout
36199          tui:
36200                tui->interp_ui_out ()
36201
36202         Since interp_ui_out() is a virtual method that also works for the CLI
36203         interpreter, and, both the CLI and the TUI interpreters inherit from
36204         the same base class (cli_interp_base), we can convert the CLI
36205         observers to cast to cli_interp_base instead and use interp_ui_out()
36206         too.  With that, the CLI observers will work for the TUI interpreter
36207         as well.  This lets us completely eliminate the TUI observers.  That's
36208         what this commit does.
36209
36210         Change-Id: Iaf6cf12dfa200ed3ab203a895a72b69dfedbd6e0
36211
36212 2022-06-24  Pedro Alves  <pedro@palves.net>
36213
36214         Revert "Delete delete_thread_silent"
36215         Turns out we'll be gaining a new use of this function very soon, the
36216         incoming AMDGPU port needs it.  Let's add it back, as it isn't really
36217         hurting anything.
36218
36219         This reverts commit 39b8a8090ed7e8967ceca3655aa5f3a2ae91219d.
36220
36221 2022-06-24  Yvan Roux  <yvan.roux@foss.st.com>
36222
36223         gdb/arm: Update the value of active sp when base sp changes
36224         For Arm Cortex-M33 with security extensions, there are 4 different
36225         stacks pointers (msp_s, msp_ns, psp_s, psp_ns).
36226         When plain "sp" is updated during unwinding of the stack, the active
36227         stack pointer of the 4 stack pointers needs to be kept in sync.
36228
36229 2022-06-24  Andrew Burgess  <aburgess@redhat.com>
36230
36231         gdb/testsuite: remove unneeded calls to get_compiler_info
36232         It is not necessary to call get_compiler_info before calling
36233         test_compiler_info, and, after recent commits that removed setting up
36234         the gcc_compiled, true, and false globals from get_compiler_info,
36235         there is now no longer any need for any test script to call
36236         get_compiler_info directly.
36237
36238         As a result every call to get_compiler_info outside of lib/gdb.exp is
36239         redundant, and this commit removes them all.
36240
36241         There should be no change in what is tested after this commit.
36242
36243 2022-06-24  Andrew Burgess  <aburgess@redhat.com>
36244
36245         gdb/testsuite: remove global gcc_compiled from gdb.exp
36246         After this commit the gcc_compiled global is no longer exported from
36247         lib/gdb.exp.  In theory we could switch over all uses of gcc_compiled
36248         to instead call test_compiler_info directly, however, I have instead
36249         added a new proc to gdb.exp: 'is_c_compiler_gcc'.  I've then updated
36250         the testsuite to call this proc instead of using the global.
36251
36252         Having a new proc specifically for this task means that we have a
36253         single consistent pattern for detecting gcc.  By wrapping this logic
36254         within a proc that calls test_compiler_info, rather than using the
36255         global, means that test scripts don't need to call get_compiler_info
36256         before they read the global, simply calling the new proc does
36257         everything in one go.
36258
36259         As a result I've been able to remove the get_compiler_info calls from
36260         all the test scripts that I've touched in this commit.
36261
36262         In some of the tests e.g. gdb.dwarf2/*.exp, the $gcc_compiled flag was
36263         being checked at the top of the script to decide if the whole script
36264         should be skipped or not.  In these cases I've called the new proc
36265         directly and removed all uses of gcc_compiled.
36266
36267         In other cases, e.g. most of the gdb.base scripts, there were many
36268         uses of gcc_compiled.  In these cases I set a new global gcc_compiled
36269         near the top of the script, and leave the rest of the script
36270         unchanged.
36271
36272         There should be no changes in what is tested after this commit.
36273
36274 2022-06-24  Pedro Alves  <pedro@palves.net>
36275
36276         Include count of unexpected core files in gdb.sum summary
36277         If GDB, GDBserver, a testcase program, Valgrind, etc. unexpectedly
36278         crash while running the GDB testsuite, and you've setup your machine
36279         such that core files are dumped in the current directory instead of
36280         being shoved somewhere by abrt, apport, or similar (as you should for
36281         proper GDB testing), you'll end up with an unexpected core file in the
36282         $build/gdb/testsuite/ directory.
36283
36284         It can happen that GDB, GDBserver, etc. even crashes _after_ gdb_exit,
36285         during teardown, and thus such a crash won't be noticed by looking at
36286         the gdb.sum file at all.  This commit aims at improving that, by
36287         including a new "unexpected core files" line in the testrun summary.
36288
36289         For example, here's what I get on x86-64 Ubuntu 20.04, with this
36290         patch:
36291
36292                          === gdb Summary ===
36293
36294          # of unexpected core files      12          << new info
36295          # of expected passes            107557
36296          # of unexpected failures        35
36297          # of expected failures          77
36298          # of unknown successes          2
36299          # of known failures             114
36300          # of untested testcases         31
36301          # of unsupported tests          139
36302
36303         I have my core pattern setup like this:
36304
36305          $ cat /proc/sys/kernel/core_pattern
36306          core.%e.%p.%h.%t
36307
36308         That's:
36309
36310          %e: executable filename
36311          %p: pid
36312          %h: hostname
36313          %t: UNIX time of dump
36314
36315         and so I get these core files:
36316
36317          $ ls -1 testsuite/core.*
36318          testsuite/core.connect-with-no.216191.nelson.1656002431
36319          testsuite/core.connect-with-no.217729.nelson.1656002431
36320          testsuite/core.gdb.194247.nelson.1656002423
36321          testsuite/core.gdb.226014.nelson.1656002435
36322          testsuite/core.gdb.232078.nelson.1656002438
36323          testsuite/core.gdb.352268.nelson.1656002441
36324          testsuite/core.gdb.4152093.nelson.1656002337
36325          testsuite/core.gdb.4154515.nelson.1656002338
36326          testsuite/core.gdb.4156668.nelson.1656002339
36327          testsuite/core.gdb.4158871.nelson.1656002341
36328          testsuite/core.gdb.468495.nelson.1656002444
36329          testsuite/core.vgdb.4192247.nelson.1656002366
36330
36331         where we can see that GDB crashed a number of times, but also
36332         Valgrind's vgdb, and a couple testcase programs.  Neither of which is
36333         good.
36334
36335         If your core_pattern is just "core" (but why??), then I guess that you
36336         may end up with just a single core file in testsuite/.  Still, that is
36337         one core file too many.
36338
36339         Above, we see a couple cores for "connect-with-no", which are the
36340         result of gdb.server/connect-with-no-symbol-file.exp.  This is a case
36341         mentioned above -- while the program crashed, that happens during
36342         testcase teardown, and it goes unnoticed (without this commit) by
36343         gdb.sum results.  Vis:
36344
36345          $ make check TESTS="gdb.server/connect-with-no-symbol-file.exp"
36346          ...
36347                          === gdb Summary ===
36348
36349          # of unexpected core files      2
36350          # of expected passes            8
36351
36352          ...
36353          $
36354
36355         The tests fully passed, but still the testcase program crashed
36356         somehow:
36357
36358          $ ls -1 testsuite/core.*
36359          testsuite/core.connect-with-no.941561.nelson.1656003317
36360          testsuite/core.connect-with-no.941682.nelson.1656003317
36361
36362         Against --target_board=native-extended-gdbserver it's even worse.  I
36363         get:
36364
36365          # of unexpected core files      26
36366
36367         and note that when GDBserver hits an assertion failure, it exits with
36368         error, instead of crashing with SIGABRT.  I think that should be
36369         changed, at least on development builds, but that would be for another
36370         patch.  After such patch, I suspect the number of unexpected cores
36371         will be higher, as there are likely teardown GDBserver assertions that
36372         we're not noticing.
36373
36374         I decided to put this new info in the "gdb Summary" section, as that's
36375         a place people already are used to looking at, either when looking at
36376         the tail of gdb.sum, or when diffing gdb.sum files, and we've already
36377         extended this section before, to include the count of DUPLICATE and
36378         PATH problems, so there's precedent.
36379
36380         Implementation-wise, the new line is appended after DejaGnu is
36381         finished, with a shell script that is invoked by the Makefile.  It is
36382         done this way so that serial and parallel testing work the same way.
36383         My initial cut at an implementation was in TCL, straight in
36384         testsuite/lib/check-test-names.exp, where DUPLICATES and PATH are
36385         handled, like so:
36386
36387          @@ -148,6 +159,10 @@ namespace eval ::CheckTestNames {
36388                      $counts(paths,$which)
36389                  maybe_show_count "# of duplicate test names\t" \
36390                      $counts(duplicates,$which)
36391          +
36392          +       set cores [glob -nocomplain -directory $::objdir core*]
36393          +       maybe_show_count "# of unexpected core files\t" \
36394          +           [llength $cores]
36395               }
36396
36397         But that would only work for serial testing, as in parallel testing,
36398         the final gdb.sum is generated by aggregating the results of all the
36399         individual gdb.sum files, and dg-extract-results.sh doesn't know about
36400         our new summary line.  And I don't think that dg-extract-results.sh
36401         should be taught about it, since the count of core files is not
36402         something that we want to count many times, once per testcase, and
36403         then add up the subcounts at the end.  Every time we count the core
36404         files, we're already counting the final count.
36405
36406         I considered using the Tcl implementation in serial mode, and the
36407         script approach for parallel testing, but that has the obvious
36408         downside of implementing and maintaining the same thing twice.  In the
36409         end, I settled on the script approach for serial mode too, which
36410         requires making the "check-single" rule print the tail end of the
36411         gdb.sum file, with a side effect being that if you look at the
36412         terminal after a run (instead of at the gdb.sum file), you'll see the
36413         "gdb Summary" section twice, once without the unexpected core lines
36414         printed, and then another with.  IMO, this isn't an issue; when
36415         testing in parallel mode, if you look at the terminal after "make -jN
36416         check", you'll also see multiple "gdb Summary" sections printed.
36417
36418         Change-Id: I190b8d41856d49ad143854b6e3e6ccd7caa04491
36419
36420 2022-06-24  Pedro Alves  <pedro@palves.net>
36421
36422         Improve core file path detection & put cores in output dir
36423         After a testrun, I noticed that I have some kernel-produced cores for
36424         testcase programs, under build/gdb/testsuite/, which shouldn't be
36425         there:
36426
36427          $ ls -1 testsuite/core.*
36428          testsuite/core.annota1.1274351.nelson.1656004407
36429          testsuite/core.annota3.1288474.nelson.1656004414
36430          testsuite/core.exitsignal.1240674.nelson.1656004391
36431
36432         I have my core pattern setup like this:
36433
36434          $ cat /proc/sys/kernel/core_pattern
36435          core.%e.%p.%h.%t
36436
36437         That's:
36438
36439          %e: executable filename
36440          %p: pid
36441          %h: hostname
36442          %t: UNIX time of dump
36443
36444         so it's easy to tell which program produced the core from the core
36445         file name.
36446
36447         From above, we can tell that the corresponding testcases are
36448         gdb.base/annota1.exp, gdb.base/annota3.exp and
36449         gdb.base/exitsignal.exp.
36450
36451         At least gdb.base/annota1.exp and gdb.base/annota3.exp have code in
36452         them to delete the core file.  However, that isn't working for me,
36453         because said code only looks for cores named exactly either "core" or
36454         "core.PID", and my core_pattern doesn't match that.
36455
36456         Another issue I noticed, is that I have not been running
36457         gdb.base/bigcore.exp, for a similar reason.  I get:
36458
36459           Program terminated with signal SIGABRT, Aborted.
36460           The program no longer exists.
36461           (gdb) PASS: gdb.base/bigcore.exp: signal SIGABRT
36462           UNTESTED: gdb.base/bigcore.exp: can't generate a core file
36463
36464         But I actually have a core file under the testcase's output dir:
36465
36466          $ find . -name "core.*"
36467          ./testsuite/outputs/gdb.base/bigcore/core.bigcore.2306705.nelson.1656005213
36468          $
36469
36470         This commit fixes these things, by adding a find_core_file routine
36471         that searches core files in a way that works with my core pattern as
36472         well.  This then also adds a convenience remove_core routine as a
36473         wrapper around find_core_file that removes the found core file.
36474
36475         In addition, it changes some testcases that expect to have their
36476         program dump core, to switch the inferior's cwd to the testcase's
36477         output dir, so that the core is dumped there instead of in
36478         build/gdb/testsuite/.  Some testcases were already doing that, but not
36479         all.  The idea is that any core file dumped in build/gdb/testsuite/ is
36480         an unexpected core file.  The next patch will add a count of such
36481         unexpected core files to gdb.sum.
36482
36483         Another change is that the directory changing is now done with "set
36484         cwd" instead of with "cd".  "set cwd" only affects the inferior cwd,
36485         while "cd" affects GDB's cwd too.  By using "set cwd" instead of "cd",
36486         if GDB dumps core in these testcases, the GDB core dump will still end
36487         up in build/gdb/testsuite/, and can thus be detected as an unexpected
36488         core.
36489
36490         Change-Id: I45068f21ffd4814350aaa8a3cc65cad5e3107607
36491
36492 2022-06-24  Andrew Burgess  <aburgess@redhat.com>
36493
36494         gdb: make use of RAII in run_inferior_call
36495         In passing I noticed that there are three local variables in
36496         run_inferior_call that are used to save, and then restore some state,
36497         I think these could all be replaced with a RAII style scoped_restore
36498         instead.
36499
36500         Of the three locals that I've changed, the only one that I believe is
36501         now restored in a different location is ui::async, before this commit
36502         the async field was restored after a call to either delete_file_handle
36503         or ui_register_input_event_handler, and after this commit, the field
36504         is restored before these calls.  However, I don't believe that either
36505         of these functions depend on the value of the async field, so I
36506         believe the commit is fine.
36507
36508         Tested on x86-64/Linux passes with no regressions.
36509
36510 2022-06-24  Pedro Alves  <pedro@palves.net>
36511
36512         Delete delete_thread_silent
36513         delete_thread_silent is no longer used anywhere.  Delete it.
36514
36515         Change-Id: Iafcec12339861d5ab2e29c14d7b1f884c9e11c0f
36516
36517 2022-06-24  GDB Administrator  <gdbadmin@sourceware.org>
36518
36519         Automatic date update in version.in
36520
36521 2022-06-23  Tom Tromey  <tromey@adacore.com>
36522
36523         Don't declare cli_set_logging
36524         cli_set_logging is declared but not defined.  It's probably a leftover
36525         from whenever interpreters were changed to use inheritance.  This
36526         patch removes the declaration.  Tested by grep and rebuilding.
36527
36528         Use PyBool_FromLong
36529         I noticed a few spots that were explicitly creating new references to
36530         Py_True or Py_False.  It's simpler here to use PyBool_FromLong, so
36531         this patch changes all the places I found.
36532
36533 2022-06-23  Alan Modra  <amodra@gmail.com>
36534
36535         PowerPC64: fix assertion in ppc_build_one_stub with -Os code
36536         save_res stubs aren't written in ppc_build_one_stub, their offsets
36537         (which are zero) should not be checked.
36538
36539                 * elf64-ppc.c (ppc_build_one_stub): Don't check save_res offsets.
36540
36541 2022-06-23  Alan Modra  <amodra@gmail.com>
36542
36543         Re: PowerPC64: stub debug dump
36544         Let's show the current stub as well as the previous one.  Of interest
36545         is the current offset and a new field, id.  Check that the build
36546         hash table traversal is in the same order as sizing traversal too.
36547
36548                 * elf64-ppc.c (struct ppc_stub_hash_entry): Add id.
36549                 (struct ppc_link_hash_table): Add stub_id.
36550                 (stub_hash_newfunc): Init id and symtype.
36551                 (dump_stub): New function, extracted from..
36552                 (dump_previous_stub): ..here.  Deleted.
36553                 (ppc_build_one_stub): Sanity check stub id as well as offset.
36554                 Show current stub as well as previous.
36555                 (ppc_size_one_stub): Set stub id.
36556                 (ppc64_elf_size_stubs): Init stub_id before traversal.
36557                 (ppc64_elf_build_stubs): Likewise.
36558
36559 2022-06-23  Fangrui Song  <maskray@google.com>
36560
36561         aarch64: Allow PC-relative relocations against protected STT_FUNC for -shared
36562             __attribute__((visibility("protected"))) void *foo() {
36563               return (void *)foo;
36564             }
36565
36566         gcc -fpic -shared -fuse-ld=bfd fails with the confusing diagnostic:
36567
36568             relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `foo' which may bind externally can not be used when making a shared object; recompile with -fPIC
36569
36570         Call _bfd_elf_symbol_refs_local_p with local_protected==true to suppress
36571         the error.  The new behavior matches gold and ld.lld.
36572
36573         Note: if some code tries to use direct access relocations to take the
36574         address of foo (likely due to -fno-pic), the pointer equality will
36575         break, but the error should be reported on the executable link, not on
36576         the innocent shared object link.  glibc 2.36 will give a warning at
36577         relocation resolving time.
36578
36579 2022-06-23  Fangrui Song  <maskray@google.com>
36580
36581         aarch64: Define elf_backend_extern_protected_data to 0 [PR 18705]
36582         Follow-up to commit 90b7a5df152a64d2bea20beb438e8b81049a5c30
36583         ("aarch64: Disallow copy relocations on protected data").
36584
36585         Commit 32f573bcb3aaa1c9defcad79dbb5851fcc02ae2d changed ld to produce
36586         R_AARCH64_GLOB_DAT but that defeated the purpose of protected visibility
36587         as an optimization.  Restore the previous behavior (which matches
36588         ld.lld) by defining elf_backend_extern_protected_data to 0.
36589
36590 2022-06-23  GDB Administrator  <gdbadmin@sourceware.org>
36591
36592         Automatic date update in version.in
36593
36594 2022-06-22  Tom Tromey  <tromey@adacore.com>
36595
36596         Use std::string for interpreter_p
36597         The global interpreter_p is a manually-managed 'char *'.  This patch
36598         changes it to be a std::string instead, and removes some erroneous
36599         comments.
36600
36601         Move mi_interpreter to mi-interp.h
36602         I noticed that touching interps.h caused a lot of recompilation.  I
36603         tracked this down to mi-common.h including this file.  This patch
36604         moves the MI interpreter to mi-interp.h, which cuts down on
36605         recompilation when modifying interps.h.
36606
36607         Use unique_xmalloc_ptr in interp
36608         This changes interp::m_name to be a unique_xmalloc_ptr, removing some
36609         manual memory management.  It also cleans up the initialization of the
36610         'inited' member, and moves the 'private:' and 'public:' keywords to
36611         their proper spots.
36612
36613 2022-06-22  Fangrui Song  <i@maskray.me>
36614
36615         aarch64: Disallow copy relocations on protected data
36616         If an executable has copy relocations for extern protected data, that
36617         can only work if the shared object containing the definition is built
36618         with assumptions (a) the compiler emits GOT-generating relocations (b)
36619         the linker produces R_*_GLOB_DAT instead of R_*_RELATIVE.  Otherwise the
36620         shared object uses its own definition directly and the executable
36621         accesses a stale copy.  Note: the GOT relocations defeat the purpose of
36622         protected visibility as an optimization, and it turns out this never
36623         worked perfectly.
36624
36625         glibc 2.36 will warn on copy relocations on protected data.  Let's
36626         produce a warning at link time, matching ld.lld which has been used on
36627         many aarch64 OSes.
36628
36629         Note: x86 requires GNU_PROPERTY_NO_COPY_ON_PROTECTED to have the error.
36630         This is to largely due to GCC 5's "x86-64: Optimize access to globals in
36631         PIE with copy reloc" which started to use direct access relocations for
36632         external data symbols in -fpie mode.
36633
36634         GCC's aarch64 port does not have the change.  Nowadays with most builds
36635         switching to -fpie/-fpic, aarch64 mostly doesn't need to worry about
36636         copy relocations.  So for aarch64 we simply don't check
36637         GNU_PROPERTY_NO_COPY_ON_PROTECTED.
36638
36639 2022-06-22  Kumar N, Bhuvanendra  <Kavitha.Natarajan@amd.com>
36640
36641         Binutils support for split-dwarf and dwarf-5
36642                 * dwarf.c (fetch_indexed_string): Added new parameter
36643                 str_offsets_base to calculate the string offset.
36644                 (read_and_display_attr_value): Read DW_AT_str_offsets_base
36645                 attribute.
36646                 (process_debug_info): While allocating memory and initializing
36647                 debug_information, do it for do_debug_info also, if its true.
36648                 (load_separate_debug_files): Load .debug_str_offsets if exists.
36649                 * dwarf.h (struct debug_info): Add str_offsets_base field.
36650
36651 2022-06-22  Nelson Chu  <nelson.chu@sifive.com>
36652
36653         RISC-V: Reorder the prefixed extensions which are out of order.
36654         This patch has been pending for almost a year...  However, I noticed that
36655         llvm can already re-order the extensions, even if they are out of orders.
36656         Not really sure if they can also re-order the single letter extensions,
36657         but at least we can do this for the multi-letter extensions in binutils.
36658
36659         bfd/
36660             * elfxx-riscv.c (riscv_parse_prefixed_ext): Removed the code which are
36661             used to check the prefixed extension orders.
36662         gas/
36663             * testsuite/gas/riscv/march-fail-order-x-z.d: Removed since we will help
36664             tp reorder the prefixed extensions for now.
36665             * testsuite/gas/riscv/march-fail-order-x-z.l: Likewise.
36666             * testsuite/gas/riscv/march-fail-order-x.d: Likewise.
36667             * testsuite/gas/riscv/march-fail-order-x.l: Likewise.
36668             * testsuite/gas/riscv/march-fail-order-z.d: Likewise.
36669             * testsuite/gas/riscv/march-fail-order-z.l: Likewise.
36670
36671 2022-06-22  Nelson Chu  <nelson.chu@sifive.com>
36672
36673         RISC-V: Use single h extension to control hypervisor CSRs and instructions.
36674         According to the picture 28.1 in the current ISA spec, h is no larger the
36675         multi-letter extension, it is a single extension after v.  Therefore, this
36676         patch fix the implementation, and use the single h to control hypervisor
36677         CSRs and instructions, which we promised to do before.
36678
36679         bfd/
36680             * elfxx-riscv.c (riscv_supported_std_ext): Added h with version 1.0 after v.
36681             (riscv_supported_std_h_ext): Removed.
36682             (riscv_all_supported_ext): Updated since riscv_supported_std_h_ext is removed.
36683             (riscv_prefix_ext_class): Removed RV_ISA_CLASS_H.
36684             (parse_config): Updated since riscv_prefix_ext_class is removed.
36685             (riscv_recognized_prefixed_ext): Likewise.
36686             (riscv_get_default_ext_version): Likewise.
36687             (riscv_multi_subset_supports): Handle INSN_CLASS_H for hypervisor instructions.
36688             (riscv_multi_subset_supports_ext): Likewise.
36689         gas/
36690             * config/tc-riscv.c (riscv_csr_class): Added CSR_CLASS_H and CSR_CLASS_H_32 for
36691             hypervisor CSRs.
36692             (riscv_csr_address): Likewise.
36693             * testsuite/gas/riscv/csr-version-1p10.d: Updated since hypervisor CSRs are
36694             controlled by single h extension for now.
36695             * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
36696             * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
36697             * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
36698             * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
36699             * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
36700             * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
36701             * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
36702             * testsuite/gas/riscv/h-ext-32.d: Added h to architecture string.
36703             * testsuite/gas/riscv/h-ext-64.d: Likewise.
36704             * testsuite/gas/riscv/march-fail-single-prefix-h: Removed since h is no
36705             longer multi-letter extension.
36706             * testsuite/gas/riscv/march-fail-unknown-h.d: Likewise.
36707         include/
36708             * opcode/riscv-opc.h: Control hypervisor CSRs by h extension, rather than
36709             the privileged spec verisons.
36710             * opcode/riscv.h (riscv_insn_class): Added INSN_CLASS_H.
36711         opcodes/
36712             * riscv-opc.c (riscv_opcodes): Control hypervisor instructions by h extension.
36713
36714 2022-06-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
36715
36716         RISC-V: Add 'H' to canonical extension ordering
36717         This commit adds 'H' to canonical extension ordering based on current
36718         consensus (not officially ratified as a new ISA specification manual
36719         but discussion for software compatibility is made).
36720
36721         bfd/ChangeLog
36722
36723                 * elfxx-riscv.c (riscv_ext_canonical_order): Add 'H' for
36724                 canonical extension ordering based on current consensus.
36725
36726 2022-06-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
36727
36728         RISC-V: Prepare i18n for required ISA extensions
36729         Some strings returned by the riscv_multi_subset_supports_ext function
36730         contain not just extension names but words like "and" and "or".
36731         This commit wraps such strings with the gettext macro (_) for
36732         internationalization in the future.
36733
36734         bfd/ChangeLog:
36735
36736                 * elfxx-riscv.c (riscv_multi_subset_supports_ext): Wrap some
36737                 strings with the gettext macro to prepare future i18n.
36738
36739 2022-06-22  Tsukasa OI  <research_trasio@irq.a4lg.com>
36740
36741         RISC-V: Fix inconsistent error message (range)
36742         This commit fixes inconsistent error message format involving compressed
36743         funct<n> fields.  In specific, funct6 had an error message with range
36744         0..2^<n> ("0..64") unlike other funct<n> fields with 0..2^<n>-1
36745         (e.g. funct4 with "0..15").
36746
36747         gas/ChangeLog:
36748
36749                 * config/tc-riscv.c (riscv_ip): Fix inconsistent error message.
36750
36751 2022-06-22  Marcus Nilsson  <brainbomb@gmail.com>
36752
36753         readelf: replace xmalloc with malloc in slurp_relr_relocs
36754         Using xmalloc makes the null check redundant since failing allocation
36755         will exit the program. Instead use malloc and let the error be
36756         conveyed up the call chain.
36757
36758 2022-06-22  Alan Modra  <amodra@gmail.com>
36759
36760         PowerPC64: stub debug dump
36761         powerpc64le-linux-ld is failing the assertion in ppc_build_one_stub,
36762         again apparently, which means a stub will overwrite the tail of a
36763         previous stub.  The difficulty with debugging these issues is that
36764         it's not a problem with the stub that triggers the assertion, but the
36765         previous stub in that section.  This patch keeps track of the last
36766         stub and adds a debug dump.  Hopefully that will help.
36767
36768                 * elf64-ppc.c (enum _ppc64_sec_type): Add sec_stub.
36769                 (struct _ppc64_elf_section_data): Add u.last_ent.
36770                 (dump_previous_stub): New function.
36771                 (ppc_build_one_stub): Keep track of previous stub, and dump it
36772                 when finding an overlapping stub.
36773
36774 2022-06-22  Alan Modra  <amodra@gmail.com>
36775
36776         PR29270, DW_FORM_udata signed output
36777                 PR 29270
36778                 * dwarf.c (read_and_display_attr_value): Output DW_FORM_udata
36779                 as unsigned.
36780
36781 2022-06-22  GDB Administrator  <gdbadmin@sourceware.org>
36782
36783         Automatic date update in version.in
36784
36785 2022-06-21  Nick Alcock  <nick.alcock@oracle.com>
36786
36787         ld: regenerate configure after recent misgeneration
36788         Things work again after this.
36789
36790         ld/ChangeLog:
36791
36792                 * configure: Regenerate.
36793
36794 2022-06-21  Nick Alcock  <nick.alcock@oracle.com>
36795
36796         libctf: tests: prune warnings from compiler output
36797         We were failing to call prune_warnings appropriately, leading to
36798         false-positive test failures on some platforms (observed on
36799         sparclinux).
36800
36801         libctf/ChangeLog:
36802
36803                 * testsuite/lib/ctf-lib.exp: Prune warnings from compiler and
36804                 linker output.
36805                 * testsuite/libctf-regression/libctf-repeat-cu.exp: Likewise,
36806                 and ar output too.
36807
36808 2022-06-21  Nick Alcock  <nick.alcock@oracle.com>
36809
36810         libctf: avoid mingw warning
36811         A missing paren led to an intended cast to avoid dependence on the size
36812         of size_t in one argument of ctf_err_warn applying to the wrong type by
36813         mistake.
36814
36815         libctf/ChangeLog:
36816
36817                 * ctf-serialize.c (ctf_write_mem): Fix cast.
36818
36819 2022-06-21  Nick Alcock  <nick.alcock@oracle.com>
36820
36821         libctf: fix linking together multiple objects derived from the same source
36822         Right now, if you compile the same .c input repeatedly with CTF enabled
36823         and different compilation flags, then arrange to link all of these
36824         together, then things misbehave in various ways.  libctf may conflate
36825         either inputs (if the .o files have the same name, say if they are
36826         stored in different .a archives), or per-CU outputs when conflicting
36827         types are found: the latter can lead to entirely spurious errors when
36828         it tries to produce multiple per-CU outputs with the same name
36829         (discarding all but the last, but then looking for types in the earlier
36830         ones which have just been thrown away).
36831
36832         Fixing this is multi-pronged.  Both inputs and outputs need to be
36833         differentiated in the hashtables libctf keeps them in: inputs with the
36834         same cuname and filename need to be considered distinct as long as they
36835         have different associated CTF dicts, and per-CU outputs need to be
36836         considered distinct as long as they have different associated input
36837         dicts.  Right now there is nothing tying the two together other than the
36838         CU name: fix this by introducing a new field in the ctf_dict_t named
36839         ctf_link_in_out, which (for input dicts) points to the associated per-CU
36840         output dict (if any), and for output dicts points to the associated
36841         input dict.  At creation time the name used is completely arbitrary:
36842         it's only important that it be distinct if CTF dicts are distinct.  So,
36843         when a clash is found, adjust the CU name by sticking the number of
36844         elements in the input on the end.  At output time, the CU name will
36845         appear in the linked object, so it matters a little more that it look
36846         slightly less ugly: in conflicting cases, append an incrementing
36847         integer, starting at 0.
36848
36849         This naming scheme is not very helpful, but it's hard to see what else
36850         we can do.  The input .o name may be the same.  The input .a name is not
36851         even visible to ctf_link, and even *that* might be the same, because
36852         .a's can contain many members with the same name, all of which
36853         participate in the link.  All we really know is that the two have
36854         distinct dictionaries with distinct types in them, and at least this way
36855         they are all represented, any any symbols, variables etc referring to
36856         those types are accurately stored.
36857
36858         (As a side-effect this also fixes a use-after-free and double-free when
36859         errors are found during variable or symbol emission.)
36860
36861         Use the opportunity to prevent a couple of sources of problems, to wit
36862         changing the active CU mappings when a link has already been done
36863         (no effect on ld, which doesn't use CU mappings at all), and causing
36864         multiple consecutive ctf_link's to have the same net effect as just
36865         doing the last one (no effect on ld, which only ever does one
36866         ctf_link) rather than having the links be a sort of half-incremental
36867         not-really-intended mess.
36868
36869         libctf/ChangeLog:
36870
36871                 PR libctf/29242
36872                 * ctf-impl.h (struct ctf_dict) [ctf_link_in_out]: New.
36873                 * ctf-dedup.c (ctf_dedup_emit_type): Set it.
36874                 * ctf-link.c (ctf_link_add_ctf_internal): Set the input
36875                 CU name uniquely when clashes are found.
36876                 (ctf_link_add): Document what repeated additions do.
36877                 (ctf_new_per_cu_name): New, come up with a consistent
36878                 name for a new per-CU dict.
36879                 (ctf_link_deduplicating): Use it.
36880                 (ctf_create_per_cu): Use it, and ctf_link_in_out, and set
36881                 ctf_link_in_out properly.  Don't overwrite per-CU dicts with
36882                 per-CU dicts relating to different inputs.
36883                 (ctf_link_add_cu_mapping): Prevent per-CU mappings being set up
36884                 if we already have per-CU outputs.
36885                 (ctf_link_one_variable): Adjust ctf_link_per_cu call.
36886                 (ctf_link_deduplicating_one_symtypetab): Likewise.
36887                 (ctf_link_empty_outputs): New, delete all the ctf_link_outputs
36888                 and blank out ctf_link_in_out on the corresponding inputs.
36889                 (ctf_link): Clarify the effect of multiple ctf_link calls.
36890                 Empty ctf_link_outputs if it already exists rather than
36891                 having the old output leak into the new link.  Fix a variable
36892                 name.
36893                 * testsuite/config/default.exp (AR): Add.
36894                 (OBJDUMP): Likewise.
36895                 * testsuite/libctf-regression/libctf-repeat-cu.exp: New test.
36896                 * testsuite/libctf-regression/libctf-repeat-cu*: Main program,
36897                 library, and expected results for the test.
36898
36899 2022-06-21  Kevin Buettner  <kevinb@redhat.com>
36900
36901         Document how GDB searches for files when using -s, -e, and -se options
36902         GDB's documentation of the 'file' command says:
36903
36904             If you do not specify a directory and the file is not found in the
36905             GDB working directory, GDB uses the environment variable PATH as a
36906             list of directories to search, just as the shell does when looking
36907             for a program to run.
36908
36909         The same is true for files specified via commandline options -s, -e,
36910         and -se.
36911
36912         This commit adds a cross reference to the file command for these options.
36913
36914 2022-06-21  Nick Clifton  <nickc@redhat.com>
36915
36916         Binutils support for dwarf-5 (location and range lists related)
36917                 * dwarf.h (struct debug_info): Add rnglists_base field.
36918                 * dwarf.c (read_and_display_attr_value): Read attribute DW_AT_rnglists_base.
36919                 (display_debug_rnglists_list): While handling DW_RLE_base_addressx,
36920                 DW_RLE_startx_endx, DW_RLE_startx_length items, pass the proper parameter
36921                 value to fetch_indexed_addr(), i.e. fetch the proper entry in .debug_addr section.
36922                 (display_debug_ranges): Add rnglists_base to the .debug_rnglists base address.
36923                 (load_separate_debug_files): Load .debug_addr section, if exists.
36924
36925         Default to disabling the linker warnings about execstack and RWX segments if the target is the HPPA architecture.
36926                 PR 29263
36927                 * configure.ac (ac_default_ld_warn_execstack): Default to 'no' for
36928                 HPPA targets.
36929                 (ac_default_ld_warn_rwx_segments): Likewise.
36930                 * configure: Regenerate.
36931                 * testsuite/ld-elf/elf.exp: Add the --warn-execstack command line
36932                 option to the command line when running execstack tests for the
36933                 HPPA target.
36934
36935 2022-06-21  GDB Administrator  <gdbadmin@sourceware.org>
36936
36937         Automatic date update in version.in
36938
36939 2022-06-20  Tom Tromey  <tromey@adacore.com>
36940
36941         Move finish_print out of value_print_options
36942         'finish_print' does not really belong in value_print_options -- this
36943         is consulted only when deciding whether or not to print a value, and
36944         never during the course of printing.  This patch removes it from the
36945         structure and makes it a static global in infcmd.c instead.
36946
36947         Tested on x86-64 Fedora 34.
36948
36949 2022-06-20  Alan Modra  <amodra@gmail.com>
36950
36951         PR29262, memory leak in pr_function_type
36952                 PR 29262
36953                 * prdbg.c (pr_function_type): Free "s" on failure path.
36954
36955         PR29261, memory leak in parse_stab_struct_fields
36956                 PR 29261
36957                 * stabs.c (parse_stab_struct_fields): Free "fields" on failure path.
36958
36959 2022-06-20  GDB Administrator  <gdbadmin@sourceware.org>
36960
36961         Automatic date update in version.in
36962
36963 2022-06-19  GDB Administrator  <gdbadmin@sourceware.org>
36964
36965         Automatic date update in version.in
36966
36967 2022-06-18  Tom Tromey  <tom@tromey.com>
36968
36969         Fix assertion failure in copy_type
36970         PR exp/20630 points out a simple way to cause an assertion failure in
36971         copy_type -- but this was found in the wild a few times as well.
36972
36973         copy_type only works for objfile-owned types, but there isn't a deep
36974         reason for this.  This patch fixes the bug by updating copy_type to
36975         work for any sort of type.
36976
36977         Better would perhaps be to finally implement type GC, but I still
36978         haven't attempted this.
36979
36980         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20630
36981
36982 2022-06-18  Tomoaki Kawada  <kawada@kmckk.co.jp>
36983
36984         Fix the sorting algorithm for reloc entries
36985         The optimized insertion sort algorithm in `elf_link_adjust_relocs`
36986         incorrectly assembled "runs" from unsorted entries and inserted them to an
36987         already-sorted prefix, breaking the loop invariants of insertion sort.
36988         This commit updates the run assembly loop to break upon encountering a
36989         non-monotonic change in the sort key.
36990
36991                 PR 29259
36992         bfd/
36993                 * elflink.c (elf_link_adjust_relocs): Ensure run being inserted
36994                 is sorted.
36995         ld/
36996                 * testsuite/ld-elf/pr29259.d,
36997                 * testsuite/ld-elf/pr29259.s,
36998                 * testsuite/ld-elf/pr29259.t: New test.
36999
37000 2022-06-18  Enze Li  <enze.li@hotmail.com>
37001
37002         gdb/python: Export nibbles to python layer
37003         This patch makes it possible to allow Value.format_string() to return
37004         nibbles output.
37005
37006         When we set the parameter of nibbles to True, we can achieve the
37007         displaying binary values in groups of every four bits.
37008
37009         Here's an example:
37010           (gdb) py print (gdb.Value (1230).format_string (format='t', nibbles=True))
37011           0100 1100 1110
37012           (gdb)
37013
37014         Note that the parameter nibbles is only useful if format='t' is also used.
37015
37016         This patch also includes update to the relevant testcase and
37017         documentation.
37018
37019         Tested on x86_64 openSUSE Tumbleweed.
37020
37021 2022-06-18  Enze Li  <enze.li@hotmail.com>
37022
37023         gdb/doc: Documentation for the new print command
37024         Document the new command "print nibbles" and add a NEWS entry.
37025
37026 2022-06-18  Enze Li  <enze.li@hotmail.com>
37027
37028         gdb: Add new 'print nibbles' feature
37029         Make an introduction of a new print setting that can be set by 'set
37030         print nibbles [on|off]'.  The default value if OFF, which can be changed
37031         by user manually.  Of course, 'show print nibbles' is also included in
37032         the patch.
37033
37034         The new feature displays binary values by group, with four bits per
37035         group.  The motivation for this work is to enhance the readability of
37036         binary values.
37037
37038         Here's a GDB session before this patch is applied.
37039           (gdb) print var_a
37040           $1 = 1230
37041           (gdb) print/t var_a
37042           $2 = 10011001110
37043
37044         With this patch applied, we can use the new print setting to display the
37045         new form of the binary values.
37046           (gdb) print var_a
37047           $1 = 1230
37048           (gdb) print/t var_a
37049           $2 = 10011001110
37050           (gdb) set print nibbles on
37051           (gdb) print/t var_a
37052           $3 = 0100 1100 1110
37053
37054         Tested on x86_64 openSUSE Tumbleweed.
37055
37056 2022-06-18  GDB Administrator  <gdbadmin@sourceware.org>
37057
37058         Automatic date update in version.in
37059
37060 2022-06-17  Tiezhu Yang  <yangtiezhu@loongson.cn>
37061
37062         gdb: NEWS: Move LoongArch gdbserver to the correct section
37063         commit e5ab6af52d38 ("gdbserver: Add LoongArch/Linux support")
37064         was merged into the master since GDB 12, so we should put the
37065         news in the "Changes since GDB 12" section.
37066
37067         Thanks Tom Tromey for your correction [1], sorry for that.
37068
37069         [1] https://sourceware.org/pipermail/gdb-patches/2022-June/190122.html
37070
37071 2022-06-17  Alan Modra  <amodra@gmail.com>
37072
37073         PR29256, memory leak in obj_elf_section_name
37074         When handling section names in quotes obj_elf_section_name calls
37075         demand_copy_C_string, which puts the name on the gas notes obstack.
37076         Such strings aren't usually freed, since obstack_free frees all more
37077         recently allocated objects as well as its arg.  When handling
37078         non-quoted names, obj_elf_section_name mallocs the name.  Due to the
37079         mix of allocation strategies it isn't possible for callers to free
37080         names, if that was desirable.  Partially fix this by always creating
37081         names on the obstack, which is more efficient anyway.  (You still
37082         can't obstack_free on error paths due to the xtensa
37083         tc_canonicalize_section_name.)  Also remove a couple of cases where
37084         the name is dup'd for no good reason as far as I know.
37085
37086                 PR 29256
37087                 * config/obj-elf.c (obj_elf_section_name): Create name on notes
37088                 obstack.
37089                 (obj_elf_attach_to_group): Don't strdup group name.
37090                 (obj_elf_section): Likewise.
37091                 (obj_elf_vendor_attribute): Use xmemdup0 rather than xstrndup.
37092
37093 2022-06-17  Alan Modra  <amodra@gmail.com>
37094
37095         PR29255, memory leak in make_tempdir
37096                 PR 29255
37097                 * bucomm.c (make_tempdir, make_tempname): Free template on all
37098                 failure paths.
37099
37100         PR29254, memory leak in stab_demangle_v3_arg
37101                 PR 29254
37102                 * stabs.c (stab_demangle_v3_arg): Free dt on failure path.
37103
37104 2022-06-17  Pedro Alves  <pedro@palves.net>
37105
37106         Fix GDB build with GCC 4.8 & 4.9
37107         With gcc 4.8/4.9, we run into this build failure (and other similar
37108         ones):
37109
37110           /home/palves/gdb/binutils-gdb/src/gdb/location.h:224:59: error: could not convert ‘{0, LINE_OFFSET_UNKNOWN}’ from ‘<brace-enclosed initializer list>’ to ‘line_offset’
37111              struct line_offset line_offset = {0, LINE_OFFSET_UNKNOWN};
37112                                                                      ^
37113
37114         The issue is that at around the GCC 4.8/4.9 era, a default member
37115         initializer prevented the struct from being an aggregate, so you
37116         cannot use aggregate initialization on them.  That rule changed after
37117         GCC 4.9 and GCC 5 & later uses new rules.
37118
37119         Fix this by not using aggregate initialization for struct line_offset.
37120         The default member initization already leaves line_offset as {0,
37121         LINE_OFFSET_UNKNOWN}, so initialization to those values can just go
37122         away.  The remaining cases are of the form {0, LINE_OFFSET_NONE}, and
37123         those cases can be better rewritten to delay setting the sign field
37124         until we know we have a valid offset.
37125
37126         Change-Id: I0506ea4a83c5fa2f15e159569db68b3b0a7509b4
37127
37128 2022-06-17  Pedro Alves  <pedro@palves.net>
37129
37130         Convert set_location_spec_string to a method
37131         This converts set_location_spec_string to a method of location_spec,
37132         and makes the location_spec::as_string field protected, renaming it to
37133         m_as_string along the way.
37134
37135         Change-Id: Iccfb1654e9fa7808d0512df89e775f9eacaeb9e0
37136
37137 2022-06-17  Pedro Alves  <pedro@palves.net>
37138
37139         Convert location_spec_to_string to a method
37140         This converts location_spec_to_string to a method of location_spec,
37141         simplifying the code using it, as it no longer has to use
37142         std::unique_ptr::get().
37143
37144         Change-Id: I621bdad8ea084470a2724163f614578caf8f2dd5
37145
37146 2022-06-17  Pedro Alves  <pedro@palves.net>
37147
37148         Convert location_spec_type to a method
37149         This converts location_spec_type to location_spec::type().
37150
37151         Change-Id: Iff4cbfafb1cf3d22adfa142ff939b4a148e52273
37152
37153 2022-06-17  Pedro Alves  <pedro@palves.net>
37154
37155         Convert location_spec_empty_p to a method
37156         This converts location_spec_empty_p to a method of location_spec,
37157         simplifying users, as they no longer have to use
37158         std::unique_ptr::get().
37159
37160         Change-Id: I83381a729896f12e1c5a1b4d6d4c2eb1eb6582ff
37161
37162 2022-06-17  Pedro Alves  <pedro@palves.net>
37163
37164         Eliminate copy_location_spec
37165         copy_location_spec is just a wrapper around location_spec::clone(), so
37166         remove it and call clone() directly.  This simplifies users, as they
37167         no longer have to use std::unique_ptr::get().
37168
37169         Change-Id: I8ce8658589460b98888283b306b315a5b8f73976
37170
37171 2022-06-17  Pedro Alves  <pedro@palves.net>
37172
37173         Eliminate the two-level data structures behind location_specs
37174         Currently, there's the location_spec hierarchy, and then some
37175         location_spec subclasses have their own struct type holding all their
37176         data fields.
37177
37178         I.e., there is this:
37179
37180          location_spec
37181            explicit_location_spec
37182            linespec_location_spec
37183            address_location_spec
37184            probe_location_spec
37185
37186         and then these separate types:
37187
37188           explicit_location
37189           linespec_location
37190
37191         where:
37192
37193           explicit_location_spec
37194              has-a explicit_location
37195           linespec_location_spec
37196              has-a linespec_location
37197
37198         This patch eliminates explicit_location and linespec_location,
37199         inlining their members in the corresponding location_spec type.
37200
37201         The location_spec subclasses were the ones currently defined in
37202         location.c, so they are moved to the header.  Since the definitions of
37203         the classes are now visible, we no longer need location_spec_deleter.
37204
37205         Some constructors that are used for cloning location_specs, like:
37206
37207           explicit explicit_location_spec (const struct explicit_location *loc)
37208
37209         ... were converted to proper copy ctors.
37210
37211         In the process, initialize_explicit_location is eliminated, and some
37212         functions that returned the "data type behind a locspec", like
37213         get_linespec_location are converted to downcast functions, like
37214         as_linespec_location_spec.
37215
37216         Change-Id: Ia31ccef9382b25a52b00fa878c8df9b8cf2a6c5a
37217
37218 2022-06-17  Pedro Alves  <pedro@palves.net>
37219
37220         event_location -> location_spec
37221         Currently, GDB internally uses the term "location" for both the
37222         location specification the user input (linespec, explicit location, or
37223         an address location), and for actual resolved locations, like the
37224         breakpoint locations, or the result of decoding a location spec to
37225         SaLs.  This is expecially confusing in the breakpoints module, as
37226         struct breakpoint has these two fields:
37227
37228           breakpoint::location;
37229           breakpoint::loc;
37230
37231         "location" is the location spec, and "loc" is the resolved locations.
37232
37233         And then, we have a method called "locations()", which returns the
37234         resolved locations as range...
37235
37236         The location spec type is presently called event_location:
37237
37238           /* Location we used to set the breakpoint.  */
37239           event_location_up location;
37240
37241         and it is described like this:
37242
37243           /* The base class for all an event locations used to set a stop event
37244              in the inferior.  */
37245
37246           struct event_location
37247           {
37248
37249         and even that is incorrect...  Location specs are used for finding
37250         actual locations in the program in scenarios that have nothing to do
37251         with stop events.  E.g., "list" works with location specs.
37252
37253         To clean all this confusion up, this patch renames "event_location" to
37254         "location_spec" throughout, and then all the variables that hold a
37255         location spec, they are renamed to include "spec" in their name, like
37256         e.g., "location" -> "locspec".  Similarly, functions that work with
37257         location specs, and currently have just "location" in their name are
37258         renamed to include "spec" in their name too.
37259
37260         Change-Id: I5814124798aa2b2003e79496e78f95c74e5eddca
37261
37262 2022-06-17  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
37263
37264         gprofng: fix build with -Werror=format-truncation
37265         gprofng/ChangeLog
37266         2022-06-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
37267
37268                 * configure.ac: Remove -Wno-format-truncation.
37269                 * src/Makefile.am: Likewise.
37270                 * configure: Rebuild.
37271                 * src/Makefile.in: Rebuild.
37272                 * common/hwctable.c: Fix -Werror=format-truncation errors.
37273                 * src/ipc.cc: Likewise.
37274                 * src/parse.cc: Likewise.
37275
37276 2022-06-17  GDB Administrator  <gdbadmin@sourceware.org>
37277
37278         Automatic date update in version.in
37279
37280 2022-06-16  Tom de Vries  <tdevries@suse.de>
37281
37282         [gdb/testsuite] Fix have_mpx test
37283         When testing on openSUSE Leap 15.4 I ran into this FAIL:
37284         ...
37285         FAIL: gdb.arch/i386-mpx-map.exp: NULL address of the pointer
37286         ...
37287         and likewise for all the other mpx tests.
37288
37289         The problem is that have_mpx is supposed to return 0, but it doesn't because
37290         it tries to match this output:
37291         ...
37292         builtin_spawn -ignore SIGHUP temp/20294/have_mpx-2-20294.x^M
37293         No MPX support^M
37294         No MPX support^M
37295         ...
37296         using:
37297         ...
37298                            && ![string equal $output "No MPX support\r\n"]]
37299         ...
37300
37301         Fix this by matching using a regexp instead.
37302
37303         Tested on x86_64-linux.
37304
37305 2022-06-16  Alan Modra  <amodra@gmail.com>
37306
37307         use of uninitialised value in input_file_open
37308         Triggered by a file containing just "#N" or "#A".  fgets when hitting
37309         EOF before reading anything returns NULL and does not write to buf.
37310         strchr (buf, '\n') then is reading from uninitialised memory.
37311
37312                 * input-file.c (input_file_open): Don't assume buf contains
37313                 zero string terminator when fgets returns NULL.
37314
37315 2022-06-16  Alan Modra  <amodra@gmail.com>
37316
37317         Always free matching vector from bfd_check_format_matches
37318         At least one place calling list_matching_formats failed to free the
37319         "matching" vector from bfd_check_format_matches afterwards.  Fix that
37320         by calling free inside list_matching_formats.
37321
37322         binutils/
37323                 * bucomm.c (list_matching_formats): Free arg.
37324                 * addr2line.c (process_file): Adjust to suit.
37325                 * ar.c (open_inarch, ranlib_touch): Likewise.
37326                 * coffdump.c (main): Likewise.
37327                 * nm.c (display_archive, display_file): Likewise.
37328                 * objcopy.c (copy_file): Likewise.
37329                 * objdump.c (display_object_bfd): Likewise.
37330                 * size.c (display_bfd): Likewise.
37331                 * srconv.c (main): Likewise.
37332         ld/
37333                 * ldlang.c (load_symbols): Free "matching".
37334
37335 2022-06-16  Alan Modra  <amodra@gmail.com>
37336
37337         Revert "Revert "Fix fbsd core matching""
37338         This reverts commit 476288fa2bddecf0f0e13dee826a076309bf01fe.
37339
37340 2022-06-16  Alan Modra  <amodra@gmail.com>
37341
37342         Restore readelf -wF
37343         Commit 94585d6d4495 resulted in readelf -wF failing with
37344         Unrecognized debug letter option 'F'
37345
37346         binutils/
37347                 * dwarf.c (debug_dump_long_opts): Add letter.
37348                 (debug_option_table): New, replacing..
37349                 (opts_table, letter_table): ..these.
37350                 (dwarf_select_sections_by_names): Adjust to suit.  Set
37351                 do_debug_frames outside of loop.
37352                 (dwarf_select_sections_by_letters): Similarly.
37353         gas/
37354                 * testsuite/gas/i386/ehinterp.d: Use readelf -wF.
37355
37356 2022-06-16  Alan Modra  <amodra@gmail.com>
37357
37358         PR29250, readelf erases CIE initial register state
37359                 PR 29250
37360         binutils/
37361                 * dwarf.c (display_debug_frames): Set col_type[reg] on sizing
37362                 pass over FDE to cie->col_type[reg] if CIE specifies reg.
37363                 Handle DW_CFA_restore and DW_CFA_restore_extended on second
37364                 pass using the same logic.  Remove unnecessary casts.  Don't
37365                 call frame_need_space on second pass over FDE.
37366         gas/
37367                 * testsuite/gas/i386/ehinterp.d,
37368                 * testsuite/gas/i386/ehinterp.s: New test.
37369                 * testsuite/gas/i386/i386.exp: Run it.
37370
37371 2022-06-16  GDB Administrator  <gdbadmin@sourceware.org>
37372
37373         Automatic date update in version.in
37374
37375 2022-06-15  Sergei Trofimovich  <siarheit@google.com>
37376
37377         sim: fix BFD_VMA format arguments on 32-bit hosts [PR gdb/29184]
37378         Noticed format mismatch when attempted to build gdb on i686-linux-gnu
37379         in --enable-64-bit-bfd mode:
37380
37381             sim/../../sim/cris/sim-if.c:576:28:
37382                 error: format '%lx' expects argument of type 'long unsigned int',
37383                 but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=]
37384               576 |       sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx",
37385                   |                            ^~~~~~~~~~~~~~~~~~~
37386               577 |          interp_load_addr, interpsiz);
37387                   |                            ~~~~~~~~~
37388                   |                            |
37389                   |                            bfd_size_type {aka long long unsigned int}
37390
37391         While at it fixed format string for time-related types.
37392
37393 2022-06-15  Tom Tromey  <tromey@adacore.com>
37394
37395         Check for listeners in emit_exiting_event
37396         I noticed that emit_exiting_event does not check whether there are any
37397         listeners before creating the event object.  All other event emitters
37398         do this, so this patch updates this one as well.
37399
37400 2022-06-15  Tom Tromey  <tom@tromey.com>
37401
37402         Add to documentation of Python 'dont_repeat' method
37403         PR python/28533 points out that the Python 'dont_repeat' documentation
37404         is a bit ambiguous about when the method ought to be called.  This
37405         patch spells it out.
37406
37407 2022-06-15  Yvan Roux  <yvan.roux@foss.st.com>
37408
37409         gdb/arm: Make sp alias for one of the other stack pointers
37410         For Cortex-M targets, SP register is never detached from msp or
37411         psp, it always has the same value as one of them.  Let GDB treat
37412         ARM_SP_REGNUM as an alias similar to what is done in hardware.
37413
37414 2022-06-15  Yvan Roux  <yvan.roux@foss.st.com>
37415
37416         gdb/arm: Track msp and psp
37417         For Arm Cortex-M33 with security extensions, there are 4 different
37418         stack pointers (msp_s, msp_ns, psp_s, psp_ns).  To be compatible
37419         with earlier Cortex-M derivates, the msp and psp registers are
37420         aliases for one of the 4 real stack pointer registers.
37421
37422         These are the combinations that exist:
37423         sp -> msp -> msp_s
37424         sp -> msp -> msp_ns
37425         sp -> psp -> psp_s
37426         sp -> psp -> psp_ns
37427
37428         This means that when the GDB client is to show the value of "msp",
37429         the value should always be equal to either "msp_s" or "msp_ns".
37430         Same goes for "psp".
37431
37432         To add a bit more context; GDB does not really use the register msp
37433         (or psp) internally, but they are part of the set of registers which
37434         are provided by the target.xml file.  As a result, they will be part
37435         of the set of registers printed by the "info r" command.
37436
37437         Without this particular patch, GDB will hit the assert in the bottom
37438         of arm_cache_get_sp_register function.
37439
37440         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29121
37441
37442 2022-06-15  Yvan Roux  <yvan.roux@foss.st.com>
37443
37444         gdb/arm: Fetch initial sp value prior to compare
37445         For Arm Cortex-M33 with security extensions, there are 4 different
37446         stack pointers (msp_s, msp_ns, psp_s, psp_ns).  In order to
37447         identify the active one, compare the values of the different
37448         stacks. The value of the initial sp register needs to be fetched to
37449         perform this comparison.
37450
37451 2022-06-15  Andrew Burgess  <aburgess@redhat.com>
37452
37453         gdb: unify two dis_asm_read_memory functions in disasm.c
37454         After the recent restructuring of the disassembler code, GDB has ended
37455         up with two identical class static functions, both called
37456         dis_asm_read_memory, with identical implementations.
37457
37458         My first thought was to move these out of their respective classes,
37459         and just make them global functions, then I'd only need a single
37460         copy.
37461
37462         And maybe that's the right way to go.  But I disliked that by doing
37463         that I loose the encapsulation of the method with the corresponding
37464         disassembler class.
37465
37466         So, instead, I placed the static method into its own class, and had
37467         both the gdb_non_printing_memory_disassembler and gdb_disassembler
37468         classes inherit from this new class as an additional base-class.
37469
37470         In terms of code generated, I don't think there's any significant
37471         difference with this approach, but I think this better reflects how
37472         the function is closely tied to the disassembler.
37473
37474         There should be no user visible changes after this commit.
37475
37476 2022-06-15  Andrew Burgess  <aburgess@redhat.com>
37477
37478         gdb: refactor the non-printing disassemblers
37479         This commit started from an observation I made while working on some
37480         other disassembler patches, that is, that the function
37481         gdb_buffered_insn_length, is broken ... sort of.
37482
37483         I noticed that the gdb_buffered_insn_length function doesn't set up
37484         the application data field if the disassemble_info structure.
37485
37486         Further, I noticed that some architectures, for example, ARM, require
37487         that the application_data field be set, see gdb_print_insn_arm in
37488         arm-tdep.c.
37489
37490         And so, if we ever use gdb_buffered_insn_length for ARM, then GDB will
37491         likely crash.  Which is why I said only "sort of" broken.  Right now
37492         we don't use gdb_buffered_insn_length with ARM, so maybe it isn't
37493         broken yet?
37494
37495         Anyway to prove to myself that there was a problem here I extended the
37496         disassembler self tests in disasm-selftests.c to include a test of
37497         gdb_buffered_insn_length.  As I run the test for all architectures, I
37498         do indeed see GDB crash for ARM.
37499
37500         To fix this we need gdb_buffered_insn_length to create a disassembler
37501         that inherits from gdb_disassemble_info, but we also need this new
37502         disassembler to not print anything.
37503
37504         And so, I introduce a new gdb_non_printing_disassembler class, this is
37505         a disassembler that doesn't print anything to the output stream.
37506
37507         I then observed that both ARC and S12Z also create non-printing
37508         disassemblers, but these are slightly different.  While the
37509         disassembler in gdb_non_printing_disassembler reads the instruction
37510         from a buffer, the ARC and S12Z disassemblers read from target memory
37511         using target_read_code.
37512
37513         And so, I further split gdb_non_printing_disassembler into two
37514         sub-classes, gdb_non_printing_memory_disassembler and
37515         gdb_non_printing_buffer_disassembler.
37516
37517         The new selftests now pass, but otherwise, there should be no user
37518         visible changes after this commit.
37519
37520 2022-06-15  Andrew Burgess  <andrew.burgess@embecosm.com>
37521
37522         gdb/python: implement the print_insn extension language hook
37523         This commit extends the Python API to include disassembler support.
37524
37525         The motivation for this commit was to provide an API by which the user
37526         could write Python scripts that would augment the output of the
37527         disassembler.
37528
37529         To achieve this I have followed the model of the existing libopcodes
37530         disassembler, that is, instructions are disassembled one by one.  This
37531         does restrict the type of things that it is possible to do from a
37532         Python script, i.e. all additional output has to fit on a single line,
37533         but this was all I needed, and creating something more complex would,
37534         I think, require greater changes to how GDB's internal disassembler
37535         operates.
37536
37537         The disassembler API is contained in the new gdb.disassembler module,
37538         which defines the following classes:
37539
37540           DisassembleInfo
37541
37542               Similar to libopcodes disassemble_info structure, has read-only
37543           properties: address, architecture, and progspace.  And has methods:
37544           __init__, read_memory, and is_valid.
37545
37546               Each time GDB wants an instruction disassembled, an instance of
37547           this class is passed to a user written disassembler function, by
37548           reading the properties, and calling the methods (and other support
37549           methods in the gdb.disassembler module) the user can perform and
37550           return the disassembly.
37551
37552           Disassembler
37553
37554               This is a base-class which user written disassemblers should
37555           inherit from.  This base class provides base implementations of
37556           __init__ and __call__ which the user written disassembler should
37557           override.
37558
37559           DisassemblerResult
37560
37561               This class can be used to hold the result of a call to the
37562           disassembler, it's really just a wrapper around a string (the text
37563           of the disassembled instruction) and a length (in bytes).  The user
37564           can return an instance of this class from Disassembler.__call__ to
37565           represent the newly disassembled instruction.
37566
37567         The gdb.disassembler module also provides the following functions:
37568
37569           register_disassembler
37570
37571               This function registers an instance of a Disassembler sub-class
37572           as a disassembler, either for one specific architecture, or, as a
37573           global disassembler for all architectures.
37574
37575           builtin_disassemble
37576
37577               This provides access to GDB's builtin disassembler.  A common
37578           use case that I see is augmenting the existing disassembler output.
37579           The user code can call this function to have GDB disassemble the
37580           instruction in the normal way.  The user gets back a
37581           DisassemblerResult object, which they can then read in order to
37582           augment the disassembler output in any way they wish.
37583
37584               This function also provides a mechanism to intercept the
37585           disassemblers reads of memory, thus the user can adjust what GDB
37586           sees when it is disassembling.
37587
37588         The included documentation provides a more detailed description of the
37589         API.
37590
37591         There is also a new CLI command added:
37592
37593           maint info python-disassemblers
37594
37595         This command is defined in the Python gdb.disassemblers module, and
37596         can be used to list the currently registered Python disassemblers.
37597
37598 2022-06-15  Andrew Burgess  <andrew.burgess@embecosm.com>
37599
37600         gdb: add extension language print_insn hook
37601         This commit is setup for the next commit.
37602
37603         In the next commit I will add a Python API to intercept the print_insn
37604         calls within GDB, each print_insn call is responsible for
37605         disassembling, and printing one instruction.  After the next commit it
37606         will be possible for a user to write Python code that either wraps
37607         around the existing disassembler, or even, in extreme situations,
37608         entirely replaces the existing disassembler.
37609
37610         This commit does not add any new Python API.
37611
37612         What this commit does is put the extension language framework in place
37613         for a print_insn hook.  There's a new callback added to 'struct
37614         extension_language_ops', which is then filled in with nullptr for Python
37615         and Guile.
37616
37617         Finally, in the disassembler, the code is restructured so that the new
37618         extension language function ext_lang_print_insn is called before we
37619         delegate to gdbarch_print_insn.
37620
37621         After this, the next commit can focus entirely on providing a Python
37622         implementation of the new print_insn callback.
37623
37624         There should be no user visible change after this commit.
37625
37626 2022-06-15  Andrew Burgess  <andrew.burgess@embecosm.com>
37627
37628         gdb: add new base class to gdb_disassembler
37629         The motivation for this change is an upcoming Python disassembler API
37630         that I would like to add.  As part of that change I need to create a
37631         new disassembler like class that contains a disassemble_info and a
37632         gdbarch.  The management of these two objects is identical to how we
37633         manage these objects within gdb_disassembler, so it might be tempting
37634         for my new class to inherit from gdb_disassembler.
37635
37636         The problem however, is that gdb_disassembler has a tight connection
37637         between its constructor, and its print_insn method.  In the
37638         constructor the ui_file* that is passed in is replaced with a member
37639         variable string_file*, and then in print_insn, the contents of the
37640         member variable string_file are printed to the original ui_file*.
37641
37642         What this means is that the gdb_disassembler class has a tight
37643         coupling between its constructor and print_insn; the class just isn't
37644         intended to be used in a situation where print_insn is not going to be
37645         called, which is how my (upcoming) sub-class would need to operate.
37646
37647         My solution then, is to separate out the management of the
37648         disassemble_info and gdbarch into a new gdb_disassemble_info class,
37649         and make this class a parent of gdb_disassembler.
37650
37651         In arm-tdep.c and mips-tdep.c, where we used to cast the
37652         disassemble_info->application_data to a gdb_disassembler, we can now
37653         cast to a gdb_disassemble_info as we only need to access the gdbarch
37654         information.
37655
37656         Now, my new Python disassembler sub-class will still want to print
37657         things to an output stream, and so we will want access to the
37658         dis_asm_fprintf functionality for printing.
37659
37660         However, rather than move this printing code into the
37661         gdb_disassemble_info base class, I have added yet another level of
37662         hierarchy, a gdb_printing_disassembler, thus the class structure is
37663         now:
37664
37665           struct gdb_disassemble_info {};
37666           struct gdb_printing_disassembler : public gdb_disassemble_info {};
37667           struct gdb_disassembler : public gdb_printing_disassembler {};
37668
37669         In a later commit my new Python disassembler will inherit from
37670         gdb_printing_disassembler.
37671
37672         The reason for adding the additional layer to the class hierarchy is
37673         that in yet another commit I intend to rewrite the function
37674         gdb_buffered_insn_length, and to do this I will be creating yet more
37675         disassembler like classes, however, these will not print anything,
37676         thus I will add a gdb_non_printing_disassembler class that also
37677         inherits from gdb_disassemble_info.  Knowing that that change is
37678         coming, I've gone with the above class hierarchy now.
37679
37680         There should be no user visible changes after this commit.
37681
37682 2022-06-15  Andrew Burgess  <aburgess@redhat.com>
37683
37684         gdb/python: convert gdbpy_err_fetch to use gdbpy_ref
37685         Convert the gdbpy_err_fetch class to make use of gdbpy_ref, this
37686         removes the need for manual reference count management, and allows the
37687         destructor to be removed.
37688
37689         There should be no functional change after this commit.
37690
37691         I think this cleanup is worth doing on its own, however, in a later
37692         commit I will want to copy instances of gdbpy_err_fetch, and switching
37693         to using gdbpy_ref means that I can rely on the default copy
37694         constructor, without having to add one that handles the reference
37695         counts, so this is good preparation for that upcoming change.
37696
37697 2022-06-15  Jan Beulich  <jbeulich@suse.com>
37698
37699         x86: drop print_operand_value()'s "hex" parameter
37700         For quite some  time all callers have been passing 1 / true. While there
37701         fold the final oappend_with_style() calls.
37702
37703 2022-06-15  Tom de Vries  <tdevries@suse.de>
37704
37705         [gdb/build] Fix build for gcc < 11
37706         When building trunk on openSUSE Leap 15.3 with system gcc 7.5.0, I run into:
37707         ...
37708         In file included from ../bfd/bfd.h:46:0,
37709                          from gdb/defs.h:37,
37710                          from gdb/debuginfod-support.c:19:
37711         gdb/debuginfod-support.c: In function ‘bool debuginfod_is_enabled()’:
37712         gdb/../include/diagnostics.h:42:3: error: unknown option after \
37713           ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
37714            _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option))
37715            ^
37716         gdb/../include/diagnostics.h:80:3: note: in expansion of macro \
37717           ‘DIAGNOSTIC_IGNORE’
37718            DIAGNOSTIC_IGNORE ("-Wstringop-overread")
37719            ^~~~~~~~~~~~~~~~~
37720         gdb/debuginfod-support.c:201:4: note: in expansion of macro \
37721           ‘DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD’
37722             DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
37723             ^
37724         ...
37725
37726         The problem is that the warning -Wstringop-overread has been introduced for
37727         gcc 11, and we can only tell gcc to ignore if it knows about it.
37728
37729         Fix this by guarding the DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD definition in
37730         diagnostics.c with '#if __GNUC__ >= 11'.
37731
37732         Tested on x86_64-linux, by completing a build.
37733
37734 2022-06-15  Alan Modra  <amodra@gmail.com>
37735
37736         PR29230, segv in lookup_symbol_in_variable_table
37737         The PR23230 testcase uses indexed strings without specifying
37738         SW_AT_str_offsets_base.  In this case we left u.str with garbage (from
37739         u.val) which then led to a segfault when attempting to access the
37740         string.  Fix that by clearing u.str.  The patch also adds missing
37741         sanity checks in the recently committed read_indexed_address and
37742         read_indexed_string functions.
37743
37744                 PR 29230
37745                 * dwarf2.c (read_indexed_address): Return uint64_t.  Sanity check idx.
37746                 (read_indexed_string): Use uint64_t for str_offset.  Sanity check idx.
37747                 (read_attribute_value): Clear u.str for indexed string forms when
37748                 DW_AT_str_offsets_base is not yet read or missing.
37749
37750 2022-06-15  Mark Wielaard  <mark@klomp.org>
37751
37752         gdb: Always suppress stringop-overread warning in debuginfod-support.c
37753         Just like on s390x with g++ 11.2.1 and ppc64le with g++ 11.3.1 g++ 11
37754         on hppa produces a spurious warning for stringop-overread in
37755         debuginfod_is_enabled for url_view. Just always suppress it on all
37756         arches.
37757
37758         https://sourceware.org/bugzilla/show_bug.cgi?id=29198
37759
37760         gdb/ChangeLog:
37761
37762                 * debuginfod-support.c (debuginfod_is_enabled): Always use
37763                 DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD.
37764
37765 2022-06-15  GDB Administrator  <gdbadmin@sourceware.org>
37766
37767         Automatic date update in version.in
37768
37769 2022-06-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
37770
37771         gprofng docs: provide help for <rate> == <interval>
37772         The help message from 'gprofng collect app -h', in
37773         the section on <rate> == <interval>, had a dangling
37774         reference to a non-existent manpage. Provide basic
37775         info, including reasons for caution.
37776
37777         gprofng docs: mention HTML / PDF in the gprofng README
37778         The HTML and PDF formats are described in the gprofng tutorial (info
37779         topic "Other Document Formats"). In addition, describe them in the
37780         README because: they are important; they are easily searchable; and the
37781         README is primarily oriented to the person who is installing gprofng,
37782         who may differ from the person who follows a user tutorial.
37783
37784 2022-06-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
37785
37786         gprofng: fix build with -Werror=format-security
37787         gprofng/ChangeLog
37788         2022-06-13  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
37789
37790                 PR gprofng/28968
37791                 * src/src/Hist_data.cc (print_row): Make param const.
37792                 * src/src/Hist_data.h (print_row): Likewise.
37793                 * src/src/Print.h: Remove unused functions and variables.
37794                 * src/Print.cc: Fix -Werror=format-security errors.
37795                 * src/parse.cc: Likewise.
37796
37797 2022-06-14  Tom de Vries  <tdevries@suse.de>
37798
37799         [gdb/testsuite] Handle unordered dict in gdb.python/py-mi-cmd.exp
37800         When running test-case gdb.python/py-mi-cmd.exp on openSUSE Leap 42.3 with
37801         python 3.4, I occasionally run into:
37802         ...
37803         Expecting: ^(-pycmd dct[^M
37804         ]+)?(\^done,result={hello="world",times="42"}[^M
37805         ]+[(]gdb[)] ^M
37806         [ ]*)
37807         -pycmd dct^M
37808         ^done,result={times="42",hello="world"}^M
37809         (gdb) ^M
37810         FAIL: gdb.python/py-mi-cmd.exp: -pycmd dct (unexpected output)
37811         ...
37812
37813         The problem is that the data type used here in py-mi-cmd.py:
37814         ...
37815                 elif argv[0] == "dct":
37816                     return {"result": {"hello": "world", "times": 42}}
37817         ...
37818         is a dictionary, and only starting version 3.6 are dictionaries insertion
37819         ordered, so using PyDict_Next in serialize_mi_result doesn't guarantee a
37820         fixed order.
37821
37822         Fix this by allowing the alternative order.
37823
37824         Tested on x86_64-linux.
37825
37826 2022-06-14  Tom Tromey  <tromey@adacore.com>
37827
37828         Implement lazy FPU initialization for ravenscar
37829         Some ravenscar runtimes implement lazy FPU handling.  On these
37830         runtimes, the FPU is only initialized when a task tries to use it.
37831         Furthermore, the FP registers aren't automatically saved on a task
37832         switch -- instead, the save is deferred until the new task tries to
37833         use the FPU.  Furthermore, each task's context area has a flag
37834         indicating whether the FPU has been initialized for this task.
37835
37836         This patch teaches GDB to understand this implementation.  When
37837         fetching or storing registers, GDB now checks to see whether the live
37838         FP registers should be used.  If not, the task's saved FP registers
37839         will be used if the task has caused FPU initialization.
37840
37841         Currently only AArch64 uses this code.  bb-runtimes implements this
37842         for ARM as well, but GDB doesn't yet have an arm-ravenscar-thread.c.
37843
37844 2022-06-14  Tom Tromey  <tromey@adacore.com>
37845
37846         Reimplement ravenscar registers using tables
37847         Currently, the ravenscar-thread implementation for each architecture
37848         is written by hand.  However, these are actually written by
37849         copy-paste.  It seems better to switch to a table-driven approach.
37850
37851         The previous code also fetched all registers whenever any register was
37852         requested.  This is corrected in the new implementation.
37853
37854 2022-06-14  Tom Tromey  <tromey@adacore.com>
37855
37856         Fix bugs in aarch64-ravenscar-thread.c
37857         We found a few bugs in aarch64-ravenscar-thread.c.
37858
37859         First, some of the register offsets were incorrect.  The "bb-runtimes"
37860         file for this runtime had the wrong offsets in comments, which GDB
37861         took to be correct.  However, those comments didn't account for
37862         alignment.  This patch adjusts the offsets.
37863
37864         Next, the "FPU Saved field" is not a register -- it is an
37865         implementation detail of the runtime.  This is removed.
37866
37867         Finally, I think the FP registers are actually named V0-V31, and the
37868         "Q" names are pseudo-registers.  This patch fixes the comment.
37869
37870 2022-06-14  Tom Tromey  <tromey@adacore.com>
37871
37872         Allow 'interrupt -a' in all-stop mode
37873         PR gdb/17160 points out that "interrupt -a" errors in all-stop mode,
37874         but there's no good reason for this.  This patch removes the error.
37875
37876         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17160
37877
37878 2022-06-14  Youling Tang  <tangyouling@loongson.cn>
37879
37880         gdbserver: Add LoongArch/Linux support
37881         Implement LoongArch/Linux support, including XML target description
37882         handling based on features determined, GPR regset support, and software
37883         breakpoint handling.
37884
37885         In the Linux kernel code of LoongArch, ptrace implements PTRACE_POKEUSR
37886         and PTRACE_PEEKUSR in the arch_ptrace function, so srv_linux_usrregs is
37887         set to yes.
37888
37889         With this patch on LoongArch:
37890
37891           $ make check-gdb TESTS="gdb.server/server-connect.exp"
37892           [...]
37893           # of expected passes          18
37894           [...]
37895
37896 2022-06-14  Tom de Vries  <tdevries@suse.de>
37897
37898         Revert "Fix fbsd core matching"
37899         This reverts commit a7e29f797cecd5a2f73c27838b09eae1f1b6c657.
37900
37901         I accidentally pushed this, so revert.
37902
37903 2022-06-14  Tom de Vries  <tdevries@suse.de>
37904
37905         [gdb/testsuite] Fix regexp in gdb.ada/mi_var_access.exp
37906         With gcc-12 and target board unix/-m32, we run into:
37907         ...
37908         (gdb) ^M
37909         Expecting: ^(-var-create A_String_Access \* A_String_Access[^M
37910         ]+)?(\^done,name="A_String_Access",numchild="1",.*[^M
37911         ]+[(]gdb[)] ^M
37912         [ ]*)
37913         -var-create A_String_Access * A_String_Access^M
37914         ^error,msg="Value out of range."^M
37915         (gdb) ^M
37916         FAIL: gdb.ada/mi_var_access.exp: Create varobj (unexpected output)
37917         ...
37918
37919         What happens is easier to understand if we take things out of the mi context:
37920         ...
37921         $ gdb -q -batch \
37922             outputs/gdb.ada/mi_var_access/mi_access \
37923             -ex "b mi_access.adb:19" \
37924             -ex run \
37925             -ex "p A_String_Access"
37926           ...
37927         Breakpoint 1, mi_access () at mi_access.adb:19
37928         19         A_String : String (3 .. 5) := "345"; -- STOP
37929         $1 = (pck.string_access) <error reading variable: Value out of range.>
37930         ...
37931         while with target board unix we have instead:
37932         ...
37933         $1 = (pck.string_access) 0x431b40 <ada_main.sec_default_sized_stacks>
37934         ...
37935
37936         The var-create command samples the value of the variable at a location where
37937         the variable is not yet initialized, and with target board unix we
37938         accidentally hit a valid address, but with target board unix/-m32 that's not
37939         the case.
37940
37941         Fix the FAIL by accepting the error message.
37942
37943         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28464
37944
37945 2022-06-14  Alan Modra  <amodra@gmail.com>
37946
37947         Fix fbsd core matching
37948         On Thu, Jun 09, 2022 at 08:59:37AM -0700, John Baldwin wrote:
37949         > On 6/9/22 1:58 AM, Tom de Vries via Gdb-patches wrote:
37950         > > Hi,
37951         > >
37952         > > With an --enable-targets=all build and target board unix/-m32 I run into a
37953         > > FAIL in test-case gdb.base/corefile.exp:
37954         > > ...
37955         > > (gdb) file outputs/gdb.base/corefile/corefile^M
37956         > > Reading symbols from outputs/gdb.base/corefile/corefile...^M
37957         > > (gdb) core-file outputs/gdb.base/corefile/corefile.core^M
37958         > > warning: core file may not match specified executable file.^M
37959         > > [New LWP 12011]^M
37960         > > Core was generated by `outputs/gdb.base/corefile/co'.^M
37961         > > Program terminated with signal SIGABRT, Aborted.^M
37962         > > (gdb) FAIL: gdb.base/corefile.exp: core-file warning-free
37963         > > ...
37964         > >
37965         > > The warning is there because of this mismatch between core and exec:
37966         > > ...
37967         > > (gdb) p core_bfd->xvec
37968         > > $3 = (const struct bfd_target *) 0x20112a0 <i386_elf32_fbsd_vec>
37969         > > (gdb) p exec_bfd->xvec
37970         > > $4 = (const struct bfd_target *) 0x2010b00 <i386_elf32_vec>
37971         > > ...
37972         > >
37973         > > In the exec case, the detected architecture is i386_elf32_vec because this bit
37974         > > of code in elfcode.h:elf_object_p():
37975         > > ...
37976         > >    if (ebd->elf_machine_code != EM_NONE
37977         > >        && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi
37978         > >        && ebd->elf_osabi != ELFOSABI_NONE)
37979         > >      goto got_wrong_format_error;
37980         > > ...
37981         > > prevents i386_elf32_fbsd from matching.
37982         > >
37983         > > Fix the core matching by copying that code to elfcore.h:elf_core_file_p().
37984         > >
37985         > > Tested on x86_64-linux.
37986         > >
37987         > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29227
37988         > >
37989         > > Any comments?
37990
37991         Looks good.
37992
37993         > Looking at elfcore.h, it seems to have not gotten changes made to elfcode.h over
37994         > time and is a bit rotted.  I suspect that all of changes made in commit 0aabe54e6222
37995         > that added these lines in elfcode.h (along with several other changes) need to
37996         > be applied to this function in elfcore.h, not just adding these lines.
37997
37998         Yes, the commit 0aabe54e6222 changes likely should go in too.  I'm a
37999         little wary of adding all the sanity checks to elf_core_file_p since
38000         that might result in some core files not being recognised at all.  For
38001         example, despite the FIXME I'd guess leaving out the EI_VERSION check
38002         was deliberate.  The following seems reasonable to me.  Please test.
38003
38004 2022-06-14  Kavitha Natarajan  <kavitha.natarajan@amd.com>
38005
38006         Debug support for global alias variable
38007         Starting with (future) Clang 15 (since
38008         https://reviews.llvm.org/D120989), Clang emits the DWARF information
38009         of global alias variables as DW_TAG_imported_declaration.  However,
38010         GDB does not handle it.  It incorrectly always reads this tag as
38011         C++/Fortran imported declaration (type alias, namespace alias and
38012         Fortran module).  This commit adds support to handle this tag as an
38013         alias variable.
38014
38015         This change fixes the failures in the gdb.base/symbol-alias.exp
38016         testcase with current git Clang.  This testcase is also updated to
38017         test nested (recursive) aliases.
38018
38019 2022-06-14  Alan Modra  <amodra@gmail.com>
38020
38021         BFD_RELOC_MIPS_16
38022         MIPS should not be using BFD_RELOC_16 for its R_MIPS_16 relocation,
38023         since R_MIPS_16 specifies a 16-bit field in a 32-bit word.
38024         BFD_RELOC_16, emitted by generic code to handle fixups on 16-bit data
38025         directives, expects fixups to operate on the whole of a 16-bit word.
38026
38027         This patch corrects the problem by using BFD_RELOC_MIPS_16, a new bfd
38028         reloc that is used to generate R_MIPS_16.  BFD_RELOC_16 is handled in
38029         md_apply_fix for cases where the fixup can be applied at assembly
38030         time.  Like BFD_RELOC_8, BFD_RELOC_16 now has no corresponding object
38031         file relocation, and thus .half, .hword, .short and .dc.w must be
38032         resolved at assembly time.  BFD_RELOC_MIPS_REL16 is removed by this
38033         patch since it isn't used.
38034
38035                 PR 3243
38036                 PR 26542
38037                 * reloc.c (BFD_RELOC_MIPS_16): Rename from BFD_RELOC_MIPS_REL16.
38038                 * elf32-mips.c (mips_reloc_map): Map BFD_RELOC_MIPS_16 to R_MIPS_16.
38039                 * elf64-mips.c (mips_reloc_map): Likewise, delete BFD_RELOC_MIPS_REL16.
38040                 * elfn32-mips.c (mips_reloc_map): Likewise.
38041                 * libbfd.h: Regenerate.
38042                 * bfd-in2.h: Regenerate.
38043         gas/
38044                 * config/tc-mips.c (append_insn): Handle BFD_RELOC_MIPS_16.
38045                 (macro_build): Likewise.
38046                 (mips_percent_op <%half>): Generate BFD_RELOC_MIPS_16.
38047                 (md_apply_fix): Handle BFD_RELOC_16 and BFD_RELOC_MIPS_16 when fx_done.
38048         ld/
38049                 * testsuite/ld-mips-elf/reloc-local-overflow.d,
38050                 * testsuite/ld-mips-elf/reloc-local-overflow.s: Rewrite.
38051
38052 2022-06-14  Alan Modra  <amodra@gmail.com>
38053
38054         Correct R_MIPS_16 n32 howto
38055         If the howto is actually used, an all-zero dst_mask will result in
38056         unchanged section contents on attempting to apply R_MIPS_16.
38057
38058                 * elfn32-mips.c (elf_mips_howto_table_rela <R_MIPS_16>): Correct
38059                 dst_mask.
38060
38061 2022-06-14  Alan Modra  <amodra@gmail.com>
38062
38063         asan: applying zero offset to NULL pointer
38064                 * dwarf.c (fetch_indexed_string): Move initialisation of "curr"
38065                 and "end" after checking for missing section.
38066
38067 2022-06-14  Alan Modra  <amodra@gmail.com>
38068
38069         gas dwarf2dbg.c tidy
38070         Make it a little more obvious that remap_debug_filename returns an
38071         allocated string (that should be freed) by returning a char * rather
38072         than const char *.  Free a few missed cases in dwarf2dbg.c, and free
38073         other memory allocated in dwarf2dbg.c.  Also remove static
38074         initialisation of variables and initialise in dwarf2_init instead,
38075         in order to ensure gas state is saner for oss-fuzz.
38076
38077                 * remap.c (remap_debug_filename): Remove const from return.
38078                 * as.h (remap_debug_filename): Update prototype.
38079                 * config/obj-elf.c (obj_elf_ident): Simplify free of
38080                 remap_debug_filename output.
38081                 * stabs.c (stabs_generate_asm_file): Likewise.
38082                 * dwarf2dbg.c (dirs, dirs_in_use, dirs_allocated, current): Don't
38083                 initialise statically..
38084                 (dwarf2_init): ..do so here, along with most other static vars.
38085                 (assign_file_to_slot): Don't set files_allocated until we
38086                 succeed in allocating memory.
38087                 (purge_generated_debug): Add bool param, free more stuff if true.
38088                 (dwarf2_directive_filename): Adjust purge_generated_debug call.
38089                 (process_entries): Don't free line_entry here..
38090                 (dwarf2_cleanup): ..do so here instead, new function.
38091                 (dwarf2_finish): Call dwarf2_cleanup.  When chaining together
38092                 subseg line entries, unhook entries from old subseg list.
38093                 (dwarf2_directive_loc): Free remap_debug_filename string.
38094                 (out_dir_and_file_list): Likewise.
38095                 (out_debug_str): Likewise.
38096
38097 2022-06-14  GDB Administrator  <gdbadmin@sourceware.org>
38098
38099         Automatic date update in version.in
38100
38101 2022-06-13  Tom de Vries  <tdevries@suse.de>
38102
38103         [gdb/testsuite] Fix gdb.reverse/test_ioctl_TCSETSW.exp with libc debuginfo
38104         When running test-case gdb.reverse/test_ioctl_TCSETSW.exp with glibc debuginfo
38105         installed, I run into:
38106         ...
38107         (gdb) PASS: gdb.reverse/test_ioctl_TCSETSW.exp: at TCSETSW call
38108         step^M
38109         __tcsetattr (fd=0, optional_actions=1, termios_p=0x7fffffffcf50) at \
38110           ../sysdeps/unix/sysv/linux/tcsetattr.c:45^M
38111         45      {^M
38112         (gdb) FAIL: gdb.reverse/test_ioctl_TCSETSW.exp: handle TCSETSW
38113         ...
38114
38115         The problem is that the step is expected to step over the call to tcsetattr,
38116         but due to glibc debuginfo being installed, we step into the call.
38117
38118         Fix this by using next instead of step.
38119
38120         Tested on x86_64-linux.
38121
38122 2022-06-13  Tom de Vries  <tdevries@suse.de>
38123
38124         [gdb] Avoid warnings in cooked_{read,write}_test for m68hc11
38125         With --enable-targets=all we have:
38126         ...
38127         $ gdb -q -batch -ex "maint selftest"
38128           ...
38129         Running selftest regcache::cooked_read_test::m68hc11.
38130         warning: No frame soft register found in the symbol table.
38131         Stack backtrace will not work.
38132         Running selftest regcache::cooked_read_test::m68hc12.
38133         warning: No frame soft register found in the symbol table.
38134         Stack backtrace will not work.
38135         Running selftest regcache::cooked_read_test::m68hc12:HCS12.
38136         warning: No frame soft register found in the symbol table.
38137         Stack backtrace will not work.
38138         ...
38139
38140         Likewise for regcache::cooked_write_test.
38141
38142         The warning has no use in the selftest context.
38143
38144         Fix this by skipping the specific selftests.
38145
38146         Tested on x86_64-linux.
38147
38148         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29224
38149
38150 2022-06-13  Tiezhu Yang  <yangtiezhu@loongson.cn>
38151
38152         gdb: LoongArch: Deal with atomic sequence
38153         We can't put a breakpoint in the middle of a ll/sc atomic sequence,
38154         so look for the end of the sequence and put the breakpoint there.
38155
38156 2022-06-13  Sam James  <sam@gentoo.org>
38157
38158         gdb: don't use bashism in configure test
38159         Results in configure output like:
38160         ```
38161         checking for X... no
38162         /var/tmp/portage/sys-devel/gdb-12.1/work/gdb-12.1/gdb/configure: 18837: test: yes: unexpected operator
38163         checking whether to use babeltrace... auto
38164         ```
38165
38166         ... when /bin/sh is provided by a POSIX-compliant shell, like dash,
38167         instead of bash.
38168
38169 2022-06-13  Jiangshuai Li  <jiangshuai_li@c-sky.com>
38170
38171         gdb:csky add support target-descriptions for CSKY arch
38172         Registers in CSKY architecture included:
38173         1. 32 gprs
38174         2. 16 ars (alternative gprs used for quick interrupt)
38175         3. hi, lo, pc
38176         4. fr0~fr31, fcsr, fid, fesr
38177         5. vr0~vr15
38178         6. ((32 banks) * 32) cr regs (max 32 banks, 32 control regs a bank)
38179
38180         For register names:
38181         Except over control registers, other registers, like gprs, hi, lo ...
38182         are fixed names. Among the 32*32 control registers, some used registers
38183         will have fixed names, others will have a default name "cpxcry". 'x'
38184         refers to bank, y refers index in the bank(a control register in bank
38185         4 with index 14 will has a default name cp4cr14).
38186
38187         For register numbers in GDB:
38188         We assign a fixed number to each register in GDB, like:
38189         r0~r31 with 0~31
38190         hi, lo with 36, 37
38191         fpu/vpu with 40~71
38192         ...
38193         described in function csky_get_supported_register_by_index().
38194
38195         Function csky_get_supported_tdesc_registers_count():
38196         To calculate the total number of registers that GDB can analyze,
38197         including those with fixed names and those with default register names.
38198
38199         Function csky_get_supported_register_by_index():
38200         To find a supported struct csky_supported_tdesc_register, return a
38201         struct include name with regnum via index.
38202
38203         Arrays csky_supported_tdesc_feature_names[]:
38204         Include all supported feature names in tdesc-xmls.
38205
38206         We use the information described above to load the register description
38207         file of the target from the stub. When loading, do a little check that
38208         whether the register description file contains SP, LR and PC.
38209
38210 2022-06-13  Tom de Vries  <tdevries@suse.de>
38211
38212         [gdb/testsuite] Handle quotes in gdb_py_module_available
38213         On openSUSE Leap 42.3 with python 3.4, I run into:
38214         ...
38215         (gdb) python import pygments^M
38216         Traceback (most recent call last):^M
38217           File "<string>", line 1, in <module>^M
38218         ImportError: No module named 'pygments'^M
38219         Error while executing Python code.^M
38220         (gdb) FAIL: gdb.base/style.exp: python import pygments
38221         ERROR: unexpected output from python import
38222         ...
38223         because gdb_py_module_available doesn't handle the single quotes around the
38224         module name in the ImportError.
38225
38226         Fix this by allowing the single quotes.
38227
38228         Tested on x86_64-linux.
38229
38230 2022-06-13  Jan Beulich  <jbeulich@suse.com>
38231
38232         x86: fix incorrect indirection
38233         Commit 384e201e5aec ("x86: properly initialize struct instr_info
38234         instance(s)") was based on an improperly refreshed patch. Correct the
38235         oversight.
38236
38237 2022-06-13  Jan Beulich  <jbeulich@suse.com>
38238
38239         x86: replace global scratch buffer
38240         With its movement to the stack, and with the subsequent desire to
38241         initialize the entire instr_info instances, this has become doubly
38242         inefficient. Individual users have better knowledge of how big a buffer
38243         they need, and in a number of cases going through an intermediate buffer
38244         can be avoided altogether.
38245
38246         Having got confirmation that it wasn't intentional to print memory
38247         operand displacements with inconsistent style, print_displacement() is
38248         now using dis_style_address_offset consistently (eliminating the need
38249         for callers to pass in a style).
38250
38251         While touching print_operand_value() also convert its "hex" parameter to
38252         bool. And while altering (and moving) oappend_immediate(), fold
38253         oappend_maybe_intel_with_style() into its only remaining caller. Finally
38254         where doing adjustments, use snprintf() in favor of sprintf().
38255
38256 2022-06-13  Jan Beulich  <jbeulich@suse.com>
38257
38258         x86: avoid string copy when swapping Vex.W controlled operands
38259         Now that op_out[] is an array of pointers, there's no need anymore to
38260         copy strings. Simply swap the pointers.
38261
38262 2022-06-13  Jan Beulich  <jbeulich@suse.com>
38263
38264         x86: shrink prefix related disassembler state fields
38265         By changing the values used for "artificial" prefix values,
38266         all_prefixes[] can be shrunk to array of unsigned char. All that
38267         additionally needs adjusting is the printing of possible apparently
38268         standalone prefixes when recovering from longjmp(): Simply check
38269         whether any prefixes were successfully decoded, to avoid converting
38270         opcode bytes matching the "artificial" values to prefix mnemonics.
38271
38272         Similarly by re-arranging the bits assigned to PREFIX_* mask values
38273         we can fit all segment register masks in a byte and hence shrink
38274         active_seg_prefix to unsigned char.
38275
38276         Somewhat similarly with last_*_prefix representing offsets into the
38277         opcode being disassembled, signed char is sufficient to hold all possible
38278         values.
38279
38280 2022-06-13  Jan Beulich  <jbeulich@suse.com>
38281
38282         x86: properly initialize struct instr_info instance(s)
38283         Commit 39fb369834a3 ("opcodes: Make i386-dis.c thread-safe") introduced
38284         a lot of uninitialized data. Alan has in particular observed ubsan
38285         taking issue with the loop inverting the order of operands, where
38286         op_riprel[] - an array of bool - can hold values other than 0 or 1.
38287
38288         Move instantiation of struct instr_info into print_insn() (thus having
38289         just a single central point), and make use of C99 dedicated initializers
38290         to fill fields right in the initializer where possible. This way all
38291         fields not explicitly initialized will be zero-filled, which in turn
38292         allows dropping of some other explicit initialization later in the
38293         function or in ckprefix(). Additionally this removes a lot of
38294         indirection, as all "ins->info" uses can simply become "info".
38295
38296         Make one further arrangement though, to limit the amount of data needing
38297         (zero)initializing on every invocation: Convert the op_out structure
38298         member to just an array of pointers, with the actual arrays living
38299         inside print_insn() (and, as befoe, having just their 1st char filled
38300         with nul).
38301
38302         While there, instead of adjusting print_insn()'s forward declaration,
38303         arrange for no such declaration to be needed in the first place.
38304
38305 2022-06-13  GDB Administrator  <gdbadmin@sourceware.org>
38306
38307         Automatic date update in version.in
38308
38309 2022-06-12  Tom Tromey  <tom@tromey.com>
38310
38311         Fix self-test failure in addrmap
38312         Mark pointed out that my recent addrmap C++-ficiation changes caused a
38313         regression in the self-tests.  This patch fixes the problem by
38314         updating this test not to allocate the mutable addrmap on an obstack.
38315
38316         Remove psymtab_addrmap
38317         While working on addrmaps, I noticed that psymtab_addrmap is no longer
38318         needed now.  It was introduced in ancient times as an optimization for
38319         DWARF, but no other symbol reader was ever updated to use it.  Now
38320         that DWARF does not use psymtabs, it can be deleted.
38321
38322         Use malloc for mutable addrmaps
38323         Mutable addrmaps currently require an obstack.  This was probably done
38324         to avoid having to call splay_tree_delete, but examination of the code
38325         shows that all mutable obstacks have a limited lifetime -- now it's
38326         simple to treat them as ordinary C++ objects, in some cases
38327         stack-allocating them, and have a destructor to make the needed call.
38328         This patch implements this change.
38329
38330         Remove addrmap::create_fixed
38331         addrmap::create_fixed is just a simple wrapper for 'new', so remove it
38332         in favor of uses of 'new'.
38333
38334         Remove addrmap_create_mutable
38335         This removes addrmap_create_mutable in favor of using 'new' at the
38336         spots where the addrmap is created.
38337
38338         Remove addrmap wrapper functions
38339         This removes the various addrmap wrapper functions in favor of simple
38340         method calls on the objects themselves.
38341
38342         Move addrmap classes to addrmap.h
38343         This moves the addrmap class definitions to addrmap.h.  This is safe
38344         to do now that the contents are private.
38345
38346         Privacy for addrmap_mutable
38347         This changes addrmap_mutable so that its data members are private.
38348
38349         Privacy for addrmap_fixed
38350         This changes addrmap_fixed so that its data members are private.
38351         It also makes struct addrmap_transition private as well.
38352
38353         Use inheritance for addrmap
38354         This is a simply C++-ification of the basics of addrmap: it uses
38355         virtual methods rather than a table of function pointers, and it
38356         changes the concrete implementations to be subclasses.
38357
38358 2022-06-12  Jon Turney  <jon.turney@dronecode.org.uk>
38359
38360         Trivial fixes to Cygwin build after 8fea1a81
38361         * Remove a stray semicolon
38362         * Restore dropped nullptr program argument in use of create_process() under CYGWIN
38363
38364         Simplify __USEWIDE
38365         Prior to c6ca3dab dropping support for Cygwin 1.5, __USEWIDE was not
38366         defined for Cygwin 1.5.  After that, it's always defined if __CYGWIN__
38367         is, so remove __USEWIDE conditionals inside __CYGWIN__ conditionals.
38368
38369         Simplify cygwin_buf_t
38370         Prior to c6ca3dab dropping support for Cygwin 1.5, cygwin_buf_t was
38371         defined as char for Cygwin 1.5.  After that, it's always wchar_t, so
38372         just use that.
38373
38374 2022-06-12  GDB Administrator  <gdbadmin@sourceware.org>
38375
38376         Automatic date update in version.in
38377
38378 2022-06-11  GDB Administrator  <gdbadmin@sourceware.org>
38379
38380         Automatic date update in version.in
38381
38382 2022-06-10  Tom Tromey  <tom@tromey.com>
38383
38384         Fix warning-avoidance initialization in xcoffread.c
38385         With the registry rewrite series, on Fedora 34, I started seeing this
38386         error in xcoffread.c:
38387
38388         ../../binutils-gdb/gdb/xcoffread.c: In function ‘void read_xcoff_symtab(objfile*, legacy_psymtab*)’:
38389         ../../binutils-gdb/gdb/xcoffread.c:948:25: error: ‘main_aux’ is used uninitialized [-Werror=uninitialized]
38390           948 |   union internal_auxent fcn_aux_saved = main_aux;
38391               |                         ^~~~~~~~~~~~~
38392         ../../binutils-gdb/gdb/xcoffread.c:933:25: note: ‘main_aux’ declared here
38393           933 |   union internal_auxent main_aux;
38394               |                         ^~~~~~~~
38395
38396         I don't know why this error started suddenly... that seems weird,
38397         because it's not obviously related to the changes I made.
38398
38399         Looking into it, it seems this line was intended to avoid a similar
38400         warning -- but since 'main_aux' is uninitialized at the point where it
38401         is used, this fix was incomplete.
38402
38403         This patch avoids the warning by initializing using "{}".  I'm
38404         checking this in.
38405
38406 2022-06-10  Carl Love  <cel@us.ibm.com>
38407
38408         Fix comparison of unsigned long int to int in record_linux_system_call.
38409         The if statement in case gdb_sys_ioctl in function
38410         record_linux_system_call in file gdb/linux-record.c is as follows:
38411
38412            if (tmpulongest == tdep->ioctl_FIOCLEX
38413               || tmpulongest == tdep->ioctl_FIONCLEX
38414             ....
38415               || tmpulongest == tdep->ioctl_TCSETSW
38416              ...
38417            }
38418
38419         The PowerPC ioctl value for ioctl_TCSETW is 0x802c7415.  The variable
38420         ioctl_TCSETW is defined in gdb/linux-record.h as an int.  The TCSETW value
38421         has the MSB set to one so it is a negative integer.  The comparison of the
38422         unsigned long value tmpulongest to a negative integer value for
38423         ioctl_TCSETSW fails.
38424
38425         This patch changes the declarations for the ioctl_* values in struct
38426         linux_record_tdep to unsigned long to fix the comparisons between
38427         tmpulongest and the tdep->ioctl_* values.
38428
38429         An additional test gdb.reverse/test_ioctl_TCSETSW.exp is added to verify
38430         the gdb record_linux_system_call() if statement for the ioctl TCSETSW
38431         succeeds.
38432
38433         This patch has been tested on Power 10 and Intel with no test failures.
38434
38435 2022-06-10  Carl Love  <cel@us.ibm.com>
38436
38437         PowerPC, correct the gdb ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF.
38438         Some of the ioctl numbers are based on the size of kernel termios structure.
38439         Currently the PowerPC GDB definitions are "hard coded" into the ioctl
38440         number.
38441
38442         The current PowerPC values for TCGETS, TCSETS, TCSETSW and TCSETSF are
38443         defined in gdb/ppc-linux-tdep.c as:
38444
38445           record_tdep->ioctl_TCGETS = 0x403c7413;
38446           record_tdep->ioctl_TCSETS = 0x803c7414;
38447           record_tdep->ioctl_TCSETSW = 0x803c7415;
38448           record_tdep->ioctl_TCSETSF = 0x803c7416;
38449
38450         Where the termios structure size is in hex digits [5:4] as 0x3c.
38451
38452         The definition for the PowerPC termios structure is given in:
38453           arch/powerpc/include/uapi/asm/termbits.h
38454
38455         The size of the termios data structure in this file is 0x2c not 0x3c.
38456
38457         This patch changes the hex digits for the size of the PowerPC termios size
38458         in the ioctl values for TCGETS, TCSETS, TCSETSW and TCSETSF to 0x2c.
38459         This patch also changes the hard coding to generate the number based on a
38460         it easier to update the ioctl numbers.
38461
38462 2022-06-10  Andrew Burgess  <aburgess@redhat.com>
38463
38464         gdb/testsuite: remove definition of true/false from gdb_compiler_info
38465         Since pretty much forever the get_compiler_info function has included
38466         these lines:
38467
38468             # Most compilers will evaluate comparisons and other boolean
38469             # operations to 0 or 1.
38470             uplevel \#0 { set true 1 }
38471             uplevel \#0 { set false 0 }
38472
38473         These define global variables true (to 1) and false (to 0).
38474
38475         It seems odd to me that these globals are defined in
38476         get_compiler_info, I guess maybe the original thinking was that if a
38477         compiler had different true/false values then we would detect it there
38478         and define true/false differently.
38479
38480         I don't think we should be bundling this logic into get_compiler_info,
38481         it seems weird to me that in order to use $true/$false a user needs to
38482         first call get_compiler_info.
38483
38484         It would be better I think if each test script that wants these
38485         variables just defined them itself, if in the future we did need
38486         different true/false values based on compiler version then we'd just
38487         do:
38488
38489           if { [test_compiler_info "some_pattern"] } {
38490             # Defined true/false one way...
38491           } else {
38492             # Defined true/false another way...
38493           }
38494
38495         But given the current true/false definitions have been in place since
38496         at least 1999, I suspect this will not be needed any time soon.
38497
38498         Given that the definitions of true/false are so simple, right now my
38499         suggestion is just to define them in each test script that wants
38500         them (there's not that many).  If we ever did need more complex logic
38501         then we can always add a function in gdb.exp that sets up these
38502         globals, but that seems overkill for now.
38503
38504         There should be no change in what is tested after this commit.
38505
38506 2022-06-10  Luis Machado  <luis.machado@arm.com>
38507
38508         Document the ARM_CC_FOR_TARGET testsuite variable
38509         This variable is useful when exercising AArch64 multi-arch support (debugging
38510         32-bit AArch32 executables).
38511
38512         Unfortunately it isn't well documented. This patch adds information about it
38513         and explains how to use it.
38514
38515 2022-06-10  Tom de Vries  <tdevries@suse.de>
38516
38517         [gdb/testsuite] Fix XPASS with gcc-12 in gdb.base/vla-struct-fields.exp
38518         With gcc-12, I get for test-case gdb.base/vla-struct-fields.exp:
38519         ...
38520         (gdb) print inner_vla_struct_object_size == sizeof(inner_vla_struct_object)^M
38521         $7 = 1^M
38522         (gdb) XPASS: gdb.base/vla-struct-fields.exp: size of inner_vla_struct_object
38523         ...
38524
38525         Fix this by limiting the xfailing to gcc-11 and earlier.  Also, limit the
38526         xfailing to the equality test.
38527
38528         Tested on x86_64-linux.
38529
38530 2022-06-10  Tom de Vries  <tdevries@suse.de>
38531
38532         [gdb/testsuite] Fix timeout in gdb.ada/ghost.exp
38533         On openSUSE Tumbleweed with gcc-12, I run into a timeout:
38534         ...
38535         (gdb) print value^M
38536         Multiple matches for value^M
38537         [0] cancel^M
38538         [1] ada.strings.maps.value (<ref> ada.strings.maps.character_mapping; \
38539             character) return character at a-strmap.adb:599^M
38540         [2] pck.value at src/gdb/testsuite/gdb.ada/ghost/pck.ads:17^M
38541         [3] system.object_reader.value (<ref> system.object_reader.object_symbol) \
38542             return system.object_reader.uint64 at s-objrea.adb:2279^M
38543         [4] system.traceback.symbolic.value (system.address) return string at \
38544             s-trasym.adb:200^M
38545         > FAIL: gdb.ada/ghost.exp: print value (timeout)
38546         print ghost_value^M
38547         Argument must be choice number^M
38548         (gdb) FAIL: gdb.ada/ghost.exp: print ghost_value
38549         ...
38550
38551         Fix this by prefixing value (as well as the other printed values) with the
38552         package name:
38553         ...
38554         (gdb) print pck.value^M
38555         ...
38556
38557         Tested on x86_64-linux.
38558
38559         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29055
38560
38561 2022-06-10  GDB Administrator  <gdbadmin@sourceware.org>
38562
38563         Automatic date update in version.in
38564
38565 2022-06-09  Tom Tromey  <tromey@adacore.com>
38566
38567         Minor fix to Python breakpoint event documentation
38568         I noticed that the Python event documentation referred to the event's
38569         "breakpoint" field as a function, whereas it is actually an attribute.
38570         This patch fixes the error.
38571
38572 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38573
38574         gdb/aarch64: fix 32-bit arm compatibility
38575         GDB's ability to run 32-bit ARM processes on an AArch64 native target
38576         is currently broken.  The test gdb.multi/multi-arch.exp currently
38577         fails with a timeout.
38578
38579         The cause of these problems is the following three functions:
38580
38581           aarch64_linux_nat_target::thread_architecture
38582           aarch64_linux_nat_target::fetch_registers
38583           aarch64_linux_nat_target::store_registers
38584
38585         What has happened, over time, is that these functions have been
38586         modified, forgetting that any particular thread (running on the native
38587         target) might be an ARM thread, or might be an AArch64 thread.
38588
38589         The problems always start with a line similar to this:
38590
38591           aarch64_gdbarch_tdep *tdep
38592             = (aarch64_gdbarch_tdep *) gdbarch_tdep (inf->gdbarch);
38593
38594         The problem with this line is that if 'inf->gdbarch' is an ARM
38595         architecture, then gdbarch_tdep will return a pointer to an
38596         arm_gdbarch_tdep object, not an aarch64_gdbarch_tdep object.  The
38597         result of the above cast will, as a consequence, be undefined.
38598
38599         In aarch64_linux_nat_target::thread_architecture, after the undefined
38600         cast we then proceed to make use of TDEP, like this:
38601
38602           if (vq == tdep->vq)
38603             return inf->gdbarch;
38604
38605         Obviously at this point the result is undefined, but, if this check
38606         returns false we then proceed with this code:
38607
38608           struct gdbarch_info info;
38609           info.bfd_arch_info = bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_aarch64);
38610           info.id = (int *) (vq == 0 ? -1 : vq);
38611           return gdbarch_find_by_info (info);
38612
38613         As a consequence we will return an AArch64 gdbarch object for our ARM
38614         thread!  Things go downhill from there on.
38615
38616         There are similar problems, with similar undefined behaviour, in the
38617         fetch_registers and store_registers functions.
38618
38619         The solution is to make use of a check like this:
38620
38621           if (gdbarch_bfd_arch_info (inf->gdbarch)->bits_per_word == 32)
38622
38623         If the word size is 32 then we know we have an ARM architecture.  We
38624         just need to make sure that we perform this check before trying to
38625         read the tdep field.
38626
38627         In aarch64_linux_nat_target::thread_architecture a little reordering,
38628         and the addition of the above check allows us to easily avoid the
38629         undefined behaviour.
38630
38631         For fetch_registers and store_registers I made the decision to split
38632         each of the functions into two new helper functions, and so
38633         aarch64_linux_nat_target::fetch_registers now calls to either
38634         aarch64_fetch_registers or aarch32_fetch_registers, and there's a
38635         similar change for store_registers.
38636
38637         One thing I had to decide was whether to place the new aarch32_*
38638         functions into the aarch32-linux-nat.c file.  In the end I decided to
38639         NOT place the functions there, but instead leave them in
38640         aarch64-linux-nat.c, my reasoning was this:
38641
38642         The existing functions in that file are shared from arm-linux-nat.c
38643         and aarch64-linux-nat.c, this generic code to support 32-bit ARM
38644         debugging from either native target.
38645
38646         In contrast, the two new aarch32 functions I have added _only_ make
38647         sense when debugging on an AArch64 native target.  These function
38648         shouldn't be called from arm-linux-nat.c at all, and so, if we places
38649         the functions into aarch32-linux-nat.c, the functions would be built
38650         into a 32-bit ARM GDB, but never used.
38651
38652         With that said, there's no technical reason why they couldn't go in
38653         aarch32-linux-nat.c, so if that is preferred I'm happy to move them.
38654
38655         After this commit the gdb.multi/multi-arch.exp passes.
38656
38657 2022-06-09  Yvan Roux  <yvan.roux@foss.st.com>
38658
38659         gdb/arm: Document and fix exception stack offsets
38660         Add a description of exception entry context stacking and fix next
38661         frame offset (at 0xA8 relative to R0 location) as well as FPU
38662         registers ones (starting at 0x68 relative to R0).
38663
38664         gdb/arm: Simplify logic for updating addresses
38665         Small performance improvement by fetching previous SP value only
38666         once before the loop and reuse it to avoid fetching at every
38667         iteration.
38668
38669 2022-06-09  Pedro Alves  <pedro@palves.net>
38670
38671         Fix ARM_CC_FOR_TARGET handling
38672         The previous patch that introduced the arm_cc_for_target procedure
38673         moved the ARM_CC_FOR_TARGET global check to that procedure, but forgot
38674         to tell tcl that ARM_CC_FOR_TARGET is a global.  As a result,
38675         specifying ARM_CC_FOR_TARGET on the command line actually does
38676         nothing.  This fixes it.
38677
38678         Change-Id: I4e33b7633fa665e2f7b8f8c9592a949d74a19153
38679
38680 2022-06-09  Yvan Roux  <yvan.roux@foss.st.com>
38681
38682         gdb/arm: Terminate unwinding when LR is 0xffffffff
38683         ARMv7-M Architecture Reference "A2.3.1 Arm core registers" states
38684         that LR is set to 0xffffffff on reset.
38685
38686         ARMv8-M Architecture Reference "B3.3 Registers" states that LR is set
38687         to 0xffffffff on warm reset if Main Extension is implemented,
38688         otherwise the value is unknown.
38689
38690 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38691
38692         gdb/testsuite: solve problems with compiler_info caching
38693         After this commit:
38694
38695           commit 44d469c5f85a4243462b8966722dafa62b602bf5
38696           Date:   Tue May 31 16:43:44 2022 +0200
38697
38698               gdb/testsuite: add Fortran compiler identification to GDB
38699
38700         Some regressions were noticed:
38701
38702           https://sourceware.org/pipermail/gdb-patches/2022-May/189673.html
38703
38704         The problem is associated with how compiler_info variable is cached
38705         between calls to get_compiler_info.
38706
38707         Even before the above commit, get_compiler_info supported two
38708         language, C and C++.  Calling get_compiler_info would set the global
38709         compiler_info based on the language passed as an argument to
38710         get_compiler_info, and, in theory, compiler_info would not be updated
38711         for the rest of the dejagnu run.
38712
38713         This obviously is slightly broken behaviour.  If the first call to
38714         get_compiler_info was for the C++ language then compiler_info would be
38715         set based on the C++ compiler in use, while if the first call to
38716         get_compiler_info was for the C language then compiler_info would be
38717         set based on the C compiler.
38718
38719         This probably wasn't very noticable, assuming a GCC based test
38720         environment then in most cases the C and C++ compiler would be the
38721         same version.
38722
38723         However, if the user starting playing with CC_FOR_TARGET or
38724         CXX_FOR_TARGET, then they might not get the behaviour they expect.
38725
38726         Except, to make matters worse, most of the time, the user probably
38727         would get the behaviour they expected .... except when they didn't!
38728         I'll explain:
38729
38730         In gdb.exp we try to avoid global variables leaking between test
38731         scripts, this is done with the help of the two procs
38732         gdb_setup_known_globals and gdb_cleanup_globals.  All known globals
38733         are recorded before a test script starts, and then, when the test
38734         script ends, any new globals are deleted.
38735
38736         Normally, compiler_info is only set as a result of a test script
38737         calling get_compiler_info or test_compiler_info.  This means that the
38738         compiler_info global will not exist when the test script starts, but
38739         will exist when the test script end, and so, the compiler_info
38740         variable is deleted at the end of each test.
38741
38742         This means that, in reality, the compiler_info is recalculated once
38743         for each test script, hence, if a test script just checks on the C
38744         compiler, or just checks on the C++ compiler, then compiler_info will
38745         be correct and the user will get the behaviour they expect.
38746
38747         However, if a single test script tries to check both the C and C++
38748         compiler versions then this will not work (even before the above
38749         commit).
38750
38751         The situation is made worse be the behaviour or the load_lib proc.
38752         This proc (provided by dejagnu) will only load each library once.
38753         This means that if a library defines a global, then this global would
38754         normally be deleted at the end of the first test script that includes
38755         the library.
38756
38757         As future attempts to load the library will not actually reload it,
38758         then the global will not be redefined and would be missing for later
38759         test scripts that also tried to load that library.
38760
38761         To work around this issue we override load_lib in gdb.exp, this new
38762         version adds all globals from the newly loaded library to the list of
38763         globals that should be preserved (not deleted).
38764
38765         And this is where things get interesting for us.  The library
38766         trace-support.exp includes calls, at the file scope, to things like
38767         is_amd64_regs_target, which cause get_compiler_info to be called.
38768         This means that after loading the library the compiler_info global is
38769         defined.
38770
38771         Our override of load_lib then decides that this new global has to be
38772         preserved, and adds it to the gdb_persistent_globals array.
38773
38774         From that point on compiler_info will never be recomputed!
38775
38776         This commit addresses all the caching problems by doing the following:
38777
38778         Change the compiler_info global into compiler_info_cache global.  This
38779         new global is an array, the keys of this array will be each of the
38780         supported languages, and the values will be the compiler version for
38781         that language.
38782
38783         Now, when we call get_compiler_info, if the compiler information for
38784         the specific language has not been computed, then we do that, and add
38785         it to the cache.
38786
38787         Next, compiler_info_cache is defined by calling
38788         gdb_persistent_global.  This automatically adds the global to the list
38789         of persistent globals.  Now the cache will not be deleted at the end
38790         of each test script.
38791
38792         This means that, for a single test run, we will compute the compiler
38793         version just once for each language, this result will then be cached
38794         between test scripts.
38795
38796         Finally, the legacy 'gcc_compiled' flag is now only set when we call
38797         get_compiler_info with the language 'c'.  Without making this change
38798         the value of 'gcc_compiled' would change each time a new language is
38799         passed to get_compiler_info.  If the last language was e.g. Fortran,
38800         then gcc_compiled might be left false.
38801
38802 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38803
38804         gdb/testsuite: handle errors better in test_compiler_info
38805         Now that get_compiler_info might actually fail (if the language is not
38806         handled), then we should try to handle this failure better in
38807         test_compiler_info.
38808
38809         After this commit, if get_compiler_info fails then we will return a
38810         suitable result depending on how the user called test_compiler_info.
38811
38812         If the user does something like:
38813
38814           set version [test_compiler_info "" "unknown-language"]
38815
38816         Then test_compiler_info will return an empty string.  My assumption is
38817         that the user will be trying to match 'version' against something, and
38818         the empty string hopefully will not match.
38819
38820         If the user does something like:
38821
38822           if { [test_compiler_info "some_pattern" "unknown-language"] } {
38823             ....
38824           }
38825
38826         Then test_compiler_info will return false which seems the obvious
38827         choice.
38828
38829         There should be no change in the test results after this commit.
38830
38831 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38832
38833         gdb/testsuite: make 'c' default language for get/test compiler info
38834         This commit is a minor cleanup for the two functions (in gdb.exp)
38835         get_compiler_info and test_compiler_info.
38836
38837         Instead of using the empty string as the default language, and just
38838         "knowing" that this means the C language.  Make this explicit.  The
38839         language argument now defaults to "c" if not specified, and the if
38840         chain in get_compiler_info that checks the language not explicitly
38841         handles "c" and gives an error for unknown languages.
38842
38843         This is a good thing, now that the API appears to take a language, if
38844         somebody does:
38845
38846           test_compiler_info "xxxx" "rust"
38847
38848         to check the version of the rust compiler then we will now give an
38849         error rather than just using the C compiler and leaving the user
38850         having to figure out why they are not getting the results they
38851         expect.
38852
38853         After a little grepping, I think the only place we were explicitly
38854         passing the empty string to either get_compiler_info or
38855         test_compiler_info was in gdb_compile_shlib_1, this is now changed to
38856         pass "c" as the default language.
38857
38858         There should be no changes to the test results after this commit.
38859
38860 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38861
38862         gdb/testsuite: remove get_compiler_info calls from gdb.exp and dwarf.exp
38863         We don't need to call get_compiler_info before calling
38864         test_compiler_info; test_compiler_info includes a call to
38865         get_compiler_info.
38866
38867         This commit cleans up lib/gdb.exp and lib/dwarf.exp a little by
38868         removing some unneeded calls to get_compiler_info.  We could do the
38869         same cleanup throughout the testsuite, but I'm leaving that for
38870         another day.
38871
38872         There should be no change in the test results after this commit.
38873
38874 2022-06-09  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
38875
38876         gdb/testsuite: use test_compiler_info in gcc_major_version
38877         The procedure gcc_major_version was earlier using the global variable
38878         compiler_info to retrieve gcc's major version.  This is discouraged and
38879         (as can be read in a comment in compiler.c) compiler_info should be
38880         local to get_compiler_info and test_compiler_info.
38881
38882         The preferred way of getting the compiler string is via calling
38883         test_compiler_info without arguments.  Gcc_major_version was changed to
38884         do that.
38885
38886 2022-06-09  Yvan Roux  <yvan.roux@foss.st.com>
38887
38888         gdb: add Yvan Roux to gdb/MAINTAINERS
38889
38890 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38891
38892         gdb/testsuite: resolve duplicate test names in gdb.threads/tls.exp
38893         While running the gdb.threads/tls.exp test with a GDB configured
38894         without Python, I noticed some duplicate test names.
38895
38896         This is caused by a call to skip_python_tests that is within a proc
38897         that is called multiple times by the test script.  Each call to
38898         skip_python_tests results in a call to 'unsupported', and this causes
38899         the duplicate test names.
38900
38901         After this commit we now call skip_python_tests just once and place
38902         the result into a variable.  Now, instead of calling skip_python_tests
38903         multiple times, we just check the variable.
38904
38905         There should be no change in what is tested after this commit.
38906
38907 2022-06-09  Andrew Burgess  <aburgess@redhat.com>
38908
38909         gdb/testsuite: resolve duplicate test name in gnu_vector.exp
38910         While testing on AArch64 I spotted a duplicate test name in the
38911         gdb.base/gnu_vector.exp test.
38912
38913         This commit adds a 'with_test_prefix' to resolve the duplicate.
38914
38915         While I was in the area I updated a 'gdb_test_multiple' call to make
38916         use of $gdb_test_name.
38917
38918         There should be no change in what is tested after this commit.
38919
38920 2022-06-09  GDB Administrator  <gdbadmin@sourceware.org>
38921
38922         Automatic date update in version.in
38923
38924 2022-06-08  Andrew Burgess  <aburgess@redhat.com>
38925
38926         gdb: make throw_perror_with_name static
38927         The throw_perror_with_name function is not used outside of utils.c
38928         right now.  And as perror_with_name is just a wrapper around
38929         throw_perror_with_name, then any future calls would be to
38930         perror_with_name.
38931
38932         Lets make throw_perror_with_name static.
38933
38934         There should be no user visible changes after this commit.
38935
38936 2022-06-08  Andrew Burgess  <aburgess@redhat.com>
38937
38938         gdb: remove trailing '.' from perror_with_name calls
38939         I ran into this error while working on AArch64 GDB:
38940
38941           Unable to fetch VFP registers.: Invalid argument.
38942
38943         Notice the '.:' in the middle of this error message.
38944
38945         This is because of this call in aarch64-linux-nat.c:
38946
38947           perror_with_name (_("Unable to fetch VFP registers."));
38948
38949         The perror_with_name function take a string, and adds ': <message>' to
38950         the end the string, so I don't think the string that we pass to
38951         perror_with_name should end in '.'.
38952
38953         This commit removes all of the trailing '.' characters from
38954         perror_with_name calls, which give more readable error messages.
38955
38956         I don't believe that any of these errors are tested in the
38957         testsuite (after a little grepping).
38958
38959 2022-06-08  Tom Tromey  <tom@tromey.com>
38960
38961         Move CU queue to dwarf2_per_objfile
38962         The CU queue is a member of dwarf2_per_bfd, but it is only used when
38963         expanding CUs.  Also, the dwarf2_per_objfile destructor checks the
38964         queue -- however, if the per-BFD object is destroyed first, this will
38965         not work.  This was pointed out Lancelot as fallout from the patch to
38966         rewrite the registry system.
38967
38968         This patch avoids this problem by moving the queue to the per-objfile
38969         object.
38970
38971 2022-06-08  Tom Tromey  <tom@tromey.com>
38972
38973         Change allocation of m_dwarf2_cus
38974         m_dwarf2_cus manually manages the 'dwarf2_cu' pointers it owns.  This
38975         patch simplifies the code by changing it to use unique_ptr.
38976
38977 2022-06-08  Andrew Burgess  <aburgess@redhat.com>
38978
38979         libopcodes: extend the styling within the i386 disassembler
38980         The i386 disassembler is pretty complex.  Most disassembly is done
38981         indirectly; operands are built into buffers within a struct instr_info
38982         instance, before finally being printed later in the disassembly
38983         process.
38984
38985         Sometimes the operand buffers are built in a different order to the
38986         order in which they will eventually be printed.
38987
38988         Each operand can contain multiple components, e.g. multiple registers,
38989         immediates, other textual elements (commas, brackets, etc).
38990
38991         When looking for how to apply styling I guess the ideal solution would
38992         be to move away from the operands being a single string that is built
38993         up, and instead have each operand be a list of "parts", where each
38994         part is some text and a style.  Then, when we eventually print the
38995         operand we would loop over the parts and print each part with the
38996         correct style.
38997
38998         But it feels like a huge amount of work to move from where we are
38999         now to that potentially ideal solution.  Plus, the above solution
39000         would be pretty complex.
39001
39002         So, instead I propose a .... different solution here, one that works
39003         with the existing infrastructure.
39004
39005         As each operand is built up, piece be piece, we pass through style
39006         information.  This style information is then encoded into the operand
39007         buffer (see below for details).  After this the code can continue to
39008         operate as it does right now in order to manage the set of operand
39009         buffers.
39010
39011         Then, as each operand is printed we can split the operand buffer into
39012         chunks at the style marker boundaries, with each chunk being printed
39013         with the correct style.
39014
39015         For encoding the style information I use a single character, currently
39016         \002, followed by the style encoded as a single hex digit, followed
39017         again by the \002 character.
39018
39019         This of course relies on there not being more than 16 styles, but that
39020         is currently true, and hopefully will remain true for the foreseeable
39021         future.
39022
39023         The other major concern that has arisen around this work is whether
39024         the escape character could ever be encountered in output naturally
39025         generated by the disassembler.  If this did happen then the escape
39026         characters would be stripped from the output, and the wrong styling
39027         would be applied.
39028
39029         However, I don't believe that this is currently a problem.
39030         Disassembler content comes from a number of sources.  First there's
39031         content that copied directly from the i386-dis.c file, this is things
39032         like register names, and other syntax elements (brackets, commas,
39033         etc).  We can easily check that the i386-dis.c file doesn't contain
39034         our special character.
39035
39036         The next source of content are immediate operands.  The text for these
39037         operands is generated by calls into libc.  By selecting a
39038         non-printable character we can be confident that this is not something
39039         that libc will generate as part of an immediate representation.
39040
39041         The other output that appears to be from the disassembler is operands
39042         that contain addresses and (possibly) symbol names.  It is quite
39043         possible that a symbol name might contain any special character we
39044         could imagine, so is this a problem?
39045
39046         I don't think it is, we don't actually print address and symbol
39047         operands through the disassembler, instead, the disassembler calls
39048         back to the user (objdump, gdb, etc) to print the address and symbol
39049         on its behalf.  This content is printed directly to the output stream,
39050         it does not pass through the i386 disassembler output buffers.  As a
39051         result, we never check this particular output for styling escape
39052         characters.
39053
39054         In some (not very scientific) benchmarking on my machine,
39055         disassembling a reasonably large (142M) shared library, I'm not seeing
39056         any significant slow down in disassembler speed with this change.
39057
39058         Most instructions are now being fully syntax highlighted when I
39059         disassemble using the --disassembler-color=extended-color option.  I'm
39060         sure that there are probably still a few corner cases that need fixing
39061         up, but we can come back to them later I think.
39062
39063         When disassembler syntax highlighting is not being used, then there
39064         should be no user visible changes after this commit.
39065
39066 2022-06-08  Carl Love  <cel@us.ibm.com>
39067
39068         Fix gdb.arch/powerpc-power7.exp isel disassembly output.
39069         The following commit changes the output format for the isel instruction on
39070         PowerPC.
39071
39072            commit dd4832bf3efc1bd1797a6b9188260692b8b0db52     Introduces error in test
39073            Author: Dmitry Selyutin <ghostmansd@gmail.com>
39074            Date:   Tue May 24 13:46:35 2022 +0000
39075
39076                opcodes: introduce BC field; fix isel
39077
39078                Per Power ISA Version 3.1B 3.3.12, isel uses BC field rather than CRB
39079                field present in binutils sources. Also, per 1.6.2, BC has the same
39080                semantics as BA and BB fields, so this should keep the same flags and
39081                mask, only with the different offset.
39082
39083                opcodes/
39084                        * ppc-opc.c
39085                        (BC): Define new field, with the same definition as CRB field,
39086                        but with the PPC_OPERAND_CR_BIT flag present.
39087                gas/
39088                        * testsuite/gas/ppc/476.d: Update.
39089                        * testsuite/gas/ppc/a2.d: Update.
39090                        * testsuite/gas/ppc/e500.d: Update.
39091                        * testsuite/gas/ppc/power7.d: Update.
39092           <snip>
39093            --- a/gas/testsuite/gas/ppc/476.d
39094            +++ b/gas/testsuite/gas/ppc/476.d
39095            @@ -209,7 +209,7 @@ Disassembly of section \.text:
39096             .*:    (7c 20 07 8c|8c 07 20 7c)       ici     1
39097             .*:    (7c 03 27 cc|cc 27 03 7c)       icread  r3,r4
39098             .*:    (50 83 65 36|36 65 83 50)       rlwimi  r3,r4,12,20,27
39099             -.*:    (7c 43 27 1e|1e 27 43 7c)       isel    r2,r3,r4,28
39100             +.*:    (7c 43 27 1e|1e 27 43 7c)       isel    r2,r3,r4,4\*cr7\+lt
39101
39102         The above change breaks the gdb regression test gdb.arch/powerpc-power7.exp
39103         on Power 7, Power 8, Power 9 and Power 10.
39104
39105         This patch updates the regression test gdb.arch/powerpc-power7.exp with
39106         the new expected output for the isel instruction.
39107
39108         The patch has been tested on Power 7 and Power 10 to verify the patch fixes
39109         the test.
39110
39111 2022-06-08  Pedro Alves  <pedro@palves.net>
39112
39113         aarch64: Add fallback if ARM_CC_FOR_TARGET not set
39114         On Aarch64, you can set ARM_CC_FOR_TARGET to point to the 32-bit
39115         compiler to use when testing gdb.multi/multi-arch.exp and
39116         gdb.multi/multi-arch-exec.exp.  If you don't set it, then those
39117         testcases don't run.
39118
39119         I guess that approximately nobody remembers to set ARM_CC_FOR_TARGET.
39120
39121         This commit adds a fallback.  If ARM_CC_FOR_TARGET is not set, and
39122         testing for Linux, try arm-linux-gnueabi-gcc,
39123         arm-none-linux-gnueabi-gcc, arm-linux-gnueabihf-gcc as 32-bit
39124         compilers, making sure that the produced executable runs on the target
39125         machine before claiming that the compiler produces useful executables.
39126
39127         Change-Id: Iefe5865d5fc84b4032eaff7f4c5c61582bf75c39
39128
39129 2022-06-08  Alan Modra  <amodra@gmail.com>
39130
39131         Don't encode reloc.size
39132         I expect the encoded reloc.size field originally came from aout
39133         r_length ecoding, but somehow went wrong for 64-bit relocs (which
39134         should have been encoded as 3).  Toss all that out, just use a byte
39135         size instead.  The changes outside of reloc.c in this patch should
39136         make the code independent of how reloc.size is encoded.
39137
39138                 * reloc.c (struct reloc_howto_struct): Increase size field by
39139                 one bit.  Comment.
39140                 (HOWTO_RSIZE): Don't encode size.
39141                 (bfd_get_reloc_size): Adjust, and make it an inline function.
39142                 (read_reloc, write_reloc): Adjust.
39143                 * bfd-in2.h: Regenerate.
39144                 * aout-ns32k.c: Include libbfd.h.
39145                 (put_reloc): Don't use howto->size directly.  Calculate r_length
39146                 using bfd_log2 and bfd_get_reloc_size.
39147                 * aoutx.h (swap_std_reloc_out): Likewise.
39148                 (aout_link_reloc_link_order): Likewise.
39149                 * i386lynx.c (swap_std_reloc_out
39150                 * mach-o-i386.c (bfd_mach_o_i386_swap_reloc_out
39151                 * pdp11.c (aout_link_reloc_link_order
39152                 * coff-arm.c (coff_arm_reloc): Don't use howto->size directly,
39153                 use bfd_get_reloc_size instead and adjust switch cases.
39154                 * coff-i386.c (coff_i386_reloc): Similarly.
39155                 * coff-x86_64.c (coff_amd64_reloc): Likewise.
39156                 * cpu-ns32k.c (do_ns32k_reloc): Likewise.
39157                 * elf32-arc.c (arc_do_relocation): Likewise.
39158                 * elf32-arm.c (elf32_arm_final_link_relocate): Likewise.
39159                 * elf32-bfin.c (bfin_bfd_reloc): Likewise.
39160                 * elf32-cr16.c (cr16_elf_final_link_relocate): Likewise.
39161                 * elf32-cris.c (cris_elf_pcrel_reloc): Likewise.
39162                 * elf32-crx.c (crx_elf_final_link_relocate): Likewise.
39163                 * elf32-csky.c (csky_elf_relocate_section): Likewise.
39164                 * elf32-d10v.c (extract_rel_addend, insert_rel_addend): Likewise.
39165                 * elf32-i386.c (elf_i386_relocate_section): Likewise.
39166                 * elf32-m32r.c (m32r_elf_generic_reloc): Likewise.
39167                 * elf32-nds32.c (nds32_elf_generic_reloc): Likewise.
39168                 * syms.c (_bfd_stab_section_find_nearest_line): Likewise.
39169                 * coff-rs6000.c (xcoff_ppc_relocate_section): Adjust howto.size.
39170                 * coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise.
39171
39172 2022-06-08  Alan Modra  <amodra@gmail.com>
39173
39174         bfin reloc offset checks
39175         These all ought to use bfd_reloc_offset_in_range.  In particular, replace
39176         the check using howto->size + 1u.
39177
39178                 * elf32-bfin.c (bfin_pcrel24_reloc): Use bfd_reloc_offset_in_range.
39179                 (bfin_imm16_reloc, bfin_byte4_reloc, bfin_bfd_reloc),
39180                 (bfin_final_link_relocate): Likewise.
39181
39182 2022-06-08  Alan Modra  <amodra@gmail.com>
39183
39184         Revert reloc howto nits
39185         The "HOWTO size encoding" patch put 1 as the HOWTO size arg for
39186         numerous howtos that are unused, describe dynamic relocs, are markers,
39187         or otherwise are special purpose reloc howtos that don't care about
39188         the size.  The idea was to ensure no howto changed by inspecting
39189         object files.  Revert those changes, making them zero size.
39190
39191                 * coff-alpha.c: Give special purpose reloc howtos a size of zero.
39192                 * coff-mcore.c, * elf-hppa.h, * elf-m10300.c, * elf32-arm.c,
39193                 * elf32-csky.c, * elf32-m32c.c, * elf32-m68k.c, * elf32-mep.c,
39194                 * elf32-mips.c, * elf32-ppc.c, * elf32-rx.c, * elf32-s390.c,
39195                 * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, *elf32-vax.c,
39196                 * elf32-xtensa.c, * elf64-alpha.c, * elf64-mips.c,
39197                 * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elfn32-mips.c,
39198                 * elfxx-loongarch.c, * elfxx-riscv.c, * elfxx-sparc.c,
39199                 * elfxx-tilegx.c, * som.c, * vms-alpha.c: Likewise.
39200
39201 2022-06-08  Alan Modra  <amodra@gmail.com>
39202
39203         HOWTO size encoding
39204         This changes the HOWTO macro to encode the howto.size field from a
39205         value given in bytes.  This of course requires editing all target
39206         uses of HOWTO, a major pain, but makes it a little nicer to specify
39207         new target HOWTOs.  Object files before/after this patch are
39208         unchanged in .data and .rodata.
39209
39210         bfd/
39211                 * reloc.c (HOWTO_RSIZE): Encode size in bytes.
39212                 (EMPTY_HOWTO): Adjust to keep it all zero.
39213                 * aout-ns32k.c, * aoutx.h, * coff-alpha.c, * coff-arm.c,
39214                 * coff-i386.c, * coff-mcore.c, * coff-mips.c, * coff-rs6000.c,
39215                 * coff-sh.c, * coff-tic30.c, * coff-tic4x.c, * coff-tic54x.c,
39216                 * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c,
39217                 * elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf32-arc.c,
39218                 * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
39219                 * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c,
39220                 * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
39221                 * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-gen.c,
39222                 * elf32-h8300.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c,
39223                 * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c,
39224                 * elf32-m68hc12.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c,
39225                 * elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c,
39226                 * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
39227                 * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c,
39228                 * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s12z.c,
39229                 * elf32-s390.c, * elf32-score.c, * elf32-score7.c,
39230                 * elf32-sh-relocs.h, * elf32-spu.c, * elf32-tic6x.c,
39231                 * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
39232                 * elf32-visium.c, * elf32-wasm32.c, * elf32-xc16x.c,
39233                 * elf32-xgate.c, * elf32-xstormy16.c, * elf32-xtensa.c,
39234                 * elf32-z80.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-gen.c,
39235                 * elf64-mips.c, * elf64-mmix.c, * elf64-nfp.c, * elf64-ppc.c,
39236                 * elf64-s390.c, * elf64-x86-64.c, * elfn32-mips.c,
39237                 * elfnn-aarch64.c, * elfxx-ia64.c, * elfxx-loongarch.c,
39238                 * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
39239                 * elfxx-tilegx.c, * mach-o-aarch64.c, * mach-o-arm.c,
39240                 * mach-o-i386.c, * mach-o-x86-64.c, * pdp11.c, * reloc.c,
39241                 * som.c, * vms-alpha.c: Adjust all uses of HOWTO.
39242                 * bfd-in2.h: Regenerate.
39243         include/
39244                 * elf/arc-reloc.def: Adjust all uses of HOWTO.
39245
39246 2022-06-08  Alan Modra  <amodra@gmail.com>
39247
39248         HOWTO_RSIZE
39249         Define a helper macro for HOWTO.
39250
39251                * reloc.c (HOWTO_RSIZE): Define.
39252                (HOWTO): Use it.
39253                * bfd-in2.h: Regenerate.
39254
39255 2022-06-08  Alan Modra  <amodra@gmail.com>
39256
39257         elf64-nfp reloc fix
39258         These are all dummy howtos, there is no reason one of them should
39259         have partial_inplace true.
39260
39261                 * elf64-nfp.c (elf_nfp_howto_table <R_NFP_IMMED_LO16_I_B>): Don't
39262                 set partial_inplace.
39263
39264 2022-06-08  Alan Modra  <amodra@gmail.com>
39265
39266         coff-z80 reloc howto fixes
39267         Mostly cosmetic unless attempting to link coff-z80 into another output
39268         format.
39269
39270                 * coff-z80.c (howto_table <R_IMM24, R_WORD0, R_WORD1>): Correct size.
39271                 (extra_case): Use bfd_{get,put}_24 when applying R_IMM24.
39272
39273 2022-06-08  Alan Modra  <amodra@gmail.com>
39274
39275         NONE reloc fixes
39276         Make them all zero size standard do-nothing howtos.
39277
39278                 * elf32-csky.c (csky_elf_howto_table <R_CKCORE_NONE>): Correct howto.
39279                 * elf32-ft32.c (ft32_elf_howto_table <R_FT32_NONE>): Likewise.
39280                 * elf32-gen.c (dummy): Likewise.
39281                 * elf32-nds32.c (none_howto): Likewise.
39282                 * elf32-nios2.c (elf_nios2_r2_howto_table_rel <R_NIOS2_NONE>):
39283                 Likewise.
39284                 * elf32-pru.c (elf_pru_howto_table_rel <R_PRU_NONE>): Likewise.
39285                 * elf32-v850.c (v800_elf_howto_table <R_V810_NONE>): Likewise.
39286                 * elf64-gen.c (dummy): Likewise.
39287                 * elfn32-mips.c (elf_mips_howto_table_rela <R_MIPS_NONE): Likewise.
39288                 * elfxx-mips.c (none_howto): Likewise.
39289                 * reloc.c (none_howto): Likewise.
39290
39291 2022-06-08  Alan Modra  <amodra@gmail.com>
39292
39293         asan: double free sb_kill
39294         oss-fuzz hits a flaky crash with a double-free.  I think this is due
39295         to gas static state not being reinitialised between testcases, a bug
39296         with oss-fuzz not gas.  Anyway, this patch should avoid the problem.
39297
39298                 * input-scrub.c (input_scrub_push): Move init of sb_index..
39299                 (input_scrub_reinit): ..to here.
39300
39301 2022-06-08  GDB Administrator  <gdbadmin@sourceware.org>
39302
39303         Automatic date update in version.in
39304
39305 2022-06-07  Tom Tromey  <tromey@adacore.com>
39306
39307         Use subclasses of windows_process_info
39308         This changes windows_process_info to use virtual methods for its
39309         callbacks, and then changes the two clients of this code to subclass
39310         this class to implement the methods.
39311
39312         I considered using CRTP here, but that would require making the new
39313         structures visible to the compilation of of nat/windows-nat.c.  This
39314         seemed like a bit of a pain, so I didn't do it.
39315
39316         This change then lets us change all the per-inferior globals to be
39317         members of the new subclass.  Note that there can still only be a
39318         single inferior -- currently there's a single global of the new type.
39319         This is just another step toward possibly implementing multi-inferior
39320         for Windows.
39321
39322         It's possible this could be cleaned up further... ideally I'd like to
39323         move more of the data into the base class.  However, because gdb
39324         supports Cygwin and gdbserver does not, and because I don't have a way
39325         to build or test Cygwin, larger refactorings are difficult.
39326
39327 2022-06-07  Tom Tromey  <tromey@adacore.com>
39328
39329         Turn some windows-nat.c static functions into methods
39330         This patch turns some windows-nat.c static functions into methods on
39331         windows_nat_target.  This avoids having to reference the
39332         windows_nat_target singleton in some more spots -- a minor code
39333         cleanup.
39334
39335         Allow ASLR to be disabled on Windows
39336         On Windows, it is possible to disable ASLR when creating a process.
39337         This patch adds code to do this, and hooks it up to gdb's existing
39338         disable-randomization feature.  Because the Windows documentation
39339         cautions that this isn't available on all versions of Windows, the
39340         CreateProcess wrapper function is updated to make the attempt, and
39341         then fall back to the current approach if it fails.
39342
39343         Introduce wrapper for CreateProcess
39344         This is a small refactoring that introduces a wrapper for the Windows
39345         CreateProcess function.  This is done to make the next patch a bit
39346         simpler.
39347
39348 2022-06-07  Enze Li  <enze.li@hotmail.com>
39349
39350         Update my email address in gdb/MAINTAINERS
39351
39352 2022-06-07  Tom Tromey  <tromey@adacore.com>
39353
39354         Constify solib_name_from_address
39355         I noticed that solib_name_from_address returned a non-const string,
39356         but it's more appropriate to return const.  This patch implements
39357         this.  Tested by rebuilding.
39358
39359 2022-06-07  Tom de Vries  <tdevries@suse.de>
39360
39361         [gdb/rust] Add missing _() for error call
39362         In commit 1390b65a1b9 ("[gdb/rust] Fix literal truncation") I forgot to add
39363         _() around a string using in an error call.
39364
39365         Fix this by adding the missing _().
39366
39367         Tested on x86_64-linux.
39368
39369 2022-06-07  Tom de Vries  <tdevries@suse.de>
39370
39371         [gdb] Allow frv::fr300 in selftests
39372         In skip_arch in gdb/selftest-arch.c we skip architecture fr300 because of
39373         PR20946, but the PR has been fixed by commit 0ae60c3ef45 ("Prevent an abort in
39374         the FRV disassembler if the target bfd name is unknown.") in Januari 2017.
39375
39376         Remove the skipping of frv::fr300.
39377
39378         Tested on x86_64-linux.
39379
39380 2022-06-07  GDB Administrator  <gdbadmin@sourceware.org>
39381
39382         Automatic date update in version.in
39383
39384 2022-06-06  Tom Tromey  <tromey@adacore.com>
39385
39386         Consolidate "Python API" sections in NEWS
39387         I noticed that the gdb NEWS file had two "Python API" sections in
39388         "Changes since GDB 12".  This patch consolidates the two.  I chose to
39389         preserve the second one, first because it is longer, and second
39390         because I felt that user command changes should come before API
39391         changes.
39392
39393         Simplify varobj "change" logic
39394         varobj used to store 'print_value' as a C string, where NULL was a
39395         valid value, and so it had logic to handle this situation.  However,
39396         at some point this was changed to be a std::string, and so the code
39397         can be simplified in this spot.
39398
39399 2022-06-06  Tom Tromey  <tromey@adacore.com>
39400
39401         Remove "-break-insert -r" tests
39402         PR mi/14270 points out that mi-break.exp has some tests for an
39403         unimplemented "-r" switch for "-break-insert".  This switch was never
39404         implemented, and is not documented -- though it is mentioned in a
39405         comment in the documentation.  This patch removes the test and the doc
39406         comment.
39407
39408         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=14270
39409
39410 2022-06-06  Tom de Vries  <tdevries@suse.de>
39411
39412         [gdb] Name arch selftests more clearly
39413         When running some all archs selftest I get:
39414         ...
39415         $ gdb -q -batch -ex "maint selftest unpack_field_as_long"
39416         Running selftest unpack_field_as_long::A6.
39417         ...
39418
39419         By now I know that A6 is an arc architecture, but for others that's less
39420         clear.
39421
39422         Fix this by using unpack_field_as_long::arc::A6 instead.
39423
39424         This then introduces redundant names like arm::arm, so try to avoid those,
39425         though I'm not entirely convinced that that's worth the trouble.
39426
39427         This introduces the following new names:
39428         ...
39429         +Running selftest unpack_field_as_long::am33_2::am33-2.
39430         +Running selftest unpack_field_as_long::arc::A6.
39431         +Running selftest unpack_field_as_long::arc::A7.
39432         +Running selftest unpack_field_as_long::arc::EM.
39433         +Running selftest unpack_field_as_long::arc::HS.
39434         +Running selftest unpack_field_as_long::arm::ep9312.
39435         +Running selftest unpack_field_as_long::arm::iwmmxt.
39436         +Running selftest unpack_field_as_long::arm::iwmmxt2.
39437         +Running selftest unpack_field_as_long::arm::xscale.
39438         +Running selftest unpack_field_as_long::bpf::xbpf.
39439         +Running selftest unpack_field_as_long::frv::fr400.
39440         +Running selftest unpack_field_as_long::frv::fr450.
39441         +Running selftest unpack_field_as_long::frv::fr500.
39442         +Running selftest unpack_field_as_long::frv::fr550.
39443         +Running selftest unpack_field_as_long::frv::simple.
39444         +Running selftest unpack_field_as_long::frv::tomcat.
39445         +Running selftest unpack_field_as_long::iq2000::iq10.
39446         +Running selftest unpack_field_as_long::m32c::m16c.
39447         +Running selftest unpack_field_as_long::mep::c5.
39448         +Running selftest unpack_field_as_long::mep::h1.
39449         +Running selftest unpack_field_as_long::nds32::n1.
39450         +Running selftest unpack_field_as_long::nds32::n1h.
39451         +Running selftest unpack_field_as_long::nds32::n1h_v2.
39452         +Running selftest unpack_field_as_long::nds32::n1h_v3.
39453         +Running selftest unpack_field_as_long::nds32::n1h_v3m.
39454         +Running selftest unpack_field_as_long::z80::ez80-adl.
39455         +Running selftest unpack_field_as_long::z80::ez80-z80.
39456         +Running selftest unpack_field_as_long::z80::gbz80.
39457         +Running selftest unpack_field_as_long::z80::r800.
39458         +Running selftest unpack_field_as_long::z80::z180.
39459         ...
39460
39461         Tested on x86_64-linux.
39462
39463 2022-06-06  Tom de Vries  <tdevries@suse.de>
39464
39465         [gdb] Enable some more print_one_insn selftests
39466         In print_one_insn_test we have this cluster of skipped tests:
39467         ...
39468             case bfd_arch_ia64:
39469             case bfd_arch_mep:
39470             case bfd_arch_mips:
39471             case bfd_arch_tic6x:
39472             case bfd_arch_xtensa:
39473               return;
39474         ...
39475
39476         Enable some of these, and document in more detail why they're enabled or
39477         skipped.
39478
39479         Likewise, document bfd_arch_or1k because it's an odd case.
39480
39481         Tested on x86_64-linux.
39482
39483 2022-06-06  Tom de Vries  <tdevries@suse.de>
39484
39485         [gdb] Fix maint selftest -v print_one_insn
39486         When running the print_one_insn selftests with -v, I get:
39487         ...
39488         $ gdb -q -batch -ex "maint selftest -v print_one_insn"
39489         Running selftest print_one_insn::A6.
39490         .shor   0x783eRunning selftest print_one_insn::A7.
39491         trap_s  0x1Running selftest print_one_insn::ARC600.
39492         .shor   0x783eRunning selftest print_one_insn::ARC601.
39493         Running selftest print_one_insn::ARC700.
39494         trap_s  0x1Running selftest print_one_insn::ARCv2.
39495         trap_s  0x1Running selftest print_one_insn::EM.
39496         trap_s  0x1Running selftest print_one_insn::HS.
39497         trap_s  0x1Running selftest print_one_insn::Loongarch32.
39498         ...
39499
39500         The insn is written to gdb_stdout, and there is code in the selftest to add a
39501         newline after the insn, which writes to stream().
39502
39503         The stream() ui_file points into a string buffer, which the disassembler uses
39504         before writing to gdb_stdout, so writing into it after the disassembler has
39505         finished has no effect.
39506
39507         Fix this by using gdb_stdlog and debug_printf (which is what the unit test
39508         infrastructure itself uses) instead, such that we have:
39509         ...
39510         Running selftest print_one_insn::A6.
39511         .shor   0x783e
39512         Running selftest print_one_insn::A7.
39513         trap_s  0x1
39514         Running selftest print_one_insn::ARC600.
39515         .shor   0x783e
39516         Running selftest print_one_insn::ARC601.
39517         Running selftest print_one_insn::ARC700.
39518         trap_s  0x1
39519         Running selftest print_one_insn::ARCv2.
39520         trap_s  0x1
39521         Running selftest print_one_insn::Loongarch32.
39522         ...
39523
39524         Note: I've also removed the printing of arch_name, which would give
39525         us otherwise the redundant:
39526         ...
39527         Running selftest print_one_insn::A6.
39528         arc .shor       0x783e
39529         Running selftest print_one_insn::A7.
39530         arc trap_s      0x1
39531         ...
39532
39533         Tested on x86_64-linux.
39534
39535 2022-06-06  Andrew Burgess  <aburgess@redhat.com>
39536
39537         gdb/testsuite: add missing skip_python_tests call in py-doc-reformat.exp
39538         In commit:
39539
39540           commit 51e8dbe1fbe7d8955589703140ca5eba7b4f1bd7
39541           Date:   Mon May 16 19:26:54 2022 +0100
39542
39543               gdb/python: improve formatting of help text for user defined commands
39544
39545         the test that was added (gdb.python/py-doc-reformat.exp) was missing a
39546         call to skip_python_tests.  As a result, this test would fail for any
39547         GDB built within Python support.
39548
39549         This commit adds a call to skip_python_tests.
39550
39551 2022-06-06  GDB Administrator  <gdbadmin@sourceware.org>
39552
39553         Automatic date update in version.in
39554
39555 2022-06-05  Tom Tromey  <tom@tromey.com>
39556
39557         Remove obsolete Python 2 comment
39558         I found a comment that referred to Python 2, but that is now obsolete
39559         -- the code it refers to is gone.  I'm checking in this patch to
39560         remove the comment.
39561
39562         There's a similar comment elsewhere, but I plan to remove that one in
39563         another patch I'm going to submit shortly.
39564
39565 2022-06-05  GDB Administrator  <gdbadmin@sourceware.org>
39566
39567         Automatic date update in version.in
39568
39569 2022-06-04  Alan Modra  <amodra@gmail.com>
39570
39571         asan: null dereference in coff_count_linenumbers
39572                 * coffgen.c (coff_count_linenumbers): Don't segfault when asymbol
39573                 the_bfd is NULL.
39574
39575         asan: uninitialised write in bfd_mach_o_write_contents
39576                 * mach-o.c (bfd_mach_o_write_contents): Always set
39577                 bfd_mach_o_dyld_info_command *_off fields.
39578
39579 2022-06-04  Tom de Vries  <tdevries@suse.de>
39580
39581         [gdb/ada] Fix literal truncation
39582         Make sure we error out on overflow instead of truncating in all cases.
39583
39584         Tested on x86_64-linux, with a build with --enable-targets=all.
39585
39586 2022-06-04  Tom de Vries  <tdevries@suse.de>
39587
39588         [gdb/m2] Fix UB and literal truncation
39589         Rewrite parse_number to use ULONGEST instead of LONGEST, to fix UB errors as
39590         mentioned in PR29163.
39591
39592         Furthermore, make sure we error out on overflow instead of truncating in all
39593         cases.
39594
39595         Tested on x86_64-linux, with a build with --enable-targets=all.
39596
39597         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29163
39598
39599 2022-06-04  Tom de Vries  <tdevries@suse.de>
39600
39601         [gdb/rust] Fix literal truncation
39602         Make sure we error out on overflow instead of truncating in all cases.
39603
39604         I've used as overflow string: "Integer literal is too large", based
39605         on what I found at
39606         <rust-lang/rust>/src/test/ui/parser/int-literal-too-large-span.rs
39607         but perhaps someone has a better idea.
39608
39609         Tested on x86_64-linux, with a build with --enable-targets=all.
39610
39611 2022-06-04  Tom de Vries  <tdevries@suse.de>
39612
39613         [gdb/pascal] Fix literal truncation
39614         Make sure we error out on overflow instead of truncating in all cases.
39615
39616         The current implementation of parse_number contains a comment about PR16377,
39617         but that's related to C-like languages.  In absence of information of whether
39618         the same fix is needed for pascal, take the conservative approach and keep
39619         behaviour for decimals unchanged.
39620
39621         Tested on x86_64-linux, with a build with --enable-targets=all.
39622
39623 2022-06-04  Tom de Vries  <tdevries@suse.de>
39624
39625         [gdb/go] Fix literal truncation
39626         Make sure we error out on overflow instead of truncating in all cases.
39627
39628         The current implementation of parse_number contains a comment about PR16377,
39629         but that's related to C-like languages.  In absence of information of whether
39630         the same fix is needed for go, take the conservative approach and keep
39631         behaviour for decimals unchanged.
39632
39633         Tested on x86_64-linux, with a build with --enable-targets=all.
39634
39635 2022-06-04  Tom de Vries  <tdevries@suse.de>
39636
39637         [gdb/fortran] Fix literal truncation
39638         As mentioned in commit 5b758627a18 ("Make gdb.base/parse_number.exp test all
39639         architectures"):
39640         ...
39641             There might be a bug that 32-bit fortran truncates 64-bit values to
39642             32-bit, given "p/x 0xffffffffffffffff" returns "0xffffffff".
39643         ...
39644
39645         More concretely, we have:
39646         ...
39647         $ for arch in i386:x86-64 i386; do \
39648             gdb -q -batch -ex "set arch $arch" -ex "set lang fortran" \
39649               -ex "p /x 0xffffffffffffffff"; \
39650           done
39651         The target architecture is set to "i386:x86-64".
39652         $1 = 0xffffffffffffffff
39653         The target architecture is set to "i386".
39654         $1 = 0xffffffff
39655         ...
39656
39657         Fix this by adding a range check in parse_number in gdb/f-exp.y.
39658
39659         Furthermore, make sure we error out on overflow instead of truncating in all
39660         other cases.
39661
39662         Tested on x86_64-linux.
39663
39664 2022-06-04  Tom de Vries  <tdevries@suse.de>
39665
39666         [gdb/c] Fix type of 2147483648 and literal truncation
39667         [ Assuming arch i386:x86-64, sizeof (int) == 4,
39668         sizeof (long) == sizeof (long long) == 8. ]
39669
39670         Currently we have (decimal for 0x80000000):
39671         ...
39672         (gdb) ptype 2147483648
39673         type = unsigned int
39674         ...
39675
39676         According to C language rules, unsigned types cannot be used for decimal
39677         constants, so the type should be long instead (reported in PR16377).
39678
39679         Fix this by making sure the type of 2147483648 is long.
39680
39681         The next interesting case is (decimal for 0x8000000000000000):
39682         ...
39683         (gdb) ptype 9223372036854775808
39684         type = unsigned long
39685         ...
39686
39687         According to the same rules, unsigned long is incorrect.
39688
39689         Current gcc uses __int128 as type, which is allowed, but we don't have that
39690         available in gdb, so the strict response here would be erroring out with
39691         overflow.
39692
39693         Older gcc without __int128 support, as well as clang use an unsigned type, but with
39694         a warning.  Interestingly, clang uses "unsigned long long" while gcc uses
39695         "unsigned long", which seems the better choice.
39696
39697         Given that the compilers allow this as a convience, do the same in gdb
39698         and keep type "unsigned long", and make this explicit in parser and test-case.
39699
39700         Furthermore, make sure we error out on overflow instead of truncating in all
39701         cases.
39702
39703         Tested on x86_64-linux with --enable-targets=all.
39704
39705         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16377
39706
39707 2022-06-04  Tom de Vries  <tdevries@suse.de>
39708
39709         [gdb/testsuite] Test more values in gdb.base/parse_numbers.exp
39710         Currently we only test value 0xffffffffffffffff in test-case
39711         gdb.base/parse_numbers.exp.
39712
39713         Test more interesting values, both in decimal and hex format, as well as
39714         negative decimals for language modula-2.
39715
39716         This results in an increase in total tests from 15572 to 847448 (55 times
39717         more tests).
39718
39719         Balance out the increase in runtime by reducing the number of architectures
39720         tested: only test one architecture per sizeof longlong/long/int/short
39721         combination, while keeping the possibility intact to run with all
39722         architectures (through setting a variable in the test-case)
39723
39724         Results in slight reduction of total tests: 15572 -> 13853.
39725
39726         Document interesting cases in the expected results:
39727         - wrapping from unsigned to signed
39728         - truncation
39729         - PR16377: using unsigned types to represent decimal constants in C
39730
39731         Running the test-case with a gdb build with -fsanitize=undefined, we trigger
39732         two UB errors in the modula-2 parser, filed as PR29163.
39733
39734         Tested on x86_64-linux with --enable-targets=all.
39735
39736 2022-06-04  Tom de Vries  <tdevries@suse.de>
39737
39738         [gdb/testsuite] Fix ERROR in gdb.ctf/funcreturn.exp
39739         On openSUSE Tumbleweed (with gcc-12, enabling ctf tests) I run into:
39740         ...
39741         ERROR: tcl error sourcing src/gdb/testsuite/gdb.ctf/funcreturn.exp.
39742         ERROR: tcl error code NONE
39743         ERROR: Unexpected arguments: \
39744           {print v_double_func} \
39745           {[0-9]+ = {double \(\)} 0x[0-9a-z]+.*} \
39746           {print double function} \
39747           }
39748         ...
39749
39750         The problem is a curly brace as fourth argument to gdb_test, which errors out
39751         due to recently introduced more strict argument checking in gdb_test.
39752
39753         Fix the error by removing the brace.
39754
39755         Though this fixes the error for me, due to PR29160 I get only FAILs, so I can't
39756         claim proper testing on x86_64-linux.
39757
39758 2022-06-04  Tom de Vries  <tdevries@suse.de>
39759
39760         [gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1
39761         When running test-case gdb.threads/manythreads.exp with check-read1, I ran
39762         into this hard-to-reproduce FAIL:
39763         ...
39764         [New Thread 0x7ffff7318700 (LWP 31125)]^M
39765         [Thread 0x7ffff7321700 (LWP 31124) exited]^M
39766         [New T^C^M
39767         ^M
39768         Thread 769 "manythreads" received signal SIGINT, Interrupt.^M
39769         [Switching to Thread 0x7ffff6d66700 (LWP 31287)]^M
39770         0x00007ffff7586a81 in clone () from /lib64/libc.so.6^M
39771         (gdb) FAIL: gdb.threads/manythreads.exp: stop threads 1
39772         ...
39773
39774         The matching in the failing gdb_test_multiple is done in an intricate way,
39775         trying to pass on some order and fail on another order.
39776
39777         Fix this by rewriting the regexps to match one line at most, and detecting
39778         invalid order by setting and checking state variables.
39779
39780         Tested on x86_64-linux.
39781
39782         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29177
39783
39784 2022-06-04  Tom de Vries  <tdevries@suse.de>
39785
39786         [gdb] Fix warning in print_one_insn::ez80-adl
39787         When running selftest print_one_insn::ez80-adl we run into this warning:
39788         ...
39789         Running selftest print_one_insn::ez80-adl.
39790         warning: Unable to determine inferior's software breakpoint type: couldn't
39791           find `_break_handler' function in inferior. Will be used default software \
39792           breakpoint instruction RST 0x08.
39793         ...
39794
39795         Fix this by explicitly handling bfd_arch_z80 in print_one_insn_test.
39796
39797         Tested on x86_64-linux.
39798
39799 2022-06-04  GDB Administrator  <gdbadmin@sourceware.org>
39800
39801         Automatic date update in version.in
39802
39803 2022-06-03  Tom Tromey  <tromey@adacore.com>
39804
39805         Use bool for evregpy_no_listeners_p
39806         I noticed that evregpy_no_listeners_p should return a bool.  This
39807         patch makes this change.  I'm checking it in.
39808
39809 2022-06-03  Alan Modra  <amodra@gmail.com>
39810
39811         asan: heap buffer overflow in _bfd_mips_elf_section_from_shdr
39812                 * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Sanity check
39813                 intopt.size and remaining bytes in section for reginfo.
39814
39815 2022-06-03  Alan Modra  <amodra@gmail.com>
39816
39817         Re: ubsan: undefined shift in frag_align_code
39818         This one needs the same fix too.
39819
39820                 * config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Avoid signed
39821                 integer overflow.
39822
39823 2022-06-03  Tom de Vries  <tdevries@suse.de>
39824
39825         [gdb] Fix warning in foreach_arch selftests
39826         When running the selftests, I run into:
39827         ...
39828         $ gdb -q -batch -ex "maint selftest"
39829           ...
39830         Running selftest execute_cfa_program::aarch64:ilp32.
39831         warning: A handler for the OS ABI "GNU/Linux" is not built into this
39832         configuration of GDB.  Attempting to continue with the default aarch64:ilp32
39833         settings.
39834         ...
39835         and likewise for execute_cfa_program::i8086 and
39836         execute_cfa_program::ia64-elf32.
39837
39838         The warning can easily be reproduced outside the selftests by doing:
39839         ...
39840         $ gdb -q -batch -ex "set arch aarch64:ilp32"
39841         ...
39842         and can be prevented by first doing "set osabi none".
39843
39844         Fix the warning by setting osabi to none while doing selftests that iterate
39845         over all architectures.
39846
39847         This causes a regression in the print_one_insn selftests for the ARC
39848         architecture.
39849
39850         The problem is pre-existing, and can be demonstrated (already without this
39851         patch) using:
39852         ...
39853         $ gdb -q -batch -ex "set osabi none" -ex "maint selftest print_one_insn::A6"
39854         Running selftest print_one_insn::A6.
39855         Self test failed: Cannot access memory at address 0x0
39856         Ran 1 unit tests, 1 failed
39857         $
39858         ...
39859
39860         For ARC, we use the generic case in print_one_insn_test, containing this code:
39861         ...
39862                int kind = gdbarch_breakpoint_kind_from_pc (gdbarch, &pc);
39863                ...
39864                insn = gdbarch_sw_breakpoint_from_kind (gdbarch, kind, &bplen);
39865         ...
39866
39867         The problem is that with osabi linux we trigger:
39868         ...
39869         static int
39870         arc_linux_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
39871         {
39872           return trap_size;
39873         }
39874         ...
39875         but with osabi none:
39876         ...
39877         arc_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
39878         {
39879           size_t length_with_limm = gdb_insn_length (gdbarch, *pcptr);
39880         ...
39881         which needs access to memory, and will consequently fail.
39882
39883         Fix this in print_one_insn_test, in the default case, by iterating over
39884         supported osabi's to makes sure we trigger arc_linux_breakpoint_kind_from_pc
39885         which will give us a usable instruction to disassemble.
39886
39887         Tested on x86_64-linux.
39888
39889 2022-06-03  Tom de Vries  <tdevries@suse.de>
39890
39891         Revert "[gdb] Fix warning in foreach_arch selftests"
39892         This reverts commit fc18b1c5afd ("[gdb] Fix warning in foreach_arch
39893         selftests").
39894
39895         The commit introduced regressions for an --enable-targets=all build:
39896         ...
39897         Running selftest print_one_insn::A6.^M
39898         Self test failed: Cannot access memory at address 0x0^M
39899         ...
39900         and while investigating those I realized that the commit fc18b1c5afd
39901         complicates things by trying to set the current osabi.
39902
39903         So, revert the patch in preparation for a simpler solution.
39904
39905         Tested on x86_64-linux.
39906
39907 2022-06-03  Jan Beulich  <jbeulich@suse.com>
39908
39909         x86: exclude certain ISA extensions from v3/v4 ISA
39910         Like TBM and LWP, XOP and FMA4 also shouldn't be included in v3.
39911
39912         Like AVX512-4VNNIW, AVX512-4FMAPS also shouldn't be included in v4.
39913
39914 2022-06-03  Roland McGrath  <mcgrathr@google.com>
39915
39916         gdb: LoongArch: Remove nonportable #include
39917         Don't use gregset.h in *-tdep.c since it's not usable on
39918         hosts that don't have <sys/procfs.h>.  It's not needed by
39919         this file, and should only be needed by *-nat.c files.
39920
39921 2022-06-03  Alan Modra  <amodra@gmail.com>
39922
39923         Re: asan: mips_gprel_reloc segfault
39924         Similarly for the elf mips support.
39925
39926                 * elf32-mips.c (mips_elf_final_gp): Don't segfault on symbols
39927                 in any of the bfd_is_const_section sections.
39928                 * elf64-mips.c (mips_elf64_final_gp): Likewise.
39929                 * elfn32-mips.c (mips_elf_final_gp): Likewise.
39930
39931 2022-06-03  Alan Modra  <amodra@gmail.com>
39932
39933         asan: mips_gprel_reloc segfault
39934         Not just the undefined section has a NULL owner, the absolute section
39935         has too.  Which means we can't find output_bfd for __gp.  Also, may as
39936         well test directly for output_bfd == NULL.
39937
39938                 * coff-mips.c (mips_gprel_reloc): Don't segfault on any of
39939                 bfd_is_const_section sections.
39940
39941 2022-06-03  GDB Administrator  <gdbadmin@sourceware.org>
39942
39943         Automatic date update in version.in
39944
39945 2022-06-02  Tom de Vries  <tdevries@suse.de>
39946
39947         [gdb/testsuite] Detect change instead of init in gdb.mi/mi-var-block.exp
39948         On openSUSE Tumbleweed with target board unix/-m32, I run into:
39949         ...
39950         PASS: gdb.mi/mi-var-block.exp: step at do_block_test 2
39951         Expecting: ^(-var-update \*[^M
39952         ]+)?(\^done,changelist=\[{name="foo",in_scope="true",type_changed="false",has_more="0"},
39953         {name="cb",in_scope="true",type_changed="false",has_more="0"}\][^M
39954         ]+[(]gdb[)] ^M
39955         [ ]*)
39956         -var-update *^M
39957         ^done,changelist=[{name="foo",in_scope="true",type_changed="false",has_more="0"}]^M
39958         (gdb) ^M
39959         FAIL: gdb.mi/mi-var-block.exp: update all vars: cb foo changed (unexpected output)
39960         ...
39961
39962         The problem is that the test-case attempts to detect a change in the cb
39963         variable caused by this initialization:
39964         ...
39965         void
39966         do_block_tests ()
39967         {
39968           int cb = 12;
39969         ...
39970         but that only works if the stack location happens to be unequal to 12 before
39971         the initialization.
39972
39973         Fix this by first initializing to 0, and then changing the value to 12:
39974         ...
39975         -  int cb = 12;
39976         +  int cb = 0;
39977         +  cb = 12;
39978         ...
39979         and detecting that change.
39980
39981         Tested on x86_64-linux.
39982
39983         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29195
39984
39985 2022-06-02  Eli Zaretskii  <eliz@gnu.org>
39986
39987         Rearrange and slightly reword the "Location Specification" section
39988         This rearranges and changes the wording of the "Location
39989         Specification" section of the GDB manual in minor ways.
39990
39991 2022-06-02  Tom Tromey  <tromey@adacore.com>
39992
39993         ODR warning for "main"
39994         "main" is redeclared with a different type in maint.c.  I think this
39995         might have come from my first gdb patch, many many years ago.  While I
39996         wonder if this profiling code is actually useful at all any more, in
39997         the meantime it's simple to fix the declaration.
39998
39999         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40000
40001 2022-06-02  Tom Tromey  <tromey@adacore.com>
40002
40003         ODR warnings for "struct coff_symbol"
40004         "struct coff_symbol" is defined in multiple .c files, causing ODR
40005         warnings.  This patch renames just the xcoffread.c type.
40006
40007         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40008
40009 2022-06-02  Tom Tromey  <tromey@adacore.com>
40010
40011         ODR warnings for "struct insn_decode_record_t"
40012         "struct insn_decode_record_t" is defined in multiple .c files, causing
40013         ODR warnings.  This patch renames the types, and removes the use of
40014         "typedef" here -- this is a C-ism that's no longer needed.
40015
40016         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40017
40018 2022-06-02  Tom Tromey  <tromey@adacore.com>
40019
40020         ODR warnings for "struct insn_info"
40021         "struct insn_info" is defined in multiple .c files, causing ODR
40022         warnings.  This patch renames the type in z80-tdep.c, leaving the
40023         other one alone.
40024
40025         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40026
40027 2022-06-02  Tom Tromey  <tromey@adacore.com>
40028
40029         ODR warnings from overlay constants
40030         Some overlay-related constants are duplicated in z80-tdep.c, causing
40031         ODR warnings.  This patch renames just the z80-specific ones.
40032
40033         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40034
40035 2022-06-02  Tom Tromey  <tromey@adacore.com>
40036
40037         ODR warning for "enum string_repr_result"
40038         "enum string_repr_result" is defined in multiple .c files, causing ODR
40039         warnings.  This patch renames the types.
40040
40041         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40042
40043 2022-06-02  Tom Tromey  <tromey@adacore.com>
40044
40045         ODR warning for "struct find_targ_sec_arg"
40046         "struct find_targ_sec_arg" is defined in multiple .c files, causing
40047         ODR warnings.  This patch renames the types.
40048
40049         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40050
40051 2022-06-02  Tom Tromey  <tromey@adacore.com>
40052
40053         ODR warning for "struct stack_item"
40054         "struct stack_item" is defined in multiple .c files, causing ODR
40055         warnings.  This patch renames these types.
40056
40057         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40058
40059 2022-06-02  Tom Tromey  <tromey@adacore.com>
40060
40061         ODR warning for "struct instruction_type"
40062         "struct instruction_type" is defined in multiple .c files, causing an
40063         ODR warning.  This patch renames the types.
40064
40065         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40066
40067 2022-06-02  Tom Tromey  <tromey@adacore.com>
40068
40069         ODR warning for struct ext_link_map
40070         This renames the solib-dsbt.c copy of "struct ext_link_map" to avoid
40071         an ODR warning.
40072
40073         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40074
40075 2022-06-02  Tom Tromey  <tromey@adacore.com>
40076
40077         ODR warning for struct field_info
40078         This renames one of the instance of "struct field_info" to avoid an
40079         ODR warning.
40080
40081         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40082
40083 2022-06-02  Tom Tromey  <tromey@adacore.com>
40084
40085         ODR warnings for struct nextfield
40086         "struct nextfield" is defined in multiple places in GDB.  This patch
40087         renames just the stabs one, leaving the DWARF one untouched.
40088
40089         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40090
40091 2022-06-02  Tom Tromey  <tromey@adacore.com>
40092
40093         ODR warnings for struct symloc
40094         "struct symloc" is defined in multiple spots in gdb, causing ODR
40095         warnings.  This patch renames these.
40096
40097         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40098
40099 2022-06-02  Tom Tromey  <tromey@adacore.com>
40100
40101         Fix ODR warning in observable.h
40102         observable.h triggers an ODR warning because this line:
40103
40104             extern observable<struct target_ops */* target */> target_changed;
40105
40106         ... may be the only declaration of "struct target_ops" in scope
40107         (depending on the particular .c file) -- and this declares it in a
40108         namespace, resulting in confusion.
40109
40110         This patch fixes the problem by adding a forward declaration.
40111
40112         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
40113
40114 2022-06-02  Tiezhu Yang  <yangtiezhu@loongson.cn>
40115
40116         gdb: LoongArch: Implement the software_single_step gdbarch method
40117         When execute the following command on LoongArch:
40118
40119           make check-gdb TESTS="gdb.base/branch-to-self.exp"
40120
40121         there exist the following failed testcases:
40122
40123           FAIL: gdb.base/branch-to-self.exp: single-step: si (timeout)
40124           FAIL: gdb.base/branch-to-self.exp: break-cond: side=host: continue to breakpoint: continue to break (timeout)
40125           FAIL: gdb.base/branch-to-self.exp: break-cond: side=host: p counter (timeout)
40126
40127         Implement the software_single_step gdbarch method to decode the current
40128         branch instruction and determine the address of the next instruction on
40129         LoongArch to fix the above failed testcases.
40130
40131 2022-06-02  Ilya Leoshkevich  <iii@linux.ibm.com>
40132
40133         gdb: Do not add empty sections to the section map
40134         From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
40135
40136         build_objfile_section_table () creates four synthetic sections per
40137         objfile, which are collected by update_section_map () and passed to
40138         std::sort ().  When there are a lot of objfiles, for example, when
40139         debugging JITs, the presence of these sections slows down the sorting
40140         significantly.
40141
40142         The output of update_section_map () is used by find_pc_section (),
40143         which can never return any of these sections: their size is 0, so they
40144         cannot be accepted by bsearch_cmp ().
40145
40146         Filter them (and all the other empty sections) out in
40147         insert_section_p (), which is used only by update_section_map ().
40148
40149 2022-06-02  Jon Turney  <jon.turney@dronecode.org.uk>
40150
40151         Fix a new warning on Cygwin
40152         > ../../gdb/windows-nat.c: In function ‘windows_solib* windows_make_so(const char*, LPVOID)’:
40153         > ../../gdb/windows-nat.c:714:12: error: declaration of ‘char name [512]’ shadows a parameter [-Werror=shadow=compatible-local]
40154         >   714 |       char name[SO_NAME_MAX_PATH_SIZE];
40155         >       |            ^~~~
40156         > ../../gdb/windows-nat.c:655:30: note: shadowed declaration is here
40157         >   655 | windows_make_so (const char *name, LPVOID load_addr)
40158         >       |                  ~~~~~~~~~~~~^~~~
40159
40160         Fix Cygwin build after 85b25bd9
40161         Fix Cygwin build after 85b25bd9 ("Simplify windows-nat.c solib handling").
40162
40163         Fix Cygwin build after 0578e87f
40164         Fix Cygwin build after 0578e87f ("Remove some globals from
40165         nat/windows-nat.c").  Update code under ifdef __CYGWIN__ for globals
40166         moved to members of struct windows_process_info.
40167
40168         Fix Cygwin build after fcab5839
40169         Fix Cygwin build after fcab5839 ("Implement pid_to_exec_file for Windows
40170         in gdbserver"). That change moves code from gdb/windows-nat.c to
40171         gdb/nat/windows-nat.c, but doesn't add the required typedefs and
40172         includes for parts of that code under ifdef __CYGWIN__.
40173
40174 2022-06-02  Alan Modra  <amodra@gmail.com>
40175
40176         Re: ubsan: signed integer overflow in atof_generic
40177         Oops.
40178
40179                 * atof-generic.c: Include limits.h.
40180
40181 2022-06-02  Alan Modra  <amodra@gmail.com>
40182
40183         ubsan: signed integer overflow in atof_generic
40184         Fix the signed overflows by using unsigned variables and detect
40185         overflow at BUG! comment.
40186
40187                 * atof-generic.c (atof_generic): Avoid signed integer overflow.
40188                 Return ERROR_EXPONENT_OVERFLOW if exponent overflows a long.
40189
40190 2022-06-02  Alan Modra  <amodra@gmail.com>
40191
40192         asan: uninit write _bfd_ecoff_write_object_contents
40193                 * ecoff.c (_bfd_ecoff_write_object_contents): zalloc reloc_buff.
40194
40195         asan: null deref in coff_write_relocs
40196                 * coffcode.h (coff_write_relocs): Don't deref NULL howto.
40197
40198         ubsan: undefined shift in frag_align_code
40199                 * frags.c (MAX_MEM_FOR_RS_ALIGN_CODE): Avoid signed integer
40200                 overflow.
40201
40202 2022-06-02  Alan Modra  <amodra@gmail.com>
40203
40204         gas read_a_source_file #APP processing
40205         This fixes some horrible code using do_scrub_chars.  What we had ran
40206         text through do_scrub_chars twice, directly in read_a_source_file and
40207         again via the input_scrub_include_sb call.  That's silly, and since
40208         do_scrub_chars is a state machine, possibly wrong.  More silliness is
40209         evident in the temporary malloc'd buffer for do_scrub_chars output,
40210         which should have been written directly to sbuf.
40211
40212         So, get rid of the do_scrub_chars call and support functions, leaving
40213         scrubbing to input_scrub_include_sb.  I did wonder about #NO_APP
40214         overlapping input_scrub_next_buffer buffers, but that should only
40215         happen if the string starts in one file and finishes in another.
40216
40217                 * read.c (scrub_string, scrub_string_end): Delete.
40218                 (scrub_from_string): Delete.
40219                 (read_a_source_file): Rewrite #APP processing.
40220
40221 2022-06-02  Alan Modra  <amodra@gmail.com>
40222
40223         sb_scrub_and_add_sb not draining input string buffer
40224         It is possible for sb_scrub_and_add_sb to not consume all of the input
40225         string buffer.  If this happens for reasons explained in the comment,
40226         do_scrub_chars can leave pointers to the string buffer for the next
40227         call.  This patch fixes that by ensuring the input is drained.  Note
40228         that the behaviour for an empty string buffer is also changed,
40229         avoiding another do_scrub_chars bug where empty input and single char
40230         sized output buffers could result in a write past the end of the
40231         output.
40232
40233                 sb.c (sb_scrub_and_add_sb): Loop until all of input sb is
40234                 consumed.
40235
40236 2022-06-02  Alan Modra  <amodra@gmail.com>
40237
40238         asan: heap buffer overflow in dwarf2_directive_filename
40239         Seen with .file 4294967289 "xxx.c"
40240
40241                 * dwarf2dbg.c (assign_file_to_slot): Catch more cases of integer
40242                 overflow.  Make param i an unsigned int.
40243
40244 2022-06-02  Alan Modra  <amodra@gmail.com>
40245
40246         asan: NULL deref in scan_unit_for_symbols
40247         Since commit b43771b045 it has been possible to look up addresses
40248         that match a unit with errors, since ranges are added to a trie while
40249         the unit is being parsed.  On error, parse_comp_unit leaves
40250         first_child_die_ptr NULL which results in a NULL info_ptr being passed
40251         to scan_unit_for_symbols.  Fix this by setting unit->error.
40252
40253         Also wrap some overlong lines, and fix some formatting errors.
40254
40255                 * dwarf2.c: Formatting.
40256                 (parse_comp_unit): Set unit->error on err_exit path.
40257
40258 2022-06-02  GDB Administrator  <gdbadmin@sourceware.org>
40259
40260         Automatic date update in version.in
40261
40262 2022-06-01  Tom de Vries  <tdevries@suse.de>
40263
40264         [gdb] Fix warning in foreach_arch selftests
40265         When running the selftests, I run into:
40266         ...
40267         $ gdb -q -batch -ex "maint selftest"
40268           ...
40269         Running selftest execute_cfa_program::aarch64:ilp32.
40270         warning: A handler for the OS ABI "GNU/Linux" is not built into this
40271         configuration of GDB.  Attempting to continue with the default aarch64:ilp32
40272         settings.
40273         ...
40274         and likewise for execute_cfa_program::i8086 and
40275         execute_cfa_program::ia64-elf32.
40276
40277         The warning can easily be reproduced outside the selftests by doing:
40278         ...
40279         $ gdb -q -batch -ex "set arch aarch64:ilp32"
40280         ...
40281         and can be prevented by first doing "set osabi none".
40282
40283         Fix the warning by setting osabi to none while doing selftests that iterate
40284         over all architectures.
40285
40286         Tested on x86_64-linux.
40287
40288 2022-06-01  Tom Tromey  <tromey@adacore.com>
40289
40290         Add gdb.current_language and gdb.Frame.language
40291         This adds the gdb.current_language function, which can be used to find
40292         the current language without (1) ever having the value "auto" or (2)
40293         having to parse the output of "show language".
40294
40295         It also adds the gdb.Frame.language, which can be used to find the
40296         language of a given frame.  This is normally preferable if one has a
40297         Frame object handy.
40298
40299 2022-06-01  Yvan Roux  <yvan.roux@foss.st.com>
40300
40301         [arm] Don't use special treatment for PC
40302         In an exception frame the PC register is extracted from the stack
40303         just like other base registers, so there is no need for a special
40304         treatment.
40305
40306         [arm] Add support for FPU registers in prologue unwinder
40307         The prologue unwinder had support for FPU registers, but only to
40308         calculate the correct offset on the stack, the values were not saved.
40309
40310 2022-06-01  Yvan Roux  <yvan.roux@foss.st.com>
40311
40312         [arm] d0..d15 are 64-bit each, not 32-bit
40313         When unwinding the stack, the floating point registers d0 to d15
40314         need to be handled as double words, not words.
40315
40316         Only the first 8 registers have been confirmed fixed with this patch
40317         on a STM32F407-DISC0 board, but the upper 8 registers on Cortex-M33
40318         should be handled in the same way.
40319
40320         The test consisted of running a program compiled with float-abi=hard.
40321         In the main function, a function taking a double as an argument was
40322         called. After the function call, a hardware timer was used to
40323         trigger an interrupt.
40324
40325         In the debug session, a breakpoint was set in the function called
40326         from main to verify the content of the registers using "info float"
40327         and another breakpoint in the interrupt handler was used to check
40328         the same registers using "info float" on frame 2 (the frame just
40329         before the dummy frame created for the signal handler in gdb).
40330
40331 2022-06-01  Yvan Roux  <yvan.roux@foss.st.com>
40332
40333         [arm] Cleanup: use hex for offsets
40334         Changed offset from decimal to hex to match architecture reference
40335         manual terminology and keep coherency with the rest of the code.
40336
40337 2022-06-01  Jiangshuai Li  <jiangshuai_li@c-sky.com>
40338
40339         gdb:csky save fpu and vdsp info to struct csky_gdbarch_tdep
40340         First, add three variables fpu_abi, fpu_hardfp and vdsp_version
40341         to csky_gdbarch_tdep. They will be initialized from info.abfd in
40342         cskg_gdbarch_init.
40343
40344         Now, they are just used to find a candidate among the list of pre-declared
40345         architectures
40346
40347         Later, they will be used in gdbarch_return_value and gdbarch_push_dummy_call
40348         for funtions described below:
40349         fpu_abi: to check if the bfd is using VAL_CSKY_FPU_ABI_HARD or
40350         VAL_CSKY_FPU_ABI_SOFT
40351         fpu_hardfp: to check if the bfd is using VAL_CSKY_FPU_HARDFP_SINGLE
40352         or VAL_CSKY_FPU_HARDFP_DOUBLE
40353         vdsp_version: to check if a function is returned with CSKY_VRET_REGNUM
40354
40355 2022-06-01  Alan Modra  <amodra@gmail.com>
40356
40357         Re: use libiberty xmalloc in bfd/doc/chew.c
40358         We can't use libiberty.a in chew.  libiberty is a host library, chew
40359         a build program.  Partly revert commit 7273d78f3f7a, instead define
40360         local versions of the libiberty functions.  ansidecl.h also isn't
40361         needed.
40362
40363                 * doc/chew.c: Don't include libiberty.h or ansidecl.h.
40364                 (xmalloc, xrealloc, xstrdup): New functions.
40365                 * doc/local.mk (LIBIBERTY): Don't define or use.
40366                 * Makefile.in: Regenerate.
40367
40368 2022-06-01  GDB Administrator  <gdbadmin@sourceware.org>
40369
40370         Automatic date update in version.in
40371
40372 2022-06-01  H.J. Lu  <hjl.tools@gmail.com>
40373
40374         x86: Properly handle IFUNC function pointer reference
40375         Update
40376
40377         commit 68c4956b1401de70173848a6bdf620cb42fa9358
40378         Author: H.J. Lu <hjl.tools@gmail.com>
40379         Date:   Tue Apr 26 09:08:54 2022 -0700
40380
40381             x86: Properly handle function pointer reference
40382
40383         to properly handle IFUNC function pointer reference.  Since IFUNC symbol
40384         value is only known at run-time, set pointer_equality_needed for IFUNC
40385         function pointer reference in PDE so that it will be resolved to its PLT
40386         entry directly.
40387
40388         bfd/
40389
40390                 PR ld/29216
40391                 * elf32-i386.c (elf_i386_scan_relocs): Set pointer_equality_needed
40392                 for IFUNC function pointer reference in PDE.
40393                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
40394
40395         ld/
40396
40397                 PR ld/29216
40398                 * testsuite/ld-ifunc/ifunc.exp: Run PR ld/29216 test.
40399                 * testsuite/ld-ifunc/pr29216.c: New file.
40400
40401 2022-05-31  H.J. Lu  <hjl.tools@gmail.com>
40402
40403         i386: Ajdust more tests for opcodes/i386: remove trailing whitespace
40404         This fixes:
40405
40406         FAIL: Build ifunc-1a with -z ibtplt
40407         FAIL: Build ifunc-1a with PIE -z ibtplt
40408         FAIL: Build libno-plt-1b.so
40409         FAIL: No PLT (dynamic 1a)
40410         FAIL: No PLT (dynamic 1b)
40411         FAIL: No PLT (dynamic 1c)
40412         FAIL: No PLT (static 1d)
40413         FAIL: No PLT (PIE 1e)
40414         FAIL: No PLT (PIE 1f)
40415         FAIL: No PLT (PIE 1g)
40416         FAIL: No PLT (dynamic 1h)
40417         FAIL: No PLT (dynamic 1i)
40418         FAIL: No PLT (static 1j)
40419
40420                 * ld-i386/libno-plt-1b.dd: Remove trailing whitespaces.
40421                 * ld-i386/no-plt-1a.dd: Likewise.
40422                 * ld-i386/no-plt-1b.dd: Likewise.
40423                 * ld-i386/no-plt-1c.dd: Likewise.
40424                 * ld-i386/no-plt-1d.dd: Likewise.
40425                 * ld-i386/no-plt-1e.dd: Likewise.
40426                 * ld-i386/no-plt-1f.dd: Likewise.
40427                 * ld-i386/no-plt-1g.dd: Likewise.
40428                 * ld-i386/no-plt-1h.dd: Likewise.
40429                 * ld-i386/no-plt-1i.dd: Likewise.
40430                 * ld-i386/no-plt-1j.dd: Likewise.
40431                 * ld-i386/plt-main-ibt.dd: Likewise.
40432                 * ld-i386/plt-pie-ibt.dd: Likewise.
40433
40434 2022-05-31  Tom Tromey  <tom@tromey.com>
40435
40436         Use unique_ptr for objfiles
40437         A while back, I changed objfiles to be held via a shared_ptr.  The
40438         idea at the time was that this was a step toward writing to the index
40439         cache in the background, and this would let gdb keep a reference alive
40440         to do so.  However, since then we've rewritten the DWARF reader, and
40441         the new index can do this without requiring a shared pointer -- in
40442         fact there are patches pending to implement this.
40443
40444         This patch switches objfile management to unique_ptr, which makes more
40445         sense now.
40446
40447         Regression tested on x86-64 Fedora 34.
40448
40449 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40450
40451         gdb/testsuite: fixup common-block.exp for intel compilers
40452         The order in which the variables in info common and info locals are
40453         displayed is compiler (and dwarf) dependent.  While all symbols should
40454         be displayed the order is not fixed.
40455
40456         I added a gdb_test_multiple that lets ifx and ifort pass in cases where
40457         only the order differs.
40458
40459 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40460
40461         gdb, testsuite, fortran: fixup mixed-lang-stack for Intel/LLVM compilers
40462         When value-printing a pointer within GDB by default GDB will look for
40463         defined symbols residing at the address of the pointer.  For the given
40464         test the Intel/LLVM compiler stacks both display a symbol associated
40465         with a printed pointer while the gnu stack does not.  This leads to
40466         failures in the test when running the test with CC_FOR_TARGET='clang'
40467         CXX_FOR_TARGET='clang' F90_FOR_TARGET='flang'"
40468
40469           (gdb) b 37
40470           (gdb) r
40471           (gdb) f 6
40472           (gdb) info args
40473           a = 1
40474           b = 2
40475           c = 3
40476           d = 4 + 5i
40477           f = 0x419ed0 "abcdef"
40478           g = 0x4041a0 <.BSS4>
40479
40480         or CC_FOR_TARGET='icx' CXX_FOR_TARGET='icpx' F90_FOR_TARGET='ifx'"
40481
40482           (gdb) b 37
40483           (gdb) r
40484           (gdb) f 6
40485           (gdb) info args
40486           a = 1
40487           b = 2
40488           c = 3
40489           d = 4 + 5i
40490           f = 0x52eee0 "abcdef"
40491           g = 0x4ca210 <mixed_func_1a_$OBJ>
40492
40493         For the compiled binary the Intel/LLVM compilers both decide to move the
40494         local variable g into the .bss section of their executable.  The gnu
40495         stack will keep the variable locally on the stack and not define a
40496         symbol for it.
40497
40498         Since the behavior for Intel/LLVM is actually expected I adapted the
40499         testcase at this point to be a bit more allowing for other outputs.
40500         I added the optional "<SYMBOLNAME>" to the regex testing for g.
40501
40502         The given changes reduce the test fails for Intel/LLVM stack by 4 each.
40503
40504 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40505
40506         gdb, testsuite, fortran: fix double free in mixed-lang-stack.exp
40507         While testing mixed-lang-stack I realized that valgrind actually
40508         complained about a double free in the test.
40509
40510            All done
40511           ==2503051==
40512           ==2503051== HEAP SUMMARY:
40513           ==2503051==     in use at exit: 0 bytes in 0 blocks
40514           ==2503051==   total heap usage: 26 allocs, 27 frees, 87,343 bytes allocated
40515           ==2503051==
40516           ==2503051== All heap blocks were freed -- no leaks are possible
40517           ==2503051==
40518           ==2503051== For lists of detected and suppressed errors, rerun with: -s
40519           ==2503051== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
40520
40521         Reason for this is that in mixed-lang-stack.cpp in mixed_func_1f an
40522         object "derived_type obj" goes on the stack which is then passed-by-value
40523         (so copied) to mixed_func_1g.  The default copy-ctor will be called but,
40524         since derived_type contains a heap allocated string and the copy
40525         constructor is not implemented it will only be able to shallow copy the
40526         object.  Right after each of the functions the object gets freed - on the
40527         other hand the d'tor of derived_type actually is implemented and calls
40528         free on the heap allocated string which leads to a double free.  Instead
40529         of obeying the rule of 3/5 I just got rid of all that since it does not
40530         serve the test.  The string is now just a const char* = ".." object
40531         member.
40532
40533 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40534
40535         testsuite, fortran: allow additional completions in module.exp
40536         For ifort, ifx, and flang the tests "complete modm" and "complete
40537         modmany" fail.  This is because all three emit additional completion
40538         suggestions.  These additional suggestions have their origin in symbols
40539         emitted by the compilers which can also be completed from the respective
40540         incomplete word (modm or modmany).  For this specific example gfortran
40541         does not emit any additional symbols.
40542
40543         For example, in this test the linkage name for var_a in ifx is
40544         "modmany_mp_var_a_" while gfortran uses "__modmany_MOD_var_a" instead.
40545         Since modmany_mp_var_a can be completed from modm and also modmany they
40546         will get displayed, while gfortran's symbol starts with "__" and thus will
40547         be ignored (it cannot be a completion of a word starting with "m").
40548
40549         Similar things happen in flang and ifort.  Some example output is shown
40550         below:
40551
40552         FLANG
40553           (gdb) complete p modm
40554           p modmany
40555           p modmany::var_a
40556           p modmany::var_b
40557           p modmany::var_c
40558           p modmany::var_i
40559           p modmany_
40560
40561         IFX/IFORT
40562           (gdb) complete p modm
40563           p modmany
40564           p modmany._
40565           p modmany::var_a
40566           p modmany::var_b
40567           p modmany::var_c
40568           p modmany::var_i
40569           p modmany_mp_var_a_
40570           p modmany_mp_var_b_
40571           p modmany_mp_var_c_
40572           p modmany_mp_var_i_
40573
40574         GFORTRAN
40575           (gdb) complete p modm
40576           p modmany
40577           p modmany::var_a
40578           p modmany::var_b
40579           p modmany::var_c
40580           p modmany::var_i
40581
40582         I want to emphasize: for Fortran (and also C/C++) the complete command
40583         does not actually check whether its suggestions make sense - all it does
40584         is look for any symbol (in the minimal symbols, partial symbols etc.)
40585         that a given substring can be completed to (meaning that the given substring
40586         is the beginning of the symbol).  One can easily produce a similar
40587         output for the gfortran compiled executable.  For this look at the
40588         slightly modified "complete p mod" in gfortran:
40589
40590           (gdb) complete p mod
40591           p mod1
40592           p mod1::var_const
40593           ...
40594           p mod_1.c
40595           p modcounter
40596           p mode_t
40597           p modf
40598           ...
40599           p modify_ldt
40600           p modmany
40601           p modmany::var_a
40602           p modmany::var_b
40603           p modmany::var_c
40604           p modmany::var_i
40605           p module
40606           p module.f90
40607           p module_entry
40608           p moduse
40609           p moduse::var_x
40610           p moduse::var_y
40611
40612         Many of the displayed symbols do not actually work with print:
40613
40614           (gdb) p mode_t
40615           Attempt to use a type name as an expression
40616           (gdb) p mod_1.c
40617           No symbol "mod_1" in current context.
40618           (gdb)
40619
40620         I think that in the given test the output for gfortran only looks nice
40621         "by chance" rather than is actually expected.  Expected is any output
40622         that also contains the completions
40623
40624           p modmany
40625
40626           p modmany::var_a
40627           p modmany::var_b
40628           p modmany::var_c
40629           p modmany::var_i
40630
40631         while anythings else can be displayed as well (depending on the
40632         compiler and its emitted symbols).
40633
40634         This, I'd consider all three outputs as valid and expected - one is just
40635         somewhat lucky that gfortran does not produce any additional symbols that
40636         got matched.
40637
40638         The given patch improves test performance for all three compilers
40639         by allowing additional suggested completions inbetween and after
40640         the two given blocks in the test.  I did not allow additional print
40641         within the modmany_list block since the output is ordered alphabetically
40642         and there should normally not appear any additional symbols there.
40643
40644         For flang/ifx/ifort I each see 2 failures less (which are exactly the two
40645         complete tests).
40646
40647         As a side note and since I mentioned C++ in the beginning: I also tried
40648         the gdb.cp/completion.exp.  The output seems a bit more reasonable,
40649         mainly since C++ actually has a demangler in place and linkage symbols
40650         do not appear in the output of complete.  Still, with a poor enough
40651         to-be-completed string one can easily produce similar results:
40652
40653           (gdb) complete p t
40654           ...
40655           p typeinfo name for void
40656           p typeinfo name for void const*
40657           p typeinfo name for void*
40658           p typeinfo name for wchar_t
40659           p typeinfo name for wchar_t const*
40660           p typeinfo name for wchar_t*
40661           p t *** List may be truncated, max-completions reached. ***
40662           (gdb) p typeinfo name for void*
40663           No symbol "typeinfo" in current context.
40664           (gdb) complete p B
40665           p BACK_SLASH
40666           p BUF_FIRST
40667           p BUF_LAST
40668           ...
40669           p Base
40670           p Base::Base()
40671           p Base::get_foo()
40672           p bad_key_err
40673           p buf
40674           p buffer
40675           p buffer_size
40676           p buflen
40677           p bufsize
40678           p build_charclass.isra
40679           (gdb) p bad_key_err
40680           No symbol "bad_key_err" in current context.
40681
40682         (compiled with gcc/g++ and breaking at main).
40683
40684         This patch is only about making the referenced test more 'fair' for the
40685         other compilers.  Generally, I find the behavior of complete a bit
40686         confusing and maybe one wants to change this at some point but this
40687         would be a bigger task.
40688
40689 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40690
40691         testsuite, fortran: fix info-types for intel compilers
40692         This info-types.exp test case had a few issues that this patch fixes.
40693
40694         First, the emitted symbol character(kind=1)/character*1 (different
40695         compilers use different naming converntions here) which is checkedin the
40696         test is not actually expected given the test program.  There is no
40697         variable of that type in the test.  Still, gfortran emits it for every
40698         Fortran program there is.  The reason is the way gfortran handles Fortran's
40699         named main program.  It generates a wrapper around the Fortran program
40700         that is quite similar to a C main function.  This C-like wrapper has
40701         argc and argv arguments for command line argument passing and the argv
40702         pointer type has a base type character(kind=1) DIE emitted at CU scope.
40703
40704         Given the program
40705
40706           program prog
40707           end program prog
40708
40709         the degbug info gfortran emits looks somewhat like
40710
40711            <0><c>: Abbrev Number: 3 (DW_TAG_compile_unit)
40712               ...
40713            <1><2f>: Abbrev Number: 4 (DW_TAG_subprogram)
40714               <30>   DW_AT_external    : 1
40715               <30>   DW_AT_name        : (indirect string, ...): main
40716               ...
40717            <2><51>: Abbrev Number: 1 (DW_TAG_formal_parameter)
40718               <52>   DW_AT_name        : (indirect string, ...): argc
40719               ...
40720            <2><5d>: Abbrev Number: 1 (DW_TAG_formal_parameter)
40721               <5e>   DW_AT_name        : (indirect string, ...): argv
40722               ...
40723               <62>   DW_AT_type        : <0x77>
40724               ...
40725            <2><6a>: Abbrev Number: 0
40726            ...
40727            <1><77>: Abbrev Number: 6 (DW_TAG_pointer_type)
40728               <78>   DW_AT_byte_size   : 8
40729               <79>   DW_AT_type        : <0x7d>
40730            <1><7d>: Abbrev Number: 2 (DW_TAG_base_type)
40731               <7e>   DW_AT_byte_size   : 1
40732               <7f>   DW_AT_encoding    : 8        (unsigned char)
40733               <80>   DW_AT_name        : (indirect string, ...): character(kind=1)
40734            <1><84>: Abbrev Number: 7 (DW_TAG_subprogram)
40735               <85>   DW_AT_name        : (indirect string, ...): prog
40736            ...
40737
40738         Ifx and flang do not emit any debug info for a wrapper main method so
40739         the type is missing here.  There was the possibility of actually adding
40740         a character*1 type variable to the Fortran executable, but both, ifx and
40741         gfortran chose to emit this variable's type as a DW_TAG_string_type of
40742         length one (instead of a character(kind=1), or whatever the respective
40743         compiler naming convention is).  While string types are printed as
40744         character*LENGHT in the fortran language part (e.g. when issuing a
40745         'ptype') they do not generate any symbols inside GDB.  In read.c it says
40746
40747            /* These dies have a type, but processing them does not create
40748               a symbol or recurse to process the children.  Therefore we can
40749               read them on-demand through read_type_die.  */
40750
40751         So they did not add any output to 'info types'.  Only flang did emit a
40752         character type here.
40753         As adding a type would have a) not solved the problem for ifx and would
40754         have b) somehow hidden the curious behavior of gfortran, instead, the
40755         check for this character type was chagened to optional with the
40756         check_optional_entry to allow for the symbols's absence and to allow
40757         flang and ifx to pass this test as well.
40758
40759         Second, the line checked for s1 was hardcoded as 37 in the test.  Given
40760         that the type is actually defined on line 41 (which is what is emitted by
40761         ifx) it even seems wrong.  The line check for s1 was changed to actually
40762         check for 41 and a gfortran bug has been filed here
40763
40764            https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105454
40765
40766         The test is now marked as xfail for gfortran.
40767
40768         Third, the whole test of checking for the 'Type s1' in info types seemed
40769         questionable.  The type s1 is declared iside the scope of the Fortran
40770         program info_types_test.  Its DIE however is emitted as a child of the
40771         whole compilation unit making it visible outside of the program's scope.
40772         The 'info types' command checks for types stored in the GLOBAL_BLOCK,
40773         or STATIC_BLOCKm wgucm according to block.h
40774
40775            The GLOBAL_BLOCK contains all the symbols defined in this compilation
40776            whose scope is the entire program linked together.
40777            The STATIC_BLOCK contains all the symbols whose scope is the
40778            entire compilation excluding other separate compilations.
40779
40780         so for gfortran, the type shows up in the output of 'info types'.  For
40781         flang and ifx on the other hand this is not the case.  The two compilers
40782         emit the type (correctly) as a child of the Fortran program, thus not
40783         adding it to either, the GLOBAL_BLOCK nor the LOCAL_BLOCK.  A bug has
40784         been opened for the gfortran scoping issue:
40785
40786            https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105454
40787
40788         While the most correct change might have been removing the check for s1,
40789         the change made here was to only check for this type in case of gfortran
40790         being used as the compiler, as this check also covers the declaration
40791         line issue mentioned above.  A comment was added to maybe remove this
40792         check once the scoping issue is resolved (and it starts to fail with
40793         newer gfortran versions).  The one used to test these changes was 13.0.
40794
40795 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40796
40797         testsuite/lib: add check_optional_entry for GDBInfoSymbols
40798         There was already a similar functionality for the GDBInfoModuleSymbols.
40799         This just extends the GDBInfoSymbols.  We will use this feature in a
40800         later commit to make a testcase less GNU specific and more flexible for
40801         other compilers.
40802
40803         Namely, in gdb.fortran/info-types.exp currenlty
40804         GDBInfoSymbols::check_entry is used to verify and test the output of the
40805         info symbols command.  The test, however was written with gfortran as a
40806         basis and some of the tests are not fair with e.g. ifx and ifort as
40807         they test for symbols that are not actually required to be emitted.  The
40808         lines
40809            GDBInfoSymbols::check_entry "${srcfile}" "" "${character1}"
40810         and
40811            GDBInfoSymbols::check_entry "${srcfile}" "37" "Type s1;"
40812
40813         check for types that are either not used in the source file (character1)
40814         or should not be emitted by the compiler at global scope (s1) thus no
40815         appearing in the info symbols command.  In order to fix this we will
40816         later use the newly introduced check_optional_entry over check_entry.
40817
40818 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40819
40820         testsuite, fortran: Add '-debug-parameters all' when using ifx/ifort
40821         In order for ifx and ifort to emit all debug entries, even for unused
40822         parameters in modules we have to define the '-debug-parameters all' flag.
40823
40824         This commit adds it to the ifx-*/ifort-* specific flags in gdb.exp.
40825
40826 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40827
40828         testsuite, fortran: add compiler dependent types to dynamic-ptype-whatis
40829         The test was earlier not using the compiler dependent type print system
40830         in fortran.exp.  I changed this.  It should generally improve the test
40831         performance for different compilers.  For ifx and gfortran I do not see
40832         any failures.
40833
40834 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40835
40836         testsuite, fortran: add required external keyword
40837         Currenlty, ifx/ifort cannot compile the given executable as it is not
40838         valid Fortran.  It is missing the external keyword on the
40839         no_arg_subroutine.  Gfortran compiles the example but this is actually
40840         a bug and there is an open gcc ticket for this here:
40841
40842            https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50377
40843
40844         Adding the keyword does not change the gfortran compiling of the example.
40845         It will, however, prevent a future fail once 50377 has been addressed.
40846
40847 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40848
40849         gdb/testsuite: disable charset.exp for intel compilers
40850         The test specifically tests for the Fortran CHARACTER(KIND=4) which is
40851         not available in ifx/ifort.
40852
40853         Since the other characters are also printed elsewhere, we disable this
40854         test for the unsupported compilers.
40855
40856 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40857
40858         gdb/testsuite: rename intel next gen c/cpp compilers
40859         The name for icx and icpx in the testsuite was earlier set to 'intel-*'
40860         by the compiler identification.  This commit changes this to 'icx-*'.
40861
40862         Note, that currently these names are not used within the testsuite so no
40863         tests have to be adapted here.
40864
40865 2022-05-31  Cristian Sandu  <cristian.sandu@intel.com>
40866             Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40867
40868         gdb/testsuite: add Fortran compiler identification to GDB
40869         This commit adds a separate Fortran compiler identification mechanism to
40870         the testsuite, similar to the existing one for C/C++.  Before this
40871         change, the options and version for the Fortran compiler specified when
40872         running the testsuite with F90_FOR_TARGET set, was detected via its
40873         respective C compiler.  So running the testsuite as
40874
40875           make check TEST=gdb.fortran/*.exp CC_FOR_TARGET=gcc F90_FOR_TARGET=ifx
40876
40877         or even
40878
40879           make check TEST=gdb.fortran/*.exp F90_FOR_TARGET=ifx
40880
40881         would use the gcc compiler inside the procedures get_compiler_info and
40882         test_compiler_info to identify compiler flags and the compiler version.
40883         This could sometimes lead to unpredictable outputs.  It also limited
40884         testsuite execution to combinations where C and Fortran compiler would
40885         come from the same family of compiers (gcc/gfortran, icc/ifort, icx/ifx,
40886         clang/flang ..).  This commit enables GDB to detect C and Fortran
40887         compilers independently of each other.
40888
40889         As most/nearly all Fortran compilers have a mechanism for preprocessing
40890         files in a C like fashion we added the exact same meachnism that already
40891         existed for C/CXX.  We let GDB preprocess a file with the compilers
40892         Fortran preprocessor and evaluate the preprocessor defined macros in that
40893         file.
40894
40895         This enables GDB to properly run heterogeneous combinations of C and
40896         Fortran compilers such as
40897
40898           CC_FOR_TARGET='gcc' and F90_FOR_TARGET='ifort'
40899
40900         or enables one to run the testsuite without specifying a C compiler as in
40901
40902           make check TESTS=gdb.fortran/*.exp F90_FOR_TARGET='ifx'
40903           make check TESTS=gdb.fortran/*.exp F90_FOR_TARGET='flang'
40904
40905         On the other hand this also requires one to always specify a
40906         identification mechanism for Fortran compilers in the compiler.F90 file.
40907
40908         We added identification for GFORTRAN, FLANG (CLASSIC and LLVM) IFX,
40909         IFORT, and ARMFLANG for now.
40910
40911         Classic and LLVM flang were each tested with their latest releases on
40912         their respective release pages.  Both get recognized by the new compiler
40913         identification and we introduced the two names flang-classic and
40914         flang-llvm to distinguish the two.  While LLVM flang is not quite mature
40915         enough yet for running the testsuite we still thought it would be a good
40916         idea to include it already.  For this we added a case for the fortran_main
40917         procedure.  LLVM flang uses 'MAIN__' as opposed to classic flang which
40918         uses 'MAIN_' here.
40919
40920         We did not have the possibility to test ARMFLANG - the versioning scheme
40921         here was extracted from its latest online documentation.
40922
40923         We changed the test_compiler_info procedure to take another optional
40924         argument, the language string, which will be passed though to the
40925         get_compiler_info procedure.  Passing 'f90' or 'c++' here will then
40926         trigger the C++/Fortran compiler identification within
40927         get_compiler_info.  The latter procedure was extended to also handle
40928         the 'f90' argument (similarly to the already existing 'c++' one).
40929
40930 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40931
40932         gdb/testsuite: move getting_compiler_info to front of gdb_compile
40933         The procedure gdb_compile queries its options via
40934
40935            [lsearch -exact $options getting_compiler_info]
40936
40937         to check whether or not it was called in with the option
40938         getting_compiler_info.  If it was called with this option it would
40939         preprocess some test input to try and figure out the actual compiler
40940         version of the compiler used.  While doing this we cannot again try to
40941         figure out the current compiler version via the 'getting_compiler_info'
40942         option as this would cause infinite recursion.  As some parts of the
40943         procedure do recursively test for the compiler version to e.g. set
40944         certain flags, at several places gdb_compile there are checks for the
40945         getting_compiler_info option needed.
40946
40947         In the procedure, there was already a variable 'getting_compiler_info'
40948         which was set to the result of the 'lsearch' query and used instead of
40949         again and again looking for getting_compiler_info in the procedure
40950         options.  But, this variable was actually set too late within the code.
40951         This lead to a mixture of querying 'getting_compiler_info' or
40952         doing an lserach on the options passed to the procedure.
40953
40954         I found this inconsistent and instead moved the variable
40955         getting_compiler_info to the front of the procedure.  It is set to true
40956         or false depending on whether or not the argument is found in the
40957         procedure's options (just as before) and queried instead of doing an
40958         lsearch on the procedure options in the rest of the procedure.
40959
40960 2022-05-31  Felix Willgerodt  <felix.willgerodt@intel.com>
40961             Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>
40962             Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40963
40964         gdb/testsuite: Fix fortran types for Intel compilers.
40965         Newer Intel compilers emit their dwarf type name in a slightly different
40966         format.  Therefore, this needs adjustment to make more tests pass in the
40967         Fortran testsuite.
40968
40969 2022-05-31  Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>
40970
40971         gdb/testsuite: Use -module option for Intel Fortran compilers
40972         The '-J' option is not supported in Intel compilers (ifx and ifort).
40973         The Intel version of the flag is '-module' which serves the same purpose.
40974
40975 2022-05-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
40976
40977         gdb/testsuite: remove F77_FOR_TARGET support
40978         The last uses of the F77_FOR_TARGET via passing f77 to GDB's compile
40979         procedure were removed in this commit
40980
40981            commit 0ecee54cfd04a60e7ca61ae07c72b20e21390257
40982            Author: Tom Tromey <tromey@redhat.com>
40983            Date:   Wed Jun 29 17:50:47 2011 +0000
40984
40985         over 10 years ago.  The last .f files in the testsuite by now are all
40986         being compiled by passing 'f90' to the GDB compile, thus only actually
40987         using F90_FOR_TARGET (array-element.f, block-data.f, subarray.f).
40988         Gfortran in this case is backwards compatible with most f77 code as
40989         claimed on gcc.gnu.org/fortran.
40990
40991         The reason we'd like to get rid of this now is, that we'll be
40992         implementing a Fortran compiler identification mechanism, similar to the
40993         C/Cpp existing ones.  It would be using the Fortran preprocessor macro
40994         defines to identify the Fortran compiler version at hand.  We found it
40995         inconsequent to only implement this for f90 but, on the other hand, f77
40996         seems deprecated.  So, with this commit we remove the remaining lines for
40997         its support.
40998
40999 2022-05-31  Pedro Alves  <pedro@palves.net>
41000
41001         Improve clear command's documentation
41002         Co-Authored-By: Eli Zaretskii <eliz@gnu.org>
41003
41004         Change-Id: I9440052fd28f795d6f7c93a4576beadd21f28885
41005
41006 2022-05-31  Pedro Alves  <pedro@palves.net>
41007
41008         Clarify why we unit test matching symbol names with 0xff characters
41009         In the name matching unit tests in gdb/dwarf2/read.c, explain better
41010         why we test symbols with \377 / 0xff characters (Latin1 'ÿ').
41011
41012         Change-Id: I517f13adfff2e4d3cd783fec1d744e2b26e18b8e
41013
41014 2022-05-31  Pedro Alves  <pedro@palves.net>
41015
41016         Improve break-range's documentation
41017         Change-Id: Iac26e1d2e7d8dc8a7d9516e6bdcc5c3fc4af45c8
41018
41019         Explicitly mention yet-unloaded shared libraries in location spec examples
41020         Change-Id: I05639ddb3bf620c7297b57ed286adc3aa926b7b6
41021
41022 2022-05-31  Alan Modra  <amodra@gmail.com>
41023
41024         sparc64 segfault in finish_dynamic_symbol
41025         SYMBOL_REFERENCES_LOCAL can return true for undefined symbols.  This
41026         can result in a segfault when running sparc64 ld/testsuite/ld-vsb
41027         tests that expect a failure.
41028
41029                 * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Don't
41030                 access u.def.section on non-default visibility undefined symbol.
41031
41032 2022-05-31  Alan Modra  <amodra@gmail.com>
41033
41034         ia64 gas: Remove unnecessary init
41035         The whole struct is cleared by alloc_record.
41036
41037                 * config/tc-ia64.c (output_prologue, output_prologue_gr): Don't
41038                 zero r.record.r.mask.
41039
41040 2022-05-31  Alan Modra  <amodra@gmail.com>
41041
41042         v850_elf_set_note prototype
41043         v850_elf_set_note is declared using an unsigned int note param in
41044         elf32-v850.h but defined with enum c850_notes note in elf32-v850.c.
41045         Current mainline gcc is warning about this.  Huh.
41046
41047                 * elf32-v850.c (v850_elf_set_note): Make "note" param an
41048                 unsigned int.
41049
41050 2022-05-31  Alan Modra  <amodra@gmail.com>
41051
41052         Import libiberty from gcc
41053                 PR 29200
41054         include/
41055                 * ansidecl.h,
41056                 * demangle.h: Import from gcc.
41057         libiberty/
41058                 * cp-demangle.c,
41059                 * testsuite/demangle-expected: Import from gcc.
41060
41061 2022-05-31  Andrew Burgess  <aburgess@redhat.com>
41062
41063         gdb/testsuite: resolve duplicate test name in gdb.trace/signal.exp
41064         Spotted a duplicate test name in gdb.trace/signal.exp, resolved in
41065         this commit by making use of 'with_test_prefix'.
41066
41067 2022-05-31  Alan Modra  <amodra@gmail.com>
41068
41069         Ajdust more tests for opcodes/i386: remove trailing whitespace
41070         git commit 202be274a4 also missed adjusting a few testsuite files.
41071         This fixes
41072         i686-vxworks  +FAIL: VxWorks shared library test 1
41073         i686-vxworks  +FAIL: VxWorks executable test 1 (dynamic)
41074
41075 2022-05-31  Alan Modra  <amodra@gmail.com>
41076
41077         Trailing spaces in objdump -r header
41078         git commit 202be274a4 went a little wild in removing trailing spaces
41079         in gas/testsuite/gas/i386/{secidx.d,secrel.d}, causing
41080         x86_64-w64-mingw32  +FAIL: i386 secrel reloc
41081         x86_64-w64-mingw32  +FAIL: i386 secidx reloc
41082
41083         I could have just replaced the trailing space, but let's fix the
41084         objdump output instead.  Touches lots of testsuite files.
41085
41086 2022-05-31  GDB Administrator  <gdbadmin@sourceware.org>
41087
41088         Automatic date update in version.in
41089
41090 2022-05-30  Simon Marchi  <simon.marchi@efficios.com>
41091
41092         gdb/testsuite: fix gdb.trace/signal.exp on x86
41093         Patch
41094
41095           202be274a41a ("opcodes/i386: remove trailing whitespace from insns with zero operands")
41096
41097         causes this regression:
41098
41099           FAIL: gdb.trace/signal.exp: find syscall insn in kill
41100
41101         It's because the test still expects to match a whitespace after the
41102         instruction, which the patch mentioned above removed.  Remove the
41103         whitespaces for the regexp.
41104
41105         Change-Id: Ie194273cc942bfd91332d4035f6eec55b7d3a428
41106
41107 2022-05-30  Pedro Alves  <pedro@palves.net>
41108
41109         gdb/manual: Introduce location specs
41110         The current "Specify Location" section of the GDB manual starts with:
41111
41112          "Several @value{GDBN} commands accept arguments that specify a location
41113          of your program's code."
41114
41115         And then, such commands are documented as taking a "location"
41116         argument.  For example, here's a representative subset:
41117
41118          @item break @var{location}
41119          @item clear @var{location}
41120          @item until @var{location}
41121          @item list @var{location}
41122          @item edit @var{location}
41123          @itemx info line @var{location}
41124          @item info macros @var{location}
41125          @item trace @var{location}
41126          @item info scope @var{location}
41127          @item maint agent @r{[}-at @var{location}@r{,}@r{]} @var{expression}
41128
41129         The issue here is that "location" isn't really correct for most of
41130         these commands.  Instead, the "location" argument is really a
41131         placeholder that represent an umbrella term for all of the
41132         "linespecs", "explicit location", and "address location" input
41133         formats.  GDB parses these and then finds the actual code locations
41134         (plural) in the program that match.  For example, a "location"
41135         specified like "-function func" will actually match all the code
41136         locations in the program that correspond to the address/file/lineno of
41137         all the functions named "func" in all the loaded programs and shared
41138         libraries of all the inferiors.  A location specified like "-function
41139         func -label lab" matches all the addresses of C labels named "lab" in
41140         all functions named "func".  Etc.
41141
41142         This means that several of the commands that claim they accept a
41143         "location", actually end up working with multiple locations, and the
41144         manual doesn't explain that all that well.  In some cases, the command
41145         will work with all the resolved locations.  In other cases, the
41146         command aborts with an error if the location specification resolves to
41147         multiple locations in the program.  In other cases, GDB just
41148         arbitrarily and silently picks whatever is the first resolved code
41149         location (which sounds like should be improved).
41150
41151         To clarify this, I propose we use the term "Location Specification",
41152         with shorthand "locaction spec", when we're talking about the user
41153         input, the argument or arguments that is/are passed to commands to
41154         instruct GDB how to find locations of interest.  This is distinct from
41155         the actual code locations in the program, which are what GDB finds
41156         based on the user-specified location spec.  Then use "location
41157         specification or the shorter "location spec" thoughout instead of
41158         "location" when we're talking about the user input.
41159
41160         Thus, this commit does the following:
41161
41162         - renames the "Specify Location" section of the manual to "Location
41163           Specifications".
41164
41165         - It then introduces the term "Location Specification", with
41166           corresponding shorthand "location spec", as something distinct from
41167           an actual code location in the program.  It explains what a concrete
41168           code location is.  It explains that a location specification may be
41169           incomplete, and that may match multiple code locations in the
41170           program, or no code location at all.  It gives examples.  Some
41171           pre-existing examples were moved from the "Set Breaks" section, and
41172           a few new ones that didn't exist yet were added.  I think it is
41173           better to have these centralized in this "Location Specification"
41174           section, since all the other commands that accept a location spec
41175           have an xref that points there.
41176
41177         - Goes through the manual, and where "@var{location}" was used for a
41178           command argument, updated it to say "@var{locspec}" instead.  At the
41179           same time, tweaks the description of the affected commands to
41180           describe what happens when the location spec resolves to more than
41181           one location.  Most commands just did not say anything about that.
41182
41183           One command -- "maint agent -at @var{location}" -- currently says it
41184           accepts a "location", suggesting it can accept address and explicit
41185           locations too, but that's incorrect.  In reality, it only accepts
41186           linespecs, so fix it accordingly.
41187
41188           One MI command -- "-trace-find line" -- currently says it accepts a
41189           "line specification", but it can accept address and explicit
41190           locations too, so fix it accordingly.
41191
41192         Special thanks goes to Eli Zaretskii for reviews and rewording
41193         suggestions.
41194
41195         Change-Id: Ic42ad8565e79ca67bfebb22cbb4794ea816fd08b
41196
41197 2022-05-30  Luis Machado  <luis.machado@arm.com>
41198
41199         Move 64-bit BFD files from ALL_TARGET_OBS to ALL_64_TARGET_OBS
41200         Doing a 32-bit build with "--enable-targets=all --disable-sim" fails to link
41201         properly.
41202
41203         --
41204
41205         loongarch-tdep.o: In function `loongarch_gdbarch_init':
41206         binutils-gdb/gdb/loongarch-tdep.c:443: undefined reference to `loongarch_r_normal_name'
41207         loongarch-tdep.o: In function `loongarch_fetch_instruction':
41208         binutils-gdb/gdb/loongarch-tdep.c:37: undefined reference to `loongarch_insn_length'
41209         loongarch-tdep.o: In function `loongarch_scan_prologue(gdbarch*, unsigned long long, unsigned long long, frame_info*, trad_frame_cache*) [clone .isra.4]':
41210         binutils-gdb/gdb/loongarch-tdep.c:87: undefined reference to `loongarch_insn_length'
41211         binutils-gdb/gdb/loongarch-tdep.c:88: undefined reference to `loongarch_decode_imm'
41212         binutils-gdb/gdb/loongarch-tdep.c:89: undefined reference to `loongarch_decode_imm'
41213         binutils-gdb/gdb/loongarch-tdep.c:90: undefined reference to `loongarch_decode_imm'
41214         binutils-gdb/gdb/loongarch-tdep.c:91: undefined reference to `loongarch_decode_imm'
41215         binutils-gdb/gdb/loongarch-tdep.c:92: undefined reference to `loongarch_decode_imm'
41216
41217         --
41218
41219         Given the list of 64-bit BFD files in
41220         opcodes/Makefile.am:TARGET64_LIBOPCODES_CFILES, it looks like GDB's
41221         ALL_TARGET_OBS list is including files that should be included in
41222         ALL_64_TARGET_OBS instead.
41223
41224         This patch accomplishes this and enables a 32-bit build with
41225         "--enable-targets=all --disable-sim" to complete.
41226
41227         Moving the bpf, tilegx and loongarch files to the correct list means GDB can
41228         find the correct disassembler function instead of finding a null pointer.
41229
41230         We still need the "--disable-sim" switch (or "--enable-64-bit-bfd") to
41231         make a 32-bit build with "--enable-targets=all" complete correctly
41232
41233 2022-05-30  Luis Machado  <luis.machado@arm.com>
41234
41235         Fix failing test for armeb-gnu-eabi
41236         The following test fails on the armeb-gnu-eabi target:
41237
41238         FAIL: Unwind information for Armv8.1-M.Mainline PACBTI extension
41239
41240         This patch adjusts the expected output for big endian.
41241
41242 2022-05-30  Alan Modra  <amodra@gmail.com>
41243
41244         Use a union to avoid casts in bfd/doc/chew.c
41245         This fixes -Wpedantic warnings in chew.c.  Conversion between function
41246         and object pointers is not guaranteed.  They can even be different
41247         sizes, not that we're likely to encounter build machines like that
41248         nowadays.
41249
41250                 PR 29194
41251                 * doc/chew.c (pcu): New union typedef.
41252                 (dict_type, pc): Use it here.  Adjust uses of pc.
41253                 (add_to_definition): Make "word" param a pcu.  Adjust all uses
41254                 of function.
41255                 (stinst_type): Delete.
41256
41257 2022-05-30  Alan Modra  <amodra@gmail.com>
41258
41259         use libiberty xmalloc in bfd/doc/chew.c
41260         Catch out of memory.
41261
41262                 * doc/chew.c: Include libibery.h.
41263                 (init_string_with_size, nextword): Replace malloc with xmalloc.
41264                 (newentry, add_to_definition): Likewise.
41265                 (catchar, catbuf): Replace realloc with xrealloc.
41266                 (add_intrinsic): Replace strdup with xstrdup.
41267                 * doc/local.mk (LIBIBERTY): Define.
41268                 (chew): Link against libiberty.
41269                 * Makefile.in: Regenerate.
41270
41271 2022-05-30  Alan Modra  <amodra@gmail.com>
41272
41273         Update K&R functions in bfd/doc/chew.c
41274                 * doc/chew.c: Update function definitions to ISO C, remove
41275                 now unnecessary prototypes.
41276
41277 2022-05-30  Alan Modra  <amodra@gmail.com>
41278
41279         Reorganise bfd/doc/chew.c a little
41280         This also removes some unused variables, and deletes support for the
41281         "var" keyword which isn't used and was broken.  (No means to set
41282         variables, and add_var used push_number inconsistent with its use
41283         elsewhere.)
41284
41285                 * doc/chew.c: Move typedefs before variables, variables before
41286                 functions.
41287                 (die): Move earlier.
41288                 (word_type, sstack, ssp): Delete.
41289                 (dict_type): Delete var field.
41290                 (add_var): Delete.
41291                 (compile): Remove "var" support.
41292
41293 2022-05-30  jiawei  <jiawei@iscas.ac.cn>
41294
41295         RISC-V: Add zhinx extension supports.
41296         The zhinx extension is a sub-extension in zfinx, corresponding to
41297         zfh extension but use GPRs instead of FPRs.
41298
41299         This patch expanded the zfh insn class define, since zfh and zhinx
41300         use the same opcodes, thanks for Nelson's works.
41301
41302         changelog in V2: Add missing classes of 'zfh' and 'zhinx' in
41303         "riscv_multi_subset_supports_ext".
41304
41305         bfd/ChangeLog:
41306
41307                 * elfxx-riscv.c (riscv_multi_subset_supports): New extensions.
41308                 (riscv_multi_subset_supports_ext): New extensions.
41309
41310         gas/ChangeLog:
41311
41312                 * testsuite/gas/riscv/fp-zhinx-insns.d: New test.
41313                 * testsuite/gas/riscv/fp-zhinx-insns.s: New test.
41314
41315         include/ChangeLog:
41316
41317                 * opcode/riscv.h (enum riscv_insn_class): New INSN classes.
41318
41319         opcodes/ChangeLog:
41320
41321                 * riscv-opc.c: Modify INSN_CLASS.
41322
41323 2022-05-30  GDB Administrator  <gdbadmin@sourceware.org>
41324
41325         Automatic date update in version.in
41326
41327 2022-05-29  GDB Administrator  <gdbadmin@sourceware.org>
41328
41329         Automatic date update in version.in
41330
41331 2022-05-28  Andrew Burgess  <aburgess@redhat.com>
41332
41333         gdb/python: improve formatting of help text for user defined commands
41334         Consider this command defined in Python (in the file test-cmd.py):
41335
41336           class test_cmd (gdb.Command):
41337             """
41338             This is the first line.
41339               Indented second line.
41340             This is the third line.
41341             """
41342
41343             def __init__ (self):
41344               super ().__init__ ("test-cmd", gdb.COMMAND_OBSCURE)
41345
41346             def invoke (self, arg, from_tty):
41347               print ("In test-cmd")
41348
41349           test_cmd()
41350
41351         Now, within a GDB session:
41352
41353           (gdb) source test-cmd.py
41354           (gdb) help test-cmd
41355
41356             This is the first line.
41357               Indented second line.
41358             This is the third line.
41359
41360           (gdb)
41361
41362         I think there's three things wrong here:
41363
41364           1. The leading blank line,
41365           2. The trailing blank line, and
41366           3. Every line is indented from the left edge slightly.
41367
41368         The problem of course, is that GDB is using the Python doc string
41369         verbatim as its help text.  While the user has formatted the help text
41370         so that it appears clear within the .py file, this means that the text
41371         appear less well formatted when displayed in the "help" output.
41372
41373         The same problem can be observed for gdb.Parameter objects in their
41374         set/show output.
41375
41376         In this commit I aim to improve the "help" output for commands and
41377         parameters.
41378
41379         To do this I have added gdbpy_fix_doc_string_indentation, a new
41380         function that rewrites the doc string text following the following
41381         rules:
41382
41383           1. Leading blank lines are removed,
41384           2. Trailing blank lines are removed, and
41385           3. Leading whitespace is removed in a "smart" way such that the
41386           relative indentation of lines is retained.
41387
41388         With this commit in place the above example now looks like this:
41389
41390           (gdb) source ~/tmp/test-cmd.py
41391           (gdb) help test-cmd
41392           This is the first line.
41393             Indented second line.
41394           This is the third line.
41395           (gdb)
41396
41397         Which I think is much neater.  Notice that the indentation of the
41398         second line is retained.  Any blank lines within the help text (not
41399         leading or trailing) will be retained.
41400
41401         I've added a NEWS entry to note that there has been a change in
41402         behaviour, but I didn't update the manual.  The existing manual is
41403         suitably vague about how the doc string is used, so I think the new
41404         behaviour is covered just as well by the existing text.
41405
41406 2022-05-28  Andrew Burgess  <aburgess@redhat.com>
41407
41408         gdb: use gdb::unique_xmalloc_ptr<char> for docs in cmdpy_init
41409         Make use of gdb::unique_xmalloc_ptr<char> to hold the documentation
41410         string in cmdpy_init (when creating a custom GDB command in Python).
41411         I think this is all pretty straight forward, the only slight weirdness
41412         is the removal of the call to free toward the end of this function.
41413
41414         Prior to this commit, if an exception was thrown after the GDB command
41415         was created then we would (I think) end up freeing the documentation
41416         string even though the command would remain registered with GDB, which
41417         would surely lead to undefined behaviour.
41418
41419         After this commit we release the doc string at the point that we hand
41420         it over to the command creation routines.  If we throw _after_ the
41421         command has been created within GDB then the doc string will be left
41422         live.  If we throw during the command creation itself (either from
41423         add_prefix_cmd or add_cmd) then it is up to those functions to free
41424         the doc string (I suspect we don't, but I think in general the
41425         commands are pretty bad at cleaning up after themselves, so I don't
41426         think this is a huge problem).
41427
41428 2022-05-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
41429
41430         gprofng: fix build with -mx32
41431         gprofng/ChangeLog
41432         2022-05-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
41433
41434                 PR gprofng/28983
41435                 PR gprofng/29143
41436                 * src/Experiment.cc (write_header): Fix argument for ctime.
41437                 Fix -Wformat= warnings.
41438                 * src/Dbe.cc: Likewise.
41439                 * src/DwarfLib.h: Fix [-Wsign-compare] warnings.
41440                 * src/Experiment.h: Likewise.
41441                 * src/ipc.cc: Fix -Wformat= warnings.
41442
41443 2022-05-28  GDB Administrator  <gdbadmin@sourceware.org>
41444
41445         Automatic date update in version.in
41446
41447 2022-05-27  Tom Tromey  <tom@tromey.com>
41448
41449         Fix crash with "maint print arc"
41450         Luis noticed that "maint print arc" would crash, because the command
41451         handler did not find "show" in the command name, violating an
41452         invariant.  This patch fixes the bug by changing the registration to
41453         use add_basic_prefix_cmd instead.
41454
41455 2022-05-27  Andrew Burgess  <aburgess@redhat.com>
41456
41457         opcodes/i386: remove trailing whitespace from insns with zero operands
41458         While working on another patch[1] I had need to touch this code in
41459         i386-dis.c:
41460
41461           ins->obufp = ins->mnemonicendp;
41462           for (i = strlen (ins->obuf) + prefix_length; i < 6; i++)
41463             oappend (ins, " ");
41464           oappend (ins, " ");
41465           (*ins->info->fprintf_styled_func)
41466             (ins->info->stream, dis_style_mnemonic, "%s", ins->obuf);
41467
41468         What this code does is add whitespace after the instruction mnemonic
41469         and before the instruction operands.
41470
41471         The problem I ran into when working on this code can be seen by
41472         assembling this input file:
41473
41474             .text
41475             nop
41476             retq
41477
41478         Now, when I disassemble, here's the output.  I've replaced trailing
41479         whitespace with '_' so that the issue is clearer:
41480
41481             Disassembly of section .text:
41482
41483             0000000000000000 <.text>:
41484                0:       90                      nop
41485                1:       c3                      retq___
41486
41487         Notice that there's no trailing whitespace after 'nop', but there are
41488         three spaces after 'retq'!
41489
41490         What happens is that instruction mnemonics are emitted into a buffer
41491         instr_info::obuf, then instr_info::mnemonicendp is setup to point to
41492         the '\0' character at the end of the mnemonic.
41493
41494         When we emit the whitespace, this is then added starting at the
41495         mnemonicendp position.  Lets consider 'retq', first the buffer is
41496         setup like this:
41497
41498           'r' 'e' 't' 'q' '\0'
41499
41500         Then we add whitespace characters at the '\0', converting the buffer
41501         to this:
41502
41503           'r' 'e' 't' 'q' ' ' ' ' ' ' '\0'
41504
41505         However, 'nop' is actually an alias for 'xchg %rax,%rax', so,
41506         initially, the buffer is setup like this:
41507
41508           'x' 'c' 'h' 'g' '\0'
41509
41510         Then in NOP_Fixup we spot that we have an instruction that is an alias
41511         for 'nop', and adjust the buffer to this:
41512
41513           'n' 'o' 'p' '\0' '\0'
41514
41515         The second '\0' is left over from the original buffer contents.
41516         However, when we rewrite the buffer, we don't afjust mnemonicendp,
41517         which still points at the second '\0' character.
41518
41519         Now, when we insert whitespace we get:
41520
41521           'n' 'o' 'p' '\0' ' ' ' ' ' ' ' ' '\0'
41522
41523         Notice the whitespace is inserted after the first '\0', so, when we
41524         print the buffer, the whitespace is not printed.
41525
41526         The fix for this is pretty easy, I can change NOP_Fixup to adjust
41527         mnemonicendp, but now a bunch of tests start failing, we now produce
41528         whitespace after the 'nop', which the tests don't expect.
41529
41530         So, I could update the tests to expect the whitespace....
41531
41532         ...except I'm not a fan of trailing whitespace, so I'd really rather
41533         not.
41534
41535         Turns out, I can pretty easily update the whitespace emitting code to
41536         spot instructions that have zero operands and just not emit any
41537         whitespace in this case.  So this is what I've done.
41538
41539         I've left in the fix for NOP_Fixup, I think updating mnemonicendp is
41540         probably a good thing, though this is not really required any more.
41541
41542         I've then updated all the tests that I saw failing to adjust the
41543         expected patterns to account for the change in whitespace.
41544
41545         [1] https://sourceware.org/pipermail/binutils/2022-April/120610.html
41546
41547 2022-05-27  Alan Modra  <amodra@gmail.com>
41548
41549         Replace bfd_hostptr_t with uintptr_t
41550         bfd_hostptr_t is defined as a type large enough to hold either a long
41551         or a pointer.  It mostly appears in the coff backend code in casts.
41552         include/coff/internal.h struct internal_syment and union
41553         internal_auxent have the only uses in data structures, where
41554         comparison with include/coff/external.h and other code reveals that
41555         the type only needs to be large enough for a 32-bit integer or a
41556         pointer.  That should mean replacing with uintptr_t is OK.
41557
41558         Remove much of BFD_HOST configury
41559         This patch removes the definition of bfd_uint64_t and bfd_int64_t as
41560         well as most BFD_HOST_* which are now unused.
41561
41562         Remove use of bfd_uint64_t and similar
41563         Requiring C99 means that uses of bfd_uint64_t can be replaced with
41564         uint64_t, and similarly for bfd_int64_t, BFD_HOST_U_64_BIT, and
41565         BFD_HOST_64_BIT.  This patch does that, removes #ifdef BFD_HOST_*
41566         and tidies a few places that print 64-bit values.
41567
41568 2022-05-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
41569
41570         gprofng: fix build with --disable-shared
41571         gprofng/ChangeLog
41572         2022-05-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
41573
41574                 * libcollector/configure.ac: Use AC_MSG_WARN instead of AC_MSG_ERROR
41575                 * libcollector/configure: Rebuild.
41576
41577 2022-05-27  Jan Beulich  <jbeulich@suse.com>
41578
41579         x86/Intel: allow MASM representation of embedded rounding / SAE
41580         MASM doesn't support the separate operand form; the modifier belongs
41581         after the instruction instead. Accept this form alongside the original
41582         (now legacy) one. Short of having access to a MASM version to actually
41583         check in how far "after the instruction" is a precise statement in their
41584         documentation, allow both that and the SDM mandated form where the
41585         modifier is on the last register operand (with a possible immediate
41586         operand following).
41587
41588         Sadly the split out function, at least for the time being, needs to cast
41589         away constness at some point, as the two callers disagree in this
41590         regard.
41591
41592         Adjust some, but not all of the testcases.
41593
41594 2022-05-27  Jan Beulich  <jbeulich@suse.com>
41595
41596         x86: re-work AVX512 embedded rounding / SAE
41597         As a preparatory step to allowing proper non-operand forms of specifying
41598         embedded rounding / SAE, convert the internal representation to non-
41599         operand form. While retaining properties (and in a few cases perhaps
41600         providing more meaningful diagnostics), this means doing away with a few
41601         hundred standalone templates, thus - as a nice side effect - reducing
41602         memory consumption / cache occupancy.
41603
41604         x86/Intel: adjust representation of embedded rounding / SAE
41605         MASM doesn't consider {sae} and alike a separate operand; it is attached
41606         to the last register operand instead, just like spelled out by the SDM.
41607         Make the disassembler follow this first, before also adjusting the
41608         assembler (such that it'll be easy to see that the assembler change
41609         doesn't alter generated code).
41610
41611 2022-05-27  Jan Beulich  <jbeulich@suse.com>
41612
41613         x86/Intel: allow MASM representation of embedded broadcast
41614         MASM doesn't support the {1to<n>} form; DWORD BCST (paralleling
41615         DWORD PTR) and alike are to be used there instead. Accept these forms
41616         alongside the original (now legacy) ones.
41617
41618         Acceptance of the original {1to<n>} operand suffix is retained both for
41619         backwards compatibility and to disambiguate VFPCLASSP{S,D,H} and vector
41620         conversions with shrinking element sizes. I have no insight (yet) into
41621         how MASM expects those to be disambiguated.
41622
41623         Adjust some, but not all of the testcases.
41624
41625 2022-05-27  Jan Beulich  <jbeulich@suse.com>
41626
41627         x86/Intel: adjust representation of embedded broadcast
41628         MASM doesn't support the {1to<n>} form; DWORD BCST (paralleling
41629         DWORD PTR) and alike are to be used there instead. Make the disassembler
41630         follow this first, before also adjusting the assembler (such that it'll
41631         be easy to see that the assembler change doesn't alter generated code).
41632
41633         For VFPCLASSP{S,D,H} and vector conversions with shrinking element sizes
41634         the original {1to<n>} operand suffix is retained, to disambiguate
41635         output. I have no insight (yet) into how MASM expects those to be
41636         disambiguated.
41637
41638 2022-05-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
41639
41640         gprofng: fix build with -mx32
41641         gprofng/ChangeLog
41642         2022-05-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
41643
41644                 PR gprofng/28983
41645                 * libcollector/libcol_util.h (__collector_getsp, __collector_getfp,
41646                 __collector_getpc): Adapt for build with -mx32
41647                 * libcollector/heaptrace.c: Fix -Wpointer-to-int-cast warnings.
41648                 * libcollector/hwprofile.h: Likewise.
41649                 * libcollector/mmaptrace.c: Likewise.
41650                 * libcollector/synctrace.c: Likewise.
41651                 * libcollector/unwind.c: Likewise.
41652
41653 2022-05-27  GDB Administrator  <gdbadmin@sourceware.org>
41654
41655         Automatic date update in version.in
41656
41657 2022-05-27  Hans-Peter Nilsson  <hp@axis.com>
41658
41659         ld: cris*-elf: Default to --no-warn-rwx-segment
41660         ld:
41661                 configure.tgt (cris-*-*, crisv32-*-* sans *-aout and *-linux): Unless
41662                 specified through the --enable-* -option, default to
41663                 --no-warn-rwx-segment.
41664
41665         Change-Id: I846bcd3e6762da807b17215a9fe337461ea0d710
41666
41667 2022-05-27  Hans-Peter Nilsson  <hp@axis.com>
41668
41669         cris: bfd: Correct default to no execstack
41670         In the now-historical CRIS glibc port, the default stack permission
41671         was no-exec as in "#define DEFAULT_STACK_PERMS (PF_R|PF_W)", and the
41672         gcc port only emits the executable-stack marker when needed; when
41673         emitting code needing it.  In other words, the binutils setting
41674         mismatches.  It doesn't matter much, except being confusing and
41675         defaulting to "off" is more sane.
41676
41677         ld:
41678
41679                 * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Switch to 0
41680                 for cris*-*-*.
41681
41682         bfd:
41683                 * elf32-cris.c (elf_backend_default_execstack): Define to 0.
41684
41685         Change-Id: I52f37598f119b19111c7a6546c00a627fca0f396
41686
41687 2022-05-26  John Baldwin  <jhb@FreeBSD.org>
41688
41689         aarch64-fbsd-nat: Move definition of debug_regs_probed under HAVE_DBREG.
41690         This fixes the build on older FreeBSD systems without support for
41691         hardware breakpoints/watchpoints.
41692
41693 2022-05-26  Lancelot SIX  <lancelot.six@amd.com>
41694
41695         gdb: Change psymbol_functions::require_partial_symbols to partial_symbols
41696         The previous patch ensured that partial symbols are read before calling
41697         most of the quick_function's methods.
41698
41699         The psymbol_functions class has the require_partial_symbols method which
41700         serves this exact purpose, and does not need to do it anymore.
41701
41702         This patch renames this method to partial_symbols and makes it an accessor
41703         which asserts that partial symbols have been read at this point.
41704
41705         Regression tested on x86_64-linux.
41706
41707 2022-05-26  Lancelot SIX  <lancelot.six@amd.com>
41708
41709         gdb: Require psymtab before calling quick_functions in objfile
41710         The recent DWARF indexer rewrite introduced a regression when debugging
41711         a forking program.
41712
41713         Here is a way to reproduce the issue (there might be other ways, but one
41714         is enough and this one mimics the situation we encountered).  Consider a
41715         program which forks, and the child loads a shared library and calls a
41716         function in this shared library:
41717
41718             if (fork () == 0)
41719               {
41720                 void *solib = dlopen (some_solib, RTLD_NOW);
41721                 void (*foo) () = dlsym (some_solib, "foo");
41722                 foo ();
41723               }
41724
41725         Suppose that this program is compiled without debug info, but the shared
41726         library it loads has debug info enabled.
41727
41728         When debugging such program with the following options:
41729
41730           - set detach-on-fork off
41731           - set follow-fork-mode child
41732
41733         we see something like:
41734
41735             (gdb) b foo
41736             Function "foo" not defined.
41737             Make breakpoint pending on future shared library load? (y or [n]) y
41738             Breakpoint 1 (foo) pending.
41739             (gdb) run
41740             Starting program: a.out
41741             [Attaching after process 19720 fork to child process 19723]
41742             [New inferior 2 (process 19723)]
41743             [Switching to process 19723]
41744
41745             Thread 2.1 "a.out" hit Breakpoint 1, 0x00007ffff7fc3101 in foo () from .../libfoo.so
41746             (gdb) list
41747
41748             Fatal signal: Segmentation fault
41749             ----- Backtrace -----
41750             0x55a278f77d76 gdb_internal_backtrace_1
41751                     ../../gdb/bt-utils.c:122
41752             0x55a278f77f83 _Z22gdb_internal_backtracev
41753                     ../../gdb/bt-utils.c:168
41754             0x55a27940b83b handle_fatal_signal
41755                     ../../gdb/event-top.c:914
41756             0x55a27940bbb1 handle_sigsegv
41757                     ../../gdb/event-top.c:987
41758             0x7effec0343bf ???
41759                     /build/glibc-sMfBJT/glibc-2.31/nptl/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
41760             0x55a27924c9d3 _ZNKSt15__uniq_ptr_implI18dwarf2_per_cu_data26dwarf2_per_cu_data_deleterE6_M_ptrEv
41761                     /usr/include/c++/9/bits/unique_ptr.h:154
41762             0x55a279248bc9 _ZNKSt10unique_ptrI18dwarf2_per_cu_data26dwarf2_per_cu_data_deleterE3getEv
41763                     /usr/include/c++/9/bits/unique_ptr.h:361
41764             0x55a2792ae718 _ZN27dwarf2_base_index_functions23find_last_source_symtabEP7objfile
41765                     ../../gdb/dwarf2/read.c:3164
41766             0x55a279afb93e _ZN7objfile23find_last_source_symtabEv
41767                     ../../gdb/symfile-debug.c:139
41768             0x55a279aa3040 _Z20select_source_symtabP6symtab
41769                     ../../gdb/source.c:365
41770             0x55a279aa22a1 _Z34set_default_source_symtab_and_linev
41771                     ../../gdb/source.c:268
41772             0x55a27903c44c list_command
41773                     ../../gdb/cli/cli-cmds.c:1185
41774             0x55a279051233 do_simple_func
41775                     ../../gdb/cli/cli-decode.c:95
41776             0x55a27905f221 _Z8cmd_funcP16cmd_list_elementPKci
41777                     ../../gdb/cli/cli-decode.c:2514
41778             0x55a279c3b0ba _Z15execute_commandPKci
41779                     ../../gdb/top.c:660
41780             0x55a27940a6c3 _Z15command_handlerPKc
41781                     ../../gdb/event-top.c:598
41782             0x55a27940b032 _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
41783                     ../../gdb/event-top.c:797
41784             0x55a279caf401 tui_command_line_handler
41785                     ../../gdb/tui/tui-interp.c:278
41786             0x55a279409098 gdb_rl_callback_handler
41787                     ../../gdb/event-top.c:230
41788             0x55a279ed5df2 rl_callback_read_char
41789                     ../../../readline/readline/callback.c:281
41790             0x55a279408bd8 gdb_rl_callback_read_char_wrapper_noexcept
41791                     ../../gdb/event-top.c:188
41792             0x55a279408de7 gdb_rl_callback_read_char_wrapper
41793                     ../../gdb/event-top.c:205
41794             0x55a27940a061 _Z19stdin_event_handleriPv
41795                     ../../gdb/event-top.c:525
41796             0x55a27a23771e handle_file_event
41797                     ../../gdbsupport/event-loop.cc:574
41798             0x55a27a237f5f gdb_wait_for_event
41799                     ../../gdbsupport/event-loop.cc:700
41800             0x55a27a235d81 _Z16gdb_do_one_eventv
41801                     ../../gdbsupport/event-loop.cc:237
41802             0x55a2796c2ef0 start_event_loop
41803                     ../../gdb/main.c:418
41804             0x55a2796c3217 captured_command_loop
41805                     ../../gdb/main.c:478
41806             0x55a2796c717b captured_main
41807                     ../../gdb/main.c:1340
41808             0x55a2796c7217 _Z8gdb_mainP18captured_main_args
41809                     ../../gdb/main.c:1355
41810             0x55a278d0b381 main
41811                     ../../gdb/gdb.c:32
41812             ---------------------
41813             A fatal error internal to GDB has been detected, further
41814             debugging is not possible.  GDB will now terminate.
41815
41816             This is a bug, please report it.  For instructions, see:
41817             <https://www.gnu.org/software/gdb/bugs/>.
41818
41819         The first issue observed is in the message printed when hitting the
41820         breakpoint.  It says that there was a break in the .so file as if there
41821         was no debug info associated with it, but there is.  Later, if we try to
41822         display the source where the execution stopped, we have a segfault.
41823
41824         Note that not having the debug info on the main binary is not strictly
41825         required to encounter some issues, it only is to encounter the segfault.
41826         If the main binary has debug information, GDB shows some source form the
41827         main binary, unrelated to where we stopped.
41828
41829         The core of the issue is that GDB never loads the psymtab for the
41830         library.  It is not loaded when we first see the .so because in case of
41831         detach-on-fork off, follow-fork-mode child, infrun.c sets
41832         child_inf->symfile_flags = SYMFILE_NO_READ to delay the psymtab loading
41833         as much as possible.  If we compare to what was done to handle this
41834         before the new indexer was activated, the psymatb construction for the
41835         shared library was done under
41836         psymbol_functions::expand_symtabs_matching:
41837
41838             bool
41839             psymbol_functions::expand_symtabs_matching (...)
41840             {
41841                 for (partial_symtab *ps : require_partial_symbols (objfile))
41842                 ...
41843             }
41844
41845         The new indexer's expand_symtabs_matching callback does not have a call
41846         to the objfile's require_partial_symbols, so if the partial symbol table
41847         is not loaded at this point, there is no mechanism to fix this.
41848
41849         Instead of requiring each implementation of the quick_functions to check
41850         that partial symbols have been read, I think it is safer to enforce this
41851         when calling the quick functions.  The general pattern for calling the
41852         quick functions is:
41853
41854             for (auto *iter : qf)
41855               iter->the_actual_method_call (...)
41856
41857         This patch proposes to wrap the access of the `qf` field with an accessor
41858         which ensures that partial symbols have been read before iterating:
41859         qf_require_partial_symbols.  All calls to quick functions are updated
41860         except:
41861
41862         - quick_functions::dump
41863         - quick_functions::read_partial_symbols (from
41864           objfile::require_partial_symbols)
41865         - quick_functions::can_lazily_read_symbols and quick_functions::has_symbols
41866           (from objfile::has_partial_symbols)
41867
41868         Regression tested on x86_64-gnu-linux.
41869
41870         Change-Id: I39a13a937fdbaae613a5cf68864b021000554546
41871
41872 2022-05-26  Tom Tromey  <tom@tromey.com>
41873
41874         Fix crash in new DWARF indexer
41875         PR gdb/29128 points out a crash in the new DWARF index code.  This
41876         happens if the aranges for a CU claims a PC, but the symtab that is
41877         created during CU expansion does not actually contain the PC.  This
41878         can only occur due to bad debuginfo, but at the same time, gdb should
41879         not crash.
41880
41881         This patch fixes the bug and further merges some code into
41882         dwarf2_base_index_functions.  This merger helps prevent the same issue
41883         from arising from the other index implementations.
41884
41885         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29128
41886
41887 2022-05-26  Tom Tromey  <tromey@adacore.com>
41888
41889         Finalize each cooked index separately
41890         After DWARF has been scanned, the cooked index code does a
41891         "finalization" step in a worker thread.  This step combines all the
41892         index entries into a single master list, canonicalizes C++ names, and
41893         splits Ada names to synthesize package names.
41894
41895         While this step is run in the background, gdb will wait for the
41896         results in some situations, and it turns out that this step can be
41897         slow.  This is PR symtab/29105.
41898
41899         This can be sped up by parallelizing, at a small memory cost.  Now
41900         each index is finalized on its own, in a worker thread.  The cost
41901         comes from name canonicalization: if a given non-canonical name is
41902         referred to by multiple indices, there will be N canonical copies (one
41903         per index) rather than just one.
41904
41905         This requires changing the users of the index to iterate over multiple
41906         results.  However, this is easily done by introducing a new "chained
41907         range" class.
41908
41909         When run on gdb itself, the memory cost seems rather low -- on my
41910         current machine, "maint space 1" reports no change due to the patch.
41911
41912         For performance testing, using "maint time 1" and "file" will not show
41913         correct results.  That approach measures "time to next prompt", but
41914         because the patch only affects background work, this shouldn't (and
41915         doesn't) change.  Instead, a simple way to make gdb wait for the
41916         results is to set a breakpoint.
41917
41918         Before:
41919
41920             $ /bin/time -f%e ~/gdb/install/bin/gdb -nx -q -batch \
41921                 -ex 'break main' /tmp/gdb
41922             Breakpoint 1 at 0x43ec30: file ../../binutils-gdb/gdb/gdb.c, line 28.
41923             2.00
41924
41925         After:
41926
41927             $ /bin/time -f%e ./gdb/gdb -nx -q -batch \
41928                 -ex 'break main' /tmp/gdb
41929             Breakpoint 1 at 0x43ec30: file ../../binutils-gdb/gdb/gdb.c, line 28.
41930             0.65
41931
41932         Regression tested on x86-64 Fedora 34.
41933
41934         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29105
41935
41936 2022-05-26  Alan Modra  <amodra@gmail.com>
41937
41938         bit-rot in target before_parse function
41939         Copy initialisation over from the elf.em before_parse.  Commit
41940         ba951afb999 2022-05-03 changed behaviour on arm and score regarding
41941         exec stack.  This patch restores the previous behaviour.
41942
41943                 * emultempl/aarch64elf.em (before_parse): Init separate_code,
41944                 warn_execstack, no_warn_rwx_segments and default_execstack.
41945                 * emultempl/armelf.em (before_parse): Likewise.
41946                 * emultempl/scoreelf.em (before_parse): Likewise.
41947                 * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Return
41948                 true for arm and nacl.
41949
41950 2022-05-26  Richard Earnshaw  <rearnsha@arm.com>
41951
41952          arm: avoid use of GNU builtin function in s_arm_unwind_save_mixed
41953         Whilst reviewing Luis' proposed change to s_arm_unwind_save_mixed
41954         yesterday I noticed that we were making use of __builting_clzl
41955         directly within the main function, which is not guaranteed to be
41956         portable.  Whilst studying the code further, I also realized that it
41957         could be rewritten without using it and also reworked to remove a lot
41958         of unnecessary iterations steps.  So this patch does that (and also
41959         removes the source of the warning that Luis was trying to fix).
41960         Finally, with the rewrite we can also simplify the caller of this
41961         routine as the new version can handle all the cases directly.
41962
41963                 * config/tc-arm.c (s_arm_unwind_save_mixed): Rewrite without
41964                 using __builtin_clzl.
41965                 (s_arm_unwind_save): Simplify logic for simple/mixed register saves.
41966
41967 2022-05-26  Lancelot SIX  <lancelot.six@amd.com>
41968
41969         gdb/linux-nat: xfer_memory_partial return E_IO on error
41970         When accessing /proc/PID/mem, if pread64/pwrite64/read/write encounters
41971         an error and return -1, linux_proc_xfer_memory_partial return
41972         TARGET_XFER_EOF.
41973
41974         I think it should return TARGET_XFER_E_IO in this case.  TARGET_XFER_EOF
41975         is returned when pread64/pwrite64/read/frite returns 0, which indicates
41976         that the address space is gone and the whole process has exited or
41977         execed.
41978
41979         This patch makes this change.
41980
41981         Regression tested on x86_64-linux-gnu.
41982
41983         Change-Id: I6030412459663b8d7933483fdda22a6c2c5d7221
41984
41985 2022-05-26  Lancelot SIX  <lancelot.six@amd.com>
41986
41987         gdb/testsuite: prefer gdb_test in gdb.dwarf2/calling-convention
41988         Since ed01945057c "Make gdb_test's question non-optional if specified",
41989         if the question and response parameters are given to gdb_test, the
41990         framework enforces that GDB asks the question.  Before this patch, tests
41991         needed to use gdb_test_multiple to enforce this.
41992
41993         This patch updates the gdb.dwarf2/calling-convention.exp testcase to use
41994         gdb_test to check that GDB asks a question.  This replaces the more
41995         complicated gdb_test_multiple based implementation.
41996
41997         Tested on x86_64-gnu-linux.
41998
41999         Change-Id: I7216e822ca68f2727e0450970097d74c27c432fe
42000
42001 2022-05-26  Potharla, Rupesh  <Rupesh.Potharla@amd.com>
42002
42003         bfd: Add Support for DW_FORM_strx* and DW_FORM_addrx*
42004
42005 2022-05-26  Luca Boccassi  <bluca@debian.org>
42006
42007         ld: add --package-metadata
42008         Generate a .note.package FDO package metadata ELF note, following
42009         the spec: https://systemd.io/ELF_PACKAGE_METADATA/
42010
42011         If the jansson library is available at build time (and it is explicitly
42012         enabled), link ld to it, and use it to validate that the input is
42013         correct JSON, to avoid writing garbage to the file. The
42014         configure option --enable-jansson has to be used to explicitly enable
42015         it (error out when not found). This allows bootstrappers (or others who
42016         are not interested) to seamlessly skip it without issues.
42017
42018 2022-05-26  GDB Administrator  <gdbadmin@sourceware.org>
42019
42020         Automatic date update in version.in
42021
42022 2022-05-26  Natarajan, Kavitha  <Kavitha.Natarajan@amd.com>
42023
42024         Re: Add bionutils support for DWARF v5's DW_OP_addrx
42025         Testsuite files belonging to commit 3ac9da49378c.
42026
42027 2022-05-25  Pedro Alves  <pedro@palves.net>
42028
42029         Show enabled locations with disabled breakpoint parent as "y-"
42030         Currently, breakpoint locations that are enabled while their parent
42031         breakpoint is disabled are displayed with "y" in the Enb colum of
42032         "info breakpoints":
42033
42034          (gdb) info breakpoints
42035          Num     Type           Disp Enb Address            What
42036          1       breakpoint     keep n   <MULTIPLE>
42037          1.1                         y   0x00000000000011b6 in ...
42038          1.2                         y   0x00000000000011c2 in ...
42039          1.3                         n   0x00000000000011ce in ...
42040
42041         Such locations won't trigger a break, so to avoid confusion, show "y-"
42042         instead.  For example:
42043
42044          (gdb) info breakpoints
42045          Num     Type           Disp Enb Address            What
42046          1       breakpoint     keep n   <MULTIPLE>
42047          1.1                         y-  0x00000000000011b6 in ...
42048          1.2                         y-  0x00000000000011c2 in ...
42049          1.3                         n   0x00000000000011ce in ...
42050
42051         The "-" sign is inspired on how the TUI represents breakpoints on the
42052         left side of the source window, with "b-" for a disabled breakpoint.
42053
42054         Change-Id: I9952313743c51bf21b4b380c72360ef7d4396a09
42055
42056 2022-05-25  Natarajan, Kavitha  <Kavitha.Natarajan@amd.com>
42057
42058         Add bionutils support for DWARF v5's DW_OP_addrx.
42059
42060 2022-05-25  Pedro Alves  <pedro@palves.net>
42061
42062         gdb: Fix DUPLICATE and PATH regressions throughout
42063         The previous patch to add -prompt/-lbl to gdb_test introduced a
42064         regression: Before, you could specify an explicit empty message to
42065         indicate you didn't want to PASS, like so:
42066
42067           gdb_test COMMAND PATTERN ""
42068
42069         After said patch, gdb_test no longer distinguishes
42070         no-message-specified vs empty-message, so tests that previously would
42071         be silent on PASS, now started emitting PASS messages based on
42072         COMMAND.  This in turn introduced a number of PATH/DUPLICATE
42073         violations in the testsuite.
42074
42075         This commit fixes all the regressions I could see.
42076
42077         This patch uses the new -nopass feature introduced in the previous
42078         commit, but tries to avoid it if possible.  Most of the patch fixes
42079         DUPLICATE issues the usual way, of using with_test_prefix or explicit
42080         unique messages.
42081
42082         See previous commit's log for more info.
42083
42084         In addition to looking for DUPLICATEs, I also looked for cases where
42085         we would now end up with an empty message in gdb.sum, due to a
42086         gdb_test being passed both no message and empty command.  E.g., this
42087         in gdb.ada/bp_reset.exp:
42088
42089          gdb_run_cmd
42090          gdb_test "" "Breakpoint $decimal, foo\\.nested_sub \\(\\).*"
42091
42092         was resulting in this in gdb.sum:
42093
42094          PASS: gdb.ada/bp_reset.exp:
42095
42096         I fixed such cases by passing an explicit message.  We may want to
42097         make such cases error out.
42098
42099         Tested on x86_64 GNU/Linux, native and native-extended-gdbserver.  I
42100         see zero PATH cases now.  I get zero DUPLICATEs with native testing
42101         now.  I still see some DUPLICATEs with native-extended-gdbserver, but
42102         those were preexisting, unrelated to the gdb_test change.
42103
42104         Change-Id: I5375f23f073493e0672190a0ec2e847938a580b2
42105
42106 2022-05-25  Pedro Alves  <pedro@palves.net>
42107
42108         Add -nopass option to gdb_test/gdb_test_multiple
42109         The previous patch to add -prompt/-lbl to gdb_test introduced a
42110         regression: Before, you could specify an explicit empty message to
42111         indicate you didn't want to PASS, like so:
42112
42113           gdb_test COMMAND PATTERN ""
42114
42115         After said patch, gdb_test no longer distinguishes
42116         no-message-specified vs empty-message, so tests that previously would
42117         be silent on PASS, now started emitting PASS messages based on
42118         COMMAND.  This in turn introduced a number of PATH/DUPLICATE
42119         violations in the testsuite.
42120
42121         I think that not issuing a PASS should be restricted to only a few
42122         cases -- namely in shared routines exported by gdb.exp, which happen
42123         to use gdb_test internally.  In tests that iterate an unknown number
42124         of tests exercising some racy scenario.  In the latter case, if we
42125         emit PASSes for each iteration, we run into the situation where
42126         different testsuite runs emit a different number of PASSes.
42127
42128         Thus, this patch preserves the current behavior, and, instead, adds a
42129         new "-nopass" option to gdb_test and gdb_test_no_output.  Compared to
42130         the old way of supressing PASS with an empty message, this has the
42131         advantage that you can specify a FAIL message that is distinct from
42132         the command string, and, it's also more explicit.
42133
42134         Change-Id: I5375f23f073493e0672190a0ec2e847938a580b2
42135
42136 2022-05-25  Tsukasa OI  <research_trasio@irq.a4lg.com>
42137
42138         RISC-V: Fix RV32Q conflict
42139         This commit makes RV32 + 'Q' extension (version 2.2 or later) not
42140         conflicting since this combination is no longer prohibited by the
42141         specification.
42142
42143         bfd/ChangeLog:
42144
42145                 * elfxx-riscv.c (riscv_parse_check_conflicts): Remove conflict
42146                 detection that prohibits RV32Q on 'Q' version 2.2 or later.
42147
42148         gas/ChangeLog:
42149
42150                 * testsuite/gas/riscv/march-fail-rv32iq.d: Removed.
42151                 * testsuite/gas/riscv/march-fail-rv32iq.l: Likewise.
42152                 * testsuite/gas/riscv/march-fail-rv32iq2p0.d: New test
42153                 showing RV32IQ fails on 'Q' extension version 2.0.
42154                 * testsuite/gas/riscv/march-fail-rv32iq2p0.l: Likewise.
42155                 * testsuite/gas/riscv/march-fail-rv32iq2.d: Likewise.
42156                 * testsuite/gas/riscv/march-fail-rv32iq-isa-2p2.d: New test
42157                 showing RV32IQ fails on ISA specification version 2.2.
42158                 * testsuite/gas/riscv/march-ok-rv32iq2p2.d: New test
42159                 showing RV32IQ succesds on 'Q' extension version 2.2.
42160                 * testsuite/gas/riscv/march-ok-rv32iq-isa-20190608.d: New test
42161                 showing RV32IQ succesds on ISA specification 20190608.
42162
42163 2022-05-25  Dmitry Selyutin  <ghostmansd@gmail.com>
42164
42165         opcodes: introduce BC field; fix isel
42166         Per Power ISA Version 3.1B 3.3.12, isel uses BC field rather than CRB
42167         field present in binutils sources. Also, per 1.6.2, BC has the same
42168         semantics as BA and BB fields, so this should keep the same flags and
42169         mask, only with the different offset.
42170
42171         opcodes/
42172                 * ppc-opc.c
42173                 (BC): Define new field, with the same definition as CRB field,
42174                 but with the PPC_OPERAND_CR_BIT flag present.
42175         gas/
42176                 * testsuite/gas/ppc/476.d: Update.
42177                 * testsuite/gas/ppc/a2.d: Update.
42178                 * testsuite/gas/ppc/e500.d: Update.
42179                 * testsuite/gas/ppc/power7.d: Update.
42180
42181 2022-05-25  Dmitry Selyutin  <ghostmansd@gmail.com>
42182
42183         ppc: extend opindex to 16 bits
42184         With the upcoming SVP64 extension[0] to PowerPC architecture, it became
42185         evident that PowerPC operand indices no longer fit 8 bits. This patch
42186         switches the underlying type to uint16_t, also introducing a special
42187         typedef so that any future extension goes even smoother.
42188
42189         [0] https://libre-soc.org
42190
42191         include/
42192                 * opcode/ppc.h (ppc_opindex_t): New typedef.
42193                 (struct powerpc_opcode): Use it.
42194                 (PPC_OPINDEX_MAX): Define.
42195         gas/
42196                 * write.h (struct fix): Increase size of fx_pcrel_adjust.
42197                 Reorganise.
42198                 * config/tc-ppc.c (insn_validate): Use ppc_opindex_t for operands.
42199                 (md_assemble): Likewise.
42200                 (md_apply_fix): Likewise.  Mask fx_pcrel_adjust with PPC_OPINDEX_MAX.
42201                 (ppc_setup_opcodes): Adjust opcode index assertion.
42202         opcodes/
42203                 * ppc-dis.c (skip_optional_operands): Use ppc_opindex_t for
42204                 operand pointer.
42205                 (lookup_powerpc, lookup_prefix, lookup_vle, lookup_spe2): Likewise.
42206                 (print_insn_powerpc): Likewise.
42207
42208 2022-05-25  GDB Administrator  <gdbadmin@sourceware.org>
42209
42210         Automatic date update in version.in
42211
42212 2022-05-24  Tom de Vries  <tdevries@suse.de>
42213
42214         [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with clang
42215         When running test-case gdb.opt/clobbered-registers-O2.exp with clang 12.0.1, I
42216         get:
42217         ...
42218         (gdb) run ^M
42219         Starting program: clobbered-registers-O2 ^M
42220         ^M
42221         Program received signal SIGSEGV, Segmentation fault.^M
42222         gen_movsd (operand0=<optimized out>, operand1=<optimized out>) at \
42223           clobbered-registers-O2.c:31^M
42224         31              return *start_sequence(operand0, operand1);^M
42225         (gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: runto: run to start_sequence
42226         ...
42227
42228         The problem is that the breakpoint in start_sequence doesn't trigger, because:
42229         - the call to start_sequence in gen_movsd is optimized away, despite the
42230           __attribute__((noinline)), so the actual function start_sequence doesn't get
42231           called, and
42232         - the debug info doesn't contain inlined function info, so there's only one
42233           breakpoint location.
42234
42235         Adding noclone and noipa alongside the noinline attribute doesn't fix this.
42236
42237         Adding the clang-specific attribute optnone in start_sequence does, but since
42238         it inhibits all optimization, that's not a preferred solution in a gdb.opt
42239         test-case, and it would work only for clang and not other compilers that
42240         possibly have the same issue.
42241
42242         Fix this by moving functions start_sequence and gen_movsd into their own
42243         files, as a way of trying harder to enforce noinline/noipa/noclone.
42244
42245         Tested on x86_64-linux.
42246
42247 2022-05-24  Tom de Vries  <tdevries@suse.de>
42248
42249         [gdb/testsuite] Fix gdb.opt/clobbered-registers-O2.exp with gcc-12
42250         When running test-case gdb.opt/clobbered-registers-O2.exp with gcc-12, I run
42251         into:
42252         ...
42253         (gdb) PASS: gdb.opt/clobbered-registers-O2.exp: backtracing
42254         print operand0^M
42255         $1 = (unsigned int *) 0x7fffffffd070^M
42256         (gdb) print *operand0^M
42257         $2 = 4195541^M
42258         (gdb) FAIL: gdb.opt/clobbered-registers-O2.exp: print operand0
42259         ...
42260
42261         The problem is that starting gcc-12, the assignments to x and y in main are
42262         optimized away:
42263         ...
42264         int main(void)
42265         {
42266           unsigned x, y;
42267
42268           x = 13;
42269           y = 14;
42270           return (int)gen_movsd (&x, &y);
42271         ...
42272
42273         Fix this by making x and y volatile.
42274
42275         Note that the test-case intends to check the handling of debug info for
42276         optimized code in function gen_movsd, so inhibiting optimization in main
42277         doesn't interfere with that.
42278
42279         Tested on x86_64-linux.
42280
42281         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29161
42282
42283 2022-05-24  Tiezhu Yang  <yangtiezhu@loongson.cn>
42284
42285         gdb: LoongArch: Define LOONGARCH_LINUX_NUM_GREGSET as 45
42286         LOONGARCH_LINUX_NUM_GREGSET should be defined as 45 (32 + 1 + 1 + 11)
42287         due to reserved 11 for extension in glibc, otherwise when execute:
42288
42289           make check-gdb TESTS="gdb.base/corefile.exp"
42290
42291         there exists the following failed testcase:
42292
42293           (gdb) core-file /home/loongson/build.git/gdb/testsuite/outputs/gdb.base/corefile/corefile.core
42294           [New LWP 7742]
42295           warning: Unexpected size of section `.reg/7742' in core file.
42296           Core was generated by `/home/loongson/build.git/gdb/testsuite/outputs/gdb.base/corefile/corefile'.
42297           Program terminated with signal SIGABRT, Aborted.
42298           warning: Unexpected size of section `.reg/7742' in core file.
42299           #0  0x000000fff76f4e24 in raise () from /lib/loongarch64-linux-gnu/libc.so.6
42300           (gdb) FAIL: gdb.base/corefile.exp: core-file warning-free
42301
42302 2022-05-24  Christophe Lyon  <christophe.lyon@arm.com>
42303
42304         AArch64: add support for DFP (Decimal Floating point)
42305         This small patch adds support for TYPE_CODE_DECFLOAT in
42306         aapcs_is_vfp_call_or_return_candidate_1 and pass_in_v_vfp_candidate,
42307         so that GDB for AArch64 knows how to pass DFP parameters and how to
42308         read DFP results when calling a function.
42309
42310         Tested on aarch64-linux-gnu, with a GCC with DFP support in the PATH,
42311         all of GDB's DFP tests pass.
42312
42313 2022-05-24  Christophe Lyon  <christophe.lyon@arm.com>
42314
42315         Merge config/ changes from GCC, to enable DFP on AArch64
42316         2022-04-28  Christophe Lyon  <christophe.lyon@arm.com>
42317
42318                 config/
42319                 * dfp.m4 (enable_decimal_float): Enable BID for AArch64.
42320
42321                 libdecnumber/
42322                 * configure: Regenerate.
42323
42324 2022-05-24  Alan Modra  <amodra@gmail.com>
42325
42326         PR29171, invalid read causing SIGSEGV
42327         The fix here is to pass "section" down to read_and_display_attr_value.
42328         The test in read_and_display_attr_value is a little bit of hardening.
42329
42330                 PR 29171
42331                 * dwarf.c (display_debug_macro, display_debug_names): Pass section
42332                 to read_and_display_attr_value2.
42333                 (read_and_display_attr_value): Don't attempt to check for .dwo
42334                 section name when section is NULL.
42335
42336 2022-05-24  Alan Modra  <amodra@gmail.com>
42337
42338         PR29170, divide by zero displaying fuzzed .debug_names
42339                 PR 29170
42340                 * dwarf.c (display_debug_names): Don't attempt to display bucket
42341                 clashes when bucket count is zero.
42342
42343         PR29169, invalid read displaying fuzzed .gdb_index
42344                 PR 29169
42345                 * dwarf.c (display_gdb_index): Combine sanity checks.  Calculate
42346                 element counts, not word counts.
42347
42348 2022-05-24  GDB Administrator  <gdbadmin@sourceware.org>
42349
42350         Automatic date update in version.in
42351
42352 2022-05-23  John Baldwin  <jhb@FreeBSD.org>
42353
42354         Tweak the std::hash<> specialization for aarch64_features.
42355         Move the specialization into an explicit std namespace to workaround a
42356         bug in older compilers.  GCC 6.4.1 at least fails to compile the previous
42357         version with the following error:
42358
42359         gdb/arch/aarch64.h:48:13: error: specialization of 'template<class _Tp> struct std::hash' in different namespace [-fpermissive]
42360
42361           struct std::hash<aarch64_features>
42362
42363 2022-05-23  John Baldwin  <jhb@FreeBSD.org>
42364
42365         Fix loongarch_iterate_over_regset_sections for non-native targets.
42366         Define a constant for the number of registers stored in a register set
42367         and use this with register_size to compute the size of the
42368         general-purpose register set in core dumps.
42369
42370         This also fixes the build on hosts such as FreeBSD that do not define
42371         an elf_gregset_t type.
42372
42373 2022-05-23  Tiezhu Yang  <yangtiezhu@loongson.cn>
42374
42375         gdb: LoongArch: Implement the iterate_over_regset_sections gdbarch method
42376         When execute the following command on LoongArch:
42377
42378           make check-gdb TESTS="gdb.base/auxv.exp"
42379
42380         there exist the following unsupported and failed testcases:
42381
42382           UNSUPPORTED: gdb.base/auxv.exp: gcore
42383           FAIL: gdb.base/auxv.exp: load core file for info auxv on native core dump
42384           FAIL: gdb.base/auxv.exp: info auxv on native core dump
42385           FAIL: gdb.base/auxv.exp: matching auxv data from live and core
42386           UNSUPPORTED: gdb.base/auxv.exp: info auxv on gcore-created dump
42387           UNSUPPORTED: gdb.base/auxv.exp: matching auxv data from live and gcore
42388
42389         we can see the following messages in gdb/testsuite/gdb.log:
42390
42391           gcore /home/loongson/build.git/gdb/testsuite/outputs/gdb.base/auxv/auxv.gcore
42392           Target does not support core file generation.
42393           (gdb) UNSUPPORTED: gdb.base/auxv.exp: gcore
42394
42395         In order to fix the above issues, implement the iterate_over_regset_sections
42396         gdbarch method to iterate over core file register note sections on LoongArch.
42397
42398         By the way, with this patch, the failed testcases in gdb.base/corefile.exp
42399         and gdb.base/gcore.exp can also be fixed.
42400
42401 2022-05-23  Tom de Vries  <tdevries@suse.de>
42402
42403         [gdb/testsuite] Fix -prompt handling in gdb_test
42404         With check-read1 I run into:
42405         ...
42406            [infrun] maybe_set_commit_resumed_all_targets: not requesting
42407         commit-resumed for target native, no resumed threads^M
42408         (gdb) FAIL: gdb.base/ui-redirect.exp: debugging: continue
42409         [infrun] fetch_inferior_event: exit^M
42410         ...
42411
42412         The problem is that proc gdb_test doesn't pass down the -prompt option to proc
42413         gdb_test_multiple, due to a typo making this lappend without effect:
42414         ...
42415             set opts {}
42416             lappend "-prompt $prompt"
42417         ...
42418
42419         Fix this by actually appending to opts.
42420
42421         Tested on x86_64-linux.
42422
42423 2022-05-23  Tom de Vries  <tdevries@suse.de>
42424
42425         [gdbsupport] Fix UB in print-utils.cc:int_string
42426         When building gdb with -fsanitize=undefined, I run into:
42427         ...
42428         (gdb) PASS: gdb.ada/access_to_packed_array.exp: set logging enabled on
42429         maint print symbols^M
42430         print-utils.cc:281:29:runtime error: negation of -9223372036854775808 cannot \
42431           be represented in type 'long int'; cast to an unsigned type to negate this \
42432           value to itself
42433         (gdb) FAIL: gdb.ada/access_to_packed_array.exp: maint print symbols
42434         ...
42435
42436         By running in a debug session, we find that this happens during printing of:
42437         ...
42438            typedef system.storage_elements.storage_offset: \
42439              range -9223372036854775808 .. 9223372036854775807;
42440         ...
42441         Possibly, an ada test-case could be created that exercises this in isolation.
42442
42443         The problem is here in int_string, where we negate a val with type LONGEST:
42444         ...
42445                  return decimal2str ("-", -val, width);
42446         ...
42447
42448         Fix this by, as recommend, using "-(ULONGEST)val" instead.
42449
42450         Tested on x86_64-linux.
42451
42452 2022-05-23  Tom de Vries  <tdevries@suse.de>
42453
42454         [gdb/exp] Fix UB in scalar_binop
42455         When building gdb with -fsanitize=undefined, I run into:
42456         ...
42457         $ gdb -q -batch -ex "p -(-0x7fffffffffffffff - 1)"
42458         src/gdb/valarith.c:1385:10: runtime error: signed integer overflow: \
42459           0 - -9223372036854775808 cannot be represented in type 'long int'
42460         $1 = -9223372036854775808
42461         ...
42462
42463         Fix this by performing the substraction in scalar_binop using unsigned types.
42464
42465         Tested on x86_64-linux.
42466
42467 2022-05-23  Tom de Vries  <tdevries@suse.de>
42468
42469         [gdb/ada] Fix gdb.ada/dynamic-iface.exp with gcc 7
42470         This test in test-case gdb.ada/dynamic-iface.exp passes with gcc 8:
42471         ...
42472         (gdb) print obj^M
42473         $1 = (n => 3, a => "ABC", value => 93)^M
42474         (gdb) PASS: gdb.ada/dynamic-iface.exp: print local as interface
42475         ...
42476         but fails with gcc 7:
42477         ...
42478         (gdb) print obj^M
42479         $1 = ()^M
42480         (gdb) FAIL: gdb.ada/dynamic-iface.exp: print local as interface
42481         ...
42482
42483         More concretely, we have trouble finding the type of obj.  With gcc 8:
42484         ...
42485         $ gdb -q -batch main -ex "b concrete.adb:20" -ex run -ex "ptype obj"
42486           ...
42487         type = <ref> new concrete.intermediate with record
42488             value: integer;
42489         end record
42490         ...
42491         and with gcc 7:
42492         ...
42493         type = <ref> tagged record null; end record
42494         ...
42495
42496         The translation from tagged type to "full view" type happens in
42497         ada_tag_value_at_base_address, where we hit this code:
42498         ...
42499           /* Storage_Offset'Last is used to indicate that a dynamic offset to
42500              top is used.  In this situation the offset is stored just after
42501              the tag, in the object itself.  */
42502           if (offset_to_top == last)
42503             {
42504               struct value *tem = value_addr (tag);
42505               tem = value_ptradd (tem, 1);
42506               tem = value_cast (ptr_type, tem);
42507               offset_to_top = value_as_long (value_ind (tem));
42508             }
42509         ...
42510         resulting in an offset_to_top for gcc 8:
42511         ...
42512         (gdb) p offset_to_top
42513         $1 = -16
42514         ...
42515         and for gcc 7:
42516         ...
42517         (gdb) p offset_to_top
42518         $1 = 16
42519         ...
42520
42521         The difference is expected, it bisects to gcc commit d0567dc0dbf ("[multiple
42522         changes]") which mentions this change.
42523
42524         There's some code right after the code quoted above that deals with this
42525         change:
42526         ...
42527           else if (offset_to_top > 0)
42528             {
42529               /* OFFSET_TO_TOP used to be a positive value to be subtracted
42530                  from the base address.  This was however incompatible with
42531                  C++ dispatch table: C++ uses a *negative* value to *add*
42532                  to the base address.  Ada's convention has therefore been
42533                  changed in GNAT 19.0w 20171023: since then, C++ and Ada
42534                  use the same convention.  Here, we support both cases by
42535                  checking the sign of OFFSET_TO_TOP.  */
42536               offset_to_top = -offset_to_top;
42537             }
42538         ...
42539         but it's not activated because of the 'else'.
42540
42541         Fix this by removing the 'else'.
42542
42543         Tested on x86_64-linux, with gcc 7.5.0.
42544
42545         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29057
42546
42547 2022-05-23  Mark Harmstone  <mark@harmstone.com>
42548
42549         ld: use definitions in generate_reloc rather than raw literals
42550
42551 2022-05-23  Tom de Vries  <tdevries@suse.de>
42552
42553         [gdb/testsuite] Skip language auto in gdb.base/parse_number.exp
42554         In test-case gdb.base/parse_number.exp, we skip architecture auto in the
42555         $supported_archs loop, to prevent duplicate testing.
42556
42557         Likewise, skip language auto and its alias local in the $::all_languages
42558         loop.  This reduces the number of tests from 17744 to 15572.
42559
42560         Tested on x86_64-linux, with a build with --enable-targets=all.
42561
42562 2022-05-23  GDB Administrator  <gdbadmin@sourceware.org>
42563
42564         Automatic date update in version.in
42565
42566 2022-05-22  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
42567
42568         Accept functions with DW_AT_linkage_name present
42569         Currently GDB is not able to debug (Binary generated with Clang) variables
42570         present in shared/private clause of OpenMP Task construct. Please note that
42571         LLVM debugger LLDB is able to debug.
42572
42573         In case of OpenMP, compilers generate artificial functions which are not
42574         present in actual program. This is done to apply parallelism to block of
42575         code.
42576
42577         For non-artifical functions, DW_AT_name attribute should contains the name
42578         exactly as present in actual program.
42579         (Ref# http://wiki.dwarfstd.org/index.php?title=Best_Practices)
42580         Since artificial functions are not present in actual program they not having
42581         DW_AT_name and having DW_AT_linkage_name instead should be fine.
42582
42583         Currently GDB is invalidating any function not havnig DW_AT_name which is why
42584         it is not able to debug OpenMP (Clang).
42585
42586         It should be fair to fallback to check DW_AT_linkage_name in case DW_AT_name
42587         is absent.
42588
42589 2022-05-22  GDB Administrator  <gdbadmin@sourceware.org>
42590
42591         Automatic date update in version.in
42592
42593 2022-05-21  GDB Administrator  <gdbadmin@sourceware.org>
42594
42595         Automatic date update in version.in
42596
42597 2022-05-20  Pedro Alves  <pedro@palves.net>
42598
42599         Rename base_breakpoint -> code_breakpoint
42600         Even after the previous patches reworking the inheritance of several
42601         breakpoint types, the present breakpoint hierarchy looks a bit
42602         surprising, as we have "breakpoint" as the superclass, and then
42603         "base_breakpoint" inherits from "breakpoint".  Like so, simplified:
42604
42605            breakpoint
42606                base_breakpoint
42607                   ordinary_breakpoint
42608                   internal_breakpoint
42609                   momentary_breakpoint
42610                   ada_catchpoint
42611                   exception_catchpoint
42612                tracepoint
42613                watchpoint
42614                catchpoint
42615                   exec_catchpoint
42616                   ...
42617
42618         The surprising part to me is having "base_breakpoint" being a subclass
42619         of "breakpoint".  I'm just refering to naming here -- I mean, you'd
42620         expect that it would be the top level baseclass that would be called
42621         "base".
42622
42623         Just flipping the names of breakpoint and base_breakpoint around
42624         wouldn't be super great for us, IMO, given we think of every type of
42625         *point as a breakpoint at the user visible level.  E.g., "info
42626         breakpoints" shows watchpoints, tracepoints, etc.  So it makes to call
42627         the top level class breakpoint.
42628
42629         Instead, I propose renaming base_breakpoint to code_breakpoint.  The
42630         previous patches made sure that all code breakpoints inherit from
42631         base_breakpoint, so it's fitting.  Also, "code breakpoint" contrasts
42632         nicely with a watchpoint also being typically known as a "data
42633         breakpoint".
42634
42635         After this commit, the resulting hierarchy looks like:
42636
42637            breakpoint
42638                code_breakpoint
42639                   ordinary_breakpoint
42640                   internal_breakpoint
42641                   momentary_breakpoint
42642                   ada_catchpoint
42643                   exception_catchpoint
42644                tracepoint
42645                watchpoint
42646                catchpoint
42647                   exec_catchpoint
42648                   ...
42649
42650         ... which makes a lot more sense to me.
42651
42652         I've left this patch as last in the series in case people want to
42653         bikeshed on the naming.
42654
42655         "code" has a nice property that it's exactly as many letters as
42656         "base", so this patch didn't require any reindentation.  :-)
42657
42658         Change-Id: Id8dc06683a69fad80d88e674f65e826d6a4e3f66
42659
42660 2022-05-20  Pedro Alves  <pedro@palves.net>
42661
42662         Test "set multiple-symbols on" creating multiple breakpoints
42663         To look for code paths that lead to create_breakpoints_sal creating
42664         multiple breakpoints, I ran the whole testsuite with this hack:
42665
42666           --- a/gdb/breakpoint.c
42667           +++ b/gdb/breakpoint.c
42668           @@ -8377,8 +8377,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
42669                                   int from_tty,
42670                                   int enabled, int internal, unsigned flags)
42671            {
42672           -  if (canonical->pre_expanded)
42673           -    gdb_assert (canonical->lsals.size () == 1);
42674           +  gdb_assert (canonical->lsals.size () == 1);
42675
42676         surprisingly, the assert never failed...
42677
42678         The way to get to create_breakpoints_sal with multiple lsals is to use
42679         "set multiple-symbols ask" and then select multiple options from the
42680         menu, like so:
42681
42682          (gdb) set multiple-symbols ask
42683          (gdb) b overload1arg
42684          [0] cancel
42685          [1] all
42686          [2] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg()
42687          [3] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(char)
42688          [4] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(double)
42689          [5] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(float)
42690          [6] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(int)
42691          [7] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(long)
42692          [8] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(short)
42693          [9] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(signed char)
42694          [10] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(unsigned char)
42695          [11] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(unsigned int)
42696          [12] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(unsigned long)
42697          [13] /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc:foo::overload1arg(unsigned short)
42698          > 2-3
42699          Breakpoint 2 at 0x1532: file /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc, line 107.
42700          Breakpoint 3 at 0x154b: file /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.cp/ovldbreak.cc, line 110.
42701          warning: Multiple breakpoints were set.
42702          Use the "delete" command to delete unwanted breakpoints.
42703
42704         ... which would trigger the assert.
42705
42706         This commit makes gdb.cp/ovldbreak.exp test this scenario.  It does
42707         that by making set_bp_overloaded take a list of expected created
42708         breakpoints rather than just one breakpoint.  It converts the
42709         procedure to use gdb_test_multiple instead of send_gdb/gdb_expect
42710         along the way.
42711
42712         Change-Id: Id87d1e08feb6670440d926f5344e5081f5e37c8e
42713
42714 2022-05-20  Pedro Alves  <pedro@palves.net>
42715
42716         Make sure momentary breakpoints are always thread-specific
42717         This adds a new ctor to momentary_breakpoints with a few parameters
42718         that are always necessary for momentary breakpoints.
42719
42720         In particular, I noticed that set_std_terminate_breakpoint doesn't
42721         make the breakpoint be thread specific, which looks like a bug to me.
42722
42723         The point of that breakpoint is to intercept std::terminate calls that
42724         happen as result of the called thread throwing an exception that won't
42725         be caught by the dummy frame.  If some other thread calls
42726         std::terminate, IMO, it's no different from some other thread calling
42727         exit/_exit, for example.
42728
42729         Change-Id: Ifc5ff4a6d6e58b8c4854d00b86725382d38a1a02
42730
42731 2022-05-20  Pedro Alves  <pedro@palves.net>
42732
42733         Momentary breakpoints should have no breakpoint number
42734         Momentary breakpoints have no breakpoint number, their breakpoint
42735         number should be always 0, to avoid constantly incrementing (or
42736         decrementing) the internal breakpoint count.
42737
42738         Indeed, set_momentary_breakpoint installs the created breakpoint
42739         without a number.
42740
42741         However, momentary_breakpoint_from_master incorrectly gives an
42742         internal breakpoint number to the new breakpoint.  This commit fixes
42743         that.
42744
42745         Change-Id: Iedcae5432cdf232db9e9a6e1a646d358abd34f95
42746
42747 2022-05-20  Pedro Alves  <pedro@palves.net>
42748
42749         Add/tweak intro comments of struct breakpoint and several subclasses
42750         This tweaks the intro comments of the following classes:
42751
42752          internal_breakpoint
42753          momentary_breakpoint
42754          breakpoint
42755          base_breakpoint
42756          watchpoint
42757          catchpoint
42758
42759         Change-Id: If6b31f51ebbb81705fbe5b8435f60ab2c88a98c8
42760
42761 2022-05-20  Pedro Alves  <pedro@palves.net>
42762
42763         Move add_location(sal) to base_breakpoint
42764         After the previous patches, only base_breakpoint subclasses use
42765         add_location(sal), so we can move it to base_breakpoint (a.k.a. base
42766         class for code breakpoints).
42767
42768         This requires a few casts here and there, but always at spots where
42769         you can see from context what the breakpoint's type actually is.
42770
42771         I inlined new_single_step_breakpoint into its only caller exactly for
42772         this reason.
42773
42774         I did try to propagate more use of base_breakpoint to avoid casts, but
42775         that turned out unwieldy for this patch.
42776
42777         Change-Id: I49d959322b0fdce5a88a216bb44730fc5dd7c6f8
42778
42779 2022-05-20  Pedro Alves  <pedro@palves.net>
42780
42781         Move common bits of catchpoint/exception_catchpoint to breakpoint's ctor
42782         Move common bits of catchpoint and exception_catchpoint to
42783         breakpoint's ctor, to avoid duplicating code.
42784
42785         Change-Id: I3a115180f4d496426522f1d89a3875026aea3cf2
42786
42787 2022-05-20  Pedro Alves  <pedro@palves.net>
42788
42789         Make catchpoint inherit breakpoint, eliminate init_raw_breakpoint
42790         struct catchpoint's ctor currently calls init_raw_breakpoint, which is
42791         a bit weird, as that ctor-like function takes a sal argument, but
42792         catchpoints don't have code locations.
42793
42794         Instead, make struct catchpoint's ctor add the catchpoint's dummy
42795         location using add_dummy_location.
42796
42797         init_raw_breakpoint uses add_location under the hood, and with a dummy
42798         sal it would ultimately use the breakpoint's gdbarch for the
42799         location's gdbarch, so replace the references to loc->gdbarch (which
42800         is now NULL) in syscall_catchpoint to references to the catchpoint's
42801         gdbarch.
42802
42803         struct catchpoint's ctor was the last user of init_raw_breakpoint, so
42804         this commit eliminates the latter.
42805
42806         Since catchpoint locations aren't code locations, make struct
42807         catchpoint inherit struct breakpoint instead of base_breakpoint.  This
42808         let's us delete the tracepoint::re_set override too.
42809
42810         Change-Id: Ib428bf71efb09fdaf399c56e4372b0f41d9c5869
42811
42812 2022-05-20  Pedro Alves  <pedro@palves.net>
42813
42814         Make breakpoint_address_bits look at the location kind
42815         Software watchpoints allocate a special dummy location using
42816         software_watchpoint_add_no_memory_location, and then
42817         breakpoint_address_bits checks whether the location is that special
42818         location to decide whether the location has a meaninful address to
42819         print.
42820
42821         Introduce a new bp_loc_software_watchpoint location kind, and make
42822         breakpoint_address_bits use bl_address_is_meaningful instead, which
42823         returns false for bp_loc_other, which is in accordance with we
42824         document for bp_location::address:
42825
42826           /* (... snip ...)  Valid for all types except
42827              bp_loc_other.  */
42828           CORE_ADDR address = 0;
42829
42830         Rename software_watchpoint_add_no_memory_location to
42831         add_dummy_location, and simplify it.  This will be used by catchpoints
42832         too in a following patch.
42833
42834         Note that neither "info breakpoints" nor "maint info breakpoints"
42835         actually prints the addresses of watchpoints, but I think it would be
42836         useful to do so in "maint info breakpoints".  This approach let's us
42837         implement that in the future.
42838
42839         Change-Id: I50e398f66ef618c31ffa662da755eaba6295aed7
42840
42841 2022-05-20  Pedro Alves  <pedro@palves.net>
42842
42843         Make exception_catchpoint inherit base_breakpoint instead of catchpoint
42844         exception_catchpoint is really a code breakpoint, with locations set
42845         by sals, re-set like other code breakpoints, etc., so make it inherit
42846         base_breakpoint.
42847
42848         This adds a bit of duplicated code to exception_catchpoint's ctor
42849         (copied from struct catchpoint's ctor), but it will be eliminated in a
42850         following patch.
42851
42852         Change-Id: I9fbb2927491120e9744a4f5e5cb5e6870ca07009
42853
42854 2022-05-20  Pedro Alves  <pedro@palves.net>
42855
42856         Refactor momentary breakpoints, eliminate set_raw_breakpoint{,_without_location}
42857         This commit makes set_momentary_breakpoint allocate the breakpoint
42858         type without relying on set_raw_breakpoint, and similarly,
42859         momentary_breakpoint_from_master not rely on
42860         set_raw_breakpoint_without_location.  This will let us convert
42861         init_raw_breakpoint to a ctor in a following patch.
42862
42863         The comment about set_raw_breakpoint being used in gdbtk sources is
42864         stale.  gdbtk no longer uses it.
42865
42866         Change-Id: Ibbf77731e4b22e18ccebc1b5799bbec0aff28c8a
42867
42868 2022-05-20  Pedro Alves  <pedro@palves.net>
42869
42870         Refactor set_internal_breakpoint / internal_breakpoint ctor
42871         This moves initialization of internal_breakpoint's breakpoint fields
42872         to internal_breakpoint's ctor, and stops using
42873         new_breakpoint_from_type for internal_breakpoint breakpoints.
42874
42875         Change-Id: I898ed0565f47cb00e4429f1c6446e6f9a385a78d
42876
42877 2022-05-20  Pedro Alves  <pedro@palves.net>
42878
42879         Convert init_ada_exception_catchpoint to a ctor
42880         Currently, init_ada_exception_catchpoint is defined in breakpoint.c, I
42881         presume so it can call the static describe_other_breakpoints function.
42882         I think this is a dependency inversion.
42883         init_ada_exception_catchpoint, being code specific to Ada catchpoints,
42884         should be in ada-lang.c, and describe_other_breakpoints, a core
42885         function, should be exported.
42886
42887         And then, we can convert init_ada_exception_catchpoint to an
42888         ada_catchpoint ctor.
42889
42890         Change-Id: I07695572dabc5a75d3d3740fd9b95db1529406a1
42891
42892 2022-05-20  Pedro Alves  <pedro@palves.net>
42893
42894         Make ada_catchpoint_location's owner ctor parameter be ada_catchpoint
42895         This commit changes ada_catchpoint_location's ctor from:
42896
42897           ada_catchpoint_location (breakpoint *owner)
42898
42899         to:
42900
42901           ada_catchpoint_location (ada_catchpoint *owner)
42902
42903         just to make the code better document intention.
42904
42905         To do this, we need to move the ada_catchpoint_location type's
42906         definition to after ada_catchpoint is defined, otherwise the compiler
42907         doesn't know that ada_catchpoint is convertible to struct breakpoint.
42908
42909         Change-Id: Id908b2e38bde30b262381e00c5637adb9bf0129d
42910
42911 2022-05-20  Pedro Alves  <pedro@palves.net>
42912
42913         init_breakpoint_sal -> base_breakpoint::base_breakpoint
42914         This converts init_breakpoint_sal to a base_breakpoint constructor.
42915
42916         It removes a use of init_raw_breakpoint.
42917
42918         To avoid manually adding a bunch of parameters to
42919         new_breakpoint_from_type, and manually passing them down to the
42920         constructors of a number of different base_breakpoint subclasses, make
42921         new_breakpoint_from_type a variable template function.
42922
42923         Change-Id: I4cc24133ac4c292f547289ec782fc78e5bbe2510
42924
42925 2022-05-20  Pedro Alves  <pedro@palves.net>
42926
42927         Remove "internal" parameter from a couple functions
42928         None of init_breakpoint_sal, create_breakpoint_sal, and
42929         strace_marker_create_breakpoints_sal make use of their "internal"
42930         parameter, so remove it.
42931
42932         Change-Id: I943f3bb44717ade7a7b7547edf8f3ff3c37da435
42933
42934 2022-05-20  Pedro Alves  <pedro@palves.net>
42935
42936         More breakpoint_ops parameter elimination
42937         Remove breakpoint_ops parameters from a few functions that don't need
42938         it.
42939
42940         Change-Id: Ifcf5e1cc688184acbf5e19b8ea60138ebe63cf28
42941
42942 2022-05-20  Pedro Alves  <pedro@palves.net>
42943
42944         Make a few functions work with base_breakpoint instead of breakpoint
42945         This makes tracepoints inherit from base_breakpoint, since their
42946         locations are code locations.  If we do that, then we can eliminate
42947         tracepoint::re_set and tracepoint::decode_location, as they are doing
42948         the same as the base_breakpoint implementations.
42949
42950         With this, all breakpoint types created by new_breakpoint_from_type
42951         are code breakpoints, i.e., base_breakpoint subclasses, and thus we
42952         can make it return a base_breakpoint pointer.
42953
42954         Finally, init_breakpoint_sal can take a base_breakpoint pointer as
42955         "self" pointer too.  This will let us convert this function to a
42956         base_breakpoint ctor in a following patch.
42957
42958         Change-Id: I3a4073ff1a4c865f525588095c18dc42b744cb54
42959
42960 2022-05-20  Pedro Alves  <pedro@palves.net>
42961
42962         ranged_breakpoint: move initialization to ctor
42963         Move initialization of ranged_breakpoint's fields to its ctor.
42964
42965         Change-Id: If7b842861f3cc6a429ea329d45598b5852283ba3
42966
42967 2022-05-20  Pedro Alves  <pedro@palves.net>
42968
42969         ranged_breakpoint: use install_breakpoint
42970         This commit replaces a chunk of code in break_range_command by an
42971         equivalent call to install_breakpoint.
42972
42973         Change-Id: I31c06cabd36f5be91740aab029265f678aa78e35
42974
42975 2022-05-20  Pedro Alves  <pedro@palves.net>
42976
42977         ranged_breakpoint: don't use init_raw_breakpoint
42978         ranged_breakpoint's ctor already sets the breakpoint's type to
42979         bp_hardware_breakpoint.
42980
42981         Since this is a "regular" breakpoint, b->pspace should remain NULL.
42982
42983         Thus, the only thing init_raw_breakpoint is needed for, is to add the
42984         breakpoint's location.  Do that directly.
42985
42986         Change-Id: I1505de94c3919881c2b300437e2c0da9b05f76bd
42987
42988 2022-05-20  Pedro Alves  <pedro@palves.net>
42989
42990         Make structs breakpoint/base_breakpoint/catchpoint be abstract
42991         You should never instanciate these types directly.
42992
42993         Change-Id: I8086c74c415eadbd44924bb0ef20f34b5b97ee6f
42994
42995 2022-05-20  Pedro Alves  <pedro@palves.net>
42996
42997         add_location_to_breakpoint -> breakpoint::add_location
42998         Make add_location_to_breakpoint be a method of struct breakpoint.
42999
43000         A patch later in the series will move this to base_breakpoint, but for
43001         now, it needs to be here.
43002
43003         Change-Id: I5bdc2ec1a7c2d66f26f51bf6f6adc8384a90b129
43004
43005 2022-05-20  Carl Love  <cel@us.ibm.com>
43006
43007         PowerPC: Make test gdb.arch/powerpc-power10.exp Endian independent.
43008         The .quad statement stores the 64-bit hex value in Endian order.  When used
43009         to store a 64-bit prefix instructions on Big Endian (BE) systems, the .quad
43010         statement stores the 32-bit suffix followed by the 32-bit prefix rather
43011         than the expected order of prefix word followed by the suffix word.  GDB
43012         fetches 32-bits at a time when disassembling instructions.  The disassembly
43013         on BE gets messed up since GDB fetches the suffix first and interprets it
43014         as a word instruction not a prefixed instruction.  When gdb fetches the
43015         prefix part of the instruction, following the initial suffix word, gdb
43016         associates the prefix word incorrectly with the following 32-bits as the
43017         suffix for the instruction when in fact it is the following instruction.
43018
43019         For example on BE we have two prefixed instructions stored using the
43020         .quad statement as follows:
43021
43022          addr    word                GDB action
43023         ---------------------------------------------
43024           1      suffix inst A   <- GDB interprets as a word instruction
43025           2      prefix inst A   <- GDB uses this prefix with
43026
43027           3      suffix inst B   <- this suffix rather than the suffix at addr 1.
43028           4      prefix inst B
43029
43030         This patch changes the .quad statement into two .longs to explicitly store
43031         the prefix followed by the suffix of the instruction.
43032
43033         The patch rearranges the instructions to put all of the word instructions
43034         together followed by the prefix instructions for clarity.
43035
43036         The patch has been tested on Power 10 and Power 7 BE and LE to verify
43037         the change works as expected.
43038
43039 2022-05-20  Tom Tromey  <tromey@adacore.com>
43040
43041         Remove obsolete text from documentation
43042         The documentation says that -enable-pretty-printing is experimental in
43043         7.0 and may change -- that's long enough ago that I think we can say
43044         that this text is no longer correct or useful.
43045
43046 2022-05-20  Nick Clifton  <nickc@redhat.com>
43047
43048         Stop readekf and objdump from aggressively following links.
43049                 * dwarf.c (dwarf_select_sections_by_names): Return zero if no
43050                 sections were selected.
43051                 (dwarf_select_sections_by_letters): Likewise.
43052                 * dwarf.h: (dwarf_select_sections_by_names): Update prototype.
43053                 (dwarf_select_sections_by_letters): Update prototype.
43054                 * objdump.c (might_need_separate_debug_info): New function.
43055                 (dump_bfd): Call new function before attempting to load separate
43056                 debug info files.
43057                 (main): Do not enable dwarf section dumping for -WK or -WN.
43058                 * readelf.c (parse_args): Do not enable dwarf section dumping for
43059                 -wK or -wN.
43060                 (might_need_separate_debug_info): New function.
43061                 (process_object): Call new function before attempting to load
43062                 separate debug info files.
43063                 * testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE
43064                 debuginfod tests to pass.
43065                 * testsuite/binutils-all/objdump.Wk: Add extra regexps.
43066                 * testsuite/binutils-all/readelf.k: Add extra regexps.
43067
43068 2022-05-20  Jia-Wei Chen  <jiawei@iscas.ac.cn>
43069
43070         RISC-V: Update zfinx implement with zicsr.
43071         Update zfinx implement with zicsr, fix missing fcsr use by zfinx.
43072         add zicsr imply by zfinx.
43073
43074         bfd/ChangeLog:
43075
43076                 * elfxx-riscv.c: New imply.
43077
43078         gas/ChangeLog:
43079
43080                 * testsuite/gas/riscv/csr-insns-pseudo-zfinx.d: New test.
43081
43082         opcodes/ChangeLog:
43083
43084                 * riscv-opc.c: Update insn class.
43085
43086 2022-05-20  Tsukasa OI  <research_trasio@irq.a4lg.com>
43087
43088         RISC-V: Remove RV128-only fmv instructions
43089         As fmv.x.q and fmv.q.x instructions are RV128-only (not RV64-only),
43090         it should be removed until RV128 support for GNU Binutils is required
43091         again.
43092
43093         gas/ChangeLog:
43094
43095                 * testsuite/gas/riscv/fmv.x.q-rv64-fail.d: New failure test.
43096                 * testsuite/gas/riscv/fmv.x.q-rv64-fail.l: Likewise.
43097                 * testsuite/gas/riscv/fmv.x.q-rv64-fail.s: Likewise.
43098
43099         include/ChangeLog:
43100
43101                 * opcode/riscv-opc.h (MATCH_FMV_X_Q, MASK_FMV_X_Q,
43102                 MATCH_FMV_Q_X, MASK_FMV_Q_X): Remove RV128-only instructions.
43103
43104         opcodes/ChangeLog:
43105
43106                 * riscv-opc.c (riscv_opcodes): Remove RV128-only instructions.
43107
43108 2022-05-20  Aditya Vidyadhar Kamath  <ADITYA.VIDYADHAR.KAMATH@ibm.com>
43109
43110         Fix non-pointer type compilation error in aix-thread.c
43111         In aix-thread.c we use ms->value_address () to get the symbol address.
43112         This triggers the following compiler error...
43113
43114              base operand of '->'  has non-pointer type 'bound_minimal_symbol'
43115
43116         ... because ms is not a pointer.
43117
43118         This commit fixes this error by using ms.value_address () instead.
43119
43120 2022-05-20  Steinar H. Gunderson  <sesse@google.com>
43121
43122         add a trie to map quickly from address range to compilation unit
43123         When using perf to profile large binaries, _bfd_dwarf2_find_nearest_line()
43124         becomes a hotspot, as perf wants to get line number information
43125         (for inline-detection purposes) for each and every sample. In Chromium
43126         in particular (the content_shell binary), this entails going through
43127         475k address ranges, which takes a long time when done repeatedly.
43128
43129         Add a radix-256 trie over the address space to quickly map address to
43130         compilation unit spaces; for content_shell, which is 1.6 GB when some
43131         (but not full) debug information turned is on, we go from 6 ms to
43132         0.006 ms (6 µs) for each lookup from address to compilation unit, a 1000x
43133         speedup.
43134
43135         There is a modest RAM increase of 180 MB in this binary (the existing
43136         linked list over ranges uses about 10 MB, and the entire perf job uses
43137         between 2–3 GB for a medium-size profile); for smaller binaries with few
43138         ranges, there should be hardly any extra RAM usage at all.
43139
43140 2022-05-20  Alan Modra  <amodra@gmail.com>
43141
43142         Tidy warn-execstack handling
43143         Make ld and bfd values consistent by swapping values 0 and 2 in
43144         link_info.warn_execstack.  This has the benefit of making the value an
43145         "extended" boolean, with 0 meaning no warning, 1 meaning warn, other
43146         values a conditional warning.
43147
43148         Yes, this patch introduces fails on arm/aarch64.  Not a problem with
43149         this patch but an arm/aarch64 before_parse problem.
43150
43151         bfd/
43152                 * elflink.c (bfd_elf_size_dynamic_sections): Adjust
43153                 warn_execstack test.
43154         include/
43155                 * bfdlink.h (warn_execstack): Swap 0 and 2 meaning.
43156         ld/
43157                 * configure.ac (DEFAULT_LD_WARN_EXECSTACK): Use values of 0,
43158                 1, 2 consistent with link_info.warn_execstack.
43159                 * ld.texi: Typo fixes.
43160                 * lexsup.c (parse_args): Adjust setting of link_info.warn_execstack.
43161                 (elf_static_list_options): Adjust help message conditions.
43162                 * configure: Regenerate.
43163
43164 2022-05-20  GDB Administrator  <gdbadmin@sourceware.org>
43165
43166         Automatic date update in version.in
43167
43168 2022-05-19  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
43169
43170         arm: Fix system register fpcxt_ns and fpcxt_s naming convention.
43171         The current assembler accepts system registers FPCXTNS and FPCXTS for Armv8.1-M
43172         Mainline Instructions VSTR, VLDR, VMRS and VMSR.
43173         Assembler should be also allowing FPCXT_NS, fpcxt_ns, fpcxtns, FPCXT_S, fpcxt_s
43174         and fpcxts. This patch fixes the issue.
43175
43176 2022-05-19  Andrew Burgess  <aburgess@redhat.com>
43177
43178         gdb/doc: use @value{GDBP} in 'info pretty-printer' example
43179         Update the 'info pretty-printer' example in the manual to make use of
43180         @value{GDBP} instead of hard-coding '(gdb)'.
43181
43182 2022-05-19  Andrew Burgess  <aburgess@redhat.com>
43183
43184         gdb/doc: make use of group/end group in 'info pretty-printers' example
43185         The 'info pretty-printers' example is pretty long and consists of many
43186         commands and their output.
43187
43188         Currently, when the pdf manual is generated this example spans a
43189         page-break, with the page-break falling part way through some example
43190         output from GDB.
43191
43192         This commit breaks up the example using @group .... @end group, within
43193         each group is a single GDB command and all its output.
43194
43195         Now, when the pdf manual is created, the page-break is placed after
43196         the output of one GDB command, and before the subsequent command, this
43197         looks much nicer.
43198
43199 2022-05-19  Nikolaos Chatzikonstantinou  <nchatz314@gmail.com>
43200
43201         gdb/doc: fix inconsistent info pretty-printer example
43202         The example for 'info pretty-printer' in the manual passes an
43203         object-regexp in some cases, but presents output as though no
43204         object-regexp was passed.
43205
43206         This commit fixes the two mistakes, in one case, fixing the output to
43207         filter based on object-regexp, and in the other, to remove the
43208         object-regexp from the command and leave all the output.
43209
43210 2022-05-19  Nick Clifton  <nickc@redhat.com>
43211
43212         Fix potentially uninitialised variables in the Windows tools
43213
43214 2022-05-19  Tiezhu Yang  <yangtiezhu@loongson.cn>
43215
43216         gdb: testsuite: Support displaced stepping on LoongArch
43217         When execute the following command on LoongArch:
43218
43219           make check-gdb TESTS="gdb.base/async-shell.exp"
43220
43221         we can see the following message in gdb/testsuite/gdb.sum:
43222
43223           UNSUPPORTED: gdb.base/async-shell.exp: displaced stepping
43224
43225         modify support_displaced_stepping to support displaced stepping
43226         on LoongArch.
43227
43228         With this patch:
43229
43230           PASS: gdb.base/async-shell.exp: run &
43231           PASS: gdb.base/async-shell.exp: shell echo foo
43232           PASS: gdb.base/async-shell.exp: interrupt
43233           PASS: gdb.base/async-shell.exp: process stopped
43234
43235         I did the following tests that use support_displaced_stepping
43236         with this patch on LoongArch, there is no failed testcases.
43237
43238         loongson@linux:~/gdb.git$ grep -r support_displaced_stepping gdb/testsuite/gdb.*
43239         gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp:if { ![support_displaced_stepping] } {
43240         gdb/testsuite/gdb.base/step-over-no-symbols.exp:    if { $displaced != "off" && ![support_displaced_stepping] } {
43241         gdb/testsuite/gdb.base/moribund-step.exp:if { ![support_displaced_stepping] } {
43242         gdb/testsuite/gdb.base/async-shell.exp:if { ![support_displaced_stepping] } {
43243         gdb/testsuite/gdb.base/inferior-died.exp:if { ![support_displaced_stepping] } {
43244         gdb/testsuite/gdb.base/step-over-syscall.exp:        if {$displaced == "on" && ![support_displaced_stepping]} {
43245         gdb/testsuite/gdb.mi/mi-watch-nonstop.exp:if { ![support_displaced_stepping] } {
43246         gdb/testsuite/gdb.mi/mi-ns-stale-regcache.exp:if { ![support_displaced_stepping] } {
43247         gdb/testsuite/gdb.mi/mi-nonstop.exp:if { ![support_displaced_stepping] } {
43248         gdb/testsuite/gdb.mi/mi-nsmoribund.exp:if { ![support_displaced_stepping] } {
43249         gdb/testsuite/gdb.mi/mi-nsintrall.exp:if { ![support_displaced_stepping] } {
43250         gdb/testsuite/gdb.mi/mi-nsthrexec.exp:if { ![support_displaced_stepping] } {
43251         gdb/testsuite/gdb.mi/mi-nonstop-exit.exp:if { ![support_displaced_stepping] } {
43252         gdb/testsuite/gdb.multi/watchpoint-multi.exp:if [support_displaced_stepping] {
43253         gdb/testsuite/gdb.python/py-evthreads.exp:if { ![support_displaced_stepping] } {
43254         gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp:    if { $displaced != "off" && ![support_displaced_stepping] } {
43255         gdb/testsuite/gdb.threads/interrupt-while-step-over.exp:    if { ${displaced-stepping} != "off" && ![support_displaced_stepping] } {
43256         gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp:    if { $displaced != "off" && ![support_displaced_stepping] } {
43257
43258 2022-05-19  Simon Marchi  <simon.marchi@polymtl.ca>
43259
43260         gdbsupport: fix path_join crash with -std=c++17 and -D_GLIBCXX_DEBUG
43261         When building GDB with -std=c++17 and -D_GLIBCXX_DEBUG=1, I get:
43262
43263           $ ./gdb -nx --data-directory=data-directory -q -ex "maint selftest path_join"
43264           /usr/include/c++/11.2.0/string_view:233: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion  '__pos < this->_M_len' failed.
43265
43266         The problem is that we're passing an empty string_view to
43267         IS_ABSOLUTE_PATH.  IS_ABSOLUTE_PATH accesses [0] on that string_view,
43268         which is out-of-bounds.
43269
43270         The reason this is not seen with -std less than c++17 is that our local
43271         copy of string_view (used with C++ < 17) does not have the assert in
43272         operator[], as that wouldn't work in a constexpr method:
43273
43274           https://gitlab.com/gnutools/binutils-gdb/-/blob/5890af36e5112bcbb8d7555e63570f68466e6944/gdbsupport/gdb_string_view.h#L180
43275
43276         IS_ABSOLUTE_PATH is normally used with null-terminated string.  It's
43277         fine to pass an empty null-terminated string to IS_ABSOLUTE_PATH,
43278         because index 0 in such a string is valid.  But not with an empty
43279         string_view.
43280
43281         Fix that by avoiding the "call" to IS_ABSOLUTE_PATH if the string_view
43282         is empty.
43283
43284         Change-Id: Idf4df961b63f513b3389235e93814c02b89ea32e
43285
43286 2022-05-19  Jan Beulich  <jbeulich@suse.com>
43287
43288         Arm64: force emission of ILP32-dependent relocs
43289         Like the placeholder types added in 04dfe7aa5217 ("Arm64: follow-on to
43290         PR gas/27217 fix"), these are also placeholders which are subsequently
43291         resolved (albeit later, hence this being a separate issue). As for the
43292         resolved types 1 is returned, these pseudo-relocs should also have 1
43293         returned to force retaining of the [eventual] relocations. This is also
43294         spelled out individually for each of them in md_apply_fix().
43295
43296 2022-05-19  Jan Beulich  <jbeulich@suse.com>
43297
43298         COFF: use hash for string table also when copying / stripping
43299         Otherwise the string table may grow and hence e.g. change a final binary
43300         (observed with PE/COFF ones) even if really there's no change. Doing so
43301         in fact reduces the overall amount of code, and in particular the number
43302         of places which need to remain in sync.
43303
43304         Afaics there's no real equivalent to the "traditional_format" field used
43305         when linking, so hashing is always enabled when copying / stripping.
43306
43307 2022-05-19  Jan Beulich  <jbeulich@suse.com>
43308
43309         COFF/PE: keep linker version during objcopy / strip
43310         Neither of the tools is really a linker, so whatever was originally
43311         recorded should be retained rather than being overwritten by these
43312         tools' versions.
43313
43314         COFF/PE: don't leave zero timestamp after objcopy / strip
43315         Fill the timestamp field suitably for _bfd_XXi_only_swap_filehdr_out().
43316         Instead of re-arranging the present if(), fold this logic with that of
43317         copying the optional header.
43318
43319 2022-05-19  Jan Beulich  <jbeulich@suse.com>
43320
43321         COFF: make objcopy / strip honor --keep-file-symbols
43322         So far this option had no effect when used together with e.g.
43323         --strip-debug. Set BSF_FILE on these symbols to change that.
43324
43325         While altering this also join two adjacent blocks of case labeled
43326         statements with identical code.
43327
43328 2022-05-19  Jan Beulich  <jbeulich@suse.com>
43329
43330         don't over-align file positions of PE executable sections
43331         When a sufficiently small alignment was specified via --file-alignment,
43332         individual section alignment shouldn't affect placement within the file.
43333         This involves first of all clearing D_PAGED for images when section and
43334         file alignment together don't permit paging of the image. The involved
43335         comparison against COFF_PAGE_SIZE in turn helped point out (through a
43336         compiler warning) that 'page_size' should be of unsigned type (as in
43337         particular FileAlignment is). This yet in turn pointed out a dubious
43338         error condition (which is being deleted).
43339
43340         For the D_PAGED case I think the enforced file alignment may still be
43341         too high, but I'm wary of changing that logic without knowing of
43342         possible corner cases.
43343
43344         Furthermore file positions in PE should be independent of the alignment
43345         recorded in section headers anyway. Otherwise there are e.g. anomalies
43346         following commit 6f8f6017a0c4 ("PR27567, Linking PE files adds alignment
43347         section flags to executables") in that linking would use information a
43348         subsequent processing step (e.g. stripping) wouldn't have available
43349         anymore, and hence a binary could change in that 2nd step for no actual
43350         reason. (Similarly stripping a binary linked with a linker pre-dating
43351         that commit would change the binary again when stripping it a 2nd time.)
43352
43353 2022-05-19  Yvan Roux  <yvan.roux@foss.st.com>
43354
43355          _bfd_real_fopen should not use ccs parameter on Windows
43356                 PR 25713
43357                 * bfdio.c (_bfd_real_fopen): Delete ccs string.
43358
43359 2022-05-19  Tsukasa OI  <research_trasio@irq.a4lg.com>
43360
43361         RISC-V: Fix canonical extension order (K and J)
43362         This commit fixes canonical extension order to follow the RISC-V ISA
43363         Manual draft-20210402-1271737 or later.
43364
43365         bfd/ChangeLog:
43366
43367                 * elfxx-riscv.c (riscv_recognized_prefixed_ext): Fix "K" extension
43368                 prefix to be placed before "J".
43369
43370 2022-05-19  GDB Administrator  <gdbadmin@sourceware.org>
43371
43372         Automatic date update in version.in
43373
43374 2022-05-18  John Baldwin  <jhb@FreeBSD.org>
43375
43376         Use aarch64_features to describe register features in target descriptions.
43377         Replace the sve bool member of aarch64_features with a vq member that
43378         holds the vector quotient.  It is zero if SVE is not present.
43379
43380         Add std::hash<> specialization and operator== so that aarch64_features
43381         can be used as a key with std::unordered_map<>.
43382
43383         Change the various functions that create or lookup aarch64 target
43384         descriptions to accept a const aarch64_features object rather than a
43385         growing number of arguments.
43386
43387         Replace the multi-dimension tdesc_aarch64_list arrays used to cache
43388         target descriptions with unordered_maps indexed by aarch64_feature.
43389
43390 2022-05-18  Jan Beulich  <jbeulich@suse.com>
43391
43392         Arm64: follow-on to PR gas/27217 fix
43393         PR gas/27217
43394
43395         Prior to trying to address PR gas/28888 I noticed anomalies in how
43396         certain insns would / wouldn't be affected in similar ways.
43397
43398         Commit eac4eb8ecb26 ("Fix a problem assembling AArch64 sources when a
43399         relocation is generated against a symbol that has a defined value") had
43400         two copy-and-paste mistakes, passing the wrong type to
43401         aarch64_force_reloc().
43402
43403         It further failed to add placeholder relocation types to that function's
43404         block of case labels leading to a return of 1. While not of interest for
43405         aarch64_force_relocation() (these placeholders are resolved right in
43406         parse_operands()), calls to aarch64_force_reloc() happen before that
43407         resolution would take place.
43408
43409 2022-05-18  Nick Clifton  <nickc@redhat.com>
43410
43411         Fix compile time warning building gold with Clang-14.
43412                 * int_encoding.cc (get_length_as_unsigned_LEB_128): Remove
43413                 current_length variable.
43414
43415 2022-05-18  Victor Do Nascimento  <victor.donascimento@arm.com>
43416
43417         oops - forgot changelog entry for the previous delta.
43418
43419         arm: Add unwind support for mixed register lists
43420                 * config/tc-arm.c (parse_reg_list): Add handling of mixed register
43421                 types.
43422                 (reg_names): Enumerate pseudoregister according to mapped physical
43423                 register number.
43424                 (s_arm_unwind_save_pseudo): Modify function signature.
43425                 (s_arm_unwind_save_core): Likewise.
43426                 (s_arm_unwind_save_mixed): New function.
43427                 (s_arm_unwind_save): Generate register list mask to pass to nested
43428                 functions.
43429                 * testsuite/gas/arm/unwind-pacbti-m.s: Expand test for mixed
43430                 register type lists.
43431                 * testsuite/gas/arm/unwind-pacbti-m.d: Likewise.
43432                 * testsuite/gas/arm/unwind-pacbti-m-readelf.d: Likewise.
43433
43434 2022-05-18  Carl Love  <cel@us.ibm.com>
43435
43436         PowerPC: bp-permanent.exp, kill-after-signal fix
43437         Fix changes that didn't make it into commit:
43438         dd9cd55e990bcc9f8448cac38d242d53974b3604.
43439
43440         Fix missing -wrap on gdb_test_multiple in gdb.base/kill-after-signal.exp
43441         that is causing regression test on x86_64-linux with taskset -c 0.
43442
43443 2022-05-18  Yichao Yu  <yyc1992@gmail.com>
43444
43445         [AArch64] Return the regnum for PC (32) on aarch64
43446         This will allow the unwind info to explicitly specify a different value
43447         for the return address from the link register.
43448         Such usage, although uncommon, is valid and useful for signal frames.
43449         It is also supported by aadwarf64 from ARM (Note 9 in [1]).
43450
43451         Ref https://sourceware.org/pipermail/gdb/2022-May/050091.html
43452
43453         [1] https://github.com/ARM-software/abi-aa/blob/2022Q1/aadwarf64/aadwarf64.rst#dwarf-register-names
43454
43455 2022-05-18  Jan Beulich  <jbeulich@suse.com>
43456
43457         x86: shrink op_riprel
43458         It is only ever initialized from a boolean, so it as well as related
43459         variables' types can simply be bool and there's no masking to 32 bits
43460         needed in set_op().
43461
43462 2022-05-18  Nick Clifton  <nickc@redhat.com>
43463
43464         Add a --no-weak option to nm.
43465                 PR 29135
43466                 * nm.c (non_weak): New variable.
43467                 (filter_symbols): When non-weak is true, ignore weak symbols.
43468                 (long_options): Add --no-weak.
43469                 (usage): Mention --no-weak.
43470                 (main): Handle -W/--no-weak.
43471                 * doc/binutils.texi: Document new feature.
43472                 * NEWS: Mention the new feature.
43473                 * testsuite/binutils-all/nm.exp: Add test of new feature.
43474                 * testsuite/binutils-all/no-weak.s: New test source file.
43475
43476 2022-05-18  Pedro Alves  <pedro@palves.net>
43477
43478         Support -prompt and -lbl in gdb_test
43479         This teaches gdb_test to forward the -prompt and -lbl options to
43480         gdb_test_multiple.
43481
43482         The option parsing is done with parse_args.
43483
43484         As a cleanup, instead of using llength and lindex to get at the
43485         positional arguments, use lassign, and check whether the corresponding
43486         variable is empty.
43487
43488         Convert gdb.base/ui-redirect.exp and gdb.xml/tdesc-reload.exp to use
43489         gdb_test -prompt/-lbl instead of gdb_test_multiple as examples.
43490
43491         Change-Id: I243e1296d32c05a421ccef30b63d43a89eaeb4a0
43492
43493 2022-05-18  Luis Machado  <luis.machado@arm.com>
43494
43495         Remove unused DWARF PAUTH registers
43496         The AARCH64_DWARF_PAUTH_DMASK and AARCH64_DWARF_PAUTH_CMASK DWARF registers
43497         never made their way into the aadwarf64. The following patch removes these
43498         constants and their use.
43499
43500         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26295
43501
43502 2022-05-18  Luis Machado  <luis.machado@arm.com>
43503
43504         Rename PAUTH_RA_STATE to RA_SIGN_STATE
43505         The aadwarf64 [1] names this register RA_SIGN_STATE, so update the code to use
43506         the same name.
43507
43508         [1] https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst
43509
43510 2022-05-18  Tom de Vries  <tdevries@suse.de>
43511
43512         [gdb/testsuite] Simplify unknown lang testing in gdb.base/parse_number.exp
43513         Move testing of language unknown out of the $supported_archs loop in
43514         gdb.base/parse_number.exp.  This reduces total amount of tests from 18466 to
43515         17744.
43516
43517         Tested on x86_64-linux.
43518
43519 2022-05-18  Tom de Vries  <tdevries@suse.de>
43520
43521         [gdb/testsuite] Use hex_for_lang in gdb.base/parse_number.exp
43522         In gdb.base/parse_number.exp, add a new proc hex_for_lang that formats a hex
43523         number appropriately for a given language.
43524
43525         Tested on x86_64-linux.
43526
43527 2022-05-18  Tom de Vries  <tdevries@suse.de>
43528
43529         [gdb/tdep] Add gdb/syscalls/update-linux-from-src.sh
43530         Add a new script gdb/syscalls/update-linux-from-src.sh, that can be used to
43531         generate *-linux.xml.in files from linux kernel sources, like so:
43532         ...
43533         $ ./update-linux-from-src.sh ~/upstream/linux-stable.git
43534         Skipping aarch64-linux.xml.in, no syscall.tbl
43535         Generating amd64-linux.xml.in
43536         Skipping arm-linux.xml.in, use arm-linux.py instead
43537         Skipping bfin-linux.xml.in, no longer supported
43538         Generating i386-linux.xml.in
43539         Generating mips-n32-linux.xml.in
43540         Generating mips-n64-linux.xml.in
43541         Generating mips-o32-linux.xml.in
43542         Generating ppc64-linux.xml.in
43543         Generating ppc-linux.xml.in
43544         Generating s390-linux.xml.in
43545         Generating s390x-linux.xml.in
43546         Generating sparc64-linux.xml.in
43547         Generating sparc-linux.xml.in
43548         ...
43549
43550         Update *-linux.xml.in and *-linux.xml using linux kernel tag v5.18-rc6.
43551
43552 2022-05-18  Tamar Christina  <tamar.christina@arm.com>
43553
43554         AArch64: Enable FP16 by default for Armv9-A.
43555         In Armv9-A SVE is mandatory, and for SVE FP16 is mandatory.  This fixes a disconnect
43556         between GCC and binutils where GCC has FP16 on by default and gas doesn't.
43557
43558         include/ChangeLog:
43559
43560         2022-05-16  Tamar Christina  <tamar.christina@arm.com>
43561
43562                 * opcode/aarch64.h (AARCH64_ARCH_V9_FEATURES): Add AARCH64_FEATURE_F16.
43563
43564 2022-05-18  Jan Beulich  <jbeulich@suse.com>
43565
43566         gas: avoid octal numbers being accepted when processing .linefile
43567         Compilers would put decimal numbers there, so I think we should treat
43568         finding octal numbers the same as finding bignums - ignore them as
43569         actually being comments of some very specific form.
43570
43571 2022-05-18  Jan Beulich  <jbeulich@suse.com>
43572
43573         gas: avoid bignum related errors when processing .linefile
43574         Any construct which to the scrubber looks like a C preprocessor
43575         line/file "directive" is converted to .linefile, but the amount of
43576         checking the scrubber does is minimal (albeit it does let through only
43577         decimal digits for the line part of the contruct). Since the scrubber
43578         conversion is further tied to # being a line comment character, anything
43579         which upon closer inspection turns out not to be a line/file "directive"
43580         is supposed to be treated as a comment, i.e. ignored. Therefore we
43581         cannot use get_absolute_expression(), as this may raise errors. Open-
43582         code the function instead, treating everything not resulting in
43583         O_constant as a comment as well.
43584
43585         Furthermore also bounds-check the parsed value. This bounds check tries
43586         to avoid implementation defined behavior (which may be the raising of an
43587         implementation defined signal), but for now makes the assumption that
43588         int has less than 64 bits. The way bfd_signed_vma (which is what offsetT
43589         aliases) is defined in bfd.h for the BFD64 case I cannot really see a
43590         clean way of avoiding this assumption. Omitting the #ifdef, otoh, would
43591         risk "condition is always false" warnings by compilers.
43592
43593         Convert get_linefile_number() to return bool at this occasion as well.
43594
43595 2022-05-18  Jan Beulich  <jbeulich@suse.com>
43596
43597         gas: fold do_repeat{,_with_expander}()
43598         do_repeat_with_expander() already deals with the "no expander" case
43599         quite fine, so there's really little point having two functions. What it
43600         lacks compared with do_repeat() is a call to sb_build(), which can
43601         simply be moved (and the then redundant sb_new() be avoided). Along with
43602         this moving also flip if the main if()'s condition such that the "no
43603         expander" case is handled first.
43604
43605         gas: don't ignore .linefile inside false conditionals
43606         When assembling code previously pre-processed by a C compiler, long
43607         enough comments may have been collapsed into "# <line> <file>"
43608         constructs. If we skip these, line numbers (and possibly even file
43609         names) will be off / wrong in both diagnostics and debug info.
43610
43611         gas: simplify ignore_input()
43612         First of all convert to switch(), in preparation of adding another
43613         directive here which may not be ignored. While doing so drop dead code:
43614         A string the first two characters of which do not match "if" also wont
43615         match "ifdef" or "ifndef".
43616
43617         gas: tweak .irp and alike file/line handling for M68K/MRI
43618         In commit 2ee1792bec22 ("gas: further adjust file/line handling for .irp
43619         and alike") I neglected the need to omit the leading . in M68K/MRI mode.
43620
43621 2022-05-18  Xi Ruoyao  <xry111@mengyan1223.wang>
43622
43623         gold: don't invoke IA32 syscall in x86_64 assembly testcase
43624         pr17704a_test.s is a x86_64 assembly file, but it invokes IA32 exit
43625         syscall with "int 0x80".  This causes a segfault on kernels with
43626         CONFIG_IA32_EMULATION disabled.
43627
43628         gold/
43629
43630                 * testsuite/pr17704a_test.s (_start): Invoke x86_64 exit syscall
43631                 instead of its IA32 counterpart.
43632
43633 2022-05-18  GDB Administrator  <gdbadmin@sourceware.org>
43634
43635         Automatic date update in version.in
43636
43637 2022-05-17  Nikolaos Chatzikonstantinou  <nchatz314@gmail.com>
43638
43639         Fix typo in info page
43640
43641 2022-05-17  Pedro Alves  <pedro@palves.net>
43642
43643         Fix gdb.python/py-connection.exp with remote targets
43644         After the patch to make gdb_test's question non-optional when
43645         specified, gdb.python/py-connection.exp started failing like so:
43646
43647           $ make check TESTS="gdb.python/py-connection.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
43648           (gdb) PASS: gdb.python/py-connection.exp: info connections while the connection is still around
43649           disconnect^M
43650           Ending remote debugging.^M
43651           (gdb) FAIL: gdb.python/py-connection.exp: kill the inferior
43652
43653         The problem is that "disconnect" when debugging with the native target
43654         asks the user whether to kill the program, while with remote targets,
43655         it doesn't.
43656
43657         Fix it by explicitly killing before disconnecting.
43658
43659         Tested with --target_board unix, native-gdbserver, and native-extended-gdbserver.
43660
43661         Change-Id: Icd85015c76deb84b71894715d43853c1087eba0b
43662
43663 2022-05-17  Felix Willgerodt  <felix.willgerodt@intel.com>
43664
43665         gdb, btrace: Throw an error for empty recordings when replaying starts.
43666         This makes record_btrace_start_replaying() more consistent, as it already
43667         errors out e.g. on a recording with only gaps.
43668
43669 2022-05-17  Pedro Alves  <pedro@palves.net>
43670
43671         Make gdb_test's question non-optional if specified
43672         gdb_test supports handling scenarios where GDB asks a question before
43673         finishing handling some command.  The full prototype of gdb_test is:
43674
43675           # gdb_test COMMAND PATTERN MESSAGE QUESTION RESPONSE
43676
43677         However, QUESTION is a question that GDB _may_ ask, not one that GDB
43678         _must_ ask:
43679
43680          # QUESTION is a question GDB may ask in response to COMMAND, like
43681          #   "are you sure?"
43682          # RESPONSE is the response to send if QUESTION appears.
43683
43684         If GDB doesn't raise the question, the test still passes.
43685
43686         I think that this is a misfeature.  If GDB regresses and stops asking
43687         a question, the testsuite won't notice.  So I think that if a QUESTION
43688         is specified, gdb_test should ensure it comes out of GDB.
43689
43690         Running the testsuite exposed a number of tests that pass
43691         QUESTION/RESPONSE to GDB, but no question comes out.  The previous
43692         commits fixed them all, so this commit changes gdb_test's behavior.
43693
43694         A related issue is that gdb_test doesn't enforce that if you specify
43695         QUESTION, that you also specify RESPONSE.  I.e., you should pass 1, 2,
43696         3, or 5 arguments to gdb_test, but never 4, or more than 5.  Making
43697         gdb_test detect bogus arguments actually regressed some testcases,
43698         also all fixed in previous commits.
43699
43700         Change-Id: I47c39c9034e6a6841129312037a5ca4c5811f0db
43701
43702 2022-05-17  Pedro Alves  <pedro@palves.net>
43703
43704         gdb.base/skip.exp: Don't abuse gdb_test's question support
43705         gdb.base/skip.exp abuses gdb_test's support for answering a GDB
43706         question to do this:
43707
43708             # With gcc 9.2.0 we jump once back to main before entering foo here.
43709             # If that happens try to step a second time.
43710             gdb_test "step" "foo \\(\\) at.*" "step 3" \
43711                 "main \\(\\) at .*\r\n$gdb_prompt " "step"
43712
43713         After a patch later in this series, gdb_test will FAIL if GDB does NOT
43714         issue the question, so this test would start failing on older GCCs.
43715
43716         Switch to using gdb_test_multiple instead.  There are three spots in
43717         the file that have the same pattern, and they're actually in a
43718         sequence of commands that is repeated those 3 times.  Factor all that
43719         out to a procedure.
43720
43721         I don't have gcc 9.2 handy, but I do have gcc 6.5, and that one is
43722         affected as well, so update the comment.
43723
43724         Change-Id: If0a7e3cdf5191b4eec95ce0c8845c3a4d801c39e
43725
43726 2022-05-17  Pedro Alves  <pedro@palves.net>
43727
43728         Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp
43729         gdb.server/connect-with-no-symbol-file.exp's connect_no_symbol_file
43730         does:
43731
43732                 gdb_test "file" ".*" "discard symbol table" \
43733                     {Discard symbol table from `.*'\? \(y or n\) } "y"
43734
43735         A following patch will make gdb_test expect the question out of GDB if
43736         one is passed down as argument to gdb_test.  With that, this test
43737         starts failing.  This is because connect_no_symbol_file is called in a
43738         loop, and the first time around, there's a loaded file, so "file" asks
43739         the "Discard symbol table ... ?" question, while in the following
43740         iterations there's no file, so there's no question.
43741
43742         Fix this by not loading a file into GDB in the first place.
43743
43744         Change-Id: I810c036b57842c4c5b47faf340466b0d446d1abc
43745
43746 2022-05-17  Pedro Alves  <pedro@palves.net>
43747
43748         Fix bogus gdb_test invocations
43749         A following patch will make gdb_test error out if bogus arguments are
43750         passed, which exposed bugs in a few testcases:
43751
43752          - gdb.python/py-parameter.exp, passing a spurious "1" as extra
43753            parameter, resulting in:
43754
43755            ERROR: Unexpected arguments: {set test-file-param bar.txt} {The name of the file has been changed to bar.txt} {set new file parameter} 1
43756
43757          - gdb.python/py-xmethods.exp, a missing test message, resulting in
43758            the next gdb_test being interpreted as message, question and
43759            response!  With the enforcing patch, this was caught with:
43760
43761            ERROR: Unexpected arguments: {p g.mul<char>('a')} {From Python G<>::mul.*} gdb_test {p g_ptr->mul<char>('a')} {From Python G<>::mul.*} {after: g_ptr->mul<char>('a')}
43762
43763          - gdb.base/pointers.exp, missing a quote.
43764
43765         Change-Id: I66f2db4412025a64121db7347dfb0b48240d46d4
43766
43767 2022-05-17  Pedro Alves  <pedro@palves.net>
43768
43769         gdb.base/scope.exp: Remove bogus gdb_test questions
43770         This test is abusing the QUESTION/RESPONSE feature to send an
43771         alternative command to GDB if the first command fails.  Like so:
43772
43773            gdb_test "print 'scope0.c'::filelocal" \
43774                     "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" \
43775                     "No symbol \"scope0.c\" in current context.*" \
43776                     "print '$srcdir/$subdir/scope0.c'::filelocal"
43777
43778         So if 'scope0.c' doesn't work, we try again with
43779         '$srcdir/$subdir/scope0.c'.  I strongly suspect this is really an
43780         obsolete test.  I think that if '$srcdir/$subdir/scope0.c' works, then
43781         'scope0.c' should have worked too, thus I'd think that if we pass due
43782         to the question path, then it's a bug.  So just remove the question
43783         part passed to gdb_test.
43784
43785         Change-Id: I2acc99285f1d519284051b49693b5441fbdfe3cd
43786
43787 2022-05-17  Pedro Alves  <pedro@palves.net>
43788
43789         Remove gdb_test questions that GDB doesn't ask
43790         Change-Id: Ib2616dc883e9dc9ee100f6c86d83a921a0113c16
43791
43792 2022-05-17  Nelson Chu  <nelson.chu@sifive.com>
43793
43794         RISC-V: Added half-precision floating-point v1.0 instructions.
43795         bfd/
43796                 * elfxx-riscv.c (riscv_implicit_subsets): Added implicit f
43797                 and zicsr for zfh.
43798                 (riscv_supported_std_z_ext): Added default v1.0 version for zfh.
43799                 (riscv_multi_subset_supports): Handle INSN_CLASS_ZFH,
43800                 INSN_CLASS_D_AND_ZFH and INSN_CLASS_Q_AND_ZFH.
43801         gas/
43802                 * config/tc-riscv.c (FLT_CHARS): Added "hH".
43803                 (macro): Expand Pseudo M_FLH and M_FSH.
43804                 (riscv_pseudo_table): Added .float16 directive.
43805                 * testsuite/gas/riscv/float16-be.d: New testcase for .float16.
43806                 * testsuite/gas/riscv/float16-le.d: Likewise.
43807                 * testsuite/gas/riscv/float16.s: Likewise.
43808                 * testsuite/gas/riscv/fp-zfh-insns.d: New testcase for zfh.
43809                 * testsuite/gas/riscv/fp-zfh-insns.s: Likewise.
43810         include/
43811                 * opcode/riscv-opc.h: Added MASK and MATCH encodings for zfh.
43812                 * opcode/riscv.h: Added INSN_CLASS and pseudo macros for zfh.
43813         opcodes/
43814                 * riscv-opc.c (riscv_opcodes): Added zfh instructions.
43815
43816 2022-05-17  GDB Administrator  <gdbadmin@sourceware.org>
43817
43818         Automatic date update in version.in
43819
43820 2022-05-16  Ilya Leoshkevich  <iii@linux.ibm.com>
43821
43822         IBM zSystems: Fix left-shifting negative PCRel32 values (PR gas/29152)
43823         s390_insert_operand ()'s val, min and max are encoded PCRel32 values
43824         and need to be left-shifted by 1 before being shown to the user.
43825         Left-shifting negative values is undefined behavior in C, but the
43826         current code does not try to prevent it, causing UBSan to complain.
43827
43828         Fix by casting the values to their unsigned equivalents before
43829         shifting.
43830
43831 2022-05-16  Pedro Alves  <pedro@palves.net>
43832
43833         Reindent gdbsupport/event-loop.cc:handle_file_event
43834         The handle_file_event function has a few unnecessary {} lexical
43835         blocks, presumably because they were originally if blocks, and the
43836         conditions were removed, or something along those lines.
43837
43838         Remove the unnecessary blocks, and reindent.
43839
43840         Change-Id: Iaecbe5c9f4940a80b81dbbc42e51ce506f6aafb2
43841
43842 2022-05-16  Pedro Alves  <pedro@palves.net>
43843
43844         gdbsupport/event-loop.cc: simplify !HAVE_POLL paths
43845         gdbsupport/event-loop.cc throughout handles the case of use_poll being
43846         true on a system where HAVE_POLL is not defined, by calling
43847         internal_error if that situation ever happens.
43848
43849         Simplify this by moving the "use_poll" global itself under HAVE_POLL,
43850         so that it's way more unlikely to ever end up in such a situation.
43851         Then, move the code that checks the value of use_poll under HAVE_POLL
43852         too, and remove the internal_error calls.  Like, from:
43853
43854             if (use_poll)
43855               {
43856           #ifdef HAVE_POLL
43857                 // poll code
43858           #else
43859               internal_error (....);
43860           #endif /* HAVE_POLL */
43861               }
43862             else
43863               {
43864                 // select code
43865               }
43866
43867         to
43868
43869           #ifdef HAVE_POLL
43870             if (use_poll)
43871               {
43872                 // poll code
43873               }
43874             else
43875           #endif /* HAVE_POLL */
43876               {
43877                 // select code
43878               }
43879
43880         While at it, make use_poll be a bool.  The current code is using
43881         unsigned char most probably to save space, but I don't think it really
43882         matters here.
43883
43884         Co-Authored-By: Youling Tang <tangyouling@loongson.cn>
43885         Change-Id: I0dd74fdd4d393ccd057906df4cd75e8e83c1cdb4
43886
43887 2022-05-16  Eli Zaretskii  <eliz@gnu.org>
43888
43889         gdb: Fix typo in last change in gdb.texinfo
43890
43891         gdb: Document the 'metadata' styling in GDB displays.
43892         The 'metadata' styling was never documented in the GDB manual.
43893         This fills that gap.
43894
43895 2022-05-16  Tom Tromey  <tromey@adacore.com>
43896
43897         Fix Ada exception regression on Windows
43898         The breakpoint c++-ification series introduced another bug in Ada --
43899         it caused "catch exception" and related commands to fail on Windows.
43900         The problem is that the re_set method calls the wrong superclass
43901         method, so the breakpoint doesn't get correctly re-set when the
43902         runtime offsets change.  This patch fixes the problem.
43903
43904 2022-05-16  Bruno Larsen  <blarsen@redhat.com>
43905
43906         gdb/testsuite: fix "continue outside of loop" TCL errors
43907         Many test cases had a few lines in the beginning that look like:
43908
43909         if { condition } {
43910           continue
43911         }
43912
43913         Where conditions varied, but were mostly in the form of ![runto_main] or
43914         [skip_*_tests], making it quite clear that this code block was supposed
43915         to finish the test if it entered the code block. This generates TCL
43916         errors, as most of these tests are not inside loops.  All cases on which
43917         this was an obvious mistake are changed in this patch.
43918
43919 2022-05-16  GDB Administrator  <gdbadmin@sourceware.org>
43920
43921         Automatic date update in version.in
43922
43923 2022-05-15  GDB Administrator  <gdbadmin@sourceware.org>
43924
43925         Automatic date update in version.in
43926
43927 2022-05-14  GDB Administrator  <gdbadmin@sourceware.org>
43928
43929         Automatic date update in version.in
43930
43931 2022-05-13  Tom Tromey  <tromey@adacore.com>
43932
43933         Remove unused field cooked_index::m_start
43934         cooked_index::m_start is unused and can be removed.  I think this was
43935         a leftover from a previous approach in the index finalization code,
43936         and then when rewriting it I forgot to remove it.
43937
43938         Tested by rebuilding.
43939
43940 2022-05-13  Tom Tromey  <tromey@adacore.com>
43941
43942         Implement pid_to_exec_file for Windows in gdbserver
43943         I noticed that gdbserver did not implement pid_to_exec_file for
43944         Windows, while gdb did implement it.  This patch moves the code to
43945         nat/windows-nat.c, so that it can be shared.  This makes the gdbserver
43946         implementation trivial.
43947
43948         Remove windows_process_info::id
43949         I noticed that windows_process_info::id is only used by gdbserver, and
43950         not really necessary.  This patch removes it.
43951
43952         Constify target_pid_to_exec_file
43953         This changes target_pid_to_exec_file and target_ops::pid_to_exec_file
43954         to return a "const char *".  I couldn't build many of these targets,
43955         but did examine the code by hand -- also, as this only affects the
43956         return type, it's normally pretty safe.  This brings gdb and gdbserver
43957         a bit closer, and allows for the removal of a const_cast as well.
43958
43959         Put corefile-run.core into test subdirectory
43960         I noticed that corefile-run.core ends up in the 'runtest' directory.
43961         It's better, when at all possible, for test files to end up in the
43962         test's designated subdirectory.  This patch makes this change.
43963
43964 2022-05-13  Tom Tromey  <tromey@adacore.com>
43965
43966         Do not double-read minimal symbols for PE COFF
43967         This changes coffread.c to avoid re-reading minimal symbols when
43968         possible.  This only works when there are no COFF symbols to be read,
43969         but at least for my mingw builds of gdb, this seems to be the case.
43970
43971         Tested using the AdaCore internal test suite on Windows.  I also did
43972         some local builds to ensure that no warnings crept in.
43973
43974 2022-05-13  Pedro Alves  <pedro@palves.net>
43975
43976         Fix "gdb --write" with core files
43977         If you load a core file into GDB with the --write option, or "set
43978         write on" (equivalent), and then poke memory expecting it to patch the
43979         core binary, you'll notice something odd -- the write seems to
43980         succeed, but in reality, it doesn't.  The value you wrote doesn't
43981         persist.  Like so:
43982
43983          $ gdb -q --write -c testsuite/outputs/gdb.base/patch/gcore.test
43984          [New LWP 615986]
43985          Core was generated by `/home/pedro/gdb/build/gdb/testsuite/outputs/gdb.base/patch/patch'.
43986          Program terminated with signal SIGTRAP, Trace/breakpoint trap.
43987          #0  0x0000555555555131 in ?? ()
43988          (gdb) p *(unsigned char *)0x0000555555555131 = 1
43989          $1 = 1 '\001'
43990          (gdb) p *(unsigned char *)0x0000555555555131
43991          $2 = 185 '\271'
43992          (gdb)
43993
43994         Diffing hexdumps of before/after patching, reveals that a "0x1" was
43995         actually written somewhere in the file.  The problem is that the "0x1"
43996         was written at the wrong offset in the file...
43997
43998         That happens because _bfd_elf_set_section_contents does this to seek
43999         to the section's offset:
44000
44001           pos = hdr->sh_offset + offset;
44002           if (bfd_seek (abfd, pos, SEEK_SET) != 0
44003               || bfd_bwrite (location, count, abfd) != count)
44004             return false;
44005
44006         ... and 'hdr->sh_offset' is zero, so we seek to just OFFSET, which is
44007         incorrect.  The reason 'hdr->sh_offset' is zero is that
44008         kernel-generated core files normally don't even have a section header
44009         table (gdb-generated ones do, but that's more an accident than a
44010         feature), and indeed elf_core_file_p doesn't even try to read sections
44011         at all:
44012
44013           /*  Core files are simply standard ELF formatted files that partition
44014               the file using the execution view of the file (program header table)
44015               rather than the linking view.  In fact, there is no section header
44016               table in a core file.
44017
44018               The process status information (including the contents of the general
44019               register set) and the floating point register set are stored in a
44020               segment of type PT_NOTE.  We handcraft a couple of extra bfd sections
44021               that allow standard bfd access to the general registers (.reg) and the
44022               floating point registers (.reg2).  */
44023
44024           bfd_cleanup
44025           elf_core_file_p (bfd *abfd)
44026
44027         Changing _bfd_elf_set_section_contents from:
44028
44029           pos = hdr->sh_offset + offset;
44030
44031         to:
44032
44033           pos = section->filepos + offset;
44034
44035         fixes it.  If we do that however, the tail end of
44036         _bfd_elf_set_section_contents ends up as a copy of
44037         _bfd_generic_set_section_contents, so just call the latter, thus
44038         eliminating some duplicate code.
44039
44040         New GDB testcase included, which exercises both patching an executable
44041         and patching a core file.  Patching an executable already works
44042         without this fix, because in that case BFD reads in the sections
44043         table.  Still, we had no testcase for that yet.  In fact, we have no
44044         "set write on" testcases at all, this is the first one.
44045
44046         Tested on x86-64 GNU/Linux, gdb, ld, binutils, and gas.
44047
44048         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18227
44049         Change-Id: I0f49f58b48aabab2e269f2959b8fd8a7fe36fdce
44050
44051 2022-05-13  Alan Modra  <amodra@gmail.com>
44052
44053         Import libiberty from gcc
44054
44055         sim: remove use of PTR
44056         PTR will soon disappear from ansidecl.h.  Remove uses in sim.  Where
44057         a PTR cast is used in assignment or function args to a void* I've
44058         simply removed the unnecessary (in C) cast rather than replacing with
44059         (void *).
44060
44061 2022-05-13  GDB Administrator  <gdbadmin@sourceware.org>
44062
44063         Automatic date update in version.in
44064
44065 2022-05-13  Alan Modra  <amodra@gmail.com>
44066
44067         gdb: remove use of PTR
44068         PTR will disappear from ansidecl.h and libiberty on the next import
44069         from gcc.  Remove current uses in gdb.
44070
44071 2022-05-12  Tom de Vries  <tdevries@suse.de>
44072
44073         [gdb/testsuite] Fix gdb.cp/break-f-std-string.cc with older gcc
44074         When running test-case gdb.cp/break-f-std-string.exp on openSUSE Leap 15.3
44075         with system gcc 7.5.0, I run into:
44076         ...
44077         (gdb) whatis /r std::string^M
44078         No symbol "string" in namespace "std".^M
44079         (gdb) FAIL: gdb.cp/break-f-std-string.exp: _GLIBCXX_USE_CXX11_ABI=1: \
44080           whatis /r std::string
44081         ...
44082         The same for gcc 8.2.1, but it passes with gcc 9.3.1.
44083
44084         At source level (as we can observe in the .ii file with -save-temps) we have
44085         indeed:
44086         ...
44087         namespace std {
44088           namespace __cxx11 {
44089             typedef basic_string<char> string;
44090           }
44091         }
44092         ...
44093         while with gcc 9.3.1, we have instead:
44094         ...
44095         namespace std {
44096           namespace __cxx11 {
44097             ...
44098           }
44099           typedef basic_string<char> string;
44100         }
44101         ...
44102         due to gcc commit 33b43b0d8cd ("Define std::string and related typedefs
44103         outside __cxx11 namespace").
44104
44105         Fix this by adding the missing typedef for gcc version 5 (the first version to
44106         have the dual abi) to 8 (the last version missing aforementioned gcc commit).
44107
44108         Tested on x86_64-linux, with:
44109         - system gcc 7.5.0
44110         - gcc 4.8.5, 8.2.1, 9.3.1, 10.3.0, 11.2.1
44111         - clang 8.0.1, 12.0.1
44112
44113 2022-05-12  Alan Modra  <amodra@gmail.com>
44114
44115         Fix an illegal memory access when creating DLLs.
44116                 PR 29006
44117                 * pe-dll.c (dll_name): Delete, replacing with..
44118                 (dll_filename): ..this, moved earlier in file.
44119                 (generate_edata): Delete parameters.  Don't set up dll_name here..
44120                 (pe_process_import_defs): ..instead set up dll_filename and
44121                 dll_symname here before returning.
44122                 (dll_symname_len): Delete write-only variable.
44123                 (pe_dll_generate_implib): Don't set up dll_symname here.
44124
44125 2022-05-12  Mark Wielaard  <mark@klomp.org>
44126
44127         gdb: Workaround stringop-overread warning in debuginfod-support.c on powerpc64
44128         Just like on s390x with g++ 11.2.1, ppc64le with g++ 11.3.1 produces a
44129         spurious warning for stringop-overread in debuginfod_is_enabled
44130         for url_view. Also suppress it on powerpc64.
44131
44132          gdb/ChangeLog:
44133
44134             * debuginfod-support.c (debuginfod_is_enabled): Use
44135               DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD on powerpc64.
44136
44137 2022-05-12  Luis Machado  <luis.machado@arm.com>
44138
44139         Make gdb.ada/float-bits.exp more generic
44140         There are assumptions in the test about the long double format
44141         being used. While the results are OK for i387 128-bit long doubles, it
44142         is not correct for IEEE quad 128-bit long doubles.
44143
44144         Also, depending on the target (64-bit/32-bit), long doubles may not
44145         be available at all. And it may be the case that the compiler for a 64-bit
44146         target doesn't support 128-bit long doubles, but GDB might still support it
44147         internally.
44148
44149         Lastly, not every long double format has invalid values. Some formats
44150         consider all values as valid floating point numbers.
44151
44152         These divergences cause the following FAIL's on aarch64/arm:
44153
44154         FAIL: gdb.ada/float-bits.exp: print val_long_double
44155         FAIL: gdb.ada/float-bits.exp: print val_long_double after assignment
44156
44157         With the above in mind, extend the test a little so it behaves well on
44158         different architectures and so it works with different long double
44159         formats.
44160
44161         Main changes:
44162
44163         - Use long double values appropriate for the long double format.
44164         - Test long double assignment to compiler-generated long
44165           double variables.
44166         - Test long double assignment to GDB internal variables.
44167
44168         Tested on x86_64 (16 PASS), i686 (16 PASS), aarch64 (12 PASS) and arm (9 PASS).
44169
44170 2022-05-12  Tom de Vries  <tdevries@suse.de>
44171
44172         [gdb/tdep] Improve gdb/syscalls/update-linux.sh
44173         Fix two things in update-linux.sh:
44174         - remove use of unnecessary tmp file
44175         - inline gen-header.py into update-linux.sh
44176
44177         Tested on x86_64-linux.
44178
44179 2022-05-12  Tom de Vries  <tdevries@suse.de>
44180
44181         [gdb/testsuite] Fix gdb.dwarf2/dw2-out-of-range-end-of-seq.exp on aarch64
44182         On aarch64-linux, with test-case gdb.dwarf2/dw2-out-of-range-end-of-seq.exp I
44183         run into:
44184         ...
44185         (gdb) run ^M
44186         Starting program: dw2-out-of-range-end-of-seq ^M
44187         ^M
44188         Program received signal SIGILL, Illegal instruction.^M
44189         main () at src/gdb/testsuite/gdb.dwarf2/main.c:1^M
44190         1       /* This testcase is part of GDB, the GNU debugger.^M
44191         (gdb) FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: runto: run to main
44192         ...
44193
44194         There are two problems here:
44195         - the test-case contains a hardcoded "DW_LNS_advance_pc 1" which causes the
44196           breakpoint pointing in the middle of an insn
44197         - the FAIL triggers on aarch64-linux, but not on x86_64-linux, because the
44198           test-case uses 'main_label' as the address of the first and only valid entry
44199           in the line table, and:
44200           - on aarch64-linux, there's no prologue, so main_label and main coincide,
44201             while
44202           - on x86_64-linux, there's a prologue, so main_label is different from main.
44203
44204         Fix these problems by:
44205         - eliminating the use of "DW_LNS_advance_pc 1", and using
44206           "DW_LNE_set_address $main_end" instead, and
44207         - eliminating the use of main_label, using "DW_LNE_set_address $main_start"
44208           instead.
44209
44210         Tested on both x86_64-linux and aarch64-linux.
44211
44212 2022-05-12  Alan Modra  <amodra@gmail.com>
44213
44214         cgen: increase buffer for hash_insn_list
44215         As was done for hash_insn_array in commit d3d1cc7b13b4.
44216
44217                 * cgen-dis.c (hash_insn_list): Increase size of buf.  Assert
44218                 size is large enough.
44219
44220 2022-05-12  Alan Modra  <amodra@gmail.com>
44221
44222         PR29142, segv in ar with empty archive and libdeps specified
44223                 PR 29142
44224                 * ar.c (main): Properly handle libdeps for zero file_count.
44225
44226 2022-05-12  Alan Modra  <amodra@gmail.com>
44227
44228         Re: IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
44229         The new test failed on s390-linux due to bfd_sprintf_vma trimming
44230         output to 32 bits for 32-bit targets.  The test was faulty anyway,
44231         expecting zero as the min end of the range is plainly wrong, but
44232         that's what you get if you cast min to int.
44233
44234                 * config/tc-s390.c (s390_insert_operand): Print range error using
44235                 PRId64.
44236                 * testsuite/gas/s390/zarch-z900-err.l: Correct expected output.
44237
44238 2022-05-12  GDB Administrator  <gdbadmin@sourceware.org>
44239
44240         Automatic date update in version.in
44241
44242 2022-05-11  Tom de Vries  <tdevries@suse.de>
44243
44244         [gdb/testsuite] Fix gdb.base/catch-syscall.exp with --with-expat=no
44245         When doing a gdb build with --with-expat=no, I run into:
44246         ...
44247         (gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
44248           continue to breakpoint: before pipe call
44249         catch syscall pipe^M
44250         Unknown syscall name 'pipe'.^M
44251         (gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
44252           catch syscall pipe
44253         catch syscall pipe2^M
44254         Unknown syscall name 'pipe2'.^M
44255         (gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
44256           catch syscall pipe2
44257         continue^M
44258         Continuing.^M
44259         [Detaching after vfork from child process 18538]^M
44260         [Inferior 1 (process 18537) exited normally]^M
44261         (gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: continue
44262         ...
44263
44264         This is a regression since recent commit 5463a15c18b ("[gdb/testsuite] Handle
44265         pipe2 syscall in gdb.base/catch-syscall.exp").
44266
44267         Fix this by using pipe/pipe2 syscall numbers instead.
44268
44269         Tested on x86_64-linux.
44270
44271 2022-05-11  Nick Clifton  <nickc@redhat.com>
44272
44273         nm: use -U as an alias for --defines-only, in line with llvm-nm
44274
44275 2022-05-11  Tom de Vries  <tdevries@suse.de>
44276
44277         [gdb/testsuite] Fix gdb.base/catch-syscall.exp without --enable-targets
44278         When doing a gdb build without --enable-targets, I run into:
44279         ...
44280         (gdb) UNSUPPORTED: gdb.base/catch-syscall.exp: multiple targets: \
44281           s390:31-bit vs s390:64-bit: set architecture s390:64-bit
44282         delete breakpoints^M
44283         (gdb) info breakpoints^M
44284         No breakpoints or watchpoints.^M
44285         (gdb) break -qualified main^M
44286         No symbol table is loaded.  Use the "file" command.^M
44287         Make breakpoint pending on future shared library load? (y or [n]) n^M
44288         (gdb) FAIL: gdb.base/catch-syscall.exp: gdb_breakpoint: set breakpoint at main
44289         ...
44290
44291         The problem is that due to recent commit e21d8399303 ("[gdb/testsuite] Remove
44292         target limits in gdb.base/catch-syscall.exp") "clean_restart $binfile" no
44293         longer is called at the end of test_catch_syscall_multi_arch.
44294
44295         Fix this by moving "clean_restart $binfile" back to
44296         test_catch_syscall_multi_arch.
44297
44298         Tested on x86_64-linux.
44299
44300 2022-05-11  Tom de Vries  <tdevries@suse.de>
44301
44302         [gdb/testsuite] Fix gdb.base/maint.exp on powerpc64le
44303         On powerpc64le-linux, I ran into:
44304         ...
44305         FAIL: gdb.base/maint.exp: maint print objfiles: symtabs
44306         ...
44307
44308         The problem is that:
44309         - the "Cooked index in use" line occurs twice in the gdb output:
44310           - once for exec maint, and
44311           - once for "Object file system-supplied DSO".
44312         - the matching of the second "Cooked index in use" also consumes
44313           the "Symtabs:" string, and consequently the corresponding
44314           clause does not trigger and $symtabs remains 0.
44315
44316         Fix this by limiting the output of the command to the exec.
44317
44318         Tested on x86_64-linux and powerpcle-linux.
44319
44320 2022-05-11  Tom de Vries  <tdevries@suse.de>
44321
44322         [gdb/tdep] Update syscalls/{ppc64,ppc}-linux.xml
44323         Regenerate syscalls/{ppc64,ppc}-linux.xml on a system with 5.14 kernel.
44324
44325 2022-05-11  Tom de Vries  <tdevries@suse.de>
44326
44327         [gdb/testsuite] Remove target limits in gdb.base/catch-syscall.exp
44328         In test-case gdb.base/catch-syscall.exp, proc test_catch_syscall_multi_arch we
44329         test for supported targets using istarget, like so:
44330         ...
44331             if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } {
44332                 ...
44333             } elseif { [istarget "powerpc-*-linux*"] \
44334                           || [istarget "powerpc64*-linux*"] } {
44335                 ...
44336         ...
44337         but the tests excercised there can all be executed if gdb is configured with
44338         --enable-targets=all.
44339
44340         Rewrite the proc to iterate over all cases, and check if the test is supported
44341         by trying "set arch $arch1" and "set arch $arch2".
44342
44343         Tested on x86_64-linux, with:
44344         - a gdb build with --enable-targets=all, and
44345         - a gdb build build with my usual --enable-targets setting (too long to
44346           include here) which means the sparc vs sparc:v9 case is unsupported.
44347
44348 2022-05-11  Tom de Vries  <tdevries@suse.de>
44349
44350         [gdb/record] Handle statx system call
44351         When running test-case gdb.reverse/fstatat-reverse.exp with target board
44352         unix/-m32 on openSUSE Tumbleweed, I run into:
44353         ...
44354         (gdb) PASS: gdb.reverse/fstatat-reverse.exp: set breakpoint at marker2
44355         continue^M
44356         Continuing.^M
44357         Process record and replay target doesn't support syscall number 383^M
44358         Process record: failed to record execution log.^M
44359         ^M
44360         Program stopped.^M
44361         0xf7fc5555 in __kernel_vsyscall ()^M
44362         (gdb) FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2
44363         ...
44364
44365         The problems is that while with native we're trying to record these syscalls
44366         (showing strace output):
44367         ...
44368         openat(AT_FDCWD, "/", O_RDONLY|O_PATH)  = 3
44369         newfstatat(3, ".", {st_mode=S_IFDIR|0755, st_size=146, ...}, 0) = 0
44370         ...
44371         with unix/-m32 we have instead:
44372         ...
44373         openat(AT_FDCWD, "/", O_RDONLY|O_PATH)  = 3
44374         statx(3, ".", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT, STATX_BASIC_STATS, \
44375           {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=STATX_ATTR_MOUNT_ROOT, \
44376           stx_mode=S_IFDIR|0755, stx_size=146, ...}) = 0
44377         ...
44378         and statx is not supported.
44379
44380         Fix this by adding support for recording syscall statx.
44381
44382         Tested on x86_64-linux.
44383
44384         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28461
44385
44386 2022-05-11  Alan Modra  <amodra@gmail.com>
44387
44388         opcodes cgen: remove use of PTR
44389         Note that opcodes is regenerated with cgen commit d1dd5fcc38e reverted,
44390         due to failure of bpf to compile with that patch applied.
44391
44392         .../opcodes/bpf-opc.c:57:11: error: conversion from ‘long unsigned int’ to ‘unsigned int’ changes value from ‘18446744073709486335’ to ‘4294902015’ [-Werror=overflow]
44393            57 |   64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
44394         plus other similar errors.
44395
44396         cpu/
44397                 * mep.opc (print_tpreg, print_spreg): Delete unnecessary
44398                 forward declarations.  Replace PTR with void *.
44399                 * mt.opc (print_dollarhex, print_pcrel): Delete forward decls.
44400         opcodes/
44401                 * bpf-desc.c, * bpf-dis.c, * cris-desc.c,
44402                 * epiphany-desc.c, * epiphany-dis.c,
44403                 * fr30-desc.c, * fr30-dis.c, * frv-desc.c, * frv-dis.c,
44404                 * ip2k-desc.c, * ip2k-dis.c, * iq2000-desc.c, * iq2000-dis.c,
44405                 * lm32-desc.c, * lm32-dis.c, * m32c-desc.c, * m32c-dis.c,
44406                 * m32r-desc.c, * m32r-dis.c, * mep-desc.c, * mep-dis.c,
44407                 * mt-desc.c, * mt-dis.c, * or1k-desc.c, * or1k-dis.c,
44408                 * xc16x-desc.c, * xc16x-dis.c,
44409                 * xstormy16-desc.c, * xstormy16-dis.c: Regenerate.
44410
44411 2022-05-11  GDB Administrator  <gdbadmin@sourceware.org>
44412
44413         Automatic date update in version.in
44414
44415 2022-05-10  Youling Tang  <tangyouling@loongson.cn>
44416
44417         gdb: mips: Fix large-frame.exp test case failure
44418         $ objdump -d outputs/gdb.base/large-frame/large-frame-O2
44419         0000000120000b20 <func>:
44420            120000b20:   67bdbff0        daddiu  sp,sp,-16400
44421            120000b24:   ffbc4000        sd      gp,16384(sp)
44422            120000b28:   3c1c0002        lui     gp,0x2
44423            120000b2c:   679c8210        daddiu  gp,gp,-32240
44424            120000b30:   0399e02d        daddu   gp,gp,t9
44425            120000b34:   df998058        ld      t9,-32680(gp)
44426            120000b38:   ffbf4008        sd      ra,16392(sp)
44427            120000b3c:   0411ffd8        bal     120000aa0 <blah>
44428         ...
44429
44430         The disassembly of the above func function shows that we may use
44431         instructions such as daddiu/daddu, so add "daddiu $gp,$gp,n",
44432         "daddu $gp,$gp,$t9" and "daddu $gp,$t9,$gp" to the mips32_scan_prologue
44433         function to fix the large-frame.exp test case.
44434
44435         Before applying the patch:
44436
44437          backtrace
44438          #0  blah (a=0xfffffee220) at .../gdb/testsuite/gdb.base/large-frame-1.c:24
44439          #1  0x0000000120000b44 in func ()
44440          Backtrace stopped: frame did not save the PC
44441          (gdb) FAIL: gdb.base/large-frame.exp: optimize=-O2: backtrace
44442
44443          # of expected passes            5
44444          # of unexpected failures        1
44445
44446         After applying the patch:
44447
44448          # of expected passes            6
44449
44450 2022-05-10  Tiezhu Yang  <yangtiezhu@loongson.cn>
44451
44452         gdb: LoongArch: Use GDB style to check readbuf and writebuf
44453         The GDB style is to write 'if (readbuf != nullptr)', and the same for
44454         writebuf.
44455
44456 2022-05-10  Tom Tromey  <tromey@adacore.com>
44457
44458         Fix --disable-threading build
44459         PR build/29110 points out that GDB fails to build on mingw when the
44460         "win32" thread model is in use.  It turns out that the Fedora cross
44461         tools using the "posix" thread model, which somehow manages to support
44462         std::future, whereas the win32 model does not.
44463
44464         While looking into this, I found that the configuring with
44465         --disable-threading will also cause a build failure.
44466
44467         This patch fixes this build by introducing a compatibility wrapper for
44468         std::future.
44469
44470         I am not able to test the win32 thread model build, but I'm going to
44471         ask the reporter to try this patch.
44472
44473         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29110
44474
44475 2022-05-10  Pedro Alves  <pedro@palves.net>
44476
44477         Fix "b f(std::string)" when current language is C
44478         If you try to set a breakpoint at a function such as "b
44479         f(std::string)", and the current language is C, the breakpoint fails
44480         to be set, like so:
44481
44482           (gdb) set language c
44483           break f(std::string)
44484           Function "f(std::string)" not defined.
44485           Make breakpoint pending on future shared library load? (y or [n]) n
44486           (gdb)
44487
44488         The problem is that the code in GDB that expands the std::string
44489         typedef hits this in c-typeprint.c:
44490
44491               /* If we have "typedef struct foo {. . .} bar;" do we want to
44492                  print it as "struct foo" or as "bar"?  Pick the latter for
44493                  C++, because C++ folk tend to expect things like "class5
44494                  *foo" rather than "struct class5 *foo".  We rather
44495                  arbitrarily choose to make language_minimal work in a C-like
44496                  way. */
44497               if (language == language_c || language == language_minimal)
44498                 {
44499                   if (type->code () == TYPE_CODE_UNION)
44500                     gdb_printf (stream, "union ");
44501                   else if (type->code () == TYPE_CODE_STRUCT)
44502                     {
44503                       if (type->is_declared_class ())
44504                         gdb_printf (stream, "class ");
44505                       else
44506                         gdb_printf (stream, "struct ");
44507                     }
44508                   else if (type->code () == TYPE_CODE_ENUM)
44509                     gdb_printf (stream, "enum ");
44510                 }
44511
44512         I.e., std::string is expanded to "class std::..." instead of just
44513         "std::...", and then the "f(class std::..." symbol doesn't exist.
44514
44515         Fix this by making cp-support.c:inspect_type print the expanded
44516         typedef type using the language of the symbol whose type we're
44517         expanding the typedefs for -- in the example in question, the
44518         "std::string" typedef symbol, which is a C++ symbol.
44519
44520         Use type_print_raw_options as it seems to me that in this scenario we
44521         always want raw types, to match the real symbol names.
44522
44523         Adjust the gdb.cp/break-f-std-string.exp testcase to try setting a
44524         breakpoint at "f(std::string)" in both C and C++.
44525
44526         Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
44527
44528 2022-05-10  Pedro Alves  <pedro@palves.net>
44529
44530         Always pass an explicit language down to c_type_print
44531         The next patch will want to do language->print_type(type, ...), to
44532         print a type in a given language, avoiding a dependency on the current
44533         language.  That doesn't work correctly currently, however, because
44534         most language implementations of language_defn::print_type call
44535         c_print_type without passing down the language.  There are two
44536         overloads of c_print_type, one that takes a language, and one that
44537         does not.  The one that does not uses the current language, defeating
44538         the point of calling language->print_type()...
44539
44540         This commit removes the c_print_type overload that does not take a
44541         language, and adjusts the codebase throughout to always pass down a
44542         language.  In most places, there's already an enum language handy.
44543         language_defn::print_type implementations naturally pass down
44544         this->la_language.  In a couple spots, like in ada-typeprint.c and
44545         rust-lang.c there's no enum language handy, but the code is written
44546         for a specific language, so we just hardcode the language.
44547
44548         In gnuv3_print_method_ptr, I wasn't sure whether we could hardcode C++
44549         here, and we don't have an enum language handy, so I made it use the
44550         current language, just like today.  Can always be improved later.
44551
44552         Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
44553
44554 2022-05-10  Pedro Alves  <pedro@palves.net>
44555
44556         Fix "b f(std::string)", always use DMGL_VERBOSE
44557         Currently, on any remotely modern GNU/Linux system,
44558         gdb.cp/no-dmgl-verbose.exp fails like so:
44559
44560           break 'f(std::string)'
44561           Function "f(std::string)" not defined.
44562           (gdb) FAIL: gdb.cp/no-dmgl-verbose.exp: gdb_breakpoint: set breakpoint at 'f(std::string)'
44563           break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
44564           Function "f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)" not defined.
44565           (gdb) PASS: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined
44566
44567         This testcase was added back in 2011, here:
44568
44569           [patch] Remove DMGL_VERBOSE
44570           https://sourceware.org/pipermail/gdb-patches/2011-June/083081.html
44571
44572         Back then, the testcase would pass cleanly.  It turns out that the
44573         reason it fails today is that the testcase is exercising something in
44574         GDB that only makes sense if the program is built for the pre-C++11
44575         libstc++ ABI.  Back then the C++11 ABI didn't exist yet, but nowadays,
44576         you need to compile with -D_GLIBCXX_USE_CXX11_ABI=0 to use the old
44577         ABI.  See "Dual ABI" in the libstdc++ manual, at
44578         <https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html>.
44579
44580         If we tweak the gdb.cp/no-dmgl-verbose.exp testcase to force the old
44581         ABI with -D_GLIBCXX_USE_CXX11_ABI=0, then it passes cleanly.
44582
44583         So why is it that setting a breakpoint at "f(std::string)" fails with
44584         modern ABI, but passes with old ABI?
44585
44586         This is where libiberty demangler's DMGL_VERBOSE option comes in.  The
44587         Itanium ABI mangling scheme has a shorthand form for std::string (and
44588         some other types).  See
44589         <https://itanium-cxx-abi.github.io/cxx-abi/abi.html>:
44590
44591           "In addition, the following catalog of abbreviations of the form "Sx" are used:
44592
44593              <substitution> ::= St # ::std::
44594              <substitution> ::= Sa # ::std::allocator
44595              <substitution> ::= Sb # ::std::basic_string
44596              <substitution> ::= Ss # ::std::basic_string < char,
44597                                                            ::std::char_traits<char>,
44598                                                            ::std::allocator<char> >
44599              <substitution> ::= Si # ::std::basic_istream<char,  std::char_traits<char> >
44600              <substitution> ::= So # ::std::basic_ostream<char,  std::char_traits<char> >
44601              <substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char> >
44602           "
44603
44604         When the libiberty demangler encounters such a abbreviation, by
44605         default, it expands it to the user-friendly typedef "std::string",
44606         "std::iostream", etc..  If OTOH DMGL_VERBOSE is specified, the
44607         abbreviation is expanded to the underlying, non-typedefed fullname
44608         "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"
44609         etc. as documented in the Itanium ABI, and pasted above.  You can see
44610         the standard abbreviations/substitutions in
44611         libiberty/cp-demangle.c:standard_subs.
44612
44613         Back before Jan's patch in 2011, there were parts of GDB that used
44614         DMGL_VERBOSE, and others that did not, leading to mismatches.  The
44615         solution back then was to stop using DMGL_VERBOSE throughout.
44616
44617         GDB has code in place to let users set a breakpoint at a function with
44618         typedefs in its parameters, like "b f(uint32_t)".  Demangled function
44619         names as they appear in the symbol tables almost (more on this is in a
44620         bit) never have typedefs in them, so when processing "b f(uint32_t)"
44621         GDB first replaces "uint32_t" for its underlying type, and then sets a
44622         breakpoint on the resulting prototype, in this case "f(unsigned int)".
44623
44624         Now, if DMGL_VERBOSE is _not_ used, then the demangler demangles the
44625         mangled name of a function such as "void f(std::string)" that was
44626         mangled using the standard abbreviations mentioned above really as:
44627
44628           "void f(std::string)".
44629
44630         For example, the mangled name of "void f(std::string)" if you compile
44631         with old pre-C++11 ABI is "_Z1fSs".  That uses the abbreviation "Ss",
44632         so if you demangle that without DMGL_VERBOSE, you get:
44633
44634           $ echo "_Z1fSs" | c++filt --no-verbose
44635           f(std::string)
44636
44637         while with DMGL_VERBOSE you'd get:
44638
44639           $ echo "_Z1fSs" | c++filt
44640           f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)
44641
44642         If, when the user sets a breakpoint at "f(std::string)", GDB would
44643         replace the std::string typedef for its underlying type using the same
44644         mechanism I mentioned for the "f(uint32_t)" example above, then GDB
44645         would really try to set a breakpoint at "f(std::basic_string<char,
44646         std::char_traits<char>, std::allocator<char> >)", and that would fail,
44647         as the function symbol GDB knows about for that function, given no
44648         DMGL_VERBOSE, is "f(std::string)".
44649
44650         For this reason, the code that expands typedefs in function parameter
44651         names has an exception for std::string (and other standard
44652         abbreviation types), such that "std::string" is never
44653         typedef-expanded.
44654
44655         And here lies the problem when you try to do "b f(std::string)" with a
44656         program compiled with the C++11 ABI.  In that case, std::string
44657         expands to a different underlying type, like so:
44658
44659           f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
44660
44661         and this symbol naturally mangles differently, as:
44662
44663           _Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
44664
44665         and then because this doesn't use the shorthand mangling abbreviation
44666         for "std::string" anymore, it always demangles as:
44667
44668           f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
44669
44670         Now, when using the C++11 ABI, and you set a breakpoint at
44671         "f(std::string)", GDB's typedefs-in-parameters expansion code hits the
44672         exception for "std::string" and doesn't expand it, so the breakpoint
44673         fails to be inserted, because the symbol that exists is really the
44674
44675           f(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
44676
44677         one, not "f(std::string)".
44678
44679         So to fix things for C++11 ABI, clearly we need to remove the
44680         "std::string" exception from the typedef-in-parameters expansion
44681         logic.  If we do just that, then "b f(std::string)" starts working
44682         with the C++11 ABI.
44683
44684         However, if we do _just_ that, and nothing else, then we break
44685         pre-C++11 ABI...
44686
44687         The solution is then to in addition switch GDB to always use
44688         DMGL_VERBOSE.  If we do this, then pre-C++11 ABI symbols works the
44689         same as C++11 ABI symbols overall -- the demangler expands the
44690         standard abbreviation for "std::string" as "std::basic_string<char,
44691         std::char_traits<char>, std::allocator<char> >" and letting GDB expand
44692         the "std::string" typedef (etc.) too is no longer a problem.
44693
44694         To avoid getting in the situation where some parts of GDB use
44695         DMGL_VERBOSE and others not, this patch adds wrappers around the
44696         demangler's entry points that GDB uses, and makes those force
44697         DMGL_VERBOSE.
44698
44699         The point of the gdb.cp/no-dmgl-verbose.exp testcase was to try to
44700         ensure that DMGL_VERBOSE doesn't creep back in:
44701
44702          gdb_test {break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'} \
44703                   {Function ".*" not defined\.} \
44704                   "DMGL_VERBOSE-demangled f(std::string) is not defined"
44705
44706         This obviously no longer makes sense to have, since we now depend on
44707         DMGL_VERBOSE.  So the patch replaces gdb.cp/no-dmgl-verbose.exp with a
44708         new gdb.cp/break-f-std-string.exp testcase whose purpose is to make
44709         sure that setting a breakpoint at "f(std::string)" works.  It
44710         exercises both pre-C++11 ABI and C++11 ABI.
44711
44712         Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
44713
44714 2022-05-10  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
44715
44716         gdb/testsuite: fix testsuite regressions for unix/-m32 board
44717         This commit fixes two regressions introduced by
44718         891e4190ba705373eec7b374209478215fff5401.
44719
44720         Reason for the failures was, that on a 32 bit machine the maximum
44721         array length as well as the maximum allocatable memory for arrays
44722         (in bytes) both seem to be limited by the maximum value of a 4
44723         byte (signed) Fortran integer.  This lead to compiler errors/unexpected
44724         behavior when compiling/running the test with the -m32 board.  This
44725         behavior is compiler dependent and can differ for different compiler
44726         implementations, but generally, it seemed like a good idea to simply
44727         avoid such situations.
44728
44729         The affected tests check for GDB's overflow behavior when using KIND
44730         parameters with GDB implemented Fortran intrinsic functions.  If these
44731         KIND parameters are too small to fit the actual intrinsic function's
44732         result, an overflow is expected.  This was done for 1, 2, and 4
44733         byte overflows.  The last one caused problems, as it tried to allocate
44734         arrays of length/byte-size bigger than the 4 byte signed integers which
44735         would then be used with the LBOUND/UBOUND/SIZE intrinsics.
44736
44737         The tests were adapted to only execute the 4 byte overflow tests when
44738         running on targets with 64 bit.  For this, the compiled tests evaluate the
44739         byte size of a C_NULL_PTR via C_SIZEOF, both defined in the ISO_C_BINDING
44740         module.  The ISO_C_BINDING constant C_NULL_PTR is a Fortran 2003, the
44741         C_SIZEOF a Fortran 2008 extension.  Both have been implemented in their
44742         respective compilers for while (e.g. C_SIZEOF is available since
44743         gfortran 4.6).  If this byte size evaluates to less than 8 we skip the
44744         4 byte overflow tests in the compiled tests of size.f90 and
44745         lbound-ubound.f90.  Similarly, in the lbound-ubound.exp testsfile we skip
44746         the 4 byte overflow tests if the procedure is_64_target evaluates to false.
44747
44748         In size.f90, additionally, the to-be-allocated amount of bytes did not
44749         fit into 4 byte signed integers for some of the arrays, as it was
44750         approximately 4 times the maximum size of a 4 byte signed integer.  We
44751         adapted the dimensions of the arrays in question as the meaningfulness
44752         of the test does not suffer from this.
44753
44754         With this patch both test run fine with the unix/-m32 board and
44755         gcc/gfortran (9.4) as well as the standard board file.
44756
44757         We also thought about completely removing the affected test from the
44758         testsuite.  We decided against this as the 32 bit identification comes
44759         with Fortran 2008 and removing tests would have decreased coverage.
44760
44761         A last change that happened with this patch was due to gfortran's and
44762         ifx's type resolution when assigning big constants to Fortran Integer*8
44763         variables.  Before the above changes this happened in a parameter
44764         statement.  Here, both compilers happily accepted a line like
44765
44766           integer*8, parameter :: var = 2147483647 + 5.
44767
44768         After this change the assignment is not done as a parameter
44769         anymore, as this triggered compile time overflow errors.  Instead,
44770         the assignment is done dynamically, depending on the kind of machine one
44771         is on.  Sadly, just changing this line to
44772
44773           integer*8 :: var
44774           var = 2147483647 + 5
44775
44776         does not work with ifx (or flang for that matter, they behave similarly
44777         here).  It will create an integer overflow in the addition as ifx deduces
44778         the type the additon is done in as Integer*4.  So var will actually
44779         contain the value -2147483644 after this.  The lines
44780
44781           integer*8 :: var
44782           var = 2147483652
44783
44784         on the other hand fail to compile with gfortran (9.4.0) as the compiler
44785         identifies an Integer overflow here.  Finally, to make this work with
44786         all three compilers an additional parameter has been introduced
44787
44788           integer*8, parameter :: helper = 2147483647
44789           integer*8 :: var
44790           var = helper + 5.
44791
44792         This works on all 3 compilers as expected.
44793
44794         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29053
44795         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29054
44796
44797 2022-05-10  Pedro Alves  <pedro@palves.net>
44798
44799         Move non-dependent gdb::observers::observable::visit_state outside template
44800         The other day, while looking at the symbols that end up in a GDB
44801         index, I noticed that the gdb::observers::observable::visit_state enum
44802         class appears a number of times:
44803
44804          $ grep VISIT gdb-index-symbol-names.txt
44805          gdb::observers::observable<bpstat*, int>::visit_state::NOT_VISITED
44806          gdb::observers::observable<bpstat*, int>::visit_state::VISITED
44807          gdb::observers::observable<bpstat*, int>::visit_state::VISITING
44808          gdb::observers::observable<breakpoint*>::visit_state::NOT_VISITED
44809          gdb::observers::observable<breakpoint*>::visit_state::VISITED
44810          gdb::observers::observable<breakpoint*>::visit_state::VISITING
44811          gdb::observers::observable<char const*, char const*>::visit_state::NOT_VISITED
44812          gdb::observers::observable<char const*, char const*>::visit_state::VISITED
44813          gdb::observers::observable<char const*, char const*>::visit_state::VISITING
44814          gdb::observers::observable<char const*>::visit_state::NOT_VISITED
44815          gdb::observers::observable<char const*>::visit_state::VISITED
44816          gdb::observers::observable<char const*>::visit_state::VISITING
44817          gdb::observers::observable<enum_flags<user_selected_what_flag> >::visit_state::NOT_VISITED
44818          gdb::observers::observable<enum_flags<user_selected_what_flag> >::visit_state::VISITED
44819          gdb::observers::observable<enum_flags<user_selected_what_flag> >::visit_state::VISITING
44820          gdb::observers::observable<frame_info*, int>::visit_state::NOT_VISITED
44821          gdb::observers::observable<frame_info*, int>::visit_state::VISITED
44822          gdb::observers::observable<frame_info*, int>::visit_state::VISITING
44823          gdb::observers::observable<gdbarch*>::visit_state::NOT_VISITED
44824          gdb::observers::observable<gdbarch*>::visit_state::VISITED
44825          gdb::observers::observable<gdbarch*>::visit_state::VISITING
44826          gdb::observers::observable<gdb_signal>::visit_state::NOT_VISITED
44827          gdb::observers::observable<gdb_signal>::visit_state::VISITED
44828          gdb::observers::observable<gdb_signal>::visit_state::VISITING
44829          [... snip ...]
44830
44831          $ grep VISIT gdb-index-symbol-names.txt | wc -l
44832          72
44833
44834         enum class visit_state is defined inside the class template
44835         observable, but it doesn't have to be, as it does not depend on the
44836         template parameters.  This commit moves it out, so that only one such
44837         type exists.  This reduces the size of a -O0 -g3 build for me by
44838         around 0.6%, like so:
44839
44840          $ du -b gdb.before gdb.after
44841          164685280       gdb.before
44842          163707424       gdb.fixed
44843
44844         and codesize by some 0.5%.
44845
44846         Change-Id: I405f4ef27b8358fdd22158245b145d849b45658e
44847
44848 2022-05-10  Nick Clifton  <nickc@redhat.com>
44849
44850         Fix compiling binutils/resbin.c with Clang version 14
44851
44852 2022-05-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
44853
44854         gprofng: include percentages in default metrics list
44855         gprofng/ChangeLog
44856         2022-05-09  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
44857
44858                 * src/gprofng.rc: Include percentages in default metrics list.
44859
44860 2022-05-10  Alan Modra  <amodra@gmail.com>
44861
44862         gprof: remove use of PTR
44863                 * basic_blocks.c: Replace uses of PTR with void * throughout.
44864                 * cg_arcs.c: Likewise.
44865                 * cg_print.c: Likewise.
44866                 * hist.c: Likewise.
44867                 * source.h: Likewise.
44868                 * symtab.c: Likewise.
44869
44870         gas: remove use of PTR
44871                 * config/obj-evax.c (evax_symbol_new_hook): Don't cast to PTR.
44872
44873 2022-05-10  Alan Modra  <amodra@gmail.com>
44874
44875         opcodes: remove use of PTR
44876         The non-cgen parts of opcodes.
44877
44878                 * cr16-dis.c (print_arg): Replace PTR with void *.
44879                 * crx-dis.c (print_arg): Likewise.
44880                 * rl78-dis.c (print_insn_rl78_common): Don't use PTR cast.
44881                 * rx-dis.c (print_insn_rx): Likewise.
44882                 * visium-dis.c (print_insn_visium): Likewise.
44883                 * z8k-dis.c (print_insn_z8k): Likewise.
44884
44885 2022-05-10  Alan Modra  <amodra@gmail.com>
44886
44887         bfd: remove use of PTR
44888                 * coffcode.h (coff_write_object_contents): Don't cast to PTR.
44889                 * elf32-csky.c (csky_elf_link_hash_traverse): Remove use of PTR
44890                 and PARAMS.
44891                 (csky_allocate_dynrelocs): Don't use PTR cast.
44892                 * elf32-nios2.c (adjust_dynrelocs, allocate_dynrelocs): Replace
44893                 PTR with void *.
44894                 * elf32-visium.c (visium_elf_howto_parity_reloc): Likewise.
44895                 * elfxx-ia64.c (ia64_elf_reloc): Likewise.
44896                 * plugin.c (bfd_plugin_bfd_print_private_bfd_data): Likewise.
44897
44898         include: remove use of PTR
44899                 * hashtab.h (HTAB_EMPTY_ENTRY): Replace PTR with void *.
44900                 (HTAB_DELETED_ENTRY): Likewise.
44901
44902 2022-05-10  GDB Administrator  <gdbadmin@sourceware.org>
44903
44904         Automatic date update in version.in
44905
44906 2022-05-09  Ilya Leoshkevich  <iii@linux.ibm.com>
44907
44908         IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
44909         as does not accept instructions like brasl %r0,.-0x100000000, because
44910         of two problems with the generic overflow check:
44911
44912         1. PCRel32 operands are signed, but are treated as unsigned.
44913
44914         2. The allowed range for these operands is [-(1 << 32), (1 << 32) - 1],
44915            and not [-(1 << 31), (1 << 31) - 1].
44916
44917         Fix both by disabling the generic overflow check - it's not needed,
44918         because s390_insert_operand () performs its own.
44919
44920         gas/
44921
44922                 * config/tc-s390.c (md_gather_operands): Set fx_no_overflow.
44923                 * testsuite/gas/s390/s390.exp: Add zarch-z900-err.
44924                 * testsuite/gas/s390/esa-z900.d: New test.
44925                 * testsuite/gas/s390/esa-z900.s: New test.
44926                 * testsuite/gas/s390/zarch-z900-err.l: New test.
44927                 * testsuite/gas/s390/zarch-z900-err.s: New test.
44928
44929 2022-05-09  Andrew Burgess  <aburgess@redhat.com>
44930
44931         gdb/testsuite: fix occasional failure in gdb.mi/mi-multi-commands.exp
44932         In bug PR gdb/29036, another failure was reported for the test
44933         gdb.mi/mi-multi-commands.exp.  This test sends two commands to GDB as
44934         a single write, and then checks that both commands are executed.
44935
44936         The problem that was encountered here is that the output of the first
44937         command, which looks like this:
44938
44939           ^done,value="\"FIRST COMMAND\""
44940
44941         Is actually produced in parts, first the '^done' is printed, then the
44942         ',value="\"FIRST COMMAND\"" is printed.
44943
44944         What was happening is that some characters from the second command
44945         were being echoed after the '^done' had been printed, but before the
44946         value part had been printed.  To avoid this issue I've relaxed the
44947         pattern that checks for the first command a little.  With this fix in
44948         place the occasional failure in this test is no longer showing up.
44949
44950         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29036
44951
44952 2022-05-09  Tom de Vries  <tdevries@suse.de>
44953
44954         [gdb] Update syscalls/{amd64,i386}-linux.xml
44955         - Add a script syscalls/gen-header.py, based on syscalls/arm-linux.py.
44956         - Add a script syscalls/update-linux.sh (alongside update-freebsd.sh and
44957           update-netbsd.sh).
44958         - Use syscalls/update-linux.sh to update syscalls/{amd64,i386}-linux.xml.in.
44959         - Regenerate syscalls/{amd64,i386}-linux.xml using syscalls/Makefile.
44960
44961         In gdb/syscalls/i386-linux.xml.in, updating has the following notable effect:
44962         ...
44963         -  <syscall name="madvise1" number="220"/>
44964         -  <syscall name="getdents64" number="221"/>
44965         -  <syscall name="fcntl64" number="222"/>
44966         +  <syscall name="getdents64" number="220"/>
44967         +  <syscall name="fcntl64" number="221"/>
44968         ...
44969
44970         I've verified in ./arch/x86/entry/syscalls/syscall_32.tbl that the numbers are
44971         correct.
44972
44973         Tested on x86_64-linux.
44974
44975 2022-05-09  Tom de Vries  <tdevries@suse.de>
44976
44977         [gdb] Add gdb/syscalls/Makefile
44978         Add a Makefile in gdb/syscalls that can be used to translate
44979         gdb/syscalls/*.xml.in into gdb/syscalls/*.xml.
44980
44981         Calling make reveals that bfin-linux.xml is missing, so add it.
44982
44983         Tested on x86_64-linux.
44984
44985 2022-05-09  Tiezhu Yang  <yangtiezhu@loongson.cn>
44986
44987         gdb: LoongArch: Implement the return_value gdbarch method
44988         When execute the following command on LoongArch:
44989
44990           make check-gdb TESTS="gdb.base/async.exp"
44991
44992         there exist the following failed testcases:
44993
44994           FAIL: gdb.base/async.exp: finish& (timeout)
44995           FAIL: gdb.base/async.exp: jump& (timeout)
44996           FAIL: gdb.base/async.exp: until& (timeout)
44997           FAIL: gdb.base/async.exp: set exec-done-display off (GDB internal error)
44998
44999         we can see the following messages in gdb/testsuite/gdb.log:
45000
45001           finish&
45002           Run till exit from #0  foo () at /home/loongson/gdb.git/gdb/testsuite/gdb.base/async.c:9
45003           (gdb) /home/loongson/gdb.git/gdb/gdbarch.c:2646: internal-error: gdbarch_return_value: Assertion `gdbarch->return_value != NULL' failed.
45004           A problem internal to GDB has been detected,
45005           further debugging may prove unreliable.
45006
45007         In order to fix the above failed testcases, implement the return_value
45008         gdbarch method on LoongArch.
45009
45010 2022-05-09  Andrew Burgess  <aburgess@redhat.com>
45011
45012         gdb: fix for gdb.base/eof-exit.exp test failures
45013         This fix relates to PR gdb/29032, this makes the test more stable by
45014         ensuring that the Ctrl-D is only sent once the prompt has been
45015         displayed.  This issue was also discussed on the mailing list here:
45016
45017           https://sourceware.org/pipermail/gdb-patches/2022-April/187670.html
45018
45019         The problem identified in the bug report is that sometimes the Ctrl-D
45020         (that the test sends to GDB) arrives while GDB is processing a
45021         command.  When this happens the Ctrl-D is handled differently than if
45022         the Ctrl-D is sent while GDB is waiting for input at a prompt.
45023
45024         The original intent of the test was that the Ctrl-D be sent while GDB
45025         was waiting at a prompt, and that is the case the occurs most often,
45026         but, when the Ctrl-D arrives during command processing, then GDB will
45027         ignore the Ctrl-D, and the test will fail.
45028
45029         This commit ensures the Ctrl-D is always sent while GDB is waiting at
45030         a prompt, which makes this test stable.
45031
45032         But, that still leaves an open question, what should happen when the
45033         Ctrl-D arrives while GDB is processing a command?  This commit doesn't
45034         attempt to answer that question, which is while bug PR gdb/29032 will
45035         not be closed once this commit is merged.
45036
45037         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29032
45038
45039 2022-05-09  Tom de Vries  <tdevries@suse.de>
45040
45041         [gdb] Make btrace maintainer entry more clear
45042         Do:
45043         ...
45044         -record btrace          <name>       <email>
45045         +record
45046         +  btrace               <name>       <email>
45047         ...
45048         to clarify that the listed maintainer is only maintainer of the btrace part of
45049         record.
45050
45051 2022-05-09  Martin Liska  <mliska@suse.cz>
45052
45053         ansidecl.h: sync from GCC
45054         include/ChangeLog:
45055
45056                 * ansidecl.h: Sync from GCC.
45057
45058 2022-05-09  Tom de Vries  <tdevries@suse.de>
45059
45060         [gdb/tdep] Support catch syscall pipe2 for i386
45061         With test-case gdb.base/catch-syscall.exp and target board unix/-m32, we run
45062         into:
45063         ...
45064         (gdb) catch syscall pipe2^M
45065         Unknown syscall name 'pipe2'.^M
45066         (gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: catch syscall pipe2
45067         ...
45068
45069         Fix this by:
45070         - adding a pipe2 entry in gdb/syscalls/i386-linux.xml.in, and
45071         - regenerating gdb/syscalls/i386-linux.xml using
45072           "xsltproc --output i386-linux.xml apply-defaults.xsl i386-linux.xml.in".
45073
45074         Tested on x86_64-linux with native and unix/-m32.
45075
45076         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
45077
45078 2022-05-09  Tom de Vries  <tdevries@suse.de>
45079
45080         [gdb/testsuite] Handle pipe2 syscall in gdb.base/catch-syscall.exp
45081         When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumbleweed,
45082         I run into:
45083         ...
45084         (gdb) continue^M
45085         Continuing.^M
45086         ^M
45087         Catchpoint 2 (returned from syscall pipe2), in pipe () from /lib64/libc.so.6^M
45088         (gdb) FAIL: gdb.base/catch-syscall.exp: without arguments: \
45089           syscall pipe has returned
45090         ...
45091
45092         The current glibc on Tumbleweed is 2.35, which contains commit
45093         "linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2
45094         is used instead of syscall pipe.
45095
45096         Fix this by detecting whether syscall pipe or pipe2 is used before running the
45097         tests.
45098
45099         Tested on x86_64-linux, specifically on:
45100         - openSUSE Tumbleweed (with glibc 2.35), and
45101         - openSUSE Leap 15.3 (with glibc 2.31).
45102
45103         On openSUSE Tumbleweed + target board unix/-m32, this exposes:
45104         ...
45105         (gdb) catch syscall pipe2^M
45106         Unknown syscall name 'pipe2'.^M
45107         ...
45108         which will be fixed in a folllow-up patch.
45109
45110         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
45111
45112 2022-05-09  Tom de Vries  <tdevries@suse.de>
45113
45114         [gdb/tdep] Handle pipe2 syscall for amd64
45115         When running test-case gdb.reverse/pipe-reverse.exp on openSUSE Tumbleweed,
45116         I run into:
45117         ...
45118         (gdb) continue^M
45119         Continuing.^M
45120         Process record and replay target doesn't support syscall number 293^M
45121         Process record: failed to record execution log.^M
45122         ^M
45123         Program stopped.^M
45124         0x00007ffff7daabdb in pipe () from /lib64/libc.so.6^M
45125         (gdb) FAIL: gdb.reverse/pipe-reverse.exp: continue to breakpoint: marker2
45126         ...
45127
45128         The current glibc on Tumbleweed is 2.35, which contains commit
45129         "linux: Implement pipe in terms of __NR_pipe2", and consequently syscall pipe2
45130         is used in stead of syscall pipe.
45131
45132         There is already support added for syscall pipe2 for aarch64 (which only has
45133         syscall pipe2, not syscall pipe), so enable the same for amd64, by:
45134         - adding amd64_sys_pipe2 in enum amd64_syscall
45135         - translating amd64_sys_pipe2 to gdb_sys_pipe2 in amd64_canonicalize_syscall
45136
45137         Tested on x86_64-linux, specifically on:
45138         - openSUSE Tumbleweed (with glibc 2.35), and
45139         - openSUSE Leap 15.3 (with glibc 2.31).
45140
45141         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29056
45142
45143 2022-05-09  GDB Administrator  <gdbadmin@sourceware.org>
45144
45145         Automatic date update in version.in
45146
45147 2022-05-08  Tom de Vries  <tdevries@suse.de>
45148
45149         [gdb/testsuite] Fix gdb.tui/scroll.exp with read1
45150         When running test-case gdb.tui/scroll.exp, I get:
45151         ...
45152         Box Dump (80 x 8) @ (0, 0):
45153             0 $17 = 16
45154             1 (gdb) p 17
45155             2 $18 = 17
45156             3 (gdb) p 18
45157             4 $19 = 18
45158             5 (gdb) p 19
45159             6 $20 = 19
45160             7 (gdb)
45161         PASS: gdb.tui/scroll.exp: check cmd window in flip layout
45162         ...
45163         but with check-read1 I get instead:
45164         ...
45165         Box Dump (80 x 8) @ (0, 0):
45166             0 (gdb) 15
45167             1 (gdb) p 16
45168             2 $17 = 16
45169             3 (gdb) p 17
45170             4 $18 = 17
45171             5 (gdb) p 18
45172             6 $19 = 18
45173             7 (gdb) p 19
45174         FAIL: gdb.tui/scroll.exp: check cmd window in flip layout
45175         ...
45176
45177         The "p 19" command is handled by Term::command, which sends the command and then
45178         does Term::wait_for "^$gdb_prompt [string_to_regexp $cmd]", which:
45179         - matches the line with "(gdb) p 19", and
45180         - tries to match the following prompt "(gdb) "
45181
45182         The problem is that scrolling results in reissuing output before the "(gdb) p
45183         19", and the second matching triggers on that.  Consequently, wait_for no
45184         longer translates gdb output into screen actions, and the screen does not
45185         reflect the result of "p 19".
45186
45187         Fix this by using a new proc wait_for_region_contents, which in contrast to
45188         wait_for can handle a multi-line regexp.
45189
45190         Tested on x86_64-linux with make targets check and check-read1.
45191
45192 2022-05-08  Tom de Vries  <tdevries@suse.de>
45193
45194         [gdb/testsuite] Fix gdb.cp/casts.exp with -m32
45195         When running test-case gdb.cp/casts.exp with target board unix/-m32, I run
45196         into:
45197         ...
45198         (gdb) print (unsigned long long) &gd == gd_value^M
45199         $31 = false^M
45200         (gdb) FAIL: gdb.cp/casts.exp: print (unsigned long long) &gd == gd_value
45201         ...
45202
45203         With some additional printing, we can see in more detail why the comparison
45204         fails:
45205         ...
45206         (gdb) print /x &gd^M
45207         $31 = 0xffffc5c8^M
45208         (gdb) PASS: gdb.cp/casts.exp: print /x &gd
45209         print /x (unsigned long long)&gd^M
45210         $32 = 0xffffc5c8^M
45211         (gdb) PASS: gdb.cp/casts.exp: print /x (unsigned long long)&gd
45212         print /x gd_value^M
45213         $33 = 0xffffffffffffc5c8^M
45214         (gdb) PASS: gdb.cp/casts.exp: print /x gd_value
45215         print (unsigned long long) &gd == gd_value^M
45216         $34 = false^M
45217         (gdb) FAIL: gdb.cp/casts.exp: print (unsigned long long) &gd == gd_value
45218         ...
45219
45220         The gd_value is set by this assignment:
45221         ...
45222           unsigned long long gd_value = (unsigned long long) &gd;
45223         ...
45224
45225         The problem here is directly casting from a pointer to a non-pointer-sized
45226         integer.
45227
45228         Fix this by adding an intermediate cast to std::uintptr_t.
45229
45230         Tested on x86_64-linux with native and target board unix/-m32.
45231
45232 2022-05-08  Tom de Vries  <tdevries@suse.de>
45233
45234         [gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync.exp
45235         In OBS, on aarch64-linux, with a gdb 11.1 based package, I run into:
45236         ...
45237         (gdb) builtin_spawn -pty^M
45238         new-ui mi /dev/pts/5^M
45239         New UI allocated^M
45240         (gdb) =thread-group-added,id="i1"^M
45241         (gdb) ERROR: MI channel failed
45242         warning: Error detected on fd 11^M
45243         thread 1.1^M
45244         Unknown thread 1.1.^M
45245         (gdb) UNRESOLVED: gdb.mi/user-selected-context-sync.exp: mode=non-stop: \
45246           test_cli_inferior: reset selection to thread 1.1
45247         ...
45248         with many more UNRESOLVED following.
45249
45250         The ERROR is a common problem, filed as
45251         https://sourceware.org/bugzilla/show_bug.cgi?id=28561 .
45252
45253         But the many UNRESOLVEDs are due to not checking whether the setup as done in
45254         the test_setup function succeeds or not.
45255
45256         Fix this by:
45257         - making test_setup return an error upon failure
45258         - handling test_setup error at the call site
45259         - adding a "setup done" pass/fail to be turned into an unresolved
45260           in case of error during setup.
45261
45262         Tested on x86_64-linux, by manually triggering the error in
45263         mi_gdb_start_separate_mi_tty.
45264
45265 2022-05-08  Tom de Vries  <tdevries@suse.de>
45266
45267         [gdb/testsuite] Fix gdb.ada/catch_ex_std.exp with remote-gdbserver-on-localhost
45268         When running test-case gdb.ada/catch_ex_std.exp on target board
45269         remote-gdbserver-on-localhost, I run into:
45270         ...
45271         (gdb) continue^M
45272         Continuing.^M
45273         [Inferior 1 (process 15656) exited with code 0177]^M
45274         (gdb) FAIL: gdb.ada/catch_ex_std.exp: runto: run to main
45275         Remote debugging from host ::1, port 49780^M
45276         /home/vries/foo: error while loading shared libraries: libsome_package.so: \
45277           cannot open shared object file: No such file or directory^M
45278         ...
45279
45280         Fix this by adding the usual shared-library + remote-target helper
45281         "gdb_load_shlib $sofile".
45282
45283         Tested on x86_64-linux with native and target board
45284         remote-gdbserver-on-localhost.
45285
45286 2022-05-08  Tom de Vries  <tdevries@suse.de>
45287
45288         [gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with check-readmore
45289         When running test-case gdb.threads/fork-plus-threads.exp with check-readmore,
45290         I run into:
45291         ...
45292         [Inferior 11 (process 7029) exited normally]^M
45293         [Inferior 1 (process 6956) exited normally]^M
45294         FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
45295           inferior 1 exited (timeout)
45296         ...
45297
45298         The problem is that the regexp consuming the "Inferior exited normally"
45299         messages:
45300         - consumes more than one of those messages at a time, but
45301         - counts only one of those messages.
45302
45303         Fix this by adopting a line-by-line approach, which deals with those messages
45304         one at a time.
45305
45306         Tested on x86_64-linux with native, check-read1 and check-readmore.
45307
45308 2022-05-08  GDB Administrator  <gdbadmin@sourceware.org>
45309
45310         Automatic date update in version.in
45311
45312 2022-05-07  Tom Tromey  <tom@tromey.com>
45313
45314         Fix "catch syscall"
45315         Simon pointed out that some recent patches of mine broke "catch
45316         syscall".  Apparently I forgot to finish the conversion of this code
45317         when removing init_catchpoint.  This patch completes the conversion
45318         and fixes the bug.
45319
45320 2022-05-07  Andrew Burgess  <aburgess@redhat.com>
45321
45322         gdb/readline: fix extra 'quit' message problem
45323         After these two commits:
45324
45325           commit 4fb7bc4b147fd30b781ea2dad533956d0362295a
45326           Date:   Mon Mar 7 13:49:21 2022 +0000
45327
45328               readline: back-port changes needed to properly detect EOF
45329
45330           commit 91395d97d905c31ac38513e4aaedecb3b25e818f
45331           Date:   Tue Feb 15 17:28:03 2022 +0000
45332
45333               gdb: handle bracketed-paste-mode and EOF correctly
45334
45335         It was observed that, if a previous command is selected at the
45336         readline prompt using the up arrow key, then when the command is
45337         accepted (by pressing return) an unexpected 'quit' message will be
45338         printed by GDB.  Here's an example session:
45339
45340           (gdb) p 123
45341           $1 = 123
45342           (gdb) p 123
45343           quit
45344           $2 = 123
45345           (gdb)
45346
45347         In this session the second 'p 123' was entered not by typing 'p 123',
45348         but by pressing the up arrow key to select the previous command.  It
45349         is important that the up arrow key is used, typing Ctrl-p will not
45350         trigger the bug.
45351
45352         The problem here appears to be readline's EOF detection when handling
45353         multi-character input sequences.  I have raised this issue on the
45354         readline mailing list here:
45355
45356           https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00012.html
45357
45358         a solution has been proposed here:
45359
45360           https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00016.html
45361
45362         This patch includes a test for this issue as well as a back-port of
45363         (the important bits of) readline commit:
45364
45365           commit 2ef9cec8c48ab1ae3a16b1874a49bd1f58eaaca1
45366           Date:   Wed May 4 11:18:04 2022 -0400
45367
45368               fix for setting RL_STATE_EOF in callback mode
45369
45370         That commit also includes some updates to the readline documentation
45371         and tests that I have not included in this commit.
45372
45373         With this commit in place the unexpected 'quit' messages are resolved.
45374
45375 2022-05-07  Alan Modra  <amodra@gmail.com>
45376
45377         Fix multiple ubsan warnings in i386-dis.c
45378         Commit 39fb369834a3 "opcodes: Make i386-dis.c thread-safe" introduced
45379         a number of casts to bfd_signed_vma that cause undefined behaviour
45380         with a 32-bit libbfd.  Revert those changes.
45381
45382                 * i386-dis.c (OP_E_memory): Do not cast disp to bfd_signed_vma
45383                 for negation.
45384                 (get32, get32s): Don't use bfd_signed_vma here.
45385
45386 2022-05-07  Alan Modra  <amodra@gmail.com>
45387
45388         Re: Fix new linker testsuite failures due to rwx segment test problems
45389         Fix it some more.
45390
45391         bfd/
45392                 * elfnn-loongarch.c: Remove commented out elf_backend_* defines.
45393         ld/
45394                 * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Match
45395                 arm*.  Delete loongarch.
45396
45397 2022-05-07  GDB Administrator  <gdbadmin@sourceware.org>
45398
45399         Automatic date update in version.in
45400
45401 2022-05-07  Carl Love  <cel@us.ibm.com>
45402
45403         PowerPC fix for gdb.server/sysroot.exp
45404         On PowerPC, the stop in the printf function is of the form:
45405
45406         Breakpoint 2, 0x00007ffff7c6ab08 in printf@@GLIBC_2.17 () from /lib64/libc.so.6
45407
45408         On other architectures the output looks like:
45409
45410         Breakpoint 2, 0x0000007fb7ea29ac in printf () from /lib/aarch64-linux-gnu/libc.so.6
45411
45412         The following patch modifies the printf test by matchine any character
45413         starting immediately after the printf.  The test now works for PowerPC
45414         output as well as the output from other architectures.
45415
45416         The test has been run on a Power 10 system and and Intel x86_64 system.
45417
45418 2022-05-06  Nick Clifton  <nickc@redhat.com>
45419
45420         Fix new linker testsuite failures due to rwx segment test problems
45421
45422 2022-05-06  Tom Tromey  <tom@tromey.com>
45423
45424         Introduce catchpoint class
45425         This introduces a catchpoint class that is used as the base class for
45426         all catchpoints.  init_catchpoint is rewritten to be a constructor
45427         instead.
45428
45429         This changes the hierarchy a little -- some catchpoints now inherit
45430         from base_breakpoint whereas previously they did not.  This isn't a
45431         problem, as long as re_set is redefined in catchpoint.
45432
45433 2022-05-06  Tom Tromey  <tom@tromey.com>
45434
45435         Add initializers to tracepoint
45436         This adds some initializers to tracepoint.  I think right now these
45437         may not be needed, due to obscure rules about zero initialization.
45438         However, this will change in the next patch, and anyway it is clearer
45439         to be explicit.
45440
45441         Remove init_raw_breakpoint_without_location
45442         This removes init_raw_breakpoint_without_location, replacing it with a
45443         constructor on 'breakpoint' itself.  The subclasses and callers are
45444         all updated.
45445
45446         Disable copying for breakpoint
45447         It seems to me that breakpoint should use DISABLE_COPY_AND_ASSIGN.
45448         This patch does this.
45449
45450         Add constructor to exception_catchpoint
45451         This adds a constructor to exception_catchpoint and simplifies the
45452         caller.
45453
45454         Add constructor to syscall_catchpoint
45455         This adds a constructor to syscall_catchpoint and simplifies the
45456         caller.
45457
45458         Add constructor to signal_catchpoint
45459         This adds a constructor to signal_catchpoint and simplifies the
45460         caller.
45461
45462         Add constructor to solib_catchpoint
45463         This adds a constructor to solib_catchpoint and simplifies the caller.
45464
45465         Add constructor to fork_catchpoint
45466         This adds a constructor to fork_catchpoint and simplifies the caller.
45467
45468         Remove unnecessary line from catch_exec_command_1
45469         catch_exec_command_1 clears the new catchpoint's "exec_pathname"
45470         field, but this is already done by virtue of calling "new".
45471
45472         Constify breakpoint::print_recreate
45473         This constifies breakpoint::print_recreate.
45474
45475         Constify breakpoint::print_mention
45476         This constifies breakpoint::print_mention.
45477
45478         Constify breakpoint::print_one
45479         This constifies breakpoint::print_one.
45480
45481         Constify breakpoint::print_it
45482         This constifies breakpoint::print_it.  Doing this pointed out some
45483         code in ada-lang.c that can be simplified a little as well.
45484
45485         Move works_in_software_mode to watchpoint
45486         works_in_software_mode is only useful for watchpoints.  This patch
45487         moves it from breakpoint to watchpoint, and changes it to return bool.
45488
45489         Boolify breakpoint::explains_signal
45490         This changes breakpoint::explains_signal to return bool.
45491
45492         Remove breakpoint::ops
45493         The breakpoint::ops field is set but never used.  This removes it.
45494
45495         Change print_recreate_thread to a method
45496         This changes print_recreate_thread to be a method on breakpoint.  This
45497         function is only used as a helper by print_recreate methods, so I
45498         thought this transformation made sense.
45499
45500 2022-05-06  Carl Love  <cel@us.ibm.com>
45501
45502         PowerPC: bp-permanent.exp, kill-after-signal fix
45503         The break point after the stepi on Intel is the entry point of the user
45504         signal handler function test_signal_handler.  The code at the break point
45505         looks like:
45506
45507              0x<hex address> <test_signal_handler>: endbr64
45508
45509         On PowerPC with a Linux 5.9 kernel or latter, the address where gdb stops
45510         after the stepi is in the vdso code inserted by the kernel.  The code at the
45511         breakpoint looks like:
45512
45513           0x<hex address>  <__kernel_start_sigtramp_rt64>:      bctrl
45514
45515         This is different from other architectures.  As discussed below, recent
45516         kernel changes involving the vdso for PowerPC have been made changes to the
45517         signal handler code flow.  PowerPC is now stopping in function
45518         __kernel_start_sigtramp_rt64.  PowerPC now requires an additional stepi to
45519         reach the user signal handler unlike other architectures.
45520
45521         The bp-permanent.exp and kill-after-signal tests run fine on PowerPC with an
45522         kernel that is older than Linux 5.9.
45523
45524         The PowerPC 64 signal handler was updated by the Linux kernel 5.9-rc1:
45525
45526             commit id: 0138ba5783ae0dcc799ad401a1e8ac8333790df9
45527             powerpc/64/signal: Balance return predictor stack in signal trampoline
45528
45529         An additional change to the PowerPC 64 signal handler was made in Linux
45530         kernel version 5.11-rc7 :
45531
45532              commit id: 24321ac668e452a4942598533d267805f291fdc9
45533              powerpc/64/signal: Fix regression in __kernel_sigtramp_rt64() semantics
45534
45535         The first kernel change, puts code into the user space signal handler (in
45536         the vdso) as a performance optimization to prevent the call/return stack
45537         from getting out of balance.  The patch ensures that the entire
45538         user/kernel/vdso cycle is balanced with the addition of the "brctl"
45539         instruction.
45540
45541         The second patch, fixes the semantics of __kernel_sigtramp_rt64().  A new
45542         symbol is introduced to serve as the jump target from the kernel to the
45543         trampoline which now consists of two parts.
45544
45545         The above changes for PowerPC signal handler, causes gdb to stop in the
45546         kernel code not the user signal handler as expected.  The kernel dispatches
45547         to the vdso code which in turn calls into the signal handler.  PowerPC is
45548         special in that the kernel is using a vdso instruction (bctrl) to enter the
45549         signal handler.
45550
45551         I do not have access to a system with the first patch but not the second.  I did
45552         test on Power 9 with the Linux 5.15.0-27-generic kernel.  Both tests fail on
45553         this Power 9 system.  The two tests also fail on Power 10 with the Linux
45554         5.14.0-70.9.1.el9_0.ppc64le kernel.
45555
45556         The following patch fixes the issue by checking if gdb stopped at "signal
45557         handler called".  If gdb stopped there, the tests verifies gdb is in the kernel
45558         function __kernel_start_sigtramp_rt64 then does an additional stepi to reach the
45559         user signal handler.  With the patch below, the tests run without errors on both
45560         the Power 9 and Power 10 systems with out any failures.
45561
45562 2022-05-06  Alan Modra  <amodra@gmail.com>
45563
45564         bfd targmatch.h makefile rule
45565         I hit this just now with a make -j build after touching config.bfd.
45566         mv: cannot stat 'targmatch.new': No such file or directory
45567         make[2]: *** [Makefile:2336: targmatch.h] Error 1
45568         make[2]: *** Waiting for unfinished jobs....
45569
45570         Fix that by not removing the target of the rule, a practice that seems
45571         likely to cause parallel running of the rule recipe.  The bug goes
45572         back to 1997, the initial c0734708814c commit.
45573
45574                 * Makefile.am (targmatch.h): rm the temp file, not targmatch.h.
45575                 * Makefile.in: Regenerate.
45576
45577 2022-05-06  Tom de Vries  <tdevries@suse.de>
45578
45579         [gdb/testsuite] Fix gdb.dwarf2/locexpr-data-member-location.exp with nopie
45580         When running test-case gdb.dwarf2/locexpr-data-member-location.exp with
45581         target board unix/-fno-PIE/-no-pie/-m32 I run into:
45582         ...
45583         (gdb) step^M
45584         26        return 0;^M
45585         (gdb) FAIL: gdb.dwarf2/locexpr-data-member-location.exp: step into foo
45586         ...
45587
45588         The problem is that the test-case tries to mimic some gdb_compile_shlib
45589         behaviour using:
45590         ...
45591         set flags {additional_flags=-fpic debug}
45592         get_func_info foo $flags
45593         ...
45594         but this doesn't work with the target board setting, because we end up doing:
45595         ...
45596         gcc locexpr-data-member-location-lib.c -fpic -g -lm -fno-PIE -no-pie -m32 \
45597           -o func_addr23029.x
45598         ...
45599         while gdb_compile_shlib properly filters out the -fno-PIE -no-pie.
45600
45601         Consequently, the address for foo determined by get_func_info doesn't match
45602         the actual address of foo.
45603
45604         Fix this by printing the address of foo using the result of gdb_compile_shlib.
45605
45606 2022-05-06  GDB Administrator  <gdbadmin@sourceware.org>
45607
45608         Automatic date update in version.in
45609
45610 2022-05-05  Simon Marchi  <simon.marchi@polymtl.ca>
45611
45612         gdb: use gdb::function_view for gdbarch_iterate_over_objfiles_in_search_order callback
45613         A rather straightforward patch to change an instance of callback +
45614         void pointer to gdb::function_view, allowing pasing lambdas that
45615         capture, and eliminating the need for the untyped pointer.
45616
45617         Change-Id: I73ed644e7849945265a2c763f79f5456695b0037
45618
45619 2022-05-05  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
45620
45621         gprofng: use $host instead $target
45622         By mistake, $target was used instead of $host to configure the gprogng build.
45623
45624         gprofng/ChangeLog
45625         2022-04-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
45626
45627                 PR gprofng/29113
45628                 PR gprofng/29116
45629                 * configure.ac: Use $host instead $target.
45630                 * libcollector/configure.ac: Likewise.
45631                 * configure: Rebuild.
45632                 * libcollector/configure: Rebuild.
45633
45634 2022-05-05  Simon Marchi  <simon.marchi@efficios.com>
45635
45636         gdb: make regcache's cooked_write_test selftest work with native-extended-gdbserver board
45637         Running
45638
45639             $ make check TESTS="gdb.gdb/unittest.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"
45640
45641         I get some failures:
45642
45643             Running selftest regcache::cooked_write_test::i386.^M
45644             Self test failed: target already pushed^M
45645             Running selftest regcache::cooked_write_test::i386:intel.^M
45646             Self test failed: target already pushed^M
45647             Running selftest regcache::cooked_write_test::i386:x64-32.^M
45648             Self test failed: target already pushed^M
45649             Running selftest regcache::cooked_write_test::i386:x64-32:intel.^M
45650             Self test failed: target already pushed^M
45651             Running selftest regcache::cooked_write_test::i386:x86-64.^M
45652             Self test failed: target already pushed^M
45653             Running selftest regcache::cooked_write_test::i386:x86-64:intel.^M
45654             Self test failed: target already pushed^M
45655             Running selftest regcache::cooked_write_test::i8086.^M
45656             Self test failed: target already pushed^M
45657
45658         This is because the native-extended-gdbserver automatically connects GDB
45659         to a GDBserver on startup, and therefore pushes a remote target on the
45660         initial inferior.  cooked_write_test is currently written in a way that
45661         errors out if the current inferior has a process_stratum_target pushed.
45662
45663         Rewrite it to use scoped_mock_context, so it doesn't depend on the
45664         current inferior (the current one upon entering the function).
45665
45666         Change-Id: I0357f989eacbdecc4bf88b043754451b476052ad
45667
45668 2022-05-05  Luis Machado  <luis.machado@arm.com>
45669
45670         Move TILE-Gx files to TARGET64_LIBOPCODES_CFILES
45671         TILE-Gx is a 64-bit core, so we should include those files in the
45672         TARGET64_LIBOPCODES_CFILES as opposed to TARGET32_LIBOPCODES_CFILES.
45673
45674         Don't define ARCH_cris for BFD64
45675         I believe it is a mistake to define ARCH_cris when BFD64 is defined. It is
45676         a 32-bit architecture, so should be placed outside of the BFD64 block.
45677
45678 2022-05-05  Xi Ruoyao  <xry111@mengyan1223.wang>
45679
45680         loongarch: Don't check ABI flags if no code section
45681         Various packages (glib and gtk4 for example) produces data-only objects
45682         using `ld -r -b binary` or `objcopy`, with no elf header flags set.  But
45683         these files also have no code sections, so they should be compatible
45684         with all ABIs.
45685
45686         bfd/
45687                 * elfnn-loongarch.c (elfNN_loongarch_merge_private_bfd_data):
45688                 Skip ABI checks if the input has no code sections.
45689
45690         Reported-by: Wu Xiaotian <yetist@gmail.com>
45691         Suggested-by: Wang Xuerui <i@xen0n.name>
45692
45693 2022-05-05  Andreas Krebbel  <krebbel@linux.ibm.com>
45694
45695         IBM zSystems: mgrk, mg first operand requires register pair
45696         opcodes/
45697
45698                 * s390-opc.c (INSTR_RRF_R0RER): New instruction type.
45699                 (MASK_RRF_R0RER): Define mask for new instruction type.
45700                 * s390-opc.txt: Use RRF_R0RER for mgrk and RXY_RERRD for mg.
45701
45702 2022-05-05  H.J. Lu  <hjl.tools@gmail.com>
45703
45704         bfd: Check NULL pointer before setting ref_real
45705                 PR ld/29086
45706                 * linker.c (bfd_wrapped_link_hash_lookup): Check NULL pointer
45707                 before setting ref_real.
45708
45709 2022-05-05  GDB Administrator  <gdbadmin@sourceware.org>
45710
45711         Automatic date update in version.in
45712
45713 2022-05-05  H.J. Lu  <hjl.tools@gmail.com>
45714
45715         LTO: Handle __real_SYM reference in IR
45716         When an IR symbol SYM is referenced in IR via __real_SYM, its resolution
45717         should be LDPR_PREVAILING_DEF, not PREVAILING_DEF_IRONLY, since LTO
45718         doesn't know that __real_SYM should be resolved by SYM.
45719
45720         bfd/
45721
45722                 PR ld/29086
45723                 * linker.c (bfd_wrapped_link_hash_lookup): Mark SYM is referenced
45724                 via __real_SYM.
45725
45726         include/
45727
45728                 PR ld/29086
45729                 * bfdlink.h (bfd_link_hash_entry): Add ref_real.
45730
45731         ld/
45732
45733                 PR ld/29086
45734                 * plugin.c (get_symbols): Resolve SYM definition to
45735                 LDPR_PREVAILING_DEF for __real_SYM reference.
45736                 * testsuite/ld-plugin/lto.exp: Run PR ld/29086 test.
45737                 * testsuite/ld-plugin/pr29086.c: New file.
45738
45739 2022-05-04  Alan Modra  <amodra@gmail.com>
45740
45741         cris bfd config
45742         cris support will be built into a 32-bit bfd if using --enable-targets=all
45743         on a 32-bit host, so we may as well make targmatch.h include cris.
45744
45745                 * config.bfd (cris): Remove #idef BFD64.
45746
45747 2022-05-04  Alan Modra  <amodra@gmail.com>
45748
45749         PowerPC64 check_relocs
45750         Tidy the dynamic reloc handling code in check_relocs, removing
45751         leftover comments and code from when check_relocs was called as each
45752         object file was read in.
45753
45754                 * elf64-ppc.c (ppc64_elf_check_relocs): Tidy dynamic reloc
45755                 handling code.
45756                 (dec_dynrel_count): Do the same here.
45757
45758 2022-05-04  Tom Tromey  <tromey@adacore.com>
45759
45760         Fix crash when creating index from index
45761         My patches yesterday to unify the DWARF index base classes had a bug
45762         -- namely, I did the wholesale dynamic_cast-to-static_cast too hastily
45763         and introduced a crash.  This can be seen by trying to add an index to
45764         a file that has an index, or by running a test like gdb-index-cxx.exp
45765         using the cc-with-debug-names.exp target board.
45766
45767         This patch fixes the crash by introducing a new virtual method and
45768         removing some of the static casts.
45769
45770 2022-05-04  Luis Machado  <luis.machado@arm.com>
45771
45772         Fix build failure for aarch64 gdbserver
45773         We're missing an argument.
45774
45775 2022-05-04  Mark Wielaard  <mark@klomp.org>
45776
45777         gdb: Workaround stringop-overread warning in debuginfod-support.c on s390x
45778         For some reason g++ 11.2.1 on s390x produces a spurious warning for
45779         stringop-overread in debuginfod_is_enabled for url_view. Add a new
45780         DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD macro to suppress this warning.
45781
45782         include/ChangeLog:
45783
45784                 * diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD): New
45785                 macro.
45786
45787         gdb/ChangeLog:
45788
45789                 * debuginfod-support.c (debuginfod_is_enabled): Use
45790                 DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD on s390x.
45791
45792 2022-05-04  Pedro Alves  <pedro@palves.net>
45793
45794         Fix GDBserver Aarch64 Linux regression
45795         Luis noticed that the recent changes to gdbserver to make it track
45796         process and threads independently regressed a few gdb.multi/*.exp
45797         tests for aarch64-linux.
45798
45799         We started seeing the following internal error for
45800         gdb.multi/multi-target-continue.exp for example:
45801
45802          Starting program: binutils-gdb/gdb/testsuite/outputs/gdb.multi/multi-target-continue/multi-target-continue ^M
45803          Error in re-setting breakpoint 2: Remote connection closed^M
45804          ../../../repos/binutils-gdb/gdb/thread.c:85: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed.^M
45805          A problem internal to GDB has been detected,^M
45806          further debugging may prove unreliable.
45807
45808         A backtrace looks like:
45809
45810          #0  thread_regcache_data (thread=thread@entry=0x0) at ../../../repos/binutils-gdb/gdbserver/inferiors.cc:120
45811          #1  0x0000aaaaaaabf0e8 in get_thread_regcache (thread=0x0, fetch=fetch@entry=0) at ../../../repos/binutils-gdb/gdbserver/regcache.cc:31
45812          #2  0x0000aaaaaaad785c in is_64bit_tdesc () at ../../../repos/binutils-gdb/gdbserver/linux-aarch64-low.cc:194
45813          #3  0x0000aaaaaaad8a48 in aarch64_target::sw_breakpoint_from_kind (this=<optimized out>, kind=4, size=0xffffffffef04) at ../../../repos/binutils-gdb/gdbserver/linux-aarch64-low.cc:3226
45814          #4  0x0000aaaaaaabe220 in bp_size (bp=0xaaaaaab6f3d0) at ../../../repos/binutils-gdb/gdbserver/mem-break.cc:226
45815          #5  check_mem_read (mem_addr=187649984471104, buf=buf@entry=0xaaaaaab625d0 "\006", mem_len=mem_len@entry=56) at ../../../repos/binutils-gdb/gdbserver/mem-break.cc:1862
45816          #6  0x0000aaaaaaacc660 in read_inferior_memory (memaddr=<optimized out>, myaddr=0xaaaaaab625d0 "\006", len=56) at ../../../repos/binutils-gdb/gdbserver/target.cc:93
45817          #7  0x0000aaaaaaac3d9c in gdb_read_memory (len=56, myaddr=0xaaaaaab625d0 "\006", memaddr=187649984471104) at ../../../repos/binutils-gdb/gdbserver/server.cc:1071
45818          #8  gdb_read_memory (memaddr=187649984471104, myaddr=0xaaaaaab625d0 "\006", len=56) at ../../../repos/binutils-gdb/gdbserver/server.cc:1048
45819          #9  0x0000aaaaaaac82a4 in process_serial_event () at ../../../repos/binutils-gdb/gdbserver/server.cc:4307
45820          #10 handle_serial_event (err=<optimized out>, client_data=<optimized out>) at ../../../repos/binutils-gdb/gdbserver/server.cc:4520
45821          #11 0x0000aaaaaaafbcd0 in gdb_wait_for_event (block=block@entry=1) at ../../../repos/binutils-gdb/gdbsupport/event-loop.cc:700
45822          #12 0x0000aaaaaaafc0b0 in gdb_wait_for_event (block=1) at ../../../repos/binutils-gdb/gdbsupport/event-loop.cc:596
45823          #13 gdb_do_one_event () at ../../../repos/binutils-gdb/gdbsupport/event-loop.cc:237
45824          #14 0x0000aaaaaaacacb0 in start_event_loop () at ../../../repos/binutils-gdb/gdbserver/server.cc:3518
45825          #15 captured_main (argc=4, argv=<optimized out>) at ../../../repos/binutils-gdb/gdbserver/server.cc:3998
45826          #16 0x0000aaaaaaab66dc in main (argc=<optimized out>, argv=<optimized out>) at ../../../repos/binutils-gdb/gdbserver/server.cc:4084
45827
45828         This sequence of functions is invoked due to a series of conditions:
45829
45830          1 - The probe-based breakpoint mechanism failed (for some reason) so ...
45831
45832          2 - ... gdbserver has to know what type of architecture it is dealing
45833              with so it can pick the right breakpoint kind, so it wants to
45834              check if we have a 64-bit target.
45835
45836          3 - To determine the size of a register, we currently fetch the
45837              current thread's register cache, and the current thread pointer
45838              is now nullptr.
45839
45840         In #3, the current thread is nullptr because gdb_read_memory clears it
45841         on purpose, via set_desired_process, exactly to expose code relying on
45842         the current thread when it shouldn't.  It was always possible to end
45843         up in this situation (when the current thread exits), but it was
45844         harder to reproduce before.
45845
45846         This commit fixes it by tweaking is_64bit_tdesc to look at the current
45847         process's tdesc instead of the current thread's tdesc.
45848
45849         Note that the thread's tdesc is itself filled from the process's
45850         tdesc, so this should be equivalent:
45851
45852          struct regcache *
45853          get_thread_regcache (struct thread_info *thread, int fetch)
45854          {
45855            struct regcache *regcache;
45856
45857            regcache = thread_regcache_data (thread);
45858
45859          ...
45860            if (regcache == NULL)
45861              {
45862                struct process_info *proc = get_thread_process (thread);
45863
45864                gdb_assert (proc->tdesc != NULL);
45865
45866                regcache = new_register_cache (proc->tdesc);
45867                set_thread_regcache_data (thread, regcache);
45868              }
45869          ...
45870
45871         Change-Id: Ibc809d7345e70a2f058b522bdc5cdbdca97e2cdc
45872
45873 2022-05-04  Simon Marchi  <simon.marchi@efficios.com>
45874
45875         gdb/remote: send qSymbol to all inferiors on startup
45876         start_remote_1 calls remote_check_symbols after things are set up to
45877         give the remote side a chance to look up symbols.  One call to
45878         remote_check_symbols sets the "general thread", if needed, and sends one
45879         qSymbol packet.  However, a remote target could have more than one
45880         process on initial connection, and this would send a qSymbol for only
45881         one of these processes.
45882
45883         Change it to iterate on all the target's inferiors and send a qSymbol
45884         packet for each one.
45885
45886         I tested this by changing gdbserver to spawn two processes on startup:
45887
45888             diff --git a/gdbserver/server.cc b/gdbserver/server.cc
45889             index 33c42714e72..9b682e9f85f 100644
45890             --- a/gdbserver/server.cc
45891             +++ b/gdbserver/server.cc
45892             @@ -3939,6 +3939,7 @@ captured_main (int argc, char *argv[])
45893
45894                    /* Wait till we are at first instruction in program.  */
45895                    target_create_inferior (program_path.get (), program_args);
45896             +      target_create_inferior (program_path.get (), program_args);
45897
45898                    /* We are now (hopefully) stopped at the first instruction of
45899                      the target process.  This assumes that the target process was
45900
45901         Instead of hacking GDBserver, it should also be possible to test this by
45902         starting manually two inferiors on an "extended-remote" connection,
45903         disconnecting from GDBserver (with the disconnect command), and
45904         re-connecting.
45905
45906         I was able to see qSymbol being sent for each inferior:
45907
45908               [remote] Sending packet: $Hgp828dc.828dc#1f
45909               [remote] Packet received: OK
45910               [remote] Sending packet: $qSymbol::#5b
45911               [remote] Packet received: qSymbol:6764625f6167656e745f6764625f74705f686561705f627566666572
45912               [remote] Sending packet: $qSymbol::6764625f6167656e745f6764625f74705f686561705f627566666572#1e
45913               [remote] Packet received: qSymbol:6e70746c5f76657273696f6e
45914               [remote] Sending packet: $qSymbol::6e70746c5f76657273696f6e#4d
45915               [remote] Packet received: OK
45916               [remote] Sending packet: $Hgp828dd.828dd#21
45917               [remote] Packet received: OK
45918               [remote] Sending packet: $qSymbol::#5b
45919               [remote] Packet received: qSymbol:6764625f6167656e745f6764625f74705f686561705f627566666572
45920               [remote] Sending packet: $qSymbol::6764625f6167656e745f6764625f74705f686561705f627566666572#1e
45921               [remote] Packet received: qSymbol:6e70746c5f76657273696f6e
45922               [remote] Sending packet: $qSymbol::6e70746c5f76657273696f6e#4d
45923               [remote] Packet received: OK
45924
45925         Note that there would probably be more work to be done to fully support
45926         this scenario, more things that need to be done for each discovered
45927         inferior instead of just for one.
45928
45929         Change-Id: I21c4ecf6367391e2e389b560f0b4bd906cf6472f
45930
45931 2022-05-04  Simon Marchi  <simon.marchi@polymtl.ca>
45932
45933         gdb/remote: iterate on pspace inferiors in remote_new_objfile
45934         Commit 152a17495663 ("gdb: prune inferiors at end of
45935         fetch_inferior_event, fix intermittent failure of
45936         gdb.threads/fork-plus-threads.exp") broke some tests with the
45937         native-gdbserver board, such as:
45938
45939             (gdb) PASS: gdb.base/step-over-syscall.exp: detach-on-fork=off: follow-fork=child: break cond on target : vfork: break marker
45940             continue^M
45941             Continuing.^M
45942             terminate called after throwing an instance of 'gdb_exception_error'^M
45943
45944         I can manually reproduce the issue by running (just the commands that
45945         the test does as a one liner):
45946
45947             $ ./gdb -q --data-directory=data-directory \
45948                   testsuite/outputs/gdb.base/step-over-syscall/step-over-vfork \
45949                   -ex "tar rem | ../gdbserver/gdbserver - testsuite/outputs/gdb.base/step-over-syscall/step-over-vfork" \
45950                   -ex "b main" \
45951                   -ex c \
45952                   -ex "d 1" \
45953                   -ex "set displaced-stepping off" \
45954                   -ex "b *0x7ffff7d7ac5a if main == 0" \
45955                   -ex "set detach-on-fork off" \
45956                   -ex "set follow-fork-mode child" \
45957                   -ex c \
45958                   -ex "inferior 1" \
45959                   -ex "b marker" \
45960                   -ex c
45961
45962         ... where 0x7ffff7d7ac5a is the exact address of the vfork syscall
45963         (which can be found by looking at gdb.log).
45964
45965         The important part of the above is that a vfork syscall creates inferior
45966         2, then inferior 2 executes until exit, then we switch back to inferior
45967         1 and try to resume it.
45968
45969         The uncaught exception happens here:
45970
45971             #4  0x00005596969d81a9 in error (fmt=0x559692da9e40 "Cannot execute this command while the target is running.\nUse the \"interrupt\" command to stop the target\nand then try again.")
45972                 at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:43
45973             #5  0x0000559695af6f66 in remote_target::putpkt_binary (this=0x617000038080, buf=0x559692da4380 "qSymbol::", cnt=9) at /home/simark/src/binutils-gdb/gdb/remote.c:9560
45974             #6  0x0000559695af6aaf in remote_target::putpkt (this=0x617000038080, buf=0x559692da4380 "qSymbol::") at /home/simark/src/binutils-gdb/gdb/remote.c:9518
45975             #7  0x0000559695ab50dc in remote_target::remote_check_symbols (this=0x617000038080) at /home/simark/src/binutils-gdb/gdb/remote.c:5141
45976             #8  0x0000559695b3cccf in remote_new_objfile (objfile=0x0) at /home/simark/src/binutils-gdb/gdb/remote.c:14600
45977             #9  0x0000559693bc52a9 in std::__invoke_impl<void, void (*&)(objfile*), objfile*> (__f=@0x61b0000167f8: 0x559695b3cb1d <remote_new_objfile(objfile*)>) at /usr/include/c++/11.2.0/bits/invoke.h:61
45978             #10 0x0000559693bb2848 in std::__invoke_r<void, void (*&)(objfile*), objfile*> (__fn=@0x61b0000167f8: 0x559695b3cb1d <remote_new_objfile(objfile*)>) at /usr/include/c++/11.2.0/bits/invoke.h:111
45979             #11 0x0000559693b8dddf in std::_Function_handler<void (objfile*), void (*)(objfile*)>::_M_invoke(std::_Any_data const&, objfile*&&) (__functor=..., __args#0=@0x7ffe0bae0590: 0x0) at /usr/include/c++/11.2.0/bits/std_function.h:291
45980             #12 0x00005596956374b2 in std::function<void (objfile*)>::operator()(objfile*) const (this=0x61b0000167f8, __args#0=0x0) at /usr/include/c++/11.2.0/bits/std_function.h:560
45981             #13 0x0000559695633c64 in gdb::observers::observable<objfile*>::notify (this=0x55969ef5c480 <gdb::observers::new_objfile>, args#0=0x0) at /home/simark/src/binutils-gdb/gdb/../gdbsupport/observable.h:150
45982             #14 0x0000559695df6cc2 in clear_symtab_users (add_flags=...) at /home/simark/src/binutils-gdb/gdb/symfile.c:2873
45983             #15 0x000055969574c263 in program_space::~program_space (this=0x6120000c8a40, __in_chrg=<optimized out>) at /home/simark/src/binutils-gdb/gdb/progspace.c:154
45984             #16 0x0000559694fc086b in delete_inferior (inf=0x61700003bf80) at /home/simark/src/binutils-gdb/gdb/inferior.c:205
45985             #17 0x0000559694fc341f in prune_inferiors () at /home/simark/src/binutils-gdb/gdb/inferior.c:390
45986             #18 0x0000559695017ada in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4293
45987             #19 0x0000559694f629e6 in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:41
45988             #20 0x0000559695b3b0e3 in remote_async_serial_handler (scb=0x6250001ef100, context=0x6170000380a8) at /home/simark/src/binutils-gdb/gdb/remote.c:14466
45989             #21 0x0000559695c59eb7 in run_async_handler_and_reschedule (scb=0x6250001ef100) at /home/simark/src/binutils-gdb/gdb/ser-base.c:138
45990             #22 0x0000559695c5a42a in fd_event (error=0, context=0x6250001ef100) at /home/simark/src/binutils-gdb/gdb/ser-base.c:189
45991             #23 0x00005596969d9ebf in handle_file_event (file_ptr=0x60700005af40, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:574
45992             #24 0x00005596969da7fa in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:700
45993             #25 0x00005596969d8539 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
45994
45995         If I enable "set debug infrun" just before the last continue, we see:
45996
45997             (gdb) continue
45998             Continuing.
45999             [infrun] clear_proceed_status_thread: 965604.965604.0
46000             [infrun] proceed: enter
46001               [infrun] proceed: addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT
46002               [infrun] scoped_disable_commit_resumed: reason=proceeding
46003               [infrun] start_step_over: enter
46004                 [infrun] start_step_over: stealing global queue of threads to step, length = 0
46005                 [infrun] operator(): step-over queue now empty
46006               [infrun] start_step_over: exit
46007               [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [965604.965604.0] at 0x7ffff7d7ac5c
46008               [infrun] do_target_resume: resume_ptid=965604.0.0, step=0, sig=GDB_SIGNAL_0
46009               [infrun] prepare_to_wait: prepare_to_wait
46010               [infrun] reset: reason=proceeding
46011               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote
46012               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote
46013             [infrun] proceed: exit
46014             [infrun] fetch_inferior_event: enter
46015               [infrun] scoped_disable_commit_resumed: reason=handling event
46016               [infrun] do_target_wait: Found 2 inferiors, starting at #1
46017               [infrun] random_pending_event_thread: None found.
46018               [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
46019               [infrun] print_target_wait_results:   965604.965604.0 [Thread 965604.965604],
46020               [infrun] print_target_wait_results:   status->kind = VFORK_DONE
46021               [infrun] handle_inferior_event: status->kind = VFORK_DONE
46022               [infrun] context_switch: Switching context from 0.0.0 to 965604.965604.0
46023               [infrun] handle_vfork_done: not waiting for a vfork-done event
46024               [infrun] start_step_over: enter
46025                 [infrun] start_step_over: stealing global queue of threads to step, length = 0
46026                 [infrun] operator(): step-over queue now empty
46027               [infrun] start_step_over: exit
46028               [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [965604.965604.0] at 0x7ffff7d7ac5c
46029               [infrun] do_target_resume: resume_ptid=965604.0.0, step=0, sig=GDB_SIGNAL_0
46030               [infrun] prepare_to_wait: prepare_to_wait
46031               [infrun] reset: reason=handling event
46032               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote
46033               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote
46034             terminate called after throwing an instance of 'gdb_exception_error'
46035
46036         What happens is:
46037
46038          - After doing the "continue" on inferior 1, the remote target gives us
46039            a VFORK_DONE event.  The core ignores it and resumes inferior 1.
46040          - Since prune_inferiors is now called after each handled event, in
46041            fetch_inferior_event, it is called after we handled that VFORK_DONE
46042            event and resumed inferior 1.
46043          - Inferior 2 is pruned, which (see backtrace above) causes its program
46044            space to be deleted, which clears the symtabs for that program space,
46045            which calls the new_objfile observable and remote_new_objfile
46046            observer (with a nullptr objfile, to indicate that the previously
46047            loaded symbols have been discarded), which calls
46048            remote_check_symbols.
46049
46050         remote_check_symbols is the function that sends the qSymbol packet, to
46051         let the remote side ask for symbol addresses.  The problem is that the
46052         remote target is working in all-stop / sync mode and is currently
46053         resumed.  It has sent a vCont packet to resume the target and is waiting
46054         for a stop reply.  It can't send any packets in the mean time.  That
46055         causes the exception to be thrown.
46056
46057         This wasn't a problem before, when prune_inferiors was called in
46058         normal_stop, because it was always called at a time the target was not
46059         resumed.
46060
46061         An important observation here is that the new_objfile observable is
46062         invoked for a change in inferior 2's program space (inferior 2's program
46063         space is the current program space).  Inferior 2 isn't bound to any
46064         process on the remote side (it has exited, that's why it's being
46065         pruned).  It doesn't make sense to try to send a qSymbol packet for a
46066         process that doesn't exist on the remote side.  remote_check_symbols
46067         actually attempts to avoid that:
46068
46069            /* The remote side has no concept of inferiors that aren't running
46070              yet, it only knows about running processes.  If we're connected
46071              but our current inferior is not running, we should not invite the
46072              remote target to request symbol lookups related to its
46073              (unrelated) current process.  */
46074           if (!target_has_execution ())
46075             return;
46076
46077         The problem here is that while inferior 2's program space is the current
46078         program space, inferior 1 is the current inferior.  So the check above
46079         passes, since inferior has execution.  We therefore try to send a
46080         qSymbol packet for inferior 1 in reaction to a change in inferior 2's
46081         program space, that's wrong.
46082
46083         This exposes a conceptual flaw in remote_new_objfile.  The "new_objfile"
46084         event concerns a specific program space, which can concern multiple
46085         inferiors, as inferiors can share a program space.  We shouldn't
46086         consider the current inferior at all, but instead all inferiors bound to
46087         the affected program space.  Especially since the current inferior can
46088         be unrelated to the current program space at that point.
46089
46090         To be clear, we are in this state because ~program_space sets itself as
46091         the current program space, but there is no more inferior having that
46092         program space to switch to, inferior 2 has already been unlinked.
46093
46094         To fix this, make remote_new_objfile iterate on all inferiors bound to
46095         the affected program space.  Remove the target_has_execution check from
46096         remote_check_symbols, replace it with an assert.  All callers must
46097         ensure that the current inferior has execution before calling it.
46098
46099         Change-Id: Ica643145bcc03115248290fd310cadab8ec8371c
46100
46101 2022-05-04  Jan Beulich  <jbeulich@suse.com>
46102
46103         Dwarf: rename yet another instance of "index"
46104         As before, on sufficiently old glibc this conflicts with a global
46105         identifier in the library headers. While there also zap the unusual
46106         padding by blanks.
46107
46108 2022-05-04  Martin Liska  <mliska@suse.cz>
46109
46110         LTO plugin: sync header file with GCC
46111         include/ChangeLog:
46112
46113                 * plugin-api.h (enum ld_plugin_tag): Sync with GCC.
46114
46115 2022-05-04  Alan Modra  <amodra@gmail.com>
46116
46117         PowerPC32 treatment of absolute symbols
46118         As already done for PowerPC64, fix dynamic relocs for absolute symbols.
46119         The patch also tidies the dynamic reloc handling code in check_relocs,
46120         removing leftover comments and code from when check_relocs was called
46121         as each object file was read in.
46122
46123         bfd/
46124                 * elf32-ppc.c (ppc_elf_check_relocs): Set isym and ifunc earlier.
46125                 Rearrange tests for dynamic relocs, handling absolute symbols.
46126                 (allocate_dynrelocs): Don't allocate dynamic relocs for locally
46127                 defined absolute symbols.
46128                 (ppc_elf_size_dynamic_sections): Similarly.
46129                 (ppc_elf_relocate_section): Similarly.
46130         ld/
46131                 * testsuite/ld-powerpc/abs32-pie.d,
46132                 * testsuite/ld-powerpc/abs32-pie.r,
46133                 * testsuite/ld-powerpc/abs32-reloc.s,
46134                 * testsuite/ld-powerpc/abs32-shared.d,
46135                 * testsuite/ld-powerpc/abs32-shared.r,
46136                 * testsuite/ld-powerpc/abs32-static.d,
46137                 * testsuite/ld-powerpc/abs32-static.r: New tests.
46138                 * testsuite/ld-powerpc/powerpc.exp: Run them.
46139
46140 2022-05-04  John Baldwin  <jhb@FreeBSD.org>
46141
46142         gdbserver: Fix build after adding tls feature to arm tdesc.
46143
46144 2022-05-04  GDB Administrator  <gdbadmin@sourceware.org>
46145
46146         Automatic date update in version.in
46147
46148 2022-05-04  John Baldwin  <jhb@FreeBSD.org>
46149
46150         NEWS: Add a note for TLS support on FreeBSD/arm and FreeBSD/Aarch64.
46151
46152         Read the tpidr register from NT_ARM_TLS on Linux.
46153
46154         gdbserver: Read the tpidr register from NT_ARM_TLS on Linux.
46155
46156         Read the tpidr register from NT_ARM_TLS core dump notes on Linux Aarch64.
46157
46158         Fetch the NT_ARM_TLS register set for native FreeBSD/Aarch64 processes.
46159         This permits resolving TLS variables.
46160
46161         Support TLS variables on FreeBSD/Aarch64.
46162         Derive the pointer to the DTV array from the tpidr register.
46163
46164         Read the tpidr register from NT_ARM_TLS core dump notes on FreeBSD/Aarch64.
46165
46166         Add an aarch64-tls feature which includes the tpidr register.
46167
46168         Fetch the NT_ARM_TLS register set for native FreeBSD/arm processes.
46169         This permits resolving TLS variables.
46170
46171         Support TLS variables on FreeBSD/arm.
46172         Derive the pointer to the DTV array from the tpidruro register.
46173
46174         Read the tpidruro register from NT_ARM_TLS core dump notes on FreeBSD/arm.
46175
46176         Add an arm-tls feature which includes the tpidruro register from CP15.
46177
46178         fbsd-nat: Add helper routines for register sets using PT_[G]SETREGSET.
46179         FreeBSD's kernel has recently added PT_GETREGSET and PT_SETREGSET
46180         operations to fetch a register set named by an ELF note type.  These
46181         helper routines provide helpers to check for a register set's
46182         existence, fetch registers for a register set, and store registers to
46183         a register set.
46184
46185 2022-05-03  H.J. Lu  <hjl.tools@gmail.com>
46186
46187         ld: Regenerate aclocal.m4 with automake 1.15.1
46188                 * aclocal.m4: Regenerate with automake 1.15.1.
46189
46190 2022-05-03  Pedro Alves  <pedro@palves.net>
46191
46192         gdbserver: track current process as well as current thread
46193         The recent commit 421490af33bf ("gdbserver/linux: Access memory even
46194         if threads are running") caused a regression in
46195         gdb.threads/access-mem-running-thread-exit.exp with gdbserver, which I
46196         somehow missed.  Like so:
46197
46198          (gdb) print global_var
46199          Cannot access memory at address 0x555555558010
46200          (gdb) FAIL: gdb.threads/access-mem-running-thread-exit.exp: non-stop: access mem (print global_var after writing, inf=2, iter=1)
46201
46202         The problem starts with GDB telling GDBserver to select a thread, via
46203         the Hg packet, which GDBserver complies with, then that thread exits,
46204         and GDB, without knowing the thread is gone, tries to write to memory,
46205         through the context of the previously selected Hg thread.
46206
46207         GDBserver's GDB-facing memory access routines, gdb_read_memory and
46208         gdb_write_memory, call set_desired_thread to make GDBserver re-select
46209         the thread that GDB has selected with the Hg packet.  Since the thread
46210         is gone, set_desired_thread returns false, and the memory access
46211         fails.
46212
46213         Now, to access memory, it doesn't really matter which thread is
46214         selected.  All we should need is the target process.  Even if the
46215         thread that GDB previously selected is gone, and GDB does not yet know
46216         about that exit, it shouldn't matter, GDBserver should still know
46217         which process that thread belonged to.
46218
46219         Fix this by making GDBserver track the current process separately,
46220         like GDB also does.  Add a new set_desired_process routine that is
46221         similar to set_desired_thread, but just sets the current process,
46222         leaving the current thread as NULL.  Use it in the GDB-facing memory
46223         read and write routines, to avoid failing if the selected thread is
46224         gone, but the process is still around.
46225
46226         Change-Id: I4ff97cb6f42558efbed224b30d5c71f6112d44cd
46227
46228 2022-05-03  Pedro Alves  <pedro@palves.net>
46229
46230         Fix gdb.threads/access-mem-running-thread-exit.exp w/ native-extended-gdbserver
46231         When testing gdb.threads/access-mem-running-thread-exit.exp with
46232         --target_board=native-extended-gdbserver, we get:
46233
46234           Running gdb.threads/access-mem-running-thread-exit.exp ...
46235           FAIL: gdb.threads/access-mem-running-thread-exit.exp: non-stop: second inferior: runto: run to main
46236           WARNING: Timed out waiting for EOF in server after monitor exit
46237
46238                           === gdb Summary ===
46239
46240           # of expected passes            3
46241           # of unexpected failures        1
46242           # of unsupported tests          1
46243
46244         The problem is that the testcase spawns a second inferior with
46245         -no-connection, and then runto_main does "run", which fails like so:
46246
46247          (gdb) run
46248          Don't know how to run.  Try "help target".
46249          (gdb) FAIL: gdb.threads/access-mem-running-thread-exit.exp: non-stop: second inferior: runto: run to main
46250
46251         That "run" above failed because native-extended-gdbserver forces "set
46252         auto-connect-native-target off", to prevent testcases from mistakenly
46253         running programs with the native target, which would exactly be the
46254         case here.
46255
46256         Fix this by letting the second inferior share the first inferior's
46257         connection everywhere except on targets that do reload on run (e.g.,
46258         --target_board=native-gdbserver).
46259
46260         Change-Id: Ib57105a238cbc69c57220e71261219fa55d329ed
46261
46262 2022-05-03  Andrew Burgess  <aburgess@redhat.com>
46263
46264         gdb: add some additional thread status debug output
46265         While working on this patch:
46266
46267           https://sourceware.org/pipermail/gdb-patches/2022-January/185109.html
46268
46269         I found it really useful to print the executing/resumed status of all
46270         threads (or all threads in a particular inferior) at various
46271         places (e.g. when a new inferior is started, when GDB attaches, etc).
46272
46273         This debug was originally part of the above patch, but I wanted to
46274         rewrite this as a separate patch and move the code into a new function
46275         in infrun.h, which is what this patch does.
46276
46277         Unless 'set debug infrun on' is in effect, then there should be no
46278         user visible changes after this commit.
46279
46280 2022-05-03  Nick Clifton  <nickc@redhat.com>
46281
46282         Add a linker warning when creating potentially dangerous executable segments.  Add tests, options to disabke and configure switches to choose defaults.
46283
46284         Fix potential arithmetic overflow in the linker's plugin handling code.
46285                 PR 29101
46286                 * libdep_plugin.c (get_libdeps): Check for overflow when computing
46287                 amount of memory to allocate.
46288
46289 2022-05-03  Andrew Burgess  <aburgess@redhat.com>
46290
46291         objdump: fix styled printing of addresses
46292         Previous work to add styled disassembler output missed a case in
46293         objdump_print_addr, which is fixed in this commit.
46294
46295 2022-05-03  Andrew Burgess  <aburgess@redhat.com>
46296
46297         gdb/testsuite: small cleanup in mi-break-qualified.exp
46298         It is not necessary to pass an empty string to mi_gdb_start, passing
46299         the empty string is equivalent to passing no arguments, which is what
46300         we do everywhere else (that we don't need to specify an actual
46301         argument).
46302
46303         The only place we use 'mi_gdb_start ""' is in
46304         gdb.mi/mi-break-qualified.exp, so in this commit I just replace that
46305         with a call to 'mi_gdb_start' - just for consistency.
46306
46307         There should be no change in what is tested after this commit.
46308
46309 2022-05-03  Andrew Burgess  <aburgess@redhat.com>
46310
46311         gdb/testsuite: change mi_gdb_start to take a list of flags
46312         After this previous commit I was thinking about the API of
46313         mi_gdb_start.  I felt that the idea of passing flags as separate
46314         arguments and using 'args' to gather these into a list, though clever,
46315         was not an intuitive API.
46316
46317         In this commit I modify mi_gdb_start so that it expects a single
46318         argument, which should be a list of flags.  Thus, where we previously
46319         would have said:
46320
46321           mi_gdb_start separate-mi-tty separate-inferior-tty
46322
46323         We would now say:
46324
46325           mi_gdb_start { separate-mi-tty separate-inferior-tty }
46326
46327         However, it turns out we never actually call mi_gdb_start passing two
46328         arguments in this way at all.  We do in some places do this:
46329
46330           mi_gdb_start separate-inferior-tty
46331
46332         But that's fine, a single string like this works equally well as a
46333         single item list, so this will not need updating.
46334
46335         There is also one place where we do this:
46336
46337           eval mi_gdb_start $start_ops
46338
46339         where $start_ops is a list that might contains 0, 1, or 2 items.  The
46340         eval here is used to expand the $start_ops list so mi_gdb_start sees
46341         the list contents as separate arguments.  In this case we just need to
46342         drop the use of eval.
46343
46344         I think that the new API is more intuitive, but others might
46345         disagree, in which case I can drop this change.
46346
46347         There should be no change in what is tested after this commit.
46348
46349 2022-05-03  Andrew Burgess  <aburgess@redhat.com>
46350
46351         gdb/testsuite: fix mi-exec-run.exp with native-extended-gdbserver board
46352         When running with the native-extended-gdbserver board, I currently see
46353         one failure in gdb.mi/mi-exec-run.exp:
46354
46355             FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=0: breakpoint hit reported on console (timeout)
46356
46357         In this test the MI interface should be started in a separate tty,
46358         which means we should have a CLI tty and an MI tty, however, this is
46359         not happening.  Instead GDB is just started in MI mode and there is no
46360         CLI tty.
46361
46362         The test script tries to switch between the CLI an MI terminals and
46363         look for some expected output on each, however, as there is no CLI
46364         terminal the expected output never arrives, and the test times out.
46365
46366         It turns out that this is not a GDB problem, rather, this is an issue
46367         with argument passing within the test script.
46368
46369         The proc default_mi_gdb_start expects to take a set of flags (strings)
46370         as arguments, each of flag is expected to be a separate argument.  The
46371         default_mi_gdb_start proc collects all its arguments into a list using
46372         the special 'args' parameter name, and then iterates over this list to
46373         see which flags were passed.
46374
46375         In mi_gdb_start, which forwards to default_mi_gdb_start, the arguments
46376         are also gathered into the 'args' parameter list, but are then
46377         expanded back to be separate arguments using the eval trick, i.e.:
46378
46379           proc mi_gdb_start { args } {
46380             return [eval default_mi_gdb_start $args]
46381           }
46382
46383         This ensures that when we arrive in default_mi_gdb_start each flag is
46384         a separate argument, rather than appearing as a single list containing
46385         all arguments.
46386
46387         When using the native-extended-gdbserver board however, the file
46388         boards/native-extended-gdbserver.exp is loaded, and this file replaces
46389         the default mi_gdb_start with its own version.
46390
46391         This new mi_gdb_start also gathers the arguments into an 'args' list,
46392         but forgets to expand the arguments out using the eval trick.
46393
46394         As a result, when using the native-extended-gdbserver board, by the
46395         time we get to default_mi_gdb_start, we end up with the args list
46396         containing a single item, which is a list containing all the arguments
46397         the user passed.
46398
46399         What this means is that if the user passes two arguments, then, in
46400         default_mi_gdb_start, instead of seeing two separate arguments, we see
46401         a single argument made by concatenating the two arguments together.
46402
46403         The only place this is a problem is in the test mi-exec-run.exp,
46404         which (as far as I can see) is the only test where we might try to
46405         pass both arguments at the same time.  Currently we think we passed
46406         both arguments to mi_gdb_start, but mi_gdb_start behaves as if no
46407         arguments were passed.
46408
46409         This commit fixes the problem by making use of the eval trick within
46410         the native-extended-gdbserver version of mi_gdb_start.  After this,
46411         the FAIL listed at the top of this message is resolved.
46412
46413 2022-05-03  Andrew Burgess  <aburgess@redhat.com>
46414
46415         gdb: fix failures in gdb.mi/mi-exec-run.exp with native-extended-gdbserver
46416         When running the gdb.mi/mi-exec-run.exp test using the
46417         native-extended-gdbserver I see failures like this:
46418
46419           FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=main: mi=main: force-fail=1: run failure detected
46420           FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=main: mi=separate: force-fail=1: run failure detected
46421           FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=1: run failure detected
46422
46423         There's a race condition here, so you might see a slightly different
46424         set of failures, but I always see some from the 'run failure detected'
46425         test.
46426
46427         NOTE: I also see an additional test failure:
46428
46429          FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=0: breakpoint hit reported on console (timeout)
46430
46431         but that is a completely different issue, and is not being addressed
46432         in this commit.
46433
46434         The problem for the 'run failure detected' test is that we end up
46435         in gdb_expect looking for output from two spawn-ids, one from
46436         gdbserver, and one from gdb.  We're looking for one output pattern
46437         from each spawn-id, and for the test to pass we need to see both
46438         patterns.
46439
46440         Now, if gdb exits then this is a test failure (this would indicate gdb
46441         crashing, which is bad), so we have an eof pattern associated with
46442         the gdb spawn-id.
46443
46444         However, in this particular test we expect gdbserver to fail to
46445         execute the binary (the test binary is set non-executable), and so we
46446         get an error message from gdbserver (which matches the pattern), and
46447         then gdbserver exits, this is expected.
46448
46449         The problem is that after spotting the pattern from gdbserver, we
46450         often see the eof from gdbserver before we see the pattern from gdb.
46451         If this happens then we drop out of the gdb_expect without ever seeing
46452         the pattern from gdb, and fail the test.
46453
46454         In this commit, I place the spawn-id of gdbserver into a global
46455         variable, and then use this global variable as the -i option within
46456         the gdb_expect.
46457
46458         Now, once we have seen the expected pattern on the gdbserver spawn-id,
46459         the global variable is cleared.  After this the gdb_expect no longer
46460         checks the gdbserver spawn-id for additional output, and so never sees
46461         the eof event.  This leaves the gdb_expect running, which allows the
46462         pattern from gdb to be seen, and for the test to pass.
46463
46464         I now see no failures relating to 'run failure detected'.
46465
46466 2022-05-03  GDB Administrator  <gdbadmin@sourceware.org>
46467
46468         Automatic date update in version.in
46469
46470 2022-05-02  Tom de Vries  <tdevries@suse.de>
46471
46472         [gdb/testsuite] Fix gdb.cp/align.exp with gcc 12.1 / 11.3
46473         Starting with gcc 12.1 / gcc 11.3, for test-case gdb.cp/align.exp we run into:
46474         ...
46475         align.cc:29:23: error: invalid application of 'alignof' to a void type^M
46476            29 |     unsigned a_void = alignof (void);^M
46477               |                       ^~~~~~~~~~~~~~^M
46478         ...
46479
46480         Fix this by using __alignof__ instead.
46481
46482         Tested on x86_64-linux, with gcc 7.5.0, gcc 12.1 and clang 12.0.1.
46483
46484 2022-05-02  Aaron Merey  <amerey@redhat.com>
46485
46486         gdb/debuginfod: Whitespace-only URL should disable debuginfod
46487         Currently debuginfod is disabled when the string of server URLs
46488         is unset or set to be the empty string (via the $DEBUGINFOD_URLS
46489         environment variable or the 'set debuginfod urls' gdb command).
46490
46491         Extend this functionality so that a whitespace-only URL also disables
46492         debuginfod.
46493
46494         Modify a testcase to verify that a whitespace-only URL disables
46495         debuginfod.
46496
46497 2022-05-02  Simon Marchi  <simon.marchi@efficios.com>
46498
46499         gdb: remove type_wanted parameter from a few functions
46500         The type_wanted value, passed down to the create_sals_from_location
46501         callback, is never used.  Remove it.
46502
46503         Change-Id: Ic363ee13f6af593a3e875ff7fe46de130cdc190c
46504
46505 2022-05-02  Simon Marchi  <simon.marchi@efficios.com>
46506
46507         gnulib: update to bd11400942d6
46508         Update the gnulib import to fixes these issues:
46509
46510           - GDB build with clang + glibc < 2.33.
46511
46512               https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=d6a07b4dc21b3118727743142c678858df442853
46513               https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00072.html
46514
46515             With glibc < 2.33, gnulib (since relatively recently) enables a
46516             replacement for free (see gnulib/import/m4/free.m4).  In that path,
46517             clang shows this error:
46518
46519                 make[2]: Entering directory '/home/smarchi/build/binutils-gdb-clang/gdbsupport'
46520                   CXX      agent.o
46521                 In file included from /home/smarchi/src/binutils-gdb/gdbsupport/agent.cc:20:
46522                 In file included from /home/smarchi/src/binutils-gdb/gdbsupport/common-defs.h:95:
46523                 ../gnulib/import/string.h:636:19: error: exception specification in declaration does not match previous declaration
46524                 _GL_EXTERN_C void free (void *) throw ();
46525                                   ^
46526                 ../gnulib/import/stdlib.h:737:17: note: expanded from macro 'free'
46527                 #   define free rpl_free
46528                                 ^
46529                 ../gnulib/import/stdlib.h:739:1: note: previous declaration is here
46530                 _GL_FUNCDECL_RPL (free, void, (void *ptr));
46531                 ^
46532                 ../gnulib/import/sys/select.h:251:23: note: expanded from macro '_GL_FUNCDECL_RPL'
46533                   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
46534                                       ^
46535                 <scratch space>:139:1: note: expanded from here
46536                 rpl_free
46537                 ^
46538
46539             The gnulib commit mentioned fixes the exception specification of `free`.
46540
46541          - GDB build on RHEL 7:
46542
46543               CC       libgnu_a-openat-proc.o
46544             In file included from /usr/include/string.h:633,
46545                              from ./string.h:41,
46546                              from ../../../binutils-gdb/gnulib/import/openat-proc.c:30:
46547             ./string.h:1105:1: error: expected identifier or '(' before '__extension__'
46548              1105 | _GL_FUNCDECL_SYS (strndup, char *,
46549                   | ^~~~~~~~~~~~~~~~
46550
46551              https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=84863a1c4dc8cca8fb0f6f670f67779cdd2d543b
46552              https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00075.html
46553
46554         Change-Id: Ibd51302feece6f385d0c53e0d08921b5d95e2776
46555
46556 2022-05-02  Tom Tromey  <tromey@adacore.com>
46557
46558         Fix Ada catchpoint regression
46559         The breakpoint C++-ification series introduced a regression for Ada
46560         catchpoints.  Specifically, commit 2b5ab5b8 ("Convert base breakpoints
46561         to vtable ops") caused these to start failing.  I didn't notice this
46562         because testing Ada using a Linux distro compiler requires installing
46563         the GNAT debuginfo, which I hadn't done.
46564
46565         This patch fixes the problem.  I'm checking it in.
46566
46567 2022-05-02  GDB Administrator  <gdbadmin@sourceware.org>
46568
46569         Automatic date update in version.in
46570
46571 2022-05-01  Tom de Vries  <tdevries@suse.de>
46572
46573         [gdb/testsuite] Fix gdb.multi/attach-no-multi-process.exp with check-readmore
46574         When running test-case gdb.multi/attach-no-multi-process.exp with
46575         check-readmore, I get:
46576         ...
46577         (gdb) attach 13411^M
46578         Attaching to Remote target^M
46579         No unwaited-for children left.^M
46580         (gdb) Reading symbols from attach-no-multi-process...^M
46581         Reading symbols from /lib64/libm.so.6...^M
46582         (No debugging symbols found in /lib64/libm.so.6)^M
46583         Reading symbols from /lib64/libc.so.6...^M
46584         (No debugging symbols found in /lib64/libc.so.6)^M
46585         Reading symbols from /lib64/ld-linux-x86-64.so.2...^M
46586         (No debugging symbols found in /lib64/ld-linux-x86-64.so.2)^M
46587         0x00007f5df1fffc8a in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6^M
46588         FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: \
46589           attach to the program via remote (timeout)
46590         ...
46591
46592         The problem is that the attach output is matched using gdb_test, which uses
46593         the '$gdb_prompt $' regexp, and this does not handle the case that '(gdb) ' is
46594         not the last available output.
46595
46596         Fix this by using a gdb_test_multiple instead with a '$gdb_prompt ' regexp, so
46597         without the '$' anchor.
46598
46599         Tested on x86_64-linux with native, check-read1 and check-readmore.
46600
46601 2022-05-01  GDB Administrator  <gdbadmin@sourceware.org>
46602
46603         Automatic date update in version.in
46604
46605 2022-04-30  Thomas Hebb  <tommyhebb@gmail.com>
46606
46607         opcodes: don't assume ELF in riscv, csky, rl78, mep disassemblers
46608         Currently, the get_disassembler() implementations for riscv, csky, and
46609         rl78--and mep_print_insn() for mep--access ELF variants of union fields
46610         without first checking that the bfd actually represents an ELF.  This
46611         causes undefined behavior and crashes when disassembling non-ELF files
46612         (the "binary" BFD, for example).  Fix that.
46613
46614 2022-04-30  GDB Administrator  <gdbadmin@sourceware.org>
46615
46616         Automatic date update in version.in
46617
46618 2022-04-29  Tom Tromey  <tom@tromey.com>
46619
46620         Remove create_breakpoints_sal_default
46621         create_breakpoints_sal_default is just a simple wrapper, so remove it.
46622
46623         Remove allocate_bp_location
46624         allocate_bp_location is just a small wrapper for a method call, so
46625         inline it everywhere.
46626
46627         Constify breakpoint_ops
46628         Now that all breakpoint_ops are statically initialized, they can all
46629         be made const.
46630
46631         Remove breakpoint ops initialization
46632         initialize_breakpoint_ops does not do much any more, so remove it in
46633         favor of statically-initialize objects.
46634
46635         Remove vtable_breakpoint_ops
46636         There's no need to have vtable_breakpoint_ops any more, so remove it
46637         in favor of base_breakpoint_ops.
46638
46639         Remove most fields from breakpoint_ops
46640         At this point, all implementations of breakpoints use the vtable.  So,
46641         we can now remove most function pointers from breakpoint_ops and
46642         switch to using methods directly in the callers.  Only the two "static
46643         virtual" methods remain in breakpoint_ops.
46644
46645         Remove breakpoint_ops from init_catchpoint
46646         init_catchpoint is only ever passed a single breakpoint_ops pointer,
46647         so remove the parameter.
46648
46649         Remove breakpoint_ops from init_ada_exception_breakpoint
46650         init_ada_exception_breakpoint is only ever passed a single
46651         breakpoint_ops structure, so remove the parameter.
46652
46653 2022-04-29  Tom Tromey  <tom@tromey.com>
46654
46655         Merge probe and ordinary tracepoints
46656         Right now, probe tracepoints are handled by a separate ops object.
46657         However, they differ only in a small way from ordinary tracepoints,
46658         and furthermore can be distinguished by their event location.
46659
46660         This patch merges the two cases, just as was done for breakpoints.
46661
46662 2022-04-29  Tom Tromey  <tom@tromey.com>
46663
46664         Merge probe and ordinary breakpoints
46665         Right now, probe breakpoints are handled by a separate ops object.
46666         However, they differ only in a small way from ordinary breakpoints,
46667         and furthermore can be distinguished by their "probe" object.
46668
46669         This patch merges the two cases.  This avoids having to introduce a
46670         new bp_ constant (which can be quite subtle to do correctly) and a new
46671         subclass.
46672
46673 2022-04-29  Tom Tromey  <tom@tromey.com>
46674
46675         Remove bkpt_base_breakpoint_ops
46676         An earlier patch removed the last use of bkpt_base_breakpoint_ops, so
46677         remove the object entirely.
46678
46679         Convert static marker tracepoints to vtable ops
46680         This converts static marker tracepoints to use vtable_breakpoint_ops.
46681
46682         Add bp_static_marker_tracepoint
46683         Because the actual construction of a breakpoint is buried deep in
46684         create_breakpoint, at present it's necessary to have a new bp_
46685         enumerator constant any time a new subclass is needed.  Static marker
46686         tracepoints are one such case, so this patch introduces
46687         bp_static_marker_tracepoint and updates various spots to recognize it.
46688
46689         Convert ranged breakpoints to vtable ops
46690         This converts ranged breakpoints to use vtable_breakpoint_ops.  This
46691         requires introducing a new ranged_breakpoint type, but this is
46692         relatively simple because ranged breakpoints can only be created by
46693         break_range_command.
46694
46695         Convert dprintf to vtable ops
46696         This converts dprintf to use vtable_breakpoint_ops.
46697
46698         Convert Ada catchpoints to vtable ops
46699         This converts Ada catchpoints to use vtable_breakpoint_ops.
46700
46701         Convert ordinary breakpoints to vtable ops
46702         This converts "ordinary" breakpoint to use vtable_breakpoint_ops.
46703         Recall that an ordinary breakpoint is both the kind normally created
46704         by users, and also a base class used by other classes.
46705
46706         Change inheritance of dprintf
46707         The dprintf breakpoint ops is mostly a copy of bpkt_breakpoint_ops,
46708         except it's written out explicitly -- and, importantly, there's
46709         nothing that bpkt_breakpoint_ops overrides that dprintf does not.
46710         This changes dprintf to simply inherit directly, and updates struct
46711         dprintf_breakpoint to reflect the change as well.
46712
46713         Convert momentary breakpoints to vtable ops
46714         This converts momentary breakpoints to use vtable_breakpoint_ops.
46715
46716         Convert internal breakpoints to vtable ops
46717         This converts internal breakpoints to use vtable_breakpoint_ops.
46718
46719         Convert break-catch-throw to vtable ops
46720         This converts break-catch-throw.c to use vtable_breakpoint_ops.
46721
46722         Convert base breakpoints to vtable ops
46723         This converts base breakpoints to use vtable_breakpoint_ops.
46724
46725 2022-04-29  Tom Tromey  <tom@tromey.com>
46726
46727         Add some new subclasses of breakpoint
46728         This adds a few new subclasses of breakpoint.  The inheritance
46729         hierarchy is chosen to reflect what's already present in
46730         initialize_breakpoint_ops -- it mirrors the way that the _ops
46731         structures are filled in.
46732
46733         This patch also changes new_breakpoint_from_type to create the correct
46734         sublcass based on bptype.  This is important due to the somewhat
46735         inverted way in which create_breakpoint works; and in particular later
46736         patches will change some of these entries.
46737
46738 2022-04-29  Tom Tromey  <tom@tromey.com>
46739
46740         Convert tracepoints to vtable ops
46741         This converts tracepoints to use vtable_breakpoint_ops.
46742
46743         Convert watchpoints to vtable ops
46744         This converts watchpoints and masked watchpoints. to use
46745         vtable_breakpoint_ops.  For masked watchpoints, a new subclass must be
46746         introduced, and watch_command_1 is changed to create one.
46747
46748         Convert break-catch-load to vtable ops
46749         This converts break-catch-load.c to use vtable_breakpoint_ops.
46750
46751         Convert break-catch-fork to vtable ops
46752         This converts break-catch-fork.c to use vtable_breakpoint_ops.
46753
46754         Convert break-catch-exec to vtable ops
46755         This converts break-catch-exec.c to use vtable_breakpoint_ops.
46756
46757         Convert break-catch-syscall to vtable ops
46758         This converts break-catch-syscall.c to use vtable_breakpoint_ops.
46759
46760         Convert break-catch-sig to use vtable ops
46761         This converts break-catch-sig.c to use vtable_breakpoint_ops.
46762
46763 2022-04-29  Tom Tromey  <tom@tromey.com>
46764
46765         Add a vtable-based breakpoint ops
46766         This adds methods to struct breakpoint.  Each method has a similar
46767         signature to a corresponding function in breakpoint_ops, with the
46768         exceptions of create_sals_from_location and create_breakpoints_sal,
46769         which can't be virtual methods on breakpoint -- they are only used
46770         during the construction of breakpoints.
46771
46772         Then, this adds a new vtable_breakpoint_ops structure and populates it
46773         with functions that simply forward a call from breakpoint_ops to the
46774         corresponding virtual method.  These are all done with lambdas,
46775         because they are just a stepping stone -- by the end of the series,
46776         this structure will be deleted.
46777
46778 2022-04-29  Tom Tromey  <tom@tromey.com>
46779
46780         Return bool from breakpoint_ops::print_one
46781         This changes breakpoint_ops::print_one to return bool, and updates all
46782         the implementations and the caller.  The caller is changed so that a
46783         NULL check is no longer needed -- something that will be impossible
46784         with a real method.
46785
46786         Delete some unnecessary wrapper functions
46787         This patch deletes a few unnecessary wrapper functions from
46788         breakpoint.c.
46789
46790         Add an assertion to clone_momentary_breakpoint
46791         This adds an assertion to clone_momentary_breakpoint.  This will
46792         eventually be removed, but in the meantime is is useful for helping
46793         convince oneself that momentary breakpoints will always use
46794         momentary_breakpoint_ops.  This understanding will help when cleaning
46795         up the code later.
46796
46797         Boolify print_solib_event
46798         Change print_solib_event to accept a bool parameter and update the
46799         callers.
46800
46801         Move "catch load" to a new file
46802         The "catch load" code is reasonably self-contained, and so this patch
46803         moves it out of breakpoint.c and into a new file, break-catch-load.c.
46804         One function from breakpoint.c, print_solib_event, now has to be
46805         exposed, but this seems pretty reasonable.
46806
46807 2022-04-29  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
46808
46809         gprofng: assertion in gprofng/src/Expression.cc:139
46810         gprofng/ChangeLog
46811         2022-04-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
46812
46813                 PR gprofng/29102
46814                 * src/Expression.h: Remove fixupValues.
46815                 * src/Expression.cc (Expression::copy): Fix a bug.
46816
46817 2022-04-29  Tom Tromey  <tromey@adacore.com>
46818
46819         De-duplicate .gdb_index
46820         This de-duplicates variables and types in .gdb_index, making the new
46821         index closer to what gdb generated before the new DWARF scanner
46822         series.  Spot-checking the resulting index for gdb itself, it seems
46823         that the new scanner picks up some extra symbols not detected by the
46824         old one.  I tested both the new and old versions of gdb on both new
46825         and old versions of the index, and startup time in all cases is
46826         roughly the same (it's worth noting that, for gdb itself, the index no
46827         longer provides any benefit over the DWARF scanner).  So, I think this
46828         fixes the size issue with the new index writer.
46829
46830         Regression tested on x86-64 Fedora 34.
46831
46832 2022-04-29  Tom Tromey  <tromey@adacore.com>
46833
46834         Fix .debug_names regression with new indexer
46835         At AdaCore, we run the internal gdb test suite in several modes,
46836         including one using the .debug_names index.  This caught a regression
46837         caused by the new DWARF indexer.
46838
46839         First, the psymtabs-based .debug_names generator was completely wrong.
46840         However, to avoid making the rewrite series even bigger (fixing the
46841         writer will also require rewriting the .debug_names reader), it
46842         attempted to preserve the weirdness.
46843
46844         However, this was not done properly.  For example the old writer did
46845         this:
46846
46847         -      case STRUCT_DOMAIN:
46848         -       return DW_TAG_structure_type;
46849
46850         The new code, instead, simply preserves the actual DWARF tag -- but
46851         this makes future lookups fail, because the .debug_names reader only
46852         looks for DW_TAG_structure_type.
46853
46854         This patch attempts to revert to the old behavior in the writer.
46855
46856 2022-04-29  Simon Marchi  <simon.marchi@polymtl.ca>
46857
46858         gdb/infrun: make fetch_inferior_event restore thread if exited or signalled
46859         Commit 152a1749566 ("gdb: prune inferiors at end of
46860         fetch_inferior_event, fix intermittent failure of
46861         gdb.threads/fork-plus-threads.exp") introduced some follow-fork-related
46862         test failures, such as:
46863
46864             info inferiors^M
46865               Num  Description       Connection           Executable        ^M
46866             * 1    process 634972    1 (native)           /home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.base/foll-fork/foll-fork ^M
46867               2    process 634975    1 (native)           /home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.base/foll-fork/foll-fork ^M
46868             (gdb) PASS: gdb.base/foll-fork.exp: follow-fork-mode=parent: detach-on-fork=off: cmd=next 2: test_follow_fork: info inferiors
46869             inferior 2^M
46870             [Switching to inferior 2 [process 634975] (/home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.base/foll-fork/foll-fork)]^M
46871             [Switching to thread 2.1 (Thread 0x7ffff7c9a740 (LWP 634975))]^M
46872             #0  0x00007ffff7d7abf7 in _Fork () from /usr/lib/libc.so.6^M
46873             (gdb) PASS: gdb.base/foll-fork.exp: follow-fork-mode=parent: detach-on-fork=off: cmd=next 2: test_follow_fork: inferior 2
46874             continue^M
46875             Continuing.^M
46876             [Inferior 2 (process 634975) exited normally]^M
46877             [Switching to Thread 0x7ffff7c9a740 (LWP 634972)]^M
46878             (gdb) PASS: gdb.base/foll-fork.exp: follow-fork-mode=parent: detach-on-fork=off: cmd=next 2: test_follow_fork: continue until exit at continue unfollowed inferior to end
46879             break callee^M
46880             Breakpoint 2 at 0x555555555160: file /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c, line 9.^M
46881             (gdb) FAIL: gdb.base/foll-fork.exp: follow-fork-mode=parent: detach-on-fork=off: cmd=next 2: test_follow_fork: break callee
46882
46883         What happens here is:
46884
46885          - inferior 2 is selected
46886          - we continue, leading to inferior 2's exit
46887          - we set breakpoint, expect 2 locations, but only one location is
46888            resolved
46889
46890         Reading between the lines, we understand that inferior 2 got pruned,
46891         when it shouldn't have been.
46892
46893         The issue can be reproduced by hand with:
46894
46895             $ ./gdb -q --data-directory=data-directory testsuite/outputs/gdb.base/foll-fork/foll-fork -ex "set detach-on-fork off" -ex start -ex "next 2" -ex "inferior 2" -ex "set debug infrun"
46896             ...
46897             Temporary breakpoint 1, main () at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c:14
46898             14        int  v = 5;
46899             [New inferior 2 (process 637627)]
46900             [Thread debugging using libthread_db enabled]
46901             Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1".
46902             17        if (pid == 0) /* set breakpoint here */
46903             [Switching to inferior 2 [process 637627] (/home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.base/foll-fork/foll-fork)]
46904             [Switching to thread 2.1 (Thread 0x7ffff7c9a740 (LWP 637627))]
46905             #0  0x00007ffff7d7abf7 in _Fork () from /usr/lib/libc.so.6
46906             (gdb) continue
46907             Continuing.
46908             [infrun] clear_proceed_status_thread: 637627.637627.0
46909             [infrun] proceed: enter
46910               [infrun] proceed: addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT
46911               [infrun] scoped_disable_commit_resumed: reason=proceeding
46912               [infrun] start_step_over: enter
46913                 [infrun] start_step_over: stealing global queue of threads to step, length = 0
46914                 [infrun] operator(): step-over queue now empty
46915               [infrun] start_step_over: exit
46916               [infrun] proceed: start: resuming threads, all-stop-on-top-of-non-stop
46917                 [infrun] proceed: resuming 637627.637627.0
46918                 [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [637627.637627.0] at 0x7ffff7d7abf7
46919                 [infrun] do_target_resume: resume_ptid=637627.637627.0, step=0, sig=GDB_SIGNAL_0
46920                 [infrun] infrun_async: enable=1
46921                 [infrun] prepare_to_wait: prepare_to_wait
46922               [infrun] proceed: end: resuming threads, all-stop-on-top-of-non-stop
46923               [infrun] reset: reason=proceeding
46924               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target native
46925               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target native
46926               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target native
46927             [infrun] proceed: exit
46928             [infrun] fetch_inferior_event: enter
46929               [infrun] scoped_disable_commit_resumed: reason=handling event
46930               [infrun] do_target_wait: Found 2 inferiors, starting at #1
46931               [infrun] random_pending_event_thread: None found.
46932               [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
46933               [infrun] print_target_wait_results:   637627.637627.0 [process 637627],
46934               [infrun] print_target_wait_results:   status->kind = EXITED, exit_status = 0
46935               [infrun] handle_inferior_event: status->kind = EXITED, exit_status = 0
46936             [Inferior 2 (process 637627) exited normally]
46937               [infrun] stop_waiting: stop_waiting
46938               [infrun] stop_all_threads: start: reason=presenting stop to user in all-stop, inf=-1
46939                 [infrun] stop_all_threads: pass=0, iterations=0
46940                 [infrun] stop_all_threads:   637624.637624.0 not executing
46941                 [infrun] stop_all_threads: pass=1, iterations=1
46942                 [infrun] stop_all_threads:   637624.637624.0 not executing
46943                 [infrun] stop_all_threads: done
46944               [infrun] stop_all_threads: end: reason=presenting stop to user in all-stop, inf=-1
46945             [Switching to Thread 0x7ffff7c9a740 (LWP 637624)]
46946               [infrun] infrun_async: enable=0
46947               [infrun] reset: reason=handling event
46948               [infrun] maybe_set_commit_resumed_all_targets: not requesting commit-resumed for target native, no resumed threads
46949             (gdb) [infrun] fetch_inferior_event: exit
46950             (gdb) info inferiors
46951               Num  Description       Connection           Executable
46952             * 1    process 637624    1 (native)           /home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.base/foll-fork/foll-fork
46953             (gdb) i th
46954               Id   Target Id                                      Frame
46955             * 1    Thread 0x7ffff7c9a740 (LWP 637624) "foll-fork" main () at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c:17
46956
46957         After handling the EXITED event for inferior 2, inferior 2 should have
46958         stayed the current inferior, which should have prevented it from getting
46959         pruned.  When debugging, we find that when getting at the
46960         prune_inferiors call, the current inferior is inferior 1.  Further
46961         debugging shows that prior to the call to
46962         clean_up_just_stopped_threads_fsms, the current inferior is inferior 2,
46963         and after, it's inferior 1.  Then, back in fetch_inferior_event, the
46964         restore_thread object is disabled, due to:
46965
46966                     /* If we got a TARGET_WAITKIND_NO_RESUMED event, then the
46967                        previously selected thread is gone.  We have two
46968                        choices - switch to no thread selected, or restore the
46969                        previously selected thread (now exited).  We chose the
46970                        later, just because that's what GDB used to do.  After
46971                        this, "info threads" says "The current thread <Thread
46972                        ID 2> has terminated." instead of "No thread
46973                        selected.".  */
46974                     if (!non_stop
46975                         && cmd_done
46976                         && ecs->ws.kind () != TARGET_WAITKIND_NO_RESUMED)
46977                       restore_thread.dont_restore ();
46978
46979         So in the end, inferior 1 stays current, and inferior 2 gets wrongfully
46980         pruned.
46981
46982         I'd say clean_up_just_stopped_threads_fsms is the culprit here.  It
46983         actually attempts to restore the event_thread to be current at the end,
46984         after the loop (I presume the current thread on entry is always supposed
46985         to be the event thread).  But in this case, the event is of kind EXITED,
46986         and ecs->event_thread is not set, so the current inferior isn't
46987         restored.
46988
46989         Fix that by using scoped_restore_current_thread.  If there is no current
46990         thread, scoped_restore_current_thread will still restore the current
46991         inferior, and that's what we want.
46992
46993         Random note: the thread_info object for inferior 2's thread is never
46994         freed.  It is held (by refcount) by the restore_thread object in
46995         fetch_inferior_event, while the inferior's thread list gets cleared, in
46996         the exit event processing.  When the refcount reaches 0 (when the
46997         restore_thread object is destroyed), there's nothing that actually
46998         deletes the thread_info object.  And I think that nothing in GDB points
46999         to it anymore, so it leaks.  I don't want to fix that in this patch, but
47000         thought it would be good to mention it, in case somebody has an idea for
47001         how to fix that.
47002
47003         Change-Id: Ibc7df543e2c46aad5f3b9250b28c3fb5912be4e8
47004
47005 2022-04-29  Pedro Alves  <pedro@palves.net>
47006
47007         Slightly tweak and clarify target_resume's interface
47008         The current target_resume interface is a bit odd & non-intuitive.
47009         I've found myself explaining it a couple times the recent past, while
47010         reviewing patches that assumed STEP/SIGNAL always applied to the
47011         passed in PTID.  It goes like this today:
47012
47013           - if the passed in PTID is a thread, then the step/signal request is
47014             for that thread.
47015
47016           - otherwise, if PTID is a wildcard (all threads or all threads of
47017             process), the step/signal request is for inferior_ptid, and PTID
47018             indicates which set of threads run free.
47019
47020         Because GDB always switches the current thread to "leader" thread
47021         being resumed/stepped/signalled, we can simplify this a bit to:
47022
47023           - step/signal are always for inferior_ptid.
47024
47025           - PTID indicates the set of threads that run free.
47026
47027         Still not ideal, but it's a minimal change and at least there are no
47028         special cases this way.
47029
47030         That's what this patch does.  It renames the PTID parameter to
47031         SCOPE_PTID, adds some assertions to target_resume, and tweaks
47032         target_resume's description.  In addition, it also renames PTID to
47033         SCOPE_PTID in the remote and linux-nat targets, and simplifies their
47034         implementation a little bit.  Other targets could do the same, but
47035         they don't have to.
47036
47037         Change-Id: I02a2ec2ab3a3e9b191de1e9a84f55c17cab7daaf
47038
47039 2022-04-29  GDB Administrator  <gdbadmin@sourceware.org>
47040
47041         Automatic date update in version.in
47042
47043 2022-04-28  Tom Tromey  <tromey@adacore.com>
47044
47045         Fix libinproctrace.so build on PPC
47046         The recent gnulib import caused a build failure of libinproctrace.so
47047         on PPC:
47048
47049             alloc.c:(.text+0x20): undefined reference to `rpl_malloc'
47050             alloc.c:(.text+0x70): undefined reference to `rpl_realloc'
47051
47052         This patch fixes the problem using the same workaround that was
47053         previously used for free.
47054
47055 2022-04-28  H.J. Lu  <hjl.tools@gmail.com>
47056
47057         x86: Properly handle function pointer reference
47058         Update
47059
47060         commit ebb191adac4ab45498dec0bfaac62f0a33537ba4
47061         Author: H.J. Lu <hjl.tools@gmail.com>
47062         Date:   Wed Feb 9 15:51:22 2022 -0800
47063
47064             x86: Disallow invalid relocation against protected symbol
47065
47066         to allow function pointer reference and make sure that PLT entry isn't
47067         used for function reference due to function pointer reference.
47068
47069         bfd/
47070
47071                 PR ld/29087
47072                 * elf32-i386.c (elf_i386_scan_relocs): Don't set
47073                 pointer_equality_needed nor check non-canonical reference for
47074                 function pointer reference.
47075                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
47076
47077         ld/
47078
47079                 PR ld/29087
47080                 * testsuite/ld-x86-64/x86-64.exp: Run PR ld/29087 tests.
47081                 * testsuite/ld-x86-64/protected-func-3.c: New file.
47082
47083 2022-04-28  Tom Tromey  <tom@tromey.com>
47084
47085         Check OBJF_NOT_FILENAME in DWARF index code
47086         The DWARF index code currently uses 'stat' to see if an objfile
47087         represents a real file.  However, I think it's more correct to check
47088         OBJF_NOT_FILENAME instead.
47089
47090         Regression tested on x86-64 Fedora 34.
47091
47092 2022-04-28  Tom Tromey  <tromey@adacore.com>
47093
47094         Remove "typedef enum ..."
47095         I noticed a few spots in GDB that use "typedef enum".  However, in C++
47096         this isn't as useful, as the tag is automatically entered as a
47097         typedef.  This patch removes most uses of "typedef enum" -- the
47098         exceptions being in some nat-* code I can't compile, and
47099         glibc_thread_db.h, which I think is more or less a copy of some C code
47100         from elsewhere.
47101
47102         Tested by rebuilding.
47103
47104 2022-04-28  Andrew Burgess  <aburgess@redhat.com>
47105
47106         gdb: fix nullptr dereference in block::ranges()
47107         This commit:
47108
47109           commit f5cb8afdd297dd68273d98a10fbfd350dff918d8
47110           Date:   Sun Feb 6 22:27:53 2022 -0500
47111
47112               gdb: remove BLOCK_RANGES macro
47113
47114         introduces a potential nullptr dereference in block::ranges, this is
47115         breaking most tests, e.g. gdb.base/break.exp is failing for me.
47116
47117         In the above patch BLOCK_CONTIGUOUS_P is changed from this:
47118
47119           #define BLOCK_CONTIGUOUS_P(bl)  (BLOCK_RANGES (bl) == nullptr \
47120                                            || BLOCK_NRANGES (bl) <= 1)
47121
47122         to this:
47123
47124           #define BLOCK_CONTIGUOUS_P(bl)  ((bl)->ranges ().size () == 0 \
47125                                            || (bl)->ranges ().size () == 1)
47126
47127         So, before the commit we checked for the block ranges being nullptr,
47128         but afterwards we just call block::ranges() in all cases.
47129
47130         The problem is that block::ranges() looks like this:
47131
47132           /* Return a view on this block's ranges.  */
47133           gdb::array_view<blockrange> ranges ()
47134           { return gdb::make_array_view (m_ranges->range, m_ranges->nranges); }
47135
47136         where m_ranges is:
47137
47138           struct blockranges *m_ranges;
47139
47140         And so, we see that the nullptr check has been lost, and we might end
47141         up dereferencing a nullptr.
47142
47143         My proposed fix is to move the nullptr check into block::ranges, and
47144         return an explicit empty array_view if m_ranges is nullptr.
47145
47146         After this, everything seems fine again.
47147
47148 2022-04-28  Stefan Liebler  <stli@linux.ibm.com>
47149
47150         s390: Add DT_JMPREL pointing to .rela.[i]plt with static-pie
47151         In static-pie case, there are IRELATIVE-relocs in
47152         .rela.iplt (htab->irelplt), which will later be grouped
47153         to .rela.plt.  On s390, the IRELATIVE relocations are
47154         always located in .rela.iplt - even for non-static case.
47155         Ensure that DT_JMPREL, DT_PLTRELA, DT_PLTRELASZ is added
47156         to the dynamic section even if htab->srelplt->size == 0.
47157         See _bfd_elf_add_dynamic_tags in bfd/elflink.c.
47158
47159         bfd/
47160                 elf64-s390.c (elf_s390_size_dynamic_sections):
47161                 Enforce DT_JMPREL via htab->elf.dt_jmprel_required.
47162
47163 2022-04-28  Stefan Liebler  <stli@linux.ibm.com>
47164
47165         s390: Avoid dynamic TLS relocs in PIE
47166         No dynamic relocs are needed for TLS defined in an executable, the
47167         TP relative offset is known at link time.
47168
47169         Fixes
47170         FAIL: Build pr22263-1
47171
47172         bfd/
47173                 PR ld/22263
47174                 * elf64-s390.c (elf_s390_tls_transition): Use bfd_link_dll
47175                 instead of bfd_link_pic for TLS.
47176                 (elf_s390_check_relocs): Likewise.
47177                 (allocate_dynrelocs): Likewise.
47178                 (elf_s390_relocate_section): Likewise.
47179
47180 2022-04-28  Nick Alcock  <nick.alcock@oracle.com>
47181
47182         libctf: impose an ordering on conflicting types
47183         When two types conflict and they are not types which can have forwards
47184         (say, two arrays of different sizes with the same name in two different
47185         TUs) the CTF deduplicator uses a popularity contest to decide what to
47186         do: the type cited by the most other types ends up put into the shared
47187         dict, while the others are relegated to per-CU child dicts.
47188
47189         This works well as long as one type *is* most popular -- but what if
47190         there is a tie?  If several types have the same popularity count,
47191         we end up picking the first we run across and promoting it, and
47192         unfortunately since we are working over a dynhash in essentially
47193         arbitrary order, this means we promote a random one.  So multiple
47194         runs of ld with the same inputs can produce different outputs!
47195         All the outputs are valid, but this is still undesirable.
47196
47197         Adjust things to use the same strategy used to sort types on the output:
47198         when there is a tie, always put the type that appears in a CU that
47199         appeared earlier on the link line (and if there is somehow still a tie,
47200         which should be impossible, pick the type with the lowest type ID).
47201
47202         Add a testcase -- and since this emerged when trying out extern arrays,
47203         check that those work as well (this requires a newer GCC, but since all
47204         GCCs that can emit CTF at all are unreleased this is probably OK as
47205         well).
47206
47207         Fix up one testcase that has slight type ordering changes as a result
47208         of this change.
47209
47210         libctf/ChangeLog:
47211
47212                 * ctf-dedup.c (ctf_dedup_detect_name_ambiguity): Use
47213                 cd_output_first_gid to break ties.
47214
47215         ld/ChangeLog:
47216
47217                 * testsuite/ld-ctf/array-conflicted-ordering.d: New test, using...
47218                 * testsuite/ld-ctf/array-char-conflicting-1.c: ... this...
47219                 * testsuite/ld-ctf/array-char-conflicting-2.c: ... and this.
47220                 * testsuite/ld-ctf/array-extern.d: New test, using...
47221                 * testsuite/ld-ctf/array-extern.c: ... this.
47222                 * testsuite/ld-ctf/conflicting-typedefs.d: Adjust for ordering
47223                 changes.
47224
47225 2022-04-28  Nick Alcock  <nick.alcock@oracle.com>
47226
47227         libctf: add a comment explaining how to use ctf_*open
47228         Specifically, tell users what to pass to those functions that accept raw
47229         section content, since it's fairly involved and easy to get wrong.
47230         (.dynsym / .dynstr when CTF_F_DYNSTR is set, otherwise .symtab / .strtab).
47231
47232         include/ChangeLog:
47233
47234                 * ctf-api.h (ctf_*open): Improve comment.
47235
47236 2022-04-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
47237
47238         gprofng: test suite problems
47239         gprofng/ChangeLog
47240         2022-04-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
47241
47242                 PR gprofng/29065
47243                 * testsuite/lib/Makefile.skel: Search parent dir for libs too.
47244
47245 2022-04-28  Simon Marchi  <simon.marchi@polymtl.ca>
47246
47247         gdb: remove BLOCKVECTOR_MAP macro
47248         Replace with equivalent methods.
47249
47250         Change-Id: I4e56c76dfc363c1447686fb29c4212ea18b4dba0
47251
47252 2022-04-28  Simon Marchi  <simon.marchi@polymtl.ca>
47253
47254         gdb: constify addrmap_find
47255         addrmap_find shouldn't need to modify the addrmap, so constify the
47256         addrmap parameter.  This helps for the following patch, where getting
47257         the map of a const blockvector will return a const addrmap.
47258
47259         Change-Id: If670e425ed013724a3a77aab7961db50366dccb2
47260
47261 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47262
47263         gdb: remove BLOCKVECTOR_BLOCK and BLOCKVECTOR_NBLOCKS macros
47264         Replace with calls to blockvector::blocks, and the appropriate method
47265         call on the returned array_view.
47266
47267         Change-Id: I04d1f39603e4d4c21c96822421431d9a029d8ddd
47268
47269 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47270
47271         gdb: remove BLOCK_ENTRY_PC macro
47272         Replace with equivalent method.
47273
47274         Change-Id: I0e033095e7358799930775e61028b48246971a7d
47275
47276 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47277
47278         gdb: remove BLOCK_CONTIGUOUS_P macro
47279         Replace with an equivalent method.
47280
47281         Change-Id: I60fd3be7b4c2601c2a74328f635fa48ed80eb7f5
47282
47283 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47284
47285         gdb: remove BLOCK_RANGE macro
47286         Replace with access through the block::ranges method.
47287
47288         Change-Id: I50f3ed433b997c9f354e49bc6583f540ae4b6121
47289
47290 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47291
47292         gdb: remove BLOCK_NRANGES macro
47293         Replace with range for loops.
47294
47295         Change-Id: Icbe04f9b6f9e6ddae2e15b2409c61f7a336bc3e3
47296
47297 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47298
47299         gdb: remove BLOCK_RANGES macro
47300         Replace with an equivalent method on struct block.
47301
47302         Change-Id: I6dcf13e9464ba8a08ade85c89e7329c300fd6c2a
47303
47304 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47305
47306         gdb: remove BLOCK_RANGE_{START,END} macros
47307         Replace with equivalent methods on blockrange.
47308
47309         Change-Id: I20fd8f624e0129782c36768291891e7582d77c74
47310
47311 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47312
47313         gdb: remove BLOCK_NAMESPACE macro
47314         Replace with equivalent methods.
47315
47316         Change-Id: If86b8cbdfb0f52e22c929614cd53e73358bab76a
47317
47318 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47319
47320         gdb: remove BLOCK_MULTIDICT macro
47321         Replace with equivalent methods.
47322
47323         Change-Id: If9a239c511a664f2a59fecb6d1cd579881b23dc2
47324
47325 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47326
47327         gdb: remove BLOCK_SUPERBLOCK macro
47328         Replace with equivalent methods.
47329
47330         Change-Id: I334a319909a50b5cc5570a45c38c70e10dc00630
47331
47332 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47333
47334         gdb: remove BLOCK_FUNCTION macro
47335         Replace with equivalent methods.
47336
47337         Change-Id: I31ec00f5bf85335c8b23d306ca0fe0b84d489101
47338
47339 2022-04-28  Simon Marchi  <simon.marchi@efficios.com>
47340
47341         gdb: remove BLOCK_{START,END} macros
47342         Replace with equivalent methods.
47343
47344         Change-Id: I10a6c8a2a86462d9d4a6a6409a3f07a6bea66310
47345
47346 2022-04-28  GDB Administrator  <gdbadmin@sourceware.org>
47347
47348         Automatic date update in version.in
47349
47350 2022-04-27  H.J. Lu  <hjl.tools@gmail.com>
47351
47352         x86: Disable 2 tests with large memory requirement
47353         gas/
47354
47355                 * testsuite/gas/i386/i386.exp: Disable rept.
47356
47357         ld/
47358
47359                 * testsuite/ld-x86-64/x86-64.exp: Disable pr17618.
47360
47361 2022-04-27  Pedro Alves  <pedro@palves.net>
47362
47363         Make gdb.base/parse_number.exp test all architectures
47364         There are some subtle differences between architectures, like the size
47365         of a "long" type, and this isn't currently accounted for in
47366         gdb.base/parse_number.exp.
47367
47368         For example, on aarch64 a long type is 8 bytes, whereas a long type is
47369         4 bytes for x86_64.  This causes the following FAIL's:
47370
47371          FAIL: gdb.base/parse_number.exp: lang=asm: ptype 0xffffffffffffffff
47372          FAIL: gdb.base/parse_number.exp: lang=auto: ptype 0xffffffffffffffff
47373          FAIL: gdb.base/parse_number.exp: lang=c: ptype 0xffffffffffffffff
47374          FAIL: gdb.base/parse_number.exp: lang=c++: ptype 0xffffffffffffffff
47375          FAIL: gdb.base/parse_number.exp: lang=fortran: p/x 0xffffffffffffffff
47376          FAIL: gdb.base/parse_number.exp: lang=fortran: ptype 0xffffffffffffffff
47377          FAIL: gdb.base/parse_number.exp: lang=go: ptype 0xffffffffffffffff
47378          FAIL: gdb.base/parse_number.exp: lang=local: ptype 0xffffffffffffffff
47379          FAIL: gdb.base/parse_number.exp: lang=minimal: ptype 0xffffffffffffffff
47380          FAIL: gdb.base/parse_number.exp: lang=objective-c: ptype 0xffffffffffffffff
47381          FAIL: gdb.base/parse_number.exp: lang=opencl: ptype 0xffffffffffffffff
47382          FAIL: gdb.base/parse_number.exp: lang=pascal: ptype 0xffffffffffffffff
47383
47384         There are some fortran-specific divergences as well, where 32-bit
47385         architectures show "unsigned int" for both 32-bit and 64-bit integers
47386         and 64-bit architectures show "unsigned int" and "unsigned long" for
47387         32-bit and 64-bit integers.
47388
47389         There might be a bug that 32-bit fortran truncates 64-bit values to
47390         32-bit, given "p/x 0xffffffffffffffff" returns "0xffffffff".
47391
47392         Here's what we get for aarch64:
47393
47394          (gdb) ptype 0xffffffff
47395          type = unsigned int
47396          (gdb) ptype 0xffffffffffffffff
47397          type = unsigned long
47398          (gdb) p sizeof (0xffffffff)
47399          $1 = 4
47400          (gdb) p sizeof (0xffffffffffffffff)
47401          quit
47402          $2 = 8
47403          (gdb) ptype 0xffffffff
47404          type = unsigned int
47405          (gdb) ptype 0xffffffffffffffff
47406          type = unsigned long
47407
47408         And for arm:
47409
47410          (gdb) ptype 0xffffffff
47411          type = unsigned int
47412          (gdb) ptype 0xffffffffffffffff
47413          quit
47414          type = unsigned long long
47415          (gdb) p sizeof (0xffffffff)
47416          quit
47417          $1 = 4
47418          (gdb) p sizeof (0xffffffffffffffff)
47419          quit
47420          $2 = 8
47421          (gdb) ptype 0xffffffff
47422          type = unsigned int
47423          (gdb) ptype 0xffffffffffffffff
47424          type = unsigned long
47425
47426         This patch...
47427
47428         * Makes the testcase iterate over all architectures, thus covering all
47429           the different combinations of types/sizes every time.
47430
47431         * Adjusts the expected values and types based on the sizes of long
47432           long, long and int.
47433
47434         A particularly curious architecture is s12z, which has 32-bit long
47435         long, and thus no way to represent 64-bit integers in C-like
47436         languages.
47437
47438         Co-Authored-By: Luis Machado <luis.machado@arm.com>
47439         Change-Id: Ifc0ccd33e7fd3c7585112ff6bebe7d266136768b
47440
47441 2022-04-27  Tom Tromey  <tromey@adacore.com>
47442
47443         Fix gdbserver build for x86-64 Windows
47444         I broke the gdbserver build on x86-64 Windows a little while back.
47445         Previously, I could not build this configuration, but today I found
47446         out that if I configure with:
47447
47448             --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
47449
47450         using the Fedora 34 tools, it will in fact build.  I'm not certain,
47451         but maybe the gnulib update helped with this.
47452
47453         This patch fixes the build.  I'm checking it in.
47454
47455 2022-04-27  John Baldwin  <jhb@FreeBSD.org>
47456
47457         Create pseudo sections for NT_ARM_TLS notes on FreeBSD.
47458         bfd/ChangeLog:
47459
47460                 * elf.c (elfcore_grok_freebsd_note): Handle NT_ARM_TLS notes.
47461
47462 2022-04-27  Christophe Lyon  <christophe.lyon@arm.com>
47463
47464         gdb/arm: Extend arm_m_addr_is_magic to support FNC_RETURN, add unwind-secure-frames command
47465         This patch makes use of the support for several stack pointers
47466         introduced by the previous patch to switch between them as needed
47467         during unwinding.
47468
47469         It introduces a new 'unwind-secure-frames' arm command to enable/disable
47470         mode switching during unwinding. It is enabled by default.
47471
47472         It has been tested using an STM32L5 board (with cortex-m33) and the
47473         sample applications shipped with the STM32Cube development
47474         environment: GTZC_TZSC_MPCBB_TrustZone in
47475         STM32CubeL5/Projects/NUCLEO-L552ZE-Q/Examples/GTZC.
47476
47477         The test consisted in setting breakpoints in various places and check
47478         that the backtrace is correct: SecureFault_Callback (Non-secure mode),
47479         __gnu_cmse_nonsecure_call (before and after the vpush instruction),
47480         SecureFault_Handler (Secure mode).
47481
47482         This implies that we tested only some parts of this patch (only MSP*
47483         were used), but remaining parts seem reasonable.
47484
47485 2022-04-27  Christophe Lyon  <christophe.lyon@arm.com>
47486
47487         gdb/arm: Add support for multiple stack pointers on Cortex-M
47488         Armv8-M architecture with Security extension features four stack pointers
47489         to handle Secure and Non-secure modes.
47490
47491         This patch adds support to switch between them as needed during
47492         unwinding, and replaces all updates of cache->prev_sp with calls to
47493         arm_cache_set_prev_sp.
47494
47495 2022-04-27  Christophe Lyon  <christophe.lyon@arm.com>
47496
47497         gdb/arm: Introduce arm_cache_init
47498         This patch is a preparation for the rest of the series and adds two
47499         arm_cache_init helper functions. It updates every place that updates
47500         cache->saved_regs to call the helper instead.
47501
47502         gdb/arm: Define MSP and PSP registers for M-Profile
47503         This patch removes the hardcoded access to PSP in
47504         arm_m_exception_cache() and relies on the definition with the XML
47505         descriptions.
47506
47507 2022-04-27  Christophe Lyon  <christophe.lyon@arm.com>
47508
47509         gdb/arm: Fix prologue analysis to support vpush
47510         While working on adding support for Non-secure/Secure modes unwinding,
47511         I noticed that the prologue analysis lacked support for vpush, which
47512         is used for instance in the CMSE stub routine.
47513
47514         This patch updates thumb_analyze_prologue accordingly, adding support
47515         for vpush of D-registers.
47516
47517 2022-04-27  Enze Li  <lienze2010@hotmail.com>
47518
47519         gdb/testsuite: fix FAIL in gdb.base/clear_non_user_bp.exp
47520         Tom and Simon feedback that there is a test failing in this commit:
47521
47522           commit a5c69b1e49bae4d0dcb20f324cebb310c63495c6
47523           Date:   Sun Apr 17 15:09:46 2022 +0800
47524
47525             gdb: fix using clear command to delete non-user breakpoints(PR cli/7161)
47526
47527         Then, I reproduced the same fail with Ubuntu 20.04 as Simon said, and I
47528         fixed the nit in this patch.  The root of the problem is not correctly
47529         matching the presentation of internal breakpoints.
47530
47531         In addition, as Pedro pointed out, the original testcase is not portable
47532         in some methods, so this patch fixes this issue and some other
47533         improvements.
47534
47535         Tested on x86_64 ubuntu 20.04.4 and openSUSE Tumbleweed(VERSION_ID="20220425").
47536
47537 2022-04-27  Jan Beulich  <jbeulich@suse.com>
47538
47539         x86: VFPCLASSSH is Evex.LLIG
47540         This also was mistakenly flagged as Evex.128.
47541
47542 2022-04-27  Nick Clifton  <nickc@redhat.com>
47543
47544         Fix potential buffer overruns when creating DLLs.
47545                 PR 29006
47546                 * pe-dll.c (make_head): Use asprintf to allocate and populate a
47547                 buffer containing the temporary name.
47548                 (make_tail, make_one, make_singleton_name_thunk): Likewise.
47549                 (make_import_fixup_mark, make_import_fixup_entry): Likewise.
47550                 (make_runtime_pseudo_reloc): Likewise.
47551                 (pe_create_runtime_relocator_reference): Likewise.
47552
47553 2022-04-27  Alan Modra  <amodra@gmail.com>
47554
47555         Revert pr29072 lto test changes
47556         Revert commit 65daf5bed6 testsuite changes in ld-plugin/.  -z isn't
47557         supported for non-ELF targets, and isn't needed since we now prune the
47558         exec stack warning (commit 333cd559ba).
47559
47560                 PR 29072
47561
47562 2022-04-27  Simon Marchi  <simon.marchi@polymtl.ca>
47563
47564         gdb/testsuite: use with_cwd where possible
47565         I learned about with_cwd today.  I spotted a few spots that could use
47566         it, to make the code more robust.
47567
47568         Change-Id: Ia23664cb827f25e79d31948e0c006a8dc61c33e1
47569
47570 2022-04-27  GDB Administrator  <gdbadmin@sourceware.org>
47571
47572         Automatic date update in version.in
47573
47574 2022-04-26  Carl Love  <cel@us.ibm.com>
47575
47576         GDB PowerPC record test cases for ISA 2.06 and ISA 3.1
47577         This patch adds PowerPC specific tests to verify recording of various
47578         instructions.  The first test case checks the ISA 2.06 lxvd2x instruction.
47579         The second test case tests several of the ISA 3.01 instructions.  Specifically,
47580         it checks the word and prefixed instructions and some of the Matrix
47581         Multiply Assist (MMA) instructions.
47582
47583         The patch has been run on both Power 10 and Power 9 to verify the ISA
47584         2.06 test case runs on both platforms without errors.  The ISA 3.1 test
47585         runs without errors on Power 10 and is skipped as expected on Power 9.
47586
47587 2022-04-26  Carl Love  <cel@us.ibm.com>
47588
47589         Add recording support for the ISA 3.1 PowerPC instructions.
47590         This patch adds support for the PowerPC ISA 3.1 instructions to the PowerPC
47591         gdb instruction recording routines.  Case statement entries are added to a
47592         number of the existing routines for recording the 32-bit word instructions.
47593         A few new functions were added to handle the new word instructions.  The 64-bit
47594         prefix instructions are all handled by a set of new routines.  The function
47595         ppc_process_prefix_instruction() is the primary function to handle the
47596         prefixed instructions. It calls additional functions to handle specific
47597         sets of prefixed instructions.  These new functions are:
47598           ppc_process_record_prefix_vsx_d_form(),
47599           ppc_process_record_prefix_store_vsx_ds_form(),
47600           ppc_process_record_prefix_op34(),
47601           ppc_process_record_prefix_op33(),
47602           ppc_process_record_prefix_op32(),
47603           ppc_process_record_prefix_store(),
47604           ppc_process_record_prefix_op59_XX3(),
47605           ppc_process_record_prefix_op42().
47606
47607 2022-04-26  Tom Tromey  <tromey@adacore.com>
47608
47609         Handle encoding failures in Windows thread names
47610         Internally at AdaCore, we noticed that the new Windows thread name
47611         code could fail.  First, it might return a zero-length string, but in
47612         gdb conventions it should return nullptr instead.  Second, an encoding
47613         failure could wind up showing replacement characters to the user; this
47614         is confusing and not useful; it's better to recognize such errors and
47615         simply discard the name.  This patch makes both of these changes.
47616
47617 2022-04-26  H.J. Lu  <hjl.tools@gmail.com>
47618
47619         i386: Pass -z noexecstack to linker tests
47620                 PR ld/29072
47621                 * testsuite/ld-i386/i386.exp: Pass -z noexecstack to gotpc1
47622                 and property-6.
47623
47624 2022-04-26  John Baldwin  <jhb@FreeBSD.org>
47625
47626         bsd-kvm: Fix build after recent changes to path handling functions.
47627         Convert bsd_kvm_corefile and the local filename in bsd_kvm_open to
47628         std::string rather than simple char * pointers freed by xfree.
47629
47630 2022-04-26  Simon Marchi  <simon.marchi@polymtl.ca>
47631
47632         gdb: make some random Python files Python 3-compatible
47633         I noticed that these files failed to format with Black, because they use
47634         print without parenthesis (which isn't Python 3 compatible).
47635
47636         I don't know if these files are still relevant, but the change is
47637         trivial, so here it is.
47638
47639         Change-Id: I116445c2b463486016f824d32effffc915b60766
47640
47641 2022-04-26  Carl Love  <cel@us.ibm.com>
47642
47643         PowerPC: Update expected floating point output for gdb.arch/altivec-regs.exp and gdb.arch/vsx-regs.exp
47644         The format for printing the floating point values was changed by commit:
47645
47646            commit 56262a931b7ca8ee3ec9104bc7e9e0b40cf3d64e
47647            Author: Tom Tromey <tromey@adacore.com>
47648            Date:   Thu Feb 17 13:43:59 2022 -0700
47649
47650                Change how "print/x" displays floating-point value
47651
47652                Currently, "print/x" will display a floating-point value by first
47653                casting it to an integer type.  This yields weird results like:
47654
47655                    (gdb) print/x 1.5
47656                    $1 = 0x1
47657                 ...
47658                 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16242
47659
47660         The above change results in 417 regression test failures since the expected
47661         Power vector register output no longer match.
47662
47663         This patch updates the expected Altivec floating point register prints to
47664         the hexadecimal format for both big endian and little endian systems.  The
47665         patch also fixes a formatting isue with the decimal_vector expected value
47666         assign statements.
47667
47668         The expected VSX vector_register1, vector_register1_vr, vector_register2,
47669         vector_register2_vr variables are updated to include the new float128 entry.
47670         Additionally, the comment in the vsx expect file about the initialization
47671         of the vs registers is updated.
47672
47673         The patch has been tested on Power 10, Power 8 LE and Power 8 BE.
47674
47675 2022-04-26  John Baldwin  <jhb@FreeBSD.org>
47676
47677         gdbsupport/pathstuff.h: #include <array> explicitly for std::array<>
47678         This fixes build breakage using clang with libc++ on FreeBSD where
47679         std::array<> is not yet declared when used by the path_join variadic
47680         function template.
47681
47682 2022-04-26  GDB Administrator  <gdbadmin@sourceware.org>
47683
47684         Automatic date update in version.in
47685
47686 2022-04-25  Tom Tromey  <tromey@adacore.com>
47687
47688         Do not put linkage names into .gdb_index
47689         This changes the .gdb_index writer to skip linkage names.  This was
47690         always done historically (though somewhat implicitly).
47691
47692 2022-04-25  Nick Clifton  <nickc@redhat.com>
47693
47694         Emit a note warning the user that creating an executable stack because of a missing .note.GNU-stack section is deprecated.
47695                 PR 29072
47696         bfd     * elflink.c (bfd_elf_size_dynamic_sections): Display a note to the
47697                 user that the current ehaviour of creating an executable stack
47698                 because of a missing .note.GNU-stack section is deprecated and
47699                 will be changed in a future release.
47700
47701         binutils* testsuite/lib/binutils-common.exp (prune_warnings_extra): Filter
47702                 out notes about the executable stacjk behaviour beign deprecated.
47703
47704         ld      * testsuite/ld-elf/pr29072.b.warn: Update to include the note
47705                 about the linker's behaviour being depreccated.
47706
47707 2022-04-25  rupothar  <rupesh.potharla@amd.com>
47708
47709         gdb/fortran: Support for assumed rank zero
47710         If a variable is passed to function in FORTRAN as an argument the
47711         variable is treated as an array with rank zero.  GDB currently does
47712         not support the case for assumed rank 0.  This patch provides support
47713         for assumed rank 0 and updates the testcase as well.
47714
47715         Without patch:
47716         Breakpoint 1, arank::sub1 (a=<error reading variable:
47717           failed to resolve dynamic array rank>) at assumedrank.f90:11
47718         11       PRINT *, RANK(a)
47719         (gdb) p a
47720         failed to resolve dynamic array rank
47721         (gdb) p rank(a)
47722         failed to resolve dynamic array rank
47723
47724         With patch:
47725         Breakpoint 1, arank::sub1 (a=0) at assumedrank.f90:11
47726         11       PRINT *, RANK(a)
47727         (gdb) p a
47728         $1 = 0
47729         (gdb) p rank(a)
47730         $2 = 0
47731
47732 2022-04-25  Lancelot SIX  <lancelot.six@amd.com>
47733
47734         gdb/infrun: assert !step_over_info_valid_p in restart_threads
47735         While working in gdb/infrun.c:restart_threads, I was wondering what are
47736         the preconditions to call the function.  It seems to me that
47737         !step_over_info_valid_p should be a precondition (i.e. if we are doing
47738         an inline step over breakpoint, we do not want to resume non stepping
47739         threads as one of them might miss the breakpoint which is temporally
47740         disabled).
47741
47742         To convince myself that this is true, I have added an assertion to
47743         enforce this, and got one regression in the testsuite:
47744
47745             FAIL: gdb.base/step-over-syscall.exp: vfork: displaced=off: single step over vfork (GDB internal error)
47746
47747         This call to restart_threads originates from handle_vfork_done which
47748         does not check if a step over is active when restarting other threads:
47749
47750             if (target_is_non_stop_p ())
47751               {
47752                 scoped_restore_current_thread restore_thread;
47753
47754                 insert_breakpoints ();
47755                 restart_threads (event_thread, event_thread->inf);
47756                 start_step_over ();
47757               }
47758
47759         In this patch, I propose to:
47760         - Call start_step_over before restart_threads.  If a step over is already
47761           in progress (as it is the case in the failing testcase),
47762           start_step_over return immediately, and there is no point in restarting
47763           all threads just to stop them right away for a step over breakpoint.
47764         - Only call restart_threads if no step over is in progress at this
47765           point.
47766
47767         In this patch, I also propose to keep the assertion in restart_threads
47768         to help enforce this precondition, and state it explicitly.
47769
47770         I have also checked all other places which call restart_threads, and
47771         they all seem to check that there is no step over currently active
47772         before doing the call.
47773
47774         As for infrun-related things, I am never completely sure I did not miss
47775         something.  So as usual, all feedback and thoughts are very welcome.
47776
47777         Tested on x86_64-linux-gnu.
47778
47779         Change-Id: If5f5f98ec4cf9aaeaabb5e3aa88ae6ffd70d4f37
47780
47781 2022-04-25  GDB Administrator  <gdbadmin@sourceware.org>
47782
47783         Automatic date update in version.in
47784
47785 2022-04-24  Andrew Burgess  <aburgess@redhat.com>
47786
47787         gdb: move setbuf calls out of gdb_readline_no_editing_callback
47788         After this commit:
47789
47790           commit d08cbc5d3203118da5583296e49273cf82378042
47791           Date:   Wed Dec 22 12:57:44 2021 +0000
47792
47793               gdb: unbuffer all input streams when not using readline
47794
47795         Issues were reported with some MS-Windows hosts, see the thread
47796         starting here:
47797
47798           https://sourceware.org/pipermail/gdb-patches/2022-March/187004.html
47799
47800         Filed in bugzilla as: PR mi/29002
47801
47802         The problem seems to be that calling setbuf on terminal file handles
47803         is not always acceptable, see this mail for more details:
47804
47805           https://sourceware.org/pipermail/gdb-patches/2022-April/187310.html
47806
47807         This commit does two things, first moving the setbuf calls out of
47808         gdb_readline_no_editing_callback so that we don't end up calling
47809         setbuf so often.
47810
47811         Then, for MS-Windows hosts, we don't call setbuf for terminals, this
47812         appears to resolve the issues that have been reported.
47813
47814         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29002
47815
47816 2022-04-24  GDB Administrator  <gdbadmin@sourceware.org>
47817
47818         Automatic date update in version.in
47819
47820 2022-04-23  GDB Administrator  <gdbadmin@sourceware.org>
47821
47822         Automatic date update in version.in
47823
47824 2022-04-22  Simon Marchi  <simon.marchi@efficios.com>
47825
47826         gdb: handle_no_resumed: only update thread list of event target
47827         When running:
47828
47829             $ make check TESTS="gdb.multi/multi-re-run.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
47830
47831         I get:
47832
47833             target remote localhost:2347^M
47834             Remote debugging using localhost:2347^M
47835             Reading symbols from /lib64/ld-linux-x86-64.so.2...^M
47836             Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.31.so...^M
47837             0x00007ffff7fd0100 in _start () from /lib64/ld-linux-x86-64.so.2^M
47838             (gdb) continue^M
47839             Continuing.^M
47840             Cannot execute this command while the target is running.^M
47841             Use the "interrupt" command to stop the target^M
47842             and then try again.^M
47843             (gdb) FAIL: gdb.multi/multi-re-run.exp: re_run_inf=1: iter=1: runto: run to all_started
47844
47845         The test does:
47846
47847          - Connect to a remote target with inferior 2, continue and stop on the
47848            all_started function
47849          - Connect to a separate remote target / GDBserver instance with inferior 1,
47850            continue and (expect to) stop on the all_started function
47851
47852         The failure seen above happens when trying to continue inferior 1.
47853
47854         What happens is:
47855
47856          - GDB tells inferior 1's remote target to continue
47857          - We go into fetch_inferior_event, try to get an event at random from
47858            the targets
47859          - do_target_wait happens to pick inferior 2's target
47860          - That target return TARGET_WAITKIND_NO_RESUMED, which makes sense:
47861            inferior 2 is stopped, that target has no resumed thread
47862          - handle_no_resumed tries to update the thread list of all targets:
47863
47864            for (auto *target : all_non_exited_process_targets ())
47865              {
47866                switch_to_target_no_thread (target);
47867                update_thread_list ();
47868              }
47869
47870          - When trying to update the thread list of inferior 1's target, it hits
47871            the "Cannot execute this command while the target is running" error.
47872            This target is working in "remote all-stop" mode, and it is currently
47873            waiting for a stop reply, so it can't send packets to update the
47874            thread list at this time.
47875
47876         To handle the problem described in the comment in handle_no_resumed, I
47877         don't think it is necessary to update the thread list of all targets,
47878         but only the event target.  That comment describes a kind of race
47879         condition where some target reports a breakpoint hit for a thread and
47880         then its last remaining resumed thread exits, so sends a "no resumed"
47881         event.  If we ended up resuming the thread that hit a breakpoint, we
47882         want to ignore the "no resumed" and carry on.
47883
47884         But I don't really see why we need to update the thread list on the
47885         other targets.  I can't really articulate this, it's more a gut feeling,
47886         maybe I just fail to imagine the situation where this is needed.  But
47887         here is the patch anyway, so we can discuss it.  The patch changes
47888         handle_no_resumed to only update the thread list of the event target.
47889         This fixes the test run shown above.
47890
47891         The way I originally tried to fix this was to make
47892         remote_target::update_thread_list return early if the target is
47893         currently awaiting a stop reply, since there's no way it can update the
47894         thread list at that time.  But that felt more like papering over the
47895         problem.  I then thought that we probably shouldn't be asking the target
47896         to update the thread list unnecessarily.
47897
47898         Change-Id: Ide3df22b4f556478e155ad1c67ad4b4fe7c26a58
47899
47900 2022-04-22  Simon Marchi  <simon.marchi@polymtl.ca>
47901
47902         gdbserver/linux: free process_info_private and arch_process_info when failing to attach
47903         Running
47904
47905           $ ../gdbserver/gdbserver --once --attach :1234 539436
47906
47907         with ASan while /proc/sys/kernel/yama/ptrace_scope is set to 1 (prevents
47908         attaching) shows that we fail to free some platform-specific objects
47909         tied to the process_info (process_info_private and arch_process_info):
47910
47911             Direct leak of 32 byte(s) in 1 object(s) allocated from:
47912                 #0 0x7f6b558b3fb9 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
47913                 #1 0x562eaf15d04a in xcalloc /home/simark/src/binutils-gdb/gdbserver/../gdb/alloc.c:100
47914                 #2 0x562eaf251548 in xcnew<process_info_private> /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/poison.h:122
47915                 #3 0x562eaf22810c in linux_process_target::add_linux_process_no_mem_file(int, int) /home/simark/src/binutils-gdb/gdbserver/linux-low.cc:426
47916                 #4 0x562eaf22d33f in linux_process_target::attach(unsigned long) /home/simark/src/binutils-gdb/gdbserver/linux-low.cc:1132
47917                 #5 0x562eaf1a7222 in attach_inferior /home/simark/src/binutils-gdb/gdbserver/server.cc:308
47918                 #6 0x562eaf1c1016 in captured_main /home/simark/src/binutils-gdb/gdbserver/server.cc:3949
47919                 #7 0x562eaf1c1d60 in main /home/simark/src/binutils-gdb/gdbserver/server.cc:4084
47920                 #8 0x7f6b552f630f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f)
47921
47922             Indirect leak of 56 byte(s) in 1 object(s) allocated from:
47923                 #0 0x7f6b558b3fb9 in __interceptor_calloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
47924                 #1 0x562eaf15d04a in xcalloc /home/simark/src/binutils-gdb/gdbserver/../gdb/alloc.c:100
47925                 #2 0x562eaf2a0d79 in xcnew<arch_process_info> /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/poison.h:122
47926                 #3 0x562eaf295e2c in x86_target::low_new_process() /home/simark/src/binutils-gdb/gdbserver/linux-x86-low.cc:723
47927                 #4 0x562eaf22819b in linux_process_target::add_linux_process_no_mem_file(int, int) /home/simark/src/binutils-gdb/gdbserver/linux-low.cc:428
47928                 #5 0x562eaf22d33f in linux_process_target::attach(unsigned long) /home/simark/src/binutils-gdb/gdbserver/linux-low.cc:1132
47929                 #6 0x562eaf1a7222 in attach_inferior /home/simark/src/binutils-gdb/gdbserver/server.cc:308
47930                 #7 0x562eaf1c1016 in captured_main /home/simark/src/binutils-gdb/gdbserver/server.cc:3949
47931                 #8 0x562eaf1c1d60 in main /home/simark/src/binutils-gdb/gdbserver/server.cc:4084
47932                 #9 0x7f6b552f630f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f)
47933
47934         Those objects are deleted by linux_process_target::mourn, but that is
47935         not called if we fail to attach, we only call remove_process.  I
47936         initially fixed this by making linux_process_target::attach call
47937         linux_process_target::mourn on failure (before calling error).  But this
47938         isn't done anywhere else (including in GDB) so it would just be
47939         confusing to do things differently here.
47940
47941         Instead, add a linux_process_target::remove_linux_process helper method
47942         (which calls remove_process), and call that instead of remove_process in
47943         the Linux target.  Move the free-ing of the extra data from the mourn
47944         method to that new method.
47945
47946         Change-Id: I277059a69d5f08087a7f3ef0b8f1792a1fcf7a85
47947
47948 2022-04-22  Andrew Burgess  <aburgess@redhat.com>
47949
47950         gdb: handle bracketed-paste-mode and EOF correctly
47951         This commit replaces an earlier commit that worked around the issues
47952         reported in bug PR gdb/28833.
47953
47954         The previous commit just implemented a work around in order to avoid
47955         the worst results of the bug, but was not a complete solution.  The
47956         full solution was considered too risky to merge close to branching GDB
47957         12.  This improved fix has been applied after GDB 12 branched.  See
47958         this thread for more details:
47959
47960           https://sourceware.org/pipermail/gdb-patches/2022-March/186391.html
47961
47962         This commit replaces this earlier commit:
47963
47964           commit 74a159a420d4b466cc81061c16d444568e36740c
47965           Date:   Fri Mar 11 14:44:03 2022 +0000
47966
47967               gdb: work around prompt corruption caused by bracketed-paste-mode
47968
47969         Please read that commit for a full description of the bug, and why is
47970         occurs.
47971
47972         In this commit I extend GDB to use readline's rl_deprep_term_function
47973         hook to call a new function gdb_rl_deprep_term_function.  From this
47974         new function we can now print the 'quit' message, this replaces the
47975         old printing of 'quit' in command_line_handler.  Of course, we only
47976         print 'quit' in gdb_rl_deprep_term_function when we are handling EOF,
47977         but thanks to the previous commit (to readline) we now know when this
47978         is.
47979
47980         There are two aspects of this commit that are worth further
47981         discussion, the first is in the new gdb_rl_deprep_term_function
47982         function.  In here I have used a scoped_restore_tmpl to disable the
47983         readline global variable rl_eof_found.
47984
47985         The reason for this is that, in rl_deprep_terminal, readline will
47986         print an extra '\n' character before printing the escape sequence to
47987         leave bracketed paste mode.  You might then think that in the
47988         gdb_rl_deprep_term_function function, we could simply print "quit" and
47989         rely on rl_deprep_terminal to print the trailing '\n'.  However,
47990         rl_deprep_terminal only prints the '\n' when bracketed paste mode is
47991         on.  If the user has turned this feature off, no '\n' is printed.
47992         This means that in gdb_rl_deprep_term_function we need to print
47993         "quit" when bracketed paste mode is on, and "quit\n" when bracketed
47994         paste mode is off.
47995
47996         We could absolutely do that, no problem, but given we know how
47997         rl_deprep_terminal is implemented, it's easier (I think) to just
47998         temporarily clear rl_eof_found, this prevents the '\n' being printed
47999         from rl_deprep_terminal, and so in gdb_rl_deprep_term_function, we can
48000         now always print "quit\n" and this works for all cases.
48001
48002         The second issue that should be discussed is backwards compatibility
48003         with older versions of readline.  GDB can be built against the system
48004         readline, which might be older than the version contained within GDB's
48005         tree.  If this is the case then the system readline might not contain
48006         the fixes needed to support correctly printing the 'quit' string.
48007
48008         To handle this situation I have retained the existing code in
48009         command_line_handler for printing 'quit', however, this code is only
48010         used now if the version of readline we are using doesn't not include
48011         the required fixes.  And so, if a user is using an older version of
48012         readline, and they have bracketed paste mode on, then they will see
48013         the 'quit' sting printed on the line below the prompt, like this:
48014
48015           (gdb)
48016           quit
48017
48018         I think this is the best we can do when someone builds GDB against an
48019         older version of readline.
48020
48021         Using a newer version of readline, or the patched version of readline
48022         that is in-tree, will now give a result like this in all cases:
48023
48024           (gdb) quit
48025
48026         Which is what we want.
48027
48028         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833
48029
48030 2022-04-22  Andrew Burgess  <aburgess@redhat.com>
48031
48032         readline: back-port changes needed to properly detect EOF
48033         This commit is a partial back-port of this upstream readline commit:
48034
48035           commit 002d31aa5f5929eb32d0e0e2e8b8d35d99e59961
48036           Author: Chet Ramey <chet.ramey@case.edu>
48037           Date:   Thu Mar 3 11:11:47 2022 -0500
48038
48039               add rl_eof_found to public API; fix pointer aliasing problems  \
48040                     with history-search-backward; fix a display problem with \
48041                     runs of invisible characters at the end of a physical    \
48042                     screen line
48043
48044         I have only pulled in the parts of this commit that relate to the new
48045         rl_eof_found global, and the RL_STATE_EOF state flag.  These changes
48046         are needed in order to fix PR cli/28833, and are discussed in this
48047         thread to the bug-readline mailing list:
48048
48049           https://lists.gnu.org/archive/html/bug-readline/2022-02/msg00021.html
48050
48051         The above commit is not yet in any official readline release, but my
48052         hope is that now it has been merged into the readline tree it should
48053         be safe enough to back port this fix to GDB's tree.
48054
48055         At some point in the future we will inevitably want to roll forward
48056         the version of readline that we maintain in the binutils-gdb
48057         repository.  When that day comes the changes in this commit can be
48058         replaced with the latest upstream readline code, as I have not changed
48059         the meaning of this code at all from what is in upstream readline.
48060
48061         This commit alone does not fix the PR cli/28833 issue, for that see
48062         the next commit, which changes GDB itself.
48063
48064         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833
48065
48066 2022-04-22  Andrew Burgess  <aburgess@redhat.com>
48067
48068         gdb: improved EOF handling when using readline 7
48069         In this commit:
48070
48071           commit a6b413d24ccc5d76179bab866834e11fd6fec294
48072           Date:   Fri Mar 11 14:44:03 2022 +0000
48073
48074               gdb: work around prompt corruption caused by bracketed-paste-mode
48075
48076         a change was made to GDB to work around bug PR gdb/28833.  The
48077         consequence of this work around is that, when bracketed paste mode is
48078         enabled in readline, and GDB is quit by sending EOF, then the output
48079         will look like this:
48080
48081           (gdb)
48082           quit
48083
48084         The ideal output, which is what we get when bracketed paste mode is
48085         off, is this:
48086
48087           (gdb) quit
48088
48089         The reason we need to make this change is explained in the original
48090         commit referenced above.  What isn't mentioned in the above commit, is
48091         that the change that motivated this work around was only added in
48092         readline 8, older versions of readline don't require the change.
48093
48094         In later commits in this series I will add a fix to GDB's in-tree copy
48095         of readline (this fix is back-ported from upstream readline), and then
48096         I will change GDB so that, when using the (patched) in-tree readline,
48097         we can have the ideal output in all cases.
48098
48099         However, GDB can be built against the system readline.  When this is
48100         done, and the system readline is version 8, then we will still have to
48101         use the work around (two line) style output.
48102
48103         But, if GDB is built against the system readline, and the system
48104         readline is an older version 7 readline, then there's no reason why we
48105         can't have the ideal output, after all, readline 7 doesn't include the
48106         change that we need to work around.
48107
48108         This commit changes GDB so that, when using readline 7 we get the
48109         ideal output in all cases.  This change is trivial (a simple check
48110         against the readline version number) so I think this should be fine to
48111         include.
48112
48113         For testing this commit, you need to configure GDB including the
48114         '--with-system-readline' flag, and build GDB on a system that uses
48115         readline 7, for example 'Ubuntu 18.04'.  Then run the test
48116         'gdb.base/eof-exit.exp', you should expect everything to PASS.
48117
48118         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833
48119
48120 2022-04-22  Simon Marchi  <simon.marchi@efficios.com>
48121
48122         gdb: prune inferiors at end of fetch_inferior_event, fix intermittent failure of gdb.threads/fork-plus-threads.exp
48123         This test sometimes fail like this:
48124
48125             info threads^M
48126               Id   Target Id         Frame ^M
48127               11.12 process 2270719   Couldn't get registers: No such process.^M
48128             (gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left
48129             [Inferior 11 (process 2270719) exited normally]^M
48130             info inferiors^M
48131               Num  Description       Connection           Executable        ^M
48132             * 1    <null>                                 /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/fork-plus-threads/fork-plus-threads ^M
48133               11   <null>                                 /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/fork-plus-threads/fork-plus-threads ^M
48134             (gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited)
48135
48136         I can get it to fail quite reliably by pinning it to a core:
48137
48138           $ taskset -c 5 make check TESTS="gdb.threads/fork-plus-threads.exp"
48139
48140         The previous attempt at fixing this was:
48141
48142           https://sourceware.org/pipermail/gdb-patches/2021-October/182846.html
48143
48144         What we see is part due to a possible unfortunate ordering of events
48145         given by the kernel, and what could be considered a bug in GDB.
48146
48147         The test program makes a number of forks, waits them all, then exits.
48148         Most of the time, GDB will get and process the exit event for inferior 1
48149         after the exit events of all the children.  But this is not guaranteed.
48150         After the last child exits and is waited by the parent, the parent can
48151         exit quickly, such that GDB collects from the kernel the exit events for
48152         the parent and that child at the same time.  It then chooses one event
48153         at random, which can be the event for the parent.  This will result in
48154         the parent appearing to exit before its child.  There's not much we can
48155         do about it, so I think we have to adjust the test to cope.
48156
48157         After expect has seen the "exited normally" notification for inferior 1,
48158         it immediately does an "info thread" that it expects to come back empty.
48159         But at this point, GDB might not have processed inferior 11's (the last
48160         child) exit event, so it will look like there is still a thread.  Of
48161         course that thread is dead, we just don't know it yet.  But that makes
48162         the "no thread" test fail.  If the test waited just a bit more for the
48163         "exited normally" notification for inferior 11, then the list of threads
48164         would be empty.
48165
48166         So, first change, make the test collect all the "exited normally"
48167         notifications for all inferiors before proceeding, that should ensure we
48168         see an empty thread list.  That would fix the first FAIL above.
48169
48170         However, we would still have the second FAIL, as we expect inferior 11
48171         to not be there, it should have been deleted automatically.  Inferior 11
48172         is normally deleted when prune_inferiors is called.  That is called by
48173         normal_stop, which is only called by fetch_inferior_event only if the
48174         event thread completed an execution command FSM (thread_fsm).  But the
48175         FSM for the continue command completed when inferior 1 exited.  At that
48176         point inferior 11 was not prunable, as it still had a thread.  When
48177         inferior 11 exits, prune_inferiors is not called.
48178
48179         I think that can be considered a GDB bug.  From the user point of view,
48180         there's no reason why in one case inferior 11 would be deleted and not
48181         in the other case.
48182
48183         This patch makes the somewhat naive change to call prune_inferiors in
48184         fetch_inferior_event, so that it is called in this case.  It is placed
48185         at this particular point in the function so that it is called after the
48186         user inferior / thread selection is restored.  If it was called before
48187         that, inferior 11 wouldn't be pruned, because it would still be the
48188         current inferior.
48189
48190         Change-Id: I48a15d118f30b1c72c528a9f805ed4974170484a
48191         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26272
48192
48193 2022-04-22  Tom Tromey  <tromey@adacore.com>
48194
48195         Un-break the coff-pe-read.c build
48196         This fixes a build breakage in my recent coff-pe-read.c change.
48197
48198         I'm sorry about this.  I don't understand how it happened, because I
48199         definitely built and tested the series on Windows, and I didn't change
48200         it before pushing.  Something must have gone wrong on the Windows
48201         build, but I don't know what.  I'll investigate and and re-test to be
48202         sure.
48203
48204 2022-04-22  Tom Tromey  <tromey@adacore.com>
48205
48206         More const use and alloca avoidance in coff-pe-read.c
48207         This changes another function in coff-pe-read.c to use 'const' more,
48208         and to avoid the use of alloca by instead using std::string.
48209
48210         Use std::string in coff-pe-read.c
48211         coff-pe-read.c uses xsnprintf and alloca, but using std::string is
48212         better, and just as easy.  In general I think alloca is something to
48213         be avoided, and unbounded uses especially so.
48214
48215         Remove a const-removing cast from coff-pe-read.c
48216         coff-pe-read.c casts away const at one spot, but this is easily
48217         replaced by calling bfd_get_filename directly in a couple of debugging
48218         prints.
48219
48220         Simplify BFD section iteration in coff-pe-read.c
48221         coff-pe-read.c iterates over BFD sections using bfd_map_over_sections,
48222         but it's much simpler to use a for-each loop.  This allows for the
48223         removal of helper functions and types.
48224
48225 2022-04-22  Tom Tromey  <tromey@adacore.com>
48226
48227         Fix method naming bug in new DWARF indexer
48228         Pedro pointed out that gdb-add-index is much slower with the new DWARF
48229         indexer.  He also noticed that, in some cases, the generated
48230         .gdb_index would have the wrong fully-qualified name for a method.
48231
48232         I tracked this down to a bug in the indexer.  If a type could have
48233         methods but was marked as a declaration, the indexer was ignoring it.
48234         However, this meant that the internal map to find the qualified name
48235         was not updated for this container.
48236
48237 2022-04-22  Christoph Muellner  <cmuellner@gcc.gnu.org>
48238
48239         RISC-V: Add missing DECLARE_INSNs for Zicbo{m,p,z}
48240         The recently added support for the Zicbo{m,p,z} extensions did not
48241         include DECLARE_INSN() declarations for the instructions.
48242         These declarations are needed by GDB's instruction detection code.
48243         This patch adds them.
48244
48245 2022-04-22  GDB Administrator  <gdbadmin@sourceware.org>
48246
48247         Automatic date update in version.in
48248
48249 2022-04-21  Carl Love  <cel@us.ibm.com>
48250
48251         Fix for gdb.base/solib-search.exp test.
48252         The variable right_lib_flags is not being set correctly to define RIGHT.
48253         The value RIGHT is needed to force the address of the library functions
48254         lib1_func3 and lib2_func4 to occur at different address in the wrong and
48255         right libraries.
48256
48257         With RIGHT defined correctly, functions lib1_func3 and lib2_func4 occur
48258         at different addresses the test runs correctly on Powerpc.
48259
48260         The test needs the lib2 addresses to be different in the right and
48261         wrong cases.  That is the point of introducing function lib2_spacer
48262         with the ifdef RIGHT compiler directive.
48263
48264         On Intel, the ARRAY_SIZE of 1 versus 8192 is sufficient to get the
48265         dynamic linker to move the addresses of the library.  You can also get
48266         the same effect on PowerPC but you must use a value much larger than
48267         8192.
48268
48269         The key thing is that the test was not properly setting RIGHT to
48270         defined to get the lib2_spacer function on Intel and Powerpc.
48271
48272         Without the patch, we have the Intel backtrace for the bad libraries:
48273
48274         backtrace
48275         #0  break_here () at /home/ ... /gdb/testsuite/gdb.base/solib-search.c:30
48276         #1  0x00007ffff7fae156 in ?? ()
48277         #2  0x00007fffffffc150 in ?? ()
48278         #3  0x00007ffff7fbb156 in ?? ()
48279         #4  0x00007fffffffc160 in ?? ()
48280         #5  0x00007ffff7fae146 in ?? ()
48281         #6  0x00007fffffffc170 in ?? ()
48282         #7  0x00007ffff7fbb146 in ?? ()
48283         #8  0x00007fffffffc180 in ?? ()
48284         #9  0x0000555555555156 in main () at /home/ ... /binutils-gdb/gdb/testsuite/gdb.base/solib-search.c:23
48285         Backtrace stopped: previous frame inner to this frame (corrupt stack?)
48286         (gdb) PASS: gdb.base/solib-search.exp: backtrace (with wrong libs) (data collection)
48287
48288         The backtrace on Intel with the good libraries is:
48289
48290         backtrace
48291         #0  break_here () at /.../binutils-gdb/gdb/testsuite/gdb.base/solib-search.c:30
48292         #1  0x00007ffff7fae156 in lib2_func4 () at /.../binutils-gdb/gdb/testsuite/gdb.base/solib-search-lib2.c:49
48293         #2  0x00007ffff7fbb156 in lib1_func3 () at /.../gdb.base/solib-search-lib1.c:49
48294         #3  0x00007ffff7fae146 in lib2_func2 () at /.../testsuite/gdb.base/solib-search-lib2.c:30
48295         #4  0x00007ffff7fbb146 in lib1_func1 () at /.../gdb.base/solib-search-lib1.c:30
48296         #5  0x0000555555555156 in main () at /...solib-search.c:23
48297         (gdb) PASS: gdb.base/solib-search.exp: backtrace (with right libs) (data collection)
48298         PASS: gdb.base/solib-search.exp: backtrace (with right libs)
48299
48300         In one case the backtrace is correct and the other it
48301         is wrong on Intel.  This is due to the fact that the ARRAY_SIZE caused
48302         the dynamic linker to move the library function addresses around.  I
48303         believe it has to do with the default size of the data and code
48304         sections used by the dynamic linker.
48305
48306         So without the patch the backtrace on PowerPC looks like:
48307
48308          backtrace
48309         #0  break_here () at /.../solib-search.c:30
48310         #1  0x00007ffff7f007f4 in lib2_func4 () at /.../solib-search-lib2.c:49
48311         #2  0x00007ffff7f307f4 in lib1_func3 () at /.../solib-search-lib1.c:49
48312         #3  0x00007ffff7f007ac in lib2_func2 () at /.../solib-search-lib2.c:30
48313         #4  0x00007ffff7f307ac in lib1_func1 () at /.../solib-search-lib1.c:30
48314         #5  0x000000001000074c in main () at /.../solib-search.c:23
48315
48316         for both the good and bad libraries.
48317
48318         The patch fixes defining RIGHT in solib-search-lib1.c and solib-search-
48319         lib2.c.  Note, without the patch the lib1_spacer and lib2_spacer
48320         functions do not show up in the object dump of the Intel or Powerpc
48321         libraries as it should.  The patch fixes that by making sure RIGHT gets
48322         defined.
48323
48324         Now with the patch the backtrace for the bad library on PowerPC looks
48325         like:
48326
48327         backtrace
48328         #0  break_here () at /.../solib-search.c:30
48329         #1  0x00007ffff7f0083c in __glink_PLTresolve () from /.../solib-search-lib2.so
48330         Backtrace stopped: frame did not save the PC
48331
48332         And the backtrace for the good libraries on PowerPC looks like:
48333
48334         backtrace
48335         #0  break_here () at /.../solib-search.c:30
48336         #1  0x00007ffff7f0083c in lib2_func4 () at /.../solib-search-lib2.c:49
48337         #2  0x00007ffff7f3083c in lib1_func3 () at /.../solib-search-lib1.c:49
48338         #3  0x00007ffff7f007cc in lib2_func2 () at /.../solib-search-lib2.c:30
48339         #4  0x00007ffff7f307cc in lib1_func1 () at /.../solib-search-lib1.c:30
48340         #5  0x000000001000074c in main () at /.../solib-search.c:23
48341         (gdb) PASS: gdb.base/solib-search.exp: backtrace (with right libs) (data collection)
48342         PASS: gdb.base/solib-search.exp: backtrace (with right libs)
48343
48344         The issue then is on Power where the ARRAY_SIZE of 1 versus 8192 is not
48345         sufficient to cause the dymanic linker to allocate the libraries at
48346         different addresses.  I don't claim to understand the specifics of how
48347         the dynamic linker works and what the default size is for the data and
48348         code sections are.  My guess is by default PowerPC allocates a larger
48349         data size by default, which is large enough to hold array[8192].  The
48350         default size of the data section allocated by the dynamic linker on
48351         Intel is not large enough to hold array[8192] thus causing the code
48352         section on Intel to have to move when the large array is defined.
48353
48354         Note on PowerPC, if you make ARRAY_SIZE big enough, then you will cause
48355         the library addresses to occur at different addresses as the larger
48356         data section forces the code section to a different address.  That was
48357         actually my original fix for the program until I spoke with Doug Evans
48358         who originally wrote the test.  Doug noticed that RIGHT was not getting
48359         defined as he originally intended in the test.
48360
48361         With the patch to fix the definition of RIGHT, PowerPC has a bad and a
48362         good backtrace because the address of lib1_func3 and lib2_func4 both
48363         move because lib1_spacer and lib2_spacer are now defined
48364         before lib1_func3 and lib2_func4.
48365
48366         Without the patch, the lib1_spacer and lib2_spacer function doesn't show
48367         up in the binary for the correct or incorrect library on Intel or PowerPC.
48368         With the patch, RIGHT gets defined as originally intended for the test on
48369         both architectures and lib1_spacer and lib2_spacer function show up in the
48370         binaries on both architectures changing the other function addresses as
48371         intended thus causing the test work as intended on PowerPC.
48372
48373 2022-04-21  Simon Marchi  <simon.marchi@efficios.com>
48374
48375         gdb/dwarf: remove line_header::header_length field
48376         This can be a local in dwarf_decode_line_header.
48377
48378         Change-Id: I2ecf4616d1a3197bd1e81ded9f999a2da9a685af
48379
48380 2022-04-21  Simon Marchi  <simon.marchi@efficios.com>
48381
48382         gdb/dwarf: remove line_header::total_length field
48383         This doesn' have to be a field, it can simply be a local variable in
48384         dwarf_decode_line_header.  Name the local variable "unit_length", since
48385         that's what the field in called in DWARF 4 and 5.  It's always easier to
48386         follow the code with the standard on the side when we use the same
48387         terminology.
48388
48389         Change-Id: I3ad1022afd9410b193ea11b9b5437686c1e4e633
48390
48391 2022-04-21  Simon Marchi  <simon.marchi@efficios.com>
48392
48393         gdb/testsuite: fix "set temporary breakpoint" DUPLICATEs
48394         Commit c67f4e538 ("gdb/testsuite: make gdb.ada/mi_prot.exp stop at
48395         expected location") introduced some DUPLICATEs in MI tests using
48396         mi_continue_to_line, for example:
48397
48398             DUPLICATE: gdb.ada/mi_ref_changeable.exp: mi_continue_to_line: set temporary breakpoint
48399
48400         These test names were previously differentiated by the location passed
48401         to mi_continue_to_line.  Since the location can contain a path, that
48402         commit removed the location from the test name, in favor of a hardcoded
48403         string "set temporary breakpoint", hence removing the differentiator.
48404
48405         mi_continue_to_line receives a "test" parameter, containing a test
48406         name.  Add a "with_test_prefix" with that name, so that all tests
48407         recorded during mi_continue_to_line have this in their name.
48408
48409         mi_continue_to_line passes that "test" string to mi_get_stop_line, that
48410         is a bit superfluous.  mi_get_stop_line only uses that string in case of
48411         failures (it doesn't record a pass if everything goes fine).  Since it's
48412         not crucial, just remove it, and adjust all callers.
48413
48414         Adjust three gdb.mi/mi-var-*.exp tests to use prefixes to differentiate
48415         the multiple calls to mi_run_inline_test (which calls
48416         mi_continue_to_line).
48417
48418         Change-Id: I511c6caa70499f8657b1cde37d71068d74d56a74
48419
48420 2022-04-21  Tom Tromey  <tromey@adacore.com>
48421
48422         Always use dwarf2_initialize_objfile
48423         Internally we noticed that some tests would fail like so on Windows:
48424
48425         warning: Section .debug_aranges in [...] has duplicate debug_info_offset 0x0, ignoring .debug_aranges.
48426
48427         Debugging showed that, in fact, a second CU was being created at this
48428         offset.  We tracked this down to the fact that, while the ELF reader
48429         is careful to re-use the per-BFD data, other readers are not, and
48430         could re-read the DWARF data multiple times.
48431
48432         However, since the change to allow an objfile to have multiple "quick
48433         symbol" implementations, there's no reason for this approach -- it's
48434         safe and easy for all symbol readers to reuse the per-BFD data when
48435         reading DWARF.
48436
48437         This patch implements this idea, simplifying dwarf2_build_psymtabs and
48438         making it private, and then switching to dwarf2_initialize_objfile as
48439         the sole way to start the DWARF reader.
48440
48441         Note that, while I think the call to dwarf2_build_frame_info in
48442         machoread.c is also obsolete, I haven't attempted to remove it here.
48443
48444 2022-04-21  Andrew Burgess  <aburgess@redhat.com>
48445
48446         gdb: fix 'remote show FOO-packet' aliases
48447         The following behaviour was observed in GDB:
48448
48449           (gdb) show remote X-packet
48450           Support for the `p' packet is auto-detected, currently unknown.
48451
48452         Note the message mentions the 'p' packet.  This is a regression since
48453         this commit:
48454
48455           commit 8579fd136a614985bd27f20539c7bb7c5a51287d
48456           Date:   Mon Nov 8 14:58:46 2021 +0000
48457
48458               gdb/gdbsupport: make xstrprintf and xstrvprintf return a unique_ptr
48459
48460         Before this commit the behaviour was:
48461
48462           (gdb) show remote X-packet
48463           Support for the `X' packet is auto-detected, currently unknown.
48464
48465         The problem was caused by a failed attempt to ensure that some
48466         allocated strings were deleted when GDB exits.  The code in the above
48467         commit attempted to make use of 'static' to solve this problem,
48468         however, the solution was just wrong.
48469
48470         In this new commit I instead allocate a static vector into which all
48471         the allocated strings are stored, this ensures the strings are
48472         released when GDB exits (which makes output from tools like valgrind
48473         cleaner), but each string within the vector can be unique, which fixes
48474         the regression.
48475
48476 2022-04-21  Simon Marchi  <simon.marchi@efficios.com>
48477
48478         gdbsupport: add path_join function
48479         In this review [1], Eli pointed out that we should be careful when
48480         concatenating file names to avoid duplicated slashes.  On Windows, a
48481         double slash at the beginning of a file path has a special meaning.  So
48482         naively concatenating "/"  and "foo/bar" would give "//foo/bar", which
48483         would not give the desired results.  We already have a few spots doing:
48484
48485           if (first_path ends with a slash)
48486             path = first_path + second_path
48487           else
48488             path = first_path + slash + second_path
48489
48490         In general, I think it's nice to avoid superfluous slashes in file
48491         paths, since they might end up visible to the user and look a bit
48492         unprofessional.
48493
48494         Introduce the path_join function that can be used to join multiple path
48495         components together (along with unit tests).
48496
48497         I initially wanted to make it possible to join two absolute paths, to
48498         support the use case of prepending a sysroot path to a target file path,
48499         or the prepending the debug-file-directory to a target file path.  But
48500         the code in solib_find_1 shows that it is more complex than this anyway
48501         (for example, when the right hand side is a Windows path with a drive
48502         letter).  So I don't think we need to support that case in path_join.
48503         That also keeps the implementation simpler.
48504
48505         Change a few spots to use path_join to show how it can be used.  I
48506         believe that all the spots I changed are guarded by some checks that
48507         ensure the right hand side operand is not an absolute path.
48508
48509         Regression-tested on Ubuntu 18.04.  Built-tested on Windows, and I also
48510         ran the new unit-test there.
48511
48512         [1] https://sourceware.org/pipermail/gdb-patches/2022-April/187559.html
48513
48514         Change-Id: I0df889f7e3f644e045f42ff429277b732eb6c752
48515
48516 2022-04-21  Lancelot SIX  <lancelot.six@amd.com>
48517
48518         gdb_spawn_attach_cmdline: use unsupported instead of untested
48519         In a previous commit (b750766ac96: gdb/testsuite: Introduce and use
48520         gdb_spawn_attach_cmdline), if gdb_spawn_attach_cmdline cannot have GDB
48521         attach to the process because of ptrace restrictions (operation not
48522         permitted), the proc issues UNTESTED.  This should really be
48523         UNSUPPORTED, as it is done in gdb_attach.
48524
48525         This patch fixes this oversight.
48526
48527         Change-Id: Ib87e33b9230f3fa7a85e06220ef4c63814b71f7d
48528
48529 2022-04-21  Enze Li  <lienze2010@hotmail.com>
48530
48531         gdb/testsuite: add binary testcases to py-format-string.exp
48532         We currently only test decimal and hexadecimal for the
48533         gdb.Value.format_string() interface, this patch adds testcases for
48534         binary format.
48535
48536         Tested on x86_64 openSUSE Tumbleweed(VERSION_ID="20220413").
48537
48538 2022-04-21  Pedro Alves  <pedro@palves.net>
48539
48540         gdb.debuginfod/fetch_src_and_symbols.exp: Fix "notice empty URL" test
48541         The gdb_test_multiple pattern for the "notice empty URL" test in
48542         gdb.debuginfod/fetch_src_and_symbols.exp misses expecting the prompt.
48543         Fix it by using -re -wrap.
48544
48545         Also, by using "confirm off", the message GDB prints if Debuginfod
48546         downloading is available doesn't contain "Enable debuginfod" any
48547         longer.  E.g.:
48548
48549         ~~~
48550           (gdb) file testsuite/outputs/gdb.debuginfod/fetch_src_and_symbols/fetch_src_and_symbols
48551           Reading symbols from testsuite/outputs/gdb.debuginfod/fetch_src_and_symbols/fetch_src_and_symbols...
48552
48553           This GDB supports auto-downloading debuginfo from the following URLs:
48554             <http://localhost:123>
48555           Enable debuginfod for this session? (y or [n])
48556         ~~~
48557
48558         ~~~
48559           (gdb) with confirm off -- file testsuite/outputs/gdb.debuginfod/fetch_src_and_symbols/fetch_src_and_symbols
48560           Reading symbols from testsuite/outputs/gdb.debuginfod/fetch_src_and_symbols/fetch_src_and_symbols...
48561
48562           This GDB supports auto-downloading debuginfo from the following URLs:
48563             <http://127.0.0.1:8000>
48564             <127.0.0.1:8000>
48565           Debuginfod has been disabled.
48566           To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
48567           (No debugging symbols found in testsuite/outputs/gdb.debuginfod/fetch_src_and_symbols/fetch_src_and_symbols)
48568           (gdb)
48569         ~~~
48570
48571         I handled that correctly in the other tests that use test_urls, but
48572         had forgotten to update the "notice empty URL" one.
48573
48574         Change-Id: I00040c83466e1494b3875574eb009c571a1504bf
48575
48576 2022-04-21  Alan Modra  <amodra@gmail.com>
48577
48578         prune .note.GNU-stack warning from testsuite
48579         binutils/
48580                 * testsuite/lib/binutils-common.exp (prune_warnings_extra): Remove
48581                 .note.GNU-stack warning.
48582                 (run_dump_test): Call prune_warnings for ld and objcopy output.
48583         ld/
48584                 * testsuite/ld-elf/elf.exp: Disable prune_warnings_extra temporarily
48585                 around test for absent .note.GNU-stack
48586                 * testsuite/ld-cris/globsymw2.s,
48587                 * testsuite/ld-cris/warn3.d: Modify "is not implemented" message
48588                 to avoid dejagnu prune_warnings.
48589
48590         ld testsuite xcoff XPASS
48591                 * testsuite/ld-scripts/defined5.d: Don't xfail xcoff targets.
48592
48593         Delete unused COFF gas macro
48594                 * config/obj-coff.h (sy_obj): Don't define.
48595                 (OBJ_SYMFIELD_TYPE): Revise comments.
48596
48597 2022-04-21  GDB Administrator  <gdbadmin@sourceware.org>
48598
48599         Automatic date update in version.in
48600
48601 2022-04-20  Aaron Merey  <amerey@redhat.com>
48602
48603         gdb/debuginfod: Prevent out_of_range exception
48604         Trailing whitespace in the string of debuginfod URLs causes an
48605         out_of_range exception during the printing of URLs for the first
48606         use notice.
48607
48608         To fix this, stop printing URLs when the substring to be printed
48609         consists only of whitespace.
48610
48611         Also add first use notice testcases.
48612
48613         Co-Authored-By: Pedro Alves <pedro@palves.net>
48614
48615 2022-04-20  Lancelot SIX  <lancelot.six@amd.com>
48616
48617         gdb/testsuite: Introduce and use gdb_spawn_attach_cmdline
48618         Following a7e6a19e87f3d719ea23c65b580a6d9bca4ccab3 "gdb: testsuite: add
48619         new gdb_attach to check "attach" command", this commit proposes to
48620         introduce the gdb_spawn_attach_cmdline helper and use it in
48621         gdb.base/attach.exp.
48622
48623         This helper starts GDB and adds the "--pid=$PID" argument.
48624
48625         Also note that both the original and new implementation use
48626         gdb_spawn_with_cmdline_opts, which in the end uses default_gdb_spawn.
48627         This makes sure that we use $INTERNAL_GDBFLAGS, which by default already
48628         contain "-iex \"set height 0\" -iex \"set width 0\"".  To avoid
48629         repetition of those arguments, gdb_spawn_attach_cmdline does not repeat
48630         those arguments.
48631
48632         To maintain a behavior similat to what gdb.base/attach.exp used to do,
48633         gdb_spawn_attach_cmdline keeps the -quiet flag.
48634
48635         Tested on x86_64-gnu-linux
48636
48637         Change-Id: I1fdcdb71c86d9c5d34bb28fc86fac68bcec37358
48638
48639 2022-04-20  Tom Tromey  <tom@tromey.com>
48640
48641         Replace symbol_symtab with symbol::symtab
48642         This turns symbol_symtab into a method on symbol.  It also replaces
48643         symbol_set_symtab with a method.
48644
48645         Replace symbol_arch with symbol::arch
48646         This turns symbol_arch into a method on symbol.
48647
48648         Replace symbol_objfile with symbol::objfile
48649         This turns symbol_objfile into a method on symbol.
48650
48651         Remove symbol::aclass_index
48652         Symbols have an aclass_index method, but this isn't needed, because
48653         the aclass index isn't useful outside of the symbol implementation.
48654
48655         Use array_view for symbol_impls
48656         It seemed to me that using array_view for symbol_impls would give a
48657         bit more error checking, at least when gdb is built in libstdc++ debug
48658         mode.
48659
48660         Add accessors for symbol's artificial field
48661         For a series I'm experimenting with, it was handy to hide a symbol's
48662         "artificial" field behind accessors.  This patch is the result.
48663
48664         Unify the DWARF index holders
48665         The dwarf2_per_bfd object has a separate field for each possible kind
48666         of index.  Until an earlier patch in this series, two of these were
48667         even derived from a common base class, but still had separate slots.
48668         This patch unifies all the index fields using the common base class
48669         that was introduced earlier in this series.  This makes it more
48670         obvious that only a single index can be active at a time, and also
48671         removes some code from dwarf2_initialize_objfile.
48672
48673         Add an ad hoc version check to dwarf_scanner_base
48674         Some generic code in the DWARF reader has a special case for older
48675         versions of .gdb_index.  This patch adds an ad hoc version check
48676         method so that these spots can work without specific knowledge of
48677         which index is in use.
48678
48679         Simplify version check in dw2_symtab_iter_next
48680         This simplifies the index versio check in dw2_symtab_iter_next, by
48681         passing a reference to the index object to this function.  This avoids
48682         an indirection via the per_bfd object.
48683
48684         Introduce and use dwarf_scanner_base
48685         This introduces dwarf_scanner_base, a base class for all the index
48686         readers in the DWARF code.  Then, it changes both mapped_index_base
48687         and cooked_index_vector to derive from this new base class.
48688
48689         Introduce readnow_functions
48690         This introduces readnow_functions, a new subclass of
48691         dwarf2_base_index_functions, and changes the DWARF reader to use it.
48692         This lets us drop the "index is NULL" hack from the gdb index code.
48693
48694         Remove some "OBJF_READNOW" code from dwarf2_debug_names_index
48695         The dwarf2_debug_names_index code treats a NULL debug_names_table as
48696         if it were from OBJF_READNOW.  However, this trick is only done for
48697         gdb_index, never for debug_names -- see dwarf2_initialize_objfile.
48698
48699         Let mapped index classes create the quick_symbol_functions object
48700         This changes the mapped index classes to create the
48701         quick_symbol_functions objects.  This is a step toward having a more
48702         abstract interface to mapped indices.
48703
48704         Give mapped_index_base a virtual destructor
48705         This changes mapped_index_base to have a virtual destructor, so it can
48706         be destroyed via its base class.
48707
48708         Move mapped_index_base to new header file
48709         This moves mapped_index_base and the helper struct name_component to a
48710         new header file in gdb/dwarf2/.
48711
48712 2022-04-20  Jan Beulich  <jbeulich@suse.com>
48713
48714         x86: reject all invalid SAE variants
48715         So far an SAE-only specifier was accepted for static-rounding insns,
48716         while SAE-only insns didn't accept static rounding specifiers. If
48717         anything it would make sense the other way around, allowing SAE-only
48718         insns to have the (ignored) rounding mode specified individually rather
48719         than globally via -mevexrcig=. But for now make things match the SDM.
48720
48721 2022-04-20  Alan Modra  <amodra@gmail.com>
48722
48723         Re: xcoff: implement linker relaxation
48724                 * xcofflink.c (xcoff_stub_csect_name): Increase buffer size.
48725                 (xcoff_stub_get_csect_in_range, xcoff_build_one_stub): Whitespace.
48726                 (bfd_xcoff_size_stubs): Cast PRIx64 arg to required type.
48727                 Don't use freed stub_name.
48728
48729         Revert "as: Reject unknown -gXXX option" testsuite
48730         This reverts the test committed as part of 6ea673e2d6.
48731
48732 2022-04-20  Cl?ment Chigot  <clement.chigot@atos.net>
48733
48734         xcoff: implement linker relaxation
48735         bfd/ChangeLog:
48736
48737                 * coff-rs6000.c (xcoff_reloc_type_noop): Add info argument.
48738                 (xcoff_reloc_type_fail): Likewise.
48739                 (xcoff_reloc_type_pos): Likewise.
48740                 (xcoff_reloc_type_neg): Likewise.
48741                 (xcoff_reloc_type_rel): Likewise.
48742                 (xcoff_reloc_type_toc): Likewise.
48743                 (xcoff_reloc_type_ba): Likewise.
48744                 (xcoff_reloc_type_crel): Likewise.
48745                 (xcoff_reloc_type_tls): Likewise.
48746                 (xcoff_reloc_type_br): Add stub handler.
48747                 (xcoff_ppc_relocate_section): Add info to
48748                 xcoff_calculate_relocation.
48749                 (xcoff_stub_indirect_call_code): New constant.
48750                 (xcoff_stub_shared_call_code): Likewise.
48751                 (bfd_xcoff_backend_data): Add stub code fields.
48752                 (bfd_pmac_xcoff_backend_data): Likewise.
48753                 * coff64-rs6000.c (xcoff64_reloc_type_br): Add stub handler.
48754                 (xcoff64_ppc_relocate_section): Add info to
48755                 xcoff64_calculate_relocation.
48756                 (xcoff64_stub_indirect_call_code): New constant.
48757                 (xcoff64_stub_shared_call_code): Likewise.
48758                 (bfd_xcoff_backend_data): Add stub code fields.
48759                 (bfd_xcoff_aix5_backend_data): Likewise.
48760                 * libxcoff.h (struct xcoff_backend_data_rec): Add stub fields.
48761                 (bfd_xcoff_stub_indirect_call_code): New define.
48762                 (bfd_xcoff_stub_indirect_call_size): New define.
48763                 (bfd_xcoff_stub_shared_call_code): New define.
48764                 (bfd_xcoff_stub_shared_call_size): New define.
48765                 (xcoff_reloc_function): Add info argument.
48766                 (enum xcoff_stub_type): New enum.
48767                 (struct xcoff_stub_hash_entry): New structure.
48768                 * xcofflink.c (struct xcoff_link_hash_table): Add stub hash
48769                 table and params fields.
48770                 (xcoff_stub_hash_entry): New define.
48771                 (xcoff_stub_hash_lookup): New define.
48772                 (stub_hash_newfunc): New function.
48773                 (_bfd_xcoff_bfd_link_hash_table_free): Free the new stub hash
48774                 table.
48775                 (_bfd_xcoff_bfd_link_hash_table_create): Create the new stub
48776                 hash table.
48777                 (xcoff_link_add_symbols): Save rawsize for XTY_SD.
48778                 (bfd_xcoff_link_init): New function.
48779                 (xcoff_stub_csect_name): New function.
48780                 (xcoff_stub_get_csect_in_range): New function.
48781                 (xcoff_stub_name): New function.
48782                 (bfd_xcoff_get_stub_entry): New function.
48783                 (bfd_xcoff_type_of_stub): New function.
48784                 (xcoff_add_stub): New function.
48785                 (xcoff_build_one_stub): New function.
48786                 (bfd_xcoff_size_stubs): New function.
48787                 (bfd_xcoff_build_stubs): New function.
48788                 (xcoff_stub_create_relocations): New function.
48789                 (xcoff_link_input_bfd): Adapt relocations to stub.
48790                 (xcoff_write_global_symbol): Adapt to new TOC entries generated
48791                 for stubs.
48792                 (_bfd_xcoff_bfd_final_link): Handle stub file.
48793                 * xcofflink.h (struct bfd_xcoff_link_params): New structure.
48794
48795         ld/ChangeLog:
48796
48797                 * emultempl/aix.em (params): New variable.
48798                 (stub_file): New variable.
48799                 (xcoff_add_stub_section): New function.
48800                 (xcoff_layout_sections_again): New function
48801                 (hook_in_stub): New function.
48802                 (_after_allocation): Add stub creation.
48803                 (_create_output_section_statements): Allocate stub file and
48804                 pass params to backend.
48805
48806 2022-04-20  Cl?ment Chigot  <clement.chigot@atos.net>
48807
48808         Stubs (added in a later patch) will generate new .loader symbols, once the allocations have been done. Thus, the .loader section cannot be layout before that.
48809         bfd/ChangeLog:
48810
48811                 * coff-rs6000.c (_bfd_xcoff_put_ldsymbol_name): Write len in
48812                   ldinfo->strings instead of directly in the output_bfd.
48813                 * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise.
48814                 * xcofflink.c (struct xcoff_link_hash_table): Remove ldrel_count
48815                   field. Add ldinfo field.
48816                 (xcoff_mark_symbol): Adjust to new ldinfo field.
48817                 (xcoff_mark): Likewise.
48818                 (bfd_xcoff_link_count_reloc): Likewise.
48819                 (xcoff_build_loader_section): Split into two functions: one that
48820                 build the loader section (this function) and one that only size
48821                 it...
48822                 (xcoff_size_loader_section): ... (this function).
48823                 (bfd_xcoff_size_dynamic_sections): Adapt to new ldinfo field.
48824                 Move the part where the dynamic sections are build to ...
48825                 (bfd_xcoff_build_dynamic_sections): ... this function.
48826                 * xcofflink.h: Add bfd_xcoff_build_dynamic_sections prototype.
48827
48828         include/ChangeLog:
48829
48830                 * coff/xcoff.h (struct xcoff_loader_info): Add ldrel_count and
48831                 libpath fields.
48832
48833         ld/ChangeLog:
48834
48835                 * emultempl/aix.em (_after_allocation): New function.
48836
48837 2022-04-20  Tom Tromey  <tom@tromey.com>
48838
48839         Use symbol_symtab accessor in compile-object-load.c
48840         I noticed that compile-object-load.c directly references owner.symtab
48841         of a symbol.  However, I think it's better for all users to call
48842         symbol_symtab.  This patch makes this change.
48843
48844 2022-04-20  Nick Clifton  <nickc@redhat.com>
48845
48846         Add linker warning for when it creates an executable stack.
48847            PR 29072
48848
48849 2022-04-20  Tom Tromey  <tom@tromey.com>
48850
48851         Micro-optimize cooked_index_entry::full_name
48852         I noticed that cooked_index_entry::full_name can return the canonical
48853         string when there is no parent entry.
48854
48855         Regression tested on x86-64 Fedora 34.
48856
48857 2022-04-20  Tiezhu Yang  <yangtiezhu@loongson.cn>
48858
48859         gdb: LoongArch: Implement loongarch_scan_prologue()
48860         If can't determine prologue from the symbol table, need to examine
48861         instructions. Implement loongarch_scan_prologue() to analyze the
48862         function prologue from START_PC to LIMIT_PC, return the address of
48863         the first instruction past the prologue.
48864
48865 2022-04-20  GDB Administrator  <gdbadmin@sourceware.org>
48866
48867         Automatic date update in version.in
48868
48869 2022-04-19  H.J. Lu  <hjl.tools@gmail.com>
48870
48871         as: Reject unknown -gXXX option
48872                 * as.c (parse_args): Reject unknown -gXXX option.
48873                 * testsuite/gas/all/empty.s: New file.
48874                 * testsuite/gas/all/pr29067.d: Likewise.
48875                 * testsuite/gas/all/pr29067.err: Likewise.
48876                 * testsuite/gas/all/gas.exp: Run pr29067.
48877
48878 2022-04-19  Lancelot SIX  <lancelot.six@amd.com>
48879
48880         gdb/selftest-arch: Make register_test_foreach_arch generate arch tests lazily
48881         The register_test_foreach_arch is used to instantiate a given selftest
48882         for all architectures supported by GDB.  It is used in many _initialize_*
48883         functions (under initialize_all_files, called by gdb_init).
48884
48885         Because the call is done during GDB's initialization, and because there
48886         is no guaranty about the order in which all the _initialize_* functions
48887         are executed, when register_test_foreach_arch is called, GDB is not
48888         fully initialized.  Specifically, when a particular initialize function
48889         is executed, only the architectures registered at that point are listed
48890         by gdbarch_printable_names.
48891
48892         As a consequence, the list of selftest effectively executed depends on
48893         the order the _initialize_* functions are called.  This can be observed
48894         with the following:
48895
48896             $ ./gdb/gdb \
48897                 -data-directory ./gdb/data-directory \
48898                 -quiet -batch -ex "maint selftest" 2>&1 \
48899                 | grep -E "Ran [0-9]+ unit tests"
48900             Ran 145 unit tests, 0 failed
48901             $ GDB_REVERSE_INIT_FUNCTIONS=1 ./gdb/gdb \
48902                 -data-directory ./gdb/data-directory \
48903                 -quiet -batch -ex "maint selftest" 2>&1 \
48904                 | grep -E "Ran [0-9]+ unit tests"
48905             Ran 82 unit tests, 0 failed
48906
48907         To fix this, make register_test_foreach_arch register a lazy selftest
48908         generator.  This way when the test generator is eventually executed, all
48909         architectures are registered and we do not have a dependency on the
48910         order the initialize functions are executed in.
48911
48912         Tested on x86_64-linux
48913
48914         Change-Id: I88eefebf7d372ad672f42d3a103e89354bc8a925
48915
48916 2022-04-19  Lancelot SIX  <lancelot.six@amd.com>
48917
48918         gdbsupport/selftest: Allow lazy registration
48919         This patch adds a way to delay the registration of tests until the
48920         latest possible moment.  This is intended for situations where GDB needs
48921         to be fully initialized in order to decide if a particular selftest can
48922         be executed or not.
48923
48924         This mechanism will be used in the next patch.
48925
48926         Change-Id: I7f6b061f4c0a6832226c7080ab4e3a2523e1b0b0
48927
48928 2022-04-19  Lancelot SIX  <lancelot.six@amd.com>
48929
48930         gdbsupport/selftest: Replace for_each_selftest with an iterator_range
48931         Remove the callback-based selftests::for_each_selftest function and use
48932         an iterator_range instead.
48933
48934         Also use this iterator range in run_tests so all iterations over the
48935         selftests are done in a consistent way.  This will become useful in a
48936         later commit.
48937
48938         Change-Id: I0b3a5349a7987fbcb0071f11c394e353df986583
48939
48940 2022-04-19  Jan Beulich  <jbeulich@suse.com>
48941
48942         x86: don't mistake ordinary immediates for SAE / rounding control
48943         The way SAE templates are constructed was always puzzling me (including
48944         the need for separate templates in the first place), and expressing the
48945         extzra attribute via Imm8 actually has a bad effect: Ordinary immediates
48946         would also be accepted, leading to an extra byte being added after the
48947         instruction (i.e. generating bad code). Before re-working this (in
48948         particular to accept proper Intel syntax there), fix the immediate issue
48949         by adding the so far missing check.
48950
48951         x86: VCMPSH is Evex.LLIG
48952         These were mistakenly flagged as Evex.128. Getting the LLIG status right
48953         for insns allowing for SAE is a prereq for planned further work.
48954
48955         x86: drop stray CheckRegSize from VFPCLASSPH
48956         Like VFPCLASSP{S,D} it has only a single operand allowing multiple
48957         sizes, hence there are no pairs of operands to check for consistent
48958         size.
48959
48960         x86/Intel: test non-legacy VCVT{,U}SI2SH insn forms
48961         For an unclear reason corresponding AVX512F tests were apparently not
48962         cloned or used as reference here, and instead the bogus legacy forms of
48963         the insns (with the embedded rounding specifier not last) were used.
48964
48965 2022-04-19  Jan Beulich  <jbeulich@suse.com>
48966
48967         x86: correct and simplify NOP disassembly
48968         It's not just REX.W which is ignored with opcode 0x90. The same goes for
48969         REX.R and REX.X as well as empty REX. None of these are forms of
48970         "xchg %eax,%eax" (which would mean zero-extending %eax to %rax), so they
48971         also shouldn't be disassembled this way.
48972
48973         While there simplify things: A single hook function suffices, thus
48974         making it unnecessary to keep two expressions in sync. And checking
48975         ins->address_mode for mode_64bit also is unnecessary, as "rex" can be
48976         non-zero only in that case anyway.
48977
48978 2022-04-19  GDB Administrator  <gdbadmin@sourceware.org>
48979
48980         Automatic date update in version.in
48981
48982 2022-04-18  Simon Marchi  <simon.marchi@efficios.com>
48983
48984         gdb/testsuite/dwarf: don't automatically add directory and file entry for DWARF 5
48985         To support DWARF 5 in the DWARF assembler line tables, we currently copy
48986         the first user-provided directory and the first user-provided files and
48987         make them elements at indices 0 in the directory and file name tables.
48988         That was a sufficient behavior at the time (see commit 44fda089397a
48989         ("[gdb/testsuite] Support .debug_line v5 in dwarf assembler")), but in
48990         the following patches, I would need to have finer grained control on
48991         what is generated exactly.  For example, I'd like to generate a DWARF 5 line
48992         table with just a single file and a single directory.
48993
48994         Get rid of this behavior, and implement what is suggested in
48995         44fda089397a: make include_dir return the directory index that can be
48996         used to refer to that directory entry (based on the DWARF version), and
48997         use it afterwards.
48998
48999         Adjust dw2-lines.exp and dw2-prologue-end.exp accordingly.  Their produced
49000         DWARF5 binaries will change a bit, in that they will now have a single
49001         directory and file, where they had two before.  But it doesn't change
49002         the expected GDB behavior.
49003
49004         Change-Id: I5459b16ac9b7f28c34c9693c35c9afd2ebb3aa3b
49005
49006 2022-04-18  Simon Marchi  <simon.marchi@efficios.com>
49007
49008         gdb: use gdb_tilde_expand instead of gdb_tilde_expand_up in source_script_with_search
49009         Since this is the latest use of gdb_tilde_expand_up, remove it.
49010
49011         Change-Id: I964c812ce55fe087876abf91e7a3577ad79c0425
49012
49013 2022-04-18  Simon Marchi  <simon.marchi@efficios.com>
49014
49015         gdbsupport: make gdb_realpath_keepfile return an std::string
49016         I'm trying to switch these functions to use std::string instead of char
49017         arrays, as much as possible.  Some callers benefit from it (can avoid
49018         doing a copy of the result), while others suffer (have to make one more
49019         copy).
49020
49021         Change-Id: I793aab17baaef8345488f4c40b9094e2695425bc
49022
49023 2022-04-18  Simon Marchi  <simon.marchi@efficios.com>
49024
49025         gdbsupport: make gdb_abspath return an std::string
49026         I'm trying to switch these functions to use std::string instead of char
49027         arrays, as much as possible.  Some callers benefit from it (can avoid
49028         doing a copy of the result), while others suffer (have to make one more
49029         copy).
49030
49031         Change-Id: Iced49b8ee2f189744c5072a3b217aab5af17a993
49032
49033 2022-04-18  Simon Marchi  <simon.marchi@polymtl.ca>
49034
49035         gdb: call gdb_tilde_expand instead of gdb_tilde_expand_up in source_script_with_search
49036         This removes a use of gdb_tilde_expand_up, which is removed later in
49037         this series.
49038
49039         Change-Id: I5887d526cea987103e4ca24514a982b0a28e992a
49040
49041 2022-04-18  Tom Tromey  <tromey@adacore.com>
49042
49043         Update gnulib
49044         This updates gnulib to a relatively recent commit.  Most of this was
49045         done by the gnulib import script; the only change I made was to
49046         update-gnulib.sh.
49047
49048         Tested on x86-64 Fedora 34.  I also did a mingw cross build.
49049
49050 2022-04-18  Tom Tromey  <tom@tromey.com>
49051
49052         Fix C++ cast of derived class to base class
49053         PR c++/28907 points out that casting from a derived class to a base
49054         class fails in some situations.  The problem turned out to be a
49055         missing use of value_embedded_offset.  One peculiarity here is that,
49056         if you managed to construct a pointer-to-derived with an embedded
49057         offset of 0, the cast would work -- for example, one of the two new
49058         tests here passes without the patch.
49059
49060         This embedded offset stuff is an endless source of bugs.  I wonder if
49061         it's possible to get rid of it somehow.
49062
49063         Regression tested on x86-64 Fedora 34.
49064
49065         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28907
49066
49067 2022-04-18  Simon Marchi  <simon.marchi@polymtl.ca>
49068
49069         gdb/testsuite: make gdb.ada/mi_prot.exp stop at expected location
49070         This test attempts to run until the line marked "STOP", which is at
49071         prot.adb:34.  It first runs until the "main" symbol, then tries to place
49072         a breakpoint by line at line 34, without specifying the source file.  When looking at the logs:
49073
49074             -break-insert -t 34^M
49075             ^done,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x0000555555558a6c",func="adafinal",file="/home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/mi_pro    t/b~prot.adb",fullname="/home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/mi_prot/b~prot.adb",line="44",thread-groups=["i1"],times="0",original-location="/home/simark/b    uild/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/mi_prot/b~prot.adb:34"}^M
49076             ... continues ...
49077              *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={addr="0x0000555555558a6c",func="adafinal",args=[],file="/home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/    mi_prot/b~prot.adb",fullname="/home/simark/build/binutils-gdb-one-target/gdb/testsuite/outputs/gdb.ada/mi_prot/b~prot.adb",line="44",arch="i386:x86-64"},thread-id="1",stopped-threads="all",co    re="8"^M
49078
49079         ... we see that the breakpoint is placed in some generated file, not in
49080         the test source file as we expect.  The problem is that "b main" in Ada
49081         does not place a breakpoint on the "Ada main", but on some symbol in a
49082         generated source file.  So when stopped at the "main" symbol, we are not
49083         stopped in the file that contains the STOP marker at line 34.
49084
49085         The test passes anyway today, so it doesn't seem to matter that we are
49086         stopped at an unexpected location.  But it starts failing with this
49087         patch [1], because b~prot.adb:34 happens to be between two functions, so
49088         the breakpoint doesn't resolve.
49089
49090         Fix this by placing the breakpoint at "$srcfile:$line", which works
49091         regardless of what is the current source file.
49092
49093         However, this ends up introducing a path in the test name.  Modify
49094         mi_tbreak and mi_continue_to_line to avoid that.
49095
49096         [1] https://sourceware.org/pipermail/gdb-patches/2022-April/187686.html
49097
49098         Change-Id: I742e2a9993046dcb5e30c64fe2ad920a363baf75
49099
49100 2022-04-18  Vignesh Balasubramanian  <Vignesh.Balasubrmanian@amd.com>
49101
49102         gdb/testsuite: add text_segment option to gdb_compile
49103         LLVM's lld linker doesn't have the "-Ttext-segment" option, but
49104         "--image-base" can be used instead.
49105
49106         To centralize the logic of checking which option is supported, add the
49107         text_segment option to gdb_compile.  Change tests that are currently
49108         using -Ttext-segment to use that new option instead.
49109
49110         This patch fixes only compilation error, for example:
49111
49112         Before:
49113
49114             $ make check TESTS="gdb.base/jit-elf.exp" RUNTESTFLAGS="CC_FOR_TARGET=clang LDFLAGS_FOR_TARGET=-fuse-ld=ld"
49115             Running /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jit-elf.exp ...
49116             gdb compile failed, clang-13: warning: -Xlinker -Ttext-segment=0x7000000: 'linker' input unused [-Wunused-command-line-argument]
49117
49118         After:
49119
49120             $ make check TESTS="gdb.base/jit-elf.exp" RUNTESTFLAGS="CC_FOR_TARGET=clang LDFLAGS_FOR_TARGET=-fuse-ld=ld"
49121             Running /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jit-elf.exp ...
49122             FAIL: gdb.base/jit-elf.exp: one_jit_test-1: continue to breakpoint: break here 1
49123             FAIL: gdb.base/jit-elf.exp: one_jit_test-1: continue to breakpoint: break here 2
49124             FAIL: gdb.base/jit-elf.exp: one_jit_test-2: continue to breakpoint: break here 1
49125             FAIL: gdb.base/jit-elf.exp: one_jit_test-2: info function ^jit_function
49126             FAIL: gdb.base/jit-elf.exp: one_jit_test-2: continue to breakpoint: break here 2
49127             FAIL: gdb.base/jit-elf.exp: attach: one_jit_test-2: continue to breakpoint: break here 1
49128             FAIL: gdb.base/jit-elf.exp: attach: one_jit_test-2: break here 1: attach
49129             FAIL: gdb.base/jit-elf.exp: PIE: one_jit_test-1: continue to breakpoint: break here 1
49130             FAIL: gdb.base/jit-elf.exp: PIE: one_jit_test-1: continue to breakpoint: break here 2
49131
49132                             === gdb Summary ===
49133
49134             # of expected passes            26
49135             # of unexpected failures        9
49136
49137         Change-Id: I3678c5c9bbfc2f80671698e28a038e6b3d14e635
49138
49139 2022-04-18  Enze Li  <lienze2010@hotmail.com>
49140
49141         gdb: fix using clear command to delete non-user breakpoints(PR cli/7161)
49142         The clear command shouldn't delete momentary and internal breakpoints,
49143         nor internal breakpoints created via Python's gdb.Breakpoint.
49144
49145         This patch fixes this issue and adds a testcase.
49146
49147         Regression tested on x86_64 openSUSE Tumbleweed(VERSION_ID="20220413").
49148
49149         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7161
49150
49151 2022-04-18  GDB Administrator  <gdbadmin@sourceware.org>
49152
49153         Automatic date update in version.in
49154
49155 2022-04-17  GDB Administrator  <gdbadmin@sourceware.org>
49156
49157         Automatic date update in version.in
49158
49159 2022-04-16  Tom Tromey  <tom@tromey.com>
49160
49161         Add comments to dwarf2/abbrev-cache.h
49162         This patch started when I noticed that the unordered_set include
49163         wasn't needed in abbrev-cache.h.  (That was probably leftover from
49164         some earlier implementation of the class.)  Then, I noticed that the
49165         class itself was under-commented.  This patch fixes both issues.
49166
49167 2022-04-16  GDB Administrator  <gdbadmin@sourceware.org>
49168
49169         Automatic date update in version.in
49170
49171 2022-04-15  Tom Tromey  <tom@tromey.com>
49172
49173         Return void from gdb_putc
49174         I don't think it's very useful to return the character from gdb_putc,
49175         so this patch changes it to return void.
49176
49177 2022-04-15  Tom Tromey  <tom@tromey.com>
49178
49179         Handle "set height 1"
49180         PR cli/17151 points out that "set height 1" has pathological behavior
49181         in gdb.  What I see is that gdb will endlessly print the pagination
49182         prompt.  This patch takes a simple and expedient approach to a fix:
49183         pretend that the height is really 2.
49184
49185         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17151
49186
49187 2022-04-15  Tom Tromey  <tom@tromey.com>
49188
49189         Allow word wrapping even when paging is disabled
49190         PR cli/20741 points out that when pagination is disabled, this also
49191         disabled word wrapping.  However, the manual documents that these
49192         settings are separate -- if you intend to disable the wrapping, you
49193         must use "set width unlimited".
49194
49195         This patch fixes the bug by letting the pagination-disabled case fall
49196         through to the code that also handles word-wrapping.
49197
49198         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20741
49199
49200 2022-04-15  Tom Tromey  <tom@tromey.com>
49201
49202         Implement value_print for Rust
49203         This adds an implementation of the value_print method to Rust.  As
49204         described in PR rust/22254, this removes a bit of weird-looking output
49205         from some "print"s -- because c_value_print is bypassed.  I don't have
49206         a test for the bug that inspired this patch, because I only know how
49207         to reproduce it when using a relatively old Rust compiler.  However,
49208         the new "cast-printing" code in value_print is required, because
49209         omitting this causes some existing tests to fail.
49210
49211         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22254
49212
49213 2022-04-15  Tom Tromey  <tom@tromey.com>
49214
49215         Reimplement Rust slice printing
49216         The current nightly Rust compiler (aka 1.61) added better DWARF
49217         representation for unsized types.  Fixing this is PR rust/21466; but
49218         the code is actually the same as what is required to make slice
49219         printing more useful, which is PR rust/23871.  This patch implements
49220         this.  I tested this against various Rust compilers: 1.48, current
49221         stable, current beta, and current nightly.
49222
49223         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21466
49224         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23871
49225
49226 2022-04-15  Tom Tromey  <tom@tromey.com>
49227
49228         Remove some dead code from the Rust value printer
49229         This removes a bit of dead code from the Rust value printer.  This
49230         code wasn't always dead -- it fixed a real bug, and a test case was
49231         added for it.  However, once val_print was removed, it became
49232         unnecessary.
49233
49234 2022-04-15  Tom Tromey  <tom@tromey.com>
49235
49236         Match rustc beta versions
49237         The rust_compiler_version proc extracts the Rust compiler version from
49238         the "rustc --version" output.  For a beta compiler, the output looks
49239         like:
49240
49241             rustc 1.60.0-beta.6 (7bccde197 2022-03-22)
49242
49243         This patch slightly relaxes the regexp -- removing a space -- so that
49244         this can be understood by this proc.
49245
49246 2022-04-15  Tom de Vries  <tdevries@suse.de>
49247
49248         [gdb/testsuite] Fix gdb.ada/float-bits.exp with -m32
49249         With test-case gdb.ada/float-bits.exp and native we get:
49250         ...
49251         (gdb) print 16llf#7FFFF7FF4054A56FA5B99019A5C8#^M
49252         $9 = 5.0e+25^M
49253         (gdb) PASS: gdb.ada/float-bits.exp: print 16llf#7FFFF7FF4054A56FA5B99019A5C8#
49254         ...
49255         but with target board unix/-m32 we have instead:
49256         ...
49257         (gdb) print 16llf#7FFFF7FF4054A56FA5B99019A5C8#^M
49258         Cannot export value 2596145952482202326224873165792712 as 96-bits \
49259           unsigned integer (must be between 0 and 79228162514264337593543950335)^M
49260         (gdb) FAIL: gdb.ada/float-bits.exp: print 16llf#7FFFF7FF4054A56FA5B99019A5C8#
49261         ...
49262
49263         Fix this by testing whether 16llf is supported by doing ptype long_long_float
49264         which gets us either:
49265         ...
49266         type = <16-byte float>^M
49267         ...
49268         or:
49269         ...
49270         type = <12-byte float>^M
49271         ...
49272
49273         Tested on x86_64-linux with native and unix/-m32.
49274
49275         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29041
49276
49277 2022-04-15  Tom Tromey  <tom@tromey.com>
49278
49279         Remove WITH_SIM define
49280         Since score-tdep.c was removed, the WITH_SIM define is not used in
49281         gdb.  This patch removes it.
49282
49283         Note that re-running autoheader shows a separate change that was
49284         missed.  I've kept it in this patch to avoid extra work.
49285
49286 2022-04-15  Tom de Vries  <tdevries@suse.de>
49287
49288         [gdb/testsuite] Fix gdb.go/methods.exp with check-readmore
49289         When running test-case gdb.go/methods.exp with make check we have:
49290         ...
49291         (gdb) break main.T.Foo^M
49292         Function "main.T.Foo" not defined.^M
49293         Make breakpoint pending on future shared library load? (y or [n]) n^M
49294         (gdb) XFAIL: gdb.go/methods.exp: gdb_breakpoint: set breakpoint at main.T.Foo
49295         ...
49296         but with make check-readmore the XFAIL fails to trigger:
49297         ...
49298         (gdb) break main.T.Foo^M
49299         Function "main.T.Foo" not defined.^M
49300         Make breakpoint pending on future shared library load? (y or [n]) n^M
49301         (gdb) FAIL: gdb.go/methods.exp: gdb_breakpoint: set breakpoint at main.T.Foo
49302         ...
49303
49304         This happens because this gdb_test_multiple "maintenance print symbols"
49305         regexp:
49306         ...
49307             -re "\r\n$gdb_prompt $" {
49308         ...
49309         matches the entire command output.
49310
49311         Fix this by adding the missing ^ at the regexp start.
49312
49313         Tested on x86_64-linux.
49314
49315         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29064
49316
49317 2022-04-15  GDB Administrator  <gdbadmin@sourceware.org>
49318
49319         Automatic date update in version.in
49320
49321 2022-04-14  Pedro Alves  <pedro@palves.net>
49322
49323         gdbserver: Eliminate prepare_to_access_memory
49324         Given:
49325
49326          - The prepare_to_access_memory machinery was added for non-stop mode.
49327
49328          - Only Linux supports non-stop.
49329
49330          - Linux no longer needs the prepare_to_access_memory machinery.  In
49331            fact, after the previous patch,
49332            linux_process_target::prepare_to_access_memory became a nop.
49333
49334         Thus, prepare_to_access_memory can go away, simplifying core GDBserver
49335         code.
49336
49337         Change-Id: I93ac8bfe66bd61c3d1c4a0e7d419335163120ecf
49338
49339 2022-04-14  Pedro Alves  <pedro@palves.net>
49340
49341         gdbserver/linux: Access memory even if threads are running
49342         Similarly to how the native Linux target was changed
49343         and subsequently reworked in these commits:
49344
49345          05c06f318fd9 Linux: Access memory even if threads are running
49346          8a89ddbda2ec Avoid /proc/pid/mem races (PR 28065)
49347
49348         ... teach GDBserver to access memory even when the current thread is
49349         running, by always accessing memory via /proc/PID/mem.
49350
49351         The existing comment:
49352
49353           /* Neither ptrace nor /proc/PID/mem allow accessing memory through a
49354              running LWP.  */
49355
49356         ... is incorrect for /proc/PID/mem does allow that.
49357
49358         Actually, from GDB's perspective, GDBserver could already access
49359         memory while threads were running, but at the expense of pausing all
49360         threads for the duration of the memory access, via
49361         prepare_to_access_memory.  This new implementation does not require
49362         pausing any thread, thus
49363         linux_process_target::prepare_to_access_memory /
49364         linux_process_target::done_accessing_memory become nops.  A subsequent
49365         patch will remove the whole prepare_to_access_memory infrastructure
49366         completely.
49367
49368         The GDBserver linux-low.cc implementation is simpler than GDB's
49369         linux-nat.c's, because GDBserver always adds the unfollowed vfork/fork
49370         children to the process list immediately when the fork/vfork event is
49371         seen out of ptrace.  I.e., there's no need to keep the file descriptor
49372         stored on a side map, we can store it directly in the process
49373         structure.
49374
49375         Change-Id: I0abfd782ceaa4ddce8d3e5f3e2dfc5928862ef61
49376
49377 2022-04-14  Pedro Alves  <pedro@palves.net>
49378
49379         gdbserver: special case target_write_memory len==0
49380         The next patch in this series adds a common helper routine for both
49381         memory reads and writes, like this:
49382
49383          static int
49384          proc_xfer_memory (CORE_ADDR memaddr, unsigned char *readbuf,
49385                           const gdb_byte *writebuf, int len)
49386          {
49387            gdb_assert ((readbuf == nullptr) != (writebuf == nullptr));
49388            ...
49389          }
49390
49391          int
49392          linux_process_target::read_memory (CORE_ADDR memaddr,
49393                                             unsigned char *myaddr, int len)
49394          {
49395            return proc_xfer_memory (memaddr, myaddr, nullptr, len);
49396          }
49397
49398          linux_process_target::write_memory (CORE_ADDR memaddr,
49399                                             const unsigned char *myaddr, int len)
49400          {
49401            return proc_xfer_memory (memaddr, nullptr, myaddr, len);
49402          }
49403
49404         Surprisingly, the assertion fails.  That happens because it can happen
49405         that target_write_memory is called with LEN==0, due to this in
49406         gdb/remote.c:
49407
49408          /* Determine whether the remote target supports binary downloading.
49409             This is accomplished by sending a no-op memory write of zero length
49410             to the target at the specified address. (...) */
49411
49412          void
49413          remote_target::check_binary_download (CORE_ADDR addr)
49414          {
49415          ...
49416                p = rs->buf.data ();
49417                *p++ = 'X';
49418                p += hexnumstr (p, (ULONGEST) addr);
49419                *p++ = ',';
49420                p += hexnumstr (p, (ULONGEST) 0);
49421                *p++ = ':';
49422                *p = '\0';
49423
49424         In this scenario, in gdbserver's target_write_memory, the "myaddr"
49425         argument of the_target->write_memory is passed the data() of a local
49426         gdb::byte_vector (which is a specialized std::vector).  It's valid for
49427         std::vector::data() to return NULL when the vector is empty.
49428
49429         This commit adds an early return to target_write_memory to avoid
49430         target backends having to care about this.  For good measure, do the
49431         same on the read side, in read_inferior_memory.
49432
49433         Change-Id: Iac8f04fcf99014c624ef4036bd318ca1771ad491
49434
49435 2022-04-14  Pedro Alves  <pedro@palves.net>
49436
49437         gdbserver/qXfer::threads, prepare_to_access_memory=>target_pause_all
49438         handle_qxfer_threads_proper needs to pause all threads even if the
49439         target can read memory when threads are running, so use
49440         target_pause_all instead, which is what the Linux implementation of
49441         prepare_to_access_memory uses.  (Only Linux implements this hook.)
49442
49443         A following patch will make the Linux backend be able to access memory
49444         when threads are running, and thus will also make
49445         prepare_to_access_memory do nothing, which would cause testsuite
49446         regressions without this change.
49447
49448         Change-Id: I127fec7246b7c45b60dfa7341e781606bf54b5da
49449
49450 2022-04-14  Tom Tromey  <tromey@adacore.com>
49451
49452         Ignore 0,0 entries in .debug_aranges
49453         When running the internal AdaCore test suite against the new DWARF
49454         indexer, I found one regression on RISC-V.  The test in question uses
49455         --gc-sections, and winds up with an entry in the middle of a
49456         .debug_aranges that has both address and length of 0.  In this
49457         scenario, gdb assumes the entries are terminated and then proceeds to
49458         reject the section because it reads a subsequent entry as if it were a
49459         header.
49460
49461         It seems to me that, because each header describes the size of each
49462         .debug_aranges CU, it's better to simply ignore 0,0 entries and simply
49463         read to the end.  That is what this patch does.
49464
49465         I've patched an existing test to provide a regression test for this.
49466
49467 2022-04-14  Tom Tromey  <tromey@adacore.com>
49468
49469         Use GetThreadDescription on Windows
49470         Windows 10 introduced SetThreadDescription and GetThreadDescription, a
49471         simpler way to set a thread's name.  This changes gdb and gdbserver to
49472         use this convention when it is available.
49473
49474         This is part of PR win32/29050.
49475
49476         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29050
49477
49478 2022-04-14  Tom Tromey  <tromey@adacore.com>
49479
49480         Set the worker thread name on Windows
49481         This patch is a bit different from the rest of the series, in that it
49482         is a change to gdb's behavior on the host.  It changes gdb's thread
49483         pool to try to set the thread name on Windows, if SetThreadDescription
49484         is available.
49485
49486         This is part of PR win32/29050.
49487
49488         This patch isn't likely to be useful to many people in the short term,
49489         because the Windows port of the libstdc++ thread code is not upstream.
49490         (AdaCore uses it, and sent it upstream, but it did not land, I don't
49491         know why.)  However, if that patch does ever go in, or presumably if
49492         you build using some other C++ runtime library, then this will be
49493         useful.
49494
49495         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29050
49496
49497 2022-04-14  Tom Tromey  <tromey@adacore.com>
49498
49499         Implement thread_name for gdbserver
49500         This changes gdbserver to implement thread_name method.
49501
49502         Share handle_ms_vc_exception with gdbserver
49503         Currently, gdb's native Windows target implements the exception-based
49504         approach for setting thread names, but gdbserver does not.  This patch
49505         moves handle_ms_vc_exception to the shared nat/windows-nat.c code, as
49506         preparation for adding this support to gdbserver.
49507
49508         Move target_read_string to target/target.c
49509         This moves the two overloads of target_read_string to a new file,
49510         target/target.c, and updates both gdb and gdbserver to build this.
49511
49512         Remove the byte order parameter to target_read_string
49513         target_read_string takes a byte order parameter, but only uses this to
49514         check whether a given character is zero.  This is readily done without
49515         requiring the parameter, so remove it.
49516
49517         Rename read_string
49518         This renames read_string to be an overload of target_read_string.
49519         This makes it more consistent for the eventual merger with gdbserver.
49520
49521         Don't call QUIT in read_string
49522         read_string does not need to call QUIT, because target_read_memory
49523         already does.  This change is needed to make string-reading usable by
49524         gdbserver.
49525
49526         Fix possible Cygwin build problem
49527         I noticed that nat/windows-nat.c checks __USEWIDE, but nothing sets it
49528         there -- I forgot to copy over the definition when making this file.
49529         This patch tries to fix the problem.  I don't have a Cygwin setup, so
49530         I don't know whether this is sufficient, but it's probably necessary.
49531
49532 2022-04-14  Lancelot SIX  <lancelot.six@amd.com>
49533             Pedro Alves  <pedro@palves.net>
49534
49535         gdb/testsuite: Fix race in gdb.dwarf2/calling-convention.exp
49536         Pedro Alves warned me that there is a race in
49537         gdb.dwarf2/calling-convention.exp making the test sometimes fail on his
49538         setup.  This can be reliably reproduced using :
49539
49540             make check-read1 TESTS="gdb.dwarf2/calling-convention.exp"
49541
49542         The relevant part of the gdb.log file is:
49543
49544             return 35
49545             Function 'foo' does not follow the target calling convention.
49546             If you continue, setting the return value will probably lead to unpredictable behaviors.
49547             Make foo return now? (y or n) PASS: gdb.dwarf2/calling-convention.exp: return 35
49548             n
49549             Not confirmed
49550             (gdb) FAIL: gdb.dwarf2/calling-convention.exp: finish
49551
49552         The issue is that when doing the test for "return 35", the DejaGnu test
49553         sends "n" (to tell GDB not to perform the return action) but never
49554         consumes the "Not confirmed" acknowledgment sent by GDB.  Later, when
49555         trying to do the next test, DejaGnu tries to match the leftover output
49556         from the "return" test. As this output is not expected, the test fails.
49557
49558         Fix by using gdb_test to send the "n" answer and match the confirmation
49559         and consume all output to the prompt.
49560
49561         Also do minor adjustments to the main regex:
49562           - Remove the leading ".*" which is not required.
49563           - Ensure that the "?" from the question is properly escaped.
49564
49565         Tested on x86_64-gnu-linux, using
49566
49567         - make check TESTS="gdb.dwarf2/calling-convention.exp"
49568         - make check-read1 TESTS="gdb.dwarf2/calling-convention.exp"
49569         - make check-readmore TESTS="gdb.dwarf2/calling-convention.exp"
49570
49571         Change-Id: I42858b13db2cbd623c5c1739de65ad423e0c0938
49572
49573 2022-04-14  Tom Tromey  <tromey@adacore.com>
49574
49575         Silence -Wmaybe-uninitialized warning from target_waitstatus
49576         Currently, one use of target_waitstatus yields a warning:
49577
49578              target/waitstatus.h: In function 'void stop_all_threads()':
49579              target/waitstatus.h:175:13: warning: 'ws.target_waitstatus::m_value' may be used uninitialized in this function [-Wmaybe-uninitialized]
49580                175 |     m_value = other.m_value;
49581                    |     ~~~~~~~~^~~~~~~~~~~~~~~
49582
49583         This patch silences the warning.  I tried the "volatile member"
49584         approach that was used for gdb::optional, but that didn't work, so
49585         this patch simply initializes the member.
49586
49587 2022-04-14  Tom Tromey  <tromey@adacore.com>
49588
49589         Fix regression on Windows with WOW64
49590         Internally at AdaCore, we recently started testing a 64-bit gdb
49591         debugging 32-bit processes.  This failed with gdb head, but not with
49592         gdb 11.
49593
49594         The tests fail like this:
49595
49596              Starting program: [...].exe
49597              warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
49598              Do you need "set solib-search-path" or "set sysroot"?
49599              warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
49600              Do you need "set solib-search-path" or "set sysroot"?
49601              warning: Could not load shared library symbols for NOT_AN_IMAGE.
49602              Do you need "set solib-search-path" or "set sysroot"?
49603              warning: Could not load shared library symbols for NOT_AN_IMAGE.
49604              Do you need "set solib-search-path" or "set sysroot"?
49605
49606         After some debugging and bisecting, to my surprise the bug was
49607         introduced by commit 183be222 ("gdb, gdbserver: make target_waitstatus
49608         safe").
49609
49610         The problem occurs in handle_exception.  Previously the code did:
49611
49612             -  ourstatus->kind = TARGET_WAITKIND_STOPPED;
49613             [...]
49614                  case EXCEPTION_BREAKPOINT:
49615             [...]
49616             -     ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
49617             [...]
49618                    /* FALLTHROUGH */
49619                  case STATUS_WX86_BREAKPOINT:
49620                    DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
49621             -      ourstatus->value.sig = GDB_SIGNAL_TRAP;
49622             [...]
49623             -  last_sig = ourstatus->value.sig;
49624
49625         However, in the new code, the fallthrough case does:
49626
49627             +      ourstatus->set_stopped (GDB_SIGNAL_TRAP);
49628
49629         ... which changes the 'kind' in 'ourstatus' after falling through.
49630
49631         This patch rearranges the 'last_sig' setting to more closely match
49632         what was done before (this is probably not strictly needed but also
49633         seemed harmless), and removes the fall-through in the
49634         'ignore_first_breakpoint' case when __x86_64__ is defined.
49635
49636 2022-04-14  Tom Tromey  <tromey@adacore.com>
49637
49638         Reorganize Python events documentation
49639         This slightly reorganizes the Python events documentation.  It hoists
49640         the "ThreadEvent" text out of the list of events, where it seemed to
49641         be misplaced.  It tidies the formatting a little bit (adding some
49642         vertical space for easier reading in info), fixes a typo, adds some
49643         missing commas, and fixes an incorrect reference to NewInferiorEvent.
49644
49645 2022-04-14  Simon Marchi  <simon.marchi@polymtl.ca>
49646
49647         gdb: remove move constructor and move assignment operator from cooked_index
49648         Building with clang++-14, I see:
49649
49650               CXX    dwarf2/cooked-index.o
49651             In file included from /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.c:21:
49652             /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.h:172:12: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
49653               explicit cooked_index (cooked_index &&other) = default;
49654                        ^
49655             /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.h:225:16: note: move constructor of 'cooked_index' is implicitly deleted because field 'm_storage' has a deleted move constructor
49656               auto_obstack m_storage;
49657                            ^
49658             /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/gdb_obstack.h:128:28: note: 'auto_obstack' has been explicitly marked deleted here
49659               DISABLE_COPY_AND_ASSIGN (auto_obstack);
49660                                        ^
49661             In file included from /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.c:21:
49662             /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.h:174:17: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
49663               cooked_index &operator= (cooked_index &&other) = default;
49664                             ^
49665             /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.h:225:16: note: move assignment operator of 'cooked_index' is implicitly deleted because field 'm_storage' has a deleted move assignment operator
49666               auto_obstack m_storage;
49667                            ^
49668             /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/gdb_obstack.h:128:3: note: 'operator=' has been explicitly marked deleted here
49669               DISABLE_COPY_AND_ASSIGN (auto_obstack);
49670               ^
49671             /home/smarchi/src/binutils-gdb/gdb/../include/ansidecl.h:425:8: note: expanded from macro 'DISABLE_COPY_AND_ASSIGN'
49672               void operator= (const TYPE &) = delete
49673                    ^
49674
49675         We explicitly make cooked_index have a default move constructor and
49676         move assignment operator.  But it doesn't actually happen because
49677         cooked_index has a field of type auto_obstack, which isn't movable.
49678         We don't actually need cooked_index to be movable at the moment, so
49679         remove those lines.
49680
49681         Change-Id: Ifc1fe3d7d67e3ae1a14363d6c1869936fe80b0a2
49682
49683 2022-04-14  Tom Tromey  <tromey@adacore.com>
49684
49685         Let std::thread check pass even without pthreads
49686         Currently, the configure check for std::thread relies on pthreads
49687         existing.  However, this means that if std::thread is implemented for
49688         a non-pthreads host, then the check will yield the wrong answer.  This
49689         happened in AdaCore internal builds.  Here, we have this GCC patch:
49690
49691             https://gcc.gnu.org/legacy-ml/gcc-patches/2019-06/msg01840.html
49692
49693         ... which adds mingw support to GCC's gthreads implementation, and
49694         also to std::thread.
49695
49696         This configure change fixes this problem and enables threading for
49697         gdb.
49698
49699 2022-04-14  Tiezhu Yang  <yangtiezhu@loongson.cn>
49700
49701         gdb: fix build errors in gdbsupport/thread-pool.h used with old gcc
49702         When I build gdb with gcc 8.3, there exist the following build errors,
49703         rename the typedef to task_t to fix them.
49704
49705           CXX      thread-pool.o
49706         In file included from /home/loongson/gdb.git/gdbsupport/thread-pool.cc:21:
49707         /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h: In member function ‘std::future<void> gdb::thread_pool::post_task(std::function<void()>&&)’:
49708         /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:69:44: error: declaration of ‘task’ shadows a previous local [-Werror=shadow=local]
49709              std::packaged_task<void ()> task (std::move (func));
49710                                                     ^~~~
49711         /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:102:39: note: shadowed declaration is here
49712            typedef std::packaged_task<void ()> task;
49713                                                ^~~~
49714         /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h: In member function ‘std::future<_Res> gdb::thread_pool::post_task(std::function<T()>&&)’:
49715         /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:80:41: error: declaration of ‘task’ shadows a previous local [-Werror=shadow=local]
49716              std::packaged_task<T ()> task (std::move (func));
49717                                                  ^~~~
49718         /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:102:39: note: shadowed declaration is here
49719            typedef std::packaged_task<void ()> task;
49720                                                ^~~~
49721
49722 2022-04-14  Tom de Vries  <tdevries@suse.de>
49723
49724         [gdb/testsuite] Detect 'No MPX support'
49725         On openSUSE Leap 15.3, mpx support has been disabled for m32, so I run into:
49726         ...
49727         (gdb) run ^M
49728         Starting program: outputs/gdb.arch/i386-mpx/i386-mpx ^M
49729         [Thread debugging using libthread_db enabled]^M
49730         Using host libthread_db library "/lib64/libthread_db.so.1".^M
49731         No MPX support^M
49732         ...
49733         and eventually into all sort of fails in this and other mpx test-cases.
49734
49735         Fix this by detecting the "No MPX support" message in have_mpx.
49736
49737         Tested on x86_64-linux with target boards unix and unix/-m32.
49738
49739 2022-04-14  Sergei Trofimovich  <siarheit@google.com>
49740
49741         M68K: avoid quadratic slowdlow in label alignment check
49742         Before the change tc-m68k maintained a list of seen labels.
49743         Alignment check traversed label list to resolve symbol to label.
49744         This caused quadratic slowdown as each symbol was checked against
49745         each label. Worst affected files are the ones built with debugging
49746         enabled as DWARF generates many labels.
49747
49748         The change embeds auxiliary label information right into symbol using
49749         TC_SYMFIELD_TYPE.
49750
49751         Before the change test from PR 29058 did not finish in 10 minutes. After
49752         the change it finishes in 2 seconds.
49753
49754         gas/ChangeLog:
49755
49756                 PR 29058
49757                 * config/tc-m68k.h (TC_SYMFIELD_TYPE): define as m68k_tc_sy.
49758                 * config/tc-m68k.c (m68k_frob_label): Use TC_SYMFIELD_TYPE to
49759                 store label information.
49760
49761 2022-04-14  caiyinyu  <caiyinyu@loongson.cn>
49762
49763         ld:LoongArch: Fix glibc fail: tst-audit25a/b.
49764           bfd/
49765
49766           * elfnn-loongarch.c: Add new func elf_loongarch64_hash_symbol.
49767
49768 2022-04-14  GDB Administrator  <gdbadmin@sourceware.org>
49769
49770         Automatic date update in version.in
49771
49772 2022-04-13  Simon Marchi  <simon.marchi@efficios.com>
49773
49774         gdb: add ATTRIBUTE_PRINTF to complaint_interceptor::issue_complaint
49775         Fix this error when building with clang++-14:
49776
49777               CXX    complaints.o
49778             /home/smarchi/src/binutils-gdb/gdb/complaints.c:130:65: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
49779               g_complaint_interceptor->m_complaints.insert (string_vprintf (fmt, args));
49780                                                                             ^~~
49781
49782         Change-Id: I0ef11f970510eb8638d1651fa0d5eeecd6a9d31a
49783
49784 2022-04-13  Simon Marchi  <simon.marchi@efficios.com>
49785
49786         gdb: fix clang build failure in msymbol_is_mips
49787         Building with clang++-14, I see:
49788
49789               CXX    mips-tdep.o
49790             /home/smarchi/src/binutils-gdb/gdb/mips-tdep.c:453:12: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
49791               return !(MSYMBOL_TARGET_FLAG_MIPS16 (msym)
49792                       ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49793             /home/smarchi/src/binutils-gdb/gdb/mips-tdep.h:54:2: note: expanded from macro 'MSYMBOL_TARGET_FLAG_MIPS16'
49794                     (sym)->target_flag_1 ()
49795                     ^
49796             /home/smarchi/src/binutils-gdb/gdb/mips-tdep.c:453:12: note: cast one or both operands to int to silence this warning
49797             /home/smarchi/src/binutils-gdb/gdb/mips-tdep.h:54:2: note: expanded from macro 'MSYMBOL_TARGET_FLAG_MIPS16'
49798                     (sym)->target_flag_1 ()
49799                     ^
49800
49801         That's since commit e165fcef1e7 ("gdb: remove MSYMBOL_TARGET_FLAG_{1,2}
49802         macros").  Fix this by using the boolean || rather than the bitwise |,
49803         since the new methods return bool values.  No change in behavior
49804         expected.
49805
49806         Change-Id: Ia82664135aa25db64c29c92f5c1141859d345bf7
49807
49808 2022-04-13  Alexander von Gluck IV  <kallisti5@unixzen.com>
49809
49810         binutils: enable PE on 32bit haiku build
49811                 * config.bfd (x86-haiku): Add i386_pei_vec as a selectable format.
49812
49813 2022-04-13  Pedro Alves  <pedro@palves.net>
49814
49815         Make intrusive_list_node's next/prev private
49816         Tromey noticed that intrusive_list_node leaves its data members
49817         public, which seems sub-optimal.
49818
49819         This commit makes intrusive_list_node's data fields private.
49820         intrusive_list_iterator, intrusive_list_reverse_iterator, and
49821         intrusive_list do need to access the fields, so they are made friends.
49822
49823         Change-Id: Ia8b306b40344cc218d423c8dfb8355207a612ac5
49824
49825 2022-04-13  Pedro Alves  <pedro@palves.net>
49826
49827         Tidy gdb.base/parse_number.exp
49828         Now that Ada is able to parse & print 0xffffffffffffffff (2^64-1) in
49829         hex, move it to the else branch like most other languages.
49830
49831         Change-Id: Ib305f6bb2b6b230a1190ea783b245b865821094c
49832
49833 2022-04-13  Alan Modra  <amodra@gmail.com>
49834
49835         ubsan: member access within null pointer of union
49836         Add some nonsense to cover "undefined behaviour".
49837
49838                 * ldlang.c (section_for_dot): Avoid UB.
49839
49840 2022-04-13  GDB Administrator  <gdbadmin@sourceware.org>
49841
49842         Automatic date update in version.in
49843
49844 2022-04-12  Tom Tromey  <tromey@adacore.com>
49845
49846         Fix bug in Ada number lexing
49847         On irc, Pedro pointed out that Ada couldn't properly handle
49848         0xffffffffffffffff.  This used to work, but is a regression due to
49849         some patches I wrote in the Ada lexer.  This patch fixes the bug.
49850
49851 2022-04-12  Simon Marchi  <simon.marchi@efficios.com>
49852
49853         gdb: fix "passing NULL to memcpy" UBsan error in dwarf2/cooked-index.c
49854         Reading a simple file compiled with :
49855
49856             $ gcc -DONE=1 -gdwarf-4 -g3  test.c
49857             $ gcc --version
49858             gcc (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
49859
49860         I get:
49861
49862             Reading symbols from /tmp/cwd/a.out...
49863             /home/smarchi/src/binutils-gdb/gdb/dwarf2/cooked-index.c:332:11: runtime error: null pointer passed as argument 2, which is declared to never be null
49864
49865         It looks like even if the size is 0 (the size of the `entries` vector is
49866         0), we shouldn't be passing a NULL pointer to memcpy.  And
49867         `entries.data ()` returns NULL.
49868
49869         Fix that by using std::vector::insert to insert the items of entries
49870         into m_entries.  I haven't checked, but it should essentially compile
49871         down to a memcpy, since the vector elements are trivially copyiable.
49872
49873         Change-Id: I75f1c901e9b522e42e89eb5936e2c70d68eb21e5
49874
49875 2022-04-12  Simon Marchi  <simon.marchi@polymtl.ca>
49876
49877         gdb: change subfile::line_vector to an std::vector
49878         Change this field to an std::vector to facilitate memory management.
49879         Since the linetable_entry array is copied into the symtab resulting from
49880         the subfile, it is possible to change it without changing how symtab
49881         stores the linetable entries (which would be a much larger change).
49882
49883         There is a small change in buildsym_compunit::record_line to avoid
49884         accessing a now invalid linetable_entry.  Before this patch, we keep a
49885         pointer to the last linetable entry, pop it from the vector, and then
49886         read last->line.  It works with the manually-maintained array, but since
49887         we now use std::vector::pop_back, I am afraid that it could be flagged
49888         as an invalid access by the various static / dynamic analysis tools to
49889         access the linetable_entry object after popping it from the vector.
49890         Instead, record just the line number in an optional and use it.
49891
49892         There are substantial changes in xcoffread.c that simplify the code, but
49893         I can't test them.  I was hesitant to do this change because of that,
49894         but I decided to send it anyway.  I don't think that an almost dead
49895         platform should hold back improving the code in the common parts of GDB.
49896
49897         The changes in xcoffread.c are:
49898
49899          - Make arrange_linetable "arrange" the linetable passed as a parameter,
49900            instead of returning possibly a new one, possibly the same one.
49901          - In the "Process main file's line numbers.", I'm not too sure what
49902            happens.  We get the lintable from "main_subfile", "arrange" it, but
49903            then assign the result to the current subfile, obtained with
49904            get_current_subfile.  I assume that the current subfile is also the
49905            main one, so now I just call arrange_linetable on the main subfile's
49906            line table.
49907          - Remove that weird "Useless if!!!" FIXME comment.  It's been there
49908            forever, but the "if" is still there, so I guess the "if" can stay
49909            there.
49910
49911         Change-Id: I11799006fd85189e8cf5bd3a168f8f38c2c27a80
49912
49913 2022-04-12  Simon Marchi  <simon.marchi@efficios.com>
49914
49915         gdb: use std::vector for temporary linetable_entry array in arrange_linetable
49916         Reduce manual memory management and make the code a bit easier to read.
49917         This helps me a bit in the following patch.
49918
49919         I don't have a way to test this, it's best-effort.
49920
49921         Change-Id: I64af9cd756311deabc6cd95e701dfb21234a40a5
49922
49923 2022-04-12  Simon Marchi  <simon.marchi@efficios.com>
49924
49925         gdb: change subfile::name and buildsym_compunit::m_comp_dir to strings
49926         Change subfile::name to be a string, for easier memory management.
49927         Change buildsym_compunit::m_comp_dir as well, since we move one in to
49928         the other at some point in patch_subfile_names, so it's easier to do
49929         both at the same time.  There are various NULL checks for both fields
49930         currently, replace them with empty checks, I think it ends up
49931         equivalent.
49932
49933         I can't test the change in xcoffread.c, it's best-effort.
49934
49935         Change-Id: I62b5fb08b2089e096768a090627ac7617e90a016
49936
49937 2022-04-12  Simon Marchi  <simon.marchi@polymtl.ca>
49938
49939         gdb: allocate subfile with new
49940         Allocate struct subfile with new, initialize its fields instead of
49941         memset-ing it to 0.  Use a unique_ptr for the window after a subfile has
49942         been allocated but before it is linked in the buildsym_compunit's list
49943         of subfile (and therefore owned by the buildsym_compunit.
49944
49945         I can't test the change in xcoffread.c, it's best-effort.  I couldn't
49946         find where subfiles are freed in that file, I assume they were
49947         intentionally (or not) leaked.
49948
49949         Change-Id: Ib3b6877de31b7e65bc466682f08dbf5840225f24
49950
49951 2022-04-12  Simon Marchi  <simon.marchi@efficios.com>
49952
49953         gdb: use decltype instead of typeof in dwarf2/read.c
49954         When building with -std=c++11, I get:
49955
49956           CXX    dwarf2/read.o
49957         /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c: In function â€˜void dwarf2_build_psymtabs_hard(dwarf2_per_objfile*)’:
49958         /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:7130:23: error: expected type-specifier before â€˜typeof’
49959          7130 |     using iter_type = typeof (per_bfd->all_comp_units.begin ());
49960               |                       ^~~~~~
49961
49962         This is because typeof is a GNU extension.  Use C++'s decltype keyword
49963         instead.
49964
49965         Change-Id: Ieca2e8d25e50f71dc6c615a405a972a54de3ef14
49966
49967 2022-04-12  Simon Marchi  <simon.marchi@efficios.com>
49968
49969         gdbsupport: use result_of_t instead of result_of in parallel-for.h
49970         When building with -std=c++11, I get:
49971
49972         In file included from /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:22:                                                                             /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/parallel-for.h:134:10: error: â€˜result_of_t’ is not a member of â€˜std’; did you mean â€˜result_of’?
49973           134 |     std::result_of_t<RangeFunction (RandomIt, RandomIt)>
49974               |          ^~~~~~~~~~~
49975               |          result_of
49976
49977         This is because result_of_t has been introduced in C++14.  Use the
49978         equivalent result_of<...>::type instead.
49979
49980         result_of and result_of_t have been removed in C++20 though, so I think
49981         we'll need some patches eventually to make the code use invoke_result
49982         instead, depending on the C++ version.
49983
49984         Change-Id: I4817f361c0ebcdd4b32976898fc368bb302b61b9
49985
49986 2022-04-12  Tom Tromey  <tom@tromey.com>
49987
49988         Remove dwarf2_per_cu_data::v
49989         Now that the psymtab reader has been removed, the
49990         dwarf2_per_cu_data::v union is no longer needed.  Instead, we can
49991         simply move the members from dwarf2_per_cu_quick_data into
49992         dwarf2_per_cu_data and remove the "quick" object entirely.
49993
49994         Delete DWARF psymtab code
49995         This removes the DWARF psymtab reader.
49996
49997 2022-04-12  Tom Tromey  <tom@tromey.com>
49998
49999         Enable the new DWARF indexer
50000         This patch finally enables the new indexer.  It is left until this
50001         point in the series to avoid any regressions; in particular, it has to
50002         come after the changes to the DWARF index writer to avoid this
50003         problem.
50004
50005         However, if you experiment with the series, this patch can be moved
50006         anywhere from the patch to wire in the new reader to this point.
50007         Moving this patch around is how I got separate numbers for the
50008         parallelization and background finalization patches.
50009
50010         In the ongoing performance example, this reduces the time from the
50011         baseline of 1.598869 to 0.903534.
50012
50013 2022-04-12  Tom Tromey  <tom@tromey.com>
50014
50015         Adapt .debug_names writer to new DWARF scanner
50016         This updates the .debug_names writer to work with the new DWARF
50017         scanner.
50018
50019 2022-04-12  Tom Tromey  <tom@tromey.com>
50020
50021         Adapt .gdb_index writer to new DWARF scanner
50022         This updates the .gdb_index writer to work with the new DWARF scanner.
50023         The .debug_names writer is deferred to another patch, to make review
50024         simpler.
50025
50026         This introduces a small hack to psyms_seen_size, but is
50027         inconsequential because this function will be deleted in a subsequent
50028         patch.
50029
50030 2022-04-12  Tom Tromey  <tom@tromey.com>
50031
50032         Genericize addrmap handling in the DWARF index writer
50033         This updates the DWARF index writing code to make the addrmap-writing
50034         a bit more generic.  Now, it can handle multiple maps, and it can work
50035         using the maps generated by the new indexer.
50036
50037         Note that the new addrmap_index_data::using_index field will be
50038         deleted in a future patch, when the rest of the DWARF psymtab code is
50039         removed.
50040
50041 2022-04-12  Tom Tromey  <tom@tromey.com>
50042
50043         Change parameters to write_address_map
50044         To support the removal of partial symtabs from the DWARF index writer,
50045         this makes a small change to have write_address_map accept the address
50046         map as a parameter, rather than assuming it always comes from the
50047         per-BFD object.
50048
50049         Change the key type in psym_index_map
50050         In order to change the DWARF index writer to avoid partial symtabs,
50051         this patch changes the key type in psym_index_map (and renames that
50052         type as well).  Using the dwarf2_per_cu_data as the key makes it
50053         simpler to reuse this code with the new indexer.
50054
50055         Rename write_psymtabs_to_index
50056         We'll be removing all the psymtab code from the DWARF reader.  As a
50057         preparatory step, this renames write_psymtabs_to_index to avoid the
50058         "psymtab" name.
50059
50060 2022-04-12  Tom Tromey  <tom@tromey.com>
50061
50062         "Finalize" the DWARF index in the background
50063         After scanning the CUs, the DWARF indexer merges all the data into a
50064         single vector, canonicalizing C++ names as it proceeds.  While not
50065         necessarily single-threaded, this process is currently done in just
50066         one thread, to keep memory costs lower.
50067
50068         However, this work is all done without reference to any data outside
50069         of the indexes.  This patch improves the apparent performance of GDB
50070         by moving it to the background.  All uses of the index are then made
50071         to wait for this process to complete.
50072
50073         In our ongoing example, this reduces the scanning time on gdb itself
50074         to 0.173937 (wall).  Recall that before this patch, the time was
50075         0.668923; and psymbol reader does this in 1.598869.  That is, at the
50076         end of this series, we see about a 10x speedup.
50077
50078 2022-04-12  Tom Tromey  <tom@tromey.com>
50079
50080         Parallelize DWARF indexing
50081         This parallelizes the new DWARF indexer.  The indexer's storage was
50082         designed so that each storage object and each indexer is fully
50083         independent.  This setup makes it simple to scan different CUs
50084         independently.
50085
50086         This patch creates a new cooked index storage object per thread, and
50087         then scans a subset of all the CUs in each such thread, using gdb's
50088         existing thread pool.
50089
50090         In the ongoing "gdb gdb" example, this patch reduces the wall time
50091         down to 0.668923, from 0.903534.  (Note that the 0.903534 is the time
50092         for the new index -- that is, when the "enable the new index" patch is
50093         rebased to before this one.  However, in the final series, that patch
50094         appears toward the end.  Hopefully this isn't too confusing.)
50095
50096 2022-04-12  Tom Tromey  <tom@tromey.com>
50097
50098         Pre-read DWARF section data
50099         Because BFD is not thread-safe, we need to be sure that any section
50100         data that is needed is read before trying to do any DWARF indexing in
50101         the background.
50102
50103         This patch takes a simple approach to this -- it pre-reads the
50104         "info"-related sections.  This is done for the main file, but also any
50105         auxiliary files as well, such as the DWO file.
50106
50107         This patch could be perhaps enhanced by removing some now-redundant
50108         calls to dwarf2_section_info::read.
50109
50110 2022-04-12  Tom Tromey  <tom@tromey.com>
50111
50112         Introduce thread-safe handling for complaints
50113         This introduces a new class that can be used to make the "complaint"
50114         code thread-safe.  Instantiating the class installs a new handler that
50115         collects complaints, and then prints them all when the object is
50116         destroyed.
50117
50118         This approach requires some locks.  I couldn't think of a better way
50119         to handle this, though, because the I/O system is not thread-safe.
50120
50121         It seemed to me that only GDB developers are likely to enable
50122         complaints, and because the complaint macro handle this case already
50123         (before any locks are required), I reasoned that any performance
50124         degradation that would result here would be fine.
50125
50126         As an aside about complaints -- are they useful at all?  I just ignore
50127         them, myself, since mostly they seem to indicate compiler problems
50128         that can't be solved in the GDB world anyway.  I'd personally prefer
50129         them to be in a separate tool, like a hypothetical 'dwarflint'.
50130
50131 2022-04-12  Tom Tromey  <tom@tromey.com>
50132
50133         Wire in the new DWARF indexer
50134         This wires the new DWARF indexer into the existing reader code.  That
50135         is, this patch makes the modification necessary to enable the new
50136         indexer.  It is not actually enabled by this patch -- that will be
50137         done later.
50138
50139         I did a bit of performance testing for this patch and a few others.  I
50140         copied my built gdb to /tmp, so that each test would be done on the
50141         same executable.  Then, each time, I did:
50142
50143             $ ./gdb -nx
50144             (gdb) maint time 1
50145             (gdb) file /tmp/gdb
50146
50147         This patch is the baseline and on one machine came in at 1.598869 wall
50148         time.
50149
50150 2022-04-12  Tom Tromey  <tom@tromey.com>
50151
50152         Implement quick_symbol_functions for cooked DWARF index
50153         This implements quick_symbol_functions for the cooked DWARF index.
50154         This is the code that interfaces between the new index and the rest of
50155         gdb.  Cooked indexes still aren't created by anything.
50156
50157         For the most part this is straightforward.  It shares some concepts
50158         with the existing DWARF indices.  However, because names are stored
50159         pre-split in the cooked index, name lookup here is necessarily
50160         different; see expand_symtabs_matching for the gory details.
50161
50162 2022-04-12  Tom Tromey  <tom@tromey.com>
50163
50164         The new DWARF indexer
50165         This patch adds the code to index DWARF.  This is just the scanner; it
50166         reads the DWARF and constructs the index, but nothing calls it yet.
50167
50168         The indexer is split into two parts: a storage object and an indexer
50169         object.  This is done to support the parallelization of this code -- a
50170         future patch will create a single storage object per thread.
50171
50172 2022-04-12  Tom Tromey  <tom@tromey.com>
50173
50174         Introduce the new DWARF index class
50175         This patch introduces the new DWARF index class.  It is called
50176         "cooked" to contrast against a "raw" index, which is mapped from disk
50177         without extra effort.
50178
50179         Nothing constructs a cooked index yet.  The essential idea here is
50180         that index entries are created via the "add" method; then when all the
50181         entries have been read, they are "finalize"d -- name canonicalization
50182         is performed and the entries are added to a sorted vector.
50183
50184         Entries use the DWARF name (DW_AT_name) or linkage name, not the full
50185         name as is done for partial symbols.
50186
50187         These two facets -- the short name and the deferred canonicalization
50188         -- help improve the performance of this approach.  This will become
50189         clear in later patches, when parallelization is added.
50190
50191         Some special code is needed for Ada, because GNAT only emits mangled
50192         ("encoded", in the Ada lingo) names, and so we reconstruct the
50193         hierarchical structure after the fact.  This is also done in the
50194         finalization phase.
50195
50196         One other aspect worth noting is that the way the "main" function is
50197         found is different in the new code.  Currently gdb will notice
50198         DW_AT_main_subprogram, but won't recognize "main" during reading --
50199         this is done later, via explicit symbol lookup.  This is done
50200         differently in the new code so that finalization can be done in the
50201         background without then requiring a synchronization to look up the
50202         symbol.
50203
50204 2022-04-12  Tom Tromey  <tom@tromey.com>
50205
50206         Update skip_one_die for new abbrev properties
50207         This updates skip_one_die to speed it up in the cases where either
50208         sibling_offset or size_if_constant are set.
50209
50210 2022-04-12  Tom Tromey  <tom@tromey.com>
50211
50212         Statically examine abbrev properties
50213         The new DIE scanner works more or less along the lines indicated by
50214         the text for the .debug_names section, disregarding the bugs in the
50215         specification.
50216
50217         While working on this, I noticed that whether a DIE is interesting is
50218         a static property of the DIE's abbrev.  It also turns out that many
50219         abbrevs imply a static size for the DIE data, and additionally that
50220         for many abbrevs, the sibling offset is stored at a constant offset
50221         from the start of the DIE.
50222
50223         This patch changes the abbrev reader to analyze each abbrev and stash
50224         the results on the abbrev.  These combine to speed up the new indexer.
50225         If the "interesting" flag is false, GDB knows to skip the DIE
50226         immediately.  If the sibling offset is statically known, skipping can
50227         be done without reading any attributes; and in some other cases, the
50228         DIE can be skipped using simple arithmetic.
50229
50230 2022-04-12  Tom Tromey  <tom@tromey.com>
50231
50232         Introduce DWARF abbrev cache
50233         The replacement for the DWARF psymbol reader works in a somewhat
50234         different way.  The current reader reads and stores all the DIEs that
50235         might be interesting.  Then, if it is missing a DIE, it re-scans the
50236         CU and reads them all.  This approach is used for both intra- and
50237         inter-CU references.
50238
50239         I instrumented the partial DIE hash to see how frequently it was used:
50240
50241             [  0] -> 1538165
50242             [  1] ->    4912
50243             [  2] ->   96102
50244             [  3] ->     175
50245             [  4] ->     244
50246
50247         That is, most DIEs are never used, and some are looked up twice -- but
50248         this is just an artifact of the implementation of
50249         partial_die_info::fixup, which may do two lookups.
50250
50251         Based on this, the new implementation doesn't try to store any DIEs,
50252         but instead just re-scans them on demand.  In order to do this,
50253         though, it is convenient to have a cache of DWARF abbrevs.  This way,
50254         if a second CU is needed to resolve an inter-CU reference, the abbrevs
50255         for that CU need only be computed a single time.
50256
50257 2022-04-12  Tom Tromey  <tom@tromey.com>
50258
50259         Add "fullname" handling to file_and_directory
50260         This changes the file_and_directory object to be able to compute and
50261         cache the "fullname" in the same way that is done by other code, like
50262         the psymtab reader.
50263
50264         Specialize std::hash for gdb_exception
50265         This adds a std::hash specialization for gdb_exception.  This lets us
50266         store these objects in a hash table, which is used later in this
50267         series to de-duplicate the exception output from multiple threads.
50268
50269         Return vector of results from parallel_for_each
50270         This changes gdb::parallel_for_each to return a vector of the results.
50271         However, if the passed-in function returns void, the return type
50272         remains 'void'.  This functionality is used later, to parallelize the
50273         new indexer.
50274
50275         Add batching parameter to parallel_for_each
50276         parallel_for_each currently requires each thread to process at least
50277         10 elements.  However, when indexing, it's fine for a thread to handle
50278         just a single CU.  This patch parameterizes this, and updates the one
50279         user.
50280
50281         Refactor build_type_psymtabs_reader
50282         The new DWARF scanner needs to save the entire cutu_reader object, not
50283         just parts of it.  In order to make this possible, this patch
50284         refactors build_type_psymtabs_reader.  This change is done separately
50285         because it is easy to review in isolation and it helps make the later
50286         patches smaller.
50287
50288         Add new overload of dwarf5_djb_hash
50289         This adds a new overload of dwarf5_djb_hash.  This is used in
50290         subsequent patches.
50291
50292 2022-04-12  Tom Tromey  <tom@tromey.com>
50293
50294         Add name splitting
50295         The new DWARF index code works by keeping names pre-split.  That is,
50296         rather than storing a symbol name like "a::b::c", the names "a", "b",
50297         and "c" will be stored separately.
50298
50299         This patch introduces some helper code to split a full name into its
50300         components.
50301
50302 2022-04-12  Tom Tromey  <tom@tromey.com>
50303
50304         Let skip_one_die not skip children
50305         This patch adds an option to skip_one_die that causes it not to skip
50306         child DIEs.  This is needed in the new scanner.
50307
50308         Allow ada_decode not to decode operators
50309         The new DWARF scanner records names as they appear in DWARF.  However,
50310         because Ada is unusual, it also decodes the Ada names to synthesize
50311         package components for them.  In order for this to work out properly,
50312         gdb also needs a mode where ada_decode can be instructed not to decode
50313         Ada operator names.  That is what this patch implements.
50314
50315         Refactor dwarf2_get_pc_bounds
50316         This changes dwarf2_get_pc_bounds so that it does not directly access
50317         a psymtab or psymtabs_addrmap.  Instead, both the addrmap and the
50318         desired payload are passed as parameters.  This makes it suitable to
50319         be used by the new indexer.
50320
50321         Add dwarf2_per_cu_data::addresses_seen
50322         This adds a new member to dwarf2_per_cu_data that indicates whether
50323         addresses have been seen for this CU.  This is then set by the
50324         .debug_aranges reader.  The idea here is to detect when a CU does not
50325         have address information, so that the new indexer will know to do
50326         extra scanning in that case.
50327
50328         Fix latent bug in read_addrmap_from_aranges
50329         Tom de Vries found a failure that we tracked down to a latent bug in
50330         read_addrmap_from_aranges (previously create_addrmap_from_aranges).
50331         The bug is that this code can erroneously reject .debug_aranges when
50332         dwz is in use, due to CUs at duplicate offsets.  Because aranges can't
50333         refer to a CU coming from the dwz file, the fix is to simply skip such
50334         CUs in the loop.
50335
50336         Split create_addrmap_from_aranges
50337         This patch splits create_addrmap_from_aranges into a wrapper function
50338         and a worker function.  The worker function is then used in a later
50339         patch.
50340
50341 2022-04-12  Tom Tromey  <tom@tromey.com>
50342
50343         Allow thread-pool.h to work without threads
50344         thread-pool.h requires CXX_STD_THREAD in order to even be included.
50345         However, there's no deep reason for this, and during review we found
50346         that one patch in the new DWARF indexer series unconditionally
50347         requires the thread pool.
50348
50349         Because the thread pool already allows a task to be run in the calling
50350         thread (for example if it is configured to have no threads in the
50351         pool), it seemed straightforward to make this code ok to use when host
50352         threads aren't available at all.
50353
50354         This patch implements this idea.  I built it on a thread-less host
50355         (mingw, before my recent configure patch) and verified that the result
50356         builds.
50357
50358         After the thread-pool change, parallel-for.h no longer needs any
50359         CXX_STD_THREAD checks at all, so this patch removes these as well.
50360
50361 2022-04-12  Nick Clifton  <nickc@redhat.com>
50362
50363         Rebase the zlib sources to the 1.2.12 release
50364
50365 2022-04-12  Tom de Vries  <tdevries@suse.de>
50366
50367         [gdb/testsuite] Fix gdb.base/stap-probe.exp with read1
50368         When running test-case gdb.base/stap-probe.exp with make target check-read1, I
50369         run into this and similar:
50370         ...
50371         FAIL: gdb.base/stap-probe.exp: without semaphore, not optimized: \
50372           info probes stap (timeout)
50373         ...
50374
50375         Fix this by using gdb_test_lines instead of gdb_test.
50376
50377         Tested on x86_64-linux.
50378
50379 2022-04-12  Tom Tromey  <tom@tromey.com>
50380
50381         Add C++ "save gdb-index" test
50382         I found a bug in the new DWARF reader series, related to the handling
50383         of enumerator names.  This bug caused a crash, so this patch adds a
50384         regression test for this particular case.  I'm checking this in.
50385
50386 2022-04-12  Tom Tromey  <tromey@adacore.com>
50387
50388         Remove "Ada Settings" node from the manual
50389         A while back, I sent a patch to unify the Ada varsize-limit setting
50390         with the more generic max-value-size:
50391
50392         https://sourceware.org/pipermail/gdb-patches/2021-September/182004.html
50393
50394         However, it turns out I somehow neglected to send part of the patch.
50395         Internally, I also removed the "Ada Settings" node from the manual, as
50396         it only documents the obsolete setting.
50397
50398         This patch removes this text.
50399
50400 2022-04-12  Tom Tromey  <tromey@adacore.com>
50401
50402         Require GNAT debug info for some Ada tests
50403         A few Ada tests require some debug info in the GNAT runtime.  When run
50404         without this info, these tests can't pass.  This patch changes these
50405         tests to detect this situation and stop with "untested".
50406
50407 2022-04-12  Nick Clifton  <nickc@redhat.com>
50408
50409         Stop strip from removing debuglink sections.
50410                 PR 28992
50411                 * objcopy.c (is_strip_section_1): Do not delete debuglink sections
50412                 when stripping debug information.
50413
50414 2022-04-12  Jan Beulich  <jbeulich@suse.com>
50415
50416         gas: new_logical_line{,_flags}() can return "void"
50417         With the sole user of the return value gone, convert the return type to
50418         void. This in turn allows simplifying another construct, by moving it
50419         slightly later in the function.
50420
50421         gas: drop .appfile and .appline
50422         These were used originally to represent "# <line> <file>" constructs
50423         inserted by (typically) compilers when pre-processing. Quite some time
50424         ago they were replaced by .linefile though. Since the original
50425         directives were never documented, we ought to be able to remove support
50426         for them. As a result in a number of case function parameter aren't used
50427         anymore and can hence be dropped.
50428
50429 2022-04-12  Jan Beulich  <jbeulich@suse.com>
50430
50431         gas: further adjust file/line handling for .macro
50432         Commit 7992631e8c0b ("gas/Dwarf: improve debug info generation from .irp
50433         and alike blocks"), while dealing okay with actual assembly source files
50434         not using .file/.line and alike outside but not inside of .macro, has
50435         undue effects when the logical file/line pair was already overridden:
50436         Line numbers would continuously increment while processing the expanded
50437         macro, while the goal of the PR gas/16908 workaround is to keep the
50438         expansion associated with the line invoking the macro. However, as soon
50439         as enough state was overridden _inside_ the macro to cause as_where() to
50440         no longer fall back top as_where_physical(), honor this by resuming the
50441         bumping of the logical line number.
50442
50443         Note that from_sb_is_expansion's initializer was 1 for an unknown
50444         reason. While renaming the variable and changing its type, also change
50445         the initializer to "expanding_none", which would have been "0" in the
50446         original code. Originally the initializer value itself wasn't ever used
50447         anyway (requiring sb_index != -1), as it necessarily had changed in
50448         input_scrub_include_sb() alongside setting sb_index to other than -1.
50449
50450         Strictly speaking input_scrub_insert_line() perhaps shouldn't use
50451         expanding_none, yet none of the other enumerators fit there either. And
50452         then strictly speaking that function probably shouldn't exist in the
50453         first place. It's used only by tic54x.
50454
50455 2022-04-12  Jan Beulich  <jbeulich@suse.com>
50456
50457         gas: further adjust file/line handling for .irp and alike
50458         Commit 7992631e8c0b ("gas/Dwarf: improve debug info generation from .irp
50459         and alike blocks"), while dealing okay with actual assembly source files
50460         not using .file/.line and alike outside but not inside of .irp et al,
50461         has undue effects when the logical file/line pair was already
50462         overridden: Line numbers would continuously increment upon every
50463         iteration, thus potentially getting far off. Furthermore it left it to
50464         the user to actually insert .file/.line inside such constructs. Note
50465         though that before aforementioned change things weren't pretty either:
50466         Diagnostics (and debug info) would be associated with the directive
50467         terminating the iteration construct, rather than with the actual lines.
50468
50469         Handle this automatically by simply latching the present line and then
50470         re-instating coordinates first thing on every iteration; note that the
50471         file can't change from what was previously pushed on the scrubber's
50472         state stack, and hence can be taken from there by using a new flavor of
50473         .linefile (which is far better memory-footprint-wise than recording the
50474         full path in the inserted directive). (This then leaves undisturbed any
50475         file/line control occurring in the body of the construct, as these will
50476         only be seen and processed afterwards.)
50477
50478 2022-04-12  Jan Beulich  <jbeulich@suse.com>
50479
50480         x86: make {disp16} work similarly to {disp32}
50481         In a few places {disp32} was handled specially when really {disp16}
50482         wants handling just the same.
50483
50484 2022-04-12  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
50485
50486         gprofng doesn't build with gcc 5.5
50487         gprofng/ChangeLog
50488         2022-04-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
50489
50490                 PR gprofng/29026
50491                 * configure.ac: Check version of bison.
50492                 * src/Makefile.am (QLParser.yy): Run bison
50493                 * src/QLParser.yy: Adapted for bison 3.04 or later.
50494                 * src/DbeSession.cc: make some params const.
50495                 * src/DbeSession.h: Likewise.
50496                 * configure: Regenerate.
50497                 * Makefile.in: Regenerate.
50498                 * src/Makefile.in: Regenerate.
50499                 * src/QLParser.tab.cc: Deleted.
50500                 * src/QLParser.tab.hh: Deleted.
50501                 * doc/Makefile.in: Regenerate.
50502                 * gp-display-html/Makefile.in: Regenerate.
50503                 * libcollector/configure: Regenerate.
50504
50505 2022-04-12  GDB Administrator  <gdbadmin@sourceware.org>
50506
50507         Automatic date update in version.in
50508
50509 2022-04-11  John Baldwin  <jhb@FreeBSD.org>
50510
50511         i386-fbsd-nat: Remove two unused variables.
50512         Earlier versions of the change in
50513         1285ce8629b37f800bf21731ee7c7a8b1b8d0233 used this variable, but not
50514         the final version that landed.
50515
50516 2022-04-11  Simon Marchi  <simon.marchi@efficios.com>
50517
50518         gdb: remove MSYMBOL_TARGET_FLAG_{1,2} macros
50519         Replace with equivalent getter/setter macros.
50520
50521         Change-Id: I1042564dd47347337374762bd64ec31b5c573ee2
50522
50523 2022-04-11  Simon Marchi  <simon.marchi@efficios.com>
50524
50525         gdb: remove minimal symbol size macros
50526         Remove MSYMBOL_HAS_SIZE, MSYMBOL_SIZE and SET_MSYMBOL_SIZE, replace them
50527         with equivalent methods.
50528
50529         Change-Id: I6ee1cf82df37e58dff52ea6568ceb4649c7d7538
50530
50531 2022-04-11  Simon Marchi  <simon.marchi@efficios.com>
50532
50533         gdb: remove MSYMBOL_TYPE macro
50534         Add a getter and a setter for a minimal symbol's type.  Remove the
50535         corresponding macro and adjust all callers.
50536
50537         Change-Id: I89900df5ffa5687133fe1a16b2e0d4684e67a77d
50538
50539 2022-04-11  Simon Marchi  <simon.marchi@efficios.com>
50540
50541         gdb: remove symbol value macros
50542         Remove all macros related to getting and setting some symbol value:
50543
50544             #define SYMBOL_VALUE(symbol)           (symbol)->value.ivalue
50545             #define SYMBOL_VALUE_ADDRESS(symbol)                         \
50546             #define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value)    \
50547             #define SYMBOL_VALUE_BYTES(symbol)     (symbol)->value.bytes
50548             #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block
50549             #define SYMBOL_BLOCK_VALUE(symbol)     (symbol)->value.block
50550             #define SYMBOL_VALUE_CHAIN(symbol)     (symbol)->value.chain
50551             #define MSYMBOL_VALUE(symbol)          (symbol)->value.ivalue
50552             #define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0)
50553             #define MSYMBOL_VALUE_ADDRESS(objfile, symbol)                         \
50554             #define BMSYMBOL_VALUE_ADDRESS(symbol) \
50555             #define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value)   \
50556             #define MSYMBOL_VALUE_BYTES(symbol)    (symbol)->value.bytes
50557             #define MSYMBOL_BLOCK_VALUE(symbol)    (symbol)->value.block
50558
50559         Replace them with equivalent methods on the appropriate objects.
50560
50561         Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50
50562
50563 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50564
50565         gdb/doc: add section about Fortran intrinsic functions and types
50566         The earlier version of this document had no sections about the
50567         available Fortran intrinsic functions or the Fortran builtin types.
50568
50569         I added two sections 'Fortran intrinsics' and 'Fortran types' to
50570         document the available Fortran language features.  The subsection
50571         'Fortran Defaults' has been integrated into the Fortran subsection.
50572
50573 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50574
50575         gdb/fortran/testsuite: add complex from integers test
50576         When working on the files I noted that there was no actual test for a
50577         COMPLEX built from two INTEGERS.  I added that now for completion.
50578
50579 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50580
50581         gdb/fortran: rewrite intrinsic handling and add some missing overloads
50582         The operators FLOOR, CEILING, CMPLX, LBOUND, UBOUND, and SIZE accept
50583         (some only with Fortran 2003) the optional parameter KIND.  This
50584         parameter determines the kind of the associated return value.  So far,
50585         implementation of this kind parameter has been missing in GDB.
50586         Additionally, the one argument overload for the CMPLX intrinsic function
50587         was not yet available.
50588
50589         This patch adds overloads for all above mentioned functions to the
50590         Fortran intrinsics handling in GDB.
50591
50592         It re-writes the intrinsic function handling section to use the helper
50593         methods wrap_unop_intrinsic/wrap_binop_intrinsic/wrap_triop_intrinsic.
50594         These methods define the action taken when a Fortran intrinsic function
50595         is called with a certain amount of arguments (1/2/3). The helper methods
50596         fortran_wrap2_kind and fortran_wrap3_kind have been added as equivalents
50597         to the existing wrap and wrap2 methods.
50598
50599         After adding more overloads to the intrinsics handling, some of the
50600         operation names were no longer accurate.  E.g. UNOP_FORTRAN_CEILING
50601         has been renamed to FORTRAN_CEILING as it is no longer a purely unary
50602         intrinsic function.  This patch also introduces intrinsic functions with
50603         one, two, or three arguments to the Fortran parser and the
50604         UNOP_OR_BINOP_OR_TERNOP_INTRINSIC token has been added.
50605
50606 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50607
50608         gdb/fortran: rename f77_keywords to f_keywords
50609         Rename f77_keywords to f_keywords since some of the introduced keywords
50610         in the array are f90 only.
50611
50612 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50613
50614         gdb/fortran: Change GDB print for fortran default types
50615         Currently, when asking GDB to print the type of a Fortran default type
50616         such as INTEGER or REAL, GDB will return the default name of that type,
50617         e.g. "integer"/"real":
50618
50619            (gdb) ptype integer
50620            type = integer
50621            (gdb) ptype real
50622            type = real
50623
50624         For LOGICAL and COMPLEX it would return the actual underlying types
50625
50626            (gdb) ptype logical
50627            type = logical*4
50628            (gdb) ptype complex
50629            type = complex*4
50630
50631         Similarly, GDB would print the default integer type for the underlying
50632         default type:
50633
50634            (gdb) ptype integer*4
50635            type = integer
50636            (gdb) ptype real*4
50637            type = real
50638            (gdb) ptype logical
50639            type = logical*4
50640            (gdb) ptype complex*4
50641            type = complex*4
50642
50643         This is inconsistent and a bit confusing.  Both options somehow indicate
50644         what the internal underlying type for the default type is - but I think
50645         the logical/complex version is a bit clearer.
50646
50647         Consider again:
50648
50649            (gdb) ptype integer
50650            type = integer
50651
50652         This indicates to a user that the type of "integer" is Fortran's default
50653         integer type.  Without examining "ptype integer*4" I would expect, that
50654         any variable declared integer in the actual code would also fit into a
50655         GDB integer.  But, since we cannot adapt out internal types to the
50656         compiler flags used at compile time of a debugged binary, this might be
50657         wrong.  Consider debugging Fortran code compiled with GNU and e.g. the
50658         "-fdefault-integer-8" flag.  In this case the gfortran default integer
50659         would be integer*8 while GDB internally still would use a builtin_integer,
50660         so an integer of the size of an integer*4 type.  On the other hand having
50661         GDB print
50662
50663            (gdb) ptype integer
50664            type = integer*4
50665
50666         makes this clearer.  I would still be tempted to fit a variable declared
50667         integer in the code into a GDB integer - but at least ptype would
50668         directly tell me what is going on.  Note, that when debugging a binary
50669         compiled with "-fdefault-integer-8" a user will always see the actual
50670         underlying type of any variable declared "integer" in the Fortran code.
50671         So having the code
50672
50673            program test
50674              integer :: a = 5
50675              print *, a ! breakpt
50676            end program test
50677
50678         will, when breaking at breakpt print
50679
50680            (gdb) ptype var
50681            type = integer(kind=4)
50682
50683         or
50684
50685            (gdb) ptype var
50686            type = integer(kind=8)
50687
50688         depending on the compiler flag.
50689
50690         This patch changes the outputs for the REAL and INTEGER default types to
50691         actually print the internally used type over the default type name.
50692
50693         The new behavior for the above examples is:
50694
50695            (gdb) ptype integer
50696            type = integer*4
50697            (gdb) ptype integer*4
50698            type = integer*4
50699
50700         Existing testcases have been adapted to reflect the new behavior.
50701
50702 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50703
50704         gdb/fortran: clean-up Fortran intrinsic types
50705         The currently implemented intrinsic type handling for Fortran missed some
50706         tokens and their parsing.  While still not all Fortran type kinds are
50707         implemented this patch at least makes the currently handled types
50708         consistent.  As an example for what this patch does, consider the
50709         intrinsic type INTEGER.  GDB implemented the handling of the
50710         keywords "integer" and "integer_2" but missed "integer_4" and "integer_8"
50711         even though their corresponding internal types were already available as
50712         the Fortran builtin types builtin_integer and builtin_integer_s8.
50713         Similar problems applied to LOGICAL, REAL, and COMPLEX.  This patch adds
50714         all missing tokens and their parsing.  Whenever a section containing the
50715         type handling was touched, it also was reordered to be in a more easy to
50716         grasp order.  All INTEGER/REAL/LOGICAL/COMPLEX types were grouped
50717         together and ordered ascending in their size making a missing one more
50718         easy to spot.
50719
50720         Before this change GDB would print the following when tyring to use the
50721         INTEGER keywords:
50722
50723            (gdb) set language fortran
50724            (gdb) ptype integer*1
50725            unsupported kind 1 for type integer
50726            (gdb) ptype integer_1
50727            No symbol table is loaded.  Use the "file" command.
50728            (gdb) ptype integer*2
50729            type = integer*2
50730            (gdb) ptype integer_2
50731            type = integer*2
50732            (gdb) ptype integer*4
50733            type = integer
50734            (gdb) ptype integer_4
50735            No symbol table is loaded.  Use the "file" command.
50736            (gdb) ptype integer*8
50737            type = integer*8
50738            (gdb) ptype integer_8
50739            No symbol table is loaded.  Use the "file" command.
50740            (gdb) ptype integer
50741            type = integer
50742
50743         With this patch all keywords are available and the GDB prints:
50744
50745            (gdb) set language fortran
50746            (gdb) ptype integer*1
50747            type = integer*1
50748            (gdb) ptype integer_1
50749            type = integer*1
50750            (gdb) ptype integer*2
50751            type = integer*2
50752            (gdb) ptype integer_2
50753            type = integer*2
50754            (gdb) ptype integer*4
50755            type = integer*4
50756            (gdb) ptype integer_4
50757            type = integer*4
50758            (gdb) ptype integer*8
50759            type = integer*8
50760            (gdb) ptype integer_8
50761            type = integer*8
50762            (gdb) ptype integer
50763            type = integer
50764
50765         The described changes have been applied to INTEGER, REAL, COMPLEX,
50766         and LOGICAL. Existing testcases have been adapted to reflect the
50767         new behavior.  Tests for formerly missing types have been added.
50768
50769 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50770
50771         gdb/fortran: change default logical type to builtin_logical
50772         According to the Fortran standard, logical is of the size of a
50773         'single numeric storage unit' (just like real and integer). For
50774         gfortran, flang and ifx/ifort this storage unit (or the default
50775         logical type) is of size kind 4, actually occupying 4 bytes of
50776         storage, and so the default type for logical expressions in
50777         Fortran should probably also be Logical*4 and not Logical*2.  I
50778         adapted GDB's behavior to be in line with
50779         gfortran/ifort/ifx/flang.
50780
50781         gdb/fortran: reformat build_fortran_types in f-lang.c
50782         Add a few newlines after the type definitions and remove some
50783         unnecessary linebreaks.
50784
50785 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50786
50787         gdb/fortran: fix complex type in Fortran builtin types
50788         Before this patch things like
50789
50790           (gdb) ptype complex*8
50791           complex*16
50792           (gdb) ptype complex*4
50793           complex*8
50794
50795         were possible in GDB, which seems confusing for a user.  The reason
50796         is a mixup in the implementation of the Fortran COMPLEX type.  In
50797         Fortran the "*X" after a type would normally (I don't think this
50798         is language required) specify the type's size in memory.  For the
50799         COMPLEX type the kind parameters usually (at least for GNU, Intel, Flang)
50800         specify not the size of the whole type but the size of the individual
50801         two REALs used to form the COMPLEX.  Thus, a COMPLEX*4 will usually
50802         consist of two REAL*4s.  Internally this type was represented by a
50803         builtin_complex_s8 - but here I think the s8 actually meant the raw
50804         size of the type.  This is confusing and I renamed the types (e.g.
50805         builting_complex_s8 became builtin_complex_s4 according to its most
50806         common useage) and their printed names to their language equivalent.
50807         Additionally, I added the default COMPLEX type "COMPLEX" being the same
50808         as a COMPLEX*4 (as is normally the case) and removed the latter.  I added
50809         a few tests for this new behavior as well.
50810
50811         The new behavior is
50812
50813           (gdb) ptype complex*8
50814           complex*8
50815           (gdb) ptype complex*4
50816           complex*4
50817
50818 2022-04-11  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
50819
50820         gdb/f-lang: remove hidden ^L characters
50821
50822         gdb/f-lang: add Integer*1 to Fortran builtin types
50823         Add builtin_integer_s1 of size TARGET_CHAR_BIT to Fortran builtin types.
50824
50825 2022-04-11  Tom de Vries  <tdevries@suse.de>
50826
50827         [gdb/testsuite] Fix gdb.base/annota1.exp with pie
50828         Since commit 359efc2d894 ("[gdb/testsuite] Make gdb.base/annota1.exp more
50829         robust") we see this fail with target board unix/-fPIE/-pie:
50830         ...
50831         FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
50832         ...
50833
50834         The problem is that the commit makes the number and order of matched
50835         annotations fixed, while between target boards unix and unix/-fPIE/-pie there
50836         is a difference:
50837         ...
50838          \032\032post-prompt
50839          Starting program: outputs/gdb.base/annota1/annota1
50840
50841         +\032\032breakpoints-invalid
50842         +
50843          \032\032starting
50844
50845          \032\032frames-invalid
50846         ...
50847
50848         Fix this by optionally matching the additional annotation.
50849
50850         Tested on x86_64-linux.
50851
50852 2022-04-11  Tom de Vries  <tdevries@suse.de>
50853
50854         [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp for m32 pie
50855         As reported in PR29043, when running test-case gdb.dwarf2/dw2-lines.exp with
50856         target board unix/-m32/-fPIE/-pie, we run into:
50857         ...
50858         Breakpoint 2, 0x56555540 in bar ()^M
50859         (gdb) PASS: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: \
50860           continue to breakpoint: foo \(1\)
50861         next^M
50862         Single stepping until exit from function bar,^M
50863         which has no line number information.^M
50864         0x56555587 in main ()^M
50865         (gdb) FAIL: gdb.dwarf2/dw2-lines.exp: cv=2: cdw=32: lv=2: ldw=32: \
50866           next to foo (2)
50867         ...
50868
50869         The problem is that the bar breakpoint ends up at an unexpected location
50870         because:
50871         - the synthetic debug info is incomplete and doesn't provide line info
50872           for the prologue part of the function, so consequently gdb uses the i386
50873           port prologue skipper to get past the prologue
50874         - the i386 port prologue skipper doesn't get past a get_pc_thunk call.
50875
50876         Work around this in the test-case by breaking on bar_label instead.
50877
50878         Tested on x86_64-linux with target boards unix, unix/-m32, unix/-fPIE/-pie and
50879         unix/-m32/-fPIE/-pie.
50880
50881 2022-04-11  GDB Administrator  <gdbadmin@sourceware.org>
50882
50883         Automatic date update in version.in
50884
50885 2022-04-10  GDB Administrator  <gdbadmin@sourceware.org>
50886
50887         Automatic date update in version.in
50888
50889 2022-04-09  Tom Tromey  <tom@tromey.com>
50890
50891         Remove MSYMBOL_VALUE_CHAIN
50892         I noticed that MSYMBOL_VALUE_CHAIN is unused, so this patch removes it.
50893
50894 2022-04-09  Alan Modra  <amodra@gmail.com>
50895
50896         Rearrange struct bfd_section a little
50897         For better packing on 64-bit hosts.
50898
50899                 * section.c (struct bfd_section): Move next and prev field earlier.
50900                 Move alignment_power later.
50901                 (BFD_FAKE_SECTION): Adjust to suit.
50902                 * bfd-in2.h: Regenerate.
50903
50904 2022-04-09  Alan Modra  <amodra@gmail.com>
50905
50906         Don't run pr27228 test for hppa
50907         As the comment says, hppa doesn't support use of BFD_RELOC_* in
50908         .reloc directives.  Using xfail can result in a spurious XPASS result
50909         as BFD_RELOC values change.
50910
50911                 * testsuite/gas/elf/pr27228.d: Change xfail to notarget for hppa.
50912
50913 2022-04-09  Alan Modra  <amodra@gmail.com>
50914
50915         Correct nds32 readelf reloc numbers
50916                 * readelf.c (is_32bit_abs_reloc, is_16bit_abs_reloc): Comment fixes.
50917                 (is_none_reloc): Correct nds32 reloc numbers.
50918
50919 2022-04-09  GDB Administrator  <gdbadmin@sourceware.org>
50920
50921         Automatic date update in version.in
50922
50923 2022-04-08  Fangrui Song  <i@maskray.me>
50924
50925         gas: Port "copy st_size only if unset" to aarch64 and riscv
50926         And disable the new test gas/elf/size.s for alpha which uses its own
50927         .set, for hppa*-*-hpux* which does not allow .size before declaration.
50928
50929 2022-04-08  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
50930
50931         gprofng: fprintf_styled_func not inizialized for disassembler
50932         gprofng/ChangeLog
50933         2022-04-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
50934
50935                 * libcollector/unwind.c: inizialize fprintf_styled_func.
50936                 * src/Disasm.cc: Likewise.
50937
50938 2022-04-08  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
50939
50940         gprofng: zlib handling
50941         gprofng/ChangeLog
50942         2022-04-06  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
50943
50944                 * configure.ac: Add AM_ZLIB.
50945                 * src/Makefile.am: Add $(ZLIBINC) and $(ZLIB).
50946                 * gprofng/src/DbeSession.h: Likewise.
50947                 * configure: Regenerate.
50948                 * Makefile.in: Regenerate.
50949                 * doc/Makefile.in: Regenerate.
50950                 * gp-display-html/Makefile.in: Regenerate.
50951                 * src/Makefile.in: Regenerate.
50952
50953 2022-04-08  Pedro Alves  <pedro@palves.net>
50954
50955         gdb: Avoid undefined shifts, fix Go shifts
50956         I noticed that a build of GDB with GCC + --enable-ubsan, testing
50957         against GDBserver showed this GDB crash:
50958
50959           (gdb) PASS: gdb.trace/trace-condition.exp: trace: 0x00abababcdcdcdcd << 46 == 0x7373400000000000: advance to trace begin
50960           tstart
50961           ../../src/gdb/valarith.c:1365:15: runtime error: left shift of 48320975398096333 by 46 places cannot be represented in type 'long int'
50962           ERROR: GDB process no longer exists
50963           GDB process exited with wait status 269549 exp9 0 1
50964           UNRESOLVED: gdb.trace/trace-condition.exp: trace: 0x00abababcdcdcdcd << 46 == 0x7373400000000000: start trace experiment
50965
50966         The problem is that, "0x00abababcdcdcdcd << 46" is an undefined signed
50967         left shift, because the result is not representable in the type of the
50968         lhs, which is signed.  This actually became defined in C++20, and if
50969         you compile with "g++ -std=c++20 -Wall", you'll see that GCC no longer
50970         warns about it, while it warns if you specify prior language versions.
50971
50972         While at it, there are a couple other situations that are undefined
50973         (and are still undefined in C++20) and result in GDB dying: shifting
50974         by a negative ammount, or by >= than the bit size of the promoted lhs.
50975         For the latter, GDB shifts using (U)LONGEST internally, so you have to
50976         shift by >= 64 bits to see it:
50977
50978          $ gdb --batch -q -ex "p 1 << -1"
50979          ../../src/gdb/valarith.c:1365:15: runtime error: shift exponent -1 is negative
50980          $ # gdb exited
50981
50982          $ gdb --batch -q -ex "p 1 << 64"
50983          ../../src/gdb/valarith.c:1365:15: runtime error: shift exponent 64 is too large for 64-bit type 'long int'
50984          $ # gdb exited
50985
50986         Also, right shifting a negative value is implementation-defined
50987         (before C++20, after which it is defined).  For this, I chose to
50988         change nothing in GDB other than adding tests, as I don't really know
50989         whether we need to do anything.  AFAIK, most implementations do an
50990         arithmetic right shift, and it may be we don't support any host or
50991         target that behaves differently.  Plus, this becomes defined in C++20
50992         exactly as arithmetic right shift.
50993
50994         Compilers don't error out on such shifts, at best they warn, so I
50995         think GDB should just continue doing the shifts anyhow too.
50996
50997         Thus:
50998
50999         - Adjust scalar_binop to avoid the undefined paths, either by adding
51000           explicit result paths, or by casting the lhs of the left shift to
51001           unsigned, as appropriate.
51002
51003           For the shifts by a too-large count, I made the result be what you'd
51004           get if you split the large count in a series of smaller shifts.
51005           Thus:
51006
51007              Left shift, positive or negative lhs:
51008
51009                V << 64
51010                  =>  V << 16 << 16 << 16 << 16
51011                    => 0
51012
51013              Right shift, positive lhs:
51014
51015                Vpos >> 64
51016                  =>  Vpos >> 16 >> 16 >> 16 >> 16
51017                    => 0
51018
51019              Right shift, negative lhs:
51020
51021                Vneg >> 64
51022                  =>  Vneg >> 16 >> 16 >> 16 >> 16
51023                    => -1
51024
51025           This is actually Go's semantics (the compiler really emits
51026           instructions to make it so that you get 0 or -1 if you have a
51027           too-large shift).  So for that language GDB does the shift and
51028           nothing else.  For other C-like languages where such a shift is
51029           undefined, GDB warns in addition to performing the shift.
51030
51031           For shift by a negative count, for Go, this is a hard error.  For
51032           other languages, since their compilers only warn, I made GDB warn
51033           too.  The semantics I chose (we're free to pick them since this is
51034           undefined behavior) is as-if you had shifted by the count cast to
51035           unsigned, thus as if you had shifted by a too-large count, thus the
51036           same as the previous scenario illustrated above.
51037
51038           Examples:
51039
51040             (gdb) set language go
51041             (gdb) p 1 << 100
51042             $1 = 0
51043             (gdb) p -1 << 100
51044             $2 = 0
51045             (gdb) p 1 >> 100
51046             $3 = 0
51047             (gdb) p -1 >> 100
51048             $4 = -1
51049             (gdb) p -2 >> 100
51050             $5 = -1
51051             (gdb) p 1 << -1
51052             left shift count is negative
51053
51054             (gdb) set language c
51055             (gdb) p -2 >> 100
51056             warning: right shift count >= width of type
51057             $6 = -1
51058             (gdb) p -2 << 100
51059             warning: left shift count >= width of type
51060             $7 = 0
51061             (gdb) p 1 << -1
51062             warning: left shift count is negative
51063             $8 = 0
51064             (gdb) p -1 >> -1
51065             warning: right shift count is negative
51066             $9 = -1
51067
51068         - The warnings' texts are the same as what GCC prints.
51069
51070         - Add comprehensive tests in a new gdb.base/bitshift.exp testcase, so
51071           that we exercise all these scenarios.
51072
51073         Change-Id: I8bcd5fa02de3114b7ababc03e65702d86ec8d45d
51074
51075 2022-04-08  Pedro Alves  <pedro@palves.net>
51076
51077         Fix undefined behavior in the Fortran, Go and Pascal number parsers
51078         This commit ports these two fixes to the C parser:
51079
51080           commit ebf13736b42af47c9907b5157c8e80c78dbe00e1
51081           CommitDate: Thu Sep 4 21:46:28 2014 +0100
51082
51083               parse_number("0") reads uninitialized memory
51084
51085           commit 20562150d8a894bc91657c843ee88c508188e32e
51086           CommitDate: Wed Oct 3 15:19:06 2018 -0600
51087
51088               Avoid undefined behavior in parse_number
51089
51090         ... to the Fortran, Go, and Fortran number parsers, fixing the same
51091         problems there.
51092
51093         Also add a new testcase that exercises printing 0xffffffffffffffff
51094         (max 64-bit) in all languages, which crashes a GDB built with UBsan
51095         without the fix.
51096
51097         I moved get_set_option_choices out of all-architectures.exp.tcl to
51098         common code to be able to extract all the supported languages.  I did
51099         a tweak to it to generalize it a bit -- you now have to pass down the
51100         "set" part of the command as well.  This is so that the proc can be
51101         used with "maintenance set" commands as well in future.
51102
51103         Change-Id: I8e8f2fdc1e8407f63d923c26fd55d98148b9e16a
51104
51105 2022-04-08  Nick Clifton  <nickc@redhat.com>
51106
51107         Debug info for function in Windows PE binary on wrong instruction
51108                 PR 29038
51109                 * coffgen.c (coff_find_nearest_line_with_names): Fix typo
51110                 retrieving saved bias.
51111
51112 2022-04-08  Simon Marchi  <simon.marchi@efficios.com>
51113
51114         Pass PKG_CONFIG_PATH down from top-level Makefile
51115         [Sending to binutils, gdb-patches and gcc-patches, since it touches the
51116         top-level Makefile/configure]
51117
51118         I have my debuginfod library installed in a non-standard location
51119         (/opt/debuginfod), which requires me to set
51120         PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
51121         configure:
51122
51123             $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure --with-debuginfod
51124             $ make
51125
51126         or
51127
51128             $ ./configure --with-debuginfod PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
51129             $ make
51130
51131         Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
51132         configure.  When running make (which runs gdb's and binutils'
51133         configure), PKG_CONFIG_PATH is not set, which results in their configure
51134         script not finding the library:
51135
51136             checking for libdebuginfod >= 0.179... no
51137             configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable."
51138
51139         Change the top-level configure/Makefile system to capture the value
51140         passed when configuring the top-level and pass it down to
51141         subdirectories (similar to CFLAGS, LDFLAGS, etc).
51142
51143         I don't know much about the top-level build system, so I really don't
51144         know if I did this correctly.  The changes are:
51145
51146          - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
51147            @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
51148            in config files (i.e. Makefile)
51149          - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
51150            to @PKG_CONFIG_PATH@
51151          - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
51152            variables set when running the sub-configures
51153
51154         I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
51155         I don't think it's needed.  AFAIU, this defines the flags to pass down
51156         when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
51157         be passed down during configure.  After that, it's captured in
51158         gdb/config.status, so even if a "make" causes a re-configure later
51159         (because gdb/configure has changed, for example), the PKG_CONFIG_PATH
51160         value will be remembered.
51161
51162         ChangeLog:
51163
51164                 * configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
51165                 * configure: Re-generate.
51166                 * Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
51167                 (PKG_CONFIG_PATH): New.
51168                 * Makefile.in: Re-generate.
51169
51170         Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
51171
51172 2022-04-08  Simon Marchi  <simon.marchi@efficios.com>
51173
51174         gdb/testsuite: use nopie in gdb.dwarf2/dw2-inline-param.exp
51175         I see this failure:
51176
51177             (gdb) run ^M
51178             Starting program: /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.dwarf2/dw2-inline-param/dw2-inline-param ^M
51179             Warning:^M
51180             Cannot insert breakpoint 1.^M
51181             Cannot access memory at address 0x113b^M
51182             ^M
51183             (gdb) FAIL: gdb.dwarf2/dw2-inline-param.exp: runto: run to *0x113b
51184
51185         The test loads the binary in GDB, grabs the address of a symbol, strips
51186         the binary, reloads it in GDB, runs the program, and then tries to place
51187         a breakpoint at that address.  The problem is that the binary is built
51188         as position independent, so the address GDB grabs in the first place
51189         isn't where the code ends up after running.
51190
51191         Fix this by linking the binary as non-position-independent.  The
51192         alternative would be to compute the relocated address where to place the
51193         breakpoint, but that's not very straightforward, unfortunately.
51194
51195         I was confused for a while, I was trying to load the binary in GDB
51196         manually to get the symbol address, but GDB was telling me the symbol
51197         could not be found.  Meanwhile, it clearly worked in gdb.log.  The thing
51198         is that GDB strips the binary in-place, so we don't have access to the
51199         intermediary binary with symbols.  Change the test to output the
51200         stripped binary to a separate file instead.
51201
51202         Change-Id: I66c56293df71b1ff49cf748d6784bd0e935211ba
51203
51204 2022-04-08  Alan Modra  <amodra@gmail.com>
51205
51206         gdb maintainer commit rights
51207         Formalise what ought to be obvious.  The top level of the binutils-gdb
51208         repository isn't owned by binutils.
51209
51210                 * MAINTAINERS: Spelling fix.  GDB global maintainer rights.
51211
51212 2022-04-08  Bernhard Heckel  <bernhard.heckel@intel.com>
51213             Nils-Christian Kempke  <nils-christian.kempke@intel.com>
51214
51215         gdb/fortran: print fortran extended types with ptype
51216         Add the print of the base-class of an extended type to the output of
51217         ptype.  This requires the Fortran compiler to emit DW_AT_inheritance
51218         for the extended type.
51219
51220 2022-04-08  Bernhard Heckel  <bernhard.heckel@intel.com>
51221             Nils-Christian Kempke  <nils-christian.kempke@intel.com>
51222
51223         gdb/fortran: add support for accessing fields of extended types
51224         Fortran 2003 supports type extension.  This patch allows access
51225         to inherited members by using their fully qualified name as described
51226         in the Fortran standard.
51227
51228         In doing so the patch also fixes a bug in GDB when trying to access the
51229         members of a base class in a derived class via the derived class' base
51230         class member.
51231
51232         This patch fixes PR22497 and PR26373 on GDB side.
51233
51234         Using the example Fortran program from PR22497
51235
51236         program mvce
51237           implicit none
51238
51239           type :: my_type
51240              integer :: my_int
51241           end type my_type
51242
51243           type, extends(my_type) :: extended_type
51244           end type extended_type
51245
51246           type(my_type) :: foo
51247           type(extended_type) :: bar
51248
51249           foo%my_int = 0
51250           bar%my_int = 1
51251
51252           print*, foo, bar
51253
51254         end program mvce
51255
51256         and running this with GDB and setting a BP at 17:
51257
51258         Before:
51259         (gdb) p bar%my_type
51260         A syntax error in expression, near `my_type'.
51261         (gdb) p bar%my_int
51262         There is no member named my_int.
51263         (gdb) p bar%my_type%my_int
51264         A syntax error in expression, near `my_type%my_int'.
51265         (gdb) p bar
51266         $1 = ( my_type = ( my_int = 1 ) )
51267
51268         After:
51269         (gdb) p bar%my_type
51270         $1 = ( my_int = 1 )
51271         (gdb) p bar%my_int
51272         $2 = 1                 # this line requires DW_TAG_inheritance to work
51273         (gdb) p bar%my_type%my_int
51274         $3 = 1
51275         (gdb) p bar
51276         $4 = ( my_type = ( my_int = 1 ) )
51277
51278         In the above example "p bar%my_int" requires the compiler to emit
51279         information about the inheritance relationship between extended_type
51280         and my_type which gfortran and flang currently do not de.  The
51281         respective issue gcc/49475 has been put as kfail.
51282
51283         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26373
51284              https://sourceware.org/bugzilla/show_bug.cgi?id=22497
51285
51286 2022-04-08  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
51287
51288         gdb: add Nils-Christian Kempke to gdb/MAINTAINERS
51289
51290 2022-04-08  Simon Marchi  <simon.marchi@polymtl.ca>
51291
51292         gdb: change file_file_name to return an std::string
51293         Straightforward change, return an std::string instead of a
51294         gdb::unique_xmalloc_ptr<char>.  No behavior change expected.
51295
51296         Change-Id: Ia5e94c94221c35f978bb1b7bdffbff7209e0520e
51297
51298 2022-04-08  GDB Administrator  <gdbadmin@sourceware.org>
51299
51300         Automatic date update in version.in
51301
51302 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51303
51304         gdb/fortran: fix fetching assumed rank array content
51305         Commit:
51306
51307           commit df7a7bdd9766adebc6b117c31bc617d81c1efd43
51308           Date:   Thu Mar 17 18:56:23 2022 +0000
51309
51310               gdb: add support for Fortran's ASSUMED RANK arrays
51311
51312         Added support for Fortran assumed rank arrays.  Unfortunately, this
51313         commit contained a bug that means though GDB can correctly calculate
51314         the rank of an assumed rank array, GDB can't fetch the contents of an
51315         assumed rank array.
51316
51317         The history of this patch can be seen on the mailing list here:
51318
51319           https://sourceware.org/pipermail/gdb-patches/2022-January/185306.html
51320
51321         The patches that were finally committed can be found here:
51322
51323           https://sourceware.org/pipermail/gdb-patches/2022-March/186906.html
51324
51325         The original patches did support fetching the array contents, it was
51326         only the later series that introduced the regression.
51327
51328         The problem is that when calculating the array rank the result is a
51329         count of the number of ranks, i.e. this is a 1 based result, 1, 2, 3,
51330         etc.
51331
51332         In contrast, when computing the details of any particular rank the
51333         value passed to the DWARF expression evaluator should be a 0 based
51334         rank offset, i.e. a 0 based number, 0, 1, 2, etc.
51335
51336         In the patches that were originally merged, this was not the case, and
51337         we were passing the 1 based rank number to the expression evaluator,
51338         e.g. passing 1 when we should pass 0, 2 when we should pass 1, etc.
51339         As a result the DWARF expression evaluator was reading the
51340         wrong (undefined) memory, and returning garbage results.
51341
51342         In this commit I have extended the test case to cover checking the
51343         array contents, I've then ensured we make use of the correct rank
51344         value, and extended some comments, and added or adjusted some asserts
51345         as appropriate.
51346
51347 2022-04-07  Simon Marchi  <simon.marchi@efficios.com>
51348
51349         gdb/testsuite: add "macros" option to gdb_compile
51350         Make gdb_compile handle a new "macros" option, which makes it pass the
51351         appropriate flag to make the compiler include macro information in the
51352         debug info.  This will help simplify tests using macros, reduce
51353         redundant code, and make it easier to add support for a new compiler.
51354
51355         Right now it only handles clang specially (using -fdebug-macro) and
51356         falls back to -g3 otherwise (which works for gcc).  Other compilers can
51357         be added as needed.
51358
51359         There are some tests that are currently skipped if the compiler is nor
51360         gcc nor clang.  After this patch, the tests will attempt to run (the -g3
51361         fall back will be used).  That gives a chance to people using other
51362         compilers to notice something is wrong and maybe add support for their
51363         compiler.  If it is needed to support a compiler that doesn't have a way
51364         to include macro information, then we can always introduce a
51365         "skip_macro_tests" that can be used to skip over them.
51366
51367         Change-Id: I50cd6ab1bfbb478c1005486408e214b551364c9b
51368
51369 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51370
51371         gdb: remove subfile::buildsym_compunit field
51372         It is only set, never used.
51373
51374         Change-Id: Ia46ed2f9da243b0ccfc4588c1b57be2a0f3939de
51375
51376 2022-04-07  Tom de Vries  <tdevries@suse.de>
51377
51378         [gdb/testsuite] Make gdb.base/annota1.exp more robust
51379         On openSUSE Tumbleweed I run into:
51380         ...
51381         FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
51382         ...
51383
51384         The problem is that the libthread_db message occurs at a location where it's
51385         not expected:
51386         ...
51387         Starting program: outputs/gdb.base/annota1/annota1 ^M
51388         ^M
51389         ^Z^Zstarting^M
51390         ^M
51391         ^Z^Zframes-invalid^M
51392         [Thread debugging using libthread_db enabled]^M
51393         Using host libthread_db library "/lib64/libthread_db.so.1".^M
51394         ^M
51395         ^Z^Zbreakpoints-invalid^M
51396         ^M
51397         ...
51398
51399         Fix this by making the matching more robust:
51400         - rewrite the regexp such that each annotation is on a single line,
51401           starting with \r\n\032\032 and ending with \r\n
51402         - add a regexp variable optional_re, that matches all possible optional
51403           output, and use it as a separator in the first part of the regexp
51404
51405         Tested on x86_64-linux.
51406
51407 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51408
51409         gdb/testsuite/dwarf: simplify line number program syntax
51410         By calling `uplevel $body` in the program proc (a pattern we use at many
51411         places), we can get rid of curly braces around each line number program
51412         directive.  That seems like a nice small improvement to me.
51413
51414         Change-Id: Ib327edcbffbd4c23a08614adee56c12ea25ebc0b
51415
51416 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51417
51418         gdb/testsuite/dwarf: remove two unused variables
51419         These variables seem to be unused, remove them.
51420
51421         Change-Id: I7d613d9d35735930ee78b2c348943c73a702afbb
51422
51423 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51424
51425         gdb: remove symtab::pspace
51426         Same idea as previous patch, but for symtab::pspace.
51427
51428         Change-Id: I1023abe622bea75ef648c6a97a01b53775d4104d
51429
51430 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51431
51432         gdb: remove symtab::objfile
51433         Same idea as previous patch, but for symtab::objfile.  I find
51434         it clearer without this wrapper, as it shows that the objfile is
51435         common to all symtabs of a given compunit.  Otherwise, you could think
51436         that each symtab (of a given compunit) can have a specific objfile.
51437
51438         Change-Id: Ifc0dbc7ec31a06eefa2787c921196949d5a6fcc6
51439
51440 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51441
51442         gdb: remove symtab::blockvector
51443         symtab::blockvector is a wrapper around compunit_symtab::blockvector.
51444         It is a bit misleadnig, as it gives the impression that a symtab has a
51445         blockvector.  Remove it, change all users to fetch the blockvector
51446         through the compunit instead.
51447
51448         Change-Id: Ibd062cd7926112a60d52899dff9224591cbdeebf
51449
51450 2022-04-07  Simon Marchi  <simon.marchi@efficios.com>
51451
51452         gdb: remove symtab::dirname
51453         I think the symtab::dirname method is bogus, or at least very
51454         misleading.  It makes you think that it returns the directory that was
51455         used to find that symtab's file during compilation (i.e. the directory
51456         the file refers to in the DWARF line header file table), or the
51457         directory part of the symtab's filename maybe.  In fact, it returns the
51458         compilation unit's directory, which is the CWD of the compiler, at
51459         compilation time.  At least for DWARF, if the symtab's filename is
51460         relative, it will be relative to that directory.  But if the symtab's
51461         filename is absolute, then the directory returned by symtab::dirname has
51462         nothing to do with the symtab's filename.
51463
51464         Remove symtab::dirname to avoid this confusion, change all users to
51465         fetch the same information through the compunit.  At least, it will be
51466         clear that this is a compunit property, not a symtab property.
51467
51468         Change-Id: I2894c3bf3789d7359a676db3c58be2c10763f5f0
51469
51470 2022-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
51471
51472         gdb/testsuite: make gdb_breakpoint and runto take a linespec
51473         Change gdb_breakpoint to accept a linespec, not just a function.  In
51474         fact, no behavior changes are necessary, this only changes the parameter
51475         name and documentation.  Change runto as well, since the two are so
51476         close (runto forwards all its arguments to gdb_breakpoint).
51477
51478         I wrote this for a downstrean GDB port,  but thought it could be
51479         useful upstream, eventually, even though not callers take advantage of
51480         it yet.
51481
51482         Change-Id: I08175fd444d5a60df90fd9985e1b5dfd87c027cc
51483
51484 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51485
51486         gdb: update comments throughout reggroups.{c,h} files
51487         This commit updates the comments in the gdb/reggroups.{c,h} files.
51488         Fill in some missing comments, correct a few comments that were not
51489         clear, and where we had comments duplicated between .c and .h files,
51490         update the .c to reference the .h.
51491
51492         No user visible changes after this commit.
51493
51494 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51495
51496         gdb: move struct reggroup into reggroups.h header
51497         Move 'struct reggroup' into the reggroups.h header.  Remove the
51498         reggroup_name and reggroup_type accessor functions, and just use the
51499         name/type member functions within 'struct reggroup', update all uses
51500         of these removed functions.
51501
51502         There should be no user visible changes after this commit.
51503
51504 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51505
51506         gdb: convert reggroup to a C++ class with constructor, etc
51507         Convert the 'struct reggroup' into a real class, with a constructor
51508         and getter methods.
51509
51510         There should be no user visible changes after this commit.
51511
51512 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51513
51514         gdb: make the pre-defined register groups const
51515         Convert the 7 global, pre-defined, register groups const, and fix the
51516         fall out (a minor tweak required in riscv-tdep.c).
51517
51518         There should be no user visible changes after this commit.
51519
51520 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51521
51522         gdb: more 'const' in gdb/reggroups.{c,h}
51523         Convert the reggroup_new and reggroup_gdbarch_new functions to return
51524         a 'const regggroup *', and fix up all the fallout.
51525
51526         There should be no user visible changes after this commit.
51527
51528 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51529
51530         gdb: remove reggroup_next and reggroup_prev
51531         Add a new function gdbarch_reggroups that returns a reference to a
51532         vector containing all the reggroups for an architecture.
51533
51534         Make use of this function throughout GDB instead of the existing
51535         reggroup_next and reggroup_prev functions.
51536
51537         Finally, delete the reggroup_next and reggroup_prev functions.
51538
51539         Most of these changes are pretty straight forward, using range based
51540         for loops instead of the old style look using reggroup_next.  There
51541         are two places where the changes are less straight forward.
51542
51543         In gdb/python/py-registers.c, the register group iterator needed to
51544         change slightly.  As the iterator is tightly coupled to the gdbarch, I
51545         just fetch the register group vector from the gdbarch when needed, and
51546         use an index counter to find the next item from the vector when
51547         needed.
51548
51549         In gdb/tui/tui-regs.c the tui_reg_next and tui_reg_prev functions are
51550         just wrappers around reggroup_next and reggroup_prev respectively.
51551         I've just inlined the logic of the old functions into the tui
51552         functions.  As the tui function had its own special twist (wrap around
51553         behaviour) I think this is OK.
51554
51555         There should be no user visible changes after this commit.
51556
51557 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51558
51559         gdb: convert reggroups to use a std::vector
51560         Replace manual linked list with a std::vector.  This commit doesn't
51561         change the reggroup_next and reggroup_prev API, but that will change
51562         in a later commit.
51563
51564         This commit is focused on the minimal changes needed to manage the
51565         reggroups using a std::vector, without changing the API exposed by the
51566         reggroup.c file.
51567
51568         There should be no user visible changes after this commit.
51569
51570 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51571
51572         gdb: always add the default register groups
51573         There's a set of 7 default register groups.  If we don't add any
51574         gdbarch specific register groups during gdbarch initialisation, then
51575         when we iterate over the register groups using reggroup_next and
51576         reggroup_prev we will make use of these 7 default groups.  See the use
51577         of default_groups in gdb/reggroups.c for details on this.
51578
51579         However, if the gdbarch adds its own groups during gdbarch
51580         initialisation, then these groups will be used in preference to the
51581         default groups.
51582
51583         A problem arises though if the particular architecture makes use of
51584         the target description mechanism.  If the default target
51585         description(s) (i.e. those internal to GDB that are used when the user
51586         doesn't provide their own) don't mention any additional register
51587         groups then the default register groups will be used.
51588
51589         But if the target description does mention additional groups then the
51590         default groups are not used, and instead, the groups from the target
51591         description are used.
51592
51593         The problem with this is that what usually happens is that the target
51594         description will mention additional groups, e.g. groups for special
51595         registers.  Most architectures that use target descriptions work
51596         around this by adding all (or most) of the default register groups in
51597         all cases.  See i386_add_reggroups, aarch64_add_reggroups,
51598         riscv_add_reggroups, xtensa_add_reggroups, and others.
51599
51600         In this patch, my suggestion is that we should just add the default
51601         register groups for every architecture, always.  This change is in
51602         gdb/reggroups.c.
51603
51604         All the remaining changes are me updating the various architectures to
51605         not add the default groups themselves.
51606
51607         So, where will this change be visible to the user?  I think the
51608         following commands will possibly change:
51609
51610         * info registers / info all-registers:
51611
51612           The user can provide a register group to these commands.  For example,
51613           on csky, we previously never added the 'vector' group.  Now, as a
51614           default group, this will be available, but (presumably) will not
51615           contain any registers.  I don't think this is necessarily a bad
51616           thing, there's something to be said for having some consistent
51617           defaults available.  There are other architectures that didn't add
51618           all 7 of the defaults, which will now have gained additional groups.
51619
51620         * maint print reggroups
51621
51622           This prints the set of all available groups.  As a maintenance
51623           command I'm less concerned with the output changing here.
51624           Obviously, for the architectures that didn't previously add all the
51625           defaults, this list just got bigger.
51626
51627         * maint print register-groups
51628
51629           This prints all the registers, and the groups they are in.  If the
51630           defaults were not previously being added then a register (obviously)
51631           can't appear in one of the default groups.  Now the groups are
51632           available then registers might be in more groups than previously.
51633           However, this is again a maintenance command, so I'm less concerned
51634           about this changing.
51635
51636 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51637
51638         gdb/tui: fix 'tui reg next/prev' command when data window is hidden
51639         Start GDB like:
51640
51641           $ gdb -q executable
51642           (gdb) start
51643           (gdb) layout src
51644           ... tui windows are now displayed ...
51645           (gdb) tui reg next
51646
51647         At this point the data (register) window should be displayed, but will
51648         contain the message 'Register Values Unavailable', and at the console
51649         you'll see the message "unknown register group 'next'".
51650
51651         The same happens with 'tui reg prev' (but the error message is
51652         slightly different).
51653
51654         At this point you can continue to use 'tui reg next' and/or 'tui reg
51655         prev' and you'll keep getting the error message.
51656
51657         The problem is that when the data (register) window is first
51658         displayed, it's current register group is nullptr.  As a consequence
51659         tui_reg_next and tui_reg_prev (tui/tui-regs.c) will always just return
51660         nullptr, which triggers an error in tui_reg_command.
51661
51662         In this commit I change tui_reg_next and tui_reg_prev so that they
51663         instead return the first and last register group respectively if the
51664         current register group is nullptr.
51665
51666         So, after this, using 'tui reg next' will (in the above case) show the
51667         first register group, while 'tui reg prev' will display the last
51668         register group.
51669
51670 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51671
51672         gdb/tui: avoid theoretical bug with 'tui reg' command
51673         While looking at the 'tui reg' command as part of another patch, I
51674         spotted a theoretical bug.
51675
51676         The 'tui reg' command takes the name of a register group, but also
51677         handles partial register group matches, though the partial match has to
51678         be unique.  The current command logic goes:
51679
51680         With the code as currently written, if a target description named a
51681         register group either 'prev' or 'next' then GDB would see this as an
51682         ambiguous register name, and refuse to switch groups.
51683
51684         Naming a register group 'prev' or 'next' seems pretty unlikely, but,
51685         by adding a single else block we can prevent this problem.
51686
51687         Now, if there's a 'prev' or 'next' register group, the user will not
51688         be able to select the group directly, the 'prev' and 'next' names will
51689         always iterate through the available groups instead.  But at least the
51690         user could select their groups by iteration, rather than direct
51691         selection.
51692
51693 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51694
51695         gdb: have reggroup_find return a const
51696         Update reggroup_find to return a const reggroup *.
51697
51698         There are other function in gdb/reggroup.{c,h} files that could
51699         benefit from returning const, these will be updated in later commits.
51700
51701         There should be no user visible changes after this commit.
51702
51703 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51704
51705         gdb: use 'const reggroup *' in python/py-registers.c file
51706         Convert uses of 'struct reggroup *' in python/py-registers.c to be
51707         'const'.
51708
51709         There should be no user visible changes after this commit.
51710
51711 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51712
51713         gdb: switch to using 'const reggroup *' in tui-regs.{c,h}
51714         Make uses of 'reggroup *' const throughout tui-regs.{c,h}.
51715
51716         There should be no user visible changes after this commit.
51717
51718 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51719
51720         gdb: make gdbarch_register_reggroup_p take a const reggroup *
51721         Change gdbarch_register_reggroup_p to take a 'const struct reggroup *'
51722         argument.  This requires a change to the gdb/gdbarch-components.py
51723         script, regeneration of gdbarch.{c,h}, and then updates to all the
51724         architectures that implement this method.
51725
51726         There should be no user visible changes after this commit.
51727
51728 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51729
51730         gdb: add some const in gdb/reggroups.c
51731         This commit makes the 'struct reggroup *' argument const for the
51732         following functions:
51733
51734           reggroup_next
51735           reggroup_prev
51736           reggroup_name
51737           reggroup_type
51738
51739         There are other places that could benefit from const in the
51740         reggroup.{c,h} files, but these will be changing in further commits.
51741
51742         There should be no user visible changes after this commit.
51743
51744 2022-04-07  Andrew Burgess  <aburgess@redhat.com>
51745
51746         gdb: don't try to use readline before it's initialized
51747         While working on a different patch, I triggered an assertion from the
51748         initialize_current_architecture code, specifically from one of
51749         the *_gdbarch_init functions in a *-tdep.c file.  This exposes a
51750         couple of issues with GDB.
51751
51752         This is easy enough to reproduce by adding 'gdb_assert (false)' into a
51753         suitable function.  For example, I added a line into i386_gdbarch_init
51754         and can see the following issue.
51755
51756         I start GDB and immediately hit the assert, the output is as you'd
51757         expect, except for the very last line:
51758
51759           $ ./gdb/gdb --data-directory ./gdb/data-directory/
51760           ../../src.dev-1/gdb/i386-tdep.c:8455: internal-error: i386_gdbarch_init: Assertion `false' failed.
51761           A problem internal to GDB has been detected,
51762           further debugging may prove unreliable.
51763           ----- Backtrace -----
51764           ... snip ...
51765           ---------------------
51766           ../../src.dev-1/gdb/i386-tdep.c:8455: internal-error: i386_gdbarch_init: Assertion `false' failed.
51767           A problem internal to GDB has been detected,
51768           further debugging may prove unreliable.
51769           Quit this debugging session? (y or n) ../../src.dev-1/gdb/ser-event.c:212:16: runtime error: member access within null pointer of type 'struct serial'
51770
51771         Something goes wrong when we try to query the user.  Note, I
51772         configured GDB with --enable-ubsan, I suspect that without this the
51773         above "error" would actually just be a crash.
51774
51775         The backtrace from ser-event.c:212 looks like this:
51776
51777           (gdb) bt 10
51778           #0  serial_event_clear (event=0x675c020) at ../../src/gdb/ser-event.c:212
51779           #1  0x0000000000769456 in invoke_async_signal_handlers () at ../../src/gdb/async-event.c:211
51780           #2  0x000000000295049b in gdb_do_one_event () at ../../src/gdbsupport/event-loop.cc:194
51781           #3  0x0000000001f015f8 in gdb_readline_wrapper (
51782               prompt=0x67135c0 "../../src/gdb/i386-tdep.c:8455: internal-error: i386_gdbarch_init: Assertion `false' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nQuit this debugg"...)
51783               at ../../src/gdb/top.c:1141
51784           #4  0x0000000002118b64 in defaulted_query(const char *, char, typedef __va_list_tag __va_list_tag *) (
51785               ctlstr=0x2e4eb68 "%s\nQuit this debugging session? ", defchar=0 '\000', args=0x7fffffffa6e0)
51786               at ../../src/gdb/utils.c:934
51787           #5  0x0000000002118f72 in query (ctlstr=0x2e4eb68 "%s\nQuit this debugging session? ")
51788               at ../../src/gdb/utils.c:1026
51789           #6  0x00000000021170f6 in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=0x6107bc0 <internal_error_problem>, file=0x2b976c8 "../../src/gdb/i386-tdep.c",
51790               line=8455, fmt=0x2b96d7f "%s: Assertion `%s' failed.", ap=0x7fffffffa8e8) at ../../src/gdb/utils.c:417
51791           #7  0x00000000021175a0 in internal_verror (file=0x2b976c8 "../../src/gdb/i386-tdep.c", line=8455,
51792               fmt=0x2b96d7f "%s: Assertion `%s' failed.", ap=0x7fffffffa8e8) at ../../src/gdb/utils.c:485
51793           #8  0x00000000029503b3 in internal_error (file=0x2b976c8 "../../src/gdb/i386-tdep.c", line=8455,
51794               fmt=0x2b96d7f "%s: Assertion `%s' failed.") at ../../src/gdbsupport/errors.cc:55
51795           #9  0x000000000122d5b6 in i386_gdbarch_init (info=..., arches=0x0) at ../../src/gdb/i386-tdep.c:8455
51796           (More stack frames follow...)
51797
51798         It turns out that the problem is that the async event handler
51799         mechanism has been invoked, but this has not yet been initialized.
51800
51801         If we look at gdb_init (in gdb/top.c) we can indeed see the call to
51802         gdb_init_signals is after the call to initialize_current_architecture.
51803
51804         If I reorder the calls, moving gdb_init_signals earlier, then the
51805         initial error is resolved, however, things are still broken.  I now
51806         see the same "Quit this debugging session? (y or n)" prompt, but when
51807         I provide an answer and press return GDB immediately crashes.
51808
51809         So what's going on now?  The next problem is that the call_readline
51810         field within the current_ui structure is not initialized, and this
51811         callback is invoked to process the reply I entered.
51812
51813         The problem is that call_readline is setup as a result of calling
51814         set_top_level_interpreter, which is called from captured_main_1.
51815         Unfortunately, set_top_level_interpreter is called after gdb_init is
51816         called.
51817
51818         I wondered how to solve this problem for a while, however, I don't
51819         know if there's an easy "just reorder some lines" solution here.
51820         Looking through captured_main_1 there seems to be a bunch of
51821         dependencies between printing various things, parsing config files,
51822         and setting up the interpreter.  I'm sure there is a solution hiding
51823         in there somewhere.... I'm just not sure I want to spend any longer
51824         looking for it.
51825
51826         So.
51827
51828         I propose a simpler solution, more of a hack/work-around.  In utils.c
51829         we already have a function filtered_printing_initialized, this is
51830         checked in a few places within internal_vproblem.  In some of these
51831         cases the call gates whether or not GDB will query the user.
51832
51833         My proposal is to add a new readline_initialized function, which
51834         checks if the current_ui has had readline initialized yet.  If this is
51835         not the case then we should not attempt to query the user.
51836
51837         After this change GDB prints the error message, the backtrace, and
51838         then aborts (including dumping core).  This actually seems pretty sane
51839         as, if GDB has not yet made it through the initialization then it
51840         doesn't make much sense to allow the user to say "no, I don't want to
51841         quit the debug session" (I think).
51842
51843 2022-04-07  Luis Machado  <luis.machado@arm.com>
51844
51845         Recognize the NT_ARM_SYSTEM_CALL register set
51846         Update binutils to recognize the NT_ARM_SYSTEM_CALL set that is dumped by
51847         Linux to core files.
51848
51849 2022-04-07  Mark Harmstone  <mark@harmstone.com>
51850
51851         Add support for COFF secidx relocations
51852         bfd     * coff-i386.c (in_reloc_p): Add R_SECTION.
51853                 (howto_table): Add R_SECTION.
51854                 (coff_pe_i386_relocation_section): Add support for R_SECTION.
51855                 (coff_i386_reloc_type_lookup): Add support for
51856                 BFD_RELOC_16_SECCIDX.
51857                 * coff-x86_64.c (in_reloc_p): Add R_SECTION.
51858                 (howto_table): Add R_SECTION.
51859                 (coff_pe_amd64_relocation_section): Add support for R_SECTION.
51860                 (coff_amd64_reloc_type_lookup): Add support for
51861                 BFD_RELOC_16_SECCIDX.
51862                 * reloc.c: Add BFD_RELOC_16_SECIDX.
51863                 * bfd-in2.h: Regenerate.
51864                 * libbfd.h: Regenerate.
51865
51866         gas     * config/tc-i386.c (pe_directive_secidx): New function.
51867                 (md_pseudo_table): Add support for secidx.
51868                 (x86_cons_fix_new): Likewise.
51869                 (tc_gen_reloc): Likewise.
51870                 * expr.c (op_rank): Add O_secidx.
51871                 * expr.h (operatorT): Likewise.
51872                 * symbols.c (resolve_symbol_value): Add support for O_secidx.
51873                 * testsuite/gas/i386/secidx.s: New test source file.
51874                 * testsuite/gas/i386/secidx.d: New test driver file.
51875                 * testsuite/gas/i386/i386.exp: Run new test.
51876
51877         include * coff/i386.h: Define R_SECTION.
51878                 * coff/x86_64.h: Likewise.
51879
51880         ld      * testsuite/ld-pe/secidx1.s: New test source file.
51881                 * testsuite/ld-pe/secidx2.s: New test source file.
51882                 * testsuite/ld-pe/secidx.d: New test driver file.
51883                 * testsuite/ld-pe/secidx_64.d: New test driver file.
51884                 * testsuite/ld-pe/pe.exp: Add new tests.
51885
51886 2022-04-07  Jan Beulich  <jbeulich@suse.com>
51887
51888         gas/Dwarf: record functions
51889         To help tools like addr2line looking up function names, in particular
51890         when dealing with e.g. PE/COFF binaries (linked from ELF objects), where
51891         there's no ELF symbol table to fall back to, emit minimalistic
51892         information for functions marked as such and having their size
51893         specified.
51894
51895         Notes regarding the restriction to (pure) ELF:
51896         - I realize this is a layering violation; I don't see how to deal with
51897           that in a better way.
51898         - S_GET_SIZE(), when OBJ_MAYBE_ELF is defined, looks wrong: Unlike
51899           S_SET_SIZE() it does not check whether the hook is NULL.
51900         - symbol_get_obj(), when OBJ_MAYBE_ELF is defined, looks unusable, as
51901           its return type can only ever be one object format's type (and this
51902           may then not be ELF's).
51903
51904         The new testcases are limited to x86 because I wanted to include the
51905         case where function size can't be determined yet at the time Dwarf2 info
51906         is generated. As .nops gains support by further targets, they could also
51907         be added here then (with, as necessary, expecations suitably relaxed to
51908         cover for insn size differences).
51909
51910 2022-04-07  Jan Beulich  <jbeulich@suse.com>
51911
51912         Arm64: arrange for line number emission for .inst
51913         Just like insns encoded the more conventional way these should have line
51914         number info associated with them.
51915
51916         Arm32: arrange for line number emission for .inst
51917         Just like insns encoded the more conventional way these should have line
51918         number info associated with them.
51919
51920         RISC-V: add testcase to check line number emission for .insn
51921         Since no such test looks to exist, derive one from insn.s.
51922
51923 2022-04-07  Andreas Krebbel  <krebbel@linux.ibm.com>
51924
51925         IBM zSystems: Add support for z16 as CPU name.
51926         So far z16 was identified as arch14. After the machine has been
51927         announced we can now add the real name.
51928
51929         gas/ChangeLog:
51930
51931                 * config/tc-s390.c (s390_parse_cpu): Add z16 as alternate CPU
51932                 name.
51933                 * doc/as.texi: Add z16 and arch14 to CPU string list.
51934                 * doc/c-s390.texi: Add z16 to CPU string list.
51935
51936         opcodes/ChangeLog:
51937
51938                 * s390-mkopc.c (main): Enable z16 as CPU string in the opcode
51939                 table.
51940
51941 2022-04-07  GDB Administrator  <gdbadmin@sourceware.org>
51942
51943         Automatic date update in version.in
51944
51945 2022-04-06  Youling Tang  <tangyouling@loongson.cn>
51946
51947         gdb: mips: Fix the handling of complex type of function return value
51948         $ objdump -d outputs/gdb.base/varargs/varargs
51949         00000001200012e8 <find_max_float_real>:
51950         ...
51951            1200013b8:   c7c10000        lwc1    $f1,0(s8)
51952            1200013bc:   c7c00004        lwc1    $f0,4(s8)
51953            1200013c0:   46000886        mov.s   $f2,$f1
51954            1200013c4:   46000046        mov.s   $f1,$f0
51955            1200013c8:   46001006        mov.s   $f0,$f2
51956            1200013cc:   46000886        mov.s   $f2,$f1
51957            1200013d0:   03c0e825        move    sp,s8
51958            1200013d4:   dfbe0038        ld      s8,56(sp)
51959            1200013d8:   67bd0080        daddiu  sp,sp,128
51960            1200013dc:   03e00008        jr      ra
51961            1200013e0:   00000000        nop
51962
51963         From the above disassembly, we can see that when the return value of the
51964         function is a complex type and len <= 2 * MIPS64_REGSIZE, the return value
51965         will be passed through $f0 and $f2, so fix the corresponding processing
51966         in mips_n32n64_return_value().
51967
51968         $ make check RUNTESTFLAGS='GDB=../gdb gdb.base/varargs.exp --outdir=test'
51969
51970         Before applying the patch:
51971          FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)
51972          FAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, dc3, dc4)
51973
51974          # of expected passes            9
51975          # of unexpected failures        2
51976
51977         After applying the patch:
51978          # of expected passes            11
51979
51980         This also fixes:
51981          FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex
51982
51983         Co-Authored-By: Maciej W. Rozycki <macro@orcam.me.uk>
51984
51985 2022-04-06  Tom Tromey  <tom@tromey.com>
51986
51987         Use new and delete in jit.c
51988         This changes jit.c to use new and delete, rather than XCNEW.  This
51989         simplifies the code a little.  This was useful for another patch I'm
51990         working on, and I thought it would make sense to send it separately.
51991
51992         Regression tested on x86-64 Fedora 34.
51993
51994 2022-04-06  Simon Marchi  <simon.marchi@efficios.com>
51995
51996         gdb: don't copy entirely optimized out values in value_copy
51997         Bug 28980 shows that trying to value_copy an entirely optimized out
51998         value causes an internal error.  The original bug report involves MI and
51999         some Python pretty printer, and is quite difficult to reproduce, but
52000         another easy way to reproduce (that is believed to be equivalent) was
52001         proposed:
52002
52003             $ ./gdb -q -nx --data-directory=data-directory -ex "py print(gdb.Value(gdb.Value(5).type.optimized_out()))"
52004             /home/smarchi/src/binutils-gdb/gdb/value.c:1731: internal-error: value_copy: Assertion `arg->contents != nullptr' failed.
52005
52006         This is caused by 5f8ab46bc691 ("gdb: constify parameter of
52007         value_copy").  It added an assertion that the contents buffer is
52008         allocated if the value is not lazy:
52009
52010           if (!value_lazy (val))
52011             {
52012               gdb_assert (arg->contents != nullptr);
52013
52014         This was based on the comment on value::contents, which suggest that
52015         this is the case:
52016
52017           /* Actual contents of the value.  Target byte-order.  NULL or not
52018              valid if lazy is nonzero.  */
52019           gdb::unique_xmalloc_ptr<gdb_byte> contents;
52020
52021         However, it turns out that it can also be nullptr also if the value is
52022         entirely optimized out, for example on exit of
52023         allocate_optimized_out_value.  That function creates a lazy value, marks
52024         the entire value as optimized out, and then clears the lazy flag.  But
52025         contents remains nullptr.
52026
52027         This wasn't a problem for value_copy before, because it was calling
52028         value_contents_all_raw on the input value, which caused contents to be
52029         allocated before doing the copy.  This means that the input value to
52030         value_copy did not have its contents allocated on entry, but had it
52031         allocated on exit.  The result value had it allocated on exit.  And that
52032         we copied bytes for an entirely optimized out value (i.e. meaningless
52033         bytes).
52034
52035         From here I see two choices:
52036
52037          1. respect the documented invariant that contents is nullptr only and
52038             only if the value is lazy, which means making
52039             allocate_optimized_out_value allocate contents
52040          2. extend the cases where contents can be nullptr to also include
52041             values that are entirely optimized out (note that you could still
52042             have some entirely optimized out values that do have contents
52043             allocated, it depends on how they were created) and adjust
52044             value_copy accordingly
52045
52046         Choice #1 is safe, but less efficient: it's not very useful to allocate
52047         a buffer for an entirely optimized out value.  It's even a bit less
52048         efficient than what we had initially, because values coming out of
52049         allocate_optimized_out_value would now always get their contents
52050         allocated.
52051
52052         Choice #2 would be more efficient than what we had before: giving an
52053         optimized out value without allocated contents to value_copy would
52054         result in an optimized out value without allocated contents (and the
52055         input value would still be without allocated contents on exit).  But
52056         it's more risky, since it's difficult to ensure that all users of the
52057         contents (through the various_contents* accessors) are all fine with
52058         that new invariant.
52059
52060         In this patch, I opt for choice #2, since I think it is a better
52061         direction than choice #1.  #1 would be a pessimization, and if we go
52062         this way, I doubt that it will ever be revisited, it will just stay that
52063         way forever.
52064
52065         Add a selftest to test this.  I initially started to write it as a
52066         Python test (since the reproducer is in Python), but a selftest is more
52067         straightforward.
52068
52069         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28980
52070         Change-Id: I6e2f5c0ea804fafa041fcc4345d47064b5900ed7
52071
52072 2022-04-06  Jeff Law  <jeffreyalaw@gmail.com>
52073
52074         Fix for v850e divq instruction
52075         This is the last of the correctness fixes I've been carrying around for the
52076         v850.
52077
52078         Like the other recent fixes, this is another case where we haven't been as
52079         careful as we should WRT host vs target types.   For the divq instruction
52080         both operands are 32 bit types.  Yet in the simulator code we convert them
52081         from unsigned int to signed long by assignment.  So 0xfffffffb (aka -5)
52082         turns into 4294967291 and naturally that changes the result of our division.
52083
52084         The fix is simple, insert a cast to int32_t to force interpretation as a
52085         signed value.
52086
52087         Testcase for the simulator is included.  It has a trivial dependency on the
52088         bins patch.
52089
52090 2022-04-06  Jeff Law  <jeffreyalaw@gmail.com>
52091
52092         Fix "bins" simulation for v850e3v5
52093         I've been carrying this for a few years.   One test in the GCC testsuite is
52094         failing due to a bug in the handling of the v850e3v5 instruction "bins".
52095
52096         When the "bins" instruction specifies a 32bit bitfield size, the simulator
52097         exhibits undefined behavior by trying to shift a 32 bit quantity by 32 bits.
52098         In the case of a 32 bit shift, we know what the resultant mask should be.  So
52099         we can just set it.
52100
52101         That seemed better than using 1UL for the constant (on a 32bit host unsigned
52102         long might still just be 32 bits) or needlessly forcing everything to
52103         long long types.
52104
52105         Thankfully the case where this shows up is only bins <src>, 0, 32, <dest>
52106         which would normally be encoded as a simple move.
52107
52108                 * testsuite/v850/allinsns.exp: Add v850e3v5.
52109                 * testsuite/v850/bins.cgs: New test.
52110                 * v850/simops.c (v850_bins): Avoid undefined behavior on left shift.
52111
52112 2022-04-06  Tiezhu Yang  <yangtiezhu@loongson.cn>
52113
52114         gdb: LoongArch: prepend tramp frame unwinder for signal
52115         Implement the "init" method of struct tramp_frame to prepend tramp
52116         frame unwinder for signal on LoongArch.
52117
52118         With this patch, the following failed testcases can be fixed:
52119
52120           FAIL: gdb.base/annota1.exp: backtrace @ signal handler (timeout)
52121           FAIL: gdb.base/annota3.exp: backtrace @ signal handler (pattern 2)
52122
52123 2022-04-06  Andrew Burgess  <aburgess@redhat.com>
52124
52125         gdb: make interp_add static
52126         Since this commit:
52127
52128           commit 8322445e0584be846f5873b9aab257dc9fbda05d
52129           Date:   Tue Jun 21 01:11:45 2016 +0100
52130
52131               Introduce interpreter factories
52132
52133         Interpreters should be registered with GDB, not by calling interp_add,
52134         but with a call to interp_factory_register.  I've checked the insight
52135         source, and it too has moved over to using interp_factory_register.
52136
52137         In this commit I make interp_add static within interps.c.
52138
52139         There should be no user visible change after this commit.
52140
52141 2022-04-06  Nick Clifton  <nickc@redhat.com>
52142
52143         Add code to display the contents of .debug_loclists sections which contain offset entry tables.
52144                 PR 28981
52145                 * dwarf.c (fetch_indexed_value): Rename to fecth_indexed_addr and
52146                 return the address, rather than a string.
52147                 (fetch_indexed_value): New function - returns a value indexed by a
52148                 DW_FORM_loclistx or DW_FORM_rnglistx form.
52149                 (read_and_display_attr_value): Add support for DW_FORM_loclistx
52150                 and DW_FORM_rnglistx.
52151                 (process_debug_info): Load the loclists and rnglists sections.
52152                 (display_loclists_list): Add support for DW_LLE_base_addressx,
52153                 DW_LLE_startx_endx, DW_LLE_startx_length and
52154                 DW_LLE_default_location.
52155                 (display_offset_entry_loclists): New function.  Displays a
52156                 .debug_loclists section that contains offset entry tables.
52157                 (display_debug_loc): Call the new function.
52158                 (display_debug_rnglists_list): Add support for
52159                 DW_RLE_base_addressx, DW_RLE_startx_endx and DW_RLE_startx_length.
52160                 (display_debug_ranges): Display the contents of the section's
52161                 header.
52162                 * dwarf.h (struct debug_info): Add loclists_base field.
52163                 * testsuite/binutils-all/dw5.W: Update expected output.
52164                 * testsuite/binutils-all/x86-64/pr26808.dump: Likewise.
52165
52166 2022-04-06  Luis Machado  <luis.machado@linaro.org>
52167
52168         Enable ARMv8.1-m PACBTI support
52169         This set of changes enable support for the ARMv8.1-m PACBTI extensions [1].
52170
52171         The goal of the PACBTI extensions is similar in scope to that of a-profile
52172         PAC/BTI (aarch64 only), but the underlying implementation is different.
52173
52174         One important difference is that the pointer authentication code is stored
52175         in a separate register, thus we don't need to mask/unmask the return address
52176         from a function in order to produce a correct backtrace.
52177
52178         The patch introduces the following modifications:
52179
52180         - Extend the prologue analyser for 32-bit ARM to handle some instructions
52181         from ARMv8.1-m PACBTI: pac, aut, pacg, autg and bti. Also keep track of
52182         return address signing/authentication instructions.
52183
52184         - Adds code to identify object file attributes that indicate the presence of
52185         ARMv8.1-m PACBTI (Tag_PAC_extension, Tag_BTI_extension, Tag_PACRET_use and
52186         Tag_BTI_use).
52187
52188         - Adds support for DWARF pseudo-register RA_AUTH_CODE, as described in the
52189         aadwarf32 [2].
52190
52191         - Extends the dwarf unwinder to track the value of RA_AUTH_CODE.
52192
52193         - Decorates backtraces with the "[PAC]" identifier when a frame has signed
52194         the return address.
52195
52196         - Makes GDB aware of a new XML feature "org.gnu.gdb.arm.m-profile-pacbti". This
52197         feature is not included as an XML file on GDB's side because it is only
52198         supported for bare metal targets.
52199
52200         - Additional documentation.
52201
52202         [1] https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
52203         [2] https://github.com/ARM-software/abi-aa/blob/main/aadwarf32/aadwarf32.rst
52204
52205 2022-04-06  Andrew Burgess  <aburgess@redhat.com>
52206
52207         gdb: move gdb_disassembly_flag into a new disasm-flags.h file
52208         While working on the disassembler I was getting frustrated.  Every
52209         time I touched disasm.h it seemed like every file in GDB would need to
52210         be rebuilt.  Surely the disassembler can't be required by that many
52211         parts of GDB, right?
52212
52213         Turns out that disasm.h is included in target.h, so pretty much every
52214         file was being rebuilt!
52215
52216         The only thing from disasm.h that target.h needed is the
52217         gdb_disassembly_flag enum, as this is part of the target_ops api.
52218
52219         In this commit I move gdb_disassembly_flag into its own file.  This is
52220         then included in target.h and disasm.h, after which, the number of
52221         files that depend on disasm.h is much reduced.
52222
52223         I also audited all the other includes of disasm.h and found that the
52224         includes in mep-tdep.c and python/py-registers.c are no longer needed,
52225         so I've removed these.
52226
52227         Now, after changing disasm.h, GDB rebuilds much quicker.
52228
52229         There should be no user visible changes after this commit.
52230
52231 2022-04-06  GDB Administrator  <gdbadmin@sourceware.org>
52232
52233         Automatic date update in version.in
52234
52235 2022-04-05  Tom Tromey  <tom@tromey.com>
52236
52237         Introduce wrapped_file
52238         Simon pointed out that timestamped_file probably needed to implement a
52239         few more methods.  This patch introduces a new file-wrapping file that
52240         forwards most of its calls, making it simpler to implement new such
52241         files.  It also converts timestamped_file and pager_file to use it.
52242
52243         Regression tested on x86-64 Fedora 34.
52244
52245 2022-04-05  Tom Tromey  <tromey@adacore.com>
52246
52247         Don't call init_thread_list in windows-nat.c
52248         I don't think there's any need to call init_thread_list in
52249         windows-nat.c.  This patch removes it.  I tested this using the
52250         internal AdaCore test suite on Windows, which FWIW does include some
52251         multi-threaded inferiors.
52252
52253 2022-04-05  Simon Marchi  <simon.marchi@efficios.com>
52254
52255         gdb/testsuite: fix intermittent failure in gdb.base/vfork-follow-parent.exp
52256         Tom de Vries reported some failures in this test:
52257
52258             continue
52259             Continuing.
52260             [New inferior 2 (process 14967)]
52261
52262             Thread 1.1 "vfork-follow-pa" hit Breakpoint 2, break_parent () at /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/vfork-follow-parent.c:23
52263             23  }
52264             (gdb) FAIL: gdb.base/vfork-follow-parent.exp: resolution_method=schedule-multiple: continue to end of inferior 2
52265             inferior 1
52266             [Switching to inferior 1 [process 14961] (/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/vfork-follow-parent)]
52267             [Switching to thread 1.1 (process 14961)]
52268             #0  break_parent () at /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/vfork-follow-parent.c:23
52269             23  }
52270             (gdb) PASS: gdb.base/vfork-follow-parent.exp: resolution_method=schedule-multiple: inferior 1
52271             continue
52272             Continuing.
52273             [Inferior 2 (process 14967) exited normally]
52274             (gdb) FAIL: gdb.base/vfork-follow-parent.exp: resolution_method=schedule-multiple: continue to break_parent (the program exited)
52275
52276         Here, we continue both the vfork parent and child, since
52277         schedule-multiple is on.  The child exits, which un-freezes the parent
52278         and makes an exit event available to GDB.  We expect GDB to consume this
52279         exit event and present it to the user.  Here, we see that GDB shows the
52280         parent hitting a breakpoint before showing the child exit.
52281
52282         Because of the vfork, we know that chronologically, the child exiting
52283         must have happend before the parent hitting a breakpoint.  However,
52284         scheduling being what it is, it is possible for the parent to un-freeze
52285         and exit quickly, such that when GDB pulls events out of the kernel,
52286         exit events for both processes are available.  And then, GDB may chose
52287         at random to return the one for the parent first.  This is what I
52288         imagine what causes the failure shown above.
52289
52290         We could change the test to expect both possible outcomes, but I wanted
52291         to avoid complicating the .exp file that way.  Instead, add a variable
52292         that the parent loops on that we set only after we confirmed the exit of
52293         the child.  That should ensure that the order is always the same.
52294
52295         Note that I wasn't able to reproduce the failure, so I can't tell if
52296         this fix really fixes the problem.
52297
52298         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29021
52299         Change-Id: Ibc8e527e0e00dac54b22021fe4d9d8ab0f3b28ad
52300
52301 2022-04-05  Simon Marchi  <simon.marchi@efficios.com>
52302
52303         gdb/testsuite: fix intermittent failures in gdb.mi/mi-cmd-user-context.exp
52304         I got failures like this once on a CI:
52305
52306             frame^M
52307             &"frame\n"^M
52308             ~"#0  child_sub_function () at /home/jenkins/workspace/binutils-gdb_master_build/arch/amd64/target_board/unix/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:33\n"^M
52309             ~"33\t    dummy = !dummy; /* thread loop line */\n"^M
52310             ^done^M
52311             (gdb) ^M
52312             FAIL: gdb.mi/mi-cmd-user-context.exp: frame 1 (unexpected output)
52313
52314         The problem is that the test expects the following regexp:
52315
52316           ".*#0  0x.*"
52317
52318         And that typically works, when the output of the frame command looks
52319         like:
52320
52321           #0  0x00005555555551bb in child_sub_function () at ...
52322
52323         Note the lack of hexadecimal address in the failing case.  Whether or
52324         not the hexadecimal address is printed (roughly) depends on whether the
52325         current PC is at the beginning of a line.  So depending on where thread
52326         2 was when GDB stopped it (after thread 1 hit its breakpoint), we can
52327         get either output.  Adjust the regexps to not expect an hexadecimal
52328         prefix (0x) but a function name instead (either child_sub_function or
52329         child_function).  That one is always printed, and is also a good check
52330         that we are in the frame we expect.
52331
52332         Note that for test "frame 5", we are showing a pthread frame (on my
52333         system), so the function name is internal to pthread, not something we
52334         can rely on.  In that case, it's almost certain that we are not at the
52335         beginning of a line, or that we don't have debug info, so I think it's
52336         fine to expect the hex prefix.
52337
52338         And for test "frame 6", it's ok to _not_ expect a hex prefix (what the
52339         test currently does), since we are showing thread 1, which has hit a
52340         breakpoint placed at the beginning of a line.
52341
52342         When testing this, Tom de Vries pointed out that the current test code
52343         doesn't ensure that the child threads are in child_sub_function when
52344         they are stopped.  If the scheduler chooses so, it is possible for the
52345         child threads to be still in the pthread_barrier_wait or child_function
52346         functions when they get stopped.  So that would be another racy failure
52347         waiting to happen.
52348
52349         The only way I can think of to ensure the child threads are in the
52350         child_sub_function function when they get stopped is to synchronize the
52351         threads using some variables instead of pthread_barrier_wait.  So,
52352         replace the barrier with an array of flags (one per child thread).  Each
52353         child thread flips its flag in child_sub_function to allow the main
52354         thread to make progress and eventually hit the breakpoint.
52355
52356         I copied user-selected-context-sync.c to a new mi-cmd-user-context.c and
52357         made modifications to that, to avoid interfering with
52358         user-selected-context-sync.exp.
52359
52360         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29025
52361         Change-Id: I919673bbf9927158beb0e8b7e9e980b8d65eca90
52362
52363 2022-04-05  Luis Machado  <luis.machado@arm.com>
52364
52365         Fix qRcmd error code parsing
52366         Someone at IRC spotted a bug in qRcmd handling. This looks like an oversight
52367         or it is that way for historical reasons.
52368
52369         The code in gdb/remote.c:remote_target::rcmd uses isdigit instead of
52370         isxdigit. One could argue that we are expecting decimal numbers, but further
52371         below we use fromhex ().
52372
52373         Update the function to use isxdigit instead and also update the documentation.
52374
52375         I see there are lots of other cases of undocumented number format for error
52376         messages, mostly described as NN instead of nn. For now I'll just update
52377         this particular function.
52378
52379 2022-04-05  Simon Marchi  <simon.marchi@efficios.com>
52380
52381         gdb: resume ongoing step after handling fork or vfork
52382         The test introduced by this patch would fail in this configuration, with
52383         the native-gdbserver or native-extended-gdbserver boards:
52384
52385             FAIL: gdb.threads/next-fork-other-thread.exp: fork_func=fork: target-non-stop=auto: non-stop=off: displaced-stepping=auto: i=2: next to for loop
52386
52387         The problem is that the step operation is forgotten when handling the
52388         fork/vfork.  With "debug infrun" and "debug remote", it looks like this
52389         (some lines omitted for brevity).  We do the next:
52390
52391             [infrun] proceed: enter
52392               [infrun] proceed: addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT
52393               [infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=0, current thread [4154304.4154304.0] at 0x5555555553bf
52394               [infrun] do_target_resume: resume_ptid=4154304.0.0, step=1, sig=GDB_SIGNAL_0
52395               [remote] Sending packet: $vCont;r5555555553bf,5555555553c4:p3f63c0.3f63c0;c:p3f63c0.-1#cd
52396             [infrun] proceed: exit
52397
52398         We then handle a fork event:
52399
52400             [infrun] fetch_inferior_event: enter
52401               [remote] wait: enter
52402                 [remote] Packet received: T05fork:p3f63ee.3f63ee;06:0100000000000000;07:b08e59f6ff7f0000;10:bf60e8f7ff7f0000;thread:p3f63c0.3f63c6;core:17;
52403               [remote] wait: exit
52404               [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
52405               [infrun] print_target_wait_results:   4154304.4154310.0 [Thread 4154304.4154310],
52406               [infrun] print_target_wait_results:   status->kind = FORKED, child_ptid = 4154350.4154350.0
52407               [infrun] handle_inferior_event: status->kind = FORKED, child_ptid = 4154350.4154350.0
52408               [remote] Sending packet: $D;3f63ee#4b
52409               [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [4154304.4154310.0] at 0x7ffff7e860bf
52410               [infrun] do_target_resume: resume_ptid=4154304.0.0, step=0, sig=GDB_SIGNAL_0
52411               [remote] Sending packet: $vCont;c:p3f63c0.-1#73
52412             [infrun] fetch_inferior_event: exit
52413
52414         In the first snippet, we resume the stepping thread with the range-stepping (r)
52415         vCont command.  But after handling the fork (detaching the fork child), we
52416         resumed the whole process freely.  The stepping thread, which was paused by
52417         GDBserver while reporting the fork event, was therefore resumed freely, instead
52418         of confined to the addresses of the stepped line.  Note that since this
52419         is a "next", it could be that we have entered a function, installed a
52420         step-resume breakpoint, and it's ok to continue freely the stepping
52421         thread, but that's not the case here.  The two snippets shown above were
52422         next to each other in the logs.
52423
52424         For the fork case, we can resume stepping right after handling the
52425         event.
52426
52427         However, for the vfork case, where we are waiting for the
52428         external child process to exec or exit, we only resume the thread that
52429         called vfork, and keep the others stopped (see patch "gdb: fix handling of
52430         vfork by multi-threaded program" prior in this series).  So we can't
52431         resume the stepping thread right now.  Instead, do it after handling the
52432         vfork-done event.
52433
52434         Change-Id: I92539c970397ce880110e039fe92b87480f816bd
52435
52436 2022-04-05  Simon Marchi  <simon.marchi@polymtl.ca>
52437
52438         gdb/remote: remove_new_fork_children don't access target_waitstatus::child_ptid if kind == TARGET_WAITKIND_THREAD_EXITED
52439         Following the previous patch, running
52440         gdb.threads/forking-threads-plus-breakpoints.exp continuously eventually
52441         gives me an internal error.
52442
52443             gdb/target/waitstatus.h:372: internal-error: child_ptid: Assertion `m_kind == TARGET_WAITKIND_FORKED || m_kind == TARGET_WAITKIND_VFORKED' failed.^M
52444             FAIL: gdb.threads/forking-threads-plus-breakpoint.exp: cond_bp_target=0: detach_on_fork=on: displaced=off: inferior 1 exited (GDB internal error)
52445
52446         The backtrace is:
52447
52448             0x55925b679c85 internal_error(char const*, int, char const*, ...)
52449                 /home/simark/src/binutils-gdb/gdbsupport/errors.cc:55
52450             0x559258deadd2 target_waitstatus::child_ptid() const
52451                 /home/simark/src/binutils-gdb/gdb/target/waitstatus.h:372
52452             0x55925a7cbac9 remote_target::remove_new_fork_children(threads_listing_context*)
52453                 /home/simark/src/binutils-gdb/gdb/remote.c:7311
52454             0x55925a79dfdb remote_target::update_thread_list()
52455                 /home/simark/src/binutils-gdb/gdb/remote.c:3981
52456             0x55925ad79b83 target_update_thread_list()
52457                 /home/simark/src/binutils-gdb/gdb/target.c:3793
52458             0x55925addbb15 update_thread_list()
52459                 /home/simark/src/binutils-gdb/gdb/thread.c:2031
52460             0x559259d64838 stop_all_threads(char const*, inferior*)
52461                 /home/simark/src/binutils-gdb/gdb/infrun.c:5104
52462             0x559259d88b45 keep_going_pass_signal
52463                 /home/simark/src/binutils-gdb/gdb/infrun.c:8215
52464             0x559259d8951b keep_going
52465                 /home/simark/src/binutils-gdb/gdb/infrun.c:8251
52466             0x559259d78835 process_event_stop_test
52467                 /home/simark/src/binutils-gdb/gdb/infrun.c:6858
52468             0x559259d750e9 handle_signal_stop
52469                 /home/simark/src/binutils-gdb/gdb/infrun.c:6580
52470             0x559259d6c07b handle_inferior_event
52471                 /home/simark/src/binutils-gdb/gdb/infrun.c:5832
52472             0x559259d57db8 fetch_inferior_event()
52473                 /home/simark/src/binutils-gdb/gdb/infrun.c:4222
52474
52475         Indeed, the code accesses target_waitstatus::child_ptid when the kind
52476         is TARGET_WAITKIND_THREAD_EXITED, which is not right.  A
52477         TARGET_WAITKIND_THREAD_EXITED event does not have a child_ptid value
52478         associated, it has an exit status, which we are not interested in.  The
52479         intent is to remove from the thread list the thread that has exited.
52480         Its ptid is found in the stop reply event, get it from there.
52481
52482         Change-Id: Icb298cbb80b8779fdf0c660dde9a5314d5591535
52483
52484 2022-04-05  Simon Marchi  <simon.marchi@efficios.com>
52485
52486         gdbserver: report correct status in thread stop race condition
52487         The test introduced by the following patch would sometimes fail in this
52488         configuration:
52489
52490             FAIL: gdb.threads/next-fork-other-thread.exp: fork_func=vfork: target-non-stop=on: non-stop=off: displaced-stepping=auto: i=14: next to for loop
52491
52492         The test has multiple threads constantly forking or vforking while the
52493         main thread keep doing "next"s.
52494
52495         (After writing the commit message, I realized this also fixes a similar
52496         failure in gdb.threads/forking-threads-plus-breakpoint.exp with the
52497         native-gdbserver and native-extended-gdbserver boards.)
52498
52499         As stop_all_threads is called, because the main thread finished its
52500         "next", it inevitably happens at some point that we ask the remote
52501         target to stop a thread and wait() reports that this thread stopped with
52502         a fork or vfork event, instead of the SIGSTOP we sent to try to stop it.
52503
52504         While running this test, I attached to GDBserver and stopped at
52505         linux-low.cc:3626.  We can see that the status pulled from the kernel
52506         for 2742805 is indeed a vfork event:
52507
52508             (gdb) p/x w
52509             $3 = 0x2057f
52510             (gdb) p WIFSTOPPED(w)
52511             $4 = true
52512             (gdb) p WSTOPSIG(w)
52513             $5 = 5
52514             (gdb) p/x (w >> 8) & (PTRACE_EVENT_VFORK << 8)
52515             $6 = 0x200
52516
52517         However, the statement at line 3626 overrides that:
52518
52519             ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (w)));
52520
52521         OURSTATUS becomes "stopped by a SIGTRAP".  The information about the
52522         fork or vfork is lost.
52523
52524         It's then all downhill from there, stop_all_threads eventually asks for
52525         a thread list update.  That thread list includes the child of that
52526         forgotten fork or vfork, the remote target goes "oh cool, a new process,
52527         let's attach to it!", when in fact that vfork child's destiny was to be
52528         detached.
52529
52530         My reverse-engineered understanding of the code around there is that the
52531         if/else between lines 3562 and 3583 (in the original code) makes sure
52532         OURSTATUS is always initialized (not "ignore").  Either the details are
52533         already in event_child->waitstatus (in the case of fork/vfork, for
52534         example), in which case we just copy event_child->waitstatus to
52535         ourstatus.  Or, if the event is a plain "stopped by a signal" or a
52536         syscall event, OURSTATUS is set to "stopped", but without a signal
52537         number.  Lines 3601 to 3629 (in the original code) serve to fill in that
52538         last bit of information.
52539
52540         The problem is that when `w` holds the vfork status, the code wrongfully
52541         takes this branch, because WSTOPSIG(w) returns SIGTRAP:
52542
52543           else if (current_thread->last_resume_kind == resume_stop
52544                && WSTOPSIG (w) != SIGSTOP)
52545
52546         The intent of this branch is, for example, when we sent SIGSTOP to try
52547         to stop a thread, but wait() reports that it stopped with another signal
52548         (that it must have received from somewhere else simultaneously), say
52549         SIGWINCH.  In that case, we want to report the SIGWINCH.  But in our
52550         fork/vfork case, we don't want to take this branch, as the thread didn't
52551         really stop because it received a signal.  For the non "stopped by a
52552         signal" and non "syscall signal" cases, we would ideally skip over all
52553         that snippet that fills in the signal or syscall number.
52554
52555         The fix I propose is to move this snipppet of the else branch of the
52556         if/else above.  In addition to moving the code, the last two "else if"
52557         branches:
52558
52559           else if (current_thread->last_resume_kind == resume_stop
52560                    && WSTOPSIG (w) != SIGSTOP)
52561             {
52562               /* A thread that has been requested to stop by GDB with vCont;t,
52563                  but, it stopped for other reasons.  */
52564               ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (w)));
52565             }
52566           else if (ourstatus->kind () == TARGET_WAITKIND_STOPPED)
52567             ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (w)));
52568
52569         are changed into a single else:
52570
52571           else
52572             ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (w)));
52573
52574         This is the default path we take if:
52575
52576          - W is not a syscall status
52577          - W does not represent a SIGSTOP that have sent to stop the thread and
52578            therefore want to suppress it
52579
52580         Change-Id: If2dc1f0537a549c293f7fa3c53efd00e3e194e79
52581
52582 2022-04-05  Simon Marchi  <simon.marchi@efficios.com>
52583
52584         gdb: fix handling of vfork by multi-threaded program (follow-fork-mode=parent, detach-on-fork=on)
52585         There is a problem with how GDB handles a vfork happening in a
52586         multi-threaded program.  This problem was reported to me by somebody not
52587         using vfork directly, but using system(3) in a multi-threaded program,
52588         which may be implemented using vfork.
52589
52590         This patch only deals about the follow-fork-mode=parent,
52591         detach-on-fork=on case, because it would be too much to chew at once to
52592         fix the bugs in the other cases as well (I tried).
52593
52594         The problem
52595         -----------
52596
52597         When a program vforks, the parent thread is suspended by the kernel
52598         until the child process exits or execs.  Specifically, in a
52599         multi-threaded program, only the thread that called vfork is suspended,
52600         other threads keep running freely. This is documented in the vfork(2)
52601         man page ("Caveats" section).
52602
52603         Let's suppose GDB is handling a vfork and the user's desire is to detach
52604         from the child. Before detaching the child, GDB must remove the software
52605         breakpoints inserted in the shared parent/child address space, in case
52606         there's a breakpoint in the path the child is going to take before
52607         exec'ing or exit'ing (unlikely, but possible). Otherwise the child could
52608         hit a breakpoint instruction while running outside the control of GDB,
52609         which would make it crash.  GDB must also avoid re-inserting breakpoints
52610         in the parent as long as it didn't receive the "vfork done" event (that
52611         is, when the child has exited or execed): since the address space is
52612         shared with the child, that would re-insert breakpoints in the child
52613         process also. So what GDB does is:
52614
52615           1. Receive "vfork" event for the parent
52616           2. Remove breakpoints from the (shared) address space and set
52617              program_space::breakpoints_not_allowed to avoid re-inserting them
52618           3. Detach from the child thread
52619           4. Resume the parent
52620           5. Wait for and receive "vfork done" event for the parent
52621           6. Clean program_space::breakpoints_not_allowed and re-insert
52622              breakpoints
52623           7. Resume the parent
52624
52625         Resuming the parent at step 4 is necessary in order for the kernel to
52626         report the "vfork done" event.  The kernel won't report a ptrace event
52627         for a thread that is ptrace-stopped.  But the theory behind this is that
52628         between steps 4 and 5, the parent won't actually do any progress even
52629         though it is ptrace-resumed, because the kernel keeps it suspended,
52630         waiting for the child to exec or exit.  So it doesn't matter for that
52631         thread if breakpoints are not inserted.
52632
52633         The problem is when the program is multi-threaded.  In step 4, GDB
52634         resumes all threads of the parent. The thread that did the vfork stays
52635         suspended by the kernel, so that's fine. But other threads are running
52636         freely while breakpoints are removed, which is a problem because they
52637         could miss a breakpoint that they should have hit.
52638
52639         The problem is present with all-stop and non-stop targets.  The only
52640         difference is that with an all-stop targets, the other threads are
52641         stopped by the target when it reports the vfork event and are resumed by
52642         the target when GDB resumes the parent.  With a non-stop target, the
52643         other threads are simply never stopped.
52644
52645         The fix
52646         -------
52647
52648         There many combinations of settings to consider (all-stop/non-stop,
52649         target-non-stop on/off, follow-fork-mode parent/child, detach-on-fork
52650         on/off, schedule-multiple on/off), but for this patch I restrict the
52651         scope to follow-fork-mode=parent, detach-on-fork=on.  That's the
52652         "default" case, where we detach the child and keep debugging the
52653         parent.  I tried to fix them all, but it's just too much to do at once.
52654         The code paths and behaviors for when we don't detach the child are
52655         completely different.
52656
52657         The guiding principle for this patch is that all threads of the vforking
52658         inferior should be stopped as long as breakpoints are removed.  This is
52659         similar to handling in-line step-overs, in a way.
52660
52661         For non-stop targets (the default on Linux native), this is what
52662         happens:
52663
52664          - In follow_fork, we call stop_all_threads to stop all threads of the
52665            inferior
52666          - In follow_fork_inferior, we record the vfork parent thread in
52667            inferior::thread_waiting_for_vfork_done
52668          - Back in handle_inferior_event, we call keep_going, which resumes only
52669            the event thread (this is already the case, with a non-stop target).
52670            This is the thread that will be waiting for vfork-done.
52671          - When we get the vfork-done event, we go in the (new) handle_vfork_done
52672            function to restart the previously stopped threads.
52673
52674         In the same scenario, but with an all-stop target:
52675
52676          - In follow_fork, no need to stop all threads of the inferior, the
52677            target has stopped all threads of all its inferiors before returning
52678            the event.
52679          - In follow_fork_inferior, we record the vfork parent thread in
52680            inferior::thread_waiting_for_vfork_done.
52681          - Back in handle_inferior_event, we also call keep_going.  However, we
52682            only want to resume the event thread here, not all inferior threads.
52683            In internal_resume_ptid (called by resume_1), we therefore now check
52684            whether one of the inferiors we are about to resume has
52685            thread_waiting_for_vfork_done set.  If so, we only resume that
52686            thread.
52687
52688            Note that when resuming multiple inferiors, one vforking and one not
52689            non-vforking, we could resume the vforking thread from the vforking
52690            inferior plus all threads from the non-vforking inferior.  However,
52691            this is not implemented, it would require more work.
52692          - When we get the vfork-done event, the existing call to keep_going
52693            naturally resumes all threads.
52694
52695         Testing-wise, add a test that tries to make the main thread hit a
52696         breakpoint while a secondary thread calls vfork.  Without the fix, the
52697         main thread keeps going while breakpoints are removed, resulting in a
52698         missed breakpoint and the program exiting.
52699
52700         Change-Id: I20eb78e17ca91f93c19c2b89a7e12c382ee814a1
52701
52702 2022-04-05  Simon Marchi  <simon.marchi@polymtl.ca>
52703
52704         gdb/infrun: add logging statement to do_target_resume
52705         This helped me, it shows which ptid we actually call target_resume with.
52706
52707         Change-Id: I2dfd771e83df8c25f39371a13e3e91dc7882b73d
52708
52709 2022-04-05  Simon Marchi  <simon.marchi@polymtl.ca>
52710
52711         gdb/infrun: add inferior parameters to stop_all_threads and restart_threads
52712         A following patch will want to stop all threads of a given inferior (as
52713         opposed to all threads of all inferiors) while handling a vfork, and
52714         restart them after.  To help with this, add inferior parameters to
52715         stop_all_threads and restart_threads.  This is done as a separate patch
52716         to make sure this doesn't cause regressions on its own, and to keep the
52717         following patches more concise.
52718
52719         No visible changes are expected here, since all calls sites pass
52720         nullptr, which should keep the existing behavior.
52721
52722         Change-Id: I4d9ba886ce842042075b4e346cfa64bbe2580dbf
52723
52724 2022-04-05  Simon Marchi  <simon.marchi@polymtl.ca>
52725
52726         gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork_done
52727         The inferior::waiting_for_vfork_done flag indicates that some thread in
52728         that inferior is waiting for a vfork-done event.  Subsequent patches
52729         will need to know which thread precisely is waiting for that event.
52730
52731         Replace the boolean flag (waiting_for_vfork_done) with a thread_info
52732         pointer (thread_waiting_for_vfork_done).
52733
52734         I think there is a latent buglet in that waiting_for_vfork_done is
52735         currently not reset on inferior exec or exit.  I could imagine that if a
52736         thread in the parent process calls exec or exit while another thread of
52737         the parent process is waiting for its vfork child to exec or exit, we
52738         could end up with inferior::waiting_for_vfork_done without a thread
52739         actually waiting for a vfork-done event anymore.  And since that flag is
52740         checked in resume_1, things could misbehave there.
52741
52742         Since the new field points to a thread_info object, and those are
52743         destroyed on exec or exit, it could be worse now since we could try to
52744         access freed memory, if thread_waiting_for_vfork_done were to point to a
52745         stale thread_info.  To avoid this, clear the field in
52746         infrun_inferior_exit and infrun_inferior_execd.
52747
52748         Change-Id: I31b847278613a49ba03fc4915f74d9ceb228fdce
52749
52750 2022-04-05  Simon Marchi  <simon.marchi@efficios.com>
52751
52752         gdb: make timestamped_file implement write_async_safe
52753         Trying to use "set debug linux-nat 1", I get an internal error:
52754
52755             /home/smarchi/src/binutils-gdb/gdb/ui-file.h:70: internal-error: write_async_safe: write_async_safe
52756
52757         The problem is that timestamped_file doesn't implement write_async_safe,
52758         which linux-nat's sigchld_handler uses.  Implement it.
52759
52760         Change-Id: I830981010c6119f13ae673605ed015cced0f5ee8
52761
52762 2022-04-05  GDB Administrator  <gdbadmin@sourceware.org>
52763
52764         Automatic date update in version.in
52765
52766 2022-04-04  Andrew Burgess  <aburgess@redhat.com>
52767
52768         gdb/testsuite: fix timeout in server-pipe.exp test
52769         I noticed that the gdb.server/server-pipe.exp test would sometimes
52770         timeout when my machine was more heavily loaded.  Turns out the test
52771         is reading all the shared libraries over GDB's remote protocol, which
52772         can be slow.
52773
52774         We avoid this in other tests by setting the sysroot in GDBFLAGS,
52775         something which is missing from the gdb.server/server-pipe.exp test.
52776
52777         Fix the timeouts by setting sysroot in GDBFLAGS, after this the shared
52778         libraries are no longer copied over the remote protocol, and I no
52779         longer see the test timeout.
52780
52781 2022-04-04  John Baldwin  <jhb@FreeBSD.org>
52782
52783         Handle TLS variable lookups when using separate debug files.
52784         Commit df22c1e5d53c38f38bce6072bb46de240f9e0e2b handled the case that
52785         a separate debug file was passed as the objfile for a shared library
52786         to svr4_fetch_objfile_link_map.  However, a separate debug file can
52787         also be passed for TLS variables in the main executable.  In addition,
52788         frv_fetch_objfile_link_map also expects to be passed the original
52789         objfile rather than a separate debug file, so pull the code to resolve
52790         a separate debug file to the main objfile up into
52791         target_translate_tls_address.
52792
52793 2022-04-04  Lancelot SIX  <lancelot.six@amd.com>
52794
52795         gdb: Add maint set ignore-prologue-end-flag
52796         The previous patch added support for the DWARF prologue-end flag in line
52797         table. This flag can be used by DWARF producers to indicate where to
52798         place breakpoints past a function prologue.  However, this takes
52799         precedence over prologue analyzers. So if we have to debug a program
52800         with erroneous debug information, the overall debugging experience will
52801         be degraded.
52802
52803         This commit proposes to add a maintenance command to instruct GDB to
52804         ignore the prologue_end flag.
52805
52806         Tested on x86_64-gnu-linux.
52807
52808         Change-Id: Idda6d1b96ba887f4af555b43d9923261b9cc6f82
52809
52810 2022-04-04  Lancelot SIX  <lancelot.six@amd.com>
52811
52812         gdb: Add support for DW_LNS_set_prologue_end in line-table
52813         Add support for DW_LNS_set_prologue_end when building line-tables.  This
52814         attribute can be set by the compiler to indicate that an instruction is
52815         an adequate place to set a breakpoint just after the prologue of a
52816         function.
52817
52818         The compiler might set multiple prologue_end, but considering how
52819         current skip_prologue_using_sal works, this commit modifies it to accept
52820         the first instruction with this marker (if any) to be the place where a
52821         breakpoint should be placed to be at the end of the prologue.
52822
52823         The need for this support came from a problematic usecase generated by
52824         hipcc (i.e. clang).  The problem is as follows:  There's a function
52825         (lets call it foo) which covers PC from 0xa800 to 0xa950.  The body of
52826         foo begins with a call to an inlined function, covering from 0xa800 to
52827         0xa94c.   The issue is that when placing a breakpoint at 'foo', GDB
52828         inserts the breakpoint at 0xa818.  The 0x18 offset is what GDB thinks is
52829         foo's first address past the prologue.
52830
52831         Later, when hitting the breakpoint, GDB reports the stop within the
52832         inlined function because the PC falls in its range while the user
52833         expects to stop in FOO.
52834
52835         Looking at the line-table for this location, we have:
52836
52837             INDEX  LINE   ADDRESS            IS-STMT
52838             [...]
52839             14     293    0x000000000000a66c Y
52840             15     END    0x000000000000a6e0 Y
52841             16     287    0x000000000000a800 Y
52842             17     END    0x000000000000a818 Y
52843             18     287    0x000000000000a824 Y
52844             [...]
52845
52846         For comparison, let's look at llvm-dwarfdump's output for this CU:
52847
52848             Address            Line   Column File   ISA Discriminator Flags
52849             ------------------ ------ ------ ------ --- ------------- -------------
52850             [...]
52851             0x000000000000a66c    293     12      2   0             0  is_stmt
52852             0x000000000000a6e0     96     43     82   0             0  is_stmt
52853             0x000000000000a6f8    102     18     82   0             0  is_stmt
52854             0x000000000000a70c    102     24     82   0             0
52855             0x000000000000a710    102     18     82   0             0
52856             0x000000000000a72c    101     16     82   0             0  is_stmt
52857             0x000000000000a73c   2915     50     83   0             0  is_stmt
52858             0x000000000000a74c    110      1      1   0             0  is_stmt
52859             0x000000000000a750    110      1      1   0             0  is_stmt end_sequence
52860             0x000000000000a800    107      0      1   0             0  is_stmt
52861             0x000000000000a800    287     12      2   0             0  is_stmt prologue_end
52862             0x000000000000a818    114     59     81   0             0  is_stmt
52863             0x000000000000a824    287     12      2   0             0  is_stmt
52864             0x000000000000a828    100     58     82   0             0  is_stmt
52865             [...]
52866
52867         The main difference we are interested in here is that llvm-dwarfdump's
52868         output tells us that 0xa800 is an adequate place to place a breakpoint
52869         past a function prologue.  Since we know that foo covers from 0xa800 to
52870         0xa94c, 0xa800 is the address at which the breakpoint should be placed
52871         if the user wants to break in foo.
52872
52873         This commit proposes to add support for the prologue_end flag in the
52874         line-program processing.
52875
52876         The processing of this prologue_end flag is made in skip_prologue_sal,
52877         before it calls gdbarch_skip_prologue_noexcept.  The intent is that if
52878         the compiler gave information on where the prologue ends, we should use
52879         this information and not try to rely on architecture dependent logic to
52880         guess it.
52881
52882         The testsuite have been executed using this patch on GNU/Linux x86_64.
52883         Testcases have been compiled with both gcc/g++ (verison 9.4.0) and
52884         clang/clang++ (version 10.0.0) since at the time of writing GCC does not
52885         set the prologue_end marker.  Tests done with GCC 11.2.0 (not over the
52886         entire testsuite) show that it does not emit this flag either.
52887
52888         No regression have been observed with GCC or Clang.  Note that when
52889         using Clang, this patch fixes a failure in
52890         gdb.opt/inline-small-func.exp.
52891
52892         Change-Id: I720449a8a9b2e1fb45b54c6095d3b1e9da9152f8
52893
52894 2022-04-04  Lancelot SIX  <lancelot.six@amd.com>
52895
52896         gdb/buildsym: Line record use a record flag
52897         Currently when recording a line entry (with
52898         buildsym_compunit::record_line), a boolean argument argument is used to
52899         indicate that the is_stmt flag should be set for this particular record.
52900         As a later commit will add support for new flags, instead of adding a
52901         parameter to record_line for each possible flag, transform the current
52902         is_stmt parameter into a enum flag.  This flags parameter will allow
52903         greater flexibility in future commits.
52904
52905         This enum flags type is not propagated into the linetable_entry type as
52906         this would require a lot of changes across the codebase for no practical
52907         gain (it currently uses a bitfield where each interesting flag only
52908         occupy 1 bit in the structure).
52909
52910         Tested on x86_64-linux, no regression observed.
52911
52912         Change-Id: I5d061fa67bdb34918742505ff983d37453839d6a
52913
52914 2022-04-04  Simon Marchi  <simon.marchi@polymtl.ca>
52915
52916         gdb: make timestamped_file implement can_emit_style_escape
52917         In our AMDGPU downstream port, we use styling in some logging output.
52918         We noticed it stopped working after the gdb_printf changes.  Making
52919         timestamped_file implement can_emit_style_escape (returning the value of
52920         the stream it wraps) fixes it.  To show that it works, modify some
52921         logging statements in auto-load.c to output style filenames.  You can
52922         see it in action by setting "set debug auto-load 1" and running a
52923         program.  We can incrementally add styling to other debug statements
52924         throughout GDB, as needed.
52925
52926         Change-Id: I78a2fd1e078f80f2263251cf6bc53b3a9de9c17a
52927
52928 2022-04-04  Simon Marchi  <simon.marchi@polymtl.ca>
52929
52930         gdb: remove assertion in psymbol_functions::expand_symtabs_matching
52931         psymtab_to_symtab is documented as possibly returning nullptr, if the
52932         primary symtab of the partial symtab has no symbols.  However,
52933         psymbol_functions::expand_symtabs_matching asserts that the result of
52934         psymtab_to_symtab as non-nullptr.
52935
52936         I caught this assert by trying the CTF symbol reader on a library I
52937         built with -gctf:
52938
52939             $ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
52940             ...
52941             Reading symbols from /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0...
52942             (gdb) maintenance expand-symtabs
52943             /home/simark/src/binutils-gdb/gdb/psymtab.c:1142: internal-error: expand_symtabs_matching: Assertion `symtab != nullptr' failed.
52944
52945         The "symtab" in question is:
52946
52947             $  readelf --ctf=.ctf /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
52948             ...
52949             CTF archive member: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c:
52950
52951               Header:
52952                 Magic number: 0xdff2
52953                 Version: 4 (CTF_VERSION_3)
52954                 Flags: 0xe (CTF_F_NEWFUNCINFO, CTF_F_IDXSORTED, CTF_F_DYNSTR)
52955                 Parent name: .ctf
52956                 Compilation unit name: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c
52957                 Type section:       0x0 -- 0x13 (0x14 bytes)
52958                 String section:     0x14 -- 0x5f (0x4c bytes)
52959
52960               Labels:
52961
52962               Data objects:
52963
52964               Function objects:
52965
52966               Variables:
52967
52968               Types:
52969                 0x80000001: (kind 5) bt_bool (*) (const bt_value *) (aligned at 0x8)
52970
52971               Strings:
52972                 0x0:
52973                 0x1: .ctf
52974                 0x6: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c
52975
52976         It contains a single type, and it is skipped by ctf_add_type_cb, because
52977         an identical type was already seen earlier in this objfile.  As a
52978         result, no compunit_symtab is created.
52979
52980         Change psymbol_functions::expand_symtabs_matching to expect that
52981         psymtab_to_symtab can return nullptr.
52982
52983         Another possibility would be to make the CTF symbol reader always create
52984         a compunit_symtab, even if there are no symbols in it (like the DWARF
52985         parser does), but so far I don't see any advantage in doing so.
52986
52987         Change-Id: Ic43c38202c838a5eb87630ed1fd61d33528164f4
52988
52989 2022-04-04  Andrew Burgess  <aburgess@redhat.com>
52990
52991         sim: fixes for libopcodes styled disassembler
52992         In commit:
52993
52994           commit 60a3da00bd5407f07d64dff82a4dae98230dfaac
52995           Date:   Sat Jan 22 11:38:18 2022 +0000
52996
52997               objdump/opcodes: add syntax highlighting to disassembler output
52998
52999         I broke several sim/ targets by forgetting to update their uses of the
53000         libopcodes disassembler to take account of the new styled printing.
53001
53002         These should all be fixed by this commit.
53003
53004         I've not tried to add actual styled output to the simulator traces,
53005         instead, the styled print routines just ignore the style and print the
53006         output unstyled.
53007
53008 2022-04-04  Tom Tromey  <tromey@adacore.com>
53009
53010         Remove some globals from nat/windows-nat.c
53011         nat/windows-nat.c has a number of globals that it uses to communicate
53012         with its clients (gdb and gdbserver).  However, if we ever want the
53013         Windows ports to be multi-inferior, globals won't work.
53014
53015         This patch takes a step toward that by moving most nat/windows-nat.c
53016         globals into a new struct windows_process_info.  Many functions are
53017         converted to be methods on this object.
53018
53019         A couple of globals remain, as they are needed to truly be global due
53020         to the way that the Windows debugging APIs work.
53021
53022         The clients still have a global for the current process.  That is,
53023         this patch is a step toward the end goal, but doesn't implement the
53024         goal itself.
53025
53026 2022-04-04  Tom Tromey  <tromey@adacore.com>
53027
53028         Remove windows_thread_info destructor
53029         windows_thread_info declares and defines a destructor, but this
53030         doesn't need to be explicit.
53031
53032         Use unique_ptr in the Windows thread list
53033         windows-nat.c uses some manual memory management when manipulating the
53034         thread_list global.  Changing this to use unique_ptr simplifies the
53035         code, in particular windows_init_thread_list.  (Note that, while I
53036         think the the call to init_thread_list in there is wrong, I haven't
53037         removed it in this patch.)
53038
53039         Use auto_obstack in windows-nat.c
53040         One spot in windows-nat.c can use auto_obstack, removing some manual
53041         memory management.
53042
53043 2022-04-04  Tom Tromey  <tromey@adacore.com>
53044
53045         Simplify windows-nat.c solib handling
53046         Currently windows-nat.c uses struct so_list to record its local idea
53047         of which shared libraries have been loaded.  However, many fields in
53048         this are not needed, and furthermore I found this quite confusing at
53049         first -- Windows actually uses solib-target and so the use of so_list
53050         here is weird.
53051
53052         This patch simplifies this code by changing it to use a std::vector
53053         and a new type that holds exactly what's needed for the Windows code.
53054
53055 2022-04-04  Pedro Alves  <pedro@palves.net>
53056
53057         Avoid undefined behavior in gdbscm_make_breakpoint
53058         Running gdb.guile/scm-breakpoint.exp against an --enable-ubsan build,
53059         we see:
53060
53061          UNRESOLVED: gdb.guile/scm-breakpoint.exp: test_watchpoints: create a breakpoint with an invalid type number
53062          ...
53063          guile (define wp2 (make-breakpoint "result" #:wp-class WP_WRITE #:type 999))
53064          ../../src/gdb/guile/scm-breakpoint.c:377:11: runtime error: load of value 999, which is not a valid value for type 'bptype'
53065          ERROR: GDB process no longer exists
53066
53067         Fix this by parsing the user/guile input as plain int, and cast to
53068         internal type only after we know we have a number that would be valid.
53069
53070         Change-Id: I03578d07db00be01b610a8f5ce72e5521aea6a4b
53071
53072 2022-04-04  Tom Tromey  <tromey@adacore.com>
53073
53074         Add context-sensitive field name completion to Ada parser
53075         This updates the Ada expression parser to implement context-sensitive
53076         field name completion.  This is PR ada/28727.
53077
53078         This is somewhat complicated due to some choices in the Ada lexer --
53079         it chooses to represent a sequence of "."-separated identifiers as a
53080         single token, so the parser must partially recreate the completer's
53081         logic to find the completion word boundaries.
53082
53083         Despite the minor warts in this patch, though, it is a decent
53084         improvement.  It's possible that the DWARF reader rewrite will help
53085         fix the package completion problem pointed out in this patch as well.
53086
53087         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28727
53088
53089 2022-04-04  Tom Tromey  <tromey@adacore.com>
53090
53091         Consolidate single-char tokens in ada-lex.l
53092         There are two rules in ada-lex.l that match single-character tokens.
53093         This merges them.
53094
53095         Also, this removes '.' from the list of such tokens.  '.' is not used
53096         in any production in ada-exp.y, and removing it here helps the
53097         subsequent completion patches.
53098
53099 2022-04-04  Tom Tromey  <tromey@adacore.com>
53100
53101         Remove the Ada DOT_ALL token
53102         The Ada parser has a DOT_ALL token to represent ".all", and another
53103         token to represent other ".<identifier>" forms.  However, for
53104         completion it is a bit more convenient to unify these cases, so this
53105         patch removes DOT_ALL.
53106
53107         Refactor ada-lex.l:processId
53108         processId in ada-lex.l is a bit funny -- it uses an "if" and a
53109         "switch", and a nested loop.  This patch cleans it up a bit, changing
53110         it to use a boolean flag and a simpler "if".
53111
53112         Implement completion for Ada attributes
53113         This adds a completer for Ada attributes.  Some work in the lexer is
53114         required in order to match end-of-input correctly, as flex does not
53115         have a general-purpose way of doing this.  (The approach taken here is
53116         recommended in the flex manual.)
53117
53118 2022-04-04  Tom Tromey  <tromey@adacore.com>
53119
53120         Refactor expression completion
53121         This refactors the gdb expression completion code to make it easier to
53122         add more types of completers.
53123
53124         In the old approach, just two kinds of completers were supported:
53125         field names for some sub-expression, or tag names (like "enum
53126         something").  The data for each kind was combined in single structure,
53127         "expr_completion_state", and handled explicitly by
53128         complete_expression.
53129
53130         In the new approach, the parser state just holds an object that is
53131         responsible for implementing completion.  This way, new completion
53132         types can be added by subclassing this base object.
53133
53134         The structop completer is moved into structop_base_operation, and new
53135         objects are defined for use by the completion code.  This moves much
53136         of the logic of expression completion out of completer.c as well.
53137
53138 2022-04-04  Tom Tromey  <tromey@adacore.com>
53139
53140         Enable "set debug parser" for Ada
53141         I noticed that "set debug parser 1" did not affect Ada parsing.  This
53142         patch fixes the problem.
53143
53144         Because this is rarely useful, and pretty much only for maintainers, I
53145         didn't write a test case.
53146
53147 2022-04-04  Tom Tromey  <tromey@adacore.com>
53148
53149         Fix bug in Ada attributes lexing
53150         The Ada lexer allows whitespace between the apostrophe and the
53151         attribute text, but processAttribute does not handle this.  This patch
53152         fixes the problem and introduces a regression test.
53153
53154         Remove null sentinel from 'attributes'
53155         In a subsequent patch, it's handy if the 'attributes' array in
53156         ada-lex.l does not have a NULL sentinel at the end.  In C++, this is
53157         easy to avoid.
53158
53159         Handle ghost entities in symbol lookup
53160         Normally, SPARK ghost entities are removed from the executable.
53161         However, with -gnata, they will be preserved.  In this situation, it's
53162         handy to be able to inspect them.  This patch allows this by removing
53163         the "___ghost_" prefix in the appropriate places.
53164
53165 2022-04-04  Simon Marchi  <simon.marchi@efficios.com>
53166
53167         gdb: rename start_symtab/end_symtab to start_compunit_symtab/end_compunit_symtab
53168         It's a bit confusing because we have both "compunit_symtab" and "symtab"
53169         types, and many methods and functions containing "start_symtab" or
53170         "end_symtab", which actually deal with compunit_symtabs.  I believe this
53171         comes from the time before compunit_symtab was introduced, where
53172         symtab did the job of both.
53173
53174         Rename everything I found containing start_symtab or end_symtab to use
53175         start_compunit_symtab or end_compunit_symtab.
53176
53177         Change-Id: If3849b156f6433640173085ad479b6a0b085ade2
53178
53179 2022-04-04  Simon Marchi  <simon.marchi@efficios.com>
53180
53181         gdb: remove some unused buildsym-legacy functions
53182         Pretty much self-explanatory.
53183
53184         Change-Id: I5b658d017cd891ecdd1df61075eacb0f44316935
53185
53186 2022-04-04  Fangrui Song  <i@maskray.me>
53187
53188         gas: copy st_size only if unset
53189         For
53190         ```
53191         .size foo1, 1
53192         foo1:
53193
53194         .set bar1, foo1
53195         .size bar1, 2
53196         .size bar2, 2
53197         .set bar2, foo1
53198
53199         .set bar3, foo2
53200         .size bar3, 2
53201         .size bar4, 2
53202         .set bar4, foo2
53203
53204         .size foo2, 1
53205         foo2:
53206         ```
53207
53208         bar1's size is 2 while bar2, bar3, bar4's is 1. The behavior of bar1 makes sense
53209         (generally directives on the new symbol should win) and is relied upon by glibc
53210         stdio-common/errlist.c:
53211
53212         ```
53213                 .hidden _sys_errlist_internal
53214                 .globl  _sys_errlist_internal
53215                 .type   _sys_errlist_internal, @object
53216                 .size   _sys_errlist_internal, 1072
53217         _sys_errlist_internal:
53218
53219                 .globl __GLIBC_2_1_sys_errlist
53220                 .set __GLIBC_2_1_sys_errlist, _sys_errlist_internal
53221                 .type __GLIBC_2_1_sys_errlist, %object
53222                 .size __GLIBC_2_1_sys_errlist, 125 * (64 / 8)
53223
53224         // glibc expects that .size __GLIBC_2_1_sys_errlist, 125 * (64 / 8) wins.
53225         ```
53226
53227         The behavior of bar2/bar3/bar4 seems brittle. To avoid the reordering of the two
53228         code blocks which will result in the bar3 situation, glibc compiles errlist.c
53229         with gcc -fno-toplevel-reorder (previously -fno-unit-at-a-time).
53230
53231         To fix the inconsistency and improve robustness, make bar2/bar3/bar4 match bar1,
53232         removing the directive order sensitivity.
53233
53234         There is a pity that `.size dest, 0` is indistinguishable from the case where
53235         dest is unset, but the compromise seems fine.
53236
53237             PR gas/29012
53238             * config/obj-elf.c (elf_copy_symbol_attributes): don't copy if src's size
53239               has been set.
53240             * testsuite/gas/elf/elf.exp: New test.
53241             * testsuite/gas/elf/size.d: New file.
53242             * testsuite/gas/elf/size.s: Likewise.
53243
53244 2022-04-04  Andrew Burgess  <aburgess@redhat.com>
53245
53246         gdb: remove use of vfprintf_filtered
53247         Commit:
53248
53249           commit 60a3da00bd5407f07d64dff82a4dae98230dfaac
53250           Date:   Sat Jan 22 11:38:18 2022 +0000
53251
53252               objdump/opcodes: add syntax highlighting to disassembler output
53253
53254         Introduced a new use of vfprintf_filtered, which has been deprecated.
53255         This commit replaces this with gdb_vprintf instead.
53256
53257 2022-04-04  Andrew Burgess  <aburgess@redhat.com>
53258
53259         opcodes/i386: partially implement disassembler style support
53260         This commit adds partial support for disassembler styling in the i386
53261         disassembler.
53262
53263         The i386 disassembler collects the instruction arguments into an array
53264         of strings, and then loops over the array printing the arguments out
53265         later on.  The problem is that by the time we print the arguments out
53266         it's not obvious what the type of each argument is.
53267
53268         Obviously this can be fixed, but I'd like to not do that as part of
53269         this commit, rather, I'd prefer to keep this commit as small as
53270         possible to get the basic infrastructure in place, then we can improve
53271         on this, to add additional styling, in later commits.
53272
53273         For now then, I think this commit should correctly style mnemonics,
53274         some immediates, and comments.  Everything else will be printed as
53275         plain text, which will include most instruction arguments, unless the
53276         argument is printed as a symbol, by calling the print_address_func
53277         callback.
53278
53279         Ignoring colours, there should be no other user visible changes in the
53280         output of the disassembler in either objdump or gdb.
53281
53282         opcodes/ChangeLog:
53283
53284                 * disassembler.c (disassemble_init_for_target): Set
53285                 created_styled_output for i386 based targets.
53286                 * i386-dis.c: Changed throughout to use fprintf_styled_func
53287                 instead of fprintf_func.
53288
53289 2022-04-04  Andrew Burgess  <aburgess@redhat.com>
53290
53291         opcodes/riscv: implement style support in the disassembler
53292         Update the RISC-V disassembler to supply style information.  This
53293         allows objdump to apply syntax highlighting to the disassembler
53294         output (when the appropriate command line flag is used).
53295
53296         Ignoring colours, there should be no other user visible changes in the
53297         output of the disassembler in either objdump or gdb.
53298
53299         opcodes/ChangeLog:
53300
53301                 * disassembler.c (disassemble_init_for_target): Set
53302                 created_styled_output for riscv.
53303                 * riscv-dis.c: Changed throughout to use fprintf_styled_func
53304                 instead of fprintf_func.
53305
53306 2022-04-04  Andrew Burgess  <aburgess@redhat.com>
53307
53308         objdump/opcodes: add syntax highlighting to disassembler output
53309         This commit adds the _option_ of having disassembler output syntax
53310         highlighted in objdump.  This option is _off_ by default.  The new
53311         command line options are:
53312
53313           --disassembler-color=off              # The default.
53314           --disassembler-color=color
53315           --disassembler-color=extended-color
53316
53317         I have implemented two colour modes, using the same option names as we
53318         use of --visualize-jumps, a basic 8-color mode ("color"), and an
53319         extended 8bit color mode ("extended-color").
53320
53321         The syntax highlighting requires that each targets disassembler be
53322         updated; each time the disassembler produces some output we now pass
53323         through an additional parameter indicating what style should be
53324         applied to the text.
53325
53326         As updating all target disassemblers is a large task, the old API is
53327         maintained.  And so, a user of the disassembler (i.e. objdump, gdb)
53328         must provide two functions, the current non-styled print function, and
53329         a new, styled print function.
53330
53331         I don't currently have a plan for converting every single target
53332         disassembler, my hope is that interested folk will update the
53333         disassemblers they are interested in.  But it is possible some might
53334         never get updated.
53335
53336         In this initial series I intend to convert the RISC-V disassembler
53337         completely, and also do a partial conversion of the x86 disassembler.
53338         Hopefully having the x86 disassembler at least partial converted will
53339         allow more people to try this out easily and provide feedback.
53340
53341         In this commit I have focused on objdump.  The changes to GDB at this
53342         point are the bare minimum required to get things compiling, GDB makes
53343         no use of the styling information to provide any colors, that will
53344         come later, if this commit is accepted.
53345
53346         This first commit in the series doesn't convert any target
53347         disassemblers at all (the next two commits will update some targets),
53348         so after this commit, the only color you will see in the disassembler
53349         output, is that produced from objdump itself, e.g. from
53350         objdump_print_addr_with_sym, where we print an address and a symbol
53351         name, these are now printed with styling information, and so will have
53352         colors applied (if the option is on).
53353
53354         Finally, my ability to pick "good" colors is ... well, terrible.  I'm
53355         in no way committed to the colors I've picked here, so I encourage
53356         people to suggest new colors, or wait for this commit to land, and
53357         then patch the choice of colors.
53358
53359         I do have an idea about using possibly an environment variable to
53360         allow the objdump colors to be customised, but I haven't done anything
53361         like that in this commit, the color choices are just fixed in the code
53362         for now.
53363
53364         binutils/ChangeLog:
53365
53366                 * NEWS: Mention new feature.
53367                 * doc/binutils.texi (objdump): Describe --disassembler-color
53368                 option.
53369                 * objdump.c (disassembler_color): New global.
53370                 (disassembler_extended_color): Likewise.
53371                 (disassembler_in_comment): Likewise.
53372                 (usage): Mention --disassembler-color option.
53373                 (long_options): Add --disassembler-color option.
53374                 (objdump_print_value): Use fprintf_styled_func instead of
53375                 fprintf_func.
53376                 (objdump_print_symname): Likewise.
53377                 (objdump_print_addr_with_sym): Likewise.
53378                 (objdump_color_for_disassembler_style): New function.
53379                 (objdump_styled_sprintf): New function.
53380                 (fprintf_styled): New function.
53381                 (disassemble_jumps): Use disassemble_set_printf, and reset
53382                 disassembler_in_comment.
53383                 (null_styled_print): New function.
53384                 (disassemble_bytes): Use disassemble_set_printf, and reset
53385                 disassembler_in_comment.
53386                 (disassemble_data): Update init_disassemble_info call.
53387                 (main): Handle --disassembler-color option.
53388
53389         include/ChangeLog:
53390
53391                 * dis-asm.h (enum disassembler_style): New enum.
53392                 (struct disassemble_info): Add fprintf_styled_func field, and
53393                 created_styled_output field.
53394                 (disassemble_set_printf): Declare.
53395                 (init_disassemble_info): Add additional parameter.
53396                 (INIT_DISASSEMBLE_INFO): Add additional parameter.
53397
53398         opcodes/ChangeLog:
53399
53400                 * dis-init.c (init_disassemble_info): Take extra parameter,
53401                 initialize the new fprintf_styled_func and created_styled_output
53402                 fields.
53403                 * disassembler.c (disassemble_set_printf): New function definition.
53404
53405 2022-04-04  Tom Tromey  <tom@tromey.com>
53406
53407         Remove more Python 2 code
53408         I found another more place that still had a workaround for Python 2.
53409         This patch removes it.
53410
53411 2022-04-04  Tom de Vries  <tdevries@suse.de>
53412
53413         [gdb/testsuite] Fix KPASS in gdb.ada/arrayptr.exp
53414         On openSUSE Leap 15.3 I run into:
53415         ...
53416         KPASS: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr.all \
53417           (PRMS minimal encodings)
53418         KPASS: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr(3) \
53419           (PRMS minimal encodings)
53420         KPASS: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr.all(3) \
53421           (PRMS minimal encodings)
53422         ...
53423
53424         The test-case KFAILs some tests.  However, the analysis in the corresponding
53425         PR talks of a compiler problem, so it should use XFAILs instead.
53426
53427         The KFAILs are setup for pre-gcc-12, but apparantly the fix has been
53428         backported to system compiler 7.5.0, hence the KPASS.
53429
53430         Fix this by:
53431         - using an XFAIL instead of a KFAIL
53432         - matching the specific gdb output that corresponds to the XFAILs
53433           (reproduced on Fedora 34).
53434
53435         Tested on x86_64-linux, specifically openSUSE Leap 15.3 and Fedora 34.
53436
53437 2022-04-04  GDB Administrator  <gdbadmin@sourceware.org>
53438
53439         Automatic date update in version.in
53440
53441 2022-04-03  rupothar  <rupesh.potharla@amd.com>
53442
53443         gdb: add support for Fortran's ASSUMED RANK arrays
53444         This patch adds a new dynamic property DYN_PROP_RANK, this property is
53445         read from the DW_AT_rank attribute and stored within the type just
53446         like other dynamic properties.
53447
53448         As arrays with dynamic ranks make use of a single
53449         DW_TAG_generic_subrange to represent all ranks of the array, support
53450         for this tag has been added to dwarf2/read.c.
53451
53452         The final piece of this puzzle is to add support in gdbtypes.c so that
53453         we can resolve an array type with dynamic rank.  To do this the
53454         existing resolve_dynamic_array_or_string function is split into two,
53455         there's a new resolve_dynamic_array_or_string_1 core that is
53456         responsible for resolving each rank of the array, while the now outer
53457         resolve_dynamic_array_or_string is responsible for figuring out the
53458         array rank (which might require resolving a dynamic property) and then
53459         calling the inner core.
53460
53461         The resolve_dynamic_range function now takes a rank, which is passed
53462         on to the dwarf expression evaluator.  This rank will only be used in
53463         the case where the array itself has dynamic rank, but we now pass the
53464         rank in all cases, this should be harmless if the rank is not needed.
53465
53466         The only small nit is that resolve_dynamic_type_internal actually
53467         handles resolving dynamic ranges itself, which now obviously requires
53468         us to pass a rank value.  But what rank value to use?  In the end I
53469         just passed '1' through here as a sane default, my thinking is that if
53470         we are in resolve_dynamic_type_internal to resolve a range, then the
53471         range isn't part of an array with dynamic rank, and so the range
53472         should actually be using the rank value at all.
53473
53474         An alternative approach would be to make the rank value a
53475         gdb::optional, however, this ends up adding a bunch of complexity to
53476         the code (e.g. having to conditionally build the array to pass to
53477         dwarf2_evaluate_property, and handling the 'rank - 1' in
53478         resolve_dynamic_array_or_string_1) so I haven't done that, but could,
53479         if people think that would be a better approach.
53480
53481         Finally, support for assumed rank arrays was only fixed very recently
53482         in gcc, so you'll need the latest gcc in order to run the tests for
53483         this.
53484
53485         Here's an example test program:
53486
53487           PROGRAM arank
53488             REAL :: a1(10)
53489             CALL sub1(a1)
53490
53491           CONTAINS
53492
53493             SUBROUTINE sub1(a)
53494               REAL :: a(..)
53495               PRINT *, RANK(a)
53496             END SUBROUTINE sub1
53497           END PROGRAM arank
53498
53499         Compiler Version:
53500         gcc (GCC) 12.0.0 20211122 (experimental)
53501
53502         Compilation command:
53503         gfortran assumedrank.f90 -gdwarf-5 -o assumedrank
53504
53505         Without Patch:
53506
53507           gdb -q assumedrank
53508           Reading symbols from assumedrank...
53509           (gdb) break sub1
53510           Breakpoint 1 at 0x4006ff: file assumedrank.f90, line 10.
53511           (gdb) run
53512           Starting program: /home/rupesh/STAGING-BUILD-2787/bin/assumedrank
53513
53514           Breakpoint 1, arank::sub1 (a=<unknown type in /home/rupesh/STAGING-BUILD-2787
53515           /bin/assumedrank, CU 0x0, DIE 0xd5>) at assumedrank.f90:10
53516           10       PRINT *, RANK(a)
53517           (gdb) print RANK(a)
53518           'a' has unknown type; cast it to its declared type
53519
53520         With patch:
53521
53522           gdb -q assumedrank
53523           Reading symbols from assumedrank...
53524           (gdb) break sub1
53525           Breakpoint 1 at 0x4006ff: file assumedrank.f90, line 10.
53526           (gdb) run
53527           Starting program: /home/rupesh/STAGING-BUILD-2787/bin/assumedrank
53528
53529           Breakpoint 1, arank::sub1 (a=...) at assumedrank.f90:10
53530           10       PRINT *, RANK(a)
53531           (gdb) print RANK(a)
53532           $1 = 1
53533           (gdb) ptype a
53534           type = real(kind=4) (10)
53535           (gdb)
53536
53537         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
53538
53539 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53540
53541         gdb/dwarf: pass an array of values to the dwarf evaluator
53542         When we need to evaluate a DWARF expression in order to resolve some
53543         dynamic property of a type we call the dwarf2_evaluate_property
53544         function, which is declared in gdb/dwarf/loc.h and defined in
53545         gdb/dwarf/loc.c.
53546
53547         Currently, this function takes (amongst other things) an argument of
53548         type property_addr_info called addr_stack and a boolean called
53549         push_initial_value.  When push_initial_value then the top value of
53550         addr_stack is pushed onto the dwarf expression evaluation stack before
53551         the expression is evaluated.
53552
53553         So far this has worked fine, as the only two cases we needed to handle
53554         are the case the DWARF expression doesn't require the object
53555         address (what the top of addr_stack represents), and the case where
53556         the DWARF expression does require the address.
53557
53558         In the next commit this is going to change.  As we add support for
53559         Fortran assumed rank arrays, we need to start resolving the dynamic
53560         properties of arrays.  To do this, we need to push the array rank onto
53561         the dwarf expression evaluation stack before the expression is
53562         evaluated.
53563
53564         This commit is a refactoring commit aimed at making it easier to
53565         support Fortran assumed rank arrays.  Instead of passing a boolean,
53566         and using this to decide if we should push the object address or not,
53567         we instead pass an array (view) of values that should be pushed to the
53568         dwarf expression evaluation stack.
53569
53570         In the couple of places where we previously passed push_initial_value
53571         as true (mostly this was defaulting to false), we now have to pass the
53572         address from the addr_stack as an item in the array view.
53573
53574         In the next commit, when we want to handle passing the array rank,
53575         this will easily be supported too.
53576
53577         There should be no user visible changes after this commit.
53578
53579 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53580
53581         gdb: small simplification in dwarf2_locexpr_baton_eval
53582         While examining the dwarf expression evaluator, I noticed that in
53583         dwarf2_locexpr_baton_eval, whenever push_initial_value is true, the
53584         addr_stack will never be nullptr.
53585
53586         This allows for a small cleanup, replacing an if/then/else with an
53587         assertion.
53588
53589         There should be no user visible changes after this commit.
53590
53591 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53592
53593         gdb/testsuite: resolve some duplicate test names in gdb.base
53594         This commit resolves all the duplicate test names that I see in the
53595         script:
53596
53597           gdb.base/attach-pie-misread.exp
53598
53599         The duplicate names all come from a second call to
53600         build_executable_own_libs, so in this commit I've places the second
53601         call inside a with_test_prefix block.
53602
53603         While I was making this change I've also modified the value being
53604         passed as the testname for the second build_executable_own_libs call.
53605         Previously we used ${test}, however, I think this was likely a
53606         mistake, the 'test' variable is setup for the previous test.  I
53607         suspect that ${testfile} is a better choice - especially now we have a
53608         testname prefix.
53609
53610         As the testname is only used (after various calls) from within
53611         build_executable_from_specs should the build fail, I don't think this
53612         change really makes much difference though.
53613
53614         There should be no change in what is tested after this commit.
53615
53616 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53617
53618         gdb/testsuite: resolve a duplicate test name in a gdb.mi test
53619         Solve two duplicate test names in the test script:
53620
53621           gdb.mi/mi-catch-cpp-exceptions.exp
53622
53623         by moving the call to restart_for_test inside the with_test_prefix
53624         block.  There should be no difference in what is tested after this
53625         commit.
53626
53627 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53628
53629         gdb/Makefile.in: move ALLDEPFILES earlier in Makefile.in
53630         If I do 'make tags' in the gdb build directory, the tags target does
53631         complete, but I see these warnings:
53632
53633           ../../src/gdb/arm.c: No such file or directory
53634           ../../src/gdb/arm-get-next-pcs.c: No such file or directory
53635           ../../src/gdb/arm-linux.c: No such file or directory
53636
53637         The reason for this is the ordering of build rules and make variables
53638         in gdb/Makefile.in, specifically, the placement of the tags related
53639         rules, and the ALLDEPFILES variable.  The ordering is like this:
53640
53641           TAGFILES_NO_SRCDIR = .... $(ALLDEPFILES) ....
53642
53643           TAGS: $(TAGFILES_NO_SRCDIR) ....
53644                   # Recipe uses $(TAGFILES_NO_SRCDIR)
53645
53646           tags: TAGS
53647
53648           ALLDEPFILES = .....
53649
53650         When the TAGS rule is parsed TAGFILES_NO_SRCDIR is expanded, which
53651         then expands ALLDEPFILES, which, at that point in the Makefile is
53652         undefined, and so expands to the empty string.  As a result TAGS does
53653         not depend on any file listed in ALLDEPFILES.
53654
53655         However, when the TAGS recipe is invoked ALLDEPFILES is now defined.
53656         As a result, all the files in ALLDEPFILES are passed to the etags
53657         program.
53658
53659         The ALLDEPFILES references three files, arm.c, arm-get-next-pcs.c, and
53660         arm-linux.c, which are actually in the gdb/arch/ directory, but, in
53661         ALLDEPFILES these files don't include the arch/ prefix.  As a result,
53662         the etags program ends up looking for these files in the wrong
53663         location.
53664
53665         As ALLDEPFILES is only used by the TAGS rule, this mistake was not
53666         previously noticed (the TAGS rule itself was broken until a recent
53667         commit).
53668
53669         In this commit I make two changes, first, I move ALLDEPFILES to be
53670         defined before TAGFILES_NO_SRCDIR, this means that the TAGS rule will
53671         depend on all the files in ALLDEPFILES.  With this change the TAGS
53672         rule now breaks complaining that there's no rule to build the 3 files
53673         mentioned above.
53674
53675         Next, I have added all *.c files in gdb/arch/ to ALLDEPFILES,
53676         including their arch/ prefix, and removed the incorrect (missing arch/
53677         prefix) references.
53678
53679         With these two changes the TAGS (or tags if you prefer) target now
53680         builds without any errors or warnings.
53681
53682 2022-04-03  Reuben Thomas  <rrt@sc3d.org>
53683
53684         gdb/Makefile.in: fix 'make tags' build target
53685         The gdb_select.h file was moved to the gdbsupport directory long ago,
53686         but a reference was accident left in gdb/Makefile.in (in the
53687         HFILES_NO_SRCDIR variable), this commit removes that reference.
53688
53689         Before this commit, if I use 'make tags' here's what I see:
53690
53691           $ make tags
53692           make: *** No rule to make target 'gdb_select.h', needed by 'TAGS'.  Stop.
53693
53694         After this commit 'make tags' completes, but I still see these
53695         warnings:
53696
53697           ../../src/gdb/arm.c: No such file or directory
53698           ../../src/gdb/arm-get-next-pcs.c: No such file or directory
53699           ../../src/gdb/arm-linux.c: No such file or directory
53700
53701         These are caused by a separate issue, and will be addressed in the
53702         next commit.
53703
53704 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53705
53706         gdb/Makefile.in: remove SOURCES variable
53707         The SOURCES variable was added to gdb/Makefile.in as part of commit:
53708
53709           commit fb40c20903110ed8af9701ce7c2635abd3770d52
53710           Date:   Wed Feb 23 00:25:43 2000 +0000
53711
53712               Add mi/ and testsuite/gdb.mi/ subdirectories.
53713
53714         But as far as I can tell was not used at the time it was added, and is
53715         not used today.
53716
53717         Lets remove it.
53718
53719 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53720
53721         gdb/tui: fair split of delta after a resize
53722         Currently, in master gdb, when a tui window is changed in size, the
53723         screen delta is mostly just added to the next available window.  We
53724         do take care to respect the min/max size, but in most cases, these
53725         limits are just "the terminal size", and so, we end up placing the
53726         whole delta on the next window.
53727
53728         Consider these steps in an 80 column, 24 line terminal:
53729
53730           (gdb) tui enable
53731           (gdb) layout src
53732           (gdb) layout split
53733           (gdb) info win
53734           Name       Lines Columns Focus
53735           src            8      80 (has focus)
53736           asm            8      80
53737           status         1      80
53738           cmd            8      80
53739           (gdb) winheight cmd +2
53740           (gdb) info win
53741           Name       Lines Columns Focus
53742           src            6      80 (has focus)
53743           asm            8      80
53744           status         1      80
53745           cmd           10      80
53746
53747         Notice that initially, the windows were balanced, 8 lines each for the
53748         major windows.  Then, when the cmd window was adjusted, the extra two
53749         lines were given to the asm window.
53750
53751         I think it would be nicer if the delta was spread more evenly over the
53752         available windows.  In the example above, after the adjustment the
53753         layout now looks like:
53754
53755           (gdb) info win
53756           Name       Lines Columns Focus
53757           src            7      80 (has focus)
53758           asm            7      80
53759           status         1      80
53760           cmd           10      80
53761
53762         This is achieved within tui_layout_split::set_size, by just handing
53763         out the delta in increments of 1 to each window (except for the window
53764         the user adjusted), until there's no more delta left.  Of course, we
53765         continue to respect the min/max window sizes.
53766
53767 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53768
53769         gdb/tui: relax restrictions on window max height and width
53770         This commit removes some arbitrary adjustments made in
53771         tui_cmd_window::max_height, tui_win_info::max_height, and
53772         tui_win_info::max_width.
53773
53774         These member functions all subtract some constant from the theoretical
53775         maximum height or width.  I've looked back through the history a
53776         little and can see no real reason why these adjustments should be
53777         needed, with these adjustments removed all the existing tui tests
53778         still pass.
53779
53780         However, retaining these restrictions causes some bugs, consider:
53781
53782           (gdb) tui new-layout hsrc {-horizontal src 1 cmd 1} 1
53783
53784         When this layout is selected with current master, gdb will leave a 4
53785         line gap at the bottom of the terminal.
53786
53787         The problem is that the maximum height is restricted, for the cmd
53788         window, to 4 less than the terminal height.
53789
53790         By removing this restriction gdb is able to size the windows to the
53791         complete terminal height, and the layout is done correctly.
53792
53793         This 4 line restriction is also what prevents this layout from working
53794         correctly:
53795
53796           (gdb) tui new-layout conly cmd 1
53797
53798         Previously, this layout would present a cmd window only, but there
53799         would be a 4 line gap at the bottom of the terminal.  This issue was
53800         mentioned in an earlier commit in this series (when a different bug
53801         was fixed), but with this commit, the above layout now correctly fills
53802         the terminal.  The associated test is updated.
53803
53804         After removing the adjustment in tui_cmd_window::max_height, the
53805         implementation is now the same as the implementation in the parent
53806         class tui_win_info, so I've completely removed the max_height call
53807         from tui_cmd_window.
53808
53809 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53810
53811         gdb/testsuite: some additional tests in gdb.tui/scroll.exp
53812         This commit just adds an extra check of the src window size prior to
53813         sending all the commands to gdb.  We also set the cmd window height to
53814         its existing height, this (obviously) shouldn't change the window
53815         layout, which we check.
53816
53817         My main motivation was adding the initial window layout check, the
53818         winheight and recheck are just extras.  All of these test pass both
53819         before and after this commit.
53820
53821 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53822
53823         gdb/tui: support placing the cmd window into a horizontal layout
53824         This commit allows the user to place the cmd window within horizontal
53825         tui layouts.  Consider this set of steps, carried out in an 80 columns
53826         by 24 lines terminal, using current master gdb:
53827
53828           (gdb) tui new-layout hsrc { -horizontal src 1 cmd 1 } 1 status 1
53829           (gdb) tui layout hsrc
53830
53831         What you end up with is a full width cmd window with the status bar
53832         beneath.  Where's the src window gone?  We then try:
53833
53834           (gdb) info win
53835           Name       Lines Columns Focus
53836           src           23       3 (has focus)
53837           cmd           23      80
53838           status         1      80
53839           (gdb)
53840
53841         Something weird has gone on, gdb has overlapped the cmd window with
53842         the src window.  If we trigger the src window to redraw is content,
53843         for example, 'list main', then we see corruption in the cmd window as
53844         the src window overwrites it.
53845
53846         So, what's going on?
53847
53848         The problem is some code in tui_layout_split::apply, in tui-layout.c.
53849         Within 'Step 1', there is a loop that calculates the min/max window
53850         sizes for all windows within a tui_layout_split.  However, there's a
53851         special case for the cmd window.
53852
53853         This special case is trying to have the cmd window retain its current
53854         size when a layout is re-applied, or a new layout is applied.  This
53855         makes sense, consider moving from the 'src' layout to the 'asm'
53856         layout, this looks something like this (status window removed):
53857
53858             .-------.         .-------.
53859             |  src  |         |  asm  |
53860             |-------|  ====>  |-------|
53861             |  cmd  |         |  cmd  |
53862             '-------'         '-------'
53863
53864         If the user has gone to the effort of adjusting the cmd window size,
53865         then, the thinking goes, we shouldn't reset the cmd window size when
53866         switching layouts like this.
53867
53868         The problem though, is that when we do a switch more like this:
53869
53870             .-----------.         .-----------.
53871             |    src    |         |     |     |
53872             |-----------|  ====>  | asm | cmd |
53873             |    cmd    |         |     |     |
53874             '-----------'         '-----------'
53875
53876         Now retaining the cmd window width makes no sense; the new layout has
53877         a completely different placement for the cmd window, instead of sizing
53878         by height, we're now sizing by width.  The existing code doesn't
53879         understand this though, and tried to retain the full width for the cmd
53880         window.
53881
53882         To solve this problem, I propose we introduce the idea of a layout
53883         "fingerprint".  The fingerprint tries to capture, in an abstract way,
53884         where the cmd window lives within the layout.
53885
53886         Only when two layouts have the same fingerprint will we attempt to
53887         retain the cmd window size.
53888
53889         The fingerprint for a layout is represented as a string, the string is
53890         a series of 'V' or 'H' characters, ending with a single 'C'
53891         character.  The series of 'V' and 'H' characters represent the
53892         vertical or horizontal layouts that must be passed through to find the
53893         cmd window.
53894
53895         Here are a few examples:
53896
53897           # This layout is equivalent to the builtin 'src' layout.
53898           # Fingerprint: VC
53899           tui new-layout example1 src 2 status 0 cmd 1
53900
53901           # This layout is equivalent to the builtin 'split' layout.
53902           # Fingerprint: VC
53903           tui new-layout example2 src 1 asm 1 status 0 cmd 1
53904
53905           # This is the same layout that was given at the top.
53906           # Fingerprint: VHC
53907           tui new-layout hsrc { -horizontal src 1 cmd 1 } 1 status 1
53908
53909         And so, when switching between example1 and example2, gdb knows that
53910         the cmd window is, basically, in the same sort of position within the
53911         layout, and will retain the cmd window size.
53912
53913         In contrast, when switching to the hsrc layout, gdb understands that
53914         the position of the cmd window is different, and does not try to
53915         retain the cmd window size.
53916
53917 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
53918
53919         gdb/tui: allow cmd window to change size in tui_layout_split::apply
53920         When we switch layouts we call the tui_layout_split::apply member
53921         function to reapply the layout, and recalculate all the window sizes.
53922
53923         One special case is the cmd window, which we try to keep at its
53924         existing size.
53925
53926         However, in some cases it is not appropriate to keep the cmd window at
53927         its existing size.  I will describe two such cases here, in one, we
53928         want the cmd window to reduce in size, and in the other, we want the
53929         cmd window to grow in size.
53930
53931         Try these steps in a 80 columns, by 24 lines terminal:
53932
53933           (gdb) tui enable
53934           (gdb) layout src
53935           (gdb) winheight cmd 20
53936           (gdb) layout split
53937
53938         You should see that the status window is missing from the new layout,
53939         and that the cmd window has been placed over the border of the asm
53940         window.  The 'info win' output is:
53941
53942           (gdb) info win
53943           Name       Lines Columns Focus
53944           src            3      80 (has focus)
53945           asm            3      80
53946           status         1      80
53947           cmd           20      80
53948
53949         Notice that gdb has assigned 27 lines of screen space, even with the
53950         border overlap between the src and asm windows, this is still 2 lines
53951         too many.
53952
53953         The problem here is that after switching layouts, gdb has forced the
53954         cmd window to retain its 20 line height.  Really, we want the cmd
53955         window to reduce in height so that the src and asm windows can occupy
53956         their minimum required space.
53957
53958         This commit allows this (details on how are below).  After this
53959         commit, in the above situation, we now see the status window displayed
53960         correctly, and the 'info win' output is:
53961
53962           (gdb) info win
53963           Name       Lines Columns Focus
53964           src            3      80 (has focus)
53965           asm            3      80
53966           status         1      80
53967           cmd           18      80
53968
53969         The cmd window has been reduced in size by 2 lines so that everything
53970         can fit on the screen.
53971
53972         The second example is one which was discussed in a recent commit,
53973         consider this case (still in the 80 column, 24 line terminal):
53974
53975           (gdb) tui enable
53976           (gdb) tui new-layout conly cmd 1
53977           (gdb) layout conly
53978           (gdb) info win
53979           Name       Lines Columns Focus
53980           cmd            8      80 (has focus)
53981           (gdb)
53982
53983         This layout only contains a cmd window, which we would expect to
53984         occupy the entire terminal.  But instead, the cmd window only occupies
53985         the first 8 lines, and the rest of the terminal is unused!
53986
53987         The reason is, again, that the cmd window is keeping its previous
53988         size (8 lines).
53989
53990         After this commit things are slightly different, the 'info win' output
53991         is now:
53992
53993           (gdb) info win
53994           Name       Lines Columns Focus
53995           cmd           20      80 (has focus)
53996
53997         Which is a little better, but why only 20 lines?  Turns out there's
53998         yet another bug hitting this case.  That bug will be addressed in a
53999         later commit, so, for now, we're accepting the 20 lines.
54000
54001         What this commit does is modify the phase of tui_layout_split::apply
54002         that handles any left over space.  Usually, in "Step 2", each
54003         sub-layout has a size calculated.  As the size is an integer, then,
54004         when all sizes are calculated we may have some space left over.
54005
54006         This extra space is then distributed between all the windows fairly
54007         until all the space is used up.
54008
54009         When we consider windows minimum size, or fixed size windows, then it
54010         is possible that we might try to use more space than is available,
54011         this was our first example above.  The same code that added extra
54012         space to the windows, can also be used to reclaim space (in the over
54013         allocation case) to allow all windows to fit.
54014
54015         The problem then is the cmd window, which we often force to a fixed
54016         size.  Inside the loop that handles the allocation of excess space, if
54017         we find that we have tried every window, and still have space either
54018         left to give, or we need to claim back more space, then, if the cmd
54019         window was changed to a fixed size, we can change the cmd window back
54020         to a non-fixed-size window, and proceed to either give, or take space
54021         from the cmd window as needed.
54022
54023 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54024
54025         gdb/tui: fairer distribution of excess space during apply
54026         When applying layouts gdb computes the size of each window (or rather,
54027         each sub-layout within a layout) using integer arithmetic.  As this
54028         rounds down the results, then, when all sub-layouts are sized, there
54029         is the possibility that we have some space left over.
54030
54031         Currently, this space is just assigned to an arbitrary sub-layout.
54032
54033         This can result in some unbalanced results.  Consider this set of
54034         steps with current master:
54035
54036           (gdb) tui enable
54037           (gdb) layout regs
54038           (gdb) info win
54039           Name       Lines Columns Focus
54040           regs           7      80
54041           src            9      80 (has focus)
54042           status         1      80
54043           cmd            8      80
54044
54045         Notice the weird split between the src and regs windows, the original
54046         layout specification has these windows given equal weight.  The
54047         problem is that, with rounding, both the regs and src windows are
54048         initially sized to 7, the extra 2 lines are then arbitrarily added to
54049         the src window.
54050
54051         In this commit, rather than add all the extra space to one single
54052         window, I instead hand out the extra space 1 line at a time, looping
54053         over all the sub-layouts.  We take care to respect the min/max sizes,
54054         and so, we now get this result:
54055
54056           (gdb) tui enable
54057           (gdb) layout regs
54058           (gdb) info win
54059           Name       Lines Columns Focus
54060           regs           8      80
54061           src            8      80 (has focus)
54062           status         1      80
54063           cmd            8      80
54064
54065         This looks more natural to me.
54066
54067         This is obviously a change in behaviour, and so, lots of the existing
54068         tests need to be updated to take this into account.  None of the
54069         changes are huge, it's just a line or two (or column for width) moved
54070         between windows.
54071
54072 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54073
54074         gdb/tui: avoid fp exception when applying layouts
54075         Consider:
54076
54077           (gdb) tui enable
54078           (gdb) layout src
54079           (gdb) tui new-layout conly cmd 1
54080           (gdb) layout conly
54081
54082         After this, with current master, gdb crashes with a floating-point
54083         exception.
54084
54085         The problem is that in tui_layout_split::apply, when we switch from
54086         'src' to 'conly', we will try to retain the cmd window height.  As
54087         such, the cmd window will become a fixed size window, which decreases
54088         the available_size, but doesn't count towards the total_weight.
54089
54090         As the cmd window is the only window, the total_weight stays at zero,
54091         and, when we move into step 2, where we attempt to size the windows,
54092         we perform a divide by zero, and crash.
54093
54094         After this commit we avoid the divide by zero, and just directly set
54095         the window size based on the fixed size.
54096
54097         There is still a problem after this commit, when the conly layout is
54098         selected the cmd window retains its original height, which will only
54099         be part of the terminal.  The rest of the terminal is left unused.
54100         This issue will be addressed in a later commit, this commit is just
54101         about the floating-point exception.
54102
54103 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54104
54105         gdb/tui/testsuite: refactor new-layout.exp test
54106         This commit changes the gdb.tui/new-layout.exp test to make use of a
54107         list of test descriptions, and a loop to check each description in
54108         turn.  There's no change to what is actually tested after this commit.
54109
54110         In future commits I plan to add additional tests to this file, and
54111         this will be easier now that all I have to do is add a new test
54112         description to the list.
54113
54114 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54115
54116         gdb/tui: add left_boxed_p and right_boxed_p member functions
54117         When I initially saw this code in tui_layout_split::apply, I assumed
54118         that this must be a bug:
54119
54120             /* Two adjacent boxed windows will share a border, making a bit
54121                more size available.  */
54122             if (i > 0
54123                 && m_splits[i - 1].layout->bottom_boxed_p ()
54124                 && m_splits[i].layout->top_boxed_p ())
54125               ...
54126
54127         After all, the apply might be laying out a horizontal layout, right?
54128         So checking bottom_boxed_p and top_boxed_p is clearly wrong.
54129
54130         Well, it turns on, that due to the implementations of these things,
54131         bottom_boxed_p is equivalent to an imagined right_boxed_p, and
54132         top_boxed_p is equivalent to an imagined left_boxed_p.
54133
54134         In this commit I've renamed both top_boxed_p and bottom_boxed_p to
54135         first_edge_has_border_p and last_edge_has_border_p respectively, and
54136         extended the comments in tui_layout_base to mention that these methods
54137         handle both horizontal and vertical layouts.
54138
54139         Now, hopefully, the code shouldn't look like it only applies for
54140         vertical layouts.
54141
54142         There should be no user visible changes after this commit.
54143
54144 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54145
54146         gdb/tui: add a tui debugging flag
54147         This commit adds 'set debug tui on|off' and 'show debug tui'.  This
54148         commit adds the control variable, and the printing macros in
54149         tui/tui.h.  I've then added some uses of these in tui.c and
54150         tui-layout.c.
54151
54152         To help produce more useful debug output in tui-layout.c, I've added
54153         some helper member functions in the class tui_layout_split, and also
54154         moved the size_info struct out of tui_layout_split::apply into the
54155         tui_layout_split class.
54156
54157         If tui debug is not turned on, then there should be no user visible
54158         changes after this commit.
54159
54160         One thing to note is that, due to the way that the tui terminal is
54161         often cleared, the only way I've found this useful is when I do:
54162
54163           (gdb) tui enable
54164           (gdb) set logging file /path/to/file
54165           (gdb) set logging debugredirect on
54166           (gdb) set logging enable on
54167
54168         Additionally, gdb has some quirks when it comes to setting up logging
54169         redirect and switching interpreters.  Thus, the above only really
54170         works if the logging is enabled after the tui is enabled, and disabled
54171         again before the tui is disabled.
54172
54173         Enabling logging and switching interpreters can cause undefined
54174         results, including crashes.  This is an existing bug in gdb[1], and
54175         has nothing directly to do with tui debug, but it is worth mentioning
54176         here I think.
54177
54178         [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28948
54179
54180 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54181
54182         gdb/tui: add new 'tui window width' command and 'winwidth' alias
54183         This commit adds a new command 'tui window width', and an alias
54184         'winwidth'.  This command is equivalent to the old 'winheight'
54185         command (which was recently renamed 'tui window height').
54186
54187         Even though I recently moved the old tui commands under the tui
54188         namespace, and I would strongly encourage all new tui commands to be
54189         added as 'tui ....' only (users can create their own top-level aliases
54190         if they want), I'm breaking that suggestion here, and adding a
54191         'winwidth' alias.
54192
54193         Given that we already have 'winheight' and have done for years, it
54194         just didn't seem right to no have the matching 'winwidth'.
54195
54196         You might notice in the test that the window resizing doesn't quite
54197         work right.  I setup a horizontal layout, then grow and shrink the
54198         windows.  At the end of the test the windows should be back to their
54199         original size...
54200
54201         ... they are not.  This isn't my fault, honest!  GDB's window resizing
54202         is a little ... temperamental, and is prone to getting things slightly
54203         wrong during resizes, off by 1 type things.  This is true for height
54204         resizing, as well as the new width resizing.
54205
54206         Later patches in this series will rework the resizing algorithm, which
54207         should improve things in this area.  For now, I'm happy that the width
54208         resizing is as good as the height resizing, given the existing quirks.
54209
54210         For the docs side I include a paragraph that explains how multiple
54211         windows are required before the width can be adjusted.  For
54212         completeness, I've added the same paragraph to the winheight
54213         description.  With the predefined layouts this extra paragraph is not
54214         really needed for winheight, as there are always multiple windows on
54215         the screen.  However, with custom layouts, this might not be true, so
54216         adding the paragraph seems like a good idea.
54217
54218         As for the changes in gdb itself, I've mostly just taken the existing
54219         height adjustment code, changed the name to make it generic 'size'
54220         adjustment, and added a boolean flag to indicate if we are adjusting
54221         the width or the height.
54222
54223 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54224
54225         gdb/tui: rename tui_layout_split:set_weights_from_heights
54226         In a following commit I'm going to add the ability to change the width
54227         of a tui window (when in a horizontal layout).  As a result, some of
54228         the places where we currently hard-code references to height need to
54229         be changed to handle either height, or width, based on whether we are
54230         in a vertical, or horizontal layout.
54231
54232         This commit renames set_weights_from_heights to
54233         set_weights_from_sizes, and makes the function use either the height,
54234         or width as appropriate.
54235
54236         Currently, the only place that we call this function is from the
54237         tui_layout_split::set_height function, in a part of the code we will
54238         only reach for vertical layouts, so the new code is not actually being
54239         used, but, this small change will help make later patches smaller, so
54240         I'm proposing this as a stand alone change.
54241
54242         There should be no user visible changes after this commit.
54243
54244 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54245
54246         gdb/tui: rename tui_layout_base::adjust_size to ::set_height
54247         Rename tui_layout_base::adjust_size to tui_layout_base::set_height,
54248         the new name more accurately reflects what this member function does,
54249         and makes it easier for a later commit to add a new
54250         tui_layout_base::set_width member function.
54251
54252         There should be no user visible changes after this commit.
54253
54254 2022-04-03  Andrew Burgess  <aburgess@redhat.com>
54255
54256         gdb: move some commands into the tui namespace
54257         There are a lot of tui related commands that live in the top-level
54258         command name space, e.g. layout, focus, refresh, winheight.
54259
54260         Having them at the top level means less typing for the user, which is
54261         good, but, I think, makes command discovery harder.
54262
54263         In this commit, I propose moving all of the above mentioned commands
54264         into the tui namespace, so 'layout' becomes 'tui layout', etc.  But I
54265         will then add aliases so that the old commands will still work,
54266         e.g. I'll make 'layout' an alias for 'tui layout'.
54267
54268         The benefit I see in this work is that tui related commands can be
54269         more easily discovered by typing 'tui ' and then tab-completing.  Also
54270         the "official" command is now a tui-sub-command, this is visible in,
54271         for example, the help output, e.g.:
54272
54273           (gdb) help layout
54274           tui layout, layout
54275           Change the layout of windows.
54276           Usage: tui layout prev | next | LAYOUT-NAME
54277
54278           List of tui layout subcommands:
54279
54280           tui layout asm -- Apply the "asm" layout.
54281           tui layout next -- Apply the next TUI layout.
54282           tui layout prev -- Apply the previous TUI layout.
54283           tui layout regs -- Apply the TUI register layout.
54284           tui layout split -- Apply the "split" layout.
54285           tui layout src -- Apply the "src" layout.
54286
54287         Which I think is a good thing, it makes it clearer that this is a tui
54288         command.
54289
54290         I've added a NEWS entry and updated the docs to mention the new and
54291         old command names, with the new name being mentioned first.
54292
54293 2022-04-03  Simon Marchi  <simon.marchi@polymtl.ca>
54294
54295         gdb: fix gdb_print -> gdb_printf typo
54296         This caused a build failure with !CXX_STD_THREAD.
54297
54298         Change-Id: I30f0c89c43a76f85c0db34809192644fa64a9d18
54299
54300 2022-04-03  Alan Modra  <amodra@gmail.com>
54301
54302         Move microblaze relax info to target specific data
54303         Target specific data shouldn't be put in struct bfd_section.
54304
54305                 * section.c (struct bfd_section): Delete relax and relax_count.
54306                 (BFD_FAKE_SECTION): Adjust to suit.
54307                 (struct relax_table): Move to..
54308                 * elf32-microblaze.c (struct relax_table): ..here.
54309                 (struct _microblaze_elf_section_data): New.
54310                 (microblaze_elf_section_data): Define.
54311                 (microblaze_elf_new_section_hook): New function.
54312                 (bfd_elf32_new_section_hook): Define.
54313                 (calc_fixup): Return a size_t.  Adjust to suit new location of
54314                 relax and relax_count.
54315                 (microblaze_elf_relax_section): Adjust to suit new location of
54316                 relax and relax_count.  Make some variables size_t.
54317                 * bfd-in2.h: Regenerate.
54318
54319 2022-04-03  Alan Modra  <amodra@gmail.com>
54320
54321         Revert commit 240d6706c6a2
54322                 PR 28592
54323                 PR 15994
54324                 PR 15935
54325                 * dwarf2.c (lookup_address_in_line_info_table): Return bool rather
54326                 than a range.
54327                 (comp_unit_find_nearest_line): Likewise.  Return true if function
54328                 info found without line info.
54329                 (_bfd_dwarf2_find_nearest_line): Revert range handling code.
54330
54331         Regen bfd po/SRC-POTFILES.in
54332
54333 2022-04-03  GDB Administrator  <gdbadmin@sourceware.org>
54334
54335         Automatic date update in version.in
54336
54337 2022-04-02  Tiezhu Yang  <yangtiezhu@loongson.cn>
54338
54339         gdb: rename floatformats_ia64_quad to floatformats_ieee_quad
54340         It is better to rename floatformats_ia64_quad to floatformats_ieee_quad
54341         to reflect the reality, and then we can clean up the related code.
54342
54343         As Tom Tromey said [1]:
54344
54345           These files are maintained in gcc and then imported into the
54346           binutils-gdb repository, so any changes to them will have to
54347           be proposed there first.
54348
54349         the related changes have been merged into gcc master now [2], it is time
54350         to do it for gdb.
54351
54352         [1] https://sourceware.org/pipermail/gdb-patches/2022-March/186569.html
54353         [2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b2dff6b2d9d6
54354
54355 2022-04-02  GDB Administrator  <gdbadmin@sourceware.org>
54356
54357         Automatic date update in version.in
54358
54359 2022-04-01  John Baldwin  <jhb@FreeBSD.org>
54360
54361         Remove unused variable.
54362
54363 2022-04-01  Aaron Merey  <amerey@redhat.com>
54364
54365         gdb/debuginfod-support.c: Always display debuginfod errors
54366         Errors encountered when downloading files from debuginfod servers
54367         are not displayed if debuginfod verbosity is set to 0 (via
54368         'set debuginfod verbose 0').
54369
54370         Tom recommended that these errors always be displayed, regardless
54371         of the verbosity setting [1]. Fix this.
54372
54373         [1] https://sourceware.org/pipermail/gdb-patches/2022-March/186350.html
54374
54375 2022-04-01  John Baldwin  <jhb@FreeBSD.org>
54376
54377         Use I386_GSBASE_REGNUM in i386fbsd_get_thread_local_address.
54378         32-bit x86 arches always the I386_*BASE_REGNUM values.  Only code that
54379         needs to support both 64-bit and 32-bit arches needs to use
54380         tdep->fsbase_regnum to compute a segment base register number.
54381
54382         FreeBSD/x86: Read segment base registers from NT_X86_SEGBASES.
54383         FreeBSD kernels recently grew a new register core dump note containing
54384         the base addresses of the %fs and %gs segments (corresponding to the
54385         %fsbase and %gsbase registers).  Parse this note to permit inspecting
54386         TLS variables in core dumps.  Native processes already supported TLS
54387         via older ptrace() operations.
54388
54389 2022-04-01  John Baldwin  <jhb@FreeBSD.org>
54390
54391         Use pseudosections for NT_FREEBSD_X86_SEGBASES core dump notes.
54392         This includes adding pseudosections when reading a core dump as well
54393         as support for writing out a core dump note from a pseudosection.
54394
54395         bfd/ChangeLog:
54396
54397                 * elf-bfd.h (elfcore_write_x86_segbases): New.
54398                 * elf.c (elfcore_grok_freebsd_note): Add pseudosections for
54399                 NT_FREEBSD_X86_SEGBASES register notes.
54400                 (elfcore_write_x86_segbases): New.
54401                 (elfcore_write_register_note): Write NT_FREEBSD_X86_SEGBASES
54402                 register notes.
54403
54404 2022-04-01  John Baldwin  <jhb@FreeBSD.org>
54405
54406         Recognize FreeBSD core dump note for x86 segment base registers.
54407         This core dump note contains the value of the base address of the %fs
54408         and %gs segments for both i386 and amd64 core dumps.  It is primarily
54409         useful in resolving the address of TLS variables in core dumps.
54410
54411         binutils/ChangeLog:
54412
54413                 * readelf.c (get_freebsd_elfcore_note_type): Handle
54414                 NT_FREEBSD_X86_SEGBASES.
54415
54416         include/ChangeLog:
54417
54418                 * elf/common.h (NT_FREEBSD_X86_SEGBASES): Define.
54419
54420 2022-04-01  John Baldwin  <jhb@FreeBSD.org>
54421
54422         elfcore_grok_freebsd_note: Remove checks of note->namesz.
54423         This function is only called if the note name is "FreeBSD", so
54424         checking the name size is unnecessary.
54425
54426         bfd/ChangeLog:
54427
54428                 * elf.c (elfcore_grok_freebsd_note): Remove checks for namesz.
54429
54430 2022-04-01  Andrew Burgess  <aburgess@redhat.com>
54431
54432         gdb/testing/tui: add new _csi_{L,S,T}
54433         This patch was original part of this series:
54434
54435           https://sourceware.org/pipermail/gdb-patches/2022-March/186429.html
54436           https://sourceware.org/pipermail/gdb-patches/2022-March/186433.html
54437
54438         I've pulled this out as it might be useful ahead of the bigger series
54439         being merged.
54440
54441         This commit adds:
54442
54443           _csi_L - insert line
54444           _csi_S - pan down
54445           _csi_T - pan up
54446
54447 2022-04-01  H.J. Lu  <hjl.tools@gmail.com>
54448
54449         x86: Remove bfd_arch_l1om and bfd_arch_k1om
54450         Remove bfd_arch_l1om and bfd_arch_k1om since L1OM/K1OM support has been
54451         removed from gas, ld and opcodes.
54452
54453         bfd/
54454
54455                 * Makefile.am (ALL_MACHINES): Remove cpu-l1om.lo and cpu-k1om.lo.
54456                 (ALL_MACHINES_CFILES): Remove cpu-l1om.c and cpu-k1om.c.
54457                 * archures.c (bfd_mach_l1om): Removed.
54458                 (bfd_mach_l1om_intel_syntax): Likewise.
54459                 (bfd_mach_k1om): Likewise.
54460                 (bfd_mach_k1om_intel_syntax): Likewise.
54461                 (bfd_k1om_arch): Likewise.
54462                 (bfd_l1om_arch): Likewise.
54463                 (bfd_archures_list): Remove bfd_k1om_arch and bfd_l1om_arch
54464                 references.
54465                 * config.bfd (targ_selvecs): Remove l1om_elf64_vec.
54466                 l1om_elf64_fbsd_vec, k1om_elf64_vec and k1om_elf64_fbsd_vec.
54467                 (targ_archs): Remove bfd_l1om_arch and bfd_k1om_arch.
54468                 * configure.ac (k1om_elf64_vec): Removed.
54469                 (k1om_elf64_fbsd_vec): Likewise.
54470                 (l1om_elf64_vec): Likewise.
54471                 (l1om_elf64_fbsd_vec): Likewise.
54472                 * cpu-k1om.c: Removed.
54473                 * cpu-l1om.c: Likewise.
54474                 * elf64-x86-64.c (elf64_l1om_elf_object_p): Removed.
54475                 (elf64_k1om_elf_object_p): Likewise.
54476                 (l1om_elf64_vec): Removed.
54477                 (l1om_elf64_fbsd_vec): Likewise.
54478                 (k1om_elf64_vec): Likewise.
54479                 (k1om_elf64_fbsd_vec): Likewise.
54480                 (ELF_TARGET_OS): Undefine.
54481                 * targets.c (_bfd_target_vector): Remove k1om_elf64_vec,
54482                 k1om_elf64_fbsd_vec, l1om_elf64_vec and l1om_elf64_fbsd_vec.
54483                 * Makefile.in: Regenerate.
54484                 * bfd-in2.h: Likewise.
54485                 * configure: Likewise.
54486
54487         opcodes/
54488
54489                 * configure.ac: Remove bfd_arch_l1om/bfd_arch_k1om references.
54490                 * disassemble.c (disassembler): Likewise.
54491                 * configure: Regenerate.
54492
54493 2022-04-01  Simon Marchi  <simon.marchi@polymtl.ca>
54494
54495         gdb/ctf: pass partial symtab's filename to buildsym_compunit
54496         I noticed that the CTF symbol reader passes the objfile's name to all
54497         buildsym_compunit instances it creates.  The result is that all
54498         compunit_symtabs created have the same name, that of the objfile:
54499
54500             { objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00)
54501               { ((struct compunit_symtab *) 0x621000286760)
54502                 debugformat ctf
54503                 producer (null)
54504                 name libbabeltrace2.so.0.0.0
54505                 dirname (null)
54506                 blockvector ((struct blockvector *) 0x6210003911d0)
54507                 user ((struct compunit_symtab *) (null))
54508                     { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003911f0)
54509                       fullname (null)
54510                       linetable ((struct linetable *) 0x0)
54511                     }
54512               }
54513               { ((struct compunit_symtab *) 0x621000275c10)
54514                 debugformat ctf
54515                 producer (null)
54516                 name libbabeltrace2.so.0.0.0
54517                 dirname (null)
54518                 blockvector ((struct blockvector *) 0x621000286710)
54519                 user ((struct compunit_symtab *) (null))
54520                     { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x621000286730)
54521                       fullname (null)
54522                       linetable ((struct linetable *) 0x0)
54523                     }
54524               }
54525
54526         Notice the two "name libbabeltrace2.so.0.0.0".
54527
54528         Change it to pass the partial_symtab's filename instead.  The output
54529         becomes:
54530
54531             { objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00)
54532               { ((struct compunit_symtab *) 0x621000295610)
54533                 debugformat ctf
54534                 producer (null)
54535                 name libbabeltrace2.so.0.0.0
54536                 dirname (null)
54537                 blockvector ((struct blockvector *) 0x6210003a15d0)
54538                 user ((struct compunit_symtab *) (null))
54539                     { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003a15f0)
54540                       fullname (null)
54541                       linetable ((struct linetable *) 0x0)
54542                     }
54543               }
54544               { ((struct compunit_symtab *) 0x621000288700)
54545                 debugformat ctf
54546                 producer (null)
54547                 name current-thread.c
54548                 dirname (null)
54549                 blockvector ((struct blockvector *) 0x6210002955c0)
54550                 user ((struct compunit_symtab *) (null))
54551                     { symtab /home/simark/src/babeltrace/src/lib/current-thread.c ((struct symtab *) 0x6210002955e0)
54552                       fullname (null)
54553                       linetable ((struct linetable *) 0x0)
54554                     }
54555               }
54556
54557         Note that the first compunit_symtab still has libbabeltrace2.so.0.0.0 as
54558         its name.  This is because the CTF symbol reader really creates a
54559         partial symtab named like this.  It appears to be because the debug info
54560         contains information that has been factored out of all CUs and is at the
54561         "top-level" of the objfile, outside any real CU.  So it creates a
54562         partial symtab and an artificial CU that's named after the objfile.
54563
54564         Change-Id: I576316bab2a3668adf87b4e6cebda900a8159b1b
54565
54566 2022-04-01  Simon Marchi  <simon.marchi@polymtl.ca>
54567
54568         gdb: print compunit_symtab name in "maint info symtabs"
54569         I think it would make sense to print a compunit_symtab's name in "maint
54570         info symtabs".  If you are looking for a given CU in the list, that's
54571         probably the field you will be looking at.  As the doc of
54572         compunit_symtab::name says, it is not meant to be a reliable file name,
54573         it is for debugging purposes (and "maint info symtabs" exists for
54574         debugging purposes).
54575
54576         Sample output with the new field:
54577
54578             (gdb) maintenance info symtabs
54579             { objfile /home/simark/build/binutils-gdb-one-target/gdb/a.out ((struct objfile *) 0x613000005d00)
54580               { ((struct compunit_symtab *) 0x621000131630)
54581                 debugformat DWARF 5
54582                 producer GNU C17 11.2.0 -mtune=generic -march=x86-64 -g3 -O0
54583                 name test.c
54584                 dirname /home/simark/build/binutils-gdb-one-target/gdb
54585                 blockvector ((struct blockvector *) 0x621000131d10)
54586                 user ((struct compunit_symtab *) (null))
54587                     { symtab test.c ((struct symtab *) 0x6210001316b0)
54588                       fullname (null)
54589                       linetable ((struct linetable *) 0x621000131d40)
54590                     }
54591                     { symtab /home/simark/build/binutils-gdb-one-target/gdb/test.h ((struct symtab *) 0x6210001316e0)
54592                       fullname (null)
54593                       linetable ((struct linetable *) 0x0)
54594                     }
54595                     { symtab /usr/include/stdc-predef.h ((struct symtab *) 0x621000131710)
54596                       fullname (null)
54597                       linetable ((struct linetable *) 0x0)
54598                     }
54599               }
54600               { ((struct compunit_symtab *) 0x6210001170a0)
54601                 debugformat DWARF 5
54602                 producer GNU C17 11.2.0 -mtune=generic -march=x86-64 -g3 -O0
54603                 name foo.c
54604                 dirname /home/simark/build/binutils-gdb-one-target/gdb
54605                 blockvector ((struct blockvector *) 0x621000131580)
54606                 user ((struct compunit_symtab *) (null))
54607                     { symtab foo.c ((struct symtab *) 0x621000117120)
54608                       fullname (null)
54609                       linetable ((struct linetable *) 0x6210001315b0)
54610                     }
54611                     { symtab /usr/include/stdc-predef.h ((struct symtab *) 0x621000117150)
54612                       fullname (null)
54613                       linetable ((struct linetable *) 0x0)
54614                     }
54615               }
54616             }
54617
54618         Change-Id: I17b87adfac2f6551cb5bda30d59f6c6882789211
54619
54620 2022-04-01  Simon Marchi  <simon.marchi@polymtl.ca>
54621
54622         gdb/ctf: don't create a buildsym_compunit when building partial symbols
54623         I am trying to do some changes to buildsym_compunit, so I am auditing
54624         the current uses.  Something seems odd with this use of
54625         buildsym_compunit (that this patch removes).
54626
54627         A buildsym_compunit is normally used when building a compunit_symtab.
54628         That is, when expanding a partial symtab into a full compunit symtab.
54629         In ctfread.c, a buildsym_compunit is created in ctf_start_archive, which
54630         is only used when creating partial symtabs.  At this moment, I don't
54631         see how that's useful.  ctf_start_archive creates a new
54632         buildsym_compunit and starts a subfile.  But that buildsym_compunit is
54633         never used again.  It's just overriden in ctf_start_symtab, which means
54634         we leak the old buildsym_compunit, I suppose.
54635
54636         Remove ctf_start_archive completely.  Add an assert in
54637         ctf_start_symtab to verify that we are not overwriting an existing
54638         buildsym_compunit (meaning we'd leak the existing one).  This assert
54639         triggers without the other part of the fix.  When doing:
54640
54641           $ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
54642           ...
54643           (gdb) maintenance expand-symtabs
54644           /home/simark/src/binutils-gdb/gdb/ctfread.c:1255: internal-error: ctf_start_symtab: Assertion `!ccp->builder' failed.
54645
54646         Change-Id: I666d146454a019f08e7305f3a1c4a974d27b4592
54647
54648 2022-04-01  Tom Tromey  <tom@tromey.com>
54649
54650         Style URLs in GDB output
54651         I noticed that GDB will display URLs in a few spots.  This changes
54652         them to be styled.  Originally I thought I'd introduce a new "url"
54653         style, but there aren't many places to use this, so I just reused
54654         filename styling instead.  This patch also changes the debuginfod URL
54655         list to be printed one URL per line.  I think this is probably a bit
54656         easier to read.
54657
54658 2022-04-01  GDB Administrator  <gdbadmin@sourceware.org>
54659
54660         Automatic date update in version.in
54661
54662 2022-03-31  Simon Marchi  <simon.marchi@polymtl.ca>
54663
54664         gdb: initialize ctf_context::builder in create_partial_symtab
54665         I built a random project with -gctf, in order to test the CTF support in
54666         GDB.  With my ASan/UBSan/etc-enabled build of GDB, I get:
54667
54668             $ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
54669             ...
54670             Reading symbols from /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0...
54671             /home/simark/src/binutils-gdb/gdb/ctfread.c:1545:31: runtime error: member call on misaligned address 0xbebebebebebebebe for type 'struct buildsym_compunit', which requires 8 byte alignment
54672             0xbebebebebebebebe: note: pointer points here
54673
54674         The 0xbebebebebebebebe value is a sign that the ctf_context::builder
54675         field is uninitialized.  The problem probably goes under the radar if
54676         the field happens to be zero-initialized, because ctf_start_archive
54677         contains this code:
54678
54679           if (ccx->builder == nullptr)
54680             {
54681               ccx->builder = new buildsym_compunit (of,
54682                               of->original_name, nullptr, language_c, 0);
54683
54684         If the field was zero-initialized (by chance), this will create a new
54685         buildsym_compunit.  But if the field was purposely filled with random
54686         bytes by one of the sanitizers, we won't create a buildsym_compunit here
54687         and we'll continue with ccx->builder equal to 0xbebebebebebebebe.
54688
54689         Fix this the easy way by initializing ccx->builder where the other
54690         ctf_context fields are initialized (yeah, this code could be made nicer
54691         C++, but I am going for the obvious fix here).
54692
54693         With this patch, this passes cleanly on my system:
54694
54695           $ make check TESTS="gdb.ctf/*.exp" RUNTESTFLAGS="CC_FOR_TARGET=/opt/gcc/git/bin/gcc"
54696           # of expected passes            40
54697
54698         ... where /opt/gcc/git/bin/gcc is a gcc with CTF support, given my
54699         system gcc does not have it.
54700
54701         Change-Id: Idea1b0cf3e3708b72ecb16b1b60222439160f9b9
54702
54703 2022-03-31  Tom Tromey  <tromey@adacore.com>
54704
54705         Remove dbx mode
54706         This patch removes gdb's dbx mode.  Regression tested on x86-64 Fedora
54707         34.
54708
54709 2022-03-31  H.J. Lu  <hjl.tools@gmail.com>
54710
54711         gdb: Consolidate 32bit-pkeys.xml and 64bit-pkeys.xml
54712         1. Since 32bit-pkeys.xml and 64bit-pkeys.xml are identical, consolidate
54713         them into a single keys.xml.
54714         2. Enable PKU for x32 to fix:
54715
54716         $ gdbserver :123456 x32-program
54717         ...
54718         .../gdbserver/regcache.cc:255: A problem internal to GDBserver has been detected
54719         .
54720         Unknown register pkru requested
54721
54722         on Tiger Lake.
54723
54724 2022-03-31  Simon Marchi  <simon.marchi@polymtl.ca>
54725
54726         gdb/linux-nat: remove check based on current_inferior in linux_handle_extended_wait
54727         The check removed by this patch, using current_inferior, looks wrong.
54728         When debugging multiple inferiors with the Linux native target and
54729         linux_handle_extended_wait is called, there's no guarantee about which
54730         is the current inferior.  The vfork-done event we receive could be for
54731         any inferior.  If the vfork-done event is for a non-current inferior, we
54732         end up wrongfully ignoring it.  As a result, the core never processes a
54733         TARGET_WAITKIND_VFORK_DONE event, program_space::breakpoints_not_allowed
54734         is never cleared, and breakpoints are never reinserted.  However,
54735         because the Linux native target decided to ignore the event, it resumed
54736         the thread - while breakpoints out.  And that's bad.
54737
54738         The proposed fix is to remove this check.  Always report vfork-done
54739         events and let infrun's logic decide if it should be ignored.  We don't
54740         save much cycles by filtering the event here.
54741
54742         Add a test that replicates the situation described above.  See comments
54743         in the test for more details.
54744
54745         Change-Id: Ibe33c1716c3602e847be6c2093120696f2286fbf
54746
54747 2022-03-31  Simon Marchi  <simon.marchi@polymtl.ca>
54748
54749         gdbserver/linux: set lwp !stopped when failing to resume
54750         I see some failures, at least in gdb.multi/multi-re-run.exp and
54751         gdb.threads/interrupted-hand-call.exp.  Running `stress -C $(nproc)` at
54752         the same time as the test makes those tests relatively frequent.
54753
54754         Let's take gdb.multi/multi-re-run.exp as an example.  The failure looks
54755         like this, an unexpected "no resumed":
54756
54757             continue
54758             Continuing.
54759             No unwaited-for children left.
54760             (gdb) FAIL: gdb.multi/multi-re-run.exp: re_run_inf=2: iter=1: continue until exit
54761
54762         The situation is:
54763
54764          - Inferior 1 is stopped somewhere, it won't really play a role here.
54765          - Inferior 2 has 2 threads, both stopped.
54766          - We resume inferior 2, the leader thread is expected to exit, making
54767            the process exit.
54768
54769         From GDB's perspective, a failing run looks like this:
54770
54771             [infrun] fetch_inferior_event: enter
54772               [infrun] scoped_disable_commit_resumed: reason=handling event
54773               [infrun] do_target_wait: Found 2 inferiors, starting at #1
54774               [infrun] random_pending_event_thread: None found.
54775               [remote] wait: enter
54776                 [remote] Packet received: T0506:20dcffffff7f0000;07:20dcffffff7f0000;10:9551555555550000;thread:pae4cd.ae4cd;core:e;
54777               [remote] wait: exit
54778               [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
54779               [infrun] print_target_wait_results:   713933.713933.0 [Thread 713933.713933],
54780               [infrun] print_target_wait_results:   status->kind = STOPPED, sig = GDB_SIGNAL_TRAP
54781               [infrun] handle_inferior_event: status->kind = STOPPED, sig = GDB_SIGNAL_TRAP
54782               [infrun] clear_step_over_info: clearing step over info
54783               [infrun] context_switch: Switching context from 0.0.0 to 713933.713933.0
54784               [infrun] handle_signal_stop: stop_pc=0x555555555195
54785               [infrun] start_step_over: enter
54786                 [infrun] start_step_over: stealing global queue of threads to step, length = 0
54787                 [infrun] operator(): step-over queue now empty
54788               [infrun] start_step_over: exit
54789               [infrun] process_event_stop_test: no stepping, continue
54790               [remote] Sending packet: $Z0,555555555194,1#8e
54791               [remote] Packet received: OK
54792               [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [713933.713933.0] at 0x555555555195
54793               [remote] Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;97;#0a
54794               [remote] Packet received: OK
54795               [remote] Sending packet: $vCont;c:pae4cd.-1#9f
54796               [infrun] prepare_to_wait: prepare_to_wait
54797               [infrun] reset: reason=handling event
54798               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target extended-remote
54799               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target extended-remote
54800               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target extended-remote
54801             [infrun] fetch_inferior_event: exit
54802             [infrun] fetch_inferior_event: enter
54803               [infrun] scoped_disable_commit_resumed: reason=handling event
54804               [infrun] do_target_wait: Found 2 inferiors, starting at #0
54805               [infrun] random_pending_event_thread: None found.
54806               [remote] wait: enter
54807                 [remote] Packet received: N
54808               [remote] wait: exit
54809               [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
54810               [infrun] print_target_wait_results:   -1.0.0 [process -1],
54811               [infrun] print_target_wait_results:   status->kind = NO_RESUMED
54812               [infrun] handle_inferior_event: status->kind = NO_RESUMED
54813               [remote] Sending packet: $Hgp0.0#ad
54814               [remote] Packet received: OK
54815               [remote] Sending packet: $qXfer:threads:read::0,1000#92
54816               [remote] Packet received: l<threads>\n<thread id="pae4cb.ae4cb" core="3" name="multi-re-run-1" handle="40c7c6f7ff7f0000"/>\n<thread id="pae4cb.ae4cc" core="2" name="multi-re-run-1" handle="40b6c6f7ff7f0000"/>\n<thread id="pae4cd.ae4ce" core="1" name="multi-re-run-2" handle="40b6c6f7ff7f0000"/>\n</threads>\n
54817               [infrun] stop_waiting: stop_waiting
54818               [remote] Sending packet: $qXfer:threads:read::0,1000#92
54819               [remote] Packet received: l<threads>\n<thread id="pae4cb.ae4cb" core="3" name="multi-re-run-1" handle="40c7c6f7ff7f0000"/>\n<thread id="pae4cb.ae4cc" core="2" name="multi-re-run-1" handle="40b6c6f7ff7f0000"/>\n<thread id="pae4cd.ae4ce" core="1" name="multi-re-run-2" handle="40b6c6f7ff7f0000"/>\n</threads>\n
54820               [infrun] infrun_async: enable=0
54821               [infrun] reset: reason=handling event
54822               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target extended-remote
54823               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target extended-remote
54824               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target extended-remote
54825             [infrun] fetch_inferior_event: exit
54826
54827         We can see that we resume the inferior with vCont;c, but got NO_RESUMED.
54828         When the test passes, we get an EXITED status to indicate the process
54829         has exited.
54830
54831         From GDBserver's point of view, it looks like this.  The logs contain
54832         some logging I added and that are part of this patch.
54833
54834             [remote] getpkt: getpkt ("vCont;c:pae4cf.-1");  [no ack sent]
54835             [threads] resume: enter
54836               [threads] thread_needs_step_over: Need step over [LWP 713931]? Ignoring, should remain stopped
54837               [threads] thread_needs_step_over: Need step over [LWP 713932]? Ignoring, should remain stopped
54838               [threads] get_pc: pc is 0x555555555195
54839               [threads] thread_needs_step_over: Need step over [LWP 713935]? No, no breakpoint found at 0x555555555195
54840               [threads] get_pc: pc is 0x7ffff7d35a95
54841               [threads] thread_needs_step_over: Need step over [LWP 713936]? No, no breakpoint found at 0x7ffff7d35a95
54842               [threads] resume: Resuming, no pending status or step over needed
54843               [threads] resume_one_thread: resuming LWP 713935
54844               [threads] proceed_one_lwp: lwp 713935
54845               [threads] resume_one_lwp_throw:   continue from pc 0x555555555195
54846               [threads] resume_one_lwp_throw: Resuming lwp 713935 (continue, signal 0, stop not expected)
54847               [threads] resume_one_lwp_throw: NOW ptid=713935.713935.0 stopped=0 resumed=0
54848               [threads] resume_one_thread: resuming LWP 713936
54849               [threads] proceed_one_lwp: lwp 713936
54850               [threads] resume_one_lwp_throw:   continue from pc 0x7ffff7d35a95
54851               [threads] resume_one_lwp_throw: Resuming lwp 713936 (continue, signal 0, stop not expected)
54852               [threads] resume_one_lwp_throw: ptrace errno = 3 (No such process)
54853             [threads] resume: exit
54854             [threads] wait_1: enter
54855               [threads] wait_1: [<all threads>]
54856               [threads] wait_for_event_filtered: waitpid(-1, ...) returned 0, ERRNO-OK
54857               [threads] resume_stopped_resumed_lwps: resuming stopped-resumed LWP LWP 713935.713936 at 7ffff7d35a95: step=0
54858               [threads] resume_one_lwp_throw:   continue from pc 0x7ffff7d35a95
54859               [threads] resume_one_lwp_throw: Resuming lwp 713936 (continue, signal 0, stop not expected)
54860               [threads] resume_one_lwp_throw: ptrace errno = 3 (No such process)
54861               [threads] operator(): check_zombie_leaders: leader_pid=713931, leader_lp!=NULL=1, num_lwps=2, zombie=0
54862               [threads] operator(): check_zombie_leaders: leader_pid=713935, leader_lp!=NULL=1, num_lwps=2, zombie=1
54863               [threads] operator(): Thread group leader 713935 zombie (it exited, or another thread execd).
54864               [threads] delete_lwp: deleting 713935
54865               [threads] wait_for_event_filtered: exit (no unwaited-for LWP)
54866             sigchld_handler
54867               [threads] wait_1: ret = null_ptid, TARGET_WAITKIND_NO_RESUMED
54868             [threads] wait_1: exit
54869
54870         What happens is:
54871
54872          - We resume the leader (713935) successfully.
54873          - The leader exits.
54874          - We resume the secondary thread (713936), we get ESRCH.  This is
54875            expected this the leader has exited.
54876          - resume_one_lwp_throw throws, it's caught by resume_one_lwp.
54877          - resume_one_lwp checks with check_ptrace_stopped_lwp_gone that the
54878            failure can be explained by the LWP becoming zombie, and swallows the
54879            error.
54880          - Note that this means that the secondary lwp still has stopped==1.
54881          - wait_1 is called, probably because linux_process_target::resume marks
54882            the async pipe at the end.
54883          - The exit event isn't ready yet, probably because the machine is under
54884            load, so waitpid returns nothing.
54885          - check_zombie_leaders detects that the leader is zombie and deletes
54886          - We try to find a resumed (non-stopped) LWP to get an event from,
54887            there's none since the leader (that was resumed) is now deleted, and
54888            the secondary thread is still marked stopped.
54889            wait_for_event_filtered returns -1, causing wait_1 to return
54890            NO_RESUMED.
54891
54892         What I notice here is that there is some kind of race between the
54893         availability of the process' exit notification and the call to wait_1
54894         that results from marking the async pipe at the end of resume.
54895
54896         I think what we want from this wait_1 invocation is to keep waiting, as
54897         we will eventually get thread exit notifications for both of our
54898         threads.
54899
54900         The fix I came up with is to mark the secondary thread as !stopped (or
54901         resumed) when we fail to resume it.  This makes wait_1 see that there is
54902         at least one resume lwp, so it won't return NO_RESUMED.  I think this
54903         makes sense to consider it resumed, because we are going to receive an
54904         exit event for it.  Here's the GDBserver logs with the fix applied:
54905
54906             [threads] resume: enter
54907               [threads] thread_needs_step_over: Need step over [LWP 724595]? Ignoring, should remain stopped
54908               [threads] thread_needs_step_over: Need step over [LWP 724596]? Ignoring, should remain stopped
54909               [threads] get_pc: pc is 0x555555555195
54910               [threads] thread_needs_step_over: Need step over [LWP 724597]? No, no breakpoint found at 0x555555555195
54911               [threads] get_pc: pc is 0x7ffff7d35a95
54912               [threads] thread_needs_step_over: Need step over [LWP 724598]? No, no breakpoint found at 0x7ffff7d35a95
54913               [threads] resume: Resuming, no pending status or step over needed
54914               [threads] resume_one_thread: resuming LWP 724597
54915               [threads] proceed_one_lwp: lwp 724597
54916               [threads] resume_one_lwp_throw:   continue from pc 0x555555555195
54917               [threads] resume_one_lwp_throw: Resuming lwp 724597 (continue, signal 0, stop not expected)
54918               [threads] resume_one_lwp_throw: NOW ptid=724597.724597.0 stopped=0 resumed=0
54919               [threads] resume_one_thread: resuming LWP 724598
54920               [threads] proceed_one_lwp: lwp 724598
54921               [threads] resume_one_lwp_throw:   continue from pc 0x7ffff7d35a95
54922               [threads] resume_one_lwp_throw: Resuming lwp 724598 (continue, signal 0, stop not expected)
54923               [threads] resume_one_lwp_throw: ptrace errno = 3 (No such process)
54924             [threads] resume: exit
54925             [threads] wait_1: enter
54926               [threads] wait_1: [<all threads>]
54927             sigchld_handler
54928               [threads] wait_for_event_filtered: waitpid(-1, ...) returned 0, ERRNO-OK
54929               [threads] operator(): check_zombie_leaders: leader_pid=724595, leader_lp!=NULL=1, num_lwps=2, zombie=0
54930               [threads] operator(): check_zombie_leaders: leader_pid=724597, leader_lp!=NULL=1, num_lwps=2, zombie=1
54931               [threads] operator(): Thread group leader 724597 zombie (it exited, or another thread execd).
54932               [threads] delete_lwp: deleting 724597
54933               [threads] wait_for_event_filtered: sigsuspend'ing
54934             sigchld_handler
54935               [threads] wait_for_event_filtered: waitpid(-1, ...) returned 724598, ERRNO-OK
54936               [threads] wait_for_event_filtered: waitpid 724598 received 0 (exited)
54937               [threads] filter_event: 724598 exited
54938               [threads] wait_for_event_filtered: waitpid(-1, ...) returned 724597, ERRNO-OK
54939               [threads] wait_for_event_filtered: waitpid 724597 received 0 (exited)
54940               [threads] wait_for_event_filtered: waitpid(-1, ...) returned 0, ERRNO-OK
54941             sigchld_handler
54942               [threads] wait_1: ret = LWP 724597.724598, exited with retcode 0
54943             [threads] wait_1: exit
54944
54945         Change-Id: Idf0bdb4cb0313f1b49e4864071650cc83fb3c100
54946
54947 2022-03-31  Simon Marchi  <simon.marchi@efficios.com>
54948
54949         gdb/testsuite/tui: implement _csi_P proc
54950         Since commit 3cd522938792 ("Change the pager to a ui_file"), I see these
54951         errors when running gdb.tui/scroll.exp:
54952
54953             ERROR: invalid command name "_csi_P"
54954                 while executing
54955             "::gdb_tcl_unknown _csi_P 2"
54956                 ("uplevel" body line 1)
54957                 invoked from within
54958             "uplevel 1 ::gdb_tcl_unknown $args"
54959                 (procedure "::unknown" line 5)
54960                 invoked from within
54961             "_csi_P 2"
54962                 ("eval" body line 1)
54963                 invoked from within
54964             "eval _csi_$cmd $params"
54965
54966         It looks like GDB is emitting a CSI that it did not emit before, the
54967         "Delete character" one:
54968
54969           https://vt100.net/docs/vt510-rm/DCH.html
54970
54971         Implement it.
54972
54973         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
54974         Change-Id: I5bf86b6104d51b0623a26a69df83d1ca9a4851b7
54975
54976 2022-03-31  Simon Marchi  <simon.marchi@polymtl.ca>
54977
54978         gdb: fix use of fprintf_filtered in top.c
54979         A race condition in how patches were pushed causes this build failure:
54980
54981               CXX    top.o
54982             /home/simark/src/binutils-gdb/gdb/top.c: In function ‘void print_gdb_configuration(ui_file*)’:
54983             /home/simark/src/binutils-gdb/gdb/top.c:1622:3: error: ‘fprintf_filtered’ was not declared in this scope; did you mean ‘printf_unfiltered’?
54984              1622 |   fprintf_filtered (stream, _("\
54985                   |   ^~~~~~~~~~~~~~~~
54986
54987         fprintf_filtered has been removed, gdb_printf must be used now.  Fix
54988         this.
54989
54990         Change-Id: I6a172ba0d53dab2e7cc43ed0ed2696c82925245b
54991
54992 2022-03-31  Richard Sandiford  <richard.sandiford@arm.com>
54993
54994         aarch64: Relax check for RNG system registers
54995         FEAT_RNG is an optional Armv8.5-A extension, but it can be backported
54996         to earlier architectures as well.  GAS previously made the RNG registers
54997         conditional on having both armv8.5-a and +rng, but only +rng should be
54998         required.
54999
55000         This seems to be the only feature that was handled like this.
55001
55002         opcodes/
55003                 * aarch64-opc.c (SR_RNG): Don't require V8_5.
55004
55005         gas/
55006                 * testsuite/gas/aarch64/rng-1.s, testsuite/gas/aarch64/rng-1.d: New
55007                 test.
55008
55009 2022-03-31  Eli Zaretskii  <eliz@gnu.org>
55010
55011         * gdb/top.c (print_gdb_configuration): Announce --enable-threading.
55012         This includes the reporting of --enable/disable-threading as part of
55013         the GDB configuration description.
55014
55015 2022-03-31  Simon Marchi  <simon.marchi@efficios.com>
55016
55017         gdb/infrun: add reason parameter to stop_all_threads
55018         Add a "reason" parameter, only used to show in debug messages what is
55019         the reason for stopping all threads.  This helped me understand the
55020         debug logs while adding some new uses of stop_all_threads, so I am
55021         proposing to merge it.
55022
55023         Change-Id: I66c8c335ebf41836a7bc3d5fe1db92c195f65e55
55024
55025 2022-03-31  Simon Marchi  <simon.marchi@efficios.com>
55026
55027         gdb/testsuite: update copyright years in gdb.base/vfork-follow-parent.*
55028         I forgot to do this before pushing the previous commit.
55029
55030         Change-Id: Ia343f702e8357d0fd109e9ddd778973e91862805
55031
55032 2022-03-31  Simon Marchi  <simon.marchi@efficios.com>
55033
55034         gdb: test vfork + follow-fork-mode=parent + detach-on-fork=off
55035         The particular behavior we have when using that combination of settings
55036         doesn't seem tested at all (at least, I don't find it if I grep for "Can
55037         not resume the parent process").  Add a simple test for that.
55038
55039         Change-Id: Ib9454a615abba661b42f1b15056df73ed1bcd4c5
55040
55041 2022-03-31  Nick Clifton  <nickc@redhat.com>
55042
55043         Accept the + character as part of filenames for MRI scripts.
55044
55045 2022-03-31  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
55046
55047         Fix procfs.c compilation
55048         procfs.c doesn't compile on Solaris:
55049
55050         /vol/src/gnu/gdb/hg/master/local/gdb/procfs.c: In member function ‘virtual bool procfs_target::info_proc(const char*, info_proc_what)’:
55051         /vol/src/gnu/gdb/hg/master/local/gdb/procfs.c:3302:3: error: ‘gdb_argv’ was not declared in this scope
55052          3302 |   gdb_argv built_argv (args);
55053               |   ^~~~~~~~
55054         /vol/src/gnu/gdb/hg/master/local/gdb/procfs.c:3303:20: error: ‘built_argv’ was not declared in this scope; did you mean ‘buildargv’?
55055          3303 |   for (char *arg : built_argv)
55056               |                    ^~~~~~~~~~
55057               |                    buildargv
55058
55059         Fixed by including  "gdbsupport/buildargv.h".
55060
55061         Tested on amd64-pc-solaris2.11, sparcv9-sun-solaris2.11.
55062
55063 2022-03-31  GDB Administrator  <gdbadmin@sourceware.org>
55064
55065         Automatic date update in version.in
55066
55067 2022-03-30  Simon Marchi  <simon.marchi@polymtl.ca>
55068
55069         gdb/testsuite: add tests for Term
55070         While trying to review Andrew's patch here [1], I thought I spotted a
55071         bug in the handling of a CSI, but I had no way to know for sure.  So I
55072         thought it would be useful to have unit tests for the handling of
55073         control characters and control sequences of our toy terminal
55074         implementation.  It might help avoid chasing bugs in the GDB TUI when in
55075         reality it's a problem with the testsuite's terminal implementation.
55076
55077         Add the gdb.tui/tuiterm.exp file to do that.  All currently supported
55078         control sequences and characters are tested, except _csi_m (the one that
55079         handles colors and stuff).  _csi_m should probably be tested too, but it
55080         will require more work.
55081
55082         Fix a few issues that the tests spotted:
55083
55084          - backspace: according to [3] (table 4-1), a backspace when the cursor
55085            is at the beginning of a line should have no effect.  Our
55086            implementation did wrap to the end of the previous line.  Change our
55087            implementation to match the doc (and the test).
55088          - insert character: this control sequence is supposed to insert blank
55089            characters, shifting all the rest of the line right.  The current
55090            implementation moves N characters right, but it overwrites the
55091            characters on the right instead of shifting them.  It also doesn't
55092            insert blank characters at the cursor.
55093          - Cursor down, forward, next line: off-by-one error when reaching the
55094            end of the display.
55095          - erase in display, line: off-by-one errors.
55096          - vertical line position absolute: allowed setting the cursor outside
55097            the display, when it should clamp it to the display size.
55098
55099         I found that this web page [2] gave some good clues on the expected
55100         behavior of some control characters or sequences that some other pages
55101         didn't.
55102
55103         [1] https://sourceware.org/pipermail/gdb-patches/2022-March/186433.html
55104         [2] https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
55105         [3] https://vt100.net/docs/vt510-rm/chapter4.html#S4.3.3
55106
55107         Change-Id: Iab4141fdcfb7459d1b7c45cc63bd1fcb50a78d5d
55108
55109 2022-03-30  Tom Tromey  <tom@tromey.com>
55110
55111         Only allow QUIT on the main thread
55112         Pedro pointed out that gdb worker threads should not react to quits.
55113         While I don't think that the new DWARF reader can call QUIT from a
55114         worker thread (and I don't think the existing minsym threading code
55115         can either), it seems safest to address this before checking in the
55116         new code.  This patch arranges for the QUIT macro to only work on the
55117         main thread.
55118
55119 2022-03-30  Tom Tromey  <tromey@adacore.com>
55120
55121         Use gdb_printf and gdb_vprintf in more places
55122         Luis pointed out that I missed a spot in the gdb_printf conversion --
55123         namely aarch64-nat.c.  While looking at this, I found another spot in
55124         darwin-nat.c that I also missed.  I can't build either of these, but I
55125         think this patch should fix the problems.
55126
55127         Consolidate definition of current_directory
55128         I noticed that both gdbserver and gdb define current_directory.
55129         However, as it is referenced by gdbsupport, it seemed better to define
55130         it there as well.  This patch also moves the declaration to
55131         pathstuff.h.  Tested by rebuilding.
55132
55133 2022-03-30  Tom Tromey  <tromey@adacore.com>
55134
55135         Decode "dynamic" interface types in Ada
55136         In Ada, if a class implements an interface and has a dynamic
55137         superclass, then the "offset to top" -- the offset that says how to
55138         turn a pointer to the interface into a pointer to the whole object --
55139         is stored in the object itself.  This patch changes GDB to understand
55140         this.
55141
55142         Because this only touches Ada code, and because Joel already reviewed
55143         it internally, I am checking it in.
55144
55145 2022-03-30  Jeff Law  <jeffreyalaw@gmail.com>
55146
55147         Fix for MUL instruction on the v850
55148                 * sim/v850/simops.c (Multiply64): Properly test if we need to
55149                 negate either of the operands.
55150
55151                 * sim/testsuite/v850/mul.cgs: New test.
55152
55153 2022-03-30  GDB Administrator  <gdbadmin@sourceware.org>
55154
55155         Automatic date update in version.in
55156
55157 2022-03-29  Tom Tromey  <tom@tromey.com>
55158
55159         Remove two unused hooks
55160         I noticed that a couple of deprecated hooks aren't ever called, so
55161         they can't really be used by Insight.  This patch removes them
55162         entirely.  I checked the Insight sources, and these aren't mentioned
55163         there, either.
55164
55165 2022-03-29  Tom Tromey  <tom@tromey.com>
55166
55167         Remove unnecessary calls to wrap_here and gdb_flush
55168         Various spots in gdb currently know about the wrap buffer, and so are
55169         careful to call wrap_here to be certain that all output has been
55170         flushed.
55171
55172         Now that the pager is just an ordinary stream, this isn't needed, and
55173         a simple call to gdb_flush is enough.
55174
55175         Similarly, there are places where gdb prints to gdb_stderr, but first
55176         flushes gdb_stdout.  stderr_file already flushes gdb_stdout, so these
55177         aren't needed.
55178
55179 2022-03-29  Tom Tromey  <tom@tromey.com>
55180
55181         Minor comment updates in utils.h
55182         This patch updates some comments in utils.h to more closely reflect
55183         the new reality.
55184
55185         Remove vfprintf_styled
55186         Nothing calls vfprintf_styled any more, so remove it.
55187
55188         Remove ui_out_flag::unfiltered_output
55189         There is no longer any need for ui_out_flag::unfiltered_output --
55190         nothing ever sets this flag.  This used to be needed to make the
55191         _unfiltered output work, but now only printf_unfiltered can be used,
55192         and it uses the puts_unfiltered method.  This patch removes the flag
55193         and the dead code.
55194
55195         Rename fprintf_symbol_filtered
55196         fprintf_symbol_filtered is misnamed, because whether filtering happens
55197         is now up to the stream.  This renames it to fprintf_symbol, which
55198         isn't a great name (the first "f" doesn't mean much and the second one
55199         is truly meaningless here), but "print_symbol" was already taken.
55200
55201         Rename puts_filtered_tabular
55202         puts_filtered_tabular is now misnamed, because whether filtering
55203         happens is now up to the stream.  So, rename it.  (This function is
55204         pretty weird, and should probably be rewritten to avoid using the
55205         chars_printed global, and moved into objc-lang.c.  However, I haven't
55206         done so.)
55207
55208         Rename print_spaces_filtered
55209         print_spaces_filtered is now misnamed, because whether filtering
55210         happens is up to the stream.  So, rename it.
55211
55212         Unify gdb printf functions
55213         Now that filtered and unfiltered output can be treated identically, we
55214         can unify the printf family of functions.  This is done under the name
55215         "gdb_printf".  Most of this patch was written by script.
55216
55217         Unify gdb putc functions
55218         Now that filtered and unfiltered output can be treated identically, we
55219         can unify the putc family of functions.  This is done under the name
55220         "gdb_putc".  Most of this patch was written by script.
55221
55222         Unify gdb puts functions
55223         Now that filtered and unfiltered output can be treated identically, we
55224         can unify the puts family of functions.  This is done under the name
55225         "gdb_puts".  Most of this patch was written by script.
55226
55227         Unify vprintf functions
55228         Now that filtered and unfiltered output can be treated identically, we
55229         can unify the vprintf family of functions: vprintf_filtered,
55230         vprintf_unfiltered, vfprintf_filtered and vfprintf_unfiltered.  (For
55231         the gdb_stdout variants, recall that only printf_unfiltered gets truly
55232         unfiltered output at this point.)  This removes one such function and
55233         renames the remaining two to "gdb_vprintf".  All callers are updated.
55234         Much of this patch was written by script.
55235
55236         Remove fputs_styled_unfiltered
55237         fputs_styled_unfiltered is only called from cli_ui_out, so remove it.
55238         This area will be further simplified in future patches.
55239
55240 2022-03-29  Tom Tromey  <tom@tromey.com>
55241
55242         Change the pager to a ui_file
55243         This rewrites the output pager as a ui_file implementation.
55244
55245         A new header is introduced to declare the pager class.  The
55246         implementation remains in utils.c for the time being, because there
55247         are some static globals there that must be used by this code.  (This
55248         could be cleaned up at some future date.)
55249
55250         I went through all the text output in gdb to ensure that this change
55251         should be ok.  There are a few cases:
55252
55253         * Any existing call to printf_unfiltered is required to be avoid the
55254           pager.  This is ensured directly in the implementation.
55255
55256         * All remaining calls to the f*_unfiltered functions -- the ones that
55257           take an explicit ui_file -- either send to an unfiltered stream
55258           (e.g., gdb_stderr), which is obviously ok; or conditionally send to
55259           gdb_stdout
55260
55261           I investigated all such calls by searching for:
55262
55263             grep -e '\bf[a-z0-9_]*_unfiltered' *.[chyl] */*.[ch] | grep -v gdb_stdlog | grep -v gdb_stderr
55264
55265           This yields a number of candidates to check.
55266
55267           * The breakpoint _print_recreate family, and
55268             save_trace_state_variables.  These are used for "save" commands
55269             and so are fine.
55270
55271           * Things printing to a temporary stream.  Obviously ok.
55272
55273           * Disassembly selftests.
55274
55275           * print_gdb_help - this is non-obvious, but ok because paging isn't
55276             yet enabled at this point during startup.
55277
55278           * serial.c - doens't use gdb_stdout
55279
55280           * The code in compile/.  This is all printing to a file.
55281
55282           * DWARF DIE dumping - doesn't reference gdb_stdout.
55283
55284         * Calls to the _filtered form -- these are all clearly ok, because if
55285           they are using gdb_stdout, then filtering will still apply; and if
55286           not, then filtering never applied and still will not.
55287
55288         Therefore, at this point, there is no longer any distinction between
55289         all the other _filtered and _unfiltered calls, and they can be
55290         unified.
55291
55292         In this patch, take special note of the vfprintf_maybe_filtered and
55293         ui_file::vprintf change.  This is one instance of the above idea,
55294         erasing the distinction between filtered and unfiltered -- in this
55295         part of the change, the "unfiltered_output" flag is never passe to
55296         cli_ui_out.  Subsequent patches will go much further in this
55297         direction.
55298
55299         Also note the can_emit_style_escape changes in ui-file.c.  Checking
55300         against gdb_stdout or gdb_stderr was always a bit of a hack; and now
55301         it is no longer needed, because this is decision can be more fully
55302         delegated to the particular ui_file implementation.
55303
55304         ui_file::can_page is removed, because this patch removed the only call
55305         to it.
55306
55307         I think this is the main part of fixing PR cli/7234.
55308
55309         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7234
55310
55311 2022-03-29  Tom Tromey  <tom@tromey.com>
55312
55313         Remove vfprintf_styled_no_gdbfmt
55314         This removes vfprintf_styled_no_gdbfmt, inlining it at the sole point
55315         of call.
55316
55317         Add style-escape methods to ui_file
55318         This adds emit_style_escape and reset_style methods to ui_file.  These
55319         aren't used yet, but they will be once the pager is converted to be a
55320         ui_file subclass.
55321
55322         Add puts_unfiltered method to ui_file
55323         When the pager is rewritten as a ui_file, gdb will still need a way to
55324         bypass the filtering.  After examining a few approaches, I chose this
55325         patch, which adds a puts_unfiltered method to ui_file.  For most
55326         implementations of ui_file, this will just delegate to puts.  This
55327         patch also switches printf_unfiltered to use the new method.
55328
55329         Only have one API for unfiltered output
55330         At the end of this series, the use of unfiltered output will be very
55331         restricted -- only places that definitely need it will use it.  To
55332         this end, I thought it would be good to reduce the number of
55333         _unfiltered APIs that are exposed.  This patch changes gdb so that
55334         only printf_unfiltered exists.  (After this patch, the f* variants
55335         still exist as well, but those will be removed later.)
55336
55337 2022-03-29  Tom Tromey  <tom@tromey.com>
55338
55339         Remove some uses of printf_unfiltered
55340         A number of spots call printf_unfiltered only because they are in code
55341         that should not be interrupted by the pager.  However, I believe these
55342         cases are all handled by infrun's blanket ban on paging, and so can be
55343         converted to the default (_filtered) API.
55344
55345         After this patch, I think all the remaining _unfiltered calls are ones
55346         that really ought to be.  A few -- namely in complete_command -- could
55347         be replaced by a scoped assignment to pagination_enabled, but for the
55348         remainder, the code seems simple enough like this.
55349
55350 2022-03-29  Tom Tromey  <tom@tromey.com>
55351
55352         Use unfiltered output in annotate.c
55353         It seems to me that annotations should not be filtered.  While it
55354         might be weird for an annotation-based UI to use the pager, it's not,
55355         I think, out of the question.  This patch makes this change.
55356
55357 2022-03-29  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
55358             Aleksandar Paunovic  <aleksandar.paunovic@intel.com>
55359
55360         gdb/remote: use current_inferior in read_ptid if multi-process not supported
55361         When parsing the ptid out of a reply package, if the multi-process
55362         extensions are not supported, use current_inferior's pid as the pid of
55363         the reported thread, instead of inferior_ptid.  This is needed because
55364         the inferior_ptid may be null_ptid although a legit context exists,
55365         due to a prior context switch via switch_to_inferior_no_thread.
55366
55367         Below is a scenario that illustrates what could go wrong.  First,
55368         setup a multi-target scenario.  This is needed, because in a
55369         multi-target setting, the inferior_ptid is cleared out before waiting
55370         on targets.  The second inferior below sits on top of a remote target.
55371         Multi-process packets are disabled.
55372
55373           $ # First, spawn a process with PID 26253 to attach to later.
55374           $ gdb-up a.out
55375           Reading symbols from a.out...
55376           (gdb) maint set target-non-stop on
55377           (gdb) set remote multiprocess-feature-packet off
55378           (gdb) start
55379           ...
55380           (gdb) add-inferior -no-connection
55381           [New inferior 2]
55382           Added inferior 2
55383           (gdb) inferior 2
55384           [Switching to inferior 2 [<null>] (<noexec>)]
55385           (gdb) target extended-remote | gdbserver --multi -
55386           Remote debugging using | gdbserver --multi -
55387           Remote debugging using stdio
55388           (gdb) attach 26253
55389           Attaching to Remote target
55390           Attached; pid = 26253
55391           [New Thread 26253]
55392           [New inferior 3]
55393           Reading /tmp/a.out from remote target...
55394           ...
55395           [New Thread 26253]
55396           ...
55397           Reading /usr/local/lib/debug/....debug from remote target...
55398           >>> GDB seems to hang here.
55399
55400         After attaching to a process and reading some library files, GDB
55401         seems to hang.  One interesting thing to note is that
55402
55403           [New Thread 26253]
55404
55405         appears twice.  We also see
55406
55407           [New inferior 3]
55408
55409         Running the same scenario with "debug infrun on" reveals more details.
55410
55411           ...
55412           (gdb) attach 26253
55413           [infrun] scoped_disable_commit_resumed: reason=attaching
55414           Attaching to Remote target
55415           Attached; pid = 26253
55416           [New Thread 26253]
55417           [infrun] infrun_async: enable=1
55418           [infrun] attach_command: immediately after attach:
55419           [infrun] attach_command:   thread 26253.26253.0, executing = 1, resumed = 0, state = RUNNING
55420           [infrun] clear_proceed_status_thread: 26253.26253.0
55421           [infrun] reset: reason=attaching
55422           [infrun] maybe_set_commit_resumed_all_targets: not requesting commit-resumed for target native, no resumed threads
55423           [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target extended-remote
55424           [infrun] fetch_inferior_event: enter
55425             [infrun] scoped_disable_commit_resumed: reason=handling event
55426             [infrun] do_target_wait: Found 2 inferiors, starting at #1
55427             [infrun] random_pending_event_thread: None found.
55428             [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) =
55429             [infrun] print_target_wait_results:   26253.26253.0 [Thread 26253],
55430             [infrun] print_target_wait_results:   status->kind = STOPPED, sig = GDB_SIGNAL_0
55431             [infrun] handle_inferior_event: status->kind = STOPPED, sig = GDB_SIGNAL_0
55432             [infrun] start_step_over: enter
55433               [infrun] start_step_over: stealing global queue of threads to step, length = 0
55434               [infrun] operator(): step-over queue now empty
55435             [infrun] start_step_over: exit
55436             [infrun] context_switch: Switching context from 0.0.0 to 26253.26253.0
55437             [infrun] handle_signal_stop: stop_pc=0x7f849d8cf151
55438             [infrun] stop_waiting: stop_waiting
55439             [infrun] stop_all_threads: starting
55440             [infrun] stop_all_threads: pass=0, iterations=0
55441           [New inferior 3]
55442           Reading /tmp/a.out from remote target...
55443           warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
55444           Reading /tmp/a.out from remote target...
55445           Reading symbols from target:/tmp/a.out...
55446           [New Thread 26253]
55447             [infrun] stop_all_threads:   4723.4723.0 not executing
55448             [infrun] stop_all_threads:   26253.26253.0 not executing
55449             [infrun] stop_all_threads:   42000.26253.0 executing, need stop
55450             [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) =
55451             [infrun] print_target_wait_results:   -1.0.0 [Thread 0],
55452             [infrun] print_target_wait_results:   status->kind = IGNORE
55453             [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) =
55454             [infrun] print_target_wait_results:   -1.0.0 [Thread 0],
55455             [infrun] print_target_wait_results:   status->kind = IGNORE
55456
55457         GDB tried to stop Thread 42000.26253.0, which does not exist, and we
55458         are waiting for a stop event that will never happen.  The PID in
55459         '42000.26253.0', namely 42000, is the PID of magic_null_ptid.
55460         It comes from gdb/remote.c:read_ptid:
55461
55462           /* Since the stub is not sending a process id, then default to
55463              what's in inferior_ptid, unless it's null at this point.  If so,
55464              then since there's no way to know the pid of the reported
55465              threads, use the magic number.  */
55466           if (inferior_ptid == null_ptid)
55467             pid = magic_null_ptid.pid ();
55468           else
55469             pid = inferior_ptid.pid ();
55470
55471           if (obuf)
55472             *obuf = pp;
55473           return ptid_t (pid, tid);
55474
55475         Because multi-process was turned off, GDB did not parse an explicitly
55476         specified PID.  Furthermore, inferior_ptid == null_ptid, and
55477         eventually GDB picked the PID from magic_null_ptid.
55478
55479         If target-non-stop is not turned on at the beginning, the same bug
55480         reveals itself as a duplicated thread as shown below.
55481
55482           # Same setup as above, without 'maint set target-non-stop on'.
55483           ...
55484           (gdb) attach 26253
55485           Attaching to Remote target
55486           Attached; pid = 26253
55487           [New inferior 3]
55488           ...
55489           [New Thread 26253]
55490           ...
55491           (gdb) info threads
55492             Id   Target Id             Frame
55493             1.1  process 13517 "a.out" main () at test.c:3
55494           * 2.1  Thread 26253 "a.out"  0x00007f12750c5151 in read () from target:/lib/x86_64-linux-gnu/libc.so.6
55495             3.1  Thread 26253 "a.out"  Remote 'g' packet reply is too long (expected 560 bytes, got 2496 bytes): 00feffffffffffff000a3a75127f000051510c75127f0000000400000000000060d24ef6af5500000000000000000000680d000000000000b85b31e3fc7f0000c0283a75127f000000e55b75127f000010d04ef6af550000460200000000000060c73975127f0000a0d23975127f0000000a3a75127f0000000000000000000051510c75127f000046020000330000002b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000080143a75127f000080143a75127f000040143a75127f000040143a75127f00007d0000007e0000007f00000080000000300c3a75127f0000300c3a75127f00000e000000000000000e0000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff0400000004000000040000000400000020143a75127f000020143a75127f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000000000000000000000e55b75127f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55496           (gdb)
55497
55498         Fix the problem by preferring current_inferior()'s pid instead of
55499         magic_null_ptid.
55500
55501         Regression-tested on X86-64 Linux.
55502
55503 2022-03-29  Andrew Burgess  <aburgess@redhat.com>
55504
55505         gdb/testsuite: fix test failure when building against readline v7
55506         The test added in the commit:
55507
55508           commit a6b413d24ccc5d76179bab866834e11fd6fec294
55509           Date:   Fri Mar 11 14:44:03 2022 +0000
55510
55511               gdb: work around prompt corruption caused by bracketed-paste-mode
55512
55513         Was not written with readline 7 in mind, only readline 8+.  Between
55514         readline 7 and 8 the escape sequence used to disable bracketed paste
55515         mode changed, an additional '\r' character was added to the end.  In
55516         fact, it was the addition of this '\r' character that triggered the
55517         issue for which the above commit is part of the solution.
55518
55519         Anyway, the test tries to spot the case where the output from GDB is
55520         not perfect, but does have the above work around applied.  However,
55521         the pattern in the test assumes that the problematic '\r' will be
55522         present, and this is only true for readline 8+.  With readline 7 the
55523         test was failing.
55524
55525         In this commit I generalise the pattern a little so that the test will
55526         still KFAIL with readline 7.
55527
55528         It's a little unfortunate that the test is KFAILing with readline 7,
55529         as without the problematic '\r' there's actually no reason that GDB
55530         couldn't "do the right thing" in this case, in which case, the test
55531         would PASS, but that would require changes within GDB itself.
55532
55533         My preference then is that initially we patch the test to get it
55534         KFAILing, then in a separate commit I can modify GDB so that it can
55535         PASS with readline 7.
55536
55537 2022-03-29  Andrew Burgess  <aburgess@redhat.com>
55538
55539         gdb/testsuite: fix copy & paste error in gdb.python/py-format-address.exp
55540         The test gdb.python/py-format-address.exp, added in commit:
55541
55542           commit 25209e2c6979c3838e14e099f0333609810db280
55543           Date:   Sat Oct 23 09:59:25 2021 +0100
55544
55545               gdb/python: add gdb.format_address function
55546
55547         included 3 copy & paste errors where the wrong address was used in the
55548         expected output patterns.
55549
55550         The test compiles two almost identical test binaries (one function
55551         changes its name, that's the only difference), two inferiors are
55552         created, each inferior using one of the test binaries.
55553
55554         We then take the address of the name changing function in both
55555         inferiors ('foo' in inferior 1 and 'bar' in inferior 2) and the tests
55556         are carried out using these addresses.
55557
55558         What we're checking for is that symbols 'foo' and 'bar' show up in the
55559         correct inferior, and that (as this test is for a Python API feature),
55560         the user can have one inferior selected, but ask about the other
55561         inferior, and see the correct symbol in the result.
55562
55563         The hope is that the two binaries will be laid out identically by the
55564         compiler, and that 'foo' and 'bar' will be at the same address.  This
55565         is fine, unless the executable is compiled as PIE (position
55566         independent executable), in which case there is a problem.
55567
55568         The problem is that though inferior 1 is set running, the inferior 2
55569         never is.  If the executables are compiled as PIE, then the address in
55570         the inferior 2 will not have been resolved, while the address in the
55571         inferior 1 will have been, and so the two addresses we use in the
55572         tests will be different.
55573
55574         This issue was reported here:
55575
55576           https://sourceware.org/pipermail/gdb-patches/2022-March/186911.html
55577
55578         The first part of the fix is to use the correct address variable in
55579         the expected output patterns, with this change the tests pass even
55580         when the executables are compiled as PIE.
55581
55582         A second part of this fix is to pass the 'nopie' option when we
55583         compile the tests, this should ensure that the address obtained in
55584         inferior 2 is the same as the address from inferior 1, which makes the
55585         test more useful.
55586
55587 2022-03-29  Andrew Burgess  <aburgess@redhat.com>
55588
55589         gdb/mi: fix use after free of frame_info causing spurious notifications
55590         In commit:
55591
55592           commit a2757c4ed693cef4ecc4dcdcb2518353eb6b3c3f
55593           Date:   Wed Mar 16 15:08:22 2022 +0000
55594
55595               gdb/mi: consistently notify user when GDB/MI client uses -thread-select
55596
55597         Changes were made to GDB to address some inconsistencies in when
55598         notifications are sent from a MI terminal to a CLI terminal (when
55599         multiple terminals are in use, see new-ui command).
55600
55601         Unfortunately, in order to track when the currently selected frame has
55602         changed, that commit grabs a frame_info pointer before and after an MI
55603         command has executed, and compares the pointers to see if the frame
55604         has changed.
55605
55606         This is not safe.
55607
55608         If the frame cache is deleted for any reason then the frame_info
55609         pointer captured before the command started, is no longer valid, and
55610         any comparisons based on that pointer are undefined.
55611
55612         This was leading to random test failures for some folk, see:
55613
55614           https://sourceware.org/pipermail/gdb-patches/2022-March/186867.html
55615
55616         This commit changes GDB so we no longer hold frame_info pointers, but
55617         instead store the frame_id and frame_level, this is safe even when the
55618         frame cache is flushed.
55619
55620 2022-03-29  Jan Beulich  <jbeulich@suse.com>
55621
55622         bfd/Dwarf2: gas doesn't mangle names
55623         Include the language identifier emitted by gas in the set of ones where
55624         no mangled names are expected. Even if there could be "hand-mangled"
55625         names, gas doesn't emit DW_AT_linkage_name in the first place.
55626
55627         bfd/Dwarf2: make find-nearest-line returned function name consistent
55628         Prior to entering the enclosing "else if()" the earlier associated if()
55629         checks function->is_linkage and, if set, uses function->name. The
55630         comment in patch context precedes (and explains) the setting
55631         function->is_linkage. Yet with the flag set, we should then also return
55632         the function name, just like said earlier if() would do when we came
55633         here a 2nd time for the same "addr". And indeed passing the same address
55634         twice on addr2line's command line would resolve the function for the 2nd
55635         instance, but not for the 1st (if this code path is taken). (This,
55636         obviously, is particularly relevant when there's no ELF symbol table in
55637         the first place, like would be the case - naturally - in PE/COFF
55638         binaries, for example.)
55639
55640         gas/Dwarf: special-case .linefile only for macros
55641         Restrict the PR gas/16908 workaround to just macros, matching the
55642         original intention as well as the comment there. For constructs like
55643         .irp or .rept the reasoning doesn't apply, as there's no separate
55644         "invocation" point which may be of interest to record (for, as said
55645         there, short macros).
55646
55647 2022-03-29  Jan Beulich  <jbeulich@suse.com>
55648
55649         RISC-V: correct FCVT.Q.L[U]
55650         While the spec isn't explicit about this, it pointing out the similarity
55651         with the D extension ought to extend to the ignoring of a meaningless
55652         rounding mode: "Note FCVT.D.W[U] always produces an exact result and is
55653         unaffected by rounding mode." Hence the chosen encodings also ought to
55654         match.
55655
55656         Note that to avoid breaking existing code the forms with a 3rd operand
55657         are not removed, which means there continues to be a difference to
55658         FCVT.D.W[U].
55659
55660 2022-03-29  Mike Frysinger  <vapier@gentoo.org>
55661
55662         sim: add arch/.gdbinit stub scripts
55663         Make it easy to load the common gdbinit script even when running in
55664         the arch/ subdir instead of the top-level sim dir.
55665
55666 2022-03-29  Alan Modra  <amodra@gmail.com>
55667
55668         asan: heap buffer overflow in pa_chk_field_selector
55669         The buffer overflow showed up running the gas "all macro" test.
55670
55671                 PR 29005
55672                 * config/tc-hppa.c (pa_chk_field_selector): Don't read past end
55673                 of line.
55674
55675 2022-03-29  GDB Administrator  <gdbadmin@sourceware.org>
55676
55677         Automatic date update in version.in
55678
55679 2022-03-28  Tom Tromey  <tom@tromey.com>
55680
55681         Add Rust parser check for end of expression
55682         I noticed that "print 5," passed in Rust -- the parser wasn't checking
55683         that the entire input was used.  This patch fixes the problem.  This
55684         in turn pointed out another bug in the parser, namely that it didn't
55685         lex the next token after handling a string token.  This is also fixed
55686         here.
55687
55688 2022-03-28  Tom Tromey  <tom@tromey.com>
55689
55690         Switch gdb_stdlog to use timestamped_file
55691         Currently, timestamps for logging are done by looking for the use of
55692         gdb_stdlog in vfprintf_unfiltered.  This seems potentially buggy, in
55693         that during logging or other redirects (like execute_fn_to_ui_file) we
55694         might have gdb_stdout==gdb_stdlog and so, conceivably, wind up with
55695         timestamps in a log when they were not desired.
55696
55697         It seems better, instead, for timestamps to be a property of the
55698         ui_file itself.
55699
55700         This patch changes gdb to use the new timestamped_file for gdb_stdlog
55701         where appropriate, and removes the special case from
55702         vfprintf_unfiltered.
55703
55704         Note that this may somewhat change the output in some cases -- in
55705         particular, when going through execute_fn_to_ui_file (or the _string
55706         variant), timestamps won't be emitted.  This could be fixed in those
55707         functions, but it wasn't clear to me whether this is really desirable.
55708
55709         Note also that this changes the TUI to send gdb_stdlog to gdb_stderr.
55710         I imagine that the previous use of gdb_stdout here was inadvertent.
55711         (And in any case it probably doesn't matter.)
55712
55713 2022-03-28  Tom Tromey  <tom@tromey.com>
55714
55715         Add new timestamped_file class
55716         This adds a "timestamped_file" subclass of ui_file.  This class adds a
55717         timestamp to its output when appropriate.  That is, it follows the
55718         rule already used in vfprintf_unfiltered of adding a timestamp at most
55719         once per write.
55720
55721         The new class is not yet used.
55722
55723 2022-03-28  Tom Tromey  <tom@tromey.com>
55724
55725         Use unique_ptr in CLI logging code
55726         This changes the CLI logging code to avoid manual memory management
55727         (to the extent possible) by using unique_ptr in a couple of spots.
55728         This will come in handy in a later patch.
55729
55730 2022-03-28  Tom Tromey  <tom@tromey.com>
55731
55732         Simplify the CLI set_logging logic
55733         The CLI's set_logging logic seemed unnecessarily complicated to me.
55734         This patch simplifies it, with an eye toward changing it to use RAII
55735         objects in a subsequent patch.
55736
55737         I did not touch the corresponding MI code.  That code seems incorrect
55738         (nothing ever uses raw_stdlog, and nothing ever sets
55739         saved_raw_stdlog).  I didn't attempt to fix this, because I question
55740         whether this is even useful for MI.
55741
55742 2022-03-28  Tom Tromey  <tromey@adacore.com>
55743
55744         Handle multiple addresses in call_site_target
55745         A large customer program has a function that is partitioned into hot
55746         and cold parts.  A variable in a callee of this function is described
55747         using DW_OP_GNU_entry_value, but gdb gets confused when trying to find
55748         the caller.  I tracked this down to dwarf2_get_pc_bounds interpreting
55749         the function's changes so that the returned low PC is the "wrong"
55750         function.
55751
55752         Intead, when processing DW_TAG_call_site, the low PC of each range in
55753         DW_AT_ranges should be preserved in the call_site_target.  This fixes
55754         the variable lookup in the test case I have.
55755
55756         I didn't write a standalone test for this as it seemed excessively
55757         complicated.
55758
55759 2022-03-28  Tom Tromey  <tromey@adacore.com>
55760
55761         Change call_site_target to iterate over addresses
55762         In order to handle the case where a call site target might refer to
55763         multiple addresses, we change the code to use a callback style.  Any
55764         spot using call_site_target::address now passes in a callback function
55765         that may be called multiple times.
55766
55767 2022-03-28  Tom Tromey  <tromey@adacore.com>
55768
55769         Change call_site_find_chain_1 to work recursively
55770         call_site_find_chain_1 has a comment claiming that recursive calls
55771         would be too expensive.  However, I doubt this is so expensive; and
55772         furthermore the explicit state management approach here is difficult
55773         both to understand and to modify.  This patch changes this code to use
55774         explicit recursion, so that a subsequent patch can generalize this
55775         code without undue trauma.
55776
55777         Additionally, I think this patch detects a latent bug in the recursion
55778         code.  (It's hard for me to be completely certain.)  The bug is that
55779         when a new target_call_site is entered, the code does:
55780
55781                   if (target_call_site)
55782                     {
55783                       if (addr_hash.insert (target_call_site->pc ()).second)
55784                         {
55785                           /* Successfully entered TARGET_CALL_SITE.  */
55786
55787                           chain.push_back (target_call_site);
55788                           break;
55789                         }
55790                     }
55791
55792         Here, if entering the target_call_site fails, then any tail_call_next
55793         elements in this call site are not visited.  However, if this code
55794         does happen to enter a call site, then the tail_call_next elements
55795         will be visited during backtracking.  This applies when doing the
55796         backtracking as well -- it will only continue through a given chain as
55797         long as each element in the chain can successfully be visited.
55798
55799         I'd appreciate some review of this.  If this behavior is intentional,
55800         it can be added to the new implementation.
55801
55802 2022-03-28  Tom Tromey  <tromey@adacore.com>
55803
55804         Constify chain_candidate
55805         While investigating this bug, I wasn't sure if chain_candidate might
55806         update 'chain'.  I changed it to accept a const reference, making it
55807         clear that it cannot.  This simplifies the code a tiny bit as well.
55808
55809         Make call_site_target members private
55810         This makes the data members of call_site_target 'private'.  This lets
55811         us remove most of its public API.  call_site_to_target_addr is changed
55812         to be a method of this type.  This is a preparatory refactoring for
55813         the fix at the end of this series.
55814
55815         Change call_site_target to use custom type and enum
55816         call_site_target reuses field_loc_kind and field_location.  However,
55817         it has never used the full range of the field_loc_kind enum.  In a
55818         subsequent patch, I plan to add a new 'kind' here, so it seemed best
55819         to avoid this reuse and instead introduce new types here.
55820
55821 2022-03-28  GDB Administrator  <gdbadmin@sourceware.org>
55822
55823         Automatic date update in version.in
55824
55825 2022-03-27  GDB Administrator  <gdbadmin@sourceware.org>
55826
55827         Automatic date update in version.in
55828
55829 2022-03-26  Tom Tromey  <tom@tromey.com>
55830
55831         Remove an unused declaration from value.h
55832         value.h has a declaration of value_print_array_elements that is
55833         incorrect.  In C, this would have been an error, but in C++ this is a
55834         declaration of an overload that is neither defined nor used.  This
55835         patch removes the declaration.
55836
55837 2022-03-26  GDB Administrator  <gdbadmin@sourceware.org>
55838
55839         Automatic date update in version.in
55840
55841 2022-03-25  Nick Alcock  <nick.alcock@oracle.com>
55842
55843         libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case
55844         My previous nm patch handled all cases but one -- if the user set NM in
55845         the environment to a path which contained an option, libtool's nm
55846         detection tries to run nm against a copy of nm with the options in it:
55847         e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
55848         test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
55849         This is unlikely to be desirable: in this case we should run
55850         "/usr/bin/nm --blargle /usr/bin/nm".
55851
55852         Furthermore, as part of this nm has to detect when the passed-in $NM
55853         contains a path, and in that case avoid doing a path search itself.
55854         This too was thrown off if an option contained something that looked
55855         like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
55856         "nm -B../prev-gcc nm" which rarely works well (and indeed it looks
55857         to see whether that nm exists, finds it doesn't, and wrongly concludes
55858         that nm -p or whatever does not work).
55859
55860         Fix all of these by clipping all options (defined as everything
55861         including and after the first " -") before deciding whether nm
55862         contains a path (but not using the clipped value for anything else),
55863         and then removing all options from the path-modified nm before
55864         looking to see whether that nm existed.
55865
55866         NM=my-nm now does a path search and runs e.g.
55867           /usr/bin/my-nm -B /usr/bin/my-nm
55868
55869         NM=/usr/bin/my-nm now avoids a path search and runs e.g.
55870           /usr/bin/my-nm -B /usr/bin/my-nm
55871
55872         NM="my-nm -p../wombat" now does a path search and runs e.g.
55873           /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm
55874
55875         NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
55876           ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm
55877
55878         This seems to be all combinations, including those used by GCC bootstrap
55879         (which, before this commit, fails to bootstrap when configured
55880         --with-build-config=bootstrap-lto, because the lto plugin is now using
55881         --export-symbols-regex, which requires libtool to find a working nm,
55882         while also using -B../prev-gcc to point at the lto plugin associated
55883         with the GCC just built.)
55884
55885         Regenerate all affected configure scripts.
55886
55887                 * libtool.m4 (LT_PATH_NM): Handle user-specified NM with
55888                 options, including options containing paths.
55889
55890 2022-03-25  Alan Modra  <amodra@gmail.com>
55891
55892         Re: gas/Dwarf: improve debug info generation from .irp and alike blocks
55893         am33_2.0-linux is a mn10300 target.
55894
55895                 * testsuite/gas/elf/dwarf-5-irp.d: xfail am33.
55896
55897 2022-03-25  GDB Administrator  <gdbadmin@sourceware.org>
55898
55899         Automatic date update in version.in
55900
55901 2022-03-24  Aaron Merey  <amerey@redhat.com>
55902
55903         Remove download size from debuginfod progress messages if unavailable
55904         Currently debuginfod progress update messages include the size of
55905         each download:
55906
55907           Downloading 7.5 MB separate debug info for /lib/libxyz.so.0
55908
55909         This value originates from the Content-Length HTTP header of the
55910         transfer.  However this header is not guaranteed to be present for
55911         each download.  This can happen when debuginfod servers compress files
55912         on-the-fly at the time of transfer.  In this case gdb wrongly prints
55913         "-0.00 MB" as the size.
55914
55915         This patch removes download sizes from progress messages when they are
55916         not available.  It also removes usage of the progress bar until
55917         a more thorough reworking of progress updating is implemented. [1]
55918
55919         [1] https://sourceware.org/pipermail/gdb-patches/2022-February/185798.html
55920
55921 2022-03-24  Reuben Thomas  <rrt@sc3d.org>
55922
55923         sim: fix a comment typo in sim-load.c
55924         Fix a typo where the documentation refers to a function parameter by the
55925         wrong name.
55926
55927         Change-Id: I99494efe62cd4aa76fb78a0bd5da438d35740ebe
55928
55929 2022-03-24  Reuben Thomas  <rrt@sc3d.org>
55930
55931         sim: fix “alligned” typos
55932         Change-Id: Ifd574e38524dd4f1cf0fc003e0c5c7499abc84a0
55933
55934 2022-03-24  Jan Beulich  <jbeulich@suse.com>
55935
55936         x86: mention dropped L1OM/K1OM support in ld/ as well
55937         This amends e961c696dcb2 ("x86: drop L1OM/K1OM support from ld"). Also
55938         remove the marker that I mistakenly added in c085ab00c7b2 ("x86: drop
55939         L1OM/K1OM support from gas").
55940
55941 2022-03-24  Simon Marchi  <simon.marchi@efficios.com>
55942
55943         gdb/testsuite: remove gdb.python/pretty-print-call-by-hand.exp
55944         This test was added without a corresponding fix, with some setup_kfails.
55945         However, it results in UNRESOLVED results when GDB is built with ASan.
55946
55947           ERROR: GDB process no longer exists
55948           GDB process exited with wait status 1946871 exp7 0 1
55949           UNRESOLVED: gdb.python/pretty-print-call-by-hand.exp: frame print: backtrace test (PRMS gdb/28856)
55950
55951         Remove the test from the tree, I'll attach it to the Bugzilla bug
55952         instead [1].
55953
55954         [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28856
55955
55956         Change-Id: Id95d8949fb8742874bd12aeac758aa4d7564d678
55957
55958 2022-03-24  Jan Beulich  <jbeulich@suse.com>
55959
55960         x86: drop L1OM/K1OM support from ld
55961         This was only rudimentary support anyway; none of the sub-architecture
55962         specific insns were ever supported.
55963
55964         x86: drop L1OM special case from disassembler
55965         There wasn't any real support anyway: None of the sub-architecture
55966         specific insns were ever supported.
55967
55968 2022-03-24  Jan Beulich  <jbeulich@suse.com>
55969
55970         MAINTAINERS: add myself
55971         I much appreciate Nick offering this role to me. Nevertheless there's
55972         still a lot for me to learn here.
55973
55974         At this occasion also update my email address in the pre-existing, much
55975         more narrow entry.
55976
55977 2022-03-24  GDB Administrator  <gdbadmin@sourceware.org>
55978
55979         Automatic date update in version.in
55980
55981 2022-03-23  Andrew Burgess  <aburgess@redhat.com>
55982
55983         gdb/testsuite: address test failures in gdb.mi/mi-multi-commands.exp
55984         The gdb.mi/mi-multi-commands.exp test was added in commit:
55985
55986           commit d08cbc5d3203118da5583296e49273cf82378042
55987           Date:   Wed Dec 22 12:57:44 2021 +0000
55988
55989               gdb: unbuffer all input streams when not using readline
55990
55991         And then tweaked in commit:
55992
55993           commit 144459531dd68a1287905079aaa131b777a8cc82
55994           Date:   Mon Feb 7 20:35:58 2022 +0000
55995
55996               gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp test
55997
55998         The second of these commits was intended to address periodic test
55999         failures that I was seeing, and this change did fix some problems,
56000         but, unfortunately, introduced other issues.
56001
56002         The problem is that the test relies on sending two commands to GDB in
56003         a single write.  As the characters that make these two commands arrive
56004         they are echoed to GDB's console.  However, there is a race between
56005         how quickly the characters are echoed and how quickly GDB decides to
56006         act on the incoming commands.
56007
56008         Usually, both commands are echoed in full before GDB acts on the first
56009         command, but sometimes this is not the case, and GDB can execute the
56010         first command before both commands are fully echoed to the console.
56011         In this case, the output of the first command will be mixed in with
56012         the echoing of the second command.
56013
56014         This mixing of the command echoing and the first command output is
56015         what was causing failures in the original version of the test.
56016
56017         The second commit relaxed the expected output pattern a little, but
56018         was still susceptible to failures, so this commit further relaxes the
56019         pattern.
56020
56021         Now, we look for the first command output with no regard to what is
56022         before, or after the command.  Then we look for the first mi prompt to
56023         indicate that the first command has completed.
56024
56025         I believe that this change should make the test more stable than it
56026         was before.
56027
56028 2022-03-23  Nick Alcock  <nick.alcock@oracle.com>
56029
56030         libctf: add LIBCTF_WRITE_FOREIGN_ENDIAN debugging option
56031         libctf has always handled endianness differences by detecting
56032         foreign-endian CTF dicts on the input and endian-flipping them: dicts
56033         are always written in native endianness.  This makes endian-awareness
56034         very low overhead, but it means that the foreign-endian code paths
56035         almost never get routinely tested, since "make check" usually reads in
56036         dicts ld has just written out: only a few corrupted-CTF tests are
56037         actually in fixed endianness, and even they only test the foreign-
56038         endian code paths when you run make check on a big-endian machine.
56039         (And the fix is surely not to add more .s-based tests like that, because
56040         they are a nightmare to maintain compared to the C-code-based ones.)
56041
56042         To improve on this, add a new environment variable,
56043         LIBCTF_WRITE_FOREIGN_ENDIAN, which causes libctf to unconditionally
56044         endian-flip at ctf_write time, so the output is always in the wrong
56045         endianness.  This then tests the foreign-endian read paths properly
56046         at open time.
56047
56048         Make this easier by restructuring the writeout code in ctf-serialize.c,
56049         which duplicates the maybe-gzip-and-write-out code three times (once
56050         for ctf_write_mem, with thresholding, and once each for
56051         ctf_compress_write and ctf_write just so those can avoid thresholding
56052         and/or compression).  Instead, have the latter two call the former
56053         with thresholds of 0 or (size_t) -1, respectively.
56054
56055         The endian-flipping code itself gains a bit of complexity, because
56056         one single endian-flipper (flip_types) was assuming the input to be
56057         in foreign-endian form and assuming it could pull things out of the
56058         input once they had been flipped and make sense of them. At the
56059         cost of a few lines of duplicated initializations, teach it to
56060         read before flipping if we're flipping to foreign-endianness instead
56061         of away from it.
56062
56063         libctf/
56064                 * ctf-impl.h (ctf_flip_header): No longer static.
56065                 (ctf_flip): Likewise.
56066                 * ctf-open.c (flip_header): Rename to...
56067                 (ctf_flip_header): ... this, now it is not private to one file.
56068                 (flip_ctf): Rename...
56069                 (ctf_flip): ... this too.  Add FOREIGN_ENDIAN arg.
56070                 (flip_types): Likewise.  Use it.
56071                 (ctf_bufopen_internal): Adjust calls.
56072                 * ctf-serialize.c (ctf_write_mem): Add flip_endian path via
56073                 a newly-allocated bounce buffer.
56074                 (ctf_compress_write): Move below ctf_write_mem and reimplement
56075                 in terms of it.
56076                 (ctf_write): Likewise.
56077                 (ctf_gzwrite): Note that this obscure writeout function does not
56078                 support endian-flipping.
56079
56080 2022-03-23  Nick Alcock  <nick.alcock@oracle.com>
56081
56082         libctf, ld: diagnose corrupted CTF header cth_strlen
56083         The last section in a CTF dict is the string table, at an offset
56084         represented by the cth_stroff header field.  Its length is recorded in
56085         the next field, cth_strlen, and the two added together are taken as the
56086         size of the CTF dict.  Upon opening a dict, we check that none of the
56087         header offsets exceed this size, and we check when uncompressing a
56088         compressed dict that the result of the uncompression is the same length:
56089         but CTF dicts need not be compressed, and short ones are not.
56090         Uncompressed dicts just use the ctf_size without checking it.  This
56091         field is thankfully almost unused: it is mostly used when reserializing
56092         a dict, which can't be done to dicts read off disk since they're
56093         read-only.
56094
56095         However, when opening an uncompressed foreign-endian dict we have to
56096         copy it out of the mmaped region it is stored in so we can endian-
56097         swap it, and we use ctf_size when doing that.  When the cth_strlen is
56098         corrupt, this can overrun.
56099
56100         Fix this by checking the ctf_size in all uncompressed cases, just as we
56101         already do in the compressed case.  Add a new test.
56102
56103         This came to light because various corrupted-CTF raw-asm tests had an
56104         incorrect cth_strlen: fix all of them so they produce the expected
56105         error again.
56106
56107         libctf/
56108                 PR libctf/28933
56109                 * ctf-open.c (ctf_bufopen_internal): Always check uncompressed
56110                 CTF dict sizes against the section size in case the cth_strlen is
56111                 corrupt.
56112
56113         ld/
56114                 PR libctf/28933
56115                 * testsuite/ld-ctf/diag-strlen-invalid.*: New test,
56116                 derived from diag-cttname-invalid.s.
56117                 * testsuite/ld-ctf/diag-cttname-invalid.s: Fix incorrect cth_strlen.
56118                 * testsuite/ld-ctf/diag-cttname-null.s: Likewise.
56119                 * testsuite/ld-ctf/diag-cuname.s: Likewise.
56120                 * testsuite/ld-ctf/diag-parlabel.s: Likewise.
56121                 * testsuite/ld-ctf/diag-parname.s: Likewise.
56122
56123 2022-03-23  Nick Alcock  <nick.alcock@oracle.com>
56124
56125         include, libctf, ld: extend variable section to contain functions too
56126         The CTF variable section is an optional (usually-not-present) section in
56127         the CTF dict which contains name -> type mappings corresponding to data
56128         symbols that are present in the linker input but not in the output
56129         symbol table: the idea is that programs that use their own symbol-
56130         resolution mechanisms can use this section to look up the types of
56131         symbols they have found using their own mechanism.
56132
56133         Because these removed symbols (mostly static variables, functions, etc)
56134         all have names that are unlikely to appear in the ELF symtab and because
56135         very few programs have their own symbol-resolution mechanisms, a special
56136         linker flag (--ctf-variables) is needed to emit this section.
56137
56138         Historically, we emitted only removed data symbols into the variable
56139         section.  This seemed to make sense at the time, but in hindsight it
56140         really doesn't: functions are symbols too, and a C program can look them
56141         up just like any other type.  So extend the variable section so that it
56142         contains all static function symbols too (if it is emitted at all), with
56143         types of kind CTF_K_FUNCTION.
56144
56145         This is a little fiddly.  We relied on compiler assistance for data
56146         symbols: the compiler simply emits all data symbols twice, once into the
56147         symtypetab as an indexed symbol and once into the variable section.
56148
56149         Rather than wait for a suitably adjusted compiler that does the same for
56150         function symbols, we can pluck unreported function symbols out of the
56151         symtab and add them to the variable section ourselves.  While we're at
56152         it, we do the same with data symbols: this is redundant right now
56153         because the compiler does it, but it costs very little time and lets the
56154         compiler drop this kludge and save a little space in .o files.
56155
56156         include/
56157                 * ctf.h: Mention the new things we can see in the variable
56158                 section.
56159
56160         ld/
56161                 * testsuite/ld-ctf/data-func-conflicted-vars.d: New test.
56162
56163         libctf/
56164                 * ctf-link.c (ctf_link_deduplicating_variables): Duplicate
56165                 symbols into the variable section too.
56166                 * ctf-serialize.c (symtypetab_delete_nonstatic_vars): Rename
56167                 to...
56168                 (symtypetab_delete_nonstatics): ... this.  Check the funchash
56169                 when pruning redundant variables.
56170                 (ctf_symtypetab_sect_sizes): Adjust accordingly.
56171                 * NEWS: Describe this change.
56172
56173 2022-03-23  Nick Alcock  <nick.alcock@oracle.com>
56174
56175         ld, testsuite: improve CTF-availability test
56176         The test for -gctf support in the compiler is used to determine when to
56177         run the ld-ctf tests and most of those in libctf.  Unfortunately,
56178         because it uses check_compiler_available and compile_one_cc, it will
56179         fail whenever the compiler emits anything on stderr, even if it
56180         actually does support CTF perfectly well.
56181
56182         So, instead, ask the compiler to emit assembler output and grep it for
56183         references to ".ctf": this is highly unlikely to be present if the
56184         compiler does not support CTF.  (This will need adjusting when CTF grows
56185         support for non-ELF platforms that don't dot-prepend their section
56186         names, but right now the linker doesn't link CTF on any such platforms
56187         in any case.)
56188
56189         With this in place we can do things like run all the libctf tests under
56190         leak sanitizers etc even if those spray warnings on simple CTF
56191         compilations, rather than being blocked from doing so just when we would
56192         most like to.
56193
56194         ld/
56195                 * testsuite/lib/ld-lib.exp (check_ctf_available): detect CTF
56196                 even if a CTF-capable compiler emits warnings.
56197
56198 2022-03-23  Simon Marchi  <simon.marchi@efficios.com>
56199
56200         gdb/python: remove Python 2/3 compatibility macros
56201         New in this version:
56202
56203          - Rebase on master, fix a few more issues that appeared.
56204
56205         python-internal.h contains a number of macros that helped make the code
56206         work with both Python 2 and 3.  Remove them and adjust the code to use
56207         the Python 3 functions.
56208
56209         Change-Id: I99a3d80067fb2d65de4f69f6473ba6ffd16efb2d
56210
56211 2022-03-23  Simon Marchi  <simon.marchi@polymtl.ca>
56212
56213         gdb/python: remove Python 2 support
56214         New in this version:
56215
56216          - Add a PY_MAJOR_VERSION check in configure.ac / AC_TRY_LIBPYTHON.  If
56217            the user passes --with-python=python2, this will cause a configure
56218            failure saying that GDB only supports Python 3.
56219
56220         Support for Python 2 is a maintenance burden for any patches touching
56221         Python support.  Among others, the differences between Python 2 and 3
56222         string and integer types are subtle.  It requires a lot of effort and
56223         thinking to get something that behaves correctly on both.  And that's if
56224         the author and reviewer of the patch even remember to test with Python
56225         2.
56226
56227         See this thread for an example:
56228
56229           https://sourceware.org/pipermail/gdb-patches/2021-December/184260.html
56230
56231         So, remove Python 2 support.  Update the documentation to state that GDB
56232         can be built against Python 3 (as opposed to Python 2 or 3).
56233
56234         Update all the spots that use:
56235
56236          - sys.version_info
56237          - IS_PY3K
56238          - PY_MAJOR_VERSION
56239          - gdb_py_is_py3k
56240
56241         ... to only keep the Python 3 portions and drop the use of some
56242         now-removed compatibility macros.
56243
56244         I did not update the configure script more than just removing the
56245         explicit references to Python 2.  We could maybe do more there, like
56246         check the Python version and reject it if that version is not
56247         supported.  Otherwise (with this patch), things will only fail at
56248         compile time, so it won't really be clear to the user that they are
56249         trying to use an unsupported Python version.  But I'm a bit lost in the
56250         configure code that checks for Python, so I kept that for later.
56251
56252         Change-Id: I75b0f79c148afbe3c07ac664cfa9cade052c0c62
56253
56254 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56255
56256         x86: reject relocations involving registers
56257         To prevent fatal or even internal errors, add a simple check to
56258         i386_validate_fix(), rejecting relocations when their target symbol is
56259         an equate of a register (or resolved to reg_section for any other
56260         reason).
56261
56262         x86: improve resolution of register equates
56263         Allow transitive (or recursive) equates to work in addition to direct
56264         ones. The only requirements are that
56265         - the equate being straight of a register, i.e. no expressions involved
56266           (albeit I'm afraid something like "%eax + 0" will be viewed as %eax),
56267         - at the point of use there's no forward ref left which cannot be
56268           resolved, yet.
56269
56270         Revert "PR28977 tc-i386.c internal error in parse_register"
56271         This reverts commit 5fac3f02edacfca458f7eeaaaa33a87e26e0e332,
56272         which was superceeded / replaced by 4faaa10f3fab.
56273
56274 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56275
56276         x86: don't attempt to resolve equates and alike from i386_parse_name()
56277         PR gas/28977
56278
56279         Perhaps right from its introduction in 4d1bb7955a8b it was wrong for
56280         i386_parse_name() to call parse_register(). This being a hook from the
56281         expression parser, it shouldn't be resolving e.g. equated symbols.
56282         That's relevant only for all other callers of parse_register().
56283
56284         To compensate, in Intel syntax mode check_register() needs calling;
56285         perhaps not doing so was an oversight right when the function was
56286         introduced. This is necessary in particular to force EVEX encoding when
56287         VRex registers are used (but of course also to reject bad uses of
56288         registers, i.e. fully matching what parse_register() needs it for).
56289
56290 2022-03-23  Luis Machado  <luis.machado@arm.com>
56291
56292         Update the list of recognized m-profile TAG_CPU_ARCH_*
56293         Check 3 additional variants previously not recognized:
56294
56295         - TAG_CPU_ARCH_V7E_M
56296         - TAG_CPU_ARCH_V8M_BASE
56297         - TAG_CPU_ARCH_V8M_MAIN
56298
56299 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56300
56301         gas/Dwarf5: re-use file 0 line string table entry when faking file 0
56302         No need to emit the same string a 2nd time for file 1 in this case.
56303
56304         gas/Dwarf5: adjust .debug_line file 0 checking
56305         First of all when a table entry has a NULL filename, the two inner if()s
56306         are better done the other way around: The 2nd doesn't depend on what the
56307         first does. This then renders redundant half of the conditions of the
56308         other if() and clarifies that subsequently only entry 0 is dealt with
56309         (indicating that part of the comment was wrong). Finally for there to be
56310         a usable name in slot 1, files_in_use needs to be larger than 1 and slot
56311         1's (rather than slot 0's) name needs to be non-NULL.
56312
56313 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56314
56315         gas/Dwarf5: drop dead code
56316         Commit 3417bfca676f ("GAS: DWARF-5: Ensure that the 0'th entry in the
56317         directory table contains the current... ") added a "dwarf_level < 5"
56318         check to out_dir_and_file_list(). This rendered dead that branch of the
56319         construct, due to the enclosing if()'s "DWARF2_LINE_VERSION >= 5".
56320         Delete that code as well as the corresponding part of the comment.
56321
56322         While there also drop a redundant "dirs != NULL": "dirs" will always be
56323         non-NULL when dirs_in_use is not zero.
56324
56325 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56326
56327         gas/Dwarf: improve debug info generation from .irp and alike blocks
56328         Tying the bumping of the logical line number to reading from the
56329         original source file looks wrong: Upon finishing of the processing of an
56330         sb the original values will be restored anyway. Yet without bumping the
56331         line counter uses of .line inside e.g. an .irp construct won't have the
56332         intended effect: Such uses may be necessary to ensure proper debug info
56333         is emitted in particular when switching sections inside the .irp body,
56334         as dwarf2_gen_line_info() would bail without doing anything when it
56335         finds the line number unchanged from what it saw last.
56336
56337 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56338
56339         ELF32: don't silently truncate relocation addends
56340         At least x86-64's x32 sub-mode and RISC-V's 32-bit mode calculate
56341         addends as 64-bit values, but store them in signed 32-bit fields when
56342         generating the file without encountering any earlier error. When the
56343         relocated field is a 64-bit one, the value resulting after processing
56344         the relocation record when linking (or the latest when loading) may
56345         thus be wrong due to the truncation.
56346
56347         With the code change in place, one x32 testcase actually triggers the
56348         new diagnostic. That one case of too large a (negative) addend is being
56349         adjusted alongside the addition of a new testcase to actually trigger
56350         the new error. (Note that due to internal BFD behavior the relocation in
56351         .data doesn't get processed anymore after the errors in .text.)
56352
56353         Note that in principle it is possible to express 64-bit relocations in
56354         ELF32, but this would require .rel relocations, i.e. with the addend
56355         stored in the 64-bit field being relocated. But I guess it would be a
56356         lot of effort for little gain to actually support this.
56357
56358 2022-03-23  Jan Beulich  <jbeulich@suse.com>
56359
56360         gas: retain whitespace between strings
56361         Macro arguments may be separated by commas or just whitespace. Macro
56362         arguments may also be quoted (where one level of quotes is removed in
56363         the course of determining the values for the respective formal
56364         parameters). Furthermore this quote removal knows _two_ somewhat odd
56365         escaping mechanisms: One, apparently in existence forever, is that a
56366         pair of quotes counts as the escaping of a quote, with the pair being
56367         transformed to a single quote in the course of quote removal. The other
56368         (introduced by c06ae4f232e6) looks more usual on the surface in that it
56369         deals with \" sequences, but it _retains_ the escaping \. Hence only the
56370         former mechanism is suitable when the value to be used by the macro body
56371         is to contain a quote. Yet this results in ambiguity of what "a""b" is
56372         intended to mean; elsewhere (e.g. for .ascii) it represents two
56373         successive string literals. However, in any event is the above different
56374         from "a" "b": I don't think this can be viewed the same as "a""b" when
56375         processing macro arguments.
56376
56377         Change the scrubber to retain such whitespace, by making the processing
56378         of strings more similar to that of symbols. And indeed this appears to
56379         make sense when taking into account that for quite a while gas has been
56380         supporting quoted symbol names.
56381
56382         Taking a more general view, however, the change doesn't go quite far
56383         enough. There are further cases where significant whitespace is removed
56384         by the scrubber. The new testcase enumerates a few in its ".if 0"
56385         section. I'm afraid the only way that I see to deal with this would be
56386         to significantly simplify the scrubber, such that it wouldn't do much
56387         more than collapse sequences of unquoted whitespace into a single blank.
56388         To be honest problems in this area aren't really surprising when seeing
56389         that there's hardly any checking of .macro use throughout the testsuite
56390         (and in particular in the [relatively] generic tests under all/).
56391
56392 2022-03-23  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
56393
56394         Only .so files are used in libcollector. Remove the other files.
56395                 * libcollector/Makefile.am (install-data-local): Remove the *.la
56396                 and *.a libraries.
56397                 * libcollector/Makefile.in: Regenerate.
56398
56399 2022-03-23  Tiezhu Yang  <yangtiezhu@loongson.cn>
56400
56401         gdb: testsuite: use gdb_attach to fix jit-elf.exp
56402         If /proc/sys/kernel/yama/ptrace_scope is 1, when execute the following
56403         command without superuser:
56404
56405           make check-gdb TESTS="gdb.base/jit-elf.exp"
56406
56407         we can see the following messages in gdb/testsuite/gdb.log:
56408
56409           (gdb) attach 1650108
56410           Attaching to program: /home/yangtiezhu/build/gdb/testsuite/outputs/gdb.base/jit-elf/jit-elf-main, process 1650108
56411           ptrace: Operation not permitted.
56412           (gdb) FAIL: gdb.base/jit-elf.exp: attach: one_jit_test-2: break here 1: attach
56413
56414         use gdb_attach to fix the above issue, at the same time, the clean_reattach
56415         proc should return a value to indicate whether it worked, and the callers
56416         should return early as well on failure.
56417
56418 2022-03-23  Tiezhu Yang  <yangtiezhu@loongson.cn>
56419
56420         gdb: testsuite: use gdb_attach to fix attach-pie-noexec.exp
56421         If /proc/sys/kernel/yama/ptrace_scope is 1, when execute the following
56422         command without superuser:
56423
56424           make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"
56425
56426         we can see the following messages in gdb/testsuite/gdb.log:
56427
56428           (gdb) attach 6500
56429           Attaching to process 6500
56430           ptrace: Operation not permitted.
56431           (gdb) PASS: gdb.base/attach-pie-noexec.exp: attach
56432
56433         It is obviously wrong, the expected result should be UNSUPPORTED in such
56434         a case.
56435
56436         With this patch, we can see "Operation not permitted" in the log info,
56437         and then we can do the following processes to test:
56438         (1) set ptrace_scope as 0
56439             $ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
56440             $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"
56441         (2) use sudo
56442             $ sudo make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"
56443
56444 2022-03-23  Tiezhu Yang  <yangtiezhu@loongson.cn>
56445
56446         gdb: testsuite: add new gdb_attach to check "attach" command
56447         This commit adds new gdb_attach to centralize the failure checking of
56448         "attach" command. Return 0 if attach failed, otherwise return 1.
56449
56450 2022-03-23  Tiezhu Yang  <yangtiezhu@loongson.cn>
56451
56452         gdb: testsuite: remove attach test from can_spawn_for_attach
56453         As Pedro Alves said, caching procs should not issue pass/fail [1],
56454         this commit removes attach test from can_spawn_for_attach, at the
56455         same time, use "verbose -log" instead of "unsupported" to get a
56456         trace about why a test run doesn't support spawning for attach.
56457
56458         [1] https://sourceware.org/pipermail/gdb-patches/2022-March/186311.html
56459
56460 2022-03-23  GDB Administrator  <gdbadmin@sourceware.org>
56461
56462         Automatic date update in version.in
56463
56464 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56465
56466         Add support for hardware breakpoints/watchpoints on FreeBSD/Aarch64.
56467         This shares aarch64-nat.c and nat/aarch64-hw-point.c with the Linux
56468         native target.  Since FreeBSD writes all of the debug registers in one
56469         ptrace op, use an unordered_set<> to track the "dirty" state for
56470         threads rather than bitmasks of modified registers.
56471
56472         fbsd-nat: Add a low_prepare_to_resume virtual method.
56473         This method can be overridden by architecture-specific targets to
56474         perform additional work before a thread is resumed.
56475
56476 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56477
56478         fbsd-nat: Add a low_delete_thread virtual method.
56479         This method can be overridden by architecture-specific targets to
56480         perform additional work when a thread is deleted.
56481
56482         Note that this method is only invoked on systems supporting LWP
56483         events, but the pending use case (aarch64 debug registers) is not
56484         supported on older kernels that do not support LWP events.
56485
56486 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56487
56488         fbsd-nat: Add helper routine to fetch siginfo_t for a ptid.
56489
56490 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56491
56492         aarch64: Add an aarch64_nat_target mixin class.
56493         This class includes platform-independent target methods for hardware
56494         breakpoints and watchpoints using routines from
56495         nat/aarch64-hw-point.c.
56496
56497         stopped_data_address is not platform-independent since the FAR
56498         register holding the address for a breakpoint hit must be fetched in a
56499         platform-specific manner.  However, aarch64_stopped_data_address is
56500         provided as a helper routine which performs platform-independent
56501         validation given the value of the FAR register.
56502
56503         For tracking the per-process debug register mirror state, use an
56504         unordered_map indexed by pid as recently adopted in x86-nat.c rather
56505         than a manual linked-list.
56506
56507 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56508
56509         nat: Split out platform-independent aarch64 debug register support.
56510         Move non-Linux-specific support for hardware break/watchpoints from
56511         nat/aarch64-linux-hw-point.c to nat/aarch64-hw-point.c.  Changes
56512         beyond a simple split of the code are:
56513
56514         - aarch64_linux_region_ok_for_watchpoint and
56515           aarch64_linux_any_set_debug_regs_state renamed to drop linux_ as
56516           they are not platform specific.
56517
56518         - Platforms must implement the aarch64_notify_debug_reg_change
56519           function which is invoked from the platform-independent code when a
56520           debug register changes for a given debug register state.  This does
56521           not use the indirection of a 'low' structure as is done for x86.
56522
56523         - The handling for kernel_supports_any_contiguous_range is not
56524           pristine.  For non-Linux it is simply defined to true.  Some uses of
56525           this could perhaps be implemented as new 'low' routines for the
56526           various places that check it instead?
56527
56528         - Pass down ptid into aarch64_handle_breakpoint and
56529           aarch64_handle_watchpoint rather than using current_lwp_ptid which
56530           is only defined on Linux.  In addition, pass the ptid on to
56531           aarch64_notify_debug_reg_change instead of the unused state
56532           argument.
56533
56534 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56535
56536         x86-fbsd-nat: Copy debug register state on fork.
56537         Use the FreeBSD native target low_new_fork hook to copy the
56538         per-process debug state from the parent to the child on fork.
56539
56540         fbsd-nat: Add a low_new_fork virtual method.
56541         This method can be overridden by architecture-specific targets to
56542         perform additional work when a new child process is forked.
56543
56544 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56545
56546         Add an x86_fbsd_nat_target mixin class for FreeBSD x86 native targets.
56547         This class implements debug register support common between the i386
56548         and amd64 native targets.
56549
56550         While here, remove #ifdef's for HAVE_PT_GETDBREGS in FreeBSD-specific
56551         code.  The ptrace request has been present on FreeBSD x86
56552         architectures since 4.0 (released in March 2000).  The last FreeBSD
56553         release without this support is 3.5 released in June 2000.
56554
56555 2022-03-22  John Baldwin  <jhb@FreeBSD.org>
56556
56557         x86-nat: Add x86_lookup_debug_reg_state.
56558         This function returns nullptr if debug register state does not yet
56559         exist for a given process rather than creating new state.
56560
56561         x86-nat: Use an unordered_map to store per-pid debug reg state.
56562         This replaces a manual linked list which used O(n) lookup and removal.
56563
56564         Remove USE_SIGTRAP_SIGINFO condition for FreeBSD/x86 debug regs support.
56565         For BSD x86 targets, stopped_by_hw_breakpoint doesn't check siginfo_t
56566         but inspects the DR6 register directly via PT_GETDBREGS.
56567
56568 2022-03-22  Tom Tromey  <tom@tromey.com>
56569
56570         Remove two unused variables
56571         I found a couple of spots that declare a symtab_and_line but don't
56572         actually use it.  I think this probably isn't detected as unused
56573         because it has a constructor.
56574
56575 2022-03-22  Steiner H Gunderson  <steinar+sourceware@gunderson.no>
56576
56577         Fix return code in _bfd_dwarf2_find_nearest_line().
56578                 * dwarf2.c (_bfd_dwarf2_find_nearest_line): if a function name is
56579                 found, but no line number info, then return a result of 2.
56580
56581 2022-03-22  Andrew Burgess  <andrew.burgess@embecosm.com>
56582
56583         gdb/python: add gdb.format_address function
56584         Add a new function, gdb.format_address, which is a wrapper around
56585         GDB's print_address function.
56586
56587         This method takes an address, and returns a string with the format:
56588
56589           ADDRESS <SYMBOL+OFFSET>
56590
56591         Where, ADDRESS is the original address, formatted as hexadecimal,
56592         SYMBOL is a symbol with an address lower than ADDRESS, and OFFSET is
56593         the offset from SYMBOL to ADDRESS in decimal.
56594
56595         If there's no SYMBOL suitably close to ADDRESS then the
56596         <SYMBOL+OFFSET> part is not included.
56597
56598         This is useful if a user wants to write a Python script that
56599         pretty-prints addresses, the user no longer needs to do manual symbol
56600         lookup, or worry about correctly formatting addresses.
56601
56602         Additionally, there are some settings that effect how GDB picks
56603         SYMBOL, and whether the file name and line number should be included
56604         with the SYMBOL name, the gdb.format_address function ensures that the
56605         users Python script also benefits from these settings.
56606
56607         The gdb.format_address by default selects SYMBOL from the current
56608         inferiors program space, and address is formatted using the
56609         architecture for the current inferior.  However, a user can also
56610         explicitly pass a program space and architecture like this:
56611
56612           gdb.format_address(ADDRESS, PROGRAM_SPACE, ARCHITECTURE)
56613
56614         In order to format an address for a different inferior.
56615
56616         Notes on the implementation:
56617
56618         In py-arch.c I extended arch_object_to_gdbarch to add an assertion for
56619         the type of the PyObject being worked on.  Prior to this commit all
56620         uses of arch_object_to_gdbarch were guaranteed to pass this function a
56621         gdb.Architecture object, but, with this commit, this might not be the
56622         case.
56623
56624         So, with this commit I've made it a requirement that the PyObject be a
56625         gdb.Architecture, and this is checked with the assert.  And in order
56626         that callers from other files can check if they have a
56627         gdb.Architecture object, I've added the new function
56628         gdbpy_is_architecture.
56629
56630         In py-progspace.c I've added two new function, the first
56631         progspace_object_to_program_space, converts a PyObject of type
56632         gdb.Progspace to the associated program_space pointer, and
56633         gdbpy_is_progspace checks if a PyObject is a gdb.Progspace or not.
56634
56635 2022-03-22  Luis Machado  <luis.machado@arm.com>
56636
56637         Fix some stale header names from dwarf files
56638         Some of these references were not updated when they were moved to a separate
56639         directory.
56640
56641 2022-03-22  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
56642
56643         Install gprofng libraries under $(pkglibdir)
56644         gprofng/ChangeLog
56645         2022-03-21  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
56646
56647                 PR gprofng/28972
56648                 * gprofng/libcollector/Makefile.am: Rename lib_LTLIBRARIES to
56649                 pkglib_LTLIBRARIES. Add install-data-local.
56650                 * gprofng/src/Makefile.am: Likewise.
56651                 * gprofng/src/envsets.cc (putenv_libcollector_ld_misc): New location of
56652                 the gprofng libraries.
56653                 * gprofng/configure.ac: Removed an unused GPROFNG_LIBDIR.
56654                 * gprofng/Makefile.am: Removed an unused GPROFNG_LIBDIR.  Add
56655                 install-data-local.
56656                 * gprofng/configure: Regenerate.
56657                 * gprofng/Makefile.in: Likewise.
56658                 * gprofng/doc/Makefile.in: Likewise.
56659                 * gprofng/gp-display-htmllibcollector/Makefile.in: Likewise.
56660                 * gprofng/libcollector/Makefile.in: Likewise.
56661                 * gprofng/src/Makefile.in: Likewise.
56662
56663 2022-03-22  GDB Administrator  <gdbadmin@sourceware.org>
56664
56665         Automatic date update in version.in
56666
56667 2022-03-21  Roland McGrath  <mcgrathr@google.com>
56668
56669         gdb: Add missing #include in solib.h
56670         The gdb_bfd_ref_ptr type is used in solib.h declarations.
56671
56672 2022-03-21  Aaron Merey  <amerey@redhat.com>
56673
56674         PR gdb/27570: missing support for debuginfod in core_target::build_file_mappings
56675         Add debuginfod support to core_target::build_file_mappings and
56676         locate_exec_from_corefile_build_id to enable the downloading of
56677         missing executables and shared libraries referenced in core files.
56678
56679         Also add debuginfod support to solib_map_sections so that previously
56680         downloaded shared libraries can be retrieved from the local debuginfod
56681         cache.
56682
56683         When core file shared libraries are found locally, verify that their
56684         build-ids match the corresponding build-ids found in the core file.
56685         If there is a mismatch, attempt to query debuginfod for the correct
56686         build and print a warning if unsuccessful:
56687
56688           warning: Build-id of /lib64/libc.so.6 does not match core file.
56689
56690         Also disable debuginfod when gcore invokes gdb.  Debuginfo is not
56691         needed for core file generation so debuginfod queries will slow down
56692         gcore unnecessarily.
56693
56694 2022-03-21  Aaron Merey  <amerey@redhat.com>
56695
56696         gdb: Add soname to build-id mapping for core files
56697         Since commit aa2d5a422 gdb has been able to read executable and shared
56698         library build-ids within core files.
56699
56700         Expand this functionality so that each core file bfd maintains a map of
56701         soname to build-id for each shared library referenced in the core file.
56702
56703         This feature may be used to verify that gdb has found the correct shared
56704         libraries for core files and to facilitate downloading shared libaries via
56705         debuginfod.
56706
56707 2022-03-21  Pedro Alves  <pedro@palves.net>
56708
56709         Watchpoint followed by catchpoint misreports watchpoint (PR gdb/28621)
56710         If GDB reports a watchpoint hit, and then the next event is not
56711         TARGET_WAITKIND_STOPPED, but instead some event for which there's a
56712         catchpoint, such that GDB calls bpstat_stop_status, GDB mistakenly
56713         thinks the watchpoint triggered.  Vis, using foll-fork.c:
56714
56715           (gdb) awatch v
56716           Hardware access (read/write) watchpoint 2: v
56717           (gdb) catch fork
56718           Catchpoint 3 (fork)
56719           (gdb) c
56720           Continuing.
56721
56722           Hardware access (read/write) watchpoint 2: v
56723
56724           Old value = 0
56725           New value = 5
56726           main () at gdb.base/foll-fork.c:16
56727           16        pid = fork ();
56728           (gdb)
56729           Continuing.
56730
56731           Hardware access (read/write) watchpoint 2: v      <<<<
56732                                                             <<<< these lines are spurious
56733           Value = 5                                         <<<<
56734
56735           Catchpoint 3 (forked process 1712369), arch_fork (ctid=0x7ffff7fa4810) at arch-fork.h:49
56736           49      arch-fork.h: No such file or directory.
56737           (gdb)
56738
56739         The problem is that when we handle the fork event, nothing called
56740         watchpoints_triggered before calling bpstat_stop_status.  Thus, each
56741         watchpoint's watchpoint_triggered field was still set to
56742         watch_triggered_yes from the previous (real) watchpoint stop.
56743         watchpoint_triggered is only current called in the handle_signal_stop
56744         path, when handling TARGET_WAITKIND_STOPPED.
56745
56746         This fixes it by adding watchpoint_triggered calls in the other events
56747         paths that call bpstat_stop_status.  But instead of adding them
56748         explicitly, it adds a new function bpstat_stop_status_nowatch that
56749         wraps bpstat_stop_status and calls watchpoint_triggered, and then
56750         replaces most calls to bpstat_stop_status with calls to
56751         bpstat_stop_status_nowatch.
56752
56753         This required constifying watchpoints_triggered.
56754
56755         New test included, which fails without the fix.
56756
56757         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28621
56758
56759         Change-Id: I282b38c2eee428d25319af3bc842f9feafed461c
56760
56761 2022-03-21  Pedro Alves  <pedro@palves.net>
56762
56763         gdbserver: Fixup previous patch
56764         The previous prepare_resume_reply change missed updating the 'buf'
56765         reference that overwrites the 'T', so if 'buf' was advanced, we'd
56766         still overwrite the wrong character.  This fixes it.
56767
56768         Change-Id: Ia8ce433366b85af4e268c1c49e7b447da3130a4d
56769
56770 2022-03-21  Pedro Alves  <pedro@palves.net>
56771
56772         gdbserver: Fix incorrect assertion
56773         While playing with adding a new event kind, I noticed that
56774         prepare_resume_reply TARGET_WAITKIND_FORKED, etc. advance 'buf', so if
56775         we force-disable the T packet, we'd fail the *buf == 'T' assertion.
56776
56777         Fix it by tweaking the assertion to always look at the beginning of
56778         the buffer.
56779
56780         Change-Id: I8c38e32353db115edcde418b3b1e8ba12343c22b
56781
56782 2022-03-21  Simon Marchi  <simon.marchi@efficios.com>
56783
56784         gdb: re-generate config.in
56785         I'm getting this diff when running `autoreconf -vf`.
56786
56787         Change-Id: Id5f009d0f0481935c1ee9df5332cb4bf45fbd32d
56788
56789 2022-03-21  Andrew Burgess  <aburgess@redhat.com>
56790
56791         gdb/x86: handle stap probe arguments in xmm registers
56792         On x86 machines with xmm register, and with recent versions of
56793         systemtap (and gcc?), it can occur that stap probe arguments will be
56794         placed into xmm registers.
56795
56796         I notice this happening on a current Fedora Rawhide install with the
56797         following package versions installed:
56798
56799           $ rpm -q glibc systemtap gcc
56800           glibc-2.35.9000-10.fc37.x86_64
56801           systemtap-4.7~pre16468670g9f253544-1.fc37.x86_64
56802           gcc-12.0.1-0.12.fc37.x86_64
56803
56804         If I check the probe data in libc, I see this:
56805
56806           $ readelf -n /lib64/libc.so.6
56807           ...
56808           stapsdt              0x0000004d       NT_STAPSDT (SystemTap probe descriptors)
56809             Provider: libc
56810             Name: pthread_start
56811             Location: 0x0000000000090ac3, Base: 0x00000000001c65c4, Semaphore: 0x0000000000000000
56812             Arguments: 8@%xmm1 8@1600(%rbx) 8@1608(%rbx)
56813           stapsdt              0x00000050       NT_STAPSDT (SystemTap probe descriptors)
56814             Provider: libc
56815             Name: pthread_create
56816             Location: 0x00000000000912f1, Base: 0x00000000001c65c4, Semaphore: 0x0000000000000000
56817             Arguments: 8@%xmm1 8@%r13 8@8(%rsp) 8@16(%rsp)
56818           ...
56819
56820         Notice that for both of these probes, the first argument is a uint64_t
56821         stored in the xmm1 register.
56822
56823         Unfortunately, if I try to use this probe within GDB, then I can't
56824         view the first argument.  Here's an example session:
56825
56826           $ gdb $(which gdb)
56827           (gdb) start
56828           ...
56829           (gdb) info probes stap  libc pthread_create
56830           ...
56831           (gdb) break *0x00007ffff729e2f1       # Use address of probe.
56832           (gdb) continue
56833           ...
56834           (gdb) p $_probe_arg0
56835           Invalid cast.
56836
56837         What's going wrong?  If I re-run my session, but this time use 'set
56838         debug stap-expression 1', this is what I see:
56839
56840           (gdb) set debug stap-expression 1
56841           (gdb) p $_probe_arg0
56842           Operation: UNOP_CAST
56843            Operation: OP_REGISTER
56844             String: xmm1
56845            Type: uint64_t
56846           Operation: UNOP_CAST
56847            Operation: OP_REGISTER
56848             String: r13
56849            Type: uint64_t
56850           Operation: UNOP_CAST
56851            Operation: UNOP_IND
56852             Operation: UNOP_CAST
56853              Operation: BINOP_ADD
56854               Operation: OP_LONG
56855                Type: long
56856                Constant: 0x0000000000000008
56857               Operation: OP_REGISTER
56858                String: rsp
56859              Type: uint64_t *
56860            Type: uint64_t
56861           Operation: UNOP_CAST
56862            Operation: UNOP_IND
56863             Operation: UNOP_CAST
56864              Operation: BINOP_ADD
56865               Operation: OP_LONG
56866                Type: long
56867                Constant: 0x0000000000000010
56868               Operation: OP_REGISTER
56869                String: rsp
56870              Type: uint64_t *
56871            Type: uint64_t
56872           Invalid cast.
56873           (gdb)
56874
56875         The important bit is this:
56876
56877           Operation: UNOP_CAST
56878            Operation: OP_REGISTER
56879             String: xmm1
56880            Type: uint64_t
56881
56882         Which is where we cast the xmm1 register to uint64_t.  And the final
56883         piece of the puzzle is:
56884
56885           (gdb) ptype $xmm1
56886           type = union vec128 {
56887               v8bf16 v8_bfloat16;
56888               v4f v4_float;
56889               v2d v2_double;
56890               v16i8 v16_int8;
56891               v8i16 v8_int16;
56892               v4i32 v4_int32;
56893               v2i64 v2_int64;
56894               uint128_t uint128;
56895           }
56896
56897         So, we are attempting to cast a union type to a scalar type, which is
56898         not supporting in C/C++, and as a consequence GDB's expression
56899         evaluator throws an error when we attempt to do this.
56900
56901         The first approach I considered for solving this problem was to try
56902         and make use of gdbarch_stap_adjust_register.  We already have a
56903         gdbarch method (gdbarch_stap_adjust_register) that allows us to tweak
56904         the name of the register that we access.  Currently only x86
56905         architectures use this to transform things like ax to eax in some
56906         cases.
56907
56908         I wondered, what if we change gdbarch_stap_adjust_register to do more
56909         than just change the register names?  What if this method instead
56910         became gdbarch_stap_read_register.  This new method would return a
56911         operation_up, and would take the register name, and the type we are
56912         trying to read from the register, and return the operation that
56913         actually reads the register.
56914
56915         The default implementation of this method would just use
56916         user_reg_map_name_to_regnum, and then create a register_operation,
56917         like we already do in stap_parse_register_operand.  But, for x86
56918         architectures this method would fist possibly adjust the register
56919         name, then do the default action to read the register.  Finally, for
56920         x86 this method would spot when we were accessing an xmm register,
56921         and, based on the type being pulled from the register, would extract
56922         the correct field from the union.
56923
56924         The benefit of this approach is that it would work with the expression
56925         types that GDB currently supports.  The draw back would be that this
56926         approach would not be very generic.  We'd need code to handle each
56927         sub-field size with an xmm register.  If other architectures started
56928         using vector registers for probe arguments, those architectures would
56929         have to create their own gdbarch_stap_read_register method.  And
56930         finally, the type of the xmm registers comes from the type defined in
56931         the target description, there's a risk that GDB might end up
56932         hard-coding the names of type sub-fields, then if a target uses a
56933         different target description, with different field names for xmm
56934         registers, the stap probes would stop working.
56935
56936         And so, based on all the above draw backs, I rejected this first
56937         approach.
56938
56939         My second plan involves adding a new expression type to GDB called
56940         unop_extract_operation.  This new expression takes a value and a type,
56941         during evaluation the value contents are fetched, and then a new value
56942         is extracted from the value contents (based on type).  This is similar
56943         to the following C expression:
56944
56945           result_value = *((output_type *) &input_value);
56946
56947         Obviously we can't actually build this expression in this case, as the
56948         input_value is in a register, but hopefully the above makes it clearer
56949         what I'm trying to do.
56950
56951         The benefit of the new expression approach is that this code can be
56952         shared across all architectures, and it doesn't care about sub-field
56953         names within the union type.
56954
56955         The draw-backs that I see are potential future problems if arguments
56956         are not stored within the least significant bytes of the register.
56957         However if/when that becomes an issue we can adapt the
56958         gdbarch_stap_read_register approach to allow architectures to control
56959         how a value is extracted.
56960
56961         For testing, I've extended the existing gdb.base/stap-probe.exp test
56962         to include a function that tries to force an argument into an xmm
56963         register.  Obviously, that will only work on a x86 target, so I've
56964         guarded the new function with an appropriate GCC define.  In the exp
56965         script we use readelf to check if the probe exists, and is using the
56966         xmm register.
56967
56968         If the probe doesn't exist then the associated tests are skipped.
56969
56970         If the probe exists, put isn't using the xmm register (which will
56971         depend on systemtap/gcc versions), then again, the tests are skipped.
56972
56973         Otherwise, we can run the test.  I think the cost of running readelf
56974         is pretty low, so I don't feel too bad making all the non-xmm targets
56975         running this step.
56976
56977         I found that on a Fedora 35 install, with these packages installed, I
56978         was able to run this test and have the probe argument be placed in an
56979         xmm register:
56980
56981           $ rpm -q systemtap gcc glibc
56982           systemtap-4.6-4.fc35.x86_64
56983           gcc-11.2.1-9.fc35.x86_64
56984           glibc-2.34-7.fc35.x86_64
56985
56986         Finally, as this patch adds a new operation type, then I need to
56987         consider how to generate an agent expression for the new operation
56988         type.
56989
56990         I have kicked the can down the road a bit on this.  In the function
56991         stap_parse_register_operand, I only create a unop_extract_operation in
56992         the case where the register type is non-scalar, this means that in
56993         most cases I don't need to worry about generating an agent expression
56994         at all.
56995
56996         In the xmm register case, when an unop_extract_operation will be
56997         created, I have sketched out how the agent expression could be
56998         handled, however, this code is currently not reached.  When we try to
56999         generate the agent expression to place the xmm register on the stack,
57000         GDB hits this error:
57001
57002           (gdb) trace -probe-stap test:xmmreg
57003           Tracepoint 1 at 0x401166
57004           (gdb) actions
57005           Enter actions for tracepoint 1, one per line.
57006           End with a line saying just "end".
57007           >collect $_probe_arg0
57008           Value not scalar: cannot be an rvalue.
57009
57010         This is because GDB doesn't currently support placing non-scalar types
57011         on the agent expression evaluation stack.  Solving this is clearly
57012         related to the original problem, but feels a bit like a second
57013         problem.  I'd like to get feedback on whether my approach to solving
57014         the original problem is acceptable or not before I start looking at
57015         how to handle xmm registers within agent expressions.
57016
57017 2022-03-21  Steiner H Gunderson  <steinar+sourceware@gunderson.no>
57018
57019         Reduce O(n2) performance overhead when parsing DWARF unit information.
57020                 PR 28978
57021                 * dwarf2.c (scan_unit_for_symbols): When performing second pass,
57022                 check to see if the function or variable being processed is the
57023                 same as the previous one.
57024
57025 2022-03-21  Jan Beulich  <jbeulich@suse.com>
57026
57027         x86: don't suppress overflow diagnostics in x32 mode
57028         Unlike in 64-bit mode, where values wrap at the 64-bit boundary anyway,
57029         there's no wrapping at the 32-bit boundary here, and hence overflow
57030         detection shouldn't be suppressed just because rela relocations are
57031         going to be used.
57032
57033         The extra check against NO_RELOC is actually a result of an ilp32 test
57034         otherwise failing. But thinking about it, reporting overflows for
57035         not-really-relocations (typically because of earlier errors) makes
57036         little sense in general. Perhaps this should even be extended to non-
57037         64-bit modes.
57038
57039 2022-03-21  Simon Marchi  <simon.marchi@efficios.com>
57040
57041         gdb/testsuite: reformat gdb.python/pretty-print-call-by-hand.py
57042         Run black on the file.
57043
57044         Change-Id: Ifb576137fb7158a0227173f61c1202f0695b3685
57045
57046 2022-03-21  Bruno Larsen  <blarsen@redhat.com>
57047
57048         [gdb/testsuite] test a function call by hand from pretty printer
57049         The test case added here is testing the bug gdb/28856, where calling a
57050         function by hand from a pretty printer makes GDB crash. There are 6
57051         mechanisms to trigger this crash in the current test, using the commands
57052         backtrace, up, down, finish, step and continue. Since the failure happens
57053         because of use-after-free (more details below) the tests will always
57054         have a chance of passing through sheer luck, but anecdotally they seem
57055         to fail all of the time.
57056
57057         The reason GDB is crashing is a use-after-free problem. The above
57058         mentioned functions save a pointer to the current frame's information,
57059         then calls the pretty printer, and uses the saved pointer for different
57060         reasons, depending on the function. The issue happens because
57061         call_function_by_hand needs to reset the obstack to get the current
57062         frame, invalidating the saved pointer.
57063
57064 2022-03-21  Pedro Alves  <pedro@palves.net>
57065
57066         gdb/testsuite: Installed-GDB testing & data-directory
57067         In testsuite/README, we suggest that you can run the testsuite against
57068         some other GDB binary by using:
57069
57070             make check RUNTESTFLAGS=GDB=/usr/bin/gdb
57071
57072         However, that example isn't fully correct, because with that command
57073         line, the testsuite will still pass
57074
57075           -data-directory=[pwd]/../data-directory
57076
57077         to /usr/bin/gdb, like e.g.:
57078
57079           ...
57080           builtin_spawn /usr/bin/gdb -nw -nx -data-directory /home/pedro/gdb/build/gdb/testsuite/../data-directory -iex set height 0 -iex set width 0
57081           ...
57082
57083         while if you're testing an installed GDB (the system GDB being the
57084         most usual scenario), then you should normally let it use its own
57085         configured directory, not the just-built GDB's data directory.
57086
57087         This commit improves the status quo with the following two changes:
57088
57089          - if the user specifies GDB on the command line, then by default,
57090            don't start GDB with the -data-directory command line option.
57091            I.e., let the tested GDB use its own configured data directory.
57092
57093          - let the user override the data directory, via a new
57094            GDB_DATA_DIRECTORY global.  This replaces the existing
57095            BUILD_DATA_DIRECTORY variable in testsuite/lib/gdb.exp, which
57096            wasn't overridable, and was a bit misnamed for the new purpose.
57097
57098         So after this, the following commands I believe behave intuitively:
57099
57100          # Test the non-installed GDB in some build dir:
57101
57102             make check \
57103               RUNTESTFLAGS="GDB=/path/to/other/build/gdb \
57104                             GDB_DATA_DIRECTORY=/path/to/other/build/gdb/data-directory"
57105
57106          # Test the GDB installed in some prefix:
57107
57108             make check \
57109               RUNTESTFLAGS="GDB=/opt/gdb/bin/gdb"
57110
57111          # Test the built GDB with some alternative data directory, e.g., the
57112            system GDB's data directory:
57113
57114             make check \
57115               RUNTESTFLAGS="GDB_DATA_DIRECTORY=/usr/share/gdb"
57116
57117         Change-Id: Icdc21c85219155d9564a9900961997e6624b78fb
57118
57119 2022-03-21  Nick Clifton  <nickc@redhat.com>
57120
57121         z80 assembler: Fix new unexpected overflow warning in v2.37
57122                 PR 28791
57123                 * config/tc-z80.c (emit_data_val): Do not warn about overlarge
57124                 constants generated by bit manipulation operators.
57125                 * testsuite/gas/z80/pr28791.s: New test source file.
57126                 * testsuite/gas/z80/pr28791.d: New test driver file.
57127
57128 2022-03-21  Andreas Schwab  <schwab@linux-m68k.org>
57129
57130         Add support for readline 8.2
57131         In readline 8.2 the type of rl_completer_word_break_characters changed to
57132         include const.
57133
57134 2022-03-21  GDB Administrator  <gdbadmin@sourceware.org>
57135
57136         Automatic date update in version.in
57137
57138 2022-03-20  Andreas Schwab  <schwab@linux-m68k.org>
57139
57140         RISC-V: Fix misplaced @end table
57141         Move the csr-check and arch items inside the table for the .option directive.
57142
57143 2022-03-20  Alan Modra  <amodra@gmail.com>
57144
57145         PR28979, internal error in demand_empty_rest_of_line
57146         The change in read_a_source_file prevents the particular testcase in
57147         the PR from triggering the assertion in demand_empty_rest_of_line.
57148         I've also removed the assertion.  Nothing much goes wrong with gas if
57149         something else triggers it, so it's not worthy of an abort.
57150
57151         I've also changed my previous patch to ignore_rest_of_line to allow
57152         that function to increment input_line_pointer past buffer_limit, like
57153         demand_empty_rest_of_line:  The two functions ought to behave the
57154         same in that respect.  Finally, demand_empty_rest_of_line gets a
57155         little hardening to prevent accesses past buffer_limit plus one.
57156
57157                 PR 28979
57158                 * read.c (read_a_source_file): Calculate known size for sbuf
57159                 rather than calling strlen.
57160                 (demand_empty_rest_of_line): Remove "know" check.  Expand comment.
57161                 Don't dereference input_line_pointer when past buffer_limit.
57162                 (ignore_rest_of_line): Allow input_line_pointer to increment to
57163                 buffer_limit plus one.  Expand comment.
57164
57165 2022-03-20  Joel Brobecker  <brobecker@adacore.com>
57166
57167         Update gdb/NEWS after GDB 12 branch creation.
57168         This commit a new section for the next release branch, and renames
57169         the section of the current branch, now that it has been cut.
57170
57171 2022-03-20  Joel Brobecker  <brobecker@adacore.com>
57172
57173         Bump version to 13.0.50.DATE-git.
57174         Now that the GDB 12 branch has been created,
57175         this commit bumps the version number in gdb/version.in to
57176         13.0.50.DATE-git
57177
57178         For the record, the GDB 12 branch was created
57179         from commit 2be64de603f8b3ae359d2d3fbf5db0e79869f32b.
57180
57181         Also, as a result of the version bump, the following changes
57182         have been made in gdb/testsuite:
57183
57184                 * gdb.base/default.exp: Change $_gdb_major to 13.
57185
57186 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57187
57188         ld:LoongArch: Add test cases to adapt to LoongArch32 and LoongArch64
57189           ld/testsuite/ld-loongarch-elf
57190
57191           *  ld-loongarch-elf.exp:  Test LoongArch32 and LoongArch64 testcases respectively.
57192           *  jmp_op.d: Fix bug in test LoongArch32.
57193           *  disas-jirl-32.d: New test case for LoongArch32.
57194           *  disas-jirl-32.s: New test case for LoongArch32.
57195           *  disas-jirl.d: Skip test case LoongArch32.
57196           *  macro_op_32.d: New test case for LoongArch32.
57197           *  macro_op_32.s: New test case for LoongArch32.
57198           *  macro_op.d: Skip test case LoongArch32.
57199
57200 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57201
57202         gas:LoongArch: Fix "make check" pr21884 fail in LoongArch32.
57203           gas/config/
57204             * tc-loongarch.c: Add function to select target mach.
57205             * tc-loongarch.h: Define macro TARGET_MACH.
57206
57207         ld: loongarch: Skip unsupport test cases.
57208           ld/testsuite/ld-elf/
57209             * eh5.d             Skip loongarch64 target.
57210             * pr21884.d         Skip loongarch* targets.
57211             * pr26936.d         Skip loongarch* targets.
57212
57213 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57214
57215         LoongArch: Fix LD check fails.
57216           Some test cases about ifunc.
57217
57218           bfd/
57219             * elfnn-loongarch.c
57220             * elfxx-loongarch.h
57221
57222            === ld Summary ===
57223           of expected passes             1430
57224           of expected failures           11
57225           of untested testcases          1
57226           of unsupported tests           154
57227
57228 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57229
57230         LoongArch: Update ABI eflag in elf header.
57231           Update LoongArch ABI eflag in elf header.
57232             ilp32s  0x5
57233             ilp32f  0x6
57234             ilp32d  0x7
57235             lp64s   0x1
57236             lp64f   0x2
57237             lp64d   0x3
57238
57239           bfd/
57240             * elfnn-loongarch.c Check object flags while ld.
57241
57242           gas/
57243             * tc-loongarch.c Write eflag to elf header.
57244
57245           include/elf
57246                 * loongarch.h Define ABI number.
57247
57248 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57249
57250         gas:LoongArch: Fix wrong line number in .debug_line
57251           The dwarf2_emit_insn() can create debuginfo of line. But it is called
57252           too late in append_fixp_and_insn. It causes extra offs when debuginfo
57253           of line sets address.
57254
57255           gas/config/
57256             * tc-loongarch.c
57257
57258 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57259
57260         gas:LoongArch: Fix segment error in compilation due to too long symbol name.
57261           Change "char buffer[8192];" into "char *buffer =
57262           (char *) malloc(1000 +  6 * len_str);" in function
57263           loongarch_expand_macro_with_format_map.
57264
57265           gas/
57266             * config/tc-loongarch.c
57267
57268           include/
57269             * opcode/loongarch.h
57270
57271           opcodes/
57272             * loongarch-coder.c
57273
57274 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57275
57276         LoongArch: Use functions instead of magic numbers.
57277           Replace the magic numbers in gas(tc-loongarch.c) and
57278           bfd(elfnn-loongarch.c) with the functions defined in
57279           the howto table(elfxx-loongarch.c).
57280
57281           gas/
57282             * config/tc-loongarch.c: use functions.
57283
57284           bfd/
57285             * elfnn-loongarch.c: use functions.
57286             * elfxx-loongarch.c: define functions.
57287             * elfxx-loongarch.h
57288
57289 2022-03-20  liuzhensong  <liuzhensong@loongson.cn>
57290
57291         ubsan: loongarch : signed integer shift overflow.
57292            opcodes/
57293                 * loongarch-coder.c :
57294                   int32_t ret = 0;
57295                   ret <<= sizeof (ret) * 8 - len;
57296                   ret >>= sizeof (ret) * 8 - len;
57297                   ...
57298                   Avoid ubsan warning.
57299
57300 2022-03-20  GDB Administrator  <gdbadmin@sourceware.org>
57301
57302         Automatic date update in version.in
57303
57304 2022-03-19  Simon Marchi  <simon.marchi@efficios.com>
57305
57306         gdb/python: remove gdb._mi_commands dict
57307         The motivation for this patch is the fact that py-micmd.c doesn't build
57308         with Python 2, due to PyDict_GetItemWithError being a Python 3-only
57309         function:
57310
57311               CXX    python/py-micmd.o
57312             /home/smarchi/src/binutils-gdb/gdb/python/py-micmd.c: In function â€˜int micmdpy_uninstall_command(micmdpy_object*)’:
57313             /home/smarchi/src/binutils-gdb/gdb/python/py-micmd.c:430:20: error: â€˜PyDict_GetItemWithError’ was not declared in this scope; did you mean â€˜PyDict_GetItemString’?
57314               430 |   PyObject *curr = PyDict_GetItemWithError (mi_cmd_dict.get (),
57315                   |                    ^~~~~~~~~~~~~~~~~~~~~~~
57316                   |                    PyDict_GetItemString
57317
57318         A first solution to fix this would be to try to replace
57319         PyDict_GetItemWithError equivalent Python 2 code.  But I looked at why
57320         we are doing this in the first place: it is to maintain the
57321         `gdb._mi_commands` Python dictionary that we use as a `name ->
57322         gdb.MICommand object` map.  Since the `gdb._mi_commands` dictionary is
57323         never actually used in Python, it seems like a lot of trouble to use a
57324         Python object for this.
57325
57326         My first idea was to replace it with a C++ map
57327         (std::unordered_map<std::string, gdbpy_ref<micmdpy_object>>).  While
57328         implementing this, I realized we don't really need this map at all.  The
57329         mi_command_py objects registered in the main MI command table can own
57330         their backing micmdpy_object (that's a gdb.MICommand, but seen from the
57331         C++ code).  To know whether an mi_command is an mi_command_py, we can
57332         use a dynamic cast.  Since there's one less data structure to maintain,
57333         there are less chances of messing things up.
57334
57335          - Change mi_command_py::m_pyobj to a gdbpy_ref, the mi_command_py is
57336            now what keeps the MICommand alive.
57337          - Set micmdpy_object::mi_command in the constructor of mi_command_py.
57338            If mi_command_py manages setting/clearing that field in
57339            swap_python_object, I think it makes sense that it also takes care of
57340            setting it initially.
57341          - Move a bunch of checks from micmdpy_install_command to
57342            swap_python_object, and make them gdb_asserts.
57343          - In micmdpy_install_command, start by doing an mi_cmd_lookup.  This is
57344            needed to know whether there's a Python MI command already registered
57345            with that name.  But we can already tell if there's a non-Python
57346            command registered with that name.  Return an error if that happens,
57347            rather than waiting for insert_mi_cmd_entry to fail.  Change the
57348            error message to "name is already in use" rather than "may already be
57349            in use", since it's more precise.
57350
57351         I asked Andrew about the original intent of using a Python dictionary
57352         object to hold the command objects.  The reason was to make sure the
57353         objects get destroyed when the Python runtime gets finalized, not later.
57354         Holding the objects in global C++ data structures and not doing anything
57355         more means that the held Python objects will be decref'd after the
57356         Python interpreter has been finalized.  That's not desirable.  I tried
57357         it and it indeed segfaults.
57358
57359         Handle this by adding a gdbpy_finalize_micommands function called in
57360         finalize_python.  This is the mirror of gdbpy_initialize_micommands
57361         called in do_start_initialization.  In there, delete all Python MI
57362         commands.  I think it makes sense to do it this way: if it was somehow
57363         possible to unload Python support from GDB in the middle of a session
57364         we'd want to unregister any Python MI command.  Otherwise, these MI
57365         commands would be backed with a stale PyObject or simply nothing.
57366
57367         Delete tests that were related to `gdb._mi_commands`.
57368
57369         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
57370         Change-Id: I060d5ebc7a096c67487998a8a4ca1e8e56f12cd3
57371
57372 2022-03-19  GDB Administrator  <gdbadmin@sourceware.org>
57373
57374         Automatic date update in version.in
57375
57376 2022-03-18  Pedro Alves  <pedro@palves.net>
57377
57378         Fix crash with stepi, no debug info, and "set debug infrun 1"
57379         A stepi in a function without debug info with "set debug infrun 1"
57380         crashes GDB since commit c8353d682f69 (gdb/infrun: some extra infrun
57381         debug print statements), due to a reference to
57382         "tp->current_symtab->filename" when tp->current_symtab is null.
57383
57384         This commit adds the missing null check.  The output in this case
57385         becomes:
57386
57387           [infrun] set_step_info: symtab = <null>, line = 0, step_frame_id = {stack=0x7fffffffd980,code=0x0000000000456c30,!special}, step_stack_frame_id = {stack=0x7fffffffd980,code=0x0000000000456c30,!special}
57388
57389         Change-Id: I5171a9d222bc7e15b9dba2feaba7d55c7acd99f8
57390
57391 2022-03-18  Tom Tromey  <tromey@adacore.com>
57392
57393         Implement gdbarch_stack_frame_destroyed_p for aarch64
57394         The internal AdaCore testsuite has a test that checks that an
57395         out-of-scope watchpoint is deleted.  This fails on some aarch64
57396         configurations, reporting an extra stop:
57397
57398             (gdb) continue
57399             Continuing.
57400
57401             Thread 3 hit Watchpoint 2: result
57402
57403             Old value = 64
57404             New value = 0
57405             0x0000000040021648 in pck.get_val (seed=0, off_by_one=false) at [...]/pck.adb:13
57406             13     end Get_Val;
57407
57408         I believe what is happening here is that the variable is stored at:
57409
57410             <efa>   DW_AT_location    : 2 byte block: 91 7c     (DW_OP_fbreg: -4)
57411
57412         and the extra stop is reported just before a return, when the ldp
57413         instruction is executed:
57414
57415            0x0000000040021644 <+204>:   ldp     x29, x30, [sp], #48
57416            0x0000000040021648 <+208>:   ret
57417
57418         This instruction modifies the frame base calculation, and so the test
57419         picks up whatever memory is pointed to in the callee frame.
57420
57421         Implementing the gdbarch hook gdbarch_stack_frame_destroyed_p fixes
57422         this problem.
57423
57424         As usual with this sort of patch, it has passed internal testing, but
57425         I don't have a good way to try it with dejagnu.  So, I don't know
57426         whether some existing test covers this.  I suspect there must be one,
57427         but it's also worth noting that this test passes for aarch64 in some
57428         configurations -- I don't know what causes one to fail and another to
57429         succeed.
57430
57431 2022-03-18  Nick Clifton  <nickc@redhat.com>
57432
57433         Fix Build issues due to patch "gprofng: a new GNU profiler"
57434           Find and fix more places where clock_gettime() and CLOCK_MONOTONIC_RAW are used.
57435
57436 2022-03-18  Simon Marchi  <simon.marchi@efficios.com>
57437
57438         gdb: run black to format some Python files
57439         Seems like some leftovers from previous commits.
57440
57441         Change-Id: I7155ccdf7a4fef83bcb3d60320252c3628efdb83
57442
57443 2022-03-18  Viorel Preoteasa  <viorel.preoteasa@gmail.com>
57444
57445         Fix ld-arm bug in encoding of blx calls jumping from thumb to arm instructions
57446                 PR 28924
57447                 * elf32-arm.c (THM_MAX_FWD_BRANCH_OFFSET): Fix definition.
57448                 (THM2_MAX_FWD_BRANCH_OFFSET): Likewise.
57449
57450 2022-03-18  Jan Beulich  <jbeulich@suse.com>
57451
57452         x86: also fold remaining multi-vector-size shift insns
57453         By slightly relaxing the checking in operand_type_register_match() we
57454         can fold the vector shift insns with an XMM source as well. While
57455         strictly speaking an overlap in just one size (see the code comment) is
57456         not enough (both operands could have multiple sizes with just a single
57457         common one), this is good enough for all templates we have, or which
57458         could sensibly / usefully appear (within the scope of the present
57459         operand matching model).
57460
57461         Tightening this a little would be possible, but would require broadcast
57462         related information to be passed into the function.
57463
57464 2022-03-18  Jan Beulich  <jbeulich@suse.com>
57465
57466         x86: drop stray CheckRegSize from VEXTRACT{F,I}32X4
57467         They have only a single operand allowing multiple sizes, hence there are
57468         no pairs of operands to check for consistent size.
57469
57470         x86: fold certain AVX2 templates into their AVX counterparts
57471         Like for AVX512VL we can make the handling of operand sizes a little
57472         more flexible to allow reducing the number of templates we have.
57473
57474 2022-03-18  Tsukasa OI  <research_trasio@irq.a4lg.com>
57475
57476         RISC-V: Cache management instructions
57477         This commit adds 'Zicbom' / 'Zicboz' instructions.
57478
57479         bfd/ChangeLog:
57480
57481                 * elfxx-riscv.c (riscv_multi_subset_supports): Add handling for
57482                 new instruction classes.
57483
57484         include/ChangeLog:
57485
57486                 * opcode/riscv-opc.h (MATCH_CBO_CLEAN, MASK_CBO_CLEAN,
57487                 MATCH_CBO_FLUSH, MASK_CBO_FLUSH, MATCH_CBO_INVAL,
57488                 MASK_CBO_INVAL, MATCH_CBO_ZERO, MASK_CBO_ZERO): New macros.
57489                 * opcode/riscv.h (enum riscv_insn_class): Add new instruction
57490                 classes INSN_CLASS_ZICBOM and INSN_CLASS_ZICBOZ.
57491
57492         opcodes/ChangeLog:
57493
57494                 * riscv-opc.c (riscv_opcodes): Add cache-block management
57495                 instructions.
57496
57497 2022-03-18  Tsukasa OI  <research_trasio@irq.a4lg.com>
57498
57499         RISC-V: Prefetch hint instructions and operand set
57500         This commit adds 'Zicbop' hint instructions.
57501
57502         bfd/ChangeLog:
57503
57504                 * elfxx-riscv.c (riscv_multi_subset_supports): Add handling for
57505                 new instruction class.
57506
57507         gas/ChangeLog:
57508
57509                 * config/tc-riscv.c (riscv_ip): Add handling for new operand
57510                 type 'f' (32-byte aligned pseudo S-type immediate for prefetch
57511                 hints).
57512                 (validate_riscv_insn): Likewise.
57513
57514         include/ChangeLog:
57515
57516                 * opcode/riscv-opc.h (MATCH_PREFETCH_I, MASK_PREFETCH_I,
57517                 MATCH_PREFETCH_R, MASK_PREFETCH_R, MATCH_PREFETCH_W,
57518                 MASK_PREFETCH_W): New macros.
57519                 * opcode/riscv.h (enum riscv_insn_class): Add new instruction
57520                 class INSN_CLASS_ZICBOP.
57521
57522         opcodes/ChangeLog:
57523
57524                 * riscv-dis.c (print_insn_args): Add handling for new operand
57525                 type.
57526                 * riscv-opc.c (riscv_opcodes): Add prefetch hint instructions.
57527
57528 2022-03-18  Alan Modra  <amodra@gmail.com>
57529
57530         PR28977 tc-i386.c internal error in parse_register
57531                 PR 28977
57532                 * config/tc-i386.c (parse_register): Handle X_op not O_register
57533                 as for a non-reg_section symbol.  Simplify array bounds check.
57534
57535 2022-03-18  Alan Modra  <amodra@gmail.com>
57536
57537         Tidy gas current_frame before exit
57538         Releases some obstack memory on an error path.
57539
57540                 * cond.c (cond_finish_check): Call cond_exit_macro.
57541
57542 2022-03-18  Alan Modra  <amodra@gmail.com>
57543
57544         ubsan: logical_input_line signed integer overflow
57545         To avoid a completely useless fuzzing ubsan "bug" report, I decided to
57546         make logical_input_line unsigned.
57547
57548                 * input-scrub.c (logical_input_line): Make unsigned.
57549                 (struct input_save): Here too.
57550                 (input_scrub_reinit, input_scrub_close, bump_line_counters),
57551                 (as_where): Adjust to suit.
57552
57553 2022-03-18  GDB Administrator  <gdbadmin@sourceware.org>
57554
57555         Automatic date update in version.in
57556
57557 2022-03-17  H.J. Lu  <hjl.tools@gmail.com>
57558
57559         gprofng: Skip jsynprog with a broken javac
57560         On CET enabled Linux/x86-64 machines, one can get
57561
57562         $ javac simple.java
57563         Error: dl failure on line 894
57564         Error: failed /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so, because /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so: rebuild shared object with SHSTK support enabled
57565
57566         Set GPROFNG_BROKEN_JAVAC to "yes" only with a broken javac and skip the
57567         jsynprog test with a broken javac.
57568
57569                 PR gprofng/28965
57570                 * Makefile.am (GPROFNG_BROKEN_JAVAC): New.
57571                 (check-DEJAGNU): Pass GPROFNG_BROKEN_JAVAC to runtest.
57572                 * configure.ac (GPROFNG_BROKEN_JAVAC): New AC_SUBST.  Set to yes
57573                 with a broken javac.
57574                 * Makefile.in: Regenerate.
57575                 * configure: Likewise.
57576                 * testsuite/gprofng.display/display.exp: Skip jsynprog with a
57577                 broken javac.
57578
57579 2022-03-17  John Baldwin  <jhb@FreeBSD.org>
57580
57581         Remove fall throughs in core_target::xfer_partial.
57582         The cases for TARGET_OBJECT_LIBRARIES and TARGET_OBJECT_LIBRARIES_AIX
57583         can try to fetch different data objects (such as
57584         TARGET_OBJECT_SIGNAL_INFO) if gdbarch methods for the requested data
57585         aren't present.  Return with TARGET_XFER_E_IO if the gdbarch method
57586         isn't present instead.
57587
57588 2022-03-17  Pedro Alves  <pedro@palves.net>
57589
57590         gdb: Remove support for S+core
57591         GCC removed support for score back in 2014 already.  Back then, we
57592         basically agreed about removing it from GDB too, but it ended up being
57593         forgotten.  See:
57594
57595          https://sourceware.org/pipermail/gdb/2014-October/044643.html
57596
57597         Following through this time around.
57598
57599         Change-Id: I5b25a1ff7bce7b150d6f90f4c34047fae4b1f8b4
57600
57601 2022-03-17  Tom Tromey  <tromey@adacore.com>
57602
57603         Add another test for Ada Wide_Wide_String
57604         In an earlier patch, I had written that I wanted to add this test:
57605
57606               ptype Wide_Wide_String'("literal")
57607
57608         ... but that it failed with the distro GNAT.  Further investigation
57609         showed that it could be made to work by adding a function using
57610         Wide_Wide_String to the program -- this caused the type to end up in
57611         the debug info.
57612
57613         This patch adds the test.  I'm checking this in.
57614
57615 2022-03-17  Alan Modra  <amodra@gmail.com>
57616
57617         ubsan: Null dereference in parse_module
57618                 * vms-alpha.c (parse_module): Sanity check that DST__K_RTNBEG
57619                 has set module->func_table for DST__K_RTNEND.  Check return
57620                 of bfd_zalloc.
57621
57622 2022-03-17  Alan Modra  <amodra@gmail.com>
57623
57624         asan: Buffer overflow in evax_bfd_print_dst
57625         With "name" a char*, the length at name[0] might be negative, escaping
57626         buffer limit checks.
57627
57628                 * vms-alpha.c (evax_bfd_print_dst): Make name an unsigned char*.
57629                 (evax_bfd_print_emh): Likewise.
57630
57631 2022-03-17  Alan Modra  <amodra@gmail.com>
57632
57633         asan: Buffer overflow in som_set_reloc_info
57634                 * som.c (som_set_reloc_info): Add symcount parameter.  Don't
57635                 access symbols past symcount.  Don't access fixup past end_fixups.
57636                 (som_slurp_reloc_table): Adjust som_set_reloc_info calls.
57637
57638 2022-03-17  Alan Modra  <amodra@gmail.com>
57639
57640         asan: use of uninitialized value in buffer_and_nest
57641         More occurences of the same as commit d12b8d620c6a.
57642
57643                 * macro.c (buffer_and_nest): Sanity check length in buffer
57644                 before calling strncasecmp.
57645
57646 2022-03-17  Alan Modra  <amodra@gmail.com>
57647
57648         gprofng configure target tests
57649         ${target} in configure.ac should be the canonical target, so that for
57650         example, someone configuring with --target=x86_64-linux will match
57651         x86_64-*-linux*.
57652
57653                 * configure.ac: Invoke AC_CANONICAL_TARGET.
57654                 * libcollector/configure.ac: Likewise.
57655                 * Makefile.in: Regenerate.
57656                 * configure: Regenerate.
57657                 * doc/Makefile.in: Regenerate.
57658                 * gp-display-html/Makefile.in: Regenerate.
57659                 * libcollector/Makefile.in: Regenerate.
57660                 * libcollector/configure: Regenerate.
57661                 * src/Makefile.in: Regenerate.
57662
57663 2022-03-17  Alan Modra  <amodra@gmail.com>
57664
57665         Re: asan: buffer overflow in peXXigen.c
57666         In the process of fixing a buffer overflow in commit fe69d4fcf0194a,
57667         I managed to introduce a fairly obvious NULL pointer dereference..
57668
57669                 * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Don't
57670                 segfault on not finding section.  Wrap overlong lines.
57671
57672 2022-03-17  Alan Modra  <amodra@gmail.com>
57673
57674         asan: buffer overflows after calling ignore_rest_of_line
57675         operand() is not a place that should be calling ignore_rest_of_line.
57676         ignore_rest_of_line shouldn't increment input_line_pointer if already
57677         at buffer limit.
57678
57679                 * expr.c (operand): Don't call ignore_rest_of_line.
57680                 * read.c (s_mri_common): Likewise.
57681                 (ignore_rest_of_line): Don't increment input_line_pointer if
57682                 already at buffer_limit.
57683
57684 2022-03-17  Alan Modra  <amodra@gmail.com>
57685
57686         Re: bfd: add AMDGCN architecture
57687                 * po/SRC-POTFILES.in: Regenerate.
57688
57689 2022-03-17  Jan Beulich  <jbeulich@suse.com>
57690
57691         x86: don't accept base architectures as extensions
57692         The -march= intentions are quite clear: A base architecture may be
57693         followed by any number of extensions. Accepting a base architecture in
57694         place of an extension will at best result in confusion, as the first of
57695         the two (or more) items specified simply would not take effect, due to
57696         being overridden by the later one(s).
57697
57698 2022-03-17  Jan Beulich  <jbeulich@suse.com>
57699
57700         x86: never set i386_cpu_flags' "unused" field
57701         Setting this field risks cpu_flags_all_zero() mistakenly returning
57702         "false" when the object passed in was e.g. the result of ANDing together
57703         two objects which had the bit set, or ANDNing together an object with
57704         the field set and one with the field clear.
57705
57706         While there also avoid setting CpuNo64: Like Cpu64 this is driven
57707         differently anyway and hence shouldn't be set anywhere by default.
57708
57709         Note that the moving of the two items in i386-gen.c's cpu_flags[] is
57710         only for documentation purposes (and slight reducing of overhead), as
57711         the fields are sorted anyway upon program start.
57712
57713 2022-03-17  Jan Beulich  <jbeulich@suse.com>
57714
57715         x86: unify CPU flag on/off processing
57716         There's no need for the arbitrary special "unknown" token: Simply
57717         recognize the leading ~ and process everything else the same, merely
57718         recording whether to set individual fields to 1 or 0.
57719
57720         While there exclude CpuIAMCU from CPU_UNKNOWN_FLAGS - CPU_IAMCU_FLAGS
57721         override cpu_arch_flags anyway when -march=iamcu is passed, and there's
57722         no reason to have the stray flag set even if no insn actually is keyed
57723         to it.
57724
57725 2022-03-17  Jan Beulich  <jbeulich@suse.com>
57726
57727         x86: add another IAMCU testcase
57728         Now that {L,K}1OM support is gone, and with it the brokenness in
57729         check_cpu_arch_compatible(), put in place a test making sure that only
57730         extensions can be enabled via .arch for IAMCU, and that the base
57731         architecture cannot be changed.
57732
57733         x86: drop L1OM/K1OM support from gas
57734         This was only rudimentary support anyway; none of the sub-architecture
57735         specific insns were ever supported.
57736
57737         x86: assorted IAMCU CPU checking fixes
57738         The checks done by check_cpu_arch_compatible() were halfway sensible
57739         only at the time where only L1OM support was there. The purpose,
57740         however, has always been to prevent bad uses of .arch (turning off the
57741         base CPU "feature" flag) while at the same time permitting extensions to
57742         be enabled / disabled. In order to achieve this (and to prevent
57743         regressions when L1OM and K1OM support are removed)
57744         - set CpuIAMCU in CPU_IAMCU_FLAGS,
57745         - adjust the IAMCU check in the function itself (the other two similarly
57746           broken checks aren't adjusted as they're slated to be removed anyway),
57747         - avoid calling the function for extentions (which would never have the
57748           base "feature" flag set),
57749         - add a new testcase actually exercising ".arch iamcu" (which would also
57750           regress with the planned removal).
57751
57752 2022-03-17  GDB Administrator  <gdbadmin@sourceware.org>
57753
57754         Automatic date update in version.in
57755
57756 2022-03-16  Andrew Burgess  <aburgess@redhat.com>
57757
57758         gdb: work around prompt corruption caused by bracketed-paste-mode
57759         In this commit:
57760
57761           commit b4f26d541aa7224b70d363932e816e6e1a857633
57762           Date:   Tue Mar 2 13:42:37 2021 -0700
57763
57764               Import GNU Readline 8.1
57765
57766         We imported readline 8.1 into GDB.  As a consequence bug PR cli/28833
57767         was reported.  This bug spotted that, when the user terminated GDB by
57768         sending EOF (usually bound to Ctrl+d), the last prompt would become
57769         corrupted.  Here's what happens, the user is sat at a prompt like
57770         this:
57771
57772           (gdb)
57773
57774         And then the user sends EOF (Ctrl+d), we now see this:
57775
57776           quit)
57777           ... gdb terminates, and we return to the shell ...
57778
57779         Notice the 'quit' was printed over the prompt.
57780
57781         This problem is a result of readline 8.1 enabling bracketed paste mode
57782         by default.  This problem is present in readline 8.0 too, but in that
57783         version of readline bracketed paste mode is off by default, so a user
57784         will not see the bug unless they specifically enable the feature.
57785
57786         Bracketed paste mode is available in readline 7.0 too, but the bug
57787         is not present in this version of readline, see below for why.
57788
57789         What causes this problem is how readline disables bracketed paste
57790         mode.  Bracketed paste mode is a terminal feature that is enabled and
57791         disabled by readline emitting a specific escape sequence.  The problem
57792         for GDB is that the escape sequence to disable bracketed paste mode
57793         includes a '\r' character at the end, see this thread for more
57794         details:
57795
57796           https://lists.gnu.org/archive/html/bug-bash/2018-01/msg00097.html
57797
57798         The change to add the '\r' character to the escape sequence used to
57799         disable bracketed paste mode was introduced between readline 7.0 and
57800         readline 8.0, this is why the bug would not occur when using older
57801         versions of readline (note: I don't know if its even possible to build
57802         GDB using readline 7.0.  That really isn't important, I'm just
57803         documenting the history of this issue).
57804
57805         So, the escape sequence to disable bracketed paste mode is emitted
57806         from the readline function rl_deprep_terminal, this is called after
57807         the user has entered a complete command and pressed return, or, if the
57808         user sends EOF.
57809
57810         However, these two cases are slightly different.  In the first case,
57811         when the user has entered a command and pressed return, the cursor
57812         will have moved to the next, empty, line, before readline emits the
57813         escape sequence to leave bracketed paste mode.  The final '\r'
57814         character moves the cursor back to the beginning of this empty line,
57815         which is harmless.
57816
57817         For the EOF case though, this is not what happens.  Instead, the
57818         escape sequence to leave bracketed paste mode is emitted on the same
57819         line as the prompt.  The final '\r' moves the cursor back to the start
57820         of the prompt line.  This leaves us ready to override the prompt.
57821
57822         It is worth noting, that this is not the intended behaviour of
57823         readline, in rl_deprep_terminal, readline should emit a '\n' character
57824         when EOF is seen.  However, due to a bug in readline this does not
57825         happen (the _rl_eof_found flag is never set).  This is the first
57826         readline bug that effects GDB.
57827
57828         GDB prints the 'quit' message from command_line_handler (in
57829         event-top.c), this function is called (indirectly) from readline to
57830         process the complete command line, but also in the EOF case (in which
57831         case the command line is set to nullptr).  As this is part of the
57832         callback to process a complete command, this is called after readline
57833         has disabled bracketed paste mode (by calling rl_deprep_terminal).
57834
57835         And so, when bracketed paste mode is in use, rl_deprep_terminal leaves
57836         the cursor at the start of the prompt line (in the EOF case), and
57837         command_line_handler then prints 'quit', which overwrites the prompt.
57838
57839         The solution to this problem is to print the 'quit' message earlier,
57840         before rl_deprep_terminal is called.  This is easy to do by using the
57841         rl_deprep_term_function hook.  It is this hook that usually calls
57842         rl_deprep_terminal, however, if we replace this with a new function,
57843         we can print the 'quit' string, and then call rl_deprep_terminal
57844         ourselves.  This allows the 'quit' to be printed before
57845         rl_deprep_terminal is called.
57846
57847         The problem here is that there is no way in rl_deprep_terminal to know
57848         if readline is processing EOF or not, and as a result, we don't know
57849         when we should print 'quit'.  This is the second readline bug that
57850         effects GDB.
57851
57852         Both of these readline issues are discussed in this thread:
57853
57854           https://lists.gnu.org/archive/html/bug-readline/2022-02/msg00021.html
57855
57856         The result of that thread was that readline was patched to address
57857         both of these issues.
57858
57859         Now it should be easy to backport the readline fix to GDB's in tree
57860         copy of readline, and then change GDB to make use of these fixes to
57861         correctly print the 'quit' string.
57862
57863         However, we are just about to branch GDB 12, and there is concern from
57864         some that changing readline this close to a new release is a risky
57865         idea, see this thread:
57866
57867           https://sourceware.org/pipermail/gdb-patches/2022-March/186391.html
57868
57869         So, this commit doesn't change readline at all.  Instead, this commit
57870         is the smallest possible GDB change in order to avoid the prompt
57871         corruption.
57872
57873         In this commit I change GDB to print the 'quit' string on the line
57874         after the prompt, but only when bracketed paste mode is on.  This
57875         avoids the overwriting issue, the user sees this:
57876
57877           (gdb)
57878           quit
57879           ... gdb terminates, and returns to the shell ...
57880
57881         This isn't ideal, but is better than the existing behaviour.  After
57882         GDB 12 has branched, we can backport the readline fix, and apply a
57883         real fix to GDB.
57884
57885         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833
57886
57887 2022-03-16  Fangrui Song  <i@maskray.me>
57888
57889         objcopy --weaken-symbol: apply to STB_GNU_UNIQUE symbols
57890             PR binutils/28926
57891             * objcopy.c (filter_symbols): Apply weaken to STB_GNU_UNIQUE symbols
57892             * NEWS: Mention feature.
57893             * testsuite/binutils-all/objcopy.exp (objcopy_test_symbol_manipulation): New test.
57894             * testsuite/binutils-all/weaken-gnu-unique.s: New.
57895
57896 2022-03-16  Tom Tromey  <tromey@adacore.com>
57897
57898         Reimplement array concatenation for Ada and D
57899         This started as a patch to implement string concatenation for Ada.
57900         However, while working on this, I looked at how this code could
57901         possibly be called.  It turns out there are only two users of
57902         concat_operation: Ada and D.  So, in addition to implementing this for
57903         Ada, this patch rewrites value_concat, removing the odd "concatenate
57904         or repeat" semantics, which were completely unused.  As Ada and D both
57905         seem to represent strings using TYPE_CODE_ARRAY, this removes the
57906         TYPE_CODE_STRING code from there as well.
57907
57908         Remove eval_op_concat
57909         eval_op_concat has code to search for an operator overload of
57910         BINOP_CONCAT.  However, the operator overloading code is specific to
57911         C++, which does not have this operator.  And,
57912         binop_types_user_defined_p rejects this case right at the start, and
57913         value_x_binop does not handle this case.  I think this code has been
57914         dead for a very long time.  This patch removes it and hoists the
57915         remaining call into concatenation::evaluate, removing eval_op_concat
57916         entirely.
57917
57918 2022-03-16  Tom Tromey  <tromey@adacore.com>
57919
57920         Ada support for wide strings
57921         This adds some basic support for Wide_String and Wide_Wide_String to
57922         the Ada expression evaluator.  In particular, a string literal may be
57923         converted to a wide or wide-wide string depending on context.
57924
57925         The patch updates an existing test case.  Note that another test,
57926         namely something like:
57927
57928             ptype Wide_Wide_String'("literal")
57929
57930         ... would be nice to add, but when tested against a distro GNAT, this
57931         did not work (probably due to lack of debuginfo); so, I haven't
57932         included it here.
57933
57934 2022-03-16  Tom Tromey  <tromey@adacore.com>
57935
57936         Remove eval_op_string
57937         eval_op_string is only used in a single place -- the implementation of
57938         string_operation.  This patch turns it into the
57939         string_operation::evaluate method, removing a bit of extraneous code.
57940
57941 2022-03-16  Carl Love  <cel@us.ibm.com>
57942
57943         Powerpc fix for gdb.base/ending-run.exp
57944         The last two tests in gdb.base/ending-run.exp case fail on Powerpc when the
57945         system does not have the needed glibc debug-info files loaded.  In this
57946         case, gdb is not able to determine where execution stopped.  This behavior
57947         looks as follows for the test case:
57948
57949         The next to the last test does a next command when the program is stopped
57950         at the closing bracket for main.  The message printed is:
57951
57952         0x00007ffff7d01524 in ?? () from /lib/powerpc64le-linux-gnu/libc.so.6
57953
57954         which fails to match any of the test_multiple options.
57955
57956         The test then does another next command.  On Powerpc, the
57957         message printed it:
57958
57959         Cannot find bounds of current function
57960
57961         The test fails as the output does not match any of the options for the
57962         gdb_test_multiple.
57963
57964         I checked the behavior on Powerpc to see if this is typical.
57965         I ran gdb on the following simple program as shown below.
57966
57967         #include <stdio.h>
57968         int
57969         main(void)
57970         {
57971           printf("Hello, world!\n");
57972           return 0;
57973         }
57974
57975         gdb ./hello_world
57976         <snip the gdb start info>
57977
57978         Type "apropos word" to search for commands related to "word"...
57979         Reading symbols from ./hello_world...
57980         (No debugging symbols found in ./hello_world)
57981         (gdb) break main
57982         Breakpoint 1 at 0x818
57983         (gdb) r
57984
57985         Starting program: /home/carll/hello_world
57986         [Thread debugging using libthread_db enabled]
57987         Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1".
57988
57989         Breakpoint 1, 0x0000000100000818 in main ()
57990         (gdb) n
57991         Single stepping until exit from function main,
57992         which has no line number information.
57993         Hello, world!
57994         0x00007ffff7d01524 in ?? () from /lib/powerpc64le-linux-gnu/libc.so.6
57995         (gdb) n
57996         Cannot find bounds of current function
57997
57998         So it would seem that the messages seen from the test case are
57999         "normal" output for Powerpc when the debug-info is not available.
58000
58001         The following patch adds the output from Powerpc as an option
58002         to the gdb_test_multiple statement, identifying the output as the expected
58003         output on Powerpc without the needed debug-info files installed.
58004
58005         The patch has been tested on a Power 10 system and an Intel
58006         64-bit system.  No additional regression failures were seen on
58007         either platform.
58008
58009 2022-03-16  Martin Storsj?  <martin@martin.st>
58010
58011         dlltool: Use the output name as basis for deterministic temp prefixes
58012                 PR 28885
58013                 * dlltool.c (main): use imp_name rather than dll_name when
58014                 generating a temporary file name.
58015
58016 2022-03-16  Jan Vrany  <jan.vrany@labware.com>
58017             Andrew Burgess  <aburgess@redhat.com>
58018
58019         gdb/mi: consistently notify user when GDB/MI client uses -thread-select
58020         GDB notifies users about user selected thread changes somewhat
58021         inconsistently as mentioned on gdb-patches mailing list here:
58022
58023           https://sourceware.org/pipermail/gdb-patches/2022-February/185989.html
58024
58025         Consider GDB debugging a multi-threaded inferior with both CLI and GDB/MI
58026         interfaces connected to separate terminals.
58027
58028         Assuming inferior is stopped and thread 1 is selected, when a thread
58029         2 is selected using '-thread-select 2' command on GDB/MI terminal:
58030
58031             -thread-select 2
58032             ^done,new-thread-id="2",frame={level="0",addr="0x00005555555551cd",func="child_sub_function",args=[],file="/home/jv/Projects/gdb/users_jv_patches/gdb/testsuite/gdb.mi/user-selected-context-sync.c",fullname="/home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c",line="30",arch="i386:x86-64"}
58033             (gdb)
58034
58035         and on CLI terminal we get the notification (as expected):
58036
58037             [Switching to thread 2 (Thread 0x7ffff7daa640 (LWP 389659))]
58038             #0  child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30
58039             30        volatile int dummy = 0;
58040
58041         However, now that thread 2 is selected, if thread 1 is selected
58042         using 'thread-select --thread 1 1' command on GDB/MI terminal
58043         terminal:
58044
58045            -thread-select --thread 1 1
58046            ^done,new-thread-id="1",frame={level="0",addr="0x0000555555555294",func="main",args=[],file="/home/jv/Projects/gdb/users_jv_patches/gdb/testsuite/gdb.mi/user-selected-context-sync.c",fullname="/home/jv/Projects/gdb/users_jv_patches/gdb/testsuite/gdb.mi/user-selected-context-sync.c",line="66",arch="i386:x86-64"}
58047            (gdb)
58048
58049         but no notification is printed on CLI terminal, despite the fact
58050         that user selected thread has changed.
58051
58052         The problem is that when `-thread-select --thread 1 1` is executed
58053         then thread is switched to thread 1 before mi_cmd_thread_select () is
58054         called, therefore the condition "inferior_ptid != previous_ptid"
58055         there does not hold.
58056
58057         To address this problem, we have to move notification logic up to
58058         mi_cmd_execute () where --thread option is processed and notify
58059         user selected contents observers there if context changes.
58060
58061         However, this in itself breaks GDB/MI because it would cause context
58062         notification to be sent on MI channel. This is because by the time
58063         we notify, MI notification suppression is already restored (done in
58064         mi_command::invoke(). Therefore we had to lift notification suppression
58065         logic also up to mi_cmd_execute (). This change in made distinction
58066         between mi_command::invoke() and mi_command::do_invoke() unnecessary
58067         as all mi_command::invoke() did (after the change) was to call
58068         do_invoke(). So this patches removes do_invoke() and moves the command
58069         execution logic directly to invoke().
58070
58071         With this change, all gdb.mi tests pass, tested on x86_64-linux.
58072
58073         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20631
58074
58075 2022-03-16  H.J. Lu  <hjl.tools@gmail.com>
58076
58077         gprofng: Use symver attribute if available
58078         Use symver attribute if available, instead of asm statement, to support
58079         LTO build.
58080
58081                 PR gprof/28962
58082                 * libcollector/dispatcher.c (timer_create@@GLIBC_2.3.3): Use
58083                 SYMVER_ATTRIBUTE.
58084                 (timer_create@GLIBC_2.2): Likewise.
58085                 (timer_create@GLIBC_2.2.5): Likewise.
58086                 (pthread_create@@GLIBC_2.1): Likewise.
58087                 (pthread_create@GLIBC_2.0): Likewise.
58088                 * libcollector/iotrace.c (open64@@GLIBC_2.2): Likewise.
58089                 (open64@GLIBC_2.1): Likewise.
58090                 (fopen@@GLIBC_2.1): Likewise.
58091                 (fopen@GLIBC_2.0): Likewise.
58092                 (fclose@@GLIBC_2.1): Likewise.
58093                 (fclose@GLIBC_2.0): Likewise.
58094                 (fdopen@@GLIBC_2.1): Likewise.
58095                 (fdopen@GLIBC_2.0): Likewise.
58096                 (pread@@GLIBC_2.2): Likewise.
58097                 (pread@GLIBC_2.1): Likewise.
58098                 (pwrite@@GLIBC_2.2): Likewise.
58099                 (pwrite@GLIBC_2.1): Likewise.
58100                 (pwrite64@@GLIBC_2.2): Likewise.
58101                 (pwrite64@GLIBC_2.1): Likewise.
58102                 (fgetpos@@GLIBC_2.2): Likewise.
58103                 (fgetpos@GLIBC_2.0): Likewise.
58104                 (fgetpos64@@GLIBC_2.2): Likewise.
58105                 (fgetpos64@GLIBC_2.1): Likewise.
58106                 (fsetpos@@GLIBC_2.2): Likewise.
58107                 (fsetpos@GLIBC_2.0): Likewise.
58108                 (fsetpos64@@GLIBC_2.2): Likewise.
58109                 (fsetpos64@GLIBC_2.1): Likewise.
58110                 * libcollector/linetrace.c (posix_spawn@@GLIBC_2.15): Likewise.
58111                 (posix_spawn@GLIBC_2.2): Likewise.
58112                 (posix_spawn@GLIBC_2.2.5): Likewise.
58113                 (posix_spawnp@@GLIBC_2.15): Likewise.
58114                 (posix_spawnp@GLIBC_2.2): Likewise.
58115                 (posix_spawnp@GLIBC_2.2.5): Likewise.
58116                 (popen@@GLIBC_2.1): Likewise.
58117                 (popen@GLIBC_2.0): Likewise.
58118                 (_popen@@GLIBC_2.1): Likewise.
58119                 (_popen@GLIBC_2.0): Likewise.
58120                 * libcollector/mmaptrace.c (dlopen@@GLIBC_2.1): Likewise.
58121                 (dlopen@GLIBC_2.0): Likewise.
58122                 * libcollector/synctrace.c (pthread_cond_wait@@GLIBC_2.3.2):
58123                 Likewise.
58124                 (pthread_cond_wait@GLIBC_2.0): Likewise.
58125                 (pthread_cond_wait@GLIBC_2.2.5): Likewise.
58126                 (pthread_cond_wait@GLIBC_2.2): Likewise.
58127                 (pthread_cond_timedwait@@GLIBC_2.3.2): Likewise.
58128                 (pthread_cond_timedwait@GLIBC_2.0): Likewise.
58129                 (pthread_cond_timedwait@GLIBC_2.2.5): Likewise.
58130                 (pthread_cond_timedwait@GLIBC_2.2): Likewise.
58131                 (sem_wait@@GLIBC_2.1): Likewise.
58132                 (sem_wait@GLIBC_2.0): Likewise.
58133                 * src/collector_module.h (SYMVER_ATTRIBUTE): New.
58134
58135 2022-03-16  H.J. Lu  <hjl.tools@gmail.com>
58136
58137         gprofng: Don't hardcode -Wno-format-truncation/-Wno-switch
58138         Use -Wno-format-truncation and -Wno-switch only if they are supported.
58139
58140                 PR gprof/28969
58141                 * configure.ac (GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS): New
58142                 AC_SUBST for -Wno-format-truncation.
58143                 (GPROFNG_NO_SWITCH_CFLAGS): New AC_SUBST for -Wno-switch.
58144                 * Makefile.in: Regenerate.
58145                 * configure: Likewise.
58146                 * src/Makefile.am (AM_CFLAGS): Replace -Wno-format-truncation
58147                 and -Wno-switch with GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS and
58148                 GPROFNG_NO_SWITCH_CFLAGS.
58149                 * src/Makefile.in: Regenerate.
58150
58151 2022-03-16  H.J. Lu  <hjl.tools@gmail.com>
58152
58153         gprofng: Don't hardcode -Wno-nonnull-compare
58154         Use -Wno-nonnull-compare only if it is supported.
58155
58156                 PR gprof/28969
58157                 * libcollector/Makefile.am (AM_CFLAGS): Replace
58158                 -Wno-nonnull-compare with GPROFNG_NO_NONNULL_COMPARE_CFLAGS.
58159                 * libcollector/configure.ac (GPROFNG_NO_NONNULL_COMPARE_CFLAGS):
58160                 New AC_SUBST for -Wno-nonnull-compare.
58161                 * libcollector/Makefile.in: Regenerate.
58162                 * libcollector/aclocal.m4: Likewise.
58163                 * libcollector/configure: Likewise.
58164
58165 2022-03-16  H.J. Lu  <hjl.tools@gmail.com>
58166
58167         gprofng: Define ATTRIBUTE_FALLTHROUGH
58168         Define ATTRIBUTE_FALLTHROUGH to __attribute__ ((fallthrough)) only for
58169         GCC 7 or above.
58170
58171                 PR gprof/28969
58172                 * common/gp-defs.h (ATTRIBUTE_FALLTHROUGH): New.
58173                 * src/gp-collect-app.cc (collect::check_args): Replace
58174                 /* FALLTHROUGH */ with ATTRIBUTE_FALLTHROUGH.
58175
58176 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58177
58178         binutils/readelf: handle AMDGPU relocation types
58179         Make readelf recognize AMDGPU relocation types, as documented here:
58180
58181           https://llvm.org/docs/AMDGPUUsage.html#amdgpu-relocation-records
58182
58183         The user-visible change looks like:
58184
58185             -000000000004  000400000001 unrecognized: 1       0000000000000000 SCRATCH_RSRC_DWORD0
58186             -00000000000c  000500000001 unrecognized: 1       0000000000000000 SCRATCH_RSRC_DWORD1
58187             -000000000014  000600000007 unrecognized: 7       0000000000000000 global_var0
58188             -00000000001c  000700000008 unrecognized: 8       0000000000000000 global_var1
58189             -000000000024  000800000009 unrecognized: 9       0000000000000000 global_var2
58190             -00000000002c  00090000000a unrecognized: a       0000000000000000 global_var3
58191             -000000000034  000a0000000b unrecognized: b       0000000000000000 global_var4
58192             +000000000004  000400000001 R_AMDGPU_ABS32_LO 0000000000000000 SCRATCH_RSRC_DWORD0
58193             +00000000000c  000500000001 R_AMDGPU_ABS32_LO 0000000000000000 SCRATCH_RSRC_DWORD1
58194             +000000000014  000600000007 R_AMDGPU_GOTPCREL 0000000000000000 global_var0
58195             +00000000001c  000700000008 R_AMDGPU_GOTPCREL 0000000000000000 global_var1
58196             +000000000024  000800000009 R_AMDGPU_GOTPCREL 0000000000000000 global_var2
58197             +00000000002c  00090000000a R_AMDGPU_REL32_LO 0000000000000000 global_var3
58198             +000000000034  000a0000000b R_AMDGPU_REL32_HI 0000000000000000 global_var4
58199
58200         binutils/ChangeLog:
58201
58202                 * readelf.c (dump_relocations): Handle EM_AMDGPU.
58203
58204         include/ChangeLog:
58205
58206                 * elf/amdgpu.h: Add relocation values.
58207
58208         Change-Id: I2ed4589f4cd37ea11ad2e0cb38d4b682271e1334
58209
58210 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58211
58212         binutils/readelf: build against msgpack, dump NT_AMDGPU_METADATA note contents
58213         The AMDGPU HSA OS ABI (code object v3 and above) defines the
58214         NT_AMDGPU_METADATA ELF note [1].  The content is a msgpack object
58215         describing, among other things, the kernels present in the code object
58216         and how to call them.
58217
58218         I think it would be useful for readelf to be able to display the content
58219         of those notes.  msgpack is a structured format, a bit like JSON, except
58220         not text-based.  It is therefore possible to dump the contents in
58221         human-readable form without knowledge of the specific layout of the
58222         note.
58223
58224         Add configury to binutils to optionally check for the msgpack C library
58225         [2].  Add There is a new --with{,out}-msgpack configure flag, and the actual
58226         library lookup is done using pkg-config.
58227
58228         If msgpack support is enabled, dumping a NT_AMDGPU_METADATA note looks
58229         like:
58230
58231             $ readelf --notes amdgpu-code-object
58232             Displaying notes found in: .note
58233               Owner                Data size        Description
58234               AMDGPU               0x0000040d       NT_AMDGPU_METADATA (code object metadata)
58235                 {
58236                   "amdhsa.kernels": [
58237                     {
58238                       ".args": [
58239                         {
58240                           ".address_space": "global",
58241                           ".name": "out.coerce",
58242                           ".offset": 0,
58243                           ".size": 8,
58244                           ".value_kind": "global_buffer",
58245                         },
58246               <snip>
58247
58248         If msgpack support is disabled, dump the contents as hex, as is done
58249         with notes that are not handled in a special way.  This allows one to
58250         decode the contents manually (maybe using a command-line msgpack
58251         decoder) if really needed.
58252
58253         [1] https://llvm.org/docs/AMDGPUUsage.html#code-object-metadata
58254         [2] https://github.com/msgpack/msgpack-c/tree/c_master
58255
58256         binutils/ChangeLog:
58257
58258                 * Makefile.am (readelf_CFLAGS): New.
58259                 (readelf_LDADD): Add MSGPACK_LIBS.
58260                 * Makefile.in: Re-generate.
58261                 * config.in: Re-generate.
58262                 * configure: Re-generate.
58263                 * configure.ac: Add --with-msgpack flag and check for msgpack
58264                 using pkg-config.
58265                 * readelf.c: Include msgpack.h if HAVE_MSGPACK.
58266                 (print_note_contents_hex): New.
58267                 (print_indents): New.
58268                 (dump_msgpack_obj): New.
58269                 (dump_msgpack): New.
58270                 (print_amdgpu_note): New.
58271                 (process_note): Handle NT_AMDGPU_METADATA note contents.
58272                 Use print_note_contents_hex.
58273
58274         Change-Id: Ia60a654e620bc32dfdb1bccd845594e2af328b84
58275
58276 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58277
58278         binutils/readelf: handle NT_AMDGPU_METADATA note name
58279         Handle the NT_AMDGPU_METADATA note, which is described here:
58280
58281           https://llvm.org/docs/AMDGPUUsage.html#code-object-v3-note-records
58282
58283         As of this patch, just print out the name, not the contents, which is in
58284         the msgpack format.
58285
58286         binutils/ChangeLog:
58287
58288                 * readelf.c (get_amdgpu_elf_note_type): New.
58289                 (process_note): Handle "AMDGPU" notes.
58290
58291         include/ChangeLog:
58292
58293                 * elf/amdgcn.h (NT_AMDGPU_METADATA): New.
58294
58295         Change-Id: Id2dba2e2aeaa55ef7464fb35aee9c7d5f96ddb23
58296
58297 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58298
58299         binutils/readelf: decode AMDGPU-specific e_flags
58300         Decode and print the AMDGPU-specific fields of e_flags, as documented
58301         here:
58302
58303           https://llvm.org/docs/AMDGPUUsage.html#header
58304
58305         That is:
58306
58307          - The specific GPU model
58308          - Whether the xnack and sramecc features are enabled
58309
58310         The result looks like:
58311
58312         -  Flags:                             0x52f
58313         +  Flags:                             0x52f, gfx906, xnack any, sramecc any
58314
58315         The flags for the "HSA" OS ABI are properly versioned and documented on
58316         that page.  But the NONE, PAL and MESA3D OS ABIs are not well documented
58317         nor versioned.  Taking a peek at the LLVM source code, we see that they
58318         encode their flags the same way as HSA v3.  For example, for PAL:
58319
58320           https://github.com/llvm/llvm-project/blob/c8b614cd74a92d85936aed5ac7c642af75ffdc29/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp#L601
58321
58322         So for those other OS ABIs, we read them the same as HSA v3.
58323
58324         binutils/ChangeLog:
58325
58326                 * readelf.c: Include elf/amdgcn.h.
58327                 (decode_AMDGPU_machine_flags): New.
58328                 (get_machine_flags): Handle flags for EM_AMDGPU machine type.
58329
58330         include/ChangeLog:
58331
58332                 * elf/amdgcn.h: Add EF_AMDGPU_MACH_AMDGCN_* and
58333                 EF_AMDGPU_FEATURE_* defines.
58334
58335         Change-Id: Ib5b94df7cae0719a22cf4e4fd0629330e9485c12
58336
58337 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58338
58339         binutils/readelf: handle AMDGPU OS ABIs
58340         When the machine is EM_AMDGPU, handle the various OS ABIs described
58341         here:
58342
58343           https://llvm.org/docs/AMDGPUUsage.html#header
58344
58345         For a binary with the HSA OS ABI, the change looks like:
58346
58347         -  OS/ABI:                            <unknown: 40>
58348         +  OS/ABI:                            AMD HSA
58349
58350         binutils/ChangeLog:
58351
58352                 * readelf.c (get_osabi_name): Handle EM_AMDGPU OS ABIs.
58353
58354         include/ChangeLog:
58355
58356                 * elf/common.h (ELFOSABI_AMDGPU_PAL, ELFOSABI_AMDGPU_MESA3D):
58357                 New.
58358
58359         Change-Id: I383590c390f7dc2fe0f902f50038735626d71863
58360
58361 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58362
58363         opcodes: handle bfd_amdgcn_arch in configure script
58364         There isn't an actual opcodes implementation for the AMDGCN arch (yet),
58365         this is just the bare minimum to get
58366
58367           $ ./configure --target=amdgcn-hsa-amdhsa --disable-gas
58368           $ make all-binutils
58369
58370         working later in this series.
58371
58372         opcodes/ChangeLog:
58373
58374                 * configure.ac: Handle bfd_amdgcn_arch.
58375                 * configure: Re-generate.
58376
58377         Change-Id: Ib7d7c5533a803ed8b2a293e9275f667ed781ce79
58378
58379 2022-03-16  Simon Marchi  <simon.marchi@efficios.com>
58380
58381         bfd: add AMDGCN architecture
58382         Add support for the AMDGCN architecture to BFD.
58383
58384         This is the bare minimum to get
58385
58386           $ ./configure --target=amdgcn-hsa-amdhsa --disable-gas
58387           $ make all-binutils
58388
58389         working later in this series.
58390
58391         The specific AMDGCN models added here are a bit arbitrary, based on
58392         what we intend to initially support in GDB.  This list will need to be
58393         updated in the future anyway.  The complete up-to-date list of existing
58394         AMDGPU models can be found here:
58395
58396           https://llvm.org/docs/AMDGPUUsage.html#processors
58397
58398         The ELF format for this architecture is documented here:
58399
58400           https://llvm.org/docs/AMDGPUUsage.html#elf-code-object
58401
58402         The flags for the "HSA" OS ABI are properly versioned and documented on
58403         that page.  But the NONE, PAL and MESA3D OS ABIs are not well documented
58404         nor versioned.  Taking a peek at the LLVM source code, we see that they
58405         encode their flags the same way as HSA v3.  For example, for PAL:
58406
58407           https://github.com/llvm/llvm-project/blob/c8b614cd74a92d85936aed5ac7c642af75ffdc29/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp#L601
58408
58409         So at least, we know that all AMDGPU objects (of which AMDGCN objects
58410         are a subset of) at the time of writing encode the specific GPU model in
58411         the EF_AMDGPU_MACH field of e_flags.
58412
58413         bfd/ChangeLog:
58414
58415                 * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES):
58416                 Add cpu-amdgcn.c.
58417                 (BFD64_BACKENDS): Add elf64-amdgcn.lo.
58418                 (BFD64_BACKENDS_CFILES): Add elf64-amdgcn.c.
58419                 * Makefile.in: Re-generate.
58420                 * cpu-amdgcn.c: New.
58421                 * elf64-amdgcn.c: New.
58422                 * archures.c (bfd_architecture): Add bfd_arch_amdgcn and related
58423                 mach defines.
58424                 (bfd_amdgcn_arch): New.
58425                 (bfd_archures_list): Add bfd_amdgcn_arch.
58426                 * bfd-in2.h: Re-generate.
58427                 * config.bfd: Handle amdgcn* target.
58428                 * configure.ac: Handle amdgcn_elf64_le_vec.
58429                 * configure: Re-generate.
58430                 * elf-bfd.h (elf_target_id): Add AMDGCN_ELF_DATA.
58431                 * targets.c (amdgcn_elf64_le_vec): New.
58432                 (_bfd_target_vector): Add amdgcn_elf64_le_vec.
58433
58434         include/ChangeLog:
58435
58436                 * elf/amdgpu.h: New.
58437                 * elf/common.h (ELFOSABI_AMDGPU_HSA): Add.
58438
58439         Change-Id: I969f7b14960797e88891c308749a6e341eece5b2
58440
58441 2022-03-16  Nick Clifton  <nickc@redhat.com>
58442
58443         Updated Serbian (for binutils/) and Russian (for gprof/) translations
58444
58445 2022-03-16  Pedro Alves  <pedro@palves.net>
58446
58447         Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver
58448         gdb.fortran/array-slices.exp and gdb.fortran/lbound-ubound.exp were
58449         recently disabled unless testing with the native target, because they
58450         rely on inferior I/O.  However, when testing against gdbserver using
58451         the native-gdbserver/native-extended-gdbserver boards, we do have
58452         access to inferior I/O.
58453
58454         The right way to check whether the board can do I/O, is via checking
58455         the gdb,noinferiorio board variable.  Switch to using that.
58456
58457         And then, tweak the testcases to expect output to appear in
58458         inferior_spawn_id, instead of gdb_spawn_id.  When testing against the
58459         native target, inferior_spawn_id is the same as gdb_spawn_id.  When
58460         testing against gdbserver, it maps to gdbserver_spawn_id.
58461
58462         This exposed a buglet in gdb.fortran/array-slices.f90's show_1d
58463         subroutine -- it was missing printing newline at the end of the
58464         "Expected GDB Output" text, leading to a test timeout.  All other
58465         subroutines end with advance=yes, except this one.  Fix it by using
58466         advance=yes here too.
58467
58468         Change-Id: I4640729f334431cfc24b0917e7d3977b677c6ca5
58469
58470 2022-03-16  GDB Administrator  <gdbadmin@sourceware.org>
58471
58472         Automatic date update in version.in
58473
58474 2022-03-15  Alan Modra  <amodra@gmail.com>
58475
58476         Delete PowerPC macro insn support
58477         Let's hope this stays dead, but it's here as a patch separate from
58478         those that removed use of powerpc_macros just in case it needs to be
58479         resurrected.
58480
58481         include/
58482                 * opcode/ppc.h (struct powerpc_macro): Delete declaration.
58483                 (powerpc_macros, powerpc_num_macros): Likewise..
58484         opcodes/
58485                 * ppc-opc.c (powerpc_macros, powerpc_num_macros): Delete.
58486         gas/
58487                 * config/tc-ppc.c (ppc_macro): Delete function.
58488                 (ppc_macro_hash): Delete.
58489                 (ppc_setup_opcodes, md_assemble): Delete macro support.
58490
58491 2022-03-15  Alan Modra  <amodra@gmail.com>
58492
58493         PowerPC SPE/SPE2 aliases in powerpc_macros
58494                 * ppc-opc.c (powerpc_macros): Move "evsadd", "evssub", "evsabs",
58495                 "evsnabs", "evsneg", "evsmul", "evsdiv", "evscmpgt", "evsgmplt",
58496                 "evsgmpeq", "evscfui", "evscfsi", "evscfuf", "evscfsf", "evsctui",
58497                 "evsctsi", "evsctuf", "evsctsf", "evsctuiz", "evsctsiz",
58498                 "evststgt", "evststlt", "evststeq"..
58499                 (powerpc_opcodes): ..to here.
58500                 (powerpc_macros): Move "evdotphsssi", "evdotphsssia", "evdotpwsssi",
58501                 and "evdotpwsssia"..
58502                 (spe2_opcodes): ..to here.
58503
58504 2022-03-15  Alan Modra  <amodra@gmail.com>
58505
58506         PowerPC VLE extended instructions in powerpc_macros
58507         This moves VLE insn out of the macro table.  "e_slwi" and "e_srwi"
58508         already exist in vle_opcodes as distinct instructions rather than
58509         encodings of e_rlwinm.
58510
58511         opcodes/
58512                 * ppc-opc.c (vle_opcodes): Typo fix e_rlwinm operand.
58513                 Add "e_inslwi", "e_insrwi", "e_rotlwi", "e_rotrwi", "e_clrlwi",
58514                 "e_clrrwi", "e_extlwi", "e_extrwi", and "e_clrlslwi".
58515                 (powerpc_macros): Delete same.  Delete "e_slwi" and "e_srwi" too.
58516         gas/
58517                 * testsuite/gas/ppc/vle-simple-5.d: Update.
58518
58519 2022-03-15  Alan Modra  <amodra@gmail.com>
58520
58521         PowerPC32 extended instructions in powerpc_macros
58522         As for PowerPC64, move instructions to the main opcode table.
58523
58524         opcodes/
58525                 * ppc-opc.c (insert_crwn, extract_crwn, insert_elwn, extract_elwn),
58526                 (insert_erwn, extract_erwn, insert_erwb, extract_erwb),
58527                 (insert_cslwn, extract_cslwb, insert_ilwb, extract_ilwn),
58528                 (insert_irwb, extract_irwn, insert_rrwn, extract_rrwn),
58529                 (insert_slwn, extract_slwn, insert_srwn, extract_srwn): New functions.
58530                 (CRWn, ELWn, ERWn, ERWb, CSLWb, CSLWn, ILWn, ILWb, IRWn, IRWb),
58531                 (RRWn, SLWn, SRWn): Define and add powerpc_operands entries.
58532                 (MMB_MASK, MME_MASK, MSHMB_MASK): Define.
58533                 (powerpc_opcodes): Add "inslwi", "insrwi", "rotrwi", "clrrwi",
58534                 "slwi", "srwi", "extlwi", "extrwi", "sli", "sri" and corresponding
58535                 record (ie. dot suffix) forms.
58536                 (powerpc_macros): Delete same.
58537         gas/
58538                 * testsuite/gas/ppc/476.d: Update.
58539                 * testsuite/gas/ppc/simpshft.d: Update.
58540
58541 2022-03-15  Alan Modra  <amodra@gmail.com>
58542
58543         PowerPC64 extended instructions in powerpc_macros
58544         The extended instructions implemented in powerpc_macros aren't used by
58545         the disassembler.  That means instructions like "sldi r3,r3,2" appear
58546         in disassembly as "rldicr r3,r3,2,61", which is annoying since many
58547         other extended instructions are shown.
58548
58549         Note that some of the instructions moved out of the macro table to the
58550         opcode table won't appear in disassembly, because they are aliases
58551         rather than a subset of the underlying raw instruction.  If enabled,
58552         rotrdi, extrdi, extldi, clrlsldi, and insrdi would replace all
58553         occurrences of rotldi, rldicl, rldicr, rldic and rldimi.  (Or many
58554         occurrences in the case of clrlsldi if n <= b was added to the extract
58555         functions.)
58556
58557         The patch also fixes a small bug in opcode sanity checking.
58558
58559         include/
58560                 * opcode/ppc.h (PPC_OPSHIFT_SH6): Define.
58561         opcodes/
58562                 * ppc-opc.c (insert_erdn, extract_erdn, insert_eldn, extract_eldn),
58563                 (insert_crdn, extract_crdn, insert_rrdn, extract_rrdn),
58564                 (insert_sldn, extract_sldn, insert_srdn, extract_srdn),
58565                 (insert_erdb, extract_erdb, insert_csldn, extract_csldb),
58566                 (insert_irdb, extract_irdn): New functions.
58567                 (ELDn, ERDn, ERDn, RRDn, SRDn, ERDb, CSLDn, CSLDb, IRDn, IRDb):
58568                 Define and add associated powerpc_operands entries.
58569                 (powerpc_opcodes): Add "rotrdi", "srdi", "extrdi", "clrrdi",
58570                 "sldi", "extldi", "clrlsldi", "insrdi" and corresponding record
58571                 (ie. dot suffix) forms.
58572                 (powerpc_macros): Delete same from here.
58573         gas/
58574                 * config/tc-ppc.c (insn_validate): Don't modify value passed
58575                 to operand->insert for PPC_OPERAND_PLUS1 when calculating mask.
58576                 Handle PPC_OPSHIFT_SH6.
58577                 * testsuite/gas/ppc/prefix-reloc.d: Update.
58578                 * testsuite/gas/ppc/simpshft.d: Update.
58579         ld/
58580                 * testsuite/ld-powerpc/elfv2so.d: Update.
58581                 * testsuite/ld-powerpc/notoc.d: Update.
58582                 * testsuite/ld-powerpc/notoc3.d: Update.
58583                 * testsuite/ld-powerpc/tlsdesc2.d: Update.
58584                 * testsuite/ld-powerpc/tlsget.d: Update.
58585                 * testsuite/ld-powerpc/tlsget2.d: Update.
58586                 * testsuite/ld-powerpc/tlsopt5.d: Update.
58587                 * testsuite/ld-powerpc/tlsopt6.d: Update.
58588
58589 2022-03-15  Tom Tromey  <tom@tromey.com>
58590
58591         Do not capture updated 'pc' in add_local_symbols
58592         Simon pointed out that commit 13835d88 ("Use function view when
58593         iterating over block symbols") caused a regression.  The bug is that
58594         the new closure captures 'pc' by reference, but later code updates
58595         this variable -- but the earlier code did not update the callback
58596         structure with the new value.
58597
58598         This patch restores the old behavior by using a new varible name in an
58599         inner scope.
58600
58601 2022-03-15  Jose E. Marchesi  <jose.marchesi@oracle.com>
58602
58603         gprofng: avoid using `fallthrough' attributes
58604         gprofng didn't build with gcc 6.3 due to the usage of __attribute__
58605         ((fallthrough)).  This patch uses /* FALLTHROUGH */ instead.
58606
58607         2022-03-15  Jose E. Marchesi  <jose.marchesi@oracle.com>
58608
58609                 * gprofng/src/gp-collect-app.cc (collect::check_args): Use
58610                 fallthrough comment instead of attribute.
58611
58612 2022-03-15  Tom Tromey  <tromey@adacore.com>
58613
58614         Fix bug in dwarf-mode.el
58615         I noticed that, occasionally, dwarf-mode would think that the objdump
58616         subprocess was still running after it had clearly exited.  I managed
58617         to reliably reproduce this today and learned that a process sentinel
58618         is not guaranteed to be run with the current buffer set to the process
58619         buffer.  This patch fixes the problem.
58620
58621         I've bumped the version number of dwarf-mode.el to make it easier to
58622         install for users who already have an earlier one installed.
58623
58624         I'm checking this in.
58625
58626         2022-03-15  Tom Tromey  <tromey@adacore.com>
58627
58628                 * dwarf-mode.el: Now 1.7.
58629                 (dwarf--sentinel): Switch to the process buffer.
58630
58631 2022-03-15  Andrew Burgess  <aburgess@redhat.com>
58632
58633         gdb/testsuite: rename a proc and fix a typo
58634         Rename a proc in gdb.mi/user-selected-context-sync.exp, I think the
58635         old name was most likely a typo.  The old name
58636         match_re_or_ensure_not_output seems (to me) to imply we're in some way
58637         checking that the regexp was not output.  But that's not what we are
58638         doing, we're checking either for the regexp, or for no output, hence
58639         the new name match_re_or_ensure_no_output.
58640
58641         Additionally, I found a definite typo in one of the comments that I've
58642         also fixed.
58643
58644         I also updated some test names.  These tests (probably due to copy &
58645         paste errors) has 'on MI' on their name, when they were actually
58646         checking CLI output.  For these test I changed the name to use 'on
58647         CLI'.
58648
58649         There should be no change in what is tested after this commit.
58650
58651 2022-03-15  Nick Clifton  <nickc@redhat.com>
58652
58653         gprofng: Add a configure test for clock_gettime and a use of the test in getthrtime.c
58654
58655 2022-03-15  H.J. Lu  <hjl.tools@gmail.com>
58656
58657         gprofng: Don't generate gprofng.info in source
58658         Add info-in-builddir to AUTOMAKE_OPTIONS.
58659
58660                 PR gprof/28967
58661                 * doc/Makefile.am (AUTOMAKE_OPTIONS): Add info-in-builddir.
58662                 * doc/Makefile.in: Regenerate.
58663
58664 2022-03-15  Tiezhu Yang  <yangtiezhu@loongson.cn>
58665
58666         gdb: LoongArch: fix failed testcases in gdb.base/align-c.exp
58667         When execute the following command on LoongArch:
58668
58669           make check-gdb TESTS="gdb.base/align-c.exp"
58670
58671         there exist some failed testcases:
58672
58673           ...
58674           FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_float)
58675           FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_double)
58676           FAIL: gdb.base/align-c.exp: print _Alignof(struct align_pair_long_double_x_long_double)
58677           ...
58678
58679         According to LoongArch ELF ABI specification [1], set the target data types
58680         of floating-point to fix the above failed testcases.
58681
58682         [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
58683
58684 2022-03-15  GDB Administrator  <gdbadmin@sourceware.org>
58685
58686         Automatic date update in version.in
58687
58688 2022-03-14  Andrew Burgess  <aburgess@redhat.com>
58689
58690         gdb/python/mi: create MI commands using python
58691         This commit allows a user to create custom MI commands using Python
58692         similarly to what is possible for Python CLI commands.
58693
58694         A new subclass of mi_command is defined for Python MI commands,
58695         mi_command_py. A new file, gdb/python/py-micmd.c contains the logic
58696         for Python MI commands.
58697
58698         This commit is based on work linked too from this mailing list thread:
58699
58700           https://sourceware.org/pipermail/gdb/2021-November/049774.html
58701
58702         Which has also been previously posted to the mailing list here:
58703
58704           https://sourceware.org/pipermail/gdb-patches/2019-May/158010.html
58705
58706         And was recently reposted here:
58707
58708           https://sourceware.org/pipermail/gdb-patches/2022-January/185190.html
58709
58710         The version in this patch takes some core code from the previously
58711         posted patches, but also has some significant differences, especially
58712         after the feedback given here:
58713
58714           https://sourceware.org/pipermail/gdb-patches/2022-February/185767.html
58715
58716         A new MI command can be implemented in Python like this:
58717
58718           class echo_args(gdb.MICommand):
58719               def invoke(self, args):
58720                   return { 'args': args }
58721
58722           echo_args("-echo-args")
58723
58724         The 'args' parameter (to the invoke method) is a list
58725         containing (almost) all command line arguments passed to the MI
58726         command (--thread and --frame are handled before the Python code is
58727         called, and removed from the args list).  This list can be empty if
58728         the MI command was passed no arguments.
58729
58730         When used within gdb the above command produced output like this:
58731
58732           (gdb)
58733           -echo-args a b c
58734           ^done,args=["a","b","c"]
58735           (gdb)
58736
58737         The 'invoke' method of the new command must return a dictionary.  The
58738         keys of this dictionary are then used as the field names in the mi
58739         command output (e.g. 'args' in the above).
58740
58741         The values of the result returned by invoke can be dictionaries,
58742         lists, iterators, or an object that can be converted to a string.
58743         These are processed recursively to create the mi output.  And so, this
58744         is valid:
58745
58746           class new_command(gdb.MICommand):
58747               def invoke(self,args):
58748                   return { 'result_one': { 'abc': 123, 'def': 'Hello' },
58749                            'result_two': [ { 'a': 1, 'b': 2 },
58750                                            { 'c': 3, 'd': 4 } ] }
58751
58752         Which produces output like:
58753
58754           (gdb)
58755           -new-command
58756           ^done,result_one={abc="123",def="Hello"},result_two=[{a="1",b="2"},{c="3",d="4"}]
58757           (gdb)
58758
58759         I have required that the fields names used in mi result output must
58760         match the regexp: "^[a-zA-Z][-_a-zA-Z0-9]*$" (without the quotes).
58761         This restriction was never written down anywhere before, but seems
58762         sensible to me, and we can always loosen this rule later if it proves
58763         to be a problem.  Much harder to try and add a restriction later, once
58764         people are already using the API.
58765
58766         What follows are some details about how this implementation differs
58767         from the original patch that was posted to the mailing list.
58768
58769         In this patch, I have changed how the lifetime of the Python
58770         gdb.MICommand objects is managed.  In the original patch, these object
58771         were kept alive by an owned reference within the mi_command_py object.
58772         As such, the Python object would not be deleted until the
58773         mi_command_py object itself was deleted.
58774
58775         This caused a problem, the mi_command_py were held in the global mi
58776         command table (in mi/mi-cmds.c), which, as a global, was not cleared
58777         until program shutdown.  By this point the Python interpreter has
58778         already been shutdown.  Attempting to delete the mi_command_py object
58779         at this point was causing GDB to try and invoke Python code after
58780         finalising the Python interpreter, and we would crash.
58781
58782         To work around this problem, the original patch added code in
58783         python/python.c that would search the mi command table, and delete the
58784         mi_command_py objects before the Python environment was finalised.
58785
58786         In contrast, in this patch, I have added a new global dictionary to
58787         the gdb module, gdb._mi_commands.  We already have several such global
58788         data stores related to pretty printers, and frame unwinders.
58789
58790         The MICommand objects are placed into the new gdb.mi_commands
58791         dictionary, and it is this reference that keeps the objects alive.
58792         When GDB's Python interpreter is shut down gdb._mi_commands is deleted,
58793         and any MICommand objects within it are deleted at this point.
58794
58795         This change avoids having to make the mi_cmd_table global, and walk
58796         over it from within GDB's python related code.
58797
58798         This patch handles command redefinition entirely within GDB's python
58799         code, though this does impose one small restriction which is not
58800         present in the original code (detailed below), I don't think this is a
58801         big issue.  However, the original patch relied on being able to
58802         finish executing the mi_command::do_invoke member function after the
58803         mi_command object had been deleted.  Though continuing to execute a
58804         member function after an object is deleted is well defined, it is
58805         also (IMHO) risky, its too easy for someone to later add a use of the
58806         object without realising that the object might sometimes, have been
58807         deleted.  The new patch avoids this issue.
58808
58809         The one restriction that is added to avoid this, is that an MICommand
58810         object can't be reinitialised with a different command name, so:
58811
58812           (gdb) python cmd = MyMICommand("-abc")
58813           (gdb) python cmd.__init__("-def")
58814           can't reinitialize object with a different command name
58815
58816         This feels like a pretty weird edge case, and I'm happy to live with
58817         this restriction.
58818
58819         I have also changed how the memory is managed for the command name.
58820         In the most recently posted patch series, the command name is moved
58821         into a subclass of mi_command, the python mi_command_py, which
58822         inherits from mi_command is then free to use a smart pointer to manage
58823         the memory for the name.
58824
58825         In this patch, I leave the mi_command class unchanged, and instead
58826         hold the memory for the name within the Python object, as the lifetime
58827         of the Python object always exceeds the c++ object stored in the
58828         mi_cmd_table.  This adds a little more complexity in py-micmd.c, but
58829         leaves the mi_command class nice and simple.
58830
58831         Next, this patch adds some extra functionality, there's a
58832         MICommand.name read-only attribute containing the name of the command,
58833         and a read-write MICommand.installed attribute that can be used to
58834         install (make the command available for use) and uninstall (remove the
58835         command from the mi_cmd_table so it can't be used) the command.  This
58836         attribute will be automatically updated if a second command replaces
58837         an earlier command.
58838
58839         This patch adds additional error handling, and makes more use the
58840         gdbpy_handle_exception function.
58841
58842         Co-Authored-By: Jan Vrany <jan.vrany@labware.com>
58843
58844 2022-03-14  Andrew Burgess  <aburgess@redhat.com>
58845
58846         gdb/gdbarch: compare some fields against 0 verify_gdbarch
58847         After the previous commit, which removes the predicate function
58848         gdbarch_register_type_p, I noticed that the gdbarch->register_type
58849         field was not checked at in the verify_gdbarch function.
58850
58851         More than not being checked, the field wasn't mentioned at all.
58852
58853         I find this strange, I would expect that every field would at least be
58854         mentioned - we already generate comments for some fields saying that
58855         this field is _not_ being checked, so the fact that this field isn't
58856         being checked looks (to me), like this field is somehow slipping
58857         through the cracks.
58858
58859         The comment at the top of gdbarch-components.py tries to explain how
58860         the validation is done.  I didn't understand this comment completely,
58861         but, I think this final sentence:
58862
58863           "Otherwise, the check is done against 0 (really NULL for function
58864           pointers, but same idea)."
58865
58866         Means that, if non of the other cases apply, then the field should be
58867         checked against 0, with 0 indicating that the field is invalid (was
58868         not set by the tdep code).  However, this is clearly not being done.
58869
58870         Looking in gdbarch.py at the code to generate verify_gdbarch we do
58871         find that there is a case that is not handled, the case where the
58872         'invalid' field is set true True, but non of the other cases apply.
58873
58874         In this commit I propose two changes:
58875
58876          1. Handle the case where the 'invalid' field of a property is set to
58877          True, this should perform a check for the field of gdbarch still
58878          being set to 0, and
58879
58880          2. If the if/else series that generates verify_gdbarch doesn't handle
58881          a property then we should raise an exception.  This means that if a
58882          property is added which isn't handled, we should no longer silently
58883          ignore it.
58884
58885         After doing this, I re-generated the gdbarch files and saw that the
58886         following gdbarch fields now had new validation checks:
58887
58888           register_type
58889           believe_pcc_promotion
58890           register_to_value
58891           value_to_register
58892           frame_red_zone_size
58893           displaced_step_restore_all_in_ptid
58894           solib_symbols_extension
58895
58896         Looking at how these are currently set in the various -tdep.c files, I
58897         believe the only one of these that is required to be set for all
58898         architectures is the register_type field.
58899
58900         And so, for all of the other fields, I've changed the property
58901         definition on gdbarch-components.py, setting the 'invalid' field to
58902         False.
58903
58904         Now, after re-generation, the register_type field is checked against
58905         0, thus an architecture that doesn't set_gdbarch_register_type will
58906         now fail during validation.  For all the other fields we skip the
58907         validation, in which case, it is find for an architecture to not set
58908         this field.
58909
58910         My expectation is that there should be no user visible changes after
58911         this commit.  Certainly for all fields except register_type, all I've
58912         really done is cause some extra comments to be generated, so I think
58913         that's clearly fine.
58914
58915         For the register_type field, my claim is that any architecture that
58916         didn't provide this would fail when creating its register cache, and I
58917         couldn't spot an architecture that doesn't provide this hook.  As
58918         such, I think this change should be fine too.
58919
58920 2022-03-14  Andrew Burgess  <aburgess@redhat.com>
58921
58922         gdb/gdbarch: remove the predicate function for gdbarch_register_type
58923         I don't believe that the gdbarch_register_type_p predicate is called
58924         anywhere in GDB, and the gdbarch_register_type function is called
58925         without checking the gdbarch_register_type_p predicate function
58926         everywhere it is used, for example in
58927         init_regcache_descr (regcache.c).
58928
58929         My claim is that the gdbarch_register_type function is required for
58930         every architecture, and GDB will not work if this function is not
58931         supplied.
58932
58933         And so, in this commit, I remove the 'predicate=True' from
58934         gdbarch-components.py for the 'register_type' field, and regenerate
58935         the gdbarch files.
58936
58937         There should be no user visible changes after this commit.
58938
58939 2022-03-14  Patrick Monnerat  <patrick@monnerat.net>
58940
58941         Replace deprecated_target_wait_hook by observers
58942         Commit b60cea7 (Make target_wait options use enum flags) broke
58943         deprecated_target_wait_hook usage: there's a commit comment telling
58944         this hook has not been converted.
58945
58946         Rather than trying to mend it, this patch replaces the hook by two
58947         target_wait observers:
58948
58949         target_pre_wait (ptid_t ptid)
58950         target_post_wait (ptid_t event_ptid)
58951
58952         Upon target_wait entry, target_pre_wait is notified with the ptid
58953         passed to target_wait. Upon exit, target_post_wait is notified with
58954         the event ptid returned by target_wait. Should an exception occur,
58955         event_ptid is null_ptid.
58956
58957         This change benefits to Insight (out-of-tree): there's no real use of the
58958         late hook in gdb itself.
58959
58960 2022-03-14  Tom Tromey  <tromey@adacore.com>
58961
58962         Correctly print subrange types in generic_value_print
58963         I noticed that generic_value_print assumes that a subrange type is
58964         always a subrange of an integer type.  However, this isn't necessarily
58965         the case.  In Ada, for example, one has subranges of character and
58966         enumeration types.
58967
58968         This code isn't often exercised, I think, because languages with real
58969         subrange types tend to implement their own printers.  However, it
58970         still seemed worth fixing.
58971
58972 2022-03-14  Luis Machado  <luis.machado@arm.com>
58973
58974         [aarch64/arm] Properly extract the return value returned in memory
58975         When running gdb.cp/non-trivial-retval.exp, the following shows up for
58976         both aarch64-linux and armhf-linux:
58977
58978         Breakpoint 3, f1 (i1=23, i2=100) at src/gdb/testsuite/gdb.cp/non-trivial-retval.cc:35
58979         35        A a;
58980         (gdb) finish
58981         Run till exit from #0  f1 (i1=23, i2=100) at src/gdb/testsuite/gdb.cp/non-trivial-retval.cc:35
58982         main () at /src/gdb/testsuite/gdb.cp/non-trivial-retval.cc:163
58983         163       B b = f2 (i1, i2);
58984         Value returned is $6 = {a = -11952}
58985         (gdb)
58986
58987         The return value should be {a = 123} instead. This happens because the
58988         backends don't extract the return value from the correct location. GDB should
58989         fetch a pointer to the memory location from X8 for aarch64 and r0 for armhf.
58990
58991         With the patch, gdb.cp/non-trivial-retval.exp has full passes on
58992         aarch64-linux and armhf-linux on Ubuntu 20.04/18.04.
58993
58994         The problem only shows up with the "finish" command. The "call" command
58995         works correctly and displays the correct return value.
58996
58997         This is also related to PR gdb/28681
58998         (https://sourceware.org/bugzilla/show_bug.cgi?id=28681) and fixes FAIL's in
58999         gdb.ada/mi_var_array.exp.
59000
59001         A new testcase is provided, and it exercises GDB's ability to "finish" a
59002         function that returns a large struct (> 16 bytes) and display the
59003         contents of this struct correctly. This has always been incorrect for
59004         these backends, but no testcase exercised this particular scenario.
59005
59006 2022-03-14  GDB Administrator  <gdbadmin@sourceware.org>
59007
59008         Automatic date update in version.in
59009
59010 2022-03-13  Alan Modra  <amodra@gmail.com>
59011
59012         PR28959, obdump doesn't disassemble mftb instruction
59013         Without a -M cpu option given, powerpc objdump defaults currently to
59014         -Mpower10 but -Many is also given.  Commit 1ff6a3b8e562 regressed
59015         -Many disassembly of instructions that are encoded differently
59016         depending on cpu, such as mftb which has pre- and post-power4
59017         encodings.
59018
59019                 PR 28959
59020                 * ppc-dis.c (lookup_powerpc): Revert 2021-05-28 change.  Instead
59021                 only look at deprecated PPC_OPCODE_RAW bit when -Many.
59022
59023 2022-03-13  GDB Administrator  <gdbadmin@sourceware.org>
59024
59025         Automatic date update in version.in
59026
59027 2022-03-12  Tom Tromey  <tom@tromey.com>
59028
59029         Relax regexp in gdb.rust/unsized.exp
59030         With nightly rustc, gdb.rust/unsized.exp fails:
59031
59032             (gdb) ptype *us
59033             Structure has no component named operator*.
59034
59035         rustc changed to emit a bit more debug info for unsized types.
59036         Because the original test is just to make sure that ptype of an
59037         unsized array looks right, this patch relaxes the regexp and changes
59038         the expression.  I think this keeps the original test meaning, but
59039         also works with nightly.  I also tested stable and 1.48.
59040
59041 2022-03-12  GDB Administrator  <gdbadmin@sourceware.org>
59042
59043         Automatic date update in version.in
59044
59045 2022-03-11  Tom Tromey  <tromey@adacore.com>
59046
59047         Avoid crash with cross-linux core file
59048         An internal test case creates a core file using gcore, then restarts
59049         gdb with that core.  When run with a cross-linux gdb (in this case,
59050         x86-64 host with ppc64-linux target), the test fails:
59051
59052             | (gdb) core core
59053             | [New LWP 18437]
59054             | warning: `/lib64/libc.so.6': Shared library architecture unknown is not compatible with target architecture powerpc:common64.
59055             | warning: Could not load shared library symbols for /lib64/ld64.so.1.
59056             | Do you need "set solib-search-path" or "set sysroot"?
59057             | ../../src/gdb/gdbarch.c:3388: internal-error: int gdbarch_elf_make_msymbol_special_p(gdbarch*): Assertion `gdbarch != NULL' failed.
59058             | A problem internal to GDB has been detected,
59059             | further debugging may prove unreliable.
59060             | Quit this debugging session? (y or n) y
59061
59062         What's happening here is that the core file lists some shared
59063         libraries.  These aren't available via the solib search path, and so
59064         gdb finds the local (x86-64) libraries.  This is not ideal, but on the
59065         other hand, it is what was asked for -- while the test does set
59066         solib-search-path, it does not set the sysroot.
59067
59068         But, because gdb isn't configured to handle these libraries, it
59069         crashes.
59070
59071         It seems to me that it's better to avoid the crash by having
59072         solib_bfd_open fail in the case where a library is incompatible.  That
59073         is what this patch does.  Now it looks like:
59074
59075             | [New LWP 15488]
59076             | Error while mapping shared library sections:
59077             | `/lib64/libc.so.6': Shared library architecture unknown is not compatible with target architecture powerpc:common64.
59078
59079         ... and does not crash gdb.
59080
59081         I don't have a good setup for testing this using dejagnu, so I don't
59082         know whether an existing gdb test covers this scenario.
59083
59084 2022-03-11  Andrew Burgess  <aburgess@redhat.com>
59085
59086         gdb/testsuite: remove duplicates from gdb.base/stap-probe.exp
59087         Remove the duplicate test names from gdb.base/stap-probe.exp, this is
59088         done by actually passing a unique test name in a couple of
59089         places (rather than using the command as the test name), and in
59090         another couple of places, a test has a duplicate name due to a cut &
59091         paste error, which I've fixed.
59092
59093         There's no change in what is actually being tested after this commit.
59094
59095 2022-03-11  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
59096
59097         gprofng: a new GNU profiler
59098         top-level
59099                 * Makefile.def: Add gprofng module.
59100                 * configure.ac: Add --enable-gprofng option.
59101                 * src-release.sh: Add gprofng.
59102                 * Makefile.in: Regenerate.
59103                 * configure: Regenerate.
59104                 * gprofng: New directory.
59105
59106         binutils
59107                 * MAINTAINERS: Add gprofng maintainer.
59108                 * README-how-to-make-a-release: Add gprofng.
59109
59110         include.
59111                 * collectorAPI.h: New file.
59112                 * libcollector.h: New file.
59113                 * libfcollector.h: New file.
59114
59115 2022-03-11  GDB Administrator  <gdbadmin@sourceware.org>
59116
59117         Automatic date update in version.in
59118
59119 2022-03-10  Aaron Merey  <amerey@redhat.com>
59120
59121         gdb/auto-load: Remove repeating "auto-load" from debug message
59122         Remove "auto-load:" from a format string passed to auto_load_debug_printf.
59123         It is unnecessary since this function will prefix the string with "[auto-load]"
59124         when printing it.
59125
59126 2022-03-10  Tom Tromey  <tromey@adacore.com>
59127
59128         Change how "print/x" displays floating-point value
59129         Currently, "print/x" will display a floating-point value by first
59130         casting it to an integer type.  This yields weird results like:
59131
59132             (gdb) print/x 1.5
59133             $1 = 0x1
59134
59135         This has confused users multiple times -- see PR gdb/16242, where
59136         there are several dups.  I've also seen some confusion from this
59137         internally at AdaCore.
59138
59139         The manual says:
59140
59141             'x'
59142                  Regard the bits of the value as an integer, and print the integer
59143                  in hexadecimal.
59144
59145         ... which seems more useful.  So, perhaps what happened is that this
59146         was incorrectly implemented (or maybe correctly implemented and then
59147         regressed, as there don't seem to be any tests).
59148
59149         This patch fixes the bug.
59150
59151         There was a previous discussion where we agreed to preserve the old
59152         behavior:
59153
59154             https://sourceware.org/legacy-ml/gdb-patches/2017-06/msg00314.html
59155
59156         However, I think it makes more sense to follow the manual.
59157
59158         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16242
59159
59160 2022-03-10  Tom Tromey  <tromey@adacore.com>
59161
59162         Simplify the ui-out progress API
59163         I noticed that 'progress' is a method on ui-out, but it seems to me
59164         that it would be better if the only API were via the progress_meter
59165         class.  This patch makes this change, changing progress to be a method
59166         on the meter itself.
59167
59168 2022-03-10  Andrew Burgess  <aburgess@redhat.com>
59169
59170         gdb/gdbarch: fix typo in gdbarch-components.py
59171         Fixes a minor typo, in a comment, in the gdbarch-components.py script.
59172
59173         There should be no user visible changes after this commit.
59174
59175 2022-03-10  Lancelot SIX  <lancelot.six@amd.com>
59176
59177         Process exit status is leader exit status testcase
59178         This adds a multi-threaded testcase that has all threads in the
59179         process exit with a different exit code, and ensures that GDB reports
59180         the thread group leader's exit status as the whole-process exit
59181         status.  Before this set of patches, this would randomly report the
59182         exit code of some other thread, and thus fail.
59183
59184         Tested on Linux-x86_64, native and gdbserver.
59185
59186         Co-Authored-By: Pedro Alves <pedro@palves.net>
59187         Change-Id: I30cba2ff4576fb01b5169cc72667f3268d919557
59188
59189 2022-03-10  Pedro Alves  <pedro@palves.net>
59190
59191         Re-add zombie leader on exit, gdbserver/linux
59192         Same as the previous patch, but for GDBserver.
59193
59194         In summary, the current zombie leader detection code in linux-low.cc
59195         has a race -- if a multi-threaded inferior exits just before
59196         check_zombie_leaders finds that the leader is now zombie via checking
59197         /proc/PID/status, check_zombie_leaders deletes the leader, assuming we
59198         won't get an event for that exit (which we won't in some scenarios,
59199         but not in this one), which is a false-positive scenario, where the
59200         whole process is simply exiting.  Later when we see the last LWP in
59201         our list exit, we report that LWP's exit status as exit code, even
59202         though for the (real) parent process, the exit code that counts is the
59203         child's leader thread's exit code.
59204
59205         Like for GDB, the solution here is to:
59206
59207            - only report whole-process exit events for the leader.
59208            - re-add the leader back to the LWP list when we finally see it
59209              exit.
59210
59211         Change-Id: Id2d7bbb51a415534e1294fff1d555b7ecaa87f1d
59212
59213 2022-03-10  Pedro Alves  <pedro@palves.net>
59214
59215         Re-add zombie leader on exit, gdb/linux
59216         The current zombie leader detection code in linux-nat.c has a race --
59217         if a multi-threaded inferior exits just before check_zombie_leaders
59218         finds that the leader is now zombie via checking /proc/PID/status,
59219         check_zombie_leaders deletes the leader, assuming we won't get an
59220         event for that exit (which we won't in some scenarios, but not in this
59221         one).  That might seem mostly harmless, but it has some downsides:
59222
59223          - later when we continue pulling events out of the kernel, we will
59224            collect the exit event of the non-leader threads, and once we see
59225            the last lwp in our list exit, we return _that_ lwp's exit code as
59226            whole-process exit code to infrun, instead of the leader's exit
59227            code.
59228
59229          - this can cause a hang in stop_all_threads in infrun.c.  Say there
59230            are 2 threads in the process.  stop_all_threads stops each of those
59231            threads, and then waits for two stop or exit events, one for each
59232            thread.  If the whole process exits, and check_zombie_leaders hits
59233            the false-positive case, linux-nat.c will only return one event to
59234            GDB (the whole-process exit returned when we see the last thread,
59235            the non-leader thread, exit), making stop_all_threads hang forever
59236            waiting for a second event that will never come.
59237
59238         However, in this false-positive scenario, where the whole process is
59239         exiting, as opposed to just the leader (with pthread_exit(), for
59240         example), we _will_ get an exit event shortly for the leader, after we
59241         collect the exit event of all the other non-leader threads.  Or put
59242         another way, we _always_ get an event for the leader after we see it
59243         become zombie.
59244
59245         I tried a number of approaches to fix this:
59246
59247         #1 - My first thought to address the race was to make GDB always
59248         report the whole-process exit status for the leader thread, not for
59249         whatever is the last lwp in the list.  We _always_ get a final exit
59250         (or exec) event for the leader, and when the race triggers, we're not
59251         collecting it.
59252
59253         #2 - My second thought was to try to plug the race in the first place.
59254
59255         I thought of making GDB call waitpid/WNOHANG for all non-leader
59256         threads immediately when the zombie leader is detected, assuming there
59257         would be an exit event pending for each of them waiting to be
59258         collected.  Turns out that that doesn't work -- you can see the leader
59259         become zombie _before_ the kernel kills all other threads.  Waitpid in
59260         that small time window returns 0, indicating no-event.  Thankfully we
59261         hit that race window all the time, which avoided trading one race for
59262         another.  Looking at the non-leader thread's status in /proc doesn't
59263         help either, the threads are still in running state for a bit, for the
59264         same reason.
59265
59266         #3 - My next attempt, which seemed promising, was to synchronously
59267         stop and wait for the stop for each of the non-leader threads.  For
59268         the scenario in question, this will collect all the exit statuses of
59269         the non-leader threads.  Then, if we are left with only the zombie
59270         leader in the lwp list, it means we either have a normal while-process
59271         exit or an exec, in which case we should not delete the leader.  If
59272         _only_ the leader exited, like in gdb.threads/leader-exit.exp, then
59273         after pausing threads, we will still have at least one live non-leader
59274         thread in the list, and so we delete the leader lwp.  I got this
59275         working and polished, and it was only after staring at the kernel code
59276         to convince myself that this would really work (and it would, for the
59277         scenario I considered), that I realized I had failed to account for
59278         one scenario -- if any non-leader thread is _already_ stopped when
59279         some thread triggers a group exit, like e.g., if you have some threads
59280         stopped and then resume just one thread with scheduler-locking or
59281         non-stop, and that thread exits the process.  I also played with
59282         PTRACE_EVENT_EXIT, see if it would help in any way to plug the race,
59283         and I couldn't find a way that it would result in any practical
59284         difference compared to looking at /proc/PID/status, with respect to
59285         having a race.
59286
59287         So I concluded that there's no way to plug the race, we just have to
59288         deal with it.  Which means, going back to approach #1.  That is the
59289         approach taken by this patch.
59290
59291         Change-Id: I6309fd4727da8c67951f9cea557724b77e8ee979
59292
59293 2022-03-10  Pedro Alves  <pedro@palves.net>
59294
59295         gdbserver: Reindent check_zombie_leaders
59296         This fixes the indentation of
59297         linux_process_target::check_zombie_leaders, which will help with
59298         keeping its comments in sync with the gdb/linux-nat.c counterpart.
59299
59300         Change-Id: I37332343bd80423d934249e3de2d04feefad1891
59301
59302 2022-03-10  Pedro Alves  <pedro@palves.net>
59303
59304         gdbserver: Reorganize linux_process_target::filter_event
59305         Reorganize linux-low.cc:linux_process_target::filter_event such that
59306         all the handling for events for LWPs not in the LWP list is together.
59307         This helps make a following patch clearer.  The comments and debug
59308         messages have also been tweaked to have them synchronized with the GDB
59309         counterpart.
59310
59311         Change-Id: If9019635f63a846607cfda44b454b4254a404019
59312
59313 2022-03-10  Pedro Alves  <pedro@palves.net>
59314
59315         gdb: Reorganize linux_nat_filter_event
59316         Reorganize linux-nat.c:linux_nat_filter_event such that all the
59317         handling for events for LWPs not in the LWP list is together.  This
59318         helps make a following patch clearer.  The comments and debug messages
59319         have also been tweaked - the end goal is to have them synchronized
59320         with the gdbserver counterpart.
59321
59322         Change-Id: I8586d8dcd76d8bd3795145e3056fc660e3b2cd22
59323
59324 2022-03-10  Pedro Alves  <pedro@palves.net>
59325
59326         Fix gdb.threads/current-lwp-dead.exp race
59327         If we make GDB report the process EXIT event for the leader thread, as
59328         will be done in a latter patch of this series, then
59329         gdb.threads/current-lwp-dead.exp starts failing:
59330
59331          (gdb) break fn_return
59332          Breakpoint 2 at 0x5555555551b5: file /home/pedro/rocm/gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.threads/current-lwp-dead.c, line 45.
59333          (gdb) continue
59334          Continuing.
59335          [New LWP 2138466]
59336          [Inferior 1 (process 2138459) exited normally]
59337          (gdb) FAIL: gdb.threads/current-lwp-dead.exp: continue to breakpoint: fn_return (the program exited)
59338
59339         The inferior exit reported is actually correct.  The main thread has
59340         indeed exited, and that's the thread that has the right exit code to
59341         report to the user, as that's the exit code that is reported to the
59342         program's parent.  In this case, GDB managed to collect the exit code
59343         for the leader thread before reaping the other thread, because in
59344         reality, the testcase isn't creating standard threads, it is using raw
59345         clone, and the new clones are put in their own thread group.
59346
59347         Fix it by making the main "thread" not exit until the scenario we're
59348         exercising plays out.  Also, run the program to completion for
59349         completeness.
59350
59351         The original program really wanted the leader thread to exit before
59352         the fn_return function was reached -- it was important that the
59353         current thread as pointed by inferior_ptid was gone when infrun got
59354         the breakpoint event.  I've tweaked the testcase to ensure that that
59355         condition is still held, though it is no longer the main thread that
59356         exits.  This required a bit of synchronization between the threads,
59357         which required using CLONE_VM unconditionally.  The #ifdef guards were
59358         added as a fix for
59359         https://sourceware.org/bugzilla/show_bug.cgi?id=11214, though I don't
59360         think they were necessary because the program is not using TLS.  If it
59361         turns out they were necessary, we can link the testcase with "-z now"
59362         instead, which was mentioned as an alternative workaround in that
59363         Bugzilla.
59364
59365         Change-Id: I7be2f0da4c2fe8f80a60bdde5e6c623d8bd5a0aa
59366
59367 2022-03-10  Pedro Alves  <pedro@palves.net>
59368
59369         Fix gdb.threads/clone-new-thread-event.exp race
59370         If we make GDB report the process EXIT event for the leader thread,
59371         instead of whatever is the last thread in the LWP list, as will be
59372         done in a latter patch of this series, then
59373         gdb.threads/current-lwp-dead.exp starts failing:
59374
59375          (gdb) FAIL: gdb.threads/clone-new-thread-event.exp: catch SIGUSR1 (the program exited)
59376
59377         This is a testcase race -- the main thread does not wait for the
59378         spawned clone "thread" to finish before exiting, so the main program
59379         may exit before the second thread is scheduled and reports its
59380         SIGUSR1.  With the change to make GDB report the EXIT for the leader,
59381         the race is 100% reproducible by adding a sleep(), like so:
59382
59383          --- c/gdb/testsuite/gdb.threads/clone-new-thread-event.c
59384          +++ w/gdb/testsuite/gdb.threads/clone-new-thread-event.c
59385          @@ -51,6 +51,7 @@ local_gettid (void)
59386           static int
59387           fn (void *unused)
59388           {
59389          +  sleep (1);
59390             tkill (local_gettid (), SIGUSR1);
59391             return 0;
59392           }
59393
59394         Resulting in:
59395
59396          Breakpoint 1, main (argc=1, argv=0x7fffffffd418) at gdb.threads/clone-new-thread-event.c:65
59397          65        stack = malloc (STACK_SIZE);
59398          (gdb) continue
59399          Continuing.
59400          [New LWP 3715562]
59401          [Inferior 1 (process 3715555) exited normally]
59402          (gdb) FAIL: gdb.threads/clone-new-thread-event.exp: catch SIGUSR1 (the program exited)
59403
59404         That inferior exit reported is actually correct.  The main thread has
59405         indeed exited, and that's the thread that has the right exit code to
59406         report to the user, as that's the exit code that is reported to the
59407         program's parent.  In this case, GDB managed to collect the exit code
59408         for the leader thread before reaping the other thread, because in
59409         reality, the testcase isn't creating standard threads, it is using raw
59410         clone, and the new clones are put in their own thread group.
59411
59412         Fix it by making the main thread wait for the child to exit.  Also,
59413         run the program to completion for completeness.
59414
59415         Change-Id: I315cd3dc2b9e860395dcab9658341ea868d7a6bf
59416
59417 2022-03-10  Pedro Alves  <pedro@palves.net>
59418
59419         Fix gdbserver/linux target_waitstatus logging assert
59420         Turning on debug output in gdbserver leads to an assertion failure if
59421         gdbserver reports a non-signal event:
59422
59423             [threads] wait_1: LWP 3273770: extended event with waitstatus status->kind = EXECD, execd_pathname = gdb.threads/non-ldr-exc-1/non-ldr-exc-1
59424             [threads] wait_1: Hit a non-gdbserver trap event.
59425           ../../src/gdbserver/../gdb/target/waitstatus.h:365: A problem internal to GDBserver has been detected.
59426           sig: Assertion `m_kind == TARGET_WAITKIND_STOPPED || m_kind == TARGET_WAITKIND_SIGNALLED' failed.
59427
59428         Fix it in the obvious way, using target_waitstatus::to_string(),
59429         resulting in, for example:
59430
59431           [threads] wait_1: ret = LWP 1542412.1542412, status->kind = STOPPED, sig = GDB_SIGNAL_TRAP
59432
59433         Change-Id: Ia4832f9b4fa39f4af67fcaf21fd4d909a285a645
59434
59435 2022-03-10  Nick Clifton  <nickc@redhat.com>
59436
59437         Add option to objdump/readelf to disable access to debuginfod servers.
59438                 * dwarf.c (use_debuginfod): New variable.  Set to 1.
59439                 (load_separate_debug_info): Only call
59440                 debuginfod_fetch_separate_debug_info is use_debuginfod is true.
59441                 (dwarf_select_sections_by_names): Add do-not-use-debuginfod and
59442                 use-debuginfod options.
59443                 (dwarf_select_sections_by_letters): Add D and E options.
59444                 * dwarf.h (use_debuginfod): New extern.
59445                 * objdump.c (usage): Mention the new options.
59446                 * readelf.c (usage): Likewise.
59447                 * doc/binutils.texi: Document the new options.
59448                 * doc/debug-options.texi: Describe the new options.
59449                 * NEWS: Mention the new feature.
59450                 * testsuite/binutils-all/debuginfod.exp: Add tests of the new
59451                 options.
59452
59453 2022-03-10  Alan Modra  <amodra@gmail.com>
59454
59455         Re: ld: Add a before_plugin_all_symbols_read hook
59456                 * testsuite/ld-plugin/pr28849.d: Adjust for powerpc64 function
59457                 descriptors.
59458
59459 2022-03-10  H.J. Lu  <hjl.tools@gmail.com>
59460
59461         ld: Add a before_plugin_all_symbols_read hook
59462         Add a before_plugin_all_symbols_read hook to load symbol references from
59463         DT_NEEDED entries, included from --copy-dt-needed-entries, before reading
59464         plugin symbols to properly resolve plugin symbol references.
59465
59466         bfd/
59467
59468                 PR ld/28849
59469                 * elf-bfd.h (elf_link_hash_table): Add handling_dt_needed.
59470                 * elflink.c (_bfd_elf_merge_symbol): Don't set non_ir_ref_dynamic
59471                 before plugin 'all symbols read' hook is called.
59472
59473         ld/
59474
59475                 PR ld/28849
59476                 * ldelf.c (ldelf_handle_dt_needed): New function.
59477                 (ldelf_before_plugin_all_symbols_read): Likewise.
59478                 (ldelf_after_open): Call ldelf_handle_dt_needed.
59479                 * ldelf.h (ldelf_before_plugin_all_symbols_read): New.
59480                 * ldemul.c (ldemul_before_plugin_all_symbols_read): Likewise.
59481                 * ldemul.h (ldemul_before_plugin_all_symbols_read): Likewise.
59482                 (ld_emulation_xfer_struct): Add before_plugin_all_symbols_read.
59483                 * ldlang.c (lang_process): Call
59484                 ldemul_before_plugin_all_symbols_read before calling
59485                 plugin_call_all_symbols_read.
59486                 * emultempl/elf.em
59487                 (gld${EMULATION_NAME}_before_plugin_all_symbols_read): New.
59488                 (LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): New.
59489                 * emultempl/emulation.em (ld_${EMULATION_NAME}_emulation):
59490                 Initialize the before_plugin_all_symbols_read field.
59491                 * testsuite/ld-plugin/lto.exp: Run PR ld/28849 tests.
59492                 * testsuite/ld-plugin/pr28849.d: New file.
59493                 * testsuite/ld-plugin/pr28849a.c: Likewise.
59494                 * testsuite/ld-plugin/pr28849b.c: Likewise.
59495
59496 2022-03-10  GDB Administrator  <gdbadmin@sourceware.org>
59497
59498         Automatic date update in version.in
59499
59500 2022-03-09  Hans-Peter Nilsson  <hp@axis.com>
59501
59502         toplevel: Makefile.def: Make configure-sim depend on all-readline
59503         Without this, a "make all-sim" without the equivalent of
59504         libreadline-dev installed on the build system, won't
59505         properly pick up the in-tree readline build, and you'll see:
59506
59507         mkdir -p -- ./sim
59508         Configuring in ./sim
59509         configure: creating cache ./config.cache
59510         checking build system type... x86_64-pc-linux-gnu
59511         checking host system type... x86_64-pc-linux-gnu
59512         checking target system type... cris-axis-elf
59513         checking for x86_64-pc-linux-gnu-gcc... gcc
59514         checking whether the C compiler works... yes
59515         ...
59516         checking for library containing tgetent... -ltermcap
59517         checking for readline in -lreadline... no
59518         configure: error: the required "readline" library is missing
59519         make[1]: *** [Makefile:11188: configure-sim] Error 1
59520         make[1]: Leaving directory '/home/hp/sim/b'
59521
59522         The sim dependency on readline is apparently (nominally)
59523         valid as there's a readline call in sim/erc32/sis.c.
59524
59525         2022-02-21  Hans-Peter Nilsson  <hp@axis.com>
59526
59527                 * Makefile.def (dependencies): Make configure-sim depend on
59528                 all-readline.
59529
59530 2022-03-09  Maciej W. Rozycki  <macro@embecosm.com>
59531
59532         GDB/testsuite: Fix a "displayed" typo in gdb.base/default.exp
59533         Fix a typo, s/dislayed/displayed/ in default.exp at the top level.
59534
59535         GDB/testsuite: Remove a stray backslash from gdb.base/settings.exp
59536         Remove a stray trailing backslash from `test-integer' in settings.exp.
59537         It is harmless as only white space follows in the next line before the
59538         closing brace, so it merely swallows the newline character, but it may
59539         look confusing to the reader.
59540
59541 2022-03-09  Christina Schimpe  <christina.schimpe@intel.com>  (tiny change)
59542
59543         * gdb/doc/gdb.texinfo (Requirements): Fix a typo.
59544
59545 2022-03-09  Alan Modra  <amodra@gmail.com>
59546
59547         Constant fold view increment expressions
59548         The idea here is to replace expressions like v + 1 + 1 + 1 with v + 3.
59549
59550                 * dwarf2dbg.c (set_or_check_view): Remove useless assertion.
59551                 Resolve multiple view increments.
59552                 * testsuite/gas/elf/dwarf2-18.d: Don't xfail mep.
59553
59554 2022-03-09  Alan Modra  <amodra@gmail.com>
59555
59556         Reduce duplicated symbol_clone_if_forward_ref work
59557                 * symbol.c (struct symbol_flags): Add forward_resolved.
59558                 (symbol_entry_find): Update needle initialisation.
59559                 (symbol_clone_if_forward_ref): Do no work when forward_resolved
59560                 is already set.  Set forward_resolved.
59561
59562 2022-03-09  Aaron Merey  <amerey@redhat.com>
59563
59564         gdb: Try searching for auto-load script using .gnu_debuglink
59565         If an auto-load script cannot be found and objfile is a separate
59566         debuginfo whose filename does not match the name found in the parent
59567         file's .gnu_debuglink section, then repeat the search using the
59568         parent's filename where the last component is replaced with the
59569         .gnu_debuglink name.
59570
59571         For example if the parent's filename is "/usr/lib/libxyz.so" and the
59572         name in its .gnu_debuglink section is "libxyz.so.debug", then
59573         if no auto-load script is otherwise found the search will be
59574         repeated with the filename "/usr/lib/libxyz.so.debug".
59575
59576         This helps gdb locate auto-load scripts when debuginfo files do not have
59577         the expected filename, such as when they are aquired from debuginfod.
59578
59579 2022-03-09  GDB Administrator  <gdbadmin@sourceware.org>
59580
59581         Automatic date update in version.in
59582
59583 2022-03-08  Aaron Merey  <amerey@redhat.com>
59584
59585         PR gdb/27876 - debuginfod-downloaded source files don't pass proper fullname across mi / (gdb)info source
59586         Source files downloaded from debuginfod currently use their original DWARF
59587         filename as their "fullname".  This causes a mismatch between the fullname
59588         and the actual location of the source file in the debuginfod client cache.
59589
59590         MI consumers such as VSCode will fail to open debuginfod-downloaded
59591         source files due to this.  Also 'info source' will fail to include the
59592         true paths of these files.
59593
59594         To fix this, use the debuginfod cache path as the fullname for debuginfod-
59595         downloaded source files.
59596
59597 2022-03-08  Jan Vrany  <jan.vrany@labware.com>
59598
59599         gdb/mi: preserve user selected thread and frame when invoking MI commands
59600         Fix for PR gdb/20684.  When invoking MI commands with --thread and/or
59601         --frame, the user selected thread and frame was not preserved:
59602
59603           (gdb)
59604           info thread
59605           &"info thread\n"
59606           ~"  Id   Target Id                                           Frame \n"
59607           ~"* 1    Thread 0x7ffff7c30740 (LWP 19302) \"user-selected-c\" main () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:60\n"
59608           ~"  2    Thread 0x7ffff7c2f700 (LWP 19306) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n"
59609           ~"  3    Thread 0x7ffff742e700 (LWP 19307) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n"
59610           ^done
59611           (gdb)
59612           info frame
59613           &"info frame\n"
59614           ~"Stack level 0, frame at 0x7fffffffdf90:\n"
59615           ~" rip = 0x555555555207 in main (/home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:60); saved rip = 0x7ffff7c5709b\n"
59616           ~" source language c.\n"
59617           ~" Arglist at 0x7fffffffdf80, args: \n"
59618           ~" Locals at 0x7fffffffdf80, Previous frame's sp is 0x7fffffffdf90\n"
59619           ~" Saved registers:\n "
59620           ~" rbp at 0x7fffffffdf80, rip at 0x7fffffffdf88\n"
59621           ^done
59622           (gdb)
59623           -stack-info-depth --thread 3
59624           ^done,depth="4"
59625           (gdb)
59626           info thread
59627           &"info thread\n"
59628           ~"  Id   Target Id                                           Frame \n"
59629           ~"  1    Thread 0x7ffff7c30740 (LWP 19302) \"user-selected-c\" main () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:60\n"
59630           ~"  2    Thread 0x7ffff7c2f700 (LWP 19306) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n"
59631           ~"* 3    Thread 0x7ffff742e700 (LWP 19307) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n"
59632           ^done
59633           (gdb)
59634           info frame
59635           &"info frame\n"
59636           ~"Stack level 0, frame at 0x7ffff742dee0:\n"
59637           ~" rip = 0x555555555169 in child_sub_function (/home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30); saved rip = 0x555555555188\n"
59638           ~" called by frame at 0x7ffff742df00\n"
59639           ~" source language c.\n"
59640           ~" Arglist at 0x7ffff742ded0, args: \n"
59641           ~" Locals at 0x7ffff742ded0, Previous frame's sp is 0x7ffff742dee0\n"
59642           ~" Saved registers:\n "
59643           ~" rbp at 0x7ffff742ded0, rip at 0x7ffff742ded8\n"
59644           ^done
59645           (gdb)
59646
59647         This caused problems for frontends that provide access to CLI because UI
59648         may silently change the context for CLI commands (as demonstrated above).
59649
59650         This commit fixes the problem by restoring thread and frame in
59651         mi_cmd_execute (). With this change, there are only two GDB/MI commands
59652         that can change user selected context: -thread-select and -stack-select-frame.
59653         This allows us to remove all and rather complicated logic of notifying
59654         about user selected context change from mi_execute_command (), leaving it
59655         to these two commands themselves to notify.
59656
59657         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20684
59658
59659 2022-03-08  Andrew Burgess  <aburgess@redhat.com>
59660
59661         gdb: announce upcoming removal of Python 2 support from gdb
59662         As has been discussed here:
59663
59664           https://sourceware.org/pipermail/gdb-patches/2022-January/184910.html
59665
59666         Python 2 support will be removed from GDB after GDB 12 has branched.
59667         This commit places an entry in the NEWS file to inform users of this
59668         decision.
59669
59670 2022-03-08  GDB Administrator  <gdbadmin@sourceware.org>
59671
59672         Automatic date update in version.in
59673
59674 2022-03-07  Andrew Burgess  <aburgess@redhat.com>
59675
59676         gdb/testsuite: add new test for comparing char types in Python
59677         There's an interesting property of the 'char' type in C and C++, the
59678         three types 'char', 'unsigned char', and 'signed char', are all
59679         considered distinct.
59680
59681         In contrast, and 'int' is signed by default, and so 'int' and 'signed
59682         int' are considered the same type.
59683
59684         This commit adds a test to ensure that this edge case is visible to a
59685         user from Python.
59686
59687         It is worth noting that for any particular compiler implementation (or
59688         the flags a compiler was invoked with), a 'char' will be either signed
59689         or unsigned; it has to be one or the other, and a user can access this
59690         information by using the Type.is_signed property.  However, for
59691         something like function overload resolution, the 'char' type is
59692         considered distinct from the signed and unsigned variants.
59693
59694         There's no change to GDB with this commit, this is just adding a new
59695         test to guard some existing functionality.
59696
59697 2022-03-07  Andrew Burgess  <aburgess@redhat.com>
59698
59699         gdb/python: add Type.is_signed property
59700         Add a new read-only property, Type.is_signed, which is True for signed
59701         types, and False otherwise.
59702
59703         This property should only be read on types for which Type.is_scalar is
59704         true, attempting to read this property for non-scalar types will raise
59705         a ValueError.
59706
59707         I chose 'is_signed' rather than 'is_unsigned' in order to match the
59708         existing Architecture.integer_type method, which takes a 'signed'
59709         parameter.  As far as I could find, that was the only existing
59710         signed/unsigned selector in the Python API, so it seemed reasonable to
59711         stay consistent.
59712
59713 2022-03-07  Andrew Burgess  <aburgess@redhat.com>
59714
59715         gdb/python: add Type.is_scalar property
59716         Add a new read-only property which is True for scalar types,
59717         otherwise, it's False.
59718
59719 2022-03-07  Andrew Burgess  <aburgess@redhat.com>
59720
59721         gdb/mi: add --no-connection to MI -add-inferior command
59722         Following on from the previous commit, where the -add-inferior command
59723         now uses the same connection as the current inferior, this commit adds
59724         a --no-connection option to -add-inferior.
59725
59726         This new option matches the existing option of the same name for the
59727         CLI version of add-inferior; the new inferior is created with no
59728         connection.
59729
59730         I've added a new 'connection' field to the MI output of -add-inferior,
59731         which includes the connection number and short name.  I haven't
59732         included the longer description field, this is the MI after all.  My
59733         expectation would be that if the frontend wanted to display all the
59734         connection details then this would be looked up from 'info
59735         connection' (or the MI equivalent if/when such a command is added).
59736
59737         The existing -add-inferior tests are updated, as are the docs.
59738
59739 2022-03-07  Umair Sair  <umair_sair@hotmail.com>
59740
59741         gdb/mi: fix regression in mi -add-inferior command
59742         Prior to the multi-target support commit:
59743
59744           commit 5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2
59745           Date:   Fri Jan 10 20:06:08 2020 +0000
59746
59747               Multi-target support
59748
59749         When a new inferior was added using the MI -add-inferior command, the
59750         new inferior would be using the same target as all the other
59751         inferiors.  This makes sense, GDB only supported a single target stack
59752         at a time.
59753
59754         After the above commit, each inferior has its own target stack.
59755
59756         To maintain backward compatibility, for the CLI add-inferior command,
59757         when a new inferior is added the above commit has the new inferior
59758         inherit a copy of the target stack from the current inferior.
59759
59760         Unfortunately, this same backward compatibility is missing for the MI.
59761
59762         This commit fixes this oversight.
59763
59764         Now, when the -add-inferior MI command is used, the new inferior will
59765         inherit a copy of the target stack from the current inferior.
59766
59767 2022-03-07  Tom Tromey  <tromey@adacore.com>
59768
59769         Deprecate dbx mode
59770         GDB has a dbx emulation mode that adds a few aliases and helper
59771         commands.  This mode is barely documented and is very superficial
59772         besides.  I suspect it is rarely used, and I would like to propose
59773         deprecating it for GDB 12, and then removing it in GDB 13.
59774
59775 2022-03-07  Pedro Alves  <pedro@palves.net>
59776
59777         Remove unnecessary inferior lookup in infrun:handle_one
59778         infrun.c:handle_one calls find_inferior_ptid unnecessarily, since we
59779         already have a thread pointer handy, and the thread has a pointer to
59780         the inferior.  This commit removes the unnecessary lookup.
59781
59782         Change-Id: I2ae18601dd75346c6c91068e9a4f9a6484fb3339
59783
59784 2022-03-07  Tom Tromey  <tromey@adacore.com>
59785
59786         Fix bug in ada_print_floating
59787         ada_print_floating rewrites a floating-point string representation to
59788         conform to Ada syntax.  However, if you managed to get a floating
59789         point error, you might see:
59790
59791             (gdb) print whatever
59792             $2 = <invalid float valu.0e>
59793
59794         What's happening here is that ada_print_floating doesn't recognize
59795         this error case, and proceeds to modify the error text.
59796
59797         This patch fixes this problem.
59798
59799 2022-03-07  Tom Tromey  <tromey@adacore.com>
59800
59801         Implement real literal extension for Ada
59802         Sometimes it is convenient to be able to specify the exact bits of a
59803         floating-point literal.  For example, you may want to set a
59804         floating-point register to a denormalized value, or to a particular
59805         NaN.
59806
59807         In C, you can do this by combining the "{}" cast with an array
59808         literal, like:
59809
59810             (gdb) p {double}{0x576488BDD2AE9FFE}
59811             $1 = 9.8765449999999996e+112
59812
59813         This patch adds a somewhat similar idea to Ada.  It extends the lexer
59814         to allow "l" and "f" suffixes in a based literal.  The "f" indicates a
59815         floating-point literal, and the "l"s control the size of the
59816         floating-point type.
59817
59818         Note that this differs from Ada's based real literals.  I believe
59819         those can also be used to control the bits of a floating-point value,
59820         but they are a bit more cumbersome to use (simplest is binary but
59821         that's also very lengthy).  Also, these aren't implemented in GDB.
59822
59823         I chose not to allow this extension to work with based integer
59824         literals with exponents.  That didn't seem very useful.
59825
59826 2022-03-07  Tom Tromey  <tromey@adacore.com>
59827
59828         Fix Ada integer literals with exponents
59829         While working on another patch, I noticed that Ada integer literals
59830         with exponents did not work.  For example, with one form you get an
59831         error:
59832
59833             (gdb) print 8e2
59834             Invalid digit `e' in based literal
59835
59836         And with another form you get an incorrect value:
59837
59838             (gdb) print 16#8#e2
59839             $2 = 8
59840
59841         This patch fixes the bugs and adds tests.
59842
59843 2022-03-07  Tom Tromey  <tromey@adacore.com>
59844
59845         Fix gdb.ada/arrayptr.exp results
59846         PR ada/28115 points out that gdb.ada/arrayptr.exp works with GNAT 12,
59847         but fails with minimal encodings in earlier versions.
59848
59849         This patch updates the test to try to report the results correctly.  I
59850         tried this with the Fedora 34 system gcc (GCC 11) and with a GCC 12
59851         built from git trunk sometime relatively recently.
59852
59853         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28115
59854
59855 2022-03-07  Tom Tromey  <tromey@adacore.com>
59856
59857         Handle non-ASCII identifiers in Ada
59858         Ada allows non-ASCII identifiers, and GNAT supports several such
59859         encodings.  This patch adds the corresponding support to gdb.
59860
59861         GNAT encodes non-ASCII characters using special symbol names.
59862
59863         For character sets like Latin-1, where all characters are a single
59864         byte, it uses a "U" followed by the hex for the character.  So, for
59865         example, thorn would be encoded as "Ufe" (0xFE being lower case
59866         thorn).
59867
59868         For wider characters, despite what the manual says (it claims
59869         Shift-JIS and EUC can be used), in practice recent versions only
59870         support Unicode.  Here, characters in the base plane are represented
59871         using "Wxxxx" and characters outside the base plane using
59872         "WWxxxxxxxx".
59873
59874         GNAT has some further quirks here.  Ada is case-insensitive, and GNAT
59875         emits symbols that have been case-folded.  For characters in ASCII,
59876         and for all characters in non-Unicode character sets, lower case is
59877         used.  For Unicode, however, characters that fit in a single byte are
59878         converted to lower case, but all others are converted to upper case.
59879
59880         Furthermore, there is a bug in GNAT where two symbols that differ only
59881         in the case of "Y WITH DIAERESIS" (and potentially others, I did not
59882         check exhaustively) can be used in one program.  I chose to omit
59883         handling this case from gdb, on the theory that it is hard to figure
59884         out the logic, and anyway if the bug is ever fixed, we'll regret
59885         having a heuristic.
59886
59887         This patch introduces a new "ada source-charset" setting.  It defaults
59888         to Latin-1, as that is GNAT's default.  This setting controls how "U"
59889         characters are decoded -- W/WW are always handled as UTF-32.
59890
59891         The ada_tag_name_from_tsd change is needed because this function will
59892         read memory from the inferior and interpret it -- and this caused an
59893         encoding failure on PPC when running a test that tries to read
59894         uninitialized memory.
59895
59896         This patch implements its own UTF-32-based case folder.  This avoids
59897         host platform quirks, and is relatively simple.  A short Python
59898         program to generate the case-folding table is included.  It simply
59899         relies on whatever version of Unicode is used by the host Python,
59900         which seems basically acceptable.
59901
59902         Test cases for UTF-8, Latin-1, and Latin-3 are included.  This
59903         exercises most of the new code paths, aside from Y WITH DIAERESIS as
59904         noted above.
59905
59906 2022-03-07  Tom Tromey  <tromey@adacore.com>
59907
59908         Define HOST_UTF32 in charset.h
59909         rust-parse.c has a #define for the host-specific UTF-32 charset name.
59910         A later patch needs the same thing, so this patch moves the definition
59911         to charset.h for easier reuse.
59912
59913 2022-03-07  Tom Tromey  <tromey@adacore.com>
59914
59915         Let phex and phex_nz handle sizeof_l==1
59916         Currently, neither phex nor phex_nz handle sizeof_l==1 -- they let
59917         this case fall through to the default case.  However, a subsequent
59918         patch in this series needs this case to work correctly.
59919
59920         I looked at all calls to these functions that pass a 1 for the
59921         sizeof_l parameter.  The only such case seems to be correct with this
59922         change.
59923
59924 2022-03-07  Tom Tromey  <tromey@adacore.com>
59925
59926         Don't pre-size result string in ada_decode
59927         Currently, ada_decode pre-sizes the output string, filling it with 'X'
59928         characters.  However, it's a bit simpler and more flexible to let
59929         std::string do the work here, and simply append characters to the
59930         string as we go.  This turns out to be useful for a subsequent patch.
59931
59932         Simplify a regular expression in ada-lex.l
59933         ada-lex.l uses "%option case-insensitive", so there is no need for
59934         regular expressions to match upper case.
59935
59936 2022-03-07  GDB Administrator  <gdbadmin@sourceware.org>
59937
59938         Automatic date update in version.in
59939
59940 2022-03-06  Maciej W. Rozycki  <macro@orcam.me.uk>
59941
59942         MIPS/opcodes: Fix alias annotation for branch instructions
59943         Correct issues with INSN2_ALIAS annotation for branch instructions:
59944
59945         - regular MIPS BEQZ/L and BNEZ/L assembly instructions are idioms for
59946           BEQ/L and BNE/L respectively with the `rs' operand equal to $0,
59947
59948         - microMIPS 32-bit BEQZ and BNEZ assembly instructions are idioms for
59949           BEQ and BNE respectively with the `rt' operand equal to $0,
59950
59951         - regular MIPS BAL assembly instruction is an idiom for architecture
59952           levels of up to the MIPSr5 ISA and a machine instruction on its own
59953           from the MIPSr6 ISA up.
59954
59955         Add missing annotation to BEQZ/L and BNEZ/L accordingly then and add a
59956         new entry for BAL for the MIPSr6 ISA, correcting a disassembly bug:
59957
59958         $ mips-linux-gnu-objdump -m mips:isa64r6 -M no-aliases -d bal.o
59959
59960         bal.o:     file format elf32-tradlittlemips
59961
59962         Disassembly of section .text:
59963
59964         00000000 <foo>:
59965            0:   04110000        0x4110000
59966                 ...
59967         $
59968
59969         Add test cases accordingly.
59970
59971         Parts for regular MIPS BEQZ/L and BNEZ/L instructions from Sagar Patel.
59972
59973         2022-03-06  Maciej W. Rozycki  <macro@orcam.me.uk>
59974
59975                 binutils/
59976                 * testsuite/binutils-all/mips/mips1-branch-alias.d: New test.
59977                 * testsuite/binutils-all/mips/mips1-branch-noalias.d: New test.
59978                 * testsuite/binutils-all/mips/mips2-branch-alias.d: New test.
59979                 * testsuite/binutils-all/mips/mips2-branch-noalias.d: New test.
59980                 * testsuite/binutils-all/mips/mips32r6-branch-alias.d: New test.
59981                 * testsuite/binutils-all/mips/mips32r6-branch-noalias.d: New
59982                 test.
59983                 * testsuite/binutils-all/mips/micromips-branch-alias.d: New
59984                 test.
59985                 * testsuite/binutils-all/mips/micromips-branch-noalias.d: New
59986                 test.
59987                 * testsuite/binutils-all/mips/mips-branch-alias.s: New test
59988                 source.
59989                 * testsuite/binutils-all/mips/micromips-branch-alias.s: New test
59990                 source.
59991                 * testsuite/binutils-all/mips/mips.exp: Run the new tests.
59992
59993         2022-03-06  Sagar Patel  <sagarmp@cs.unc.edu>
59994                     Maciej W. Rozycki  <macro@orcam.me.uk>
59995
59996                 opcodes/
59997                 * mips-opc.c (mips_builtin_opcodes): Fix INSN2_ALIAS annotation
59998                 for "bal", "beqz", "beqzl", "bnez" and "bnezl" instructions.
59999                 * micromips-opc.c (micromips_opcodes): Likewise for "beqz" and
60000                 "bnez" instructions.
60001
60002 2022-03-06  Tom Tromey  <tom@tromey.com>
60003
60004         Use function view when iterating over block symbols
60005         This changes iterate_over_block_local_vars and
60006         iterate_over_block_arg_vars to take a gdb::function_view rather than a
60007         function pointer and a user-data.  In one spot, this allows us to
60008         remove a helper structure and helper function.  In another spot, this
60009         looked more complicated, so I changed the helper function to be an
60010         "operator()" -- also a simplification, just not as big.
60011
60012 2022-03-06  Tom Tromey  <tom@tromey.com>
60013
60014         Simplify hppa-tdep.c use of objfile_key
60015         I happened to notice a couple of unnecessary casts in hppa-tdep.c, and
60016         then I saw that the use of objfile_key could be simplified -- removing
60017         some code and using the default deleter rather than noop_deleter.
60018
60019         Tested by rebuilding.  Let me know what you think.
60020
60021 2022-03-06  Simon Marchi  <simon.marchi@polymtl.ca>
60022
60023         gdb: constify parameter of value_copy
60024         In a following patch, I have a const value I want to copy using a
60025         value_copy.  However, value_copy takes a non-const source value, at the
60026         moment.  Change the paramter to be const,
60027
60028         If the source value is not lazy, we currently call
60029         value_contents_all_raw, which calls allocate_value_contents, to get a
60030         view on the contents.  They both take a non-const value, that's a
60031         problem.  My first attempt at solving it was to add a const version of
60032         value_contents_all_raw, make allocate_value_contents take a const value,
60033         and either:
60034
60035          - make value::contents mutable
60036          - make allocate_value_contents cast away the const
60037
60038         The idea being that allocating the value contents buffer does modify the
60039         value at the bit level, but logically that doesn't change its state.
60040
60041         That was getting a bit complicated, so what I ended up doing is make
60042         value_copy not call value_contents_all_raw.  We know at this point that
60043         the value is not lazy, so value::contents must have been allocate
60044         already.
60045
60046         Change-Id: I3741ab362bce14315f712ec24064ccc17e3578d4
60047
60048 2022-03-06  Simon Marchi  <simon.marchi@polymtl.ca>
60049
60050         gdb: remove internalvar_funcs::destroy
60051         No kind of internal var uses it remove it.  This makes the transition to
60052         using a variant easier, since we don't need to think about where this
60053         should be called (in a destructor or not), if it can throw, etc.
60054
60055         Change-Id: Iebbc867d1ce6716480450d9790410d6684cbe4dd
60056
60057 2022-03-06  GDB Administrator  <gdbadmin@sourceware.org>
60058
60059         Automatic date update in version.in
60060
60061 2022-03-05  GDB Administrator  <gdbadmin@sourceware.org>
60062
60063         Automatic date update in version.in
60064
60065 2022-03-04  Tom Tromey  <tromey@adacore.com>
60066
60067         Mark vDSO as not a file
60068         The vDSO objfile is not a real file, so mark it as such.  I noticed
60069         this because, when playing with debuginfod, I saw:
60070
60071         Downloading 0.01 MB separate debug info for /tmp/system-supplied DSO at 0x7ffff7fc9000
60072
60073         That "/tmp" is wrong -- it's just gdb's cwd.  This patch corrects the
60074         problem, resulting in:
60075
60076         Downloading 0.01 MB separate debug info for system-supplied DSO at 0x7ffff7fc9000
60077
60078         Regression tested on x86-64 Fedora 34.
60079
60080 2022-03-04  Simon Marchi  <simon.marchi@polymtl.ca>
60081
60082         binutils/readelf: fix indentation in process_dynamic_section
60083         Clangd shows a warning about misleading indentation in this file, fix
60084         it.
60085
60086         binutils/ChangeLog:
60087
60088                 * readelf.c (process_dynamic_section): Fix indentation.
60089
60090         Change-Id: I43a7f4f4c75dd080af614222b980526f5debf297
60091
60092 2022-03-04  Christina Schimpe  <christina.schimpe@intel.com>
60093
60094         gdb: Use a typedef's scoped type name to identify local typedefs
60095         GDB prints the wrong type for typedefs in case there is another typedef
60096         available for the same raw type (gdb/16040).  The reason is that the
60097         current hashmap based substitution mechanism always compares the target
60098         type of a typedef and not its scoped name.
60099
60100         The original output of GDB for a program like
60101
60102         ~~~~
60103         namespace ns
60104         {
60105           typedef double scoped_double;
60106         }
60107
60108         typedef double global_double;
60109
60110         class TypedefHolder
60111         {
60112         public:
60113           double a;
60114           ns::scoped_double b;
60115           global_double c;
60116
60117         private:
60118           typedef double class_double;
60119           class_double d;
60120
60121           double method1(ns::scoped_double) { return 24.0; }
60122           double method2(global_double) { return 24.0; }
60123         };
60124
60125         int main()
60126         {
60127           TypedefHolder th;
60128           return 0;
60129         }
60130         ~~~~
60131
60132         is
60133         ~~~~
60134
60135         (gdb) b 27
60136         Breakpoint 1 at 0x1131: file TypedefHolder.cc, line 27.
60137         (gdb) r
60138         Starting program: /tmp/typedefholder
60139
60140         Breakpoint 1, main () at TypedefHolder.cc:27
60141         27        return 0;
60142         (gdb) ptype th
60143         type = class TypedefHolder {
60144           public:
60145             class_double a;
60146             class_double b;
60147             class_double c;
60148           private:
60149             class_double d;
60150
60151             class_double method1(class_double);
60152             class_double method2(class_double);
60153
60154             typedef double class_double;
60155         }
60156         ~~~~
60157
60158         Basically all attributes of a class which have the raw type "double" are
60159         substituted by "class_double".
60160
60161         With the patch the output is the following
60162
60163         ~~~~
60164         type = class TypedefHolder {
60165           public:
60166             double a;
60167             ns::scoped_double b;
60168             global_double c;
60169           private:
60170             class_double d;
60171
60172             double method1(ns::scoped_double);
60173             double method2(global_double);
60174
60175             typedef double class_double;
60176         }
60177         ~~~~
60178
60179 2022-03-04  Jan Beulich  <jbeulich@suse.com>
60180
60181         RISC-V: make .insn actually work for 64-bit insns
60182         Presently in this case, due to an undefined behavior shift, at least
60183         with x86 cross builds I'm observing:
60184
60185         Error: value conflicts with instruction length `8,0x0000003f'
60186
60187         Eliminate the UB and extend the respective testcase.
60188
60189 2022-03-04  Jan Beulich  <jbeulich@suse.com>
60190
60191         x86: drop redundant x86-64-code16-2 test
60192         The code16-2 test is already meaningless enough as a gas test, identical
60193         to this one, and is run uniformly for all ELF targets anyway.
60194
60195 2022-03-04  GDB Administrator  <gdbadmin@sourceware.org>
60196
60197         Automatic date update in version.in
60198
60199 2022-03-03  Roland McGrath  <mcgrathr@google.com>
60200
60201         Fix typo in last change.
60202
60203 2022-03-03  Roland McGrath  <mcgrathr@google.com>
60204
60205         Avoid conflict with gnulib open/close macros.
60206         On some systems, the gnulib configuration will decide to define open
60207         and/or close as macros to replace the POSIX C functions.  This
60208         interferes with using those names in C++ class or namespace scopes.
60209
60210         gdbsupport/
60211                 * event-pipe.cc (event_pipe::open): Renamed to ...
60212                 (event_pipe::open_pipe): ... this.
60213                 (event_pipe::close): Renamed to ...
60214                 (event_pipe::close_pipe): ... this.
60215                 * event-pipe.h (class event_pipe): Updated.
60216         gdb/
60217                 * inf-ptrace.h (async_file_open, async_file_close): Updated.
60218         gdbserver/
60219                 * gdbserver/linux-low.cc (linux_process_target::async): Likewise.
60220
60221 2022-03-03  Alan Modra  <amodra@gmail.com>
60222
60223         Adjust ld ctf test for 32-bit targets
60224         powerpc-linux, and I suspect other 32-bit targets, report "aligned at
60225         0x4" for this test.
60226
60227                 * testsuite/ld-ctf/nonrepresentable.d: Accept any alignment.
60228
60229 2022-03-03  Luis Machado  <luis.machado@arm.com>
60230
60231         Update my e-mail address in the MAINTAINERS file
60232         Update the information accordingly.
60233
60234 2022-03-03  Tiezhu Yang  <yangtiezhu@loongson.cn>
60235
60236         gdb: testsuite: fix failed testcases in gdb.base/gdb-caching-proc.exp
60237         When execute the following command:
60238
60239           make check-gdb TESTS="gdb.base/gdb-caching-proc.exp"
60240
60241         we can see there exist some failed testcases:
60242
60243           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 0: can spawn for attach (got interactive prompt)
60244           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 1: can spawn for attach (got interactive prompt)
60245           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 2: can spawn for attach (got interactive prompt)
60246           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 3: can spawn for attach (got interactive prompt)
60247           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 4: can spawn for attach (got interactive prompt)
60248           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 5: can spawn for attach (got interactive prompt)
60249           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 6: can spawn for attach (got interactive prompt)
60250           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 7: can spawn for attach (got interactive prompt)
60251           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 8: can spawn for attach (got interactive prompt)
60252           FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 9: can spawn for attach (got interactive prompt)
60253
60254         here are the detailed messages in gdb/testsuite/gdb.log:
60255
60256           attach 873776
60257           A program is being debugged already.  Kill it? (y or n) n
60258           Not killed.
60259           (gdb) FAIL: gdb.base/gdb-caching-proc.exp: can_spawn_for_attach: 0: can spawn for attach (got interactive prompt)
60260
60261         so handle the case "A program is being debugged already.  Kill it" in
60262         can_spawn_for_attach to fix the failed testcases.
60263
60264 2022-03-03  Alan Modra  <amodra@gmail.com>
60265
60266         comment typo fix
60267
60268 2022-03-03  Alan Modra  <amodra@gmail.com>
60269
60270         PowerPC64 DT_RELR relative reloc addresses
60271         Section addresses can change between ppc64_elf_size_stubs and
60272         ppc64_elf_build_stubs due to .eh_frame editing.  The idea of stashing
60273         r_offset final addresses calculated in ppc64_elf_size_stubs for use by
60274         ppc64_elf_build_stubs was never a good idea.  Instead, we need to keep
60275         section/offset pairs.
60276
60277                 * elf64-ppc.c (struct ppc_link_hash_table): Delete relr_addr.
60278                 Add relr section/offset array.
60279                 (append_relr_off): Rewrite.  Update all callers.
60280                 (sort_relr): New function.
60281                 (ppc64_elf_size_stubs): Adjust to suit new relative reloc stash.
60282                 (ppc64_elf_build_stubs): Likewise.
60283
60284 2022-03-03  GDB Administrator  <gdbadmin@sourceware.org>
60285
60286         Automatic date update in version.in
60287
60288 2022-03-02  John Baldwin  <jhb@FreeBSD.org>
60289
60290         configure: Stop checking for PT_GETXMMREGS.
60291         This request is present on all modern *BSD/i386 systems (those
60292         released since mid-2006), and the *BSD/i386 targets now assume it is
60293         present unconditionally.
60294
60295         i386-bsd-nat: Assume PT_GETXMMREGS is present.
60296         NetBSD has included PT_GETXMMREGS since 1.6 released in September
60297         2002.  OpenBSD has included PT_GETXMMREGS since 3.8 released in
60298         November 2005.
60299
60300         i386-fbsd-nat: Assume PT_GETXMMREGS is present.
60301         PT_GETXMMREGS was first added in FreeBSD 6.0 released in November 2005.
60302         The last FreeBSD release without support was 5.5 released in May 2006.
60303
60304 2022-03-02  John Baldwin  <jhb@FreeBSD.org>
60305
60306         fbsd-tdep: Implement the vsyscall_range gdbarch hook.
60307         FreeBSD recently added a real vDSO in its shared page for the amd64
60308         architecture.  The vDSO is mapped at the address given by the
60309         AT_KPRELOAD ELF auxiliary vector entry.  To find the end of the
60310         mapping range, parse the list of virtual map entries used by 'info
60311         proc mappings' either from the NT_PROCSTAT_VMMAP core dump note, or
60312         via the kinfo_getvmmap function for native targets (fetched from the
60313         native target as the TARGET_OBJECT_FREEBSD_VMMAP object).
60314
60315         This silences warnings on recent FreeBSD/amd64 kernels due to not
60316         finding symbols for the vdso:
60317
60318         warning: Could not load shared library symbols for [vdso].
60319         Do you need "set solib-search-path" or "set sysroot"?
60320
60321 2022-03-02  Tom Tromey  <tromey@adacore.com>
60322
60323         Rewrite make-target-delegates in Python
60324         I think gdb is probably better off having fewer languages involved
60325         when generating code.  'sh' is unavoidable for build-time generation,
60326         but for other things, let's use Python.
60327
60328         This rewrites make-target-delegates in Python.  I've stuck pretty
60329         closely to the original code in this rewrite, so it may look slightly
60330         weird from a Python perspective.
60331
60332         The only output difference is that a copyright header is now
60333         generated, using the code introduced in the previous patch.
60334
60335         make-target-delegates.py is simpler to invoke, as it knows the correct
60336         input file to scan and it creates the output file itself.
60337
60338 2022-03-02  Tom Tromey  <tromey@adacore.com>
60339
60340         Move copyright code from gdbarch.py to new file
60341         This moves the copyright code from gdbarch.py to a new Python source
60342         file, gdbcopyright.py.  The function in this file will find the
60343         copyright dates by scanning the calling script.  This will be reused
60344         in a future patch.
60345
60346         This involved minor changes to the output of gdbarch.py.  Also, I've
60347         updated copyright.py to remove the reference to gdbarch.sh.  We don't
60348         need to mention gdbarch.py there, either.
60349
60350 2022-03-02  GDB Administrator  <gdbadmin@sourceware.org>
60351
60352         Automatic date update in version.in
60353
60354 2022-03-01  Tom Tromey  <tom@tromey.com>
60355
60356         Some "distclean" fixes in gdb
60357         PR build/12440 points out that "make distclean" is broken in gdb.
60358         Most of the breakage comes from other projects in the tree, but we can
60359         fix some of the issues, which is what this patch does.
60360
60361         Note that the yacc output files, like c-exp.c, are left alone.  In a
60362         source distribution, these are included in the tarball, and if the
60363         user builds in-tree, we would not want to remove them.
60364
60365         While that seems a bit obscure, it seems to me that "distclean" is
60366         only really useful for in-tree builds anyway -- out-of-tree I simply
60367         delete the entire build directory and start over.
60368
60369         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12440
60370
60371 2022-03-01  Tom Tromey  <tom@tromey.com>
60372
60373         Fix typo in the "alias" example
60374         PR cli/17332, filed around 8 years ago, points out a typo in the docs
60375         -- in one example, the command and its output are obviously out of
60376         sync.  This patch fixes it.  I'm checking this in as obvious.
60377
60378         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17332
60379
60380 2022-03-01  Nick Clifton  <nickc@redhat.com>
60381
60382         Fix a typo in the previous delta to bfdio.c.
60383                 PR 25713
60384                 * bfdio.c (_bfd_real_fopen): Fix typo.
60385
60386 2022-03-01  Alan Modra  <amodra@gmail.com>
60387
60388         Revert "Check thin archive element file size against archive header"
60389         This reverts commit 48e3e6aec8a4f37d00ea6c0da3ab45e76490e3db.
60390
60391                 PR 28929
60392                 * archive.c (_bfd_get_elt_at_filepos): Don't check thin archive
60393                 element file size.
60394
60395 2022-03-01  Nick Clifton  <nickc@redhat.com>
60396
60397         Fix linker tests to compile with gcc-12.
60398                 PR 21964
60399                 * testsuite/ld-elf/pr21964-1a.c: Fix array comparisons.
60400                 * testsuite/ld-elf/pr21964-1b.c: Likewise.
60401                 * testsuite/ld-elf/pr21964-1c.c: Likewise.
60402                 * testsuite/ld-elf/pr21964-2a.c: Likewise.
60403                 * testsuite/ld-elf/pr21964-2b.c: Likewise.
60404                 * testsuite/ld-elf/pr21964-3a.c: Likewise.
60405
60406         Prevent an assertion from being triggered when linking an ARM object file with incorrectly set build attributes.
60407                 PR 28848
60408                 PR 28859
60409                 * elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first
60410                 input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have
60411                 TAG_FP_arch set then reset the TAG_ABI_HardFP_use.
60412
60413 2022-03-01  Tiezhu Yang  <yangtiezhu@loongson.cn>
60414
60415         gdb: testsuite: fix wrong expected result in attach-pie-noexec.exp
60416         If /proc/sys/kernel/yama/ptrace_scope is 1, when execute the test case
60417         gdb.base/attach-pie-noexec.exp without superuser, the gdb.log shows the
60418         following info:
60419
60420           (gdb) attach 6500
60421           Attaching to process 6500
60422           ptrace: Operation not permitted.
60423           (gdb) PASS: gdb.base/attach-pie-noexec.exp: attach
60424
60425         It is obviously wrong, the expected result should be UNSUPPORTED in such
60426         a case.
60427
60428         It is better to make can_spawn_for_attach to return false for this case.
60429         It would have to setup a small test program, compile it to exec, spawn it
60430         and try to attach to it.
60431
60432         With this patch, we can see "Operation not permitted" in the log info,
60433         and then we can do the following processes to test:
60434         (1) set ptrace_scope as 0
60435             $ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
60436             $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"
60437         (2) use sudo
60438             $ sudo make check-gdb TESTS="gdb.base/attach-pie-noexec.exp"
60439
60440         Additionally, handle the other cases when test with RUNTESTFLAGS=
60441         "--target_board=native-extended-gdbserver".
60442
60443 2022-03-01  Tiezhu Yang  <yangtiezhu@loongson.cn>
60444
60445         gdb: testsuite: print explicit test result in can_spawn_for_attach
60446         In the current code, there is no test result when execute the following
60447         commands:
60448
60449           $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp" RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost"
60450           $ make check-gdb TESTS="gdb.base/attach-pie-noexec.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
60451
60452         It is better to print explicit test result in can_spawn_for_attach.
60453
60454 2022-03-01  Tiezhu Yang  <yangtiezhu@loongson.cn>
60455
60456         gdb: add Tiezhu Yang as LoongArch maintainer
60457         The patch series "gdb: Add basic support for LoongArch" has been
60458         merged into master, list Tiezhu Yang as LoongArch maintainer.
60459
60460 2022-03-01  GDB Administrator  <gdbadmin@sourceware.org>
60461
60462         Automatic date update in version.in
60463
60464 2022-02-28  Keith Seitz  <keiths@redhat.com>
60465
60466         Fix "spawn id XYZ not open" errors in gdb.mi/mi-exec-run.exp
60467         Running mi-exec-run.exp on native-extended-gdbserver/-m{32,64}
60468         causes several Tcl errors to appear. For example,
60469
60470         (gdb)
60471         ERROR: : spawn id exp20 not open
60472             while executing
60473         "expect {
60474         -i exp11 -timeout 10
60475                         -i "$inferior_spawn_id"
60476                         -re ".*Cannot exec.*Permission denied" {
60477                             set saw_perm_error 1
60478                             verbose -log "saw..."
60479             ("uplevel" body line 1)
60480             invoked from within
60481         "uplevel $body" NONE : spawn id exp20 not open
60482         UNRESOLVED: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=1: run failure detected (eof)
60483
60484         This is happening because of the way this test is implemented:
60485
60486                 while {1} {
60487                     gdb_expect {
60488                         -i "$inferior_spawn_id"
60489                         -re ".*Cannot exec.*Permission denied" {
60490                             set saw_perm_error 1
60491                             verbose -log "saw mi error"
60492                         }
60493                         -i "$gdb_spawn_id"
60494                         -re "\\^error,msg=\"During startup program exited with code 127" {
60495                             set saw_mi_error 1
60496                             verbose -log "saw mi error"
60497                         }
60498                        # and so on
60499                     }
60500                 }
60501
60502         The first time this loop is executed, `inferior_spawn_id' is valid. When the
60503         first branch of the expect statement is reached, gdbserver has exited, closing
60504         the spawn_id.  Since we haven't seen the gdb-side error yet, the loop is executed
60505         again.  The first branch now refers to a non-existent spawn_id, leading to the error.
60506
60507         This can be fixed by using exp_continue to loop in expect instead of looping around
60508         expect, which is the approach I have used[1].  Note I've had to update the expected
60509         message for the "During startup..." error message when running with gdbserver.
60510
60511         One other small change I've made is to add a log entry which spills the values of
60512         the two variables, saw_mi_error and saw_perm_error (and updated the log output
60513         for the later).  This should make the log output clearer about why the test failed.
60514
60515         With this patch installed, all the ERRORs disappear, leaving previously masked
60516         FAILs (which I have not attempted to fix).
60517
60518         [1] Anyone know why this test doesn't simply use gdb_test_multiple? I can only
60519         assume that it was intentionally written this way, and I've modified the code with
60520         that assumption. I have tested a version using gdb_test_multiple, and that appears
60521         to work fine, too, if that is preferred. [It still employs exp_continue to fix the
60522         spawn_id errors.]
60523
60524 2022-02-28  Tom Tromey  <tromey@adacore.com>
60525
60526         Add more filename styling
60527         I found a few spots where filename styling ought to be applied, but is
60528         not.
60529
60530 2022-02-28  Tom Tromey  <tromey@adacore.com>
60531
60532         Fix maybe-uninitialized warning in py-infthread.c
60533         I got this warning from py-infthread.c using the Fedora 34 system GCC:
60534
60535         ../../binutils-gdb/gdb/python/py-infthread.c:102:30: warning: ‘extra_info’ may be used uninitialized in this function [-Wmaybe-uninitialized]
60536
60537         I think this happens because GDB_PY_HANDLE_EXCEPTION expands to an
60538         'if' whose condition is always true -- but GCC can't know this.  This
60539         patch avoids the warning by adding a harmless initialization.
60540
60541 2022-02-28  Tom Tromey  <tromey@adacore.com>
60542
60543         Handle multi-byte bracket sequences in Ada lexer
60544         As noted in an earlier patch, the Ada lexer does not handle multi-byte
60545         bracket sequences.  This patch adds support for these for character
60546         literals.  gdb does not generally seem to handle the Ada wide string
60547         types, so for the time being these continue to be excluded -- but an
60548         explicit error is added to make this more clear.
60549
60550 2022-02-28  Tom Tromey  <tromey@adacore.com>
60551
60552         Handle 'QWW' encoding case in Ada enums
60553         In Ada, an enum can contain character literals.  GNAT encodes these
60554         values in a special way.  For example, the Unicode character U+0178
60555         would be represented as 'QW0178' in the DWARF:
60556
60557          <3><112f>: Abbrev Number: 2 (DW_TAG_enumerator)
60558             <1130>   DW_AT_name        : (indirect string, offset: 0x19ff): QW0178
60559             <1134>   DW_AT_const_value : 2
60560
60561         gdb handles this reasonably well, but failed to handle the 'QWW'
60562         encoding, which is used for characters outside the base plane.
60563
60564         Also, while working on this, I noticed that gdb will print the decimal
60565         value for an enum character constant:
60566
60567             (gdb) print Char_X
60568             $2 = 1 'x'
60569
60570         This is a nice feature, IMO, because in this situation the 'x' enum
60571         constant does not have its usual decimal value -- it has the value
60572         that's assigned based on the enumeration type.
60573
60574         However, gdb did not do this when it decided to print the constant
60575         using the bracket notation:
60576
60577             (gdb) print Char_Thorn
60578             $3 = ["de"]
60579
60580         This patch changes gdb to print the decimal value here as well, and to
60581         put the bracket notation in single quotes -- otherwise gdb will be
60582         printing something that it can't then read.  Now it looks like:
60583
60584             (gdb) print Char_Thorn
60585             $3 = 4 '["de"]'
60586
60587         Note that gdb can't read longer bracket notations, like the other ones
60588         printed in this test case:
60589
60590             (gdb) print Char_King
60591             $4 = 3 '["01fa00"]'
60592
60593         While I think this is a bug, I plan to fix it separately.
60594
60595         Finally, in the new test case, the copyright dates are chosen this way
60596         because this all started as a copy of an existing test.
60597
60598 2022-02-28  Andrew Burgess  <aburgess@redhat.com>
60599
60600         gdb/python: Add gdb.InferiorThread.details attribute
60601         This adds a new read-only attribute gdb.InferiorThread.details, this
60602         attribute contains a string, the results of target_extra_thread_info
60603         for the thread, or None, if target_extra_thread_info returns nullptr.
60604
60605         As the string returned by target_extra_thread_info is unstructured,
60606         this attribute is only really useful for echoing straight through to
60607         the user, but, if a user wants to write a command that displays the
60608         same, or a similar 'Thread Id' to the one seen in 'info threads', then
60609         they need access to this string.
60610
60611         Given that the string produced by target_extra_thread_info varies by
60612         target, there's only minimal testing of this attribute, I check that
60613         the attribute can be accessed, and that the return value is either
60614         None, or a string.
60615
60616 2022-02-28  Keith Seitz  <keiths@redhat.com>
60617
60618         Error when gdb_is_target_1 is called without running gdb instance
60619         This is a snafu that I encountered while implementing the previous
60620         patch, which attempted to use gdb_is_target_native.  This proc and
60621         gdb_is_target_remote both rely on gdb_is_target_1, which actually
60622         cannot be called without gdb already running.
60623
60624         This patch adds appropriate warning comments to these procs and
60625         causes gdb_is_target_1 to issue a Tcl error if it is called without a
60626         gdb instance already running.  This should prevent unwitting callers
60627         from using this at the wrong time.
60628
60629 2022-02-28  Keith Seitz  <keiths@redhat.com>
60630
60631         Fix gdb.fortran "failed to extract expected results" errors
60632         When running the gdb.fortran tests array-slices.exp and lbound-ubound.exp,
60633         the test suite throws several ERRORs on native-gdbserver/-m{32,64},
60634         and native-extended-gdbsever/-m{32,64}:
60635
60636         [on native-extended-gdbserver/-m64]
60637         Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/array-slices.exp ...
60638         ERROR: failed to extract expected results
60639         ERROR: failed to extract expected results
60640         Running /home/keiths/work/gdb/branches/testsuite-errors/linux/gdb/testsuite/../../../src/gdb/testsuite/gdb.fortran/lbound-ubound.exp ...
60641         ERROR: failed to extract expected results for lbound
60642
60643         This occurs because the tests require inferior I/O which we do not have
60644         access to while using these targets.
60645
60646         This patch skips these tests when running on non-native targets.
60647
60648 2022-02-28  Torbj?rn Svensson  <torbjorn.svensson@st.com>
60649
60650         Further correct the handling of long pathnames on Windows hosts.
60651                 PR 25713
60652                 * bfdio.c (_bfd_real_fopen): Fix handling of parhs longer than 260
60653                 characters on Windows hosts.
60654
60655 2022-02-28  Nick Clifton  <nickc@redhat.com>
60656
60657         Clarify the wording of the error message when an obsolete configuration is encountered.
60658                 PR 28886
60659                 * config.bfd: Update error message for obsolete configurations.
60660
60661 2022-02-28  GDB Administrator  <gdbadmin@sourceware.org>
60662
60663         Automatic date update in version.in
60664
60665 2022-02-27  GDB Administrator  <gdbadmin@sourceware.org>
60666
60667         Automatic date update in version.in
60668
60669 2022-02-26  Kevin Buettner  <kevinb@redhat.com>
60670
60671         Handle recursive internal problem in gdb_internal_error_resync
60672         I came across this problem when testing gdb.base/gdb-sigterm.exp
60673         on a machine with a pre-release version of glib-2.34 installed:
60674
60675         A problem internal to GDB has been detected,
60676         further debugging may prove unreliable.
60677         Quit this debugging session? (y or n) Recursive internal problem.
60678         FAIL: gdb.base/gdb-sigterm.exp: expect eof #0 (GDB internal error)
60679         Resyncing due to internal error.
60680         ERROR: : spawn id exp11 not open
60681             while executing
60682         "expect {
60683         -i exp11 -timeout 10
60684                     -re "Quit this debugging session\\? \\(y or n\\) $" {
60685                         send_gdb "n\n" answer
60686                         incr count
60687                     }
60688                     -re "Create..."
60689             ("uplevel" body line 1)
60690             invoked from within
60691         "uplevel $body" NONE : spawn id exp11 not open
60692         ERROR: Could not resync from internal error (timeout)
60693         gdb.base/gdb-sigterm.exp: expect eof #0: stepped 9 times
60694         UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes
60695
60696         I don't have a problem with the latter ERROR nor the UNRESOLVED
60697         messages.  However the first ERROR regarding the exp11 spawn id
60698         not being open is not especially useful.
60699
60700         This commit handles the "Recursive internal problem" case, avoiding
60701         the problematic ERROR shown above.
60702
60703         With this commit in place, the log messages look like this instead:
60704
60705         A problem internal to GDB has been detected,
60706         further debugging may prove unreliable.
60707         Quit this debugging session? (y or n) Recursive internal problem.
60708         FAIL: gdb.base/gdb-sigterm.exp: expect eof #15 (GDB internal error)
60709         Resyncing due to internal error.
60710         ERROR: Could not resync from internal error (recursive internal problem)
60711         gdb.base/gdb-sigterm.exp: expect eof #15: stepped 12 times
60712         UNRESOLVED: gdb.base/gdb-sigterm.exp: 50 SIGTERM passes
60713
60714         gdb/testsuite/ChangeLog:
60715
60716                 * lib/gdb.exp (gdb_internal_error_resync): Handle "Recursive
60717                 internal problem".
60718
60719 2022-02-26  GDB Administrator  <gdbadmin@sourceware.org>
60720
60721         Automatic date update in version.in
60722
60723 2022-02-25  Aaron Merey  <amerey@redhat.com>
60724
60725         gdb-add-index: disable debuginfod
60726         gdb-add-index may trigger debuginfod's first-use notice.  The notice
60727         is misleading in this case.  It instructs the user to modify .gdbinit
60728         in order to permanently enable/disable debuginfod but gdb-add-index
60729         invokes gdb with -nx which ignores .gdbinit.
60730
60731         Additionally debuginfod is not needed for gdb-add-index since the
60732         symbol file is given as an argument and should already be present
60733         locally.
60734
60735         Fix this by disabling debuginfod when gdb-add-index invokes gdb.
60736
60737 2022-02-25  Andrew Burgess  <aburgess@redhat.com>
60738
60739         gdb: add operator+= and operator+ overload for std::string
60740         This commit adds operator+= and operator+ overloads for adding
60741         gdb::unique_xmalloc_ptr<char> to a std::string.  I could only find 3
60742         places in GDB where this was useful right now, and these all make use
60743         of operator+=.
60744
60745         I've also added a self test for gdb::unique_xmalloc_ptr<char>, which
60746         makes use of both operator+= and operator+, so they are both getting
60747         used/tested.
60748
60749         There should be no user visible changes after this commit, except when
60750         running 'maint selftest', where the new self test is visible.
60751
60752 2022-02-25  Tom Tromey  <tromey@adacore.com>
60753
60754         Print MI prompt on interrupted command
60755         Joel noticed that if the remote dies unexpectedly during a command --
60756         you can simulate this by using "continue" and then killing gdbserver
60757         -- then the CLI will print a new prompt, but MI will not.  Later, we
60758         found out that this was also filed in bugzilla as PR mi/23820.
60759
60760         The output looks something like this:
60761
60762             | (gdb)
60763             | cont
60764             | &"cont\n"
60765             | ~"Continuing.\n"
60766             | ^running
60767             | *running,thread-id="all"
60768             | (gdb)
60769             | [... some output from GDB during program startup...]
60770             | =thread-exited,id="1",group-id="i1"
60771             | =thread-group-exited,id="i1"
60772             | &"Remote connection closed\n"
60773
60774         Now, what about that "(gdb)" in the middle?
60775
60776         That prompt comes from this questionable code in
60777         mi-interp.c:mi_on_resume_1:
60778
60779               /* This is what gdb used to do historically -- printing prompt
60780                  even if it cannot actually accept any input.  This will be
60781                  surely removed for MI3, and may be removed even earlier.  */
60782               if (current_ui->prompt_state == PROMPT_BLOCKED)
60783                 fputs_unfiltered ("(gdb) \n", mi->raw_stdout);
60784
60785         ... which seems like something to remove.  But maybe the intent here
60786         is that this prompt is sufficient, and MI clients must be ready to
60787         handle output coming after a prompt.  On the other hand, if this code
60788         *is* removed, then nothing would print a prompt in this scenario.
60789
60790         Anyway, the CLI and the TUI handle emitting the prompt here by hooking
60791         into gdb::observers::command_error, but MI doesn't install an observer
60792         here.
60793
60794         This patch adds the missing observer and arranges to show the MI
60795         prompt.  Regression tested on x86-64 Fedora 34.
60796
60797         It seems like this area could be improved a bit, by having
60798         start_event_loop call the prompt-displaying code directly, rather than
60799         indirecting through an observer.  However, I haven't done this.
60800
60801         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23820
60802
60803 2022-02-25  Andrew Burgess  <aburgess@redhat.com>
60804             Tom Tromey  <tromey@adacore.com>
60805
60806         gdb/testsuite: fix list.exp test cases
60807         PR testsuite/7142 -- old enough to have been converted from Gnats --
60808         points out that test_list_filename_and_function in gdb.base/list.exp
60809         has "fails" that are unmatched with passes.  This patch cleans this up
60810         a little.
60811
60812         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7142
60813
60814 2022-02-25  Tsukasa OI  <research_trasio@irq.a4lg.com>
60815
60816         RISC-V: Remove a loop in the ISA parser
60817         Since commit e601909a3287bf541c6a7d82214bb387d2c76d82 ("RISC-V: Support
60818         to parse the multi-letter prefix in the architecture string.") changed
60819         so that all prefixed extensions are parsed in single
60820         riscv_parse_prefixed_ext call, a "while" loop on riscv_parse_subset
60821         is no longer required.
60822
60823         bfd/ChangeLog:
60824
60825                 * elfxx-riscv.c (riscv_parse_subset): Remove unnecessary loop.
60826
60827 2022-02-25  Tsukasa OI  <research_trasio@irq.a4lg.com>
60828
60829         RISC-V: Fix mask for some fcvt instructions
60830         This commit fixes incorrect uses of mask values in 'fcvt' instruction
60831         family.
60832
60833         opcodes/ChangeLog:
60834
60835                 * riscv-opc.c (riscv_opcodes): Fix incorrect uses of mask values
60836                 in 'fcvt' instruction family.
60837
60838 2022-02-25  Keith Seitz  <keiths@redhat.com>
60839
60840         Support template lookups in strncmp_iw_with_mode
60841         This patch adds support for wild template parameter list matches, similar
60842         to how ABI tags or function overloads are now handled.
60843
60844         With this patch, users will be able to "gloss over" the details of matching
60845         template parameter lists.  This is accomplished by adding (yet more) logic
60846         to strncmp_iw_with_mode to skip parameter lists if none is explicitly given
60847         by the user.
60848
60849         Here's a simple example using gdb.linespec/cpls-ops.exp:
60850
60851         Before
60852         ------
60853         (gdb) ptype test_op_call
60854         type = struct test_op_call {
60855           public:
60856             void operator()(void);
60857             void operator()(int);
60858             void operator()(long);
60859             void operator()<int>(int *);
60860         }
60861         (gdb) b test_op_call::operator()
60862         Breakpoint 1 at 0x400583: test_op_call::operator(). (3 locations)
60863         (gdb) i b
60864         Num     Type           Disp Enb Address            What
60865         1       breakpoint     keep y   <MULTIPLE>
60866         1.1                         y     0x400583 in test_op_call::operator()(int)
60867                                                            at cpls-ops.cc:43
60868         1.2                         y     0x40058e in test_op_call::operator()()
60869                                                            at cpls-ops.cc:47
60870         1.3                         y     0x40059e in test_op_call::operator()(long)
60871                                                            at cpls-ops.cc:51
60872
60873         The breakpoint at test_op_call::operator()<int> was never set.
60874
60875         After
60876         -----
60877         (gdb) b test_op_call::operator()
60878         Breakpoint 1 at 0x400583: test_op_call::operator(). (4 locations)
60879         (gdb) i b
60880         Num     Type           Disp Enb Address            What
60881         1       breakpoint     keep y   <MULTIPLE>
60882         1.1                         y     0x400583 in test_op_call::operator()(int)
60883                                                            at cpls-ops.cc:43
60884         1.2                         y     0x40058e in test_op_call::operator()()
60885                                                            at cpls-ops.cc:47
60886         1.3                         y     0x40059e in test_op_call::operator()(long)
60887                                                            at cpls-ops.cc:51
60888         1.4                         y     0x4008d0 in test_op_call::operator()<int>(int*)
60889                                                            at cpls-ops.cc:57
60890
60891         Similar to how scope lookups work, passing "-qualified" to the break command
60892         will cause a literal lookup of the symbol.  In the example immediately above,
60893         this will cause GDB to only find the three non-template functions.
60894
60895 2022-02-25  Keith Seitz  <keiths@redhat.com>
60896
60897         Unit tests for strncmp_iw_with_mode
60898         This patch attempts to make a start at adding unit tests for
60899         strncmp_iw_with_mode.  While there is quite a bit of testing
60900         of this function in other tests, these are currently end-to-end
60901         tests.
60902
60903         This patch attempts to cover the basics of string matching, white
60904         space, C++ ABI tags, and several other topics. However, one area
60905         that is ostensibly missing is testing the `match_for_lcd' feature.
60906         This is otherwise tested as part of our end-to-end DejaGNU-based
60907         testing.
60908
60909 2022-02-25  Keith Seitz  <keiths@redhat.com>
60910
60911         Move find_toplevel_char to cp-support.[ch]
60912         find_toplevel_char is being used more and more outside of linespec.c, so
60913         this patch moves it into cp-support.[ch].
60914
60915 2022-02-25  GDB Administrator  <gdbadmin@sourceware.org>
60916
60917         Automatic date update in version.in
60918
60919 2022-02-24  Tom Tromey  <tom@tromey.com>
60920             Andrew Burgess  <aburgess@redhat.com>
60921
60922         Fix crash in Fortran code
60923         PR fortran/28801 points out a gdb crash that can be provoked by
60924         certain Fortran code.  The bug is that f77_get_upperbound assumes the
60925         property is either a constant or undefined, but in this case it is
60926         PROP_LOCEXPR.
60927
60928         This patch fixes the crash by making this function (and the
60929         lower-bound one as well) do the correct check before calling
60930         'const_val'.
60931
60932         Thanks to Andrew for writing the test case.
60933
60934         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28801
60935
60936 2022-02-24  John Baldwin  <jhb@FreeBSD.org>
60937
60938         Revert "do_target_wait_1: Clear TARGET_WNOHANG if the target isn't async."
60939         Commit 14b3360508b1 ("do_target_wait_1: Clear
60940         TARGET_WNOHANG if the target isn't async.") broke some multi-target
60941         tests, such as gdb.multi/multi-target-info-inferiors.exp.  The symptom
60942         is that execution just hangs at some point.  What happens is:
60943
60944         1. One remote inferior is started, and now sits stopped at a breakpoint.
60945            It is not "async" at this point (but it "can async").
60946
60947         2. We run a native inferior, the event loop gets woken up by the native
60948            target's fd.
60949
60950         3. In do_target_wait, we randomly choose an inferior to call target_wait
60951            on first, it happens to be the remote inferior.
60952
60953         4. Because the target is currently not "async", we clear
60954            TARGET_WNOHANG, resulting in synchronous wait.  We therefore block
60955            here:
60956
60957           #0  0x00007fe9540dbb4d in select () from /usr/lib/libc.so.6
60958           #1  0x000055fc7e821da7 in gdb_select (n=15, readfds=0x7ffdb77c1fb0, writefds=0x0, exceptfds=0x7ffdb77c2050, timeout=0x7ffdb77c1f90) at /home/simark/src/binutils-gdb/gdb/posix-hdep.c:31
60959           #2  0x000055fc7ddef905 in interruptible_select (n=15, readfds=0x7ffdb77c1fb0, writefds=0x0, exceptfds=0x7ffdb77c2050, timeout=0x7ffdb77c1f90) at /home/simark/src/binutils-gdb/gdb/event-top.c:1134
60960           #3  0x000055fc7eda58e4 in ser_base_wait_for (scb=0x6250002e4100, timeout=1) at /home/simark/src/binutils-gdb/gdb/ser-base.c:240
60961           #4  0x000055fc7eda66ba in do_ser_base_readchar (scb=0x6250002e4100, timeout=-1) at /home/simark/src/binutils-gdb/gdb/ser-base.c:365
60962           #5  0x000055fc7eda6ff6 in generic_readchar (scb=0x6250002e4100, timeout=-1, do_readchar=0x55fc7eda663c <do_ser_base_readchar(serial*, int)>) at /home/simark/src/binutils-gdb/gdb/ser-base.c:444
60963           #6  0x000055fc7eda718a in ser_base_readchar (scb=0x6250002e4100, timeout=-1) at /home/simark/src/binutils-gdb/gdb/ser-base.c:471
60964           #7  0x000055fc7edb1ecd in serial_readchar (scb=0x6250002e4100, timeout=-1) at /home/simark/src/binutils-gdb/gdb/serial.c:393
60965           #8  0x000055fc7ec48b8f in remote_target::readchar (this=0x617000038780, timeout=-1) at /home/simark/src/binutils-gdb/gdb/remote.c:9446
60966           #9  0x000055fc7ec4da82 in remote_target::getpkt_or_notif_sane_1 (this=0x617000038780, buf=0x6170000387a8, forever=1, expecting_notif=1, is_notif=0x7ffdb77c24f0) at /home/simark/src/binutils-gdb/gdb/remote.c:9928
60967           #10 0x000055fc7ec4f045 in remote_target::getpkt_or_notif_sane (this=0x617000038780, buf=0x6170000387a8, forever=1, is_notif=0x7ffdb77c24f0) at /home/simark/src/binutils-gdb/gdb/remote.c:10037
60968           #11 0x000055fc7ec354d4 in remote_target::wait_ns (this=0x617000038780, ptid=..., status=0x7ffdb77c33c8, options=...) at /home/simark/src/binutils-gdb/gdb/remote.c:8147
60969           #12 0x000055fc7ec38aa1 in remote_target::wait (this=0x617000038780, ptid=..., status=0x7ffdb77c33c8, options=...) at /home/simark/src/binutils-gdb/gdb/remote.c:8337
60970           #13 0x000055fc7f1409ce in target_wait (ptid=..., status=0x7ffdb77c33c8, options=...) at /home/simark/src/binutils-gdb/gdb/target.c:2612
60971           #14 0x000055fc7e19da98 in do_target_wait_1 (inf=0x617000038080, ptid=..., status=0x7ffdb77c33c8, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3636
60972           #15 0x000055fc7e19e26b in operator() (__closure=0x7ffdb77c2f90, inf=0x617000038080) at /home/simark/src/binutils-gdb/gdb/infrun.c:3697
60973           #16 0x000055fc7e19f0c4 in do_target_wait (ecs=0x7ffdb77c33a0, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3716
60974           #17 0x000055fc7e1a31f7 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4061
60975
60976         Before the aforementioned commit, we would not have cleared
60977         TARGET_WNOHANG, the remote target's wait would have returned nothing,
60978         and we would have consumed the native target's event.
60979
60980         After applying this revert, the testsuite state looks as good as before
60981         for me on Ubuntu 20.04 amd64.
60982
60983         Change-Id: Ic17a1642935cabcc16c25cb6899d52e12c2f5c3f
60984
60985 2022-02-24  Andrew Burgess  <aburgess@redhat.com>
60986
60987         gdb: use a range based for loop when iterating over an array
60988         Make use of a range based for loop to iterate over a static global
60989         array, removing the need to have a null entry at the end of the
60990         array.
60991
60992         There should be no user visible changes after this commit.
60993
60994 2022-02-24  Dominique Quatravaux  <dominique.quatravaux@epfl.ch>
60995             Louis-He  <1726110778@qq.com>
60996             Philippe Blain  <levraiphilippeblain@gmail.com>
60997
60998         gdb/darwin: skip over WIFSTOPPED wait4 status
60999         On modern Darwin's, there appears to be a new circumstance in which a
61000         MACH_NOTIFY_DEAD_NAME message can be received, and which was not
61001         previously accounted for: to signal the WIFSTOPPED condition in the
61002         debuggee. In that case the debuggee is not dead yet (and in fact,
61003         counting it as dead would cause a zombie leak - A process in such a
61004         state reparents to PID 1, but cannot be killed).
61005
61006          - Read and ignore such messages (counting on the next exception message
61007            to let us know of the inferior's new state again)
61008          - Refactor logging so as to clearly distinguish between the
61009            MACH_NOTIFY_DEAD_NAME cases (WIFEXITED, WIFSTOPPED, signal, or
61010            something else), and warn in the last case
61011
61012         Change-Id: Ie86904a894e9bd154e6b674b1bfbfbaee7fde3e1
61013
61014 2022-02-24  Simon Marchi  <simon.marchi@polymtl.ca>
61015
61016         gdb/linux-tdep: move "Perms" column right
61017         Commit 29ef4c0699e1 ("gdb/linux-tdep.c: Add Perms to the 'info proc
61018         mappings' output") has broken test gdb.base/info-proc.exp on Linux,
61019         because it changes the output of "info proc mappings" in a way that the
61020         test does not expect (my bad for not testing before pushing).
61021
61022         I looked at how FreeBSD handles this, since I remembered it did show
61023         permission flags.  It looks like this:
61024
61025                   Start Addr           End Addr       Size     Offset   Flags   File
61026                     0x200000           0x243000    0x43000        0x0  r-- CN-- /usr/local/bin/tmux
61027
61028         (I think that `Flags` and the flags not being aligned is not
61029         intentional)
61030
61031         The test passes on FreeBSD, because the test looks for four hex numbers
61032         in a row and ignores the rest:
61033
61034             ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*"
61035
61036         I suggest fixing it on Linux by moving the flags column to the same
61037         place as in the FreeBSD output.  It makes things a bit more consistent
61038         between OSes, and we don't have to touch the test.
61039
61040         At the same time, make use of the actual length of the permission's
61041         string to specify the number of characters to print.
61042
61043         Before this patch, the output looks like:
61044
61045                   Start Addr           End Addr   Perms       Size     Offset objfile
61046               0x55dd4b544000     0x55dd4b546000   r--p      0x2000        0x0 /usr/bin/sleep
61047
61048         and after, it looks like:
61049
61050                   Start Addr           End Addr       Size     Offset  Perms  objfile
61051               0x5622ae662000     0x5622ae664000     0x2000        0x0  r--p   /usr/bin/sleep
61052
61053         Change-Id: If0fc167b010b25f97a3c54e2f491df4973ccde8f
61054
61055 2022-02-24  Simon Marchi  <simon.marchi@polymtl.ca>
61056
61057         gdb/linux-tdep: make read_mapping return a structure
61058         Change read_mapping to return a structure instead of taking many output
61059         parameters.  Change the string + length output parameters (permissions
61060         and device) to be gdb::string_view, since that's what string_view is
61061         for (a non-NULL terminated view on a string).  No changes in behavior
61062         expected.
61063
61064         Change-Id: I86e627d84d3dda8c9b835592b0f4de8d90d12112
61065
61066 2022-02-24  GDB Administrator  <gdbadmin@sourceware.org>
61067
61068         Automatic date update in version.in
61069
61070 2022-02-23  Tom Tromey  <tromey@adacore.com>
61071
61072         Fix bug in C++ overload resolution
61073         PR c++/28901 points out a bug in C++ overload resolution.  When
61074         comparing two overloads, one might be better than the other for
61075         certain parameters -- but, if that one also has some invalid
61076         conversion, then it should never be considered the better choice.
61077         Instead, a valid-but-not-apparently-quite-as-good overload should be
61078         preferred.
61079
61080         This patch fixes this problem by changing how overload comparisons are
61081         done.  I don't believe it should affect any currently valid overload
61082         resolution; nor should it affect resolutions where all the choices are
61083         equally invalid.
61084
61085 2022-02-23  Dominik 'Disconnect3d' Czarnota  <dominik.b.czarnota@gmail.com>
61086
61087         gdb/linux-tdep.c: Add Perms to the 'info proc mappings' output
61088         Fixes #28914 and so it adds a 'Perms' (permissions) column to the
61089         'info proc mappings' command output. This will allow users to know
61090         the memory pages permissions right away from GDB instead of having
61091         to fetch them from the /proc/$pid/maps file (which is also what GDB
61092         does internally, but it just did not print that column).
61093
61094         Below I am also showing how an example output looks like before and
61095         after this commit in case someone wonders.
61096
61097         On i386 targets - before this commit:
61098         ```
61099         (gdb) info proc mappings
61100         process 3461464
61101         Mapped address spaces:
61102
61103             Start Addr   End Addr        Size     Offset objfile
61104             0x56555000 0x56556000      0x1000        0x0 /home/dc/src/binutils-gdb/build/a.out
61105             0x56556000 0x56557000      0x1000     0x1000 /home/dc/src/binutils-gdb/build/a.out
61106             0x56557000 0x56558000      0x1000     0x2000 /home/dc/src/binutils-gdb/build/a.out
61107             0x56558000 0x5655a000      0x2000     0x2000 /home/dc/src/binutils-gdb/build/a.out
61108             0xf7fc4000 0xf7fc8000      0x4000        0x0 [vvar]
61109             0xf7fc8000 0xf7fca000      0x2000        0x0 [vdso]
61110             0xf7fca000 0xf7fcb000      0x1000        0x0 /usr/lib/i386-linux-gnu/ld-2.33.so
61111             0xf7fcb000 0xf7fee000     0x23000     0x1000 /usr/lib/i386-linux-gnu/ld-2.33.so
61112             0xf7fee000 0xf7ffb000      0xd000    0x24000 /usr/lib/i386-linux-gnu/ld-2.33.so
61113             0xf7ffb000 0xf7ffe000      0x3000    0x30000 /usr/lib/i386-linux-gnu/ld-2.33.so
61114             0xfffdc000 0xffffe000     0x22000        0x0 [stack]
61115         (gdb)
61116         ```
61117
61118         On i386 targets - after this commit:
61119         ```
61120         (gdb) info proc mappings
61121         process 3461464
61122         Mapped address spaces:
61123
61124             Start Addr   End Addr   Perms       Size     Offset objfile
61125             0x56555000 0x56556000   r--p      0x1000        0x0 /home/dc/src/binutils-gdb/build/a.out
61126             0x56556000 0x56557000   r-xp      0x1000     0x1000 /home/dc/src/binutils-gdb/build/a.out
61127             0x56557000 0x56558000   r--p      0x1000     0x2000 /home/dc/src/binutils-gdb/build/a.out
61128             0x56558000 0x5655a000   rw-p      0x2000     0x2000 /home/dc/src/binutils-gdb/build/a.out
61129             0xf7fc4000 0xf7fc8000   r--p      0x4000        0x0 [vvar]
61130             0xf7fc8000 0xf7fca000   r-xp      0x2000        0x0 [vdso]
61131             0xf7fca000 0xf7fcb000   r--p      0x1000        0x0 /usr/lib/i386-linux-gnu/ld-2.33.so
61132             0xf7fcb000 0xf7fee000   r-xp     0x23000     0x1000 /usr/lib/i386-linux-gnu/ld-2.33.so
61133             0xf7fee000 0xf7ffb000   r--p      0xd000    0x24000 /usr/lib/i386-linux-gnu/ld-2.33.so
61134             0xf7ffb000 0xf7ffe000   rw-p      0x3000    0x30000 /usr/lib/i386-linux-gnu/ld-2.33.so
61135             0xfffdc000 0xffffe000   rw-p     0x22000        0x0 [stack]
61136         (gdb)
61137         ```
61138
61139         On amd64 targets - after this commit:
61140         ```
61141         (gdb) info proc mappings
61142         process 3461869
61143         Mapped address spaces:
61144
61145                   Start Addr           End Addr   Perms       Size     Offset objfile
61146               0x555555554000     0x555555555000   r--p      0x1000        0x0 /home/dc/src/binutils-gdb/build/a.out
61147               0x555555555000     0x555555556000   r-xp      0x1000     0x1000 /home/dc/src/binutils-gdb/build/a.out
61148               0x555555556000     0x555555557000   r--p      0x1000     0x2000 /home/dc/src/binutils-gdb/build/a.out
61149               0x555555557000     0x555555559000   rw-p      0x2000     0x2000 /home/dc/src/binutils-gdb/build/a.out
61150               0x7ffff7fc3000     0x7ffff7fc7000   r--p      0x4000        0x0 [vvar]
61151               0x7ffff7fc7000     0x7ffff7fc9000   r-xp      0x2000        0x0 [vdso]
61152               0x7ffff7fc9000     0x7ffff7fca000   r--p      0x1000        0x0 /usr/lib/x86_64-linux-gnu/ld-2.33.so
61153               0x7ffff7fca000     0x7ffff7ff1000   r-xp     0x27000     0x1000 /usr/lib/x86_64-linux-gnu/ld-2.33.so
61154               0x7ffff7ff1000     0x7ffff7ffb000   r--p      0xa000    0x28000 /usr/lib/x86_64-linux-gnu/ld-2.33.so
61155               0x7ffff7ffb000     0x7ffff7fff000   rw-p      0x4000    0x31000 /usr/lib/x86_64-linux-gnu/ld-2.33.so
61156               0x7ffffffdd000     0x7ffffffff000   rw-p     0x22000        0x0 [stack]
61157           0xffffffffff600000 0xffffffffff601000   --xp      0x1000        0x0 [vsyscall]
61158         (gdb)
61159         ```
61160
61161         Change-Id: I4991f6cc758cd532eae3ae98c29d22e7bd9d9c36
61162
61163 2022-02-23  Patrick O'Neill  <patrick@rivosinc.com>
61164
61165         RISC-V: PR28733, add missing extension info to 'unrecognized opcode' error
61166         Currently we report errors as "unrecognized opcode `fence.i'" when the
61167         opcode isn't part of the selected extensions.
61168         This patch expands that error message to include the missing extension
61169         information. For example, now the error message would be "unrecognized
61170         opcode `fence.i', extension `zifencei' required".
61171         If the opcode is not a part of any extension, the error message reverts
61172         to "unrecognized opcode `<op statement>'".
61173
61174
61175         bfd/
61176                 pr 28733
61177                 * elfxx-riscv.c (riscv_multi_subset_supports_ext): New function,
61178                 used to return the extension string for each INSN_CLASS_*.
61179                 * elfxx-riscv.h: Added extern riscv_multi_subset_supports_ext.
61180         gas/
61181                 pr 28733
61182                 * config/tc-riscv.c (struct riscv_ip_error): New structure,
61183                 contains information about errors that occur within the riscv_ip.
61184                 (riscv_ip): Use struct riscv_ip_error to report more detailed errors.
61185                 * testsuite/gas/riscv/c-fld-fsd-fail.l: Updated.
61186                 * testsuite/gas/riscv/march-imply-i2p1-01.: Likewise.
61187
61188 2022-02-23  Patrick O'Neill  <patrick@rivosinc.com>
61189
61190         RISC-V: PR28733, add missing extension info to 'invalid CSR' error
61191         Currently we report errors as "invalid CSR 'fscr' for the current ISA"
61192         when the instruction isn't valid.
61193
61194         This patch expands that error message to include the missing extension
61195         information. For example, now the error message would be "invalid CSR
61196         'fscr' for the current ISA, CSR 'fscr' needs 'f' extension".
61197
61198
61199         gas/
61200                 pr 28733
61201                 * config/tc-riscv.c (riscv_csr_address): Report more details
61202                 when the CSR is invalid.
61203                 * testsuite/gas/riscv/csr-version-1p10.l: Updated detailed errors.
61204                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
61205                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
61206                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
61207
61208 2022-02-23  Alan Modra  <amodra@gmail.com>
61209
61210         binutils 2.38 vs. ppc32 linux kernel
61211         Commit b25f942e18d6 made .machine more strict.  Weaken it again.
61212
61213                 * config/tc-ppc.c (ppc_machine): Treat an early .machine specially,
61214                 keeping sticky options to work around gcc bugs.
61215
61216 2022-02-23  Nelson Chu  <nelson.chu@sifive.com>
61217
61218         RISC-V: Updated CSRs to privileged spec v1.12 and debug spec v1.0.
61219         * Removed N extension CSRs,
61220         ustatus, uie, utvec, uscratch, uepc, ucause, utval and uip.
61221
61222         * Removed two supervisor CSRs,
61223         sedeleg and sideleg.
61224
61225         * Changed debug CSR address of scontext from 0x7aa to 0x5a8.  We cannot support
61226         different versions of debug specs for now, so only supporting the latest one is
61227         the only way to move forward.
61228
61229         * Added debug CSRs,
61230         mscontext (0x7aa), mcontrol6 (0x7a1, tdata1) and tmexttrigger ((0x7a1, tdata1).
61231
61232         * Regarded hcontext as a debug CSR.
61233
61234         include/
61235                 * opcode/riscv-opc.h: Updated CSRs to privileged spec v1.12 and
61236                 debug spec v1.0.
61237         gas/
61238                 * testsuite/gas/riscv/csr.s: Updated CSRs to privileged spec v1.12
61239                 and debug spec v1.0.
61240                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
61241                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
61242                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
61243                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
61244                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
61245                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
61246                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
61247                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
61248                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
61249                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
61250                 * testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
61251
61252 2022-02-23  Tsukasa OI  <research_trasio@irq.a4lg.com>
61253
61254         RISC-V: Add Privileged Architecture 1.12 CSRs
61255         This commit adds,
61256
61257         * Most of CSRs as listed in the Privileged Architecture,
61258         version 1.12 (except scontext and mscontext).
61259
61260         * Testcases for most CSRs added on the Privileged
61261         Architecture, version 1.12 (except moved "scontext" and
61262         new "mscontext").
61263
61264         include/ChangeLog:
61265
61266                 * opcode/riscv-opc.h (CSR_SENVCFG, CSR_MCONFIGPTR, CSR_MENVCFG,
61267                 CSR_MSTATUSH, CSR_MENVCFGH, CSR_MTINST, CSR_MTVAL2, CSR_MSECCFG,
61268                 CSR_MSECCFGH, CSR_PMPCFG4, CSR_PMPCFG5, CSR_PMPCFG6,
61269                 CSR_PMPCFG7, CSR_PMPCFG8, CSR_PMPCFG9, CSR_PMPCFG10,
61270                 CSR_PMPCFG11, CSR_PMPCFG12, CSR_PMPCFG13, CSR_PMPCFG14,
61271                 CSR_PMPCFG15, CSR_PMPADDR16, CSR_PMPADDR17, CSR_PMPADDR18,
61272                 CSR_PMPADDR19, CSR_PMPADDR20, CSR_PMPADDR21, CSR_PMPADDR22,
61273                 CSR_PMPADDR23, CSR_PMPADDR24, CSR_PMPADDR25, CSR_PMPADDR26,
61274                 CSR_PMPADDR27, CSR_PMPADDR28, CSR_PMPADDR29, CSR_PMPADDR30,
61275                 CSR_PMPADDR31, CSR_PMPADDR32, CSR_PMPADDR33, CSR_PMPADDR34,
61276                 CSR_PMPADDR35, CSR_PMPADDR36, CSR_PMPADDR37, CSR_PMPADDR38,
61277                 CSR_PMPADDR39, CSR_PMPADDR40, CSR_PMPADDR41, CSR_PMPADDR42,
61278                 CSR_PMPADDR43, CSR_PMPADDR44, CSR_PMPADDR45, CSR_PMPADDR46,
61279                 CSR_PMPADDR47, CSR_PMPADDR48, CSR_PMPADDR49, CSR_PMPADDR50,
61280                 CSR_PMPADDR51, CSR_PMPADDR52, CSR_PMPADDR53, CSR_PMPADDR54,
61281                 CSR_PMPADDR55, CSR_PMPADDR56, CSR_PMPADDR57, CSR_PMPADDR58,
61282                 CSR_PMPADDR59, CSR_PMPADDR60, CSR_PMPADDR61, CSR_PMPADDR62,
61283                 CSR_PMPADDR63): New CSR macros.
61284
61285         gas/ChangeLog:
61286
61287                 * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
61288                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
61289                 * testsuite/gas/riscv/csr.s: Add new CSRs.
61290                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
61291                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
61292                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
61293                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
61294                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
61295                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
61296                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
61297                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
61298
61299 2022-02-23  Tsukasa OI  <research_trasio@irq.a4lg.com>
61300
61301         RISC-V: Reorganize testcases for CFI directives
61302         This commit reorganizes and adds some CSRs to csr-dw-regnums.[sd] to
61303         make it test the same CSRs as csr.s.
61304
61305         gas/ChangeLog:
61306
61307                 * testsuite/gas/riscv/csr-dw-regnums.s: Reorganize and add
61308                 defined CSRs tested in csr.s.
61309                 * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
61310
61311 2022-02-23  GDB Administrator  <gdbadmin@sourceware.org>
61312
61313         Automatic date update in version.in
61314
61315 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61316
61317         NEWS: Note that the FreeBSD async target supports async mode.
61318
61319 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61320
61321         inf-ptrace: Add an event_pipe to be used for async mode in subclasses.
61322         Subclasses of inf_ptrace_target have to opt-in to using the event_pipe
61323         by implementing the can_async_p and async methods.  For subclasses
61324         which do this, inf_ptrace_target provides is_async_p, async_wait_fd
61325         and closes the pipe in the close target method.
61326
61327         inf_ptrace_target also provides wrapper routines around the event pipe
61328         (async_file_open, async_file_close, async_file_flush, and
61329         async_file_mark) for use in target methods such as async.
61330         inf_ptrace_target also exports a static async_file_mark_if_open
61331         function which can be used in SIGCHLD signal handlers.
61332
61333 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61334
61335         Enable async mode in the target in attach_cmd.
61336         If the attach target supports async mode, enable it after the
61337         attach target's ::attach method returns.
61338
61339         fbsd-nat: Return nullptr rather than failing ::thread_name.
61340         ptrace on FreeBSD cannot be used against running processes and instead
61341         fails with EBUSY.  This meant that 'info threads' would fail if any of
61342         the threads were running (for example when using schedule-multiple=on
61343         in gdb.base/fork-running-state.exp).  Instead of throwing errors, just
61344         return nullptr as no thread name is better than causing info threads to
61345         fail completely.
61346
61347 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61348
61349         fbsd-nat: Various cleanups to the ::resume entry debug message.
61350         Move the message from 'show debug fbsd-lwp' to 'show debug fbsd-nat'
61351         since it is helpful for debugging async target support and not just
61352         LWP support.
61353
61354         Use target_pid_to_str to format the ptid and log the step and signo
61355         arguments.
61356
61357 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61358
61359         fbsd-nat: Include ptrace operation in error messages.
61360
61361 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61362
61363         fbsd-nat: Implement async target support.
61364         This is a fairly simple version of async target support.
61365
61366         Synchronous mode still uses blocking waitpid() calls in
61367         inf_ptrace::wait() unlike the Linux native target which always uses
61368         WNOHANG and uses sigsuspend() for synchronous operation.
61369
61370         Asynchronous mode registers an event pipe with the core as a file
61371         handle and writes to the pipe when SIGCHLD is raised.  TARGET_WNOHANG
61372         is handled by inf_ptrace::wait().
61373
61374 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61375
61376         inf-ptrace: Support async targets in inf_ptrace_target::wait.
61377         - Handle TARGET_WNOHANG by passing WNOHANG to waitpid and returning
61378           TARGET_WAITKIND_IGNORE if there are no events to report.
61379
61380         - Handle a race in async mode where SIGCHLD might signal the event
61381           pipe for an event that has already been reported.  If the event was
61382           the exit of the last child process, waitpid() will fail with ECHILD
61383           rather than returning a pid of 0.  For this case, return
61384           TARGET_WAITKIND_NO_RESUMED.
61385
61386 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61387
61388         inf-ptrace: Return an IGNORE event if waitpid() fails.
61389         Previously this returned a TARGET_WAITKIND_SIGNALLED event for
61390         inferior_ptid.  However, inferior_ptid is invalid during ::wait()
61391         methods after the multi-target changes, so this was triggering an
61392         assertion further up the stack.
61393
61394         do_target_wait_1: Clear TARGET_WNOHANG if the target isn't async.
61395         Previously, TARGET_WNOHANG was cleared if a target supported async
61396         mode even if async mode wasn't currently enabled.  This change only
61397         permits TARGET_WNOHANG if async mode is enabled.
61398
61399 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61400
61401         Don't enable async mode at the end of target ::resume methods.
61402         Now that target_resume always enables async mode after target::resume
61403         returns, these calls are redundant.
61404
61405         The other place that target resume methods are invoked outside of
61406         target_resume are as the beneath target in record_full_wait_1.  In
61407         this case, async mode should already be enabled when supported by the
61408         target before the resume method is invoked due to the following:
61409
61410           In general, targets which support async mode run as async until
61411           ::wait returns TARGET_WAITKIND_NO_RESUMED to indicate that there are
61412           no unwaited for children (either they have exited or are stopped).
61413           When that occurs, the loop in wait_one disables async mode.  Later
61414           if a stopped child is resumed, async mode is re-enabled in
61415           do_target_resume before waiting for the next event.
61416
61417           In the case of record_full_wait_1, this function is invoked from the
61418           ::wait target method when fetching an event.  If the underlying
61419           target supports async mode, then an earlier call to do_target_resume
61420           to resume the child reporting an event in the loop in
61421           record_full_wait_1 would have already enabled async mode before
61422           ::wait was invoked.  In addition, nothing in the code executed in
61423           the loop in record_full_wait_1 disables async mode.  Async mode is
61424           only disabled higher in the call stack in wait_one after ::wait
61425           returns.
61426
61427           It is also true that async mode can be disabled by an
61428           INF_EXEC_COMPLETE event passed to inferior_event_handle, but all of
61429           the places that invoke that are in the gdb core which is "above" a
61430           target ::wait method.
61431
61432         Note that there is an earlier call to enable async mode in
61433         linux_nat_target::resume.  That call also marks the async event pipe
61434         to report an existing event after enabling async mode, so it needs to
61435         stay.
61436
61437 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61438
61439         Enable async mode on supported targets in target_resume.
61440         Enabling async mode above the target layer removes duplicate code in
61441         ::resume methods of async-capable targets.  Commit 5b6d1e4fa4f
61442         ("Multi-target support") enabled async mode in do_target_resume after
61443         target_resume returns which is a step in this direction.  However,
61444         other callers of target_resume such as target_continue do not enable
61445         async mode.  Rather than enabling async mode in each of the callers
61446         after target_resume returns, enable async mode at the end of
61447         target_resume.
61448
61449         gdbserver linux-low: Convert linux_event_pipe to the event_pipe class.
61450         Use event_pipe from gdbsupport in place of the existing file
61451         descriptor array.
61452
61453         gdb linux-nat: Convert linux_nat_event_pipe to the event_pipe class.
61454         Use event_pipe from gdbsupport in place of the existing file
61455         descriptor array.
61456
61457 2022-02-22  John Baldwin  <jhb@FreeBSD.org>
61458
61459         gdbsupport: Add an event-pipe class.
61460         This pulls out the implementation of an event pipe used to implement
61461         target async support in both linux-low.cc (gdbserver) and linux-nat.c
61462         (gdb).
61463
61464         This will be used to replace the existing event pipe in linux-low.cc
61465         and linux-nat.c in future commits.
61466
61467         Co-Authored-By: Lancelot SIX <lsix@lancelotsix.com>
61468
61469 2022-02-22  Ruslan Kabatsayev  <b7.10110111@gmail.com>
61470
61471         gdb: fix detection of compilation and linking flags for source-highlight
61472         Currently there are two problems with the detection of
61473         source-highlight via pkg-config in GDB's configure script:
61474
61475         1. The LDFLAGS variable is used to pass the 'pkg-config --libs' output
61476         to AC_LINK_IFELSE, which results in the "-L/some/path
61477         -lsource-highlight" preceding the conftest.cpp, which can result in a
61478         failure to find symbols referenced in conftest.cpp, if the linker is
61479         using --as-needed by default.
61480
61481         2. The CFLAGS variable is used to pass the 'pkg-config --cflags'
61482         output to AC_LINK_IFELSE.  However, as the current language is C++,
61483         AC_LINK_IFELSE will actuall use CXXFLAGS, not CFLAGS, so any flags
61484         returned from pkg-config will not be seen.
61485
61486         This patch fixes both of these mistakes, allowing GDB to correctly
61487         configure and build using source-highlight installed into a custom
61488         prefix, e.g. ~/opt/gdb-git (because the system version of
61489         source-highlight is too old).
61490
61491 2022-02-22  Philippe Blain  <levraiphilippeblain@gmail.com>
61492
61493         gdb/testsuite/README: point to default value of INTERNAL_GDBFLAGS
61494         The INTERNAL_GDBFLAGS runtest variable was updated in 55c3ad88013
61495         ([gdb/testsuite] Prevent pagination in GDB_INTERNALFLAGS, 2020-10-26) to
61496         disable pagination, and in aae1c79a03a (PR python/12227..., 2010-12-07)
61497         to point to the data directory, but its default value mentioned in the
61498         testsuite's README was not kept up to date.
61499
61500         To avoid it getting out of sync even more, point the reader to the
61501         definition of the variable in lib/gdb.exp, and move the explanation of
61502         the different flags there. Also adjust the example in the README
61503         so it follows the flags added in 55c3ad88013.
61504
61505         Change-Id: I3533608a7d6ae5198af09c7dc7743bde24c19ed7
61506
61507 2022-02-22  Kito Cheng  <kito.cheng@sifive.com>
61508
61509         RISC-V: Maintain a string to hold the canonical order
61510         Using dummy entry in riscv_supported_std_ext cause confusing and wrongly
61511         support `b` and `k` extensions.
61512
61513         bfd/
61514                 * elfxx-riscv.c (riscv_supported_std_ext): Drop unsupported
61515                 extensions.
61516                 (riscv_ext_canonical_order): New.
61517                 (riscv_init_ext_order): Use riscv_ext_canonical_order rather
61518                 than riscv_supported_std_ext to compute canonical order.
61519
61520         V2 Changes:
61521
61522         - Use `*ext` rather than `*ext != NULL` for checking is reach end of
61523           string.
61524
61525 2022-02-22  GDB Administrator  <gdbadmin@sourceware.org>
61526
61527         Automatic date update in version.in
61528
61529 2022-02-21  Alan Modra  <amodra@gmail.com>
61530
61531         Re: ld: Support customized output section type
61532         "DO NOT EDIT!" says the comment at the top of bfd-in2.h.  Move the new
61533         type field where it belongs.
61534
61535                 PR ld/28841
61536                 * section.c (struct bfd_section): Add type.  Formatting.
61537                 (BFD_FAKE_SECTION): Formatting.
61538                 * bfd-in2.h: Regenerate.
61539
61540 2022-02-21  Mike Frysinger  <vapier@gentoo.org>
61541
61542         sim: gdbinit: hoist setup to common code
61543         This was left in subdirs because of the dynamic cgen usage.  However,
61544         we can move this breakpoint call to runtime and let gdb detect whether
61545         the symbol exists.
61546
61547 2022-02-21  Andrew Burgess  <aburgess@redhat.com>
61548
61549         gdb/testsuite: relax pattern in new gdb.mi/mi-multi-commands.exp test
61550         I saw some failures in the test gdb.mi/mi-multi-commands.exp that I
61551         added recently.  This test was added in commit:
61552
61553           commit d08cbc5d3203118da5583296e49273cf82378042
61554           Date:   Wed Dec 22 12:57:44 2021 +0000
61555
61556               gdb: unbuffer all input streams when not using readline
61557
61558         The failures I see only occurred when my machine was very heavily
61559         loaded.
61560
61561         In this test I send multiple commands from dejagnu to gdb with a
61562         single send_gdb call.  In a well behaving world what I want to happen
61563         is that the gdb console sees both commands arrive and echos the text
61564         of those commands.  Then gdb starts processing the first command,
61565         prints the result, and then processes the second command, and prints
61566         the result.
61567
61568         However, what I saw in my loaded environment was that only after
61569         sending the two commands, only the first command was echoed to gdb's
61570         terminal.  Then gdb started processing the first command, and started
61571         to write the output.  Now, mixed in with the first command output, the
61572         second command was echoed to gdb's terminal.  Finally, gdb would
61573         finish printing the first command output, and would read and handle
61574         the second command.
61575
61576         This mixing of command echoing with the first command output was
61577         causing the test matching patterns to fail.
61578
61579         In this commit I change the command I use in the test from a CLI
61580         command to an MI command, this reduces the number of lines of output
61581         that come from the test, CLI commands sent through the MI interpreter
61582         are echoed back like this:
61583
61584           (gdb)
61585           set $a = "FIRST COMMAND"
61586           &"set $a = \"FIRST COMMAND\"\n"
61587           ^done
61588           (gdb)
61589
61590         While this is not the case for true MI command:
61591
61592           (gdb)
61593           -data-evaluate-expression $a
61594           ^done,value="\"FIRST COMMAND\""
61595           (gdb)
61596
61597         Less output makes for simpler patterns to match against.
61598
61599         Next, when sending two command to gdb I was previously trying to spot
61600         the output of the first command followed by the prompt with nothing
61601         between.  This is not really needed, for the first command I can look
61602         for just the ^done,value="\"FIRST COMMAND\"" string, then I can start
61603         looking for the output of the second command.
61604
61605         So long as the second pattern matches up to the gdb prompt, then I can
61606         be sure than nothing is left over in the expect buffer to muck up
61607         later matches.
61608
61609         As to see the second command output gdb must have read in the second
61610         command, the second command output never suffers from the corruption
61611         that the first command output does.
61612
61613         Since making this change, I've not seen a failure in this test.
61614
61615 2022-02-21  Andrew Burgess  <aburgess@redhat.com>
61616
61617         gdb: avoid nullptr access in dbxread.c from read_dbx_symtab
61618         This fixes a GDB crash reported in bug pr/28900, related to reading in
61619         some stabs debug information.
61620
61621         In this commit my goal is to stop GDB crashing.  I am not trying to
61622         ensure that GDB makes the best possible use of the available stabs
61623         debug information.  At this point I consider stabs a legacy debug
61624         format, with only limited support in GDB.
61625
61626         So, the problem appears to be that, when reading in the stabs data, we
61627         need to find a N_SO entry, this is the entry that defines the start of
61628         a compilation unit (or at least the location of a corresponding source
61629         file).
61630
61631         It is while handling an N_SO that GDB creates a psymtab to hold the
61632         incoming debug information (symbols, etc).
61633
61634         The problem we hit in the bug is that we encounter some symbol
61635         information (an N_PC entry) outside of an N_SO entry - that is we find
61636         some symbol information that is not associated with any source file.
61637
61638         We already have some protection for this case, look (in
61639         read_dbx_symtab) at the handling of N_PC entries of type 'F' and 'f',
61640         if we have no psymtab (the pst variable is nullptr) then we issue a
61641         complaint.  However, for whatever reason, in both 'f' and 'F'
61642         handling, there is one place where we assume that the pst
61643         variable (the psymtab) is not nullptr.  This is a mistake.
61644
61645         In this commit, I guard these two locations (in 'f' and 'F' handling)
61646         so we no longer assume pst is not nullptr.
61647
61648         While I was at it, I audited all the other uses of pst in
61649         read_dbx_symtab, and in every potentially dangerous case I added a
61650         nullptr check, and issue a suitable complaint if pst is found to be
61651         nullptr.
61652
61653         It might well be true that we could/should do something smarter if we
61654         see a debug symbol outside of an N_SO entry, and if anyone wanted to
61655         do that work, they're welcome too.  But this commit is just about
61656         preventing the nullptr access, and the subsequent GDB crash.
61657
61658         I don't have any tests for this change, I have no idea how to generate
61659         weird stabs data for testing.  The original binary from the bug report
61660         now loads just fine without GDB crashing.
61661
61662         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28900
61663
61664 2022-02-21  Andrew Burgess  <aburgess@redhat.com>
61665
61666         gdb: make use of std::string in dbxread.c and xcoffread.c
61667         While taking a look through dbxread.c I spotted a couple of places
61668         where making use of std::string would remove the need for manual
61669         memory allocation and memcpy.
61670
61671         During review Simon pointed out that the same code exists in
61672         xcoffread.c, so I've applied the same fix there too.
61673
61674         There should be no user visible changes after this commit.
61675
61676 2022-02-21  GDB Administrator  <gdbadmin@sourceware.org>
61677
61678         Automatic date update in version.in
61679
61680 2022-02-20  Lancelot SIX  <lancelot.six@amd.com>
61681
61682         gdb: Only paginate for filtered output in fputs_maybe_filtered
61683         A have had situation where a unfiltered output (done using
61684         fputs_unfiltered) ended up triggering pagination.  The backtrace for this was:
61685
61686             ...
61687             #24 0x000055839377ee4e in check_async_event_handlers () at ../../gdb/async-event.c:335
61688             #25 0x0000558394b67b57 in gdb_do_one_event () at ../../gdbsupport/event-loop.cc:216
61689             #26 0x0000558394587454 in gdb_readline_wrapper (prompt=0x7ffd907712d0 "--Type <RET> for more, q to quit, c to continue without paging--") at ../../gdb/top.c:1148
61690             #27 0x0000558394707270 in prompt_for_continue () at ../../gdb/utils.c:1438
61691             #28 0x00005583947088b3 in fputs_maybe_filtered (linebuffer=0x60c0000f4000 "   [...quite big message...]", stream=0x60300028e9d0, filter=0) at ../../gdb/utils.c:1752
61692             #29 0x0000558394708e57 in fputs_unfiltered (linebuffer=0x60c0000f4000 "   [...quite big message...]", stream=0x60300028e9d0) at ../../gdb/utils.c:1811
61693             ...
61694
61695         This comes from what appears to be a oversight in fputs_maybe_filtered.  This
61696         function has a FILTER parameter which if true makes the function pause after
61697         every screenful (i.e. triggers pagination).
61698
61699         The filter parameter is correctly used to guard the first place where
61700         prompt_for_continue.  There is a second place in the function which can call
61701         prompt_for_continue, but is currently unguarded.  I believe that this is an
61702         oversight, this patch fixes that.
61703
61704         Tested on Linux-x86_64, no regression observed.
61705
61706         Change-Id: Iad8ffd50a87cf20077500878e2564b5a7dc81ece
61707
61708 2022-02-20  GDB Administrator  <gdbadmin@sourceware.org>
61709
61710         Automatic date update in version.in
61711
61712 2022-02-19  Dominique Quatravaux  <dominique.quatravaux@epfl.ch>
61713
61714         gdb/darwin: remove not-so-harmless spurious call to `wait4`
61715         As seen in https://sourceware.org/bugzilla/show_bug.cgi?id=24069 this
61716         code will typically wait4() a second time on the same process that was
61717         already wait4()'d a few lines above. While this used to be
61718         harmless/idempotent (when we assumed that the process already exited),
61719         this now causes a deadlock in the WIFSTOPPED case.
61720
61721         The early (~2019) history of bug #24069 cautiously suggests to use
61722         WNOHANG instead of outright deleting the call. However, tests on the
61723         current version of Darwin (Big Sur) demonstrate that gdb runs just fine
61724         without a redundant call to wait4(), as would be expected.
61725         Notwithstanding the debatable value of conserving bug compatibility with
61726         an OS release that is more than a decade old, there is scant evidence of
61727         what that double-wait4() was supposed to achieve in the first place - A
61728         cursory investigation with `git blame` pinpoints commits bb00b29d7802
61729         and a80b95ba67e2 from the 2008-2009 era, but fails to answer the
61730         "why" question conclusively.
61731
61732         Co-Authored-By: Philippe Blain <levraiphilippeblain@gmail.com>
61733         Change-Id: Id4e4415d66d6ff6b3552b60d761693f17015e4a0
61734
61735 2022-02-19  GDB Administrator  <gdbadmin@sourceware.org>
61736
61737         Automatic date update in version.in
61738
61739 2022-02-18  Tom Tromey  <tromey@adacore.com>
61740
61741         Add constructor to bound_minimal_symbol
61742         This adds a constructor to bound_minimal_symbol, to avoid a build
61743         failure with clang that Simon pointed out.
61744
61745         I also took the opportunity to remove some redundant initializations,
61746         and to change one use of push_back to emplace_back, as suggested by
61747         Simon.
61748
61749 2022-02-18  Roland McGrath  <mcgrathr@google.com>
61750
61751         Fix typo in ld.texi
61752         ld/
61753                 * ld.texi (Output Section Type): Fix typo in @code syntax.
61754
61755 2022-02-18  Simon Marchi  <simon.marchi@polymtl.ca>
61756
61757         gdb: remove newlines from some linux_nat_debug_printf calls
61758         Change-Id: I80328fab7096221356864b5a4fb30858b48d2c10
61759
61760 2022-02-18  GDB Administrator  <gdbadmin@sourceware.org>
61761
61762         Automatic date update in version.in
61763
61764 2022-02-17  Nick Clifton  <nickc@redhat.com>
61765
61766         Updated Serbian translations for the bfd, gold, ld and opcodes directories
61767
61768 2022-02-17  GDB Administrator  <gdbadmin@sourceware.org>
61769
61770         Automatic date update in version.in
61771
61772 2022-02-16  Fangrui Song  <maskray@google.com>
61773
61774         ld: Support customized output section type
61775         bfd/
61776             PR ld/28841
61777             * bfd-in2.h (struct bfd_section): Add type.
61778             (discarded_section): Add field.
61779             * elf.c (elf_fake_sections): Handle bfd_section::type.
61780             * section.c (BFD_FAKE_SECTION): Add field.
61781             * mri.c (mri_draw_tree): Update function call.
61782
61783         ld/
61784             PR ld/28841
61785             * ld.texi: Document new output section type.
61786             * ldlex.l: Add new token TYPE.
61787             * ldgram.y: Handle TYPE=exp.
61788             * ldlang.h: Add type_section to list of section types.
61789             * ldlang.c (lang_add_section): Handle type_section.
61790             (map_input_to_output_sections): Handle type_section.
61791             * testsuite/ld-scripts/output-section-types.t: Add tests.
61792             * testsuite/ld-scripts/output-section-types.d: Update.
61793
61794 2022-02-16  Andrew Burgess  <aburgess@redhat.com>
61795
61796         gdb/tui: add a missing white space character
61797         Just adds a missing space.  There should be no user visible changes
61798         after this commit.
61799
61800         gdb: convert callback_handler_installed from int to bool
61801         Simple int to bool conversion on callback_handler_installed in
61802         event-top.c.  There should be no user visible changes after this
61803         commit.
61804
61805 2022-02-16  Alan Modra  <amodra@gmail.com>
61806
61807         gas local label and dollar label handling
61808         Much of the gas source and older BFD source use "long" for function
61809         parameters and variables, when other types would be more appropriate.
61810         This patch fixes one of those cases.  Dollar labels and numeric local
61811         labels do not need large numbers.  Small positive itegers are usually
61812         all that is required.  Due to allowing longs, it was possible for
61813         fb_label_name and dollar_label_name to overflow their buffers.
61814
61815                 * symbols.c: Delete unnecessary forward declarations.
61816                 (dollar_labels, dollar_label_instances): Use unsigned int.
61817                 (dollar_label_defined, dollar_label_instance): Likewise.
61818                 (define_dollar_label): Likewise.
61819                 (fb_low_counter, fb_labels, fb_label_instances): Likewise.
61820                 (fb_label_instance_inc, fb_label_instance): Likewise.
61821                 (fb_label_count, fb_label_max): Make them size_t.
61822                 (dollar_label_name, fb_label_name): Rewrite using sprintf.
61823                 * symbols.h (dollar_label_defined): Update prototype.
61824                 (define_dollar_label, dollar_label_name): Likewise.
61825                 (fb_label_instance_inc, fb_label_name): Likewise.
61826                 * config/bfin-lex.l (yylex): Remove unnecessary casts.
61827                 * expr.c (integer_constant): Likewise.
61828                 * read.c (read_a_source_file): Limit numeric label range to int.
61829
61830 2022-02-16  Alan Modra  <amodra@gmail.com>
61831
61832         ubsan: s_app_line integer overflow
61833         There are quite a few ubsan warnings in gas.  This one disappears with
61834         a code tidy.
61835
61836                 * read.c (s_app_line): Rename 'l' to 'linenum'.  Avoid ubsan
61837                 warning.
61838
61839 2022-02-16  Alan Modra  <amodra@gmail.com>
61840
61841         pe_ILF_make_a_symbol_reloc segfault
61842         pei-aarch64-little apparently lacks support for BFD_RELOC_RVA.
61843
61844                 * peicode.h (pe_ILF_make_a_symbol_reloc): Don't segfault on
61845                 NULL howto.
61846
61847 2022-02-16  Alan Modra  <amodra@gmail.com>
61848
61849         What to do when sh_addralign isn't a power of two
61850         BFD generally doesn't handle anything but a power of two section
61851         alignment, and ELF sh_addralign is required to be an integral power of
61852         two (or zero) by the ELF spec.  Of course this is ignored by fuzzers,
61853         and because bfd_log2 rounds up, we can end up with alignment_power
61854         being 32 on a 32-bit object or 64 on a 64-bit object.  That then
61855         triggers ubsan warnings in places like bfd_update_compression_header
61856         where we want to convert from alignment_power back to an alignment.
61857         I suppose we could reject object files that have non-compliant
61858         sh_addralign, but I think it's also reasonable to use the greatest
61859         power of two divisor of sh_addralign, ie. the rightmost 1 bit.
61860
61861                 * elf.c (_bfd_elf_make_section_from_shdr): Use greatest power
61862                 of two divisor of sh_addralign.
61863                 (_bfd_elf_assign_file_position_for_section): Likewise.
61864                 (assign_file_positions_for_non_load_sections): Likewise.
61865
61866 2022-02-16  Alan Modra  <amodra@gmail.com>
61867
61868         asan: buffer overflow in vms-alpha.c
61869                 * vms-alpha.c (evax_bfd_print_dst): Sanity check another place
61870                 printing strings.
61871
61872         asan : use of uninitialized value in buffer_and_nest
61873                 * macro.c (buffer_and_nest): Don't read past end of string buffer.
61874
61875         asan: buffer overflow in peXXigen.c
61876                 * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Properly
61877                 sanity check DataDirectory[PE_DEBUG_DATA].Size.
61878
61879 2022-02-16  Hans-Peter Nilsson  <hp@axis.com>
61880
61881         sim/common: Improve sim_dump_memory head comment
61882         As requested by Mike.
61883
61884                 * sim-memopt.c: Improve head comment.
61885
61886 2022-02-16  Hans-Peter Nilsson  <hp@axis.com>
61887
61888         sim/testsuite/cris/c/stat3.c: Fix formatting nit
61889         * c/stat3.c (main): Fix formatting nit.
61890
61891 2022-02-16  Mike Frysinger  <vapier@gentoo.org>
61892
61893         sim: testsuite: cleanup the istarget * logic
61894         Now that the multitarget testing has settled, clean up the cases where
61895         istarget * is used.  This ends up being mostly style unindenting.
61896
61897 2022-02-16  GDB Administrator  <gdbadmin@sourceware.org>
61898
61899         Automatic date update in version.in
61900
61901 2022-02-15  H.J. Lu  <hjl.tools@gmail.com>
61902
61903         i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL
61904         Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation
61905         in read-only section.
61906
61907         bfd/
61908
61909                 PR ld/28894
61910                 * elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow
61911                 R_386_TLS_IE.
61912
61913         ld/
61914                 PR ld/28894
61915                 * testsuite/ld-i386/i386.exp: Run pr28894.
61916                 * testsuite/ld-i386/pr28894.d: New file.
61917                 * testsuite/ld-i386/pr28894.s: Likewise.
61918
61919 2022-02-15  Hans-Peter Nilsson  <hp@axis.com>
61920
61921         sim/testsuite: Default global_cc_os and global_cc_works properly
61922         There was an omission on 3e6dc39ed7a8 "sim/testsuite: Set
61923         global_cc_os also when no compiler is found"; global_cc_os
61924         wasn't set for other than the primary target, which means
61925         that the "unguarded" use of global_cc_os in
61926         testsuite/cris/c/c.exp caused the dreaded "ERROR: can't read
61927         "global_cc_os": no such variable" when e.g. configuring for
61928         pru-elf and doing "make check-sim".  Better initializing
61929         both variables at the top to default values, rather than
61930         adding another single 'set global_cc_os ""', to reduce the
61931         risk of not setting them properly if or when that
61932         if-statement-chain is made longer.
61933
61934         sim/testsuite:
61935                 * lib/sim-defs.exp (sim_init_toolchain): Default
61936                 global_cc_os and global_cc_works properly, before if-chain.
61937
61938 2022-02-15  H.J. Lu  <hjl.tools@gmail.com>
61939
61940         x86: Add has_sib to struct instr_info
61941         Add has_sib to struct instr_info and use SIB info only if ins->has_sib
61942         is true.
61943
61944                 PR binutils/28892
61945                 * i386-dis.c (instr_info): Add has_sib.
61946                 (get_sib): Set has_sib.
61947                 (OP_E_memory): Replace havesib with ins->has_sib.
61948                 (OP_VEX): Use ins->sib.index only if ins->has_sib is true.
61949
61950 2022-02-15  Lancelot SIX  <lancelot.six@amd.com>
61951
61952         gdb: Respect the DW_CC_nocall attribute
61953         It is possible for a compiler to optimize a function in a such ways that
61954         the function does not follow the calling convention of the target.  In
61955         such situation, the compiler can use the DW_AT_calling_convention
61956         attribute with the value DW_CC_nocall to tell the debugger that it is
61957         unsafe to call the function.  The DWARF5 standard states, in 3.3.1.1:
61958
61959           > If the value of the calling convention attribute is the constant
61960           > DW_CC_nocall, the subroutine does not obey standard calling
61961           > conventions, and it may not be safe for the debugger to call this
61962           > subroutine.
61963
61964         Non standard calling convention can affect GDB's assumptions in multiple
61965         ways, including how arguments are passed to the function, how values are
61966         returned, and so on.  For this reason, it is unsafe for GDB to try to do
61967         the following operations on a function with marked with DW_CC_nocall:
61968
61969         - call / print an expression requiring the function to be evaluated,
61970         - inspect the value a function returns using the 'finish' command,
61971         - force the value returned by a function using the 'return' command.
61972
61973         This patch ensures that if a command which relies on GDB's knowledge of
61974         the target's calling convention is used on a function marked nocall, GDB
61975         prints an appropriate message to the user and does not proceed with the
61976         operation which is unreliable.
61977
61978         Note that it is still possible for someone to use a vendor specific
61979         value for the DW_AT_calling_convention attribute for example to indicate
61980         the use of an alternative calling convention.  This commit does not
61981         prevent this, and target dependent code can be adjusted if one wanted to
61982         support multiple calling conventions.
61983
61984         Tested on x86_64-Linux, with no regression observed.
61985
61986         Change-Id: I72970dae68234cb83edbc0cf71aa3d6002a4a540
61987
61988 2022-02-15  Lancelot SIX  <lancelot.six@amd.com>
61989             Simon Marchi  <simon.marchi@polymtl.ca>
61990
61991         gdb: add a symbol* argument to get_return_value
61992         Add an argument to the get_return_value function to indicate the symbol
61993         of the function the debuggee is returning from.  This will be used by
61994         the following patch.
61995
61996         Since the function return type can be deduced from the symbol remove the
61997         value_type argument which becomes redundant.
61998
61999         No user visible change after this patch.
62000
62001         Tested on x86_64-linux.
62002
62003         Change-Id: Idf1279f1f7199f5022738a6679e0fa63fbd22edc
62004
62005 2022-02-15  H.J. Lu  <hjl.tools@gmail.com>
62006
62007         x86-64: Use MAXPAGESIZE for the relro segment alignment
62008         Adjust x86-64 linker tests after reverting
62009
62010         commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be
62011         Author: Alan Modra <amodra@gmail.com>
62012         Date:   Thu Feb 3 08:57:47 2022 +1030
62013
62014             PR28824, relro security issues, x86 keep COMMONPAGESIZE relro
62015
62016         to use MAXPAGESIZE for the end of the relro segment alignment, like other
62017         ELF targets.
62018
62019                 * testsuite/ld-x86-64/plt-main-bnd.dd: Updated.
62020                 * testsuite/ld-x86-64/plt-main-ibt-x32.dd: Likewise.
62021                 * testsuite/ld-x86-64/plt-main-ibt.dd: Likewise.
62022                 * testsuite/ld-x86-64/pr14207.d: Likewise.
62023                 * testsuite/ld-x86-64/pr18176.d: Likewise.
62024                 * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
62025                 * testsuite/ld-x86-64/pr20830a.d: Likewise.
62026                 * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
62027                 * testsuite/ld-x86-64/pr20830b.d: Likewise.
62028                 * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
62029                 * testsuite/ld-x86-64/pr21038a.d: Likewise.
62030                 * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
62031                 * testsuite/ld-x86-64/pr21038b.d: Likewise.
62032                 * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
62033                 * testsuite/ld-x86-64/pr21038c.d: Likewise.
62034
62035 2022-02-15  H.J. Lu  <hjl.tools@gmail.com>
62036
62037         Revert "PR28824, relro security issues, x86 keep COMMONPAGESIZE relro"
62038         This reverts commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be.
62039
62040 2022-02-15  GDB Administrator  <gdbadmin@sourceware.org>
62041
62042         Automatic date update in version.in
62043
62044 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62045
62046         sim/testsuite/cris: If failing compilation, mark C tests as errors
62047         ...when we know we have a working compiler.  This will reduce
62048         the risk of faulty edits by exposing them rather than hiding
62049         them as "unresolved".  It also harmonizes behavior with that of
62050         run_sim_test.
62051
62052                 * c/c.exp: Mark C tests failing compilation test errors.
62053
62054 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62055
62056         sim/testsuite/cris: Remove faulty use of basename in C tests
62057         Calls to basename were added here as part of commit
62058         e1e1ae6e9b5e "sim: testsuite: fix objdir handling", but that
62059         commit missed adding "#include <libgen.h>" or the equivalent
62060         GNU extension, see basename(3).  Fixing that shows a logical
62061         error in the change to openpf1.c; the non-/-prefixed
62062         code-path was changed instead of the "/"-prefixed code-path,
62063         which is the one executed after that commit.
62064
62065         For "newlib" these tests failed linking after that commit.
62066         Recent newlib has the (asm-renamed) GNU-extension-variant of
62067         basename, but we're better off not using it at all.
62068
62069         Unfortunately, compilation failures for C tests run by the
62070         machinery in c.exp are currently just marked "unresolved",
62071         in contrast to C and assembler tests run by calling
62072         run_sim_test.
62073
62074         The interaction of calling with the full program-path vs.
62075         use of --sysroot exposes a consistency problem: when
62076         --sysroot is used, argv[0] isn't the path by which the
62077         program can find itself.  It's undecided whether argv[0] for
62078         the program running in the simulator should be edited
62079         (related to the naked argument to the simulator before
62080         passing on to the simulated program) to remove a leading
62081         --sysroot.  Either way, such a change would be out of scope
62082         for this commit.
62083
62084                 * c/stat3.c (mybasename): New macro.  Use it instead of basename.
62085                 * c/openpf1.c: Correct basename-related change and update related
62086                 comment.
62087
62088 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62089
62090         sim: Add sim_dump_memory for debugging
62091         Intended to be called from the debugger tool.
62092
62093         sim/common:
62094                 * sim-memopt.c (sim_dump_memory): New function.
62095
62096 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62097
62098         sim: Fix use of out-of-tree assembler and linker when testing
62099         With commit 7a259895bb2d "sim: testsuite: expand arch specific
62100         toolchain settings", trying to use out-of-tree ld and as at test-time
62101         broke for the "primary target", like when testing a release-tarball.
62102
62103         Subsequent to that commit, all assembler tests without in-tree-built
62104         tools FAIL, getting errors when trying to call
62105         $(abs_builddir)/../gas/as-new.  But, that isn't the actual culprint;
62106         it's actually it's its immediate predecessor, commit 8996c21067373
62107         "sim: testsuite: setup per-port toolchain settings for multitarget
62108         build", which hardcodes in-tree-paths to those tools instead of
62109         considering e.g. $(<X>_FOR_TARGET), the preferred overridable variable
62110         for single-target builds, as set up by the toplevel Makefile.
62111
62112         This commit calls GCC_TARGET_TOOL (a deceptive name; gcc-specific
62113         features aren't used) from toplev/config/acx.m4, somewhat like calls
62114         in toplev/configure.ac but without the NCN_STRICT_CHECK_TARGET_TOOLS
62115         step, for each X to find a value for $(<X>_FOR_TARGET).  N.B.: in-tree
62116         tools still override any ${target}-${tool} found in $PATH, i.e. only
62117         previously broken builds are affected.
62118
62119         The variables $(<X>_FOR_TARGET) are usually overridden by the toplevel
62120         Makefile to the same value or better, but has to be set here too, as
62121         automake "wants" Makefiles to be self-contained (you get an error
62122         pointing out that the variable may be empty).  If it hadn't been for
62123         that, SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET would not be needed.
62124         This detail should only (positively) affect users invoking "make
62125         check" in sim/ instead of "make check-sim" (or "make check") at the
62126         toplevel.  Now the output from "configure" matches the target tools
62127         actually used by sim at test-time, for the "primary target".
62128
62129         Using $(CC) for "example-" targets CC_FOR_TARGET is not changed, as
62130         that appears to be a deliberate special-case.
62131
62132         Note that all tools still have to be installed and present in
62133         $PATH at configure-time to be properly used at test-time.
62134
62135         sim:
62136                 * m4/sim_ac_toolchain.m4 (SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET):
62137                 New defun.
62138                 (SIM_TOOLCHAIN_VARS): Call it using AC_REQUIRE, and use variables
62139                 AS_FOR_TARGET, LD_FOR_TARGET and CC_FOR_TARGET instead of hard-coded
62140                 values.
62141                 * Makefile.in, configure: Regenerate.
62142
62143 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62144
62145         sim cris: Unbreak --disable-sim-hardware builds
62146         With --disable-sim-hardware (--enable-sim-hardware=no),
62147         whose default was changed to --enable-sim-hardware(=yes) in
62148         commit 34cf51120683, building for cris-elf fails as
62149         sim_hw_parse then doesn't exist.
62150
62151         A cris-elf simulator configured for --enable-sim-hardware
62152         (or the default after to the mentioned commit) runs about
62153         2.5x slower than one configured --disable-sim-hardware.
62154         A further 2-5% performance regression was not investigated.
62155
62156         When sim_hw_parse doesn't exist, --cris-900000xx can't be
62157         supported.  The best action here is to remove it completely,
62158         so its absence can be identified through --help, but
62159         avoiding littering the code with "#if WITH_HW".
62160
62161         sim/cris:
62162                 * sim-if.c (cris_options) [WITH_HW]: Conditionalize
62163                 support of option --cris-900000xx.
62164                 (sim_open) [WITH_HW]: Conditionalize sim_hw_parse
62165                 call.
62166
62167 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62168
62169         sim/testsuite/cris: As applicable, require simoption --cris-900000xx
62170         Apply the new run_sim_test option "require" as in "#require
62171         simoption --cris-900000xx" for all tests using that option.
62172         This allows a clean test-suite-run for a build with
62173         --disable-sim-hardware, where that option is not supported,
62174         by skipping those tests as "untested".
62175
62176         sim/testsuite/cris:
62177                 * asm/io1.ms, asm/io2.ms, asm/io3.ms, asm/io6.ms,
62178                 asm/io7.ms: Call "#require: simoption --cris-900000xx".
62179
62180 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62181
62182         sim/testsuite: Support "requires: simoption <--name-of-option>"
62183         Simulator features can be present or not, typically
62184         depending on different-valued configure options, like
62185         --enable-sim-hardware[=off|=on].  To avoid failures in
62186         test-suite-runs when testing such configurations, a new
62187         predicate is needed, as neither "target", "progos" nor
62188         "mach" fits cleanly.
62189
62190         The immediate need was to check for presence of a simulator
62191         option, but rather than a specialized "requires-simoption:"
62192         predicate I thought I'd handle the general (parametrized)
62193         need, so here's a generic predicate machinery and a (first)
62194         predicate to use together with it; checking whether a
62195         particular option is supported, by looking at "run --help"
62196         output.  This was inspired by the check_effective_target_
62197         machinery in the gcc test-suite.
62198
62199         Multiple "requires: <requirement> <parameter>" form a list of
62200         predicates (with parameters), to be used as a conjunction.
62201
62202         sim/testsuite:
62203                 * lib/sim-defs.exp (sim_check_requires_simoption): New function.
62204                 (run_sim_test): Support "requires: <requirement> <parameter>".
62205
62206 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62207
62208         sim/testsuite/cris/hw/rv-n-cris/irq1.ms: Disable due to randomness
62209         For reasons that remain largely to be investigated (besides
62210         the apparent lack of synchronization between two processes),
62211         this test fails randomly, with two different sets of common
62212         outputs.  Curiously, that doesn't happen for the other
62213         similar tests.  There's a comment that mentions this, though
62214         that doesn't make it a sustainable part of a test-suite.
62215         (Known-blinking tests should be disabled until fixed.)
62216
62217         sim/testsuite/cris:
62218                 * hw/rv-n-cris/irq1.ms: Disable by use of a never-matched
62219                 "progos" value.
62220
62221 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62222
62223         sim/testsuite/cris/c: Use -sim3 but only for newlib targets
62224         Commit a39487c6685f "sim: cris: use -sim with C tests for cris-elf
62225         targets" caused " -sim" to be appended to CFLAGS_FOR_TARGET for
62226         cris*-*-elf, where testing had until then relied on
62227         "RUNTESTFLAGS=--target_board=cris-sim" being passed when running "make
62228         check-sim", adding the right options.  While "-sim" happens to work,
62229         the baseboard-file cris-sim.exp uses "-sim3" so for consistency use
62230         that instead.
62231
62232         Then commit b42f20d2ac72 "sim: testsuite: drop most specific istarget
62233         checks" caused " -sim" to be appended for *all* targets, which just
62234         doesn't work.  For example, for crisv32-linux-gnu, that's not a
62235         recognized option and will cause a dejagnu error and further testing
62236         in c.exp will be aborted.
62237
62238         While cris-sim.exp appends "-static" for *-linux-gnu, further changes
62239         in the test-suite have caused "linux"-specific tests to break, so that
62240         part will be tended to separately.
62241
62242         But, save and restore CFLAGS_FOR_TARGET around the modification and
62243         use where needed, to not have the CRIS-specific modification affect a
62244         continuing test-run (possibly for other targets).
62245
62246         sim/testsuite/cris:
62247                 * c/c.exp (CFLAGS_FOR_TARGET): Replace appended option " -sim"
62248                 with " -sim3", but do it conditionally for newlib targets.  Save
62249                 and restore CFLAGS_FOR_TARGET in saved_CFLAGS_FOR_TARGET such
62250                 that it doesn't affect the value of CFLAGS_FOR_TARGET outside
62251                 c.exp.
62252
62253 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62254
62255         sim/testsuite: Set global_cc_os also when no compiler is found
62256         If we don't set this variable, it doesn't exist, and using "#progos:"
62257         in an assembler-file will cause an error rather than just skipping the
62258         test, viz:
62259
62260         Running /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp ...
62261         ERROR: tcl error sourcing /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp.
62262         ERROR: can't read "global_cc_os": no such variable
62263             while executing
62264         "if { $opts(progos) != "" && $opts(progos) != $global_cc_os } {
62265                 untested $subdir/$name
62266                 return
62267             }"
62268             (procedure "run_sim_test" line 102)
62269
62270         Neither the commit introducing progos, nor the top comment
62271         in run_sim_test, mentions progos as intended only for C
62272         tests, or that its use must be gated on $global_cc_works !=
62273         0, so (not) setting it in the no-working-compiler path seems
62274         just overlooked.
62275
62276         Allowing it to be used for assembler tests makes it usable
62277         for e.g. an always-false predicate and in expressions in
62278         .exp files without gating on $global_cc_works != 0.
62279
62280         With this patch, global_cc_os is set to "", just as for "unknown OS".
62281
62282             sim/testsuite:
62283                 * lib/sim-defs.exp (sim_init_toolchain): Set global_cc_os also when
62284                 no working target C compiler is found.
62285
62286 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62287
62288         sim/testsuite/cris: Assembler testcase for PRIx32 usage bug
62289         Several C test-cases exposed the bug, but let's have one for
62290         people who test using just the assembler and linker.
62291
62292                 * asm/endmem1.ms: New test.
62293
62294 2022-02-14  Hans-Peter Nilsson  <hp@axis.com>
62295
62296         sim cris: Correct PRIu32 to PRIx32
62297         In 5ee0bc23a68f "sim: clean up bfd_vma printing" there was
62298         an additional introduction of PRIx32 and PRIu32 but just in
62299         sim/cris/sim-if.c.  One type of bug was fixed in commit
62300         d16ce6e4d581 "sim: cris: fix memory setup typos" but one
62301         remained; the PRIu32 usage is wrong, as hex output is
62302         desired; note the 0x prefix.
62303
62304         Without this fix, you'll see output like:
62305          memory map 0:0x4000..0x5fff (8192 bytes) overlaps 0:0x0..0x16383 (91012 bytes)
62306          program stopped with signal 6 (Aborted).
62307         for some C programs, like some of the ones in the sim/cris/c
62308         testsuite from where the example is taken (freopen2.c).
62309
62310         The bug behavior was with memory allocation.  With an
62311         attempt to allocate memory using the brk syscall such that
62312         the room up to the next 8192-byte "page boundary" wasn't
62313         sufficient, the simulator memory allocation machinery horked
62314         on a consistency error when trying to allocate a memory
62315         block to raise the "end of the data segment": there was
62316         already memory allocated at that address.
62317
62318         Unfortunately, none of the programs in sim/cris/asm exposed
62319         this bug at the time, but an assembler test-case is
62320         committed after this fix.
62321
62322         sim/cris:
62323                 * sim-if.c (sim_open): Correct PRIu32 to PRIx32.
62324
62325 2022-02-14  Sergei Trofimovich  <siarheit@google.com>
62326
62327         microblaze: fix fsqrt collicion to build on glibc-2.35
62328                 * microblaze-opcm.h: Renamed 'fsqrt' to 'microblaze_fsqrt'.
62329                 * microblaze-opc.h: Follow 'fsqrt' rename.
62330
62331 2022-02-14  Tom Tromey  <tom@tromey.com>
62332
62333         Remove LA_PRINT_STRING
62334         This removes the LA_PRINT_STRING macro, in favor of using ordinary
62335         method calls.
62336
62337         Remove LA_PRINT_CHAR
62338         This removes the LA_PRINT_CHAR macro, in favor of using ordinary
62339         method calls.
62340
62341         Remove LA_PRINT_TYPE
62342         This removes the LA_PRINT_TYPE macro, in favor of using ordinary
62343         method calls.
62344
62345 2022-02-14  Andrew Burgess  <andrew.burgess@embecosm.com>
62346
62347         gdb/python: move styling support to gdb.styling
62348         This commit moves the two Python functions that are used for styling
62349         into a new module, gdb.styling, there's then a small update in
62350         python.c so GDB can find the functions in their new location.
62351
62352         The motivation for this change is purely to try and reduce the clutter
62353         in the top-level gdb module, and encapsulate related functions into
62354         modules.  I did ponder documenting these functions as part of the
62355         Python API, however, doing so would effectively "fix" the API, and I'm
62356         still wondering if there's improvements that could be made, also, the
62357         colorize function is only called in some cases now that GDB prefers
62358         libsource-highlight, so it's not entirely sure how this would work as
62359         part of a user facing API.
62360
62361         Still, despite these functions never having been part of a documented
62362         API, it is possible that a user out there has overridden these to, in
62363         some way, customize how GDB performs styling.  Moving the function as
62364         I propose in this patch could break things for that user, however,
62365         fixing this breakage is trivial, and, as these functions were never
62366         documented, I don't think we should be obliged to not break user code
62367         that relies on them.
62368
62369 2022-02-14  Andrew Burgess  <andrew.burgess@embecosm.com>
62370
62371         gdb: use python to colorize disassembler output
62372         This commit adds styling support to the disassembler output, as such
62373         two new commands are added to GDB:
62374
62375           set style disassembler enabled on|off
62376           show style disassembler enabled
62377
62378         In this commit I make use of the Python Pygments package to provide
62379         the styling.  I did investigate making use of libsource-highlight,
62380         however, I found the highlighting results to be inferior to those of
62381         Pygments; only some mnemonics were highlighted, and highlighting of
62382         register names such as r9d and r8d (on x86-64) was incorrect.
62383
62384         To enable disassembler highlighting via Pygments, I've added a new
62385         extension language hook, which is then implemented for Python.  This
62386         hook is very similar to the existing hook for source code
62387         colorization.
62388
62389         One possibly odd choice I made with the new hook is to pass a
62390         gdb.Architecture through, even though this is currently unused.  The
62391         reason this argument is not used is that, currently, styling is
62392         performed identically for all architectures.
62393
62394         However, even though the Python function used to perform styling of
62395         disassembly output is not part of any documented API, I don't want
62396         to close the door on a user overriding this function to provide
62397         architecture specific styling.  To do this, the user would inevitably
62398         require access to the gdb.Architecture, and so I decided to add this
62399         field now.
62400
62401         The styling is applied within gdb_disassembler::print_insn, to achieve
62402         this, gdb_disassembler now writes its output into a temporary buffer,
62403         styling is then applied to the contents of this buffer.  Finally the
62404         gdb_disassembler buffer is copied out to its final destination stream.
62405
62406         There's a new test to check that the disassembler output includes some
62407         escape sequences, though I don't check for specific colours; the
62408         precise colors will depend on which instructions are in the
62409         disassembler output, and, I guess, how pygments is configured.
62410
62411         The only negative change with this commit is how we currently style
62412         addresses in GDB.
62413
62414         Currently, when the disassembler wants to print an address, we call
62415         back into GDB, and GDB prints the address value using the `address`
62416         styling, and the symbol name using `function` styling.  After this
62417         commit, if pygments is used, then all disassembler styling is done
62418         through pygments, and this include the address and symbol name parts
62419         of the disassembler output.
62420
62421         I don't know how much of an issue this will be for people.  There's
62422         already some precedent for this in GDB when we look at source styling.
62423         For example, function names in styled source listings are not styled
62424         using the `function` style, but instead, either GNU Source Highlight,
62425         or pygments gets to decide how the function name should be styled.
62426
62427         If the Python pygments library is not present then GDB will continue
62428         to behave as it always has, the disassembler output is mostly
62429         unstyled, but the address and symbols are styled using the `address`
62430         and `function` styles, as they are today.
62431
62432         However, if the user does `set style disassembler enabled off`, then
62433         all disassembler styling is switched off.  This obviously covers the
62434         use of pygments, but also includes the minimal styling done by GDB
62435         when pygments is not available.
62436
62437 2022-02-14  H.J. Lu  <hjl.tools@gmail.com>
62438
62439         ld: Keep indirect symbol from IR if referenced from shared object
62440         Don't change indirect symbol defined in IR to undefined if it is
62441         referenced from shared object.
62442
62443         bfd/
62444
62445                 PR ld/28879
62446                 * elflink.c (_bfd_elf_merge_symbol): Don't change indirect
62447                 symbol defined in IR to undefined if it is referenced from
62448                 shared object.
62449
62450         ld/
62451
62452                 PR ld/28879
62453                 * testsuite/ld-plugin/lto.exp: Run PR ld/28879 tests.
62454                 * testsuite/ld-plugin/pr28879a.cc: New file.
62455                 * testsuite/ld-plugin/pr28879b.cc: Likewise.
62456
62457 2022-02-14  GDB Administrator  <gdbadmin@sourceware.org>
62458
62459         Automatic date update in version.in
62460
62461 2022-02-13  Alan Modra  <amodra@gmail.com>
62462
62463         PR28882, build failure with gcc-4.2 due to use of 0b literals
62464                 PR 28882
62465                 * elf/loongarch.h: Replace binary literals with hex.
62466
62467 2022-02-13  Alan Modra  <amodra@gmail.com>
62468
62469         Don't pass around expld.dataseg pointer
62470         The better to see any code that accesses expld.dataseg.
62471
62472                 * ldexp.c (fold_segment_end): Remove seg parameter.  Adjust calls.
62473                 (fold_segment_align, fold_segment_relro_end): Likewise.
62474                 * ldlang.c (lang_size_segment): Likewise.
62475                 (lang_size_relro_segment_1, lang_find_relro_sections_1): Likewise.
62476
62477 2022-02-13  Alan Modra  <amodra@gmail.com>
62478
62479         Remove bfd ELF_RELROPAGESIZE
62480         Now that ld properly aligns the end of the relro segment, the hack to
62481         make relro work on powerpc can disappear.
62482
62483         bfd/
62484                 * bfd.c (bfd_emul_get_commonpagesize): Remove relro param.
62485                 Don't return bed->relropagesize.
62486                 * elf-bfd.h (struct elf_backend_data): Remove relropagesize.
62487                 * elfxx-target.h (ELF_RELROPAGESIZE): Remove.
62488                 * elf32-ppc.c (ELF_RELROPAGESIZE): Don't define.
62489                 * elf64-ppc.c: Likewise.
62490                 * bfd-in2.h: Regenerate.
62491         ld/
62492                 * ldemul.c (after_parse_default): Adjust
62493                 bfd_emul_get_commonpagesize call.
62494
62495 2022-02-13  Alan Modra  <amodra@gmail.com>
62496
62497         PR28824, relro security issues, x86 keep COMMONPAGESIZE relro
62498         x86 treats MAXPAGESIZE as a memory optimisation parameter, actual
62499         hardware paging is always COMMPAGESIZE of 4k.  Use COMMONPAGESIZE for
62500         the end of the relro segment alignment.
62501
62502         The previous patch regresses pr18176, increasing the testcase file
62503         size from 322208 to 2099872 bytes.  Fixing this on x86 will require
62504         introducing a gap after the end of the relro segment (of up to
62505         relropagesize-1 bytes).
62506
62507                 PR 28824
62508                 PR 18176
62509                 * ld.h (ld_config_type): Add relro_use_commonpagesize field.
62510                 * ldexp.c (fold_segment_align): Set relropagesize depending on
62511                 relro_use_commonpagesize.
62512                 * emultempl/elf-x86.em (elf_x86_create_output_section_statements):
62513                 Set relro_use_commonpagesize.
62514                 * testsuite/ld-x86-64/pr18176.d: xfail.
62515
62516 2022-02-13  Alan Modra  <amodra@gmail.com>
62517
62518         PR28824, relro security issues
62519         Background
62520         ==========
62521         There are constraints on layout of binaries to meet demand paging and
62522         memory protection requirements.  Demand paged binaries must have file
62523         offset mod pagesize equal to vma mod pagesize.  Memory protection
62524         (executable, read, write status) can only change at page boundaries.
62525         The linker's MAXPAGESIZE variable gives the page size for these layout
62526         constraints.
62527
62528         In a typical basic executable with two memory segments, text (RE) and
62529         data (RW), the data segment must start on a different page to the
62530         last text segment page.  For example, with 64k pages and a small
62531         executable of 48k text and 1k data, the text segment might start at
62532         address 0x10000 and data at 0x20000 for a total of two 64k memory
62533         pages.  Demand paging would require the image on disk to be 64k+1k
62534         in size.  We can do better than that.  If the data segment instead
62535         starts at 0x2c000 (the end of the text segment plus one 64k page) then
62536         there are still only two memory pages, but the disk image is now
62537         smaller, 48k+1k in size.  This is why the linker normally starts the
62538         data segment at the end of the text segment plus one page.  That
62539         simple heuristic isn't ideal in all cases.  Changing our simple
62540         example to one with 64k-1 text size, following that heuristic would
62541         result in data starting at 0x2ffff.  Now we have two 64k memory data
62542         pages for a data segment of 1k!  If the data segment instead started
62543         at 0x30000 we'd get a single data segment page at the cost of 1 byte
62544         extra in the disk image, which is likely a good trade-off.  So the
62545         linker does adjust the simple heuristic.  Just how much disk image
62546         size increase is allowed is controlled by the linker's COMMONPAGESIZE
62547         variable.
62548
62549         A PT_GNU_RELRO segment overlays the initial part of the data segment,
62550         saying that those pages should be made read-only after relocation by
62551         the dynamic loader.  Page granularity for memory protection means that
62552         the end of the relro segment must be at a page boundary.
62553
62554         The problem
62555         ===========
62556         Unfortunately most targets currently only align the end of the relro
62557         segment to COMMONPAGESIZE.  That results in only partial relro
62558         protection if an executable is running with MAXPAGESIZE pages, since
62559         any part of the relro segment past the last MAXPAGESIZE boundary can't
62560         be made read-only without also affecting sections past the end of the
62561         relro segment.  I believe this problem arose because x86 always runs
62562         with 4k (COMMPAGESIZE) memory pages, and therefore using a larger
62563         MAXPAGESIZE on x86 is for reasons other than the demand paging and
62564         memory page protection boundary requirements.
62565
62566         The solution
62567         ============
62568         Always end the relro segment on a MAXPAGESIZE boundary, except for
62569         x86.  Note that the relro segment, comprising of sections at the start
62570         of the data segment, is sized according to how those sections are laid
62571         out.  That means the start of the relro segment is fixed relative to
62572         its end.  Which also means the start of the data segment must be at a
62573         fixed address mod MAXPAGESIZE.  So for relro the linker can't play
62574         games with the start of the data segment to save disk space.  At
62575         least, not without introducing gaps between the relro sections.  In
62576         fact, because the linker was starting layout using its simple
62577         heuristic of starting the data segment at the end of the text segment
62578         plus one page, it was sometimes introducing page gaps for no reason.
62579         See pr28743.
62580
62581                 PR 28824
62582                 PR 28734
62583                 * ldexp.c (fold_segment_align): When relro, don't adjust up by
62584                 offset within page.  Set relropagesize.
62585                 (fold_segment_relro_end): Align to relropagesize.
62586                 * ldexp.h (seg_align_type): Rename pagesize to commonpagesize.
62587                 Add relropagesize.  Comment.
62588                 * ldlang.c (lang_size_segment): Adjust to suit field renaming.
62589                 (lang_size_relro_segment_1): Align relro_end using relropagesize.
62590
62591 2022-02-13  GDB Administrator  <gdbadmin@sourceware.org>
62592
62593         Automatic date update in version.in
62594
62595 2022-02-12  GDB Administrator  <gdbadmin@sourceware.org>
62596
62597         Automatic date update in version.in
62598
62599 2022-02-11  H.J. Lu  <hjl.tools@gmail.com>
62600
62601         x86: Disallow invalid relocation against protected symbol
62602         I am checking this into master and will backport it to 2.38 branch.
62603
62604         H.J
62605         ----
62606         On x86, GCC 12 supports -mno-direct-extern-access to enable canonical
62607         reference to protected function and disable copy relocation.  With
62608         -mno-direct-extern-access, the canonical protected function symbols must
62609         be accessed via canonical reference and the protected data symbols in
62610         shared libraries are non-copyable. Under glibc 2.35, non-canonical
62611         reference to the canonical protected function will get the run-time error:
62612
62613         ./y: internal_f: ./libfoo.so: non-canonical reference to canonical protected function
62614
62615         and copy relocations against the non-copyable protected symbols will get
62616         the run-time error:
62617
62618         ./x: internal_i: ./libfoo.so: copy relocation against non-copyable protected symbol
62619
62620         Update x86 linker to disallow non-canonical reference to the canonical
62621         protected function:
62622
62623         ld: plt.o: non-canonical reference to canonical protected function `internal_f' in libfoo.so
62624         ld: failed to set dynamic section sizes: bad value
62625
62626         and copy relocation against the non-copyable protected symbol:
62627
62628         ld: main.o: copy relocation against non-copyable protected symbol `internal_i' in libfoo.so
62629
62630         at link-time.
62631
62632         bfd/
62633
62634                 PR ld/28875
62635                 * elf-properties.c (_bfd_elf_parse_gnu_properties): Don't skip
62636                 shared libraries for GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
62637                 * elf32-i386.c (elf_i386_scan_relocs): Disallow non-canonical
62638                 reference to canonical protected function.
62639                 * elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
62640                 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Don't allow copy
62641                 relocation against non-copyable protected symbol.
62642
62643         ld/
62644
62645                 PR ld/28875
62646                 * testsuite/ld-i386/i386.exp: Check non-canonical reference to
62647                 canonical protected function and check copy relocation against
62648                 non-copyable protected symbol.
62649                 * testsuite/ld-i386/pr21997-1.err: New file.
62650                 * testsuite/ld-i386/pr28875.err: Likewise.
62651                 * testsuite/ld-i386/pr28875a.c: Likewise.
62652                 * testsuite/ld-i386/pr28875b.c: Likewise.
62653                 * testsuite/ld-x86-64/pr21997-1a.err: Updated.
62654                 * testsuite/ld-x86-64/pr21997-1b.err: Likewise.
62655                 * testsuite/ld-x86-64/pr28875-data.err: New file.
62656                 * testsuite/ld-x86-64/pr28875-func.err: Likewise.
62657                 * testsuite/ld-x86-64/x86-64.exp: Check non-canonical reference
62658                 to canonical protected function and check copy relocation against
62659                 non-copyable protected symbol.
62660
62661 2022-02-11  Tom Tromey  <tromey@adacore.com>
62662
62663         Add initializers to bound_minimal_symbol
62664         This adds initializers to bound_minimal_symbol, allowing for the
62665         removal of some calls to memset.
62666
62667 2022-02-11  Bhuvanendra Kumar N  <Bhuvanendra.KumarN@amd.com>
62668
62669         gdb/fortran: support ptype and print commands for namelist variables
62670         Gfortran supports namelists (a Fortran feature); it emits
62671         DW_TAG_namelist and DW_TAG_namelist_item dies. But gdb does not
62672         process these dies and does not support 'print' or 'ptype' commands on
62673         namelist variables.
62674
62675         An attempt to print namelist variables results in gdb bailing out with
62676         the error message as shown below.
62677
62678           (gdb) print nml
62679           No symbol "nml" in current context.
62680
62681         This commit is to make the print and ptype commands work for namelist
62682         variables and its items. Sample output of these commands is shared
62683         below, with fixed gdb.
62684
62685           (gdb) ptype nml
62686           type = Type nml
62687               integer(kind=4) :: a
62688               integer(kind=4) :: b
62689           End Type nml
62690           (gdb) print nml
62691           $1 = ( a = 10, b = 20 )
62692
62693 2022-02-11  Bruno Larsen  <blarsen@redhat.com>
62694
62695         gdb: fix until behavior with trailing !is_stmt lines
62696         When using the command "until", it is expected that GDB will exit a
62697         loop if the current instruction is the last one related to that loop.
62698         However, if there were trailing non-statement instructions, "until"
62699         would just behave as "next".  This was noticeable in clang-compiled
62700         code, but might happen with gcc-compiled as well.  PR gdb/17315 relates
62701         to this problem, as running gdb.base/watchpoint.exp with clang
62702         would fail for this reason.
62703
62704         To better understand this issue, consider the following source code,
62705         with line numbers marked on the left:
62706
62707           10:   for (i = 0; i < 10; ++i)
62708           11:     loop_body ();
62709           12:   other_stuff ();
62710
62711         If we transform this to pseudo-assembler, and generate a line table,
62712         we could end up with something like this:
62713
62714           Address | Pseudo-Assembler | Line | Is-Statement?
62715
62716           0x100   | i = 0            | 10   | Yes
62717           0x104   | loop_body ()     | 11   | Yes
62718           0x108   | i = i + 1        | 10   | Yes
62719           0x10c   | if (i < 10):     | 10   | No
62720           0x110   |     goto 0x104   | 10   | No
62721           0x114   | other_stuff ()   | 12   | Yes
62722
62723         Notice the two non-statement instructions at the end of the loop.
62724
62725         The problem is that when we reach address 0x108 and use 'until',
62726         hoping to leave the loop, GDB sets up a stepping range that runs from
62727         the start of the function (0x100 in our example) to the end of the
62728         current line table entry, that is 0x10c in our example.  GDB then
62729         starts stepping forward.
62730
62731         When 0x10c is reached GDB spots that we have left the stepping range,
62732         that the new location is not a statement, and that the new location is
62733         associated with the same source line number as the previous stepping
62734         range.  GDB then sets up a new stepping range that runs from 0x10c to
62735         0x114, and continues stepping forward.
62736
62737         Within that stepping range the inferior hits the goto (at 0x110) and
62738         loops back to address 0x104.
62739
62740         At 0x104 GDB spots that we have left the previous stepping range, that
62741         the new address is marked as a statement, and that the new address is
62742         for a different source line.  As a result, GDB stops and returns
62743         control to the user.  This is not what the user was expecting, they
62744         expected GDB to exit the loop.
62745
62746         The fix proposed in this patch, is that, when the user issues the
62747         'until' command, and GDB sets up the initial stepping range, GDB will
62748         check subsequent SALs (symtab_and_lines) to see if they are
62749         non-statements associated with the same line number.  If they are then
62750         the end of the initial stepping range is extended to the end of the
62751         non-statement SALs.
62752
62753         In our example above, the user is at 0x108 and uses 'until', GDB now
62754         sets up a stepping range from the start of the function 0x100 to
62755         0x114, the first address associated with a different line.
62756
62757         Now as GDB steps around the loop it never leaves the initial stepping
62758         range.  It is only when GDB exits the loop that we leave the stepping
62759         range, and the stepping finishes at address 0x114.
62760
62761         This patch also adds a test case that can be run with gcc to test that
62762         this functionality is not broken in the future.
62763
62764         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17315
62765
62766 2022-02-11  Richard Sandiford  <richard.sandiford@arm.com>
62767
62768         gas/doc: Fix "a true results" typo
62769
62770 2022-02-11  Jan Vrany  <jan.vrany@labware.com>
62771
62772         gdb: extend the information printed by 'maint info jit'
62773         This commit updates the output of 'maint info jit' to print not just
62774         the jit_code_entry address, but also the symfile address, and the
62775         symfile size.
62776
62777         The new information could be obtained by looking into target memory at
62778         the contents of the jit_code_entry, but, by storing this information
62779         within gdb at the time the jit object is loaded, it is now possible to
62780         check if the jit_code_entry has been modified in target memory behind
62781         gdb's back.
62782
62783         Additionally, the symfile address is the same address that is now used
62784         in the objfile names after commit 4a620b7e.
62785
62786         One test that relies on the output of 'maint info jit' was updated to
62787         allow for the new output format.
62788
62789 2022-02-11  Michael Forney  <mforney@mforney.org>
62790
62791         bfd: Remove return with expression in void function
62792               * bfd.c (bfd_set_gp_value): Remove return with expression
62793                 in void function.
62794
62795 2022-02-11  Tiezhu Yang  <yangtiezhu@loongson.cn>
62796
62797         gdb: LoongArch: Add Makefile, configure and NEWS
62798         This commit adds Makefile, configure and NEWS for LoongArch.
62799
62800         gdb: LoongArch: Add initial native Linux support
62801         This commit adds initial native Linux support for LoongArch.
62802
62803         gdb: LoongArch: Add initial Linux target support
62804         This commit adds initial Linux target support for LoongArch.
62805
62806         gdb: LoongArch: Add initial baremetal support
62807         This commit adds initial baremetal support for LoongArch.
62808
62809         gdb: LoongArch: Add initial target description support
62810         This commit adds initial target description support for LoongArch.
62811
62812 2022-02-11  Mike Frysinger  <vapier@gentoo.org>
62813
62814         libctf: delete unused libctf_TEXINFOS
62815         It's not clear what this was meant for, but it's not used by anything,
62816         and the info pages still generate fine without it.
62817
62818 2022-02-11  Simon Marchi  <simon.marchi@polymtl.ca>
62819
62820         gdb/linux: remove ptrace support check for exec, fork, vfork, vforkdone, clone, sysgood
62821         I think it's safe to remove checking support for these ptrace features,
62822         they have all been added in what is now ancient times (around the
62823         beginning of Linux 2.6).  This allows removing a bit of complexity in
62824         linux-nat.c and nat/linux-ptrace.c.
62825
62826         It also allows saving one extra fork every time we start debugging on
62827         Linux: linux_check_ptrace_features forks a child process to test if some
62828         ptrace features are supported.  That child process forks a grand-child,
62829         to test whether ptrace reports an event for the fork by the child.  This
62830         is no longer needed, if we assume the kernel supports reporting forks.
62831
62832         PTRACE_O_TRACEVFORKDONE was introduced in Linux in this change, in 2003:
62833
62834           https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=45c1a159b85b3b30afd26a77b4be312226bba416
62835
62836         PTRACE_O_TRACESYSGOOD was supported at least as of this change, in 2002:
62837
62838           https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=acc7088569c8eef04eeed0eff51d23bb5bcff964
62839
62840         PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK, PTRACE_O_TRACEEXEC and
62841         PTRACE_O_TRACECLONE were introduced in this change, in 2002:
62842
62843           https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=a0691b116f6a4473f0fa264210ab9b95771a2b46
62844
62845         Change-Id: Iffb906549a89cc6b619427f976ec044706ab1e8d
62846
62847 2022-02-11  GDB Administrator  <gdbadmin@sourceware.org>
62848
62849         Automatic date update in version.in
62850
62851 2022-02-10  Andrew Burgess  <aburgess@redhat.com>
62852
62853         gdb/infrun: some extra infrun debug print statements
62854         While reviewing a different patch I wanted to know more about what was
62855         going on during GDB's stepping.  I added some extra infrun debug print
62856         calls, and I thought these might be useful to others.
62857
62858 2022-02-10  GDB Administrator  <gdbadmin@sourceware.org>
62859
62860         Automatic date update in version.in
62861
62862 2022-02-09  Nick Clifton  <nickc@redhat.com>
62863
62864         Update the obsolete list and how-to-make-a-release documentation now that the 2.38 release is out.
62865
62866 2022-02-09  Alan Modra  <amodra@gmail.com>
62867
62868         PR28763, SIGSEGV during processing of program headers via readelf
62869                 PR 28763
62870                 * readelf.c (process_file_header): Discard any cached program
62871                 headers if there is an extension field for e_phnum in first
62872                 section header.
62873
62874 2022-02-09  Alan Modra  <amodra@gmail.com>
62875
62876         Work around gcc-4 warnings in elf64-ppc.c
62877         elf64-ppc.c: In function 'ppc64_elf_size_dynamic_sections':
62878         elf64-ppc.c:10309:45: error: value computed is not used [-Werror=unused-value]
62879              ++lgot_ents, ++lgot_masks, isym != NULL && isym++)
62880
62881         It is of course a silly warning, fixed in later versions of gcc.  I
62882         wrote "isym != NULL && isym++" rather than the simpler "isym++" to
62883         stop sanitisers complaining about incrementing a NULL pointer.  isym
62884         is of course unused in any code path where it might start off as
62885         NULL.  Sometimes you can't win.  So don't try to be clever in reading
62886         local symbols only when needed.  99 times out of 100 they will be
62887         cached anyway.
62888
62889                 * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Avoid annoying
62890                 warnings by always reading local syms.
62891                 (ppc64_elf_layout_multitoc): Likewise.
62892
62893 2022-02-09  Peilin Ye  <peilin.ye@bytedance.com>
62894
62895         Test --only-keep-debug on ELF relocatables
62896         Add a test for commit 7c4643efe7be, which fixed --only-keep-debug for ELF
62897         relocatables.
62898
62899                 * testsuite/binutils-all/objcopy.exp
62900                 (keep_debug_symbols_for_elf_relocatable): New test.
62901
62902 2022-02-09  GDB Administrator  <gdbadmin@sourceware.org>
62903
62904         Automatic date update in version.in
62905
62906 2022-02-08  Palmer Dabbelt  <palmer@rivosinc.com>
62907
62908         RISC-V: Stop reporting warnings for mismatched extension versions
62909         The extension version checking logic is really just too complicated to
62910         encode into the linker, trying to do so causes more harm than good.
62911         This removes the checks and the associated tests, leaving the logic to
62912         keep the largest version of each extension linked into the target.
62913
62914         bfd/
62915
62916                 * elfnn-riscv.c (riscv_version_mismatch): Rename to
62917                 riscv_update_subset_version, and stop reporting warnings on
62918                 version mismatches.
62919                 (riscv_merge_std_ext): Adjust calls to riscv_version_mismatch.
62920                 (riscv_merge_multi_letter_ext): Likewise.
62921
62922         ld/
62923                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Remove
62924                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise
62925                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise
62926                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: Likewise
62927                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s: Likewise
62928                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s: Likewise
62929                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s: Likewise
62930                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s: Likewise
62931                 * testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: New test.
62932                 * testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p0.s:
62933                 Likewise.
62934                 * testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p1.s:
62935                 Likewise.
62936                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Remove obselete
62937                 attr-merge-arch-failed-{01,02}, replace with
62938                 attr-merge-user-ext-01.
62939
62940 2022-02-08  Alan Modra  <amodra@gmail.com>
62941
62942         PR28862, heap-buffer-overflow in parse_stab_string
62943         I have no info on the format of a "SUNPRO C++ Namespace" stab, so am
62944         relying on the previous code being correct in parsing these stabs.
62945         Just don't allow NULs anywhere in the stab.
62946
62947                 PR 28862
62948                 * stabs.c (parse_stab_string): Don't overrun buffer when parsing
62949                 'Y' stab.
62950
62951 2022-02-08  Alan Modra  <amodra@gmail.com>
62952
62953         Re: elf: Check symbol version without any symbols
62954                 * testsuite/ld-elf/pr24718-1.d: Don't xfail for hppa64.
62955
62956 2022-02-08  Andrew Burgess  <aburgess@redhat.com>
62957
62958         gdb: remove tailing newlines from index_cache_debug calls
62959         I noticed that most of the calls to index_cache_debug include a
62960         trailing newline.  As the new debug mechanism already adds a newline,
62961         that means all of these debug calls result in a blank line being
62962         printed, which I think is a mistake.
62963
62964         Remove all the trailing newlines.
62965
62966         I also reformatted one of the index_cache_debug where a string will
62967         now fit onto a single line.
62968
62969         Unless 'set debug index-cache on' is used, there should be no visible
62970         change in output after this commit.
62971
62972 2022-02-08  H.J. Lu  <hjl.tools@gmail.com>
62973
62974         i386: Allow GOT32 relocations against ABS symbols
62975         GOT32 relocations are allowed since absolute value + addend is stored in
62976         the GOT slot.
62977
62978         Tested on glibc 2.35 build with GCC 11.2 and -Os.
62979
62980         bfd/
62981
62982                 PR ld/28870
62983                 * elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32
62984                 relocations.
62985
62986         ld/
62987
62988                 PR ld/28870
62989                 * testsuite/ld-i386/i386.exp: Run pr28870.
62990                 * testsuite/ld-i386/pr28870.d: New file.
62991                 * testsuite/ld-i386/pr28870.s: Likewise.
62992
62993 2022-02-08  GDB Administrator  <gdbadmin@sourceware.org>
62994
62995         Automatic date update in version.in
62996
62997 2022-02-07  Andrew Burgess  <aburgess@redhat.com>
62998
62999         gdb/python: allow Value.format_string to return styled output
63000         Add a new argument to the gdb.Value.format_string method, 'styling'.
63001         This argument is False by default.
63002
63003         When this argument is True, then the returned string can contain output
63004         styling escape sequences.
63005
63006         When this argument is False, then the returned string will not contain
63007         any styling escape sequences.
63008
63009         If the returned string is going to be printed to the user, then it is
63010         often nice to retain the GDB styling.
63011
63012         For the testing, we need to adjust the TERM environment variable, as
63013         we do for all the styling tests.  I'm now running all of the C tests
63014         in gdb.python/py-format-string.exp in an environment where styling
63015         could be generated, but only my new test should actually produce
63016         styled output, hopefully this will catch the case where a bug might
63017         cause format_string to always produce styled output.
63018
63019 2022-02-07  Lancelot SIX  <lancelot.six@amd.com>
63020
63021         gdb: make thread_info::m_thread_fsm a std::unique_ptr
63022         While working on function calls, I realized that the thread_fsm member
63023         of struct thread_info is a raw pointer to a resource it owns.  This
63024         commit changes the type of the thread_fsm member to a std::unique_ptr in
63025         order to signify this ownership relationship and slightly ease resource
63026         management (no need to manually call delete).
63027
63028         To ensure consistent use, the field is made a private member
63029         (m_thread_fsm).  The setter method (set_thread_fsm) can then check
63030         that it is incorrect to associate a FSM to a thread_info object if
63031         another one is already in place.  This is ensured by an assertion.
63032
63033         The function run_inferior_call takes an argument as a pointer to a
63034         call_thread_fsm and installs it in it in a thread_info instance.  Also
63035         change this function's signature to accept a unique_ptr in order to
63036         signify that the ownership of the call_thread_fsm is transferred during
63037         the call.
63038
63039         No user visible change expected after this commit.
63040
63041         Tested on x86_64-linux with no regression observed.
63042
63043         Change-Id: Ia1224f72a4afa247801ce6650ce82f90224a9ae8
63044
63045 2022-02-07  Andrew Burgess  <aburgess@redhat.com>
63046
63047         gdb: unbuffer all input streams when not using readline
63048         This commit should fix PR gdb/28711.  What's actually going on is
63049         pretty involved, and there's still a bit of the story that I don't
63050         understand completely, however, from my observed results, I think that
63051         the change I propose making here (or something very similar) is going
63052         to be needed.
63053
63054         The original bug report involves using eclipse to drive gdb using mi
63055         commands.  A separate tty is spun off in which to send gdb the mi
63056         commands, this tty is created using the new-ui command.
63057
63058         The behaviour observed is that, given a particular set of mi commands
63059         being sent to gdb, we sometimes see an ESPIPE error from a lseek
63060         call, which ultimately results in gdb terminating.
63061
63062         The problems all originate from gdb_readline_no_editing_callback in
63063         gdb/event-top.c, where we can (sometimes) perform calls to fgetc, and
63064         allow glibc to perform buffering on the FILE object being used.
63065
63066         I say sometime, because, gdb_readline_no_editing_callback already
63067         includes a call to disable the glibc buffering, but this is only done
63068         if the input stream is not a tty.  In our case the input stream is a
63069         tty, so the buffering is left in place.
63070
63071         The first step to understanding why this problem occurs is to
63072         understand that eclipse sends multiple commands to gdb very quickly
63073         without waiting for and answer to each command, eclipse plans to
63074         collect all of the command results after sending all the commands to
63075         gdb.  In fact, eclipse sends the commands to gdb that they appear to
63076         arrive in the gdb process as a single block of data.  When reproducing
63077         this issue within the testsuite I find it necessary to send multiple
63078         commands using a single write call.
63079
63080         The next bit of the story gets a little involved, and this is where my
63081         understanding is not complete.  I can describe the behaviour that I
63082         observe, and (for me at least) I'm happy that what I'm seeing, if a
63083         little strange, is consistent.  In order to fully understand what's
63084         going on I think I would likely need to dive into kernel code, which
63085         currently seems unnecessary given that I'm happy with the solution I'm
63086         proposing.
63087
63088         The following description all relates to input from a tty in which I'm
63089         not using readline.  I see the same problems either when using a
63090         new-ui tty, or with gdb's standard, non-readline, mi tty.
63091
63092         Here's what I observe happening when I send multiple commands to gdb
63093         using a single write, if I send gdb this:
63094
63095           command_1\ncommand_2\ncommand_3
63096
63097         then gdb's event loop will wake up (from its select) as it sees there
63098         is input available.  We call into gdb_readline_no_editing_callback,
63099         where we call fgetc, glibc will do a single big read, and get back
63100         just:
63101
63102           command_1\n
63103
63104         that is, despite there being multiple lines of input available, I
63105         consistently get just a single line.  From glibc a single character is
63106         returned from the fgetc call, and within gdb we accumulate characters,
63107         one at a time, into our own buffer.  Eventually gdb sees the '\n'
63108         character, and dispatches the whole 'command_1' into gdb's command
63109         handler, which processes the command and prints the result.  We then
63110         return to gdb_readline_no_editing_callback, which in turn returns to
63111         gdb's event loop where we re-enter the select.
63112
63113         Inside the select we immediately see that there is more input waiting
63114         on the input stream, drop out of the select, and call back into
63115         gdb_readline_no_editing_callback.  In this function we again call
63116         fgetc where glibc performs another big read.  This time glibc gets:
63117
63118           command_2\n
63119
63120         that is, we once again get just a single line, despite there being a
63121         third line available.  Just like the first command we copy the whole
63122         string, character by character into gdb's buffer, then handle the
63123         command.  After handling the command we go to the event loop, enter,
63124         and then exit the select, and call back to the function
63125         gdb_readline_no_editing_callback.
63126
63127         In gdb_readline_no_editing_callback we again call fgetc, this time
63128         glibc gets the string:
63129
63130           command_3\n
63131
63132         like before, we copy this to gdb's buffer and handle the command, then
63133         we return to the event loop.  At this point the select blocks while we
63134         wait for more input to arrive.
63135
63136         The important bit of this is that someone, somewhere is, it appears,
63137         taking care to split the incoming write into lines.
63138
63139         My next experiment is to try something like:
63140
63141           this_is_a_very_long_command\nshort_command\n
63142
63143         However, I actually make 'this_is_a_very_long_command' very long, as
63144         in many hundreds of characters long.  One way to do this is:
63145
63146           echo xxxxxx.....xxxxx
63147
63148         and just adding more and more 'x' characters as needed.  What I'm
63149         aiming for is to have the first command be longer than glibc's
63150         internal read buffer, which, on my machine, is 1024 characters.
63151
63152         However, for this discussion, lets imagine that glibc's buffer is just
63153         8 characters (we can create just this situation by adding a suitable
63154         setbuf call into gdb_readline_no_editing_callback).
63155
63156         Now, if I send gdb this data:
63157
63158           abcdefghij\nkl\n
63159
63160         The first read from glibc will get 'abcdefgh', that is a full 8
63161         character buffer.  Once gdb has copied these to its buffer we call
63162         fgetc again, and now glibc will get 'ij\n', that is, just like before,
63163         multiple lines are split at the '\n' character.  The full command,
63164         which is now in gdb's buffer can be handled 'abcdefghij', after which
63165         we go (via the event loop) back to gdb_readline_no_editing_callback.
63166         Now we call fgetc, and glibc will get 'kl\n', which is then handled in
63167         the normal way.
63168
63169         So far, so good.  However, there is, apparently, one edge case where
63170         the above rules don't apply.
63171
63172         If the '\n' character is the first character read from the kernel,
63173         then the incoming lines are not split up.  So, given glibc's 8
63174         character buffer, if I send gdb this:
63175
63176           abcdefgh\nkl\n
63177
63178         that is the first command is 8 characters plus a newline, then, on the
63179         first read (from within glibc) we get 'abcdefgh' in a single buffer.
63180         As there's no newline gdb calls fgetc again, and glibc does another
63181         large read, now we get:
63182
63183           \nkl\n
63184
63185         which doesn't follow the above pattern - the lines are not split into
63186         separate buffers!
63187
63188         So, gdb reads the first character from glibc using fgetc, this is the
63189         newline.  Now gdb has a complete command, and so the command is
63190         handled.  We then return to the event loop and enter the select.
63191
63192         The problem is that, as far as the kernel is concerned, there is no
63193         more input pending, it's all been read into glibc's buffer, and so the
63194         select doesn't return.  The second command is basically stuck in
63195         glibc's buffer.
63196
63197         If I send another command to gdb, or even just send an empty
63198         command (a lone newline) then the select returns, we call into
63199         gdb_readline_no_editing_callback, and now gdb sees the second
63200         command.
63201
63202         OK, so the above is interesting, but it doesn't explain the ESPIPE
63203         error.
63204
63205         Well, that's a slightly different, but related issue.  The ESPIPE
63206         case will _only_ show up when using new-ui to create the separate tty
63207         for mi commands, and is a consequence of this commit:
63208
63209           commit afe09f0b6311a4dd1a7e2dc6491550bb228734f8
63210           Date:   Thu Jul 18 17:20:04 2019 +0100
63211
63212               Fix for using named pipes on Windows
63213
63214         Prior to this commit, the new-ui command would open the tty three
63215         times, once each for stdin, stderr, and stdout.  After this commit we
63216         open the tty just once and reuse the FILE object for all three roles.
63217
63218         Consider the problem case, where glibc has (unexpectedly) read the
63219         second command into its internal buffer.  When we handle the first
63220         command we usually end up having to write something to the mi output
63221         stream.
63222
63223         After the above commit the same FILE object represents both the input
63224         and output streams, so, when gdb tries to write to the FILE object,
63225         glibc spots that there is input pending within the input buffer, and
63226         so assumes that we have read ahead of where we should be in the input
63227         file.  To correct for this glibc tries to do an lseek call to
63228         reposition the file offset of the output stream prior to writing to
63229         it.  However, as the output stream is a tty, and seeking is not
63230         supported on a tty, this lseek call fails, this results in the ESPIPE,
63231         which ultimately causes gdb to terminate.
63232
63233         So, now we understand why the ESPIPE triggers (which was what caused
63234         the gdb crash in the original bug report), and we also understand that
63235         sometime gdb will not handle the second command in a timely
63236         fashion (if the first command is just the wrong length). So, what to
63237         do about all this?
63238
63239         We could revert the commit mentioned above (and implement its
63240         functionality another way).  This would certainly resolve the ESPIPE
63241         issue, the buffered input would now only be on the input stream, the
63242         output stream would have no buffered input, and so glibc would never
63243         try to lseek, and so we'd never get the ESPIPE error.
63244
63245         However, this only solves one of the two problems.  We would still
63246         suffer from the problem where, if the first command is just the wrong
63247         length, the second command will not (immediately) get handled.
63248
63249         The only solution I can see to this problem is to unbuffer the input
63250         stream.  If glibc is not buffering the input, but instead, we read
63251         incoming data character by character from the kernel, then everything
63252         will be fine.  As soon as we see the newline at the end of the first
63253         command we will handle the first command.  As glibc will have no
63254         buffered input it will not be tempted to lseek, so no ESPIPE error.
63255         When we go have to the event loop there will be more data pending in
63256         the kernel, so the select will immediately return, and the second
63257         command will be processed.
63258
63259         I'm tempted to suggest that we should move the unbuffering of the
63260         input stream out of gdb_readline_no_editing_callback and do it
63261         somewhere earlier, more like when we create the input streams.
63262         However, I've not done that in this commit for a couple of reasons:
63263
63264           1. By keeping the unbuffering in gdb_readline_no_editing_callback
63265           I'm making the smallest possible change that fixes the bug.  Moving
63266           the unbuffering somewhere better can be done as a refactor later, if
63267           that 's felt to be important,
63268
63269           2. I don't think making repeated calls to unbuffer the input will
63270           have that much performance impact.  We only make the unbuffer call
63271           once per call to gdb_readline_no_editing_callback, and, if the input
63272           stream is already unbuffered we'll return pretty quickly, so I don't
63273           see this as being massively costly,
63274
63275           3. Tom is currently doing lots of gdb stream management changes and
63276           I want to minimise the chances we'll conflict.
63277
63278         So, this commit just changes gdb_readline_no_editing_callback to
63279         always unbuffer the input stream.
63280
63281         The test for this issue sends two commands in a loop, with the first
63282         command growing bigger each time around the loop.  I actually make the
63283         first command bigger by just adding whitespace to the front, as gdb
63284         still has to read the complete command (including whitespace) via
63285         glibc, so this is enough to trigger the bug.
63286
63287         The original bug was reported when using a virtual machine, and in
63288         this situation we see this in the strace output:
63289
63290           read(9, "70-var-info-path-expression var1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1024) = 64
63291           read(9, "\n71-var-info-path-expression var1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", 1024) = 67
63292
63293         I'm not completely sure what's going on here, but it appears that the
63294         kernel on the virtual machine is delivering the input to glibc slower
63295         than I see on my real hardware; glibc asks for 1024 bytes, but only
63296         gets 64 bytes the first time.  In the second read we see the problem
63297         case, the first character is the newline, but then the entire second
63298         command is included.
63299
63300         If I run this exact example on my real hardware then the first command
63301         would not be truncated at 64 bytes, instead, I'd expect to see the
63302         newline included in the first read, with the second command split into
63303         a second read.
63304
63305         So, for testing, I check cases where the first command is just a few
63306         characters (starting at 8 character), all the way up to 2048
63307         characters.  Hopefully, this should mean we hit the problem case for
63308         most machine setups.
63309
63310         The only last question relates to commit afe09f0b6311a4d that I
63311         mentioned earlier.  That commit was intended to provide support for
63312         Microsoft named pipes:
63313
63314           https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipes
63315
63316         I know next to nothing about this topic beyond a brief scan of the
63317         above link, but I think these windows named pipe are closer in
63318         behaviour to unix sockets than to unix named fifos.
63319
63320         I am a little nervous that, after the above commit, we now use the
63321         same FILE for in, err, and out streams.  In contrast, in a vanilla C
63322         program, I would expect different FILE objects for each stream.
63323
63324         Still, I'm reluctant to revert the above commit (and provide the same
63325         functionality a different way) without a specific bug to point at,
63326         and, now that the streams are unbuffered, I expect a lot of the read
63327         and write calls are going straight to the kernel with minimal glibc
63328         involvement, so maybe it doesn't really matter.  Anyway, I haven't
63329         touched the above patch, but it is something to keep in mind when
63330         working in this area.
63331
63332         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28711
63333
63334 2022-02-07  Andrew Burgess  <aburgess@redhat.com>
63335
63336         gdb/disasm: combine the no printing disassembler setup code
63337         We have three places in gdb where we initialise a disassembler that
63338         will not print anything (used for figuring out the length of
63339         instructions, or collecting other information from the disassembler).
63340
63341         Each of these places has its own stub function to act as a print like
63342         callback, the stub function is identical in each case, and just does
63343         nothing.
63344
63345         In this commit I create a new function to initialise a disassembler
63346         that doesn't print anything, and have all three locations use this new
63347         function.  There's now only one non-printing stub function.
63348
63349         There should be no user visible changes after this commit.
63350
63351 2022-02-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
63352
63353         gdb: add the 'set/show suppress-cli-notifications' command
63354         GDB already has a flag to suppress printing notification events, such
63355         as thread and inferior context switches, on the CLI.  This is used
63356         internally when executing commands.  Make the flag available to the
63357         user via a new command.  This is expected to be useful in scripts.
63358
63359         For instance, suppose that when Inferior 1 gets to a certain state,
63360         you want to add and set up a new inferior using the commands below,
63361         but you also want to have a reduced/clean output.
63362
63363           define do-setup
63364             printf "Setting up Inferior 2...\n"
63365             add-inferior -exec a.out
63366             inferior 2
63367             break file.c:3
63368             run
63369             inferior 1
63370             printf "Done\n"
63371           end
63372
63373         Currently, GDB prints
63374
63375           (gdb) do-setup
63376           Setting up Inferior 2...
63377           [New inferior 2]
63378           Added inferior 2 on connection 1 (native)
63379           [Switching to inferior 2 [<null>] (/tmp/a.out)]
63380           Breakpoint 2 at 0x1155: file file.c, line 3.
63381
63382           Thread 2.1 "a.out" hit Breakpoint 2, main () at file.c:3
63383           3         return 0;
63384           [Switching to inferior 1 [process 7670] (/tmp/test)]
63385           [Switching to thread 1.1 (process 7670)]
63386           #0  main () at test.c:2
63387           2         int a = 1;
63388           Done
63389
63390         GDB's Python API make it possible to capture and return GDB's output,
63391         but this does not work for all the streams.  In particular, CLI
63392         notification events are not captured:
63393
63394           (gdb) python gdb.execute("do-setup", False, True)
63395           [Switching to inferior 2 [<null>] (/tmp/a.out)]
63396
63397           Thread 2.1 "a.out" hit Breakpoint 2, main () at file.c:3
63398           3         return 0;
63399           [Switching to inferior 1 [process 8263] (/tmp/test)]
63400           [Switching to thread 1.1 (process 8263)]
63401           #0  main () at test.c:2
63402           2         int a = 1;
63403
63404         You can use the new "set suppress-cli-notifications" command to
63405         suppress the output:
63406
63407           (gdb) set suppress-cli-notifications on
63408           (gdb) do-setup
63409           Setting up Inferior 2...
63410           [New inferior 2]
63411           Added inferior 2 on connection 1 (native)
63412           Breakpoint 2 at 0x1155: file file.c, line 3.
63413           Done
63414
63415 2022-02-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
63416
63417         gdb/cli: add a 'normal_stop' option to 'cli_suppress_notification'
63418         Extend the 'cli_suppress_notification' struct with a new field,
63419         'normal_stop', that can be used for checking if printing normal stop
63420         events on the CLI should be suppressed.
63421
63422         This patch only introduces the flag.  The subsequent patch adds a user
63423         command to turn the flag off/on.
63424
63425 2022-02-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
63426
63427         gdb/cli: convert cli_suppress_notification from int to bool
63428         Convert the suppress_notification flag for the CLI from int to bool.
63429
63430 2022-02-07  Alan Modra  <amodra@gmail.com>
63431
63432         Revert "elf: Remove the 1-page gap before the RELRO segment"
63433         This reverts commit 2f83249c13d86065b4c7cdb198ea871017b4bba1.
63434
63435                 PR ld/28743
63436                 * ldlang.c (lang_size_relro_segment_1): Revert 2022-01-10 changes.
63437                 * testsuite/ld-i386/pr20830.d: Likewise.
63438                 * testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
63439                 * testsuite/ld-x86-64/pr14207.d: Likewise.
63440                 * testsuite/ld-x86-64/pr18176.d: Likewise.
63441                 * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
63442                 * testsuite/ld-x86-64/pr20830a.d: Likewise.
63443                 * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
63444                 * testsuite/ld-x86-64/pr20830b.d: Likewise.
63445                 * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
63446                 * testsuite/ld-x86-64/pr21038a.d: Likewise.
63447                 * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
63448                 * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
63449                 * testsuite/ld-x86-64/pr21038c.d: Likewise.
63450
63451 2022-02-07  Alan Modra  <amodra@gmail.com>
63452
63453         Revert "ld: Rewrite lang_size_relro_segment_1"
63454         This reverts commit c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3.
63455
63456                 PR ld/28743
63457                 PR ld/28819
63458                 * ldlang.c (lang_size_relro_segment_1): Revert 2022-01-14 change.
63459                 * testsuite/ld-x86-64/pr28743-1.d: Likewise.
63460                 * testsuite/ld-x86-64/pr28743-1.s: Likewise.
63461                 * testsuite/ld-x86-64/x86-64.exp: Likewise.
63462
63463 2022-02-07  GDB Administrator  <gdbadmin@sourceware.org>
63464
63465         Automatic date update in version.in
63466
63467 2022-02-06  Alan Modra  <amodra@gmail.com>
63468
63469         A more elegant pr28827-1 testcase
63470         Use .irpc macros in pr28827-1.s
63471
63472                 * testsuite/ld-powerpc/pr28827-1.s: Make the testcase more
63473                 elegant.  Comment.
63474
63475 2022-02-06  Tom Tromey  <tom@tromey.com>
63476
63477         Merge do_val_print and common_val_print
63478         The only caller of do_val_print just does a small bit of work before
63479         the call.  This patch merges the two functions, and removes an
63480         unnecessary local variable, making gdb a bit simpler.
63481
63482 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63483
63484         gdb: remove SYMBOL_LINE macro
63485         Add a getter and a setter for a symbol's line.  Remove the corresponding macro
63486         and adjust all callers.
63487
63488         Change-Id: I229f2b8fcf938c07975f641361313a8761fad9a5
63489
63490 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63491
63492         gdb: remove SYMBOL_TYPE macro
63493         Add a getter and a setter for a symbol's type.  Remove the corresponding
63494         macro and adjust all callers.
63495
63496         Change-Id: Ie1a137744c5bfe1df4d4f9ae5541c5299577c8de
63497
63498 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63499
63500         gdb: remote SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION macro
63501         Add a getter for a whether a symbol is a C++ template function.  Remove
63502         the corresponding macro and adjust all callers.
63503
63504         Change-Id: I89abc2802a952b77b0e0eb73a25c2306cb8e8bcc
63505
63506 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63507
63508         gdb: remove SYMBOL_INLINED macro
63509         Add a getter and a setter for whether a symbol is inlined.  Remove the
63510         corresponding macro and adjust all callers.
63511
63512         Change-Id: I934468da3b5a32dd6b161a6f252a6b1b94737279
63513
63514 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63515
63516         gdb: remove SYMBOL_IS_ARGUMENT macro
63517         Add a getter and a setter for whether a symbol is an argument.  Remove
63518         the corresponding macro and adjust all callers.
63519
63520         Change-Id: I71b4f0465f3dfd2ed8b9e140bd3f7d5eb8d9ee81
63521
63522 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63523
63524         gdb: remove SYMBOL_OBJFILE_OWNED macro
63525         Add a getter and a setter for whether a symbol is objfile owned.  Remove
63526         the corresponding macro and adjust all callers.
63527
63528         Change-Id: Ib7ef3718d65553ae924ca04c3fd478b0f4f3147c
63529
63530 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63531
63532         gdb: remove SYMBOL_DOMAIN macro
63533         Add a getter and a setter for a symbol's domain.  Remove the
63534         corresponding macro and adjust all callers.
63535
63536         Change-Id: I54465b50ac89739c663859a726aef8cdc6e4b8f3
63537
63538 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63539
63540         gdb: remove SYMBOL_CLASS macro, add getter
63541         Change-Id: I83211d5a47efc0564386e5b5ea4a29c00b1fd46a
63542
63543 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63544
63545         gdb: remove SYMBOL_IMPL macro, add method
63546         Add a getter for a symbol's "impl".  Remove the corresponding macro and
63547         adjust all callers.
63548
63549         Change-Id: Ibe26ed442f0f99a0f5cddafca30bd96ec7fb9fa8
63550
63551 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63552
63553         gdb: remove SYMBOL_ACLASS_INDEX macro, add getter/setter
63554         Add a getter and a setter for a symbol's aclass index.  Remove the
63555         corresponding macro and adjust all callers.
63556
63557         Change-Id: Ie8c8d732624cfadb714aba5ddafa3d29409b3d39
63558
63559 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63560
63561         gdb: remove SYMBOL_MATCHES_SEARCH_NAME
63562         It seems like this macro is not needed at all anymore, it just wraps the
63563         function of the same name with the same arguments.
63564
63565         Change-Id: I3c342ac8d89c27af5aee1a819dc32cc6396fd41b
63566
63567 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63568
63569         gdb: remove SYMTAB_DIRNAME macro
63570         Remove the macro, replace with an equivalent method.
63571
63572         Change-Id: I46ec36b91bb734331138eb9cd086b2db01635aed
63573
63574 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63575
63576         gdb: remove SYMTAB_PSPACE macro
63577         Remove the macro, replace with an equivalent method.
63578
63579         Change-Id: Icccc20e7e8ae03ac4dac1c7514c25a12a9a0ac69
63580
63581 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63582
63583         gdb: remove SYMTAB_OBJFILE macro
63584         Remove the macro, replace with an equivalent method.
63585
63586         Change-Id: I8f9ecd290ad28502e53c1ceca5006ba78bf042eb
63587
63588 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63589
63590         gdb: remove SYMTAB_BLOCKVECTOR macro
63591         Remove the macro, replace with an equivalent method.
63592
63593         Change-Id: Id6fe2a79c04bcd6c69ccaefb7a69bc06a476288c
63594
63595 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63596
63597         gdb: remove SYMTAB_LANGUAGE macro, add getter/setter
63598         Add a getter and a setter for a symtab's language.  Remove the
63599         corresponding macro and adjust all callers.
63600
63601         Change-Id: I9f4d840b11c19f80f39bac1bce020fdd1739e11f
63602
63603 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63604
63605         gdb: remove SYMTAB_LINETABLE macro, add getter/setter
63606         Add a getter and a setter for a symtab's linetable.  Remove the
63607         corresponding macro and adjust all callers.
63608
63609         Change-Id: I159183fc0ccd8e18ab937b3c2f09ef2244ec6e9c
63610
63611 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63612
63613         gdb: remove SYMTAB_COMPUNIT macro, add getter/setter
63614         Add a getter and a setter for a symtab's compunit_symtab.  Remove the
63615         corresponding macro and adjust all callers.
63616
63617         For brevity, I chose the name "compunit" instead of "compunit_symtab"
63618         the the field, getter and setter names.  Since we are already in symtab
63619         context, the _symtab suffix seems redundant.
63620
63621         Change-Id: I4b9b731c96e3594f7733e75af1e3d01bc0e4fe92
63622
63623 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63624
63625         gdb: remove COMPUNIT_MACRO_TABLE macro, add getter/setter
63626         Add a getter and a setter for a compunit_symtab's macro table.  Remove the
63627         corresponding macro and adjust all callers.
63628
63629         Change-Id: I00615ea72d5ac43d9a865e941cb2de0a979c173a
63630
63631 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63632
63633         gdb: remove COMPUNIT_EPILOGUE_UNWIND_VALID macro, add getter/setter
63634         Add a getter and a setter for a compunit_symtab's epilogue unwind valid flag.
63635         Remove the corresponding macro and adjust all callers.
63636
63637         Change-Id: If3b68629d987767da9be7041a95d96dc34367a9a
63638
63639 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63640
63641         gdb: remove COMPUNIT_LOCATIONS_VALID macro, add getter/setter
63642         Add a getter and a setter for a compunit_symtab's locations valid flag.
63643         Remove the corresponding macro and adjust all callers.
63644
63645         Change-Id: I3e3cfba926ce62993d5b61814331bb3244afad01
63646
63647 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63648
63649         gdb: remove COMPUNIT_BLOCK_LINE_SECTION macro, add getter/setter
63650         Add a getter and a setter for a compunit_symtab's block line section.  Remove
63651         the corresponding macro and adjust all callers.
63652
63653         Change-Id: I3eb1a323388ad55eae8bfa45f5bc4a08dc3df455
63654
63655 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63656
63657         gdb: remove COMPUNIT_BLOCKVECTOR macro, add getter/setter
63658         Add a getter and a setter for a compunit_symtab's blockvector.  Remove
63659         the corresponding macro and adjust all callers.
63660
63661         Change-Id: I99484c6619dcbbea7c5d89c72aa660316ca62f64
63662
63663 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63664
63665         gdb: remove COMPUNIT_DIRNAME macro, add getter/setter
63666         Add a getter and a setter for a compunit_symtab's dirname.  Remove the
63667         corresponding macro and adjust all callers.
63668
63669         Change-Id: If2f39b295fd26822586485e04a8b8b5aa5cc9b2e
63670
63671 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63672
63673         gdb: remove COMPUNIT_PRODUCER macro, add getter/setter
63674         Add a getter and a setter for a compunit_symtab's producer.  Remove the
63675         corresponding macro and adjust all callers.
63676
63677         Change-Id: Ia1d6d8a0e247a08a21af23819d71e49b37d8931b
63678
63679 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63680
63681         gdb: remove COMPUNIT_DEBUGFORMAT macro, add getter/setter
63682         Add a getter and a setter for a compunit_symtab's debugformat.  Remove
63683         the corresponding macro and adjust all callers.
63684
63685         Change-Id: I1667b02d5322346f8e23abd9f8a584afbcd75975
63686
63687 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63688
63689         gdb: remove COMPUNIT_FILETABS macro
63690         I think that most remaining uses of COMPUNIT_FILETABS intend to get the
63691         primary filetab of the compunit_symtab specifically (and not to iterate
63692         over all filetabs, for example, those cases would use compunit_filetabs,
63693         which has been converted to compunit_symtab::filetabs), so replace mosts
63694         uses with compunit_symtab::primary_filetab.
63695
63696         In jit.c, function finalize_symtab, we can save the symtab object
63697         returned by allocate_symtab and use it, it makes things simpler.
63698
63699         Change-Id: I4e51d6d4b40759de8768b61292e5e13c8eae2e38
63700
63701 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63702
63703         gdb: move compunit_filetabs to compunit_symtab::filetabs
63704         Make compunit_filetabs, used to iterate a compunit_symtab's filetabs, a
63705         method of compunit_symtab.  The name filetabs conflicts with the current
63706         name of the field.  Rename the field to m_filetabs, since at this point
63707         nothing outside of compunit_symtab uses it, so we should treat it as
63708         private (even though it's not actually private).  Rename the
63709         last_filetab field to m_last_filetab as well (it's only used on
63710         compunit_symtab::add_filetab).
63711
63712         Adjust the COMPUNIT_FILETABS macro to keep its current behavior of
63713         returning the first filetab.
63714
63715         Change-Id: I537b553a44451c52d24b18ee1bfa47e23747cfc3
63716
63717 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63718
63719         gdb: add compunit_symtab::set_primary_filetab method
63720         Add a method to set the primary filetab of the CU.  This is currently
63721         done in buildsym_compunit::end_symtab_with_blockvector.
63722
63723         Change-Id: I16c51a6b90a4cb4c0c5f183b0f2e12bc64b6fd74
63724
63725 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63726
63727         gdb: add compunit_symtab::add_filetab method
63728         Add a method to append a filetab/symtab to a compunit_symtab.  There is
63729         a single place where this is done currently, in allocate_symtab.
63730
63731         Change-Id: Ie86c6e34d175728173d1cffdce44acd6cff6c31d
63732
63733 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63734
63735         gdb: rename compunit_primary_filetab to compunit_symtab::primary_filetab
63736         Make compunit_primary_filetab a method of compunit_symtab.
63737
63738         Change-Id: Iee3c4f7e36d579bf763c5bba146e5e10d6766768
63739
63740 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63741
63742         gdb: remove COMPUNIT_OBJFILE macro
63743         Remove the macro, update all users to use the getter directly.
63744
63745         Change-Id: I3f0fd6f4455d1c4ebd5da73b561eb18a979ef1f6
63746
63747 2022-02-06  Simon Marchi  <simon.marchi@efficios.com>
63748
63749         gdb: add getter/setter for compunit_symtab::objfile
63750         Rename the field to m_objfile, and add a getter and a setter.  Update
63751         all users.
63752
63753         Change-Id: If7e2f763ee3e70570140d9af9261b1b056253317
63754
63755 2022-02-06  Tom Tromey  <tom@tromey.com>
63756
63757         Allow non-ASCII characters in Rust identifiers
63758         Rust 1.53 (quite a while ago now) ungated the support for non-ASCII
63759         identifiers.  This didn't work in gdb.  This is PR rust/20166.
63760
63761         This patch fixes the problem by allowing non-ASCII characters to be
63762         considered as identifier components.  It seemed simplest to just pass
63763         them through -- doing any extra checking didn't seem worthwhile.
63764
63765         The new test also verifies that such characters are allowed in strings
63766         and character literals as well.  The latter also required a bit of
63767         work in the lexer.
63768
63769         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20166
63770
63771 2022-02-06  Tom Tromey  <tom@tromey.com>
63772
63773         Fix Rust parser bug with function fields
63774         In Rust, 'obj.f()' is a method call -- but '(obj.f)()' is a call of a
63775         function-valued field 'f' in 'obj'.  The Rust parser in gdb currently
63776         gets this wrong.  This is PR rust/24082.
63777
63778         The expression and Rust parser rewrites made this simple to fix --
63779         simply wrapping a parenthesized expression in a new operation handles
63780         it.  This patch has a slight hack because I didn't want to introduce a
63781         new exp_opcode enumeration constant just for this.  IMO this doesn't
63782         matter, since we should work toward removing dependencies on these
63783         opcodes anyway; but let me know what you think of this.
63784
63785         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24082
63786
63787 2022-02-06  H.J. Lu  <hjl.tools@gmail.com>
63788
63789         ld: Add emultempl/emulation.em
63790         Add emultempl/emulation.em to define ld_${EMULATION_NAME}_emulation so
63791         that new emulation hooks can be added easily.
63792
63793                 * emultempl/aix.em (LDEMUL_AFTER_OPEN): New.
63794                 (LDEMUL_SET_OUTPUT_ARCH): Likewise.
63795                 (LDEMUL_CHOOSE_TARGET): Likewise.
63796                 (LDEMUL_BEFORE_ALLOCATION): Likewise.
63797                 (LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Likewise.
63798                 (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
63799                 (LDEMUL_PARSE_ARGS): Likewise.
63800                 (LDEMUL_ADD_OPTIONS): Likewise.
63801                 (LDEMUL_HANDLE_OPTION): Likewise.
63802                 (LDEMUL_UNRECOGNIZED_FILE): Likewise.
63803                 (LDEMUL_PRINT_SYMBOL): Likewise.
63804                 (ld_${EMULATION_NAME}_emulation): Removed.
63805                 Source ${srcdir}/emultempl/emulation.em.
63806                 * emultempl/beos.em (gld_${EMULATION_NAME}_before_parse):
63807                 Renamed to ...
63808                 (gld${EMULATION_NAME}_before_parse): This.
63809                 (gld_${EMULATION_NAME}_set_symbols): Renamed to ...
63810                 (gld${EMULATION_NAME}_set_symbols): This.
63811                 (gld_${EMULATION_NAME}_after_open): Renamed to ...
63812                 (gld${EMULATION_NAME}_after_open): This.
63813                 (gld_${EMULATION_NAME}_before_allocation): Renamed to ...
63814                 (gld${EMULATION_NAME}_before_allocation): This.
63815                 (gld_${EMULATION_NAME}_get_script): Renamed to ...
63816                 (gld${EMULATION_NAME}_get_script): This.
63817                 (LDEMUL_AFTER_OPEN): New.
63818                 (LDEMUL_BEFORE_ALLOCATION): Likewise.
63819                 (LDEMUL_PLACE_ORPHAN): Likewise.
63820                 (LDEMUL_SET_SYMBOLS): Likewise.
63821                 (LDEMUL_ADD_OPTIONS): Likewise.
63822                 (LDEMUL_HANDLE_OPTION): Likewise.
63823                 (ld_${EMULATION_NAME}_emulation): Removed.
63824                 Source ${srcdir}/emultempl/emulation.em.
63825                 * emultempl/elf.em (LDEMUL_AFTER_PARSE): New.
63826                 (LDEMUL_AFTER_OPEN): Likewise.
63827                 (LDEMUL_BEFORE_PLACE_ORPHANS): Likewise.
63828                 (LDEMUL_AFTER_ALLOCATION): Likewise.
63829                 (LDEMUL_SET_OUTPUT_ARCH): Likewise.
63830                 (LDEMUL_BEFORE_ALLOCATION): Likewise.
63831                 (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
63832                 (LDEMUL_PLACE_ORPHAN): Likewise.
63833                 (LDEMUL_ADD_OPTIONS): Likewise.
63834                 (LDEMUL_HANDLE_OPTION): Likewise.
63835                 (LDEMUL_LIST_OPTIONS): Likewise.
63836                 (LDEMUL_UNRECOGNIZED_FILE): Likewise.
63837                 (ld_${EMULATION_NAME}_emulation): Removed.
63838                 Source ${srcdir}/emultempl/emulation.em.
63839                 * emultempl/emulation.em: New file.
63840                 * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Removed.
63841                 Source ${srcdir}/emultempl/emulation.em.
63842                 * emultempl/msp430.em (LDEMUL_AFTER_OPEN): New.
63843                 (LDEMUL_AFTER_ALLOCATION): Likewise.
63844                 (LDEMUL_PLACE_ORPHAN): Likewise.
63845                 (LDEMUL_FINISH): Likewise.
63846                 (LDEMUL_ADD_OPTIONS): Likewise.
63847                 (LDEMUL_HANDLE_OPTION): Likewise.
63848                 (LDEMUL_LIST_OPTIONS): Likewise.
63849                 (ld_${EMULATION_NAME}_emulation): Removed.
63850                 Source ${srcdir}/emultempl/emulation.em.
63851                 * emultempl/pe.em (gld_${EMULATION_NAME}_before_parse): Renamed
63852                 to ...
63853                 (gld${EMULATION_NAME}_before_parse): This.
63854                 (gld_${EMULATION_NAME}_list_options): Renamed to ...
63855                 (gld${EMULATION_NAME}_list_options): This.
63856                 (gld_${EMULATION_NAME}_set_symbols): Renamed to ...
63857                 (gld${EMULATION_NAME}_set_symbols): This.
63858                 (gld_${EMULATION_NAME}_after_parse): Renamed to ...
63859                 (gld${EMULATION_NAME}_after_parse): This.
63860                 (gld_${EMULATION_NAME}_after_open): Renamed to ...
63861                 (gld${EMULATION_NAME}_after_open): This.
63862                 (gld_${EMULATION_NAME}_before_allocation): Renamed to ...
63863                 (gld${EMULATION_NAME}_before_allocation): This.
63864                 (gld_${EMULATION_NAME}_unrecognized_file): Renamed to ...
63865                 (gld${EMULATION_NAME}_unrecognized_file): This.
63866                 (gld_${EMULATION_NAME}_recognized_file): Renamed to ...
63867                 (gld${EMULATION_NAME}_recognized_file): This.
63868                 (gld_${EMULATION_NAME}_finish): Renamed to ...
63869                 (gld${EMULATION_NAME}_finish): This.
63870                 (gld_${EMULATION_NAME}_place_orphan): Renamed to ...
63871                 (gld${EMULATION_NAME}_place_orphan): This.
63872                 (gld_${EMULATION_NAME}_open_dynamic_archive): Renamed to ...
63873                 (gld${EMULATION_NAME}_open_dynamic_archive): This.
63874                 (gld_${EMULATION_NAME}_find_potential_libraries): Renamed to ...
63875                 (gld${EMULATION_NAME}_find_potential_libraries): This.
63876                 (gld_${EMULATION_NAME}_get_script): Renamed to ...
63877                 (gld${EMULATION_NAME}_get_script): This.
63878                 (LDEMUL_AFTER_PARSE): New.
63879                 (LDEMUL_AFTER_OPEN): Likewise.
63880                 (LDEMUL_BEFORE_ALLOCATION): Likewise.
63881                 (LDEMUL_FINISH=): Likewise.
63882                 (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
63883                 (LDEMUL_PLACE_ORPHAN): Likewise.
63884                 (LDEMUL_SET_SYMBOLS): Likewise.
63885                 (LDEMUL_ADD_OPTIONS): Likewise.
63886                 (LDEMUL_HANDLE_OPTION): Likewise.
63887                 (LDEMUL_UNRECOGNIZED_FILE): Likewise.
63888                 (LDEMUL_LIST_OPTIONS): Likewise.
63889                 (LDEMUL_RECOGNIZED_FILE): Likewise.
63890                 (LDEMUL_FIND_POTENTIAL_LIBRARIES): Likewise.
63891                 (ld_${EMULATION_NAME}_emulation): Removed.
63892                 Source ${srcdir}/emultempl/emulation.em.
63893                 * emultempl/pep.em (gld_${EMULATION_NAME}_before_parse): Renamed
63894                 to ...
63895                 (gld${EMULATION_NAME}_before_parse): This.
63896                 (gld_${EMULATION_NAME}_list_options): Renamed to ...
63897                 (gld${EMULATION_NAME}_list_options): This.
63898                 (gld_${EMULATION_NAME}_set_symbols): Renamed to ...
63899                 (gld${EMULATION_NAME}_set_symbols): This.
63900                 (gld_${EMULATION_NAME}_after_parse): Renamed to ...
63901                 (gld${EMULATION_NAME}_after_parse): This.
63902                 (gld_${EMULATION_NAME}_after_open): Renamed to ...
63903                 (gld${EMULATION_NAME}_after_open): This.
63904                 (gld_${EMULATION_NAME}_before_allocation): Renamed to ...
63905                 (gld${EMULATION_NAME}_before_allocation): This.
63906                 (gld_${EMULATION_NAME}_unrecognized_file): Renamed to ...
63907                 (gld${EMULATION_NAME}_unrecognized_file): This.
63908                 (gld_${EMULATION_NAME}_recognized_file): Renamed to ...
63909                 (gld${EMULATION_NAME}_recognized_file): This.
63910                 (gld_${EMULATION_NAME}_finish): Renamed to ...
63911                 (gld${EMULATION_NAME}_finish): This.
63912                 (gld_${EMULATION_NAME}_place_orphan): Renamed to ...
63913                 (gld${EMULATION_NAME}_place_orphan): This.
63914                 (gld_${EMULATION_NAME}_open_dynamic_archive): Renamed to ...
63915                 (gld${EMULATION_NAME}_open_dynamic_archive): This.
63916                 (gld_${EMULATION_NAME}_find_potential_libraries): Renamed to ...
63917                 (gld${EMULATION_NAME}_find_potential_libraries): This.
63918                 (gld_${EMULATION_NAME}_get_script): Renamed to ...
63919                 (gld${EMULATION_NAME}_get_script): This.
63920                 (LDEMUL_AFTER_PARSE): New.
63921                 (LDEMUL_AFTER_OPEN): Likewise.
63922                 (LDEMUL_BEFORE_ALLOCATION): Likewise.
63923                 (LDEMUL_FINISH=): Likewise.
63924                 (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
63925                 (LDEMUL_PLACE_ORPHAN): Likewise.
63926                 (LDEMUL_SET_SYMBOLS): Likewise.
63927                 (LDEMUL_ADD_OPTIONS): Likewise.
63928                 (LDEMUL_HANDLE_OPTION): Likewise.
63929                 (LDEMUL_UNRECOGNIZED_FILE): Likewise.
63930                 (LDEMUL_LIST_OPTIONS): Likewise.
63931                 (LDEMUL_RECOGNIZED_FILE): Likewise.
63932                 (LDEMUL_FIND_POTENTIAL_LIBRARIES): Likewise.
63933                 (ld_${EMULATION_NAME}_emulation): Removed.
63934                 Source ${srcdir}/emultempl/emulation.em.
63935                 * emultempl/ticoff.em (gld_${EMULATION_NAME}_list_options):
63936                 Renamed to ...
63937                 (gld${EMULATION_NAME}_list_options): This.
63938                 (gld_${EMULATION_NAME}_before_parse): Renamed to ...
63939                 (gld_${EMULATION_NAME}_get_script): Renamed to ...
63940                 (gld${EMULATION_NAME}_get_script): This.
63941                 (LDEMUL_ADD_OPTIONS): New.
63942                 (LDEMUL_HANDLE_OPTION): Likewise.
63943                 (LDEMUL_LIST_OPTIONS): Likewise.
63944                 (ld_${EMULATION_NAME}_emulation): Removed.
63945                 Source ${srcdir}/emultempl/emulation.em.
63946                 * emultempl/vanilla.em (LDEMUL_BEFORE_PARSE): New.
63947                 (LDEMUL_SET_OUTPUT_ARCH): Likewise.
63948                 (LDEMUL_GET_SCRIPT): Likewise.
63949                 (EMULATION_NAME): Likewise.
63950                 (OUTPUT_FORMAT): Likewise.
63951                 (ld_vanilla_emulation): Removed.
63952                 Source ${srcdir}/emultempl/emulation.em.
63953
63954 2022-02-06  Andrew Burgess  <aburgess@redhat.com>
63955
63956         gdb/doc: update docs for 'info win' and 'winheight' commands
63957         This started by noticing that the docs for 'winheight' are out of
63958         date, the docs currently give a specific list of possible window
63959         names.  However, now that windows can be implemented in Python, it is
63960         not possible to list all possible names.
63961
63962         I now link the user to a mechanism by which they can discover the
63963         valid names for themselves at run time (by using 'info win').  That,
63964         and the fact that gdb provides tab-completion of the name at the
63965         command line, feels good enough.
63966
63967         Finally, I noticed that the docs for 'win info' don't explicitly say
63968         that the name of the window is given in the output.  This could
63969         probably have been inferred, but given I'm now linking to this as a
63970         mechanism to find the window name, I'd prefer to mention that the name
63971         can be found in the output.
63972
63973 2022-02-06  Andrew Burgess  <aburgess@redhat.com>
63974
63975         gdb/tui: add window width information to 'info win' output
63976         Now that we support horizontal window placement in the tui, it makes
63977         sense to have 'info win' include the width, as well as the height, of
63978         the currently visible windows.
63979
63980         That's what this commit does.  Example output is now:
63981
63982           (gdb) info win
63983           Name       Lines Columns Focus
63984           src           12      40 (has focus)
63985           asm           12      41
63986           status         1      80
63987           cmd           11      80
63988
63989         I've added a NEWS entry, but the documentation was already suitably
63990         vague, it just says that 'info win' displays the size of the visible
63991         windows, so I don't think anything needs to be added there.
63992
63993         I've also added some tests, as far as I could find, the 'info win'
63994         command was previously untested.
63995
63996 2022-02-06  GDB Administrator  <gdbadmin@sourceware.org>
63997
63998         Automatic date update in version.in
63999
64000 2022-02-05  H.J. Lu  <hjl.tools@gmail.com>
64001
64002         x86: Skip undefined symbol when finishing DT_RELR
64003         Don't abort for undefined symbol when finishing DT_RELR.  Instead, skip
64004         undefined symbol.  Undefined symbol will be reported by relocate_section.
64005
64006                 * elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Skip
64007                 undefined symbol in finishing phase.
64008
64009 2022-02-05  Alan Modra  <amodra@gmail.com>
64010
64011         Tweak assembler invocation for pr28827-1 test
64012                 PR 28827
64013                 * testsuite/ld-powerpc/pr28827-1.d: Pass -a64 to gas.
64014
64015 2022-02-05  Alan Modra  <amodra@gmail.com>
64016
64017         PR28827 testcase
64018         This testcase triggers a stub sizing error with the patches applied
64019         for PR28743 (commit 2f83249c13d8 and c804c6f98d34).
64020
64021                 PR 28827
64022                 * testsuite/ld-powerpc/pr28827-1.s,
64023                 * testsuite/ld-powerpc/pr28827-1.d: New test.
64024                 * testsuite/ld-powerpc/powerpc.exp: Run it.
64025
64026 2022-02-05  Alan Modra  <amodra@gmail.com>
64027
64028         Enable "size" as a dumpprog in ld
64029         binutils/
64030                 * testsuite/lib/binutils-common.exp (run_dump_test): Reference
64031                 global SIZE and SIZEFLAGS.
64032         ld/
64033                 * testsuite/config/default.exp: Define SIZE and SIZEFLAGS.
64034
64035 2022-02-05  Alan Modra  <amodra@gmail.com>
64036
64037         Detect .eh_frame_hdr earlier for SIZEOF_HEADERS
64038         Current code detects the need for PT_GNU_EH_FRAME using a field set by
64039         _bfd_elf_discard_section_eh_frame_hdr, which is called fairly late in
64040         the linking process.  Use the elf hash table eh_info instead, which is
64041         set up earlier by size_dynamic_sections.
64042
64043                 * elf-bfd.h (struct output_elf_obj_tdata): Delete eh_frame_hdr.
64044                 (elf_eh_frame_hdr): Don't define.
64045                 (_bfd_elf_discard_section_eh_frame_hdr): Update prototype.
64046                 * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Delete
64047                 abfd parameter.  Don't set elf_eh_frame_hdr.
64048                 * elf.c (elf_eh_frame_hdr): New function.
64049                 (get_program_header_size): Adjust elf_eh_frame_hdr call.
64050                 (_bfd_elf_map_sections_to_segments): Likewise.
64051
64052 2022-02-05  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64053
64054         sim: mips: Add simulator support for mips32r6/mips64r6
64055         2022-02-01  Ali Lown  <ali.lown@imgtec.com>
64056                     Andrew Bennett  <andrew.bennett@imgtec.com>
64057                     Dragan Mladjenovic  <dragan.mladjenovic@rt-rk.com>
64058                     Faraz Shahbazker  <fshahbazker@wavecomp.com>
64059
64060         sim/common/ChangeLog:
64061                 * sim-bits.h (EXTEND9, EXTEND18 ,EXTEND19, EXTEND21,
64062                 EXTEND26): New macros.
64063
64064         sim/mips/ChangeLog:
64065                 * Makefile.in (IGEN_INCLUDE): Add mips3264r6.igen.
64066                 * configure: Regenerate.
64067                 * configure.ac: Support mipsisa32r6 and mipsisa64r6.
64068                 (sim_engine_run): Pick simulator model from processor specified
64069                 in e_flags.
64070                 * cp1.c (value_fpr): Handle fmt_dc32.
64071                 (fp_unary, fp_binary): Zero initialize locals.
64072                 (update_fcsr, fp_classify, fp_rint, fp_r6_cmp, inner_fmac,
64073                 fp_fmac, fp_min, fp_max, fp_mina, fp_maxa, fp_fmadd, fp_fmsub):
64074                 New functions.
64075                 (sim_fpu_class_mips_mapping): New.
64076                 * cp1.h (fcsr_ABS2008_mask, fcsr_ABS2008_shift): New define.
64077                 * interp.c (MIPSR6_P): New.
64078                 (load_word): Allow unaligned memory access for MIPSR6.
64079                 * micromips.igen (sc, scd): Adapt to new do_sc* helper signature.
64080                 * mips.igen: Add *r6 models.
64081                 (signal_if_cti, forbiddenslot32): New helpers.
64082                 (delayslot32): Use signal_if_cti.
64083                 (do_sc, do_scd); Add store_ll_bit parameter.
64084                 (sc, scd): Adapt to previous change.
64085                 (nal, beq, bal): New definitions for *r6.
64086                 (sll): Split nop and ssnop cases into ...
64087                 (nop, ssnop): New definitions.
64088                 (loadstore_ea): Use the 32-bit compatibility adressing.
64089                 (cache): Split logic into ...
64090                 (do_cache): New helper.
64091                 (check_fpu): Select IEEE 754-2008 mode for R6.
64092                 (not_word_value, unpredictable, check_mt_hilo, check_mf_hilo,
64093                 check_multi_hilo, check_div_hilo, check_u64, do_dmfc1b, add,
64094                 li, addu, and, andi, bgez, bgtz, blez, bltz, bne, break, dadd,
64095                 daddiu, daddu, dror, dror32, drorv, dsll, dsll32, dsllv, dsra,
64096                 dsra32, dsrav, dsrl, dsrl32, dsub, dsubu, j, jal, jalr,
64097                 jalr.hb, lb, lbu, ld, lh, lhu, lui, lw, lwu, nor, or, ori, ror,
64098                 rorv, sb, sd, sh, sll, sllv, slt, slti, sltiu, sltu, sra, srav,
64099                 srl, srlv, sub, subu, sw, sync, syscall, teq, tge, tgeu, tlt,
64100                 tltu, tne, xor, xori, check_fmt_p, do_load_double,
64101                 do_store_double, abs.FMT, add.FMT, ceil.l.FMT, ceil.w.FMT,
64102                 cfc1, ctc1, cvt.d.FMT, cvt.l.FMT, cvt.w.FMT, div.FMT, dfmc1,
64103                 dmtc1, floor.l.FMT, floor.w.FMT, ldc1, lwc1, mfc1, mov.FMT,
64104                 mtc1, mul.FMT, recip.FMT, round.l.FMT, round.w.FMT, rsqrt.FMT,
64105                 sdc1, sqrt.FMT, sub.FMT, swc1, trunc.l.FMT, trunc.w.FMT, bc0f,
64106                 bc0fl, bc0t, bc0tl, dmfc0, dmtc0, eret, mfc0, mtc0, cop, tlbp,
64107                 tlbr, tlbwi, tlbwr): Enable on *r6 models.
64108                 * mips3264r2.igen (dext, dextm, dextu, di, dins, dinsm, dinsu,
64109                 dsbh, dshd, ei, ext, mfhc1, mthc1, ins, seb, seh, synci, rdhwr,
64110                 wsbh): Likewise.
64111                 * mips3264r6.igen: New file.
64112                 * sim-main.h (FP_formats): Add fmt_dc32.
64113                 (FORBIDDEN_SLOT): New macros.
64114                 (simFORBIDDENSLOT, FP_R6CMP_*, FP_R6CLASS_*): New defines.
64115                 (fp_r6_cmp, fp_classify, fp_rint, fp_min, fp_max, fp_mina,
64116                 fp_maxa, fp_fmadd, fp_fmsub): New declarations.
64117                 (R6Compare, Classify, RoundToIntegralExact, Min, Max, MinA,
64118                 MaxA, FusedMultiplyAdd, FusedMultiplySub): New macros. Wrapping
64119                 previous declarations.
64120
64121         sim/testsuite/mips/ChangeLog:
64122                 * basic.exp: Add r6-*.s tests.
64123                 (run_r6_removed_test): New function.
64124                 (run_endian_tests): New function.
64125                 * hilo-hazard-3.s: Skip for mips*r6.
64126                 * r2-fpu.s: New test.
64127                 * r6-64.s: New test.
64128                 * r6-branch.s: New test.
64129                 * r6-forbidden.s: New test.
64130                 * r6-fpu.s: New test.
64131                 * r6-llsc-dp.s: New test.
64132                 * r6-llsc-wp.s: New test.
64133                 * r6-removed.csv: New test.
64134                 * r6-removed.s: New test.
64135                 * r6.s: New test.
64136                 * utils-r6.inc: New inc.
64137
64138 2022-02-05  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64139
64140         sim: Add partial support for IEEE 754-2008
64141         2022-02-01  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64142
64143         sim/common/ChangeLog:
64144                 * sim-fpu.c (sim_fpu_minmax_nan): New.
64145                 (sim_fpu_max): Add variant behaviour for IEEE 754-2008.
64146                 (sim_fpu_min): Likewise.
64147                 (sim_fpu_is_un, sim_fpu_is_or): New.
64148                 (sim_fpu_un, sim_fpu_or): New.
64149                 (sim_fpu_is_ieee754_2008, sim_fpu_is_ieee754_1985): New.
64150                 (sim_fpu_set_mode): New.
64151                 (sim_fpu_classify): New.
64152                 * sim-fpu.h (sim_fpu_minmax_nan): New declaration.
64153                 (sim_fpu_un, sim_fpu_or): New declarations.
64154                 (sim_fpu_is_un, sim_fpu_is_or): New declarations.
64155                 (sim_fpu_mode): New enum.
64156                 [sim_fpu_state](current_mode): New field.
64157                 (sim_fpu_current_mode): New define.
64158                 (sim_fpu_is_ieee754_2008): New declaration.
64159                 (sim_fpu_is_ieee754_1985): New declaration.
64160                 (sim_fpu_set_mode): New declaration.
64161                 (sim_fpu_classify): New declaration.
64162
64163 2022-02-05  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64164
64165         sim: Factor out NaN handling in floating point operations
64166         2022-02-01  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64167
64168         sim/common/ChangeLog:
64169                 * sim-fpu.c (sim_fpu_op_nan): New.
64170                 (sim_fpu_add): Factor out NaN operand handling with
64171                 a call to sim_fpu_op_nan.
64172                 (sim_fpu_sub, sim_fpu_mul, sim_fpu_div): Likewise.
64173                 (sim_fpu_rem, sim_fpu_max, sim_fpu_min): Likewise.
64174                 * sim-fpu.h (sim_fpu_op_nan): New declaration.
64175
64176 2022-02-05  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64177
64178         sim: Allow toggling of quiet NaN-bit semantics
64179         IEEE754-1985 specifies the top bit of the mantissa as an indicator
64180         of signalling vs. quiet NaN, but does not define the precise semantics.
64181         Most architectures treat this bit as indicating quiet NaN, but legacy
64182         (pre-R6) MIPS goes the other way and treats it as signalling NaN.
64183
64184         This used to be controlled by a macro that was only defined for MIPS.
64185         This patch replaces the macro with a variable to track the current
64186         semantics of the NaN bit and allows differentiation between older
64187         (pre-R6) and and newer MIPS cores.
64188
64189         2022-02-01  Faraz Shahbazker  <fshahbazker@wavecomp.com>
64190
64191         sim/common/ChangeLog:
64192                 * sim-fpu.c (_sim_fpu): New.
64193                 (pack_fpu, unpack_fpu): Allow reversal of quiet NaN semantics.
64194                 * sim-fpu.h (sim_fpu_state): New struct.
64195                 (_sim_fpu): New extern.
64196                 (sim_fpu_quiet_nan_inverted): New define.
64197
64198         sim/mips/ChangeLog:
64199                 * cp1.h (fcsr_NAN2008_mask, fcsr_NAN2008_shift): New.
64200                 * mips.igen (check_fpu): Select default quiet NaN mode
64201                 for legacy MIPS.
64202                 * sim-main.h (SIM_QUIET_NAN_NEGATED): Remove.
64203
64204 2022-02-05  GDB Administrator  <gdbadmin@sourceware.org>
64205
64206         Automatic date update in version.in
64207
64208 2022-02-04  H.J. Lu  <hjl.tools@gmail.com>
64209
64210         ld: Remove emultempl/armcoff.em
64211         Remove emultempl/armcoff.em which has been unused after
64212
64213         commit 2ac93be706418f3b2aebeb22159a328023faed52
64214         Author: Alan Modra <amodra@gmail.com>
64215         Date:   Mon Apr 16 20:33:36 2018 +0930
64216
64217             Remove arm-aout and arm-coff support
64218
64219             This also removes arm-netbsd (not arm-netbsdelf!), arm-openbsd, and
64220             arm-riscix.  Those targets weren't on the obsolete list but they are
64221             all aout, and it doesn't make all that much sense to remove arm-aout
64222             without removing them too.
64223
64224                 * emultempl/armcoff.em: Removed.
64225
64226 2022-02-04  Simon Marchi  <simon.marchi@efficios.com>
64227
64228         gdb: include jit_code_entry::symfile_addr value in names of objfiles created by jit reader API
64229         This commit includes the JIT object's symfile address in the names of
64230         objfiles created by JIT reader API (e.g., << JIT compiled code at
64231         0x7ffd8a0c77a0 >>).  This allows one to at least differentiate one from
64232         another.
64233
64234         The address is the one that the debugged program has put in
64235         jit_code_entry::symfile_addr, and that the JIT reader's read function
64236         receives.  As we can see in gdb.base/jit-reader-host.c and
64237         gdb.base/jit-reader.c, that may not be the actual value of where the
64238         JIT-ed code is.  But it is a value chosen by the author of the JIT
64239         engine and the JIT reader, so including this value in the objfile name
64240         may help them correlate the JIT objfiles created by with their logs /
64241         data structures.
64242
64243         To access this field, we need to pass down a reference to the
64244         jit_code_entry.  So make jit_dbg_reader_data a structure (instead of an
64245         alias for a CORE_ADDR) that includes the address of the code entry in
64246         the inferior's address space (the previous meaning of
64247         jit_dbg_reader_data) plus a reference to the jit_code_entry as read into
64248         GDB's address space.  And while at it, pass down the gdbarch, so that we
64249         don't have to call target_gdbarch.
64250
64251         Co-Authored-By: Jan Vrany <jan.vrany@labware.com>
64252         Change-Id: Ib26c4d1bd8de503d651aff89ad2e500cb312afa5
64253
64254 2022-02-04  Tom Tromey  <tromey@adacore.com>
64255
64256         Improve Ada unchecked union type printing
64257         Currently, "ptype" of an Ada unchecked union may show a
64258         compiler-generated wrapper structure in its output.  It's more
64259         Ada-like to elide this structure, which is what this patch implements.
64260         It turned out to be simplest to reuse a part of print_variant_clauses
64261         for this.
64262
64263         As this is Ada-specific, and Joel already reviewed it internally, I am
64264         going to check it in.
64265
64266 2022-02-04  Tom Tromey  <tromey@adacore.com>
64267
64268         Remove host_hex_value
64269         I noticed that host_hex_value is redundant, because gdbsupport already
64270         has fromhex.  This patch removes the former in favor of the latter.
64271
64272         Regression tested on x86-64 Fedora 34.
64273
64274 2022-02-04  Andi Kleen  <andi@firstfloor.org>
64275
64276         Support symbol+offset lookup in addr2line
64277         The Linux kernel usually ouputs symbol+offset instead of plain code
64278         addresses these days, to avoid leaking ASLR secrets and to handle
64279         dynamically loaded modules.
64280
64281         Converting those with addr2line is somewhat involved: it requires
64282         looking up the symbol first using nm and then manually compute the
64283         offset, and then pass it to addr2line.
64284
64285         This patch implements the necessary steps directly in addr2line,
64286         by looking up the symbol (with demangling if needed) and computing
64287         the offset.
64288
64289         It's possible that a symbol is ambigious with a hex number. In this
64290         case it uses the symbol lookup if the string contains a +. When it isn't
64291         ambigious the + is optional.
64292
64293 2022-02-04  GDB Administrator  <gdbadmin@sourceware.org>
64294
64295         Automatic date update in version.in
64296
64297 2022-02-03  Cary Coutant  <ccoutant@gmail.com>
64298
64299         Rename EM_56800V4 to EM_56800EF.
64300         include/elf:
64301                 * common.h: Rename EM_56800V4 to EM_56800EF.
64302
64303 2022-02-03  H.J. Lu  <hjl.tools@gmail.com>
64304
64305         x86: Update X86_64_GOT_TYPE_P to cover more GOT relocations
64306         Add R_X86_64_GOT32, R_X86_64_GOT64, R_X86_64_GOTPCREL64 and
64307         R_X86_64_GOTPLT64 to X86_64_GOT_TYPE_P to cover more GOT relocations.
64308
64309                 PR ld/28858
64310                 * elfxx-x86.h (X86_64_GOT_TYPE_P): Add R_X86_64_GOT32,
64311                 R_X86_64_GOT64, R_X86_64_GOTPCREL64 and R_X86_64_GOTPLT64.
64312
64313 2022-02-03  Cary Coutant  <ccoutant@gmail.com>
64314
64315         Add new e_machine values.
64316         include/elf:
64317                 * common.h: Add EM_U16_U8CORE, EM_TACHYUM, EM_56800V4.
64318
64319 2022-02-03  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
64320
64321         testsuite: fix failure in gdb.threads/killed-outside.exp
64322         Starting with commit
64323
64324           commit 1da5d0e664e362857153af8682321a89ebafb7f6
64325           Date:   Tue Jan 4 08:02:24 2022 -0700
64326
64327             Change how Python architecture and language are handled
64328
64329         we see a failure in gdb.threads/killed-outside.exp:
64330
64331           ...
64332           Executing on target: kill -9 16622    (timeout = 300)
64333           builtin_spawn -ignore SIGHUP kill -9 16622
64334           continue
64335           Continuing.
64336           Couldn't get registers: No such process.
64337           (gdb) [Thread 0x7ffff77c2700 (LWP 16626) exited]
64338
64339           Program terminated with signal SIGKILL, Killed.
64340           The program no longer exists.
64341           FAIL: gdb.threads/killed-outside.exp: prompt after first continue (timeout)
64342
64343         This is not a regression but a failure due to a change in GDB's
64344         output.  Prior to the aforementioned commit, GDB has been printing the
64345         "Couldn't get registers: No such process." message twice.  The second
64346         one came from
64347
64348           (top-gdb) bt
64349           #0  amd64_linux_nat_target::fetch_registers (this=0x555557f31440 <the_amd64_linux_nat_target>, regcache=0x555558805ce0, regnum=16) at /gdb-up/gdb/amd64-linux-nat.c:225
64350           #1  0x000055555640ac5f in target_ops::fetch_registers (this=0x555557d636d0 <the_thread_db_target>, arg0=0x555558805ce0, arg1=16) at /gdb-up/gdb/target-delegates.c:502
64351           #2  0x000055555641a647 in target_fetch_registers (regcache=0x555558805ce0, regno=16) at /gdb-up/gdb/target.c:3945
64352           #3  0x0000555556278e68 in regcache::raw_update (this=0x555558805ce0, regnum=16) at /gdb-up/gdb/regcache.c:587
64353           #4  0x0000555556278f14 in readable_regcache::raw_read (this=0x555558805ce0, regnum=16, buf=0x555558881950 "") at /gdb-up/gdb/regcache.c:601
64354           #5  0x00005555562792aa in readable_regcache::cooked_read (this=0x555558805ce0, regnum=16, buf=0x555558881950 "") at /gdb-up/gdb/regcache.c:690
64355           #6  0x000055555627965e in readable_regcache::cooked_read_value (this=0x555558805ce0, regnum=16) at /gdb-up/gdb/regcache.c:748
64356           #7  0x0000555556352a37 in sentinel_frame_prev_register (this_frame=0x555558181090, this_prologue_cache=0x5555581810a8, regnum=16) at /gdb-up/gdb/sentinel-frame.c:53
64357           #8  0x0000555555fa4773 in frame_unwind_register_value (next_frame=0x555558181090, regnum=16) at /gdb-up/gdb/frame.c:1235
64358           #9  0x0000555555fa420d in frame_register_unwind (next_frame=0x555558181090, regnum=16, optimizedp=0x7fffffffd570, unavailablep=0x7fffffffd574, lvalp=0x7fffffffd57c, addrp=0x7fffffffd580,
64359               realnump=0x7fffffffd578, bufferp=0x7fffffffd5b0 "") at /gdb-up/gdb/frame.c:1143
64360           #10 0x0000555555fa455f in frame_unwind_register (next_frame=0x555558181090, regnum=16, buf=0x7fffffffd5b0 "") at /gdb-up/gdb/frame.c:1199
64361           #11 0x00005555560178e2 in i386_unwind_pc (gdbarch=0x5555587c4a70, next_frame=0x555558181090) at /gdb-up/gdb/i386-tdep.c:1972
64362           #12 0x0000555555cd2b9d in gdbarch_unwind_pc (gdbarch=0x5555587c4a70, next_frame=0x555558181090) at /gdb-up/gdb/gdbarch.c:3007
64363           #13 0x0000555555fa3a5b in frame_unwind_pc (this_frame=0x555558181090) at /gdb-up/gdb/frame.c:948
64364           #14 0x0000555555fa7621 in get_frame_pc (frame=0x555558181160) at /gdb-up/gdb/frame.c:2572
64365           #15 0x0000555555fa7706 in get_frame_address_in_block (this_frame=0x555558181160) at /gdb-up/gdb/frame.c:2602
64366           #16 0x0000555555fa77d0 in get_frame_address_in_block_if_available (this_frame=0x555558181160, pc=0x7fffffffd708) at /gdb-up/gdb/frame.c:2665
64367           #17 0x0000555555fa5f8d in select_frame (fi=0x555558181160) at /gdb-up/gdb/frame.c:1890
64368           #18 0x0000555555fa5bab in lookup_selected_frame (a_frame_id=..., frame_level=-1) at /gdb-up/gdb/frame.c:1720
64369           #19 0x0000555555fa5e47 in get_selected_frame (message=0x0) at /gdb-up/gdb/frame.c:1810
64370           #20 0x0000555555cc9c6e in get_current_arch () at /gdb-up/gdb/arch-utils.c:848
64371           #21 0x000055555625b239 in gdbpy_before_prompt_hook (extlang=0x555557451f20 <extension_language_python>, current_gdb_prompt=0x555557f4d890 <top_prompt+16> "(gdb) ")
64372               at /gdb-up/gdb/python/python.c:1063
64373           #22 0x0000555555f7cfbb in ext_lang_before_prompt (current_gdb_prompt=0x555557f4d890 <top_prompt+16> "(gdb) ") at /gdb-up/gdb/extension.c:922
64374           #23 0x0000555555f7d442 in std::_Function_handler<void (char const*), void (*)(char const*)>::_M_invoke(std::_Any_data const&, char const*&&) (__functor=...,
64375               __args#0=@0x7fffffffd900: 0x555557f4d890 <top_prompt+16> "(gdb) ") at /usr/include/c++/7/bits/std_function.h:316
64376           #24 0x0000555555f752dd in std::function<void (char const*)>::operator()(char const*) const (this=0x55555817d838, __args#0=0x555557f4d890 <top_prompt+16> "(gdb) ")
64377               at /usr/include/c++/7/bits/std_function.h:706
64378           #25 0x0000555555f75100 in gdb::observers::observable<char const*>::notify (this=0x555557f49060 <gdb::observers::before_prompt>, args#0=0x555557f4d890 <top_prompt+16> "(gdb) ")
64379               at /gdb-up/gdb/../gdbsupport/observable.h:150
64380           #26 0x0000555555f736dc in top_level_prompt () at /gdb-up/gdb/event-top.c:444
64381           #27 0x0000555555f735ba in display_gdb_prompt (new_prompt=0x0) at /gdb-up/gdb/event-top.c:411
64382           #28 0x00005555564611a7 in tui_on_command_error () at /gdb-up/gdb/tui/tui-interp.c:205
64383           #29 0x0000555555c2173f in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/7/bits/std_function.h:316
64384           #30 0x0000555555e10c20 in std::function<void ()>::operator()() const (this=0x5555580f9028) at /usr/include/c++/7/bits/std_function.h:706
64385           #31 0x0000555555e10973 in gdb::observers::observable<>::notify() const (this=0x555557f48d20 <gdb::observers::command_error>) at /gdb-up/gdb/../gdbsupport/observable.h:150
64386           #32 0x00005555560e9b3f in start_event_loop () at /gdb-up/gdb/main.c:438
64387           #33 0x00005555560e9bcc in captured_command_loop () at /gdb-up/gdb/main.c:481
64388           #34 0x00005555560eb616 in captured_main (data=0x7fffffffddd0) at /gdb-up/gdb/main.c:1348
64389           #35 0x00005555560eb67c in gdb_main (args=0x7fffffffddd0) at /gdb-up/gdb/main.c:1363
64390           #36 0x0000555555c1b6b3 in main (argc=12, argv=0x7fffffffded8) at /gdb-up/gdb/gdb.c:32
64391
64392         Commit 1da5d0e664 eliminated the call to 'get_current_arch'
64393         in 'gdbpy_before_prompt_hook'.  Hence, the second instance of
64394         "Couldn't get registers: No such process." does not appear anymore.
64395
64396         Fix the failure by updating the regular expression in the test.
64397
64398 2022-02-03  Alan Modra  <amodra@gmail.com>
64399
64400         PowerPC64 treatment of absolute symbols
64401         Supporting -static-pie on PowerPC64 requires the linker to properly
64402         treat SHN_ABS symbols for cases like glibc's _nl_current_LC_CTYPE_used
64403         absolute symbol.  I've been slow to fix the linker on powerpc because
64404         there is some chance that this will break some shared libraries or
64405         PIEs.
64406
64407         bfd/
64408                 * elf64-ppc.c (ppc64_elf_check_relocs): Consolidate local sym
64409                 handling code.  Don't count dyn relocs against non-dynamic
64410                 absolute symbols.
64411                 (dec_dynrel_count): Adjust to suit.
64412                 (ppc64_elf_edit_toc): Don't remove entries for absolute symbols
64413                 when pic.
64414                 (allocate_got): Don't allocate space for got relocs against
64415                 non-dynamic absolute syms.
64416                 (ppc64_elf_layout_multitoc): Likewise.
64417                 (got_and_plt_relr): Likewise.
64418                 (ppc64_elf_size_dynamic_sections): Likewise for local got.
64419                 (got_and_plt_relr_for_local_syms): Likewise.
64420                 (ppc64_elf_size_stubs): Don't allocate space for relr either.
64421                 (ppc64_elf_relocate_section): Don't write relocs against non-dynamic
64422                 absolute symbols.  Don't optimise got and toc code sequences
64423                 loading absolute symbol entries.
64424         ld/
64425                 * testsuite/ld-powerpc/abs-reloc.s,
64426                 * testsuite/ld-powerpc/abs-static.d,
64427                 * testsuite/ld-powerpc/abs-static.r,
64428                 * testsuite/ld-powerpc/abs-pie.d,
64429                 * testsuite/ld-powerpc/abs-pie.r,
64430                 * testsuite/ld-powerpc/abs-shared.d,
64431                 * testsuite/ld-powerpc/abs-shared.r,
64432                 * testsuite/ld-powerpc/abs-pie-relr.d,
64433                 * testsuite/ld-powerpc/abs-pie-relr.r,
64434                 * testsuite/ld-powerpc/abs-shared-relr.d,
64435                 * testsuite/ld-powerpc/abs-shared-relr.r: New tests.
64436                 * testsuite/ld-powerpc/powerpc.exp: Run them.
64437
64438 2022-02-03  GDB Administrator  <gdbadmin@sourceware.org>
64439
64440         Automatic date update in version.in
64441
64442 2022-02-02  Nick Clifton  <nickc@redhat.com>
64443
64444         Stop the BFD library complaining about compressed dwarf debug string sections being too big.
64445                 PR 28834
64446                 * dwarf2.c (read_section): Change the heuristic that checks for
64447                 overlarge dwarf debug info sections.
64448
64449 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64450
64451         gdb: fix formatting for help set/show extended-prompt
64452         The formatting of the help text for 'help set extended-prompt' and
64453         'help show extended-prompt' is a little off.
64454
64455         Here's the offending snippet:
64456
64457             Substitutions are applied to VALUE to compute the real prompt.
64458
64459             The currently defined substitutions are:
64460               \[        Begins a sequence of non-printing characters.
64461           \\    A backslash.
64462           \]    Ends a sequence of non-printing characters.
64463           \e    The ESC character.
64464
64465         Notice that the line for '\[' is indented more that the others.
64466
64467         Turns out this is due to how we build this help text, something which
64468         is done in Python.  We extended a classes __doc__ string with some
64469         dynamically generated text.
64470
64471         The classes doc string looks like this:
64472
64473             """Set the extended prompt.
64474
64475             Usage: set extended-prompt VALUE
64476
64477             Substitutions are applied to VALUE to compute the real prompt.
64478
64479             The currently defined substitutions are:
64480             """
64481
64482         Notice the closing """ are in a line of their own, and include some
64483         white space just before.  It's this extra white space that's causing
64484         the problem.
64485
64486         Fix the formatting issue by moving the """ to the end of the previous
64487         line.  I then add the extra newline in at the point where the doc
64488         string is merged with the dynamically generated text.
64489
64490         Now everything lines up correctly.
64491
64492 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64493
64494         gdb: test to check one aspect of the linespec parsing code
64495         While working on the fix for PR cli/28665 (see previous couple of
64496         commits), I was playing with making a change in the linespec parsing
64497         code.  Specifically, I was thinking about whether the spec_string for
64498         LINESPEC_LOCATION locations should ever be nullptr.
64499
64500         I made a change to prevent the spec_string from ever being nullptr,
64501         tested gdb, and saw no regressions.
64502
64503         However, as part of this work I was reviewing how the breakpoint code
64504         handles this case (spec_string being nullptr), and spotted that in
64505         parse_breakpoint_sals the nullptr case is specifically handled, so
64506         changing this should have caused a regression.  But I didn't see one.
64507
64508         So, this commit adds a comment in location.c mentioning that the
64509         nullptr case is (a) not an oversight, and (b) is required.  Then I add
64510         a new test to gdb.base/break.exp that ensures a change in this area
64511         will cause a regression.
64512
64513         This test passes on current gdb, but with my modified (and broken)
64514         gdb, the test would fail.
64515
64516 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64517
64518         gdb: handle calls to edit command passing only a linespec condition
64519         While working on the previous commit to fix PR cli/28665, I noticed
64520         that the 'edit' command would suffer from the same problem.  That is,
64521         something like:
64522
64523           (gdb) edit task 123
64524
64525         would cause GDB to break.  For a full explanation of what's going on
64526         here, see the commit message for the previous commit.
64527
64528         As with the previous commit, this issue can be prevented by detecting,
64529         and throwing, a junk at the end of the line error earlier, before
64530         calling decode_line_1.
64531
64532         So, that's what this commit does.  I've also added some tests for this
64533         issue.
64534
64535         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28665
64536
64537 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64538
64539         gdb: handle calls to list command passing only a linespec condition
64540         In PR cli/28665, it was reported that GDB would crash when given a
64541         command like:
64542
64543           (gdb) list task 123
64544
64545         The problem here is that in cli/cli-cmd.c:list_command, the string
64546         'task 123' is passed to string_to_event_location in find a location
64547         specification.  However, this location parsing understands about
64548         breakpoint conditions, and so, will stop parsing when it sees
64549         something that looks like a condition, in this case, the 'task 123'
64550         looks like a breakpoint condition.
64551
64552         As a result, the location we get back from string_to_event_location
64553         has no actual location specification attached to it.  The actual call
64554         path is:
64555
64556           list_command
64557             string_to_event_location
64558               string_to_event_location_basic
64559                 new_linespec_location
64560
64561         In new_linespec_location we call linespec_lex_to_end, which looks at
64562         'task 123' and decides that there's nothing there that describes a
64563         location.  As such, in new_linespec_location, the spec_string field of
64564         the location is left as nullptr.
64565
64566         Back in list_command we then call decode_line_1, which calls
64567         event_location_to_sals, which calls parse_linespec, which takes the
64568         spec_string we found earlier, and tries to converts this into a list
64569         of sals.
64570
64571         However, parse_linespec is not intended to be passed a nullptr, for
64572         example, calling is_ada_operator will try to access through the
64573         nullptr, causing undefined behaviour.  But there are other cases
64574         within parse_linespec which don't expect to see a nullptr.
64575
64576         When looking at how to fix this issue, I first considered having
64577         linespec_lex_to_end detect the problem.  That function understands
64578         when the first thing in the linespec is a condition keyword, and so,
64579         could throw an error saying something like: "no linespec before
64580         condition keyword", however, this is not going to work, at least, not
64581         without additional changes to GDB, it is valid to place a breakpoint
64582         like:
64583
64584           (gdb) break task 123
64585
64586         This will place a breakpoint at the current location with the
64587         condition 'task 123', and changing linespec_lex_to_end breaks this
64588         behaviour.
64589
64590         So, next, I considered what would happen if I added a condition to an
64591         otherwise valid list command, this is what I see:
64592
64593           (gdb) list file.c:1 task 123
64594           Junk at end of line specification.
64595           (gdb)
64596
64597         So, then I wondered, could we just pull the "Junk" detection forward,
64598         so that we throw the error earlier, before we call decode_line_1?
64599
64600         It turns out that yes we can.  Well, sort of.
64601
64602         It is simpler, I think, to add a separate check into the list_command
64603         function, after calling string_to_event_location, but before calling
64604         decode_line_1.  We know when we call string_to_event_location that the
64605         string in question is not empty, so, after calling
64606         string_to_event_location, if non of the string has been consumed, then
64607         the content of the string must be junk - it clearly doesn't look like
64608         a location specification.
64609
64610         I've reused the same "Junk at end of line specification." error for
64611         consistency, and added a few tests to cover this issue.
64612
64613         While the first version of this patch was on the mailing list, a
64614         second bug PR gdb/28797 was raised.  This was for a very similar
64615         issue, but this time the problem command was:
64616
64617           (gdb) list ,,
64618
64619         Here the list command understands about the first comma, list can have
64620         two arguments separated by a comma, and the first argument can be
64621         missing.  So we end up trying to parse the second command "," as a
64622         linespec.
64623
64624         However, in linespec_lex_to_end, we will stop parsing a linespec at a
64625         comma, so, in the above case we end up with an empty linespec (between
64626         the two commas), and, like above, this results in the spec_string
64627         being nullptr.
64628
64629         As with the previous case, I've resolved this issue by adding an extra
64630         check for junk at the end of the line - after parsing (or failing to
64631         parse) the nothing between the two commas, we still have the "," left
64632         at the end of the list command line - when we see this we can throw
64633         the same "junk at the end of the line" error, and all is good.
64634
64635         I've added tests for this case too.
64636
64637         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28665
64638         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28797
64639
64640 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64641
64642         gdb/testsuite: move linespec test into gdb.linespec/ directory
64643         The gdb.base/linespecs.exp test should really live in the gdb.linespec
64644         directory, so lets move it there.
64645
64646         As we already have gdb.linespec/linespec.exp, I've renamed the test to
64647         gdb.linespec/errors.exp, as this better reflects what the test is
64648         actually checking.
64649
64650         Finally, the test script doesn't have its own source file, it was
64651         reusing a random other source file, gdb.base/memattr.c.  Now the tests
64652         script is in gdb.linespec/, I've updated the test to use a different
64653         source file from that directory.
64654
64655 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64656
64657         gdb: add empty string check in parse_linespec
64658         If parse_linespec (linespec.c) is passed ARG as an empty string then
64659         we end up calling `strchr (linespec_quote_characters, '\0')`, which
64660         will return a pointer to the '\0' at the end of
64661         linespec_quote_characters.  This then results in GDB calling
64662         skip_quote_char with `ARG + 1`, which is undefined behaviour (as ARG
64663         only contained a single character, the '\0').
64664
64665         Fix this by checking for the first character of ARG being '\0' before
64666         the call to strchr.
64667
64668         I have additionally added an assertion that ARG can't itself be
64669         nullptr, as calling is_ada_operator with nullptr can end up calling
64670         'startswith' on the nullptr, which is undefined behaviour.
64671
64672         Finally, I moved the declaration of TOKEN into the body of
64673         parse_linespec, to where TOKEN is defined.
64674
64675         This patch came about while I was working on fixes for PR cli/28665
64676         and PR gdb/28797.  The actual fixes for these two issues will be in a
64677         later commit in this series, but, with this patch in place, both of
64678         the above bugs would hit the new assertion rather than accessing
64679         invalid memory and crashing.  The '\0' check is not currently ever
64680         hit, but just makes the code a little safer.
64681
64682         Because this patch only changes the nature of the failure for the
64683         above two bugs, there's no tests here.  A later commit will fix the
64684         above two issues, at which point I'll add some tests.
64685
64686         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28665
64687         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28797
64688
64689 2022-02-02  Andrew Burgess  <aburgess@redhat.com>
64690
64691         gdb: update the comment on string_to_event_location
64692         The comment on string_to_event_location is (I believe) out of date.
64693         This commit fixes the two issues I see:
64694
64695           1. This function can't return NULL any more.  The implementation
64696           calls string_to_explicit_location which can return NULL, but if this
64697           is the case we then call string_to_event_location_basic, which I
64698           don't believe can ever return NULL.
64699
64700           2. I've removed the mention that the returned string is malloc'd,
64701           though this is true, now that we return a managed pointer, I believe
64702           the source of the memory allocation is irrelevant, and so, shouldn't
64703           be discussed in the header comment.
64704
64705         There should be no user visible changes after this commit.
64706
64707 2022-02-02  Nick Clifton  <nickc@redhat.com>
64708
64709         Updated French translation for the ld/ and gold/ sub-directories
64710
64711 2022-02-02  Stafford Horne  <shorne@gmail.com>
64712
64713         or1k: Avoid R_OR1K_GOT16 signed overflow by using special howto
64714         Previously when fixing PR 21464 we masked out upper bits of the
64715         relocation value in order to avoid overflow complaints when acceptable.
64716         It turns out this does not work when the relocation value ends up being
64717         signed.
64718
64719         To fix this this patch introduces a special howto with
64720         complain_on_overflow set to complain_overflow_dont.  This is used in
64721         place of the normal R_OR1K_GOT16 howto when we detect R_OR1K_GOT_AHI16
64722         relocations.
64723
64724         bfd/ChangeLog:
64725
64726                 PR 28735
64727                 * elf32-or1k.c (or1k_elf_got16_no_overflow_howto): Define.
64728                 (or1k_elf_relocate_section): Use new howto instead of trying to
64729                 mask out relocation bits.
64730
64731 2022-02-02  GDB Administrator  <gdbadmin@sourceware.org>
64732
64733         Automatic date update in version.in
64734
64735 2022-02-01  Tom Tromey  <tromey@adacore.com>
64736
64737         Fix flex rule in gdb
64738         Currently, if flex fails, it will leave the resulting .c file in the
64739         tree.  This will cause a cascade of errors, and requires the manual
64740         deletion of the .c file in order to recreate the problem.
64741
64742         It's better for the rule to fail such that the .c file is not updated.
64743         This way, 'make' will fail the same way every time -- which is much
64744         handier for debugging syntax errors.
64745
64746         This fix just updates the Makefile rule to follow the way that the
64747         "yacc" rule already works.
64748
64749 2022-02-01  Markus Metzger  <markus.t.metzger@intel.com>
64750
64751         gdb, btrace: improve error messages
64752         When trying to use 'record btrace' on a system that does not support it,
64753         the error message isn't as clear as it could be.  See
64754         https://sourceware.org/pipermail/gdb/2022-January/049870.html.
64755
64756         Improve the error message in a few cases.
64757
64758         Reported-by: Simon Sobisch  <simonsobisch@gnu.org>
64759
64760 2022-02-01  Jan Vrany  <jan.vrany@labware.com>
64761
64762         gdb/python: fix gdb.Objfile.__repr__ () for dynamically compiled code
64763         While experimenting with JIT reader API I realized that calling repr ()
64764         on objfile created by JIT reader crashes GDB.
64765
64766         The problem was that objfpy_repr () called objfile_filename () which
64767         returned NULL, causing PyString_FromFormat () to crash.
64768
64769         This commit fixes this problem by using objfile_name () instead of
64770         objfile_filename (). This also makes consistent with the value of gdb.Objfile.filename variable.
64771
64772 2022-02-01  Samuel Thibault  <samuel.thibault@gnu.org>
64773
64774         hurd: Fix RPC prototypes
64775         The last updates of MIG introduced qualifying strings and arrays with
64776         const as appropriate.  We thus have to update the protypes in gdb too.
64777
64778         Change-Id: I3f72aac1dfa6e58d1394d5776b822d7c8f2409df
64779
64780 2022-02-01  Samuel Thibault  <samuel.thibault@gnu.org>
64781
64782         hurd: Fix RPC link names
64783         The RPC stub code expects to be calling a C function, not a C++
64784         function.
64785
64786         Change-Id: Idd7549fc118f2addc7fb4975667a011cacacc03f
64787
64788 2022-02-01  GDB Administrator  <gdbadmin@sourceware.org>
64789
64790         Automatic date update in version.in
64791
64792 2022-01-31  H.J. Lu  <hjl.tools@gmail.com>
64793
64794         elf: Check symbol version without any symbols
64795         VER_FLG_WEAK doesn't indicate that all symbol references of the symbol
64796         version have STB_WEAK.  VER_FLG_WEAK indicates a weak symbol version
64797         definition with no symbols associated with it.  It is used to verify
64798         the existence of a particular implementation without any symbol references
64799         to the weak symbol version.
64800
64801                 PR ld/24718
64802                 * testsuite/ld-elf/pr24718-1.d: New file.
64803                 * testsuite/ld-elf/pr24718-1.s: Likewise.
64804                 * testsuite/ld-elf/pr24718-1.t: Likewise.
64805
64806 2022-01-31  H.J. Lu  <hjl.tools@gmail.com>
64807
64808         Load debug section only when dumping debug sections
64809         Don't load debug sections if we aren't dumping any debug sections.
64810
64811                 PR binutils/28843
64812                 * objdump.c (dump_any_debugging): New.
64813                 (load_debug_section): Return false if dump_any_debugging isn't
64814                 set.
64815                 (main): Set dump_any_debugging when dumping any debug sections.
64816                 * readelf (dump_any_debugging): New.
64817                 (parse_args): Set dump_any_debugging when dumping any debug
64818                 sections.
64819                 (load_debug_section): Return false if dump_any_debugging isn't
64820                 set.
64821
64822 2022-01-31  Simon Marchi  <simon.marchi@efficios.com>
64823
64824         gdb: fix some clang-tidy readability-misleading-indentation warnings
64825         I have warnings like these showing in my editor all the time, so I
64826         thought I'd run clang-tidy with this diagnostic on all the files (that I
64827         can compile) and fix them.
64828
64829         There is still one warning, in utils.c, but that's because some code
64830         is mixed up with preprocessor macros (#ifdef TUI), so I think there no
64831         good solution there.
64832
64833         Change-Id: I345175fc7dd865318f0fbe61ac026c88c3b6a96b
64834
64835 2022-01-31  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
64836
64837         gdb, testsuite, fortran: adapt info symbol expected output for intel compilers
64838         Info symbol is expected to print the symbol table name of a symbol, since
64839         symbol lookup happens via the minimal symbol table.  This name
64840         corresponds to the linkage name in the full symbol table.
64841
64842         For gfortran (and maybe others) these names currently have the form
64843         XXXX.NUMBER where XXXX is the symbol name and NUMBER a compiler
64844         generated appendix for mangling.
64845         An example taken from the modified nested-funcs-2.exp would be
64846
64847         ~~~~
64848         $ objdump -t ./outputs/gdb.fortran/nested-funcs-2/nested-funcs-2 | grep \
64849         increment
64850         00000000000014ab l  F .text  0000000000000095  increment.3883
64851         000000000000141c l  F .text  000000000000008f  increment_program_global.3881
64852         ~~~~
64853
64854         This mangled name gets recognized by the Ada demangler/decoder and decoded as
64855         Ada to XXXX (setting the symbol language to Ada).  This leads to output
64856         of XXXX over XXXX.NUMBER for info symbol on gfortran symbols.
64857
64858         For ifort and ifx the generated linkage names have the form
64859         SCOPEA_SCOPEB_XXXX_ which are not recognized by the Ada decoder (or any
64860         other demangler for that matter) and thus printed as is.
64861         The respective objdump in the above case looks like
64862
64863         ~~~~
64864         $ objdump -t ./outputs/gdb.fortran/nested-funcs-2/nested-funcs-2 | grep \
64865         increment
64866         0000000000403a44 l  F .text  0000000000000074  contains_keyword_IP_increment_
64867         0000000000403ab8 l  F .text  0000000000000070
64868         contains_keyword_IP_increment_program_global_
64869         ~~~~
64870
64871         In the unmodified testcase this results in 'fails' when ran with the intel
64872         compilers:
64873
64874         ~~~~
64875         >> make check RUNTESTFLAGS="gdb.fortran/nested-funcs-2.exp \
64876         GDBFLAGS='$GDBFLAGS' CC_FOR_TARGET='icpc' F90_FOR_TARGET='ifort'"
64877
64878         ...
64879
64880                         === gdb Summary ===
64881
64882         \# of expected passes            80
64883         \# of unexpected failures        14
64884         ~~~~
64885
64886         Note that there is no Fortran mangling standard.  We keep the gfortran
64887         behavior as is and modify the test to reflect ifx and ifort mangled
64888         names which fixes above fails.
64889
64890 2022-01-31  Nick Clifton  <nickc@redhat.com>
64891
64892         Import patch from mainline GCC to fix an infinite recusion in the Rust demangler.
64893                 PR 98886
64894                 PR 99935
64895                 * rust-demangle.c (struct rust_demangler): Add a recursion
64896                 counter.
64897                 (demangle_path): Increment/decrement the recursion counter upon
64898                 entry and exit.  Fail if the counter exceeds a fixed limit.
64899                 (demangle_type): Likewise.
64900                 (rust_demangle_callback): Initialise the recursion counter,
64901                 disabling if requested by the option flags.
64902
64903 2022-01-31  Alan Modra  <amodra@gmail.com>
64904
64905         Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
64906         In trying to find a testcase for PR28827, I managed to hit a linker
64907         error in bfd_set_section_contents with a .branch_lt input section
64908         being too large for the output .branch_lt.
64909
64910         bfd/
64911                 PR 28827
64912                 * elf64-ppc.c (ppc64_elf_size_stubs): Set section size to
64913                 maxsize past STUB_SHRINK_ITER before laying out.  Remove now
64914                 unnecessary conditional setting of maxsize at start of loop.
64915         ld/
64916                 * testsuite/ld-powerpc/pr28827-2.d,
64917                 * testsuite/ld-powerpc/pr28827-2.lnk,
64918                 * testsuite/ld-powerpc/pr28827-2.s: New test.
64919                 * testsuite/ld-powerpc/powerpc.exp: Run it.
64920
64921 2022-01-31  Tom Tromey  <tom@tromey.com>
64922
64923         Remove unused variables in fbsd-tdep.c files
64924         i386-fbsd-tdep.c and amd64-fbsd-tdep.c failed to build on my x86-64
64925         Fedora 34 machine, using the system gcc, after a recent patch.  These
64926         two files now have unused variables, which provokes a warning in this
64927         configuration.
64928
64929         I'm checking in this patch to remove the unused variables.
64930
64931 2022-01-31  GDB Administrator  <gdbadmin@sourceware.org>
64932
64933         Automatic date update in version.in
64934
64935 2022-01-30  GDB Administrator  <gdbadmin@sourceware.org>
64936
64937         Automatic date update in version.in
64938
64939 2022-01-29  Alan Modra  <amodra@gmail.com>
64940
64941         Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
64942         The previous patch wasn't quite correct.  The size and padding depends
64943         on offset used in the current iteration, and if we're fudging the
64944         offset past STUB_SHRINK_ITER then we'd better use that offset.  We
64945         can't have plt_stub_pad using stub_sec->size as the offset.
64946
64947                 PR 28827
64948                 * elf64-ppc.c (plt_stub_pad): Add stub_off param.
64949                 (ppc_size_one_stub): Set up stub_offset to value used in this
64950                 iteration before sizing the stub.  Adjust plt_stub_pad calls.
64951
64952 2022-01-29  Alan Modra  <amodra@gmail.com>
64953
64954         objcopy --only-keep-debug
64955         From: Peilin Ye <peilin.ye@bytedance.com>
64956         objcopy's --only-keep-debug option has been broken for ELF files since
64957         commit 8c803a2dd7d3.
64958
64959           1. binutils/objcopy.c:setup_section() marks non-debug sections as
64960              SHT_NOBITS, then calls bfd_copy_private_section_data();
64961           2. If ISEC and OSEC share the same section flags,
64962              bfd/elf.c:_bfd_elf_init_private_section_data() restores OSEC's
64963              section type back to ISEC's section type, effectively undoing
64964              "make_nobits".
64965
64966                 * objcopy.c (setup_section): Act on make_nobits after calling
64967                 bfd_copy_private_section_data.
64968
64969 2022-01-29  GDB Administrator  <gdbadmin@sourceware.org>
64970
64971         Automatic date update in version.in
64972
64973 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
64974
64975         gdb: fix ppc-sysv-tdep.c build on 32-bit platforms
64976         The previous code triggered the following error on an i386 host:
64977
64978         /git/gdb/gdb/ppc-sysv-tdep.c:1764:34: error: non-constant-expression cannot be narrowed from type 'ULONGEST' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
64979                       unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
64980                                                 ^~~~~~~~~~~~~~~~~~~~~
64981         /git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH'
64982                                       ^~~~~~~~~~~~~~~~~~
64983         /git/gdb/gdb/ppc-sysv-tdep.c:1764:34: note: insert an explicit cast to silence this issue
64984                       unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
64985                                                 ^~~~~~~~~~~~~~~~~~~~~
64986                                                 static_cast<size_t>( )
64987         /git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH'
64988                                       ^~~~~~~~~~~~~~~~~~
64989         1 error generated.
64990
64991         Fix this by using gdb::make_array_view.
64992
64993 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
64994
64995         FreeBSD x86 nat: Use register maps for GP register sets.
64996         Rather than using the x86-specific register offset tables, use
64997         register maps to describe the layout of the general purpose registers
64998         fetched via PT_GETREGS.  The sole user-visible difference is that
64999         FreeBSD/amd64 will now report additional segment registers ($ds, $es,
65000         $fs, and $gs) for both 32-bit and 64-bit processes.
65001
65002         As part of these changes, the FreeBSD x86 native targets no longer use
65003         amd64-bsd-nat.c or i386-bsd-nat.c.  Remove FreeBSD-specific register
65004         handling (for $fs_base, $gs_base, and XSAVE state) from these files.
65005         Similarly, remove the global x86bsd_xsave_len from x86-bsd-nat.c.  The
65006         FreeBSD x86 native targets use a static xsave_len instead.
65007
65008         While here, rework the probing of PT_GETXMMREGS on FreeBSD/i386.
65009         Probe the ptrace op once in the target read_description method and
65010         cache the result for the future similar to the way the status of XSAVE
65011         support is probed in the read_description method.  In addition, return
65012         the proper xcr0 mask (X87-only) for old kernels or systems without
65013         either XSAVE or XMM support.
65014
65015 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
65016
65017         fbsd-nat: Return a bool from fetch_register_set and store_register_set.
65018         Change these helper functions to return true if they did any work.
65019
65020 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
65021
65022         FreeBSD x86: Use tramp-frame for signal frames.
65023         Use a register map to describe the registers in mcontext_t as part of
65024         the signal frame as is done on several other FreeBSD arches.  This
65025         permits fetching the fsbase and gsbase register values from the signal
65026         frame for both amd64 and i386 and permits fetching additional segment
65027         registers stored as 16-bit values on amd64.
65028
65029         While signal frames on FreeBSD do contain floating point/XSAVE state,
65030         these unwinders do not attempt to supply those registers.  The
65031         existing x86 signal frame uwinders do not support these registers, and
65032         the only existing functions which handle FSAVE/FXSAVE/XSAVE state all
65033         work with regcaches.  In the future these unwinders could create a
65034         tempory regcache, collect floating point registers, and then supply
65035         values out of the regcache into the trad-frame.
65036
65037 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
65038
65039         Use register maps for gp regsets on FreeBSD/x86 core dumps.
65040         In particular, this permits reporting the value of the $ds, $es, $fs,
65041         and $gs segment registers from amd64 core dumps since they are stored
65042         as 16-bit values rather than the 32-bit size assumed by i386_gregset.
65043
65044 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
65045
65046         regcache: Zero-extend small registers described by a register map.
65047         When registers are supplied via regcache_supply_register from a
65048         register block described by a register map, registers may be stored in
65049         slots smaller than GDB's native register size (e.g. x86 segment
65050         registers are 16 bits, but the GDB registers for those are 32-bits).
65051         regcache_collect_regset is careful to zero-extend slots larger than a
65052         register size, but regcache_supply_regset just used
65053         regcache::raw_supply_part and did not initialize the upper bytes of a
65054         register value.
65055
65056         trad_frame_set_reg_regmap assumes these semantics (zero-extending
65057         short registers).  Upcoming patches also require these semantics for
65058         handling x86 segment register values stored in 16-bit slots on
65059         FreeBSD.  Note that architecturally x86 segment registers are 16 bits,
65060         but the x86 gdb architectures treat these registers as 32 bits.
65061
65062 2022-01-28  John Baldwin  <jhb@FreeBSD.org>
65063
65064         FreeBSD x86: Remove fallback for detecting signal trampolines by address.
65065         A few FreeBSD releases did not include the page holding the signal
65066         code in core dumps.  As a workaround, a sysctl was used to fetch the
65067         default location of the signal code instead.  The youngest affected
65068         FreeBSD release is 10.1 released in November 2014 and EOLed in
65069         December 2016.  The fallback only works for native processes and would
65070         require a separate unwinder once the FreeBSD arches are converted to
65071         use tramp_frame for signal frames.
65072
65073         Remove support for pre-5.0 FreeBSD/i386 signal trampolines.
65074         The last relevant release (FreeBSD 4.11) was released in January of
65075         2005.
65076
65077         Remove vestigal FreeBSD/i386 3.x support.
65078         This was orphaned when a.out support was removed as the FreeBSD/i386
65079         ELF support always used the register layouts from 4.0+.
65080
65081 2022-01-28  Bruno Larsen  <blarsen@redhat.com>
65082
65083         Add Bruno Larsen to gdb/MAINTAINERS
65084
65085 2022-01-28  Enze Li  <lienze2010@hotmail.com>
65086
65087         gdb/build: Fix Wpessimizing-move in clang build
65088         When building with clang, I run into an error:
65089
65090         ...
65091         tui/tui-disasm.c:138:25: error: moving a temporary object prevents copy
65092         elision [-Werror,-Wpessimizing-move]
65093               tal.addr_string = std::move (gdb_dis_out.release ());
65094                                 ^
65095         tui/tui-disasm.c:138:25: note: remove std::move call here
65096               tal.addr_string = std::move (gdb_dis_out.release ());
65097                                 ^~~~~~~~~~~                      ~
65098         ...
65099
65100         The error above is caused by the recent commit 5d10a2041eb8 ("gdb: add
65101         string_file::release method").
65102
65103         Fix this by removing std::move.
65104
65105         Build on x86_64-linux with clang 13.0.0.
65106
65107 2022-01-28  Simon Marchi  <simon.marchi@polymtl.ca>
65108
65109         Add top-level .editorconfig file
65110         Add a .editorconfig [1] file.  This helps configure editors
65111         automatically with the right whitespace settings.  It will help me,
65112         since I need to juggle with different whitespace settings for different
65113         projects.   But I think it can also help newcomers get things right from
65114         the start.
65115
65116         Some editors have native support for reading these files, while others
65117         require a plug-in [2].  And if you don't want to use it, then this file
65118         doesn't change anything to your life.
65119
65120         I added rules for the kinds of files I edit most often, but more can be
65121         added later.  I assumed that the rules were the same for GDB and the
65122         other projects, but if that's not the case, we can always put
65123         .editorconfig files in project subdirectories to override settings.
65124
65125         [1] https://editorconfig.org/
65126         [2] https://editorconfig.org/#download
65127
65128         Change-Id: Ifda136d13877fafcf0d137fec8501f6a34e1367b
65129
65130 2022-01-28  Nick Clifton  <nickc@redhat.com>
65131
65132         Updated French translation for the gas sub-directory.
65133
65134 2022-01-28  Alan Modra  <amodra@gmail.com>
65135
65136         Set __ehdr_start rel_from_abs earlier
65137         This is just a tidy, making the __ehdr_start symbol flag tweaks all in
65138         one place.
65139
65140                 * ldelf.c (ldelf_before_allocation): Don't set rel_from_abs
65141                 for __ehdr_start.
65142                 * ldlang.c (lang_symbol_tweaks): Set it here instead.
65143
65144 2022-01-28  Alan Modra  <amodra@gmail.com>
65145
65146         PowerPC64 handling of @tocbase
65147                 * elf64-ppc.c (ppc64_elf_relocate_section): Warn if the symbol
65148                 on R_PPC64_TOC isn't local.
65149
65150 2022-01-28  Alan Modra  <amodra@gmail.com>
65151
65152         Update PowerPC64 symtocbase test
65153         Using a symbol other than .TOC. with @tocbase is an extension to the
65154         ABI.  It is never valid to use a symbol without a definition in the
65155         binary, and symbols on these expressions cannot be overridden.  Make
65156         this explicit by using ".hidden" in the testcase.
65157
65158                 * testsuite/ld-powerpc/symtocbase-1.s: Align data.  Make function
65159                 entry symbol hidden.
65160                 * testsuite/ld-powerpc/symtocbase-2.s: Likewise.
65161                 * testsuite/ld-powerpc/symtocbase.d: Adjust expected output.
65162
65163 2022-01-28  Alan Modra  <amodra@gmail.com>
65164
65165         PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
65166         The assertion is this one in ppc_build_one_stub
65167           BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
65168         It is checking that a stub doesn't overwrite the tail of a previous
65169         stub, so not something trivial.
65170
65171         Normally, stub sizing iterates until no stubs are added, detected by
65172         no change in stub section size.  Iteration also continues if no stubs
65173         are added but one or more stubs increases in size, which also can be
65174         detected by a change in stub section size.  But there is a
65175         pathological case where stub section sizing decreases one iteration
65176         then increases the next.  To handle that situation, stub sizing also
65177         stops at more than STUB_SHRINK_ITER (20) iterations when calculated
65178         stub section size is smaller.  The previous larger size is kept for
65179         the actual layout (so that building the stubs, which behaves like
65180         another iteration of stub sizing, will see the stub section sizes
65181         shrink).  The problem with that stopping condition is that it assumes
65182         that stub sizing is only affected by addresses external to the stub
65183         sections, which isn't always true.
65184
65185         This patch fixes that by also keeping larger individual stub_offset
65186         addresses past STUB_SHRINK_ITER.  It also catches a further
65187         pathological case where one stub shrinks and another expands in such a
65188         way that no stub section size change is seen.
65189
65190                 PR 28827
65191                 * elf64-ppc.c (struct ppc_link_hash_table): Add stub_changed.
65192                 (STUB_SHRINK_ITER): Move earlier in file.
65193                 (ppc_size_one_stub): Detect any change in stub_offset.  Keep
65194                 larger one if past STUB_SHRINK_ITER.
65195                 (ppc64_elf_size_stubs): Iterate on stub_changed too.
65196
65197 2022-01-28  Alan Modra  <amodra@gmail.com>
65198
65199         PR28826 x86_64 ld segfaults building xen
65200         Fallout from commit e86fc4a5bc37
65201
65202                 PR 28826
65203                 * coffgen.c (coff_write_alien_symbol): Init dummy to zeros.
65204
65205 2022-01-28  Alan Modra  <amodra@gmail.com>
65206
65207         PR28753, buffer overflow in read_section_stabs_debugging_info
65208                 PR 28753
65209                 * rddbg.c (read_section_stabs_debugging_info): Don't read past
65210                 end of section when concatentating stab strings.
65211
65212 2022-01-28  GDB Administrator  <gdbadmin@sourceware.org>
65213
65214         Automatic date update in version.in
65215
65216 2022-01-27  Simon Marchi  <simon.marchi@polymtl.ca>
65217
65218         gdb: work around negative DW_AT_data_member_location GCC 11 bug
65219         g++ 11.1.0 has a bug where it will emit a negative
65220         DW_AT_data_member_location in some cases:
65221
65222             $ cat test.cpp
65223             #include <memory>
65224
65225             int
65226             main()
65227             {
65228               std::unique_ptr<int> ptr;
65229             }
65230             $ g++ -g test.cpp
65231             $ llvm-dwarfdump -F a.out
65232             ...
65233             0x00000964:       DW_TAG_member
65234                                 DW_AT_name [DW_FORM_strp]   ("_M_head_impl")
65235                                 DW_AT_decl_file [DW_FORM_data1]     ("/usr/include/c++/11.1.0/tuple")
65236                                 DW_AT_decl_line [DW_FORM_data1]     (125)
65237                                 DW_AT_decl_column [DW_FORM_data1]   (0x27)
65238                                 DW_AT_type [DW_FORM_ref4]   (0x0000067a "default_delete<int>")
65239                                 DW_AT_data_member_location [DW_FORM_sdata]  (-1)
65240             ...
65241
65242         This leads to a GDB crash (when built with ASan, otherwise probably
65243         garbage results), since it tries to read just before (to the left, in
65244         ASan speak) of the value's buffer:
65245
65246             ==888645==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000c52af at pc 0x7f711b239f4b bp 0x7fff356bd470 sp 0x7fff356bcc18
65247             READ of size 1 at 0x6020000c52af thread T0
65248                 #0 0x7f711b239f4a in __interceptor_memcpy /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
65249                 #1 0x555c4977efa1 in value_contents_copy_raw /home/simark/src/binutils-gdb/gdb/value.c:1347
65250                 #2 0x555c497909cd in value_primitive_field(value*, long, int, type*) /home/simark/src/binutils-gdb/gdb/value.c:3126
65251                 #3 0x555c478f2eaa in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:333
65252                 #4 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65253                 #5 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65254                 #6 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65255                 #7 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65256                 #8 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65257                 #9 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65258                 #10 0x555c4760d45f in c_value_print_struct /home/simark/src/binutils-gdb/gdb/c-valprint.c:383
65259                 #11 0x555c4760df4c in c_value_print_inner(value*, ui_file*, int, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:438
65260                 #12 0x555c483ff9a7 in language_defn::value_print_inner(value*, ui_file*, int, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:632
65261                 #13 0x555c49758b68 in do_val_print /home/simark/src/binutils-gdb/gdb/valprint.c:1048
65262                 #14 0x555c49759b17 in common_val_print(value*, ui_file*, int, value_print_options const*, language_defn const*) /home/simark/src/binutils-gdb/gdb/valprint.c:1151
65263                 #15 0x555c478f2fcb in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:335
65264                 #16 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65265                 #17 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65266                 #18 0x555c4760d45f in c_value_print_struct /home/simark/src/binutils-gdb/gdb/c-valprint.c:383
65267                 #19 0x555c4760df4c in c_value_print_inner(value*, ui_file*, int, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:438
65268                 #20 0x555c483ff9a7 in language_defn::value_print_inner(value*, ui_file*, int, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:632
65269                 #21 0x555c49758b68 in do_val_print /home/simark/src/binutils-gdb/gdb/valprint.c:1048
65270                 #22 0x555c49759b17 in common_val_print(value*, ui_file*, int, value_print_options const*, language_defn const*) /home/simark/src/binutils-gdb/gdb/valprint.c:1151
65271                 #23 0x555c478f2fcb in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:335
65272                 #24 0x555c4760d45f in c_value_print_struct /home/simark/src/binutils-gdb/gdb/c-valprint.c:383
65273                 #25 0x555c4760df4c in c_value_print_inner(value*, ui_file*, int, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:438
65274                 #26 0x555c483ff9a7 in language_defn::value_print_inner(value*, ui_file*, int, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:632
65275                 #27 0x555c49758b68 in do_val_print /home/simark/src/binutils-gdb/gdb/valprint.c:1048
65276                 #28 0x555c49759b17 in common_val_print(value*, ui_file*, int, value_print_options const*, language_defn const*) /home/simark/src/binutils-gdb/gdb/valprint.c:1151
65277                 #29 0x555c4760f04c in c_value_print(value*, ui_file*, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:587
65278                 #30 0x555c483ff954 in language_defn::value_print(value*, ui_file*, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:614
65279                 #31 0x555c49759f61 in value_print(value*, ui_file*, value_print_options const*) /home/simark/src/binutils-gdb/gdb/valprint.c:1189
65280                 #32 0x555c48950f70 in print_formatted /home/simark/src/binutils-gdb/gdb/printcmd.c:337
65281                 #33 0x555c48958eda in print_value(value*, value_print_options const&) /home/simark/src/binutils-gdb/gdb/printcmd.c:1258
65282                 #34 0x555c48959891 in print_command_1 /home/simark/src/binutils-gdb/gdb/printcmd.c:1367
65283                 #35 0x555c4895a3df in print_command /home/simark/src/binutils-gdb/gdb/printcmd.c:1458
65284                 #36 0x555c4767f974 in do_simple_func /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:97
65285                 #37 0x555c47692e25 in cmd_func(cmd_list_element*, char const*, int) /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:2475
65286                 #38 0x555c4936107e in execute_command(char const*, int) /home/simark/src/binutils-gdb/gdb/top.c:670
65287                 #39 0x555c485f1bff in catch_command_errors /home/simark/src/binutils-gdb/gdb/main.c:523
65288                 #40 0x555c485f249c in execute_cmdargs /home/simark/src/binutils-gdb/gdb/main.c:618
65289                 #41 0x555c485f6677 in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:1317
65290                 #42 0x555c485f6c83 in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1338
65291                 #43 0x555c485f6d65 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1363
65292                 #44 0x555c46e41ba8 in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
65293                 #45 0x7f71198bcb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
65294                 #46 0x555c46e4197d in _start (/home/simark/build/binutils-gdb-one-target/gdb/gdb+0x77f197d)
65295
65296             0x6020000c52af is located 1 bytes to the left of 8-byte region [0x6020000c52b0,0x6020000c52b8)
65297             allocated by thread T0 here:
65298                 #0 0x7f711b2b7459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
65299                 #1 0x555c470acdc9 in xcalloc /home/simark/src/binutils-gdb/gdb/alloc.c:100
65300                 #2 0x555c49b775cd in xzalloc(unsigned long) /home/simark/src/binutils-gdb/gdbsupport/common-utils.cc:29
65301                 #3 0x555c4977bdeb in allocate_value_contents /home/simark/src/binutils-gdb/gdb/value.c:1029
65302                 #4 0x555c4977be25 in allocate_value(type*) /home/simark/src/binutils-gdb/gdb/value.c:1040
65303                 #5 0x555c4979030d in value_primitive_field(value*, long, int, type*) /home/simark/src/binutils-gdb/gdb/value.c:3092
65304                 #6 0x555c478f6280 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:501
65305                 #7 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65306                 #8 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65307                 #9 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65308                 #10 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65309                 #11 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65310                 #12 0x555c4760d45f in c_value_print_struct /home/simark/src/binutils-gdb/gdb/c-valprint.c:383
65311                 #13 0x555c4760df4c in c_value_print_inner(value*, ui_file*, int, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:438
65312                 #14 0x555c483ff9a7 in language_defn::value_print_inner(value*, ui_file*, int, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:632
65313                 #15 0x555c49758b68 in do_val_print /home/simark/src/binutils-gdb/gdb/valprint.c:1048
65314                 #16 0x555c49759b17 in common_val_print(value*, ui_file*, int, value_print_options const*, language_defn const*) /home/simark/src/binutils-gdb/gdb/valprint.c:1151
65315                 #17 0x555c478f2fcb in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:335
65316                 #18 0x555c478f63b2 in cp_print_value /home/simark/src/binutils-gdb/gdb/cp-valprint.c:513
65317                 #19 0x555c478f02ca in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:161
65318                 #20 0x555c4760d45f in c_value_print_struct /home/simark/src/binutils-gdb/gdb/c-valprint.c:383
65319                 #21 0x555c4760df4c in c_value_print_inner(value*, ui_file*, int, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:438
65320                 #22 0x555c483ff9a7 in language_defn::value_print_inner(value*, ui_file*, int, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:632
65321                 #23 0x555c49758b68 in do_val_print /home/simark/src/binutils-gdb/gdb/valprint.c:1048
65322                 #24 0x555c49759b17 in common_val_print(value*, ui_file*, int, value_print_options const*, language_defn const*) /home/simark/src/binutils-gdb/gdb/valprint.c:1151
65323                 #25 0x555c478f2fcb in cp_print_value_fields(value*, ui_file*, int, value_print_options const*, type**, int) /home/simark/src/binutils-gdb/gdb/cp-valprint.c:335
65324                 #26 0x555c4760d45f in c_value_print_struct /home/simark/src/binutils-gdb/gdb/c-valprint.c:383
65325                 #27 0x555c4760df4c in c_value_print_inner(value*, ui_file*, int, value_print_options const*) /home/simark/src/binutils-gdb/gdb/c-valprint.c:438
65326                 #28 0x555c483ff9a7 in language_defn::value_print_inner(value*, ui_file*, int, value_print_options const*) const /home/simark/src/binutils-gdb/gdb/language.c:632
65327                 #29 0x555c49758b68 in do_val_print /home/simark/src/binutils-gdb/gdb/valprint.c:1048
65328
65329         Since there are some binaries with this in the wild, I think it would be
65330         useful for GDB to work around this.  I did the obvious simple thing, if
65331         the DW_AT_data_member_location's value is -1, replace it with 0.  I
65332         added a producer check to only apply this fixup for GCC 11.  The idea is
65333         that if some other compiler ever uses a DW_AT_data_member_location value
65334         of -1 by mistake, we don't know (before analyzing the bug at least) if
65335         they did mean 0 or some other value.  So I wouldn't want to apply the
65336         fixup in that case.
65337
65338         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28063
65339         Change-Id: Ieef3459b0b9bbce8bdad838ba83b4b64e7269d42
65340
65341 2022-01-27  Kevin Buettner  <kevinb@redhat.com>
65342
65343         Fix GDB internal error by using text (instead of data) section offset
65344         Fedora Rawhide is now using gcc-12.0.  As part of updating to the
65345         gcc-12.0 package set, Rawhide is also now using a version of libgcc_s
65346         which lacks a .data section.  This causes gdb to fail in the following
65347         fashion while debugging a program (such as gdb) which uses libgcc_s:
65348
65349             (top-gdb) run
65350             Starting program: rawhide-master/bld/gdb/gdb
65351             ...
65352             objfiles.h:467: internal-error: sect_index_data not initialized
65353             A problem internal to GDB has been detected,
65354             further debugging may prove unreliable.
65355             ...
65356
65357         I snipped the backtrace from the above output.  Instead, here's a
65358         portion of a backtrace obtained using GDB's backtrace command.
65359         (Obviously, in order to obtain it, I used a GDB which has been patched
65360         with this commit.)
65361
65362             #0  internal_error (
65363                 file=0xc6a508 "gdb/objfiles.h", line=467,
65364                 fmt=0xc6a4e8 "sect_index_data not initialized")
65365                 at gdbsupport/errors.cc:51
65366             #1  0x00000000005f9651 in objfile::data_section_offset (this=0x4fa48f0)
65367                 at gdb/objfiles.h:467
65368             #2  0x000000000097c5f8 in relocate_address (address=0x17244, objfile=0x4fa48f0)
65369                 at gdb/stap-probe.c:1333
65370             #3  0x000000000097c630 in stap_probe::get_relocated_address (this=0xa1a17a0,
65371                 objfile=0x4fa48f0)
65372                 at gdb/stap-probe.c:1341
65373             #4  0x00000000004d7025 in create_exception_master_breakpoint_probe (
65374                 objfile=0x4fa48f0)
65375                 at gdb/breakpoint.c:3505
65376             #5  0x00000000004d7426 in create_exception_master_breakpoint ()
65377                 at gdb/breakpoint.c:3575
65378             #6  0x00000000004efcc1 in breakpoint_re_set ()
65379                 at gdb/breakpoint.c:13407
65380             #7  0x0000000000956998 in solib_add (pattern=0x0, from_tty=0, readsyms=1)
65381                 at gdb/solib.c:1001
65382             #8  0x00000000009576a8 in handle_solib_event ()
65383                 at gdb/solib.c:1269
65384             ...
65385
65386         The function 'relocate_address' in gdb/stap-probe.c attempts to do
65387         its "relocation" by using objfile->data_section_offset().  That
65388         method, data_section_offset() is defined as follows in objfiles.h:
65389
65390           CORE_ADDR data_section_offset () const
65391           {
65392             return section_offsets[SECT_OFF_DATA (this)];
65393           }
65394
65395         The internal error occurs when the SECT_OFF_DATA macro finds that the
65396         'sect_index_data' field is -1:
65397
65398             #define SECT_OFF_DATA(objfile) \
65399                  ((objfile->sect_index_data == -1) \
65400                   ? (internal_error (__FILE__, __LINE__, \
65401                                      _("sect_index_data not initialized")), -1) \
65402                   : objfile->sect_index_data)
65403
65404         relocate_address() is obtaining the section offset in order to compute
65405         a relocated address.  For some ABIs, such as the System V ABI, the
65406         section offsets will all be the same.  So for those ABIs, it doesn't
65407         matter which offset is used.  However, other ABIs, such as the FDPIC
65408         ABI, will have different offsets for the various sections.  Thus, for
65409         those ABIs, it is vital that this and other relocation code use the
65410         correct offset.
65411
65412         In stap_probe::get_relocated_address, the address to which to add the
65413         offset (thus forming the relocated address) is obtained via
65414         this->get_address (); get_address is a getter for m_address in
65415         probe.h.  It's documented/defined as follows (also in probe.h):
65416
65417           /* The address where the probe is inserted, relative to
65418              SECT_OFF_TEXT.  */
65419           CORE_ADDR m_address;
65420
65421         (Thanks to Tom Tromey for this observation.)
65422
65423         So, based on this, the current use of data_section_offset /
65424         SECT_OFF_DATA is wrong.  This relocation code should have been using
65425         text_section_offset / SECT_OFF_TEXT all along.  That being the
65426         case, I've adjusted the stap-probe.c relocation code accordingly.
65427
65428         Searching the sources turned up one other use of data_section_offset,
65429         in gdb/dtrace-probe.c, so I've updated that code as well.  The same
65430         reasoning presented above applies to this case too.
65431
65432         Summary:
65433
65434                 * gdb/dtrace-probe.c (dtrace_probe::get_relocated_address):
65435                 Use method text_section_offset instead of data_section_offset.
65436                 * gdb/stap-probe.c (relocate_address): Likewise.
65437
65438 2022-01-27  Markus Metzger  <markus.t.metzger@intel.com>
65439
65440         gdb, remote, btrace: move switch_to_thread call right before xfer call
65441         In remote_target::remote_btrace_maybe_reopen, we switch to the currently
65442         iterated thread in order to set inferior_ptid for a subsequent xfer.
65443
65444         Move the switch_to_thread call directly before the target_read_stralloc
65445         call to clarify why we need to switch threads.
65446
65447 2022-01-27  Markus Metzger  <markus.t.metzger@intel.com>
65448
65449         gdb, gdbserver: update thread identifier in enable_btrace target method
65450         The enable_btrace target method takes a ptid_t to identify the thread on
65451         which tracing shall be enabled.
65452
65453         Change this to thread_info * to avoid translating back and forth between
65454         the two.  This will be used in a subsequent patch.
65455
65456 2022-01-27  Markus Metzger  <markus.t.metzger@intel.com>
65457
65458         gdb, btrace: switch threads in remote_btrace_maybe_reopen()
65459         In remote_btrace_maybe_reopen() we iterate over threads and use
65460         set_general_thread() to set the thread from which to transfer the btrace
65461         configuration.
65462
65463         This sets the remote general thread but does not affect inferior_ptid.  On
65464         the xfer request later on, remote_target::xfer_partial() again sets the
65465         remote general thread to inferior_ptid, overwriting what
65466         remote_btrace_maybe_reopen() had done.
65467
65468         In one case, this led to inferior_ptid being null_ptid when we tried to
65469         enable tracing on a newly created thread inside a newly created process
65470         during attach.
65471
65472         This, in turn, led to find_inferior_pid() asserting when we iterated over
65473         threads in record_btrace_is_replaying(), which was called from
65474         record_btrace_target::xfer_partial() when reading the btrace configuration
65475         of the new thread to check whether it was already being recorded.
65476
65477         The bug was exposed by
65478
65479             0618ae41497 gdb: optimize all_matching_threads_iterator
65480
65481         and found by
65482
65483             FAIL: gdb.btrace/enable-new-thread.exp: ... (GDB internal error)
65484
65485         Use switch_to_thread() in remote_btrace_maybe_reopen().
65486
65487 2022-01-27  Markus Metzger  <markus.t.metzger@intel.com>
65488
65489         gdb, btrace: rename record_btrace_enable_warn()
65490         We use record_btrace_enable_warn() as the new-thread observer callback.
65491         It is not used in other contexts.
65492
65493         Rename it to record_btrace_on_new_thread() to make its role more clear.
65494
65495 2022-01-27  Nick Clifton  <nickc@redhat.com>
65496
65497         Updated Swedish translation for the binutils subdirectory
65498
65499 2022-01-27  GDB Administrator  <gdbadmin@sourceware.org>
65500
65501         Automatic date update in version.in
65502
65503 2022-01-26  Andrew Burgess  <aburgess@redhat.com>
65504
65505         gdb/python: handle non utf-8 characters when source highlighting
65506         This commit adds support for source files that contain non utf-8
65507         characters when performing source styling using the Python pygments
65508         package.  This does not change the behaviour of GDB when the GNU
65509         Source Highlight library is used.
65510
65511         For the following problem description, assume that either GDB is built
65512         without GNU Source Highlight support, of that this has been disabled
65513         using 'maintenance set gnu-source-highlight enabled off'.
65514
65515         The initial problem reported was that a source file containing non
65516         utf-8 characters would cause GDB to print a Python exception, and then
65517         display the source without styling, e.g.:
65518
65519           Python Exception <class 'UnicodeDecodeError'>: 'utf-8' codec can't decode byte 0xc0 in position 142: invalid start byte
65520           /* Source code here, without styling...  */
65521
65522         Further, as the user steps through different source files, each time
65523         the problematic source file was evicted from the source cache, and
65524         then later reloaded, the exception would be printed again.
65525
65526         Finally, this problem is only present when using Python 3, this issue
65527         is not present for Python 2.
65528
65529         What makes this especially frustrating is that GDB can clearly print
65530         the source file contents, they're right there...  If we disable
65531         styling completely, or make use of the GNU Source Highlight library,
65532         then everything is fine.  So why is there an error when we try to
65533         apply styling using Python?
65534
65535         The problem is the use of PyString_FromString (which is an alias for
65536         PyUnicode_FromString in Python 3), this function converts a C string
65537         into a either a Unicode object (Py3) or a str object (Py2).  For
65538         Python 2 there is no unicode encoding performed during this function
65539         call, but for Python 3 the input is assumed to be a uft-8 encoding
65540         string for the purpose of the conversion.  And here of course, is the
65541         problem, if the source file contains non utf-8 characters, then it
65542         should not be treated as utf-8, but that's what we do, and that's why
65543         we get an error.
65544
65545         My first thought when looking at this was to spot when the
65546         PyString_FromString call failed with a UnicodeDecodeError and silently
65547         ignore the error.  This would mean that GDB would print the source
65548         without styling, but would also avoid the annoying exception message.
65549
65550         However, I also make use of `pygmentize`, a command line wrapper
65551         around the Python pygments module, which I use to apply syntax
65552         highlighting in the output of `less`.  And this command line wrapper
65553         is quite happy to syntax highlight my source file that contains non
65554         utf-8 characters, so it feels like the problem should be solvable.
65555
65556         It turns out that inside the pygments module there is already support
65557         for guessing the encoding of the incoming file content, if the
65558         incoming content is not already a Unicode string.  This is what
65559         happens for Python 2 where the incoming content is of `str` type.
65560
65561         We could try and make GDB smarter when it comes to converting C
65562         strings into Python Unicode objects; this would probably require us to
65563         just try a couple of different encoding schemes rather than just
65564         giving up after utf-8.
65565
65566         However, I figure, why bother?  The pygments module already does this
65567         for us, and the colorize API is not part of the documented external
65568         API of GDB.  So, why not just change the colorize API, instead of the
65569         content being a Unicode string (for Python 3), lets just make the
65570         content be a bytes object.  The pygments module can then take
65571         responsibility for guessing the encoding.
65572
65573         So, currently, the colorize API receives a unicode object, and returns
65574         a unicode object.  I propose that the colorize API receive a bytes
65575         object, and return a bytes object.
65576
65577 2022-01-26  Tom Tromey  <tom@tromey.com>
65578
65579         Remove global wrap_here function
65580         This removes the global wrap_here function, so that future calls
65581         cannot be introduced.  Instead, all callers must use the method on the
65582         appropriate ui_file.
65583
65584         This temporarily moves the implementation of this method to utils.c.
65585         This will change once the remaining patches to untangle the pager have
65586         been written.
65587
65588 2022-01-26  Tom Tromey  <tom@tromey.com>
65589
65590         Always call the wrap_here method
65591         This changes all existing calls to wrap_here to call the method on the
65592         appropriate ui_file instead.  The choice of ui_file is determined by
65593         context.
65594
65595 2022-01-26  Tom Tromey  <tom@tromey.com>
65596
65597         Add ui_file::wrap_here
65598         Right now, wrap_here is a global function.  In the long run, we'd like
65599         output streams to be relatively self-contained objects, and having a
65600         global function like this is counter to that goal.  Also, existing
65601         code freely mixes writes to some parameterized stream with calls to
65602         wrap_here -- but wrap_here only really affects gdb_stdout, so this is
65603         also incoherent.
65604
65605         This step is a patch toward making wrap_here more sane.  It adds a
65606         wrap_here method to ui_file and changes ui_out implementations to use
65607         it.
65608
65609 2022-01-26  Tom Tromey  <tom@tromey.com>
65610
65611         Convert wrap_here to use integer parameter
65612         I think it only really makes sense to call wrap_here with an argument
65613         consisting solely of spaces.  Given this, it seemed better to me that
65614         the argument be an int, rather than a string.  This patch is the
65615         result.  Much of it was written by a script.
65616
65617 2022-01-26  Andrew Burgess  <aburgess@redhat.com>
65618
65619         gdb/python: improve the auto help text for gdb.Parameter
65620         This commit attempts to improve the help text that is generated for
65621         gdb.Parameter objects when the user fails to provide their own
65622         documentation.
65623
65624         Documentation for a gdb.Parameter is currently pulled from two
65625         sources: the class documentation string, and the set_doc/show_doc
65626         class attributes.  Thus, a fully documented parameter might look like
65627         this:
65628
65629           class Param_All (gdb.Parameter):
65630              """This is the class documentation string."""
65631
65632              show_doc = "Show the state of this parameter"
65633              set_doc = "Set the state of this parameter"
65634
65635              def get_set_string (self):
65636                 val = "on"
65637                 if (self.value == False):
65638                    val = "off"
65639                 return "Test Parameter has been set to " + val
65640
65641              def __init__ (self, name):
65642                 super (Param_All, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)
65643                 self._value = True
65644
65645           Param_All ('param-all')
65646
65647         Then in GDB we see this:
65648
65649           (gdb) help set param-all
65650           Set the state of this parameter
65651           This is the class documentation string.
65652
65653         Which is fine.  But, if the user skips both of the documentation parts
65654         like this:
65655
65656           class Param_None (gdb.Parameter):
65657
65658              def get_set_string (self):
65659                 val = "on"
65660                 if (self.value == False):
65661                    val = "off"
65662                 return "Test Parameter has been set to " + val
65663
65664              def __init__ (self, name):
65665                 super (Param_None, self).__init__ (name, gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)
65666                 self._value = True
65667
65668           Param_None ('param-none')
65669
65670         Now in GDB we see this:
65671
65672           (gdb) help set param-none
65673           This command is not documented.
65674           This command is not documented.
65675
65676         That's not great, the duplicated text looks a bit weird.  If we drop
65677         different parts we get different results.  Here's what we get if the
65678         user drops the set_doc and show_doc attributes:
65679
65680           (gdb) help set param-doc
65681           This command is not documented.
65682           This is the class documentation string.
65683
65684         That kind of sucks, we say it's undocumented, then proceed to print
65685         the documentation.  Finally, if we drop the class documentation but
65686         keep the set_doc and show_doc:
65687
65688           (gdb) help set param-set-show
65689           Set the state of this parameter
65690           This command is not documented.
65691
65692         That seems OK.
65693
65694         So, I think there's room for improvement.
65695
65696         With this patch, for the four cases above we now see this:
65697
65698           # All values provided by the user, no change in this case:
65699           (gdb) help set param-all
65700           Set the state of this parameter
65701           This is the class documentation string.
65702
65703           # Nothing provided by the user, the first string is now different:
65704           (gdb) help set param-none
65705           Set the current value of 'param-none'.
65706           This command is not documented.
65707
65708           # Only the class documentation is provided, the first string is
65709           # changed as in the previous case:
65710           (gdb) help set param-doc
65711           Set the current value of 'param-doc'.
65712           This is the class documentation string.
65713
65714           # Only the set_doc and show_doc are provided, this case is unchanged
65715           # from before the patch:
65716           (gdb) help set param-set-show
65717           Set the state of this parameter
65718           This command is not documented.
65719
65720         The one place where this change might be considered a negative is when
65721         dealing with prefix commands.  If we create a prefix command but don't
65722         supply the set_doc / show_doc strings, then this is what we saw before
65723         my patch:
65724
65725           (gdb) python Param_None ('print param-none')
65726           (gdb) help set print
65727           set print, set pr, set p
65728           Generic command for setting how things print.
65729
65730           List of set print subcommands:
65731
65732           ... snip ...
65733           set print param-none -- This command is not documented.
65734           ... snip ...
65735
65736         And after my patch:
65737
65738           (gdb) python Param_None ('print param-none')
65739           (gdb) help set print
65740           set print, set pr, set p
65741           Generic command for setting how things print.
65742
65743           List of set print subcommands:
65744
65745           ... snip ...
65746           set print param-none -- Set the current value of 'print param-none'.
65747           ... snip ...
65748
65749         This seems slightly less helpful than before, but I don't think its
65750         terrible.
65751
65752         Additionally, I've changed what we print when the get_show_string
65753         method is not provided in Python.
65754
65755         Back when gdb.Parameter was first added to GDB, we didn't provide a
65756         show function when registering the internal command object within
65757         GDB.  As a result, GDB would make use of its "magic" mangling of the
65758         show_doc string to create a sentence that would display the current
65759         value (see deprecated_show_value_hack in cli/cli-setshow.c).
65760
65761         However, when we added support for the get_show_string method to
65762         gdb.Parameter, there was an attempt to maintain backward compatibility
65763         by displaying the show_doc string with the current value appended, see
65764         get_show_value in py-param.c.  Unfortunately, this isn't anywhere
65765         close to what deprecated_show_value_hack does, and the results are
65766         pretty poor, for example, this is GDB before my patch:
65767
65768           (gdb) show param-none
65769           This command is not documented. off
65770
65771         I think we can all agree that this is pretty bad.
65772
65773         After my patch, we how show this:
65774
65775           (gdb) show param-none
65776           The current value of 'param-none' is "off".
65777
65778         Which at least is a real sentence, even if it's not very informative.
65779
65780         This patch does change the way that the Python API behaves slightly,
65781         but only in the cases when the user has missed providing GDB with some
65782         information.  In most cases I think the new behaviour is a lot better,
65783         there's the one case (noted above) which is a bit iffy, but I think is
65784         still OK.
65785
65786         I've updated the existing gdb.python/py-parameter.exp test to cover
65787         the modified behaviour.
65788
65789         Finally, I've updated the documentation to (I hope) make it clearer
65790         how the various bits of help text come together.
65791
65792 2022-01-26  Andrew Burgess  <aburgess@redhat.com>
65793
65794         gdb/python: add gdb.history_count function
65795         Add a new function gdb.history_count to the Python api, this function
65796         returns an integer, the number of items in GDB's value history.
65797
65798         This is useful if you want to pull items from the history by their
65799         absolute number, for example, if you wanted to show a complete history
65800         list.  Previously we could figure out how many items are in the
65801         history list by trying to fetch the items, and then catching the
65802         exception when the item is not available, but having this function
65803         seems nicer.
65804
65805 2022-01-26  Tom Tromey  <tromey@adacore.com>
65806
65807         Remove unused declaration
65808         This removes an unused declaration from top.h.  This type is not
65809         defined anywhere.
65810
65811 2022-01-26  Simon Marchi  <simon.marchi@efficios.com>
65812
65813         gdb: convert maintenance target-async and target-non-stop settings to callbacks
65814         This simplifies things a bit, as we don't need two variables and think
65815         about reverting target_async_permitted_1 and target_non_stop_enabled_1
65816         values if we can't change the setting.
65817
65818         Change-Id: I36acab045dacf02ae1988486cfdb27c1dff309f6
65819
65820 2022-01-26  Keith Seitz  <keiths@redhat.com>
65821
65822         Reference array of structs instead of first member during memcpy
65823         aarch64-tdep.c defines the following macro:
65824
65825         #define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
65826                 do  \
65827                   { \
65828                     unsigned int mem_len = LENGTH; \
65829                     if (mem_len) \
65830                       { \
65831                         MEMS =  XNEWVEC (struct aarch64_mem_r, mem_len);  \
65832                         memcpy(&MEMS->len, &RECORD_BUF[0], \
65833                                sizeof(struct aarch64_mem_r) * LENGTH); \
65834                       } \
65835                   } \
65836                   while (0)
65837
65838         This is simlpy allocating a new array and copying it. However, for
65839         the destination address, it is actually copying into the first member
65840         of the first element of the array (`&MEMS->len"). This elicits a
65841         warning with GCC 12:
65842
65843         ../../binutils-gdb/gdb/aarch64-tdep.c: In function ‘int aarch64_process_record(gdbarch*, regcache*, CORE_ADDR)’:
65844         ../../binutils-gdb/gdb/aarch64-tdep.c:3711:23: error: writing 16 bytes into a region of size 8 [-Werror=stringop-overflow=]
65845          3711 |                 memcpy(&MEMS->len, &RECORD_BUF[0], \
65846               |                       ^
65847         ../../binutils-gdb/gdb/aarch64-tdep.c:4394:3: note: in expansion of macro ‘MEM_ALLOC’
65848          4394 |   MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
65849               |   ^~~~~~~~~
65850         ../../binutils-gdb/gdb/aarch64-tdep.c:3721:12: note: destination object ‘aarch64_mem_r::len’ of size 8
65851          3721 |   uint64_t len;    /* Record length.  */
65852               |            ^~~
65853
65854         The simple fix is to reference the array, `MEMS' as the destination of the copy.
65855
65856         Tested by rebuilding.
65857
65858
65859         # Please enter the commit message for your changes. Lines starting
65860         # with '#' will be kept; you may remove them yourself if you want to.
65861         # An empty message aborts the commit.
65862         #
65863         # Date:      Tue Jan 25 08:28:32 2022 -0800
65864         #
65865         # On branch master
65866         # Your branch is ahead of 'origin/master' by 1 commit.
65867         #   (use "git push" to publish your local commits)
65868         #
65869         # Changes to be committed:
65870         #       modified:   aarch64-tdep.c
65871         #
65872
65873 2022-01-26  Simon Marchi  <simon.marchi@polymtl.ca>
65874
65875         gdb: add string_file::release method
65876         A common pattern for string_file is to want to move out the internal
65877         string buffer, because it is the result of the computation that we want
65878         to return.  It is the reason why string_file::string returns a non-const
65879         reference, as explained in the comment.  I think it would make sense to
65880         have a dedicated method for that instead and make string_file::string
65881         return a const reference.
65882
65883         This allows removing the explicit std::move in the typical case.  Note
65884         that compile_program::compute was missing a move, meaning that the
65885         resulting string was copied.  With the new version, it's not possible to
65886         forget to move.
65887
65888         Change-Id: Ieaefa35b73daa7930b2f3a26988b6e3b4121bb79
65889
65890 2022-01-26  Tom Tromey  <tromey@adacore.com>
65891
65892         Add a way to temporarily set a gdb parameter from Python
65893         It's sometimes useful to temporarily set some gdb parameter from
65894         Python.  Now that the 'endian' crash is fixed, and now that the
65895         current language is no longer captured by the Python layer, it seems
65896         reasonable to add a helper function for this situation.
65897
65898         This adds a new gdb.with_parameter function.  This creates a context
65899         manager which temporarily sets some parameter to a specified value.
65900         The old value is restored when the context is exited.  This is most
65901         useful with the Python "with" statement:
65902
65903            with gdb.with_parameter('language', 'ada'):
65904               ... do Ada stuff
65905
65906         This also adds a simple function to set a parameter,
65907         gdb.set_parameter, as suggested by Andrew.
65908
65909         This is PR python/10790.
65910
65911         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=10790
65912
65913 2022-01-26  Tom Tromey  <tromey@adacore.com>
65914
65915         Fix another crash with gdb parameters in Python
65916         While looking into the language-capturing issue, I found another way
65917         to crash gdb using parameters from Python:
65918
65919         (gdb) python print(gdb.parameter('endian'))
65920
65921         (This is related to PR python/12188, though this patch isn't going to
65922         fix what that bug is really about.)
65923
65924         The problem here is that the global variable that underlies the
65925         "endian" parameter is initialized to NULL.  However, that's not a
65926         valid value for an "enum" set/show parameter.
65927
65928         My understanding is that, in gdb, an "enum" parameter's underlying
65929         variable must have a value that is "==" (not just strcmp-equal) to one
65930         of the values coming from the enum array.  This invariant is relied on
65931         in various places.
65932
65933         I started this patch by fixing the problem with "endian".  Then I
65934         added some assertions to add_setshow_enum_cmd to try to catch other
65935         problems of the same type.
65936
65937         This patch fixes all the problems that I found.  I also looked at all
65938         the calls to add_setshow_enum_cmd to ensure that they were all
65939         included in the gdb I tested.  I think they are: there are no calls in
65940         nat-* files, or in remote-sim.c; and I was trying a build with all
65941         targets, Python, and Guile enabled.
65942
65943         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12188
65944
65945 2022-01-26  Tom Tromey  <tromey@adacore.com>
65946
65947         Change how Python architecture and language are handled
65948         Currently, gdb's Python layer captures the current architecture and
65949         language when "entering" Python code.  This has some undesirable
65950         effects, and so this series changes how this is handled.
65951
65952         First, there is code like this:
65953
65954           gdbpy_enter enter_py (python_gdbarch, python_language);
65955
65956         This is incorrect, because both of these are NULL when not otherwise
65957         assigned.  This can cause crashes in some cases -- I've added one to
65958         the test suite.  (Note that this crasher is just an example, other
65959         ones along the same lines are possible.)
65960
65961         Second, when the language is captured in this way, it means that
65962         Python code cannot affect the current language for its own purposes.
65963         It's reasonable to want to write code like this:
65964
65965             gdb.execute('set language mumble')
65966             ... stuff using the current language
65967             gdb.execute('set language previous-value')
65968
65969         However, this won't actually work, because the language is captured on
65970         entry.  I've added a test to show this as well.
65971
65972         This patch changes gdb to try to avoid capturing the current values.
65973         The Python concept of the current gdbarch is only set in those few
65974         cases where a non-default value is computed or needed; and the
65975         language is not captured at all -- instead, in the cases where it's
65976         required, the current language is temporarily changed.
65977
65978 2022-01-26  H.J. Lu  <hjl.tools@gmail.com>
65979
65980         bfd: Make bfd.stamp depend on source bfd.texi
65981         Make bfd.stamp depend on source bfd.texi to avoid regenerating
65982         doc/bfd.info for each make run.
65983
65984                 PR binutils/28807
65985                 * Makefile.in: Regenerate.
65986                 * doc/local.mk (%D%/bfd.stamp): Depend on $(srcdir)/%D%/bfd.texi.
65987
65988 2022-01-26  H.J. Lu  <hjl.tools@gmail.com>
65989
65990         ld: Rewrite lang_size_relro_segment_1
65991         1. Compute the desired PT_GNU_RELRO segment base and find the maximum
65992         section alignment of sections starting from the PT_GNU_RELRO segment.
65993         2. Find the first preceding load section.
65994         3. Don't add the 1-page gap between the first preceding load section and
65995         the relro segment if the maximum page size >= the maximum section
65996         alignment.  Align the PT_GNU_RELRO segment first.  Subtract the maximum
65997         page size if therer is still a 1-page gap.
65998
65999                 PR ld/28743
66000                 PR ld/28819
66001                 * ldlang.c (lang_size_relro_segment_1): Rewrite.
66002                 * testsuite/ld-x86-64/pr28743-1.d: New file.
66003                 * testsuite/ld-x86-64/pr28743-1.s: Likewise.
66004                 * testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.
66005
66006 2022-01-26  Lancelot SIX  <lancelot.six@amd.com>
66007
66008         gdb/testsuite: Ensure constant test name in gdb.base/break-interp.exp
66009         When running the testsuite, I have lines similar to the following in the
66010         gdb.sum file:
66011
66012         ~~~
66013         PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: first backtrace: p /x 0x7f283d2f0fd1
66014         ...
66015         PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: binprelink=NO: binsepdebug=NO: binpie=NO: INNER: first backtrace: p /x 0x7f00de0317a5
66016         ...
66017         ~~~
66018
66019         The address part of the command might change between execution of the
66020         test, which adds noise to a diff between two .sum files.
66021
66022         This patch changes to test name to "p /x $pc" in order to have constant
66023         test name.
66024
66025         Tested on x86_64-Linux.
66026
66027         Change-Id: I973c1237a084dd6d424276443cbf0920533c9a21
66028
66029 2022-01-26  GDB Administrator  <gdbadmin@sourceware.org>
66030
66031         Automatic date update in version.in
66032
66033 2022-01-25  Tom Tromey  <tom@tromey.com>
66034
66035         Always print the "host libthread-db" message to stdout
66036         linux-thread-db.c has a bit of unusual code that unconditionally
66037         prints a message, but decides whether to print to gdb_stdout or
66038         gdb_stdlog based on a debug flag.  It seems better to me to simply
66039         always print this; and this is the only spot in gdb where we
66040         conditionally pass gdb_stdout to one of the f*_unfiltered functions.
66041
66042 2022-01-25  Tom Tromey  <tom@tromey.com>
66043
66044         Reduce explicit use of gdb_stdout
66045         In an earlier version of the pager rewrite series, it was important to
66046         audit unfiltered output calls to see which were truly necessary.
66047
66048         This is no longer necessary, but it still seems like a decent cleanup
66049         to change calls to avoid explicitly passing gdb_stdout.  That is,
66050         rather than using something like fprintf_unfiltered with gdb_stdout,
66051         the code ought to use plain printf_unfiltered instead.
66052
66053         This patch makes this change.  I went ahead and converted all the
66054         _filtered calls I could find, as well, for the same clarity.
66055
66056 2022-01-25  Tom Tromey  <tom@tromey.com>
66057
66058         Sent timing stats to gdb_stdlog
66059         This changes the time / space / symtab per-command statistics code to
66060         send its output to gdb_stdlog rather than gdb_stdout.  This seems
66061         slightly more correct to me.
66062
66063         Send some error output to gdb_stderr
66064         This changes some code to send some error messages to gdb_stderr
66065         rather than gdb_stdout.
66066
66067 2022-01-25  Klaus Ziegler  <klausz@haus-gisela.de>
66068
66069         Fix a probem building the binutils on SPARC/amd64
66070                 PR 28816
66071                 * elf/common.h (AT_SUN_HWCAP): Make definition conditional.
66072
66073 2022-01-25  H.J. Lu  <hjl.tools@gmail.com>
66074
66075         bfd: Regenerate Makefile.in
66076                 * Makefile.in: Regenerate.
66077
66078 2022-01-25  Mike Frysinger  <vapier@gentoo.org>
66079
66080         gold: drop old cygnus install hack
66081         The gold subdir doesn't actually have a manual, so this hack doesn't
66082         do anything.  Plus the automake cygnus option was removed years ago
66083         by Simon in d0ac1c44885daf68f631befa37e ("Bump to autoconf 2.69 and
66084         automake 1.15.1").  So delete it here.
66085
66086         gas: drop old cygnus install hack
66087         This was needed when gas was using the automake cygnus option, but
66088         this was removed years ago by Simon in d0ac1c44885daf68f631befa37e
66089         ("Bump to autoconf 2.69 and automake 1.15.1").  So delete it here.
66090         The info pages are already & still installed by default w/out it.
66091
66092 2022-01-25  GDB Administrator  <gdbadmin@sourceware.org>
66093
66094         Automatic date update in version.in
66095
66096 2022-01-24  H.J. Lu  <hjl.tools@gmail.com>
66097
66098         bfd: Update doc/local.mk
66099                 PR binutils/28807
66100                 * Makefile.in: Regenerate.
66101                 * doc/local.mk (AM_MAKEINFOFLAGS): Add -I "$(srcdir)/%D%" -I %D%.
66102                 (TEXI2DVI): New.
66103                 (%D%/bfd.texi): Removed.
66104                 (doc/bfd/index.html): Remove -I$(srcdir).  Replace bfd.texi with
66105                 %D%/bfd.texi.
66106
66107 2022-01-24  Roland McGrath  <mcgrathr@google.com>
66108
66109         bfd/doc: Fix racy build failure from missing mkdir
66110         bfd/
66111                 * doc/local.mk (%D%/bfdver.texi): Add mkdir command.
66112
66113 2022-01-24  Martin Sebor  <msebor@redhat.com>
66114
66115         Fix a proble building the libiberty library with gcc-12.
66116                 PR 28779
66117                 * regex.c: Suppress -Wuse-after-free.
66118
66119 2022-01-24  Andrew Burgess  <aburgess@redhat.com>
66120
66121         gdb/doc: improve description for Window.click on Python TUI windows
66122         The description of the Window.click method doesn't mention where the
66123         coordinates are anchored (it's the top left corner).
66124
66125         This minor tweak just mentions this point.
66126
66127 2022-01-24  Nick Clifton  <nickc@redhat.com>
66128
66129         Update Bulgarian, French, Romaniam and Ukranian translation for some of the sub-directories
66130
66131 2022-01-24  GDB Administrator  <gdbadmin@sourceware.org>
66132
66133         Automatic date update in version.in
66134
66135 2022-01-23  Tom Tromey  <tom@tromey.com>
66136
66137         Simplify some Rust expression-evaluation code
66138         A few Rust operations do a bit of work in their 'evaluate' functions
66139         and then call another function -- but are also the only caller.  This
66140         patch simplifies this code by removing the extra layer.
66141
66142         Tested on x86-64 Fedora 34.  I'm checking this in.
66143
66144 2022-01-23  H.J. Lu  <hjl.tools@gmail.com>
66145
66146         bfd: Partially revert commit 0e3839bde6f
66147         Partially revert
66148
66149         commit 0e3839bde6f93e1e3eefce815be3636e3d81054d
66150         Author: H.J. Lu <hjl.tools@gmail.com>
66151         Date:   Sun Jan 23 07:29:27 2022 -0800
66152
66153             bfd: Properly install library and header files
66154
66155                 PR binutils/28807
66156                 * Makefile.am: Revert bfdlib_LTLIBRARIES and bfdinclude_HEADERS
66157                 changes.
66158                 * Makefile.in: Regenerate.
66159
66160 2022-01-23  H.J. Lu  <hjl.tools@gmail.com>
66161
66162         bfd: Properly install library and header files
66163         Rename bfdlib_LTLIBRARIES and bfdinclude_HEADERS to lib_LTLIBRARIES and
66164         include_HEADERS to fix the missing installed library and header files in
66165         bfd caused by
66166
66167         commit bd32be01c997f686ab0b53f0640eaa0aeb61fbd3
66168         Author: Mike Frysinger <vapier@gentoo.org>
66169         Date:   Fri Dec 3 00:23:20 2021 -0500
66170
66171             bfd: merge doc subdir up a level
66172
66173                 PR binutils/28807
66174                 * Makefile.am (bfdlib_LTLIBRARIES): Renamed to ...
66175                 (lib_LTLIBRARIES): This.
66176                 (bfdinclude_HEADERS): Renamed to ...
66177                 (include_HEADERS): This.
66178                 * Makefile.in: Regenerate.
66179                 * doc/local.mk (install): Removed.
66180
66181 2022-01-23  H.J. Lu  <hjl.tools@gmail.com>
66182
66183         Regenerate Makefile.in files with automake 1.15.1
66184         Regenerate Makefile.in files with the unmodified automake 1.15.1 to
66185         remove
66186
66187         runstatedir = @runstatedir@
66188
66189         bfd/
66190
66191                 * Makefile.in: Regenerate.
66192
66193         binutils/
66194
66195                 * Makefile.in: Regenerate.
66196
66197         gas/
66198
66199                 * Makefile.in: Regenerate.
66200
66201         gold/
66202
66203                 * Makefile.in: Regenerate.
66204                 * testsuite/Makefile.in: Likewise.
66205
66206         gprof/
66207
66208                 * Makefile.in: Regenerate.
66209
66210         ld/
66211
66212                 * Makefile.in: Regenerate.
66213
66214         opcodes/
66215
66216                 * Makefile.in: Regenerate.
66217
66218 2022-01-23  H.J. Lu  <hjl.tools@gmail.com>
66219
66220         Regenerate configure files with autoconf 2.69
66221         Regenerate configure files with the unmodified autoconf 2.69 to remove
66222
66223           --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
66224
66225         bfd/
66226
66227                 * configure: Regenerate.
66228
66229         binutils/
66230
66231                 * configure: Regenerate.
66232
66233         gas/
66234
66235                 * configure: Regenerate.
66236
66237         gold/
66238
66239                 * configure: Regenerate.
66240
66241         gprof/
66242
66243                 * configure: Regenerate.
66244
66245         ld/
66246
66247                 * configure: Regenerate.
66248
66249         opcodes/
66250
66251                 * configure: Regenerate.
66252
66253 2022-01-23  GDB Administrator  <gdbadmin@sourceware.org>
66254
66255         Automatic date update in version.in
66256
66257 2022-01-22  Mike Frysinger  <vapier@gentoo.org>
66258
66259         bfd: merge doc subdir up a level
66260         This avoids a recursive make into the doc subdir and speeds up the
66261         build slightly.  It also allows for more parallelism.
66262
66263         bfd: rename core.texi to corefile.texi
66264         This is a generated file name from a correspondingly named C file.
66265         Rename it to avoid unique build rules since there's no difference
66266         to the generated manual.
66267
66268         bfd: replace doc header generation with pattern rules
66269         This unifies boilerplate rules for most files with pattern rules.
66270
66271 2022-01-22  Martin Storsj?  <martin@martin.st>
66272
66273         Allow inferring tmp_prefix from the dll name from a def file.
66274
66275 2022-01-22  Alexander von Gluck IV  <kallisti5@unixzen.com>
66276
66277         Adjust default page sizes for haiku arm.
66278                 * configure.tgt (arm-haiku): Fix typo.
66279                 * emulparams/armelf_haiku.su (MAXPAGESIZE): Use the default value.
66280                 (COMMONPAGESIZE): Likewise.
66281
66282 2022-01-22  Nick Clifton  <nickc@redhat.com>
66283
66284         Update release makeing script with new release numbers
66285
66286         Change version number to 2.38.50 and regenerate files
66287
66288         Add markers for 2.38 branch
66289
66290 2022-01-22  Lifang Xia  <lifang_xia@linux.alibaba.com>
66291
66292         RISC-V: create new frag after alignment.
66293         PR 28793:
66294
66295         The alignment may be removed in linker. We need to create new frag after
66296         alignment to prevent the assembler from computing static offsets.
66297
66298         gas/
66299                 * config/tc-riscv.c (riscv_frag_align_code): Create new frag.
66300
66301 2022-01-22  GDB Administrator  <gdbadmin@sourceware.org>
66302
66303         Automatic date update in version.in
66304
66305 2022-01-21  Simon Marchi  <simon.marchi@polymtl.ca>
66306
66307         gdb: include gdbsupport/buildargv.h in ser-mingw.c
66308         Fixes:
66309
66310               CXX    ser-mingw.o
66311             /home/simark/src/binutils-gdb/gdb/ser-mingw.c: In function ‘int pipe_windows_open(serial*, const char*)’:
66312             /home/simark/src/binutils-gdb/gdb/ser-mingw.c:870:3: error: ‘gdb_argv’ was not declared in this scope
66313               870 |   gdb_argv argv (name);
66314                   |   ^~~~~~~~
66315
66316         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28802
66317         Change-Id: I7f3e8ec5f9ca8582d587545fdf6b69901259f199
66318
66319 2022-01-21  Nick Clifton  <nickc@redhat.com>
66320
66321         Updated Serbian translation for the ld sub-directory
66322
66323 2022-01-21  Andrew Burgess  <aburgess@redhat.com>
66324
66325         gdb/doc: fill in two missing @r
66326         I noticed two places in the docs where we appear to be missing @r.
66327         makeinfo seems to do the correct things despite these being
66328         missing (at least, I couldn't see any difference in the pdf or info
66329         output), but it doesn't hurt to have the @r in place.
66330
66331 2022-01-21  Mike Frysinger  <vapier@gentoo.org>
66332
66333         drop old unused stamp-h.in file
66334         This was needed by ancient versions of automake, but that hasn't been
66335         the case since at least automake-1.5, so punt this from the tree.
66336
66337 2022-01-21  Simon Marchi  <simon.marchi@polymtl.ca>
66338
66339         gdbsupport/gdb_regex.cc: replace defs.h include with common-defs.h
66340         This was forgotten when gdb_regex was moved from gdb to gdbsupport.
66341
66342         Change-Id: I73b446f71861cabbf7afdb7408ef9d59fa64b804
66343
66344 2022-01-21  GDB Administrator  <gdbadmin@sourceware.org>
66345
66346         Automatic date update in version.in
66347
66348 2022-01-20  Tom Tromey  <tromey@adacore.com>
66349
66350         Avoid bad breakpoints with --gc-sections
66351         We found a case where --gc-sections can cause gdb to set an invalid
66352         breakpoint.  In the included test case, gdb will set a breakpoint with
66353         two locations, one of which is 0x0.
66354
66355         The code in lnp_state_machine::check_line_address is intended to
66356         filter out this sort of problem, but in this case, the entire CU is
66357         empty, causing unrelocated_lowpc==0x0 -- which circumvents the check.
66358
66359         It seems to me that if a CU is empty like this, then it is ok to
66360         simply ignore the line table, as there won't be any locations anyway.
66361
66362 2022-01-20  GDB Administrator  <gdbadmin@sourceware.org>
66363
66364         Automatic date update in version.in
66365
66366 2022-01-19  Maciej W. Rozycki  <macro@embecosm.com>
66367
66368         Add `set print array-indexes' tests for C/C++ arrays
66369         Add `set print array-indexes' tests for C/C++ arrays, complementing one
66370         for Fortran arrays.
66371
66372 2022-01-19  Maciej W. Rozycki  <macro@embecosm.com>
66373
66374         Respect `set print array-indexes' with Fortran arrays
66375         Add `set print array-indexes' handling for Fortran arrays.  Currently
66376         the setting is ignored and indices are never shown.
66377
66378         Keep track of the most recent index handled so that any outstanding
66379         repeated elements printed when the limit set by `set print elements' is
66380         hit have the correct index shown.
66381
66382         Output now looks like:
66383
66384         (gdb) set print array-indexes on
66385         (gdb) print array_1d
66386         $1 = ((-2) = 1, (-1) = 1, (0) = 1, (1) = 1, (2) = 1)
66387         (gdb) set print repeats 4
66388         (gdb) set print elements 12
66389         (gdb) print array_2d
66390         $2 = ((-2) = ((-2) = 2, <repeats 5 times>) (-1) = ((-2) = 2, <repeats 5 times>) (0) = ((-2) = 2, (-1) = 2, ...) ...)
66391         (gdb)
66392
66393         for a 5-element vector and a 5 by 5 array filled with the value of 2.
66394
66395 2022-01-19  Maciej W. Rozycki  <macro@embecosm.com>
66396
66397         Add `set print repeats' tests for C/C++ arrays
66398         Add `set print repeats' tests for C/C++ arrays, complementing one for
66399         Fortran arrays and covering the different interpretation of the `set
66400         print elements' setting in particular where the per-dimension count of
66401         the elements handled is matched against the trigger rather than the
66402         total element count as with Fortran arrays.
66403
66404 2022-01-19  Maciej W. Rozycki  <macro@embecosm.com>
66405
66406         Respect `set print repeats' with Fortran arrays
66407         Implement `set print repeats' handling for Fortran arrays.  Currently
66408         the setting is ignored and always treated as if no limit was set.
66409
66410         Unlike the generic array walker implemented decades ago the Fortran one
66411         is a proper C++ class.  Rather than trying to mimic the old walker then,
66412         which turned out a bit of a challenge where interacting with the `set
66413         print elements' setting, write it entirely from scratch, by adding an
66414         extra specialization handler method for processing dimensions other than
66415         the innermost one and letting the specialization class call the `walk_1'
66416         method from the handler as it sees fit.  This way repeats can be tracked
66417         and the next inner dimension recursed into as a need arises only, or
66418         unconditionally in the base class.
66419
66420         Keep track of the dimension number being handled in the class rather as
66421         a parameter to the walker so that it does not have to be passed across
66422         by the specialization class.
66423
66424         Use per-dimension element count tracking, needed to terminate processing
66425         early when the limit set by `set print elements' is hit.  This requires
66426         extra care too where the limit triggers exactly where another element
66427         that is a subarray begins.  In that case rather than recursing we need
66428         to terminate processing or lone `(...)' would be printed.  Additionally
66429         if the skipped element is the last one in the current dimension we need
66430         to print `...' by hand, because `continue_walking' won't print it at the
66431         upper level, because it can see the last element has already been taken
66432         care of.
66433
66434         Preserve the existing semantics of `set print elements' where the total
66435         count of the elements handled is matched against the trigger level which
66436         is unlike with the C/C++ array printer where the per-dimension element
66437         count is used instead.
66438
66439         Output now looks like:
66440
66441         (gdb) set print repeats 4
66442         (gdb) print array_2d
66443         $1 = ((2, <repeats 5 times>) <repeats 5 times>)
66444         (gdb) set print elements 12
66445         (gdb) print array_2d
66446         $2 = ((2, <repeats 5 times>) (2, <repeats 5 times>) (2, 2, ...) ...)
66447         (gdb)
66448
66449         for a 5 by 5 array filled with the value of 2.
66450
66451         Amend existing test cases accordingly that rely on the current incorrect
66452         behavior and explicitly request that there be no limit for printing
66453         repeated elements there.
66454
66455         Add suitable test cases as well covering sliced arrays in particular.
66456
66457         Co-Authored-By: Andrew Burgess <andrew.burgess@embecosm.com>
66458
66459 2022-01-19  John Baldwin  <jhb@FreeBSD.org>
66460
66461         fbsd-nat: Add include for gdb_argv.
66462
66463 2022-01-19  Alan Modra  <amodra@gmail.com>
66464
66465         PowerPC64 DT_RELR ELFv1
66466         More fun with R_PPC64_NONE found in .opd.  Fixed by the
66467         allocate_dynrelocs and ppc64_elf_size_dynamic_sections changes, and
66468         since we are doing ifunc, opd and SYMBOL_REFERENCES_LOCAL tests later,
66469         don't duplicate that work in check_relocs.
66470
66471                 * elf64-ppc.c (ppc64_elf_check_relocs): Remove opd and ifunc
66472                 conditions for rel_count.
66473                 (dec_dynrel_count): Likewise.
66474                 (allocate_dynrelocs): Test for opd and ifunc when allocating
66475                 relative relocs.
66476                 (ppc64_elf_size_dynamic_sections): Likewise.
66477
66478 2022-01-19  Alan Modra  <amodra@gmail.com>
66479
66480         PowerPC64 DT_RELR local PLT
66481         Similarly to the local GOT case.
66482
66483                 * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
66484                 space for PLT relocs against local syms when enable_dt_relr.
66485
66486 2022-01-19  Alan Modra  <amodra@gmail.com>
66487
66488         PowerPC64 DT_RELR local GOT
66489         Fixes another case where we end up with superfluous R_PPC64_NONE.
66490
66491                 * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
66492                 space for GOT relocs against non-TLS local syms when enable_dt_relr.
66493                 (ppc64_elf_layout_multitoc): Likewise.
66494
66495 2022-01-19  GDB Administrator  <gdbadmin@sourceware.org>
66496
66497         Automatic date update in version.in
66498
66499 2022-01-18  Alan Modra  <amodra@gmail.com>
66500
66501         Re: PowerPC64 DT_RELR
66502         HJ: "There are 238 R_PPC64_NONEs in libc.so.6 alone."
66503         Indeed, let's make them go away.  I had the SYMBOL_REFERENCES_LOCAL
66504         test in the wrong place.  check_relocs is too early to know whether a
66505         symbol is dynamic in a shared library.  Lots of glibc symbols are made
66506         local by version script, but that doesn't happen until
66507         size_dynamic_sections.
66508
66509                 * elf64-ppc.c (ppc64_elf_check_relocs): Don't count relative relocs
66510                 here depending on SYMBOL_REFERENCES_LOCAL.
66511                 (dec_dynrel_count): Likewise.
66512                 (allocate_dynrelocs): Do so here instead.
66513
66514 2022-01-18  Tom Tromey  <tom@tromey.com>
66515
66516         Fix the remote-sim.c build
66517         My earlier patch to move gdb_argv broke the remote-sim.c build.  This
66518         patch fixes the bug.  I'm checking it in.
66519
66520 2022-01-18  Simon Marchi  <simon.marchi@polymtl.ca>
66521
66522         gdbserver: introduce remote_debug_printf
66523         Add remote_debug_printf, and use it for all debug messages controlled by
66524         remote_debug.
66525
66526         Change remote_debug to be a bool, which is trivial in this case.
66527
66528         Change-Id: I90de13cb892faec3830047b571661822b126d6e8
66529
66530 2022-01-18  Simon Marchi  <simon.marchi@polymtl.ca>
66531
66532         gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXIT
66533         Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which
66534         use the logging infrastructure from gdbsupport/common-debug.h.  Replace
66535         all debug_print uses that are predicated by debug_threads with
66536         threads_dethreads_debug_printf.  Replace uses of the debug_enter and
66537         debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves
66538         essentially the same purpose, but allows showing what comes between the
66539         enter and the exit in an indented form.
66540
66541         Note that "threads" debug is currently used for a bit of everything in
66542         GDBserver, not only threads related stuff.  It should ideally be cleaned
66543         up and separated logically as is done in GDB, but that's out of the
66544         scope of this patch.
66545
66546         Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a
66547
66548 2022-01-18  Simon Marchi  <simon.marchi@polymtl.ca>
66549
66550         gdbserver: turn debug_threads into a boolean
66551         debug_threads is always used as a boolean.  Except in ax.cc and
66552         tracepoint.cc.  These files have their own macros that use
66553         debug_threads, and have a concept of verbosity level.  But they both
66554         have a single level, so it's just a boolean in the end.
66555
66556         Remove this concept of level.  If we ever want to re-introduce it, I
66557         think it will be better implemented in a more common location.
66558
66559         Change debug_threads to bool and adjust some users that were treating it
66560         as an int.
66561
66562         Change-Id: I137f596eaf763a08c977dd74417969cedfee9ecf
66563
66564 2022-01-18  Tom Tromey  <tom@tromey.com>
66565
66566         Simplify Ada catchpoints
66567         All the Ada catchpoints use the same breakpoint_ops contents, because
66568         the catchpoint itself records its kind.  This patch simplifies the
66569         code by removing the redundant ops structures.
66570
66571         Move "catch exec" to a new file
66572         The "catch exec" code is reasonably self-contained, and so this patch
66573         moves it out of breakpoint.c (the second largest source file in gdb)
66574         and into a new file, break-catch-exec.c.
66575
66576         Move "catch fork" to a new file
66577         The "catch fork" code is reasonably self-contained, and so this patch
66578         moves it out of breakpoint.c (the second largest source file in gdb)
66579         and into a new file, break-catch-fork.c.
66580
66581         Unify "catch fork" and "catch vfork"
66582         I noticed that "catch fork" and "catch vfork" are nearly identical.
66583         This patch simplifies the code by unifying these two cases.
66584
66585         Move gdb_regex to gdbsupport
66586         This moves the gdb_regex convenience class to gdbsupport.
66587
66588         Introduce gdb-hashtab module in gdbsupport
66589         gdb has some extensions and helpers for working with the libiberty
66590         hash table.  This patch consolidates these and moves them to
66591         gdbsupport.
66592
66593         Move gdb obstack code to gdbsupport
66594         This moves the gdb-specific obstack code -- both extensions like
66595         obconcat and obstack_strdup, and things like auto_obstack -- to
66596         gdbsupport.
66597
66598         Move gdb_argv to gdbsupport
66599         This moves the gdb_argv class to a new header in gdbsupport.
66600
66601         Simplify event_location_probe
66602         event_location_probe currently stores two strings, but really only
66603         needs one.  This patch simplifies it and removes some unnecessary
66604         copies as well.
66605
66606         Use std::string in event_location
66607         This changes event_location to use std::string, removing some manual
66608         memory management, and an unnecessary string copy.
66609
66610         Split event_location into subclasses
66611         event_location uses the old C-style discriminated union approach.
66612         However, it's better to use subclassing, as this makes the code
66613         clearer and removes some chances for error.  This also enables future
66614         cleanups to avoid manual memory management and copies.
66615
66616         Remove EL_* macros from location.c
66617         This patch removes the old-style EL_* macros from location.c.  This
66618         cleans up the code by itself, IMO, but also enables further cleanups
66619         in subsequent patches.
66620
66621         Boolify explicit_to_string_internal
66622         This changes explicit_to_string_internal to use 'bool' rather than
66623         'int'.
66624
66625         Remove a use of xfree in location.c
66626         This small cleanup removes a use of xfree from location.c, by
66627         switching to unique_xmalloc_ptr.  One function is only used in
66628         location.c, so it is made static.  And, another function is changed to
66629         avoid a copy.
66630
66631 2022-01-18  Simon Marchi  <simon.marchi@polymtl.ca>
66632
66633         gdb: use ptid_t::to_string instead of target_pid_to_str in debug statements
66634         Same idea as 0fab79556484 ("gdb: use ptid_t::to_string in infrun debug
66635         messages"), but throughout GDB.
66636
66637         Change-Id: I62ba36eaef29935316d7187b9b13d7b88491acc1
66638
66639 2022-01-18  Andrew Burgess  <aburgess@redhat.com>
66640
66641         gdb: preserve `|` in connection details string
66642         Consider this GDB session:
66643
66644           $ gdb -q
66645           (gdb) target remote  | gdbserver - ~/tmp/hello.x
66646           Remote debugging using | gdbserver - ~/tmp/hello.x
66647           ... snip ...
66648           (gdb) info connections
66649             Num  What                              Description
66650           * 1    remote gdbserver - ~/tmp/hello.x  Remote target using gdb-specific protocol
66651           (gdb) python conn = gdb.selected_inferior().connection
66652           (gdb) python print(conn.details)
66653           gdbserver - ~/tmp/hello.x
66654           (gdb)
66655
66656         I think there are two things wrong here, first in the "What" column of
66657         the 'info connections' output, I think the text should be:
66658
66659           remote | gdbserver - ~/tmp/hello.x
66660
66661         to correctly show the user how the connection was established.  And in
66662         a similar fashion, I think that the `details` string of the
66663         gdb.TargetConnection object should be:
66664
66665           | gdbserver - ~/tmp/hello.x
66666
66667         This commit makes this change.  Currently the '|' is detected and
66668         removed in gdb/serial.c.  The string passed to the pipe_ops
66669         structure (from gdb/ser-pipe.c), doesn't then, contain the `|`, this
66670         is instead implied by the fact that it is a pipes based implementation
66671         of the serial_ops interface.
66672
66673         After this commit we still detect the `|` in gdb/serial.c, but we now
66674         store the full string (including the `|`) in the serial::name member
66675         variable.
66676
66677         For pipe based serial connections, this name is only used for
66678         displaying the two fields I mention above, and in pipe_open (from
66679         gdb/ser-pipe.c), and in pipe_open, we now know to skip over the `|`.
66680
66681         The benefit I see from this change is that GDB's output now more
66682         accurately reflects the commands used to start a target, thus making
66683         it easier for a user to understand what is going on.
66684
66685 2022-01-18  Tiezhu Yang  <yangtiezhu@loongson.cn>
66686
66687         gdb: testsuite: print explicit test result for gdb.base/dfp-test.exp
66688         In the current code, if decimal floating point is not supported for
66689         this target, there is no binary file dfp-test, and also there is no
66690         test result after execute the following commands:
66691
66692           $ make check-gdb TESTS="gdb.base/dfp-test.exp"
66693           $ grep error gdb/testsuite/gdb.log
66694           /home/loongson/gdb.git/gdb/testsuite/gdb.base/dfp-test.c:39:1: error: decimal floating point not supported for this target
66695           [...]
66696           $ cat gdb/testsuite/gdb.sum
66697           [...]
66698           Running target unix
66699           Running /home/loongson/gdb.git/gdb/testsuite/gdb.base/dfp-test.exp ...
66700
66701                           === gdb Summary ===
66702           [...]
66703
66704         With this patch:
66705
66706           $ make check-gdb TESTS="gdb.base/dfp-test.exp"
66707           $ cat gdb/testsuite/gdb.sum
66708           [...]
66709           Running target unix
66710           Running /home/loongson/gdb.git/gdb/testsuite/gdb.base/dfp-test.exp ...
66711           UNSUPPORTED: gdb.base/dfp-test.exp: decimal floating point not supported for this target.
66712
66713                           === gdb Summary ===
66714
66715           # of unsupported tests                1
66716           [...]
66717
66718 2022-01-18  Simon Marchi  <simon.marchi@efficios.com>
66719
66720         bfd/elf64-ppc.c: fix clang -Wbitwise-instead-of-logical warning in ppc64_elf_check_init_fini
66721         I see this error with clang-14:
66722
66723               CC       elf64-ppc.lo
66724             /home/smarchi/src/binutils-gdb/bfd/elf64-ppc.c:13131:11: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
66725               return (check_pasted_section (info, ".init")
66726                      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66727
66728         Fix by replacing & with &&.  But given that the check_pasted_section
66729         function has side-effects and we want to make sure both calls are made,
66730         assign to temporary variables before evaluating the `&&`.
66731
66732         Change-Id: I849e1b2401bea5f4d8ef3ab9af99ba9e3ef42490
66733
66734 2022-01-18  Alan Modra  <amodra@gmail.com>
66735
66736         PR28029, debuginfod tests
66737         binutils/NEWS says of the change in --process-links semantics:
66738           If other debug section display options are also enabled (eg
66739           --debug-dump=info) then the contents of matching sections in both the main
66740           file and the separate debuginfo file *will* be displayed.  This is because in
66741           most cases the debug section will only be present in one of the files.
66742
66743         Implying that debug info is dumped without --process-links.  Indeed
66744         that appears to be the case for readelf.  This does the same for
66745         objdump.
66746
66747                 PR 28029
66748                 * objdump.c (dump_bfd): Do not exit early when !is_mainfile
66749                 && !processlinks, instead just exclude non-debug output.
66750                 (dump_dwarf): Add is_mainfile parameter and pass to
66751                 dump_dwarf_section.
66752                 (dump_dwarf_section): Only display debug sections when
66753                 !is_mainfile and !process_links.
66754
66755 2022-01-18  Alan Modra  <amodra@gmail.com>
66756
66757         Check thin archive element file size against archive header
66758         Makes it a little less likely for someone to break their thin archives.
66759
66760                 * archive.c (_bfd_get_elt_at_filepos): Check thin archive
66761                 element file size.
66762
66763 2022-01-18  Alan Modra  <amodra@gmail.com>
66764
66765         lang_size_relro_segment tidy
66766         This function has seen too many minimal change style edits.
66767         No functional changes in this patch.
66768
66769                 * ldlang.c (lang_size_relro_segment): Tidy.
66770
66771 2022-01-18  Alan Modra  <amodra@gmail.com>
66772
66773         PowerPC64 DT_RELR
66774         PowerPC64 takes a more traditional approach to DT_RELR than x86.  Count
66775         relative relocs in check_relocs, allocate space for them and output in
66776         the usual places but not doing so when enable_dt_relr.  DT_RELR is
66777         sized in the existing ppc stub relaxation machinery, run via the
66778         linker's ldemul_after_allocation hook.  DT_RELR is output in the same
66779         function that writes ppc stubs, run via ldemul_finish.
66780
66781         This support should be considered experimental.
66782
66783         bfd/
66784                 * elf64-ppc.c (struct ppc_local_dyn_relocs): Renamed from
66785                 ppc_dyn_relocs.  Add rel_count field.  Update uses.
66786                 (struct ppc_dyn_relocs): New.  Replace all uses of elf_dyn_relocs.
66787                 (struct ppc_link_hash_table): Add relr_alloc, relr_count and
66788                 relr_addr.
66789                 (ppc64_elf_copy_indirect_symbol): Merge rel_count.
66790                 (ppc64_elf_check_relocs): Init rel_count for global and local syms.
66791                 (dec_dynrel_count): Change r_info param to reloc pointer.  Update
66792                 all callers.  Handle decrementing rel_count.
66793                 (allocate_got): Don't allocate space for relative relocs when
66794                 enable_dt_relr.
66795                 (allocate_dynrelocs): Likewise.
66796                 (ppc64_elf_size_dynamic_sections): Likewise.  Handle srelrdyn.
66797                 (ppc_build_one_stub): Don't emit relative relocs on .branch_lt.
66798                 (compare_relr_address, append_relr_off): New functions.
66799                 (got_and_plt_relr_for_local_syms, got_and_plt_relr): Likewise.
66800                 (ppc64_elf_size_stubs): Size .relr.syn.
66801                 (ppc64_elf_build_stubs): Emit .relr.dyn.
66802                 (build_global_entry_stubs_and_plt): Don't output relative relocs
66803                 when enable_dt_relr.
66804                 (write_plt_relocs_for_local_syms): Likewise.
66805                 (ppc64_elf_relocate_section): Likewise.
66806         binutils/
66807                 * testsuite/lib/binutils-common.exp (supports_dt_relr): Add
66808                 powerpc64.
66809         ld/
66810                 * emulparams/elf64ppc.sh: Source dt-relr.sh.
66811                 * testsuite/ld-elf/dt-relr-2b.d: Adjust for powerpc.
66812                 * testsuite/ld-elf/dt-relr-2c.d: Likewise.
66813                 * testsuite/ld-elf/dt-relr-2d.d: Likewise.
66814                 * testsuite/ld-elf/dt-relr-2e.d: Likewise.
66815
66816 2022-01-18  Alan Modra  <amodra@gmail.com>
66817
66818         tweak __ehdr_start visibility and flags for check_relocs
66819         bfd/
66820                 * elf-bfd.h (UNDEFWEAK_NO_DYNAMIC_RELOC): Test linker_def.
66821         ld/
66822                 * ldelf.c (ldelf_before_allocation): Don't force __ehdr_start
66823                 local and hidden here..
66824                 * ldlang.c (lang_symbol_tweaks): ..do so here instead and set
66825                 def_regular and linker_def for check_relocs.  New function
66826                 extracted from lang_process.
66827
66828 2022-01-18  GDB Administrator  <gdbadmin@sourceware.org>
66829
66830         Automatic date update in version.in
66831
66832 2022-01-17  Nick Clifton  <nickc@redhat.com>
66833
66834         Update the config.guess and config.sub files from the master repository and regenerate files.
66835
66836 2022-01-17  Sergey Belyashov  <sergey.belyashov@gmail.com>
66837
66838         Fix Z80 assembly failure.
66839                 PR 28762
66840                 * app.c (do_scrub_chars): Correct handling when the symbol is not 'af'.
66841
66842 2022-01-17  Simon Marchi  <simon.marchi@polymtl.ca>
66843
66844         gdb/infrun: rename variable and move to more specific scope
66845         Move the "started" variable to the scope it's needed, and rename it to
66846         "step_over_started".
66847
66848         Change-Id: I56f3384dbd328f55198063bb855edda10f1492a3
66849
66850 2022-01-17  Jan Beulich  <jbeulich@suse.com>
66851
66852         x86: adjust struct instr_info field types
66853         Now that this lives on the stack, let's have it be a little less
66854         wasteful in terms of space. Switch boolean fields to "bool" (also when
66855         this doesn't change their size) and also limit the widths of "rex",
66856         "rex_used", "op_ad", and "op_index". Do a little bit of re-ordering as
66857         well to limit the number of padding holes.
66858
66859         x86: drop index16 field
66860         There's a single use on a generally infrequently taken code path. Put
66861         the necessary conditional there instead.
66862
66863         x86: drop most Intel syntax register name arrays
66864         By making use of, in particular, oappend_maybe_intel() there's no need
66865         for this redundant set of static data.
66866
66867         x86: fold variables in memory operand index handling
66868         There's no real need for the pseudo-boolean "haveindex" or for separate
66869         32-bit / 64-bit index pointers. Fold them into a single "indexes" and
66870         set that uniformly to AT&T names, compensating by emitting the register
66871         name via oappend_maybe_intel().
66872
66873         x86: constify disassembler static data
66874         Now that the code is intended to be largely thread-safe, we'd better not
66875         have any writable static objects.
66876
66877 2022-01-17  GDB Administrator  <gdbadmin@sourceware.org>
66878
66879         Automatic date update in version.in
66880
66881 2022-01-16  Joel Brobecker  <brobecker@adacore.com>
66882
66883         gdb/copyright.py: Do not update gdbsupport/Makefile.in
66884         This file is generated, so we should not modify it (any modification
66885         we make is going to be undone at the next re-generation anyway).
66886
66887 2022-01-16  GDB Administrator  <gdbadmin@sourceware.org>
66888
66889         Automatic date update in version.in
66890
66891 2022-01-15  GDB Administrator  <gdbadmin@sourceware.org>
66892
66893         Automatic date update in version.in
66894
66895 2022-01-14  Simon Marchi  <simon.marchi@efficios.com>
66896
66897         gdb.dlang/demangle.exp: update expected output for _D8demangle4testFnZv
66898         Since commit ce2d3708bc8b ("Synchronize binutils libiberty sources with
66899         gcc version."), I see this failure:
66900
66901             demangle _D8demangle4testFnZv^M
66902             demangle.test(typeof(null))^M
66903             (gdb) FAIL: gdb.dlang/demangle.exp: _D8demangle4testFnZv
66904
66905         The commit imported the commit 0e32a5aa8bc9 ("libiberty: Add support for
66906         D `typeof(*null)' types") from the gcc repository.  That commit includes
66907         an update to libiberty/testsuite/d-demangle-expected, which updates a
66908         test for the exact same mangled name:
66909
66910              _D8demangle4testFnZv
66911             -demangle.test(none)
66912             +demangle.test(typeof(null))
66913
66914         I don't know anything about D, but give that the change was made by Iain
66915         Buclaw, the D language maintainer, I trust him on that.
66916
66917         Fix our test by updating the expected output in the same way.
66918
66919         Note: it's not really useful to have all these D demangling tests in the
66920         GDB testsuite, since there are demangling tests in libiberty.  We should
66921         consider removing them, but we first need to make sure that everything
66922         that is covered in gdb/testsuite/gdb.dlang/demangle.exp is also covered
66923         in libiberty/testsuite/d-demangle-expected.
66924
66925         Change-Id: If2b290ea8367b8e1e0b90b20d4a6e0bee517952d
66926
66927 2022-01-14  Nils-Christian Kempke  <nils-christian.kempke@intel.com>
66928
66929         gdb/testsuite: enable __INTEL_LLVM_COMPILER preprocessor in get_compiler_info
66930         Intel Next Gen compiler defines preprocessor __INTEL_LLVM_COMPILER and provides
66931         version info in __clang_version__ e.g. value: 12.0.0 (icx 2020.10.0.1113).
66932
66933         gdb/testsuite/ChangeLog:
66934         2020-12-07  Abdul Basit Ijaz  <abdul.b.ijaz@intel.com>
66935
66936                 * lib/compiler.c: Add Intel next gen compiler pre-processor check.
66937                 * lib/compiler.cc: Ditto.
66938                 * lib/fortran.exp (fortran_main): Check Intel next gen compiler in
66939                 test_compiler_info.
66940
66941 2022-01-14  Alan Modra  <amodra@gmail.com>
66942
66943         PR28751 mbind2a / mbind2b regressions on powerpc*-linux
66944         include/
66945                 * bfdlink.h (struct bfd_link_info): Add commonpagesize_is_set.
66946         ld/
66947                 PR 28751
66948                 * emultempl/elf.em (handle_option): Set commonpagesize_is_set.
66949                 * ldelf.c (ldelf_after_parse): Don't error when only one of
66950                 -z max-page-size or -z common-page-size is given, correct the
66951                 other value to make it sane.
66952                 * testsuite/ld-elf/elf.exp (mbind2a, mbind2b): Do not pass
66953                 -z max-page-size.
66954
66955 2022-01-14  Jan Beulich  <jbeulich@suse.com>
66956
66957         x86: drop ymmxmm_mode
66958         This enumerator is not used by any table entry.
66959
66960         x86: share yet more VEX table entries with EVEX decoding
66961         On top of prior similar work more opportunities have appeared in the
66962         meantime. Note that this also happens to address the prior lack of
66963         decoding of EVEX.L'L for VMOV{L,H}P{S,D} and VMOV{LH,HL}PS.
66964
66965         x86: consistently use scalar_mode for AVX512-FP16 scalar insns
66966         For some reason the original AVFX512F insns were not taken as a basis
66967         here, causing unnecessary divergence. While not an active issue, it is
66968         still relevant to note that OP_XMM() has special treatment of e.g.
66969         scalar_mode (marking broadcast as invalid). Such would better be
66970         consistent for all sufficiently similar insns.
66971
66972         x86: record further wrong uses of EVEX.b
66973         For one EVEX.W set does not imply EVEX.b is uniformly valid. Reject it
66974         for modes which occur for insns allowing for EVEX.W to be set (noticed
66975         with VMOV{H,L}PD and VMOVDDUP, and only in AT&T mode, but not checked
66976         whether further insns would also have been impacted; I expect e.g.
66977         VCMPSD would have had the same issue). And then the present concept of
66978         broadcast makes no sense at all when the memory operand of an insn is
66979         the destination.
66980
66981 2022-01-14  Jan Beulich  <jbeulich@suse.com>
66982
66983         x86: reduce AVX512 FP set of insns decoded through vex_w_table[]
66984         Like for AVX512-FP16, there's not that many FP insns where going through
66985         this table is easier / cheaper than using suitable macros. Utilize %XS
66986         and %XD more to eliminate a fair number of table entries.
66987
66988         While doing this I noticed a few anomalies. Where lines get touched /
66989         moved anyway, these are being addressed right here:
66990         - vmovshdup used EXx for its 2nd operand, thus displaying seemingly
66991           valid broadcast when EVEX.b is set with a memory operand; use
66992           EXEvexXNoBcst instead just like vmovsldup already does
66993         - vmovlhps used EXx for its 3rd operand, when all sibling entries use
66994           EXq; switch to EXq there for consistency (the two differ only for
66995           memory operands)
66996
66997 2022-01-14  Jan Beulich  <jbeulich@suse.com>
66998
66999         x86: reduce AVX512-FP16 set of insns decoded through vex_w_table[]
67000         Like already indicated during review of the original submission, there's
67001         really only very few insns where going through this table is easier /
67002         cheaper than using suitable macros. Utilize %XH more and introduce
67003         similar %XS and %XD (which subsequently can be used for further table
67004         size reduction).
67005
67006         While there also switch to using oappend() in 'XH' macro processing.
67007
67008 2022-01-14  GDB Administrator  <gdbadmin@sourceware.org>
67009
67010         Automatic date update in version.in
67011
67012 2022-01-13  H.J. Lu  <hjl.tools@gmail.com>
67013
67014         ld: Disable DT_RELR in some -z relro tests
67015         Disable DT_RELR in the following -z relro tests which don't expect
67016         DT_RELR in linker outputs.
67017
67018                 * testsuite/ld-i386/pr20830.d: Pass $NO_DT_RELR_LDFLAGS to ld.
67019                 * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
67020                 * testsuite/ld-x86-64/pr20830a.d: Likewise.
67021                 * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
67022                 * testsuite/ld-x86-64/pr20830b.d: Likewise.
67023                 * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
67024                 * testsuite/ld-x86-64/pr21038a.d: Likewise.
67025                 * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
67026                 * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
67027                 * testsuite/ld-x86-64/pr21038c.d: Likewise.
67028
67029 2022-01-13  H.J. Lu  <hjl.tools@gmail.com>
67030
67031         Reapply libiberty: Pass --plugin to AR and RANLIB
67032         Reapply the patch to detect GCC LTO plugin used for libiberty build to
67033         support LTO build in libiberty.
67034
67035                 * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
67036                 (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
67037                 (configure_deps): Depend on ../config/gcc-plugin.m4.
67038                 * aclocal.m4: Include ../config/gcc-plugin.m4.
67039                 * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
67040                 RANLIB_PLUGIN_OPTION.
67041                 * configure: Regenerate.
67042
67043 2022-01-13  H.J. Lu  <hjl.tools@gmail.com>
67044
67045         elf: Remove the 1-page gap before the RELRO segment
67046         The existing RELRO scheme may leave a 1-page gap before the RELRO segment
67047         and align the end of the RELRO segment to the page size:
67048
67049           [18] .eh_frame    PROGBITS    408fa0 008fa0 005e80 00   A  0   0  8
67050           [19] .init_array  INIT_ARRAY  410de0 00fde0 000008 08  WA  0   0  8
67051           [20] .fini_array  FINI_ARRAY  410de8 00fde8 000008 08  WA  0   0  8
67052           [21] .dynamic     DYNAMIC     410df0 00fdf0 000200 10  WA  7   0  8
67053           [22] .got         PROGBITS    410ff0 00fff0 000010 08  WA  0   0  8
67054           [23] .got.plt     PROGBITS    411000 010000 000048 08  WA  0   0  8
67055
67056         Instead, we can remove the 1-page gap if the maximum page size >= the
67057         maximum section alignment:
67058
67059           [18] .eh_frame    PROGBITS    408fa0 008fa0 005e80 00   A  0   0  8
67060           [19] .init_array  INIT_ARRAY  40fde0 00fde0 000008 08  WA  0   0  8
67061           [20] .fini_array  FINI_ARRAY  40fde8 00fde8 000008 08  WA  0   0  8
67062           [21] .dynamic     DYNAMIC     40fdf0 00fdf0 000200 10  WA  7   0  8
67063           [22] .got         PROGBITS    40fff0 00fff0 000010 08  WA  0   0  8
67064           [23] .got.plt     PROGBITS    410000 010000 000048 08  WA  0   0  8
67065
67066         Because the end of the RELRO segment is always aligned to the page size
67067         and may not be moved, the RELRO segment size may be increased:
67068
67069           [ 3] .dynstr      STRTAB      000148 000148 000001 00   A  0   0  1
67070           [ 4] .eh_frame    PROGBITS    000150 000150 000000 00   A  0   0  8
67071           [ 5] .init_array  INIT_ARRAY  200150 000150 000010 08  WA  0   0  1
67072           [ 6] .fini_array  FINI_ARRAY  200160 000160 000010 08  WA  0   0  1
67073           [ 7] .jcr         PROGBITS    200170 000170 000008 00  WA  0   0  1
67074           [ 8] .data.rel.ro PROGBITS    200180 000180 000020 00  WA  0   0 16
67075           [ 9] .dynamic     DYNAMIC     2001a0 0001a0 0001c0 10  WA  3   0  8
67076           [10] .got         PROGBITS    200360 000360 0002a8 00  WA  0   0  8
67077           [11] .bss         NOBITS      201000 000608 000840 00  WA  0   0  1
67078
67079         vs the old section layout:
67080
67081           [ 3] .dynstr      STRTAB      000148 000148 000001 00   A  0   0  1
67082           [ 4] .eh_frame    PROGBITS    000150 000150 000000 00   A  0   0  8
67083           [ 5] .init_array  INIT_ARRAY  200b48 000b48 000010 08  WA  0   0  1
67084           [ 6] .fini_array  FINI_ARRAY  200b58 000b58 000010 08  WA  0   0  1
67085           [ 7] .jcr         PROGBITS    200b68 000b68 000008 00  WA  0   0  1
67086           [ 8] .data.rel.ro PROGBITS    200b70 000b70 000020 00  WA  0   0 16
67087           [ 9] .dynamic     DYNAMIC     200b90 000b90 0001c0 10  WA  3   0  8
67088           [10] .got         PROGBITS    200d50 000d50 0002a8 00  WA  0   0  8
67089           [11] .bss         NOBITS      201000 000ff8 000840 00  WA  0   0  1
67090
67091         But there is no 1-page gap.
67092
67093                 PR ld/28743
67094                 * ldlang.c (lang_size_relro_segment_1): Remove the 1-page gap
67095                 before the RELRO segment if the maximum page size >= the maximum
67096                 section alignment.
67097                 * testsuite/ld-i386/pr20830.d: Adjusted.
67098                 * testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
67099                 * testsuite/ld-x86-64/pr14207.d: Likewise.
67100                 * testsuite/ld-x86-64/pr18176.d: Likewise.
67101                 * testsuite/ld-x86-64/pr20830a-now.d: Likewise.
67102                 * testsuite/ld-x86-64/pr20830a.d: Likewise.
67103                 * testsuite/ld-x86-64/pr20830b-now.d: Likewise.
67104                 * testsuite/ld-x86-64/pr20830b.d: Likewise.
67105                 * testsuite/ld-x86-64/pr21038a-now.d: Likewise.
67106                 * testsuite/ld-x86-64/pr21038a.d: Likewise.
67107                 * testsuite/ld-x86-64/pr21038b-now.d: Likewise.
67108                 * testsuite/ld-x86-64/pr21038c-now.d: Likewise.
67109                 * testsuite/ld-x86-64/pr21038c.d: Likewise.
67110
67111 2022-01-13  Nick Clifton  <nickc@redhat.com>
67112
67113         Synchronize binutils libiberty sources with gcc version.
67114         +2021-12-30  Lancelot SIX  <lsix@lancelotsix.com>
67115         +
67116         +       * cp-demangle.c (d_clone_suffix): Support digits in clone tag
67117         +       names.
67118         +       * testsuite/demangle-expected: Check demangling of clone symbols
67119         +       with digits in name.
67120         +
67121         +2021-12-16  H.J. Lu  <hjl.tools@gmail.com>
67122         +
67123         +       Revert:
67124         +       2021-12-16  H.J. Lu  <hjl.tools@gmail.com>
67125         +
67126         +       * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
67127         +       (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
67128         +       (configure_deps): Depend on ../config/gcc-plugin.m4.
67129         +       * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
67130         +       RANLIB_PLUGIN_OPTION.
67131         +       * aclocal.m4: Regenerated.
67132         +       * configure: Likewise.
67133         +
67134         +2021-12-15  H.J. Lu  <hjl.tools@gmail.com>
67135         +
67136         +       * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
67137         +       (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
67138         +       (configure_deps): Depend on ../config/gcc-plugin.m4.
67139         +       * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
67140         +       RANLIB_PLUGIN_OPTION.
67141         +       * aclocal.m4: Regenerated.
67142         +       * configure: Likewise.
67143         +
67144         +2021-11-29  Eric Gallager  <egallager@gcc.gnu.org>
67145         +
67146         +       PR other/103021
67147         +       * Makefile.in: Use ETAGS variable in TAGS target.
67148         +       * configure: Regenerate.
67149         +       * configure.ac: Allow ETAGS variable to be overridden.
67150         +
67151         +2021-11-29  Andrew Pinski  <apinski@marvell.com>
67152         +
67153         +       * make-temp-file.c (try_dir): Check to see if the dir
67154         +       is actually a directory.
67155         +
67156         +2021-10-22  Eric Gallager  <egallager@gcc.gnu.org>
67157         +
67158         +       PR other/102663
67159         +       * Makefile.in: Allow dvi-formatted documentation
67160         +       to be installed.
67161         +
67162         +2021-10-17  Lu?s Ferreira  <contact@lsferreira.net>
67163         +
67164         +       PR d/102618
67165         +       * d-demangle.c (dlang_parse_qualified): Handle anonymous
67166         +       symbols correctly.
67167         +       * testsuite/d-demangle-expected: New tests to cover anonymous
67168         +       symbols.
67169         +
67170         +2021-10-14  Lu?s Ferreira  <contact@lsferreira.net>
67171         +
67172         +       * testsuite/d-demangle-expected: Add test case for function literals.
67173         +
67174         +2021-10-14  Lu?s Ferreira  <contact@lsferreira.net>
67175         +
67176         +       * testsuite/d-demangle-expected: Add test cases for simple special
67177         +       mangles.
67178         +
67179         +2021-10-12  Lu?s Ferreira  <contact@lsferreira.net>
67180         +
67181         +       * d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis
67182         +       around lhs and rhs of assignments.
67183         +
67184         +2021-10-01  Lu?s Ferreira  <contact@lsferreira.net>
67185         +
67186         +       * testsuite/d-demangle-expected: Add missing format for new test
67187         +
67188         +2021-09-23  Lu?s Ferreira  <contact@lsferreira.net>
67189         +
67190         +       * d-demangle.c (dlang_Type): Validate MANGLED is nonnull.
67191         +       * testsuite/d-demangle-expected: New test.
67192         +
67193         +2021-09-23  Lu?s Ferreira  <contact@lsferreira.net>
67194         +
67195         +       * d-demangle.c (dlang_symbol_backref): Ensure strlen of
67196         +       string is less than length computed by dlang_number.
67197         +
67198         +2021-09-01  Iain Sandoe  <iain@sandoe.co.uk>
67199
67200                 * configure: Regenerate.
67201         +       * configure.ac: Do not search for sbrk on Darwin.
67202         +       * xmalloc.c: Do not declare sbrk unless it has been found
67203         +       by configure.
67204         +
67205         +2021-08-29  Iain Buclaw  <ibuclaw@gdcproject.org>
67206         +
67207         +       * d-demangle.c (dlang_identifier): Skip over fake parent manglings.
67208         +       * testsuite/d-demangle-expected: Add tests.
67209         +
67210         +2021-08-29  Iain Buclaw  <ibuclaw@gdcproject.org>
67211         +
67212         +       * d-demangle.c (dlang_parse_arrayliteral): Add 'info' parameter.
67213         +       (dlang_parse_assocarray): Likewise.
67214         +       (dlang_parse_structlit): Likewise.
67215         +       (dlang_value): Likewise.  Handle function literal symbols.
67216         +       (dlang_template_args): Pass 'info' to dlang_value.
67217         +       * testsuite/d-demangle-expected: Add new test.
67218         +
67219         +2021-08-29  Iain Buclaw  <ibuclaw@gdcproject.org>
67220         +
67221         +       * d-demangle.c (dlang_attributes): Handle typeof(*null).
67222         +       (dlang_type): Likewise.  Demangle 'n' as typeof(null).
67223         +       * testsuite/d-demangle-expected: Update tests.
67224         +
67225         +2021-08-23  Iain Sandoe  <iain@sandoe.co.uk>
67226         +
67227         +       * simple-object-mach-o.c (simple_object_mach_o_write_segment):
67228         +       Cast the first argument to set_32 as needed.
67229
67230         -2021-07-03  Nick Clifton  <nickc@redhat.com>
67231         +2021-08-18  Iain Sandoe  <iain@sandoe.co.uk>
67232
67233         +       * simple-object-mach-o.c (simple_object_mach_o_write_segment):
67234         +       Arrange to swap the LTO index tables where needed.
67235          # Please enter the commit message for your changes. Lines starting
67236
67237 2022-01-13  Andrew Burgess  <aburgess@redhat.com>
67238
67239         gdb: don't use -Wmissing-prototypes with g++
67240         This commit aims to not make use of -Wmissing-prototypes when
67241         compiling with g++.
67242
67243         Use of -Wmissing-prototypes was added with this commit:
67244
67245           commit a0761e34f054767de6d6389929d27e9015fb299b
67246           Date:   Wed Mar 11 15:15:12 2020 -0400
67247
67248               gdb: enable -Wmissing-prototypes warning
67249
67250         Because clang can provide helpful warnings with this flag.
67251         Unfortunately, g++ doesn't accept this flag, and will give this
67252         warning:
67253
67254           cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
67255
67256         In theory the fact that this flag is not supported should be detected
67257         by the configure check in gdbsupport/warning.m4, but for users of
67258         ccache, this check doesn't work due to a long standing ccache issue:
67259
67260           https://github.com/ccache/ccache/issues/738
67261
67262         The ccache problem is that -W... options are reordered on the command
67263         line, and so -Wmissing-prototypes is seen before -Werror.  Usually
67264         this doesn't matter, but the above warning (about the flag not being
67265         valid) is issued before the -Werror flag is processed, and so is not
67266         fatal.
67267
67268         There have been two previous attempts to fix this that I'm aware of.
67269         The first is:
67270
67271           https://sourceware.org/pipermail/gdb-patches/2021-September/182148.html
67272
67273         In this attempt, instead of just relying on a compile to check if a
67274         flag is valid, the proposal was to both compile and link.  As linking
67275         doesn't go through ccache, we don't suffer from the argument
67276         reordering problem, and the link phase will correctly fail when using
67277         -Wmissing-prototypes with g++.  The configure script will then disable
67278         the use of this flag.
67279
67280         This approach was rejected, and the suggestion was to only add the
67281         -Wmissing-prototypes flag if we are compiling with gcc.
67282
67283         The second attempt, attempts this approach, and can be found here:
67284
67285           https://sourceware.org/pipermail/gdb-patches/2021-November/183076.html
67286
67287         This attempt only adds the -Wmissing-prototypes flag is the value of
67288         GCC is not 'yes'.  This feels like it is doing the right thing,
67289         unfortunately, the GCC flag is really a 'is gcc like' flag, not a
67290         strict, is gcc check.  As such, GCC is set to 'yes' for clang, which
67291         would mean the flag was not included for clang or gcc.  The entire
67292         point of the original commit was to add this flag for clang, so
67293         clearly the second attempt is not sufficient either.
67294
67295         In this new attempt I have added gdbsupport/compiler-type.m4, this
67296         file defines AM_GDB_COMPILER_TYPE.  This macro sets the variable
67297         GDB_COMPILER_TYPE to either 'gcc', 'clang', or 'unknown'.  In future
67298         the list of values might be extended to cover other compilers, if this
67299         is ever useful.
67300
67301         I've then modified gdbsupport/warning.m4 to only add the problematic
67302         -Wmissing-prototypes flag if GDB_COMPILER_TYPE is not 'gcc'.
67303
67304         I've tested this with both gcc and clang and see the expected results,
67305         gcc no longer attempts to use the -Wmissing-prototypes flag, while
67306         clang continues to use it.
67307
67308         When compiling using ccache, I am no longer seeing the warning.
67309
67310 2022-01-13  Andrew Burgess  <aburgess@redhat.com>
67311
67312         gdb: add some extra debug information to attach_command
67313         While working on another patch I wanted to add some extra debug
67314         information to the attach_command function.  This required me to add a
67315         new function to convert the thread_info::state variable to a string.
67316
67317         The new debug might be useful to others, and the state to string
67318         function might be useful in other locations, so I thought I'd merge
67319         it.
67320
67321 2022-01-13  Alan Modra  <amodra@gmail.com>
67322
67323         Re: gas: add visibility support using GNU syntax on XCOFF
67324         tc-ppc.c: In function 'ppc_comm':
67325         tc-ppc.c:4560:40: error: 'visibility' may be used uninitialized in this function [-Werror=maybe-uninitialized]
67326
67327         With that fixed we hit lots of segfaults in the ld testsuite.
67328
67329                 PR 22085
67330         bfd/
67331                 * xcofflink.c (xcoff_link_input_bfd): Don't segfault on NULL
67332                 sym_hash.
67333         gas/
67334                 * config/tc-ppc.c (ppc_comm): Init visibility.
67335
67336 2022-01-13  Alan Modra  <amodra@gmail.com>
67337
67338         dt-relr.exp --no-as-needed
67339         Otherwise the very simple test may not be linked with libc.so at all,
67340         and thus correctly have no version reference added.  Causing failure
67341         of the dt-relr-glibc-1b.so test.
67342
67343                 * testsuite/ld-elf/dt-relr.exp: Link with --no-as-needed.
67344
67345 2022-01-13  Alan Modra  <amodra@gmail.com>
67346
67347         Correct .relr.dyn nocombreloc script
67348                 * scripttempl/elf.sc (.relr.dyn): Don't depend on $COMBRELOC.
67349
67350 2022-01-13  Alan Modra  <amodra@gmail.com>
67351
67352         testsuite supports_dt_relr
67353         Tidy, and fix "FAIL: Build dt-relr-glibc-1b.so" on all non-x86
67354         linux targets.
67355
67356         binutils/
67357                 * binutils-common.exp (supports_dt_relr): New proc.
67358         ld/
67359                 * testsuite/config/default.exp (DT_RELR_LDFLAGS, NO_DT_RELR_LDFLAGS),
67360                 (DT_RELR_CC_LDFLAGS, NO_DT_RELR_CC_LDFLAGS): Use supports_dt_relr.
67361                 * testsuite/ld-elf/dt-relr.exp: Don't run unless supports_dt_relr.
67362                 * testsuite/ld-elf/dt-relr-1a.d: Likewise.
67363                 * testsuite/ld-elf/dt-relr-1b.d: Likewise.
67364                 * testsuite/ld-elf/dt-relr-1c.d: Likewise.
67365                 * testsuite/ld-elf/dt-relr-2a.d: Likewise.
67366                 * testsuite/ld-elf/dt-relr-2b.d: Likewise.
67367                 * testsuite/ld-elf/dt-relr-2c.d: Likewise.
67368                 * testsuite/ld-elf/dt-relr-2d.d: Likewise.
67369                 * testsuite/ld-elf/dt-relr-2e.d: Likewise.
67370                 * testsuite/ld-elf/dt-relr-2f.d: Likewise.
67371                 * testsuite/ld-elf/dt-relr-2g.d: Likewise.
67372                 * testsuite/ld-elf/dt-relr-2h.d: Likewise.
67373                 * testsuite/ld-elf/dt-relr-3a.d: Likewise.
67374                 * testsuite/ld-elf/dt-relr-3b.d: Likewise.
67375
67376 2022-01-13  Alan Modra  <amodra@gmail.com>
67377
67378         Don't use C++ comments in assembly
67379         It might seem to work, but only if '/' is a start of comment char.
67380
67381                 * testsuite/ld-elf/dt-relr-1.s: Use # for comment.
67382                 * testsuite/ld-elf/dt-relr-2.s: Likewise.
67383                 * testsuite/ld-elf/dt-relr-3.s: Likewise.
67384
67385 2022-01-13  Alan Modra  <amodra@gmail.com>
67386
67387         Move DT_RELR tag setting to elflink.c
67388         This makes the code setting DT_RELR tags generally available.  Many
67389         targets will be able to use the defaults.  Those that can't should set
67390         up sh_entsize for .relr.dyn output section before reaching the dynamic
67391         tag code in bfd_elf_final_link.
67392
67393                 * elflink.c (bfd_elf_final_link): Set up DT_RELR tags and sh_entsize.
67394                 * elfxx-x86.c (_bfd_x86_elf_finish_dynamic_sections): Don't do any
67395                 of that here.
67396
67397 2022-01-13  Alan Modra  <amodra@gmail.com>
67398
67399         Re: Set SEC_ELF_REVERSE_COPY earlier
67400         Let's not rely on .init/.fini having relocs for the size sanity check.
67401         This is mainly to squash reports of "my fuzzed object made ld hang".
67402
67403 2022-01-13  Tiezhu Yang  <yangtiezhu@loongson.cn>
67404
67405         gdb: testsuite: make string[] type as char in gdb.base/charset.c
67406         This reverts the commit ff656e2e1cb1 ("gdb: testsuite: fix failed
67407         testcases in gdb.base/charset.exp").
67408
67409         The original test code has no problem. On an architecture where
67410         char is signed, then both 'A' and ebcdic_us_string[7] will yield
67411         -63, which makes the equality true. On an architecture where char
67412         is unsigned, then both 'A' and ebcdic_us_string[7] will yield 193,
67413         which also makes the equality true.
67414
67415         The test cases only failed on LoongArch. The default type of char
67416         is signed char on LoongArch, like x86-64. But when use gdb print
67417         command on LoongArch, the default type of char is unsigned char,
67418         this is wrong, I will look into it later, sorry for that.
67419
67420         On LoongArch:
67421
67422           $ cat test_char.c
67423           #include <stdio.h>
67424
67425           int main()
67426           {
67427                   char c1 = 193;
67428                   unsigned char c2 = 193;
67429
67430                   printf("%d\n", c1);
67431                   printf("%d\n", c1 == c2);
67432
67433                   return 0;
67434           }
67435           $ gcc test_char.c -o test_char
67436           $ ./test_char
67437           -63
67438           0
67439
67440           (gdb) set target-charset EBCDIC-US
67441           (gdb) print 'A'
67442           $1 = 193 'A'
67443           (gdb) print /c 'A'
67444           $2 = 193 'A'
67445           (gdb) print /u 'A'
67446           $3 = 193
67447           (gdb) print /d 'A'
67448           $4 = -63
67449           (gdb) print /x 'A'
67450           $5 = 0xc1
67451
67452 2022-01-13  GDB Administrator  <gdbadmin@sourceware.org>
67453
67454         Automatic date update in version.in
67455
67456 2022-01-12  Carl Love  <cel@us.ibm.com>
67457
67458         gdb Power 9 add test for HW watchpoint support.
67459         The Power 9 processor revision 2.2 has HW watchpoint support disabled due
67460         to a HW bug.  The support is fixed in Power 9 processor revision 2.3.  This
67461         patch add a test to lib/gdb.exp for Power to determine if the processor
67462         supports HW watchpoints or not.  If the Power processor doesn't support HW
67463         watchpoints the proceedure skip_hw_watchpoint_tests will return 1 to
67464         disable the various HW watchpoint tests.
67465
67466         The patch has been tested on Power 9, processor revesions 2.2 and 2.3.  The
67467         patch has also been tested on Power 10.  No regression test failures were
67468         found.
67469
67470 2022-01-12  Andrew Burgess  <aburgess@redhat.com>
67471
67472         gdb/python: add gdb.host_charset function
67473         We already have gdb.target_charset and gdb.target_wide_charset.  This
67474         commit adds gdb.host_charset along the same lines.
67475
67476 2022-01-12  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
67477
67478         gdb/testsuite: fix gdb.python/py-events.exp for finding process id
67479         When executed with --target_board=native-extended-gdbserver, the
67480         gdb.python/py-events.exp test errors out with
67481
67482           ERROR: tcl error sourcing /path/to/gdb/testsuite/gdb.python/py-events.exp.
67483           ERROR: can't read "process_id": no such variable
67484               while executing
67485           "lappend expected "ptid: \\($process_id, $process_id, 0\\)" "address: $addr""
67486               (file "/path/to/gdb/testsuite/gdb.python/py-events.exp" line 103)
67487               invoked from within
67488           "source /path/to/gdb/testsuite/gdb.python/py-events.exp"
67489               ("uplevel" body line 1)
67490               invoked from within
67491           "uplevel #0 source /path/to/gdb/testsuite/gdb.python/py-events.exp"
67492               invoked from within
67493           "catch "uplevel #0 source $test_file_name""
67494
67495         There are multiple problems around this:
67496
67497         1. The process_id variable is not initialized to a default value.
67498
67499         2. The test attempts to find the PID of the current thread, but the
67500            regexp that it uses is not tailored for the output printed by the
67501            remote target.
67502
67503         3. The test uses "info threads" to find the current thread PID.
67504            Using the "thread" command instead is simpler.
67505
67506         Fix these problems.
67507
67508 2022-01-12  Tom Tromey  <tromey@adacore.com>
67509
67510         Don't mention "serial" in target remote description
67511         PR remote/9177 points out that "info files" mentions "serial" a couple
67512         of times:
67513
67514             Remote serial target in gdb-specific protocol:
67515             Debugging a target over a serial line.
67516
67517         However, often the remote target isn't really a serial connection.
67518
67519         It seems to me that this text could be a bit clearer; and furthermore
67520         since "info files" prints the target's long description,
67521         remote_target::files_info doesn't really add much and can simply be
67522         removed.
67523
67524         Regression tested on x86-64 Fedora 34.
67525
67526         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=9177
67527
67528 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67529
67530         ld: Add glibc dependency for DT_RELR
67531         When DT_RELR is enabled, to avoid random run-time crash with older glibc
67532         binaries without DT_RELR support, add a GLIBC_ABI_DT_RELR symbol version,
67533         which is provided by glibc with DT_RELR support, dependency on the shared
67534         C library if it provides a GLIBC_2.XX symbol version.
67535
67536         bfd/
67537
67538                 * elflink.c (elf_link_add_dt_relr_dependency): New function.
67539                 (bfd_elf_size_dynamic_sections): Call
67540                 elf_link_add_dt_relr_dependency if DT_RELR is enabled.
67541
67542         ld/
67543
67544                 * ld.texi: Mention GLIBC_ABI_DT_RELR in -z pack-relative-relocs
67545                 entry.
67546                 * testsuite/ld-elf/dt-relr-glibc-1.c: New file.
67547                 * testsuite/ld-elf/dt-relr-glibc-1a.rd: Likewise.
67548                 * testsuite/ld-elf/dt-relr-glibc-1b.rd: Likewise.
67549                 * testsuite/ld-elf/dt-relr.exp: Likewise.
67550
67551 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67552
67553         ld: Add simple DT_RELR tests
67554                 * testsuite/ld-elf/dt-relr-1.s: New file.
67555                 * testsuite/ld-elf/dt-relr-1a.d: Likewise.
67556                 * testsuite/ld-elf/dt-relr-1b.d: Likewise.
67557                 * testsuite/ld-elf/dt-relr-1c.d: Likewise.
67558                 * testsuite/ld-elf/dt-relr-2.s: Likewise.
67559                 * testsuite/ld-elf/dt-relr-2a.d: Likewise.
67560                 * testsuite/ld-elf/dt-relr-2b.d: Likewise.
67561                 * testsuite/ld-elf/dt-relr-2c.d: Likewise.
67562                 * testsuite/ld-elf/dt-relr-2d.d: Likewise.
67563                 * testsuite/ld-elf/dt-relr-2e.d: Likewise.
67564                 * testsuite/ld-elf/dt-relr-2f.d: Likewise.
67565                 * testsuite/ld-elf/dt-relr-2g.d: Likewise.
67566                 * testsuite/ld-elf/dt-relr-2h.d: Likewise.
67567                 * testsuite/ld-elf/dt-relr-3.s: Likewise.
67568                 * testsuite/ld-elf/dt-relr-3a.d: Likewise.
67569                 * testsuite/ld-elf/dt-relr-3b.d: Likewise.
67570                 * testsuite/ld-i386/dt-relr-1.s: Likewise.
67571                 * testsuite/ld-i386/dt-relr-1a.d: Likewise.
67572                 * testsuite/ld-i386/dt-relr-1b.d: Likewise.
67573                 * testsuite/ld-x86-64/dt-relr-1a-x32.d: Likewise.
67574                 * testsuite/ld-x86-64/dt-relr-1a.d: Likewise.
67575                 * testsuite/ld-x86-64/dt-relr-1b-x32.d: Likewise.
67576                 * testsuite/ld-x86-64/dt-relr-1b.d: Likewise.
67577                 * testsuite/ld-x86-64/dt-relr-1.s: Likewise.
67578                 * testsuite/ld-i386/i386.exp: Run dt-relr-1a and dt-relr-1b.
67579                 * testsuite/ld-x86-64/x86-64.exp: Run dt-relr-1a, dt-relr-1a-x32
67580                 dt-relr-1b and dt-relr-1b-x32.
67581
67582 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67583
67584         x86: Add DT_RELR support
67585         DT_RELR is implemented with linker relaxation:
67586
67587         1. During linker relaxation, we scan input relocations with the same
67588         logic in relocate_section to determine if a relative relocation should
67589         be generated and save the relative relocation candidate information for
67590         sizing the DT_RELR section later after all symbols addresses can be
67591         determined.  For these relative relocations which can't be placed in
67592         the DT_RELR section, they will be placed in the rela.dyn/rel.dyn
67593         section.
67594         2. When DT_RELR is enabled, _bfd_elf_map_sections_to_segments calls a
67595         backend function to size the DT_RELR section which will compute the
67596         DT_RELR section size and tell ldelf_map_segments to layout sections
67597         again when the DT_RELR section size has been increased.
67598         3. After regular symbol processing is finished, bfd_elf_final_link calls
67599         a backend function to finish the DT_RELR section.
67600
67601                 * elf32-i386.c (elf_i386_relocate_section): Don't generate
67602                 relative relocation when DT_RELR is enabled.
67603                 (elf_i386_finish_dynamic_symbol): Likewise.
67604                 * elf64-x86-64.c (elf_x86_64_relocate_section): Don't generate
67605                 relative relocation when DT_RELR is enabled.
67606                 (elf_x86_64_finish_dynamic_symbol): Likewise.
67607                 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
67608                 relative_r_type, relative_r_name, elf_append_reloc,
67609                 elf_write_addend and elf_write_addend_in_got.
67610                 (elf_x86_relative_reloc_record_add): New function.
67611                 (_bfd_x86_elf_link_relax_section): Likewise.
67612                 (elf64_dt_relr_bitmap_add): Likewise.
67613                 (elf32_dt_relr_bitmap_add): Likewise.
67614                 (_bfd_elf32_write_addend): Likewise.
67615                 (_bfd_elf64_write_addend): Likewise.
67616                 (elf_x86_size_or_finish_relative_reloc): Likewise.
67617                 (elf_x86_compute_dl_relr_bitmap): Likewise.
67618                 (elf_x86_write_dl_relr_bitmap): Likewise.
67619                 (elf_x86_relative_reloc_compare ): Likewise.
67620                 (_bfd_elf_x86_size_relative_relocs): Likewise.
67621                 (_bfd_elf_x86_finish_relative_relocs): Likewise.
67622                 (_bfd_x86_elf_size_dynamic_sections): Skip the .relr.dyn section.
67623                 (_bfd_x86_elf_finish_dynamic_sections): Convert 3 spare dynamic
67624                 tags to DT_RELR, DT_RELRSZ and for compact relative relocation.
67625                 * elfxx-x86.h (X86_64_GOT_TYPE_P): New.
67626                 (I386_GOT_TYPE_P): Likewise.
67627                 (X86_GOT_TYPE_P): Likewise.
67628                 (X86_64_RELATIVE_RELOC_TYPE_P): Likewise.
67629                 (I386_RELATIVE_RELOC_TYPE_P): Likewise.
67630                 (X86_RELATIVE_RELOC_TYPE_P): Likewise.
67631                 (X86_LOCAL_GOT_RELATIVE_RELOC_P): Likewise.
67632                 (I386_PCREL_TYPE_P): Likewise.
67633                 (X86_64_PCREL_TYPE_P): Likewise.
67634                 (X86_64_NEED_DYNAMIC_RELOC_TYPE_P): Rewrite.
67635                 (I386_NEED_DYNAMIC_RELOC_TYPE_P): Likewise.
67636                 (GENERATE_DYNAMIC_RELOCATION_P): Also check rel_from_abs.
67637                 (elf_x86_link_hash_entry): Add got_relative_reloc_done.
67638                 (elf_x86_relative_reloc_record): New.
67639                 (elf_x86_relative_reloc_data): Likewise.
67640                 (elf_dt_relr_bitmap): Likewise.
67641                 (elf_x86_link_hash_table): Add dt_relr_bitmap, relative_reloc,
67642                 unaligned_relative_reloc, relative_r_type, relative_r_name,
67643                 elf_append_reloc, elf_write_addend, elf_write_addend_in_got and
67644                 relative_reloc_done.
67645                 (elf_x86_relative_reloc_done): New.
67646                 (relative_reloc_packed): Likewise.
67647                 (_bfd_x86_elf_link_relax_section): Likewise.
67648                 (_bfd_elf_x86_size_relative_relocs): Likewise.
67649                 (_bfd_elf_x86_finish_relative_relocs): Likewise.
67650                 (_bfd_elf32_write_addend): Likewise.
67651                 (_bfd_elf64_write_addend): Likewise.
67652                 (bfd_elf32_bfd_relax_section): Likewise.
67653                 (bfd_elf64_bfd_relax_section): Likewise.
67654                 (elf_backend_size_relative_relocs): Likewise.
67655                 (elf_backend_finish_relative_relocs): Likewise.
67656                 (elf_x86_allocate_local_got_info): Also allocate
67657                 relative_reloc_done.
67658
67659 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67660
67661         elf: Support DT_RELR in linker tests
67662         Allow eabling and disabling DT_RELR in linker tests.  Disable DT_RELR in
67663         linker tests which don't expect DT_RELR in linker outputs.
67664
67665         binutils/
67666
67667                 * testsuite/lib/binutils-common.exp (run_dump_test): Make
67668                 DT_RELR_LDFLAGS and NO_DT_RELR_LDFLAGS global.
67669
67670         ld/
67671
67672                 * testsuite/config/default.exp (DT_RELR_LDFLAGS): New.
67673                 (DT_RELR_CC_LDFLAGS): Likewise.
67674                 (NO_DT_RELR_LDFLAGS): Likewise.
67675                 (NO_DT_RELR_CC_LDFLAGS): Likewise.
67676                 * testsuite/ld-elf/shared.exp: Pass $NO_DT_RELR_LDFLAGS to
67677                 linker for some tests.
67678                 * testsuite/ld-i386/export-class.exp: Likewise.
67679                 * testsuite/ld-i386/i386.exp: Likewise.
67680                 * testsuite/ld-i386/ibt-plt-2a.d: Pass $NO_DT_RELR_LDFLAGS to
67681                 linker.
67682                 * testsuite/ld-i386/ibt-plt-3a.d: Likewise.
67683                 * testsuite/ld-i386/ibt-plt-3c.d: Likewise.
67684                 * testsuite/ld-i386/pr26869.d: Likewise.
67685                 * testsuite/ld-i386/report-reloc-1.d: Likewise.
67686                 * testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
67687                 * testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
67688                 * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
67689                 * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
67690                 * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
67691                 * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
67692                 * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
67693                 * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
67694                 * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
67695                 * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
67696                 * testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
67697                 * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
67698                 * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
67699                 * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
67700                 * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
67701                 * testsuite/ld-x86-64/ilp32-4.d: Likewise.
67702                 * testsuite/ld-x86-64/load1c.d: Likewise.
67703                 * testsuite/ld-x86-64/load1d.d: Likewise.
67704                 * testsuite/ld-x86-64/pr13082-2b.d: Likewise.
67705                 * testsuite/ld-x86-64/pr14207.d: Likewise.
67706                 * testsuite/ld-x86-64/pr18176.d: Likewise.
67707                 * testsuite/ld-x86-64/pr19162.d: Likewise.
67708                 * testsuite/ld-x86-64/pr19636-2d.d: Likewise.
67709                 * testsuite/ld-x86-64/pr19636-2l.d: Likewise.
67710                 * testsuite/ld-x86-64/pr20253-1d.d: Likewise.
67711                 * testsuite/ld-x86-64/pr20253-1f.d: Likewise.
67712                 * testsuite/ld-x86-64/pr20253-1j.d: Likewise.
67713                 * testsuite/ld-x86-64/pr20253-1l.d: Likewise.
67714                 * testsuite/ld-x86-64/report-reloc-1-x32.d: Likewise.
67715                 * testsuite/ld-x86-64/report-reloc-1.d: Likewise.
67716                 * testsuite/ld-x86-64/export-class.exp (x86_64_export_class_test):
67717                 Pass $NO_DT_RELR_LDFLAGS to linker.
67718                 * testsuite/ld-x86-64/x86-64.exp: Pass $NO_DT_RELR_LDFLAGS to
67719                 linker for some tests.
67720
67721 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67722
67723         elf: Add size_relative_relocs and finish_relative_relocs
67724         On some targets, the DT_RELR section size can be computed only after all
67725         symbols addresses can be determined.  Set the preliminary DT_RELR section
67726         size before mapping sections to segments and set the final DT_RELR section
67727         size after regular symbol processing is done.
67728
67729                 * elf-bfd.h (elf_backend_data): Add size_relative_relocs and
67730                 finish_relative_relocs.
67731                 * elf.c (_bfd_elf_map_sections_to_segments): Call
67732                 size_relative_relocs if DT_RELR is enabled.
67733                 * elflink.c (bfd_elf_final_link): Call finish_relative_relocs
67734                 after regular symbol processing is finished if DT_RELR is enabled.
67735                 * elfxx-target.h (elf_backend_size_relative_relocs): New.
67736                 (elf_backend_finish_relative_relocs): Likewise.
67737                 (elfNN_bed): Add elf_backend_size_relative_relocs and
67738                 elf_backend_finish_relative_relocs.
67739
67740 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67741
67742         ld: Initial DT_RELR support
67743         Add a -z pack-relative-relocs option to enable DT_RELR and create a
67744         relr.dyn section for DT_RELR.  DT_RELR is implemented with the linker
67745         relaxation infrastructure, but it doesn't require the --relax option
67746         enabled.  -z pack-relative-relocs implies -z combreloc.  -z nocombreloc
67747         implies -z nopack-relative-relocs.
67748
67749         -z pack-relative-relocs is chosen over the similar option in lld,
67750         --pack-dyn-relocs=relr, to implement a glibc binary lockout mechanism
67751         with a special glibc version symbol, to avoid random crashes of DT_RELR
67752         binaries with the existing glibc binaries.
67753
67754         bfd/
67755
67756                 * elf-bfd.h (elf_link_hash_table): Add srelrdyn.
67757                 * elflink.c (_bfd_elf_link_create_dynamic_sections): Create a
67758                 .relr.dyn section for DT_RELR.
67759
67760         include/
67761
67762                 * bfdlink.h (bfd_link_info): Add enable_dt_relr.
67763
67764         ld/
67765
67766                 * News: Mention -z pack-relative-relocs and
67767                 -z nopack-relative-relocs.
67768                 * ld.texi: Document -z pack-relative-relocs and
67769                 -z nopack-relative-relocs.
67770                 * ldelf.c (ldelf_after_parse): Disable DT_RELR if not building
67771                 PIE nor shared library.  Add 3 spare dynamic tags for DT_RELR,
67772                 DT_RELRSZ and DT_RELRENT.
67773                 * ldlang.c (lang_relax_sections): Also enable relaxation if
67774                 DT_RELR is enabled.
67775                 * emulparams/elf32_x86_64.sh: Source dt-relr.sh.
67776                 * emulparams/elf_i386.sh: Likewise.
67777                 * emulparams/elf_x86_64.sh: Likewise.
67778                 * emulparams/dt-relr.sh: New file.
67779                 * scripttempl/elf.sc: Support .relr.dyn.
67780
67781 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67782
67783         elf: Pass need_layout to _bfd_elf_map_sections_to_segments
67784         On some targets, the DT_RELR section size can be computed only after all
67785         symbols addresses can be determined.  Update ldelf_map_segments to pass
67786         need_layout to _bfd_elf_map_sections_to_segments which will size DT_RELR
67787         section and set need_layout to true if the DT_RELR section size is changed.
67788
67789         bfd/
67790
67791                 * elf-bfd.h (_bfd_elf_map_sections_to_segments): Add a bool
67792                 pointer argument.
67793                 * elf.c (_bfd_elf_map_sections_to_segments): Add a bool pointer
67794                 argument to indicate if section layout needs update.
67795                 (assign_file_positions_for_load_sections): Pass NULL to
67796                 _bfd_elf_map_sections_to_segments.
67797                 * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): Pass
67798                 NULL to _bfd_elf_map_sections_to_segments.
67799
67800         ld/
67801
67802                 * ldelfgen.c (ldelf_map_segments): Pass &need_layout to
67803                 _bfd_elf_map_sections_to_segments.
67804
67805 2022-01-12  H.J. Lu  <hjl.tools@gmail.com>
67806
67807         elf: Add .relr.dyn to special_sections_r
67808                 * elf.c (special_sections_r): Add .relr.dyn.
67809
67810 2022-01-12  Andrew Burgess  <aburgess@redhat.com>
67811
67812         gdb: add 'maint set/show gnu-source-highlight enabled' command
67813         In a later commit I want to address an issue with the Python pygments
67814         based code styling solution.  As this approach is only used when the
67815         GNU Source Highlight library is not available, testing bugs in this
67816         area can be annoying, as it requires GDB to be rebuilt with use of GNU
67817         Source Highlight disabled.
67818
67819         This commit adds a pair of new maintenance commands:
67820
67821           maintenance set gnu-source-highlight enabled on|off
67822           maintenance show gnu-source-highlight enabled
67823
67824         these commands can be used to disable use of the GNU Source Highlight
67825         library, allowing me, in a later commit, to easily test bugs that
67826         would otherwise be masked by GNU Source Highlight being used.
67827
67828         I made this a maintenance command, rather than a general purpose
67829         command, as it didn't seem like this was something a general user
67830         would need to adjust.  We can always convert the maintenance command
67831         to a general command later if needed.
67832
67833         There's no test for this here, but this feature will be used in a
67834         later commit.
67835
67836 2022-01-12  Andrew Burgess  <aburgess@redhat.com>
67837
67838         gdb: erase items from the source_cache::m_offset_cache
67839         The source_cache class has two member variables m_source_map, which
67840         stores the file contents, and m_offset_cache, which stores offsets
67841         into the file contents.
67842
67843         As source files are read the contents of the file, as well as the
67844         offset data, are stored in the cache using these two member variables.
67845
67846         Whenever GDB needs either the files contents, or the offset data,
67847         source_cache::ensure is called.  This function looks for the file in
67848         m_source_map, and if it's found then this implies the file is also in
67849         m_offset_cache, and we're done.
67850
67851         If the file is not in m_source_map then GDB calls
67852         source_cache::get_plain_source_lines to open the file and read its
67853         contents.  ::get_plain_source_lines also calculates the offset data,
67854         which is then inserted into m_offset_cache.
67855
67856         Back in ::ensure, the file contents are added into m_source_map.  And
67857         finally, if m_source_map contains more than MAX_ENTRIES, an entry is
67858         removed from m_source_map.
67859
67860         The problem is entries are not removed from m_offset_cache at the same
67861         time.
67862
67863         This means that if a program contains enough source files, GDB will
67864         hold at most MAX_ENTRIES cached source file contents, but can contain
67865         offsets data for every source file.
67866
67867         Now, the offsets data is going to be smaller than the cached file
67868         contents, so maybe there's no harm here.  But, when we reload the file
67869         contents we always recalculate the offsets data.  And, when we
67870         ::get_line_charpos asking for offset data we still call ::ensure which
67871         will ends up loading and caching the file contents.
67872
67873         So, given the current code does the work of reloading the offset data
67874         anyway, we may as well save memory by capping m_offset_cache to
67875         MAX_ENTRIES just like we do m_source_map.
67876
67877         That's what this commit does.
67878
67879         There should be no user visible changes after this commit, except for
67880         ever so slightly lower memory usage in some cases.
67881
67882 2022-01-12  Andrew Burgess  <aburgess@redhat.com>
67883
67884         gdb: new 'maint flush source-cache' command
67885         This commit adds a new 'maint flush source-cache' command, this
67886         flushes the cache of source file contents.
67887
67888         After flushing GDB is forced to reread source files the next time any
67889         source lines are to be displayed.
67890
67891         I've added a test for this new feature.  The test is a little weird,
67892         in that it modifies a source file after compilation, and makes use of
67893         the cache flush so that the changes show up when listing the source
67894         file.  I'm not sure when such a situation would ever crop up in real
67895         life, but maybe we can imagine such cases.
67896
67897         In reality, this command is useful for testing the syntax highlighting
67898         within GDB, we can adjust the syntax highlighting settings, flush the
67899         cache, and then get the file contents re-highlighted using the new
67900         settings.
67901
67902 2022-01-12  Andrew Burgess  <aburgess@redhat.com>
67903
67904         gdb: rename lin-lwp to linux-nat in set/show debug
67905         Rename 'set debug lin-lwp' to 'set debug linux-nat' and 'show debug
67906         lin-lwp' to 'show debug linux-nat'.
67907
67908         I've updated the documentation and help text to match, as well as
67909         making it clear that the debug that is coming out relates to all
67910         aspects of Linux native inferior support, not just the LWP aspect of
67911         it.
67912
67913         The boundary between general "native" target debug, and the lwp
67914         specific part of that debug was always a little blurry, but the actual
67915         debug variable inside GDB is debug_linux_nat, and the print routine
67916         linux_nat_debug_printf, is used throughout the linux-nat.c file, not
67917         just for lwp related debug, so the new name seems to make more sense.
67918
67919 2022-01-12  Clément Chigot  <clement.chigot@atos.net>
67920
67921         ld: add hidden and internal visibility support for XCOFF
67922         This patch adds a primary support for hidden and internal visibility in
67923         GNU linker for XCOFF format.
67924         The protected visibility isn't yet supported.
67925
67926         PR 22085
67927
67928         bfd/ChangeLog:
67929
67930                 * xcofflink.c (xcoff_dynamic_definition_p): Add hidden
67931                   and internal visibility support.
67932                 (xcoff_link_add_symbols): Likewise.
67933                 (xcoff_auto_export_p): Likewise.
67934                 (bfd_xcoff_export_symbol): Likewise.
67935                 (xcoff_link_input_bfd): Likewise.
67936
67937         ld/ChangeLog:
67938
67939                 * testsuite/ld-vsb/main.c: Adapt for XCOFF.
67940                 * testsuite/ld-vsb/sh1.c: Likewse.
67941                 * testsuite/ld-vsb/vsb.exp: Likewise.
67942                 * testsuite/ld-vsb/visibility-1-xcoff-32.d: New test.
67943                 * testsuite/ld-vsb/visibility-1-xcoff-64.d: New test.
67944                 * testsuite/ld-vsb/visibility-2-xcoff-32.d: New test.
67945                 * testsuite/ld-vsb/visibility-2-xcoff-64.d: New test.
67946                 * testsuite/ld-vsb/xcoffvsb.dat: New test.
67947
67948 2022-01-12  Clément Chigot  <clement.chigot@atos.net>
67949
67950         ld/testsuite: prepare ld-elfvsb to support XCOFF
67951         A following patch will add visibility support in ld for XCOFF. Thus,
67952         ld-elfvsb is renamed ld-vsb and a suffix is added to files targeting only
67953         ELF format.
67954
67955         ld/ChangeLog:
67956
67957                 * testsuite/ld-elfvsb: rename as ld-vsb.
67958                 * testsuite/ld-elfvsb/hidden0.d: move to ld-vsb and rename with
67959                   suffix -elf.d.
67960                 * testsuite/ld-elfvsb/hidden1.d: Likewise.
67961                 * testsuite/ld-elfvsb/hidden2.d: Likewise.
67962                 * testsuite/ld-elfvsb/internal0.d: Likewise.
67963                 * testsuite/ld-elfvsb/internal1.d: Likewise.
67964                 * testsuite/ld-elfvsb/protected0.d: Likewise.
67965                 * testsuite/ld-elfvsb/protected1.d: Likewise.
67966
67967 2022-01-12  Clément Chigot  <clement.chigot@atos.net>
67968
67969         gas: add visibility support using GNU syntax on XCOFF
67970         In order to ease port of GNU assembly code and especially ld testsuite,
67971         this patch allows XCOFF to accept the usual GNU syntax for visibility.
67972
67973         PR 22085
67974
67975         gas/ChangeLog:
67976
67977                 * config/tc-ppc.c (ppc_GNU_visibility): New function.
67978                 * testsuite/gas/ppc/aix.exp: Add new tests.
67979                 * testsuite/gas/ppc/xcoff-visibility-2-32.d: New test.
67980                 * testsuite/gas/ppc/xcoff-visibility-2-64.d: New test.
67981                 * testsuite/gas/ppc/xcoff-visibility-2.s: New test.
67982
67983 2022-01-12  Clément Chigot  <clement.chigot@atos.net>
67984
67985         gas: add visibility support for XCOFF
67986         XCOFF assembly defines the visibility using an additional argument
67987         on several pseudo-ops: .globl, .weak, .extern and .comm.
67988         This implies that .globl and .weak syntax is different than the
67989         usual GNU syntax. But we want to provide compatibility with AIX
67990         assembler, especially because GCC is generating the visibility
67991         using this XCOFF syntax.
67992
67993         PR 22085
67994
67995         bfd/ChangeLog:
67996
67997                 * coffcode.h (coff_write_object_contents): Change XCOFF header
67998                 vstamp field to 2.
67999                 * coffgen.c (coff_print_symbol): Increase the size for n_type.
68000
68001         gas/ChangeLog:
68002
68003                 * config/tc-ppc.c (ppc_xcoff_get_visibility): New function.
68004                 (ppc_globl): New function.
68005                 (ppc_weak): New function.
68006                 (ppc_comm): Add visibility field support.
68007                 (ppc_extern): Likewise.
68008                 * testsuite/gas/all/cofftag.d: Adjust to new n_type size
68009                 providing by objdump.
68010                 * testsuite/gas/ppc/test1xcoff32.d: Likewise.
68011                 * testsuite/gas/ppc/aix.exp: Add new tests.
68012                 * testsuite/gas/ppc/xcoff-visibility-1-32.d: New test.
68013                 * testsuite/gas/ppc/xcoff-visibility-1-64.d: New test.
68014                 * testsuite/gas/ppc/xcoff-visibility-1.s: New test.
68015
68016         include/ChangeLog:
68017
68018                 * coff/internal.h (SYM_V_INTERNAL, SYM_V_HIDDEN,
68019                 SYM_V_PROTECTED, SYM_V_EXPORTED, SYM_V_MASK): New defines.
68020                 * coff/xcoff.h (struct xcoff_link_hash_entry): Add visibility
68021                 field.
68022
68023         ld/ChangeLog:
68024
68025                 * testsuite/ld-pe/pr19803.d: Adjust to new n_type size
68026                 providing by objdump.
68027
68028 2022-01-12  Hans-Peter Nilsson  <hp@axis.com>
68029
68030         objdump, readelf: Emit "CU:" format only when wide output is requested
68031         As pre-approved by Alan in
68032         https://sourceware.org/pipermail/binutils/2021-September/118019.html
68033         and I believe people have run into getting testsuite failures for
68034         test-environments with "long" directory names, at least once more
68035         since that time.  Enough.  I grepped the gas, binutils and ld
68036         testsuites for "CU:" to catch target-specific occurrences, but I
68037         noticed none.  I chose to remove "CU:" on the objdump tests instead of
68038         changing options to get the wide format, so as to keep the name of the
68039         test consistent with actual options; but added it to the readelf
68040         options for the gas test as I believe the "CU:" format is preferable.
68041
68042         Tested for cris-elf and native x86_64-pc-linux-gnu.
68043
68044         binutils:
68045                 * dwarf.c (display_debug_lines_decoded): Don't check the
68046                 string length of the directory, instead emit the "CU: dir/name"
68047                 format only if wide output is requested.
68048                 * testsuite/binutils-all/dw5.W, testsuite/binutils-all/objdump.WL:
68049                 Adjust accordingly.
68050
68051         gas:
68052                 * testsuite/gas/elf/dwarf-5-loc0.d: Add -W to readelf options.
68053
68054 2022-01-12  Alan Modra  <amodra@gmail.com>
68055
68056         Set SEC_ELF_REVERSE_COPY earlier
68057         For the sake of DT_RELR.
68058
68059         bfd/
68060                 * elflink.c (elf_link_input_bfd): Don't set SEC_ELF_REVERSE_COPY
68061                 here.  Move sanity checks to reverse copying code.
68062         ld/
68063                 * ldlang.c (lang_add_section): Set SEC_ELF_REVERSE_COPY for
68064                 .ctors/.dtors in .init_array/.fini_array.
68065
68066 2022-01-12  Tiezhu Yang  <yangtiezhu@loongson.cn>
68067
68068         gdb: testsuite: fix wrong comment in gdb.base/charset.c
68069         In gdb/testsuite/gdb.base/charset.c, use "IBM1047" instead of "EBCDIC"
68070         to fix the wrong comment.
68071
68072 2022-01-12  Tiezhu Yang  <yangtiezhu@loongson.cn>
68073
68074         gdb: testsuite: fix failed testcases in gdb.base/charset.exp
68075         In gdb/testsuite/gdb.base/charset.c, the last argument is greater than 127
68076         when call fill_run() in EBCDIC-US and IBM1047, but the type of string[] is
68077         char, this will change the value due to sign extension.
68078
68079         For example, ebcdic_us_string[7] will be -63 instead of the original 193 in
68080         EBCDIC-US.
68081
68082         Make the type of string[] as unsigned char to fix the following six failed
68083         testcases:
68084
68085           $ grep FAIL gdb/testsuite/gdb.sum
68086           FAIL: gdb.base/charset.exp: check value of parsed character literal in EBCDIC-US
68087           FAIL: gdb.base/charset.exp: check value of parsed string literal in EBCDIC-US
68088           FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in EBCDIC-US
68089           FAIL: gdb.base/charset.exp: check value of parsed character literal in IBM1047
68090           FAIL: gdb.base/charset.exp: check value of parsed string literal in IBM1047
68091           FAIL: gdb.base/charset.exp: check value of escape that doesn't exist in IBM1047
68092
68093 2022-01-12  GDB Administrator  <gdbadmin@sourceware.org>
68094
68095         Automatic date update in version.in
68096
68097 2022-01-11  Fangrui Song  <maskray@google.com>
68098
68099         ar: Add --thin for creating thin archives
68100         In many ar implementations (FreeBSD, elfutils, etc), -T has the X/Open
68101         System Interface specified semantics. Therefore -T for thin archives is
68102         not recommended for portability. -T is deprecated without diagnostics.
68103
68104             PR binutils/28759
68105             * ar.c (long_options): Add --thin.
68106             (usage) Add --thin. Deprecate -T without diagnostics.
68107             * doc/binutils.texi: Add doc.
68108             * NEWS: Mention --thin.
68109             * binutils/testsuite/binutils-all/ar.exp: Add tests.
68110
68111 2022-01-11  Martin Storsj  <martin@martin.st>
68112
68113         Fix multiple problems with DLL generation.
68114         ld      * pe-dll.c (make_head): Prefix the symbol name with the dll name.
68115                 (make_tail, make_one, make_singleton_name_thunk): Likewise.
68116                 (make_import_fixup_entry, make_runtime_pseudo_reloc): Likewise.
68117                 (pe_create_runtime_relocator_reference): Likewise.
68118                 (pe_dll_generate_implib): Set dll_symname_len.
68119                 (pe_process_import_defs): Likewise.
68120
68121         binutils
68122                 * dlltool.c (main): If a prefix has not been provided, attempt to
68123                 use a deterministic one based upon the dll name.
68124
68125 2022-01-11  Jan Beulich  <jbeulich@suse.com>
68126
68127         gas/doc: mention quoted symbol names
68128
68129 2022-01-11  Andrew Burgess  <aburgess@redhat.com>
68130
68131         gdbsupport: regenerate Makefile.in
68132         I had cause to regenerate gdbsupport/Makefile.in, and noticed some
68133         unexpected changes in the copyright header dates.
68134
68135         I suspect that this was caused by the end of year date range update
68136         process.
68137
68138         The Makefile.in contains two date ranges.  The first range appears to
68139         be the date range for the version of automake being used, that is the
68140         range runs up to 2017 only, when automake 1.15.1 was released.
68141
68142         The second date range in Makefile.in represents the date range for the
68143         generated file, and so, now runs up to 2022.
68144
68145         Anyway, this is the result of running autoreconf (using automake
68146         1.15.1) in the gdbsupport directory.
68147
68148 2022-01-11  GDB Administrator  <gdbadmin@sourceware.org>
68149
68150         Automatic date update in version.in
68151
68152 2022-01-10  Clément Chigot  <clement.chigot@atos.net>
68153
68154         XCOFF: add support for TLS relocations on hidden symbols
68155         This patch adds support for TLS relocation targeting C_HIDEXT symbols.
68156         In gas, TLS relocations, except R_TLSM and R_TLMSL, must keep the value
68157         of their target symbol.
68158         In ld, it simply ensures that internal TLS symbols are added to the
68159         linker hash table for xcoff_reloc_type_tls.
68160
68161         It also improves the tests made by both.
68162
68163         bfd/ChangeLog:
68164
68165                 * coff-rs6000.c (xcoff_howto_table): Fix name of R_TLSML.
68166                 (xcoff_reloc_type_tls): Replace the error when h is NULL by
68167                 an assert.
68168                 (xcoff_complain_overflow_unsigned_func): Adjust comments.
68169                 * coff64-rs6000.c (xcoff64_howto_table): Fix name of R_TLSML.
68170                 * xcofflink.c (xcoff_link_add_symbols_to_hash_table): New
68171                 function.
68172                 (xcoff_link_add_symbols): Add C_HIDEXT TLS symbols to the linker
68173                 hash table.
68174
68175         gas/ChangeLog:
68176
68177                 * config/tc-ppc.c (md_apply_fix): Enable support for TLS
68178                 relocation over internal symbols.
68179                 * testsuite/gas/ppc/aix.exp: Replace xcoff-tlms by xcoff-tls.
68180                 * testsuite/gas/ppc/xcoff-tlsm-32.d: Removed.
68181                 * testsuite/gas/ppc/xcoff-tlsm-64.d: Removed.
68182                 * testsuite/gas/ppc/xcoff-tlsm.s: Removed.
68183                 * testsuite/gas/ppc/xcoff-tls-32.d: New test.
68184                 * testsuite/gas/ppc/xcoff-tls-64.d: New test.
68185                 * testsuite/gas/ppc/xcoff-tls.s: New test.
68186
68187         ld/ChangeLog:
68188
68189                 * testsuite/ld-powerpc/aix52.exp: Improve aix-tls-reloc test.
68190                 * testsuite/ld-powerpc/aix-tls-reloc.s: Likewise.
68191                 * testsuite/ld-powerpc/aix-tls-reloc-32.d: Removed.
68192                 * testsuite/ld-powerpc/aix-tls-reloc-64.d: Removed.
68193                 * testsuite/ld-powerpc/aix-tls-reloc-32.dd: New test.
68194                 * testsuite/ld-powerpc/aix-tls-reloc-32.dt: New test.
68195                 * testsuite/ld-powerpc/aix-tls-reloc-64.dd: New test.
68196                 * testsuite/ld-powerpc/aix-tls-reloc-64.dt: New test.
68197
68198 2022-01-10  Tiezhu Yang  <yangtiezhu@loongson.cn>
68199
68200         gdb: add Tiezhu Yang to MAINTAINERS
68201
68202 2022-01-10  Tom Tromey  <tom@tromey.com>
68203
68204         Reduce use of unfiltered output in Darwin code
68205         The Darwin code uses unfiltered output liberally.  This patch changes
68206         this code to send some output to gdb_stdlog (in some cases via the use
68207         of debug_prefixed_printf_cond_nofunc), or to gdb_stderr, or to simply
68208         switch to filtered output.
68209
68210         Note that I didn't switch inferior_debug to use
68211         debug_prefixed_printf_cond_nofunc, because that would affect the
68212         output by removing the information about the inferior.  I wasn't sure
68213         if this was important or not, so I left it in.
68214
68215         v2 of this patch uses warning rather than prints to gdb_stderr, and
68216         removes some trailing whitespace.
68217
68218         I can't compile this patch, so it's "best effort".
68219
68220 2022-01-10  GDB Administrator  <gdbadmin@sourceware.org>
68221
68222         Automatic date update in version.in
68223
68224 2022-01-09  GDB Administrator  <gdbadmin@sourceware.org>
68225
68226         Automatic date update in version.in
68227
68228 2022-01-08  Andrew Burgess  <aburgess@redhat.com>
68229
68230         gdb/hurd: handle inferiors exiting
68231         While testing on GNU/Hurd (i386) I noticed that GDB crashes when an
68232         inferior exits, with this error:
68233
68234           inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.
68235
68236         The problem appears to be in gnu_nat_target::wait.
68237
68238         We always set inferior_ptid to null_ptid before calling target_wait,
68239         this has been the case since the multi-target changes were made to GDB
68240         in commit:
68241
68242           commit 5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2
68243           Date:   Fri Jan 10 20:06:08 2020 +0000
68244
68245               Multi-target support
68246
68247         With follow up changes in commit:
68248
68249           commit 24ed6739b699f329c2c45aedee5f8c7d2f54e493
68250           Date:   Thu Jan 30 14:35:40 2020 +0000
68251
68252               gdb/remote: Restore support for 'S' stop reply packet
68253
68254         Unfortunately, the GNU/Hurd target is still relying on the value of
68255         inferior_ptid in the case where an inferior exits - we return the
68256         value of inferior_ptid as the pid of the process that exited.  This
68257         was fine in the single target world, where inferior_ptid identified
68258         the one running inferior, but this is no longer good enough.
68259
68260         Instead, we should return a ptid containing the pid of the process
68261         that exited, as obtained from the wait event, and this is what this
68262         commit does.
68263
68264         I've not run the full testsuite on GNU/Hurd as there appear to be lots
68265         of other issues with this target that makes running the full testsuite
68266         very painful, but I think this looks like a small easy improvement.
68267
68268 2022-01-08  Tom Tromey  <tom@tromey.com>
68269
68270         Add explicit check for nullptr to target_announce_attach
68271         Lancelot pointed out that target_announce_attach was missing an
68272         explicit check against nullptr.  This patch adds it.
68273
68274 2022-01-08  Hannes Domani  <ssbssa@yahoo.de>
68275
68276         Add _sigsys info to siginfo struct
68277         This patch adds information about _sigsys structure from newer
68278         kernels, so that $_siginfo decoding can show information about
68279         _sigsys, making it easier for developers to debug seccomp failures.
68280         Requested in PR gdb/24283.
68281
68282         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24283
68283
68284 2022-01-08  Tiezhu Yang  <yangtiezhu@loongson.cn>
68285
68286         gdb: testsuite: show print array-indexes after set in arrayidx.exp
68287         Add "show print array-indexes" testcases after set print array-indexes
68288         to off or on.
68289
68290         Without this patch:
68291
68292             PASS: gdb.base/arrayidx.exp: set print array-indexes to off
68293             PASS: gdb.base/arrayidx.exp: print array with array-indexes off
68294             PASS: gdb.base/arrayidx.exp: set print array-indexes to on
68295             PASS: gdb.base/arrayidx.exp: print array with array-indexes on
68296
68297         With this patch:
68298
68299             PASS: gdb.base/arrayidx.exp: set print array-indexes to off
68300             PASS: gdb.base/arrayidx.exp: show print array-indexes is off
68301             PASS: gdb.base/arrayidx.exp: print array with array-indexes off
68302             PASS: gdb.base/arrayidx.exp: set print array-indexes to on
68303             PASS: gdb.base/arrayidx.exp: show print array-indexes is on
68304             PASS: gdb.base/arrayidx.exp: print array with array-indexes on
68305
68306 2022-01-08  H.J. Lu  <hjl.tools@gmail.com>
68307
68308         ld: Extract _bfd_elf_link_iterate_on_relocs
68309         DT_RELR encodes consecutive R_*_RELATIVE relocations in GOT (the global
68310         offset table) and data sections in a compact format:
68311
68312         https://groups.google.com/g/generic-abi/c/bX460iggiKg
68313
68314         On some targets, R_*_RELATIVE relocations are counted and the GOT offsets
68315         are allocated when setting the dynamic section sizes after seeing all
68316         relocations.  R_*_RELATIVE relocations are generated while relocating
68317         sections after section layout has been finalized.
68318
68319         To prepare for DT_RELR implementation on these targets, extract
68320         _bfd_elf_link_iterate_on_relocs from _bfd_elf_link_check_relocs so
68321         that a backend can scan relocations in elf_backend_always_size_sections
68322
68323         For x86 targets, the old check_relocs is renamed to scan_relocs and a
68324         new check_relocs is added to chek input sections and create dynamic
68325         relocation sections so that they will be mapped to output sections.
68326         scan_relocs is now called from elf_backend_always_size_sections.
68327
68328         Since relocations are scanned after __start, __stop, .startof. and
68329         .sizeof. symbols have been finalized on x86, __[start|stop]_SECNAME for
68330         --gc-sections -z start-stop-gc are now zero when all SECNAME sections
68331         been garbage collected.  This is no need for elf_x86_start_stop_gc_p.
68332
68333         bfd/
68334
68335                 * elf-bfd.h (_bfd_elf_link_iterate_on_relocs): New.
68336                 * elf32-i386.c (elf_i386_convert_load_reloc): Don't call
68337                 elf_x86_start_stop_gc_p.
68338                 (elf_i386_check_relocs): Renamed to ...
68339                 (elf_i386_scan_relocs): This.  Don't call
68340                 _bfd_elf_make_dynamic_reloc_section.
68341                 (elf_i386_always_size_sections): New.
68342                 (elf_backend_check_relocs): Removed.
68343                 (elf_backend_always_size_sections): New.
68344                 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Don't call
68345                 elf_x86_start_stop_gc_p.
68346                 (elf_x86_64_check_relocs): Renamed to ...
68347                 (elf_x86_64_scan_relocs): This.  Don't call
68348                 _bfd_elf_make_dynamic_reloc_section.
68349                 (elf_x86_64_always_size_sections): New.
68350                 (elf_backend_check_relocs): Removed.
68351                 (elf_backend_always_size_sections): New.
68352                 * elflink.c (elf_link_check_or_scan_relocs):
68353                 New.  Extracted from _bfd_elf_link_check_relocs.
68354                 (_bfd_elf_link_check_relocs): Call elf_link_check_or_scan_relocs.
68355                 * elfxx-x86.c (_bfd_x86_elf_check_relocs): New.
68356                 * elfxx-x86.h (X86_64_NEED_DYNAMIC_RELOC_TYPE_P): New.
68357                 (I386_NEED_DYNAMIC_RELOC_TYPE_P): Likewise.
68358                 (X86_NEED_DYNAMIC_RELOC_TYPE_P): Likewise.
68359                 (_bfd_x86_elf_check_relocs): Likewise.
68360                 (elf_backend_check_relocs): Likewise.
68361                 (elf_backend_always_size_sections): Removed.
68362                 (elf_x86_start_stop_gc_p): Likewise.
68363
68364         ld/
68365
68366                 * testsuite/ld-i386/pr27491-1a.d: Updated.
68367                 * testsuite/ld-x86-64/pr27491-1a.d: Likewise.
68368
68369 2022-01-08  GDB Administrator  <gdbadmin@sourceware.org>
68370
68371         Automatic date update in version.in
68372
68373 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68374
68375         gdb/testsuite: Remove duplicates from gdb.mi/mi-catch-load.exp
68376         When I run the testsuite, I have:
68377
68378             Running .../gdb/testsuite/gdb.mi/mi-catch-load.exp ...
68379             DUPLICATE: gdb.mi/mi-catch-load.exp: breakpoint at main
68380             DUPLICATE: gdb.mi/mi-catch-load.exp: mi runto main
68381
68382         Fix by grouping the various phases in with_test_prefix blocks.  Since
68383         the tests now have a prefix, remove the manually written prefixes in
68384         testnames.
68385
68386         Also change some messages with the pattern "(timeout) $testname" into
68387         "$estname (timeout)" since tools will handle this as $testname[1] (which
68388         is what we want in this particular scenario).
68389
68390         Tested on x86_64-linux.
68391
68392         [1] https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages
68393
68394 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68395
68396         gdb/testsuite: Remove duplicates from gdb.threads/staticthreads.ex
68397         When running the testsuite, I have:
68398
68399             Running .../gdb/testsuite/gdb.threads/staticthreads.exp ...
68400             DUPLICATE: gdb.threads/staticthreads.exp: couldn't compile staticthreads.c: unrecognized error
68401
68402         Fix by using foreach_with_prefix instead of foreach when preparing the
68403         test case.
68404
68405         Testeed on x86_64-linux both in a setup where the test fails to prepare
68406         and in a setup where the test fails to setup.
68407
68408 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68409
68410         gdb/testsuite: Remove duplicates from gdb.mi/mi-language.exp
68411         When running the testsuite, I have:
68412
68413             Running .../gdb/testsuite/gdb.mi/mi-language.exp ...
68414             DUPLICATE: gdb.mi/mi-language.exp: set lang ada
68415
68416         This is due to an erroneous explicit test name.  This explicit test name
68417         also happens to be useless (at least it would have been if it was
68418         correct) since it only repeats the command, so just remove the explicit
68419         test name and let the command be used as default test name.  Also remove
68420         explicit test name at another location in the file since it also just
68421         repeat the command.
68422
68423         Tested on x86_64-linux.
68424
68425 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68426
68427         gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop-exit.exp
68428         When running the testsuite, I have:
68429
68430             Running .../gdb/testsuite/gdb.mi/mi-nonstop-exit.exp ...
68431             DUPLICATE: gdb.mi/mi-nonstop-exit.exp: breakpoint at main
68432             DUPLICATE: gdb.mi/mi-nonstop-exit.exp: mi runto main
68433
68434         This test runs the same sequence of operations twice.  Refactor the code
68435         by running both of those sequences within a foreach_with_prefix block to
68436         ensure that the commands have unique test names.
68437
68438         Tested on x86_64-linux.
68439
68440 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68441
68442         gdb/testsuite: Remove duplicates from gdb.mi/mi-nonstop.exp
68443         When running the testsuite, I have:
68444
68445             Running .../gdb/testsuite/gdb.mi/mi-nonstop.exp ...
68446             DUPLICATE: gdb.mi/mi-nonstop.exp: check varobj, w1, 1
68447             DUPLICATE: gdb.mi/mi-nonstop.exp: stacktrace of stopped thread
68448
68449         Fix by adjusting the problematic test names.
68450
68451         Tested on x86_64-linux.
68452
68453 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68454
68455         gdb/testsuite: Remove duplicates from gdb.mi/mi-nsthrexec.exp
68456         When running the testsuite, I have:
68457
68458             Running .../gdb/testsuite/gdb.mi/mi-nsthrexec.exp ...
68459             DUPLICATE: gdb.mi/mi-nsthrexec.exp: breakpoint at main
68460
68461         Fix by adjusting the duplicated test name.
68462
68463         Tested on x86_64-linux.
68464
68465 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68466
68467         gdb/testsuite: Remove duplicates from gdb.base/watchpoints.exp
68468         When running the testsuite, I have:
68469
68470             Running ../gdb/testsuite/gdb.base/watchpoints.exp ...
68471             DUPLICATE: gdb.base/watchpoints.exp: watchpoint hit, first time
68472
68473         Fix by adjusting the test names where appropriate.
68474
68475         Tested on x86_64-linux.
68476
68477 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68478
68479         gdb/testsuite: Remove duplicates from gdb.base/nested-subp2.exp
68480         When running the testsuite, I have:
68481
68482             Running .../gdb/testsuite/gdb.base/nested-subp2.exp ...
68483             DUPLICATE: gdb.base/nested-subp2.exp: continue to the STOP marker
68484             DUPLICATE: gdb.base/nested-subp2.exp: print c
68485             DUPLICATE: gdb.base/nested-subp2.exp: print count
68486
68487         Fix by using with_test_prefix to differentiate the test that are
68488         performed at different points during the execution of the debuggee.
68489
68490         Tested on x86_64-linux.
68491
68492 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68493
68494         gdb/testsuite: Remove duplicates from gdb.base/call-signal-resume.exp
68495         When running the testsuite, I have:
68496
68497             Running .../gdb/testsuite/gdb.base/call-signal-resume.exp ...
68498             DUPLICATE: gdb.base/call-signal-resume.exp: dummy stack frame number
68499             DUPLICATE: gdb.base/call-signal-resume.exp: set confirm off
68500             DUPLICATE: gdb.base/call-signal-resume.exp: return
68501
68502         This is due to the fact that a pattern was probably copy/pasted to
68503         re-use the logic while not adjusting the test names to avoid the
68504         duplication.
68505
68506         Fix by removing the redundant tests ('set confirm off' only needs to be
68507         used once) and adjusting the test names where appropriate.
68508
68509         Tested on x86_64-linux.
68510
68511 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68512
68513         gdb/testsuite: Remove duplicates from gdb.base/pointers.exp
68514         When I run the testsuite, I have :
68515
68516             Running .../gdb/testsuite/gdb.base/pointers.exp ...
68517             DUPLICATE: gdb.base/pointers.exp: pointer assignment
68518
68519         Fix by placing the sections with duplication in with_test_prefix blocks.
68520         This removes the duplication and gives a better organization the file.
68521
68522         Tested on x86_64-linux.
68523         Co-Authored-By: Pedro Alves <pedro@palves.net>
68524
68525 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68526
68527         gdb/testsuite: Remove duplicates from gdb.base/unload.exp
68528         When running the testsuite, I have:
68529
68530             Running .../gdb/testsuite/gdb.base/unload.exp ...
68531             DUPLICATE: gdb.base/unload.exp: continuing to unloaded libfile
68532
68533         Fix by adjusting the test name.
68534
68535         Tested on x86_64-linux.
68536
68537 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68538
68539         gdb/testsuite: Remove duplicates from gdb.base/define-prefix.exp
68540         When running the testsuite, I have:
68541
68542             Running .../gdb/testsuite/gdb.base/define-prefix.exp ...
68543             DUPLICATE: gdb.base/define-prefix.exp: define user command: ghi-prefix-cmd
68544
68545         Fix by adjusting test names.
68546
68547         Tested on x86_64-linux.
68548
68549 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68550
68551         gdb/testsuite: Remove duplicates from gdb.base/funcargs.exp
68552         When running the testsuite, I have:
68553
68554             Running .../gdb/testsuite/gdb.base/funcargs.exp ...
68555             DUPLICATE: gdb.base/funcargs.exp: run to call2a
68556
68557         Fix by using proc_with_prefix instead on plain proc to create logical
68558         function blocks.
68559
68560         Tested on x86_64-linux.
68561
68562 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68563
68564         gdb/testsuite: Remove duplicates from gdb.base/shlib-call.exp
68565         When I run the testsuite, I have:
68566
68567             Running .../gdb/testsuite/gdb.base/shlib-call.exp ...
68568             DUPLICATE: gdb.base/shlib-call.exp: print g
68569             DUPLICATE: gdb.base/shlib-call.exp: set print sevenbit-strings
68570             DUPLICATE: gdb.base/shlib-call.exp: set print address off
68571             DUPLICATE: gdb.base/shlib-call.exp: set width 0
68572             DUPLICATE: gdb.base/shlib-call.exp: continue until exit
68573
68574         Fix by adjusting the test names when required, and by removing
68575         un-necessary commands.
68576
68577         While at it, do some cleanup:
68578         - Replace an explicit GDB restart sequence with a call to clean_restart.
68579         - Remove trailing whitespaces.
68580         - Use $gdb_test_name in gdb_test_multiple.
68581
68582         Tested on x86_64-linux.
68583
68584 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68585
68586         gdb/testsuite: Remove duplicates from gdb.base/set-cfd.exp
68587         When running the testsuite, I have:
68588
68589             Running .../gdb/testsuite/gdb.base/set-cwd.exp ...
68590             DUPLICATE: gdb.base/set-cwd.exp: test_cwd_reset: continue to breakpoint: break-here
68591
68592         Fix by moving the tests after the 'runto_main' within the same
68593         with_test_prefix scope.
68594
68595         While at it, I fix some indentation issues.
68596
68597         Tested on x86_64-linux.
68598
68599 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68600
68601         gdb/testsuite: Remove duplicates from gdb.base/exprs.exp
68602         When running the testsuite, I have:
68603
68604             Running .../gdb/testsuite/gdb.base/exprs.exp ...
68605             DUPLICATE: gdb.base/exprs.exp: \$[0-9]* = red (setup)
68606
68607         Fix by using with_test_prefix where appropriate.
68608
68609         Tested on x86_64-linux.
68610
68611 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68612
68613         gdb/testsuite: Remove duplicates from gdb.base/readline.exp
68614         When running the testsuite, I have:
68615
68616             Running .../gdb/testsuite/gdb.base/readline.exp ...
68617             DUPLICATE: gdb.base/readline.exp: Simple operate-and-get-next - final prompt
68618
68619         Fix by adjusting the prefix given to the second 'simple' call to
68620         operate_and_get_next.
68621
68622         Tested on x86_64-linux.
68623
68624 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68625
68626         gdb/testsuite: Remove duplicates from gdb.base/pretty-array.exp
68627         When I run the testsuite, I have:
68628
68629             Running .../gdb/testsuite/gdb.base/pretty-array.exp ...
68630             DUPLICATE: gdb.base/pretty-array.exp: print nums
68631             DUPLICATE: gdb.base/pretty-array.exp: print nums
68632
68633         Fix by giving a name to the test cases.
68634
68635         Tested on x86_64-linux.
68636
68637 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68638
68639         gdb/testsuite: Remove duplicates from gdb.base/ui-redirect.exp
68640         When running the testsuite, I have:
68641
68642             Running .../gdb/testsuite/gdb.base/ui-redirect.exp ...
68643             DUPLICATE: gdb.base/ui-redirect.exp: redirect while already logging: set logging redirect off
68644
68645         Fix by moving the first 'set logging redirect off' to the end of the
68646         previous [with_test_prefix] test block. The statement's purpose is to
68647         clean the on flag set in this previous block, so moving it there makes
68648         sense and does not change the sequence of commands in the test file.
68649
68650         Tested on x86_64-linux.
68651
68652 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68653
68654         gdb: completion-support.exp: improve leading whitespace support
68655         There is a expect support library in the source tree designed to help
68656         developers test the auto-completion capabilities of GDB.
68657
68658         One of the functions is test_gdb_complete_unique_re.  It is used
68659         (usually indirectly via test_gdb_complete_unique) to test that a given
68660         input line is completed as a given output line.  The test checks for two
68661         ways to do the completion: using tab-completion, or using the
68662         'complete' command.  To do this, calls to two dedicated functions are
68663         performed.  If we omit few details, we can consider that a call to
68664
68665             test_gdb_complete_unique $input $expected
68666
68667         is equivalent to the two following calls:
68668
68669             test_gdb_complete_tab_unique $input $expected
68670             test_gdb_complete_cmd_unique $input $expected
68671
68672         When using the tab-completion, everything works as expected, but some
68673         care must be taken when using the 'complete' command if the given input
68674         has leading whitespaces.  In such situation, the output of the
68675         'complete' command will drop the leading whitespaces.
68676
68677         The current approach is that in such situation, the input and expected
68678         outputs are right trimmed (i.e. all leading whitespaces are removed)
68679         when performing the command completion check.
68680
68681         This means that the following call:
68682
68683             test_gdb_complete_unique "   $input" "   $expected"
68684
68685         is almost equivalent to (again, omitting few details and arguments):
68686
68687             test_gdb_complete_tab_unique "   $input" "   $expected"
68688             test_gdb_complete_cmd_unique "$input" "$expected"
68689
68690         This approach comes with a problem that we encounter when running the
68691         tests in complete-empty.exp.  When doing so, we have:
68692
68693             Running .../gdb/testsuite/gdb.base/complete-empty.exp ...
68694             DUPLICATE: gdb.base/complete-empty.exp: empty-input-line: cmd complete ""
68695
68696         This is because the test file does something like:
68697
68698             test_gdb_complete_unique "" "!" " " 1
68699             test_gdb_complete_unique "   " "   !" " " 1¬
68700
68701         which, if we do the substitution introduced above is equivalent to:
68702
68703             test_gdb_complete_tab_unique "" "!"
68704             test_gdb_complete_cmd_unique "" "!"
68705             test_gdb_complete_tab_unique "   " "   !"
68706             test_gdb_complete_cmd_unique "" "!"
68707
68708         We see that the lines 2 and 4 are now the same, and for this reason the
68709         testing framework complains about DUPLICATE test names.
68710
68711         To fix that, this commit proposes that instead of left trimming both
68712         input and expected outputs, only the expected output is trimmed.
68713
68714         Care must be taken in the case the completion gives more possibilities
68715         than allowed by the max-completions setting.  In this case, the input
68716         will be repeated in the output in its left trimmed version.  This commit
68717         also ensures that this is taken care of.
68718
68719         With this commit, the gdb.base/complete-empty.exp still passes all its
68720         tests but does not report the DUPLICATE anymore.
68721
68722         Tested on x86_64-linux.
68723
68724 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68725
68726         gdb/testsuite: Remove duplicates from gdb.base/subst.exp
68727         When I run the testsuite, I have:
68728
68729             Running .../gdb/testsuite/gdb.base/subst.ex ...
68730             DUPLICATE: gdb.base/subst.exp: unset substitute-path from, no rule entered yet
68731
68732         Fix by adjusting the problematic test name.
68733
68734         Tested on x86_64-linux.
68735
68736 2022-01-07  Pedro Alves  <pedro@palves.net>
68737
68738         gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp
68739         When I run the testsuite, I have:
68740
68741             Running ../gdb/testsuite/gdb.base/dfp-exprs.exp ...
68742             DUPLICATE: gdb.base/dfp-exprs.exp: p 1.2dl < 1.3df
68743
68744         Replace hand-written tests checking various comparison operators between
68745         various decimal floating point types with a loop to programmatically
68746         generate all the combinations.  This removes the need to eyeball for all
68747         suffixes, which lead to the original duplication.
68748
68749         Also add a lot more combinations, testing all comparison operators
68750         comprehensively.  The result is 262 unique tests vs 104 before this
68751         patch.
68752
68753         Tested on x86_86-linux.
68754
68755         Change-Id: Id215a3d610aa8e032bf06ee160b5e3aed4a92d1e
68756
68757 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68758
68759         gdb/testsuite: Remove duplicates from gdb.base/ptype.exp
68760         When running the testsuite, I have:
68761
68762             Running .../gdb/testsuite/gdb.base/ptype.exp ...
68763             DUPLICATE: gdb.base/ptype.exp: ptype the_highest
68764             DUPLICATE: gdb.base/ptype.exp: list intfoo
68765             DUPLICATE: gdb.base/ptype.exp: list charfoo
68766
68767         Fix by adjusting the offending test names.
68768
68769         Tested on x86_64-linux.
68770
68771 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68772
68773         gdb/testsuite: Remove duplicates from gdb.base/dfp-test.exp
68774         When running the testsuite, I have:
68775
68776             Running .../gdb/testsuite/gdb.base/dfp-test.exp ...
68777             DUPLICATE: gdb.base/dfp-test.exp: 1.23E is an invalid number
68778             DUPLICATE: gdb.base/dfp-test.exp: 1.23E45A is an invalid number
68779             DUPLICATE: gdb.base/dfp-test.exp: 1.23E is an invalid number
68780             DUPLICATE: gdb.base/dfp-test.exp: 1.23E45A is an invalid number
68781
68782         Fix by using proc_with_prefix where appropriate.
68783
68784         Tested on x86_64-linux.
68785         Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
68786
68787 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68788
68789         gdb/testsuite: Remove duplicates from gdb.base/del.exp
68790         When running the testsuite, I have:
68791
68792             Running .../gdb/testsuite/gdb.base/del.exp ...
68793             DUPLICATE: gdb.base/del.exp: info break after removing break on main
68794
68795         Refactor slightly this test to run the various configurations under
68796         foreach_with_prefix so each variant is automatically prefixed, ensuring
68797         that the forgotten custom test name cannot happen.
68798
68799         Tested on x86_64-linux.
68800
68801 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68802
68803         gdb/testsuite: Remove duplicates from gdb.base/solib-display.exp
68804         When running the testsuite, I have:
68805
68806             Running .../gdb/testsuite/gdb.base/solib-display.exp ...
68807             DUPLICATE: gdb.base/solib-display.exp: NO: break 25
68808             DUPLICATE: gdb.base/solib-display.exp: NO: continue
68809             DUPLICATE: gdb.base/solib-display.exp: IN: break 25
68810             DUPLICATE: gdb.base/solib-display.exp: IN: continue
68811             DUPLICATE: gdb.base/solib-display.exp: SEP: break 25
68812             DUPLICATE: gdb.base/solib-display.exp: SEP: continue
68813
68814         The 'break 25' appears because the test inserts two breakpoints at the
68815         same location.  Fix this by only inserting the breakpoint once.
68816
68817         Fix the 'continue' DUPLICATE by giving a phony name to the second
68818         continue: 'continue two'.
68819
68820         While at it, this commit also removes a trailing space.
68821
68822         Tested on x86_64-linux.
68823
68824 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68825
68826         gdb/testsuite: Remove duplicates from gdb.base/decl-before-def.exp
68827         When running the testsuite, I have:
68828
68829             Running .../gdb/testsuite/gdb.base/decl-before-def.exp ...
68830             DUPLICATE: gdb.base/decl-before-def.exp: p a
68831
68832         Fix by giving explicit names to the two tests that use the same command.
68833
68834         Tested on x86_64-linux.
68835
68836 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68837
68838         gdb/testsuite: Remove duplicates from gdb.base/pending.exp
68839         When running the testsuite, I have:
68840
68841             Running .../gdb/testsuite/gdb.base/pending.exp ...
68842             DUPLICATE: gdb.base/pending.exp: disable other breakpoints
68843
68844         Fix by adjusting the test names.
68845
68846         Tested on x86_64-linux.
68847
68848 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68849
68850         gdb/testsuite: Remove duplicates from gdb.base/checkpoint.exp
68851         When running the testsuite, I have:
68852
68853             Running .../gdb/testsuite/gdb.base/checkpoint.exp ...
68854             DUPLICATE: gdb.base/checkpoint.exp: verify lines 5 two
68855             DUPLICATE: gdb.base/checkpoint.exp: restart 0 one
68856
68857         This patch fixes the various erroneous incorrect test names.
68858
68859         While at it, this patch also remove some trailing white spaces across
68860         the file.
68861
68862         Tested on x86_64-linux.
68863
68864 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68865
68866         gdb/testsuite: Remove duplicates from gdb.base/pie-fork.exp
68867         When running the testsuite, I have:
68868
68869             Running .../gdb/testsuite/gdb.base/pie-fork.exp ...
68870             DUPLICATE: gdb.base/pie-fork.exp: test_no_detach_on_fork: continue
68871
68872         Fix by giving explicit names to the 'continue' commands that cause the
68873         duplicate message.
68874
68875         Tested on x86_64-linux.
68876
68877 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68878
68879         gdb/testsuite: Remove duplicates from gdb.base/realname-expand.exp
68880         When running the testsuite, I have:
68881
68882             Running .../gdb/testsuite/gdb.base/realname-expand.exp ...
68883             DUPLICATE: gdb.base/realname-expand.exp: set basenames-may-differ on
68884
68885         This is due to the fact that the test restarts GDB twice and each time
68886         sets the basenames-may-differ setting.  This patch proposes to fix this
68887         by not restarting GDB so the setting is maintained.  It just clears the
68888         breakpoints between the two tests and updates the breakpoints number as
68889         required.
68890
68891         This patch also perform some minor refactorings to improve visibility.
68892
68893         Tested on x86_64-linux.
68894
68895 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68896
68897         gdb/testsuite: Remove duplicates from gdb.base/interp.exp
68898         When running the testsuite I have:
68899
68900             Running .../gdb/testsuite/gdb.base/interp.exp ...
68901             DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *"
68902
68903         This is due to the fact that multiple successive instances of
68904         gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd
68905         to a new test name.
68906
68907         Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set
68908         by gdb_test_multiple.
68909
68910         While fixing this, this patch refactors all occurrences of the following
68911         pattern:
68912
68913             set cmd foo
68914             gdb_test_multiple $cmd $cmd {
68915                 -re ... {
68916                     pass $cmd
68917                 }
68918             }
68919
68920         into
68921
68922             gdb_test_multiple foo "" {
68923                 -re ... {
68924                     pass $gdb_test_name
68925                  }
68926             }
68927
68928         This makes this test file coherent in its use of $gdb_test_name.
68929
68930         Tested on x86_64-linux.
68931
68932 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68933
68934         gdb/testsuite: Remove duplicates from gdb.base/miscexprs.exp
68935         When running the testsuite I see:
68936
68937             Running .../gdb/testsuite/gdb.base/miscexprs.exp ...
68938             DUPLICATE: gdb.base/miscexprs.exp: print value of !ibig.i[100]
68939             DUPLICATE: gdb.base/miscexprs.exp: print value of !ibig.i[100]
68940
68941         This is due to an explicit test name repeated across multiple tests.
68942         The actual test explicit names do not add much over the command from
68943         wich default test names are derived.
68944
68945         Fix by removing the explicit test names across the file where they do
68946         not add value.  While at doing some cleaning, also use $gdb_test_name in
68947         the various uses of gdb_test_multiple.
68948
68949         Tested on x86_64-linux.
68950
68951 2022-01-07  Lancelot SIX  <lsix@lancelotsix.com>
68952
68953         gdb/testsuite: Remove duplicates from gdb.base/stack-checking.exp
68954         When running the testsuite I have:
68955
68956             Running .../gdb/testsuite/gdb.base/stack-checking.exp ...
68957             DUPLICATE: gdb.base/stack-checking.exp: bt
68958             DUPLICATE: gdb.base/stack-checking.exp: bt
68959
68960         Fix by using with_test_prefix.
68961
68962         Tested on x86_64-linux.
68963
68964 2022-01-07  Philipp Tomsich  <philipp.tomsich@vrull.eu>
68965
68966         RISC-V: update docs to reflect privileged spec v1.9 has been dropped
68967         After commit d8af286fffa ("RISC-V: Drop the privileged spec v1.9
68968         support.") has removed support for privileged spec v1.9, this removes
68969         it from the documentation.
68970
68971         References: d8af286fffa ("RISC-V: Drop the privileged spec v1.9 support.")
68972
68973         gas/ChangeLog:
68974
68975                 * configure: Regenerate.
68976                 * configure.ac: Remove reference to priv spec 1.9.
68977                 * po/fr.po: Same.
68978                 * po/ru.po: Same.
68979                 * po/uk.po: Same.
68980
68981 2022-01-07  Philipp Tomsich  <philipp.tomsich@vrull.eu>
68982
68983         RISC-V: update docs for -mpriv-spec/--with-priv-spec for 1.12
68984         While support for the privileged spec was added in a63375ac337
68985         ("RISC-V: Hypervisor ext: support Privileged Spec 1.12"), the
68986         documentation has not been updated.  Add 1.12 to the relevant
68987         documentation.
68988
68989         References: a63375ac337 ("RISC-V: Hypervisor ext: support Privileged Spec 1.12")
68990
68991         gas/ChangeLog:
68992
68993                 * config/tc-riscv.c: Add 1.12 to the usage message.
68994                 * configure: Regenerate.
68995                 * configure.ac: Add 1.12 to the help/usage message.
68996                 * po/fr.po: Same.
68997                 * po/ru.po: Same.
68998                 * po/uk.po: Same.
68999
69000 2022-01-07  Tom Tromey  <tromey@adacore.com>
69001
69002         Do not use CC_HAS_LONG_LONG
69003         ax.cc checks CC_HAS_LONG_LONG, but nothing defines this.  However,
69004         PRINTF_HAS_LONG_LONG is checked in configure.  This patch removes the
69005         former and keeps the latter.  This is PR remote/14976 (filed by me in
69006         2012, lol).
69007
69008         I'm checking this in.
69009
69010         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=14976
69011
69012 2022-01-07  Andrew Burgess  <aburgess@redhat.com>
69013
69014         gdb/doc: shorten some source lines, and prevent some line breaks
69015         Building on the previous commit, this makes use of a trailing @ to
69016         split long @deffn lines in the guile.texi source file.  This splitting
69017         doesn't change how the document is laid out by texinfo.
69018
69019         I have also wrapped keyword and argument name pairs in @w{...} to
69020         prevent line breaks appearing between the two.  I've currently only
69021         done this for the longer @deffn lines, where a line break is
69022         possible.  This makes the @deffn lines much nicer to read in the
69023         generated pdf.
69024
69025 2022-01-07  Andrew Burgess  <aburgess@redhat.com>
69026
69027         gdb/doc: Remove (...) around guile procedure names in @deffn lines
69028         Most guile procedures in the guile.texi file are defined like:
69029
69030           @deffn {Scheme Procedure} name arg1 arg2 arg3
69031
69032         But there are two places where we do this:
69033
69034           @deffn {Scheme Procedure} (name arg1 arg2 arg3)
69035
69036         Notice the added (...).  Though this does represent how a procedure
69037         call is written in scheme, it's not the normal style throughout the
69038         manual.  I also checked the 'info guile' info page to see how they
69039         wrote there declarations, and they use the first style too.
69040
69041         The second style also has the drawback that index entries are added as
69042         '(name', and so they are grouped in the '(' section of the index,
69043         which is not very user friendly.
69044
69045         In this commit I've changed the definitions of make-command and
69046         make-parameter to use the first style.
69047
69048         The procedure declaration lines can get pretty long with all of the
69049         arguments, and this was true for both of the procedures I am changing
69050         in this commit.  I have made use of a trailing '@' to split the deffn
69051         lines, and keep them under 80 characters in the texi source.  This
69052         makes no difference to how the final document looks.
69053
69054         Finally, our current style for keyword arguments, appears to be:
69055
69056           [#:keyword-name argument-name]
69057
69058         I don't really understand the reason for this, 'info guile' just seems
69059         to use:
69060
69061           [#:keyword-name]
69062
69063         which seems just as good to me.  But I don't propose to change
69064         that just now.  What I do notice though, is that sometimes, texinfo
69065         will place a line break between the keyword-name and the
69066         argument-name, for example, the pdf of make-command is:
69067
69068           make-command name [#:invoke invoke] [#:command-class
69069             command-class] [#:completer-class completer] [#:prefix? prefix] [#:doc
69070             doc-string]
69071
69072         Notice the line break after '#:command-class' and after '#:doc',
69073         neither of which are ideal.  And so, for the two commands I am
69074         changing in this commit, I have made use of @w{...} to prevent line
69075         breaks between the keyword-name and the argument-name.  Now the pdf
69076         looks like this:
69077
69078           make-command name [#:invoke invoke]
69079             [#:command-class command-class] [#:completer-class completer]
69080             [#:prefix? prefix] [#:doc doc-string]
69081
69082         Which seems much better.  I'll probably update the other deffn lines
69083         at some point.
69084
69085 2022-01-07  Pavel Mayorov  <pmayorov@cloudlinux.com>
69086
69087         Revert previous delta to debug.c.  Replace with patch to reject indirect types that point to indirect types.
69088                 PR 28718
69089                 * dwarf.c: Revert previous delta.
69090                 (debug_get_real_type): Reject indirect types that point to
69091                 indirect types.
69092                 (debug_get_type_name, debug_get_type_size, debug_write_type):
69093                 Likewise.
69094
69095 2022-01-07  Nelson Chu  <nelson.chu@sifive.com>
69096
69097         RISC-V: Updated the default ISA spec to 20191213.
69098         Update the default ISA spec from 2.2 to 20191213 will change the default
69099         version of i from 2.0 to 2.1.  Since zicsr and zifencei are separated
69100         from i 2.1, users need to add them in the architecture string if they need
69101         fence.i and csr instructions.  Besides, we also allow old ISA spec can
69102         recognize zicsr and zifencei, but we won't output them since they are
69103         already included in the i extension when i's version is less than 2.1.
69104
69105         bfd/
69106                 * elfxx-riscv.c (riscv_parse_add_subset): Allow old ISA spec can
69107                 recognize zicsr and zifencei.
69108         gas/
69109                 * config/tc-riscv.c (DEFAULT_RISCV_ISA_SPEC): Updated to 20191213.
69110                 * testsuite/gas/riscv/csr-version-1p10.d: Added zicsr to -march since
69111                 the default version of i is 2.1.
69112                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
69113                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
69114                 * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
69115                 * testsuite/gas/riscv/option-arch-03.d: Updated i's version to 2.1.
69116                 * testsuite/gas/riscv/option-arch-03.s: Likewise.
69117         ld/
69118                 * testsuite/ld-riscv-elf/call-relax.d: Added zicsr to -march since
69119                 the default version of i is 2.1.
69120                 * testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated i's version to 2.1.
69121                 * testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise.
69122                 * testsuite/ld-riscv-elf/attr-merge-arch-01b.: Likewise.
69123                 * testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
69124                 * testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise.
69125                 * testsuite/ld-riscv-elf/attr-merge-arch-02b.s: Likewise.
69126                 * testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise.
69127                 * testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise.
69128                 * testsuite/ld-riscv-elf/attr-merge-arch-03b.s: Likewise.
69129                 * testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: Added zifencei
69130                 into Tag_RISCV_arch since it is added implied when i's version is
69131                 larger than 2.1.
69132
69133 2022-01-07  Alan Modra  <amodra@gmail.com>
69134
69135         Move elf_backend_always_size_sections earlier
69136                 * elflink.c (bfd_elf_size_dynamic_sections): Move plt/got init
69137                 earlier and call elf_backend_always_size_sections at the start
69138                 of this function.
69139
69140 2022-01-07  GDB Administrator  <gdbadmin@sourceware.org>
69141
69142         Automatic date update in version.in
69143
69144 2022-01-06  H.J. Lu  <hjl.tools@gmail.com>
69145
69146         ldelfgen.c: Add missing newlines when calling einfo
69147                 * ldelfgen.c (ldelf_map_segments): Add the missing newline to
69148                 einfo.
69149
69150 2022-01-06  Nick Clifton  <nickc@redhat.com>
69151
69152         Fix a stack exhaustion bug parsing malicious STABS format debug information.
69153                 PR 28718
69154                 * debug.c (debug_write_type): Allow for malicious recursion via
69155                 indirect debug types.
69156
69157 2022-01-06  Richard Sandiford  <richard.sandiford@arm.com>
69158
69159         aarch64: Add support for new SME instructions
69160         This patch adds support for three new SME instructions: ADDSPL,
69161         ADDSVL and RDSVL.  They behave like ADDPL, ADDVL and RDVL, but read
69162         the streaming vector length instead of the current vector length.
69163
69164         opcodes/
69165                 * aarch64-tbl.h (aarch64_opcode_table): Add ADDSPL, ADDSVL and RDSVL.
69166                 * aarch64-dis-2.c: Regenerate.
69167
69168         gas/
69169                 * testsuite/gas/aarch64/sme.s, testsuite/gas/aarch64/sme.d: Add tests
69170                 for ADDSPL, ADDSVL and RDSVL.
69171
69172 2022-01-06  Tom Tromey  <tom@tromey.com>
69173
69174         Use target_announce_detach in more targets
69175         target_announce_detach was added in commit 0f48b757 ("Factor out
69176         "Detaching from program" message printing").  There, Pedro wrote:
69177
69178             (For now, I left the couple targets that print this a bit differently
69179             alone.  Maybe this could be further pulled out into infcmd.c.  If we
69180             did that, and those targets want to continue printing differently,
69181             this new function could be converted to a target method.)
69182
69183         It seems to me that the differences aren't very big, and in some cases
69184         other targets handled the output a bit more nicely.  In particular,
69185         some targets will print a different message when exec_file==NULL,
69186         rather than printing the same output with an empty string as
69187         exec_file.
69188
69189         This patch incorporates the nicer output into target_announce_detach,
69190         then changes the remaining ports to use this function.
69191
69192 2022-01-06  Tom Tromey  <tom@tromey.com>
69193
69194         Introduce target_announce_attach
69195         This introduces target_announce_attach, by analog with
69196         target_announce_detach.  Then it converts existing targets to use
69197         this, rather than emitting their own output by hand.
69198
69199 2022-01-06  Andrew Burgess  <aburgess@redhat.com>
69200
69201         gdb: make use add_setshow_prefix_cmd in gnu-nat.c
69202         In gnu-nat.c we currently implement some set/show prefix commands
69203         "manually", that is, we call add_prefix_cmd, and assign a set and show
69204         function to each prefix command.
69205
69206         These set/show functions print an error indicating that the user
69207         didn't type a complete command.
69208
69209         If we instead switch to using add_setshow_prefix_cmd then we can
69210         delete the set/show functions, GDB provides some default functions,
69211         which give a nice help style summary that lists all of the available
69212         sub-commands, along with a one line summary of what each does.
69213
69214         Though this clearly changes the existing behaviour, I think this
69215         change is acceptable as the new behaviour is more inline with other
69216         set/show prefix commands, and the new behaviour is more informative.
69217
69218         This change will conflict with Tom's change here:
69219
69220           https://sourceware.org/pipermail/gdb-patches/2022-January/184724.html
69221
69222         Where Tom changes the set/show functions that I delete.  My suggestion
69223         is that the set/show functions still be deleted even after Tom's
69224         patch (or instead of Tom's patch).
69225
69226         For testing I've build GDB on GNU/Hurd, and manually tested these
69227         functions.  I did a grep over the testsuite, and don't believe the
69228         existing error messages are being checked for in any tests.
69229
69230 2022-01-06  Tom Tromey  <tom@tromey.com>
69231
69232         Use warning in windows-nat error messages
69233         A warning in windows-nat.c can be converted to use the warning
69234         function.  As a side effect, this arranges for the output to be sent
69235         to gdb_stderr.
69236
69237 2022-01-06  Tom Tromey  <tom@tromey.com>
69238
69239         Clean up some dead code in windows-tdep.c
69240         windows-tdep.c checks the result of xmalloc, which isn't necessary.  I
69241         initially removed this dead check, but then went a bit further and
69242         modified the code so that some "goto"s and explicit memory management
69243         could be removed.  Then, I added a couple of missing bounds checks.
69244
69245         I believe this also fixes a possible bug with a missing 0-termination
69246         of a string.  I am not certain, but that is why I think the existing
69247         code allocates a buffer that is 1 byte too long -- but then it fails
69248         to set this byte to 0.
69249
69250 2022-01-06  Tom Tromey  <tromey@adacore.com>
69251
69252         Avoid crash in language_info
69253         language_info calls:
69254
69255           show_language_command (NULL, 1, NULL, NULL);
69256
69257         ... "knowing" that show_language_command does not use its ui_file
69258         parameter.  However, this was changed in commit 7514a661
69259         ("Consistently Use ui_file parameter to show callbacks").
69260
69261         This patch changes language_info to pass a ui_file.
69262
69263         It took a while to write the test -- this function is only called when
69264         'verbose' is on and when switching the "expected" language in auto
69265         mode.
69266
69267 2022-01-06  Tom Tromey  <tromey@adacore.com>
69268
69269         Fix some failures in langs.exp
69270         langs.exp currently has some fails for me because the stack trace
69271         includes full paths to the source files.
69272
69273             FAIL: gdb.base/langs.exp: up to foo in langs.exp
69274             FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp
69275             FAIL: gdb.base/langs.exp: up to fsub in langs.exp
69276
69277         This fixes the failures by making the filename regexps a bit more lax.
69278
69279 2022-01-06  Jan Beulich  <jbeulich@suse.com>
69280
69281         x86: drop NoAVX insn attribute
69282         To avoid issues like that addressed by 6e3e5c9e4181 ("x86: extend SSE
69283         check to PCLMULQDQ, AES, and GFNI insns"), base the check on opcode
69284         attributes and operand types.
69285
69286         x86: drop NoAVX from POPCNT
69287         With the introduction of CpuPOPCNT the NoAVX attribute has become
69288         meaningless for POPCNT.
69289
69290         x86: drop some "comm" template parameters
69291         As already indicated in a remark when introducing these templates, the
69292         "commutative" attribute is ignored for legacy encoding templates. Hence
69293         it is possible to shorten a number of templates by specifying C directly
69294         rather than through a template parameter. I think this helps readability
69295         a bit.
69296
69297         x86: templatize FMA insn templates
69298         The operand ordering portion of the mnemonics repeats, causing a flurry
69299         of almost identical templates. Abstract this out.
69300
69301         x86-64: restrict PC32 -> PLT32 conversion
69302         Neither non-64-bit code nor uses with a non-zero offset from a symbol
69303         should be converted to PLT32, as an eventual PLT entry would not express
69304         what was requested.
69305
69306 2022-01-06  Lancelot SIX  <lancelot.six@amd.com>
69307
69308         gdb: Fix copyright year in gdb/testsuite/gdb.base/inferior-clone.exp
69309         I just realized that I forgot to update the year before pushing the
69310         patch that created this file.  Since it landed after the global
69311         copyright year update have been done, this file’s copyright year is
69312         updated.
69313
69314         This patch fixes that.
69315
69316         Change-Id: I280f7d86e02d38425f7afdcf19a1c3500d51c23f
69317
69318 2022-01-06  Mike Frysinger  <vapier@gentoo.org>
69319
69320         sim: ppc: migrate to standard uintXX_t types
69321         Drop the sim-specific unsignedXX types and move to the standard uintXX_t
69322         types that C11 provides.
69323
69324         sim: common: migrate to standard uintXX_t types
69325         Drop the sim-specific unsignedXX types and move to the standard uintXX_t
69326         types that C11 provides.
69327
69328         sim: igen: migrate to standard uintXX_t types
69329         Move off the custom local 64-bit types and to the standard uintXX_t
69330         types that C11 provides.
69331
69332         sim: mips: migrate to standard uintXX_t types
69333         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69334         types that C11 provides.
69335
69336         sim: cris: migrate to standard uintXX_t types
69337         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69338         types that C11 provides.
69339
69340         sim: iq2000: migrate to standard uintXX_t types
69341         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69342         types that C11 provides.
69343
69344         sim: synacor: migrate to standard uintXX_t types
69345         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69346         types that C11 provides.
69347
69348         sim: msp430: migrate to standard uintXX_t types
69349         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69350         types that C11 provides.
69351
69352         sim: riscv: migrate to standard uintXX_t types
69353         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69354         types that C11 provides.
69355
69356         sim: bfin: migrate to standard uintXX_t types
69357         Move off the sim-specific unsignedXX types and to the standard uintXX_t
69358         types that C11 provides.
69359
69360         sim: testsuite: migrate to standard uintXX_t types
69361         This old code setup its own uintXX types, but since we require C11
69362         now, we can assume the standard uintXX_t types exist and use them.
69363
69364         sim: erc32: migrate to standard uintXX_t types
69365         This old port setup its own uintXX types, but since we require C11
69366         now, we can assume the standard uintXX_t types exist and use them.
69367
69368         sim: mn10300: migrate to standard uintXX_t types
69369         This old port setup its own uintXX types, but since we require C11
69370         now, we can assume the standard uintXX_t types exist and use them.
69371
69372         sim: v850: migrate to standard uintXX_t types
69373         This old port setup its own uintXX types, but since we require C11
69374         now, we can assume the standard uintXX_t types exist and use them.
69375
69376 2022-01-06  Mike Frysinger  <vapier@gentoo.org>
69377
69378         sim: m68hc11: migrate to standard uintXX_t types
69379         This old port setup its own uintXX types, but since we require C11
69380         now, we can assume the standard uintXX_t types exist and use them.
69381
69382         Also migrate off the sim-specific unsignedXX types.
69383
69384 2022-01-06  Mike Frysinger  <vapier@gentoo.org>
69385
69386         sim: d10v: migrate to standard uintXX_t types
69387         This old port setup its own uintXX types, but since we require C11
69388         now, we can assume the standard uintXX_t types exist and use them.
69389
69390         Also migrate off the sim-specific unsignedXX types.
69391
69392 2022-01-06  Mike Frysinger  <vapier@gentoo.org>
69393
69394         sim: cr16: migrate to standard uintXX_t types
69395         This old port setup its own uintXX types, but since we require C11
69396         now, we can assume the standard uintXX_t types exist and use them.
69397
69398         Also migrate off the sim-specific unsignedXX types.
69399
69400 2022-01-06  GDB Administrator  <gdbadmin@sourceware.org>
69401
69402         Automatic date update in version.in
69403
69404 2022-01-05  H.J. Lu  <hjl.tools@gmail.com>
69405
69406         x86: Add elf_x86_allocate_local_got_info
69407         Add elf_x86_allocate_local_got_info to allocate x86 GOT info for local
69408         symbols.
69409
69410                 * elf32-i386.c (elf_i386_check_relocs): Call
69411                 elf_x86_allocate_local_got_info.
69412                 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
69413                 * elfxx-x86.h (elf_x86_allocate_local_got_info): New.
69414
69415 2022-01-05  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
69416
69417         opcodes: Make i386-dis.c thread-safe
69418         Improve thread safety in print_insn_i386_att, print_insn_i386_intel and
69419         print_insn_i386 by removing the use of static variables.
69420
69421         Tested on x86_64-pc-linux-gnu.
69422
69423         2022-01-04 Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
69424
69425                 * i386-dis.c: Make print_insn_i386_att, print_insn_i386_intel
69426                 and print_insn_i386 thread-safe
69427
69428 2022-01-05  H.J. Lu  <hjl.tools@gmail.com>
69429
69430         doc: Replace =frame-interp with =frames-interp
69431         The actual objdump and readelf option name is =frames-interp, not
69432         =frames-interp.
69433
69434                 PR binutils/28747
69435                 * doc/debug.options.texi: Replace =frame-interp with
69436                 =frames-interp.
69437
69438 2022-01-05  Tom Tromey  <tromey@adacore.com>
69439
69440         Change riscv_return_value to use RETURN_VALUE_ABI_PRESERVES_ADDRESS
69441         Internally, AdaCore has a test that is equivalent to (really a direct
69442         translation of) gdb.base/gnu_vector.exp.  On 32-bit RISC-V, the
69443         "return" part of this test fails.
69444
69445         Joel tracked this down to riscv_return_value returning
69446         RETURN_VALUE_ABI_RETURNS_ADDRESS.  Using
69447         RETURN_VALUE_ABI_PRESERVES_ADDRESS is more correct here, and fixes the
69448         bug.
69449
69450         I tested this for both 32- and 64-bit RISC-V using the AdaCore
69451         internal test suite, and Andrew Burgess tested it using
69452         gnu_vector.exp.
69453
69454 2022-01-05  Tom Tromey  <tom@tromey.com>
69455
69456         Filtered output cleanup in expression dumping
69457         Most of the expression-dumping code uses filtered output, but a few
69458         functions did not.  This patch cleans up these instance.
69459
69460         Note that this won't cause any behavior change, because the only calls
69461         to dump_prefix_expression pass in gdb_stdlog.  However, in the long
69462         run it's easier to audit the code if the number of uses of _unfiltered
69463         is reduced.
69464
69465 2022-01-05  Tom Tromey  <tom@tromey.com>
69466
69467         Use filtered output in terminal_info implementations
69468         This changes one terminal_info implementation, and
69469         default_terminal_info, to use filtered output.  Other implementations
69470         of this method already use filtered output.
69471
69472         I can't compile go32-nat.c, so this is a 'best effort' patch.
69473
69474 2022-01-05  Tom Tromey  <tom@tromey.com>
69475
69476         Use filtered output in gnu-nat.c commands
69477         gnu-nat.c has a number of ordinary commands that should use filtered
69478         output.  In a few cases, I changed the output to use gdb_stderr as
69479         well.  I can't compile this file, so this patch is split out as a
69480         "best effort".
69481
69482         Use filtered output in *-tdep commands
69483         Various targets introduce their own commands, which then use
69484         unfiltered output.  It's better to use filtered output by default, so
69485         this patch fixes the instances I found.
69486
69487         Use filtered output in btrace-related commands
69488         This changes btrace.c and record-btrace.c to use filtered output in
69489         the commands implemented there.
69490
69491         Use filtered output in some dumping commands
69492         There are several commands that may optionally send their output to a
69493         file -- they take an optional filename argument and open a file.  This
69494         patch changes these commands to use filtered output.  The rationale
69495         here is that, when printing to gdb_stdout, filtering is appropriate --
69496         it is, and should be, the default for all commands.  And, when writing
69497         to a file, paging will not happen anyway (it only happens when the
69498         stream==gdb_stdout), so using the _filtered form will not change
69499         anything.
69500
69501         Use filtered output in kill command
69502         This changes the kill command to use filtered output.  I split this
69503         one into its own patch because, out of an abundance of caution, I
69504         changed the function to call bfd_cache_close_all a bit earlier, in
69505         case pagination caused an exception.
69506
69507 2022-01-05  Tom Tromey  <tom@tromey.com>
69508
69509         Use filtered output in ordinary commands
69510         Many otherwise ordinary commands choose to use unfiltered output
69511         rather than filtered.  I don't think there's any reason for this, so
69512         this changes many such commands to use filtered output instead.
69513
69514         Note that complete_command is not touched due to a comment there
69515         explaining why unfiltered output is believed to be used.
69516
69517 2022-01-05  Tom Tromey  <tom@tromey.com>
69518
69519         Use filtered output in language_info
69520         Change language_info to use filtered output.  This is ok because the
69521         sole caller uses filtered output elsewhere, and because this function
69522         calls show_language_command, which also uses filtered output.
69523
69524         Use filtered output in files_info implementations
69525         This changes the implementations of the target files_info method to
69526         use filtered output.  This makes sense because the sole caller of this
69527         method is an ordinary command (info_program_command).  This patch
69528         changes this command to use filtered output as well.
69529
69530         Use filtered output in target-descriptions.c
69531         target-descriptions.c uses unfiltered output.  However, if you happen
69532         to invoke this command interactively, it's probably better for it to
69533         use filtering.  For non-interactive use, this doesn't matter.
69534
69535         Use filtered output for gdbarch dump
69536         This changes gdbarch dumping to use filtered output.  This seems a bit
69537         better to me, both on the principle that this is an ordinary command,
69538         and because the output can be voluminous, so it may be nice to stop in
69539         the middle.
69540
69541 2022-01-05  Tom Tromey  <tom@tromey.com>
69542
69543         Implement putstr and putstrn in ui_file
69544         In my tour of the ui_file subsystem, I found that fputstr and fputstrn
69545         can be simplified.  The _filtered forms are never used (and IMO
69546         unlikely to ever be used) and so can be removed.  And, the interface
69547         can be simplified by removing a callback function and moving the
69548         implementation directly to ui_file.
69549
69550         A new self-test is included.  Previously, I think nothing was testing
69551         this code.
69552
69553         Regression tested on x86-64 Fedora 34.
69554
69555 2022-01-05  Tom Tromey  <tromey@adacore.com>
69556
69557         Change how versioned symbols are recorded
69558         A change to BFD caused a gdb regression when using the Ada "catch
69559         exception" feature.  The bug is visible when a shared library throws
69560         an exception that is caught in the main executable.
69561
69562         This was discussed here:
69563
69564         https://sourceware.org/pipermail/binutils/2021-July/117538.html
69565
69566         This patch implements Alan's proposed fix, namely to use VERSYM_HIDDEN
69567         rather than the name when deciding to install a version-less symbol.
69568
69569         The internal test case is identical to the catch_ex_std.exp that is
69570         in-tree, so I haven't added a new test.  I could not make that one
69571         fail on x86-64 Linux, though.  It's possible that maybe I'd have to
69572         update the system linker first, but I didn't want to try that.
69573
69574         Regression tested on x86-64 Fedora 32.
69575
69576 2022-01-05  Hannes Domani  <ssbssa@yahoo.de>
69577
69578         Fix inferior_thread attribute in new_thread event
69579         Commit 72ee03ff58 fixed a use-after-move bug in add_thread_object, but
69580         it changed the inferior_thread attribute to contain the inferior instead
69581         of the actual thread.
69582         This now uses the thread_obj in its new location instead.
69583
69584         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28429
69585
69586 2022-01-05  Tom Tromey  <tom@tromey.com>
69587
69588         Simplify execute_control_commands_to_string
69589         execute_control_commands_to_string can be rewritten in terms of
69590         execute_fn_to_string, which consolidates some knowledge about which
69591         streams to redirect.
69592
69593         Regression tested on x86-64 Fedora 34.
69594
69595 2022-01-05  Tom Tromey  <tromey@adacore.com>
69596
69597         Do not print anything when self-backtrace unavailable
69598         Right now, gdb's self-backtrace feature will still print something
69599         when a backtrace is unavailable:
69600
69601            sig_write (_("----- Backtrace -----\n"));
69602         [...]
69603              sig_write (_("Backtrace unavailable\n"));
69604             sig_write ("---------------------\n");
69605
69606         However, if GDB_PRINT_INTERNAL_BACKTRACE is undefined, it seems better
69607         to me to print nothing at all.
69608
69609         This patch implements this change.  It also makes a couple of other
69610         small changes in this same module: it adds a header guard to
69611         bt-utils.h, and it protects the definitions of
69612         gdb_internal_backtrace_1 with a check of GDB_PRINT_INTERNAL_BACKTRACE.
69613
69614 2022-01-05  Tom Tromey  <tromey@adacore.com>
69615
69616         Fix pager regression
69617         The patch to fix paging with redirection caused a regression in the
69618         internal AdaCore test suite.  The problem occurs when running an MI
69619         command from the CLI using interpreter-exec, when paging is enabled.
69620         This scenario isn't covered by the current test suite, so this patch
69621         includes a new test.
69622
69623         The problem is that, in this situation, MI does:
69624
69625           fputs_unfiltered (strcmp (context->command, "target-select") == 0
69626                              ? "^connected" : "^done", mi->raw_stdout);
69627
69628         Here raw_stdout is a stdio_file wrapping stdout, so the pager thinks
69629         that it is ok to buffer the output.  However, in this setup, it isn't
69630         ok, and flushing the wrap buffer doesn't really work properly.  Also,
69631         MI next does:
69632
69633           mi_out_put (uiout, mi->raw_stdout);
69634
69635         ... but this uses ui_file::write, which also doesn't flush the wrap
69636         buffer.
69637
69638         I think all this will be fixed by the pager rewrite series I'm working
69639         on.  However, in the meantime, adding the old gdb_stdout check back to
69640         the pager fixes this problem.
69641
69642         Regression tested on x86-64 Fedora 34.
69643
69644 2022-01-05  H.J. Lu  <hjl.tools@gmail.com>
69645
69646         elf: Set p_align to the minimum page size if possible
69647         Currently, on 32-bit and 64-bit ARM, it seems that ld generates p_align
69648         values of 0x10000 even if no section alignment is greater than 0x1000.
69649         The issue is more general and probably affects other targets with multiple
69650         page sizes.
69651
69652         While file layout absolutely must take 64K page size into account, that
69653         does not have to be reflected in the p_align value.  If running on a 64K
69654         kernel, the file will be loaded at a 64K page boundary by necessity. On
69655         a 4K kernel, 64K alignment is not needed.
69656
69657         The glibc loader has been fixed to honor p_align:
69658
69659         https://sourceware.org/bugzilla/show_bug.cgi?id=28676
69660
69661         similar to kernel:
69662
69663         commit ce81bb256a224259ab686742a6284930cbe4f1fa
69664         Author: Chris Kennelly <ckennelly@google.com>
69665         Date:   Thu Oct 15 20:12:32 2020 -0700
69666
69667             fs/binfmt_elf: use PT_LOAD p_align values for suitable start address
69668
69669         This means that on 4K kernels, we will start to do extra work for 64K
69670         p_align, but this pointless for pretty much all binaries (whose section
69671         alignment rarely exceeds 16).
69672
69673         The minimum page size is used, instead of the maximum section alignment
69674         due to this glibc bug:
69675
69676         https://sourceware.org/bugzilla/show_bug.cgi?id=28688
69677
69678         It has been fixed in glibc 2.35.  But linker output must work on existing
69679         glibc binaries.
69680
69681         1. Set p_align to the minimum page size while laying out segments aligning
69682         to the maximum page size or section alignment.  The run-time loader can
69683         align segments to the minimum page size or above, depending on system page
69684         size.
69685         2. If -z max-page-size=NNN is used, p_align will be set to the maximum
69686         page size or the largest section alignment.
69687         3. If a section requires alignment higher than the minimum page size,
69688         don't set p_align to the minimum page size.
69689         4. If a section requires alignment higher than the maximum page size,
69690         set p_align to the section alignment.
69691         5. For objcopy, when the minimum page size != the maximum page size,
69692         p_align may be set to the minimum page size while segments are aligned
69693         to the maximum page size.  In this case, the input p_align will be
69694         ignored and the maximum page size will be used to align the ouput
69695         segments.
69696         6. Update linker to disallow the common page size > the maximum page size.
69697         7. Update linker to avoid the common page size > the maximum page size.
69698         8. Adjust pru_irq_map-1.d to expect p_align == sh_addralign:
69699
69700         Section Headers:
69701           [Nr] Name   Type            Addr     Off    Size   ES Flg Lk Inf Al
69702           [ 0]        NULL            00000000 000000 000000 00      0   0  0
69703           [ 1] .text  PROGBITS        20000000 00007c 000004 00  AX  0   0  4
69704         ...
69705         Program Headers:
69706           Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
69707           LOAD           0x000074 0x00000000 0x00000000 0x00008 0x00008 RW  0x1
69708           LOAD           0x00007c 0x20000000 0x20000000 0x00004 0x00004 R E 0x4
69709
69710         vs.
69711
69712         Section Headers:
69713           [Nr] Name   Type            Addr     Off    Size   ES Flg Lk Inf Al
69714           [ 0]        NULL            00000000 000000 000000 00      0   0  0
69715           [ 1] .text  PROGBITS        20000000 00007c 000004 00  AX  0   0  4
69716         ...
69717         Program Headers:
69718           Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
69719           LOAD           0x000074 0x00000000 0x00000000 0x00008 0x00008 RW  0x1
69720           LOAD           0x00007c 0x20000000 0x20000000 0x00004 0x00004 R E 0x1
69721
69722         To enable this linker optimization, the backend should define ELF_P_ALIGN
69723         to ELF_MINPAGESIZE.
69724
69725         bfd/
69726
69727                 PR ld/28689
69728                 PR ld/28695
69729                 * elf-bfd.h (elf_backend_data): Add p_align.
69730                 * elf.c (assign_file_positions_for_load_sections): Set p_align
69731                 to the default p_align value while laying out segments aligning
69732                 to maximum page size or section alignment.
69733                 (elf_is_p_align_valid): New function.
69734                 (copy_elf_program_header): Call elf_is_p_align_valid to determine
69735                 if p_align is valid.
69736                 * elfxx-target.h (ELF_P_ALIGN): New.  Default to 0.
69737                 (elfNN_bed): Add ELF_P_ALIGN.
69738                 * elfxx-x86.h (ELF_P_ALIGN): New.  Set to ELF_MINPAGESIZE.
69739
69740         include/
69741
69742                 PR ld/28689
69743                 PR ld/28695
69744                 * bfdlink.h (bfd_link_info): Add maxpagesize_is_set.
69745
69746         ld/
69747
69748                 PR ld/28689
69749                 PR ld/28695
69750                 * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Set
69751                 link_info.maxpagesize_is_set for -z max-page-size=NNN.
69752                 * ldelf.c (ldelf_after_parse): Disallow link_info.commonpagesize
69753                 > link_info.maxpagesize.
69754                 * testsuite/ld-elf/elf.exp: Pass -z max-page-size=0x4000 to
69755                 linker to build mbind2a and mbind2b.
69756                 * testsuite/ld-elf/header.d: Add -z common-page-size=0x100.
69757                 * testsuite/ld-elf/linux-x86.exp: Add PR ld/28689 tests.
69758                 * testsuite/ld-elf/p_align-1.c: New file.
69759                 * testsuite/ld-elf/page-size-1.d: New test.
69760                 * testsuite/ld-elf/pr26936.d: Add -z common-page-size=0x1000.
69761                 * testsuite/ld-elf/seg.d: Likewise.
69762                 * testsuite/ld-scripts/rgn-at5.d: Likewise.
69763                 * testsuite/ld-pru/pru_irq_map-1.d: Append 1 to name.  Adjust
69764                 expected PT_LOAD segment alignment.
69765                 * testsuite/ld-pru/pru_irq_map-2.d: Append 2 to name.
69766                 * testsuite/ld-scripts/pr23571.d: Add -z max-page-size=0x1000.
69767
69768 2022-01-05  Alan Modra  <amodra@gmail.com>
69769
69770         Adjust quoted-sym-names test
69771         Some targets restrict symbol addresses in .text to instruction
69772         boundaries.
69773
69774                 * testsuite/gas/all/quoted-sym-names.s: Define syms in .data.
69775                 * testsuite/gas/all/quoted-sym-names.d: Adjust to suit.
69776
69777 2022-01-05  Alan Modra  <amodra@gmail.com>
69778
69779         infinite recursion detected in gold testcase
69780         gold/testsuite/icf_test.cc:32:5: error: infinite recursion detected [-Werror=infinite-recursion]
69781            32 | int kept_func()
69782               |     ^~~~~~~~~
69783
69784                 * testsuite/icf_test.cc: Avoid infinite recursion error.
69785
69786 2022-01-05  GDB Administrator  <gdbadmin@sourceware.org>
69787
69788         Automatic date update in version.in
69789
69790 2022-01-04  H.J. Lu  <hjl.tools@gmail.com>
69791
69792         ld/x86: Update -z report-relative-reloc
69793         Use 0x%v, instead of bfd_sprintf_vma, to report relative relocations.
69794         Change linker relative relocations report from
69795
69796         tmpdir/dump: R_X86_64_IRELATIVE (offset: 0x0000000000002000, info: 0x0000000000000025, addend: 0x0000000000001007) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
69797
69798         to
69799
69800         tmpdir/dump: R_X86_64_IRELATIVE (offset: 0x2000, info: 0x25, addend: 0x1007) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
69801
69802         bfd/
69803
69804                 * elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): Use
69805                 0x%v instead of bfd_sprintf_vma.
69806
69807         ld/
69808
69809                 * testsuite/ld-i386/report-reloc-1.l: Updated.
69810                 * testsuite/ld-x86-64/report-reloc-1.l: Likewise.
69811
69812 2022-01-04  H.J. Lu  <hjl.tools@gmail.com>
69813
69814         ld: Improve thin archive member error message
69815         Improve thin archive member error message with:
69816
69817         ld: libbar.a(bar.o): error opening thin archive member: No such file or directory
69818
69819         instead of
69820
69821         ld: libbar.a: error adding symbols: No such file or directory
69822
69823                 PR ld/28722
69824                 * archive.c (_bfd_get_elt_at_filepos): Add a pointer argument
69825                 for struct bfd_link_info.  Call linker callback when failing to
69826                 open thin archive member.
69827                 (_bfd_generic_get_elt_at_index): Pass NULL to
69828                 _bfd_get_elt_at_filepos.
69829                 (bfd_generic_openr_next_archived_file): Likewise.
69830                 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Add a pointer
69831                 argument for struct bfd_link_info and pass it to
69832                 _bfd_get_elt_at_filepos.
69833                 (alpha_ecoff_openr_next_archived_file): Pass NULL to
69834                 _bfd_get_elt_at_filepos.
69835                 (alpha_ecoff_get_elt_at_index): Likewise.
69836                 * coff-rs6000.c (_bfd_xcoff_openr_next_archived_file): Likewise.
69837                 * ecoff.c (ecoff_link_add_archive_symbols): Pass info to
69838                 backend->get_elt_at_filepos.
69839                 * elflink.c (elf_link_is_defined_archive_symbol): info to
69840                 _bfd_get_elt_at_filepos.
69841                 * libbfd-in.h (_bfd_get_elt_at_filepos): Add a pointer argument
69842                 for struct bfd_link_info.
69843                 * libbfd.h: Regenerate.
69844                 * libecoff.h (ecoff_backend_data): Add a pointer argument for
69845                 struct bfd_link_info to get_elt_at_filepos.
69846                 * linker.c (_bfd_generic_link_add_archive_symbols): Pass info to
69847                 _bfd_get_elt_at_filepos.
69848
69849 2022-01-04  Lancelot SIX  <lancelot.six@amd.com>
69850
69851         gdb/testsuite: fix inferior-clone.exp for native-extended-gdbserver
69852         003aae076207dbf32f98ba846158fc32669ef85f (gdb: Copy inferior properties
69853         in clone-inferior) introduced a testcase that fails when testing with
69854         the native-extended-gdbserver board:
69855
69856             Running ../gdb/testsuite/gdb.base/inferior-clone.exp ...
69857             FAIL: gdb.base/inferior-clone.exp: inferior 2: clone-inferior
69858             FAIL: gdb.base/inferior-clone.exp: inferior 3: clone-inferior
69859
69860         The error is as follows:
69861
69862             clone-inferior
69863             [New inferior 2]
69864             Added inferior 2 on connection 1 (extended-remote localhost:2346)
69865             (gdb) FAIL: gdb.base/inferior-clone.exp: inferior 2: clone-inferior
69866
69867         This fails because the testcase only expect the 'Added inferior 2' part
69868         of the message.  The 'on connection 1 [...]' part is unexpected.
69869
69870         Fix by adjusting the testcase to a account for the possible trailing
69871         part of the message.
69872
69873         Tested on x86_64-linux with native-extende-gdbserver and unix boards.
69874
69875         Change-Id: Ie3d6f04c9ffe9cab1fbda8ddf4935ee09b858c7a
69876
69877 2022-01-04  Nick Clifton  <nickc@redhat.com>
69878
69879         Add ATTRIBUTE_UNUSED to load_build_id_debug_file()'s main_filename parameter.
69880
69881 2022-01-04  Andrew Burgess  <aburgess@redhat.com>
69882
69883         gdb: don't pass nullptr to sigwait
69884         I tried building GDB on GNU/Hurd, and ran into this warning:
69885
69886           gdbsupport/scoped_ignore_signal.h:78:16: error: null argument where non-null required (argument 2) [-Werror=nonnull]
69887
69888         This is because in this commit:
69889
69890           commit 99624310dd82542c389c89c2e55d8cae36bb74e1
69891           Date:   Sun Jun 27 15:13:14 2021 -0400
69892
69893               gdb: fall back on sigpending + sigwait if sigtimedwait is not available
69894
69895         A call to sigwait was introduced that passes nullptr as the second
69896         argument, this call is only reached if sigtimedwait is not supported.
69897
69898         The original patch was written for macOS, I assume on that target
69899         passing nullptr as the second argument is fine.
69900
69901         On my GNU/Linux box, the man-page for sigwait doesn't mention that
69902         nullptr is allowed for the second argument, so my assumption would be
69903         that nullptr is not OK, and, if I change the '#ifdef
69904         HAVE_SIGTIMEDWAIT' introduced by the above patch to '#if 0', and
69905         rebuild on GNU/Linux, I see the same warning that I see on GNU/Hurd.
69906
69907         I propose that we stop passing nullptr as the second argument to
69908         sigwait, and instead pass a valid int pointer.  The value returned in
69909         the int can then be used in an assert.
69910
69911         For testing, I (locally) made the change to the #ifdef I mentioned
69912         above, compiled GDB, and ran the usual tests, this meant I was using
69913         sigwait instead on sigtimedwait on GNU/Linux, I saw no regressions.
69914
69915 2022-01-04  Nick Clifton  <nickc@redhat.com>
69916
69917         Remove a spurious debugging message.
69918                 PR 28716
69919                 * dwarf.c (load_build_id_debug_file): Remove spurious printf.
69920
69921 2022-01-04  Tom de Vries  <tdevries@suse.de>
69922
69923         [gdb/build] Fix build breaker in gdb/cli/cli-logging.c
69924         Fix build breaker in gdb/cli/cli-logging.c:
69925         ...
69926         gdb/cli/cli-logging.c: In function \
69927           ‘void show_logging_enabled(ui_file*, int, cmd_list_element*, const char*)’:
69928         gdb/gdbsupport/gdb_locale.h:28:28: error: cannot convert ‘char*’ to ‘ui_file*’
69929            28 | # define _(String) gettext (String)
69930               |                    ~~~~~~~~^~~~~~~~
69931               |                            |
69932               |                            char*
69933         gdb/cli/cli-logging.c:202:25: note: in expansion of macro ‘_’
69934           202 |     fprintf_unfiltered (_("on: Logging is enabled.\n"));
69935               |                         ^
69936         ...
69937
69938         Build and tested on x86_64-linux.
69939
69940         Fixes: 45aec4e5ed8 ("[gdb/cli] Improve show logging output")
69941
69942 2022-01-04  Jan Beulich  <jbeulich@suse.com>
69943
69944         x86/Intel: correct VFPCLASSP{S,D} handling when displacement is present
69945         fits_in_disp8() can be called before ambiguous operands get resolved
69946         or rejected (in process_suffix()), which requires that i.memshift be
69947         non-negative to avoid an internal error. This case wasn't covered by
69948         6c0946d0d28d ("x86: correct VFPCLASSP{S,D} operand size handling").
69949
69950 2022-01-04  Jan Beulich  <jbeulich@suse.com>
69951
69952         gas: rework handling of backslashes in quoted symbol names
69953         Strange effects can result from the present handling, e.g.:
69954
69955         .if 1
69956         "backslash\\":
69957         .endif
69958
69959         yields first (correctly) "missing closing `"'" but then also "invalid
69960         character '\' in mnemonic" and further "end of file inside conditional".
69961         Symbols names ending in \ are in principle not expressable with that
69962         scheme.
69963
69964         Instead of recording whether a backslash was seen, inspect the
69965         subsequent character right away. Only accept \\ (meaning a single
69966         backslash in the resulting symbol name) and \" (meaning an embedded
69967         double quote in the resulting symbol name) for now, warning about any
69968         other combination.
69969
69970         While perhaps not necessary immediately, also permit concatenated
69971         strings to form a symbol name. This may become useful if going forward
69972         we would want to support \<octal> or \x<hex> sequences, where closing
69973         and re-opening quotes can be useful to delimit such sequences.
69974
69975         The ELF "Multibyte symbol names" test gets switched away from using
69976         .set, as that would now also mean excluding nios2 and pru. By using
69977         .equiv instead, even the existing #notarget can be dropped. (For h8300
69978         the .section directive additionally needs attributes specified, to avoid
69979         a target specific warning.)
69980
69981 2022-01-04  GDB Administrator  <gdbadmin@sourceware.org>
69982
69983         Automatic date update in version.in
69984
69985 2022-01-03  Tom de Vries  <tdevries@suse.de>
69986
69987         [gdb/cli] Improve show logging output
69988         Before commit 3b6acaee895 "Update more calls to add_prefix_cmd" we had the
69989         following output for "show logging":
69990         ...
69991         $ gdb -q -batch -ex "set trace-commands on" \
69992             -ex "set logging off" \
69993             -ex "show logging" \
69994             -ex "set logging on" \
69995             -ex "show logging"
69996         +set logging off
69997         +show logging
69998         Future logs will be written to gdb.txt.
69999         Logs will be appended to the log file.
70000         Output will be logged and displayed.
70001         Debug output will be logged and displayed.
70002         +set logging on
70003         +show logging
70004         Currently logging to "gdb.txt".
70005         Logs will be appended to the log file.
70006         Output will be logged and displayed.
70007         Debug output will be logged and displayed.
70008         ...
70009
70010         After that commit we have instead:
70011         ...
70012         +set logging off
70013         +show logging
70014         debugredirect:  The logging output mode is off.
70015         file:  The current logfile is "gdb.txt".
70016         overwrite:  Whether logging overwrites or appends to the log file is off.
70017         redirect:  The logging output mode is off.
70018         +set logging on
70019         +show logging
70020         debugredirect:  The logging output mode is off.
70021         file:  The current logfile is "gdb.txt".
70022         overwrite:  Whether logging overwrites or appends to the log file is off.
70023         redirect:  The logging output mode is off.
70024         ...
70025         which gives less clear output for some subcommands.
70026
70027         OTOH, it's explicit about whether boolean values are on or off.
70028
70029         The new text seems to have been chosen to match the set/show help texts:
70030         ...
70031         (gdb) help show logging
70032         Show logging options.
70033
70034         List of show logging subcommands:
70035
70036         show logging debugredirect -- Show the logging debug output mode.
70037         show logging file -- Show the current logfile.
70038         show logging overwrite -- \
70039           Show whether logging overwrites or appends to the log file.
70040         show logging redirect -- Show the logging output mode.
70041         ...
70042
70043         Make the show logging messages more clear, while still keep the boolean
70044         values explicit, such that we have:
70045         ...
70046         $ ./gdb.sh -q -batch -ex "show logging"
70047         logging debugredirect:  off: \
70048           Debug output will go to both the screen and the log file.
70049         logging enabled:  off: Logging is disabled.
70050         logging file:  The current logfile is "gdb.txt".
70051         logging overwrite:  off: Logging appends to the log file.
70052         logging redirect:  off: Output will go to both the screen and the log file.
70053         ...
70054
70055         Tested on x86_64-linux.
70056
70057 2022-01-03  Tom Tromey  <tromey@adacore.com>
70058
70059         Fix use of 'printf' in gdbtypes.c
70060         An earlier patch of mine, commit 64b7cc50 ("Remove
70061         gdb_print_host_address") inadvertently changed a function in
70062         gdbtypes.c to use printf rather than printf_filtered.  This patch
70063         fixes the problem.
70064
70065         Fix regression in page-logging.exp
70066         Simon and Tom pointed out that page-logging.exp failed on their
70067         machines.  Tom tracked this down to the "width" setting.  Since
70068         there's no need in the test to change the width, it seems simplest to
70069         remove the setting.  I confirmed that the test still fails if the fix
70070         is backed out, ensuring that the test is still testing what it
70071         purports to.
70072
70073         Small indentation fix in eval.c
70074         I noticed that the AdaCore tree had a small divergence in eval.c -- it
70075         had a fix for an indentation problem in binop_promote.  I'm checking
70076         in this small fix as obvious.
70077
70078 2022-01-03  Tom de Vries  <tdevries@suse.de>
70079
70080         [gdb/testsuite] Handle for loop initial decl with gcc 4.8.5
70081         When running test-case gdb.threads/schedlock-thread-exit.exp on a system with
70082         system compiler gcc 4.8.5, I run into:
70083         ...
70084         src/gdb/testsuite/gdb.threads/schedlock-thread-exit.c:33:3: error: \
70085           'for' loop initial declarations are only allowed in C99 mode
70086         ...
70087
70088         Fix this by:
70089         - using -std=c99, or
70090         - using -std=gnu99, in case that's required, or
70091         - in the case of the jit test-cases, rewriting the for loops.
70092
70093         Tested on x86_64-linux, both with gcc 4.8.5 and gcc 7.5.0.
70094
70095 2022-01-03  GDB Administrator  <gdbadmin@sourceware.org>
70096
70097         Automatic date update in version.in
70098
70099 2022-01-02  Tom Tromey  <tom@tromey.com>
70100
70101         Update copying.awk for _initialize declaration patch
70102         Commit 6c265988 ("gdb: add back declarations for _initialize
70103         functions") modified copying.c, but not copying.awk.  This patch
70104         updates copying.awk to backport the appropriate fix.  This way, if
70105         copying.awk is run again, it will create the correct output.
70106
70107         I'm checking this in as obvious.
70108
70109 2022-01-02  Tom Tromey  <tom@tromey.com>
70110
70111         Use filtered output in print_i387_ext
70112         print_i387_ext mostly uses filtered output, but one call in the middle
70113         of the function uses the _unfiltered form.  This patch fixes this
70114         call.  I'm checking this in as obvious.
70115
70116 2022-01-02  Alan Modra  <amodra@gmail.com>
70117
70118         Update year range in copyright notice of binutils files
70119         The result of running etc/update-copyright.py --this-year, fixing all
70120         the files whose mode is changed by the script, plus a build with
70121         --enable-maintainer-mode --enable-cgen-maint=yes, then checking
70122         out */po/*.pot which we don't update frequently.
70123
70124         The copy of cgen was with commit d1dd5fcc38ead reverted as that commit
70125         breaks building of bfp opcodes files.
70126
70127 2022-01-02  GDB Administrator  <gdbadmin@sourceware.org>
70128
70129         Automatic date update in version.in
70130
70131 2022-01-01  Mike Frysinger  <vapier@gentoo.org>
70132
70133         gdb: copyright: fix a few comment typos
70134
70135         sim: ppc: drop natural types
70136         These are almost entirely unused.  For the very few places using them,
70137         replace with explicit signed types.  This matches what was done in the
70138         common sim code.
70139
70140         sim: mips: clean up bad style/whitespace
70141         This doesn't fix all the problems, but grabs a bunch of the more
70142         obvious ones.
70143
70144         sim: tweak copyright lines for gnulib update-copyright
70145         The regex it uses does not like so many leading spaces which causes
70146         it to think the files lack copyright.  Trim them down so the script
70147         can find & update them accordingly.
70148
70149         gdb: update sim mips testsuite copyright exemption
70150         The sim testsuite was reorganized last year, so update the path.
70151
70152 2022-01-01  Mike Frysinger  <vapier@gentoo.org>
70153
70154         unify 64-bit bfd checks
70155         Move the 64-bit bfd logic out of bfd/configure.ac and into bfd64.m4
70156         under config so it can be shared between all the other subdirs.
70157
70158         This replaces want64 with enable_64_bit_bfd which was already being
70159         declared, but not used directly.
70160
70161 2022-01-01  Joel Brobecker  <brobecker@adacore.com>
70162
70163         Update Copyright year in gdb/testsuite/gdb.arch/powerpc-power10.exp
70164         This commit updates the copyright year range in the script
70165         gdb/testsuite/gdb.arch/powerpc-power10.exp. The update was
70166         performed by running gdb/copyright.py again, to make sure
70167         that the copyright year range will be automatically updated
70168         in years forward.
70169
70170 2022-01-01  Joel Brobecker  <brobecker@adacore.com>
70171
70172         Fix copyright header in gdb/testsuite/gdb.arch/powerpc-power10.exp
70173         The copyright year and holder line is slight malformed, missing
70174         a space after a comma, and this is sufficient for gdb's
70175         copyright.py script to miss this file during its automated
70176         copyright year update.
70177
70178         This commit fixes this.
70179
70180 2022-01-01  Joel Brobecker  <brobecker@adacore.com>
70181
70182         gdb/copyright.py: Add update-netbsd.sh to MULTIPLE_COPYRIGHT_HEADERS
70183         Add gdb/syscalls/update-netbsd.sh to the reminder printed
70184         at the end of the execution listing all the files where
70185         a manual update of the copyright header is needed. This
70186         scripts contains some inline code which includes a copyright
70187         header.
70188
70189         Manual copyright year update of various GDB files
70190         This commit updates the copyright year in some files where
70191         we have a copyright year outside of the copyright year,
70192         and thus are not included in gdb's copyright.py script.
70193
70194 2022-01-01  Joel Brobecker  <brobecker@adacore.com>
70195
70196         Automatic Copyright Year update after running gdb/copyright.py
70197         This commit brings all the changes made by running gdb/copyright.py
70198         as per GDB's Start of New Year Procedure.
70199
70200         For the avoidance of doubt, all changes in this commits were
70201         performed by the script.
70202
70203 2022-01-01  Joel Brobecker  <brobecker@adacore.com>
70204
70205         Update Copyright Year in gdb, gdbserver and gdbreplay version output
70206         This commit changes the copyright year printed by gdb, gdbserver
70207         and gdbreplay when printing the tool's version.
70208
70209 2022-01-01  Alan Modra  <amodra@gmail.com>
70210
70211         ubsan: next_char_of_string signed integer overflow
70212         Squash another totally useless fuzz report that I should have ignored.
70213
70214                 * read.c (next_char_of_string): Avoid integer overflow.
70215
70216 2022-01-01  Alan Modra  <amodra@gmail.com>
70217
70218         ubsan: bfd_mach_o_build_commands shift exponent 64 is too large
70219                 * mach-o.c (bfd_mach_o_read_section_32): Limit alignment further.
70220                 (bfd_mach_o_read_section_64): Likewise.
70221
70222 2022-01-01  Alan Modra  <amodra@gmail.com>
70223
70224         ubsan: signed integer multiply overflow
70225         9223371018427387904 * 2 cannot be represented in type 'long', yes, but
70226         we don't care.
70227
70228                 * expr.c (expr): Avoid signed overflow.
70229
70230 2022-01-01  Alan Modra  <amodra@gmail.com>
70231
70232         asan: Null-dereference in _bfd_xcoff_copy_private_bfd_data
70233         sec->output_section will be NULL when objcopy removes sections.
70234
70235                 * coff-rs6000.c (_bfd_xcoff_copy_private_bfd_data): Protect against
70236                 objcopy removing sections.
70237
70238 2022-01-01  Alan Modra  <amodra@gmail.com>
70239
70240         ubsan: integer overflow in section filepos subtraction
70241                 * elf.c (assign_file_positions_for_non_load_sections): Avoid
70242                 signed integer overflow.
70243
70244 2022-01-01  Alan Modra  <amodra@gmail.com>
70245
70246         Remove unnecessary ELF_MINPAGESIZE defines
70247         The idea of this patch is to make it easy to see which targets (just
70248         sparc) have ELF_MINPAGESIZE != ELF_COMMONPAGESIZE.
70249
70250                 * elf32-arm.c (ELF_MINPAGESIZE): Don't define.
70251                 * elf32-metag.c: Likewise.
70252                 * elfnn-aarch64.c: Likewise.
70253                 * elf64-x86-64.c: Likewise.  Also don't redefine a bunch of other
70254                 macros for l1om elf64-target.h use that are unchanged from default.
70255
70256 2022-01-01  H.J. Lu  <hjl.tools@gmail.com>
70257
70258         ld-x86-64: Pass options to linker with "-Wl,"
70259                 * testsuite/ld-x86-64/x86-64.exp: Pass options to linker with
70260                 "-Wl,".
70261
70262 2022-01-01  GDB Administrator  <gdbadmin@sourceware.org>
70263
70264         Automatic date update in version.in
70265
70266 2021-12-31  Tom Tromey  <tom@tromey.com>
70267
70268         Do not call reinitialize_more_filter from avr_io_reg_read_command
70269         avr_io_reg_read_command is an ordinary gdb command, and so should not
70270         be calling reinitialize_more_filter.  This patch removes it.  I'm
70271         checking this in as obvious.  Tested by rebuilding.
70272
70273 2021-12-31  H.J. Lu  <hjl.tools@gmail.com>
70274
70275         x86: Define check_relocs_failed in elfxx-x86.h
70276                 * elf32-i386.c (check_relocs_failed): Moved to ...
70277                 * elfxx-x86.h (check_relocs_failed): Here.  New.
70278                 * elf64-x86-64.c (check_relocs_failed): Removed.
70279
70280         Define X86_PCREL_TYPE_P/X86_SIZE_TYPE_P in elfxx-x86.h
70281                 * elf32-i386.c: Don't include "elf/i386.h".
70282                 (X86_PCREL_TYPE_P): Removed.
70283                 (X86_SIZE_TYPE_P): Likewise.
70284                 (elf_i386_check_relocs): Pass false to NEED_DYNAMIC_RELOCATION_P.
70285                 (elf_i386_relocate_section): Pass false to
70286                 GENERATE_DYNAMIC_RELOCATION_P and COPY_INPUT_RELOC_P.
70287                 * elf64-x86-64.c: Don't include "elf/x86-64.h".
70288                 (X86_PCREL_TYPE_P): Removed.
70289                 (X86_SIZE_TYPE_P): Likewise.
70290                 (elf_x86_64_check_relocs): Pass true to NEED_DYNAMIC_RELOCATION_P
70291                 and X86_PCREL_TYPE_P.
70292                 (elf_x86_64_relocate_section): Pass true to X86_PCREL_TYPE_P,
70293                 X86_SIZE_TYPE_P, GENERATE_DYNAMIC_RELOCATION_P and
70294                 COPY_INPUT_RELOC_P.
70295                 * elfxx-x86.c: Don't include "elf/i386.h" nor "elf/x86-64.h".
70296                 * elfxx-x86.h (X86_64_PCREL_TYPE_P): New.
70297                 (I386_PCREL_TYPE_P): Likewise.
70298                 (X86_PCREL_TYPE_P): Likewise.
70299                 (X86_64_SIZE_TYPE_P): Likewise.
70300                 (I386_SIZE_TYPE_P): Likewise.
70301                 (X86_SIZE_TYPE_P): Likewise.
70302                 (NEED_DYNAMIC_RELOCATION_P): Add IS_X86_64 and pass it to
70303                 X86_PCREL_TYPE_P.
70304                 (COPY_INPUT_RELOC_P): Likewise.
70305                 (GENERATE_DYNAMIC_RELOCATION_P): Add IS_X86_64, pass it to
70306                 X86_PCREL_TYPE_P and X86_SIZE_TYPE_P.
70307
70308 2021-12-31  Tamar Christina  <tamar.christina@arm.com>
70309
70310         ld: fix coff PE SEH
70311         COFF_WITH_pex64 and COFF_WITH_peAArch64 can't be true at the same time.
70312         That means that two conditionals that control the sorting of the .pdata section
70313         became a falsum.
70314
70315         The testsuite doesn't catch this because the linker does the sorting and to link
70316         you require library support from the unwinder so we can't test from binutils in
70317         isolation.
70318
70319         bfd/ChangeLog:
70320
70321         2021-12-31  Tamar Christina  <tamar.christina@arm.com>
70322
70323                 PR ld/28682
70324                 * peXXigen.c: Fix conditional.
70325
70326 2021-12-31  GDB Administrator  <gdbadmin@sourceware.org>
70327
70328         Automatic date update in version.in
70329
70330 2021-12-30  GDB Administrator  <gdbadmin@sourceware.org>
70331
70332         Automatic date update in version.in
70333
70334 2021-12-29  Tom Tromey  <tom@tromey.com>
70335
70336         Use filtered output in show callbacks
70337         "show" command callbacks, like most ordinary gdb commands, should use
70338         filtered output.  I found a few that did not, so this patch changes
70339         them to use the filtered form.
70340
70341 2021-12-29  Tom Tromey  <tom@tromey.com>
70342
70343         Consistently Use ui_file parameter to show callbacks
70344         I happened to notice that one "show" callback was printing to
70345         gdb_stdout rather than to the passed-in ui_file parameter.  I went
70346         through all such callbacks and fixed them to consistently use the
70347         ui_file.
70348
70349         Regression tested on x86-64 Fedora 34.
70350
70351 2021-12-29  Tom Tromey  <tom@tromey.com>
70352
70353         Use gdb_stdlog for MI debugging
70354         When MI debugging is enabled, the logging output should be sent to
70355         gdb_stdlog.  This is part of PR gdb/7233.
70356
70357         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70358
70359 2021-12-29  Tom Tromey  <tom@tromey.com>
70360
70361         Use debug_prefixed_printf_cond_nofunc in index-cache
70362         This changes index-cache.c to use debug_prefixed_printf_cond_nofunc.
70363         As a side effect, logs are now written to gdb_stdlog.  This is part of
70364         PR gdb/7233.
70365
70366         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70367
70368 2021-12-29  Tom Tromey  <tom@tromey.com>
70369
70370         Send minsym logging to gdb_stdlog
70371         This changes minsyms.c to send logging output to gdb_stdlog.  This is
70372         part of PR gdb/7233.
70373
70374         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70375
70376 2021-12-29  Tom Tromey  <tom@tromey.com>
70377
70378         Use gdb_stdlog for separate debug file logging
70379         This changes the separate debug file logging code (spread across two
70380         files) to use gdb_stdlog for its output.  This is part of PR gdb/7233.
70381
70382         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70383
70384 2021-12-29  Tom Tromey  <tom@tromey.com>
70385
70386         Use debug_prefixed_printf_cond_nofunc in machoread
70387         This changes machoread.c to use debug_prefixed_printf_cond_nofunc.  As
70388         a side effect, the logs are now written to gdb_stdlog.  This is part
70389         of PR gdb/7233.
70390
70391         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70392
70393 2021-12-29  Tom Tromey  <tom@tromey.com>
70394
70395         Use debug_prefixed_printf_cond_nofunc in microblaze.c
70396         This changes microblaze.c to use the standard logging macro.  As a
70397         side effect, logs will now go to gdb_stdlog.  This is part of PR gdb/7233.
70398
70399         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70400
70401 2021-12-29  Tom Tromey  <tom@tromey.com>
70402
70403         Send debugging data to gdb_stdlog in mips-linux-nat.c
70404         This changes mips-linux-nat.c to send some logging output to
70405         gdb_stdlog, rather than stdout.  This is part of PR gdb/7233.
70406
70407         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70408
70409 2021-12-29  Tom Tromey  <tom@tromey.com>
70410
70411         Send arch-utils error messages to gdb_stderr
70412         This changes arch-utils.c to send some error messages to gdb_stderr.
70413         This is part of PR gdb/7233.
70414
70415         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70416
70417 2021-12-29  Tom Tromey  <tom@tromey.com>
70418
70419         Use correct stream for process record output
70420         The process record code often emits unfiltered output.  In some cases,
70421         this output ought to go to gdb_stderr (but see below).  In other
70422         cases, the output is guarded by a logging variable and so ought to go
70423         to gdb_stdlog.  This patch makes these changes.
70424
70425         Note that in many cases, the output to stderr is followed by a
70426         "return -1", which is how process record indicates an error.  It seems
70427         to me that calling error here would be preferable, because, in many
70428         cases, that's all the caller does when it sees a -1.  However, I
70429         haven't made this change.
70430
70431         This is part of PR gdb/7233.
70432
70433         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70434
70435 2021-12-29  Tom Tromey  <tom@tromey.com>
70436
70437         Send jit.c errors to gdb_stderr
70438         jit.c writes some error messages to gdb_stdout, but using gdb_stderr
70439         is better.  This is part of PR gdb/7233.
70440
70441         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
70442
70443 2021-12-29  Tom Tromey  <tom@tromey.com>
70444
70445         Fix logging redirection bug with pager
70446         I noticed yesterday that if gdb output is redirected to a file, the
70447         pager will still be active.  This is irritating, because the output
70448         isn't actually visible -- just the pager prompt.  Looking in bugzilla,
70449         I found that this had been filed 17 years ago, as PR cli/8798.
70450
70451         This patch fixes the bug.  It changes the pagination code to query the
70452         particular ui-file to see if paging is allowable.  The ui-file
70453         implementations are changed so that only the stdout implementation and
70454         a tee (where one sub-file is stdout) can page.
70455
70456         Regression tested on x86-64 Fedora 34.
70457
70458         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=8798
70459
70460 2021-12-29  Tom Tromey  <tom@tromey.com>
70461
70462         Remove unusual use of core_addr_eq and core_addr_hash
70463         gdbtypes.h uses core_addr_eq and core_addr_hash in a weird way: taking
70464         the address of a member and then passing this (as a void*) to these
70465         functions.
70466
70467         It seems better to simply inline the ordinary code here.  CORE_ADDR is
70468         a scalar so it can be directly compared, and the identity hash
70469         function seems safe to assume as well.
70470
70471         After this, core_addr_eq and core_addr_hash are unused, so this patch
70472         removes them.
70473
70474 2021-12-29  Lancelot SIX  <lancelot.six@amd.com>
70475
70476         gdb: Copy inferior properties in clone-inferior
70477         This commit ensures that the following settings are cloned from one
70478         inferior to the new one when processing the clone-inferior command:
70479           - inferior-tty
70480           - environment variables
70481           - cwd
70482           - args
70483
70484         Some of those parameters can be passed as command line arguments to GDB
70485         (-args and -tty), so one could expect the clone-inferior to respect
70486         those flags.  The following debugging session illustrates that:
70487
70488             gdb -nx -quiet -batch \
70489                  -ex "show args" \
70490                  -ex "show inferior-tty" \
70491                  -ex "clone-inferior" \
70492                  -ex "inferior 2" \
70493                  -ex "show args" \
70494                  -ex "show inferior-tty" \
70495                  -tty=/some/tty \
70496                  -args echo foo bar
70497             Argument list to give program being debugged when it is started is "foo bar".
70498             Terminal for future runs of program being debugged is "/some/tty".
70499             [New inferior 2]
70500             Added inferior 2.
70501             [Switching to inferior 2 [<null>] (/bin/echo)]
70502             Argument list to give program being debugged when it is started is "".
70503             Terminal for future runs of program being debugged is "".
70504
70505         The other properties this commit copies on clone (i.e. CWD and the
70506         environment variables) are included since they are related (in the sense
70507         that they influence the runtime behavior of the program) even if they
70508         cannot be directly set using command line switches.
70509
70510         There is a chance that this patch changes existing user workflow.  I
70511         think that this change is mostly harmless.  If users want to start a new
70512         inferior based on an existing one, they probably already propagate those
70513         settings to the new inferior in some way.
70514
70515         Tested on x86_64-linux.
70516
70517         Change-Id: I3b1f28b662f246228b37bb24c2ea1481567b363d
70518
70519 2021-12-29  GDB Administrator  <gdbadmin@sourceware.org>
70520
70521         Automatic date update in version.in
70522
70523 2021-12-28  H.J. Lu  <hjl.tools@gmail.com>
70524
70525         elf32-i386: Fix a typo in GOT comments
70526         Entry offsets in the global offset table are multiples of 4, not 8.
70527
70528                 * elf32-i386.c (elf_i386_relocate_section): Fix a typo in GOT
70529                 comments.
70530
70531 2021-12-28  H.J. Lu  <hjl.tools@gmail.com>
70532
70533         bfd: Don't check non-thin archive member file size
70534         There is no need to check member file size for thin archive member.
70535
70536                 * bfdio.c (bfd_bread): Don't check non-thin archive member file
70537                 size.
70538
70539 2021-12-28  Alan Modra  <amodra@gmail.com>
70540
70541         gas reloc sorting
70542         In some cases, eg. riscv_pre_output_hook, gas generates out-of-order
70543         relocations.  Various places in the linker assume relocs are sorted
70544         by increasing r_offset, which is normally the case.  Provide
70545         GAS_SORT_RELOCS to handle unsorted relocs.
70546
70547         bfd/
70548                 PR 28709
70549                 * elf32-nds32.c (nds32_insertion_sort): Make static.
70550                 * elf32-nds32.h (nds32_insertion_sort): Delete declaration.
70551         gas/
70552                 PR 28709
70553                 * write.c (write_relocs): Implement reloc sorting by r_offset
70554                 when GAS_SORT_RELOCS.
70555                 * config/tc-nds32.c (compar_relent, nds32_set_section_relocs): Delete.
70556                 * config/tc-nds32.h (nds32_set_section_relocs): Don't declare.
70557                 (SET_SECTION_RELOCS): Don't define.
70558                 (GAS_SORT_RELOCS): Define.
70559                 * config/tc-riscv.h (GAS_SORT_RELOCS): Define.
70560
70561 2021-12-28  jiawei  <jiawei@iscas.ac.cn>
70562
70563         ld: Fix testcase errors due to -shared not support.
70564         Reviewed-by: Jim Wilson <jim.wilson.gcc@gmail.com>
70565
70566         ld/ChangeLog:
70567
70568                 * testsuite/ld-ctf/ctf.exp: Add shared lib check.
70569                 * testsuite/ld-plugin/lto.exp: Add lto shared check.
70570
70571 2021-12-28  GDB Administrator  <gdbadmin@sourceware.org>
70572
70573         Automatic date update in version.in
70574
70575 2021-12-27  H.J. Lu  <hjl.tools@gmail.com>
70576
70577         elf: Update comments for check_relocs in elf_backend_data
70578         Since
70579
70580         commit 5c3261b0e834647cf9eb555320e20871b7854f98
70581         Author: H.J. Lu <hjl.tools@gmail.com>
70582         Date:   Mon Oct 16 03:49:54 2017 -0700
70583
70584             ELF: Call check_relocs after opening all inputs
70585
70586         check_relocs is called after opening all inputs.
70587
70588                 * elf-bfd.h (elf_backend_data::check_relocs): Update comments.
70589
70590 2021-12-27  H.J. Lu  <hjl.tools@gmail.com>
70591
70592         ld: Remove emultempl/linux.em
70593         Remove emultempl/linux.em whose last usage was removed by
70594
70595         commit c65c21e1ffd1e02d9970a4bca0b7e384788a50f0
70596         Author: Alan Modra <amodra@gmail.com>
70597         Date:   Mon Apr 16 22:14:01 2018 +0930
70598
70599             various i386-aout and i386-coff target removal
70600
70601             Also tidies some other aout leftovers in binutils-common.exp.
70602
70603 2021-12-27  GDB Administrator  <gdbadmin@sourceware.org>
70604
70605         Automatic date update in version.in
70606
70607 2021-12-26  GDB Administrator  <gdbadmin@sourceware.org>
70608
70609         Automatic date update in version.in
70610
70611 2021-12-25  GDB Administrator  <gdbadmin@sourceware.org>
70612
70613         Automatic date update in version.in
70614
70615 2021-12-24  Tom Tromey  <tom@tromey.com>
70616
70617         Remove gdb_print_host_address
70618         gdb_print_host_address is just a simple wrapper around
70619         fprintf_filtered.  However, it is readily replaced in all callers by a
70620         combination of %s and call to host_address_to_string.  This also
70621         simplifies the code, so I think it's worthwhile to remove this
70622         function.
70623
70624         Regression tested on x86-64 Fedora 64.
70625
70626 2021-12-24  Tom Tromey  <tom@tromey.com>
70627
70628         Move gdb_bfd_errmsg to gdb_bfd.c
70629         gdb_bfd.c contains most of gdb's BFD-related utility functions.
70630         However, gdb_bfd_errmsg is in utils.c.  It seemed better to me to move
70631         this out of util.[ch] and into the BFD-related file instead.
70632
70633         Tested by rebuilding.
70634
70635 2021-12-24  Nelson Chu  <nelson.chu@sifive.com>
70636
70637         RISC-V: Rewrite the csr testcases.
70638         Maskray (Fangrui Song) had suggested me before that we should combine
70639         multiple testcases into one file as possible as we can.  So that we can
70640         more easily understand what these test cases are testing, and easier to
70641         maintain.  Therefore, this patch rewrites all csr testcases, to make them
70642         more clean.
70643
70644         gas/
70645                 * testsuite/gas/riscv/csr-fail-nonexistent.d: Renamed from
70646                 priv-reg-fail-nonexistent testcase.
70647                 * testsuite/gas/riscv/csr-fail-nonexistent.: Likewise.
70648                 * testsuite/gas/riscv/csr-fail-nonexistent.s: Likewise.
70649                 * testsuite/gas/riscv/csr-insns-pseudo-noalias.d: Renamed from
70650                 priv-reg-pseudo testcase.
70651                 * testsuite/gas/riscv/csr-insns-pseudo.d: Likewise.
70652                 * testsuite/gas/riscv/csr-insns-pseudo.s: Likewise.
70653                 * testsuite/gas/riscv/csr-insns-read-only.d: Renamed from
70654                 priv-reg-fail-read-only-02 testcase.
70655                 * testsuite/gas/riscv/csr-insns-read-only.l: Likewise.
70656                 * testsuite/gas/riscv/csr-insns-read-only.s: Likewise.
70657                 * testsuite/gas/riscv/h-ext-32.d: Moved hypervisor csrs to csr.s.
70658                 * testsuite/gas/riscv/h-ext-32.s: Likewise.
70659                 * testsuite/gas/riscv/h-ext-64.d: Likewise.
70660                 * testsuite/gas/riscv/h-ext-64.s: Likewise.
70661                 * testsuite/gas/riscv/csr.s: Renamed from priv-reg.s, and then
70662                 added the hypervisor csrs.
70663                 * testsuite/gas/riscv/csr-version-1p9p1.d: The csr testcase when
70664                 the privileged spec is 1.9.1.  Also tested all invalid csr warnings
70665                 when -mcsr-check is enabled.
70666                 * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
70667                 * testsuite/gas/riscv/csr-version-1p10.d: Likewise, but the
70668                 privileged spec is 1.10..
70669                 * testsuite/gas/riscv/csr-version-1p10.l: Likewise.
70670                 * testsuite/gas/riscv/csr-version-1p11.d: Likewise, but the
70671                 privileged spec is 1.11.
70672                 * testsuite/gas/riscv/csr-version-1p11.l: Likewise.
70673                 * testsuite/gas/riscv/csr-version-1p12.d: Likewise, but the
70674                 privileged spec is 1.12.
70675                 * testsuite/gas/riscv/csr-version-1p12.l: Likewise.
70676                 * testsuite/gas/riscv/priv-reg*: Removed or Renamed.
70677
70678 2021-12-24  Vineet Gupta  <vineetg@rivosinc.com>
70679
70680         RISC-V: Hypervisor ext: support Privileged Spec 1.12
70681         This is the Hypervisor Extension 1.0
70682
70683          - Hypervisor Memory-Management Instructions
70684            HFENCE.VVMA, HFENCE.GVMA,
70685
70686          - Hypervisor Virtual Machine Load and Store Instructions
70687            HLV.B, HLV.BU,          HSV.B,
70688            HLV.H, HLV.HU, HLVX.HU, HSB.H,
70689            HLV.W, HLV.WU, HLVX.WU, HSV.W,
70690            HLV.D,                  HSV.D
70691
70692          - Hypervisor CSRs (some new, some address changed)
70693            hstatus, hedeleg, hideleg, hie, hcounteren, hgeie, htval, hip, hvip,
70694            htinst, hgeip, henvcfg, henvcfgh, hgatp, hcontext, htimedelta, htimedeltah,
70695            vsstatus, vsie, vstvec, vsscratch, vsepc, vscause, vstval, vsip, vsatp,
70696
70697         Note that following were added already as part of svinval extension
70698         support:
70699            HINVAL.GVMA, HINVAL.VVMA
70700
70701         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
70702         Reviewed-by: Nelson Chu <nelson.chu@sifive.com>
70703
70704         bfd/
70705                 * cpu-riscv.c (riscv_priv_specs): Added entry for 1.12.
70706                 * cpu-riscv.h (enum riscv_spec_class): Added PRIV_SPEC_CLASS_1P12.
70707         gas/
70708                 * config/tc-riscv.c (abort_version): Updated comment.
70709                 (validate_riscv_insn): Annotate switch-break.
70710                 * testsuite/gas/riscv/h-ext-32.d: New testcase for hypervisor.
70711                 * testsuite/gas/riscv/h-ext-32.s: Likewise.
70712                 * testsuite/gas/riscv/h-ext-64.d: Likewise.
70713                 * testsuite/gas/riscv/h-ext-64.s: Likewise.
70714         include/
70715                 * opcode/riscv-opc.h: Added encodings for hypervisor csrs and
70716                 instrcutions.
70717         opcodes/
70718                 * riscv-opc.c (riscv_opcodes): Added hypervisor instrcutions.
70719
70720 2021-12-24  Vineet Gupta  <vineetg@rivosinc.com>
70721
70722         RISC-V: Hypervisor ext: drop Privileged Spec 1.9.1 implementation/tests
70723         This makes way for a clean 1.12 based Hypervisor Ext support.
70724
70725         There are no known implementors of 1.9.1 H-ext. (Per Jim, kendryte k210
70726         is based on priv spec 1.9.1, but it seems unlikely that they implemented
70727         H-ext).
70728
70729         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
70730         Reviewed-by: Nelson Chu <nelson.chu@sifive.com>
70731
70732         gas/
70733                 * testsuite/gas/riscv/csr-dw-regnums.d: Drop the hypervisor csrs
70734                 defined in the privileged spec 1.9.1.
70735                 * testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
70736                 * testsuite/gas/riscv/priv-reg-fail-read-only-01.s: Likewise.
70737                 * testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise.
70738                 * testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise.
70739                 * testsuite/gas/riscv/priv-reg-version-1p10.d: Likewise.
70740                 * testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise.
70741                 * testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise.
70742                 * testsuite/gas/riscv/priv-reg.s: Likewise.
70743         include/
70744                 * opcode/riscv-opc.h: Drop the hypervisor csrs defined in the
70745                 privileged spec 1.9.1.
70746
70747 2021-12-24  GDB Administrator  <gdbadmin@sourceware.org>
70748
70749         Automatic date update in version.in
70750
70751 2021-12-23  Andrew Burgess  <aburgess@redhat.com>
70752
70753         gdb/testsuite: resolve some duplicate testnames in gdb.mi
70754         Set of fixes to resolve some duplicate test names in the gdb.mi/
70755         directory.  There should be no real test changes after this set of
70756         fixes, they are all either:
70757
70758           - Adding with_test_prefix type constructs to make test names unique,
70759             or
70760
70761           - Changing the test name to be more descriptive, or better reflect
70762             the test being run.
70763
70764 2021-12-23  Andrew Burgess  <andrew.burgess@embecosm.com>
70765
70766         gdb/remote: handle attach when stop packet lacks thread-id
70767         Bug PR gdb/28405 reports a regression when using attach with an
70768         extended-remote target.  In this case the target is not including a
70769         thread-id in the stop packet it sends back after the attach.
70770
70771         The regression was introduced with this commit:
70772
70773           commit 8f66807b98f7634c43149ea62e454ea8f877691d
70774           Date:   Wed Jan 13 20:26:58 2021 -0500
70775
70776               gdb: better handling of 'S' packets
70777
70778         The problem is that when GDB processes the stop packet, it sees that
70779         there is no thread-id and so has to "guess" which thread the stop
70780         should apply to.
70781
70782         In this case the target only has one thread, so really, there's no
70783         guessing needed, but GDB still runs through the same process, this
70784         shouldn't cause us any problems.
70785
70786         However, after the above commit, GDB now expects itself to be more
70787         internally consistent, specifically, only a thread that GDB thinks is
70788         resumed, can be a candidate for having stopped.
70789
70790         It turns out that, when GDB attaches to a process through an
70791         extended-remote target, the threads of the process being attached too,
70792         are not, initially, marked as resumed.
70793
70794         And so, when GDB tries to figure out which thread the stop might apply
70795         too, it finds no threads in the processes marked resumed, and so an
70796         assert triggers.
70797
70798         In extended_remote_target::attach we create a new thread with a call
70799         to add_thread_silent, rather than remote_target::remote_add_thread,
70800         the reason is that calling the latter will result in a call to
70801         'add_thread' rather than 'add_thread_silent'.  However,
70802         remote_target::remote_add_thread includes additional
70803         actions (i.e. calling remote_thread_info::set_resumed and set_running)
70804         which are missing from extended_remote_target::attach.  These missing
70805         calls are what would serve to mark the new thread as resumed.
70806
70807         In this commit I propose that we add an extra parameter to
70808         remote_target::remote_add_thread.  This new parameter will force the
70809         new thread to be added with a call to add_thread_silent.  We can now
70810         call remote_add_thread from the ::attach method, the extra
70811         actions (listed above) will now be performed, and the thread will be
70812         left in the correct state.
70813
70814         Additionally, in PR gdb/28405, a segfault is reported.  This segfault
70815         triggers when 'set debug remote 1' is used before trying to reproduce
70816         the original assertion failure.  The cause of this is in
70817         remote_target::select_thread_for_ambiguous_stop_reply, where we do
70818         this:
70819
70820           remote_debug_printf ("first resumed thread is %s",
70821                                pid_to_str (first_resumed_thread->ptid).c_str ());
70822           remote_debug_printf ("is this guess ambiguous? = %d", ambiguous);
70823
70824           gdb_assert (first_resumed_thread != nullptr);
70825
70826         Notice that when debug printing is on we dereference
70827         first_resumed_thread before we assert that the pointer is not
70828         nullptr.  This is the cause of the segfault, and is resolved by moving
70829         the assert before the debug printing code.
70830
70831         I've extended an existing test, ext-attach.exp, so that the original
70832         test is run multiple times; we run in the original mode, as normal,
70833         but also, we now run with different packets disabled in gdbserver.  In
70834         particular, disabling Tthread would trigger the assertion as it was
70835         reported in the original bug.  I also run the test in all-stop and
70836         non-stop modes now for extra coverage, we also run the tests with
70837         target-async enabled, and disabled.
70838
70839         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28405
70840
70841 2021-12-23  Andrew Burgess  <aburgess@redhat.com>
70842
70843         gdb: on x86-64 non-trivial C++ objects are returned in memory
70844         Fixes PR gdb/28681.  It was observed that after using the `finish`
70845         command an incorrect value was displayed in some cases.  Specifically,
70846         this behaviour was observed on an x86-64 target.
70847
70848         Consider this test program:
70849
70850           struct A
70851           {
70852             int i;
70853
70854             A ()
70855             { this->i = 0; }
70856             A (const A& a)
70857             { this->i = a.i; }
70858           };
70859
70860           A
70861           func (int i)
70862           {
70863             A a;
70864             a.i = i;
70865             return a;
70866           }
70867
70868           int
70869           main ()
70870           {
70871             A a = func (3);
70872             return a.i;
70873           }
70874
70875         And this GDB session:
70876
70877           $ gdb -q ex.x
70878           Reading symbols from ex.x...
70879           (gdb) b func
70880           Breakpoint 1 at 0x401115: file ex.cc, line 14.
70881           (gdb) r
70882           Starting program: /home/andrew/tmp/ex.x
70883
70884           Breakpoint 1, func (i=3) at ex.cc:14
70885           14      A a;
70886           (gdb) finish
70887           Run till exit from #0  func (i=3) at ex.cc:14
70888           main () at ex.cc:23
70889           23      return a.i;
70890           Value returned is $1 = {
70891             i = -19044
70892           }
70893           (gdb) p a
70894           $2 = {
70895             i = 3
70896           }
70897           (gdb)
70898
70899         Notice how after the `finish` the contents of $1 are junk, but, when I
70900         immediately ask for the value of `a`, I get back the correct value.
70901
70902         The problem here is that after the finish command GDB calls the
70903         function amd64_return_value to figure out where the return value can
70904         be found (on x86-64 targets anyway).
70905
70906         This function makes the wrong choice for the struct A in our case, as
70907         sizeof(A) <= 8, then amd64_return_value decides that A will be
70908         returned in a register.  GDB then reads the return value register an
70909         interprets the contents as an instance of A.
70910
70911         Unfortunately, A is not trivially copyable (due to its copy
70912         constructor), and the sys-v specification for argument and return
70913         value passing, says that any non-trivial C++ object should have space
70914         allocated for it by the caller, and the address of this space is
70915         passed to the callee as a hidden first argument.  The callee should
70916         then return the address of this space as the return value.
70917
70918         And so, the register that GDB is treating as containing an instance of
70919         A, actually contains the address of an instance of A (in this case on
70920         the stack), this is why GDB shows the incorrect result.
70921
70922         The call stack within GDB for where we actually go wrong is this:
70923
70924           amd64_return_value
70925             amd64_classify
70926               amd64_classify_aggregate
70927
70928         And it is in amd64_classify_aggregate that we should be classifying
70929         the type as AMD64_MEMORY, instead of as AMD64_INTEGER as we currently
70930         do (via a call to amd64_classify_aggregate_field).
70931
70932         At the top of amd64_classify_aggregate we already have this logic:
70933
70934           if (TYPE_LENGTH (type) > 16 || amd64_has_unaligned_fields (type))
70935             {
70936               theclass[0] = theclass[1] = AMD64_MEMORY;
70937               return;
70938             }
70939
70940         Which handles some easy cases where we know a struct will be placed
70941         into memory, that is (a) the struct is more than 16-bytes in size,
70942         or (b) the struct has any unaligned fields.
70943
70944         All we need then, is to add a check here to see if the struct is
70945         trivially copyable.  If it is not then we know the struct will be
70946         passed in memory.
70947
70948         I originally structured the code like this:
70949
70950           if (TYPE_LENGTH (type) > 16
70951               || amd64_has_unaligned_fields (type)
70952               || !language_pass_by_reference (type).trivially_copyable)
70953             {
70954               theclass[0] = theclass[1] = AMD64_MEMORY;
70955               return;
70956             }
70957
70958         This solved the example from the bug, and my small example above.  So
70959         then I started adding some more extensive tests to the GDB testsuite,
70960         and I ran into a problem.  I hit this error:
70961
70962           gdbtypes.h:676: internal-error: loc_bitpos: Assertion `m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.
70963
70964         This problem is triggered from:
70965
70966           amd64_classify_aggregate
70967             amd64_has_unaligned_fields
70968               field::loc_bitpos
70969
70970         Inside the unaligned field check we try to get the bit position of
70971         each field.  Unfortunately, in some cases the field location is not
70972         FIELD_LOC_KIND_BITPOS, but is FIELD_LOC_KIND_DWARF_BLOCK.
70973
70974         An example that shows this bug is:
70975
70976           struct B
70977           {
70978             short j;
70979           };
70980
70981           struct A : virtual public B
70982           {
70983             short i;
70984
70985             A ()
70986             { this->i = 0; }
70987             A (const A& a)
70988             { this->i = a.i; }
70989           };
70990
70991           A
70992           func (int i)
70993           {
70994             A a;
70995             a.i = i;
70996             return a;
70997           }
70998
70999           int
71000           main ()
71001           {
71002             A a = func (3);
71003             return a.i;
71004           }
71005
71006         It is the virtual base class, B, that causes the problem.  The base
71007         class is represented, within GDB, as a field within A.  However, the
71008         location type for this field is a DWARF_BLOCK.
71009
71010         I spent a little time trying to figure out how to convert the
71011         DWARF_BLOCK to a BITPOS, however, I realised that, in this case at
71012         least, conversion is not needed.
71013
71014         The C++ standard says that a class is not trivially copyable if it has
71015         any virtual base classes.  And so, in this case, even if I could
71016         figure out the BITPOS for the virtual base class fields, I know for
71017         sure that I would immediately fail the trivially_copyable check.  So,
71018         lets just reorder the checks in amd64_classify_aggregate to:
71019
71020           if (TYPE_LENGTH (type) > 16
71021               || !language_pass_by_reference (type).trivially_copyable
71022               || amd64_has_unaligned_fields (type))
71023             {
71024               theclass[0] = theclass[1] = AMD64_MEMORY;
71025               return;
71026             }
71027
71028         Now, if we have a class with virtual bases we will fail quicker, and
71029         avoid the unaligned fields check completely.
71030
71031         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28681
71032
71033 2021-12-23  Andrew Burgess  <aburgess@redhat.com>
71034
71035         gdb: make use of SCOPE_EXIT to manage thread executing state
71036         While working on another patch relating to how GDB manages threads
71037         executing and resumed state, I spotted the following code in
71038         record-btrace.c:
71039
71040           executing = tp->executing ();
71041           set_executing (proc_target, inferior_ptid, false);
71042
71043           id = null_frame_id;
71044           try
71045             {
71046               id = get_frame_id (get_current_frame ());
71047             }
71048           catch (const gdb_exception &except)
71049             {
71050               /* Restore the previous execution state.  */
71051               set_executing (proc_target, inferior_ptid, executing);
71052
71053               throw;
71054             }
71055
71056           /* Restore the previous execution state.  */
71057           set_executing (proc_target, inferior_ptid, executing);
71058
71059           return id;
71060
71061         I notice that we only catch the exception so we can call
71062         set_executing, and this is the same call to set_executing that we need
71063         to perform in the non-exception return path.
71064
71065         This would be much cleaner if we could use SCOPE_EXIT to avoid the
71066         try/catch, so lets do that.
71067
71068         While cleaning this up, I also applied a similar patch to
71069         record-full.c, though there's no try/catch in that case, but using
71070         SCOPE_EXIT makes the code safe if, in the future, we do start throwing
71071         exceptions.
71072
71073         There should be no user visible changes after this commit.
71074
71075 2021-12-23  GDB Administrator  <gdbadmin@sourceware.org>
71076
71077         Automatic date update in version.in
71078
71079 2021-12-22  Andrew Burgess  <aburgess@redhat.com>
71080
71081         gdb/doc: add some index entries relating to mi-async setting
71082         I noticed that the mi-async setting was not referenced from the index
71083         in any way, this commit tries to rectify that a bit.
71084
71085         The @cindex lines I think are not controversial, these same index
71086         entries are used elsewhere in the manual for async related topics (see
71087         @node Background Execution).
71088
71089         The only bit that might be controversial is that I've added a @kindex
71090         entry for 'set mi-async' when the command is documented as '-gdb-set
71091         mi-async' (with a similar difference for the show/-gdb-show).
71092
71093         My reasoning here is that nothing else is indexed under -gdb-set or
71094         -gdb-show, and as -gdb-set/-gdb-show are just the MI equivalent for
71095         set/show anything that is documented under set/show can be adjusted
71096         using -gdb-set/-gdbshow, and so, I've tried to keep the index
71097         consistent for mi-async.
71098
71099 2021-12-22  Andrew Burgess  <aburgess@redhat.com>
71100
71101         gdb: convert 'set debug lin-lwp' to a boolean command
71102         Convert the 'set debug lin-lwp' command to a boolean.  Adds a new
71103         LINUX_NAT_SCOPED_DEBUG_ENTER_EXIT macro, and makes use of it in one
71104         place (linux_nat_target::stop).
71105
71106         The manual entry for 'set debug lin-lwp' is already vague about
71107         exactly what arguments this command takes, and the description talks
71108         about turning debug on and off, so I don't think there's any updates
71109         required there.
71110
71111         I have updated the doc strings shown when the users enters 'help show
71112         debug lin-lwp' or 'help show debug lin-lwp'.  The old title lines used
71113         to talk about the 'GNU/Linux lwp module', but this debug flag is now
71114         used for any native linux target debug, so we now talk about
71115         'GNU/Linux native target'.  The body string for this setting has been
71116         changed from 'Enables printf debugging output.' to 'When on, print
71117         debug messages relating to the GNU/Linux native target.', the old
71118         value looks like a cut&paste error to me.
71119
71120 2021-12-22  Andrew Burgess  <aburgess@redhat.com>
71121
71122         gdb: add threads debugging switch
71123         Add new commands:
71124
71125           set debug threads on|off
71126           show debug threads
71127
71128         Prints additional debug information relating to thread creation and
71129         deletion.
71130
71131         GDB already announces when threads are created of course.... most of
71132         the time, but sometimes threads are added silently, in which case this
71133         debug message is the only mechanism to see the thread being added.
71134         Also, though GDB does announce when a thread exits, it doesn't
71135         announce when the thread object is deleted, I've added a debug message
71136         for that.
71137
71138         Additionally, having message printed through the debug system will
71139         cause the messages to be nested to an appropriate depth when other
71140         debug sub-systems are turned on (especially things like `infrun` and
71141         `lin-lwp`).
71142
71143 2021-12-22  jiawei  <jiawei@iscas.ac.cn>
71144
71145         RISC-V: Update Scalar Crypto testcases.
71146         Add opcodes in testcases to make sure every instruction generate
71147         right opcode after disassemble.
71148
71149         gas/ChangeLog:
71150
71151                 * testsuite/gas/riscv/k-ext-64.d: Add opcode detect.
71152                 * testsuite/gas/riscv/k-ext.d: Ditto.
71153                 * testsuite/gas/riscv/zbkb-32.d: Ditto.
71154                 * testsuite/gas/riscv/zbkb-64.d: Ditto.
71155                 * testsuite/gas/riscv/zbkc-32.d: Ditto.
71156                 * testsuite/gas/riscv/zbkc-64.d: Ditto.
71157                 * testsuite/gas/riscv/zbkx-32.d: Ditto.
71158                 * testsuite/gas/riscv/zbkx-64.d: Ditto.
71159                 * testsuite/gas/riscv/zknd-32.d: Ditto.
71160                 * testsuite/gas/riscv/zknd-64.d: Ditto.
71161                 * testsuite/gas/riscv/zkne-32.d: Ditto.
71162                 * testsuite/gas/riscv/zkne-64.d: Ditto.
71163                 * testsuite/gas/riscv/zknh-32.d: Ditto.
71164                 * testsuite/gas/riscv/zknh-64.d: Ditto.
71165                 * testsuite/gas/riscv/zksed-32.d: Ditto.
71166                 * testsuite/gas/riscv/zksed-64.d: Ditto.
71167                 * testsuite/gas/riscv/zksh-32.d: Ditto.
71168                 * testsuite/gas/riscv/zksh-64.d: Ditto.
71169
71170 2021-12-22  Simon Marchi  <simon.marchi@polymtl.ca>
71171
71172         gdbarch-components.py: change empty "params" tuples to empty lists
71173         During review, it was suggested to change the "params" parameter from a
71174         tuple to a list, for esthetic reasons.  The empty ones are still tuples
71175         though, they should probably be changed to be empty lists, for
71176         consistency.  It does not change anything in the script result.
71177
71178         Change-Id: If13c6c527aa167a5ee5b45740e5f1bda1e9517e4
71179
71180 2021-12-22  GDB Administrator  <gdbadmin@sourceware.org>
71181
71182         Automatic date update in version.in
71183
71184 2021-12-21  Luis Machado  <luis.machado@linaro.org>
71185
71186         [AArch64] Fix typo in error messages
71187         Fix mispelling of PROT_ME to PROT_MTE in the error messages.
71188
71189 2021-12-21  Joel Sherrill  <joel@rtems.org>
71190
71191         Obsolete m32c-rtems and m32r-rtems
71192         2020-12-20  Joel Sherrill <joel@rtems.org>
71193
71194         bfd/
71195                 * config.bfd (m32c-*-rtems*): Remove target.
71196
71197         ld/
71198                 * configure.tgt (m32c-*-rtems*): Remove target.
71199                 * configure.tgt (m32r-*-rtems*): Remove target.
71200
71201 2021-12-21  Jan Beulich  <jbeulich@suse.com>
71202
71203         x86: -mfence-as-lock-add=yes doesn't work for 16-bit mode
71204         Rather than trying to fix this (which would require making an assumption
71205         on the upper half of %esp being zero), simply issue an error. While at
71206         it, since the generated code is in conflict with -momit-lock-prefix=yes,
71207         issue an error in that case as well.
71208
71209         gas/ELF: avoid below-base ref in obj_elf_parse_section_letters()
71210         We would better be prepared for 'm' being the first character of the
71211         incoming string.
71212
71213 2021-12-21  Alan Modra  <amodra@gmail.com>
71214
71215         Typo fixes in binutils doc
71216                 * doc/binutils.texi: Fix typos.
71217
71218 2021-12-21  GDB Administrator  <gdbadmin@sourceware.org>
71219
71220         Automatic date update in version.in
71221
71222 2021-12-20  Tom Tromey  <tom@tromey.com>
71223
71224         Remove print_spaces
71225         This removes the print_spaces helper function, in favor of using the
71226         "*%s" idiom that's already used in many places in gdb.  One spot (in
71227         symmisc.c) is changed to use print_spaces_filtered, because the rest
71228         of that function is using filtered output.  (This highlights one way
71229         that the printf idiom is better -- this error is harder to make when
71230         using that.)
71231
71232         Regression tested on x86-64 Fedora 34.
71233
71234 2021-12-20  Tom Tromey  <tom@tromey.com>
71235
71236         Remove puts_debug
71237         I noticed that puts_debug isn't used in the tree.  git log tells me
71238         that the last use was removed in 2015:
71239
71240             commit 40e0b27177e747600d3ec186458fe0e482a1cf77
71241             Author: Pedro Alves <palves@redhat.com>
71242             Date:   Mon Aug 24 15:40:26 2015 +0100
71243
71244                 Delete the remaining ROM monitor targets
71245
71246         ... and this commit mentions that the code being removed here probably
71247         hadn't worked for 6 years prior to that.
71248
71249         Based on this, I'm removing puts_debug.  I don't think it's useful.
71250         Tested by rebuilding.
71251
71252 2021-12-20  Tom Tromey  <tom@tromey.com>
71253
71254         Make n_spaces return a const char *
71255         n_spaces keeps the spaces in a static buffer.  If a caller overwrites
71256         these, it may give an incorrect result to a subsequent caller.  So,
71257         make the return type const to help avoid this outcome.
71258
71259 2021-12-20  Enze Li  <lienze2010@hotmail.com>
71260
71261         Add Enze Li to gdb/MAINTAINERS
71262
71263 2021-12-20  Joel Brobecker  <brobecker@adacore.com>
71264
71265         gdb/ada-exp.y: Reformat comment to follow GDB's coding standards
71266         This commit reformats a comment in gdb/ada-exp.y to avoid
71267         the leading '*' at the beginning of each line of the comment.
71268
71269         gdb/ada-lang.h: Reformat comment to follow coding standards
71270         This commit reformats a comment in gdb/ada-lang.h to avoid
71271         the leading '*' at the beginning of each line of the comment.
71272
71273 2021-12-20  GDB Administrator  <gdbadmin@sourceware.org>
71274
71275         Automatic date update in version.in
71276
71277 2021-12-19  Alan Modra  <amodra@gmail.com>
71278
71279         Obsolete m32c-rtems
71280
71281         readelf: avoid a possible divide by zero
71282                 * readelf.c (process_section_headers): Check SHT_RELR entsize.
71283
71284 2021-12-19  GDB Administrator  <gdbadmin@sourceware.org>
71285
71286         Automatic date update in version.in
71287
71288 2021-12-18  Enze Li  <lienze2010@hotmail.com>
71289
71290         gdb: add "exit" command as an alias for "quit"
71291         This command adds the "exit" command as an alias for the "quit"
71292         command, as requested in PR gdb/28406.
71293
71294         The documentation is also updated to mention this new command.
71295
71296         Tested on x86_64-linux.
71297
71298         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28406
71299
71300 2021-12-18  Andrew Burgess  <aburgess@redhat.com>
71301
71302         gdb: add assert in remote_target::wait relating to async being off
71303         While working on another patch I ended up in a situation where I had
71304         async mode disabled (with 'maint set target-async off'), but the async
71305         event token got marked anyway.
71306
71307         In this situation GDB was continually calling into
71308         remote_target::wait, however, the async token would never become
71309         unmarked as the unmarking is guarded by target_is_async_p.
71310
71311         We could just unconditionally unmark the token, but that would feel
71312         like just ignoring a bug, so, instead, lets assert that if
71313         !target_is_async_p, then the async token should not be marked.
71314
71315         This assertion would have caught my earlier mistake.
71316
71317         There should be no user visible changes with this commit.
71318
71319 2021-12-18  Andrew Burgess  <aburgess@redhat.com>
71320
71321         gdb/remote: some fixes for 'maint set target-async off'
71322         While working on another patch relating to remote targets, I wanted to
71323         test with 'maint set target-async off' in place.  Unfortunately I ran
71324         into some problems.  This commit is an attempt to fix one of the
71325         issues I hit.
71326
71327         In my particular case I was actually running with:
71328
71329           maint set target-async off
71330           maint set target-non-stop off
71331
71332         that is, we're telling GDB to force the targets to operate in
71333         non-async mode, and in all-stop mode.  Here's my GDB session showing
71334         the problem:
71335
71336           (gdb) maintenance set target-async off
71337           (gdb) maintenance set target-non-stop off
71338           (gdb) target extended-remote :54321
71339           Remote debugging using :54321
71340           (gdb) attach 2365960
71341           Attaching to process 2365960
71342           No unwaited-for children left.
71343           (gdb)
71344
71345         Notice the 'No unwaited-for children left.' error, this is the
71346         problem.  There's no reason why GDB should not be able to attach to
71347         the process.
71348
71349         The problem is this:
71350
71351           1. The user runs 'attach PID' and this sends GDB into attach_command
71352           in infcmd.c.  From here we call the ::attach method on the attach
71353           target, which will be the extended_remote_target.
71354
71355           2. In extended_remote_target::attach, we attach to the remote target
71356           and get the first reply (which is a stop packet).  We put off
71357           processing the stop packet until the end of ::attach.  We setup the
71358           inferior and thread to represent the process we attached to, and
71359           download the target description.  Finally, we process the initial
71360           stop packet.
71361
71362           If '!target_is_non_stop_p ()' and '!target_can_async_p ()', which is
71363           the case for us given the maintenance commands we used, we cache the
71364           stop packet within the remote_state::buf for later processing.
71365
71366           3. Back in attach_command, if 'target_is_non_stop_p ()' then we
71367           request that the target stops.  This will either process any cached
71368           stop replies, or request that the target stops, and process the stop
71369           replies.  However, this code is not what we use due to non-stop mode
71370           being disabled.  So, we skip to the next step which is to call
71371           validate_exec_file.
71372
71373           4. Calling validate_exec_file can cause packets to be sent to the
71374           remote target, and replies received, the first path I hit is the
71375           call to target_pid_to_exec_file, which calls
71376           remote_target::pid_to_exec_file, which can then try to read the
71377           executable from the remote.  Sending an receiving packets will make
71378           use of the remote_state::buf object.
71379
71380           5. The attempt to attach continues, but the damage is already done...
71381
71382         So, the problem is that, in step #2 we cache a stop reply in the
71383         remote_state::buf, and then in step #4 we reuse the remote_state::buf
71384         object, discarding any cached stop reply.  As a result, the initial
71385         stop, which is sent when GDB first attaches to the target, is lost.
71386
71387         This problem can clearly be seen, I feel, by looking at the
71388         remote_state::cached_wait_status flag.  This flag tells GDB if there
71389         is a wait status cached in remote_state::buf.  However, in
71390         remote_target::putpkt_binary and remote_target::getpkt_or_notif_sane_1
71391         this flag is just set back to 0, doing this immediately discards any
71392         cached data.
71393
71394         I don't know if this scheme ever made sense,  looking at commit
71395         2d717e4f8a54, where the cached_wait_status flag was added, it appears
71396         that there was nothing between where the stop was cached, and where
71397         the stop was consumed, so, I suspect, there never was a situation
71398         where we ended up in putpkt_binary or getpkt_or_notif_sane_1 and
71399         needed to clear to the flag, maybe the clearing was added "just in
71400         case".  Whatever the history, I claim that this clearing this flag is
71401         no longer a good idea.
71402
71403         So, my first step toward fixing this issue was to replace the two
71404         instances of 'rs->cached_wait_status = 0;' in ::putpkt_binary and
71405         ::getpkt_or_notif_sane_1 with 'gdb_assert (rs->cached_wait_status ==
71406         0);', this, at least would show me when GDB was doing something
71407         dangerous, and indeed, this assert is now hit in my test case above.
71408
71409         I did play with using some kind of scoped restore to backup, and
71410         restore the remote_state::buf object in all the places within remote.c
71411         that I was hitting where the ::buf was being corrupted.  The first
71412         problem with this is that, where the ::cached_wait_status flag is
71413         reset is _not_ where ::buf is corrupted.  For the ::putpkt_binary
71414         case, by the time we get to the method the buffer has already been
71415         corrupted in many cases, so we end up needing to add the scoped
71416         save/restore within the callers, which means we need the save/restore
71417         in _lots_ of places.
71418
71419         Plus, using this save/restore model feels like the wrong solution.  I
71420         don't think that it's obvious that the buffer might be holding cached
71421         data, and I think it would be too easy for new corruptions of the
71422         buffer to be introduced, which could easily go unnoticed for a long
71423         time.
71424
71425         So, I really wanted a solution that didn't require us to cache data in
71426         the ::buf object.
71427
71428         Luckily, I think we already have such a solution in place, the
71429         remote_state::stop_reply_queue, it seems like this does exactly the
71430         same task, just in a slightly different way.  With the
71431         ::stop_reply_queue, the stop packets are processed upon receipt and
71432         the stop_reply object is added to the queue.  With the ::buf cache
71433         solution, the unprocessed stop reply is cached in the ::buf, and
71434         processed later.
71435
71436         So, finally, in this commit, I propose to remove the
71437         remote_state::cached_wait_status flag and to stop using the ::buf to
71438         cache stop replies.  Instead, stop replies will now always be stored
71439         in the ::stop_reply_queue.
71440
71441         There are two places where we use the ::buf to hold a cached stop
71442         reply, the first is in the ::attach method, and the second is in
71443         remote_target::start_remote, however, the second of these cases is far
71444         less problematic, as after caching the stop reply in ::buf we call the
71445         global start_remote function, which does very little work before
71446         calling normal_stop, which processes the cached stop reply.  However,
71447         my plan is to switch both users over to using ::stop_reply_queue so
71448         that the old (unsafe) ::cached_wait_status mechanism can be completely
71449         removed.
71450
71451         The next problem is that the ::stop_reply_queue is currently only used
71452         for async-mode, and so, in remote_target::push_stop_reply, where we
71453         push stop_reply objects into the ::stop_reply_queue, we currently also
71454         mark the async event token.  I've modified this so we only mark the
71455         async event token if 'target_is_async_p ()' - note, _is_, not _can_
71456         here. The ::push_stop_reply method is called in places where async
71457         mode has been temporarily disabled, but, when async mode is switched
71458         back on (see remote_target::async) we will mark the event token if
71459         there are events in the queue.
71460
71461         Another change of interest is in remote_target::remote_interrupt_as.
71462         Previously this code checked ::cached_wait_status, but didn't check
71463         for events in the ::stop_reply_queue.  Now that ::cached_wait_status
71464         has been removed we now check the queue length instead, which should
71465         have the same result.
71466
71467         Finally, in remote_target::wait_as, I've tried to merge the processing
71468         of the ::stop_reply_queue with how we used to handle the
71469         ::cached_wait_status flag.
71470
71471         Currently, when processing the ::stop_reply_queue we call
71472         process_stop_reply and immediately return.  However, when handling
71473         ::cached_wait_status we run through the whole of ::wait_as, and return
71474         at the end of the function.
71475
71476         If we consider a standard stop packet, the two differences I see are:
71477
71478           1. Resetting of the remote_state::waiting_for_stop_reply, flag; this
71479           is not currently done when processing a stop from the
71480           ::stop_reply_queue.
71481
71482           2. The final return value has the possibility of being adjusted at
71483           the end of ::wait_as, as well as there being calls to
71484           record_currthread, non of which are done if we process a stop from
71485           the ::stop_reply_queue.
71486
71487         After discussion on the mailing list:
71488
71489           https://sourceware.org/pipermail/gdb-patches/2021-December/184535.html
71490
71491         it was suggested that, when an event is pushed into the
71492         ::stop_reply_queue, the ::waiting_for_stop_reply flag is never going
71493         to be set.  As a result, we don't need to worry about the first
71494         difference.  I have however, added a gdb_assert to validate the
71495         assumption that the flag is never going to be set.  If in future the
71496         situation ever changes, then we should find out pretty quickly.
71497
71498         As for the second difference, I have resolved this by having all stop
71499         packets taken from the ::stop_reply_queue, pass through the return
71500         value adjustment code at the end of ::wait_as.
71501
71502         An example of a test that reveals the benefits of this commit is:
71503
71504           make check-gdb \
71505             RUNTESTFLAGS="--target_board=native-extended-gdbserver \
71506                           GDBFLAGS='-ex maint\ set\ target-async\ off \
71507                                     -ex maint\ set\ target-non-stop\ off' \
71508                           gdb.base/attach.exp"
71509
71510         For testing I've been running test on x86-64/GNU Linux, and run with
71511         target boards unix, native-gdbserver, and native-extended-gdbserver.
71512         For each board I've run with the default GDBFLAGS, as well as with:
71513
71514           GDBFLAGS='-ex maint\ set\ target-async\ off \
71515                     -ex maint\ set\ target-non-stop\ off' \
71516
71517         Though running with the above GDBFLAGS is clearly a lot more unstable
71518         both before and after my patch, I'm not seeing any consistent new
71519         failures with my patch, except, with the native-extended-gdbserver
71520         board, where I am seeing new failures, but only because more tests are
71521         now running.  For that configuration alone I see the number of
71522         unresolved go down by 49, the number of passes goes up by 446, and the
71523         number of failures also increases by 144.  All of the failures are new
71524         tests as far as I can tell.
71525
71526 2021-12-18  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
71527
71528         x86: Terminate mnemonicendp in swap_operand()
71529         Tested on x86_64-pc-linux-gnu.
71530
71531         opcodes/ChangeLog:
71532         2021-12-17 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
71533
71534                 * i386-dis.c (swap_operand): Terminate mnemonicendp.
71535
71536         gas/ChangeLog:
71537         2021-12-17 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
71538
71539                 * testsuite/gas/i386/opts-intel.d: Updated expected disassembly.
71540                 * testsuite/gas/i386/opts.d: Likewise.
71541                 * testsuite/gas/i386/sse2avx-opts-intel.d: Likewise.
71542                 * testsuite/gas/i386/sse2avx-opts.d: Likewise.
71543                 * testsuite/gas/i386/x86-64-opts-intel.d: Likewise.
71544                 * testsuite/gas/i386/x86-64-opts.d: Likewise.
71545                 * testsuite/gas/i386/x86-64-sse2avx-opts-intel.d: Likewise.
71546                 * testsuite/gas/i386/x86-64-sse2avx-opts.d: Likewise.
71547
71548 2021-12-18  GDB Administrator  <gdbadmin@sourceware.org>
71549
71550         Automatic date update in version.in
71551
71552 2021-12-17  Tom Tromey  <tom@tromey.com>
71553
71554         Document gdbarch-components.py
71555         This adds a comment to document how to update gdbarch.
71556
71557         Remove gdbarch.sh
71558         This patch runs gdbarch.py and removes gdbarch.sh.
71559
71560 2021-12-17  Simon Marchi  <simon.marchi@efficios.com>
71561
71562         Add new gdbarch generator
71563         The new gdbarch generator is a Python program.  It reads the
71564         "components.py" that was created in the previous patch, and generates
71565         gdbarch.c and gdbarch-gen.h.
71566
71567         This is a relatively straightforward translation of the existing .sh
71568         code.  It doesn't try very hard to be idiomatic Python or to be
71569         especially smart.
71570
71571         It is, however, incredibly faster:
71572
71573             $ time ./gdbarch.sh
71574
71575             real        0m8.197s
71576             user        0m5.779s
71577             sys 0m3.384s
71578
71579             $ time ./gdbarch.py
71580
71581             real        0m0.065s
71582             user        0m0.053s
71583             sys 0m0.011s
71584
71585         Co-Authored-By: Tom Tromey <tom@tromey.com>
71586
71587 2021-12-17  Tom Tromey  <tom@tromey.com>
71588
71589         Generate new gdbarch-components.py from gdbarch.sh
71590         The new gdbarch.sh approach will be to edit a Python file, rather than
71591         adding a line to a certain part of gdbarch.sh.  We use the existing sh
71592         code, though, to generate the first draft of this .py file.
71593
71594         Documentation on the format will come in a subsequent patch.
71595
71596         Note that some info (like "staticdefault") in the current code is
71597         actually unused, and so is ignored by this new generator.
71598
71599 2021-12-17  Tom Tromey  <tom@tromey.com>
71600
71601         Do not sort the fields in gdbarch_dump
71602         This changes gdbarch.sh so that it no longer sorts the fields in
71603         gdbarch_dump.  This sorting isn't done anywhere else by gdbarch.sh,
71604         and this simplifies the new generator a little bit.
71605
71606         Do not generate gdbarch.h
71607         Now that gdbarch.h has been split, we no longer need the generator
71608         code in gdbarch.sh, so remove it.
71609
71610 2021-12-17  Tom Tromey  <tom@tromey.com>
71611
71612         Split gdbarch.h into two files
71613         This patch splits gdbarch.h into two files -- gdbarch.h now is
71614         editable and hand-maintained, and the new gdbarch-gen.h file is the
71615         only thing generated by gdbarch.sh.  This lets us avoid maintaining
71616         boilerplate in the gdbarch.sh file.
71617
71618         Note that gdbarch.sh still generates gdbarch.h after this patch.  This
71619         makes it easier to re-run when rebasing.  This code is removed in a
71620         subsequent patch.
71621
71622 2021-12-17  Tom Tromey  <tom@tromey.com>
71623
71624         Move ordinary gdbarch code to arch-utils
71625         While I think it makes sense to generate gdbarch.c, at the same time I
71626         think it is better for ordinary code to be editable in a C file -- not
71627         as a hunk of C code embedded in the generator.
71628
71629         This patch moves this sort of code out of gdbarch.sh and gdbarch.c and
71630         into arch-utils.c, then has arch-utils.c include gdbarch.c.
71631
71632 2021-12-17  Maciej W. Rozycki  <macro@embecosm.com>
71633
71634         Avoid redundant operations in `fortran_array_walker'
71635         Move inner dimension's element type determination outside the respective
71636         loops in `fortran_array_walker'.  The operation is exactly the same with
71637         each iteration, so there is no point in redoing it for each element and
71638         while a smart compiler might be able to move it outside the loop it is
71639         regardless a bad coding style.  No functional change.
71640
71641         Initialize `m_ndimensions' in the member initializer list
71642         Following our coding convention initialize the `m_ndimensions' member in
71643         the member initializer list rather than in the body of the constructor
71644         of the `fortran_array_walker' class.  No functional change.
71645
71646 2021-12-17  Lancelot SIX  <lancelot.six@amd.com>
71647             Pedro Alves  <pedro@palves.net>
71648
71649         gdb/tui: install SIGWINCH only when connected to a TTY
71650         PR26056 reports that when GDB is connected to non-TTY stdin/stdout, it
71651         crashes when it receives a SIGWINCH signal.
71652
71653         This can be reproduced as follows:
71654
71655             $ gdb/gdb -nx -batch -ex 'run' --args sleep 60 </dev/null 2>&1 | cat
71656
71657             # from another terminal:
71658             $ kill -WINCH %(pidof gdb)
71659
71660         When doing so, the process crashes in a call to rl_resize_terminal:
71661
71662             void
71663             rl_resize_terminal (void)
71664             {
71665               _rl_get_screen_size (fileno (rl_instream), 1);
71666               ...
71667             }
71668
71669         The problem is that at this point rl_instream has the value NULL.
71670
71671         The rl_instream variable is supposed to be initialized during a call to
71672         readline_initialize_everything, which in a normal startup sequence is
71673         called under this call chain:
71674
71675             tui_interp::init
71676               tui_ensure_readline_initialized
71677                 rl_initialize
71678                   readline_initialize_everything
71679
71680         In tui_interp::init, we have the following sequence:
71681
71682             tui_initialize_io ();
71683             tui_initialize_win ();                // <- Installs SIGWINCH
71684             if (gdb_stdout->isatty ())
71685               tui_ensure_readline_initialized (); // <- Initializes rl_instream
71686
71687         This function unconditionally installs the SIGWINCH signal handler (this
71688         is done by tui_initialize_win), and then if gdb_stdout is a TTY it
71689         initializes readline.  Therefore, if stdout is not a TTY, SIGWINCH is
71690         installed but readline is not initialized.  In such situation
71691         rl_instream stays NULL, and when GDB receives a SIGWINCH it calls its
71692         handler and in fine tries to access rl_instream leading to the crash.
71693
71694         This patch proposes to fix this issue by installing the SIGWINCH signal
71695         handler only if GDB is connected to a TTY.  Given that this
71696         initialization it the only task of tui_initialize_win, this patch moves
71697         tui_initialize_win just after the call to
71698         tui_ensure_readline_initialized.
71699
71700         Tested on x86_64-linux.
71701
71702         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26056
71703         Change-Id: I6458acef7b0d9beda2a10715d0345f02361076d9
71704
71705 2021-12-17  Alan Modra  <amodra@gmail.com>
71706
71707         asan: NULL dereference in bfd_elf_set_group_contents
71708                 * elf-bfd.h (struct output_elf_obj_tdata): Make num_section_syms
71709                 unsigned.
71710                 * elf.c (bfd_elf_set_group_contents): Bounds check sec->index
71711                 and check that entry in elf_section_syms for sec is non-NULL.
71712                 (_bfd_elf_symbol_from_bfd_symbol): Adjust.
71713
71714 2021-12-17  Alan Modra  <amodra@gmail.com>
71715
71716         asan: use after free in _bfd_elf_mips_get_relocated_section_contents
71717         Leaving entries on mips_hi16_list from a previous pass over relocs
71718         leads to confusing bugs.
71719
71720                 * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents):
71721                 Free mips_hi16_list entries on error exit.
71722
71723 2021-12-17  Alan Modra  <amodra@gmail.com>
71724
71725         asan: abort in wasm_scan_name_function_section
71726         Macros like READ_LEB128 in wasm-module.c that alter control flow are
71727         evil.  Maintainers will break your code if you have hidden ways to
71728         reach labels.
71729
71730                 * wasm-module.c (wasm_scan_name_function_section): Don't
71731                 attempt to bfd_release NULL.
71732
71733 2021-12-17  Alan Modra  <amodra@gmail.com>
71734
71735         asan: heap-buffer-overflow in bpf_elf_generic_reloc
71736         The bpf reloc howtos are a bit weird, using bitpos to specify an
71737         offset from r_offset that is outside the size of the reloc as given by
71738         howto.size.  That means bfd_get_reloc_size gives the wrong answer for
71739         range checking, and thus bfd_reloc_offset_in_range can't be used.
71740
71741                 * elf64-bpf.c (bpf_elf_generic_reloc): Handle bitpos offset reloc
71742                 range checking.
71743
71744 2021-12-17  Alan Modra  <amodra@gmail.com>
71745
71746         ubsan: bfd.c:2519:8: shift exponent 34 is too large
71747                 * bfd.c (bfd_update_compression_header): Avoid integer overflow.
71748
71749         asan: buffer overflow in mmo_get_symbols
71750                 * mmo.c (mmo_get_symbols): Error on symbol name exceeding max length.
71751
71752 2021-12-17  Alan Modra  <amodra@gmail.com>
71753
71754         asan: buffer overflow in elfnn-aarch64.c get_plt_type
71755         We can't assume .dynamic is a multiple of ElfNN_External_Dyn, at least
71756         not when presented with fuzzed object files.
71757
71758                 * elfnn-aarch64.c (get_plt_type): Don't access past end of
71759                 improperly sized .dynamic.
71760
71761 2021-12-17  Alan Modra  <amodra@gmail.com>
71762
71763         try_build_id_prefix gcc-10 -Wformat-security errors
71764         dwarf.c:11300:3: error: format not a string literal and no format arguments [-Werror=format-security]
71765         11300 |   f += sprintf (f, prefix);
71766
71767                 PR 28697
71768                 * dwarf.c (try_build_id_prefix): Avoid -Wformat-security error.
71769
71770 2021-12-17  GDB Administrator  <gdbadmin@sourceware.org>
71771
71772         Automatic date update in version.in
71773
71774 2021-12-16  Nick Clifton  <nickc@redhat.com>
71775
71776         Fix AVR assembler so that it creates relocs that will work with linker relaxation.
71777                 PR 28686
71778         gas     * config/tc-avr.h (tc_fix_adjustable): Define.
71779                 * config/tc-avr.c (avr_fix_adjustable): New function.
71780                 * testsuite/gas/all/gas.exp: Skip tests that need adjustable fixups.
71781                 * testsuite/gas/elf/elf.exp: Likewise.
71782                 * testsuite/gas/avr/diffreloc_withrelax.d: Adjust expected output.
71783                 * testsuite/gas/avr/pc-relative-reloc.d: Adjust expected output.
71784
71785         ld      * testsuite/ld-avr/avr-prop-7.d: Adjust expected output.
71786                 * testsuite/ld-avr/avr-prop-8.d: Likewise.
71787                 * testsuite/ld-avr/pr13402.d: Likewise.
71788
71789 2021-12-16  Nick Clifton  <nickc@redhat.com>
71790
71791         When loading separate debug info files, also attempt to locate a file based upon the build-id.
71792                 PR 28697
71793                 * dwarf.c (load_build_id_debug_file): New function.
71794                 (try_build_id_prefix): New function.
71795                 (check_for_and_load_links): Call load_build_id_debug_file.
71796                 (debug_displays): Add entry for .note.gnu.build-id.
71797                 * dwarf.h (enum dwarf_section_display_enum): Add
71798                 note_gnu_build_id.
71799                 * testsuite/binutils-all/debuginfod.exp (test_fetch_debuglink):
71800                 Fix regexp for loads via debuglink section.
71801
71802 2021-12-16  Richard Sandiford  <richard.sandiford@arm.com>
71803
71804         arm: Add support for Armv9.1-A to Armv9.3-A
71805         This patch adds AArch32 support for -march=armv9.[123]-a.
71806         The behaviour of the new options can be expressed using a
71807         combination of existing feature flags and tables.
71808
71809         The cpu_arch_ver entries for ARM_ARCH_V9_2A and ARM_ARCH_V9_3A
71810         are technically redundant but it seemed less surprising to include
71811         them anyway.
71812
71813         include/
71814                 * opcode/arm.h (ARM_ARCH_V9_1A, ARM_ARCH_V9_2A): New macros.
71815                 (ARM_ARCH_V9_3A): Likewise.
71816
71817         gas/
71818                 * doc/c-arm.texi: Add armv9.1-a, armv9.2-a and armv9.3-a.
71819                 * config/tc-arm.c (armv91a_ext_table, armv92a_ext_table): New macros.
71820                 (armv93a_ext_table): Likewise.
71821                 (arm_archs): Add armv9.1-a, armv9.2-a and armv9.3-a.
71822                 (cpu_arch_ver): Add ARM_ARCH_V9_1A, ARM_ARCH_V9_2A and ARM_ARCH_V9_3A.
71823                 * NEWS: Mention the above.
71824                 * testsuite/gas/arm/attr-march-armv9_1-a.d: New test.
71825                 * testsuite/gas/arm/attr-march-armv9_2-a.d: Likewise.
71826                 * testsuite/gas/arm/attr-march-armv9_3-a.d: Likewise.
71827                 * testsuite/gas/arm/bfloat16-armv9.1-a.d: Likewise.
71828                 * testsuite/gas/arm/bfloat16-armv9.2-a.d: Likewise.
71829                 * testsuite/gas/arm/bfloat16-armv9.3-a.d: Likewise.
71830                 * testsuite/gas/arm/i8mm-armv9.1-a.d: Likewise.
71831                 * testsuite/gas/arm/i8mm-armv9.2-a.d: Likewise.
71832                 * testsuite/gas/arm/i8mm-armv9.3-a.d: Likewise.
71833
71834 2021-12-16  Richard Sandiford  <richard.sandiford@arm.com>
71835
71836         arm: Add support for Armv8.7-A and Armv8.8-A
71837         This patch adds AArch32 support for -march=armv8.[78]-a.
71838         The behaviour of the new options can be expressed using a
71839         combination of existing feature flags and tables.
71840
71841         The cpu_arch_ver entries are technically redundant but
71842         it seemed less surprising to include them anyway.
71843
71844         include/
71845                 * opcode/arm.h (ARM_ARCH_V8_7A, ARM_ARCH_V8_8A): New macros.
71846
71847         gas/
71848                 * doc/c-arm.texi: Add armv8.7-a and armv8.8-a.
71849                 * config/tc-arm.c (armv87a_ext_table, armv88a_ext_table): New macros.
71850                 (arm_archs): Add armv8.7-a and armv8.8-a.
71851                 (cpu_arch_ver): Add ARM_ARCH_V8_7A and ARM_ARCH_V8_8A.
71852                 * NEWS: Mention the above.
71853                 * testsuite/gas/arm/attr-march-armv8_7-a.d: New test.
71854                 * testsuite/gas/arm/attr-march-armv8_8-a.d: Likewise.
71855                 * testsuite/gas/arm/bfloat16-armv8.7-a.d: Likewise.
71856                 * testsuite/gas/arm/bfloat16-armv8.8-a.d: Likewise.
71857                 * testsuite/gas/arm/i8mm-armv8.7-a.d: Likewise.
71858                 * testsuite/gas/arm/i8mm-armv8.8-a.d: Likewise.
71859
71860 2021-12-16  Richard Sandiford  <richard.sandiford@arm.com>
71861
71862         aarch64: Add support for Armv9.1-A to Armv9.3-A
71863         This patch adds AArch64 support for -march=armv9.[123]-a.
71864         The behaviour of the new options can be expressed using a
71865         combination of existing feature flags, so we don't need to
71866         eat into the vanishing number of spare AARCH64_FEATURE_* bits.
71867         Hoewver, it was more convenient to separate out the |s of
71868         feature flags so that Armv9.1-A could reuse the set for
71869         Armv8.6-A, and so on.
71870
71871         include/
71872                 * opcode/aarch64.h (AARCH64_ARCH_V8_FEATURES): New macro,
71873                 split out from...
71874                 (AARCH64_ARCH_V8): ...here.
71875                 (AARCH64_ARCH_V8_1_FEATURES): New macro, split out from...
71876                 (AARCH64_ARCH_V8_1): ...here.
71877                 (AARCH64_ARCH_V8_2_FEATURES): New macro, split out from...
71878                 (AARCH64_ARCH_V8_2): ...here.
71879                 (AARCH64_ARCH_V8_3_FEATURES): New macro, split out from...
71880                 (AARCH64_ARCH_V8_3): ...here.
71881                 (AARCH64_ARCH_V8_4_FEATURES): New macro, split out from...
71882                 (AARCH64_ARCH_V8_4): ...here.
71883                 (AARCH64_ARCH_V8_5_FEATURES): New macro, split out from...
71884                 (AARCH64_ARCH_V8_5): ...here.
71885                 (AARCH64_ARCH_V8_6_FEATURES): New macro, split out from...
71886                 (AARCH64_ARCH_V8_6): ...here.
71887                 (AARCH64_ARCH_V8_7_FEATURES): New macro, split out from...
71888                 (AARCH64_ARCH_V8_7): ...here.
71889                 (AARCH64_ARCH_V8_8_FEATURES): New macro, split out from...
71890                 (AARCH64_ARCH_V8_8): ...here.
71891                 (AARCH64_ARCH_V9_FEATURES): New macro, split out from...
71892                 (AARCH64_ARCH_V9): ...here.
71893                 (AARCH64_ARCH_V9_1_FEATURES, AARCH64_ARCH_V9_1): New macros.
71894                 (AARCH64_ARCH_V9_2_FEATURES, AARCH64_ARCH_V9_2): New macros.
71895                 (AARCH64_ARCH_V9_3_FEATURES, AARCH64_ARCH_V9_3): New macros.
71896
71897         gas/
71898                 * doc/c-aarch64.texi: Add armv9.1-a, armv9-2-a and armv9.3-a.
71899                 * config/tc-aarch64.c (aarch64_archs): Likewise.
71900                 * NEWS: Mention the above.
71901                 * testsuite/gas/aarch64/armv9_invalid.d,
71902                 testsuite/gas/aarch64/armv9_invalid.s,
71903                 testsuite/gas/aarch64/armv9_invalid.l: New test.
71904                 * testsuite/gas/aarch64/armv9_1.d,
71905                 testsuite/gas/aarch64/armv9_1.s: Likewise.
71906                 * testsuite/gas/aarch64/armv9_1_invalid.d,
71907                 testsuite/gas/aarch64/armv9_1_invalid.s,
71908                 testsuite/gas/aarch64/armv9_1_invalid.l: Likewise.
71909                 * testsuite/gas/aarch64/armv9_2.d,
71910                 testsuite/gas/aarch64/armv9_2.s: Likewise.
71911                 * testsuite/gas/aarch64/armv9_2_invalid.d,
71912                 testsuite/gas/aarch64/armv9_2_invalid.s,
71913                 testsuite/gas/aarch64/armv9_2_invalid.l: Likewise.
71914                 * testsuite/gas/aarch64/armv9_3.d,
71915                 testsuite/gas/aarch64/armv9_3.s: Likewise.
71916
71917 2021-12-16  Nelson Chu  <nelson.chu@sifive.com>
71918
71919         RISC-V: Support svinval extension with frozen version 1.0.
71920         According to the privileged spec, there are five new instructions for
71921         svinval extension.  Two of them (HINVAL.VVMA and HINVAL.GVMA) need to
71922         enable the hypervisor extension.  But there is no implementation of
71923         hypervisor extension in mainline for now, so let's consider the related
71924         issues later.
71925
71926                         31..25  24..20 19..15 14..12 11...7 6..2  1..0
71927         sinval.vma      0001011 rs2    rs1    000    00000  11100 11
71928         sfence.w.inval  0001100 00000  00000  000    00000  11100 11
71929         sfence.inval.ir 0001100 00001  00000  000    00000  11100 11
71930         hinval.vvma     0010011 rs2    rs1    000    00000  11100 11
71931         hinval.gvma     0110011 rs2    rs1    000    00000  11100 11
71932
71933         This patch is cherry-picked from the riscv integration branch since the
71934         svinval extension is frozen for now.  Besides, we fix the funct7 encodings
71935         of hinval.vvma and hinval.gvma, from 0x0011011 and 0x0111011 to 0x0010011
71936         and 0x0110011.
71937
71938         bfd/
71939                 * elfxx-riscv.c (riscv_supported_std_s_ext): Added svinval.
71940                 (riscv_multi_subset_supports): Handle INSN_CLASS_SVINVAL.
71941         gas/
71942                 * testsuite/gas/riscv/svinval.d: New testcase.
71943                 * testsuite/gas/riscv/svinval.s: Likewise.
71944         include/
71945                 * opcode/riscv-opc.h: Added encodings for svinval.
71946                 * opcode/riscv.h (enum riscv_insn_class): Added INSN_CLASS_SVINVAL.
71947         opcodes/
71948                 * riscv-opc.c (riscv_opcodes): Added svinval instructions.
71949
71950 2021-12-16  Mike Frysinger  <vapier@gentoo.org>
71951
71952         sim: mips/or1k: drop redundant arg to bitsize macro
71953         These are just using the default behavior for the 3rd arg, so drop
71954         it to make it more clear.  This also makes them match all other
71955         ports that only use the first 2 arguments.
71956
71957 2021-12-16  Mike Frysinger  <vapier@gentoo.org>
71958
71959         bfd: unify texi generation rules
71960         The logic between these rules are extremely similar, so unify them
71961         into a single variable by leveraging make $@ and $< variables.
71962
71963         Also add automake silent rule support while we're here.
71964
71965 2021-12-16  Mike Frysinger  <vapier@gentoo.org>
71966
71967         sim: fix mingw builds with replacement gnulib open
71968         The header shuffling in here broke the workaround for gnulib defining
71969         "open".  Move it back before the sim-specific includes to fix.  This
71970         is because the callback struct in the headers has an "open" member and
71971         this file tries to call that.
71972
71973 2021-12-16  Sandra Loosemore  <sandra@codesourcery.com>
71974
71975         Adjust compare_link_order for unstable qsort
71976         In a cross toolchain for nios2-elf target and x86_64-w64-mingw32 host
71977         using binutils 2.37, we observed a failure that didn't show up on
71978         x86_64-linux-gnu host:  testcase pr25490-5.s was failing with
71979
71980         C:\path\to\nios2-elf-ld.exe: looping in map_segments
71981         FAIL: __patchable_function_entries section 5
71982
71983                 * ldelfgen.c (compare_link_order): Don't use section id in
71984                 sorting.  Keep original ordering instead.  Update comments.
71985
71986 2021-12-16  Alan Modra  <amodra@gmail.com>
71987
71988         Re: Fix an undefined behaviour in the BFD library's DWARF parser
71989         Using an unsigned int cast (to 32 bits) on a pointer difference (of
71990         possibly 64 bits) is wrong.  Even though it will work on all real
71991         object files, the fuzzers will eventually find this hole.
71992
71993                 PR 28687
71994                 * dwarf1.c (parse_die): Cast pointer difference to size_t.
71995                 Catch another possible pointer overflow.
71996
71997 2021-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
71998
71999         gdb: re-format with black 21.12b0
72000         Run black 21.12b0 on gdb/, there is a single whitespace change.  I will
72001         update the wiki [1] in parallel to bump the version of black to 21.12b0.
72002
72003         [1] https://sourceware.org/gdb/wiki/Internals%20GDB-Python-Coding-Standards
72004
72005         Change-Id: Ib3b859e3506c74a4f15d16f1e44ef402de3b98e2
72006
72007 2021-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
72008
72009         gdb: re-format with black 21.9b0
72010         Run black 21.9b0 on gdb/ (this is the version currently mentioned on the
72011         wiki [1], the subsequent commit will bump that version).
72012
72013         [1] https://sourceware.org/gdb/wiki/Internals%20GDB-Python-Coding-Standards
72014
72015         Change-Id: I5ceaab42c42428e053e2572df172aa42a88f0f86
72016
72017 2021-12-16  GDB Administrator  <gdbadmin@sourceware.org>
72018
72019         Automatic date update in version.in
72020
72021 2021-12-15  Alan Modra  <amodra@gmail.com>
72022
72023         PR28691, validate dwarf attribute form
72024         PR28691 is a fuzzing PR that triggers a non-problem of "output changes
72025         per run" with PIEs and/or different compilers.  I've closed similar
72026         PRs before as wontfix, but I guess there will be no end of this type
72027         of PR.  The trigger is an attribute that usually takes one of the
72028         offset/constant reference DW_FORMs being given an indexed string
72029         DW_FORM.  The bfd reader doesn't support indexed strings and returns
72030         an error string instead.  The address of the string varies with PIE
72031         runs and/or compiler, and we allow that address to appear in output.
72032         Fix this by validating integer attribute forms, as we do for string
72033         form attributes.
72034
72035                 PR 28691
72036                 * dwarf2.c (is_str_attr): Rename to..
72037                 (is_str_form): ..this.  Change param type.  Update calls.
72038                 (is_int_form): New function.
72039                 (read_attribute_value): Handle DW_FORM_addrx2.
72040                 (find_abstract_instance): Validate form when using attr.u.val.
72041                 (scan_unit_for_symbols, parse_comp_unit): Likewise.
72042
72043 2021-12-15  Luis Machado  <luis.machado@linaro.org>
72044
72045         New --enable-threading configure option to control use of threads in GDB/GDBserver
72046         Add the --enable-threading configure option so multithreading can be disabled
72047         at configure time. This is useful for statically-linked builds of
72048         GDB/GDBserver, since the thread library doesn't play well with that setup.
72049
72050         If you try to run a statically-linked GDB built with threading, it will crash
72051         when setting up the number of worker threads.
72052
72053         This new option is also convenient when debugging GDB in a system with lots of
72054         threads, where the thread discovery code in GDB will emit too many messages,
72055         like so:
72056
72057         [New Thread 0xfffff74d3a50 (LWP 2625599)]
72058
72059         If you have X threads, that message will be repeated X times.
72060
72061         The default for --enable-threading is "yes".
72062
72063 2021-12-15  Nikita Popov  <npv1310@gmail.com>
72064
72065         Fix an undefined behaviour in the BFD library's DWARF parser.
72066                 PR 28687
72067                 * dwarf1.c (parse_die): Fix undefined behaviour in range tests.
72068
72069 2021-12-15  Alan Modra  <amodra@gmail.com>
72070
72071         PR28694, Out-of-bounds write in stab_xcoff_builtin_type
72072                 PR 28694
72073                 * stabs.c (stab_xcoff_builtin_type): Make typenum unsigned.
72074                 Negate typenum earlier, simplifying bounds checking.  Correct
72075                 off-by-one indexing.  Adjust switch cases.
72076
72077 2021-12-15  GDB Administrator  <gdbadmin@sourceware.org>
72078
72079         Automatic date update in version.in
72080
72081 2021-12-14  Alan Modra  <amodra@gmail.com>
72082
72083         loongarch32 build failure on 32-bit host
72084         gas/config/tc-loongarch.c: In function ‘assember_macro_helper’:
72085         gas/config/tc-loongarch.c:915:28: error: right shift count >= width of type [-Werror=shift-count-overflow]
72086           915 |       hi32 = insn->args[1] >> 32;
72087               |                            ^~
72088
72089         One possible fix is to make offsetT a 64-bit type for loongarch32.
72090         This also makes bfd/targmatch.h (generated from bfd/config.bfd)
72091         consistent since the loongarch32 match is inside #ifdef BFD64.
72092
72093                 * config.bfd (loongarch32-*): Set want64.
72094
72095 2021-12-14  Alan Modra  <amodra@gmail.com>
72096
72097         loongarch64 build failure on 32-bit host
72098         gas/config/tc-loongarch.c: In function ‘loongarch_args_parser_can_match_arg_helper’:
72099         gas/config/tc-loongarch.c:661:13: error: cast from pointer to integer of different size [-Werror=pointer
72100         -to-int-cast]
72101           661 |       imm = (offsetT) str_hash_find (r_htab, arg);
72102               |             ^
72103
72104         Cast it to the correct size int, relying on normal integer promotions
72105         if offsetT is larger than a pointer.
72106
72107                 * config/tc-loongarch.c (loongarch_args_parser_can_match_arg_helper):
72108                 Cast return from str_hash_find to intptr_t, not offsetT.
72109
72110 2021-12-14  Alan Modra  <amodra@gmail.com>
72111
72112         XCOFF C_STSYM test failure on 32-bit host
72113         This test was failing here and on another similar symbol:
72114         [  4](sec  1)(fl 0x00)(ty   0)(scl 143) (nx 0) 0x05d1745d11745d21 .bs
72115         where correct output is
72116         [  4](sec  1)(fl 0x00)(ty   0)(scl 143) (nx 0) 0x000000000000000a .bs
72117
72118         The problem is caused by a 32-bit host pointer being sign-extended
72119         when stored into a 64-bit bfd_vma, and then that value not being
72120         trimmed back to 32 bits when used.  The following belt-and-braces
72121         patch fixes both the store and subsequent reads.
72122
72123                 * coffcode.h (coff_slurp_symbol_table): Do not sign extend
72124                 when storing a host pointer to syment.n_value.
72125                 * coffgen.c (coff_get_symbol_info): Cast syment.n_value to a
72126                 bfd_hostptr_t before using in arithmetic.
72127                 (coff_print_symbol): Likewise.
72128
72129 2021-12-14  Simon Marchi  <simon.marchi@efficios.com>
72130
72131         gdbserver/tracepoint.cc: use snprintf in gdb_agent_socket_init
72132         If we modify tracepoint.cc to try to use a too long unix socket name,
72133         for example by modifying SOCK_DIR to be:
72134
72135             #define SOCK_DIR "/tmp/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut/salut"
72136
72137         ... trying to start an application with libinproctrace.so loaded
72138         crashes:
72139
72140             $ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6:./libinproctrace.so /bin/ls
72141             /home/smarchi/src/binutils-gdb/gdbserver/../gdbsupport/common-utils.cc:69: A problem internal to GDBserver in-process agent has been detected.
72142             xsnprintf: Assertion `ret < size' failed.
72143
72144         Looking at the rest of the socket initialization code, the intent seems
72145         to be that if something goes wrong, we warn but let the program
72146         execute.  So crashing on this failed assertions seems against the intent.
72147
72148         Commit 6cebaf6e1ae4 ("use xsnprintf instead of snprintf.") changed this
72149         code to use xsnprintf instead of snprintf, introducing this assertion.
72150         Before that, snprintf would return a value bigger that UNIX_PATH_MAX and
72151         the "if" after would catch it and emit a warning, which is exactly what
72152         we want.  That change was done because LynxOS didn't have snprintf.
72153         Since LynxOS isn't supported anymore, we can simply revert to use
72154         snprintf there.
72155
72156         With this patch, we get a warning (printed by the caller of
72157         gdb_agent_socket_init), but the program keeps executing:
72158
72159             $ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6:./libinproctrace.so /bin/ls
72160             ipa: could not create sync socket
72161             ...
72162
72163         Change-Id: I78bca52d5dc3145335abeae45a42052701e3f5dd
72164
72165 2021-12-14  Simon Marchi  <simon.marchi@efficios.com>
72166
72167         gdbserver/tracepoint.cc: work around -Wstringop-truncation error
72168         When building gdb with  on AArch64 with g++ 11.1.0 (and some preceding
72169         versions too), -O2 and -fsanitize=address, I get this error.
72170
72171               CXX    tracepoint-ipa.o
72172             cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
72173             In file included from /usr/include/string.h:519,
72174                              from ../gnulib/import/string.h:41,
72175                              from /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/common-defs.h:95,
72176                              from /home/simark/src/binutils-gdb/gdbserver/server.h:22,
72177                              from /home/simark/src/binutils-gdb/gdbserver/tracepoint.cc:19:
72178             In function ‘char* strncpy(char*, const char*, size_t)’,
72179                 inlined from ‘int init_named_socket(const char*)’ at /home/simark/src/binutils-gdb/gdbserver/tracepoint.cc:6902:11,
72180                 inlined from ‘int gdb_agent_socket_init()’ at /home/simark/src/binutils-gdb/gdbserver/tracepoint.cc:6953:26,
72181                 inlined from ‘void* gdb_agent_helper_thread(void*)’ at /home/simark/src/binutils-gdb/gdbserver/tracepoint.cc:7204:41:
72182             /usr/include/bits/string_fortified.h:95:34: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output may be truncated copying 107 bytes from a string of length 107 [-Werror=stringop-truncation]
72183                95 |   return __builtin___strncpy_chk (__dest, __src, __len,
72184                   |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
72185                96 |                                   __glibc_objsize (__dest));
72186                   |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
72187
72188         Note that _FORTIFY_SOURCE changes the message a bit, but I get a similar
72189         error if I use -D_FORTIFY_SOURCE=0.
72190
72191         I am pretty sure it's spurious and might be related to this GCC bug:
72192
72193           https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780
72194
72195         From what I can see, we are copying from a static 108 bytes long buffer
72196         (the global array agent_socket_name) to a 108 bytes long array,
72197         sockaddr_un::sun_path.  I don't see anything wrong.
72198
72199         Still, it would make things easier if we didn't see this error.  Change
72200         the code to check that the source string length is smaller than the
72201         destination buffer (including space for the NULL byte) and use strcpy.
72202
72203         For anybody who would like to try to reproduce, the full command line
72204         is:
72205
72206             g++     -I. -I/home/simark/src/binutils-gdb/gdbserver -I/home/simark/src/binutils-gdb/gdbserver/../gdb/regformats -I/home/simark/src/binutils-gdb/gdbserver/.. -I/home/simark/src/binutils-gdb/gdbserver/../include -I/home/simark/src/binutils-gdb/gdbserver/../gdb -I/home/simark/src/binutils-gdb/gdbserver/../gnulib/import -I../gnulib/import -I/home/simark/src/binutils-gdb/gdbserver/.. -I..   -pthread -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wmissing-prototypes -Wstrict-null-sentinel -Wformat -Wformat-nonliteral -Werror -DGDBSERVER  -DCONFIG_UST_GDB_INTEGRATION -Drpl_strerror_r=strerror_r -Drpl_free=free -fPIC -DIN_PROCESS_AGENT -fvisibility=hidden -g3 -O2 -fsanitize=address   -c -o tracepoint-ipa.o -MT tracepoint-ipa.o -MMD -MP -MF ./.deps/tracepoint-ipa.Tpo /home/simark/src/binutils-gdb/gdbserver/tracepoint.cc
72207
72208         Change-Id: I18e86c0487feead7e7677e69398405e7057cf464
72209
72210 2021-12-14  Simon Marchi  <simon.marchi@polymtl.ca>
72211
72212         bfd: fix -Wunused errors with clang 13+
72213         Clang 13 and 14 produce some -Wunused-but-set-{variable,parameter} for
72214         situations where gcc doesn't.  In particular, when a variable is set and
72215         then used in a way to update its own value.  For example, if `i` is only
72216         used in this way:
72217
72218           int i = 2;
72219           i++;
72220           i = i + 1;
72221
72222         gcc won't warn, but clang will.
72223
72224         Fix all such errors found in an --enable-targets=all build.  It would be
72225         important for somebody who knows what they're doing to just make sure
72226         that these variables can indeed be deleted, and that there a no cases
72227         where it's a bug, and the variable should actually be used.
72228
72229         The first instance of this error fix by this patch is:
72230
72231               CC       elf32-score.lo
72232             /home/simark/src/binutils-gdb/bfd/elf32-score.c:450:11: error: variable 'relocation' set but not used [-Werror,-Wunused-but-set-variable]
72233               bfd_vma relocation;
72234                       ^
72235
72236         Change-Id: I2f233ce20352645cf388aff3dfa08a651d21a6b6
72237
72238 2021-12-14  Andrew Burgess  <aburgess@redhat.com>
72239
72240         gdb/mi: rename build_table to add_builtin_mi_commands
72241         Just give the function build_table a more descriptive name.  There
72242         should be no user visible changes after this commit.
72243
72244 2021-12-14  Jan Vrany  <jan.vrany@labware.com>
72245
72246         gdb/mi: rename mi_cmd to mi_command
72247         Just give this class a new name, more inline with the name of the
72248         sub-classes.  I've also updated mi_cmd_up to mi_command_up in
72249         mi-cmds.c inline with this new naming scheme.
72250
72251         There should be no user visible changes after this commit.
72252
72253 2021-12-14  Jan Vrany  <jan.vrany@labware.com>
72254
72255         gdb/mi: use separate classes for different types of MI command
72256         This commit changes the infrastructure in mi-cmds.{c,h} to add new
72257         sub-classes for the different types of MI command.  Instances of these
72258         sub-classes are then created and added into mi_cmd_table.
72259
72260         The existing mi_cmd class becomes the abstract base class, this has an
72261         invoke method and takes care of the suppress notifications handling,
72262         before calling a do_invoke virtual method which is implemented by all
72263         of the sub-classes.
72264
72265         There's currently two different sub-classes, one of pure MI commands,
72266         and a second for MI commands that delegate to CLI commands.
72267
72268         There should be no user visible changes after this commit.
72269
72270 2021-12-14  Andrew Burgess  <aburgess@redhat.com>
72271
72272         gdb/mi: int to bool conversion in mi_execute_cli_command
72273         Change an argument of mi_execute_cli_command from int to bool.  Update
72274         the callers to take this into account.  Within mi_execute_cli_command,
72275         update a comparison of a pointer to 0 with a comparison to nullptr,
72276         and add an assert, if we are not using the argument string then the
72277         string should be nullptr.  Also removed a cryptic 'gdb_????' comment,
72278         which isn't really helpful.
72279
72280         There should be no user visible changes after this commit.
72281
72282 2021-12-14  Jan Vrany  <jan.vrany@labware.com>
72283
72284         gdb/mi: use std::map for MI commands in mi-cmds.c
72285         This changes the hashmap used in mi-cmds.c from a custom structure to
72286         std::map.  Not only is replacing a custom container with a standard
72287         one an improvement, but using std::map will make it easier to
72288         dynamically add commands; which is something that is planned for a
72289         later series, where we will allow MI commands to be implemented in
72290         Python.
72291
72292         There should be no user visible changes after this commit.
72293
72294 2021-12-14  Jan Vrany  <jan.vrany@labware.com>
72295
72296         gdb/mi: rename mi_lookup to mi_cmd_lookup
72297         Lets give this function a more descriptive name.  I've also improved
72298         the comments in the header and source files.
72299
72300         There should be no user visible changes after this commit.
72301
72302 2021-12-14  Nelson Chu  <nelson.chu@sifive.com>
72303
72304         RISC-V: Added ld testcases for the medlow and medany code models.
72305         There are two linker scripts, code-model-01.ld and code-model-02.ld,
72306         which are corresponding to the two different memory layouts,
72307
72308         * code-model-01.ld: the text section is in the 32-bit address range, but
72309           the data section is far away from the text section, which means the data
72310           section is over the 32-bit address range.
72311
72312         * code-model-02.ld: the text section is over the 32-bit address range, but
72313           the data section is placed nearly zero address.
72314
72315         We use the two linker scripts, to test the current medlow and medany behaviors
72316         of GNU ld, including the weak symbol references and the relaxations behaviors.
72317         Besides, these testcases also show the limits of the current medlow and medany
72318         code models, that is - we may get the truncated to fit errors when linking
72319         with the above two linker scripts.
72320
72321         ld/
72322                 * testsuite/ld-riscv-elf/code-model-01.ld: New testcases to test the
72323                 behaviors of the current medlow and medany code models.
72324                 * testsuite/ld-riscv-elf/code-model-02.ld: Likewise.
72325                 * testsuite/ld-riscv-elf/code-model-medany-01.d: Likewise.
72326                 * testsuite/ld-riscv-elf/code-model-medany-02.d: Likewise.
72327                 * testsuite/ld-riscv-elf/code-model-medany-weakref-01.d: Likewise.
72328                 * testsuite/ld-riscv-elf/code-model-medany-weakref-02.d: Likewise.
72329                 * testsuite/ld-riscv-elf/code-model-medlow-01.d: Likewise.
72330                 * testsuite/ld-riscv-elf/code-model-medlow-02.d: Likewise.
72331                 * testsuite/ld-riscv-elf/code-model-medlow-weakref-01.d: Likewise.
72332                 * testsuite/ld-riscv-elf/code-model-medlow-weakref-02.d: Likewise.
72333                 * testsuite/ld-riscv-elf/code-model-relax-medany-01.d: Likewise.
72334                 * testsuite/ld-riscv-elf/code-model-relax-medany-02.d: Likewise.
72335                 * testsuite/ld-riscv-elf/code-model-relax-medany-weakref-01.d: Likewise.
72336                 * testsuite/ld-riscv-elf/code-model-relax-medany-weakref-02.d: Likewise.
72337                 * testsuite/ld-riscv-elf/code-model-relax-medlow-01.d: Likewise.
72338                 * testsuite/ld-riscv-elf/code-model-relax-medlow-02.d: Likewise.
72339                 * testsuite/ld-riscv-elf/code-model-relax-medlow-weakref-01.d: Likewise.
72340                 * testsuite/ld-riscv-elf/code-model-relax-medlow-weakref-02.d: Likewise.
72341                 * testsuite/ld-riscv-elf/code-model.s: Likewise.
72342                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
72343
72344 2021-12-14  GDB Administrator  <gdbadmin@sourceware.org>
72345
72346         Automatic date update in version.in
72347
72348 2021-12-13  H.J. Lu  <hjl.tools@gmail.com>
72349
72350         x86: Adjust linker tests for --disable-separate-code
72351         Adjust linker tests for linker configured with --disable-separate-code:
72352
72353         1. Update expected outputs.
72354         2. Pass -z max-page-size=0x1000 -z separate-code" to linker.
72355
72356                 * testsuite/ld-i386/report-reloc-1.l: Updated.
72357                 * testsuite/ld-x86-64/report-reloc-1.l: Likewise.
72358                 * testsuite/ld-x86-64/pe-x86-64.exp: Pass
72359                 "-z max-page-size=0x1000 -z separate-code" to linker.
72360                 * testsuite/ld-x86-64/pr19609-4e.d: Likewise.
72361                 * testsuite/ld-x86-64/pr19609-6a.d: Likewise.
72362                 * testsuite/ld-x86-64/pr19609-6b.d: Likewise.
72363                 * testsuite/ld-x86-64/pr19609-7b.d: Likewise.
72364                 * testsuite/ld-x86-64/pr19609-7d.d: Likewise.
72365
72366 2021-12-13  Carl Love  <cel@us.ibm.com>
72367
72368         gdb: Powerpc mark xfail in gdb.base/catch-syscall.exp
72369         Powerpc is not reporting the
72370
72371           Catchpoint 1 (returned from syscall execve),  ....
72372
72373         as expected.  The issue appears to be with the kernel not returning the
72374         expected result.  This patch marks the test failure as an xfail.
72375
72376         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28623
72377
72378 2021-12-13  Andrew Burgess  <andrew.burgess@embecosm.com>
72379
72380         gdb: improve reuse of value contents when fetching array elements
72381         While working on a Python script, which was interacting with a remote
72382         target, I noticed some weird slowness in GDB.  In my program I had a
72383         structure something like this:
72384
72385           struct foo_t
72386           {
72387             int array[5];
72388           };
72389
72390           struct foo_t global_foo;
72391
72392         Then in the Python script I was fetching a complete copy of global
72393         foo, like:
72394
72395           val = gdb.parse_and_eval('global_foo')
72396           val.fetch_lazy()
72397
72398         Then I would work with items in foo_t.array, like:
72399
72400           print(val['array'][1])
72401
72402         I called the fetch_lazy method specifically because I knew I was going
72403         to end up accessing almost all of the contents of val, and so I wanted
72404         GDB to do a single remote protocol call to fetch all the contents in
72405         one go, rather than trying to do lazy fetches for a couple of bytes at
72406         a time.
72407
72408         What I observed was that, after the fetch_lazy call, GDB does,
72409         correctly, fetch the entire contents of global_foo, including all of
72410         the contents of array, however, when I access val.array[1], GDB still
72411         goes and fetches the value of this element from the remote target.
72412
72413         What's going on is that in valarith.c, in value_subscript, for C like
72414         languages, we always end up treating the array value as a pointer, and
72415         then doing value_ptradd, and value_ind, the second of these calls
72416         always returns a lazy value.
72417
72418         My guess is that this approach allows us to handle indexing off the
72419         end of an array, when working with zero element arrays, or when
72420         indexing a raw pointer as an array.  And, I agree, that in these
72421         cases, where, even when the original value is non-lazy, we still will
72422         not have the content of the array loaded, we should be using the
72423         value_ind approach.
72424
72425         However, for cases where we do have the array contents loaded, and we
72426         do know the bounds of the array, I think we should be using
72427         value_subscripted_rvalue, which is what we use for non C like
72428         languages.
72429
72430         One problem I did run into, exposed by gdb.base/charset.exp, was that
72431         value_subscripted_rvalue stripped typedefs from the element type of
72432         the array, which means the value returned will not have the same type
72433         as an element of the array, but would be the raw, non-typedefed,
72434         type.  In charset.exp we got back an 'int' instead of a
72435         'wchar_t' (which is a typedef of 'int'), and this impacts how we print
72436         the value.  Removing typedefs from the resulting value just seems
72437         wrong, so I got rid of that, and I don't see any test regressions.
72438
72439         With this change in place, my original Python script is now doing no
72440         additional memory accesses, and its performance increases about 10x!
72441
72442 2021-12-13  Andrew Burgess  <aburgess@redhat.com>
72443
72444         gdb: update gdb-gdb.py.in for latest changes to struct field
72445         This commit updates uses of 'loc' and 'loc_kind' to 'm_loc' and
72446         'm_loc_kind' respectively, in gdb-gdb.py.in, which is required after
72447         this commit:
72448
72449           commit cd3f655cc7a55437a05aa8e7b1fcc9051b5fe404
72450           Date:   Thu Sep 30 22:38:29 2021 -0400
72451
72452               gdb: add accessors for field (and call site) location
72453
72454         I have also incorporated this change:
72455
72456           https://sourceware.org/pipermail/gdb-patches/2021-September/182171.html
72457
72458         Which means we print 'm_name' instead of 'name' when displaying the
72459         'm_name' member variable.
72460
72461         Finally, I have also added support for the new TYPE_SPECIFIC_INT
72462         fields, which were added with this commit:
72463
72464           commit 20a5fcbd5b28cca88511ac5a9ad5e54251e8fa6d
72465           Date:   Wed Sep 23 09:39:24 2020 -0600
72466
72467               Handle bit offset and bit size in base types
72468
72469         I updated the gdb.gdb/python-helper.exp test to cover all of these
72470         changes.
72471
72472 2021-12-13  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
72473
72474         gdbserver/linux-low: replace direct assignment to current_thread
72475         Use scoped_restore_current_thread and switch_to_thread in
72476         linux_process_target::wait_for_sigstop.
72477
72478 2021-12-13  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
72479
72480         gdbserver: replace direct assignments to current_thread
72481         Replace the direct assignments to current_thread with
72482         switch_to_thread.  Use scoped_restore_current_thread when appropriate.
72483         There is one instance remaining in linux-low.cc's wait_for_sigstop.
72484         This will be handled in a separate patch.
72485
72486         Regression-tested on X86-64 Linux using the native-gdbserver and
72487         native-extended-gdbserver board files.
72488
72489 2021-12-13  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
72490
72491         gdbserver: introduce scoped_restore_current_thread and switch_to_thread
72492         Introduce a class for restoring the current thread and a function to
72493         switch to the given thread.  This is a preparation for a refactoring
72494         that aims to remove direct assignments to 'current_thread'.
72495
72496 2021-12-13  Andrew Burgess  <aburgess@redhat.com>
72497
72498         gdb: make post_startup_inferior a virtual method on inf_ptrace_target
72499         While working on a later patch that required me to understand how GDB
72500         starts up inferiors, I was confused by the
72501         target_ops::post_startup_inferior method.
72502
72503         The post_startup_inferior target function is only called from
72504         inf_ptrace_target::create_inferior.
72505
72506         Part of the target class hierarchy looks like this:
72507
72508           inf_child_target
72509              |
72510              '-- inf_ptrace_target
72511                     |
72512                     |-- linux_nat_target
72513                     |
72514                     |-- fbsd_nat_target
72515                     |
72516                     |-- nbsd_nat_target
72517                     |
72518                     |-- obsd_nat_target
72519                     |
72520                     '-- rs6000_nat_target
72521
72522         Every sub-class of inf_ptrace_target, except rs6000_nat_target,
72523         implements ::post_startup_inferior.  The rs6000_nat_target picks up
72524         the implementation of ::post_startup_inferior not from
72525         inf_ptrace_target, but from inf_child_target.
72526
72527         No descendent of inf_child_target, outside the inf_ptrace_target
72528         sub-tree, implements ::post_startup_inferior, which isn't really
72529         surprising, as they would never see the method called (remember, the
72530         method is only called from inf_ptrace_target::create_inferior).
72531
72532         What I find confusing is the role inf_child_target plays in
72533         implementing, what is really a helper function for just one of its
72534         descendents.
72535
72536         In this commit I propose that we formally make ::post_startup_inferior
72537         a helper function of inf_ptrace_target.  To do this I will remove the
72538         ::post_startup_inferior from the target_ops API, and instead make this
72539         a protected, pure virtual function on inf_ptrace_target.
72540
72541         I'll remove the empty implementation of ::post_startup_inferior from
72542         the inf_child_target class, and add a new empty implementation to the
72543         rs6000_nat_target class.
72544
72545         All the other descendents of inf_ptrace_target already provide an
72546         implementation of this method and so don't need to change beyond
72547         making the method protected within their class declarations.
72548
72549         To me, this makes much more sense now.  The helper function, which is
72550         only called from within the inf_ptrace_target class, is now a part of
72551         the inf_ptrace_target class.
72552
72553         The only way in which this change is visible to a user is if the user
72554         turns on 'set debug target 1'.  With this debug flag on, prior to this
72555         patch the user would see something like:
72556
72557           -> native->post_startup_inferior (...)
72558           <- native->post_startup_inferior (2588939)
72559
72560         After this patch these lines are no longer present, as the
72561         post_startup_inferior is no longer a top level target method.  For me,
72562         this is an acceptable change.
72563
72564 2021-12-13  Andrew Burgess  <aburgess@redhat.com>
72565
72566         gdb: have mips_nbsd_nat_target inherit from nbsd_nat_target
72567         While working on another patch I had reason to look at
72568         mips-netbsd-nat.c, and noticed that the class mips_nbsd_nat_target
72569         inherits directly from inf_ptrace_target.
72570
72571         This is a little strange as alpha_bsd_nat_target,
72572         arm_netbsd_nat_target, hppa_nbsd_nat_target, m68k_bsd_nat_target,
72573         ppc_nbsd_nat_target, sh_nbsd_nat_target, and vax_bsd_nat_target all
72574         inherit from nbsd_nat_target.
72575
72576         Originally, in this commit:
72577
72578           commit f6ac5f3d63e03a81c4ff3749aba234961cc9090e
72579           Date:   Thu May 3 00:37:22 2018 +0100
72580
72581               Convert struct target_ops to C++
72582
72583         When the target tree was converted to C++, all of the above classes
72584         inherited from inf_ptrace_target except for hppa_nbsd_nat_target,
72585         which was the only class that originally inherited from
72586         nbsd_nat_target.
72587
72588         Later on all the remaining targets (except mips) were converted to
72589         inherit from nbsd_nat_target, these are the commits:
72590
72591           commit 4fed520be264b60893aa674071947890f8172915
72592           Date:   Sat Mar 14 16:05:24 2020 +0100
72593
72594               Inherit alpha_netbsd_nat_target from nbsd_nat_target
72595
72596           commit 6018d381a00515933016c539d2fdc18ad0d304b8
72597           Date:   Sat Mar 14 14:50:51 2020 +0100
72598
72599               Inherit arm_netbsd_nat_target from nbsd_nat_target
72600
72601           commit 01a801176ea15ddfc988cade2e3d84c3b0abfec3
72602           Date:   Sat Mar 14 16:54:42 2020 +0100
72603
72604               Inherit m68k_bsd_nat_target from nbsd_nat_target
72605
72606           commit 9faa006d11a5e08264a007463435f84b77864c9c
72607           Date:   Thu Mar 19 14:52:57 2020 +0100
72608
72609               Inherit ppc_nbsd_nat_target from nbsd_nat_target
72610
72611           commit 9809762324491b851332ce600ae9bde8dd34f601
72612           Date:   Tue Mar 17 15:07:39 2020 +0100
72613
72614               Inherit sh_nbsd_nat_target from nbsd_nat_target
72615
72616           commit d5be5fa4207da00d039a1d5a040ba316e7092cbd
72617           Date:   Sat Mar 14 13:21:58 2020 +0100
72618
72619               Inherit vax_bsd_nat_target from nbsd_nat_target
72620
72621         I could only find mailing list threads for ppc and sh in the archive ,
72622         and unfortunately, none of the commits has any real detail that might
72623         explain why mips was missed out, the only extra context I could find
72624         was this message:
72625
72626           https://sourceware.org/pipermail/gdb-patches/2020-March/166853.html
72627
72628         Which says that "proper" OS support is going to be added to
72629         nbsd_nat_target, hence the need to inherit from that class.
72630
72631         My guess is that leaving mips_nbsd_nat_target unchanged was an
72632         oversight, so, in this commit, I propose changing mips_nbsd_nat_target
72633         to inherit from nbsd_nat_target just like all the other nbsd targets.
72634
72635         My motivation for this patch relates to the post_startup_inferior
72636         target method.  In a future commit I want to change how this method is
72637         handled.  Currently the mips_nbsd_nat_target will pick up the empty
72638         implementation of inf_child_target::post_startup_inferior rather than
72639         the version in netbsd-nat.c.  This feels like a bug to me, as surely,
72640         enabling of proc events is something that would need to be done for
72641         all netbsd targets, regardless of architecture.
72642
72643         In my future patch I have a choice then, either (a) add a new, empty
72644         implementation of post_startup_inferior to mips_nbsd_nat_target,
72645         or (b) this commit, have mips_nbsd_nat_target inherit from
72646         nbsd_nat_target.  Option (b) seems like the right way to go, hence,
72647         this commit.
72648
72649         I've done absolutely no testing for this change, not even building it,
72650         as that would require at least an environment in which I can x-build
72651         mips-netbsd applications, which I have no idea how to set up.
72652
72653 2021-12-13  Andrew Burgess  <aburgess@redhat.com>
72654
72655         gdb: only include mips and riscv targets if building with 64-bit bfd
72656         While testing another patch I was trying to build different
72657         configurations of GDB, and, during one test build I ran into a
72658         problem, I configured with `--enable-targets=all
72659         --host=i686-w64-mingw32` and saw this error while linking GDB:
72660
72661           .../i686-w64-mingw32/bin/ld: mips-tdep.o: in function `mips_gdbarch_init':
72662           .../src/gdb/mips-tdep.c:8730: undefined reference to `disassembler_options_mips'
72663           .../i686-w64-mingw32/bin/ld: riscv-tdep.o: in function `riscv_gdbarch_init':
72664           .../src/gdb/riscv-tdep.c:3851: undefined reference to `disassembler_options_riscv'
72665
72666         So the `disassembler_options_mips` and `disassembler_options_riscv`
72667         symbols are missing.
72668
72669         This turns out to be because mips-dis.c and riscv-dis.c, in which
72670         these symbols are defined, are in the TARGET64_LIBOPCODES_CFILES list
72671         in opcodes/Makefile.am, these files are only built when we are
72672         building with a 64-bit bfd.
72673
72674         If we look further, into bfd/Makefile.am, we can see that all the
72675         files matching elf*-riscv.lo are in the BFD64_BACKENDS list, as are
72676         the elf*-mips.lo files, and (I know because I tried), the two
72677         disassemblers do, not surprisingly, depend on features supplied from
72678         libbfd.
72679
72680         So, though we can build most of GDB just fine for riscv and mips with
72681         a 32-bit bfd, if I understand correctly, the final GDB
72682         executable (assuming we could get it to link) would not understand
72683         these architectures at the bfd level, nor would there be any
72684         disassembler available.  This sounds like a pretty useless GDB to me.
72685
72686         So, in this commit, I move the riscv and mips targets into GDB's list
72687         of targets that require a 64-bit bfd.  After this I can build GDB just
72688         fine with the configure options given above.
72689
72690         This was discussed on the mailing list in a couple of threads:
72691
72692           https://sourceware.org/pipermail/gdb-patches/2021-December/184365.html
72693           https://sourceware.org/pipermail/binutils/2021-November/118498.html
72694
72695         and it is agreed, that it is unfortunate that the 32-bit riscv and
72696         32-bit mips targets require a 64-bit bfd.  If in the future this
72697         situation ever changes then it would be expected that some (or all) of
72698         this patch would be reverted.  Until then though, this patch allows
72699         GDB to build when configured with --enable-targets=all, and when using
72700         a 32-bit libbfd.
72701
72702 2021-12-13  GDB Administrator  <gdbadmin@sourceware.org>
72703
72704         Automatic date update in version.in
72705
72706 2021-12-12  Tom Tromey  <tom@tromey.com>
72707
72708         C++-ify path substitution code
72709         I found some uses of xfree in the path substitution code in source.c.
72710         C++-ifying struct substitute_path_rule both simplifies the code and
72711         removes manual memory management.
72712
72713         Regression tested on x86-64 Fedora 34.
72714
72715 2021-12-12  GDB Administrator  <gdbadmin@sourceware.org>
72716
72717         Automatic date update in version.in
72718
72719 2021-12-11  Alan Modra  <amodra@gmail.com>
72720
72721         [GOLD] PowerPC64 @notoc in non-power10 code
72722         Gold version of commit 7aba54da42.
72723
72724         elfcpp/
72725                 * powerpc.h (R_PPC64_REL24_P9NOTOC): Define.
72726         gold/
72727                 * powerpc.cc (Target_powerpc::maybe_skip_tls_get_addr_call,
72728                 is_branch_reloc, max_branch_delta): Handle R_PPC64_REL24_P9NOTOC.
72729                 (Target_powerpc::Branch_info::make_stub): Likewise.
72730                 (struct Plt_stub_ent): Add p9notoc_, p9off_, tsize_.
72731                 (struct Branch_stub_ent): Add p9notoc_, p9off_.
72732                 (Stub_table::add_plt_call_entry): Handle R_PPC64_REL24_P9NOTOC.
72733                 (Stub_table::add_long_branch_entry): Likewise.
72734                 (Stub_table::add_eh_frame): Likewise.
72735                 (Stub_table::plt_call_size): Return aligned size.  Adjust callers.
72736                 Handle p9notoc_ sizing.
72737                 (Stub_table::do_write): Write out p9notoc_ stubs.
72738                 (Target_powerpc::Scan::get_reference_flags, local, global):
72739                 Handle R_PPC64_REL24_P9NOTOC.
72740                 (Target_powerpc::Relocate::relocate): Likewise.
72741
72742 2021-12-11  H.J. Lu  <hjl.tools@gmail.com>
72743
72744         Don't return the main file as the separate debug info
72745         On Fedora 35,
72746
72747         $ readelf -d /usr/bin/npc
72748
72749         caused readelf to run out of stack since load_separate_debug_info
72750         returned the input main file as the separate debug info:
72751
72752         (gdb) bt
72753          #0  load_separate_debug_info (
72754             main_filename=main_filename@entry=0x510f50 "/export/home/hjl/.cache/debuginfod_client/dcc33c51c49e7dafc178fdb5cf8bd8946f965295/debuginfo",
72755             xlink=xlink@entry=0x4e5180 <debug_displays+4480>,
72756             parse_func=parse_func@entry=0x431550 <parse_gnu_debuglink>,
72757             check_func=check_func@entry=0x432ae0 <check_gnu_debuglink>,
72758             func_data=func_data@entry=0x7fffffffdb60, file=file@entry=0x51d430)
72759             at /export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:11057
72760          #1  0x000000000043328d in check_for_and_load_links (file=0x51d430,
72761             filename=0x510f50 "/export/home/hjl/.cache/debuginfod_client/dcc33c51c49e7dafc178fdb5cf8bd8946f965295/debuginfo")
72762             at /export/gnu/import/git/sources/binutils-gdb/binutils/dwarf.c:11381
72763          #2  0x00000000004332ae in check_for_and_load_links (file=0x51b070,
72764             filename=0x518dd0 "/export/home/hjl/.cache/debuginfod_client/dcc33c51c49e7dafc178fdb5cf8bd8946f965295/debuginfo")
72765
72766         Return NULL if the separate debug info is the same as the input main
72767         file to avoid infinite recursion.
72768
72769                 PR binutils/28679
72770                 * dwarf.c (load_separate_debug_info): Don't return the input
72771                 main file.
72772
72773 2021-12-11  Alan Modra  <amodra@gmail.com>
72774
72775         Don't edit bogus sh_link on reading relocatable objects (Oracle fix)
72776         This reverts a 1995 fix to handle bogus object files.  Presumably such
72777         object files have long gone.
72778
72779                 * elf.c (bfd_section_from_shdr): Remove old hack for Oracle
72780                 libraries.
72781
72782 2021-12-11  GDB Administrator  <gdbadmin@sourceware.org>
72783
72784         Automatic date update in version.in
72785
72786 2021-12-10  Jan Vrany  <jan.vrany@labware.com>
72787
72788         gdb/testsuite: respect GDBSERVER variable in remote-stdio-gdbserver "board"
72789         The comment on top of gdb/testsuite/boards/remote-stdio-gdbserver.exp says
72790         that user can specify path to gdbserver on remote system by setting
72791         GDBSERVER variable. However, this variable was ignored and /usr/bin/gdbserver
72792         was used unconditionally.
72793
72794         This commit updates the code to respect GDBSERVER if set and fall back to
72795         /usr/bin/gdbserver if not.
72796
72797 2021-12-10  Simon Marchi  <simon.marchi@polymtl.ca>
72798
72799         Revert "gdbsupport: remove unnecessary `#ifndef IN_PROCESS_AGENT`"
72800         This reverts commit fe72c32765e1190c8a17d309fc3a7e1882d6a430.
72801
72802         It turns out it was wrong, libinproctrace.so does build its own
72803         gdbsupport/tdesc.cc.  This broke the build:
72804
72805             make[1]: Entering directory '/home/simark/build/binutils-gdb-one-target/gdbserver'
72806               CXXLD  libinproctrace.so
72807             /usr/bin/ld: gdbsupport/tdesc-ipa.o: in function `print_xml_feature::visit_pre(target_desc const*)':
72808             /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/tdesc.cc:407: undefined reference to `tdesc_architecture_name(target_desc const*)'
72809             /usr/bin/ld: /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/tdesc.cc:408: undefined reference to `tdesc_architecture_name(target_desc const*)'
72810             /usr/bin/ld: /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/tdesc.cc:411: undefined reference to `tdesc_osabi_name(target_desc const*)'
72811             /usr/bin/ld: /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/tdesc.cc:416: undefined reference to `tdesc_compatible_info_list(target_desc const*)'
72812             /usr/bin/ld: /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/tdesc.cc:418: undefined reference to `tdesc_compatible_info_arch_name(std::unique_ptr<tdesc_compatible_info, std::default_delete<tdesc_compatible_info> > const&)'
72813
72814 2021-12-10  GDB Administrator  <gdbadmin@sourceware.org>
72815
72816         Automatic date update in version.in
72817
72818 2021-12-09  Alan Modra  <amodra@gmail.com>
72819
72820         PR28674, objdump crash
72821         Not returning an error indication here leaves the attribute
72822         uninitialised, which then leads to intemperate behaviour.
72823
72824                 PR 28674
72825                 * dwarf2.c (read_attribute_value): Return NULL on trying to read
72826                 past end of attributes.
72827
72828 2021-12-09  Alan Modra  <amodra@gmail.com>
72829
72830         Set sh_link for reloc sections created as normal sections
72831         binutils-all/strip-13 and binutils-all/strip-14 tests create
72832         SHT_REL/SHT_RELA sections by hand.  These don't have sh_link set to
72833         the .symtab section as they should, leading to readelf warnings if you
72834         happen to be looking at the object files.
72835
72836                 * elf.c (assign_section_numbers): Formatting.  Set sh_link for
72837                 reloc sections created as normal sections in relocatable
72838                 objects.
72839
72840 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
72841
72842         gdbsupport: remove unnecessary `#ifndef IN_PROCESS_AGENT`
72843         I suppose this code was copied from GDBserver and this ifndef was left
72844         there.  As far as I know, IN_PROCESS_AGENT will never be defined when
72845         building this file, so we can remove this.
72846
72847         Change-Id: I84fc408e330b3a29106df830a09342861cadbaf6
72848
72849 2021-12-09  Simon Marchi  <simon.marchi@polymtl.ca>
72850
72851         gdb/microblaze-tdep.c: fix -Wunused-but-set-variable
72852         Fix this, seen when building with clang 14:
72853
72854               CXX    microblaze-tdep.o
72855             /home/simark/src/binutils-gdb/gdb/microblaze-tdep.c:207:7: error: variable 'flags' set but not used [-Werror,-Wunused-but-set-variable]
72856               int flags = 0;
72857                   ^
72858
72859         Change-Id: I59f726ed33e924912748bc475b6fd9a9394fc0d0
72860
72861 2021-12-09  Simon Marchi  <simon.marchi@polymtl.ca>
72862
72863         gdb/csky-tdep.c: fix -Wunused-but-set-variable error
72864         Fix these, seen when building with clang 14:
72865
72866               CXX    csky-tdep.o
72867             /home/simark/src/binutils-gdb/gdb/csky-tdep.c:332:7: error: variable 'need_dummy_stack' set but not used [-Werror,-Wunused-but-set-variable]
72868               int need_dummy_stack = 0;
72869                   ^
72870             /home/simark/src/binutils-gdb/gdb/csky-tdep.c:805:12: error: variable 'offset' set but not used [-Werror,-Wunused-but-set-variable]
72871                           int offset = 0;
72872                               ^
72873
72874         Change-Id: I6703bcb50e83c50083f716f4084ef6aa30d659c4
72875
72876 2021-12-09  Simon Marchi  <simon.marchi@polymtl.ca>
72877
72878         gdb/testsuite: fix default behavior of runto
72879         The documented behavior of proc runto is to not emit a PASS when
72880         succeeding to to run to the specified location, but emit a FAIL when
72881         failing to do so.  I suppose the intent is that it won't pollute the
72882         results normally passing tests (although I don't see why we would care),
72883         but make visible any problems.
72884
72885         However, it seems like the implementation makes it default to never
72886         print anything.  "no-message" is prependend to "args", so if "message"
72887         is not passed, we will always take the   path that sets print_fail to 0,
72888         which will silence any failure.
72889
72890         This unfortunately means that tests relying on runto_main won't emit a
72891         FAIL if failing to run to main.  And since commit 4dfef5be6812
72892         ("gdb/testsuite: make runto_main not pass no-message to runto"), tests
72893         don't emit a FAIL themselves when failing to run to main.  This means
72894         that tests failing to run to main just fail silently, and that's bad.
72895
72896         This can be reproduced by hacking gdb.base/template.exp like so:
72897
72898             diff --git a/gdb/testsuite/gdb.base/template.c b/gdb/testsuite/gdb.base/template.c
72899             index bcf39c377d92..052be5b79d73 100644
72900             --- a/gdb/testsuite/gdb.base/template.c
72901             +++ b/gdb/testsuite/gdb.base/template.c
72902             @@ -15,6 +15,14 @@
72903                 You should have received a copy of the GNU General Public License
72904                 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
72905
72906             +#include <stdlib.h>
72907             +
72908             +__attribute__((constructor))
72909             +static void c (void)
72910             +{
72911             +  exit (1);
72912             +}
72913             +
72914              int
72915              main (void)
72916              {
72917
72918         Running the modified gdb.base/template.exp shows that it exits without
72919         printing any result.
72920
72921         Remove the line that prepends no-message to args, that should make
72922         runto's behavior match its documentation.
72923
72924         This patch will appear to add many failures, but in reality they already
72925         existed, they were just silenced.
72926
72927         Change-Id: I2a730d5bc72b6ef0698cd6aad962d9902aa7c3d6
72928
72929 2021-12-09  Carl Love  <cel@us.ibm.com>
72930
72931         gdb fix elfv1 Powerpc gdb.dwarf2/frame-inlined-in-outer-frame.exp
72932         On ELFv1, the _start symbol must point to the *function descriptor* (in
72933         the .opd section), not to the function code (in the .text section) like
72934         with ELFv2 and other architectures.
72935
72936 2021-12-09  Tom de Vries  <tdevries@suse.de>
72937
72938         [gdb/testsuite] Fix gdb.base/maint.exp with -readnow
72939         With test-case gdb.base/maint.exp and target board -readnow, I run into:
72940         ...
72941         FAIL: gdb.base/maint.exp: maint info line-table w/o a file name
72942         ...
72943
72944         The problem is that this and other regexps anchored using '^':
72945         ...
72946             -re "^$gdb_prompt $" {
72947         ...
72948         don't trigger because other regexps don't consume the entire preceding line.
72949
72950         This is partly due to the addition of the IS-STMT column.
72951
72952         Fix this by making the regexps consume entire lines.
72953
72954         Tested on x86_64-linux with native and target board readnow, as well as
72955         check-read1 and check-readmore.
72956
72957 2021-12-09  Tom de Vries  <tdevries@suse.de>
72958
72959         [gdb/testsuite] Fix gdb.base/include-main.exp with -readnow
72960         With test-case gdb.base/include-main.exp and target board readnow, I run into:
72961         ...
72962         FAIL: gdb.base/include-main.exp: maint info symtab
72963         ...
72964
72965         The corresponding check in gdb.base/include-main.exp:
72966         ...
72967         gdb_test_no_output "maint info symtab"
72968         ...
72969         checks that no CU was expanded, while -readnow ensures that all CUs are
72970         expanded.
72971
72972         Fix this by skipping the check with -readnow.
72973
72974         Tested on x86_64-linux, with native and target board readnow.
72975
72976 2021-12-09  Nelson Chu  <nelson.chu@sifive.com>
72977
72978         RISC-V: Clarify the behavior of .option arch directive.
72979         * To be consistent with -march option, removed the "=" operator when
72980         user want to reset the whole architecture string.  So the formats are,
72981
72982         .option arch, +<extension><version>, ...
72983         .option arch, -<extension>
72984         .option arch, <ISA string>
72985
72986         * Don't allow to add or remove the base extensions in the .option arch
72987         directive.  Instead, users should reset the whole architecture string
72988         while they want to change the base extension.
72989
72990         * The operator "+" won't update the version of extension, if the
72991         extension is already in the subset list.
72992
72993         bfd/
72994                 * elfxx-riscv.c (riscv_add_subset): Don't update the version
72995                 if the extension is already in the subset list.
72996                 (riscv_update_subset): To be consistent with -march option,
72997                 removed the "=" operator when user want to reset the whole
72998                 architecture string.  Besides, Don't allow to add or remove
72999                 the base extensions in the .option arch directive.
73000         gas/
73001                 * testsuite/gas/riscv/option-arch-01.s: Updated since we cannot
73002                 add or remove the base extensions in the .option arch directive.
73003                 * testsuite/gas/riscv/option-arch-02.s: Likewise.
73004                 * testsuite/gas/riscv/option-arch-fail.l: Likewise.
73005                 * testsuite/gas/riscv/option-arch-fail.s: Likewise.
73006                 * testsuite/gas/riscv/option-arch-01a.d: Set -misa-spec=2.2.
73007                 * testsuite/gas/riscv/option-arch-01b.d: Likewise.
73008                 * testsuite/gas/riscv/option-arch-02.d: Updated since the .option
73009                 arch, + won't change the version of extension, if the extension is
73010                 already in the subset list.
73011                 * testsuite/gas/riscv/option-arch-03.s: Removed the "=" operator
73012                 when resetting the whole architecture string.
73013
73014 2021-12-09  Mike Frysinger  <vapier@gentoo.org>
73015
73016         sim: use ## for automake comments
73017         The ## marker tells automake to not include the comment in its
73018         generated output, so use that in most places where the comment
73019         only makes sense in the inputs.
73020
73021 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
73022
73023         gdb, gdbserver: detach fork child when detaching from fork parent
73024         While working with pending fork events, I wondered what would happen if
73025         the user detached an inferior while a thread of that inferior had a
73026         pending fork event.  What happens with the fork child, which is
73027         ptrace-attached by the GDB process (or by GDBserver), but not known to
73028         the core?  Sure enough, neither the core of GDB or the target detach the
73029         child process, so GDB (or GDBserver) just stays ptrace-attached to the
73030         process.  The result is that the fork child process is stuck, while you
73031         would expect it to be detached and run.
73032
73033         Make GDBserver detach of fork children it knows about.  That is done in
73034         the generic handle_detach function.  Since a process_info already exists
73035         for the child, we can simply call detach_inferior on it.
73036
73037         GDB-side, make the linux-nat and remote targets detach of fork children
73038         known because of pending fork events.  These pending fork events can be
73039         stored in:
73040
73041          - thread_info::pending_waitstatus, if the core has consumed the event
73042            but then saved it for later (for example, because it got the event
73043            while stopping all threads, to present an all-stop stop on top of a
73044            non-stop target)
73045          - thread_info::pending_follow: if we ran to a "catch fork" and we
73046            detach at that moment
73047
73048         Additionally, pending fork events can be in target-specific fields:
73049
73050          - For linux-nat, they can be in lwp_info::status and
73051            lwp_info::waitstatus.
73052          - For the remote target, they could be stored as pending stop replies,
73053            saved in `remote_state::notif_state::pending_event`, if not
73054            acknowledged yet, or in `remote_state::stop_reply_queue`, if
73055            acknowledged.  I followed the model of remove_new_fork_children for
73056            this: call remote_notif_get_pending_events to process /
73057            acknowledge any unacknowledged notification, then look through
73058            stop_reply_queue.
73059
73060         Update the gdb.threads/pending-fork-event.exp test (and rename it to
73061         gdb.threads/pending-fork-event-detach.exp) to try to detach the process
73062         while it is stopped with a pending fork event.  In order to verify that
73063         the fork child process is correctly detached and resumes execution
73064         outside of GDB's control, make that process create a file in the test
73065         output directory, and make the test wait $timeout seconds for that file
73066         to appear (it happens instantly if everything goes well).
73067
73068         This test catches a bug in linux-nat.c, also reported as PR 28512
73069         ("waitstatus.h:300: internal-error: gdb_signal target_waitstatus::sig()
73070         const: Assertion `m_kind == TARGET_WAITKIND_STOPPED || m_kind ==
73071         TARGET_WAITKIND_SIGNALLED' failed.).  When detaching a thread with a
73072         pending event, get_detach_signal unconditionally fetches the signal
73073         stored in the waitstatus (`tp->pending_waitstatus ().sig ()`).  However,
73074         that is only valid if the pending event is of type
73075         TARGET_WAITKIND_STOPPED, and this is now enforced using assertions (iit
73076         would also be valid for TARGET_WAITKIND_SIGNALLED, but that would mean
73077         the thread does not exist anymore, so we wouldn't be detaching it).  Add
73078         a condition in get_detach_signal to access the signal number only if the
73079         wait status is of kind TARGET_WAITKIND_STOPPED, and use GDB_SIGNAL_0
73080         instead (since the thread was not stopped with a signal to begin with).
73081
73082         Add another test, gdb.threads/pending-fork-event-ns.exp, specifically to
73083         verify that we consider events in pending stop replies in the remote
73084         target.  This test has many threads constantly forking, and we detach
73085         from the program while the program is executing.  That gives us some
73086         chance that we detach while a fork stop reply is stored in the remote
73087         target.  To verify that we correctly detach all fork children, we ask
73088         the parent to exit by sending it a SIGUSR1 signal and have it write a
73089         file to the filesystem before exiting.  Because the parent's main thread
73090         joins the forking threads, and the forking threads wait for their fork
73091         children to exit, if some fork child is not detach by GDB, the parent
73092         will not write the file, and the test will time out.  If I remove the
73093         new remote_detach_pid calls in remote.c, the test fails eventually if I
73094         run it in a loop.
73095
73096         There is a known limitation: we don't remove breakpoints from the
73097         children before detaching it.  So the children, could hit a trap
73098         instruction after being detached and crash.  I know this is wrong, and
73099         it should be fixed, but I would like to handle that later.  The current
73100         patch doesn't fix everything, but it's a step in the right direction.
73101
73102         Change-Id: I6d811a56f520e3cb92d5ea563ad38976f92e93dd
73103         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28512
73104
73105 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
73106
73107         gdb: move clearing of tp->pending_follow to follow_fork_inferior
73108         A following patch will change targets so that when they detach an
73109         inferior, they also detach any pending fork children this inferior may
73110         have.  While doing this, I hit a case where we couldn't differentiate
73111         two cases, where in one we should detach the fork detach but not in the
73112         other.
73113
73114         Suppose we continue past a fork with "follow-fork-mode == child" &&
73115         "detach-on-fork on".  follow_fork_inferior calls target_detach to detach
73116         the parent.  In that case the target should not detach the fork
73117         child, as we'll continue debugging the child.  As of now, the
73118         tp->pending_follow field of the thread who called fork still contains
73119         the details about the fork.
73120
73121         Then, suppose we run to a fork catchpoint and the user types "detach".
73122         In that case, the target should detach the fork child in addition to the
73123         parent.  In that case as well, the tp->pending_follow field contains
73124         the details about the fork.
73125
73126         To allow targets to differentiate the two cases, clear
73127         tp->pending_follow a bit earlier, when following a fork.  Targets will
73128         then see that tp->pending_follow contains TARGET_WAITKIND_SPURIOUS, and
73129         won't detach the fork child.
73130
73131         As of this patch, no behavior changes are expected.
73132
73133         Change-Id: I537741859ed712cb531baaefc78bb934e2a28153
73134
73135 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
73136
73137         gdb/remote.c: refactor pending fork status functions
73138         In preparation for a following patch, refactor a few things that I did
73139         find a bit awkward, and to make them a bit more reusable.
73140
73141          - Pass an inferior to kill_new_fork_children instead of a pid.  That
73142            allows iterating on only this inferior's threads and avoid further
73143            filtering on the thread's pid.
73144          - Change thread_pending_fork_status to return a non-nullptr value only
73145            if the thread does have a pending fork status.
73146          - Remove is_pending_fork_parent_thread, as one can just use
73147            thread_pending_fork_status and check for nullptr.
73148          - Replace is_pending_fork_parent with is_fork_status, which just
73149            returns if the given target_waitkind if a fork or a vfork.  Push
73150            filtering on the pid to the callers, when it is necessary.
73151
73152         Change-Id: I0764ccc684d40f054e39df6fa5458cc4c5d1cd7b
73153
73154 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
73155
73156         gdb/remote.c: move some things up
73157         Move the stop_reply and a few functions up.  Some code above them in the
73158         file will need to use them in a following patch.  No behavior changes
73159         expected here.
73160
73161         Change-Id: I3ca57d0e3ec253f56e1ba401289d9d167de14ad2
73162
73163 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
73164
73165         gdb/linux-nat: factor ptrace-detach code to new detach_one_pid function
73166         The following patch will add some code paths that need to ptrace-detach
73167         a given PID.  Factor out the code that does this and put it in its own
73168         function, so that it can be re-used.
73169
73170         Change-Id: Ie65ca0d89893b41aea0a23d9fc6ffbed042a9705
73171
73172 2021-12-09  Simon Marchi  <simon.marchi@efficios.com>
73173
73174         gdbserver: hide fork child threads from GDB
73175         This patch aims at fixing a bug where an inferior is unexpectedly
73176         created when a fork happens at the same time as another event, and that
73177         other event is reported to GDB first (and the fork event stays pending
73178         in GDBserver).  This happens for example when we step a thread and
73179         another thread forks at the same time.  The bug looks like (if I
73180         reproduce the included test by hand):
73181
73182             (gdb) show detach-on-fork
73183             Whether gdb will detach the child of a fork is on.
73184             (gdb) show follow-fork-mode
73185             Debugger response to a program call of fork or vfork is "parent".
73186             (gdb) si
73187             [New inferior 2]
73188             Reading /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/step-while-fork-in-other-thread/step-while-fork-in-other-thread from remote target...
73189             Reading /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/step-while-fork-in-other-thread/step-while-fork-in-other-thread from remote target...
73190             Reading symbols from target:/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/step-while-fork-in-other-thread/step-while-fork-in-other-thread...
73191             [New Thread 965190.965190]
73192             [Switching to Thread 965190.965190]
73193             Remote 'g' packet reply is too long (expected 560 bytes, got 816 bytes): ... <long series of bytes>
73194
73195         The sequence of events leading to the problem is:
73196
73197          - We are using the all-stop user-visible mode as well as the
73198            synchronous / all-stop variant of the remote protocol
73199          - We have two threads, thread A that we single-step and thread B that
73200            calls fork at the same time
73201          - GDBserver's linux_process_target::wait pulls the "single step
73202            complete SIGTRAP" and the "fork" events from the kernel.  It
73203            arbitrarily choses one event to report, it happens to be the
73204            single-step SIGTRAP.  The fork stays pending in the thread_info.
73205          - GDBserver send that SIGTRAP as a stop reply to GDB
73206          - While in stop_all_threads, GDB calls update_thread_list, which ends
73207            up querying the remote thread list using qXfer:threads:read.
73208          - In the reply, GDBserver includes the fork child created as a result
73209            of thread B's fork.
73210          - GDB-side, the remote target sees the new PID, calls
73211            remote_notice_new_inferior, which ends up unexpectedly creating a new
73212            inferior, and things go downhill from there.
73213
73214         The problem here is that as long as GDB did not process the fork event,
73215         it should pretend the fork child does not exist.  Ultimately, this event
73216         will be reported, we'll go through follow_fork, and that process will be
73217         detached.
73218
73219         The remote target (GDB-side), has some code to remove from the reported
73220         thread list the threads that are the result of forks not processed by
73221         GDB yet.  But that only works for fork events that have made their way
73222         to the remote target (GDB-side), but haven't been consumed by the core
73223         yet, so are still lingering as pending stop replies in the remote target
73224         (see remove_new_fork_children in remote.c).  But in our case, the fork
73225         event hasn't made its way to the GDB-side remote target.  We need to
73226         implement the same kind of logic GDBserver-side: if there exists a
73227         thread / inferior that is the result of a fork event GDBserver hasn't
73228         reported yet, it should exclude that thread / inferior from the reported
73229         thread list.
73230
73231         This was actually discussed a while ago, but not implemented AFAIK:
73232
73233             https://pi.simark.ca/gdb-patches/1ad9f5a8-d00e-9a26-b0c9-3f4066af5142@redhat.com/#t
73234             https://sourceware.org/pipermail/gdb-patches/2016-June/133906.html
73235
73236         Implementation details-wise, the fix for this is all in GDBserver.  The
73237         Linux layer of GDBserver already tracks unreported fork parent / child
73238         relationships using the lwp_info::fork_relative, in order to avoid
73239         wildcard actions resuming fork childs unknown to GDB.  This information
73240         needs to be made available to the handle_qxfer_threads_worker function,
73241         so it can filter the reported threads.  Add a new thread_pending_parent
73242         target function that allows the Linux target to return the parent of an
73243         eventual fork child.
73244
73245         Testing-wise, the test replicates pretty-much the sequence of events
73246         shown above.  The setup of the test makes it such that the main thread
73247         is about to fork.  We stepi the other thread, so that the step completes
73248         very quickly, in a single event.  Meanwhile, the main thread is resumed,
73249         so very likely has time to call fork.  This means that the bug may not
73250         reproduce every time (if the main thread does not have time to call
73251         fork), but it will reproduce more often than not.  The test fails
73252         without the fix applied on the native-gdbserver and
73253         native-extended-gdbserver boards.
73254
73255         At some point I suspected that which thread called fork and which thread
73256         did the step influenced the order in which the events were reported, and
73257         therefore the reproducibility of the bug.  So I made the test try  both
73258         combinations: main thread forks while other thread steps, and vice
73259         versa.  I'm not sure this is still necessary, but I left it there
73260         anyway.  It doesn't hurt to test a few more combinations.
73261
73262         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28288
73263         Change-Id: I2158d5732fc7d7ca06b0eb01f88cf27bf527b990
73264
73265 2021-12-09  GDB Administrator  <gdbadmin@sourceware.org>
73266
73267         Automatic date update in version.in
73268
73269 2021-12-08  Tom Tromey  <tom@tromey.com>
73270
73271         Use for-each more in gdb
73272         There are some loops in gdb that use ARRAY_SIZE (or a wordier
73273         equivalent) to loop over a static array.  This patch changes some of
73274         these to use foreach instead.
73275
73276         Regression tested on x86-64 Fedora 34.
73277
73278 2021-12-08  Tom Tromey  <tromey@adacore.com>
73279
73280         Fix error in file_and_directory patch
73281         In my earlier C++-ization patch for file_and_directory, I introduced
73282         an error:
73283
73284         -  if (strcmp (fnd.name, "<unknown>") != 0)
73285         +  if (fnd.is_unknown ())
73286
73287         This change inverted the sense of the test, which causes failures with
73288         .debug_names.
73289
73290         This patch fixes the bug.  Regression tested on x86-64 Fedora 34.  I
73291         also tested it using the AdaCore internal test suite, with
73292         .debug_names -- this was failing before, and now it works.
73293
73294 2021-12-08  Andrew Burgess  <aburgess@redhat.com>
73295
73296         gdb/python: Use tp_init instead of tp_new to setup gdb.Value
73297         The documentation suggests that we implement gdb.Value.__init__,
73298         however, this is not currently true, we really implement
73299         gdb.Value.__new__.  This will cause confusion if a user tries to
73300         sub-class gdb.Value.  They might write:
73301
73302           class MyVal (gdb.Value):
73303               def __init__ (self, val):
73304                   gdb.Value.__init__(self, val)
73305
73306           obj = MyVal(123)
73307           print ("Got: %s" % obj)
73308
73309         But, when they source this code they'll see:
73310
73311           (gdb) source ~/tmp/value-test.py
73312           Traceback (most recent call last):
73313             File "/home/andrew/tmp/value-test.py", line 7, in <module>
73314               obj = MyVal(123)
73315             File "/home/andrew/tmp/value-test.py", line 5, in __init__
73316               gdb.Value.__init__(self, val)
73317           TypeError: object.__init__() takes exactly one argument (the instance to initialize)
73318           (gdb)
73319
73320         The reason for this is that, as we don't implement __init__ for
73321         gdb.Value, Python ends up calling object.__init__ instead, which
73322         doesn't expect any arguments.
73323
73324         The Python docs suggest that the reason why we might take this
73325         approach is because we want gdb.Value to be immutable:
73326
73327            https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_new
73328
73329         But I don't see any reason why we should require gdb.Value to be
73330         immutable when other types defined in GDB are not.  This current
73331         immutability can be seen in this code:
73332
73333           obj = gdb.Value(1234)
73334           print("Got: %s" % obj)
73335           obj.__init__ (5678)
73336           print("Got: %s" % obj)
73337
73338         Which currently runs without error, but prints:
73339
73340           Got: 1234
73341           Got: 1234
73342
73343         In this commit I propose that we switch to using __init__ to
73344         initialize gdb.Value objects.
73345
73346         This does introduce some additional complexity, during the __init__
73347         call a gdb.Value might already be associated with a gdb value object,
73348         in which case we need to cleanly break that association before
73349         installing the new gdb value object.  However, the cost of doing this
73350         is not great, and the benefit - being able to easily sub-class
73351         gdb.Value seems worth it.
73352
73353         After this commit the first example above works without error, while
73354         the second example now prints:
73355
73356           Got: 1234
73357           Got: 5678
73358
73359         In order to make it easier to override the gdb.Value.__init__ method,
73360         I have tweaked the definition of gdb.Value.__init__.  The second,
73361         optional argument to __init__ is a gdb.Type, if this argument is not
73362         present then GDB figures out a suitable type.
73363
73364         However, if we want to override the __init__ method in a sub-class,
73365         and still support the default argument, it is easier to write:
73366
73367           class MyVal (gdb.Value):
73368               def __init__ (self, val, type=None):
73369                   gdb.Value.__init__(self, val, type)
73370
73371         Currently, passing None for the Type will result in an error:
73372
73373           TypeError: type argument must be a gdb.Type.
73374
73375         After this commit I now allow the type argument to be None, in which
73376         case GDB figures out a suitable type just as if the type had not been
73377         passed at all.
73378
73379         Unless a user is trying to reinitialize a value, or create sub-classes
73380         of gdb.Value, there should be no user visible changes after this
73381         commit.
73382
73383 2021-12-08  Andrew Burgess  <aburgess@redhat.com>
73384
73385         gdb: use try/catch around a gdb_disassembler::print_insn call
73386         While investigating some disassembler problems I ran into this case;
73387         GDB compiled on a 32-bit arm target, with --enable-targets=all.  Then
73388         in GDB:
73389
73390           (gdb) set architecture i386
73391           (gdb) disassemble 0x0,+4
73392           unknown disassembler error (error = -1)
73393
73394         This is interesting because it shows a case where the libopcodes
73395         disassembler is returning -1 without first calling the
73396         memory_error_func callback.  Indeed, the return from libopcodes
73397         happens from this code snippet in i386-dis.c in the print_insn
73398         function:
73399
73400           if (address_mode == mode_64bit && sizeof (bfd_vma) < 8)
73401             {
73402               (*info->fprintf_func) (info->stream,
73403                                      _("64-bit address is disabled"));
73404               return -1;
73405             }
73406
73407         Notice how, prior to the return the disassembler tries to print a
73408         helpful message out, but GDB doesn't print this message.
73409
73410         The reason this message goes missing is the call stack, it looks like
73411         this:
73412
73413           gdb_pretty_print_disassembler::pretty_print_insn
73414             gdb_disassembler::print_insn
73415               gdbarch_print_insn
73416                 ...
73417                   i386-dis.c:print_insn
73418
73419         When i386-dis.c:print_insn returns -1 this is handled in
73420         gdb_disassembler::print_insn, where an exception is thrown.  However,
73421         the actual printing of the disassembler output is done in
73422         gdb_pretty_print_disassembler::pretty_print_insn, and is only done if
73423         an exception is not thrown.
73424
73425         In this commit I change this.  The pretty_print_insn now uses
73426         try/catch around the call to gdb_disassembler::print_insn, if we catch
73427         an error then we first print any pending output in the instruction
73428         buffer, before rethrowing the exception.  As a result, even if an
73429         exception is thrown we still print any pending disassembler output to
73430         the screen; in the above case the helpful message will now be shown.
73431
73432         Before my patch we might expect to see this output:
73433
73434           (gdb) disassemble 0x0,+4
73435           Dump of assembler code from 0x0 to 0x4:
73436              0x0000000000000000:        unknown disassembler error (error = -1)
73437           (gdb)
73438
73439         But now we see this:
73440
73441           (gdb) disassemble 0x0,+4
73442           Dump of assembler code from 0x0 to 0x4:
73443              0x0000000000000000:        64-bit address is disabled
73444           unknown disassembler error (error = -1)
73445
73446         If the disassembler returns -1 without printing a helpful message then
73447         we would still expect a change in output, something like:
73448
73449           (gdb) disassemble 0x0,+4
73450           Dump of assembler code from 0x0 to 0x4:
73451              0x0000000000000000:
73452           unknown disassembler error (error = -1)
73453
73454         Which I think is still acceptable, though at this point I think a
73455         strong case can be made that this is a disassembler bug (not printing
73456         anything, but still returning -1).
73457
73458         Notice however, that the error message is always printed on a new line
73459         now.  This is also true for the memory error case, where before we
73460         might see this:
73461
73462           (gdb) disassemble 0x0,+4
73463           Dump of assembler code from 0x0 to 0x4:
73464              0x00000000:        Cannot access memory at address 0x0
73465
73466         We now get this:
73467
73468           (gdb) disassemble 0x0,+4
73469           Dump of assembler code from 0x0 to 0x4:
73470              0x00000000:
73471           Cannot access memory at address 0x0
73472
73473         For me, I'm happy to accept this change, having the error on a line by
73474         itself, rather than just appended to the end of the previous line,
73475         seems like an improvement, but I'm aware others might feel
73476         differently, so I'd appreciate any feedback.
73477
73478 2021-12-08  Jan Vrany  <jan.vrany@labware.com>
73479
73480         ppc: recognize all program traps
73481         Permanent program breakpoints (ones inserted into the code) other than
73482         the one GDB uses for POWER (0x7fe00008) did not result in stop but
73483         caused GDB to loop infinitely.
73484
73485         This was because GDB did not recognize trap instructions other than
73486         "trap". For example, "tw 12, 4, 4" was not be recognized, causing GDB
73487         to loop forever.
73488
73489         This commit fixes this by providing POWER specific hook
73490         (gdbarch_program_breakpoint_here_p) recognizing all tw, twi, td and tdi
73491         instructions.
73492
73493         Tested on Linux on PowerPC e500 and on QEMU PPC64le.
73494
73495 2021-12-08  Jan Vrany  <jan.vrany@labware.com>
73496
73497         ppc: use "trap" ("tw, 31, 0, 0") as breakpoint instruction
73498         Power ISA 3.0 B spec [1], sections 3.3.11 "Fixed-Point Trap Instructions"
73499         and section C.6 "Trap Mnemonics" specify "tw, 31, 0, 0" (encoded as
73500         0x7fe00008) as canonical unconditional trap instruction.
73501
73502         This commit changes the breakpoint instruction used by GDB from
73503         "tw 12, r2, r2" to unconditional "trap".
73504
73505         [1]: https://openpowerfoundation.org/?resource_lib=power-isa-version-3-0
73506
73507 2021-12-08  Fangrui Song  <maskray@google.com>
73508
73509         bfd_section_from_shdr: Support SHT_RELR sections
73510         If a.so contains an SHT_RELR section, objcopy a.so will fail with:
73511
73512             a.so: unknown type [0x13] section `.relr.dyn'
73513
73514         This change allows objcopy to work.
73515
73516         bfd/
73517             * elf.c (bfd_section_from_shdr): Support SHT_RELR.
73518
73519 2021-12-08  Alan Modra  <amodra@gmail.com>
73520
73521         PR28673, input file 'gcov' is the same as output file
73522                 PR 28673
73523                 * ldlang.c (open_output): Use local_sym_name when checking
73524                 output against input files rather than filename.
73525
73526 2021-12-08  Tom Tromey  <tom@tromey.com>
73527
73528         Fix bug in source.c change
73529         My earlier change to source.c ("Remove an xfree from add_path")
73530         introduced a regression.  This patch fixes the problem.
73531
73532 2021-12-08  Simon Marchi  <simon.marchi@polymtl.ca>
73533
73534         gdb: make struct linespect contain vectors, not pointers to vectors
73535         struct linespec contains pointers to vectors, instead of containing
73536         vectors directly.  This is probably historical, when linespec_parser
73537         (which contains a struct linespec field) was not C++-ified yet.  But it
73538         seems easy to change the pointers to vectors to just vectors today.
73539         This simplifies the code, we don't need to manually allocate and delete
73540         the vectors and there's no pointer that can be NULL.
73541
73542         As far as I understand, there was not meaningful distinction between a
73543         NULL pointer to vector and an empty vector.  So all NULL checks are
73544         changed for !empty checks.
73545
73546         Change-Id: Ie759707da14d9d984169b93233343a86e2de9ee6
73547
73548 2021-12-08  GDB Administrator  <gdbadmin@sourceware.org>
73549
73550         Automatic date update in version.in
73551
73552 2021-12-07  Tom Tromey  <tom@tromey.com>
73553
73554         Remove an xfree from add_path
73555         This removes a temporary \0 assignment and an xfree from add_path,
73556         replacing it with a simpler use of std::string.
73557
73558 2021-12-07  Simon Marchi  <simon.marchi@polymtl.ca>
73559
73560         gdb/linespec.c: simplify condition
73561         We can remove the empty check: if the vector has size 1, it is obviously
73562         not empty.  This code ended up like this because the empty check used to
73563         be a NULL check.
73564
73565         Change-Id: I1571bd0228818ca93f6a6b444e9b010dc2da4c08
73566
73567 2021-12-07  Simon Marchi  <simon.marchi@polymtl.ca>
73568
73569         gdb: rename "maint agent" functions
73570         Functions agent_eval_command and agent_command are used to implement
73571         maintenance commands, rename them accordingly (with the maint_ prefix),
73572         as well as the agent_command_1 helper function.
73573
73574         Change-Id: Iacf96d4a0a26298e8dd4648a0f38da649ea5ef61
73575
73576 2021-12-07  Simon Marchi  <simon.marchi@polymtl.ca>
73577
73578         gdb: make set_raw_breakpoint static
73579         set_raw_breakpoint is only used in breakpoint.c, make it static.
73580
73581         Change-Id: I7fbeda067685309a30b88aceaf957eff7a28e310
73582
73583 2021-12-07  John Baldwin  <jhb@FreeBSD.org>
73584
73585         Support AT_FXRNG and AT_KPRELOAD on FreeBSD.
73586         FreeBSD's kernel has recently added two new ELF auxiliary vector
73587         entries.  AT_FXRNG points to a root seed version for the kernel's
73588         PRNG.  Userland can use this to reseed a userland PRNG after the
73589         kernel's PRNG has reseeded.  AT_KPRELOAD is the base address of a
73590         kernel-provided vDSO.
73591
73592         This change displays the proper name and description of these entries
73593         in 'info auxv'.
73594
73595         include/ChangeLog:
73596
73597                 * elf/common.h (AT_FREEBSD_FXRNG, AT_FREEBSD_KPRELOAD): Define.
73598
73599 2021-12-07  Tom Tromey  <tromey@adacore.com>
73600
73601         Avoid extra work in global_symbol_searcher::expand_symtabs
73602         I noticed that global_symbol_searcher::expand_symtabs always passes a
73603         file matcher to expand_symtabs_matching.  However, if 'filenames' is
73604         empty, then this always returns true.  It's slightly more efficient to
73605         pass a null file matcher in this case, because that lets the "quick"
73606         symbol implementations skip any filename checks.
73607
73608         Regression tested on x86-64 Fedora 34.
73609
73610 2021-12-07  Tom de Vries  <tdevries@suse.de>
73611
73612         [gdb/testsuite] Fix options arg handling in compile_jit_elf_main_as_so
73613         In commit 80ad340c902 ("[gdb/testsuite] use -Ttext-segment for jit-elf tests")
73614         the following change was made:
73615         ...
73616          proc compile_jit_elf_main_as_so {main_solib_srcfile main_solib_binfile options} {
73617         -    set options [concat $options debug]
73618         +    global jit_load_address jit_load_increment
73619         +
73620         +    set options [list \
73621         +       additional_flags="-DMAIN=jit_dl_main" \
73622         +       additional_flags=-DLOAD_ADDRESS=$jit_load_address \
73623         +       additional_flags=-DLOAD_INCREMENT=$jit_load_increment \
73624         +       debug]
73625         ...
73626
73627         Before the change, the options argument was used, but after the change not
73628         anymore.
73629
73630         Fix this by reverting back to using "set options [concat $options ...]".
73631
73632         Fixing this gets us twice the -DMAIN=jit_dl_main bit, once from a caller, and
73633         once from compile_jit_elf_main_as_so.  Fix this by removing the bit from
73634         compile_jit_elf_main_as_so, which makes the code similar to compile_jit_main.
73635
73636         Tested on x86_64-linux.
73637
73638 2021-12-07  Tom de Vries  <tdevries@suse.de>
73639
73640         [gdb/testsuite] Fix FAIL in gdb.tui/basic.exp
73641         On openSUSE Leap 15.2 aarch64 I ran into:
73642         ...
73643         FAIL: gdb.tui/basic.exp: check main is where we expect on the screen
73644         ...
73645         while this is passing on x86_64.
73646
73647         On x86_64-linux we have at the initial screen dump for "list -q main":
73648         ...
73649          0 +-/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.tui/tui-layout.c--+
73650          1 |       15     You should have received a copy of the GNU General Public |
73651          2 |       16     along with this program.  If not, see <http://www.gnu.org/|
73652          3 |       17                                                               |
73653          4 |       18  int                                                          |
73654          5 |       19  main ()                                                      |
73655          6 |       20  {                                                            |
73656          7 |       21    return 0;                                                  |
73657          8 |       22  }                                                            |
73658          9 |       23                                                               |
73659         ...
73660         but on aarch64:
73661         ...
73662          0 +-/home/tdevries/gdb/src/gdb/testsuite/gdb.tui/tui-layout.c--------------+
73663          1 |       16     along with this program.  If not, see <http://www.gnu.org/|
73664          2 |       17                                                               |
73665          3 |       18  int                                                          |
73666          4 |       19  main ()                                                      |
73667          5 |       20  {                                                            |
73668          6 |       21    return 0;                                                  |
73669          7 |       22  }                                                            |
73670          8 |       23                                                               |
73671          9 |       24                                                               |
73672         ...
73673
73674         The cause of the diffferent placement is that we have as line number for main
73675         on x86_64:
73676         ...
73677         $ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main"
73678         Line 20 of "tui-layout.c" starts at address 0x4004a7 <main> \
73679           and ends at 0x4004ab <main+4>.
73680         ...
73681         and on aarch64 instead:
73682         ...
73683         $ gdb -q -batch outputs/gdb.tui/basic/basic -ex "info line main"
73684         Line 21 of "tui-layout.c" starts at address 0x4005f4 <main> \
73685           and ends at 0x4005f8 <main+4>.
73686         ...
73687
73688         Fix this by using a new source file main-one-line.c, that implements the
73689         entire main function on a single line, in order to force the compiler to use
73690         that line number.
73691
73692         Also try to do less hard-coding in the test-case.
73693
73694         Tested on x86_64-linux and aarch64-linux.
73695
73696 2021-12-07  Tom de Vries  <tdevries@suse.de>
73697
73698         [gdb/tdep] Fix inferior plt calls in PIE for i386
73699         Consider test-case test.c:
73700         ...
73701         int main (void) {
73702           void *p = malloc (10);
73703           return 0;
73704         }
73705         ...
73706
73707         When compiled to a non-PIE exec:
73708         ...
73709         $ gcc -m32 test.c
73710         ...
73711         the call sequence looks like:
73712         ...
73713          8048447:       83 ec 0c                sub    $0xc,%esp
73714          804844a:       6a 0a                   push   $0xa
73715          804844c:       e8 bf fe ff ff          call   8048310 <malloc@plt>
73716         ...
73717         which calls to:
73718         ...
73719         08048310 <malloc@plt>:
73720          8048310:       ff 25 0c a0 04 08       jmp    *0x804a00c
73721          8048316:       68 00 00 00 00          push   $0x0
73722          804831b:       e9 e0 ff ff ff          jmp    8048300 <.plt>
73723         ...
73724         where the first insn at 0x8048310 initially jumps to the following address
73725         0x8048316, read from the .got.plt @ 0x804a00c:
73726         ...
73727          804a000 0c9f0408 00000000 00000000 16830408  ................
73728          804a010 26830408                             &...
73729         ...
73730
73731         Likewise, when compiled as a PIE:
73732         ...
73733         $ gcc -m32 -fPIE -pie test.c
73734         ...
73735         we have this call sequence (with %ebx setup to point to the .got.plt):
73736         ...
73737         0000055d <main>:
73738          579:   83 ec 0c                sub    $0xc,%esp
73739          57c:   6a 0a                   push   $0xa
73740          57e:   89 c3                   mov    %eax,%ebx
73741          580:   e8 6b fe ff ff          call   3f0 <malloc@plt>
73742         ...
73743         which calls to:
73744         ...
73745         000003f0 <malloc@plt>:
73746          3f0:   ff a3 0c 00 00 00       jmp    *0xc(%ebx)
73747          3f6:   68 00 00 00 00          push   $0x0
73748          3fb:   e9 e0 ff ff ff          jmp    3e0 <.plt>
73749         ...
73750         where the insn at 0x3f0 initially jumps to following address 0x3f6, read from
73751         the .got.plt at offset 0xc:
73752         ...
73753          2000 f41e0000 00000000 00000000 f6030000  ................
73754          2010 06040000                             ....
73755         ...
73756
73757         When instead doing an inferior call to malloc (with nosharedlib to force
73758         malloc to resolve to malloc@plt rather than the functions in ld.so or libc.so)
73759         with the non-PIE exec, we have the expected:
73760         ...
73761         $ gdb -q -batch a.out -ex start -ex nosharedlib -ex "p /x (void *)malloc (10)"
73762         Temporary breakpoint 1 at 0x8048444
73763
73764         Temporary breakpoint 1, 0x08048444 in main ()
73765         $1 = 0x804b160
73766         ...
73767
73768         But with the PIE exec, we run into:
73769         ...
73770         $ gdb -q -batch a.out -ex start -ex nosharedlib -ex "p /x (void *)malloc (10)"
73771         Temporary breakpoint 1 at 0x56c
73772
73773         Temporary breakpoint 1, 0x5655556c in main ()
73774
73775         Program received signal SIGSEGV, Segmentation fault.
73776         0x565553f0 in malloc@plt ()
73777         ...
73778
73779         The segfault happens because:
73780         - the inferior call mechanism doesn't setup %ebx
73781         - %ebx instead is 0
73782         - the jump to "*0xc(%ebx)" reads from memory at 0xc
73783
73784         Fix this by setting up %ebx properly in i386_thiscall_push_dummy_call.
73785
73786         Fixes this failure with target board unix/-m32/-pie/-fPIE reported in
73787         PR28467:
73788         ...
73789         FAIL: gdb.base/nodebug.exp: p/c (int) array_index("abcdef",2)
73790         ...
73791
73792         Tested on x86_64-linux, with target board unix/-m32 and unix/-m32/-fPIE/-pie.
73793
73794         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28467
73795
73796 2021-12-07  Tom de Vries  <tdevries@suse.de>
73797
73798         [gdb/symtab] Support -readnow during reread
73799         When running test-case gdb.base/cached-source-file.exp with target board
73800         readnow, we run into:
73801         ...
73802         FAIL: gdb.base/cached-source-file.exp: rerun program (the program exited)
73803         ...
73804
73805         The problem is that when rereading, the readnow is ignored.
73806
73807         Fix this by copying the readnow handling code from symbol_file_add_with_addrs
73808         to reread_symbols.
73809
73810         Tested on x86_64-linux.
73811
73812         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26800
73813
73814 2021-12-07  Tom de Vries  <tdevries@suse.de>
73815
73816         [gdb/ada] Fix assert in ada_is_unconstrained_packed_array_type
73817         On openSUSE Leap 42.3, with system compiler gcc 4.8.5 I run into:
73818         ...
73819         (gdb) print u_one_two_three^M
73820         src/gdb/gdbtypes.h:1050: internal-error: field: \
73821          Assertion `idx >= 0 && idx < num_fields ()' failed.^M
73822         ...
73823
73824         We run into trouble while doing this in
73825         ada_is_unconstrained_packed_array_type:
73826         ...
73827         1953          return TYPE_FIELD_BITSIZE (type, 0) > 0;
73828         ...
73829         which tries to get field 0 from a type without fields:
73830         ...
73831         (gdb) p type->num_fields ()
73832         $6 = 0
73833         ...
73834         which is the case because the type is a typedef:
73835         ...
73836         (gdb) p type->code ()
73837         $7 = TYPE_CODE_TYPEDEF
73838         ...
73839
73840         Fix this by using the type referenced by the typedef instead.
73841
73842         Tested on x86_64-linux.
73843
73844         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28323
73845
73846 2021-12-07  Alan Modra  <amodra@gmail.com>
73847
73848         Re: Add support for AArch64 EFI (efi-*-aarch64)
73849         Commit b69c9d41e8 was broken in multiple ways regarding the realloc
73850         of the target string, most notably in that "-little" wasn't actually
73851         appended to the input_target or output_target.  This caused asan
73852         errors and "FAIL: Check if efi app format is recognized".  I also
73853         noticed that the input_target string wasn't being copied but rather
73854         the output_target when dealing with the input target.  Fix that too.
73855
73856                 PR 26206
73857                 * objcopy.c (convert_efi_target): Rewrite.  Allocate modified
73858                 target strings here..
73859                 (copy_main): ..rather than here.  Do handle input_target,
73860                 not output_target for input.
73861
73862 2021-12-07  Alan Modra  <amodra@gmail.com>
73863
73864         Error on ld output file name matching input file name
73865         It's not foolproof, for example we don't catch output to a linker
73866         script, to a library specified with -l, or to an element of a thin
73867         archive.
73868
73869                 * ldlang.c (open_output): Exit with error on output file matching
73870                 an input file.
73871                 * testsuite/ld-misc/just-symbols.exp: Adjust ld -r test to suit.
73872
73873 2021-12-07  GDB Administrator  <gdbadmin@sourceware.org>
73874
73875         Automatic date update in version.in
73876
73877 2021-12-06  Carl Love  <cel@us.ibm.com>
73878
73879         gdb: Add PowerPC support to gdb.dwarf2/frame-inlined-in-outer-frame
73880         This patch adds an #elif defined for PowerPC to setup the exit_0 macro.
73881         This patch addes the needed macro definitionald logic to handle both elfV1
73882         and elfV2.
73883
73884         The patch has been successfully tested on both PowerPC BE, Powerpc LE and
73885         X86_64 with no regressions.
73886
73887 2021-12-06  Tom de Vries  <tdevries@suse.de>
73888
73889         [gdb/testsuite] Use precise align in gdb.arch/i386-{avx,sse}.exp
73890         Test-cases gdb.arch/i386-{avx,sse}.exp use assembly instructions that require
73891         the memory operands to be aligned to a certain boundary, and the test-cases
73892         use C11's _Alignas to make that happen.
73893
73894         The draw-back of using _Alignas is that while it does enforce a minimum
73895         alignment, the actual alignment may be bigger, which makes the following
73896         scenario possible:
73897         - copy say, gdb.arch/i386-avx.c as basis for a new test-case
73898         - run the test-case and observe a PASS
73899         - commit the new test-case in the supposition that the test-case is correct
73900           and well-tested
73901         - run later into a failure on a different test setup (which may be a setup
73902           where reproduction and investigation is more difficult and time-consuming),
73903           and find out that the specified alignment was incorrect and should have been
73904           updated to say, 64 bytes.  The initial PASS occurred only because the actual
73905           alignment happened to be greater than required.
73906
73907         The idea of having precise alignment as a means of having more predictable
73908         execution which allows flushing out bugs earlier, has been filed as PR
73909         gcc/103095.
73910
73911         Add a new file lib/precise-aligned-alloc.c with functions
73912         precise_aligned_alloc and precise_aligned_dup, to support precise alignment.
73913
73914         Use precise_aligned_dup in aforementioned test-cases to:
73915         - verify that the specified alignment is indeed sufficient, rather
73916           than too little but accidentally over-aligned.
73917         - prevent the same type of problems in any new test-cases based on these
73918
73919         Tested on x86_64-linux, with both gcc and clang.
73920
73921 2021-12-06  Tom de Vries  <tdevries@suse.de>
73922
73923         [gdb/testsuite] Fix data alignment in gdb.arch/i386-{avx,sse}.exp
73924         When running test-case gdb.arch/i386-avx.exp with clang I ran into:
73925         ...
73926         (gdb) PASS: gdb.arch/i386-avx.exp: set first breakpoint in main
73927         continue^M
73928         Continuing.^M
73929         ^M
73930         Program received signal SIGSEGV, Segmentation fault.^M
73931         0x000000000040052b in main (argc=1, argv=0x7fffffffd3c8) at i386-avx.c:54^M
73932         54        asm ("vmovaps 0(%0), %%ymm0\n\t"^M
73933         (gdb) FAIL: gdb.arch/i386-avx.exp: continue to breakpoint: \
73934           continue to first breakpoint in main
73935         ...
73936
73937         The problem is that the vmovaps insn requires an 256-bit (or 32-byte) aligned
73938         address, and it's only 16-byte aligned:
73939         ...
73940         (gdb) p /x $rax
73941         $1 = 0x601030
73942         ...
73943
73944         Fix this by using a sufficiently aligned address, using _Alignas.
73945
73946         Compile using -std=gnu11 to support _Alignas.
73947
73948         Likewise in gdb.arch/i386-sse.exp.
73949
73950         Tested on x86_64-linux, with both gcc and clang.
73951
73952 2021-12-06  Alan Modra  <amodra@gmail.com>
73953
73954         [GOLD] PowerPC64 inline plt sequences
73955         The fixes gold failures to handle inline PLT sequences properly.
73956         PowerPC gold was always turning these back into direct calls due to
73957         gsym->use_plt_offset() returning false.  This is fixed for dynamic
73958         linking by correcting get_reference_flags, and for static linking by
73959         overriding use_plt_offset() in relocate().  The rest of the patch
73960         revolves around needing to create PLT entries for inline PLT calls
73961         when statically linking (for gcc -mlongcall).  The lplt section
73962         handled that for local symbols, now it does globals too.
73963
73964                 * powerpc.cc (Target_powerpc::plt_off): Return proper section
73965                 for static link.
73966                 (Target_powerpc::symval_for_branch): Make public.
73967                 (Target_powerpc::make_lplt_section): Add Symbol_table* param.
73968                 Adjust all calls.
73969                 (Target_powerpc::make_local_plt_entry): Likewise.
73970                 (Target_powerpc::make_local_plt_entry): New variant for global syms.
73971                 (Powerpc_relobj::do_relocate_sections): Don't write lplt contents.
73972                 (Output_data_plt_powerpc::do_write): Write lplt contents here.
73973                 (Output_data_plt_powerpc::Output_data_plt_powerpc): Save
73974                 symbol table pointer.  Adjust all uses.
73975                 (Output_data_plt_powerpc::add_entry): Add stash parameter.  Don't
73976                 do dynamic reloc handling when no reloc section.  Save symbol
73977                 for local plt entries.
73978                 (Output_data_plt_powerpc::add_local_entry): Save symbol.
73979                 (Output_data_plt_powerpc::Local_plt_ent): New class.
73980                 (Output_data_plt_powerpc::sym_ents_): New vector.
73981                 (Target_powerpc::Scan::get_reference_flags): Return
73982                 FUNCTION_CALL|RELATIVE_REF for inline plt relocs.
73983                 (Target_powerpc::Scan::global): Make entries in lplt for inline
73984                 plt call relocation symbols.
73985                 (Target_powerpc::Relocate::relocate): Rename has_plt_offset to
73986                 use_plt_offset.  Set use_plt_offset for inline plt relocs.
73987
73988 2021-12-06  Clément Chigot  <clement.chigot@atos.net>
73989
73990         ld: improve shared tests for AIX
73991         It's now possible to refer symbols in the main program from the
73992         shared library. However, it still impossible to have the same
73993         overriden features between shared objects and mains than ELF,
73994         without using the runtime linking feature which isn't yet fully
73995         available.
73996
73997         ld/ChangeLog:
73998
73999                 * testsuite/ld-shared/shared.exp: Improve XCOFF support
74000                 * testsuite/ld-shared/main.c: Likewise.
74001                 * testsuite/ld-shared/sh1.c: Likewise.
74002                 * testsuite/ld-shared/xcoff.dat: Likewise.
74003
74004 2021-12-06  GDB Administrator  <gdbadmin@sourceware.org>
74005
74006         Automatic date update in version.in
74007
74008 2021-12-05  Tom Tromey  <tom@tromey.com>
74009
74010         Preserve artificial CU name in process_psymtab_comp_unit_reader
74011         This fixes a use-after-free that Simon pointed out.
74012         process_psymtab_comp_unit_reader was allocating an artificial name for
74013         a CU, and then discarding it.  However, this name was preserved in the
74014         cached file_and_directory.  This patch arranges for the allocated name
74015         to be preserved there.
74016
74017 2021-12-05  Mike Frysinger  <vapier@gentoo.org>
74018
74019         sim: include ansidecl.h when needed
74020         Avoid implicit include deps with this to help untangle sim headers
74021         so we can get rid of arch-specific sim-main.h.
74022
74023         sim: include stdint.h when needed
74024         Avoid implicit include deps with this to help untangle sim headers
74025         so we can get rid of arch-specific sim-main.h.
74026
74027         sim: include stdarg.h when used
74028         Avoid implicit include deps with this to help untangle sim headers
74029         so we can get rid of arch-specific sim-main.h.
74030
74031 2021-12-05  Mike Frysinger  <vapier@gentoo.org>
74032
74033         sim: reorder header includes
74034         We're including system headers after local headers in a bunch of
74035         places, but this leads to conflicts when our local headers happen
74036         to define symbols that show up in the system headers.
74037
74038         Use the more standard order of:
74039         * config.h (via defs.h)
74040         * system headers
74041         * local library headers (e.g. bfd & libiberty)
74042         * sim specific headers
74043
74044 2021-12-05  Simon Marchi  <simon.marchi@polymtl.ca>
74045
74046         gdbsupport: fix memory leak in create_file_handler when re-using file handler
74047         ASan made me notice a memory leak, where the memory tied to the file
74048         handle name string wasn't freed.  When register a file handler with an
74049         fd that is already registered, we re-use the file_handler object, so we
74050         ended up creating a new std::string object and overwriting the
74051         file_handler::name pointer, without free-ing the old std::string.
74052
74053         Fix this by allocating file_handler with new, deleting it with
74054         delete, and making file_handler::name not a pointer.
74055
74056         Change-Id: Ie304cc78ab5ae5dfad9a1366e9890c09de651f43
74057
74058 2021-12-05  GDB Administrator  <gdbadmin@sourceware.org>
74059
74060         Automatic date update in version.in
74061
74062 2021-12-04  Mike Frysinger  <vapier@gentoo.org>
74063
74064         sim: moxie: hoist dtb rules up to common builds
74065         These rules don't depend on the target compiler settings, so hoist
74066         the build logic up to the common builds for better parallelization.
74067
74068         sim: m68hc11: delete unused profile flags
74069         These were moved to the common configure script a while ago and have
74070         the same default as these, so just delete it.
74071
74072         sim: msp430: delete redundant comments & settings
74073         These were copied from the example docs, so aren't adding any value.
74074
74075         sim: erc32: drop old configure target
74076         There is no configure script in here anymore to regenerate.
74077
74078         sim: m32c/rl78: drop redundant -Wall settings
74079         We already turn these on in the configure script.
74080
74081 2021-12-04  Tom Tromey  <tom@tromey.com>
74082
74083         Cache the result of find_file_and_directory
74084         This changes the DWARF reader to cache the result of
74085         find_file_and_directory.  This is not especially important now, but it
74086         will help the new DWARF indexer.
74087
74088         Move file_and_directory to new file and C++-ize
74089         This moves file_and_directory to a new file, and then C++-izes it --
74090         replacing direct assignments with methods, and arranging for it to own
74091         any string that must be computed.  Finally, the CU's objfile will only
74092         be used on demand; this is an important property for the new DWARF
74093         indexer's parallel mode.
74094
74095         Remove Irix case from find_file_and_directory
74096         find_file_and_directory has a special case for the Irix 6.2 compiler.
74097         Since this is long obsolete, this patch removes it.
74098
74099 2021-12-04  Mike Frysinger  <vapier@gentoo.org>
74100
74101         sim: frv: split up testsuite a bit
74102         Running frv's allinsn in serial is quite slow due to the sheer number
74103         of tests it contains.  By splitting it up and running in parallel, the
74104         execution time on my system goes from ~100sec to ~60sec.
74105
74106 2021-12-04  Simon Marchi  <simon.marchi@polymtl.ca>
74107
74108         gdb: don't show deprecated aliases
74109         I don't think it's very useful to show deprecated aliases to the
74110         user.  It encourages the user to use them, when the goal is the
74111         opposite.
74112
74113         For example, before:
74114
74115             (gdb) help set index-cache enabled
74116             set index-cache enabled, set index-cache off, set index-cache on
74117               alias set index-cache off = set index-cache enabled off
74118               alias set index-cache on = set index-cache enabled on
74119             Enable the index cache.
74120             When on, enable the use of the index cache.
74121
74122             (gdb) help set index-cache on
74123             Warning: 'set index-cache on', an alias for the command 'set index-cache enabled', is deprecated.
74124             Use 'set index-cache enabled on'.
74125
74126             set index-cache enabled, set index-cache off, set index-cache on
74127               alias set index-cache off = set index-cache enabled off
74128               alias set index-cache on = set index-cache enabled on
74129             Enable the index cache.
74130             When on, enable the use of the index cache.
74131
74132         After:
74133
74134             (gdb) help set index-cache enabled
74135             Enable the index cache.
74136             When on, enable the use of the index cache.
74137             (gdb) help set index-cache on
74138             Warning: 'set index-cache on', an alias for the command 'set index-cache enabled', is deprecated.
74139             Use 'set index-cache enabled on'.
74140
74141             Enable the index cache.
74142             When on, enable the use of the index cache.
74143
74144         Change-Id: I989b618a5ad96ba975367e9d16db95523cd57a4c
74145
74146 2021-12-04  Simon Marchi  <simon.marchi@polymtl.ca>
74147
74148         gdb/testsuite: fix two "maint info line-table"-related tests
74149         Commit 92228a334ba2 ("gdb: small "maintenance info line-table"
74150         readability improvements") change the output format of "maint info
74151         line-table" slightly, adding some empty lines between each
74152         line-table.  This causes two tests to start failing, update them to
74153         account for those empty lines.
74154
74155         Change-Id: I9d33a58fce3e860ba0554b25f5582e8066a5c519
74156
74157 2021-12-04  Simon Marchi  <simon.marchi@efficios.com>
74158
74159         gdb: revert one array_view copy change in ada-lang.c
74160         Commit 4bce7cdaf481 ("gdbsupport: add array_view copy function") caused
74161         an internal error when running gdb.ada/packed_array_assign.exp:
74162
74163             print pra(1) := pr^M
74164             /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/array-view.h:217: internal-error: copy: Assertion `dest.size () == src.size ()' failed.^M
74165
74166         I am not sure what's the root cause of this, whether it is a GDB bug
74167         exposed by using the array_view copy function or not.  Back out the
74168         change that triggers the internal error for now, while we investigate
74169         it.
74170
74171         Change-Id: I055ab14143e4cfd3ca7ce8f4855c6c3c05db52a7
74172
74173 2021-12-04  Mike Frysinger  <vapier@gentoo.org>
74174
74175         bfd: unify header generation rules
74176         The logic between these rules are extremely similar, so unify them
74177         into a single variable.
74178
74179 2021-12-04  Mike Frysinger  <vapier@gentoo.org>
74180
74181         bfd: move header updates up a directory
74182         The rules for rebuilding the bfd headers live in the doc/ subdir
74183         (most likely) because they rely on the chew & related tools.  But
74184         we can collapse them into the main Makefile while keeping the tools
74185         in the doc subdir easily enough.  This makes the code simpler and
74186         allows for rebuilding them in parallel.
74187
74188         Also add automake silent rule support while we're here.
74189
74190 2021-12-04  Mike Frysinger  <vapier@gentoo.org>
74191
74192         bfd: convert bfdver.h to silent automake rules
74193
74194 2021-12-04  GDB Administrator  <gdbadmin@sourceware.org>
74195
74196         Automatic date update in version.in
74197
74198 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74199
74200         gdb: small "maintenance info line-table" readability improvements
74201          - separate each entry with a newline, to visually separate them
74202          - style filenames with the filename style
74203          - print the name of the compunit_symtab
74204
74205         A header now looks like this, with the compunit_symtab name added (and
74206         the coloring, but you can't really see it here):
74207
74208             objfile: /home/simark/build/babeltrace/src/cli/.libs/babeltrace2 ((struct objfile *) 0x613000005980)
74209             compunit_symtab: babeltrace2-cfg-cli-args.c ((struct compunit_symtab *) 0x62100da1ed10)
74210             symtab: /usr/include/glib-2.0/glib/gdatetime.h ((struct symtab *) 0x62100d9ee530)
74211             linetable: ((struct linetable *) 0x0):
74212
74213         Change-Id: Idc23e10aaa66e2e692adb0a6a74144f72c4fa1c7
74214
74215 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74216
74217         gdb: change some alias functions parameters to const-reference
74218         Now that we use intrusive list to link aliases, it becomes easier to
74219         pass cmd_list_element arguments by const-reference rather than by
74220         pointer to some functions, change a few.
74221
74222         Change-Id: Id0df648ed26e9447da0671fc2c858981cda31df8
74223
74224 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74225
74226         gdb: use intrusive_list for cmd_list_element aliases list
74227         Change the manually-implemented linked list to use intrusive_list.  This
74228         is not strictly necessary, but it makes the code much simpler.
74229
74230         Change-Id: Idd08090ebf2db8bdcf68e85ef72a9635f1584ccc
74231
74232 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74233
74234         gdb: trivial changes to use array_view
74235         Change a few relatively obvious spots using value contents to propagate
74236         the use array_view a bit more.
74237
74238         Change-Id: I5338a60986f06d5969fec803d04f8423c9288a15
74239
74240 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74241
74242         gdb: make extract_integer take an array_view
74243         I think it would make sense for extract_integer, extract_signed_integer
74244         and extract_unsigned_integer to take an array_view.  This way, when we
74245         extract an integer, we can validate that we don't overflow the buffer
74246         passed by the caller (e.g. ask to extract a 4-byte integer but pass a
74247         2-byte buffer).
74248
74249          - Change extract_integer to take an array_view
74250          - Add overloads of extract_signed_integer and extract_unsigned_integer
74251            that take array_views.  Keep the existing versions so we don't
74252            need to change all callers, but make them call the array_view
74253            versions.
74254
74255         This shortens some places like:
74256
74257           result = extract_unsigned_integer (value_contents (result_val).data (),
74258                                              TYPE_LENGTH (value_type (result_val)),
74259                                              byte_order);
74260
74261         into
74262
74263           result = extract_unsigned_integer (value_contents (result_val), byte_order);
74264
74265         value_contents returns an array view that is of length
74266         `TYPE_LENGTH (value_type (result_val))` already, so the length is
74267         implicitly communicated through the array view.
74268
74269         Change-Id: Ic1c1f98c88d5c17a8486393af316f982604d6c95
74270
74271 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74272
74273         gdbsupport: add array_view copy function
74274         An assertion was recently added to array_view::operator[] to ensure we
74275         don't do out of bounds accesses.  However, when the array_view is copied
74276         to or from using memcpy, it bypasses that safety.
74277
74278         To address this, add a `copy` free function that copies data from an
74279         array view to another, ensuring that the destination and source array
74280         views have the same size.  When copying to or from parts of an
74281         array_view, we are expected to use gdb::array_view::slice, which does
74282         its own bounds check.  With all that, any copy operation that goes out
74283         of bounds should be caught by an assertion at runtime.
74284
74285         copy is implemented using std::copy and std::copy_backward, which, at
74286         least on libstdc++, appears to pick memmove when copying trivial data.
74287         So in the end there shouldn't be much difference vs using a bare memcpy,
74288         as we do right now.  When copying non-trivial data, std::copy and
74289         std::copy_backward assigns each element in a loop.
74290
74291         To properly support overlapping ranges, we must use std::copy or
74292         std::copy_backward, depending on whether the destination is before the
74293         source or vice-versa.  std::copy and std::copy_backward don't support
74294         copying exactly overlapping ranges (where the source range is equal to
74295         the destination range).  But in this case, no copy is needed anyway, so
74296         we do nothing.
74297
74298         The order of parameters of the new copy function is based on std::copy
74299         and std::copy_backward, where the source comes before the destination.
74300
74301         Change a few randomly selected spots to use the new function, to show
74302         how it can be used.
74303
74304         Add a test for the new function, testing both with arrays of a trivial
74305         type (int) and of a non-trivial type (foo).  Test non-overlapping
74306         ranges as well as three kinds of overlapping ranges: source before dest,
74307         dest before source, and dest == source.
74308
74309         Change-Id: Ibeaca04e0028410fd44ce82f72e60058d6230a03
74310
74311 2021-12-03  Simon Marchi  <simon.marchi@efficios.com>
74312
74313         gdb: change store_waitstatus to return a target_waitstatus by value
74314         store_waitstatus is basically a translation function between a status
74315         integer and an equivalent target_waitstatus object.  It would make sense
74316         for it to take the integer as a parameter and return the
74317         target_waitstatus by value.  Do that, and rename to
74318         host_status_to_waitstatus.  Users can then do:
74319
74320           ws = host_status_to_waitstatus (status)
74321
74322         which does the right thing, given the move constructor of
74323         target_waitstatus.
74324
74325         Change-Id: I7a07d59d3dc19d3ed66929642f82f44f3e85d61b
74326
74327 2021-12-03  Simon Marchi  <simon.marchi@efficios.com>
74328
74329         gdb: return *this in target_waitstatus setters
74330         While playing with some code creating target_waitstatus objects, I was
74331         mildly annoyed by the fact that we can't just return a new
74332         target_waitstatus object.  We have to do:
74333
74334             target_waitstatus ws;
74335             ws.set_exited (123);
74336             return ws;
74337
74338         Make the setters return the "this" object as a reference, such that it's
74339         possible to do:
74340
74341             return target_waitstatus ().set_exited (123);
74342
74343         I initially thought of adding static creation functions, which you would
74344         use like:
74345
74346             return target_waitstatus::make_exited (123);
74347
74348         However, making the setters return a reference to the object achieves
74349         pretty much the same thing, with less new code.
74350
74351         Change-Id: I45159b7f9fcd9db5b20603480e323020b14ed147
74352
74353 2021-12-03  Simon Marchi  <simon.marchi@polymtl.ca>
74354
74355         gdb: make saved_filename an std::string
74356         Make this variable an std::string, avoiding manual memory management.
74357
74358         Change-Id: Ie7a8d7381449ab9c4dfc4cb8b99e63b9ffa8f947
74359
74360 2021-12-03  Richard Sandiford  <richard.sandiford@arm.com>
74361
74362         aarch64: Fix uninitialised memory
74363         AARCH64_OPDE_EXPECTED_A_AFTER_B and AARCH64_OPDE_A_SHOULD_FOLLOW_B
74364         are not paired with an error string, but we had an assert that the
74365         error was nonnull.  Previously this assert was testing uninitialised
74366         memory and so could pass or fail arbitrarily.
74367
74368         opcodes/
74369                 * aarch64-opc.c (verify_mops_pme_sequence): Initialize the error
74370                 field to null for AARCH64_OPDE_EXPECTED_A_AFTER_B and
74371                 AARCH64_OPDE_A_SHOULD_FOLLOW_B.
74372                 * aarch64-dis.c (print_verifier_notes): Move assert.
74373
74374 2021-12-03  Andrew Burgess  <andrew.burgess@embecosm.com>
74375
74376         gdb: make value_subscripted_rvalue static
74377         The function value_subscripted_rvalue is only used in valarith.c, so
74378         lets make it a static function.
74379
74380         There should be no user visible change after this commit.
74381
74382 2021-12-03  Andrew Burgess  <aburgess@redhat.com>
74383
74384         gdb/testsuite: give a test a real name
74385         A test in gdb.python/py-send-packet.exp added in this commit:
74386
74387           commit 24b2de7b776f8f23788d855b1eec290c6e208821
74388           Date:   Tue Aug 31 14:04:36 2021 +0100
74389
74390               gdb/python: add gdb.RemoteTargetConnection.send_packet
74391
74392         included a large amount of binary data in the command sent to GDB.  As
74393         this test didn't have a real test name the binary data was included in
74394         the gdb.sum file.  The contents of the binary data could change
74395         between different runs of GDB, and this makes comparing results
74396         harder.
74397
74398         This commit gives the test a real test name.
74399
74400 2021-12-03  Andrew Burgess  <aburgess@redhat.com>
74401
74402         gdb/remote: fix use after free bug
74403         This commit:
74404
74405           commit 288712bbaca36bff6578bc839ebcdc3707662f81
74406           Date:   Mon Nov 22 15:16:27 2021 +0000
74407
74408               gdb/remote: use scoped_restore to control starting_up flag
74409
74410         introduced a use after free bug.  The scoped restore added in the
74411         above commit resets a flag within a remote_target's remote_state
74412         object.
74413
74414         However, in some situations, the remote_target can be unpushed before
74415         the error is thrown.  If the only reference to the target is the one
74416         in the target stack, then unpushing the target will cause the
74417         remote_target to be deleted, which, in turn, will delete the
74418         remote_state object.  The scoped restore will then try to reset the
74419         flag within a deleted object.
74420
74421         This problem was caught in the gdb.server/server-connect.exp test,
74422         which, when run with the address sanitizer enabled, highlights the
74423         write after free bug described above.
74424
74425         This commit resolves this issue by adding a new class specifically for
74426         the purpose of managing the starting_up flag.  As well as setting, and
74427         then clearing the starting_up flag, this new class increments, and
74428         then decrements the reference count on the remote_target object.  This
74429         prevents the remote_target from being deleted until after the flag has
74430         been reset.
74431
74432         The gdb.server/server-connect.exp now runs cleanly with the address
74433         sanitizer enabled.
74434
74435 2021-12-03  Mike Frysinger  <vapier@gentoo.org>
74436
74437         libctf: workaround automake bug with conditional info pages
74438         It looks like automake makes assumptions about its ability to build info
74439         pages based on the GNU standard behavior of shipping info pages with the
74440         distributions.  So even though the info pages were conditionalized, and
74441         automake disabled some of the targets, it was still creeping in by way
74442         of unconditional INFO_DEPS settings.
74443
74444         We can workaround this by adding a stub target for the info page when
74445         building info pages are disabled.  This tricks automake into disabling
74446         its own extended generation target.  I'll follow up with the automake
74447         folks to see what they think.
74448
74449 2021-12-03  Chenghua Xu  <xuchenghua@loongson.cn>
74450
74451         Add myself and Zhensong Liu as the LoongArch port maintainer.
74452
74453 2021-12-03  Alan Modra  <amodra@gmail.com>
74454
74455         Revert "Re: Don't compile some opcodes files when bfd is 32-bit only"
74456         This reverts commit 7a53275579e7cec9389ccb924f5ecf69e8d89d41.
74457         The bpf sim doesn't work with a 32-bit bfd after all.
74458
74459 2021-12-03  GDB Administrator  <gdbadmin@sourceware.org>
74460
74461         Automatic date update in version.in
74462
74463 2021-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
74464
74465         gdb: remove unexpected xstrdup in _initialize_maint_test_settings
74466         That xstrdup is not correct, since we are assigning an std::string.  The
74467         result of xstrdup is used to initialize the string, and then lost
74468         forever.  Remove it.
74469
74470         Change-Id: Ief7771055e4bfd643ef3b285ec9fb7b1bfd14335
74471
74472 2021-12-02  Nick Clifton  <nickc@redhat.com>
74473
74474         Fix illegal memory access whilst parsing corrupt DWARF debug information.
74475                 PR 28645
74476                 * dwarf.c (process_cu_tu_index): Add test for overruning section
74477                 whilst processing slots.
74478
74479 2021-12-02  Tom de Vries  <tdevries@suse.de>
74480
74481         [gdb/tdep] Fix avx512 -m32 support in gdbserver
74482         PR27257 reports a problem that can be reproduced as follows:
74483         - use x86_64 machine with avx512 support
74484         - compile a hello world with -m32 to a.out
74485         - start a gdbserver session with a.out
74486         - use gdb to connect to the gdbserver session
74487
74488         This makes us run into:
74489         ...
74490         Listening on port 2346
74491         Remote debugging from host ::1, port 34940
74492         src/gdbserver/regcache.cc:257: \
74493           A problem internal to GDBserver has been detected.
74494         Unknown register zmm16h requested
74495         ...
74496
74497         The problem is that i387_xsave_to_cache in gdbserver/i387-fp.cc can't find a
74498         register zmm16h in the register cache.
74499
74500         To understand how this happens, first some background.
74501
74502         SSE has 16 128-bit wide xmm registers.
74503
74504         AVX extends the SSE registers set as follows:
74505         - it extends the 16 existing 128-bit wide xmm registers to 256-bit wide ymm
74506           registers.
74507
74508         AVX512 extends the AVX register set as follows:
74509         - it extends the 16 existing 256-bit wide ymm registers to 512-bit wide zmm
74510           registers.
74511         - it adds 16 additional 512-bit wide zmm registers (with corresponding ymm and
74512           xmm subregisters added as well)
74513
74514         However, in 32-bit mode, there are only 8 xmm/ymm/zmm registers.
74515
74516         The problem we're running into is that gdbserver/i387-fp.cc uses these
74517         constants to describe the size of the register file:
74518         ...
74519         static const int num_avx512_zmmh_low_registers = 16;
74520         static const int num_avx512_zmmh_high_registers = 16;
74521         static const int num_avx512_ymmh_registers = 16;
74522         static const int num_avx512_xmm_registers = 16;
74523         ...
74524         which are all incorrect for the 32-bit case.
74525
74526         Fix this by replacing the constants with variables that have the appropriate
74527         values in 64-bit and 32-bit mode.
74528
74529         Tested on x86_64-linux with native and unix/-m32.
74530
74531 2021-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
74532
74533         gdb/testsuite: update tests looking for "DWARF 2" debug format
74534         Commit ab557072b8ec ("gdb: use actual DWARF version in compunit's
74535         debugformat field") changes the debug format string in "info source" to
74536         show the actual DWARF version, rather than always show "DWARF 2".
74537
74538         However, it failed to consider that some tests checked for the "DWARF 2"
74539         string to see if the test program is compiled with DWARF debug
74540         information.  Since everything is compiled with DWARF 4 or 5 nowadays,
74541         that changed the behavior of those tests.  Notably, it prevent the
74542         tests using skip_inline_var_tests to run.
74543
74544         Grep through the testsuite for "DWARF 2" and change all occurrences I
74545         could find to use "DWARF [0-9]" instead (that string is passed to TCL's
74546         string match).
74547
74548         Change-Id: Ic7fb0217fb9623880c6f155da6becba0f567a885
74549
74550 2021-12-02  Joel Brobecker  <brobecker@adacore.com>
74551
74552         (PPC64) fix handling of fixed-point values when using "return" command
74553         In the gdb.ada/fixed_points_function.exp testcase, we have the following
74554         Ada code...
74555
74556            type FP1_Type is delta 0.1 range -1.0 .. +1.0; --  Ordinary
74557            function Call_FP1 (F : FP1_Type) return FP1_Type is
74558            begin
74559               FP1_Arg := F;
74560               return FP1_Arg;
74561            end Call_FP1;
74562
74563         ... used as follow:
74564
74565            F1 : FP1_Type := 1.0;
74566            F1 := Call_FP1 (F1);
74567
74568         The testcase, among other things, verifies that "return" works
74569         properly as follow:
74570
74571             | (gdb) return 1.0
74572             | Make pck.call_fp1 return now? (y or n) y
74573             | [...]
74574             | 9          F1 := Call_FP1 (F1);
74575             | (gdb) next
74576             | (gdb) print f1
74577             | $1 = 0.0625
74578
74579         The output of the last command shows that we returned the wrong
74580         value. The value printed gives a clue about the problem, since
74581         it is 1/16th of the value we expected, where 1/16 is FP1_Type's
74582         scaling factor.
74583
74584         The problem, here, comes from the fact that the function
74585         handling return values for base types (ppc64_sysv_abi_return_value_base)
74586         writes the return value using unpack_long which, upon seeing that
74587         the value being unpacked is a fixed point type, applies the scaling
74588         factor, to get the integer-representation of our fixed-point value
74589         (similar to what it does with floats, for instance).
74590
74591         So, the fix consists in teaching ppc64_sysv_abi_return_value_base
74592         about fixed-point types, and to avoid the unwanted application
74593         of the scaling factor.
74594
74595         Note that the "finish" function, on the other hand, does not
74596         suffer from this issue, simply becaue the value returned by
74597         the function is read from register without the use of a type,
74598         thus avoiding an unwanted application of a scaling factor.
74599
74600         No test added, as this change is already tested by
74601         gdb.ada/fixed_points_function.exp.
74602
74603         Co-Authored-By: Tristan Gingold <gingold@adacore.com>
74604
74605 2021-12-02  Joel Brobecker  <brobecker@adacore.com>
74606
74607         (RISCV) fix handling of fixed-point type return values
74608         This commit adds support for TYPE_CODE_FIXED_POINT types for
74609         "finish" and "return" commands.
74610
74611         Consider the following Ada code...
74612
74613            type FP1_Type is delta 0.1 range -1.0 .. +1.0; --  Ordinary
74614            function Call_FP1 (F : FP1_Type) return FP1_Type is
74615            begin
74616               FP1_Arg := F;
74617               return FP1_Arg;
74618            end Call_FP1;
74619
74620         ... used as follow:
74621
74622            F1 : FP1_Type := 1.0;
74623            F1 := Call_FP1 (F1);
74624
74625         "finish" currently behaves as follow:
74626
74627             | (gdb) finish
74628             | [...]
74629             | Value returned is $1 = 0
74630
74631         We expect the returned value to be "1".
74632
74633         Similarly, "return" makes the function return the wrong value:
74634
74635             | (gdb) return 1.0
74636             | Make pck.call_fp1 return now? (y or n) y
74637             | [...]
74638             | 9          F1 := Call_FP1 (F1);
74639             | (gdb) next
74640             | (gdb) print f1
74641             | $1 = 0.0625
74642
74643         (we expect it to print "1" instead).
74644
74645         This problem comes from the handling of integral return values
74646         when the return value is actually fixed point type. Our type
74647         here is actually a range of a fixed point type, but the same
74648         principles should also apply to pure fixed-point types. For
74649         the record, here is what the debugging info looks like:
74650
74651          <1><238>: Abbrev Number: 2 (DW_TAG_subrange_type)
74652             <239>   DW_AT_lower_bound : -16
74653             <23a>   DW_AT_upper_bound : 16
74654             <23b>   DW_AT_name        : pck__fp1_type
74655             <23f>   DW_AT_type        : <0x248>
74656
74657          <1><248>: Abbrev Number: 4 (DW_TAG_base_type)
74658             <249>   DW_AT_byte_size   : 1
74659             <24a>   DW_AT_encoding    : 13      (signed_fixed)
74660             <24b>   DW_AT_binary_scale: -4
74661             <24c>   DW_AT_name        : pck__Tfp1_typeB
74662             <250>   DW_AT_artificial  : 1
74663
74664         ... where the scaling factor is 1/16.
74665
74666         Looking at the "finish" command, what happens is that riscv_arg_location
74667         determines that our return value should be returned by parameter using
74668         an integral convention (via builtin type long). And then,
74669         riscv_return_value uses a cast to that builtin type long to
74670         store the value of into a buffer with the right register size.
74671         This doesn't work in our case, because the underlying value
74672         returned by the function is unscaled, which means it is 16,
74673         and thus the cast is like doing:
74674
74675            arg_val = (FP1_Type) 16
74676
74677         ... In other words, it is trying to create an FP1_Type enty whose
74678         value is 16. Applying the scaling factor, that's 256, and because
74679         the size of FP1_Type is 1 byte, we overflow and thus it ends up
74680         being zero.
74681
74682         The same happen with the "return" function, but the other way around.
74683
74684         The fix consists in handling fixed-point types separately from
74685         integral types.
74686
74687 2021-12-02  Joel Brobecker  <brobecker@adacore.com>
74688
74689         (ARM/fixed-point) wrong value shown by "finish" command:
74690         Consider the following Ada code:
74691
74692            type FP1_Type is delta 0.1 range -1.0 .. +1.0; --  Ordinary
74693            FP1_Arg : FP1_Type := 0.0;
74694
74695            function Call_FP1 (F : FP1_Type) return FP1_Type is
74696            begin
74697               FP1_Arg := F;
74698               return FP1_Arg;
74699            end Call_FP1;
74700
74701         After having stopped inside function Call_FP1 as follow:
74702
74703             Breakpoint 1, pck.call_fp1 (f=1) at /[...]/pck.adb:5
74704             5             FP1_Arg := F;
74705
74706         Returning from that function call using "finish" should show
74707         that the function return "1.0" (the same value as was passed
74708         as an argument). However, this is not the case:
74709
74710             (gdb) finish
74711             Run till exit from #0  pck.call_fp1 (f=1)
74712             [...]
74713             9          F1 := Call_FP1 (F1);
74714             Value returned is $1 = 0
74715
74716         This patch enhances the extraction of the return value to know about
74717         fixed point types.
74718
74719 2021-12-02  Xavier Roirand  <roirand@adacore.com>
74720
74721         (Ada/AArch64) fix fixed point argument passing in inferior funcall
74722         Consider the following code:
74723
74724            type FP1_Type is delta 0.1 range -1.0 .. +1.0; --  Ordinary
74725
74726            function Call_FP1 (F : FP1_Type) return FP1_Type is
74727            begin
74728               return F;
74729            end Call_FP1;
74730
74731         When the default in GCC is to generate proper DWARF info for fixed point
74732         types, then in gdb, printing the result of a call to call_fp1 with a
74733         decimal parameter leads to:
74734
74735           (gdb) p call_fp1(0.5)
74736           $1 = 0
74737
74738         The displayed value is wrong, and we actually expected:
74739
74740           (gdb) p call_fp1(0.5)
74741           $1 = 0.5
74742
74743         What happened is that our fixed point type parameter got promoted to a
74744         32bit integer because we detected that the length of that object was less
74745         than 4 bytes. The compiler does not perform this promotion and therefore
74746         GDB should not either.
74747
74748         This patch fixes the behavior described above.
74749
74750 2021-12-02  Tom Tromey  <tromey@adacore.com>
74751
74752         Implement 'task apply'
74753         This adds a 'task apply' command, which is the Ada tasking analogue of
74754         'thread apply'.  Unlike 'thread apply', it doesn't offer the
74755         'ascending' flag; but otherwise it's essentially the same.
74756
74757         Add "task" keyword to the "watch" command
74758         Breakpoints in gdb can be made specific to an Ada task using the
74759         "task" qualifier.  This patch applies this same idea to watchpoints.
74760
74761 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74762
74763         aarch64: Update gas/NEWS for recent changes
74764         gas/
74765                 * NEWS: Mention support for Armv8.8-A and for new system registers.
74766
74767 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74768
74769         aarch64: Add BC instruction
74770         This patch adds support for the Armv8.8-A BC instruction.
74771         [https://developer.arm.com/documentation/ddi0596/2021-09/Base-Instructions/BC-cond--Branch-Consistent-conditionally-?lang=en]
74772
74773         include/
74774                 * opcode/aarch64.h (AARCH64_FEATURE_HBC): New macro.
74775                 (AARCH64_ARCH_V8_8): Make armv8.8-a imply AARCH64_FEATURE_HBC.
74776
74777         opcodes/
74778                 * aarch64-tbl.h (aarch64_feature_hbc): New variable.
74779                 (HBC, HBC_INSN): New macros.
74780                 (aarch64_opcode_table): Add BC.C.
74781                 * aarch64-dis-2.c: Regenerate.
74782
74783         gas/
74784                 * doc/c-aarch64.texi: Document +hbc.
74785                 * config/tc-aarch64.c (aarch64_features): Add "hbc".
74786                 * testsuite/gas/aarch64/hbc.s, testsuite/gas/aarch64/hbc.d: New test.
74787                 * testsuite/gas/aarch64/hbc-invalid.s,
74788                 testsuite/gas/aarch64/hbc-invalid.l,
74789                 testsuite/gas/aarch64/hbc-invalid.d: New test.
74790
74791 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74792
74793         aarch64: Enforce P/M/E order for MOPS instructions
74794         The MOPS instructions should be used as a triple, such as:
74795
74796                cpyfp [x0]!, [x1]!, x2!
74797                cpyfm [x0]!, [x1]!, x2!
74798                cpyfe [x0]!, [x1]!, x2!
74799
74800         The registers should also be the same for each writeback operand.
74801         This patch adds a warning for code that doesn't follow this rule,
74802         along similar lines to the warning that we already emit for
74803         invalid uses of MOVPRFX.
74804
74805         include/
74806                 * opcode/aarch64.h (C_SCAN_MOPS_P, C_SCAN_MOPS_M, C_SCAN_MOPS_E)
74807                 (C_SCAN_MOPS_PME): New macros.
74808                 (AARCH64_OPDE_A_SHOULD_FOLLOW_B): New aarch64_operand_error_kind.
74809                 (AARCH64_OPDE_EXPECTED_A_AFTER_B): Likewise.
74810                 (aarch64_operand_error): Make each data value a union between
74811                 an int and a string.
74812
74813         opcodes/
74814                 * aarch64-tbl.h (MOPS_CPY_OP1_OP2_INSN): Add scan flags.
74815                 (MOPS_SET_OP1_OP2_INSN): Likewise.
74816                 * aarch64-opc.c (set_out_of_range_error): Update after change to
74817                 aarch64_operand_error.
74818                 (set_unaligned_error, set_reg_list_error): Likewise.
74819                 (init_insn_sequence): Use a 3-instruction sequence for
74820                 MOPS P instructions.
74821                 (verify_mops_pme_sequence): New function.
74822                 (verify_constraints): Call it.
74823                 * aarch64-dis.c (print_verifier_notes): Handle
74824                 AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B.
74825
74826         gas/
74827                 * config/tc-aarch64.c (operand_mismatch_kind_names): Add entries
74828                 for AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B.
74829                 (operand_error_higher_severity_p): Check that
74830                 AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B
74831                 come between AARCH64_OPDE_RECOVERABLE and AARCH64_OPDE_SYNTAX_ERROR;
74832                 their relative order is not significant.
74833                 (record_operand_error_with_data): Update after change to
74834                 aarch64_operand_error.
74835                 (output_operand_error_record): Likewise.  Handle
74836                 AARCH64_OPDE_A_SHOULD_FOLLOW_B and AARCH64_OPDE_EXPECTED_A_AFTER_B.
74837                 * testsuite/gas/aarch64/mops_invalid_2.s,
74838                 testsuite/gas/aarch64/mops_invalid_2.d,
74839                 testsuite/gas/aarch64/mops_invalid_2.l: New test.
74840
74841 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74842
74843         aarch64: Add support for +mops
74844         This patch adds support for FEAT_MOPS, an Armv8.8-A extension
74845         that provides memcpy and memset acceleration instructions.
74846
74847         I took the perhaps controversial decision to generate the individual
74848         instruction forms using macros rather than list them out individually.
74849         This becomes useful with a follow-on patch to check that code follows
74850         the correct P/M/E sequence.
74851         [https://developer.arm.com/documentation/ddi0596/2021-09/Base-Instructions?lang=en]
74852
74853         include/
74854                 * opcode/aarch64.h (AARCH64_FEATURE_MOPS): New macro.
74855                 (AARCH64_ARCH_V8_8): Make armv8.8-a imply AARCH64_FEATURE_MOPS.
74856                 (AARCH64_OPND_MOPS_ADDR_Rd): New aarch64_opnd.
74857                 (AARCH64_OPND_MOPS_ADDR_Rs): Likewise.
74858                 (AARCH64_OPND_MOPS_WB_Rn): Likewise.
74859
74860         opcodes/
74861                 * aarch64-asm.h (ins_x0_to_x30): New inserter.
74862                 * aarch64-asm.c (aarch64_ins_x0_to_x30): New function.
74863                 * aarch64-dis.h (ext_x0_to_x30): New extractor.
74864                 * aarch64-dis.c (aarch64_ext_x0_to_x30): New function.
74865                 * aarch64-tbl.h (aarch64_feature_mops): New feature set.
74866                 (aarch64_feature_mops_memtag): Likewise.
74867                 (MOPS, MOPS_MEMTAG, MOPS_INSN, MOPS_MEMTAG_INSN)
74868                 (MOPS_CPY_OP1_OP2_PME_INSN, MOPS_CPY_OP1_OP2_INSN, MOPS_CPY_OP1_INSN)
74869                 (MOPS_CPY_INSN, MOPS_SET_OP1_OP2_PME_INSN, MOPS_SET_OP1_OP2_INSN)
74870                 (MOPS_SET_INSN): New macros.
74871                 (aarch64_opcode_table): Add MOPS instructions.
74872                 (aarch64_opcode_table): Add entries for AARCH64_OPND_MOPS_ADDR_Rd,
74873                 AARCH64_OPND_MOPS_ADDR_Rs and AARCH64_OPND_MOPS_WB_Rn.
74874                 * aarch64-opc.c (aarch64_print_operand): Handle
74875                 AARCH64_OPND_MOPS_ADDR_Rd, AARCH64_OPND_MOPS_ADDR_Rs and
74876                 AARCH64_OPND_MOPS_WB_Rn.
74877                 (verify_three_different_regs): New function.
74878                 * aarch64-asm-2.c: Regenerate.
74879                 * aarch64-dis-2.c: Likewise.
74880                 * aarch64-opc-2.c: Likewise.
74881
74882         gas/
74883                 * doc/c-aarch64.texi: Document +mops.
74884                 * config/tc-aarch64.c (parse_x0_to_x30): New function.
74885                 (parse_operands): Handle AARCH64_OPND_MOPS_ADDR_Rd,
74886                 AARCH64_OPND_MOPS_ADDR_Rs and AARCH64_OPND_MOPS_WB_Rn.
74887                 (aarch64_features): Add "mops".
74888                 * testsuite/gas/aarch64/mops.s, testsuite/gas/aarch64/mops.d: New test.
74889                 * testsuite/gas/aarch64/mops_invalid.s,
74890                 * testsuite/gas/aarch64/mops_invalid.d,
74891                 * testsuite/gas/aarch64/mops_invalid.l: Likewise.
74892
74893 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74894
74895         aarch64: Add Armv8.8-A system registers
74896         Armv8.8-A defines two new system registers: allint and icc_nmiar1_el1.
74897         Both of them were previously unmapped.  allint supports a 0/1 immediate.
74898         [https://developer.arm.com/documentation/ddi0595/2021-09/AArch64-Registers/ALLINT--All-Interrupt-Mask-Bit?lang=en]
74899         [https://developer.arm.com/documentation/ddi0595/2021-09/AArch64-Registers/ICC-NMIAR1-EL1--Interrupt-Controller-Non-maskable-Interrupt-Acknowledge-Register-1?lang=en]
74900
74901         opcodes/
74902                 * aarch64-opc.c (SR_V8_8): New macro.
74903                 (aarch64_sys_regs): Add allint and icc_nmiar1_el1.
74904                 (aarch64_pstatefields): Add allint.
74905
74906         gas/
74907                 * testsuite/gas/aarch64/armv8_8-a-sysregs.s,
74908                 * testsuite/gas/aarch64/armv8_8-a-sysregs.d: New test.
74909                 * testsuite/gas/aarch64/armv8_8-a-sysregs-invalid.s,
74910                 * testsuite/gas/aarch64/armv8_8-a-sysregs-invalid.l,
74911                 * testsuite/gas/aarch64/armv8_8-a-sysregs-invalid.d: New test.
74912
74913 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74914
74915         aarch64: Add id_aa64isar2_el1
74916         Armv8.8-A defines a read-only system register called id_aa64isar2_el1.
74917         The register was previously RES0 and should therefore be accepted
74918         at all architecture levels.
74919         [https://developer.arm.com/documentation/ddi0595/2021-09/AArch64-Registers/ID-AA64ISAR2-EL1--AArch64-Instruction-Set-Attribute-Register-2?lang=en]
74920
74921         opcodes/
74922                 * aarch64-opc.c (aarch64_sys_regs): Add id_aa64isar2_el1.
74923
74924         gas/
74925                 * testsuite/gas/aarch64/sysreg-diagnostic.s: Test writes to
74926                 id_aa64isar2_el1.
74927                 * testsuite/gas/aarch64/sysreg-diagnostic.d: Update accordingly.
74928                 * testsuite/gas/aarch64/sysreg-diagnostic.l: Likewise.
74929                 * testsuite/gas/aarch64/sysreg.s: Test reads from
74930                 id_aa64isar2_el1.
74931                 * testsuite/gas/aarch64/sysreg.d: Update accordingly.
74932
74933 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74934
74935         aarch64: Add support for Armv8.8-A
74936         This patch adds skeleton support for -march=armv8.8-a, testing only
74937         that it correctly inherits from armv8.7-a.
74938
74939         include/
74940                 * opcode/aarch64.h (AARCH64_FEATURE_V8_8): New macro.
74941                 (AARCH64_ARCH_V8_8): Likewise.
74942
74943         gas/
74944                 * doc/c-aarch64.texi: Document armv8.8-a.
74945                 * config/tc-aarch64.c (aarch64_archs): Add armv8-8-a
74946                 * testsuite/gas/aarch64/v8-8-a.s,
74947                 * testsuite/gas/aarch64/v8-8-a.d: New test.
74948
74949 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74950
74951         aarch64: Provide line info for unclosed sequences
74952         We warn about MOVPRFX instructions that have no following
74953         instruction.  This patch adds a line number to the message,
74954         which is useful if the assembly code has multiple text sections.
74955
74956         The new code is unconditional since OBJ_ELF is always defined
74957         for aarch64.
74958
74959         gas/
74960                 * config/tc-aarch64.h (aarch64_segment_info_type): Add last_file
74961                 and last_line.
74962                 * config/tc-aarch64.c (now_instr_sequence): Delete.
74963                 (force_automatic_sequence_close): Provide a line number when
74964                 reporting unclosed sequences.
74965                 (md_assemble): Record the location of the instruction in
74966                 tc_segment_info.
74967                 * testsuite/gas/aarch64/sve-movprfx_4.l: Add line number to error
74968                 message.
74969                 * testsuite/gas/aarch64/sve-movprfx_7.l: Likewise.
74970                 * testsuite/gas/aarch64/sve-movprfx_8.l: Likewise.
74971
74972 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74973
74974         aarch64: Tweak insn sequence code
74975         libopcodes has some code to check constraints across sequences
74976         of consecutive instructions.  It was added to support MOVPRFX
74977         sequences but is going to be useful for the Armv8.8-A MOPS
74978         feature as well.
74979
74980         Currently the structure has one field to record the instruction
74981         that started a sequence and another to record the remaining
74982         instructions in the sequence.  It's more convenient for the
74983         MOPS code if we put the instructions into a single array instead.
74984
74985         No functional change intended.
74986
74987         include/
74988                 * opcode/aarch64.h (aarch64_instr_sequence): Replace num_insns
74989                 and current_insns with num_added_insns and num_allocated_insns.
74990
74991         opcodes/
74992                 * aarch64-opc.c (add_insn_to_sequence): New function.
74993                 (init_insn_sequence): Update for new aarch64_instr_sequence layout.
74994                 Add the first instruction to the inst array.
74995                 (verify_constraints): Update for new aarch64_instr_sequence layout.
74996                 Don't add the last instruction to the array.
74997
74998 2021-12-02  Richard Sandiford  <richard.sandiford@arm.com>
74999
75000         aarch64: Add maximum immediate value to aarch64_sys_reg
75001         The immediate form of MSR has a 4-bit immediate field (in CRm).
75002         However, many forms of MSR require a smaller immediate.  These cases
75003         are identified by value in operand_general_constraint_met_p,
75004         but they're now the common case rather than the exception.
75005
75006         This patch therefore adds the maximum value to the sys_reg
75007         description and gets the range from there.  It also enforces
75008         the minimum of 0, which avoids a situation in which:
75009
75010           msr dit, #2
75011
75012         would give the expected:
75013
75014           Error: immediate value out of range 0 to 1
75015
75016         whereas:
75017
75018           msr dit, #-1
75019
75020         would give:
75021
75022           Error: immediate value out of range 0 to 15
75023
75024         (from the later UIMM4 checking).
75025
75026         Also:
75027
75028         - we were reporting the first error above against the wrong operand
75029         - TCO takes a single-bit immediate, but we previously allowed
75030           all 16 values.
75031           [https://developer.arm.com/documentation/ddi0596/2021-09/Base-Instructions/MSR--immediate---Move-immediate-value-to-Special-Register-?lang=en]
75032
75033         opcodes/
75034                 * aarch64-opc.h (F_REG_MAX_VALUE, F_GET_REG_MAX_VALUE): New macros.
75035                 * aarch64-opc.c (operand_general_constraint_met_p): Read the
75036                 maximum MSR immediate value from aarch64_pstatefields.
75037                 (aarch64_pstatefields): Add the maximum immediate value
75038                 for each register.
75039
75040         gas/
75041                 * testsuite/gas/aarch64/sysreg-4.s: Use an immediate value of 1
75042                 rather than 8 for the TCO test.
75043                 * testsuite/gas/aarch64/sysreg-4.d: Update accordingly.
75044                 * testsuite/gas/aarch64/armv8_2-a-illegal.l: Fix operand number
75045                 in MSR immediate error messages.
75046                 * testsuite/gas/aarch64/diagnostic.l: Likewise.
75047                 * testsuite/gas/aarch64/pan-illegal.l: Likewise.
75048                 * testsuite/gas/aarch64/ssbs-illegal1.l: Likewise.
75049                 * testsuite/gas/aarch64/illegal-sysreg-4b.s,
75050                 * testsuite/gas/aarch64/illegal-sysreg-4b.d,
75051                 * testsuite/gas/aarch64/illegal-sysreg-4b.l: New test.
75052
75053 2021-12-02  Marcus Nilsson  <brainbomb@gmail.com>
75054
75055         Allow the --visualize-jumps feature to work with the AVR disassembler.
75056                 * avr-dis.c (avr_operand); Pass in disassemble_info and fill
75057                 in insn_type on branching instructions.
75058
75059 2021-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
75060
75061         gdb, include: replace pragmas with DIAGNOSTIC macros, fix build with g++ 4.8
75062         When introducing this code, I forgot that we had some macros for this.
75063         Replace some "manual" pragma diagnostic with some DIAGNOSTIC_* macros,
75064         provided by include/diagnostics.h.
75065
75066         In diagnostics.h:
75067
75068          - Add DIAGNOSTIC_ERROR, to enable a diagnostic at error level.
75069          - Add DIAGNOSTIC_ERROR_SWITCH, to enable -Wswitch at error level, for
75070            both gcc and clang.
75071
75072         Additionally, using DIAGNOSTIC_PUSH, DIAGNOSTIC_ERROR_SWITCH and
75073         DIAGNOSTIC_POP seems to misbehave with g++ 4.8, where we see these
75074         errors:
75075
75076               CXX    ada-tasks.o
75077             /home/smarchi/src/binutils-gdb/gdb/ada-tasks.c: In function void read_known_tasks():
75078             /home/smarchi/src/binutils-gdb/gdb/ada-tasks.c:998:10: error: enumeration value ADA_TASKS_UNKNOWN not handled in switch [-Werror=switch]
75079                switch (data->known_tasks_kind)
75080                       ^
75081
75082         Because of the POP, the diagnostic should go back to being disabled,
75083         since it was disabled in the beginning, but that's not what we see
75084         here.  Versions of GCC >= 5 compile correctly.
75085
75086         Work around this by making DIAGNOSTIC_ERROR_SWITCH a no-op for GCC < 5.
75087
75088         Note that this code (already as it exists in master today) enables
75089         -Wswitch at the error level even if --disable-werror is passed.  It
75090         shouldn't be a problem, as it's not like a new enumerator will appear
75091         out of nowhere and cause a build error if building with future
75092         compilers.  Still, for correctness, we would ideally want to ask the
75093         compiler to enable -Wswitch at its default level (as if the user had
75094         passed -Wswitch on the command-line).  There doesn't seem to be a way to
75095         do this.
75096
75097         Change-Id: Id33ebec3de39bd449409ea0bab59831289ffe82d
75098
75099 2021-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
75100
75101         gas: re-generate configure
75102         When configuring gas, I get:
75103
75104           config.status: error: cannot find input file: `doc/Makefile.in'
75105
75106         This is because configure is out-of-date, re-generate it.
75107
75108         Change-Id: Iaa5980c282900d9fd23b90f0df25bf8ba3676498
75109
75110 2021-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
75111
75112         libctf: re-generate configure
75113         When configuring libctf, I get:
75114
75115           config.status: error: cannot find input file: `doc/Makefile.in'
75116
75117         This is because configure is out-of-date, re-generate it.
75118
75119         Change-Id: Ie69acd33012211a4620661582c7d24ad6d2cd169
75120
75121 2021-12-02  H.J. Lu  <hjl.tools@gmail.com>
75122
75123         x86: Skip __[start|stop]_SECNAME for --gc-sections -z start-stop-gc
75124         Don't convert memory load to immediate load on __start_SECNAME and
75125         __stop_SECNAME for --gc-sections -z start-stop-gc if all SECNAME
75126         sections been garbage collected.
75127
75128         bfd/
75129
75130                 PR ld/27491
75131                 * elf32-i386.c (elf_i386_convert_load_reloc): Skip __start_SECNAME
75132                 and __stop_SECNAME for --gc-sections -z start-stop-gc if the input
75133                 section been garbage collected.
75134                 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
75135                 * elfxx-x86.h (elf_x86_start_stop_gc_p): New function.
75136
75137         ld/
75138                 PR ld/27491
75139                 * testsuite/ld-i386/i386.exp: Run PR ld/27491 tests.
75140                 * testsuite/ld-x86-64/x86-64.exp: Likewise.
75141                 * testsuite/ld-i386/pr27491-1.s: New file.
75142                 * testsuite/ld-i386/pr27491-1a.d: Likewise.
75143                 * testsuite/ld-i386/pr27491-1b.d: Likewise.
75144                 * testsuite/ld-i386/pr27491-1c.d: Likewise.
75145                 * testsuite/ld-i386/pr27491-2.d: Likewise.
75146                 * testsuite/ld-i386/pr27491-2.s: Likewise.
75147                 * testsuite/ld-i386/pr27491-3.d: Likewise.
75148                 * testsuite/ld-i386/pr27491-3.s: Likewise.
75149                 * testsuite/ld-i386/pr27491-4.d: Likewise.
75150                 * testsuite/ld-i386/pr27491-4a.s: Likewise.
75151                 * testsuite/ld-i386/pr27491-4b.s: Likewise.
75152                 * testsuite/ld-x86-64/pr27491-1.s: Likewise.
75153                 * testsuite/ld-x86-64/pr27491-1a.d: Likewise.
75154                 * testsuite/ld-x86-64/pr27491-1b.d: Likewise.
75155                 * testsuite/ld-x86-64/pr27491-1c.d: Likewise.
75156                 * testsuite/ld-x86-64/pr27491-2.d: Likewise.
75157                 * testsuite/ld-x86-64/pr27491-2.s: Likewise.
75158                 * testsuite/ld-x86-64/pr27491-3.d: Likewise.
75159                 * testsuite/ld-x86-64/pr27491-3.s: Likewise.
75160                 * testsuite/ld-x86-64/pr27491-4.d: Likewise.
75161                 * testsuite/ld-x86-64/pr27491-4a.s: Likewise.
75162                 * testsuite/ld-x86-64/pr27491-4b.s: Likewise.
75163
75164 2021-12-02  Mike Frysinger  <vapier@gentoo.org>
75165
75166         bfd: delete unused proto settings
75167         These have been around for decades but don't appear to be used, and
75168         trying to build them (e.g. `make archive.p archive.ip`) doesn't work,
75169         so just delete it all.
75170
75171         gas: merge doc subdir up a level
75172         This avoids a recursive make into the doc subdir and speeds up the
75173         build slightly.  It also allows for more parallelism.
75174
75175         libctf: merge doc subdir up a level
75176         This avoids a recursive make into the doc subdir and speeds up the
75177         build slightly.  It also allows for more parallelism.
75178
75179 2021-12-02  Simon Marchi  <simon.marchi@polymtl.ca>
75180
75181         gdb: use actual DWARF version in compunit's debugformat field
75182         The "info source" command, with a DWARF-compile program, always show
75183         that the debug info is "DWARF 2":
75184
75185             (gdb) info source
75186             Current source file is test.c
75187             Compilation directory is /home/smarchi/build/binutils-gdb/gdb
75188             Located in /home/smarchi/build/binutils-gdb/gdb/test.c
75189             Contains 2 lines.
75190             Source language is c.
75191             Producer is GNU C17 9.3.0 -mtune=generic -march=x86-64 -g3 -gdwarf-5 -O0 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection.
75192             Compiled with DWARF 2 debugging format.
75193             Includes preprocessor macro info.
75194
75195         Change it to display the actual DWARF version:
75196
75197             (gdb) info source
75198             Current source file is test.c
75199             Compilation directory is /home/smarchi/build/binutils-gdb/gdb
75200             Located in /home/smarchi/build/binutils-gdb/gdb/test.c
75201             Contains 2 lines.
75202             Source language is c.
75203             Producer is GNU C17 9.3.0 -mtune=generic -march=x86-64 -g3 -gdwarf-5 -O0 -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -fcf-protection.
75204             Compiled with DWARF 5 debugging format.
75205             Includes preprocessor macro info.
75206
75207         The comp_unit_head::version field is guaranteed to be between 2 and 5,
75208         thanks to the check in read_comp_unit_head.  So we can still use static
75209         strings to pass to record_debugformat, and keep it efficient.
75210
75211         In the future, when somebody will update GDB to support DWARF 6, they'll
75212         hit this assert and have to update this code.
75213
75214         Change-Id: I3270b7ebf5e9a17b4215405bd2e365662a4d6172
75215
75216 2021-12-02  H.J. Lu  <hjl.tools@gmail.com>
75217
75218         elf: Discard input .note.gnu.build-id sections
75219         1. Discard input .note.gnu.build-id sections.
75220         2. Clear the build ID field before writing.
75221         3. Use bfd_make_section_anyway_with_flags to create the output
75222         .note.gnu.build-id section.
75223
75224                 PR ld/28639
75225                 * ldelf.c (ldelf_after_open): Discard input .note.gnu.build-id
75226                 sections, excluding the first one.
75227                 (write_build_id): Clear the build ID field before writing.
75228                 (ldelf_setup_build_id): Use bfd_make_section_anyway_with_flags
75229                 to create the output .note.gnu.build-id section.
75230                 * testsuite/ld-elf/build-id.exp: New file.
75231                 * testsuite/ld-elf/pr28639a.rd: Likewise.
75232                 * testsuite/ld-elf/pr28639b.rd: Likewise.
75233                 * testsuite/ld-elf/pr28639c.rd: Likewise.
75234                 * testsuite/ld-elf/pr28639d.rd: Likewise.
75235
75236 2021-12-02  GDB Administrator  <gdbadmin@sourceware.org>
75237
75238         Automatic date update in version.in
75239
75240 2021-12-01  Mike Frysinger  <vapier@gentoo.org>
75241
75242         binutils: add missing prefix for binutils/index.html rule
75243
75244 2021-12-01  Luca Boccassi  <luca.boccassi@gmail.com>
75245
75246         readelf: recognize FDO Packaging Metadata ELF note.  (Correcting snafu during patch application)
75247
75248 2021-12-01  Luca Boccassi  <luca.boccassi@gmail.com>
75249
75250         readelf: recognize FDO Packaging Metadata ELF note
75251         As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
75252         this note will be used starting from Fedora 36. Allow
75253         readelf --notes to pretty print it:
75254
75255         Displaying notes found in: .note.package
75256           Owner                Data size        Description
75257           FDO                  0x00000039       FDO_PACKAGING_METADATA
75258             Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}
75259
75260 2021-12-01  Tom de Vries  <tdevries@suse.de>
75261
75262         [gdb/testsuite] Fix typo in gdb.multi/multi-arch-exec.exp
75263         With gdb.multi/multi-arch-exec.exp I run into:
75264         ...
75265         Running src/gdb/testsuite/gdb.multi/multi-arch-exec.exp ...
75266         ERROR: tcl error sourcing src/gdb/testsuite/gdb.multi/multi-arch-exec.exp.
75267         ERROR: wrong # args: extra words after "else" clause in "if" command
75268             while executing
75269         "if [istarget "powerpc64*-*-*"] {
75270                 set march "-m64"
75271             } else if [istarget "s390*-*-*"] {
75272                 set march "-m31"
75273             } else {
75274                 set march "-m32"
75275             }"
75276         ...
75277
75278         Fix the else if -> elseif typo.
75279
75280         Tested on x86_64-linux.
75281
75282 2021-12-01  Tom de Vries  <tdevries@suse.de>
75283
75284         [gdb/testsuite] Fix gdb.arch/i386-pkru.exp on linux
75285         When running test-case gdb.arch/i386-pkru.exp on a machine with "Memory
75286         Protection Keys for Userspace" support, we run into:
75287         ...
75288         (gdb) PASS: gdb.arch/i386-pkru.exp: probe PKRU support
75289         print $pkru^M
75290         $2 = 1431655764^M
75291         (gdb) FAIL: gdb.arch/i386-pkru.exp: pkru register
75292         ...
75293
75294         The test-case expects the $pkru register to have the default value 0, matching
75295         the "init state" of 0 defined by the XSAVE hardware.
75296
75297         Since linux kernel version v4.9 containing commit acd547b29880 ("x86/pkeys:
75298         Default to a restrictive init PKRU"), the register is set to 0x55555554 by
75299         default (which matches the printed decimal value above).
75300
75301         Fix the FAIL by accepting this value for linux.
75302
75303         Tested on x86_64-linux.
75304
75305 2021-12-01  Nick Clifton  <nickc@redhat.com>
75306
75307         Fix the fields in the x_n union inside the the x_file structure so that pointers can be stored.
75308                 PR 28630
75309                 * coff/internal.h (x_n): Use bfd_hostptr_t for the fields in this
75310                 structure.
75311
75312 2021-12-01  Andrew Burgess  <aburgess@redhat.com>
75313
75314         gdb/remote: use scoped_restore to control starting_up flag
75315         This commit makes use of a scoped_restore object to control the
75316         remote_state::starting_up flag within the remote_target::start_remote
75317         method.
75318
75319         Ideally I would have liked to create the scoped_restore inside
75320         start_remote and just leave the restore in place until the end of the
75321         scope, however, I'm worried that doing this would change the behaviour
75322         of GDB.  Specifically, in start_remote, the following code is executed
75323         once the starting_up flag has been restored to its previous value:
75324
75325           if (breakpoints_should_be_inserted_now ())
75326             insert_breakpoints ();
75327
75328         I think (but am not 100% sure) that calling install_breakpoints could
75329         end up back inside remote_target::can_download_tracepoint, which does
75330         check the value of remote_state::starting_up.  And so, I'm concerned
75331         that leaving the scoped_restore in place until the end of start_remote
75332         will cause a possible change in behaviour.
75333
75334         To avoid this, and to leave things as close to the current behaviour
75335         as possible, I've split remote_target::start_remote into two, there's
75336         the main function body which moves into remote_target::start_remote_1,
75337         this function uses the scoped_restore to change the ::starting_up
75338         flag, then there's the old remote_target::start_remote, which now just
75339         calls ::start_remote_1, and then does the insert_breakpoints call.
75340
75341         There should be no user visible changes after this commit, unless
75342         there's a situation where the ::starting_up flag could previously have
75343         been left set, if this was the case, then this situation should no
75344         longer be possible.
75345
75346 2021-12-01  Simon Marchi  <simon.marchi@polymtl.ca>
75347
75348         gdb.base/corefile-buildid.exp: fix DUPLICATEs when failing to generate a core file
75349         When my system isn't properly configured to generate core files in the
75350         local directory, I see these DUPLICATEs:
75351
75352             DUPLICATE: gdb.base/corefile-buildid.exp: could not generate core file
75353
75354         Fix that by having a single with_test_prefix around that message and
75355         what follows.
75356
75357         Change-Id: I4ac245fcce1c666db56e3bad3582aa17f183dcba
75358
75359 2021-12-01  Mike Frysinger  <vapier@gentoo.org>
75360
75361         gold: enable silent build rules
75362
75363 2021-12-01  GDB Administrator  <gdbadmin@sourceware.org>
75364
75365         Automatic date update in version.in
75366
75367 2021-11-30  Carl Love  <cel@us.ibm.com>
75368
75369         gdb: Powerpc fix gdb.multi/multi-arch-exec.exp test
75370         The expect file has a procedure append_arch_options which sets march based
75371         the istarget.  The current if / else statement does not check for
75372         powerpc64.  The else statement is hit which sets march to -m32.  This
75373         results in compilation errors on 64-bit PowerPC.
75374
75375         This patch adds an if statement to check for powerpc64 and if true sets mach
75376         to -m64.
75377
75378         The patch was tested on a Power 10 system.  No compile errors were generated.
75379         The test completes with 1 expected pass and no failures.
75380
75381 2021-11-30  Mike Frysinger  <vapier@gentoo.org>
75382
75383         binutils: regenerate Makefile.in after doc/ changes
75384
75385 2021-11-30  Roland McGrath  <mcgrathr@google.com>
75386
75387         Fix missing build dependency for binutils man pages
75388         binutils/
75389                 * doc/local.mk: Give each man page target its missing dependency on
75390                 doc/$(am__dirstamp).
75391
75392 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75393
75394         aarch64: Add missing system registers [PR27145]
75395         This patch adds support for various system registers, up to Armv8.7-A.
75396         This includes all the registers that were mentioned in the PR and that
75397         hadn't become supported since.
75398
75399         opcodes/
75400                 PR aarch64/27145
75401                 * aarch64-opc.c (SR_V8_4): Remove duplicate definition.
75402                 (SR_V8_6, SR_V8_7, SR_GIC, SR_AMU): New macros.
75403                 (aarch64_sys_regs): Add missing entries (up to Armv8.7-A).
75404
75405         gas/
75406                 PR aarch64/27145
75407                 * testsuite/gas/aarch64/sysreg-8.s,
75408                 * testsuite/gas/aarch64/sysreg-8.d,
75409                 * testsuite/gas/aarch64/illegal-sysreg-8.s,
75410                 * testsuite/gas/aarch64/illegal-sysreg-8.d,
75411                 * testsuite/gas/aarch64/illegal-sysreg-8.l,
75412                 * testsuite/gas/aarch64/illegal-sysreg-8b.s,
75413                 * testsuite/gas/aarch64/illegal-sysreg-8b.d,
75414                 * testsuite/gas/aarch64/illegal-sysreg-8b.l: New tests.
75415                 * testsuite/gas/aarch64/sysreg.s: Change system register numbers
75416                 to ones that are still unallocated.
75417                 * testsuite/gas/aarch64/sysreg.d: Update accordingly.
75418
75419 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75420
75421         aarch64: Make LOR registers conditional on +lor
75422         We have a +lor feature flag for the Limited Ordering Regions
75423         extension, but the associated registers didn't use it.
75424
75425         opcodes/
75426                 * aarch64-opc.c (SR_LOR): New macro.
75427                 (aarch64_sys_regs): Use it for lorc_el1, lorea_el1, lorn_el1 and
75428                 lorsa_el1.
75429
75430         gas/
75431                 * testsuite/gas/aarch64/sysreg-7.s: Enable +lor.
75432                 * testsuite/gas/aarch64/illegal-sysreg-7.s: Test for LOR registers
75433                 without +lor.
75434                 * testsuite/gas/aarch64/illegal-sysreg-7.d: Update accordingly.
75435                 * testsuite/gas/aarch64/illegal-sysreg-7.l: Likewise.
75436
75437 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75438
75439         aarch64: Remove ZIDR_EL1
75440         ZIDR_EL1 was part of an early version of SVE, but didn't make
75441         it to the final release.
75442
75443         opcodes/
75444                 * aarch64-opc.c (aarch64_sys_regs): Remove zidr_el1 entry.
75445
75446         gas/
75447                 * testsuite/gas/aarch64/sve-sysreg.s: Remove zidr_el1.
75448                 * testsuite/gas/aarch64/sve-sysreg.d: Update accordingly.
75449                 * testsuite/gas/aarch64/sve-sysreg-invalid.l: Likewise.
75450
75451 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75452
75453         aarch64: Allow writes to MFAR_EL3
75454         MFAR_EL3 is a read/write register, but was incorrectly marked as
75455         read-only
75456         [https://developer.arm.com/documentation/ddi0601/2021-09/AArch64-Registers/MFAR-EL3--PA-Fault-Address-Register?lang=en]
75457
75458         opcodes/
75459                 * aarch64-opc.c (aarch64_sys_regs): Mark mfar_el3 as read-write.
75460
75461         gas/
75462                 * testsuite/gas/aarch64/rme.s: Test writing to mfar_el3.
75463                 * testsuite/gas/aarch64/rme.d: Update accordingly.
75464                 * testsuite/gas/aarch64/rme-invalid.s: Delete.
75465                 * testsuite/gas/aarch64/rme-invalid.l: Likewise.
75466                 * testsuite/gas/aarch64/rme-invalid.d: Likewise.
75467
75468 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75469
75470         aarch64: Mark PMSIDR_EL1 as read-only
75471         We were incorrectly allowing writes to PMSIDR_EL1, which is
75472         a read-only register.
75473         [https://developer.arm.com/documentation/ddi0595/2021-09/AArch64-Registers/PMSIDR-EL1--Sampling-Profiling-ID-Register?lang=en]
75474
75475         opcodes/
75476                 * aarch64-opc.c (aarch64_sys_regs): Make pmsidr_el1 as F_REG_READ.
75477
75478         gas/
75479                 * testsuite/gas/aarch64/msr.s: Remove write to pmsidr_el1.
75480                 * testsuite/gas/aarch64/msr.d: Update accordingly.
75481                 * testsuite/gas/aarch64/illegal-sysreg-2.s,
75482                 * testsuite/gas/aarch64/illegal-sysreg-2.d,
75483                 * testsuite/gas/aarch64/illegal-sysreg-2.l: New test.
75484
75485 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75486
75487         aarch64: Remove duplicate system register entries
75488         There is a lot of overlap between the ETM and ETE system registers,
75489         so some registers were listed twice.
75490
75491         Already tested by etm.[sd] and ete.[sd].
75492
75493         opcodes/
75494                 * aarch64-opc.c (aarch64_sys_regs): Combine ETE and ETM blocks
75495                 and remove redundant entries.
75496
75497         gas/
75498                 * testsuite/gas/aarch64/etm.s: Remove duplicated test.
75499                 * testsuite/gas/aarch64/etm.d: Update accordingly.
75500
75501 2021-11-30  Richard Sandiford  <richard.sandiford@arm.com>
75502
75503         aarch64: Check for register aliases before mnemonics
75504         Previously we would not accept:
75505
75506                 A .req B
75507
75508         if A happened to be the name of an instruction.  Adding new
75509         instructions could therefore invalidate existing register aliases.
75510
75511         I noticed this with a test that used "zero" as a register alias
75512         for "xzr", where "zero" is now also the name of an SME instruction.
75513         I don't have any evidence that "real" code is doing this, but it
75514         seems at least plausible.
75515
75516         This patch switches things so that we check for register aliases
75517         first.  It might slow down parsing slightly, but the difference
75518         is unlikely to be noticeable.
75519
75520         Things like:
75521
75522                 b       .req + 0
75523
75524         still work, since create_register_alias checks for " .req ",
75525         and with the input scrubber, we'll only keep whitespace after
75526         .req if it's followed by another name.  If there's some valid
75527         expression that I haven't thought about that is scrubbed to
75528         " .req ", users could avoid the ambiguity by wrapping .req
75529         in parentheses.
75530
75531         The new test for invalid aliases already passed.  I just wanted
75532         something to exercise the !dot condition.
75533
75534         I can't find a way of exercising the (existing) p == base condition,
75535         but I'm not brave enough to say that it can never happen.  If it does
75536         happen, get_mnemonic_name would return an empty string.
75537
75538         gas/
75539                 * config/tc-aarch64.c (opcode_lookup): Move mnemonic extraction
75540                 code to...
75541                 (md_assemble): ...here.  Check for register aliases first.
75542                 * testsuite/gas/aarch64/register_aliases.d,
75543                 testsuite/gas/aarch64/register_aliases.s: Test for a register
75544                 alias called "zero".
75545                 * testsuite/gas/aarch64/register_aliases_invalid.d,
75546                 testsuite/gas/aarch64/register_aliases_invalid.l,
75547                 testsuite/gas/aarch64/register_aliases_invalid.s: New test.
75548
75549 2021-11-30  Andrew Burgess  <aburgess@redhat.com>
75550
75551         gdb/python: don't use the 'p' format for parsing args
75552         When running the gdb.python/py-arch.exp tests on a GDB built
75553         against Python 2 I ran into some errors.  The problem is that this
75554         test script exercises the gdb.Architecture.integer_type method, and
75555         this method uses 'p' as an argument format specifier in a call to
75556         gdb_PyArg_ParseTupleAndKeywords.
75557
75558         Unfortunately this specified was only added in Python 3.3, so will
75559         cause an error for earlier versions of Python.
75560
75561         This commit switches to use the 'O' specifier to collect a PyObject,
75562         and then uses PyObject_IsTrue to convert the object to a boolean.
75563
75564         An earlier version of this patch incorrectly switched from using 'p'
75565         to use 'i', however, it was pointed out during review that this would
75566         cause some changes in behaviour, for example both of these will work
75567         with 'p', but not with 'i':
75568
75569           gdb.selected_inferior().architecture().integer_type(32, None)
75570           gdb.selected_inferior().architecture().integer_type(32, "foo")
75571
75572         The new approach of using 'O' works fine with these cases.  I've added
75573         some new tests to cover both of the above.
75574
75575         There should be no user visible changes after this commit.
75576
75577 2021-11-30  Tom de Vries  <tdevries@sdflex.arch.suse.de>
75578
75579         [gdb/testsuite] Fix gdb.base/style.exp with stub-termcap
75580         When running test-case gdb.base/style.exp with a gdb build using
75581         stub-termcap.c, we run into:
75582         ...
75583         (gdb) PASS: gdb.base/style.exp: all styles enabled: frame when width=20
75584         ^M<et width 30^M
75585         (gdb) FAIL: gdb.base/style.exp: all styles enabled: set width 30
75586         ...
75587
75588         The problem is that we're trying to issue the command "set width 30" while
75589         width is set to 20, which causes horizontal scrolling.
75590
75591         Fix this by resetting the width to 0 before issuing the "set width 30"
75592         command.
75593
75594         Tested on x86_64-linux.
75595
75596         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24582
75597
75598 2021-11-30  Nick Clifton  <nickc@redhat.com>
75599
75600         Use dwarf_vma type for offsets, ranges and section sizes in DWARF decoder.
75601                 * dwarf.c (find_debug_info_for_offset): Use dwarf_vma type for
75602                 offsets, sizes and ranges.
75603                 (display_loc_list): Likewise.  Also use print_dwarf_vma to print
75604                 the offset.
75605                 (display_loclists_list): Likewise.
75606                 (display_loc_list_dwo): Likewise.
75607                 (display_debug_str): Likewise.
75608                 (display_debug_aranges): Likewise.
75609                 (display_debug_ranges_list): Likewise.
75610                 (display_debug_rnglists_list): Likewise.
75611                 (display_debug_ranges): Likewise.
75612
75613         ld: pru: Add pru_irq_map output section
75614                 * scripttempl/pru.sc (.pru_irq_map): Define output section.
75615                 * testsuite/ld-pru/pru_irq_map-1.d: New test.
75616                 * testsuite/ld-pru/pru_irq_map-2.d: New test.
75617                 * testsuite/ld-pru/pru_irq_map.s: New test.
75618
75619 2021-11-30  Andrew Burgess  <aburgess@redhat.com>
75620
75621         gdb/testsuite: check the python module is available before using it
75622         The gdb.python/py-inferior-leak.exp test makes use of the tracemalloc
75623         module.  When running the Python tests with a GDB built against Python
75624         2 I ran into a test failure due to the tracemalloc module not being
75625         available.
75626
75627         This commit adds a new helper function to lib/gdb-python.exp that
75628         checks if a named module is available.  Using this we can then skip
75629         the py-inferior-leak.exp test when the tracemalloc module is not
75630         available.
75631
75632 2021-11-30  Andrew Burgess  <aburgess@redhat.com>
75633
75634         gdb: fix disassembler regressions for 32-bit arm
75635         After this commit:
75636
75637           commit 76b43c9b5c2b275cbf4f927bfc25984410cb5dd5
75638           Date:   Tue Oct 5 15:10:12 2021 +0100
75639
75640               gdb: improve error reporting from the disassembler
75641
75642         We started seeing FAILs in the gdb.base/all-architectures*.exp tests,
75643         when running on a 32-bit ARM target, though I suspect running on any
75644         target that compiles such that bfd_vma is 32-bits would also trigger
75645         the failures.
75646
75647         The problem is that the test is expected GDB's disassembler to print
75648         an error like this:
75649
75650           Cannot access memory at address 0x0
75651
75652         However, after the above commit we see an error like:
75653
75654           unknown disassembler error (error = -1)
75655
75656         The reason for this is this code in opcodes/i386-dis.c (in the
75657         print_insn function):
75658
75659           if (address_mode == mode_64bit && sizeof (bfd_vma) < 8)
75660             {
75661               (*info->fprintf_func) (info->stream,
75662                                      _("64-bit address is disabled"));
75663               return -1;
75664             }
75665
75666         This code effectively disallows us from ever disassembling 64-bit x86
75667         code if we compiled GDB with a 32-bit bfd_vma.  Notice we return
75668         -1 (indicating a failure to disassemble), but never call the
75669         memory_error_func callback.
75670
75671         Prior to the above commit GDB, when it received the -1 return value
75672         would assume that a memory error had occurred and just print whatever
75673         value happened to be in the memory error address variable, the default
75674         value of 0 just happened to be fine because the test had asked GDB to
75675         do this 'disassemble 0x0,+4'.
75676
75677         If we instead change the test to do 'disassemble 0x100,+4' then GDB
75678         would (previously) have still reported:
75679
75680           Cannot access memory at address 0x0
75681
75682         which makes far less sense.
75683
75684         In this commit I propose to fix this issue by changing the test to
75685         accept either the "Cannot access memory ..." string, or the newer
75686         "unknown disassembler error ..." string.  With this change done the
75687         test now passes.
75688
75689         However, there is one weakness with this strategy; if GDB broke such
75690         that we _always_ reported "unknown disassembler error ..." we would
75691         never notice.  This clearly would be bad.  To avoid this issue I have
75692         adjusted the all-architectures*.exp tests so that, when we disassemble
75693         for the default architecture (the one selected by "auto") we _only_
75694         expect to get the "Cannot access memory ..." error string.
75695
75696         [ Note: In an ideal world we should be able to disassemble any
75697           architecture at all times.  There's no reason why the 64-bit x86
75698           disassembler requires a 64-bit bfd_vma, other than the code happens
75699           to be written that way.  We could rewrite the disassemble to not
75700           have this requirement, but, I don't plan to do that any time soon. ]
75701
75702         Further, I have changed the all-architectures*.exp test so that we now
75703         disassemble at address 0x100, this should avoid us being able to pass
75704         by printing a default address of 0x0.  I did originally change the
75705         address we disassembled at to 0x4, however, some architectures,
75706         e.g. ia64, have a default instruction alignment that is greater than
75707         4, so would still round down to 0x0.  I could have just picked 0x8 as
75708         an address, but I figured that 0x100 was likely to satisfy most
75709         architectures alignment requirements.
75710
75711 2021-11-30  Andrew Burgess  <aburgess@redhat.com>
75712
75713         gdb/python: add gdb.RemoteTargetConnection.send_packet
75714         This commits adds a new sub-class of gdb.TargetConnection,
75715         gdb.RemoteTargetConnection.  This sub-class is created for all
75716         'remote' and 'extended-remote' targets.
75717
75718         This new sub-class has one additional method over its base class,
75719         'send_packet'.  This new method is equivalent to the 'maint
75720         packet' CLI command, it allows a custom packet to be sent to a remote
75721         target.
75722
75723         The outgoing packet can either be a bytes object, or a Unicode string,
75724         so long as the Unicode string contains only ASCII characters.
75725
75726         The result of calling RemoteTargetConnection.send_packet is a bytes
75727         object containing the reply that came from the remote.
75728
75729 2021-11-30  Andrew Burgess  <aburgess@redhat.com>
75730
75731         gdb: make packet_command function available outside remote.c
75732         In a later commit I will add a Python API to access the 'maint packet'
75733         functionality, that is, sending a user specified packet to the target.
75734
75735         To make implementing this easier, this commit refactors how this
75736         command is currently implemented so that the packet_command function
75737         is now global.
75738
75739         The new global send_remote_packet function takes an object that is an
75740         implementation of an abstract interface.  Two functions within this
75741         interface are then called, one just before a packet is sent to the
75742         remote target, and one when the reply has been received from the
75743         remote target.  Using an interface object in this way allows (1) for
75744         the error checking to be done before the first callback is made, this
75745         means we only print out what packet it being sent once we know we are
75746         going to actually send it, and (2) we don't need to make a copy of the
75747         reply if all we want to do is print it.
75748
75749         One user visible changes after this commit are the error
75750         messages, which I've changed to be less 'maint packet' command
75751         focused, this will make them (I hope) better for when
75752         send_remote_packet can be called from Python code.
75753
75754         So:      "command can only be used with remote target"
75755         Becomes: "packets can only be sent to a remote target"
75756
75757         And:     "remote-packet command requires packet text as argument"
75758         Becomes: "a remote packet must not be empty"
75759
75760         Additionally, in this commit, I've added support for packet replies
75761         that contain binary data.  Before this commit, the code that printed
75762         the reply treated the reply as a C string, it assumed that the string
75763         only contained printable characters, and had a null character only at
75764         the end.
75765
75766         One way to show the problem with this is if we try to read the auxv
75767         data from a remote target, the auxv data is binary, so, before this
75768         commit:
75769
75770           (gdb) target remote :54321
75771           ...
75772           (gdb) maint packet qXfer:auxv:read::0,1000
75773           sending: "qXfer:auxv:read::0,1000"
75774           received: "l!"
75775           (gdb)
75776
75777         And after this commit:
75778
75779           (gdb) target remote :54321
75780           ...
75781           (gdb) maint packet qXfer:auxv:read::0,1000
75782           sending: "qXfer:auxv:read::0,1000"
75783           received: "l!\x00\x00\x00\x00\x00\x00\x00\x00\xf0\xfc\xf7\xff\x7f\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xff\xf>
75784           (gdb)
75785
75786         The binary contents of the reply are now printed as escaped hex.
75787
75788 2021-11-30  Andrew Burgess  <aburgess@redhat.com>
75789
75790         gdb/python: introduce gdb.TargetConnection object type
75791         This commit adds a new object type gdb.TargetConnection.  This new
75792         type represents a connection within GDB (a connection as displayed by
75793         'info connections').
75794
75795         There's three ways to find a gdb.TargetConnection, there's a new
75796         'gdb.connections()' function, which returns a list of all currently
75797         active connections.
75798
75799         Or you can read the new 'connection' property on the gdb.Inferior
75800         object type, this contains the connection for that inferior (or None
75801         if the inferior has no connection, for example, it is exited).
75802
75803         Finally, there's a new gdb.events.connection_removed event registry,
75804         this emits a new gdb.ConnectionEvent whenever a connection is removed
75805         from GDB (this can happen when all inferiors using a connection exit,
75806         though this is not always the case, depending on the connection type).
75807         The gdb.ConnectionEvent has a 'connection' property, which is the
75808         gdb.TargetConnection being removed from GDB.
75809
75810         The gdb.TargetConnection has an 'is_valid()' method.  A connection
75811         object becomes invalid when the underlying connection is removed from
75812         GDB (as discussed above, this might be when all inferiors using a
75813         connection exit, or it might be when the user explicitly replaces a
75814         connection in GDB by issuing another 'target' command).
75815
75816         The gdb.TargetConnection has the following read-only properties:
75817
75818           'num': The number for this connection,
75819
75820           'type': e.g. 'native', 'remote', 'sim', etc
75821
75822           'description': The longer description as seen in the 'info
75823                          connections' command output.
75824
75825           'details': A string or None.  Extra details for the connection, for
75826                      example, a remote connection's details might be
75827                      'hostname:port'.
75828
75829 2021-11-30  Nelson Chu  <nelson.chu@sifive.com>
75830
75831         RISC-V: The vtype immediate with more than the defined 8 bits are preserved.
75832         According the rvv spec,
75833         https://github.com/riscv/riscv-v-spec/blob/master/vtype-format.adoc
75834
75835         The bits of vtype immediate from 8 to (xlen - 1) should be reserved.
75836         Therefore, we should also dump the vtype immediate as numbers, when
75837         they are set over 8-bits.  I think this is a bug that we used to support
75838         vediv extension and use the bit 8 and 9 of vtype, but forgot to update
75839         the behavior when removing the vediv.
75840
75841         Consider the testcases,
75842
75843         vsetvli  a0, a1,  0x700    # the reserved bit 10, 9 and 8 are used.
75844         vsetvli  a0, a1,  0x400    # the reserved bit 10 is used.
75845         vsetvli  a0, a1,  0x300    # the reserved bit 9 and 8 are used.
75846         vsetvli  a0, a1,  0x100    # the reserved bit 8 is used.
75847         vsetivli a0, 0xb, 0x300    # the reserved bit 9 and 8 are used.
75848         vsetivli a0, 0xb, 0x100    # the reserved bit 8 is used.
75849
75850         The original objdump shows the following result,
75851
75852         0000000000000000 <.text>:
75853            0:   7005f557                vsetvli a0,a1,1792
75854            4:   4005f557                vsetvli a0,a1,1024
75855            8:   3005f557                vsetvli a0,a1,e8,m1,tu,mu
75856            c:   1005f557                vsetvli a0,a1,e8,m1,tu,mu
75857           10:   f005f557                vsetivli        a0,11,e8,m1,tu,mu
75858           14:   d005f557                vsetivli        a0,11,e8,m1,tu,mu
75859
75860         But in fact the correct result should be,
75861
75862         0000000000000000 <.text>:
75863            0:   7005f557                vsetvli a0,a1,1792
75864            4:   4005f557                vsetvli a0,a1,1024
75865            8:   3005f557                vsetvli a0,a1,768
75866            c:   1005f557                vsetvli a0,a1,256
75867           10:   f005f557                vsetivli        a0,11,768
75868           14:   d005f557                vsetivli        a0,11,256
75869
75870         gas/
75871                 * testsuite/gas/riscv/vector-insns.d: Added testcases to
75872                 test the reserved bit 8 to (xlen-1) of vtype.
75873                 * testsuite/gas/riscv/vector-insns.s: Likewise.
75874         include/
75875                 * opcode/riscv.h: Removed OP_MASK_VTYPE_RES and OP_SH_VTYPE_RES,
75876                 since they are different for operand Vc and Vb.
75877         opcodes/
75878                 * riscv-dis.c (print_insn_args): Updated imm_vtype_res to
75879                 extract the reserved immediate of vtype correctly.
75880
75881 2021-11-30  Nelson Chu  <nelson.chu@sifive.com>
75882
75883         RISC-V: Dump vset[i]vli immediate as numbers once vsew or vlmul is reserved.
75884         Consider the following case,
75885
75886         vsetvli  a0, a1,  0x4           # unrecognized vlmul
75887         vsetvli  a0, a1,  0x20          # unrecognized vsew
75888         vsetivli a0, 0xb, 0x4           # unrecognized vlmul
75889         vsetivli a0, 0xb, 0x20          # unrecognized vsew
75890
75891         For the current dis-assembler, we get the result,
75892
75893         0000000000000000 <.text>:
75894            0:   0045f557                vsetvli a0,a1,e8,(null),tu,mu
75895            4:   0205f557                vsetvli a0,a1,e128,m1,tu,mu
75896            8:   c045f557                vsetivli        a0,11,e8,(null),tu,mu
75897            c:   c205f557                vsetivli        a0,11,e128,m1,tu,mu
75898
75899         The vsew e128 and vlmul (null) are preserved according to the spec,
75900         so dump these fields looks wrong.  Consider that we are used to dump
75901         the unrecognized csr as csr numbers directly, we should also dump
75902         the whole vset[i]vli immediates as numbers, once the vsew or vlmul
75903         is reserved.  Therefore, following is what I expected,
75904
75905         0000000000000000 <.text>:
75906            0:   0045f557                vsetvli a0,a1,4
75907            4:   0205f557                vsetvli a0,a1,32
75908            8:   c045f557                vsetivli        a0,11,4
75909            c:   c205f557                vsetivli        a0,11,32
75910
75911         gas/
75912                 * testsuite/gas/riscv/vector-insns.d: Rewrite the vset[i]vli
75913                 testcases since we should dump the immediate as numbers once
75914                 the vsew or vlmul is reserved.
75915                 * testsuite/gas/riscv/vector-insns.s: Likewise.
75916         opcodes/
75917                 * riscv-dis.c (print_insn_args): The reserved vsew and vlmul
75918                 are NULL string in the riscv_vsew and riscv_vlmul, so dump the
75919                 whole imm as numbers once one of them is NULL.
75920                 * riscv-opc.c (riscv_vsew): Set the reserved vsew to NULL.
75921                 (riscv_vlmul): Set the reserved vlmul to NULL.
75922
75923 2021-11-30  Mike Frysinger  <vapier@gentoo.org>
75924
75925         zlib: enable silent build rules
75926
75927         ld: enable silent build rules
75928         Also add $(AM_V_xxx) to various manual rules in here.
75929
75930         libctf: enable silent build rules
75931         Also add $(AM_V_xxx) to various manual rules in here.
75932
75933         gprof: enable silent build rules
75934         Also add $(AM_V_xxx) to various manual rules in here.
75935
75936         binutils: merge doc subdir up a level
75937         This avoids a recursive make into the doc subdir and speeds up the
75938         build slightly.  It also allows for more parallelism.
75939
75940         binutils: enable silent build rules
75941         Also add $(AM_V_xxx) to various manual rules in here.
75942
75943         bfd: enable silent build rules
75944         Also add $(AM_V_xxx) to various manual rules in here.
75945
75946         opcodes: enable silent build rules
75947         Also add $(AM_V_xxx) to various manual rules in here.
75948
75949 2021-11-30  GDB Administrator  <gdbadmin@sourceware.org>
75950
75951         Automatic date update in version.in
75952
75953 2021-11-29  Tom Tromey  <tom@tromey.com>
75954
75955         Allow DW_ATE_UTF for Rust characters
75956         The Rust compiler plans to change the encoding of a Rust 'char' type
75957         to use DW_ATE_UTF.  You can see the discussion here:
75958
75959             https://github.com/rust-lang/rust/pull/89887
75960
75961         However, this fails in gdb.  I looked into this, and it turns out that
75962         the handling of DW_ATE_UTF is currently fairly specific to C++.  In
75963         particular, the code here assumes the C++ type names, and it creates
75964         an integer type.
75965
75966         This comes from commit 53e710acd ("GDB thinks char16_t and char32_t
75967         are signed in C++").  The message says:
75968
75969             Both places need fixing.  But since I couldn't tell why dwarf2read.c
75970             needs to create a new type, I've made it use the per-arch built-in
75971             types instead, so that the types are only created once per arch
75972             instead of once per objfile.  That seems to work fine.
75973
75974         ... which is fine, but it seems to me that it's also correct to make a
75975         new character type; and this approach is better because it preserves
75976         the type name as well.  This does use more memory, but first we
75977         shouldn't be too concerned about the memory use of types coming from
75978         debuginfo; and second, if we are, we should implement type interning
75979         anyway.
75980
75981         Changing this code to use a character type revealed a couple of
75982         oddities in the C/C++ handling of TYPE_CODE_CHAR.  This patch fixes
75983         these as well.
75984
75985         I filed PR rust/28637 for this issue, so that this patch can be
75986         backported to the gdb 11 branch.
75987
75988 2021-11-29  Aaron Merey  <amerey@redhat.com>
75989             Tom de Vries  <tdevries@suse.de>
75990
75991         [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
75992         During debuginfod downloads, ctrl-c should result in the download
75993         being cancelled and skipped.  However in some cases, ctrl-c fails to
75994         get delivered to gdb during downloading.  This can result in downloads
75995         being unskippable.
75996
75997         Fix this by ensuring that target_terminal::ours is in effect for the
75998         duration of each download.
75999
76000         https://sourceware.org/bugzilla/show_bug.cgi?id=27026#c3
76001
76002 2021-11-29  Nick Clifton  <nickc@redhat.com>
76003
76004         strings: Replace references to -u option with references to -U.
76005                 PR 28632
76006
76007 2021-11-29  Tom de Vries  <tdevries@suse.de>
76008
76009         [gdb/symtab] Fix segfault in search_one_symtab
76010         PR28539 describes a segfault in lambda function search_one_symtab due to
76011         psymbol_functions::expand_symtabs_matching calling expansion_notify with a
76012         nullptr symtab:
76013         ...
76014                   struct compunit_symtab *symtab =
76015                     psymtab_to_symtab (objfile, ps);
76016
76017                   if (expansion_notify != NULL)
76018                     if (!expansion_notify (symtab))
76019                       return false;
76020         ...
76021
76022         This happens as follows.  The partial symtab ps is a dwarf2_include_psymtab
76023         for some header file:
76024         ...
76025         (gdb) p ps.filename
76026         $5 = 0x64fcf80 "/usr/include/c++/11/bits/stl_construct.h"
76027         ...
76028
76029         The includer of ps is a shared symtab for a partial unit, with as user:
76030         ...
76031         (gdb) p ps.includer().user.filename
76032         $11 = 0x64fc9f0 \
76033           "/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp"
76034         ...
76035
76036         The call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently
76037         the shared symtab), but returns nullptr because:
76038         ...
76039         struct dwarf2_include_psymtab : public partial_symtab
76040         {
76041           ...
76042           compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override
76043           {
76044             return nullptr;
76045           }
76046         ...
76047
76048         Fix this by returning the Decl.cpp symtab instead, which fixes the segfault
76049         in the PR.
76050
76051         Tested on x86_64-linux.
76052
76053         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28539
76054
76055 2021-11-29  Nick Clifton  <nickc@redhat.com>
76056
76057         Update description of string's -n option.
76058                 PR 28632
76059                 * strings.c (usage): Update desciption of -n option.
76060                 * doc/binutils.texi: Likewise.
76061
76062 2021-11-29  Tom de Vries  <tdevries@suse.de>
76063
76064         [gdb/testsuite] Fix typo in proc lines
76065         Proc lines contains a typo:
76066         ...
76067           string_form { set $_line_string_form $value }
76068         ...
76069
76070         Remove the incorrect '$' in '$_line_string_form'.
76071
76072         Tested on x86_64-linux.
76073
76074 2021-11-29  Tom de Vries  <tdevries@suse.de>
76075
76076         [gdb/testsuite] Use unique files in gdb.dwarf2/dw2-lines.exp
76077         While debugging a problem in gdb.dwarf2/dw2-lines.exp, I realized that the
76078         test-case generates all executables and associated temporary files using the
76079         same filenames.
76080
76081         Fix this by adding a new proc prefix_id in lib/gdb.exp, and using it in the
76082         test-case.
76083
76084         Tested on x86_64-linux.
76085
76086 2021-11-29  Tom de Vries  <tdevries@suse.de>
76087
76088         [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp with -m32
76089         When running test-case gdb.dwarf2/dw2-lines.exp with target board -unix/-m32,
76090         we run into another instance of PR28383, where the dwarf assembler generates
76091         64-bit relocations which are not supported by the 32-bit assembler:
76092         ...
76093         dw2-lines-dw.S: Assembler messages:^M
76094         outputs/gdb.dwarf2/dw2-lines/dw2-lines-dw.S:76: Error: \
76095           cannot represent relocation type BFD_RELOC_64^M
76096         ...
76097
76098         Fix this by using _op_offset in _line_finalize_header.
76099
76100         Tested on x86_64-linux.
76101
76102 2021-11-29  Mike Frysinger  <vapier@gentoo.org>
76103
76104         sim: testsuite: drop most specific istarget checks
76105         We'll rely on the toolchain probing to determine whether each arch's
76106         tests can be run rather the current configure target.  This allows
76107         testing all of the ports in a multitarget configuration.
76108
76109         For now, we don't reformat the files entirely to make it easier to
76110         review, and in case we need to make adjustments.  Once this feels
76111         like it's stable, we can flatten the code a bit by removing the if
76112         statement entirely.
76113
76114 2021-11-29  Mike Frysinger  <vapier@gentoo.org>
76115
76116         sim: testsuite: support parallel execution
76117         Break up the dejagnu logic so that we can parallelize the testsuite.
76118         This takes a page from gcc & gdb where each .exp is run in isolation
76119         instead of in serial.
76120
76121         For most targets, this doesn't make much of a difference as they only
76122         have a single .exp.  A few (like cris & frv) have multiple .exp though
76123         and will see a bit of a speed up.
76124
76125         The real gain is when testing a multitarget build.  This way we can
76126         run all the targets in parallel and cut the execution time a bit.
76127         On my system, it goes from ~155sec to ~100sec.
76128
76129         We can gain further speedups by splitting up some of the larger .exp
76130         files into smaller groups.  We'll do that in a followup though.
76131
76132 2021-11-29  Mike Frysinger  <vapier@gentoo.org>
76133
76134         sim: testsuite: expand arch specific toolchain settings
76135         Leverage the new per-port toolchain settings to initialize the env
76136         for eeach set of tests.  This allows us to run all the tests in a
76137         multitarget build if the user sets up the vars.  If they don't, we
76138         can still skip all the tests.
76139
76140 2021-11-29  Mike Frysinger  <vapier@gentoo.org>
76141
76142         sim: testsuite: setup per-port toolchain settings for multitarget build
76143         Gas does not support multitarget builds -- it still only supports
76144         a single input & output format.  ld is a bit better, but requires
76145         manual flags to select the right output.  This makes it impossible
76146         to run the complete testsuite in a multitarget build.
76147
76148         To address this limitation, create a suite of FOR_TARGET variables
76149         so these can be set to precompiled as & ld programs.  It requires
76150         a bit of setup ahead of time, but it's a one-time cost, and makes
76151         running the full testsuite at once much easier.
76152
76153 2021-11-29  GDB Administrator  <gdbadmin@sourceware.org>
76154
76155         Automatic date update in version.in
76156
76157 2021-11-28  Alan Modra  <amodra@gmail.com>
76158
76159         PR28629 NIOS2 fallout
76160         The test exactly matched wrong output.
76161
76162                 PR 28629
76163                 * testsuite/gas/nios2/relax.d: Update expected output.
76164
76165 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76166
76167         sim: add checks to core headers to prevent incorrect common building
76168         Some of the core sim headers rely on the SIM_AC_OPTION_BITSIZE macro
76169         which can change the size of core types.  Since these haven't been
76170         unified across ports, add checks to make sure they aren't accidentally
76171         included when building for all ports.  This caught the sim-load file
76172         using poisoned headers that it didn't actually need.
76173
76174         sim: unify syscall.o building
76175         Now that we've unified all the syscall tables, this file does not rely
76176         on any port-specific settings, so move it up to building as part of the
76177         common step so we only do it once in a multibuild.
76178
76179         sim: drop unused gentmap & nltvals.def logic
76180         Now that all ports have switched to target-newlib-* files, there's
76181         no need for these files & generating things at build time.  So punt
76182         the logic and make target-newlib-syscall a hard requirement.
76183
76184         sim: mcore: switch to new target-newlib-syscall
76185         Use the new target-newlib-syscall module.  This is needed to merge all
76186         the architectures into a single build, and mcore has a custom syscall
76187         table for its newlib/libgloss port.
76188
76189         sim: riscv: switch to new target-newlib-syscall
76190         Use the new target-newlib-syscall module.  This is needed to merge all
76191         the architectures into a single build, and riscv has a custom syscall
76192         table for its newlib/libgloss port.
76193
76194 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76195
76196         sim: cr16: switch to new target-newlib-syscall
76197         Use the new target-newlib-syscall module.  This is needed to merge all
76198         the architectures into a single build, and cr16 has a custom syscall
76199         table for its newlib/libgloss port.
76200
76201         This allows cleaning up the syscall ifdef logic.  We know these will
76202         always exist now.
76203
76204 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76205
76206         sim: d10v: switch to new target-newlib-syscall
76207         Use the new target-newlib-syscall module.  This is needed to merge all
76208         the architectures into a single build, and d10v has a custom syscall
76209         table for its newlib/libgloss port.
76210
76211         This allows cleaning up the syscall ifdef logic.  We know these will
76212         always exist now.
76213
76214 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76215
76216         sim: sh: switch to new target-newlib-syscall
76217         Use the new target-newlib-syscall module.  This is needed to merge all
76218         the architectures into a single build, and sh has a custom syscall
76219         table for its newlib/libgloss port.
76220
76221 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76222
76223         sim: v850: switch to new target-newlib-syscall
76224         Use the new target-newlib-syscall module.  This is needed to merge all
76225         the architectures into a single build, and v850 has a custom syscall
76226         table for its newlib/libgloss port.
76227
76228         This allows cleaning up the syscall ifdef logic.  We know these will
76229         always exist now.
76230
76231 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76232
76233         sim: iq2000/lm32/m32c/moxie/rx: switch to new target-newlib-syscall.h
76234         Use the new target-newlib-syscall.h to provide the target syscall
76235         defines.  These code paths are written specifically for the newlib
76236         ABI rather than being generalized, so switching them to the defines
76237         rather than trying to go through the dynamic callback conversion
76238         seems like the best trade-off for now.  Might have to reconsider
76239         this in the future.
76240
76241 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76242
76243         sim: nltvals: pull target syscalls out into a dedicated source file
76244         Like we just did for pulling out the errno map, pull out the syscall
76245         maps into a dedicated common file.  Most newlib ports are using the
76246         same syscall map, but not all, which means we have to do a bit more
76247         work to migrate.
76248
76249         This commit adds the maps and switches the ports using the common
76250         default syscall table over to it.  Ports using unique syscall tables
76251         are still using the old targ-map.c logic.
76252
76253         Switching common ports over is easy by checking NL_TARGET, but the
76254         ppc code needs a bit more cleanup here hence its larger diff.
76255
76256 2021-11-28  Mike Frysinger  <vapier@gentoo.org>
76257
76258         sim: frv: resolve syscalls dynamically
76259         Avoid use of TARGET_<syscall> defines and rely on the callback layers
76260         to resolve these dynamically so we can support multiple syscall layers
76261         instead of assuming the newlib/libgloss numbers all the time.
76262
76263         sim: mn10300: resolve syscalls dynamically
76264         Avoid use of TARGET_<syscall> defines and rely on the callback layers
76265         to resolve these dynamically so we can support multiple syscall layers
76266         instead of assuming the newlib/libgloss numbers all the time.
76267
76268         sim: nltvals: drop i960
76269         This port was dropped from gdb/bfd/sim years ago, so stop including
76270         its syscall constants too.
76271
76272         sim: moxie: fix datadir handling
76273         Expand the value at `make` time rather than configure generation time
76274         so that we handle $(datarootdir) setting properly.
76275
76276 2021-11-28  GDB Administrator  <gdbadmin@sourceware.org>
76277
76278         Automatic date update in version.in
76279
76280 2021-11-27  Simon Marchi  <simon.marchi@polymtl.ca>
76281
76282         gdb: fix typos in configure
76283         The variable names used to restore CFLAGS and LDFLAGS here don't quite
76284         match the names used above, resulting in losing the original CFLAGS and
76285         LDFLAGS.  Fix that.
76286
76287         Change-Id: I9cc2c3b48b1dc30c31a7143563c893fd6f426a0a
76288
76289 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76290
76291         sim: hw: mark hw_descriptors const
76292
76293         sim: testsuite: add dedicated flag for init toolchain tests
76294         As we setup more reliable CC_FOR_TARGET variables for each target, the
76295         bfin way of overriding it to stuff custom CFLAGS doesn't scale well.
76296         Add a dedicated CFLAGS_FOR_TARGET_init setting that each set of tests
76297         can setup if they want to add custom options.
76298
76299         sim: testsuite: clean up arch specific toolchain settings
76300         In a multitarget build, we process all targets in order, so make sure
76301         the toolchain settings from one don't leak into the next.
76302
76303 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76304
76305         sim: cris: always search for local rvdummy tool
76306         If the board info sets the sim to a basename that is found via $PATH
76307         (which is the default dejagnu behavior), the logic here to use its
76308         dirname to find rvdummy fails because it looks for `./rvdummy`.  So
76309         switch it to always use the local build of rvdummy which is the one
76310         we want to be testing against in the first place.
76311
76312         If we get a request for testing against a different setup, we can
76313         figure out & document the needs at that point, and then setup some
76314         config knobs to control it.
76315
76316 2021-11-27  Tom de Vries  <tdevries@suse.de>
76317
76318         [gdb/testsuite] Fix FAIL in gdb.base/list-missing-source.exp
76319         In commit f8080fb7a44 "[gdb/testsuite] Add gdb.base/include-main.exp" a
76320         file gdb.base/main.c was added, which caused the following regression:
76321         ...
76322         (gdb) list^M
76323         <gdb.base/main.c>
76324         (gdb) FAIL: gdb.base/list-missing-source.exp: list
76325         ...
76326
76327         The problem is that the test-case does not expect to find a file main.c, but
76328         now it finds gdb.base/main.c.
76329
76330         Fix this by using the more specific file name list-missing-source.c.
76331
76332         Tested on x86_64-linux.
76333
76334 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76335
76336         sim: testsuite: fix bits-gen EXEEXT handling
76337         Add missing $(EXEEXT) to dependencies on bits-gen.  These are actually
76338         build-only tools, but automake doesn't allow for build & host tools, so
76339         the rules are re-using EXEEXT.
76340
76341 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76342
76343         sim: testsuite: initial support for OS-specific tests
76344         We usually test against the newlib/libgloss environment, but for a
76345         few ports that also support Linux apps, we want to test that logic
76346         too.  A lot of the C code is written such that it works with either
76347         newlib/libgloss or glibc/linux toolchains, but we have some tests
76348         that end up being Linux-specific.  Cris has been using the target
76349         tuple as a rough proxy for this (where cris*-*-elf is assumed to be
76350         newlib/libgloss, and everything else is glibc/linux), but that is a
76351         bit too rough, and it doesn't work in a multitarget build.
76352
76353         So lets create a few stub files that we can do compile tests with
76354         to detect the different setups, and then let tests declare which
76355         one they require (if they require any at all).
76356
76357 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76358
76359         sim: testsuite: unify basic C compiler checks
76360         Both bfin & cris ports test the C compiler to see if it works, but in
76361         their own way.  Unify the checks in the common code so we can leverage
76362         them in more ports in the future, and collapse the bfin & cris code.
76363
76364 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76365
76366         sim: testsuite: rework sim_init usage
76367         The sim_init function was called by runtest for each test when --tool
76368         was set to sim.  When we changed to --tool '' to collapse the testsuite
76369         dir, the init function was no longer called on every test.  However, it
76370         was still being called explicitly by config/default.exp.  It's not clear
76371         why that explicit call ever existed since, in the past, it meant it was
76372         redundant.
76373
76374         Lets drop the single sim_init call in config/default.exp and move it out
76375         to all our tests.  This replicates the runtest behavior so we can setup
76376         variables on a per-test basis which allows us to recollapse the sim_path
76377         logic back.  We'll also leverage this in the future for toolchain setup.
76378
76379         Also add a few comments clarifying the overall runtime behavior.
76380
76381 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76382
76383         sim: cris: fix testsuite hang when sim is missing
76384         If the cris sim hasn't been built yet, trying to run its testsuite
76385         will hang indefinitely.  The common sim APIs already have this, so
76386         copy it over to the cris forks of the test+run functions.
76387
76388 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76389
76390         sim: testsuite: fix objdir handling
76391         The tests assume that the cwd is the objdir directory and write its
76392         intermediates to there all the time.  When using runtest's --objdir
76393         setting though, this puts the files in the wrong place.  This isn't
76394         a big problem currently as we never change --objdir, but in order to
76395         support parallel test execution, we're going to start setting that
76396         option, so clean up the code ahead of time.
76397
76398         We also have to tweak some of the cris tests which were making
76399         assumptions about the argv[0] value.
76400
76401 2021-11-27  Mike Frysinger  <vapier@gentoo.org>
76402
76403         sim: testsuite: rename global_sim_options to SIMFLAGS_FOR_TARGET
76404         Now that all the other toolchain settings have been renamed to match
76405         the dejagnu settings of XXX_FOR_TARGET, rename global_sim_options to
76406         SIMFLAGS_FOR_TARGET too.
76407
76408         sim: testsuite: replace global_ld_options with LDFLAGS_FOR_TARGET
76409         Only a few tests actually use global_ld_options, but we can replace the
76410         sim-specific settings with the dejagnu common LDFLAGS_FOR_TARGET and get
76411         the same result.
76412
76413 2021-11-27  GDB Administrator  <gdbadmin@sourceware.org>
76414
76415         Automatic date update in version.in
76416
76417 2021-11-26  John David Anglin  <danglin@gcc.gnu.org>
76418
76419         Fix ifunc test fails on hppa*-*-*
76420         2021-11-26  John David Anglin  <danglin@gcc.gnu.org>
76421
76422                 PR ld/27442
76423
76424         ld/ChangeLog:
76425
76426                 * ld/testsuite/ld-ifunc/ifunc.exp (contains_irelative_reloc): Adjust
76427                 regexp.
76428                 Skip static ifunc-using executable test on hppa*-*-*.
76429
76430 2021-11-26  H.J. Lu  <hjl.tools@gmail.com>
76431
76432         gas: Update commit 4780e5e4933
76433         Update
76434
76435         commit 4780e5e4933a2497a5aecc4ceabbbb8e82aaf822
76436         Author: Tom de Vries <tdevries@suse.de>
76437         Date:   Fri Nov 26 09:59:45 2021 +0100
76438
76439             [gas] Fix file 0 dir with -gdwarf-5
76440
76441         1. Replace i with j in
76442
76443           for (j = 0; i < NUM_MD5_BYTES; ++j)
76444
76445         2. Pass -W to readelf to force CU: in output due to:
76446
76447                       if (do_wide || strlen (directory) < 76)
76448                         printf (_("CU: %s/%s:\n"), directory, file_table[0].name);
76449                       else
76450                         printf ("%s:\n", file_table[0].name);
76451
76452                 PR gas/28629
76453                 * dwarf2dbg.c (out_dir_and_file_list): Fix a typo in commit
76454                 4780e5e4933.
76455                 * testsuite/gas/elf/dwarf-5-nop-for-line-table.d: Pass -W to
76456                 readelf.
76457
76458 2021-11-26  Mike Frysinger  <vapier@gentoo.org>
76459
76460         sim: testsuite: replace global_as_options with ASFLAGS_FOR_TARGET
76461         Only a few tests actually use global_as_options, but we can replace the
76462         sim-specific settings with the dejagnu common ASFLAGS_FOR_TARGET and get
76463         the same result.
76464
76465 2021-11-26  Tom de Vries  <tdevries@suse.de>
76466
76467         [gdb/testsuite] Add gdb.base/include-main.exp
76468         The test-case gdb.ada/dgopt.exp uses the -gnatD switch, in combination with
76469         -gnatG.
76470
76471         This causes the source file $src/gdb/testsuite/gdb.ada/dgopt/x.adb to be
76472         expanded into $build/gdb/testsuite/outputs/gdb.ada/dgopt/x.adb.dg, and the
76473         debug information should refer to the x.adb.dg file.
76474
76475         That is the case for the .debug_line part:
76476         ...
76477         The Directory Table is empty.
76478
76479          The File Name Table (offset 0x1c):
76480           Entry Dir     Time    Size    Name
76481           1     0       0       0       x.adb.dg
76482         ...
76483         but not for the .debug_info part:
76484         ...
76485             <11>   DW_AT_name        : $src/gdb/testsuite/gdb.ada/dgopt/x.adb
76486             <15>   DW_AT_comp_dir    : $build/gdb/testsuite/outputs/gdb.ada/dgopt
76487         ...
76488
76489         Filed as PR gcc/103436.
76490
76491         In C we can generate similar debug information, using a source file that does
76492         not contain any code, but includes another one that does:
76493         ...
76494          $ cat gdb/testsuite/gdb.base/include-main.c
76495          #include "main.c"
76496         ...
76497         such that in the .debug_line part we have:
76498         ...
76499          The Directory Table (offset 0x1c):
76500           1     /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base
76501
76502          The File Name Table (offset 0x57):
76503           Entry Dir     Time    Size    Name
76504           1     1       0       0       main.c
76505         ...
76506         and in the .debug_info part:
76507         ...
76508             <11>   DW_AT_name        : $src/gdb/testsuite/gdb.base/include-main.c
76509             <15>   DW_AT_comp_dir    : $build/gdb/testsuite
76510         ...
76511
76512         Add a C test-case that mimics gdb.ada/dgopt.exp, that is:
76513         - generate debug info as described above,
76514         - issue a list of a line in include-main.c, while the corresponding
76515           CU is not expanded yet.
76516
76517         Tested on x86_64-linux.
76518
76519 2021-11-26  Mike Frysinger  <vapier@gentoo.org>
76520
76521         sim: testsuite: drop unused global_cc_options
76522         Nothing in the testsuite is using this setting, so let's drop it.
76523         Any code that wants to set compiler flags can use CFLAGS_FOR_TARGET
76524         instead to get the same effect.
76525
76526         sim: testsuite: punt unused toolchain variables
76527         These haven't been used in over 20 years.  The sim testsuite used to
76528         run these tools itself directly, but back in ~1999 it switched to the
76529         dejagnu helpers (e.g. target_assemble & target_link), and the dejagnu
76530         logic only utilizes XXX_FOR_TARGET variables.  Punt them here to avoid
76531         confusion with dead code.
76532
76533 2021-11-26  Andrew Burgess  <aburgess@redhat.com>
76534             Simon Cook  <simon.cook@embecosm.com>
76535
76536         gdb: add risc-v disassembler options support
76537         This commit adds support for RISC-V disassembler options to GDB.  This
76538         commit is based on this patch which was never committed:
76539
76540           https://sourceware.org/pipermail/binutils/2021-January/114944.html
76541
76542         All of the binutils refactoring has been moved to a separate, earlier,
76543         commit, so this commit is pretty straight forward, just registering
76544         the required gdbarch hooks.
76545
76546 2021-11-26  Andrew Burgess  <aburgess@redhat.com>
76547             Simon Cook  <simon.cook@embecosm.com>
76548
76549         opcodes/riscv: add disassembler options support to libopcodes
76550         In preparation for the next commit, which will add GDB support for
76551         RISC-V disassembler options, this commit restructures how the
76552         disassembler options are managed within libopcodes.
76553
76554         The implementation provided here is based on this mailing list patch
76555         which was never committed:
76556
76557           https://sourceware.org/pipermail/binutils/2021-January/114944.html
76558
76559         which in turn took inspiration from the MIPS implementation of the
76560         same feature.
76561
76562         The biggest changes from the original mailing list post are:
76563
76564           1. The GDB changes have been split into a separate patch, and
76565
76566           2. The `riscv_option_args_privspec` variable, which held the valid
76567           priv-spec values is now gone, instead we use the `riscv_priv_specs`
76568           array from bfd/cpu-riscv.c instead.
76569
76570
76571         include/ChangeLog:
76572
76573                 * dis-asm.h (disassembler_options_riscv): Declare.
76574
76575         opcodes/ChangeLog:
76576
76577                 * riscv-dis.c (enum riscv_option_arg_t): New enum typedef.
76578                 (riscv_options): New static global.
76579                 (disassembler_options_riscv): New function.
76580                 (print_riscv_disassembler_options): Rewrite to use
76581                 disassembler_options_riscv.
76582
76583 2021-11-26  Tom de Vries  <tdevries@suse.de>
76584
76585         [gas] Fix file 0 dir with -gdwarf-5
76586         In out_dir_and_file_list, if file 0 is copied from file 1, only the filename
76587         is copied, and the dir and md5 fields are left to their default values.
76588
76589         Fix this by adding the copy of the dir and md5 fields.
76590
76591         gas/ChangeLog:
76592
76593         2021-11-26  Tom de Vries  <tdevries@suse.de>
76594
76595                 PR 28629
76596                 * dwarf2dbg.c (out_dir_and_file_list): When copying file 1 to file 0,
76597                 also copy dir and md5 fields.
76598                 * testsuite/gas/i386/dwarf5-line-4.d: Adjust expected output.
76599
76600 2021-11-26  Mike Frysinger  <vapier@gentoo.org>
76601
76602         sim: mips: avoid _ namespace
76603         Some C libraries export _P symbols in their headers (like older
76604         newlib and its ctype.h), so use P_ instead to avoid conflicts.
76605
76606         ld: fix POSIX shell test usage
76607         POSIX test uses = for compares, not == which is a bashism.
76608
76609         gas: enable silent build rules
76610
76611         ld: fix --disable-multiple-abs-defs alignment in help
76612
76613 2021-11-26  GDB Administrator  <gdbadmin@sourceware.org>
76614
76615         Automatic date update in version.in
76616
76617 2021-11-25  Enze Li  <lienze2010@hotmail.com>
76618
76619         gdb: ensure extension_language_python is always defined
76620         In this commit:
76621
76622           commit c6a6aad52d9e839d6a84ac31cabe2b7e1a2a31a0
76623           Date:   Mon Oct 25 17:25:45 2021 +0100
76624
76625               gdb/python: make some global variables static
76626
76627         building without Python was broken.  The extension_language_python
76628         global was moved from being always defined, to only being defined when
76629         the HAVE_PYTHON macro was defined.  As a consequence, building without
76630         Python support would result in errors like:
76631
76632           /usr/bin/ld: extension.o:(.rodata+0x120): undefined reference to `extension_language_python'
76633
76634         This commit fixes the problem by moving the definition of
76635         extension_language_python outside of the HAVE_PYTHON macro protection.
76636
76637 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76638
76639         Revert "gdb: add assert in remote_target::wait relating to async being off"
76640         This commit introduced a test failure in gdb.server/attach-flag.exp.
76641         I didn't spot this failure originally as the problem is fixed by this,
76642         as yet unpushed patch:
76643
76644           https://sourceware.org/pipermail/gdb-patches/2021-November/183768.html
76645
76646         I unfortunately didn't test each patch in the original series
76647         independently.  I'll repost this patch after the above patch has been
76648         merged.
76649
76650         This reverts commit 32b1f5e8d6b8ddd3be6e471c26dd85a1dac31dda.
76651
76652 2021-11-25  Nick Clifton  <nickc@redhat.com>
76653
76654         Fix building the AArch64 assembler and disassembler when assertions are disabled.
76655                 PR 28614
76656                 * aarch64-asm.c: Replace assert(0) with real code.
76657                 * aarch64-dis.c: Likewise.
76658                 * aarch64-opc.c: Likewise.
76659
76660 2021-11-25  Bruno Larsen  <blarsen@redhat.com>
76661
76662         PR gdb/28480: Improve ambiguous member detection
76663         Basic ambiguity detection assumes that when 2 fields with the same name
76664         have the same byte offset, it must be an unambiguous request. This is not
76665         always correct. Consider the following code:
76666
76667         class empty { };
76668
76669         class A {
76670         public:
76671           [[no_unique_address]] empty e;
76672         };
76673
76674         class B {
76675         public:
76676           int e;
76677         };
76678
76679         class C: public A, public B { };
76680
76681         if we tried to use c.e in code, the compiler would warn of an ambiguity,
76682         however, since A::e does not demand an unique address, it gets the same
76683         address (and thus byte offset) of the members, making A::e and B::e have the
76684         same address. however, "print c.e" would fail to report the ambiguity,
76685         and would instead print it as an empty class (first path found).
76686
76687         The new code solves this by checking for other found_fields that have
76688         different m_struct_path.back() (final class that the member was found
76689         in), despite having the same byte offset.
76690
76691         The testcase gdb.cp/ambiguous.exp was also changed to test for this
76692         behavior.
76693
76694 2021-11-25  Jan W. Jagersma  <jwjagersma@gmail.com>
76695
76696         coff-go32: consistent 16-byte section alignment
76697         Section alignment for coff-go32 is inconsistent - The '.text' and
76698         '.data' sections are 16-byte aligned, but named sections '.text.*' and
76699         '.data.*' are only 4-byte aligned.  '.gnu.linkonce.r.*' is aligned to
76700         16 bytes, yet '.rodata' and '.rodata.*' are aligned to 4 bytes.  For
76701         '.bss' all input sections are only aligned to 4 bytes.
76702
76703         This primarily can cause trouble when using SSE instructions, which
76704         require their memory operands to be aligned to 16-byte boundaries.
76705
76706         This patch solves the issue simply by setting the section alignment
76707         to 16 bytes, for all code and data sections referenced in the default
76708         linker script.
76709
76710                 * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES):  Use partial
76711                 name match for .text, .data.  Add entries for .const, .rodata,
76712                 .bss, .gnu.linkonce.b.
76713
76714 2021-11-25  Alan Modra  <amodra@gmail.com>
76715
76716         Re: AArch64: Add support for AArch64 EFI (efi-*-aarch64)
76717         Commit b69c9d41e8 edited bfd/Makefile.in rather than using automake,
76718         which meant a typo in Makefile.am was not discovered and other
76719         differences in Makefile.in are seen with a proper regeneration.  One
76720         difference was lack of an empty line between the pe-aarch64igen.c rule
76721         and the following $(BFD32_LIBS) etc. dependency rule, in the
76722         regenerated file.  Not that it matters for proper "make" behaviour,
76723         but it's nicer with a line between those rules.  Moving the rule
76724         earlier seems to cure the missing empty line.
76725
76726                 * Makefile.am (BFD64_BACKENDS): Correct typo.
76727                 (BFD_H_DEPS, LOCAL_H_DEPS): Move earlier.  Move rule using these
76728                 deps earlier too.
76729                 * Makefile.in: Regenerate.
76730                 * po/BLD-POTFILES.in: Regenerate.
76731                 * po/SRC-POTFILES.in: Regenerate.
76732
76733 2021-11-25  Nick Clifton  <nickc@redhat.com>
76734
76735         Updated French translation for the opcodes directory.
76736                 * po/fr.po; Updated French translation.
76737
76738 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76739
76740         gdb: rename source_styling_changed observer
76741         In a later commit I plan to add disassembler styling.  In the same way
76742         that we have a source_styling_changed observer I would need to add a
76743         disassembler_styling_changed observer.
76744
76745         However, currently, these observers would only be notified from
76746         cli-style.c:set_style_enabled, and observed in tui-winsource.c,
76747         tui_source_window::style_changed, as a result, having two observers
76748         seems unnecessary right now, so, in this commit, I plan to rename
76749         source_styling_changed to just styling_changed, then, in the later
76750         commit, when disassembler styling is added, I can use the same
76751         observer for both source styling, and disassembler styling.
76752
76753         There should be no user visible changes after this commit.
76754
76755 2021-11-25  Andrew Burgess  <andrew.burgess@embecosm.com>
76756
76757         gdb/python: make some global variables static
76758         Make a couple of global variables static in python/python.c.  To do
76759         this I had to move the definition of extension_language_python to
76760         later in the file.
76761
76762         There should be no user visible changes after this commit.
76763
76764 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76765
76766         gdb: add assert in remote_target::wait relating to async being off
76767         While working on another patch I ended up in a situation where I had
76768         async mode disabled (with 'maint set target-async off'), but the async
76769         event token got marked anyway.
76770
76771         In this situation GDB was continually calling into
76772         remote_target::wait, however, the async token would never become
76773         unmarked as the unmarking is guarded by target_is_async_p.
76774
76775         We could just unconditionally unmark the token, but that would feel
76776         like just ignoring a bug, so, instead, lets assert that if
76777         !target_is_async_p, then the async token should not be marked.
76778
76779         This assertion would have caught my earlier mistake.
76780
76781         There should be no user visible changes with this commit.
76782
76783 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76784
76785         gdb: simplify remote_target::is_async_p
76786         This commit simplifies remote_target::is_async_p by removing the
76787         target_async_permitted check.
76788
76789         In previous commits I have added additional assertions around the
76790         target_async_permitted flag into target.c, as a result we should now
76791         be confident that if target_can_async_p returns false, a target will
76792         never have async mode enabled.  Given this, it should not be necessary
76793         to check target_async_permitted in remote_target::is_async_p, if this
76794         flag is false ::is_async_p should return false anyway.  There is an
76795         assert to this effect in target_is_async_p.
76796
76797         There should be no user visible change after this commit.
76798
76799 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76800
76801         gdb: add asserts in target.c for target_async_permitted
76802         The target_async_permitted flag allows a user to override whether a
76803         target can act in async mode or not.  In previous commits I have moved
76804         the checking of this flag out of the various ::can_async_p methods and
76805         into the common target.c code.
76806
76807         In this commit I will add some additional assertions into
76808         target_is_async_p and target_async.  The rules these assertions are
76809         checking are:
76810
76811           1. A target that returns false for target_can_async_p should never
76812           become "async enabled", and so ::is_async_p should always return
76813           false.  This is being checked in target_is_async_p.
76814
76815           2. GDB should never try to enable async mode for a target that
76816           returns false for target_can_async_p, this is checked in
76817           target_async.
76818
76819         There are a few places where we call the ::is_async_p method directly,
76820         in these cases we will obviously not pass through the assert in
76821         target_is_async_p, however, there are also plenty of places where we
76822         do call target_is_async_p so if GDB starts to misbehave we should
76823         catch it quickly enough.
76824
76825         There should be no user visible changes after this commit.
76826
76827 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76828
76829         gdb: hoist target_async_permitted checks into target.c
76830         This commit moves the target_async_permitted check out of each targets
76831         ::can_async_p method and into the target_can_async_p wrapper function.
76832
76833         I've left some asserts in the two ::can_async_p methods that I
76834         changed, which will hopefully catch any direct calls to these methods
76835         that might be added in the future.
76836
76837         There should be no user visible changes after this commit.
76838
76839 2021-11-25  Andrew Burgess  <aburgess@redhat.com>
76840
76841         gdb: introduce a new overload of target_can_async_p
76842         There are a few places where we call the target_ops::can_async_p
76843         member function directly, instead of using the target_can_async_p
76844         wrapper.
76845
76846         In some of these places this is because we need to ask before the
76847         target has been pushed, and in another location (in target.c) it seems
76848         unnecessary to go through the wrapper when we are already in target.c
76849         code.
76850
76851         However, in the next commit I'd like to hoist some common checks out
76852         of target specific code into target.c.  To achieve this, in this
76853         commit, I introduce a new overload of target_can_async_p which takes a
76854         target_ops pointer, and calls the ::can_async_p method directly.  I
76855         then make use of the new overload where appropriate.
76856
76857         There should be no user visible changes after this commit.
76858
76859 2021-11-25  Clément Chigot  <clement.chigot@atos.net>
76860
76861         ld/testsuite/ld-elfvsb: correctly test "weak hidden symbol DSO last"
76862         The test must be done with the shared object and not with the object
76863         file which is already being tested above.
76864
76865         ld/
76866                 * testsuite/ld-elfvsb/elfvsb.exp: use .so file in "weak hidden
76867                   symbol DSO last"
76868
76869 2021-11-25  Tom de Vries  <tdevries@suse.de>
76870
76871         [gdb/cli] Add "set logging enabled", deprecate "set logging on/off"
76872         Before commit 3b6acaee895 "Update more calls to add_prefix_cmd" we had the
76873         following output for "show logging file":
76874         ...
76875         $ gdb -q -batch -ex "set trace-commands on" \
76876             -ex "set logging off" \
76877             -ex "show logging file" \
76878             -ex "set logging on" \
76879             -ex "show logging file"
76880         +set logging off
76881         +show logging file
76882         Future logs will be written to gdb.txt.
76883         +set logging on
76884         +show logging file
76885         Currently logging to "gdb.txt".
76886         ...
76887
76888         After that commit we have instead:
76889         ...
76890         +set logging off
76891         +show logging file
76892         The current logfile is "gdb.txt".
76893         +set logging on
76894         +show logging file
76895         The current logfile is "gdb.txt".
76896         ...
76897
76898         Before the commit, whether logging is enabled or not can be deduced from the
76899         output of the command.  After the commit, the message is unified and it's no
76900         longer clear whether logging is enabled or not.
76901
76902         Fix this by:
76903         - adding a new command "show logging enabled"
76904         - adding a corresponding new command "set logging enabled on/off"
76905         - making the commands "set logging on/off" deprecated aliases of the
76906           "set logging enabled on/off" command.
76907
76908         Update the docs and testsuite to use "set logging enabled".  Mention the new
76909         and deprecated commands in NEWS.
76910
76911         Tested on x86_64-linux.
76912
76913 2021-11-25  Tom de Vries  <tdevries@suse.de>
76914
76915         [gdb/cli] Fix typo in logging overwrite help text
76916         Currently we have:
76917         ...
76918         $ gdb -q -batch -ex "help set logging overwrite"
76919         Set whether logging overwrites or appends to the log file.
76920         If set, logging overrides the log file.
76921         ...
76922
76923         Fix overrides -> overwrites typo.
76924
76925 2021-11-25  GDB Administrator  <gdbadmin@sourceware.org>
76926
76927         Automatic date update in version.in
76928
76929 2021-11-24  Simon Marchi  <simon.marchi@efficios.com>
76930
76931         gdb: fix help doc for "set index-cache enabled"
76932         When implementing this command, I put "help doc" as a placeholder for
76933         the help string, and forgot to update it.  Change it for a real help
76934         string.
76935
76936         Change-Id: Id23c2142c5073dc570bd8a706e9ec6fa8c40eb09
76937
76938 2021-11-24  Simon Marchi  <simon.marchi@efficios.com>
76939
76940         Revert (part of) "gdb fix for catch-syscall.exp"
76941         This reverts (par of) commit ab198279120fe7937c0970a8bb881922726678f9.
76942         This commit changed what the test expects when catching the execve
76943         syscall based on the behavior seen on a Linux PowerPC machine.  That is,
76944         we get an "entry" event, but no "return" event.  This is not what we get
76945         on Linux with other architectures, though, and it seems like a
76946         PowerPC-specific bug.
76947
76948         Revert the part of the patch related to this, but not the other hunk.
76949
76950         Change-Id: I4248776e4299f10999487be96d4acd1b33639996
76951
76952 2021-11-24  Nick Clifton  <nickc@redhat.com>
76953
76954         Fix an illegal memory access parsing a corrupt sysroff file.
76955                 PR 28564
76956                 * sysdump.c (getCHARS): Check for an out of bounds read.
76957
76958 2021-11-24  Andrew Burgess  <aburgess@redhat.com>
76959
76960         gdb: fix crash when reading ECOFF debug information
76961         In commit:
76962
76963           commit 633cf2548bcd3dafe297e21a1dd3574240280d48
76964           Date:   Wed May 9 15:42:28 2018 -0600
76965
76966               Remove cleanups from mdebugread.c
76967
76968         the following change was made in the function parse_partial_symbols in
76969         mdebugread.c:
76970
76971           -  fdr_to_pst = XCNEWVEC (struct pst_map, hdr->ifdMax + 1);
76972           -  old_chain = make_cleanup (xfree, fdr_to_pst);
76973           +  gdb::def_vector<struct pst_map> fdr_to_pst_holder (hdr->ifdMax + 1);
76974           +  fdr_to_pst = fdr_to_pst_holder.data ();
76975
76976         The problem with this change is that XCNEWVEC calls xcalloc, which in
76977         turn calls calloc, and calloc zero initializes the allocated memory.
76978         In contrast, the new line gdb::def_vector<struct pst_map> specifically
76979         does not initialize the underlying memory.
76980
76981         This is a problem because, later on in this same function, we
76982         increment the n_globals field within 'struct pst_map' objects stored
76983         in the vector.  The incrementing is now being done from an
76984         uninitialized starting point.
76985
76986         In this commit we switch from using gdb::def_vector to using
76987         std::vector, this alone should be enough to ensure that the fields are
76988         initialized to zero.
76989
76990         However, for extra clarity, I have also added initial values in the
76991         'struct pst_map' to make it crystal clear how the struct will start
76992         up.
76993
76994         This issue was reported on the mailing list here:
76995
76996           https://sourceware.org/pipermail/gdb-patches/2021-November/183693.html
76997
76998         Co-Authored-By: Lightning <lightningth@gmail.com>
76999
77000 2021-11-24  GDB Administrator  <gdbadmin@sourceware.org>
77001
77002         Automatic date update in version.in
77003
77004 2021-11-23  Alexandra Hájková  <ahajkova@redhat.com>
77005
77006         configure.ac: Check for the readline.h explicitly
77007         When readline development package is missing make fails with
77008         "configure: error: system readline is not new enough" which
77009         might be confusing. This patch checks for the readline.h explicitly
77010         and makes make to warn about the missing package.
77011
77012 2021-11-23  Tamar Christina  <tamar.christina@arm.com>
77013
77014         AArch64: Add support for AArch64 EFI (efi-*-aarch64).
77015         This adds support for efi-*-aarch64 by virtue of adding a new PEI target
77016         pei-aarch64-little.  This is not a full target and only exists to support EFI
77017         at this time.
77018
77019         This means that this target does not support relocation processing and is mostly
77020         a container format.  This format has been added to elf based aarch64 targets
77021         such that efi images can be made natively on Linux.
77022
77023         However this target is not valid for use with gas but only with objcopy.
77024
77025         With these changes the resulting file is recognized as an efi image by
77026         third party tools:
77027
77028         >  pecli info hello.efi
77029
77030         Metadata
77031         ================================================================================
77032         MD5:            598c32a778b0f0deebe977fef8578c4e
77033         SHA1:           4580121edd5cb4dc40f51b28f171fd15250df84c
77034         SHA256:         3154bd7cf42433d1c957f6bf55a17ad8c57ed41b29df2d485703349fd6ff1d5c
77035         Imphash:
77036         Size:           47561 bytes
77037         Type:           PE32+ executable (EFI application) (stripped to external PDB), for MS Windows
77038         Compile Time:   1970-01-01 00:00:00 (UTC - 0x0       )
77039         Entry point:    0x2000 (section .text)
77040
77041         Sections
77042         ================================================================================
77043         Name      RWX  VirtSize   VirtAddr   RawAddr   RawSize   Entropy  md5
77044         .text     R-X  0x5bb0     0x2000     0x400     0x5c00      6.39 551fbc264256a3f387de8a891500ae0d
77045         .reloc    R--  0xc        0x8000     0x6000    0x200       0.02 0c45f6d812d079821c1d54c09ab89e1d
77046         .data     RW-  0x1d88     0x9000     0x6200    0x1e00      4.18 5d1137c09f01289dc62bf754f7290db3
77047         .dynamic  RW-  0xf0       0xb000     0x8000    0x200       0.34 5c94ed3206f05a277e6f04fbf131f131
77048         .rela     R--  0xe58      0xc000     0x8200    0x1000      1.87 8b5c6bc30f3acb7ca7bf2e6789d68519
77049         .dynsym   R--  0x138      0xd000     0x9200    0x200       0.96 bdcf5101da51aadc663ca8859f88138c
77050
77051         Imports
77052         ================================================================================
77053
77054         Any magic number is based on the Microsoft PE specification [1].
77055
77056         [1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
77057
77058         bfd/ChangeLog:
77059
77060         2021-10-21  Tamar Christina  <tamar.christina@arm.com>
77061
77062                 PR binutils/26206
77063                 * .gitignore (pe-aarch64igen.c): New.
77064                 * Makefile.am (pei-aarch64.lo, pe-aarch64igen.lo, pei-aarch64.c,
77065                 pe-aarch64igen.c): Add support.
77066                 * Makefile.in: Likewise.
77067                 * bfd.c (bfd_get_sign_extend_vma): Add pei-aarch64-little.
77068                 * coff-aarch64.c: New file.
77069                 * coffcode.h (coff_set_arch_mach_hook, coff_set_flags,
77070                 coff_write_object_contents) Add aarch64 (aarch64_pei_vec) support.
77071                 * config.bfd: Likewise.
77072                 * configure: Likewise.
77073                 * configure.ac: Likewise.
77074                 * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE,
77075                 GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE,
77076                 GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT,
77077                 GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE,
77078                 GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT,
77079                 GET_PDATA_ENTRY, _bfd_peAArch64_bfd_copy_private_bfd_data_common,
77080                 _bfd_peAArch64_bfd_copy_private_section_data,
77081                 _bfd_peAArch64_get_symbol_info, _bfd_peAArch64_only_swap_filehdr_out,
77082                 _bfd_peAArch64_print_private_bfd_data_common,
77083                 _bfd_peAArch64i_final_link_postscript,
77084                 _bfd_peAArch64i_only_swap_filehdr_out, _bfd_peAArch64i_swap_aouthdr_in,
77085                 _bfd_peAArch64i_swap_aouthdr_out, _bfd_peAArch64i_swap_aux_in,
77086                 _bfd_peAArch64i_swap_aux_out, _bfd_peAArch64i_swap_lineno_in,
77087                 _bfd_peAArch64i_swap_lineno_out, _bfd_peAArch64i_swap_scnhdr_out,
77088                 _bfd_peAArch64i_swap_sym_in, _bfd_peAArch64i_swap_sym_out,
77089                 _bfd_peAArch64i_swap_debugdir_in, _bfd_peAArch64i_swap_debugdir_out,
77090                 _bfd_peAArch64i_write_codeview_record,
77091                 _bfd_peAArch64i_slurp_codeview_record,
77092                 _bfd_peAArch64_print_ce_compressed_pdata): New.
77093                 * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out,
77094                 pe_print_pdata, _bfd_XX_print_private_bfd_data_common,
77095                 _bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript):
77096                 Support COFF_WITH_peAArch64,
77097                 * pei-aarch64.c: New file.
77098                 * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p):
77099                 Support COFF_WITH_peAArch64.
77100                 (jtab): Add dummy entry that traps.
77101                 * targets.c (aarch64_pei_vec): New.
77102
77103         binutils/ChangeLog:
77104
77105         2021-10-21  Tamar Christina  <tamar.christina@arm.com>
77106
77107                 PR binutils/26206
77108                 * NEWS: Add new support.
77109                 * objcopy.c (convert_efi_target): Add efi-*-aarch64 support.
77110                 * testsuite/binutils-all/aarch64/pei-aarch64-little.d: New test.
77111                 * testsuite/binutils-all/aarch64/pei-aarch64-little.s: New test.
77112
77113         include/ChangeLog:
77114
77115         2021-10-21  Tamar Christina  <tamar.christina@arm.com>
77116
77117                 PR binutils/26206
77118                 * coff/aarch64.h: New file.
77119                 * coff/pe.h (IMAGE_FILE_MACHINE_ARM64): New.
77120
77121 2021-11-23  Alan Modra  <amodra@gmail.com>
77122
77123         binutils debuginfod test
77124         A missing "return" resulted in this non-ELF fail:
77125         x86_64-w64-mingw32  +FAIL: debuginfod (create separate debug info file)
77126
77127         Also, the debuginfod I have installed does not appear to handle
77128         non-native ELF objects, so only run the test when native.
77129
77130                 * testsuite/binutils-all/debuginfod.exp: Don't run test unless
77131                 native ELF.
77132
77133 2021-11-23  Alan Modra  <amodra@gmail.com>
77134
77135         Update bug reporting address
77136         https://sourceware.org/bugzilla/ everywhere
77137
77138         bfd/
77139                 * configure.ac (ACX_BUGURL): Set to https://sourceware.org/bugzilla/
77140                 * po/Make-in (msgid-bugs-address): Likewise.
77141                 * README: Report bugs to the above.
77142                 * configure: Regenerate.
77143         binutils/
77144                 * po/Make-in (msgid-bugs-address): Update.
77145         gas/
77146                 * README: Update bug address.  Delete mention of gcc.
77147                 * po/Make-in: Update bug address.
77148         gold/
77149                 * po/Make-in: Update bug address.
77150         gprof/
77151                 * po/Make-in: Update bug address.
77152         ld/
77153                 * po/Make-in: Update bug address.
77154         opcodes/
77155                 * po/Make-in: Update bug address.
77156
77157 2021-11-23  Jan (janneke) Nieuwenhuizen  <janneke@gnu.org>
77158
77159         gdb: more compile fixes for gnu-nat.c
77160         This fixes compile errors like
77161
77162             ../../gdb-11.1/gdb/gnu-nat.c: In function void add_task_commands():
77163             ../../gdb-11.1/gdb/gnu-nat.c:3204:17: error: no matching function for call to add_cmd(const char [8], command_class, cmd_list_element*&, char*, cmd_list_element**)
77164              3204 |         &setlist);
77165                   |                 ^
77166             In file included from ../../gdb-11.1/gdb/completer.h:21,
77167                              from ../../gdb-11.1/gdb/symtab.h:36,
77168                              from ../../gdb-11.1/gdb/infrun.h:21,
77169                              from ../../gdb-11.1/gdb/target.h:42,
77170                              from ../../gdb-11.1/gdb/inf-child.h:23,
77171                              from ../../gdb-11.1/gdb/gnu-nat.h:38,
77172                              from ../../gdb-11.1/gdb/gnu-nat.c:24:
77173             ../../gdb-11.1/gdb/command.h:160:33: note: candidate: cmd_list_element* add_cmd(const char*, command_class, void (*)(const char*, int), const char*, cmd_list_element**)
77174               160 | extern struct cmd_list_element *add_cmd (const char *, enum command_class,
77175                   |                                 ^~~~~~~
77176             ../../gdb-11.1/gdb/command.h:161:30: note:   no known conversion for argument 3 from cmd_list_element* to void (*)(const char*, int)
77177               161 |       cmd_const_cfunc_ftype *fun,
77178                   |       ~~~~~~~~~~~~~~~~~~~~~~~^~~
77179             ../../gdb-11.1/gdb/command.h:167:33: note: candidate: cmd_list_element* add_cmd(const char*, command_class, const char*, cmd_list_element**)
77180               167 | extern struct cmd_list_element *add_cmd (const char *, enum command_class,
77181                   |                                 ^~~~~~~
77182             ../../gdb-11.1/gdb/command.h:167:33: note:   candidate expects 4 arguments, 5 provided
77183             ../../gdb-11.1/gdb/gnu-nat.c:3210:18: error: no matching function for call to add_cmd(const char [8], command_class, cmd_list_element*&, char*, cmd_list_element**)
77184              3210 |         &showlist);
77185                   |                  ^
77186
77187         Change-Id: Ie9029363d3fb40e34e8f5b1ab503745bc44bfe3f
77188
77189 2021-11-23  Andrea Monaco  <andrea.monaco@autistici.org>
77190
77191         gnu-nat.c: fix calls to add_info_alias
77192         Some time ago add_info_alias was changed (commit
77193         e0f25bd9717c7973197095523db7c1cdc956cea2).  These calls were not updated
77194         and caused errors on compilation.
77195
77196         Change-Id: I354ae4e8b8926d785abc94ec7142471ffd76d2de
77197
77198 2021-11-23  GDB Administrator  <gdbadmin@sourceware.org>
77199
77200         Automatic date update in version.in
77201
77202 2021-11-22  Simon Marchi  <simon.marchi@efficios.com>
77203
77204         gdb: pass more const target_waitstatus by reference
77205         While working on target_waitstatus changes, I noticed a few places where
77206         const target_waitstatus objects could be passed by reference instead of
77207         by pointers.  And in some cases, places where a target_waitstatus could
77208         be passed as const, but was not.  Convert them as much as possible.
77209
77210         Change-Id: Ied552d464be5d5b87489913b95f9720a5ad50c5a
77211
77212 2021-11-22  Simon Marchi  <simon.marchi@efficios.com>
77213
77214         gdb: introduce target_waitkind_str, use it in target_waitstatus::to_string
77215         I would like to print target_waitkind values in debug messages, so I
77216         think that a target_waitkind-to-string function would be useful.  While
77217         at it, use it in target_waitstatus::to_string.  This changes the output
77218         of target_waitstatus::to_string a bit, but I think it is for the better.
77219         The debug messages will show a string matching exactly the
77220         target_waitkind enumerator (minus the TARGET_WAITKIND prefix).
77221
77222         As a convenience, make string_appendf return the same reference to
77223         string it got as a parameter.  This allows doing this:
77224
77225           return string_appendf (str, "foo");
77226
77227         ... keeping the code concise.
77228
77229         Change-Id: I383dffc9c78614e7d0668b1516073905e798eef7
77230
77231 2021-11-22  Simon Marchi  <simon.marchi@efficios.com>
77232
77233         gdb: rename target_waitstatus_to_string to target_waitstatus::to_string
77234         Make target_waitstatus_to_string a "to_string" method of
77235         target_waitstatus, a bit like we have ptid_t::to_string already.  This
77236         will save a bit of typing.
77237
77238         Change-Id: Id261b7a09fa9fa3c738abac131c191a6f9c13905
77239
77240 2021-11-22  Nelson Chu  <nelson.chu@sifive.com>
77241
77242         RISC-V: Removed the redundant NULL pointer check in the riscv_update_subset.
77243         If we always use the .option arch to call the riscv_update_subset, then
77244         it is almost impossible that the input string will be NULL.  Therefore,
77245         just remove the redundant NULL pointer check in the riscv_update_subset.
77246
77247         bfd/
77248                 * elfxx-riscv.c (riscv_update_subset): Removed the redundant NULL
77249                 pointer check.
77250
77251 2021-11-22  Nelson Chu  <nelson.chu@sifive.com>
77252
77253         RISC-V: Replace .option rvc/norvc with .option arch, +c/-c.
77254         Since the .option rvc/norvc directives are obsolete, replace them with
77255         the new proposed diretives: .option arch, +c/-c.  And also reset the
77256         riscv_opts.rvc flag for the .option arch directives.
77257
77258         gas/
77259                 * config/tc-riscv.c (s_riscv_option): Reset the riscv_opts.rvc
77260                 for the .option arch directives.
77261                 * testsuite/gas/riscv/align-1.s: Replace the obsolete .option
77262                 rvc/norvc with .option arch, +c/-c.
77263                 * testsuite/gas/riscv/c-add-addi.s: Likewise.
77264                 * testsuite/gas/riscv/c-nonzero-imm.s: Likewise.
77265                 * testsuite/gas/riscv/c-nonzero-reg.s: Likewise.
77266                 * testsuite/gas/riscv/c-zero-imm-64.s: Likewise.
77267                 * testsuite/gas/riscv/c-zero-imm.s: Likewise.
77268                 * testsuite/gas/riscv/c-zero-reg.s: Likewise.
77269                 * testsuite/gas/riscv/ext.s: Likewise.
77270                 * testsuite/gas/riscv/mapping-01.s: Likewise.
77271                 * testsuite/gas/riscv/mapping-02.s: Likewise.
77272                 * testsuite/gas/riscv/mapping-03.s: Likewise.
77273                 * testsuite/gas/riscv/mapping-04.s: Likewise.
77274                 * testsuite/gas/riscv/no-relax-align-2.s: Likewise.
77275                 * testsuite/gas/riscv/shamt-32.s: Likewise.
77276                 * testsuite/gas/riscv/shamt-64.s: Likewise.
77277
77278 2021-11-22  Tom de Vries  <tdevries@suse.de>
77279
77280         [gdb/build] Fix x86_64 x32 build
77281         A build error on x86_64 with x32 abi was reported here (
77282         https://sourceware.org/pipermail/gdb/2021-November/049787.html ):
77283         ...
77284         gdb/nat/amd64-linux-siginfo.c:280:42: error: \
77285           'struct compat_x32_siginfo_t::<unnamed union>::<unnamed>' has no member \
77286           named 'si_addr_bnd'
77287         280 | #define cpt_si_lower _sifields._sigfault.si_addr_bnd._lower
77288         | ^~~~~~~~~~~
77289         gdb/nat/amd64-linux-siginfo.c:337:38: note: in expansion of macro 'cpt_si_lower'
77290         337 | to->cpt_si_lower = from_ptrace.cpt_si_lower;
77291         | ^~~~~~~~~~~~
77292         ...
77293
77294         The problem is that code added in commit d3d7d1ba3bb "[gdb/tdep] Handle
77295         si_addr_bnd in compat_siginfo_from_siginfo" doesn't compile on an x86_64 x32
77296         setup, because compat_x32_siginfo_t doesn't have the si_addr_bnd fields.
77297
77298         Fix this conservatively by disabling the code for x32.
77299
77300         Tested on x86_64-linux.
77301
77302 2021-11-22  Nelson Chu  <nelson.chu@sifive.com>
77303
77304         RISC-V: PR28610, Fix ASAN heap-buffer-overflow error in riscv_update_subset.
77305         The architecture parser in riscv_update_subset shouldn't check (or access)
77306         the pointer space which doesn't exist.
77307
77308         bfd/
77309                 pr 28610
77310                 * elfxx-riscv.c (riscv_update_subset): The architecture parser
77311                 shouldn't access the pointer space which doesn't exist.
77312
77313 2021-11-22  Tom de Vries  <tdevries@suse.de>
77314
77315         [gdb/symtab] Support .debug_line with DW_FORM_line_strp
77316         I noticed a new gcc option -gdwarf64 and tried it out (using gcc 11.2.1).
77317
77318         With a test-case hello.c:
77319         ...
77320         int
77321         main (void)
77322         {
77323           printf ("hello\n");
77324           return 0;
77325         }
77326         ...
77327         compiled like this:
77328         ...
77329         $ gcc -g -gdwarf64 ~/hello.c
77330         ...
77331         I ran into:
77332         ...
77333         $ gdb -q -batch a.out
77334         DW_FORM_line_strp pointing outside of .debug_line_str section \
77335           [in module a.out]
77336         ...
77337
77338         Debugging gdb revealed that the string offset is:
77339         ...
77340         (gdb) up
77341             objfile=0x182ab70, str_offset=1378684502312,
77342             form_name=0xeae9b5 "DW_FORM_line_strp")
77343             at src/gdb/dwarf2/section.c:208
77344         208         error (_("%s pointing outside of %s section [in module %s]"),
77345         (gdb) p /x str_offset
77346         $1 = 0x14100000128
77347         (gdb)
77348         ...
77349         which is read when parsing a .debug_line entry at 0x1e0.
77350
77351         Looking with readelf at the 0x1e0 entry, we have:
77352         ...
77353          The Directory Table (offset 0x202, lines 2, columns 1):
77354           Entry Name
77355           0     (indirect line string, offset: 0x128): /data/gdb_versions/devel
77356           1     (indirect line string, offset: 0x141): /home/vries
77357         ...
77358         which in a hexdump looks like:
77359         ...
77360           0x00000200 1f022801 00004101 00000201 1f020f02
77361         ...
77362
77363         What happens is the following:
77364         - readelf interprets the DW_FORM_line_strp reference to .debug_line_str as
77365           a 4 byte value, and sees entries 0x00000128 and 0x00000141.
77366         - gdb instead interprets it as an 8 byte value, and sees as first entry
77367           0x0000014100000128, which is too big so it bails out.
77368
77369         AFAIU, gdb is wrong.  It assumes DW_FORM_line_strp is 8 bytes on the basis
77370         that the corresponding CU is 64-bit DWARF.  However, the .debug_line
77371         contribution has it's own initial_length field, and encodes there that it's
77372         32-bit DWARF.
77373
77374         Fix this by using the correct offset size for DW_FORM_line_strp references
77375         in .debug_line.
77376
77377         Note: the described test-case does trigger this complaint (both with and
77378         without this patch):
77379         ...
77380         $ gdb -q -batch -iex "set complaints 10" a.out
77381         During symbol reading: intermixed 32-bit and 64-bit DWARF sections
77382         ...
77383
77384         The reason that the CU has 64-bit dwarf is because -gdwarf64 was passed to
77385         gcc.  The reason that the .debug_line entry has 32-bit dwarf is because that's
77386         what gas generates.  Perhaps this is complaint-worthy, but I don't think it
77387         is wrong.
77388
77389         Tested on x86_64-linux, using native and target board dwarf64.exp.
77390
77391 2021-11-22  Tom de Vries  <tdevries@suse.de>
77392
77393         [gdb/testsuite] Add target board dwarf64.exp
77394         Add a new target board dwarf64.exp, that runs test with -gdwarf64.
77395
77396         Tested on x86_64-linux.
77397
77398 2021-11-22  Tom de Vries  <tdevries@suse.de>
77399
77400         [gdb/testsuite] Support .debug_line v5 in dwarf assembler
77401         The v5 section version for .debug_line has:
77402         - two new fields address_size and segment_selector_size
77403         - a different way to encode the directory and filename tables.
77404
77405         Add support for this in the dwarf assembler.
77406
77407         For now, make the v5 directory and filename tables work with the v4 type of
77408         specification in the test-cases by adding duplicate entries at position 0.
77409
77410         This will need to be properly fixed with an intrusive fix that changes how
77411         directory and filename entries are specified in the test-cases, f.i:
77412         ...
77413         set diridx [include_dir "${srcdir}/${subdir}"]
77414         set fileidx [file_name "$srcfile" $diridx]
77415         ...
77416
77417         Tested on x86_64-linux.
77418
77419 2021-11-22  Tom de Vries  <tdevries@suse.de>
77420
77421         [gdb/testsuite] Factor out _line_finalize_header
77422         Rather than generate dwarf immediately in procs include_dir and file_name,
77423         postpone generation and store the data in variables.  Then handle the
77424         generation in a new proc _line_finalize_header.
77425
77426         Tested on x86-64-linux.
77427
77428 2021-11-22  Tom de Vries  <tdevries@suse.de>
77429
77430         [gdb/testsuite] Support .debug_line v4 in dwarf assembler
77431         The .debug_line header got a new field in v4:
77432         maximum_operations_per_instruction.
77433
77434         Generate this field in the dwarf assembler, for now hardcoding the value to 1,
77435         meaning non-VLIW.
77436
77437         Tested on x86_64-linux.
77438
77439 2021-11-22  Tom de Vries  <tdevries@suse.de>
77440
77441         [gdb/testsuite] Add test-case gdb.dwarf2/dw2-lines.exp
77442         Add a new test-case gdb.dwarf2/dw2-lines.exp that tests various .debug_line
77443         sections.
77444
77445         Tested on x86_64-linux.
77446
77447 2021-11-22  Tom de Vries  <tdevries@suse.de>
77448
77449         [gdb/testsuite] Speed up MACRO_AT_* calls
77450         Currently, for each MACRO_AT_range or MACRO_AT_func in dwarf assembly the
77451         following is done:
77452         - $srcdir/$subdir/$srcfile is compiled to an executable using
77453           flags "debug"
77454         - a new gdb instance is started
77455         - the new executable is loaded.
77456
77457         This is inefficient, because the executable is identical within the same
77458         Dwarf::assemble call.
77459
77460         Share the gdb instance in the same Dwarf::assemble invocation, which speeds
77461         up a make check with RUNTESTFLAGS like this to catch all dwarf assembly
77462         test-cases:
77463         ...
77464         rtf=$(echo $(cd src/gdb/testsuite; find gdb.* -type f -name "*.exp" \
77465               | xargs grep -l Dwarf::assemble))
77466         ...
77467         from:
77468         ...
77469         real    1m39.916s
77470         user    1m25.668s
77471         sys     0m21.377s
77472         ...
77473         to:
77474         ...
77475         real    1m29.512s
77476         user    1m17.316s
77477         sys     0m19.100s
77478         ...
77479
77480         Tested on x86_64-linux.
77481
77482 2021-11-22  GDB Administrator  <gdbadmin@sourceware.org>
77483
77484         Automatic date update in version.in
77485
77486 2021-11-21  Lancelot SIX  <lsix@lancelotsix.com>
77487
77488         gdb/testsuite: Remove duplicates in gdb.base/catch-signal.exp
77489         When running the testsuite I have the following:
77490
77491             Running .../gdb/testsuite/gdb.base/catch-signal.exp ...
77492             DUPLICATE: gdb.base/catch-signal.exp: SIGHUP: continue
77493             DUPLICATE: gdb.base/catch-signal.exp: SIGHUP: continue
77494             DUPLICATE: gdb.base/catch-signal.exp: 1: continue
77495             DUPLICATE: gdb.base/catch-signal.exp: 1: continue
77496             DUPLICATE: gdb.base/catch-signal.exp: SIGHUP SIGUSR2: continue
77497             DUPLICATE: gdb.base/catch-signal.exp: SIGHUP SIGUSR2: continue
77498
77499         This patch removes DUPLICATE in gdb.base/catch-signal.exp by explicitly
77500         giving names to the offending 'gdb_test "continue"' statements to make
77501         them distinct.
77502
77503         Tested on x86_64-linux.
77504
77505 2021-11-21  Mike Frysinger  <vapier@gentoo.org>
77506
77507         sim: v850: fix cpu_option testsuite handling
77508         The v850 testsuite code has been testing the $opt variable, but this
77509         was never actually set anywhere globally or v850-specific.  Instead,
77510         this was a random variable leaking out of the sh testsuite code.  As
77511         far as I can tell, it has always been this way.  That means the code
77512         only ever tested the v850 cpu target (which is the default).
77513
77514         This failure can be easily seen in practice by running the v850 code
77515         in isolation and seeing it crash:
77516         $ runtest v850/allinsns.exp
77517         ...
77518         Running target unix
77519         Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
77520         Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
77521         Using ../../../sim/testsuite/config/default.exp as tool-and-target-specific interface file.
77522         WARNING: Assuming target board is the local machine (which is probably wrong).
77523         You may need to set your DEJAGNU environment variable.
77524         Running ../../../sim/testsuite/v850/allinsns.exp ...
77525         ERROR: tcl error sourcing ../../../sim/testsuite/v850/allinsns.exp.
77526         ERROR: tcl error code TCL LOOKUP VARNAME opt
77527         ERROR: can't read "opt": no such variable
77528             while executing
77529         "switch -regexp -- $opt {
77530
77531         Backing up a bit, the reason for this logic in the first place is
77532         because the common sim testsuite code makes an assumption about the
77533         assembler options with cpu_option -- the option and its value are
77534         always separated by an =.  This is not the case with v850.  So tweak
77535         the core sim logic a bit to support omitting the = so that we can
77536         switch v850 to the standard all_machs setting and avoid opt entirely.
77537
77538 2021-11-21  GDB Administrator  <gdbadmin@sourceware.org>
77539
77540         Automatic date update in version.in
77541
77542 2021-11-20  Jeff Law  <jeffreyalaw@gmail.com>
77543
77544             Fix intermittent failures on the H8, particularly H8/SX tests.
77545             The upstream GCC tester has  showed spurious execution failures on the
77546             H8 target for the H8/SX multilibs. I suspected memory corruption or an
77547             uninitialized variable early as the same binary would sometimes work and
77548             sometimes it got the wrong result. Worse yet, the point where the test
77549             determined it was getting the wrong result would change.
77550
77551             Because it only happened on the H8/SX variant I was able to zero in on
77552             the "mova" support and the "short form" of those instructions in particular.
77553
77554             As the code stands it checks if code->op3.type == 0 to try and identify cases
77555             where op3 wasn't filled in and thus we've got the short form of the mova
77556             instruction.
77557
77558             But for the short-form of those instructions we never set any of the "op3"
77559             data structure. We get whatever was lying around -- it's usually zero and
77560              thus things usually work, but if the stale data was nonzero, then we'd
77561             fail to recognize the instruction as a short-form and fail to set up the
77562             various fields appropriately.
77563
77564             I initially initialized the op3.type field to zero, but didn't like that
77565              because it was inconsistent with how other operands were initialized.
77566             Bringing consistency meant using -1 as the initializer value and adjusting
77567             the check for short form mova appropriately.
77568
77569             I've had this in the upstream GCC tester for perhaps a year at this point
77570             and haven't seen any of the intermittent failures again.
77571
77572 2021-11-20  Simon Marchi  <simon.marchi@efficios.com>
77573
77574         gdbsupport: fix array-view compilation with c++11 && _GLIBCXX_DEBUG
77575         When building with -std=c++11 and -D_GLIBCXX_DEBUG=1, we get some errors
77576         like:
77577
77578               CXX    unittests/array-view-selftests.o
77579             In file included from /home/smarchi/src/binutils-gdb/gdb/utils.h:25,
77580                              from /home/smarchi/src/binutils-gdb/gdb/defs.h:630,
77581                              from /home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:20:
77582             /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/array-view.h: In instantiation of constexpr gdb::array_view<T> gdb::array_view<T>::slice(gdb::array_view<T>::size_type, gdb::array_view<T>::size_type) const [with T = unsigned char; gdb::array_view<T>::size_type = long unsigned int:
77583             /home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:532:29:   required from here
77584             /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/array-view.h:192:3: error: body of constexpr function constexpr gdb::array_view<T> gdb::array_view<T>::slice(gdb::array_view<T>::size_type, gdb::array_view<T>::size_type) const [with T = unsigned char; gdb::array_view<T>::size_type = long unsigned int not a return-statement
77585               192 |   }
77586                   |   ^
77587
77588         This is because constexpr functions in c++11 can only consist of a
77589         single return statement, so we can't have the gdb_assert in there.  Make
77590         the gdb_assert presence conditional to the __cplusplus version, to
77591         enable it only for c++14 and later.
77592
77593         Change-Id: I2ac33f7b4bd1765ddc3ac8d07445b16ac1f340f0
77594
77595 2021-11-20  Tom de Vries  <tdevries@suse.de>
77596
77597         [gdb/build] Check if libsource-highlight is usable
77598         When building gdb with g++ 4.8.5, I ran into:
77599         ...
77600         ld: source-cache.o: in function `source_cache::ensure(symtab*)':
77601         source-cache.c:207: undefined reference to \
77602           srchilite::SourceHighlight::SourceHighlight(std::string const&)
77603         ...
77604
77605         [ I configured gdb without explicit settings related to source-highlight, so
77606         we're excercising the enable_source_highlight=auto scenario. ]
77607
77608         The problem is that:
77609         - the source-highlight library is build with system compiler
77610           g++ 7.5.0 which uses the new libstdc++ library abi (see
77611           https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html )
77612         - gdb is build using g++ 4.8.5 which uses the old abi.
77613
77614         [ There's a compatibility macro _GLIBCXX_USE_CXX11_ABI, but that doesn't work
77615         for this case.  Instead, it enables the opposite case where the
77616         source-highlight library is build with g++ 4.8.5 and gdb is build with
77617         g++ 7.5.0. ]
77618
77619         Fix this by checking whether the source-highlight library is usable during
77620         configuration.
77621
77622         In the enable_source_highlight=auto scenario, this allows the build to skip
77623         the unusable library and finish successfully.
77624
77625         In the enable_source_highlight=yes scenario, this allows the build to error
77626         out earlier.
77627
77628         Tested on x86_64-linux.
77629
77630 2021-11-20  Clément Chigot  <clement.chigot@atos.net>
77631
77632         bfd: remove wrong comment in xcofflink.c
77633         This comment was long time ago associated to the function
77634         "xcoff_build_ldsyms" which have since been replaced by
77635         "xcoff_build_ldsym".
77636
77637                 * xcofflink.c: Remove wrong comment.
77638
77639 2021-11-20  Mike Frysinger  <vapier@gentoo.org>
77640
77641         sim: bfin: fix short --env usage in testsuite
77642         Now that we have more than one option that matches "--env", the test
77643         config here doesn't work.  Use the explicit --environment.
77644
77645 2021-11-20  GDB Administrator  <gdbadmin@sourceware.org>
77646
77647         Automatic date update in version.in
77648
77649 2021-11-19  H.J. Lu  <hjl.tools@gmail.com>
77650
77651         elfedit: Align --[in|out]put-abiversion usage
77652         Align
77653
77654           --input-abiversion [0-255]  Set input ABIVERSION
77655           --output-abiversion [0-255] Set output ABIVERSION
77656
77657         instead of
77658
77659           --input-abiversion [0-255]
77660                                       Set input ABIVERSION
77661           --output-abiversion [0-255]
77662                                       Set output ABIVERSION
77663
77664                 * elfedit.c (usage): Align --[in|out]put-abiversion usage.
77665
77666 2021-11-19  Tom de Vries  <tdevries@suse.de>
77667
77668         [gdb/testsuite] Handle runto fail in gdb.mi/mi-var-cp.exp
77669         On OBS I ran into:
77670         ...
77671         PASS: gdb.mi/mi-var-cp.exp: run to mi-var-cp.cc:81 (set breakpoint)
77672         UNRESOLVED: gdb.mi/mi-var-cp.exp: unable to start target
77673         ...
77674         followed by 81 FAILs and two more UNRESOLVEDs.
77675
77676         I didn't manage to reproduce this, but I did notice that the initial
77677         problem causing the UNRESOLVED caused all subsequent UNRESOLVEDs and FAILs.
77678
77679         I emulated the problem by commenting out the send_gdb "run\n" in
77680         mi_run_cmd_full.
77681
77682         Fix this by:
77683         - handling mi_run_cmd failure in mi_get_inline_test
77684         - handling mi_run_inline_test failure in gdb.mi/mi-var-cp.exp, and
77685           other test-cases using mi_get_inline_test
77686
77687         Tested on x86_64-linux.
77688
77689 2021-11-19  Tom de Vries  <tdevries@suse.de>
77690
77691         [gdb/testsuite] Fix 64-bit dwarf test-cases with -m32
77692         When running test-case gdb.dwarf2/loc-sec-offset.exp with target board -m32,
77693         I run into:
77694         ...
77695         builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -m32 \
77696           -fdiagnostics-color=never -c -o loc-sec-offset-dw641.o \
77697           loc-sec-offset-dw64.S^M
77698         as: loc-sec-offset-dw641.o: unsupported relocation type: 0x1^M
77699         loc-sec-offset-dw64.S: Assembler messages:^M
77700         loc-sec-offset-dw64.S:29: Error: cannot represent relocation type \
77701           BFD_RELOC_64^M
77702         ...
77703
77704         Looking at line 29, we have:
77705         ...
77706                 .8byte        .Labbrev1_begin   /* Abbrevs */
77707         ...
77708
77709         It would be nice if the assembler could handle this somehow.  But I guess
77710         it's not unreasonable that an assembler for a 32-bit architecture will object
77711         to handling 64-bit labels.
77712
77713         Instead, work around this in the dwarf assembler by emitting:
77714         ...
77715                 .4byte        .Labbrev1_begin   /* Abbrevs (lsw) */
77716                 .4byte        0                 /* Abbrevs (msw) */
77717         ...
77718
77719         Tested on x86_64-linux with target board unix/-m32.
77720
77721         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28383
77722
77723 2021-11-19  Tom de Vries  <tdevries@suse.de>
77724
77725         [gdb/testsuite] Fix gdb.threads/thread-specific-bp.exp
77726         On OBS I ran into a failure in test-case gdb.threads/thread-specific-bp.exp:
77727         ...
77728         (gdb) PASS: gdb.threads/thread-specific-bp.exp: non-stop: continue to end
77729         info breakpoint^M
77730         Num     Type           Disp Enb Address            What^M
77731         1       breakpoint     keep y   0x0000555555555167 in main at $src:36^M
77732                 breakpoint already hit 1 time^M
77733         2       breakpoint     keep y   0x0000555555555151 in start at $src:23^M
77734                 breakpoint already hit 1 time^M
77735         3       breakpoint     keep y   0x0000555555555167 in main at $src:36 thread 2^M
77736                 stop only in thread 2^M
77737         4       breakpoint     keep y   0x000055555555515c in end at $src:29^M
77738                 breakpoint already hit 1 time^M
77739         (gdb) [Thread 0x7ffff7db1640 (LWP 19984) exited]^M
77740         Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M
77741         FAIL: gdb.threads/thread-specific-bp.exp: non-stop: \
77742           thread-specific breakpoint was deleted (timeout)
77743         ...
77744
77745         Fix this by waiting for the "[Thread 0x7ffff7db1640 (LWP 19984) exited]"
77746         message before issuing the "info breakpoint command".
77747
77748         Tested on x86_64-linux.
77749
77750 2021-11-19  Christina Schimpe  <christina.schimpe@intel.com>
77751
77752         gdb/testsuite: Extend tests for print of cv qualifiers
77753         This commit supplements whatis and ptype command tests for print of
77754         const-volatile qualifiers.
77755
77756         gdb/testsuite/ChangeLog:
77757         2021-11-16  Christina Schimpe  <christina.schimpe@intel.com>
77758
77759                 * gdb.cp/ptype-cv-cp.cc: New const and volatile typedef
77760                   variables.
77761                 * gdb.cp/ptype-cv-cp.exp: Add new tests.
77762
77763 2021-11-19  Christina Schimpe  <christina.schimpe@intel.com>
77764
77765         gdb: Print cv qualifiers if class attributes are substituted
77766         Make ptype print const/volatile qualifiers when template or typedef
77767         attributes are substituted.
77768
77769         For a programm like
77770         ~~~
77771         template<typename DataT>
77772         class Cfoo
77773         {
77774           typedef float myfloat;
77775         public:
77776           DataT me0;
77777           const DataT me1=1;
77778           const myfloat me2=2.0;
77779         };
77780
77781         int main()
77782         {
77783           Cfoo<int> cfoo;
77784           return 0;
77785         }
77786         ~~~
77787
77788         gdb outputs the following type for cfoo's attributes:
77789
77790         ~~~
77791         (gdb) b 14
77792         Breakpoint 1 at 0x1170: file tmp.cc, line 14.
77793         (gdb) run
77794         Starting program: /tmp
77795
77796         Breakpoint 1, main () at tmp.cc:14
77797         14        return 0;
77798         (gdb) ptype cfoo
77799         type = class Cfoo<int> [with DataT = int] {
77800           public:
77801             DataT me0;
77802             DataT me1;
77803             myfloat me2;
77804
77805           private:
77806             typedef float myfloat;
77807         }
77808
77809         ~~~
77810
77811         The cv qualifiers (const in this case) are ignored for me1 and me2.
77812
77813         After:
77814         ~~~
77815         (gdb) ptype cfoo
77816         type = class Cfoo<int> [with DataT = int] {
77817           public:
77818             DataT me0;
77819             const DataT me1;
77820             const myfloat me2;
77821
77822           private:
77823             typedef float myfloat;
77824         }
77825         ~~~
77826
77827         gdb/ChangeLog:
77828         2021-11-16  Christina Schimpe  <christina.schimpe@intel.com>
77829
77830                 * gdb/c-typeprint.c: Print cv qualifiers in case of parameter
77831                   substitution.
77832
77833         gdb/testsuite/ChangeLog:
77834         2021-11-16  Christina Schimpe  <christina.schimpe@intel.com>
77835
77836                 * gdb.cp/templates.cc:  New template class Cfoo with const,
77837                   template, typdef and integer attributes.
77838                 * gdb.cp/templates.exp: Add new test using ptype and ptype/r
77839                   commmands for template class CFoo.
77840
77841 2021-11-19  Nelson Chu  <nelson.chu@sifive.com>
77842
77843         RISC-V: Support new .option arch directive.
77844         https://github.com/riscv/riscv-asm-manual/pull/67
77845
77846         Format:
77847         .option arch, +<extension><version>, ...
77848         .option arch, -<extension>
77849         .option arch, =<ISA string>
77850
77851         The new direcitve is used to enable/disable extensions for the specific
77852         code region.  For example,
77853
77854         .attribute arch, "rv64ic"   # arch = rv64i2p0_c2p0
77855         .option push
77856         .option arch, +d2p0, -c     # arch = rv64i2p0_f2p0_d2p0, f is added implied
77857         .option arch, =rv32gc       # arch = rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0
77858         .option pop                 # arch = rv64i2p0_c2p0
77859
77860         Note that,
77861         1. ".option rvc/norvc" have the same behavior as ".option arch +c/-c".
77862         2. ".option arch -i" is illegal, since we cannot remove base i extension.
77863         3. If arch=rv64i2p0, then ".option arch, +i3p0" will update the i's version
77864            from 2.0 to 3.0.
77865         4. If arch=rv64i3p0, then ".option arch, +i" will update the i's version
77866            from 2.0 to the default one according to the chosen isa spec.
77867
77868         bfd/
77869                 * elfxx-riscv.c (riscv_add_subset): If the subset is already added,
77870                 and the new versions are not RISCV_UNKNOWN_VERSION, then update the
77871                 versions to the subset list.
77872                 (riscv_copy_subset): New function.  Copy the subset from list.
77873                 (riscv_copy_subset_list): New function.  Return the new copyed list.
77874                 (riscv_update_subset): Updated to make .option arch directives workable.
77875                 * elfxx-riscv.h: Updated.
77876         gas/
77877                 * config/tc-riscv.c (riscv_subsets): Defined as a pointer.
77878                 (riscv_rps_as): Init the subset_list to NULL, we will set it later
77879                 once riscv_opts_stack is created or updated.
77880                 (struct riscv_option_stack, riscv_opts_stack): Moved forward.
77881                 (riscv_set_arch): Updated.
77882                 (s_riscv_option): Support new .option arch directive, to add, remove
77883                 or update subsets for the specific code region.
77884                 (riscv_write_out_attrs): Updated.
77885                 * doc/c-riscv.texi: Added document for new .option arch directive.
77886                 * testsuite/gas/riscv/option-arch-01a.d: New testcase.
77887                 * testsuite/gas/riscv/option-arch-01b.d: Likewise.
77888                 * testsuite/gas/riscv/option-arch-01.s: Likewise..
77889                 * testsuite/gas/riscv/option-arch-02.d: Likewise.
77890                 * testsuite/gas/riscv/option-arch-02.s: Likewise.
77891                 * testsuite/gas/riscv/option-arch-fail.d: Likewise.
77892                 * testsuite/gas/riscv/option-arch-fail.l: Likewise.
77893                 * testsuite/gas/riscv/option-arch-fail.s: Likewise.
77894
77895 2021-11-19  Alan Modra  <amodra@gmail.com>
77896
77897         Re: Add multibyte character warning option to the assembler.
77898         On hppa*-hp-hpux* run_dump_test edits the test file, adjusting .comm
77899         directives to suit those target's unusual syntax.  Thus gas is passed
77900         a temporary file name.
77901
77902                 * testsuite/gas/all/multibyte1.l: Ignore file name.
77903
77904 2021-11-19  Mike Frysinger  <vapier@gentoo.org>
77905
77906         sim: install various doc files
77907
77908 2021-11-19  Nelson Chu  <nelson.chu@sifive.com>
77909
77910         RISC-V: Support STO_RISCV_VARIANT_CC and DT_RISCV_VARIANT_CC.
77911         This is the original discussion,
77912         https://github.com/riscv/riscv-elf-psabi-doc/pull/190
77913
77914         And here is the glibc part,
77915         https://sourceware.org/pipermail/libc-alpha/2021-August/129931.html
77916
77917         For binutils part, we need to support a new direcitve: .variant_cc.
77918         The function symbol marked by .variant_cc means it need to be resolved
77919         directly without resolver for dynamic linker.  We also add a new dynamic
77920         entry, STO_RISCV_VARIANT_CC, to indicate there are symbols with the
77921         special attribute in the dynamic symbol table of the object.
77922
77923         I heard that llvm already have supported this in their mainline, so
77924         I think it's time to commit this.
77925
77926         bfd/
77927                 * elfnn-riscv.c (riscv_elf_link_hash_table): Added variant_cc
77928                 flag. It is used to check if relocations for variant CC symbols
77929                 may be present.
77930                 (allocate_dynrelocs): If the symbol has STO_RISCV_VARIANT_CC
77931                 flag, then raise the variant_cc flag of riscv_elf_link_hash_table.
77932                 (riscv_elf_size_dynamic_sections): Added dynamic entry for
77933                 variant_cc.
77934                 (riscv_elf_merge_symbol_attribute): New function, used to merge
77935                 non-visibility st_other attributes, including STO_RISCV_VARIANT_CC.
77936         binutils/
77937                 * readelf.c (get_riscv_dynamic_type): New function.
77938                 (get_dynamic_type): Called get_riscv_dynamic_type for riscv targets.
77939                 (get_riscv_symbol_other): New function.
77940                 (get_symbol_other): Called get_riscv_symbol_other for riscv targets.
77941         gas/
77942                 * config/tc-riscv.c (s_variant_cc): Marked symbol that it follows a
77943                 variant CC convention.
77944                 (riscv_elf_copy_symbol_attributes): Same as elf_copy_symbol_attributes,
77945                 but without copying st_other.  If a function symbol has special st_other
77946                 value set via directives, then attaching an IFUNC resolver to that symbol
77947                 should not override the st_other setting.
77948                 (riscv_pseudo_table): Support variant_cc diretive.
77949                 * config/tc-riscv.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Defined.
77950                 * testsuite/gas/riscv/variant_cc-set.d: New testcase.
77951                 * testsuite/gas/riscv/variant_cc-set.s: Likewise.
77952                 * testsuite/gas/riscv/variant_cc.d: Likewise.
77953                 * testsuite/gas/riscv/variant_cc.s: Likewise.
77954         include/
77955                 * elf/riscv.h (DT_RISCV_VARIANT_CC): Defined to (DT_LOPROC + 1).
77956                 (STO_RISCV_VARIANT_CC): Defined to 0x80.
77957         ld/
77958                 * testsuite/ld-riscv-elf/variant_cc-1.s: New testcase.
77959                 * testsuite/ld-riscv-elf/variant_cc-2.s: Likewise.
77960                 * testsuite/ld-riscv-elf/variant_cc-now.d: Likewise.
77961                 * testsuite/ld-riscv-elf/variant_cc-r.d: Likewise.
77962                 * testsuite/ld-riscv-elf/variant_cc-shared.d: Likewise.
77963                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
77964
77965 2021-11-19  Mike Frysinger  <vapier@gentoo.org>
77966
77967         sim: use program_transform_name for libsim
77968         Instead of always using target_alias as a prefix on the name, use
77969         program_transform_name instead so that the library is scoped in the
77970         same way as the run program.
77971
77972         sim: avoid installing headers when there is no sim
77973         If we aren't building any sims, don't install the sim headers as they
77974         won't be useful to anyone.
77975
77976 2021-11-19  GDB Administrator  <gdbadmin@sourceware.org>
77977
77978         Automatic date update in version.in
77979
77980 2021-11-18  Kevin Buettner  <kevinb@redhat.com>
77981
77982         dprintf-execution-x-script.exp: Adjust test for native-extended-gdbserver
77983         Without this commit, doing...
77984
77985         make check RUNTESTFLAGS="--target_board=native-extended-gdbserver" \
77986                    TESTS="gdb.base/dprintf-execution-x-script.exp"
77987
77988         ...will show one failure.
77989
77990         Here's a snippet from gdb.log showing the circumstances - I've trimmed
77991         the paths for readability:
77992
77993         builtin_spawn gdb -nw -nx -data-directory data-directory -iex set height 0 -iex set width 0 -iex set auto-connect-native-target off -iex set sysroot -ex set height unlimited -x testsuite/gdb.base/dprintf-execution-x-script.gdb --args testsuite/outputs/gdb.base/dprintf-execution-x-script/dprintf-execution-x-script
77994         ...
77995         Reading symbols from testsuite/outputs/gdb.base/dprintf-execution-x-script/dprintf-execution-x-script...
77996         Dprintf 1 at 0x40116e: file testsuite/gdb.base/dprintf-execution-x-script.c, line 38.
77997         Breakpoint 2 at 0x40113a: file testsuite/gdb.base/dprintf-execution-x-script.c, line 26.
77998         testsuite/gdb.base/dprintf-execution-x-script.gdb:21: Error in sourced command file:
77999         Don't know how to run.  Try "help target".
78000         (gdb) FAIL: gdb.base/dprintf-execution-x-script.exp: load and run script with -x
78001         ...
78002         GNU gdb (GDB) 12.0.50.20211118-git
78003         Copyright (C) 2021 Free Software Foundation, Inc.
78004         ...
78005         (gdb) set height 0
78006         (gdb) set width 0
78007         (gdb) builtin_spawn gdbserver/gdbserver --once --multi localhost:2346
78008         Listening on port 2346
78009         target extended-remote localhost:2346
78010         Remote debugging using localhost:2346
78011         ...
78012         [Tests after this point will pass.]
78013
78014         Note that the command which spawns gdb prevents the gdb script from
78015         using the native target via "-iex set auto-connect-native-target off".
78016
78017         Moreover, the script in question contains a "run" command, so GDB
78018         doesn't know how to run (since it's prevented from using the native
78019         target and no alternate "target" command has been issued.  But, once
78020         GDB finishes starting up, the test will spawn a gdbserver and then
78021         connect to it.  The other (two) tests after this point both pass.
78022
78023         I've fixed this by using gdb_test_multiple instead of gdb_test.
78024         When a "Don't know how to run message" is received, the test is
78025         unsupported.
78026
78027         I've also added a comment explaining the reason for needing to check
78028         for "Don't know how to run" despite bailing out at the top of the test
78029         via:
78030
78031           if ![target_can_use_run_cmd] {
78032               return 0
78033           }
78034
78035 2021-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
78036
78037         gdb: fix array-view-selftests.c build with g++ 4.8
78038         When building with g++ 4.8, I get:
78039
78040             CXX    unittests/array-view-selftests.o
78041           /home/smarchi/src/binutils-gdb/gdb/unittests/array-view-selftests.c:123:42: error: expected 'class' before 'Container'
78042            template<template<typename ...> typename Container>
78043                                                     ^
78044
78045         I am no C++ template expert, but it looks like if I change "typename" for
78046         "class", as the compiler kind of suggests, the code compiles.
78047
78048         Change-Id: I9c3edd29fb2b190069f0ce0dbf3bc3604d175f48
78049
78050 2021-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
78051
78052         gdb: fix ia64-tdep.c build with g++ 4.8
78053         When building with g++ 4.8, I get:
78054
78055               CXX    ia64-tdep.o
78056             /home/smarchi/src/binutils-gdb/gdb/ia64-tdep.c:3862:1: error: could not convert '{ia64_allocate_new_rse_frame, ia64_store_argument_in_slot, ia64_set_function_addr}' from '<brace
78057         -enclosed initializer list>' to 'const ia64_infcall_ops'
78058              };
78059              ^
78060
78061         This happens since commit 345bd07cce3 ("gdb: fix gdbarch_tdep ODR
78062         violation"), which added default values for ia64_infcall_ops fields.  It
78063         looks like g++ 4.8 doesn't like initializing the ia64_infcall_ops object
78064         using the brace-enclosed initializer list when the ia64_infcall_ops
78065         fields are assigned default values.
78066
78067         Later compilers don't have a problem with that, so I suppose that the
78068         code is correct, but still, change it to make gcc 4.8 happy.  Don't
78069         initialize the fields of ia64_infcall_ops directly, instead
78070         default-initialize ia64_gdbarch_tdep::infcall_ops.
78071
78072         Change-Id: I35e3a61abd7b7bbcafe6cb207078c738c5266d76
78073
78074 2021-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
78075
78076         gdb: move AIX_TEXT_SEGMENT_BASE to rs6000-aix-tdep.c, remove rs6000-tdep.h
78077         The contents of rs6000-tdep.h (AIX_TEXT_SEGMENT_BASE) is AIX-specific,
78078         so I thought that this file should be named rs6000-aix-tdep.h.  But
78079         there's already a rs6000-aix-tdep.h, so then I though
78080         AIX_TEXT_SEGMENT_BASE should simply be moved there, and rs6000-tdep.h
78081         deleted.  But then I realized that AIX_TEXT_SEGMENT_BASE is only used in
78082         rs6000-aix-tdep.c, so move it to the beginning of that file.
78083
78084         Change-Id: Ia212c6fae202f31aedb46575821cd642beeda7a3
78085
78086 2021-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
78087
78088         gdb: rename rs6000-nat.c to rs6000-aix-nat.c
78089         This file seems to be AIX-specific, according to its contents and
78090         configure.nat.  Rename it to rs6000-aix-nat.c, to make that clear (and
78091         to follow the convention).
78092
78093         Change-Id: Ib418dddc6b79b2e28f64431121742b5e87f5f4f5
78094
78095 2021-11-18  Tom de Vries  <tdevries@suse.de>
78096
78097         [gdb/doc] Fix negative repeat count examining memory example
78098         The documentation for the examining memory command x contains an example:
78099         ...
78100         You can also specify a negative repeat count to examine memory backward from
78101         the given address.  For example, 'x/-3uh 0x54320' prints three halfwords (h)
78102         at 0x54314, 0x54328, and 0x5431c.
78103         ...
78104
78105         The 0x54328 looks like a typo, which was intended to be 0x54318.
78106
78107         But the series uses a 4-byte distance, while the halfword size used in the
78108         command means a 2-byte distance, so the series should be:
78109         ...
78110         0x5431a, 0x5431c, and 0x5431e.
78111         ...
78112
78113         Fix this by updating the addresses in the example accordingly.
78114
78115         Reported here ( https://sourceware.org/pipermail/gdb/2021-November/049784.html
78116         ).
78117
78118 2021-11-18  Nick Clifton  <nickc@redhat.com>
78119
78120         Add multibyte character warning option to the assembler.
78121                 * as.c (parse_args): Add support for --multibyte-handling.
78122                 * as.h (multibyte_handling): Declare.
78123                 * app.c (scan_for_multibyte_characters): New function.
78124                 (do_scrub_chars): Call the new function if multibyte warning is
78125                 enabled.
78126                 * input-scrub,c (input_scrub_next_buffer): Call the multibyte
78127                 scanning function if multibyte warnings are enabled.
78128                 * symbols.c (struct symbol_flags): Add multibyte_warned bit.
78129                 (symbol_init): Call the multibyte scanning function if multibyte
78130                 symbol warnings are enabled.
78131                 (S_SET_SEGMENT): Likewise.
78132                 * NEWS: Mention the new feature.
78133                 * doc/as.texi: Document the new feature.
78134                 * testsuite/gas/all/multibyte.s: New test source file.
78135                 * testsuite/gas/all/multibyte1.d: New test driver file.
78136                 * testsuite/gas/all/multibyte1.l: New test expected output.
78137                 * testsuite/gas/all/multibyte2.d: New test driver file.
78138                 * testsuite/gas/all/multibyte2.l: New test expected output.
78139                 * testsuite/gas/all/gas.exp: Run the new tests.
78140
78141 2021-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
78142
78143         gdb: include gdbarch.h in all files extending gdbarch_tdep
78144         Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") made a bunch
78145         of files define a *_gdbarch_tdep class that inherits from a gdbarch_tdep
78146         base.  But some of these files don't include gdbarch.h, where
78147         gdbarch_tdep is defined.  This may cause build errors if gdbarch.h isn't
78148         already included by chance by some other header file.  Avoid this by
78149         making them include gdbarch.h.
78150
78151         Change-Id: If433d302007e274daa4f656cfc94f769cf1aa68a
78152
78153 2021-11-18  Simon Marchi  <simon.marchi@polymtl.ca>
78154
78155         gdbsupport: make gdb_assert_not_reached accept a format string
78156         Change gdb_assert_not_reached to accept a format string plus
78157         corresponding arguments.  This allows giving more precise messages.
78158
78159         Because the format string passed by the caller is prepended with a "%s:"
78160         to add the function name, the callers can no longer pass a translated
78161         string (`_(...)`).  Make the gdb_assert_not_reached include the _(),
78162         just like the gdb_assert_fail macro just above.
78163
78164         Change-Id: Id0cfda5a57979df6cdaacaba0d55dd91ae9efee7
78165
78166 2021-11-18  Carl Love  <cel@us.ibm.com>
78167
78168         gdb fix for catch-syscall.exp
78169         Remove check_continue "execve" from Proc test_catch_syscall_execve.
78170
78171         The check_continue proceedure checs that the command, execve, starts and
78172         checks for the return from the command.  The execve command starts a new
78173         program and thus the return from the command causing the test to fail.
78174
78175         The call to proc check_continue "execve" is removed and replaced with
78176         just the call to check_call_to_syscall "execve" to verify the command
78177         executed.  The next test in proc test_catch_syscall_execve verifies that
78178         the new program started and hit the break point in main.
78179
78180         Update the check for the PowerPC architecture.  Power Little Endian systems
78181         include "le" in the name.  The istarget "power64-*-linux*" check fails to
78182         match LE sytems.  The expected string is updated to capture both Big Endian
78183         and Little Endian systems.  Power 10 LE istarget prints as:
78184         powerpc64le-unknown-linux-gnu.
78185
78186         This patch fixes three failures and the error:
78187
78188             ERROR: can't read "arch1": no such variable
78189
78190         Patch tested on Power 10 ppc64le GNU/Linux platform.
78191
78192 2021-11-18  Carl Love  <cel@us.ibm.com>
78193
78194         gdb: PowerPC fix gdb.base/break-interp.exp
78195         This patch fixes eight test failures on PowerPC for the test
78196         gdb.base/break-interp.exp. The patch adds a funtion and registers it to
78197         setup the displaced stepping for ppc-linux platform.  The patch moves the
78198         struct ppc_inferior_data to the ppc-tdep.h include file to make it visible
78199         to the ppc-linux-tdep.c and rs6000-tdep.c files.  Additionally the function
78200         get_ppc_per_inferior is made external in ppc-tdep.h to make it visible in
78201         both files.
78202
78203         Tested on Power 10 ppc64le-linux with no regressions.
78204
78205 2021-11-18  Carl Love  <cel@us.ibm.com>
78206
78207         gdb fix PowerPC test gdb.arch/ppc-longdouble.exp
78208         The test complains of duplicate tests.
78209
78210         DUPLICATE: gdb.arch/ppc-longdouble.exp: continue to breakpoint: return
78211
78212         The do_test calls gdb_continue_to_breakpoint "return".  The duplicates
78213         are the result of calling do_test three times with different arguments.
78214
78215         This patch fixes the duplicate tests by adding $name to the
78216         gdb_continue_to_breakpoint argument.
78217
78218         Patch tested on Power 10  ppc64le GNU/Linux, no duplicate tests reported,
78219         no new regression errors.
78220
78221 2021-11-18  H.J. Lu  <hjl.tools@gmail.com>
78222
78223         elf/x86: Issue an error on discarded output .plt section
78224         Issue an error, instead of crash, on discarded output .plt section.
78225
78226         bfd/
78227
78228                 PR ld/28597
78229                 * elf32-i386.c (elf_i386_finish_dynamic_sections): Issue an error
78230                 on discarded output .plt section.
78231                 * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Likewise.
78232
78233         ld/
78234
78235                 PR ld/28597
78236                 * testsuite/ld-elf/pr28597.d: New file.
78237                 * testsuite/ld-elf/pr28597.s: Likewise.
78238                 * testsuite/ld-elf/pr28597.t: Likewise.
78239
78240 2021-11-18  Tom de Vries  <tdevries@suse.de>
78241
78242         [gdb/testsuite] Add missing wait in gdb.base/signals-state-child.exp
78243         On OBS I ran into:
78244         ...
78245         (gdb) shell diff -s outputs/gdb.base/signals-state-child/standalone.txt \
78246           outputs/gdb.base/signals-state-child/gdb.txt^M
78247         diff: outputs/gdb.base/signals-state-child/standalone.txt: \
78248           No such file or directory^M
78249         (gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical
78250         ...
78251
78252         I managed to reproduce this by adding "sleep (5)" at the start of main in
78253         signals-state-child.c.
78254
78255         Fix this by waiting on the result of the spawned command.
78256
78257         Tested on x86_64-linux.
78258
78259 2021-11-18  Alan Modra  <amodra@gmail.com>
78260
78261         Re: Don't compile some opcodes files when bfd is 32-bit only
78262         Put bpf back in the 32-bit targets, even though bpf requires a 64-bit
78263         bfd.  bpf sim support apparently works without being 64-bit.
78264
78265                 * Makefile.am (TARGET64_LIBOPCODES_CFILES): Move bpf files..
78266                 (TARGET32_LIBOPCODES_CFILES): ..to here.
78267                 * Makefile.in: Regenerate.
78268
78269 2021-11-18  Alan Modra  <amodra@gmail.com>
78270
78271         Pass DEBUGINFOD_CFLAGS when compiling dwarf.c
78272         Pick up the elfutils/debuginfod.h install location -I flags from
78273         a variable set by debuginfod.m4 (via pkg.m4 and pkg-config).
78274
78275                 * Makefile.am (DEBUGINFOD_CFLAGS): Define.
78276                 (dwarf.@OBJECT@): New rule.
78277
78278 2021-11-18  jiawei  <jiawei@iscas.ac.cn>
78279
78280         RISC-V: Add testcases for z[fdq]inx
78281         Use gpr when the zfinx enable, the testcases contain float
78282         instructions that reuse by z[fdq]inx.
78283
78284         gas/ChangeLog:
78285
78286         * testsuite/gas/riscv/zdinx.d: New test.
78287         * testsuite/gas/riscv/zdinx.s: New test.
78288         * testsuite/gas/riscv/zfinx.d: New test.
78289         * testsuite/gas/riscv/zfinx.s: New test.
78290         * testsuite/gas/riscv/zqinx.d: New test.
78291         * testsuite/gas/riscv/zqinx.s: New test.
78292
78293         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
78294
78295 2021-11-18  jiawei  <jiawei@iscas.ac.cn>
78296
78297         RISC-V: Add instructions and operand set for z[fdq]inx
78298         Reuse float instructions in INSN_CLASS_F/D/Q, use riscv_subset_supports to
78299         verify if z*inx enabled and use gpr instead of fpr when z*inx is enable.
78300
78301         bfd/ChangeLog:
78302
78303         * elfxx-riscv.c (riscv_multi_subset_supports): Added support for
78304           z*inx extension.
78305
78306         gas/ChangeLog:
78307
78308         * config/tc-riscv.c (riscv_ip): Added register choice for z*inx.
78309
78310         include/ChangeLog:
78311
78312         * opcode/riscv.h (enum riscv_insn_class): Reused INSN_CLASS_* for z*inx.
78313
78314         opcodes/ChangeLog:
78315
78316         * riscv-dis.c (riscv_disassemble_insn): Added disassemble check for
78317           z*inx.
78318         * riscv-opc.c: Reused INSN_CLASS_* for z*inx.
78319
78320         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
78321
78322 2021-11-18  jiawei  <jiawei@iscas.ac.cn>
78323
78324         RISC-V: Add mininal support for z[fdq]inx
78325         Minimal support for zfinx, zdinx, zqinx. Like f/d/q, the zqinx
78326         imply zdinx and zdinx imply zfinx, where zfinx are not compatible
78327         with f/d/q.
78328
78329         bfd/ChangeLog:
78330
78331         * elfxx-riscv.c (riscv_implicit_subsets): Added implicit rules
78332         for z*inx extensions.
78333         (riscv_supported_std_z_ext): Added entries for z*inx.
78334         (riscv_parse_check_conflicts): Added conflict check for z*inx.
78335
78336         Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
78337
78338 2021-11-18  GDB Administrator  <gdbadmin@sourceware.org>
78339
78340         Automatic date update in version.in
78341
78342 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78343
78344         aarch64: [SME] SVE2 instructions added to support SME
78345         This patch is adding new SVE2 instructions added to support SME extension.
78346         The following SVE2 instructions are added by the SME architecture:
78347         * PSEL,
78348         * REVD, SCLAMP and UCLAMP.
78349
78350         gas/ChangeLog:
78351
78352                 * config/tc-aarch64.c (parse_sme_pred_reg_with_index):
78353                 New parser.
78354                 (parse_operands): New parser.
78355                 * testsuite/gas/aarch64/sme-9-illegal.d: New test.
78356                 * testsuite/gas/aarch64/sme-9-illegal.l: New test.
78357                 * testsuite/gas/aarch64/sme-9-illegal.s: New test.
78358                 * testsuite/gas/aarch64/sme-9.d: New test.
78359                 * testsuite/gas/aarch64/sme-9.s: New test.
78360
78361         include/ChangeLog:
78362
78363                 * opcode/aarch64.h (enum aarch64_opnd): New operand
78364                 AARCH64_OPND_SME_PnT_Wm_imm.
78365
78366         opcodes/ChangeLog:
78367
78368                 * aarch64-asm.c (aarch64_ins_sme_pred_reg_with_index):
78369                 New inserter.
78370                 * aarch64-dis.c (aarch64_ext_sme_pred_reg_with_index):
78371                 New extractor.
78372                 * aarch64-opc.c (aarch64_print_operand): Printout of
78373                 OPND_SME_PnT_Wm_imm.
78374                 * aarch64-opc.h (enum aarch64_field_kind): New bitfields
78375                 FLD_SME_Rm, FLD_SME_i1, FLD_SME_tszh, FLD_SME_tszl.
78376                 * aarch64-tbl.h (OP_SVE_NN_BHSD): New qualifier.
78377                 (OP_SVE_QMQ): New qualifier.
78378                 (struct aarch64_opcode): New instructions PSEL, REVD,
78379                 SCLAMP and UCLAMP.
78380                 aarch64-asm-2.c: Regenerate.
78381                 aarch64-dis-2.c: Regenerate.
78382                 aarch64-opc-2.c: Regenerate.
78383
78384 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78385
78386         aarch64: [SME] Add new SME system registers
78387         This patch is adding miscellaneous SME related system registers.
78388
78389         gas/ChangeLog:
78390
78391                 * testsuite/gas/aarch64/sme-sysreg.d: New test.
78392                 * testsuite/gas/aarch64/sme-sysreg.s: New test.
78393                 * testsuite/gas/aarch64/sme-sysreg-illegal.d: New test.
78394                 * testsuite/gas/aarch64/sme-sysreg-illegal.l: New test.
78395                 * testsuite/gas/aarch64/sme-sysreg-illegal.s: New test.
78396
78397         opcodes/ChangeLog:
78398
78399                 * aarch64-opc.c: New system registers id_aa64smfr0_el1,
78400                 smcr_el1, smcr_el12, smcr_el2, smcr_el3, smpri_el1,
78401                 smprimap_el2, smidr_el1, tpidr2_el0 and mpamsm_el1.
78402
78403 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78404
78405         aarch64: [SME] Add SME mode selection and state access instructions
78406         This patch is adding new SME mode selection and state access instructions:
78407         * Add SMSTART and SMSTOP instructions.
78408         * Add SVCR system register.
78409
78410         gas/ChangeLog:
78411
78412                 * config/tc-aarch64.c (parse_sme_sm_za): New parser.
78413                 (parse_operands): New parser.
78414                 * testsuite/gas/aarch64/sme-8-illegal.d: New test.
78415                 * testsuite/gas/aarch64/sme-8-illegal.l: New test.
78416                 * testsuite/gas/aarch64/sme-8-illegal.s: New test.
78417                 * testsuite/gas/aarch64/sme-8.d: New test.
78418                 * testsuite/gas/aarch64/sme-8.s: New test.
78419
78420         include/ChangeLog:
78421
78422                 * opcode/aarch64.h (enum aarch64_opnd): New operand
78423                 AARCH64_OPND_SME_SM_ZA.
78424                 (enum aarch64_insn_class): New instruction classes
78425                 sme_start and sme_stop.
78426
78427         opcodes/ChangeLog:
78428
78429                 * aarch64-asm.c (aarch64_ins_pstatefield): New inserter.
78430                 (aarch64_ins_sme_sm_za): New inserter.
78431                 * aarch64-dis.c (aarch64_ext_imm): New extractor.
78432                 (aarch64_ext_pstatefield): New extractor.
78433                 (aarch64_ext_sme_sm_za): New extractor.
78434                 * aarch64-opc.c (operand_general_constraint_met_p):
78435                 New pstatefield value for SME instructions.
78436                 (aarch64_print_operand): Printout for OPND_SME_SM_ZA.
78437                 (SR_SME): New register SVCR.
78438                 * aarch64-opc.h (F_REG_IN_CRM): New register endcoding.
78439                 * aarch64-opc.h (F_IMM_IN_CRM): New immediate endcoding.
78440                 (PSTATE_ENCODE_CRM): Encode CRm field.
78441                 (PSTATE_DECODE_CRM): Decode CRm field.
78442                 (PSTATE_ENCODE_CRM_IMM): Encode CRm immediate field.
78443                 (PSTATE_DECODE_CRM_IMM): Decode CRm immediate field.
78444                 (PSTATE_ENCODE_CRM_AND_IMM): Encode CRm and immediate
78445                 field.
78446                 * aarch64-tbl.h (struct aarch64_opcode): New SMSTART
78447                 and SMSTOP instructions.
78448                 aarch64-asm-2.c: Regenerate.
78449                 aarch64-dis-2.c: Regenerate.
78450                 aarch64-opc-2.c: Regenerate.
78451
78452 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78453
78454         aarch64: [SME] Add LD1x, ST1x, LDR and STR instructions
78455         This patch is adding new loads and stores defined by SME instructions.
78456
78457         gas/ChangeLog:
78458
78459                 * config/tc-aarch64.c (parse_sme_address): New parser.
78460                 (parse_sme_za_hv_tiles_operand_with_braces): New parser.
78461                 (parse_sme_za_array): New parser.
78462                 (output_operand_error_record): Print error details if
78463                 present.
78464                 (parse_operands): Support new operands.
78465                 * testsuite/gas/aarch64/sme-5-illegal.d: New test.
78466                 * testsuite/gas/aarch64/sme-5-illegal.l: New test.
78467                 * testsuite/gas/aarch64/sme-5-illegal.s: New test.
78468                 * testsuite/gas/aarch64/sme-5.d: New test.
78469                 * testsuite/gas/aarch64/sme-5.s: New test.
78470                 * testsuite/gas/aarch64/sme-6-illegal.d: New test.
78471                 * testsuite/gas/aarch64/sme-6-illegal.l: New test.
78472                 * testsuite/gas/aarch64/sme-6-illegal.s: New test.
78473                 * testsuite/gas/aarch64/sme-6.d: New test.
78474                 * testsuite/gas/aarch64/sme-6.s: New test.
78475                 * testsuite/gas/aarch64/sme-7-illegal.d: New test.
78476                 * testsuite/gas/aarch64/sme-7-illegal.l: New test.
78477                 * testsuite/gas/aarch64/sme-7-illegal.s: New test.
78478                 * testsuite/gas/aarch64/sme-7.d: New test.
78479                 * testsuite/gas/aarch64/sme-7.s: New test.
78480
78481         include/ChangeLog:
78482
78483                 * opcode/aarch64.h (enum aarch64_opnd): New operands.
78484                 (enum aarch64_insn_class): Added sme_ldr and sme_str.
78485                 (AARCH64_OPDE_UNTIED_IMMS): New operand error kind.
78486
78487         opcodes/ChangeLog:
78488
78489                 * aarch64-asm.c (aarch64_ins_sme_za_hv_tiles): New inserter.
78490                 (aarch64_ins_sme_za_list): New inserter.
78491                 (aarch64_ins_sme_za_array): New inserter.
78492                 (aarch64_ins_sme_addr_ri_u4xvl): New inserter.
78493                 * aarch64-asm.h (AARCH64_DECL_OPD_INSERTER): Added
78494                 ins_sme_za_list, ins_sme_za_array and ins_sme_addr_ri_u4xvl.
78495                 * aarch64-dis.c (aarch64_ext_sme_za_hv_tiles): New extractor.
78496                 (aarch64_ext_sme_za_list): New extractor.
78497                 (aarch64_ext_sme_za_array): New extractor.
78498                 (aarch64_ext_sme_addr_ri_u4xvl): New extractor.
78499                 * aarch64-dis.h (AARCH64_DECL_OPD_EXTRACTOR): Added
78500                 ext_sme_za_list, ext_sme_za_array and ext_sme_addr_ri_u4xvl.
78501                 * aarch64-opc.c (operand_general_constraint_met_p):
78502                 (aarch64_match_operands_constraint): Handle sme_ldr, sme_str
78503                 and sme_misc.
78504                 (aarch64_print_operand): New operands supported.
78505                 * aarch64-tbl.h (OP_SVE_QUU): New qualifier.
78506                 (OP_SVE_QZU): New qualifier.
78507                 aarch64-asm-2.c: Regenerate.
78508                 aarch64-dis-2.c: Regenerate.
78509                 aarch64-opc-2.c: Regenerate.
78510
78511 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78512
78513         aarch64: [SME] Add ZERO instruction
78514         This patch is adding ZERO (a list of 64-bit element ZA tiles)
78515         instruction.
78516
78517         gas/ChangeLog:
78518
78519                 * config/tc-aarch64.c (parse_sme_list_of_64bit_tiles):
78520                 New parser.
78521                 (parse_operands): Handle OPND_SME_list_of_64bit_tiles.
78522                 * testsuite/gas/aarch64/sme-4-illegal.d: New test.
78523                 * testsuite/gas/aarch64/sme-4-illegal.l: New test.
78524                 * testsuite/gas/aarch64/sme-4-illegal.s: New test.
78525                 * testsuite/gas/aarch64/sme-4.d: New test.
78526                 * testsuite/gas/aarch64/sme-4.s: New test.
78527
78528         include/ChangeLog:
78529
78530                 * opcode/aarch64.h (enum aarch64_opnd): New operand
78531                 AARCH64_OPND_SME_list_of_64bit_tiles.
78532
78533         opcodes/ChangeLog:
78534
78535                 * aarch64-opc.c (print_sme_za_list): New printing function.
78536                 (aarch64_print_operand): Handle OPND_SME_list_of_64bit_tiles.
78537                 * aarch64-opc.h (enum aarch64_field_kind): New bitfield
78538                 FLD_SME_zero_mask.
78539                 * aarch64-tbl.h (struct aarch64_opcode): New ZERO instruction.
78540                 aarch64-asm-2.c: Regenerate.
78541                 aarch64-dis-2.c: Regenerate.
78542                 aarch64-opc-2.c: Regenerate.
78543
78544 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78545
78546         aarch64: [SME] Add MOV and MOVA instructions
78547         This patch is adding new MOV (alias) and MOVA SME instruction.
78548
78549         gas/ChangeLog:
78550
78551                 * config/tc-aarch64.c (enum sme_hv_slice): new enum.
78552                 (struct reloc_entry): Added ZAH and ZAV registers.
78553                 (parse_sme_immediate): Immediate parser.
78554                 (parse_sme_za_hv_tiles_operand): ZA tile parser.
78555                 (parse_sme_za_hv_tiles_operand_index): Index parser.
78556                 (parse_operands): Added ZA tile parser calls.
78557                 (REGNUMS): New macro. Regs with suffix.
78558                 (REGSET16S): New macro. 16 regs with suffix.
78559                 * testsuite/gas/aarch64/sme-2-illegal.d: New test.
78560                 * testsuite/gas/aarch64/sme-2-illegal.l: New test.
78561                 * testsuite/gas/aarch64/sme-2-illegal.s: New test.
78562                 * testsuite/gas/aarch64/sme-2.d: New test.
78563                 * testsuite/gas/aarch64/sme-2.s: New test.
78564                 * testsuite/gas/aarch64/sme-2a.d: New test.
78565                 * testsuite/gas/aarch64/sme-2a.s: New test.
78566                 * testsuite/gas/aarch64/sme-3-illegal.d: New test.
78567                 * testsuite/gas/aarch64/sme-3-illegal.l: New test.
78568                 * testsuite/gas/aarch64/sme-3-illegal.s: New test.
78569                 * testsuite/gas/aarch64/sme-3.d: New test.
78570                 * testsuite/gas/aarch64/sme-3.s: New test.
78571                 * testsuite/gas/aarch64/sme-3a.d: New test.
78572                 * testsuite/gas/aarch64/sme-3a.s: New test.
78573
78574         include/ChangeLog:
78575
78576                 * opcode/aarch64.h (enum aarch64_opnd): New enums
78577                 AARCH64_OPND_SME_ZA_HV_idx_src and
78578                 AARCH64_OPND_SME_ZA_HV_idx_dest.
78579                 (struct aarch64_opnd_info): New ZA tile vector struct.
78580
78581         opcodes/ChangeLog:
78582
78583                 * aarch64-asm.c (aarch64_ins_sme_za_hv_tiles):
78584                 New inserter.
78585                 * aarch64-asm.h (AARCH64_DECL_OPD_INSERTER):
78586                 New inserter ins_sme_za_hv_tiles.
78587                 * aarch64-dis.c (aarch64_ext_sme_za_hv_tiles):
78588                 New extractor.
78589                 * aarch64-dis.h (AARCH64_DECL_OPD_EXTRACTOR):
78590                 New extractor ext_sme_za_hv_tiles.
78591                 * aarch64-opc.c (aarch64_print_operand):
78592                 Handle SME_ZA_HV_idx_src and SME_ZA_HV_idx_dest.
78593                 * aarch64-opc.h (enum aarch64_field_kind): New enums
78594                 FLD_SME_size_10, FLD_SME_Q, FLD_SME_V and FLD_SME_Rv.
78595                 (struct aarch64_operand): Increase fields size to 5.
78596                 * aarch64-tbl.h (OP_SME_BHSDQ_PM_BHSDQ): New qualifiers
78597                 aarch64-asm-2.c: Regenerate.
78598                 aarch64-dis-2.c: Regenerate.
78599                 aarch64-opc-2.c: Regenerate.
78600
78601 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78602
78603         aarch64: [SME] Add SME instructions
78604         Patch is adding new SME matrix instructions. Please note additional
78605         instructions will be added in following patches.
78606
78607         gas/ChangeLog:
78608
78609                 * config/tc-aarch64.c (parse_sme_zada_operand):
78610                 New parser.
78611                 * config/tc-aarch64.c (parse_reg_with_qual):
78612                 New reg parser.
78613                 * config/tc-aarch64.c (R_ZA): New egister type.
78614                 (parse_operands): New parser.
78615                 * testsuite/gas/aarch64/sme-illegal.d: New test.
78616                 * testsuite/gas/aarch64/sme-illegal.l: New test.
78617                 * testsuite/gas/aarch64/sme-illegal.s: New test.
78618                 * testsuite/gas/aarch64/sme.d: New test.
78619                 * testsuite/gas/aarch64/sme.s: New test.
78620                 * testsuite/gas/aarch64/sme-f64.d: New test.
78621                 * testsuite/gas/aarch64/sme-f64.s: New test.
78622                 * testsuite/gas/aarch64/sme-i64.d: New test.
78623                 * testsuite/gas/aarch64/sme-i64.s: New test.
78624
78625         include/ChangeLog:
78626
78627                 * opcode/aarch64.h (enum aarch64_opnd): New operands
78628                 AARCH64_OPND_SME_ZAda_2b, AARCH64_OPND_SME_ZAda_3b and
78629                 AARCH64_OPND_SME_Pm.
78630                 (enum aarch64_insn_class): New instruction class sme_misc.
78631
78632         opcodes/ChangeLog:
78633
78634                 * aarch64-opc.c (aarch64_print_operand):
78635                 Print OPND_SME_ZAda_2b and OPND_SME_ZAda_3b operands.
78636                 (verify_constraints): Handle OPND_SME_Pm.
78637                 * aarch64-opc.h (enum aarch64_field_kind):
78638                 New bit fields FLD_SME_ZAda_2b, FLD_SME_ZAda_3b and FLD_SME_Pm.
78639                 * aarch64-tbl.h (OP_SME_ZADA_PN_PM_ZN_S): New qualifier set.
78640                 (OP_SME_ZADA_PN_PM_ZN_D): New qualifier.
78641                 (OP_SME_ZADA_PN_PM_ZN_ZM): New qualifier.
78642                 (OP_SME_ZADA_S_PM_PM_S_S): New qualifier.
78643                 (OP_SME_ZADA_D_PM_PM_D_D): New qualifier.
78644                 (OP_SME_ZADA_S_PM_PM_H_H): New qualifier.
78645                 (OP_SME_ZADA_S_PM_PM_B_B): New qualifier.
78646                 (OP_SME_ZADA_D_PM_PM_H_H): New qualifier.
78647                 (SME_INSN): New instruction macro.
78648                 (SME_F64_INSN): New instruction macro.
78649                 (SME_I64_INSN): New instruction macro.
78650                 (SME_INSNC): New instruction macro.
78651                 (struct aarch64_opcode): New SME instructions.
78652                 aarch64-asm-2.c: Regenerate.
78653                 aarch64-dis-2.c: Regenerate.
78654                 aarch64-opc-2.c: Regenerate.
78655
78656 2021-11-17  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
78657
78658         aarch64: [SME] Add +sme option to -march
78659         This series of patches (tagged [SME]) add support for the Scalable
78660         Matrix Extension. Patch introduces new command line options: +sme, +sme-f64 and
78661         +sme-i64 to -march command line options.
78662
78663         gas/ChangeLog:
78664
78665                 * NEWS: Updated docs.
78666                 * config/tc-aarch64.c: New SME command line options.
78667                 * doc/c-aarch64.texi: Update docs.
78668
78669         include/ChangeLog:
78670
78671                 * opcode/aarch64.h (AARCH64_FEATURE_SME): New flag.
78672                 (AARCH64_FEATURE_SME_F64): New flag.
78673                 (AARCH64_FEATURE_SME_I64): New flag.
78674
78675         opcodes/ChangeLog:
78676
78677                 * aarch64-tbl.h (SME): New feature object.
78678
78679 2021-11-17  Jeremy Drake  <cygwin@jdrake.com>
78680
78681         Set the default DLL chracteristics to 0 for Cygwin based targets.
78682                 * emultempl/pep.em (DEFAULT_DLL_CHARACTERISTICS): Set to 0 for
78683                 Cygwin targets.
78684                 * emultempl/pep.em (DEFAULT_DLL_CHARACTERISTICS): Likewise.
78685
78686 2021-11-17  Nick Clifton  <nickc@redhat.com>
78687
78688         Fix the linker script parser so that it will recognise the PT_GNU_RELRO segment type, and the linker itself so that it will gracefully handle being unable to assign any sections to such a segment.
78689                 PR 28452
78690         bfd     * elf.c (assign_file_positions_for_non_load_sections): Replace
78691                 assertion with a warning message.
78692
78693         ld      * ldgram.y: Add support for PT_GNU_RELRO and PT_GNU_PROPERTY.
78694                 * ldgram.c: Regenerate.
78695
78696 2021-11-17  Andreas Arnez  <arnez@linux.ibm.com>
78697
78698         [gdb/build, s390x] Fix build after gdbarch_tdep changes
78699         Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") changes a
78700         declaration in s390-tdep.h from
78701
78702            struct gdbarch_tdep { ... };
78703
78704         to
78705
78706            struct s390_gdbarch_tdep : gdbarch_tdep { ... };
78707
78708         and now requires that gdbarch_tdep has been declared before.  Which is
78709         usually the case, except when compiling s390-linux-nat.c, where
78710         s390-tdep.h is included before gdbarch.h.  Thus the s390x build errors out
78711         with the compiler complaining about a missing class name after the colon.
78712
78713         Fix this in s390-linux-nat.c, by including gdbarch.h before s390-tdep.h.
78714
78715 2021-11-17  Luis Machado  <luis.machado@linaro.org>
78716
78717         Expose the BTI BTYPE more explicitly in the registers
78718         Augment the register description XML to expose the BTI BTYPE field contained
78719         in the CPSR register. It will be displayed like so:
78720
78721         cpsr           0x60001000          [ EL=0 BTYPE=0 SSBS C Z ]
78722
78723 2021-11-17  H.J. Lu  <hjl.tools@gmail.com>
78724
78725         elfedit: Add --output-abiversion option to update ABIVERSION
78726                 * NEWS: Mention --output-abiversion.
78727                 * elfedit.c (input_elf_abiversion): New.
78728                 (output_elf_abiversion): Likewise.
78729                 (update_elf_header): Update EI_ABIVERSION.
78730                 (command_line_switch): Add OPTION_INPUT_ABIVERSION and
78731                 OPTION_OUTPUT_ABIVERSION.
78732                 (options): Add --input-abiversion and --output-abiversion.
78733                 (usage): Likewise.
78734                 (main): Handle --input-abiversion and --output-abiversion.
78735                 * doc/binutils.texi: Document --input-abiversion and
78736                 --output-abiversion.
78737                 * testsuite/binutils-all/elfedit.exp: Run elfedit-6.
78738                 * testsuite/binutils-all/elfedit-6.d: New file.
78739
78740 2021-11-17  Nelson Chu  <nelson.chu@sifive.com>
78741
78742         RISC-V: Support rvv extension with released version 1.0.
78743         2021-11-17  Jim Wilson  <jimw@sifive.com>
78744                     Kito Cheng  <kito.cheng@sifive.com>
78745                     Nelson Chu  <nelson.chu@sifive.com>
78746
78747         This patch is porting from the following riscv github,
78748         https://github.com/riscv/riscv-binutils-gdb/tree/rvv-1.0.x
78749
78750         And here is the vector spec,
78751         https://github.com/riscv/riscv-v-spec
78752
78753         bfd/
78754                 * elfxx-riscv.c (riscv_implicit_subsets): Added imply rules
78755                 of v, zve and zvl extensions.
78756                 (riscv_supported_std_ext): Updated verison of v to  1.0.
78757                 (riscv_supported_std_z_ext): Added zve and zvl extensions.
78758                 (riscv_parse_check_conflicts): The zvl extensions need to
78759                 enable either v or zve extension.
78760                 (riscv_multi_subset_supports): Check the subset list to know
78761                 if the INSN_CLASS_V and INSN_CLASS_ZVEF instructions are supported.
78762         gas/
78763                 * config/tc-riscv.c (enum riscv_csr_class): Added CSR_CLASS_V.
78764                 (enum reg_class): Added RCLASS_VECR and RCLASS_VECM.
78765                 (validate_riscv_insn): Check whether the rvv operands are valid.
78766                 (md_begin): Initialize register hash for rvv registers.
78767                 (macro_build): Added rvv operands when expanding rvv pseudoes.
78768                 (vector_macro): Expand rvv macros into one or more instructions.
78769                 (macro): Likewise.
78770                 (my_getVsetvliExpression): Similar to my_getVsetvliExpression,
78771                 but used for parsing vsetvli operands.
78772                 (riscv_ip): Parse and encode rvv operands.  Besides, The rvv loads
78773                 and stores with EEW 64 cannot be used when zve32x is enabled.
78774                 * testsuite/gas/riscv/priv-reg-fail-version-1p10.d: Updated -march
78775                 to rv32ifv_zkr.
78776                 * testsuite/gas/riscv/priv-reg-fail-version-1p11.d: Likewise.
78777                 * testsuite/gas/riscv/priv-reg-fail-version-1p9p1.d: Likewise.
78778                 * testsuite/gas/riscv/priv-reg.s: Added rvv csr testcases.
78779                 * testsuite/gas/riscv/priv-reg-version-1p10.d: Likewise.
78780                 * testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise.
78781                 * testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise.
78782                 * testsuite/gas/riscv/march-imply-v.d: New testcase.
78783                 * testsuite/gas/riscv/vector-insns-fail-zve32xf.d: Likewise.
78784                 * testsuite/gas/riscv/vector-insns-fail-zve32xf.l: Likewise.
78785                 * testsuite/gas/riscv/vector-insns-fail-zvl.d: Likewise.
78786                 * testsuite/gas/riscv/vector-insns-fail-zvl.l: Likewise.
78787                 * testsuite/gas/riscv/vector-insns-vmsgtvx.d: Likewise.
78788                 * testsuite/gas/riscv/vector-insns-vmsgtvx.s: Likewise.
78789                 * testsuite/gas/riscv/vector-insns-zero-imm.d: Likewise.
78790                 * testsuite/gas/riscv/vector-insns-zero-imm.s: Likewise.
78791                 * testsuite/gas/riscv/vector-insns.d: Likewise.
78792                 * testsuite/gas/riscv/vector-insns.s: Likewise.
78793         include/
78794                 * opcode/riscv-opc.h: Defined mask/match encodings and csrs for rvv.
78795                 * opcode/riscv.h: Defined rvv immediate encodings and fields.
78796                 (enum riscv_insn_class): Added INSN_CLASS_V and INSN_CLASS_ZVEF.
78797                 (INSN_V_EEW64): Defined.
78798                 (M_VMSGE, M_VMSGEU): Added for the rvv pseudoes.
78799         opcodes/
78800                 * riscv-dis.c (print_insn_args): Dump the rvv operands.
78801                 * riscv-opc.c (riscv_vecr_names_numeric): Defined rvv registers.
78802                 (riscv_vecm_names_numeric): Likewise.
78803                 (riscv_vsew): Likewise.
78804                 (riscv_vlmul): Likewise.
78805                 (riscv_vta): Likewise.
78806                 (riscv_vma): Likewise.
78807                 (match_vs1_eq_vs2): Added for rvv Vu operand.
78808                 (match_vd_eq_vs1_eq_vs2): Added for rvv Vv operand.
78809                 (riscv_opcodes): Added rvv v1.0 instructions.
78810
78811 2021-11-17  Sergei Trofimovich  <siarheit@google.com>
78812
78813         gdb/nat/linux-osdata.c: fix build on gcc-12 (string overfow)
78814         On gcc-12 build fails as:
78815
78816             ../../gdbserver/../gdb/nat/linux-osdata.c: In function 'void linux_xfer_osdata_processes(buffer*)':
78817             ../../gdbserver/../gdb/nat/linux-osdata.c:330:39: error:
78818               '__builtin___sprintf_chk' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
78819               330 |                 sprintf (core_str, "%d", i);
78820                   |                                       ^
78821
78822         It's an off-by-one case in an infeasible scenario for negative
78823         huge core count. The change switches to std::string for memory
78824         handling.
78825
78826         Tested by running 'info os processes' and checking CPU cores column.
78827
78828 2021-11-17  Aaron Merey  <amerey@redhat.com>
78829
78830         gdb: Add aliases for read_core_file_mappings callbacks
78831         Add aliases read_core_file_mappings_loop_ftype and
78832         read_core_file_mappings_pre_loop_ftype.  Intended for use with
78833         read_core_file_mappings.
78834
78835         Also add build_id parameter to read_core_file_mappings_loop_ftype.
78836
78837 2021-11-17  Mike Frysinger  <vapier@gentoo.org>
78838
78839         sim: testsuite: add support for $pwd replacements
78840         Extend the common test framework to support $pwd replacements in
78841         settings.  This allows replacing the custom cris @exedir@ with it.
78842
78843         sim: cris: replace @srcdir@ test extension with $srcdir/$subdir
78844         The common framework supports $srcdir & $subdir replacements already,
78845         so replace the custom @srcdir@ logic with those.  Since the replace
78846         happens in slurp_options that cris already uses, we don't have any
78847         logic to port over there.  We have to duplicate that into the cris
78848         slurp_rv helper though.
78849
78850 2021-11-17  Mike Frysinger  <vapier@gentoo.org>
78851
78852         sim: cris: drop custom "dynamic" test field
78853         This tag is used to force tests to be built dynamically (i.e. without
78854         -static linking).  This is because cris-sim.exp in dejagnu turns on
78855         static linking in ldflags.
78856
78857         The default configs and runtest flags shouldn't load these boards.
78858         If these settings are still needed, we should figure out a different
78859         way of suppressing the stock settings wholesale.  We want these to
78860         all pass out of the box with little to no configuration so that they
78861         can run in a multitarget build.
78862
78863         With dropping "dynamic", it'll be easier to merge the custom cris
78864         test logic with the common sim test logic.
78865
78866 2021-11-17  Mike Frysinger  <vapier@gentoo.org>
78867
78868         sim: testsuite: add more silent build rules
78869         site.exp is still verbose, but that comes from automake, so have
78870         to get it fixed upstream.
78871
78872 2021-11-17  GDB Administrator  <gdbadmin@sourceware.org>
78873
78874         Automatic date update in version.in
78875
78876 2021-11-16  Sergei Trofimovich  <siarheit@google.com>
78877
78878         sim: cr16: fix build on gcc-12 (NULL comparison)
78879         On gcc-12 build fails as:
78880
78881             sim/cr16/interp.c: In function 'lookup_hash':
78882             sim/cr16/interp.c:89:25: error:
78883               the comparison will always evaluate as 'true'
78884               for the address of 'mnimonic' will never be NULL [-Werror=address]
78885                89 |   if ((h->ops->mnimonic != NULL) &&
78886                   |                         ^~
78887
78888         'mnimonic' is a sharr array within ops. It can never be NULL.
78889
78890         While at it renamed 'mnimonic' to 'mnemonic'.
78891
78892 2021-11-16  Simon Marchi  <simon.marchi@polymtl.ca>
78893
78894         gdb: fix length of array view returned by some value_contents functions
78895         In commit 50888e42dcd3 ("gdb: change functions returning value contents
78896         to use gdb::array_view"), I believe I made a mistake with the length of
78897         the array views returned by some functions.  All functions return a view
78898         of `TYPE_LENGTH (value_type (type))` length.  This is not correct when
78899         the value's enclosing type is larger than the value's type.  In that
78900         case, the value's contents buffer is of the size of the enclosing type,
78901         and the value's actual contents is a slice of that (as returned by
78902         value_contents).  So, functions value_contents_all_raw,
78903         value_contents_for_printing and value_contents_for_printing_const are
78904         not correct.  Since they are meant to return the value's contents buffer
78905         as a whole, they should have the size of the enclosing type.
78906
78907         There is nothing that uses the returned array view size at the moment,
78908         so this didn't cause a problem.  But it became apparent when trying to
78909         adjust some callers.
78910
78911         Change-Id: Ib4e8837e1069111d2b2784d3253d5f3002419e68
78912
78913 2021-11-16  Fangrui Song  <maskray@google.com>
78914
78915         readelf: Support SHT_RELR/DT_RELR for -r
78916         The -r output for SHT_RELR looks like:
78917
78918         Relocation section '.relr.dyn' at offset 0x530 contains 4 entries:
78919           7 offsets
78920         00000000000028c0
78921         00000000000028c8
78922         0000000000003ad0
78923         0000000000003ad8
78924         0000000000003ae0
78925         0000000000003ae8
78926         0000000000003af0
78927
78928         For --use-dynamic, the header looks like
78929
78930             'RELR' relocation section at offset 0x530 contains 32 bytes:
78931
78932         include/
78933             * elf/common.h (DT_ENCODING): Bump to 38.
78934             * elf/external.h (Elf32_External_Relr): New.
78935             (Elf64_External_Relr): New.
78936         binutils/
78937             * readelf.c (enum relocation_type): New.
78938             (slurp_relr_relocs): New.
78939             (dump_relocations): Change is_rela to rel_type.
78940             Dump RELR.
78941             (dynamic_relocations): Add DT_RELR.
78942             (process_relocs): Check SHT_RELR and DT_RELR.
78943             (process_dynamic_section): Store into dynamic_info for
78944             DT_RELR/DT_RELRENT/DT_RELRSZ.
78945
78946 2021-11-16  Simon Marchi  <simon.marchi@polymtl.ca>
78947
78948         gdbsupport: remove FUNCTION_NAME
78949         __func__ is standard C++11:
78950
78951             https://en.cppreference.com/w/cpp/language/function
78952
78953         Also, in C++11, __func__ expands to the demangled function name, so the
78954         mention in the comment above FUNCTION_NAME doesn't apply anymore.
78955         Finally, in places where FUNCTION_NAME is used, I think it's enough to
78956         print the function name, no need to print the whole signature.
78957         Therefore, I propose to just remove FUNCTION_NAME and update users to
78958         use the standard __func__.
78959
78960         Change-Id: I778f28155422b044402442dc18d42d0cded1017d
78961
78962 2021-11-16  Andrew Burgess  <aburgess@redhat.com>
78963
78964         gdb/gdbsupport: make xstrprintf and xstrvprintf return a unique_ptr
78965         The motivation is to reduce the number of places where unmanaged
78966         pointers are returned from allocation type routines.  All of the
78967         callers are updated.
78968
78969         There should be no user visible changes after this commit.
78970
78971 2021-11-16  Andrew Burgess  <aburgess@redhat.com>
78972
78973         gdbsupport: move xfree into its own file
78974         In the next commit I'd like to reference gdb_unique_ptr within the
78975         common-utils.h file.  However, this requires that I include
78976         gdb_unique_ptr.h, which requires that xfree be defined.
78977
78978         Interestingly, gdb_unique_ptr.h doesn't actually include anything that
78979         defines xfree, but I was finding that when I added a gdb_unique_ptr.h
78980         include to common-utils.h I was getting a dependency cycle; before my
78981         change xfree was defined when gdb_unique_ptr.h was processed, while
78982         after my change it was not, and this made g++ unhappy.
78983
78984         To break this cycle, I propose to move xfree into its own header file,
78985         gdb-xfree.h, which I'll then include into gdb_unique_ptr.h and
78986         common-utils.cc.
78987
78988 2021-11-16  Andrew Burgess  <aburgess@redhat.com>
78989
78990         gdb: throw OPTIMIZED_OUT_ERROR rather than GENERIC_ERROR
78991         While reviewing this patch:
78992
78993           https://sourceware.org/pipermail/gdb-patches/2021-November/183227.html
78994
78995         I spotted that the patch could be improved if we threw
78996         OPTIMIZED_OUT_ERROR rather than GENERIC_ERROR in a few places.
78997
78998         This commit updates error_value_optimized_out and
78999         require_not_optimized_out to throw OPTIMIZED_OUT_ERROR.
79000
79001         I ran the testsuite and saw no regressions.  This doesn't really
79002         surprise me, we don't usually write code like:
79003
79004           catch (const gdb_exception_error &ex)
79005             {
79006               (if ex.error == GENERIC_ERROR)
79007                 ...
79008               else
79009                 ...
79010             }
79011
79012         There are a three places where we write something like:
79013
79014           catch (const gdb_exception_error &ex)
79015             {
79016               (if ex.error == OPTIMIZED_OUT_ERROR)
79017                 ...
79018             }
79019
79020         In frame.c:unwind_pc, stack.c:info_frame_command_core, and
79021         value.c:value_optimized_out, but if we are hitting these cases then
79022         it's not significantly changing GDB's behaviour.
79023
79024 2021-11-16  Tom Tromey  <tromey@adacore.com>
79025
79026         Remove config.cache in gdbserver's "distclean"
79027         PR gdb/28586 points out that "make distclean" fails to delete
79028         config.cache from gdbserver/.  This patch fixes the bug, and removes a
79029         duplicate "Makefile" deletion that was also pointed out in the PR.
79030
79031 2021-11-16  Tom de Vries  <tdevries@suse.de>
79032
79033         [gdb/testsuite] Remove inferior output in gdb.base/foll-vfork.exp
79034         Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but
79035         which makes the regexp matching more difficult (see commit 1f28b70def1
79036         "[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp").
79037
79038         Remove the inferior output, and revert commit 1f28b70def1 to make the matching
79039         more restrictive.
79040
79041         Tested on x86_64-linux.
79042
79043 2021-11-16  H.J. Lu  <hjl.tools@gmail.com>
79044
79045         x86: Don't allow KMOV in TLS code sequences
79046         Don't allow KMOV in TLS code sequences which require integer MOV
79047         instructions.
79048
79049                 PR target/28595
79050                 * config/tc-i386.c (match_template): Don't allow KMOV in TLS
79051                 code sequences.
79052                 * testsuite/gas/i386/i386.exp: Run inval-tls and x86-64-inval-tls
79053                 tests.
79054                 * testsuite/gas/i386/inval-tls.l: New file.
79055                 * testsuite/gas/i386/inval-tls.s: Likewise.
79056                 * testsuite/gas/i386/x86-64-inval-tls.l: Likewise.
79057                 * testsuite/gas/i386/x86-64-inval-tls.s: Likewise.
79058
79059 2021-11-16  Mike Frysinger  <vapier@gentoo.org>
79060
79061         sim: run: support concise env var settings
79062         Support the same syntax as other common utilities where env vars can
79063         be specified before the program to be run without an explicit option.
79064
79065         This behavior can be suppressed by using the -- marker.
79066
79067 2021-11-16  Mike Frysinger  <vapier@gentoo.org>
79068
79069         sim: nrun: add --env-{set,unset,clear} command line options
79070         Provide explicit control over the program's environment with the
79071         basic set/unset/clear options.  These are a bit clunky to use,
79072         but they're functional.
79073
79074         The env set operation is split out into a separate function as it'll
79075         be used in the next commit.
79076
79077         With these in place, we can adjust the custom cris testsuite to use
79078         the now standard options and not its one-off hack.
79079
79080 2021-11-16  Mike Frysinger  <vapier@gentoo.org>
79081
79082         sim: syscall: hoist argc/argn/argnlen to common code
79083         Now that the callback framework supports argv & envp, we can move
79084         the Blackfin implementation of these syscalls to the common code.
79085
79086         sim: syscall: fix argvlen & argv implementation
79087         Now that we have access to the argv & envp strings, finish implementing
79088         these syscalls.  Delete unused variables, fix tbuf by incrementing the
79089         pointer instead of setting to the length, and make sure we don't write
79090         more data than the bufsize says is available.
79091
79092         sim: callback: expose argv & environ
79093         Pass the existing strings data to the callbacks so that common
79094         libgloss syscalls can be implemented (which we'll do shortly).
79095
79096 2021-11-16  Mike Frysinger  <vapier@gentoo.org>
79097
79098         sim: keep track of program environment strings
79099         We've been passing the environment strings to sim_create_inferior,
79100         but most ports don't do anything with them.  A few will use ad-hoc
79101         logic to stuff the stack for user-mode programs, but that's it.
79102
79103         Let's formalize this across the board by storing the strings in the
79104         normal sim state.  This will allow (in future commits) supporting
79105         more functionality in the run interface, and to unify some of the
79106         libgloss syscalls.
79107
79108 2021-11-16  Mike Frysinger  <vapier@gentoo.org>
79109
79110         sim: iq2000: fix some missing prototypes warnings
79111         Turns out some of these were hiding real bugs like not passing the
79112         pc variable down.
79113
79114 2021-11-16  jiawei  <jiawei@iscas.ac.cn>
79115
79116         RISC-V: Scalar crypto instruction and entropy source CSR testcases.
79117         Add testcases for Scalar Crypto extension, with total testcase contain all
79118         instructions in k-ext/k-ext-64 and sub-extension testcase for zbk* zk*. Also
79119         add testcase for new CSR name 'seed' which is the Entropy Source in zkr.
79120
79121         In fact these whole testcases can be combined into one file, after we have
79122         supported the .option arch +-= directives.
79123
79124         gas/
79125                 * testsuite/gas/riscv/k-ext-64.d: New testcase for crypto instructions.
79126                 * testsuite/gas/riscv/k-ext-64.s: Likewise.
79127                 * testsuite/gas/riscv/k-ext.d: Likewise.
79128                 * testsuite/gas/riscv/k-ext.s: Likewise.
79129                 * testsuite/gas/riscv/zbkb-32.d: Likewise.
79130                 * testsuite/gas/riscv/zbkb-32.s: Likewise.
79131                 * testsuite/gas/riscv/zbkb-64.d: Likewise.
79132                 * testsuite/gas/riscv/zbkb-64.s: Likewise.
79133                 * testsuite/gas/riscv/zbkc-32.d: Likewise.
79134                 * testsuite/gas/riscv/zbkc-64.d: Likewise.
79135                 * testsuite/gas/riscv/zbkc.s: Likewise.
79136                 * testsuite/gas/riscv/zbkx-32.d: Likewise.
79137                 * testsuite/gas/riscv/zbkx-64.d: Likewise.
79138                 * testsuite/gas/riscv/zbkx.s: Likewise.
79139                 * testsuite/gas/riscv/zknd-32.d: Likewise.
79140                 * testsuite/gas/riscv/zknd-32.s: Likewise.
79141                 * testsuite/gas/riscv/zknd-64.d: Likewise.
79142                 * testsuite/gas/riscv/zknd-64.s: Likewise.
79143                 * testsuite/gas/riscv/zkne-32.d: Likewise.
79144                 * testsuite/gas/riscv/zkne-32.s: Likewise.
79145                 * testsuite/gas/riscv/zkne-64.d: Likewise.
79146                 * testsuite/gas/riscv/zkne-64.s: Likewise.
79147                 * testsuite/gas/riscv/zknh-32.d: Likewise.
79148                 * testsuite/gas/riscv/zknh-32.s: Likewise.
79149                 * testsuite/gas/riscv/zknh-64.d: Likewise.
79150                 * testsuite/gas/riscv/zknh-64.s: Likewise.
79151                 * testsuite/gas/riscv/zksed-32.d: Likewise.
79152                 * testsuite/gas/riscv/zksed-64.d: Likewise.
79153                 * testsuite/gas/riscv/zksed.s: Likewise.
79154                 * testsuite/gas/riscv/zksh-32.d: Likewise.
79155                 * testsuite/gas/riscv/zksh-64.d: Likewise.
79156                 * testsuite/gas/riscv/zksh.s: Likewise.
79157                 * testsuite/gas/riscv/priv-reg-fail-zkr.d: New testcase for zkr
79158                 csr check.
79159                 * testsuite/gas/riscv/priv-reg-fail-zkr.l: Likewise.
79160                 * testsuite/gas/riscv/priv-reg-fail-version-1p10.d: Updated march to
79161                 rv32if_zkr.
79162                 * testsuite/gas/riscv/priv-reg-fail-version-1p11.d: Likewise.
79163                 * testsuite/gas/riscv/priv-reg-fail-version-1p9p1.d: Likewise.
79164                 * testsuite/gas/riscv/priv-reg-version-1p10.d: Added Crypto seed csr.
79165                 * testsuite/gas/riscv/priv-reg-version-1p11.d: Likewise.
79166                 * testsuite/gas/riscv/priv-reg-version-1p9p1.d: Likewise.
79167                 * testsuite/gas/riscv/priv-reg.s: Likewise.
79168
79169 2021-11-16  jiawei  <jiawei@iscas.ac.cn>
79170
79171         RISC-V: Scalar crypto instructions and operand set.
79172         Add instructions in k-ext, some instruction in zbkb, zbkc is reuse from
79173         zbb,zbc, we just change the class attribute to make them both support.
79174         The 'aes64ks1i' and 'aes64ks2' instructions are present in both the Zknd
79175         and Zkne extensions on rv64.  Add new operand letter 'y' to present 'bs'
79176         symbol and 'Y' to present 'rnum' symbolc  for zkn instructions.  Also add
79177         a new Entropy Source CSR define 'seed' located at address 0x015.
79178
79179         bfd/
79180                 * elfxx-riscv.c (riscv_multi_subset_supports): Added support for
79181                 crypto extension.
79182         gas/
79183                 *config/tc-riscv.c (enum riscv_csr_class): Added CSR_CLASS_ZKR.
79184                 (riscv_csr_address): Checked for CSR_CLASS_ZKR.
79185                 (validate_riscv_insn): Added y and Y for bs and rnum operands.
79186                 (riscv_ip): Handle y and Y operands.
79187         include/
79188                 * opcode/riscv-opc.h: Added encodings of crypto instructions.
79189                 Also defined new csr seed, which address is 0x15.
79190                 * opcode/riscv.h: Defined OP_* and INSN_CLASS_* for crypto.
79191         opcodes/
79192                 * riscv-dis.c (print_insn_args): Recognized new y and Y operands.
79193                 * riscv-opc.c (riscv_opcodes): Added crypto instructions.
79194
79195 2021-11-16  jiawei  <jiawei@iscas.ac.cn>
79196
79197         RISC-V: Minimal support of scalar crypto extension.
79198         Minimal support of scalar crypto extension, add "k" in the
79199         riscv_supported_std_ext, to make the order check right with
79200         "zk" behind "zb".
79201
79202         bfd/
79203                 * elfxx-riscv.c (riscv_implicit_subsets): Added implicit
79204                 rules for zk* extensions.
79205                 (riscv_supported_std_ext): Added entry for k.
79206                 (riscv_supported_std_z_ext): Added entries for zk*.
79207
79208 2021-11-16  Simon Marchi  <simon.marchi@efficios.com>
79209
79210         gdb: rework "set debuginfod" commands
79211         As discussed here [1], do some re-work in the "set debuginfod commands".
79212
79213         First, use "set debuginfod enabled on/off/ask" instead of "set
79214         debuginfod on/off/ask".  This is more MI-friendly, and it gives an
79215         output that makes more sense in "info set", for example.
79216
79217         Then, make the show commands not call "error" when debuginfod support is
79218         not compiled in.  This makes the commands "show" and "show debuginfod"
79219         stop early, breaking gdb.base/default.exp:
79220
79221             Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/default.exp ...
79222             FAIL: gdb.base/default.exp: info set
79223             FAIL: gdb.base/default.exp: show
79224
79225          - Make the "debuginfod enabled" setting default to "off" when debuginfod
79226            support is not compiled in, and "ask" otherwise.
79227          - Make the setter of "debuginfod enabled" error out when debuginfod
79228            support is not compiled in, so that "debuginfod enabled" will always
79229            remain "off" in that case.
79230          - Make the setter of "debuginfod verbose" work in any case.  I don't
79231            see the harm in letting the user change that setting, since the user will
79232            hit an error if they try to enable the use of debuginfod.
79233          - I would do the same for the "debuginfod urls" setter, but because
79234            this one needs to see the DEBUGINFOD_URLS_ENV_VAR macro, provided by
79235            libdebuginfod, I made that one error out as well if debuginfod
79236            support is not compiled it (otherwise, I would have left it like
79237            "debuginfod verbose".  Alternatively, we could hard-code
79238            "DEBUGINFOD_URLS" in the code (in fact, it was prior to this patch,
79239            but I think it was an oversight, as other spots use
79240            DEBUGINFOD_URLS_ENV_VAR), or use a dummy string to store the setting,
79241            but I don't really see the value in that.
79242
79243         Rename debuginfod_enable to debuginfod_enabled, just so it matches the
79244         setting name.
79245
79246         [1] https://sourceware.org/pipermail/gdb-patches/2021-October/182937.html
79247
79248         Change-Id: I45fdb2993f668226a5639228951362b7800f09d5
79249         Co-Authored-By: Aaron Merey <amerey@redhat.com>
79250
79251 2021-11-16  Simon Marchi  <simon.marchi@polymtl.ca>
79252
79253         gdb: adjust gdbarch_tdep calls in nat files
79254         Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") forgot to
79255         update the gdbarch_tdep calls in the native files other than x86-64
79256         Linux.  This patch updates them all (to the best of my knowledge).
79257         These are the files I was able to build-test:
79258
79259           aarch64-linux-nat.c
79260           amd64-bsd-nat.c
79261           arm-linux-nat.c
79262           ppc-linux-nat.c
79263           windows-nat.c
79264           xtensa-linux-nat.c
79265
79266         And these are the ones I could not build-test:
79267
79268           aix-thread.c
79269           arm-netbsd-nat.c
79270           ppc-fbsd-nat.c
79271           ppc-netbsd-nat.c
79272           ia64-tdep.c (the part that needs libunwind)
79273           ppc-obsd-nat.c
79274           rs6000-nat.c
79275
79276         If there are still some build problems related to gdbarch_tdep in them,
79277         they should be pretty obvious to fix.
79278
79279         Change-Id: Iaa3d791a850e4432973757598e634e3da6061428
79280
79281 2021-11-16  Simon Marchi  <simon.marchi@polymtl.ca>
79282
79283         gdb: remove unused variables in xtensa-linux-nat.c
79284         While build-testing this file, the compiler complained about these two
79285         unused variables, remove them.
79286
79287         Change-Id: I3c54f779f12c16ef6184af58aca75eaad042ce4e
79288
79289 2021-11-16  Simon Marchi  <simon.marchi@polymtl.ca>
79290
79291         gdb: add arc-newlib-tdep.c to ALL_TARGET_OBS
79292         This file is currently not compiled in an --enable-targets=all build,
79293         but it should be.  Add it to ALL_TARGET_OBS.
79294
79295         Update the gdbarch_tdep call that commit 345bd07cce33 ("gdb: fix
79296         gdbarch_tdep ODR violation") forgot to update.
79297
79298         Change-Id: I86248a01493eea5e70186e9c46a298ad3994b034
79299
79300 2021-11-16  Jim Wilson  <wilson@tuliptree.org>
79301
79302         Update my email address.
79303         I've left SiFive and have a new gmail account because it is convenient
79304         to use with git send-email.  I'm planning to use this for my RISC-V
79305         work.  My tuliptree address still works, it just isn't as convenient.
79306
79307                 binutils:
79308                 * MAINTAINERS (RISC-V): Update my address.
79309
79310 2021-11-16  GDB Administrator  <gdbadmin@sourceware.org>
79311
79312         Automatic date update in version.in
79313
79314 2021-11-15  Tom de Vries  <tdevries@suse.de>
79315
79316         [gdb] Don't use gdb_stdlog for inferior-events
79317         The test-case gdb.base/foll-vfork.exp contains:
79318         ...
79319         if [gdb_debug_enabled] {
79320             untested "debug is enabled"
79321             return 0
79322         }
79323         ...
79324
79325         To understand what it does, I disabled this bit and ran with GDB_DEBUG=infrun,
79326         like so:
79327         ...
79328         $ cd $build/gdb/testsuite
79329         $ make check GDB_DEBUG=infrun RUNTESTFLAGS=gdb.base/foll-vfork.exp
79330         ...
79331         and ran into:
79332         ...
79333         (gdb) PASS: gdb.base/foll-vfork.exp: exec: \
79334           vfork parent follow, through step: set follow-fork parent
79335         next^M
79336         33        if (pid == 0) {^M
79337         (gdb) FAIL: gdb.base/foll-vfork.exp: exec: \
79338           vfork parent follow, through step: step
79339         ...
79340
79341         The problem is that the test-case expects:
79342         ...
79343         (gdb) PASS: gdb.base/foll-vfork.exp: exec: \
79344           vfork parent follow, through step: set follow-fork parent
79345         next^M
79346         [Detaching after vfork from child process 28169]^M
79347         33        if (pid == 0) {^M
79348         (gdb) PASS: gdb.base/foll-vfork.exp: exec: \
79349           vfork parent follow, through step: step
79350         ...
79351         but the "Detaching" line has been redirected to
79352         $outputs/gdb.base/foll-vfork/gdb.debug.
79353
79354         I looked at the documentation of "set logging debugredirect [on|off]":
79355         ...
79356           By default, GDB debug output will go to both the terminal and the logfile.
79357           Set debugredirect if you want debug output to go only to the log file.
79358         ...
79359         and my interpretation of it was that "debug output" did not match the
79360         "messages" description of inferior-events:
79361         ...
79362         The set print inferior-events command allows you to enable or disable printing
79363         of messages when GDB notices that new inferiors have started or that inferiors
79364         have exited or have been detached.
79365         ...
79366
79367         Fix the discrepancy by not using gdb_stdlog for inferior-events.
79368
79369         Update the gdb.base/foll-vfork.exp test-case to not require
79370         gdb_debug_enabled == 0.
79371
79372         Tested on x86_64-linux.
79373
79374         Tested test-case gdb.base/foll-vfork.exp with and without GDB_DEBUG=infrun.
79375
79376 2021-11-15  Roland McGrath  <mcgrathr@google.com>
79377
79378         ld: Fix testsuite failures under --enable-textrel-check=error
79379         ld/
79380                 * testsuite/ld-aarch64/dt_textrel.d: Pass explicit -z notext in
79381                 case ld was configured with --enable-textrel-check=error.
79382                 * testsuite/ld-aarch64/pr22764.d: Likewise.
79383                 * testsuite/ld-aarch64/pr20402.d: Likewise.
79384
79385 2021-11-15  Luis Machado  <luis.machado@linaro.org>
79386
79387         Extend the prologue analyzer to handle the bti instruction
79388         Handle the BTI instruction in the prologue analyzer. The patch handles all
79389         the variations of the BTI instruction.
79390
79391 2021-11-15  Simon Marchi  <simon.marchi@polymtl.ca>
79392
79393         gdb: fix gdbarch_tdep ODR violation
79394         I would like to be able to use non-trivial types in gdbarch_tdep types.
79395         This is not possible at the moment (in theory), because of the one
79396         definition rule.
79397
79398         To allow it, rename all gdbarch_tdep types to <arch>_gdbarch_tdep, and
79399         make them inherit from a gdbarch_tdep base class.  The inheritance is
79400         necessary to be able to pass pointers to all these <arch>_gdbarch_tdep
79401         objects to gdbarch_alloc, which takes a pointer to gdbarch_tdep.
79402
79403         These objects are never deleted through a base class pointer, so I
79404         didn't include a virtual destructor.  In the future, if gdbarch objects
79405         deletable, I could imagine that the gdbarch_tdep objects could become
79406         owned by the gdbarch objects, and then it would become useful to have a
79407         virtual destructor (so that the gdbarch object can delete the owned
79408         gdbarch_tdep object).  But that's not necessary right now.
79409
79410         It turns out that RISC-V already has a gdbarch_tdep that is
79411         non-default-constructible, so that provides a good motivation for this
79412         change.
79413
79414         Most changes are fairly straightforward, mostly needing to add some
79415         casts all over the place.  There is however the xtensa architecture,
79416         doing its own little weird thing to define its gdbarch_tdep.  I did my
79417         best to adapt it, but I can't test those changes.
79418
79419         Change-Id: Ic001903f91ddd106bd6ca09a79dabe8df2d69f3b
79420
79421 2021-11-15  Clément Chigot  <clement.chigot@atos.net>
79422
79423         COFF: avoid modifications over C_FILE filename aux entries.
79424         Commit e86fc4a5bc37 ("PR 28447: implement multiple parameters for .file
79425         on XCOFF") introduces C_FILE entries which can store additional
79426         information.
79427         However, some modifications are needed by them but not by the original
79428         C_FILE entries, usually representing the filename.
79429         This patch ensures that filename entries are kept as is, in order to
79430         protect targets not supporting the additional entries.
79431
79432                 * coffgen.c (coff_write_symbol): Protect filename entries
79433                 (coff_write_symbols): Likewise.
79434                 (coff_print_symbol): Likewise.
79435
79436 2021-11-15  Eric Botcazou  <ebotcazou@gcc.gnu.org>
79437
79438         Deal with full path in .file 0 directive
79439         Gas uses the directory part, if present, of the .file 0 directive to set
79440         entry 0 of the directory table in DWARF 5, which represents the "current
79441         directory".
79442
79443         Now Gas also uses the file part of the same directive to set entry 0 of the
79444         file table, which represents the "current compilation file".  But the latter
79445         need not be located in the former so GCC will use a full path in the file
79446         part when it is passed a full path:
79447
79448         gcc -c /full/path/test.c -save-temps
79449
79450         yields:
79451
79452          .file 0 "/current/directory" "/full/path/test.c"
79453
79454         in the assembly file and:
79455
79456          The Directory Table (offset 0x22, lines 2, columns 1):
79457           Entry Name
79458           0     (indirect line string, offset: 0x25): /current/directory
79459           1     (indirect line string, offset: 0x38): /full/path
79460
79461          The File Name Table (offset 0x30, lines 2, columns 2):
79462           Entry Dir     Name
79463           0     0       (indirect line string, offset: 0x43): /full/path/test.c
79464
79465         in the object file.  Note the full path and the questionable Dir value in
79466         the 0 entry of the file table.
79467
79468 2021-11-15  Mike Frysinger  <vapier@gentoo.org>
79469
79470         sim: cris: make error message test a little more flexible
79471         The point of this test is to just make sure the usage text is shown,
79472         not the exact details of the usage text.  So shorten the output test
79473         to match the beginning.  This fixes breakage when the output changed
79474         slightly to include [--].
79475
79476         sim: run: fix crash in argc==0 error situation
79477         The new argv processing code assumed that we were always passed a
79478         command line.  If we weren't, make sure we don't crash before we
79479         get a chance to output an error message about incorrect usage.
79480
79481         sim: cris: touch up rvdummy handling
79482         Add quiet build support and make sure it's removed with `make clean`.
79483
79484         sim: cris: replace custom "dest" test field with new --argv0
79485         The #dest field used in the cris testsuite is a bit of hack to set the
79486         argv[0] for the tests to read out later on.  Now that the sim has an
79487         option to set argv[0] explicitly, we don't need this custom field, so
79488         let's drop it to harmonize the testsuites a little.
79489
79490         sim: run: add --argv0 option to control argv[0]
79491         We default argv[0] to the program we run which is a standard *NIX
79492         convention, but sometimes we want to be able to control the argv[0]
79493         setting independently (especially for programs that inspect argv[0]
79494         to change their behavior or output).  Add an option to control it.
79495
79496 2021-11-15  Mike Frysinger  <vapier@gentoo.org>
79497
79498         sim: split program path out of argv vector
79499         We use the program argv to both find the program to run (argv[0]) and
79500         to hold the arguments to the program.  Most of the time this is fine,
79501         but if we want to let programs specify argv[0] independently (which is
79502         possible in standard *NIX programs), this double duty doesn't work.
79503
79504         So let's split the path to the program to run out into a separate
79505         field by itself.  This simplifies the various sim_open funcs too.
79506
79507         By itself, this code is more of a logical cleanup than something that
79508         is super useful.  But it will open up customization of argv[0] in a
79509         follow up commit.  Split the changes to make it easier to review.
79510
79511 2021-11-15  Mike Frysinger  <vapier@gentoo.org>
79512
79513         sim: bfin: fix mach/xfail usage in tests
79514         Set the mach to the right value all the time, and update xfail to
79515         say the test fails on all targets.  WIth multitarget testing, the
79516         idea of target here doesn't make much sense.
79517
79518 2021-11-15  Alan Modra  <amodra@gmail.com>
79519
79520         -Waddress fixes for gold testsuite
79521         Current mainline gcc.
79522         common_test_1.c: In function 'main':
79523         common_test_1.c:56:14: error: comparison between two arrays [-Werror=array-compare]
79524            56 |   assert (c5 > c4);
79525               |              ^
79526         common_test_1.c:56:14: note: use '&c5[0] > &c4[0]' to compare the addresses
79527
79528                 * testsuite/common_test_1.c: Avoid -Waddress warnings.
79529                 * testsuite/common_test_1_v1.c: Likewise.
79530                 * testsuite/common_test_1_v2.c: Likewise.
79531                 * testsuite/script_test_2.cc: Likewise.
79532
79533 2021-11-15  Alan Modra  <amodra@gmail.com>
79534
79535         PowerPC64 @notoc in non-power10 code
79536         R_PPC64_REL24_P9NOTOC is a variant of R_PPC64_REL24_NOTOC for use on
79537         @notoc cals from non-power10 code in the rare case that using such a
79538         construct is useful.  R_PPC64_REL24_P9NOTOC will be emitted by gas
79539         rather than R_PPC64_REL24_NOTOC when @notoc is used in a branch
79540         instruction if power10 instructions are not enabled at that point.
79541         The new relocation tells the linker to not use power10 instructions on
79542         any stub emitted for that branch, unless overridden by
79543         --power10-stubs=yes.
79544
79545         The current linker heuristic of only generating power10 instructions
79546         for stubs if power10-only relocations are detected, continues to be
79547         used.
79548
79549         include/
79550                 * elf/ppc64.h (R_PPC64_REL24_P9NOTOC): Define.
79551         bfd/
79552                 * reloc.c (BFD_RELOC_PPC64_REL24_P9NOTOC): Define.
79553                 * elf64-ppc.c (ppc64_elf_howto_raw): Add entry for new reloc.
79554                 (ppc64_elf_reloc_type_lookup): Handle it.
79555                 (enum ppc_stub_type): Delete.
79556                 (enum ppc_stub_main_type, ppc_stub_sub_type): New.
79557                 (struct ppc_stub_type): New.
79558                 (struct ppc_stub_hash_entry): Use the above new type.
79559                 (struct ppc_link_hash_table): Update stub_count.
79560                 (is_branch_reloc, ppc64_elf_check_relocs),
79561                 (toc_adjusting_stub_needed): Handle new reloc.
79562                 (stub_hash_newfunc, select_alt_stub, ppc_merge_stub),
79563                 (ppc_type_of_stub, plt_stub_size, build_plt_stub),
79564                 (build_tls_get_addr_head, build_tls_get_addr_tail),
79565                 (ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_size_stubs),
79566                 (ppc64_elf_build_stubs, ppc64_elf_relocate_section): Handle new
79567                 reloc.  Modify stub handling to suit new scheme.
79568                 * bfd-in2.h: Regenerate.
79569                 * libbfd.h: Regenerate.
79570         gas/
79571                 * config/tc-ppc.c (ppc_elf_suffix): When power10 is not enabled
79572                 return BFD_RELOC_PPC64_REL24_P9NOTOC for @notoc.
79573                 (fixup_size, ppc_force_relocation, ppc_fix_adjustable): Handle
79574                 BFD_RELOC_PPC64_REL24_P9NOTOC.
79575         ld/
79576                 * testsuite/ld-powerpc/callstub-2.s: Add .machine power10.
79577
79578 2021-11-15  Alan Modra  <amodra@gmail.com>
79579
79580         Regenerate a couple of files
79581         A couple of files changed on my latest --enable-maintainer-mode
79582         build.  ld/Makefile.in had a missing dependency but better sorting of
79583         the loongson entries.
79584
79585         intl/
79586                 * configure: Regenerate.
79587         ld/
79588                 * Makefile.am: Sort loongson entries.
79589                 * Makefile.in: Regenerate.
79590
79591 2021-11-15  Pedro Alves  <pedro@palves.net>
79592
79593         Fix build with current GCC: EL_EXPLICIT(location) always non-NULL
79594         Compiling GDB with current GCC (1b4a63593b) runs into this:
79595
79596           src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
79597           src/gdb/location.c:963:38: error: the address of 'event_location::<unnamed union>::explicit_loc' will never be NULL [-Werror=address]
79598             963 |       return (EL_EXPLICIT (location) == NULL
79599                 |                                      ^
79600           src/gdb/location.c:57:30: note: 'event_location::<unnamed union>::explicit_loc' declared here
79601              57 |     struct explicit_location explicit_loc;
79602                 |                              ^~~~~~~~~~~~
79603
79604         GCC is right, EL_EXPLICIT is defined as returning the address of an
79605         union field:
79606
79607               /* An explicit location.  */
79608               struct explicit_location explicit_loc;
79609           #define EL_EXPLICIT(P) (&((P)->u.explicit_loc))
79610
79611         and thus must always be non-NULL.
79612
79613         Change-Id: Ie74fee7834495a93affcefce03c06e4d83ad8191
79614
79615 2021-11-15  GDB Administrator  <gdbadmin@sourceware.org>
79616
79617         Automatic date update in version.in
79618
79619 2021-11-14  Lancelot SIX  <lsix@lancelotsix.com>
79620
79621         [PR gdb/16238] Add completer for the show user command
79622         The 'show user' command (which shows the definition of non-python/scheme
79623         user defined commands) is currently missing a completer. This is
79624         mentioned in PR 16238.  Having one can improve the user experience.
79625
79626         In this commit I propose an implementation for such completer as well as
79627         the associated tests.
79628
79629         Tested on x86_64 GNU/Linux.
79630
79631         All feedbacks are welcome.
79632
79633         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16238
79634
79635 2021-11-14  Alan Modra  <amodra@gmail.com>
79636
79637         sync libbacktrace from gcc
79638
79639 2021-11-14  GDB Administrator  <gdbadmin@sourceware.org>
79640
79641         Automatic date update in version.in
79642
79643 2021-11-13  H.J. Lu  <hjl.tools@gmail.com>
79644
79645         Sync Makefile.tpl with GCC
79646                 * Makefile.tpl: Sync with GCC.
79647                 * Makefile.in: Regenerate.
79648
79649 2021-11-13  Mike Frysinger  <vapier@gentoo.org>
79650
79651         sim: sh: fix switch-bool warnings
79652         This code triggers -Werror=switch-bool warnings with <=gcc-5 versions.
79653         Rework it to use if statements instead as it also simplifies a bit.
79654
79655         sim: sh: rework carry checks to not rely on integer overflows
79656         In <=gcc-7 versions, -fstrict-overflow is enabled by default, and that
79657         triggers warnings in this code that relies on integer overflows to test
79658         for carries.  Change the logic to test against the limit directly.
79659
79660 2021-11-13  GDB Administrator  <gdbadmin@sourceware.org>
79661
79662         Automatic date update in version.in
79663
79664 2021-11-12  Carl Love  <cel@us.ibm.com>
79665
79666         Fix gdb.base/sigstep.exp test for ppc
79667         The test stops at <signal_handler called> which is the call to the handler
79668         rather than in the handler as intended.  This patch replaces the
79669         gdb_test "$enter_cmd to handler" with a gdb_test_multiple test.  The multiple
79670         test looks for the stop at <signal_handler called>.  If found, the command
79671         is issued again.  The test passes if gdb stops in the handler as expected.
79672
79673         (gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step
79674         from handler: continue to signal
79675         stepi
79676         <signal handler called>
79677         1: x/i $pc
79678         => 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>:       bctrl
79679         (gdb) stepi
79680         handler (sig=551) at sigstep.c:32
79681         32      {
79682         1: x/i $pc
79683         => 0x10000097c <handler>:       addis   r2,r12,2
79684         (gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler,
79685         step from handler: stepi to handler
79686
79687         Patch has been tested on x86_64-linux and ppc64le-linux with no test failures.
79688
79689 2021-11-12  Tom de Vries  <tdevries@suse.de>
79690
79691         [gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp
79692         On OBS I ran into:
79693         ...
79694         (gdb) PASS: gdb.base/foll-vfork.exp: exit: \
79695           vfork relations in info inferiors: continue to child exit
79696         info inferiors^M
79697           Num  Description       Connection           Executable        ^M
79698           1    <null>                                 foll-vfork-exit ^M
79699         * 2    <null>                                 foll-vfork-exit ^M
79700         (gdb) I'm the proud parent of child #5044!^M
79701         FAIL: gdb.base/foll-vfork.exp: exit: vfork relations in info inferiors: \
79702           vfork relation no longer appears in info inferiors (timeout)
79703         ...
79704
79705         Fix this by removing the '$' anchor in the corresponding '$gdb_prompt $'
79706         regexps.
79707
79708         Tested on x86_64-linux.
79709
79710 2021-11-12  Alan Modra  <amodra@gmail.com>
79711
79712         Don't compile some opcodes files when bfd is 32-bit only
79713                 * Makefile.am (TARGET_LIBOPCODES_CFILES): Split into..
79714                 (TARGET64_LIBOPCODES_CFILES): ..this and..
79715                 (TARGET32_LIBOPCODES_CFILES): ..this.
79716                 (ALL_MACHINES): Likewise split to
79717                 (ALL64_MACHINES, ALL32_MACHINES): ..this.
79718                 * disassemble.c: Define some ARCH_* when ARCH_all only if BFD64.
79719                 * configure.ac (BFD_MACHINES): Defined depending on BFD_ARCH_SIZE.
79720                 * Makefile.in: Regenerate.
79721                 * configure: Regenerate.
79722
79723         Import Makefile.def from gcc
79724                 * Makefile.def: Import from gcc.
79725                 * Makefile.in: Regenerate.
79726
79727 2021-11-12  Alan Modra  <amodra@gmail.com>
79728
79729         Fix demangle style usage info
79730         Extract allowed styles from libiberty, so we don't have to worry about
79731         our help messages getting out of date.  The function probably belongs
79732         in libiberty/cplus-dem.c but it can be here for a while to iron out
79733         bugs.
79734
79735                 PR 28581
79736                 * demanguse.c: New file.
79737                 * demanguse.h: New file.
79738                 * nm.c (usage): Break up output.  Use display_demangler_styles.
79739                 * objdump.c (usage): Use display_demangler_styles.
79740                 * readelf.c (usage): Likewise.
79741                 * Makefile.am: Add demanguse.c and demanguse.h.
79742                 * Makefile.in: Regenerate.
79743                 * po/POTFILESin: Regenerate.
79744
79745 2021-11-12  GDB Administrator  <gdbadmin@sourceware.org>
79746
79747         Automatic date update in version.in
79748
79749 2021-11-11  Simon Marchi  <simon.marchi@efficios.com>
79750
79751         gdb: fix "set scheduler-locking" thread exit hang
79752         GDB hangs when doing this:
79753
79754          - launch inferior with multiple threads
79755          - multiple threads hit some breakpoint(s)
79756          - one breakpoint hit is presented as a stop, the rest are saved as
79757            pending wait statuses
79758          - "set scheduler-locking on"
79759          - resume the currently selected thread (because of scheduler-locking,
79760            it's the only one resumed), let it execute until exit
79761          - GDB hangs, not showing the prompt, impossible to interrupt with ^C
79762
79763         When the resumed thread exits, we expect the target to return a
79764         TARGET_WAITKIND_NO_RESUMED event, and that's what we see:
79765
79766             [infrun] fetch_inferior_event: enter
79767               [infrun] scoped_disable_commit_resumed: reason=handling event
79768               [infrun] random_pending_event_thread: None found.
79769             [Thread 0x7ffff7d9c700 (LWP 309357) exited]
79770               [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
79771               [infrun] print_target_wait_results:   -1.0.0 [process -1],
79772               [infrun] print_target_wait_results:   status->kind = no-resumed
79773               [infrun] handle_inferior_event: status->kind = no-resumed
79774               [infrun] handle_no_resumed: TARGET_WAITKIND_NO_RESUMED (ignoring: found resumed)
79775               [infrun] prepare_to_wait: prepare_to_wait
79776               [infrun] reset: reason=handling event
79777               [infrun] maybe_set_commit_resumed_all_targets: not requesting commit-resumed for target native, no resumed threads
79778             [infrun] fetch_inferior_event: exit
79779
79780         The problem is in handle_no_resumed: we check if some other thread is
79781         actually resumed, to see if we should ignore that event (see comments in
79782         that function for more info).  If this condition is true:
79783
79784             (thread->executing () || thread->has_pending_waitstatus ())
79785
79786         ... then we ignore the event.  The problem is that there are some non-resumed
79787         threads with a pending event, which makes us ignore the event.  But these
79788         threads are not resumed, so we end up waiting while nothing executes, hence
79789         waiting for ever.
79790
79791         My first fix was to change the condition to:
79792
79793             (thread->executing ()
79794              || (thread->resumed () && thread->has_pending_waitstatus ()))
79795
79796         ... but then it occured to me that we could simply check for:
79797
79798             (thread->resumed ())
79799
79800         Since "executing" implies "resumed", checking simply for "resumed"
79801         covers threads that are resumed and executing, as well as threads that
79802         are resumed with a pending status, which is what we want.
79803
79804         Change-Id: Ie796290f8ae7f34c026ca3a8fcef7397414f4780
79805
79806 2021-11-11  Tom de Vries  <tdevries@suse.de>
79807
79808         [gdb/build] Fix Wimplicit-exception-spec-mismatch in clang build
79809         When building with clang 13 (and -std=gnu++17 to work around an issue in
79810         string_view-selftests.c), we run into a few Wimplicit-exception-spec-mismatch
79811         warnings:
79812         ...
79813         src/gdbsupport/new-op.cc:102:1: error: function previously declared with an \
79814           explicit exception specification redeclared with an implicit exception \
79815           specification [-Werror,-Wimplicit-exception-spec-mismatch]
79816         operator delete (void *p)
79817         ^
79818         /usr/include/c++/11/new:130:6: note: previous declaration is here
79819         void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
79820              ^
79821         ...
79822
79823         These are due to recent commit 5fff6115fea "Fix
79824         LD_PRELOAD=/usr/lib64/libasan.so.6 gdb".
79825
79826         Fix this by adding the missing noexcept.
79827
79828         Build on x86_64-linux, using gcc 7.5.0 and clang 13.0.0.
79829
79830 2021-11-11  Tom de Vries  <tdevries@suse.de>
79831
79832         [gdb/build] Fix build with -std=c++11
79833         When building with -std=c++11, we run into two Werror=missing-declarations:
79834         ...
79835         new-op.cc: In function 'void operator delete(void*, std::size_t)':
79836         new-op.cc:114:1: error: no previous declaration for \
79837           'void operator delete(void*, std::size_t)' [-Werror=missing-declarations]
79838          operator delete (void *p, std::size_t) noexcept
79839          ^~~~~~~~
79840         new-op.cc: In function 'void operator delete [](void*, std::size_t)':
79841         new-op.cc:132:1: error: no previous declaration for \
79842           'void operator delete [](void*, std::size_t)' [-Werror=missing-declarations]
79843          operator delete[] (void *p, std::size_t) noexcept
79844          ^~~~~~~~
79845         ...
79846
79847         These are due to recent commit 5fff6115fea "Fix
79848         LD_PRELOAD=/usr/lib64/libasan.so.6 gdb".
79849
79850         The declarations are provided by <new> (which is included) for c++14 onwards,
79851         but they are missing for c++11.
79852
79853         Fix this by adding the missing declarations.
79854
79855         Tested on x86_64-linux, with gcc 7.5.0, both without (implying -std=gnu++14) and
79856         with -std=c++11.
79857
79858 2021-11-11  Tom de Vries  <tdevries@suse.de>
79859
79860         [gdb/testsuite] Add gdb.arch/ppc64-break-on-_exit.exp
79861         Add a regression test-case for commit a50bdb99afe "[gdb/tdep, rs6000] Don't
79862         skip system call in skip_prologue":
79863         - set a breakpoint on a local copy of glibc's _exit, and
79864         - verify that it triggers.
79865
79866         The test-case uses an assembly file by default, but also has the possibility
79867         to use a C source file instead.
79868
79869         Tested on ppc64le-linux.  Verified that the test-case fails without
79870         aforementioned commit, and passes with the commit.  Both with assembly
79871         and C source.
79872
79873 2021-11-11  Nelson Chu  <nelson.chu@sifive.com>
79874
79875         RISC-V: Dump objects according to the elf architecture attribute.
79876         For now we should always generate the elf architecture attribute both for
79877         elf and linux toolchains, so that we could dump the objects correctly
79878         according to the generated architecture string.  This patch resolves the
79879         problem that we probably dump an object with c.nop instructions, but
79880         in fact the c extension isn't allowed.  Consider the following case,
79881
79882         nelson@LAPTOP-QFSGI1F2:~/test$ cat temp.s
79883         .option norvc
79884         .option norelax
79885         .text
79886         add     a0, a0, a0
79887         .byte   0x1
79888         .balign 16
79889         nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-as temp.s -o temp.o
79890         nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-objdump -d temp.o
79891
79892         temp.o:     file format elf32-littleriscv
79893
79894         Disassembly of section .text:
79895
79896         00000000 <.text>:
79897            0:   00a50533                add     a0,a0,a0
79898            4:   01                      .byte   0x01
79899            5:   00                      .byte   0x00
79900            6:   0001                    nop
79901            8:   00000013                nop
79902            c:   00000013                nop
79903         nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-readelf -A temp.o
79904         Attribute Section: riscv
79905         File Attributes
79906           Tag_RISCV_arch: "rv32i2p0_m2p0_a2p0_f2p0_d2p0"
79907
79908         The c.nop at address 0x6 is generated for alignment, but since the rvc isn't
79909         allowed for this object, dump it as a c.nop instruction looks wrong.  After
79910         applying this patch, I get the following result,
79911
79912         nelson@LAPTOP-QFSGI1F2:~/test$ ~/binutils-dev/build-elf32-upstream/build-install/bin/riscv32-unknown-elf-objdump -d temp.o
79913
79914         temp.o:     file format elf32-littleriscv
79915
79916         Disassembly of section .text:
79917
79918         00000000 <.text>:
79919            0:   00a50533                add     a0,a0,a0
79920            4:   01                      .byte   0x01
79921            5:   00                      .byte   0x00
79922            6:   0001                    .2byte  0x1
79923            8:   00000013                nop
79924            c:   00000013                nop
79925
79926         For the current objdump, we dump data to .byte/.short/.word/.dword, and
79927         dump the unknown or unsupported instructions to .2byte/.4byte/.8byte, which
79928         respectively are 2, 4 and 8 bytes instructions.  Therefore, we shouldn't
79929         dump the 0x0001 as a c.nop instruction in the above case, we should dump
79930         it to .2byte 0x1 as a unknown instruction, since the rvc is disabled.
79931
79932         However, consider that some people may use the new objdump to dump the old
79933         objects, which don't have any elf attributes.  We usually set the default
79934         architecture string to rv64g by bfd/elfxx-riscv.c:riscv_set_default_arch.
79935         But this will cause rvc instructions to be unrecognized.  Therefore, we
79936         set the default architecture string to rv64gc for disassembler, to keep
79937         the previous behavior.
79938
79939         This patch pass the riscv-gnu-toolchain gcc/binutils regressions for
79940         rv32emc-elf, rv32gc-linux, rv32i-elf, rv64gc-elf and rv64gc-linux
79941         toolchains.  Also, tested by --enable-targets=all and can build
79942         riscv-gdb successfully.
79943
79944         bfd/
79945                 * elfnn-riscv.c (riscv_merge_arch_attr_info): Tidy the
79946                 codes for riscv_parse_subset_t setting.
79947                 * elfxx-riscv.c (riscv_get_default_ext_version): Updated.
79948                 (riscv_subset_supports): Moved from gas/config/tc-riscv.c.
79949                 (riscv_multi_subset_supports): Likewise.
79950                 * elfxx-riscv.h: Added extern for riscv_subset_supports and
79951                 riscv_multi_subset_supports.
79952         gas/
79953                 * config/tc-riscv.c (riscv_subset_supports): Moved to
79954                 bfd/elfxx-riscv.c.
79955                 (riscv_multi_subset_supports): Likewise.
79956                 (riscv_rps_as): Defined for architectrue parser.
79957                 (riscv_set_arch): Updated.
79958                 (riscv_set_abi_by_arch): Likewise.
79959                 (riscv_csr_address): Likewise.
79960                 (reg_lookup_internal): Likewise.
79961                 (riscv_ip): Likewise.
79962                 (s_riscv_option): Updated.
79963                 * testsuite/gas/riscv/mapping-04b.d: Updated.
79964                 * testsuite/gas/riscv/mapping-norelax-03b.d: Likewise.
79965                 * testsuite/gas/riscv/mapping-norelax-04b.d: Likewise.
79966         opcodes/
79967                 * riscv-dis.c: Include elfxx-riscv.h since we need the
79968                 architecture parser.  Also removed the cpu-riscv.h, it
79969                 is already included in elfxx-riscv.h.
79970                 (default_isa_spec): Defined since the parser need this
79971                 to set the default architecture string.
79972                 (xlen): Moved out from riscv_disassemble_insn as a global
79973                 variable, it is more convenient to initialize riscv_rps_dis.
79974                 (riscv_subsets): Defined to recoed the supported
79975                 extensions.
79976                 (riscv_rps_dis): Defined for architectrue parser.
79977                 (riscv_disassemble_insn): Call riscv_multi_subset_supports
79978                 to make sure if the instructions are valid or not.
79979                 (print_insn_riscv): Initialize the riscv_subsets by parsing
79980                 the elf architectrue attribute.  Otherwise, set the default
79981                 architectrue string to rv64gc.
79982
79983 2021-11-11  Mike Frysinger  <vapier@gentoo.org>
79984
79985         sim: testsuite: drop sim_compile cover function
79986         Most code isn't using this, and the only call site (in one cris file)
79987         can use target_compile directly.  So switch it over to simplify.
79988
79989         sim: cris: stop testing a.out explicitly [ld/13900]
79990         Since gcc dropped support for a.out starting with 4.4.0 in 2009, it's
79991         been impossible to verify this code actually still works.  Since it
79992         crashes in ld, and it uses a config option that no other tests uses
79993         and we want to remove, drop the test to avoid all the trouble.
79994
79995         sim: io: tweak compiler workaround with error output
79996         Outputting an extra space broke a cris test.  Change the workaround
79997         to use %s with an empty string to avoid the compiler warning but not
79998         output an extra space.
79999
80000         sim: testsuite: delete unused arm remote host logic
80001         There's no need to sync testutils.inc with remote hosts.  The one
80002         we have in the source tree is all we need and only thing we test.
80003         Delete it to simplify.
80004
80005         sim: synacor: simplify test generation
80006         Objcopy was used to create a binary file of just the executable code
80007         since the environment requires code to based at address 0.  We can
80008         accomplish the same thing with the -Ttext=0 flag, so switch to that
80009         to get rid of custom logic.
80010
80011 2021-11-11  GDB Administrator  <gdbadmin@sourceware.org>
80012
80013         Automatic date update in version.in
80014
80015 2021-11-10  Tom Tromey  <tromey@adacore.com>
80016
80017         Handle PIE in .debug_loclists
80018         Simon pointed out that my recent patches to .debug_loclists caused
80019         some regressions.  After a brief discussion we realized it was because
80020         his system compiler defaults to PIE.
80021
80022         This patch changes this code to unconditionally apply the text offset
80023         here.  It also changes loclist_describe_location to work more like
80024         dwarf2_find_location_expression.
80025
80026         I tested this by running the gdb.dwarf2 tests both with and without
80027         -pie.
80028
80029 2021-11-10  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
80030
80031         arm: enable Cortex-A710 CPU
80032         This patch is adding support for Cortex-A710 CPU in Arm.
80033
80034         bfd/
80035
80036                 * cpu-arm.c (processors): Add cortex-a710.
80037
80038         gas/
80039
80040                 * NEWS: Update docs.
80041                 * config/tc-arm.c (arm_cpus): Add cortex-a710 to -mcpu.
80042                 * doc/c-arm.texi: Update docs.
80043                 * testsuite/gas/arm/cpu-cortex-a710.d: New test.
80044
80045 2021-11-10  Clément Chigot  <clement.chigot@atos.net>
80046
80047         gdb: adjust x_file fields on COFF readers
80048         Commit e86fc4a5bc37 ("PR 28447: implement multiple parameters for .file
80049         on XCOFF") changes the structure associated to the internal
80050         representation of files in COFF formats.  However, gdb directory update
80051         has been forgotten, leading to compilation errors of this kind:
80052
80053               CXX    coffread.o
80054             /home/simark/src/binutils-gdb/gdb/coffread.c: In function 'const char* coff_getfilename(internal_auxent*)':
80055             /home/simark/src/binutils-gdb/gdb/coffread.c:1343:29: error: 'union internal_auxent::<unnamed struct>::<unnamed>' has no member named 'x_zeroes'
80056              1343 |   if (aux_entry->x_file.x_n.x_zeroes == 0)
80057                   |                             ^~~~~~~~
80058
80059         Fix it by adjusting the COFF code in GDB.
80060
80061         Change-Id: I703fa134bc722d47515efbd72b88fa5650af6c3c
80062
80063 2021-11-10  Tom de Vries  <tdevries@suse.de>
80064
80065         [gdb/testsuite] Add gdb.opt/break-on-_exit.exp
80066         Add a test-case to excercise the problem scenario reported in PR28527 and
80067         fixed in commit a50bdb99afe "[gdb/tdep, rs6000] Don't skip system call in
80068         skip_prologue":
80069         - set a breakpoint on _exit, and
80070         - verify that it triggers.
80071
80072         Note that this is not a regression test for that commit.  Since the actual
80073         code in _exit may vary across os instances, we cannot guarantee that the
80074         problem will always trigger with this test-case.
80075
80076         Rather, this test-case is a version of the original test-case
80077         (gdb.threads/process-dies-while-detaching.exp) that is minimal while still
80078         reproducing the problem reported in PR28527, in that same setting.
80079
80080         The benefit of this test-case is that it exercise real-life code and may
80081         expose similar problems in other settings.  Also, it provides a much easier
80082         test-case to investigate in case a similar problem occurs.
80083
80084         Tested on x86_64-linux and ppc64le-linux.
80085
80086 2021-11-10  Mike Frysinger  <vapier@gentoo.org>
80087
80088         sim: frv: flip trapdump default back to off
80089         When I refactored this by scoping it to sim-frv-xxx in commit
80090         e7954ef5e5ed90fb7d28c013518f4c2e6bcd20a1 ("sim: frv: scope the
80091         unique configure flag"), I changed the default from off to on.
80092         While the feature is nice for developers, it breaks a bunch of
80093         tests which aren't expecting this extra output.  So flip it back
80094         to off by default.
80095
80096 2021-11-10  Pekka Seppänen  <pexu@sourceware.mail.kapsi.fi>
80097
80098         PR28575, readelf.c and strings.c use undefined type uint
80099         Since --unicode support (commit b3aa80b45c4) both binutils/readelf.c
80100         and binutils/strings.c use 'uint' in a few locations.  It likely
80101         should be 'unsigned int' since there isn't anything defining 'uint'
80102         within binutils (besides zlib) and AFAIK it isn't a standard type.
80103
80104                 * readelf.c (print_symbol): Replace uint with unsigned int.
80105                 * strings.c (string_min, display_utf8_char): Likewise.
80106                 (print_unicode_stream_body, print_unicode_stream): Likewise.
80107                 (print_strings): Likewise.
80108                 (get_unicode_byte): Wrap long line.
80109
80110 2021-11-10  Clément Chigot  <clement.chigot@atos.net>
80111
80112         ld: set correct flags for AIX shared tests
80113         Previous flags were aimed to be run with XLC.
80114         Nowadays, only GCC is being tested with GNU toolchain. Moreover,
80115         recent XLC versions might also accept "-shared".
80116
80117                 * testsuite/ld-shared/shared.exp: Adjust shared flags.
80118
80119 2021-11-10  Clément Chigot  <clement.chigot@atos.net>
80120
80121         PR 28447: implement multiple parameters for .file on XCOFF
80122         On XCOFF, ".file" pseudo-op allows 3 extras parameters to provide
80123         additional information to AIX linker, or its debugger. These are
80124         stored in auxiliary entries of the C_FILE symbol.
80125
80126         bfd/
80127                 PR 28447
80128                 * coffcode.h (combined_entry_type): Add extrap field.
80129                 (coff_bigobj_swap_aux_in): Adjust names of x_file fields.
80130                 (coff_bigobj_swap_aux_out): Likewise.
80131                 * coffgen.c (coff_write_auxent_fname): New function.
80132                 (coff_fix_symbol_name): Write x_file using
80133                  coff_write_auxent_fname.
80134                 (coff_write_symbol): Likewise.
80135                 (coff_write_symbols): Add C_FILE auxiliary entries to
80136                 string table if needed.
80137                 (coff_get_normalized_symtab): Adjust names of x_file fields.
80138                 Normalize C_FILE auxiliary entries.
80139                 (coff_print_symbol): Print C_FILE auxiliary entries.
80140                 * coff-rs6000.c (_bfd_xcoff_swap_aux_in): Adjust names of
80141                 x_file fields.
80142                 (_bfd_xcoff_swap_aux_out): Likewise.
80143                 * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
80144                 (_bfd_xcoff64_swap_aux_out): Likewise.
80145                 * cofflink.c (_bfd_coff_final_link): Likewise.
80146                 (_bfd_coff_link_input_bfd): Likewise.
80147                 * coffswap.h (coff_swap_aux_in): Likewise.
80148                 * peXXigen.c (_bfd_XXi_swap_aux_in): Likewise.
80149                 (_bfd_XXi_swap_aux_out): Likewise.
80150                 * xcofflink.c (xcoff_link_input_bfd): Likewise.
80151                 * libcoff.h: Regenerate.
80152         gas/
80153                 * config/tc-ppc.c (ppc_file): New function.
80154                 * config/tc-ppc.h (OBJ_COFF_MAX_AUXENTRIES): Change to 4.
80155                 * testsuite/gas/ppc/aix.exp: Add tests.
80156                 * testsuite/gas/ppc/xcoff-file-32.d: New test.
80157                 * testsuite/gas/ppc/xcoff-file-64.d: New test.
80158                 * testsuite/gas/ppc/xcoff-file.s: New test.
80159         include/
80160                 * coff/internal.h (union internal_auxent): Change x_file to be a
80161                   struct instead of a union. Add x_ftype field.
80162                 * coff/rs6000.h (union external_auxent): Add x_resv field.
80163                 * coff/xcoff.h (XFT_FN): New define.
80164                 (XFT_CT): Likewise.
80165                 (XFT_CV): Likewise.
80166                 (XFT_CD): Likewise.
80167
80168 2021-11-10  Kevin Buettner  <kevinb@redhat.com>
80169
80170         Test case for Bug 28308
80171         The purpose of this test is described in the comments in
80172         dprintf-execution-x-script.exp.
80173
80174         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28308
80175
80176         The name of this new test was based on that of an existing test,
80177         bp-cmds-execution-x-script.exp.  I started off by copying that test,
80178         adding to it, and then rewriting almost all of it.  It's different
80179         enough that I decided that listing the copyright year as 2021
80180         was sufficient.
80181
80182 2021-11-10  Kevin Buettner  <kevinb@redhat.com>
80183
80184         Fix PR 28308 - dprintf breakpoints not working when run from script
80185         This commit fixes Bug 28308, titled "Strange interactions with
80186         dprintf and break/commands":
80187
80188         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28308
80189
80190         Since creating that bug report, I've found a somewhat simpler way of
80191         reproducing the problem.  I've encapsulated it into the GDB test case
80192         which I've created along with this bug fix.  The name of the new test
80193         is gdb.base/dprintf-execution-x-script.exp, I'll demonstrate the
80194         problem using this test case, though for brevity, I've placed all
80195         relevant files in the same directory and have renamed the files to all
80196         start with 'dp-bug' instead of 'dprintf-execution-x-script'.
80197
80198         The script file, named dp-bug.gdb, consists of the following commands:
80199
80200         dprintf increment, "dprintf in increment(), vi=%d\n", vi
80201         break inc_vi
80202         commands
80203           continue
80204         end
80205         run
80206
80207         Note that the final command in this script is 'run'.  When 'run' is
80208         instead issued interactively, the  bug does not occur.  So, let's look
80209         at the interactive case first in order to see the correct/expected
80210         output:
80211
80212         $ gdb -q -x dp-bug.gdb dp-bug
80213         ... eliding buggy output which I'll discuss later ...
80214         (gdb) run
80215         Starting program: /mesquite2/sourceware-git/f34-master/bld/gdb/tmp/dp-bug
80216         vi=0
80217         dprintf in increment(), vi=0
80218
80219         Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
80220         26      in dprintf-execution-x-script.c
80221         vi=1
80222         dprintf in increment(), vi=1
80223
80224         Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
80225         26      in dprintf-execution-x-script.c
80226         vi=2
80227         dprintf in increment(), vi=2
80228
80229         Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
80230         26      in dprintf-execution-x-script.c
80231         vi=3
80232         [Inferior 1 (process 1539210) exited normally]
80233
80234         In this run, in which 'run' was issued from the gdb prompt (instead
80235         of at the end of the script), there are three dprintf messages along
80236         with three 'Breakpoint 2' messages.  This is the correct output.
80237
80238         Now let's look at the output that I snipped above; this is the output
80239         when 'run' is issued from the script loaded via GDB's -x switch:
80240
80241         $ gdb -q -x dp-bug.gdb dp-bug
80242         Reading symbols from dp-bug...
80243         Dprintf 1 at 0x40116e: file dprintf-execution-x-script.c, line 38.
80244         Breakpoint 2 at 0x40113a: file dprintf-execution-x-script.c, line 26.
80245         vi=0
80246         dprintf in increment(), vi=0
80247
80248         Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
80249         26      dprintf-execution-x-script.c: No such file or directory.
80250         vi=1
80251
80252         Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
80253         26      in dprintf-execution-x-script.c
80254         vi=2
80255
80256         Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
80257         26      in dprintf-execution-x-script.c
80258         vi=3
80259         [Inferior 1 (process 1539175) exited normally]
80260
80261         In the output shown above, only the first dprintf message is printed.
80262         The 2nd and 3rd dprintf messages are missing!  However, all three
80263         'Breakpoint 2...' messages are still printed.
80264
80265         Why does this happen?
80266
80267         bpstat_do_actions_1() in gdb/breakpoint.c contains the following
80268         comment and code near the start of the function:
80269
80270           /* Avoid endless recursion if a `source' command is contained
80271              in bs->commands.  */
80272           if (executing_breakpoint_commands)
80273             return 0;
80274
80275           scoped_restore save_executing
80276             = make_scoped_restore (&executing_breakpoint_commands, 1);
80277
80278         Also, as described by this comment prior to the 'async' field
80279         in 'struct ui' in top.h, the main UI starts off in sync mode
80280         when processing command line arguments:
80281
80282           /* True if the UI is in async mode, false if in sync mode.  If in
80283              sync mode, a synchronous execution command (e.g, "next") does not
80284              return until the command is finished.  If in async mode, then
80285              running a synchronous command returns right after resuming the
80286              target.  Waiting for the command's completion is later done on
80287              the top event loop.  For the main UI, this starts out disabled,
80288              until all the explicit command line arguments (e.g., `gdb -ex
80289              "start" -ex "next"') are processed.  */
80290
80291         This combination of things, the state of the static global
80292         'executing_breakpoint_commands' plus the state of the async
80293         field in the main UI causes this behavior.
80294
80295         This is a backtrace after hitting the dprintf breakpoint for
80296         the second time when doing 'run' from the script file, i.e.
80297         non-interactively:
80298
80299         Thread 1 "gdb" hit Breakpoint 3, bpstat_do_actions_1 (bsp=0x7fffffffc2b8)
80300             at /ironwood1/sourceware-git/f34-master/bld/../../worktree-master/gdb/breakpoint.c:4431
80301         4431      if (executing_breakpoint_commands)
80302
80303          #0  bpstat_do_actions_1 (bsp=0x7fffffffc2b8)
80304              at gdb/breakpoint.c:4431
80305          #1  0x00000000004d8bc6 in dprintf_after_condition_true (bs=0x1538090)
80306              at gdb/breakpoint.c:13048
80307          #2  0x00000000004c5caa in bpstat_stop_status (aspace=0x116dbc0, bp_addr=0x40116e, thread=0x137f450, ws=0x7fffffffc718,
80308              stop_chain=0x1538090) at gdb/breakpoint.c:5498
80309          #3  0x0000000000768d98 in handle_signal_stop (ecs=0x7fffffffc6f0)
80310              at gdb/infrun.c:6172
80311          #4  0x00000000007678d3 in handle_inferior_event (ecs=0x7fffffffc6f0)
80312              at gdb/infrun.c:5662
80313          #5  0x0000000000763cd5 in fetch_inferior_event ()
80314              at gdb/infrun.c:4060
80315          #6  0x0000000000746d7d in inferior_event_handler (event_type=INF_REG_EVENT)
80316              at gdb/inf-loop.c:41
80317          #7  0x00000000007a702f in handle_target_event (error=0, client_data=0x0)
80318              at gdb/linux-nat.c:4207
80319          #8  0x0000000000b8cd6e in gdb_wait_for_event (block=block@entry=0)
80320              at gdbsupport/event-loop.cc:701
80321          #9  0x0000000000b8d032 in gdb_wait_for_event (block=0)
80322              at gdbsupport/event-loop.cc:597
80323          #10 gdb_do_one_event () at gdbsupport/event-loop.cc:212
80324          #11 0x00000000009d19b6 in wait_sync_command_done ()
80325              at gdb/top.c:528
80326          #12 0x00000000009d1a3f in maybe_wait_sync_command_done (was_sync=0)
80327              at gdb/top.c:545
80328          #13 0x00000000009d2033 in execute_command (p=0x7fffffffcb18 "", from_tty=0)
80329              at gdb/top.c:676
80330          #14 0x0000000000560d5b in execute_control_command_1 (cmd=0x13b9bb0, from_tty=0)
80331              at gdb/cli/cli-script.c:547
80332          #15 0x000000000056134a in execute_control_command (cmd=0x13b9bb0, from_tty=0)
80333              at gdb/cli/cli-script.c:717
80334          #16 0x00000000004c3bbe in bpstat_do_actions_1 (bsp=0x137f530)
80335              at gdb/breakpoint.c:4469
80336          #17 0x00000000004c3d40 in bpstat_do_actions ()
80337              at gdb/breakpoint.c:4533
80338          #18 0x00000000006a473a in command_handler (command=0x1399ad0 "run")
80339              at gdb/event-top.c:624
80340          #19 0x00000000009d182e in read_command_file (stream=0x113e540)
80341              at gdb/top.c:443
80342          #20 0x0000000000563697 in script_from_file (stream=0x113e540, file=0x13bb0b0 "dp-bug.gdb")
80343              at gdb/cli/cli-script.c:1642
80344          #21 0x00000000006abd63 in source_gdb_script (extlang=0xc44e80 <extension_language_gdb>, stream=0x113e540,
80345              file=0x13bb0b0 "dp-bug.gdb") at gdb/extension.c:188
80346          #22 0x0000000000544400 in source_script_from_stream (stream=0x113e540, file=0x7fffffffd91a "dp-bug.gdb",
80347              file_to_open=0x13bb0b0 "dp-bug.gdb")
80348              at gdb/cli/cli-cmds.c:692
80349          #23 0x0000000000544557 in source_script_with_search (file=0x7fffffffd91a "dp-bug.gdb", from_tty=1, search_path=0)
80350              at gdb/cli/cli-cmds.c:750
80351          #24 0x00000000005445cf in source_script (file=0x7fffffffd91a "dp-bug.gdb", from_tty=1)
80352              at gdb/cli/cli-cmds.c:759
80353          #25 0x00000000007cf6d9 in catch_command_errors (command=0x5445aa <source_script(char const*, int)>,
80354              arg=0x7fffffffd91a "dp-bug.gdb", from_tty=1, do_bp_actions=false)
80355              at gdb/main.c:523
80356          #26 0x00000000007cf85d in execute_cmdargs (cmdarg_vec=0x7fffffffd1b0, file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND,
80357              ret=0x7fffffffd18c) at gdb/main.c:615
80358          #27 0x00000000007d0c8e in captured_main_1 (context=0x7fffffffd3f0)
80359              at gdb/main.c:1322
80360          #28 0x00000000007d0eba in captured_main (data=0x7fffffffd3f0)
80361              at gdb/main.c:1343
80362          #29 0x00000000007d0f25 in gdb_main (args=0x7fffffffd3f0)
80363              at gdb/main.c:1368
80364          #30 0x00000000004186dd in main (argc=5, argv=0x7fffffffd508)
80365              at gdb/gdb.c:32
80366
80367         There are two frames for bpstat_do_actions_1(), one at frame #16 and
80368         the other at frame #0.  The one at frame #16 is processing the actions
80369         for Breakpoint 2, which is a 'continue'.  The one at frame #0 is attempting
80370         to process the dprintf breakpoint action.  However, at this point,
80371         the value of 'executing_breakpoint_commands' is 1, forcing an early
80372         return, i.e. prior to executing the command(s) associated with the dprintf
80373         breakpoint.
80374
80375         For the sake of comparison, this is what the stack looks like when hitting
80376         the dprintf breakpoint for the second time when issuing the 'run'
80377         command from the GDB prompt.
80378
80379         Thread 1 "gdb" hit Breakpoint 3, bpstat_do_actions_1 (bsp=0x7fffffffccd8)
80380             at /ironwood1/sourceware-git/f34-master/bld/../../worktree-master/gdb/breakpoint.c:4431
80381         4431      if (executing_breakpoint_commands)
80382
80383          #0  bpstat_do_actions_1 (bsp=0x7fffffffccd8)
80384              at gdb/breakpoint.c:4431
80385          #1  0x00000000004d8bc6 in dprintf_after_condition_true (bs=0x16b0290)
80386              at gdb/breakpoint.c:13048
80387          #2  0x00000000004c5caa in bpstat_stop_status (aspace=0x116dbc0, bp_addr=0x40116e, thread=0x13f0e60, ws=0x7fffffffd138,
80388              stop_chain=0x16b0290) at gdb/breakpoint.c:5498
80389          #3  0x0000000000768d98 in handle_signal_stop (ecs=0x7fffffffd110)
80390              at gdb/infrun.c:6172
80391          #4  0x00000000007678d3 in handle_inferior_event (ecs=0x7fffffffd110)
80392              at gdb/infrun.c:5662
80393          #5  0x0000000000763cd5 in fetch_inferior_event ()
80394              at gdb/infrun.c:4060
80395          #6  0x0000000000746d7d in inferior_event_handler (event_type=INF_REG_EVENT)
80396              at gdb/inf-loop.c:41
80397          #7  0x00000000007a702f in handle_target_event (error=0, client_data=0x0)
80398              at gdb/linux-nat.c:4207
80399          #8  0x0000000000b8cd6e in gdb_wait_for_event (block=block@entry=0)
80400              at gdbsupport/event-loop.cc:701
80401          #9  0x0000000000b8d032 in gdb_wait_for_event (block=0)
80402              at gdbsupport/event-loop.cc:597
80403          #10 gdb_do_one_event () at gdbsupport/event-loop.cc:212
80404          #11 0x00000000007cf512 in start_event_loop ()
80405              at gdb/main.c:421
80406          #12 0x00000000007cf631 in captured_command_loop ()
80407              at gdb/main.c:481
80408          #13 0x00000000007d0ebf in captured_main (data=0x7fffffffd3f0)
80409              at gdb/main.c:1353
80410          #14 0x00000000007d0f25 in gdb_main (args=0x7fffffffd3f0)
80411              at gdb/main.c:1368
80412          #15 0x00000000004186dd in main (argc=5, argv=0x7fffffffd508)
80413              at gdb/gdb.c:32
80414
80415         This relatively short backtrace is due to the current UI's async field
80416         being set to 1.
80417
80418         Yet another thing to be aware of regarding this problem is the
80419         difference in the way that commands associated to dprintf breakpoints
80420         versus regular breakpoints are handled.  While they both use a command
80421         list associated with the breakpoint, regular breakpoints will place
80422         the commands to be run on the bpstat chain constructed in
80423         bp_stop_status().  These commands are run later on.  For dprintf
80424         breakpoints, commands are run via the 'after_condition_true' function
80425         pointer directly from bpstat_stop_status().  (The 'commands' field in
80426         the bpstat is cleared in dprintf_after_condition_true().  This
80427         prevents the dprintf commands from being run again later on when other
80428         commands on the bpstat chain are processed.)
80429
80430         Another thing that I noticed is that dprintf breakpoints are the only
80431         type of breakpoint which use 'after_condition_true'.  This suggests
80432         that one possible way of fixing this problem, that of making dprintf
80433         breakpoints work more like regular breakpoints, probably won't work.
80434         (I must admit, however, that my understanding of this code isn't
80435         complete enough to say why.  I'll trust that whoever implemented it
80436         had a good reason for doing it this way.)
80437
80438         The comment referenced earlier regarding 'executing_breakpoint_commands'
80439         states that the reason for checking this variable is to avoid
80440         potential endless recursion when a 'source' command appears in
80441         bs->commands.  We know that a dprintf command is constrained to either
80442         1) execution of a GDB printf command, 2) an inferior function call of
80443         a printf-like function, or 3) execution of an agent-printf command.
80444         Therefore, infinite recursion due to a 'source' command cannot happen
80445         when executing commands upon hitting a dprintf breakpoint.
80446
80447         I chose to fix this problem by having dprintf_after_condition_true()
80448         directly call execute_control_commands().  This means that it no
80449         longer attempts to go through bpstat_do_actions_1() avoiding the
80450         infinite recursion check for potential 'source' commands on the
80451         command chain.  I think it simplifies this code a little bit too, a
80452         definite bonus.
80453
80454         Summary:
80455
80456                 * breakpoint.c (dprintf_after_condition_true): Don't call
80457                 bpstat_do_actions_1().  Call execute_control_commands()
80458                 instead.
80459
80460 2021-11-10  Alan Modra  <amodra@gmail.com>
80461
80462         Re: Add --unicode option
80463                 * objdump: Whitespace fixes.
80464                 (long_options): Correct "ctf" entry.
80465
80466 2021-11-10  Alan Modra  <amodra@gmail.com>
80467
80468         Re: Add --unicode option
80469         At low optimisation levels gcc may warn.
80470
80471                 * strings.c (print_unicode_stream_body): Avoid bogus "may be
80472                 used unitialised" warning.
80473
80474 2021-11-10  GDB Administrator  <gdbadmin@sourceware.org>
80475
80476         Automatic date update in version.in
80477
80478 2021-11-09  Alan Modra  <amodra@gmail.com>
80479
80480         PR28543, readelf entered an infinite loop
80481         This little tweak terminates fuzzed binary readelf output a little
80482         quicker.
80483
80484                 PR 28543
80485                 * dwarf.c (read_and_display_attr_value): Consume a byte when
80486                 form is unrecognized.
80487
80488 2021-11-09  Alan Modra  <amodra@gmail.com>
80489
80490         PR28542, Undefined behaviours in readelf.c
80491                 PR 28542
80492                 * readelf.c (dump_relocations): Check that section headers have
80493                 been read before attempting to access section name.
80494                 (print_dynamic_symbol): Likewise.
80495                 (process_mips_specific): Delete dead code.
80496
80497 2021-11-09  Pedro Alves  <pedro@palves.net>
80498
80499         gdb::array_view slicing/container selftest - test std::array too
80500         Change-Id: I2141b0b8a09f6521a59908599eb5ba1a19b18dc6
80501
80502 2021-11-09  Simon Marchi  <simon.marchi@efficios.com>
80503
80504         gdb.debuginfod/fetch_src_and_symbols.exp: fix when GDB is built with AddressSanitizer
80505         This test fails for me, showing:
80506
80507             ERROR: tcl error sourcing /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp.
80508             ERROR: This GDB was configured as follows:
80509                configure --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
80510                          --with-auto-load-dir=$debugdir:$datadir/auto-load
80511                          --with-auto-load-safe-path=$debugdir:$datadir/auto-load
80512             ... and much more ...
80513
80514         The problem is that TCL's exec throws an error as soon as the exec'ed
80515         process outputs on stderr.  When GDB is built with ASan, it prints some
80516         warnings about pre-existing signal handlers:
80517
80518             warning: Found custom handler for signal 7 (Bus error) preinstalled.
80519             warning: Found custom handler for signal 8 (Floating point exception) preinstalled.
80520             warning: Found custom handler for signal 11 (Segmentation fault) preinstalled.
80521
80522         Pass --quiet to GDB to avoid these warnings.
80523
80524         Change-Id: I3751d89b9b1df646da19149d7cb86775e2d3e80f
80525
80526 2021-11-09  Tom Tromey  <tromey@adacore.com>
80527
80528         Correctly handle DW_LLE_start_end
80529         When the code to handle DW_LLE_start_end was added (as part of some
80530         DWARF 5 work), it was written to add the base address.  However, this
80531         seems incorrect -- the DWARF standard describes this as an address,
80532         not an offset from the base address.
80533
80534         This patch changes a couple of spots in dwarf2/loc.c to fix this
80535         problem.  It then changes decode_debug_loc_addresses to return
80536         DEBUG_LOC_OFFSET_PAIR instead, which preserves the previous semantics.
80537
80538         This only showed up on the RISC-V target internally, due to the
80539         combination of DWARF 5 and a newer version of GCC.  I've updated a
80540         couple of existing loclists test cases to demonstrate the bug.
80541
80542 2021-11-09  Tom Tromey  <tromey@adacore.com>
80543
80544         Fix build on rhES5
80545         The rhES5 build failed due to an upstream import a while back.  The
80546         bug here is that, while the 'personality' function exists,
80547         ADDR_NO_RANDOMIZE is only defined in <linux/personality.h>, not
80548         <sys/personality.h>.
80549
80550         However, <linux/personality.h> does not declare the 'personality'
80551         function, and <sys/personality.h> and <linux/personality.h> cannot
80552         both be included.
80553
80554         This patch restores one of the removed configure checks and updates
80555         the code to check it.
80556
80557         We had this as a local patch at AdaCore, because it seemed like there
80558         was no interest upstream.  However, now it turns out that this fixes
80559         PR build/28555, so I'm sending it now.
80560
80561 2021-11-09  H.J. Lu  <hjl.tools@gmail.com>
80562
80563         doc/ctf-spec.texi: Remove "@validatemenus off"
80564         Remove @validatemenus from ctf-spec.texi, which has been removed from
80565         texinfo by
80566
80567         commit a16dd1a9ece08568a1980b9a65a3a9090717997f
80568         Author: Gavin Smith <gavinsmith0123@gmail.com>
80569         Date:   Mon Oct 12 16:32:37 2020 +0100
80570
80571             * doc/texinfo.texi
80572             (Writing a Menu, Customization Variables for @-Commands)
80573             (Command List),
80574             * doc/refcard/txirefcard.tex
80575             Remove @validatemenus.
80576             * tp/Texinfo/XS/Makefile.am (command_ids.h): Use gawk instead
80577             of awk.  Avoid discouraged "$p" usage, using "$(p)" instead.
80578             * tp/Texinfo/XS/configure.ac: Check for gawk.
80579
80580         commit 128acab3889b51809dc3bd3c6c74b61d13f7f5f4
80581         Author: Gavin Smith <gavinsmith0123@gmail.com>
80582         Date:   Thu Jan 3 14:51:53 2019 +0000
80583
80584             Update refcard.
80585
80586             * doc/refcard/txirefcard.tex: @setfilename is no longer
80587             mandatory.  Do not mention @validatemenus or explicitly giving
80588             @node pointers, as these are not very important features.
80589
80590                 PR libctf/28567
80591                 * doc/ctf-spec.texi: Remove "@validatemenus off".
80592
80593 2021-11-09  Nick Clifton  <nickc@redhat.com>
80594
80595         Add --unicode option to control how unicode characters are handled by display tools.
80596                 * nm.c: Add --unicode option to control how unicode characters are
80597                 handled.
80598                 * objdump.c: Likewise.
80599                 * readelf.c: Likewise.
80600                 * strings.c: Likewise.
80601                 * binutils.texi: Document the new feature.
80602                 * NEWS: Document the new feature.
80603                 * testsuite/binutils-all/unicode.exp: New file.
80604                 * testsuite/binutils-all/nm.hex.unicode
80605                 * testsuite/binutils-all/strings.escape.unicode
80606                 * testsuite/binutils-all/objdump.highlight.unicode
80607                 * testsuite/binutils-all/readelf.invalid.unicode
80608
80609 2021-11-09  Mike Frysinger  <vapier@gentoo.org>
80610
80611         sim: sh: simplify testsuite a bit
80612         Switch from the centralized list in the exp file to each test declaring
80613         its own requirements which they're already (mostly) doing.  This will
80614         increase coverage slightly by running more tests in more configurations
80615         since the hardcoded exp list was a little out of date.
80616
80617         We have to mark the psh* tests as shdsp only (to match what the exp
80618         file was doing), mark the fsca & fsrra tests as failing (since they
80619         weren't even being run by the exp file), and to fix the expected
80620         output & status of the fail test.
80621
80622 2021-11-09  Mike Frysinger  <vapier@gentoo.org>
80623
80624         sim: cris: clean up missing func prototype warnings
80625         Move some unused funcs under existing #if 0 protection, mark a few
80626         local funcs as static, and add missing prototypes for the rest which
80627         are used from other files.  This fixes all the fatal warnings in the
80628         mloop files so we can turn -Werror on here fully.
80629
80630 2021-11-09  GDB Administrator  <gdbadmin@sourceware.org>
80631
80632         Automatic date update in version.in
80633
80634 2021-11-08  Lancelot SIX  <lsix@lancelotsix.com>
80635
80636         Improve gdb::array_view ctor from contiguous containers
80637         While reading the interface of gdb::array_view, I realized that the
80638         constructor that builds an array_view on top of a contiguous container
80639         (such as std::vector, std::array or even gdb::array_view) can be
80640         missused.
80641
80642         Lets consider the following code sample:
80643
80644                 struct Parent
80645                 {
80646                   Parent (int a): a { a } {}
80647                   int a;
80648                 };
80649
80650                 std::ostream &operator<< (std::ostream& os, const Parent & p)
80651                 { os << "Parent {a=" << p.a << "}"; return os; }
80652
80653                 struct Child : public Parent
80654                 {
80655                   Child (int a, int b): Parent { a }, b { b } {}
80656                   int b;
80657                 };
80658
80659                 std::ostream &operator<< (std::ostream& os, const Child & p)
80660                 { os << "Child {a=" << p.a << ", b=" << p.b << "}"; return os; }
80661
80662                 template <typename T>
80663                 void print (const gdb::array_view<const T> &p)
80664                 {
80665                   std::for_each (p.begin (), p.end (), [](const T &p) { std::cout << p << '\n'; });
80666                 }
80667
80668         Then with the current interface nothinng prevents this usage of
80669         array_view to be done:
80670
80671                 const std::array<Child, 3> elts = {
80672                   Child {1, 2},
80673                   Child {3, 4},
80674                   Child {5, 6}
80675                 };
80676                 print_all<Parent> (elts);
80677
80678         This compiles fine and produces the following output:
80679
80680                 Parent {a=1}
80681                 Parent {a=2}
80682                 Parent {a=3}
80683
80684         which is obviously wrong.  There is nowhere in memory a Parent-like
80685         object for which the A member is 2 and this call to print_all<Parent>
80686         shold not compile at all (calling print_all<Child> is however fine).
80687
80688         This comes down to the fact that a Child* is convertible into a Parent*,
80689         and that an array view is constructed to a pointer to the first element
80690         and a size.  The valid type pointed to that can be used with this
80691         constructor are restricted using SFINAE, which requires that a
80692         pointer to a member into the underlying container can be converted into a
80693         pointer the array_view's data type.
80694
80695         This patch proposes to change the constraints on the gdb::array_view
80696         ctor which accepts a container now requires that the (decayed) type of
80697         the elements in the container match the (decayed) type of the array_view
80698         being constructed.
80699
80700         Applying this change required minimum adjustment in GDB codebase, which
80701         are also included in this patch.
80702
80703         Tested by rebuilding.
80704
80705 2021-11-08  Lancelot SIX  <lsix@lancelotsix.com>
80706
80707         Add a const version of gdb_argv:as_array_view
80708         This commits adds const versions for the GET and AS_ARRAX_VIEW methods
80709         of gdb_argv.  Those methods will be required in the following patch of
80710         the series.
80711
80712 2021-11-08  Simon Marchi  <simon.marchi@polymtl.ca>
80713
80714         gdb: fix nulltr -> nullptr typo
80715         Change-Id: I04403bd85ec3fa75ea14130d68daba675a2a8aeb
80716
80717 2021-11-08  Simon Marchi  <simon.marchi@polymtl.ca>
80718
80719         gdb: tweak scoped_disable_commit_resumed uses when resuming all threads in non-stop
80720         When doing "continue -a" in non-stop mode, each thread is individually
80721         resumed while the commit resumed state is enabled.  This forces the
80722         target to commit each resumption immediately, instead of being able to
80723         batch things.
80724
80725         The reason is that there is no scoped_disable_commit_resumed around the
80726         loop over threads in continue_1, when "non_stop && all_threads" is true.
80727         Since the proceed function is called once for each thread, the
80728         scoped_disable_commit_resumed in proceed therefore forces commit-resumed
80729         between each thread resumption.  Add the necessary
80730         scoped_disable_commit_resumed in continue_1 to avoid that.
80731
80732         I looked at the MI side of things, the function exec_continue, and found
80733         that it was correct.  There is a similar iteration over threads, and
80734         there is a scoped_disable_commit_resumed at the function scope.  This is
80735         not wrong, but a bit more than we need.  The branches that just call
80736         continue_1 do not need it, as continue_1 takes care of disabling commit
80737         resumed.  So, move the scoped_disable_commit_resumed to the inner scope
80738         where we iterate on threads and proceed them individually.
80739
80740         Here's an example debugging a multi-threaded program attached by
80741         gdbserver (debug output trimmed for brevity):
80742
80743             $ ./gdb -nx -q --data-directory=data-directory -ex "set non-stop" -ex "tar rem :1234"
80744             (gdb) set debug remote
80745             (gdb) set debug infrun
80746             (gdb) c -a
80747             Continuing.
80748             [infrun] proceed: enter
80749               [infrun] scoped_disable_commit_resumed: reason=proceeding
80750               [remote] Sending packet: $vCont;c:p14388.14388#90
80751               [infrun] reset: reason=proceeding
80752               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote
80753               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote
80754             [infrun] proceed: exit
80755             [infrun] proceed: enter
80756               [infrun] scoped_disable_commit_resumed: reason=proceeding
80757               [remote] Sending packet: $vCont;c:p14388.1438a#b9
80758               [infrun] reset: reason=proceeding
80759               [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote
80760               [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote
80761             [infrun] proceed: exit
80762             ... and so on for each thread ...
80763
80764         Notice how we send one vCont;c for each thread.  With the patch applied, we
80765         send a single vCont;c at the end:
80766
80767             [infrun] scoped_disable_commit_resumed: reason=continue all threads in non-stop
80768             [infrun] proceed: enter
80769               [infrun] scoped_disable_commit_resumed: reason=proceeding
80770               [infrun] reset: reason=proceeding
80771             [infrun] proceed: exit
80772             [infrun] clear_proceed_status_thread: Thread 85790.85792
80773             [infrun] proceed: enter
80774               [infrun] scoped_disable_commit_resumed: reason=proceeding
80775               [infrun] reset: reason=proceeding
80776             [infrun] proceed: exit
80777             ... proceeding threads individually ...
80778             [infrun] reset: reason=continue all threads in non-stop
80779             [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for target remote
80780             [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for target remote
80781             [remote] Sending packet: $vCont;c#a8
80782
80783         Change-Id: I331dd2473c5aa5114f89854196fed2a8fdd122bb
80784
80785 2021-11-08  Simon Marchi  <simon.marchi@polymtl.ca>
80786
80787         gdb: make dwarf2_find_containing_comp_unit take a dwarf2_per_bfd
80788         While reading another patch, I saw that this function didn't need to
80789         take a dwarf2_per_objfile, but could take a dwarf2_per_bfd instead.
80790         It doesn't change the behavior, but doing this shows that this function
80791         is objfile-independent (can work with only the shared per-bfd data).
80792
80793         Change-Id: I58f9c9cef6688902e95226480285da2d0005d77f
80794
80795 2021-11-08  Simon Marchi  <simon.marchi@polymtl.ca>
80796
80797         gdb: remove bpstat typedef, rename bpstats to bpstat
80798         I don't find that the bpstat typedef, which hides a pointer, is
80799         particularly useful.  In fact, it confused me many times, and I just see
80800         it as something to remember that adds cognitive load.  Also, with C++,
80801         we might want to be able to pass bpstats objects by const-reference, not
80802         necessarily by pointer.
80803
80804         So, remove the bpstat typedef and rename struct bpstats to bpstat (since
80805         it represents one bpstat, it makes sense that it is singular).
80806
80807         Change-Id: I52e763b6e54ee666a9e045785f686d37b4f5f849
80808
80809 2021-11-08  Nick Alcock  <nick.alcock@oracle.com>
80810
80811         libctf: add CTF format specification
80812         It's been a long time since most of this was written: it's long past
80813         time to put it in the binutils source tree.  It's believed correct and
80814         complete insofar as it goes: it documents format v3 (the current
80815         version) but not the libctf API or any earlier versions.  (The
80816         earlier versions can be read by libctf but not generated by it, and you
80817         are highly unlikely ever to see an example of any of them.)
80818
80819         libctf/ChangeLog
80820         2021-11-08  Nick Alcock  <nick.alcock@oracle.com>
80821
80822                 * doc/ctf-spec.texi: New file.
80823                 * configure.ac (MAKEINFO): Add.
80824                 (BUILD_INFO): Likewise.
80825                 (AC_CONFIG_FILES) [doc/Makefile]: Add.
80826                 * Makefile.am [BUILD_INFO] (SUBDIRS): Add doc/.
80827                 * doc/Makefile.am: New file.
80828                 * doc/Makefile.in: Likewise.
80829                 * configure: Regenerated.
80830                 * Makefile.in: Likewise.
80831
80832 2021-11-08  GDB Administrator  <gdbadmin@sourceware.org>
80833
80834         Automatic date update in version.in
80835
80836 2021-11-07  Alan Modra  <amodra@gmail.com>
80837
80838         Correct ld script wildcard matching description
80839         Goes with commit 68bbb9f788d0
80840
80841                 * ld.texi (Input Section Wildcards): Delete paragraph incorrectly
80842                 saying '*' does not match '/'.
80843
80844 2021-11-07  Mike Frysinger  <vapier@gentoo.org>
80845
80846         sim: sh: fix conversion of PC to an integer
80847         On LLP64 targets where sizeof(long) != sizeof(void*), this code fails:
80848         sim/sh/interp.c:704:24: error: cast from pointer to integer of different size  -Werror=pointer-to-int-cast]
80849           704 |   do { memstalls += ((((long) PC & 3) != 0) ? (n) : ((n) - 1)); } while (0)
80850               |                        ^
80851
80852         Since this code simply needs to check alignment, cast it using uintptr_t
80853         which is the right type for this.
80854
80855 2021-11-07  Mike Frysinger  <vapier@gentoo.org>
80856
80857         sim: sh: clean up time(NULL) call
80858         Casting 0 to a pointer via (long *) doesn't work on LLP64 targets:
80859         error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
80860
80861         It's also unnecessary here.  We can simply pass NULL like every other
80862         bit of code does.
80863
80864 2021-11-07  Mike Frysinger  <vapier@gentoo.org>
80865
80866         sim: sh: break utime logic out of _WIN32 check
80867         Some _WIN32 targets provide utime (like mingw), so move the header
80868         include out from _WIN32 and under the specific HAVE_UTIME_H check.
80869
80870         sim: sh: drop errno extern
80871         This isn't needed on any reasonable target nowadays, and no other
80872         source does this, and breaks with some mingw targets, so punt the
80873         extern entirely.
80874
80875         sim: sh: fix isnan redefinition with mingw targets
80876         The code assumes that all _WIN32 targets are the same and can
80877         define isnan to _isnan.  For mingw targets, they provide an isnan
80878         define already, so no need for the fallback here.
80879
80880         sim: arm/bfin/rx: undefine page size from system headers
80881         Some targets (like cygwin) will export page size defines that clash
80882         with our local usage here.  Undefine the system one to fix building
80883         for these targets.
80884
80885         sim: ppc: switch to libiberty environ.h
80886         Drop our compat code and assume environ exists to simplify.
80887         We did this for all other targets already, but ppc was missed.
80888
80889         sim: sh: enable -Werror everywhere
80890         With most of the warnings fixed in interp.c, we can enable -Werror
80891         here too now.  There are some -Wmaybe-uninitialized warnings still
80892         lurking that look legitimate, but we don't flag those are fatal,
80893         and I don't have the expertise to dive into each opcode to figure
80894         out the right way to clean them up.
80895
80896         sim: sh: fix uninitialized variable usage with pdmsb
80897         This block of code relies on i to control which bits to test and how
80898         many times to run through the loop, but it never actually initialized
80899         it.  There is another chunk of code that handles the pdmsb instruction
80900         that sets i to 16, so use that here too assuming it's correct.  The
80901         programming manual suggests this is the right value too, but I am by
80902         no means a SuperH DSP expert.  The tests are still passing though ...
80903
80904         sim: sh: constify a few read-only lookup tables
80905
80906         sim: sh: fix various parentheses warnings
80907         Add parentheses to a bunch of places where the compiler suggests we
80908         do to avoid confusion to most readers.
80909
80910         sim: sh: fix unused-value warnings
80911         These macro expansions are deliberate in not using the computed value
80912         so that they trigger side-effects (possible invalid memory accesses)
80913         but while otherwise being noops.  Add a (void) cast so the compiler
80914         knows these are intentional.
80915
80916         sim: sh: rework register layout with anonymous unions & structs
80917         Now that we require C11, we can leverage anonymous unions & structs
80918         to fix a long standing issue with the SH register layout.  The use
80919         of sregs.i for sh-dsp has generated a lot of compiler warnings about
80920         the access being out of bounds -- it only has 7 elements declared,
80921         but code goes beyond that to reach into the fregs that follow.  But
80922         now that we have anonymous unions, we can reduce the nested names
80923         and have sregs cover all of these registers.
80924
80925 2021-11-07  GDB Administrator  <gdbadmin@sourceware.org>
80926
80927         Automatic date update in version.in
80928
80929 2021-11-06  Tiezhu Yang  <yangtiezhu@loongson.cn>
80930
80931         sim: mips: use sim_fpu_to{32,64}u to fix build warnings
80932         Since the first argument type is unsigned32 or unsigned64, just use
80933         sim_fpu_to{32,64}u instead of sim_fpu_to{32,64}i to fix the following
80934         build warnings:
80935
80936           CC     cp1.o
80937         .../sim/mips/cp1.c: In function 'convert':
80938         .../sim/mips/cp1.c:1425:32: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign]
80939                status |= sim_fpu_to32i (&result32, &wop, round);
80940                                         ^~~~~~~~~
80941         In file included from .../sim/mips/sim-main.h:67,
80942                          from .../sim/mips/cp1.c:46:
80943         .../sim/mips/../common/sim-fpu.h:270:22: note: expected 'signed32 *' {aka 'int *'} but argument is of type 'unsigned32 *' {aka 'unsigned int *'}
80944          INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f,
80945                               ^~~~~~~~~~~~~
80946         .../sim/mips/cp1.c:1429:32: warning: pointer targets in passing argument 1 of 'sim_fpu_to64i' differ in signedness [-Wpointer-sign]
80947                status |= sim_fpu_to64i (&result64, &wop, round);
80948                                         ^~~~~~~~~
80949         In file included from .../sim/mips/sim-main.h:67,
80950                          from .../sim/mips/cp1.c:46:
80951         .../sim/mips/../common/sim-fpu.h:274:22: note: expected 'signed64 *' {aka 'long int *'} but argument is of type 'unsigned64 *' {aka 'long unsigned int *'}
80952          INLINE_SIM_FPU (int) sim_fpu_to64i (signed64 *i, const sim_fpu *f,
80953                               ^~~~~~~~~~~~~
80954         .../sim/mips/cp1.c: In function 'convert_ps':
80955         .../sim/mips/cp1.c:1528:34: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign]
80956                status_u |= sim_fpu_to32i (&res_u, &wop_u, round);
80957                                           ^~~~~~
80958         In file included from .../sim/mips/sim-main.h:67,
80959                          from .../sim/mips/cp1.c:46:
80960         .../sim/mips/../common/sim-fpu.h:270:22: note: expected 'signed32 *' {aka 'int *'} but argument is of type 'unsigned32 *' {aka 'unsigned int *'}
80961          INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f,
80962                               ^~~~~~~~~~~~~
80963         .../sim/mips/cp1.c:1529:34: warning: pointer targets in passing argument 1 of 'sim_fpu_to32i' differ in signedness [-Wpointer-sign]
80964                status_l |= sim_fpu_to32i (&res_l, &wop_l, round);
80965                                           ^~~~~~
80966         In file included from .../sim/mips/sim-main.h:67,
80967                          from .../sim/mips/cp1.c:46:
80968         .../sim/mips/../common/sim-fpu.h:270:22: note: expected 'signed32 *' {aka 'int *'} but argument is of type 'unsigned32 *' {aka 'unsigned int *'}
80969          INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f,
80970                               ^~~~~~~~~~~~~
80971
80972 2021-11-06  Alan Modra  <amodra@gmail.com>
80973
80974         Modernise yyerror
80975         Newer versions of bison emit a prototype for yyerror
80976                 void yyerror (const char *);
80977         This clashes with some of our old code that declares yyerror to return
80978         an int.  Fix that in most cases by modernizing yyerror.  bfin-parse.y
80979         uses the return value all over the place, so for there disable
80980         generation of the prototype as specified by posix.
80981
80982         binutils/
80983                 * arparse.y (yyerror): Return void.
80984                 * dlltool.c (yyerror): Likewise.
80985                 * dlltool.h (yyerror): Likewise.
80986                 * sysinfo.y (yyerror): Likewise.
80987                 * windmc.h (yyerror): Likewise.
80988                 * mclex.c (mc_error): Extract from ..
80989                 (yyerror): ..here, both now returning void.
80990         gas/
80991                 * config/bfin-parse.y (yyerror): Define.
80992                 (yyerror): Make static.
80993                 * itbl-parse.y (yyerror): Return void.
80994         ld/
80995                 * deffilep.y (def_error): Return void.
80996
80997 2021-11-06  Alan Modra  <amodra@gmail.com>
80998
80999         ubsan: undefined shift in mach-o.c
81000         This one was logically wrong too.  If file_ptr was 64 bits, then -1U
81001         is extended to 0x00000000ffffffff, probably not what was intended
81002         here.
81003
81004                 * mach-o.c (FILE_ALIGN): Correct expression.
81005
81006 2021-11-06  Fangrui Song  <maskray@google.com>
81007
81008         readelf: Support RELR in -S and -d and output
81009         readelf -r dumping support is not added in this patch.
81010
81011         include/
81012                 * elf/common.h: Add SHT_RELR, DT_RELR{,SZ,ENT}
81013         bfd/
81014                 * elf.c (_bfd_elf_print_private_bfd_data): Add DT_RELR{,SZ,ENT}.
81015         binutils/
81016                 * readelf.c (get_dynamic_type): Add DT_RELR{,SZ,ENT}.
81017                 (get_section_type_name): Add SHT_RELR.
81018
81019 2021-11-06  Fangrui Song  <maskray@google.com>
81020
81021         readelf: Make DT_PREINIT_ARRAYSZ's output style match DT_INIT_ARRAYSZ
81022         The output now looks like:
81023
81024         - 0x0000000000000021 (PREINIT_ARRAYSZ)    0x10
81025         + 0x0000000000000021 (PREINIT_ARRAYSZ)    16 (bytes)
81026           0x0000000000000019 (INIT_ARRAY)         0xbefc90
81027           0x000000000000001b (INIT_ARRAYSZ)       536 (bytes)
81028
81029                 * readelf.c (process_dynamic_section): Handle DT_PREINIT_ARRAYSZ.
81030
81031 2021-11-06  Mike Frysinger  <vapier@gentoo.org>
81032
81033         sim: clarify license text via COPYING file
81034         The project has been using GPL v3 for a while now in the source files,
81035         and the arm & ppc ports have carried a copy of the COPYING file.  Lets
81036         move those up to the top sim dir like other projects to make it clear.
81037
81038         Also drop the ppc/COPYING.LIB as it's not really referenced by any
81039         source as everything is GPL v3.
81040
81041 2021-11-06  GDB Administrator  <gdbadmin@sourceware.org>
81042
81043         Automatic date update in version.in
81044
81045 2021-11-05  Tom Tromey  <tom@tromey.com>
81046
81047         Introduce make_unique_xstrndup
81048         This adds a new make_unique_xstrndup function, which is the "n"
81049         analogue of make_unique_xstrdup.  It also updates a couple existing
81050         places to use this function.
81051
81052 2021-11-05  Pedro Alves  <pedro@palves.net>
81053
81054         Avoid /proc/pid/mem races (PR 28065)
81055         PR 28065 (gdb.threads/access-mem-running-thread-exit.exp intermittent
81056         failure) shows that GDB can hit an unexpected scenario -- it can
81057         happen that the kernel manages to open a /proc/PID/task/LWP/mem file,
81058         but then reading from the file returns 0/EOF, even though the process
81059         hasn't exited or execed.
81060
81061         "0" out of read/write is normally what you get when the address space
81062         of the process the file was open for is gone, because the process
81063         execed or exited.  So when GDB gets the 0, it returns memory access
81064         failure.  In the bad case in question, the process hasn't execed or
81065         exited, so GDB fails a memory access when the access should have
81066         worked.
81067
81068         GDB has code in place to gracefully handle the case of opening the
81069         /proc/PID/task/LWP/mem just while the LWP is exiting -- most often the
81070         open fails with EACCES or ENOENT.  When it happens, GDB just tries
81071         opening the file for a different thread of the process.  The testcase
81072         is written such that it stresses GDB's logic of closing/reopening the
81073         /proc/PID/task/LWP/mem file, by constantly spawning short lived
81074         threads.
81075
81076         However, there's a window where the kernel manages to find the thread,
81077         but the thread exits just after and clears its address space pointer.
81078         In this case, the kernel creates a file successfully, but the file
81079         ends up with no address space associated, so a subsequent read/write
81080         returns 0/EOF too, just like if the whole process had execed or
81081         exited.  This is the case in question that GDB does not handle.
81082
81083         Oleg Nesterov gave this suggestion as workaround for that race:
81084
81085             gdb can open(/proc/pid/mem) and then read (say) /proc/pid/statm.
81086             If statm reports something non-zero, then open() was "successfull".
81087
81088         I think that might work.  However, I didn't try it, because I realized
81089         we have another nasty race that that wouldn't fix.
81090
81091         The other race I realized is that because we close/reopen the
81092         /proc/PID/task/LWP/mem file when GDB switches to a different inferior,
81093         then it can happen that GDB reopens /proc/PID/task/LWP/mem just after
81094         a thread execs, and before GDB has seen the corresponding exec event.
81095         I.e., we can open a /proc/PID/task/LWP/mem file accessing the
81096         post-exec address space thinking we're accessing the pre-exec address
81097         space.
81098
81099         A few months back, Simon, Oleg and I discussed a similar race:
81100
81101           [Bug gdb/26754] Race condition when resuming threads and one does an exec
81102           https://sourceware.org/bugzilla/show_bug.cgi?id=26754
81103
81104         The solution back then was to make the kernel fail any ptrace
81105         operation until the exec event is consumed, with this kernel commit:
81106
81107          commit dbb5afad100a828c97e012c6106566d99f041db6
81108          Author:     Oleg Nesterov <oleg@redhat.com>
81109          AuthorDate: Wed May 12 15:33:08 2021 +0200
81110          Commit:     Linus Torvalds <torvalds@linux-foundation.org>
81111          CommitDate: Wed May 12 10:45:22 2021 -0700
81112
81113              ptrace: make ptrace() fail if the tracee changed its pid unexpectedly
81114
81115         This however, only applies to ptrace, not to the /proc/pid/mem file
81116         opening case.  Also, even if it did apply to the file open case, we
81117         would want to support current kernels until such a fix is more wide
81118         spread anyhow.
81119
81120         So all in all, this commit gives up on the idea of only ever keeping
81121         one /proc/pid/mem file descriptor open.  Instead, make GDB open a
81122         /proc/pid/mem per inferior, and keep it open until the inferior exits,
81123         is detached or execs.  Make GDB open the file right after the inferior
81124         is created or is attached to or forks, at which point we know the
81125         inferior is stable and stopped and isn't thus going to exec, or have a
81126         thread exit, and so the file open won't fail (unless the whole process
81127         is SIGKILLed from outside GDB, at which point it doesn't matter
81128         whether we open the file).
81129
81130         This way, we avoid both races described above, at the expense of using
81131         more file descriptors (one per inferior).
81132
81133         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28065
81134         Change-Id: Iff943b95126d0f98a7973a07e989e4f020c29419
81135
81136 2021-11-05  Andrew Burgess  <aburgess@redhat.com>
81137
81138         gdb/testsuite: use gdb_get_line_number
81139         Replaces a hard coded line number with a use of gdb_get_line_number.
81140
81141         I suspect that the line number has, over time, come adrift from where
81142         it was supposed to be stopping.  When the test was first added, line
81143         770 pointed at the final 'return 0' in function main.  Over time, as
81144         things have been added, line 770 now points at some random location in
81145         the middle of main.
81146
81147         So, I've marked the 'return 0' with a comment, and now the test will
81148         always stop there.
81149
81150         I also removed an old comment from 1997 talking about how these tests
81151         will only pass with the HP compiler, followed by an additional comment
81152         from 2000 saying that the tests now pass with GCC.
81153
81154         I get the same results before and after this change.
81155
81156 2021-11-05  Alan Modra  <amodra@gmail.com>
81157
81158         PR28541, unstable cie offset in the output of readelf
81159         Calculating "0 - pointer" can indeed result in seeming randomness as
81160         the pointer address varies.
81161
81162                 PR 28541
81163                 * dwarf.c (display_debug_frames): Don't print cie offset when
81164                 invalid, print "invalid" instead.  Remove now redundant warning.
81165
81166 2021-11-05  Alan Modra  <amodra@gmail.com>
81167
81168         Missing va_end in aarch64-dis.c
81169                 * aarch64-dis.c (extract_fields): Invoke va_end.
81170
81171 2021-11-05  Alan Modra  <amodra@gmail.com>
81172
81173         PR28530, Hang in objdump on machine with 196GB RAM
81174         Investigating the PR28530 testcase, which has a fuzzed compression
81175         header with an enormous size, I noticed that decompress_contents is
81176         broken when the size doesn't fit in strm.avail_out.  It wouldn't be
81177         too hard to support larger sizes (patches welcome!) but for now just
81178         stop decompress_contents from returning rubbish.
81179
81180                 PR 28530
81181                 * compress.c (decompress_contents): Fail when uncompressed_size
81182                 is too big.
81183                 (bfd_init_section_decompress_status): Likewise.
81184
81185 2021-11-05  Alan Modra  <amodra@gmail.com>
81186
81187         asan: alpha-vms: objdump buffer overflows
81188                 * vms-alpha.c (evax_bfd_print_desc): Sanity check buffer access.
81189                 (evax_bfd_print_valspec, evax_bfd_print_typspec): Likewise.
81190                 (evax_bfd_print_dst): Likewise.
81191
81192 2021-11-05  GDB Administrator  <gdbadmin@sourceware.org>
81193
81194         Automatic date update in version.in
81195
81196 2021-11-04  Simon Marchi  <simon.marchi@polymtl.ca>
81197
81198         gdb: introduce "set index-cache enabled", deprecate "set index-cache on/off"
81199         The "set index-cache" command is used at the same time as a prefix
81200         command (prefix for "set index-cache directory", for example), and a
81201         boolean setting for turning the index-cache on and off.  Even though I
81202         did introduce that, I now don't think it's a good idea to do something
81203         non-standard like this.
81204
81205         First, there's no dedicated CLI command to show whether the index-cache
81206         is enabled, so it has to be custom output in the "show index-cache
81207         handler".  Also, it means there's no good way a MI frontend can find out
81208         if the index-cache is enabled.  "-gdb-show index-cache" doesn't show it
81209         in the MI output record:
81210
81211             (gdb) interpreter-exec mi "-gdb-show index-cache"
81212             ~"\n"
81213             ~"The index cache is currently disabled.\n"
81214             ^done,showlist={option={name="directory",value="/home/simark/.cache/gdb"}}
81215
81216         Fix this by introducing "set/show index-cache enabled on/off", regular
81217         boolean setting commands.  Keep commands "set index-cache on" and "set
81218         index-cache off" as deprecated aliases of "set index-cache enabled",
81219         with respectively the default arguments "on" and "off".
81220
81221         Update tests using "set index-cache on/off" to use the new command.
81222         Update the regexps in gdb.base/maint.exp to figure out whether the
81223         index-cache is enabled or not.  Update the doc to mention the new
81224         commands.
81225
81226         Change-Id: I7d5aaaf7fd22bf47bd03e0023ef4fbb4023b37b3
81227
81228 2021-11-04  Simon Marchi  <simon.marchi@polymtl.ca>
81229
81230         gdb: pass/return setting setter/getter scalar values by value
81231         The getter and setter in struct setting always receive and return values
81232         by const reference.  This is not necessary for scalar values (like bool
81233         and int), but more importantly it makes it a bit annoying to write a
81234         getter, you have to use a scratch static variable or something similar
81235         that you can refer to:
81236
81237           const bool &
81238           my_getter ()
81239           {
81240             static bool value;
81241             value = function_returning_bool ();
81242             return value;
81243           }
81244
81245         Change the getter and setter function signatures to receive and return
81246         value by value instead of by reference, when the underlying data type is
81247         scalar.  This means that string-based settings will still use
81248         references, but all others will be by value.  The getter above would
81249         then be re-written as:
81250
81251           bool
81252           my_getter ()
81253           {
81254             return function_returning_bool ();
81255           }
81256
81257         This is useful for a patch later in this series that defines a boolean
81258         setting with a getter and a setter.
81259
81260         Change-Id: Ieca3a2419fcdb75a6f75948b2c920b548a0af0fd
81261
81262 2021-11-04  Simon Marchi  <simon.marchi@polymtl.ca>
81263
81264         gdb: remove command_class enum class_deprecated
81265         The class_deprecated enumerator isn't assigned anywhere, so remove it.
81266         Commands that are deprecated have cmd_list_element::cmd_deprecated set
81267         instead.
81268
81269         Change-Id: Ib35e540915c52aa65f13bfe9b8e4e22e6007903c
81270
81271 2021-11-04  Simon Marchi  <simon.marchi@polymtl.ca>
81272
81273         gdb: remove unnecessary cmd_list_element::aliases nullptr checks
81274         Remove two unnecessary nullptr checks.  If aliases is nullptr, then the
81275         for loops will simply be skipped.
81276
81277         Change-Id: I9132063bb17798391f8d019af305383fa8e0229f
81278
81279 2021-11-04  Simon Marchi  <simon.marchi@polymtl.ca>
81280
81281         gdbserver: re-generate configure
81282         I get some diffs when running autoconf in gdbserver, probably leftovers
81283         from commit 5dfe4bfcb969 ("Fix format_pieces selftest on Windows").
81284         Re-generate configure in that directory.
81285
81286         Change-Id: Icdc9906af95fbaf1047a579914b2983f8ec5db08
81287
81288 2021-11-04  H.J. Lu  <hjl.tools@gmail.com>
81289
81290         Revert "bfd: Always check sections with the corrupt size"
81291         This reverts commit e0f7ea91436dd308a094c4c101fd4169e8245a91.
81292
81293 2021-11-04  H.J. Lu  <hjl.tools@gmail.com>
81294
81295         bfd: Always check sections with the corrupt size
81296         Always check sections with the corrupt size for non-MMO files.  Skip MMO
81297         files for compress_status == COMPRESS_SECTION_NONE since MMO has special
81298         handling for COMPRESS_SECTION_NONE.
81299
81300                 PR binutils/28530
81301                 * compress.c (bfd_get_full_section_contents): Always check
81302                 sections with the corrupt size.
81303
81304 2021-11-04  Nelson Chu  <nelson.chu@sifive.com>
81305
81306         RISC-V: Clarify the behavior of .option rvc or norvc.
81307         Add/Remove the rvc extension to/from the riscv_subsets once the
81308         .option rvc/norvc is set.  So that we don't need to always check
81309         the riscv_opts.rvc in the riscv_subset_supports, just call the
81310         riscv_lookup_subset to search the subset list is enough.
81311
81312         Besides, we will need to dump the instructions according to the
81313         elf architecture attributes.  That means the dis-assembler needs
81314         to parse the architecture string from the elf attribute before
81315         dumping any instructions, and also needs to recognized the
81316         INSN_CLASS* classes from riscv_opcodes.  Therefore, I suppose
81317         some functions will need to be moved from gas/config/tc-riscv.c
81318         to bfd/elfxx-riscv.c, including riscv_multi_subset_supports and
81319         riscv_subset_supports.  This is one of the reasons why we need
81320         this patch.
81321
81322         This patch passes the gcc/binutils regressions of rv32emc-elf,
81323         rv32i-elf, rv64gc-elf and rv64gc-linux toolchains.
81324
81325         bfd/
81326                 * elfxx-riscv.c (riscv_remove_subset): Remove the extension
81327                 from the subset list.
81328                 (riscv_update_subset): Add/Remove an extension to/from the
81329                 subset list.  This is used for the .option rvc or norvc.
81330                 * elfxx-riscv.h: Added the extern bool riscv_update_subset.
81331         gas/
81332                 * config/tc-riscv.c (riscv_set_options): Removed the unused
81333                 rve flag.
81334                 (riscv_opts): Likewise.
81335                 (riscv_set_rve): Removed.
81336                 (riscv_subset_supports): Removed the riscv_opts.rvc check.
81337                 (riscv_set_arch): Don't need to call riscv_set_rve.
81338                 (reg_lookup_internal): Call riscv_subset_supports to check
81339                 whether the rve is supported.
81340                 (s_riscv_option): Add/Remove the rvc extension to/from the
81341                 subset list once the .option rvc/norvc is set.
81342
81343 2021-11-04  Mike Frysinger  <vapier@gentoo.org>
81344
81345         sim: mips: fix missing prototype in multi-run generation
81346         The multi-run logic for mips involves a bit of codegen and rewriting
81347         of files to include per-architecture prefixes.  That can result in
81348         files with missing prototypes which cause compiler errors.  In the
81349         case of mips-sde-elf targets, we have:
81350         $srcdir/m16run.c -> $builddir/m16mips64r2_run.c
81351           sim_engine_run -> m16mips64r2_engine_run
81352         $srcdir/micromipsrun.c -> micromipsmicromips_run.c
81353           sim_engine_run -> micromips64micromips_engine_run
81354
81355         micromipsmicromips_run.c:80:1: error: no previous prototype for 'micromips64micromips_engine_run' [-Werror=missing-prototypes]
81356            80 | micromips64micromips_engine_run (SIM_DESC sd, int next_cpu_nr, int nr_cpus,
81357
81358         We generate headers for those prototypes in the configure script,
81359         but only include them in the generated multi-run.c file.  Update the
81360         rewrite logic to turn the sim-engine.h include into the relevant
81361         generated engine include so these files also have their prototypes.
81362         $srcdir/m16run.c -> $builddir/m16mips64r2_run.c
81363           sim-engine.h -> m16mips64r2_engine.h
81364         $srcdir/micromipsrun.c -> micromipsmicromips_run.c
81365           sim-engine.h -> micromips64micromips_engine.h
81366
81367 2021-11-04  Alan Modra  <amodra@gmail.com>
81368
81369         PR28540, segmentation fault on NULL byte_get
81370                 PR 28540
81371                 * objdump.c (dump_bfd): Don't attempt load_separate_debug_files
81372                 when byte_get is NULL.
81373
81374 2021-11-04  GDB Administrator  <gdbadmin@sourceware.org>
81375
81376         Automatic date update in version.in
81377
81378 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81379
81380         sim: ppc: inline common sim-fpu.c logic
81381         We will never bother building w/out a ../common/ sim directory,
81382         so drop ancient logic supporting that method.
81383
81384 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81385
81386         sim: ppc: switch to common builds for callback objects
81387         We don't need to build this anymore ourselves since the common build
81388         includes it and produces the same object code.  We also need to pull
81389         in the split constant modules after the refactoring and pulling them
81390         out of nltvals.def & targ-map.o.  This doesn't matter for the sim
81391         directly, but does for gdb and other users of libsim.
81392
81393         We also delete some conditional source tree logic since we already
81394         require this be the "new" combined tree with a ../common/ dir.  This
81395         has been the case for decades at this point.
81396
81397 2021-11-03  Simon Marchi  <simon.marchi@polymtl.ca>
81398
81399         gdb: fix gnu-nat build
81400         When building gnu-nat.c, we get:
81401
81402               CXX    gnu-nat.o
81403             gnu-nat.c: In member function 'virtual void gnu_nat_target::create_inferior(const char*, const string&, char**, int)':
81404             gnu-nat.c:2117:13: error: 'struct inf' has no member named 'target_is_pushed'
81405              2117 |   if (!inf->target_is_pushed (this))
81406                   |             ^~~~~~~~~~~~~~~~
81407             gnu-nat.c:2118:10: error: 'struct inf' has no member named 'push_target'
81408              2118 |     inf->push_target (this);
81409                   |          ^~~~~~~~~~~
81410
81411         This is because of a confusion between the generic `struct inferior`
81412         variable and the gnu-nat-specific `struct inf` variable.  Fix by
81413         referring to `inferior`, not `inf`.
81414
81415         Adjust the comment on top of `struct inf` to clarify the purpose of that
81416         type.
81417
81418         Co-Authored-By: Andrea Monaco <andrea.monaco@autistici.org>
81419         Change-Id: I2fe2f7f6ef61a38d79860fd262b08835c963fc77
81420
81421 2021-11-03  Simon Marchi  <simon.marchi@polymtl.ca>
81422
81423         gdb/testsuite: set ASAN_OPTIONS=detect_leaks=0 while running tests
81424         We see some additional failures when running the testsuite against a GDB
81425         compiled with ASan, compared to a GDB compiled without ASan.  Some of
81426         them are caused by the memory leak report shown by the GDB process when
81427         it exits, and the fact that it makes it exit with a non-zero exit code.
81428
81429         I generally try to remember to set ASAN_OPTIONS=detect_leaks=0 in my
81430         environment when running the tests, but I don't always do it.  I think
81431         it would be nice if the testsuite did it.  I don't see any use to have
81432         leak detection when running the tests.  That is, unless we ever have a
81433         test that ensures GDB doesn't leak memory, which isn't going to happen
81434         any time soon.
81435
81436         Here are some tests I found that were affected by this:
81437
81438             gdb.base/batch-exit-status.exp
81439             gdb.base/many-headers.exp
81440             gdb.base/quit.exp
81441             gdb.base/with-mf.exp
81442             gdb.dwarf2/gdb-add-index.exp
81443             gdb.dwarf2/gdb-add-index-symlink.exp
81444             gdb.dwarf2/imported-unit-runto-main.exp
81445
81446         Change-Id: I784c7df8a13979eb96587f735c1d33ba2cc6e0ca
81447
81448 2021-11-03  Tom Tromey  <tromey@adacore.com>
81449
81450         Use section name in warnings in display_debug_loc
81451         While looking at an apparently malformed executable with
81452         "readelf --debug-dump=loc", I got this warning:
81453
81454             readelf: ./main: Warning: There is a hole [0x89 - 0x95] in .debug_loc section.
81455
81456         However, the executable only has a .debug_loclists section.
81457
81458         This patch fixes the warning messages in display_debug_loc to use the
81459         name of the section that is being processed.
81460
81461         binutils/ChangeLog
81462         2021-11-03  Tom Tromey  <tromey@adacore.com>
81463
81464                 * dwarf.c (display_debug_loc): Use section name in warnings.
81465
81466 2021-11-03  Luis Machado  <luis.machado@linaro.org>
81467
81468         [AArch64] Make gdbserver register set selection dynamic
81469         The current register set selection mechanism for AArch64 is static, based
81470         on a pre-populated array of register sets.
81471
81472         This means that we might potentially probe register sets that are not
81473         available. This is OK if the kernel errors out during ptrace, but probing the
81474         tag_ctl register, for example, does not result in a ptrace error if the kernel
81475         supports the tagged address ABI but not MTE (PR 28355).
81476
81477         Making the register set selection dynamic, based on feature checks, solves
81478         this and simplifies the code a bit. It allows us to list all of the register
81479         sets only once, and pick and choose based on HWCAP/HWCAP2 or other properties.
81480
81481         I plan to backport this fix to GDB 11 as well.
81482
81483         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28355
81484
81485 2021-11-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
81486
81487         Fix LD_PRELOAD=/usr/lib64/libasan.so.6 gdb
81488         Currently for a binary compiled normally (without -fsanitize=address) but with
81489         LD_PRELOAD of ASAN one gets:
81490
81491         $ ASAN_OPTIONS=detect_leaks=0:alloc_dealloc_mismatch=1:abort_on_error=1:fast_unwind_on_malloc=0 LD_PRELOAD=/usr/lib64/libasan.so.6 gdb
81492         =================================================================
81493         ==1909567==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x602000001570
81494             #0 0x7f1c98e5efa7 in operator delete[](void*) (/usr/lib64/libasan.so.6+0xb0fa7)
81495         ...
81496         0x602000001570 is located 0 bytes inside of 2-byte region [0x602000001570,0x602000001572)
81497         allocated by thread T0 here:
81498             #0 0x7f1c98e5cd1f in __interceptor_malloc (/usr/lib64/libasan.so.6+0xaed1f)
81499             #1 0x557ee4a42e81 in operator new(unsigned long) (/usr/libexec/gdb+0x74ce81)
81500         SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/usr/lib64/libasan.so.6+0xb0fa7) in operator delete[](void*)
81501         ==1909567==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
81502         ==1909567==ABORTING
81503
81504         Despite the code called properly operator new[] and operator delete[].
81505         But GDB's new-op.cc provides its own operator new[] which gets translated into
81506         malloc() (which gets recogized as operatore new(size_t)) but as it does not
81507         translate also operators delete[] Address Sanitizer gets confused.
81508
81509         The question is how many variants of the delete operator need to be provided.
81510         There could be 14 operators new but there are only 4, GDB uses 3 of them.
81511         There could be 16 operators delete but there are only 6, GDB uses 2 of them.
81512         It depends on libraries and compiler which of the operators will get used.
81513         Currently being used:
81514                          U operator new[](unsigned long)
81515                          U operator new(unsigned long)
81516                          U operator new(unsigned long, std::nothrow_t const&)
81517                          U operator delete[](void*)
81518                          U operator delete(void*, unsigned long)
81519
81520         Tested on x86_64-linux.
81521
81522 2021-11-03  Alan Modra  <amodra@gmail.com>
81523
81524         asan: dlltool buffer overflow: embedded NUL in string
81525         yyleng gives the pattern length, xstrdup just copies up to the NUL.
81526         So it is quite possible writing at an index of yyleng-2 overflows
81527         the xstrdup allocated string buffer.  xmemdup quite handily avoids
81528         this problem, even writing the terminating NUL over the trailing
81529         quote.  Use it in ldlex.l too where we'd already had a report of this
81530         problem and fixed it by hand, and to implement xmemdup0 in gas.
81531
81532         binutils/
81533                 * deflex.l (single and double quote strings): Use xmemdup.
81534         gas/
81535                 * as.h (xmemdup0): Use xmemdup.
81536         ld/
81537                 PR 20906
81538                 * ldlex.l (double quote string): Use xmemdup.
81539
81540 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81541
81542         sim: mloop: mark a few conditionally used funcs as unused
81543         These are marked inline, so building w/gcc at higher optimization
81544         levels will automatically discard them.  But building with -O0 will
81545         trigger unused function warnings, so fix that.
81546
81547         The common before/after cover functions in the common mloop generator
81548         are not used by all architecture ports.  Doesn't seem to be a hard
81549         requirement, so marking them optional (i.e. unused) is fine.
81550
81551         The cris execute function is conditionally used depending on the
81552         fast-build mode settings, so mark it unused too.
81553
81554 2021-11-03  Alan Modra  <amodra@gmail.com>
81555
81556         asan: assert (addr_ranges) <= (start)
81557         That assert would be more obvious if it were reported as
81558         "addr_ranges <= end_ranges".  Fix that by using the obvious variable
81559         in the final loop.  Stop the assertion by using a signed comparison:
81560         It's possible for the rounding up of the arange pointer to exceed the
81561         end of the block when the block size is fuzzed.
81562
81563                 * dwarf.c (display_debug_aranges): Use "end_ranges" in loop
81564                 displaying ranges rather that "start".  Simplify rounding up
81565                 to 2*address_size boundary.  Use signed comparison in loop.
81566
81567 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81568
81569         sim: hoist cgen mloop rules up to common builds
81570         These rules don't depend on the target compiler settings, so hoist
81571         the build logic up to the common builds for better parallelization.
81572
81573         We have to extend the genmloop.sh logic a bit to allow outputting
81574         to a subdir since it always assumed cwd was the right place.
81575
81576         We leave the cgen maintainer rules in the subdirs for now as they
81577         aren't normally run, and they rely on cgen logic that has not yet
81578         been generalized.
81579
81580 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81581
81582         sim: hoist mn10300 & v850 igen rules up to common builds
81583         These rules don't depend on the target compiler settings, so hoist
81584         the build logic up to the common builds for better parallelization.
81585
81586         We leave the mips rules in place as they depend on complicated
81587         arch-specific configure logic that needs to be untangled first.
81588
81589 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81590
81591         sim: hoist gencode & opc2c build rules up to common builds
81592         These rules don't depend on the target compiler settings, so hoist
81593         the build logic up to the common builds for better parallelization.
81594
81595 2021-11-03  Mike Frysinger  <vapier@gentoo.org>
81596
81597         opcodes: d10v: simplify header includes
81598         This file doesn't use anything from bfd (sysdep.h), so drop that
81599         include.  This avoids an implicit dependency on the generated
81600         config.h which can be problematic for build-time tools.
81601
81602         Also swap stdio.h for stddef.h.  This file isn't doing or using
81603         any I/O structures, but it does need NULL.
81604
81605 2021-11-03  Alan Modra  <amodra@gmail.com>
81606
81607         PR28523, ld.bfd created undefined symbols on ppc64
81608         This patch removes any fake (linker created) function descriptor
81609         symbol if its code entry symbol isn't dynamic, to ensure bogus dynamic
81610         symbols are not created.  The change to func_desc_adjust requires that
81611         it be run only once, which means ppc64_elf_tls_setup can't call it for
81612         just a few selected symbols.
81613
81614                 PR 28523
81615                 * elf64-ppc.c (func_desc_adjust): If a function entry sym is
81616                 not dynamic and has no plt entry, hide any associated fake
81617                 function descriptor symbol.
81618                 (ppc64_elf_edit): Move func_desc_adjust iteration over syms to..
81619                 (ppc64_elf_tls_setup): ..here.
81620
81621 2021-11-03  GDB Administrator  <gdbadmin@sourceware.org>
81622
81623         Automatic date update in version.in
81624
81625 2021-11-02  Tom de Vries  <tdevries@suse.de>
81626
81627         [gdb/tdep, rs6000] Don't skip system call in skip_prologue
81628         I ran into a case where a breakpoint on _exit never triggered, because it was
81629         set past the end of the _exit prologue, past the end of the exit_group system
81630         call (which does not return).
81631
81632         More concretely, the breakpoint was set at the last insn show here:
81633         ...
81634         Dump of assembler code for function _exit:
81635            0x00007ffff7e42ea0 <+0>:     12 00 4c 3c     addis   r2,r12,18
81636            0x00007ffff7e42ea4 <+4>:     60 43 42 38     addi    r2,r2,17248
81637            0x00007ffff7e42ea8 <+8>:     00 00 00 60     nop
81638            0x00007ffff7e42eac <+12>:    f8 ff e1 fb     std     r31,-8(r1)
81639            0x00007ffff7e42eb0 <+16>:    78 1b 7f 7c     mr      r31,r3
81640            0x00007ffff7e42eb4 <+20>:    f0 ff c1 fb     std     r30,-16(r1)
81641            0x00007ffff7e42eb8 <+24>:    ea 00 00 38     li      r0,234
81642            0x00007ffff7e42ebc <+28>:    a0 8b 22 e9     ld      r9,-29792(r2)
81643            0x00007ffff7e42ec0 <+32>:    78 fb e3 7f     mr      r3,r31
81644            0x00007ffff7e42ec4 <+36>:    14 6a c9 7f     add     r30,r9,r13
81645            0x00007ffff7e42ec8 <+40>:    02 00 00 44     sc
81646            0x00007ffff7e42ecc <+44>:    26 00 00 7c     mfcr    r0
81647            0x00007ffff7e42ed0 <+48>:    00 10 09 74     andis.  r9,r0,4096
81648         ...
81649
81650         Fix this by treating system calls the same as branches in skip_prologue:
81651         by default, don't skip, such that the breakpoint is set at 0x00007ffff7e42eb8
81652         instead.
81653
81654         Tested on ppc64le-linux, on a power 8 machine.
81655
81656         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527
81657
81658 2021-11-02  Tom de Vries  <tdevries@zinfandel-3.arch.suse.de>
81659
81660         [gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases
81661         On powerpc64le-linux, with test-case gdb.arch/powerpc-addpcis.exp I run into
81662         SIGILL:
81663         ...
81664         (gdb) PASS: gdb.arch/powerpc-addpcis.exp: get hexadecimal valueof "$r3"
81665         stepi^M
81666         ^M
81667         Program terminated with signal SIGILL, Illegal instruction.^M
81668         The program no longer exists.^M
81669         (gdb) PASS: gdb.arch/powerpc-addpcis.exp: set r4
81670         ...
81671         because it's a power9 insn, and I'm running on a power8 machine.
81672
81673         Fix this by handling the SIGILL.  Likewise in gdb.arch/powerpc-lnia.exp.
81674
81675         Tested on powerpc64le-linux.
81676
81677 2021-11-02  Andrew Burgess  <andrew.burgess@embecosm.com>
81678
81679         gdb/sim: update my email address
81680         gdb:
81681
81682                 * MAINTAINERS (Global Maintainers): Update my address.
81683                 (Responsible Maintainers): Likewise.
81684                 (Write After Approval): Likewise.
81685
81686         sim:
81687
81688                 * MAINTAINERS (Global Maintainers): Update my address.
81689
81690 2021-11-02  Tom de Vries  <tdevries@suse.de>
81691
81692         [gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie
81693         When running test-case gdb.base/step-indirect-call-thunk.exp with target board
81694         unix/-m32/-fPIE/-pie, I run into:
81695         ...
81696         (gdb) stepi^M
81697         0x5655552e      22      {                /* inc.1 */^M
81698         (gdb) stepi^M
81699         0x56555530      22      {                /* inc.1 */^M
81700         (gdb) stepi^M
81701         0x565555f7 in __x86.get_pc_thunk.ax ()^M
81702         (gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
81703         ...
81704
81705         In contrast, with unix/-m32 we have instead:
81706         ...
81707         (gdb) stepi^M
81708         0x08048407      22      {                /* inc.1 */^M
81709         (gdb) stepi^M
81710         23        return x + 1;  /* inc.2 */^M
81711         (gdb) stepi^M
81712         0x0804840c      23        return x + 1;  /* inc.2 */^M
81713         (gdb) stepi^M
81714         24      }                /* inc.3 */^M
81715         (gdb) stepi^M
81716         0x08048410      24      }                /* inc.3 */^M
81717         (gdb) stepi^M
81718         0x0804848f in __x86_return_thunk ()^M
81719         (gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
81720         ...
81721
81722         The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a
81723         PIC helper function for x86_64-linux.
81724
81725         Fix this by insn-stepping through it.
81726
81727         Likewise in a few other test-cases.
81728
81729         Tested on x86_64-linux.
81730
81731 2021-11-02  GDB Administrator  <gdbadmin@sourceware.org>
81732
81733         Automatic date update in version.in
81734
81735 2021-11-01  Alan Modra  <amodra@gmail.com>
81736
81737         ARM: match armeb output for unwind-pacbti-m test
81738                 * testsuite/gas/arm/unwind-pacbti-m.d: Match armeb output.
81739
81740 2021-11-01  Bruno Larsen  <blarsen@redhat.com>
81741
81742         [gdb/doc]: Updated manpages to be consistent with help
81743         Updated manpages to be consistent with help information provided by the
81744         binary. The main changes are:
81745
81746         * Making all long-form options have '--', instead of a single '-';
81747         * added most of the missing options to the manpage;
81748         * removed the information about using '+' instead of '-', since it
81749           doesn't seem to be supported anymore.
81750
81751         This also fixes 2 upstream bugs:
81752         * https://sourceware.org/bugzilla/show_bug.cgi?id=23965; by adding
81753         --args to the manpage
81754         * https://sourceware.org/bugzilla/show_bug.cgi?id=10619; by adding the
81755         double dashes
81756
81757 2021-11-01  Alan Modra  <amodra@gmail.com>
81758
81759         macho-o archive sanity checks
81760         Anti-fuzzing checks.
81761
81762                 * mach-o.c (bfd_mach_o_fat_archive_p): Sanity check entry offset
81763                 and size against file size.
81764
81765 2021-11-01  Alan Modra  <amodra@gmail.com>
81766
81767         objcopy buffer overflow
81768         "tocopy" in this code was an int, which when the size to be copied was
81769         larger than MAXINT could result in tocopy being negative.  A negative
81770         value of course is less than BUFSIZE, but when converted to
81771         bfd_size_type is extremely large.
81772
81773                 PR 995
81774                 * objcopy.c (copy_unknown_object): Correct calculation of "tocopy".
81775                 Use better variable types.
81776
81777 2021-11-01  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
81778
81779         arm: add armv9-a architecture to -march
81780         Update also include:
81781                 + New value of Tag_CPU_arch EABI attribute (22) is added.
81782                 + Updated missing Tag_CPU_arch EABI attributes.
81783                 + Updated how we combine archs 'v4t_plus_v6_m' as this mechanism
81784                   have to handle new Armv9 as well.
81785
81786         Regression tested on `arm-none-eabi` cross Binutils and no issues.
81787
81788         bfd/
81789
81790                 * archures.c: Define bfd_mach_arm_9.
81791                 * bfd-in2.h (bfd_mach_arm_9): Define bfd_mach_arm_9.
81792                 * cpu-arm.c: Add 'armv9-a' option to -march.
81793                 * elf32-arm.c (using_thumb2_bl): Update assert check.
81794                 (arch_has_arm_nop): Add TAG_CPU_ARCH_V9.
81795                 (bfd_arm_get_mach_from_attributes): Add case for TAG_CPU_ARCH_V9.
81796                 Update assert.
81797                 (tag_cpu_arch_combine): Updated table.
81798                 (v9): New table..
81799
81800         binutils/
81801
81802                 * readelf.c (arm_attr_tag_CPU_arch): Update with
81803
81804         elfcpp/
81805
81806                 * arm.h: Update TAG_CPU_ARCH_ enums with correct values.
81807
81808         gas/
81809
81810                 * NEWS: Update docs.
81811                 * config/tc-arm.c (get_aeabi_cpu_arch_from_fset): Return Armv9-a
81812                 for -amarch=all.
81813                 (aeabi_set_public_attributes): Update assert.
81814                 * doc/c-arm.texi: Update docs.
81815                 * testsuite/gas/arm/armv9-a_arch.d: New test.
81816                 * testsuite/gas/arm/attr-march-all.d: Update test with v9.
81817
81818         include/
81819
81820                 * elf/arm.h Update TAG_CPU_ARCH_ defines with correct values.
81821                 * opcode/arm.h (ARM_EXT3_V9A): New macro.
81822                 (ARM_ARCH_NONE): Updated with arm_feature_set.core size.
81823                 (FPU_NONE): Updated.
81824                 (ARM_ANY): Updated.
81825                 (ARM_ARCH_UNKNOWN): New macro.
81826                 (ARM_FEATURE_LOW): Updated.
81827                 (ARM_FEATURE_CORE): Updated.
81828                 (ARM_FEATURE_CORE_LOW): Updated.
81829                 (ARM_FEATURE_CORE_HIGH): Updated.
81830                 (ARM_FEATURE_COPROC): Updated.
81831                 (ARM_FEATURE): Updated.
81832                 (ARM_FEATURE_ALL): New macro.
81833
81834         opcodes/
81835
81836                 * arm-dis.c (select_arm_features): Support bfd_mach_arm_9.
81837                 Also Update bfd_mach_arm_unknown to use new macro ARM_ARCH_UNKNOWN.
81838
81839 2021-11-01  Mike Frysinger  <vapier@gentoo.org>
81840
81841         sim: iq2000: reduce -Wno-error scope
81842         Clean up the warnings in sim-if, then reduce the -Werror disable to
81843         the files that still aren't clean that now that we require GNU make
81844         and can set variables on a per-object basis.
81845
81846         sim: lm32: reduce -Wno-error scope
81847         Clean up some warnings in dv-lm32cpu, and all in sim-if, then reduce
81848         the -Werror disable to the files that still aren't clean that now that
81849         we require GNU make and can set variables on a per-object basis.
81850
81851         sim: frv: reduce -Wno-error scope
81852         Only two files in here still generates warnings, so reduce the -Werror
81853         disable to that now that we require GNU make and can set variables on
81854         a per-object basis.
81855
81856         sim: m32r: reduce -Wno-error scope
81857         Only two files in here still generates warnings, so reduce the -Werror
81858         disable to that now that we require GNU make and can set variables on
81859         a per-object basis.
81860
81861         sim: mips: reduce -Wno-error scope
81862         Fix a few printf warnings in sim-main.c, and then we're left with only
81863         one file in here still generating warnings, so reduce the -Werror
81864         disable to that alone now that we require GNU make and can set variables
81865         on a per-object basis.
81866
81867         sim: erc32: reduce -Wno-error scope
81868         Only one file in here still generates warnings, so reduce the -Werror
81869         disable to that alone now that we require GNU make and can set variables
81870         on a per-object basis.
81871
81872         sim: cris: reduce -Wno-error scope
81873         Only two files in here still generates warnings, so reduce the -Werror
81874         disable to that now that we require GNU make and can set variables on
81875         a per-object basis.
81876
81877         sim: sh: reduce -Wno-error scope
81878         Only one file in here still generates warnings, so reduce the -Werror
81879         disable to that alone now that we require GNU make and can set variables
81880         on a per-object basis.
81881
81882         sim: or1k: build with -Werror
81883         The only warnings left in this port are a few maybe-uninitialized,
81884         but we don't abort the build for them, so turn on -Werror everywhere.
81885
81886         sim: igen: minor build output alignment fix
81887         The custom echo was off by one space relative to all the others.
81888
81889         sim: ppc: fix the printf fix for 32-bit systems
81890         The time delta is a 64-bit value too.
81891
81892         sim: m68hc11: clean up pointer casts
81893         The void *data field is used to past arbitrary data between event
81894         handlers, and these are using it to pass an integer.  Fix up the
81895         casts to avoid using (long) to cast to/from pointers since there
81896         is no guarantee that's the right size.
81897
81898         sim: d10v: clean up pointer casts
81899         Use %p to print pointers instead of trying to cast them to longs.
81900
81901         sim: bfin: cast pointers using uintptr_t
81902         We can't assume that sizeof(long) == sizeof(void*), so change all
81903         these casts over to uintptr_t.
81904
81905         sim: ppc: clean up printf format handling
81906         Don't blindly cast every possible type to (long).  Change to the right
81907         printf format specifier whether it be a 64-bit type or a pointer.
81908
81909         sim: ppc: switch core types to stdint.h types
81910         There's no need to define these ourselves anymore, so switch to the
81911         stdint.h types.  This will be important when we start using PRI*
81912         defines with printf formats.
81913
81914         sim: mn10300: clean up pointer casts
81915         The void *data field is used to past arbitrary data between event
81916         handlers, and these are using it to pass an enum.  Fix up the casts
81917         to avoid using (long) to cast to/from pointers since there is no
81918         guarantee that's the right size.
81919
81920         sim: events: clean up trace casts
81921         Don't blindly cast every possible type to (long).  Change to the right
81922         printf format specifier whether it be a 64-bit type or a pointer.
81923
81924         sim: ppc: handle \r in igen inputs [PR sim/28476]
81925         Make sure we consume & ignore \r bytes in inputs in case the file
81926         encodings are from a non-LF systems (e.g. Windows).
81927
81928         sim: ppc: constify strings in igen tooling
81929
81930 2021-11-01  GDB Administrator  <gdbadmin@sourceware.org>
81931
81932         Automatic date update in version.in
81933
81934 2021-10-31  Tom Tromey  <tom@tromey.com>
81935
81936         Fix latent bug in DWARF test case
81937         On my branch that replaces the DWARF psymtab reader,
81938         dw2-stack-boundary.exp started failing.  However, when I look at the
81939         output in gdb.log, it is correct:
81940
81941             file /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary
81942             Reading symbols from /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary...
81943             During symbol reading: location description stack overflow
81944             During symbol reading: location description stack underflow
81945
81946         What happens to cause the failure is that the two branches in
81947         gdb_test_multiple appear in this order:
81948
81949             -re "\r\nDuring symbol reading: location description stack underflow" {
81950             [...]
81951             -re "\r\nDuring symbol reading: location description stack overflow" {
81952
81953         The first one will match the above, without causing the second one to
81954         ever match -- leading to a spurious failure.
81955
81956         Anchoring the regexps seems to fix the problem, and works for the
81957         current gdb as well.
81958
81959 2021-10-31  Tom Tromey  <tom@tromey.com>
81960
81961         Fix unittest.exp failure due to 'set debuginfod' addition
81962         The 'set debuginfod' change caused a regression in unittest.exp:
81963
81964             Running selftest help_doc_invariants.
81965             help doc broken invariant: command 'info set debuginfod' help doc first line is not terminated with a '.' character
81966             help doc broken invariant: command 'set debuginfod' help doc first line is not terminated with a '.' character
81967             help doc broken invariant: command 'show debuginfod' help doc first line is not terminated with a '.' character
81968             Self test failed: self-test failed at ../../binutils-gdb/gdb/unittests/command-def-selftests.c:100
81969
81970         This patch fixes the problem.  I'm checking it in.
81971
81972 2021-10-31  Mike Frysinger  <vapier@gentoo.org>
81973
81974         sim: ppc: use silent build rules here too
81975         The ppc codebase is unique and doesn't leverage common/, so have to
81976         add silent rules to it specifically.
81977
81978         sim: rl78: drop obsolete manual dependency rules
81979         We have GNU make generate these for us automatically now, so there's
81980         no need to manually specify any deps.
81981
81982         sim: drop unused targ-vals.h includes
81983         This is used in a few places where it's not needed.  Drop the include
81984         to avoid the build-time generated header file as we move to drop it.
81985
81986         sim: unify callback.o building
81987         Now that the use of TARGET_xxx defines have been removed, we can move
81988         this to the common logic so we only build it once for multi-targets.
81989
81990         sim: nltvals: pull target open flags out into a dedicated source file
81991         Like we just did for pulling out the errno & signal maps, pull out the
81992         open flag map into a dedicated common file.  All newlib ports are using
81993         the same map which makes it easy.
81994
81995         sim: nltvals: localize TARGET_<open> defines
81996         Code should not be using these directly, instead they should be
81997         resolving these dynamically via the open_map.  Rework the common
81998         callback code that was using the defines to use symbolic names
81999         instead, and localize some of the defines in the ARM code (since
82000         it's a bit unclear how many different APIs it supports currently),
82001         then remove the defines out of the header so no new code can rely on
82002         them.
82003
82004         sim: nltvals: pull target signal out into a dedicated source file
82005         Like we just did for pulling out the errno map, pull out the signal
82006         map into a dedicated common file.  All newlib ports are using the
82007         same signal map which makes it easy.
82008
82009 2021-10-31  Mike Frysinger  <vapier@gentoo.org>
82010
82011         sim: nltvals: pull target errno out into a dedicated source file
82012         The current system maintains a list of target errno constants in the
82013         nltvals.def file, then runs a build-time tool to turn that into a C
82014         file.  This list of errno values is the same for all arches, so we
82015         don't need the arch-specific flexibility.  Further, these are only
82016         for newlib/libgloss environments, which makes it confusing to support
82017         other userland runtimes (like Linux).  Let's simplify to make this
82018         easier to understand & build.  We don't namespace the variables yet,
82019         but sets up the framework for it.
82020
82021         Create a new target-newlib-errno.c template file.  The template file
82022         is hand written, but the inline map is still automatically generated.
82023
82024         This allows us to move it to the common set of objects so it's only
82025         built once in a multi-target build.
82026
82027         Now we can remove the output from the gentmap build-time tool since
82028         it's checked into the tree.
82029
82030         Then we stop including the errno lists in nltvals.def since nothing
82031         uses it.
82032
82033 2021-10-31  Mike Frysinger  <vapier@gentoo.org>
82034
82035         sim: erc32: use silent build rules with sis linkage
82036
82037 2021-10-31  Mike Frysinger  <vapier@gentoo.org>
82038
82039         sim: erc32: fix a few more build warnings
82040         Tweak the if indentation & brace style to avoid ambiguous warnings.
82041
82042         Add ATTRIBUTE_UNUSED to UART functions that aren't used when FAST_UART
82043         is defined (which is the default).
82044
82045 2021-10-31  Orgad Shaneh  <orgads@gmail.com>
82046
82047         sim: erc32: fix signedness compatibility and redefinition warnings
82048
82049 2021-10-31  Mike Frysinger  <vapier@gentoo.org>
82050
82051         sim: add arch-specific conditional logic
82052         This will make it easy to include arch-specific logic (build files)
82053         as we migrate ports to the common top level build.
82054
82055         sim: v850: delete old gencode logic
82056         The v850 port used to have a gencode helper, but it was deleted long
82057         ago.  Clean up the settings that no longer make sense w/out it.
82058
82059         sim: common: merge multiple clean commands
82060         This provides a minor speedup when cleaning in a multi-target build.
82061
82062         sim: m32c: tighten up opc2c build output
82063         Drop the single debugging line that repeats the command line option,
82064         and use the silent build helpers to tighten up output.
82065
82066         sim: tighten up build regen rules
82067         Update the makefile & configure related rules to use the silent
82068         build helpers.
82069
82070         sim: tighten up gencode output
82071         Update the gencode rules to use the silent build helpers.
82072
82073         sim: igen: tighten up build output
82074         Add a new stamp helper for quiet builds, and don't dump the command
82075         line options when it runs.  That isn't standard tool behavior, and
82076         doesn't really seem necessary in any way.
82077
82078         sim: tighten up stamp rules
82079         Add a new ECHO_STAMP helper and convert existing stamp code over
82080         to it.  This is mostly common rules and cgen mloop rules.
82081
82082         sim: silence stamp touch rules
82083         We pretty much never care about these stamp touches, so silence them.
82084         Also switch to using $@ when it makes sense.
82085
82086         sim: standardize move-if-change rules
82087         Use the srcroot path and make them all silent.
82088
82089         sim: mips/v850: remove redundant variable setup
82090         The common/Make-common.in fragment already provides these variables.
82091
82092 2021-10-31  Orgad Shaneh  <orgads@gmail.com>
82093
82094         sim: fix compilation on mingw64 [PR sim/28476]
82095         ...by reordering includes.
82096
82097         1. sim-utils.c
82098
82099         sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h
82100         which has UserMode as a member. So if sim-main.h is included before winnt.h,
82101         compilation fails.
82102
82103         2. ppc
82104
82105         registers.h defines CR, which is used as a member in winnt.h.
82106
82107         winsock2.h is included by sys/time.h, so sys/time.h has to be included
82108         before registers.h.
82109
82110         Bug: https://sourceware.org/PR28476
82111
82112 2021-10-31  Alan Modra  <amodra@gmail.com>
82113
82114         Don't include coff/pe.h in coff-x86_64.c
82115         This (and other) code from coffcode.h is broken for x86_64_coff_vec,
82116         and has been ever since support was added in 2006 commit 99ad839030c1
82117         Here, bfd_coff_aoutsz must match coff_swap_aouthdr_out otherwise we
82118         end up writing garbage.
82119
82120               /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
82121                  include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)).  */
82122               char * buff;
82123               bfd_size_type amount = bfd_coff_aoutsz (abfd);
82124
82125               buff = (char *) bfd_malloc (amount);
82126               if (buff == NULL)
82127                 return false;
82128
82129               coff_swap_aouthdr_out (abfd, & internal_a, buff);
82130               amount = bfd_bwrite (buff, amount, abfd);
82131
82132         We have removed support for --target=x86_64-coff, likely because it
82133         never worked properly, but still produce coff-x86_64.o with
82134         --enable-targets=all.  This means objcopy can recognize x86_64 COFF
82135         files but will write garbage to the output file, a fact found by
82136         fuzzers.  I suspect x86_64 COFF is still broken after this fix, and
82137         mention of coff-x86_64.* should be removed from bfd/Makefile.am.
82138
82139                 * coff-x86_64.c: Don't include coff/pe.h.
82140                 (COFF_WITH_pex64): Don't define here.
82141                 * pe-x86_64.c: Include coff/pe.h and other headers.
82142                 (PEI_HEADERS): Define.
82143
82144 2021-10-31  Alan Modra  <amodra@gmail.com>
82145
82146         Re: PR28420, ecoff fuzzing failures
82147         sym_ptr_ptr NULL results in segfaults.
82148
82149                 PR 28420
82150                 * ecoff.c (ecoff_slurp_reloc_table): Don't leave sym_ptr_ptr NULL.
82151
82152 2021-10-31  Alan Modra  <amodra@gmail.com>
82153
82154         ubsan: alpha-vms: undefined shift
82155                 * vms-alpha.c (evax_bfd_print_image): Shift left 1u.
82156
82157         PR28518: signed integer overflow & free on unmalloced address
82158                 PR 28518
82159                 * vms-alpha.c (build_module_list): Don't lose malloc buffer address.
82160                 Use unsigned variables.
82161
82162 2021-10-31  GDB Administrator  <gdbadmin@sourceware.org>
82163
82164         Automatic date update in version.in
82165
82166 2021-10-30  Simon Marchi  <simon.marchi@polymtl.ca>
82167
82168         gdb: fix gdb.gdb/unittest.exp with C++17 compiler
82169         On a machine with gcc 11, I get:
82170
82171             FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_v" (second tab) (timeout)
82172             FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_vie" (timeout)
82173
82174         That's because when compiling with C++ >= 17, we use the standard
82175         version of string_view, and don't have a selftest for it.  So the list
82176         of selftests shown by the tab completion when completing "string_v"
82177         differs.
82178
82179         Change the test to use the copy_* tests instead.
82180
82181         Change-Id: I85f6aa44ee5fc9652b9bd4451e0506b89773526b
82182
82183 2021-10-30  Aaron Merey  <amerey@redhat.com>
82184
82185         gdb.texinfo: Expand documentation for debuginfod
82186         Add section describing GDB's usage of debuginfod.
82187
82188         Refer to this new section in the description of the '--with-debuginfod'
82189         configure option.
82190
82191         Mention debuginfod in the 'Separate Debug Files' section.
82192
82193 2021-10-30  Aaron Merey  <amerey@redhat.com>
82194
82195         gdb: add set/show commands for managing debuginfod
82196         Add 'set debuginfod' command.  Accepts 'on', 'off' or 'ask' as an
82197         argument.  'on' enables debuginfod for the current session.  'off'
82198         disables debuginfod for the current session.  'ask' will prompt
82199         the user to either enable or disable debuginfod when the next query
82200         is about to be performed:
82201
82202             This GDB supports auto-downloading debuginfo from the following URLs:
82203             <URL1> <URL2> ...
82204             Enable debuginfod for this session? (y or [n]) y
82205             Debuginfod has been enabled.
82206             To make this setting permanent, add 'set debuginfod on' to .gdbinit.
82207
82208         For interactive sessions, 'ask' is the default.  For non-interactive
82209         sessions, 'off' is the default.
82210
82211         Add 'show debuginfod status' command.  Displays whether debuginfod
82212         is set to 'on', 'off' or 'ask'.
82213
82214         Add 'set/show debuginfod urls' commands. Accepts a string of
82215         space-separated debuginfod server URLs to be queried.  The default
82216         value is copied from the DEBUGINFOD_URLS environment variable.
82217
82218         Finally add 'set/show debuginfod verbose' commands to control whether
82219         debuginfod-related output is displayed.  Verbose output is enabled
82220         by default.
82221
82222             (gdb) run
82223             Starting program: /bin/sleep 5
82224             Download failed: No route to host.  Continuing without debug info for /lib64/libc.so.6.
82225
82226         If GDB is not built with debuginfod then these commands will just display
82227
82228             Support for debuginfod is not compiled into GDB.
82229
82230 2021-10-30  GDB Administrator  <gdbadmin@sourceware.org>
82231
82232         Automatic date update in version.in
82233
82234 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82235
82236         gdb: remove TYPE_FIELD_DWARF_BLOCK
82237         Remove TYPE_FIELD_DWARF_BLOCK, replace with type::field +
82238         field::loc_dwarf_block.
82239
82240         Change-Id: I10af9410bb5f46d342b8358a7956998c7e804b64
82241
82242 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82243
82244         gdb: remove TYPE_FIELD_STATIC_PHYSADDR
82245         Remove TYPE_FIELD_STATIC_PHYSADDR replace with type::field +
82246         field::loc_physaddr.
82247
82248         Change-Id: Ica9bc4a48f34750ec82ec86c298d3ecece81bcbd
82249
82250 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82251
82252         gdb: remove TYPE_FIELD_STATIC_PHYSNAME
82253         Remove TYPE_FIELD_STATIC_PHYSNAME, replace with type::field +
82254         field::loc_physname.
82255
82256         Change-Id: Ie35d446b67dd1d02f39998b406001bdb7e6d5abb
82257
82258 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82259
82260         gdb: remove TYPE_FIELD_ENUMVAL
82261         Remove TYPE_FIELD_ENUMVAL, replace with type::field +
82262         field::loc_enumval.
82263
82264         Change-Id: I2ada73e4635aad3363ce2eb22c1dc52698ee2072
82265
82266 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82267
82268         gdb: remove TYPE_FIELD_BITPOS
82269         Remove TYPE_FIELD_BITPOS, replace its uses with type::field +
82270         field::loc_bitpos.
82271
82272         Change-Id: Iccd8d5a77e5352843a837babaa6bd284162e0320
82273
82274 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82275
82276         gdb: remove TYPE_FIELD_LOC_KIND
82277         Remove TYPE_FIELD_LOC_KIND, replace its uses with type::field +
82278         field::loc_kind.
82279
82280         Change-Id: Ib124a26365df82ac1d23df7962d954192913bd90
82281
82282 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82283
82284         gdb: remove FIELD_DWARF_BLOCK macro
82285         Remove FIELD_DWARF_BLOCK, replace its uses with field::loc_dwarf_block.
82286
82287         Change-Id: I66b7d6a960cb5e341e61e21bd3cc9a6ac26de6a8
82288
82289 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82290
82291         gdb: remove FIELD_STATIC_PHYSADDR macro
82292         Remove FIELD_LOC_KIND_PHYSADDR, replace its uses with
82293         field::loc_physaddr.
82294
82295         Change-Id: Ifd8b2bdaad75f42bfb1404ef8c396ffe7e10ac55
82296
82297 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82298
82299         gdb: remove FIELD_STATIC_PHYSNAME macro
82300         Remove FIELD_STATIC_PHYSNAME, replace its uses with field::loc_physname.
82301
82302         Change-Id: Iaa8952410403b4eb5bbd68411feea27e2405d657
82303
82304 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82305
82306         gdb: remove FIELD_ENUMVAL macro
82307         Remove FIELD_ENUMVAL, replace its uses with field::loc_enumval.
82308
82309         Change-Id: Id4861cee91a8bb583a9836f1aa5da0a320fbf4d9
82310
82311 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82312
82313         gdb: remove FIELD_BITPOS macro
82314         Remove FIELD_BITPOD, replace its uses with field::loc_bitpos.
82315
82316         Change-Id: Idb99297e0170661254276c206383a7e9bf1a935a
82317
82318 2021-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
82319
82320         gdb: remove FIELD_LOC_KIND macro
82321         Remove FIELD_LOC_KIND, replace its uses with field::loc_kind or
82322         call_site_target::loc_kind.
82323
82324         Change-Id: I0368d8c3ea269d491bb215aa70e32edbdf55f389
82325
82326 2021-10-29  Tom Tromey  <tromey@adacore.com>
82327
82328         Add gdb.Architecture.integer_type Python function
82329         This adds a new Python function, gdb.Architecture.integer_type, which
82330         can be used to look up an integer type of a given size and
82331         signed-ness.  This is useful to avoid dependency on debuginfo when a
82332         particular integer type would be useful.
82333
82334         v2 moves this to be a method on gdb.Architecture and addresses other
82335         review comments.
82336
82337 2021-10-29  Tom Tromey  <tromey@adacore.com>
82338
82339         Remove ada_value_print_inner
82340         I noticed that the only caller of ada_value_print_inner is
82341         valprint.c:do_val_print (via ada_language::value_print_inner), meaning
82342         that the try/catch logic in this function is redundant.  This patch
82343         removes the wrapper function.
82344
82345         Regression tested on x86-64 Fedora 34.
82346
82347 2021-10-29  Tom Tromey  <tromey@adacore.com>
82348
82349         Document resolve_dynamic_type oddity
82350         Today I re-learned that resolve_dynamic_type can return a type for
82351         which is_dynamic_type returns true.  This can happen for an array
82352         whose elements have dynamic type -- the array is reported as dynamic,
82353         but resolving the elements would be incorrect, because each element
82354         might have a different type after resolution.
82355
82356         You can see the special case in resolve_dynamic_array_or_string:
82357
82358           if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
82359         ...
82360           else
82361         ...
82362
82363         I looked into having the TYPE_CODE_ARRAY case in
82364         is_dynamic_type_internal follow this same logic, but that breaks down
82365         on the gdb.fortran/dynamic-ptype-whatis.exp test case.  In particular
82366         this code in fortran_undetermined::evaluate:
82367
82368           value *callee = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
82369           if (noside == EVAL_AVOID_SIDE_EFFECTS
82370               && is_dynamic_type (value_type (callee)))
82371             callee = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL);
82372
82373         ... relies on is_dynamic_type returning true for such an array.
82374
82375         I wasn't really sure of the best way to fix this, so in the meantime I
82376         wrote this patch, which documents the oddity so that I might have a
82377         chance of remembering this in the future.
82378
82379 2021-10-29  Tom Tromey  <tromey@adacore.com>
82380
82381         Avoid self-test failures on x86-linux
82382         The disassembly tests in "maint selftest" will fail on x86-linux.
82383         This happens because opcodes rejects an attempt to disassemble for an
82384         arch with a 64-bit address size when bfd_vma is 32-bit.
82385
82386         This patch avoids this problem by avoiding the test in this case.  I
82387         chose to do it this way because this seems to be the only situation
82388         where opcodes checks the size of bfd_vma.
82389
82390         For v2 of this patch, I've also updated memory_error_test to do the
82391         same thing.  This is needed due to the "improve error reporting from
82392         the disassembler" patch.
82393
82394 2021-10-29  Tom de Vries  <tdevries@suse.de>
82395
82396         [gdb/build] Fix build with --disable-unit-tests
82397         A build with --disable-unit-tests currently run into:
82398         ...
82399         ld: maint.o: in function \
82400           `maintenance_selftest_completer(cmd_list_element*, completion_tracker&,
82401                                           char const*, char const*)':
82402         src/gdb/maint.c:1183: undefined reference to \
82403           `selftests::for_each_selftest(
82404             gdb::function_view<
82405               void (std::__cxx11::basic_string<char,std::char_traits<char>,
82406                                                std::allocator<char> > const&)>)'
82407         ...
82408
82409         Fix this by guarding the call to selftests::for_each_selftest in
82410         maintenance_selftest_completer with GDB_SELF_TEST, such that the "-verbose"
82411         completion still works.
82412
82413         Rebuild on x86_64-linux and ran gdb.gdb/unittest.exp.
82414
82415 2021-10-29  Enze Li  <lienze2010@hotmail.com>
82416
82417         Document "memory-tag-violations".
82418         * gdb/doc/gdb.texinfo: (Data): Document '-memory-tag-violations'.
82419          (Command Options): Update the example.
82420
82421 2021-10-29  Tejas Belagod  <tejas.belagod@arm.com>
82422
82423         Support for a new pacbti unwind opcode.
82424         This patch adds readelf support for decoding the exception table
82425         opcode for restoring the RA_AUTH_CODE pseudo register defined by the
82426         EHABI
82427         (https://github.com/ARM-software/abi-aa/releases/download/2021Q1/ehabi32.pdf
82428         Section 10.3).
82429
82430                 * readelf.c (decode_arm_unwind_bytecode): Add support to decode
82431                 restoring RA_AUTH_CODE pseudo register.
82432
82433 2021-10-29  Alan Modra  <amodra@gmail.com>
82434
82435         Re: arm: add unwinder encoding support for PACBTI
82436         Move the gas testsuite files to where they belong.
82437
82438 2021-10-29  Alan Modra  <amodra@gmail.com>
82439
82440         ELF core file size checks
82441         Catch fuzzed segments where p_offset + p_filesz wraps, and limit error
82442         output.
82443
82444                 * elfcore.h (elf_core_file_p): Rewrite segment checks using
82445                 bfd_get_file_size.  Set read_only on file size errors.
82446                 * elfcode.h (elf_swap_shdr_in): Don't repeat error message.
82447
82448 2021-10-29  Alan Modra  <amodra@gmail.com>
82449
82450         obcopy vs. files with silly section alignment
82451         We already ignore stupid segment alignment when rewriting headers,
82452         ignore section alignment too.
82453
82454                 * elf.c (rewrite_elf_program_header): Ignore section alignment
82455                 power greater than 62.
82456
82457 2021-10-29  GDB Administrator  <gdbadmin@sourceware.org>
82458
82459         Automatic date update in version.in
82460
82461 2021-10-28  Stafford Horne  <shorne@gmail.com>
82462
82463         gdb: Add OpenRISC gdbserver and native config news
82464         The previous patches added gdbserver and native debugging support
82465         for OpenRISC targets.  This patch documents that in the news.
82466
82467         gdb: or1k: add single step for linux native debugging
82468         Needed for single stepping in Linux, this adds the or1k implementation
82469         of or1k_software_single_step.  Most of the implementation is borrowed
82470         from the bare metal single step code from or1k_single_step_through_delay
82471         which has been extracted and shared in helper function
82472         or1k_delay_slot_p.
82473
82474 2021-10-28  Stafford Horne  <shorne@gmail.com>
82475
82476         gdb: or1k: add native linux support
82477         This patch adds support for running gdb natively on OpenRISC linux.
82478         Debugging support is provided via the linux PTRACE interface which is
82479         mostly handled by GDB genric code.  This patch provides the logic of how
82480         to read and write the ptrace registers between linux and GDB.
82481
82482         Single stepping is privided in a separate patch.
82483
82484 2021-10-28  Stafford Horne  <shorne@gmail.com>
82485
82486         gdb: or1k: add generated linux descriptor file
82487
82488         gdb: or1k: fixup linux regcache comment
82489         The old comment was not properly updated from the RISC-V example used.
82490         Update it to match OpenRISC.
82491
82492 2021-10-28  Stafford Horne  <shorne@gmail.com>
82493
82494         gdb: or1k: implement gdb server
82495         This patch adds gdbserver support for OpenRISC.  This has been used for
82496         debugging the glibc port that in being worked on here:
82497
82498           https://github.com/openrisc/or1k-glibc/tree/or1k-port-2
82499
82500         Hence the comment about registers definitions being inline with glibc.
82501
82502 2021-10-28  Christian Biesinger  <cbiesinger@google.com>
82503
82504         [sim] Include defs.h in ppc/hw_memory.c
82505         To fix this error (seen on cygwin):
82506         /../../sim/ppc/../common ../../../sim/ppc/hw_memory.c
82507         In file included from ../../gnulib/import/stdlib.h:100,
82508                          from ../../../sim/ppc/hw_memory.c:28:
82509         ../../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
82510           663 |  #error "Please include config.h first."
82511               |   ^~~~~
82512         ../../gnulib/import/unistd.h:665:24: error: expected ';' before 'extern'
82513           665 | _GL_INLINE_HEADER_BEGIN
82514               |                        ^
82515               |                        ;
82516         ../../gnulib/import/unistd.h:2806:22: error: expected ';' before 'extern'
82517          2806 | _GL_INLINE_HEADER_END
82518               |                      ^
82519               |                      ;
82520
82521 2021-10-28  Markus Klein  <markus.klein@sma.de>
82522
82523         ARM assembler: Allow up to 32 single precision registers in the VPUSH and VPOP instructions.
82524                 PR 28436
82525                 * config/tc-arm.c (do_vfp_nsyn_push_pop_check): New function.
82526                 (do_vfp_nsyn_pop): Use the new function.
82527                 (do_vfp_nsyn_push): Use the new function.
82528                 * testsuite/gas/arm/v8_1m-mve.s: Add new instructions.
82529                 * testsuite/gas/arm/v8_1m-mve.d: Updated expected disassembly.
82530
82531 2021-10-28  Simon Marchi  <simon.marchi@efficios.com>
82532
82533         gdb: use ptid_t::to_string in infrun debug messages
82534         In debug messages, I think it would be more helpful to print ptid using
82535         the simple "pid.lwp.tid" notation in infrun debug messages.  I am
82536         currently debugging some fork issues, and find the pid_to_str output not
82537         so useful, as it doesn't tell which process a thread belongs to.
82538
82539         It currently shows up like this:
82540
82541             [infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=0, current thread [Thread 0x7ffff7d95740 (LWP 892942)] at 0x55555555521f
82542
82543         With the patch, it shows up like this:
82544
82545             [infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [894072.894077.0] at 0x5555555551d9
82546
82547         Change-Id: I130796d7dfb0d8e763b8358d8a6002701d80c4ea
82548
82549 2021-10-28  Simon Marchi  <simon.marchi@polymtl.ca>
82550
82551         gdb: add selftest name completion
82552         After the previous commit, it is easy to add completion for selftest
82553         names.  Again, this is not particularly high value, but I rarely touched
82554         completion, so it served as a simple example to get some practice.
82555
82556         Change the for_each_selftest_ftype parameter to gdb::function_view, so
82557         that we can pass a lambda that captures things.
82558
82559         Change-Id: I87cac299ddca9ca7eb0ffab78342e850a98d954c
82560
82561 2021-10-28  Tejas Belagod  <Tejas.Belagod@arm.com>
82562
82563         arm: add unwinder encoding support for PACBTI
82564         This patch adds support for encoding the Return Address Authentication pseudo
82565         register - '.save {ra_auth_code}' as defined by the DWARF ABI - in the
82566         exception tables where the opcode is defined by the EHABI
82567
82568         gas/Changelog:
82569
82570                 * config/tc-arm.c (arm_reg_type): Add new type REG_TYPE_PSEUDO.
82571                 (reg_expected_msgs): Add message for pseudo reg type.
82572                 (reg_list_els): Add new reg list type REGLIST_PSEUDO.
82573                 (parse_reg_list): Handle new REGLIST_PSEUDO type.
82574                 (s_arm_unwind_save_pseudo): Encode pseudo reg list save in exception
82575                 tables.
82576                 (s_arm_unwind_save): Handle new REG_TYPE_PSEUDO.
82577                 (reg_names): Add ra_auth_code pseudo register.
82578                 * testsuite/gas/arm/unwind-pacbti-m.s: New test.
82579                 * testsuite/gas/arm/unwind-pacbti-m.d: New test.
82580                 * testsuite/gas/arm/unwind-pacbti-m-readelf.d: New test.
82581
82582 2021-10-28  Simon Marchi  <simon.marchi@polymtl.ca>
82583
82584         gdb: add "maint set/show selftest verbose" commands and use process_options
82585         I saw the new -verbose switch to "maint selftests" and thought it would
82586         be nice for it to use the option framework.  For example, that makes
82587         having completion easy.  It's not that high value, given this is a
82588         maintenance command, but I had never used the framework myself, so it
82589         was a good way to practice.
82590
82591         This patch also adds the "maint set/show selftest verbose" setting.  It
82592         would be possible to use option framework without adding the setting,
82593         but using the framework makes adding the option almost trivial, so I
82594         thought why not.
82595
82596         Change-Id: I6687faa0713ff3da60b398253211777100094144
82597
82598 2021-10-28  Tom de Vries  <tdevries@suse.de>
82599
82600         [gdb/testsuite] Update some test-cases to GPLv3
82601         I noticed some files in the test-suite have GPLv2 notices.
82602
82603         Update these to GPLv3.
82604
82605 2021-10-28  Simon Marchi  <simon.marchi@polymtl.ca>
82606
82607         gdb: add add_setshow_prefix_cmd
82608         There's a common pattern to call add_basic_prefix_cmd and
82609         add_show_prefix_cmd to add matching set and show commands.  Add the
82610         add_setshow_prefix_cmd function to factor that out and use it at a few
82611         places.
82612
82613         Change-Id: I6e9e90a30e9efb7b255bf839cac27b85d7069cfd
82614
82615 2021-10-28  Tom de Vries  <tdevries@suse.de>
82616
82617         [gdb/testsuite] Require python in gdb.server/server-kill-python.exp
82618         I came across this when running test-case gdb.server/server-kill-python.exp
82619         with a gdb configured without python:
82620         ...
82621         builtin_spawn gdb -nw -nx -data-directory data-directory -iex set height 0 \
82622           -iex set width 0 -quiet -iex set height 0 -iex set width 0 \
82623           -ex source outputs/gdb.server/server-kill-python/file1.py^M
82624         FAIL: gdb.server/server-kill-python.exp: ensure inferior is running
82625         Executing on target: kill -9 28535    (timeout = 300)
82626         builtin_spawn -ignore SIGHUP kill -9 28535^M
82627         file1.py:1: Error in sourced command file:^M
82628         Undefined command: "import".  Try "help".^M
82629         ...
82630
82631         Fix this by testing for python support in the test-case.
82632
82633         Tested on aarch64-linux (with python support disabled) and x86_64-linux (with
82634         python support enabled).
82635
82636 2021-10-28  Tom de Vries  <tdevries@suse.de>
82637
82638         [gdb/testsuite] Fix assembly comments in gdb.dwarf2/clang-debug-names.exp.tcl
82639         On openSUSE Leap 15.2 aarch64 I ran into:
82640         ...
82641         clang-debug-names-debug.S:72: \
82642           Error: junk at end of line, first unrecognized character is `#'
82643         ...
82644         due to:
82645         ...
82646             71  .Ldebug_names_start:
82647             72    .short 5                      # Header: version
82648         ...
82649
82650         Fix this by using the /* ... */ comment style instead:
82651         ...
82652         $ sed -i 's% #\([^"]*\)%/*\1 */%' clang-debug-names.exp.tcl
82653         ...
82654
82655         Tested on aarch64-linux and x86_64-linux.
82656
82657 2021-10-28  Tom de Vries  <tdevries@suse.de>
82658
82659         [gdb/symtab] Handle DW_AT_string_length with location list
82660         Consider a fortran routine where a string variable s is modified:
82661         ...
82662         subroutine f(s)
82663           character*(*) s
82664           print *, s
82665           s(1:3) = 'oof'
82666           print *, s
82667         end subroutine f
82668         ...
82669
82670         When compiling with optimization level -O1 and printing the type of
82671         variable s we get:
82672         ...
82673         $ gdb -q -batch outputs/gdb.opt/fortran-string/fortran-string \
82674           -ex "b f" \
82675           -ex run \
82676           -ex "ptype s"
82677         Breakpoint 1 at 0x4006f7: file fortran-string.f90, line 21.
82678
82679         Breakpoint 1, f (s=..., _s=_s@entry=3) at fortran-string.f90:21
82680         21      subroutine f(s)
82681         type = character*1
82682         ...
82683         while with -O0 we have instead:
82684         ...
82685         type = character (3)
82686         ...
82687
82688         The problem is that the type of s is:
82689         ...
82690          <1><2d6>: Abbrev Number: 21 (DW_TAG_string_type)
82691             <2d7>   DW_AT_string_length: 0xbf (location list)
82692             <2db>   DW_AT_byte_size   : 4
82693         ...
82694         where the DW_AT_string_length is a location list, a case that is not handled
82695         by attr_to_dynamic_prop.
82696
82697         Fix this by handling attr->form_is_section_offset () in attr_to_dynamic_prop.
82698
82699         Tested on x86_64-linux.
82700
82701         The test-case is based on gdb.opt/fortran-string.exp from
82702         https://src.fedoraproject.org/rpms/gdb/raw/f32/f/gdb-archer-vla-tests.patch .
82703         I've updated the copyrights to stretch to 2021.
82704
82705         [ I've tried to create a dwarf assembly test-case for this, but didn't
82706         manage. ]
82707
82708         Co-Authored-By: Jan Kratochvil <jan.kratochvil@redhat.com>
82709
82710         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26910
82711
82712 2021-10-28  Kavitha Natarajan  <kavitha.natarajan@amd.com>
82713
82714         [gdb/testsuite] Initialize anonymous union in gdb.cp/koenig.cc
82715         GDB test fails while running the test case gdb.cp/koenig.exp using
82716         clang compiler:
82717         [...]
82718         p foo (p_union)
82719         No symbol "p_union" in current context.
82720         (gdb) FAIL: gdb.cp/koenig.exp: p foo (p_union)
82721         [...]
82722
82723         In the testcase, "p_union" is an unused/uninitialized variable of
82724         anonymous union type. Clang does not emit symbol for unused anonymous
82725         union/struct variables at any optimization level. Since the compiler
82726         itself is not emitting the symbol for "p_union", debug info is also
82727         not emitted when built with debug option. If the anonymous union is
82728         initialized (or used), then clang emits the symbol "p_union" which
82729         enables emitting debug info for "p_union".
82730         [...]
82731         p foo (p_union)
82732         Cannot resolve function foo to any overloaded instance
82733         (gdb) PASS: gdb.cp/koenig.exp: p foo (p_union)
82734         [...]
82735
82736 2021-10-28  Alan Modra  <amodra@gmail.com>
82737
82738         asan: mmo: NULL dereferenc in mmo_xore_32
82739         mmo_get_loc can return NULL.  It's commented even, and that the caller
82740         then must handle a split field.  mmo_xore_* don't handle split fields,
82741         instead just segfault.  Stop that happening, and refuse to recognise
82742         fuzzed mmo files that trigger this problem.
82743
82744                 * mmo.c (mmo_get_loc): Don't declare inline.
82745                 (mmo_xore_64, mmo_xore_32, mmo_xore_16): Remove forward decls.
82746                 Return pointer, don't dereference NULL.
82747                 (mmo_scan): Return error on mmo_get_loc returning NULL.
82748
82749 2021-10-28  Alan Modra  <amodra@gmail.com>
82750
82751         bfd: remove use of INLINE
82752         No need to use anything fancy, plain inline works just as well.
82753
82754                 * bfd-in.h (INLINE): Don't define.
82755                 * bfd-in2.h: Regenerate.
82756                 * aoutx.h: Replace use of INLINE with inline.
82757                 * elf-eh-frame.c: Likewise.
82758                 * elf32-score7.c: Likewise.
82759                 * elfxx-mips.c: Likewise.
82760                 * ihex.c: Likewise.
82761                 * mach-o.c: Likewise.
82762                 * mmo.c: Likewise.
82763
82764 2021-10-28  Alan Modra  <amodra@gmail.com>
82765
82766         ASSERT in empty output section with address
82767                 * ldlang.c (lang_do_assignments_1): Correct "dot" inside ignored
82768                 sections.
82769                 * testsuite/ld-scripts/empty-address-4.d,
82770                 * testsuite/ld-scripts/empty-address-4.s,
82771                 * testsuite/ld-scripts/empty-address-4.t: New test.
82772                 * testsuite/ld-scripts/empty-address.exp: Run it.
82773
82774 2021-10-28  GDB Administrator  <gdbadmin@sourceware.org>
82775
82776         Automatic date update in version.in
82777
82778 2021-10-27  Alan Modra  <amodra@gmail.com>
82779
82780         asan: alpha-vms: buffer overflows
82781         Yet more anti-fuzzer sanity checking
82782
82783                 * vms-alpha.c (evax_bfd_print_egsd): Sanity check record and
82784                 name lengths before access.
82785                 (evax_bfd_print_etir_stc_ir, evax_bfd_print_etir): Likewise.
82786
82787 2021-10-27  Alan Modra  <amodra@gmail.com>
82788
82789         ubsan: arm: undefined shift
82790         left shift of 2 by 31 places cannot be represented in type 'int'
82791
82792                 * arm-dis.c (print_insn_thumb16): Avoid undefined behaviour.
82793
82794 2021-10-27  Tom Tromey  <tromey@adacore.com>
82795
82796         Fix watchpoints with multiple threads on Windows
82797         A recent internal change pointed out that watchpoints were not working
82798         on Windows when the inferior was multi-threaded.  This happened
82799         because the debug registers were only updated for certain threads --
82800         in particular, those that were being resumed and that were not marked
82801         as suspended.  In the case of single-stepping, the need to update the
82802         debug registers in other threads could also be "forgotten".
82803
82804         This patch changes windows-nat.c to mark all threads needing a debug
82805         register update.  This brings the code closer to what gdbserver does
82806         (though, unfortunately, it still seems more complicated than needed).
82807
82808 2021-10-27  Tom de Vries  <tdevries@suse.de>
82809
82810         [gdb/testsuite] Fix port detection in gdb.debuginfod/fetch_src_and_symbols.exp
82811         On OBS I ran into this failure with test-case
82812         gdb.debuginfod/fetch_src_and_symbols.exp:
82813         ...
82814         Failed to listen for connections: Address already in use^M
82815         [Thu Oct 21 11:48:49 2021] (559/559): started http server on IPv6 port=8000^M
82816           ...
82817         FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: find port timeout
82818         ...
82819
82820         The test-case is trying to start debuginfod on a port to see if it's
82821         available, and it handles either this message:
82822           "started http server on IPv4 IPv6 port=$port"
82823         meaning success, or:
82824           "failed to bind to port"
82825         meaning failure, in which case the debuginfod instance is killed, and we try
82826         the next port.
82827
82828         The test-case only uses the v4 address 127.0.0.1, so fix this by:
82829         - accepting "started http server on IPv4 port=$port"
82830         - rejecting "started http server on IPv6 port=$port"
82831
82832         Tested on x86_64-linux.
82833
82834 2021-10-27  Simon Marchi  <simon.marchi@efficios.com>
82835
82836         gdb: fix value.c build on 32-bits
82837         When building on ARM (32-bits), we errors like this:
82838
82839             /home/smarchi/src/binutils-gdb/gdb/value.c: In function 'gdb::array_view<const unsigned char> value_contents_for_printing(value*)':
82840             /home/smarchi/src/binutils-gdb/gdb/value.c:1252:35: error: narrowing conversion of 'length' from 'ULONGEST' {aka 'long long unsigned int'} to 'size_t' {aka 'unsigned int'} [-Werror=narrowing]
82841              1252 |   return {value->contents.get (), length};
82842                   |                                   ^~~~~~
82843
82844         Fix that by using gdb::make_array_view, which does the appropriate
82845         conversion.
82846
82847         Change-Id: I7d6f2e75d7440d248b8fb18f8272ee92954b404d
82848
82849 2021-10-27  Nelson Chu  <nelson.chu@sifive.com>
82850
82851         RISC-V: Tidy riscv assembler and disassembler.
82852         Tidy the gas/config/tc-riscv.c and opcodes/riscv-dis.c, to prepare for
82853         moving the released extensions (including released vendor extensions)
82854         from integration branch back to mainline.
82855
82856         * Added parts of missing comments.
82857
82858         * Updated md_show_usage.
82859
82860         * For validate_riscv_insn, riscv_ip and print_insn_args, unify the
82861           following pointer names,
82862           - oparg: pointed to the parsed operand defined in the riscv_opcodes.
82863           - asarg: pointed to the parsed operand from assembly.
82864           - opargStart: recorded the parsed operand name from riscv_opcodes.
82865           - asargStart: recorded the parsed operand name from assembly.
82866
82867         gas/
82868                 * config/tc-riscv.c: Added parts of missind comments and updated
82869                 the md_show_usage.
82870                 (riscv_multi_subset_supports): Tidy codes.
82871                 (validate_riscv_insn): Unify the pointer names, oparg, asarg,
82872                 opargStart and asargStart, to prepare for moving the released
82873                 extensions from integration branch back to mainline.
82874                 (riscv_ip): Likewise.
82875                 (macro_build): Added fmtStart, also used to prepare for moving
82876                 released extensions.
82877                 (md_show_usage): Added missing descriptions for new options.
82878         opcodes/
82879                 * riscv-dis.c (print_insn_args): Unify the pointer names,
82880                 oparg and opargStart, to prepare for moving the released
82881                 extensions from integration branch back to mainline.
82882
82883 2021-10-27  Maciej W. Rozycki  <macro@embecosm.com>
82884
82885         opcodes: Fix RPATH not being set for dynamic libbfd dependency
82886         If built as a shared library, libopcodes has a load-time dependency on
82887         libbfd, which is recorded in the dynamic section, however without a
82888         corresponding RPATH entry for the directory to find libbfd in.  This
82889         causes loading to fail whenever libbfd is only pulled by libopcodes
82890         indirectly and libbfd has been installed in a directory that is not in
82891         the dynamic loader's search path.
82892
82893         It does not happen with the programs included with binutils or GDB,
82894         because they all also pull libbfd when using libopcodes, but it can
82895         happen with external software, e.g.:
82896
82897         $ gdbserver --help
82898         gdbserver: error while loading shared libraries: libbfd-[...].so: cannot open shared object file: No such file or directory
82899         $
82900
82901         (not our `gdbserver').
82902
82903         Indirect dynamic dependencies are handled by libtool automatically by
82904         adding RPATH entries as required, however our setup for libopcodes
82905         prevents this from happening by linking in libbfd with an explicit file
82906         reference sneaked through to the linker directly behind libtool's back
82907         via the `-Wl' linker command-line option rather than via `-l' combined
82908         with a suitable library search path specified via `-L', as it would be
82909         usually the case, or just referring to the relevant .la file in a fully
82910         libtool-enabled configuration such as ours.
82911
82912         According to an observation in the discussion back in 2007[1][2][3] that
82913         has led to the current arrangement it is to prevent libtool from picking
82914         up the wrong version of libbfd.  It does not appear to be needed though,
82915         not at least with our current libtool incarnation, as directly referring
82916         `libbfd.la' does exactly what it should, as previously suggested[4], and
82917         with no link-time reference to the installation directory other than to
82918         set RPATH.  Uninstalled version of libopcodes has libbfd's build-time
82919         location prepended to RPATH too, as also expected.
82920
82921         Use a direct reference to `libbfd.la' then, making the load error quoted
82922         above go away.  Alternatively `-L' and `-l' could be used to the same
82923         effect, but it seems an unnecessary complication and just another way to
82924         circumvent rather than making use of libtool.
82925
82926         References:
82927
82928         [1] "compile failure due to undefined symbol",
82929             <https://sourceware.org/ml/binutils/2007-08/msg00476.html>
82930
82931         [2] same, <https://sourceware.org/ml/binutils/2007-09/msg00000.html>
82932
82933         [3] same, <https://sourceware.org/ml/binutils/2007-10/msg00019.html>
82934
82935         [4] same, <https://sourceware.org/ml/binutils/2007-10/msg00034.html>
82936
82937                 opcodes/
82938                 * Makefile.am: Remove obsolete comment.
82939                 * configure.ac: Refer `libbfd.la' to link shared BFD library
82940                 except for Cygwin.
82941                 * Makefile.in: Regenerate.
82942                 * configure: Regenerate.
82943
82944 2021-10-27  GDB Administrator  <gdbadmin@sourceware.org>
82945
82946         Automatic date update in version.in
82947
82948 2021-10-27  H.J. Lu  <hjl.tools@gmail.com>
82949
82950         gold: Place .note.gnu.property section before other note sections
82951         Place the .note.gnu.property section before all other note sections to
82952         avoid being placed between other note sections with different alignments.
82953
82954                 PR gold/28494
82955                 * layout.cc (Layout::create_note): Set order to ORDER_PROPERTY_NOTE
82956                 for the .note.gnu.property section.
82957                 * layout.h (Output_section_order): Add ORDER_PROPERTY_NOTE.
82958
82959 2021-10-26  Tom de Vries  <tdevries@suse.de>
82960
82961         [gdb/doc] Fix print inferior-events default
82962         In the docs about print inferior-events we read:
82963         ...
82964         By default, these messages will not be printed.
82965         ...
82966
82967         That used to be the case, but is no longer so since commit f67c0c91715 "Enable
82968         'set print inferior-events' and improve detach/fork/kill/exit messages".
82969
82970         Fix this by updating the docs.
82971
82972 2021-10-26  GDB Administrator  <gdbadmin@sourceware.org>
82973
82974         Automatic date update in version.in
82975
82976 2021-10-25  Simon Marchi  <simon.marchi@polymtl.ca>
82977
82978         gdb: change functions returning value contents to use gdb::array_view
82979         The bug fixed by this [1] patch was caused by an out-of-bounds access to
82980         a value's content.  The code gets the value's content (just a pointer)
82981         and then indexes it with a non-sensical index.
82982
82983         This made me think of changing functions that return value contents to
82984         return array_views instead of a plain pointer.  This has the advantage
82985         that when GDB is built with _GLIBCXX_DEBUG, accesses to the array_view
82986         are checked, making bugs more apparent / easier to find.
82987
82988         This patch changes the return types of these functions, and updates
82989         callers to call .data() on the result, meaning it's not changing
82990         anything in practice.  Additional work will be needed (which can be done
82991         little by little) to make callers propagate the use of array_view and
82992         reap the benefits.
82993
82994         [1] https://sourceware.org/pipermail/gdb-patches/2021-September/182306.html
82995
82996         Change-Id: I5151f888f169e1c36abe2cbc57620110673816f3
82997
82998 2021-10-25  Simon Marchi  <simon.marchi@efficios.com>
82999
83000         gdbsupport: add assertions in array_view
83001         Add assertions to ensure we don't access an array_view out of bounds.
83002         Enable these assertions only when _GLIBCXX_DEBUG is set, as we did for
83003         gdb::optional.
83004
83005         Change-Id: Iffaee38252405073735ed123c8e57fde6b2c6be3
83006
83007 2021-10-25  Simon Marchi  <simon.marchi@polymtl.ca>
83008
83009         gdbserver: make target_pid_to_str return std::string
83010         I wanted to write a warning that included two target_pid_to_str calls,
83011         like this:
83012
83013             warning (_("Blabla %s, blabla %s"),
83014                      target_pid_to_str (ptid1),
83015                      target_pid_to_str (ptid2));
83016
83017         This doesn't work, because target_pid_to_str stores its result in a
83018         static buffer, so my message would show twice the same ptid.  Change
83019         target_pid_to_str to return an std::string to avoid this.  I don't think
83020         we save much by using a static buffer, but it is more error-prone.
83021
83022         Change-Id: Ie3f649627686b84930529cc5c7c691ccf5d36dc2
83023
83024 2021-10-25  H.J. Lu  <hjl.tools@gmail.com>
83025
83026         x86: Also handle stores for -muse-unaligned-vector-move
83027                 * config/tc-i386.c (encode_with_unaligned_vector_move): Also
83028                 handle stores.
83029                 * testsuite/gas/i386/unaligned-vector-move.s: Add stores.
83030                 * testsuite/gas/i386/unaligned-vector-move.d: Updated.
83031                 * testsuite/gas/i386/x86-64-unaligned-vector-move.d: Likewise.
83032
83033 2021-10-25  Tom de Vries  <tdevries@suse.de>
83034
83035         [gdb/testsuite] Fix duplicate in gdb.mi/mi-var-cp.exp
83036         With test-case gdb.mi/mi-var-cp.exp I run into this duplicate:
83037         ...
83038         PASS: gdb.mi/mi-var-cp.exp: run to mi-var-cp.cc:104 (set breakpoint)
83039         PASS: gdb.mi/mi-var-cp.exp: create varobj for s
83040         PASS: gdb.mi/mi-var-cp.exp: create varobj for s
83041         DUPLICATE: gdb.mi/mi-var-cp.exp: create varobj for s
83042         ...
83043
83044         This is due to a duplicate test name here:
83045         ...
83046         $ cat -n gdb/testsuite/gdb.mi/mi-var-cp.cc
83047           ...
83048            100  int reference_to_struct ()
83049            101  {
83050            102    /*: BEGIN: reference_to_struct :*/
83051            103    S s = {7, 8};
83052            104    S& r = s;
83053            105    /*:
83054            106      mi_create_varobj S s "create varobj for s"
83055            107      mi_create_varobj R r "create varobj for s"
83056         ...
83057
83058         Fix this by using "create varobj for r" instead.
83059
83060         Tested on x86_64-linux.
83061
83062 2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83063
83064         libctf, ld: handle nonrepresentable types better
83065         ctf_type_visit (used, among other things, by the type dumping code) was
83066         aborting when it saw a nonrepresentable type anywhere: even a single
83067         structure member with a nonrepresentable type caused an abort with
83068         ECTF_NONREPRESENTABLE.  This is not useful behaviour, given that the
83069         abort comes from a type-resolution we are only doing in order to
83070         determine whether the type is a structure or union.  We know
83071         nonrepresentable types can't be either, so handle that case and
83072         pass the nonrepresentable type down.
83073
83074         (The added test verifies that the dumper now handles this case and
83075         prints nonrepresentable structure members as it already does
83076         nonrepresentable top-level types, rather than skipping the whole
83077         structure -- or, without the previous commit, skipping the whole types
83078         section.)
83079
83080         ld/ChangeLog
83081         2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83082
83083                 * testsuite/ld-ctf/nonrepresentable-member.*: New test.
83084
83085         libctf/ChangeLog
83086         2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83087
83088                 * ctf-types.c (ctf_type_rvisit): Handle nonrepresentable types.
83089
83090 2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83091
83092         libctf: dump: do not stop dumping types on error
83093         If dumping of a single type fails, we obviously can't dump it; but just
83094         as obviously this doesn't make the other types in the types section
83095         invalid or undumpable.  So we should not propagate errors seen when
83096         type-dumping, but rather ignore them and carry on, so we dump as many
83097         types as we can (leaving out the ones we can't grok).
83098
83099         libctf/ChangeLog
83100         2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83101
83102                 * ctf-dump.c (ctf_dump_type): Do not abort on error.
83103
83104 2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83105
83106         binutils, ld: make objdump --ctf's parameter optional
83107         ld by default (and always, unless adjusted with a hand-rolled linker
83108         script) emits deduplicated CTF into the .ctf section.  But viewing
83109         it needs you to explicitly tell objdump this: it doesn't default
83110         its argument, even though what you always end up typing is
83111         --ctf=.ctf.
83112
83113         This is annoying, so make the argument optional.
83114
83115         binutils/ChangeLog
83116         2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83117
83118                 * objdump.c (usage): --ctf now has an optional argument.
83119                 (main): Adjust accordingly.
83120                 (dump_ctf): Default it.
83121                 * doc/ctf.options.texi: Adjust.
83122
83123         ld/ChangeLog
83124         2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83125
83126                 * testsuite/ld-ctf/array.d: Change --ctf=.ctf to --ctf.
83127                 * testsuite/ld-ctf/conflicting-cycle-1.B-1.d: Likewise.
83128                 * testsuite/ld-ctf/conflicting-cycle-1.B-2.d: Likewise.
83129                 * testsuite/ld-ctf/conflicting-cycle-1.parent.d: Likewise.
83130                 * testsuite/ld-ctf/conflicting-cycle-2.A-1.d: Likewise.
83131                 * testsuite/ld-ctf/conflicting-cycle-2.A-2.d: Likewise.
83132                 * testsuite/ld-ctf/conflicting-cycle-2.parent.d: Likewise.
83133                 * testsuite/ld-ctf/conflicting-cycle-3.C-1.d: Likewise.
83134                 * testsuite/ld-ctf/conflicting-cycle-3.C-2.d: Likewise.
83135                 * testsuite/ld-ctf/conflicting-cycle-3.parent.d: Likewise.
83136                 * testsuite/ld-ctf/conflicting-enums.d: Likewise.
83137                 * testsuite/ld-ctf/conflicting-typedefs.d: Likewise.
83138                 * testsuite/ld-ctf/cross-tu-cyclic-conflicting.d: Likewise.
83139                 * testsuite/ld-ctf/cross-tu-cyclic-nonconflicting.d: Likewise.
83140                 * testsuite/ld-ctf/cross-tu-into-cycle.d: Likewise.
83141                 * testsuite/ld-ctf/cross-tu-noncyclic.d: Likewise.
83142                 * testsuite/ld-ctf/cycle-1.d: Likewise.
83143                 * testsuite/ld-ctf/cycle-2.A.d: Likewise.
83144                 * testsuite/ld-ctf/cycle-2.B.d: Likewise.
83145                 * testsuite/ld-ctf/cycle-2.C.d: Likewise.
83146                 * testsuite/ld-ctf/data-func-conflicted.d: Likewise.
83147                 * testsuite/ld-ctf/diag-cttname-null.d: Likewise.
83148                 * testsuite/ld-ctf/diag-cuname.d: Likewise.
83149                 * testsuite/ld-ctf/diag-parlabel.d: Likewise.
83150                 * testsuite/ld-ctf/enum-forward.d: Likewise.
83151                 * testsuite/ld-ctf/enums.d: Likewise.
83152                 * testsuite/ld-ctf/forward.d: Likewise.
83153                 * testsuite/ld-ctf/function.d: Likewise.
83154                 * testsuite/ld-ctf/nonrepresentable.d: Likewise.
83155                 * testsuite/ld-ctf/slice.d: Likewise.
83156                 * testsuite/ld-ctf/super-sub-cycles.d: Likewise.
83157
83158 2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83159
83160         binutils: make objdump/readelf --ctf-parent actually useful
83161         This option has been present since the very early days of the
83162         development of libctf as part of binutils, and it shows.  Back in the
83163         earliest days, I thought we might handle ambiguous types by introducing
83164         new ELF sections on the fly named things like .ctf.foo.c for ambiguous
83165         types found only in foo.c, etc.  This turned out to be a terrible idea,
83166         so we moved to using a CTF archive in the .ctf section which contained
83167         all the CTF dictionaries -- but the --ctf-parent option in objdump and
83168         readelf was never adjusted, and lingered as a mechanism to specify CTF
83169         parent dictionaries in sections other than .ctf, even though the linker
83170         has no way to produce parent dictionaries in different sections from
83171         their children, libctf's ctf_open can't handle such split-up
83172         parent/child dicts, and they are never found in the wild, emitted by GNU
83173         ld or by any known third-party linking tool.
83174
83175         Meanwhile, the actually-useful ctf_link feature (albeit not used by ld)
83176         which lets you remap the names of CTF archive members (so you can end up
83177         with a parent archive member named something other than ".ctf", still
83178         contained with all its children in a single .ctf section) had no support
83179         in objdump or readelf: there was no way to tell them that these members
83180         were parents, so all the types in the associated child dicts always
83181         appeared corrupted, referencing nonexistent types from a parent objdump
83182         couldn't find.
83183
83184         So adjust --ctf-parent so that rather than taking a section name it
83185         takes a member name instead (if not specified, the name is ".ctf", which
83186         is what GNU ld emits).  Because the option was always useless before
83187         now, this is expected to have no backward-compatibility implications.
83188
83189         As part of this, we have to slightly adjust the code which skips the
83190         archive member name if redundant: right now it skips it if it's ".ctf",
83191         on the assumption that this name will almost always be at the start
83192         of the objdump output and thus we'll end up with a shared dump
83193         and then smaller, headed dumps for the per-TU child dicts; but if
83194         the parent name has been changed, that won't be true any more.
83195
83196         So change the rules to "members named .ctf which appear first in the
83197         first have their member name skipped".  Since we now need to count
83198         members, move from ctf_archive_iter (for which passing in extra
83199         parameters requires defining a new struct and is clumsy) to
83200         ctf_archive_next, allowing us to just *call* dump_ctf_archive_member and
83201         maintain a member count in the obvious way.  In the process we fix a
83202         tiny difference between readelf and objdump: if a ctf_dump ever failed,
83203         readelf skipped every later member, while objdump tried to keep going as
83204         much as it could.  For a dumping tool the former is clearly preferable.
83205
83206         binutils/ChangeLog
83207         2021-10-25  Nick Alcock  <nick.alcock@oracle.com>
83208
83209                 * objdump.c (usage): --ctf-parent now takes a name, not a section.
83210                 (dump_ctf): Don't open a separate section; use the parent_name in
83211                 ctf_dict_open instead.  Use ctf_archive_next, not ctf_archive_iter,
83212                 so we can pass down a member count.
83213                 (dump_ctf_archive_member): Add the member count; don't return
83214                 anything.  Import parents into children no matter what the
83215                 parent's name, while still avoiding displaying the header for the
83216                 common parent name of ".ctf".
83217                 * readelf.c (usage): Adjust similarly.
83218                 (dump_section_as_ctf): Likewise.
83219                 (dump_ctf_archive_member): Likewise.  Never stop iterating over
83220                 archive members, even if ctf_dump of one member fails.
83221                 * doc/ctf.options.texi: Adjust.
83222
83223 2021-10-25  Alan Modra  <amodra@gmail.com>
83224
83225         objdump doesn't accept -L option
83226         A followup to commit ca0e11aa4b.
83227
83228                 * objdump.c (main): Add 'L' to short options and sort them.
83229
83230 2021-10-25  Alan Modra  <amodra@gmail.com>
83231
83232         bfd_nonfatal_message, localise va_start
83233         Nothing to see here, just a little tidier.
83234
83235                 * bucomm.c (bfd_nonfatal_message): Localise va_list args.
83236
83237 2021-10-25  Alan Modra  <amodra@gmail.com>
83238
83239         ubsan: _bfd_xcoff64_swap_aux_in left shift of negative value
83240                 * coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Use bfd_vma for h.
83241
83242         asan: evax_bfd_print_image buffer overflow
83243                 * vms-alpha.c (evax_bfd_print_image): Sanity check printing of
83244                 "image activator fixup" section.
83245                 (evax_bfd_print_relocation_records): Sanity check buffer offsets.
83246                 (evax_bfd_print_address_fixups): Likewise.
83247                 (evax_bfd_print_reference_fixups): Likewise.
83248
83249 2021-10-25  GDB Administrator  <gdbadmin@sourceware.org>
83250
83251         Automatic date update in version.in
83252
83253 2021-10-24  Alan Modra  <amodra@gmail.com>
83254
83255         asan: c4x, c54x coff_canonicalize_reloc buffer overflow
83256         Sometimes the investigation of a fuzzing bug report leads into areas
83257         you'd rather not go.  In this instance by the time I'd figured out the
83258         real cause was a target variant that had never been properly supported
83259         in binutils, the time needed to fix it was less than the time needed
83260         to rip it out.
83261
83262                 * coffcode.h (coff_set_alignment_hook): Call bfd_coff_swap_reloc_in
83263                 not coff_swap_reloc_in.
83264                 (coff_slurp_reloc_table): Likewise.  Don't use RELOC type.
83265                 (ticoff0_swap_table): Use coff_swap_reloc_v0_out and
83266                 coff_swap_reloc_v0_in.
83267                 * coffswap.h (coff_swap_reloc_v0_in, coff_swap_reloc_v0_out): New.
83268                 * coff-tic54x.c (tic54x_lookup_howto): Don't abort.
83269                 * coffgen.c (coff_get_normalized_symtab): Use PTR_ADD.
83270                 * bfd-in.h (PTR_ADD, NPTR_ADD): Avoid warnings when passing an
83271                 expression.
83272                 * bfd-in2.h: Regenerate.
83273
83274 2021-10-24  Alan Modra  <amodra@gmail.com>
83275
83276         asan: arm-darwin: buffer overflow
83277                 PR 21813
83278                 * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Sanity
83279                 check PAIR reloc in other branch of condition as was done for
83280                 PR21813.  Formatting.  Delete debug printf.
83281
83282         asan: aout: heap buffer overflow
83283                 * aoutx.h (aout_get_external_symbols): Sanity check before writing
83284                 zero index entry.  Remove outdated comment.
83285                 * pdp11.c (aout_get_external_symbols): Likewise.
83286
83287 2021-10-24  liuzhensong  <liuzhensong@loongson.cn>
83288
83289         LoongArch ld support
83290         2021-10-22  Chenghua Xu  <xuchenghua@loongson.cn>
83291                     Zhensong Liu  <liuzhensong@loongson.cn>
83292                     Weinan Liu  <liuweinan@loongson.cn>
83293                     Xiaolin Tang  <tangxiaolin@loongson.cn>
83294
83295         ld/
83296                 * Makefile.am: Add LoongArch.
83297                 * NEWS: Mention LoongArch support.
83298                 * configure.tgt: Add LoongArch.
83299                 * emulparams/elf32loongarch-defs.sh: New.
83300                 * emulparams/elf32loongarch.sh: Likewise.
83301                 * emulparams/elf64loongarch-defs.sh: Likewise.
83302                 * emulparams/elf64loongarch.sh: Likewise.
83303                 * emultempl/loongarchelf.em: Likewise.
83304                 * Makefile.in: Regenerate.
83305                 * po/BLD-POTFILES.in: Regenerate.
83306         ld/testsuite/
83307                 * ld-loongarch-elf/disas-jirl.d: New.
83308                 * ld-loongarch-elf/disas-jirl.s: Likewise.
83309                 * ld-loongarch-elf/jmp_op.d: Likewise.
83310                 * ld-loongarch-elf/jmp_op.s: Likewise.
83311                 * ld-loongarch-elf/ld-loongarch-elf.exp: Likewise.
83312                 * ld-loongarch-elf/macro_op.d: Likewise.
83313                 * ld-loongarch-elf/macro_op.s: Likewise.
83314                 * ld-loongarch-elf/syscall-0.s: Likewise.
83315                 * ld-loongarch-elf/syscall-1.s: Likewise.
83316                 * ld-loongarch-elf/syscall.d: Likewise.
83317                 * ld-srec/srec.exp: Add LoongArch.
83318                 * ld-unique/pr21529.d: Likewise.
83319
83320 2021-10-24  liuzhensong  <liuzhensong@loongson.cn>
83321
83322         LoongArch gas support
83323         2021-10-22  Chenghua Xu  <xuchenghua@loongson.cn>
83324                     Zhensong Liu  <liuzhensong@loongson.cn>
83325                     Weinan Liu  <liuweinan@loongson.cn>
83326                     Xiaolin Tang  <tangxiaolin@loongson.cn>
83327
83328         gas/
83329                 * Makefile.am: Add LoongArch.
83330                 * NEWS: Mention LoongArch support.
83331                 * config/loongarch-lex-wrapper.c: New.
83332                 * config/loongarch-lex.h: New.
83333                 * config/loongarch-lex.l: New.
83334                 * config/loongarch-parse.y: New.
83335                 * config/tc-loongarch.c: New.
83336                 * config/tc-loongarch.h: New.
83337                 * configure.ac: Add LoongArch.
83338                 * configure.tgt: Likewise.
83339                 * doc/as.texi: Likewise.
83340                 * doc/c-loongarch.texi: Likewise.
83341                 * Makefile.in: Regenerate.
83342                 * configure: Regenerate.
83343                 * po/POTFILES.in: Regenerate.
83344         gas/testsuite/
83345                 * gas/all/gas.exp: Add LoongArch.
83346                 * gas/elf/elf.exp: Likewise.
83347                 * gas/loongarch/4opt_op.d: New.
83348                 * gas/loongarch/4opt_op.s: Likewise.
83349                 * gas/loongarch/fix_op.d: Likewise.
83350                 * gas/loongarch/fix_op.s: Likewise.
83351                 * gas/loongarch/float_op.d: Likewise.
83352                 * gas/loongarch/float_op.s: Likewise.
83353                 * gas/loongarch/imm_op.d: Likewise.
83354                 * gas/loongarch/imm_op.s: Likewise.
83355                 * gas/loongarch/jmp_op.d: Likewise.
83356                 * gas/loongarch/jmp_op.s: Likewise.
83357                 * gas/loongarch/load_store_op.d: Likewise.
83358                 * gas/loongarch/load_store_op.s: Likewise.
83359                 * gas/loongarch/loongarch.exp: Likewise.
83360                 * gas/loongarch/macro_op.d: Likewise.
83361                 * gas/loongarch/macro_op.s: Likewise.
83362                 * gas/loongarch/nop.d: Likewise.
83363                 * gas/loongarch/nop.s: Likewise.
83364                 * gas/loongarch/privilege_op.d: Likewise.
83365                 * gas/loongarch/privilege_op.s: Likewise.
83366                 * gas/loongarch/syscall.d: Likewise.
83367                 * gas/loongarch/syscall.s: Likewise.
83368                 * lib/gas-defs.exp: Add LoongArch.
83369
83370 2021-10-24  liuzhensong  <liuzhensong@loongson.cn>
83371
83372         LoongArch binutils support
83373         2021-10-22  Chenghua Xu  <xuchenghua@loongson.cn>
83374                     Zhensong Liu  <liuzhensong@loongson.cn>
83375                     Weinan Liu  <liuweinan@loongson.cn>
83376         binutils/
83377                 * NEWS: Mention LoongArch support.
83378                 * readelf.c: Add LoongArch.
83379                 * testsuite/binutils-all/objdump.exp: Add LoongArch.
83380
83381 2021-10-24  liuzhensong  <liuzhensong@loongson.cn>
83382
83383         LoongArch opcodes support
83384         2021-10-22  Chenghua Xu  <xuchenghua@loongson.cn>
83385                     Zhensong Liu  <liuzhensong@loongson.cn>
83386                     Weinan Liu  <liuweinan@loongson.cn>
83387
83388         include/
83389                 * opcode/loongarch.h: New.
83390                 * dis-asm.h: Declare print_loongarch_disassembler_options.
83391         opcodes/
83392                 * Makefile.am: Add LoongArch.
83393                 * configure.ac: Likewise.
83394                 * disassemble.c: Likewise.
83395                 * disassemble.h: Declare print_insn_loongarch.
83396                 * loongarch-coder.c: New.
83397                 * loongarch-dis.c: New.
83398                 * loongarch-opc.c: New.
83399                 * Makefile.in: Regenerate.
83400                 * configure: Regenerate.
83401                 * po/POTFILES.in: Regenerate.
83402
83403 2021-10-24  liuzhensong  <liuzhensong@loongson.cn>
83404
83405         LoongArch bfd support
83406         2021-10-22  Chenghua Xu  <xuchenghua@loongson.cn>
83407                     Zhensong Liu  <liuzhensong@loongson.cn>
83408                     Weinan Liu  <liuweinan@loongson.cn>
83409         bfd/
83410                 * Makefile.am: Add LoongArch.
83411                 * archures.c: Likewise.
83412                 * config.bfd: Likewise.
83413                 * configure.ac: Likewise.
83414                 * cpu-loongarch.c: New.
83415                 * elf-bfd.h: Add LoongArch.
83416                 * elf.c: Add LoongArch elfcore_grok_xxx.
83417                 * elfnn-loongarch.c: New.
83418                 * elfxx-loongarch.c: New.
83419                 * elfxx-loongarch.h: New.
83420                 * reloc.c: Add LoongArch BFD RELOC ENUM.
83421                 * targets.c: Add LoongArch target.
83422                 * Makefile.in: Regenerate.
83423                 * bfd-in2.h: Regenerate.
83424                 * configure: Regenerate.
83425                 * libbfd.h: Regenerate.
83426                 * po/BLD-POTFILES.in: Regenerate.
83427                 * po/SRC-POTFILES.in: Regenerate.
83428
83429         include/
83430                 * elf/common.h: Add NT_LARCH_{CPUCFG,CSR,LSX,LASX}.
83431                 * elf/loongarch.h: New.
83432
83433 2021-10-24  GDB Administrator  <gdbadmin@sourceware.org>
83434
83435         Automatic date update in version.in
83436
83437 2021-10-23  GDB Administrator  <gdbadmin@sourceware.org>
83438
83439         Automatic date update in version.in
83440
83441 2021-10-22  H.J. Lu  <hjl.tools@gmail.com>
83442
83443         x86: Add -muse-unaligned-vector-move to assembler
83444         Unaligned load/store instructions on aligned memory or register are as
83445         fast as aligned load/store instructions on modern Intel processors.  Add
83446         a command-line option, -muse-unaligned-vector-move, to x86 assembler to
83447         encode encode aligned vector load/store instructions as unaligned
83448         vector load/store instructions.
83449
83450                 * NEWS: Mention -muse-unaligned-vector-move.
83451                 * config/tc-i386.c (use_unaligned_vector_move): New.
83452                 (encode_with_unaligned_vector_move): Likewise.
83453                 (md_assemble): Call encode_with_unaligned_vector_move for
83454                 -muse-unaligned-vector-move.
83455                 (OPTION_MUSE_UNALIGNED_VECTOR_MOVE): New.
83456                 (md_longopts): Add -muse-unaligned-vector-move.
83457                 (md_parse_option): Handle -muse-unaligned-vector-move.
83458                 (md_show_usage): Add -muse-unaligned-vector-move.
83459                 * doc/c-i386.texi: Document -muse-unaligned-vector-move.
83460                 * testsuite/gas/i386/i386.exp: Run unaligned-vector-move and
83461                 x86-64-unaligned-vector-move.
83462                 * testsuite/gas/i386/unaligned-vector-move.d: New file.
83463                 * testsuite/gas/i386/unaligned-vector-move.s: Likewise.
83464                 * testsuite/gas/i386/x86-64-unaligned-vector-move.d: Likewise.
83465
83466 2021-10-22  Tom Tromey  <tromey@adacore.com>
83467
83468         Fix 'uninstall' target
83469         This adds some missing code to the 'uninstall' targets in gdb and
83470         gdbserver.  It also changes gdb's uninstall target so that it no
83471         longer tries to remove any man page -- this is already done (and more
83472         correctly) by doc/Makefile.in.
83473
83474         I tested this with 'make install' followed by 'make uninstall', then
83475         examining the install tree for regular files.  Only the 'dir' file
83476         remains, but this appears to just be how 'install-info' is intended to
83477         work.
83478
83479 2021-10-22  Tom Tromey  <tromey@adacore.com>
83480
83481         Remove unused variables from gdbserver's Makefile
83482         This removes a number of unused variables from gdbserver's Makefile.
83483         I found these while working on the subsequent patches, and figured it
83484         would be cleaner to have a separate patch for the deletions.
83485
83486 2021-10-22  Tom de Vries  <tdevries@suse.de>
83487
83488         [gdb/testsuite] Fix gdb.threads/linux-dp.exp
83489         On openSUSE Tumbleweed with glibc-debuginfo installed I get:
83490         ...
83491          (gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print
83492          where^M
83493          #0  print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M
83494          #1  0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M
83495          #2  0x00007ffff7d56b37 in start_thread (arg=<optimized out>) \
83496                                   at pthread_create.c:435^M
83497          #3  0x00007ffff7ddb640 in clone3 () \
83498                                   at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81^M
83499          (gdb) PASS: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit
83500         ...
83501         while without debuginfo installed I get instead:
83502         ...
83503          (gdb) PASS: gdb.threads/linux-dp.exp: continue to breakpoint: thread 5's print
83504          where^M
83505          #0  print_philosopher (n=3, left=33 '!', right=33 '!') at linux-dp.c:105^M
83506          #1  0x0000000000401628 in philosopher (data=0x40537c) at linux-dp.c:148^M
83507          #2  0x00007ffff7d56b37 in start_thread () from /lib64/libc.so.6^M
83508          #3  0x00007ffff7ddb640 in clone3 () from /lib64/libc.so.6^M
83509          (gdb) FAIL: gdb.threads/linux-dp.exp: first thread-specific breakpoint hit
83510         ...
83511
83512         The problem is that the regexp used:
83513         ...
83514           "\(from .*libpthread\|at pthread_create\|in pthread_create\)"
83515         ...
83516         expects the 'from' part to match libpthread, but in glibc 2.34 libpthread has
83517         been merged into libc.
83518
83519         Fix this by updating the regexp.
83520
83521         Tested on x86_64-linux.
83522
83523 2021-10-22  Tom de Vries  <tdevries@suse.de>
83524
83525         [gdb/testsuite] Fix FAILs in gdb.mi/mi-breakpoint-changed.exp
83526         Since commit e36788d1354 "[gdb/testsuite] Fix handling of nr_args < 3 in
83527         mi_gdb_test" we run into:
83528         ...
83529         PASS: gdb.mi/mi-breakpoint-changed.exp: test_auto_disable: mi runto main
83530         Expecting: ^(-break-insert -f pendfunc1[^M
83531         ]+)?((&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-created,\
83532           bkpt=\{number="2",type="breakpoint".*\}.*\n\^done[^M
83533         ]+[(]gdb[)] ^M
83534         [ ]*)
83535         -break-insert -f pendfunc1^M
83536         ^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",\
83537           addr="0x00007ffff7bd559e",func="pendfunc1",\
83538           file="gdb/testsuite/gdb.mi/pendshr1.c",\
83539           fullname="gdb/testsuite/gdb.mi/pendshr1.c",line="21",thread-groups=["i1"],\
83540           times="0",original-location="pendfunc1"}^M
83541         (gdb) ^M
83542         FAIL: gdb.mi/mi-breakpoint-changed.exp: test_auto_disable: \
83543           -break-insert -f pendfunc1 (unexpected output)
83544         ...
83545
83546         The regexp expects a breakpoint-created event, but that's actually suppressed
83547         by the command:
83548         ...
83549         DEF_MI_CMD_MI_1 ("break-insert", mi_cmd_break_insert,
83550                            &mi_suppress_notification.breakpoint),
83551         ...
83552
83553         Fix this by updating the regexp.
83554
83555         Likewise for the following:
83556         ...
83557         PASS: gdb.mi/mi-breakpoint-changed.exp: test_auto_disable: \
83558           -break-insert -f pendfunc1
83559         Expecting: ^(-break-enable count 1 2[^M
83560         ]+)?(=breakpoint-modified,\
83561           bkpt=\{number="2",type="breakpoint",disp="dis",enabled="y".*\}.*\n\^done[^M
83562         ]+[(]gdb[)] ^M
83563         [ ]*)
83564         -break-enable count 1 2^M
83565         ^done^M
83566         (gdb) ^M
83567         FAIL: gdb.mi/mi-breakpoint-changed.exp: test_auto_disable: \
83568           -break-enable count 1 2 (unexpected out\
83569         put)
83570         ...
83571
83572         Tested on x86_64-linux.
83573
83574 2021-10-22  Andrew Burgess  <andrew.burgess@embecosm.com>
83575
83576         gdb/python: move gdb.Membuf support into a new file
83577         In a future commit I'm going to be creating gdb.Membuf objects from a
83578         new file within gdb/python/py*.c.  Currently all gdb.Membuf objects
83579         are created directly within infpy_read_memory (as a result of calling
83580         gdb.Inferior.read_memory()).
83581
83582         Initially I split out the Membuf creation code into a new function,
83583         and left the new function in gdb/python/py-inferior.c, however, it
83584         felt a little random that the Membuf creation code should live with
83585         the inferior handling code.
83586
83587         So, then I moved all of the Membuf related code out into a new file,
83588         gdb/python/py-membuf.c, the interface is gdbpy_buffer_to_membuf, which
83589         wraps an array of bytes into a gdb.Membuf object.
83590
83591         Most of the code is moved directly from py-inferior.c with only minor
83592         tweaks to layout and replacing NULL with nullptr, hence, I've left the
83593         copyright date on py-membuf.c as 2009-2021 to match py-inferior.c.
83594
83595         Currently, the only user of this code is still py-inferior.c, but in
83596         later commits this will change.
83597
83598         There should be no user visible changes after this commit.
83599
83600 2021-10-22  Andrew Burgess  <andrew.burgess@embecosm.com>
83601
83602         gdb/python: new gdb.architecture_names function
83603         Add a new function to the Python API, gdb.architecture_names().  This
83604         function returns a list containing all of the supported architecture
83605         names within the current build of GDB.
83606
83607         The values returned in this list are all of the possible values that
83608         can be returned from gdb.Architecture.name().
83609
83610 2021-10-22  Andrew Burgess  <andrew.burgess@embecosm.com>
83611
83612         gdb: make disassembler fprintf callback a static member function
83613         The disassemble_info structure has four callbacks, we have three of
83614         them as static member functions within gdb_disassembler, the fourth is
83615         just a global static function.
83616
83617         However, this fourth callback, is still only used from the
83618         disassemble_info struct, so there's no real reason for its special
83619         handling.
83620
83621         This commit makes fprintf_disasm a static method within
83622         gdb_disassembler.
83623
83624         There should be no user visible changes after this commit.
83625
83626 2021-10-22  Lewis Revill  <lewis.revill@embecosm.com>
83627
83628         RISC-V: Added ld testcase for pcgp relaxation.
83629         Consider the the pcgp-relax-02 testcase,
83630
83631                 .text
83632                 .globl _start
83633         _start:
83634         .L1:    auipc   a0, %pcrel_hi(data_a)
83635         .L2:    auipc   a1, %pcrel_hi(data_b)
83636                 addi    a0, a0, %pcrel_lo(.L1)
83637                 addi    a1, a1, %pcrel_lo(.L2)
83638
83639                 .data
83640                 .word 0x0
83641                 .globl data_a
83642         data_a:
83643                 .word 0x1
83644
83645                 .section .rodata
83646                 .globl data_b
83647         data_b:
83648                 .word 0x2
83649
83650         If the first auipc is deleted, but we are still building the pcgp
83651         table (connect the high and low pcrel relocations), then there is
83652         an aliasing issue that we need some way to disambiguate which of
83653         the two symbols we are targeting.  Therefore, Palmer thought of a
83654         way to use R_RISCV_DELETE to split this into two phases, so we
83655         could resolve the addresses before creating the ambiguities.
83656
83657         This patch just add the ld testcase for the above case, in case we
83658         have changed something but break this.
83659
83660         ld/
83661                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Renamed pcgp-relax
83662                 to pcgp-relax-01, and added pcgp-relax-02.
83663                 * testsuite/ld-riscv-elf/pcgp-relax-01.d: Renmaed from pcgp-relax.
83664                 * testsuite/ld-riscv-elf/pcgp-relax-01.s: Likewise.
83665                 * testsuite/ld-riscv-elf/pcgp-relax-02.d: New testcase.
83666                 * testsuite/ld-riscv-elf/pcgp-relax-02.s: Likewise.
83667
83668 2021-10-22  Lewis Revill  <lewis.revill@embecosm.com>
83669
83670         RISC-V: Don't separate pcgp relaxation to another relax pass.
83671         Commit abd20cb637008da9d32018b4b03973e119388a0a and
83672         ebdcad3fddf6ec21f6d4dcc702379a12718cf0c4 introduced additional
83673         complexity into the paths run by the RISC-V relaxation pass in order to
83674         resolve the issue of accurately keeping track of pcrel_hi and pcrel_lo
83675         pairs. The first commit split up relaxation of these relocs into a pass
83676         which occurred after other relaxations in order to prevent the situation
83677         where bytes were deleted in between a pcrel_lo/pcrel_hi pair, inhibiting
83678         our ability to find the corresponding pcrel_hi relocation from the
83679         address attached to the pcrel_lo.
83680
83681         Since the relaxation was split into two passes the 'again' parameter
83682         could not be used to perform the entire relaxation process again and so
83683         the second commit added a way to restart ldelf_map_segments, thus
83684         starting the whole process again.
83685
83686         Unfortunately this process could not account for the fact that we were
83687         not finished with the relaxation process so in some cases - such as the
83688         case where code would not fit in a memory region before the
83689         R_RISCV_ALIGN relocation was relaxed - sanity checks in generic code
83690         would fail.
83691
83692         This patch fixes all three of these concerns by reverting back to a
83693         system of having only one target relax pass but updating entries in the
83694         table of pcrel_hi/pcrel_lo relocs every time any bytes are deleted. Thus
83695         we can keep track of the pairs accurately, and we can use the 'again'
83696         parameter to restart the entire target relax pass, behaving in the way
83697         that generic code expects. Unfortunately we must still have an
83698         additional pass to delay deleting AUIPC bytes to avoid ambiguity between
83699         pcrel_hi relocs stored in the table after deletion. This pass can only
83700         be run once so we may potentially miss out on relaxation opportunities
83701         but this is likely to be rare.
83702
83703         https://sourceware.org/bugzilla/show_bug.cgi?id=28410
83704
83705         bfd/
83706                 * elfnn-riscv.c (riscv_elf_link_hash_table): Removed restart_relax.
83707                 (riscv_elf_link_hash_table_create): Updated.
83708                 (riscv_relax_delete_bytes): Moved after the riscv_update_pcgp_relocs.
83709                 Update the pcgp_relocs table whenever bytes are deleted.
83710                 (riscv_update_pcgp_relocs): Add function to update the section
83711                 offset of pcrel_hi and pcrel_lo, and also update the symbol value
83712                 of pcrel_hi.
83713                 (_bfd_riscv_relax_call): Need to update the pcgp_relocs table
83714                 when deleting codes.
83715                 (_bfd_riscv_relax_lui): Likewise.
83716                 (_bfd_riscv_relax_tls_le): Likewise.
83717                 (_bfd_riscv_relax_align): Once we've handled an R_RISCV_ALIGN,
83718                 we can't relax anything else, so set the sec->sec_flg0 to true.
83719                 Besides, we don't need to update the pcgp_relocs table at this
83720                 stage, so just pass NULL pointer as the pcgp_relocs table for
83721                 riscv_relax_delete_bytes.
83722                 (_bfd_riscv_relax_section): Use only one pass for all target
83723                 relaxations.
83724                 (_bfd_riscv_relax_delete): Likewise, we don't need to update
83725                 the pcgp_relocs table at this stage, and don't need to set
83726                 the `again' since restart_relax mechanism is abandoned.
83727                 (bfd_elfNN_riscv_restart_relax_sections): Removed.
83728                 (_bfd_riscv_relax_section): Updated.
83729                 * elfxx-riscv.h (bfd_elf32_riscv_restart_relax_sections): Removed.
83730                 (bfd_elf64_riscv_restart_relax_sections): Likewise.
83731         ld/
83732                 * emultempl/riscvelf.em: Revert restart_relax changes and set
83733                 relax_pass to 3.
83734                 * testsuite/ld-riscv-elf/align-small-region.d: New testcase.
83735                 * testsuite/ld-riscv-elf/align-small-region.ld: Likewise.
83736                 * testsuite/ld-riscv-elf/align-small-region.s: Likewise.
83737                 * testsuite/ld-riscv-elf/restart-relax.d: Removed sine the
83738                 restart_relax mechanism is abandoned.
83739                 * testsuite/ld-riscv-elf/restart-relax.s: Likewise.
83740                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
83741
83742 2021-10-22  Simon Marchi  <simon.marchi@polymtl.ca>
83743
83744         gdb: fix remote-sim.c build
83745         Commit 183be222907a ("gdb, gdbserver: make target_waitstatus safe")
83746         broke the remote-sim.c build.  In fact, it does some wrong changes,
83747         result of a bad sed invocation.
83748
83749         Fix it by adjusting the code to the new target_waitstatus API.
83750
83751         Change-Id: I3236ff7ef7681fc29215f68be210ff4263760e91
83752
83753 2021-10-22  GDB Administrator  <gdbadmin@sourceware.org>
83754
83755         Automatic date update in version.in
83756
83757 2021-10-21  Simon Marchi  <simon.marchi@efficios.com>
83758
83759         gdb, gdbserver: make target_waitstatus safe
83760         I stumbled on a bug caused by the fact that a code path read
83761         target_waitstatus::value::sig (expecting it to contain a gdb_signal
83762         value) while target_waitstatus::kind was TARGET_WAITKIND_FORKED.  This
83763         meant that the active union field was in fact
83764         target_waitstatus::value::related_pid, and contained a ptid.  The read
83765         signal value was therefore garbage, and that caused GDB to crash soon
83766         after.  Or, since that GDB was built with ubsan, this nice error
83767         message:
83768
83769             /home/simark/src/binutils-gdb/gdb/linux-nat.c:1271:12: runtime error: load of value 2686365, which is not a valid value for type 'gdb_signal'
83770
83771         Despite being a large-ish change, I think it would be nice to make
83772         target_waitstatus safe against that kind of bug.  As already done
83773         elsewhere (e.g. dynamic_prop), validate that the type of value read from
83774         the union matches what is supposed to be the active field.
83775
83776          - Make the kind and value of target_waitstatus private.
83777          - Make the kind initialized to TARGET_WAITKIND_IGNORE on
83778            target_waitstatus construction.  This is what most users appear to do
83779            explicitly.
83780          - Add setters, one for each kind.  Each setter takes as a parameter the
83781            data associated to that kind, if any.  This makes it impossible to
83782            forget to attach the associated data.
83783          - Add getters, one for each associated data type.  Each getter
83784            validates that the data type fetched by the user matches the wait
83785            status kind.
83786          - Change "integer" to "exit_status", "related_pid" to "child_ptid",
83787            just because that's more precise terminology.
83788          - Fix all users.
83789
83790         That last point is semi-mechanical.  There are a lot of obvious changes,
83791         but some less obvious ones.  For example, it's not possible to set the
83792         kind at some point and the associated data later, as some users did.
83793         But in any case, the intent of the code should not change in this patch.
83794
83795         This was tested on x86-64 Linux (unix, native-gdbserver and
83796         native-extended-gdbserver boards).  It was built-tested on x86-64
83797         FreeBSD, NetBSD, MinGW and macOS.  The rest of the changes to native
83798         files was done as a best effort.  If I forgot any place to update in
83799         these files, it should be easy to fix (unless the change happens to
83800         reveal an actual bug).
83801
83802         Change-Id: I0ae967df1ff6e28de78abbe3ac9b4b2ff4ad03b7
83803
83804 2021-10-21  Simon Marchi  <simon.marchi@polymtl.ca>
83805
83806         gdbserver: initialize the members of lwp_info in-class
83807         Add a constructor to initialize the waitstatus members.  Initialize the
83808         others in the class directly.
83809
83810         Change-Id: I10f885eb33adfae86e3c97b1e135335b540d7442
83811
83812 2021-10-21  Simon Marchi  <simon.marchi@polymtl.ca>
83813
83814         gdbserver: make thread_info non-POD
83815         Add a constructor and a destructor.  The constructor takes care of the
83816         initialization that happened in add_thread, while the destructor takes
83817         care of the freeing that happened in free_one_thread.  This is needed to
83818         make target_waitstatus non-POD, as thread_info contains a member of that
83819         type.
83820
83821         Change-Id: I1db321b4de9dd233ede0d5c101950f1d6f1d13b7
83822
83823 2021-10-21  Andrew Pinski  <apinski@marvell.com>
83824
83825         Fix ARMv8.4 for hw watchpoint and breakpoint
83826         Just like my previoius patch for ARMv8.1 and v8.2 (49ecef2a7da2ee9df4),
83827         this adds ARMv8.4 debug arch as being compatible for hw watchpoint
83828         and breakpoints.
83829
83830         Refactor code slightly in nat/aarch64-linux-hw-point.c (aarch64_linux_get_debug_reg_capacity)
83831         Since the two locations which check the debug arch are the same code currently, it is
83832         a good idea to factor it out to a new function and just use that function from
83833         aarch64_linux_get_debug_reg_capacity. This is also the first step to support
83834         ARMv8.4 debug arch.
83835
83836 2021-10-21  Carl Love  <cel@us.ibm.com>
83837
83838         Fixes for gdb.mi/mi-break.exp
83839         Update the expected pattern for two of the tests.
83840
83841         Matching pattern \" doesn't work.  Use .*  to match the \* pattern.
83842
83843 2021-10-21  Tom de Vries  <tdevries@suse.de>
83844
83845         [gdb/tui] Fix breakpoint display functionality
83846         In commit 81e6b8eb208 "Make tui-winsource not use breakpoint_chain", a loop
83847         body was transformed into a lambda function body:
83848         ...
83849         -      for (bp = breakpoint_chain;
83850         -           bp != NULL;
83851         -           bp = bp->next)
83852         +      iterate_over_breakpoints ([&] (breakpoint *bp) -> bool
83853         ...
83854         and consequently:
83855         - a continue was replaced by a return, and
83856         - a final return was added.
83857
83858         Then in commit 240edef62f0 "gdb: remove iterate_over_breakpoints function", we
83859         transformed back to a loop body:
83860         ...
83861         -      iterate_over_breakpoints ([&] (breakpoint *bp) -> bool
83862         +      for (breakpoint *bp : all_breakpoints ())
83863         ...
83864         but without reverting the changes that introduced the two returns.
83865
83866         Consequently, breakpoints no longer show up in the tui source window.
83867
83868         Fix this by reverting the changes that introduced the two returns.
83869
83870         Build on x86_64-linux, tested with all .exp test-cases that contain
83871         tuiterm_env.
83872
83873         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28483
83874
83875 2021-10-21  Carl Love  <cel@us.ibm.com>
83876
83877         Fix test step-and-next-inline.cc
83878         The test expect the runto_main to stop at the first line of the function.
83879         Depending on the optimization level, gdb may stop in the prolog or after
83880         the prolog at the first line.  To ensure the test stops at the first line
83881         of main, have it explicitly stop at a break point on the first line of the
83882         function.
83883
83884         On PowerPC, the test passes when compiled with no optimization but fails
83885         with all levels of optimization due to gdb stopping in the prolog.
83886
83887 2021-10-21  Tom Tromey  <tromey@adacore.com>
83888
83889         Fix latent Ada bug when accessing field offsets
83890         The "add accessors for field (and call site) location" patch caused a
83891         gdb crash when running the internal AdaCore testsuite.  This turned
83892         out to be a latent bug in ada-lang.c.
83893
83894         The immediate cause of the bug is that find_struct_field
83895         unconditionally uses TYPE_FIELD_BITPOS.  This causes an assert for a
83896         dynamic type.
83897
83898         This patch fixes the problem by doing two things.  First, it changes
83899         find_struct_field to use a dummy value for the field offset in the
83900         situation where the offset is not actually needed by the caller.  This
83901         works because the offset isn't used in any other way -- only as a
83902         result.
83903
83904         Second, this patch assures that calls to find_struct_field use a
83905         resolved type when the offset is needed.  For
83906         value_tag_from_contents_and_address, this is done by resolving the
83907         type explicitly.  In ada_value_struct_elt, this is done by passing
83908         nullptr for the out parameters when they are not needed (the second
83909         call in this function already uses a resolved type).
83910
83911         Note that, while we believe the parent field probably can't occur at a
83912         variable offset, the patch still updates this code path, just in case.
83913
83914         I've updated an existing test case to reproduce the crash.
83915         I'm checking this in.
83916
83917 2021-10-21  Alan Modra  <amodra@gmail.com>
83918
83919         -Waddress warning in ldelf.c
83920         ldelf.c: In function 'ldelf_after_open':
83921         ldelf.c:1049:43: warning: the comparison will always evaluate as 'true' for the address of 'elf_header' will never be NULL [-Waddress]
83922          1049 |           && elf_tdata (abfd)->elf_header != NULL
83923               |                                           ^~
83924         In file included from ldelf.c:37:
83925         ../bfd/elf-bfd.h:1957:21: note: 'elf_header' declared here
83926          1957 |   Elf_Internal_Ehdr elf_header[1];      /* Actual data, but ref like ptr */
83927
83928                 * ldelf.c (ldelf_after_open): Remove useless elf_header test.
83929
83930 2021-10-21  Alan Modra  <amodra@gmail.com>
83931
83932         Avoid -Waddress warnings in readelf
83933         Mainline gcc:
83934         readelf.c: In function 'find_section':
83935         readelf.c:349:8: error: the comparison will always evaluate as 'true' for the pointer operand in 'filedata->section_headers + (sizetype)((long unsigned int)i * 80)' must not be NULL [-Werror=address]
83936           349 |   ((X) != NULL                                                          \
83937               |        ^~
83938         readelf.c:761:9: note: in expansion of macro 'SECTION_NAME_VALID'
83939           761 |     if (SECTION_NAME_VALID (filedata->section_headers + i)
83940               |         ^~~~~~~~~~~~~~~~~~
83941
83942         This will likely be fixed in gcc, but inline functions are nicer than
83943         macros.
83944
83945                 * readelf.c (SECTION_NAME, SECTION_NAME_VALID),
83946                 (SECTION_NAME_PRINT, VALID_SYMBOL_NAME, VALID_DYNAMIC_NAME),
83947                 (GET_DYNAMIC_NAME): Delete.  Replace with..
83948                 (section_name, section_name_valid, section_name_print),
83949                 (valid_symbol_name, valid_dynamic_name, get_dynamic_name): ..these
83950                 new inline functions.  Update use throughout file.
83951
83952 2021-10-21  GDB Administrator  <gdbadmin@sourceware.org>
83953
83954         Automatic date update in version.in
83955
83956 2021-10-20  Alan Modra  <amodra@gmail.com>
83957
83958         PR28417, std::string no longer allows accepting nullptr_t
83959                 PR 28417
83960                 * incremental.cc (Sized_relobj_incr::do_section_name): Avoid
83961                 std:string undefined behaviour.
83962                 * options.h (Search_directory::Search_directory): Likewise.
83963
83964 2021-10-20  Alan Modra  <amodra@gmail.com>
83965
83966         Re: PR27625, powerpc64 gold __tls_get_addr calls
83967         My previous PR27625 patch had a problem or two.  For one, the error
83968         "__tls_get_addr call lacks marker reloc" on processing some calls
83969         before hitting a call without markers typically isn't seen.  Instead a
83970         gold assertion fails.  Either way it would be a hard error, which
83971         triggers on a file contained in libphobos.a when running the gcc
83972         testsuite.  A warning isn't even appropriate since the call involved
83973         is one built by hand without any of the arg setup relocations that
83974         might result in linker optimisation.
83975
83976         So this patch reverts most of commit 0af4fcc25dd5, instead entirely
83977         ignoring the problem of mis-optimising old-style __tls_get_addr calls
83978         without marker relocs.  We can't handle them gracefully without
83979         another pass over relocations before decisions are made about GOT
83980         entries in Scan::global or Scan::local.  That seems too costly, just
83981         to link object files from 2009.  What's more, there doesn't seem to be
83982         any way to allow the libphobos explicit __tls_get_addr call, but not
83983         old TLS sequences without marker relocs.  Examining instructions
83984         before the __tls_get_addr call is out of the question: program flow
83985         might reach the call via a branch.  Putting an R_PPC64_TLSGD marker
83986         with zero sym on the call might be a solution, but current linkers
83987         will then merrily optimise away the call!
83988
83989                 PR gold/27625
83990                 * powerpc.cc (Powerpc_relobj): Delete no_tls_marker_, tls_marker_,
83991                 and tls_opt_error_ variables and accessors.  Remove all uses.
83992
83993 2021-10-20  Tom Tromey  <tom@tromey.com>
83994
83995         Use std::string in print_one_catch_syscall
83996         This changes print_one_catch_syscall to use std::string, removing a
83997         bit of manual memory management.
83998
83999         Use unique_xmalloc_ptr in breakpoint
84000         This changes struct breakpoint to use unique_xmalloc_ptr in a couple
84001         of spots, removing a bit of manual memory management.
84002
84003         Use unique_xmalloc_ptr in bp_location
84004         This changes struct bp_location to use a unique_xmalloc_ptr, removing
84005         a bit of manual memory management.
84006
84007         Use unique_xmalloc_ptr in watchpoint
84008         This changes struct watchpoint to use unique_xmalloc_ptr in a couple
84009         of places, removing a bit of manual memory management.
84010
84011         Use unique_xmalloc_ptr in exec_catchpoint
84012         This changes struct exec_catchpoint to use a unique_xmalloc_ptr,
84013         removing a bit of manual memory management.
84014
84015         Use unique_xmalloc_ptr in solib_catchpoint
84016         This changes struct solib_catchpoint to use a unique_xmalloc_ptr,
84017         removing a bit of manual memory management.
84018
84019 2021-10-20  Christian Biesinger  <cbiesinger@google.com>
84020
84021         Make c-exp.y work with Bison 3.8+
84022         When using Bison 3.8, we get this error:
84023
84024             ../../gdb/c-exp.y:3455:1: error: 'void c_print_token(FILE*, int, YYSTYPE)' defined but not used [-Werror=unused-function]
84025
84026         That's because bison 3.8 removed YYPRINT support:
84027         https://savannah.gnu.org/forum/forum.php?forum_id=10047
84028
84029         Accordingly, this patch only defines that function for Bison < 3.8.
84030
84031         Change-Id: I3cbf2f317630bb72810b00f2d9b2c4b99fa812ad
84032
84033 2021-10-20  GDB Administrator  <gdbadmin@sourceware.org>
84034
84035         Automatic date update in version.in
84036
84037 2021-10-19  Tom de Vries  <tdevries@suse.de>
84038
84039         [gdb/testsuite] Reimplement gdb.gdb/python-interrupts.exp as unittest
84040         The test-case gdb.gdb/python-interrupts.exp:
84041         - runs to captured_command_loop
84042         - sets a breakpoint at set_active_ext_lang
84043         - calls a python command
84044         - verifies the command triggers the breakpoint
84045         - sends a signal and verifies the result
84046
84047         The test-case is fragile, because (f.i. with -flto) it cannot be guaranteed
84048         that captured_command_loop and set_active_ext_lang are available for setting
84049         breakpoints.
84050
84051         Reimplement the test-case as unittest, using:
84052         - execute_command_to_string to capture the output
84053         - try/catch to catch the "Error while executing Python code" exception
84054         - a new hook selftests::hook_set_active_ext_lang to raise the signal
84055
84056         Tested on x86_64-linux.
84057
84058 2021-10-19  Tom Tromey  <tromey@adacore.com>
84059
84060         Check index in type::field
84061         This changes gdb to check the index that is passed to type::field.
84062         This caught one bug in the Ada code when running the test suite
84063         (actually I found the bug first, then realized that the check would
84064         have helped), so this patch fixes that as well.
84065
84066         Regression tested on x86-64 Fedora 34.
84067
84068 2021-10-19  Tom Tromey  <tromey@adacore.com>
84069
84070         Fix Rust lex selftest when using libiconv
84071         The Rust lex selftest fails on our Windows build.  I tracked this down
84072         to a use of UTF-32 as a parameter to convert_between_encodings.  Here,
84073         iconv_open succeeds, but the actual conversion of a tab character
84074         fails with EILSEQ.  I suspect that "UTF-32" is being interpreted as
84075         big-endian, as changing the call to use "UTF-32LE" makes it work.
84076         This patch implements this fix.
84077
84078 2021-10-19  Tom Tromey  <tromey@adacore.com>
84079
84080         Fix format_pieces selftest on Windows
84081         The format_pieces selftest currently fails on Windows hosts.
84082
84083         The selftest doesn't handle the "%ll" -> "%I64" rewrite that the
84084         formatter may perform, but also gdbsupport was missing a configure
84085         check for PRINTF_HAS_LONG_LONG.  This patch fixes both issues.
84086
84087 2021-10-19  Tom Tromey  <tromey@adacore.com>
84088
84089         Fix bug in dynamic type resolution
84090         A customer-reported problem led us to a bug in dynamic type
84091         resolution.  resolve_dynamic_struct will recursively call
84092         resolve_dynamic_type_internal, passing it the sub-object for the
84093         particular field being resolved.  While it offsets the address here,
84094         it does not also offset the "valaddr" -- the array of bytes describing
84095         the memory.
84096
84097         This patch fixes the bug, by offsetting both.  A test case is included
84098         that can be used to reproduce the bug.
84099
84100 2021-10-19  Tom Tromey  <tromey@adacore.com>
84101
84102         Always use std::function for self-tests
84103         Now that there is a register_test variant that accepts std::function,
84104         it seems to me that the 'selftest' struct and accompanying code is
84105         obsolete -- simply always using std::function is simpler.  This patch
84106         implements this idea.
84107
84108 2021-10-19  Daniel Black  <daniel@mariadb.org>
84109
84110         Fix PR gdb/17917 Lookup build-id in remote binaries
84111         GDB doesn't support loading debug files using build-id from remote
84112         target filesystems.
84113
84114         This is the case when gdbserver attached to a process and a gdb target
84115         remote occurs over tcp.
84116
84117         With this change we make build-id lookups possible:
84118
84119             (gdb) show debug-file-directory
84120             The directory where separate debug symbols are searched for is "/usr/local/lib/debug".
84121             (gdb) set debug-file-directory /usr/lib/debug
84122             (gdb) show sysroot
84123             The current system root is "target:".
84124             (gdb) target extended-remote :46615
84125             Remote debugging using :46615
84126             warning: Can not parse XML target description; XML support was disabled at compile time
84127             Reading /usr/sbin/mariadbd from remote target...
84128             warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
84129             Reading /usr/sbin/mariadbd from remote target...
84130             Reading symbols from target:/usr/sbin/mariadbd...
84131             Reading /usr/lib/debug/.build-id/6e/0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84132             Reading /usr/lib/debug/.build-id/6e/0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84133             Reading symbols from target:/usr/lib/debug/.build-id/6e/0a874dca5a7ff831396ddc0785d939a192efe3.debug...
84134             Reading /lib/x86_64-linux-gnu/libpcre2-8.so.0 from remote target...
84135             ...
84136
84137         Before this change, the lookups would have been (GNU gdb (GDB) Fedora 10.2-3.fc34):
84138
84139             (gdb) target extended-remote :46615
84140             Remote debugging using :46615
84141             Reading /usr/sbin/mariadbd from remote target...
84142             warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
84143             Reading /usr/sbin/mariadbd from remote target...
84144             Reading symbols from target:/usr/sbin/mariadbd...
84145             Reading /usr/sbin/0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84146             Reading /usr/sbin/.debug/0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84147             Reading /usr/lib/debug//usr/sbin/0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84148             Reading /usr/lib/debug/usr/sbin//0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84149             Reading target:/usr/lib/debug/usr/sbin//0a874dca5a7ff831396ddc0785d939a192efe3.debug from remote target...
84150             Missing separate debuginfo for target:/usr/sbin/mariadbd
84151             Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/6e/0a874dca5a7ff831396ddc0785d939a192efe3.debug
84152             (No debugging symbols found in target:/usr/sbin/mariadbd)
84153
84154         Observe it didn't look for
84155         /usr/lib/debug/.build-id/6e/0a874dca5a7ff831396ddc0785d939a192efe3.debug
84156         on the remote target (where it is) and expected them to be installed
84157         locally.
84158
84159         As a minor optimization, this also changes the build-id lookup such that
84160         if sysroot is empty, no second lookup of the same location is performed.
84161
84162         Change-Id: I5181696d271c325a25a0805a8defb8ab7f9b3f55
84163         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17917
84164
84165 2021-10-19  Nick Clifton  <nickc@redhat.com>
84166
84167         Fix a potential illegal memory access when testing for a special LTO symbol name.
84168         bfd     * linker.c (_bfd_generic_link_add_one_symbol): Test for a NULL
84169                 name before checking to see if the symbol is __gnu_lto_slim.
84170                 * archive.c (_bfd_compute_and_write_armap): Likewise.
84171         binutils
84172                 * nm.c (filter_symbols): Test for a NULL name before checking to
84173                 see if the symbol is __gnu_lto_slim.
84174                 * objcopy.c (filter_symbols): Likewise.
84175
84176 2021-10-19  GDB Administrator  <gdbadmin@sourceware.org>
84177
84178         Automatic date update in version.in
84179
84180 2021-10-18  Weimin Pan  <weimin.pan@oracle.com>
84181
84182         CTF: incorrect underlying type setting for enumeration types
84183         A bug was filed against the incorrect underlying type setting for
84184         an enumeration type, which was caused by a copy and paste error.
84185         This patch fixes the problem by setting it by calling objfile_int_type,
84186         which was originally dwarf2_per_objfile::int_type, with ctf_type_size bits.
84187         Also add error checking on ctf_func_type_info call.
84188
84189 2021-10-18  GDB Administrator  <gdbadmin@sourceware.org>
84190
84191         Automatic date update in version.in
84192
84193 2021-10-17  Alan Modra  <amodra@gmail.com>
84194
84195         PR28459, readelf issues bogus warning
84196         I'd missed the fact that the .debug_rnglists dump doesn't exactly
84197         display the contents of the section.  Instead readelf rummages through
84198         .debug_info looking for DW_AT_ranges entries, then displays the
84199         entries in .debug_rnglists pointed at, sorted.  A simpler dump of the
84200         actual section contents might be more useful and robust, but it was
84201         likely done that way to detect overlap and holes.
84202
84203         Anyway, the headers in .debug_rnglists besides the first are ignored,
84204         and limiting to the unit length of the first header fails if there is
84205         more than one unit.
84206
84207                 PR 28459
84208                 * dwarf.c (display_debug_ranges): Don't constrain data to length
84209                 in header.
84210
84211 2021-10-17  GDB Administrator  <gdbadmin@sourceware.org>
84212
84213         Automatic date update in version.in
84214
84215 2021-10-16  H.J. Lu  <hjl.tools@gmail.com>
84216
84217         ld: Adjust pr28158.rd for glibc 2.34
84218         Adjust pr28158.rd for glibc 2.34:
84219
84220         $ readelf -W --dyn-syms tmpdir/pr28158
84221
84222         Symbol table '.dynsym' contains 4 entries:
84223            Num:    Value          Size Type    Bind   Vis      Ndx Name
84224              0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
84225              1: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@GLIBC_2.34 (2)
84226              2: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
84227              3: 000000000040401c     4 OBJECT  GLOBAL DEFAULT   23 foo@VERS_2.0 (3)
84228         $
84229
84230         vs older glibc:
84231
84232         $ readelf -W --dyn-syms tmpdir/pr28158
84233
84234         Symbol table '.dynsym' contains 4 entries:
84235            Num:    Value          Size Type    Bind   Vis      Ndx Name
84236              0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
84237              1: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@GLIBC_2.2.5 (3)
84238              2: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
84239              3: 000000000040401c     4 OBJECT  GLOBAL DEFAULT   23 foo@VERS_2.0 (2)
84240
84241         $
84242
84243                 * testsuite/ld-elf/pr28158.rd: Adjusted for glibc 2.34.
84244
84245 2021-10-16  GDB Administrator  <gdbadmin@sourceware.org>
84246
84247         Automatic date update in version.in
84248
84249 2021-10-15  GDB Administrator  <gdbadmin@sourceware.org>
84250
84251         Automatic date update in version.in
84252
84253 2021-10-14  Carl Love  <cel@us.ibm.com>
84254
84255         Powerpc: Add support for openat and fstatat syscalls
84256         [gdb] update ppc-linux-tdep.c
84257
84258         Add argument to ppc_canonicalize_syscall for the wordsize.
84259         Add syscall entries for the openat and fstatat system calls.
84260
84261 2021-10-14  Tom de Vries  <tdevries@suse.de>
84262
84263         [gdb/testsuite] Add .debug_loc support in dwarf assembler
84264         Add .debug_loc support in the dwarf assembler, and use it in new test-case
84265         gdb.dwarf2/loc-sec-offset.exp (which is based on
84266         gdb.dwarf2/loclists-sec-offset.exp).
84267
84268         Tested on x86_64-linux.
84269
84270 2021-10-14  Alan Modra  <amodra@gmail.com>
84271
84272         [GOLD] Re: PowerPC64: Don't pretend to support multi-toc
84273         We can't get at section->address() until everything is laid out, so
84274         trying to generalise the offset calculation rather than using a value
84275         of 0x8000 (the old object->toc_base_offset()) was bound to fail.
84276         got->g_o_t() is a little better than a hard-coded 0x8000.
84277
84278                 * powerpc.cc (Target_powerpc::Scan::local, global): Don't use
84279                 toc_pointer() here.
84280
84281 2021-10-14  Alan Modra  <amodra@gmail.com>
84282
84283         [GOLD] Two GOT sections for PowerPC64
84284         Split .got into two piece, one with the header and entries for small
84285         model got entries, the other with entries for medium/large model got
84286         entries.  The idea is to better support mixed pcrel/non-pcrel code
84287         where non-pcrel small-model .toc entries need to be within 32k of the
84288         toc pointer.
84289
84290                 * target.h (Target::tls_offset_for_local): Add got param.
84291                 (Target::tls_offset_for_global): Likewise.
84292                 (Target::do_tls_offset_for_local, do_tls_offset_for_global): Likewise.
84293                 * output.h (Output_data_got::Got_entry::write): Add got param.
84294                 * output.cc (Output_data_got::Got_entry::write): Likewise, pass to
84295                 tls_offset_for_local/global calls.
84296                 (Output_data_got::do_write): Adjust to suit.
84297                 * s390.cc (Target_s390::do_tls_offset_for_local): Likewise.
84298                 (Target_s390::do_tls_offset_for_global): Likewise.
84299                 * powerpc.cc (enum Got_type): Extend with small types, move from
84300                 class Target_powerpc.
84301                 (Target_powerpc::biggot_): New.
84302                 (Traget_powerpc::do_tls_offset_for_local, do_tls_offset_for_global,
84303                 got_size, got_section, got_base_offset): Handle biggot_.
84304                 (Target_powerpc::do_define_standard_symbols): Adjust.
84305                 (Target_powerpc::make_plt_section, do_finalize_sections): Likewise.
84306                 (Output_data_got_powerpc::Output_data_got_powerpc): Only make
84307                 64-bit header for small got section.
84308                 (Output_data_got_powerpc::g_o_t): Only return a result for small
84309                 got section.
84310                 (Output_data_got_powerpc::write): Only write small got section
84311                 header.
84312                 (Target_powerpc::Scan::local, global): Select small/big Got_type
84313                 and section to suit reloc.
84314                 (Target_powerpc::Relocate::relocate): Similarly.
84315                 (Sort_toc_sections): Rewrite.
84316
84317 2021-10-14  Alan Modra  <amodra@gmail.com>
84318
84319         [GOLD] PowerPC64: Don't pretend to support multi-toc
84320         Code in powerpc.cc is pretending to support a per-object toc pointer
84321         value, but powerpc gold has no real support for multi-toc.  This patch
84322         removes the pretense, tidying quite a lot in preparation for a
84323         followup patch.  If multi-toc is ever to be supported, don't revert
84324         this patch but start by adding object parameter to toc_pointer() and
84325         an object to Branch_stub_key.
84326
84327                 * powerpc.cc (Powerpc_relobj::toc_base_offset): Delete.
84328                 (Target_powerpc::toc_pointer): New function.  Use throughout.
84329                 (Target_powerpc::got_base_offset): New function.  Use throughout..
84330                 (Output_data_got_powerpc::got_base_offset): ..in place of
84331                 this.  Delete.
84332                 (Output_data_got_powerpc::Output_data_got_powerpc): Init
84333                 header_index_ to -1u for 64-bit, and make header here.
84334                 (Output_data_got_powerpc::set_final_data_size, reserve_ent): Don't
84335                 make 64-bit header here.
84336                 (Output_data_got_powerpc::g_o_t): Return toc pointer offset in
84337                 section for 64-bit.  Use throughout.
84338                 (Stub_table): Remove toc_base_off_ from Branch_stub_key, and
84339                 object param on add_long_branch_entry and find_long_branch_entry.
84340                 Adjust all uses.
84341
84342 2021-10-14  Alan Modra  <amodra@gmail.com>
84343
84344         Re: s12z/disassembler: call memory_error_func when appropriate
84345         Adjust for commit ba7c18a48457.
84346
84347                 * testsuite/gas/s12z/truncated.d: Update expected output.
84348
84349 2021-10-14  GDB Administrator  <gdbadmin@sourceware.org>
84350
84351         Automatic date update in version.in
84352
84353 2021-10-13  Tom de Vries  <tdevries@suse.de>
84354
84355         [gdb/exp] Improve <error reading variable> message
84356         When printing a variable x in a subroutine foo:
84357         ...
84358         subroutine foo (x)
84359           integer(4) :: x (*)
84360           x(3) = 1
84361         end subroutine foo
84362         ...
84363         where x is an array with unknown bounds, we get:
84364         ...
84365         $ gdb -q -batch outputs/gdb.fortran/array-no-bounds/array-no-bounds \
84366           -ex "break foo" \
84367           -ex run \
84368           -ex "print x"
84369         Breakpoint 1 at 0x4005cf: file array-no-bounds.f90, line 18.
84370
84371         Breakpoint 1, foo (x=...) at array-no-bounds.f90:18
84372         18        x(3) = 1
84373         $1 = <error reading variable>
84374         ...
84375
84376         Improve the error message by printing the details of the error, such that we
84377         have instead:
84378         ...
84379         $1 = <error reading variable: failed to get range bounds>
84380         ...
84381
84382         This is a change in gdb/valprint.c, and grepping through the sources reveals
84383         that this is a common pattern.
84384
84385         Tested on x86_64-linux.
84386
84387 2021-10-13  Carl Love  <cel@us.ibm.com>
84388
84389         PPC fix for stfiwx instruction (and additional stores with primary opcode of 31)
84390         [gdb] Fix address being recorded in rs6000-tdep.c, ppc_process_record_op31.
84391
84392         The GDB record function was recording the variable addr that was passed in
84393         rather than the calculated effective address (ea) by the
84394         ppc_process_record_op31 function.
84395
84396 2021-10-13  Andrew Burgess  <andrew.burgess@embecosm.com>
84397
84398         gdb: improve error reporting from the disassembler
84399         If the libopcodes disassembler returns a negative value then this
84400         indicates that the disassembly failed for some reason.  In disas.c, in
84401         the function gdb_disassembler::print_insn we can see how this is
84402         handled; when we get a negative value back, we call the memory_error
84403         function, which throws an exception.
84404
84405         The problem here is that the address used in the memory_error call is
84406         gdb_disassembler::m_err_memaddr, which is set in
84407         gdb_disassembler::dis_asm_memory_error, which is called from within
84408         the libopcodes disassembler through the
84409         disassembler_info::memory_error_func callback.
84410
84411         However, for this to work correctly, every time the libopcodes
84412         disassembler returns a negative value, the libopcodes disassembler
84413         must have first called the memory_error_func callback.
84414
84415         My first plan was to make m_err_memaddr a gdb::optional, and assert
84416         that it always had a value prior to calling memory_error, however, a
84417         quick look in opcodes/*-dis.c shows that there _are_ cases where a
84418         negative value is returned without first calling the memory_error_func
84419         callback, for example in arc-dis.c and cris-dis.c.
84420
84421         Now, I think that a good argument can be made that these disassemblers
84422         must therefore be broken, except for the case where we can't read
84423         memory, we should always be able to disassemble the memory contents to
84424         _something_, even if it's just '.word 0x....'.  However, I certainly
84425         don't plan to go and fix all of the disassemblers.
84426
84427         What I do propose to do then, is make m_err_memaddr a gdb::optional,
84428         but now, instead of always calling memory_error, I add a new path
84429         which just calls error complaining about an unknown error.  This new
84430         path is only used if m_err_memaddr doesn't have a value (indicating
84431         that the memory_error_func callback was not called).
84432
84433         To test this I just augmented one of the disassemblers to always
84434         return -1, before this patch I see this:
84435
84436           Dump of assembler code for function main:
84437              0x000101aa <+0>:   Cannot access memory at address 0x0
84438
84439         And after this commit I now see:
84440
84441           Dump of assembler code for function main:
84442              0x000101aa <+0>:   unknown disassembler error (error = -1)
84443
84444         This doesn't really help much, but that's because there's no way to
84445         report non memory errors out of the disasembler, because, it was not
84446         expected that the disassembler would ever report non memory errors.
84447
84448 2021-10-13  Tom de Vries  <tdevries@suse.de>
84449
84450         [gdb/testsuite] Fix gdb.fortran/call-no-debug.exp with native-gdbserver
84451         When running test-case gdb.fortran/call-no-debug.exp with target board
84452         native-gdbserver, I run into:
84453         ...
84454         (gdb) PASS: gdb.fortran/call-no-debug.exp: print string_func_ (&'abcdefg', 3)
84455         call (integer) string_func_ (&'abcdefg', 3)^M
84456         $2 = 0^M
84457         (gdb) FAIL: gdb.fortran/call-no-debug.exp: call (integer) string_func_ (&'abcdefg', 3)
84458         ...
84459
84460         The problem is that gdb_test is used to match inferior output.
84461
84462         Fix this by using gdb_test_stdio.
84463
84464         Tested on x86_64-linux.
84465
84466 2021-10-13  Tom de Vries  <tdevries@suse.de>
84467
84468         [gdb/testsuite] Require use_gdb_stub == 0 where appropriate
84469         When running with target board native-gdbserver, we run into a number of FAILs
84470         due to use of the start command (and similar), which is not supported when
84471         use_gdb_stub == 1.
84472
84473         Fix this by:
84474         - requiring use_gdb_stub == 0 for the entire test-case, or
84475         - guarding some tests in the test-case with use_gdb_stub == 0.
84476
84477         Tested on x86_64-linux.
84478
84479 2021-10-13  Tom de Vries  <tdevries@suse.de>
84480
84481         [gdb/testsuite] Fix test name in gdb.python/python.exp
84482         When running test-case gdb.python/python.exp, we have:
84483         ...
84484         PASS: gdb.python/python.exp: starti via gdb.execute, not from tty
84485         PASS: gdb.python/python.exp: starti via interactive input
84486         ...
84487
84488         The two tests are instances of the same test, with different values for
84489         starti command argument from_tty, so it's strange that the test names are so
84490         different.
84491
84492         This is due to using a gdb_test nested in a gdb_test_multiple, with the inner
84493         one using a different test name than the outer one.  [ That could still make
84494         sense if both produced passes, but that's not the case here. ]
84495
84496         Fix this by using $gdb_test_name, such that we have:
84497         ...
84498         PASS: gdb.python/python.exp: starti via gdb.execute, not from tty
84499         PASS: gdb.python/python.exp: starti via gdb.execute, from tty
84500         ...
84501
84502         Also make this more readable by using variables.
84503
84504         Tested on x86_64-linux.
84505
84506 2021-10-13  Tom de Vries  <tdevries@suse.de>
84507
84508         [gdb/testsuite] Fix gdb.base/batch-exit-status.exp with native-gdbserver
84509         When running test-case gdb.base/batch-exit-status.exp with target board
84510         native-gdbserver, I run into (added missing double quotes for clarity):
84511         ...
84512         builtin_spawn $build/gdb/testsuite/../../gdb/gdb -nw -nx \
84513           -data-directory $build/gdb/testsuite/../data-directory \
84514           -iex "set height 0" -iex "set width 0" \
84515           -ex "set auto-connect-native-target off" \
84516           -iex "set sysroot" -batch ""^M
84517         : No such file or directory.^M
84518         PASS: gdb.base/batch-exit-status.exp: 1x: \
84519           No such file or directory: [lindex $result 2] == 0
84520         FAIL: gdb.base/batch-exit-status.exp: 1x: \
84521           No such file or directory: [lindex $result 3] == $expect_status
84522         ...
84523
84524         As in commit a02a90c114c "[gdb/testsuite] Set sysroot earlier in
84525         local-board.exp", the problem is the use of -ex for
84526         "set auto-connect-native-target off", which makes that the last command to
84527         be executed, and consequently determines the return status.
84528
84529         Fix this by using -iex instead.
84530
84531         Tested on x86_64-linux.
84532
84533 2021-10-13  Tom de Vries  <tdevries@suse.de>
84534
84535         [gdb/testsuite] Remove quit in gdb.arch/i386-mpx.exp
84536         When running test-case gdb.arch/i386-mpx.exp with target board
84537         native-gdbserver, I run into:
84538         ...
84539         (gdb) PASS: gdb.arch/i386-mpx.exp: verify size for bnd0
84540         Remote debugging from host ::1, port 42328^M
84541         quit^M
84542         A debugging session is active.^M
84543         ^M
84544                 Inferior 1 [process 19679] will be killed.^M
84545         ^M
84546         Quit anyway? (y or n) monitor exit^M
84547         Please answer y or n.^M
84548         A debugging session is active.^M
84549         ^M
84550                 Inferior 1 [process 19679] will be killed.^M
84551         ^M
84552         Quit anyway? (y or n) WARNING: Timed out waiting for EOF in server after monitor exit
84553         ...
84554
84555         The problem is that the test-case sends a quit at the end (without verifying
84556         the result of this in any way):
84557         ...
84558         send_gdb "quit\n"
84559         ...
84560
84561         Fix this by removing the quit.
84562
84563         Tested on x86_64-linux.
84564
84565 2021-10-13  GDB Administrator  <gdbadmin@sourceware.org>
84566
84567         Automatic date update in version.in
84568
84569 2021-10-12  GDB Administrator  <gdbadmin@sourceware.org>
84570
84571         Automatic date update in version.in
84572
84573 2021-10-11  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>
84574
84575         [ARM] Add support for M-profile MVE extension
84576         This patch adds support for the M-profile MVE extension, which includes the
84577         following:
84578
84579         - New M-profile XML feature m-profile-mve
84580         - MVE vector predication status and control register (VPR)
84581         - p0 pseudo register (contained in the VPR)
84582         - q0 ~ q7 pseudo vector registers
84583         - New feature bits
84584         - Documentation update
84585
84586         Pseudo register p0 is the least significant bits of vpr and can be accessed
84587         as $p0 or displayed through $vpr.  For more information about the register
84588         layout, please refer to [1].
84589
84590         The q0 ~ q7 registers map back to the d0 ~ d15 registers, two d registers
84591         per q register.
84592
84593         The register dump looks like this:
84594
84595         (gdb) info reg all
84596         r0             0x0                 0
84597         r1             0x0                 0
84598         r2             0x0                 0
84599         r3             0x0                 0
84600         r4             0x0                 0
84601         r5             0x0                 0
84602         r6             0x0                 0
84603         r7             0x0                 0
84604         r8             0x0                 0
84605         r9             0x0                 0
84606         r10            0x0                 0
84607         r11            0x0                 0
84608         r12            0x0                 0
84609         sp             0x0                 0x0 <__Vectors>
84610         lr             0xffffffff          -1
84611         pc             0xd0c               0xd0c <Reset_Handler>
84612         xpsr           0x1000000           16777216
84613         d0             0                   (raw 0x0000000000000000)
84614         d1             0                   (raw 0x0000000000000000)
84615         d2             0                   (raw 0x0000000000000000)
84616         d3             0                   (raw 0x0000000000000000)
84617         d4             0                   (raw 0x0000000000000000)
84618         d5             0                   (raw 0x0000000000000000)
84619         d6             0                   (raw 0x0000000000000000)
84620         d7             0                   (raw 0x0000000000000000)
84621         d8             0                   (raw 0x0000000000000000)
84622         d9             0                   (raw 0x0000000000000000)
84623         d10            0                   (raw 0x0000000000000000)
84624         d11            0                   (raw 0x0000000000000000)
84625         d12            0                   (raw 0x0000000000000000)
84626         d13            0                   (raw 0x0000000000000000)
84627         d14            0                   (raw 0x0000000000000000)
84628         d15            0                   (raw 0x0000000000000000)
84629         fpscr          0x0                 0
84630         vpr            0x0                 [ P0=0 MASK01=0 MASK23=0 ]
84631         s0             0                   (raw 0x00000000)
84632         s1             0                   (raw 0x00000000)
84633         s2             0                   (raw 0x00000000)
84634         s3             0                   (raw 0x00000000)
84635         s4             0                   (raw 0x00000000)
84636         s5             0                   (raw 0x00000000)
84637         s6             0                   (raw 0x00000000)
84638         s7             0                   (raw 0x00000000)
84639         s8             0                   (raw 0x00000000)
84640         s9             0                   (raw 0x00000000)
84641         s10            0                   (raw 0x00000000)
84642         s11            0                   (raw 0x00000000)
84643         s12            0                   (raw 0x00000000)
84644         s13            0                   (raw 0x00000000)
84645         s14            0                   (raw 0x00000000)
84646         s15            0                   (raw 0x00000000)
84647         s16            0                   (raw 0x00000000)
84648         s17            0                   (raw 0x00000000)
84649         s18            0                   (raw 0x00000000)
84650         s19            0                   (raw 0x00000000)
84651         s20            0                   (raw 0x00000000)
84652         s21            0                   (raw 0x00000000)
84653         s22            0                   (raw 0x00000000)
84654         s23            0                   (raw 0x00000000)
84655         s24            0                   (raw 0x00000000)
84656         s25            0                   (raw 0x00000000)
84657         s26            0                   (raw 0x00000000)
84658         s27            0                   (raw 0x00000000)
84659         s28            0                   (raw 0x00000000)
84660         s29            0                   (raw 0x00000000)
84661         s30            0                   (raw 0x00000000)
84662         s31            0                   (raw 0x00000000)
84663         q0             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84664         q1             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84665         q2             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84666         q3             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84667         q4             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84668         q5             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84669         q6             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84670         q7             {u8 = {0x0 <repeats 16 times>}, u16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u32 = {0x0, 0x0, 0x0, 0x0}, u64 = {0x0, 0x0}, f32 = {0x0, 0x0, 0x0, 0x0}, f64 = {0x0, 0x0}}
84671         p0             0x0                 0
84672
84673         Built and regtested with a simulator.
84674
84675         [1] https://developer.arm.com/documentation/ddi0553/bn
84676
84677         Co-Authored-By: Luis Machado <luis.machado@linaro.org>
84678
84679 2021-10-11  Luis Machado  <luis.machado@linaro.org>
84680
84681         [ARM] Refactor pseudo register numbering
84682         The pseudo register handling for ARM uses some hardcoded constants to
84683         determine types and names.  In preparation to the upcoming MVE support
84684         patch (that will add another pseudo register), this patch refactors and
84685         reorganizes things in order to simplify handling of future pseudo registers.
84686
84687         We keep track of the first pseudo register number in a group and the number of
84688         pseudo registers in that group.
84689
84690         Right now we only have the S and Q pseudo registers.
84691
84692 2021-10-11  Luis Machado  <luis.machado@linaro.org>
84693
84694         [ARM] Small refactoring of arm gdbarch initialization
84695         This is in preparation to MVE support, where we will define another
84696         pseudo register. We need to define the pseudo register numbers *after*
84697         accounting for all the registers in the XML description, so move
84698         the call to tdesc_use_registers up.
84699
84700         If we don't do it, GDB's register count won't consider registers contained
84701         in the XML but ignored by GDB, throwing the register numbering off.
84702
84703 2021-10-11  Luis Machado  <luis.machado@linaro.org>
84704
84705         [ARM] Refactor some constants
84706         In preparation for the MVE extension patch, this one refactors some of
84707         the register-related constants we have for ARM.
84708
84709         Basically I'm separating counting constants from numbering constants.
84710
84711         For example, ARM_A1_REGNUM is a numbering constant, whereas ARM_NUM_ARG_REGS
84712         is a counting constant.
84713
84714 2021-10-11  Tom de Vries  <tdevries@suse.de>
84715
84716         [gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp
84717         When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed
84718         (with glibc 2.34) I run into:
84719         ...
84720         (gdb) ^M
84721         PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array
84722         Expecting: ^(-var-create array \* array[^M
84723         ]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M
84724         ]+[(]gdb[)] ^M
84725         [ ]*)
84726         -var-create array * array^M
84727         &"Attempt to use a type name as an expression.\n"^M
84728         ^error,msg="-var-create: unable to create variable object"^M
84729         (gdb) ^M
84730         FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output)
84731         ...
84732
84733         The problem is that the name array is used both:
84734         - as the name for a local variable
84735         - as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included
84736           by nss/nss_files/files-hosts.c.
84737
84738         Fix this by ignoring the shared lib symbols.
84739
84740         Likewise in a couple of other fortran tests.
84741
84742         Tested on x86_64-linux.
84743
84744 2021-10-11  Andrew Burgess  <andrew.burgess@embecosm.com>
84745
84746         z80/disassembler: call memory_error_func when appropriate
84747         If a call to the read_memory_func fails then we should call the
84748         memory_error_func to notify the user of the disassembler of the
84749         address that was a problem.
84750
84751         Without this GDB will report all memory errors as being at address
84752         0x0.
84753
84754         opcodes/ChangeLog:
84755
84756                 * z80-dis.c (fetch_data): Call memory_error_func if the
84757                 read_memory_func call fails.
84758
84759 2021-10-11  Andrew Burgess  <andrew.burgess@embecosm.com>
84760
84761         s12z/disassembler: call memory_error_func when appropriate
84762         If a call to the read_memory_func fails then we should call the
84763         memory_error_func to notify the user of the disassembler of the
84764         address that was a problem.
84765
84766         Without this GDB will report all memory errors as being at address
84767         0x0.
84768
84769         opcodes/ChangeLog:
84770
84771                 * s12z-disc.c (abstract_read_memory): Call memory_error_func if
84772                 the read_memory_func call fails.
84773
84774 2021-10-11  Tom de Vries  <tdevries@suse.de>
84775
84776         [gdb/testsuite] Fix double debug info in gdb.dwarf2/dw2-ref-missing-frame.exp
84777         A mistake slipped in in commit a5ea23036d8 "[gdb/testsuite] Use function_range
84778         in gdb.dwarf2/dw2-ref-missing-frame.exp".
84779
84780         Before the commit the main file was compiled with debug info, and the two
84781         others not:
84782         ...
84783         if {[prepare_for_testing_full "failed to prepare" \
84784                 [list $testfile {} $srcfile {} $srcfuncfile {} \
84785                      $srcmainfile debug]]} {
84786         ...
84787
84788         After the commit, all were compiled with debug info, and consequently, there
84789         are two versions of debug info for $srcfuncfile.  This shows up as a FAIL when
84790         running the test-case with target boards readnow and cc-with-debug-names.
84791
84792         Fix this by using prepare_for_testing_full, as before.
84793
84794         Tested on x86_64-linux.
84795
84796         Fixes: a5ea23036d8 ("[gdb/testsuite] Use function_range in
84797                gdb.dwarf2/dw2-ref-missing-frame.exp")
84798
84799 2021-10-11  Tom de Vries  <tdevries@suse.de>
84800
84801         [gdb/testsuite] Use require for ensure_gdb_index
84802         Replace:
84803         ...
84804         if { [ensure_gdb_index $binfile] == -1 } {
84805             return -1
84806         }
84807         ...
84808         with:
84809         ...
84810         require {ensure_gdb_index $binfile} != -1
84811         ...
84812         and consequently, add a missing UNTESTED message.
84813
84814         Tested on x86_64-linux, both with native and target board readnow.
84815
84816 2021-10-11  Tom de Vries  <tdevries@suse.de>
84817
84818         [gdb/testsuite] Handle readnow in ensure_gdb_index
84819         When running test-case gdb.base/with-mf.exp with target board readnow, I run
84820         into:
84821         ...
84822         FAIL: gdb.base/with-mf.exp: check if index present
84823         ...
84824         This is since commit 6010fb0c49e "[gdb/testsuite] Fix full buffer in
84825         gdb.rust/dwindex.exp".
84826
84827         Before that commit, the proc ensure_gdb_index would treat the line:
84828         ...
84829         .gdb_index: faked for "readnow"^M
84830         ...
84831         as proof that an index is already present (which is incorrect).
84832
84833         Now, instead it generates aforementioned FAIL and continues to generate an
84834         index.
84835
84836         Fix this by explicitly handling the readnow case in proc ensure_gdb_index,
84837         such that we bail out instead.
84838
84839         Tested on x86_64-linux.
84840
84841 2021-10-11  Tom de Vries  <tdevries@suse.de>
84842
84843         [gdb/testsuite] Fix gdb.dwarf2/gdb-add-index-symlink.exp
84844         The test-case gdb.dwarf2/gdb-add-index-symlink.exp interpretes a failure to
84845         add an index as a failure to add an index for a symlink:
84846         ...
84847         if { [ensure_gdb_index $symlink] == -1 } {
84848             fail "Unable to call gdb-add-index with a symlink to a symfile"
84849             return -1
84850         }
84851         ...
84852
84853         However, it's possible that the gdb-add-index also fails with a regular
84854         file.  Add a check for that situation.
84855
84856         Tested on x86_64-linux.
84857
84858 2021-10-11  Tom de Vries  <tdevries@suse.de>
84859
84860         [gdb/testsuite] Add proc require in lib/gdb.exp
84861         Add a new proc require in lib/gdb.exp, and use it to shorten:
84862         ...
84863         if { [gdb_skip_xml_test] } {
84864             # Valgrind gdbserver requires gdb with xml support.
84865             untested "missing xml support"
84866             return 0
84867         }
84868         ...
84869         into:
84870         ...
84871         require gdb_skip_xml_test 0
84872         ...
84873
84874         Tested on x86_64-linux, both with and without a trigger patch that forces
84875         gdb_skip_xml_test to return 1.
84876
84877 2021-10-11  Michael Forney  <mforney@mforney.org>
84878
84879         bfd: Remove use of void pointer arithmetic
84880         This is not valid in ISO C. Instead, use a pointer to bfd_byte.
84881
84882                 * peicode.h (pe_bfd_object_p): Remove use of void pointer
84883                 arithmetic.
84884
84885 2021-10-11  GDB Administrator  <gdbadmin@sourceware.org>
84886
84887         Automatic date update in version.in
84888
84889 2021-10-10  GDB Administrator  <gdbadmin@sourceware.org>
84890
84891         Automatic date update in version.in
84892
84893 2021-10-09  Tom de Vries  <tdevries@suse.de>
84894
84895         [gdb] Make execute_command_to_string return string on throw
84896         The pattern for using execute_command_to_string is:
84897         ...
84898           std::string output;
84899           output = execute_fn_to_string (fn, term_out);
84900         ...
84901
84902         This results in a problem when using it in a try/catch:
84903         ...
84904           try
84905             {
84906               output = execute_fn_to_string (fn, term_out)
84907             }
84908           catch (const gdb_exception &e)
84909             {
84910               /* Use output.  */
84911             }
84912         ...
84913
84914         If an expection was thrown during execute_fn_to_string, then the output
84915         remains unassigned, while it could be worthwhile to known what output was
84916         generated by gdb before the expection was thrown.
84917
84918         Fix this by returning the string using a parameter instead:
84919         ...
84920           execute_fn_to_string (output, fn, term_out)
84921         ...
84922
84923         Also add a variant without string parameter, to support places where the
84924         function is used while ignoring the result:
84925         ...
84926           execute_fn_to_string (fn, term_out)
84927         ...
84928
84929         Tested on x86_64-linux.
84930
84931 2021-10-09  Tom de Vries  <tdevries@suse.de>
84932
84933         [gdb/testsuite] Add check-readmore
84934         Consider the gdb output:
84935         ...
84936         27        return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
84937         (gdb) ^M
84938         Thread 2 "run-attach-whil" stopped.^M
84939         ...
84940
84941         When trying to match the gdb prompt using gdb_test which uses '$gdb_prompt $',
84942         it may pass or fail.
84943
84944         This sort of thing needs to be fixed (see commit b0e2f96b56b), but there's
84945         currently no way to reliably find this type of FAILs.
84946
84947         We have check-read1, but that one actually make the test pass reliably.
84948
84949         We need something like the opposite of check-read1: something that makes
84950         expect read a bit slower, or more exhaustively.
84951
84952         Add a new test target check-readmore that implements this.
84953
84954         There are two methods of implementing this in read1.c:
84955         - the first method waits a bit before doing a read
84956         - the second method does a read and then decides whether to
84957           return or to wait a bit and do another read, and so on.
84958
84959         The second method is potentially faster, has less risc of timeout and could
84960         potentially detect more problems.  The first method has a simpler
84961         implementation.
84962
84963         The second method is enabled by default.  The default waiting period is 10
84964         miliseconds.
84965
84966         The first method can be enabled using:
84967         ...
84968         $ export READMORE_METHOD=1
84969         ...
84970         and the waiting period can be specified in miliseconds using:
84971         ...
84972         $ export READMORE_SLEEP=9
84973         ...
84974
84975         Also a log file can be specified using:
84976         ...
84977         $ export READMORE_LOG=$(pwd -P)/LOG
84978         ...
84979
84980         Tested on x86_64-linux.
84981
84982         Testing with check-readmore showed these regressions:
84983         ...
84984         FAIL: gdb.base/bp-cmds-continue-ctrl-c.exp: run: stop with control-c (continue)
84985         FAIL: gdb.base/bp-cmds-continue-ctrl-c.exp: attach: stop with control-c (continue)
84986         ...
84987
84988         I have not been able to find a problem in the test-case, and I think it's the
84989         nature of both the test-case and readmore that makes it run longer.  Make
84990         these pass by increasing the alarm timeout from 60 to 120 seconds.
84991
84992         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27957
84993
84994 2021-10-09  Tom de Vries  <tdevries@suse.de>
84995
84996         [gdb/testsuite] Fix fortran module tests with stressed cpu
84997         When running these test-cases:
84998         - gdb.fortran/info-modules.exp
84999         - gdb.fortran/module.exp
85000         - gdb.mi/mi-fortran-modules.exp
85001         in conjunction with:
85002         ...
85003         $ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
85004         ...
85005         I run into timeouts.
85006
85007         Fix this by using:
85008         - "set auto-solib-add off" to avoid symbols of shared libs
85009           (which doesn't work for libc, now that libpthread_name_p has been
85010           updated to  match libc)
85011         - "nosharedlibrary" to avoid symbols of libc
85012
85013         Tested on x86_64-linux.
85014
85015         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28133
85016
85017 2021-10-09  Guillermo E. Martinez  <guillermo.e.martinez@oracle.com>
85018
85019         PR28415, invalid read in xtensa_read_table_entries
85020                 PR 28415
85021                 PR 28416
85022                 * elf32-xtensa.c (xtensa_read_table_entries): Handle error
85023                 return from retrieve_contents.
85024
85025 2021-10-09  GDB Administrator  <gdbadmin@sourceware.org>
85026
85027         Automatic date update in version.in
85028
85029 2021-10-08  Tom de Vries  <tdevries@suse.de>
85030
85031         [gdb/testsuite] Fix gdb.base/info-types-c++.exp with stressed cpu
85032         When running test-case gdb.base/info-types-c++.exp in conjunction with:
85033         ...
85034         $ stress -c $(($(cat /proc/cpuinfo | grep -c "^processor") + 1))
85035         ...
85036         we get:
85037         ...
85038         FAIL: gdb.base/info-types-c++.exp: info types (timeout)
85039         ...
85040
85041         Fix this by setting auto-solib-add to off.
85042
85043         Tested on x86_64-linux.
85044
85045 2021-10-08  Tom de Vries  <tdevries@suse.de>
85046
85047         [gdb/testsuite] Fix gdb.base/info_sources_2.exp with check-read1
85048         When running test-case gdb.base/info_sources_2.exp with check-read1, I run
85049         into:
85050         ...
85051         FAIL: gdb.base/info_sources_2.exp: args: : info sources  (timeout)
85052         ...
85053
85054         Fix this by consuming a "$src1, $src2, ..., $srcn: line bit by bit rather than
85055         as one whole line.
85056
85057         Also add the missing handling of "Objfile has no debug information".
85058
85059         Tested on x86_64-linux.
85060
85061 2021-10-08  Tom de Vries  <tdevries@suse.de>
85062
85063         [gdb/testsuite] Fix gdb.mi/gdb2549.exp with check-read1
85064         When running test-case gdb.mi/gdb2549.exp with check-read1, I run into:
85065         ...
85066         FAIL: gdb.mi/gdb2549.exp: register values x (timeout)
85067         ...
85068
85069         Fix this by applying the same fix as for "register values t" in commit
85070         478e490a4df "[gdb/testsuite] Fix gdb.mi/gdb2549.exp with check-read1".
85071
85072         Tested on x86_64-linux.
85073
85074 2021-10-08  Tom de Vries  <tdevries@suse.de>
85075
85076         [gdb/testsuite] Fix gdb.base/bt-on-error-and-warning.exp with check-read1
85077         When running test-case gdb.base/bt-on-error-and-warning.exp with check-read1,
85078         I run into:
85079         ...
85080         (gdb) maint internal-error foobar^M
85081         src/gdb/maint.c:82: internal-error: foobar^M
85082         A problem internal to GDB has been detectedFAIL: \
85083           gdb.base/bt-on-error-and-warning.exp: problem=internal-error, mode=on: \
85084           scan for backtrace (GDB internal error)
85085         Resyncing due to internal error.
85086         ,^M
85087         ...
85088
85089         The corresponding gdb_test_multiple in the test-case contains:
85090         ...
85091                    -early -re "^A problem internal to GDB has been detected,\r\n" {
85092                        incr header_lines
85093                        exp_continue
85094                    }
85095         ...
85096         but instead this one triggers in gdb_test_multiple:
85097         ...
85098                 -re ".*A problem internal to GDB has been detected" {
85099                     fail "$message (GDB internal error)"
85100                     gdb_internal_error_resync
85101                     set result -1
85102                 }
85103         ...
85104
85105         Fix this by likewise shortening the regexp to before the comma.
85106
85107         Tested on x86_64-linux.
85108
85109 2021-10-08  Tom de Vries  <tdevries@suse.de>
85110
85111         [gdb/testsuite] Add nopie in two test-cases
85112         When running test-case gdb.dwarf2/dw2-restrict.exp on openSUSE Leap 15.2 with
85113         gcc-PIE installed (switching compiler default to -fPIE/-pie), I get:
85114         ...
85115         gdb compile failed, ld: outputs/gdb.dwarf2/dw2-restrict/dw2-restrict0.o: \
85116           warning: relocation in read-only section `.text'
85117         ld: warning: creating DT_TEXTREL in a PIE
85118         UNTESTED: gdb.dwarf2/dw2-restrict.exp: failed to prepare
85119         ...
85120
85121         This is due to using a hardcoded .S file that was generated with -fno-PIE.
85122
85123         Fix this by adding the missing nopie.
85124
85125         Likewise in gdb.arch/amd64-tailcall-noret.exp.
85126
85127         Tested on x86_64-linux.
85128
85129 2021-10-08  GDB Administrator  <gdbadmin@sourceware.org>
85130
85131         Automatic date update in version.in
85132
85133 2021-10-07  Tom de Vries  <tdevries@suse.de>
85134
85135         [gdb/testsuite] Fix gdb.threads/check-libthread-db.exp with glibc 2.34
85136         When running test-case gdb.threads/check-libthread-db.exp on openSUSE
85137         Tumbleweed (with glibc 2.34) I get:
85138         ...
85139         (gdb) continue^M
85140         Continuing.^M
85141         [Thread debugging using libthread_db enabled]^M
85142         Using host libthread_db library "/lib64/libthread_db.so.1".^M
85143         Stopped due to shared library event:^M
85144           Inferior loaded /lib64/libm.so.6^M
85145             /lib64/libc.so.6^M
85146         (gdb) FAIL: gdb.threads/check-libthread-db.exp: user-initiated check: continue
85147         ...
85148
85149         The check expect the inferior to load libpthread, but since glibc 2.34
85150         libpthread has been integrated into glibc, and consequently it's no longer
85151         a dependency:
85152         ...
85153         $ ldd outputs/gdb.threads/check-libthread-db/check-libthread-db
85154                 linux-vdso.so.1 (0x00007ffe4cae4000)
85155                 libm.so.6 => /lib64/libm.so.6 (0x00007f167c77c000)
85156                 libc.so.6 => /lib64/libc.so.6 (0x00007f167c572000)
85157                 /lib64/ld-linux-x86-64.so.2 (0x00007f167c86e000)
85158         ...
85159
85160         Fix this by updating the regexp to expect libpthread or libc.
85161
85162         Tested on x86_64-linux.
85163
85164 2021-10-07  Tom de Vries  <tdevries@suse.de>
85165
85166         [gdb/testsuite] Fix gdb.guile/scm-type.exp with gcc 4.8
85167         With gcc 7.5.0, I get:
85168         ...
85169         (gdb) guile (print (type-range (field-type (type-field (value-type \
85170           (value-dereference f)) "items"))))^M
85171         = (0 0)^M
85172         (gdb) PASS: gdb.guile/scm-type.exp: lang_cpp: test_range: \
85173           on flexible array member: $cmd
85174         ...
85175         but with gcc 4.8.5, I get instead:
85176         ...
85177         (gdb) guile (print (type-range (field-type (type-field (value-type \
85178           (value-dereference f)) "items"))))^M
85179         = (0 -1)^M
85180         (gdb) FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: \
85181           on flexible array member: $cmd
85182         ...
85183
85184         There's a difference in debug info.  With gcc 4.8.5, we have:
85185         ...
85186          <2><224>: Abbrev Number: 15 (DW_TAG_member)
85187             <225>   DW_AT_name        : items
85188             <22b>   DW_AT_type        : <0x231>
85189          <1><231>: Abbrev Number: 4 (DW_TAG_array_type)
85190             <232>   DW_AT_type        : <0x105>
85191          <2><23a>: Abbrev Number: 16 (DW_TAG_subrange_type)
85192             <23b>   DW_AT_type        : <0x11a>
85193             <23f>   DW_AT_upper_bound : 0xffffffffffffffff
85194         ...
85195         and with gcc 7.5.0, we have instead:
85196         ...
85197          <2><89f>: Abbrev Number: 12 (DW_TAG_member)
85198             <8a0>   DW_AT_name        : items
85199             <8a6>   DW_AT_type        : <0x8ac>
85200          <1><8ac>: Abbrev Number: 17 (DW_TAG_array_type)
85201             <8ad>   DW_AT_type        : <0x29d>
85202          <2><8b5>: Abbrev Number: 41 (DW_TAG_subrange_type)
85203          <2><8b6>: Abbrev Number: 0
85204         ...
85205
85206         As mentioned in commit 858c8f2c1b9 "gdb/testsuite: adjust
85207         gdb.python/flexible-array-member.exp expected pattern":
85208         ...
85209         Ideally, GDB would present a consistent and documented value for an
85210         array member declared with size 0, regardless of how the debug info
85211         looks like.
85212         ...
85213
85214         As in gdb.python/flexible-array-member.exp, change the test to accept the two
85215         values.
85216
85217         Tested on x86_64-linux.
85218
85219 2021-10-07  Simon Marchi  <simon.marchi@polymtl.ca>
85220
85221         gdb: add accessors for field (and call site) location
85222         Add accessors for the various location values in struct field.  This
85223         lets us assert that when we get a location value of a certain kind (say,
85224         bitpos), the field's location indeed contains a value of that kind.
85225
85226         Remove the SET_FIELD_* macros, instead use the new setters directly.
85227         Update the FIELD_* macros used to access field locations to go through
85228         the getters.  They will be removed in a subsequent patch.
85229
85230         There are places where the FIELD_* macros are used on call_site_target
85231         structures, because it contains members of the same name (loc_kind and
85232         loc).  For now, I have replicated the getters/setters in
85233         call_site_target.  But we could perhaps eventually factor them in a
85234         "location" structure that can be used at both places.
85235
85236         Note that the field structure, being zero-initialized, defaults to a
85237         bitpos location with value 0.  While writing this patch, I tried to make
85238         it default to an "unset" location, to catch places where we would miss
85239         setting a field's location.  However, I found that some places relied on
85240         the default being "bitpos 0", so I left it as-is.  This change could
85241         always be done as follow-up work, making these places explicitly set the
85242         "bitpos 0" location.
85243
85244         I found two issues to fix:
85245
85246          - I got some failures in the gdb.base/infcall-nested-structs-c++.exp
85247            test.  They were caused by two functions in amd64-tdep.c using
85248            TYPE_FIELD_BITPOS before checking if the location is of the bitpos
85249            kind, which they do indirectly through `field_is_static`.  Simply
85250            move getting the bitpos below the field_is_static call.
85251
85252          - I got a failure in gdb.xml/tdesc-regs.exp.  It turns out that in
85253            make_gdb_type_enum, we set enum field values using SET_FIELD_BITPOS,
85254            and later access them through FIELD_ENUMVAL.  Fix that by using
85255            set_loc_enumval to set the value.
85256
85257         Change-Id: I53d3734916c46457576ba11dd77df4049d2fc1e8
85258
85259 2021-10-07  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85260
85261         RISC-V: Support aliases for Zbs instructions
85262         Add aliases for the non-immediate mnemonics of b{set,clr,inv,ext} to
85263         yencode the respective immediate insn b{set,clr,inv,ext}i when the
85264         second source operand is an immediate.
85265
85266         2021-01-11  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85267
85268             gas/
85269                 * testsuite/gas/riscv/b-ext.d: Add tests.
85270                 * testsuite/gas/riscv/b-ext.s: Likewise.
85271                 * testsuite/gas/riscv/b-ext-64.d: Likewise.
85272                 * testsuite/gas/riscv/b-ext-64.s: Likewise.
85273             opcodes/
85274                 * riscv-opc.c (riscv_opcodes): Add aliases for Zbs.
85275
85276         Suggested-by: Jan Beulich <jbeulich@suse.com>
85277
85278 2021-10-07  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85279
85280         RISC-V: Add support for Zbs instructions
85281         This change adds the Zbs instructions from the Zbs 1.0.0 specification.
85282         See
85283           https://github.com/riscv/riscv-bitmanip/releases/tag/1.0.0
85284         for the frozen specification.
85285
85286         2021-01-09  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85287
85288             bfd/
85289                 * elfxx-riscv.c (riscv_supported_std_z_ext): Added zbs.
85290             gas/
85291                 * config/tc-riscv.c (riscv_multi_subset_supports): Handle INSN_CLASS_ZBS.
85292                 * testsuite/gas/riscv/b-ext.d: Test Zbs instructions.
85293                 * testsuite/gas/riscv/b-ext.s: Likewise.
85294                 * testsuite/gas/riscv/b-ext-64.d: Likewise.
85295                 * testsuite/gas/riscv/b-ext-64.s: Likewise.
85296             include/
85297                 * opcode/riscv-opc.h: Added MASK/MATCH/DECLARE_INSN for Zbs.
85298                 * opcode/riscv.h (riscv_insn_class): Added INSN_CLASS_ZBS.
85299             opcodes/
85300                 * riscv-opc.c (riscv_supported_std_z_ext): Add zbs.
85301
85302 2021-10-07  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85303
85304         RISC-V: Update extension version for Zb[abc] to 1.0.0
85305         2021-10-06  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85306
85307             bfd/
85308                 * elfxx-riscv.c (riscv_supported_std_z_ext): Update the version
85309                 number for zba, zbb and zbc to 1.0.0
85310
85311
85312         Version-changes: 3
85313         - Updated version numbers for zba, zbb and zbc to 1.0.0
85314
85315 2021-10-07  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85316
85317         RISC-V: Split Zb[abc] into commented sections
85318         The Zb[abc] opcodes are bundled just below the Privileged opcodes in
85319         riscv_opcodes, possibly giving the appearance that they are part of
85320         the Privileged spec for an uninitiated reader.  This separates them
85321         out and adds comments above each section to clearly identify them as
85322         Zba, Zbb or Zbc opcodes.
85323
85324         2021-10-04  Philipp Tomsich  <philipp.tomsich@vrull.eu>
85325
85326             opcodes/
85327                 * riscv-opc.c: Split of Zb[abc] instructions and add comments.
85328
85329 2021-10-07  Alan Modra  <amodra@gmail.com>
85330
85331         PR28423, use-after-free in objdump
85332         XCOFF archives use a bi-directional linked list for file members.  So
85333         one member points to both the previous member and the next member.
85334         Members may not be sequentially ordered in the file.  This of course
85335         is over-engineered nonsense and an attractive target for fuzzers.
85336         (There is even a free list of members!)  The testcase in PR28423 is an
85337         XCOFF archive with one member pointing to itself, which results in
85338         lots of bad behaviour.  For example, "ar t" never terminates.
85339
85340         The use-after-free with "objdump -r" happens like this:  The first
85341         archive element is opened, its symbols are read and "canonicalized"
85342         for objdump, then relocations are read and printed.  Those relocations
85343         use the canonicalized symbols, and also happen to be cached by the
85344         coff bfd backend support.  objdump frees the symbols.  The next
85345         archive element is then opened.  This must be done before the first
85346         element is closed, because finding the next element uses data held in
85347         the currect element.  Unfortunately the next element happens to be the
85348         original, so we aren't opening, we're reopening a bfd which has cached
85349         data.  When the relocations are printed they use the cached copy
85350         containing references to the freed canonical symbols.
85351
85352         This patch adds a little sanity checking to the XCOFF "open next
85353         archive file" support, so that it rejects archive members pointing at
85354         themselves.  That is sufficient to cure this problem.  Anything more
85355         is overkill.  If someone deliberately fuzzes an XCOFF archive with an
85356         element loop then reports an "ar" bug when it runs forever, they will
85357         find their bug report closed WONTFIX.
85358
85359                 PR 28423
85360                 * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Save size occupied
85361                 by member name in areltdata.extra_size.
85362                 (_bfd_xcoff_openr_next_archived_file): Sanity check nextoff.
85363                 * coff64-rs6000.c (xcoff64_openr_next_archived_file): Call
85364                 _bfd_xcoff_openr_next_archived_file.
85365
85366 2021-10-07  Alan Modra  <amodra@gmail.com>
85367
85368         PR28422, build_id use-after-free
85369         This fixes a bug in commit 5d9bbb73c1df.  All fields preserved from a
85370         bfd in struct bfd_preserve need to be cleared in bfd_reinit.
85371
85372                 PR 28422
85373                 * format.c (bfd_reinit): Clear build_id.
85374
85375 2021-10-07  Alan Modra  <amodra@gmail.com>
85376
85377         Change ridiculous section size error
85378         Rather than reporting "memory exhausted", report "file truncated".
85379         You can hit this error on small fuzzed object files, or on files that
85380         are actually truncated.  In either case sizes can be such that an out
85381         of memory error is a little confusing.
85382
85383                 * compress.c (bfd_get_full_section_contents): Set
85384                 bfd_error_file_truncated rather than bfd_error_no_memory when
85385                 section size exceeds file size.
85386
85387 2021-10-07  Tom de Vries  <tdevries@suse.de>
85388
85389         [gdb/testsuite] Fix FAIL in gdb.base/annota1.exp
85390         On openSUSE tumbleweed I run into:
85391         ...
85392         FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
85393         ...
85394         due to a message related to libthread_db:
85395         ...
85396         ^Z^Zstarting^M
85397         [Thread debugging using libthread_db enabled]^M
85398         Using host libthread_db library "/lib64/libthread_db.so.1".^M
85399         ^M
85400         ^Z^Zframes-invalid^M
85401         ...
85402         which is not matched by the regexp.
85403
85404         Fix this by updating the regexp.
85405
85406         Tested on x86_64-linux.
85407
85408 2021-10-07  Tom de Vries  <tdevries@suse.de>
85409
85410         [gdb/testsuite] Refactor regexp in gdb.base/annota1.exp
85411         Refactor regexp in gdb.base/annota1.exp to reduce indentation and repetition.
85412
85413         Tested on x86_64-linux.
85414
85415 2021-10-07  GDB Administrator  <gdbadmin@sourceware.org>
85416
85417         Automatic date update in version.in
85418
85419 2021-10-06  Andrew Burgess  <andrew.burgess@embecosm.com>
85420
85421         gdb/doc: improve 'show print elements' description
85422         The documentation for 'show print elements' contains the line:
85423
85424           If the number is 0, then the printing is unlimited.
85425
85426         However, this line is now out of date as can be seen by this GDB
85427         session:
85428
85429           (gdb) set print elements 0
85430           (gdb) show print elements
85431           Limit on string chars or array elements to print is unlimited.
85432
85433         The value 0 does indeed mean unlimited, and this is described in the
85434         'set print elements' section, however, for 'show print elements' the
85435         user will never see the value 0, so lets just remove that bit from the
85436         docs.
85437
85438 2021-10-06  Tom de Vries  <tdevries@suse.de>
85439
85440         [gdb/testsuite] Fix FAIL in gdb.tui/corefile-run.exp
85441         When running test-case gdb.tui/corefile-run.exp on openSUSE Tumbleweed,
85442         I run into:
85443         ...
85444         PASS: gdb.tui/corefile-run.exp: load corefile
85445         FAIL: gdb.tui/corefile-run.exp: run until the end
85446         ...
85447
85448         What's going on is easier to see when also doing dump_screen if
85449         check_contents passes, and inspecting state at the preceding PASS:
85450         ...
85451          +-------------------------------------------------------------------------+
85452          exec No process In:                                           L??   PC: ??
85453          [New LWP 16629]
85454          [Thread debugging using libthread_db enabled]
85455          Using host libthread_db library "/lib64/libthread_db.so.1".
85456          Core was generated by `/data/gdb_versions/devel/build/gdb/testsuite/output
85457          s/gdb.tui/corefile-run/corefi'.
85458          Program terminated with signal SIGTRAP, Trace/breakpoint trap.
85459          #0  main ()
85460          --Type <RET> for more, q to quit, c to continue without paging--
85461         ...
85462
85463         The problem is that we're getting a pagination prompt, and the subsequent run
85464         command is interpreted as an answer to that prompt.
85465
85466         Fix this by:
85467         - detecting the gdb prompt in response to "load corefile", such that
85468           we detect the failure earlier, and
85469         - doing a "set pagination off" in Term::clean_restart.
85470
85471         Tested on x86_64-linux.
85472
85473 2021-10-06  Alan Modra  <amodra@gmail.com>
85474
85475         PR28420, ecoff fuzzing failures
85476                 PR 28420
85477                 * coff-mips.c (mips_adjust_reloc_in): Replace abort with error
85478                 message and return.
85479                 * ecoff.c (ecoff_slurp_reloc_table): Remove assertion and aborts,
85480                 instead handle errors gracefully.
85481
85482 2021-10-06  Alan Modra  <amodra@gmail.com>
85483
85484         PR28402, fail to allocate line number array
85485         This fixes a situation where the COFF code allocated memory for
85486         internal representaion arrays before reading the external file data.
85487         That meant the allocation didn't have any sanity check against file
85488         size.
85489
85490                 PR 28402
85491                 * coffcode.h (buy_and_read): Malloc rather than alloc memory.
85492                 (coff_slurp_line_table): Read native line number info before
85493                 allocating memory for internal line number array.  Adjust error
85494                 paths to suit.  Remove now unnecessary line number count check.
85495                 (coff_slurp_reloc_table): Adjust to suit buy_and_read change.
85496
85497 2021-10-06  Alan Modra  <amodra@gmail.com>
85498
85499         PR28403, null pointer dereference in disassemble_bytes
85500         Indexing of symbol and howto arrays wasn't checked in aout targets.
85501
85502                 PR 28403
85503                 * aout-ns32k.c (MY (reloc_howto)): Sanity check howto_table index.
85504                 Make r_index unsigned.
85505                 (MY_swap_std_reloc_in): Make r_index unsigned.
85506                 * aoutx.h (MOVE_ADDRESS): Sanity check symbol r_index.
85507                 (aout_link_input_section_std): Make r_index unsigned.
85508                 (aout_link_input_section_ext): Likewise.
85509                 * i386lynx.c (MOVE_ADDRESS): Sanity check symbol r_index.
85510                 (swap_ext_reloc_in, swap_std_reloc_in): Make r_index unsigned.
85511                 * pdp11.c (MOVE_ADDRESS): Sanity check symbol r_index.
85512
85513 2021-10-06  Alan Modra  <amodra@gmail.com>
85514
85515         PR28401, invalid section name lookup
85516         The PR28401 testcase has a section named "", ie. an empty string.
85517         This results in some silly behaviour in load_debug_section, and
85518         dump_dwarf_section.  Fix that.  Note that this patch doesn't correct
85519         the main complaint in PR28401, "failed to allocate", since malloc
85520         failures on sections having huge bogus sizes are to be expected.  We
85521         can't safely catch all such cases by comparing with file size, for
85522         example, where sections contain compressed data.
85523
85524                 PR 28401
85525                 * objdump.c (load_debug_section): Don't attempt to retrieve
85526                 empty name sections.
85527                 (dump_dwarf_section): Likewise.
85528
85529 2021-10-06  GDB Administrator  <gdbadmin@sourceware.org>
85530
85531         Automatic date update in version.in
85532
85533 2021-10-06  Tom de Vries  <tdevries@suse.de>
85534
85535         [gdb/testsuite] Make tui testing less verbose
85536         Currently, tui testing is rather verbose.  When using these RUNTESTFLAGS to
85537         pick up all tui tests (17 in total):
85538         ...
85539         rtf=$(echo $(cd src/gdb/testsuite/; find gdb.* -type f -name *.exp* \
85540           | xargs grep -l tuiterm_env) )
85541         ...
85542         we have:
85543         ...
85544         $ wc -l gdb.log
85545         120592 gdb.log
85546         ...
85547
85548         Most of the output is related to controlling the tui screen, but that does
85549         not give a top-level sense of how the test-case progresses.
85550
85551         Put differently: a lot of bandwith is used to describe how we arrive at a
85552         certain tui screen state.  But we don't actually always show the state we
85553         arrive at, unless there's a FAIL.
85554
85555         And if there's say, a PASS that should actually be FAILing, it's hard to
85556         detect.
85557
85558         Fix this by:
85559         - dropping the -log on the call to verbose in _log.  We still can get the
85560           same info back using runtest -v.
85561         - dumping the screen or box that we're checking, also when the test passes.
85562
85563         Brings down verbosity to something more reasonable:
85564         ...
85565         $ wc -l gdb.log
85566         3221 gdb.log
85567         ...
85568
85569         Tested on x86_64-linux.
85570
85571 2021-10-06  Tom de Vries  <tdevries@suse.de>
85572
85573         [gdb/testsuite] Add Term::dump_box in lib/tuiterm.exp
85574         Factor out new proc Term::get_region and use it to implement a
85575         new proc Term::dump_box, similar to Term::dump_screen.
85576
85577         Tested on x86_64-linux.
85578
85579 2021-10-05  Lancelot SIX  <lsix@lancelotsix.com>
85580
85581         gdb: Remove deprecated assertion in setting::get
85582         The commit 702991711a91bd47b209289562843a11e7009396 (gdb: Have setter
85583         and getter callbacks for settings) makes it possible for a setting not
85584         to be backed by a memory buffer but use callback functions instead to
85585         retrieve or set the setting's value.
85586
85587         An assertion was not properly updated to take into account that the
85588         m_var member (which points to a memory buffer, if used) might be nullptr
85589         if the setting uses callback functions.  If the setting is backed by a
85590         memory buffer, the m_var has to be non nullptr, which is already checked
85591         before the pointer is dereferenced.
85592
85593         This commit removes this assertion as it is not valid anymore.
85594
85595 2021-10-05  Tom Tromey  <tromey@adacore.com>
85596
85597         Remove 'varsize-limit'
85598         This makes the Ada-specific "varsize-limit" a synonym for
85599         "max-value-size", and removes the Ada-specific checks of the limit.
85600
85601         I am not certain of the history here, but it seems to me that this
85602         code is fully obsolete now.  And, removing this makes it possible to
85603         index large Ada arrays without triggering an error.  A new test case
85604         is included to demonstrate this.
85605
85606 2021-10-05  Tom Tromey  <tromey@adacore.com>
85607
85608         Allow lazy 'zero' value
85609         This changes value_zero to create a lazy value.  In many cases,
85610         value_zero is called in expression evaluation to wrap a type in a
85611         non-eval context.  It seems senseless to allocate a buffer in these
85612         cases.
85613
85614         A new 'is_zero' flag is added so we can preserve the existing
85615         assertions in value_fetch_lazy.
85616
85617         A subsequent patch will add a test where creating a zero value would
85618         fail, due to the variable size check.  However, the contents of this
85619         value are never needed, and so creating a lazy value avoids the error
85620         case.
85621
85622 2021-10-05  Tom Tromey  <tromey@adacore.com>
85623
85624         Add lval_funcs::is_optimized_out
85625         This adds an is_optimized_out function pointer to lval_funcs, and
85626         changes value_optimized_out to call it.  This new function lets gdb
85627         determine if a value is optimized out without necessarily fetching the
85628         value.  This is needed for a subsequent patch, where an attempt to
85629         access a lazy value would fail due to the value size limit -- however,
85630         the access was only needed to determine the optimized-out state.
85631
85632 2021-10-05  Tom de Vries  <tdevries@suse.de>
85633
85634         [gdb/testsuite] Fix FAIL in gdb.mi/mi-nsmoribund.exp
85635         Since commit e36788d1354 "[gdb/testsuite] Fix handling of nr_args < 3 in
85636         mi_gdb_test" we run into:
85637         ...
85638         PASS: gdb.mi/mi-nsmoribund.exp: print done = 1
85639         Expecting: ^(.*[^M
85640         ]+)?([^
85641         ]*^M
85642         \*running,thread-id="[0-9]+"^M
85643         \*running,thread-id="[0-9]+"^M
85644         \*running,thread-id="[0-9]+"^M
85645         \*running,thread-id="[0-9]+"^M
85646         \*running,thread-id="[0-9]+"^M
85647         \*running,thread-id="[0-9]+"^M
85648         \*running,thread-id="[0-9]+"^M
85649         \*running,thread-id="[0-9]+"^M
85650         \*running,thread-id="[0-9]+"^M
85651         \*running,thread-id="[0-9]+"[^M
85652         ]+[(]gdb[)] ^M
85653         [ ]*)
85654         103-exec-continue --all^M
85655         =library-loaded,id="/lib64/libgcc_s.so.1",target-name="/lib64/libgcc_s.so.1",\
85656           host-name="/lib64/libgcc_s.so.1",symbols-loaded="0",thread-group="i1",\
85657           ranges=[{from="0x00007ffff22a5010",to="0x00007ffff22b6365"}]^M
85658         103^running^M
85659         *running,thread-id="5"^M
85660         (gdb) ^M
85661         FAIL: gdb.mi/mi-nsmoribund.exp: 103-exec-continue --all (unexpected output)
85662         ...
85663
85664         The regexp expect running messages for all threads, but we only get one for
85665         thread 5.
85666
85667         The test-case uses non-stop mode, and when the exec-continue --all command is
85668         issued, thread 5 is stopped and all other threads are running.  Consequently,
85669         only thread 5 is resumed, and reported as running.
85670
85671         Fix this by updating the regexp.
85672
85673         Tested on x86_64-linux.
85674
85675 2021-10-05  Andrew Burgess  <andrew.burgess@embecosm.com>
85676
85677         gdb/python: fix memory leak in python inferior code
85678         When a user creates a gdb.Inferior object for the first time a new
85679         Python object is created.  This object is then cached within GDB's
85680         inferior object using the registry mechanism (see
85681         inferior_to_inferior_object in py-inferior.c, specifically the calls
85682         to inferior_data and set_inferior_data).
85683
85684         The Python Reference to the gdb.Inferior object held within the real
85685         inferior object ensures that the reference count on the Python
85686         gdb.Inferior object never reaches zero while the GDB inferior object
85687         continues to exist.
85688
85689         At the same time, the gdb.Inferior object maintains a C++ pointer back
85690         to GDB's real inferior object.  We therefore end up with a system that
85691         looks like this:
85692
85693                            Python Reference
85694                                  |
85695                                  |
85696             .----------.         |          .--------------.
85697             |          |------------------->|              |
85698             | inferior |                    | gdb.Inferior |
85699             |          |<-------------------|              |
85700             '----------'         |          '--------------'
85701                                  |
85702                                  |
85703                             C++ Pointer
85704
85705         When GDB's inferior object is deleted (say the inferior exits) then
85706         py_free_inferior is called (thanks to the registry system), this
85707         function looks up the Python gdb.Inferior object and sets the C++
85708         pointer to nullptr and finally reduces the reference count on the
85709         Python gdb.Inferior object.
85710
85711         If at this point the user still holds a reference to the Python
85712         gdb.Inferior object then nothing happens.  However, the gdb.Inferior
85713         object is now in the non-valid state (see infpy_is_valid in
85714         py-inferior.c), but otherwise, everything is fine.
85715
85716         However, if there are no further references to the Python gdb.Inferior
85717         object, or, once the user has given up all their references to the
85718         gdb.Inferior object, then infpy_dealloc is called.
85719
85720         This function currently checks to see if the inferior pointer within
85721         the gdb.Inferior object is nullptr or not.  If the pointer is nullptr
85722         then infpy_dealloc immediately returns.
85723
85724         Only when the inferior point in the gdb.Inferior is not nullptr do
85725         we (a) set the gdb.Inferior reference inside GDB's inferior to
85726         nullptr, and (b) call the underlying Python tp_free function.
85727
85728         There are a number things wrong here:
85729
85730           1.  The Python gdb.Inferior reference within GDB's inferior object
85731           holds a reference count, thus, setting this reference to nullptr
85732           without first decrementing the reference count would leak a
85733           reference, however...
85734
85735           2. As GDB's inferior holds a reference then infpy_dealloc will never
85736           be called until GDB's inferior object is deleted.  Deleting a GDB
85737           inferior ohject calls py_free_inferior, and so gives up the
85738           reference.  At this point there is no longer a need to call
85739           set_inferior_data to set the field back to NULL, that field must
85740           have been cleared in order to get the reference count to zero, which
85741           means...
85742
85743           3. If we know that py_free_inferior must be called before
85744           infpy_dealloc, then we know that the inferior pointer in
85745           gdb.Inferior will always be nullptr when infpy_dealloc is called,
85746           this means that the call to the underlying tp_free function will
85747           always be skipped.  Skipping this call will cause Python to leak the
85748           memory associated with the gdb.Inferior object, which is what we
85749           currently always do.
85750
85751         Given all of the above, I assert that the C++ pointer within
85752         gdb.Inferior will always be nullptr when infpy_dealloc is called.
85753         That's what this patch does.
85754
85755         I wrote a test for this issue making use of Pythons tracemalloc
85756         module, which allows us to spot this memory leak.
85757
85758 2021-10-05  Bhuvanendra Kumar N  <Bhuvanendra.KumarN@amd.com>
85759
85760         [gdb/testsuite] Use function_range in gdb.dwarf2/dw2-ref-missing-frame.exp
85761         Following 2 test points are failing with clang compiler
85762
85763         (gdb) FAIL: gdb.dwarf2/dw2-ref-missing-frame.exp: func_nofb print
85764         (gdb) FAIL: gdb.dwarf2/dw2-ref-missing-frame.exp: func_loopfb print
85765
85766         As in commit f677852bbda "[gdb/testsuite] Use function_range in
85767         gdb.dwarf2/dw2-abs-hi-pc.exp", the problem is that the CU and functions
85768         have an empty address range, due to using asm labels in global scope,
85769         which is a known source of problems, as explained in the comment of proc
85770         function_range in gdb/testsuite/lib/dwarf.exp.  Hence fix this also by
85771         using function_range.
85772
85773         Tested on x86_64-linux with gcc and clang.
85774
85775 2021-10-05  Andrew Burgess  <andrew.burgess@embecosm.com>
85776
85777         gdb/python: add a new gdb_exiting event
85778         Add a new event, gdb.events.gdb_exiting, which is called once GDB
85779         decides it is going to exit.
85780
85781         This event is not triggered in the case that GDB performs a hard
85782         abort, for example, when handling an internal error and the user
85783         decides to quit the debug session, or if GDB hits an unexpected,
85784         fatal, signal.
85785
85786         This event is triggered if the user just types 'quit' at the command
85787         prompt, or if GDB is run with '-batch' and has processed all of the
85788         required commands.
85789
85790         The new event type is gdb.GdbExitingEvent, and it has a single
85791         attribute exit_code, which is the value that GDB is about to exit
85792         with.
85793
85794         The event is triggered before GDB starts dismantling any of its own
85795         internal state, so, my expectation is that most Python calls should
85796         work just fine at this point.
85797
85798         When considering this functionality I wondered about using the
85799         'atexit' Python module.  However, this is triggered when the Python
85800         environment is shut down, which is done from a final cleanup.  At
85801         this point we don't know for sure what other GDB state has already
85802         been cleaned up.
85803
85804 2021-10-05  Andrew Burgess  <andrew.burgess@embecosm.com>
85805
85806         gdb/python: update events test to handle missing exit_code
85807         The test gdb.python/py-events.exp sets up a handler for the gdb.exited
85808         event.  Unfortunately the handler is slightly broken, it assumes that
85809         the exit_code attribute will always be present.  This is not always
85810         the case.
85811
85812         In a later commit I am going to add more tests to py-events.exp test
85813         script, and in so doing I expose the bug in our handling of gdb.exited
85814         events.
85815
85816         Just to be clear, GDB itself is fine, it is the test that is not
85817         written correctly according to the Python Events API.
85818
85819         So, in this commit I fix the Python code in the test, and extend the
85820         test case to exercise more paths through the Python code.
85821
85822         Additionally, I noticed that the gdb.exited event is used as an
85823         example in the documentation for how to write an event handler.
85824         Unfortunately the same bug that we had in our test was also present in
85825         the example code in the manual.
85826
85827         So I've fixed that too.
85828
85829         After this commit there is no functional change to GDB.
85830
85831 2021-10-05  GDB Administrator  <gdbadmin@sourceware.org>
85832
85833         Automatic date update in version.in
85834
85835 2021-10-04  Tom Tromey  <tromey@adacore.com>
85836
85837         Use unique_xmalloc_ptr<char> when demangling
85838         I noticed that some methods in language_defn could use
85839         unique_xmalloc_ptr<char> rather than a plain 'char *'.  This patch
85840         implements this change, fixing up the fallout and changing
85841         gdb_demangle to also return this type.  In one spot, std::string is
85842         used to simplify some related code, and in another, an auto_obstack is
85843         used to avoid manual management.
85844
85845         Regression tested on x86-64 Fedora 34.
85846
85847 2021-10-04  Tom Tromey  <tromey@adacore.com>
85848
85849         Minor boolean fix in windows-nat.c
85850         I noticed a spot in windows-nat.c that used '1' rather than the more
85851         appropriate 'true'.  This patch fixes it.
85852
85853 2021-10-04  Tom de Vries  <tdevries@suse.de>
85854
85855         [gdb/build] Add CXX_DIALECT to CXX
85856         Say we use a gcc version that (while supporting c++11) does not support c++11
85857         by default, and needs an -std setting to enable it.
85858
85859         If gdb would use the default AX_CXX_COMPILE_STDCXX from autoconf-archive, then
85860         we'd have:
85861         ...
85862         CXX="g++ -std=gnu++11"
85863         ...
85864
85865         That mechanism however has the following problem (quoting from commit
85866         0bcda685399):
85867         ...
85868         the top level Makefile passes CXX down to subdirs, and that overrides whatever
85869         gdb/Makefile may set CXX to.  The result would be that a make invocation from
85870         the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a
85871         make invocation at the top level would not.
85872         ...
85873
85874         Commit 0bcda685399 fixes this by using a custom AX_CXX_COMPILE_STDCXX which
85875         does:
85876         ...
85877         CXX=g++
85878         CXX_DIALECT=-std=gnu++11
85879         ...
85880
85881         The problem reported in PR28318 is that using the custom instead of the
85882         default AX_CXX_COMPILE_STDCXX makes the configure test for std::thread
85883         support fail.
85884
85885         We could simply add $CXX_DIALECT to the test for std::thread support, but
85886         that would have to be repeated for each added c++ support test.
85887
85888         Instead, fix this by doing:
85889         ...
85890         CXX="g++ -std=gnu++11"
85891         CXX_DIALECT=-std=gnu++11
85892         ...
85893
85894         This is somewhat awkward, since it results in -std=gnu++11 occuring twice in
85895         some situations:
85896         ...
85897         $ touch src/gdb/dwarf2/read.c
85898         $ ( cd build/gdb; make V=1 dwarf2/read.o )
85899         g++-4.8 -std=gnu++11 -x c++ -std=gnu++11 ...
85900         ...
85901
85902         However, both settings are needed:
85903          - the switch in CXX for the std::thread tests (and other tests)
85904          - the switch in CXX_DIALECT so it can be appended in Makefiles, to
85905            counteract the fact that the top-level Makefile overrides CXX
85906
85907         The code added in gdb/ax_cxx_compile_stdcxx.m4 is copied from the default
85908         AX_CXX_COMPILE_STDCXX from autoconf-archive.
85909
85910         Tested on x86_64-linux.
85911
85912         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28318
85913
85914 2021-10-04  Simon Marchi  <simon.marchi@polymtl.ca>
85915
85916         [gdb/symtab] Use unrelocated addresses in call_site
85917         Consider test-case gdb.trace/entry-values.exp with target board
85918         unix/-fPIE/-pie.
85919
85920         Using this command we have an abbreviated version, and can see the correct
85921         @entry values for foo:
85922         ...
85923         $ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \
85924           -ex start \
85925           -ex "break foo" \
85926           -ex "set print entry-values both" \
85927           -ex continue
85928         Temporary breakpoint 1 at 0x679
85929
85930         Temporary breakpoint 1, 0x0000555555554679 in main ()
85931         Breakpoint 2 at 0x55555555463e
85932
85933         Breakpoint 2, 0x000055555555463e in foo (i=0, i@entry=2, j=2, j@entry=3)
85934         ...
85935
85936         Now, let's try the same again, but run directly to foo rather than stopping at
85937         main:
85938         ...
85939         $ gdb -q -batch outputs/gdb.trace/entry-values/entry-values \
85940           -ex "break foo" \
85941           -ex "set print entry-values both" \
85942           -ex run
85943         Breakpoint 1 at 0x63e
85944
85945         Breakpoint 1, 0x000055555555463e in foo (i=0, i@entry=<optimized out>, \
85946           j=2, j@entry=<optimized out>)
85947         ...
85948
85949         So, what explains the difference?  Noteworthy, this is a dwarf assembly
85950         test-case, with debug info for foo and bar, but not for main.
85951
85952         In the first case:
85953         - we run to main
85954         - this does not trigger expanding debug info, because there's none for main
85955         - we set a breakpoint at foo
85956         - this triggers expanding debug info.  Relocated addresses are used in
85957           call_site info (because the exec is started)
85958         - we continue to foo, and manage to find the call_site info
85959
85960         In the second case:
85961         - we set a breakpoint at foo
85962         - this triggers expanding debug info.  Unrelocated addresses are used in
85963           call_site info (because the exec is not started)
85964         - we run to foo
85965         - this triggers objfile_relocate1, but it doesn't update the call_site
85966           info addresses
85967         - we don't manage to find the call_site info
85968
85969         We could fix this by adding the missing call_site relocation in
85970         objfile_relocate1.
85971
85972         This solution however is counter-trend in the sense that we're trying to
85973         work towards the situation where when starting two instances of an executable,
85974         we need only one instance of debug information, implying the use of
85975         unrelocated addresses.
85976
85977         So, fix this instead by using unrelocated addresses in call_site info.
85978
85979         Tested on x86_64-linux.
85980
85981         This fixes all remaining unix/-fno-PIE/-no-pie vs unix/-fPIE/-pie
85982         regressions, like f.i. PR24892.
85983
85984         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24892
85985
85986         Co-Authored-By: Tom de Vries <tdevries@suse.de>
85987
85988 2021-10-04  Simon Marchi  <simon.marchi@polymtl.ca>
85989
85990         [gdb/symtab] C++-ify call_site
85991         - add constructor
85992         - add member function call_site::pc ()
85993
85994         Tested on x86_64-linux.
85995
85996         Co-Authored-By: Tom de Vries <tdevries@suse.de>
85997
85998 2021-10-04  Tom de Vries  <tdevries@suse.de>
85999
86000         [gdb/symtab] Add call_site_eq and call_site_hash
86001         In commit b4c919f7525 "[gdb/symtab] Fix htab_find_slot call in
86002         read_call_site_scope" , I removed the comment:
86003         ...
86004         It must be the first field as we overload core_addr_hash and core_addr_eq for
86005         it.
86006         ...
86007         for field pc of struct call_site.
86008
86009         However, this was not tested, and when indeed moving field pc to the second
86010         location, we run into a testsuite failure in gdb.trace/entry-values.exp.
86011
86012         This is caused by core_addr_eq (the eq_f function for the htab) being
86013         called with a pointer to the pc field (as passed into htab_find_slot) and a
86014         pointer to a hash table element.  Now that pc is no longer the first field,
86015         the pointer to hash table element no longer points to the pc field.
86016
86017         This could be fixed by simply reinstating the comment, but we're trying to
86018         get rid of this kind of tricks that make refactoring more difficult.
86019
86020         Instead, fix this by:
86021         - reverting commit b4c919f7525, apart from the comment removal, such that
86022           we're passing a pointer to element to htab_find_slot
86023         - updating the htab_find_slot call in compunit_symtab::find_call_site
86024           in a similar manner
86025         - adding a call_site_eq and call_site_hash, and using these in the hash table
86026           instead of core_addr_eq and core_addr_hash.
86027
86028         Tested on x86_64-linux, both with and without a trigger patch that moves pc to
86029         the second location in struct call_site.
86030
86031 2021-10-04  Tom Tromey  <tromey@adacore.com>
86032
86033         Fix remote-sim.c compilation
86034         The change "make string-like set show commands use std::string
86035         variable" caused remote-sim.c to fail to build.  The issue is that the
86036         code does:
86037
86038           const std::string &sysroot = gdb_sysroot;
86039           if (is_target_filename (sysroot))
86040             sysroot += strlen (TARGET_SYSROOT_PREFIX);
86041
86042         ... which isn't valid.
86043
86044         This patch changes this code to use a 'const char *' again, fixing the
86045         build.
86046
86047 2021-10-04  Bruno Larsen  <blarsen@redhat.com>
86048
86049         [gdb/testsuite] update analyze-racy-logs.py to python3
86050         Since python 2 is no longer supported on most distributions, update the
86051         script to run under python while while still being runnable under
86052         python2.
86053
86054 2021-10-04  Andrew Burgess  <andrew.burgess@embecosm.com>
86055
86056         gdbsupport: remove attempt to define TARGET_WORD_SIZE
86057         In the gdbsupport configure.ac file, there is an attempt to define
86058         TARGET_WORD_SIZE.  This is done by running grep on the file
86059         ../bfd/bfd-in3.h.
86060
86061         The problem with this is, the file bfd-in3.h is generated into the bfd
86062         build directory when bfd is configured, and there is no dependency
86063         between the gdbsupport module and the bfd module, so, for example, if
86064         I do:
86065
86066           $ ../src/configure
86067           $ make all-gdbsupport
86068
86069         Then bfd will neither be configured, or built.  In this case
86070         TARGET_WORD_SIZE ends up being defined, but with no value because the
86071         grep on bfd-in3.h fails.
86072
86073         However, it turns out that this doesn't matter; we don't actually use
86074         TARGET_WORD_SIZE anywhere.
86075
86076         My proposal in this commit is to just remove the definition of
86077         TARGET_WORD_SIZE, the alternative would be to add a dependency between
86078         configure-gdbsupport and configure-bfd into Makefile.def, but adding a
86079         dependency for something we don't need seems pretty pointless.
86080
86081 2021-10-04  Mike Frysinger  <vapier@gentoo.org>
86082
86083         sim: add --info-target for listing supported BFD targets
86084         It can be difficult to guess the exact bfd name, so add an option to
86085         list all the targets that the current build supports.  This aligns with
86086         other simulator options like --info-architecture.
86087
86088 2021-10-04  GDB Administrator  <gdbadmin@sourceware.org>
86089
86090         Automatic date update in version.in
86091
86092 2021-10-03  Lancelot SIX  <lsix@lancelotsix.com>
86093
86094         gdb: Setting setter return a bool to tell if the value changed
86095         GDB can notify observers when a parameter is changed.
86096
86097         To do that, do_set_command (in gdb/cli/cli-setshow.c) compares the new
86098         value against the old one before updating it, and based on that notifies
86099         observers.  This looks like something like:
86100
86101             int valuechanged = 0;
86102             switch (cmd->var.type ())
86103             {
86104             case var_integer:
86105               {
86106                 LONGEST new_val = parse_and_eval_long (arg)
86107                 if (new_val != cmd->var.get<int> ())
86108                 {
86109                   cmd->var.get<int> (new_val);
86110                   value_changes = 1;
86111                 }
86112               }
86113             case var_uinteger:
86114             case var_zuinteger:
86115               {
86116                 unsigned int val
86117                   = parse_cli_var_uinteger (c->var->type (), &arg, true);
86118                 if (c->var->get<unsigned int> () != val)
86119                   {
86120                     c->var->set<unsigned int> (val);
86121                     option_changed = true;
86122                   }
86123               }
86124             case...
86125               /* And so on for all possible var_types.  */
86126             }
86127
86128         This comparison is done for each possible var_type, which leads to
86129         unnecessary logic duplication.
86130
86131         In this patch I propose to move all those checks in one place within the
86132         setting setter method.  This limits the code duplication and simplifies
86133         the do_set_command implementation.
86134
86135         This patch also changes slightly the way a value change is detected.
86136         Instead of comparing the user provided value against the current value
86137         of the setting, we compare the value of the setting before and after the
86138         set operation.  This is meant to handle edge cases where trying to set
86139         an unrecognized value would be equivalent to a noop (the actual value
86140         remains unchanged).  Doing this requires that the original value needs
86141         to be copied before the update, which can be non trivial for
86142         std::string.
86143
86144         There should be no user visible change introduced by this commit.
86145
86146         Tested on x86_64 GNU/Linux.
86147
86148         [1] https://review.lttng.org/c/binutils-gdb/+/5831/41
86149
86150         Change-Id: If064b9cede3eb56275aacd2b286f74eceb1aed11
86151
86152 2021-10-03  Lancelot SIX  <lsix@lancelotsix.com>
86153             Simon Marchi  <simon.marchi@polymtl.ca>
86154
86155         gdb: Have setter and getter callbacks for settings
86156         The main motivation behind this improvement is to help the
86157         implementation of a patch Simon Marchi is preparing to fix a bug when
86158         MI or Python try to access parameters that are inferior dependent (see
86159         PR/28085).
86160
86161         This commit extends the previous ones, which introduces the setting
86162         object to represent a static variable whose value can be set or shown
86163         with the appropriate commands.  This patch proposes that a setting can
86164         either contain a pointer to a static variable holding a setting, or
86165         pointers to a pair of setter and getter callback functions.
86166
86167         The callbacks functions can be used to retrieve or change the value with
86168         custom logic.  This is useful when the source of truth for a given
86169         setting is not contained in the variable pointed to by the setting
86170         instance.
86171
86172         Given that the callback function call is hidden within the setting
86173         abstraction introduced earlier, none of the sites accessing the setting
86174         needs to be updated.  The registered getter or setter is used whatever
86175         the way to access it is (through MI, Python, Guile, the "with" command
86176         and the $_gdb_setting / $_gdb_setting_str convenience functions).
86177
86178         All the add_setshow_*_cmd are given a new overload that will accept the
86179         pair of function pointers (set / get functions) instead of the pointer
86180         to a global variable.
86181
86182         Tested on GNU/Linux x86_64 with no regression observed.
86183
86184         Change-Id: Ieb81fef57550632ff66e6aa85f637372a226be8c
86185
86186 2021-10-03  Simon Marchi  <simon.marchi@efficios.com>
86187             Lancelot SIX  <lsix@lancelotsix.com>
86188
86189         gdb: make string-like set show commands use std::string variable
86190         String-like settings (var_string, var_filename, var_optional_filename,
86191         var_string_noescape) currently take a pointer to a `char *` storage
86192         variable (typically global) that holds the setting's value.  I'd like to
86193         "mordernize" this by changing them to use an std::string for storage.
86194
86195         An obvious reason is that string operations on std::string are often
86196         easier to write than with C strings.  And they avoid having to do any
86197         manual memory management.
86198
86199         Another interesting reason is that, with `char *`, nullptr and an empty
86200         string often both have the same meaning of "no value".  String settings
86201         are initially nullptr (unless initialized otherwise).  But when doing
86202         "set foo" (where `foo` is a string setting), the setting now points to
86203         an empty string.  For example, solib_search_path is nullptr at startup,
86204         but points to an empty string after doing "set solib-search-path".  This
86205         leads to some code that needs to check for both to check for "no value".
86206         Or some code that converts back and forth between NULL and "" when
86207         getting or setting the value.  I find this very error-prone, because it
86208         is very easy to forget one or the other.  With std::string, we at least
86209         know that the variable is not "NULL".  There is only one way of
86210         representing an empty string setting, that is with an empty string.
86211
86212         I was wondering whether the distinction between NULL and "" would be
86213         important for some setting, but it doesn't seem so.  If that ever
86214         happens, it would be more C++-y and self-descriptive to use
86215         optional<string> anyway.
86216
86217         Actually, there's one spot where this distinction mattered, it's in
86218         init_history, for the test gdb.base/gdbinit-history.exp.  init_history
86219         sets the history filename to the default ".gdb_history" if it sees that
86220         the setting was never set - if history_filename is nullptr.  If
86221         history_filename is an empty string, it means the setting was explicitly
86222         cleared, so it leaves it as-is.  With the change to std::string, this
86223         distinction doesn't exist anymore.  This can be fixed by moving the code
86224         that chooses a good default value for history_filename to
86225         _initialize_top.  This is ran before -ex commands are processed, so an
86226         -ex command can then clear that value if needed (what
86227         gdb.base/gdbinit-history.exp tests).
86228
86229         Another small improvement, in my opinion is that we can now easily
86230         give string parameters initial values, by simply initializing the global
86231         variables, instead of xstrdup-ing it in the _initialize function.
86232
86233         In Python and Guile, when registering a string-like parameter, we
86234         allocate (with new) an std::string that is owned by the param_smob (in
86235         Guile) and the parmpy_object (in Python) objects.
86236
86237         This patch started by changing all relevant add_setshow_* commands to
86238         take an `std::string *` instead of a `char **` and fixing everything
86239         that failed to build.  That includes of course all string setting
86240         variable and their uses.
86241
86242         string_option_def now uses an std::string also, because there's a
86243         connection between options and settings (see
86244         add_setshow_cmds_for_options).
86245
86246         The add_path function in source.c is really complex and twisted, I'd
86247         rather not try to change it to work on an std::string right now.
86248         Instead, I added an overload that copies the std:string to a `char *`
86249         and back.  This means more copying, but this is not used in a hot path
86250         at all, so I think it is acceptable.
86251
86252         Change-Id: I92c50a1bdd8307141cdbacb388248e4e4fc08c93
86253
86254 2021-10-03  Lancelot SIX  <lsix@lancelotsix.com>
86255             Simon Marchi  <simon.marchi@polymtl.ca>
86256
86257         gdb: Introduce setting construct within cmd_list_element
86258         cmd_list_element can contain a pointer to data that can be set and / or
86259         shown.  This is achieved with the void* VAR member which points to the
86260         data that can be accessed, while the VAR_TYPE member (of type enum
86261         var_types) indicates how to interpret the data pointed to.
86262
86263         With this pattern, the user of the cmd_list_element needs to know what
86264         is the storage type associated with a given VAR_TYPES in order to do
86265         the proper casting.  No automatic safeguard is available to prevent
86266         miss-use of the pointer.  Client code typically looks something like:
86267
86268                 switch (c->var_type)
86269                 {
86270                   case var_zuinteger:
86271                     unsigned int v = *(unsigned int*) c->var;
86272                     ...
86273                     break;
86274                   case var_boolean:
86275                     bool v = *(bool *) c->var;
86276                     ...
86277                     break;
86278                   ...
86279                 }
86280
86281         This patch proposes to add an abstraction around the var_types and void*
86282         pointer pair.  The abstraction is meant to prevent the user from having
86283         to handle the cast and verify that the data is read or written as a type
86284         that is coherent with the setting's var_type.  This is achieved by
86285         introducing the struct setting which exposes a set of templated get /
86286         set member functions.  The template parameter is the type of the
86287         variable that holds the referred variable.
86288
86289         Using those accessors allows runtime checks to be inserted in order to
86290         ensure that the data pointed to has the expected type.  For example,
86291         instantiating the member functions with bool will yield something
86292         similar to:
86293
86294                 const bool &get<bool> () const
86295                 {
86296                   gdb_assert (m_var_type == var_boolean);
86297                   gdb_assert (m_var != nullptr);
86298                   return *static_cast<bool *> (m_var);
86299                 }
86300                 void set<bool> (const bool &var)
86301                 {
86302                   gdb_assert (m_var_type == var_boolean);
86303                   gdb_assert (m_var != nullptr);
86304                   *static_cast<bool *> (m_var) = var;
86305                 }
86306
86307         Using the new abstraction, our initial example becomes:
86308
86309                 switch (c->var_type)
86310                 {
86311                   case var_zuinteger:
86312                     unsigned int v = c->var->get<unsigned int> ();
86313                     ...
86314                     break;
86315                   case var_boolean:
86316                     bool v = c->var->get<bool> ();
86317                     ...
86318                     break;
86319                   ...
86320                 }
86321
86322         While the call site is still similar, the introduction of runtime checks
86323         help ensure correct usage of the data.
86324
86325         In order to avoid turning the bulk of add_setshow_cmd_full into a
86326         templated function, and following a suggestion from Pedro Alves, a
86327         setting can be constructed from a pre validated type erased reference to
86328         a variable.  This is what setting::erased_args is used for.
86329
86330         Introducing an opaque abstraction to describe a setting will also make
86331         it possible to use callbacks to retrieve or set the value of the setting
86332         on the fly instead of pointing to a static chunk of memory.  This will
86333         be done added in a later commit.
86334
86335         Given that a cmd_list_element may or may not reference a setting, the
86336         VAR and VAR_TYPES members of the struct are replaced with a
86337         gdb::optional<setting> named VAR.
86338
86339         Few internal function signatures have been modified to take into account
86340         this new abstraction:
86341
86342         -The functions value_from_setting, str_value_from_setting and
86343          get_setshow_command_value_string used to have a 'cmd_list_element *'
86344          parameter but only used it for the VAR and VAR_TYPE member. They now
86345          take a 'const setting &' parameter instead.
86346         - Similarly, the 'void *' and a 'enum var_types' parameters of
86347           pascm_param_value and gdbpy_parameter_value have been replaced with a
86348           'const setting &' parameter.
86349
86350         No user visible change is expected after this patch.
86351
86352         Tested on GNU/Linux x86_64, with no regression noticed.
86353
86354         Change-Id: Ie1d08c3ceb8b30b3d7bf1efe036eb8acffcd2f34
86355
86356 2021-10-03  Mike Frysinger  <vapier@gentoo.org>
86357
86358         sim: filter out SIGSTKSZ [PR sim/28302]
86359         We map target signals to host signals so we can propagate signals
86360         between the host & simulated worlds.  That means we need to know
86361         the symbolic names & values of all signals that might be sent.
86362
86363         The tools that generate that list use signal.h and include all
86364         symbols that start with "SIG" so as to automatically include any
86365         new symbols that the C library might add.  Unfortunately, this
86366         also picks up "SIGSTKSZ" which is not actually a signal itself,
86367         but a signal related setting -- it's the size of the stack when
86368         a signal is handled.
86369
86370         By itself this doesn't super matter as we will never see a signal
86371         with that same value (since the range of valid signals tend to be
86372         way less than 1024, and the size of the default signal stack will
86373         never be that small).  But with recent glibc changes that make this
86374         into a dynamic value instead of a compile-time constant, some users
86375         see build failures when building the sim.
86376
86377         As suggested by Adam Sampson, update our scripts to ignore this
86378         symbol to simplify everything and avoid the build failure.
86379
86380         Bug: https://sourceware.org/PR28302
86381
86382 2021-10-03  Mike Frysinger  <vapier@gentoo.org>
86383
86384         sim: ppc: fallback when ln is not available [PR sim/18864]
86385         Not all systems have easy access to hard links or symlinks, so add
86386         fallback logic to the run->psim build code to handle those.
86387
86388         Bug: https://sourceware.org/PR18864
86389
86390 2021-10-03  Lancelot SIX  <lsix@lancelotsix.com>
86391
86392         gdb: Fix comment in riscv_scan_prologue
86393         I found an inaccurate comment in riscv_scan_prologue.  This commit fixes
86394         it.
86395
86396 2021-10-03  Lancelot SIX  <lsix@lancelotsix.com>
86397
86398         gdb: Support the c.mv insn in the riscv prologue scanner.
86399         While working on other problems, I encountered situations where GDB
86400         fails to properly unwind the stack because some functions use the C.MV
86401         instruction in the prologue.  The prologue scanner stops when it hits
86402         this instruction assuming its job is done at this point.  Unfortunately
86403         the prologue is not necessarily finished yet, preventing GDB to properly
86404         unwind.
86405
86406         This commit adds support for handling such instruction in
86407         riscv_scan_prologue.
86408
86409         Note that C.MV is part of the compressed instruction set.  The MV
86410         counterpart from the base ISA is a pseudo instruction that expands to
86411         'ADDI RD,RS1,0' which is already supported.
86412
86413         Tested on riscv64-linux-gnu.
86414
86415         All feedback are welcome.
86416
86417 2021-10-03  GDB Administrator  <gdbadmin@sourceware.org>
86418
86419         Automatic date update in version.in
86420
86421 2021-10-02  Simon Marchi  <simon.marchi@polymtl.ca>
86422
86423         [gdb/symtab] Remove COMPUNIT_CALL_SITE_HTAB
86424         Remove macro COMPUNIT_CALL_SITE_HTAB, and provide access to the htab using
86425         member functions:
86426         - compunit_symtab::find_call_site
86427         - compunit_symtab::set_call_site_htab
86428
86429         Tested on x86_64-linux.
86430
86431         Co-Authored-By: Tom de Vries <tdevries@suse.de>
86432
86433 2021-10-02  Simon Marchi  <simon.marchi@polymtl.ca>
86434
86435         gdb/python: fix a few flake8 warnings
86436         Fix these rather obvious warnings reported by flake8:
86437
86438             ./lib/gdb/FrameIterator.py:16:1: F401 'gdb' imported but unused
86439             ./lib/gdb/FrameIterator.py:17:1: F401 'itertools' imported but unused
86440             ./lib/gdb/command/prompt.py:55:26: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
86441             ./lib/gdb/command/explore.py:526:9: F841 local variable 'has_explorable_fields' is assigned to but never used
86442             ./lib/gdb/command/explore.py:697:56: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
86443             ./lib/gdb/command/explore.py:736:62: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
86444             ./lib/gdb/command/explore.py:767:61: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
86445             ./lib/gdb/command/frame_filters.py:21:1: F401 'copy' imported but unused
86446             ./lib/gdb/command/frame_filters.py:22:1: F401 'gdb.FrameIterator.FrameIterator' imported but unused
86447             ./lib/gdb/command/frame_filters.py:23:1: F401 'gdb.FrameDecorator.FrameDecorator' imported but unused
86448             ./lib/gdb/command/frame_filters.py:25:1: F401 'itertools' imported but unused
86449             ./lib/gdb/command/frame_filters.py:179:17: E712 comparison to True should be 'if cond is True:' or 'if cond:'
86450
86451         Change-Id: I4f49c0cb430359ee872222600c61d9c5283b09ab
86452
86453 2021-10-02  GDB Administrator  <gdbadmin@sourceware.org>
86454
86455         Automatic date update in version.in
86456
86457 2021-10-01  Luis Machado  <luis.machado@linaro.org>
86458
86459         Fix build failure for 32-bit targets
86460         When building master GDB, I ran into the following:
86461
86462         binutils-gdb/gdb/bt-utils.c: In function 'int libbacktrace_print(void*, uintptr_t, const char*, int, const char*)':
86463         binutils-gdb/gdb/bt-utils.c:93:44: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'uintptr_t {aka unsigned int}' [-Werror=format=]
86464            snprintf (buf, sizeof (buf), "0x%lx ", pc);
86465
86466         Fix this by using %PRIxPTR as opposed to %lx.
86467
86468 2021-10-01  Nick Clifton  <nickc@redhat.com>
86469
86470         Fix mistake in RX assembler documentation (special section names)
86471
86472 2021-10-01  Simon Marchi  <simon.marchi@polymtl.ca>
86473
86474         [gdb/symtab] Fix htab_find_slot call in read_call_site_scope
86475         In read_call_site_scope we have:
86476         ...
86477           call_site_local.pc = pc;
86478           slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
86479         ...
86480
86481         The call passes a call_site pointer as element.  OTOH, the hashtab is created
86482         using hash_f == core_addr_hash and eq_f == core_addr_eq, so the element
86483         will be accessed through a CORE_ADDR pointer.
86484
86485         This is not wrong (at least in C), given that pc is the first field in
86486         call_site.
86487
86488         Nevertheless, as in call_site_for_pc, make the htab_find_slot call match the
86489         used hash_f and eq_f by using &pc instead:
86490         ...
86491           slot = htab_find_slot (cu->call_site_htab, &pc, INSERT);
86492         ...
86493
86494         Tested on x86_64-linux.
86495
86496         Co-Authored-By: Tom de Vries <tdevries@suse.de>
86497
86498 2021-10-01  Andrea Corallo  <andrea.corallo@arm.com>
86499
86500         PATCH bfd: Fix linker warning for recently introduced arm attributes
86501         2021-09-27  Andrea Corallo  <andrea.corallo@arm.com>
86502
86503                 * elf-bfd.h (NUM_KNOWN_OBJ_ATTRIBUTES): Update value to cover
86504                 'Tag_BTI_use' and 'Tag_PACRET_use'.
86505
86506 2021-10-01  Simon Marchi  <simon.marchi@polymtl.ca>
86507
86508         gdb/testsuite/dwarf: use options for rnglists/loclists procs
86509         Change how rnglists and loclists procs to align them with how procs for
86510         aranges (and other things in the DWARF assembler) work.  Instead of
86511         using "args" (variable number of parameters in TCL) and command-line
86512         style option arguments, use one leading "option" parameters, used as a
86513         kind of key/value dictionary of options parsed using `parse_options`.
86514
86515         Change-Id: I63e60d17ae16a020ce4d6de44baf3d152ea42a1a
86516
86517 2021-10-01  Simon Marchi  <simon.marchi@polymtl.ca>
86518
86519         gdb/testsuite/dwarf: don't define nested procs for rnglists/loclists
86520         When I wrote support for rnglists and loclists in the testsuite's DWARF
86521         assembler, I made it with nested procs, for example proc "table" inside
86522         proc "rnglists".  The intention was that this proc "table" could only be
86523         used by the user while inside proc "rnglists"'s body.  I had chosen very
86524         simple names, thinking there was no chance of name clashes.  I recently
86525         learned that this is not how TCL works.  This ends up defining a proc
86526         "table" in the current namespace ("Dwarf" in this case).
86527
86528         Things still work if you generate rnglists and loclists in the same
86529         file, as each redefines its own procedures when executing.  But if a
86530         user of the assembler happened to define a convenience "table" or
86531         "start_end" procedure, for example, it would get overriden.
86532
86533         I'd like to change how this works to reduce the chances of a name clash.
86534
86535          - Move the procs out of each other, so they are not defined in a nested
86536            fashion.
86537          - Prefix them with "_rnglists_" or "_loclists_".
86538          - While calling $body in the various procs, temporarily make the procs
86539            available under their "short" name.  For example, while in rngllists'
86540            body, make _rnglists_table available as just "table".  This allows
86541            existing code to keep working and keeps it not too verbose.
86542          - Modify with_override to allow the overriden proc to not exist.  In
86543            that case, the temporary proc is deleted on exit.
86544
86545         Note the non-conforming indentation when calling with_override in
86546         _loclists_list.  This is on purpose: as we implement more loclists (and
86547         rnglists) entry types, the indentation would otherwise get larger and
86548         larger without much value for readability.  So I think it's reasonable
86549         here to put them on the same level.
86550
86551         Change-Id: I7bb48d26fcb0dba1ae4dada05c0c837212424328
86552
86553 2021-10-01  Simon Marchi  <simon.marchi@polymtl.ca>
86554
86555         gdb: remove TYPE_FIELD_NAME and FIELD_NAME macros
86556         Remove the `TYPE_FIELD_NAME` and `FIELD_NAME` macros, changing all the
86557         call sites to use field::name directly.
86558
86559         Change-Id: I6900ae4e1ffab1396e24fb3298e94bf123826ca6
86560
86561 2021-10-01  Simon Marchi  <simon.marchi@polymtl.ca>
86562
86563         gdb: add field::name / field::set_name
86564         Add the `name` and `set_name` methods on `struct field`, in order to
86565         remove `FIELD_NAME` and `TYPE_FIELD_NAME` macros.  In this patch, the
86566         macros are changed to use `field::name`, so all the call sites that are
86567         used to set the field's name are changed to use `field::set_name`.
86568         The next patch will remove the macros completely.
86569
86570         Note that because of the name clash between the existing field named
86571         `name` and the new method, I renamed the field `m_name`.  It is not
86572         private per-se, because we can't make `struct field` a non-POD yet, but
86573         it should be considered private anyway (not accessed outside `struct
86574         field`).
86575
86576         Change-Id: If16ddbca4e0c39d0ff9da420bb5cdebe5b9b0896
86577
86578 2021-10-01  GDB Administrator  <gdbadmin@sourceware.org>
86579
86580         Automatic date update in version.in
86581
86582 2021-09-30  Sergio Durigan Junior  <sergiodj@sergiodj.net>
86583
86584         [PR gdb/28369] Use get_shell on gdb/ser-pipe.c
86585         PR gdb/28369 reports that gdb/ser-pipe.c has an 'execl' function call
86586         with a hard-coded "/bin/sh" as its argument.  We've had 'get_shell'
86587         for a while now, which is conscious about the SHELL environment and a
86588         better alternative to always calling "/bin/sh".
86589
86590         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28369
86591
86592 2021-09-30  Tom de Vries  <tdevries@suse.de>
86593
86594         [gdb/testsuite] Add untested for missing xml support in gdb.base/valgrind*.exp
86595         Add untested in case missing xml support is detected in test-cases
86596         gdb.base/valgrind*.exp.
86597
86598         Tested on x86_64-linux.
86599
86600 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86601
86602         arm: enable Cortex-R52+ CPU
86603         Patch is adding Cortex-R52+ as 'cortex-r52plus' command line
86604         flag for -mcpu option.
86605
86606         bfd/
86607
86608                 * cpu-arm.c: New Cortex-R52+ CPU.
86609
86610         gas/
86611
86612                 * NEWS: Update docs.
86613                 * config/tc-arm.c: New Cortex-R52+ CPU.
86614                 * doc/c-arm.texi: Update docs.
86615                 * testsuite/gas/arm/cpu-cortex-r52plus.d: New test.
86616
86617 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86618
86619         aarch64: Enable Cortex-X2 CPU
86620         This patch is adding support for Cortex-X2 CPU.
86621
86622         gas:
86623
86624                 * NEWS: Update docs.
86625                 * config/tc-aarch64.c: Add Cortex-X2.
86626                 * doc/c-aarch64.texi: Update docs.
86627
86628 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86629
86630         aarch64: Enable Cortex-A710 CPU
86631         This patch is adding support for Cortex-A710 CPU.
86632
86633         gas/
86634
86635                 * NEWS: Update docs.
86636                 * config/tc-aarch64.c: Add Cortex-A710.
86637                 * doc/c-aarch64.texi: Update docs.
86638
86639 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86640
86641         aarch64: Enable Cortex-A510 CPU
86642         This patch is adding support for Cortex-A510 CPU.
86643
86644         gas/
86645
86646                 * NEWS: Update docs.
86647                 * config/tc-aarch64.c: Add Cortex-A510.
86648                 * doc/c-aarch64.texi: Update docs.
86649
86650 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86651
86652         aarch64: Update AArch64 features command line options docs 2/2
86653         Patch is only sorting by 'Extension` column 'Architecture Extension'
86654         table.
86655
86656         gas/
86657
86658                 * doc/c-aarch64.texi: Update docs.
86659
86660 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86661
86662         aarch64: Update AArch64 features command line options docs 1/2
86663         Patch is improving entries in "Architecture extensions" table in GAS
86664         documentation.
86665
86666         gas/
86667
86668                 * doc/c-aarch64.texi: Update docs.
86669
86670 2021-09-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
86671
86672         aarch64: add armv9-a architecture to -march
86673         Patch is adding new 'armv9-a` command line flag to -march for AArch64.
86674
86675         gas/
86676
86677                 * config/tc-aarch64.c: Add 'armv9-a' command line flag.
86678                 * docs/c-aarch64.text: Update docs.
86679                 * NEWS: Update docs.
86680
86681         include/
86682
86683                 * opcode/aarch64.h (AARCH64_FEATURE_V9): New define.
86684                 (AARCH64_ARCH_V9): New define.
86685
86686 2021-09-30  Simon Marchi  <simon.marchi@polymtl.ca>
86687
86688         gdb/testsuite: make runto_main not pass no-message to runto
86689         As follow-up to this discussion:
86690
86691           https://sourceware.org/pipermail/gdb-patches/2020-August/171385.html
86692
86693         ... make runto_main not pass no-message to runto.  This means that if we
86694         fail to run to main, for some reason, we'll emit a FAIL.  This is the
86695         behavior we want the majority of (if not all) the time.
86696
86697         Without this, we rely on tests logging a failure if runto_main fails,
86698         otherwise.  They do so in a very inconsisteny mannet, sometimes using
86699         "fail", "unsupported" or "untested".  The messages also vary widly.
86700         This patch removes all these messages as well.
86701
86702         Also, remove a few "fail" where we call runto (and not runto_main).  by
86703         default (without an explicit no-message argument), runto prints a
86704         failure already.  In two places, gdb.multi/multi-re-run.exp and
86705         gdb.python/py-pp-registration.exp, remove "message" passed to runto.
86706         This removes a few PASSes that we don't care about (but FAILs will still
86707         be printed if we fail to run to where we want to).  This aligns their
86708         behavior with the rest of the testsuite.
86709
86710         Change-Id: Ib763c98c5f4fb6898886b635210d7c34bd4b9023
86711
86712 2021-09-30  Simon Marchi  <simon.marchi@polymtl.ca>
86713
86714         gdbsupport: make gdb_mkostemp_cloexec return a scoped_fd
86715         This encourages the callers to use automatic file descriptor management.
86716
86717         Change-Id: I137a81df6f3607b457e28c35aafde8ed6f3a3344
86718
86719 2021-09-30  Simon Marchi  <simon.marchi@polymtl.ca>
86720
86721         gdbsupport: make gdb_open_cloexec return scoped_fd
86722         Make gdb_open_cloexec return a scoped_fd, to encourage using automatic
86723         management of the file descriptor closing.  Except in the most trivial
86724         cases, I changed the callers to just release the fd, which retains their
86725         existing behavior.  That will allow the transition to using scoped_fd
86726         more to go gradually, one caller at a time.
86727
86728         Change-Id: Ife022b403f96e71d5ebb4f1056ef6251b30fe554
86729
86730 2021-09-30  Simon Marchi  <simon.marchi@polymtl.ca>
86731
86732         gdbsupport: move gdb_file_up to its own file
86733         The following patches wants to change gdb_fopen_cloexec and
86734         gdb_mkostemp_cloexec to return a scoped_fd.  Doing this causes a cyclic
86735         include between scoped_fd.h and filestuff.h, that both want to include
86736         each other.  scoped_fd.h includes filestuff.h because of the
86737         scoped_fd::to_file method's return value.  filestuff.h would then
86738         include scoped_fd.h for gdb_fopen_cloexec's and gdb_mkostemp_cloexec's
86739         return values.
86740
86741         To fix that, move gdb_file_up to its own file, gdb_file.h.
86742
86743         Change-Id: Ic82a48914b2aacee8f14af535b7469245f88b93d
86744
86745 2021-09-30  Dimitar Dimitrov  <dimitar@dinux.eu>
86746
86747         ld: pru: Fix resource_table output section alignment
86748         My commit 261980de18b added alignment for the resource table symbol.
86749         But it is wrong.  The Linux remoteproc driver loads and interprets the
86750         contents of the .resource_table ELF section, not of a table symbol.
86751
86752         Without this patch, if the linker happens to output padding for symbol
86753         alignment, then the resource table contents as viewed by the kernel
86754         loader would "shift" and look corrupted.
86755
86756         ld/ChangeLog:
86757
86758                 * scripttempl/pru.sc  (.resource_table): Align the output
86759                 section, not the first symbol.
86760
86761 2021-09-30  Tom Tromey  <tromey@adacore.com>
86762
86763         Fix Windows crash from stop_pc change
86764         The "make thread_suspend_state::stop_pc optional" patch caused a
86765         regression on Windows when using shared libraries.  I tracked this
86766         down to an unguarded use of stop_pc() in the TARGET_WAITKIND_LOADED
86767         case of handle_inferior_event.  This patch fixes the bug by ensuring
86768         that the stop PC is set at this point.
86769
86770 2021-09-30  Tom de Vries  <tdevries@suse.de>
86771
86772         [gdb/testsuite] Use untested in gdb.debuginfod/fetch_src_and_symbols.exp
86773         With running test-case gdb.debuginfod/fetch_src_and_symbols.exp with target
86774         board unix/-bad, I get:
86775         ...
86776         gcc: error: unrecognized command line option '-bad'^M
86777         compiler exited with status 1
86778         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86779         FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: compile
86780         ...
86781
86782         Replace the FAIL with the usual:
86783         ...
86784         UNTESTED: gdb.debuginfod/fetch_src_and_symbols.exp: failed to compile
86785         ...
86786
86787         Tested on x86_64-linux.
86788
86789 2021-09-30  Tom de Vries  <tdevries@suse.de>
86790
86791         [gdb/testsuite] Remove redundant FAIL in gdb.base/info-os.exp
86792         When running test-case gdb.base/info-os.exp with target board unix/-bad, I run
86793         into:
86794         ...
86795         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86796         UNTESTED: gdb.base/info-os.exp: failed to prepare
86797         FAIL: gdb.base/info-os.exp: cannot compile test program
86798         ...
86799
86800         Remove the redundant FAIL.
86801
86802         Tested on x86_64-linux.
86803
86804 2021-09-30  Tom de Vries  <tdevries@suse.de>
86805
86806         [gdb/testsuite] Fix DUPLICATE in gdb.base/info-os.exp
86807         When running test-case gdb.base/info-os.exp, I run into:
86808         ...
86809         PASS: gdb.base/info-os.exp: get threads
86810         PASS: gdb.base/info-os.exp: get threads
86811         DUPLICATE: gdb.base/info-os.exp: get threads
86812         ...
86813
86814         Fix this not doing pass followed by exp_continue in gdb_test_multiple.
86815
86816         Tested on x86_64-linux.
86817
86818 2021-09-30  Tom de Vries  <tdevries@suse.de>
86819
86820         [gdb/testsuite] Check compilation result in gdb.dwarf2/dw2-opt-structptr.exp
86821         When running test-case gdb.dwarf2/dw2-opt-structptr.exp with target board
86822         unix/-bad, I get:
86823         ...
86824         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86825         UNTESTED: gdb.dwarf2/dw2-opt-structptr.exp: dw2-opt-structptr.exp
86826         UNTESTED: gdb.dwarf2/dw2-opt-structptr.exp: failed to compile
86827         ERROR: (dw2-opt-structptr) No such file or directory
86828         UNRESOLVED: gdb.dwarf2/dw2-opt-structptr.exp: console: set print object on
86829         ...
86830
86831         Merge the two UNTESTEDs.
86832
86833         Fix the UNRESOLVED by checking result of compilation.
86834
86835         Tested on x86_64-linux.
86836
86837 2021-09-30  Tom de Vries  <tdevries@suse.de>
86838
86839         [gdb/testsuite] Check compilation result in gdb.base/structs.exp
86840         When running test-case gdb.base/structs.exp with target board unix/-bad, I
86841         get:
86842         ...
86843         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86844         UNTESTED: gdb.base/structs.exp: failed to prepare
86845         ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/structs.exp.
86846         ERROR: can't read "use_gdb_stub": no such variable
86847         ...
86848
86849         Fix this by checking the compilation result.
86850
86851         Fix the resulting DUPLICATEs using with_test_prefix.
86852
86853         Tested on x86_64-linux.
86854
86855 2021-09-30  Tom de Vries  <tdevries@suse.de>
86856
86857         [gdb/testsuite] Prepare nodebug exec in gdb.base/cvexpr.exp
86858         When running test-case gdb.base/cvexpr.exp with target board unix/-bad, I get:
86859         ...
86860         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86861         ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/cvexpr.exp.
86862         ERROR: can't read "use_gdb_stub": no such variable
86863         ...
86864
86865         This is triggered in a part of the test that claims to require no debug
86866         information, but uses the exec containing either dwarf or ctf.
86867
86868         Fix this by preparing another executable compiled with nodebug, and using
86869         that one instead.
86870
86871         Also use with_test_prefix to mark the nodebug part, such that we have:
86872         ...
86873         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86874         UNTESTED: gdb.base/cvexpr.exp: dwarf: failed to prepare
86875         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86876         UNTESTED: gdb.base/cvexpr.exp: nodebug: failed to prepare
86877         ...
86878
86879         Tested on x86_64-linux.
86880
86881 2021-09-30  Tom de Vries  <tdevries@suse.de>
86882
86883         [gdb/testsuite] Fix DUPLICATE in gdb.base/cvexpr.exp
86884         Fix:
86885         ...
86886         DUPLICATE: gdb.base/cvexpr.exp: ptype int * restrict
86887         ...
86888         using with_test_prefix.
86889
86890         Tested on x86_64-linux.
86891
86892 2021-09-30  Tom de Vries  <tdevries@suse.de>
86893
86894         [gdb/testsuite] Check compilation result in gdb.base/call-sc.exp
86895         When running test-case gdb.base/call-sc.exp with target board unix/-bad, I
86896         get:
86897         ...
86898         gdb compile failed, gcc: error: unrecognized command line option '-bad'
86899         UNTESTED: gdb.base/call-sc.exp: failed to prepare
86900         ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/call-sc.exp.
86901         ERROR: can't read "use_gdb_stub": no such variable
86902         ...
86903
86904         Fix this by checking the compilation result.
86905
86906         Fix the resulting DUPLICATE:
86907         ...
86908         DUPLICATE: gdb.base/call-sc.exp: failed to prepare
86909         ...
86910         using with_test_prefix.
86911
86912         Tested on x86_64-linux.
86913
86914 2021-09-30  Tom de Vries  <tdevries@suse.de>
86915
86916         [gdb/testsuite] Fix untested messages in gdb.mi/*.exp
86917         The effect of:
86918         ...
86919         untested "y.exp"
86920         ...
86921         in a gdb.x/y.exp is:
86922         ...
86923         UNTESTED: gdb.x/y.exp: y.exp
86924         ...
86925         which is a bit pointless.
86926
86927         Replace these untested messages in gdb.mi/*.exp with the usual "failed to
86928         compile".
86929
86930         Likewise for an:
86931         ...
86932         untested $testname
86933         ...
86934         where the variable is undefined.
86935
86936         Tested on x86_64-linux.
86937
86938 2021-09-30  Nick Clifton  <nickc@redhat.com>
86939
86940         make objcopy fail if it is asked to redefine symbols in an object file containing LTO information.
86941                 * objcopy.c (filter_symbols): Fail if attempting to dredefine
86942                 symbols in an LTO object file.
86943
86944 2021-09-30  Tom de Vries  <tdevries@suse.de>
86945
86946         [gdb/testsuite] Fix full buffer in gdb.rust/dwindex.exp
86947         On ubuntu 18.04.5, I run into:
86948         ...
86949         (gdb) mt print objfiles dwindex^M
86950         ^M
86951         Object file build/gdb/testsuite/outputs/gdb.rust/dwindex/dwindex:  \
86952           Objfile at 0x55dab0b87a50, bfd at 0x55dab0b0cfa0, 1095 minsyms^M
86953         ^M
86954         Psymtabs:^M
86955         vendor/compiler_builtins/src/int/specialized_div_rem/mod.rs at 0x55dab0db0720^M
86956           ...
86957         library/std/src/sys/unix/stdio.rs at 0x55dab0d96320^M
86958         ERROR: internal buffer is full.
86959         UNRESOLVED: gdb.rust/dwindex.exp: check if index present
86960         ...
86961
86962         Fix this by using -lbl in proc ensure_gdb_index.
86963
86964         Tested on x86_64-linux.
86965
86966 2021-09-30  Libor Bukata  <libor.bukata@oracle.com>
86967
86968         Add Solaris specific ELF note processing
86969         Add elfcore_grok_solaris_note function that enables to
86970         obtain process status, register values, and program info
86971         from Solaris's core files.
86972
86973         bfd/
86974                 * elf.c (elfcore_grok_solaris_note): Solaris specific ELF
86975                 note parser. Better GDB's coredump analysis on Solaris...
86976                 (elfcore_grok_solaris_note_impl): New function.
86977                 (elfcore_grok_solaris_prstatus): New function.
86978                 (elfcore_grok_solaris_info): New function.
86979                 (elfcore_grok_solaris_lwpstatus): New function.
86980                 (elf_parse_notes): Added "CORE" groker element.
86981         include/
86982                 * elf/common.h: Add note segment constants for core files on
86983                 Solaris systems.
86984
86985 2021-09-30  Frederic Cambus  <fred@statdns.com>
86986
86987         Add support to readelf for reading OpenBSD ELF core notes.
86988                 * readelf.c (get_openbsd_elfcore_note_type): New function.
86989                 (process_note): Add support for OpenBSD core notes.
86990
86991 2021-09-30  GDB Administrator  <gdbadmin@sourceware.org>
86992
86993         Automatic date update in version.in
86994
86995 2021-09-29  Tom de Vries  <tdevries@suse.de>
86996
86997         [gdb/testsuite] Fix gdb.base/break-interp.exp for ld.so without debug
86998         When running test-case gdb.base/break-interp.exp on openSUSE Leap 42.3, I get:
86999         ...
87000         (gdb) info addr dl_main^M
87001         Symbol "dl_main" is at 0x1750 in a file compiled without debugging.^M
87002         (gdb) FAIL: gdb.base/break-interp.exp: info addr dl_main
87003         ...
87004         while the regexp expects "Symbol \"dl_main\" is a function at address $hex\\."
87005
87006         Fix this by also accepting this variant.
87007
87008         Tested on x86_64-linux.
87009
87010 2021-09-29  H.J. Lu  <hjl.tools@gmail.com>
87011
87012         Add a testcase for PR binutils/27202
87013                 PR binutils/27202
87014                 * testsuite/gas/elf/dwarf-5-loc0.d: New file.
87015                 * testsuite/gas/elf/dwarf-5-loc0.s: Likewise.
87016                 * testsuite/gas/elf/elf.exp: Run dwarf-5-loc0.
87017
87018 2021-09-29  Pedro Alves  <pedro@palves.net>
87019
87020         Fix gdb.multi/multi-term-settings.exp race
87021         The gdb.multi/multi-term-settings.exp testcase sometimes fails like so:
87022
87023          Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.multi/multi-term-settings.exp ...
87024          FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT)
87025
87026         It's easier to reproduce if you stress the machine at the same time, like e.g.:
87027
87028           $ stress -c 24
87029
87030         Looking at gdb.log, we see:
87031
87032          (gdb) attach 60422
87033          Attaching to program: build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings, process 60422
87034          [New Thread 60422.60422]
87035          Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...
87036          Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.31.so...
87037          Reading symbols from /lib64/ld-linux-x86-64.so.2...
87038          (No debugging symbols found in /lib64/ld-linux-x86-64.so.2)
87039          0x00007f2fc2485334 in __GI___clock_nanosleep (clock_id=<optimized out>, clock_id@entry <mailto:clock_id@entry>=0, flags=flags@entry <mailto:flags@entry>=0, req=req@entry <mailto:req@entry>=0x7ffe23126940, rem=rem@entry <mailto:rem@entry>=0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
87040          78     ../sysdeps/unix/sysv/linux/clock_nanosleep.c: No such file or directory.
87041          (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: inf2: attach
87042          set schedule-multiple on
87043          (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: set schedule-multiple on
87044          info inferiors
87045            Num  Description       Connection                         Executable
87046            1    process 60404     1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings
87047          * 2    process 60422     1 (extended-remote localhost:2349) build/gdb/testsuite/outputs/gdb.multi/multi-term-settings/multi-term-settings
87048          (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: info inferiors
87049          pid=60422, count=46
87050          pid=60422, count=47
87051          pid=60422, count=48
87052          pid=60422, count=49
87053          pid=60422, count=50
87054          pid=60422, count=51
87055          pid=60422, count=52
87056          pid=60422, count=53
87057          pid=60422, count=54
87058          pid=60422, count=55
87059          pid=60422, count=56
87060          pid=60422, count=57
87061          pid=60422, count=58
87062          pid=60422, count=59
87063          pid=60422, count=60
87064          pid=60422, count=61
87065          pid=60422, count=62
87066          pid=60422, count=63
87067          pid=60422, count=64
87068          pid=60422, count=65
87069          pid=60422, count=66
87070          pid=60422, count=67
87071          pid=60422, count=68
87072          pid=60422, count=69
87073          pid=60404, count=54
87074          pid=60404, count=55
87075          pid=60404, count=56
87076          pid=60404, count=57
87077          pid=60404, count=58
87078          PASS: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: continue
87079          Quit
87080          (gdb) FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: stop with control-c (SIGINT)
87081
87082         If you look at the testcase's sources, you'll see that the intention
87083         is to resumes the program with "continue", wait to see a few of those
87084         "pid=..., count=..." lines, and then interrupt the program with
87085         Ctrl-C.  But somehow, that resulted in GDB printing "Quit", instead of
87086         the Ctrl-C stopping the program with SIGINT.
87087
87088         Here's what is happening:
87089
87090          #1 - those "pid=..., count=..." lines we see above weren't actually
87091               output by the inferior after it has been continued (see #1).
87092               Note that "inf1_how" and "inf2_how" are "attach".  What happened
87093               is that those "pid=..., count=..." lines were output by the
87094               inferiors _before_ they were attached to.  We see them at that
87095               point instead of earlier, because that's where the testcase
87096               reads from the inferiors' spawn_ids.
87097
87098          #2 - The testcase mistakenly thinks those "pid=..., count=..." lines
87099               happened after the continue was processed by GDB, meaning it has
87100               waited enough, and so sends the Ctrl-C.  GDB hasn't yet passed
87101               the terminal to the inferior, so the Ctrl-C results in that
87102               Quit.
87103
87104         The fix here is twofold:
87105
87106          #1 - flush inferior output right after attaching
87107
87108          #2 - consume the "Continuing" printed by "continue", indicating the
87109               inferior has the terminal.  This is the same as done throughout
87110               the testsuite to handle this exact problem of sending Ctrl-C too
87111               soon.
87112
87113         gdb/testsuite/ChangeLog:
87114         yyyy-mm-dd  Pedro Alves  <pedro@palves.net <mailto:pedro@palves.net>>
87115
87116                 * gdb.multi/multi-term-settings.exp (create_inferior): Flush
87117                 inferior output.
87118                 (coretest): Use $gdb_test_name.  After issuing "continue", wait
87119                 for "Continuing".
87120
87121         Change-Id: Iba7671dfe1eee6b98d29cfdb05a1b9aa2f9defb9
87122
87123 2021-09-29  Tom de Vries  <tdevries@suse.de>
87124
87125         [gdb/testsuite] Disable vgdb tests if xml not supported
87126         I build gdb without xml support using --without-expat, and ran into:
87127         ...
87128         (gdb) target remote | vgdb --wait=2 --max-invoke-ms=2500 --pid=22032^M
87129         Remote debugging using | vgdb --wait=2 --max-invoke-ms=2500 --pid=22032^M
87130         relaying data between gdb and process 22032^M
87131         warning: Can not parse XML target description; XML support was disabled at \
87132           compile time^M
87133           ...
87134         (gdb) PASS: gdb.base/valgrind-infcall.exp: continue #1
87135         p gdb_test_infcall ()^M
87136         Remote 'g' packet reply is too long (expected 560 bytes, got 800 bytes): ...^M
87137         (gdb) FAIL: gdb.base/valgrind-infcall.exp: p gdb_test_infcall ()
87138         ...
87139
87140         After googling the error message with context valgrind gdbserver, I found
87141         indications that the Remote 'g' packet reply error is due to missing xml
87142         support.
87143
87144         And here ( https://www.valgrind.org/docs/manual/manual-core-adv.html ) I
87145         found:
87146         ...
87147         GDB version needed for ARM and PPC32/64.
87148
87149         You must use a GDB version which is able to read XML target description sent
87150         by a gdbserver.  This is the standard setup if GDB was configured and built
87151         with the "expat" library.  If your GDB was not configured with XML support, it
87152         will report an error message when using the "target" command.  Debugging will
87153         not work because GDB will then not be able to fetch the registers from the
87154         Valgrind gdbserver.
87155         ...
87156
87157         So I guess I'm running into the same problem for x86_64.
87158
87159         Fix this by skipping all gdb.base/valgrind-*.exp tests if xml support is not
87160         available.  Although only the gdb.base/valgrind-infcall*.exp produce fails,
87161         the Remote 'g' packet reply error occurs in all tests, so it seems prudent to
87162         disable them all.
87163
87164         Tested on x86_64-linux.
87165
87166 2021-09-29  Tom de Vries  <tdevries@suse.de>
87167
87168         [gdb/testsuite] Fix gdb.python/py-breakpoint.exp with python 2
87169         With a gdb build using python 2.7, I run into:
87170         ...
87171         (gdb) python \
87172           gdb.events.breakpoint_modified.connect(lambda bp: print(bp.enabled))^M
87173           File "<string>", line 1^M
87174             gdb.events.breakpoint_modified.connect(lambda bp: print(bp.enabled))^M
87175                                                                   ^^M
87176         SyntaxError: invalid syntax^M
87177         Error while executing Python code.^M
87178         (gdb) FAIL: gdb.python/py-breakpoint.exp: test_bkpt_auto_disable: \
87179           trap breakpoint_modified event
87180         ...
87181
87182         This is caused by the following:
87183         - a lambda function body needs to be an expression
87184         - in python 2, print is a statement, while in python 3 it's a function
87185         - a function call is an expression, and a statement is not.
87186
87187         Fix this by defining a function print_bp_enabled:
87188         ...
87189         def print_bp_enabled (bp):
87190             print (bp.enabled)
87191         end
87192         ...
87193         and using that instead.
87194
87195         Tested on x86_64-linux.
87196
87197 2021-09-29  Tom de Vries  <tdevries@suse.de>
87198
87199         [gdb/testsuite] Fix breakpoint detection in gdb.gdb/python-helper.exp
87200         With a gdb configured to be somewhat minimal, while still supporting python:
87201         ...
87202         $ gdb --configuration
87203         This GDB was configured as follows:
87204            configure --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
87205                      --with-auto-load-dir=$debugdir:$datadir/auto-load
87206                      --with-auto-load-safe-path=$debugdir:$datadir/auto-load
87207                      --without-expat
87208                      --with-gdb-datadir=$install/share/gdb (relocatable)
87209                      --with-jit-reader-dir=$install/lib64/gdb (relocatable)
87210                      --without-libunwind-ia64
87211                      --without-lzma
87212                      --without-babeltrace
87213                      --without-intel-pt
87214                      --with-mpfr
87215                      --without-xxhash
87216                      --with-python=/usr
87217                      --with-python-libdir=/usr/lib
87218                      --with-debuginfod
87219                      --without-guile
87220                      --disable-source-highlight
87221                      --with-separate-debug-dir=/usr/lib/debug
87222                      --with-system-gdbinit=$devel/system-gdbinit
87223         ...
87224         and using gcc 4.8 to build gdb (causing std::thread not to be used due to
87225         PR28318) I ran into:
87226         ...
87227         (gdb) PASS: gdb.gdb/python-helper.exp: start inner gdb
87228         print 1^M
87229         ^M
87230         Breakpoint 2, value_print () at src/gdb/valprint.c:1174^M
87231         1174      scoped_value_mark free_values;^M
87232         (xgdb) FAIL: gdb.gdb/python-helper.exp: hit breakpoint in inner gdb (timeout)
87233         ...
87234
87235         The problem is that the regexp expects "hit Breakpoint $decimal".  The "hit"
87236         part is missing.
87237
87238         The "hit" is printed by maybe_print_thread_hit_breakpoint, when
87239         show_thread_that_caused_stop returns true:
87240         ...
87241         int
87242         show_thread_that_caused_stop (void)
87243         {
87244           return highest_thread_num > 1;
87245         }
87246         ...
87247         Apparently, that's not the case.
87248
87249         Fix this by removing "hit" from the regexp, making the regexp more similar to
87250         what is used in say, continue_to_breakpoint.
87251
87252         Tested on x86_64-linux.
87253
87254 2021-09-29  Andrew Burgess  <andrew.burgess@embecosm.com>
87255
87256         gdb: fix build when libbacktrace and execinfo backtrace are not available
87257         In this commit:
87258
87259           commit abbbd4a3e0ca51132e7fb31a43f896d29894dae0
87260           Date:   Wed Aug 11 13:24:33 2021 +0100
87261
87262               gdb: use libbacktrace to create a better backtrace for fatal signals
87263
87264         The build of GDB was broken iff, the execinfo backtrace API is not
87265         available, and, libbacktrace is either disabled, or not usable.  In
87266         this case you'll see build errors like this:
87267
87268               CXX    bt-utils.o
87269             /home/username/src/binutils-gdb/gdb/bt-utils.c: In function 'void gdb_internal_backtrace()':
87270             /home/username/src/binutils-gdb/gdb/bt-utils.c:165:5: error: 'gdb_internal_backtrace_1' was not declared in this scope
87271                  gdb_internal_backtrace_1 ();
87272                  ^~~~~~~~~~~~~~~~~~~~~~~~
87273
87274         This commit fixes the issue by guarding the call to
87275         gdb_internal_backtrace_1 with '#ifdef GDB_PRINT_INTERNAL_BACKTRACE',
87276         which is only defined when one of the backtrace libraries are
87277         available.
87278
87279 2021-09-29  Andrew Burgess  <andrew.burgess@embecosm.com>
87280
87281         gdb/doc: use 'standard error stream' instead of 'stderr' in some places
87282         With this commit:
87283
87284           commit 91f2597bd24d171c1337a4629f8237aa47c59082
87285           Date:   Thu Aug 12 18:24:59 2021 +0100
87286
87287               gdb: print backtrace for internal error/warning
87288
87289         I included some references to 'stderr', which, it was pointed out,
87290         would be better written as 'standard error stream'.  See:
87291
87292           https://sourceware.org/pipermail/gdb-patches/2021-September/182225.html
87293
87294         This commit replaces the two instances of 'stderr' that I introduced.
87295
87296 2021-09-29  Andrew Burgess  <andrew.burgess@embecosm.com>
87297
87298         gdb: fix manor -> manner typo in some comments
87299         In a recent commit I used 'manor' in some comments rather than
87300         'manner'.  This commit fixes those two mistakes.
87301
87302         I also looked through the gdb/ tree and found one additional instance
87303         of this mistake that this commit also fixes.
87304
87305 2021-09-29  Alan Modra  <amodra@gmail.com>
87306
87307         PR27202, readelf -wL doesn't work on ".loc 0"
87308         For DWARF revision 4 and earlier, display_debug_lines_decoded
87309         populates the file_table array with entries read from .debug_line
87310         after the directory table.  file_table[0] contains the first entry.
87311         DWARF rev 4 line number programs index this entry as file number one.
87312         DWARF revision 5 changes .debug_line format quite extensively, and in
87313         particular gives file number zero a meaning.
87314
87315                 PR 27202
87316                 * dwarf.c (display_debug_lines_decoded): Correct indexing used
87317                 for DWARF5 files.
87318
87319 2021-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
87320
87321         gdb: enable target_async around stop_all_threads call in process_initial_stop_replies
87322         The following scenario hangs:
87323
87324          - maint set target-non-stop on
87325          - `gdbserver --attach`
87326          - a multi-threaded program
87327
87328         For example:
87329
87330         Terminal 1:
87331
87332             $ gnome-calculator&
87333             [1] 495731
87334             $ ../gdbserver/gdbserver --once --attach :1234 495731
87335             Attached; pid = 495731
87336             Listening on port 1234
87337
87338         Terminal 2:
87339
87340             $ ./gdb -nx -q --data-directory=data-directory /usr/bin/gnome-calculator -ex "maint set target-non-stop on" -ex "tar rem :1234"
87341             Reading symbols from /usr/bin/gnome-calculator...
87342             (No debugging symbols found in /usr/bin/gnome-calculator)
87343             Remote debugging using :1234
87344             * hangs *
87345
87346         What happens is:
87347
87348          - The protocol between gdb and gdbserver is in non-stop mode, but the
87349            user-visible behavior is all-stop
87350          - On connect, gdbserver sends one stop reply for one thread that is
87351            stops, the others stay running
87352          - In process_initial_stop_replies, gdb calls stop_all_threads to stop
87353            these other threads, because we are using the all-stop user-visible
87354            mode
87355          - stop_all_threads sends a stop request for all the running threads and
87356            then waits for resulting events
87357          - At this point, the remote target is in target_async(0) mode, which
87358            makes stop_all_threads not consider it for events
87359          - stop_all_threads loops indefinitely (it does not even block
87360            indefinitely, it is in an infinite busy loop) because there are no
87361            event sources.  wait_one_event returns a TARGET_WAITKIND_NO_RESUMED
87362            wait status.
87363
87364         Fix that by making the remote target async around the stop_all_threads
87365         call.
87366
87367         I haven't implemented it because I'm not sure how to do it, but I think
87368         it would be a good idea to have, in stop_all_threads / wait_one /
87369         handle_one, an assert to check that if we are expecting one or more
87370         event, then there are some targets that are in a state where they can
87371         supply some events.  Otherwise, we'll necessarily be stuck in this
87372         infinite loop, and it's probably due to a bug in GDB.  I'm not too sure
87373         where to put this or how to express it though.  Perhaps in
87374         stop_all_threads, here:
87375
87376                   for (int i = 0; i < waits_needed; i++)
87377                     {
87378                       wait_one_event event = wait_one ();
87379                       *here*
87380                       if (handle_one (event))
87381                         break;
87382                     }
87383
87384         If at that point, the returned event is TARGET_WAITKIND_NO_RESUMED,
87385         there's a problem.  We expect some event, because we've asked some
87386         threads to stop, but all targets are answering that they won't have any
87387         events for us.  That's a contradiction, and a sign that something has
87388         gone wrong.  It could perhaps event be:
87389
87390             gdb_assert (event.ws.kind != TARGET_WAITKIND_NO_RESUMED);
87391
87392         in handle_one, as the idea is the same in prepare_for_detach.
87393
87394         A bit more sophisticated would be: we know which targets we are
87395         expecting waits from, since we know which threads we have asked to
87396         stop.  So if any of these targets returns TARGET_WAITKIND_NO_RESUMED,
87397         something is fishy.
87398
87399         Add a test that tests attaching with gdbserver's --attach flag to a
87400         multi-threaded program, and then connecting to it.  Without the fix, the
87401         test reproduces the hang.
87402
87403         Change-Id: If6f6690a4887ca66693ef1af64791dda4c65f24f
87404
87405 2021-09-29  GDB Administrator  <gdbadmin@sourceware.org>
87406
87407         Automatic date update in version.in
87408
87409 2021-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
87410
87411         gdb: fix darwin-nat build (again)
87412         I made a mistake in the previous patch.  Adjust the format string to
87413         match the arguments.
87414
87415         Change-Id: I4d45e0e0adb78eb3b5a06ba1a5287155940056ba
87416
87417 2021-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
87418
87419         gdb: fix darwin-nat build
87420         There are two errors of this kind:
87421
87422               CXX    darwin-nat.o
87423             /Users/smarchi/src/binutils-gdb/gdb/darwin-nat.c:1175:19: error: format specifies type 'unsigned long' but the argument has type 'ULONGEST' (aka 'unsigned long long') [-Werror,-Wformat]
87424                  ptid.pid (), ptid.tid ());
87425                               ^~~~~~~~~~~
87426
87427         Fix them by using ptid_t's to_string method.
87428
87429         Change-Id: I52087d5f7ee0fc01ac8b3f87d4db0217cb0d7cc7
87430
87431 2021-09-29  Simon Marchi  <simon.marchi@polymtl.ca>
87432
87433         gdb.base/foll-fork.exp: accept "info breakpoints" output in any order
87434         The test currently requires the "inf 1" breakpoint to be before the "inf
87435         2" breakpoint.  This is not always the case:
87436
87437             info breakpoints 2
87438             Num     Type           Disp Enb Address            What
87439             2       breakpoint     keep y   <MULTIPLE>
87440             2.1                         y   0x0000555555554730 in callee at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c:9 inf 2
87441             2.2                         y   0x0000555555554730 in callee at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c:9 inf 1
87442             (gdb) FAIL: gdb.base/foll-fork.exp: follow-fork-mode=parent: detach-on-fork=off: cmd=next 2: test_follow_fork: info breakpoints
87443
87444         Since add_location_to_breakpoint uses only the address as a criterion to
87445         sort locations, the order of locations at the same address is not
87446         stable: it will depend on the insertion order.  Here, the insertion
87447         order comes from the order of SALs when creating the breakpoint, which
87448         can vary from machine to machine.  While it would be more user-friendly
87449         to have a more stable order for printed breakpoint locations, it doesn't
87450         really matter for this test, and it would be hard to define an order
87451         that will be the same everywhere, all the time.
87452
87453         So, loosen the regexp to accept "inf 1" and "inf 2" in any order.
87454
87455         Co-Authored-By: Pedro Alves <pedro@palves.net>
87456         Change-Id: I5ada2e0c6ad0669e0d161bfb6b767229c0970d16
87457
87458 2021-09-28  Cooper Qu  <cooper.qu@linux.alibaba.com>
87459
87460         RISC-V: Fix wrong version number when arch contains 'p'.
87461         When specify a default version for p extension in
87462         riscv_supported_std_ext[](elfxx-riscv.c) and assembling with
87463         -march=rv32imacp, the c extension's version in attribute will become
87464         0p0, the expectation is 2p0.
87465
87466         TODO: Remember to add testcase when we have supported standrad p in
87467         the future.
87468
87469         bfd/
87470                 PR gas/28372
87471                 * elfxx-riscv.c (riscv_parsing_subset_version): Break if p
87472                 represent the 'p' extension.
87473
87474         Change-Id: Ia4e0cf26f3d7d07acaee8cefd86707ecac663a59
87475
87476 2021-09-28  Nelson Chu  <nelson.chu@sifive.com>
87477
87478         RISC-V: Allow to add numbers in the prefixed extension names.
87479         We need to allow adding numbers in the prefixed extension names, since
87480         the zve<32,64><d,f,x> extensions are included in the forzen rvv v1.0 spec
87481         recently.  But there are two restrictions as follows,
87482
87483         * The extension name ends with <number>p is invalid, since this may
87484         be confused with extension with <number>.0 version.  We report errors
87485         for this case.
87486
87487         Invalid format: [z|h|s|zvm|x][0-9a-z]+[0-9]+p
87488
87489         * The extension name ends with numbers is valid, but the numbers will
87490         be parsed as major version, so try to avoid naming extensions like this.
87491
87492         bfd/
87493                 * elfxx-riscv.c (riscv_recognized_prefixed_ext): Renamed from
87494                 riscv_valid_prefixed_ext/
87495                 (riscv_parsing_subset_version): The extensions end with <number>p
87496                 is forbidden, we already report the detailed errors in the
87497                 riscv_parse_prefixed_ext, so clean the code and unused parameters.
87498                 (riscv_parse_std_ext): Updated.
87499                 (riscv_parse_prefixed_ext): Rewrite the parser to allow numbers
87500                 in the prefixed extension names.
87501         gas/
87502                 * testsuite/gas/riscv/march-fail-invalid-x-01.d: New testcases.
87503                 * testsuite/gas/riscv/march-fail-invalid-x-02.d: Likewise.
87504                 * testsuite/gas/riscv/march-fail-invalid-z-01.d: Likewise.
87505                 * testsuite/gas/riscv/march-fail-invalid-z-02.d: Likewise.
87506                 * testsuite/gas/riscv/march-fail-invalid.l: Likewise.
87507                 * testsuite/gas/riscv/march-fail-version-x.d: Removed.
87508                 * testsuite/gas/riscv/march-fail-version-z.d: Likewise.
87509                 * testsuite/gas/riscv/march-fail-version.l: Likewise.
87510
87511 2021-09-28  Andrew Burgess  <andrew.burgess@embecosm.com>
87512
87513         gdb: print backtrace for internal error/warning
87514         This commit builds on previous work to allow GDB to print a backtrace
87515         of itself when GDB encounters an internal-error or internal-warning.
87516         This fixes PR gdb/26377.
87517
87518         There's not many places where we call internal_warning, and I guess in
87519         most cases the user would probably continue their debug session.  And
87520         so, in order to avoid cluttering up the output, by default, printing
87521         of a backtrace is off for internal-warnings.
87522
87523         In contrast, printing of a backtrace is on by default for
87524         internal-errors, as I figure that in most cases hitting an
87525         internal-error is going to be the end of the debug session.
87526
87527         Whether a backtrace is printed or not can be controlled with the new
87528         settings:
87529
87530           maintenance set internal-error backtrace on|off
87531           maintenance show internal-error backtrace
87532
87533           maintenance set internal-warning backtrace on|off
87534           maintenance show internal-warning backtrace
87535
87536         Here is an example of what an internal-error now looks like with the
87537         backtrace included:
87538
87539           (gdb) maintenance internal-error blah
87540           ../../src.dev-3/gdb/maint.c:82: internal-error: blah
87541           A problem internal to GDB has been detected,
87542           further debugging may prove unreliable.
87543           ----- Backtrace -----
87544           0x5c61ca gdb_internal_backtrace_1
87545                 ../../src.dev-3/gdb/bt-utils.c:123
87546           0x5c626d _Z22gdb_internal_backtracev
87547                 ../../src.dev-3/gdb/bt-utils.c:165
87548           0xe33237 internal_vproblem
87549                 ../../src.dev-3/gdb/utils.c:393
87550           0xe33539 _Z15internal_verrorPKciS0_P13__va_list_tag
87551                 ../../src.dev-3/gdb/utils.c:470
87552           0x1549652 _Z14internal_errorPKciS0_z
87553                 ../../src.dev-3/gdbsupport/errors.cc:55
87554           0x9c7982 maintenance_internal_error
87555                 ../../src.dev-3/gdb/maint.c:82
87556           0x636f57 do_simple_func
87557                 ../../src.dev-3/gdb/cli/cli-decode.c:97
87558            .... snip, lots more backtrace lines ....
87559           ---------------------
87560           ../../src.dev-3/gdb/maint.c:82: internal-error: blah
87561           A problem internal to GDB has been detected,
87562           further debugging may prove unreliable.
87563           Quit this debugging session? (y or n) y
87564
87565           This is a bug, please report it.  For instructions, see:
87566           <https://www.gnu.org/software/gdb/bugs/>.
87567
87568           ../../src.dev-3/gdb/maint.c:82: internal-error: blah
87569           A problem internal to GDB has been detected,
87570           further debugging may prove unreliable.
87571           Create a core file of GDB? (y or n) n
87572
87573         My hope is that this backtrace might make it slightly easier to
87574         diagnose GDB issues if all that is provided is the console output, I
87575         find that we frequently get reports of an assert being hit that is
87576         located in pretty generic code (frame.c, value.c, etc) and it is not
87577         always obvious how we might have arrived at the assert.
87578
87579         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26377
87580
87581 2021-09-28  Andrew Burgess  <andrew.burgess@embecosm.com>
87582
87583         gdb: use libbacktrace to create a better backtrace for fatal signals
87584         GDB recently gained the ability to print a backtrace when a fatal
87585         signal is encountered.  This backtrace is produced using the backtrace
87586         and backtrace_symbols_fd API available in glibc.
87587
87588         However, in order for this API to actually map addresses to symbol
87589         names it is required that the application (GDB) be compiled with
87590         -rdynamic, which GDB is not by default.
87591
87592         As a result, the backtrace produced often looks like this:
87593
87594           Fatal signal: Bus error
87595           ----- Backtrace -----
87596           ./gdb/gdb[0x80ec00]
87597           ./gdb/gdb[0x80ed56]
87598           /lib64/libc.so.6(+0x3c6b0)[0x7fc2ce1936b0]
87599           /lib64/libc.so.6(__poll+0x4f)[0x7fc2ce24da5f]
87600           ./gdb/gdb[0x15495ba]
87601           ./gdb/gdb[0x15489b8]
87602           ./gdb/gdb[0x9b794d]
87603           ./gdb/gdb[0x9b7a6d]
87604           ./gdb/gdb[0x9b943b]
87605           ./gdb/gdb[0x9b94a1]
87606           ./gdb/gdb[0x4175dd]
87607           /lib64/libc.so.6(__libc_start_main+0xf3)[0x7fc2ce17e1a3]
87608           ./gdb/gdb[0x4174de]
87609           ---------------------
87610
87611         This is OK if you have access to the exact same build of GDB, you can
87612         manually map the addresses back to symbols, however, it is next to
87613         useless if all you have is a backtrace copied into a bug report.
87614
87615         GCC uses libbacktrace for printing a backtrace when it encounters an
87616         error.  In recent commits I added this library into the binutils-gdb
87617         repository, and in this commit I allow this library to be used by
87618         GDB.  Now (when GDB is compiled with debug information) the backtrace
87619         looks like this:
87620
87621           ----- Backtrace -----
87622           0x80ee08 gdb_internal_backtrace
87623                 ../../src/gdb/event-top.c:989
87624           0x80ef0b handle_fatal_signal
87625                 ../../src/gdb/event-top.c:1036
87626           0x7f24539dd6af ???
87627           0x7f2453a97a5f ???
87628           0x154976f gdb_wait_for_event
87629                 ../../src/gdbsupport/event-loop.cc:613
87630           0x1548b6d _Z16gdb_do_one_eventv
87631                 ../../src/gdbsupport/event-loop.cc:237
87632           0x9b7b02 start_event_loop
87633                 ../../src/gdb/main.c:421
87634           0x9b7c22 captured_command_loop
87635                 ../../src/gdb/main.c:481
87636           0x9b95f0 captured_main
87637                 ../../src/gdb/main.c:1353
87638           0x9b9656 _Z8gdb_mainP18captured_main_args
87639                 ../../src/gdb/main.c:1368
87640           0x4175ec main
87641                 ../../src/gdb/gdb.c:32
87642           ---------------------
87643
87644         Which seems much more useful.
87645
87646         Use of libbacktrace is optional.  If GDB is configured with
87647         --disable-libbacktrace then the libbacktrace directory will not be
87648         built, and GDB will not try to use this library.  In this case GDB
87649         would try to use the old backtrace and backtrace_symbols_fd API.
87650
87651         All of the functions related to writing the backtrace of GDB itself
87652         have been moved into the new files gdb/by-utils.{c,h}.
87653
87654 2021-09-28  Andrew Burgess  <andrew.burgess@embecosm.com>
87655
87656         src-release.sh: add libbacktrace to GDB_SUPPORT_DIRS
87657         After the previous commit that imported libbacktrace from gcc, this
87658         commit updates src-release.sh so that the libbacktrace directory is
87659         included in the gdb release tar file.
87660
87661         ChangeLog:
87662
87663                 * src-release.sh (GDB_SUPPPORT_DIRS): Add libbacktrace.
87664
87665 2021-09-28  Andrew Burgess  <andrew.burgess@embecosm.com>
87666
87667         Copy in libbacktrace from gcc
87668         This copies in libbacktrace from the gcc repository as it was in the
87669         commit 62e420293a293608f383d9b9c7f2debd666e9fc9.  GDB is going to
87670         start using this library soon.
87671
87672         A dependency between GDB and libbacktrace has already been added to
87673         the top level Makefile, so, after this commit, when building GDB,
87674         libbacktrace will be built first.  However, libbacktrace is not yet
87675         linked into GDB, or used by GDB in any way.
87676
87677         It is possible to stop libbacktrace being built by configuring the
87678         tree with --disable-libbacktrace.
87679
87680         This commit does NOT update src-release.sh, that will be done in the
87681         next commit, this commit ONLY imports libbacktrace from gcc.  This
87682         means that if you try to make a release of GDB from exactly this
87683         commit then the release tar file will not include libbacktrace.
87684         However, as libbacktrace is an optional dependency this is fine.
87685
87686 2021-09-28  Andrew Burgess  <andrew.burgess@embecosm.com>
87687
87688         gdb: Add a dependency between gdb and libbacktrace
87689         GDB is going to start using libbacktrace, so add a build dependency.
87690
87691         ChangeLog:
87692
87693                 * Makefile.def: Add all-gdb dependency on all-libbacktrace.
87694                 * Makefile.in: Regenerate.
87695
87696 2021-09-28  Andrew Burgess  <andrew.burgess@embecosm.com>
87697
87698         top-level configure: setup target_configdirs based on repository
87699         The top-level configure script is shared between the gcc repository
87700         and the binutils-gdb repository.
87701
87702         The target_configdirs variable in the configure.ac script, defines
87703         sub-directories that contain components that should be built for the
87704         target using the target tools.
87705
87706         Some components, e.g. zlib, are built as both host and target
87707         libraries.
87708
87709         This causes problems for binutils-gdb.  If we run 'make all' in the
87710         binutils-gdb repository we end up trying to build a target version of
87711         the zlib library, which requires the target compiler be available.
87712         Often the target compiler isn't immediately available, and so the
87713         build fails.
87714
87715         The problem with zlib impacted a previous attempt to synchronise the
87716         top-level configure scripts from gcc to binutils-gdb, see this thread:
87717
87718           https://sourceware.org/pipermail/binutils/2019-May/107094.html
87719
87720         And I'm in the process of importing libbacktrace in to binutils-gdb,
87721         which is also a host and target library, and triggers the same issues.
87722
87723         I believe that for binutils-gdb, at least at the moment, there are no
87724         target libraries that we need to build.
87725
87726         In the configure script we build three lists of things we want to
87727         build, $configdirs, $build_configdirs, and $target_configdirs, we also
87728         build two lists of things we don't want to build, $skipdirs and
87729         $noconfigdirs.  We then remove anything that is in the lists of things
87730         not to build, from the list of things that should be built.
87731
87732         My proposal is to add everything in target_configdirs into skipdirs,
87733         if the source tree doesn't contain a gcc/ sub-directory.  The result
87734         is that for binutils-gdb no target tools or libraries will be built,
87735         while for the gcc repository, nothing should change.
87736
87737         If a user builds a unified source tree, then the target tools and
87738         libraries should still be built as the gcc/ directory will be present.
87739
87740         I've tested a build of gcc on x86-64, and the same set of target
87741         libraries still seem to get built.  On binutils-gdb this change
87742         resolves the issues with 'make all'.
87743
87744         ChangeLog:
87745
87746                 * configure: Regenerate.
87747                 * configure.ac (skipdirs): Add the contents of target_configdirs if
87748                 we are not building gcc.
87749
87750 2021-09-28  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
87751
87752         PR28391, strip/objcopy --preserve-dates *.a: cannot set time
87753         After commit 985e0264516 copy_archive function began to pass invalid
87754         values to the utimensat(2) function when it tries to preserve
87755         timestamps in ar archives.  This happens because the bfd_stat_arch_elt
87756         implementation for ar archives fills only the st_mtim.tv_sec part of
87757         the st_mtim timespec structure, but leaves the st_mtim.tv_nsec part
87758         and the whole st_atim timespec untouched leaving them uninitialized
87759
87760                 PR 28391
87761                 * ar.c (extract_file): Clear buf for preserve_dates.
87762                 * objcopy.c (copy_archive): Likewise.
87763
87764 2021-09-28  Mike Frysinger  <vapier@gentoo.org>
87765
87766         sim: drop weak func attrs on module inits
87767         When I first wrote this, I was thinking we'd scan all source files
87768         that existed and generate a complete init list.  That means for any
87769         particular build, we'd probably have a few functions that didn't
87770         exist, so weak attributes was necessary.  What I ended up scanning
87771         though was only the source files that went into a particular build.
87772
87773         There was another concern too: a source file might be included, but
87774         the build settings would cause all of its contents to be skipped
87775         (via CPP defines).  So scanning via naive grep would pick up names
87776         not actually available.  A check of the source tree shows that we
87777         never do this, and it's pretty easy to institute a policy that we
87778         don't start (by at the very least including a stub init func).
87779
87780         The use of weak symbols ends up causing a problem in practice: for
87781         a few modules (like profiling), nothing else pulls it in, so the
87782         linker omits it entirely, which leads to the profiling module never
87783         being available.  So drop the weak markings since we know all these
87784         funcs will be available.
87785
87786 2021-09-28  Cui,Lili  <lili.cui@intel.com>
87787
87788         x86: Print {bad} on invalid broadcast in OP_E_memory
87789         Don't print broadcast for scalar_mode, and print {bad} for invalid broadcast.
87790
87791         gas/
87792
87793                 PR binutils/28381
87794                 * testsuite/gas/i386/bad-bcast.s: Add a new testcase.
87795                 * testsuite/gas/i386/bad-bcast.d: Likewise.
87796                 * testsuite/gas/i386/bad-bcast-intel.d: New.
87797
87798         opcodes/
87799
87800                 PR binutils/28381
87801                 * i386-dis.c (static struct): Add no_broadcast.
87802                 (OP_E_memory): Mark invalid broadcast with no_broadcast=1 and Print "{bad}"for it.
87803                 (intel_operand_size): mark invalid broadcast with no_broadcast=1.
87804                 (OP_XMM): Mark scalar_mode with no_broadcast=1.
87805
87806 2021-09-28  Simon Marchi  <simon.marchi@polymtl.ca>
87807
87808         gdb: use intrusive_list for linux-nat lwp_list
87809         Replace the manually maintained linked list of lwp_info objects with
87810         intrusive_list.  Replace the ALL_LWPS macro with all_lwps, which returns
87811         a range.  Add all_lwps_safe as well, for use in iterate_over_lwps, which
87812         currently iterates in a safe manner.
87813
87814         Change-Id: I355313502510acc0103f5eaf2fbde80897d6376c
87815
87816 2021-09-28  Simon Marchi  <simon.marchi@polymtl.ca>
87817
87818         gdb: add destructor to lwp_info
87819         Replace the lwp_free function with a destructor.  Make lwp_info
87820         non-copyable, since there is now a destructor (we wouldn't want an
87821         lwp_info object getting copied and this->arch_private getting deleted
87822         twice).
87823
87824         Change-Id: I09fcbe967e362566d3a06fed2abca2a9955570fa
87825
87826 2021-09-28  Simon Marchi  <simon.marchi@polymtl.ca>
87827
87828         gdb: make lwp_info non-POD
87829         Initialize all fields in the class declaration directly.  This opens the
87830         door to using intrusive_list, done in the following patch.
87831
87832         Change-Id: I38bb27410cd9ebf511d310bb86fe2ea1872c3b05
87833
87834 2021-09-28  GDB Administrator  <gdbadmin@sourceware.org>
87835
87836         Automatic date update in version.in
87837
87838 2021-09-27  Simon Marchi  <simon.marchi@efficios.com>
87839
87840         gdb: don't share aspace/pspace on fork with "detach-on-fork on" and "follow-fork-mode child"
87841         We found that when handling forks, two inferiors can unexpectedly share
87842         their program space and address space.  To reproduce:
87843
87844          1. Using a test program that forks...
87845          2. "set follow-fork-mode child"
87846          3. "set detach-on-fork on" (the default)
87847          4. run to a breakpoint somewhere after the fork
87848
87849         Step 4 should have created a new inferior:
87850
87851             (gdb) info inferiors
87852               Num  Description       Connection           Executable
87853               1    <null>                                 /home/smarchi/build/wt/amd/gdb/fork
87854             * 2    process 251425    1 (native)           /home/smarchi/build/wt/amd/gdb/fork
87855
87856         By inspecting the state of GDB, we can see that the two inferiors now
87857         share one program space and one address space:
87858
87859         Inferior 1:
87860
87861             (top-gdb) p inferior_list.m_front.num
87862             $2 = 1
87863             (top-gdb) p inferior_list.m_front.aspace
87864             $3 = (struct address_space *) 0x5595e2520400
87865             (top-gdb) p inferior_list.m_front.pspace
87866             $4 = (struct program_space *) 0x5595e2520440
87867
87868         Inferior 2:
87869
87870             (top-gdb) p inferior_list.m_front.next.num
87871             $5 = 2
87872             (top-gdb) p inferior_list.m_front.next.aspace
87873             $6 = (struct address_space *) 0x5595e2520400
87874             (top-gdb) p inferior_list.m_front.next.pspace
87875             $7 = (struct program_space *) 0x5595e2520440
87876
87877         You can then run inferior 1 again and the two inferiors will still
87878         erroneously share their spaces, but already at this point this is wrong.
87879
87880         The cause of the bad {a,p}space sharing is in follow_fork_inferior.
87881         When following the child and detaching from the parent, we just re-use
87882         the parent's spaces, rather than cloning them.  When we switch back to
87883         inferior 1 and run again, we find ourselves with two unrelated inferiors
87884         sharing spaces.
87885
87886         Fix that by creating new spaces for the parent after having moved them
87887         to the child.  My initial implementation created new spaces for the
87888         child instead.  Doing this breaks doing "next" over fork().  When "next"
87889         start, we record the symtab of the starting location.  When the program
87890         stops, we compare that symtab with the symtab the program has stopped
87891         at.  If the symtab or the line number has changed, we conclude the
87892         "next" is done.  If we create a new program space for the child and copy
87893         the parent's program space to it with clone_program_space, it creates
87894         new symtabs for the child as well.  When the child stop, but still on
87895         the fork() line, GDB thinks the "next" is done because the symtab
87896         pointers no longer match.  In reality they are two symtab instances that
87897         represent the same file.  But moving the spaces to the child and
87898         creating new spaces for the parent, we avoid this problem.
87899
87900         Note that the problem described above happens today with "detach-on-fork
87901         off" and "follow-fork-mode child", because we create new spaces for the
87902         child.  This will have to be addressed later.
87903
87904         Test-wise, improve gdb.base/foll-fork.exp to set a breakpoint that is
87905         expected to have a location in each inferiors.  Without the fix, when
87906         the two inferiors erroneously share a program space, GDB reports a
87907         single location.
87908
87909         Change-Id: Ifea76e14f87b9f7321fc3a766217061190e71c6e
87910
87911 2021-09-27  Simon Marchi  <simon.marchi@efficios.com>
87912
87913         gdb.base/foll-fork.exp: use foreach_with_prefix to handle prefixes
87914         No behavior change in the test expected, other than in the test names.
87915
87916         Change-Id: I111137483858ab0f23138439f2930009779a2b3d
87917
87918 2021-09-27  Simon Marchi  <simon.marchi@efficios.com>
87919
87920         gdb.base/foll-fork.exp: rename variables
87921         Rename the variables / parameters used to match the corresponding GDB
87922         setting name, I find that easier to follow.
87923
87924         Change-Id: Idcbddbbb369279fcf1e808b11a8c478f21b2a946
87925
87926 2021-09-27  Simon Marchi  <simon.marchi@efficios.com>
87927
87928         gdb.base/foll-fork.exp: refactor to restart GDB between each portion of the test
87929         This test is difficult to follow and modify because the state of GDB is
87930         preserved some tests.  Add a setup proc, which starts a new GDB and runs
87931         to main, and use it in all test procs.  Use proc_with_prefix to avoid
87932         duplicates.
87933
87934         The check_fork_catchpoints proc also seems used to check for follow-fork
87935         support by checking if catchpoints are supported.  If they are not, it
87936         uses "return -code return", which makes its caller return.  I find this
87937         unnecessary complex, versus just returning a boolean.  Modify it to do
87938         so.
87939
87940         Change-Id: I23e62b204286c5e9c5c86d2727f7d33fb126ed08
87941
87942 2021-09-27  Simon Marchi  <simon.marchi@efficios.com>
87943
87944         gdb.base/foll-fork.exp: remove gating based on target triplet
87945         It looks like this test has some code to check at runtime the support of
87946         fork handling of the target (see check_fork_catchpoints).  So, it seems
87947         to me that the check based on target triplet at the beginning of the
87948         test is not needed.  This kind of gating is generally not desirable,
87949         because we wouldn't think of updating it when adding fork support to a
87950         target.  For example, FreeBSD supports fork, but it wasn't listed here.
87951
87952         Change-Id: I6b55f2298edae6b37c3681fb8633d8ea1b5aabee
87953
87954 2021-09-27  Simon Marchi  <simon.marchi@efficios.com>
87955
87956         gdb.base/foll-fork.exp: remove DUPLICATEs
87957         Remove DUPLICATEs, and and at the same time replace two uses of
87958         gdb_test_multiple with gdb_test.  I don't think using gdb_test_multiple
87959         is necessary here.
87960
87961         Change-Id: I8dcf097c3364e92d4f0e11f0c0f05dbb88e86742
87962
87963 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
87964
87965         libctf, lookup: fix bounds of pptrtab lookup
87966         An off-by-one bug in the check for pptrtab lookup meant that we could
87967         access the pptrtab past its bounds (*well* past its bounds),
87968         particularly if we called ctf_lookup_by_name in a child dict with "*foo"
87969         where "foo" is a type that exists in the parent but not the child and no
87970         previous lookups by name have been carried out.  (Note that "*foo" is
87971         not even a valid thing to call ctf_lookup_by_name with: foo * is.
87972         Nonetheless, users sometimes do call ctf_lookup_by_name with invalid
87973         content, and it should return ECTF_NOTYPE, not crash.)
87974
87975         ctf_pptrtab_len, as its name suggests (and as other tests of it in
87976         ctf-lookup.c confirm), is one higher than the maximum valid permissible
87977         index, so the comparison is wrong.
87978
87979         (Test added, which should fail pretty reliably in the presence of this
87980         bug on any machine with 4KiB pages.)
87981
87982         libctf/ChangeLog
87983         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
87984
87985                 * ctf-lookup.c (ctf_lookup_by_name_internal): Fix pptrtab bounds.
87986                 * testsuite/libctf-writable/pptrtab-writable-page-deep-lookup.*:
87987                 New test.
87988
87989 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
87990
87991         libctf, testsuite: fix various warnings in tests
87992         These warnings are all off by default, but if they do fire you get
87993         spurious ERRORs when running make check-libctf.
87994
87995         libctf/ChangeLog
87996         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
87997
87998                 * testsuite/libctf-lookup/enum-symbol.c: Remove unused label.
87999                 * testsuite/libctf-lookup/conflicting-type-syms.c: Remove unused
88000                 variables.
88001                 * testsuite/libctf-regression/pptrtab.c: Likewise.
88002                 * testsuite/libctf-regression/type-add-unnamed-struct.c: Likewise.
88003                 * testsuite/libctf-writable/pptrtab.c: Likewise.
88004                 * testsuite/libctf-writable/reserialize-strtab-corruption.c:
88005                 Likewise.
88006                 * testsuite/libctf-regression/nonstatic-var-section-ld-r.c: Fix
88007                 format string.
88008                 * testsuite/libctf-regression/nonstatic-var-section-ld.c:
88009                 Likewise.
88010                 * testsuite/libctf-regression/nonstatic-var-section-ld.lk: Adjust.
88011                 * testsuite/libctf-writable/symtypetab-nonlinker-writeout.c: Fix
88012                 initializer.
88013
88014 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88015
88016         libctf: fix handling of CTF symtypetab sections emitted by older GCC
88017         Older (pre-upstreaming) GCC emits a function symtypetab section of a
88018         format never read by any extant libctf.  We can detect such CTF dicts by
88019         the lack of the CTF_F_NEWFUNCINFO flag in their header, and we do so
88020         when reading in the symtypetab section -- but if the set of symbols with
88021         types is sufficiently sparse, even an older GCC will emit a function
88022         index section.
88023
88024         In NEWFUNCINFO-capable compilers, this section will always be the exact
88025         same length as the corresponding function section (each is an array of
88026         uint32_t, associated 1:1 with each other). But this is not true for the
88027         older compiler, for which the sections are different lengths.  We check
88028         to see if the function symtypetab section and its index are the same
88029         length, but we fail to skip this check when this is not a NEWFUNCINFO
88030         dict, and emit a spurious corruption error for a CTF dict we could
88031         have perfectly well opened and used.
88032
88033         Fix trivial: check the flag (and fix the terrible grammar of the error
88034         message at the same time).
88035
88036         libctf/ChangeLog
88037         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88038
88039                 * ctf-open.c (ctf_bufopen_internal): Don't complain about corrupt
88040                 function index symtypetab sections if this is an old-format
88041                 function symtypetab section (which should be ignored in any case).
88042                 Fix bad grammar.
88043
88044 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88045
88046         configure: regenerate in all projects that use libtool.m4
88047         (including sim/, which has no changelog.)
88048
88049         bfd/ChangeLog
88050         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88051
88052                 * configure: Regenerate.
88053
88054         binutils/ChangeLog
88055         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88056
88057                 * configure: Regenerate.
88058
88059         gas/ChangeLog
88060         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88061
88062                 * configure: Regenerate.
88063
88064         gprof/ChangeLog
88065         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88066
88067                 * configure: Regenerate.
88068
88069         ld/ChangeLog
88070         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88071
88072                 * configure: Regenerate.
88073
88074         libctf/ChangeLog
88075         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88076
88077                 * configure: Regenerate.
88078                 * Makefile.in: Regenerate.
88079
88080         opcodes/ChangeLog
88081         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88082
88083                 * configure: Regenerate.
88084
88085         zlib/ChangeLog
88086         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88087
88088                 * configure: Regenerate.
88089
88090 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88091
88092         libctf: try several possibilities for linker versioning flags
88093         Checking for linker versioning by just grepping ld --help output for
88094         mentions of --version-script is inadequate now that Solaris 11.4
88095         implements a --version-script with different semantics.  Try linking a
88096         test program with a small wildcard-using version script with each
88097         supported set of flags in turn, to make sure that linker versioning is
88098         not only advertised but actually works.
88099
88100         The Solaris "GNU-compatible" linker versioning is not quite
88101         GNU-compatible enough, but we can work around the differences by
88102         generating a new version script that removes the comments from the
88103         original (Solaris ld requires #-style comments), and making another
88104         version script for libctf-nonbfd in particular which doesn't mention any
88105         of the symbols that appear in libctf.la, to avoid Solaris ld introducing
88106         corresponding new NOTYPE symbols to match the version script.
88107
88108         libctf/ChangeLog
88109         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88110
88111                 PR libctf/27967
88112                 * configure.ac (VERSION_FLAGS): Replace with...
88113                 (ac_cv_libctf_version_script): ... this multiple test.
88114                 (VERSION_FLAGS_NOBFD): Substitute this too.
88115                 * Makefile.am (libctf_nobfd_la_LDFLAGS): Use it.  Split out...
88116                 (libctf_ldflags_nover): ... non-versioning flags here.
88117                 (libctf_la_LDFLAGS): Use it.
88118                 * libctf.ver: Give every symbol not in libctf-nobfd a comment on
88119                 the same line noting as much.
88120
88121 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88122
88123         libtool.m4: fix nm BSD flag detection
88124         Libtool needs to get BSD-format (or MS-format) output out of the system
88125         nm, so that it can scan generated object files for symbol names for
88126         -export-symbols-regex support.  Some nms need specific flags to turn on
88127         BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
88128         Unfortunately the code to do this has a pair of interlocking flaws:
88129
88130          - it runs the test by doing an nm of /dev/null.  Some platforms
88131            reasonably refuse to do an nm on a device file, but before now this
88132            has only been worked around by assuming that the error message has a
88133            specific textual form emitted by Tru64 nm, and that getting this
88134            error means this is Tru64 nm and that nm -B would work to produce
88135            BSD-format output, even though the test never actually got anything
88136            but an error message out of nm -B.  This is fixable by nm'ing *nm
88137            itself* (since we necessarily have a path to it).
88138
88139          - the test is entirely skipped if NM is set in the environment, on the
88140            grounds that the user has overridden the test: but the user cannot
88141            reasonably be expected to know that libtool wants not only nm but
88142            also flags forcing BSD-format output.  Worse yet, one such "user" is
88143            the top-level Cygnus configure script, which neither tests for
88144            nor specifies any BSD-format flags.  So platforms needing BSD-format
88145            flags always fail to set them when run in a Cygnus tree, breaking
88146            -export-symbols-regex on such platforms.  Libtool also needs to
88147            augment $LD on some platforms, but this is done unconditionally,
88148            augmenting whatever the user specified: the nm check should do the
88149            same.
88150
88151            One wrinkle: if the user has overridden $NM, a path might have been
88152            provided: so we use the user-specified path if there was one, and
88153            otherwise do the path search as usual.  (If the nm specified doesn't
88154            work, this might lead to a few extra pointless path searches -- but
88155            the test is going to fail anyway, so that's not a problem.)
88156
88157         (Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
88158         symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
88159         *that* is a symlink to /usr/bin/nm.)
88160
88161         ChangeLog
88162         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88163
88164                 PR libctf/27967
88165                 * libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
88166                 NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
88167                 errors from nms that refuse to work on non-regular files.  Remove
88168                 other workarounds for this problem.  Strip out blank lines from the
88169                 nm output.
88170
88171 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88172
88173         libtool.m4: augment symcode for Solaris 11
88174         This reports common symbols like GNU nm, via a type code of 'C'.
88175
88176         ChangeLog
88177         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88178
88179                 PR libctf/27967
88180                 * libtool.m4 (lt_cv_sys_global_symbol_pipe): Augment symcode for
88181                 Solaris 11.
88182
88183 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88184
88185         libctf: link against libiberty before linking in libbfd or libctf-nobfd
88186         This ensures that the CTF_LIBADD, which always contains at least this
88187         when doing a shared link:
88188
88189         -L`pwd`/../libiberty/pic -liberty
88190
88191         appears in the link line before any requirements pulled in by libbfd.la,
88192         which include -liberty but because it is install-time do not include the
88193         -L`pwd`/../libiberty/pic portion (in an indirect dep like this, the path
88194         comes from the libbfd.la file, and is an install path).  libiberty also
88195         appears after libbfd in the link line by virtue of libctf-nobfd.la,
88196         because libctf-nobfd has to follow libbfd in the link line, and that
88197         needs symbols from libiberty too.
88198
88199         Without this, an installed liberty might well be pulled in by libbfd,
88200         and if --enable-install-libiberty is not specified this libiberty might
88201         be completely incompatible with what is being installed and break either
88202         or boht of libbfd and libctf. (The specific problem observed here is
88203         that bsearch_r was not present, but other problems might easily be
88204         observed in future too.)
88205
88206         Because ld links against libctf, this has a tendency to break the system
88207         linker at install time too, if installing with --prefix=/usr.  That's
88208         quite unpleasant to recover from.
88209
88210         libctf/ChangeLog
88211         2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
88212
88213                 PR libctf/27360
88214                 * Makefile.am (libctf_la_LIBADD): Link against libiberty
88215                 before pulling in libbfd.la or pulling in libctf-nobfd.la.
88216                 * Makefile.in: Regenerate.
88217
88218 2021-09-27  Tom de Vries  <tdevries@suse.de>
88219
88220         [gdb/build] Fix build with g++-4.8
88221         When building g++-4.8, we run into:
88222         ...
88223         src/gdb/dwarf2/read.c:919:5: error: multiple fields in union \
88224           'partial_die_info::<anonymous union>' initialized
88225         ...
88226
88227         This is due to:
88228         ...
88229             union
88230             {
88231               struct
88232               {
88233                CORE_ADDR lowpc = 0;
88234                CORE_ADDR highpc = 0;
88235               };
88236               ULONGEST ranges_offset;
88237             };
88238         ...
88239
88240         The error looks incorrect, given that only one union member is initialized,
88241         and does not reproduce with newer g++.
88242
88243         Nevertheless, work around this by moving the initialization to a constructor.
88244
88245         [ I considered just removing the initialization, with the idea that access
88246         should be guarded by has_pc_info, but I ran into one failure in the testsuite,
88247         for gdb.base/check-psymtab.exp due to add_partial_symbol using lowpc without
88248         checking has_pc_info. ]
88249
88250         Tested on x86_64-linux.
88251
88252 2021-09-27  Andrew Burgess  <andrew.burgess@embecosm.com>
88253
88254         gdb: add setting to disable reading source code files
88255         In some situations it is possible that a user might not want GDB to
88256         try and access source code files, for example, the source code might
88257         be stored on a slow to access network file system.
88258
88259         It is almost certainly possible that using some combination of 'set
88260         directories' and/or 'set substitute-path' a user can trick GDB into
88261         being unable to find the source files, but this feels like a rather
88262         crude way to solve the problem.
88263
88264         In this commit a new option is add that stops GDB from opening and
88265         reading the source files.  A user can run with source code reading
88266         disabled if this is required, then re-enable later if they decide
88267         that they now want to view the source code.
88268
88269 2021-09-27  Andrew Burgess  <andrew.burgess@embecosm.com>
88270
88271         gdb: remove duplicate cmd_list_element declarations
88272         For some reason we have two locations where cmd_list_elements are
88273         declared, cli/cli-cmds.h and gdbcmd.h.  Worse still there is
88274         duplication between these two locations.
88275
88276         In this commit I have moved all of the cmd_list_element declarations
88277         from gdbcmd.h into cli/cli-cmds.h and removed the duplicates.
88278
88279         There should be no user visible changes after this commit.
88280
88281 2021-09-27  Andrew Burgess  <andrew.burgess@embecosm.com>
88282
88283         gdb: prevent an assertion when computing the frame_id for an inline frame
88284         I ran into this assertion while GDB was trying to unwind the stack:
88285
88286           gdb/inline-frame.c:173: internal-error: void inline_frame_this_id(frame_info*, void**, frame_id*): Assertion `frame_id_p (*this_id)' failed.
88287
88288         That is, when building the frame_id for an inline frame, GDB asks for
88289         the frame_id of the previous frame.  Unfortunately, no valid frame_id
88290         was returned for the previous frame, and so the assertion triggers.
88291
88292         What is happening is this, I had a stack that looked something like
88293         this (the arrows '->' point from caller to callee):
88294
88295           normal_frame -> inline_frame
88296
88297         However, for whatever reason (e.g. broken debug information, or
88298         corrupted stack contents in the inferior), when GDB tries to unwind
88299         "normal_frame", it ends up getting back effectively the same frame,
88300         thus the call stack looks like this to GDB:
88301
88302           .-> normal_frame -> inline_frame
88303           |     |
88304           '-----'
88305
88306         Given such a situation we would expect GDB to terminate the stack with
88307         an error like this:
88308
88309           Backtrace stopped: previous frame identical to this frame (corrupt stack?)
88310
88311         However, the inline_frame causes a problem, and here's why:
88312
88313         When unwinding we start from the sentinel frame and call
88314         get_prev_frame.  We eventually end up in get_prev_frame_if_no_cycle,
88315         in here we create a raw frame, and as this is frame #0 we immediately
88316         return.
88317
88318         However, eventually we will try to unwind the stack further.  When we
88319         do this we inevitably needing to know the frame_id for frame #0, and
88320         so, eventually, we end up in compute_frame_id.
88321
88322         In compute_frame_id we first find the right unwinder for this frame,
88323         in our case (i.e. for inline_frame) the $pc is within the function
88324         normal_frame, but also within a block associated with the inlined
88325         function inline_frame, as such the inline frame unwinder claims this
88326         frame.
88327
88328         Back in compute_frame_id we next compute the frame_id, for our
88329         inline_frame this means a call to inline_frame_this_id.
88330
88331         The ID of an inline frame is based on the id of the previous frame, so
88332         from inline_frame_this_id we call get_prev_frame_always, this
88333         eventually calls get_prev_frame_if_no_cycle again, which creates
88334         another raw frame and calls compute_frame_id (for frames other than
88335         frame 0 we immediately compute the frame_id).
88336
88337         In compute_frame_id we again identify the correct unwinder for this
88338         frame.  Our $pc is unchanged, however, the fact that the next frame is
88339         of type INLINE_FRAME prevents the inline frame unwinder from claiming
88340         this frame again, and so, the standard DWARF frame unwinder claims
88341         normal_frame.
88342
88343         We return to compute_frame_id and call the standard DWARF function to
88344         build the frame_id for normal_frame.
88345
88346         With the frame_id of normal_frame figured out we return to
88347         compute_frame_id, and then to get_prev_frame_if_no_cycle, where we add
88348         the ID for normal_frame into the frame_id cache, and return the frame
88349         back to inline_frame_this_id.
88350
88351         From inline_frame_this_id we build a frame_id for inline_frame and
88352         return to compute_frame_id, and then to get_prev_frame_if_no_cycle,
88353         which adds the frame_id for inline_frame into the frame_id cache.
88354
88355         So far, so good.
88356
88357         However, as we are trying to unwind the complete stack, we eventually
88358         ask for the previous frame of normal_frame, remember, at this point
88359         GDB doesn't know the stack is corrupted (with a cycle), GDB still
88360         needs to figure that out.
88361
88362         So, we eventually end up in get_prev_frame_if_no_cycle where we create
88363         a raw frame and call compute_frame_id, remember, this is for the frame
88364         before normal_frame.
88365
88366         The first task for compute_frame_id is to find the unwinder for this
88367         frame, so all of the frame sniffers are tried in order, this includes
88368         the inline frame sniffer.
88369
88370         The inline frame sniffer asks for the $pc, this request is sent up the
88371         stack to normal_frame, which, due to its cyclic behaviour, tells GDB
88372         that the $pc in the previous frame was the same as the $pc in
88373         normal_frame.
88374
88375         GDB spots that this $pc corresponds to both the function normal_frame
88376         and also the inline function inline_frame.  As the next frame is not
88377         an INLINE_FRAME then GDB figures that we have not yet built a frame to
88378         cover inline_frame, and so the inline sniffer claims this new frame.
88379         Our stack is now looking like this:
88380
88381           inline_frame -> normal_frame -> inline_frame
88382
88383         But, we have not yet computed the frame id for the outer most (on the
88384         left) inline_frame.  After the frame sniffer has claimed the inline
88385         frame GDB returns to compute_frame_id and calls inline_frame_this_id.
88386
88387         In here GDB calls get_prev_frame_always, which eventually ends up
88388         in get_prev_frame_if_no_cycle again, where we create a raw frame and
88389         call compute_frame_id.
88390
88391         Just like before, compute_frame_id tries to find an unwinder for this
88392         new frame, it sees that the $pc is within both normal_frame and
88393         inline_frame, but the next frame is, again, an INLINE_FRAME, so, just
88394         like before the standard DWARF unwinder claims this frame.  Back in
88395         compute_frame_id we again call the standard DWARF function to build
88396         the frame_id for this new copy of normal_frame.
88397
88398         At this point the stack looks like this:
88399
88400           normal_frame -> inline_frame -> normal_frame -> inline_frame
88401
88402         After compute_frame_id we return to get_prev_frame_if_no_cycle, where
88403         we try to add the frame_id for the new normal_frame into the frame_id
88404         cache, however, unlike before, we fail to add this frame_id as it is
88405         a duplicate of the previous normal_frame frame_id.  Having found a
88406         duplicate get_prev_frame_if_no_cycle unlinks the new frame from the
88407         stack, and returns nullptr, the stack now looks like this:
88408
88409           inline_frame -> normal_frame -> inline_frame
88410
88411         The nullptr result from get_prev_frame_if_no_cycle is fed back to
88412         inline_frame_this_id, which forwards this to get_frame_id, which
88413         immediately returns null_frame_id.  As null_frame_id is not considered
88414         a valid frame_id, this is what triggers the assertion.
88415
88416         In summary then:
88417
88418          - inline_frame_this_id currently assumes that as the inline frame
88419            exists, we will always get a valid frame back from
88420            get_prev_frame_always,
88421
88422          - get_prev_frame_if_no_cycle currently assumes that it is safe to
88423            return nullptr when it sees a cycle.
88424
88425         Notice that in frame.c:compute_frame_id, this code:
88426
88427           fi->this_id.value = outer_frame_id;
88428           fi->unwind->this_id (fi, &fi->prologue_cache, &fi->this_id.value);
88429           gdb_assert (frame_id_p (fi->this_id.value));
88430
88431         The assertion makes it clear that the this_id function must always
88432         return a valid frame_id (e.g. null_frame_id is not a valid return
88433         value), and similarly in inline_frame.c:inline_frame_this_id this
88434         code:
88435
88436           *this_id = get_frame_id (get_prev_frame_always (this_frame));
88437           /* snip comment */
88438           gdb_assert (frame_id_p (*this_id));
88439
88440         Makes it clear that every inline frame expects to be able to get a
88441         previous frame, which will have a valid frame_id.
88442
88443         As I have discussed above, these assumptions don't currently hold in
88444         all cases.
88445
88446         One possibility would be to move the call to get_prev_frame_always
88447         forward from inline_frame_this_id to inline_frame_sniffer, however,
88448         this falls foul of (in frame.c:frame_cleanup_after_sniffer) this
88449         assertion:
88450
88451           /* No sniffer should extend the frame chain; sniff based on what is
88452              already certain.  */
88453           gdb_assert (!frame->prev_p);
88454
88455         This assert prohibits any sniffer from trying to get the previous
88456         frame, as getting the previous frame is likely to depend on the next
88457         frame, I can understand why this assertion is a good thing, and I'm in
88458         no rush to alter this rule.
88459
88460         The solution proposed here takes onboard feedback from both Pedro, and
88461         Simon (see the links below).  The get_prev_frame_if_no_cycle function
88462         is renamed to get_prev_frame_maybe_check_cycle, and will now not do
88463         cycle detection for inline frames, even when we spot a duplicate frame
88464         it is still returned.  This is fine, as, if the normal frame has a
88465         duplicate frame-id then the inline frame will also have a duplicate
88466         frame-id.  And so, when we reject the inline frame, the duplicate
88467         normal frame, which is previous to the inline frame, will also be
88468         rejected.
88469
88470         In inline-frame.c the call to get_prev_frame_always is no longer
88471         nested inside the call to get_frame_id.  There are reasons why
88472         get_prev_frame_always can return nullptr, for example, if there is a
88473         memory error while trying to get the previous frame, if this should
88474         happen then we now give a more informative error message.
88475
88476         Historical Links:
88477
88478          Patch v2: https://sourceware.org/pipermail/gdb-patches/2021-June/180208.html
88479          Feedback: https://sourceware.org/pipermail/gdb-patches/2021-July/180651.html
88480                    https://sourceware.org/pipermail/gdb-patches/2021-July/180663.html
88481
88482          Patch v3: https://sourceware.org/pipermail/gdb-patches/2021-July/181029.html
88483          Feedback: https://sourceware.org/pipermail/gdb-patches/2021-July/181035.html
88484
88485          Additional input: https://sourceware.org/pipermail/gdb-patches/2021-September/182040.html
88486
88487 2021-09-27  Tom de Vries  <tdevries@suse.de>
88488
88489         [gdb/testsuite] Fix gdb.base/dcache-flush.exp
88490         When running test-case gdb.base/dcache-flush.exp on ubuntu 18.04.5, I run into:
88491         ...
88492         (gdb) PASS: gdb.base/dcache-flush.exp: p var2
88493         info dcache^M
88494         Dcache 4096 lines of 64 bytes each.^M
88495         Contains data for Thread 0x7ffff7fc6b80 (LWP 3551)^M
88496         Line 0: address 0x7fffffffd4c0 [47 hits]^M
88497         Line 1: address 0x7fffffffd500 [31 hits]^M
88498         Line 2: address 0x7fffffffd5c0 [7 hits]^M
88499         Cache state: 3 active lines, 85 hits^M
88500         (gdb) FAIL: gdb.base/dcache-flush.exp: check dcache before flushing
88501         ...
88502         The regexp expects "Contains data for process $decimal".
88503
88504         This is another case of thread_db_target::pid_to_str being used.
88505
88506         Fix this by updating the regexp.
88507
88508         Tested on x86_64-linux.
88509
88510 2021-09-27  Tom de Vries  <tdevries@suse.de>
88511
88512         [gdb/testsuite] Test sw watchpoint in gdb.threads/process-dies-while-detaching.exp
88513         The test-case gdb.threads/process-dies-while-detaching.exp takes about 20s
88514         when using hw watchpoints, but when forcing sw watchpoints (using the patch
88515         mentioned in PR28375#c0), the test-case takes instead 3m14s.
88516
88517         Also, it show a FAIL:
88518         ...
88519         (gdb) continue^M
88520         Continuing.^M
88521         Cannot find user-level thread for LWP 10324: generic error^M
88522         (gdb) FAIL: gdb.threads/process-dies-while-detaching.exp: single-process:
88523         continue: watchpoint: continue
88524         ...
88525         for which PR28375 was filed.
88526
88527         Modify the test-case to:
88528         - add the hw/sw axis to the watchpoint testing, to ensure that we
88529           observe the sw watchpoint behaviour also on can-use-hw-watchpoints
88530           architectures.
88531         - skip the hw breakpoint testing if not supported
88532         - set the sw watchpoint later to avoid making the test
88533           too slow.  This still triggers the same PR, but now takes just 24s.
88534
88535         This patch adds a KFAIL for PR28375.
88536
88537         Tested on x86_64-linux.
88538
88539 2021-09-27  Simon Marchi  <simon.marchi@polymtl.ca>
88540
88541         gdb: fix indentation in gdbtypes.c
88542         Change-Id: I7bfbb9d349a1f474256800c45e28fe3b1de08771
88543
88544 2021-09-27  GDB Administrator  <gdbadmin@sourceware.org>
88545
88546         Automatic date update in version.in
88547
88548 2021-09-26  GDB Administrator  <gdbadmin@sourceware.org>
88549
88550         Automatic date update in version.in
88551
88552 2021-09-26  Peter Bergner  <bergner@linux.ibm.com>
88553
88554         PowerPC: Enable mfppr mfppr32, mtppr and mtppr32 extended mnemonics on POWER5
88555         SPR 896 and the mfppr mfppr32, mtppr and mtppr32 extended mnemonics were added
88556         in ISA 2.03, so enable them on POWER5 and later.
88557
88558         opcodes/
88559                 * ppc-opc.c (powerpc_opcodes) <mfppr, mfppr32, mtppr, mtppr32>: Enable
88560                 on POWER5 and later.
88561
88562         gas/
88563                 * testsuite/gas/ppc/power5.s: New test.
88564                 * testsuite/gas/ppc/power5.d: Likewise.
88565                 * testsuite/gas/ppc/ppc.exp: Run it.
88566                 * testsuite/gas/ppc/power7.s: Remove tests for mfppr, mfppr32, mtppr
88567                 and mtppr32.
88568                 * testsuite/gas/ppc/power7.d: Likewise.
88569
88570 2021-09-25  Tom de Vries  <tdevries@suse.de>
88571
88572         [gdb/testsuite] Minimize gdb restarts
88573         Minimize gdb restarts, applying the following rules:
88574         - don't use prepare_for_testing unless necessary
88575         - don't use clean_restart unless necessary
88576
88577         Also, if possible, replace build_for_executable + clean_restart
88578         with prepare_for_testing for brevity.
88579
88580         Touches 68 test-cases.
88581
88582         Tested on x86_64-linux.
88583
88584 2021-09-25  Alan Modra  <amodra@gmail.com>
88585
88586         PR28346, segfault attempting to disassemble raw binary
88587         Don't attempt to access elf_section_data for non-ELF sections.
88588
88589                 PR 28346
88590                 * elf32-xtensa.c (xtensa_read_table_entries): Return zero entries
88591                 for non-ELF.
88592
88593 2021-09-25  GDB Administrator  <gdbadmin@sourceware.org>
88594
88595         Automatic date update in version.in
88596
88597 2021-09-24  Hans-Peter Nilsson  <hp@axis.com>
88598
88599         gas/testsuite/ld-elf/dwarf2-21.d: Pass -W
88600         Required for the expected "CU:" to be emitted for long
88601         source-paths.  See binutils/dwarf.c:
88602
88603          if (do_wide || strlen (directory) < 76)
88604            printf (_("CU: %s/%s:\n"), directory, file_table[0].name);
88605          else
88606            printf ("%s:\n", file_table[0].name);
88607
88608         See also commit 5f410aa50ce2c, "testsuite/ld-elf/pr26936.d:
88609         Pass -W."
88610
88611         gas/ChangeLog:
88612                 * testsuite/ld-elf/dwarf2-21.d: Pass -W.
88613
88614 2021-09-24  Simon Marchi  <simon.marchi@polymtl.ca>
88615
88616         gdb: change thread_info::name to unique_xmalloc_ptr, add helper function
88617         This started out as changing thread_info::name to a unique_xmalloc_ptr.
88618         That showed that almost all users of that field had the same logic to
88619         get a thread's name: use thread_info::name if non-nullptr, else ask the
88620         target.  Factor out this logic in a new thread_name free function.  Make
88621         the field private (rename to m_name) and add some accessors.
88622
88623         Change-Id: Iebdd95f4cd21fbefc505249bd1d05befc466a2fc
88624
88625 2021-09-24  Tom Tromey  <tom@tromey.com>
88626
88627         Move value_true to value.h
88628         I noticed that value_true is declared in language.h and defined in
88629         language.c.  However, as part of the value API, I think it would be
88630         better in one of those files.  And, because it is very short, I
88631         changed it to be an inline function in value.h.  I've also removed a
88632         comment from the implementation, on the basis that it seems obsolete
88633         -- if the change it suggests was needed, it probably would have been
88634         done by now; and if it is needed in the future, odds are it would be
88635         done differently anyway.
88636
88637         Finally, this patch also changes value_true and value_logical_not to
88638         return a bool, and updates some uses.
88639
88640 2021-09-24  Pedro Alves  <pedro@palves.net>
88641
88642         Make dcache multi-target-safe
88643         By inspection, I noticed that this code in dcache.c is not
88644         multi-target-aware:
88645
88646           /* If this is a different inferior from what we've recorded,
88647              flush the cache.  */
88648
88649           if (inferior_ptid != dcache->ptid)
88650
88651         This doesn't take into account that threads of different targets may
88652         have the same ptid.
88653
88654         Fixed by also storing/comparing the process_stratum_target.
88655
88656         Tested on x86-64-linux-gnu, native and gdbserver.
88657
88658         Change-Id: I4d9d74052c696b72d28cb1c77b697b911725c8d3
88659
88660 2021-09-24  Pedro Alves  <pedro@palves.net>
88661
88662         Fix 'FAIL: gdb.perf/disassemble.exp: python Disassemble().run()'
88663         We currently have one FAIL while running "make check-perf":
88664
88665           PerfTest::assemble, run ...
88666           python Disassemble().run()
88667           Traceback (most recent call last):
88668             File "<string>", line 1, in <module>
88669             File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/perftest.py", line 64, in run
88670               self.warm_up()
88671             File "<string>", line 25, in warm_up
88672           gdb.error: No symbol "ada_evaluate_subexp" in current context.
88673           Error while executing Python code.
88674           (gdb) FAIL: gdb.perf/disassemble.exp: python Disassemble().run()
88675           ...
88676
88677         The gdb.perf/disassemble.exp testcase debugs GDB with itself, runs to
88678         main, and then disassembles a few GDB functions.  The problem is that
88679         most(!) functions it is trying to disassemble are now gone...
88680
88681         This commit fixes the issue by simply picking some other functions to
88682         disassemble.
88683
88684         It would perhaps be better to come up with some test program to
88685         disassemble, one that would stay the same throughout the years,
88686         instead of disassembling GDB itself.  I don't know why that wasn't
88687         done to begin with.  I'll have to leave that for another rainy day,
88688         though.
88689
88690         gdb/testsuite/
88691         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
88692
88693                 * gdb.perf/disassemble.py (Disassemble::warm_up): Disassemble
88694                 evaluate_subexp_do_call instead of ada_evaluate_subexp.
88695                 (Disassemble::warm_up): Disassemble "captured_main",
88696                 "run_inferior_call" and "update_global_location_list" instead of
88697                 "evaluate_subexp_standard" and "c_parse_internal".
88698
88699         Change-Id: I89d1cca89ce2e495dea5096e439685739cc0d3df
88700
88701 2021-09-24  Pedro Alves  <pedro@palves.net>
88702
88703         Fix all PATH problems in testsuite/gdb.perf/
88704         Currently "make check-perf" triggers ~40 PATH messages in gdb.sum:
88705
88706           ...
88707           PATH: gdb.perf/backtrace.exp: python sys.path.insert(0, os.path.abspath("/home/pedro/rocm/gdb/build/gdb/../../src/gdb/testsuite/gdb.perf/lib"))
88708           PATH: gdb.perf/backtrace.exp: python exec (open ('/home/pedro/rocm/gdb/build/gdb/testsuite/outputs/gdb.perf/backtrace/backtrace.py').read ())
88709           ...
88710
88711         This commit fixes them.  E.g. before/after gdb.sum diff:
88712
88713          -PASS: gdb.perf/backtrace.exp: python import os, sys
88714          -PASS: gdb.perf/backtrace.exp: python sys.path.insert(0, os.path.abspath("/home/pedro/rocm/gdb/build-master/gdb/../../src/gdb/testsuite/gdb.perf/lib"))
88715          -PATH: gdb.perf/backtrace.exp: python sys.path.insert(0, os.path.abspath("/home/pedro/rocm/gdb/build-master/gdb/../../src/gdb/testsuite/gdb.perf/lib"))
88716          -PASS: gdb.perf/backtrace.exp: python exec (open ('/home/pedro/rocm/gdb/build-master/gdb/testsuite/outputs/gdb.perf/backtrace/backtrace.py').read ())
88717          -PATH: gdb.perf/backtrace.exp: python exec (open ('/home/pedro/rocm/gdb/build-master/gdb/testsuite/outputs/gdb.perf/backtrace/backtrace.py').read ())
88718          +PASS: gdb.perf/backtrace.exp: setup perftest: python import os, sys
88719          +PASS: gdb.perf/backtrace.exp: setup perftest: python sys.path.insert(0, os.path.abspath("${srcdir}/gdb.perf/lib"))
88720          +PASS: gdb.perf/backtrace.exp: setup perftest: python exec (open ('${srcdir}/gdb.perf/backtrace.py').read ())
88721
88722         gdb/testsuite/
88723         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
88724
88725                 * lib/perftest.exp (PerfTest::_setup_perftest): Use
88726                 with_test_prefix.  Add explicit test names to python invocations,
88727                 with "$srcdir" not expanded.
88728
88729         Change-Id: I50a31b04b7abdea754139509e4a34ae9263118a4
88730
88731 2021-09-24  Pedro Alves  <pedro@palves.net>
88732
88733         Fix all DUPLICATE problems in testsuite/gdb.perf/
88734         Currently running "make check-perf" shows:
88735
88736          ...
88737          # of duplicate test names       6008
88738          ...
88739
88740         All those duplicate test names come from gdb.perf/skip-command.exp.
88741         This commit fixes them, using with_test_prefix.
88742
88743         gdb/testsuite/
88744         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
88745
88746                 * gdb.perf/skip-command.exp (run_skip_bench): Wrap each for
88747                 iteration in with_test_prefix.
88748
88749         Change-Id: I38501cf70bc6b60306ee7228996ee7bcd858dc1b
88750
88751 2021-09-24  Tom Tromey  <tromey@adacore.com>
88752
88753         Fix handling of DW_AT_data_bit_offset
88754         A newer version of GCC will now emit member locations using just
88755         DW_AT_data_bit_offset, like:
88756
88757          <3><14fe>: Abbrev Number: 1 (DW_TAG_member)
88758             <14ff>   DW_AT_name        : (indirect string, offset: 0x215e): nb_bytes
88759             <1503>   DW_AT_decl_file   : 1
88760             <1503>   DW_AT_decl_line   : 10
88761             <1504>   DW_AT_decl_column : 7
88762             <1505>   DW_AT_type        : <0x150b>
88763             <1509>   DW_AT_bit_size    : 31
88764             <150a>   DW_AT_data_bit_offset: 64
88765
88766         whereas earlier versions would emit something like:
88767
88768          <3><164f>: Abbrev Number: 7 (DW_TAG_member)
88769             <1650>   DW_AT_name        : (indirect string, offset: 0x218d): nb_bytes
88770             <1654>   DW_AT_decl_file   : 1
88771             <1655>   DW_AT_decl_line   : 10
88772             <1656>   DW_AT_decl_column : 7
88773             <1657>   DW_AT_type        : <0x165f>
88774             <165b>   DW_AT_byte_size   : 4
88775             <165c>   DW_AT_bit_size    : 31
88776             <165d>   DW_AT_bit_offset  : 1
88777             <165e>   DW_AT_data_member_location: 8
88778
88779         That is, DW_AT_data_member_location is not emitted any more.  This is
88780         a change due to the switch to DWARF 5 by default.
88781
88782         This change pointed out an existing bug in gdb, namely that the
88783         attr_to_dynamic_prop depends on the presence of
88784         DW_AT_data_member_location.  This patch moves the handling of
88785         DW_AT_data_bit_offset into handle_data_member_location, and updates
88786         attr_to_dynamic_prop to handle this new case.
88787
88788         A new test case is included.  This test fails with GCC 11, but passes
88789         with an earlier version of GCC.
88790
88791 2021-09-24  Tom de Vries  <tdevries@suse.de>
88792
88793         [gdb/testsuite] Don't leave gdb instance running after function_range
88794         A typical dwarf assembly test-case start like this:
88795         ...
88796         standard_testfile .c -debug.S
88797
88798         set asm_file [standard_output_file $srcfile2]
88799         Dwarf::assemble $asm_file {
88800           ...
88801         }
88802
88803         if { [prepare_for_testing "failed to prepare" ${testfile} \
88804                   [list $srcfile $asm_file] {nodebug}] } {
88805             return -1
88806         }
88807         ...
88808
88809         When accidentally using build_for_executable instead of
88810         prepare_for_testing (or intentionally using it but forgetting to add
88811         clean_restart $binfile or some such) the mistake may not be caught, because
88812         another gdb instance is still running, and we may silently end up testing
88813         compiler-generated DWARF.
88814
88815         This can be caused by something relatively obvious, like an earlier
88816         prepare_for_testing or clean_restart, but also by something more obscure like
88817         function_range, which may even be triggered by dwarf assembly like this:
88818         ...
88819           {MACRO_AT_func {main}}
88820         ...
88821
88822         Fix this by calling gdb_exit at the end of function_range.
88823
88824         Also fix the fallout of that in test-case gdb.dwarf2/dw2-bad-elf.exp, where a
88825         get_sizeof call used the gdb instance left lingering by function_range.
88826
88827         [ A better and more complete fix would add a new proc get_exec_info, that would
88828         be called at the start of the dwarf assembly body:
88829         ...
88830         Dwarf::assemble $asm_file {
88831           get_exec_info {main foo} {int void*}
88832         ...
88833         that would:
88834         - do a prepare_for_testing with $srcfile (roughtly equivalent to what
88835           MACRO_AT_func does,
88836         - call function_range for all functions main and foo, without starting a
88837           new gdb instance
88838         - set corresponding variables at the call-site: main_start, main_len,
88839           main_end, foo_start, foo_len, foo_end.
88840         - get size for types int and void*
88841         - set corresponding variables at the call-site: int_size, void_ptr_size.
88842         - do a gdb_exit. ]
88843
88844         Tested on x86_64-linux.
88845
88846 2021-09-24  Tom de Vries  <tdevries@suse.de>
88847
88848         [gdb/testsuite] Use pie instead of -fpie/-pie
88849         I noticed two test-cases where -fpie is used.  Using the canonical pie option
88850         will usually get one -fPIE instead.
88851
88852         That choice is justified here in gdb_compile:
88853         ...
88854           # For safety, use fPIE rather than fpie. On AArch64, m68k, PowerPC
88855           # and SPARC, fpie can cause compile errors due to the GOT exceeding
88856           # a maximum size.  On other architectures the two flags are
88857           # identical (see the GCC manual). Note Debian9 and Ubuntu16.10
88858           # onwards default GCC to using fPIE.  If you do require fpie, then
88859           # it can be set using the pie_flag.
88860           set flag "additional_flags=-fPIE"
88861         ...
88862
88863         There is no indication that using -fpie rather than -fPIE is on purpose, so
88864         use pie instead.
88865
88866         Tested on x86_64-linux.
88867
88868 2021-09-24  Tom de Vries  <tdevries@suse.de>
88869
88870         [gdb/testsuite] Factor out dump_info in gdb.testsuite/dump-system-info.exp
88871         Factor out new proc dump_info in test-case gdb.testsuite/dump-system-info.exp,
88872         and in the process:
88873         - fix a few typos
88874         - remove unnecessary "test -r /proc/cpuinfo"
88875
88876         Tested on x86_64-linux.
88877
88878         Co-Authored-By: Pedro Alves <pedro@palves.net>
88879
88880 2021-09-24  Pedro Alves  <pedro@palves.net>
88881
88882         gdb/testsuite: Make it possible to use TCL variables in DWARF assembler loclists
88883         It is currently not possible to use variables in locations lists.  For
88884         example, with:
88885
88886           diff --git a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
88887           index 6b4f5c8cbb8..cdbf948619f 100644
88888           --- a/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
88889           +++ b/gdb/testsuite/gdb.dwarf2/loclists-multiple-cus.exp
88890           @@ -30,6 +30,8 @@ if {![dwarf2_support]} {
88891                return 0
88892            }
88893
88894           +set myconst 0x123456
88895           +
88896            # Test with 32-bit and 64-bit DWARF.
88897            foreach_with_prefix is_64 {false true} {
88898                if { $is_64 } {
88899           @@ -49,6 +51,7 @@ foreach_with_prefix is_64 {false true} {
88900                   global func1_addr func1_len
88901                   global func2_addr func2_len
88902                   global is_64
88903           +       global myconst
88904
88905                   # The CU uses the DW_FORM_loclistx form to refer to the .debug_loclists
88906                   # section.
88907           @@ -107,7 +110,7 @@ foreach_with_prefix is_64 {false true} {
88908                           list_ {
88909                               # When in func1.
88910                               start_length $func1_addr $func1_len {
88911           -                       DW_OP_constu 0x123456
88912           +                       DW_OP_constu $myconst
88913                                   DW_OP_stack_value
88914                               }
88915
88916         we get:
88917
88918           $ make check TESTS="*/loclists-multiple-cus.exp"
88919           ...
88920           gdb compile failed, build/gdb/testsuite/outputs/gdb.dwarf2/loclists-multiple-cus/loclists-multiple-cus-dw32.S: Assembler messages:
88921           build/gdb/testsuite/outputs/gdb.dwarf2/loclists-multiple-cus/loclists-multiple-cus-dw32.S:78: Error: leb128 operand is an undefined symbol: $myconst
88922           ...
88923
88924         That means $myconst was copied literally to the generated assembly
88925         file.
88926
88927         This patch fixes it, by running subst on the location list body, in
88928         the context of the caller.  The fix is applied to both
88929         Dwarf::loclists::table::list_::start_length and
88930         Dwarf::loclists::table::list_::start_end.
88931
88932         Reported-by: Zoran Zaric <Zoran.Zaric@amd.com>
88933
88934         Change-Id: I615a64431857242d9f477d5699e3732df1b31322
88935
88936 2021-09-24  Tom de Vries  <tdevries@suse.de>
88937
88938         [gdb/testsuite] Fix DUPLICATEs in gdb.dwarf2/implptr-64bit.exp
88939         When running test-case gdb.dwarf2/implptr-64bit.exp with target board
88940         unix/-m32, I noticed:
88941         ...
88942         DUPLICATE: gdb.dwarf2/implptr-64bit.exp: failed to prepare
88943         ...
88944
88945         Fix this by using with_test_prefix.
88946
88947         Tested on x86_64-linux.
88948
88949 2021-09-24  Tom de Vries  <tdevries@suse.de>
88950
88951         [gdb/testsuite] Fix DUPLICATEs gdb.dwarf2/dw2-is-stmt.exp
88952         Fix these DUPLICATEs by using with_test_prefix:
88953         ...
88954         DUPLICATE: gdb.dwarf2/dw2-is-stmt.exp: ensure we saw a valid line pattern, 1
88955         DUPLICATE: gdb.dwarf2/dw2-is-stmt.exp: ensure we saw a valid line pattern, 2
88956         ...
88957
88958         Tested on x86_64-linux.
88959
88960 2021-09-24  Tom de Vries  <tdevries@suse.de>
88961
88962         [gdb/testsuite] Fix set $var val in gdb.dwarf2/dw2-is-stmt.exp
88963         When doing a testrun with:
88964         ...
88965         $ make check RUNTESTFLAGS=$(cd $src/gdb/testsuite/; echo gdb.dwarf2/*.exp)
88966         ...
88967         I ran into:
88968         ...
88969         ERROR: tcl error sourcing gdb.dwarf2/dw2-is-stmt.exp.
88970         ERROR: expected integer but got "dw2-abs-hi-pc-world.c"
88971             while executing
88972         "incr i"
88973         ...
88974
88975         The variable i is set in gdb.dwarf2/dw2-abs-hi-pc.exp, and leaks to
88976         gdb.dwarf2/dw2-is-stmt.exp.  It's not removed by gdb_cleanup_globals because i
88977         is set as global variable by runtest.exp, which does:
88978         ...
88979         for { set i 0 } { $i < $argc } { incr i } {
88980         ...
88981         at toplevel but forgets to unset the variable.
88982
88983         Fix this by removing '$' in front of the variable name when doing set:
88984         ...
88985         -set $i 0
88986         +set i 0
88987         ...
88988
88989         Tested on x86_64-linux.
88990
88991 2021-09-24  Tom de Vries  <tdevries@suse.de>
88992
88993         [gdb/testsuite] Fix DUPLICATE in gdb.base/load-command.exp
88994         Fix this duplicate:
88995         ...
88996         DUPLICATE: gdb.base/load-command.exp: check initial value of the_variable
88997         ...
88998         by using with_test_prefix.
88999
89000         Tested on x86_64-linux.
89001
89002 2021-09-24  Tom de Vries  <tdevries@suse.de>
89003
89004         [gdb/testsuite] Use pie/nopie instead of ldflags=-pie/-no-pie
89005         I noticed two test-case that use ldflags=-pie and ldflags-no-pie, instead of
89006         the canonical pie and nopie options, which would typically also add
89007         additional_flags=-fPIE respectively additional_flags=-fno-pie.
89008
89009         There is no indication that this is on purpose, so replace these with pie and
89010         nopie.
89011
89012         Tested on x86_64-linux.
89013
89014 2021-09-24  Tom de Vries  <tdevries@suse.de>
89015
89016         [gdb/testsuite] Add gdb.testsuite/dump-system-info.exp
89017         When interpreting the testsuite results, it's often relevant what kind of
89018         machine the testsuite ran on.  On a local machine one can just do
89019         /proc/cpuinfo, but in case of running tests using a remote system
89020         that distributes test runs to other remote systems that are not directly
89021         accessible, that's not possible.
89022
89023         Fix this by dumping /proc/cpuinfo into the gdb.log, as well as lsb_release -a
89024         and uname -a.
89025
89026         We could do this at the start of each test run, by putting it into unix.exp
89027         or some such.  However, this might be too verbose, so we choose to put it into
89028         its own test-case, such that it get triggered in a full testrun, but not when
89029         running one or a subset of tests.
89030
89031         We put the test-case into the gdb.testsuite directory, which is currently the
89032         only place in the testsuite where we do not test gdb.   [ Though perhaps this
89033         could be put into a new gdb.info directory, since the test-case doesn't
89034         actually test the testsuite. ]
89035
89036         Tested on x86_64-linux.
89037
89038 2021-09-24  GDB Administrator  <gdbadmin@sourceware.org>
89039
89040         Automatic date update in version.in
89041
89042 2021-09-23  Tom Tromey  <tom@tromey.com>
89043
89044         Change pointer_type to a method of struct type
89045         I noticed that pointer_type is declared in language.h and defined in
89046         language.c.  However, it really has to do with types, so it should
89047         have been in gdbtypes.h all along.
89048
89049         This patch changes it to be a method on struct type.  And, I went
89050         through uses of TYPE_IS_REFERENCE and updated many spots to use the
89051         new method as well.  (I didn't update ones that were in arch-specific
89052         code, as I couldn't readily test that.)
89053
89054 2021-09-23  Tom de Vries  <tdevries@suse.de>
89055
89056         [gdb/testsuite] Support -fPIE/-fno-PIE/-pie/-no-pie in gdb_compile_rust
89057         When running gdb.rust/*.exp test-cases with target board unix/-fPIE/-pie, I
89058         run into:
89059         ...
89060         builtin_spawn -ignore SIGHUP rustc --color never gdb.rust/watch.rs \
89061           -g -lm -fPIE -pie -o outputs/gdb.rust/watch/watch^M
89062         error: Unrecognized option: 'f'^M
89063         ^M
89064         compiler exited with status 1
89065         ...
89066
89067         The problem is that -fPIE and -fpie are gcc options, but for rust we use
89068         rustc, which has different compilation options.
89069
89070         Fix this by translating the gcc options to rustc options in gdb_compile_rust,
89071         similar to how that is done for ada in target_compile_ada_from_dir.
89072
89073         Likewise for unix/-fno-PIE/-no-pie.
89074
89075         Tested on x86_64-linux, with:
89076         - native
89077         - unix/-fPIE/-pie
89078         - unix/-fno-PIE/-no-pie
89079         specifically, on openSUSE Leap 15.2 both with package gcc-PIE:
89080         - installed (making gcc default to PIE)
89081         - uninstalled (making gcc default to non-PIE).
89082         and rustc 1.52.1.
89083
89084 2021-09-23  Tom de Vries  <tdevries@suse.de>
89085
89086         [gdb/testsuite] Use pie instead of -fPIE -pie
89087         Replace {additional_flags=-fPIE ldflags=-pie} with {pie}.
89088
89089         This makes sure that the test-cases properly error out when using target board
89090         unix/-fno-PIE/-no-pie.
89091
89092         Tested on x86_64-linux.
89093
89094 2021-09-23  Tom de Vries  <tdevries@suse.de>
89095
89096         [gdb/testsuite] Fix probe test in gdb.base/break-interp.exp
89097         When running test-case gdb.base/break-interp.exp on ubuntu 18.04.5, we have:
89098         ...
89099          (gdb) bt^M
89100          #0  0x00007eff7ad5ae12 in ?? () from break-interp-LDprelinkNOdebugNO^M
89101          #1  0x00007eff7ad71f50 in ?? () from break-interp-LDprelinkNOdebugNO^M
89102          #2  0x00007eff7ad59128 in ?? () from break-interp-LDprelinkNOdebugNO^M
89103          #3  0x00007eff7ad58098 in ?? () from break-interp-LDprelinkNOdebugNO^M
89104          #4  0x0000000000000002 in ?? ()^M
89105          #5  0x00007fff505d7a32 in ?? ()^M
89106          #6  0x00007fff505d7a94 in ?? ()^M
89107          #7  0x0000000000000000 in ?? ()^M
89108          (gdb) FAIL: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: \
89109                  first backtrace: dl bt
89110         ...
89111
89112         Using the backtrace, the test-case tries to establish that we're stopped in
89113         dl_main.
89114
89115         However, the backtrace only shows an address, because:
89116         - the dynamic linker contains no minimal symbols and no debug info, and
89117         - gdb is build without --with-separate-debug-dir so it can't find the
89118           corresponding .debug file, which does contain the mimimal symbols and
89119           debug info.
89120
89121         As in "[gdb/testsuite] Improve probe detection in gdb.base/break-probes.exp",
89122         fix this by doing info probes and grepping for the address.
89123
89124         Tested on x86_64-linux.
89125
89126 2021-09-23  Tom de Vries  <tdevries@suse.de>
89127
89128         [gdb/testsuite] Improve probe detection in gdb.base/break-probes.exp
89129         When running test-case gdb.base/break-probes.exp on ubuntu 18.04.5, we have:
89130         ...
89131          (gdb) run^M
89132          Starting program: break-probes^M
89133          Stopped due to shared library event (no libraries added or removed)^M
89134          (gdb) bt^M
89135          #0  0x00007ffff7dd6e12 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89136          #1  0x00007ffff7dedf50 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89137          #2  0x00007ffff7dd5128 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89138          #3  0x00007ffff7dd4098 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89139          #4  0x0000000000000001 in ?? ()^M
89140          #5  0x00007fffffffdaac in ?? ()^M
89141          #6  0x0000000000000000 in ?? ()^M
89142          (gdb) UNSUPPORTED: gdb.base/break-probes.exp: probes not present on this system
89143         ...
89144
89145         Using the backtrace, the test-case tries to establish that we're stopped in
89146         dl_main, which is used as proof that we're using probes.
89147
89148         However, the backtrace only shows an address, because:
89149         - the dynamic linker contains no minimal symbols and no debug info, and
89150         - gdb is build without --with-separate-debug-dir so it can't find the
89151           corresponding .debug file, which does contain the mimimal symbols and
89152           debug info.
89153
89154         Fix this by instead printing the pc and grepping for the value in the
89155         info probes output:
89156         ...
89157         (gdb) p /x $pc^M
89158         $1 = 0x7ffff7dd6e12^M
89159         (gdb) info probes^M
89160         Type Provider Name           Where              Object                      ^M
89161           ...
89162         stap rtld     init_start     0x00007ffff7dd6e12 /lib64/ld-linux-x86-64.so.2 ^M
89163           ...
89164         (gdb)
89165         ...
89166
89167         Tested on x86_64-linux.
89168
89169 2021-09-23  Tom de Vries  <tdevries@suse.de>
89170
89171         [gdb/testsuite] Handle failing probe detection in gdb.base/break-probes.exp
89172         When running test-case gdb.base/break-probes.exp on ubuntu 18.04.5, we have:
89173         ...
89174          (gdb) bt^M
89175          #0  0x00007ffff7dd6e12 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89176          #1  0x00007ffff7dedf50 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89177          #2  0x00007ffff7dd5128 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89178          #3  0x00007ffff7dd4098 in ?? () from /lib64/ld-linux-x86-64.so.2^M
89179          #4  0x0000000000000001 in ?? ()^M
89180          #5  0x00007fffffffdaac in ?? ()^M
89181          #6  0x0000000000000000 in ?? ()^M
89182          (gdb) FAIL: gdb.base/break-probes.exp: ensure using probes
89183         ...
89184
89185         The test-case intends to emit an UNTESTED in this case, but fails to do so
89186         because it tries to do it in a regexp clause in a gdb_test_multiple, which
89187         doesn't trigger.  Instead, a default clause triggers which produces the FAIL.
89188
89189         Also the use of UNTESTED is not appropriate, and we should use UNSUPPORTED
89190         instead.
89191
89192         Fix this by silencing the FAIL, and emitting an UNSUPPORTED after the
89193         gdb_test_multiple:
89194         ...
89195          if { ! $using_probes } {
89196         +    unsupported "probes not present on this system"
89197              return -1
89198          }
89199         ...
89200
89201         Tested on x86_64-linux.
89202
89203 2021-09-23  Tom de Vries  <tdevries@suse.de>
89204
89205         [gdb/testsuite] Use early-out style in gdb.base/break-probes.exp
89206         Reduce indentation and improve readability in test-case
89207         gdb.base/break-probes.exp by replacing:
89208         ...
89209         if { <cond> } {
89210           <lots-of-code>
89211         }
89212         ...
89213         with:
89214         ...
89215         if { ! <cond> } {
89216           return -1
89217         }
89218         <lots-of-code>
89219         ...
89220
89221         Tested on x86_64-linux.
89222
89223 2021-09-23  Pedro Alves  <pedro@palves.net>
89224
89225         Test that frame info/IDs are stable/consistent
89226         This adds a testcase that tests that the unwinder produces consistent
89227         frame info and frame IDs by making sure that "info frame" shows the
89228         same result when stopped at a function (level == 0), compared to when
89229         we find the same frame in the stack at a level > 0.
89230
89231         E.g., on x86-64, right after running to main, we see:
89232
89233           (gdb) info frame
89234           Stack level 0, frame at 0x7fffffffd340:
89235            rip = 0x555555555168 in main (gdb.base/backtrace.c:41); saved rip = 0x7ffff7dd90b3
89236            source language c.
89237            Arglist at 0x7fffffffd330, args:
89238            Locals at 0x7fffffffd330, Previous frame's sp is 0x7fffffffd340
89239            Saved registers:
89240             rbp at 0x7fffffffd330, rip at 0x7fffffffd338
89241           (gdb)
89242
89243         and then after continuing to a function called by main, and selecting
89244         the "main" frame again, we see:
89245
89246           (gdb) info frame
89247           Stack level 3, frame at 0x7fffffffd340:
89248            rip = 0x555555555172 in main (gdb.base/backtrace.c:41); saved rip = 0x7ffff7dd90b3
89249            caller of frame at 0x7fffffffd330
89250            source language c.
89251            Arglist at 0x7fffffffd330, args:
89252            Locals at 0x7fffffffd330, Previous frame's sp is 0x7fffffffd340
89253            Saved registers:
89254             rbp at 0x7fffffffd330, rip at 0x7fffffffd338
89255           (gdb)
89256
89257         The only differences should be in the stack level, the 'rip = '
89258         address, and the presence of the "caller of frame at" info.  All the
89259         rest should be the same.  If it isn't, it probably means that the
89260         frame base, the frame ID, etc. aren't stable & consistent.
89261
89262         The testcase exercises both the DWARF and the heuristic unwinders,
89263         using "maint set dwarf unwinder on/off".
89264
89265         Tested on {x86-64 -m64, x86-64 -m32, Aarch64, Power8} GNU/Linux.
89266
89267         Change-Id: I795001c82cc70d543d197415e3f80ce5dc7f3452
89268
89269 2021-09-23  Tom Tromey  <tromey@adacore.com>
89270
89271         Change get_ada_task_ptid parameter type
89272         get_ada_task_ptid currently takes a 'long' as its 'thread' parameter
89273         type.  However, on some platforms this is actually a pointer, and
89274         using 'long' can sometimes end up with the value being sign-extended.
89275         This sign extension can cause problems later, if the tid is then later
89276         used as an address again.
89277
89278         This patch changes the parameter type to ULONGEST and updates all the
89279         uses.  This approach preserves sign extension on the targets where it
89280         is apparently intended, while avoiding it on others.
89281
89282         Co-Authored-By: John Baldwin <jhb@FreeBSD.org>
89283
89284 2021-09-23  Tom Tromey  <tromey@adacore.com>
89285
89286         Change ptid_t::tid to ULONGEST
89287         The ptid_t 'tid' member is normally used as an address in gdb -- both
89288         bsd-uthread and ravenscar-thread use it this way.  However, because
89289         the type is 'long', this can cause problems with sign extension.
89290
89291         This patch changes the type to ULONGEST to ensure that sign extension
89292         does not occur.
89293
89294 2021-09-23  Tom Tromey  <tromey@adacore.com>
89295
89296         Remove defaulted 'tid' parameter to ptid_t constructor
89297         I wanted to find, and potentially modify, all the spots where the
89298         'tid' parameter to the ptid_t constructor was used.  So, I temporarily
89299         removed this parameter and then rebuilt.
89300
89301         In order to make it simpler to search through the "real" (nonzero)
89302         uses of this parameter, something I knew I'd have to do multiple
89303         times, I removed any ", 0" from constructor calls.
89304
89305         Co-Authored-By: John Baldwin <jhb@FreeBSD.org>
89306
89307 2021-09-23  Tom Tromey  <tom@tromey.com>
89308
89309         Style the "XXX" text in ptype/o
89310         This patch changes gdb to use the 'highlight' style on the "XXX" text
89311         in the output of ptype/o.
89312
89313 2021-09-23  GDB Administrator  <gdbadmin@sourceware.org>
89314
89315         Automatic date update in version.in
89316
89317 2021-09-22  Tom de Vries  <tdevries@suse.de>
89318
89319         [gdb/testsuite] Fix gdb.python/py-events.exp
89320         With test-case gdb.python/py-events.exp on ubuntu 18.04.5 we run into:
89321         ...
89322         (gdb) info threads^M
89323           Id   Target Id                                     Frame ^M
89324         * 1    Thread 0x7ffff7fc3740 (LWP 31467) "py-events" do_nothing () at \
89325                  src/gdb/testsuite/gdb.python/py-events-shlib.c:19^M
89326         (gdb) FAIL: gdb.python/py-events.exp: get current thread
89327         ...
89328
89329         The info thread commands uses "Thread" instead of "process" because
89330         libpthread is already loaded:
89331         ...
89332         new objfile name: /lib/x86_64-linux-gnu/libdl.so.2^M
89333         [Thread debugging using libthread_db enabled]^M
89334         Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".^M
89335         event type: new_objfile^M
89336         new objfile name: /lib/x86_64-linux-gnu/libpthread.so.0^M
89337         ...
89338         and consequently thread_db_target::pid_to_str is used.
89339
89340         Fix this by parsing the "Thread" expression.
89341
89342         Tested on x86_64-linux.
89343
89344 2021-09-22  Tom de Vries  <tdevries@suse.de>
89345
89346         [gdb] Add maint selftest -verbose option
89347         The print_one_insn selftest in gdb/disasm-selftests.c contains:
89348         ...
89349           /* If you want to see the disassembled instruction printed to gdb_stdout,
89350              set verbose to true.  */
89351           static const bool verbose = false;
89352         ...
89353
89354         Make this parameter available in the maint selftest command using a new option
89355         -verbose, such that we can do:
89356         ...
89357         (gdb) maint selftest -verbose print_one_insn
89358         ...
89359
89360         Tested on x86_64-linux.
89361
89362 2021-09-22  Alan Modra  <amodra@gmail.com>
89363
89364         dwarf2 sub-section test
89365         This is a testcase for the bug fixed by commit 5b4846283c3d.  When
89366         running the testcase on ia64 targets I found timeouts along with lots
89367         of memory being consumed, due to ia64 gas not tracking text
89368         sub-sections.  Trying to add nops for ".nop 16" in ".text 1" resulting
89369         in them being added to subsegment 0, with no increase to subsegment 1
89370         size.  This patch also fixes that problem.
89371
89372         Note that the testcase fails on ft32-elf, mn10200-elf, score-elf,
89373         tic5x-elf, and xtensa-elf.  The first two are relocation errors, the
89374         last three appear to be the .nop directive failing to emit the right
89375         number of nops.  I didn't XFAIL any of them.
89376
89377                 * config/tc-ia64.c (md): Add last_text_subseg.
89378                 (ia64_flush_insns, dot_endp): Use last_text_subseg.
89379                 (ia64_frob_label, md_assemble): Set last_text_subseg.
89380                 * testsuite/gas/elf/dwarf2-21.d,
89381                 * testsuite/gas/elf/dwarf2-21.s: New test.
89382                 * testsuite/gas/elf/elf.exp: Run it.
89383
89384 2021-09-22  Alan Modra  <amodra@gmail.com>
89385
89386         Fix x86 "FAIL: TLS -fno-pic -shared"
89387         Fix a typo in commit 5d0869d9872a
89388
89389                 * testsuite/ld-i386/tlsnopic.rd: Typo fix.
89390
89391 2021-09-22  GDB Administrator  <gdbadmin@sourceware.org>
89392
89393         Automatic date update in version.in
89394
89395 2021-09-21  Nick Clifton  <nickc@redhat.com>
89396
89397         Change the linker's heuristic for computing the entry point for binaries so that shared libraries default to an entry point of 0.
89398                 * ldlang.c (lang_end): When computing the entry point, only
89399                 try the start address of the entry section when creating an
89400                 executable.
89401                 * ld.texi (Entry point): Update description of heuristic used to
89402                 choose the entry point.
89403                 testsuite/ld-alpha/tlspic.rd: Update expected entry point address.
89404                 testsuite/ld-arm/tls-gdesc-got.d: Likewise.
89405                 testsuite/ld-i386/tlsnopic.rd: Likewise.
89406                 testsuite/ld-ia64/tlspic.rd: Likewise.
89407                 testsuite/ld-sparc/gotop32.rd: Likewise.
89408                 testsuite/ld-sparc/gotop64.rd: Likewise.
89409                 testsuite/ld-sparc/tlssunnopic32.rd: Likewise.
89410                 testsuite/ld-sparc/tlssunnopic64.rd: Likewise.
89411                 testsuite/ld-sparc/tlssunpic32.rd: Likewise.
89412                 testsuite/ld-sparc/tlssunpic64.rd: Likewise.
89413                 testsuite/ld-tic6x/shlib-1.rd: Likewise.
89414                 testsuite/ld-tic6x/shlib-1b.rd: Likewise.
89415                 testsuite/ld-tic6x/shlib-1r.rd: Likewise.
89416                 testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
89417                 testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
89418                 testsuite/ld-x86-64/pr14207.d: Likewise.
89419                 testsuite/ld-x86-64/tlsdesc.rd: Likewise.
89420                 testsuite/ld-x86-64/tlspic.rd: Likewise.
89421                 testsuite/ld-x86-64/tlspic2.rd: Likewise.
89422
89423 2021-09-21  Tom de Vries  <tdevries@suse.de>
89424
89425         [gdb/testsuite] Handle supports_memtag in gdb.base/gdb-caching-proc.exp
89426         In test-case gdb.base/gdb-caching-proc.exp, we run all procs declared with
89427         gdb_caching_proc.  Some of these require a gdb instance, some not.
89428
89429         We could just do a clean_restart every time, but that would amount to 44 gdb
89430         restarts.  We try to minimize this by doing this only for the few procs that
89431         need it, and hardcoding those in the test-case.
89432
89433         For those procs, we do a clean_restart, execute the proc, and then do a
89434         gdb_exit, to make sure the gdb instance doesn't linger such that we detect
89435         procs that need a gdb instance but are not listed in the test-case.
89436
89437         However, that doesn't work in the case of gnat_runtime_has_debug_info.  This
89438         proc doesn't require a gdb instance because it starts its own.  But it doesn't
89439         clean up the gdb instance, and since it's not listed, the test-case
89440         doesn't clean up the gdb instance eiter.  Consequently, the proc
89441         supports_memtag (which should be listed, but isn't) uses the gdb instance
89442         started by gnat_runtime_has_debug_info rather than throwing an error.  Well,
89443         unless gnat_runtime_has_debug_info fails before starting a gdb instance, in
89444         which case we do run into the error.
89445
89446         Fix this by:
89447         - doing gdb_exit unconditionally
89448         - fixing the resulting error by adding supports_memtag in the test-case to
89449           the "needing gdb instance" list
89450
89451         Tested on x86_64-linux.
89452
89453 2021-09-21  Felix Willgerodt  <felix.willgerodt@intel.com>
89454
89455         gdb, doc: Add ieee_half and bfloat16 to list of predefined target types.
89456         For some reason these two weren't added to the list when they were orginally
89457         added to GDB.
89458
89459         gdb/doc/ChangeLog:
89460         2021-09-21  Felix Willgerodt  <felix.willgerodt@intel.com>
89461
89462                 * gdb.texinfo (Predefined Target Types): Mention ieee_half and bfloat16.
89463
89464 2021-09-21  GDB Administrator  <gdbadmin@sourceware.org>
89465
89466         Automatic date update in version.in
89467
89468 2021-09-20  Tom de Vries  <tdevries@suse.de>
89469
89470         [gdb/testsuite] Fix gdb.ada/interface.exp with gcc-9
89471         When running test-case gdb.ada/interface.exp with gcc-9, we run into:
89472         ...
89473         (gdb) info locals^M
89474         s = (x => 1, y => 2, w => 3, h => 4)^M
89475         r = (x => 1, y => 2, w => 3, h => 4)^M
89476         (gdb) FAIL: gdb.ada/interface.exp: info locals
89477         ...
89478
89479         The failure is caused by the regexp expecting variable r followed by
89480         variable s.
89481
89482         Fix this by allowing variable s followed by variable r as well.
89483
89484         Tested on x86_64-linux.
89485
89486 2021-09-20  Tom de Vries  <tdevries@suse.de>
89487
89488         [gdb/testsuite] Fix gdb.ada/mi_prot.exp
89489         When running test-case gdb.ada/mi_prot.exp with gcc 8.5.0, we run into:
89490         ...
89491         (gdb) ^M
89492         Expecting: ^(-stack-list-arguments --no-frame-filters 1[^M
89493         ]+)?(\^done,stack=.*[^M
89494         ]+[(]gdb[)] ^M
89495         [ ]*)
89496         -stack-list-arguments --no-frame-filters 1^M
89497         ^done,stack-args=[frame={level="0",args=[{name="<_object>",value="(ceiling_priority =\
89498         > 97, local => 0)"},{name="v",value="5"},{name="<_objectO>",value="true"}]},frame={le\
89499         vel="1",args=[{name="v",value="5"},{name="<_objectO>",value="true"}]},frame={level="2\
89500         ",args=[]}]^M
89501         (gdb) ^M
89502         FAIL: gdb.ada/mi_prot.exp: -stack-list-arguments --no-frame-filters 1 (unexpected out\
89503         put)
89504         ...
89505
89506         Fix this by updating the regexp to expect "^done,stack-args=" instead of
89507         "^done,stack=".
89508
89509         Tested on x86_64-linux.
89510
89511 2021-09-20  Tom de Vries  <tdevries@suse.de>
89512
89513         [gdb/testsuite] Register test for each arch separately in register_test_foreach_arch
89514         In gdb/disasm-selftests.c we have:
89515         ...
89516           selftests::register_test_foreach_arch ("print_one_insn",
89517                                                  selftests::print_one_insn_test);
89518         ...
89519         and we get:
89520         ...
89521         $ gdb -q -batch -ex "maint selftest print_one_insn" 2>&1 \
89522           | grep ^Running
89523         Running selftest print_one_insn.
89524         $
89525         ...
89526
89527         Change the semantics register_test_foreach_arch such that a version of
89528         print_one_insn is registered for each architecture, such that we have:
89529         ...
89530         $ gdb -q -batch -ex "maint selftest print_one_insn" 2>&1 \
89531           | grep ^Running
89532         Running selftest print_one_insn::A6.
89533         Running selftest print_one_insn::A7.
89534         Running selftest print_one_insn::ARC600.
89535           ...
89536         $
89537         ...
89538
89539         This makes it f.i. possible to do:
89540         ...
89541         $ gdb -q -batch a.out -ex "maint selftest print_one_insn::armv8.1-m.main"
89542         Running selftest print_one_insn::armv8.1-m.main.
89543         Self test failed: self-test failed at src/gdb/disasm-selftests.c:165
89544         Ran 1 unit tests, 1 failed
89545         ...
89546
89547         Tested on x86_64-linux with an --enable-targets=all build.
89548
89549 2021-09-20  Tom de Vries  <tdevries@suse.de>
89550
89551         [gdb] Change register_test to use std::function arg
89552         Change register_test to use std::function arg, such that we can do:
89553         ...
89554           register_test (test_name, [=] () { SELF_CHECK (...); });
89555         ...
89556
89557         Tested on x86_64-linux.
89558
89559 2021-09-20  Tom de Vries  <tdevries@suse.de>
89560
89561         [gdb/testsuite] Fix gdb.ada/big_packed_array.exp xfail for -m32
89562         With test-case gdb.ada/big_packed_array.exp and target board unix/-m32 I run
89563         into:
89564         ...
89565         (gdb) print bad^M
89566         $2 = (0 => 0 <repeats 24 times>, 160)^M
89567         (gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad
89568         ...
89569
89570         The problem is that while the variable is an array of 196 bits (== 24.5 bytes),
89571         the debug information describes it as 25 unsigned char.  This is PR
89572         gcc/101643, and the test-case contains an xfail for this, which catches only:
89573         ...
89574         (gdb) print bad^M
89575         $2 = (0 => 0 <repeats 25 times>)^M
89576         ...
89577
89578         Fix this by updating the xfail pattern.
89579
89580         Tested on x86_64-linux.
89581
89582 2021-09-20  Simon Marchi  <simon.marchi@polymtl.ca>
89583
89584         gdbsupport/gdb_proc_service.h: use decltype instead of typeof
89585         Bug 28341 shows that GDB fails to compile when built with -std=c++11.
89586         I don't know much about the use case, but according to the author of the
89587         bug:
89588
89589             I encountered the scenario where CXX is set to "g++ -std=c++11" when
89590             I try to compile binutils under GCC as part of the GCC 3-stage
89591             compilation, which is common for building a cross-compiler.
89592
89593         The author of the bug suggests using __typeof__ instead of typeof.  But
89594         since we're using C++, we might as well use decltype, which is standard.
89595         This is what this patch does.
89596
89597         The failure (and fix) can be observed by configuring GDB with CXX="g++
89598         -std=c++11":
89599
89600               CXX    linux-low.o
89601             In file included from /home/simark/src/binutils-gdb/gdbserver/gdb_proc_service.h:22,
89602                              from /home/simark/src/binutils-gdb/gdbserver/linux-low.h:27,
89603                              from /home/simark/src/binutils-gdb/gdbserver/linux-low.cc:20:
89604             /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/gdb_proc_service.h:177:50: error: expected constructor, destructor, or type conversion before (token
89605               177 |   __attribute__((visibility ("default"))) typeof (SYM) SYM
89606                   |                                                  ^
89607             /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/gdb_proc_service.h:179:1: note: in expansion of macro PS_EXPORT
89608               179 | PS_EXPORT (ps_get_thread_area);
89609                   | ^~~~~~~~~
89610
89611         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28341
89612         Change-Id: I84fbaae938209d8d935ca08dec9b7e6a0dd1bda0
89613
89614 2021-09-20  Andrew Burgess  <andrew.burgess@embecosm.com>
89615
89616         riscv: print .2byte or .4byte before an unknown instruction encoding
89617         When the RISC-V disassembler encounters an unknown instruction, it
89618         currently just prints the value of the bytes, like this:
89619
89620           Dump of assembler code for function custom_insn:
89621              0x00010132 <+0>:   addi    sp,sp,-16
89622              0x00010134 <+2>:   sw      s0,12(sp)
89623              0x00010136 <+4>:   addi    s0,sp,16
89624              0x00010138 <+6>:   0x52018b
89625              0x0001013c <+10>:  0x9c45
89626
89627         My proposal, in this patch, is to change the behaviour to this:
89628
89629           Dump of assembler code for function custom_insn:
89630              0x00010132 <+0>:   addi    sp,sp,-16
89631              0x00010134 <+2>:   sw      s0,12(sp)
89632              0x00010136 <+4>:   addi    s0,sp,16
89633              0x00010138 <+6>:   .4byte  0x52018b
89634              0x0001013c <+10>:  .2byte  0x9c45
89635
89636         Adding the .4byte and .2byte opcodes.  The benefit that I see here is
89637         that in the patched version of the tools, the disassembler output can
89638         be fed back into the assembler and it should assemble to the same
89639         binary format.  Before the patch, the disassembler output is invalid
89640         assembly.
89641
89642         I've started a RISC-V specific test file under binutils so that I can
89643         add a test for this change.
89644
89645         binutils/ChangeLog:
89646
89647                 * testsuite/binutils-all/riscv/riscv.exp: New file.
89648                 * testsuite/binutils-all/riscv/unknown.d: New file.
89649                 * testsuite/binutils-all/riscv/unknown.s: New file.
89650
89651         opcodes/ChangeLog:
89652
89653                 * riscv-dis.c (riscv_disassemble_insn): Print a .%dbyte opcode
89654                 before an unknown instruction, '%d' is replaced with the
89655                 instruction length.
89656
89657 2021-09-20  Alan Modra  <amodra@gmail.com>
89658
89659         Fix allocate_filenum last dir/file checks
89660                 * dwarf2dbg.c (allocate_filenum) Correct use of last_used_dir_len.
89661
89662 2021-09-20  Alan Modra  <amodra@gmail.com>
89663
89664         Re: PR28149, debug info with wrong file association
89665         Fixes segfaults when building aarch64-linux kernel, due to only doing
89666         part of the work necessary when allocating file numbers late.  I'd
89667         missed looping over subsegments, which resulted in some u.filename
89668         entries left around and later interpreted as u.view.
89669
89670                 PR 28149
89671                 * dwarf2dbg.c (purge_generated_debug): Iterate over subsegs too.
89672                 (dwarf2_finish): Call do_allocate_filenum for all subsegs too,
89673                 in a separate loop before subsegs are chained.
89674
89675 2021-09-20  Alan Modra  <amodra@gmail.com>
89676
89677         Move eelf_mipsel_haiki.c to ALL_64_EMULATION_SOURCES
89678         --enable-targets=all on a 32-bit host results in a link failure with
89679         undefined references due to elfxx-mips.c not being compiled.  This
89680         patch fixes that by putting eelf_mipsel_haiki.c in the correct
89681         EMULATION_SOURCES Makefile variable.  I've also added a bunch of
89682         missing file dependencies and sorted a few things so that it's easier
89683         to verify dependencies are present.
89684
89685                 * Makfile.am: Add missing haiku dependencies, sort.
89686                 (ALL_EMULATION_SOURCES): Sort.  Move eelf_mipsel_haiku.c to..
89687                 (ALL_64_EMULATION_SOURCES): ..here.  Sort.
89688                 * Makfile.in: Regenerate.
89689
89690 2021-09-20  GDB Administrator  <gdbadmin@sourceware.org>
89691
89692         Automatic date update in version.in
89693
89694 2021-09-19  H.J. Lu  <hjl.tools@gmail.com>
89695
89696         elf: Don't set version info on unversioned symbols
89697         Don't set version info on unversioned symbols when seeing a hidden
89698         versioned symbol after an unversioned definition and the default
89699         versioned symbol.
89700
89701         bfd/
89702
89703                 PR ld/28348
89704                 * elflink.c (elf_link_add_object_symbols): Don't set version info
89705                 on unversioned symbols.
89706
89707         ld/
89708
89709                 PR ld/28348
89710                 * testsuite/ld-elf/pr28348.rd: New file.
89711                 * testsuite/ld-elf/pr28348.t: Likewise.
89712                 * testsuite/ld-elf/pr28348a.c: Likewise.
89713                 * testsuite/ld-elf/pr28348b.c: Likewise.
89714                 * testsuite/ld-elf/pr28348c.c: Likewise.
89715                 * testsuite/ld-elf/shared.exp: Run PR ld/28348 tests.
89716
89717 2021-09-19  Mike Frysinger  <vapier@gentoo.org>
89718
89719         gdb: manual: update @inforef to @xref
89720         The @inforef command is deprecated, and @xref does the samething.
89721         Also had to update the text capitalization to match current manual.
89722         Verified that info & HTML links work.
89723
89724 2021-09-19  Weimin Pan  <weimin.pan@oracle.com>
89725
89726         CTF: multi-CU and archive support
89727         Now gdb is capable of debugging executable, which consists of multiple
89728         compilation units (CUs) with the CTF debug info. An executable could
89729         potentially have one or more archives, which, in CTF context, contain
89730         conflicting types.
89731
89732         all changes were made in ctfread.c in which elfctf_build_psymtabs was
89733         modified to handle archives, via the ctf archive iterator and its callback
89734         build_ctf_archive_member and scan_partial_symbols was modified to scan
89735         archives, which are treated as subfiles, to build the psymtabs.
89736
89737         Also changes were made to handle CTF's data object section and function
89738         info section which now share the same format of their contents - an array
89739         of type IDs. New functions ctf_psymtab_add_stt_entries, which is called by
89740         ctf_psymtab_add_stt_obj and ctf_psymtab_add_stt_func, and add_stt_entries,
89741         which is called by add_stt_obj and add_stt_func when setting up psymtabs
89742         and full symtab, respectively.
89743
89744 2021-09-19  GDB Administrator  <gdbadmin@sourceware.org>
89745
89746         Automatic date update in version.in
89747
89748 2021-09-18  Tom de Vries  <tdevries@suse.de>
89749
89750         [gdb/testsuite] Fix gdb.server/server-kill.exp with -m32
89751         When running test-case gdb.server/server-kill.exp with target board unix/-m32,
89752         I run into:
89753         ...
89754         0xf7fd6b20 in _start () from /lib/ld-linux.so.2^M
89755         (gdb) Executing on target: kill -9 13082    (timeout = 300)
89756         builtin_spawn -ignore SIGHUP kill -9 13082^M
89757         bt^M
89758         (gdb) FAIL: gdb.server/server-kill.exp: kill_pid_of=server: test_unwind_syms: bt
89759         ...
89760
89761         The test-case expects the backtrace command to trigger remote communication,
89762         which then should result in a "Remote connection closed" or similar.
89763
89764         However, no remote communication is triggered, because we hit the "Check that
89765         this frame is unwindable" case in get_prev_frame_always_1.
89766
89767         We don't hit this problem in the kill_pid_of=inferior case, because there we
89768         run to main before doing the backtrace.
89769
89770         Fix this by doing the same in the kill_pid_of=server case.
89771
89772         Tested on x86_64-linux.
89773
89774 2021-09-18  Tom de Vries  <tdevries@suse.de>
89775
89776         [gdb/ada] Handle artificial local symbols
89777         With current master and gcc 7.5.0/8.5.0, we have this timeout:
89778         ...
89779         (gdb) print s^M
89780         Multiple matches for s^M
89781         [0] cancel^M
89782         [1] s at src/gdb/testsuite/gdb.ada/interface/foo.adb:20^M
89783         [2] s at src/gdb/testsuite/gdb.ada/interface/foo.adb:?^M
89784         > FAIL: gdb.ada/interface.exp: print s (timeout)
89785         ...
89786
89787         [ The FAIL doesn't reproduce with gcc 9.3.1.  This difference in
89788         behaviour bisects to gcc commit d70ba0c10de.
89789
89790         The FAIL with earlier gcc bisects to gdb commit ba8694b650b. ]
89791
89792         The FAIL is caused by gcc generating this debug info describing a named
89793         artificial variable:
89794         ...
89795          <2><1204>: Abbrev Number: 31 (DW_TAG_variable)
89796             <1205>   DW_AT_name        : s.14
89797             <1209>   DW_AT_type        : <0x1213>
89798             <120d>   DW_AT_artificial  : 1
89799             <120d>   DW_AT_location    : 5 byte block: 91 e0 7d 23 18   \
89800               (DW_OP_fbreg: -288; DW_OP_plus_uconst: 24)
89801         ...
89802
89803         An easy way to fix this would be to simply not put named artificial variables
89804         into the symbol table.  However, that causes regressions for Ada.  It relies
89805         on being able to get the value from such variables, using a named reference.
89806
89807         Fix this instead by marking the symbol as artificial, and:
89808         - ignoring such symbols in ada_resolve_variable, which fixes the FAIL
89809         - ignoring such ada symbols in do_print_variable_and_value, which prevents
89810           them from showing up in "info locals"
89811
89812         Note that a fix for the latter was submitted here (
89813         https://sourceware.org/pipermail/gdb-patches/2008-January/054994.html ), and
89814         this patch borrows from it.
89815
89816         Tested on x86_64-linux.
89817
89818         Co-Authored-By: Joel Brobecker  <brobecker@adacore.com>
89819
89820         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28180
89821
89822 2021-09-18  GDB Administrator  <gdbadmin@sourceware.org>
89823
89824         Automatic date update in version.in
89825
89826 2021-09-17  Alan Modra  <amodra@gmail.com>
89827
89828         PR28149 part 2, purge generated line info
89829         Mixing compiler generated line info with gas generated line info is
89830         generally just confusing.  Also .loc directives with non-zero view
89831         fields might reference a previous .loc.  It becomes a little more
89832         tricky to locate that previous .loc if there might be gas generated
89833         line info present too.  Mind you, we turn off gas generation of line
89834         info on seeing compiler generated line info, so any reference back
89835         won't hit gas generated line info.  At least, if the view info is
89836         sane.  Unfortunately, gas needs to handle mangled source.
89837
89838                 PR 28149
89839                 * dwarf2dbg.c (purge_generated_debug): New function.
89840                 (dwarf2_directive_filename): Call the above.
89841                 (out_debug_line): Don't segfault after purging.
89842                 * testsuite/gas/i386/dwarf2-line-4.d: Update expected output.
89843                 * testsuite/gas/i386/dwarf4-line-1.d: Likewise.
89844                 * testsuite/gas/i386/dwarf5-line-1.d: Likewise.
89845                 * testsuite/gas/i386/dwarf5-line-2.d: Likewise.
89846
89847 2021-09-17  Alan Modra  <amodra@gmail.com>
89848
89849         PR28149, debug info with wrong file association
89850         gcc-11 and gcc-12 pass -gdwarf-5 to gas, in order to prime gas for
89851         DWARF 5 level debug info.  Unfortunately it seems there are cases
89852         where the compiler does not emit a .file or .loc dwarf debug directive
89853         before any machine instructions.  (Note that the .file directive
89854         typically emitted as the first line of assembly output doesn't count as
89855         a dwarf debug directive.  The dwarf .file has a file number before the
89856         file name string.)
89857
89858         This patch delays allocation of file numbers for gas generated line
89859         debug info until the end of assembly, thus avoiding any clashes with
89860         compiler generated file numbers.  Two fixes for test case source are
89861         necessary;  A .loc can't use a file number that hasn't already been
89862         specified with .file.
89863
89864         A followup patch will remove all the gas generated line info on
89865         seeing a .file directive.
89866
89867                 PR 28149
89868                 * dwarf2dbg.c (num_of_auto_assigned): Delete.
89869                 (current): Update initialisation.
89870                 (set_or_check_view): Replace all accesses to view with u.view.
89871                 (dwarf2_consume_line_info): Likewise.
89872                 (dwarf2_directive_loc): Likewise.  Assert that we aren't generating
89873                 line info.
89874                 (dwarf2_gen_line_info_1): Don't call set_or_check_view on
89875                 gas generated line entries.
89876                 (dwarf2_gen_line_info): Set and track filenames for gas generated
89877                 line entries.  Simplify generation of labels.
89878                 (get_directory_table_entry): Use filename_cmp when comparing dirs.
89879                 (do_allocate_filenum): New function.
89880                 (dwarf2_where): Set u.filename and filenum to -1 for gas generated
89881                 line entries.
89882                 (dwarf2_directive_filename): Remove num_of_auto_assigned handling.
89883                 (process_entries): Update view field access.  Call
89884                 do_allocate_filenum.
89885                 * dwarf2dbg.h (struct dwarf2_line_info): Add filename field in
89886                 union aliasing view.
89887                 * testsuite/gas/i386/dwarf2-line-3.s: Add .file directive.
89888                 * testsuite/gas/i386/dwarf2-line-4.s: Likewise.
89889                 * testsuite/gas/i386/dwarf2-line-4.d: Update expected output.
89890                 * testsuite/gas/i386/dwarf4-line-1.d: Likewise.
89891                 * testsuite/gas/i386/dwarf5-line-1.d: Likewise.
89892                 * testsuite/gas/i386/dwarf5-line-2.d: Likewise.
89893
89894 2021-09-17  Alan Modra  <amodra@gmail.com>
89895
89896         [GOLD] PowerPC64 support for sym+addend GOT entries
89897         Pass addends to all the GOT handling functions, plus remove some
89898         extraneous asserts.
89899
89900                 PR 28192
89901                 * powerpc.cc (Output_data_got_powerpc): Add addend parameter to
89902                 all methods creating got entries.
89903                 (Target_powerpc::Scan::local): Pass reloc addend to got handling
89904                 functions, and when creating dynamic got relocations.
89905                 (Target_powerpc::Scan::global): Likewise.
89906                 (Target_powerpc::Relocate::relocate): Likewise.  Remove extraneous
89907                 assertions.
89908
89909 2021-09-17  Alan Modra  <amodra@gmail.com>
89910
89911         [GOLD] Got_entry::write addends
89912         This takes care of writing out GOT entries with addends.  The local
89913         symbol case was already largely handled, except for passing the addend
89914         to tls_offset_for_local which might need the addend in a
89915         local_got_offset call.  That's needed also in tls_offset_for_global.
89916
89917         I'm assuming here that GOT entries for function symbols won't ever
89918         have addends, and in particular that a GOT entry referencing PLT call
89919         stub code won't want an offset into the code.
89920
89921                 PR 28192
89922                 * output.cc (Output_data_got::Got_entry::write): Include addend
89923                 in global symbol value.  Pass addend to tls_offset_for_*.
89924                 * powerpc.cc (Target_powerpc::do_tls_offset_for_local): Handle addend.
89925                 (Target_powerpc::do_tls_offset_for_global): Likewise.
89926                 * s390.cc (Target_s390::do_tls_offset_for_local): Likewise.
89927                 (Target_s390::do_tls_offset_for_global): Likewise.
89928                 * target.h (Target::tls_offset_for_local): Add addend param.
89929                 (Target::tls_offset_for_global): Likewise.
89930                 (Target::do_tls_offset_for_local): Likewise.
89931                 (Target::do_tls_offset_for_global): Likewise.
89932
89933 2021-09-17  Alan Modra  <amodra@gmail.com>
89934
89935         [GOLD] Output_data_got create entry method addends
89936         This patch makes all the Output_data_got methods that create new
89937         entries accept an optional addend.
89938
89939                 PR 28192
89940                 * output.h (Output_data_got::add_global): Add optional addend
89941                 parameter.  Update comment.  Delete overload without addend.
89942                 (Output_data_got::add_global_plt): Likewise.
89943                 (Output_data_got::add_global_tls): Likewise.
89944                 (Output_data_got::add_global_with_rel): Likewise.
89945                 (Output_data_got::add_global_pair_with_rel): Likewise.
89946                 (Output_data_got::add_local_plt): Likewise.
89947                 (Output_data_got::add_local_tls): Likewise.
89948                 (Output_data_got::add_local_tls_pair): Likewise.
89949                 (Output_data_got::reserve_local): Likewise.
89950                 (Output_data_got::reserve_global): Likewise.
89951                 (Output_data_got::Got_entry): Include addend in global sym
89952                 constructor.  Delete local sym constructor without addend.
89953                 * output.cc (Output_data_got::add_global): Add addend param,
89954                 pass to got handling methods.
89955                 (Output_data_got::add_global_plt): Likewise.
89956                 (Output_data_got::add_global_with_rel): Likewise.
89957                 (Output_data_got::add_global_pair_with_rel): Likewise.
89958                 (Output_data_got::add_local_plt): Likewise.
89959                 (Output_data_got::add_local_tls_pair): Likewise.
89960                 (Output_data_got::reserve_local): Likewise.
89961                 (Output_data_got::reserve_global): Likewise.
89962
89963 2021-09-17  Alan Modra  <amodra@gmail.com>
89964
89965         [GOLD] Output_data_got tidy
89966         Some Output_data_got methods already have support for addends, but
89967         were implemented as separate methods.  This removes unnecessary code
89968         duplication.
89969
89970         Relobj::local_has_got_offset and others there get a similar treatment.
89971         Comments are removed since it should be obvious without a comment, and
89972         the existing comments are not precisely what the code does.  For
89973         example, a local_has_got_offset call without an addend does not return
89974         whether the local symbol has *a* GOT offset of type GOT_TYPE, it
89975         returns whether there is a GOT entry of type GOT_TYPE for the symbol
89976         with addend of zero.
89977
89978                 PR 28192
89979                 * output.h (Output_data_got::add_local): Make addend optional.
89980                 (Output_data_got::add_local_with_rel): Likewise.
89981                 (Output_data_got::add_local_pair_with_rel): Likewise.
89982                 * output.cc (Output_data_got::add_local): Delete overload
89983                 without addend.
89984                 (Output_data_got::add_local_with_rel): Likewise.
89985                 (Output_data_got::add_local_pair_with_rel): Likewise.
89986                 * object.h (Relobj::local_has_got_offset): Make addend optional.
89987                 Delete overload without addend later.  Update comment.
89988                 (Relobj::local_got_offset): Likewise.
89989                 (Relobj::set_local_got_offset): Likewise.
89990
89991 2021-09-17  Alan Modra  <amodra@gmail.com>
89992
89993         [GOLD] Remove addend from Local_got_entry_key
89994         This patch removes the addend from Local_got_entry_key, which is
89995         unnecessary now that Got_offset_list has an addend.  Note that it
89996         might be advantageous to keep the addend in Local_got_entry_key when
89997         linking objects containing a large number of section_sym+addend@got
89998         relocations.  I opted to save some memory by removing the field but
89999         left the class there in case we might need to restore {sym,addend}
90000         lookup.  That's also why this change is split out from the
90001         Got_offset_list change.
90002
90003                 PR 28192
90004                 * object.h (Local_got_entry_key): Delete addend_ field.
90005                 Adjust constructor and methods to suit.
90006                 * object.cc (Sized_relobj::do_for_all_local_got_entries):
90007                 Update key.
90008
90009 2021-09-17  Alan Modra  <amodra@gmail.com>
90010
90011         [GOLD] Got_offset_list: addend field
90012         This is the first in a series of patches aimed at supporting GOT
90013         entries against symbol plus addend generally for PowerPC64 rather than
90014         just section symbol plus addend as gold has currently.
90015
90016         This patch adds an addend field to Got_offset_list, so that both local
90017         and global symbols can have GOT entries with addend.
90018
90019                 PR 28192
90020                 * object.h (Got_offset_list): Add addend_ field, init in both
90021                 constructors.  Adjust all accessors to suit.
90022                 (Sized_relobj::do_local_has_got_offset): Adjust to suit.
90023                 (Sized_relobj::do_local_got_offset): Likewise.
90024                 (Sized_relobj::do_set_local_got_offset): Likewise.
90025                 * symtab.h (Symbol::has_got_offset): Add optional addend param.
90026                 (Symbol::got_offset, Symbol::set_got_offset): Likewise.
90027                 * incremental.cc (Local_got_offset_visitor::visit): Add unused
90028                 uint64_t parameter with FIXME.
90029                 (Global_got_offset_visitor::visit): Add unused uint64_t parameter.
90030
90031 2021-09-17  Henry Castro  <hcvcastro@gmail.com>
90032
90033         Fix segfault when running ia16-elf-gdb
90034         "A problem internal to GDB has been detected,
90035         further debugging may prove unreliable."
90036
90037         Segmentation fault
90038
90039 2021-09-17  Nelson Chu  <nelson.chu@sifive.com>
90040
90041         RISC-V: Merged extension string tables and their version tables into one.
90042         There are two main reasons for this patch,
90043
90044         * In the past we had two extension tables, one is used to record all
90045         supported extensions in bfd/elfxx-riscv.c, another is used to get the
90046         default extension versions in gas/config/tc-riscv.c.  It is hard to
90047         maintain lots of tables in different files, but in fact we can merge
90048         them into just one table.  Therefore, we now define many riscv_supported_std*
90049         tables, which record names and versions for all supported extensions.
90050         We not only use these tables to initialize the riscv_ext_order, but
90051         also use them to get the default versions of extensions, and decide if
90052         the extensions should be enbaled by default.
90053
90054         * We add a new filed `default_enable' for the riscv_supported_std* tables,
90055         to decide if the extension should be enabled by default.  For now if the
90056         `default_enable' field of the extension is set to EXT_DEFAULT, then we
90057         should enable the extension when the -march and elf architecture attributes
90058         are not set.  In the future, I suppose the `default_enable' can be set
90059         to lots of EXT_<VENDOR>, each vendor can decide to open which extensions,
90060         when the target triple of vendor is chosen.
90061
90062         The elf/linux regression tests of riscv-gnu-toolchain are passed.
90063
90064         bfd/
90065                 * elfnn-riscv.c (cpu-riscv.h): Removed sine it is included in
90066                 bfd/elfxx-riscv.h.
90067                 (riscv_merge_std_ext): Updated since the field of rpe is changed.
90068                 * elfxx-riscv.c (cpu-riscv.h): Removed.
90069                 (riscv_implicit_subsets): Added implicit extensions for g.
90070                 (struct riscv_supported_ext): Used to be riscv_ext_version.  Moved
90071                 from gas/config/tc-riscv.c, and added new field `default_enable' to
90072                 decide if the extension should be enabled by default.
90073                 (EXT_DEFAULT): Defined for `default_enable' field.
90074                 (riscv_supported_std_ext): It used to return the supported standard
90075                 architecture string, but now we move ext_version_table from
90076                 gas/config/tc-riscv.c to here, and rename it to riscv_supported_std_ext.
90077                 Currently we not only use the table to initialize riscv_ext_order, but
90078                 also get the default versions of extensions, and decide if the extensions
90079                 should be enbaled by default.
90080                 (riscv_supported_std_z_ext): Likewise, but is used for z* extensions.
90081                 (riscv_supported_std_s_ext): Likewise, but is used for s* extensions.
90082                 (riscv_supported_std_h_ext): Likewise, but is used for h* extensions.
90083                 (riscv_supported_std_zxm_ext): Likewise, but is used for zxm* extensions.
90084                 (riscv_all_supported_ext): Includes all supported extension tables.
90085                 (riscv_known_prefixed_ext): Updated.
90086                 (riscv_valid_prefixed_ext): Updated.
90087                 (riscv_init_ext_order): Init the riscv_ext_order table according to
90088                 riscv_supported_std_ext.
90089                 (riscv_get_default_ext_version): Moved from gas/config/tc-riscv.c.
90090                 Get the versions of extensions from riscv_supported_std* tables.
90091                 (riscv_parse_add_subset): Updated.
90092                 (riscv_parse_std_ext): Updated.
90093                 (riscv_set_default_arch): Set the default subset list according to
90094                 the default_enable field of riscv_supported_*ext tables.
90095                 (riscv_parse_subset): If the input ARCH is NULL, then we call
90096                 riscv_set_default_arch to set the default subset list.
90097                 * elfxx-riscv.h (cpu-riscv.h): Included.
90098                 (riscv_parse_subset_t): Removed get_default_version field, and added
90099                 isa_spec field to replace it.
90100                 (extern riscv_supported_std_ext): Removed.
90101         gas/
90102                 * (bfd/cpu-riscv.h): Removed.
90103                 (struct riscv_ext_version): Renamed and moved to bfd/elfxx-riscv.c.
90104                 (ext_version_table): Likewise.
90105                 (riscv_get_default_ext_version): Likewise.
90106                 (ext_version_hash): Removed.
90107                 (init_ext_version_hash): Removed.
90108                 (riscv_set_arch): Updated since the field of rps is changed.  Besides,
90109                 report error when the architecture string is empty.
90110                 (riscv_after_parse_args): Updated.
90111
90112 2021-09-17  GDB Administrator  <gdbadmin@sourceware.org>
90113
90114         Automatic date update in version.in
90115
90116 2021-09-16  Tom de Vries  <tdevries@suse.de>
90117
90118         [gdb/testsuite] Fix interrupted sleep in multi-threaded test-cases
90119         When running test-case gdb.threads/continue-pending-status.exp with native, I
90120         have:
90121         ...
90122         (gdb) continue^M
90123         Continuing.^M
90124         PASS: gdb.threads/continue-pending-status.exp: attempt 0: continue for ctrl-c
90125         ^C^M
90126         Thread 1 "continue-pendin" received signal SIGINT, Interrupt.^M
90127         [Switching to Thread 0x7ffff7fc4740 (LWP 1276)]^M
90128         0x00007ffff758e4c0 in __GI___nanosleep () at nanosleep.c:27^M
90129         27        return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
90130         (gdb) PASS: gdb.threads/continue-pending-status.exp: attempt 0: caught interrupt
90131         ...
90132         but with target board unix/-m32, I run into:
90133         ...
90134         (gdb) continue^M
90135         Continuing.^M
90136         PASS: gdb.threads/continue-pending-status.exp: attempt 0: continue for ctrl-c
90137         [Thread 0xf74aeb40 (LWP 31957) exited]^M
90138         [Thread 0xf7cafb40 (LWP 31956) exited]^M
90139         [Inferior 1 (process 31952) exited normally]^M
90140         (gdb) Quit^M
90141         ...
90142
90143         The problem is that the sleep (300) call at the end of main is interrupted,
90144         which causes the inferior to exit before the ctrl-c can be send.
90145
90146         This problem is described at "Interrupted System Calls" in the docs, and the
90147         suggested solution (using a sleep loop) indeed fixes the problem.
90148
90149         Fix this instead using the more prevalent:
90150         ...
90151           alarm (300);
90152           ...
90153           while (1) sleep (1);
90154         ...
90155         which is roughly equivalent because the sleep is called at the end of main,
90156         but slightly better because it guards against hangs from the start rather than
90157         from the end of main.
90158
90159         Likewise in gdb.base/watch_thread_num.exp.
90160
90161         Likewise in gdb.btrace/enable-running.exp, but use the sleep loop there,
90162         because the sleep is not called at the end of main.
90163
90164         Tested on x86_64-linux.
90165
90166 2021-09-16  Mike Frysinger  <vapier@gentoo.org>
90167
90168         gdb: manual: fix werrors typo
90169
90170 2021-09-16  GDB Administrator  <gdbadmin@sourceware.org>
90171
90172         Automatic date update in version.in
90173
90174 2021-09-15  Tom de Vries  <tdevries@suse.de>
90175
90176         [gdb/testsuite] Use function_range in gdb.dwarf2/dw2-abs-hi-pc.exp
90177         When I run test-case gdb.dwarf2/dw2-abs-hi-pc.exp with gcc, we have:
90178         ...
90179         (gdb) break hello^M
90180         Breakpoint 1 at 0x4004c0: file dw2-abs-hi-pc-hello.c, line 24.^M
90181         (gdb) PASS: gdb.dwarf2/dw2-abs-hi-pc.exp: break hello
90182         ...
90183         but with clang, I run into:
90184         ...
90185         (gdb) break hello^M
90186         Breakpoint 1 at 0x4004e4^M
90187         (gdb) FAIL: gdb.dwarf2/dw2-abs-hi-pc.exp: break hello
90188         ...
90189
90190         The problem is that the CU and function both have an empty address range:
90191         ...
90192          <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit)
90193             <108>   DW_AT_name        : dw2-abs-hi-pc-hello.c
90194             <123>   DW_AT_low_pc      : 0x4004e0
90195             <127>   DW_AT_high_pc     : 0x4004e0
90196          <1><12f>: Abbrev Number: 2 (DW_TAG_subprogram)
90197             <131>   DW_AT_name        : hello
90198             <13a>   DW_AT_low_pc      : 0x4004e0
90199             <13e>   DW_AT_high_pc     : 0x4004e0
90200         ...
90201
90202         The address ranges are set like this in dw2-abs-hi-pc-hello-dbg.S:
90203         ...
90204                 .4byte  .hello_start    /* DW_AT_low_pc */
90205                 .4byte  .hello_end      /* DW_AT_high_pc */
90206         ...
90207         where the labels refer to dw2-abs-hi-pc-hello.c:
90208         ...
90209         extern int v;
90210
90211         asm (".hello_start: .globl .hello_start\n");
90212         void
90213         hello (void)
90214         {
90215         asm (".hello0: .globl .hello0\n");
90216           v++;
90217         asm (".hello1: .globl .hello1\n");
90218         }
90219         asm (".hello_end: .globl .hello_end\n");
90220         ...
90221
90222         Using asm labels in global scope is a known source of problems, as explained
90223         in the comment of proc function_range in gdb/testsuite/lib/dwarf.exp.
90224
90225         Fix this by using function_range instead.
90226
90227         Tested on x86_64-linux with gcc and clang-7 and clang-12.
90228
90229 2021-09-15  Claudiu Zissulescu  <claziss@synopsys.com>
90230
90231         arc: Fix got-weak linker test
90232         Use regular expressions to fix the got-weak linker test.
90233
90234         ld/
90235                 * testsuite/got-weak.d: Update test.
90236
90237 2021-09-15  Andrew Burgess  <andrew.burgess@embecosm.com>
90238
90239         bfd: fix incorrect type used in sizeof
90240         Noticed in passing that we used 'sizeof (char **)' when calculating
90241         the size of a list of 'char *' pointers.  Of course, this isn't really
90242         going to make a difference anywhere, but we may as well be correct.
90243
90244         There should be no user visible changes after this commit.
90245
90246         bfd/ChangeLog:
90247
90248                 * archures.c (bfd_arch_list): Use 'char *' instead of 'char **'
90249                 when calculating space for a string list.
90250
90251 2021-09-15  Tom de Vries  <tdevries@suse.de>
90252
90253         [gdb/doc] Fix typo in maint selftest entry
90254         Fix typo "will by" -> "will be".
90255
90256 2021-09-15  Tom de Vries  <tdevries@suse.de>
90257
90258         [bfd] Ensure unique printable names for bfd archs
90259         Remove duplicate entry in bfd_ft32_arch and bfd_rx_arch.
90260
90261         Fix printable name for bfd_mach_n1: "nh1" -> "n1".
90262
90263                 PR 28336
90264                 * cpu-ft32.c (arch_info_struct): Remove "ft32" entry.
90265                 * cpu-rx.c (arch_info_struct): Remove "rx" entry.
90266                 * cpu-nds32.c (bfd_nds32_arch): Fix printable name for bfd_mach_n1
90267                 entry.
90268
90269 2021-09-15  Alan Modra  <amodra@gmail.com>
90270
90271         PR28328, dlltool ice
90272                 PR 28328
90273                 * archive.c (bfd_ar_hdr_from_filesystem): Don't use bfd_set_input_error
90274                 here, our caller will do that.
90275
90276 2021-09-15  GDB Administrator  <gdbadmin@sourceware.org>
90277
90278         Automatic date update in version.in
90279
90280 2021-09-14  Tom de Vries  <tdevries@suse.de>
90281
90282         [gdb/testsuite] Fix gdb_load_no_complaints with gnu-debuglink
90283         When running test-case gdb.dwarf2/dw2-ranges-psym-warning.exp with target
90284         board gnu-debuglink I run into:
90285         ...
90286         (gdb) file dw2-ranges-psym-warning^M
90287         Reading symbols from dw2-ranges-psym-warning...^M
90288         Reading symbols from .debug/dw2-ranges-psym-warning.debug...^M
90289         (gdb) FAIL: gdb.dwarf2/dw2-ranges-psym-warning.exp: No complaints
90290         ...
90291
90292         Fix this by updating the regexp in gdb_load_no_complaints.
90293
90294         Tested on x86_64-linux.
90295
90296 2021-09-14  Tom de Vries  <tdevries@suse.de>
90297
90298         [gdb/symtab] Fix function range handling in psymtabs
90299         Consider the test-case from this patch.
90300
90301         We run into:
90302         ...
90303         (gdb) PASS: gdb.dwarf2/dw2-ranges-psym-warning.exp: continue
90304         bt^M
90305         warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in symtab.)^M
90306         ^M
90307         warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in symtab.)^M
90308         ^M
90309         warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in symtab.)^M
90310         ^M
90311         warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in symtab.)^M
90312         ^M
90313         warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in symtab.)^M
90314         ^M
90315         warning: (Internal error: pc 0x4004b6 in read in psymtab, but not in symtab.)^M
90316         ^M
90317           read in psymtab, but not in symtab.)^M
90318         ^M
90319         )^M
90320         (gdb) FAIL: gdb.dwarf2/dw2-ranges-psym-warning.exp: bt
90321         ...
90322
90323         This happens as follows.
90324
90325         The function foo:
90326         ...
90327          <1><31>: Abbrev Number: 4 (DW_TAG_subprogram)
90328             <33>   DW_AT_name        : foo
90329             <37>   DW_AT_ranges      : 0x0
90330         ...
90331         has these ranges:
90332         ...
90333             00000000 00000000004004c1 00000000004004d2
90334             00000000 00000000004004ae 00000000004004af
90335             00000000 <End of list>
90336         ...
90337         which have a hole at at [0x4004af,0x4004c1).
90338
90339         However, the address map of the partial symtabs incorrectly maps addresses
90340         in the hole (such as 0x4004b6 in the backtrace) to the foo CU.
90341
90342         The address map of the full symbol table of the foo CU however does not
90343         contain the addresses in the hole, which is what the warning / internal error
90344         complains about.
90345
90346         Fix this by making sure that ranges of functions are read correctly.
90347
90348         The patch adds a bit to struct partial_die_info, in this hole (shown for
90349         x86_64-linux):
90350         ...
90351         /*   11: 7   |     4 */    unsigned int canonical_name : 1;
90352         /* XXX  4-byte hole  */
90353         /*   16      |     8 */    const char *raw_name;
90354         ...
90355         So there's no increase in size for 64-bit, but AFAIU there will be an increase
90356         for 32-bit.
90357
90358         Tested on x86_64-linux.
90359
90360         gdb/ChangeLog:
90361
90362         2021-08-10  Tom de Vries  <tdevries@suse.de>
90363
90364                 PR symtab/28200
90365                 * dwarf2/read.c (struct partial_die_info): Add has_range_info and
90366                 range_offset field.
90367                 (add_partial_subprogram): Handle pdi->has_range_info.
90368                 (partial_die_info::read): Set pdi->has_range_info.
90369
90370         gdb/testsuite/ChangeLog:
90371
90372         2021-08-10  Tom de Vries  <tdevries@suse.de>
90373
90374                 PR symtab/28200
90375                 * gdb.dwarf2/dw2-ranges-psym-warning-main.c: New test.
90376                 * gdb.dwarf2/dw2-ranges-psym-warning.c: New test.
90377                 * gdb.dwarf2/dw2-ranges-psym-warning.exp: New file.
90378
90379 2021-09-14  Tom de Vries  <tdevries@suse.de>
90380
90381         [gdb/symtab] Fix CU list in .debug_names for dummy CUs
90382         With current trunk and target board cc-with-debug-names we have:
90383         ...
90384         (gdb) file dw2-ranges-psym^M
90385         Reading symbols from dw2-ranges-psym...^M
90386         warning: Section .debug_names in dw2-ranges-psym has abbreviation_table of \
90387           size 1 vs. written as 28, ignoring .debug_names.^M
90388         (gdb) set complaints 0^M
90389         (gdb) FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
90390         ...
90391
90392         The executable has 8 compilation units:
90393         ...
90394         $ readelf -wi dw2-ranges-psym | grep @
90395           Compilation Unit @ offset 0x0:
90396           Compilation Unit @ offset 0x2e:
90397           Compilation Unit @ offset 0xa5:
90398           Compilation Unit @ offset 0xc7:
90399           Compilation Unit @ offset 0xd2:
90400           Compilation Unit @ offset 0x145:
90401           Compilation Unit @ offset 0x150:
90402           Compilation Unit @ offset 0x308:
90403         ...
90404         of which the ones at 0xc7 and 0x145 are dummy CUs (that is, they do not
90405         contain a single DIE), which were added by recent commit 5ef670d81fd
90406         "[gdb/testsuite] Add dummy start and end CUs in dwarf assembly".
90407
90408         The .debug_names section contains this CU table:
90409         ...
90410         [  0] 0x0
90411         [  1] 0x2e
90412         [  2] 0xa5
90413         [  3] 0xd2
90414         [  4] 0x150
90415         [  5] 0x308
90416         [  6] 0x1
90417         [  7] 0x0
90418         ...
90419         The last two entries are incorrect, and the entries for the dummy CUs are
90420         missing.
90421
90422         The last two entries are incorrect because here in write_debug_names we write
90423         the dimension of the CU list as 8:
90424         ...
90425           /* comp_unit_count - The number of CUs in the CU list.  */
90426           header.append_uint (4, dwarf5_byte_order,
90427                              per_objfile->per_bfd->all_comp_units.size ()
90428                              - per_objfile->per_bfd->tu_stats.nr_tus);
90429         ...
90430         while the actual dimension of the CU list is 6.
90431
90432         The discrepancy is caused by this code which skips the dummy CUs:
90433         ...
90434           for (int i = 0; i < per_objfile->per_bfd->all_comp_units.size (); ++i)
90435             {
90436               ...
90437               /* CU of a shared file from 'dwz -m' may be unused by this main
90438                 file.  It may be referenced from a local scope but in such
90439                 case it does not need to be present in .debug_names.  */
90440               if (psymtab == NULL)
90441                continue;
90442         ...
90443         because they have a null partial symtab.
90444
90445         We can fix this by writing the actual dimension of the CU list, but that still
90446         leaves the dummy CUs out of the CU list.  The purpose of having these is to
90447         delimit the end of preceding CUs.
90448
90449         So, fix this by:
90450         - removing the code that skips the dummy CUs (note that the same change
90451           was done for .gdb_index in commit efba5c2319d '[gdb/symtab] Handle PU
90452           without import in "save gdb-index"'.
90453         - verifying that all units are represented in the CU/TU lists
90454         - using the actual CU list size when writing the dimension of the CU list
90455           (and likewise for the TU list).
90456
90457         Tested on x86_64-linux with native and target board cc-with-debug-names.
90458
90459         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28261
90460
90461 2021-09-14  Tom de Vries  <tdevries@suse.de>
90462
90463         [gdb/testsuite] Generate .debug_aranges in gdb.dwarf2/locexpr-data-member-location.exp
90464         When running test-case gdb.dwarf2/locexpr-data-member-location.exp with target
90465         board cc-with-debug-names, all tests pass but we run into PR28261:
90466         ...
90467         (gdb) run ^M
90468         Starting program: locexpr-data-member-location ^M
90469         warning: Section .debug_names in locexpr-data-member-location-lib.so has \
90470           abbreviation_table of size 1 vs. written as 37, ignoring .debug_names.^M
90471         ...
90472
90473         Using a patch that fixes PR28261, the warning is gone, but we run into:
90474         ...
90475         FAIL: gdb.dwarf2/locexpr-data-member-location.exp: step into foo
90476         ...
90477
90478         This is due a missing .debug_aranges contribution for the CU declared in
90479         gdb.dwarf2/locexpr-data-member-location.exp.
90480
90481         Fix this by adding the missing .debug_aranges contribution.
90482
90483         Tested on x86_64-linux.
90484
90485 2021-09-14  Claudiu Zissulescu  <claziss@synopsys.com>
90486
90487         arc: Fix potential invalid pointer access when fixing got symbols.
90488         When statically linking, it can arrive to an undefined weak symbol of
90489         which its value cannot be determined. However, we are having pieces of
90490         code which doesn't take this situation into account, leading to access
90491         a structure which may not be initialized. Fix this situation and add a
90492         test.
90493
90494         bfd/
90495         xxxx-xx-xx  Cupertino Miranda  <cmiranda@synopsys.com>
90496                     Claudiu Zissulescu  <claziss@synopsys.com>
90497
90498                 * arc-got.h (arc_static_sym_data): New structure.
90499                 (get_static_sym_data): New function.
90500                 (relocate_fix_got_relocs_for_got_info): Move the computation fo
90501                 symbol value and section to above introduced function, and use
90502                 this new function.
90503
90504         ld/testsuite/
90505         xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>
90506
90507                 * ld-arc/got-weak.d: New file.
90508                 * ld-arc/got-weak.s: Likewise.
90509
90510
90511         fix
90512
90513 2021-09-14  Mike Frysinger  <vapier@gentoo.org>
90514
90515         sim: bfin: add support for SDL2
90516         This probably should have been ported long ago, but better late than
90517         never.  We keep support for both versions for now since both projects
90518         tend to have long lifetimes.  Maybe consider dropping SDL1 in another
90519         ten years.
90520
90521 2021-09-14  GDB Administrator  <gdbadmin@sourceware.org>
90522
90523         Automatic date update in version.in
90524
90525 2021-09-14  Tom Tromey  <tom@tromey.com>
90526
90527         Remove use of __CYGNUSCLIB__
90528         I found a check of __CYGNUSCLIB__ in dbxread.c.  I think this is dead
90529         code.  This patch removes it.
90530
90531 2021-09-13  Tom de Vries  <tdevries@suse.de>
90532
90533         [gdb/testsuite] Check for valid test name
90534         When running gdb.base/batch-exit-status.exp I noticed that the test name
90535         contains a newline:
90536         ...
90537         PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
90538         : No such file or directory\.: [lindex $result 2] == 0
90539         ...
90540
90541         Check for this in ::CheckTestNames::check, such that we have a warning:
90542         ...
90543         PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
90544         : No such file or directory\.: [lindex $result 2] == 0
90545         WARNING: Newline in test name
90546         ...
90547
90548         Tested on x86_64-linux.
90549
90550 2021-09-13  Tom de Vries  <tdevries@suse.de>
90551
90552         [gdb/tdep] Fix exec check in gdb_print_insn_arm
90553         With a gdb build with --enable-targets=all we run into a KFAIL:
90554         ...
90555         KFAIL: gdb.gdb/unittest.exp: executable loaded: maintenance selftest, \
90556           failed none (PRMS: gdb/27891)
90557         ...
90558         due to:
90559         ...
90560         Running selftest print_one_insn.^M
90561         Self test failed: arch armv8.1-m.main: self-test failed at \
90562           disasm-selftests.c:165^M
90563         ...
90564
90565         The test fails because we expect disassembling of one arm insn to consume 4
90566         bytes and produce (using verbose = true in disasm-selftests.c):
90567         ...
90568         arm mov r0, #0
90569         ...
90570         but instead the disassembler uses thumb mode and only consumes 2
90571         bytes and produces:
90572         ...
90573         arm movs        r0, r0
90574         ...
90575
90576         The failure does not show up in the "no executable loaded" variant because
90577         this code in gdb_print_insn_arm isn't triggered:
90578         ...
90579           if (current_program_space->exec_bfd () != NULL)
90580             info->flags |= USER_SPECIFIED_MACHINE_TYPE;
90581         ...
90582         and consequently we do this in print_insn:
90583         ...
90584               if ((info->flags & USER_SPECIFIED_MACHINE_TYPE) == 0)
90585                 info->mach = bfd_mach_arm_unknown;
90586         ...
90587         and don't set force_thumb to true in select_arm_features.
90588
90589         The code in gdb_print_insn_arm makes the assumption that the disassembly
90590         architecture matches the exec architecture, which in this case is incorrect,
90591         because the exec architecture is x86_64, and the disassembly architecture is
90592         armv8.1-m.main.  Fix that by explicitly checking it:
90593         ...
90594           if (current_program_space->exec_bfd () != NULL
90595               && (current_program_space->exec_bfd ()->arch_info
90596                   == gdbarch_bfd_arch_info (gdbarch)))
90597         ...
90598
90599         This fixes the print_one_insn failure, so remove the KFAIL.
90600
90601         Tested on x86_64-linux.
90602
90603         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27891
90604
90605 2021-09-13  Tom de Vries  <tdevries@suse.de>
90606
90607         [gdb/tdep] Reset force_thumb in parse_arm_disassembler_options
90608         With a gdb build with --enable-targets=all, we have 2 arch-specific failures
90609         in selftest print_one_insn:
90610         ...
90611         $ gdb -q -batch a.out -ex "maint selftest print_one_insn" 2>&1 \
90612           | grep "Self test failed: arch "
90613         Self test failed: arch armv8.1-m.main: self-test failed at \
90614           disasm-selftests.c:165
90615         Self test failed: arch arm_any: self-test failed at disasm-selftests.c:165
90616         $
90617         ...
90618
90619         During the first failed test, force_thumb is set to true, and remains so until
90620         and during the second test, which causes the second failure.
90621
90622         Fix this by resetting force_thumb to false in parse_arm_disassembler_options,
90623         such that we get just one failure:
90624         ...
90625         $ gdb -q -batch a.out -ex "maint selftest print_one_insn" 2>&1 \
90626           | grep "Self test failed: arch "
90627         Self test failed: arch armv8.1-m.main: self-test failed at \
90628           disasm-selftests.c:165
90629         $
90630         ...
90631
90632         Tested on x86_64-linux.
90633
90634 2021-09-13  Tom Tromey  <tromey@adacore.com>
90635
90636         Fix no-Python build
90637         A build without Python will currently fail, because
90638         selftests::test_python uses gdb_python_initialized, which is only
90639         conditionally defined.
90640
90641         This patch fixes the build by making test_python also be conditionally
90642         defined.  I chose this approach because the selftest will fail if
90643         Python is not enabled, so it didn't seem useful to leave it defined.
90644
90645 2021-09-13  Nelson Chu  <nelson.chu@sifive.com>
90646
90647         RISC-V: Update the assembler insn testcase.
90648         Since the 0x57 is preserved for the vadd.vv instruction in the integration
90649         branch, remove it to make sure the testcase can work.
90650
90651         gas/
90652                 * testsuite/gas/riscv/insn.d: Remove 0x57 since it is preserved
90653                 for vadd.vv instruction.
90654                 * testsuite/gas/riscv/insn.s: Likewise.
90655
90656 2021-09-13  Jan Beulich  <jbeulich@suse.com>
90657
90658         MIPS: don't use get_symbol_name() for section parsing.  With s_change_section() later calling obj_elf_section(), it seems better to pre-parse the section name by the same function that will be used there. This way no differences in what is accepted will result.
90659         gas     * config/tc-mips.c (s_change_section): Use obj_elf_section_name to
90660                 parse the section name.
90661
90662         ia64: don't use get_symbol_name() for section parsing.  With cross_section() later calling obj_elf_section(), it seems better to pre-parse the section name by the same function that will be used there. This way no differences in what is accepted will result.
90663         gas     * config/tc-ia64.c (cross_section): Use obj_elf_section_name to
90664                 parse the section name.
90665
90666 2021-09-13  Tom de Vries  <tdevries@suse.de>
90667
90668         [gdb/testsuite] Fix gdb.gdb/selftest.exp
90669         With a gdb build with CFLAGS "-O2 -g -flto=auto", I run into:
90670         ...
90671          #7  gdb_main (args=0x7fffffffd220) at src/gdb/main.c:1368^M
90672          #8  main (argc=<optimized out>, argv=<optimized out>) at src/gdb/gdb.c:32^M
90673          (gdb) FAIL: gdb.gdb/selftest.exp: backtrace through signal handler
90674         ...
90675         which means that this regexp in proc test_with_self fails:
90676         ...
90677           -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
90678         ...
90679
90680         The problem is that gdb_main has been inlined into main, and consequently the
90681         backtrace uses:
90682         ...
90683          #x  <fn> ...
90684         ...
90685         instead of
90686         ...
90687          #x  <address> in <fn> ...
90688         ...
90689
90690         Fix this by updating the regexp to not require "in" before " main".
90691
90692         Tested on x86_64-linux.
90693
90694 2021-09-13  Alan Modra  <amodra@gmail.com>
90695
90696         Re: Deprecate a.out support for NetBSD targets
90697                 * config.bfd: Correct m68-*-*bsd* obsolete target match.
90698
90699 2021-09-13  Tom de Vries  <tdevries@suse.de>
90700
90701         [gdb/testsuite] Fix test name in gdb.base/batch-exit-status.exp
90702         When running gdb.base/batch-exit-status.exp I noticed that the test name
90703         contains a newline:
90704         ...
90705         PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
90706         : No such file or directory\.: [lindex $result 2] == 0
90707         ...
90708
90709         The mistake is that I passed an output regexp argument to a parameter
90710         interpreted as testname prefix.  Fix this by passing a testname prefix
90711         instead.
90712
90713         Add support for checking output, to be able to handle the output regexp
90714         argument.
90715
90716         Tested on x86_64-linux.
90717
90718 2021-09-13  GDB Administrator  <gdbadmin@sourceware.org>
90719
90720         Automatic date update in version.in
90721
90722 2021-09-12  Tom de Vries  <tdevries@suse.de>
90723
90724         [gdb/testsuite] Set sysroot earlier in local-board.exp
90725         When running test-case gdb.base/batch-exit-status.exp for native, it passes.
90726         But with target board cc-with-debug-names, we run into (added missing double
90727         quotes for clarity):
90728         ...
90729         builtin_spawn $build/gdb/testsuite/../../gdb/gdb -nw -nx \
90730           -data-directory $build/gdb/testsuite/../data-directory \
90731           -iex "set height 0" -iex "set width 0" -ex "set sysroot" -batch ""^M
90732         : No such file or directory.^M
90733         PASS: gdb.base/batch-exit-status.exp: \
90734           : No such file or directory\.: [lindex $result 2] == 0
90735         FAIL: gdb.base/batch-exit-status.exp: \
90736           : No such file or directory\.: [lindex $result 3] == $expect_status
90737         ...
90738
90739         The difference between the passing and failing case is that with native we
90740         have (leaving out set height/width for brevity):
90741         ...
90742         $ gdb -batch ""; echo $?
90743         : No such file or directory.
90744         1
90745         ...
90746         and with target board cc-with-debug-names:
90747         ...
90748         $ gdb -ex "set sysroot" -batch ""; echo $?
90749         : No such file or directory.
90750         0
90751         ...
90752
90753         The difference is expected.  GDB returns the exit status of the last executed
90754         command.  In the former case that's 'file ""', which fails.  In the latter case,
90755         that's 'set sysroot', which succeeds.
90756
90757         Fix this by setting sysroot using -iex instead of -ex in local-board.exp, such
90758         that we have the expected:
90759         ...
90760         $ gdb -iex "set sysroot" -batch ""; echo $?
90761         : No such file or directory.
90762         1
90763         ...
90764
90765         Tested on x86_64-linux.
90766
90767 2021-09-12  GDB Administrator  <gdbadmin@sourceware.org>
90768
90769         Automatic date update in version.in
90770
90771 2021-09-11  Mike Frysinger  <vapier@gentoo.org>
90772
90773         sim: run: change help short option to -h
90774         It's unclear why -H was picked over the more standard -h, but since
90775         -h is still not used, just change -H to -h to match pretty much every
90776         other tool in the sourceware tree.
90777
90778 2021-09-11  GDB Administrator  <gdbadmin@sourceware.org>
90779
90780         Automatic date update in version.in
90781
90782 2021-09-10  Tom de Vries  <tdevries@suse.de>
90783
90784         [gdb/testsuite] Reimplement gdb.gdb/python-selftest.exp as unittest
90785         The test-case gdb.gdb/python-selftest.exp:
90786         - patches the gdb_python_initialized variable in gdb to 0
90787         - checks that the output of a python command is "Python not initialized"
90788
90789         Reimplement gdb.gdb/python-selftest.exp as unittest, using:
90790         - execute_command_to_string to capture the output
90791         - try/catch to catch the "Python not initialized" exception.
90792
90793         Tested on x86_64-linux.
90794
90795 2021-09-10  Tom de Vries  <tdevries@suse.de>
90796
90797         [gdb/testsuite] Fix DUPLICATE in gdb.base/global-var-nested-by-dso.exp
90798         Fix DUPLICATE in gdb.base/global-var-nested-by-dso.exp by naming commands more
90799         uniquely.
90800
90801 2021-09-10  Tom de Vries  <tdevries@suse.de>
90802
90803         [gdb/testsuite] Fix DUPLICATE in gdb.base/skip-solib.exp
90804         Fix DUPLICATE in gdb.base/skip-solib.exp by using with_test_prefix.
90805
90806         Also fix indentation style and long lines, remove outdated question/answer
90807         bits, and use multi_line.
90808
90809 2021-09-10  Tom de Vries  <tdevries@suse.de>
90810
90811         [gdb/testsuite] Fix handling of nr_args < 3 in mi_gdb_test
90812         The documentation of mi_gdb_test states that the command, pattern and message
90813         arguments are mandatory:
90814         ...
90815          # mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb;
90816          #   test the result.
90817         ...
90818
90819         However, this is not checked, and when mi_gdb_test is called with less than 3
90820         arguments, it passes or fails silently.
90821
90822         Fix this by using the following semantics:
90823         - if there are 1 or 2 arguments, use the command as the message.
90824         - if there is 1 argument, use ".*" as the pattern.
90825         - if there are no or too much arguments, error out.
90826
90827         Fix a PATH issue in gdb.mi/mi-logging.exp, introduced by using the command as
90828         message.  Fix a few other trivial-looking FAILs.
90829
90830         There are 11 less trivial-looking FAILs left in gdb.mi in test-cases:
90831         - mi-nsmoribund.exp
90832         - mi-breakpoint-changed.exp
90833         - mi-break.exp.
90834
90835         Tested on x86_64-linux.
90836
90837 2021-09-10  Tom de Vries  <tdevries@suse.de>
90838
90839         [gdb/testsuite] Add string_list_to_regexp
90840         A regexp pattern with escapes like this is hard to read:
90841         ...
90842         set re "~\"\[$\]$decimal = 1\\\\n\"\r\n\\^done"
90843         ...
90844
90845         We can make it more readable by spacing out parts (which allows us to also use
90846         the curly braces where that's convenient):
90847         ...
90848         set re [list "~" {"} {[$]} $decimal " = 1" "\\\\" "n" {"} "\r\n" "\\^" "done"]
90849         set re [join $re ""]
90850         ...
90851         or by using string_to_regexp:
90852         ...
90853         set re [list \
90854                     [string_to_regexp {~"$}] \
90855                     $decimal \
90856                     [string_to_regexp " = 1\\n\"\r\n^done"]]
90857         set re [join $re ""]
90858         ...
90859         Note: we have to avoid applying string_to_list to decimal, which is already a
90860         regexp.
90861
90862         Add a proc string_list_to_regexp to make it easy to do both:
90863         ...
90864         set re [list \
90865                     [string_list_to_regexp ~ {"} $] \
90866                     $decimal \
90867                     [string_list_to_regexp " = 1" \\ n {"} \r\n ^ done]]
90868         ...
90869
90870         Also add a test-case gdb.testsuite/string_to_regexp.exp.
90871
90872 2021-09-10  Tom de Vries  <tdevries@suse.de>
90873
90874         [gdb/testsuite] Handle unrecognized command line option in gdb_compile_test
90875         When running the gdb testsuite with gnatmake-4.8, I get many fails of the
90876         following form:
90877         ...
90878         gcc: error: unrecognized command line option '-fgnat-encodings=all'^M
90879         gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error^M
90880         compiler exited with status 1
90881         compilation failed: gcc ... gdb.ada/O2_float_param/foo.adb
90882         gcc: error: unrecognized command line option '-fgnat-encodings=all'
90883         gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error
90884         FAIL: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb
90885         ...
90886
90887         Fix this by marking the test unsupported instead, such that we have:
90888         ...
90889         UNSUPPORTED: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb \
90890           (unsupported option '-fgnat-encodings=all')
90891         ...
90892
90893         Tested on x86_64-linux.
90894
90895 2021-09-10  Alan Modra  <amodra@gmail.com>
90896
90897         PowerPC, sanity check r_offset in relocate_section
90898                 * elf32-ppc.c (offset_in_range): New function.
90899                 (ppc_elf_vle_split16): Sanity check r_offset before accessing
90900                 section contents.  Return status.
90901                 (ppc_elf_relocate_section): Sanity check r_offset before
90902                 accessing section contents.  Don't segfault on NULL howto.
90903
90904         Re: gas: Use the directory name in .file 0
90905                 PR gas/28266
90906                 * testsuite/gas/elf/dwarf-5-file0-2.s: Use %object rather than
90907                 @object, .4byte instead of .long, and .asciz instead of .string.
90908
90909 2021-09-10  Mike Frysinger  <vapier@gentoo.org>
90910
90911         etc: switch to automake
90912         There's no content in here currently, so switching to automake is
90913         pretty easy with a stub file.
90914
90915         etc: rename configure.in to configure.ac
90916         The .in name has been deprecated for a long time in favor of .ac.
90917
90918 2021-09-10  H.J. Lu  <hjl.tools@gmail.com>
90919
90920         gas: Use the directory name in .file 0
90921         DWARF5 allows .file 0 to take an optional directory name.  Set the entry
90922         0 of the directory table to the directory name in .file 0.
90923
90924                 PR gas/28266
90925                 * dwarf2dbg.c (get_directory_table_entry): Add an argument for
90926                 the directory name in .file 0 and use it, instead of PWD.
90927                 (allocate_filenum): Pass NULL to get_directory_table_entry.
90928                 (allocate_filename_to_slot): Pass the incoming dirname to
90929                 get_directory_table_entry.
90930                 * testsuite/gas/elf/dwarf-5-file0-2.d: New file.
90931                 * testsuite/gas/elf/dwarf-5-file0-2.s: Likewise.
90932                 * testsuite/gas/elf/elf.exp: Run dwarf-5-file0-2.
90933
90934 2021-09-10  GDB Administrator  <gdbadmin@sourceware.org>
90935
90936         Automatic date update in version.in
90937
90938 2021-09-09  Yoshinori Sato  <ysato@users.sourceforge.jp>
90939
90940         gdb: Enable target rx-*-*linux.
90941         I added rx-*-linux in binutils few yaers ago.
90942         But missing this changes,
90943
90944 2021-09-09  Tom de Vries  <tdevries@suse.de>
90945
90946         [gdb/testsuite] Fix gdb.base/coredump-filter-build-id.exp with older eu-unstrip
90947         On openSUSE Leap 42.3 with eu-unstrip 0.158, we run into:
90948         ...
90949         (gdb) PASS: gdb.base/coredump-filter-build-id.exp: save corefile
90950         First line of eu-unstrip: \
90951           0x400000+0x202000 f4ae8502bd6a14770182382316bc595e9dc6f08b@0x400284 - - [exe]
90952         FAIL: gdb.base/coredump-filter-build-id.exp: gcore dumped mapping with build-id
90953         ...
90954
90955         The test expects an actual file name instead of '[exe]', but that only got
90956         introduced with eu-unstrip 0.161.  Before it printed '[exe]' or '[pie]'.
90957
90958         Fix this by updating the regexp.
90959
90960         Tested on x86_64-linux.
90961
90962 2021-09-09  Tom de Vries  <tdevries@suse.de>
90963
90964         [gdb/testsuite] Fix various issues in gdb.mi/mi-sym-info.exp
90965         I noticed this failure in gdb.mi/mi-sym-info.exp with gcc-4.8:
90966         ...
90967         FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 1 \
90968           (unexpected output)
90969         ...
90970         due to function f2 instead of f3 being listed.
90971
90972         AFAICT, this is caused by a difference in debug info:
90973         ...
90974         $ readelf -wi outputs/gdb.mi/mi-sym-info/mi-sym-info1.o \
90975           | egrep "DW_AT_name.*: f[1-3]"
90976             <72>   DW_AT_name        : f1
90977             <a1>   DW_AT_name        : f2
90978             <d0>   DW_AT_name        : f3
90979         ...
90980         vs:
90981         ...
90982         $ readelf -wi outputs/gdb.mi/mi-sym-info/mi-sym-info1.o \
90983           | egrep "DW_AT_name.*: f[1-3]"
90984             <f4>   DW_AT_name        : f3
90985             <123>   DW_AT_name        : f2
90986             <152>   DW_AT_name        : f1
90987         ...
90988         and the command documentation does not mention an imposed order, so fix this
90989         by allowing f2 as well.
90990
90991         Doing this fix, it made sense to do a refactoring of adding f2_re and f3_re
90992         variables, in order to write (?:$f2_re|$f3_re), and I applied the same pattern
90993         overall.
90994
90995         Furthermore, I found a silent FAIL due to calling mi_gdb_proc with 2 args, fix
90996         by updating the regexp.
90997
90998         Then I ran with clang and found another FAIL, fix by updating the regexp.
90999
91000         Tested on x86_64-linux with gcc-4.8.5, gcc-7.5.0, gcc-11.2.1, clang-7.0.1 and
91001         clang-12.0.1.
91002
91003 2021-09-09  Tom de Vries  <tdevries@suse.de>
91004
91005         [gdb/testsuite] Reimplement gdb.gdb/complaints.exp as unittest
91006         When building gdb with "-Wall -O2 -g -flto=auto", I run into:
91007         ...
91008         (gdb) call clear_complaints()^M
91009         No symbol "clear_complaints" in current context.^M
91010         (gdb) FAIL: gdb.gdb/complaints.exp: clear complaints
91011         ...
91012
91013         The problem is that lto has optimized away the clear_complaints function
91014         and consequently the selftest doesn't work.
91015
91016         Fix this by reimplementing the selftest as a unit test.
91017
91018         Factor out two new functions:
91019         - void
91020           execute_fn_to_ui_file (struct ui_file *file, std::function<void(void)> fn);
91021         - std::string
91022           execute_fn_to_string (std::function<void(void)> fn, bool term_out);
91023         and use the latter to capture the complaints output.
91024
91025         Tested on x86_64-linux.
91026
91027 2021-09-09  Andrew Burgess  <andrew.burgess@embecosm.com>
91028
91029         gdb/python: remove all uses of Py_TPFLAGS_HAVE_ITER
91030         Python 2 has a bit flag Py_TPFLAGS_HAVE_ITER which can be passed as
91031         part of the tp_flags field when defining a new object type.  This flag
91032         is not defined in Python 3 and so we define it to 0 in
91033         python-internal.h (when IS_PY3K is defined).
91034
91035         The meaning of this flag is that the object has the fields tp_iter and
91036         tp_iternext.  Note the use of "has" here, the flag says nothing about
91037         the values in those fields, just that the type object has the fields.
91038
91039         In early versions of Python 2 these fields were no part of the
91040         PyTypeObject struct, they were added in version 2.2 (see
91041         https://docs.python.org/release/2.3/api/type-structs.html).  And so,
91042         there could be a some code compiled out there which has a PyTypeObject
91043         structure within it that doesn't even have the tp_iter and tp_iternext
91044         fields, attempting to access these fields would be undefined
91045         behaviour.
91046
91047         And so Python added the Py_TPFLAGS_HAVE_ITER flag.  If the flag is
91048         present then Python is free to access the tp_iter and tp_iternext
91049         fields.
91050
91051         If we consider GDB then we always assume that the tp_iter and
91052         tp_iternext fields are part of PyTypeObject.  If someone was crazy
91053         enough to try and compile GDB against Python 2.1 then we'd get lots of
91054         build errors saying that we were passing too many fields when
91055         initializing PyTypeObject structures.  And so, I claim, we can be sure
91056         that GDB will always be compiled with a version of Python that has the
91057         tp_iter and tp_iternext fields in PyTypeObject.
91058
91059         Next we can look at the Py_TPFLAGS_DEFAULT flag.  In Python 2, each
91060         time additional fields are added to PyTypeObject a new Py_TPFLAGS_*
91061         flag would be defined to indicate whether those flags are present or
91062         not.  And, those new flags would be added to Py_TPFLAGS_DEFAULT.  And
91063         so, in the latest version of Python 2 the Py_TPFLAGS_DEFAULT flag
91064         includes Py_TPFLAGS_HAVE_ITER (see
91065         https://docs.python.org/2.7/c-api/typeobj.html).
91066
91067         In GDB we pass Py_TPFLAGS_DEFAULT as part of the tp_flags for all
91068         objects we define.
91069
91070         And so, in this commit, I propose to remove all uses of
91071         Py_TPFLAGS_HAVE_ITER from GDB, it's simply not needed.
91072
91073         There should be no user visible changes after this commit.
91074
91075 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91076
91077         sim: accept -EB/-EL short options
91078         Many GNU tools accept -EB/-EL as short options for selecting big &
91079         little endian modes.  While the sim has an -E option, it requires
91080         spelling out "big" and "little".  Adding support for -EB & -EL is
91081         thus quite trivial, so lets round it out to be less annoying.
91082
91083         sim: ppc: drop support for std-config.h overrides
91084         Only the ppc arch supports this kind of source file override logic.
91085         All the others expose knobs via configure flags, and for some of
91086         these, the ppc code does as well.  For others, it doesn't make sense
91087         to ever change them.  Since it's unlikely anyone is using this, drop
91088         it all to simplify the code (and to get us a little closer to the
91089         common sim code).
91090
91091         sim: ppc: enable use of gnulib
91092         All other sim arches are using this now, so finish up the logic in
91093         the ppc arch to enable gnulib usage here too.
91094
91095         sim: drop old O_NDELAY & FNBLOCK support
91096         We use these older names inconsistently in the sim codebase, and time
91097         has moved on long ago, so drop support for these non-standard names.
91098         POSIX provides O_NONBLOCK for us, so use it everywhere.
91099
91100 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91101
91102         sim: dv-sockser: enable for mingw targets too
91103         We have enough functionality from gnulib now to build sockser on
91104         all platforms.
91105
91106         Non-blocking I/O is supported when F_GETFL/F_SETFL are unavailable,
91107         but we can address that in a follow up commit.  This mirrors what
91108         is done in other places in the sim already.
91109
91110 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91111
91112         sim: cgen: workaround Windows VOID define
91113         The cgen framework provides a "VOID" type for code to use, but this
91114         defines ends up conflicting with the standard Windows VOID define.
91115         Since they actually define to the same thing ("void"), undef it here
91116         to fix the Windows build.
91117
91118         We might want to reconsider the need for "VOID" in cgen, but that
91119         will take larger discussion & coordination with the cgen project.
91120
91121 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91122
91123         sim: dv-sockser: move sim-main.h include after system includes
91124         The sim-main.h header is a bit of a dumping ground.  Every arch can
91125         (and many do) define all sorts of weird & common names that end up
91126         conflicting with system headers.  So including it before the system
91127         headers sets us up for pain.  v850 is a good example of this -- when
91128         building for mingw, we see weird failures:
91129
91130         $ i686-w64-mingw32-gcc ... -c -o dv-sockser.o ../../../../sim/v850/../common/dv-sockser.c
91131         In file included from ../../../../sim/v850/sim-main.h:11,
91132                          from ../../../../sim/v850/../common/dv-sockser.c:24:
91133         ../../../../sim/v850/../common/sim-base.h:97:32: error: expected ')' before '->' token
91134           97 | # define STATE_CPU(sd, n) ((sd)->cpu[0])
91135              |                                ^~
91136
91137         While gcc is unhelpful at first, running it through the preprocessor
91138         by hand shows more details:
91139
91140         $ i686-w64-mingw32-gcc ... -E -dD -o dv-sockser.i ../../../../sim/v850/../common/dv-sockser.c
91141         $ i686-w64-mingw32-gcc -c dv-sockser.i
91142         In file included from /usr/i686-w64-mingw32/usr/include/minwindef.h:163,
91143                          from /usr/i686-w64-mingw32/usr/include/windef.h:9,
91144                          from /usr/i686-w64-mingw32/usr/include/windows.h:69,
91145                          from /usr/i686-w64-mingw32/usr/include/winsock2.h:23,
91146                          from ../../gnulib/import/sys/socket.h:684,
91147                          from ../../gnulib/import/netinet/in.h:43,
91148                          from ../../../../sim/v850/../common/dv-sockser.c:39:
91149         /usr/i686-w64-mingw32/usr/include/winnt.h:4803:25: error: expected ')' before '->' token
91150          4803 |       DWORD State;
91151               |                         ^
91152               |                         )
91153
91154         This is because v850 sets up this common name:
91155
91156         All of this needs cleaning up someday, but since the dv-sockser code
91157         definitely should be fixed in this way, lets do that now and unblock
91158         the v850 code.
91159
91160 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91161
91162         sim: mips: delete unused PSIZE define
91163         It's unclear what this define is for as it appears to be unused, and
91164         has never been used in the history of the mips sim.  Delete it to tidy
91165         up, and to fix build errors for Windows targets that have a standard
91166         "PSIZE" struct in their system headers.  This doesn't show up yet as
91167         most sim files don't include many system headers, but enabling sockser
91168         code for mingw uncovers the conflict.
91169
91170         Unfortunately the error produced by gcc is inscrutable, but running
91171         it through the preprocessor manually manages to provide a pointer to
91172         the underlying issue.
91173
91174         $ i686-w64-mingw32-gcc ... -c -o dv-sockser.o ../../../../sim/mips/../common/dv-sockser.c
91175         <command-line>: error: expected identifier or '(' before numeric constant
91176         In file included from /usr/i686-w64-mingw32/usr/include/windows.h:71,
91177                          from /usr/i686-w64-mingw32/usr/include/winsock2.h:23,
91178                          from ../../gnulib/import/sys/socket.h:684,
91179                          from ../../gnulib/import/netinet/in.h:43,
91180                          from ../../../../sim/mips/../common/dv-sockser.c:39:
91181         /usr/i686-w64-mingw32/usr/include/wingdi.h:2934:59: error: unknown type name 'LPSIZE'; did you mean 'LPSIZEL'?
91182          2934 |   WINGDIAPI WINBOOL WINAPI GetAspectRatioFilterEx(HDC hdc,LPSIZE lpsize);
91183               |                                                           ^~~~~~
91184               |                                                           LPSIZEL
91185         ...
91186
91187         $ i686-w64-mingw32-gcc ... -E -dD -o dv-sockser.i ../../../../sim/mips/../common/dv-sockser.c
91188         $ i686-w64-mingw32-gcc -c dv-sockser.i
91189         In file included from /usr/i686-w64-mingw32/usr/include/windows.h:69,
91190                          from /usr/i686-w64-mingw32/usr/include/winsock2.h:23,
91191                          from ../../gnulib/import/sys/socket.h:684,
91192                          from ../../gnulib/import/netinet/in.h:43,
91193                          from ../../../../sim/mips/../common/dv-sockser.c:39:
91194         /usr/i686-w64-mingw32/usr/include/windef.h:104:9: error: expected identifier or '(' before numeric constant
91195           104 | } SIZE,*PSIZE,*LPSIZE;
91196               |         ^~
91197
91198 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91199
91200         sim: ppc: switch to common warning flags
91201         Now that the ppc code has been cleaned up enough to use the same set
91202         of warning flags as the common code, delete the ppc-specific configure
91203         logic so we can leverage what the common code already defined for us.
91204
91205 2021-09-09  Tom de Vries  <tdevries@suse.de>
91206
91207         sim: ppc: enable -Wpointer-sign warnings
91208         When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into:
91209         ...
91210         src/sim/ppc/hw_memory.c: In function 'hw_memory_init_address':
91211         src/sim/ppc/hw_memory.c:204:7: error: pointer targets in passing argument 4 \
91212           of 'device_find_integer_array_property' differ in signedness \
91213           [-Werror=pointer-sign]
91214                &new_chunk->size);
91215                ^
91216         ...
91217
91218         Fix these by adding an explicit pointer cast.  It's a bit ugly to use APIs
91219         based on signed integers to read out unsigned values, but in practice, this
91220         is par for the course in the ppc code.
91221
91222         We already use signed APIs and assign the result to unsigned values a lot:
91223         see how device_find_integer_property returns a signed integer (cell), but
91224         then assign it to unsigned types.  The array APIs are not used that often
91225         which is why we don't see many warnings, and we disable warnings when we
91226         assign signed integers to unsigned integers in general.
91227
91228         The dtc/libfdt project (which is the standard in other projects) processes
91229         the fdt blob as a series of bytes without any type information.  Typing is
91230         left to the caller.  They have core APIs that read/write bytes, and a few
91231         helper functions to cast/convert those bytes to the right value (e.g. u32).
91232         In this ppc sim code, the core APIs use signed integers, and the callers
91233         convert to unsigned, usually implicitly.
91234
91235         We could add some core APIs to the ppc sim that deal with raw bytes and then
91236         add some helpers to convert to the right type, but that seems like a lot of
91237         lifting for what boils down to a cast, and is effectively equivalent to all
91238         the implicit assignments we use elsewhere.  Long term, a lot of the ppc code
91239         should either get converted to existing sim common code, or we should stand
91240         up proper APIs in the common code first, or use standard libraries to do all
91241         the processing (e.g. libfdt).  Either way, this device.c code would all get
91242         deleted, and callers (like these hw_*.c files) would get converted.  Which
91243         is also why we go with a cast rather new (but largely unused) APIs.
91244
91245 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91246
91247         sim: ppc: enable -Wmissing-declarations & -Wmissing-prototypes
91248         This aligns with common code which already uses this flag.  We have
91249         to add another local prototype to fix the failure, and add another
91250         local decl for the SIM_DESC type.  Unwinding these will require a
91251         lot more work & conversions in the process, so going with the decl
91252         for now unblocks the warning unification.
91253
91254 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91255
91256         sim: microblaze: replace custom basic types with common ones
91257         The basic "byte" type conflicts with Windows headers, and we already
91258         have common types that provide the right sizes.  So replace these with
91259         the common ones to avoid issues.
91260
91261           CC     dv-sockser.o
91262         In file included from /usr/i686-w64-mingw32/usr/include/wtypes.h:8,
91263                          from /usr/i686-w64-mingw32/usr/include/winscard.h:10,
91264                          from /usr/i686-w64-mingw32/usr/include/windows.h:97,
91265                          from /usr/i686-w64-mingw32/usr/include/winsock2.h:23,
91266                          from ../../gnulib/import/sys/socket.h:684,
91267                          from ../../gnulib/import/netinet/in.h:43,
91268                          from .../build/sim/../../../sim/microblaze/../common/dv-sockser.c:39:
91269         /usr/i686-w64-mingw32/usr/include/rpcndr.h:63:25: error: conflicting types for 'byte'; have 'unsigned char'
91270            63 |   typedef unsigned char byte;
91271               |                         ^~~~
91272         In file included from .../buildsim/../../../sim/microblaze/sim-main.h:21,
91273                          from .../buildsim/../../../sim/microblaze/../common/dv-sockser.c:24:
91274         .../buildsim/../../../sim/microblaze/microblaze.h:94:25: note: previous declaration of 'byte' with type 'byte' {aka 'char'}
91275            94 | typedef char            byte;
91276               |                         ^~~~
91277         make: *** [Makefile:513: dv-sockser.o] Error 1
91278
91279 2021-09-09  Jim Wilson  <jimw@sifive.com>
91280
91281         RISC-V: Pretty print values formed with lui and addiw.
91282         The disassembler has support to pretty print values created by an lui/addi
91283         pair, but there is no support for addiw.  There is also no support for
91284         c.addi and c.addiw.  This patch extends the pretty printing support to
91285         handle these 3 instructions in addition to addi.  Existing testcases serve
91286         as tests for the new feature.
91287
91288                 opcodes/
91289                 * riscv-dis.c (maybe_print_address): New arg wide.  Sign extend when
91290                 wide is true.
91291                 (print_insn_args): Fix calls to maybe_print_address.  Add checks for
91292                 c.addi, c.addiw, and addiw, and call maybe_print_address for them.
91293
91294                 gas/
91295                 * testsuite/gas/riscv/insn.d: Update for disassembler change.
91296                 * testsuite/gas/li32.d, testsuite/gas/li64.d: Likwise.
91297                 * testsuite/gas/lla64.d: Likewise.
91298
91299 2021-09-09  Mike Frysinger  <vapier@gentoo.org>
91300
91301         sim: ppc: align format string settings with common code
91302         This copies logic used in the common sim warning configure code to fix
91303         build errors for mingw targets.  Turning format warnings on triggers
91304         a failure in the debug.c file, so apply a minor fix at the same time.
91305
91306         sim: ppc: drop unnecessary config includes
91307         This file is compiled for the --host & --build system which leads to
91308         including the configure generated config.h in both environments.
91309         This obviously doesn't work when the two targets don't look alike at
91310         all and can cause build failures here (e.g. a mingw host & a linux
91311         build).  Since we don't actually need any config settings in this
91312         very simple file, drop the includes entirely.
91313
91314 2021-09-09  GDB Administrator  <gdbadmin@sourceware.org>
91315
91316         Automatic date update in version.in
91317
91318 2021-09-08  Mike Frysinger  <vapier@gentoo.org>
91319
91320         gnulib: import various network functions
91321         Some sim ports use these to provide networking functionality via the
91322         dv-sockser module or via direct emulation for a few ports.
91323
91324         Gdb seems to build just fine still too.
91325
91326 2021-09-08  Tom Tromey  <tromey@adacore.com>
91327
91328         Fix unit test build on Windows
91329         Like Tom de Vries' earlier patch to fix the no-CXX_STD_THREAD case in
91330         maint.c, this patch fixes a similar problem in
91331         parallel-for-selftests.c.  This fixes a build failure on Windows.
91332
91333 2021-09-08  Alan Modra  <amodra@gmail.com>
91334
91335         PowerPC64, sanity check r_offset in relocate_section
91336         This hardens the powerpc64 linker code transformations.
91337
91338                 * elf64-ppc.c (is_8byte_reloc, offset_in_range): New functions.
91339                 (ppc64_elf_relocate_section): Sanity check r_offset before
91340                 accessing section contents for various code transformations.
91341
91342 2021-09-08  Alan Modra  <amodra@gmail.com>
91343
91344         PowerPC64: Avoid useless work on R_PPC64_TPREL34
91345         _bfd_elf_ppc_at_tprel_transform doesn't handle prefix instructions,
91346         and I'm not inclined to implement code editing for them.
91347
91348                 * elf64-ppc.c (ppc64_elf_relocate_section): Don't attempt tprel
91349                 transform for R_PPC64_TPREL34.
91350
91351 2021-09-08  Andrew Burgess  <andrew.burgess@embecosm.com>
91352
91353         gdb: make thread_suspend_state::stop_pc optional
91354         Currently the stop_pc field of thread_suspect_state is a CORE_ADDR and
91355         when we want to indicate that there is no stop_pc available we set
91356         this field back to a special value.
91357
91358         There are actually two special values used, in post_create_inferior
91359         the stop_pc is set to 0.  This is a little unfortunate, there are
91360         plenty of embedded targets where 0 is a valid pc value.  The more
91361         common special value for stop_pc though, is set in
91362         thread_info::set_executing, where the value (~(CORE_ADDR) 0) is used.
91363
91364         This commit changes things so that the stop_pc is instead a
91365         gdb::optional.  We can now explicitly reset the field to an
91366         uninitialised state, we also have asserts that we don't read the
91367         stop_pc when its in an uninitialised state (both in
91368         gdbsupport/gdb_optional.h, when compiling with _GLIBCXX_DEBUG
91369         defined, and in thread_info::stop_pc).
91370
91371         One situation where a thread will not have a stop_pc value is when the
91372         thread is stopped as a consequence of GDB being in all stop mode, and
91373         some other thread stopped at an interesting event.  When GDB brings
91374         all the other threads to a stop those other threads will not have a
91375         stop_pc set (thus avoiding an unnecessary read of the pc register).
91376
91377         Previously, when GDB passed through handle_one (in infrun.c) the
91378         threads executing flag was set to false and the stop_pc field was left
91379         unchanged, i.e. it would (previous) have been left as ~0.
91380
91381         Now, handle_one leaves the stop_pc with no value.
91382
91383         This caused a problem when we later try to set these threads running
91384         again, in proceed() we compare the current pc with the cached stop_pc.
91385         If the thread was stopped via handle_one then the stop_pc would have
91386         been left as ~0, and the compare (in proceed) would (likely) fail.
91387         Now however, this compare tries to read the stop_pc when it has no
91388         value and this would trigger an assert.
91389
91390         To resolve this I've added thread_info::stop_pc_p() which returns true
91391         if the thread has a cached stop_pc.  We should only ever call
91392         thread_info::stop_pc() if we know that there is a cached stop_pc,
91393         however, this doesn't mean that every call to thread_info::stop_pc()
91394         needs to be guarded with a call to thread_info::stop_pc_p(), in most
91395         cases we know that the thread we are looking at stopped due to some
91396         interesting event in that thread, and so, we know that the stop_pc is
91397         valid.
91398
91399         After running the testsuite I've seen no other situations where
91400         stop_pc is read uninitialised.
91401
91402         There should be no user visible changes after this commit.
91403
91404 2021-09-08  Tom de Vries  <tdevries@suse.de>
91405
91406         [gdb/build] Fix build with undefined CXX_STD_THREAD
91407         When building gdb on openSUSE Leap 42.3, we trigger the case that
91408         CXX_STD_THREAD is undefined, and run into:
91409         ...
91410         gdb/maint.c: In function 'void maintenance_show_worker_threads \
91411           (ui_file*, int, cmd_list_element*, const char*)':
91412         gdb/maint.c:877:14: error: 'gdb::thread_pool' has not been declared
91413                  gdb::thread_pool::g_thread_pool->thread_count ());
91414                       ^
91415         Makefile:1647: recipe for target 'maint.o' failed
91416         make[1]: *** [maint.o] Error 1
91417         ...
91418
91419         Fix this by handling the undefined CXX_STD_THREAD case in
91420         maintenance_show_worker_threads, such that we get:
91421         ...
91422         $ gdb -q -batch -ex "maint show worker-thread"
91423         The number of worker threads GDB can use is 0.
91424         ...
91425
91426         Tested on x86_64-linux.
91427
91428         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28312
91429
91430 2021-09-08  Mike Frysinger  <vapier@gentoo.org>
91431
91432         sim: update configure target list
91433         Fix sorting of the list, and update the globs to match the list used
91434         in gdb's configure script.
91435
91436         gdb: cris: enable sim integration
91437         The sim side is already ready to go for cris, so wire it up.
91438
91439         gdb: aarch64: enable sim integration
91440         The sim side is already ready to go for aarch64, so wire it up.
91441
91442         gdb: sim: consolidate configure settings
91443         Moving all the sim settings to one section makes it easier to track,
91444         and makes it easier to keep it aligned with the sim target tests.
91445         The gdb logic was duplicating this when handling different OS targets
91446         instead of having a single cpu check.  Now it's more obvious that the
91447         sim is tied to a cpu and not related to the OS.
91448
91449 2021-09-08  GDB Administrator  <gdbadmin@sourceware.org>
91450
91451         Automatic date update in version.in
91452
91453 2021-09-07  Tom Tromey  <tromey@adacore.com>
91454
91455         Remove unused declaration from gdbserver/win32-low.h
91456         I noticed that gdbserver/win32-low.h has an unused declaration.  This
91457         code was changed a while ago, but this declaration slipped through.
91458         This patch removes it.  Tested by rebuilding.
91459
91460 2021-09-07  Andrew Burgess  <andrew.burgess@embecosm.com>
91461
91462         gdb: make use of std::string in utils.c
91463         Replace some of the manual string management (malloc/free) with
91464         std::string when creating commands in utils.c.
91465
91466         Things are a little bit messy as, creating the prefix commands (using
91467         add_basic_prefix_cmd and add_show_prefix_cmd), doesn't copy the doc
91468         string, while creating the actual set/show commands (using
91469         add_setshow_enum_cmd) does copy the doc string.
91470
91471         As a result, I have retained the use of xstrprintf when creating the
91472         prefix command doc strings, but switched to using std::string when
91473         creating the actual set/show commands.
91474
91475         There should be no user visible changes after this commit.
91476
91477 2021-09-07  Luis Machado  <luis.machado@linaro.org>
91478
91479         Revert: [AArch64] MTE corefile support
91480                 bfd     * elf.c (elfcore_make_memtag_note_section): New function.
91481                         (elfcore_grok_note): Handle NT_MEMTAG note types.
91482
91483                 binutils* readelf.c (get_note_type): Handle NT_MEMTAG note types.
91484
91485                 include * elf/common.h (NT_MEMTAG): New constant.
91486                         (NT_MEMTAG_TYPE_AARCH_MTE): New constant.
91487
91488 2021-09-07  Andrew Burgess  <andrew.burgess@embecosm.com>
91489
91490         gdb: use bool instead of int in struct internal_problem
91491         Change struct internal_problem (gdb/utils.c) to use bool instead of
91492         int, update the 3 static instances of this structure that we create to
91493         use true/false instead of 1/0.
91494
91495         I've also updated the comments on struct internal_problem as the
91496         existing comment doesn't seem to be referring to the structure, it
91497         talks about returning something, which doesn't make sense in this
91498         context.
91499
91500         There should be no user visible changes after this commit.
91501
91502 2021-09-07  Andrew Burgess  <andrew.burgess@embecosm.com>
91503
91504         gdb: make thread_info::executing private
91505         Rename thread_info::executing to thread_info::m_executing, and make it
91506         private.  Add a new get/set member functions, and convert GDB to make
91507         use of these.
91508
91509         The only real change of interest in this patch is in thread.c where I
91510         have deleted the helper function set_executing_thread, and now just
91511         use the new set function thread_info::set_executing.  However, the old
91512         helper function set_executing_thread included some code to reset the
91513         thread's stop_pc, so I moved this code into the new function
91514         thread_info::set_executing.  However, I don't believe there is
91515         anywhere that this results in a change of behaviour, previously the
91516         executing flag was always set true through a call to
91517         set_executing_thread anyway.
91518
91519 2021-09-07  Nick Clifton  <nickc@redhat.com>
91520
91521         Fix an illegal memory access triggered by an atempt to disassemble a corrupt xtensa binary.
91522                 PR 28305
91523                 * elf32-xtensa.c (elf_xtensa_do_reloc): Add check for put of range
91524                 reloc.
91525
91526 2021-09-07  Andrew Burgess  <andrew.burgess@embecosm.com>
91527
91528         gdb/python: new function to add values into GDB's history
91529         The guile API has (history-append! <value>) to add values into GDB's
91530         history list.  There is currently no equivalent in the Python API.
91531
91532         This commit adds gdb.add_history(<value>) to the Python API, this
91533         function takes <value> a gdb.Value (or anything that can be passed to
91534         the constructor of gdb.Value), and adds the value it represents to
91535         GDB's history list.  The index of the newly added value is returned.
91536
91537 2021-09-07  Nick Clifton  <nickc@redhat.com>
91538
91539         Fix illegal memory access triggered by an attempt to disassemble a corrupt RISC-V binary.
91540                 PR 28303
91541                 * elfxx-riscv.c (riscv_elf_add_sub_reloc): Add check for out of
91542                 range relocs.
91543
91544 2021-09-07  Tom de Vries  <tdevries@suse.de>
91545
91546         [gdb/testsuite] Handle internal-error in gdb_unload
91547         When reverting commit 5a20fadc841 and using gdb_unload instead of runto "bar"
91548         to trigger the internal-error in test-case
91549         gdb.dwarf2/locexpr-data-member-location.exp, we run into:
91550         ...
91551         ERROR: couldn't unload file in $gdb (timeout).
91552         ...
91553         and the test-case takes about 1 minute.
91554
91555         Fix this by handling internal-error in gdb_unload, such that we have:
91556         ...
91557         ERROR: Couldn't unload file in $gdb (GDB internal error).
91558         ERROR: Could not resync from internal error (eof)
91559         ...
91560         within 2 seconds.
91561
91562         Tested on x86_64-linux.
91563
91564 2021-09-07  Alan Modra  <amodra@gmail.com>
91565
91566         PR28307, segfault in ppc64_elf_toc64_reloc
91567         Adds missing bfd_reloc_offset_in_range checks to various relocation
91568         special_functions.
91569
91570                 PR 28307
91571                 * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Range check reloc offset.
91572                 * elf64-ppc.c (ppc64_elf_ha_reloc, ppc64_elf_brtaken_reloc): Likewise.
91573                 (ppc64_elf_toc64_reloc, ppc64_elf_prefix_reloc): Likewise.
91574
91575 2021-09-07  GDB Administrator  <gdbadmin@sourceware.org>
91576
91577         Automatic date update in version.in
91578
91579 2021-09-07  Tom de Vries  <tdevries@suse.de>
91580
91581         [gdb/testsuite] Handle internal-error in gdb_run_cmd
91582         When reverting commit 5a20fadc841 the test-case
91583         gdb.dwarf2/locexpr-data-member-location.exp fails like this:
91584         ...
91585         FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \
91586           (GDB internal error)
91587         ERROR: Could not resync from internal error (eof)
91588         ...
91589         and takes 1 minute to run.
91590
91591         The long running time is caused by running into a timeout in gdb_run_cmd, at
91592         this point:
91593         ...
91594         (gdb) run ^M
91595         The program being debugged has been started already.^M
91596         Start it from the beginning? (y or n) y^M
91597         /home/vries/gdb_versions/devel/src/gdb/gdbtypes.c:5583: internal-error: \
91598           Unexpected type field location kind: 4^M
91599         A problem internal to GDB has been detected,^M
91600         further debugging may prove unreliable.^M
91601         Quit this debugging session? (y or n)
91602         ...
91603
91604         Fix this by detecting the internal-error in gdb_run_cmd.  We don't handle it
91605         in gdb_run_cmd, but stash the gdb output back into the buffer using
91606         -notransfer, and let the caller proc runto deal with it.
91607
91608         After the fix, the test-case just takes 2 seconds.
91609
91610         Tested on x86_64-linux.
91611
91612 2021-09-06  Lancelot SIX  <lsix@lancelotsix.com>
91613
91614         gdb: rename gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.c
91615         A previous commit added the
91616         gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp testcase, but one of its
91617         associated file was named after a previous version of the test.
91618
91619         This commit fixes this and makes sure that all the files linked to this
91620         testcase share the same prefix in the name.
91621
91622         Tested on riscv64 GNU/Linux.
91623
91624 2021-09-06  Tom de Vries  <tdevries@suse.de>
91625
91626         [gdb/testsuite] Handle eof in gdb_internal_error_resync
91627         Before commit 5a20fadc841 the test-case
91628         gdb.dwarf2/locexpr-data-member-location.exp fails like this:
91629         ...
91630         FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \
91631           (GDB internal error)
91632         ERROR: : spawn id exp9 not open
91633             while executing
91634         "expect {
91635         -i exp9 -timeout 10
91636                     -re "Quit this debugging session\\? \\(y or n\\) $" {
91637                         send_gdb "n\n" answer
91638                         incr count
91639                     }
91640                     -re "Create ..."
91641             ("uplevel" body line 1)
91642             invoked from within
91643         "uplevel $body" NONE : spawn id exp9 not open
91644         ERROR: Could not resync from internal error (timeout)
91645         ...
91646
91647         Fix the:
91648         ...
91649         ERROR: : spawn id exp9 not open
91650         ...
91651         by handling eof in gdb_internal_error_resync, such that we have instead:
91652         ...
91653         FAIL: gdb.dwarf2/locexpr-data-member-location.exp: running to bar in runto \
91654           (GDB internal error)
91655         ERROR: Could not resync from internal error (eof)
91656         ...
91657
91658         Tested on x86_64-linux.
91659
91660 2021-09-06  Tom Tromey  <tom@tromey.com>
91661
91662         Remove some complaints.h includes
91663         There are a few includes of complaints.h that aren't necessary.  This
91664         patch removes them.  Tested by rebuilding.
91665
91666 2021-09-06  Nick Clifton  <nickc@redhat.com>
91667
91668         Fix an illegal memory access triggered by disassembling corrupt s390x binaries.
91669                 PR 28304
91670                 * elfxx-score7.c (score_elf_gprel15_reloc): If there is no output bfd
91671                 treat the reloc as undefined.
91672
91673         Fix potential use on an uninitialised vairable in the MCore assembler.
91674
91675         Fix potential uninitialised variable in microblaze assembler code.
91676
91677 2021-09-06  Yinjun Zhang  <yinjun.zhang@corigine.com>
91678
91679         Add a sanity check to the init_nfp6000_mecsr_sec() function in the NFP disassembler.
91680
91681 2021-09-06  Alexandra Hájková  <ahajkova@redhat.com>
91682
91683         gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCK
91684         The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for
91685         switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error
91686         under some circumstances.
91687
91688         Fixes bug 28030.
91689
91690 2021-09-06  GDB Administrator  <gdbadmin@sourceware.org>
91691
91692         Automatic date update in version.in
91693
91694 2021-09-05  GDB Administrator  <gdbadmin@sourceware.org>
91695
91696         Automatic date update in version.in
91697
91698 2021-09-04  Tom de Vries  <tdevries@suse.de>
91699
91700         [gdb/testsuite] Check avx support in gdb.arch/amd64-disp-step-avx.exp
91701         On a machine on Open Build Service I'm running into a SIGILL for test-case
91702         gdb.arch/amd64-disp-step-avx.exp:
91703         ...
91704         Program received signal SIGILL, Illegal instruction.^M
91705         test_rip_vex2 () at gdb.arch/amd64-disp-step-avx.S:40^M
91706         40              vmovsd ro_var(%rip),%xmm0^M
91707         (gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: vex2: \
91708           continue to test_rip_vex2_end
91709         ...
91710         The SIGILL happens when trying to execute the first avx instruction in the
91711         executable.
91712
91713         I can't directly access the machine, but looking at the log for test-case
91714         gdb.arch/i386-avx.exp, it seems that there's no avx support:
91715         ...
91716         Breakpoint 1, main (argc=1, argv=0x7fffffffd6b8) at gdb.arch/i386-avx.c:68^M
91717         68        if (have_avx ())^M
91718         (gdb) print have_avx ()^M
91719         $1 = 0^M
91720         ...
91721
91722         Fix this by:
91723         - adding a gdb_caching_proc have_avx, similar to have_mpx, using the have_avx
91724           function from gdb.arch/i386-avx.c
91725         - using proc have_avx in both gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
91726           and gdb/testsuite/gdb.arch/i386-avx.exp.
91727
91728         Tested on my x86_64-linux laptop with avx support, where both test-cases pass.
91729
91730         gdb/testsuite/ChangeLog:
91731
91732         2021-09-04  Tom de Vries  <tdevries@suse.de>
91733
91734                 PR testsuite/26950
91735                 * gdb/testsuite/gdb.arch/i386-avx.c (main): Remove call to have_avx.
91736                 (have_avx): Move ...
91737                 * gdb/testsuite/lib/gdb.exp (have_avx): ... here.  New proc.
91738                 * gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp: Use have_avx.
91739                 * gdb/testsuite/gdb.arch/i386-avx.exp: Same.
91740
91741 2021-09-04  Mike Frysinger  <vapier@gentoo.org>
91742
91743         gnulib: import sys_wait
91744         A few sims use this to emulate process syscalls.
91745         Gdb builds seem to still be fine.
91746
91747 2021-09-04  GDB Administrator  <gdbadmin@sourceware.org>
91748
91749         Automatic date update in version.in
91750
91751 2021-09-03  Tom Tromey  <tromey@adacore.com>
91752
91753         Use CORE_ADDR as return type from x86_dr_low_get_addr
91754         On a Windows build locally, watchpoints started failing.  I tracked
91755         this down to x86_dr_low_get_addr returning an 'unsigned long'... in
91756         this particular build, this is a 32-bit type, but the inferior is a
91757         64-bit program.
91758
91759         This patch fixes the problem by changing the return type.  No other
91760         change is required, because this matches the function pointer in
91761         struct x86_dr_low_type.
91762
91763 2021-09-03  Kevin Buettner  <kevinb@redhat.com>
91764
91765         Test case reproducing PR28030 bug
91766         The original reproducer for PR28030 required use of a specific
91767         compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR,
91768         though it seems probable that other gcc versions might also be able to
91769         reproduce the bug as well.  This commit introduces a test case which,
91770         using the DWARF assembler, provides a reproducer which is independent
91771         of the compiler version.  (Well, it'll work with whatever compilers
91772         the DWARF assembler works with.)
91773
91774         To the best of my knowledge, it's also the first test case which uses
91775         the DWARF assembler to provide debug info for a shared object.  That
91776         being the case, I provided more than the usual commentary which should
91777         allow this case to be used as a template when a combo shared
91778         library / DWARF assembler test case is required in the future.
91779
91780         I provide some details regarding the bug in a comment near the
91781         beginning of locexpr-dml.exp.
91782
91783         This problem was difficult to reproduce; I found myself constantly
91784         referring to the backtrace while trying to figure out what (else) I
91785         might be missing while trying to create a reproducer.  Below is a
91786         partial backtrace which I include for posterity.
91787
91788          #0  internal_error (
91789             file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575,
91790             fmt=0xc520c0 "Unexpected type field location kind: %d")
91791             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51
91792          #1  0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930,
91793             type=0x274c260, copied_types=0x30bb290)
91794             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575
91795          #2  0x00000000006ef382 in copy_type_recursive (objfile=0x1635930,
91796             type=0x274ca10, copied_types=0x30bb290)
91797             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602
91798          #3  0x0000000000a7409a in preserve_one_value (value=0x24269f0,
91799             objfile=0x1635930, copied_types=0x30bb290)
91800             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529
91801          #4  0x000000000072012a in gdbscm_preserve_values (
91802             extlang=0xc55720 <extension_language_guile>, objfile=0x1635930,
91803             copied_types=0x30bb290)
91804             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94
91805          #5  0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930,
91806             copied_types=0x30bb290)
91807             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568
91808          #6  0x0000000000a7428d in preserve_values (objfile=0x1635930)
91809             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579
91810          #7  0x000000000082d514 in objfile::~objfile (this=0x1635930,
91811             __in_chrg=<optimized out>)
91812             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549
91813          #8  0x0000000000831cc8 in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x1654580)
91814             at /usr/include/c++/11/bits/shared_ptr_base.h:348
91815          #9  0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168
91816          #10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=<optimized out>)
91817             at /usr/include/c++/11/bits/shared_ptr_base.h:705
91818          #11 0x000000000082feee in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x190bb80, __in_chrg=<optimized out>)
91819             at /usr/include/c++/11/bits/shared_ptr_base.h:1154
91820          #12 0x000000000082ff0a in std::shared_ptr<objfile>::~shared_ptr (
91821             this=0x190bb80, __in_chrg=<optimized out>)
91822             at /usr/include/c++/11/bits/shared_ptr.h:122
91823          #13 0x000000000085ed7e in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x114bc00,
91824             __p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168
91825          #14 0x000000000085e88d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=...,
91826             __p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531
91827          #15 0x000000000085e50c in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x114bc00, __position=
91828           std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
91829             at /usr/include/c++/11/bits/stl_list.h:1925
91830          #16 0x000000000085df0e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x114bc00, __position=
91831           std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
91832             at /usr/include/c++/11/bits/list.tcc:158
91833          #17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0,
91834             objfile=0x1635930)
91835             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210
91836          #18 0x000000000082d3ae in objfile::unlink (this=0x1635930)
91837             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487
91838          #19 0x000000000082e68c in objfile_purge_solibs ()
91839             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875
91840          #20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1)
91841             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236
91842          #21 0x00000000009a37fe in target_pre_inferior (from_tty=1)
91843             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496
91844          #22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1,
91845             run_how=RUN_NORMAL)
91846             at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437
91847
91848         I'll note a few points regarding this backtrace:
91849
91850         Frame #1 is where the internal error occurs.  It's caused by an
91851         unhandled case for FIELD_LOC_KIND_DWARF_BLOCK.  The fix for this bug
91852         adds support for this case.
91853
91854         Frame #22 - it's a partial backtrace - shows that GDB is attempting to
91855         (re)run the program.  You can see the exact command sequence that was
91856         used for reproducing this problem in the PR (at
91857         https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a
91858         nutshell, after starting the program and advancing to the appropriate
91859         source line, GDB was asked to step into libstdc++; a "finish" command
91860         was issued, returning a value.  The fact that a value was returned is
91861         very important.  GDB was then used to step back into libstdc++.  A
91862         breakpoint was set on a source line in the library after which a "run"
91863         command was issued.
91864
91865         Frame #19 shows a call to objfile_purge_solibs.  It's aptly named.
91866
91867         Frame #7 is a call to the destructor for one of the objfile solibs; it
91868         turned out to be the one for libstdc++.
91869
91870         Frames #6 thru #3 show various value preservation frames.  If you look
91871         at preserve_values() in gdb/value.c, the value history is preserved
91872         first, followed by internal variables, followed by values for the
91873         extension languages (python and guile).
91874
91875 2021-09-03  Tom de Vries  <tdevries@suse.de>
91876
91877         [gdb/testsuite] Add untested case in gdb.gdb/complaints.exp
91878         When building gdb with "-Wall -O2 -g -flto=auto", I run into:
91879         ...
91880         (gdb) call clear_complaints()^M
91881         No symbol "clear_complaints" in current context.^M
91882         (gdb) FAIL: gdb.gdb/complaints.exp: clear complaints
91883         ...
91884
91885         The problem is that lto has optimized away clear_complaints, and consequently
91886         the selftests cannot run.
91887
91888         Fix this by:
91889         - using info function to detect presence of clear_complaints
91890         - handling the absence of clear_complaints by calling untested
91891         ...
91892         (gdb) UNTESTED: gdb.gdb/complaints.exp: \
91893           Cannot find clear_complaints, skipping test
91894         ...
91895
91896         Tested on x86_64-linux.
91897
91898         gdb/testsuite/ChangeLog:
91899
91900         2021-09-03  Tom de Vries  <tdevries@suse.de>
91901
91902                 * gdb.gdb/complaints.exp: Use untested if clear_complaints cannot
91903                 be found.
91904
91905 2021-09-03  Felix Willgerodt  <felix.willgerodt@intel.com>
91906
91907         gdb: Enable finish command and inferior calls for _Float16 on amd64 and i386.
91908         Values of type _Float16 and _Float16 _Complex can now be used on CPUs with
91909         AVX512-FP16 support. Return values of those types are located in XMM0.
91910         Compiler support for gcc and clang is in progress, see e.g.:
91911         https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574117.html
91912
91913         gdb/ChangeLog:
91914         2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>
91915
91916                 * amd64-tdep.c (amd64_classify): Classify _Float16 and
91917                 _Float16 _Complex as AMD64_SSE.
91918                 * i386-tdep.c (i386_extract_return_value): Read _Float16 and
91919                 _Float16 _Complex from xmm0.
91920
91921         gdb/testsuite/ChangeLog:
91922         2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>
91923
91924                 * gdb.arch/x86-avx512fp16-abi.c: New file.
91925                 * gdb.arch/x86-avx512fp16-abi.exp: New file.
91926
91927 2021-09-03  Felix Willgerodt  <felix.willgerodt@intel.com>
91928
91929         Add half support for AVX512 register view.
91930         This adds support for the half datatype, FP16, to the AVX512 register printing.
91931
91932         gdb/ChangeLog:
91933         2020-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>
91934
91935                 * i386-tdep.c (i386_zmm_type) <v32_half>: New field.
91936                 (i386_ymm_type) <v16_half>: New field.
91937                 (i386_gdbarch_init): Add set_gdbarch_half_format.
91938                 * features/i386/64bit-avx512.xml: Add half type.
91939                 * features/i386/64bit-avx512.c: Regenerated.
91940                 * features/i386/64bit-sse.xml: Add half type.
91941                 * features/i386/64bit-sse.c: Regenerated.
91942
91943         gdb/testsuite/ChangeLog:
91944         2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>
91945
91946                 * gdb.arch/x86-avx512fp16.c: New file.
91947                 * gdb.arch/x86-avx512fp16.exp: New file.
91948                 * lib/gdb.exp (skip_avx512fp16_tests): New function.
91949
91950 2021-09-03  Felix Willgerodt  <felix.willgerodt@intel.com>
91951
91952         gdb, i386: Enable AVX512-bfloat16 for i386 targets.
91953         Values of type bfloat16 can also be used on 32-bit targets, which was missed
91954         in the original enablement.  This also adjusts the testcase to pass with
91955         "unix/-m32", where only the lower 8 AVX registers are available.
91956
91957         gdb/ChangeLog:
91958         2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>
91959
91960                 * features/i386/32bit-sse.xml: Add bfloat16 type.
91961                 * features/i386/32bit-sse.c: Regenerated.
91962
91963         gdb/testsuite/ChangeLog:
91964         2021-07-21  Felix Willgerodt  <Felix.Willgerodt@intel.com>
91965
91966                 * gdb.arch/x86-avx512bf16.exp: Only use x/z/ymm 0-7.
91967
91968 2021-09-03  Tom de Vries  <tdevries@suse.de>
91969
91970         [gdb/testsuite] Add untested case in selftest_setup
91971         When building gdb with "-Wall -O2 -g -flto=auto", I run into:
91972         ...
91973         FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \
91974           (got interactive prompt)
91975         FAIL: gdb.gdb/python-helper.exp: run until breakpoint at captured_main
91976         WARNING: Couldn't test self
91977         ...
91978         and similar in gdb.gdb/selftest.exp.
91979
91980         The first FAIL in more detail:
91981         ...
91982         (gdb) break captured_main^M
91983         Function "captured_main" not defined.^M
91984         Make breakpoint pending on future shared library load? (y or [n]) n^M
91985         (gdb) FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \
91986           (got interactive prompt)
91987         ...
91988
91989         The problem is that lto has optimized away the captured_main function
91990         and consequently the selftests dependent on that cannot run.
91991
91992         Fix this by:
91993         - using gdb_breakpoint to detect failure to set the breakpoint
91994         - handling the failure to set a breakpoint by calling untested
91995         - not emitting the warning if we've already got untested
91996         such that we have:
91997         ...
91998         (gdb) UNTESTED: gdb.gdb/python-helper.exp: Cannot set breakpoint at \
91999           captured_main, skipping testcase.
92000         ...
92001
92002         gdb/testsuite/ChangeLog:
92003
92004         2021-09-02  Tom de Vries  <tdevries@suse.de>
92005
92006                 * lib/selftest-support.exp: Emit untested when not being able to set
92007                 breakpoint.
92008
92009 2021-09-03  Alan Modra  <amodra@gmail.com>
92010
92011         ld testsuite tidy
92012         Fixes a few issues:
92013         1) If you use "-fsanitize=address,undefined" in CFLAGS, the Makefile
92014         attempt to trim off -fsanitize options left us with ",undefined".
92015         2) ld_compile adds CFLAGS_FOR_TARGET itself, no need to pass it.
92016         3) CFLAGS might be needed linking bootstrap test.
92017
92018                 * Makefile.am (CFLAGS_FOR_TARGET, CXXFLAGS_FOR_TARGET): Trim off
92019                 all -fsanitize=*.
92020                 * Makefile.in: Regenerate.
92021                 * testsuite/ld-bootstrap/bootstrap.exp: Use CFLAGS when linking.
92022                 * testsuite/ld-cdtest/cdtest.exp: Use CFLAGS_FOR_TARGET when
92023                 linking.
92024                 * testsuite/ld-auto-import/auto-import.exp: Don't pass
92025                 CFLAGS_FOR_TARGET to ld_compile.
92026                 * testsuite/ld-cygwin/exe-export.exp: Likewise.
92027                 * testsuite/ld-elfvers/vers.exp: Likewise.
92028                 * testsuite/ld-elfvsb/elfvsb.exp: Likewise.
92029                 * testsuite/ld-elfweak/elfweak.exp: Likewise.
92030                 * testsuite/ld-gc/gc.exp: Likewise.
92031                 * testsuite/ld-pe/pe-compile.exp: Likewise.
92032                 * testsuite/ld-pe/pe-run.exp: Likewise.
92033                 * testsuite/ld-pe/pe-run2.exp: Likewise.
92034                 * testsuite/ld-plugin/plugin.exp: Likewise.
92035                 * testsuite/ld-shared/shared.exp: Likewise.
92036                 * testsuite/ld-elfcomm/elfcomm.exp: Likewise, and don't allow
92037                 nios2 testing to trash CFLAGS_FOR_TARGET.
92038                 * testsuite/ld-scripts/crossref.exp: Don't pass options in
92039                 CC_FOR_TARGET, do so in CFLAGS_FOR_TARGET instead.
92040                 * testsuite/ld-srec/srec.exp: Likewise, and for CXX.
92041
92042 2021-09-03  Alan Modra  <amodra@gmail.com>
92043
92044         CC_FOR_TARGET et al
92045         The top level Makefile, the ld Makefile and others, define
92046         CC_FOR_TARGET to be a compiler for the binutils target machine.  This
92047         is the compiler that should be used for almost all tests with C
92048         source.  There are _FOR_TARGET versions of CFLAGS, CXX, and CXXFLAGS
92049         too.  This was all supposed to work with the testsuite .exp files
92050         using CC for the target compiler, and CC_FOR_HOST for the host
92051         compiler, with the makefiles passing CC=$CC_FOR_TARGET and
92052         CC_FOR_HOST=$CC to the runtest invocation.
92053
92054         One exception to the rule of using CC_FOR_TARGET is the native-only ld
92055         bootstrap test, which uses the newly built ld to link a copy of
92056         itself.  Since the files being linked were created with the host
92057         compiler, the boostrap test should use CC and CFLAGS, in case some
92058         host compiler option provides needed libraries automatically.
92059         However, bootstrap.exp used CC where it should have used CC_FOR_HOST.
92060         I set about fixing that problem, then decided that playing games in
92061         the makefiles with CC was a bad idea.  Not only is it confusing, but
92062         other dejagnu code knows about CC_FOR_TARGET.  See dejagnu/target.exp.
92063
92064         So this patch gets rid of the makefile variable renaming and changes
92065         all the .exp files to use the correct _FOR_TARGET variables.
92066         CC_FOR_HOST and CFLAGS_FOR_HOST disappear.  A followup patch will
92067         correct bootstrap.exp to use CFLAGS, and a number of other things I
92068         noticed.
92069
92070         binutils/
92071                 * testsuite/lib/binutils-common.exp (run_dump_test): Use
92072                 CC_FOR_TARGET and CFLAGS_FOR_TARGET rather than CC and CFLAGS.
92073         ld/
92074                 * Makefile.am (check-DEJAGNU): Don't set CC to CC_FOR_TARGET
92075                 and similar.  Pass variables with unchanged names.  Don't set
92076                 CC_FOR_HOST or CFLAGS_FOR_HOST.
92077                 * Makefile.in: Regenerate.
92078                 * testsuite/config/default.exp: Update default CC and similar.
92079                 (compiler_supports, plug_opt): Use CC_FOR_TARGET.
92080                 * testsuite/ld-cdtest/cdtest.exp: Replace all uses of CC with
92081                 CC_FOR_TARGET, and similarly for CFLAGS, CXX and CXXFLAGS.
92082                 * testsuite/ld-auto-import/auto-import.exp: Likewise.
92083                 * testsuite/ld-cygwin/exe-export.exp: Likewise.
92084                 * testsuite/ld-elf/dwarf.exp: Likewise.
92085                 * testsuite/ld-elf/indirect.exp: Likewise.
92086                 * testsuite/ld-elf/shared.exp: Likewise.
92087                 * testsuite/ld-elfcomm/elfcomm.exp: Likewise.
92088                 * testsuite/ld-elfvers/vers.exp: Likewise.
92089                 * testsuite/ld-elfvsb/elfvsb.exp: Likewise.
92090                 * testsuite/ld-elfweak/elfweak.exp: Likewise.
92091                 * testsuite/ld-gc/gc.exp: Likewise.
92092                 * testsuite/ld-ifunc/ifunc.exp: Likewise.
92093                 * testsuite/ld-mn10300/mn10300.exp: Likewise.
92094                 * testsuite/ld-pe/pe-compile.exp: Likewise.
92095                 * testsuite/ld-pe/pe-run.exp: Likewise.
92096                 * testsuite/ld-pe/pe-run2.exp: Likewise.
92097                 * testsuite/ld-pie/pie.exp: Likewise.
92098                 * testsuite/ld-plugin/lto.exp: Likewise.
92099                 * testsuite/ld-plugin/plugin.exp: Likewise.
92100                 * testsuite/ld-scripts/crossref.exp: Likewise.
92101                 * testsuite/ld-selective/selective.exp: Likewise.
92102                 * testsuite/ld-sh/sh.exp: Likewise.
92103                 * testsuite/ld-shared/shared.exp: Likewise.
92104                 * testsuite/ld-srec/srec.exp: Likewise.
92105                 * testsuite/ld-undefined/undefined.exp: Likewise.
92106                 * testsuite/ld-unique/unique.exp: Likewise.
92107                 * testsuite/ld-x86-64/tls.exp: Likewise.
92108                 * testsuite/lib/ld-lib.exp: Likewise.
92109         libctf/
92110                 * Makefile.am (check-DEJAGNU): Don't set CC to CC_FOR_TARGET.
92111                 Pass CC and CC_FOR_TARGET.  Don't set CC_FOR_HOST.
92112                 * Makefile.in: Regenerate.
92113                 * testsuite/config/default.exp: Update default CC and similar.
92114                 * testsuite/lib/ctf-lib.exp (run_native_host_cmd): Use CC rather
92115                 than CC_FOR_HOST.
92116                 (run_lookup_test): Use CC_FOR_TARGET and CFLAGS_FOR_TARGET.
92117
92118 2021-09-03  Alan Modra  <amodra@gmail.com>
92119
92120         pj: asan: out of bounds, ubsan: left shift of negative
92121                 * pj-dis.c: Include libiberty.h.
92122                 (print_insn_pj): Don't index op->arg past array bound.  Don't
92123                 left shift negative int.
92124
92125         ubsan: alpha: member access within null pointer
92126                 * elf64-alpha.c (elf64_alpha_relax_with_lituse): Avoid UB.
92127
92128         ubsan: libctf: applying zero offset to null pointer
92129                 * ctf-open.c (init_symtab): Avoid ubsan error.
92130
92131 2021-09-03  Alan Modra  <amodra@gmail.com>
92132
92133         haiku tidy
92134         --enable-maintainer-mode showed a number of files needing to be
92135         regenerated, and in the case of ld/Makefile.in that the file was
92136         regenerated by hand.  Nothing to see here really.
92137
92138         ld/
92139                 * Makefile.am (ALL_64_EMULATION_SOURCES): Sort haiku entry.
92140                 * Makefile.in: Regenerate.
92141                 * po/BLD-POTFILES.in: Regenerate.
92142         libctf/
92143                 * configure: Regenerate.
92144         zlib/
92145                 * configure: Regenerate.
92146
92147 2021-09-03  Fangrui Song  <maskray@google.com>
92148
92149         gold: --export-dynamic-symbol: don't imply -u
92150         to match GNU ld.
92151
92152         gold/
92153                 * archive.cc (Library_base::should_include_member): Don't handle
92154                 --export-dynamic-symbol.
92155                 * symtab.cc (Symbol_table::do_add_undefined_symbols_from_command_line):
92156                 Likewise.
92157
92158 2021-09-03  GDB Administrator  <gdbadmin@sourceware.org>
92159
92160         Automatic date update in version.in
92161
92162 2021-09-02  Alexander von Gluck IV  <kallisti5@unixzen.com>
92163
92164         Add support for the haiku operating system.  These are the os support patches we have been grooming and maintaining for quite a few years over on git.haiku-os.org.  All of these architectures are working and most have been stable for quite some time.
92165
92166 2021-09-02  Nick Clifton  <nickc@redhat.com>
92167
92168         Fix the V850 assembler's generation of relocations for the st.b instruction.
92169                 PR 28292
92170         gas     * config/tc-v850.c (handle_lo16): Also accept
92171                 BFD_RELOC_V850_LO16_SPLIT_OFFSET.
92172                 * testsuite/gas/v850/split-lo16.s: Add extra line.
92173                 * testsuite/gas/v850/split-lo16.d: Update expected disassembly.
92174
92175         opcodes * v850-opc.c (D16): Use BFD_RELOC_V850_LO16_SPLIT_OFFSET in place
92176                 of BFD_RELOC_16.
92177
92178 2021-09-02  Alan Modra  <amodra@gmail.com>
92179
92180         SHT_SYMTAB_SHNDX handling
92181         .symtab_shndx section contents is an array, one entry for each symbol
92182         in .symtab, present when the number of symbols exceeds a little less
92183         than 64k.  Since the mapping is 1-1 with symbols there is no need to
92184         keep both dest_index and destshndx_index in elf_sym_strtab.  Instead,
92185         just make sure that the shndx pointers to the swap functions are kept
92186         NULL when .symtab_shndx does not exist.  Also, strtabcount in the
92187         linker's elf hash table is incremented in lock-step with the output
92188         symcount, so that can disappear too.
92189
92190 2021-09-02  Alan Modra  <amodra@gmail.com>
92191
92192         PTR_ADD and NPTR_ADD for bfd.h
92193         This defines a couple of macros used to avoid ubsan complaints about
92194         calculations involving NULL pointers.  PTR_ADD should be used in the
92195         case where it is known that the offset is always zero with a NULL
92196         pointer, and you'd like to know if a non-zero offset is ever used.
92197         NPTR_ADD should be rarely used, but is defined for cases where a
92198         non-zero offset is expected and should be ignored if the pointer is
92199         NULL.
92200
92201         bfd/
92202                 * bfd-in.h (PTR_ADD, NPTR_ADD): Define.
92203                 * bfd-in2.h: Regenerate.
92204                 * elf-eh-frame.c (adjust_eh_frame_local_symbols): Avoid NULL
92205                 pointer calculations.
92206                 * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): Likewise.
92207                 (bfd_elf_add_dt_needed_tag, elf_finalize_dynstr): Likewise.
92208                 (elf_link_add_object_symbols, elf_link_input_bfd): Likewise.
92209                 (bfd_elf_final_link, bfd_elf_gc_record_vtinherit): Likewise.
92210         binutils/
92211                 * objdump.c (disassemble_section): Use PTR_ADD for rel_ppend.
92212
92213 2021-09-02  Alan Modra  <amodra@gmail.com>
92214
92215         obstack.h __PTR_ALIGN vs. ubsan
92216         Current ubsan complains on every use of __PTR_ALIGN (when ptrdiff_t is
92217         as large as a pointer), due to making calculations relative to a NULL
92218         pointer.  This patch avoids the problem by extracting out and
92219         simplifying __BPTR_ALIGN for the usual case.  I've continued to use
92220         ptrdiff_t here, where it might be better to throw away __BPTR_ALIGN
92221         entirely and just assume uintptr_t exists.
92222
92223                 * obstack.h (__PTR_ALIGN): Expand and simplify __BPTR_ALIGN
92224                 rather than calculating relative to a NULL pointer.
92225
92226 2021-09-02  GDB Administrator  <gdbadmin@sourceware.org>
92227
92228         Automatic date update in version.in
92229
92230 2021-09-01  Tom de Vries  <tdevries@suse.de>
92231
92232         [gdb/testsuite] Fix dwo path in fission-*.S
92233         [ Using $build for /home/vries/gdb_versions/devel/build to make things a bit
92234         more readable. ]
92235
92236         When using make check// to run test-case gdb.dwarf2/fission-base.exp:
92237         ...
92238         ( cd $build/gdb; make check//unix RUNTESTFLAGS="fission-base.exp" )
92239         ...
92240         we run into:
92241         ...
92242         (gdb) file \
92243           $build/gdb/testsuite.unix/outputs/gdb.dwarf2/fission-base/fission-base^M
92244         Reading symbols from \
92245           $build/gdb/testsuite.unix/outputs/gdb.dwarf2/fission-base/fission-base...^M
92246         warning: Could not find DWO CU \
92247           $build/gdb/testsuite.1/outputs/gdb.dwarf2/fission-base/fission-base.dwo \
92248           (0x807060504030201) referenced by CU at offset 0xc7 [in module \
92249           $build/gdb/testsuite.unix/outputs/gdb.dwarf2/fission-base/fission-base]^M
92250         ...
92251
92252         The problem is that the executable refers to the dwo file using path name
92253         $build/gdb/testsuite.1/outputs/gdb.dwarf2/fission-base/fission-base.dwo,
92254         while the actual dwo file is at
92255         $build/gdb/testsuite.unix/outputs/gdb.dwarf2/fission-base/fission-base.dwo.
92256
92257         This is caused by this trick in fission-base.S:
92258         ...
92259          #define XSTR(s) STR(s)
92260          #define STR(s) #s
92261            ...
92262            .asciz XSTR(DWO)        # DW_AT_GNU_dwo_name
92263         ...
92264         and:
92265         ...
92266         $ echo | gcc -E -dD - | grep "define unix"
92267         ...
92268
92269         I used this trick to avoid doing additional_flags=-DDWO=\"$dwo\", since I was
92270         concerned that there could be quoting issues.
92271
92272         However, I've found other uses of this pattern, f.i. in
92273         gdb/testsuite/gdb.base/corefile-buildid.exp:
92274         ...
92275           additional_flags=-DSHLIB_NAME=\"$dlopen_lib\"]
92276         ...
92277
92278         So, fix this by:
92279         - using additional_flags=-DDWO=\"$dwo\" and
92280         - using plain DWO instead of XSTR(DWO)
92281
92282         Likewise in other gdb.dwarf2/fission*.exp test-cases.
92283
92284         Tested on x86_64-linux, using make check//unix.
92285
92286         gdb/testsuite/ChangeLog:
92287
92288         2021-09-01  Tom de Vries  <tdevries@suse.de>
92289
92290                 PR testsuite/28298
92291                 * gdb.dwarf2/fission-base.S: Use DWO instead of XSTR(DWO).
92292                 * gdb.dwarf2/fission-loclists-pie.S: Same.
92293                 * gdb.dwarf2/fission-loclists.S: Same.
92294                 * gdb.dwarf2/fission-reread.S: Same.
92295                 * gdb.dwarf2/fission-base.exp: Use additional_flags=-DDWO=\"$dwo\".
92296                 * gdb.dwarf2/fission-loclists-pie.exp: Same.
92297                 * gdb.dwarf2/fission-loclists.exp: Same.
92298                 * gdb.dwarf2/fission-reread.exp: Same.
92299
92300 2021-09-01  Tom de Vries  <tdevries@suse.de>
92301
92302         [gdb/testsuite] Fix gdb.fortran/call-no-debug.exp symbol search
92303         On openSUSE Tumbleweed I ran into:
92304         ...
92305         (gdb) ptype outstring_func.part^M
92306         No symbol "outstring_func" in current context.^M
92307         (gdb) FAIL: gdb.fortran/call-no-debug.exp: ptype outstring_func.part
92308         ...
92309         while on openSUSE Leap 15.2 I have instead:
92310         ...
92311         (gdb) ptype string_func_^M
92312         type = <unknown return type> ()^M
92313         (gdb) PASS: gdb.fortran/call-no-debug.exp: ptype string_func_
92314         ...
92315
92316         The difference is caused by the result for "info function string_func", which
92317         is this for the latter:
92318         ...
92319         (gdb) info function string_func^M
92320         All functions matching regular expression "string_func":^M
92321         ^M
92322         Non-debugging symbols:^M
92323         0x000000000040089c  string_func_^M
92324         ...
92325         but this for the former:
92326         ...
92327         (gdb) info function string_func^M
92328         All functions matching regular expression "string_func":^M
92329         ^M
92330         Non-debugging symbols:^M
92331         0x00000000004012bb  string_func_^M
92332         0x00007ffff7bac5b0  outstring_func.part^M
92333         0x00007ffff7bb1a00  outstring_func.part^M
92334         ...
92335
92336         The extra symbols are part of glibc:
92337         ...
92338         $ nm /lib64/libc.so.6 | grep string_func
92339         00000000000695b0 t outstring_func.part.0
92340         000000000006ea00 t outstring_func.part.0
92341         ...
92342
92343         If glibc debug info is installed, we get instead:
92344         ...
92345         (gdb) info function string_func^M
92346         All functions matching regular expression "string_func":^M
92347         ^M
92348         File /usr/src/debug/glibc-2.33-9.1.x86_64/stdio-common/vfprintf-internal.c:^M
92349         236:    static int outstring_func(int, size_t, const unsigned int *, FILE *);^M
92350         ^M
92351         File vfprintf-internal.c:^M
92352         236:    static int outstring_func(int, size_t, const unsigned char *, FILE *);^M
92353         ^M
92354         Non-debugging symbols:^M
92355         0x00000000004012bb  string_func_^M
92356         ...
92357         and the FAIL doesn't trigger.
92358
92359         Fix this by calling "info function string_func" before starting the exec, such
92360         that only symbols of the exec are taken into account.
92361
92362         Tested on x86_64-linux.
92363
92364         gdb/testsuite/ChangeLog:
92365
92366         2021-09-01  Tom de Vries  <tdevries@suse.de>
92367
92368                 * gdb.fortran/call-no-debug.exp: Avoid shared lib symbols for
92369                 find_mangled_name calls.
92370
92371 2021-09-01  Yinjun Zhang  <yinjun.zhang@corigine.com>
92372
92373         nfp: add validity check of island and me
92374         AddressSanitizer detects heap-buffer-overflow when running
92375         "objdump -D" for nfp .nffw files.
92376
92377                 PR 27854
92378                 * nfp-dis.c (_NFP_ISLAND_MAX, _NFP_ME_MAX): Define.
92379                 (nfp_priv_data): ..and use here.
92380                 (_print_instrs): Sanity check island and menum.
92381
92382 2021-09-01  Alan Modra  <amodra@gmail.com>
92383
92384         PR28250, Null pointer dereference in debug_class_type_samep
92385         Typo fix, obviously should be m1->variants != NULL, not
92386         m1->variants == NULL.
92387
92388                 PR 28250
92389                 * debug.c (debug_class_type_samep): Correct m1->variants test.
92390
92391 2021-09-01  GDB Administrator  <gdbadmin@sourceware.org>
92392
92393         Automatic date update in version.in
92394
92395 2021-08-31  Simon Marchi  <simon.marchi@polymtl.ca>
92396
92397         gdb: remove breakpoint_find_if
92398         Remove breakpoint_find_if, replace its sole usage with using
92399         all_breakpoints directly instead.  At the same time, change return
92400         types to use bool.
92401
92402         Change-Id: I9ec392236b4804b362d16ab563330b9c07311106
92403
92404 2021-08-31  Nick Clifton  <nickc@redhat.com>
92405
92406         Update the how-to-make-a-release document so that a check for empty manual pages is included.  cf PR 28144
92407
92408 2021-08-31  Nelson Chu  <nelson.chu@sifive.com>
92409
92410         RISC-V: Extend .insn directive to support hardcode encoding.
92411         The .insn directive can let users use their own instructions, or
92412         some new instruction, which haven't supported in the old binutils.
92413         For example, if users want to use sifive cache instruction, they
92414         cannot just write "cflush.d1.l1" in the assembly code, they should
92415         use ".insn i SYSTEM, 0, x0, x10, -0x40".  But the .insn directive
92416         may not easy to use for some cases, and not so friendly to users.
92417         Therefore, I believe most of the users will use ".word 0xfc050073",
92418         to encode the instructions directly, rather than use .insn.  But
92419         once we have supported the mapping symbols, the .word directives
92420         are marked as data, so disassembler won't dump them as instructions
92421         as usual.  I have discussed this with Kito many times, we all think
92422         extend the .insn direcitve to support the hardcode encoding, is the
92423         easiest way to resolve the problem.  Therefore, there are two more
92424         .insn formats are proposed as follows,
92425
92426         (original) .insn <type>, <operand1>, <operand2>, ...
92427                    .insn <insn-length>, <value>
92428                    .insn <value>
92429
92430         The <type> is string, and the <insn-length> and <value> are constants.
92431
92432         gas/
92433                 * config/tc-riscv.c (riscv_ip_hardcode): Similar to riscv_ip,
92434                 but assembles an instruction according to the hardcode values
92435                 of .insn directive.
92436                 * doc/c-riscv.texi: Document two new .insn formats.
92437                 * testsuite/gas/riscv/insn-fail.d: New testcases.
92438                 * testsuite/gas/riscv/insn-fail.l: Likewise.
92439                 * testsuite/gas/riscv/insn-fail.s: Likewise.
92440                 * testsuite/gas/riscv/insn.d: Updated.
92441                 * testsuite/gas/riscv/insn.s: Likewise.
92442
92443 2021-08-31  John Baldwin  <jhb@FreeBSD.org>
92444
92445         Use gdbfmt for vprintf_filtered.
92446         gdbfmt was already used for printf_filtered, so using it for
92447         vprintf_filtered is more consistent.
92448
92449         As a result, all callers of vfprintf_maybe_filtered now use gdbfmt, so
92450         the function can be simplified to assume the gdbfmt case and remove
92451         the associated bool argument.  Similary, vprintf_filtered is now a
92452         simple wrapper around vfprintf_filtered.
92453
92454 2021-08-31  GDB Administrator  <gdbadmin@sourceware.org>
92455
92456         Automatic date update in version.in
92457
92458 2021-08-30  John Baldwin  <jhb@FreeBSD.org>
92459
92460         fbsd-nat: Don't use '%jd' and '%ju' with printf_filtered.
92461         The handler for 'info proc status' for native processes on FreeBSD
92462         uses the 'j' size modifier along with uintmax_t / intmax_t casts to
92463         output integer values for types such as off_t that are not aliases of
92464         a basic C type such as 'int' or 'long'.  printf_filtered does not
92465         support the 'j' modifer, so this resulted in runtime errors in
92466         practice:
92467
92468         (gdb) info proc stat
92469         process 8674
92470         Name: ls
92471         State: T (stopped)
92472         Parent process: 8673
92473         Process group: 8674
92474         Session id: 2779
92475         Unrecognized format specifier 'j' in printf
92476
92477         Instead, use plongest and pulongest to generate the output strings of
92478         these integer values.
92479
92480 2021-08-30  Simon Marchi  <simon.marchi@polymtl.ca>
92481
92482         gdb: fix build error in unittests/parallel-for-selftests.c
92483         We get this error when building GDB on some platforms.  I get it using
92484         g++-10 on Ubuntu 20.04 (installed using the distro package).  It was
92485         also reported by John Baldwin, using a clang that uses libc++.
92486
92487               CXX    unittests/parallel-for-selftests.o
92488             cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
92489             /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c: In function 'void selftests::parallel_for::test(int)':
92490             /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:53:30: error: use of deleted function 'std::atomic<int>::atomic(const std::atomic<int>&)'
92491                53 |   std::atomic<int> counter = 0;
92492                   |                              ^
92493             In file included from /usr/include/c++/9/future:42,
92494                              from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/thread-pool.h:29,
92495                              from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/parallel-for.h:26,
92496                              from /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:22:
92497             /usr/include/c++/9/atomic:755:7: note: declared here
92498               755 |       atomic(const atomic&) = delete;
92499                   |       ^~~~~~
92500             /usr/include/c++/9/atomic:759:17: note:   after user-defined conversion: 'constexpr std::atomic<int>::atomic(std::atomic<int>::__integral_type)'
92501               759 |       constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
92502                   |                 ^~~~~~
92503
92504         I haven't dug to know why it does not happen everywhere, but this patch
92505         fixes it by using the constructor to initialize the variable, rather
92506         than the assignment operator.
92507
92508         Change-Id: I6b27958171bf6187f6a875657395fd10441db7e6
92509
92510 2021-08-30  Nelson Chu  <nelson.chu@sifive.com>
92511
92512         RISC-V: PR28291, Fix the gdb fails that PR27916 caused.
92513         * According to PR28291, we get the following unexpected gdb behavior,
92514
92515         (gdb) disassemble 0x0,+4
92516         Dump of assembler code from 0x0 to 0x4:
92517            0x0000000000000000:
92518            0x0000000000000001:
92519            0x0000000000000002:
92520            0x0000000000000003:
92521         End of assembler dump.
92522
92523         * This patch should fix it to the right behavior,
92524
92525         (gdb) disassemble 0x0,+4
92526         Dump of assembler code from 0x0 to 0x4:
92527            0x0000000000000000:  Cannot access memory at address 0x0
92528
92529         opcodes/
92530             pr 28291
92531             * riscv-dis.c (print_insn_riscv): Return STATUS if it is not zero.
92532
92533 2021-08-30  Tom Tromey  <tom@tromey.com>
92534
92535         Add some parallel_for_each tests
92536         Tom de Vries noticed that a patch in the DWARF scanner rewrite series
92537         caused a regression in parallel_for_each -- it started crashing in the
92538         case where the number of threads is 0 (there was an unchecked use of
92539         "n-1" that was used to size an array).
92540
92541         He also pointed out that there were no tests of parallel_for_each.
92542         This adds a few tests of parallel_for_each, primarily testing that
92543         different settings for the number of threads will work.  This test
92544         catches the bug that he found in that series.
92545
92546 2021-08-30  Tom Tromey  <tom@tromey.com>
92547
92548         Add a show function for "maint show worker-threads"
92549         I wanted to see how many threads gdb thought it was using, but
92550         "maint show worker-threads" only reported "unlimited".  This patch
92551         adds a show function so that it will now report the number of threads
92552         gdb has started.
92553
92554         Regression tested on x86-64 Fedora 34.
92555
92556 2021-08-30  Tom de Vries  <tdevries@suse.de>
92557
92558         [gdb/cli] Don't assert on empty string for core-file
92559         With current gdb we run into:
92560         ...
92561         $ gdb -batch '' ''
92562         : No such file or directory.
92563         pathstuff.cc:132: internal-error: \
92564           gdb::unique_xmalloc_ptr<char> gdb_abspath(const char*): \
92565           Assertion `path != NULL && path[0] != '\0'' failed.
92566         ...
92567
92568         Fix this by skipping the call to gdb_abspath in core_target_open in the
92569         empty-string case, such that we have instead:
92570         ...
92571         $ gdb -batch '' ''
92572         : No such file or directory.
92573         : No such file or directory.
92574         $
92575         ...
92576
92577         Tested on x86_64-linux.
92578
92579         gdb/ChangeLog:
92580
92581         2021-08-30  Tom de Vries  <tdevries@suse.de>
92582
92583                 PR cli/28290
92584                 * gdb/corelow.c (core_target_open): Skip call to gdb_abspath in the
92585                 empty-string case.
92586
92587         gdb/testsuite/ChangeLog:
92588
92589         2021-08-30  Tom de Vries  <tdevries@suse.de>
92590
92591                 PR cli/28290
92592                 * gdb.base/batch-exit-status.exp: Add gdb '' and gdb '' '' tests.
92593
92594 2021-08-30  Nelson Chu  <nelson.chu@sifive.com>
92595
92596         RISC-V: PR27916, Support mapping symbols.
92597         Similar to ARM/AARCH64, we add mapping symbols in the symbol table,
92598         to mark the start addresses of data and instructions.  The $d means
92599         data, and the $x means instruction.  Then the disassembler uses these
92600         symbols to decide whether we should dump data or instruction.
92601
92602         Consider the mapping-04 test case,
92603         $ cat tmp.s
92604           .text
92605           .option norelax
92606           .option norvc
92607           .fill 2, 4, 0x1001
92608           .byte 1
92609           .word 0
92610           .balign 8
92611           add a0, a0, a0
92612           .fill 5, 2, 0x2002
92613           add a1, a1, a1
92614           .data
92615           .word 0x1             # No need to add mapping symbols.
92616           .word 0x2
92617
92618         $ riscv64-unknown-elf-as tmp.s -o tmp.o
92619         $ riscv64-unknown-elf-objdump -d tmp.o
92620
92621         Disassembly of section .text:
92622
92623         0000000000000000 <.text>:
92624            0:   00001001         .word   0x00001001  # Marked $d, .fill directive.
92625            4:   00001001         .word   0x00001001
92626            8:   00000001         .word   0x00000001  # .byte + part of .word.
92627            c:   00               .byte   0x00        # remaining .word.
92628            d:   00               .byte   0x00        # Marked $d, odd byte of alignment.
92629            e:   0001             nop                 # Marked $x, nops for alignment.
92630           10:   00a50533         add     a0,a0,a0
92631           14:   20022002         .word   0x20022002  # Marked $d, .fill directive.
92632           18:   20022002         .word   0x20022002
92633           1c:   2002             .short  0x2002
92634           1e:   00b585b3         add     a1,a1,a1    # Marked $x.
92635           22:   0001             nop                 # Section tail alignment.
92636           24:   00000013         nop
92637
92638         * Use $d and $x to mark the distribution of data and instructions.
92639           Alignments of code are recognized as instructions, since we usually
92640           fill nops for them.
92641
92642         * If the alignment have odd bytes, then we cannot just fill the nops
92643           into the spaces.  We always fill an odd byte 0x00 at the start of
92644           the spaces.  Therefore, add a $d mapping symbol for the odd byte,
92645           to tell disassembler that it isn't an instruction.  The behavior
92646           is same as Arm and Aarch64.
92647
92648         The elf/linux toolchain regressions all passed.  Besides, I also
92649         disable the mapping symbols internally, but use the new objudmp, the
92650         regressions passed, too.  Therefore, the new objudmp should dump
92651         the objects corretly, even if they don't have any mapping symbols.
92652
92653         bfd/
92654                 pr 27916
92655                 * cpu-riscv.c (riscv_elf_is_mapping_symbols): Define mapping symbols.
92656                 * cpu-riscv.h: extern riscv_elf_is_mapping_symbols.
92657                 * elfnn-riscv.c (riscv_maybe_function_sym): Do not choose mapping
92658                 symbols as a function name.
92659                 (riscv_elf_is_target_special_symbol): Add mapping symbols.
92660         binutils/
92661                 pr 27916
92662                 * testsuite/binutils-all/readelf.s: Updated.
92663                 * testsuite/binutils-all/readelf.s-64: Likewise.
92664                 * testsuite/binutils-all/readelf.s-64-unused: Likewise.
92665                 * testsuite/binutils-all/readelf.ss: Likewise.
92666                 * testsuite/binutils-all/readelf.ss-64: Likewise.
92667                 * testsuite/binutils-all/readelf.ss-64-unused: Likewise.
92668         gas/
92669                 pr 27916
92670                 * config/tc-riscv.c (make_mapping_symbol): Create a new mapping symbol.
92671                 (riscv_mapping_state): Decide whether to create mapping symbol for
92672                 frag_now.  Only add the mapping symbols to text sections.
92673                 (riscv_add_odd_padding_symbol): Add the mapping symbols for the
92674                 riscv_handle_align, which have odd bytes spaces.
92675                 (riscv_check_mapping_symbols): Remove any excess mapping symbols.
92676                 (md_assemble): Marked as MAP_INSN.
92677                 (riscv_frag_align_code): Marked as MAP_INSN.
92678                 (riscv_init_frag): Add mapping symbols for frag, it usually called
92679                 by frag_var.  Marked as MAP_DATA for rs_align and rs_fill, and
92680                 marked as MAP_INSN for rs_align_code.
92681                 (s_riscv_insn): Marked as MAP_INSN.
92682                 (riscv_adjust_symtab): Call riscv_check_mapping_symbols.
92683                 * config/tc-riscv.h (md_cons_align): Defined to riscv_mapping_state
92684                 with MAP_DATA.
92685                 (TC_SEGMENT_INFO_TYPE): Record mapping state for each segment.
92686                 (TC_FRAG_TYPE): Record the first and last mapping symbols for the
92687                 fragments.  The first mapping symbol must be placed at the start
92688                 of the fragment.
92689                 (TC_FRAG_INIT): Defined to riscv_init_frag.
92690                 * testsuite/gas/riscv/mapping-01.s: New testcase.
92691                 * testsuite/gas/riscv/mapping-01a.d: Likewise.
92692                 * testsuite/gas/riscv/mapping-01b.d: Likewise.
92693                 * testsuite/gas/riscv/mapping-02.s: Likewise.
92694                 * testsuite/gas/riscv/mapping-02a.d: Likewise.
92695                 * testsuite/gas/riscv/mapping-02b.d: Likewise.
92696                 * testsuite/gas/riscv/mapping-03.s: Likewise.
92697                 * testsuite/gas/riscv/mapping-03a.d: Likewise.
92698                 * testsuite/gas/riscv/mapping-03b.d: Likewise.
92699                 * testsuite/gas/riscv/mapping-04.s: Likewise.
92700                 * testsuite/gas/riscv/mapping-04a.d: Likewise.
92701                 * testsuite/gas/riscv/mapping-04b.d: Likewise.
92702                 * testsuite/gas/riscv/mapping-norelax-04a.d: Likewise.
92703                 * testsuite/gas/riscv/mapping-norelax-04b.d: Likewise.
92704                 * testsuite/gas/riscv/no-relax-align.d: Updated.
92705                 * testsuite/gas/riscv/no-relax-align-2.d: Likewise.
92706         include/
92707                 pr 27916
92708                 * opcode/riscv.h (enum riscv_seg_mstate): Added.
92709
92710         opcodes/
92711                 pr 27916
92712                 * riscv-dis.c (last_map_symbol, last_stop_offset, last_map_state):
92713                 Added to dump sections with mapping symbols.
92714                 (riscv_get_map_state): Get the mapping state from the symbol.
92715                 (riscv_search_mapping_symbol): Check the sorted symbol table, and
92716                 then find the suitable mapping symbol.
92717                 (riscv_data_length): Decide which data size we should print.
92718                 (riscv_disassemble_data): Dump the data contents.
92719                 (print_insn_riscv): Handle the mapping symbols.
92720                 (riscv_symbol_is_valid): Marked mapping symbols as invalid.
92721
92722 2021-08-30  Tom de Vries  <tdevries@suse.de>
92723
92724         [gdb/testsuite] Improve argument syntax of proc arange
92725         The current syntax of proc arange is:
92726         ...
92727           proc arange { arange_start arange_length {comment ""} {seg_sel ""} } {
92728         ...
92729         and a typical call looks like:
92730         ...
92731           arange $start $len
92732         ...
92733
92734         This style is somewhat annoying because if you want to specify the last
92735         parameter, you need to give the default values of all the other optional ones
92736         before as well:
92737         ...
92738           arange $start $len "" $seg_sel
92739         ...
92740
92741         Update the syntax to:
92742         ...
92743             proc arange { options arange_start arange_length } {
92744                parse_options {
92745                    { comment "" }
92746                    { seg_sel "" }
92747                }
92748         ...
92749         such that a typical call looks like:
92750         ...
92751           arange {} $start $len
92752         ...
92753         and a call using seg_sel looks like:
92754         ...
92755           arange {
92756             seg_sel $seg_sel
92757           } $start $len
92758         ...
92759
92760         Also update proc aranges, which already has an options argument, to use the
92761         new proc parse_options.
92762
92763         Tested on x86_64-linux.
92764
92765         Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
92766
92767 2021-08-30  GDB Administrator  <gdbadmin@sourceware.org>
92768
92769         Automatic date update in version.in
92770
92771 2021-08-29  GDB Administrator  <gdbadmin@sourceware.org>
92772
92773         Automatic date update in version.in
92774
92775 2021-08-28  H.J. Lu  <hjl.tools@gmail.com>
92776
92777         ld: Change indirect symbol from IR to undefined
92778         bfd/
92779
92780                 PR ld/28264
92781                 * elflink.c (_bfd_elf_merge_symbol): Change indirect symbol from
92782                 IR to undefined.
92783
92784         ld/
92785
92786                 PR ld/28264
92787                 * testsuite/ld-plugin/lto.exp: Run PR ld/28264 test.
92788                 * testsuite/ld-plugin/pr28264-1.d: New file.
92789                 * testsuite/ld-plugin/pr28264-2.d: Likewise.
92790                 * testsuite/ld-plugin/pr28264-3.d: Likewise.
92791                 * testsuite/ld-plugin/pr28264-4.d: Likewise.
92792                 * testsuite/ld-plugin/pr28264.c: Likewise.
92793                 * testsuite/ld-plugin/pr28264.ver: Likewise.
92794
92795 2021-08-28  Alan Modra  <amodra@gmail.com>
92796
92797         PR28264, ld.bfd crash on linking efivar with LTO
92798                 PR 28264
92799                 PR 26978
92800                 * linker.c (_bfd_generic_link_add_one_symbol <MIND>): Check
92801                 that string is non-NULL.
92802
92803 2021-08-28  GDB Administrator  <gdbadmin@sourceware.org>
92804
92805         Automatic date update in version.in
92806
92807 2021-08-27  Tom de Vries  <tdevries@suse.de>
92808
92809         [gdb/symtab] Don't write .gdb_index symbol table with empty entries
92810         When comparing the sizes of the index files generated for shlib
92811         outputs/gdb.dwarf2/dw2-zero-range/shr1.sl, I noticed a large difference
92812         between .debug_names:
92813         ...
92814         $ gdb -q -batch $shlib -ex "save gdb-index -dwarf-5 ."
92815         $ du -b -h shr1.sl.debug_names shr1.sl.debug_str
92816         61      shr1.sl.debug_names
92817         0       shr1.sl.debug_str
92818         ...
92819         and .gdb_index:
92820         ...
92821         $ gdb -q -batch $shlib -ex "save gdb-index ."
92822         $ du -b -h shr1.sl.gdb-index
92823         8.2K    shr1.sl.gdb-index
92824         ...
92825
92826         The problem is that the .gdb_index contains a non-empty symbol table with only
92827         empty entries.
92828
92829         Fix this by making the symbol table empty, such that we have instead:
92830         ...
92831         $ du -b -h shr1.sl.gdb-index
92832         184     shr1.sl.gdb-index
92833         ...
92834
92835         Tested on x86_64-linux.
92836
92837 2021-08-27  Tom de Vries  <tdevries@suse.de>
92838
92839         [gdb/testsuite] Generate .debug_aranges in gdb.dlang/watch-loc.exp
92840         Before commit 5ef670d81fd "[gdb/testsuite] Add dummy start and end CUs in
92841         dwarf assembly" we had in exec outputs/gdb.dlang/watch-loc/watch-loc a D
92842         compilation unit at offset 0xc7:
92843         ...
92844           Compilation Unit @ offset 0xc7:
92845            Length:        0x4c (32-bit)
92846            Version:       4
92847            Abbrev Offset: 0x64
92848            Pointer Size:  8
92849          <0><d2>: Abbrev Number: 2 (DW_TAG_compile_unit)
92850             <d3>   DW_AT_language    : 19       (D)
92851         ...
92852         with a corresponding .debug_aranges entry:
92853         ...
92854         Offset into .debug_info:  0xc7
92855           Pointer Size:             4
92856           Segment Size:             0
92857
92858             Address    Length
92859             004004a7 0000000b
92860             00000000 00000000
92861         ...
92862
92863         After that commit we have a dummy CU at offset 0xc7 and the D compilation unit
92864         at offset 0xd2:
92865         ...
92866           Compilation Unit @ offset 0xc7:
92867            Length:        0x7 (32-bit)
92868            Version:       4
92869            Abbrev Offset: 0x64
92870            Pointer Size:  8
92871           Compilation Unit @ offset 0xd2:
92872            Length:        0x4c (32-bit)
92873            Version:       4
92874            Abbrev Offset: 0x65
92875            Pointer Size:  8
92876          <0><dd>: Abbrev Number: 2 (DW_TAG_compile_unit)
92877             <de>   DW_AT_language    : 19       (D)
92878         ...
92879         while the .debug_aranges entry still points to 0xc7.
92880
92881         The problem is that the test-case uses a hack (quoting from
92882         commit 75f06e9dc59):
92883         ...
92884         [ Note: this is a non-trivial test-case.  The file watch-loc-dw.S contains a
92885         .debug_info section, but not an .debug_aranges section or any actual code.
92886         The file watch-loc.c contains code and a .debug_aranges section, but no other
92887         debug section.  So, the intent for the .debug_aranges section in watch-loc.c
92888         is to refer to a compilation unit in the .debug_info section in
92889         watch-loc-dw.S. ]
92890         ...
92891         and adding the dummy CU caused that hack to stop working.
92892
92893         Fix this by moving the generation of .debug_aranges from watch-loc.c to
92894         watch-loc.exp, such that we have:
92895         ...
92896           Offset into .debug_info:  0xd2
92897           Pointer Size:             4
92898           Segment Size:             0
92899
92900             Address    Length
92901             004004a7 0000000b
92902             00000000 00000000
92903         ...
92904
92905         Tested on x86_64-linux.
92906
92907 2021-08-27  Tom de Vries  <tdevries@suse.de>
92908
92909         [gdb/testsuite] Generate .debug_aranges entry for dummy CU
92910         A best practise for DWARF [1] is to generate .debug_aranges entries for CUs
92911         even if they have no address range.
92912
92913         Generate .debug_arange entries for the dummy CUs added by the DWARF assembler.
92914
92915         Tested on x86_64-linux.
92916
92917         [1] http://wiki.dwarfstd.org/index.php?title=Best_Practices
92918
92919 2021-08-27  Tom de Vries  <tdevries@suse.de>
92920
92921         [gdb/testsuite] Add .debug_aranges in more test-cases
92922         A couple of test-cases fail when run with target board cc-with-debug-names due
92923         to missing .debug_aranges entries for the CUs added by the dwarf assembler.
92924
92925         Add a .debug_aranges entry for those CUs.
92926
92927         Tested on x86_64-linux.
92928
92929 2021-08-27  Tom de Vries  <tdevries@suse.de>
92930
92931         [gdb/testsuite] Support .debug_aranges in dwarf assembly
92932         Add a proc aranges such that we can generate .debug_aranges sections in dwarf
92933         assembly using:
92934         ...
92935           cu { label cu_label } {
92936           ...
92937           }
92938
92939           aranges {} cu_label {
92940             arange $addr $len [<comment>] [$segment_selector]
92941           }
92942         ...
92943
92944         Tested on x86_64-linux.
92945
92946 2021-08-27  Tom de Vries  <tdevries@suse.de>
92947
92948         [gdb/testsuite] Add label option to proc cu
92949         We can use current dwarf assembly infrastructure to declare a label that marks
92950         the start of the CU header:
92951         ...
92952           declare_labels header_start_cu_a
92953           _section ".debug_info"
92954           header_start_cu_a : cu {} {
92955           }
92956           _section ".debug_info"
92957           header_start_cu_b : cu {} {
92958           }
92959         ...
92960         on the condition that we switch to the .debug_info section before, which makes
92961         this style of use fragile.
92962
92963         Another way to achieve the same is to use the label as generated by the cu
92964         proc itself:
92965         ...
92966           variable _cu_label
92967           cu {} {
92968           }
92969           set header_start_cu_a $_cu_label
92970           cu {} {
92971           }
92972           set header_start_cu_b $_cu_label
92973         ...
92974         but again that seems fragile given that adding a new CU inbetween will
92975         silently result in the wrong value for the label.
92976
92977         Add a label option to proc cu such that we can simply do:
92978         ...
92979           cu { label header_start_cu_a } {
92980           }
92981           cu { label header_start_cu_b } {
92982           }
92983         ...
92984
92985         Tested on x86_64-linux.
92986
92987 2021-08-27  GDB Administrator  <gdbadmin@sourceware.org>
92988
92989         Automatic date update in version.in
92990
92991 2021-08-26  Andrew Burgess  <andrew.burgess@embecosm.com>
92992
92993         gdb: remove some stray newlines in debug output
92994         I spotted a couple of stray newlines that were left at the end of
92995         debug message during conversion to the new debug output scheme.  These
92996         messages are part of the 'set debug lin-lwp 1' output.
92997
92998 2021-08-26  GDB Administrator  <gdbadmin@sourceware.org>
92999
93000         Automatic date update in version.in
93001
93002 2021-08-25  GDB Administrator  <gdbadmin@sourceware.org>
93003
93004         Automatic date update in version.in
93005
93006 2021-08-24  Tom Tromey  <tom@tromey.com>
93007
93008         Fix two regressions caused by CU / TU merging
93009         PR symtab/28160 and PR symtab/27893 concern GDB crashes in the test
93010         suite when using the "fission" target board.  They are both caused by
93011         the patches that merge the list of CUs with the list of TUs (and to a
93012         lesser degree by the patches to share DWARF data across objfiles), and
93013         the underlying issue is the same: it turns out that reading a DWO can
93014         cause new type units to be created.  This means that the list of
93015         dwarf2_per_cu_data objects depends on precisely which CUs have been
93016         expanded.  However, because the type units can be created while
93017         expanding a CU means that the vector of CUs can expand while it is
93018         being iterated over -- a classic mistake.  Also, because a TU can be
93019         added later, it means the resize_symtabs approach is incorrect.
93020
93021         This patch fixes resize_symtabs by removing it, and having set_symtab
93022         resize the vector on demand.  It fixes the iteration problem by
93023         introducing a safe (index-based) iterator and changing the relevant
93024         spots to use it.
93025
93026         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28160
93027         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27893
93028
93029 2021-08-24  Alan Modra  <amodra@gmail.com>
93030
93031         Real programmers don't configure gcc using --with-ld
93032                 * testsuite/lib/ld-lib.exp (run_host_cmd): Give a clue as to why
93033                 gcc -B doesn't pick up the ld under test.
93034
93035 2021-08-24  Alan Modra  <amodra@gmail.com>
93036
93037         objdump -S test fail on mingw
93038         FAIL: objdump -S
93039         FAIL: objdump --source-comment
93040         is seen on mingw for the simple reason that gcc adds a .exe suffix on
93041         the output file if not already present.  Fix that, and tidy some objcopy
93042         tests.
93043
93044                 * testsuite/lib/binutils-common.exp (exeext): New proc.
93045                 * testsuite/binutils-all/objcopy.exp (exe, test_prog): Use it here.
93046                 (objcopy_remove_relocations_from_executable): Catch objcopy errors.
93047                 Only run on ELF targets.
93048                 * testsuite/binutils-all/objdump.exp (exe): Set variable.
93049                 (test_build_id_debuglink, test_objdump_S): Use exe file suffix.
93050
93051 2021-08-24  James Bowman (FTDI-UK)  <james.bowman@ftdichip.com>
93052
93053         FT32: Remove recursion in ft32_opcode
93054         The function ft32_opcode used recursion.  This could cause a stack
93055         overflow.  Replaced with a pair of non-recursive functions.
93056
93057                 PR 28169
93058                 * ft32-dis.c: Formatting.
93059                 (ft32_opcode1): Split out from..
93060                 (ft32_opcode): ..here.
93061
93062 2021-08-24  GDB Administrator  <gdbadmin@sourceware.org>
93063
93064         Automatic date update in version.in
93065
93066 2021-08-23  Tom Tromey  <tom@tromey.com>
93067
93068         Fix a latent bug in dw2-ranges-overlap.exp
93069         dw2-ranges-overlap.exp creates a program where a psymtab has two
93070         address ranges, and a function without debug info whose address is
93071         between these two ranges.  Then it sets a breakpoint on this function
93072         and runs to it, expecting that the language should remain "auto; c"
93073         when stopped.
93074
93075         However, this test case also has a "main" function described (briefly)
93076         in the DWARF, and this function is given language C++.  Also, a
93077         breakpoint stop sets the current language to the language that was
93078         used when setting the breakpoint.
93079
93080         My new DWARF scanner decides that this "main" is the main program and
93081         sets the current language to C++ at startup, causing this test to
93082         fail.
93083
93084         This patch fixes the test in a simple way, by introducing a new
93085         function that takes the place of "main" in the DWARF.  I think this
93086         still exercises the original problem, but also avoids problems with my
93087         branch.
93088
93089         It seemed safe to me to submit this separately.
93090
93091 2021-08-23  Tom de Vries  <tdevries@suse.de>
93092
93093         [gdb] Fix 'not in executable format' error message
93094         With trying to load a non-executable file into gdb, we run into PR26880:
93095         ...
93096         $ gdb -q -batch test.c
93097         "0x7ffc87bfc8d0s": not in executable format: \
93098           file format not recognized
93099         ...
93100
93101         The problem is caused by using %ps in combination with the error function
93102         (note that confusingly, it does work in combination with the warning
93103         function).
93104
93105         Fix this by using plain "%s" instead.
93106
93107         Tested on x86_64-linux.
93108
93109         gdb/ChangeLog:
93110
93111         2021-08-22  Tom de Vries  <tdevries@suse.de>
93112
93113                 PR gdb/26880
93114                 * gdb/exec.c (exec_file_attach): Use %s instead of %ps in call to
93115                 error function.
93116
93117         gdb/testsuite/ChangeLog:
93118
93119         2021-08-22  Tom de Vries  <tdevries@suse.de>
93120
93121                 PR gdb/26880
93122                 * gdb.base/non-executable.exp: New file.
93123
93124 2021-08-23  Tom de Vries  <tdevries@suse.de>
93125
93126         [gdb/testsuite] Use compiler-generated instead of gas-generated stabs
93127         The test-case gdb.dwarf2/dw2-ranges.exp is the only one in the gdb testsuite
93128         that uses gas-generated stabs.
93129
93130         While the use seems natural alongside the use of gas-generated dwarf in the
93131         same test-case, there are a few known issues, filed on the gdb side as:
93132         - PR symtab/12497 - "stabs: PIE relocation does not work"
93133         - PR symtab/28221 - "[readnow, stabs] FAIL: gdb.dwarf2/dw2-ranges.exp: \
93134           info line func"
93135         and on the gas side as:
93136         - PR gas/28233 - "[gas, --gstabs] Generate stabs more similar to gcc"
93137
93138         The test-case contains a KFAIL for PR12497, but it's outdated and fails to
93139         trigger.
93140
93141         The intention of the test-case is to test gas-generated dwarf, and using
93142         gcc-generated stabs instead of gas-generated stabs works fine.
93143
93144         Supporting compiler-generated stabs is already a corner-case for gdb, and
93145         there's no current commitment/incentive to support/workaround gas-generated
93146         stabs, which can be considered a corner-case of a corner-case.
93147
93148         Work around these problem by using compiler-generated stabs in the test-case.
93149
93150         Tested on x86_64-linux.
93151
93152         gdb/testsuite/ChangeLog:
93153
93154         2021-08-22  Tom de Vries  <tdevries@suse.de>
93155
93156                 * gdb.dwarf2/dw2-ranges.exp: Use compiler-generated stabs.
93157
93158 2021-08-23  Tom de Vries  <tdevries@suse.de>
93159
93160         [gdb/testsuite] Add dummy start and end CUs in dwarf assembly
93161         Say one compiles a hello.c:
93162         ...
93163         $ gcc -g hello.c
93164         ...
93165
93166         On openSUSE Leap 15.2 and Tumbleweed, the CU for hello.c is typically not the
93167         first in .debug_info, nor the last, due to presence of debug information in
93168         objects for sources like:
93169         - ../sysdeps/x86_64/start.S
93170         - init.c
93171         - ../sysdeps/x86_64/crti.S
93172         - elf-init.c
93173         - ../sysdeps/x86_64/crtn.S.
93174
93175         On other systems, say ubuntu 18.04.5, the CU for hello.c is typically the
93176         first and the last in .debug_info.
93177
93178         This difference has caused me to find some errors in the dwarf assembly
93179         using openSUSE, that didn't show up on other platforms.
93180
93181         Force the same situation on other platforms by adding a dummy start
93182         and end CU.
93183
93184         Tested on x86_64-linux.
93185
93186         gdb/testsuite/ChangeLog:
93187
93188         2021-08-22  Tom de Vries  <tdevries@suse.de>
93189
93190                 PR testsuite/28235
93191                 * lib/dwarf.exp (Dwarf::dummy_cu): New proc.
93192                 (Dwarf::assemble): Add dummy start and end CU.
93193
93194 2021-08-23  Tom de Vries  <tdevries@suse.de>
93195
93196         [gdb/testsuite] Fix dw2-ranges-psym.exp with -readnow
93197         When running test-case gdb.dwarf2/dw2-ranges-psym.exp with target board
93198         -readnow, I run into:
93199         ...
93200         (gdb) file dw2-ranges-psym^M
93201         Reading symbols from dw2-ranges-psym...^M
93202         Expanding full symbols from dw2-ranges-psym...^M
93203         (gdb) set complaints 0^M
93204         (gdb) FAIL: gdb.dwarf2/dw2-ranges-psym.exp: No complaints
93205         ...
93206
93207         The problem is that the regexp expects a gdb prompt immediately after the
93208         "Reading symbols" line.
93209
93210         Fix this by updating the regexp.
93211
93212         Tested on x86_64-linux.
93213
93214         gdb/testsuite/ChangeLog:
93215
93216         2021-08-22  Tom de Vries  <tdevries@suse.de>
93217
93218                 * lib/gdb.exp (gdb_load_no_complaints): Update regexp to allow
93219                 "Expanding full symbols" Line.
93220
93221 2021-08-23  GDB Administrator  <gdbadmin@sourceware.org>
93222
93223         Automatic date update in version.in
93224
93225 2021-08-22  Mike Frysinger  <vapier@gentoo.org>
93226
93227         sim: m32r: add __linux__ hack for non-Linux hosts
93228         The m32r Linux syscall emulation logic assumes the host environment
93229         directly matches -- it's being run on 32-bit little endian Linux.
93230         This breaks building for non-Linux systems, so put all the code in
93231         __linux__ ifdef checks.  This code needs a lot of love to make it
93232         work everywhere, but let's at least unbreak it for non-Linux hosts.
93233
93234 2021-08-22  GDB Administrator  <gdbadmin@sourceware.org>
93235
93236         Automatic date update in version.in
93237
93238 2021-08-21  GDB Administrator  <gdbadmin@sourceware.org>
93239
93240         Automatic date update in version.in
93241
93242 2021-08-20  Mike Frysinger  <vapier@gentoo.org>
93243
93244         sim: nltvals: switch output mode to a directory
93245         In preparation for this script generating more files, change the output
93246         argument to specify a directory.  This drops the stdout behavior, but
93247         since no one really runs this tool directly, it's not a big deal.
93248
93249 2021-08-20  GDB Administrator  <gdbadmin@sourceware.org>
93250
93251         Automatic date update in version.in
93252
93253 2021-08-19  Simon Marchi  <simon.marchi@polymtl.ca>
93254
93255         gdb: use bool in notify_command_param_changed_p and do_set_command
93256         Trivial patch to use bool instead of int.
93257
93258         Change-Id: I9e5f8ee4305272a6671cbaaaf2f0484eff0d1ea5
93259
93260 2021-08-19  H.J. Lu  <hjl.tools@gmail.com>
93261
93262         x86: Put back 3 aborts in OP_E_memory
93263         Put back 3 aborts where invalid lengths should have been filtered out.
93264
93265         gas/
93266
93267                 PR binutils/28247
93268                 * testsuite/gas/i386/bad-bcast.s: Add a comment.
93269
93270         opcodes/
93271
93272                 PR binutils/28247
93273                 * * i386-dis.c (OP_E_memory): Put back 3 aborts.
93274
93275 2021-08-19  H.J. Lu  <hjl.tools@gmail.com>
93276
93277         x86: Avoid abort on invalid broadcast
93278         Print "{bad}" on invalid broadcast instead of abort.
93279
93280         gas/
93281
93282                 PR binutils/28247
93283                 * testsuite/gas/i386/bad-bcast.d: New file.
93284                 * testsuite/gas/i386/bad-bcast.s: Likewise.
93285                 * testsuite/gas/i386/i386.exp: Run bad-bcast.
93286
93287         opcodes/
93288
93289                 PR binutils/28247
93290                 * i386-dis.c (OP_E_memory): Print "{bad}" on invalid broadcast
93291                 instead of abort.
93292
93293 2021-08-19  Aaron Merey  <amerey@redhat.com>
93294
93295         gdb/solib: Refactor scan_dyntag
93296         scan_dyntag is unnecessarily duplicated in solib-svr4.c and solib-dsbt.c.
93297
93298         Move this function to solib.c and rename it to gdb_bfd_scan_elf_dyntag.
93299         Also add it to solib.h so it is included in both solib-svr4 and solib-dsbt.
93300
93301 2021-08-19  GDB Administrator  <gdbadmin@sourceware.org>
93302
93303         Automatic date update in version.in
93304
93305 2021-08-18  Will Schmidt  <will_schmidt@vnet.ibm.com>
93306
93307         [gdb] [rs6000] Add ppc64_linux_gcc_target_options method.
93308         Add a method to set the gcc target options for the ppc64 targets.
93309         This change sets an empty value, which allows the gcc
93310         default values (-mcmodel=medium) be used, instead of -mcmodel=large
93311         which is set by the default_gcc_target_options hook.
93312
93313         [gdb] [rs6000] Add ppc64*_gnu_triplet_regexp methods.
93314         Add methods to set the target triplet so we can
93315         find the proper gcc when our gcc is named of
93316         the form powerpc64{le}-<foo>-gcc or ppc64{le}-<foo>-gcc.
93317
93318 2021-08-18  Alan Modra  <amodra@gmail.com>
93319
93320         Re: as: Replace the removed symbol with the versioned symbol
93321         Some targets, typically embedded without shared libraries, replace the
93322         relocation symbol with a section symbol (see tc_fix_adjustable).
93323         Allow the test to pass for such targets.  Fixes the following.
93324
93325         avr-elf  +FAIL: symver symver16
93326         d10v-elf  +FAIL: symver symver16
93327         dlx-elf  +FAIL: symver symver16
93328         ip2k-elf  +FAIL: symver symver16
93329         m68k-elf  +FAIL: symver symver16
93330         mcore-elf  +FAIL: symver symver16
93331         pj-elf  +FAIL: symver symver16
93332         s12z-elf  +FAIL: symver symver16
93333         visium-elf  +FAIL: symver symver16
93334         z80-elf  +FAIL: symver symver16
93335
93336                 PR gas/28157
93337                 * testsuite/gas/symver/symver16.d: Relax reloc match.
93338
93339 2021-08-18  Alan Modra  <amodra@gmail.com>
93340
93341         [GOLD] PowerPC64 relocation overflow for -Os register save/restore funcs
93342         Fixes a silly mistake in calculating the address of -Os out-of-line
93343         register save/restore function copies.  Copies of these linker defined
93344         functions are added to stub sections when the original (in
93345         target->savres_section) can't be reached.
93346
93347                 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct address
93348                 calculation of out-of-line save/restore function copies.
93349
93350 2021-08-18  Alan Modra  <amodra@gmail.com>
93351
93352         Another ld script backtrack
93353                 * ldgram.y (length_spec): Throw away look-ahead NAME.
93354
93355 2021-08-18  Mike Frysinger  <vapier@gentoo.org>
93356
93357         gdb: fix spacing on CCLD silent rules
93358
93359         sim: nltvals: localize TARGET_<ERRNO> defines
93360         Code should not be using these directly, instead they should be
93361         resolving these dynamically via cb_host_to_target_errno maps.
93362         Fix the Blackfin code and remove the defines out of the header
93363         so no new code can rely on them.
93364
93365 2021-08-18  Mike Frysinger  <vapier@gentoo.org>
93366
93367         sim: rename ChangeLog files to ChangeLog-2021
93368         Now that ChangeLog entries are no longer used for sim patches,
93369         this commit renames all relevant sim ChangeLog to ChangeLog-2021,
93370         similar to what we would do in the context of the "Start of New
93371         Year" procedure.
93372
93373         The purpose of this change is to avoid people merging ChangeLog
93374         entries by mistake when applying existing commits that they are
93375         currently working on.
93376
93377         Also throw in a .gitignore entry to keep people from adding new
93378         ChangeLog files anywhere in the sim tree.
93379
93380 2021-08-18  GDB Administrator  <gdbadmin@sourceware.org>
93381
93382         Automatic date update in version.in
93383
93384 2021-08-17  Simon Marchi  <simon.marchi@polymtl.ca>
93385
93386         gdb: fix thread_step_over_chain_length
93387         If I debug a single-thread program and look at the infrun debug logs, I
93388         see:
93389
93390             [infrun] start_step_over: stealing global queue of threads to step, length = 2
93391
93392         That makes no sense... turns out there's a buglet in
93393         thread_step_over_chain_length, "num" should be initialized to 0.  I
93394         think this bug is a leftover from an earlier version of the code (not
93395         merged upstream) that manually walked the list, where the first item was
93396         implicitly counted (hence the 1).
93397
93398         Change-Id: I0af03aa93509aed36528be5076894dc156a0b5ce
93399
93400 2021-08-17  Shahab Vahedi  <shahab@synopsys.com>
93401
93402         opcodes: Fix the auxiliary register numbers for ARC HS
93403         The numbers for the auxiliary registers "tlbindex" and
93404         "tlbcommand" of ARCv2HS are incorrect.  This patch makes
93405         the following changes to correct that error.
93406
93407          ,------------.-----------------.---------------.
93408          | aux. reg.  | old (incorrect) | new (correct) |
93409          |------------+-----------------+---------------|
93410          | tlbindex   |      0x463      |     0x464     |
93411          | tlbcommand |      0x464      |     0x465     |
93412          `------------^-----------------^---------------'
93413
93414         opcodes/
93415         2021-08-17  Shahab Vahedi <shahab@synopsys.com>
93416
93417                 * arc-regs.h (DEF): Fix the register numbers.
93418
93419 2021-08-17  H.J. Lu  <hjl.tools@gmail.com>
93420
93421         gdb: Don't assume r_ldsomap when r_version > 1 on Linux
93422         The r_ldsomap field is specific to Solaris (part of librtld_db), and
93423         should never be accessed for Linux.  glibc is planning to add a field
93424         to support multiple namespaces.  But there will be no r_ldsomap when
93425         r_version is bumped to 2.  Add linux_[ilp32|lp64]_fetch_link_map_offsets
93426         to set r_ldsomap_offset to -1 and use them for Linux targets.
93427
93428         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28236
93429
93430 2021-08-17  H.J. Lu  <hjl.tools@gmail.com>
93431
93432         gdbserver: Check r_version < 1 for Linux debugger interface
93433         Update gdbserver to check r_version < 1 instead of r_version != 1 so
93434         that r_version can be bumped for a new field in the glibc debugger
93435         interface to support multiple namespaces.  Since so far, the gdbserver
93436         only reads fields defined for r_version == 1, it is compatible with
93437         r_version >= 1.
93438
93439         All future glibc debugger interface changes will be backward compatible.
93440         If there is ever the need for backward incompatible change to the glibc
93441         debugger interface, a new DT_XXX element will be provided to access the
93442         new incompatible interface.
93443
93444         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11839
93445
93446 2021-08-17  Andrea Corallo  <andrea.corallo@arm.com>
93447
93448         PATCH [4/4] arm: Add Tag_PACRET_use build attribute
93449         bfd/
93450         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93451
93452                 * elf32-arm.c (elf32_arm_merge_eabi_attributes): Add
93453                 'Tag_PACRET_use' case.
93454
93455         binutils/
93456         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93457
93458                 * readelf.c (arm_attr_tag_PAC_extension): Declare.
93459                 (arm_attr_public_tags): Add 'PAC_extension' lookup.
93460
93461         elfcpp/
93462         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93463
93464                 * arm.h: Define 'Tag_PACRET_use' enum.
93465
93466         gas/
93467         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93468
93469                 * config/tc-arm.c (arm_convert_symbolic_attribute): Add
93470                 'Tag_PACRET_use' to the attribute_table.
93471
93472         include/
93473         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93474
93475                 * elf/arm.h (elf_arm_reloc_type): Add 'Tag_PACRET_use'.
93476
93477 2021-08-17  Andrea Corallo  <andrea.corallo@arm.com>
93478
93479         PATCH [3/4] arm: Add Tag_BTI_use build attribute
93480         bfd/
93481         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93482
93483                 * elf32-arm.c (elf32_arm_merge_eabi_attributes): Add
93484                 'Tag_BTI_use' case.
93485
93486         binutils/
93487         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93488
93489                 * readelf.c (arm_attr_tag_PAC_extension): Declare.
93490                 (arm_attr_public_tags): Add 'PAC_extension' lookup.
93491
93492         elfcpp/
93493         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93494
93495                 * arm.h: Define 'Tag_BTI_use' enum.
93496
93497         gas/
93498         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93499
93500                 * config/tc-arm.c (arm_convert_symbolic_attribute): Add
93501                 'Tag_BTI_use' to the attribute_table.
93502
93503         include/
93504         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93505
93506                 * elf/arm.h (elf_arm_reloc_type): Add 'Tag_BTI_use'.
93507
93508 2021-08-17  Andrea Corallo  <andrea.corallo@arm.com>
93509
93510         PATCH [2/4] arm: Add Tag_BTI_extension build attribute
93511         bfd/
93512         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93513
93514                 * elf32-arm.c (elf32_arm_merge_eabi_attributes): Add
93515                 'Tag_BTI_extension' case.
93516
93517         binutils/
93518         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93519
93520                 * readelf.c (arm_attr_tag_PAC_extension): Declare.
93521                 (arm_attr_public_tags): Add 'PAC_extension' lookup.
93522
93523         elfcpp/
93524         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93525
93526                 * arm.h: Define 'Tag_BTI_extension' enum.
93527
93528         gas/
93529         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93530
93531                 * config/tc-arm.c (arm_convert_symbolic_attribute): Add
93532                 'Tag_BTI_extension' to the attribute_table.
93533
93534         include/
93535         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93536
93537                 * elf/arm.h (elf_arm_reloc_type): Add 'Tag_BTI_extension'.
93538
93539 2021-08-17  Andrea Corallo  <andrea.corallo@arm.com>
93540
93541         PATCH [1/4] arm: Add Tag_PAC_extension build attribute
93542         bfd/
93543         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93544
93545                 * elf32-arm.c (elf32_arm_merge_eabi_attributes): Add
93546                 'Tag_PAC_extension' case.
93547
93548         binutils/
93549         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93550
93551                 * readelf.c (arm_attr_tag_PAC_extension): Declare.
93552                 (arm_attr_public_tags): Add 'PAC_extension' lookup.
93553
93554         elfcpp/
93555         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93556
93557                 * arm.h: Define 'Tag_PAC_extension' enum.
93558
93559         gas/
93560         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93561
93562                 * config/tc-arm.c (arm_convert_symbolic_attribute): Add
93563                 'Tag_PAC_extension' to the attribute_table.
93564
93565         include/
93566         2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>
93567
93568                 * elf/arm.h (elf_arm_reloc_type): Add 'Tag_PAC_extension'.
93569
93570 2021-08-17  H.J. Lu  <hjl.tools@gmail.com>
93571
93572         x86: Always run fp tests
93573         Always run fp tests since the size of .tfloat, .ds.x, .dc.x and .dcb.x
93574         directive outputs is always 10 bytes.  There is no need for fp-elf32 nor
93575         fp-elf64.
93576
93577                 PR gas/28230
93578                 * testsuite/gas/i386/fp-elf32.d: Removed.
93579                 * testsuite/gas/i386/fp-elf64.d: Likewise.
93580                 * testsuite/gas/i386/fp.s: Remove NO_TFLOAT_PADDING codes.
93581                 * testsuite/gas/i386/i386.exp: Don't run fp-elf32 nor fp-elf64.
93582                 Always run fp.
93583
93584 2021-08-17  GDB Administrator  <gdbadmin@sourceware.org>
93585
93586         Automatic date update in version.in
93587
93588 2021-08-16  H.J. Lu  <hjl.tools@gmail.com>
93589
93590         x86: Don't pad .tfloat directive output
93591         .tfloat output should always be 10 bytes without padding, independent
93592         of psABIs.  In glibc, x86 assembly codes expect 10-byte .tfloat output.
93593         This also reduces .ds.x output and .tfloat output with hex input from
93594         12 bytes to 10 bytes to match .tfloat output.
93595
93596                 PR gas/28230
93597                 * NEWS: Mention changes of .ds.x output and .tfloat output with
93598                 hex input.
93599                 * config/tc-i386.c (x86_tfloat_pad): Removed.
93600                 * config/tc-i386.h (X_PRECISION_PAD): Changed to 0.
93601                 (x86_tfloat_pad): Removed.
93602                 * testsuite/gas/i386/fp.s: If NO_TFLOAT_PADDING isn't defined,
93603                 add explicit paddings after .tfloat, .ds.x, .dc.x and .dcb.x
93604                 directives.
93605                 * testsuite/gas/i386/i386.exp (ASFLAGS): Append
93606                 "--defsym NO_TFLOAT_PADDING=1" when running the fp test.
93607
93608 2021-08-16  Tom Tromey  <tromey@adacore.com>
93609
93610         Fix register regression in DWARF evaluator
93611         On an internal test case, using an arm-elf target, commit ba5bc3e5a92
93612         ("Make DWARF evaluator return a single struct value") causes a
93613         regression.  (It doesn't happen for any of the other cross targets
93614         that I test when importing upstream gdb.)
93615
93616         I don't know if there's an upstream gdb test case showing the same
93617         problem... I can only really run native tests with dejagnu AFAIK.
93618
93619         The failure manifests like this:
93620
93621             Breakpoint 1, file_1.export_1 (param_1=<error reading variable: Unable to access DWARF register number 64>, str=...) at [...]/file_1.adb:5
93622
93623         Whereas when it works it looks like:
93624
93625             Breakpoint 1, file_1.export_1 (param_1=99.0, str=...) at [...]/file_1.adb:5
93626
93627         The difference is that the new code uses the passed-in gdbarch,
93628         whereas the old code used the frame's gdbarch, when handling
93629         DWARF_VALUE_REGISTER.
93630
93631         This patch restores the use of the frame's arch.
93632
93633 2021-08-16  Tom Tromey  <tromey@adacore.com>
93634
93635         Fix Ada regression due to DWARF expression series
93636         Commit 0579205aec4 ("Simplify dwarf_expr_context class interface")
93637         caused a regression in the internal AdaCore test suite.  I didn't try
93638         to reproduce this with the GDB test suite, but the test is identical
93639         to gdb.dwarf2/dynarr-ptr.exp.
93640
93641         The problem is that this change:
93642
93643                 case DW_OP_push_object_address:
93644                   /* Return the address of the object we are currently observing.  */
93645         -         if (this->data_view.data () == nullptr
93646         -             && this->obj_address == 0)
93647         +         if (this->m_addr_info == nullptr)
93648
93649         ... slightly changes the logic here.  In particular, it's possible for
93650         the caller to pass in a non-NULL m_addr_info, but one that looks like:
93651
93652             (top) p *this.m_addr_info
93653             $15 = {
93654               type = 0x29b7a70,
93655               valaddr = {
93656                 m_array = 0x0,
93657                 m_size = 0
93658               },
93659               addr = 0,
93660               next = 0x0
93661             }
93662
93663         In this case, an additional check is needed.  With the current code,
93664         what happens instead is that the computation computes an incorrect
93665         address -- but one that does not fail in read_memory, due to the
93666         precise memory map of the embedded target in question.
93667
93668         This patch restores the old logic.
93669
93670 2021-08-16  Patrick Monnerat  <patrick@monnerat.net>
93671
93672         Notify observer of breakpoint auto-disabling
93673         As breakpoint_modified observer is currently notified upon breakpoint stop
93674         before handling auto-disabling when enable count is reached, the observer
93675         is never notified of the disabling.
93676
93677         The problem affects:
93678         - The MI interpreter enabled= value when reporting =breakpoint-modified
93679         - A Python event handler for breakpoint_modified using the "enabled"
93680           member of its parameter
93681         - insight: breakpoint GUI window is not properly updated upon auto-disable
93682
93683         This patch moves the observer notification after the auto-disabling
93684         code and implements corresponding tests for the MI and Python cases.
93685
93686         Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=23336
93687
93688         Change-Id: I0c50df4789334071e5390cb46b3ca0d4a7f83c61
93689
93690 2021-08-16  H.J. Lu  <hjl.tools@gmail.com>
93691
93692         as: Replace the removed symbol with the versioned symbol
93693         When a symbol removed by .symver is used in relocation and there is one
93694         and only one versioned symbol, don't remove the symbol.  Instead, mark
93695         it to be removed and replace the removed symbol used in relocation with
93696         the versioned symbol before generating relocation.
93697
93698                 PR gas/28157
93699                 * symbols.c (symbol_flags): Add removed.
93700                 (symbol_entry_find): Updated.
93701                 (symbol_mark_removed): New function.
93702                 (symbol_removed_p): Likewise.
93703                 * symbols.h (symbol_mark_removed): New prototype.
93704                 (symbol_removed_p): Likewise.
93705                 * write.c (write_relocs): Call obj_fixup_removed_symbol on
93706                 removed fixp->fx_addsy and fixp->fx_subsy if defined.
93707                 (set_symtab): Don't add a symbol if symbol_removed_p returns true.
93708                 * config/obj-elf.c (elf_frob_symbol):  Don't remove the symbol
93709                 if it is used on relocation.  Instead, mark it as to be removed
93710                 and issue an error if the symbol has more than one versioned name.
93711                 (elf_fixup_removed_symbol): New function.
93712                 * config/obj-elf.h (elf_fixup_removed_symbol): New prototype.
93713                 (obj_fixup_removed_symbol): New.
93714                 * testsuite/gas/symver/symver11.d: Updated expected error
93715                 message.
93716                 * testsuite/gas/symver/symver16.d: New file.
93717                 * testsuite/gas/symver/symver16.s: Likewise.
93718
93719 2021-08-16  GDB Administrator  <gdbadmin@sourceware.org>
93720
93721         Automatic date update in version.in
93722
93723 2021-08-15  GDB Administrator  <gdbadmin@sourceware.org>
93724
93725         Automatic date update in version.in
93726
93727 2021-08-14  Alan Modra  <amodra@gmail.com>
93728
93729         ld script fill pattern expression
93730         It turns out we do need to backtrack when parsing after all.  The
93731         fill_opt component in the section rule swiches to EXPRESSION and back
93732         to SCRIPT, and to find the end of an expression it is necessary to
93733         look ahead one token.
93734
93735                 * ldgram.y (section): Throw away lookahead NAME token.
93736                 (overlay_section): Likewise.
93737                 * testsuite/ld-elf/overlay.t: Add fill pattern on overlays.
93738                 Test fill pattern before stupidly named normal sections too,
93739                 and before /DISCARD/.
93740
93741 2021-08-14  GDB Administrator  <gdbadmin@sourceware.org>
93742
93743         Automatic date update in version.in
93744
93745 2021-08-13  Alan Modra  <amodra@gmail.com>
93746
93747         ld lexer tidy, possibly break the world
93748         This tidies the states in which ld lexer rules are enabled.
93749         This change will quite likely trip over issues similar to those
93750         mentioned in the new ldlex.l comments, so please test it out.
93751
93752                 * ldgram.y (wildcard_name): Remove now unnecessary components.
93753                 * ldlex.l: Restrict many rules' states.  Remove -l expression
93754                 state rule.  Comment on lookahead state madness and need for
93755                 /DISCARD/ in expression state.
93756
93757 2021-08-13  Alan Modra  <amodra@gmail.com>
93758
93759         ld script lower-case absolute and sizeof_headers
93760         I think these happened by accident, so let's see what breaks if they
93761         are removed.
93762
93763                 * ldlex.l: Remove lower case "absolute" and "sizeof_headers"
93764                 in non-mri mode.
93765                 * ld.texi: Remove sizeof_headers index.
93766                 * testsuite/ld-mmix/mmohdr1.ld: Use SIZEOF_HEADERS.
93767
93768 2021-08-13  Alan Modra  <amodra@gmail.com>
93769
93770         tidy mri script extern
93771         MRI mode generally doesn't flip lexer states, so let's make MRI mode
93772         "extern" not do so either.
93773
93774                 * ldgram.y (extern_name_list): Don't change lex state here.
93775                 (ifile_p1): Change state here on EXTERN instead.
93776
93777 2021-08-13  Alan Modra  <amodra@gmail.com>
93778
93779         Re: PR28217, Syntax error when memory region contains a hyphen
93780         I discovered some more errors when tightening up the lexer rules.
93781         Just because we INCLUDE a file doesn't mean we've switched states.
93782
93783                 PR 28217
93784                 * ldgram.y (statement): Don't switch lexer state on INCLUDE.
93785                 (mri_script_command, ifile_p1, memory_spec, section): Likewise.
93786
93787 2021-08-13  Lifang Xia  <lifang_xia@c-sky.com>
93788
93789         PR28168: [CSKY] Fix stack overflow in disassembler
93790         PR 28168:
93791         Stack overflow with a large float. %f is not a goot choice for this.
93792         %f should be replaced with %.7g.
93793
93794         gas/
93795                 * testsuite/gas/csky/pr28168.d: New testcase for PR 28168.
93796                 * testsuite/gas/csky/pr28168.s: Likewise.
93797                 * testsuite/gas/csky/v2_float_part2.d: Following the new format.
93798                 * opcodes/csky-dis.c (csky_output_operand): %.7g replaces %f.
93799
93800 2021-08-13  Alan Modra  <amodra@gmail.com>
93801
93802         PR28217, Syntax error when memory region contains a hyphen
93803         The saga of commit 40726f16a8d7 continues.  This attacks the problem
93804         of switching between SCRIPT and EXPRESSION state lexing by removing
93805         the need to do so for phdrs like ":text".  Instead {WILDCHAR}*
93806         matching, the reason why ":text" lexed as one token, is restricted to
93807         within the braces of a section or overlay statement.  The new WILD
93808         lexer state is switched at the non-optional brace tokens, so
93809         ldlex_backup is no longer needed.  I've also removed the BOTH state,
93810         which doesn't seem to be needed any more.  Besides rules involving
93811         error reporting, there was just one place where SCRIPT appeared
93812         without BOTH, the {WILDCHAR}* rule, three where BOTH appears without
93813         SCRIPT for tokens that only need EXPRESSION state, and two where BOTH
93814         appears alongside INPUT_LIST.  (Since I'm editing the wild and
93815         filename rules, removing BOTH and adding WILD can also be seen as
93816         renaming the old BOTH state to SCRIPT and renaming the old SCRIPT
93817         state to WILD with a reduced scope.)
93818
93819         As a followup, I'll look at removing EXPRESSION state from some lexer
93820         rules that no longer need it due to this cleanup.
93821
93822                 PR 28217
93823                 * ldgram.y (exp <ORIGIN, LENGTH>): Use paren_script_name.
93824                 (section): Parse within braces of section in wild mode, and
93825                 after brace back in script mode.  Remove ldlex_backup call.
93826                 Similarly for OVERLAY.
93827                 (overlay_section): Similarly.
93828                 (script_file): Replace ldlex_both with ldlex_script.
93829                 * ldlex.h (ldlex_wild): Declare.
93830                 (ldlex_both): Delete.
93831                 * ldlex.l (BOTH): Delete.  Remove state from all rules.
93832                 (WILD): New state.  Enable many tokens in this state.
93833                 Enable filename match in SCRIPT mode.  Enable WILDCHAR match
93834                 in WILD state, disable in SCRIPT mode.
93835                 (ldlex_wild): New function.
93836                 * ldfile.c (ldfile_try_open_bfd): Replace ldlex_both call with
93837                 ldlex_script.
93838
93839 2021-08-13  Alan Modra  <amodra@gmail.com>
93840
93841         ns32k configury
93842         Since ns32k-netbsd is as yet not removed, just marked obsolete,
93843         the target should still be accepted with --enable-obsolete.
93844
93845         I also enabled ns32k-openbsd in ld since there doesn't seem to be a
93846         good reason why that target is not supported there but is elsewhere.
93847
93848         bfd/
93849                 * config.bfd: Allow ns32k-netbsd.
93850         ld/
93851                 * configure.tgt: Allow ns32k-openbsd.
93852
93853 2021-08-13  GDB Administrator  <gdbadmin@sourceware.org>
93854
93855         Automatic date update in version.in
93856
93857 2021-08-13  Lancelot SIX  <lsix@lancelotsix.com>
93858
93859         gdb: riscv_scan_prologue: handle LD and LW instructions
93860         While working on the testsuite, I ended up noticing that GDB fails to
93861         produce a full backtrace from a thread waiting in pthread_join.  When
93862         selecting the waiting thread and using the 'bt' command, the following
93863         result can be observed:
93864
93865                 (gdb) bt
93866                 #0  0x0000003ff7fccd20 in __futex_abstimed_wait_common64 () from /lib/riscv64-linux-gnu/libpthread.so.0
93867                 #1  0x0000003ff7fc43da in __pthread_clockjoin_ex () from /lib/riscv64-linux-gnu/libpthread.so.0
93868                 Backtrace stopped: frame did not save the PC
93869
93870         On my platform, I do not have debug symbols for glibc, so I need to rely
93871         on prologue analysis in order to unwind stack.
93872
93873         Here is what the function prologue looks like:
93874
93875                 (gdb) disassemble __pthread_clockjoin_ex
93876                 Dump of assembler code for function __pthread_clockjoin_ex:
93877                    0x0000003ff7fc42de <+0>:     addi    sp,sp,-144
93878                    0x0000003ff7fc42e0 <+2>:     sd      s5,88(sp)
93879                    0x0000003ff7fc42e2 <+4>:     auipc   s5,0xd
93880                    0x0000003ff7fc42e6 <+8>:     ld      s5,-2(s5) # 0x3ff7fd12e0
93881                    0x0000003ff7fc42ea <+12>:    ld      a5,0(s5)
93882                    0x0000003ff7fc42ee <+16>:    sd      ra,136(sp)
93883                    0x0000003ff7fc42f0 <+18>:    sd      s0,128(sp)
93884                    0x0000003ff7fc42f2 <+20>:    sd      s1,120(sp)
93885                    0x0000003ff7fc42f4 <+22>:    sd      s2,112(sp)
93886                    0x0000003ff7fc42f6 <+24>:    sd      s3,104(sp)
93887                    0x0000003ff7fc42f8 <+26>:    sd      s4,96(sp)
93888                    0x0000003ff7fc42fa <+28>:    sd      s6,80(sp)
93889                    0x0000003ff7fc42fc <+30>:    sd      s7,72(sp)
93890                    0x0000003ff7fc42fe <+32>:    sd      s8,64(sp)
93891                    0x0000003ff7fc4300 <+34>:    sd      s9,56(sp)
93892                    0x0000003ff7fc4302 <+36>:    sd      a5,40(sp)
93893
93894         As far as prologue analysis is concerned, the most interesting part is
93895         done at address 0x0000003ff7fc42ee (<+16>): 'sd ra,136(sp)'. This stores
93896         the RA (return address) register on the stack, which is the information
93897         we are looking for in order to identify the caller.
93898
93899         In the current implementation of the prologue scanner, GDB stops when
93900         hitting 0x0000003ff7fc42e6 (<+8>) because it does not know what to do
93901         with the 'ld' instruction.  GDB thinks it reached the end of the
93902         prologue but have not yet reached the important part, which explain
93903         GDB's inability to unwind past this point.
93904
93905         The section of the prologue starting at <+4> until <+12> is used to load
93906         the stack canary[1], which will then be placed on the stack at <+36> at
93907         the end of the prologue.
93908
93909         In order to have the prologue properly handled, this commit proposes to
93910         add support for the ld instruction in the RISC-V prologue scanner.
93911         I guess riscv32 would use lw in such situation so this patch also adds
93912         support for this instruction.
93913
93914         With this patch applied, gdb is now able to unwind past pthread_join:
93915
93916                 (gdb) bt
93917                 #0  0x0000003ff7fccd20 in __futex_abstimed_wait_common64 () from /lib/riscv64-linux-gnu/libpthread.so.0
93918                 #1  0x0000003ff7fc43da in __pthread_clockjoin_ex () from /lib/riscv64-linux-gnu/libpthread.so.0
93919                 #2  0x0000002aaaaaa88e in bar() ()
93920                 #3  0x0000002aaaaaa8c4 in foo() ()
93921                 #4  0x0000002aaaaaa8da in main ()
93922
93923         I have had a look to see if I could reproduce this easily, but in my
93924         simple testcases using '-fstack-protector-all', the canary is loaded
93925         after the RA register is saved.  I do not have a reliable way of
93926         generating a prologue similar to the problematic one so I forged one
93927         instead.
93928
93929         The testsuite have been run on riscv64 ubuntu 21.01 with no regression
93930         observed.
93931
93932         [1] https://en.wikipedia.org/wiki/Buffer_overflow_protection#Canaries
93933
93934 2021-08-12  Tom Tromey  <tromey@adacore.com>
93935
93936         Update documentation to mention Pygments
93937         Philippe Blain pointed out that the gdb documentation does not mention
93938         that Pygments may be used for source highlighting.  This patch updates
93939         the docs to reflect how highlighting is actually done.
93940
93941 2021-08-12  Simon Marchi  <simon.marchi@polymtl.ca>
93942
93943         gdb: make gdbarch_printable_names return a vector
93944         I noticed that gdbarch_selftest::operator() leaked the value returned by
93945         gdbarch_printable_names.  Make gdbarch_printable_names return an
93946         std::vector and update callers.  That makes it easier for everyone
93947         involved, less manual memory management.
93948
93949         Change-Id: Ia8fc028bdb91f787410cca34f10bf3c5a6da1498
93950
93951 2021-08-12  Carl Love  <cel@us.ibm.com>
93952
93953         Improve forward progress test in python.exp
93954         The test steps into func2 and than does an up to get back to the previous
93955         frame. The test checks that the line number you are at after the up command
93956         is greater than the line where the function was called from. The
93957         assembly/codegen for the powerpc target includes a NOP after the
93958         branch-link.
93959
93960         func2 (); /* Break at func2 call site. /
93961         10000694: 59 00 00 48 bl 100006ec
93962         10000698: 00 00 00 60 nop
93963         return 0; / Break to end. */
93964         1000069c: 00 00 20 39 li r9,0
93965
93966         The PC at the instruction following the branch-link is 0x10000698 which
93967         GDB.find_pc_line() maps to the same line number as the bl instruction.
93968         GDB did move past the branch-link location thus making forward progress.
93969
93970         The following proposed fix adds an additional PC check to see if forward
93971         progress was made.  The line test is changed from greater than to greater
93972         than or equal.
93973
93974 2021-08-12  Jiangshuai Li  <jiangshuai_li@c-sky.com>
93975
93976         gdb:csky rm tdesc_has_registers in csky_register_name
93977         As CSKY arch has not parsed target-description.xml in csky_gdbarch_init,
93978         when a remote server, like csky-qemu or gdbserver, send a target-description.xml
93979         to gdb, tdesc_has_registers will return ture, but tdesc_register_name (gdbarch, 0)
93980         will return NULL, so a cmd "info registers r0" will not work.
93981
93982         Function of parsing target-description.xml will be add later for CSKY arch,
93983         now it is temporarily removed to allow me to do other supported tests.
93984
93985         2021-07-15 Jiangshuai Li  <jiangshuai_li@c-sky.com>
93986
93987                     * csky-tdep.c : not using tdesc funtions in csky_register_name
93988
93989 2021-08-12  Alan Modra  <amodra@gmail.com>
93990
93991         Re: gas: support NaN flavors
93992         Fixes tic4x-coff FAIL: simple FP constants
93993
93994                 * testsuite/gas/all/float.s: Make NaN tests conditional on hasnan.
93995                 * testsuite/gas/all/gas.exp: Define hasnan.
93996
93997 2021-08-12  GDB Administrator  <gdbadmin@sourceware.org>
93998
93999         Automatic date update in version.in
94000
94001 2021-08-11  H.J. Lu  <hjl.tools@gmail.com>
94002
94003         ld: Update the pass and fail strings of PR ld/28138 test
94004                 PR ld/28138
94005                 * testsuite/ld-plugin/lto.exp: Update the pass and fail strings
94006                 of PR ld/28138 test to indicate which part of the test passed
94007                 and failed.
94008
94009 2021-08-11  Darius Galis  <darius.galis@cyberthorstudios.com>
94010
94011         Fix a typo in the RX asse,bler.  The Double-precision floating-point exception handling control register name is DECNT not DCENT.
94012                 * config/rx-parse.y (DECNT): Fixed typo.
94013                 * testsuite/gas/rx/dpopm.sm (DECNT): Fixed typo.
94014                 * testsuite/gas/rx/dpushm.sm (DECNT): Fixed typo.
94015                 * testsuite/gas/rx/macros.inc (DECNT): Fixed typo.
94016
94017 2021-08-11  Nick Clifton  <nickc@redhat.com>
94018
94019         Fix an internal error in the CSKY assembler when asked to resolve an overlarge constant.
94020                 PR 28215
94021                 * config/tc-csky.c (md_apply_fix): Correctly handle a fixup that
94022                 involves an overlarge constant.
94023
94024 2021-08-11  Luis Machado  <luis.machado@linaro.org>
94025
94026         Add 3 new PAC-related ARM note types
94027         The following patch synchronizes includes/objdump/readelf with the Linux
94028         Kernel in terms of ARM regset notes.
94029
94030         We're currently missing 3 of them:
94031
94032         NT_ARM_PACA_KEYS
94033         NT_ARM_PACG_KEYS
94034         NT_ARM_PAC_ENABLED_KEYS
94035
94036         We don't need GDB to bother with this at the moment, so this doesn't update
94037         bfd/elf.c. If needed, we can do it in the future.
94038
94039         binutils/
94040
94041                 * readelf.c (get_note_type): Handle new ARM PAC notes.
94042
94043         include/elf/
94044
94045                 * common.h (NT_ARM_PACA_KEYS, NT_ARM_PACG_KEYS)
94046                 (NT_ARM_PAC_ENABLED_KEYS): New constants.
94047
94048 2021-08-11  Nick Clifton  <nickc@redhat.com>
94049
94050         Updated Portuguese translation for the binutils sub-directory.
94051
94052 2021-08-11  John Ericson  <git@JohnEricson.me>
94053
94054         Deprecate a.out support for NetBSD targets.
94055         As discussed previously, a.out support is now quite deprecated, and in
94056         some cases removed, in both Binutils itself and NetBSD, so this legacy
94057         default makes little sense. `netbsdelf*` and `netbsdaout*` still work
94058         allowing the user to be explicit about there choice. Additionally, the
94059         configure script warns about the change as Nick Clifton requested.
94060
94061         One possible concern was the status of NetBSD on NS32K, where only a.out
94062         was supported. But per [1] NetBSD has removed support, and if it were to
94063         come back, it would be with ELF. The binutils implementation is
94064         therefore marked obsolete, per the instructions in the last message.
94065
94066         With that patch and this one applied, I have confirmed the following:
94067
94068         --target=i686-unknown-netbsd
94069         --target=i686-unknown-netbsdelf
94070           builds completely
94071
94072         --target=i686-unknown-netbsdaout
94073           properly fails because target is deprecated.
94074
94075         --target=vax-unknown-netbsdaout builds completely except for gas, where
94076         the target is deprecated.
94077
94078         [1]: https://mail-index.netbsd.org/tech-toolchain/2021/07/19/msg004025.html
94079         ---
94080          bfd/config.bfd                             | 43 +++++++++++++--------
94081          bfd/configure.ac                           |  5 +--
94082          binutils/testsuite/binutils-all/nm.exp     |  2 +-
94083          binutils/testsuite/lib/binutils-common.exp |  7 +---
94084          config/picflag.m4                          |  4 +-
94085          gas/configure.tgt                          |  9 +++--
94086          gas/testsuite/gas/arm/blx-bl-convert.d     |  2 +-
94087          gas/testsuite/gas/arm/blx-local-thumb.d    |  2 +-
94088          gas/testsuite/gas/sh/basic.exp             |  2 +-
94089          gdb/configure.host                         | 34 +++++++----------
94090          gdb/configure.tgt                          |  2 +-
94091          gdb/testsuite/gdb.asm/asm-source.exp       |  6 +--
94092          intl/configure                             |  2 +-
94093          ld/configure.tgt                           | 44 +++++++++++-----------
94094          ld/testsuite/ld-arm/arm-elf.exp            |  4 +-
94095          ld/testsuite/ld-elf/elf.exp                |  2 +-
94096          ld/testsuite/ld-elf/shared.exp             |  4 +-
94097          libiberty/configure                        |  4 +-
94098
94099 2021-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
94100
94101         gdb: don't print backtrace when dumping core after an internal error
94102         Currently, when GDB hits an internal error, and the user selects to
94103         dump core, the recently added feature to write a backtrace to the
94104         console will kick in, and print a backtrace as well as dumping the
94105         core.
94106
94107         This was certainly not my intention when adding the backtrace on fatal
94108         signal functionality, this feature was intended to produce a backtrace
94109         when GDB crashes due to some fatal signal, internal errors should have
94110         continued to behave as they did before, unchanged.
94111
94112         In this commit I set the signal disposition of SIGABRT back to SIG_DFL
94113         just prior to the call to abort() that GDB uses to trigger the core
94114         dump, this prevents GDB reaching the code that writes the backtrace to
94115         the console.
94116
94117         I've also added a test that checks we don't see a backtrace on the
94118         console after an internal error.
94119
94120 2021-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
94121
94122         gdb: register SIGBUS, SIGFPE, and SIGABRT handlers
94123         Register handlers for SIGBUS, SIGFPE, and SIGABRT.  All of these
94124         signals are setup as fatal signals that will cause GDB to terminate.
94125         However, by passing these signals through the handle_fatal_signal
94126         function, a user can arrange to see a backtrace when GDB
94127         terminates (see maint set backtrace-on-fatal-signal).
94128
94129         In normal use of GDB there should be no user visible changes after
94130         this commit.  Only if GDB terminates with one of the above signals
94131         will GDB change slightly, potentially printing a backtrace before
94132         aborting.
94133
94134         I've added new tests for SIGFPE, SIGBUS, and SIGABRT.
94135
94136 2021-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
94137
94138         gdb: print backtrace on fatal SIGSEGV
94139         This commit adds a new maintenance feature, the ability to print
94140         a (limited) backtrace if GDB dies due to a fatal signal.
94141
94142         The backtrace is produced using the backtrace and backtrace_symbols_fd
94143         functions which are declared in the execinfo.h header, and both of
94144         which are async signal safe.  A configure check has been added to
94145         check for these features, if they are not available then the new code
94146         is not compiled into GDB and the backtrace will not be printed.
94147
94148         The motivation for this new feature is to aid in debugging GDB in
94149         situations where GDB has crashed at a users site, but the user is
94150         reluctant to share core files, possibly due to concerns about what
94151         might be in the memory image within the core file.  Such a user might
94152         be happy to share a simple backtrace that was written to stderr.
94153
94154         The production of the backtrace is on by default, but can switched off
94155         using the new commands:
94156
94157           maintenance set backtrace-on-fatal-signal on|off
94158           maintenance show backtrace-on-fatal-signal
94159
94160         Right now, I have hooked this feature in to GDB's existing handling of
94161         SIGSEGV only, but this will be extended to more signals in a later
94162         commit.
94163
94164         One additional change I have made in this commit is that, when we
94165         decide GDB should terminate due to the fatal signal, we now
94166         raise the same fatal signal rather than raising SIGABRT.
94167
94168         Currently, this is only effecting our handling of SIGSEGV.  So,
94169         previously, if GDB hit a SEGV then we would terminate GDB with a
94170         SIGABRT.  After this commit we will terminate GDB with a SIGSEGV.
94171
94172         This feels like an improvement to me, we should still get a core dump,
94173         but in many shells, the user will see a more specific message once GDB
94174         exits, in bash for example "Segmentation fault" rather than "Aborted".
94175
94176         Finally then, here is an example of the output a user would see if GDB
94177         should hit an internal SIGSEGV:
94178
94179           Fatal signal: Segmentation fault
94180           ----- Backtrace -----
94181           ./gdb/gdb[0x8078e6]
94182           ./gdb/gdb[0x807b20]
94183           /lib64/libpthread.so.0(+0x14b20)[0x7f6648c92b20]
94184           /lib64/libc.so.6(__poll+0x4f)[0x7f66484d3a5f]
94185           ./gdb/gdb[0x1540f4c]
94186           ./gdb/gdb[0x154034a]
94187           ./gdb/gdb[0x9b002d]
94188           ./gdb/gdb[0x9b014d]
94189           ./gdb/gdb[0x9b1aa6]
94190           ./gdb/gdb[0x9b1b0c]
94191           ./gdb/gdb[0x41756d]
94192           /lib64/libc.so.6(__libc_start_main+0xf3)[0x7f66484041a3]
94193           ./gdb/gdb[0x41746e]
94194           ---------------------
94195           A fatal error internal to GDB has been detected, further
94196           debugging is not possible.  GDB will now terminate.
94197
94198           This is a bug, please report it.  For instructions, see:
94199           <https://www.gnu.org/software/gdb/bugs/>.
94200
94201           Segmentation fault (core dumped)
94202
94203         It is disappointing that backtrace_symbols_fd does not actually map
94204         the addresses back to symbols, this appears, in part, to be due to GDB
94205         not being built with -rdynamic as the manual page for
94206         backtrace_symbols_fd suggests, however, even when I do add -rdynamic
94207         to the build of GDB I only see symbols for some addresses.
94208
94209         We could potentially look at alternative libraries to provide the
94210         backtrace (e.g. libunwind) however, the solution presented here, which
94211         is available as part of glibc is probably a good baseline from which
94212         we might improve things in future.
94213
94214 2021-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
94215
94216         gdb: rename async_init_signals to gdb_init_signals
94217         The async_init_signals has, for some time, dealt with async and sync
94218         signals, so removing the async prefix makes sense I think.
94219
94220         Additionally, as pointed out by Pedro:
94221
94222           .....
94223
94224         The comments relating to SIGTRAP and SIGQUIT within this function are
94225         out of date.
94226
94227         The comments for SIGTRAP talk about the signal disposition (SIG_IGN)
94228         being passed to the inferior, meaning the signal disposition being
94229         inherited by GDB's fork children.  However, we now call
94230         restore_original_signals_state prior to forking, so the comment on
94231         SIGTRAP is redundant.
94232
94233         The comments for SIGQUIT are similarly out of date, further, the
94234         comment on SIGQUIT talks about problems with BSD4.3 and vfork,
94235         however, we have not supported BSD4.3 for several years now.
94236
94237         Given the above, it seems that changing the disposition of SIGTRAP is
94238         no longer needed, so I've deleted the signal() call for SIGTRAP.
94239
94240         Finally, the header comment on the function now called
94241         gdb_init_signals was getting quite out of date, so I've updated it
94242         to (hopefully) better reflect reality.
94243
94244         There should be no user visible change after this commit.
94245
94246 2021-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
94247
94248         gdb: register signal handler after setting up event token
94249         This commit fixes the smallest of small possible bug related to signal
94250         handling.  If we look in async_init_signals we see code like this:
94251
94252           signal (SIGQUIT, handle_sigquit);
94253           sigquit_token =
94254             create_async_signal_handler (async_do_nothing, NULL, "sigquit");
94255
94256         Then if we look in handle_sigquit we see code like this:
94257
94258           mark_async_signal_handler (sigquit_token);
94259           signal (sig, handle_sigquit);
94260
94261         Finally, in mark_async_signal_handler we have:
94262
94263           async_handler_ptr->ready = 1;
94264
94265         Where async_handler_ptr will be sigquit_token.
94266
94267         What this means is that if a SIGQUIT arrive in async_init_signals
94268         after handle_sigquit has been registered, but before sigquit_token has
94269         been initialised, then GDB will most likely crash.
94270
94271         The chance of this happening is tiny, but fixing this is trivial, just
94272         ensure we call create_async_signal_handler before calling signal, so
94273         lets do that.
94274
94275         There are no tests for this.  Trying to land a signal in the right
94276         spot is pretty hit and miss.  I did try changing the current HEAD GDB
94277         like this:
94278
94279           signal (SIGQUIT, handle_sigquit);
94280           raise (SIGQUIT);
94281           sigquit_token =
94282             create_async_signal_handler (async_do_nothing, NULL, "sigquit");
94283
94284         And confirmed that this did result in a crash, after my change I tried
94285         this:
94286
94287           sigquit_token =
94288             create_async_signal_handler (async_do_nothing, NULL, "sigquit");
94289           signal (SIGQUIT, handle_sigquit);
94290           raise (SIGQUIT);
94291
94292         And GDB now starts up just fine.
94293
94294         gdb/ChangeLog:
94295
94296                 * event-top.c (async_init_signals): For each signal, call signal
94297                 only after calling create_async_signal_handler.
94298
94299 2021-08-11  Andrew Burgess  <andrew.burgess@embecosm.com>
94300
94301         gdb: terminate upon receipt of SIGFPE
94302         GDB's SIGFPE handling is broken, this is PR gdb/16505 and
94303         PR gdb/17891.
94304
94305         We currently try to use an async event token to process SIGFPE.  So,
94306         when a SIGFPE arrives the signal handler calls
94307         mark_async_signal_handler then returns, effectively ignoring the
94308         signal (for now).
94309
94310         The intention is that later the event loop will see that the async
94311         token associated with SIGFPE has been marked and will call the async
94312         handler, which just throws an error.
94313
94314         The problem is that SIGFPE is not safe to ignore.  Ignoring a
94315         SIGFPE (unless it is generated artificially, e.g. by raise()) is
94316         undefined behaviour, after ignoring the signal on many targets we
94317         return to the instruction that caused the SIGFPE to be raised, which
94318         immediately causes another SIGFPE to be raised, we get stuck in an
94319         infinite loop.  The behaviour is certainly true on x86-64.
94320
94321         To view this behaviour I simply added some dummy code to GDB that
94322         performed an integer divide by zero, compiled this on x86-64
94323         GNU/Linux, ran GDB and saw GDB hang.
94324
94325         In this commit, I propose to remove all special handling of SIGFPE and
94326         instead just let GDB make use of the default SIGFPE action, that is,
94327         to terminate the process.
94328
94329         The only user visible change here should be:
94330
94331           - If a user sends a SIGFPE to GDB using something like kill,
94332             previously GDB would just print an error and remain alive, now GDB
94333             will terminate.  This is inline with what happens if the user
94334             sends GDB a SIGSEGV from kill though, so I don't see this as an
94335             issue.
94336
94337           - If a bug in GDB causes a real SIGFPE, previously the users GDB
94338             session would hang.  Now the GDB session will terminate.  Again,
94339             this is inline with what happens if GDB receives a SIGSEGV due to
94340             an internal bug.
94341
94342         In bug gdb/16505 there is mention that it would be nice if GDB did
94343         more than just terminate when receiving a fatal signal.  I haven't
94344         done that in this commit, but later commits will move in that
94345         direction.
94346
94347         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16505
94348         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17891
94349
94350 2021-08-11  Alan Modra  <amodra@gmail.com>
94351
94352         PR28198, Support # as linker script comment marker
94353                 PR 28198
94354                 * ldlex.l: Combine rules for handling newline, whitespace and
94355                 comments.  Extend # comment handling to all states.
94356
94357 2021-08-11  Alan Modra  <amodra@gmail.com>
94358
94359         ldgram.y tidies
94360         I've been tripped up before thinking the "end" rule was the "END"
94361         token.  Let's use a better name.  The formatting changes are for
94362         consistency within rules, and making it a little easier to visually
94363         separate tokens from mid-rule actions.
94364
94365                 * ldgram.y (separator): Rename from "end".  Update uses.
94366                 (statement): Formatting.  Move ';' match to beginning.
94367                 (paren_script_name): Formatting.  Simplify.
94368                 (must_be_exp, section): Formatting.
94369
94370 2021-08-11  Alan Modra  <amodra@gmail.com>
94371
94372         Mention whitespace in script expressions
94373         Inside an output section statement, ld's parser can't tell whether a
94374         line
94375             .+=4;
94376         is an assignment to dot or a file named ".+=4".
94377
94378                 * ld.texi (expressions): Mention need for whitespace.
94379
94380 2021-08-11  Matt Jacobson  <mhjacobson@me.com>
94381
94382         Add a -mno-dollar-line-separator command line option to the AVR assembler.
94383         Some frontends, like the gcc Objective-C frontend, emit symbols with $
94384         characters in them.  The AVR target code in gas treats $ as a line separator,
94385         so the code doesn?t assemble correctly.
94386
94387         Provide a machine-specific option to disable treating $ as a line separator.
94388
94389                 * config/tc-avr.c (enum options): Add option flag.
94390                 (struct option): Add option -mno-dollar-line-separator.
94391                 (md_parse_option): Adjust treatment of $ when option is present.
94392                 * config/tc-avr.h: Use avr_line_separator_chars.
94393
94394 2021-08-11  Nick Clifton  <nickc@redhat.com>
94395
94396         Fix typo in previous delta
94397
94398 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94399
94400         gas: fold IEEE encoding of -Inf with that of +Inf
94401         The respective results differ only by the sign bits - there's no need to
94402         have basically identical (partially even arch-specific) logic twice.
94403         Simply set the sign bit at the end of encoding the various formats.
94404
94405 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94406
94407         gas: support NaN flavors
94408         Like for infinity, there isn't just a single NaN. The sign bit may be
94409         of interest and, going beyond infinity, whether the value is quiet or
94410         signalling may be even more relevant to be able to encode.
94411
94412         Note that an anomaly with x86'es double extended precision NaN values
94413         gets taken care of at the same time: For all other formats a positive
94414         value with all mantissa bits set was used, while here a negative value
94415         with all non-significant mantissa bits clear was chose for an unknown
94416         reason.
94417
94418         For m68k, since I don't know their X_PRECISION floating point value
94419         layout, a warning gets issued if any of the new flavors was attempted
94420         to be encoded that way. However likely it may be that, given that the
94421         code lives in a source file supposedly implementing IEEE-compliant
94422         formats, the bit patterns of the individual words match x86'es, I didn't
94423         want to guess so. And my very, very old paper doc doesn't even mention
94424         floating point formats other than single and double.
94425
94426 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94427
94428         Arm64: leave .bfloat16 processing to common code
94429         With x86 support having been implemented by extending atof-ieee.c, avoid
94430         unnecessary code duplication in md_atof(). This will then also allow to
94431         take advantage of adjustments made there without needing to mirror them
94432         here.
94433
94434         Arm32: leave more .bfloat16 processing to common code
94435         With x86 support having been implemented by extending atof-ieee.c, avoid
94436         unnecessary code duplication in md_atof(). This will then also allow to
94437         take advantage of adjustments made there without needing to mirror them
94438         here.
94439
94440         gas: make 2nd argument of .dcb.* consistently optional
94441         Unlike the forms consuming/producing integer data, the floating point
94442         ones so far required the 2nd argument to be present, contrary to
94443         documentation. To avoid code duplication, split float_length() out of
94444         hex_float() (taking the opportunity to adjust error message wording).
94445
94446 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94447
94448         x86: introduce .bfloat16 directive
94449         This is to be able to generate data acted upon by AVX512-BF16 and
94450         AMX-BF16 insns. While not part of the IEEE standard, the format is
94451         sufficiently standardized to warrant handling in config/atof-ieee.c.
94452         Arm, where custom handling was implemented, may want to leverage this as
94453         well. To be able to also use the hex forms supported for other floating
94454         point formats, a small addition to the generic hex_float() is needed.
94455
94456         Extend existing x86 testcases.
94457
94458 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94459
94460         x86: introduce .hfloat directive
94461         This is to be able to generate data passed to {,V}CVTPH2PS and acted
94462         upon by AVX512-FP16 insns. To be able to also use the hex forms
94463         supported for other floating point formats, a small addition to the
94464         generic hex_float() is needed.
94465
94466         Extend existing x86 testcases.
94467
94468 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94469
94470         x86/ELF: fix .tfloat output with hex input
94471         The ELF psABI-s are quite clear here: On 32-bit the data type is 12
94472         bytes long (with 2 bytes of trailing padding), while on 64-bit it is 16
94473         bytes long (with 6 bytes of padding). Make hex_float() capable of
94474         handling such padding.
94475
94476         Note that this brings the emitted data size of .dc.x / .dcb.x in line
94477         also for non-ELF targets; so far they were different depending on input
94478         format (dec vs hex).
94479
94480         Extend the existing x86 testcases.
94481
94482 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94483
94484         x86/ELF: fix .ds.x output
94485         The ELF psABI-s are quite clear here: On 32-bit the underlying data type
94486         is 12 bytes long (with 2 bytes of trailing padding), while on 64-bit it
94487         is 16 bytes long (with 6 bytes of padding). Make s_space() capable of
94488         handling 'x' (and 'p') type floating point being other than 12 bytes
94489         wide (also adjusting documentation). This requires duplicating the
94490         definition of X_PRECISION in the target speciifc header; the compiler
94491         would complain if this was out of sync with config/atof-ieee.c.
94492
94493         Note that for now padding space doesn't get separated from actual
94494         storage, which means that things will work correctly only for little-
94495         endian cases, and which also means that by specifying large enough
94496         numbers padding space can be set to non-zero. Since the logic is needed
94497         for a single little-endian architecture only for now, I'm hoping that
94498         this might be acceptable for the time being; otherwise the change will
94499         become more intrusive.
94500
94501         Note also that this brings the emitted data size of .ds.x vs .tfloat in
94502         line for non-ELF targets as well; the issue will be even more obvious
94503         when further taking into account a subsequent patch fixing .dc.x/.dcb.x
94504         (where output sizes currently differ depending on input format).
94505
94506         Extend existing x86 testcases.
94507
94508 2021-08-11  Jan Beulich  <jbeulich@suse.com>
94509
94510         x86/ELF: fix .tfloat output
94511         The ELF psABI-s are quite clear here: On 32-bit the data type is 12
94512         bytes long (with 2 bytes of trailing padding), while on 64-bit it is 16
94513         bytes long (with 6 bytes of padding). Make ieee_md_atof() capable of
94514         handling such padding, and specify the needed padding for x86 (leaving
94515         non-ELF targets alone for now). Split the existing x86 testcase.
94516
94517         x86: have non-PE/COFF BEOS be recognized as ELF
94518         BEOS, unless explicitly requesting *-*-beospe* targets, uses standard
94519         ELF. None of the newly enabled tests in the testsuite fail for me.
94520
94521 2021-08-11  Alan Modra  <amodra@gmail.com>
94522
94523         PR28163, Segment fault in function rl78_special_reloc
94524         Relocation offset checks were completely missing in the rl78 backend,
94525         allowing a relocation to write over memory anywhere.  This was true
94526         for rl78_special_reloc, a function primarily used when applying debug
94527         relocations, and in rl78_elf_relocate_section used by the linker.
94528
94529         This patch fixes those problems by correcting inaccuracies in the
94530         relocation howtos, then uses those howtos to sanity check relocation
94531         offsets before applying relocations.  In addition, the patch
94532         implements overflow checking using the howto information rather than
94533         the ad-hoc scheme implemented in relocate_section.  I implemented the
94534         overflow checking in rl78_special_reloc too.
94535
94536                 * elf32-rl78.c (RL78REL, RL78_OP_REL): Add mask parameter.
94537                 (rl78_elf_howto_table): Set destination masks.  Correct size and
94538                 bitsize of DIR32_REV.  Correct complain_on_overflow for many relocs
94539                 as per tests in relocate_section.  Add RH_SFR.  Correct bitsize
94540                 for RH_SADDR.  Set size to 3 and bitsize to 0 for all OP relocs.
94541                 (check_overflow): New function.
94542                 (rl78_special_reloc): Check that reloc address is within section.
94543                 Apply relocations using reloc howto.  Check for overflow.
94544                 (RANGE): Delete.
94545                 (rl78_elf_relocate_section): Sanity check r_offset.  Perform
94546                 overflow checking using reloc howto.
94547
94548 2021-08-11  GDB Administrator  <gdbadmin@sourceware.org>
94549
94550         Automatic date update in version.in
94551
94552 2021-08-10  Tom Tromey  <tom@tromey.com>
94553
94554         Ignore .debug_types when reading .debug_aranges
94555         I noticed that the fission-reread.exp test case can cause a complaint
94556         when run with --target_board=cc-with-debug-names:
94557
94558         warning: Section .debug_aranges in [...]/fission-reread has duplicate debug_info_offset 0x0, ignoring .debug_aranges.
94559
94560         The bug here is that this executable has both .debug_info and
94561         .debug_types, and both have a CU at offset 0x0.  This triggers the
94562         duplicate warning.
94563
94564         Because .debug_types doesn't provide any address ranges, these CUs can
94565         be ignored.  That is, this bug turns out to be another regression from
94566         the info/types merger patch.
94567
94568         This patch fixes the problem by having this loop igore type units.
94569         fission-reread.exp is updated to test for the bug.
94570
94571 2021-08-10  Tom Tromey  <tom@tromey.com>
94572
94573         Generalize addrmap dumping
94574         While debugging another patch series, I wanted to dump an addrmap.  I
94575         came up with this patch, which generalizes the addrmap-dumping code
94576         from psymtab.c and moves it to addrmap.c.  psymtab.c is changed to use
94577         the new code.
94578
94579 2021-08-10  Simon Marchi  <simon.marchi@polymtl.ca>
94580
94581         gdb: iterate only on vfork parent threads in handle_vfork_child_exec_or_exit
94582         I spotted what I think is a buglet in proceed_after_vfork_done.  After a
94583         vfork child exits or execs, we resume all the threads of the parent.  To
94584         do so, we iterate on all threads using iterate_over_threads with the
94585         proceed_after_vfork_done callback.  Each thread is resumed if the
94586         following condition is true:
94587
94588             if (thread->ptid.pid () == pid
94589                 && thread->state == THREAD_RUNNING
94590                 && !thread->executing
94591                 && !thread->stop_requested
94592                 && thread->stop_signal () == GDB_SIGNAL_0)
94593
94594         where `pid` is the pid of the vfork parent.  This is not multi-target
94595         aware: since it only filters on pid, if there is an inferior with the
94596         same pid in another target, we could end up resuming a thread of that
94597         other inferior.  The chances of the stars aligning for this to happen
94598         are tiny, but still.
94599
94600         Fix that by iterating only on the vfork parent's threads, instead of on
94601         all threads.  This is more efficient, as we iterate on just the required
94602         threads (inferiors have their own thread list), and we can drop the pid
94603         check.  The resulting code is also more straightforward in my opinion,
94604         so it's a win-win.
94605
94606         Change-Id: I14647da72e2bf65592e82fbe6efb77a413a4be3a
94607
94608 2021-08-10  Nick Clifton  <nickc@redhat.com>
94609
94610         Updated Serbian and Russian translations for various sub-directories
94611
94612 2021-08-10  George Barrett  <bob@bob131.so>
94613
94614         guile: fix smob exports
94615         Before Guile v2.1 [1], calls to `scm_make_smob_type' implicitly added
94616         the created class to the exports list of (oop goops); v2.1+ does not
94617         implicitly create bindings in any modules. This means that the GDB
94618         manual subsection documenting exported types is not quite right when GDB
94619         is linked against Guile <v2.1 (types are exported from (oop goops))
94620         instead of (gdb)) and incorrect when linked against Guile v2.1+ (types
94621         are not bound to any variables at all!).
94622
94623         There is a range of cases in which it's necessary or convenient to be
94624         able to refer to a GDB smob type, for instance:
94625
94626          - Pattern matching based on the type of a value.
94627          - Defining GOOPS methods handling values from GDB (GOOPS methods
94628            typically use dynamic dispatch based on the types of the arguments).
94629          - Type-checking assertions when applying some defensive programming on
94630            an interface.
94631          - Generally any other situation one might encounter in a dynamically
94632            typed language that might need some introspection.
94633
94634         If you're more familiar with Python, it would be quite similar to being
94635         unable to refer to the classes exported from the GDB module (which is to
94636         say: not crippling for the most part, but makes certain tasks more
94637         difficult than necessary).
94638
94639         This commit makes a small change to GDB's smob registration machinery
94640         to make sure registered smobs get exported from the current
94641         module. This will likely cause warnings to the user about conflicting
94642         exports if they load both (gdb) and (oop goops) from a GDB linked
94643         against Guile v2.0, but it shouldn't impact functionality (and seemed
94644         preferable to trying to un-export bindings from (oop goops) if v2.0
94645         was detected).
94646
94647         [1]: This changed with Guile commit
94648              28d0871b553a3959a6c59e2e4caec1c1509f8595
94649
94650         gdb/ChangeLog:
94651
94652         2021-06-07  George Barrett  <bob@bob131.so>
94653
94654                 * guile/scm-gsmob.c (gdbscm_make_smob_type): Export registered
94655                 smob type from the current module.
94656
94657         gdb/testsuite/ChangeLog:
94658
94659         2021-06-07  George Barrett  <bob@bob131.so>
94660
94661                 * gdb.guile/scm-gsmob.exp (test exports): Add tests to make
94662                 sure the smob types currently listed in the GDB manual get
94663                 exported from the (gdb) module.
94664
94665         Change-Id: I7dcd791276b48dfc9edb64fc71170bbb42a6f6e7
94666
94667 2021-08-10  GDB Administrator  <gdbadmin@sourceware.org>
94668
94669         Automatic date update in version.in
94670
94671 2021-08-09  Nick Clifton  <nickc@redhat.com>
94672
94673         GAS: DWARF-5: Ensure that the 0'th entry in the directory table contains the current working directory.
94674                 * dwarf2dbg.c (get_directory_table_entry): Ensure that dir[0]
94675                 contains current working directory.
94676                 (out_dir_and_file_list): Likewise.
94677                 * testsuite/gas/elf/dwarf-5-dir0.s: New test source file.
94678                 * testsuite/gas/elf/dwarf-5-dir0.d: New test driver.
94679                 * testsuite/gas/elf/elf.exp: Run the new test.
94680                 * testsuite/gas/elf/dwarf-5-file0.d: Adjust expected output.
94681                 * testsuite/gas/i386/dwarf5-line-1.d: Likewise.
94682                 * testsuite/gas/i386/dwarf5-line-2.d: Likewise.
94683
94684 2021-08-09  GDB Administrator  <gdbadmin@sourceware.org>
94685
94686         Automatic date update in version.in
94687
94688 2021-08-08  Tom Tromey  <tom@tromey.com>
94689
94690         Include objfiles.h in a few .c files
94691         I found a few .c files that rely on objfiles.h, but that only include
94692         it indirectly, via dwarf2/read.h -> psympriv.h.  If that include is
94693         removed (something my new DWARF indexer series does), then the build
94694         will break.
94695
94696         It seemed harmless and correct to add these includes now, making the
94697         eventual series a little smaller.
94698
94699 2021-08-08  GDB Administrator  <gdbadmin@sourceware.org>
94700
94701         Automatic date update in version.in
94702
94703 2021-08-07  Alan Modra  <amodra@gmail.com>
94704
94705         PR28186, SEGV elf.c:7991:30 in _bfd_elf_fixup_group_sections
94706                 PR 28186
94707                 * elf.c (_bfd_elf_fixup_group_sections): Don't segfault on
94708                 objcopy/strip with NULL output_section.
94709
94710 2021-08-07  Alan Modra  <amodra@gmail.com>
94711
94712         PR28176, rl78 complex reloc divide by zero
94713         This is a bit more than just preventing the divide by zero.  Most of
94714         the patch is tidying up error reporting, so that for example, linking
94715         an object file with a reloc stack underflow produces a linker error
94716         rather than just displaying a message that might be ignored.
94717
94718                 PR 28176
94719                 * elf32-rl78.c (RL78_STACK_PUSH, RL78_STACK_POP): Delete.
94720                 (rl78_stack_push, rl78_stack_pop): New inline functions.
94721                 (rl78_compute_complex_reloc): Add status and error message params.
94722                 Use new inline stack handling functions.  Report stack overflow
94723                 or underflow, and divide by zero.
94724                 (rl78_special_reloc): Return status and error message from
94725                 rl78_compute_complex_reloc.
94726                 (rl78_elf_relocate_section): Similarly.  Modernise reloc error
94727                 reporting.  Delete unused bfd_reloc_other case.  Don't assume
94728                 DIR24S_PCREL overflow is due to undefined function.
94729                 (rl78_offset_for_reloc): Adjust to suit rl78_compute_complex_reloc.
94730
94731 2021-08-07  GDB Administrator  <gdbadmin@sourceware.org>
94732
94733         Automatic date update in version.in
94734
94735 2021-08-06  Tom de Vries  <tdevries@suse.de>
94736
94737         [gdb/symtab] Recognize .gdb_index symbol table with empty entries as empty
94738         When reading a .gdb_index that contains a non-empty symbol table with only
94739         empty entries, gdb doesn't recognize it as empty.
94740
94741         Fix this by recognizing that the constant pool is empty, and then setting the
94742         symbol table to empty.
94743
94744         Tested on x86_64-linux.
94745
94746         gdb/ChangeLog:
94747
94748         2021-08-01  Tom de Vries  <tdevries@suse.de>
94749
94750                 PR symtab/28159
94751                 * dwarf2/read.c (read_gdb_index_from_buffer): Handle symbol table
94752                 filled with empty entries.
94753
94754         gdb/testsuite/ChangeLog:
94755
94756         2021-08-01  Tom de Vries  <tdevries@suse.de>
94757
94758                 PR symtab/28159
94759                 * gdb.dwarf2/dw2-zero-range.exp: Remove kfail.
94760
94761 2021-08-06  Tom Tromey  <tromey@adacore.com>
94762
94763         Unconditionally define _initialize_addrmap
94764         The way that init.c is generated does not allow for an initialization
94765         function to be conditionally defined -- doing so will result in a link
94766         error.
94767
94768         This patch fixes a build problem that arises from such a conditional
94769         definition.  It can be reproduce with --disable-unit-tests.
94770
94771 2021-08-06  Tom de Vries  <tdevries@suse.de>
94772
94773         [gdb/symtab] Fix zero address complaint for shlib
94774         In PR28004 the following warning / Internal error is reported:
94775         ...
94776         $ gdb -q -batch \
94777             -iex "set sysroot $(pwd -P)/repro" \
94778             ./repro/gdb \
94779             ./repro/core \
94780             -ex bt
94781           ...
94782          Program terminated with signal SIGABRT, Aborted.
94783          #0  0x00007ff8fe8e5d22 in raise () from repro/usr/lib/libc.so.6
94784          [Current thread is 1 (LWP 1762498)]
94785          #1  0x00007ff8fe8cf862 in abort () from repro/usr/lib/libc.so.6
94786          warning: (Internal error: pc 0x7ff8feb2c21d in read in psymtab, \
94787                    but not in symtab.)
94788          warning: (Internal error: pc 0x7ff8feb2c218 in read in psymtab, \
94789                    but not in symtab.)
94790           ...
94791          #2  0x00007ff8feb2c21e in __gnu_debug::_Error_formatter::_M_error() const \
94792            [clone .cold] (warning: (Internal error: pc 0x7ff8feb2c21d in read in \
94793            psymtab, but not in symtab.)
94794
94795         ) from repro/usr/lib/libstdc++.so.6
94796         ...
94797
94798         The warning is about the following:
94799         - in find_pc_sect_compunit_symtab we try to find the address
94800           (0x7ff8feb2c218 / 0x7ff8feb2c21d) in the symtabs.
94801         - that fails, so we try again in the partial symtabs.
94802         - we find a matching partial symtab
94803         - however, the partial symtab has a full symtab, so
94804           we should have found a matching symtab in the first step.
94805
94806         The addresses are:
94807         ...
94808         (gdb) info sym 0x7ff8feb2c218
94809         __gnu_debug::_Error_formatter::_M_error() const [clone .cold] in \
94810           section .text of repro/usr/lib/libstdc++.so.6
94811         (gdb) info sym 0x7ff8feb2c21d
94812         __gnu_debug::_Error_formatter::_M_error() const [clone .cold] + 5 in \
94813           section .text of repro/usr/lib/libstdc++.so.6
94814         ...
94815         which correspond to unrelocated addresses 0x9c218 and 0x9c21d:
94816         ...
94817         $ nm -C  repro/usr/lib/libstdc++.so.6.0.29 | grep 000000000009c218
94818         000000000009c218 t __gnu_debug::_Error_formatter::_M_error() const \
94819           [clone .cold]
94820         ...
94821         which belong to function __gnu_debug::_Error_formatter::_M_error() in
94822         /build/gcc/src/gcc/libstdc++-v3/src/c++11/debug.cc.
94823
94824         The partial symtab that is found for the addresses is instead the one for
94825         /build/gcc/src/gcc/libstdc++-v3/src/c++98/bitmap_allocator.cc, which is
94826         incorrect.
94827
94828         This happens as follows.
94829
94830         The bitmap_allocator.cc CU has DW_AT_ranges at .debug_rnglist offset 0x4b50:
94831         ...
94832             00004b50 0000000000000000 0000000000000056
94833             00004b5a 00000000000a4790 00000000000a479c
94834             00004b64 00000000000a47a0 00000000000a47ac
94835         ...
94836
94837         When reading the first range 0x0..0x56, it doesn't trigger the "start address
94838         of zero" complaint here:
94839         ...
94840               /* A not-uncommon case of bad debug info.
94841                  Don't pollute the addrmap with bad data.  */
94842               if (range_beginning + baseaddr == 0
94843                   && !per_objfile->per_bfd->has_section_at_zero)
94844                 {
94845                   complaint (_(".debug_rnglists entry has start address of zero"
94846                                " [in module %s]"), objfile_name (objfile));
94847                   continue;
94848                 }
94849         ...
94850         because baseaddr != 0, which seems incorrect given that when loading the
94851         shared library individually in gdb (and consequently baseaddr == 0), we do see
94852         the complaint.
94853
94854         Consequently, we run into this case in dwarf2_get_pc_bounds:
94855         ...
94856           if (low == 0 && !per_objfile->per_bfd->has_section_at_zero)
94857             return PC_BOUNDS_INVALID;
94858         ...
94859         which then results in this code in process_psymtab_comp_unit_reader being
94860         called with cu_bounds_kind == PC_BOUNDS_INVALID, which sets the set_addrmap
94861         argument to 1:
94862         ...
94863               scan_partial_symbols (first_die, &lowpc, &highpc,
94864                                     cu_bounds_kind <= PC_BOUNDS_INVALID, cu);
94865         ...
94866         and consequently, the CU addrmap gets build using address info from the
94867         functions.
94868
94869         During that process, addrmap_set_empty is called with a range that includes
94870         0x9c218 and 0x9c21d:
94871         ...
94872         (gdb) p /x start
94873         $7 = 0x9989c
94874         (gdb) p /x end_inclusive
94875         $8 = 0xb200d
94876         ...
94877         but it's called for a function at DIE 0x54153 with DW_AT_ranges at 0x40ae:
94878         ...
94879             000040ae 00000000000b1ee0 00000000000b200e
94880             000040b9 000000000009989c 00000000000998c4
94881             000040c3 <End of list>
94882         ...
94883         and neither range includes 0x9c218 and 0x9c21d.
94884
94885         This is caused by this code in partial_die_info::read:
94886         ...
94887                     if (dwarf2_ranges_read (ranges_offset, &lowpc, &highpc, cu,
94888                                             nullptr, tag))
94889                      has_pc_info = 1;
94890         ...
94891         which pretends that the function is located at addresses 0x9989c..0xb200d,
94892         which is indeed not the case.
94893
94894         This patch fixes the first problem encountered: fix the "start address of
94895         zero" complaint warning by removing the baseaddr part from the condition.
94896         Same for dwarf2_ranges_process.
94897
94898         The effect is that:
94899         - the complaint is triggered, and
94900         - the warning / Internal error is no longer triggered.
94901
94902         This does not fix the observed problem in partial_die_info::read, which is
94903         filed as PR28200.
94904
94905         Tested on x86_64-linux.
94906
94907         Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
94908
94909         gdb/ChangeLog:
94910
94911         2021-07-29  Simon Marchi  <simon.marchi@polymtl.ca>
94912                     Tom de Vries  <tdevries@suse.de>
94913
94914                 PR symtab/28004
94915                 * gdb/dwarf2/read.c (dwarf2_rnglists_process, dwarf2_ranges_process):
94916                 Fix zero address complaint.
94917                 * gdb/testsuite/gdb.dwarf2/dw2-zero-range-shlib.c: New test.
94918                 * gdb/testsuite/gdb.dwarf2/dw2-zero-range.c: New test.
94919                 * gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp: New file.
94920
94921 2021-08-06  Alan Modra  <amodra@gmail.com>
94922
94923         Re: Add tests for Intel AVX512_FP16 instructions
94924                 * testsuite/gas/i386/x86-64-avx512_fp16_pseudo_ops.d: Pass with
94925                 mingw section padding.
94926
94927 2021-08-06  Alan Modra  <amodra@gmail.com>
94928
94929         chew ubsan warning
94930         It matters not at all if pc is incremented from its initial NULL
94931         value, but avoid this silly runtime ubsan error.
94932
94933                 * doc/chew.c (perform): Avoid incrementing NULL pc.
94934
94935 2021-08-06  Alan Modra  <amodra@gmail.com>
94936
94937         bfd_reloc_offset_in_range overflow
94938         This patch is more about the style of bounds checking we ought to use,
94939         rather than a real problem.  An overflow of "octet + reloc_size" can
94940         only happen with huge sections which would certainly cause out of
94941         memory errors.
94942
94943                 * reloc.c (bfd_reloc_offset_in_range): Avoid possible overflow.
94944
94945 2021-08-06  Alan Modra  <amodra@gmail.com>
94946
94947         PR28175, Segment fault in coff-tic30.c reloc_processing
94948         The obj_convert table shouldn't be accessed without first checking the
94949         index against the table size.
94950
94951                 PR 28175
94952                 * coff-tic30.c (reloc_processing): Sanity check reloc symbol index.
94953                 * coff-z80.c (reloc_processing): Likewise.
94954                 * coff-z8k.c (reloc_processing): Likewise.
94955
94956 2021-08-06  Alan Modra  <amodra@gmail.com>
94957
94958         PR28173, nds32_elf_howto_table index out of bounds
94959         Indexing the howto table was seriously broken by a missing entry, and
94960         use of assertions about user input rather than testing the input.
94961
94962                 PR 28173
94963                 * elf32-nds32.c (nds32_elf_howto_table): Add missing empty howto.
94964                 (bfd_elf32_bfd_reloc_type_table_lookup): Replace assertions with
94965                 range checks.  Return NULL if unsupported reloc type.  Remove
94966                 dead code.  Take an unsigned int param.
94967                 (nds32_info_to_howto_rel): Test for NULL howto or howto name
94968                 return from lookup.  Remove assertion.
94969                 (nds32_info_to_howto): Remove unnecessary ATTRIBUTE_UNUSED.
94970                 Test for NULL howto or howto name return from lookup.
94971
94972 2021-08-06  Alan Modra  <amodra@gmail.com>
94973
94974         PR28172, bfin_pcrel24_reloc heap-buffer-overflow
94975         bfin pcrel24 relocs are weird, they apply to the reloc address minus
94976         two.  That means reloc addresses of 0 and 1 are invalid.  Check that,
94977         and fix other reloc range checking.
94978
94979                 PR 28172
94980                 * elf32-bfin.c (bfin_pcrel24_reloc): Correct reloc range check.
94981                 (bfin_imm16_reloc, bfin_byte4_reloc, bfin_bfd_reloc): Likewise.
94982                 (bfin_final_link_relocate): Likewise.
94983
94984 2021-08-06  GDB Administrator  <gdbadmin@sourceware.org>
94985
94986         Automatic date update in version.in
94987
94988 2021-08-05  Will Schmidt  <will_schmidt@vnet.ibm.com>
94989
94990         [PATCH] GDB Testsuite, update compile-cplus.exp
94991         [PATCH] GDB Testsuite, update compile-cplus.exp
94992
94993         Update the gdb.compile/compile-cplus.exp test to
94994         handle errors generated when passing bad arguments
94995         into the gdb-compile command.
94996         This matches changes made to gdb.compile/compile.exp
94997         in the past as part of
94998         "Migrate rest of compile commands to new options framework"
94999                  e6ed716cd5514c08b9d7c469d185b1aa177dbc22
95000
95001 2021-08-05  Will Schmidt  <will_schmidt@vnet.ibm.com>
95002
95003         [gdb] Handle .TOC. sections during gdb-compile for rs6000 target.
95004         [gdb] Handle .TOC. sections during gdb-compile for rs6000 target.
95005
95006           When we encounter a .TOC. symbol in the object we are loading,
95007         we need to associate this with the .toc section in order to
95008         properly resolve other symbols in the object.  IF a .toc section
95009         is not found, iterate the sections until we find one with the
95010         SEC_ALLOC flag.  If that also fails, fall back to using
95011         the *ABS* section, pointed to by bfd_abs_section_ptr.
95012
95013 2021-08-05  Simon Marchi  <simon.marchi@polymtl.ca>
95014
95015         gdb/testsuite: gdb.base/attach.exp: expose bug when testing with native-extended-gdbserver
95016         In gdb.base/attach.exp, proc do_attach_failure_tests, we attach to a
95017         process.  When then try to attach to the same process in another
95018         inferior, expecting it to fail.  We then come back to the first inferior
95019         and try to kill it, to clean up the test.  When using the
95020         native-extended-gdbserver board, this "kill" test passes, even though it
95021         didn't actually work:
95022
95023             add-inferior
95024             [New inferior 2]
95025             Added inferior 2 on connection 1 (extended-remote localhost:2347)
95026             (gdb) PASS: gdb.base/attach.exp: do_attach_failure_tests: add empty inferior 2
95027             inferior 2
95028             [Switching to inferior 2 [<null>] (<noexec>)]
95029             (gdb) PASS: gdb.base/attach.exp: do_attach_failure_tests: switch to inferior 2
95030             attach 817032
95031             Attaching to process 817032
95032             Attaching to process 817032 failed
95033             (gdb) PASS: gdb.base/attach.exp: do_attach_failure_tests: fail to attach again
95034             inferior 1
95035             [Switching to inferior 1 [process 817032] (/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/attach/attach)]
95036             [Switching to thread 1.1 (Thread 817032.817032)]
95037             #0  main () at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/attach.c:19
95038             19    while (! should_exit)
95039             (gdb) PASS: gdb.base/attach.exp: do_attach_failure_tests: switch to inferior 1
95040             kill
95041             Kill the program being debugged? (y or n) y
95042             Remote connection closed  <==== That's unexpected
95043             (gdb) PASS: gdb.base/attach.exp: do_attach_failure_tests: exit after attach failures
95044
95045         When the second attach fails, gdbserver seems to break the connection
95046         (it hangs up on the existing remote target) and start listening again
95047         for incoming connections.  This is documented in PR 19558 [1].
95048
95049         Make the expected output regexp for the kill command tighter (it
95050         currently accepts anything).  Use "set confirm off" so we don't have to
95051         deal with the confirmation.  And to be really sure the extended-remote
95052         target still works, try to run the inferior again after killing.  The
95053         now tests are kfail'ed when the target is gdbserver.
95054
95055         [1] https://sourceware.org/bugzilla/show_bug.cgi?id=19558
95056
95057         gdb/testsuite/ChangeLog:
95058
95059                 * gdb.base/attach.exp (do_attach_failure_tests): Make kill
95060                 regexp tighter, run inferior after killing it.  Kfail when
95061                 target is gdbserver.
95062
95063         Change-Id: I99c5cd3968ce2ec962ace35b016f842a243b7a0d
95064
95065 2021-08-05  Simon Marchi  <simon.marchi@polymtl.ca>
95066
95067         gdb/testsuite: gdb.base/attach.exp: fix support check in test_command_line_attach_run
95068         When running this test with the native-extended-gdbserver, we get:
95069
95070             main () at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/attach.c:19
95071             19    while (! should_exit)
95072             The program being debugged has been started already.
95073             Start it from the beginning? (y or n) PASS: gdb.base/attach.exp: cmdline attach run: run to prompt
95074             y
95075             Don't know how to run.  Try "help target".
95076             (gdb) FAIL: gdb.base/attach.exp: cmdline attach run: run to main
95077
95078         This test tests using both "-p <pid>" and "-ex start" on the command line,
95079         making sure that we first attach and then run.
95080
95081         Normally, after that "y", we should see the program running again.
95082         However, a particuliarity of the native-extended-gdbserver is that it
95083         uses "set auto-connect-native-target off" on the command line.  The full
95084         GDB command line is:
95085
95086             ./gdb -nw -nx -data-directory /home/simark/build/binutils-gdb/gdb/testsuite/../data-directory \
95087                   -iex set height 0 -iex set width 0 -ex set auto-connect-native-target off \
95088                   -ex set sysroot -quiet -iex set height 0 -iex set width 0 --pid=536609 -ex start
95089
95090         The attach succeeds.  I guess it is done before "set
95091         auto-connect-native-target off", or it somehow bypasses it.  When the
95092         "start" is executed, the native target is unpushed, while killing the
95093         existing process, but not re-pushed, due to "set
95094         auto-connect-native-target off".  So we get that "Don't know how to run"
95095         message.
95096
95097         Really, I think it's a case of the test doing things incompatible with
95098         the board, I think it should just be skipped.  And as we can see with
95099         the current code, there were some attempts at doing this, just using the
95100         wrong checks:
95101
95102          - isnative: this is a dejagnu proc which checks if the target board has
95103            the same triplet as the build machine.  In the case of
95104            native-extended-gdbserver, it does.
95105          - is_remote target: this checks whether the target board is remote, as
95106            in executing on a different machin.  native-extended-gdbserver is not
95107            remote.
95108
95109         Since the --pid option specifically attaches to a process using the
95110         native target, change the test to use gdb_is_target_native instead.
95111
95112         gdb/testsuite/ChangeLog:
95113
95114                 * gdb.base/attach.exp (test_command_line_attach_run): Use
95115                 gdb_is_target_native to check if test is supported.
95116
95117         Change-Id: I762e127f39623889999dc9ed2185540a0951bfb0
95118
95119 2021-08-05  Simon Marchi  <simon.marchi@polymtl.ca>
95120
95121         gdb: target_waitstatus_to_string: print extra info for FORKED, VFORKED, EXECD
95122         Print the extra information contained in target_waitstatus for these
95123         events.  For TARGET_WAITKIND_{FORKED,VFORKED}, the extra information is
95124         contained in related_pid, and is the ptid of the new process.  For
95125         TARGET_WAITKIND_EXECD, it,s the exec'd path name in execd_pathname.
95126         Print it using the same format used for TARGET_WAITKIND_STOPPED and
95127         others.
95128
95129         Here are sample outputs for all three events:
95130
95131             [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
95132             [infrun] print_target_wait_results:   726890.726890.0 [process 726890],
95133             [infrun] print_target_wait_results:   status->kind = vforked, related_pid = 726894.726894.0
95134
95135             [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
95136             [infrun] print_target_wait_results:   727045.727045.0 [process 727045],
95137             [infrun] print_target_wait_results:   status->kind = forked, related_pid = 727049.727049.0
95138
95139             [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
95140             [infrun] print_target_wait_results:   727119.727119.0 [process 727119],
95141             [infrun] print_target_wait_results:   status->kind = execd, execd_pathname = /usr/bin/ls
95142
95143         Change-Id: I4416a74e3bf792a625a68bf26c51689e170f2184
95144
95145 2021-08-05  Simon Marchi  <simon.marchi@polymtl.ca>
95146
95147         gdb: use ptid_t::to_string in print_target_wait_results
95148         The ptid_t::to_string method was introduced recently, to format a ptid_t
95149         for debug purposes.  It formats the ptid exactly as is done in
95150         print_target_wait_results, so make print_target_wait_results use it.
95151
95152         Change-Id: I0a81c8040d3e1858fb304cb28366b34d94eefe4d
95153
95154 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95155
95156         Add as_lval argument to expression evaluator
95157         There are cases where the result of the expression evaluation is
95158         expected to be in a form of a value and not location description.
95159
95160         One place that has this requirement is dwarf_entry_parameter_to_value
95161         function, but more are expected in the future. Until now, this
95162         requirement was fulfilled by extending the evaluated expression with
95163         a DW_OP_stack_value operation at the end.
95164
95165         New implementation, introduces a new evaluation argument instead.
95166
95167                 * dwarf2/expr.c (dwarf_expr_context::fetch_result): Add as_lval
95168                 argument.
95169                 (dwarf_expr_context::eval_exp): Add as_lval argument.
95170                 * dwarf2/expr.h (struct dwarf_expr_context): Add as_lval
95171                 argument to fetch_result and eval_exp methods.
95172                 * dwarf2/frame.c (execute_stack_op): Add as_lval argument.
95173                 * dwarf2/loc.c (dwarf_entry_parameter_to_value): Remove
95174                 DWARF expression extension.
95175                 (dwarf2_evaluate_loc_desc_full): Add as_lval argument support.
95176                 (dwarf2_evaluate_loc_desc): Add as_lval argument support.
95177                 (dwarf2_locexpr_baton_eval): Add as_lval argument support.
95178
95179 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95180
95181         Simplify dwarf_expr_context class interface
95182         Idea of this patch is to get a clean and simple public interface for
95183         the dwarf_expr_context class, looking like:
95184
95185         - constructor,
95186         - destructor,
95187         - push_address method and
95188         - evaluate method.
95189
95190         Where constructor should only ever require a target architecture
95191         information. This information is held in per object file
95192         (dwarf2_per_objfile) structure, so it makes sense to keep that
95193         structure as a constructor argument. It also makes sense to get the
95194         address size from that structure, but unfortunately that interface
95195         doesn't exist at the moment, so the dwarf_expr_context class user
95196         needs to provide that information.
95197
95198         The push_address method is used to push a CORE_ADDR as a value on
95199         top of the DWARF stack before the evaluation. This method can be
95200         later changed to push any struct value object on the stack.
95201
95202         The evaluate method is the method that evaluates a DWARF expression
95203         and provides the evaluation result, in a form of a single struct
95204         value object that describes a location. To do this, the method requires
95205         a context of the evaluation, as well as expected result type
95206         information. If the type information is not provided, the DWARF generic
95207         type will be used instead.
95208
95209         To avoid storing the gdbarch information in the evaluator object, that
95210         information is now always acquired from the per_objfile object.
95211
95212         All data members are now private and only visible to the evaluator
95213         class, so a m_ prefix was added to all of their names to reflect that.
95214         To make this distinction clear, they are also accessed through objects
95215         this pointer, wherever that was not the case before.
95216
95217         gdb/ChangeLog:
95218
95219                 * dwarf2/expr.c (dwarf_expr_context::dwarf_expr_context): Add
95220                 address size argument.
95221                 (dwarf_expr_context::read_mem): Change to use property_addr_info
95222                 structure.
95223                 (dwarf_expr_context::evaluate): New function.
95224                 (dwarf_expr_context::execute_stack_op): Change to use
95225                 property_addr_info structure.
95226                 * dwarf2/expr.h (struct dwarf_expr_context): New evaluate
95227                 declaration. Change eval and fetch_result method to private.
95228                 (dwarf_expr_context::gdbarch): Remove member.
95229                 (dwarf_expr_context::stack): Make private and add m_ prefix.
95230                 (dwarf_expr_context::addr_size): Make private and add
95231                 m_ prefix.
95232                 (dwarf_expr_context::recursion_depth): Make private and add
95233                 m_ prefix.
95234                 (dwarf_expr_context::max_recursion_depth): Make private and
95235                 add m_ prefix.
95236                 (dwarf_expr_context::len): Make private and add m_ prefix.
95237                 (dwarf_expr_context::data): Make private and add m_ prefix.
95238                 (dwarf_expr_context::initialized): Make private and add
95239                 m_ prefix.
95240                 (dwarf_expr_context::pieces): Make private and add m_ prefix.
95241                 (dwarf_expr_context::per_objfile): Make private and add
95242                 m_ prefix.
95243                 (dwarf_expr_context::frame): Make private and add m_ prefix.
95244                 (dwarf_expr_context::per_cu): Make private and add m_ prefix.
95245                 (dwarf_expr_context::addr_info): Make private and add
95246                 m_ prefix.
95247                 * dwarf2/frame.c (execute_stack_op): Change to call evaluate
95248                 method.
95249                 * dwarf2/loc.c (dwarf2_evaluate_loc_desc_full): Change to call
95250                 evaluate method.
95251                 (dwarf2_locexpr_baton_eval): Change to call evaluate method.
95252
95253 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95254
95255         Make DWARF evaluator return a single struct value
95256         The patch is addressing the issue of class users writing and reading
95257         the internal data of the dwarf_expr_context class.
95258
95259         At this point, all conditions are met for the DWARF evaluator to return
95260         an evaluation result in a form of a single struct value object.
95261
95262         gdb/ChangeLog:
95263
95264                 * dwarf2/expr.c (pieced_value_funcs): Chenge to static
95265                 function.
95266                 (allocate_piece_closure): Change to static function.
95267                 (dwarf_expr_context::fetch_result): New function.
95268                 * dwarf2/expr.h (struct piece_closure): Remove declaration.
95269                 (struct dwarf_expr_context): fetch_result new declaration.
95270                 fetch, fetch_address and fetch_in_stack_memory members move
95271                 to private.
95272                 (allocate_piece_closure): Remove.
95273                 * dwarf2/frame.c (execute_stack_op): Change to use
95274                 fetch_result.
95275                 * dwarf2/loc.c (dwarf2_evaluate_loc_desc_full): Change to use
95276                 fetch_result.
95277                 (dwarf2_locexpr_baton_eval): Change to use fetch_result.
95278                 * dwarf2/loc.h (invalid_synthetic_pointer): Expose function.
95279
95280 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95281
95282         Make value_copy also copy the stack data member
95283         Fixing a bug where the value_copy function did not copy the stack data
95284         and initialized members of the struct value. This is needed for the
95285         next patch where the DWARF expression evaluator is changed to return a
95286         single struct value object.
95287
95288                 * value.c (value_copy): Change to also copy the stack data
95289                   and initialized members.
95290
95291 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95292
95293         Move piece_closure and its support to expr.c
95294         Following 5 patches series is trying to clean up the interface of the
95295         DWARF expression evaluator class (dwarf_expr_context).
95296
95297         After merging all expression evaluators into one class, the next
95298         logical step is to make a clean user interface for that class. To do
95299         that, we first need to address the issue of class users writing and
95300         reading the internal data of the class directly.
95301
95302         Fixing the case of writing is simple, it makes sense for an evaluator
95303         instance to be per architecture basis. Currently, the best separation
95304         seems to be per object file, so having that data (dwarf2_per_objfile)
95305         as a constructor argument makes sense. It also makes sense to get the
95306         address size from that object file, but unfortunately that interface
95307         does not exist at the moment.
95308
95309         Luckily, address size information is already available to the users
95310         through other means. As a result, the address size also needs to be a
95311         class constructor argument, at least until a better interface for
95312         acquiring that information from an object file is implemented.
95313
95314         The rest of the user written data comes down to a context of an
95315         evaluated expression (compilation unit context, frame context and
95316         passed in buffer context) and a source type information that a result
95317         of evaluating expression is representing. So, it makes sense for all of
95318         these to be arguments of an evaluation method.
95319
95320         To address the problem of reading the dwarf_expr_context class
95321         internal data, we first need to understand why it is implemented that
95322         way?
95323
95324         This is actualy a question of which existing class can be used to
95325         represent both values and a location descriptions and why it is not
95326         used currently?
95327
95328         The answer is in a struct value class/structure, but the problem is
95329         that before the evaluators were merged, only one evaluator had an
95330         infrastructure to resolve composite and implicit pointer location
95331         descriptions.
95332
95333         After the merge, we are now able to use the struct value to represent
95334         any result of the expression evaluation. It also makes sense to move
95335         all infrastructure for those location descriptions to the expr.c file
95336         considering that that is the only place using that infrastructure.
95337
95338         What we are left with in the end is a clean public interface of the
95339         dwarf_expr_context class containing:
95340
95341         - constructor,
95342         - destructor,
95343         - push_address method and
95344         - eval_exp method.
95345
95346         The idea with this particular patch is to move piece_closure structure
95347         and the interface that handles it (lval_funcs) to expr.c file.
95348
95349         While implicit pointer location descriptions are still not useful in
95350         the CFI context (of the AMD's DWARF standard extensions), the composite
95351         location descriptions are certainly necessary to describe a results of
95352         specific compiler optimizations.
95353
95354         Considering that a piece_closure structure is used to represent both,
95355         there was no benefit in splitting them.
95356
95357         gdb/ChangeLog:
95358
95359                 * dwarf2/expr.c (struct piece_closure): Add from loc.c.
95360                 (allocate_piece_closure): Add from loc.c.
95361                 (bits_to_bytes): Add from loc.c.
95362                 (rw_pieced_value): Add from loc.c.
95363                 (read_pieced_value): Add from loc.c.
95364                 (write_pieced_value): Add from loc.c.
95365                 (check_pieced_synthetic_pointer): Add from loc.c.
95366                 (indirect_pieced_value): Add from loc.c.
95367                 (coerce_pieced_ref): Add from loc.c.
95368                 (copy_pieced_value_closure): Add from loc.c.
95369                 (free_pieced_value_closure): Add from loc.c.
95370                 (sect_variable_value): Add from loc.c.
95371                 * dwarf2/loc.c (sect_variable_value): Move to expr.c.
95372                 (struct piece_closure): Move to expr.c.
95373                 (allocate_piece_closure): Move to expr.c.
95374                 (bits_to_bytes): Move to expr.c.
95375                 (rw_pieced_value): Move to expr.c.
95376                 (read_pieced_value): Move to expr.c.
95377                 (write_pieced_value): Move to expr.c.
95378                 (check_pieced_synthetic_pointer): Move to expr.c.
95379                 (indirect_pieced_value): Move to expr.c.
95380                 (coerce_pieced_ref): Move to expr.c.
95381                 (copy_pieced_value_closure): Move to expr.c.
95382                 (free_pieced_value_closure): Move to expr.c.
95383
95384 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95385
95386         Merge evaluate_for_locexpr_baton evaluator
95387         The evaluate_for_locexpr_baton is the last derived class from the
95388         dwarf_expr_context class. It's purpose is to support the passed in
95389         buffer functionality.
95390
95391         Although, it is not really necessary to merge this class with it's
95392         base class, doing that simplifies new expression evaluator design.
95393
95394         Considering that this functionality is going around the DWARF standard,
95395         it is also reasonable to expect that with a new evaluator design and
95396         extending the push object address functionality to accept any location
95397         description, there will be no need to support passed in buffers.
95398
95399         Alternatively, it would also makes sense to abstract the interaction
95400         between the evaluator and a given resource in the near future. The
95401         passed in buffer would then be a specialization of that abstraction.
95402
95403         gdb/ChangeLog:
95404
95405                 * dwarf2/expr.c (dwarf_expr_context::read_mem): Merge with
95406                 evaluate_for_locexpr_baton implementation.
95407                 * dwarf2/loc.c (class evaluate_for_locexpr_baton): Remove
95408                 class.
95409                 (evaluate_for_locexpr_baton::read_mem): Move to
95410                 dwarf_expr_context.
95411                 (dwarf2_locexpr_baton_eval): Instantiate dwarf_expr_context
95412                 instead of evaluate_for_locexpr_baton class.
95413
95414 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95415
95416         Remove empty frame and full evaluators
95417         There are no virtual methods that require different specialization in
95418         dwarf_expr_context class. This means that derived classes
95419         dwarf_expr_executor and dwarf_evaluate_loc_desc are not needed any
95420         more.
95421
95422         As a result of this, the  evaluate_for_locexpr_baton class base class
95423         is now the dwarf_expr_context class.
95424
95425         There might be a need for a better class hierarchy when we know more
95426         about the direction of the future DWARF versions and gdb extensions,
95427         but that is out of the scope of this patch series.
95428
95429         gdb/ChangeLog:
95430
95431                 * dwarf2/frame.c (class dwarf_expr_executor): Remove class.
95432                 (execute_stack_op): Instantiate dwarf_expr_context instead of
95433                 dwarf_evaluate_loc_desc class.
95434                 * dwarf2/loc.c (class dwarf_evaluate_loc_desc): Remove class.
95435                 (dwarf2_evaluate_loc_desc_full): Instantiate dwarf_expr_context
95436                 instead of dwarf_evaluate_loc_desc class.
95437                 (struct evaluate_for_locexpr_baton): Derive from
95438                 dwarf_expr_context.
95439
95440 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95441
95442         Inline get_reg_value method of dwarf_expr_context
95443         The get_reg_value method is a small function that is only called once,
95444         so it can be inlined to simplify the dwarf_expr_context class.
95445
95446         gdb/ChangeLog:
95447
95448                 * dwarf2/expr.c (dwarf_expr_context::get_reg_value): Remove
95449                 method.
95450                 (dwarf_expr_context::execute_stack_op): Inline get_reg_value
95451                 method.
95452                 * dwarf2/expr.h (dwarf_expr_context::get_reg_value): Remove
95453                 method.
95454
95455 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95456
95457         Move push_dwarf_reg_entry_value to expr.c
95458         Following the idea of merging the evaluators, the
95459         push_dwarf_reg_entry_value method can be moved from
95460         dwarf_expr_executor and dwarf_evaluate_loc_desc classes
95461         to their base class dwarf_expr_context.
95462
95463         gdb/ChangeLog:
95464
95465                 * dwarf2/expr.c
95466                 (dwarf_expr_context::push_dwarf_reg_entry_value): Move from
95467                 dwarf_evaluate_loc_desc.
95468                 * dwarf2/frame.c
95469                 (dwarf_expr_executor::push_dwarf_reg_entry_value): Remove
95470                 method.
95471                 * dwarf2/loc.c (dwarf_expr_reg_to_entry_parameter): Expose
95472                 function.
95473                 (dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value): Move to
95474                 dwarf_expr_context.
95475                 * dwarf2/loc.h (dwarf_expr_reg_to_entry_parameter): Expose
95476                 function.
95477
95478 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95479
95480         Move read_mem to dwarf_expr_context
95481         Following the idea of merging the evaluators, the read_mem method can
95482         be moved from dwarf_expr_executor and dwarf_evaluate_loc_desc classes
95483         to their base class dwarf_expr_context.
95484
95485         gdb/ChangeLog:
95486
95487                 * dwarf2/expr.c (dwarf_expr_context::read_mem): Move from
95488                 dwarf_evaluate_loc_desc.
95489                 * dwarf2/frame.c (dwarf_expr_executor::read_mem): Remove
95490                 method.
95491                 * dwarf2/loc.c (dwarf_evaluate_loc_desc::read_mem): Move to
95492                 dwarf_expr_context.
95493
95494 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95495
95496         Move get_object_address to dwarf_expr_context
95497         Following the idea of merging the evaluators, the get_object_address
95498         and can be moved from dwarf_expr_executor and dwarf_evaluate_loc_desc
95499         classes to their base class dwarf_expr_context.
95500
95501         gdb/ChangeLog:
95502
95503                 * dwarf2/expr.c (dwarf_expr_context::get_object_address): Move
95504                 from dwarf_evaluate_loc_desc.
95505                 (class dwarf_expr_context): Add object address member to
95506                 dwarf_expr_context.
95507                 * dwarf2/expr.h (dwarf_expr_context::get_frame_pc): Remove
95508                 method.
95509                 * dwarf2/frame.c (dwarf_expr_executor::get_object_address):
95510                 Remove method.
95511                 * dwarf2/loc.c (dwarf_evaluate_loc_desc::get_object_address):
95512                 move to dwarf_expr_context.
95513                 (class dwarf_evaluate_loc_desc): Move object address member to
95514                 dwarf_expr_context.
95515
95516 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95517
95518         Move dwarf_call to dwarf_expr_context
95519         Following the idea of merging the evaluators, the dwarf_call and
95520         get_frame_pc method can be moved from dwarf_expr_executor and
95521         dwarf_evaluate_loc_desc classes to their base class dwarf_expr_context.
95522         Once this is done, the get_frame_pc can be replace with lambda
95523         function.
95524
95525         gdb/ChangeLog:
95526
95527                 * dwarf2/expr.c (dwarf_expr_context::dwarf_call): Move from
95528                 dwarf_evaluate_loc_desc.
95529                 (dwarf_expr_context::get_frame_pc): Replace with lambda.
95530                 * dwarf2/expr.h (dwarf_expr_context::get_frame_pc): Remove
95531                 method.
95532                 * dwarf2/frame.c (dwarf_expr_executor::dwarf_call): Remove
95533                 method.
95534                 (dwarf_expr_executor::get_frame_pc): Remove method.
95535                 * dwarf2/loc.c (dwarf_evaluate_loc_desc::get_frame_pc): Remove
95536                 method.
95537                 (dwarf_evaluate_loc_desc::dwarf_call): Move to
95538                 dwarf_expr_context.
95539                 (per_cu_dwarf_call): Inline function.
95540
95541 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95542
95543         Move compilation unit info to dwarf_expr_context
95544         This patch moves the compilation unit context information and support
95545         from dwarf_expr_executor and dwarf_evaluate_loc_desc to
95546         dwarf_expr_context evaluator. The idea is to report an error when a
95547         given operation requires a compilation unit information to be resolved,
95548         which is not available.
95549
95550         With this change, it also makes sense to always acquire ref_addr_size
95551         information from the compilation unit context, considering that all
95552         DWARF operations that refer to that information require a compilation
95553         unit context to be present during their evaluation.
95554
95555         gdb/ChangeLog:
95556
95557                 * dwarf2/expr.c (ensure_have_per_cu): New function.
95558                 (dwarf_expr_context::dwarf_expr_context): Add compilation unit
95559                 context information.
95560                 (dwarf_expr_context::get_base_type): Move from
95561                 dwarf_evaluate_loc_desc.
95562                 (dwarf_expr_context::get_addr_index): Remove method.
95563                 (dwarf_expr_context::dwarf_variable_value): Remove method.
95564                 (dwarf_expr_context::execute_stack_op): Call compilation unit
95565                 context info check. Inline get_addr_index and
95566                 dwarf_variable_value methods.
95567                 * dwarf2/expr.h (struct dwarf_expr_context): Add compilation
95568                 context info.
95569                 (dwarf_expr_context::get_addr_index): Remove method.
95570                 (dwarf_expr_context::dwarf_variable_value): Remove method.
95571                 (dwarf_expr_context::ref_addr_size): Remove member.
95572                 * dwarf2/frame.c (dwarf_expr_executor::get_addr_index): Remove
95573                 method.
95574                 (dwarf_expr_executor::dwarf_variable_value): Remove method.
95575                 * dwarf2/loc.c (sect_variable_value): Expose function.
95576                 (dwarf_evaluate_loc_desc::get_addr_index): Remove method.
95577                 (dwarf_evaluate_loc_desc::dwarf_variable_value): Remove method.
95578                 (class dwarf_evaluate_loc_desc): Move compilation unit context
95579                 information to dwarf_expr_context class.
95580                 * dwarf2/loc.h (sect_variable_value): Expose function.
95581
95582 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95583
95584         Remove get_frame_cfa from dwarf_expr_context
95585         Following the idea of merging the evaluators, the get_frame_cfa method
95586         can be moved from dwarf_expr_executor and dwarf_evaluate_loc_desc
95587         classes to their base class dwarf_expr_context. Once this is done,
95588         it becomes apparent that the method is only called once and it can be
95589         inlined.
95590
95591         It is also necessary to check if the frame context information was
95592         provided before the DW_OP_call_frame_cfa operation is executed.
95593
95594         gdb/ChangeLog:
95595
95596                 * dwarf2/expr.c (dwarf_expr_context::get_frame_cfa): Remove
95597                 method.
95598                 (dwarf_expr_context::execute_stack_op): Call frame context info
95599                 check for DW_OP_call_frame_cfa. Remove use of get_frame_cfa.
95600                 * dwarf2/expr.h (dwarf_expr_context::get_frame_cfa): Remove
95601                 method.
95602                 * dwarf2/frame.c (dwarf_expr_context::get_frame_cfa): Remove
95603                 method.
95604                 * dwarf2/loc.c (dwarf_expr_context::get_frame_cfa): Remove
95605                 method.
95606
95607 2021-08-05  Zoran Zaric  <zoran.zaric@amd.com>
95608
95609         Move frame context info to dwarf_expr_context
95610         Following 15 patches in this patch series is cleaning up the design of
95611         the DWARF expression evaluator (dwarf_expr_context) to make future
95612         extensions of that evaluator easier and cleaner to implement.
95613
95614         There are three subclasses of the dwarf_expr_context class
95615         (dwarf_expr_executor, dwarf_evaluate_loc_desc and
95616         evaluate_for_locexpr_baton). Here is a short description of each class:
95617
95618         - dwarf_expr_executor is evaluating a DWARF expression in a context
95619           of a Call Frame Information. The overridden methods of this subclass
95620           report an error if a specific DWARF operation, represented by that
95621           method, is not allowed in a CFI context. The source code of this
95622           subclass lacks the support for composite as well as implicit pointer
95623           location description.
95624
95625         - dwarf_evaluate_loc_desc can evaluate any expression with no
95626           restrictions. All of the methods that this subclass overrides are
95627           actually doing what they are intended to do. This subclass contains
95628           a full support for all location description types.
95629
95630         - evaluate_for_locexpr_baton subclass is a specialization of the
95631           dwarf_evaluate_loc_desc subclass and it's function is to add
95632           support for passed in buffers. This seems to be a way to go around
95633           the fact that DWARF standard lacks a bit offset support for memory
95634           location descriptions as well as using any location description for
95635           the push object address functionality.
95636
95637         It all comes down to this question: what is a function of a DWARF
95638         expression evaluator?
95639
95640         Is it to evaluate the expression in a given context or to check the
95641         correctness of that expression in that context?
95642
95643         Currently, the only reason why there is a dwarf_expr_executor subclass
95644         is to report an invalid DWARF expression in a context of a CFI, but is
95645         that what the evaluator is supposed to do considering that the evaluator
95646         is not tied to a given DWARF version?
95647
95648         There are more and more vendor and GNU extensions that are not part of
95649         the DWARF standard, so is it that impossible to expect that some of the
95650         extensions could actually lift the previously imposed restrictions of
95651         the CFI context? Not to mention that every new DWARF version is lifting
95652         some restrictions anyway.
95653
95654         The thing that makes more sense for an evaluator to do, is to take the
95655         context of an evaluation and checks the requirements of every operation
95656         evaluated against that context. With this approach, the evaluator would
95657         report an error only if parts of the context, necessary for the
95658         evaluation, are missing.
95659
95660         If this approach is taken, then the unification of the
95661         dwarf_evaluate_loc_desc, dwarf_expr_executor and dwarf_expr_context
95662         is the next logical step. This makes a design of the DWARF expression
95663         evaluator cleaner and allows more flexibility when supporting future
95664         vendor and GNU extensions.
95665
95666         Additional benefit here is that now all evaluators have access to all
95667         location description types, which means that a vendor extended CFI
95668         rules could support composite location description as well. This also
95669         means that a new evaluator interface can be changed to return a single
95670         struct value (that describes the result of the evaluation) instead of
95671         a caller poking around the dwarf_expr_context internal data for answers
95672         (like it is done currently).
95673
95674         This patch starts the merging process by moving the frame context
95675         information and support from dwarf_expr_executor and
95676         dwarf_evaluate_loc_desc to dwarf_expr_context evaluator. The idea
95677         is to report an error when a given operation requires a frame
95678         information to be resolved, if that information is not present.
95679
95680         gdb/ChangeLog:
95681
95682                 * dwarf2/expr.c (ensure_have_frame): New function.
95683                 (read_addr_from_reg): Add from frame.c.
95684                 (dwarf_expr_context::dwarf_expr_context): Add frame info to
95685                 dwarf_expr_context.
95686                 (dwarf_expr_context::read_addr_from_reg): Remove.
95687                 (dwarf_expr_context::get_reg_value): Move from
95688                 dwarf_evaluate_loc_desc.
95689                 (dwarf_expr_context::get_frame_base): Move from
95690                 dwarf_evaluate_loc_desc.
95691                 (dwarf_expr_context::execute_stack_op): Call frame context info
95692                 check. Remove use of read_addr_from_reg method.
95693                 * dwarf2/expr.h (struct dwarf_expr_context): Add frame info
95694                 member, read_addr_from_reg, get_reg_value and get_frame_base
95695                 declaration.
95696                 (read_addr_from_reg): Move to expr.c.
95697                 * dwarf2/frame.c (read_addr_from_reg): Move to
95698                 dwarf_expr_context.
95699                 (dwarf_expr_executor::read_addr_from_reg): Remove.
95700                 (dwarf_expr_executor::get_frame_base): Remove.
95701                 (dwarf_expr_executor::get_reg_value): Remove.
95702                 (execute_stack_op): Use read_addr_from_reg function instead of
95703                 read_addr_from_reg method.
95704                 * dwarf2/loc.c (dwarf_evaluate_loc_desc::get_frame_base): Move
95705                 to dwarf_expr_context.
95706                 (dwarf_evaluate_loc_desc::get_reg_value): Move to
95707                 dwarf_expr_context.
95708                 (dwarf_evaluate_loc_desc::read_addr_from_reg): Remove.
95709                 (dwarf2_locexpr_baton_eval):Use read_addr_from_reg function
95710                 instead of read_addr_from_reg method.
95711
95712 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95713
95714         Cleanup of the dwarf_expr_context constructor
95715         Move the initial values for dwarf_expr_context class data members
95716         to the class declaration in expr.h.
95717
95718         gdb/ChangeLog:
95719
95720                 * dwarf2/expr.c (dwarf_expr_context::dwarf_expr_context):
95721                 Remove initial data members values.
95722                 * dwarf2/expr.h (dwarf_expr_context): Add initial values
95723                 to the class data members.
95724
95725 2021-08-05  Zoran Zaric  <Zoran.Zaric@amd.com>
95726
95727         Replace the symbol needs evaluator with a parser
95728         This patch addresses a design problem with the symbol_needs_eval_context
95729         class. It exposes the problem by introducing two new testsuite test
95730         cases.
95731
95732         To explain the issue, I first need to explain the dwarf_expr_context
95733         class that the symbol_needs_eval_context class derives from.
95734
95735         The intention behind the dwarf_expr_context class is to commonize the
95736         DWARF expression evaluation mechanism for different evaluation
95737         contexts. Currently in gdb, the evaluation context can contain some or
95738         all of the following information: architecture, object file, frame and
95739         compilation unit.
95740
95741         Depending on the information needed to evaluate a given expression,
95742         there are currently three distinct DWARF expression evaluators:
95743
95744          - Frame: designed to evaluate an expression in the context of a call
95745            frame information (dwarf_expr_executor class). This evaluator doesn't
95746            need a compilation unit information.
95747
95748          - Location description: designed to evaluate an expression in the
95749            context of a source level information (dwarf_evaluate_loc_desc
95750            class). This evaluator expects all information needed for the
95751            evaluation of the given expression to be present.
95752
95753          - Symbol needs: designed to answer a question about the parts of the
95754            context information required to evaluate a DWARF expression behind a
95755            given symbol (symbol_needs_eval_context class). This evaluator
95756            doesn't need a frame information.
95757
95758         The functional difference between the symbol needs evaluator and the
95759         others is that this evaluator is not meant to interact with the actual
95760         target. Instead, it is supposed to check which parts of the context
95761         information are needed for the given DWARF expression to be evaluated by
95762         the location description evaluator.
95763
95764         The idea is to take advantage of the existing dwarf_expr_context
95765         evaluation mechanism and to fake all required interactions with the
95766         actual target, by returning back dummy values. The evaluation result is
95767         returned as one of three possible values, based on operations found in a
95768         given expression:
95769
95770         - SYMBOL_NEEDS_NONE,
95771         - SYMBOL_NEEDS_REGISTERS and
95772         - SYMBOL_NEEDS_FRAME.
95773
95774         The problem here is that faking results of target interactions can yield
95775         an incorrect evaluation result.
95776
95777         For example, if we have a conditional DWARF expression, where the
95778         condition depends on a value read from an actual target, and the true
95779         branch of the condition requires a frame information to be evaluated,
95780         while the false branch doesn't, fake target reads could conclude that a
95781         frame information is not needed, where in fact it is. This wrong
95782         information would then cause the expression to be actually evaluated (by
95783         the location description evaluator) with a missing frame information.
95784         This would then crash the debugger.
95785
95786         The gdb.dwarf2/symbol_needs_eval_fail.exp test introduces this
95787         scenario, with the following DWARF expression:
95788
95789                            DW_OP_addr $some_variable
95790                            DW_OP_deref
95791
95792                            # conditional jump to DW_OP_bregx
95793                            DW_OP_bra 4
95794                            DW_OP_lit0
95795
95796                            # jump to DW_OP_stack_value
95797                            DW_OP_skip 3
95798                            DW_OP_bregx $dwarf_regnum 0
95799                            DW_OP_stack_value
95800
95801         This expression describes a case where some variable dictates the
95802         location of another variable. Depending on a value of some_variable, the
95803         variable whose location is described by this expression is either read
95804         from a register or it is defined as a constant value 0. In both cases,
95805         the value will be returned as an implicit location description on the
95806         DWARF stack.
95807
95808         Currently, when the symbol needs evaluator fakes a memory read from the
95809         address behind the some_variable variable, the constant value 0 is used
95810         as the value of the variable A, and the check returns the
95811         SYMBOL_NEEDS_NONE result.
95812
95813         This is clearly a wrong result and it causes the debugger to crash.
95814
95815         The scenario might sound strange to some people, but it comes from a
95816         SIMD/SIMT architecture where $some_variable is an execution mask.  In
95817         any case, it is a valid DWARF expression, and GDB shouldn't crash while
95818         evaluating it. Also, a similar example could be made based on a
95819         condition of the frame base value, where if that value is concluded to
95820         be 0, the variable location could be defaulted to a TLS based memory
95821         address.
95822
95823         The gdb.dwarf2/symbol_needs_eval_timeout.exp test introduces a second
95824         scenario. This scenario is a bit more abstract due to the DWARF
95825         assembler lacking the CFI support, but it exposes a different
95826         manifestation of the same problem. Like in the previous scenario, the
95827         DWARF expression used in the test is valid:
95828
95829                                DW_OP_lit1
95830                                DW_OP_addr $some_variable
95831                                DW_OP_deref
95832
95833                                # jump to DW_OP_fbreg
95834                                DW_OP_skip 4
95835                                DW_OP_drop
95836                                DW_OP_fbreg 0
95837                                DW_OP_dup
95838                                DW_OP_lit0
95839                                DW_OP_eq
95840
95841                                # conditional jump to DW_OP_drop
95842                                DW_OP_bra -9
95843                                DW_OP_stack_value
95844
95845         Similarly to the previous scenario, the location of a variable A is an
95846         implicit location description with a constant value that depends on a
95847         value held by a global variable. The difference from the previous case
95848         is that DWARF expression contains a loop instead of just one branch. The
95849         end condition of that loop depends on the expectation that a frame base
95850         value is never zero. Currently, the act of faking the target reads will
95851         cause the symbol needs evaluator to get stuck in an infinite loop.
95852
95853         Somebody could argue that we could change the fake reads to return
95854         something else, but that would only hide the real problem.
95855
95856         The general impression seems to be that the desired design is to have
95857         one class that deals with parsing of the DWARF expression, while there
95858         are virtual methods that deal with specifics of some operations.
95859
95860         Using an evaluator mechanism here doesn't seem to be correct, because
95861         the act of evaluation relies on accessing the data from the actual
95862         target with the possibility of skipping the evaluation of some parts of
95863         the expression.
95864
95865         To better explain the proposed solution for the issue, I first need to
95866         explain a couple more details behind the current design:
95867
95868         There are multiple places in gdb that handle DWARF expression parsing
95869         for different purposes. Some are in charge of converting the expression
95870         to some other internal representation (decode_location_expression,
95871         disassemble_dwarf_expression and dwarf2_compile_expr_to_ax), some are
95872         analysing the expression for specific information
95873         (compute_stack_depth_worker) and some are in charge of evaluating the
95874         expression in a given context (dwarf_expr_context::execute_stack_op
95875         and decode_locdesc).
95876
95877         The problem is that all those functions have a similar (large) switch
95878         statement that handles each DWARF expression operation. The result of
95879         this is a code duplication and harder maintenance.
95880
95881         As a step into the right direction to solve this problem (at least for
95882         the purpose of a DWARF expression evaluation) the expression parsing was
95883         commonized inside of an evaluator base class (dwarf_expr_context). This
95884         makes sense for all derived classes, except for the symbol needs
95885         evaluator (symbol_needs_eval_context) class.
95886
95887         As described previously the problem with this evaluator is that if the
95888         evaluator is not allowed to access the actual target, it is not really
95889         evaluating.
95890
95891         Instead, the desired function of a symbol needs evaluator seems to fall
95892         more into expression analysis category. This means that a more natural
95893         fit for this evaluator is to be a symbol needs analysis, similar to the
95894         existing compute_stack_depth_worker analysis.
95895
95896         Another problem is that using a heavyweight mechanism of an evaluator
95897         to do an expression analysis seems to be an unneeded overhead. It also
95898         requires a more complicated design of the parent class to support fake
95899         target reads.
95900
95901         The reality is that the whole symbol_needs_eval_context class can be
95902         replaced with a lightweight recursive analysis function, that will give
95903         more correct result without compromising the design of the
95904         dwarf_expr_context class. The analysis treats the expression byte
95905         stream as a DWARF operation graph, where each graph node can be
95906         visited only once and each operation can decide if the frame context
95907         is needed for their evaluation.
95908
95909         The downside of this approach is adding of one more similar switch
95910         statement, but at least this way the new symbol needs analysis will be
95911         a lightweight mechnism and it will provide a correct result for any
95912         given DWARF expression.
95913
95914         A more desired long term design would be to have one class that deals
95915         with parsing of the DWARF expression, while there would be a virtual
95916         methods that deal with specifics of some DWARF operations. Then that
95917         class would be used as a base for all DWARF expression parsing mentioned
95918         at the beginning.
95919
95920         This however, requires a far bigger changes that are out of the scope
95921         of this patch series.
95922
95923         The new analysis requires the DWARF location description for the
95924         argc argument of the main function to change in the assembly file
95925         gdb.python/amd64-py-framefilter-invalidarg.S. Originally, expression
95926         ended with a 0 value byte, which was never reached by the symbol needs
95927         evaluator, because it was detecting a stack underflow when evaluating
95928         the operation before. The new approach does not simulate a DWARF
95929         stack anymore, so the 0 value byte needs to be removed because it
95930         makes the DWARF expression invalid.
95931
95932         gdb/ChangeLog:
95933
95934                 * dwarf2/loc.c (class symbol_needs_eval_context): Remove.
95935                 (dwarf2_get_symbol_read_needs): New function.
95936                 (dwarf2_loc_desc_get_symbol_read_needs): Remove.
95937                 (locexpr_get_symbol_read_needs): Use
95938                 dwarf2_get_symbol_read_needs.
95939
95940         gdb/testsuite/ChangeLog:
95941
95942                 * gdb.python/amd64-py-framefilter-invalidarg.S : Update argc
95943                   DWARF location expression.
95944                 * lib/dwarf.exp (_location): Handle DW_OP_fbreg.
95945                 * gdb.dwarf2/symbol_needs_eval.c: New file.
95946                 * gdb.dwarf2/symbol_needs_eval_fail.exp: New file.
95947                 * gdb.dwarf2/symbol_needs_eval_timeout.exp: New file.
95948
95949 2021-08-05  Cui,Lili  <lili.cui@intel.com>
95950
95951         [PATCH 2/2] Add tests for Intel AVX512_FP16 instructions
95952         Intel AVX512 FP16 instructions use maps 3, 5 and 6. Maps 5 and 6 use 3 bits
95953         in the EVEX.mmm field (0b101, 0b110). Map 5 is for instructions that were FP32
95954         in map 1 (0Fxx). Map 6 is for instructions that were FP32 in map 2 (0F38xx).
95955         There are some exceptions to this rule. Some things in map 1 (0Fxx) with imm8
95956         operands predated our current conventions; those instructions moved to map 3.
95957         FP32 things in map 3 (0F3Axx) found new opcodes in map3 for FP16 because map3
95958         is very sparsely populated. Most of the FP16 instructions share opcodes and
95959         prefix (EVEX.pp) bits with the related FP32 operations.
95960
95961         Intel AVX512 FP16 instructions has new displacements scaling rules, please refer
95962         to the public software developer manual for detail information.
95963
95964         gas/
95965
95966         2021-08-05  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
95967                     H.J. Lu  <hongjiu.lu@intel.com>
95968                     Wei Xiao <wei3.xiao@intel.com>
95969                     Lili Cui  <lili.cui@intel.com>
95970
95971                 * testsuite/gas/i386/i386.exp: Run FP16 tests.
95972                 * testsuite/gas/i386/avx512_fp16-intel.d: New test.
95973                 * testsuite/gas/i386/avx512_fp16-inval-bcast.l: Ditto.
95974                 * testsuite/gas/i386/avx512_fp16-inval-bcast.s: Ditto.
95975                 * testsuite/gas/i386/avx512_fp16.d: Ditto.
95976                 * testsuite/gas/i386/avx512_fp16.s: Ditto.
95977                 * testsuite/gas/i386/avx512_fp16_pseudo_ops.d: Ditto.
95978                 * testsuite/gas/i386/avx512_fp16_pseudo_ops.s: Ditto.
95979                 * testsuite/gas/i386/avx512_fp16_vl-intel.d: Ditto.
95980                 * testsuite/gas/i386/avx512_fp16_vl.d: Ditto.
95981                 * testsuite/gas/i386/avx512_fp16_vl.s: Ditto.
95982                 * testsuite/gas/i386/x86-64-avx512_fp16-intel.d: Ditto.
95983                 * testsuite/gas/i386/x86-64-avx512_fp16-inval-bcast.l: Ditto.
95984                 * testsuite/gas/i386/x86-64-avx512_fp16-inval-bcast.s: Ditto.
95985                 * testsuite/gas/i386/x86-64-avx512_fp16.d: Ditto.
95986                 * testsuite/gas/i386/x86-64-avx512_fp16.s: Ditto.
95987                 * testsuite/gas/i386/x86-64-avx512_fp16_pseudo_ops.d: Ditto.
95988                 * testsuite/gas/i386/x86-64-avx512_fp16_pseudo_ops.s: Ditto.
95989                 * testsuite/gas/i386/x86-64-avx512_fp16_vl-intel.d: Ditto.
95990                 * testsuite/gas/i386/x86-64-avx512_fp16_vl.d: Ditto.
95991                 * testsuite/gas/i386/x86-64-avx512_fp16_vl.s: Ditto.
95992                 * testsuite/gas/i386/x86-64-avx512_fp16-inval-register.l: Ditto.
95993                 * testsuite/gas/i386/x86-64-avx512_fp16-inval-register.s: Ditto.
95994                 * testsuite/gas/i386/x86-64-avx512_fp16-bad.d: Ditto.
95995                 * testsuite/gas/i386/x86-64-avx512_fp16-bad.s: Ditto.
95996                 * testsuite/gas/i386/x86-64-default-suffix-avx.d: Add new testcase.
95997                 * testsuite/gas/i386/x86-64-default-suffix.d: Ditto.
95998                 * testsuite/gas/i386/x86-64-default-suffix.s: Ditto.
95999                 * testsuite/gas/i386/xmmword.l: Ditto.
96000                 * testsuite/gas/i386/xmmword.s: Ditto.
96001
96002 2021-08-05  Cui,Lili  <lili.cui@intel.com>
96003
96004         [PATCH 1/2] Enable Intel AVX512_FP16 instructions
96005         Intel AVX512 FP16 instructions use maps 3, 5 and 6. Maps 5 and 6 use 3 bits
96006         in the EVEX.mmm field (0b101, 0b110). Map 5 is for instructions that were FP32
96007         in map 1 (0Fxx). Map 6 is for instructions that were FP32 in map 2 (0F38xx).
96008         There are some exceptions to this rule. Some things in map 1 (0Fxx) with imm8
96009         operands predated our current conventions; those instructions moved to map 3.
96010         FP32 things in map 3 (0F3Axx) found new opcodes in map3 for FP16 because map3
96011         is very sparsely populated. Most of the FP16 instructions share opcodes and
96012         prefix (EVEX.pp) bits with the related FP32 operations.
96013
96014         Intel AVX512 FP16 instructions has new displacements scaling rules, please refer
96015         to the public software developer manual for detail information.
96016
96017         gas/
96018
96019         2021-08-05  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
96020                     H.J. Lu  <hongjiu.lu@intel.com>
96021                     Wei Xiao <wei3.xiao@intel.com>
96022                     Lili Cui  <lili.cui@intel.com>
96023
96024                 * config/tc-i386.c (struct Broadcast_Operation): Adjust comment.
96025                 (cpu_arch): Add .avx512_fp16.
96026                 (cpu_noarch): Add noavx512_fp16.
96027                 (pte): Add evexmap5 and evexmap6.
96028                 (build_evex_prefix): Handle EVEXMAP5 and EVEXMAP6.
96029                 (check_VecOperations): Handle {1to32}.
96030                 (check_VecOperands): Handle CheckRegNumb.
96031                 (check_word_reg): Handle Toqword.
96032                 (i386_error): Add invalid_dest_and_src_register_set.
96033                 (match_template): Handle invalid_dest_and_src_register_set.
96034                 * doc/c-i386.texi: Document avx512_fp16, noavx512_fp16.
96035
96036         opcodes/
96037
96038         2021-08-05  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
96039                     H.J. Lu  <hongjiu.lu@intel.com>
96040                     Wei Xiao <wei3.xiao@intel.com>
96041                     Lili Cui  <lili.cui@intel.com>
96042
96043                 * i386-dis.c (EXwScalarS): New.
96044                 (EXxh): Ditto.
96045                 (EXxhc): Ditto.
96046                 (EXxmmqh): Ditto.
96047                 (EXxmmqdh): Ditto.
96048                 (EXEvexXwb): Ditto.
96049                 (DistinctDest_Fixup): Ditto.
96050                 (enum): Add xh_mode, evex_half_bcst_xmmqh_mode, evex_half_bcst_xmmqdh_mode
96051                 and w_swap_mode.
96052                 (enum): Add PREFIX_EVEX_0F3A08_W_0, PREFIX_EVEX_0F3A0A_W_0,
96053                 PREFIX_EVEX_0F3A26, PREFIX_EVEX_0F3A27, PREFIX_EVEX_0F3A56,
96054                 PREFIX_EVEX_0F3A57, PREFIX_EVEX_0F3A66, PREFIX_EVEX_0F3A67,
96055                 PREFIX_EVEX_0F3AC2, PREFIX_EVEX_MAP5_10, PREFIX_EVEX_MAP5_11,
96056                 PREFIX_EVEX_MAP5_1D, PREFIX_EVEX_MAP5_2A, PREFIX_EVEX_MAP5_2C,
96057                 PREFIX_EVEX_MAP5_2D, PREFIX_EVEX_MAP5_2E, PREFIX_EVEX_MAP5_2F,
96058                 PREFIX_EVEX_MAP5_51, PREFIX_EVEX_MAP5_58, PREFIX_EVEX_MAP5_59,
96059                 PREFIX_EVEX_MAP5_5A_W_0, PREFIX_EVEX_MAP5_5A_W_1,
96060                 PREFIX_EVEX_MAP5_5B_W_0, PREFIX_EVEX_MAP5_5B_W_1,
96061                 PREFIX_EVEX_MAP5_5C, PREFIX_EVEX_MAP5_5D, PREFIX_EVEX_MAP5_5E,
96062                 PREFIX_EVEX_MAP5_5F, PREFIX_EVEX_MAP5_78, PREFIX_EVEX_MAP5_79,
96063                 PREFIX_EVEX_MAP5_7A, PREFIX_EVEX_MAP5_7B, PREFIX_EVEX_MAP5_7C,
96064                 PREFIX_EVEX_MAP5_7D_W_0, PREFIX_EVEX_MAP6_13, PREFIX_EVEX_MAP6_56,
96065                 PREFIX_EVEX_MAP6_57, PREFIX_EVEX_MAP6_D6, PREFIX_EVEX_MAP6_D7
96066                 (enum): Add EVEX_MAP5 and EVEX_MAP6.
96067                 (enum): Add EVEX_W_MAP5_5A, EVEX_W_MAP5_5B,
96068                 EVEX_W_MAP5_78_P_0, EVEX_W_MAP5_78_P_2, EVEX_W_MAP5_79_P_0,
96069                 EVEX_W_MAP5_79_P_2, EVEX_W_MAP5_7A_P_2, EVEX_W_MAP5_7A_P_3,
96070                 EVEX_W_MAP5_7B_P_2, EVEX_W_MAP5_7C_P_0, EVEX_W_MAP5_7C_P_2,
96071                 EVEX_W_MAP5_7D, EVEX_W_MAP6_13_P_0, EVEX_W_MAP6_13_P_2,
96072                 (get_valid_dis386): Properly handle new instructions.
96073                 (intel_operand_size): Handle new modes.
96074                 (OP_E_memory): Ditto.
96075                 (OP_EX): Ditto.
96076                 * i386-dis-evex.h: Updated for AVX512_FP16.
96077                 * i386-dis-evex-mod.h: Updated for AVX512_FP16.
96078                 * i386-dis-evex-prefix.h: Updated for AVX512_FP16.
96079                 * i386-dis-evex-reg.h : Updated for AVX512_FP16.
96080                 * i386-dis-evex-w.h : Updated for AVX512_FP16.
96081                 * i386-gen.c (cpu_flag_init): Add CPU_AVX512_FP16_FLAGS,
96082                 and CPU_ANY_AVX512_FP16_FLAGS. Update CPU_ANY_AVX512F_FLAGS
96083                 and CPU_ANY_AVX512BW_FLAGS.
96084                 (cpu_flags): Add CpuAVX512_FP16.
96085                 (opcode_modifiers): Add DistinctDest.
96086                 * i386-opc.h (enum): (AVX512_FP16): New.
96087                 (i386_opcode_modifier): Add reqdistinctreg.
96088                 (i386_cpu_flags): Add cpuavx512_fp16.
96089                 (EVEXMAP5): Defined as a macro.
96090                 (EVEXMAP6): Ditto.
96091                 * i386-opc.tbl: Add Intel AVX512_FP16 instructions.
96092                 * i386-init.h: Regenerated.
96093                 * i386-tbl.h: Ditto.
96094
96095 2021-08-05  Alan Modra  <amodra@gmail.com>
96096
96097         PR28167, vms-alpha build_module_list
96098                 PR 28167
96099                 * vms-alpha.c (build_module_list): Malloc and free section contents.
96100                 Don't read past end of section.
96101
96102 2021-08-05  Alan Modra  <amodra@gmail.com>
96103
96104         PR28166, _bfd_elf_mips_get_relocated_section_contents
96105         Some of the code paths unpacking mips relocs left arelent->sym_ptr_ptr
96106         uninitialised.
96107
96108                 PR 28166
96109                 * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Don't leave
96110                 sym_ptr_ptr uninitialised.
96111
96112 2021-08-05  Alan Modra  <amodra@gmail.com>
96113
96114         PR28165, buffer overflow in elf32-rx.c:rx_info_to_howto_rela
96115                 PR 28165
96116                 * elf32-rx.c (rx_elf_howto_table): Add missing empty entries.
96117                 (rx_info_to_howto_rela): Assert rx_elf_howto_table is correct size.
96118                 Use actual size when sanity checking r_type.
96119
96120 2021-08-05  Alan Modra  <amodra@gmail.com>
96121
96122         Re: elf: Treat undefined version as hidden
96123         Fix fallout in cris testsuite
96124
96125                 PR binutils/28158
96126                 * ld-cris/libdso-1c.d: Update for version display change.
96127                 * ld-cris/libdso-15b.d: Likewise.
96128
96129 2021-08-05  Andrew Burgess  <andrew.burgess@embecosm.com>
96130
96131         gdb/testsuite: update test gdb.base/step-over-syscall.exp
96132         I was looking at PR gdb/19675 and the related test
96133         gdb.base/step-over-syscall.exp.  This test includes a call to kfail
96134         when we are testing a displaced step over a clone syscall.
96135
96136         While looking at the test I removed the call to kfail and ran the
96137         test, and was surprised that the test passed.
96138
96139         I ran the test a few times and it does sometimes fail, but mostly it
96140         passed fine.
96141
96142         PR gdb/19675 describes how, when we displaced step over a clone, the
96143         new thread is created with a $pc in the displaced step buffer.  GDB
96144         then fails to "fix" this $pc (for the new thread), and the thread will
96145         be set running with its current $pc value.  This means that the new
96146         thread will just start executing from whatever happens to be after the
96147         displaced stepping buffer.
96148
96149         In the original PR gdb/19675 bug report Yao Qi was seeing the new
96150         thread cause a segfault, the problem is, what actually happens is
96151         totally undefined.
96152
96153         On my machine, I'm seeing the new thread reenter main, it then starts
96154         trying to run the test again (in the new thread).  This just happens
96155         to be safe enough (in this simple test) that most of the time the
96156         inferior doesn't crash.
96157
96158         In this commit I try to make the test slightly more likely to fail by
96159         doing a couple of things.
96160
96161         First, I added a static variable to main, this is set true when the
96162         first thread enters main, if a second thread ever enters main then I
96163         force an abort.
96164
96165         Second, when the test is finishing I want to ensure that the new
96166         threads have had a chance to do "something bad" if they are going to.
96167         So I added a global counter, as each thread starts successfully it
96168         decrements the counter.  The main thread does not proceed to the final
96169         marker function (where GDB has placed a breakpoint) until all threads
96170         have started successfully.  This means that if the newly created
96171         thread doesn't successfully enter clone_fn then the counter will never
96172         reach zero and the test will timeout.
96173
96174         With these two changes my hope is that the test should fail more
96175         reliably, and so, I have also changed the test to call setup_kfail
96176         before the specific steps that we expect to misbehave instead of just
96177         calling kfail and skipping parts of the test completely.  The benefit
96178         of this is that if/when we fix GDB this test will start to KPASS and
96179         we'll know to update this test to remove the setup_kfail call.
96180
96181 2021-08-05  GDB Administrator  <gdbadmin@sourceware.org>
96182
96183         Automatic date update in version.in
96184
96185 2021-08-05  Lancelot SIX  <lsix@lancelotsix.com>
96186
96187         gdb: Use unwinder name in frame_info::to_string
96188         While working on a stack unwinding issue using 'set debug frame on', I
96189         noticed the frame_info::to_string method could be slightly improved.
96190
96191         Unwinders have been given a name in
96192         a154d838a70e96d888620c072e2d6ea8bdf044ca.  Before this patch, frame_info
96193         debug output prints the host address of the used unwinder, which is not
96194         easy to interpret.  This patch proposes to use the unwinder name
96195         instead since we now have it.
96196
96197         Before the patch:
96198
96199             {level=1,type=NORMAL_FRAME,unwind=0x2ac1763ec0,pc=0x3ff7fc3460,id={stack=0x3ff7ea79b0,code=0x0000003ff7fc33ac,!special},func=0x3ff7fc33ac}
96200
96201         With the patch:
96202
96203             {level=1,type=NORMAL_FRAME,unwinder="riscv prologue",pc=0x3ff7fc3460,id={stack=0x3ff7ea79b0,code=0x0000003ff7fc33ac,!special},func=0x3ff7fc33ac}
96204
96205         Tested on riscv64-linux-gnu.
96206
96207 2021-08-04  Simon Marchi  <simon.marchi@polymtl.ca>
96208
96209         gdb/testsuite: fix gdb.base/info-macros.exp with clang
96210         The test gdb.base/info-macros.exp says that it doesn't pass the "debug"
96211         option to prepare_for_testing because that would cause -g to appear
96212         after -g3 on the command line, and that would cause some gcc versions to
96213         not include macro info.  I don't know what gcc versions this refers to.
96214         I tested with gcc 4.8, and that works fine with -g after -g3.
96215
96216         The current state is problematic when testing with CC_FOR_TARGET=clang,
96217         because then only -fdebug-macro is included.  No -g switch if included,
96218         meaning we get a binary without any debug info, and the test fails.
96219
96220         One way to fix it would be to add "debug" to the options when the
96221         compiler is clang.
96222
96223         However, the solution I chose was to specify "debug" in any case, even
96224         for gcc.  Other macro tests such as gdb.base/macscp.exp do perfectly
96225         fine with it.  Also, this lets the test use the debug flag specified by
96226         the board file.  For example, we can test with GCC and DWARF 5, with:
96227
96228             $ make check RUNTESTFLAGS="--target_board unix/gdb:debug_flags=-gdwarf-5" TESTS="gdb.base/info-macros.exp"
96229
96230         With the hard-coded -g3, this wouldn't actually test with DWARF 5.
96231
96232         Change-Id: I33fa92ee545007d3ae9c52c4bb2d5be6b5b698f1
96233
96234 2021-08-04  Simon Marchi  <simon.marchi@polymtl.ca>
96235
96236         gdb: avoid dereferencing empty str_offsets_base optional in dwarf_decode_macros
96237         Since 4d7188abfdf2 ("gdbsupport: add debug assertions in
96238         gdb::optional::get"), some macro-related tests fail on Ubuntu 20.04 with
96239         the system gcc 9.3.0 compiler when building with _GLIBCXX_DEBUG.  For
96240         example, gdb.base/info-macros.exp results in:
96241
96242            (gdb) break -qualified main
96243            /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/gdb_optional.h:206: internal-error: T& gdb::optional<T>::get() [with T = long unsigned int]: Assertion `this->has_value ()' failed.
96244
96245         The binary contains DWARF 4 debug info and includes a pre-standard
96246         (pre-DWARF 5) .debug_macro section.  The CU doesn't have a
96247         DW_AT_str_offsets_base attribute (which doesn't exist in DWARF 4).  The
96248         field dwarf2_cu::str_offsets_base is therefore empty.  At
96249         dwarf2/read.c:24138, we unconditionally read the value in the optional,
96250         which triggers the assertion shown above.
96251
96252         The same thing happens when building the test program with DWARF 5 with
96253         the same gcc compiler, as that version of gcc doesn't use indirect
96254         string forms, even with DWARF 5.  So it still doesn't add a
96255         DW_AT_str_offsets_base attribute on the CU.
96256
96257         Fix that by propagating down a gdb::optional<ULONGEST> for the str
96258         offsets base instead of ULONGEST.  That value is only used in
96259         dwarf_decode_macro_bytes, when encountering an "strx" macro operation
96260         (DW_MACRO_define_strx or DW_MACRO_undef_strx).  Add a check there that
96261         we indeed have a value in the optional before reading it.  This is
96262         unlikely to happen, but could happen in theory with an erroneous file
96263         that uses DW_MACRO_define_strx but does not provide a
96264         DW_AT_str_offsets_base (in practice, some things would probably have
96265         failed before and stopped processing of debug info).  I tested the
96266         complaint by inverting the condition and using a clang-compiled binary,
96267         which uses the strx operators.  This is the result:
96268
96269             During symbol reading: use of DW_MACRO_define_strx with unknown string offsets base [in module /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/info-macros/info-macros]
96270
96271         The test now passes cleanly with the setup mentioned above, and the
96272         testsuite looks on par with how it was before 4d7188abfdf2.
96273
96274         Change-Id: I7ebd2724beb7b9b4178872374c2a177aea696e77
96275
96276 2021-08-04  Simon Marchi  <simon.marchi@polymtl.ca>
96277
96278         gdb: fix typo in complaint in dwarf2/macro.c
96279         I saw this complaint when my code had some bug, and spotted the typo.
96280         Fix it, and while at it mention DW_MACRO as well (it would be confusing
96281         to only see DW_MACINFO with a file that uses a DWARF 5 .debug_macro
96282         section).  I contemplated the idea of passing the knowledge of whether
96283         we are dealing with a .debug_macro section or .debug_macinfo section, to
96284         print only the right one.  But in the end, I don't think that trouble is
96285         necessary for a complaint nobody is going to see.
96286
96287         Change-Id: I276ce8da65c3eac5304f64a1e246358ed29cdbbc
96288
96289 2021-08-04  Simon Marchi  <simon.marchi@polymtl.ca>
96290
96291         gdb: fix warnings in bsd-kvm.c
96292         Building on OpenBSD, I get warnings like:
96293
96294               CXX    bsd-kvm.o
96295             /home/simark/src/binutils-gdb/gdb/bsd-kvm.c:241:18: error: ISO C++11 does not allow conversion from string literal to 'char *' [-Werror,-Wwritable-strings]
96296               nl[0].n_name = "_dumppcb";
96297                              ^
96298
96299         Silence those by adding casts.
96300
96301         Change-Id: I2bef4eebcc306762a4e3e5b5c52f67ecf2820503
96302
96303 2021-08-04  Andreas Krebbel  <krebbel@linux.ibm.com>
96304
96305         IBM Z: Remove lpswey parameter
96306         opcodes/
96307                 * s390-opc.c (INSTR_SIY_RD): New instruction format.
96308                 (MASK_SIY_RD): New instruction mask.
96309                 * s390-opc.txt: Change instruction format of lpswey to SIY_RD.
96310
96311         gas/
96312                 * testsuite/gas/s390/zarch-arch14.d: Remove last operand of
96313                 lpswey.
96314                 * testsuite/gas/s390/zarch-arch14.s: Likewise.
96315
96316 2021-08-04  Alan Modra  <amodra@gmail.com>
96317
96318         PR28162, segment fault in mips_elf_assign_gp
96319         For the testcase in the PR, _bfd_mips_elf32_gprel16_reloc is passed a
96320         NULL output_bfd.  As expected for reloc special functions if called by
96321         objdump or when final linking.  The function attempts to find the
96322         output by
96323           output_bfd = symbol->section->output_section->owner;
96324         That makes some sense, since when handling a gp-relative reloc we need
96325         the relevant gp to which the symbol is relative.  Possibly the gp
96326         value can be one for a shared library?  But that doesn't seem useful
96327         or supported by the various abi docs and won't work as written.
96328         Symbols defined in shared libraries have section->output_section
96329         NULL, and what's more the code in mips_elf_assign_gp isn't set up to
96330         look at shared library symbols.
96331
96332         Also, if the symbol is a SHN_ABS one the owner of *ABS* section is
96333         NULL, which will result in the testcase segfault.  The only gp to
96334         which an absolute symbol can be relative is the linker output bfd when
96335         linking, or the input bfd when not.  This patch arranges to do that
96336         for all gp-relative reloc symbols.
96337
96338                 * elf32-mips.c (_bfd_mips_elf32_gprel16_reloc): Don't use the
96339                 section symbol to find the output bfd, use input_section.
96340                 (mips_elf_gprel32_reloc, mips16_gprel_reloc): Likewise.
96341                 * elf64-mips.c (mips_elf64_gprel16_reloc): Likewise.
96342                 (mips_elf64_literal_reloc, mips_elf64_gprel32_reloc): Likewise.
96343                 (mips16_gprel_reloc): Likewise.
96344
96345 2021-08-04  Tom de Vries  <tdevries@suse.de>
96346
96347         [gdb/symtab] Use lambda function instead of addrmap_foreach_check
96348         Use a lambda function instead of addrmap_foreach_check,
96349         which removes the need for static variables.
96350
96351         Also remove unnecessary static on local var temp_obstack in test_addrmap.
96352
96353         gdb/ChangeLog:
96354
96355         2021-08-04  Tom de Vries  <tdevries@suse.de>
96356
96357                 * addrmap.c (addrmap_foreach_check): Remove.
96358                 (array, val1, val2): Move ...
96359                 (test_addrmap): ... here.  Remove static on temp_obstack.  Use lambda
96360                 function instead of addrmap_foreach_check.
96361
96362 2021-08-04  H.J. Lu  <hjl.tools@gmail.com>
96363
96364         elf: Treat undefined version as hidden
96365         Since undefined version can't be used to resolve any references without
96366         the original definition, treat it as hidden.
96367
96368         bfd/
96369
96370                 PR binutils/28158
96371                 * elf.c (_bfd_elf_get_symbol_version_string): Treat undefined
96372                 version as hidden.
96373
96374         ld/
96375
96376                 PR binutils/28158
96377                 * testsuite/ld-elf/linux-x86.exp: Run PR binutils/28158 tests.
96378                 * testsuite/ld-elf/pr28158-1.c: New file.
96379                 * testsuite/ld-elf/pr28158-2.S: Likewise.
96380                 * testsuite/ld-elf/pr28158.nd: Likewise.
96381                 * testsuite/ld-elf/pr28158.rd: Likewise.
96382                 * testsuite/ld-elf/pr28158.t: Likewise.
96383                 * testsuite/ld-elfvers/vers2.dsym: Updated.
96384                 * testsuite/ld-elfvers/vers3.dsym: Likewise.
96385                 * testsuite/ld-elfvers/vers6.dsym: Likewise.
96386                 * testsuite/ld-elfvers/vers19.dsym: Likewise.
96387                 * testsuite/ld-elfvers/vers22.dsym: Likewise.
96388                 * testsuite/ld-elfvers/vers23.dsym: Likewise.
96389                 * testsuite/ld-elfvers/vers23d.dsym: Likewise.
96390                 * testsuite/ld-elfvers/vers27d4.dsym: Likewise.
96391                 * testsuite/ld-elfvers/vers28c.dsym: Likewise.
96392
96393 2021-08-04  Tom de Vries  <tdevries@suse.de>
96394
96395         [gdb/symtab] Implement addrmap_mutable_find
96396         Currently addrmap_mutable_find is not implemented:
96397         ...
96398         static void *
96399         addrmap_mutable_find (struct addrmap *self, CORE_ADDR addr)
96400         {
96401           /* Not needed yet.  */
96402           internal_error (__FILE__, __LINE__,
96403                           _("addrmap_find is not implemented yet "
96404                             "for mutable addrmaps"));
96405         }
96406         ...
96407
96408         I implemented this because I needed it during debugging, to be able to do:
96409         ...
96410         (gdb) p ((dwarf2_psymtab *)addrmap_find (map, addr))->filename
96411         ...
96412         before and after a call to addrmap_set_empty.
96413
96414         Since this is not used otherwise, added addrmap unit test.
96415
96416         Build on x86_64-linux, tested by doing:
96417         ...
96418         $ gdb -q -batch -ex "maint selftest addrmap"
96419         Running selftest addrmap.
96420         Ran 1 unit tests, 0 failed
96421         ...
96422
96423         gdb/ChangeLog:
96424
96425         2021-08-03  Tom de Vries  <tdevries@suse.de>
96426
96427                 * gdb/addrmap.c (addrmap_mutable_find): Implement
96428                 [GDB_SELF_TESTS] (CHECK_ADDRMAP_FIND): New macro.
96429                 [GDB_SELF_TESTS] (core_addr, addrmap_foreach_check, test_addrmap)
96430                 (_initialize_addrmap): New function.
96431
96432 2021-08-04  Clément Chigot  <clement.chigot@atos.net>
96433
96434         gas: correctly output XCOFF tbss symbols with XTY_CM type.
96435         Global tbss symbols weren't correctly handled and were generating
96436         a symbol with XTY_SD instead of XTY_CM as expected.
96437
96438         gas/
96439                 * config/tc-ppc.c (ppc_frog_symbol): Generate a XTY_CM when
96440                 a symbol has a storage class of XMC_UL.
96441
96442 2021-08-04  Clément Chigot  <clement.chigot@atos.net>
96443
96444         gas: always add dummy symbols when creating XCOFF sections.
96445         Most of the algorithms for XCOFF in tc-ppc.c assume that
96446         the csects field of a ppc_xcoff_section isn't NULL.
96447         This was already made for most of the sections with the creation
96448         of a dummy symbol.
96449         This patch simply mades it default when creating a xcoff_section.
96450
96451         gas/
96452                 * config/tc-ppc.c (ppc_init_xcoff_section): Always create
96453                 the dummy symbol.
96454                 (md_begin): Adjust ppc_init_xcoff_section call.
96455                 (ppc_comm): Likewise.
96456                 (ppc_change_csect): Likewise.
96457
96458 2021-08-04  Alan Modra  <amodra@gmail.com>
96459
96460         PR28156, rename.c doesn't compile with MinGW
96461         Guard against lack of struct timespec definition.
96462
96463                 PR 28156
96464                 * rename.c (get_stat_atime, get_stat_mtime): Don't compile
96465                 unless HAVE_UTIMENSAT is defined.
96466
96467 2021-08-04  Alan Modra  <amodra@gmail.com>
96468
96469         PR28155, Superfluous "the" in the man page
96470                 PR 28155
96471                 * ld.texi (Options <runtime library name>): Correct grammar.
96472
96473         revise PE IMAGE_SCN_LNK_NRELOC_OVFL test
96474                 * coffcode.h (coff_set_alignment_hook): Test that the resulting
96475                 reloc count is not less than 0xffff.
96476
96477 2021-08-04  Simon Marchi  <simon.marchi@polymtl.ca>
96478
96479         gdb: follow-fork: push target and add thread in target_follow_fork
96480         In the context of ROCm-gdb [1], the ROCm target sits on top of the
96481         linux-nat target.  when a process forks, it needs to carry over some
96482         data from the forking inferior to the fork child inferior.  Ideally, the
96483         ROCm target would implement the follow_fork target_ops method, but there
96484         are some small problems.  This patch fixes these, which helps the ROCm
96485         target, but also makes things more consistent and a bit nicer in
96486         general, I believe.
96487
96488         The main problem is: when follow-fork-mode is "parent",
96489         target_follow_fork is called with the parent as the current inferior.
96490         When it's "child", target_follow_fork is called with the child as the
96491         current inferior.  This means that target_follow_fork is sometimes
96492         called on the parent's target stack and sometimes on the child's target
96493         stack.
96494
96495         The parent's target stack may contain targets above the process target,
96496         such as the ROCm target.  So if follow-fork-child is "parent", the ROCm
96497         target would get notified of the fork and do whatever is needed.  But
96498         the child's target stack, at that moment, only contains the exec and
96499         process target copied over from the parent.  The child's target stack is
96500         set up by follow_fork_inferior, before calling target_follow_fork.  In
96501         that case, the ROCm target wouldn't get notified of the fork.
96502
96503         For consistency, I think it would be good to always call
96504         target_follow_fork on the parent inferior's target stack.  I think it
96505         makes sense as a way to indicate "this inferior has called fork, do
96506         whatever is needed".  The desired outcome of the fork (whether an
96507         inferior is created for the child, do we need to detach from the child)
96508         can be indicated by passed parameter.
96509
96510         I therefore propose these changes:
96511
96512          - make follow_fork_inferior always call target_follow_fork with the
96513            parent as the current inferior.  That lets all targets present on the
96514            parent's target stack do some fork-related handling and push
96515            themselves on the fork child's target stack if needed.
96516
96517            For this purpose, pass the child inferior down to target_follow_fork
96518            and follow_fork implementations.  This is nullptr if no inferior is
96519            created for the child, because we want to detach from it.
96520
96521          - as a result, in follow_fork_inferior, detach from the parent inferior
96522            (if needed) only after the target_follow_fork call.  This is needed
96523            because we want to call target_follow_fork before the parent's
96524            target stack is torn down.
96525
96526          - hand over to the targets in the parent's target stack (including the
96527            process target) the responsibility to push themselves, if needed, to
96528            the child's target stack.  Also hand over the responsibility to the
96529            process target, at the same time, to create the child's initial
96530            thread (just like we do for follow_exec).
96531
96532          - pass the child inferior to exec_on_vfork, so we don't need to swap
96533            the current inferior between parent and child.  Nothing in
96534            exec_on_vfork depends on the current inferior, after this change.
96535
96536            Although this could perhaps be replaced with just having the exec
96537            target implement follow_fork and push itself in the child's target
96538            stack, like the process target does... We would just need to make
96539            sure the process target calls beneath()->follow_fork(...).  I'm not
96540            sure about this one.
96541
96542         gdb/ChangeLog:
96543
96544                 * target.h (struct target_ops) <follow_fork>: Add inferior*
96545                 parameter.
96546                 (target_follow_fork): Likewise.
96547                 * target.c (default_follow_fork): Likewise.
96548                 (target_follow_fork): Likewise.
96549                 * fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Likewise.
96550                 (fbsd_nat_target::follow_fork): Likewise, and call
96551                 inf_ptrace_target::follow_fork.
96552                 * linux-nat.h (class linux_nat_target) <follow_fork>: Likewise.
96553                 * linux-nat.c (linux_nat_target::follow_fork): Likewise, and
96554                 call inf_ptrace_target::follow_fork.
96555                 * obsd-nat.h (obsd_nat_target) <follow_fork>: Likewise.
96556                 * obsd-nat.c (obsd_nat_target::follow_fork): Likewise, and call
96557                 inf_ptrace_target::follow_fork.
96558                 * remote.c (class remote_target) <follow_fork>: Likewise.
96559                 (remote_target::follow_fork): Likewise, and call
96560                 process_stratum_target::follow_fork.
96561                 * process-stratum-target.h (class process_stratum_target)
96562                 <follow_fork>: New.
96563                 * process-stratum-target.c
96564                 (process_stratum_target::follow_fork): New.
96565                 * target-delegates.c: Re-generate.
96566
96567         [1] https://github.com/ROCm-Developer-Tools/ROCgdb
96568
96569         Change-Id: I460bd0af850f0485e8aed4b24c6d8262a4c69929
96570
96571 2021-08-04  GDB Administrator  <gdbadmin@sourceware.org>
96572
96573         Automatic date update in version.in
96574
96575 2021-08-03  Carl Love  <cel@us.ibm.com>
96576
96577         Fixes for mi-fortran-modules.exp fixes
96578         Output has additional information for a given filename.
96579
96580         gdb/testsuite/ChangeLog
96581                 * gdb.mi/mi-fortran-modules.exp (system_modules_pattern,
96582                 system_module_symbols_pattern): Add check for additional symbols
96583                 on the line
96584
96585 2021-08-03  Simon Marchi  <simon.marchi@polymtl.ca>
96586
96587         gdbsupport: add debug assertions in gdb::optional::get
96588         The libstdc++ version of optional contains some runtime checks enabled
96589         when _GLIBCXX_DEBUG is defined.  I think it would be useful if our
96590         version contained similar checks.
96591
96592         Add checks in the two `get` methods, also conditional on _GLIBCXX_DEBUG.
96593         I think it's simpler to use that macro rather than introducing a new
96594         GDB-specific one, as I think that if somebody is interested in enabling
96595         these runtime checks, they'll also be interested in enabling the
96596         libstdc++ runtime checks (and vice-versa).
96597
96598         I implemented these checks using gdb_assert.  Note that gdb_assert
96599         throws (after querying the user), and we are in noexcept methods.  That
96600         means that std::terminate / abort will immediately be called.  I think
96601         this is ok, since if those were "real" _GLIBCXX_DEBUG checks, abort
96602         would be called straight away.
96603
96604         If I add a dummy failure, it looks like so:
96605
96606             $ ./gdb -q -nx --data-directory=data-directory
96607             /home/simark/src/binutils-gdb/gdb/../gdbsupport/gdb_optional.h:206: internal-error: T& gdb::optional<T>::get() [with T = int]: Assertion `this->has_value ()' failed.
96608             A problem internal to GDB has been detected,
96609             further debugging may prove unreliable.
96610             Quit this debugging session? (y or n) n
96611             [1]    658767 abort (core dumped)  ./gdb -q -nx --data-directory=data-directory
96612
96613         Change-Id: Iadfdcd131425bd2ca6a2de30d7b22e9b3cc67793
96614
96615 2021-08-03  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
96616
96617         [gdb/testsuite] templates.exp to accept clang++ output
96618         Please consider below testcase with intended error.
96619         ``````````
96620             constexpr const char cstring[] = "Eta";
96621             template <const char*, typename T> class Column {};
96622             using quick = Column<cstring,double>; // cstring without '&'
96623
96624             void lookup() {
96625               quick c1;
96626               c1.ls();
96627             }
96628         ``````````
96629         It produces below error.
96630         ``````````
96631         no member named 'ls' in 'Column<&cstring, double>'.
96632         ``````````
96633         Please note that error message contains '&' for cstring, which is absent
96634         in actual program.
96635         Clang++ does not generate & in such cases and this should also be
96636         accepted as correct output.
96637
96638         gdb/testsuite/ChangeLog:
96639
96640                 * gdb.cp/templates.exp: Accept different but correct output
96641                 from the Clang++ compiled binary also.
96642
96643 2021-08-03  GDB Administrator  <gdbadmin@sourceware.org>
96644
96645         Automatic date update in version.in
96646
96647 2021-08-02  Tom Tromey  <tromey@adacore.com>
96648
96649         Handle compiler-generated suffixes in Ada names
96650         The compiler may add a suffix to a mangled name.  A typical example
96651         would be splitting a function and creating a ".cold" variant.
96652
96653         This patch changes Ada decoding (aka demangling) to handle these
96654         suffixes.  It also changes the encoding process to handle them as
96655         well.
96656
96657         A symbol like "function.cold" will now be displayed to the user as
96658         "function[cold]".  The "." is not simply preserved because that is
96659         already used in Ada.
96660
96661 2021-08-02  Tom Tromey  <tromey@adacore.com>
96662
96663         Remove uses of fprintf_symbol_filtered
96664         I believe that many calls to fprintf_symbol_filtered are incorrect.
96665         In particular, there are some that pass a symbol's print name, like:
96666
96667           fprintf_symbol_filtered (gdb_stdout, sym->print_name (),
96668                                    current_language->la_language, DMGL_ANSI);
96669
96670         fprintf_symbol_filtered uses the "demangle" global to decide whether
96671         or not to demangle -- but print_name does this as well.  This can lead
96672         to double-demangling.  Normally this could be innocuous, except I also
96673         plan to change Ada demangling in a way that causes this to fail.
96674
96675 2021-08-02  Tom Tromey  <tromey@adacore.com>
96676
96677         Handle type qualifier for enumeration name
96678         Pierre-Marie noticed that the Ada expression "TYPE'(NAME)" resolved
96679         incorrectly when "TYPE" was an enumeration type.  Here, "NAME" should
96680         be unambiguous.
96681
96682         This patch fixes this problem.  Note that the patch is not perfect --
96683         it does not give an error if TYPE is an enumeration type but NAME is
96684         not an enumerator but does have some other meaning in scope.  Fixing
96685         this proved difficult, and so I've left it out.
96686
96687 2021-08-02  Tom Tromey  <tromey@adacore.com>
96688
96689         Remove the type_qualifier global
96690         The type_qualifier global is no longer needed in the Ada expression
96691         parser, so this removes it.
96692
96693 2021-08-02  Tom Tromey  <tromey@adacore.com>
96694
96695         Defer Ada character literal resolution
96696         In Ada, an enumeration type can use a character literal as one of the
96697         enumerators.  The Ada expression parser handles the appropriate
96698         conversion.
96699
96700         It turns out, though, that this conversion was handled incorrectly.
96701         For an expression like TYPE'(EXP), the conversion would be done for
96702         any such literal appearing in EXP -- but only the outermost such
96703         expression should really be affected.
96704
96705         This patch defers the conversion until the resolution phase, fixing
96706         the bug.
96707
96708 2021-08-02  Tom Tromey  <tromey@adacore.com>
96709
96710         Refactor Ada resolution
96711         In a subsequent patch, it will be convenient if an Ada expression
96712         operation can supply its own replacement object.  This patch refactors
96713         Ada expression resolution to make this possible.
96714
96715         Remove add_symbols_from_enclosing_procs
96716         I noticed that add_symbols_from_enclosing_procs is empty, and can be
96717         removed.  The one caller, ada_add_local_symbols, can also be
96718         simplified, removing some code that, I think, was an incorrect attempt
96719         to handle nested functions.
96720
96721 2021-08-02  Tom Tromey  <tromey@adacore.com>
96722
96723         Avoid crash in varobj deletion
96724         PR varobj/28131 points out a crash in the varobj deletion code.  It
96725         took a while to reproduce this, but essentially what happens is that a
96726         top-level varobj deletes its root object, then deletes the "dynamic"
96727         object.  However, deletion of the dynamic object may cause
96728         ~py_varobj_iter to run, which in turn uses gdbpy_enter_varobj:
96729
96730         gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var)
96731         : gdbpy_enter (var->root->exp->gdbarch, var->root->exp->language_defn)
96732         {
96733         }
96734
96735         However, because var->root has already been destroyed, this is
96736         invalid.
96737
96738         I've added a new test case.  This doesn't reliably crash, but the
96739         problem can easily be seen under valgrind (and, I presume, with ASAN,
96740         though I did not try this).
96741
96742         Tested on x86-64 Fedora 32.  I also propose putting this on the GDB 11
96743         branch, with a suitable ChangeLog entry of course.
96744
96745         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28131
96746
96747 2021-08-02  Tom de Vries  <tdevries@suse.de>
96748
96749         [gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-dwz-m
96750         When running with target board cc-with-dwz-m, we run into:
96751         ...
96752         (gdb) file dw2-using-debug-str-no-debug-str^M
96753         Reading symbols from dw2-using-debug-str-no-debug-str...^M
96754         (gdb) FAIL: gdb.dwarf2/dw2-using-debug-str.exp: file dw2-using-debug-str
96755         ...
96756
96757         With native, the .debug_str section is present in the
96758         dw2-using-debug-str executable, and removed from the
96759         dw2-using-debug-str-no-debug-str executable.  When loading the latter, a dwarf
96760         error is triggered.
96761
96762         With cc-with-dwz-m, the .debug_str section is not present in the
96763         dw2-using-debug-str executable, because it's already moved to
96764         .tmp/dw2-using-debug-str.dwz.  Consequently, the removal has no effect, and no
96765         dwarf error is triggered, which causes the FAIL.
96766
96767         The same problem arises with target board cc-with-gnu-debuglink.
96768
96769         Fix this by detecting whether the .debug_str section is missing, and skipping
96770         the remainder of the test-case.
96771
96772         Tested on x86_64-linux.
96773
96774         gdb/testsuite/ChangeLog:
96775
96776         2021-08-02  Tom de Vries  <tdevries@suse.de>
96777
96778                 * gdb.dwarf2/dw2-using-debug-str.exp: Handle missing .debug_str
96779                 section in dw2-using-debug-str.
96780
96781 2021-08-02  Tom de Vries  <tdevries@suse.de>
96782
96783         [gdb/testsuite] Fix gdb.dwarf2/dw2-using-debug-str.exp with cc-with-gdb-index
96784         When running with target board cc-with-gdb-index, we run into:
96785         ...
96786         (gdb) file dw2-using-debug-str-no-debug-str^M
96787         Reading symbols from dw2-using-debug-str-no-debug-str...^M
96788         Dwarf Error: DW_FORM_strp used without required section^M
96789         (gdb) FAIL: gdb.dwarf2/dw2-using-debug-str.exp: file dw2-using-debug-str
96790         ...
96791
96792         The test expects the dwarf error, but has no matching pattern for the entire
96793         output.
96794
96795         Fix this by updating the regexp.
96796
96797         Tested on x86_64-linux.
96798
96799         gdb/testsuite/ChangeLog:
96800
96801         2021-08-02  Tom de Vries  <tdevries@suse.de>
96802
96803                 * gdb.dwarf2/dw2-using-debug-str.exp: Update regexp to match
96804                 cc-with-gdb-index output.
96805
96806 2021-08-02  Tom de Vries  <tdevries@suse.de>
96807
96808         [gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp with cc-with-gdb-index
96809         When running with target board cc-with-gdb-index, we run into:
96810         ...
96811         rm: cannot remove '/tmp/tmp.JmYTeiuFjj/*.gdb-index': \
96812           No such file or directory^M
96813         FAIL: gdb.dwarf2/per-bfd-sharing.exp: \
96814           couldn't remove files in temporary cache dir
96815         ...
96816
96817         Fix this, as in gdb.base/index-cache.exp, by only FAILing when
96818         $expecting_index_cache_use.
96819
96820         Tested on x86_64-linux.
96821
96822         gdb/testsuite/ChangeLog:
96823
96824         2021-08-02  Tom de Vries  <tdevries@suse.de>
96825
96826                 * gdb.dwarf2/per-bfd-sharing.exp: Only expect index-cache files
96827                 when $expecting_index_cache_use.
96828
96829 2021-08-02  Tom de Vries  <tdevries@suse.de>
96830
96831         [gdb/testsuite] Fix gdb.dwarf2/gdb-index-nodebug.exp with cc-with-gdb-index
96832         When running with target board cc-with-gdb-index, we run into:
96833         ...
96834         (gdb) save gdb-index .^M
96835         Error while writing index for `gdb-index-nodebug': \
96836           Cannot use an index to create the index^M
96837         (gdb) FAIL: gdb.dwarf2/gdb-index-nodebug.exp: try to save gdb index
96838         ...
96839
96840         Fix this by detecting an already present index, and marking the test
96841         unsupported.
96842
96843         Tested on x86_64-linux.
96844
96845         gdb/testsuite/ChangeLog:
96846
96847         2021-08-02  Tom de Vries  <tdevries@suse.de>
96848
96849                 * gdb.dwarf2/gdb-index-nodebug.exp: Mark unsupported when index
96850                 already present.
96851
96852 2021-08-02  Tom de Vries  <tdevries@suse.de>
96853
96854         [gdb/testsuite] Fix gdb.dwarf2/fission-relative-dwo.exp with cc-with-gdb-index
96855         When running with target board cc-with-gdb-index, we run into:
96856         ...
96857         gdb compile failed, warning: Could not find DWO CU \
96858           fission-relative-dwo.dwo(0x1234) referenced by CU at offset 0xc7 \
96859           [in module outputs/gdb.dwarf2/fission-relative-dwo/.tmp/fission-relative-dwo]
96860         UNTESTED: gdb.dwarf2/fission-relative-dwo.exp: fission-relative-dwo.exp
96861         ERROR: failed to compile fission-relative-dwo
96862         ...
96863
96864         The problem is that:
96865         - the .dwo file is found relative to the executable, and
96866         - cc-with-tweaks.sh moves the executable to a temp dir, but not
96867           the .dwo file.
96868
96869         Fix this by copying the .dwo file alongside the executable in the temp dir.
96870
96871         Verified changes using shellcheck.
96872
96873         Tested on x86_64-linux.
96874
96875         gdb/ChangeLog:
96876
96877         2021-08-02  Tom de Vries  <tdevries@suse.de>
96878
96879                 * contrib/cc-with-tweaks.sh: Copy .dwo files alongside executable.
96880
96881 2021-08-02  Shahab Vahedi  <shahab@synopsys.com>
96882
96883         gdb: Make the builtin "boolean" type an unsigned type
96884         When printing the fields of a register that is of a custom struct type,
96885         the "unpack_bits_as_long ()" function is used:
96886
96887             do_val_print (...)
96888               cp_print_value_fields (...)
96889                 value_field_bitfield (...)
96890                   unpack_value_bitfield (...)
96891                     unpack_bits_as_long (...)
96892
96893         This function may sign-extend the extracted field while returning it:
96894
96895             val >>= lsbcount;
96896
96897             if (...)
96898               {
96899                 valmask = (((ULONGEST) 1) << bitsize) - 1;
96900                 val &= valmask;
96901                 if (!field_type->is_unsigned ())
96902                   if (val & (valmask ^ (valmask >> 1)))
96903                       val |= ~valmask;
96904               }
96905
96906             return val;
96907
96908         lsbcount:   Number of lower bits to get rid of.
96909         bitsize:    The bit length of the field to be extracted.
96910         val:        The register value.
96911         field_type: The type of field that is being handled.
96912
96913         While the logic here is correct, there is a problem when it is
96914         handling "field_type"s of "boolean".  Those types are NOT marked
96915         as "unsigned" and therefore they end up being sign extended.
96916         Although this is not a problem for "false" (0), it definitely
96917         causes trouble for "true".
96918
96919         This patch constructs the builtin boolean type as such that it is
96920         marked as an "unsigned" entity.
96921
96922         The issue tackled here was first encountered for arc-elf32 target
96923         running on an x86_64 machine.  The unit-test introduced in this change
96924         has passed for all the targets (--enable-targets=all) running on the
96925         same x86_64 host.
96926
96927         Fixes: https://sourceware.org/PR28104
96928
96929 2021-08-02  GDB Administrator  <gdbadmin@sourceware.org>
96930
96931         Automatic date update in version.in
96932
96933 2021-08-01  Tom de Vries  <tdevries@suse.de>
96934
96935         [gdb/testsuite] Fix gdb.base/maint.exp with cc-with-gdb-index
96936         With target board cc-with-gdb-index we run into:
96937         ...
96938         FAIL: gdb.base/maint.exp: maint print statistics
96939         ...
96940
96941         The output that is checked is:
96942         ...
96943         Statistics for 'maint':^M
96944           Number of "minimal" symbols read: 53^M
96945           Number of "full" symbols read: 40^M
96946           Number of "types" defined: 60^M
96947           Number of symbol tables: 7^M
96948           Number of symbol tables with line tables: 2^M
96949           Number of symbol tables with blockvectors: 2^M
96950           Number of read CUs: 2^M
96951           Number of unread CUs: 5^M
96952           Total memory used for objfile obstack: 20320^M
96953           Total memory used for BFD obstack: 4064^M
96954           Total memory used for string cache: 4064^M
96955         ...
96956         and the regexp doesn't match because it expects the "Number of read/unread
96957         CUs" lines in a different place.
96958
96959         Fix this by updating the regexp.
96960
96961         Tested on x86_64-linux.
96962
96963         gdb/testsuite/ChangeLog:
96964
96965         2021-08-01  Tom de Vries  <tdevries@suse.de>
96966
96967                 * gdb.base/maint.exp: Update "maint print statistics" to match
96968                 output with target board cc-with-gdb-index.
96969
96970 2021-08-01  Tom de Vries  <tdevries@suse.de>
96971
96972         [gdb/testsuite] Fix gdb.base/index-cache.exp with cc-with-gdb-index
96973         With target board cc-with-gdb-index we run into:
96974         ...
96975         FAIL: gdb.base/index-cache.exp: couldn't remove files in temporary cache dir
96976         ...
96977
96978         The problem is that there are no files to remove, because the index cache
96979         isn't used, as indicated by $expecting_index_cache_use.
96980
96981         Fix this by only FAILing when $expecting_index_cache_use.
96982
96983         Tested on x86_64-linux.
96984
96985         gdb/testsuite/ChangeLog:
96986
96987         2021-08-01  Tom de Vries  <tdevries@suse.de>
96988
96989                 * gdb.base/index-cache.exp:
96990
96991 2021-08-01  GDB Administrator  <gdbadmin@sourceware.org>
96992
96993         Automatic date update in version.in
96994
96995 2021-07-31  GDB Administrator  <gdbadmin@sourceware.org>
96996
96997         Automatic date update in version.in
96998
96999 2021-07-30  Tom Tromey  <tom@tromey.com>
97000
97001         Use iterator_range in more places
97002         This changes a couple of spots to replace custom iterator range
97003         classes with a specialization of iterator_range.
97004
97005         Regression tested on x86-64 Fedora 34.
97006
97007 2021-07-30  Tom Tromey  <tom@tromey.com>
97008
97009         Replace exception_print_same with operator!=
97010         I noticed that exception_print_same is only used in a single spot, and
97011         it seemed to be better as an operator!= method attached to
97012         gdb_exception.
97013
97014         Regression tested on x86-64 Fedora 34.
97015
97016 2021-07-30  Tom de Vries  <tdevries@suse.de>
97017
97018         [gdb/build] Disable attribute nonnull
97019         With trunk gcc (12.0) we're running into a -Werror=nonnull-compare build
97020         breaker in gdb, which caused a broader review of the usage of the nonnull
97021         attribute.
97022
97023         The current conclusion is that it's best to disable this.  This is explained
97024         at length in the gdbsupport/common-defs.h comment.
97025
97026         Tested by building with trunk gcc.
97027
97028         gdb/ChangeLog:
97029
97030         2021-07-29  Tom de Vries  <tdevries@suse.de>
97031
97032                 * gdbsupport/common-defs.h (ATTRIBUTE_NONNULL): Disable.
97033
97034 2021-07-30  Clément Chigot  <clement.chigot@atos.net>
97035
97036         gas: ensure XCOFF DWARF subsection are initialized to 0
97037         debug_abbrev doesn't use end_exp to compute its size. However, it must
97038         be NULL. Otherwise, ppc_xcoff_end might try to access uninitialized
97039         memory.
97040
97041         gas/
97042                 * config/tc-ppc.c (ppc_dwsect): Use XCNEW instead of XNEW when creating
97043                 a new subsection.
97044
97045 2021-07-30  Clément Chigot  <clement.chigot@atos.net>
97046
97047         bfd: ensure that symbols targeted by DWARF relocations are kept in XCOFF
97048         This patch improves XCOFF garbage collector pass, in order to keep
97049         symbols being referenced only by special sections like DWARF sections.
97050
97051         bfd/
97052                 * xcofflink.c (xcoff_mark): Replace SEC_MARK by gc_mark.
97053                 Look through relocations even if xcoff_section_data is NULL.
97054                 (xcoff_sweep): Check if any sections of a file is kept before
97055                 adding its special sections.
97056                 Call xcoff_mark for special sessions being kept instead of just
97057                 marking them.
97058                 (SEC_MARK): Remove
97059                 (xcoff_mark_symbol): Replace SEC_MARK by gc_mark.
97060                 (xcoff_keep_symbol_p): Likewise.
97061                 (bfd_xcoff_size_dynamic_sections): Likewise.
97062                 (xcoff_find_tc0): Likewise.
97063
97064 2021-07-30  Clément Chigot  <clement.chigot@atos.net>
97065
97066         bfd: avoid a crash when debug_section isn't created in XCOFF
97067         bfd/
97068                 * xcofflink.c (bfd_xcoff_size_dynamic_sections):
97069                 Add check to know if debug_section is initialized.
97070
97071 2021-07-30  Alan Modra  <amodra@gmail.com>
97072
97073         readelf: catch archive_file_size of -1
97074         Fuzzers might put -1 in arhdr.ar_size.  If the size is rounded up to
97075         and even number of bytes we get zero.
97076
97077                 * readelf.c (process_archive): Don't round up archive_file_size.
97078                 Do round up next_arhdr_offset calculation.
97079
97080 2021-07-30  Alan Modra  <amodra@gmail.com>
97081
97082         reloc_upper_bound size calculations
97083         Section reloc_count is an unsigned int.  Adding one for a NULL
97084         terminator to an array of arelent pointers can wrap the count to
97085         zero.  Avoid that by doing the addition as longs.
97086
97087                 * coffgen.c (coff_get_reloc_upper_bound): Don't overflow unsigned
97088                 int expression.
97089                 * elf.c (_bfd_elf_get_reloc_upper_bound): Likewise.
97090                 * elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Likewise.
97091                 * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
97092                 * vms-alpha.c (alpha_vms_get_reloc_upper_bound): Likewise.
97093
97094 2021-07-30  Alan Modra  <amodra@gmail.com>
97095
97096         Sanity check _bfd_coff_read_string_table
97097                 * coffgen.c (_bfd_coff_read_string_table): Catch overflows
97098                 when calculating string table file location.
97099
97100 2021-07-30  Alan Modra  <amodra@gmail.com>
97101
97102         IMAGE_SCN_LNK_NRELOC_OVFL
97103         From microsoft docs: It is an error if IMAGE_SCN_LNK_NRELOC_OVFL is
97104         set and there are fewer than 0xffff relocations in the section.
97105
97106                 * coffcode.h (coff_set_alignment_hook): Sanity check overflow
97107                 reloc count.
97108
97109 2021-07-30  Simon Marchi  <simon.marchi@polymtl.ca>
97110
97111         gdb: fix nr_bits gdb_assert in append_flags_type_field
97112         The assertion
97113
97114             gdb_assert (nr_bits >= 1 && nr_bits <= type_bitsize);
97115
97116         is not correct.  Well, it's correct in that we do want the number of
97117         bits to be in the range [1, type_bitsize].  But we don't check anywhere
97118         that the end of the specified flag is within the containing type.
97119
97120         The following code should generate a failed assertion, as the flag goes
97121         past the 32 bits of the underlying type, but it's currently not caught:
97122
97123             static void
97124             test_print_flag (gdbarch *arch)
97125             {
97126               type *flags_type = arch_flags_type (arch, "test_type", 32);
97127               type *field_type = builtin_type (arch)->builtin_uint32;
97128               append_flags_type_field (flags_type, 31, 2, field_type, "invalid");
97129             }
97130
97131         (You can test this by registering it as a selftest using
97132         selftests::register_test_foreach_arc and running.)
97133
97134         Change the assertion to verify that the end bit is within the range of
97135         the underlying type.  This implicitly verifies that nr_bits is not
97136         too big as well, so we don't need a separate assertion for that.
97137
97138         Change-Id: I9be79e5fd7a5917bf25b03b598727e6274c892e8
97139         Co-Authored-By: Tony Tye <Tony.Tye@amd.com>
97140
97141 2021-07-30  GDB Administrator  <gdbadmin@sourceware.org>
97142
97143         Automatic date update in version.in
97144
97145 2021-07-29  John Baldwin  <jhb@FreeBSD.org>
97146
97147         obsd-nat: Report both thread and PID in ::pid_to_str.
97148         This improves the output of info threads when debugging multiple
97149         inferiors (e.g. after a fork with detach_on_fork disabled).
97150
97151 2021-07-29  John Baldwin  <jhb@FreeBSD.org>
97152
97153         obsd-nat: Various fixes for fork following.
97154         - Don't use #ifdef's on ptrace ops.  obsd-nat.h didn't include
97155           <sys/ptrace.h>, so the virtual methods weren't always overridden
97156           causing the fork following to not work.  In addition, the thread and
97157           fork code is intertwined in ::wait and and the lack of #ifdef's
97158           there already assumed both were present.  Finally, both of these
97159           ptrace ops have been present in OpenBSD for at least 10 years.
97160
97161         - Move duplicated code to enable PTRACE_FORK event reporting to a
97162           single function and invoke it on new child processes reported via
97163           PTRACE_FORK.
97164
97165         - Don't return early from PTRACE_FORK handling, but instead reset
97166           wptid to the correct ptid if the child reports its event before the
97167           parent.  This allows the ptid fixup code to add thread IDs if the
97168           first event for a process is a PTRACE_FORK event.  This also
97169           properly returns ptid's with thread IDs when reporting PTRACE_FORK
97170           events.
97171
97172         - Handle detach_fork by skipping the PT_DETACH.
97173
97174 2021-07-29  John Baldwin  <jhb@FreeBSD.org>
97175
97176         obsd-nat: Various fixes to obsd_nat_target::wait.
97177         - Call inf_ptrace_target::wait instead of duplicating the code.
97178           Replace a check for WIFSTOPPED on the returned status from waitpid
97179           by checking for TARGET_WAITKIND_STOPPED in the parsed status as is
97180           done in fbsd_nat_target::wait.
97181
97182         - Don't use inferior_ptid when deciding if a new process is a child vs
97183           parent of the fork.  Instead, use find_inferior_pid and assume that
97184           if an inferior already exists, the pid in question is the parent;
97185           otherwise, the pid is the child.
97186
97187         - Don't use inferior_ptid when deciding if the ptid of the process
97188           needs to be updated with an LWP ID, or if this is a new thread.
97189           Instead, use the approach from fbsd-nat which is to check if a ptid
97190           without an LWP exists and if so update the ptid of that thread
97191           instead of adding a new thread.
97192
97193 2021-07-29  John Baldwin  <jhb@FreeBSD.org>
97194
97195         x86-bsd-nat: Only define gdb_ptrace when using debug registers.
97196         This fixes an unused function warning on OpenBSD which does not
97197         support PT_GETDBREGS.
97198
97199 2021-07-29  John Baldwin  <jhb@FreeBSD.org>
97200
97201         Don't compile x86 debug register support on OpenBSD.
97202         Simon Marchi tried gdb on OpenBSD, and it immediately segfaults when
97203         running a program.  Simon tracked down the problem to x86_dr_low.get_status
97204         being nullptr at this point:
97205
97206             (lldb) print x86_dr_low.get_status
97207             (unsigned long (*)()) $0 = 0x0000000000000000
97208             (lldb) bt
97209             * thread #1, stop reason = step over
97210               * frame #0: 0x0000033b64b764aa gdb`x86_dr_stopped_data_address(state=0x0000033d7162a310, addr_p=0x00007f7ffffc5688) at x86-dregs.c:645:12
97211                 frame #1: 0x0000033b64b766de gdb`x86_dr_stopped_by_watchpoint(state=0x0000033d7162a310) at x86-dregs.c:687:10
97212                 frame #2: 0x0000033b64ea5f72 gdb`x86_stopped_by_watchpoint() at x86-nat.c:206:10
97213                 frame #3: 0x0000033b64637fbb gdb`x86_nat_target<obsd_nat_target>::stopped_by_watchpoint(this=0x0000033b65252820) at x86-nat.h:100:12
97214                 frame #4: 0x0000033b64d3ff11 gdb`target_stopped_by_watchpoint() at target.c:468:46
97215                 frame #5: 0x0000033b6469b001 gdb`watchpoints_triggered(ws=0x00007f7ffffc61c8) at breakpoint.c:4790:32
97216                 frame #6: 0x0000033b64a8bb8b gdb`handle_signal_stop(ecs=0x00007f7ffffc61a0) at infrun.c:6072:29
97217                 frame #7: 0x0000033b64a7e3a7 gdb`handle_inferior_event(ecs=0x00007f7ffffc61a0) at infrun.c:5694:7
97218                 frame #8: 0x0000033b64a7c1a0 gdb`fetch_inferior_event() at infrun.c:4090:5
97219                 frame #9: 0x0000033b64a51921 gdb`inferior_event_handler(event_type=INF_REG_EVENT) at inf-loop.c:41:7
97220                 frame #10: 0x0000033b64a827c9 gdb`infrun_async_inferior_event_handler(data=0x0000000000000000) at infrun.c:9384:3
97221                 frame #11: 0x0000033b6465bd4f gdb`check_async_event_handlers() at async-event.c:335:4
97222                 frame #12: 0x0000033b65070917 gdb`gdb_do_one_event() at event-loop.cc:216:10
97223                 frame #13: 0x0000033b64af0db1 gdb`start_event_loop() at main.c:421:13
97224                 frame #14: 0x0000033b64aefe9a gdb`captured_command_loop() at main.c:481:3
97225                 frame #15: 0x0000033b64aed5c2 gdb`captured_main(data=0x00007f7ffffc6470) at main.c:1353:4
97226                 frame #16: 0x0000033b64aed4f2 gdb`gdb_main(args=0x00007f7ffffc6470) at main.c:1368:7
97227                 frame #17: 0x0000033b6459d787 gdb`main(argc=5, argv=0x00007f7ffffc6518) at gdb.c:32:10
97228                 frame #18: 0x0000033b6459d521 gdb`___start + 321
97229
97230         On BSDs, get_status is set in _initialize_x86_bsd_nat, but only if
97231         HAVE_PT_GETDBREGS is defined.  PT_GETDBREGS doesn't exist on OpenBSD, so
97232         get_status (and the other fields of x86_dr_low) are left as nullptr.
97233
97234         OpenBSD doesn't support getting or setting the x86 debug registers, so
97235         fix by omitting debug register support entirely on OpenBSD:
97236
97237         - Change x86bsd_nat_target to only inherit from x86_nat_target if
97238           PT_GETDBREGS is supported.
97239
97240         - Don't include x86-nat.o and nat/x86-dregs.o for OpenBSD/amd64.  They
97241           were already omitted for OpenBSD/i386.
97242
97243 2021-07-29  Carl Love  <cel@us.ibm.com>
97244
97245         Fix for gdb.tui/tui-layout-asm.exp
97246         The width of the window is too narrow to display the entire assembly line.
97247         The width of the columns in the window changes as the test walks thru the
97248         terminal window output.  The column change results in the first and second
97249         reads of the same line to differ thus causing the test to fail.  Increasing
97250         the width of the window keeps the column width consistent thru the test.
97251
97252         If the test fails, the added check prints an message to the log file if
97253         the failure may be due to the window being too narrow.
97254
97255         gdb/testsuite/ChangeLog
97256
97257                 * gdb.tui/tui-layout-asm.exp: Replace window width of 80 with the
97258                 tui_asm_window_width variable for the width. Add if
97259                 count_whitespace check.
97260                 (count_whitespace): New proc
97261
97262 2021-07-29  George Barrett  <bob@bob131.so>
97263
97264         guile/scm-math: indentation fixes
97265         Changes the indenting of a few expressions in
97266         vlscm_convert_typed_number to be better in line with the prevailing
97267         code style.
97268
97269         gdb/ChangeLog:
97270
97271         2021-07-30  George Barrett  <bob@bob131.so>
97272
97273                 * guile/scm-math.c (vlscm_convert_typed_number): Fix the
97274                 indentation of calls to gdbscm_make_out_of_range_error.
97275
97276         Change-Id: I7463998b77c17a00e88058e89b52fa029ee40e03
97277
97278 2021-07-29  George Barrett  <bob@bob131.so>
97279
97280         guile: fix make-value with pointer type
97281         Calling the `make-value' procedure with an integer value and a pointer
97282         type for the #:type argument triggers a failed assertion in
97283         `get_unsigned_type_max', as that function doesn't consider pointers to
97284         be an unsigned type. This commit fixes the issue by adding a separate
97285         code path for pointers.
97286
97287         As previously suggested, range checking is done using a new helper
97288         function in gdbtypes.
97289
97290         gdb/ChangeLog:
97291
97292         2021-07-30  George Barrett  <bob@bob131.so>
97293
97294                 * gdbtypes.h (get_pointer_type_max): Add declaration.
97295                 * gdbtypes.c (get_pointer_type_max): Add definition for new
97296                 helper function.
97297                 * guile/scm-math.c (vlscm_convert_typed_number): Add code path
97298                 for handling conversions to pointer types without failing an
97299                 assert.
97300
97301         gdb/testsuite/ChangeLog:
97302
97303         2021-07-30  George Barrett  <bob@bob131.so>
97304
97305                 * gdb.guile/scm-math.exp (test_value_numeric_ops): Add test
97306                 for creating pointers with make-value.
97307                 (test_make_pointer_value, test_pointer_numeric_range): Add
97308                 test procedures containing checks for integer-to-pointer
97309                 validation.
97310
97311         Change-Id: I9994dd1c848840a3d995f745e6d72867732049f0
97312
97313 2021-07-29  George Barrett  <bob@bob131.so>
97314
97315         gdbtypes: return value from get_unsigned_type_max
97316         Changes the signature of get_unsigned_type_max to return the computed
97317         value rather than returning void and writing the value into a pointer
97318         passed by the caller.
97319
97320         gdb/ChangeLog:
97321
97322         2021-07-30  George Barrett  <bob@bob131.so>
97323
97324                 * gdbtypes.h (get_unsigned_type_max): Change signature to
97325                 return the result instead of accepting a pointer argument in
97326                 which to store the result.
97327                 * gdbtypes.c (get_unsigned_type_max): Likewise.
97328                 * guile/scm-math.c (vlscm_convert_typed_number): Update caller
97329                 of get_unsigned_type_max.
97330                 (vlscm_integer_fits_p): Likewise.
97331
97332         Change-Id: Ibb1bf0c0fa181fac7853147dfde082a7d1ae2323
97333
97334 2021-07-29  Clément Chigot  <clement.chigot@atos.net>
97335
97336         gas: improve C_BSTAT and C_STSYM symbols handling on XCOFF
97337         A C_BSTAT debug symbol specifies the beginning of a static block.
97338         Its n_value is the index of the csect containing static symbols.
97339         A C_STSYM debug symbol represents the stabstring of a statically
97340         allocated symbol. Its n_value is the offset in the csect pointed
97341         by the containing C_BSTAT.
97342
97343         These two special n_value were not correctly handled both when
97344         generating object files with gas or when reading them with objdump.
97345         This patch tries to improve that and, above all, to allow gas-generated
97346         object files with such symbols to be accepted by AIX ld.
97347
97348         bfd/
97349                 * coff-bfd.c (bfd_coff_get_syment): Adjust n_value of symbols
97350                 having fix_value = 1 in order to be an index and not a memory
97351                 offset.
97352                 * coffgen.c (coff_get_symbol_info): Likewize.
97353                 (coff_print_symbol): Likewize.
97354
97355         gas/
97356                 * config/tc-ppc.c (ppc_frob_label): Don't change within if
97357                 already set.
97358                 (ppc_stabx): Remove workaround changing exp.X_add_symbol's
97359                 within.
97360                 * config/tc-ppc.h (struct ppc_tc_sy): Update comments.
97361                 * symbols.c (resolve_symbol_value): Remove symbol update
97362                 when final_val is 0 and it's an AIX debug symbol.
97363                 * testsuite/gas/ppc/aix.exp: Add new tests.
97364                 * testsuite/gas/ppc/xcoff-stsym-32.d: New test.
97365                 * testsuite/gas/ppc/xcoff-stsym-64.d: New test.
97366                 * testsuite/gas/ppc/xcoff-stsym.s: New test.
97367
97368 2021-07-29  George Barrett  <bob@bob131.so>
97369
97370         Guile: temporary breakpoints
97371         Adds API to the Guile bindings for creating temporary breakpoints and
97372         querying whether an existing breakpoint object is temporary. This is
97373         effectively a transliteration of the Python implementation.
97374
97375         It's worth noting that the added `is_temporary' flag is ignored in the
97376         watchpoint registration path. This replicates the behaviour of the
97377         Python implementation, but might be a bit surprising for users.
97378
97379         gdb/ChangeLog:
97380
97381         2021-06-09  George Barrett  <bob@bob131.so>
97382
97383                 * guile/scm-breakpoint.c (gdbscm_breakpoint_object::spec): Add
97384                 is_temporary field.
97385                 (temporary_keyword): Add keyword object for make-breakpoint
97386                 argument parsing.
97387                 (gdbscm_make_breakpoint): Accept #:temporary keyword argument
97388                 and store the value in the allocated object's
97389                 spec.is_temporary.
97390                 (gdbscm_register_breakpoint_x): Pass the breakpoint's
97391                 spec.is_temporary value to create_breakpoint.
97392                 (gdbscm_breakpoint_temporary): Add breakpoint-temporary?
97393                 procedure implementation.
97394                 (breakpoint_functions::make-breakpoint): Update documentation
97395                 string and fix a typo.
97396                 (breakpoint_functions::breakpoint-temporary?): Add
97397                 breakpoint-temporary? procedure.
97398                 (gdbscm_initialize_breakpoints): Initialise temporary_keyword
97399                 variable.
97400                 NEWS (Guile API): Mention new temporary breakpoints API.
97401
97402         gdb/doc/ChangeLog:
97403
97404         2021-06-09  George Barrett  <bob@bob131.so>
97405
97406                 * guile.texi (Breakpoints In Guile): Update make-breakpoint
97407                 documentation to reflect new #:temporary argument.
97408                 Add documentation for new breakpoint-temporary? procedure.
97409
97410         gdb/testsuite/ChangeLog:
97411
97412         2021-06-09  George Barrett  <bob@bob131.so>
97413
97414                 * gdb.guile/scm-breakpoint.exp: Add additional tests for
97415                 temporary breakpoints.
97416
97417         Change-Id: I2de332ee7c256f5591d7141ab3ad50d31b871d17
97418
97419 2021-07-29  GDB Administrator  <gdbadmin@sourceware.org>
97420
97421         Automatic date update in version.in
97422
97423 2021-07-28  Simon Marchi  <simon.marchi@polymtl.ca>
97424
97425         gdb: clean up some things in features/Makefile
97426         Clean up some things I noticed:
97427
97428          - we generate a regformats/microblaze-with-stack-protect.dat file.  I
97429            don't think this is used.  It could be used by a GDBserver built for
97430            Microblaze, but GDBserver isn't ported to Microblaze.  So I don't
97431            think that's used at all.  Remove the entry in features/Makefile and
97432            the file itself.
97433
97434          - There are a bunch of *-expedite values in features/Makefile for
97435            architectures for which we don't generate dat files.  AFAIK, these
97436            *-expedite values are only used when generating dat files.  Remove
97437            those that are not necessary.
97438
97439          - 32bit-segments.xml is not listed in the Makfile, but it's used.  This
97440            means that it wouldn't get re-generated if we were to change how C
97441            files are generated from the XML.  It looks like it was simply
97442            forgotten, add it.
97443
97444         Change-Id: I112d00db317102270e1df924473c37122ccb6c3a
97445
97446 2021-07-28  H.J. Lu  <hjl.tools@gmail.com>
97447
97448         x86: Simplify check for distinct TMM register operands
97449         If any pair of operands in AMX instructions with 3 TMM register operands
97450         are the same, the instruction will UD.  Don't call register_number to
97451         check for distinct TMM register operands since all TMM register operands
97452         have the same size.
97453
97454                 * config/tc-i386.c (check_VecOperands): Remove register_number
97455                 call when checking for distinct TMM register operands.
97456
97457 2021-07-28  H.J. Lu  <hjl.tools@gmail.com>
97458
97459         ld: Run tmpdir/pr28138 only for native build
97460                 * PR ld/28138
97461                 * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
97462                 native build.
97463
97464 2021-07-28  H.J. Lu  <hjl.tools@gmail.com>
97465
97466         bfd: Close the file descriptor if there is no archive fd
97467         Close the file descriptor if there is no archive plugin file descriptor
97468         to avoid running out of file descriptors on thin archives with many
97469         archive members.
97470
97471         bfd/
97472
97473                 PR ld/28138
97474                 * plugin.c (bfd_plugin_close_file_descriptor): Close the file
97475                 descriptor there is no archive plugin file descriptor.
97476
97477         ld/
97478
97479                 PR ld/28138
97480                 * testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
97481                 * testsuite/ld-plugin/pr28138.c: New file.
97482                 * testsuite/ld-plugin/pr28138-1.c: Likewise.
97483                 * testsuite/ld-plugin/pr28138-2.c: Likewise.
97484                 * testsuite/ld-plugin/pr28138-3.c: Likewise.
97485                 * testsuite/ld-plugin/pr28138-4.c: Likewise.
97486                 * testsuite/ld-plugin/pr28138-5.c: Likewise.
97487                 * testsuite/ld-plugin/pr28138-6.c: Likewise.
97488                 * testsuite/ld-plugin/pr28138-7.c: Likewise.
97489
97490 2021-07-28  H.J. Lu  <hjl.tools@gmail.com>
97491
97492         ld: Report error reason when a library cannot be found
97493         With "ulimit -n 20", report:
97494
97495         ld: cannot find -lgcc: Too many open files
97496
97497         instead of
97498
97499         ld: cannot find -lgcc
97500
97501                 * ldfile.c (ldfile_open_file): Rport error reason when a library
97502                 cannot be found.
97503
97504 2021-07-28  Sergei Trofimovich  <siarheit@google.com>
97505
97506         texi2pod.pl: add no-op --no-split option support [PR28144]
97507         Change 2faf902da ("generate single html manual page by default")
97508         added use of --no-split option to makeinfo. binutils reuses
97509         makeinfo options for texi2pod.pl wrapper. Unsupported option
97510         led to silent manpage truncation.
97511
97512         The change adds no-op option support.
97513
97514         etc/
97515
97516                 * texi2pod.pl: Handle no-op --no-split option.
97517
97518 2021-07-28  Andrew Burgess  <andrew.burgess@embecosm.com>
97519
97520         gdb: fix missing space in some info variables output
97521         Fixes PR gdb/28121.  When a user declares an array like this:
97522
97523           int * const foo_1[3];
97524
97525         And in GDB the user does this:
97526
97527           (gdb) info variables foo
97528           All variables matching regular expression "foo":
97529
97530           File test.c:
97531           1:    int * constfoo_1[3];
97532
97533         Notice the missing space between 'const' and 'foo_1'.  This is fixed
97534         in c_type_print_varspec_prefix (c-typeprint.c) by passing through the
97535         flag that indicates if a trailing space is needed, rather than hard
97536         coding the flag to false as we currently do.
97537
97538         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28121
97539
97540 2021-07-28  Tom de Vries  <tdevries@suse.de>
97541
97542         [gdb/symtab] Fix unhandled dwarf expression opcode with gcc-11 -gdwarf-5
97543         [ I've confused things by forgetting to add -gdwarf-4 in $subject of
97544         commit 0057a7ee0d9 "[gdb/testsuite] Add KFAILs for gdb.ada FAILs with
97545         gcc-11".  So I'm adding here -gdwarf-5 in $subject, even though -gdwarf-5 is
97546         the default for gcc-11.  I keep getting confused because of working with a
97547         system gcc-11 compiler that was patched to switch the default back to
97548         -gdwarf-4. ]
97549
97550         When running test-case gdb.ada/arrayptr.exp with gcc-11 (and default
97551         -gdwarf-5), I run into:
97552         ...
97553         (gdb) print pa_ptr.all^M
97554         Unhandled dwarf expression opcode 0xff^M
97555         (gdb) FAIL: gdb.ada/arrayptr.exp: scenario=all: print pa_ptr.all
97556         ...
97557
97558         What happens is that pa_ptr:
97559         ...
97560          <2><1523>: Abbrev Number: 3 (DW_TAG_variable)
97561             <1524>   DW_AT_name        : pa_ptr
97562             <1529>   DW_AT_type        : <0x14fa>
97563         ...
97564         has type:
97565         ...
97566          <2><14fa>: Abbrev Number: 2 (DW_TAG_typedef)
97567             <14fb>   DW_AT_name        : foo__packed_array_ptr
97568             <1500>   DW_AT_type        : <0x1504>
97569          <2><1504>: Abbrev Number: 4 (DW_TAG_pointer_type)
97570             <1505>   DW_AT_byte_size   : 8
97571             <1505>   DW_AT_type        : <0x1509>
97572         ...
97573         which is a pointer to a subrange:
97574         ...
97575          <2><1509>: Abbrev Number: 12 (DW_TAG_subrange_type)
97576             <150a>   DW_AT_lower_bound : 0
97577             <150b>   DW_AT_upper_bound : 0x3fffffffffffffffff
97578             <151b>   DW_AT_name        : foo__packed_array
97579             <151f>   DW_AT_type        : <0x15cc>
97580             <1523>   DW_AT_artificial  : 1
97581          <1><15cc>: Abbrev Number: 5 (DW_TAG_base_type)
97582             <15cd>   DW_AT_byte_size   : 16
97583             <15ce>   DW_AT_encoding    : 7      (unsigned)
97584             <15cf>   DW_AT_name        : long_long_long_unsigned
97585             <15d3>   DW_AT_artificial  : 1
97586         ...
97587         with upper bound of form DW_FORM_data16.
97588
97589         In gdb/dwarf/attribute.h we have:
97590         ...
97591           /* Return non-zero if ATTR's value falls in the 'constant' class, or
97592              zero otherwise.  When this function returns true, you can apply
97593              the constant_value method to it.
97594              ...
97595              DW_FORM_data16 is not considered as constant_value cannot handle
97596              that.  */
97597           bool form_is_constant () const;
97598         ...
97599         so instead we have attribute::form_is_block (DW_FORM_data16) == true.
97600
97601         Then in attr_to_dynamic_prop for the upper bound, we get a PROC_LOCEXPR
97602         instead of a PROP_CONST and end up trying to evaluate the constant
97603         0x3fffffffffffffffff as if it were a locexpr, which causes the
97604         "Unhandled dwarf expression opcode 0xff".
97605
97606         In contrast, with -gdwarf-4 we have:
97607         ...
97608             <164c>   DW_AT_upper_bound : 18 byte block: \
97609               9e 10 ff ff ff ff ff ff ff ff 3f 0 0 0 0 0 0 0 \
97610               (DW_OP_implicit_value 16 byte block: \
97611                 ff ff ff ff ff ff ff ff 3f 0 0 0 0 0 0 0 )
97612         ...
97613
97614         Fix the dwarf error by translating the DW_FORM_data16 constant into a
97615         PROC_LOCEXPR, effectively by prepending 0x9e 0x10, such that we have same
97616         result as with -gdwarf-4:
97617         ...
97618         (gdb) print pa_ptr.all^M
97619         That operation is not available on integers of more than 8 bytes.^M
97620         (gdb) KFAIL: gdb.ada/arrayptr.exp: scenario=all: print pa_ptr.all \
97621           (PRMS: gdb/20991)
97622         ...
97623
97624         Tested on x86_64-linux, with gcc-11 and target board
97625         unix/gdb:debug_flags=-gdwarf-5.
97626
97627         gdb/ChangeLog:
97628
97629         2021-07-25  Tom de Vries  <tdevries@suse.de>
97630
97631                 * dwarf2/read.c (attr_to_dynamic_prop): Handle DW_FORM_data16.
97632
97633 2021-07-28  will schmidt  <will_schmidt@vnet.ibm.com>
97634
97635         Externalize the _bfd_set_gp_value function
97636         This change adds an external-visible wrapper for the _bfd_set_gp_value
97637         function.  This is a prerequisite for some gdb patches that better
97638         handle powerpc64le relocations against ".TOC.".
97639
97640                 * bfd.c (bfd_set_gp_value): New externally visible wrapper
97641                 for _bfd_set_gp_value.
97642                 * bfd-in2.h: Regenerate.
97643
97644 2021-07-28  Alan Modra  <amodra@gmail.com>
97645
97646         PowerPC: ignore sticky options for .machine
97647         PowerPC gas and objdump for a long time have allowed certain -m/-M
97648         options that extend a base cpu with extra functional units to be
97649         specified before the base cpu.  For example, "-maltivec -mpower4" is
97650         the same as "-mpower4 -maltivec".  See
97651         https://sourceware.org/pipermail/binutils/2008-January/054935.html
97652
97653         It doesn't make as much sense that .machine keep any of these
97654         "sticky" flags when handling a new base cpu.  See gcc PR101393.  I
97655         think that instead .machine ought to override the command line.
97656         That's what this patch does.  It is still possible to extend cpu
97657         functionality with .machine.  For example the following can be
97658         assembled when selecting a basic -mppc on the command line:
97659                 .machine power5
97660                 .machine altivec
97661                 frin 1,2
97662                 lvsr 3,4,5
97663         Here, ".machine altivec" extends the ".machine power5" so that both
97664         the power5 "frin" instruction and the altivec "lvsr" instruction are
97665         enabled.  Swapping the two ".machine" directives would result in
97666         failure to assemble "lvsr".
97667
97668         This change will expose some assembly errors, such as the one in
97669         glibc/sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c, a file
97670         compiled with -maltivec but containing
97671           asm volatile (".machine push;\n"
97672                         ".machine \"power5\";\n"
97673                         "vspltisb %0,0;\n"
97674                         "vspltisb %1,-1;\n"
97675                         "vpkuwus %0,%0,%1;\n"
97676                         "mfvscr %0;\n"
97677                         "stvx %0,0,%2;\n"
97678                         ".machine pop;"
97679                         : "=v" (v0), "=v" (v1)
97680                         : "r" (vscr_ptr)
97681                         : "memory");
97682         It's just wrong to choose power5 for a bunch of altivec instructions
97683         and in fact all of those .machine directives are unnecessary.
97684
97685                 * config/tc-ppc.c (ppc_machine): Don't use command line
97686                 sticky options.
97687
97688 2021-07-28  GDB Administrator  <gdbadmin@sourceware.org>
97689
97690         Automatic date update in version.in
97691
97692 2021-07-27  Tom de Vries  <tdevries@suse.de>
97693
97694         [gdb/testsuite] Add xfail for PR gcc/101643
97695         With gcc 8.5.0 I run into:
97696         ...
97697         (gdb) print bad^M
97698         $2 = (0 => 0 <repeats 25 times>)^M
97699         (gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad
97700         ...
97701         while with gcc 9.3.1 we have instead:
97702         ...
97703         (gdb) print bad^M
97704         $2 = (false <repeats 196 times>)^M
97705         (gdb) PASS: gdb.ada/big_packed_array.exp: scenario=minimal: print bad
97706         ...
97707
97708         This is caused by gcc PR, which I've filed at
97709         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101643 "[debug, ada] packed array
97710         not described as packed".
97711
97712         Fix by marking this as XFAIL.
97713
97714         Tested on x86_64-linux.
97715
97716         gdb/ChangeLog:
97717
97718         2021-07-27  Tom de Vries  <tdevries@suse.de>
97719
97720                 PR testsuite/26904
97721                 * gdb/testsuite/gdb.ada/big_packed_array.exp: Add xfail.
97722
97723 2021-07-27  Tom de Vries  <tdevries@suse.de>
97724
97725         [gdb/testsuite] Add xfail for PR gcc/101633
97726         With gcc 7.5.0, I run into:
97727         ...
97728         (gdb) print objects^M
97729         $1 = ((tag => object, values => ()), (tag => unused))^M
97730         (gdb) FAIL: gdb.ada/array_of_variant.exp: scenario=minimal: print entire array
97731         ...
97732         while with gcc 8.5.0 we have:
97733         ...
97734         (gdb) print objects^M
97735         $1 = ((tag => object, values => (2, 2, 2, 2, 2)), (tag => unused))^M
97736         (gdb) PASS: gdb.ada/array_of_variant.exp: scenario=minimal: print entire array
97737         ...
97738
97739         This is due to a gcc PR, which I've filed at
97740         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101633 "Bug 101633 - [debug]
97741         DW_TAG_subrange_type missing DW_AT_upper_bound".
97742
97743         Fix by marking this and related FAILs as XFAIL.
97744
97745         Tested on x86_64-linux.
97746
97747         gdb/ChangeLog:
97748
97749         2021-07-27  Tom de Vries  <tdevries@suse.de>
97750
97751                 PR testsuite/26903
97752                 * gdb/testsuite/gdb.ada/array_of_variant.exp: Add xfails.
97753
97754 2021-07-27  Andrew Burgess  <andrew.burgess@embecosm.com>
97755
97756         gdb: remove VALUE_FRAME_ID and fix another frame debug issue
97757         This commit was originally part of this patch series:
97758
97759           (v1): https://sourceware.org/pipermail/gdb-patches/2021-May/179357.html
97760           (v2): https://sourceware.org/pipermail/gdb-patches/2021-June/180208.html
97761           (v3): https://sourceware.org/pipermail/gdb-patches/2021-July/181028.html
97762
97763         However, that series is being held up in review, so I wanted to break
97764         out some of the non-related fixes in order to get these merged.
97765
97766         This commit addresses two semi-related issues, both of which are
97767         problems exposed by using 'set debug frame on'.
97768
97769         The first issue is in frame.c in get_prev_frame_always_1, and was
97770         introduced by this commit:
97771
97772           commit a05a883fbaba69d0f80806e46a9457727fcbe74c
97773           Date:   Tue Jun 29 12:03:50 2021 -0400
97774
97775               gdb: introduce frame_debug_printf
97776
97777         This commit replaced fprint_frame with frame_info::to_string.
97778         However, the former could handle taking a nullptr while the later, a
97779         member function, obviously requires a non-nullptr in order to make the
97780         function call.  In one place we are not-guaranteed to have a
97781         non-nullptr, and so, there is the possibility of triggering undefined
97782         behaviour.
97783
97784         The second issue addressed in this commit has existed for a while in
97785         GDB, and would cause this assertion:
97786
97787           gdb/frame.c:622: internal-error: frame_id get_frame_id(frame_info*): Assertion `fi->this_id.p != frame_id_status::COMPUTING' failed.
97788
97789         We attempt to get the frame_id for a frame while we are computing the
97790         frame_id for that same frame.
97791
97792         What happens is that when GDB stops we create a frame_info object for
97793         the sentinel frame (frame #-1) and then we attempt to unwind this
97794         frame to create a frame_info object for frame #0.
97795
97796         In the test case used here to expose the issue we have created a
97797         Python frame unwinder.  In the Python unwinder we attemt to read the
97798         program counter register.
97799
97800         Reading this register will initially create a lazy register value.
97801         The frame-id stored in the lazy register value will be for the
97802         sentinel frame (lazy register values hold the frame-id for the frame
97803         from which the register will be unwound).
97804
97805         However, the Python unwinder does actually want to examine the value
97806         of the program counter, and so the lazy register value is resolved
97807         into a non-lazy value.  This sends GDB into value_fetch_lazy_register
97808         in value.c.
97809
97810         Now, inside this function, if 'set debug frame on' is in effect, then
97811         we want to print something like:
97812
97813           frame=%d, regnum=%d(%s), ....
97814
97815         Where 'frame=%d' will be the relative frame level of the frame for
97816         which the register is being fetched, so, in this case we would expect
97817         to see 'frame=0', i.e. we are reading a register as it would be in
97818         frame #0.  But, remember, the lazy register value actually holds the
97819         frame-id for frame #-1 (the sentinel frame).
97820
97821         So, to get the frame_info for frame #0 we used to call:
97822
97823           frame = frame_find_by_id (VALUE_FRAME_ID (val));
97824
97825         Where VALUE_FRAME_ID is:
97826
97827           #define VALUE_FRAME_ID(val) (get_prev_frame_id_by_id (VALUE_NEXT_FRAME_ID (val)))
97828
97829         That is, we start with the frame-id for the next frame as obtained by
97830         VALUE_NEXT_FRAME_ID, then call get_prev_frame_id_by_id to get the
97831         frame-id of the previous frame.
97832
97833         The get_prev_frame_id_by_id function finds the frame_info for the
97834         given frame-id (in this case frame #-1), calls get_prev_frame to get
97835         the previous frame, and then calls get_frame_id.
97836
97837         The problem here is that calling get_frame_id requires that we know
97838         the frame unwinder, so then have to try each frame unwinder in turn,
97839         which would include the Python unwinder.... which is where we started,
97840         and thus we have a loop!
97841
97842         To prevent this loop GDB has an assertion in place, which is what
97843         actually triggers.
97844
97845         Solving the assertion failure is pretty easy, if we consider the code
97846         in value_fetch_lazy_register and get_prev_frame_id_by_id then what we
97847         do is:
97848
97849           1. Start with a frame_id taken from a value,
97850           2. Lookup the corresponding frame,
97851           3. Find the previous frame,
97852           4. Get the frame_id for that frame, and
97853           5. Lookup the corresponding frame
97854           6. Print the frame's level
97855
97856         Notice that steps 3 and 5 give us the exact same result, step 4 is
97857         just wasted effort.  We could shorten this process such that we drop
97858         steps 4 and 5, thus:
97859
97860           1. Start with a frame_id taken from a value,
97861           2. Lookup the corresponding frame,
97862           3. Find the previous frame,
97863           6. Print the frame's level
97864
97865         This will give the exact same frame as a result, and this is what I
97866         have done in this patch by removing the use of VALUE_FRAME_ID from
97867         value_fetch_lazy_register.
97868
97869         Out of curiosity I looked to see how widely VALUE_FRAME_ID was used,
97870         and saw it was only used in one other place in valops.c:value_assign,
97871         where, once again, we take the result of VALUE_FRAME_ID and pass it to
97872         frame_find_by_id, thus introducing a redundant frame_id lookup.
97873
97874         I don't think the value_assign case risks triggering the assertion
97875         though, as we are unlikely to call value_assign while computing the
97876         frame_id for a frame, however, we could make value_assign slightly
97877         more efficient, with no real additional complexity, by removing the
97878         use of VALUE_FRAME_ID.
97879
97880         So, in this commit, I completely remove VALUE_FRAME_ID, and replace it
97881         with a use of VALUE_NEXT_FRAME_ID, followed by a direct call to
97882         get_prev_frame_always, this should make no difference in either case,
97883         and resolves the assertion issue from value.c.
97884
97885         As I said, this patch was originally part of another series, the
97886         original test relied on the fixes in that original series.  However, I
97887         was able to create an alternative test for this issue by enabling
97888         frame debug within an existing test script.
97889
97890         This commit probably fixes bug PR gdb/27938, though the bug doesn't
97891         have a reproducer attached so it is not possible to know for sure.
97892
97893         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27938
97894
97895 2021-07-27  Chenghua Xu  <xuchenghua@loongson.cn>
97896
97897         Correct gs264e bfd_mach in mips_arch_choices.
97898         opcodes/
97899             * mips-dis.c (mips_arch_choices): Correct gs264e bfd_mach.
97900
97901 2021-07-27  Roland McGrath  <mcgrathr@google.com>
97902
97903         Fix ld test case that assumes --enable-textrel-check
97904         ld/
97905                 * testsuite/ld-x86-64/x86-64.exp (Build textrel-1): Use --warn-textrel.
97906
97907 2021-07-27  GDB Administrator  <gdbadmin@sourceware.org>
97908
97909         Automatic date update in version.in
97910
97911 2021-07-27  H.J. Lu  <hjl.tools@gmail.com>
97912
97913         bfd: Set error to bfd_error_malformed_archive only if unset
97914         When reading an archive member, set error to bfd_error_malformed_archive
97915         on open_nested_file failure only if the error is unset.
97916
97917                 PR ld/28138
97918                 * archive.c (_bfd_get_elt_at_filepos): Don't set error to
97919                 bfd_error_malformed_archive if it has been set.
97920
97921 2021-07-26  Carl Love  <cel@us.ibm.com>
97922
97923         Fix for mi-reverse.exp
97924         This test fails on PPC64 because PPC64 prints the value of 3.5 with
97925         more significant digits than on Intel. The patch updates the regular
97926         expression to allow for more significant digits on the constant.
97927
97928         gdb/testsuite/ChangeLog
97929
97930                 * gdb.mi/mi-reverse.exp: mi_execute_to exec-step reverse add check
97931                 for additional digits.
97932
97933 2021-07-26  Tom Tromey  <tromey@adacore.com>
97934
97935         Fix the Windows build
97936         The gdb build was broken on Windows after the patch to change
97937         get_inferior_cwd.  This patch fixes the build.
97938
97939 2021-07-26  Shahab Vahedi  <shahab@synopsys.com>
97940
97941         gdb: Fix numerical field extraction for target description "flags"
97942         The "val_print_type_code_flags ()" function is responsible for
97943         extraction of fields for "flags" data type.  These data types are
97944         used when describing a custom register type in a target description
97945         XML.  The logic used for the extraction though is not sound:
97946
97947             unsigned field_len = TYPE_FIELD_BITSIZE (type, field);
97948             ULONGEST field_val
97949               = val >> (TYPE_FIELD_BITPOS (type, field) - field_len + 1);
97950
97951         TYPE_FIELD_BITSIZE: The bit length of the field to be extracted.
97952         TYPE_FIELD_BITPOS:  The starting position of the field; 0 is LSB.
97953         val:                The register value.
97954
97955         Imagine you have a field that starts at position 1 and its length
97956         is 4 bits.  According to the third line of the code snippet the
97957         shifting right would become "val >> -2", or "val >> 0xfff...fe"
97958         to be precise.  That will result in a "field_val" of 0.
97959
97960         The correct extraction should be:
97961
97962             ULONGEST field_val = val >> TYPE_FIELD_BITPOS (type, field);
97963
97964         The rest of the algorithm that masks out the higher bits is OK.
97965
97966         Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
97967
97968 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
97969
97970         PATCH [10/10] arm: Alias 'ra_auth_code' to r12 for pacbti.
97971         gas/
97972         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
97973
97974                 * config/tc-arm.c (reg_names): Alias 'ra_auth_code' to r12.
97975
97976 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
97977
97978         PATCH [9/10] arm: add 'pacg' instruction for Armv8.1-M pacbti extension
97979         gas/
97980         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
97981
97982                 * config/tc-arm.c (T16_32_TAB): Add '_pacg'.
97983                 (do_t_pacbti_pacg): New function.
97984                 (insns): Define 'pacg' insn.
97985                 * testsuite/gas/arm/armv8_1-m-pacbti.d: Add 'pacg' test.
97986                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
97987
97988         opcodes/
97989         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
97990
97991                 * arm-dis.c (thumb32_opcodes): Add 'pacg'.
97992
97993 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
97994
97995         PATCH [8/10] arm: add 'autg' instruction for Armv8.1-M pacbti extension
97996         gas/
97997         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
97998
97999                 * config/tc-arm.c (T16_32_TAB): Add '_autg'.
98000                 (insns): Define 'autg' insn.
98001                 * testsuite/gas/arm/armv8_1-m-pacbti.d: Add autg test.
98002                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
98003
98004         opcodes/
98005         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98006
98007                 * arm-dis.c (thumb32_opcodes): Add 'autg'.
98008
98009 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98010
98011         PATCH [7/10] arm: add 'bxaut' instruction for Armv8.1-M pacbti extension
98012         gas/
98013         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98014
98015                 * config/tc-arm.c (T16_32_TAB): Add '_bxaut'.
98016                 (do_t_pacbti_nonop): New function.
98017                 (insns): Define 'bxaut' insn.
98018                 * testsuite/gas/arm/armv8_1-m-pacbti.d: Add 'bxaut' test.
98019                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
98020
98021         opcodes/
98022         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98023
98024                 * arm-dis.c (thumb32_opcodes): Add 'bxaut'.
98025
98026 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98027
98028         PATCH [6/10] arm: Add -march=armv8.1-m.main+pacbti flag
98029         gas/
98030         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98031
98032                 * config/tc-arm.c (pacbti_ext): Define.
98033                 (BAD_PACBTI): New macro.
98034                 (armv8_1m_main_ext_table): Add 'pacbti' extension.
98035
98036         include/
98037         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98038
98039                 * opcode/arm.h (ARM_EXT3_PACBTI, ARM_AEXT3_V8_1M_MAIN_PACBTI): New
98040                 macro.
98041
98042 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98043
98044         PATCH [5/10] arm: Extend again arm_feature_set struct to provide more bits
98045         include/
98046         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98047
98048                 * opcode/arm.h (arm_feature_set): Extend 'core' field.
98049                 (ARM_CPU_HAS_FEATURE, ARM_FSET_CPU_SUBSET, ARM_CPU_IS_ANY)
98050                 (ARM_MERGE_FEATURE_SETS, ARM_CLEAR_FEATURE, ARM_FEATURE_EQUAL)
98051                 (ARM_FEATURE_ZERO, ARM_FEATURE_CORE_EQUAL): Account for
98052                 'core[2]'.
98053                 (ARM_FEATURE_CORE_HIGH_HIGH): New macro.
98054
98055 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98056
98057         PATCH [4/10] arm: add 'pac' instruction for Armv8.1-M pacbti extension
98058         gas/
98059         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98060
98061                 * config/tc-arm.c (T16_32_TAB): Add '_pac'.
98062                 (insns): Add 'pac' insn.
98063                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.l: Add pac tests.
98064                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.s: Likewise.
98065                 * testsuite/gas/arm/armv8_1-m-pacbti.d: Likewise.
98066                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
98067
98068         opcodes/
98069         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98070
98071                 * arm-dis.c (thumb32_opcodes): Add 'pac'.
98072
98073 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98074
98075         PATCH [3/10] arm: add 'aut' instruction for Armv8.1-M pacbti extension
98076         gas/
98077         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98078
98079                 * config/tc-arm.c (insns): Add 'aut.'
98080                 (T16_32_TAB): Add '_aut'.
98081                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.l: Add 'aut' tests.
98082                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.s: Likewise.
98083                 * testsuite/gas/arm/armv8_1-m-pacbti.d: Likewise.
98084                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
98085
98086         opcodes/
98087         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98088
98089                 * arm-dis.c (thumb32_opcodes): Add 'aut'.
98090
98091 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98092
98093         PATCH [2/10] arm: add 'pacbti' instruction for Armv8.1-M pacbti extension
98094         gas/
98095         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98096
98097                 * config/tc-arm.c
98098                 (enum operand_parse_code): Add OP_SP and OP_R12.
98099                 (parse_operands): Add switch cases for OP_SP and OP_R12.
98100                 (T16_32_TAB): Add '_pacbti'.
98101                 (do_t_pacbti): New function.
98102                 (insns): Add 'pacbti'.
98103                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.d: New file.
98104                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.l: Likewise.
98105                 * testsuite/gas/arm/armv8_1-m-pacbti-bad.s: Likewise.
98106                 * testsuite/gas/arm/armv8_1-m-pacbti.d: Add 'pacbti' to testcase.
98107                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
98108
98109         opcodes/
98110         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98111
98112                 * arm-dis.c (thumb32_opcodes): Add 'pacbti' instruction.
98113
98114 2021-07-26  Andrea Corallo  <andrea.corallo@arm.com>
98115
98116         PATCH [1/10] arm: add 'bti' instruction for Armv8.1-M pacbti extension
98117         gas/
98118         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98119
98120                 * config/tc-arm.c (insns): Add 'bti' insn.
98121                 * testsuite/gas/arm/armv8_1-m-pacbti.d: New file.
98122                 * testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.
98123
98124         opcodes/
98125         2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>
98126
98127                 * arm-dis.c (thumb32_opcodes): Add bti instruction.
98128
98129 2021-07-26  Andrew Burgess  <andrew.burgess@embecosm.com>
98130
98131         gdb: move remaining ChangeLogs to legacy files
98132         In commit:
98133
98134           commit f069ea46a03ae868581d1c852da28e979ea1245a
98135           Date:   Sat Jul 3 16:29:08 2021 -0700
98136
98137               Rename gdb/ChangeLog to gdb/ChangeLog-2021
98138
98139         The gdb/ChangeLog file was renamed, but all of the other ChangeLog
98140         files relating to gdb were left in place.
98141
98142         As I understand things, the no ChangeLogs policy applies to all the
98143         GDB related directories, so this commit renames all of the remaining
98144         GDB related ChangeLog files.
98145
98146         As with the original commit, the intention behind this commit is to
98147         hopefully stop people merging ChangeLog entries by mistake.
98148
98149         The renames carried out in this commit are:
98150
98151             gdb/doc/ChangeLog -> gdb/doc/ChangeLog-1991-2021
98152             gdb/stubs/ChangeLog -> gdb/stubs/ChangeLog-2012-2020
98153             gdb/testsuite/ChangeLog -> gdb/testsuite/ChangeLog-2014-2021
98154             gdbserver/ChangeLog -> gdbserver/ChangeLog-2002-2021
98155             gdbsupport/ChangeLog -> gdbsupport/ChangeLog-2020-2021
98156
98157 2021-07-26  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
98158
98159         gdb/mi: handle no condition argument case for -break-condition
98160         As reported in PR gdb/28076 [1], passing no condition argument to the
98161         -break-condition command (e.g.: "-break-condition 2") should clear the
98162         condition for breakpoint 2, just like CLI's "condition 2", but instead
98163         an error message is returned:
98164
98165           ^error,msg="-break-condition: Missing the <number> and/or <expr> argument"
98166
98167         The current implementation of the -break-condition command's argument
98168         handling (79aabb7308c "gdb/mi: add a '--force' flag to the
98169         '-break-condition' command") was done according to the documentation,
98170         where the condition argument seemed mandatory.  However, the
98171         -break-condition command originally (i.e. before the 79aabb7308c
98172         patch) used the CLI's "cond" command, and back then not passing a
98173         condition argument was clearing out the condition.  So, this is a
98174         regression in terms of the behavior.
98175
98176         Fix the argument handling of the -break-condition command to allow not
98177         having a condition argument, and also update the document to make the
98178         behavior clear.  Also add test cases to test the scenarios which were
98179         previously not covered.
98180
98181         [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28076
98182
98183 2021-07-26  GDB Administrator  <gdbadmin@sourceware.org>
98184
98185         Automatic date update in version.in
98186
98187 2021-07-25  GDB Administrator  <gdbadmin@sourceware.org>
98188
98189         Automatic date update in version.in
98190
98191 2021-07-24  Alan Modra  <amodra@gmail.com>
98192
98193         Revert: PowerPC: Don't generate unused section symbols
98194         Blindly following x86 broke linux kernel builds.
98195
98196         bfd/
98197                 * elf32-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define as true.
98198                 * elf64-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Likewise.
98199         gas/
98200                 * testsuite/gas/ppc/power4.d: Adjust for section sym change.
98201                 * testsuite/gas/ppc/test1elf32.d: Likewise.
98202                 * testsuite/gas/ppc/test1elf64.d: Likewise.
98203         ld/
98204                 * testsuite/ld-powerpc/tlsexe.r: Adjust for section sym change.
98205                 * testsuite/ld-powerpc/tlsexe32.r: Likewise.
98206                 * testsuite/ld-powerpc/tlsexe32no.r: Likewise.
98207                 * testsuite/ld-powerpc/tlsexeno.r: Likewise.
98208                 * testsuite/ld-powerpc/tlsexenors.r: Likewise.
98209                 * testsuite/ld-powerpc/tlsexers.r: Likewise.
98210                 * testsuite/ld-powerpc/tlsexetoc.r: Likewise.
98211                 * testsuite/ld-powerpc/tlsexetocrs.r: Likewise.
98212                 * testsuite/ld-powerpc/tlsget.d: Likewise.
98213                 * testsuite/ld-powerpc/tlsget.wf: Likewise.
98214                 * testsuite/ld-powerpc/tlsget2.d: Likewise.
98215                 * testsuite/ld-powerpc/tlsget2.wf: Likewise.
98216                 * testsuite/ld-powerpc/tlsso.r: Likewise.
98217                 * testsuite/ld-powerpc/tlsso32.r: Likewise.
98218                 * testsuite/ld-powerpc/tlstocso.r: Likewise.
98219
98220 2021-07-24  Alan Modra  <amodra@gmail.com>
98221
98222         Re: ld script expression parsing
98223         Commit 40726f16a8d7 broke references to sections within ADDR(), and
98224         overlays with weird section names.
98225
98226                 * ldgram.y (paren_script_name): New rule.
98227                 (exp): Use it for ALIGNOF, SIZEOF, ADDR, and LOADADDR.  Similarly
98228                 ensure script mode parsing for section name in SEGMENT_START.
98229                 (overlay_section): Delete unnecessary ldlex_script call.  Backup
98230                 on a lookahead NAME parsed in expression mode.
98231                 * testsuite/ld-elf/overlay.s: Add more sections.
98232                 * testsuite/ld-elf/overlay.t: Test '-' in section names.
98233
98234 2021-07-24  Frederic Cambus  <fred@statdns.com>
98235
98236         Update the NetBSD system call table to match NetBSD-current.
98237         Generated from sys/sys/syscall.h revision 1.319.
98238
98239         We can safely remove the _lwp_gettid syscall, which was never exposed
98240         in libc and never made it into a release.
98241
98242         gdb/ChangeLog:
98243
98244         2021-07-23  Frederic Cambus  <fred@statdns.com>
98245
98246                 * syscalls/netbsd.xml: Regenerate.
98247
98248 2021-07-24  GDB Administrator  <gdbadmin@sourceware.org>
98249
98250         Automatic date update in version.in
98251
98252 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98253
98254         gdb/testsuite: test get/set value of unregistered Guile parameter
98255         When creating a parameter in Guile, you have to create it using
98256         make-parameter and then register it with GDB with register-parameter!.
98257         In between, it's still possible (though not documented) to set the
98258         parameter's value.  I broke this use case by mistake while writing this
98259         series, so thought it would be good to have a test for it.
98260
98261         I suppose that people could use this "feature" to give their parameter
98262         an initial value, even though make-parameter has an initial-value
98263         parameter for this.  Nevertheless, changing this behavior could break
98264         some scripts, which is why I think it's important for it to be tested.
98265
98266         Change-Id: I5b2103e3cec0cfdcccf7ffb00eb05fed8626e66d
98267
98268 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98269
98270         gdb: remove cmd_list_element::function::sfunc
98271         I don't understand what the sfunc function type in
98272         cmd_list_element::function is for.  Compared to cmd_simple_func_ftype,
98273         it has an extra cmd_list_element parameter, giving the callback access
98274         to the cmd_list_element for the command being invoked.  This allows
98275         registering the same callback with many commands, and alter the behavior
98276         using the cmd_list_element's context.
98277
98278         From the comment in cmd_list_element, it sounds like at some point it
98279         was the callback function type for set and show functions, hence the
98280         "s".  But nowadays, it's used for many more commands that need to access
98281         the cmd_list_element object (see add_catch_command for example).
98282
98283         I don't really see the point of having sfunc at all, since do_sfunc is
98284         just a trivial shim that changes the order of the arguments.  All
98285         commands using sfunc could just as well set cmd_list_element::func to
98286         their callback directly.
98287
98288         Therefore, remove the sfunc field in cmd_list_element and everything
98289         that goes with it.  Rename cmd_const_sfunc_ftype to cmd_func_ftype and
98290         use it for cmd_list_element::func, as well as for the add_setshow
98291         commands.
98292
98293         Change-Id: I1eb96326c9b511c293c76996cea0ebc51c70fac0
98294
98295 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98296
98297         gdb: rename cfunc to simple_func
98298         After browsing the CLI code for quite a while and trying really hard, I
98299         reached the conclusion that I can't give a meaningful explanation of
98300         what "sfunc" and "cfunc" functions are, in cmd_list_element.  I don't
98301         see a logic at all.  That makes it very difficult to do any kind of
98302         change.  Unless somebody can make sense out of all that, I'd like to try
98303         to retro-fit some logic in the cmd_list_element callback function code
98304         so that we can understand what is going on, do some cleanups and add new
98305         features.
98306
98307         The first change is about "cfunc".  I can't figure out what the "c" in
98308         cfunc means.  It's not const, because there's already "const" in
98309         "cmd_const_cfunc_ftype", and the previous "cmd_cfunc_ftype" had nothing
98310         const..  It's not "cmd" or "command", because there's already "cmd" in
98311         "cmd_const_cfunc_ftype".
98312
98313         The "main" command callback, cmd_list_element::func, has three
98314         parameters, whereas cfunc has two.  It is missing the cmd_list_element
98315         parameter.  So the only reason I see for cfunc to exist is to be a shim
98316         between the three and two parameter versions.  Most commands don't need
98317         to receive the cmd_list_element object, so adding it everywhere would be
98318         long and would just add more unnecessary boilerplate.  So since this is
98319         the "simple" version of the callback, compared to the "full", I suggest
98320         renaming cmd_const_cfunc_ftype into cmd_simple_func_ftype, as well as
98321         everything (like the utility functions) that goes with it.
98322
98323         Change-Id: I4e46cacfd77a66bc1cbf683f6a362072504b7868
98324
98325 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98326
98327         gdb: make inferior::m_terminal an std::string
98328         Same idea as the previous patch, but for m_terminal.
98329
98330         Change-Id: If9367d5db8c976a4336680adca4ea5bc31ab64d2
98331
98332 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98333
98334         gdb: make inferior::m_cwd an std::string
98335         Same idea as the previous patch, but for m_cwd.
98336
98337         To keep things consistent across the board, change get_inferior_cwd as
98338         well, which is shared with GDBserver.  So update the related GDBserver
98339         code too.
98340
98341         Change-Id: Ia2c047fda738d45f3d18bc999eb67ceb8400ce4e
98342
98343 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98344
98345         gdb: make inferior::m_args an std::string
98346         With the current code, both a NULL pointer and an empty string can mean
98347         "no arguments".  We don't need this distinction.  Changing to a string
98348         has the advantage that there is now a single state for that (an empty
98349         string), which makes the code a bit simpler in my opinion.
98350
98351         Change-Id: Icdc622820f7869478791dbaa84b4a1c7fec21ced
98352
98353 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98354
98355         gdb: add setter/getter for inferior cwd
98356         Add cwd/set_cwd to the inferior class, remove set_inferior_args.
98357         Keep get_inferior_args, because it is used from fork_inferior, in shared
98358         code.  The cwd could eventually be passed as a parameter eventually,
98359         though, I think that would be cleaner.
98360
98361         Change-Id: Ifb72ea865d7e6f9a491308f0d5c1595579d8427e
98362
98363 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98364
98365         gdb: add setter/getter for inferior arguments
98366         Add args/set_args to the inferior class, remove the set_inferior_args
98367         and get_inferior_args functions, that would just be wrappers around
98368         them.
98369
98370         Change-Id: If87d52f3402ce08be26c32897ae8915d9f6d1ea3
98371
98372 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98373
98374         gdb: remove inferior::{argc,argv}
98375         There are currently two states that the inferior args can be stored.
98376         The main one is the `args` field, where they are stored as a single
98377         string.  The other one is the `argc`/`argv` fields.
98378
98379         This last one is only used for arguments passed in GDB's
98380         command line.  And the only outcome is that when get_inferior_args is
98381         called, `argc`/`argv` are serialized into `args`.  So really,
98382         `argc`/`argv` is just a staging area before moving the arguments in
98383         `args`.
98384
98385         Simplify this by only keeping the `args` field.  Change
98386         set_inferior_args_vector to immediately serialize the arguments into
98387         `args`, work that would be done in get_inferior_args later anyway.
98388
98389         The only time where this work would be "wasted" is when the user passes
98390         some arguments on the command line, but does not end up running the
98391         program.  But that just seems unlikely.  And it's not that much work.
98392
98393         Change-Id: Ica0b9859397c095f6530350c8fb3c36905f2044a
98394
98395 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98396
98397         gdb: un-share set_inferior_cwd declaration
98398         The declaration of set_inferior_cwd is currently shared between gdb and
98399         gdbserver, in gdbsupport/common-inferior.h.  It doesn't need to be, as
98400         set_inferior_cwd is not called from common code.  Only get_inferior_cwd
98401         needs to.
98402
98403         The motivation for this is that a future patch will change the prototype
98404         of set_inferior_cwd in gdb, and I don't want to change it for gdbserver
98405         unnecessarily.  I see this as a good cleanup in any case, to reduce to
98406         just the essential what is shared between GDB and GDBserver.
98407
98408         Change-Id: I3127d27d078f0503ebf5ccc6fddf14f212426a73
98409
98410 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98411
98412         gdb.base/setshow.exp: fix duplicate test name
98413         Fix:
98414
98415             DUPLICATE: gdb.base/setshow.exp: test_setshow_args: show args
98416
98417         by giving some explicit test names.
98418
98419         Change-Id: I2a738d3d3675ab9b45929e71f5aee0ea6bf92072
98420
98421 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98422
98423         gdb.base/setshow.exp: split in procs
98424         Split in multiple procs, one per topic, and start with a fresh GDB in
98425         each.  I find it easier to work on a test with multiple smaller
98426         independent test procedures.  For example, it's possible to comment all
98427         but one when working on one.  It's also easier to add things without
98428         having to think about the impact on existing tests, and vice-versa.
98429
98430         Change-Id: I19691eed8f9bcb975b2eeff7577cac66251bcbe2
98431
98432 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98433
98434         gdb.base/setshow.exp: use save_vars to save/restore gdb_prompt
98435         Using save_vars is a bit better than what we have now, as it ensures the
98436         variable gets restored if the code within it throws an error.
98437
98438         Change-Id: I3bd6836e5b7efb61b078acadff1a1c8182c19a27
98439
98440 2021-07-23  Simon Marchi  <simon.marchi@polymtl.ca>
98441
98442         gdb/testsuite: split gdb.python/py-parameter.exp in procs
98443         Split the file into multiple independent test procs, where each proc
98444         starts with a fresh GDB.  I find it easier to understand what a test is
98445         doing when each part of the test is isolated and self-contained.  It
98446         makes it easier to comment out some parts of the test while working /
98447         debugging a specific part.  It also makes it easier to add new things
98448         (which a subsequent patch will do) without fear of impacting another part
98449         of the test.
98450
98451         Change-Id: I8b4d52ac82b1492d79b679e13914ed177d8a836d
98452
98453 2021-07-23  Carl Love  <cel@us.ibm.com>
98454
98455         Fix for gdb.python/py-breakpoint.exp
98456         Not all systems have hardware breakpoint support.  Add a check
98457         to see if the system supports hardware breakpoints.
98458
98459         gdb/testsuite/ChangeLog
98460
98461                 * gdb.python/py-breakpoint.exp (test_hardware_breakpoints): Add
98462                 check for hardware breakpoint support.
98463
98464 2021-07-23  Andrew Burgess  <andrew.burgess@embecosm.com>
98465
98466         gdb/testsuite: don't error when trying to unset last_spawn_tty_name
98467         In spawn_capture_tty_name (lib/gdb.exp) we either set or unset
98468         last_spawn_tty_name depending on whether spawn_out(slave,name) exists
98469         or not.
98470
98471         One situation that might cause spawn_out(slave,name) to not exists is
98472         if the spawn function is called with the argument -leaveopen, which is
98473         how it is called when processes are created as part of a pipeline, the
98474         created process has no tty, instead its output is written to a file
98475         descriptor.
98476
98477         If a pipeline is created consisting of multiple processes then there
98478         will be multiple sequential calls to spawn, all using -leaveopen.  The
98479         first of these calls is fine, spawn_out(slave,name) is not set, and so
98480         in spawn_capture_tty_name we unset last_spawn_tty_name.  However, on
98481         the second call to spawn, spawn_out(slave,name) is still not set and
98482         so in spawn_capture_tty_name we again try to unset
98483         last_spawn_tty_name, this now throws an error (as last_spawn_tty_name
98484         is already unset).
98485
98486         Fix this issue by using -nocomplain with the call to unset in
98487         spawn_capture_tty_name.
98488
98489         Before this commit I was seeing gdb.base/gnu-debugdata.exp report 1
98490         pass, and 1 unsupported test.  After this commit I now see 16 passes
98491         from this test script.
98492
98493         I have also improved the code that used to do this:
98494
98495             if { [info exists spawn_out] } {
98496                 set ::last_spawn_tty_name $spawn_out(slave,name)
98497             } else {
98498                 ...
98499             }
98500
98501         The problem here is that we check for the existence of spawn_out, and
98502         then unconditionally read spawn_out(slave,name).  A situation could
98503         arise where some other element of spawn_out is set,
98504         e.g. spawn_out(foo), in which case we would enter the if block and try
98505         to read a non-existent variable.  After this commit we now check
98506         specifically for spawn_out(slave,name).
98507
98508         Finally, it is worth noting that before this issue was fixed runtest
98509         itself, or rather the expect process behind runtest, would segfault
98510         while exiting.  I haven't looked at all into what the problem is here
98511         that caused expect to crash, as fixing the bug in GDB's testing
98512         scripts made the segfault go away.
98513
98514 2021-07-23  Jan Beulich  <jbeulich@suse.com>
98515
98516         x86: express unduly set rounding control bits in disassembly
98517         While EVEX.L'L are indeed ignored when EVEX.b stands for just SAE,
98518         EVEX.b itself is not ignored when an insn permits neither rounding
98519         control nor SAE.
98520
98521         While changing this aspect of EVEX.b handling, also alter unduly set
98522         embedded broadcast: Don't call BadOp(), screwing up subsequent
98523         disassembly, but emit "{bad}" instead.
98524
98525 2021-07-23  GDB Administrator  <gdbadmin@sourceware.org>
98526
98527         Automatic date update in version.in
98528
98529 2021-07-22  Tom de Vries  <tdevries@suse.de>
98530
98531         [gdb/testsuite] Fix FAILs due to PR gcc/101575
98532         When running test-case gdb.ada/formatted_ref.exp with gcc-11 and target board
98533         unix/gdb:debug_flags=-gdwarf-4 we run into:
98534         ...
98535         (gdb) print/x s^M
98536         No definition of "s" in current context.^M
98537         (gdb) FAIL: gdb.ada/formatted_ref.exp: print/x s
98538         ...
98539         which is caused by "runto defs.adb:20" taking us to defs__struct1IP:
98540         ...
98541         (gdb) break defs.adb:20^M
98542         Breakpoint 1 at 0x402cfd: defs.adb:20. (2 locations)^M
98543         (gdb) run ^M
98544         Starting program: formatted_ref ^M
98545         ^M
98546         Breakpoint 1, defs__struct1IP () at defs.adb:20^M
98547         20            return s.x;                   -- Set breakpoint marker here.^M
98548         (gdb) print s1'access^M
98549         ...
98550         instead of the expected defs.f1:
98551         ...
98552         (gdb) break defs.adb:20^M
98553         Breakpoint 1 at 0x402d0e: file defs.adb, line 20.^M
98554         (gdb) run ^M
98555         Starting program: formatted_ref ^M
98556         ^M
98557         Breakpoint 1, defs.f1 (s=...) at defs.adb:20^M
98558         20            return s.x;                   -- Set breakpoint marker here.^M
98559         ...
98560
98561         This is caused by incorrect line info due to gcc PR 101575 - "[gcc-11,
98562         -gdwarf-4] Missing .file <n> directive causes invalid line info".
98563
98564         Fix this by when landing in defs__struct1IP:
98565         - xfailing the runto, and
98566         - issuing a continue to land in defs.f1.
98567
98568         Likewise in a few other test-cases.
98569
98570         Tested on x86_64-linux, with:
98571         - system gcc.
98572         - gcc-11 and target boards unix/gdb:debug_flags=-gdwarf-4 and
98573           unix/gdb:debug_flags=-gdwarf-5.
98574
98575         gdb/testsuite/ChangeLog:
98576
98577         2021-07-22  Tom de Vries  <tdevries@suse.de>
98578
98579                 * gdb.ada/formatted_ref.exp: Add xfail for PR gcc/101575.
98580                 * gdb.ada/iwide.exp: Same.
98581                 * gdb.ada/pkd_arr_elem.exp: Same.
98582
98583 2021-07-22  Jan Beulich  <jbeulich@suse.com>
98584
98585         x86: drop dq{b,d}_mode
98586         Their sole use is for {,V}EXTRACTPS / {,V}P{EXT,INS}RB respectively; for
98587         consistency also limit use of dqw_mode to Jdqw. 64-bit disassembly
98588         reflecting REX.W / VEX.W is not in line with the assembler's opcode
98589         table having NoRex64 / VexWIG in all respective templates, i.e. assembly
98590         input isn't being honored there either. Obviously the 0FC5 encodings of
98591         {,V}PEXTRW then also need adjustment for consistency reasons.
98592
98593         x86: drop vex_scalar_w_dq_mode
98594         It has only a single use and can easily be represented by dq_mode
98595         instead. Plus its handling in intel_operand_size() was duplicating
98596         that of vex_vsib_{d,q}_w_dq_mode anyway.
98597
98598         x86: drop xmm_m{b,w,d,q}_mode
98599         They're effectively redundant with {b,w,d,q}_mode.
98600
98601         x86: fold duplicate vector register printing code
98602         The bulk of OP_XMM() can be easily reused also for OP_EX(). Break the
98603         shared logic out of the function, and invoke the new helper from both
98604         places.
98605
98606         x86: drop vex_mode and vex_scalar_mode
98607         These are fully redundant with, respectively, x_mode and scalar_mode.
98608
98609         x86: correct EVEX.V' handling outside of 64-bit mode
98610         Unlike the high bit of VEX.vvvv / EVEX.vvvv, EVEX.V' is not ignored
98611         outside of 64-bit mode. Oddly enough there already are tests for these
98612         cases, but their expectations were wrong. (This may have been based on
98613         an old SDM version, where the restriction wasn't properly spelled out.)
98614
98615         x86: fold duplicate code in MOVSXD_Fixup()
98616         There's no need to have two paths printing the "xd" mnemonic suffix.
98617
98618         x86: fold duplicate register printing code
98619         What so far was OP_E_register() can be easily reused also for OP_G().
98620         Add suitable parameters to the function and move the invocation of
98621         swap_operand() to OP_E(). Adjust MOVSXD's first operand: There never was
98622         a need to use movsxd_mode there, and its use gets in the way of the code
98623         folding.
98624
98625         x86-64: properly bounds-check %bnd<N> in OP_G()
98626         The restriction to %bnd0-%bnd3 requires to also check REX.R is clear,
98627         just like OP_E_Register() also includes REX.B in its check.
98628
98629         x86-64: generalize OP_G()'s EVEX.R' handling
98630         EVEX.R' is invalid to be clear not only for mask registers, but also for
98631         GPRs - IOW everything handled in this function.
98632
98633 2021-07-22  Jan Beulich  <jbeulich@suse.com>
98634
98635         x86: correct VCVT{,U}SI2SD rounding mode handling
98636         With EVEX.W clear the instruction doesn't ignore the rounding mode, but
98637         (like for other insns without rounding semantics) EVEX.b set causes #UD.
98638         Hence the handling of EVEX.W needs to be done when processing
98639         evex_rounding_64_mode, not at the decode stages.
98640
98641         Derive a new 64-bit testcase from the 32-bit one to cover the different
98642         EVEX.W treatment in both cases.
98643
98644 2021-07-22  Jan Beulich  <jbeulich@suse.com>
98645
98646         x86: drop OP_Mask()
98647         By moving its vex.r check there it becomes fully redundant with OP_G().
98648
98649 2021-07-22  GDB Administrator  <gdbadmin@sourceware.org>
98650
98651         Automatic date update in version.in
98652
98653 2021-07-21  Tom de Vries  <tdevries@suse.de>
98654
98655         [gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11
98656         When running test-case gdb.cp/step-and-next-inline.exp with gcc-11, I run
98657         into:
98658         ...
98659         KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 1 \
98660           (PRMS symtab/25507)
98661         FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 2
98662         KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 3 \
98663           (PRMS symtab/25507)
98664         ...
98665
98666         [ Note that I get the same result with gcc-11 and target board
98667         unix/gdb:debug_flags=-gdwarf-4, so this is not a dwarf 4 vs 5 issue. ]
98668
98669         With gcc-10, I have this trace:
98670         ...
98671         64        get_alias_set (&xx);
98672         get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51
98673         51        if (t != NULL
98674         40        if (t->x != i)
98675         52            && TREE_TYPE (t).z != 1
98676         43        return x;
98677         53            && TREE_TYPE (t).z != 2
98678         43        return x;
98679         54            && TREE_TYPE (t).z != 3)
98680         43        return x;
98681         main () at step-and-next-inline.cc:65
98682         65        return 0;
98683         ...
98684         and with gcc-11, I have instead:
98685         ...
98686         64        get_alias_set (&xx);
98687         get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51
98688         51        if (t != NULL
98689         52            && TREE_TYPE (t).z != 1
98690         43        return x;
98691         53            && TREE_TYPE (t).z != 2
98692         43        return x;
98693         54            && TREE_TYPE (t).z != 3)
98694         43        return x;
98695         main () at step-and-next-inline.cc:65
98696         65        return 0;
98697         ...
98698         and with clang-10, I have instead:
98699         ...
98700         64        get_alias_set (&xx);
98701         get_alias_set (t=0x601034 <xx>) at step-and-next-inline.cc:51
98702         51        if (t != NULL
98703         52            && TREE_TYPE (t).z != 1
98704         53            && TREE_TYPE (t).z != 2
98705         54            && TREE_TYPE (t).z != 3)
98706         51        if (t != NULL
98707         57      }
98708         main () at step-and-next-inline.cc:65
98709         65        return 0;
98710         ...
98711
98712         The test-case tries to verify that we don't step into inlined function
98713         tree_check (lines 40-43) (so, with the clang trace we get that right).
98714
98715         The test-case then tries to kfail the problems when using gcc, but this is
98716         done in such a way that the testing still gets out of sync after a failure.
98717         That is: the "next step 2" check that is supposed to match
98718         "TREE_TYPE (t).z != 2" is actually matching "TREE_TYPE (t).z != 1":
98719         ...
98720         (gdb) next^M
98721         52            && TREE_TYPE (t).z != 1^M
98722         (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: next step 2
98723         ...
98724
98725         Fix this by issuing extra nexts to arrive at the required lines.
98726
98727         Tested on x86_64-linux, with gcc-8, gcc-9, gcc-10, gcc-11, clang-8, clang-10
98728         and clang-12.
98729
98730         gdb/testsuite/ChangeLog:
98731
98732         2021-07-20  Tom de Vries  <tdevries@suse.de>
98733
98734                 * gdb.cp/step-and-next-inline.cc (tree_check, get_alias_set, main):
98735                 Tag closing brace with comment.
98736                 * gdb.cp/step-and-next-inline.h: Update to keep identical with
98737                 step-and-next-inline.cc.
98738                 * gdb.cp/step-and-next-inline.exp: Issue extra next when required.
98739
98740 2021-07-21  Nick Clifton  <nickc@redhat.com>
98741
98742         Updated Russian translation for the bfd library
98743
98744 2021-07-21  Luca Boccassi  <luca.boccassi@microsoft.com>
98745
98746         Allows linker scripts to set the SEC_READONLY flag.
98747         * ld.texi: Document new output section type.
98748         * ldgram.y: Add new token.
98749         * ldlang.c: Handle the new flag.
98750         * ldlang.h: Add readonly_section to list of section types.
98751         * ldlex.l: Add a new identifier.
98752         * testsuite/ld-scripts/output-section-types.t: New example linker script.
98753         * testsuite/ld-scripts/output-section-types.d: Test driver.
98754         * testsyute/ld-scripts/script.exp: Run the new test.
98755
98756 2021-07-21  Tom de Vries  <tdevries@suse.de>
98757
98758         [gdb/testsuite] Fix FAILs due to PR gcc/101452
98759         When running test-case gdb.base/ptype-offsets.exp with gcc-11 (with -gdwarf-5
98760         default) or gcc-10 with target board unix/gdb:debug_flags=-gdwarf-5 we run
98761         into this regression:
98762         ...
98763          (gdb) ptype/o static_member^M
98764          /* offset      |    size */  type = struct static_member {^M
98765         -                               static static_member Empty;^M
98766          /*      0      |       4 */    int abc;^M
98767          ^M
98768                                         /* total size (bytes):    4 */^M
98769                                       }^M
98770         -(gdb) PASS: gdb.base/ptype-offsets.exp: ptype/o static_member
98771         +(gdb) FAIL: gdb.base/ptype-offsets.exp: ptype/o static_member
98772         ...
98773
98774         This is caused by missing debug info, which I filed as gcc PR101452 - "[debug,
98775         dwarf-5] undefined static member removed by
98776         -feliminate-unused-debug-symbols".
98777
98778         It's not clear yet whether this is a bug or a feature, but work around this in
98779         the test-cases by:
98780         - defining the static member
98781         - adding additional_flags=-fno-eliminate-unused-debug-types.
98782
98783         Tested on x86_64-linux.
98784
98785         gdb/testsuite/ChangeLog:
98786
98787         2021-07-20  Tom de Vries  <tdevries@suse.de>
98788
98789                 * lib/gdb.exp (gcc_major_version): New proc.
98790                 * gdb.base/ptype-offsets.cc: Define static member static_member::Empty.
98791                 * gdb.cp/templates.exp: Define static member using -DGCC_BUG.
98792                 * gdb.cp/m-static.exp: Add
98793                 additional_flags=-fno-eliminate-unused-debug-types.
98794                 * gdb.cp/pr-574.exp: Same.
98795                 * gdb.cp/pr9167.exp: Same.
98796
98797 2021-07-21  Tom de Vries  <tdevries@suse.de>
98798
98799         [gdb/testsuite] Add KFAILs for gdb.ada FAILs with gcc-11
98800         With gcc-11 we run into:
98801         ...
98802         (gdb) print pa_ptr.all^M
98803         That operation is not available on integers of more than 8 bytes.^M
98804         (gdb) KFAIL: gdb.ada/arrayptr.exp: scenario=all: print pa_ptr.all (PRMS: gdb/20991)
98805         ...
98806
98807         This is due to PR exp/20991 - "__int128 type support".  Mark this and similar
98808         FAILs as KFAIL.
98809
98810         Also mark this FAIL:
98811         ....
98812         (gdb) print pa_ptr(3)^M
98813         cannot subscript or call something of type `foo__packed_array_ptr'^M
98814         (gdb) FAIL: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr(3)
98815         ...
98816         as a KFAIL for PR ada/28115 - "Support packed array encoded as
98817         DW_TAG_subrange_type".
98818
98819         Tested on x86_64-linux, with gcc-10 and gcc-11.
98820
98821         gdb/testsuite/ChangeLog:
98822
98823         2021-07-21  Tom de Vries  <tdevries@suse.de>
98824
98825                 * gdb.ada/arrayptr.exp: Add KFAILs for PR20991 and PR28115.
98826                 * gdb.ada/exprs.exp: Add KFAILs for PR20991.
98827                 * gdb.ada/packed_array_assign.exp: Same.
98828
98829 2021-07-21  Alan Modra  <amodra@gmail.com>
98830
98831         as_bad_subtract
98832         Many places report errors of the nature "can't resolve a - b".
98833         This provides a utility function to report such errors consistently.
98834         I removed the section reporting and quotes around symbol names while I
98835         was at it.  Compare
98836         ifunc-2.s:4: Error: can't resolve `bar1' {.text.1 section} - `foo1' {.text.1 section}
98837         with
98838         ifunc-2.s:4: Error: can't resolve bar1 - foo1
98839
98840         In many cases the section names don't help the user very much in
98841         figuring out what went wrong, and the quotes if present arguably ought
98842         to be placed around the entire expression:
98843         can't resolve `bar1 - foo1'
98844
98845         The patch also tidies some tc_get_reloc functions that leak memory on
98846         error paths.
98847
98848                 * write.h (as_bad_subtract): Declare.
98849                 * write.c (as_bad_subtract): New function.
98850                 (fixup_segment): Use as_bad_subtract.
98851                 * config/tc-arc.c (md_apply_fix): Likewise.
98852                 * config/tc-avr.c (md_apply_fix, tc_gen_reloc): Likewise.
98853                 * config/tc-cris.c (md_apply_fix): Likewise.
98854                 * config/tc-d10v.c (md_apply_fix): Likewise.
98855                 * config/tc-d30v.c (md_apply_fix): Likewise.
98856                 * config/tc-ft32.c (md_apply_fix): Likewise.
98857                 * config/tc-h8300.c (tc_gen_reloc): Likewise.
98858                 * config/tc-m68hc11.c (md_apply_fix): Likewise.
98859                 * config/tc-mmix.c (mmix_frob_file): Likewise.
98860                 * config/tc-mn10200.c (tc_gen_reloc): Likewise.
98861                 * config/tc-nds32.c (nds32_apply_fix): Likewise.
98862                 * config/tc-pru.c (md_apply_fix): Likewise.
98863                 * config/tc-riscv.c (md_apply_fix): Likewise.
98864                 * config/tc-s12z.c (md_apply_fix): Likewise.
98865                 * config/tc-s390.c (md_apply_fix): Likewise.
98866                 * config/tc-tilegx.c (md_apply_fix): Likewise.
98867                 * config/tc-tilepro.c (md_apply_fix): Likewise.
98868                 * config/tc-v850.c (md_apply_fix): Likewise.
98869                 * config/tc-vax.c (md_apply_fix): Likewise.
98870                 * config/tc-xc16x.c (tc_gen_reloc): Likewise.
98871                 * config/tc-xgate.c (md_apply_fix): Likewise.
98872                 * config/tc-xstormy16.c (xstormy16_md_apply_fix): Likewise.
98873                 * config/tc-xtensa.c (md_apply_fix): Likewise.
98874                 * config/tc-z80.c (tc_gen_reloc): Likewise.
98875                 * config/tc-spu.c (md_apply_fix): Likewise.
98876                 (tc_gen_reloc): Delete dead code.  Free memory on error.
98877                 * config/tc-cr16.c (tc_gen_reloc): Use as_bad_subtract.  Free
98878                 on error.
98879                 * config/tc-crx.c (tc_gen_reloc): Likewise.
98880                 * config/tc-ppc.c (tc_gen_reloc): Likewise.
98881                 * testsuite/gas/i386/ifunc-2.l: Adjust to suit changed error message.
98882                 * testsuite/gas/mips/lui-2.l: Likewise.
98883                 * testsuite/gas/tic6x/reloc-bad-1.l: Likewise.
98884
98885 2021-07-21  John Ericson  <git@JohnEricson.me>
98886
98887         Remove `netbsdpe` support
98888         netbsdpe was deprecated in c2ce831330e10dab4703094491f80b6b9a5c2289.
98889         Since then, a release has passed (2.37), and it was marked obselete in
98890         5c9cbf07f3f972ecffe13d858010b3179df17b32. Unless I am mistaken, that
98891         means we can now remove support altogether.
98892
98893         All branches in the "active" code are remove, and the target is
98894         additionally marked as obsolete next to the other removed ones for
98895         libbfd and gdb.
98896
98897         Per [1] from the NetBSD toolchain list, PE/COFF support was removed a
98898         decade ago. Furthermore, the sole mention of this target in the binutils
98899         commit history was in 2002. Together, I'm led to believe this target
98900         hasn't seen much attention in quite a while.
98901
98902         [1]: https://mail-index.netbsd.org/tech-toolchain/2021/06/16/msg003996.html
98903
98904         bfd/
98905                 * config.bfd: Remove netbsdpe entry.
98906         binutils/
98907                 * configure.ac: Remove netbsdpe entry.
98908                 * testsuite/lib/binutils-common.exp (is_pecoff_format): Likewise.
98909                 * configure: Regenerate.
98910         gas/
98911                 * configure.tgt: Remove netbsdpe entry.
98912         gdb/
98913                 * configure.tgt: Add netbsdpe to removed targets.
98914         ld/
98915                 * configure.tgt: Remove netbsdpe entry.
98916                 * testsuite/ld-bootstrap/bootstrap.exp: Likewise.
98917
98918 2021-07-21  GDB Administrator  <gdbadmin@sourceware.org>
98919
98920         Automatic date update in version.in
98921
98922 2021-07-20  Alan Modra  <amodra@gmail.com>
98923
98924         PR28106, build of 2.37 fails on FreeBSD and Clang
98925         https://en.cppreference.com/w/cpp/types/NULL says NULL might be
98926         defined as nullptr.
98927         https://en.cppreference.com/w/cpp/language/reinterpret_cast says
98928         reinterpret_cast can't be used on nullptr.
98929
98930                 PR gold/28106
98931                 PR gold/27815
98932                 * gc.h (gc_process_relocs): Use static_cast in Section_id constructor.
98933
98934 2021-07-20  Luis Machado  <luis.machado@linaro.org>
98935
98936         Fix printing of non-address types when memory tagging is enabled
98937         When the architecture supports memory tagging, we handle
98938         pointer/reference types in a special way, so we can validate tags and
98939         show mismatches.
98940
98941         Unfortunately, the currently implementation errors out when the user
98942         prints non-address values: composite types, floats, references, member
98943         functions and other things.
98944
98945         Vector registers:
98946
98947          (gdb) p $v0
98948          Value can't be converted to integer.
98949
98950         Non-existent internal variables:
98951
98952          (gdb) p $foo
98953          Value can't be converted to integer.
98954
98955         The same happens for complex types and printing struct/union types.
98956
98957         There are a few problems here.
98958
98959         The first one is that after print_command_1 evaluates the expression
98960         to print, the tag validation code call value_as_address
98961         unconditionally, without making sure we have have a suitable type
98962         where it makes to sense to call it.  That results in value_as_address
98963         (if it isn't given a pointer-like type) trying to treat the value as
98964         an integer and convert it to an address, which #1 - doesn't make sense
98965         (i.e., no sense in validating tags after "print 1"), and throws for
98966         non-integer-convertible types.  We fix this by making sure we have a
98967         pointer or reference type first, and only if so then proceed to check
98968         if the address-like value has tags.
98969
98970         The second is that we're calling value_as_address even if we have an
98971         optimized out or unavailable value, which throws, because the value's
98972         contents aren't fully accessible/readable.  This error currently
98973         escapes out and aborts the print.  This case is fixed by checking for
98974         optimized out / unavailable explicitly.
98975
98976         Third, the tag checking process does not gracefully handle exceptions.
98977         If any exception is thrown from the tag validation code, we abort the
98978         print.  E.g., the target may fail to access tags via a running thread.
98979         Or the needed /proc files aren't available.  Or some other untold
98980         reason.  This is a bit too rigid.  This commit changes print_command_1
98981         to catch errors, print them, and still continue with the normal
98982         expression printing path instead of erroring out and printing nothing
98983         useful.
98984
98985         With this patch, printing works correctly again:
98986
98987          (gdb) p $v0
98988          $1 = {d = {f = {2.0546950501119882e-81, 2.0546950501119882e-81}, u = {3399988123389603631, 3399988123389603631}, s = {
98989                3399988123389603631, 3399988123389603631}}, s = {f = {1.59329203e-10, 1.59329203e-10, 1.59329203e-10, 1.59329203e-10}, u = {
98990                791621423, 791621423, 791621423, 791621423}, s = {791621423, 791621423, 791621423, 791621423}}, h = {bf = {1.592e-10,
98991                1.592e-10, 1.592e-10, 1.592e-10, 1.592e-10, 1.592e-10, 1.592e-10, 1.592e-10}, f = {0.11224, 0.11224, 0.11224, 0.11224, 0.11224,
98992                0.11224, 0.11224, 0.11224}, u = {12079, 12079, 12079, 12079, 12079, 12079, 12079, 12079}, s = {12079, 12079, 12079, 12079,
98993                12079, 12079, 12079, 12079}}, b = {u = {47 <repeats 16 times>}, s = {47 <repeats 16 times>}}, q = {u = {
98994                62718710765820030520700417840365121327}, s = {62718710765820030520700417840365121327}}}
98995          (gdb) p $foo
98996          $2 = void
98997          (gdb) p 2 + 2i
98998          $3 = 2 + 2i
98999
99000         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28110
99001
99002 2021-07-20  Nelson Chu  <nelson.chu@sifive.com>
99003
99004         RISC-V: Minor updates for architecture parser.
99005         * Two add subset functions is redundant.  Keep the riscv_add_implicit_subset,
99006         and renamed it to riscv_add_subset.  Besides, if the subset is added in order,
99007         then we just add it at the tail of the subset list.
99008
99009         * Removed the "-march:" prefix from the error messages.  Since not only the
99010         -march= option will use the parser, but also the architecture elf attributes,
99011         the default architecture setting and linker will use the same parser.
99012
99013         * Use a function, riscv_parse_check_conflicts, to check the conflicts
99014         of extensions, including the rv64e and rv32q.
99015
99016         The rv32emc-elf/rv32i-elf/rv32gc-linux/rv64gc-elf/rv64gc-linux regressions
99017         are tested and passed.
99018
99019         bfd/
99020                 * elfxx-riscv.c (riscv_lookup_subset): Check the subset tail list
99021                 first.  If the subset is added in order, then we can just add it to
99022                 the tail without searching the whole list.
99023                 (riscv_add_subset): Replaced by riscv_add_implicit_subset.
99024                 (riscv_add_implicit_subset): Renamed to riscv_add_subset.
99025                 (riscv_parse_add_subset): Updated.
99026                 (riscv_parsing_subset_version): Removed the "-march:" prefix from
99027                 the error message.
99028                 (riscv_parse_prefixed_ext): Likewise.
99029                 (riscv_parse_std_ext): Likewise.  And move the rv<xlen>e check
99030                 to riscv_parse_check_conflicts.
99031                 (riscv_parse_check_conflicts): New function used to check conflicts.
99032                 (riscv_parse_subset): Updated.
99033         gas/
99034                 * testsuite/gas/riscv/march-fail-base-02.l: Updated.
99035                 * testsuite/gas/riscv/march-fail-unknown-std.l: Likewise.
99036
99037 2021-07-20  GDB Administrator  <gdbadmin@sourceware.org>
99038
99039         Automatic date update in version.in
99040
99041 2021-07-19  Simon Marchi  <simon.marchi@polymtl.ca>
99042
99043         gdb: set current thread in btrace_compute_ftrace_{bts,pt}
99044         As documented in bug 28086, test gdb.btrace/enable-new-thread.exp
99045         started failing with commit 0618ae414979 ("gdb: optimize
99046         all_matching_threads_iterator"):
99047
99048             (gdb) record btrace^M
99049             (gdb) PASS: gdb.btrace/enable-new-thread.exp: record btrace
99050             break 24^M
99051             Breakpoint 2 at 0x555555555175: file /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.btrace/enable-new-thread.c, line 24.^M
99052             (gdb) continue^M
99053             Continuing.^M
99054             /home/smarchi/src/binutils-gdb/gdb/inferior.c:303: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.^M
99055             A problem internal to GDB has been detected,^M
99056             further debugging may prove unreliable.^M
99057             Quit this debugging session? (y or n) FAIL: gdb.btrace/enable-new-thread.exp: continue to breakpoint: cont to bp.1 (GDB internal error)
99058
99059         Note that I only see the failure if GDB is compiled without libipt
99060         support.  This is because GDB then makes use BTS instead of PT, so
99061         exercises different code paths.
99062
99063         I think that the commit above just exposed an existing problem.  The
99064         stack trace of the internal error is:
99065
99066             #8  0x0000561cb81e404e in internal_error (file=0x561cb83aa2f8 "/home/smarchi/src/binutils-gdb/gdb/inferior.c", line=303, fmt=0x561cb83aa099 "%s: Assertion `%s' failed.") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:55
99067             #9  0x0000561cb7b5c031 in find_inferior_pid (targ=0x561cb8aafb60 <the_amd64_linux_nat_target>, pid=0) at /home/smarchi/src/binutils-gdb/gdb/inferior.c:303
99068             #10 0x0000561cb7b5c102 in find_inferior_ptid (targ=0x561cb8aafb60 <the_amd64_linux_nat_target>, ptid=...) at /home/smarchi/src/binutils-gdb/gdb/inferior.c:317
99069             #11 0x0000561cb7f1d1c3 in find_thread_ptid (targ=0x561cb8aafb60 <the_amd64_linux_nat_target>, ptid=...) at /home/smarchi/src/binutils-gdb/gdb/thread.c:487
99070             #12 0x0000561cb7f1b921 in all_matching_threads_iterator::all_matching_threads_iterator (this=0x7ffc4ee34678, filter_target=0x561cb8aafb60 <the_amd64_linux_nat_target>, filter_ptid=...) at /home/smarchi/src/binutils-gdb/gdb/thread-iter.c:125
99071             #13 0x0000561cb77bc462 in filtered_iterator<all_matching_threads_iterator, non_exited_thread_filter>::filtered_iterator<process_stratum_target* const&, ptid_t const&> (this=0x7ffc4ee34670) at /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/filtered-iterator.h:42
99072             #14 0x0000561cb77b97cb in all_non_exited_threads_range::begin (this=0x7ffc4ee34650) at /home/smarchi/src/binutils-gdb/gdb/thread-iter.h:243
99073             #15 0x0000561cb7d8ba30 in record_btrace_target::record_is_replaying (this=0x561cb8aa6250 <record_btrace_ops>, ptid=...) at /home/smarchi/src/binutils-gdb/gdb/record-btrace.c:1411
99074             #16 0x0000561cb7d8bb83 in record_btrace_target::xfer_partial (this=0x561cb8aa6250 <record_btrace_ops>, object=TARGET_OBJECT_MEMORY, annex=0x0, readbuf=0x7ffc4ee34c58 "\260g\343N\374\177", writebuf=0x0, offset=140737352774277, len=1, xfered_len=0x7ffc4ee34ad8) at /home/smarchi/src/binutils-gdb/gdb/record-btrace.c:1437
99075             #17 0x0000561cb7ef73a9 in raw_memory_xfer_partial (ops=0x561cb8aa6250 <record_btrace_ops>, readbuf=0x7ffc4ee34c58 "\260g\343N\374\177", writebuf=0x0, memaddr=140737352774277, len=1, xfered_len=0x7ffc4ee34ad8) at /home/smarchi/src/binutils-gdb/gdb/target.c:1504
99076             #18 0x0000561cb7ef77da in memory_xfer_partial_1 (ops=0x561cb8aa6250 <record_btrace_ops>, object=TARGET_OBJECT_CODE_MEMORY, readbuf=0x7ffc4ee34c58 "\260g\343N\374\177", writebuf=0x0, memaddr=140737352774277, len=1, xfered_len=0x7ffc4ee34ad8) at /home/smarchi/src/binutils-gdb/gdb/target.c:1635
99077             #19 0x0000561cb7ef78b5 in memory_xfer_partial (ops=0x561cb8aa6250 <record_btrace_ops>, object=TARGET_OBJECT_CODE_MEMORY, readbuf=0x7ffc4ee34c58 "\260g\343N\374\177", writebuf=0x0, memaddr=140737352774277, len=1, xfered_len=0x7ffc4ee34ad8) at /home/smarchi/src/binutils-gdb/gdb/target.c:1664
99078             #20 0x0000561cb7ef7ba4 in target_xfer_partial (ops=0x561cb8aa6250 <record_btrace_ops>, object=TARGET_OBJECT_CODE_MEMORY, annex=0x0, readbuf=0x7ffc4ee34c58 "\260g\343N\374\177", writebuf=0x0, offset=140737352774277, len=1, xfered_len=0x7ffc4ee34ad8) at /home/smarchi/src/binutils-gdb/gdb/target.c:1721
99079             #21 0x0000561cb7ef8503 in target_read_partial (ops=0x561cb8aa6250 <record_btrace_ops>, object=TARGET_OBJECT_CODE_MEMORY, annex=0x0, buf=0x7ffc4ee34c58 "\260g\343N\374\177", offset=140737352774277, len=1, xfered_len=0x7ffc4ee34ad8) at /home/smarchi/src/binutils-gdb/gdb/target.c:1974
99080             #22 0x0000561cb7ef861f in target_read (ops=0x561cb8aa6250 <record_btrace_ops>, object=TARGET_OBJECT_CODE_MEMORY, annex=0x0, buf=0x7ffc4ee34c58 "\260g\343N\374\177", offset=140737352774277, len=1) at /home/smarchi/src/binutils-gdb/gdb/target.c:2014
99081             #23 0x0000561cb7ef809f in target_read_code (memaddr=140737352774277, myaddr=0x7ffc4ee34c58 "\260g\343N\374\177", len=1) at /home/smarchi/src/binutils-gdb/gdb/target.c:1869
99082             #24 0x0000561cb7937f4d in gdb_disassembler::dis_asm_read_memory (memaddr=140737352774277, myaddr=0x7ffc4ee34c58 "\260g\343N\374\177", len=1, info=0x7ffc4ee34e88) at /home/smarchi/src/binutils-gdb/gdb/disasm.c:139
99083             #25 0x0000561cb80ab66d in fetch_data (info=0x7ffc4ee34e88, addr=0x7ffc4ee34c59 "g\343N\374\177") at /home/smarchi/src/binutils-gdb/opcodes/i386-dis.c:194
99084             #26 0x0000561cb80ab7e2 in ckprefix () at /home/smarchi/src/binutils-gdb/opcodes/i386-dis.c:8628
99085             #27 0x0000561cb80adbd8 in print_insn (pc=140737352774277, info=0x7ffc4ee34e88) at /home/smarchi/src/binutils-gdb/opcodes/i386-dis.c:9587
99086             #28 0x0000561cb80abe4f in print_insn_i386 (pc=140737352774277, info=0x7ffc4ee34e88) at /home/smarchi/src/binutils-gdb/opcodes/i386-dis.c:8894
99087             #29 0x0000561cb7744a19 in default_print_insn (memaddr=140737352774277, info=0x7ffc4ee34e88) at /home/smarchi/src/binutils-gdb/gdb/arch-utils.c:1029
99088             #30 0x0000561cb7b33067 in i386_print_insn (pc=140737352774277, info=0x7ffc4ee34e88) at /home/smarchi/src/binutils-gdb/gdb/i386-tdep.c:4013
99089             #31 0x0000561cb7acd8f4 in gdbarch_print_insn (gdbarch=0x561cbae2fb60, vma=140737352774277, info=0x7ffc4ee34e88) at /home/smarchi/src/binutils-gdb/gdb/gdbarch.c:3478
99090             #32 0x0000561cb793a32d in gdb_disassembler::print_insn (this=0x7ffc4ee34e80, memaddr=140737352774277, branch_delay_insns=0x0) at /home/smarchi/src/binutils-gdb/gdb/disasm.c:795
99091             #33 0x0000561cb793a5b0 in gdb_print_insn (gdbarch=0x561cbae2fb60, memaddr=140737352774277, stream=0x561cb8ac99f8 <null_stream>, branch_delay_insns=0x0) at /home/smarchi/src/binutils-gdb/gdb/disasm.c:850
99092             #34 0x0000561cb793a631 in gdb_insn_length (gdbarch=0x561cbae2fb60, addr=140737352774277) at /home/smarchi/src/binutils-gdb/gdb/disasm.c:859
99093             #35 0x0000561cb77f53f4 in btrace_compute_ftrace_bts (tp=0x561cbba11210, btrace=0x7ffc4ee35188, gaps=...) at /home/smarchi/src/binutils-gdb/gdb/btrace.c:1107
99094             #36 0x0000561cb77f55f5 in btrace_compute_ftrace_1 (tp=0x561cbba11210, btrace=0x7ffc4ee35180, cpu=0x0, gaps=...) at /home/smarchi/src/binutils-gdb/gdb/btrace.c:1527
99095             #37 0x0000561cb77f5705 in btrace_compute_ftrace (tp=0x561cbba11210, btrace=0x7ffc4ee35180, cpu=0x0) at /home/smarchi/src/binutils-gdb/gdb/btrace.c:1560
99096             #38 0x0000561cb77f583b in btrace_add_pc (tp=0x561cbba11210) at /home/smarchi/src/binutils-gdb/gdb/btrace.c:1589
99097             #39 0x0000561cb77f5a86 in btrace_enable (tp=0x561cbba11210, conf=0x561cb8ac6878 <record_btrace_conf>) at /home/smarchi/src/binutils-gdb/gdb/btrace.c:1629
99098             #40 0x0000561cb7d88d26 in record_btrace_enable_warn (tp=0x561cbba11210) at /home/smarchi/src/binutils-gdb/gdb/record-btrace.c:294
99099             #41 0x0000561cb7c603dc in std::__invoke_impl<void, void (*&)(thread_info*), thread_info*> (__f=@0x561cbb6c4878: 0x561cb7d88cdc <record_btrace_enable_warn(thread_info*)>) at /usr/include/c++/10/bits/invoke.h:60
99100             #42 0x0000561cb7c5e5a6 in std::__invoke_r<void, void (*&)(thread_info*), thread_info*> (__fn=@0x561cbb6c4878: 0x561cb7d88cdc <record_btrace_enable_warn(thread_info*)>) at /usr/include/c++/10/bits/invoke.h:153
99101             #43 0x0000561cb7c5dc92 in std::_Function_handler<void (thread_info*), void (*)(thread_info*)>::_M_invoke(std::_Any_data const&, thread_info*&&) (__functor=..., __args#0=@0x7ffc4ee35310: 0x561cbba11210) at /usr/include/c++/10/bits/std_function.h:291
99102             #44 0x0000561cb7f2600f in std::function<void (thread_info*)>::operator()(thread_info*) const (this=0x561cbb6c4878, __args#0=0x561cbba11210) at /usr/include/c++/10/bits/std_function.h:622
99103             #45 0x0000561cb7f23dc8 in gdb::observers::observable<thread_info*>::notify (this=0x561cb8ac5aa0 <gdb::observers::new_thread>, args#0=0x561cbba11210) at /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/observable.h:150
99104             #46 0x0000561cb7f1c436 in add_thread_silent (targ=0x561cb8aafb60 <the_amd64_linux_nat_target>, ptid=...) at /home/smarchi/src/binutils-gdb/gdb/thread.c:263
99105             #47 0x0000561cb7f1c479 in add_thread_with_info (targ=0x561cb8aafb60 <the_amd64_linux_nat_target>, ptid=..., priv=0x561cbb3f7ab0) at /home/smarchi/src/binutils-gdb/gdb/thread.c:272
99106             #48 0x0000561cb7bfa1d0 in record_thread (info=0x561cbb0413a0, tp=0x0, ptid=..., th_p=0x7ffc4ee35610, ti_p=0x7ffc4ee35620) at /home/smarchi/src/binutils-gdb/gdb/linux-thread-db.c:1380
99107             #49 0x0000561cb7bf7a2a in thread_from_lwp (stopped=0x561cba81db20, ptid=...) at /home/smarchi/src/binutils-gdb/gdb/linux-thread-db.c:429
99108             #50 0x0000561cb7bf7ac5 in thread_db_notice_clone (parent=..., child=...) at /home/smarchi/src/binutils-gdb/gdb/linux-thread-db.c:447
99109             #51 0x0000561cb7bdc9a2 in linux_handle_extended_wait (lp=0x561cbae25720, status=4991) at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:1981
99110             #52 0x0000561cb7bdf0f3 in linux_nat_filter_event (lwpid=435403, status=198015) at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:2920
99111             #53 0x0000561cb7bdfed6 in linux_nat_wait_1 (ptid=..., ourstatus=0x7ffc4ee36398, target_options=...) at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:3202
99112             #54 0x0000561cb7be0b68 in linux_nat_target::wait (this=0x561cb8aafb60 <the_amd64_linux_nat_target>, ptid=..., ourstatus=0x7ffc4ee36398, target_options=...) at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:3440
99113             #55 0x0000561cb7bfa2fc in thread_db_target::wait (this=0x561cb8a9acd0 <the_thread_db_target>, ptid=..., ourstatus=0x7ffc4ee36398, options=...) at /home/smarchi/src/binutils-gdb/gdb/linux-thread-db.c:1412
99114             #56 0x0000561cb7d8e356 in record_btrace_target::wait (this=0x561cb8aa6250 <record_btrace_ops>, ptid=..., status=0x7ffc4ee36398, options=...) at /home/smarchi/src/binutils-gdb/gdb/record-btrace.c:2547
99115             #57 0x0000561cb7ef996d in target_wait (ptid=..., status=0x7ffc4ee36398, options=...) at /home/smarchi/src/binutils-gdb/gdb/target.c:2608
99116             #58 0x0000561cb7b6d297 in do_target_wait_1 (inf=0x561cba6d8780, ptid=..., status=0x7ffc4ee36398, options=...) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:3640
99117             #59 0x0000561cb7b6d43e in operator() (__closure=0x7ffc4ee36190, inf=0x561cba6d8780) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:3701
99118             #60 0x0000561cb7b6d7b2 in do_target_wait (ecs=0x7ffc4ee36370, options=...) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:3720
99119             #61 0x0000561cb7b6e67d in fetch_inferior_event () at /home/smarchi/src/binutils-gdb/gdb/infrun.c:4069
99120             #62 0x0000561cb7b4659b in inferior_event_handler (event_type=INF_REG_EVENT) at /home/smarchi/src/binutils-gdb/gdb/inf-loop.c:41
99121             #63 0x0000561cb7be25f7 in handle_target_event (error=0, client_data=0x0) at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:4227
99122             #64 0x0000561cb81e4ee2 in handle_file_event (file_ptr=0x561cbae24e10, ready_mask=1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:575
99123             #65 0x0000561cb81e5490 in gdb_wait_for_event (block=0) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:701
99124             #66 0x0000561cb81e41be in gdb_do_one_event () at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:212
99125             #67 0x0000561cb7c18096 in start_event_loop () at /home/smarchi/src/binutils-gdb/gdb/main.c:421
99126             #68 0x0000561cb7c181e0 in captured_command_loop () at /home/smarchi/src/binutils-gdb/gdb/main.c:481
99127             #69 0x0000561cb7c19d7e in captured_main (data=0x7ffc4ee366a0) at /home/smarchi/src/binutils-gdb/gdb/main.c:1353
99128             #70 0x0000561cb7c19df0 in gdb_main (args=0x7ffc4ee366a0) at /home/smarchi/src/binutils-gdb/gdb/main.c:1368
99129             #71 0x0000561cb7693186 in main (argc=11, argv=0x7ffc4ee367b8) at /home/smarchi/src/binutils-gdb/gdb/gdb.c:32
99130
99131         At frame 45, the new_thread observable is fired.  At this moment, the
99132         new thread isn't the current thread, inferior_ptid is null_ptid.  I
99133         think this is ok: the new_thread observable doesn't give any guarantee
99134         on the global context when observers are invoked.  Frame 35,
99135         btrace_compute_ftrace_bts, calls gdb_insn_length.  gdb_insn_length
99136         doesn't have a thread_info or other parameter what could indicate where
99137         to read memory from, it implicitly uses the global context
99138         (inferior_ptid).
99139
99140         So we reach the all_non_exited_threads_range in
99141         record_btrace_target::record_is_replaying with a null inferior_ptid.
99142         The previous implemention of all_non_exited_threads_range didn't care,
99143         but the new one does.  The problem of calling gdb_insn_length and
99144         ultimately trying to read memory with a null inferior_ptid already
99145         existed, but the commit mentioned above made it visible.
99146
99147         Something between frames 40 (record_btrace_enable_warn) and 35
99148         (btrace_compute_ftrace_bts) needs to be switching the global context to
99149         make TP the current thread.  Since btrace_compute_ftrace_bts takes the
99150         thread_info to work with as a parameter, that typically means that it
99151         doesn't require its caller to also set the global current context
99152         (current thread) when calling.  If it needs to call other functions
99153         that do require the global current thread to be set, then it needs to
99154         temporarily change the current thread while calling these other
99155         functions.  Therefore, switch and restore the current thread in
99156         btrace_compute_ftrace_bts.
99157
99158         By inspection, it looks like btrace_compute_ftrace_pt may also call
99159         functions sensitive to the global context: it installs the
99160         btrace_pt_readmem_callback callback in the PT instruction decoder.  When
99161         this function gets called, inferior_ptid must be set appropriately.  Add
99162         a switch and restore in there too.
99163
99164         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28086
99165         Change-Id: I407fbfe41aab990068bd102491aa3709b0a034b3
99166
99167 2021-07-19  GDB Administrator  <gdbadmin@sourceware.org>
99168
99169         Automatic date update in version.in
99170
99171 2021-07-18  Nick Clifton  <nickc@redhat.com>
99172
99173         Move pending-obsolesence targets onto the obsolete list.
99174                 * config.bfd: Move pending obsoletion targets to obsolete list.
99175
99176         Update how-to-make-a-release checklist with latest changes from 2.37 release
99177
99178 2021-07-18  Michael Krasnyk  <mkrasnyk@argo.ai>
99179
99180         PR28098 Skip R_*_NONE relocation entries with zero r_sym without counting
99181                 PR gold/28098
99182                 * reloc.cc (Track_relocs::advance): Skip R_*_NONE relocation entries
99183                 with r_sym of zero without counting in advance method.
99184
99185 2021-07-18  Simon Marchi  <simon.marchi@polymtl.ca>
99186
99187         gdb: convert nat/x86-dregs.c macros to functions
99188         I'm debugging why GDB crashes on OpenBSD/amd64, turns out it's because
99189         x86_dr_low.get_status is nullptr.  It would have been useful to be able
99190         to break on x86_dr_low_get_status, so I thought it would be a good
99191         reason to convert these function-like macros into functions.
99192
99193         Change-Id: Ic200b50ef8455b4697bc518da0fa2bb704cf4721
99194
99195 2021-07-18  GDB Administrator  <gdbadmin@sourceware.org>
99196
99197         Automatic date update in version.in
99198
99199 2021-07-17  Tom Tromey  <tom@tromey.com>
99200
99201         Fix file-name handling regression with DWARF index
99202         When run with the gdb-index or debug-names target boards, dup-psym.exp
99203         fails.  This came up for me because my new DWARF scanner reuses this
99204         part of the existing index code, and so it registers as a regression.
99205         This is PR symtab/25834.
99206
99207         Looking into this, I found that the DWARF index code here is fairly
99208         different from the psymtab code.  I don't think there's a deep reason
99209         for this, and in fact, it seemed to me that the index code could
99210         simply mimic what the psymtab code already does.
99211
99212         That is what this patch implements.  The DW_AT_name and DW_AT_comp_dir
99213         are now stored in the quick file names table.  This may require
99214         allocating a quick file names table even when DW_AT_stmt_list does not
99215         exist.  Then, the functions that work with this data are changed to
99216         use find_source_or_rewrite, just as the psymbol code does.  Finally,
99217         line_header::file_full_name is removed, as it is no longer needed.
99218
99219         Currently, the index maintains a hash table of "quick file names".
99220         The hash table uses a deletion function to free the "real name"
99221         components when necessary.  There's also a second such function to
99222         implement the forget_cached_source_info method.
99223
99224         This bug fix patch will create a quick file name object even when
99225         there is no DW_AT_stmt_list, meaning that the object won't be entered
99226         in the hash table.  So, this patch changes the memory management
99227         approach so that the entries are cleared when the per-BFD object is
99228         destroyed.  (A dwarf2_per_cu_data destructor is not introduced,
99229         because we have been avoiding adding a vtable to that class.)
99230
99231         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25834
99232
99233 2021-07-17  Tom Tromey  <tom@tromey.com>
99234
99235         Check for debug-types in map_symbol_filenames
99236         map_symbol_filenames can skip type units -- in fact I think it has to,
99237         due to the assertion at the top of dw2_get_file_names.  This may be a
99238         regression due to the TU/CU unification patch, I did not check.
99239
99240         Simplify DWARF file name caching
99241         The DWARF index file name caching code only records when a line table
99242         has been read and the reading failed.  However, the code would be
99243         simpler if it recorded any attempt, which is what this patch
99244         implements.
99245
99246         Introduce find_source_or_rewrite
99247         The final bug fix in this series would duplicate the logic in
99248         psymtab_to_fullname, so this patch extracts the body of this function
99249         into a new function.
99250
99251         Simplify file_and_directory storage management
99252         file_and_directory carries a std::string in case the compilation
99253         directory is computed, but a subsequent patch wants to preserve this
99254         string without also having to maintain the storage for it.  So, this
99255         patch arranges for the compilation directory string to be stored in
99256         the per-BFD string bcache instead.
99257
99258         Pass file_and_directory through DWARF line-decoding code
99259         This patch removes the redundant "comp_unit" parameter from
99260         compute_include_file_name, and arranges to pass a file_and_directory
99261         object from the readers down to this function.  It also changes the
99262         partial symtab reader to use find_file_and_directory, rather than
99263         reimplement this functionality by hand.
99264
99265         Rename and refactor psymtab_include_file_name
99266         In order to fix an index-related regression, I want to use
99267         psymtab_include_file_name in the DWARF index file-handling code.  This
99268         patch renames this function and changes it to no longer require a
99269         partial symtab to be passed in.  A subsequent patch will further
99270         refactor this code to remove the redundant parameter (which was always
99271         there but is now more obvious).
99272
99273 2021-07-17  Sergey Belyashov  <Sergey.Belyashov@gmail.com>
99274
99275         Add basic Z80 CPU support
99276         Supported ISAs:
99277         - Z80 (all undocumented instructions)
99278         - Z180
99279         - eZ80 (Z80 mode only)
99280
99281         Datasheets:
99282         Z80: https://www.zilog.com/manage_directlink.php?filepath=docs/z80/um0080&extn=.pdf
99283         Z180: https://www.zilog.com/manage_directlink.php?filepath=docs/z180/ps0140&extn=.pdf
99284         eZ80: http://www.zilog.com/force_download.php?filepath=YUhSMGNEb3ZMM2QzZHk1NmFXeHZaeTVqYjIwdlpHOWpjeTlWVFRBd056Y3VjR1Jt
99285
99286         To debug Z80 programs using GDB you must configure and embed
99287         z80-stub.c to your program (SDCC compiler is required). Or
99288         you may use some simulator with GDB support.
99289
99290         gdb/ChangeLog:
99291
99292                 * Makefile.in (ALL_TARGET_OBS): Add z80-tdep.c.
99293                 * NEWS: Mention z80 support.
99294                 * configure.tgt: Handle z80*.
99295                 * features/Makefile (XMLTOC): Add z80.xml.
99296                 * features/z80-cpu.xml: New.
99297                 * features/z80.c: Generate.
99298                 * features/z80.xml: New.
99299                 * z80-tdep.c: New file.
99300                 * z80-tdep.h: New file.
99301
99302         gdb/stubs/ChangeLog:
99303
99304                 * z80-stub.c: New file.
99305
99306         Change-Id: Id0b7a6e210c3f93c6853c5e3031b7bcee47d0db9
99307
99308 2021-07-17  Simon Marchi  <simon.marchi@polymtl.ca>
99309
99310         gdb: make all_inferiors_safe actually work
99311         The test gdb.threads/fork-plus-threads.exp fails since 08bdefb58b78
99312         ("gdb: make inferior_list use intrusive_list"):
99313
99314             FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left
99315
99316         Looking at the log, we see that we are left with a bunch of inferiors in
99317         the detach-on-fork=off case:
99318
99319             info inferiors^M
99320               Num  Description       Connection           Executable        ^M
99321             * 1    <null>                                 <snip>/fork-plus-threads ^M
99322               2    <null>                                 <snip>/fork-plus-threads ^M
99323               3    <null>                                 <snip>/fork-plus-threads ^M
99324               4    <null>                                 <snip>/fork-plus-threads ^M
99325               5    <null>                                 <snip>/fork-plus-threads ^M
99326               6    <null>                                 <snip>/fork-plus-threads ^M
99327               7    <null>                                 <snip>/fork-plus-threads ^M
99328               8    <null>                                 <snip>/fork-plus-threads ^M
99329               9    <null>                                 <snip>/fork-plus-threads ^M
99330               10   <null>                                 <snip>/fork-plus-threads ^M
99331               11   <null>                                 <snip>/fork-plus-threads ^M
99332             (gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left
99333
99334         when we expect to have just one.  The problem is prune_inferiors not
99335         pruning inferiors.  And this is caused by all_inferiors_safe not
99336         actually iterating on inferiors.  The current implementation:
99337
99338           inline all_inferiors_safe_range
99339           all_inferiors_safe ()
99340           {
99341             return {};
99342           }
99343
99344         default-constructs an all_inferiors_safe_range, which default-constructs
99345         an all_inferiors_safe_iterator as its m_begin field, which
99346         default-constructs a all_inferiors_iterator.  A default-constructed
99347         all_inferiors_iterator is an end iterator, which means we have
99348         constructed an (end,end) all_inferiors_safe_range.
99349
99350         We actually need to pass down the list on which we want to iterator
99351         (that is the inferior_list global), so that all_inferiors_iterator's
99352         first constructor is chosen.  We also pass nullptr as the proc_target
99353         filter.  In this case, we don't do any filtering, but if in the future
99354         all_inferiors_safe needed to allow filtering on process target (like
99355         all_inferiors does), we could pass down a process target pointer.
99356
99357         basic_safe_iterator's constructor needs to be changed to allow
99358         constructing the wrapped iterator with multiple arguments, not just one.
99359
99360         With this, gdb.threads/fork-plus-threads.exp is passing once again for
99361         me.
99362
99363         Change-Id: I650552ede596e3590c4b7606ce403690a0278a01
99364
99365 2021-07-17  GDB Administrator  <gdbadmin@sourceware.org>
99366
99367         Automatic date update in version.in
99368
99369 2021-07-16  Lancelot SIX  <lsix@lancelotsix.com>
99370
99371         gdb: Support stepping out from signal handler on riscv*-linux
99372         Currently, gdb cannot step outside of a signal handler on RISC-V
99373         platforms.  This causes multiple failures in gdb.base/sigstep.exp:
99374
99375                 FAIL: gdb.base/sigstep.exp: continue to handler, nothing in handler, step from handler: leave handler (timeout)
99376                 FAIL: gdb.base/sigstep.exp: continue to handler, si+advance in handler, step from handler: leave handler (timeout)
99377                 FAIL: gdb.base/sigstep.exp: continue to handler, nothing in handler, next from handler: leave handler (timeout)
99378                 FAIL: gdb.base/sigstep.exp: continue to handler, si+advance in handler, next from handler: leave handler (timeout)
99379                 FAIL: gdb.base/sigstep.exp: stepi from handleri: leave signal trampoline
99380                 FAIL: gdb.base/sigstep.exp: nexti from handleri: leave signal trampoline
99381
99382                                 === gdb Summary ===
99383
99384                 # of expected passes            587
99385                 # of unexpected failures        6
99386
99387         This patch adds support for stepping outside of a signal handler on
99388         riscv*-*-linux*.
99389
99390         Implementation is heavily inspired from mips_linux_syscall_next_pc and
99391         surroundings as advised by Pedro Alves.
99392
99393         After this patch, all tests in gdb.base/sigstep.exp pass.
99394
99395         Build and tested on riscv64-linux-gnu.
99396
99397 2021-07-16  Lancelot SIX  <lsix@lancelotsix.com>
99398
99399         gdb/testsuite: Declare that riscv*-*-linux* cannot hardware_single_step
99400         Many tests fail in gdb/testsuite/gdb.base/sigstep.exp on
99401         riscv64-linux-gnu.  Those tests check that when stepping, if the
99402         debuggee received a signal it should step inside the signal handler.
99403
99404         This feature requires hardware support for single stepping (or at least
99405         kernel support), but none are available on riscv*-linux-gnu hosts, at
99406         the moment at least.
99407
99408         This patch adds RISC-V to the list of configurations that does not
99409         have hardware single step capability, disabling tests relying on such
99410         feature.
99411
99412         Tested on riscv64-linux-gnu.
99413
99414 2021-07-16  Tom Tromey  <tom@tromey.com>
99415
99416         Document quick_symbol_functions::expand_symtabs_matching invariant
99417         While working on my series to replace the DWARF psymbol reader, I
99418         noticed that the expand_symtabs_matching has an undocumented
99419         invariant.  I think that, if this invariant is not followed, then GDB
99420         will crash.  So, this patch documents this in the relevant spots and
99421         introduces some asserts to make it clear.
99422
99423         Regression tested on x86-64 Fedora 32.
99424
99425 2021-07-16  Tom Tromey  <tromey@adacore.com>
99426
99427         Fix array stride bug
99428         Investigation of using the Python API with an Ada program showed that
99429         an array of dynamic types was not being handled properly.  I tracked
99430         this down to an oddity of how array strides are handled.
99431
99432         In gdb, an array stride can be attached to the range type, via the
99433         range_bounds object.  However, the stride can also be put into the
99434         array's first field.  From create_range_type_with_stride:
99435
99436           else if (bit_stride > 0)
99437             TYPE_FIELD_BITSIZE (result_type, 0) = bit_stride;
99438
99439         It's hard to be sure why this is done, but I would guess a combination
99440         of historical reasons plus a desire (mentioned in a comment somewhere)
99441         to avoid modifying the range type.
99442
99443         This patch fixes the problem by changing type::bit_stride to
99444         understand this convention.  It also fixes one spot that reproduces
99445         this logic.
99446
99447         Regression tested on x86-64 Fedora 32.
99448
99449 2021-07-16  Giulio Benetti  <giulio.benetti@benettiengineering.com>
99450
99451         or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation.
99452         bfd     * elf32-or1k.c (or1k_elf_relocate_section): Use a separate entry
99453                 in switch case R_OR1K_INSN_REL_26 where we need to check for
99454                 !SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
99455
99456 2021-07-16  Nick Clifton  <nickc@redhat.com>
99457
99458         Updated Swedish translation for the binutils sub-directory
99459
99460 2021-07-16  GDB Administrator  <gdbadmin@sourceware.org>
99461
99462         Automatic date update in version.in
99463
99464 2021-07-15  Tom Tromey  <tromey@adacore.com>
99465
99466         Avoid expression parsing crash with unknown language
99467         PR gdb/28093 points out that gdb crashes when language is set to
99468         "unknown" and expression parsing is attempted.  At first I thought
99469         this was a regression due to the expression rewrite, but it turns out
99470         that older versions crash as well.
99471
99472         This patch avoids the crash by changing the default expression parser
99473         to throw an exception.  I think this is preferable -- the current
99474         behavior of silently doing nothing does not really make sense.
99475
99476         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28093
99477
99478 2021-07-15  Simon Marchi  <simon.marchi@polymtl.ca>
99479
99480         gdb: pass child_ptid and fork kind to target_ops::follow_fork
99481         This is a small cleanup I think would be nice, that I spotted while
99482         doing the following patch.
99483
99484         gdb/ChangeLog:
99485
99486                 * target.h (struct target_ops) <follow_fork>: Add ptid and
99487                 target_waitkind parameters.
99488                 (target_follow_fork): Likewise.
99489                 * target.c (default_follow_fork): Likewise.
99490                 (target_follow_fork): Likewise.
99491                 * fbsd-nat.h (class fbsd_nat_target) <follow_fork>: Likewise.
99492                 * fbsd-nat.c (fbsd_nat_target::follow_fork): Likewise.
99493                 * linux-nat.h (class linux_nat_target) <follow_fork>: Likewise.
99494                 * linux-nat.c (linux_nat_target::follow_fork): Likewise.
99495                 * obsd-nat.h (class obsd_nat_target) <follow_fork>: Likewise.
99496                 * obsd-nat.c (obsd_nat_target::follow_fork): Likewise.
99497                 * remote.c (class remote_target) <follow_fork>: Likewise.
99498                 * target-debug.h (target_debug_print_target_waitkind): New.
99499                 * target-delegates.c: Re-generate.
99500
99501         Change-Id: I5421a542f2e19100a22b74cc333d2b235d0de3c8
99502
99503 2021-07-15  Simon Marchi  <simon.marchi@polymtl.ca>
99504
99505         gdb: call post_create_inferior at end of follow_fork_inferior
99506         GDB doesn't handle well the case of an inferior using the JIT interface
99507         to register JIT-ed objfiles and forking.  If an inferior registers a
99508         code object using the JIT interface and then forks, the child process
99509         conceptually has the same code object loaded, so GDB should look it up
99510         and learn about it (it currently doesn't).
99511
99512         To achieve this, I think it would make sense to have the
99513         inferior_created observable called when an inferior is created due to a
99514         fork in follow_fork_inferior.  The inferior_created observable is
99515         currently called both after starting a new inferior and after attaching
99516         to an inferior, allowing various sub-components to learn about that new
99517         executing inferior.  We can see handling a fork child just like
99518         attaching to it, so any work done when attaching should also be done in
99519         the case of a fork child.
99520
99521         Instead of just calling the inferior_created observable, this patch
99522         makes follow_fork_inferior call the whole post_create_inferior function.
99523         This way, the attach and follow-fork code code paths are more alike.
99524
99525         Given that post_create_inferior calls solib_create_inferior_hook,
99526         follow_fork_inferior doesn't need to do it itself, so those calls to
99527         solib_create_inferior_hook are removed.
99528
99529         One question you may have: why not just call post_create_inferior at the
99530         places where solib_create_inferior_hook is currently called, instead of
99531         after target_follow_fork?
99532
99533          - there's something fishy for the second solib_create_inferior_hook
99534            call site: at this point we have switched the current program space
99535            to the child's, but not the current inferior nor the current thread.
99536            So solib_create_inferior_hook (and everything under, including
99537            check_for_thread_db, for example) is called with inferior 1 as the
99538            current inferior and inferior 2's program space as the current
99539            program space.  I think that's wrong, because at this point we are
99540            setting up inferior 2, and all that code relies on the current
99541            inferior.  We could just add a switch_to_thread call before it to
99542            make inferior 2 the current one, but there are other problems (see
99543            below).
99544
99545          - solib_create_inferior_hook is currently not called on the
99546            `follow_child && detach_fork` path.  I think we need to call it,
99547            because we still get a new inferior in that case (even though we
99548            detach the parent).  If we only call post_create_inferior where
99549            solib_create_inferior_hook used to be called, then the JIT
99550            subcomponent doesn't get informed about the new inferior, and that
99551            introduces a failure in the new gdb.base/jit-elf-fork.exp test.
99552
99553          - if we try to put the post_create_inferior just after the
99554            switch_to_thread that was originally at line 662, or just before the
99555            call to target_follow_fork, we introduce a subtle failure in
99556            gdb.threads/fork-thread-pending.exp.  What happens then is that
99557            libthread_db gets loaded (somewhere under post_create_inferior)
99558            before the linux-nat target learns about the LWPs (which happens in
99559            linux_nat_target::follow_fork).  As a result, the ALL_LWPS loop in
99560            try_thread_db_load_1 doesn't see the child LWP, and the thread-db
99561            target doesn't have the chance to fill in thread_info::priv.  A bit
99562            later, when the test does "info threads", and
99563            thread_db_target::pid_to_str is called, the thread-db target doesn't
99564            recognize the thread as one of its own, and delegates the request to
99565            the target below.  Because the pid_to_str output is not the expected
99566            one, the test fails.
99567
99568            This tells me that we need to call the process target's follow_fork
99569            first, to make the process target create the necessary LWP and thread
99570            structures.  Then, we can call post_create_inferior to let the other
99571            components of GDB do their thing.
99572
99573            But then you may ask: check_for_thread_db is already called today,
99574            somewhere under solib_create_inferior_hook, and that is before
99575            target_follow_fork, why don't we see this ordering problem!?  Well,
99576            because of the first bullet point: when check_for_thread_db /
99577            thread_db_load are called, the current inferior is (erroneously)
99578            inferior 1, the parent.  Because libthread_db is already loaded for
99579            the parent, thread_db_load early returns.  check_for_thread_db later
99580            gets called by linux_nat_target::follow_fork.  At this point, the
99581            current inferior is the correct one and the child's LWP exists, so
99582            all is well.
99583
99584         Since we now call post_create_inferior after target_follow_fork, which
99585         calls the inferior_created observable, which calls check_for_thread_db,
99586         I don't think linux_nat_target needs to explicitly call
99587         check_for_thread_db itself, so that is removed.
99588
99589         In terms of testing, this patch adds a new gdb.base/jit-elf-fork.exp
99590         test.  It makes an inferior register a JIT code object and then fork.
99591         It then verifies that whatever the detach-on-fork and follow-fork-child
99592         parameters are, GDB knows about the JIT code object in all the inferiors
99593         that survive the fork.  It verifies that the inferiors can unload that
99594         code object.
99595
99596         There isn't currently a way to get visibility into GDB's idea of the JIT
99597         code objects for each inferior.  For the purpose of this test, add the
99598         "maintenance info jit" command.  There isn't much we can print about the
99599         JIT code objects except their load address.  So the output looks a bit
99600         bare, but it's good enough for the test.
99601
99602         gdb/ChangeLog:
99603
99604                 * NEWS: Mention "maint info jit" command.
99605                 * infrun.c (follow_fork_inferior): Don't call
99606                 solib_create_inferior_hook, call post_create_inferior if a new
99607                 inferior was created.
99608                 * jit.c (maint_info_jit_cmd): New.
99609                 (_initialize_jit): Register new command.
99610                 * linux-nat.c (linux_nat_target::follow_fork): Don't call
99611                 check_for_thread_db.
99612                 * linux-nat.h (check_for_thread_db): Remove declaration.
99613                 * linux-thread-db.c (check_thread_signals): Make static.
99614
99615         gdb/doc/ChangeLog:
99616
99617                 * gdb.texinfo (Maintenance Commands): Mention "maint info jit".
99618
99619         gdb/testsuite/ChangeLog:
99620
99621                 * gdb.base/jit-elf-fork-main.c: New test.
99622                 * gdb.base/jit-elf-fork-solib.c: New test.
99623                 * gdb.base/jit-elf-fork.exp: New test.
99624
99625         Change-Id: I9a192e55b8a451c00e88100669283fc9ca60de5c
99626
99627 2021-07-15  Libor Bukata  <libor.bukata@oracle.com>
99628
99629         [gdb/procfs.c] Fix build failure in find_stop_signal
99630         It fixes a regression caused by commit
99631         1edb66d856c82c389edfd7610143236a68c76846 where thread_info::suspend was
99632         made private.
99633
99634         The public thread_info API has to be used to get stop signal and avoid
99635         build failures.
99636
99637         gdb/ChangeLog:
99638
99639         2021-07-14  Libor Bukata <libor.bukata@oracle.com>
99640
99641           * gdb/procfs.c (find_stop_signal): Use thread_info API.
99642
99643         Change-Id: I53bc57a05cd0eca5f28ef0726d6faeeb306e7904
99644
99645 2021-07-15  GDB Administrator  <gdbadmin@sourceware.org>
99646
99647         Automatic date update in version.in
99648
99649 2021-07-14  H.J. Lu  <hjl.tools@gmail.com>
99650
99651         x86: Add int1 as one byte opcode 0xf1
99652         Also change the x86 disassembler to disassemble 0xf1 as int1, instead of
99653         icebp.
99654
99655         gas/
99656
99657                 PR gas/28088
99658                 * testsuite/gas/i386/opcode.s: Add int1.
99659                 * testsuite/gas/i386/x86-64-opcode.s: Add int1, int3 and int.
99660                 * testsuite/gas/i386/opcode-intel.d: Updated.
99661                 * testsuite/gas/i386/opcode-suffix.d: Likewise.
99662                 * testsuite/gas/i386/opcode.d: Likewise.
99663                 * testsuite/gas/i386/x86-64-opcode.d: Likewise.
99664
99665         opcodes/
99666
99667                 PR gas/28088
99668                 * i386-dis.c (dis386): Replace icebp with int1.
99669                 * i386-opc.tbl: Add int1.
99670                 * i386-tbl.h: Regenerate.
99671
99672 2021-07-14  Alan Modra  <amodra@gmail.com>
99673
99674         gas: default TC_VALIDATE_FIX_SUB to 0
99675         gas/write.c provides a fallback TC_VALIDATE_FIX_SUB define that can be
99676         a problem for some targets, the problem being that a non-zero
99677         definition of TC_VALIDATE_FIX_SUB says that some uses of fx_subsy are
99678         OK, in effect that the target will handle fx_subsy in md_apply_fix
99679         and/or tc_gen_reloc.  A lot of targets don't have the necessary
99680         md_apply_fix and tc_gen_reloc support.  So a safer default is to
99681         disallow fx_subsy by default.
99682
99683         I've had a good look over target usage of fx_subsy, and think I've
99684         caught all the cases where targets need TC_VALIDATE_FIX_SUB.  Possible
99685         failures would be limited to alpha, microblaze, ppc and s390 (the
99686         targets that define UNDEFINED_DIFFERENCE_OK), or targets that generate
99687         fixups with BFD_RELOC_GPREL32/16 and use a syntax explicitly showing
99688         a difference expression.
99689
99690                 * write.c (TC_VALIDATE_FIX_SUB): Default to 0.
99691                 * config/tc-hppa.h (TC_VALIDATE_FIX_SUB): Define.
99692                 * config/tc-microblaze.h (TC_VALIDATE_FIX_SUB): Define.
99693                 * config/tc-alpha.h (TC_VALIDATE_FIX_SUB): Define for ECOFF.
99694                 * config/tc-ppc.h (TC_VALIDATE_FIX_SUB): Don't define for ELF.
99695                 Do define for XCOFF.
99696
99697 2021-07-14  Clément Chigot  <clement.chigot@atos.net>
99698
99699         objdump: add DWARF support for AIX
99700         DWARF sections have special names on AIX which need be handled
99701         by objdump in order to correctly print them.
99702         This patch also adds the correlation in bfd for future uses.
99703
99704         bfd/
99705                 * libxcoff.h (struct xcoff_dwsect_name): Add DWARF name.
99706                 * coff-rs6000.c (xcoff_dwsect_names): Update.
99707                 * coffcode.h (sec_to_styp_flags): Likewise.
99708                 (coff_new_section_hook): Likewise.
99709         binutils/
99710                 * dwarf.h (struct dwarf_section): Add XCOFF name.
99711                 * dwarf.c (struct dwarf_section_display): Update.
99712                 * objdump.c (load_debug_section): Add XCOFF name handler.
99713                 (dump_dwarf_section): Likewise.
99714         gas/
99715                 * config/tc-ppc.c (ppc_change_debug_section): Update to
99716                 match new name's field.
99717
99718 2021-07-14  Tom de Vries  <tdevries@suse.de>
99719
99720         [gdb/testsuite] Fix gdb.base/gold-gdb-index.exp
99721         When running test-case gdb.base/gold-gdb-index.exp on openSUSE Tumbleweed,
99722         I run into:
99723         ...
99724         FAIL: gdb.base/gold-gdb-index.exp: maint info symtabs
99725         ...
99726
99727         This is due to a dummy .gdb_index:
99728         ...
99729         Contents of the .gdb_index section:
99730
99731         Version 7
99732
99733         CU table:
99734
99735         TU table:
99736
99737         Address table:
99738
99739         Symbol table:
99740         ...
99741
99742         The dummy .gdb_index is ignored when loading the symbols, and instead partial
99743         symbols are used.  Consequently, we get the same result as if we'd removed
99744         -Wl,--gdb-index from the compilation.
99745
99746         Presumably, gold fails to generate a proper .gdb_index because it lacks
99747         DWARF5 support.
99748
99749         Anyway, without a proper .gdb_index we can't test the gdb behaviour we're
99750         trying to excercise.  Fix this by detecting whether we actually used a
99751         .gdb_index for symbol loading.
99752
99753         Tested on x86_64-linux.
99754
99755         gdb/testsuite/ChangeLog:
99756
99757         2021-07-14  Tom de Vries  <tdevries@suse.de>
99758
99759                 * lib/gdb.exp (have_index): New proc.
99760                 * gdb.base/gold-gdb-index.exp: Use have_index.
99761
99762 2021-07-14  Tom de Vries  <tdevries@suse.de>
99763
99764         [gdb/testsuite] Add missing skip_tui_tests
99765         When building gdb with --disable-tui, we run into:
99766         ...
99767         (gdb) frame apply all -- -^M
99768         Undefined command: "-".  Try "help".^M
99769         (gdb) ERROR: Undefined command "frame apply all -- -".
99770         UNRESOLVED: gdb.base/options.exp: test-frame-apply: frame apply all -- -
99771         ...
99772
99773         Fix this by detecting whether tui is supported, and skipping the tui-related
99774         tests otherwise.  Same in some gdb.tui test-cases.
99775
99776         Tested on x86_64-linux.
99777
99778         gdb/testsuite/ChangeLog:
99779
99780         2021-07-13  Tom de Vries  <tdevries@suse.de>
99781
99782                 * gdb.base/options.exp: Skip tui-related tests when tui is not
99783                 supported.
99784                 * gdb.python/tui-window-disabled.exp: Same.
99785                 * gdb.python/tui-window.exp: Same.
99786
99787 2021-07-14  GDB Administrator  <gdbadmin@sourceware.org>
99788
99789         Automatic date update in version.in
99790
99791 2021-07-13  Lancelot SIX  <lsix@lancelotsix.com>
99792
99793         Use /bin/sh as shebang in gdb/make-init-c
99794         While testing the NixOS[1] packaging for gdb-11.0.90.tar.xz, I got the
99795         following error:
99796
99797           [...]
99798           CXX    aarch32-tdep.o
99799           CXX    gdb.o
99800           GEN    init.c
99801           /nix/store/26a78ync552m8j4sbjavhvkmnqir8c9y-bash-4.4-p23/bin/bash: ./make-init-c: /usr/bin/env: bad interpreter: No such file or directory
99802           make[2]: *** [Makefile:1866: stamp-init] Error 126
99803           make[2]: *** Waiting for unfinished jobs....
99804           make[2]: Leaving directory '/build/gdb-11.0.90/gdb'
99805           make[1]: *** [Makefile:9814: all-gdb] Error 2
99806           make[1]: Leaving directory '/build/gdb-11.0.90'
99807           make: *** [Makefile:903: all] Error 2
99808           builder for '/nix/store/xs8my3rrc3l4kdlbpx0azh6q0v0jxphr-gdb-gdb-11.0.90.drv' failed with exit code 2
99809           error: build of '/nix/store/xs8my3rrc3l4kdlbpx0azh6q0v0jxphr-gdb-gdb-11.0.90.drv' failed
99810
99811         In the nix build environment, /usr/bin/env is not present, only /bin/sh
99812         is.  This patch makes sure that gdb/make-init-c uses '/bin/sh' as
99813         interpreter as this is the only one available on this platform.
99814
99815         I do not think this change will cause regressions on any other
99816         configuration.
99817
99818         [1] https://nixos.org/
99819
99820         gdb/Changelog
99821
99822                 * make-init-c: Use /bin/sh as shebang.
99823
99824 2021-07-13  John Baldwin  <jhb@FreeBSD.org>
99825
99826         arm-fbsd-nat: Use fetch_register_set and store_register_set.
99827
99828         aarch64-fbsd-nat: Use fetch_register_set and store_register_set.
99829
99830         riscv-fbsd-nat: Use fetch_register_set and store_register_set.
99831
99832         fbsd-nat: Add helper functions to fetch and store register sets.
99833         In particular, this supports register sets described by a regcache_map
99834         which are fetched and stored with dedicated ptrace operations.  These
99835         functions are intended to be used in architecture-specific
99836         fetch_registers and store_registers target methods.
99837
99838         Add regcache_map_supplies helper routine.
99839         This helper can be used in the fetch_registers and store_registers
99840         target methods to determine if a register set includes a specific
99841         register.
99842
99843 2021-07-13  Pedro Alves  <pedro@palves.net>
99844
99845         Avoid letting exceptions escape gdb_bfd_iovec_fileio_close (PR gdb/28080)
99846         Before PR gdb/28080 was fixed by the previous patch, GDB was crashing
99847         like this:
99848
99849          (gdb) detach
99850          Detaching from program: target:/any/program, process 3671843
99851          Detaching from process 3671843
99852          Ending remote debugging.
99853          [Inferior 1 (process 3671843) detached]
99854          In main
99855          terminate called after throwing an instance of 'gdb_exception_error'
99856          Aborted (core dumped)
99857
99858         Here's the exception above being thrown:
99859
99860          (top-gdb) bt
99861          #0  throw_error (error=TARGET_CLOSE_ERROR, fmt=0x555556035588 "Remote connection closed") at src/gdbsupport/common-exceptions.cc:222
99862          #1  0x0000555555bbaa46 in remote_target::readchar (this=0x555556a11040, timeout=10000) at src/gdb/remote.c:9440
99863          #2  0x0000555555bbb9e5 in remote_target::getpkt_or_notif_sane_1 (this=0x555556a11040, buf=0x555556a11058, forever=0, expecting_notif=0, is_notif=0x0) at src/gdb/remote.c:9928
99864          #3  0x0000555555bbbda9 in remote_target::getpkt_sane (this=0x555556a11040, buf=0x555556a11058, forever=0) at src/gdb/remote.c:10030
99865          #4  0x0000555555bc0e75 in remote_target::remote_hostio_send_command (this=0x555556a11040, command_bytes=13, which_packet=14, remote_errno=0x7fffffffcfd0, attachment=0x0, attachment_len=0x0) at src/gdb/remote.c:12137
99866          #5  0x0000555555bc1b6c in remote_target::remote_hostio_close (this=0x555556a11040, fd=8, remote_errno=0x7fffffffcfd0) at src/gdb/remote.c:12455
99867          #6  0x0000555555bc1bb4 in remote_target::fileio_close (During symbol reading: .debug_line address at offset 0x64f417 is 0 [in module build/gdb/gdb]
99868          this=0x555556a11040, fd=8, remote_errno=0x7fffffffcfd0) at src/gdb/remote.c:12462
99869          #7  0x0000555555c9274c in target_fileio_close (fd=3, target_errno=0x7fffffffcfd0) at src/gdb/target.c:3365
99870          #8  0x000055555595a19d in gdb_bfd_iovec_fileio_close (abfd=0x555556b9f8a0, stream=0x555556b11530) at src/gdb/gdb_bfd.c:439
99871          #9  0x0000555555e09e3f in opncls_bclose (abfd=0x555556b9f8a0) at src/bfd/opncls.c:599
99872          #10 0x0000555555e0a2c7 in bfd_close_all_done (abfd=0x555556b9f8a0) at src/bfd/opncls.c:847
99873          #11 0x0000555555e0a27a in bfd_close (abfd=0x555556b9f8a0) at src/bfd/opncls.c:814
99874          #12 0x000055555595a9d3 in gdb_bfd_close_or_warn (abfd=0x555556b9f8a0) at src/gdb/gdb_bfd.c:626
99875          #13 0x000055555595ad29 in gdb_bfd_unref (abfd=0x555556b9f8a0) at src/gdb/gdb_bfd.c:715
99876          #14 0x0000555555ae4730 in objfile::~objfile (this=0x555556515540, __in_chrg=<optimized out>) at src/gdb/objfiles.c:573
99877          #15 0x0000555555ae955a in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x555556c20db0) at /usr/include/c++/9/bits/shared_ptr_base.h:377
99878          #16 0x000055555572b7c8 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x555556c20db0) at /usr/include/c++/9/bits/shared_ptr_base.h:155
99879          #17 0x00005555557263c3 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x555556bf0588, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/shared_ptr_base.h:730
99880          #18 0x0000555555ae745e in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x555556bf0580, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/shared_ptr_base.h:1169
99881          #19 0x0000555555ae747e in std::shared_ptr<objfile>::~shared_ptr (this=0x555556bf0580, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/shared_ptr.h:103
99882          #20 0x0000555555b1c1dc in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x5555564cdd60, __p=0x555556bf0580) at /usr/include/c++/9/ext/new_allocator.h:153
99883          #21 0x0000555555b1bb1d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=..., __p=0x555556bf0580) at /usr/include/c++/9/bits/alloc_traits.h:497
99884          #22 0x0000555555b1b73e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x5555564cdd60, __position=std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x555556515540}) at /usr/include/c++/9/bits/stl_list.h:1921
99885          #23 0x0000555555b1afeb in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x5555564cdd60, __position=std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x555556515540}) at /usr/include/c++/9/bits/list.tcc:158
99886          #24 0x0000555555b19576 in program_space::remove_objfile (this=0x5555564cdd20, objfile=0x555556515540) at src/gdb/progspace.c:210
99887          #25 0x0000555555ae4502 in objfile::unlink (this=0x555556515540) at src/gdb/objfiles.c:487
99888          #26 0x0000555555ae5a12 in objfile_purge_solibs () at src/gdb/objfiles.c:875
99889          #27 0x0000555555c09686 in no_shared_libraries (ignored=0x0, from_tty=1) at src/gdb/solib.c:1236
99890          #28 0x00005555559e3f5f in detach_command (args=0x0, from_tty=1) at src/gdb/infcmd.c:2769
99891
99892         Note frame #14:
99893
99894          #14 0x0000555555ae4730 in objfile::~objfile (this=0x555556515540, __in_chrg=<optimized out>) at src/gdb/objfiles.c:573
99895
99896         That's a dtor, thus noexcept.  That's the reason for the
99897         std::terminate.
99898
99899         The previous patch fixed things such that the exception above isn't
99900         thrown anymore.  However, it's possible that e.g., the remote
99901         connection drops just while a user types "nosharedlibrary", or some
99902         other reason that leads to objfile::~objfile, and then we end up the
99903         same std::terminate problem.
99904
99905         Also notice that frames #9-#11 are BFD frames:
99906
99907          #9  0x0000555555e09e3f in opncls_bclose (abfd=0x555556bc27e0) at src/bfd/opncls.c:599
99908          #10 0x0000555555e0a2c7 in bfd_close_all_done (abfd=0x555556bc27e0) at src/bfd/opncls.c:847
99909          #11 0x0000555555e0a27a in bfd_close (abfd=0x555556bc27e0) at src/bfd/opncls.c:814
99910
99911         BFD is written in C and thus throwing exceptions over such frames may
99912         either not clean up properly, or, may abort if bfd is not compiled
99913         with -fasynchronous-unwind-tables (x86-64 defaults that on, but not
99914         all GCC ports do).
99915
99916         Thus frame #8 seems like a good place to swallow exceptions.  More so
99917         since in this spot we already ignore target_fileio_close return
99918         errors.  That's what this commit does.  Without the previous fix, we'd
99919         see:
99920
99921          (gdb) detach
99922          Detaching from program: target:/any/program, process 2197701
99923          Ending remote debugging.
99924          [Inferior 1 (process 2197701) detached]
99925          warning: cannot close "target:/lib64/ld-linux-x86-64.so.2": Remote connection closed
99926
99927         Note it prints a warning, which would still be a regression compared
99928         to GDB 10, if it weren't for the previous fix.
99929
99930         gdb/ChangeLog:
99931         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
99932
99933                 PR gdb/28080
99934                 * gdb_bfd.c (gdb_bfd_close_warning): New.
99935                 (gdb_bfd_iovec_fileio_close): Wrap target_fileio_close in
99936                 try/catch and print warning on exception.
99937                 (gdb_bfd_close_or_warn): Use gdb_bfd_close_warning.
99938
99939         Change-Id: Ic7a26ddba0a4444e3377b0e7c1c89934a84545d7
99940
99941 2021-07-13  Pedro Alves  <pedro@palves.net>
99942
99943         Fix detach with target remote (PR gdb/28080)
99944         Commit 408f66864a1a823591b26420410c982174c239a2 ("detach in all-stop
99945         with threads running") regressed "detach" with "target remote":
99946
99947          (gdb) detach
99948          Detaching from program: target:/any/program, process 3671843
99949          Detaching from process 3671843
99950          Ending remote debugging.
99951          [Inferior 1 (process 3671843) detached]
99952          In main
99953          terminate called after throwing an instance of 'gdb_exception_error'
99954          Aborted (core dumped)
99955
99956         Here's the exception above being thrown:
99957
99958          (top-gdb) bt
99959          #0  throw_error (error=TARGET_CLOSE_ERROR, fmt=0x555556035588 "Remote connection closed") at src/gdbsupport/common-exceptions.cc:222
99960          #1  0x0000555555bbaa46 in remote_target::readchar (this=0x555556a11040, timeout=10000) at src/gdb/remote.c:9440
99961          #2  0x0000555555bbb9e5 in remote_target::getpkt_or_notif_sane_1 (this=0x555556a11040, buf=0x555556a11058, forever=0, expecting_notif=0, is_notif=0x0) at src/gdb/remote.c:9928
99962          #3  0x0000555555bbbda9 in remote_target::getpkt_sane (this=0x555556a11040, buf=0x555556a11058, forever=0) at src/gdb/remote.c:10030
99963          #4  0x0000555555bc0e75 in remote_target::remote_hostio_send_command (this=0x555556a11040, command_bytes=13, which_packet=14, remote_errno=0x7fffffffcfd0, attachment=0x0, attachment_len=0x0) at src/gdb/remote.c:12137
99964          #5  0x0000555555bc1b6c in remote_target::remote_hostio_close (this=0x555556a11040, fd=8, remote_errno=0x7fffffffcfd0) at src/gdb/remote.c:12455
99965          #6  0x0000555555bc1bb4 in remote_target::fileio_close (During symbol reading: .debug_line address at offset 0x64f417 is 0 [in module build/gdb/gdb]
99966          this=0x555556a11040, fd=8, remote_errno=0x7fffffffcfd0) at src/gdb/remote.c:12462
99967          #7  0x0000555555c9274c in target_fileio_close (fd=3, target_errno=0x7fffffffcfd0) at src/gdb/target.c:3365
99968          #8  0x000055555595a19d in gdb_bfd_iovec_fileio_close (abfd=0x555556b9f8a0, stream=0x555556b11530) at src/gdb/gdb_bfd.c:439
99969          #9  0x0000555555e09e3f in opncls_bclose (abfd=0x555556b9f8a0) at src/bfd/opncls.c:599
99970          #10 0x0000555555e0a2c7 in bfd_close_all_done (abfd=0x555556b9f8a0) at src/bfd/opncls.c:847
99971          #11 0x0000555555e0a27a in bfd_close (abfd=0x555556b9f8a0) at src/bfd/opncls.c:814
99972          #12 0x000055555595a9d3 in gdb_bfd_close_or_warn (abfd=0x555556b9f8a0) at src/gdb/gdb_bfd.c:626
99973          #13 0x000055555595ad29 in gdb_bfd_unref (abfd=0x555556b9f8a0) at src/gdb/gdb_bfd.c:715
99974          #14 0x0000555555ae4730 in objfile::~objfile (this=0x555556515540, __in_chrg=<optimized out>) at src/gdb/objfiles.c:573
99975          #15 0x0000555555ae955a in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x555556c20db0) at /usr/include/c++/9/bits/shared_ptr_base.h:377
99976          #16 0x000055555572b7c8 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x555556c20db0) at /usr/include/c++/9/bits/shared_ptr_base.h:155
99977          #17 0x00005555557263c3 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x555556bf0588, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/shared_ptr_base.h:730
99978          #18 0x0000555555ae745e in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x555556bf0580, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/shared_ptr_base.h:1169
99979          #19 0x0000555555ae747e in std::shared_ptr<objfile>::~shared_ptr (this=0x555556bf0580, __in_chrg=<optimized out>) at /usr/include/c++/9/bits/shared_ptr.h:103
99980          #20 0x0000555555b1c1dc in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x5555564cdd60, __p=0x555556bf0580) at /usr/include/c++/9/ext/new_allocator.h:153
99981          #21 0x0000555555b1bb1d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=..., __p=0x555556bf0580) at /usr/include/c++/9/bits/alloc_traits.h:497
99982          #22 0x0000555555b1b73e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x5555564cdd60, __position=std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x555556515540}) at /usr/include/c++/9/bits/stl_list.h:1921
99983          #23 0x0000555555b1afeb in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x5555564cdd60, __position=std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x555556515540}) at /usr/include/c++/9/bits/list.tcc:158
99984          #24 0x0000555555b19576 in program_space::remove_objfile (this=0x5555564cdd20, objfile=0x555556515540) at src/gdb/progspace.c:210
99985          #25 0x0000555555ae4502 in objfile::unlink (this=0x555556515540) at src/gdb/objfiles.c:487
99986          #26 0x0000555555ae5a12 in objfile_purge_solibs () at src/gdb/objfiles.c:875
99987          #27 0x0000555555c09686 in no_shared_libraries (ignored=0x0, from_tty=1) at src/gdb/solib.c:1236
99988          #28 0x00005555559e3f5f in detach_command (args=0x0, from_tty=1) at src/gdb/infcmd.c:2769
99989
99990         So frame #28 already detached the remote process, and then we're
99991         purging the shared libraries.  GDB had opened remote shared libraries
99992         via the target: sysroot, so it tries closing them.  GDBserver is
99993         tearing down already, so remote communication breaks down and we close
99994         the remote target and throw TARGET_CLOSE_ERROR.
99995
99996         Note frame #14:
99997
99998          #14 0x0000555555ae4730 in objfile::~objfile (this=0x555556515540, __in_chrg=<optimized out>) at src/gdb/objfiles.c:573
99999
100000         That's a dtor, thus noexcept.  That's the reason for the
100001         std::terminate.
100002
100003         Stepping back a bit, why do we still have open remote files if we've
100004         managed to detach already, and, we're debugging with "target remote"?
100005         The reason is that commit 408f66864a1a823591b26420410c982174c239a2
100006         makes detach_command hold a reference to the target, so the remote
100007         target won't be finally closed until frame #28 returns.  It's closing
100008         the target that invalidates target file I/O handles.
100009
100010         This commit fixes the issue by not relying on target_close to
100011         invalidate the target file I/O handles, instead invalidate them
100012         immediately in remote_unpush_target.  So when GDB purges the solibs,
100013         and we end up in target_fileio_close (frame #7 above), there's nothing
100014         to do, and we don't try to talk with the remote target anymore.
100015
100016         The regression isn't seen when testing with
100017         --target_board=native-gdbserver, because that does "set sysroot" to
100018         disable the "target:" sysroot, for test run speed reasons.  So this
100019         commit adds a testcase that explicitly tests detach with "set sysroot
100020         target:".
100021
100022         gdb/ChangeLog:
100023         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
100024
100025                 PR gdb/28080
100026                 * remote.c (remote_unpush_target): Invalidate file I/O target
100027                 handles.
100028                 * target.c (fileio_handles_invalidate_target): Make extern.
100029                 * target.h (fileio_handles_invalidate_target): Declare.
100030
100031         gdb/testsuite/ChangeLog:
100032         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
100033
100034                 PR gdb/28080
100035                 * gdb.base/detach-sysroot-target.exp: New.
100036                 * gdb.base/detach-sysroot-target.c: New.
100037
100038         Reported-By: Jonah Graham <jonah@kichwacoders.com>
100039
100040         Change-Id: I851234910172f42a1b30e731161376c344d2727d
100041
100042 2021-07-13  Tom de Vries  <tdevries@suse.de>
100043
100044         [gdb/testsuite] Fix check-libthread-db.exp FAILs with glibc 2.33
100045         When running test-case gdb.threads/check-libthread-db.exp on openSUSE
100046         Tumbleweed with glibc 2.33, I get:
100047         ...
100048         (gdb) maint check libthread-db^M
100049         Running libthread_db integrity checks:^M
100050           Got thread 0x7ffff7c79b80 => 9354 => 0x7ffff7c79b80; errno = 0 ... OK^M
100051         libthread_db integrity checks passed.^M
100052         (gdb) FAIL: gdb.threads/check-libthread-db.exp: user-initiated check: \
100053           libpthread.so not initialized (pattern 2)
100054         ...
100055
100056         The test-case expects instead:
100057         ...
100058           Got thread 0x0 => 9354 => 0x0 ... OK^M
100059         ...
100060         which is what I get on openSUSE Leap 15.2 with glibc 2.26, and what is
100061         described in the test-case like this:
100062         ...
100063             # libthread_db should fake a single thread with th_unique == NULL.
100064         ...
100065
100066         Using a breakpoint on check_thread_db_callback we can compare the two
100067         scenarios, and find that in the latter case we hit this code in glibc function
100068         iterate_thread_list in nptl_db/td_ta_thr_iter.c:
100069         ...
100070           if (next == 0 && fake_empty)
100071             {
100072               /* __pthread_initialize_minimal has not run.  There is just the main
100073                  thread to return.  We cannot rely on its thread register.  They
100074                  sometimes contain garbage that would confuse us, left by the
100075                  kernel at exec.  So if it looks like initialization is incomplete,
100076                  we only fake a special descriptor for the initial thread.  */
100077               td_thrhandle_t th = { ta, 0 };
100078               return callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
100079             }
100080         ...
100081         while in the former case we don't because this preceding statement doesn't
100082         result in next == 0:
100083         ...
100084           err = DB_GET_FIELD (next, ta, head, list_t, next, 0);
100085         ...
100086
100087         Note that the comment mentions __pthread_initialize_minimal, but in both cases
100088         it has already run before we hit the callback, so it's possible the comment is
100089         no longer accurate.
100090
100091         The change in behaviour bisect to glibc commit 1daccf403b "nptl: Move stack
100092         list variables into _rtld_global", which moves the initialization of stack
100093         list variables such as __stack_user to an earlier moment, which explains well
100094         enough the observed difference.
100095
100096         Fix this by updating the regexp patterns to agree with what libthread-db is
100097         telling us.
100098
100099         Tested on x86_64-linux, both with glibc 2.33 and 2.26.
100100
100101         gdb/testsuite/ChangeLog:
100102
100103         2021-07-07  Tom de Vries  <tdevries@suse.de>
100104
100105                 PR testsuite/27690
100106                 * gdb.threads/check-libthread-db.exp: Update patterns for glibc 2.33.
100107
100108 2021-07-13  Felix Willgerodt  <felix.willgerodt@intel.com>
100109
100110         gdb, dwarf: Don't follow the parent of a subprogram to get a prefix.
100111         During prefix resolution, if the parent is a subprogram, there is no need
100112         to go to the parent of the subprogram.  The DIE will be local.
100113
100114         For a program like:
100115         ~~~
100116           class F1
100117           {
100118           public:
100119             int a;
100120             int
100121             vvv ()
100122             {
100123               class F2
100124               {
100125                 int f;
100126               };
100127               F2 abcd;
100128               return 1;
100129             }
100130           };
100131         ~~~
100132
100133         The class F2 should not be seen as a member of F1.
100134
100135         Before:
100136         ~~~
100137         (gdb) ptype abcd
100138         type = class F1::F2 {
100139           private:
100140             int f;
100141         }
100142         ~~~
100143
100144         After:
100145         ~~~
100146         (gdb) ptype abcd
100147         type = class F2 {
100148           private:
100149             int f;
100150         }
100151         ~~~
100152
100153         gdb/ChangeLog:
100154         2021-06-23  Felix Willgerodt  <felix.willgerodt@intel.com>
100155
100156                 * dwarf2/read.c (determine_prefix): Return an empty prefix if the
100157                 parent is a subprogram.
100158
100159         gdb/testsuite/ChangeLog:
100160         2021-06-23  Felix Willgerodt  <felix.willgerodt@intel.com>
100161
100162                 * gdb.cp/nested-class-func-class.cc: New file.
100163                 * gdb.cp/nested-class-func-class.exp: New file.
100164
100165 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100166
100167         gdb: disable commit-resumed on -exec-interrupt --thread-group
100168         As reported in PR gdb/28077, we hit an internal error when using
100169         -exec-interrupt with --thread-group:
100170
100171             info threads
100172             &"info threads\n"
100173             ~"  Id   Target Id             Frame \n"
100174             ~"* 1    process 403312 \"loop\" (running)\n"
100175             ^done
100176             (gdb)
100177             -exec-interrupt --thread-group i1
100178             ~"/home/simark/src/binutils-gdb/gdb/target.c:3768: internal-error: void target_stop(ptid_t): Assertion `!proc_target->commit_resumed_state' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nQuit this debugging session? (y or n) "
100179
100180         This is because this code path never disables commit-resumed (a
100181         requirement for calling target_stop, as documented in
100182         process_stratum_target::»commit_resumed_state) before calling
100183         target_stop.
100184
100185         The other 3 code paths in mi_cmd_exec_interrupt use interrupt_target_1,
100186         which does it.  But the --thread-group code path uses its own thing
100187         which doesn't do it.  Fix this by adding a scoped_disable_commit_resumed
100188         in this code path.
100189
100190         Calling -exec-interrupt with --thread-group is apparently not tested at
100191         the moment (which is why this bug could creep in).  Add a new test for
100192         that.  The test runs two inferiors and tries to interrupt them with
100193         "-exec-interrupt --thread-group X".
100194
100195         This will need to be merged in the gdb-11-branch, so here are ChangeLog
100196         entries:
100197
100198         gdb/ChangeLog:
100199
100200                 * mi/mi-main.c (mi_cmd_exec_interrupt): Use
100201                 scoped_disable_commit_resumed in the --thread-group case.
100202
100203         gdb/testsuite/ChangeLog:
100204
100205                 * gdb.mi/interrupt-thread-group.c: New.
100206                 * gdb.mi/interrupt-thread-group.exp: New.
100207
100208         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28077
100209         Change-Id: I615efefcbcaf2c15d47caf5e4b9d82854b2a2fcb
100210
100211 2021-07-13  Nelson Chu  <nelson.chu@sifive.com>
100212
100213         RISC-V: Enable elf attributes when default configure option isn't set.
100214         Since gcc commit, 3c70b3ca1ef58f302bf8c16d9e7c7bb8626408bf, we now enable
100215         elf attributes for all riscv targets by default in gcc.  Therefore, I
100216         think binutils should have the same behavior, in case users are writing
100217         assembly files.  If --enable-default-riscv-attribute isn't set, then we
100218         enable the elf attributes for all riscv targets by default.
100219
100220         ChangLog:
100221
100222         binutils/
100223
100224                 * testsuite/binutils-all/readelf.s: Add comments for riscv.
100225                 * testsuite/binutils-all/readelf.s-64: Likewise.
100226                 * testsuite/binutils-all/readelf.s-64-unused: Likewise.
100227                 * testsuite/binutils-all/readelf.ss: Likewise.
100228                 * testsuite/binutils-all/readelf.ss-64: Likewise.
100229                 * testsuite/binutils-all/readelf.ss-64-unused: Likewise.
100230
100231         gas/
100232
100233                 * configure.ac: If --enable-default-riscv-attribute isn't set,
100234                 then we enable the elf attributes for all riscv targets by
100235                 default.
100236                 * configure: Regenerated.
100237
100238 2021-07-13  John Ericson  <git@JohnEricson.me>
100239
100240         Fix some dangling references to `netbsd-tdep`
100241         These files were renamed in 1b71cfcfdc3e13a655fefa6566b5564cec044c10,
100242         but evidentially a few dangling references were left behind. This causes
100243         builds to fail:
100244
100245             $ ./configure --target i686-netbsdelf
100246             $ make
100247             make: *** No rule to make target 'nbsd-tdep.c', needed by 'nbsd-tdep.o'.  Stop.
100248
100249 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100250
100251         gdb: optimize all_matching_threads_iterator
100252         all_matching_threads_iterator is used extensively in some pretty fast
100253         paths, often under the all_non_exited_threads function.
100254
100255         If a filter target and thread-specific ptid are given, it iterates on
100256         all threads of all inferiors of that target, to ultimately yield exactly
100257         on thread.  And this happens quite often, which means we unnecessarily
100258         spend time iterating on threads to find the one we are looking for.  The
100259         same thing happens if an inferior-specific ptid is given, although there
100260         the iterator yields all the threads of that inferior.
100261
100262         In those cases, the callers of all_non_exited_threads could have
100263         different behaviors depending on the kind of ptid, to avoid this
100264         inefficiency, but that would be very tedious.  Using
100265         all_non_exited_threads has the advantage that one simple implementation
100266         can work seamlessly on multiple threads or on one specific thread, just
100267         by playing with the ptid.
100268
100269         Instead, optimize all_matching_threads_iterator directly to detect these
100270         different cases and limiting what we iterate on to just what we need.
100271
100272          - if filter_ptid is minus_one_ptid, do as we do now: filter inferiors
100273            based on filter_target, iterate on all of the matching inferiors'
100274            threads
100275          - if filter_ptid is a pid-only ptid (then a filter_target must
100276            necessarily be given), look up that inferior and iterate on all its
100277            threads
100278          - otherwise, filter_ptid is a thread-specific ptid, so look up that
100279            specific thread and "iterate" only on it
100280
100281         For the last case, what was an iteration on all threads of the filter
100282         target now becomes a call to find_thread_ptid, which is quite efficient
100283         now thanks to inferior::ptid_thread_map.
100284
100285         gdb/ChangeLog:
100286
100287                 * thread-iter.h (class all_matching_threads_iterator)
100288                 <all_matching_threads_iterator>: Use default.
100289                 <enum class mode>: New.
100290                 <m_inf, m_thr>: Initialize.
100291                 <m_filter_ptid>: Remove.
100292                 * thread-iter.c (all_matching_threads_iterator::m_inf_matches):
100293                 Don't filter on m_filter_ptid.
100294                 (all_matching_threads_iterator::all_matching_threads_iterator):
100295                 Choose path based on filter_ptid (all threads, all threads of
100296                 inferior, single thread).
100297                 (all_matching_threads_iterator::advance): Likewise.
100298
100299         Change-Id: Ic6a19845f5f760fa1b8eac8145793c0ff431bbc9
100300
100301 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100302
100303         gdb: maintain ptid -> thread map, optimize find_thread_ptid
100304         When debugging a large number of threads (thousands), looking up a
100305         thread by ptid_t using the inferior::thread_list linked list can add up.
100306
100307         Add inferior::thread_map, an std::unordered_map indexed by ptid_t, and
100308         change the find_thread_ptid function to look up a thread using
100309         std::unordered_map::find, instead of iterating on all of the
100310         inferior's threads.  This should make it faster to look up a thread
100311         from its ptid.
100312
100313         Change-Id: I3a8da0a839e18dee5bb98b8b7dbeb7f3dfa8ae1c
100314         Co-Authored-By: Pedro Alves <pedro@palves.net>
100315
100316 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100317
100318         gdb: optimize selection of resumed thread with pending event
100319         Consider a case where many threads (thousands) keep hitting a breakpoint
100320         whose condition evaluates to false.  random_pending_event_thread is
100321         responsible for selecting a thread from an inferior among all that are
100322         resumed with a pending wait status.  It is currently implemented by
100323         walking the inferior's thread list twice: once to count the number of
100324         candidates and once to select a random one.
100325
100326         Since we now maintain a per target list of resumed threads with pending
100327         event, we can implement this more efficiently by walking that list and
100328         selecting the first thread that matches the criteria
100329         (random_pending_event_thread looks for an thread from a specific
100330         inferior, and possibly a filter ptid).  It will be faster especially in
100331         the common case where there isn't any resumed thread with pending
100332         event.  Currently, we have to iterate the thread list to figure this
100333         out.  With this patch, the list of resumed threads with pending event
100334         will be empty, so it's quick to figure out.
100335
100336         The random selection is kept, but is moved to
100337         process_stratum_target::random_resumed_with_pending_wait_status.  The
100338         same technique is used: do a first pass to count the number of
100339         candidates, and do a second pass to select a random one.  But given that
100340         the list of resumed threads with pending wait statuses will generally be
100341         short, or at least shorter than the full thread list, it should be
100342         quicker.
100343
100344         Note that this isn't completely true, in case there are multiple
100345         inferiors on the same target.  Imagine that inferior A has 10k resumed
100346         threads with pending wait statuses, and random_pending_event_thread is
100347         called with inferior B.  We'll need to go through the list that contains
100348         inferior A's threads to realize that inferior B has no resumed threads
100349         with pending wait status.  But I think that this is a corner /
100350         pathological case.  And a possible fix for this situation would be to
100351         make random_pending_event_thread work per-process-target, rather than
100352         per-inferior.
100353
100354         Change-Id: I1b71d01beaa500a148b5b9797745103e13917325
100355
100356 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100357
100358         gdb: optimize check for resumed threads with pending wait status in maybe_set_commit_resumed_all_targets
100359         Consider a test case where many threads (thousands) keep hitting a
100360         breakpoint whose condition evaluates to false.
100361         maybe_set_commit_resumed_all_targets is called at each handled event,
100362         when the scoped_disable_commit_resumed object in fetch_inferior_event is
100363         reset_and_commit-ed.  One particularly expensive check in there is
100364         whether the target has at least one resumed thread with a pending wait
100365         status (in which case, we don't want to commit the resumed threads, as
100366         we want to consume this status first).  It is currently implemented as
100367         walking all threads of the target.
100368
100369         Since we now maintain a per-target list of resumed threads with pending
100370         status, we can do this check efficiently, by checking whether that list
100371         is empty or not.
100372
100373         Add the process_stratum_target::has_resumed_with_pending_wait_status
100374         method for this, and use it in maybe_set_commit_resumed_all_targets.
100375
100376         Change-Id: Ia1595baa1b358338f94fc3cb3af7f27092dad5b6
100377
100378 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100379
100380         gdb: maintain per-process-target list of resumed threads with pending wait status
100381         Looking up threads that are both resumed and have a pending wait
100382         status to report is something that we do quite often in the fast path
100383         and is expensive if there are many threads, since it currently requires
100384         walking whole thread lists.
100385
100386         The first instance is in maybe_set_commit_resumed_all_targets.  This is
100387         called after handling each event in fetch_inferior_event, to see if we
100388         should ask targets to commit their resumed threads or not.  If at least
100389         one thread is resumed but has a pending wait status, we don't ask the
100390         targets to commit their resumed threads, because we want to consume and
100391         handle the pending wait status first.
100392
100393         The second instance is in random_pending_event_thread, where we want to
100394         select a random thread among all those that are resumed and have a
100395         pending wait status.  This is called every time we try to consume
100396         events, to see if there are any pending events that we we want to
100397         consume, before asking the targets for more events.
100398
100399         To allow optimizing these cases, maintain a per-process-target list of
100400         threads that are resumed and have a pending wait status.
100401
100402         In maybe_set_commit_resumed_all_targets, we'll be able to check in O(1)
100403         if there are any such threads simply by checking whether the list is
100404         empty.
100405
100406         In random_pending_event_thread, we'll be able to use that list, which
100407         will be quicker than iterating the list of threads, especially when
100408         there are no resumed with pending wait status threads.
100409
100410         About implementation details: using the new setters on class
100411         thread_info, it's relatively easy to maintain that list.  Any time the
100412         "resumed" or "pending wait status" property is changed, we check whether
100413         that should cause the thread to be added or removed from the list.
100414
100415         In set_thread_exited, we try to remove the thread from the list, because
100416         keeping an exited thread in that list would make no sense (especially if
100417         the thread is freed).  My first implementation assumed that a process
100418         stratum target was always present when set_thread_exited is called.
100419         That's however, not the case: in some cases, targets unpush themselves
100420         from an inferior and then call "exit_inferior", which exits all the
100421         threads.  If the target is unpushed before set_thread_exited is called
100422         on the threads, it means we could mistakenly leave some threads in the
100423         list.  I tried to see how hard it would be to make it such that targets
100424         have to exit all threads before unpushing themselves from the inferior
100425         (that would seem logical to me, we don't want threads belonging to an
100426         inferior that has no process target).  That seemed quite difficult and
100427         not worth the time at the moment.  Instead, I changed
100428         inferior::unpush_target to remove all threads of that inferior from the
100429         list.
100430
100431         As of this patch, the list is not used, this is done in the subsequent
100432         patches.
100433
100434         The debug messages in process-stratum-target.c need to print some ptids.
100435         However, they can't use target_pid_to_str to print them without
100436         introducing a dependency on the current inferior (the current inferior
100437         is used to get the current target stack).  For debug messages, I find it
100438         clearer to print the spelled out ptid anyway (the pid, lwp and tid
100439         values).  Add a ptid_t::to_string method that returns a string
100440         representation of the ptid that is meant for debug messages, a bit like
100441         we already have frame_id::to_string.
100442
100443         Change-Id: Iad8f93db2d13984dd5aa5867db940ed1169dbb67
100444
100445 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100446
100447         gdb: make thread_info::suspend private, add getters / setters
100448         A following patch will want to take some action when a pending wait
100449         status is set on or removed from a thread.  Add a getter and a setter on
100450         thread_info for the pending waitstatus, so that we can add some code in
100451         the setter later.
100452
100453         The thing is, the pending wait status field is in the
100454         thread_suspend_state, along with other fields that we need to backup
100455         before and restore after the thread does an inferior function call.
100456         Therefore, make the thread_suspend_state member private
100457         (thread_info::suspend becomes thread_info::m_suspend), and add getters /
100458         setters for all of its fields:
100459
100460          - pending wait status
100461          - stop signal
100462          - stop reason
100463          - stop pc
100464
100465         For the pending wait status, add the additional has_pending_waitstatus
100466         and clear_pending_waitstatus methods.
100467
100468         I think this makes the thread_info interface a bit nicer, because we
100469         now access the fields as:
100470
100471           thread->stop_pc ()
100472
100473         rather than
100474
100475           thread->suspend.stop_pc
100476
100477         The stop_pc field being in the `suspend` structure is an implementation
100478         detail of thread_info that callers don't need to be aware of.
100479
100480         For the backup / restore of the thread_suspend_state structure, add
100481         save_suspend_to and restore_suspend_from methods.  You might wonder why
100482         `save_suspend_to`, as opposed to a simple getter like
100483
100484           thread_suspend_state &suspend ();
100485
100486         I want to make it clear that this is to be used only for backing up and
100487         restoring the suspend state, _not_ to access fields like:
100488
100489           thread->suspend ()->stop_pc
100490
100491         Adding some getters / setters allows adding some assertions.  I find
100492         that this helps understand how things are supposed to work.  Add:
100493
100494          - When getting the pending status (pending_waitstatus method), ensure
100495            that there is a pending status.
100496          - When setting a pending status (set_pending_waitstatus method), ensure
100497            there is no pending status.
100498
100499         There is one case I found where this wasn't true - in
100500         remote_target::process_initial_stop_replies - which needed adjustments
100501         to respect that contract.  I think it's because
100502         process_initial_stop_replies is kind of (ab)using the
100503         thread_info::suspend::waitstatus to store some statuses temporarily, for
100504         its internal use (statuses it doesn't intent on leaving pending).
100505
100506         process_initial_stop_replies pulls out stop replies received during the
100507         initial connection using target_wait.  It always stores the received
100508         event in `evthread->suspend.waitstatus`.  But it only sets
100509         waitstatus_pending_p, if it deems the event interesting enough to leave
100510         pending, to be reported to the core:
100511
100512               if (ws.kind != TARGET_WAITKIND_STOPPED
100513                   || ws.value.sig != GDB_SIGNAL_0)
100514                 evthread->suspend.waitstatus_pending_p = 1;
100515
100516         It later uses this flag a bit below, to choose which thread to make the
100517         "selected" one:
100518
100519               if (selected == NULL
100520                   && thread->suspend.waitstatus_pending_p)
100521                 selected = thread;
100522
100523         And ultimately that's used if the user-visible mode is all-stop, so that
100524         we print the stop for that interesting thread:
100525
100526           /* In all-stop, we only print the status of one thread, and leave
100527              others with their status pending.  */
100528           if (!non_stop)
100529             {
100530               thread_info *thread = selected;
100531               if (thread == NULL)
100532                 thread = lowest_stopped;
100533               if (thread == NULL)
100534                 thread = first;
100535
100536               print_one_stopped_thread (thread);
100537             }
100538
100539         But in any case (all-stop or non-stop), print_one_stopped_thread needs
100540         to access the waitstatus value of these threads that don't have a
100541         pending waitstatus (those that had TARGET_WAITKIND_STOPPED +
100542         GDB_SIGNAL_0).  This doesn't work with the assertions I've
100543         put.
100544
100545         So, change the code to only set the thread's wait status if it is an
100546         interesting one that we are going to leave pending.  If the thread
100547         stopped due to a non-interesting event (TARGET_WAITKIND_STOPPED +
100548         GDB_SIGNAL_0), don't store it.  Adjust print_one_stopped_thread to
100549         understand that if a thread has no pending waitstatus, it's because it
100550         stopped with TARGET_WAITKIND_STOPPED + GDB_SIGNAL_0.
100551
100552         The call to set_last_target_status also uses the pending waitstatus.
100553         However, given that the pending waitstatus for the thread may have been
100554         cleared in print_one_stopped_thread (and that there might not even be a
100555         pending waitstatus in the first place, as explained above), it is no
100556         longer possible to do it at this point.  To fix that, move the call to
100557         set_last_target_status in print_one_stopped_thread.  I think this will
100558         preserve the existing behavior, because set_last_target_status is
100559         currently using the current thread's wait status.  And the current
100560         thread is the last one for which print_one_stopped_thread is called.  So
100561         by calling set_last_target_status in print_one_stopped_thread, we'll get
100562         the same result.  set_last_target_status will possibly be called
100563         multiple times, but only the last call will matter.  It just means
100564         possibly more calls to set_last_target_status, but those are cheap.
100565
100566         Change-Id: Iedab9653238eaf8231abcf0baa20145acc8b77a7
100567
100568 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100569
100570         gdb: add setter / getter for thread_info resumed state
100571         A following patch will want to do things when a thread's resumed state
100572         changes.  Make the `resumed` field private (renamed to `m_resumed`) and
100573         add a getter and a setter for it.  The following patch in question will
100574         therefore be able to add some code to the setter.
100575
100576         Change-Id: I360c48cc55a036503174313261ce4e757d795319
100577
100578 2021-07-13  Simon Marchi  <simon.marchi@polymtl.ca>
100579
100580         gdb: use intrusive list for step-over chain
100581         The threads that need a step-over are currently linked using an
100582         hand-written intrusive doubly-linked list, so that seems a very good
100583         candidate for intrusive_list, convert it.
100584
100585         For this, we have a use case of appending a list to another one (in
100586         start_step_over).  Based on the std::list and Boost APIs, add a splice
100587         method.  However, only support splicing the other list at the end of the
100588         `this` list, since that's all we need.
100589
100590         Add explicit default assignment operators to
100591         reference_to_pointer_iterator, which are otherwise implicitly deleted.
100592         This is needed because to define thread_step_over_list_safe_iterator, we
100593         wrap reference_to_pointer_iterator inside a basic_safe_iterator, and
100594         basic_safe_iterator needs to be able to copy-assign the wrapped
100595         iterator.  The move-assignment operator is therefore not needed, only
100596         the copy-assignment operator is.  But for completeness, add both.
100597
100598         Change-Id: I31b2ff67c7b78251314646b31887ef1dfebe510c
100599
100600 2021-07-13  Pedro Alves  <pedro@palves.net>
100601
100602         gdb: make inferior_list use intrusive_list
100603         Change inferior_list, the global list of inferiors, to use
100604         intrusive_list.  I think most other changes are somewhat obvious
100605         fallouts from this change.
100606
100607         There is a small change in behavior in scoped_mock_context.  Before this
100608         patch, constructing a scoped_mock_context would replace the whole
100609         inferior list with only the new mock inferior.  Tests using two
100610         scoped_mock_contexts therefore needed to manually link the two inferiors
100611         together, as the second scoped_mock_context would bump the first mock
100612         inferior from the thread list.  With this patch, a scoped_mock_context
100613         adds its mock inferior to the inferior list on construction, and removes
100614         it on destruction.  This means that tests run with mock inferiors in the
100615         inferior list in addition to any pre-existing inferiors (there is always
100616         at least one).  There is no possible pid clash problem, since each
100617         scoped mock inferior uses its own process target, and pids are per
100618         process target.
100619
100620         Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
100621         Change-Id: I7eb6a8f867d4dcf8b8cd2dcffd118f7270756018
100622
100623 2021-07-13  Pedro Alves  <pedro@palves.net>
100624
100625         gdb: introduce intrusive_list, make thread_info use it
100626         GDB currently has several objects that are put in a singly linked list,
100627         by having the object's type have a "next" pointer directly.  For
100628         example, struct thread_info and struct inferior.  Because these are
100629         simply-linked lists, and we don't keep track of a "tail" pointer, when
100630         we want to append a new element on the list, we need to walk the whole
100631         list to find the current tail.  It would be nice to get rid of that
100632         walk.  Removing elements from such lists also requires a walk, to find
100633         the "previous" position relative to the element being removed.  To
100634         eliminate the need for that walk, we could make those lists
100635         doubly-linked, by adding a "prev" pointer alongside "next".  It would be
100636         nice to avoid the boilerplate associated with maintaining such a list
100637         manually, though.  That is what the new intrusive_list type addresses.
100638
100639         With an intrusive list, it's also possible to move items out of the
100640         list without destroying them, which is interesting in our case for
100641         example for threads, when we exit them, but can't destroy them
100642         immediately.  We currently keep exited threads on the thread list, but
100643         we could change that which would simplify some things.
100644
100645         Note that with std::list, element removal is O(N).  I.e., with
100646         std::list, we need to walk the list to find the iterator pointing to
100647         the position to remove.  However, we could store a list iterator
100648         inside the object as soon as we put the object in the list, to address
100649         it, because std::list iterators are not invalidated when other
100650         elements are added/removed.  However, if you need to put the same
100651         object in more than one list, then std::list<object> doesn't work.
100652         You need to instead use std::list<object *>, which is less efficient
100653         for requiring extra memory allocations.  For an example of an object
100654         in multiple lists, see the step_over_next/step_over_prev fields in
100655         thread_info:
100656
100657           /* Step-over chain.  A thread is in the step-over queue if these are
100658              non-NULL.  If only a single thread is in the chain, then these
100659              fields point to self.  */
100660           struct thread_info *step_over_prev = NULL;
100661           struct thread_info *step_over_next = NULL;
100662
100663         The new intrusive_list type gives us the advantages of an intrusive
100664         linked list, while avoiding the boilerplate associated with manually
100665         maintaining it.
100666
100667         intrusive_list's API follows the standard container interface, and thus
100668         std::list's interface.  It is based the API of Boost's intrusive list,
100669         here:
100670
100671          https://www.boost.org/doc/libs/1_73_0/doc/html/boost/intrusive/list.html
100672
100673         Our implementation is relatively simple, while Boost's is complicated
100674         and intertwined due to a lot of customization options, which our version
100675         doesn't have.
100676
100677         The easiest way to use an intrusive_list is to make the list's element
100678         type inherit from intrusive_node.  This adds a prev/next pointers to
100679         the element type.  However, to support putting the same object in more
100680         than one list, intrusive_list supports putting the "node" info as a
100681         field member, so you can have more than one such nodes, one per list.
100682
100683         As a first guinea pig, this patch makes the per-inferior thread list use
100684         intrusive_list using the base class method.
100685
100686         Unlike Boost's implementation, ours is not a circular list.  An earlier
100687         version of the patch was circular: the intrusive_list type included an
100688         intrusive_list_node "head".  In this design, a node contained pointers
100689         to the previous and next nodes, not the previous and next elements.
100690         This wasn't great for when debugging GDB with GDB, as it was difficult
100691         to get from a pointer to the node to a pointer to the element.  With the
100692         design proposed in this patch, nodes contain pointers to the previous
100693         and next elements, making it easy to traverse the list by hand and
100694         inspect each element.
100695
100696         The intrusive_list object contains pointers to the first and last
100697         elements of the list.  They are nullptr if the list is empty.
100698         Each element's node contains a pointer to the previous and next
100699         elements.  The first element's previous pointer is nullptr and the last
100700         element's next pointer is nullptr.  Therefore, if there's a single
100701         element in the list, both its previous and next pointers are nullptr.
100702         To differentiate such an element from an element that is not linked into
100703         a list, the previous and next pointers contain a special value (-1) when
100704         the node is not linked.  This is necessary to be able to reliably tell
100705         if a given node is currently linked or not.
100706
100707         A begin() iterator points to the first item in the list.  An end()
100708         iterator contains nullptr.  This makes iteration until end naturally
100709         work, as advancing past the last element will make the iterator contain
100710         nullptr, making it equal to the end iterator.  If the list is empty,
100711         a begin() iterator will contain nullptr from the start, and therefore be
100712         immediately equal to the end.
100713
100714         Iterating on an intrusive_list yields references to objects (e.g.
100715         `thread_info&`).  The rest of GDB currently expects iterators and ranges
100716         to yield pointers (e.g. `thread_info*`).  To bridge the gap, add the
100717         reference_to_pointer_iterator type.  It is used to define
100718         inf_threads_iterator.
100719
100720         Add a Python pretty-printer, to help inspecting intrusive lists when
100721         debugging GDB with GDB.  Here's an example of the output:
100722
100723             (top-gdb) p current_inferior_.m_obj.thread_list
100724             $1 = intrusive list of thread_info = {0x61700002c000, 0x617000069080, 0x617000069400, 0x61700006d680, 0x61700006eb80}
100725
100726         It's not possible with current master, but with this patch [1] that I
100727         hope will be merged eventually, it's possible to index the list and
100728         access the pretty-printed value's children:
100729
100730             (top-gdb) p current_inferior_.m_obj.thread_list[1]
100731             $2 = (thread_info *) 0x617000069080
100732             (top-gdb) p current_inferior_.m_obj.thread_list[1].ptid
100733             $3 = {
100734               m_pid = 406499,
100735               m_lwp = 406503,
100736               m_tid = 0
100737             }
100738
100739         Even though iterating the list in C++ yields references, the Python
100740         pretty-printer yields pointers.  The reason for this is that the output
100741         of printing the thread list above would be unreadable, IMO, if each
100742         thread_info object was printed in-line, since they contain so much
100743         information.  I think it's more useful to print pointers, and let the
100744         user drill down as needed.
100745
100746         [1] https://sourceware.org/pipermail/gdb-patches/2021-April/178050.html
100747
100748         Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
100749         Change-Id: I3412a14dc77f25876d742dab8f44e0ba7c7586c0
100750
100751 2021-07-13  GDB Administrator  <gdbadmin@sourceware.org>
100752
100753         Automatic date update in version.in
100754
100755 2021-07-12  Tucker  <tuckkern@sourceware@gmail.com>
100756
100757         Add the SEC_ELF_OCTETS flag to debug sections created by the assembler.
100758                 PR 28054
100759         gas     * config/obj-elf.c (obj_elf_change_section): Set the
100760                 SEF_ELF_OCTETS flag on debug sections.
100761
100762 2021-07-12  Tom de Vries  <tdevries@suse.de>
100763
100764         [gdb/testsuite] Fix gdb.btrace/tsx.exp on system with tsx disabled in microcode
100765         Recently I started to see this fail with trunk:
100766         ...
100767         (gdb) record instruction-history^M
100768         1          0x00000000004004ab <main+4>: call   0x4004b7 <test>^M
100769         2          0x00000000004004c6 <test+15>:        mov    $0x1,%eax^M
100770         3          0x00000000004004cb <test+20>:        ret    ^M
100771         (gdb) FAIL: gdb.btrace/tsx.exp: speculation indication
100772         ...
100773
100774         This is due to an intel microcode update (1) that disables Intel TSX by default.
100775
100776         Fix this by updating the pattern.
100777
100778         Tested on x86_64-linux, with both gcc 7.5.0 and clang 12.0.1.
100779
100780         [1] https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html
100781
100782         gdb/testsuite/ChangeLog:
100783
100784         2021-07-12  Tom de Vries  <tdevries@suse.de>
100785
100786                 PR testsuite/28057
100787                 * gdb.btrace/tsx.exp: Add pattern for system with tsx disabled in
100788                 microcode.
100789
100790 2021-07-12  Nick Clifton  <nickc@redhat.com>
100791
100792         Updated French translation for the binutils sub-directory
100793
100794         Fix a translation problem for the text generated by readelf at the start of a dump of a dynamic section.
100795                 PR 28072
100796         binutils * readelf.c (process_dynamic_section): Use ngettext to help with translation of header text.
100797
100798 2021-07-12  Tom de Vries  <tdevries@suse.de>
100799
100800         [gdb/testsuite] Fix gdb.mi/mi-info-sources.exp for extra debug info
100801         When running test-case gdb.mi/mi-info-sources.exp, I run into:
100802         ...
100803         Running src/gdb/testsuite/gdb.mi/mi-info-sources.exp ...
100804         ERROR: internal buffer is full.
100805         ...
100806         due to extra debug info from the shared libraries.
100807
100808         Fix this by using "nosharedlibrary".
100809
100810         Then I run into these FAILs:
100811         ...
100812         FAIL: gdb.mi/mi-info-sources.exp: debug_read=false: \
100813           -file-list-exec-source-files (unexpected output)
100814         FAIL: gdb.mi/mi-info-sources.exp: debug_read=true: \
100815           -file-list-exec-source-files (unexpected output)
100816         FAIL: gdb.mi/mi-info-sources.exp: debug_read=true: \
100817           -file-list-exec-source-files --group-by-objfile, look for \
100818           mi-info-sources.c (unexpected output)
100819         FAIL: gdb.mi/mi-info-sources.exp: debug_read=true: \
100820           -file-list-exec-source-files --group-by-objfile, look for \
100821           mi-info-sources-base.c (unexpected output)
100822         ...
100823         due to openSUSE executables which have debug info for objects from sources
100824         like sysdeps/x86_64/crtn.S.
100825
100826         Fix these by updating the patterns, and adding "maint expand-symtabs" to
100827         reliably get fully-read objfiles.
100828
100829         Then I run into FAILs when using the readnow target board.  Fix these by
100830         skipping the relevant tests.
100831
100832         Then I run into FAILs when using the cc-with-gnu-debuglink board.  Fix these
100833         by updating the patterns.
100834
100835         Tested on x86_64-linux, with native, check-read1, readnow, cc-with-gdb-index,
100836         cc-with-debug-names, cc-with-gnu-debuglink, cc-with-dwz, cc-with-dwz-m.
100837
100838         gdb/testsuite/ChangeLog:
100839
100840         2021-07-05  Tom de Vries  <tdevries@suse.de>
100841
100842                 * lib/mi-support.exp (mi_readnow): New proc.
100843                 * gdb.mi/mi-info-sources.exp: Use nosharedlibrary.  Update patterns.
100844                 Skip tests for readnow.  Use "maint expand-symtabs".
100845
100846 2021-07-12  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
100847
100848         testsuite: fix whitespace problems in gdb.mi/mi-break.exp
100849         Replace leading 8-spaces with tab and remove trailing space in
100850         gdb.mi/mi-break.exp.
100851
100852 2021-07-12  GDB Administrator  <gdbadmin@sourceware.org>
100853
100854         Automatic date update in version.in
100855
100856 2021-07-11  GDB Administrator  <gdbadmin@sourceware.org>
100857
100858         Automatic date update in version.in
100859
100860 2021-07-10  Alan Modra  <amodra@gmail.com>
100861
100862         Tidy commit 49910fd88dcd
100863         Pointer range checking is UB if the values compared are outside the
100864         underlying array elements (plus one).
100865
100866                 * dwarf2.c (read_address): Remove accidental commit.
100867                 (read_ranges): Compare offset rather than pointers.
100868
100869 2021-07-10  Alan Modra  <amodra@gmail.com>
100870
100871         PR28069, assertion fail in dwarf.c:display_discr_list
100872         We shouldn't be asserting on anything to do with leb128 values, or
100873         reporting file and line numbers when something unexpected happens.
100874         leb128 data is of indeterminate length, perfect for fuzzer mayhem.
100875         It would only make sense to assert or report dwarf.c/readelf.c source
100876         lines if the code had already sized and sanity checked the leb128
100877         values.
100878
100879         After removing the assertions, the testcase then gave:
100880
100881             <37>   DW_AT_discr_list  : 5 byte block: 0 0 0 0 0  (label 0, label 0, label 0, label 0, <corrupt>
100882         readelf: Warning: corrupt discr_list - unrecognized discriminant byte 0x5
100883
100884             <3d>   DW_AT_encoding    : 0        (void)
100885             <3e>   DW_AT_identifier_case: 0     (case_sensitive)
100886             <3f>   DW_AT_virtuality  : 0        (none)
100887             <40>   DW_AT_decimal_sign: 5        (trailing separate)
100888
100889         So the DW_AT_discr_list was showing more data than just the 5 byte
100890         block.  That happened due to "end" pointing a long way past the end of
100891         block, and uvalue decrementing past zero on one of the leb128 bytes.
100892
100893                 PR 28069
100894                 * dwarf.c (display_discr_list): Remove assertions.  Delete "end"
100895                 parameter, use initial "data" pointer as the end.  Formatting.
100896                 Don't count down bytes as they are read.
100897                 (read_and_display_attr_value): Adjust display_discr_list call.
100898                 (read_and_print_leb128): Don't pass __FILE__ and __LINE__ to
100899                 report_leb_status.
100900                 * dwarf.h (report_leb_status): Don't report file and line
100901                 numbers.  Delete file and lnum parameters,
100902                 (READ_ULEB, READ_SLEB): Adjust.
100903
100904 2021-07-10  GDB Administrator  <gdbadmin@sourceware.org>
100905
100906         Automatic date update in version.in
100907
100908 2021-07-09  H.J. Lu  <hjl.tools@gmail.com>
100909
100910         ld/NEWS: Clarify -z [no]indirect-extern-access
100911         -z [no]indirect-extern-access are only for x86 ELF linker.
100912
100913 2021-07-09  H.J. Lu  <hjl.tools@gmail.com>
100914
100915         elf: Limits 2 GNU_PROPERTY_1_NEEDED tests to Linux/x86
100916         Run property-1_needed-1b.d and property-1_needed-1c.d, which pass
100917         -z [no]indirect-extern-access to linker, only run for Linux/x86 targets.
100918
100919                 * testsuite/ld-elf/property-1_needed-1b.d: Only run for
100920                 Linux/x86 targets.
100921                 * testsuite/ld-elf/property-1_needed-1c.d: Likewise.
100922
100923 2021-07-09  H.J. Lu  <hjl.tools@gmail.com>
100924
100925         elf: Add GNU_PROPERTY_1_NEEDED check
100926         If GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS is set on any input
100927         relocatable files:
100928
100929         1. Don't generate copy relocations.
100930         2. Turn off extern_protected_data since it implies
100931         GNU_PROPERTY_NO_COPY_ON_PROTECTED.
100932         3. Treate reference to protected symbols with indirect external access
100933         as local.
100934         4. Set GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS on output.
100935         5. When generating executable, clear this bit when there are non-GOT or
100936         non-PLT relocations in input relocatable files without the bit set.
100937         6. Add -z [no]indirect-extern-access to control indirect external access.
100938
100939         bfd/
100940
100941                 * elf-bfd (elf_obj_tdata): Add has_indirect_extern_access.
100942                 (elf_has_indirect_extern_access): New.
100943                 * elf-properties.c (_bfd_elf_parse_gnu_properties): Set
100944                 elf_has_indirect_extern_access and elf_has_no_copy_on_protected
100945                 when seeing GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
100946                 (elf_write_gnu_propertie): Add an argument to pass link_info.
100947                 Set needed_1_p for GNU_PROPERTY_1_NEEDED in memory.
100948                 (_bfd_elf_link_setup_gnu_properties): Handle
100949                 GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS for
100950                 -z indirect-extern-access.  Set nocopyreloc to true and
100951                 extern_protected_data to false for indirect external access.
100952                 (_bfd_elf_convert_gnu_properties): Updated.
100953                 * elf32-i386.c (elf_i386_check_relocs): Set
100954                 non_got_ref_without_indirect_extern_access on legacy non-GOT or
100955                 non-PLT references.
100956                 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
100957                 * elflink.c (_bfd_elf_symbol_refs_local_p): Return true for
100958                 STV_PROTECTED symbols with indirect external access.
100959                 * elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Clear
100960                 indirect_extern_access for legacy non-GOT/non-PLT references.
100961                 * elfxx-x86.h (elf_x86_link_hash_entry): Add
100962                 non_got_ref_without_indirect_extern_access.
100963
100964         include/
100965
100966                 * bfdlink.h (bfd_link_info): Add indirect_extern_access and
100967                 needed_1_p.  Change nocopyreloc to int.
100968
100969         ld/
100970
100971                 * NEWS: Mention -z [no]indirect-extern-access
100972                 * ld.texi: Document -z [no]indirect-extern-access
100973                 * ldmain.c (main): Initialize link_info.indirect_extern_access
100974                 to -1.
100975                 * emulparams/extern_protected_data.sh: Support
100976                 -z [no]indirect-extern-access.
100977                 * testsuite/ld-elf/indirect-extern-access-1.rd: New file
100978                 * testsuite/ld-elf/indirect-extern-access-1a.c: Likewise.
100979                 * testsuite/ld-elf/indirect-extern-access-1b.c: Likewise.
100980                 * testsuite/ld-elf/indirect-extern-access-2.rd: Likewise.
100981                 * testsuite/ld-elf/indirect-extern-access-2a.c: Likewise.
100982                 * testsuite/ld-elf/indirect-extern-access-2b.c: Likewise.
100983                 * testsuite/ld-elf/indirect-extern-access-3.rd: Likewise.
100984                 * testsuite/ld-elf/indirect-extern-access.S: Likewise.
100985                 * testsuite/ld-elf/property-1_needed-1b.d: Likewise.
100986                 * testsuite/ld-elf/property-1_needed-1c.d: Likewise.
100987                 * testsuite/ld-x86-64/indirect-extern-access.rd: Likewise.
100988                 * testsuite/ld-x86-64/protected-data-1.h: Likewise.
100989                 * testsuite/ld-x86-64/protected-data-1a.c: Likewise.
100990                 * testsuite/ld-x86-64/protected-data-1b.c: Likewise.
100991                 * testsuite/ld-x86-64/protected-data-2a.S: Likewise.
100992                 * testsuite/ld-x86-64/protected-data-2b.S: Likewise.
100993                 * testsuite/ld-x86-64/protected-func-2a.S: Likewise.
100994                 * testsuite/ld-x86-64/protected-func-2b.S: Likewise.
100995                 * testsuite/ld-x86-64/protected-func-2c.c: Likewise.
100996                 * testsuite/ld-elf/linux-x86.exp: Run test with
100997                 GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
100998                 * testsuite/ld-x86-64/x86-64.exp: Run tests for protected
100999                 function and data with indirect external access.
101000
101001 2021-07-09  H.J. Lu  <hjl.tools@gmail.com>
101002
101003         elf: Add GNU_PROPERTY_1_NEEDED
101004         Add GNU_PROPERTY_1_NEEDED:
101005
101006          #define GNU_PROPERTY_1_NEEDED      GNU_PROPERTY_UINT32_OR_LO
101007
101008         to indicate the needed properties by the object file.
101009
101010         Add GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS:
101011
101012          #define GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS  (1U << 0)
101013
101014         to indicate that the object file requires canonical function pointers and
101015         cannot be used with copy relocation.
101016
101017         binutils/
101018
101019                 * readelf.c (decode_1_needed): New.
101020                 (print_gnu_property_note): Handle GNU_PROPERTY_1_NEEDED.
101021
101022         include/
101023
101024                 * elf/common.h (GNU_PROPERTY_1_NEEDED): New.
101025                 (GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS): Likewise.
101026
101027         ld/
101028
101029                 * testsuite/ld-elf/property-1_needed-1a.d: New file.
101030                 * testsuite/ld-elf/property-1_needed-1.s: Likewise.
101031
101032 2021-07-09  GDB Administrator  <gdbadmin@sourceware.org>
101033
101034         Automatic date update in version.in
101035
101036 2021-07-09  Lancelot SIX  <lsix@lancelotsix.com>
101037
101038         Remove unused parameter in maybe_software_singlestep
101039         While working around, I noticed that the last parameter of
101040         maybe_software_singlestep is never used.  This path removes
101041         it.
101042
101043         Built on x86_64-linux-gnu and riscv64-linux-gnu.
101044
101045         gdb/ChangeLog:
101046
101047                 * infrun.c (maybe_software_singlestep): Remove unused PC
101048                 parameter.
101049                 (resume_1): Update calls to maybe_software_singlestep.
101050
101051 2021-07-08  H.J. Lu  <hjl.tools@gmail.com>
101052
101053         x86-64: Disallow PC reloc against weak undefined symbols in PIE
101054         Disallow PC relocations against weak undefined symbols in PIE since they
101055         can lead to non-zero address at run-time.
101056
101057         bfd/
101058
101059                 PR ld/21782
101060                 * elf64-x86-64.c (elf_x86_64_relocate_section): Disallow PC
101061                 relocations against weak undefined symbols in PIE.
101062
101063         ld/
101064
101065                 PR ld/21782
101066                 * testsuite/ld-x86-64/pie3.d: Expect linker error.
101067
101068 2021-07-08  H.J. Lu  <hjl.tools@gmail.com>
101069
101070         ld: Limit cache size and add --max-cache-size=SIZE
101071         When link_info.keep_memory is true, linker caches the relocation
101072         information and symbol tables of input files in memory.  When there
101073         are many input files with many relocations, we may run out of memory.
101074         Add --max-cache-size=SIZE to set the maximum cache size.
101075
101076         bfd/
101077
101078                 PR ld/18028
101079                 * bfd.c (bfd): Add alloc_size.
101080                 * elf-bfd.h (_bfd_elf_link_info_read_relocs): New.
101081                 * elf32-i386.c (elf_i386_check_relocs): Use _bfd_link_keep_memory.
101082                 Update cache_size.
101083                 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
101084                 * elflink.c (_bfd_elf_link_read_relocs): Renamed to ...
101085                 (_bfd_elf_link_info_read_relocs): This.  Update cache_size.
101086                 (_bfd_elf_link_read_relocs): New.
101087                 (_bfd_elf_link_check_relocs): Call _bfd_elf_link_info_read_relocs
101088                 instead of _bfd_elf_link_read_relocs.
101089                 (elf_link_add_object_symbols): Likewise.
101090                 (elf_link_input_bfd): Likewise.
101091                 (init_reloc_cookie_rels): Likewise.
101092                 (init_reloc_cookie): Update cache_size.  Call
101093                 _bfd_elf_link_info_read_relocs instead of
101094                 _bfd_elf_link_read_relocs.
101095                 (link_info_ok): New.
101096                 (elf_gc_smash_unused_vtentry_relocs): Updated.  Call
101097                 _bfd_elf_link_info_read_relocs instead of
101098                 _bfd_elf_link_read_relocs.
101099                 (bfd_elf_gc_sections): Use link_info_ok.  Pass &link_info_ok
101100                 to elf_gc_smash_unused_vtentry_relocs.
101101                 * libbfd-in.h (_bfd_link_keep_memory): New.
101102                 * linker.c (_bfd_link_keep_memory): New.
101103                 * opncls.c (bfd_alloc): Update alloc_size.
101104                 * bfd-in2.h: Regenerated.
101105                 * libbfd.h: Likewise.
101106
101107         include/
101108
101109                 PR ld/18028
101110                 * bfdlink.h (bfd_link_info): Add cache_size and max_cache_size.
101111
101112         ld/
101113
101114                 PR ld/18028
101115                 * NEWS: Mention --max-cache-size=SIZE.
101116                 * ld.texi: Document --max-cache-size=SIZE.
101117                 * ldlex.h (option_values): Add OPTION_MAX_CACHE_SIZE.
101118                 * ldmain.c: (main): Set link_info.max_cache_size to -1.
101119                 * lexsup.c (ld_options): Add --max-cache-size=SIZE.
101120                 (parse_args): Support OPTION_MAX_CACHE_SIZE.
101121                 * testsuite/ld-bootstrap/bootstrap.exp: Add test for
101122                 --max-cache-size=-1.
101123
101124 2021-07-08  Simon Marchi  <simon.marchi@polymtl.ca>
101125
101126         gdb: don't set Linux-specific displaced stepping methods in s390_gdbarch_init
101127         According to bug 28056, running an s390x binary gives:
101128
101129             (gdb) run
101130             Starting program: /usr/bin/ls
101131             /home/ubuntu/tmp/gdb-11.0.90.20210705/gdb/linux-tdep.c:2550: internal-error: displaced_step_prepare_status linux_displaced_step_prepare(gdbarch*, thread_info*, CORE_ADDR&): Assertion `gdbarch_data->num_disp_step_buffers > 0' failed.
101132
101133         This is because the s390 architecture registers some Linux-specific
101134         displaced stepping callbacks in the OS-agnostic s390_gdbarch_init:
101135
101136             set_gdbarch_displaced_step_prepare (gdbarch, linux_displaced_step_prepare);
101137             set_gdbarch_displaced_step_finish (gdbarch, linux_displaced_step_finish);
101138             set_gdbarch_displaced_step_restore_all_in_ptid
101139               (gdbarch, linux_displaced_step_restore_all_in_ptid);
101140
101141         But then the Linux-specific s390_linux_init_abi_any passes
101142         num_disp_step_buffers=0 to linux_init_abi:
101143
101144             linux_init_abi (info, gdbarch, 0);
101145
101146         The problem happens when linux_displaced_step_prepare is called for the
101147         first time.  It tries to allocate the displaced stepping buffers, but
101148         sees that the number of displaced stepping buffers for that architecture
101149         is 0, which is unexpected / invalid.
101150
101151         s390_gdbarch_init should not register the linux_* callbacks, that is
101152         expected to be done by linux_init_abi.  If debugging a bare-metal s390
101153         program, or an s390 program on another OS GDB doesn't know about, we
101154         wouldn't want to use them.  We would either register no callbacks, if
101155         displaced stepping isn't supported, or register a different set of
101156         callbacks if we wanted to support displaced stepping in those cases.
101157
101158         The commit that refactored the displaced stepping machinery and
101159         introduced these set_gdbarch_displaced_step_* calls is 187b041e2514
101160         ("gdb: move displaced stepping logic to gdbarch, allow starting
101161         concurrent displaced steps").  However, even before that,
101162         s390_gdbarch_init did:
101163
101164           set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
101165
101166         ... which already seemed wrong.  The Linux-specific callback was used
101167         even for non-Linux system.  Maybe that was on purpose, because it would
101168         also happen to work in some other non-Linux case, or maybe it was simply
101169         a mistake.  I'll assume that this was a small mistake when
101170         s390-tdep.{h,c} where factored out of s390-linux-tdep.c, in d6e589456475
101171         ("s390: Split up s390-linux-tdep.c into two files").
101172
101173         Fix this by removing the setting of these displaced step callbacks from
101174         s390_gdbarch_init.  Instead, pass num_disp_step_buffers=1 to
101175         linux_init_abi, in s390_linux_init_abi_any.  Doing so will cause
101176         linux_init_abi to register these same callbacks.  It will also mean that
101177         when debugging a bare-metal s390 executable or an executable on another
101178         OS that GDB doesn't know about, gdbarch_displaced_step_prepare won't be
101179         set, so displaced stepping won't be used.
101180
101181         This patch will need to be merged in the gdb-11-branch, since this is a
101182         GDB 11 regression, so here's the ChangeLog entry:
101183
101184         gdb/ChangeLog:
101185
101186                 * s390-linux-tdep.c (s390_linux_init_abi_any): Pass 1 (number
101187                 of displaced stepping buffers to linux_init_abi.
101188                 * s390-tdep.c (s390_gdbarch_init): Don't set the Linux-specific
101189                 displaced-stepping gdbarch callbacks.
101190
101191         Change-Id: Ieab2f8990c78fde845ce7378d6fd4ee2833800d5
101192         Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28056
101193
101194 2021-07-08  Simon Marchi  <simon.marchi@polymtl.ca>
101195
101196         gdb/Makefile.in: remove testsuite from SUBDIRS
101197         When distclean-ing a configured / built gdb directory, like so:
101198
101199             $ ./configure && make all-gdb && make distclean
101200
101201         The distclean operation fails with:
101202
101203             Missing testsuite/Makefile
101204
101205         If we look at the SUBDIRS variable in the generated gdb/Makefile,
101206         testsuite is there twice:
101207
101208             SUBDIRS = doc  testsuite data-directory testsuite
101209
101210         So we try distclean-ing the testsuite directory twice.  The second time,
101211         gdb/testsuite/Makefile doesn't exist, so it fails.
101212
101213         The first "testsuite" comes from the @subdirs@ replacement, because of
101214         the `AC_CONFIG_SUBDIRS` macro in gdb/configure.ac.  The second one is
101215         hard-coded in gdb/Makefile.in:
101216
101217             SUBDIRS = doc @subdirs@ data-directory testsuite
101218
101219         The hard-coded was added by:
101220
101221             bdbbcd577460 ("Always build 'all' in gdb/testsuite")
101222
101223         which came after `testsuite` was removed from @subdirs@ by:
101224
101225             f99d1d37496f ("Remove gdb/testsuite/configure")
101226
101227         My commit a100a94530eb ("gdb/testsuite: restore configure script")
101228         should have removed the hard-coded `testsuite`, since it added it back
101229         as a "subdir", but I missed it because I only looked f99d1d37496f to
101230         write my patch.
101231
101232         Fix this by removing the hard-coded one.
101233
101234         This patch should be pushed to both master and gdb-11-branch, hence the
101235         ChangeLog entry:
101236
101237         gdb/ChangeLog:
101238
101239                 * Makefile.in (SUBDIRS): Remove testsuite.
101240
101241         Change-Id: I63e5590b1a08673c646510b3ecc74600eae9f92d
101242
101243 2021-07-08  Nick Clifton  <nickc@redhat.com>
101244
101245         Updated Portuguese translation for the BFD sub-directory
101246
101247 2021-07-08  Tom de Vries  <tdevries@suse.de>
101248
101249         [gdb/testsuite] Fix gdb.guile/scm-breakpoint.exp with guile 3.0
101250         When running test-case gdb.guile/scm-breakpoint.exp on openSUSE Tumbleweed
101251         with guile 3.0, I run into:
101252         ...
101253         (gdb) guile (define cp (make-breakpoint "syscall" #:type BP_CATCHPOINT))^M
101254         ERROR: In procedure make-breakpoint:^M
101255         In procedure gdbscm_make_breakpoint: unsupported breakpoint type in \
101256           position 3: "BP_CATCHPOINT"^M
101257         Error while executing Scheme code.^M
101258         (gdb) FAIL: gdb.guile/scm-breakpoint.exp: test_catchpoints: \
101259           create a catchpoint via the api
101260         ...
101261
101262         The same test passes on openSUSE Leap 15.2 with guile 2.0, where the second
101263         line of the error message starts with the same prefix as the first:
101264         ...
101265         ERROR: In procedure gdbscm_make_breakpoint: unsupported breakpoint type in \
101266           position 3: "BP_CATCHPOINT"^M
101267         ...
101268
101269         I observe the same difference in many other tests, f.i.:
101270         ...
101271         (gdb) gu (print (value-add i '()))^M
101272         ERROR: In procedure value-add:^M
101273         In procedure gdbscm_value_add: Wrong type argument in position 2: ()^M
101274         Error while executing Scheme code.^M
101275         (gdb) PASS: gdb.guile/scm-math.exp: catch error in guile type conversion
101276         ...
101277         but it doesn't cause FAILs anywhere else.
101278
101279         Fix this by updating the regexp to make the "ERROR: " prefix optional.
101280
101281         Tested on x86_64-linux, with both guile 2.0 and 3.0.
101282
101283         gdb/testsuite/ChangeLog:
101284
101285         2021-07-07  Tom de Vries  <tdevries@suse.de>
101286
101287                 * gdb.guile/scm-breakpoint.exp: Make additional "ERROR: " prefix in
101288                 exception printing optional.
101289
101290 2021-07-08  Mike Frysinger  <vapier@gentoo.org>
101291
101292         sim: erc32: use libsim.a for common objects
101293         We're starting to move more objects to the common build that sis did
101294         not need before, so linking them is causing problems (when common
101295         objects end up needing symbols from non-common objects).  Switch it
101296         to the libsim.a archive which will allow the link to pull out only
101297         what it needs.
101298
101299 2021-07-08  GDB Administrator  <gdbadmin@sourceware.org>
101300
101301         Automatic date update in version.in
101302
101303 2021-07-07  Nick Clifton  <nickc@redhat.com>
101304
101305         Remove an accidental change to elfcode.h included as part of commit 6e0dfbf420.
101306                 PR 27659
101307                 * elfcode.h (elf_swap_symbol_out): Revert accidental change that
101308                 removed an abort if the shndx pointer is NULL.
101309
101310 2021-07-07  H.J. Lu  <hjl.tools@gmail.com>
101311
101312         ld: Check archive only for archive member
101313         Since plugin_maybe_claim calls bfd_close on the original input BFD if it
101314         isn't an archive member, pass NULL to bfd_plugin_close_file_descriptor
101315         to indicate that the BFD isn't an archive member.
101316
101317         bfd/
101318
101319                 PR ld/18028
101320                 * plugin.c (bfd_plugin_close_file_descriptor): Check archive
101321                 only of abfd != NULL.
101322                 (try_claim): Pass NULL to bfd_plugin_close_file_descriptor if
101323                 it isn't an archive member.
101324
101325         ld/
101326
101327                 PR ld/18028
101328                 * plugin.c (plugin_input_file): Add comments for abfd and ibfd.
101329                 (plugin_object_p): Set input->ibfd to NULL if it isn't an
101330                 archive member.
101331
101332 2021-07-07  Andreas Krebbel  <krebbel@linux.ibm.com>
101333
101334         Add changelog entries for last commit
101335
101336 2021-07-07  Andreas Krebbel  <krebbel@linux.ibm.com>
101337
101338         IBM Z: Add another arch14 instruction
101339         opcodes/
101340
101341                 * opcodes/s390-opc.txt: Add qpaci.
101342
101343         gas/
101344
101345                 * testsuite/gas/s390/zarch-arch14.d: Add qpaci.
101346                 * testsuite/gas/s390/zarch-arch14.s: Add qpaci.
101347
101348 2021-07-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
101349
101350         Fix Solaris gprof build with --disable-nls
101351         gprof fails to compile on Solaris 10 and 11.3 with --disable-nls:
101352
101353         In file included from /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/gprof.h:33,
101354                          from /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/basic_blocks.c:24:
101355         /usr/include/libintl.h:45:14: error: expected identifier or '(' before 'const'
101356            45 | extern char *dcgettext(const char *, const char *, const int);
101357               |              ^~~~~~~~~
101358         /usr/include/libintl.h:46:14: error: expected identifier or '(' before 'const'
101359            46 | extern char *dgettext(const char *, const char *);
101360               |              ^~~~~~~~
101361         /usr/include/libintl.h:47:14: error: expected identifier or '(' before 'const'
101362            47 | extern char *gettext(const char *);
101363               |              ^~~~~~~
101364         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:165:33:
101365         error: expected identifier or '(' before 'do'
101366           165 | # define textdomain(Domainname) do {} while (0)
101367               |                                 ^~
101368         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:165:39:
101369         error: expected identifier or '(' before 'while'
101370           165 | # define textdomain(Domainname) do {} while (0)
101371               |                                       ^~~~~
101372         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:166:46:
101373         error: expected identifier or '(' before 'do'
101374           166 | # define bindtextdomain(Domainname, Dirname) do {} while (0)
101375               |                                              ^~
101376         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:166:52:
101377         error: expected identifier or '(' before 'while'
101378           166 | # define bindtextdomain(Domainname, Dirname) do {} while (0)
101379               |                                                    ^~~~~
101380         /usr/include/libintl.h:55:14: error: expected identifier or '(' before 'unsigned'
101381            55 | extern char *dcngettext(const char *, const char *,
101382               |              ^~~~~~~~~~
101383         /usr/include/libintl.h:57:14: error: expected identifier or '(' before 'unsigned'
101384            57 | extern char *dngettext(const char *, const char *,
101385               |              ^~~~~~~~~
101386         /usr/include/libintl.h:59:14: error: expected identifier or '(' before 'unsigned'
101387            59 | extern char *ngettext(const char *, const char *, unsigned long int);
101388               |              ^~~~~~~~
101389
101390         This is a known issue already partially fixed in binutils/sysdep.h.  For
101391         gprof, the same fix needs to be applied in bfd/sysdep.h, as the
101392         following patch does.  Tested on i386-pc-solaris2.10 and
101393         i386-pc-solaris2.11.
101394
101395         2021-07-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
101396
101397                 bfd:
101398                 * sysdep.h [!ENABLE_NLS]: Prevent inclusion of <libintl.h> on
101399                 Solaris.
101400
101401 2021-07-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
101402
101403         Check for strnlen declaration to fix Solaris 10 build
101404         binutils currently fails to compile on Solaris 10:
101405
101406         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function 'bfd_get_debug_link_info_1':
101407         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: implicit declaration of function 'strnlen' [-Werror=implicit-function-declaration]
101408          1231 |   crc_offset = strnlen (name, size) + 1;
101409               |                ^~~~~~~
101410         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: incompatible implicit declaration of built-in function 'strnlen' [-Werror]
101411         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function 'bfd_get_alt_debug_link_info':
101412         /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1319:20: error: incompatible implicit declaration of built-in function 'strnlen' [-Werror]
101413          1319 |   buildid_offset = strnlen (name, size) + 1;
101414               |                    ^~~~~~~
101415
101416         and in a couple of other places.  The platform lacks strnlen, and while
101417         libiberty.h can provide a fallback declaration, the necessary configure
101418         test isn't run.
101419
101420         Fixed with the following patch.  Tested on i386-pc-solaris2.10.
101421
101422         2021-07-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
101423
101424                 bfd:
101425                 * configure.ac: Check for strnlen declaration.
101426                 * configure, config.in: Regenerate.
101427
101428                 binutils:
101429                 * configure.ac: Check for strnlen declaration.
101430                 * configure, config.in: Regenerate.
101431
101432 2021-07-07  Nick Clifton  <nickc@redhat.com>
101433
101434         Fix problems translating messages when a percentage sign appears at the end of a string.
101435                 PR 28051
101436         gas     * config/tc-i386.c (offset_in_range): Reformat error messages in
101437                 order to fix problems when translating.
101438                 (md_assemble): Likewise.
101439                 * messages.c (as_internal_value_out_of_range): Likewise.
101440                 * read.c (emit_expr_with_reloc): Likewise.
101441                 * testsuite/gas/all/overflow.l Change expected output format.
101442                 * po/gas.pot: Regenerate.
101443
101444         bfd     * coff-rs6000.c (xcoff_reloc_type_tls): Reformat error messages in
101445                 order to fix problems when translating.
101446                 * cofflink.c (_bfd_coff_write_global_sym): Likewise.
101447                 * elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
101448                 Likewise.
101449                 * po/bfd.pot: Regenerate.
101450
101451 2021-07-07  GDB Administrator  <gdbadmin@sourceware.org>
101452
101453         Automatic date update in version.in
101454
101455 2021-07-06  Simon Marchi  <simon.marchi@polymtl.ca>
101456
101457         gdb: introduce iterator_range, remove next_adapter
101458         I was always a bit confused by next_adapter, because it kind of mixes
101459         the element type and the iterator type.  In reality, it is not much more
101460         than a class that wraps two iterators (begin and end).  However, it
101461         assumes that:
101462
101463          - you can construct the begin iterator by passing a pointer to the
101464            first element of the iterable
101465          - you can default-construct iterator to make the end iterator
101466
101467         I think that by generalizing it a little bit, we can re-use it at more
101468         places.
101469
101470         Rename it to "iterator_range".  I think it describes a bit better: it's
101471         a range made by wrapping a begin and end iterator.  Move it to its own
101472         file, since it's not related to next_iterator anymore.
101473
101474         iterator_range has two constructors.  The variadic one, where arguments
101475         are forwarded to construct the underlying begin iterator.  The end
101476         iterator is constructed through default construction.  This is a
101477         generalization of what we have today.
101478
101479         There is another constructor which receives already constructed begin
101480         and end iterators, useful if the end iterator can't be obtained by
101481         default-construction.  Or, if you wanted to make a range that does not
101482         end at the end of the container, you could pass any iterator as the
101483         "end".
101484
101485         This generalization allows removing some "range" classes, like
101486         all_inferiors_range.  These classes existed only to pass some arguments
101487         when constructing the begin iterator.  With iterator_range, those same
101488         arguments are passed to the iterator_range constructed and then
101489         forwarded to the constructed begin iterator.
101490
101491         There is a small functional difference in how iterator_range works
101492         compared to next_adapter.  next_adapter stored the pointer it received
101493         as argument and constructeur an iterator in the `begin` method.
101494         iterator_range constructs the begin iterator and stores it as a member.
101495         Its `begin` method returns a copy of that iterator.
101496
101497         With just iterator_range, uses of next_adapter<foo> would be replaced
101498         with:
101499
101500           using foo_iterator = next_iterator<foo>;
101501           using foo_range = iterator_range<foo_iterator>;
101502
101503         However, I added a `next_range` wrapper as a direct replacement for
101504         next_adapter<foo>.  IMO, next_range is a slightly better name than
101505         next_adapter.
101506
101507         The rest of the changes are applications of this new class.
101508
101509         gdbsupport/ChangeLog:
101510
101511                 * next-iterator.h (class next_adapter): Remove.
101512                 * iterator-range.h: New.
101513
101514         gdb/ChangeLog:
101515
101516                 * breakpoint.h (bp_locations_range): Remove.
101517                 (bp_location_range): New.
101518                 (struct breakpoint) <locations>: Adjust type.
101519                 (breakpoint_range): Use iterator_range.
101520                 (tracepoint_range): Use iterator_range.
101521                 * breakpoint.c (breakpoint::locations): Adjust return type.
101522                 * gdb_bfd.h (gdb_bfd_section_range): Use iterator_range.
101523                 * gdbthread.h (all_threads_safe): Pass argument to
101524                 all_threads_safe_range.
101525                 * inferior-iter.h (all_inferiors_range): Use iterator_range.
101526                 (all_inferiors_safe_range): Use iterator_range.
101527                 (all_non_exited_inferiors_range): Use iterator_range.
101528                 * inferior.h (all_inferiors, all_non_exited_inferiors): Pass
101529                 inferior_list as argument.
101530                 * objfiles.h (struct objfile) <compunits_range>: Remove.
101531                 <compunits>: Return compunit_symtab_range.
101532                 * progspace.h (unwrapping_objfile_iterator)
101533                 <unwrapping_objfile_iterator>: Take parameter by value.
101534                 (unwrapping_objfile_range): Use iterator_range.
101535                 (struct program_space) <objfiles_range>: Define with "using".
101536                 <objfiles>: Adjust.
101537                 <objfiles_safe_range>: Define with "using".
101538                 <objfiles_safe>: Adjust.
101539                 <solibs>: Return so_list_range, define here.
101540                 * progspace.c (program_space::solibs): Remove.
101541                 * psymtab.h (class psymtab_storage) <partial_symtab_iterator>:
101542                 New.
101543                 <partial_symtab_range>: Use iterator_range.
101544                 * solist.h (so_list_range): New.
101545                 * symtab.h (compunit_symtab_range):
101546                 New.
101547                 (symtab_range): New.
101548                 (compunit_filetabs): Change to a function.
101549                 * thread-iter.h (inf_threads_range,
101550                 inf_non_exited_threads_range, safe_inf_threads_range,
101551                 all_threads_safe_range): Use iterator_range.
101552                 * top.h (ui_range): New.
101553                 (all_uis): Use ui_range.
101554
101555         Change-Id: Ib7a9d2a3547f45f01aa1c6b24536ba159db9b854
101556
101557 2021-07-06  Simon Marchi  <simon.marchi@polymtl.ca>
101558
101559         gdb/testsuite: restore configure script
101560         Commit f99d1d37496f ("Remove gdb/testsuite/configure") removed
101561         gdb/testsuite/configure, as anything gdb/testsuite/configure did could
101562         be done by gdb/configure.
101563
101564         There is however one use case that popped up when this changed
101565         propagated to downstream consumers, to run the testsuite on an already
101566         built GDB.  In the workflow of ROCm-GDB at AMD, a GDB package is built
101567         in a CI job.  This GDB package is then tested on different machines /
101568         hardware configurations as part of other CI jobs.  To achieve this,
101569         those CI jobs only configure the testsuite directory and run "make
101570         check" with an appropriate board file.
101571
101572         In light of this use case, the way I see it is that gdb/testsuite could
101573         be considered its own project.  It could be stored in a completely
101574         different repo if we want to, it just happens to be stored inside gdb/.
101575
101576         Since the only downside of having gdb/testsuite/configure is that it
101577         takes a few more seconds to run, but on the other hand it's quite useful
101578         for some people, I propose re-adding it.
101579
101580         In a sense, this is revert of f99d1d37496f, but it's not a direct
101581         git-revert, as some things have changed since.
101582
101583         gdb/ChangeLog:
101584
101585                 * configure.ac: Remove things that were moved from
101586                 testsuite/configure.ac.
101587                 * configure: Re-generate.
101588
101589         gdb/testsuite/ChangeLog:
101590
101591                 * configure.ac: Restore.
101592                 * configure: Re-generate.
101593                 * aclocal.m4: Re-generate.
101594                 * Makefile.in (distclean): Add config.status.
101595                 (Makefile): Adjust paths.
101596                 (lib/pdtrace): Adjust paths.
101597                 (config.status): Add.
101598
101599         Change-Id: Ic38c79485e1835712d9c99649c9dfb59667254f1
101600
101601 2021-07-06  Joel Brobecker  <brobecker@adacore.com>
101602
101603         Rename gdb/ChangeLog to gdb/ChangeLog-2021
101604         Now that ChangeLog entries are no longer used for GDB patches,
101605         this commit renames the file gdb/ChangeLog to gdb/ChangeLog-2021,
101606         similar to what we would do in the context of the "Start of New
101607         Year" procedure.
101608
101609         The purpose of this change is to avoid people merging ChangeLog
101610         entries by mistake when applying existing commits that they are
101611         currently working on.
101612
101613 2021-07-06  Dan Streetman  <ddstreet@canonical.com>
101614
101615         sim: ppc: add missing empty targets
101616         These are copied from sim/common/Make-common.in.
101617
101618         On ppc the build fails without at least the 'info' target, e.g.:
101619
101620         Making info in ppc
101621         make[4]: Entering directory '/<<BUILDDIR>>/gdb-10.2.2974.g5b45e89f56d+21.10.20210510155809/build/default/sim/ppc'
101622         make[4]: *** No rule to make target 'info'.  Stop.
101623
101624 2021-07-06  Yuri Chornoivan  <yurchor@ukr.net>
101625
101626         PR 28053: Fix spelling mistakes: usupported -> unsupported and relocatation -> relocation.
101627
101628 2021-07-06  Michael Matz  <matz@suse.de>
101629
101630         elf/riscv: Fix relaxation with aliases [PR28021]
101631         the fix for PR22756 only changed behaviour for hidden aliases,
101632         but the same situation exists for non-hidden aliases: sym_hashes[]
101633         can contain multiple entries pointing to the same symbol structure
101634         leading to relaxation adjustment to be applied twice.
101635
101636         Fix this by testing for duplicates for everything that looks like it
101637         has a version.
101638
101639         PR ld/28021
101640
101641         bfd/
101642                 * elfnn-riscv.c (riscv_relax_delete_bytes): Check for any
101643                 versioning.
101644
101645         ld/
101646                 * testsuite/ld-riscv-elf/relax-twice.ver: New.
101647                 * testsuite/ld-riscv-elf/relax-twice-1.s: New.
101648                 * testsuite/ld-riscv-elf/relax-twice-2.s: New.
101649                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp
101650                 (run_relax_twice_test): New, and call it.
101651
101652 2021-07-06  Pedro Alves  <pedro@palves.net>
101653             Qingchuan Shi  <qingchuan.shi@amd.com>
101654
101655         Update gdb performance testsuite to be compatible with Python 3.8
101656         Running "make check-perf" on a system with Python 3.8 (e.g., Ubuntu
101657         20.04) runs into this Python problem:
101658
101659           Traceback (most recent call last):
101660             File "<string>", line 1, in <module>
101661             File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/perftest.py", line 65, in run
101662               self.execute_test()
101663             File "<string>", line 35, in execute_test
101664             File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/measure.py", line 45, in measure
101665               m.start(id)
101666             File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/measure.py", line 102, in start
101667               self.start_time = time.clock()
101668           AttributeError: module 'time' has no attribute 'clock'
101669           Error while executing Python code.
101670           (gdb) FAIL: gdb.perf/single-step.exp: python SingleStep(1000).run()
101671
101672         ... many times over.
101673
101674         The problem is that the testsuite is using time.clock(), deprecated in
101675         Python 3.3 and finaly removed in Python 3.8.  The guidelines say to
101676         use time.perf_counter() or time.process_time() instead depending on
101677         requirements.  Looking at the current description of those functions,
101678         at:
101679
101680            https://docs.python.org/3.10/library/time.html
101681
101682         we have:
101683
101684            time.perf_counter() -> float
101685
101686                Return the value (in fractional seconds) of a performance
101687                counter, i.e. a clock with the highest available resolution to
101688                measure a short duration. It does include time elapsed during
101689                sleep and is system-wide. (...)
101690
101691            time.process_time() -> float
101692
101693                Return the value (in fractional seconds) of the sum of the
101694                system and user CPU time of the current process. It does not
101695                include time elapsed during sleep. It is process-wide by
101696                definition. (...)
101697
101698         I'm thinking that it's just best to record both instead of picking
101699         one.  So this patch replaces the MeasurementCpuTime measurement class
101700         with two new classes -- MeasurementPerfCounter and
101701         MeasurementProcessTime.  Correspondingly, this changes the reports in
101702         testsuite/perftest.log -- we have two new "perf_counter" and
101703         "process_time" measurements and the "cpu_time" measurement is gone.  I
101704         don't suppose breaking backward compatibility here is a big problem.
101705         I suspect no one is really tracking long term performance using the
101706         perf testsuite today.  And if they are, it shouldn't be hard to adjust.
101707
101708         For backward compatility, with Python < 3.3, both perf_counter and
101709         process_time use the old time.clock.
101710
101711         gdb/testsuite/ChangeLog:
101712         yyyy-mm-dd  Qingchuan Shi  <qingchuan.shi@amd.com>
101713                     Pedro Alves  <pedro@palves.net>
101714
101715                 * gdb.perf/lib/perftest/perftest.py: Import sys.
101716                 (time.perf_counter, time.process_time): Map to time.clock on
101717                 Python < 3.3.
101718                 (MeasurementCpuTime): Delete, replaced by...
101719                 (MeasurementPerfCounter, MeasurementProcessTime): .. these two new
101720                 classes.
101721                 * gdb.perf/lib/perftest/perftest.py: Import MeasurementPerfCounter
101722                 and MeasurementProcessTime instead of MeasurementCpuTime.
101723                 (TestCaseWithBasicMeasurements): Use MeasurementPerfCounter and
101724                 MeasurementProcessTime instead of MeasurementCpuTime.
101725
101726
101727         Change-Id: Ia850c05d5ce57d2dada70ba5b0061f566444aa2b
101728
101729 2021-07-06  Pedro Alves  <pedro@palves.net>
101730
101731         gdb.perf/: FAIL on Python errors, avoid "ERROR: internal buffer is full"
101732         Currently, if you run make check-perf on a system with Python 3.8,
101733         tests seen to PASS, but they actually test a lot less than intended,
101734         due to:
101735
101736          PerfTest::assemble, run ...
101737          python BackTrace(64).run()
101738          Traceback (most recent call last):
101739            File "<string>", line 1, in <module>
101740            File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/perftest.py", line 65, in run
101741              self.execute_test()
101742            File "<string>", line 49, in execute_test
101743            File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/measure.py", line 45, in measure
101744              m.start(id)
101745            File "/home/pedro/rocm/gdb/src/gdb/testsuite/gdb.perf/lib/perftest/measure.py", line 102, in start
101746              self.start_time = time.clock()
101747          AttributeError: module 'time' has no attribute 'clock'
101748          Error while executing Python code.
101749          (gdb) PASS: gdb.perf/backtrace.exp: python BackTrace(64).run()
101750
101751         And then, after fixing the above Python compatibility issues (which
101752         will be a separate patch), I get 86 instances of overflowing expect's
101753         buffer, like:
101754
101755           ERROR: internal buffer is full.
101756           UNRESOLVED: gdb.perf/single-step.exp: python SingleStep(1000).run()
101757
101758         This patch fixes both problems by adding & using a gdb_test_python_run
101759         routine that:
101760
101761          - checks for Python errors
101762          - consumes output line by line
101763
101764         gdb/testsuite/ChangeLog:
101765         yyyy-mm-dd  Pedro Alves  <pedro@palves.net>
101766
101767                 * gdb.perf/backtrace.exp: Use gdb_test_python_run.
101768                 * gdb.perf/disassemble.exp: Use gdb_test_python_run.
101769                 * gdb.perf/single-step.exp: Use gdb_test_python_run.
101770                 * gdb.perf/skip-command.exp: Use gdb_test_python_run.
101771                 * gdb.perf/skip-prologue.exp: Use gdb_test_python_run.
101772                 * gdb.perf/solib.exp: Use gdb_test_python_run.
101773                 * gdb.perf/template-breakpoints.exp: Use gdb_test_python_run.
101774                 * lib/perftest.exp (gdb_test_python_run): New.
101775
101776         Change-Id: I007af36f164b3f4cda41033616eaaa4e268dfd2f
101777
101778 2021-07-06  Tom de Vries  <tdevries@suse.de>
101779
101780         [gdb/testsuite] Remove read1 timeout factor from gdb.base/info-macros.exp
101781         At the moment some check-read1 timeouts are handled like this in
101782         gdb.base/info-macros.exp:
101783         ...
101784         gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname {
101785           -re "$r1$r2$r3" {
101786              pass $testname
101787           }
101788           -re ".*#define TWO.*\r\n$gdb_prompt" {
101789              fail $testname
101790           }
101791           -re ".*#define THREE.*\r\n$gdb_prompt" {
101792              fail $testname
101793           }
101794           -re ".*#define FOUR.*\r\n$gdb_prompt" {
101795              fail $testname
101796           }
101797         }
101798         ...
101799         which is not ideal.
101800
101801         We could use gdb_test_lines, but it currently doesn't support verifying
101802         the absence of regexps, which is done using the clauses above calling fail.
101803
101804         Fix this by using gdb_test_lines and adding a -re-not syntax to
101805         gdb_test_lines, such that we can do:
101806         ...
101807         gdb_test_lines $test $testname $r1.*$r2 \
101808             -re-not "#define TWO" \
101809             -re-not "#define THREE" \
101810             -re-not "#define FOUR"
101811         ...
101812
101813         Tested on x86_64-linux, whith make targets check and check-read1.
101814
101815         Also observed that check-read1 execution time is reduced from 6m35s to 13s.
101816
101817         gdb/testsuite/ChangeLog:
101818
101819         2021-07-06  Tom de Vries  <tdevries@suse.de>
101820
101821                 * gdb.base/info-macros.exp: Replace use of
101822                 gdb_test_multiple_with_read1_timeout_factor with gdb_test_lines.
101823                 (gdb_test_multiple_with_read1_timeout_factor): Remove.
101824                 * lib/gdb.exp (gdb_test_lines): Add handling or -re-not <regexp>.
101825
101826 2021-07-06  Nelson Chu  <nelson.chu@sifive.com>
101827
101828         RISC-V: Fix the build broken with -Werror.
101829         ChangeLog:
101830
101831         bfd/
101832
101833                 * elfnn-riscv.c(riscv_elf_additional_program_headers): Removed the
101834                 unused variable s.
101835                 (riscv_elf_modify_segment_map): Added ATTRIBUTE_UNUSED for the
101836                 unused parameter info.
101837
101838 2021-07-06  Tom de Vries  <tdevries@suse.de>
101839
101840         [gdb/symtab] Fix skipping of import of C++ CU
101841         Tom Tromey observed that when changing the language in
101842         gdb.dwarf2/imported-unit-bp.exp from c to c++, the test failed.
101843
101844         This is due to this code in process_imported_unit_die:
101845         ...
101846               /* We're importing a C++ compilation unit with tag DW_TAG_compile_unit
101847                  into another compilation unit, at root level.  Regard this as a hint,
101848                  and ignore it.  */
101849               if (die->parent && die->parent->parent == NULL
101850                   && per_cu->unit_type == DW_UT_compile
101851                   && per_cu->lang == language_cplus)
101852                 return;
101853         ...
101854         which should have a partial symtabs counterpart.
101855
101856         Add the missing counterpart in process_psymtab_comp_unit.
101857
101858         Tested on x86_64-linux (openSUSE Leap 15.2), no regressions for config:
101859         - using default gcc version 7.5.0
101860           (with 5 unexpected FAILs)
101861         - gcc 10.3.0 and target board
101862           unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects
101863           (with 1000 unexpected FAILs)
101864
101865         gdb/ChangeLog:
101866
101867         2021-07-06  Tom de Vries  <tdevries@suse.de>
101868
101869                 * dwarf2/read.c (scan_partial_symbols): Skip top-level imports of
101870                 c++ CU.
101871                 * testsuite/gdb.dwarf2/imported-unit-bp.exp: Moved to ...
101872                 * testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl: ... here.
101873                 * testsuite/gdb.dwarf2/imported-unit-bp-c++.exp: New test.
101874                 * testsuite/gdb.dwarf2/imported-unit-bp-c.exp: New test.
101875                 * testsuite/gdb.dwarf2/imported-unit.exp: Update.
101876
101877 2021-07-06  Kito Cheng  <kito.cheng@sifive.com>
101878
101879         RISC-V: Add PT_RISCV_ATTRIBUTES and add it to PHDR.
101880         We added PT_RISCV_ATTRIBUTES to program header to make
101881         .riscv.attribute easier to find in dynamic loader or kernel.
101882
101883         Ref:
101884         https://github.com/riscv/riscv-elf-psabi-doc/pull/71
101885
101886         ChangeLog:
101887
101888         bfd/
101889
101890                 * elfnn-riscv.c(RISCV_ATTRIBUTES_SECTION_NAME): New.
101891                 (riscv_elf_additional_program_headers): Ditto.
101892                 (riscv_elf_modify_segment_map): Ditto.
101893                 (elf_backend_additional_program_headers): Ditto.
101894                 (elf_backend_modify_segment_map): Ditto.
101895                 (elf_backend_obj_attrs_section): Use RISCV_ATTRIBUTES_SECTION_NAME
101896                 rather than string literal.
101897
101898         binutils/
101899
101900                 * readelf.c(get_riscv_segment_type): New.
101901                 (get_segment_type): Handle EM_RISCV.
101902
101903         include/
101904
101905                 * elf/riscv.h (PT_RISCV_ATTRIBUTES): New.
101906                 * testsuite/ld-elf/orphan-region.ld: Discard .riscv.attributes
101907                 section for simplify testcase.
101908                 * testsuite/ld-riscv-elf/attr-phdr.d: New.
101909                 * testsuite/ld-riscv-elf/attr-phdr.s: Ditto.
101910                 * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Add attr-phdr to
101911                 testcase.
101912
101913 2021-07-06  Alan Modra  <amodra@gmail.com>
101914
101915         Re: PR28055, segfault in bpf special reloc function
101916                 PR 28055
101917                 * elf64-bpf.c (bpf_elf_generic_reloc): Add missing ATTRIBUTE_UNUSED.
101918
101919 2021-07-06  GDB Administrator  <gdbadmin@sourceware.org>
101920
101921         Automatic date update in version.in
101922
101923 2021-07-05  Tom Tromey  <tom@tromey.com>
101924
101925         Simplify debug_names index writing
101926         This changes the .debug_names writer to find the TU indices in the
101927         main loop over all CUs and TUs.  (An earlier patch applied this same
101928         treatment to the .gdb_index writer.)
101929
101930         Simplify gdb_index writing
101931         write_gdbindex writes the CUs first, then walks the signatured type
101932         hash table to write out the TUs.  However, now that CUs and TUs are
101933         unified in the DWARF reader, it's simpler to handle both of these in
101934         the same loop.
101935
101936         Minor cleanup to addrmap_index_data::previous_valid
101937         This changes addrmap_index_data::previous_valid to a bool, and
101938         initializes it inline.
101939
101940 2021-07-05  Tom Tromey  <tom@tromey.com>
101941
101942         Fix oddity in write_gdbindex
101943         My recent patch to unify CUs and TUs introduced an oddity in
101944         write_gdbindex.  Here, we pass 'i' to recursively_write_psymbols, but
101945         we must instead pass 'counter', to handle the situation where a TU is
101946         mixed in with the CUs.
101947
101948         I am not sure a test case for this is possible.  I think it can only
101949         happen when using DWARF 5, where a TU appears in .debug_info.
101950         However, this situation is already not handled correctly by
101951         .gdb_index.  I filed a bug about this.
101952
101953 2021-07-05  Tom Tromey  <tom@tromey.com>
101954
101955         Fix warning in symtab.c
101956         The compiler gives this warning when building symtab.c:
101957
101958         ../../binutils-gdb/gdb/symtab.c:4247:28: warning: 'to_match' may be used uninitialized in this function [-Wmaybe-uninitialized]
101959
101960         This patch fixes the warning by adding a gdb_assert_not_reached.
101961
101962 2021-07-05  H.J. Lu  <hjl.tools@gmail.com>
101963
101964         ld: Cache and reuse the IR archive file descriptor
101965         Linker plugin_object_p opens the IR archive for each IR archive member.
101966         For GCC plugin, plugin_object_p closes the archive file descriptor.  But
101967         for LLVM plugin, the archive file descriptor remains open.  If there are
101968         3000 IR archive members, there are 3000 file descriptors for them.  We
101969         can run out of file descriptors petty easily.
101970
101971         1. Add archive_plugin_fd and archive_plugin_fd_open_count to bfd so that
101972         we can cache and reuse the IR archive file descriptor for all IR archive
101973         members in the archive.
101974         2. Add bfd_plugin_close_file_descriptor to properly close the IR archive
101975         file descriptor.
101976
101977         bfd/
101978
101979                 PR ld/28040
101980                 * archive.c (_bfd_archive_close_and_cleanup): Close the archive
101981                 plugin file descriptor if needed.
101982                 * bfd.c (bfd): Add archive_plugin_fd and
101983                 archive_plugin_fd_open_count.
101984                 * opncls.c (_bfd_new_bfd): Initialize to -1.
101985                 * plugin.c (bfd_plugin_open_input): Cache and reuse the archive
101986                 plugin file descriptor.
101987                 (bfd_plugin_close_file_descriptor): New function.
101988                 (try_claim): Call bfd_plugin_close_file_descriptor.
101989                 * plugin.h (bfd_plugin_close_file_descriptor): New.
101990                 * bfd-in2.h: Regenerated.
101991
101992         ld/
101993
101994                 PR ld/28040
101995                 * plugin.c (plugin_input_file): Add ibfd.
101996                 (release_plugin_file_descriptor): New function.
101997                 (release_input_file): Call release_plugin_file_descriptor to
101998                 close input->fd.
101999                 (plugin_object_p): Call release_plugin_file_descriptor to close
102000                 input->fd.  Also call release_plugin_file_descriptor if not
102001                 claimed.
102002                 * testsuite/config/default.exp (RANLIB): New.
102003                 * testsuite/ld-plugin/lto.exp: Run ranlib test.
102004
102005 2021-07-05  Nick Clifton  <nickc@redhat.com>
102006
102007         Restore the libiberty component of commit 50ad1254d5030d0804cbf89c758359ae202e8d55.
102008         This commit has not yet been applied to the master sources in the gcc repository.
102009         It was submitted here: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574405.html
102010         The commit allows options to be set for the AR and RANLIB programs used when building libiberty, which in turn allows building with LTO enabled.
102011
102012         Updated translations (mainly Ukranian and French) triggered by creation of 2.37 branch.
102013
102014 2021-07-05  Tom de Vries  <tdevries@suse.de>
102015
102016         [gdb/testsuite] Fix fail in gdb.fortran/ptype-on-functions.exp with gcc-7
102017         Since commit 05b85772061 "gdb/fortran: Add type info of formal parameter for
102018         clang" I see:
102019         ...
102020         (gdb) ptype say_string^M
102021         type = void (character*(*), integer(kind=4))^M
102022         (gdb) FAIL: gdb.fortran/ptype-on-functions.exp: ptype say_string
102023         ...
102024
102025         The part of the commit causing the fail is:
102026         ...
102027          gdb_test "ptype say_string" \
102028         -    "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)"
102029         +    "type = void \\(character\[^,\]+, $integer8\\)"
102030         ...
102031         which fails to take into account that for gcc-7 and before, the type for
102032         string length of a string argument is int, not size_t.
102033
102034         Fix this by allowing both $integer8 and $integer4.
102035
102036         Tested on x86_64-linux, with gcc-7 and gcc-10.
102037
102038         gdb/testsuite/ChangeLog:
102039
102040         2021-07-05  Tom de Vries  <tdevries@suse.de>
102041
102042                 * gdb.fortran/ptype-on-functions.exp: Allow both $integer8 and
102043                 $integer4 for size of string length.
102044
102045 2021-07-05  Simon Marchi  <simon.marchi@polymtl.ca>
102046
102047         gdb: fall back on sigpending + sigwait if sigtimedwait is not available
102048         The macOS platform does not provide sigtimedwait, so we get:
102049
102050               CXX    compile/compile.o
102051             In file included from /Users/smarchi/src/binutils-gdb/gdb/compile/compile.c:46:
102052             /Users/smarchi/src/binutils-gdb/gdb/../gdbsupport/scoped_ignore_signal.h:69:4: error: use of undeclared identifier 'sigtimedwait'
102053                       sigtimedwait (&set, nullptr, &zero_timeout);
102054                       ^
102055
102056         An alternative to sigtimedwait with a timeout of 0 is to use sigpending,
102057         to first check which signals are pending, and then sigwait, to consume
102058         them.  Since that's slightly more expensive (2 syscalls instead of 1),
102059         keep using sigtimedwait for the platforms that provide it, and fall back
102060         to sigpending + sigwait for the others.
102061
102062         gdbsupport/ChangeLog:
102063
102064                 * scoped_ignore_signal.h (struct scoped_ignore_signal)
102065                 <~scoped_ignore_signal>: Use sigtimedwait if HAVE_SIGTIMEDWAIT
102066                 is defined, else use sigpending + sigwait.
102067
102068         Change-Id: I2a72798337e81dd1bbd21214736a139dd350af87
102069         Co-Authored-By: John Baldwin <jhb@FreeBSD.org>
102070
102071 2021-07-05  Simon Marchi  <simon.marchi@polymtl.ca>
102072
102073         gdbsupport/common.m4: check for sigtimedwait
102074         The next patch will make the use of sigtimedwait conditional to whether
102075         the platform provides it.  Start by adding a configure check for it.
102076
102077         gdbsupport/ChangeLog:
102078
102079                 * common.m4 (GDB_AC_COMMON): Check for sigtimedwait.
102080                 * config.in, configure: Re-generate.
102081
102082         gdb/ChangeLog:
102083
102084                 * config.in, configure: Re-generate.
102085
102086         gdbserver/ChangeLog:
102087
102088                 * config.in, configure: Re-generate.
102089
102090         Change-Id: Ic7613fe14521b966b4d991bbcd0933ab14629c05
102091
102092 2021-07-05  Alan Modra  <amodra@gmail.com>
102093
102094         Re: opcodes: constify & local meps macros
102095         Commit f375d32b35ce changed a generated file.  Edit the source instead.
102096
102097                 * mep.opc (macros): Make static and const.
102098                 (lookup_macro): Return and use const pointer.
102099                 (expand_macro): Make mac param const.
102100                 (expand_string): Make pmacro const.
102101
102102 2021-07-05  Alan Modra  <amodra@gmail.com>
102103
102104         PR28055, segfault in bpf special reloc function
102105         The testcase in this PR tickled two bugs fixed here.  output_bfd is
102106         NULL when a reloc special_function is called for final linking and
102107         when called from bfd_generic_get_relocated_section_contents.  Clearly
102108         using output_bfd is wrong as it results in segfaults.  Not only that,
102109         the endianness of the reloc field really should be that of the input.
102110         The second bug was not checking that the entire reloc field was
102111         contained in the section contents.
102112
102113                 PR 28055
102114                 * elf64-bpf.c (bpf_elf_generic_reloc): Use correct bfd for bfd_put
102115                 and bfd_put_32 calls.  Correct section limit checks.
102116
102117 2021-07-05  Alan Modra  <amodra@gmail.com>
102118
102119         PR28047, readelf crash due to assertion failure
102120         DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref1, and
102121         DW_FORM_ref_udata are all supposed to be within the containing unit.
102122
102123                 PR 28047
102124                 * dwarf.c (get_type_abbrev_from_form): Add cu_end parameter.
102125                 Check DW_FORM_ref1 etc. arg against cu_end rather than end of
102126                 section.  Adjust all callers.
102127
102128 2021-07-05  GDB Administrator  <gdbadmin@sourceware.org>
102129
102130         Automatic date update in version.in
102131
102132 2021-07-04  Simon Marchi  <simon.marchi@polymtl.ca>
102133
102134         gdb: return early if no execution in darwin_solib_create_inferior_hook
102135         When loading a file using the file command on macOS, we get:
102136
102137             $ ./gdb -nx --data-directory=data-directory -q -ex "file ./test"
102138             Reading symbols from ./test...
102139             Reading symbols from /Users/smarchi/build/binutils-gdb/gdb/test.dSYM/Contents/Resources/DWARF/test...
102140             /Users/smarchi/src/binutils-gdb/gdb/thread.c:72: internal-error: struct thread_info *inferior_thread(): Assertion `current_thread_ != nullptr' failed.
102141             A problem internal to GDB has been detected,
102142             further debugging may prove unreliable.
102143             Quit this debugging session? (y or n)
102144
102145         The backtrace is:
102146
102147             * frame #0: 0x0000000101fcb826 gdb`internal_error(file="/Users/smarchi/src/binutils-gdb/gdb/thread.c", line=72, fmt="%s: Assertion `%s' failed.") at errors.cc:52:3
102148               frame #1: 0x00000001018a2584 gdb`inferior_thread() at thread.c:72:3
102149               frame #2: 0x0000000101469c09 gdb`get_current_regcache() at regcache.c:421:31
102150               frame #3: 0x00000001015f9812 gdb`darwin_solib_get_all_image_info_addr_at_init(info=0x0000603000006d00) at solib-darwin.c:464:34
102151               frame #4: 0x00000001015f7a04 gdb`darwin_solib_create_inferior_hook(from_tty=1) at solib-darwin.c:515:5
102152               frame #5: 0x000000010161205e gdb`solib_create_inferior_hook(from_tty=1) at solib.c:1200:3
102153               frame #6: 0x00000001016d8f76 gdb`symbol_file_command(args="./test", from_tty=1) at symfile.c:1650:7
102154               frame #7: 0x0000000100abab17 gdb`file_command(arg="./test", from_tty=1) at exec.c:555:3
102155               frame #8: 0x00000001004dc799 gdb`do_const_cfunc(c=0x000061100000c340, args="./test", from_tty=1) at cli-decode.c:102:3
102156               frame #9: 0x00000001004ea042 gdb`cmd_func(cmd=0x000061100000c340, args="./test", from_tty=1) at cli-decode.c:2160:7
102157               frame #10: 0x00000001018d4f59 gdb`execute_command(p="t", from_tty=1) at top.c:674:2
102158               frame #11: 0x0000000100eee430 gdb`catch_command_errors(command=(gdb`execute_command(char const*, int) at top.c:561), arg="file ./test", from_tty=1, do_bp_actions=true)(char const*, int), char const*, int, bool) at main.c:523:7
102159               frame #12: 0x0000000100eee902 gdb`execute_cmdargs(cmdarg_vec=0x00007ffeefbfeba0 size=1, file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND, ret=0x00007ffeefbfec20) at main.c:618:9
102160               frame #13: 0x0000000100eed3a4 gdb`captured_main_1(context=0x00007ffeefbff780) at main.c:1322:3
102161               frame #14: 0x0000000100ee810d gdb`captured_main(data=0x00007ffeefbff780) at main.c:1343:3
102162               frame #15: 0x0000000100ee8025 gdb`gdb_main(args=0x00007ffeefbff780) at main.c:1368:7
102163               frame #16: 0x00000001000044f1 gdb`main(argc=6, argv=0x00007ffeefbff8a0) at gdb.c:32:10
102164               frame #17: 0x00007fff20558f5d libdyld.dylib`start + 1
102165
102166         The solib_create_inferior_hook call in symbol_file_command was added by
102167         commit ea142fbfc9c1 ("Fix breakpoints on file reloads for PIE
102168         binaries").  It causes solib_create_inferior_hook to be called while
102169         the inferior is not running, which darwin_solib_create_inferior_hook
102170         does not expect.  darwin_solib_get_all_image_info_addr_at_init, in
102171         particular, assumes that there is a current thread, as it tries to get
102172         the current thread's regcache.
102173
102174         Fix it by adding a target_has_execution check and returning early.  Note
102175         that there is a similar check in svr4_solib_create_inferior_hook.
102176
102177         gdb/ChangeLog:
102178
102179                 * solib-darwin.c (darwin_solib_create_inferior_hook): Return
102180                 early if no execution.
102181
102182         Change-Id: Ia11dd983a1e29786e5ce663d0fcaa6846dc611bb
102183
102184 2021-07-04  GDB Administrator  <gdbadmin@sourceware.org>
102185
102186         Automatic date update in version.in
102187
102188 2021-07-03  H.J. Lu  <hjl.tools@gmail.com>
102189
102190         gprof: Regenerate configure
102191                 * configure: Regenerated.
102192
102193 2021-07-03  Joel Brobecker  <brobecker@adacore.com>
102194
102195         Update NEWS post GDB 11 branch creation.
102196         gdb/ChangeLog:
102197
102198                 * NEWS: Create a new section for the next release branch.
102199                 Rename the section of the current branch, now that it has
102200                 been cut.
102201
102202 2021-07-03  Joel Brobecker  <brobecker@adacore.com>
102203
102204         Bump version to 12.0.50.DATE-git.
102205         Now that the GDB 11 branch has been created, we can
102206         bump the version number.
102207
102208         gdb/ChangeLog:
102209
102210                 GDB 11 branch created (4b51505e33441c6165e7789fa2b6d21930242927):
102211                 * version.in: Bump version to 12.0.50.DATE-git.
102212
102213         gdb/testsuite/ChangeLog:
102214
102215                 * gdb.base/default.exp: Change $_gdb_major to 12.
102216
102217 2021-07-03  Tom Tromey  <tom@tromey.com>
102218
102219         Use 'bool' more idiomatically in dwarf_decode_lines
102220         I noticed a couple of spots related to dwarf_decode_lines where the
102221         'include_p' field was not being used idiomatically -- it is of type
102222         bool now, so treat it as such.
102223
102224         gdb/ChangeLog
102225         2021-07-03  Tom Tromey  <tom@tromey.com>
102226
102227                 * dwarf2/read.c (lnp_state_machine::record_line): Use 'true'.
102228                 (dwarf_decode_lines): Remove '=='.
102229
102230 2021-07-03  Nick Clifton  <nickc@redhat.com>
102231
102232         More minor updates to the how-to-make-a-release documentation
102233
102234         Update version number and regenerate files
102235
102236         Add markers for 2.37 branch