Andrew Burgess [Wed, 6 Nov 2019 10:17:05 +0000 (10:17 +0000)]
gdb: Don't reorder line table entries too much when sorting.
Don't reorder line table entries for the same address when sorting the
line table, maintain the compiler given line order. Usually this will
reflect the order in which lines are conceptually encountered at a
given address.
Consider this example:
/* 1 */ volatile int global_var;
/* 2 */ int __attribute__ ((noinline))
/* 3 */ bar ()
/* 4 */ {
/* 5 */ return global_var;
/* 6 */ }
/* 7 */ static inline int __attribute__ ((always_inline))
/* 8 */ foo ()
/* 9 */ {
/* 10 */ return bar ();
/* 11 */ }
/* 12 */ int
/* 13 */ main ()
/* 14 */ {
/* 15 */ global_var = 0;
/* 16 */ return foo ();
/* 17 */ }
GCC 10 currently generates a line table like this (as shown by
objdump):
CU: ./test.c:
File name Line number Starting address
test.c 4 0x4004b0
test.c 5 0x4004b0
test.c 6 0x4004b6
test.c 6 0x4004b7
test.c 14 0x4003b0
test.c 15 0x4003b0
test.c 16 0x4003ba
test.c 10 0x4003ba
test.c 10 0x4003c1
The interesting entries are those for lines 16 and 10 at address
0x4003ba, these represent the call to foo and the inlined body of
foo.
With the current line table sorting GDB builds the line table like
this (as shown by 'maintenance info line-table'):
INDEX LINE ADDRESS
0 14 0x00000000004003b0
1 15 0x00000000004003b0
2 10 0x00000000004003ba
3 16 0x00000000004003ba
4 END 0x00000000004003c1
5 4 0x00000000004004b0
6 5 0x00000000004004b0
7 END 0x00000000004004b7
Notice that entries 2 and 3 for lines 10 and 16 are now in a different
order to the line table as given by the compiler. With this patch
applied the order is now:
INDEX LINE ADDRESS
0 14 0x00000000004003b0
1 15 0x00000000004003b0
2 16 0x00000000004003ba
3 10 0x00000000004003ba
4 END 0x00000000004003c1
5 4 0x00000000004004b0
6 5 0x00000000004004b0
7 END 0x00000000004004b7
Notice that entries 2 and 3 are now in their original order again.
The consequence of the incorrect ordering is that when stepping
through inlined functions GDB will display the wrong line for the
inner most frame. Here's a GDB session before this patch is applied:
Starting program: /home/andrew/tmp/inline/test
Temporary breakpoint 1, main () at test.c:15
15 /* 15 */ global_var = 0;
(gdb) step
16 /* 16 */ return foo ();
(gdb) step
foo () at test.c:16
16 /* 16 */ return foo ();
(gdb) step
bar () at test.c:5
5 /* 5 */ return global_var;
The step from line 15 to 16 was fine, but the next step should have
taken us to line 10, instead we are left at line 16. The final step
to line 5 is as expected.
With this patch applied the session goes better:
Starting program: /home/andrew/tmp/inline/test
Temporary breakpoint 1, main () at test.c:15
15 /* 15 */ global_var = 0;
(gdb) step
16 /* 16 */ return foo ();
(gdb) step
foo () at test.c:10
10 /* 10 */ return bar ();
(gdb) step
bar () at test.c:5
5 /* 5 */ return global_var;
We now visit the lines as 15, 16, 10, 5 as we would like.
The reason for this issue is that the inline frame unwinder is
detecting that foo is inlined in main. When we stop at the shared
address 0x4003ba the inline frame unwinder first shows us the outer
frame, this information is extracted from the DWARF's
DW_TAG_inlined_subroutine entries and passed via GDB's block data.
When we step again the inlined frame unwinder moves us up the call
stack to the inner most frame at which point the frame is displayed as
normal, with the location for the address being looked up in the line
table.
As GDB uses the last line table entry for an address as "the" line to
report for that address it is critical that GDB maintain the order of
the line table entries. In the first case, by reordering the line
table we report the wrong location.
I had to make a small adjustment in find_pc_sect_line in order to
correctly find the previous line in the line table. In some line
tables I was seeing an actual line entry and an end of sequence marker
at the same address, before this commit these would reorder to move
the end of sequence marker before the line entry (end of sequence has
line number 0). Now the end of sequence marker remains in its correct
location, and in order to find a previous line we should step backward
over any end of sequence markers.
As an example, the binary:
gdb/testsuite/outputs/gdb.dwarf2/dw2-ranges-func/dw2-ranges-func-lo-cold
Has this line table before the patch:
INDEX LINE ADDRESS
0 48 0x0000000000400487
1 END 0x000000000040048e
2 52 0x000000000040048e
3 54 0x0000000000400492
4 56 0x0000000000400497
5 END 0x000000000040049a
6 62 0x000000000040049a
7 END 0x00000000004004a1
8 66 0x00000000004004a1
9 68 0x00000000004004a5
10 70 0x00000000004004aa
11 72 0x00000000004004b9
12 END 0x00000000004004bc
13 76 0x00000000004004bc
14 78 0x00000000004004c0
15 80 0x00000000004004c5
16 END 0x00000000004004cc
And after this patch:
INDEX LINE ADDRESS
0 48 0x0000000000400487
1 52 0x000000000040048e
2 END 0x000000000040048e
3 54 0x0000000000400492
4 56 0x0000000000400497
5 END 0x000000000040049a
6 62 0x000000000040049a
7 66 0x00000000004004a1
8 END 0x00000000004004a1
9 68 0x00000000004004a5
10 70 0x00000000004004aa
11 72 0x00000000004004b9
12 END 0x00000000004004bc
13 76 0x00000000004004bc
14 78 0x00000000004004c0
15 80 0x00000000004004c5
16 END 0x00000000004004cc
When calling find_pc_sect_line with the address 0x000000000040048e, in
both cases we find entry #3, we then try to find the previous entry,
which originally found this entry '2 52 0x000000000040048e',
after the patch it finds '2 END 0x000000000040048e', which
cases the lookup to fail.
By skipping the END marker after this patch we get back to the correct
entry, which is now #1: '1 52 0x000000000040048e', and
everything works again.
gdb/ChangeLog:
* buildsym.c (lte_is_less_than): Delete.
(buildsym_compunit::end_symtab_with_blockvector): Create local
lambda function to sort line table entries, and use
std::stable_sort instead of std::sort.
* symtab.c (find_pc_sect_line): Skip backward over end of sequence
markers when looking for a previous line.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-inline-stepping.c: New file.
* gdb.dwarf2/dw2-inline-stepping.exp: New file.
Change-Id: Ia0309494be4cfd9dcc554f30209477f5f040b21b
Andrew Burgess [Tue, 5 Nov 2019 16:00:26 +0000 (16:00 +0000)]
gdb: Include end of sequence markers in the line table
In this commit:
commit
d9b3de22f33e400f7f409cce3acf6c7dab07dd79
Date: Wed May 27 14:44:29 2015 -0700
Add struct to record dwarf line number state machine.
I believe an unintended change was made to how we store the DWARF line
table, the end of sequence markers between sequences of lines were
lost from the line table.
This commit fixes this small oversight and restores the end of
sequence markers.
Given that we've survived this long without noticing is clearly an
indication that this isn't that serious, however, a later patch that I
am developing would benefit from having the markers in place, so I'd
like to restore them.
Having the markers also means that the output of 'maintenance info
line-table' now more closely reflects the DWARF line table.
I've taken this opportunity to improve how 'maintenance info
line-table' displays the end of sequence markers - it now uses the END
keyword, rather than just printing an entry with line number 0. So we
see this:
INDEX LINE ADDRESS
0 12 0x00000000004003b0
1 17 0x00000000004003b0
2 18 0x00000000004003b0
3 END 0x00000000004003b7
4 5 0x00000000004004a0
5 6 0x00000000004004a0
6 END 0x00000000004004a7
Instead of what we would have seen, which was this:
INDEX LINE ADDRESS
0 12 0x00000000004003b0
1 17 0x00000000004003b0
2 18 0x00000000004003b0
3 0 0x00000000004003b7
4 5 0x00000000004004a0
5 6 0x00000000004004a0
6 0 0x00000000004004a7
I've added a small test that uses 'maintenance info line-table' to
ensure that we don't regress this again.
gdb/ChangeLog:
* dwarf2read.c (lnp_state_machine::record_line): Include
end_sequence parameter in debug print out. Record the line if we
are at an end_sequence marker even if it's not the start of a
statement.
* symmisc.c (maintenance_print_one_line_table): Print end of
sequence markers with 'END' not '0'.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Update line table parsing test.
* gdb.dwarf2/dw2-ranges-base.exp: Add new line table parsing test.
Change-Id: I002f872248db82a1d4fefdc6b51ff5dbf932d8a8
Jim Wilson [Fri, 24 Jan 2020 22:24:09 +0000 (14:24 -0800)]
RISC-V: Minor cleanup for s extension support.
Looking at older versions of the patch, I confirmed that the odd comment
I referred to earlier was indeed from the removal of the sx support. It
also explains an oddly formatted switch statement. This patch fixes both
minor problems.
bfd/
* elfxx-riscv.c (riscv_get_prefix_class): Format s case like others.
(riscv_parse_prefixed_ext): Fix s extension comment and reword to
avoid over long line.
Change-Id: I1cb62e4a16188270f029b6376e4b1684000d6c7a
Pedro Alves [Fri, 24 Jan 2020 18:46:20 +0000 (18:46 +0000)]
Fix re-runs of a second inferior (PR gdb/25410)
This fixes a latent bug exposed by the multi-target patch (
5b6d1e4fa
"Multi-target support), and then fixes two other latent bugs exposed
by fixing that first latent bug.
The symptom described in the bug report is that starting a first
inferior, then trying to run a second (multi-threaded) inferior twice,
causes libthread_db to fail to load, along with other erratic
behavior:
(gdb) run
Starting program: /tmp/foo
warning: td_ta_new failed: generic error
Going a bit deeply, I found that if the two inferiors have different
symbols, we can see that just after inferior 2 exits, we are left with
inferior 2 selected, which is correct, but the symbols in scope belong
to inferior 1, which is obviously incorrect...
This problem is that there's a path in
scoped_restore_current_thread::restore() that switches to no thread
selected, and switches the current inferior, but leaves the current
program space as is, resulting in leaving the program space pointing
to the wrong program space (the one of the other inferior). This was
happening after handling TARGET_WAITKIND_NO_RESUMED, which is an event
that triggers after TARGET_WAITKIND_EXITED for the previous inferior
exit. Subsequent symbol lookups find the symbols of the wrong
inferior.
The fix is to use switch_to_inferior_no_thread in that problem spot.
This function was recently added along with the multi-target work
exactly for these situations.
As for testing, this patch adds a new testcase that tests symbol
printing just after inferior exit, which exercises the root cause of
the problem more directly. And then, to cover the use case described
in the bug too, it also exercises the lithread_db.so mis-loading, by
using TLS printing as a proxy for being sure that threaded debugging
was activated sucessfully. The testcase fails without the fix like
this, for the "print symbol just after exit" bits:
...
[Inferior 1 (process 8719) exited normally]
(gdb) PASS: gdb.multi/multi-re-run.exp: re_run_inf=1: iter=1: continue until exit
print re_run_var_1
No symbol "re_run_var_1" in current context.
(gdb) FAIL: gdb.multi/multi-re-run.exp: re_run_inf=1: iter=1: print re_run_var_1
...
And like this for the "libthread_db.so loading" bits:
(gdb) run
Starting program: /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.multi/multi-re-run/multi-re-run
warning: td_ta_new failed: generic error
[New LWP 27001]
Thread 1.1 "multi-re-run" hit Breakpoint 3, all_started () at /home/pedro/gdb/binutils-gdb/build/../src/gdb/testsuite/gdb.multi/multi-re-run.c:44
44 }
(gdb) PASS: gdb.multi/multi-re-run.exp: re_run_inf=1: iter=2: running to all_started in runto
print tls_var
Cannot find thread-local storage for LWP 27000, executable file /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.multi/multi-re-run/multi-re-run:
Cannot find thread-local variables on this target
(gdb) FAIL: gdb.multi/multi-re-run.exp: re_run_inf=1: iter=2: print tls_var
As mentioned, that fix above goes on to expose a couple other latent
bugs. This commit fixes those as well.
The first latent bug exposed is in
infrun.c:handle_vfork_child_exec_or_exit. The current code is leaving
inf->pspace == NULL while calling clone_program_space. The idea was
to make it so that the breakpoints module doesn't use this inferior's
pspace to set breakpoints. With that, any
scoped_restore_current_thread use from within clone_program_space
tries to restore a NULL program space, which hits an assertion:
Attaching after Thread 0x7ffff74b8700 (LWP 27276) vfork to child process 27277]
[New inferior 2 (process 27277)]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
/home/pedro/gdb/binutils-gdb/build/../src/gdb/progspace.c:243: internal-error: void set_current_program_space(program_space*): Assertion `pspace != NULL' faile
d.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.threads/vfork-follow-child-exit.exp: detach-on-fork=off: continue (GDB internal error)
That NULL pspace idea was legitimate, but it's no longer necessary,
since commit
b2e586e850db ("Defer breakpoint reset when cloning
progspace for fork child"). So the fix is to just set the inferior's
program space earlier.
The other latent bug exposed is in exec.c. When exec_close is called
from the program_space destructor, it is purposedly called with a
current program space that is not the current inferior's program
space. The problem is that the multi-target work added some code to
remove_target_sections that loops over all inferiors, and uses
scoped_restore_current_thread to save/restore the previous
thread/inferior/frame state. This makes it so that exec_close returns
with the current program space set to the current inferior's program
space, which is exactly what we did not want. Then the program_space
destructor continues into free_all_objfiles, but it is now running
that method on the wrong program space, resulting in:
Reading symbols from /home/pedro/gdb/binutils-gdb/build/gdb/testsuite/outputs/gdb.threads/fork-plus-threads/fork-plus-threads...
Reading symbols from /usr/lib/debug/usr/lib64/libpthread-2.26.so.debug...
Reading symbols from /usr/lib/debug/usr/lib64/libm-2.26.so.debug...
Reading symbols from /usr/lib/debug/usr/lib64/libc-2.26.so.debug...
Reading symbols from /usr/lib/debug/usr/lib64/ld-2.26.so.debug...
[Inferior 3 (process 9583) exited normally]
/home/pedro/gdb/binutils-gdb/build/../src/gdb/progspace.c:170: internal-error: void program_space::free_all_objfiles(): Assertion `so->objfile == NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited (GDB internal error)
The fix is to use scoped_restore_current_pspace_and_thread instead of
scoped_restore_current_thread.
gdb/ChangeLog:
2020-01-24 Pedro Alves <palves@redhat.com>
PR gdb/25410
* thread.c (scoped_restore_current_thread::restore): Use
switch_to_inferior_no_thread.
* exec.c: Include "progspace-and-thread.h".
(add_target_sections, remove_target_sections):
scoped_restore_current_pspace_and_thread instead of
scoped_restore_current_thread.
* infrun.c (handle_vfork_child_exec_or_exit): Assign the pspace
and aspace to the inferior before calling clone_program_space.
Remove stale comment.
gdb/testsuite/ChangeLog:
2020-01-24 Pedro Alves <palves@redhat.com>
PR gdb/25410
* gdb.multi/multi-re-run-1.c: New.
* gdb.multi/multi-re-run-2.c: New.
* gdb.multi/multi-re-run.exp: New.
Hannes Domani [Fri, 24 Jan 2020 14:03:14 +0000 (15:03 +0100)]
Add install-strip target to gdbserver
So far this was only possible indirectly when invoked from the gdb directory.
This makes the install-strip target independent from gdb.
2020-01-24 Hannes Domani <ssbssa@yahoo.de>
* Makefile.in (install-strip): New target.
(install_sh, INSTALL_STRIP_PROGRAM, STRIP): New variables.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Add AM_PROG_INSTALL_STRIP.
Christian Biesinger [Fri, 24 Jan 2020 14:12:48 +0000 (15:12 +0100)]
Make the class name in the definition match the declaration
Fixes a compile error because the class is actually called
arm_netbsd_nat_target.
gdb/ChangeLog:
2020-01-24 Christian Biesinger <cbiesinger@google.com>
* arm-nbsd-nat.c (arm_nbsd_nat_target::fetch_registers): Rename to...
(arm_netbsd_nat_target::fetch_registers): ...this.
(arm_nbsd_nat_target::store_registers): Rename to...
(arm_netbsd_nat_target::store_registers): ...this.
Change-Id: Ibebfab9edeff48f54c32d0745afda1d74d31de92
Christian Biesinger [Fri, 24 Jan 2020 14:05:05 +0000 (15:05 +0100)]
Define _KERNTYPES in arm-nbsd-nat.c
Fixes the below compile error on ARM NetBSD 9.0_RC1 (the only version I
tested). types.h does not define register_t by default.
We already use this define elsewhere, notably in bsd-kvm.c.
In file included from ../../gdb/arm-nbsd-nat.c:28:
/usr/include/machine/frame.h:54:2: error: unknown type name 'register_t'; did you mean '__register_t'?
register_t tf_spsr;
^
/usr/include/machine/types.h:77:14: note: '__register_t' declared here
typedef int __register_t;
^
There are other compile errors that this does not fix.
gdb/ChangeLog:
2020-01-24 Christian Biesinger <cbiesinger@google.com>
* arm-nbsd-nat.c: Define _KERNTYPES to get the declaration of
register_t.
Change-Id: I82c21d38189ee59ea0af2538ba84b771d268722e
Christian Biesinger [Fri, 24 Jan 2020 13:58:29 +0000 (14:58 +0100)]
Support the NetBSD version of pthread_setname_np
On NetBSD, pthread_setname_np takes a printf-style format string plus
one argument:
https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current
This patch makes thread-pool.c handle that.
gdbsupport/ChangeLog:
2020-01-24 Christian Biesinger <cbiesinger@google.com>
* thread-pool.c (set_thread_name): Add an overload for the NetBSD
version of pthread_setname_np.
Change-Id: I61e664a813eaa7f52b6811b1a43e08ac3082d8ef
Nick Clifton [Fri, 24 Jan 2020 13:19:48 +0000 (13:19 +0000)]
Fix an illegal call to free() when copying a PE format file.
PR 25447
* coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
syms and keep strings flags as these may have been set in order to
prevent a bogus call to free.
Maciej W. Rozycki [Fri, 24 Jan 2020 12:56:00 +0000 (12:56 +0000)]
gdbserver: Make `make TAGS' actually work
Fix a:
make: *** No rule to make target '.../gdb/gdbserver/arch/arm.c', needed by 'TAGS'. Stop.
error produced by `make TAGS' by making the list of sources processed
match actual file locations and by moving host-specific object files
listed in DEPFILES to nat/ or target/ subdirectories as appropriate so
that the location of the corresponding source file can be mechanically
determined.
gdb/gdbserver/
* Makefile.in (SFILES): Adjust paths to point to real files.
(OBS): Move waitstatus.o to target/waitstatus.o.
(TAGS): Transform paths appropriately.
(%.o): Rename to...
(nat/%.o): ... this pattern rule.
(%.o): Rename to...
(target/%.o): ... this pattern rule.
* configure.srv: Adjust paths throughout to include nat/ prefix
with the revant files.
* configure.ac: Add `nat' and `target' to CONFIG_SRC_SUBDIR.
* configure: Regenerate.
Maciej W. Rozycki [Fri, 24 Jan 2020 12:56:00 +0000 (12:56 +0000)]
gdbserver: Remove a stale TAGS recipe for config files
Complement commit
7ea814144a31 ("Fully disentangle gdb and gdbserver"),
<https://sourceware.org/ml/gdb-patches/2002-02/msg00692.html> (from
2002!), and remove a recipe to include config files in `make TAGS',
which are no longer used by `gdbserver' as from that commit.
gdb/gdbserver/
* Makefile.in (TAGS): Remove config files from the recipe.
Nick Clifton [Fri, 24 Jan 2020 11:55:12 +0000 (11:55 +0000)]
Fix issue with warning messages about corrupt debuginfod notes.
* readelf.c (get_build_id): Fix warning messages about corrupt
notes.
Christian Biesinger [Thu, 23 Jan 2020 14:52:05 +0000 (15:52 +0100)]
Update comments about removed function
regset_from_core_section doesn't exist anymore; it has been replaced
by the iterate_over_regset_sections gdbarch method. Update comments
accordingly to not confuse readers.
gdb/ChangeLog:
2020-01-24 Christian Biesinger <cbiesinger@google.com>
* aarch64-fbsd-tdep.c (aarch64_fbsd_iterate_over_regset_sections):
Update comment.
* aarch64-linux-tdep.c (aarch64_linux_iterate_over_regset_sections):
Likewise.
* arm-fbsd-tdep.c (arm_fbsd_iterate_over_regset_sections): Likewise.
* gdbcore.h (deprecated_add_core_fns): Update comment to point to
the correct replacement (iterate_over_regset_sections).
* riscv-fbsd-tdep.c (riscv_fbsd_iterate_over_regset_sections):
Update comment.
Change-Id: I5eea4d18e15edae5d6dfd5d0d6241e5b2ae40daa
Andrew Burgess [Tue, 19 Nov 2019 11:17:20 +0000 (11:17 +0000)]
gdb: Enable stdin on exception in execute_gdb_command
This is an update of this patch:
https://sourceware.org/ml/gdb-patches/2018-09/msg00884.html
This patch attempts to address PR gdb/23718 by re-enabling stdin
whenever an exception is caught during gdb.execute().
When Python gdb.execute() is called, an exception could occur (e.g. the
target disappearing), which is then converted into a Python exception. If
stdin was disabled before the exception is caught, it is not re-enabled,
because the exception doesn't propagate to the top level of the event loop,
whose catch block would otherwise enable it.
The result is that when execution of a Python script completes, GDB does
not prompt or accept input, and is effectively hung.
This change rectifies the issue by re-enabling stdin in the catch block of
execute_gdb_command, prior to converting the exception to a Python
exception.
Since this patch was originally posted I've added a test, and also I
converted the code to re-enable stdin from this:
SWITCH_THRU_ALL_UIS ()
{
async_enable_stdin ();
}
to simply this:
async_enable_stdin ();
My reasoning is that we only need the SWITCH_THRU_ALL_UIS if, at the time
the exception is caught, the current_ui might be different than at the time
we called async_disable_stdin. Within python's execute_gdb_command I think
it should be impossible to switch current_ui, so the SWITCH_THRU_ALL_UIS
isn't needed.
gdb/ChangeLog:
PR gdb/23718
* gdb/python/python.c (execute_gdb_command): Call
async_enable_stdin in catch block.
gdb/testsuite/ChangeLog:
PR gdb/23718
* gdb.server/server-kill-python.exp: New file.
Change-Id: I1cfc36ee9f8484cc1ed82be9be338353db6bc080
Andrew Burgess [Tue, 19 Nov 2019 18:09:43 +0000 (18:09 +0000)]
gdb: Re-enable stdin for all UIs from start_event_loop
If we catch an exception in start_event_loop's call to
gdb_do_one_event, then it is possible that the current_ui has changed
since we called async_disable_stdin. If that's the case then calling
async_enable_stdin will be called on the wrong UI.
To solve this problem we wrap the call to async_enable_stdin with
SWITCH_THRU_ALL_UIS, this causes us to try and re-enable stdin for all
UIs, which will catch any for which we called async_disable_stdin.
gdb/ChangeLog:
* event-loop.c (start_event_loop): Wrap async_enable_stdin with
SWITCH_THRU_ALL_UIS.
gdb/testsuite/ChangeLog:
* gdb.server/multi-ui-errors.c: New file.
* gdb.server/multi-ui-errors.exp: New file.
Change-Id: I1e18deff2e6f4e17f7a13adce3553eb001cad93b
Andrew Burgess [Sat, 11 Jan 2020 01:38:28 +0000 (01:38 +0000)]
gdb/tui: asm window handles invalid memory and scrolls better
This started as a patch to enable the asm window to handle attempts to
disassemble invalid memory, but it ended up expanding into a
significant rewrite of how the asm window handles scrolling. These
two things ended up being tied together as it was impossible to
correctly test scrolling into invalid memory when the asm window would
randomly behave weirdly while scrolling.
Things that should work nicely now; scrolling to the bottom or top of
the listing with PageUp, PageDown, Up Arrow, Down Arrow and we should
be able to scroll past small areas of memory that don't have symbols
associated with them. It should also be possible to scroll to the
start of a section even if there's no symbol at the start of the
section.
Adding tests for this scrolling was a little bit of a problem. First
I would have liked to add tests for PageUp / PageDown, but the tuiterm
library we use doesn't support these commands right now due to only
emulating a basic ascii terminal. Changing this to emulate a more
complex terminal would require adding support for more escape sequence
control codes, so I've not tried to tackle that in this patch.
Next, I would have liked to test scrolling to the start or end of the
assembler listing and then trying to scroll even more, however, this
is a problem because in a well behaving GDB a scroll at the start/end
has no effect. What we need to do is:
- Move to start of assembler listing,
- Send scroll up command,
- Wait for all curses output,
- Ensure the assembler listing is unchanged, we're still at the
start of the listing.
The problem is that there is no curses output, so how long do we wait
at step 3? The same problem exists for scrolling to the bottom of the
assembler listing. However, when scrolling down you can at least see
the end coming, so I added a test for this case, however, this feels
like an area of code that is massively under tested.
gdb/ChangeLog:
PR tui/9765
* minsyms.c (lookup_minimal_symbol_by_pc_section): Update header
comment, add extra parameter, and update to store previous symbol
when appropriate.
* minsyms.h (lookup_minimal_symbol_by_pc_section): Update comment,
add extra parameter.
* tui/tui-disasm.c (tui_disassemble): Update header comment,
remove unneeded parameter, add try/catch around gdb_print_insn,
rewrite to add items to asm_lines vector.
(tui_find_backward_disassembly_start_address): New function.
(tui_find_disassembly_address): Updated throughout.
(tui_disasm_window::set_contents): Update for changes to
tui_disassemble.
(tui_disasm_window::do_scroll_vertical): No need to adjust the
number of lines to scroll.
gdb/testsuite/ChangeLog:
PR tui/9765
* gdb.tui/tui-layout-asm.exp: Add scrolling test for asm window.
Change-Id: I323987c8fd316962c937e73c17d952ccd3cfa66c
Pedro Alves [Sat, 11 Jan 2020 01:37:26 +0000 (01:37 +0000)]
gdb/tui: Prevent exceptions from trying to cross readline
This is triggered by simply scrolling off the end of the dissasembly
window. This commit doesn't fix the actual exception that is being
thrown, which will still need to be fixed, but makes sure that we
don't ever throw an exception out to readline.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
PR tui/9765
* tui/tui-io.c (tui_getc): Rename to ...
(tui_getc_1): ... this.
(tui_get): New, reimplent as try/catch wrapper around tui_getc_1.
Change-Id: I2e32a401ab34404b2132ec82a3e1c17b9b723e41
GDB Administrator [Fri, 24 Jan 2020 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 23 Jan 2020 22:55:35 +0000 (17:55 -0500)]
gdb: introduce objfile text_section_offset and data_section_offset methods
The pattern
objfile->section_offsets[SECT_OFF_TEXT (objfile)]
... appears very often, to get the offset of the text section of an
objfile. I thought it would be more readable to write it as:
objfile->text_section_offset ()
... so I added this method and used it where possible. I also added
data_section_offset, although it is not used as much.
gdb/ChangeLog:
* objfiles.h (ALL_OBJFILE_OSECTIONS): Move up.
(SECT_OFF_DATA): Likewise.
(SECT_OFF_RODATA): Likewise.
(SECT_OFF_TEXT): Likewise.
(SECT_OFF_BSS): Likewise.
(struct objfile) <text_section_offset, data_section_offset>: New
methods.
* amd64-windows-tdep.c (amd64_windows_find_unwind_info): Use
objfile::text_section_offset.
* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
* coffread.c (coff_symtab_read): Likewise.
(enter_linenos): Likewise.
(process_coff_symbol): Likewise.
* ctfread.c (get_objfile_text_range): Likewise.
* dtrace-probe.c (dtrace_probe::get_relocated_address):
Use objfile::data_section_offset.
* dwarf2-frame.c (execute_cfa_program): Use
objfile::text_section_offset.
(dwarf2_frame_find_fde): Likewise.
* dwarf2read.c (create_addrmap_from_index): Likewise.
(create_addrmap_from_aranges): Likewise.
(dw2_find_pc_sect_compunit_symtab): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(add_partial_symbol): Likewise.
(add_partial_subprogram): Likewise.
(process_full_comp_unit): Likewise.
(read_file_scope): Likewise.
(read_func_scope): Likewise.
(read_lexical_block_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_rnglists_process): Likewise.
(dwarf2_ranges_process): Likewise.
(dwarf2_ranges_read): Likewise.
(dwarf_decode_lines_1): Likewise.
(new_symbol): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_per_cu_text_offset): Likewise.
* hppa-bsd-tdep.c (hppabsd_find_global_pointer): Likewise.
* hppa-tdep.c (read_unwind_info): Likewise.
* ia64-tdep.c (ia64_find_unwind_table): Likewise.
* psympriv.h (struct partial_symtab): Likewise.
* psymtab.c (find_pc_sect_psymtab): Likewise.
* solib-svr4.c (enable_break): Likewise.
* stap-probe.c (relocate_address): Use
objfile::data_section_offset.
* xcoffread.c (enter_line_range): Use
objfile::text_section_offset.
(read_xcoff_symtab): Likewise.
Simon Marchi [Thu, 23 Jan 2020 22:44:22 +0000 (17:44 -0500)]
gdb: fix variable shadowing error in darwin-nat.c
We encounter this error when building on macOS with GCC.
CXX darwin-nat.o
/src-local/binutils-gdb/gdb/darwin-nat.c: In member function 'ptid_t darwin_nat_target::wait_1(ptid_t, target_waitstatus*)':
/src-local/binutils-gdb/gdb/darwin-nat.c:1264:18: error: declaration of 'inf' shadows a previous local [-Werror=shadow=compatible-local]
for (inferior *inf : all_inferiors (this))
^~~
/src-local/binutils-gdb/gdb/darwin-nat.c:1205:20: note: shadowed declaration is here
struct inferior *inf;
^~~
Fix it by moving the declaration of `inf` in the specific scopes that
need it. I think it's clearer this way anyway, as it shows that it's
not the same `inf` that is used in these different scopes.
Thanks to Iain Sandoe for reporting this. I did not see this error at
first, because I compile with the default system compiler on macOS,
which is clang. The compiler flag we try to enable for this is
`-Wshadow=local`, which is not one recognized by clang. I checked to
see if there would a version of the -Wshadow* warnings [1] we could
enable for clang, that would catch this, but the only one that would is
`-Wshadow` itself, and this is too invasive for us (which is why we
enabled just -Wshadow=local in the first place).
[1] https://clang.llvm.org/docs/DiagnosticsReference.html#wshadow
gdb/ChangeLog:
* darwin-nat.c (darwin_nat_target::wait_1): Move `inf`
declaration to narrower scopes.
Simon Marchi [Thu, 23 Jan 2020 19:55:50 +0000 (14:55 -0500)]
gdb: fix darwin-nat.c build / adapt to multi-target
The darwin-nat.c file doesn't build since the multi-target changes
(
5b6d1e4f, "Multi-target support"). This patch makes it build. I have
access to a macOS vm, so I am able to build it, but I wasn't able to
successfully codesign it and try to actually debug something, so I don't
know if it works. I don't have much more time to put on this to figure
it out, so I thought I'd sent the patch anyway, as it's at least a step
in the right direction.
The bulk of the patch is to change a bunch of functions to be methods of
the darwin_nat_target object, so that this can pass `this` to
find_inferior_ptid and other functions that now require a
process_stratum_target pointer.
The darwin_ptrace_him function (renamed to darwin_nat_target::ptrace_him
in this patch) is passed to fork_inferior as the `init_trace_fun`
parameter. Since the method can't be passed as a plain function pointer
(we need the `this` pointer), I changed the `init_trace_fun` parameter
of fork_inferior to be a gdb::function_view, so we can pass a lambda and
capture `this`.
The changes in darwin-nat.h are only to move definition higher in the
file, so that forward declarations are not needed.
gdb/ChangeLog:
* darwin-nat.h (struct darwin_exception_msg, enum
darwin_msg_state, struct darwin_thread_info, darwin_thread_t):
Move up.
(class darwin_nat_target) <wait_1, check_new_threads,
decode_exception_message, decode_message, stop_inferior,
init_thread_list, ptrace_him, cancel_breakpoint>: Declare.
* darwin-nat.c (darwin_check_new_threads): Rename to...
(darwin_nat_target::check_new_threads): ... this.
(darwin_suspend_inferior_it): Remove.
(darwin_decode_exception_message): Rename to...
(darwin_nat_target::decode_exception_message): ... this.
(darwin_nat_target::resume): Pass target to find_inferior_ptid.
(darwin_decode_message): Rename to...
(darwin_nat_target::decode_message): ... this.
(cancel_breakpoint): Rename to...
(darwin_nat_target::cancel_breakpoint): ... this.
(darwin_wait): Rename to...
(darwin_nat_target::wait_1): ... this. Use range-based for loop
instead of iterate_over_inferiors.
(darwin_nat_target::wait): Call wait_1 instead of darwin_wait.
(darwin_stop_inferior): Rename to...
(darwin_nat_target::stop_inferior): ... this.
(darwin_nat_target::kill): Call wait_1 instead of darwin_wait.
(darwin_init_thread_list): Rename to...
(darwin_nat_target::init_thread_list): ... this.
(darwin_ptrace_him): Rename to...
(darwin_nat_target::ptrace_him): ... this.
(darwin_nat_target::create_inferior): Pass lambda function to
fork_inferior.
(darwin_nat_target::detach): Call stop_inferior instead of
darwin_stop_inferior.
* fork-inferior.h (fork_inferior): Change init_trace_fun
parameter to gdb::function_view.
* fork-inferior.c (fork_inferior): Likewise.
Hannes Domani [Sat, 21 Dec 2019 16:08:14 +0000 (17:08 +0100)]
Cache the text section offset of shared libraries
Each time a dll is loaded, update_solib_list is called.
This in turn calls deep down xfer_partial -> windows_xfer_shared_libraries,
which calls windows_xfer_shared_library for each loaded dll,
and pe_text_section_offset reads the dll for the text section offset.
Also if the data provided by xfer_partial is bigger than 4K,
then all of this is done for each 4K chunk (see target_read_alloc_1).
Caching of the text section offset improves the startup time of
an application with >300 dynamically loaded plugins from 2m10s to 10s.
And the shutdown time improves from 2m to 2s.
gdb/ChangeLog:
2020-01-23 Hannes Domani <ssbssa@yahoo.de>
* i386-cygwin-tdep.c (core_process_module_section): Update.
* windows-nat.c (struct lm_info_windows): Add text_offset.
(windows_xfer_shared_libraries): Update.
* windows-tdep.c (windows_xfer_shared_library):
Add text_offset_cached argument.
* windows-tdep.h (windows_xfer_shared_library): Update.
Nick Clifton [Thu, 23 Jan 2020 14:33:36 +0000 (14:33 +0000)]
Updated translations for various binutils sub-directories.
Alan Modra [Thu, 23 Jan 2020 01:05:51 +0000 (11:35 +1030)]
PR25444, Floating point exception in _bfd_elf_compute_section_file_positions
PR 25444
* elf.c (assign_file_positions_for_load_sections): Avoid divide
by zero when p_align is zero.
Jim Wilson [Thu, 23 Jan 2020 00:45:04 +0000 (16:45 -0800)]
RISC-V: Change -march parsing.
bfd/
2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
* bfd/elfnn-riscv.c (riscv_skip_prefix): New.
(riscv_prefix_cmp): Likewise.
(riscv_non_std_ext_p): Deleted.
(riscv_std_sv_ext_p): Likewise.
(riscv_non_std_sv_ext_p): Likewise.
(riscv_merge_non_std_and_sv_ext): Rename to...
(riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
(riscv_merge_arch_attr_info): Replace 3 calls to
riscv_merge_non_std_and_sv_ext with single call to
riscv_merge_multi_letter_ext.
* bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
encounter a 'z' prefix.
(riscv_get_prefix_class): New function, return prefix class based
on first few characters of input string.
(riscv_parse_config): New structure to factor out minor differences
in extension class parsing behaviour.
(riscv_parse_sv_or_non_std_ext): Rename to...
(riscv_parse_prefixed_ext): and parameterise with
riscv_parse_config.
(riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
(riscv_multi_letter_ext_valid_p): New.
(riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
(riscv_parse_subset): Delegate all non-single-letter parsing work
to riscv_parse_prefixed_ext.
* bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
(riscv_get_prefix_class): Declare.
gas/
2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
* testsuite/gas/riscv/march-ok-s.d: sx is no longer valid and
s exts must be known, so rename *ok* to *fail*.
* testsuite/gas/riscv/march-ok-sx.d: Likewise.
* testsuite/gas/riscv/march-ok-s-with-version: Likewise.
* testsuite/gas/riscv/march-fail-s.l: Expected error messages for
above change.
* testsuite/gas/riscv/march-fail-sx.l: Likewise.
* testsuite/gas/riscv/march-fail-sx-with-version.l: Likewise.
Change-Id: Ic4d91a13d055a10d30ab28752a380a669b59f29c
GDB Administrator [Thu, 23 Jan 2020 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Jozef Lawrynowicz [Wed, 22 Jan 2020 21:44:54 +0000 (21:44 +0000)]
MSP430: Fix simulator execution of RRUX instruction
The MSP430X RRUX instruction (unsigned right shift) is synthesized as
the RRC (rotate right through carry) instruction, but with the ZC
(zero carry) bit of the opcode extention word set.
Ensure the carry flag is ignored when the ZC bit is set.
sim/msp430/ChangeLog:
2020-01-22 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* msp430-sim.c (msp430_step_once): Ignore the carry flag when executing
an RRC instruction, if the ZC bit of the extension word is set.
sim/testsuite/sim/msp430/ChangeLog:
2020-01-22 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* rrux.s: New test.
H.J. Lu [Wed, 22 Jan 2020 17:24:14 +0000 (09:24 -0800)]
x86: Always disallow double word suffix with word general register
In 64-bit mode, double word suffix in mnemonic with word general register
is disallowed. Otherwise, assembler gives a warning:
$ cat /tmp/x.s
movl %ax, %bx
movl %ds, %ax
movl %ax, %cs
$ gcc -c /tmp/x.s
/tmp/x.s: Assembler messages:
/tmp/x.s:1: Error: incorrect register `%bx' used with `l' suffix
/tmp/x.s:2: Error: incorrect register `%ax' used with `l' suffix
/tmp/x.s:3: Error: incorrect register `%ax' used with `l' suffix
$ gcc -c /tmp/x.s -m32
/tmp/x.s: Assembler messages:
/tmp/x.s: Assembler messages:
/tmp/x.s:1: Warning: using `%ebx' instead of `%bx' due to `l' suffix
/tmp/x.s:1: Warning: using `%eax' instead of `%ax' due to `l' suffix
/tmp/x.s:2: Warning: using `%eax' instead of `%ax' due to `l' suffix
/tmp/x.s:3: Warning: using `%eax' instead of `%ax' due to `l' suffix
This patch makes it a hard error in all modes. Now we get:
$ gcc -c /tmp/x.s -m32
/tmp/x.s: Assembler messages:
/tmp/x.s:1: Error: incorrect register `%bx' used with `l' suffix
/tmp/x.s:2: Error: incorrect register `%ax' used with `l' suffix
/tmp/x.s:3: Error: incorrect register `%ax' used with `l' suffix
PR gas/25438
* config/tc-i386.c (check_long_reg): Always disallow double word
suffix in mnemonic with word general register.
* testsuite/gas/i386/general.s: Replace word general register
with double word general register for movl.
* testsuite/gas/i386/inval.s: Add tests for movl with word general
register.
* testsuite/gas/i386/general.l: Updated.
* testsuite/gas/i386/inval.l: Likewise.
H.J. Lu [Wed, 22 Jan 2020 14:22:41 +0000 (06:22 -0800)]
x86-64: Skip GNU2 TLS tests only without compiler support
After fixing:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93319
https://sourceware.org/bugzilla/show_bug.cgi?id=25416
-mtls-dialect=gnu2 is working for x32 with GCC 10. Skip GNU2 TLS tests
only if compiler doesn't support it.
PR ld/25416
* testsuite/ld-x86-64/tls.exp: Skip GNU2 TLS tests only without
compiler support.
Alan Modra [Wed, 22 Jan 2020 01:54:56 +0000 (12:24 +1030)]
PowerPC64 tls_get_addr_desc static support
This provides a linker generated __tls_get_addr_desc wrapper function
preserving registers around a __tls_get_addr call. The idea being to
support __tls_get_addr_desc without requiring a glibc update.
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
(ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
__tls_get_addr_desc.
(ppc64_elf_size_stubs): Add section for linker generated
__tls_get_addr_desc wrapper function. Loop at least once if
generating this function.
(emit_tga_desc, emit_tga_desc_eh_frame): New functions.
(ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
ld/
* testsuite/ld-powerpc/tlsdesc3.d,
* testsuite/ld-powerpc/tlsdesc3.wf,
* testsuite/ld-powerpc/tlsdesc4.d,
* testsuite/ld-powerpc/tlsdesc4.s,
* testsuite/ld-powerpc/tlsdesc4.wf: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
Alan Modra [Mon, 20 Jan 2020 02:08:00 +0000 (12:38 +1030)]
PowerPC64 __tls_get_addr_desc
This implements register saving and restoring in the __tls_get_addr
call stub, so that when glibc supports the optimized tls call stub gcc
can generate code that assumes only r0, r12 and of course r3 are
changed on a __tls_get_addr call. When gcc expects __tls_get_addr
calls to preserve registers the call will be to __tls_get_addr_desc,
which will be translated by the linker to a call to __tls_get_addr_opt.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
* elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
tga_desc_fd.
(is_tls_get_addr): Match tga_desc and tga_desc_df too.
(STDU_R1_0R1, ADDI_R1_R1): Define.
(tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
(ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd. Indirect
tga_desc_fd to opt_fd, and tga_desc to opt. Set
no_tls_get_addr_regsave.
(branch_reloc_hash_match): Add hash3 and hash4.
(ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
(ppc64_elf_size_dynamic_sections): Likewise.
(ppc64_elf_relocate_section): Likewise.
(plt_stub_size, build_plt_stub): Likewise. Size regsave
__tls_get_addr stub.
(build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
eh_frame.
(ppc_size_one_stub): Handle tga_desc_fd and tga_desc too. Size
eh_frame for regsave __tls_get_addr.
gas/
* config/tc-ppc.c (parse_tls_arg): Handle tls arg for
__tls_get_addr_desc and __tls_get_addr_opt.
ld/
* emultempl/ppc64elf.em (ppc64_opt, PARSE_AND_LIST_LONGOPTS),
(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Support
--tls-get-addr-regsave and --no-tls-get-addr-regsave.
(params): Init new field.
* ld.texi (--tls-get-addr-regsave, --no-tls-get-addr-regsave):
Document.
* testsuite/ld-powerpc/tlsdesc.s,
* testsuite/ld-powerpc/tlsdesc.d,
* testsuite/ld-powerpc/tlsdesc.wf,
* testsuite/ld-powerpc/tlsdesc2.d,
* testsuite/ld-powerpc/tlsdesc2.wf,
* testsuite/ld-powerpc/tlsexenors.d,
* testsuite/ld-powerpc/tlsexenors.r,
* testsuite/ld-powerpc/tlsexers.d,
* testsuite/ld-powerpc/tlsexers.r,
* testsuite/ld-powerpc/tlsexetocnors.d,
* testsuite/ld-powerpc/tlsexetocrs.d,
* testsuite/ld-powerpc/tlsexetocrs.r,
* testsuite/ld-powerpc/tlsopt6.d,
* testsuite/ld-powerpc/tlsopt6.wf: New.
* testsuite/ld-powerpc/powerpc.exp: Run new tests.
Alan Modra [Wed, 22 Jan 2020 02:32:11 +0000 (13:02 +1030)]
PowerPC64 TLS optimization fix
When linking with --no-tls-optimize the linker doesn't generate a call
or long branch stub to __tls_get_addr in some circumstances, giving:
relocation truncated to fit: R_PPC64_REL24 against symbol `__tls_get_addr'
* elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
which __tls_get_addr calls will be eliminated.
Yuri Chornoivan [Sun, 19 Jan 2020 14:24:06 +0000 (16:24 +0200)]
PR25417, Fix minor typos
PR 25417
binutils/
* readelf.c (get_alpha_symbol_other): Fix error message typo.
ld/
* ldlang.c (ldlang_open_ctf): Fix error message typo.
* emultempl/z80elf.em (z80_elf_after_open): Likewise.
H.J. Lu [Wed, 22 Jan 2020 00:20:38 +0000 (16:20 -0800)]
pr23900-1.d: Adjusted
Linux program headers may look like
Section to Segment mapping:
Segment Sections...
00 .note.gnu.property .text
01 .note.gnu.property
02 .note.gnu.property
or
Section to Segment mapping:
Segment Sections...
00 .note.gnu.property
01 .text
02 .note.gnu.property
03 .note.gnu.property
Update pr23900-1.d to accept both.
* testsuite/ld-elf/pr23900-1.d: Adjusted.
GDB Administrator [Wed, 22 Jan 2020 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 21 Jan 2020 23:30:07 +0000 (18:30 -0500)]
gdb: add declaration for _initialize_gdbarch in gdbarch.sh
In commit
gdb: add back declarations for _initialize functions
6c2659886f7018fcca26ee0fc813bc9748fb8513
I wrongfully edited gdbarch.c, instead of editing gdbarch.sh and
re-generating gdbarch.c. This patch fixes gdbarch.sh to add a
declaration for _initialize_gdbarch. gdbarch.c is not changed, as the
output of gdbarch.sh now matches the current state of gdbarch.c.
gdb/ChangeLog:
* gdbarch.sh: Add declaration for _initialize_gdbarch.
Simon Marchi [Tue, 21 Jan 2020 21:28:25 +0000 (16:28 -0500)]
gdb: remove uses of iterate_over_inferiors in remote-sim.c
This removes the two uses of iterate_over_inferiors, in favor of
range-based loops.
gdb/ChangeLog:
* remote-sim.c (check_for_duplicate_sim_descriptor): Remove.
(get_sim_inferior_data): Remove use of iterate_over_inferiors,
replace with range-based for.
(gdbsim_interrupt_inferior): Remove.
(gdbsim_target::interrupt): Replace iterate_over_inferiors use
with a range-based for. Inline code from
gdbsim_interrupt_inferior.
Simon Marchi [Tue, 21 Jan 2020 21:04:51 +0000 (16:04 -0500)]
gdb: fix indentation in infrun.c
I noticed the indentation there was off, this patch fixes it.
gdb/ChangeLog:
* infrun.c (proceed): Fix indentation.
Tom Tromey [Fri, 3 Jan 2020 20:59:27 +0000 (13:59 -0700)]
Allow use of Pygments to colorize source code
While GNU Source Highlight is good, it's also difficult to build and
distribute. For one thing, it needs Boost. For another, it has an
unusual configuration and installation setup.
Pygments, a Python library, doesn't suffer from these issues, and so I
thought it would be a reasonable fallback.
This patch implements this idea. GNU Source Highlight is preferred,
but if it is unavailable (or fails), the extension languages are
tried. This patch also implements support for Pygments.
Something similar could be done for Guile, using:
https://dthompson.us/projects/guile-syntax-highlight.html
However, I don't know enough about Guile internals to make this
happen, so I have not done it here.
gdb/ChangeLog
2020-01-21 Tom Tromey <tromey@adacore.com>
* source-cache.c (source_cache::ensure): Call ext_lang_colorize.
* python/python.c (python_extension_ops): Update.
(gdbpy_colorize): New function.
* python/lib/gdb/__init__.py (colorize): New function.
* extension.h (ext_lang_colorize): Declare.
* extension.c (ext_lang_colorize): New function.
* extension-priv.h (struct extension_language_ops) <colorize>: New
member.
* cli/cli-style.c (_initialize_cli_style): Update help text.
Change-Id: I5e21623ee05f1f66baaa6deaeca78b578c031bf4
H.J. Lu [Tue, 21 Jan 2020 13:43:59 +0000 (05:43 -0800)]
pr23900-1.d: Also check PT_GNU_PROPERTY program header
Also pass -l to readelf to check PT_GNU_PROPERTY program header.
PR ld/23900
* testsuite/ld-elf/pr23900-1.d: Also pass -l to readelf.
Jan Beulich [Tue, 21 Jan 2020 13:41:05 +0000 (14:41 +0100)]
x86: testsuite adjustments after commit
1a0351246a5c
The odd behavior of certain COFF/PE targets makes necessary some
mechanical adjustments.
Luis Machado [Thu, 9 Jan 2020 19:24:15 +0000 (16:24 -0300)]
Convert an int flag variable to bool
As suggested, the cond variable is really supposed to be a bool. So,
make it so.
gdb/ChangeLog:
2020-01-21 Luis Machado <luis.machado@linaro.org>
* aarch64-tdep.c (struct aarch64_displaced_step_closure)
<cond>: Change type to bool.
(aarch64_displaced_step_b_cond): Update cond to use bool type.
(aarch64_displaced_step_cb): Likewise.
(aarch64_displaced_step_tb): Likewise.
Luis Machado [Thu, 9 Jan 2020 19:19:31 +0000 (16:19 -0300)]
Add more debugging output to aarch64_displaced_step_fixup
While debugging the step-over-syscall problem, i wanted to see a bit more
debugging output to try to determine the root cause.
This patch does this.
gdb/ChangeLog:
2020-01-21 Luis Machado <luis.machado@linaro.org>
* aarch64-tdep.c (aarch64_displaced_step_fixup): Add more debugging
output.
Luis Machado [Thu, 9 Jan 2020 19:04:36 +0000 (16:04 -0300)]
Fix step-over-syscall.exp failure
In particular, this one:
FAIL: gdb.base/step-over-syscall.exp: fork: displaced=on: check_pc_after_cross_syscall: single step over fork final pc
When ptrace fork event reporting is enabled, GDB gets a PTRACE_EVENT_FORK
event whenever the inferior executes the fork syscall.
Then the logic is that GDB needs to step the inferior yet again in order to
receive a predetermined SIGTRAP, but no execution takes place because the
signal was already queued for delivery. That means the PC should stay the same.
I noticed the aarch64 code is currently adjusting the PC in this situation,
making the inferior skip an instruction without executing it.
The following change checks if we did not execute the instruction
(pc - to == 0), making proper adjustments for such case.
Regression tested on aarch64-linux-gnu on the tryserver.
gdb/ChangeLog:
2020-01-21 Luis Machado <luis.machado@linaro.org>
* aarch64-tdep.c (struct aarch64_displaced_step_closure )
<pc_adjust>: Adjust the documentation.
(aarch64_displaced_step_fixup): Check if PC really moved before
adjusting it.
Jan Beulich [Tue, 21 Jan 2020 07:30:05 +0000 (08:30 +0100)]
x86: replace adhoc ambiguous operand checking for CRC32
There's no need (anymore?) to heavily special case this - just make
generic logic consider only its first operand, and deal with the case
of an 'l' suffix not being allowed in a pattern.
Jan Beulich [Tue, 21 Jan 2020 07:28:25 +0000 (08:28 +0100)]
x86: improve handling of insns with ambiguous operand sizes
Commit
b76bc5d54e ("x86: don't default variable shift count insns to
8-bit operand size") pointed out a very bad case, but the underlying
problem is, as mentioned on various occasions, much larger: Silently
selecting a (nowhere documented afaict) certain default operand size
when there's no "sizing" suffix and no suitable register operand(s) is
simply dangerous (for the programmer to make mistakes).
While in Intel syntax mode such mistakes already lead to an error (which
is going to remain that way), AT&T syntax mode now gains warnings in
such cases by default, which can be suppressed or promoted to an error
if so desired by the programmer. Furthermore at least general purpose
insns now consistently have a default applied (alongside the warning
emission), rather than accepting some and refusing others.
No warnings are (as before) to be generated for "DefaultSize" insns as
well as ones acting on selector and other fixed-width values. For
SYSRET, however, the DefaultSize needs to be dropped - it had been
wrongly put there in the first place, as it's unrelated to .code16gcc
(no stack accesses involved).
As set forth as a prereq when I first mentioned this intended change a
few years back, Linux as well as gcc have meanwhile been patched to
avoid (emission of) ambiguous operands (and hence triggering of the new
warning).
Note that I think that in 64-bit mode IRET and far RET would better get
a diagnostic too, as it's reasonably likely that a suffix-less instance
really is meant to be a 64-bit one. But I guess I better make this a
separate follow-on patch.
Note further that floating point operations with integer operands are an
exception for now: They continue to use short (16-bit) operands by
default even in 32- and 64-bit modes.
Finally note that while {,V}PCMPESTR{I,M} would, strictly speaking, also
need to be diagnosed, with their 64-bit forms not being very useful I
think it is better to continue to avoid warning about them (by way of
them carrying IgnoreSize attributes).
Jan Beulich [Tue, 21 Jan 2020 07:25:31 +0000 (08:25 +0100)]
x86: VCVTNEPS2BF16{X,Y} should permit broadcasting
Just like other VCVT*{X,Y} templates do, and to allow the programmer
flexibility (might be relevant in particular when heavily macro-izing
code), the two templates should also have Broadcast set, just like their
X/Y-suffix-less counterparts. This in turn requires them to also have
* Dword set on their memory operands, to cover the logic added to
i386gen by
4a1b91eabbe7 ("x86: Expand Broadcast to 3 bits"),
* RegXMM/RegYMM set on their source operands, to satisfy broadcast
sizing logic in gas itself.
Otherwise ATTSyntax templates wouldn't need such operand size attributes.
While extending the test cases, also add Intel syntax broadcast forms
without explicit size specifiers.
GDB Administrator [Tue, 21 Jan 2020 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Mon, 20 Jan 2020 15:10:23 +0000 (15:10 +0000)]
Updated translations for various binutils sub-directories
H.J. Lu [Mon, 20 Jan 2020 14:58:51 +0000 (06:58 -0800)]
x86-64: Fix TLSDESC relaxation for x32
For x32, we must encode "lea x@TLSDESC(%rip), %reg" with a REX prefix
even if it isn't required. Otherwise linker can’t safely perform
GDesc -> IE/LE optimization. X32 TLSDESC sequences can be:
40 8d 05 00 00 00 00 rex lea x@TLSDESC(%rip), %reg
...
67 ff 10 call *x@TLSCALL(%eax)
or the same sequence as LP64:
48 8d 05 00 00 00 00 lea foo@TLSDESC(%rip), %reg
...
ff 10 call *foo@TLSCALL(%rax)
We need to support both sequences for x32. For both GDesc -> IE/LE
transitions,
67 ff 10 call *x@TLSCALL(%eax)
should relaxed to
0f 1f 00 nopl (%rax)
For GDesc -> LE transition,
40 8d 05 00 00 00 00 rex lea x@TLSDESC(%rip), %reg
should relaxed to
40 c7 c0 fc ff ff ff rex movl $x@tpoff, %reg
For GDesc -> IE transition,
40 8d 05 00 00 00 00 rex lea x@TLSDESC(%rip), %reg
should relaxed to
40 8b 05 00 00 00 00 rex movl x@gottpoff(%rip), %eax
bfd/
PR ld/25416
* elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
"rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
X32 mode.
(elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
transition, relax "rex leal x@tlsdesc(%rip), %reg" to
"rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
"rex leal x@tlsdesc(%rip), %reg" to
"rex movl x@gottpoff(%rip), %eax". For both transitions, relax
"call *(%eax)" to "nopl (%rax)".
gas/
PR ld/25416
* config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix
for lea with R_X86_64_GOTPC32_TLSDESC relocation when generating
x32 object.
* testsuite/gas/i386/ilp32/x32-tls.d: Updated.
* testsuite/gas/i386/ilp32/x32-tls.s: Add tests for lea with
R_X86_64_GOTPC32_TLSDESC relocation.
ld/
PR ld/25416
* testsuite/ld-x86-64/pr25416-1.s: New file
* testsuite/ld-x86-64/pr25416-1a.d: Likewise.
* testsuite/ld-x86-64/pr25416-1b.d: Likewise.
* testsuite/ld-x86-64/pr25416-1.s: Likewise.
* testsuite/ld-x86-64/pr25416-2.s: Likewise.
* testsuite/ld-x86-64/pr25416-2a.d: Likewise.
* testsuite/ld-x86-64/pr25416-2b.d: Likewise.
* testsuite/ld-x86-64/pr25416-3.d: Likewise.
* testsuite/ld-x86-64/pr25416-3.s: Likewise.
* testsuite/ld-x86-64/pr25416-4.d: Likewise.
* testsuite/ld-x86-64/pr25416-4.s: Likewise.
* testsuite/ld-x86-64/pr25416-5a.c: Likewise.
* testsuite/ld-x86-64/pr25416-5b.s: Likewise.
* testsuite/ld-x86-64/pr25416-5c.s: Likewise.
* testsuite/ld-x86-64/pr25416-5d.s: Likewise.
* testsuite/ld-x86-64/pr25416-5e.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/25416 tests.
Alan Modra [Mon, 20 Jan 2020 02:03:29 +0000 (12:33 +1030)]
Don't touch r11 in __tls_get_addr stub
This modifies the special __tls_get_addr stub that checks for a
tlsdesc style __tls_index entry and returns early. Not using r11
isn't much benefit at the moment but a followup patch will preserve
regs around the first call to __tls_get_addr when the __tls_index
entry isn't yet set up for an early return.
bfd/
* elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
(MTLR_R11): Don't define.
(LD_R0_0R3, CMPDI_R0_0): Define.
(build_tls_get_addr_stub): Don't use r11 in stub.
ld/
* testsuite/ld-powerpc/tlsexe.d: Match new __tls_get_addr stub.
* testsuite/ld-powerpc/tlsexeno.d: Likewise.
* testsuite/ld-powerpc/tlsexetoc.d: Likewise.
* testsuite/ld-powerpc/tlsexetocno.d: Likewise.
* testsuite/ld-powerpc/tlsopt5.d: Likewise.
Alan Modra [Mon, 20 Jan 2020 06:04:20 +0000 (16:34 +1030)]
PowerPC64 ppc_elf_hash_entry, defined_sym_val, is_tls_get_addr
* elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
(defined_sym_val, is_tls_get_addr): Likewise.
Alan Modra [Mon, 20 Jan 2020 02:02:37 +0000 (12:32 +1030)]
ubsan: hppa: negation of -
2147483648
* hppa-dis.c (fput_const): Remove useless cast.
Alan Modra [Mon, 20 Jan 2020 02:01:58 +0000 (12:31 +1030)]
ubsan: arm: out of bounds array access
.inst 0x81bdfe9f
disassembles as
0:
81bdfe9f ldaexdhi pc, reg-names-std, [sp]
I'm quite sure "reg-names-std" isn't an ARM register.
* arm-dis.c (print_insn_arm): Wrap 'T' value.
Simon Marchi [Mon, 20 Jan 2020 00:47:49 +0000 (19:47 -0500)]
sim: don't rely on inferior_ptid in gdbsim_target::wait
When running a program with the simulator target, I get:
/home/simark/src/binutils-gdb/gdb/inferior.c:279: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.
This can be reproduced by building a GDB for --target=arm-none-gnueabi,
and running with
$ ./gdb -nx --data-directory=data-directory a.out -ex "target sim" -ex load -ex "b main" -ex r
Where a.out is any program with a main.
The problem is that gdbsim_target::wait assumes that inferior_ptid has
the value of the thread it wants to report an event for.
Actually, it's the target's responsibility to come up with the ptid of
the thread the event is for. In the sim target, that ptid is stored in
sim_inferior_data::remote_sim_ptid, so return that instead of
inferior_ptid.
ChangeLog:
* remote-sim.c (gdbsim_target::wait): Return
sim_data->remote_sim_ptid instead of inferior_ptid.
Simon Marchi [Mon, 20 Jan 2020 00:47:17 +0000 (19:47 -0500)]
sim: add some stdlib.h includes
When trying to compile GDB with --target=avr, with gcc 9.2.0, I am
getting a bunch of:
/home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: error: implicit declaration of function ‘abort’ [-Werror=implicit-function-declaration]
94 | abort ();
| ^~~~~
/home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: error: incompatible implicit declaration of built-in function ‘abort’ [-Werror]
/home/simark/src/binutils-gdb/sim/avr/../common/nrun.c:94:7: note: include ‘<stdlib.h>’ or provide a declaration of ‘abort’
I did what the compiler told me and added the relevant includes in the
problematic files.
sim/common/ChangeLog:
* nrun.c: Include stdlib.h.
* sim-core.c: Likewise.
* sim-engine.c: Likewise.
* sim-io.c: Likewise.
* sim-module.c: Likewise.
* sim-reason.c: Likewise.
GDB Administrator [Mon, 20 Jan 2020 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 11 Jan 2020 18:40:45 +0000 (11:40 -0700)]
Call disassemble_free_target in gdb
Commit
20135676fc4c3912297c313b3e0d3cbd6cc402e3 ("PR24960, Memory leak
from disassembler") added "disassemble_free_target" to opcodes. This
is used to free target-specific data when finished with a
disassembler.
This patch changes gdb to call this function where needed.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* disasm.c (~gdb_disassembler): New destructor.
(gdb_buffered_insn_length): Call disassemble_free_target.
* disasm.h (class gdb_disassembler): Declare destructor. Use
DISABLE_COPY_AND_ASSIGN.
Change-Id: I245ba5b7dec5e5d9f29cd21832c6e2b4fecef047
Tom Tromey [Sat, 11 Jan 2020 22:56:10 +0000 (15:56 -0700)]
Replace init_cutu_and_read_dies with a class
init_cutu_and_read_dies takes a callback function, which I've always
found somewhat difficult to follow. This patch replaces this function
with a class, and changes the callers to use it. In some cases this
allows for the removal of a helper struct and helper function as well.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* dwarf2read.c (abbrev_table_up): Move typedef earlier.
(die_reader_func_ftype): Remove.
(cutu_reader): New class.
(dw2_get_file_names_reader): Remove "data" parameter.
(dw2_get_file_names): Use cutu_reader.
(create_debug_type_hash_table): Update.
(read_cutu_die_from_dwo): Update comment.
(lookup_dwo_unit): Add dwo_name parameter.
(cutu_reader::init_tu_and_read_dwo_dies): Now a method. Remove
die_reader_func_ftype and data parameters.
(cutu_reader::cutu_reader): Rename from init_cutu_and_read_dies.
Remove die_reader_func_ftype and data parameters.
(~cutu_reader): New; from init_cutu_and_read_dies.
(cutu_reader::cutu_reader): Rename from
init_cutu_and_read_dies_no_follow. Remove die_reader_func_ftype
and data parameters.
(init_cutu_and_read_dies_simple): Remove.
(struct process_psymtab_comp_unit_data): Remove.
(process_psymtab_comp_unit_reader): Remove data parameter; add
want_partial_unit and pretend_language parameters.
(process_psymtab_comp_unit): Use cutu_reader.
(build_type_psymtabs_reader): Remove data parameter.
(build_type_psymtabs_1): Use cutu_reader.
(process_skeletonless_type_unit): Likewise.
(load_partial_comp_unit_reader): Remove.
(load_partial_comp_unit): Use cutu_reader.
(load_full_comp_unit_reader): Remove.
(load_full_comp_unit): Use cutu_reader.
(struct create_dwo_cu_data): Remove.
(create_dwo_cu_reader): Remove datap parameter; add dwo_file and
dwo_unit parameters.
(create_cus_hash_table): Use cutu_reader.
(struct dwarf2_read_addr_index_data): Remove.
(dwarf2_read_addr_index_reader): Remove.
(dwarf2_read_addr_index): Use cutu_reader.
(read_signatured_type_reader): Remove.
(read_signatured_type): Use cutu_reader.
Change-Id: I4ef2f29e73108ce94bfe97799f8f638ed272212d
Tom Tromey [Fri, 27 Dec 2019 15:47:41 +0000 (08:47 -0700)]
Remove flickering from the TUI
In some cases, the TUI flickers when redrawing. This can be seen
mostly easily when switching layouts.
This patch fixes the problem by exploiting the double buffering that
curses already does. In some spots, the TUI will now disable flushing
the curses buffers to the screen; and then flush them all at once when
the rendering is complete.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_show_assembly): Use tui_suppress_output.
* tui/tui-wingeneral.h (class tui_suppress_output): New.
(tui_wrefresh): Declare.
* tui/tui-wingeneral.c (suppress_output): New global.
(tui_suppress_output, ~tui_suppress_output): New constructor and
destructor.
(tui_wrefresh): New function.
(tui_gen_win_info::refresh_window): Use tui_wrefresh.
(tui_gen_win_info::make_window): Call wnoutrefresh when needed.
* tui/tui-regs.h (struct tui_data_window) <no_refresh>: Declare
method.
* tui/tui-regs.c (tui_data_window::erase_data_content): Call
tui_wrefresh.
(tui_data_window::no_refresh): New method.
(tui_data_item_window::refresh_window): Call tui_wrefresh.
(tui_reg_command): Use tui_suppress_output
* tui/tui-layout.c (tui_set_layout): Use tui_suppress_output.
* tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: New
method.
* tui/tui-command.c (tui_refresh_cmd_win): Call tui_wrefresh.
Change-Id: Icb832ae100b861de3af3307488e636fa928d5c9f
Tom Tromey [Sat, 21 Dec 2019 18:14:56 +0000 (11:14 -0700)]
Make "file" clear TUI source window
I noticed that a plain "file" will leave the current source file in
the TUI source window. Instead, I think, it should clear the source
window. This patch implements this.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_line):
Handle case where symtab is null.
gdb/testsuite/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* gdb.tui/main.exp: Add check for plain "file".
Change-Id: I8424acf837f1a47f75bc6a833d1e917d4c10b51e
Simon Marchi [Sun, 19 Jan 2020 16:54:02 +0000 (11:54 -0500)]
gdb/linux-fork: simplify one_fork_p
Unless I'm missing something, this function is a complicated way of
saying "fork_list.size () == 1".
gdb/ChangeLog:
* linux-fork.c (one_fork_p): Simplify.
GDB Administrator [Sun, 19 Jan 2020 00:01:01 +0000 (00:01 +0000)]
Automatic date update in version.in
Roland McGrath [Sat, 18 Jan 2020 22:42:24 +0000 (14:42 -0800)]
Fix ld-x86-64/align-branch-1 test failure on --target=x86_64-elf
ld/ChangeLog
* testsuite/ld-x86-64/align-branch-1.d: Loosen instruction regexps
to admit whatever absolute address. The label-relative address is
what the test needs to verify.
Nick Clifton [Sat, 18 Jan 2020 14:37:55 +0000 (14:37 +0000)]
Update the notes on how to create a branch prior to a new release.
Nick Clifton [Sat, 18 Jan 2020 14:12:07 +0000 (14:12 +0000)]
Update version to 2.34.50. Regenerate configure and .pot files.
Nick Clifton [Sat, 18 Jan 2020 13:50:25 +0000 (13:50 +0000)]
Add markers for 2.34 branch to the NEWS files and ChangeLogs.
Nick Clifton [Sat, 18 Jan 2020 13:43:19 +0000 (13:43 +0000)]
Update top level config files with copies from the official repository.
2020-01-01 Ben Elliston <bje@gnu.org>
* config.guess: Update copyright years.
* config.sub: Likewise.
2019-12-21 Ben Elliston <bje@gnu.org>
* config.guess (set_cc_for_build): Prevent multiple calls by
checking if $tmp is already set. We can't check CC_FOR_BUILD as
the user may set it externally. Thanks to Torbj?rn Granlund for
the bug report.
2019-12-21 Torbj?rn Granlund <tg@gmplib.org>
* config.guess (alpha:Linux:*:*): Guard against missing
/proc/cpuinfo by redirecting standard error to /dev/null.
2019-09-12 Daniel Bittman <danielbittman1@gmail.com>
* config.guess (*:Twizzler:*:*): New.
* config.sub (-twizzler*): New.
2019-07-24 Ben Elliston <bje@gnu.org>
* config.guess (mips:OSF1:*.*): Whitespace cleanup.
2019-06-30 Ben Elliston <bje@gnu.org>
* config.sub (case $os): Match nsk* and powerunix. Don't later
match nsk* and set os=nsk which removes the OS version number.
2019-06-30 Ben Elliston <bje@gnu.org>
* config.sub: Recognise os108*.
2019-06-26 Ben Elliston <bje@gnu.org>
* config.sub (hp300): Set $os to hpux.
2019-06-26 Ben Elliston <bje@gnu.org>
* config.sub (vsta): Move into alphabetical order.
2019-06-10 Ben Elliston <bje@gnu.org>
* config.guess (*:OS108:*:*): Recognise new OS.
2019-05-28 Ben Elliston <bje@gnu.org>
* config.guess (*:Darwin:*:*): Run xcode-select to determine if a
system compiler is installed. If not, do not run set_cc_for_build,
as the default cc will open a dialog box asking to install
Xcode. If no C compiler is available, guess based on uname -p and
uname -m.
2019-05-28 Ben Elliston <bje@gnu.org>
* config.guess (*:Darwin:*:*): Simplify UNAME_PROCESSOR.
GDB Administrator [Sat, 18 Jan 2020 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 17 Jan 2020 18:40:10 +0000 (13:40 -0500)]
Make all-gdbsupport depend on all-bfd
Trying to run "make all-gdbsupport" at the top-level in a build from scratch
results in:
make[2]: Entering directory '/home/smarchi/build/binutils-gdb/gdbsupport'
CC agent.o
In file included from /home/smarchi/src/binutils-gdb/gdbsupport/common-defs.h:133,
from /home/smarchi/src/binutils-gdb/gdbsupport/agent.c:20:
/home/smarchi/src/binutils-gdb/gdbsupport/common-types.h:35:10: fatal error: bfd.h: No such file or directory
35 | #include "bfd.h"
| ^~~~~~~
Before building all-gdbsupport, we need all-bfd to run, so that bfd.h is
generated.
(Once this patch is merged in the binutils-gdb repo, I'll send it to gcc
to keep the files in sync.)
ChangeLog:
* Makefile.def: Add dependencies of all-gdbsupport on all-bfd.
* Makefile.in: Re-generate.
Christian Biesinger [Fri, 17 Jan 2020 18:34:03 +0000 (12:34 -0600)]
Fix spelling errors
seperate -> separate
bfd/ChangeLog:
2020-01-17 Christian Biesinger <cbiesinger@google.com>
* coff-arm.c: Fix spelling error (seperate).
* elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
error (seperate).
* sysdep.h (strnlen): Fix spelling error (seperate).
opcodes/ChangeLog:
2020-01-17 Christian Biesinger <cbiesinger@google.com>
* opintl.h: Fix spelling error (seperate).
sim/arm/ChangeLog:
2020-01-17 Christian Biesinger <cbiesinger@google.com>
* iwmmxt.c: Fix spelling error (seperate).
Change-Id: I55e5f47bcf3cf3533d2acb7ad338f1be0d5f30f9
Nick Clifton [Fri, 17 Jan 2020 15:56:55 +0000 (15:56 +0000)]
Fix a libiberty testsuite failure.
* testsuite/demangle-expected: Update expected demangling of
enable_if pattern.
Thomas Troeger [Fri, 17 Jan 2020 15:27:31 +0000 (15:27 +0000)]
Improve the performance of the ascii art jump visualizer.
* objdump.c (jump_info_visualize_address): Discard jumps that are
no longer needed.
(disassemble_bytes): Only compute the maximum level if jumps were
detected.
Pedro Alves [Wed, 15 Jan 2020 21:55:29 +0000 (21:55 +0000)]
Fix gdbsupport build on compilers that don't default to C++11 or above
gdbsupport fails to build with compilers that don't default to C++11
or above. gdbsupport's configure.ac is already using
AX_CXX_COMPILE_STDCXX, which sets CXX_DIALECT to the -std=gnu++11
switch if necessary, but the problem is that nowhere are we using
CXX_DIALECT. This fixes it.
gdbsupport/ChangeLog:
2020-01-17 Pedro Alves <palves@redhat.com>
* Makefile.am: Append CXX_DIALECT to CXX.
* Makefile.in: Regenerate.
Pedro Alves [Fri, 17 Jan 2020 15:14:56 +0000 (15:14 +0000)]
Fix gdbsupport build
I'm seeing this on F27 (a clean build from scratch):
~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport'
CC gdb_tilde_expand.o
In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0,
from ../gnulib/import/glob.h:544,
from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22:
../bfd/config.h:7:4: error: #error config.h must be #included before system headers
# error config.h must be #included before system headers
^~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
libc-config.h, where it includes config.h, says:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* This is intended to be a good-enough substitute for glibc system
macros like those defined in <sys/cdefs.h>, so that Gnulib code
shared with glibc can do this as the first #include:
#ifndef _LIBC
# include <libc-config.h>
#endif
When compiled as part of glibc this is a no-op; when compiled as
part of Gnulib this includes Gnulib's <config.h> and defines macros
that glibc library code would normally assume. */
#include <config.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The issue is that that '#include <config.h>' picks up bfd's config.h
instead of gnulib's.
This problem doesn't trigger in the gdb dir because there we generate
config.h under that exact name so gnulib's libc-config.h ends up
picking gdb's config.h instead of gnulib.c and that ends up harmless.
In gdbsupport, the config.h file is really named support-config.h, so
that '#include <config.h>' in libc-config.h doesn't pick it like it
would if it had the conventional config.h name.
This patch fixes it by simply renaming gdbserver's support-config.h to
config.h.
gdbsupport/ChangeLog:
2020-01-17 Pedro Alves <palves@redhat.com>
* configure.ac: Generate config.h instead of support-config.h.
* common-defs.h: Include <gdbsupport/config.h> instead of
<gdbsupport/support-config.h>.
* Makefile.in: Regenerate.
* configure: Regenerate.
H.J. Lu [Fri, 17 Jan 2020 15:07:55 +0000 (07:07 -0800)]
x86: Add {vex} pseudo prefix
There are 2-byte VEX prefix and 3-byte VEX prefix. 2-byte VEX prefix
can't encode all operands. By default, assembler tries 2-byte VEX prefix
first. {vex3} can be used to force 3-byte VEX prefix. This patch adds
{vex} pseudo prefix and keeps {vex2} for backward compatibility.
gas/
* config/tc-i386.c (_i386_insn): Replace vex_encoding_vex2
with vex_encoding_vex.
(parse_insn): Likewise.
* doc/c-i386.texi: Replace {vex2} with {vex}. Update {vex}
and {vex3} documentation.
* testsuite/gas/i386/pseudos.s: Replace 3 {vex2} tests with
{vex}.
* testsuite/gas/i386/x86-64-pseudos.s: Likewise.
opcodes/
* i386-opc.tbl: Add {vex} pseudo prefix.
* i386-tbl.h: Regenerated.
Simon Marchi [Fri, 17 Jan 2020 14:58:57 +0000 (09:58 -0500)]
gdb: remove uses of iterate_over_inferiors in top.c
Replace with range-based for loops.
gdb/ChangeLog:
* top.c (struct qt_args): Remove.
(kill_or_detach): Change return type to void, replace `void *`
parameter with a proper one.
(print_inferior_quit_action): Likewise.
(quit_confirm): Use range-based for loop to iterate over inferiors.
(quit_force): Likewise.
Simon Marchi [Fri, 17 Jan 2020 14:57:58 +0000 (09:57 -0500)]
gdb: remove uses of iterate_over_inferiors in mi/mi-main.c
Replace with range-based loops.
gdb/ChangeLog:
* mi/mi-main.c (run_one_inferior): Change return type to void, replace
`void *` parameter with proper parameters.
(mi_cmd_exec_run): Use range-based loop to iterate over inferiors.
(print_one_inferior): Change return type to void, replace `void *`
parameter with proper parameters.
(mi_cmd_list_thread_groups): Use range-based loop to iterate over
inferiors.
(get_other_inferior): Remove.
(mi_cmd_remove_inferior): Use range-based loop to iterate over
inferiors.
Simon Marchi [Fri, 17 Jan 2020 14:57:07 +0000 (09:57 -0500)]
gdb: remove use of iterate_over_inferiors in mi/mi-interp.c
Replace it with a range-based for. I've updated the comment in
mi_interp::init, which was a bit stale.
gdb/ChangeLog:
* mi/mi-interp.c (report_initial_inferior): Remove.
(mi_interp::init): Use range-based for to iterate over inferiors.
Simon Marchi [Fri, 17 Jan 2020 14:51:10 +0000 (09:51 -0500)]
gdb: remove use of iterate_over_inferiors in py-inferior.c
Use range-based for instead of iterate_over_inferiors in one spot in the Python
code.
gdb/ChangeLog:
* python/py-inferior.c (build_inferior_list): Remove.
(gdbpy_ref): Use range-based for loop to iterate over inferiors.
Andre Vieira [Fri, 17 Jan 2020 14:19:35 +0000 (14:19 +0000)]
Forgot to add testcases to commit for [binutils][arm] PR25376 Change MVE ...
The original commit was
2da2eaf4ce299c84c5a1f1bc6f7944266cb36d6e
Nick Clifton [Fri, 17 Jan 2020 14:13:22 +0000 (14:13 +0000)]
Update libiberty sources with changes in the gcc mainline.
+2020-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ Update copyright years.
+
+2019-12-06 Tim Ruehsen <tim.ruehsen@gmx.de>
+
+ * make-relative-prefix.c (split_directories):
+ Return early on empty 'name'
+
+2019-11-16 Tim Ruehsen <tim.ruehsen@gmx.de>
+
+ * cp-demangle.c (d_print_init): Remove const from 4th param.
+ (cplus_demangle_fill_name): Initialize d->d_counting.
+ (cplus_demangle_fill_extended_operator): Likewise.
+ (cplus_demangle_fill_ctor): Likewise.
+ (cplus_demangle_fill_dtor): Likewise.
+ (d_make_empty): Likewise.
+ (d_count_templates_scopes): Remobe const from 3rd param,
+ Return on dc->d_counting > 1,
+ Increment dc->d_counting.
+ * cp-demint.c (cplus_demangle_fill_component): Initialize d->d_counting.
+ (cplus_demangle_fill_builtin_type): Likewise.
+ (cplus_demangle_fill_operator): Likewise.
+
+2019-11-16 Eduard-Mihai Burtescu <eddyb@lyken.rs>
+
+ * cplus-dem.c (cplus_demangle): Use rust_demangle directly.
+ (rust_demangle): Remove.
+ * rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash.
+ (parse_lower_hex_nibble): Rename to decode_lower_hex_nibble.
+ (parse_legacy_escape): Rename to decode_legacy_escape.
+ (rust_is_mangled): Remove.
+ (struct rust_demangler): Add.
+ (peek): Add.
+ (next): Add.
+ (struct rust_mangled_ident): Add.
+ (parse_ident): Add.
+ (rust_demangle_sym): Remove.
+ (print_str): Add.
+ (PRINT): Add.
+ (print_ident): Add.
+ (rust_demangle_callback): Add.
+ (struct str_buf): Add.
+ (str_buf_reserve): Add.
+ (str_buf_append): Add.
+ (str_buf_demangle_callback): Add.
+ (rust_demangle): Add.
+ * rust-demangle.h: Remove.
+
+2019-11-15 Miguel Saldivar <saldivarcher@gmail.com>
+
+ * testsuite/demangle-expected: Fix test.
+
+2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
+
+ * cp-demangle.c (d_expr_primary): Handle
+ nullptr demangling.
+ * testsuite/demangle-expected: Added test.
+
+2019-10-29 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * cp-demangle.c (d_number): Avoid signed int overflow.
+
+2019-10-28 Miguel Saldivar <saldivarcher@gmail.com>
+
+ * cp-demangle.c (d_print_mod): Add a space before printing `complex`
+ and `imaginary`, as opposed to after.
+ * testsuite/demangle-expected: Adjust test.
+
+2019-10-03 Eduard-Mihai Burtescu <eddyb@lyken.rs>
+
+ * rust-demangle.c (looks_like_rust): Remove.
+ (rust_is_mangled): Don't check escapes.
+ (is_prefixed_hash): Allow 0-9a-f permutations.
+ (rust_demangle_sym): Don't bail on unknown escapes.
+ * testsuite/rust-demangle-expected: Update 'main::$99$' test.
+
+2019-09-03 Eduard-Mihai Burtescu <eddyb@lyken.rs>
+
+ * rust-demangle.c (unescape): Remove.
+ (parse_lower_hex_nibble): New function.
+ (parse_legacy_escape): New function.
+ (is_prefixed_hash): Use parse_lower_hex_nibble.
+ (looks_like_rust): Use parse_legacy_escape.
+ (rust_demangle_sym): Use parse_legacy_escape.
+ * testsuite/rust-demangle-expected: Add 'llv$u6d$' test.
+
+2019-08-27 Martin Liska <mliska@suse.cz>
+
+ PR lto/91478
+ * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
+ First find a WEAK HIDDEN symbol in symbol table that will be
+ preserved. Later, use the symbol name for all removed symbols.
+
+2019-08-12 Martin Liska <mliska@suse.cz>
+
+ * Makefile.in: Add filedescriptor.c.
+ * filedescriptor.c: New file.
+ * lrealpath.c (is_valid_fd): Remove.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index
0be45b4ae8..
fe738d0db4 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -1,7 +1,7 @@
# Makefile for the libiberty library.
# Originally written by K. Richard Pixley <rich@cygnus.com>.
#
-# Copyright (C) 1990-2019 Free Software Foundation, Inc.
+# Copyright (C) 1990-2020 Free Software Foundation, Inc.
#
# This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or
@@ -127,7 +127,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
cp-demint.c cplus-dem.c crc32.c \
d-demangle.c dwarfnames.c dyn-string.c \
- fdmatch.c ffs.c fibheap.c filename_cmp.c floatformat.c \
+ fdmatch.c ffs.c fibheap.c filedescriptor.c filename_cmp.c floatformat.c \
fnmatch.c fopen_unlocked.c \
getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
gettimeofday.c \
@@ -171,6 +171,7 @@ REQUIRED_OFILES = \
./cp-demint.$(objext) ./crc32.$(objext) ./d-demangle.$(objext) \
./dwarfnames.$(objext) ./dyn-string.$(objext) \
./fdmatch.$(objext) ./fibheap.$(objext) \
+ ./filedescriptor.$(objext) \
./filename_cmp.$(objext) ./floatformat.$(objext) \
./fnmatch.$(objext) ./fopen_unlocked.$(objext) \
./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \
@@ -756,6 +757,17 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
else true; fi
$(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION)
+./filedescriptor.$(objext): $(srcdir)/filedescriptor.c config.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/libiberty.h
+ if [ x"$(PICFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(srcdir)/filedescriptor.c -o pic/$@; \
+ else true; fi
+ if [ x"$(NOASANFLAG)" != x ]; then \
+ $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/filedescriptor.c -o noasan/$@; \
+ else true; fi
+ $(COMPILE.c) $(srcdir)/filedescriptor.c $(OUTPUT_OPTION)
+
+
./filename_cmp.$(objext): $(srcdir)/filename_cmp.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/safe-ctype.h
diff --git a/libiberty/_doprnt.c b/libiberty/_doprnt.c
index
d44dc415ed..
a739f4304f 100644
--- a/libiberty/_doprnt.c
+++ b/libiberty/_doprnt.c
@@ -1,5 +1,5 @@
/* Provide a version of _doprnt in terms of fprintf.
- Copyright (C) 1998-2019 Free Software Foundation, Inc.
+ Copyright (C) 1998-2020 Free Software Foundation, Inc.
Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
This program is free software; you can redistribute it and/or modify it
diff --git a/libiberty/argv.c b/libiberty/argv.c
index
6444896f99..
8c9794db6a 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -1,5 +1,5 @@
/* Create and destroy argument vectors (argv's)
- Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ Copyright (C) 1992-2020 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support
This file is part of the libiberty library.
diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c
index
5718682f69..
6e38e2234d 100644
--- a/libiberty/asprintf.c
+++ b/libiberty/asprintf.c
@@ -1,6 +1,6 @@
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller.
- Copyright (C) 1997-2019 Free Software Foundation, Inc.
+ Copyright (C) 1997-2020 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
This file is part of the libiberty library.
diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c
index
72c1b710bd..
49a2faaa51 100644
--- a/libiberty/choose-temp.c
+++ b/libiberty/choose-temp.c
@@ -1,5 +1,5 @@
/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
diff --git a/libiberty/clock.c b/libiberty/clock.c
index
a3730714bd..
0de74657d0 100644
--- a/libiberty/clock.c
+++ b/libiberty/clock.c
@@ -1,5 +1,5 @@
/* ANSI-compatible clock function.
- Copyright (C) 1994-2019 Free Software Foundation, Inc.
+ Copyright (C) 1994-2020 Free Software Foundation, Inc.
This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the
diff --git
GDB Administrator [Fri, 17 Jan 2020 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Thu, 16 Jan 2020 22:41:53 +0000 (16:41 -0600)]
Fix some spelling errors.
I noticed those from a lintian run:
https://salsa.debian.org/cbiesinger-guest/gdb/-/jobs/514119
gdb/ChangeLog:
2020-01-16 Christian Biesinger <cbiesinger@google.com>
* btrace.c (btrace_compute_ftrace_1): Fix spelling error (Unkown).
(btrace_stitch_trace): Likewise.
* charset.c (intermediate_encoding): Likewise (vaild).
* nat/linux-btrace.c (linux_read_pt): Likewise (Unkown).
* python/py-record-btrace.c (struct PyMethodDef): Likewise (occurences).
* record-btrace.c (record_btrace_print_conf): Likewise (unkown).
gdb/testsuite/ChangeLog:
2020-01-16 Christian Biesinger <cbiesinger@google.com>
* lib/gdb.exp: Fix spelling error (seperatelly).
Change-Id: I2a44936bac295020f217fb6c78b99b0a8d09cf9a
Hannes Domani [Mon, 23 Dec 2019 15:38:13 +0000 (16:38 +0100)]
Add type for $_tlb->process_environment_block->process_parameters
The type then looks like this:
(gdb) pt $_tlb->process_environment_block->process_parameters
type = struct rtl_user_process_parameters {
DWORD32 maximum_length;
DWORD32 length;
DWORD32 flags;
DWORD32 debug_flags;
void *console_handle;
DWORD32 console_flags;
void *standard_input;
void *standard_output;
void *standard_error;
unicode_string current_directory;
void *current_directory_handle;
unicode_string dll_path;
unicode_string image_path_name;
unicode_string command_line;
void *environment;
DWORD32 starting_x;
DWORD32 starting_y;
DWORD32 count_x;
DWORD32 count_y;
DWORD32 count_chars_x;
DWORD32 count_chars_y;
DWORD32 fill_attribute;
DWORD32 window_flags;
DWORD32 show_window_flags;
unicode_string window_title;
unicode_string desktop_info;
unicode_string shell_info;
unicode_string runtime_data;
} *
It's mainly useful to get the current directory, or the full command line:
(gdb) p $_tlb->process_environment_block->process_parameters->current_directory
$1 = {
length = 26,
maximum_length = 520,
buffer = 0xe36c8 L"C:\\src\\tests\\"
}
(gdb) p $_tlb->process_environment_block->process_parameters->command_line
$2 = {
length = 94,
maximum_length = 96,
buffer = 0xe32aa L"\"C:\\gdb\\build64\\gdb-git\\gdb\\gdb.exe\" access.exe"
}
The type names are all lowercase because the existing types created
by windows_get_tlb_type are also lowercase.
Type unicode_string is documented at [1].
The official documentation [2] for rtl_user_process_parameters is limited,
so I've used this other page [3].
[1] https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_unicode_string
[2] https://docs.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-rtl_user_process_parameters
[3] https://www.nirsoft.net/kernel_struct/vista/RTL_USER_PROCESS_PARAMETERS.html
gdb/ChangeLog:
2020-01-16 Hannes Domani <ssbssa@yahoo.de>
* windows-tdep.c (windows_get_tlb_type):
Add rtl_user_process_parameters type.
Pedro Alves [Thu, 16 Jan 2020 18:35:30 +0000 (18:35 +0000)]
Ensure proc-service symbols have default visibility (PR build/24805)
Compiling GDB with '-fvisibility=hidden' removes the symbols that
should be exported.
This patch explicitly marks them as visible.
gdb/ChangeLog:
2020-01-16 Pedro Alves <palves@redhat.com>
Norbert Lange <nolange79@gmail.com>
PR build/24805
* gdbsupport/gdb_proc_service.h (PS_EXPORT): New.
(ps_get_thread_area, ps_getpid, ps_lcontinue, ps_lgetfpregs)
(ps_lgetregs, ps_lsetfpregs, ps_lsetregs, ps_lstop, ps_pcontinue)
(ps_pdread, ps_pdwrite, ps_pglobal_lookup, ps_pstop, ps_ptread)
(ps_ptwrite, ps_lgetxregs, ps_lgetxregsize, ps_lsetxregs)
(ps_plog): Redeclare exported functions with default visibility.
Pedro Alves [Thu, 16 Jan 2020 18:11:06 +0000 (18:11 +0000)]
[gdb] Move ChangeLog entries to their right files
I spotted a few misplaced entries in the ChangeLog-2019 entries, and
went on to fix them.
Looking around I saw a good number of other entries in other years.
Then OCD got the best of me and I fixed them all.
Also fixes cases of wrong paths in entries, like "* gdb/foo.c" instead
of "* foo.c".
Nitika Achra [Thu, 16 Jan 2020 16:51:06 +0000 (11:51 -0500)]
Support for DWARF5 location lists entries
This patch handles DW_LLE_base_addressx, DW_LLE_startx_length and
DW_LLE_start_length.
Tested by running the testsuite before and after the patch and there is
no increase in the number of test cases that fails. Tested with both
-gdwarf-4 and -gdwarf-5 flags. Also tested -gslit-dwarf along with
-gdwarf-4 as well as -gdwarf5 flags.
This is an effort to support DWARF5 in gdb.
gdb/ChangeLog:
* dwarf2loc.c (decode_debug_loclists_addresses): Handle
DW_LLE_base_addressx, DW_LLE_startx_length, DW_LLE_start_length.
Andre Vieira [Thu, 16 Jan 2020 13:50:52 +0000 (13:50 +0000)]
[binutils][arm] PR25376 Change MVE into a CORE_HIGH feature
This patch moves MVE feature bits into the CORE_HIGH section. This makes sure
.fpu and -mfpu does not reset the bits set by MVE. This is important because
.fpu has no option to "set" these same bits and thus, mimic'ing GCC, we choose
to define MVE as an architecture extension rather than put it together with
other the legacy fpu features.
This will enable the following behavior:
.arch armv8.1-m.main
.arch mve
.fpu fpv5-sp-d16 #does not disable mve.
vadd.i32 q0, q1, q2
This patch also makes sure MVE is not taken into account during auto-detect.
This was already the case, but because we moved the MVE bits to the
architecture feature space we must make sure ARM_ANY does not include MVE.
gas/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* config/tc-arm.c (mve_ext, mve_fp_ext): Use CORE_HIGH.
(armv8_1m_main_ext_table): Use CORE_HIGH for mve.
* testsuite/arm/armv8_1-m-fpu-mve-1.s: New.
* testsuite/arm/armv8_1-m-fpu-mve-1.d: New.
* testsuite/arm/armv8_1-m-fpu-mve-2.s: New.
* testsuite/arm/armv8_1-m-fpu-mve-2.d: New.
include/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* opcodes/arm.h (FPU_MVE, FPU_MVE_FPU): Move these features to...
(ARM_EXT2_MVE, ARM_EXT2_MVE_FP): ... the CORE_HIGH space.
(ARM_ANY): Redefine to not include any MVE bits.
(ARM_FEATURE_ALL): Removed.
opcodes/ChangeLog:
2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376
* opcodes/arm-dis.c (coprocessor_opcodes): Use CORE_HIGH for MVE bits.
(neon_opcodes): Likewise.
(select_arm_features): Make sure we enable MVE bits when selecting
armv8.1-m.main. Make sure we do not enable MVE bits when not selecting
any architecture.
Jozef Lawrynowicz [Thu, 16 Jan 2020 13:44:21 +0000 (13:44 +0000)]
MSP430: Remove unused linker script template elf32msp430_3.sc
ld/ChangeLog:
2020-01-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* scripttempl/elf32msp430_3.sc: Remove.
Jozef Lawrynowicz [Thu, 16 Jan 2020 11:32:23 +0000 (11:32 +0000)]
MSP430: Add input section rules for .upper sections to default linker script
ld/ChangeLog:
2020-01-16 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* scripttempl/elf32msp430.sc: Add input section rules for
.upper.{text,data,rodata,bss}.
* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
* testsuite/ld-msp430-elf/upper-input-sections.s: New test.
Jan Beulich [Thu, 16 Jan 2020 09:07:36 +0000 (10:07 +0100)]
x86: drop found_cpu_match local variable
50aecf8c5f could have done so right away; perhaps the variable shouldn't
have been introduced in the first place.
Jan Beulich [Thu, 16 Jan 2020 09:07:05 +0000 (10:07 +0100)]
x86: drop stale Vec_Imm4 related comment
I overlooked this in commit
9d3bf266fd ("x86: drop Vec_Imm4"), presumably
because of the mis-spelling.
Jan Beulich [Thu, 16 Jan 2020 09:06:21 +0000 (10:06 +0100)]
x86: add a few more missing VexWIG
Alternatively it could also be VexW0 (to match other SSE2AVX), but the
VexW attribute shouldn't be left unset.
Jan Beulich [Thu, 16 Jan 2020 09:05:35 +0000 (10:05 +0100)]
x86: VPEXTRQ/VPINSRQ are unavailable outside of 64-bit mode
The AVX512DQ patterns lacking a Cpu64 attribute made the memory operand
forms accepted even outside of 64-bit mode, and this even without any
{evex} pseudo-prefix (otherwise one could argue that this is an attempt
to follow one possible, albeit somewhat odd, interpretation of the SDM
wording to this effect).
For consistency between the various involved templates drop the
* (now) unnecessary IgnoreSize attributes
* unnecessary (due to VexW1) Size64 attributes from VEX encoded forms
* redundant (with Reg64) Qword operand attributes
uniformly.
GDB Administrator [Thu, 16 Jan 2020 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 15 Jan 2020 17:58:08 +0000 (12:58 -0500)]
texi2pod.pl: import support for @t{...} from gcc
GDB's man page source (in gdb.texinfo) contains:
@t{++}
The @t{...} part is supposed to display the wrapped text with a
fixed-width font. The texi2pod.pl script currently doesn't handle
@t{...}, so it appears as-is in the man page:
You can use GDB to debug programs written in C, C@t{++}, Fortran and Modula-2.
gcc's version of texi2pod.pl (at contrib/texi2pod.pl in gcc's repo)
replaces @t{...} with the wrapped text as-is, which I think is an
acceptable behavior. The fixed-width font distinction is not really
important for a man page, where the text will be displayed with whatever
font the user is using.
Import the line that does that from gcc's version.
I have verified that there is no other, unwanted change in man pages
generated in binutils' and GDB's doc, with this patch applied.
etc/ChangeLog:
* texi2pod.pl: Handle @t{...} tags.
Simon Marchi [Wed, 15 Jan 2020 17:47:44 +0000 (12:47 -0500)]
Use get_thread_regcache instead of get_current_regcache in post_create_inferior
In post_create_inferior, we get the current thread using the
inferior_thread function and store it in `thr`. We then call
get_current_regcache immediately after, which does:
return get_thread_regcache (inferior_thread ());
This patch makes post_create_inferior use get_thread_regcache, passing
`thr`, saving an unnecessary inferior_thread call.
gdb/ChangeLog:
* infcmd.c (post_create_inferior): Use get_thread_regcache
instead of get_current_regcache.
Lars Brinkhoff [Wed, 15 Jan 2020 14:18:54 +0000 (14:18 +0000)]
Set the default page size of the PDP11 target to 8192 bytes.
PR 20694
bfd * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
ld * temulparams/pdp11.sh (TARGET_PAGE_SIZE): Set to 8192.
Alan Modra [Wed, 15 Jan 2020 05:37:16 +0000 (16:07 +1030)]
tic4x disassembly static variables
tic4x uses a number of static variables for tables that are generated
depending on the current machine (tic4x vs. tic3x). However, it is
possible to change the machine from one invocation of print_insn_tic4x
to the next. This patch throws away the old state if that happens,
and uses a relatively small known size array of register names rather
than a malloc'd table.
* tic4x-dis.c (tic4x_version): Make unsigned long.
(optab, optab_special, registernames): New file scope vars.
(tic4x_print_register): Set up registernames rather than
malloc'd registertable.
(tic4x_disassemble): Delete optable and optable_special. Use
optab and optab_special instead. Throw away old optab,
optab_special and registernames when info->mach changes.