Alan Hayward [Wed, 21 Aug 2019 14:05:40 +0000 (15:05 +0100)]
Refactor svr4_create_solib_event_breakpoints
Move the bulk of svr4_create_solib_event_breakpoints into a new
function to simplify the logic. No functional changes.
gdb/ChangeLog:
* solib-svr4.c (svr4_find_and_create_probe_breakpoints): Move
code to here...
(svr4_create_solib_event_breakpoints): ...from here.
Alan Modra [Mon, 2 Sep 2019 07:18:44 +0000 (16:48 +0930)]
Re: Memory leak in dwarf2.c
PR 11983
* dwarf2.c (read_alt_indirect_string): Free debug_filename
on success. Tidy.
(read_alt_indirect_ref): Likewise.
Alan Modra [Mon, 2 Sep 2019 00:24:55 +0000 (09:54 +0930)]
Memory leak in dwarf2.c
This fixes a small leak of debug_filename. bfd_openr copies the file
name since git commit
1be5090bca.
PR 11983
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename
on success. Tidy.
GDB Administrator [Mon, 2 Sep 2019 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sun, 1 Sep 2019 04:22:36 +0000 (21:22 -0700)]
RISC-V: Fix linker problems with tls copy relocs.
The linker doesn't allocate memory space for sections that are only SEC_ALLOC
and SEC_THREAD_LOCAL. See the IS_TBSS test in ld/ldlang.c. So we need to
pretend that .tdata.dyn sections have contents to get the right result. It
will be marked this way anyways if there is a .tdata section to merge with.
bfd/
PR 23825
* elfnn-riscv.c (riscv_elf_create_dynamic_sections): Add SEC_LOAD,
SEC_DATA, and SEC_HAS_CONTENTS to .tdata.dyn section.
GDB Administrator [Sun, 1 Sep 2019 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 31 Aug 2019 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Fri, 30 Aug 2019 22:14:36 +0000 (15:14 -0700)]
RISC-V: Force linker error exit after unresolvable reloc.
This was noticed while trying to test the compiler -msave-restore support.
Putting non-pic code in a shared library gives a linker error, but doesn't
stop the build.
rohan:2030$ cat libtmp.c
extern int sub2 (int);
int sub (int i) { return sub2 (i + 10); }
rohan:2031$ cat libtmp2.c
extern int sub (int);
int sub2 (int i) { return sub (i + 10); }
rohan:2032$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp.so libtmp.c
rohan:2033$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp2.so libtmp2.c libtmp.so
/home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-linux-gnu/8.3.0/../../../../riscv64-unknown-linux-gnu/bin/ld: /tmp/cctrsIBe.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub'
rohan:2034$ echo $?
0
rohan:2035$ ls -lt libtmp2.so
-rwxr-xr-x 1 jimw jimw 6912 Aug 30 14:32 libtmp2.so
rohan:2036$
The patch fixes this by forcing a linker error. I now get this.
ohan:2059$ sh tmp.script
/home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: libtmp2.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub'
/home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: final link failed: bad value
rohan:2060$ echo $?
1
rohan:2061$ ls -lt libtmp2.so
ls: cannot access 'libtmp2.so': No such file or directory
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): For unresolvable reloc
error, call bfd_set_error, set ret to FALSE, and goto out label.
Sergio Durigan Junior [Thu, 29 Aug 2019 20:11:45 +0000 (16:11 -0400)]
Remove "\nError: " suffix from nat/fork-inferior.c:trace_start_error warning message
Rationale: https://sourceware.org/ml/gdb-patches/2019-08/msg00651.html
This very simple patch removes the "\nError: " suffix from the warning
message printed by nat/fork-inferior.c:trace_start_error. This proved
to just pollute the screen, causing things like:
Starting program: /usr/bin/true
warning: Could not trace the inferior process.
Error:
warning: ptrace: Permission denied
This "Error: " string is not useful at all, and can confuse things,
therefore let's just remove it and simplify the resulting messages:
Starting program: /usr/bin/true
warning: Could not trace the inferior process.
warning: ptrace: Permission denied
gdb/ChangeLog:
2019-08-30 Sergio Durigan Junior <sergiodj@redhat.com>
* nat/fork-inferior.c (trace_start_error): Remove "\nError: "
suffix from warning message.
Tom Tromey [Thu, 18 Jul 2019 20:38:39 +0000 (14:38 -0600)]
Remove tui_win_info::refresh_all
The TUI has two duplicate "re-render this window" methods, "rerender"
and "refresh_all". They differ only slightly in semantics, so I
wanted to see if they could be unified.
After looking into this, I decided that refresh_all was not needed.
There are 4 calls to tui_refresh_all_win (the only caller of this
method):
1. tui_enable. This sets the layout, which renders the windows.
2. tui_cont_sig. Here, I think it's sufficient to simply redraw the
current window contents from the curses backing store, because gdb
state didn't change while it was suspended
3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's
explicitly enough to just refresh the screen (as above).
4. tui_refresh_all_command. This is the command equivalent of C-l.
So, this patch removes this method entirely and simplifies
tui_refresh_all_win.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_base)
<refresh_all>: Don't declare.
* tui/tui-winsource.c (tui_source_window_base::refresh_all):
Remove.
* tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or
tui_show_locator_content.
* tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't
declare.
* tui/tui-regs.c (tui_data_window::refresh_all): Remove.
* tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't
declare.
Tom Tromey [Thu, 18 Jul 2019 20:34:39 +0000 (14:34 -0600)]
Don't call wrefresh from tui_cont_sig
tui_cont_sig does not need to call wrefresh, because this is already
done by tui_refresh_all_win.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-io.c (tui_cont_sig): Don't call wrefresh.
Tom Tromey [Thu, 18 Jul 2019 20:12:31 +0000 (14:12 -0600)]
Minor rearrangement of tui-stack.c
This move _initialize_tui_stack to the end of tui-stack.c, per the gdb
style; and then removes two unnecessary forward declarations.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (_initialize_tui_stack): Move later.
Remove unnecessary forward declarations.
Tom Tromey [Thu, 18 Jul 2019 20:08:53 +0000 (14:08 -0600)]
Make tui_locator_window::set_locator_fullname re-render
This changes tui_locator_window::set_locator_fullname to re-render the
locator window, so that the callers don't need to do this.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_locator_window::set_locator_fullname): Call
rerender.
(tui_update_locator_fullname, tui_show_frame_info): Don't call
tui_show_locator_content.
Tom Tromey [Thu, 18 Jul 2019 20:04:14 +0000 (14:04 -0600)]
Swap tui_show_locator_content and tui_locator_window::rerender
This swaps the bodies ot tui_show_locator_content and
tui_locator_window::rerender, so that the latter does the work, and
the former is now just an exported convenience wrapper.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_show_locator_content): Move lower. Rewrite.
(tui_locator_window::rerender): Rewrite using body of previous
tui_show_locator_content.
Tom Tromey [Thu, 18 Jul 2019 20:01:56 +0000 (14:01 -0600)]
Turn two locator functions into methods
This changes tui_set_locator_fullname and tui_set_locator_info to be
methods on tui_locator_window. This enables some subsequent
cleannups.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-stack.h (struct tui_locator_window) <set_locator_info,
set_locator_fullname>: New methods.
* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
Rename from tui_set_locator_fullname.
(tui_locator_window::set_locator_info): Rename from
tui_set_locator_info. Return bool.
(tui_update_locator_fullname, tui_show_frame_info): Update.
Tom Tromey [Thu, 18 Jul 2019 19:46:23 +0000 (13:46 -0600)]
Don't call tui_refresh_all from show_layout
show_layout calls tui_refresh_all in one case. However, it doesn't
need to any more, because the resize method on each window will also
update the contents.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (show_layout): Don't call tui_refresh_all.
Tom Tromey [Wed, 17 Jul 2019 22:11:40 +0000 (16:11 -0600)]
Don't call touchwin in tui_gen_win_info::refresh_window
The call to touchwin in tui_gen_win_info::refresh_window was an
artifact of some earlier refactorings. Testing shows it isn't needed
any more -- I believe it was only ever needed for the data item window
display problem; but that's been solved more locally.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Don't
call touchwin.
Tom Tromey [Mon, 15 Jul 2019 21:59:53 +0000 (15:59 -0600)]
Remove NULL checks from box_win
box_win can't be called with a NULL window, or with an invisible
window. So, the NULL checks in that function can be removed.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Assume win_info and
win_info->handle cannot be NULL.
Tom Tromey [Mon, 15 Jul 2019 21:28:56 +0000 (15:28 -0600)]
Simplify register display
This patch starts with the observation that the code in
tui_data_window::display_registers_from can all be replaced with a
call to resize. To make this work propertly, it also changes
tui_display_register to be the "rerender" method on
tui_data_item_window.
The refresh_window method is needed due to the use of nested windows
here. The ncurses man page makes it sound like this is not very well
supported; and experience bears this out: negelecting the touchwin
call in this path will cause the register window to blank when
switching focus.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_item_window) <rerender,
refresh_window>: Declare.
* tui/tui-regs.c (tui_data_window::display_registers_from): Call
resize.
(tui_data_item_window::rerender): Rename from
tui_display_register.
(tui_data_item_window::refresh_window): New method.
* tui/tui-layout.c (tui_gen_win_info::resize): Do nothing on
no-op.
Tom Tromey [Mon, 15 Jul 2019 01:45:55 +0000 (19:45 -0600)]
Private data members in tui_data_window
This changes tui_data_window so that the data members are private.
This required the addition of a simple accessor method in one case.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <regs_content,
regs_column_count, current_group>: Move later. Now private.
<get_current_group>: New method.
* tui/tui-regs.c (tui_reg_command): Update.
* tui/tui-layout.c (tui_set_layout): Update.
Tom Tromey [Sun, 14 Jul 2019 15:11:46 +0000 (09:11 -0600)]
Remove some calls in tui_data_window
This patch removes a call to erase_data_content in refresh_all and
then removes some other calls that are more clearly unnecessary once
one follows calls from that point.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::display_registers_from_line)
(tui_data_window::rerender): Don't call
check_and_display_highlight_if_needed.
(tui_data_window::refresh_all): Remove call to
erase_data_content.
Tom Tromey [Sun, 14 Jul 2019 15:07:10 +0000 (09:07 -0600)]
Remove some checks of .empty()
A few methods in tui_data_window check whether the contents are empty;
but all the callers already check this, so these calls can be removed.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::last_regs_line_no)
(tui_data_window::display_registers_from)
(tui_data_window::display_reg_element_at_line)
(tui_data_window::display_registers_from_line): Remove checks of
"empty".
Tom Tromey [Sun, 14 Jul 2019 14:27:34 +0000 (08:27 -0600)]
Remove tui_data_window::display_all_data
tui_data_window::rerender clears the data item windows, and then calls
display_all_data. However, that method only does anything if the
contents are not empty. So, display_all_data can be renamed and the
wrapper removed.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <display_all_data>:
Don't declare.
* tui/tui-regs.c (tui_data_window::show_registers): Call
rerender.
(tui_data_window::rerender): Rename from display_all_data.
(tui_data_window::rerender): Remove old implementation.
Tom Tromey [Sun, 14 Jul 2019 14:21:16 +0000 (08:21 -0600)]
Remove NO_DATA_STRING
NO_DATA_STRING shouldn't be used. It's referenced in a single spot,
in tui_data_window::display_all_data. This patch removes the use and
replaces it with the more correct text. A later patch (though not in
this series) will remove this call entirely, when it's more obviously
correct to do so.
gdb/ChangeLog
2019-08-30 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_data_window::display_all_data): Change
text.
* tui/tui-data.h (NO_DATA_STRING): Remove define.
H.J. Lu [Fri, 30 Aug 2019 14:46:15 +0000 (07:46 -0700)]
Copy BFD_COMPRESS/BFD_DECOMPRESS/BFD_COMPRESS_GABI for thin archive
We need to copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI flags
for thin archive.
PR ld/24951
* archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS,
BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive.
Srinath Parvathaneni [Fri, 30 Aug 2019 09:44:18 +0000 (10:44 +0100)]
[PATCH][ARM][GAS]: Assembler support to interpret MVE VMOV instruction correctly.
This patch make changes to the assembler to encode MVE VMOV instruction "a" same as "b".
a: VMOV<c><q> <Dd>, <Dm>
b: VMOV<c><q>.F64 <Dd>, <Dm>
gas/ChangeLog:
2019-08-30 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* config/tc-arm.c (do_neon_mov): Modify "if" statement.
* testsuite/gas/arm/mve-vmov-bad-3.d: New test.
* testsuite/gas/arm/mve-vmov-bad-3.l: Likewise.
* testsuite/gas/arm/mve-vmov-bad-3.s: Likewise.
Claudiu Zissulescu [Fri, 30 Aug 2019 08:31:19 +0000 (11:31 +0300)]
[ARC] [COMMITTED] Fix FASTMATH field.
Move FASTMATH to the right enum.
2019-08-30 Claudiu Zissulescu <claziss@gmail.com>
* opcode/arc.h (FASTMATH): Move it from insn_class_t to
insn_subclass_t enum.
GDB Administrator [Fri, 30 Aug 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Thu, 29 Aug 2019 21:48:05 +0000 (14:48 -0700)]
Run argv0-symlink.exp only on native target and local host.
This testcase was originally for PR gdb/15415, a problem with the
"run" command expanding symlinks in the name of the program being run.
It does not correctly distinguish between files on build, host, and
target, and it is not clear if it would be testing anything useful in
configurations where "run" is not being used.
2019-08-29 Sandra Loosemore <sandra@codesourcery.com>
* gdb.base/argv0-symlink.exp: Run only on native target
and local host.
Bernhard Wodok [Tue, 27 Aug 2019 15:40:31 +0000 (11:40 -0400)]
Fix PR win32/24284: tcp_auto_retry doesn't work in MinGW
This was reported by Bernhard Wodok, along with a patch to fix the
issue. I adjusted the patch a bit, and I'm submitting the patch on
his behalf.
According to Bernhard, the issue can be reproduced by doing:
1. start gdb
2. enter 'target remote :2345'
3. observe that it throws a "connection refused" error immediately
instead of waiting and throwing a timeout error
I.e., I believe it can be reproduced by our current tests, which is
why I'm not proposing any extra tests here (well, I don't use nor have
any Windows system to test this, so...).
The problem happens because, on ser-tcp:wait_for_connect, we call
'gdb_select' passing 0 as its first argument, which, when using MinGW,
ends up using the 'gdb_select' version from mingw-hdep.c, and when the
first argument is 0 this means that WaitForMultipleObjects will be
called with 0 as its first argument as well. According to the MS API
docs, this is forbidden:
https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects
The proposed fix is simple: we just call Sleep when N == 0 (and when
TIMEOUT is non-NULL), and return 0. It makes sense to me.
Both Bernhard and Paul Carroll confirmed that the fix works. I'm
Cc'ing Bernhard in case you have any questions about the patch.
OK?
gdb/ChangeLog:
2019-08-29 Bernhard Wodok <barto@gmx.net>
Sergio Durigan Junior <sergiodj@redhat.com>
PR win32/24284
* mingw-hdep.c (gdb_select): Handle case when 'n' is zero.
Tom de Vries [Thu, 29 Aug 2019 12:43:11 +0000 (14:43 +0200)]
[gdb/testsuite] Fix gdb.fortran/info-types.exp regexp
The gdb.fortran/info-types.exp test-case passes with gcc 7 (though not on
openSUSE, due to the extra debug info) and fails with gcc 4.8 and gcc 8.
Fix the gdb_test regexp to fix all those cases.
gdb/testsuite/ChangeLog:
2019-08-29 Tom de Vries <tdevries@suse.de>
* gdb.fortran/info-types.exp: Fix gdb_test regexp to allow more
diverse debug info.
* lib/fortran.exp (fortran_int8): New proc, based on fortran_int4.
Alan Modra [Thu, 29 Aug 2019 09:05:54 +0000 (18:35 +0930)]
PR24697, R_PPC_EMB_SDA21 cannot be used when making a shared object
This removes a restriction on various R_PPC_EMB relocations that has
been present for ppc32 since 1996-04-26 git commit
e25a798839. As far
as I know, only those relocs that would require addressing via r2 for
.sdata2/.sbss2 access are disallowed in shared libraries.
PR 24697
* elf32-ppc.c (ppc_elf_check_relocs): Call bad_shared_reloc
when !bfd_link_executable for R_PPC_EMB_SDA2I16 and
R_PPC_EMB_SDA2REL. Don't call bad_shared_reloc for any other
reloc.
Alan Modra [Thu, 29 Aug 2019 02:00:11 +0000 (11:30 +0930)]
PowerPC64 xlate_pcrel_opt
We can easily support an offset on the second instruction of a
sequence marked with R_PPC64_PCREL_OPT. For example,
pla ra,symbol@pcrel
ld rt,off(ra)
can be optimised to
pld rt,symbol+off@pcrel
nop
* elf64-ppc.c (xlate_pcrel_opt): Add poff parameter. Allow offset
on second insn, return it in poff.
(ppc64_elf_relocate_section): Add offset to paddi addend for
PCREL_OPT.
Jim Wilson [Thu, 29 Aug 2019 00:47:01 +0000 (17:47 -0700)]
RISC-V: Fix a gp relaxation reloc overflow error.
This was broken when I changed how we compute the value for the gp register.
It used to be computed inside the sdata section. Now it is computed at the
end which makes it an abs section symbol. There is code that tries to use
the alignment of the section that the gp value is in, but this does not work
if it is in the abs section, as the abs section has alignment of 1 byte.
There are people using alternative linker scripts that still define it in the
sdata section, so the code is still useful. Thus adding a check to disable
this when gp is in the abs section.
bfd/
* elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs
section when setting max_alignment. Update comment.
(_bfd_riscv_relax_pc): Likewise.
GDB Administrator [Thu, 29 Aug 2019 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 28 Aug 2019 23:34:08 +0000 (09:04 +0930)]
Tidy check_uvalue
I don't see a need to calculate "ptr = start + uvalue" then compare
"ptr" with "start" and "end". Given "start <= end" on entry, the
"uvalue" comparison with "max_uvalue" ought to be sufficient to ensure
"start + uvalue" is bounded by "start" and "end" regardless of the
size of pointers and the unsigned dwarf_vma integer type.
* dwarf.c (check_uvalue): Remove unnecessary pointer checks.
Alan Modra [Wed, 28 Aug 2019 07:04:34 +0000 (16:34 +0930)]
PR24891, objdump memory leaks when parsing malformed archive
BFD was leaking memory in bfd_check_format_matches. As part of
deciding the proper format of an archive, BFD looks at the format of
the first file stored. That file's bfd was left open for reasons
given in a comment removed in git commit
0e71e4955cd1 that said:
/* We ought to close `first' here, but we can't, because
we have no way to remove it from the archive cache.
It's close to impossible to figure out when we can
release bfd_ardata. FIXME. */
Well, things have changed since that comment was true and we now can
remove files from the archive cache. Closing the first file is good
and cures some of the leaks. Other leaks are caused by
bfd_check_format_matches throwing away bfd tdata before trying a new
match. That lost the element cache set up when format checking the
first element in the archive. The easiest and cleanest fix is to
simply disable the caching when checking the first element.
PR 24891
* bfd.c (struct bfd): Add no_element_cache.
* archive.c (_bfd_get_elt_at_filepos): Don't add element to
archive cache when no_element_cache.
(bfd_generic_archive_p): Set no_element_cache when opening first
element to check format. Close first element too.
(do_slurp_bsd_armap): Don't zero ardata->cache here.
* bfd-in2.h: Regenerate.
Tom de Vries [Wed, 28 Aug 2019 17:13:29 +0000 (19:13 +0200)]
[gdb/testsuite] Fix info-var.exp for debug info from other files
On openSUSE Leap 15.1, I get:
...
FAIL: gdb.base/info-var.exp: info variables
FAIL: gdb.base/info-var.exp: info variables -n
...
because the info variables command prints info also for init.c:
...
File init.c:^M
24: const int _IO_stdin_used;^M
...
while the regexps in the test-case only expect info for info-var-f1.c and
info-var-f2.c.
Fix this by extending the regexps.
Tested on x86_64-linux, both openSUSE Leap 15.1 and Fedora 30.
gdb/testsuite/ChangeLog:
2019-08-28 Tom de Vries <tdevries@suse.de>
* gdb.base/info-var.exp: Allow info variables to print info for files
other than info-var-f1.c and info-var-f2.c.
Alan Modra [Wed, 28 Aug 2019 14:50:46 +0000 (00:20 +0930)]
Segfault in ld building SPEC CPU2017 527.cam4_r with -flto
Caused by the PR24406 fix. unwrap_hash_lookup shouldn't be called
with link_info.wrap_hash NULL.
PR ld/24406
* plugin.c (get_symbols): Test link_info.wrap_hash before calling
unwrap_hash_lookup.
Gary Benson [Wed, 28 Aug 2019 14:19:28 +0000 (15:19 +0100)]
Fix Gnulib glob.c resource leaks found by Coverity
Coverity discovered a number of resource leaks in Gnulib's glob.c.
This commit backports the Gnulib commits that fix the leaks.
gnulib/ChangeLog:
* patches/0003-Fix-glob-c-Coverity-issues.patch: New file.
* update-gnulib.sh: List the above.
* import/glob.c: Rebuild.
Andrew Burgess [Tue, 9 Jul 2019 14:49:07 +0000 (15:49 +0100)]
gdb/fortran: Don't include module symbols when searching for types
Currently the 'info types' command will return symbols that correspond
to Fortran modules. This is because the symbols are created with
domain MODULE_DOMAIN and address_class LOC_TYPEDEF. The address_class
LOC_TYPEDEF is the same address_class used for type symbols which is
why the modules show up when listing types.
This commit explicitly prevents symbols in the MODULE_DOMAIN from
appearing when we search for symbols in the TYPES_DOMAIN, this
prevents the Fortran module symbols from appearing in the output of
'info types'.
gdb/ChangeLog:
* symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols
when searching for types.
gdb/testsuite/ChangeLog:
* gdb.fortran/info-types.exp: Add module.
* gdb.fortran/info-types.f90: Update expected results.
Andrew Burgess [Tue, 9 Jul 2019 14:47:19 +0000 (15:47 +0100)]
gdb/fortran: Implement la_print_typedef for Fortran
Implement an la_print_typedef method for Fortran, this allows 'info
types' to work for Fortran. The implementation is just copied from
ada_print_typedef (with the appropriate changes).
To support the testing of this patch I added a new proc,
fortran_character1, to lib/fortran.exp which returns a regexp to match
a 1-byte character type. The regexp returned is correct for current
versions of gFortran. All of the other regexp are guesses based on
all of the other support procs in lib/fortran.exp, I haven't tested
them myself.
gdb/ChangeLog:
* f-lang.c (f_language_defn): Use f_print_typedef.
* f-lang.h (f_print_typedef): Declare.
* f-typeprint.c (f_print_typedef): Define.
gdb/testsuite/ChangeLog:
* gdb.fortran/info-types.exp: New file.
* gdb.fortran/info-types.f90: New file.
* lib/fortran.exp (fortran_character1): New proc.
Niklas G?rtler [Wed, 28 Aug 2019 11:33:41 +0000 (12:33 +0100)]
Add an option to objcopy to change the alignment of sections.
PR 24942
* objcopy.c (SECTION_CONTEXT_SET_ALIGNMENT): New constant.
(struct section_list): Add alignment field.
(command_line_switch): Add OPTION_SET_SECTION_ALIGNMENT.
(copy_options): Add --set-section-alignment.
(copy_usage): Describe --set-section-alignment.
(find_section_list): Initialise the alignment field.
(setup_section): Handle the alignment field.
(copy_main): Handle OPTION_SET_SECTION_ALIGNMENT.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.
Nick Clifton [Wed, 28 Aug 2019 10:39:19 +0000 (11:39 +0100)]
Add a --source-comment=<text> option to objdump which provides a prefix to dipslayed source code lines.
PR 24931
* objdump.c (source_comment): New static variable.
(option_values): Add OPTION_SOURCE_COMMENT.
(long_opions): Add --source-comment.
(print_line): If source comment is set, use it as a prefix to the
source code line.
(main): Handle OPTION_SOURCE_COMMENT.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.
* testsuite/binutils-all/objdump.exp (test_objdump_S): Add tests
of the -S and --source-comment options.
GDB Administrator [Wed, 28 Aug 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Tue, 27 Aug 2019 18:22:38 +0000 (13:22 -0500)]
Fix compiler warning in linux-namespaces.c
../../gdb/nat/linux-namespaces.c: In function ‘void mnsh_main(int)’:
../../gdb/nat/linux-namespaces.c:604:8: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
close (fd);
~~~~~~^~~~
And the warning is correct -- mnsh_recv_message can return -1 and leave fd
uninitialized, and mnsh_main will still call close (fd) if that happens.
Initialize fd to -1 to avoid that.
gdb/ChangeLog:
2019-08-27 Christian Biesinger <cbiesinger@google.com>
* nat/linux-namespaces.c (mnsh_main): Initialize fd (to -1).
Nick Clifton [Tue, 27 Aug 2019 15:28:55 +0000 (16:28 +0100)]
Improve the DWARF decoder's ability to describe the DW_AT_discr_list attribute.
PR 24510
* dwarf.c (MAX_CU_NESTING): New constant.
(level_type_signed): New static array.
(skip_attr_bytes): New function.
(get_type_signedness): New function.
(read_and_print_leb128): New function.
(display_discr_list): New function.
(read_and_display_attr_value): Add start parameter.
Use new functions when handling DW_AT_type and DW_AT_discr_list.
(read_and_display_attr): Add start parameter. Pass to
read_and_display_attr_value.
(process_debug_info): Update call to read_and_display_attr.
(display_formatted_table): Likewise.
(display_debug_lines_decoded): Likewise. Also add start
parameter.
(display_debug_lines): Likewise.
* testsuite/binutils-all/dwarf-attributes.S: Update discrimination
lists.
* testsuite/binutils-all/dwarf-attributes.W: Update expected
output.
Andrew Burgess [Mon, 22 Jul 2019 15:53:06 +0000 (16:53 +0100)]
gdb: Add new -n flag to some info commands
The 'info variables', its alias 'whereis', and 'info functions' all
include non-debug symbols in the output by default. The list of
non-debug symbols can sometimes be quite long, resulting in the
debug symbol based results being scrolled off the screen.
This commit adds a '-n' flag to all of the commands listed above that
excludes the non-debug symbols from the results, leaving just the
debug symbol based results.
gdb/ChangeLog:
* cli/cli-utils.c (info_print_options_defs): Delete.
(make_info_print_options_def_group): Delete.
(extract_info_print_options): Delete.
(info_print_command_completer): Delete.
(info_print_args_help): Add extra parameter, and optionally
include text about -n flag.
* cli/cli-utils.h (struct info_print_options): Delete.
(extract_info_print_options): Delete declaration.
(info_print_command_completer): Delete declaration.
(info_print_args_help): Add extra parameter, extend header
comment.
* python/python.c (gdbpy_rbreak): Pass additional parameter to
search_symbols.
* stack.c (struct info_print_options): New type.
(info_print_options_defs): New file scoped variable.
(make_info_print_options_def_group): New static function.
(info_print_command_completer): New static function.
(info_locals_command): Update to use new local functions.
(info_args_command): Likewise.
(_initialize_stack): Add extra parameter to calls to
info_print_args_help.
* symtab.c (search_symbols): Add extra parameter, use this to
possibly excluse non-debug symbols.
(symtab_symbol_info): Add extra parameter, which is passed on to
search_symbols.
(struct info_print_options): New type.
(info_print_options_defs): New file scoped variable.
(make_info_print_options_def_group): New static function.
(info_print_command_completer): New static function.
(info_variables_command): Update to use local functions, and pass
extra parameter through to symtab_symbol_info.
(info_functions_command): Likewise.
(info_types_command): Pass additional argument through to
symtab_symbol_info.
(rbreak_command): Pass extra argument to search_symbols.
(_initialize_symtab): Add extra arguments for calls to
info_print_args_help, and update help text for 'info variables',
'whereis', and 'info functions' commands.
* symtab.h (search_symbols): Add extra argument to declaration.
* NEWS: Mention new flags.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Add information about the -n flag to
"info variables" and "info functions".
gdb/testsuite/ChangeLog:
* gdb.base/info-fun.exp: Extend to test the -n flag for 'info
functions'. Reindent as needed.
* gdb.base/info-var-f1.c: New file.
* gdb.base/info-var-f2.c: New file.
* gdb.base/info-var.exp: New file.
* gdb.base/info-var.h: New file.
Srinath Parvathaneni [Tue, 27 Aug 2019 11:08:21 +0000 (12:08 +0100)]
Add support for the MVE VMOV instruction to the ARM assembler. This instruction copies the value of one vector register to another vector register. The patch also modifies the decoding of VORR instruction which is effecting decoding of VMOV instruction.
gas * config/tc-arm.c (parse_neon_mov): Add check to accept vector
register to both the arguments in VMOV instruction.
* testsuite/gas/arm/mve-vmov-1.d: Modify.
* testsuite/gas/arm/mve-vmov-1.s: Likewise.
* testsuite/gas/arm/mve-vorr.d: Likewise.
opcodes * arm-dis.c (mve_opcodes): Add entry for MVE_VMOV_VEC_TO_VEC.
(is_mve_undefined): Add case for MVE_VMOV_VEC_TO_VEC.
(print_insn_mve): Add condition to check Qm==Qn of VORR instruction.
GDB Administrator [Tue, 27 Aug 2019 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Sat, 3 Aug 2019 00:59:37 +0000 (19:59 -0500)]
Factor out the common code in lookup_{static,global}_symbol
The two functions are extremely similar; this factors out their code into
a shared _internal function.
gdb/ChangeLog:
2019-08-26 Christian Biesinger <cbiesinger@google.com>
* symtab.c (lookup_static_symbol): Call the new function (and move
it down to be next to lookup_global_symbol).
(struct global_sym_lookup_data): Add block_enum member and rename to...
(struct global_or_static_sym_lookup_data): ...this.
(lookup_symbol_global_iterator_cb): Pass block_index instead of
GLOBAL_BLOCK to lookup_symbol_in_objfile and rename to...
(lookup_symbol_global_or_static_iterator_cb): ...this.
(lookup_global_or_static_symbol): New function.
(lookup_global_symbol): Call new function.
Tom de Vries [Mon, 26 Aug 2019 17:24:59 +0000 (19:24 +0200)]
[gdb, c++] Improve error message when using libstdcxx without SDT probes
When using catch catch/rethrow/catch, a libstdcxx with SDT probes is required
for both the regexp argument, and the convenience variable $_exception (
https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Catchpoints.html ).
Currently, when using these features with a libstdcxx without SDT probes, we
get the cryptic error message:
...
not stopped at a C++ exception catchpoint
...
Improve this by instead emitting the more helpful:
...
did not find exception probe (does libstdcxx have SDT probes?)
...
Tested on x86_64-linux.
gdb/ChangeLog:
2019-08-26 Tom de Vries <tdevries@suse.de>
PR c++/24852
* break-catch-throw.c (fetch_probe_arguments): Improve error mesage
when pc_probe.prob == NULL.
gdb/testsuite/ChangeLog:
2019-08-26 Tom de Vries <tdevries@suse.de>
PR c++/24852
* gdb.cp/no-libstdcxx-probe.exp: New test.
Tom de Vries [Mon, 26 Aug 2019 16:48:02 +0000 (18:48 +0200)]
[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if true
The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests
need to be skipped, while tcl interprets 0 as false rather than true, which is
confusing.
Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need
to be skipped.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-26 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe
* tests need to be skipped.
* gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests.
* gdb.mi/mi-catch-cpp-exceptions.exp: Update call to
mi_skip_libstdcxx_probe_tests.
Sergio Durigan Junior [Sun, 25 Aug 2019 16:10:35 +0000 (12:10 -0400)]
Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's "SyntaxWarning: invalid escape sequence")
The way unrecognized escape sequences are handled has changed in
Python 3.8: users now see a SyntaxWarning message, which will
eventually become a SyntaxError in future versions of Python:
(gdb) source /blabla/gdb.python/py-xmethods/py-xmethods.py
/blabla/gdb.python/py-xmethods/py-xmethods.py:204: SyntaxWarning: invalid escape seque
nce \+
'operator\+',
/blabla/gdb.python/py-xmethods/py-xmethods.py:211: SyntaxWarning: invalid escape seque
nce \+
'operator\+\+',
One of our testcases, gdb.python/py-xmethods.exp, contains strings in
the form of "operator\+". This is not recognized by Python, but is
still needed by the testsuite to work properly. The solution is
simple: we just have to make sure these strings are marked as
raw (i.e, r""). This is what this patch does. I took the opportunity
to also convert other strings to raw, which, in two cases, allowed the
removal of an extra backslash.
I tested this using Python 3.7 and Python 3.8, and everything works
fine.
I think I could push this as obvious, but decided to send it to
gdb-patches just in case.
gdb/testsuite/ChangeLog:
2019-08-26 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.python/py-xmethods.exp: Use raw strings when passing
arguments to SimpleXMethodMatcher.
Alan Modra [Mon, 26 Aug 2019 09:36:28 +0000 (19:06 +0930)]
PR24938, Null Pointer Dereference in debug.c:debug_write_type
PR 24938
* debug.c (debug_write_type): Call empty_type for NULL type here..
(debug_write_type): ..rather than in just one case here.
Kito Cheng [Tue, 20 Aug 2019 09:47:58 +0000 (17:47 +0800)]
RISC-V: Improve li expansion for better code density.
li is a pseudo instruction in RISC-V, it might expand to more than one
instructions if the immediate value can't fit addi or lui, but the
assembler will always using 4-byte instructions during expansion.
For example:
li a0, 0x12345001
will expand into
12345537 lui a0,0x12345
00150513 addi a0,a0,1
but addi could be compress into
0505 addi a0,a0,1
It because load_const use macro_build to emit instructions,
and macro_build call append_insn, and expect it will compress
it if possible, but the fact is append_insn never compress anything,
So this patch redirect the li expansion flow to normal instruction
emission flow via md_assemble, added md_assemblef as an wrapper for
that for easier emit instruction with printf-style argument to build
instruction.
gas/ChangeLog:
* tc-riscv.c (md_assemblef): New.
(load_const) Use md_assemblef instead of macro_build to emit
instructions.
* testsuite/gas/riscv/li32.d: New.
* testsuite/gas/riscv/li32.s: Ditto.
* testsuite/gas/riscv/li64.d: Ditto.
* testsuite/gas/riscv/li64.s: Ditto.
Simon Marchi [Mon, 26 Aug 2019 01:30:02 +0000 (21:30 -0400)]
dwarf2read: fix compilation issue with gcc 4.8
gcc 4.8 (and probably other versions too) doesn't like that the local
variable symbol_linkage has the same name as the enum class defined in
the same context:
CXX dwarf2read.o
/home/smarchi/src/binutils-gdb/gdb/dwarf2read.c: In member function ‘dwarf2_per_cu_data* dw2_debug_names_iterator::next()’:
/home/smarchi/src/binutils-gdb/gdb/dwarf2read.c:5850:22: error: ‘symbol_linkage’ is not a class, namespace, or enumeration
} symbol_linkage = symbol_linkage::unknown;
^
Rename the local variable to avoid this.
This problem was originally reported with the Netbsd builder on the
buildbot, which uses gcc 5.5, I believe. I am not able to test it on
that builder right now, but chances are that the fix will work there
too.
gdb/ChangeLog:
* dwarf2read.c (dw2_debug_names_iterator::next): Rename local
variable symbol_linkage to symbol_linkage_.
GDB Administrator [Mon, 26 Aug 2019 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 25 Aug 2019 22:09:47 +0000 (18:09 -0400)]
dwarf2read: replace gdb::optional<bool> with enum
gdb::optional<bool> is dangerous, because it's easy to do:
if (opt_bool)
when you actually meant
if (*opt_bool)
or vice-versa. The first checks if the optional is set, the second
checks if the wrapped bool is true.
Replace it with an enum that explicitly defines the three possible
states.
gdb/ChangeLog:
* dwarf2read.c (dw2_debug_names_iterator::next): Use enum to
represent whether the symbol is static, dynamic, or we don't
know.
Yoshinori Sato [Tue, 20 Aug 2019 15:24:37 +0000 (00:24 +0900)]
Convert the RX target to make use of target descriptions.
gdb/ChangeLog
2019-08-25 Yoshinori Sato <ysato@users.sourceforge.jp>
* gdb/rx-tdep.c (rx_register_names): New.
(rx_register_name): Delete.
(rx_psw_type): Delete.
(rx_fpsw_type): Delete.
(rx_register_type): Delete.
(rx_gdbarch_init): Convert target-descriptions.
(_initialize_rx_tdep): Add initialize_tdesc_rx.
* gdb/features/Makefile: Add rx.xml.
* gdb/features/rx.xml: New.
* gdb/features/rx.c: Generated.
* gdb/NEWS: Mention target description support.
gdb/doc/ChangeLog:
2019-08-25 Yoshinori Sato <ysato@users.sourceforge.jp>
* gdb.texinfo (Standard Target Features): Add RX Features sub-section.
GDB Administrator [Sun, 25 Aug 2019 00:01:30 +0000 (00:01 +0000)]
Automatic date update in version.in
Christian Biesinger [Fri, 9 Aug 2019 19:25:15 +0000 (14:25 -0500)]
Fix compile warning in symtab.c
My compiler (g++ 8.2) can't tell that *bsc_ptr and *slot_ptr are
only used in the cases when it does get initialized. Just initialize
the vars earlier to avoid the warning, there does not seem to be a
downside to it.
../../gdb/symtab.c: In function ‘block_symbol lookup_static_symbol(const char*, domain_enum)’:
../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
xfree (slot->value.not_found.name);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/symtab.c:2578:29: note: ‘slot’ was declared here
struct symbol_cache_slot *slot;
^~~~
../../gdb/symtab.c:1405:3: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (bsc == NULL)
^~
../../gdb/symtab.c:2577:30: note: ‘bsc’ was declared here
struct block_symbol_cache *bsc;
^~~
../../gdb/symtab.c: In function ‘block_symbol lookup_global_symbol(const char*, const block*, domain_enum)’:
../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized]
xfree (slot->value.not_found.name);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/symtab.c:2658:29: note: ‘slot’ was declared here
struct symbol_cache_slot *slot;
^~~~
../../gdb/symtab.c:1409:14: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
++bsc->collisions;
~~~~~^~~~~~~~~~
../../gdb/symtab.c:2657:30: note: ‘bsc’ was declared here
struct block_symbol_cache *bsc;
^~~
gdb/ChangeLog:
2019-08-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (symbol_cache_lookup): Always initialize *bsc_ptr and *slot_ptr.
Alan Modra [Sat, 24 Aug 2019 00:29:03 +0000 (09:59 +0930)]
PowerPC64 segfault in ppc64_elf_edit_toc
Found on a GOT reference to __ehdr_start, which is tweaked to be
undefined weak at some stages of linking. SYMBOL_REFERENCES_LOCAL
isn't a sufficient test.
* elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak
symbols from GOT optimisation.
GDB Administrator [Sat, 24 Aug 2019 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Wed, 21 Aug 2019 20:22:45 +0000 (16:22 -0400)]
Move gdb-dlfcn.[ch] to gdbsupport/
I need to use 'gdb_dlopen' inside 'gdbsupport/', but it's not yet
supported there. This commit moves 'gdb-dlfcn.[ch]' to 'gdbsupport/',
which makes it available also on gdbserver.
gdb/ChangeLog:
2019-08-23 Sergio Durigan Junior <sergiodj@redhat.com>
* configure.ac: Don't check for 'dlfcn.h' (moved to
gdbsupport/common.m4).
* Makefile.in (COMMON_SFILES): Move 'gdb-dlfcn.c' to
'gdbsupport/'.
(HFILES_NO_SRCDIR): Likewise, for 'gdb-dlfcn.h'.
* compile/compile-c-support.c: Include
'gdbsupport/gdb-dlfcn.h'.
* gdbsupport/common.m4: Check for 'dlfcn.h'.
* gdb-dlfcn.c: Move to...
* gdbsupport/gdb-dlfcn.c: ... here.
* gdb-dlfcn.h: Move to...
* gdbsupport/gdb-dlfcn.h: ... here.
gdb/gdbserver/ChangeLog:
2019-08-23 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Add 'gdbsupport/gdb-dlfcn.c'.
(OBS): Add 'gdbsupport/gdb-dlfcn.o'.
* config.in: Regenerate.
* configure: Regenerate.
Sandra Loosemore [Fri, 23 Aug 2019 15:18:54 +0000 (08:18 -0700)]
Fix bug in nios2 prologue analysis.
The nios2 prologue analyzer was mistakenly using an unsigned int field
to represent a 32-bit signed value. This caused problems with an
incorrect conversion being applied to negative values when they were
automatically promoted for addition to a 64-bit CORE_ADDR value.
This patch fixes test failures in gdb.base/large-frame.exp and
gdb.dwarf2/dw2-ref-missing-frame.exp. Normally the nios2 backend
prefers to use the dwarf2 unwinder so the prologue analyzer is only
invoked if there is no dwarf2 information.
2019-08-23 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (struct reg_value): Improve comments. Make
the offset field signed.
Stafford Horne [Fri, 23 Aug 2019 13:25:55 +0000 (22:25 +0900)]
or1k: Fix incorrect value in PLT GOT entries, causing infinite loop
The PLT GOT entry should point to the first PLT entry which contains the
runtime linker function. It was pointing back to the symbol PLT entry
causing an infinite loop.
I found this when testing the OpenRISC glibc port which uses the runtime
dynamic linker. It seems other libc's we use so far have not been
making use of the initial PLT GOT entries.
bfd/ChangeLog:
* elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for
PLT GOT entries.
Nick Clifton [Fri, 23 Aug 2019 12:22:02 +0000 (13:22 +0100)]
Stop the BFD library from failing when encountering a second set of relocs for the same section.
PR 24456
* elf.c (bfd_section_from_shdr): Issue an informative warning
message and continue processing other sections after encountering
a reloc section for a section which already has other relocs
associated with it.
Alan Modra [Fri, 23 Aug 2019 09:46:25 +0000 (19:16 +0930)]
PR24933, Memory leak in elf_x86_64_get_synthetic_symtab
PR 24933
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
on error without freeing plts[] contents.
Nick Clifton [Fri, 23 Aug 2019 09:46:46 +0000 (10:46 +0100)]
Updated Swedish translation for the gas sub-directory.
2019-08-23 Nick Clifton <nickc@redhat.com>
* po/sv.po: Updated Swedish translation.
Nick Clifton [Fri, 23 Aug 2019 09:37:51 +0000 (10:37 +0100)]
Prevent a potential illegal memory access in the DWARF parser when processing a corrupt file.
PR 24829
* dwarf.c (check_uvalue): New function. Ensures that a block's
size is valid.
(read_and_display_attr_value): Use check_value when processsing
DW_FORM_block<n> attributes.
GDB Administrator [Fri, 23 Aug 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Tue, 13 Aug 2019 19:48:05 +0000 (14:48 -0500)]
Make GDB compile with Python 3 on MinGW
PyFile_FromString and PyFile_AsFile have been removed in Python 3.
There is no obvious replacement that works here, and we can't just
pass our FILE* to a DLL in Windows because it may use a different
C runtime.
So we just call a Python function which reads and executes file
contents. Care must be taken to execute it in the context of
__main__.
Tested by inverting the ifdef and running the testsuite on Debian
Linux (even without the patch, I failed at running the testsuite
on Windows). I did test with both Python 2 and 3.
gdb/ChangeLog:
2019-08-22 Christian Biesinger <cbiesinger@google.com>
* python/lib/gdb/__init__.py (_execute_file): New function.
* python/python.c (python_run_simple_file): Call gdb._execute_file
on Windows.
Tom de Vries [Thu, 22 Aug 2019 14:54:59 +0000 (16:54 +0200)]
[gdb/testsuite] Make gdb_test message more informative in multi-term-settings.exp
This racy fail message, reported in PR24929:
...
FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: \
stop with control-c
...
does not make clear which gdb_test fails here:
...
if {$expect_ttou} {
gdb_test "" "Quit" "stop with control-c"
} else {
gdb_test "" "received signal SIGINT.*" "stop with control-c"
}
...
Fix this by making the gdb_test message argument more informative.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-22 Tom de Vries <tdevries@suse.de>
* gdb.multi/multi-term-settings.exp (coretest): Make gdb_test messages
more informative.
Dennis Zhang [Thu, 22 Aug 2019 14:21:32 +0000 (15:21 +0100)]
Arm: Add support for missing CPUs
This patch adds support for following CPUs:
Cortex-M35P, Cortex-A77, Cortex-A76AE.
Related specifications can be found at https://developer.arm.com/ip-products/processors.
gas/ChangeLog:
* config/tc-arm.c: New entries for Cortex-M35P, Cortex-A77,
and Cortex-A76AE.
* doc/c-arm.texi: Document new processors.
* testsuite/gas/arm/cpu-cortex-a76ae.d: New test.
* testsuite/gas/arm/cpu-cortex-a77.d: New test.
* testsuite/gas/arm/cpu-cortex-m35p.d: New test.
bfd/ChangeLog:
* cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.
Nick Clifton [Thu, 22 Aug 2019 13:37:03 +0000 (14:37 +0100)]
Fix an illegal memory access when dumping corrupt x86_64 PE unwind data.
PR 24922
* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add checks before
reading data from extra records.
Nick Clifton [Thu, 22 Aug 2019 12:16:28 +0000 (13:16 +0100)]
oops - omitted changelog entry from previous delta.
Nick Clifton [Thu, 22 Aug 2019 12:11:18 +0000 (13:11 +0100)]
Prevent a floating point exception in the dwarf parser when a CU or TU table does not have any columns.
PR 24921
* dwarf.c (process_cu_tu_index): Handle the case where a table
does not have any columns.
Bosco Garc?a [Thu, 22 Aug 2019 11:54:06 +0000 (12:54 +0100)]
Fix the assembler's floating point number parser so that it can correctly handle numbers encoded as a leading decimal point, followed by zeroes, followed by a non-zero sequence.
* atof-generic.c (atof_generic): Do not ignore leading zeros if
they appear after a decimal point.
* testsuite/gas/all/float.s: Extend test to include a number with
a leading decimal point followed by several zeroes.
* testsuite/gas/i386/fp.s: Likewise.
* testsuite/gas/i386/fp.d: Update expected output.
Andrew Burgess [Thu, 22 Aug 2019 09:07:00 +0000 (10:07 +0100)]
gdb/fortran: Remove some dead code from the parser
The Fortran parser contains some code that looks like it was probably
inherited from the C/C++ parser as it checks to see if the current
language is C++, which should never be true when we're in the Fortran
parser.
gdb/ChangeLog:
* f-exp.y (yylex): Remove is_a_field_of_this local variable, and
all uses as this was never set to anything but a zero value.
Tamar Christina [Thu, 22 Aug 2019 10:35:35 +0000 (11:35 +0100)]
AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).
This patch fixes a few linker crashes due to TLS code reaching an assert when it
shouldn't.
The first scenario is with weak TLS symbols that remain weak during linking. In
this case the mid-end would not have seen a TLS symbol and so wouldn't have
allocated the TLS section. We currently assert here and the linker crashes with
a not very useful message.
This patch changes this to return the value 0 for the TLS symbol in question
emulating what lld and gold and other BFD targets do. However because weak TLS
is implementation defined and we don't define any behavior for it I also emit a
warning to the user to inform them of such.
Secondly when a strong TLS reference is undefined. The linker crashes even after
it correctly reported that there is an undefined reference. This changes it so
that it gracefully exits and reports a useful error.
bfd/ChangeLog:
PR ld/24601
* elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS.
Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation.
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it.
* elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning
for weak TLS.
ld/ChangeLog:
PR ld/24601
* testsuite/ld-aarch64/aarch64-elf.exp (undef-tls, weak-tls): New.
* testsuite/ld-aarch64/undef-tls.d: New test.
* testsuite/ld-aarch64/undef-tls.s: New test.
* testsuite/ld-aarch64/weak-tls.d: New test.
* testsuite/ld-aarch64/weak-tls.s: New test.
Barnaby Wilks [Thu, 22 Aug 2019 10:13:23 +0000 (11:13 +0100)]
Implement a float16 directive for assembling 16 bit IEEE 754 floating point numbers for the AArch64 assembler.
The syntax of the directive is:
.float16 <0-n decimal numbers>
e.g.
.float16 0.5
.float16 10.2, NaN, 452.09
The floats will always be encoded using the binary16 format as described in the
IEEE 754-2008 standard. There is no need to support Arm's alternative half-precision
format since AArch64 only supports the IEEE format.
gas * config/tc-aarch64.c: Add float16 directive and add "Hh" to
acceptable float characters.
* doc/c-aarch64.texi: Documentation for float16 directive.
* testsuite/gas/aarch64/float16-be.d: New test.
* testsuite/gas/aarch64/float16-le.d: New test.
* testsuite/gas/aarch64/float16.s: New test.
* NEWS: Add NEWS entry.
Kyrylo Tkachov [Thu, 22 Aug 2019 09:20:01 +0000 (10:20 +0100)]
[AArch64][gas] Update MTE system register encodings
The MTE specification adjusted the encoding of the TFSRE0_EL1, TFSR_EL1, TFSR_EL2, TFSR_EL3, TFSR_EL12 system registers.
This patch brings binutils up to date.
The references for the encodings are at:
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsre0_el1 (also contains TFSR_EL12 description)
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el1
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el2
https://developer.arm.com/docs/ddi0595/latest/aarch64-system-registers/tfsr_el3
Tested check-gas for aarch64-none-elf.
opcodes/
* aarch64-opc.c (aarch64_sys_regs): Update encoding of tfsre0_el1,
tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12.
(aarch64_sys_reg_supported_p): Update checks for the above.
gas/
* testsuite/gas/aarch64/sysreg-4.d: Update expected disassembly for
tfsre0_el1, tfsr_el1, tfsr_el2, tfsr_el3, tfsr_el12 system registers.
Alan Modra [Thu, 22 Aug 2019 01:51:48 +0000 (11:21 +0930)]
ARM CMSE symbols
This patch removes use of st_target_internal to cache the result of
comparing symbol names against CMSE_PREFIX. The problem with setting
a bit in st_target_internal in swap_symbol_in is that calling
bfd_elf_sym_name from swap_symbol_in requires symtab_hdr, and you
don't know for sure whether swap_symbol_in is operating on dynsyms
(and thus elf_tdata (abfd)->dynsymtab_hdr should be used) or on the
normal symtab (thus elf_tdata (abfd)->symtab_hdr). You can make an
educated guess based on abfd->flags & DYNAMIC but that relies on
knowing a lot about calls to bfd_elf_get_elf_syms, and is fragile in
the face of possible future changes.
include/
* elf/arm.h (ARM_GET_SYM_CMSE_SPCL, ARM_SET_SYM_CMSE_SPCL): Delete.
bfd/
* elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL,
instead recognize CMSE_PREFIX in symbol name.
(elf32_arm_gc_mark_extra_sections): Likewise.
(elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL.
(elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.
GDB Administrator [Thu, 22 Aug 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 21 Aug 2019 20:11:33 +0000 (21:11 +0100)]
Fix nullptr in with_command_1
Running 'with' without arguments crashes GDB. This fixes it.
gdb/ChangeLog:
2019-08-21 Bogdan Harjoc <harjoc@gmail.com>
* cli/cli-cmds.c (with_command_1): Error out if no arguments.
gdb/testsuite/ChangeLog:
2019-08-21 Pedro Alves <palves@redhat.com>
* gdb.base/with.exp: Test "with" with no arguments.
Christian Biesinger [Wed, 21 Aug 2019 20:03:53 +0000 (15:03 -0500)]
Fix g++ 9.1 build breakage
gdb/ChangeLog:
2019-08-21 Christian Biesinger <cbiesinger@google.com>
* tui/tui-data.h (tui_gen_win_info): Add an =default
move constructor, required by some GCC versions.
Jinke Fan [Wed, 15 May 2019 09:34:57 +0000 (17:34 +0800)]
gdb/djgpp: Add Hygon Dhyana processor support
Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between
AMD and Haiguang Information Technology Co.,Ltd., which aims at
providing high performance x86 processors for the China server market.
Its first generation processor codename is Dhyana, which originates
from AMD technology and shares most of the architecture with AMD's
family 17h, but with different CPU Vendor ID("HygonGenuine")/Family
series number(Family 18h).
gdb/ChangeLog:
2019-08-21 Jinke Fan <fanjinke51@yeah.net>
* go32-nat.c (go32_sysinfo): Add hygon_p.
Tom de Vries [Wed, 21 Aug 2019 09:49:33 +0000 (11:49 +0200)]
[gdb/testsuite] Stabilize gdb-caching-proc.exp test order
The test-case gdb-caching-proc.exp tests each gdb_caching_proc in
gdb/testsuite/lib/*.exp. However, the order of .exp file being tested can
change from run to run, because of using glob.
Fix this by sorting the glob result.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-21 Tom de Vries <tdevries@suse.de>
* gdb.base/gdb-caching-proc.exp: Sort files.
GDB Administrator [Wed, 21 Aug 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 14 Jul 2019 14:25:43 +0000 (08:25 -0600)]
Change some tui_data_window methods to be private
Turning various calls into methods has made it possible to now change
some tui_data_window methods to be private.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <last_regs_line_no,
line_from_reg_element_no, first_reg_element_no_inline,
display_all_data, delete_data_content_windows,
erase_data_content>: Now private.
Tom Tromey [Sun, 14 Jul 2019 00:30:53 +0000 (18:30 -0600)]
Remove some defines from tui-data.h
This removes the HILITE and NO_HILITE defines from tui-data.h, in
favor of simply passing a bool to box_win.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (box_win): Change type of highlight_flag.
(tui_unhighlight_win, tui_highlight_win)
(tui_win_info::make_window): Update.
* tui/tui-data.h (HILITE, NO_HILITE): Remove.
Tom Tromey [Sun, 14 Jul 2019 00:29:57 +0000 (18:29 -0600)]
Move some defines to tui-stack.c
Some #defines in tui-data.h are only used in tui-stack.c, so move them
there.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
(MAX_PID_WIDTH): Move to tui-stack.c.
* tui/tui-stack.c (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
(MAX_PID_WIDTH): Move from tui-data.h.
Tom Tromey [Sat, 13 Jul 2019 22:47:31 +0000 (16:47 -0600)]
Change tui_make_window to be a method
I combined several small changes into one patch here. I believe I
started by noticing that the "title" is not needed by tui_gen_win_info
and could be self-managing (i.e. std::string). Moving this revealed
that "can_box" is also a property of tui_win_info and not
tui_gen_win_info; and this in turn caused the changes to
tui_make_window and box_win.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (tui_make_window): Don't declare.
* tui/tui-wingeneral.c (box_win): Change type of win_info.
(box_win): Update.
(tui_gen_win_info::make_window): Rename from tui_make_window.
(tui_win_info::make_window): New method.
(tui_gen_win_info::make_visible): Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* tui/tui-regs.c (tui_data_window::show_register_group): Update.
(tui_data_window::display_registers_from): Update.
* tui/tui-layout.c (tui_gen_win_info::resize): Update.
* tui/tui-data.h (struct tui_gen_win_info) <make_window>:
Declare.
<can_box>: Remove.
<title>: Remove.
(struct tui_win_info) <make_window>: Declare.
<can_box>: Now virtual.
<title>: New member.
* tui/tui-data.c (~tui_gen_win_info): Don't free title.
* tui/tui-command.c (tui_cmd_window::resize): Update.
Tom Tromey [Sat, 13 Jul 2019 22:36:07 +0000 (16:36 -0600)]
Remove tui_data_window::display_regs
There's no need for tui_data_window::display_regs any more (if there
ever was). All the paths through data window construction will end up
setting this to true. This patch removes the member.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <display_regs>: Remove.
* tui/tui-regs.c (tui_data_window::show_registers): Update.
(tui_data_window::check_register_values): Update.
Tom Tromey [Sat, 13 Jul 2019 22:24:48 +0000 (16:24 -0600)]
Remove indirection from tui_data_window::regs_content
tui_data_window::regs_content is currently a vector of unique_ptr.
However, due to the way this is managed now, there is no need to keep
the pointers -- it can simply be a vector of the objects themselves.
This patch removes this extra layer of indirection.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window): Use
DISABLE_COPY_AND_ASSIGN.
<regs_content>: Change type, removing unique_ptr.
<tui_data_window>: Add move constructor.
* tui/tui-regs.c (tui_data_window::show_registers)
(tui_data_window::show_register_group)
(tui_data_window::display_registers_from)
(tui_data_window::display_registers_from)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_data_window::rerender, tui_data_window::refresh_window)
(tui_data_window::check_register_values): Update.
Tom Tromey [Sat, 13 Jul 2019 22:19:11 +0000 (16:19 -0600)]
Add two methods to tui_data_window
This changes tui_show_registers and tui_show_register_group to be
methods on tui_data_window.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <show_registers,
show_register_group>: Declare.
(tui_show_register_group): Don't declare.
* tui/tui-regs.c (tui_data_window::show_registers): Rename from
tui_show_registers.
(tui_data_window::show_register_group): Rename from
tui_show_register_group.
(tui_data_window::check_register_values, tui_reg_command):
Update.
* tui/tui-layout.c (tui_set_layout): Update.
Tom Tromey [Sat, 13 Jul 2019 22:15:30 +0000 (16:15 -0600)]
Change tui_check_register_values to be a method
This changes tui_check_register_values to be a method on
tui_data_window. An additional check in tui_register_changed is
needed, because TUI_DATA_WIN could be NULL at this point.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <check_register_values>:
Declare.
(tui_check_register_values): Don't declare.
* tui/tui-regs.c (tui_data_window::check_register_values): Rename
from tui_check_register_values.
* tui/tui-hooks.c (tui_register_changed): Update.
Tom Tromey [Sat, 13 Jul 2019 22:08:33 +0000 (16:08 -0600)]
Rearrange tui-regs.c some more
This moves tui_reg_layout later in tui-regs.c, closer to where it is
used.
It also changes tui_show_registers not to enable the TUI or change the
layout -- this is already done by this point by all the callers.
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.c (tui_reg_layout): Move later.
(tui_show_registers): Don't enable TUI mode or change layout.
Tom Tromey [Sat, 13 Jul 2019 22:01:34 +0000 (16:01 -0600)]
Change tui_data_item_window::content to be a unique_xmalloc_ptr
This changes tui_data_item_window::content to be a unique_xmalloc_ptr
and fixes up the fallout. It also removes a parameter from
tui_expand_tabs, as it was only ever given one value.
This also removes some tab-handling code from
tui_data_window::display_registers_from. Because the content can only
be set by tui_register_format, and because that calls tui_expand_tabs,
it's not possible to see a tab here.
gdb/ChangeLog
2019-08-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_item_window)
<~tui_data_item_window>: Remove.
<content>: Now a unique_xmalloc_ptr.
* tui/tui-regs.c (tui_register_format): Return a
unique_xmalloc_ptr.
(tui_get_register): Update.
(~tui_data_item_window): Remove.
(tui_data_window::display_registers_from, tui_display_register):
Update.
* tui/tui-io.h (tui_expand_tabs): Update.
* tui/tui-io.c (tui_expand_tabs): Return a unique_xmalloc_ptr.
Remove "col" parameter.