Artur Shepilko [Fri, 10 Apr 2020 14:56:43 +0000 (10:56 -0400)]
gdb: fix undefined behavior reported in copy_bitwise
gdb version 9.1, built with clang 8.0.0 on Ubuntu 18.04 (x86_64);
--enable-ubsan (for clang's undefined behavior sanitizer)
Executing command; `maint selftest copy_bitwise` bombs in runtime error:
../../gdb/utils.c:3432:28: runtime error: left shift of negative value -1
Closer look reveals the offending shift: `(~0 << nbits)`, apparently 0
is treated as signed int, resulting in negative complement. Explicitly
stating it unsigned 0U fixes it and the `copy_bitwise` test passes
ok.
GDB Administrator [Sat, 11 Apr 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 10 Apr 2020 13:18:49 +0000 (07:18 -0600)]
Avoid infinite recursion in get_msymbol_address
Sometimes, get_msymbol_address can cause infinite recursion, leading
to a crash. This was reported previously here:
https://sourceware.org/pipermail/gdb-patches/2019-November/162154.html
A user on irc reported this as well, and with his help and the help of
a friend of his, we found that the problem occurred because, when
reloading a separate debug objfile, the objfile would lose the
OBJF_MAINLINE flag. This would cause some symbols from this separate
debug objfile to be marked "maybe_copied" -- but then
get_msymbol_address could find the same symbol and fail as reported.
This patch fixes the bug by preserving OBJF_MAINLINE.
No test case, unfortunately, because I could not successfully make
one.
gdb/ChangeLog
2020-04-10 Tom Tromey <tromey@adacore.com>
* symfile.c (symbol_file_add_separate): Preserve OBJF_MAINLINE.
Tom Tromey [Fri, 10 Apr 2020 13:18:49 +0000 (07:18 -0600)]
Skip separate debug files when handling copy relocations
get_symbol_address and get_msymbol_address call
lookup_minimal_symbol_linkage, which iterates over the separate debug
files of the objfile that is passed in.
This means that if these functions pass in a separate debug objfile,
then they are doing unnecessary work.
This patch avoids the extra work by skipping separate debug objfiles
in the loops.
gdb/ChangeLog
2020-04-10 Tom Tromey <tromey@adacore.com>
* symtab.c (get_symbol_address, get_msymbol_address): Skip
separate debug files.
Hannes Domani [Thu, 9 Apr 2020 14:33:20 +0000 (16:33 +0200)]
Fix debugging of WOW64 processes
The new code regarding pending stops only checks for EXCEPTION_BREAKPOINT,
but for WOW64 processes STATUS_WX86_BREAKPOINT is necessary as well.
Also, ignore_first_breakpoint is used now in nat/windows-nat.c as well,
but was not available there.
gdb/ChangeLog:
2020-04-10 Hannes Domani <ssbssa@yahoo.de>
* nat/windows-nat.c (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
Move to...
* nat/windows-nat.h (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP):
... here.
* windows-nat.c (windows_nat_target::get_windows_debug_event):
Check for STATUS_WX86_BREAKPOINT.
(windows_nat_target::wait): Same.
Rainer Orth [Fri, 10 Apr 2020 09:18:10 +0000 (11:18 +0200)]
ld: xfail several shared (non PIC) tests on Solaris
Three ld tests currently FAIL on Solaris/SPARC:
FAIL: shared (non PIC)
FAIL: shared (non PIC, load offset)
FAIL: shared (PIC main, non PIC so)
all of them in the same way:
/var/gcc/binutils/sparcv7/obj/binutils/ld/tmpdir/ld/collect-ld: read-only
segment has dynamic relocations
Given that Solaris defaults to -z text, this is to be expected, thus
this patch xfail's them.
Tested on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11.
* testsuite/ld-shared/shared.exp: Remove dangling comments.
xfail shared non PIC tests on Solaris.
Tom de Vries [Fri, 10 Apr 2020 07:50:11 +0000 (09:50 +0200)]
[gdb/testsuite] Fix -readnow FAIL in gdb.base/style.exp
When running test-case gdb.base/style.exp with target board readnow, we run
into:
...
FAIL: gdb.base/style.exp: filename is styled when loading symbol file
...
The problem is that with -readnow, an extra "Expanding full symbols" message
is generated:
...
(gdb) file $file^M
Reading symbols from $file...^M
Expanding full symbols from $file...^M
(gdb) FAIL: gdb.base/style.exp: filename is styled when loading symbol file
...
and the test does not expect this message.
Fix this by expecting the additional message for -readnow.
gdb/testsuite/ChangeLog:
2020-04-10 Tom de Vries <tdevries@suse.de>
* gdb.base/style.exp: Expect "Expanding full symbols" message for
-readnow.
Tom de Vries [Fri, 10 Apr 2020 07:29:52 +0000 (09:29 +0200)]
[gdb/cli] Don't let python colorize strip leading newlines
Consider the test-case gdb.base/async.exp. Using the executable, I run to
main, and land on a line advertised as line 26:
...
$ gdb outputs/gdb.base/async/async -ex start
Reading symbols from outputs/gdb.base/async/async...
Temporary breakpoint 1 at 0x4004e4: file gdb.base/async.c, line 26.
Starting program: outputs/gdb.base/async/async
Temporary breakpoint 1, main () at gdb.base/async.c:26
26 y = foo ();
...
But actually, the line turns out to be line 28:
...
$ cat -n gdb.base/async.c
...
26 y = 2;
27 z = 9;
28 y = foo ();
...
This is caused by the following: the python colorizer initializes the lexer
with default options (no second argument to get_lexer_for_filename):
...
def colorize(filename, contents):
# Don't want any errors.
try:
lexer = lexers.get_lexer_for_filename(filename)
formatter = formatters.TerminalFormatter()
return highlight(contents, lexer, formatter)
...
which include option stripnl=True, which strips leading and trailing newlines.
This causes the python colorizer to strip the two leading newlines of async.c.
Fix this by initializing the lexer with stripnl=False.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2020-04-10 Tom de Vries <tdevries@suse.de>
PR cli/25808
* python/lib/gdb/__init__.py: Initialize lexer with stripnl=False.
gdb/testsuite/ChangeLog:
2020-04-10 Tom de Vries <tdevries@suse.de>
PR cli/25808
* gdb.base/style.c: Add leading newlines.
* gdb.base/style.exp: Use gdb_get_line_number to get specific lines.
Check listing of main's one-line body.
GDB Administrator [Fri, 10 Apr 2020 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 9 Apr 2020 23:00:39 +0000 (19:00 -0400)]
gdb: move Tom de Vries to Global Maintainers
gdb/ChangeLog:
* MAINTAINERS (Global Maintainers): Add Tom de Vries.
(Write After Approval): Remove Tom de Vries.
Bernd Edlinger [Thu, 9 Apr 2020 01:18:23 +0000 (03:18 +0200)]
Partially revert my UB fix in record_line
This reverts the following commit partially:
commit
64dc2d4bd24ff7119c913fff91184414f09b8042
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Thu Mar 12 11:52:34 2020 +0100
Fix an undefined behavior in record_line
Additionally do not completely remove symbols
at the same PC than the end marker, instead
make them non-is-stmt breakpoints.
We keep the undefined behavoir fix,
but have to restore the original behavior
regarding deletion of the line entries.
2020-04-09 Bernd Edlinger <bernd.edlinger@hotmail.de>
revert partially:
2020-04-01 Bernd Edlinger <bernd.edlinger@hotmail.de>
* buildsym.c (record_line): Fix undefined behavior and preserve
lines at eof.
Kamil Rytarowski [Wed, 8 Apr 2020 02:01:10 +0000 (04:01 +0200)]
Add SVR4 psABI specific parser for AUXV entries
NetBSD and OpenBSD always use an int to store the type as
defined in the SVR4 psABI specifications rather than long
as assumed by the default parser.
Define svr4_auxv_parse() that shares code with default_auxv_parse().
Remove obsd_auxv_parse() and switch OpenBSD to svr4_auxv_parse().
Remove not fully accurate comment from obsd-tdep.c.
Use svr4_auxv_parse() on NetBSD.
gdb/ChangeLog:
* auxv.h (svr4_auxv_parse): New.
* auxv.c (default_auxv_parse): Split into default_auxv_parse
and generic_auxv_parse.
(svr4_auxv_parse): Add.
* obsd-tdep.c: Include "auxv.h".
(obsd_auxv_parse): Remove.
(obsd_init_abi): Remove comment.
(obsd_init_abi): Change set_gdbarch_auxv_parse passed argument
from `obsd_auxv_parse' to `svr4_auxv_parse'.
* nbsd-tdep.c: Include "auxv.h".
(nbsd_init_abi): Call set_gdbarch_auxv_parse.
Rainer Orth [Thu, 9 Apr 2020 11:10:40 +0000 (13:10 +0200)]
ld: Fix pr22269-1 on 32-bit Solaris/SPARC
pr22269-1.s currently FAILs to assemble on 32-bit Solaris/SPARC:
ERROR: -K PIC tmpdir/pr22269-1.s: assembly failed
UNRESOLVED: pr22269-1 (static pie undefined weak)
tmpdir/pr22269-1.s: Assembler messages:
tmpdir/pr22269-1.s:27: Error: Architecture mismatch on "be,pn %icc,.LL4 ,pn %icc,.LL4".
tmpdir/pr22269-1.s:27: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
tmpdir/pr22269-1.s:32: Error: Architecture mismatch on "return %i7+8".
tmpdir/pr22269-1.s:32: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
tmpdir/pr22269-1.s:36: Error: Architecture mismatch on "return %i7+8".
tmpdir/pr22269-1.s:36: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.)
I could trace this to the fact that gcc on sparc-sun-solaris2.* defaults
to --with-cpu=v9. So the gcc -S step of compiling the testcase is run
with -mcpu=v9, while the manual invocation of as-new lacks the
corresponding -Av9, creating a mismatch.
Solaris seems to be the only affected target, otherwise only
64-bit-default configurations default to --with-cpu=v9 or
--with-cpu=ultrasparc: sparcv9-*-*, sparc64-*-*,
sparc64-*-freebsd*, ultrasparc-*-freebsd*, and sparc64-*-openbsd*.
This patch just adds -Av9 to AFLAGS_PIC in ld-elf/shared.exp. It has a
precedent in ld-elfvers/vers.exp where -Av9a is added to as_options on
sparc-*-*. It lets the test pass and causes no other changes in
sparc-sun-solaris2.11 test results.
* testsuite/ld-elf/shared.exp: Add -Av9 to AFLAGS_PIC on sparc*-*-*.
H.J. Lu [Thu, 9 Apr 2020 02:31:45 +0000 (19:31 -0700)]
x86: Correct -mlfence-before-indirect-branch= documentation
Replace "after indirect near branch" with "before indirect near branch".
* doc/c-i386.texi: Correct -mlfence-before-indirect-branch=
documentation.
GDB Administrator [Thu, 9 Apr 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Add pending stop support to gdbserver's Windows port
This changes gdbserver to also handle pending stops, the same way that
gdb does. This is PR gdb/22992.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
PR gdb/22992
* win32-low.c (child_continue): Call matching_pending_stop.
(get_child_debug_event): Call fetch_pending_stop. Push pending
stop when needed.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Implement stopped_by_sw_breakpoint for Windows gdbserver
This changes the Windows gdbserver port to implement the
stopped_by_sw_breakpoint target method. This is needed to support
pending stops.
This is a separate patch now, because Pedro suggested splitting it out
for simpler bisecting, in the case that it introduces a bug.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (win32_process_target::stopped_by_sw_breakpoint)
(win32_process_target::supports_stopped_by_sw_breakpoint):
Declare.
* win32-low.c (win32_supports_z_point_type): Always handle
Z_PACKET_SW_BP.
(win32_insert_point): Call insert_memory_breakpoint when needed.
(win32_remove_point): Call remove_memory_breakpoint when needed.
(win32_process_target::stopped_by_sw_breakpoint)
(win32_process_target::supports_stopped_by_sw_breakpoint): New
methods.
(win32_target_ops): Update.
(maybe_adjust_pc): New function.
(win32_wait): Call maybe_adjust_pc.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Introduce win32_target_ops::decr_pc_after_break
This adds a decr_pc_after_break member to win32_target_ops and updates
the two Windows targets to set it.
Note that I can't test the win32-arm-low.c change.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct win32_target_ops) <decr_pc_after_break>: New
field.
* win32-i386-low.c (the_low_target): Update.
* win32-arm-low.c (the_low_target): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Add read_pc / write_pc support to win32-low
This changes win32-low.c to implement the read_pc and write_pc
methods. A subsequent patch will need these.
Note that I have no way to test, or even compile, the win32-arm-low.c
change.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (win32_process_target::read_pc)
(win32_process_target::write_pc): Declare.
* win32-low.c (win32_process_target::read_pc)
(win32_process_target::write_pc): New methods.
* win32-i386-low.c (i386_win32_get_pc, i386_win32_set_pc): New
functions.
(the_low_target): Update.
* win32-arm-low.c (arm_win32_get_pc, arm_win32_set_pc): New
functions.
(the_low_target): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Make last_wait_event static
Now that last_wait_event is entirely handled in nat/windows-nat.c, it
can be made static.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (last_wait_event): Don't declare.
(wait_for_debug_event): Update comment.
* nat/windows-nat.c (last_wait_event): Now static.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Move wait_for_debug_event to nat/windows-nat.c
This moves the wait_for_debug_event helper function to
nat/windows-nat.c, and changes gdbserver to use it.
wait_for_debug_event is a wrapper for WaitForDebugEvent that also sets
last_wait_event when appropriate. This is needed to properly handle
queued stops.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (wait_for_debug_event): Move to
nat/windows-nat.c.
* nat/windows-nat.h (wait_for_debug_event): Declare.
* nat/windows-nat.c (wait_for_debug_event): Move from
windows-nat.c. No longer static.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_kill, get_child_debug_event): Use
wait_for_debug_event.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Introduce fetch_pending_stop
This introduces a new "fetch_pending_stop" function and changes gdb to
use it. This function removes the first matching pending stop from
the list of such stops.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (get_windows_debug_event): Use
fetch_pending_stop.
* nat/windows-nat.h (fetch_pending_stop): Declare.
* nat/windows-nat.c (fetch_pending_stop): New function.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share some inferior-related Windows code
This adds a couple of functions to nat/windows-nat.c and changes gdb
and gdbserver to use them. One function checks the list of pending
stops for a match (not yet used by gdbserver, but will be in a
subsequent patch); and the other is a wrapper for ContinueDebugEvent
that always uses the last "real" stop event.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_continue): Use matching_pending_stop and
continue_last_debug_event.
* nat/windows-nat.h (matching_pending_stop)
(continue_last_debug_event): Declare.
* nat/windows-nat.c (DEBUG_EVENTS): New define.
(matching_pending_stop, continue_last_debug_event): New
functions.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (child_continue): Call continue_last_debug_event.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share handle_exception
Both gdb and gdbserver have a "handle_exception" function, the bulk of
which is shared between the two implementations. This patch arranges
for the entire thing to be moved into nat/windows-nat.c, with the
differences handled by callbacks. This patch introduces one more
callback to make this possible.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (MS_VC_EXCEPTION): Move to nat/windows-nat.c.
(handle_exception_result): Move to nat/windows-nat.h.
(DEBUG_EXCEPTION_SIMPLE): Remove.
(windows_nat::handle_ms_vc_exception): New function.
(handle_exception): Move to nat/windows-nat.c.
(get_windows_debug_event): Update.
(STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP): Move to
nat/windows-nat.c.
* nat/windows-nat.h (handle_ms_vc_exception): Declare.
(handle_exception_result): Move from windows-nat.c.
(handle_exception): Declare.
* nat/windows-nat.c (MS_VC_EXCEPTION, handle_exception)
(STATUS_WX86_SINGLE_STEP, STATUS_WX86_BREAKPOINT): Move from
windows-nat.c.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (handle_exception): Remove.
(windows_nat::handle_ms_vc_exception): New function.
(get_child_debug_event): Add "continue_status" parameter.
Update.
(win32_wait): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Remove some globals from windows-nat.c
windows-nat.c has a few "count" globals that don't seem to be used.
Possibly they were used for debugging at some point, but they no
longer seem useful to me. Because they get in the way of some code
sharing, this patch removes them.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (exception_count, event_count): Remove.
(handle_exception, get_windows_debug_event)
(do_initial_windows_stuff): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share handle_load_dll and handle_unload_dll declarations
This changes nat/windows-nat.h to declare handle_load_dll and
handle_unload_dll. The embedding application is required to implement
these -- while the actual code was difficult to share due to some
other differences between the two programs, sharing the declaration
lets a subsequent patch share more code that uses these as callbacks.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat::handle_load_dll)
(windows_nat::handle_unload_dll): Rename. No longer static.
* nat/windows-nat.h (handle_load_dll, handle_unload_dll):
Declare.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (windows_nat::handle_load_dll): Rename from
handle_load_dll. No longer static.
(windows_nat::handle_unload_dll): Rename from handle_unload_dll.
No longer static.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Fix up complaints.h for namespace use
If 'complaint' is used in a namespace context, it will fail because
'stop_whining' is only declared at the top level. This patch fixes
this problem in a simple way, by moving the declaration of
'stop_whining' out of the macro and to the top-level.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* complaints.h (stop_whining): Declare at top-level.
(complaint): Don't declare stop_whining.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Normalize handle_output_debug_string API
This changes gdbserver's implementation of handle_output_debug_string
to have the same calling convention as that of gdb. This allows for
sharing some more code in a subsequent patch.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat::handle_output_debug_string):
Rename. No longer static.
* nat/windows-nat.h (handle_output_debug_string): Declare.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (handle_output_debug_string): Add parameter. Change
return type.
(win32_kill, get_child_debug_event): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share some Windows-related globals
This moves some Windows-related globals into nat/windows-nat.c,
sharing them between gdb and gdbserver.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, last_wait_event)
(current_windows_thread, desired_stop_thread_id, pending_stops)
(struct pending_stop, siginfo_er): Move to nat/windows-nat.c.
(display_selectors, fake_create_process)
(get_windows_debug_event): Update.
* nat/windows-nat.h (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, last_wait_event)
(current_windows_thread, desired_stop_thread_id, pending_stops)
(struct pending_stop, siginfo_er): Move from windows-nat.c.
* nat/windows-nat.c (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, last_wait_event)
(current_windows_thread, desired_stop_thread_id, pending_stops)
(siginfo_er): New globals. Move from windows-nat.c.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (current_process_handle, current_process_id)
(main_thread_id, last_sig, current_event, siginfo_er): Move to
nat/windows-nat.c.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share get_image_name between gdb and gdbserver
This moves get_image_name to nat/windows-nat.c so that it can be
shared between gdb and gdbserver.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (get_image_name): Move to nat/windows-nat.c.
(handle_load_dll): Update.
* nat/windows-nat.c (get_image_name): Move from windows-nat.c.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (get_image_name): Remove.
(handle_load_dll): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share thread_rec between gdb and gdbserver
This changes gdb and gdbserver to use the same calling convention for
the "thread_rec" helper function. Fully merging these is difficult
due to differences in how threads are managed by the enclosing
applications; but sharing a declaration makes it possible for future
shared code to call this method.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (enum thread_disposition_type): Move to
nat/windows-nat.h.
(windows_nat::thread_rec): Rename from thread_rec. No longer
static.
(windows_add_thread, windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, handle_exception)
(windows_nat_target::resume, get_windows_debug_event)
(windows_nat_target::get_tib_address)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Update.
* nat/windows-nat.h (enum thread_disposition_type): Move from
windows-nat.c.
(thread_rec): Declare.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (windows_nat::thread_rec): Rename from thread_rec.
No longer static. Change parameters.
(child_add_thread, child_fetch_inferior_registers)
(child_store_inferior_registers, win32_resume)
(win32_get_tib_address): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Wrap shared windows-nat code in windows_nat namespace
This wraps the shared windows-nat code in a windows_nat namespace.
This helps avoid name clashes.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c: Add "using namespace".
* nat/windows-nat.h: Wrap contents in windows_nat namespace.
* nat/windows-nat.c: Wrap contents in windows_nat namespace.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct win32_target_ops): Use qualified names where
needed.
* win32-i386-low.c: Add "using namespace".
* win32-low.c: Add "using namespace".
* win32-arm-low.c: Add "using namespace".
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Call CloseHandle from ~windows_thread_info
Add a destructor to windows_thread_info that calls CloseHandle.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (struct windows_thread_info): Declare
destructor.
* nat/windows-nat.c (~windows_thread_info): New.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (delete_thread_info): Don't call CloseHandle.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Handle pending stops from the Windows kernel
PR gdb/22992 concerns an assertion failure in gdb when debugging a
certain inferior:
int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
Initially the investigation centered on the discovery that gdb was not
suspending other threads when attempting to single-step. This
oversight is corrected in this patch: now, when stepping a thread, gdb
will call SuspendThread on all other threads.
However, the bug persisted even after this change. In particular,
WaitForDebugEvent could see a stop for a thread that was ostensibly
suspended. Our theory of what is happening here is that there are
actually simultaneous breakpoint hits, and the Windows kernel queues
the events, causing the second stop to be reported on a suspended
thread.
In Windows 10 or later gdb could use the DBG_REPLY_LATER flag to
ContinueDebugEvent to request that such events be re-reported later.
However, relying on that did not seem advisable, so this patch instead
arranges to queue such "pending" stops, and then to report them later,
once the step has completed.
In the PR, Pedro pointed out that it's best in this scenario to
implement the stopped_by_sw_breakpoint method, so this patch does this
as well.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
PR gdb/22992
* windows-nat.c (current_event): Update comment.
(last_wait_event, desired_stop_thread_id): New globals.
(struct pending_stop): New.
(pending_stops): New global.
(windows_nat_target) <stopped_by_sw_breakpoint>
<supports_stopped_by_sw_breakpoint>: New methods.
(windows_fetch_one_register): Add assertions. Adjust PC.
(windows_continue): Handle pending stops. Suspend other threads
when stepping. Use last_wait_event
(wait_for_debug_event): New function.
(get_windows_debug_event): Use wait_for_debug_event. Handle
pending stops. Queue spurious stops.
(windows_nat_target::wait): Set stopped_at_software_breakpoint.
(windows_nat_target::kill): Use wait_for_debug_event.
* nat/windows-nat.h (struct windows_thread_info)
<stopped_at_software_breakpoint>: New field.
* nat/windows-nat.c (windows_thread_info::resume): Clear
stopped_at_software_breakpoint.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Change type of argument to windows-nat.c:thread_rec
windows-nat.c:thread_rec accepts an integer parameter whose
interpretation depends on whether it is less than, equal to, or
greater than zero. I found this confusing at times, so this patch
replaces it with an enum instead.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (enum thread_disposition_type): New.
(thread_rec): Replace "get_context" parameter with "disposition";
change type.
(windows_add_thread, windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, handle_exception)
(windows_nat_target::resume, get_windows_debug_event)
(windows_nat_target::get_tib_address)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share Windows thread-suspend and -resume code
This adds "suspend" and "resume" methods to windows_thread_info, and
changes gdb and gdbserver to share this code.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (thread_rec): Use windows_thread_info::suspend.
(windows_continue): Use windows_continue::resume.
* nat/windows-nat.h (struct windows_thread_info) <suspend,
resume>: Declare new methods.
* nat/windows-nat.c: New file.
* configure.nat (NATDEPFILES): Add nat/windows-nat.o when needed.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_require_context, suspend_one_thread): Use
windows_thread_info::suspend.
(continue_one_thread): Use windows_thread_info::resume.
* configure.srv (srv_tgtobj): Add windows-nat.o when needed.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Use lwp, not tid, for Windows thread id
This changes windows-nat.c to put the Windows thread id into the "lwp"
field of ptid_t, not the "tid" field. This is done for two reasons.
First, ptid.h has this to say:
process_stratum targets that handle threading themselves should
prefer using the ptid.lwp field, leaving the ptid.tid field for any
thread_stratum target that might want to sit on top.
Second, this change brings gdb and gdbserver into sync here, which
makes sharing code simpler.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_add_thread, windows_delete_thread)
(windows_nat_target::fetch_registers)
(windows_nat_target::store_registers, fake_create_process)
(windows_nat_target::resume, windows_nat_target::resume)
(get_windows_debug_event, windows_nat_target::wait)
(windows_nat_target::pid_to_str)
(windows_nat_target::get_tib_address)
(windows_nat_target::get_ada_task_ptid)
(windows_nat_target::thread_name)
(windows_nat_target::thread_alive): Use lwp, not tid.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Make windows_thread_info::name a unique_xmalloc_ptr
This changes windows_thread_info::name to be a unique_xmalloc_ptr,
removing some manual memory management.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (handle_exception)
(windows_nat_target::thread_name): Update.
* nat/windows-nat.h (windows_thread_info): Remove destructor.
<name>: Now unique_xmalloc_ptr.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Change two windows_thread_info members to "bool"
This changes a couple of fields of windows_thread_info to have type
"bool". It also updates the comment of another field, to clarify the
possible values it can hold.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (thread_rec)
(windows_nat_target::fetch_registers): Update.
* nat/windows-nat.h (struct windows_thread_info) <suspended>:
Update comment.
<debug_registers_changed, reload_context>: Now bool.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-i386-low.c (update_debug_registers)
(i386_prepare_to_resume, i386_thread_added): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Use new and delete for windows_thread_info
This adds a constructor, destructor, and member initializers to
windows_thread_info, and changes gdb and gdbserver to use new and
delete.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_add_thread): Use new.
(windows_init_thread_list, windows_delete_thread): Use delete.
(get_windows_debug_event): Update.
* nat/windows-nat.h (struct windows_thread_info): Add constructor,
destructor, and initializers.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (child_add_thread): Use new.
(delete_thread_info): Use delete.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Share windows_thread_info between gdb and gdbserver
This introduces a new file, nat/windows-nat.h, which holds the
definition of windows_thread_info. This is now shared between gdb and
gdbserver.
Note that the two implementations different slightly. gdb had a
couple of fields ("name" and "reload_context") that gdbserver did not;
while gdbserver had one field ("base_context") that gdb did not, plus
better comments. The new file preserves all the fields, and the
comments.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info): Remove.
* nat/windows-nat.h: New file.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct windows_thread_info): Remove.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Rename windows_thread_info::id to "tid"
This changes the name of a field in windows_thread_info, bringing gdb
and gdbserver closer into sync.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info) <tid>: Rename from "id".
(thread_rec, windows_add_thread, windows_delete_thread)
(windows_continue): Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Rename win32_thread_info to windows_thread_info
This renames win32_thread_info to windows_thread_info in gdbserver.
This renaming helps make it possible to share some code between gdb
and gdbserver.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.h (struct windows_thread_info): Rename from
win32_thread_info. Remove typedef.
(struct win32_target_ops, win32_require_context): Update.
* win32-low.c (win32_get_thread_context)
(win32_set_thread_context, win32_prepare_to_resume)
(win32_require_context, thread_rec, child_add_thread)
(delete_thread_info, continue_one_thread)
(child_fetch_inferior_registers, child_store_inferior_registers)
(win32_resume, suspend_one_thread, win32_get_tib_address):
Update.
* win32-i386-low.c (update_debug_registers)
(win32_get_current_dr, i386_get_thread_context)
(i386_prepare_to_resume, i386_thread_added, i386_single_step)
(i386_fetch_inferior_register, i386_store_inferior_register):
Update.
* win32-arm-low.c (arm_get_thread_context)
(arm_fetch_inferior_register, arm_store_inferior_register):
Update.
Tom Tromey [Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)]
Remove the "next" field from windows_thread_info
This changes windows_thread_info to remove the "next" field, replacing
the linked list of threads with a vector. This is a prerequisite to
sharing this structure with gdbserver, which manages threads
differently.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (struct windows_thread_info): Remove typedef.
(thread_head): Remove.
(thread_list): New global.
(thread_rec, windows_add_thread, windows_init_thread_list)
(windows_delete_thread, windows_continue): Update.
Simon Marchi [Wed, 8 Apr 2020 18:05:54 +0000 (14:05 -0400)]
gdb: stop using host-dependent signal numbers in windows-tdep.c
The signal enumeration in windows-tdep.c is defined differently whether
it is compiled on Cygwin or not. This is problematic, since the code in
tdep files is not supposed to be influenced by the host platform (the
platform GDB itself runs on).
This makes a difference in windows_gdb_signal_to_target. An obvious
example of clash is SIGABRT. Let's pretend we are cross-debugging a
Cygwin process from a MinGW (non-Cygwin Windows) GDB. If GDB needs to
translate the gdb signal number GDB_SIGNAL_ABRT into a target
equivalent, it would obtain the MinGW number (22), despite the target
being a Cygwin process. Conversely, if debugging a MinGW process from a
Cygwin-hosted GDB, GDB_SIGNAL_ABRT would be converted to a Cygwin signal
number (6) despite the target being a MinGW process. This is wrong,
since we want the result to depend on the target's platform, not GDB's
platform.
This known flaw was accepted because at the time we had a single OS ABI
(called Cygwin) for all Windows binaries (Cygwin ones and non-Cygwin
ones). This limitation is now lifted, as we now have separate Windows
and Cygwin OS ABIs. This means we are able to detect at runtime whether
the binary we are debugging is a Cygwin one or non-Cygwin one.
This patch splits the signal enum in two, one for the MinGW flavors and
one for Cygwin, removing all the ifdefs that made it depend on the host
platform. It then makes two separate gdb_signal_to_target gdbarch
methods, that are used according to the OS ABI selected at runtime.
There is a bit of re-shuffling needed in how the gdbarch'es are
initialized, but nothing major.
gdb/ChangeLog:
* windows-tdep.h (windows_init_abi): Add comment.
(cygwin_init_abi): New declaration.
* windows-tdep.c: Split signal enumeration in two, one for
Windows and one for Cygwin.
(windows_gdb_signal_to_target): Only deal with signal of the
Windows OS ABI.
(cygwin_gdb_signal_to_target): New function.
(windows_init_abi): Rename to windows_init_abi_common, don't set
gdb_signal_to_target gdbarch method. Add new new function with
this name.
(cygwin_init_abi): New function.
* amd64-windows-tdep.c (amd64_windows_init_abi_common): Add
comment. Don't call windows_init_abi.
(amd64_windows_init_abi): Add comment, call windows_init_abi.
(amd64_cygwin_init_abi): Add comment, call cygwin_init_abi.
* i386-windows-tdep.c (i386_windows_init_abi): Rename to
i386_windows_init_abi_common, don't call windows_init_abi. Add
a new function of this name.
(i386_cygwin_init_abi): New function.
(_initialize_i386_windows_tdep): Bind i386_cygwin_init_abi to
OS ABI Cygwin.
Simon Marchi [Wed, 8 Apr 2020 12:07:33 +0000 (08:07 -0400)]
Remove objfile parameter from read_gdb_index_from_buffer
I noticed this was unused, so remove it.
gdb/ChangeLog:
* dwarf2/read.c (read_gdb_index_from_buffer): Remove objfile
parameter.c.
(dwarf2_read_gdb_index): Update.
Gunther Nikl [Wed, 8 Apr 2020 11:33:16 +0000 (12:33 +0100)]
[PATCH 1/4]: microblaze: remove duplicate prototypes
The microblaze target header duplicates prototypes already provided by tc.h.
* config/tc-microblaze.h (md_begin, md_assemble, md_undefined_symbol,
md_show_usage, md_convert_frag, md_operand, md_number_to_chars,
md_estimate_size_before_relax, md_section_align, tc_gen_reloc,
md_apply_fix3): Delete prototypes.
Gunther Nikl [Wed, 8 Apr 2020 11:28:10 +0000 (12:28 +0100)]
[PATCH 4/4]: Add generic prototype for md_pcrel_from_section
This patch removes the need for target headers to provide a custom prototype
for md_pcrel_from_section.
* tc.h (md_pcrel_from_section): Add prototype.
* config/tc-aarch64.h (md_pcrel_from_section): Remove prototype.
* config/tc-arc.h (md_pcrel_from_section): Likewise.
* config/tc-arm.h (md_pcrel_from_section): Likewise.
* config/tc-avr.h (md_pcrel_from_section): Likewise.
* config/tc-bfin.h (md_pcrel_from_section): Likewise.
* config/tc-bpf.h (md_pcrel_from_section): Likewise.
* config/tc-csky.h (md_pcrel_from_section): Likewise.
* config/tc-d10v.h (md_pcrel_from_section): Likewise.
* config/tc-d30v.h (md_pcrel_from_section): Likewise.
* config/tc-epiphany.h (md_pcrel_from_section): Likewise.
* config/tc-fr30.h (md_pcrel_from_section): Likewise.
* config/tc-frv.h (md_pcrel_from_section): Likewise.
* config/tc-iq2000.h (md_pcrel_from_section): Likewise.
* config/tc-lm32.h (md_pcrel_from_section): Likewise.
* config/tc-m32c.h (md_pcrel_from_section): Likewise.
* config/tc-m32r.h (md_pcrel_from_section): Likewise.
* config/tc-mcore.h (md_pcrel_from_section): Likewise.
* config/tc-mep.h (md_pcrel_from_section): Likewise.
* config/tc-metag.h (md_pcrel_from_section): Likewise.
* config/tc-microblaze.h (md_pcrel_from_section): Likewise.
* config/tc-mmix.h (md_pcrel_from_section): Likewise.
* config/tc-moxie.h (md_pcrel_from_section): Likewise.
* config/tc-msp430.h (md_pcrel_from_section): Likewise.
* config/tc-mt.h (md_pcrel_from_section): Likewise.
* config/tc-or1k.h (md_pcrel_from_section): Likewise.
* config/tc-ppc.h (md_pcrel_from_section): Likewise.
* config/tc-rl78.h (md_pcrel_from_section): Likewise.
* config/tc-rx.h (md_pcrel_from_section): Likewise.
* config/tc-s390.h (md_pcrel_from_section): Likewise.
* config/tc-sh.h (md_pcrel_from_section): Likewise.
* config/tc-xc16x.h (md_pcrel_from_section): Likewise.
* config/tc-xstormy16.h (md_pcrel_from_section): Likewise.
Gunther Nikl [Wed, 8 Apr 2020 10:15:28 +0000 (11:15 +0100)]
[PATCH 3/4]: m32c: remove duplicate define and prototype
The m32c target header has a duplicate entry for MD_PCREL_FROM_SECTION.
The duplication was present since the initial commit of the port.
* config/tc-m32c.h (MD_PCREL_FROM_SECTION): Delete duplicate define.
(md_pcrel_from_section): Remove duplicate prototype.
Gunther Nikl [Wed, 8 Apr 2020 10:11:43 +0000 (11:11 +0100)]
[PATCH 2/4]: moxie: use generic pcrel support
The moxie target header uses md_pcrel_from, thus the local prototype and
the macro definition for MD_PCREL_FROM_SECTION are not needed.
* config/tc-moxie.h (MD_PCREL_FROM_SECTION): Delete define.
(md_pcrel_from): Remove prototytpe.
Tom de Vries [Wed, 8 Apr 2020 10:05:34 +0000 (12:05 +0200)]
[gdb/testsuite] Fix imported-unit.exp FAIL without psymtabs
The test-case gdb.dwarf2/imported-unit.exp contains a test testing partial
symbols, so when we run the test-case using either target board readnow,
cc-with-gdb-index or cc-with-debug-names, we run into:
...
FAIL: gdb.dwarf2/imported-unit.exp: no static partial symbols in importing unit
...
Fix this by marking the test unsupported if there are no partial symbols.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-04-08 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (psymtabs_p): New proc.
* gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in
importing unit" unsupported if there are no partial symbols.
Tom de Vries [Wed, 8 Apr 2020 04:57:56 +0000 (06:57 +0200)]
[gdb/testsuite] Add gcc/94469 xfails to gdb.ada/call_pn.exp
When running test-case gdb.ada/call_pn.exp with target board
unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects, we run into:
...
(gdb) print last_node_id^M
Multiple matches for last_node_id^M
[0] cancel^M
[1] pck.last_node_id at gdb/testsuite/gdb.ada/call_pn/pck.adb:17^M
[2] pck.last_node_id at gdb/testsuite/gdb.ada/call_pn/foo.adb:17^M
> FAIL: gdb.ada/call_pn.exp: print last_node_id after calling pn (timeout)
...
This failure is due to a gcc bug that declares two instead of one symbols,
filed as PR gcc/94469.
Add an xfail at this test. Also add a similar xfail at an earlier test, that
only triggers with -readnow. Stabilize test results by making sure the
earlier xfail is always triggered, using "maint expand-symtabs".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-04-08 Tom de Vries <tdevries@suse.de>
PR testsuite/25760
* gdb.ada/call_pn.exp: Call "maint expand-symtabs". Add xfails.
GDB Administrator [Wed, 8 Apr 2020 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in
Kamil Rytarowski [Mon, 6 Apr 2020 18:08:46 +0000 (20:08 +0200)]
Define NetBSD specific skip_solib_resolver
gdb/ChangeLog:
* nbsd-tdep.c: Include "objfiles.h".
(nbsd_skip_solib_resolver): New.
(nbsd_init_abi): Call set_gdbarch_skip_solib_resolver().
nitachra [Tue, 7 Apr 2020 13:06:00 +0000 (18:36 +0530)]
DWARFv5: Info address command error in gdb with DWARFfv5.
GDB throws the error 'Unrecognized DWARF opcode 0x02 at 2' when running
Info address command with the executable file compiled with -gdwarf-5 flag.
This patch fixes this error.
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 -gdwarf-5 flags. Used clang version 10.0.0.
This is the test case used-
void bar(int arr[], int l, int m, int r) {
int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
}
int main()
{
int arr[] = {12, 11};
bar(arr,0,1,2);
return 0;
}
clang -gdwarf-5 test.c -o test.out
gdb test.out
gdb> start
gdb> step
gdb> step
gdb> step
gdb> step
gdb> info address L
Symbol "L" is multi-location:
Range 0x7c04007902bc5084-0x67fb876440700: a complex DWARF expression:
0: DW_OP_breg16 1 [$rip]
Unrecognized DWARF opcode 0x02 at 2
gdb/ChangeLog:
2020-04-07 Nitika Achra <Nitika.Achra@amd.com>
* dwarf2/loc.c (loclist_describe_location): Call the function decode_debug_loclists_
addresses if DWARF version is 5 or more because DW_LLE_start* or DW_LLE_offset_pair
with DW_LLE_base_addressx are being emitted in DWARFv5.
Add the newly added kind DW_LOC_OFFSET_PAIR also.
The length of location description is an unsigned ULEB integer in DWARFv5 instead of
unsigned integer.
nitachra [Tue, 7 Apr 2020 13:05:59 +0000 (18:35 +0530)]
DWARFv5: Handle location list for split dwarf.
GDB throws the error '<error reading variable: dwarf2_find_location_
expression: Corrupted DWARF expression.>' while printing the variable
value with executable file compiled with -gdwarf-5 and -gdwarf-split
flags. This is because DW_LLE_start* or DW_LLE_offset_pair with
DW_LLE_base_addressx are being emitted in DWARFv5 location list instead of
DW_LLE_GNU*. This patch fixes this error.
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
-gdwarf-5 flags. Used clang version 10.0.0. This is the test case used-
void bar(int arr[], int l, int m, int r) {
int i, j, k, n1= m - l + 1, n2= r - m, L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
}
int main()
{
int arr[] = {12, 11};
bar(arr,0,1,2);
return 0;
}
clang -gdwarf-5 -gsplit-dwarf test.c -o test.out
gdb test.out
gdb> start
gdb> step
gdb> step
gdb> step
gdb> step
gdb> p L[0]
dwarf2_find_location_expression: Corrupted DWARF expression.
gdb/ChangeLog:
2020-04-07 Nitika Achra <Nitika.Achra@amd.com>
* dwarf2/loc.c (enum debug_loc_kind): Add a new kind DEBUG_LOC_OFFSET_PAIR.
(dwarf2_find_location_expression): Call the function decode_debug_loclists_
addresses if DWARF version is 5 or more. DW_LLE_start* or DW_LLE_offset_pair
with DW_LLE_base_addressx are being emitted in DWARFv5 instead of DW_LLE_GNU*.
Add applicable base address if the entry is DW_LLE_offset_pair from DWO.
(decode_debug_loclists_addresses): Return DEBUG_LOC_OFFSET_PAIR instead of
DEBUG_LOC_START_END in case of DW_LLE_offset_pair.
nitachra [Tue, 7 Apr 2020 13:05:58 +0000 (18:35 +0530)]
Support for DW_AT_loclists_base and DW_FORM_loclistx.
Hi Tom,
This is the updated series with ChangeLogs edits.
Regards,
Nitika
Simon Marchi [Tue, 7 Apr 2020 15:48:46 +0000 (11:48 -0400)]
gdb: small cleanups in dwarf2_psymtab constructors
I noticed that only one of the two dwarf2_psymtab constructors are
actually used. The one that is used accepts an `addr` parameter (the
base text offset), but its sole caller passes a constant, 0. We want to
keep calling the three-arguments standard_psymtab constructor form,
however, since it differs from the two-arguments form in subtle ways.
Also, I believe the dwarf2_per_cu_data associated to the created
dwarf2_psymtab should be passed as a constructor argument. That will
help me in a future patchset, to convince myself that the `per_cu_data`
field can't be NULL.
So this patch:
- Removes the two-parameters constructor of dwarf2_psymtab, as it is
unused.
- Removes the `addr` parameter of the remaining constructor, passing 0
directly to the base class' constructor.
- Adds a `per_cu` parameter, to assign the `per_cu_data` field at
construction.
gdb/ChangeLog:
* dwarf2/read.h (struct dwarf2_psymtab): Remove two-parameters
constructor. Remove `addr` parameter from other constructor and
add `per_cu` parameter.
* dwarf2/read.c (create_partial_symtab): Update.
Tom de Vries [Tue, 7 Apr 2020 15:33:05 +0000 (17:33 +0200)]
[gdb/symtab] Add symbol with inherited DW_AT_const_value to psymtabs
Consider the test-case added in this patch, with resulting dwarf (related to
variable aaa):
...
<0><d2>: Abbrev Number: 2 (DW_TAG_partial_unit)
<1><eb>: Abbrev Number: 4 (DW_TAG_variable)
<ec> DW_AT_name : aaa
<f0> DW_AT_type : <0xe4>
<f4> DW_AT_const_value : 1
<0><10c>: Abbrev Number: 2 (DW_TAG_compile_unit)
<10e> DW_AT_name : <artificial>
<1><11b>: Abbrev Number: 3 (DW_TAG_variable)
<11c> DW_AT_abstract_origin: <0xeb>
...
When running the test-case, we see:
...
(gdb) p aaa^M
No symbol "aaa" in current context.^M
(gdb) FAIL: gdb.dwarf2/imported-unit-abstract-const-value.exp: p aaa
...
while with target board readnow.exp, we have:
...
(gdb) p aaa^M
$1 = 1^M
...
This is due to the fact that there's no aaa symbol in the partial symtabs:
...
Partial symtab for source file <artificial>@0x101 (object 0x351cf40)^M
...
Global partial symbols:^M
`main', function, 0x4004a7^M
^M
...
which is due to the fact that when attempting to add the symbol corresponding
to DIE 0x11b in add_partial_symbol:
...
(gdb) p /x pdi->sect_off
$4 = 0x11b
(gdb) p pdi.has_const_value
$5 = 0
...
it seems the DW_AT_const_value was not inherited from DIE 0xeb, and
consequently we leave without adding a partial symbol.
Fix this by making sure that partial_die_info::has_const_value is inherited
in partial_die_info::fixup.
Build and reg-tested on x86_64-linux.
Tested test-case with target boards readnow, cc-with-gdb-index and
cc-with-debug-names. The "print aaa" test fails for cc-with-gdb-index, that's
PR25791, the test passes when applying the corresponding proposed patch.
gdb/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
PR symtab/25796
* dwarf2/read.c (can_have_DW_AT_const_value_p): New function.
(partial_die_info::fixup): Inherit has_const_value.
gdb/testsuite/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
PR symtab/25796
* gdb.dwarf2/imported-unit-abstract-const-value.exp: New file.
Rainer Orth [Tue, 7 Apr 2020 15:03:09 +0000 (17:03 +0200)]
ChangeLog entry for last change.
Rainer Orth [Tue, 7 Apr 2020 14:52:03 +0000 (16:52 +0200)]
ld: Fix several 32-bit SPARC plugin tests
Several ld plugin tests currently FAIL on 32-bit Solaris/SPARC:
FAIL: load plugin with source
FAIL: plugin claimfile lost symbol with source
FAIL: plugin claimfile replace symbol with source
FAIL: plugin claimfile resolve symbol with source
FAIL: plugin claimfile replace file with source
FAIL: plugin set symbol visibility with source
FAIL: plugin ignore lib with source
FAIL: plugin claimfile replace lib with source
FAIL: plugin 2 with source lib
FAIL: load plugin 2 with source
FAIL: load plugin 2 with source and -r
FAIL: plugin 3 with source lib
FAIL: load plugin 3 with source
FAIL: load plugin 3 with source and -r
FAIL: PR ld/20070
all of them in the same way:
./ld-new: BFD (GNU Binutils) 2.34.50.
20200328 internal error, aborting at /vol/src/gnu/binutils/hg/master/git/bfd/elf32-sparc.c:154 in sparc_final_write_processing
This happens when bfd_get_mach returns 0 when abfd refers to a source
file:
$11 = {
filename = 0x28c358 "/vol/src/gnu/binutils/hg/master/local/ld/testsuite/ld-plugin/func.c (symbol from plugin)", xvec = 0x24ed6c <sparc_elf32_sol2_vec>,
[...]
While I could find no specification what abfd's are allowed/expected in
*_final_write_processing, I could find no other target that behaved the
same. And indeed ignoring the 0 case fixes the failures. The code now
errors for other values. 64-bit SPARC is not affected because it doesn't
have a specific implementation of elf_backend_final_write_processing.
Tested on sparc-sun-solaris2.11.
2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Nick Clifton <nickc@redhat.com>
* elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
<0>: Ignore.
<default>: Error rather than abort.
H.J. Lu [Tue, 7 Apr 2020 11:43:49 +0000 (04:43 -0700)]
gas: Mention support for Intel SERIALIZE and TSXLDTRK
* NEWS: Mention support for Intel SERIALIZE and TSXLDTRK
instructions.
H.J. Lu [Tue, 7 Apr 2020 11:17:01 +0000 (04:17 -0700)]
gas/doc/c-z80.texi: Fix @xref warnings
Fix
gas/doc/c-z80.texi:244: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:278: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:284: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:291: warning: `.' or `,' must follow @xref, not )
gas/doc/c-z80.texi:295: warning: `.' or `,' must follow @xref, not )
* doc/c-z80.texi: Fix @xref warnings.
Tom de Vries [Tue, 7 Apr 2020 08:57:20 +0000 (10:57 +0200)]
[gdb/symtab] Fix check-psymtab failure for inline function
Consider test-case inline.c, containing an inline function foo:
...
static inline int foo (void) { return 0; }
int main (void) { return foo (); }
...
And the test-case compiled with -O2 and debug info:
...
$ gcc -g inline.c -O2
...
This results in a DWARF entry for foo without pc info:
...
<1><114>: Abbrev Number: 4 (DW_TAG_subprogram)
<115> DW_AT_name : foo
<119> DW_AT_decl_file : 1
<11a> DW_AT_decl_line : 2
<11b> DW_AT_prototyped : 1
<11b> DW_AT_type : <0x10d>
<11f> DW_AT_inline : 3 (declared as inline and inlined)
...
When loading the executable in gdb, we create a partial symbol for foo, but
after expansion into a full symbol table no actual symbol is created,
resulting in a maint check-psymtab failure:
...
(gdb) maint check-psymtab
Static symbol `foo' only found in inline.c psymtab
...
Fix this by skipping this type of partial symbol during the check.
Note that we're not fixing this by not creating the partial symbol, because
this breaks setting a breakpoint on an inlined inline function in a CU for
which the partial symtab has not been expanded (test-case
gdb.dwarf2/break-inline-psymtab.exp).
Tested on x86_64-linux.
gdb/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
* psymtab.c (maintenance_check_psymtabs): Skip static LOC_BLOCK
symbols without address.
gdb/testsuite/ChangeLog:
2020-04-07 Tom de Vries <tdevries@suse.de>
* gdb.base/check-psymtab.c: New test.
* gdb.base/check-psymtab.exp: New file.
Cui,Lili [Tue, 7 Apr 2020 05:59:50 +0000 (13:59 +0800)]
Add support for intel TSXLDTRK instructions$
gas/
* config/tc-i386.c (cpu_arch): Add .TSXLDTRK.
(cpu_noarch): Likewise.
* doc/c-i386.texi: Document TSXLDTRK.
* testsuite/gas/i386/i386.exp: Run TSXLDTRK tests.
* testsuite/gas/i386/tsxldtrk.d: Likewise.
* testsuite/gas/i386/tsxldtrk.s: Likewise.
* testsuite/gas/i386/x86-64-tsxldtrk.d: Likewise.
opcodes/
* i386-dis.c (enum): Add PREFIX_0F01_REG_5_MOD_3_RM_1,
(prefix_table): New instructions (see prefixes above).
(rm_table): Likewise.
* i386-gen.c (cpu_flag_init): Add CPU_TSXLDTRK_FLAGS,
CPU_ANY_TSXLDTRK_FLAGS.
(cpu_flags): Add CpuTSXLDTRK.
* i386-opc.h (enum): Add CpuTSXLDTRK.
(i386_cpu_flags): Add cputsxldtrk.
* i386-opc.tbl: Add XSUSPLDTRK insns.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
GDB Administrator [Tue, 7 Apr 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Kamil Rytarowski [Wed, 25 Mar 2020 19:29:44 +0000 (20:29 +0100)]
Implement basic threading support in the NetBSD target
Use sysctl(3) as the portable interface to prompt NetBSD threads on
all supported NetBSD versions. In future newer versions could switch
to PT_LWPSTATUS ptrace(2) API that will be supported on NetBSD 10.0
and newer.
Implement as part of nbsd_nat_target:
- thread_name() - read descriptive thread name
- thread_alive() - check whether a thread is alive
- post_attach() - updates the list of threads after attach
- update_thread_list() - updates the list of threads
- pid_to_str() - translates ptid to a descriptive string
There are two local static functions:
- nbsd_thread_lister() - generic LWP lister for a specified pid
- nbsd_add_threads() - utility to update the list of threads
Now, GDB on NetBSD can attach to a multithreaded process, spawn
a multithreaded process, list threads, print their LWP+PID numbers
and descriptive thread names.
gdb/ChangeLog:
* nbsd-nat.h (struct thread_info): Add forward declaration.
(nbsd_nat_target::thread_alive): Add.
(nbsd_nat_target::thread_name): Likewise.
(nbsd_nat_target::update_thread_list): Likewise.
(update_thread_list::post_attach): Likewise.
(post_attach::pid_to_str): Likewise.
* nbsd-nat.c: Include "gdbthread.h" and "inferior.h".
(nbsd_thread_lister): Add.
(nbsd_nat_target::thread_alive): Likewise.
(nbsd_nat_target::thread_name): Likewise.
(nbsd_add_threads): Likewise.
(update_thread_list::post_attach): Likewise.
(nbsd_nat_target::update_thread_list): Likewise.
(post_attach::pid_to_str): Likewise.
Tom Tromey [Mon, 6 Apr 2020 18:59:57 +0000 (12:59 -0600)]
Select variant field when printing variant
When I updated the Ada variant-printing code to be value-based, I
neglected a couple of issues. First, print_variant_part must first
extract the variant field before finding the active component; second,
print_field_values should pass in the field value as the outer value
when recursing.
This patch fixes both of these issues.
gdb/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* ada-valprint.c (print_variant_part): Extract the variant field.
(print_field_values): Use the field as the outer value when
recursing.
gdb/testsuite/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* gdb.ada/variant-record/proc.adb: New file.
* gdb.ada/variant-record/value.adb: New file.
* gdb.ada/variant-record/value.s: New file.
* gdb.ada/variant-record.exp: New file.
Tom Tromey [Mon, 6 Apr 2020 18:42:40 +0000 (12:42 -0600)]
Fix build breakage in NetBSD tdep files
A recent patch caused some build failures in NetBSD tdep files. I saw
this failure in my --enable-target=all build.
This patch fixes the problems. Tested by rebuilding.
I am going to check this in.
gdb/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* sh-nbsd-tdep.c: Include nbsd-tdep.h.
* ppc-nbsd-tdep.c: Include nbsd-tdep.h.
* mips-nbsd-tdep.c (mipsnbsd_init_abi): Add missing ";".
* arm-nbsd-tdep.c: Include nbsd-tdep.h.
* hppa-nbsd-tdep.c: Include nbsd-tdep.h.
Tom Tromey [Mon, 6 Apr 2020 18:13:24 +0000 (12:13 -0600)]
Handle complex error type in read_base_type
It turns out there was one more bug in the earlier complex series:
read_base_type could cause an assertion failure on some platforms. I
found this running the AdaCore internal test suite, but you can also
see it by running gdb's "gdb.cp" tests for x86 (not x86-64).
In particular, the DW_ATE_complex_float case calls
dwarf2_init_complex_target_type, which calls dwarf2_init_float_type,
which can return a type using TYPE_CODE_ERROR.
This patch changes the DWARF reader to handle this case, the same way
that the f-lang.c patch did. Perhaps init_complex_type really should
be changed to allow TYPE_CODE_ERROR? I was not sure.
Tested on x86-64 Fedora 30, using an x86 build. I'm checking this in.
gdb/ChangeLog
2020-04-06 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (read_base_type) <DW_ATE_complex_float>: Handle
TYPE_CODE_ERROR.
Kamil Rytarowski [Mon, 16 Mar 2020 18:02:22 +0000 (19:02 +0100)]
Add signal number conversions for NetBSD
gdb/ChangeLog:
* nbsd-tdep.c: Include "gdbarch.h".
Define enum with NetBSD signal numbers.
(nbsd_gdb_signal_from_target, nbsd_gdb_signal_to_target): New.
* alpha-nbsd-tdep.c (alphanbsd_init_abi): Call nbsd_init_abi().
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Likewise.
* arm-nbsd-tdep.c (arm_netbsd_elf_init_abi): Likewise.
* hppa-nbsd-tdep.c (hppanbsd_init_abi): Likewise.
* i386-nbsd-tdep.c (i386nbsd_init_abi): Likewise.
* mips-nbsd-tdep.c (nbsd_init_abi): Likewise.
* ppc-nbsd-tdep.c (ppcnbsd_init_abi): Likewise.
* sh-nbsd-tdep.c (shnbsd_init_abi): Likewise.
* sparc-nbsd-tdep.c (sparc32nbsd_init_abi): Likewise.
* sparc64-nbsd-tdep.c (sparc64nbsd_init_abi): Likewise.
* vax-nbsd-tdep.c (vaxnbsd_elf_init_abi): Likewise.
GDB Administrator [Mon, 6 Apr 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 5 Apr 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 4 Apr 2020 02:06:29 +0000 (19:06 -0700)]
elf: Remove zero-sized relocation section from section group
Remove zero-sized relocation section from a section group since it has
been removed from the output.
PR ld/25767
* elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
relocation section from section group.
GDB Administrator [Sat, 4 Apr 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Hannes Domani [Fri, 3 Apr 2020 19:38:31 +0000 (21:38 +0200)]
Fix attributes of typed enums of typedefs
For this enum:
typedef unsigned char byte;
enum byte_enum : byte
{
byte_val = 128
};
The unsigned attribute is not set:
(gdb) p byte_val
$1 = -128
That's because it uses the attributes of the 'byte' typedef for the enum.
So this changes it to use the attributes of the underlying 'unsigned char'
instead.
gdb/ChangeLog:
2020-04-03 Hannes Domani <ssbssa@yahoo.de>
PR gdb/25325
* dwarf2/read.c (read_enumeration_type): Fix typed enum attributes.
gdb/testsuite/ChangeLog:
2020-04-03 Hannes Domani <ssbssa@yahoo.de>
PR gdb/25325
* gdb.cp/typed-enum.cc: New test.
* gdb.cp/typed-enum.exp: New file.
Tom Tromey [Fri, 3 Apr 2020 15:11:55 +0000 (09:11 -0600)]
Fix DWARF disassembly of DW_OP_const_type
While debugging another issue, I noticed that disassembling a DWARF
expression using DW_OP_const_type did not work.
disassemble_dwarf_expression was not properly decoding this operation.
This patch fixes the problem. Tested by re-debugging gdb.
I didn't write a test case because that seemed like overkill for
what's essentially a maintainer's helper.
The expression evaluator does decode this properly, so no other change
was needed.
gdb/ChangeLog
2020-04-03 Tom Tromey <tromey@adacore.com>
* dwarf2/loc.c (disassemble_dwarf_expression) <DW_OP_const_type>:
Read constant block.
GDB Administrator [Fri, 3 Apr 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 2 Apr 2020 19:49:06 +0000 (15:49 -0400)]
gdb: use bfd_get_section_contents to read section contents in is_linked_with_cygwin_dll
The function is_linked_with_cygwin_dll currently uses
gdb_bfd_map_section to get some section contents. This is not ideal
because that memory, which is only used in this function, can't be
released. Instead, it was suggested to use
bfd_get_full_section_contents.
However, bfd_get_full_section_contents returns a newly allocated buffer,
which is not very practical to use with C++ automatic memory management
constructs. I decided to make gdb_bfd_get_full_section_contents, a
small alternative to bfd_get_full_section_contents. It is a small
wrapper around bfd_get_section_contents which returns the full contents
of the section in a gdb::byte_vector.
gdb_bfd_get_full_section_contents could be used at many places that
already allocate a vector of the size of the section and then call
bfd_get_section_contents. I think these call sites can be updated over
time.
gdb/ChangeLog:
* gdb_bfd.h: Include gdbsupport/byte-vector.h.
(gdb_bfd_get_full_section_contents): New declaration.
* gdb_bfd.c (gdb_bfd_get_full_section_contents): New function.
* windows-tdep.c (is_linked_with_cygwin_dll): Use
gdb_bfd_get_full_section_contents.
Simon Marchi [Thu, 2 Apr 2020 19:43:41 +0000 (15:43 -0400)]
gdb: replace some calls to internal_error with gdb_assert
There are a few spots using the pattern:
if (condition)
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
The message brings no value, since it's pretty the description of a
failed assertion. Replace a few of these that are obvious with
gdb_assert.
gdb/ChangeLog:
* exec.c (build_section_table): Replace internal_error with
gdb_assert.
(section_table_xfer_memory_partial): Likewise.
* mdebugread.c (parse_partial_symbols): Likewise.
* psymtab.c (lookup_partial_symbol): Likewise.
* utils.c (wrap_here): Likewise.
Tom Tromey [Thu, 2 Apr 2020 19:13:02 +0000 (13:13 -0600)]
Avoid assertion failure due to complex type change
Tankut Baris Aktemur pointed out that the recent series to change how
complex types are handled introduced a regression.
This assert in init_complex_type was firing:
gdb_assert (TYPE_CODE (target_type) == TYPE_CODE_INT
|| TYPE_CODE (target_type) == TYPE_CODE_FLT);
The problem was that f-lang.c could call init_complex_type with a type
whose code was TYPE_CODE_ERROR.
It seemed best to me to fix this in f-lang.c, rather than to change
init_complex_type to accept error types.
Tested on x86-64 Fedora 30. I'm checking this in.
gdb/ChangeLog
2020-04-02 Tom Tromey <tromey@adacore.com>
* f-lang.c (build_fortran_types): Use arch_type to initialize
builtin_complex_s32 in the TYPE_CODE_ERROR case.
Tom Tromey [Thu, 2 Apr 2020 18:49:35 +0000 (12:49 -0600)]
Micro-optimize partial_die_info::read
While profiling the DWARF reader, I noticed that
partial_die_info::read creates a vector to store attributes. However,
the vector is not needed, as this code only processes a single
attribute at a time.
This patch removes the vector. On my machine, this improves the time
of "./gdb ./gdb" from 2.22 seconds to 1.92 seconds (mean times over 10
runs).
Note that the attribute is initialized by read_attribute, so it does
not need any special initialization. Avoiding this also improves
performance a bit.
Tested on x86-64 Fedora 30. I'm checking this in.
gdb/ChangeLog
2020-04-02 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (partial_die_info::read): Do not create a vector
of attributes.
Andrew Burgess [Mon, 23 Mar 2020 12:40:24 +0000 (12:40 +0000)]
gdb: Don't remove duplicate entries from the line table
In this commit:
commit
8c95582da858ac981f689a6f599acacb8c5c490f
Date: Mon Dec 30 21:04:51 2019 +0000
gdb: Add support for tracking the DWARF line table is-stmt field
A change was made in buildsym_compunit::record_line to remove
duplicate line table entries in some cases. This was an invalid
change, as these duplicate line table entries are used in _some_ cases
as part of prologue detection (see skip_prologue_using_sal).
It might be possible to identify those line table entries that are
required by skip_prologue_using_sal and only keep those duplicates
around, however, I have not done this here. The original duplicate
removal was done because (a) it was easy to implement, and (b) it
seemed obviously harmless.
As (b) is now known to be false, and implementation would be more
complex, and so (a) is also false. As such, it seems better to keep
all duplicates until an actual reason presents itself for why we
should remove any.
The original regression was spotted on RISC-V, which makes use of
skip_prologue_using_sal as part of riscv_skip_prologue. Originally I
created the test gdb.dwarf2/dw2-inline-small-func.exp, however, this
test will not compile on RISC-V as this target doesn't support
.uleb128 or .sleb128 assembler directives containing complex
expressions. As a result I added the gdb.opt/inline-small-func.exp
test, which exposes the bug on RISC-V, but obviously depends on the
compiler to produce specific DWARF information in order to expose the
bug. Still this test does ensure we always get the desired result,
even if the DWARF changes.
Originally the gdb.dwarf2/dw2-inline-small-func.exp test passed on
x86-64 even with the duplicate line table entries incorrectly
removed. The reason for this is that when a compilation unit doesn't
have a 'producer' string then skip_prologue_using_sal is not used,
instead the prologue is always skipped using analysis of the assembler
code.
However, for Clang on x86-64 skip_prologue_using_sal is used, so I
modified the gdb.dwarf2/dw2-inline-small-func.exp test to include a
'producer' string that names the Clang compiler. With this done the
test would fail on x86-64.
One thing to note is that the gdb.opt/inline-small-func.exp test might
fail on some targets. For example, if we compare sparc to risc-v by
looking at sparc32_skip_prologue we see that this function doesn't use
skip_prologue_using_sal, but instead uses find_pc_partial_function
directly. I don't know the full history behind why the code is like
it is, but it feels like sparc32_skip_prologue is an attempt to
duplicate some of the functionality of skip_prologue_using_sal, but
without all of the special cases. If this is true then the new test
could easily fail on this target, this would suggest that sparc should
consider switching to use skip_prologue_using_sal like risc-v does.
gdb/ChangeLog:
* buildsym.c (buildsym_compunit::record_line): Remove
deduplication code.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-inline-small-func-lbls.c: New file.
* gdb.dwarf2/dw2-inline-small-func.c: New file.
* gdb.dwarf2/dw2-inline-small-func.exp: New file.
* gdb.dwarf2/dw2-inline-small-func.h: New file.
* gdb.opt/inline-small-func.c: New file.
* gdb.opt/inline-small-func.exp: New file.
* gdb.opt/inline-small-func.h: New file.
Andrew Burgess [Mon, 23 Mar 2020 15:11:48 +0000 (15:11 +0000)]
gdb/testsuite: Add support for DW_LNS_set_file to DWARF compiler
Extend the Dejagnu DWARF compiler to support DW_LNS_set_file opcode.
This will be used in a later commit. There should be no change in the
testsuite after this commit.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (Dwarf::lines::program::DW_LNS_set_file): New
function.
Andrew Burgess [Mon, 23 Mar 2020 15:11:25 +0000 (15:11 +0000)]
gdb/testsuite: Add compiler options parameter to function_range helper
When using the Dejagnu DWARF compiler tests will often use the
function_range helper function to extract the extents of a function.
If the plan is to compiler the file with non-default compiler flags
then we must pass those same compiler flags through to the
function_range helper function.
This will be used in a later commit, there should be no change in the
testsuite behaviour after this commit.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (function_range): Allow compiler options to be
specified.
Tom de Vries [Thu, 2 Apr 2020 15:12:49 +0000 (17:12 +0200)]
[gdb/testsuite] Don't use O2 for inlining in break-inline-psymtab.exp
In test-case gdb.dwarf2/break-inline-psymtab.exp we use O2 to enable inlining
of bar into foo in break-inline-psymtab-2.c.
Instead, enforce inlining using __attribute__((always_inline)), to avoid any
optimization-related test issues.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-04-02 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/break-inline-psymtab-2.c (bar): Add
__attribute__((always_inline)).
* gdb.dwarf2/break-inline-psymtab.exp: Don't use -O2.
H.J. Lu [Thu, 2 Apr 2020 14:39:55 +0000 (07:39 -0700)]
NOCF_PROTECTION_CFLAGS: Replace nopie with available
* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): Replace
nopie with available.
H.J. Lu [Thu, 2 Apr 2020 14:03:08 +0000 (07:03 -0700)]
ld: Add NOCF_PROTECTION_CFLAGS to turn off -fcf-protection
GCC in Ubuntu 20.04 enables -fcf-protection by default, which leads to
FAIL: S-records
FAIL: S-records with constructors
FAIL: Build plt-main with -z bndplt
FAIL: Build plt-main with PIE and -z bndplt
FAIL: Build plt-main with -z bndplt -z now
FAIL: Build plt-main with PIE and -z bndplt -z now
on x86-64. Add NOCF_PROTECTION_CFLAGS to pass -fcf-protection=none on
these tests.
* testsuite/config/default.exp (NOCF_PROTECTION_CFLAGS): New.
Set to "-fcf-protection=none" if target compiler supports it.
* testsuite/ld-srec/srec.exp: Add $NOCF_PROTECTION_CFLAGS to
CC and CXX.
* testsuite/ld-x86-64/x86-64.exp: Add $NOCF_PROTECTION_CFLAGS
to PLT BND tests.
Jan W. Jagersma [Thu, 2 Apr 2020 13:31:43 +0000 (14:31 +0100)]
coff-go32-exe: support variable-length stubs
The stub size in GO32 executables has historically been fixed at 2048
bytes, due to hardcoded limitations in bfd. Recent patches to djgpp by
Stas Sergeev (CC'd) have pushed the stub right up to this limit, so if
any further expansion is desired, this must first be patched in bfd.
This series includes three patches: The first changes the meaning of
the bfd->origin field slightly, so that target code can use this to
specify an offset into the file where the actual bfd is located.
The second patch then uses this to enable support for variable-sized
stubs in the coff-go32-exe format.
The final patch is only a cleanup, it normalizes function and variable
names in coff-stgo32.c so that they all begin with the same prefix.
bfd * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
bfd->origin to file offset.
* bfdwin.c (bfd_get_file_window): Likewise.
* bfd.c: Clarify the use of the bfd->origin field.
* bfd-in2.h: Regenerate.
* coff-i386.c: Don't include go32exe.h. Allow overriding
coff_write_object_contents via COFF_WRITE_CONTENTS.
* coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
(go32exe_write_object_contents): New functions.
(go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
(COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
(create_go32_stub): Remove check for 2k size limit. Read stub
from go32exe_temp_stub if present.
(go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
copy variable-length stub.
(go32_check_format): Read stub to go32exe_temp_stub, set
origin, return go32exe_cleanup.
(adjust_filehdr_in_post, adjust_filehdr_out_pre)
(adjust_filehdr_out_post, adjust_scnhdr_in_post)
(adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
(adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
Remove functions and their associated #defines.
* coffcode.h (coff_mkobject_hook): Remove stub copying code.
* libcoff-in.h: (struct coff_tdata): New field stub_size.
Rename field go32stub to stub.
* libcoff.h: Regenerate.
* coff-stgo32.c (go32_check_format): Rename to...
(go32exe_check_format): ...this.
(go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
(go32exe_copy_private_bfd_data): ...this.
(stub_bytes): Rename to...
(go32exe_default_stub): ...this.
(create_go32_stub): Rename to...
(go32exe_create_stub): ...this.
* coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
when possible.
include * coff/go32exe.h: Remove file.
* coff/internal.h (struct internal_filehdr): Remove field
go32stub. Remove flag F_GO32STUB.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)]
gdbserver/linux-low: delete 'linux_target_ops' and 'the_low_target'
All the linux target ops have been moved into linux_process_target
as methods. The 'linux_target_ops' struct and its instantiations
are now obsolete. Delete them.
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* linux-low.h (struct linux_target_ops): Remove.
(the_low_target): Remove.
* linux-x86-low.cc (the_low_target): Remove.
* linux-aarch64-low.cc (the_low_target): Ditto.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-cris-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-ia64-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-mips-low.cc (the_low_target): Ditto.
* linux-nios2-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-riscv-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_ipa_tdesc_idx' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'get_ipa_tdesc_idx' linux target op and let a concrete
linux target define the op by overriding the declaration in
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <get_ipa_tdesc_idx>: Remove.
* linux-low.cc (linux_process_target::get_ipa_tdesc_idx): Remove.
* linux-x86-low.cc (class x86_target) <get_ipa_tdesc_idx>: Declare.
(x86_get_ipa_tdesc_idx): Turn into...
(x86_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <get_ipa_tdesc_idx>: Declare.
(ppc_get_ipa_tdesc_idx): Turn into...
(ppc_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <get_ipa_tdesc_idx>: Declare.
(s390_get_ipa_tdesc_idx): Turn into...
(s390_target::get_ipa_tdesc_idx): ...this.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_syscall_trapinfo' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_syscall_trapinfo' linux target op into a method
of process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <get_syscall_trapinfo>
<gdb_catch_this_syscall>
<low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
* linux-low.cc (get_syscall_trapinfo): Turn into...
(linux_process_target::get_syscall_trapinfo): ...this.
(linux_process_target::low_get_syscall_trapinfo): Define.
(gdb_catch_this_syscall_p): Turn into...
(linux_process_target::gdb_catch_this_syscall): ...this.
(linux_process_target::low_supports_catch_syscall): Define.
Update the callers below.
(linux_process_target::wait_1)
(linux_process_target::supports_catch_syscall)
* linux-x86-low.cc (class x86_target) <low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(x86_target::low_supports_catch_syscall): Define.
(x86_get_syscall_trapinfo): Turn into...
(x86_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(aarch64_target::low_supports_catch_syscall): Define.
(aarch64_get_syscall_trapinfo): Turn into...
(aarch64_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_supports_catch_syscall>
<low_get_syscall_trapinfo>: Declare.
(arm_target::low_supports_catch_syscall): Define.
(arm_get_syscall_trapinfo): Turn into...
(arm_target::low_get_syscall_trapinfo): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (the_low_target): Remove the op field.
* linux-s390-low.cc (the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_hardware_single_step' into a method
All the linux low targets except arm define the
'supports_hardware_single_step' op to return true. Hence, we override
the method to return true in linux_process_target, and remove the
definitions in all the linux low targets but arm.
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'supports_hardware_single_step' linux target op and
override the process_stratum_target's op definition in
linux_process_target to return true.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <finish_step_over>
<maybe_hw_step>: Declare.
* linux-low.cc (can_hardware_single_step): Remove.
(maybe_hw_step): Turn into...
(linux_process_target::maybe_hw_step): ...this.
(finish_step_over): Turn into...
(linux_process_target::finish_step_over): ...this.
(linux_process_target::supports_hardware_single_step): Update
to return true.
Update the callers below.
(linux_process_target::single_step)
(linux_process_target::resume_one_lwp_throw)
* linux-arm-low.cc (class arm_target)
<supports_hardware_single_step>: Declare.
(arm_supports_hardware_single_step): Turn into...
(arm_target::supports_hardware_single_step): ...this.
(the_low_target): Remove the op field.
* linux-x86-low.cc (x86_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (aarch64_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-s390-low.cc (s390_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-sh-low.cc (sh_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tile-low.cc (tile_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (xtensa_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_range_stepping' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'supports_range_stepping' linux target op into a method
of linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_supports_range_stepping>: Declare.
* linux-low.cc (linux_process_target::low_supports_range_stepping):
Define.
(linux_process_target::supports_range_stepping): Update the call
site.
* linux-x86-low.cc (class x86_target)
<low_supports_range_stepping>: Declare.
(x86_supports_range_stepping): Turn into...
(x86_target::low_supports_range_stepping): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_supports_range_stepping>: Declare.
(aarch64_supports_range_stepping): Turn into...
(aarch64_target::low_supports_range_stepping): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'emit_ops' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'emit_ops' linux target ops and let the concrete
linux target define the op by overriding the declaration of
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <emit_ops>: Remove.
* linux-low.cc (linux_process_target::emit_ops): Remove.
* linux-x86-low.cc (class x86_target) <emit_ops>: Declare.
(x86_emit_ops): Turn into...
(x86_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <emit_ops>: Declare.
(aarch64_emit_ops): Turn into...
(aarch64_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <emit_ops>: Declare.
(ppc_emit_ops): Turn into...
(ppc_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <emit_ops>: Declare.
(s390_emit_ops): Turn into...
(s390_target::emit_ops): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn fast tracepoint ops into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'install_fast_tracepoint_jump_pad' and
'get_min_fast_tracepoint_insn_len' linux target ops to let the
concrete linux target define the ops by overriding the declarations
of process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the ops.
(class linux_process_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Remove.
* linux-low.cc (linux_process_target::supports_fast_tracepoints)
(linux_process_target::install_fast_tracepoint_jump_pad)
(linux_process_target::get_min_fast_tracepoint_insn_len): Remove.
* linux-x86-low.cc (class x86_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(x86_target::supports_fast_tracepoints): Define.
(x86_install_fast_tracepoint_jump_pad): Turn into...
(x86_target::install_fast_tracepoint_jump_pad): ...this.
(x86_get_min_fast_tracepoint_insn_len): Turn into...
(x86_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-aarch64-low.cc (class aarch64_target)
<supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(aarch64_target::supports_fast_tracepoints): Define.
(aarch64_install_fast_tracepoint_jump_pad): Turn into...
(aarch64_target::install_fast_tracepoint_jump_pad): ...this.
(aarch64_get_min_fast_tracepoint_insn_len): Turn into...
(aarch64_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(ppc_target::supports_fast_tracepoints): Define.
(ppc_install_fast_tracepoint_jump_pad): Turn into...
(ppc_target::install_fast_tracepoint_jump_pad): ...this.
(ppc_get_min_fast_tracepoint_insn_len): Turn into...
(ppc_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target) <supports_fast_tracepoints>
<install_fast_tracepoint_jump_pad>
<get_min_fast_tracepoint_insn_len>: Declare.
(s390_target::supports_fast_tracepoints): Define.
(s390_install_fast_tracepoint_jump_pad): Turn into...
(s390_target::install_fast_tracepoint_jump_pad): ...this.
(s390_get_min_fast_tracepoint_insn_len): Turn into...
(s390_target::get_min_fast_tracepoint_insn_len): ...this.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (the_low_target): Remove the op fields.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:30 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'get_thread_area' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_thread_area' linux target op into a method of
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <stuck_in_jump_pad>
<linux_fast_tracepoint_collecting>
<low_get_thread_area>: Declare.
* linux-low.cc (supports_fast_tracepoints): Remove.
(linux_fast_tracepoint_collecting): Turn into...
(linux_process_target::linux_fast_tracepoint_collecting): ...this.
(linux_process_target::low_get_thread_area): Define.
(stuck_in_jump_pad_callback): Turn into...
(linux_process_target::stuck_in_jump_pad): ...this.
Update the caller below.
(linux_process_target::stabilize_threads)
* linux-x86-low.cc (class x86_target) <low_get_thread_area>:
Declare.
(x86_get_thread_area): Turn into...
(x86_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target) <low_get_thread_area>:
Declare.
(aarch64_get_thread_area): Turn into...
(aarch64_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <low_get_thread_area>:
Declare.
(ppc_get_thread_area): Turn into...
(ppc_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <low_get_thread_area>:
Declare.
(s390_get_thread_area): Turn into...
(s390_target::low_get_thread_area): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'supports_tracepoints' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remote the 'supports_tracepoints' linux target op and let the
concrete linux target define it by overriding the op declared in
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <supports_tracepoints>: Remove.
* linux-low.cc (linux_process_target::supports_tracepoints): Remove.
* linux-x86-low.cc (class x86_target) <supports_tracepoints>:
Declare.
(x86_supports_tracepoints): Turn into...
(x86_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<supports_tracepoints>: Declare.
(aarch64_supports_tracepoints): Turn into...
(aarch64_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <supports_tracepoints>:
Declare.
(ppc_supports_tracepoints): Turn into...
(ppc_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <supports_tracepoints>:
Declare.
(s390_supports_tracepoints): Turn into...
(s390_target::supports_tracepoints): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'process_qsupported' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'process_qsupported' linux target op and let a concrete
linux target define the op by overriding the op declaration in
process_stratum_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <process_qsupported>: Remove.
* linux-low.cc (linux_process_target::process_qsupported): Remove.
* linux-x86-low.cc (class x86_target) <process_qsupported>: Declare.
(x86_linux_process_qsupported): Turn into...
(x86_target::process_qsupported): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (the_low_target): Remove the op
field.
* linux-arm-low.cc (the_low_target): Ditto.
* linux-bfin-low.cc (the_low_target): Ditto.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.
Tankut Baris Aktemur [Thu, 2 Apr 2020 13:11:29 +0000 (15:11 +0200)]
gdbserver/linux-low: turn 'prepare_to_resume' into a method
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'prepare_to_resume' linux target op into a method of
linux_process_target.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <low_prepare_to_resume>: Declare.
* linux-low.cc (linux_process_target::low_prepare_to_resume):
Define.
Update the callers below:
(linux_process_target::resume_one_lwp_throw)
(linux_process_target::low_prepare_to_resume)
* linux-x86-low.cc (class x86_target) <low_prepare_to_resume>:
Declare.
(x86_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<low_prepare_to_resume>: Declare.
(aarch64_target::low_prepare_to_resume): Define.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <low_prepare_to_resume>:
Declare.
(arm_prepare_to_resume): Turn into...
(arm_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <low_prepare_to_resume>:
Declare.
(mips_linux_prepare_to_resume): Turn into...
(mips_target::low_prepare_to_resume): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* linux-crisv32-low.cc (the_low_target): Ditto.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-ppc-low.cc (the_low_target): Ditto.
* linux-s390-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.