binutils-gdb.git
4 years agoRemove obsolete gdbarch_static_transform_name
Rainer Orth [Thu, 25 Jun 2020 15:56:12 +0000 (17:56 +0200)]
Remove obsolete gdbarch_static_transform_name

gdbarch_static_transform_name is completely Solaris-specific or rather
specific to the Studio compilers.  Studio cc has deprecated Stabs support
in the 12.4 release back in 2015, GCC has defaulted to DWARF-2 on Solaris
7+ since 2004 and Stabs themselves are pretty much obsolete, so the whole
code can go.

Tested on sparcv9-sun-solaris2.11 and x86_64-pc-linux-gnu with
--enable-targets=all.

* sol2-tdep.c (sol2_static_transform_name): Remove.
(sol2_init_abi): Don't register it.
* gdbarch.sh (static_transform_name): Remove.
* gdbarch.c, gdbarch.h: Regenerate.

* dbxread.c (read_dbx_symtab) <'S'>: Remove call to
gdbarch_static_transform_name.
* mdebugread.c (parse_partial_symbols) <'S'>: Likewise.
* stabsread.c (define_symbol) <'X'>: Remove.
(define_symbol) <'S'>: Remove gdbarch_static_transform_name
handling.
<'V'>: Likewise.
* xcoffread.c (scan_xcoff_symtab): Remove gdbarch.
<'S'>: Remove call to gdbarch_static_transform_name.

4 years agoUse fork instead of vfork on Solaris
Rainer Orth [Thu, 25 Jun 2020 15:48:14 +0000 (17:48 +0200)]
Use fork instead of vfork on Solaris

The gdb.mi/mi-exec-run.exp test never completed/timed out on Solaris for
quite some time:

FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=main: mi=main: force-fail=1: run failure detected (timeout)

This is for gdb trying to exec mi-exec-run.nox, a copy of mi-exec-run
with execute permissions removed.

The process tree at this point looks like this:

          21254 /vol/gcc/bin/expect -- /vol/gcc/share/dejagnu/runtest.exp GDB_PARALLEL=yes --outdir=outputs/gdb.mi/mi-exec-run-vfork gdb.mi/mi-exec-run.exp
            21300 <defunct>
            21281 <defunct>
            21294 $obj/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory $obj/gdb/testsuite/../data-directory -i=mi
              21297 $obj/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory $obj/gdb/testsuite/../data-directory -i=mi

The parent gdb hangs here:

21294:  $obj/gdb/testsuite/../../gdb/gdb -nw
------------  lwp# 1 / thread# 1  ---------------
 0000000000000000 SYS#0    ()
 0000000000daeccd procfs_target::create_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, int) () + 97 (procfs.c:2853)
 0000000000ca63a7 run_command_1(char const*, int, run_how) () + 349 (basic_string.h:187)
 0000000000ca6516 start_command(char const*, int) () + 26 (infcmd.c:584)
 0000000000b3ca8e do_const_cfunc(cmd_list_element*, char const*, int) () + f (cli-decode.c:96)
 0000000000b3ed77 cmd_func(cmd_list_element*, char const*, int) () + 32 (cli-decode.c:2113)
 0000000000f2d219 execute_command(char const*, int) () + 455 (top.c:657)
 0000000000d4ad77 mi_execute_cli_command(char const*, int, char const*) () + 242 (basic_string.h:187)
 0000000000d4ae80 mi_cmd_exec_run(char const*, char**, int) () + ba (mi-main.c:473)

with these process flags

21294: $obj/gdb/testsuite/../../gdb/gdb -nw
data model = _LP64  flags = VFORKP|ORPHAN|MSACCT|MSFORK
sigpend = 0x00004103,0x00000000,0x00000000
 /1: flags = 0
sigmask = 0xffbffeff,0xffffffff,0x000000ff
cursig = SIGKILL
 /2: flags = DETACH|STOPPED|ASLEEP  lwp_park(0x0,0x0,0x0)
why = PR_SUSPENDED
sigmask = 0x000a2002,0x00000000,0x00000000
[...]

while the child sits at

21297:  $obj/gdb/testsuite/../../gdb/gdb -nw
 00007fffbf078a0b execve   (7fffbffff7567fffbfffec587fffbfffec90, 0)
 00007fffbef84cf6 execvpex () + f6
 00007fffbef84f45 execvp () + 15
 0000000000d60a44 fork_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, void (*)(), gdb::function_view<void (int)>, void (*)(), char const*, void (*)(char const*, char* const*, char* const*)) () + 47f (fork-inferior.c:423)
 0000000000daeccd procfs_target::create_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, int) () + 97 (procfs.c:2853)
 0000000000ca63a7 run_command_1(char const*, int, run_how) () + 349 (basic_string.h:187)
 0000000000ca6516 start_command(char const*, int) () + 26 (infcmd.c:584)
 0000000000b3ca8e do_const_cfunc(cmd_list_element*, char const*, int) () + f (cli-decode.c:96)
 0000000000b3ed77 cmd_func(cmd_list_element*, char const*, int) () + 32 (cli-decode.c:2113)
 0000000000f2d219 execute_command(char const*, int) () + 455 (top.c:657)
 0000000000d4ad77 mi_execute_cli_command(char const*, int, char const*) () + 242 (basic_string.h:187)
 0000000000d4ae80 mi_cmd_exec_run(char const*, char**, int) () + ba (mi-main.c:473)

with

21297: $obj/gdb/testsuite/../../gdb/gdb -nw
data model = _LP64  flags = MSACCT|MSFORK
exitset  = 0x00000000 0x04000000 0x00000000 0x00000000
           0x00000000 0x00000000 0x00000000 0x00000000
 /1: flags = STOPPED|ISTOP  execve(0x7fffbffff756,0x7fffbfffec58,0x7fffbfffec90,0x0)
why = PR_SYSEXIT  what = execve

We have a deadlock here: the execve in the child cannot return until the
parent has handled the PR_SYSEXIT while the parent cannot run with a
vfork'ed child as documented in proc(4):

       The child of a vfork(2) borrows the  parent's  address  space.  When  a
       vfork(2) is executed by a traced process, all watched areas established
       for the parent are suspended until the child terminates or performs  an
       exec(2).  Any  watched areas established independently in the child are
       cancelled when the parent resumes  after  the  child's  termination  or
       exec(2).  PCWATCH  fails  with  EBUSY  if  applied  to  the parent of a
       vfork(2) before the child has terminated or performed an  exec(2).  The
       PR_VFORKP  flag  is  set  in  the  pstatus  structure for such a parent
       process.

In that situation, the parent cannot be killed even with SIGKILL (as
runtest will attempt once the timeout occurs; the pending signal can be
seen in the pflags output above), so the whole test hangs until one
manually kills the child process.

Fortunately, there's an easy way out: when using fork instead of vfork,
the problem doesn't occur, and this is what the current patch does: it
calls fork_inferior with a dummy pre_trace_fun arg.

Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

* procfs.c (procfs_pre_trace): New function.
(procfs_target::create_inferior): Pass it to fork_inferior.

4 years agoDon't include *sol2-tdep.o on Linux/sparc*
Rainer Orth [Thu, 25 Jun 2020 11:54:42 +0000 (13:54 +0200)]
Don't include *sol2-tdep.o on Linux/sparc*

Linux/sparc* currently links Solaris-specific files (sparc-sol2-tdep.o,
sparc64-sol2-tdep.o, sol2-tdep.o) for no apparent reason.  It has no
business doing so, and none of the functions/variables defined there are
used explicitly.  If support for the Solaris OSABI were desired, this
should be done using --enable-targets instead.

Since neither sparc{32,64}_sol2_init_abi currently declared in common
headers (sparc*-tdep.h) are used outside their source files, they are made
static and the declarations removed.

Tested on sparcv9-sun-solaris2.11 and sparc64-unknown-linux-gnu.

* configure.tgt <sparc-*-linux*> (gdb_target_obs): Remove
sparc-sol2-tdep.o, sol2-tdep.o, sparc64-sol2-tdep.o.
<sparc64-*-linux*> (gdb_target_obs): Remove sparc64-sol2-tdep.o,
sol2-tdep.o, sparc-sol2-tdep.o.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Make static.
* sparc-tdep.h (sparc32_sol2_init_abi): Remove.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Make static.
* sparc64-tdep.h (sparc64_sol2_init_abi): Remove.

4 years agoMove common handlers to sol2_init_abi
Rainer Orth [Thu, 25 Jun 2020 11:43:46 +0000 (13:43 +0200)]
Move common handlers to sol2_init_abi

There's some overlap and duplication between 32 and 64-bit Solaris/SPARC
and x86 tdep files, in particular

        sol2_core_pid_to_str
*_sol2_sigtramp_p
        sol2_skip_solib_resolver
        *_sol2_static_transform_name (forgotten on amd64)
        set_gdbarch_sofun_address_maybe_missing (likewise)

This patch avoids this by centralizing common code in sol2-tdep.c.
While sparc_sol2_pc_in_sigtramp and sparc_sol2_static_transform_name
were declared in the shared sparc-tdep.h, they were only used in Solaris
files.

Tested on amd64-pc-solaris2.11, i386-pc-solaris2.11,
sparcv9-sun-solaris2.11, and sparc-sun-solaris2.11, and
sparc64-unknown-linux-gnu.

* amd64-sol2-tdep.c (amd64_sol2_sigtramp_p): Remove.
(amd64_sol2_init_abi): Use sol2_sigtramp_p.
Call sol2_init_abi.
  Remove calls to set_gdbarch_skip_solib_resolver,
set_gdbarch_core_pid_to_str.
* i386-sol2-tdep.c (i386_sol2_sigtramp_p): Remove.
(i386_sol2_static_transform_name): Remove.
(i386_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str.
Use sol2_sigtramp_p.
* sol2-tdep.c (sol2_pc_in_sigtramp): New function.
(sol2_sigtramp_p): New function.
(sol2_static_transform_name): New function.
(sol2_skip_solib_resolver, sol2_core_pid_to_str): Make static.
(sol2_init_abi): New function.
* sol2-tdep.h (sol2_sigtramp_p, sol2_init_abi): Declare.
(sol2_skip_solib_resolver, sol2_core_pid_to_str): Remove.
* sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Remove.
(sparc32_sol2_sigtramp_frame_sniffer): Just call sol2_sigtramp_p.
(sparc_sol2_static_transform_name): Remove.
(sparc32_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver,
set_gdbarch_core_pid_to_str.
* sparc-tdep.h (sparc_sol2_pc_in_sigtramp)
(sparc_sol2_static_transform_name): Remove
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_sniffer): Just
call sol2_sigtramp_p.
(sparc64_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str.

4 years agoUpdate the Swedish translation in the gprof/ subdirectory.
Nick Clifton [Thu, 25 Jun 2020 10:29:24 +0000 (11:29 +0100)]
Update the Swedish translation in the gprof/ subdirectory.

* po/sv.po: Updated Swedish translation.

4 years agoRemove the use of the register keyword in the libiberty.h header file - it is depreca...
Nick Clifton [Thu, 25 Jun 2020 10:16:42 +0000 (11:16 +0100)]
Remove the use of the register keyword in the libiberty.h header file - it is deprecated and incompatible with C++17.

* libiberty.h (bsearch_r): Remove use of the register keyword from
the prototype.

4 years agoStop the assembler from generating R_ARM_THM_JMP11 relocations as these are not suppo...
Nick Clifton [Thu, 25 Jun 2020 10:11:51 +0000 (11:11 +0100)]
Stop the assembler from generating R_ARM_THM_JMP11 relocations as these are not supported by the kernel.

PR 26141
* config/tc-arm.c (arm_force_relocation): Force resolution of
BFD_RELOC_THUMB_PCREL_BRANCH12 relocations.
* testsuite/gas/arm/plt-1.d: Adjust expected disassembly.

4 years agox86: make J disassembler macro available for new use
Jan Beulich [Thu, 25 Jun 2020 07:31:50 +0000 (09:31 +0200)]
x86: make J disassembler macro available for new use

There's clearly a shortage of available macro characters, as can be seen
from the various two-character macros that had to be introduced. Don't
waste characters for things that can be expressed differently. In the
case of J this alternative is {l|}.

4 years agox86: drop left-over 4-way alternative disassembler templates
Jan Beulich [Thu, 25 Jun 2020 07:30:39 +0000 (09:30 +0200)]
x86: drop left-over 4-way alternative disassembler templates

Commit 7c52e0e8658a, dropping the general concept of 4-way alternatives,
for whatever reason, omitted cleaning up these two instances.

4 years agox86: move ImmExt processing
Jan Beulich [Thu, 25 Jun 2020 07:30:09 +0000 (09:30 +0200)]
x86: move ImmExt processing

With abuses of ImmExt gone, all templates using it have operands. Move
its main invocation into process_operands(), matching its secondary one
for the SSE2AVX case.

4 years agox86: operand sizing prefixes can disambiguate insns
Jan Beulich [Thu, 25 Jun 2020 07:29:29 +0000 (09:29 +0200)]
x86: operand sizing prefixes can disambiguate insns

Use of an explicit data size or REX.W prefix is sufficient indication of
the intended operation when operand size can't be derived from suffix or
register operands. Avoid the ambiguity warning and make in particular
immediate handling (sizing) cope with explicitly specified prefixes.

Extending/reusing the noreg16 test made me notice a few cases of
unintentional 32-bit addressing, which gets corrected at the same time.

4 years agox86: fix SYSRET disassembly, improve {,V}CVTSI2S{S,D} and PTWRITE
Jan Beulich [Thu, 25 Jun 2020 07:27:21 +0000 (09:27 +0200)]
x86: fix SYSRET disassembly, improve {,V}CVTSI2S{S,D} and PTWRITE

SYSRET can't use the same macro as IRET, since there's no 16-bit operand
size form of it. Re-use LQ for it instead.

Doing so made obvious that outside of 64-bit mode {,V}CVTSI2S{S,D} and
PTWRITE should have an 'l' suffix printed only in suffix-always mode.

4 years agox86-64: REX prefix is invalid with VEX etc
Jan Beulich [Thu, 25 Jun 2020 07:26:28 +0000 (09:26 +0200)]
x86-64: REX prefix is invalid with VEX etc

Just like for the data size prefix (see commit 7a8655d2bbdc ["x86: don't
abort() upon DATA16 prefix on (E)VEX encoded insn"]), any form of REX
prefix is invalid with VEX/XOP/EVEX.

4 years agox86-64: honor REX prefixes for SSE2AVX
Jan Beulich [Thu, 25 Jun 2020 07:25:52 +0000 (09:25 +0200)]
x86-64: honor REX prefixes for SSE2AVX

Legacy encoded insns do so, and their automatic conversion to AVX ones
ought to produce functionally identical code. Therefore explicit REX
prefixes cannot simply be ignored. This is in particular relevant
because at least PCMPESTR{I,M}'s 64-bit forms couldn't be expressed in
older gas by other than using a REX64 prefix.

4 years agox86: also refuse data size prefix on SIMD insns
Jan Beulich [Thu, 25 Jun 2020 07:25:12 +0000 (09:25 +0200)]
x86: also refuse data size prefix on SIMD insns

The data size prefix alters the meaning of legacy encoded SIMD insns,
and hence shouldn't be accepted there. Use of it also leads to
inconsistencies in SSE2AVX mode. Don't match insns with data size prefix
against SSE2AVX templates.

4 years agox86: drop stray assignment from build_evex_prefix()
Jan Beulich [Thu, 25 Jun 2020 07:24:23 +0000 (09:24 +0200)]
x86: drop stray assignment from build_evex_prefix()

Unlike in build_vex_prefix() this is not needed here.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Jun 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoSync config, include and libiberty with GCC
H.J. Lu [Wed, 24 Jun 2020 19:27:57 +0000 (12:27 -0700)]
Sync config, include and libiberty with GCC

config/

2020-06-24  H.J. Lu  <hongjiu.lu@intel.com>

Sync with GCC
2020-05-29  H.J. Lu  <hjl.tools@gmail.com>

PR bootstrap/95413
* cet.m4: Replace save_CFLAGS and save_LDFLAGS with
cet_save_CFLAGS and cet_save_LDFLAGS.

include/

2020-06-24  H.J. Lu  <hongjiu.lu@intel.com>

Sync with GCC
2020-06-23  Nick Alcock  <nick.alcock@oracle.com>

* libiberty.h (bsearch_r): New.

2020-04-17  Martin Liska  <mliska@suse.cz>
    Jonathan Yong <10walls@gmail.com>

PR gcov-profile/94570
* filenames.h (defined): Do not define HAVE_DOS_BASED_FILE_SYSTEM
for CYGWIN.

libiberty/

2020-06-23  Nick Alcock  <nick.alcock@oracle.com>

* bsearch_r.c: New file.
* Makefile.in (CFILES): Add bsearch_r.c.
(REQUIRED_OFILES): Add bsearch_r.o.
* functions.texi: Regenerate.

2020-05-29  H.J. Lu  <hjl.tools@gmail.com>

PR bootstrap/95413
* configure: Regenerated.

2020-05-15  Iain Buclaw  <ibuclaw@gdcproject.org>

* d-demangle.c (dlang_attributes): Add @live attribute.
* testsuite/d-demangle-expected: Add new tests.

2020-05-14  Rainer Schuetze  <r.sagitario@gmx.de>
    Iain Buclaw  <ibuclaw@gdcproject.org>

* d-demangle.c (enum dlang_symbol_kinds): Remove enum.
(struct dlang_info): New struct
(dlang_decode_backref): New function.
(dlang_backref): New function.
(dlang_symbol_backref): New function.
(dlang_type_backref): New function.
(dlang_symbol_name_p): New function.
(dlang_function_type_noreturn): New function.
(dlang_function_type): Add 'info' parameter.  Decode function type
with dlang_function_type_noreturn.
(dlang_function_args): Add 'info' parameter.
(dlang_type): Add 'info' parameter.  Handle back referenced types.
(dlang_identifier): Replace 'kind' parameter with 'info'.  Handle back
referenced symbols.  Split off decoding of plain identifiers to...
(dlang_lname): ...here.
(dlang_parse_mangle): Replace 'kind' parameter with 'info'.  Decode
function type and return with dlang_type.
(dlang_parse_qualified): Replace 'kind' parameter with 'info', add
'suffix_modifier' parameter.  Decode function type with
dlang_function_type_noreturn.
(dlang_parse_tuple): Add 'info' parameter.
(dlang_template_symbol_param): New function.
(dlang_template_args): Add 'info' parameter.  Decode symbol parameter
with dlang_template_symbol_param.  Handle back referenced values, and
externally mangled parameters.
(dlang_parse_template): Add 'info' parameter.
(dlang_demangle_init_info): New function.
(dlang_demangle): Initialize and pass 'info' parameter.
* testsuite/d-demangle-expected: Add new tests.

4 years agoW/ Clang, compile/link C++ test programs with "-x c++"
Pedro Alves [Wed, 24 Jun 2020 22:18:19 +0000 (23:18 +0100)]
W/ Clang, compile/link C++ test programs with "-x c++"

Some testcases want to compile .c files with a C++ compiler.  So they
pass the "c++" option to gdb_compile.  That works fine with GCC, but
with Clang, it results in:

  gdb compile failed, clang-5.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]

and the testcase is skipped with UNTESTED.

A previous patch fixed a case like that in
gdb.compile/compile-cplus.exp, by adding -Wno-deprecated to the build
options.  However, there are other testcases that use the same
pattern, and all fail for the same reason.  For example:

 gdb.base/info-types-c++.exp
 gdb.base/max-depth-c++.exp
 gdb.base/msym-lang.exp
 gdb.base/whatis-ptype-typedefs.exp
 gdb.btrace/rn-dl-bind.exp

Fix this in a central place, within gdb_compile, by passing "-x c++"
to the compiler driver when we're compiling/linking C++.

This revealed that gdb.compile/compile-cplus.exp and
gdb.arch/amd64-entry-value-paramref.exp tests are compiling an
assembly file with the "c++" option, which would now fail to compile,
with the C++ compiler not grokking the assembly, of course.  We just
need to not pass "c++" and all the other related C++ options when
compiling an assembly file.

gdb/testsuite/ChangeLog:
2020-06-24  Pedro Alves  <palves@redhat.com>

* gdb.arch/amd64-entry-value-paramref.exp: Use
prepare_for_testing_full and don't pass "c++" for the .S file
build spec.
* gdb.compile/compile-cplus.exp: Don't compile $srcfile3 with
$options, since it's an assembly file.  Remove -Wno-deprecated.
* lib/gdb.exp (gdb_compile): Pass "-x c++" explicitly when
compiling C++ programs.

4 years agoW/ Clang, compile C/C++ testcases with -Wno-unknown-warning-option
Pedro Alves [Wed, 24 Jun 2020 22:18:19 +0000 (23:18 +0100)]
W/ Clang, compile C/C++ testcases with -Wno-unknown-warning-option

Some C/C++ testcases unconditionally pass -Wno-foo as additional
options to disable some warning.  That is OK with GCC, because GCC
accepts -Wno-foo silently even if it doesn't support -Wfoo.  This is a
feature which allows disabling warnings with newer compilers without
breaking builds with older compilers.  Clang however warns about
unknown -Wno-foo by default, unless you pass
-Wno-unknown-warning-option as well:

 $ gcc -Wno-foo test.c
 * nothing, compiles successfuly *

 $ clang -Wno-foo test.c
 warning: unknown warning option '-Wno-foo [-Wunknown-warning-option]

This commit adds -Wunknown-warning-option centrally in gdb_compile, so
that individual testcases don't have to worry about breaking older
Clangs.

IOW, this avoids this problematic scenario:

#1 - A testcase compiles successfully with Clang version X.
#2 - Clang version "X + 1" adds a new warning, enabled by default,
     which breaks the test.
#3 - We add -Wno-newwarning to the testcase, fixing the testcase with
     clang "X + 1".
#4 - Now building the test with Clang version X no longer works, due
     to "unknown warning option".

gdb/testsuite/ChangeLog:
2020-06-24  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_compile): Update intro comment.  If C/C++ with
Clang, add "-Wno-unknown-warning-option" to the options.

4 years agoFixes PR 25475: ensure exec-file-mismatch "ask" always asks in case of mismatch.
Philippe Waroquiers [Sun, 21 Jun 2020 19:26:25 +0000 (21:26 +0200)]
Fixes PR 25475: ensure exec-file-mismatch "ask" always asks in case of mismatch.

As explained in https://sourceware.org/bugzilla/show_bug.cgi?id=25475,
when the currently loaded file has no debug symbol,
symbol_file_add_with_addrs does not ask a confirmation to the user
before loading the new symbol file.  The behaviour is not consistent
when symbol_file_add_with_addrs is called due to exec-file-mismatch "ask"
setting.

The PR discusses several solutions/approaches.
The preferred approach (suggested by Joel) is to ensure that GDB always asks
a confirmation when it loads a new symbol file due to exec-file-mismatch,
using a new SYMFILE add-flag.

I tested this manually.  If OK, we can remove the bypass introduced by Tom
in 6b9374f1, in order to always answer to the 'load' question.

gdb/ChangeLog
2020-06-24  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* symfile-add-flags.h: New flag SYMFILE_ALWAYS_CONFIRM.
* exec.c (validate_exec_file): If from_tty, set both
SYMFILE_VERBOSE (== from_tty) and SYMFILE_ALWAYS_CONFIRM.
* symfile.c (symbol_file_add_with_addrs): if always_confirm
and from_tty, unconditionally ask a confirmation.

4 years agobfd/riscv: tighten matching rules in riscv_scan
Andrew Burgess [Tue, 23 Jun 2020 22:22:43 +0000 (23:22 +0100)]
bfd/riscv: tighten matching rules in riscv_scan

The following GDB behaviour was observed:

  (gdb) x/1i 0x0001014a
     0x1014a <main+8>: jal 0x10132 <foo>
  (gdb) show architecture
  The target architecture is set automatically (currently riscv:rv32)
  (gdb) set architecture riscv:rv32
  The target architecture is assumed to be riscv:rv32
  (gdb) x/1i 0x0001014a
     0x1014a <main+8>: 0x37e5
  (gdb)

Notice that initially we can disassemble the instruction (it's a
compressed jal instruction), but after setting the architecture we can
no longer disassemble the instruction.

This is particularly puzzling as GDB initially thought the
architecture was 'riscv:rv32', but when we force the architecture to
be that, the disassembly stops working.

This issue was introduced with this commit:

  commit c35d018b1a5ec604e49a807402c4205530b25ca8
  Date:   Mon Jan 27 15:19:30 2020 -0800

      RISC-V: Fix gdbserver problem with handling arch strings.

In this commit we try to make riscv_scan handle cases where we see
architecture strings like 'riscv:rv32imc' (for example).  Normally
this wouldn't match as bfd_default_scan requires an exact match, so we
extended riscv_scan to ignore trailing characters.

Unfortunately the default riscv arch is called 'riscv', is 64-bit,
and has its mach type set to 0, which I think is intended to pair with
code is riscv-dis.c:riscv_disassemble_insn that tries to guess if we
are 32 or 64 bit.

What happens then is that 'riscv:rv32' is first tested against 'riscv'
using bfd_default_scan, this doesn't match, we then compare this to
'riscv', but allowing trailing characters to be ignored, this matches,
and our 'riscv:rv32' matches against the default (64-bit)
architecture.

The solution I propose is to prevent the default architecture from
taking part in this "ignore trailing characters" extra match case,
only the more specific 'riscv:rv32' and 'riscv:rv64' get this extra
matching.

bfd/ChangeLog:

* cpu-riscv.c (riscv_scan): Don't allow shorter matches using the
default architecture.

4 years agoFix a potential use of an uninitialised variable error in gold.
Nick Clifton [Wed, 24 Jun 2020 16:38:16 +0000 (17:38 +0100)]
Fix a potential use of an uninitialised variable error in gold.

* target-reloc.h (issue_discarded_error): Initialise the
key_symndx variable.

4 years agold: Correct --dependency-file order
H.J. Lu [Wed, 24 Jun 2020 13:39:03 +0000 (06:39 -0700)]
ld: Correct --dependency-file order

Change ld --help output to

  -d, -dc, -dp                Force common symbols to be defined
  --dependency-file FILE      Write dependency file

instead of

  -d, -dc                     Force common symbols to be defined
  --dependency-file FILE, -dp Write dependency file

PR ld/26165
* lexsup.c (ld_options): Correct --dependency-file order.

4 years agocsky: Don't generate unnecessary dynamic tags
H.J. Lu [Wed, 24 Jun 2020 13:14:18 +0000 (06:14 -0700)]
csky: Don't generate unnecessary dynamic tags

Dynamic tags, DT_JMPREL, PLTREL and PLTRELSZ, are needed only if there
are relocation entries for PLT.  Don't generate them if there are no
relocation entries for PLT.

bfd/

PR ld/26083
* elf32-csky.c (csky_elf_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.

ld/

PR ld/26083
* testsuite/ld-csky/tls-ie-v1.d: Updated.
* testsuite/ld-csky/tls-ie.d: Likewise.

4 years agocris: Don't generate unnecessary dynamic tags
H.J. Lu [Wed, 24 Jun 2020 11:00:19 +0000 (04:00 -0700)]
cris: Don't generate unnecessary dynamic tags

Dynamic tags, DT_JMPREL, PLTREL and PLTRELSZ, are needed only if there
are relocation entries for PLT.  Don't generate them if there are no
relocation entries for PLT.

bfd/

PR ld/26083
* elf32-cris.c (elf_cris_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.

ld/

PR ld/26083
* testsuite/ld-cris/libdso-15b.d: Updated.
* testsuite/ld-cris/libdso-1c.d: Likewise.
* testsuite/ld-cris/libdso-1d.d: Likewise.
* testsuite/ld-cris/libdso-15c.d: New file.

4 years agold: Set non_ir_ref_regular on source for assignment
H.J. Lu [Wed, 24 Jun 2020 10:56:05 +0000 (03:56 -0700)]
ld: Set non_ir_ref_regular on source for assignment

We need to set non_ir_ref_regular on the source for assignment to get
the correct LTO resolution:

190 a27be7f4ad90c5ce PREVAILING_DEF real_g

instead of

190 30c3b2d8f967f5ea PREVAILING_DEF_IRONLY real_g

PR ld/26163
* ldexp.c (exp_fold_tree_1): Set non_ir_ref_regular on the source
for assignment.
* testsuite/ld-plugin/lto.exp: Run ld/26163 test.
* testsuite/ld-plugin/pr26163a.c: New file.
* testsuite/ld-plugin/pr26163b.c: Likewise.

4 years agold --help output
Alan Modra [Wed, 24 Jun 2020 04:47:38 +0000 (14:17 +0930)]
ld --help output

It's best if help message output does not contain tabs, since we don't
know tab stop settings or even if tabs are handled by the output
device.  This reverts some 2020-06-23 changes and fixes the csky help
message.

* lexsup.c (elf_shlib_list_options): Properly format help message.
(elf_plt_unwind_list_options): Likewise.
* emultempl/cskyelf.em (PARSE_AND_LIST_OPTIONS): Likewise.

4 years agoubsan: alpha-vms: shift exponent 536874240 is too large
Alan Modra [Wed, 24 Jun 2020 00:54:32 +0000 (10:24 +0930)]
ubsan: alpha-vms: shift exponent 536874240 is too large

C_OPR_ASH is supposed to be an arithmetic shift.  By the look of it,
this operator implemented logical shifts since the original binutils
support was added.  This patch corrects that and avoids some nonsense
ubsan complaints.  I chose to implement infinite precision shifts
rather than masking shift counts to the word size as the spec I had is
silent on what is supposed to happen with overlarge shift counts.

* vms-alpha.c (_bfd_vms_slurp_etir <ETIR__C_OPR_ASH>): Implement
shifts without undefined behaviour.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Jun 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: New maintenance command to print XML target description
Andrew Burgess [Tue, 9 Jun 2020 22:08:54 +0000 (23:08 +0100)]
gdb: New maintenance command to print XML target description

This commit adds a new maintenance command that dumps the current
target description as an XML document.  This is a maintenance command
as I currently only see this being useful for GDB developers, or for
people debugging a new remote target.

By default the command will print whatever the current target
description is, whether this was delivered by the remote, loaded by
the user from a file, or if it is a built in target within GDB.

The command can also take an optional filename argument.  In this case
GDB loads a target description from the file, and then reprints it.
This could be useful for testing GDB's parsing of target descriptions,
or to check that GDB can successfully parse a particular XML
description.

It is worth noting that the XML description printed will not be an
exact copy of the document fed into GDB.  For example this minimal
input file:

  <target>
    <feature name="abc">
      <reg name="r1" bitsize="32"/>
    </feature>
  </target>

Will produce this output:

  (gdb) maint print xml-tdesc path/to/file.xml
  <?xml version="1.0"?>
  <!DOCTYPE target SYSTEM "gdb-target.dtd">
  <target>
    <feature name="abc">
      <reg name="r1" bitsize="32" type="int" regnum="0"/>
    </feature>
  </target>

Notice that GDB filled in both the 'type' and 'regnum' fields of the
<reg>.  I think this is actually a positive as it means we get to
really understand how GDB processed the document, if GDB made some
assumptions that differ to those the user expected then hopefully this
will bring those issues to the users attention.

To implement this I have tweaked the output produced by the
print_xml_feature which is defined within the gdbsupport/ directory.
The changes I have made to this class are:

  1. The <architecture>...</architecture> tags are now not produced if
  the architecture name is NULL.

  2. The <osabi>...</osabi> tags get a newline at the end.

  3. And, the whole XML document is indented using white space in a
  nested fashion (as in the example output above).

I think that these changes should be fine, the print_xml_feature class
is used:

  1. In gdbserver to generate an XML document to send as the target
  description to GDB.

  2. In GDB as part of a self-check function, a target_desc is
  converted to XML then parsed back into a target_desc.  We then check
  the before and after target_desc objects are the same.

  3. In the new 'maint print xml-tdesc' command.

In all of these use cases adding the extra white space should be fine.

gdbsupport/ChangeLog:

* tdesc.cc (print_xml_feature::visit_pre): Use add_line to add
output content, and call indent as needed in all overloaded
variants.
(print_xml_feature::visit_post): Likewise.
(print_xml_feature::visit): Likewise.
(print_xml_feature::add_line): Two new overloaded functions.
* tdesc.h (print_xml_feature::indent): New member function.
(print_xml_feature::add_line): Two new overloaded member
functions.
(print_xml_feature::m_depth): New member variable.

gdb/ChangeLog:

* target-descriptions.c (tdesc_architecture_name): Protect against
NULL pointer dereference.
(maint_print_xml_tdesc_cmd): New function.
(_initialize_target_descriptions): Register new 'maint print
xml-tdesc' command and give it the filename completer.
* NEWS: Mention new 'maint print xml-tdesc' command.

gdb/testsuite/ChangeLog:

* gdb.xml/tdesc-reload.c: New file.
* gdb.xml/tdesc-reload.exp: New file.
* gdb.xml/maint-xml-dump-01.xml: New file.
* gdb.xml/maint-xml-dump-02.xml: New file.
* gdb.xml/maint-xml-dump.exp: New file.

gdb/doc/ChangeLog:

* gdb.texinfo (Maintenance Commands): Document new 'maint print
xml-desc' command.

4 years agogdb: Print compatible information within print_xml_feature
Andrew Burgess [Thu, 11 Jun 2020 21:36:29 +0000 (22:36 +0100)]
gdb: Print compatible information within print_xml_feature

The gdbsupport directory contains a helper class print_xml_feature
that is shared between gdb and gdbserver.  This class is used for
printing an XML representation of a target_desc object.

Currently this class doesn't have the ability to print the
<compatible> entities that can appear within a target description, I
guess no targets have needed that functionality yet.

The print_xml_feature classes API is based around operating on the
target_desc class, however, the sharing between gdb and gdbserver is
purely textural, we rely on their being a class called target_desc in
both gdb and gdbserver, but there is no shared implementation.  We
then have a set of functions declared that operate on an object of
type target_desc, and again these functions have completely separate
implementations.

Currently then the gdb version of target_desc contains a vector of
bfd_arch_info pointers which represents the compatible entries from a
target description.  The gdbserver version of target_desc has no such
information.  Further, the gdbserver code doesn't seem to include the
bfd headers, and so doesn't know about the bfd types.

I was reluctant to include the bfd headers into gdbserver just so I
can reference the compatible information, which isn't (currently) even
needed in gdbserver.

So, the approach I take in this patch is to wrap the compatible
information into a new helper class.  This class is declared in the
gdbsupport library, but implemented separately in both gdb and
gdbserver.

In gdbserver the class is empty.  The compatible information within
the gdbserver is an empty list, of empty classes.

In gdb the class contains a pointer to the bfd_arch_info object.

With this in place we can now add support to print_xml_feature for
printing the compatible information if it is present.  In the
gdbserver code this will never happen, as the gdbserver never has any
compatible information.  But in gdb, this code will trigger when
appropriate.

gdb/ChangeLog:

* target-descriptions.c (class tdesc_compatible_info): New class.
(struct target_desc): Change type of compatible vector.
(tdesc_compatible_p): Update for change in type of
target_desc::compatible.
(tdesc_compatible_info_list): New function.
(tdesc_compatible_info_arch_name): New function.
(tdesc_add_compatible): Update for change in type of
target_desc::compatible.
(print_c_tdesc::visit_pre): Likewise.

gdbserver/ChangeLog:

* tdesc.cc (struct tdesc_compatible_info): New struct.
(tdesc_compatible_info_list): New function.
(tdesc_compatible_info_arch_name): New function.

gdbsupport/ChangeLog:

* tdesc.cc (print_xml_feature::visit_pre): Print compatible
information.
* tdesc.h (struct tdesc_compatible_info): Declare new struct.
(tdesc_compatible_info_up): New typedef.
(tdesc_compatible_info_list): Declare new function.
(tdesc_compatible_info_arch_name): Declare new function.

4 years agogdb: Allow target description to be dumped even when it is remote
Andrew Burgess [Tue, 9 Jun 2020 18:00:55 +0000 (19:00 +0100)]
gdb: Allow target description to be dumped even when it is remote

The maintenance command 'maintenance print c-tdesc' can only print the
target description if it was loaded from a local file, or if the local
filename is passed to the maintenance command as an argument.

Sometimes it would be nice to know what target description GDB was
given by the remote, however, if I connect to a remote target and try
this command I see this:

  (gdb) maintenance print c-tdesc
  The current target description did not come from an XML file.
  (gdb)

Which is not very helpful.

This commit changes things so that if the description came from the
remote end then GDB will use a fake filename 'fetched from target' as
the filename for the description, GDB will then create the C
description of the target as though it came from this file.  Example
output would look like this (I snipped the feature creation from the
middle as that hasn't changed):

  (gdb) maintenance print c-tdesc
  /* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
    Original: fetched from target */

  #include "defs.h"
  #include "osabi.h"
  #include "target-descriptions.h"

  struct target_desc *tdesc_fetched_from_target;
  static void
  initialize_tdesc_fetched_from_target (void)
  {
    struct target_desc *result = allocate_target_description ();
    struct tdesc_feature *feature;

    /* ... features created here ... */

    tdesc_fetched_from_target = result;
  }
  (gdb)

In order to support using 'fetched from target' I had to update the
print_c_tdesc code to handle filenames that include a space.  This has
the benefit that we can now print out real files with spaces in the
name, for example the file 'with space.xml':

  (gdb) maint print c-tdesc with space.xml

I originally added this functionality so I could inspect the
description passed to GDB by the remote target.  After using this for
a while I realised that actually having GDB recreate the XML would be
even better, so a later commit will add that functionality too.

Still, given how small this patch is I thought it might be nice to
include this in GDB anyway.

While I was working on this anyway I've added filename command
completion to this command.

gdb/ChangeLog:

* target-descriptions.c (print_c_tdesc::print_c_tdesc): Change
whitespace to underscore.
(maint_print_c_tdesc_cmd): Use fake filename for target
descriptions that came from the target.
(_initialize_target_descriptions): Add filename command completion
for 'maint print c-tdesc'.

4 years agogdb: add some more empty lines in loc.c
Simon Marchi [Tue, 23 Jun 2020 19:40:23 +0000 (15:40 -0400)]
gdb: add some more empty lines in loc.c

Add some empty lines at places I forgot in the previous patch.

gdb/ChangeLog:

* dwarf2/loc.c (decode_debug_loclists_addresses): Add empty
lines.

Change-Id: I8a9f3766ede1ce750e0703023285dca873bce0da

4 years agogdb: add empty lines in loc.c
Simon Marchi [Tue, 23 Jun 2020 19:26:36 +0000 (15:26 -0400)]
gdb: add empty lines in loc.c

I always found that some switch statements in this file were a bit too
packed.  I think having empty lines between each case helps with
reading.  I'm pushing this as obvious, I hope it won't be too
controversial.

gdb/ChangeLog:

* dwarf2/loc.c (decode_debug_loc_dwo_addresses): Add empty
lines.
(dwarf2_find_location_expression): Likewise.
(call_site_parameter_matches): Likewise.
(dwarf2_compile_expr_to_ax): Likewise.
(disassemble_dwarf_expression): Likewise.
(loclist_describe_location): Likewise.

Change-Id: I381366a0468ff1793faa612c46ef48a9d4773192

4 years agoPR 22843: ld, gold: Add --dependency-file option.
Roland McGrath [Tue, 23 Jun 2020 19:01:24 +0000 (12:01 -0700)]
PR 22843: ld, gold: Add --dependency-file option.

gold/
* options.h (class General_options): Add --dependency-file option.
* fileread.cc (File_read::files_read): New static variable.
(File_read::open): Add the file to the files_read list.
(File_read::record_file_read): New static member function.
(File_read::write_dependency_file): New static member function.
* fileread.h (class File_read): Declare them.
* layout.cc (Layout::read_layout_from_file): Call record_file_read.
(Close_task_runner::run): Call write_dependency_file if
--dependency-file was passed.

ld/
* NEWS: Note --dependency-file.
* ld.texi (Options): Document --dependency-file.
* ldlex.h (enum option_values): Add OPTION_DEPENDENCY_FILE.
* ld.h (ld_config_type): New member dependency_file.
* lexsup.c (ld_options, parse_args): Parse --dependency-file.
* ldmain.c (struct dependency_file): New type.
(dependency_files, dependency_files_tail): New static variables.
(track_dependency_files): New function.
(write_dependency_file): New function.
(main): Call it when --dependency-file was passed.
* ldfile.c (ldfile_try_open_bfd): Call track_dependency_files.
(ldfile_open_command_file_1): Likewise.
* ldelf.c (ldelf_try_needed): Likewise.
* pe-dll.c (pe_implied_import_dll): Likewise.

4 years agoFix "maint selftest" regression, add struct scoped_mock_context
Pedro Alves [Tue, 23 Jun 2020 14:18:41 +0000 (15:18 +0100)]
Fix "maint selftest" regression, add struct scoped_mock_context

This commit:

 commit 3922b302645fda04da42a5279399578ae2f6206c
 Author:     Pedro Alves <palves@redhat.com>
 AuthorDate: Thu Jun 18 21:28:37 2020 +0100

    Decouple inferior_ptid/inferior_thread(); dup ptids in thread list (PR 25412)

caused a regression for gdb.gdb/unittest.exp when GDB is configured
with --enable-targets=all.  The failure is:

  gdb/thread.c:95: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed.

The problem is in this line in regcache.c:cooked_read_test:

  /* Switch to the mock thread.  */
  scoped_restore restore_inferior_ptid
    = make_scoped_restore (&inferior_ptid, mock_ptid);

Both gdbarch-selftest.c and regcache.c set up a similar mock context,
but the series the patch above belongs to only updated the
gdbarch-selftest.c context to not write to inferior_ptid directly, and
missed updating regcache.c's.

Instead of copying the fix over to regcache.c, share the mock context
setup code in a new RAII class, based on gdbarch-selftest.c's version.

Also remove the "target already pushed" error from regcache.c, like it
had been removed from gdbarch-selftest.c in the multi-target series.
That check is unnecessary because each inferior now has its own target
stack, and the unit test pushes a target on a separate (mock)
inferior, not the current inferior on entry.

gdb/ChangeLog:
2020-06-23  Pedro Alves  <palves@redhat.com>

* gdbarch-selftests.c: Don't include inferior.h, gdbthread.h or
progspace-and-thread.h.  Include scoped-mock-context.h instead.
(register_to_value_test): Use scoped_mock_context.
* regcache.c: Include "scoped-mock-context.h".
(cooked_read_test): Don't error out if a target is already pushed.
Use scoped_mock_context.  Adjust.
* scoped-mock-context.h: New file.

4 years agoAdjust command completion output when TUI is disabled
Sandra Loosemore [Tue, 23 Jun 2020 16:33:31 +0000 (09:33 -0700)]
Adjust command completion output when TUI is disabled

The history-scrolling commands "+", "-", "<" and ">" are only known to
GDB when TUI is enabled.  This means the "complete pipe " command
produces different output depending on whether TUI is present, which
in turn caused

FAIL: gdb.base/shell.exp: cmd complete "pipe "

This patch provides different patterns for that test depending on
whether or not TUI is available.

2020-06-23  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* lib/completion-support.exp (test_gdb_completion_offers_commands):
Adjust for omitted commands when TUI is disabled.

4 years agoAdd a testcase for PR binutils/26160
H.J. Lu [Tue, 23 Jun 2020 16:19:05 +0000 (09:19 -0700)]
Add a testcase for PR binutils/26160

PR binutils/26160
* testsuite/binutils-all/pr26160.dwp.bz2: New file.
* testsuite/binutils-all/pr26160.r: Likewise.
* testsuite/binutils-all/readelf.exp: Run PR binutils/26160 test.

4 years agoPR26150, Assertion when asm() defines global symbols, -flto and --start-group
Alan Modra [Tue, 23 Jun 2020 14:20:56 +0000 (23:50 +0930)]
PR26150, Assertion when asm() defines global symbols, -flto and --start-group

If an archive map contains symbols that aren't actually defined by the
indexed element for any reason, then loading that element will leave
the symbol undefined (or common).  This leads to the possibility of
the element being loaded again should the archive be searched again
due to the action of --start-group/--end-group.  The testcase
triggering this problem was an archive containing fat lto objects,
with the archive map incorrectly created by ar rather than gcc-ar.

PR 26150
* ldlang.c (ldlang_add_file): Assert that we aren't adding the
current end of link.next list again too.
* ldmain.c (add_archive_element): Don't load archive elements
again that have already been loaded.

4 years agoFix decoding of indexed DWARF strings using pre-DWARF-5 string offset sections. ...
Nick Clifton [Tue, 23 Jun 2020 15:06:38 +0000 (16:06 +0100)]
Fix decoding of indexed DWARF strings using pre-DWARF-5 string offset sections.  Fix display of .debug_str_offsets.dwo sections.

PR 26160
* dwarf.c (fetch_indexed_string): Detect and handle old style
.debug_str_offset tables.
(display_debug_str_offsets): Likewise.  Also add support for
.debug_str_offsets.dwo sections.

4 years agoImprove -Wunused-value testcase build failures fix
Gary Benson [Tue, 23 Jun 2020 14:11:27 +0000 (15:11 +0100)]
Improve -Wunused-value testcase build failures fix

This commit improves upon my previous -Wunused-value fix by
replacing the various dummy variables with casts to void, as
suggested by Pedro.

gdb/testsuite/ChangeLog:

* gdb.cp/namespace.cc: Improve -Wunused-value fix.
* gdb.cp/nsimport.cc: Likewise.
* gdb.cp/nsnested.cc: Likewise.
* gdb.cp/nsnoimports.cc: Likewise.
* gdb.cp/nsusing.cc: Likewise.
* gdb.cp/smartp.cc: Likewise.
* gdb.python/py-pp-integral.c: Likewise.
* gdb.python/py-pp-re-notag.c: Likewise.

4 years agoAdd a testcase for PR binutils/26112
H.J. Lu [Tue, 23 Jun 2020 13:50:23 +0000 (06:50 -0700)]
Add a testcase for PR binutils/26112

PR binutils/26112
* testsuite/binutils-all/pr26112.o.bz2: New file.
* testsuite/binutils-all/pr26112.r: Likewise.
* testsuite/binutils-all/readelf.exp: Run PR binutils/26112 test.

4 years agogdb: Convert language la_is_string_type_p field to a method
Andrew Burgess [Thu, 18 Jun 2020 21:01:33 +0000 (22:01 +0100)]
gdb: Convert language la_is_string_type_p field to a method

This commit changes the language_data::la_is_string_type_p function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_is_string_type_p
initializer.
(ada_language::is_string_type_p): New member function.
* c-lang.c (c_language_data): Delete la_is_string_type_p
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_is_string_type_p): Delete function, implementation
moved to f_language::is_string_type_p.
(f_language_data): Delete la_is_string_type_p initializer.
(f_language::is_string_type_p): New member function,
implementation from f_is_string_type_p.
* go-lang.c (go_is_string_type_p): Delete function, implementation
moved to go_language::is_string_type_p.
(go_language_data): Delete la_is_string_type_p initializer.
(go_language::is_string_type_p): New member function,
implementation from go_is_string_type_p.
* language.c (language_defn::is_string_type_p): Define new member
function.
(default_is_string_type_p): Make static, add comment copied from
header file.
(unknown_language_data): Delete la_is_string_type_p initializer.
(unknown_language::is_string_type_p): New member function.
(auto_language_data): Delete la_is_string_type_p initializer.
(auto_language::is_string_type_p): New member function.
* language.h (language_data): Delete la_is_string_type_p field.
(language_defn::is_string_type_p): Declare new function.
(default_is_string_type_p): Delete desclaration, move comment to
definition.
* m2-lang.c (m2_is_string_type_p): Delete function, implementation
moved to m2_language::is_string_type_p.
(m2_language_data): Delete la_is_string_type_p initializer.
(m2_language::is_string_type_p): New member function,
implementation from m2_is_string_type_p.
* objc-lang.c (objc_language_data): Delete la_is_string_type_p
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_is_string_type_p): Delete function,
implementation moved to pascal_language::is_string_type_p.
(pascal_language_data): Delete la_is_string_type_p initializer.
(pascal_language::is_string_type_p): New member function,
implementation from pascal_is_string_type_p.
* rust-lang.c (rust_is_string_type_p): Delete function,
implementation moved to rust_language::is_string_type_p.
(rust_language_data): Delete la_is_string_type_p initializer.
(rust_language::is_string_type_p): New member function,
implementation from rust_is_string_type_p.
* valprint.c (val_print_scalar_or_string_type_p): Update call to
is_string_type_p.

4 years agogdb: Convert language la_print_typedef field to a method
Andrew Burgess [Thu, 18 Jun 2020 20:38:50 +0000 (21:38 +0100)]
gdb: Convert language la_print_typedef field to a method

This commit changes the language_data::la_print_typedef function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_print_typedef
initializer.
(ada_language::print_typedef): New member function.
* c-lang.c (c_language_data): Delete la_print_typedef initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_language_data): Likewise.
(f_language::print_typedef): New member function.
* go-lang.c (go_language_data): Delete la_print_typedef
initializer.
* language.c (language_defn::print_typedef): Define member
function.
(unknown_language_data): Delete la_print_typedef initializer.
(unknown_language::print_typedef): New member function.
(auto_language_data): Delete la_print_typedef initializer.
(auto_language::print_typedef): New member function.
* language.h (language_data): Delete la_print_typedef field.
(language_defn::print_typedef): Declare new member function.
(LA_PRINT_TYPEDEF): Update call to print_typedef.
(default_print_typedef): Delete declaration.
* m2-lang.c (m2_language_data): Delete la_print_typedef
initializer.
(m2_language::print_typedef): New member function.
* objc-lang.c (objc_language_data): Delete la_print_typedef
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
(pascal_language::print_typedef): New member function.
* rust-lang.c (rust_print_typedef): Delete function,
implementation moved to rust_language::print_typedef.
(rust_language): Delete la_print_typedef initializer.
(rust_language::print_typedef): New member function,
implementation from rust_print_typedef.
* typeprint.c (default_print_typedef): Delete.

4 years agogdb: Convert language la_printstr field to a method
Andrew Burgess [Wed, 3 Jun 2020 15:44:05 +0000 (16:44 +0100)]
gdb: Convert language la_printstr field to a method

This commit changes the language_data::la_printstr function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_printstr initializer.
(ada_language::printstr): New member function.
* c-lang.c (c_language_data): Delete la_printstr initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_printstr): Rename to f_language::printstr.
(f_language_data): Delete la_printstr initializer.
(f_language::printstr): New member function, implementation from
f_printstr.
* go-lang.c (go_language_data): Delete la_printstr initializer.
* language.c (language_defn::printstr): Define new member
function.
(unk_lang_printstr): Delete.
(unknown_language_data): Delete la_printstr initializer.
(unknown_language::printstr): New member function.
(auto_language_data): Delete la_printstr initializer.
(auto_language::printstr): New member function.
* language.h (language_data): Delete la_printstr field.
(language_defn::printstr): Declare new member function.
(LA_PRINT_STRING): Update call to printstr.
* m2-lang.c (m2_printstr): Rename to m2_language::printstr.
(m2_language_data): Delete la_printstr initializer.
(m2_language::printstr): New member function, implementation from
m2_printstr.
* objc-lang.c (objc_language_data): Delete la_printstr
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_printstr): Rename to pascal_language::printstr.
(pascal_language_data): Delete la_printstr initializer.
(pascal_language::printstr): New member function, implementation
from pascal_printstr.
* p-lang.h (pascal_printstr): Delete declaration.
* rust-lang.c (rust_printstr): Update header comment.
(rust_language_data): Delete la_printstr initializer.
(rust_language::printstr): New member function.

4 years agogdb: Convert language la_printchar field to a method
Andrew Burgess [Wed, 3 Jun 2020 14:54:19 +0000 (15:54 +0100)]
gdb: Convert language la_printchar field to a method

This commit changes the language_data::la_printchar function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_printchar initializer.
(ada_language::printchar): New member function.
* c-lang.c (c_language_data): Delete la_printchar initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_printchar): Rename to f_language::printchar.
(f_language_data): Delete la_printchar initializer.
(f_language::printchar): New member function, implementation from
f_printchar.
* go-lang.c (go_language_data): Delete la_printchar initializer.
* language.c (unk_lang_printchar): Delete.
(language_defn::printchar): Define new member function.
(unknown_language_data): Delete la_printchar initializer.
(unknown_language::printchar): New member function.
(auto_language_data): Delete la_printchar initializer.
(auto_language::printchar): New member function.
* language.h (language_data): Delete la_printchar field.
(language_defn::printchar): Declare new member function.
(LA_PRINT_CHAR): Update call to printchar.
* m2-lang.c (m2_language_data): Delete la_printchar initializer.
(m2_language::printchar): New member function.
* objc-lang.c (objc_language_data): Delete la_printchar
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Delete la_printchar
initializer.
(pascal_language::printchar): New member function.
* rust-lang.c (rust_printchar): Rename to
rust_language::printchar.
(rust_language_data): Delete la_printchar initializer.
(rust_language::printchar): New member function, implementation
from rust_printchar.

4 years agogdb: Convert language la_emitchar field to a method
Andrew Burgess [Tue, 2 Jun 2020 20:54:49 +0000 (21:54 +0100)]
gdb: Convert language la_emitchar field to a method

This commit changes the language_data::la_emitchar function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (emit_char): Renamed to ada_language::emitchar.
(ada_language_data): Delete la_emitchar initializer.
(ada_language::emitchar): New member function, implementation from
emit_char.
* c-lang.c (c_language_data): Delete la_emitchar initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_emit_char): Rename to f_language::emitchar.
(f_language_data): Delete la_emitchar initializer.
(f_language::emitchar): New member function, implementation from
f_emit_char.
* go-lang.c (go_language_data): Delete la_emitchar initializer.
* language.c (unk_lang_emit_char): Delete.
(language_defn::emitchar): New member function definition.
(unknown_language_data): Delete la_emitchar initializer.
(unknown_language::emitchar): New member function.
(auto_language_data): Delete la_emitchar initializer.
(auto_language::emitchar): New member function.
* language.h (language_data): Delete la_emitchar field.
(language_defn::emitchar): New member field declaration.
(LA_EMIT_CHAR): Update call to emitchar.
* m2-lang.c (m2_emit_char): Rename to m2_language::emitchar.
(m2_language_data): Delete la_emitchar initializer.
(m2_language::emitchar): New member function, implementation from
m2_emit_char.
* objc-lang.c (objc_language_data): Delete la_emitchar
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_emit_char): Rename to pascal_language::emitchar.
(pascal_language_data): Delete la_emitchar initializer.
(pascal_language::emitchar): New member function, implementation
from pascal_emit_char.
* rust-lang.c (rust_emitchar): Rename to rust_language::emitchar.
(rust_language_data): Delete la_emitchar initializer.
(rust_language::emitchar): New member function, implementation
from rust_emitchar.

4 years agogdb: Convert language la_post_parser field to a method
Andrew Burgess [Tue, 2 Jun 2020 13:57:40 +0000 (14:57 +0100)]
gdb: Convert language la_post_parser field to a method

This commit changes the language_data::la_post_parser function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (resolve): Rename to ada_language::post_parser.
(ada_language_data): Delete la_post_parser initializer.
(ada_language::post_parser): New member function.
* c-lang.c (c_language_data): Delete la_post_parser initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_post_parser field.
(language_defn::post_parser): New member function.
* m2-lang.c (m2_language_data): Delete la_post_parser initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* parse.c (parse_exp_in_context): Update call to post_parser.
(null_post_parser): Delete definition.
* parser-defs.h (null_post_parser): Delete declaration.
* rust-lang.c (rust_language_data): Delete la_post_parser
initializer.

4 years agogdb: Convert language la_parser field to a method
Andrew Burgess [Tue, 2 Jun 2020 13:48:04 +0000 (14:48 +0100)]
gdb: Convert language la_parser field to a method

This commit changes the language_data::la_parser function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (parse): Rename to ada_language::parser.
(ada_language_data): Delete la_parser initializer.
(ada_language::parser): New member function, implementation from
parse.
* c-lang.c (c_language_data): Delete la_parser initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
(d_language::parser): New member function.
* f-lang.c (f_language_data): Delete la_parser initializer.
(f_language::parser): New member function.
* go-lang.c (go_language_data): Delete la_parser initializer.
(go_language::parser): New member function.
* language.c (unk_lang_parser): Delete.
(language_defn::parser): Define new member function.
(unknown_language_data): Delete la_parser initializer.
(unknown_language::parser): New member function.
(auto_language_data): Delete la_parser initializer.
(auto_language::parser): New member function.
* language.h (language_data): Delete la_parser field.
(language_defn::parser): Declare new member function.
* m2-lang.c (m2_language_data): Delete la_parser initializer.
(m2_language::parser): New member function.
* objc-lang.c (objc_language_data): Delete la_parser initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
(pascal_language::parser): New member function.
* parse.c (parse_exp_in_context): Update call to parser.
* rust-lang.c (rust_language_data): Delete la_parser initializer.
(rust_language::parser): New member function.

4 years agoELF: Add _bfd_elf_add_dynamic_tags
H.J. Lu [Tue, 23 Jun 2020 12:07:31 +0000 (05:07 -0700)]
ELF: Add _bfd_elf_add_dynamic_tags

All ELF backends with shared library support need to add dynamic tags.
Add dt_pltgot_required and dt_jmprel_required to elf_link_hash_table to
indicate that DT_PLTGOT and DT_JMPREL are required dynamic tags.

1. Add _bfd_elf_add_dynamic_tags to add common dynamic tags.
2. Add _bfd_elf_maybe_vxworks_add_dynamic_tags to add common VxWorks
dynamic tags.

* elf-bfd.h (elf_link_hash_table): Add dt_pltgot_required and
dt_jmprel_required.
(_bfd_elf_add_dynamic_tags): New.
* elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.
* elf32-arc.c (elf_arc_size_dynamic_sections): Likewise.
* elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
* elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
* elf32-microblaze.c (microblaze_elf_size_dynamic_sections):
Likewise.
* elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections):
Likewise.
* elfnn-riscv.c (riscv_elf_size_dynamic_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
* elf32-arm.c (elf32_arm_size_dynamic_sections): Call
_bfd_elf_maybe_vxworks_add_dynamic_tags.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections):
Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
(_bfd_x86_elf_size_dynamic_sections): Likewise.
* elfxx-x86.h (elf_x86_link_hash_table): Remove dt_reloc,
dt_reloc_sz and dt_reloc_ent.
* elf-vxworks.c (_bfd_elf_maybe_vxworks_add_dynamic_tags): New.
* elf-vxworks.h (_bfd_elf_maybe_vxworks_add_dynamic_tags):
Likewise.
* elf32-hppa.c (elf32_hppa_link_hash_table_create): Set
etab.dt_pltgot_required.
(elf32_hppa_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.
* elf32-metag.c (elf_metag_link_hash_table_create): Set
etab.dt_pltgot_required.
(elf_metag_size_dynamic_sections): Call _bfd_elf_add_dynamic_tags.
* elf32-sh.c (sh_elf_link_hash_table_create): Set
root.dt_pltgot_required for FDPIC output.
(sh_elf_size_dynamic_sections): Call
_bfd_elf_maybe_vxworks_add_dynamic_tags.
* elf32-xtensa.c (elf_xtensa_link_hash_table_create): Set
elf.dt_pltgot_required.
(elf_xtensa_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.
* elf64-hppa.c (elf64_hppa_hash_table_create): Set
root.dt_pltgot_required.
(elf64_hppa_size_dynamic_sections): Call
_bfd_elf_add_dynamic_tags.
* elfnn-ia64.c (elfNN_ia64_hash_table_create): Set
root.dt_pltgot_required.
(elfNN_ia64_size_dynamic_sections): Set root.dt_jmprel_required
for rel_pltoff_sec.  Call _bfd_elf_add_dynamic_tags.
* elflink.c (_bfd_elf_add_dynamic_tags): New.

4 years agoAvoid testcase build failures with -Wunused-value
Gary Benson [Tue, 23 Jun 2020 11:25:34 +0000 (12:25 +0100)]
Avoid testcase build failures with -Wunused-value

A number of testcases fail to build with -Wunused-value enabled.
This commit adds dummy values to avoid this.

gdb/testsuite/ChangeLog:

* gdb.cp/namespace.cc: Avoid build failure with -Wunused-value.
* gdb.cp/nsimport.cc: Likewise.
* gdb.cp/nsnested.cc: Likewise.
* gdb.cp/nsnoimports.cc: Likewise.
* gdb.cp/nsusing.cc: Likewise.
* gdb.cp/smartp.cc: Likewise.
* gdb.python/py-pp-integral.c: Likewise.
* gdb.python/py-pp-re-notag.c: Likewise.

4 years agogdb: Add --with-python-libdir to gdb's --configuration output
Andrew Burgess [Tue, 23 Jun 2020 09:02:47 +0000 (10:02 +0100)]
gdb: Add --with-python-libdir to gdb's --configuration output

Commit:

  commit d13c7322fe1266984024644154003a19664610ea
  Date:   Fri Jan 17 00:10:22 2020 +0000

      gdb: Allow more control over where to find python libraries

Added a new configuration option --with-python-libdir, but failed to
add this option to the output of 'gdb --configuration'.  This commit
fixes this mistake.

gdb/ChangeLog:

* top.c (print_gdb_configuration): Print --with-python-libdir
configuration value.

4 years agoRISC-V: Generate ELF priv attributes if priv instruction are explicited used.
Nelson Chu [Mon, 22 Jun 2020 08:11:18 +0000 (16:11 +0800)]
RISC-V: Generate ELF priv attributes if priv instruction are explicited used.

We should generate the ELF priv attributes only if,

1. The priv attributes are already set in the assembly file.
2. The CSR are explicited used.
3. The privileged instruction are explicited used.

* There are four privileged instruction defined in the v1.11 priv spec:
`mret`, `sret`, `wfi` and `sfence.vma`.

* `sfence.vm` is dropped in the v1.10 priv spec.

* `uret` is actually a N-ext instruction.  So it is better to regard it as
an user instruction rather than the priv instruction.

* `hret` is used to return from traps in H-mode.  H-mode is removed since
the v1.10 priv spec, but probably be added in the new hypervisor spec.
Therefore, `hret` should be controlled by the hypervisor spec rather than
priv spec in the future.

* `dret` is a debug instruction.  We should record the debug spec versions
once it is explicited used in the future.

gas/
* config/tc-riscv.c (explicit_priv_attr): Rename explicit_csr to
explicit_priv_attr.  It used to indicate CSR or priv instructions are
explictly used.
(riscv_is_priv_insn): Return True if it is a privileged instruction.
(riscv_ip): Call riscv_is_priv_insn to check whether the instruction
is privileged or not.  If it is, then set explicit_priv_attr to TRUE.
(riscv_write_out_attrs): Clarification of when to generate the elf
priv spec attributes.

* testsuite/gas/riscv/attribute-11.s: Add comments.
* testsuite/gas/riscv/attribute-14.s: New testcase.  Use symbol
`priv_insn_<n>` to decide which priv instruction is expected to used.
(<n> is a to g.)
* testsuite/gas/riscv/attribute-14a.d: Likewise.
* testsuite/gas/riscv/attribute-14b.d: Likewise.
* testsuite/gas/riscv/attribute-14c.d: Likewise.
* testsuite/gas/riscv/attribute-14d.d: Likewise.
* testsuite/gas/riscv/attribute-14e.d: Likewise.

4 years agoCorrect bfin XPASSes
Alan Modra [Mon, 22 Jun 2020 02:20:46 +0000 (11:50 +0930)]
Correct bfin XPASSes

bfin-elf and bfin-linux differ.  This patch fixes these:
bfin-linux-uclibc  -XPASS: PR ld/14170
bfin-linux-uclibc  -XPASS: pr17068 link --as-needed lib in group
bfin-linux-uclibc  -XPASS: -Bsymbolic-functions
bfin-linux-uclibc  -XPASS: pr22374 function pointer initialization

* testsuite/ld-elf/shared.exp (pr14170): Clear xfail for
bfin-*-linux*.
(pr17068, symbolic-func.so, pr22374): Likewise.

4 years agobinutils objdump.exp remote_file typo
Alan Modra [Mon, 22 Jun 2020 02:13:30 +0000 (11:43 +0930)]
binutils objdump.exp remote_file typo

* testsuite/binutils-all/objdump.exp (bintest.a): Correct
remote_file delete command.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 23 Jun 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoNEWS and documentation for alias default-args related concept and commands.
Philippe Waroquiers [Mon, 24 Jun 2019 22:50:29 +0000 (00:50 +0200)]
NEWS and documentation for alias default-args related concept and commands.

gdb/ChangeLog
2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* NEWS: Mention change to the alias command.

gdb/doc/ChangeLog
2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.texinfo (Command aliases default args): New node documenting
how to use default args for a command using aliases.
(Aliases): Document the new 'DEFAULT-ARGS...' option.
(Help): Update help aliases text and describe when full alias
definition is provided.

4 years agoAdd tests for new alias default-args related commands and arguments.
Philippe Waroquiers [Sun, 23 Jun 2019 21:13:57 +0000 (23:13 +0200)]
Add tests for new alias default-args related commands and arguments.

Test the new default-args behaviour and completion for the alias command.
Note that gdb.base/default-args.exp is somewhat copied from
with.exp (the test of the with command), while default-exp.c
is a plain copy of with.c.

gdb/testsuite/ChangeLog
2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/default-args.exp: New test.
* gdb.base/default-args.c: New file.
* gdb.base/alias.exp: Update expected error msg for alias foo=bar.
* gdb.base/default.exp: Update to new help text.
* gdb.base/help.exp: Likewise.
* gdb.base/page.exp: Likewise.
* gdb.base/style.exp: Likewise.
* gdb.guile/guile.exp: Likewise.
* gdb.python/python.exp: Likewise.

4 years agodefault-args: allow to define default arguments for aliases
Philippe Waroquiers [Wed, 19 Jun 2019 10:49:55 +0000 (12:49 +0200)]
default-args: allow to define default arguments for aliases

Currently, a user can define an alias, but cannot have default
arguments for this alias.

This patch modifies the 'alias' command so that default args can
be provided.
    (gdb) h alias
    Define a new command that is an alias of an existing command.
    Usage: alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]
    ALIAS is the name of the alias command to create.
    COMMAND is the command being aliased to.

    Options:
      -a
        Specify that ALIAS is an abbreviation of COMMAND.
        Abbreviations are not used in command completion..

    GDB will automatically prepend the provided DEFAULT-ARGS to the list
    of arguments explicitly provided when using ALIAS.
    Use "help aliases" to list all user defined aliases and their default args.

    Examples:
    Make "spe" an alias of "set print elements":
      alias spe set print elements
    Make "elms" an alias of "elements" in the "set print" command:
      alias -a set print elms set print elements
    Make "btf" an alias of "backtrace -full -past-entry -past-main" :
      alias btf = backtrace -full -past-entry -past-main
    Make "wLapPeu" an alias of 2 nested "with":
      alias wLapPeu = with language pascal -- with print elements unlimited --
    (gdb)

The way 'default-args' is implemented makes it trivial to set default
args also for GDB commands (such as "backtrace") and for GDB pre-defined
aliases (such as "bt").  It was however deemed better to not allow to
define default arguments for pre-defined commands and aliases, to avoid
users believing that e.g. default args for "backtrace" would apply to "bt".

If needed, default-args could be allowed for GDB predefined commands
and aliases by adding a command
'set default-args GDB_COMMAND_OR_PREDEFINED_ALIAS [DEFAULT-ARGS...]'.

* 'alias' command now has a completer that helps to complete:
     - ALIAS (if the user defines an alias after a prefix),
     - the aliased COMMAND
     - the possible options for the aliased COMMAND.

* Help and apropos commands show the definitions of the aliases
  that have default arguments, e.g.
        (gdb) help backtrace
        backtrace, btf, where, bt
          alias btf = backtrace -full -past-entry -past-main
        Print backtrace of all stack frames, or innermost COUNT frames.
        Usage: backtrace [OPTION]... [QUALIFIER]... [COUNT | -COUNT]

        Options:
          -entry-values no|only|preferred|if-needed|both|compact|default
            Set printing of function arguments at function entry.
        ...

gdb/ChangeLog
2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* cli/cli-cmds.c (lookup_cmd_for_default_args)
(alias_command_completer)
(make_alias_options_def_group): New functions.
(alias_opts, alias_option_defs): New struct and array.
(alias_usage_error): Update usage.
(alias_command): Handles optional DEFAULT-ARGS... arguments.
Use option framework.
(_initialize_cli_cmds): Update alias command help.
Update aliases command help.
(show_user):
Add NULL for new default_args lookup_cmd argument.
(valid_command_p): Rename to validate_aliased_command.
Add NULL for new default_args lookup_cmd argument.  Verify that the
aliased_command has no default args.
* cli/cli-decode.c (help_cmd): Show aliases definitions.
(lookup_cmd_1, lookup_cmd): New argument default_args.
(add_alias_cmd):
Add NULL for new default_args lookup_cmd argument.
(print_help_for_command): Show default args under the layout
 alias some_alias = some_aliased_cmd some_alias_default_arg.
* cli/cli-decode.h (struct cmd_list_element): New member default_args.
xfree default_args in destructor.
* cli/cli-script.c (process_next_line, do_define_command):
Add NULL for new default_args lookup_cmd argument.
* command.h: Declare new default_args argument in lookup_cmd
and lookup_cmd_1.
* completer.c (complete_line_internal_1):
Add NULL for new default_args lookup_cmd or lookup_cmd_1 argument.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
* guile/scm-param.c (add_setshow_generic, pascm_parameter_defined_p):
Likewise.
* infcmd.c (_initialize_infcmd): Likewise.
* python/py-auto-load.c (gdbpy_initialize_auto_load): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
* python/py-param.c (add_setshow_generic): Likewise.
* remote.c (_initialize_remote): Likewise.
* top.c (execute_command): Prepend default_args if command has some.
(set_verbose):
Add NULL for new default_args lookup_cmd or lookup_cmd_1 argument.
* tracepoint.c (validate_actionline, encode_actions_1):
Add NULL for new default_args lookup_cmd or lookup_cmd_1 argument.

4 years agoDisable parts of gdb.base/source-dir.exp on remote host
Sandra Loosemore [Mon, 22 Jun 2020 17:10:02 +0000 (10:10 -0700)]
Disable parts of gdb.base/source-dir.exp on remote host

One set of tests in this file does a lot of complicated directory
manipulations to force a specific DW_AT_comp_dir format and gdb
directory search path.  As it's written, everything assumes host ==
build, and it does not seem to me that there is any obvious way to
rewrite this so it will work in general on remote host.  For instance,
our harness for testing on remote Windows host normally does all
compilation and GDB execution in $cwd using relative pathnames and I'm
not sure all these directory tricks would set up the scenario it's
trying to test even if they were correctly performed on host rather
than build.  So I think it's reasonable just to disable this on remote
host instead.

I also noted that it's using the wrong search path syntax for Windows
host in the "set directories" command and conditionalized that while I
was looking at it.  That's a necessary fix to make this work in a
situation where host == build and it's Windows, but I'm not actually
set up to test that it's sufficient, too.

2020-06-22  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/source-dir.exp (test_truncated_comp_dir): Skip on
remote host.  Fix search path syntax on Windows host.

4 years agoAdd support for decoding the DW_MACRO_define_strx and DW_MACRO_undef_strx operands...
Nick Clifton [Mon, 22 Jun 2020 16:44:56 +0000 (17:44 +0100)]
Add support for decoding the DW_MACRO_define_strx and DW_MACRO_undef_strx operands found in DWARF-5 .debug_macro sections.

PR 26112
* dwarf.c (display_debug_str_offsets): Add code to display the
contents of the .debug_str_offsets section.
(display_debug_macro): Add support for DW_MACRO_define_strx and
DW_MACRO_undef_strx.

4 years agoaarch64: Normalize and sort feature bit macros
Alex Coplan [Mon, 22 Jun 2020 13:51:04 +0000 (14:51 +0100)]
aarch64: Normalize and sort feature bit macros

This patch normalizes and sorts the feature bit macros in
include/opcode/aarch64.h such that it's easy to tell which bits are
allocated and where it's safe to add new feature bits.

Testing:
 * Testsuite run on aarch64-none-elf.

include/ChangeLog:

2020-06-22  Alex Coplan  <alex.coplan@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_SHA2): Normalize.
(AARCH64_FEATURE_AES): Likewise.
(AARCH64_FEATURE_V8_4): Likewise.
(AARCH64_FEATURE_SM4): Likewise.
(AARCH64_FEATURE_SHA3): Likewise.
(AARCH64_FEATURE_V8): Likewise.
(AARCH64_FEATURE_V8_2): Likewise.
(AARCH64_FEATURE_V8_3): Likewise.
(AARCH64_FEATURE_FP): Likewise.
(AARCH64_FEATURE_SIMD): Likewise.
(AARCH64_FEATURE_CRC): Likewise.
(AARCH64_FEATURE_LSE): Likewise.
(AARCH64_FEATURE_PAN): Likewise.
(AARCH64_FEATURE_LOR): Likewise.
(AARCH64_FEATURE_RDMA): Likewise.
(AARCH64_FEATURE_V8_1): Likewise.
(AARCH64_FEATURE_F16): Likewise.
(AARCH64_FEATURE_RAS): Likewise.
(AARCH64_FEATURE_PROFILE): Likewise.
(AARCH64_FEATURE_SVE): Likewise.
(AARCH64_FEATURE_RCPC): Likewise.
(AARCH64_FEATURE_COMPNUM): Likewise.
(AARCH64_FEATURE_DOTPROD): Likewise.
(AARCH64_FEATURE_F16_FML): Likewise.
(AARCH64_FEATURE_V8_5): Likewise.
(AARCH64_FEATURE_V8_6): Likewise.
(AARCH64_FEATURE_BFLOAT16): Likewise.
(AARCH64_FEATURE_FLAGMANIP): Likewise.
(AARCH64_FEATURE_FRINTTS): Likewise.
(AARCH64_FEATURE_SB): Likewise.
(AARCH64_FEATURE_PREDRES): Likewise.
(AARCH64_FEATURE_CVADP): Likewise.
(AARCH64_FEATURE_RNG): Likewise.
(AARCH64_FEATURE_BTI): Likewise.
(AARCH64_FEATURE_SCXTNUM): Likewise.
(AARCH64_FEATURE_ID_PFR2): Likewise.
(AARCH64_FEATURE_SSBS): Likewise.
(AARCH64_FEATURE_MEMTAG): Likewise.
(AARCH64_FEATURE_TME): Likewise.
(AARCH64_FEATURE_I8MM): Likewise.
(AARCH64_FEATURE_F32MM): Likewise.
(AARCH64_FEATURE_F64MM): Likewise.
(AARCH64_FEATURE_SVE2): Likewise.
(AARCH64_FEATURE_SVE2_AES): Likewise.
(AARCH64_FEATURE_SVE2_BITPERM): Likewise.
(AARCH64_FEATURE_SVE2_SM4): Likewise.
(AARCH64_FEATURE_SVE2_SHA3): Likewise.

4 years agoRecognize some new Mach-O load commands
Saagar Jha [Mon, 22 Jun 2020 13:29:20 +0000 (14:29 +0100)]
Recognize some new Mach-O load commands

bfd
* mach-o.c: Support the new load commands by reading a linkedit data
command for them.
binutils
* od-macho.c: Dump linkedit data for new load commands.
include
* mach-o/loader.h: Add declarations of two new Mach-O load
commands.

4 years agogdbserver/linux-low: use std::list to store pending signals
Tankut Baris Aktemur [Mon, 22 Jun 2020 12:13:48 +0000 (14:13 +0200)]
gdbserver/linux-low: use std::list to store pending signals

Use std::list to store pending signals instead of a manually-managed
linked list.  This is a refactoring.

In the existing code, pending signals are kept in a manually-created
linked list with "prev" pointers.  A new pending signal is thus
inserted to the beginning of the list.  When consuming, GDB goes until
the end of the list, following the "prev" pointers, and processes the
final item.  With this patch, a new item is added to the end of the
list and the item at the front of the list is consumed.  In other
words, the list elements used to be stored in reverse order; with this
patch, they are stored in their order of arrival.  This causes a change
in the debug messages that print the pending signals.  Otherwise, no
behavioral change is expected.

gdbserver/ChangeLog:
2020-06-22  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Use std::list to stop pending signal instead of manually-created
linked list.
* linux-low.h: Include <list>.
(struct pending_signal): Move here from linux-low.cc.
(struct lwp_info) <pending_signals>
<pending_signals_to_report>: Update the type.
* linux-low.cc (struct pending_signals): Remove.
(linux_process_target::delete_lwp)
(linux_process_target::add_lwp)
(enqueue_one_deferred_signal)
(dequeue_one_deferred_signal)
(enqueue_pending_signal)
(linux_process_target::resume_one_lwp_throw)
(linux_process_target::thread_needs_step_over)
(linux_process_target::resume_one_thread)
(linux_process_target::proceed_one_lwp): Update the use of pending
signal list.

4 years agogdb/jit: return bool in jit_breakpoint_re_set_internal and jit_read_descriptor
Tankut Baris Aktemur [Mon, 22 Jun 2020 12:03:33 +0000 (14:03 +0200)]
gdb/jit: return bool in jit_breakpoint_re_set_internal and jit_read_descriptor

This is a minor refactoring that converts the return type of
jit_read_descriptor and jit_breakpoint_re_set_internal functions
from 'int' to 'bool'.

The return value logic of jit_breakpoint_re_set_internal has been
reversed.  With this patch it now returns true if the jit breakpoint
has been successfully initialized.

gdb/ChangeLog:
2020-06-22  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* jit.c (jit_read_descriptor): Use bool as the return type.
(jit_breakpoint_re_set_internal): Use bool as the return type.
Invert the return value logic; return true if the jit breakpoint
has been successfully initialized.
(jit_inferior_init): Update the call to
jit_breakpoint_re_set_internal.

4 years agoSolaris, target_wait(), don't rely on inferior_ptid
Pedro Alves [Mon, 22 Jun 2020 09:54:08 +0000 (10:54 +0100)]
Solaris, target_wait(), don't rely on inferior_ptid

Debugging on Solaris is broken, with the procfs target backend failing
with:

 procfs: couldn't find pid 0 in procinfo list.

as soon as you start a program.

The problem is procfs_target::wait assuming that inferior_ptid is
meaningful on entry, but, since the multi-target series, inferior_ptid
is null_ptid before we call target_wait, in infrun.c:

  static ptid_t
  do_target_wait_1 (inferior *inf, ptid_t ptid,
    target_waitstatus *status, int options)
  {
...
    /* We know that we are looking for an event in the target of inferior
       INF, but we don't know which thread the event might come from.  As
       such we want to make sure that INFERIOR_PTID is reset so that none of
       the wait code relies on it - doing so is always a mistake.  */
    switch_to_inferior_no_thread (inf);

This patch tweaks the backend to remove the assumption that
inferior_ptid points at something.  sol-thread.c (the thread_stratum
that sits on top of procfs.c) also has the same issue.

Some spots in procfs_target::wait were returning
TARGET_WAITKIND_SPURIOUS+inferior_ptid.  This commit replaces those
with waiting again without returning to the core.  This fixes the
relying on inferior_ptid, and also should fix the issue discussed
here:
  https://sourceware.org/pipermail/gdb/2020-May/048616.html
  https://sourceware.org/pipermail/gdb/2020-June/048660.html

gdb/ChangeLog:
2020-06-22  Pedro Alves  <palves@redhat.com>

PR gdb/25939
* procfs.c (procfs_target::wait): Don't reference inferior_ptid.
Use the current inferior instead.  Don't return
TARGET_WAITKIND_SPURIOUS/inferior_ptid -- instead continue and
wait again.
* sol-thread.c (sol_thread_target::wait): Don't reference
inferior_ptid.
(ps_lgetregs, ps_lsetregs, ps_lgetfpregs, ps_lsetfpregs)
(sol_update_thread_list_callback): Use the current inferior's pid
instead of inferior_ptid.

4 years agoRISC-V: Report warning when linking the objects with different priv specs.
Nelson Chu [Fri, 12 Jun 2020 15:06:49 +0000 (23:06 +0800)]
RISC-V: Report warning when linking the objects with different priv specs.

We do know some conflicts among different privileged specs.  For linker,
the safest approach is that don't allow the object linked with others which
may cause conflicts.  But this may cause inconvenience since not all objects
with conflicting priv specs are linked will cause problems.  But it is hard
to know the detailed conflict cases for linker, so we probably need a option
to tell linker that we do know there are no conflicts, or we are willing to
take risks to link the objects with conflicted priv specs.  But the option
is still under discussion.

Therefore, we can report warnings rather than errors when linking the objects
with conflicted priv specs.  This not only makes the linker more flexible,
but also warns people that the conflicts may happen.  We also need to update
the output priv spec version once the input priv spec is newer.

bfd/
* elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from
opcodes/riscv-opc.c to bfd/elfxx-riscv.c, since we need it in linker.
(riscv_get_priv_spec_class): Likewise.
(riscv_get_priv_spec_name): Likewise.
(riscv_get_priv_spec_class_from_numbers): New function, convert
the version numbers into string, then call riscv_get_priv_spec_class
to get the priv spec class.
* elfxx-riscv.h (riscv_get_priv_spec_class): Move forward declaration
from include/opcode/riscv.h to bfd/elfxx-riscv.h.
(riscv_get_priv_spec_name): Likewise.
(riscv_get_priv_spec_class_from_numbers): New forward declaration.
(opcode/riscv.h): Include it in the header rather than elfxx-riscv.c.
* elfnn-riscv.c (riscv_merge_attributes):  Get the priv spec classes
of input and output objects form their priv spec attributes by
riscv_get_priv_spec_class_from_numbers.  Report warning rather than
errors when linking objects with differnet priv spec versions.  We do
know v1.9.1 may have conflicts to other versions, so report the
warning, too.  After that, update the output priv spec version to the
newest one so far.

gas/
* config/tc-riscv.c (buf_size, buf): Remove the unused variables.
(riscv_set_default_priv_spec): Get the priv spec version from the
priv spec attributes by riscv_get_priv_spec_class_from_numbers.

include/
* opcode/riscv.h (riscv_get_priv_spec_class): Move the function
forward declarations to bfd/elfxx-riscv.h.
(riscv_get_priv_spec_name): Likewise.

opcodes/
* riscv-opc.c: Move the structures and functions to bfd/elfxx-riscv.c.
* riscv-dis.c: Include elfxx-riscv.h.

ld/
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Updated.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Updated.

4 years agoRISC-V: Don't assume the priv attributes are in order when handling them.
Nelson Chu [Tue, 9 Jun 2020 07:33:08 +0000 (15:33 +0800)]
RISC-V: Don't assume the priv attributes are in order when handling them.

There is no guarantee that the priv attributes should be defined in order.
Therefore, we shouldn't have the order assumption when handling them in the
riscv_merge_attributes.  Set priv_attrs_merged to TRUE if we have handled
all of the priv attributes.

bfd/
* elfnn-riscv.c (riscv_merge_attributes): Once we meet one of the
priv attributes, we will check the conflicts for all of them (major,
minor and revision), and then set the priv_attrs_merged to TRUE to
indicate that we have handled all of the priv attributes.  Remove
the unused boolean priv_may_conflict, in_priv_zero and out_priv_zero.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 22 Jun 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoVarious procfs.c cleanups
Rainer Orth [Sun, 21 Jun 2020 16:51:58 +0000 (18:51 +0200)]
Various procfs.c cleanups

While reading through procfs.c, I noticed a couple of cleanup
opportunities:

* Some comments and code allowed for portability across different
  targets.  Since procfs.c is Solaris-only for some time now, those can
  go.

* Likewise, there were some references to the old ioctl-based /proc left.

* The code still allowed for SYS_exec.  However, it is no longer present
  in either Solaris 11.3, 11.4, or Illumos.  Checking the OpenSolaris
  sources, I found that it had already been removed in 2010 well before
  the Solaris 11 release.

* Some blocks of #if 0 code can go:

** References to struct procinfo.{g,fp}regs_dirty which are no longer
   defined.

** Code handling the PR_ASLWP flag where <sys/procfs.h> has

#define PR_ASLWP   0x00000040 /* obsolete flag; never set */

Tested on amd64-pc-solaris2.11.

* procfs.c: Cleanup many comments.

(READ_WATCHFLAG, WRITE_WATCHFLAG, EXEC_WATCHFLAG)
(AFTER_WATCHFLAG): Replace by value.

(MAIN_PROC_NAME_FORMAT): Inline ...
(create_procinfo): ... here.

(procfs_debug_inferior): Remove SYS_exec handling.
(syscall_is_exec): Likewise.
(procfs_set_exec_trap): Likewise.

(syscall_is_lwp_exit): Inline in callers.
(syscall_is_exit): Likewise.
(syscall_is_exec): Likewise.
(syscall_is_lwp_create): Likewise.

(invalidate_cache): Remove #if 0 code.

(make_signal_thread_runnable):  Remove.
(procfs_target::resume): Remove #if 0 code.

4 years ago[PR gdb/25939] Move push_target call earlier in procfs.c
Rainer Orth [Sun, 21 Jun 2020 16:32:27 +0000 (18:32 +0200)]
[PR gdb/25939] Move push_target call earlier in procfs.c

Since the multi-target patch, the run command fails on Solaris with an
assertion failure even for a trivial program:

$ ./gdb -D ./data-directory ./hello
GNU gdb (GDB) 10.0.50.20200106-git
[...]
Reading symbols from ./hello...
(gdb) run
Starting program: /vol/obj/gnu/gdb/gdb/reghunt/no-resync/122448/gdb/hello
/vol/src/gnu/gdb/hg/master/reghunt/gdb/thread.c:336: internal-error:
thread_info::thread_info(inferior*, ptid_t): Assertion `inf_ != NULL'
failed.

Here's the start of the corresponding stack trace:

#0  internal_error (
    file=file@entry=0x966150
"/vol/src/gnu/gdb/hg/master/reghunt/gdb/thread.c", line=line@entry=336,
fmt=0x9ddb94 "%s: Assertion `%s' failed.")
    at /vol/src/gnu/gdb/hg/master/reghunt/gdb/gdbsupport/errors.c:51
#1  0x0000000000ef81f4 in thread_info::thread_info (this=0x1212020,
    inf_=<optimized out>, ptid_=...)
    at /vol/src/gnu/gdb/hg/master/reghunt/gdb/thread.c:344
#2  0x0000000000ef82cd in new_thread (inf=inf@entry=0x0, ptid=...)
    at /vol/src/gnu/gdb/hg/master/reghunt/gdb/thread.c:239
#3  0x0000000000efac3c in add_thread_silent (
    targ=targ@entry=0x11b0940 <the_procfs_target>, ptid=...)
    at /vol/src/gnu/gdb/hg/master/reghunt/gdb/thread.c:304
#4  0x0000000000d90692 in procfs_target::create_inferior (
    this=0x11b0940 <the_procfs_target>,
    exec_file=0x13dbef0
"/vol/obj/gnu/gdb/gdb/reghunt/no-resync/122448/gdb/hello", allargs="",
env=0x13c48f0, from_tty=<optimized out>)
    at /vol/src/gnu/gdb/hg/master/reghunt/gdb/gdbsupport/ptid.h:47
#5  0x0000000000c84e64 in run_command_1 (args=<optimized out>, from_tty=1,
    run_how=run_how@entry=RUN_NORMAL)
    at /vol/gcc-9/include/c++/9.1.0/bits/basic_string.h:263
#6  0x0000000000c85007 in run_command (args=<optimized out>,
    from_tty=<optimized out>)
    at /vol/src/gnu/gdb/hg/master/reghunt/gdb/infcmd.c:687

Looking closer, I found that in add_thread_silent as called from
procfs.c (procfs_target::create_inferior) find_inferior_ptid returns
NULL.  The all_inferiors (targ) iterator comes up empty.

Going from there, I see that in add_thread_silent

m_target_stack = {m_top = file_stratum, m_stack = {0x20190e0
<the_dummy_target>, 0x200b8c0 <exec_ops>, 0x0, 0x0, 0x0, 0x0, 0x0}}}

i.e. the_procfs_target is missing compared to the_amd64_linux_nat_target
on Linux/x86_64.

Moving the push_target call earlier allows debugging to get over the
initial assertion failure.  I run instead into

procfs: couldn't find pid 0 in procinfo list.

which is fixed by

https://sourceware.org/pipermail/gdb-patches/2020-June/169674.html

Both patches tested together on amd64-pc-solaris2.11.

PR gdb/25939
* procfs.c (procfs_target::procfs_init_inferior): Move push_target
call ...
(procfs_target::create_inferior): ... here.

4 years agoPR26132, ar creates invalid libraries for some targets with plugins enabled
Alan Modra [Sun, 21 Jun 2020 11:24:24 +0000 (20:54 +0930)]
PR26132, ar creates invalid libraries for some targets with plugins enabled

PR 26132
* configure.ac: Disable plugins by default for some targets.
* plugin.c: Comment typo fix.
* configure: Regenerate.

4 years agoDo without ld ENABLE_PLUGINS
Alan Modra [Sun, 21 Jun 2020 04:53:46 +0000 (14:23 +0930)]
Do without ld ENABLE_PLUGINS

Instead, use BFD_SUPPORTS_PLUGINS.

* ldfile.c: Replace uses of ENABLE_PLUGINS with BFD_SUPPORTS_PLUGINS.
* ldlang.c: Likewise.
* ldlang.h: Likewise.
* ldlex.h: Likewise.
* ldmain.c: Likewise.
* lexsup.c: Likewise.
* plugin.c: Wrap body of file in #if BFD_SUPPORTS_PLUGINS.
* testplug.c: Likewise.
* testplug2.c: Likewise.
* testplug3.c: Likewise.
* testplug4.c: Likewise.
* configure.ac (ENABLE_PLUGINS): Don't define AM_CONTITIONAL.
* Makefile.am: Remove ENABLE_PLUGINS conditionals.
(PLUGIN_CFLAGS): Don't define.
(PLUGIN_C, PLUGIN_H, PLUGIN_OBJECT): Likewise.  Substitute all
uses with plugin file name.
* configure: Regenerate.
* Makefile.in: Regenerate.

4 years agoEnsure 'exec-file has changed' check has priority over 'exec-file-mismatch' check
Philippe Waroquiers [Sat, 23 May 2020 12:54:31 +0000 (14:54 +0200)]
Ensure 'exec-file has changed' check has priority over 'exec-file-mismatch' check

Following the implementation of exec-file-mismatch based on build-id,
an attach to a process that runs a modified exec-file was triggering
the exec-file-mismatch handling, giving a warning such as:
  warning: Mismatch between current exec-file /bd/home/philippe/gdb/git/build_termours/gdb/testsuite/outputs/gdb.base/attach/attach
  and automatically determined exec-file /bd/home/philippe/gdb/git/build_termours/gdb/testsuite/outputs/gdb.base/attach/attach
  exec-file-mismatch handling is currently "ask"
as the build-ids differ when an exec-file is recompiled.

This patch ensures that the exec-file-mismatch check is done with an up to date
build-id.  With this, exec-file-mismatch check will only trigger when the
PID file really differs from the (build-id refreshed) current exec-file.
Note that the additional check does not (yet) reload the symbols if
the exec-file is changed: this reload will happen later if needed.

gdb/ChangeLog
2020-06-21  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* exec.c (validate_exec_file): Ensure the build-id is up to
date by calling reopen_exec_file (that checks file timestamp
to decide to re-read the file).

gdb/testsuite/ChangeLog

2020-06-21  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/attach.exp: Test priority of 'exec-file' changed
over 'exec-file-mismatch'.
* gdb.base/attach.c: Mark should_exit volatile.
* gdb.base/attach2.c: Likewise.  Add a comment explaining
why the sleep cannot be big.
* gdb.base/attach3.c: New file.

4 years agoAdjust gdb.mi/mi-sym-info.exp filename patterns.
Sandra Loosemore [Sun, 21 Jun 2020 02:37:49 +0000 (19:37 -0700)]
Adjust gdb.mi/mi-sym-info.exp filename patterns.

2020-06-20  Sandra Loosemore  <sandra@codesourcery.com>

* gdb.mi/mi-sym-info.exp: Adjust filename patterns to make directory
prefix optional.

4 years agoFix gdb.base/list-missing-source.exp on remote host.
Sandra Loosemore [Sun, 21 Jun 2020 00:23:53 +0000 (17:23 -0700)]
Fix gdb.base/list-missing-source.exp on remote host.

2020-06-20  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/list-missing-source.exp: Correct $srcfile manipulation
for remote host.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 21 Jun 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoRemove perror from ld_assemble, ld_compile and ld_nm
Alan Modra [Sat, 20 Jun 2020 06:23:37 +0000 (15:53 +0930)]
Remove perror from ld_assemble, ld_compile and ld_nm

ERROR should really be reserved for errors in the testsuite framework,
not just normal errors from the tools under test.  Removing use of
perror has been suggested before but without action, over concerns
that some test failures might be missed.  This patch removes uses of
perror in ld_assemble, ld_compile and ld_nm, and updates numerous
places that ignored the result of these functions by inappropriately
returning an "unresolved" test status.  Net result over my large set
of targets look good, in some cases improving the diagnostics, eg:

i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  -ERROR: tmpdir/script: nm failed
i386-msdos  +FAIL: script
i386-msdos  +FAIL: MRI script
i386-msdos  +FAIL: MEMORY
i386-msdos  +FAIL: MEMORY with symbols

* testsuite/lib/ld-lib.exp (default_ld_compile): Don't perror on
a compiler error.
(default_ld_assemble): Similarly for an assembler error.
(default_ld_nm): Similarly for an nm error.
(run_ld_link_tests): Report ld_assemble errors as a fail.
(check_as_cfi): Remove now unnecessary perror substitution.
* testsuite/ld-elf/exclude.exp: Report ld_nm error return as test
fails rather then unresolved.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-scripts/alignof.exp: Likewise.
* testsuite/ld-scripts/defined.exp: Likewise.
* testsuite/ld-scripts/script.exp: Likewise.
* testsuite/ld-scripts/sizeof.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-scripts/extern.exp: Likewise.  Return on ld_link
failure.
* testsuite/ld-elfweak/elfweak.exp: Report compiler errors as
test unresolved.
* testsuite/ld-fastcall/fastcall.exp: Report assember errors as
test fails.
* testsuite/ld-i386/i386.exp (iamcu_tests): Likewise.
* testsuite/ld-ia64/line.exp: Likewise.
* testsuite/ld-mep/mep.exp: Likewise.
* testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
* testsuite/ld-nios2/nios2.exp: Likewise.
* testsuite/ld-scripts/alignof.exp: Likewise.
* testsuite/ld-x86-64/line.exp: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-scripts/log2.exp: Formatting.
* testsuite/ld-tic6x/tic6x.exp: Report ld_link errors as a test fail.

4 years agoecoff testsuite fixes
Alan Modra [Sat, 20 Jun 2020 01:17:32 +0000 (10:47 +0930)]
ecoff testsuite fixes

The aim of this change is to remove a whole lot of "assembly failed"
errors for ecoff targets.

* testsuite/ld-alpha/alpha.exp: Exclude *ecoff targets.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/tls.exp: Likewise.
* testsuite/ld-elf/tls_common.exp: Likewise.
* testsuite/ld-scripts/phdrs2.exp: Likewise.

4 years agoSH gas configure and ld tests
Alan Modra [Sat, 20 Jun 2020 01:11:40 +0000 (10:41 +0930)]
SH gas configure and ld tests

All current SH gas targets use BFD.  sh-coff was incorrectly reported
as unsupported.

gas/
* configure.tgt: Set bfd_gas for all SH targets.
ld/
* testsuite/ld-sh/sh.exp: Don't run relax tests for non-ELF.
Fail when ld_assemble fails.  Use elseif to reduce indentation.

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 20 Jun 2020 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoFixes for gdb.xml/tdesc-regs.exp.
Sandra Loosemore [Fri, 19 Jun 2020 16:15:38 +0000 (09:15 -0700)]
Fixes for gdb.xml/tdesc-regs.exp.

2020-06-19  Sandra Loosemore  <sandra@codesourcery.com>
    Hafiz Abid Qadeer  <abidh@codesourcery.com>

* gdb.xml/tdesc-regs.exp (load_description): Correct pathname of
file sent to remote host.
(top level): Allow int32_t as type of 32-bit register.

4 years ago[gdb/testsuite] Limit default_target_compile override
Tom de Vries [Fri, 19 Jun 2020 15:55:52 +0000 (17:55 +0200)]
[gdb/testsuite] Limit default_target_compile override

The file lib/future.exp contains an override of dejagnu's
default_target_compile.

The override is activated if dejagnu's default_target_compile is missing
support for one or more languages.

However, if the override is activated, it's active for all languages.

This unnecessarily extends the scope of potential problems in the override to
languages that don't need the override.

Fix this by limiting the scope of the override.

Also add a note stating for which languages the override is active, as a
reminder that support for those languages needs to be ported to dejagnu.  With
my system dejagnu 1.6.1, as well as with current dejagnu trunk, that gives us:
...
NOTE: Dejagnu's default_target_compile is missing support for Go, using \
  local override
NOTE: Dejagnu's default_target_compile is missing support for Rust, using \
  local override
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-19  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_note): New proc.
* lib/future.exp (gdb_default_target_compile_1): Factor out of ...
(gdb_default_target_compile): ... here.  Only call
gdb_default_target_compile_1 if use_gdb_compile(<lang>) is set.
(use_gdb_compile): Change to array.
(toplevel): Update sets of use_gdb_compile to specify language.
Warn about default_target_compile override.  Store dejagnu's version
of default_target_compile in dejagnu_default_target_compile.

4 years agoSilence warnings about incompatible plugins.
Nick Clifton [Fri, 19 Jun 2020 09:25:43 +0000 (10:25 +0100)]
Silence warnings about incompatible plugins.

I have been looking at a Fedora bug report[1] from a user who was
receiving warning messages from the BFD library about incompatible
plugins.  It turns out that they had both 32-bit and 64-bit versions
of the same plugin installed, and the BFD library was attempting to
load all of them.

After thinking about it for a while, it seemed to me that the simplest
solution was to not warn about incompatible plugins whilst attempting
to create a list of viable plugins.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1836618

* plugin.c (try_load_plugin): Suppress the error message about
being unable to open a plugin if creating a list of viable
plugins.

4 years agoRe: ld testsuite fixes for alpha
Alan Modra [Fri, 19 Jun 2020 03:26:12 +0000 (12:56 +0930)]
Re: ld testsuite fixes for alpha

I missed some.

* testsuite/ld-plugin/pr22983.1.d: Accept st_other notations.
* testsuite/ld-plugin/pr22983.2.d: Likewise.
* testsuite/ld-plugin/pr22983.4.d: Likewise.

4 years agold testsuite fixes for alpha
Alan Modra [Fri, 19 Jun 2020 00:30:30 +0000 (10:00 +0930)]
ld testsuite fixes for alpha

Some tests failed just due to st_other info, eg. [NOPV], being
emitted by readelf or objdump.  Fix that.  Also since alpha doesn't
support ifunc, don't run the ifunc tests for alpha.

* testsuite/ld-elf/dynamic-1.rd: Accept st_other notations.
* testsuite/ld-elf/rdynamic-1.rd: Likewise.
* testsuite/ld-elf/pr9676.rd: Likewise.
* testsuite/ld-elf/pr9679.rd: Likewise.
* testsuite/ld-elfvers/vers30.dsym: Likewise.
* testsuite/ld-elfvers/vers31.dsym: Likewise.
* testsuite/ld-plugin/pr22983.3.d: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Exclude alpha.

4 years agoEmit a warning when -z relro is unsupported
Alan Modra [Thu, 18 Jun 2020 23:47:20 +0000 (09:17 +0930)]
Emit a warning when -z relro is unsupported

ld silently accepts -z relro and -z norelro for targets that lack the
necessary GNU_RELRO support.  This patch makes those targets emit a
warning instead, and adds testsuite infrastructure to detect when
relro is unsupported.

binutils/
* testsuite/config/default.exp (ld_elf_shared_opt): Don't set.
* testsuite/lib/binutils-common.exp (check_relro_support): New proc.
(run_dump_test): Use check_relro_support to decide whether to pass
extra ld option "-z norelro".
ld/
* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Omit
-z relro and -z norelro when target support for GNU_RELRO is lacking.
(gld${EMULATION_NAME}_before_parse): Ignore RELRO default too.
* emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Ignore
RELRO default when target support for GNU_RELRO is lacking.
* emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise.
* emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Likewise.
* emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise.
* testsuite/config/default.exp (ld_elf_shared_opt): Don't set.
* testsuite/ld-elf/pr16322.d: xfail when no relro support.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/shared.exp (pr20995-2.so, pr20995-2): Likewise.
* testsuite/lib/ld-lib.exp (run_ld_link_tests): Use check_relro_support
to decide whether to pass extra ld option "-z norelro".

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 19 Jun 2020 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoDecouple inferior_ptid/inferior_thread(); dup ptids in thread list (PR 25412)
Pedro Alves [Thu, 18 Jun 2020 20:28:37 +0000 (21:28 +0100)]
Decouple inferior_ptid/inferior_thread(); dup ptids in thread list (PR 25412)

In PR 25412, Simon noticed that after the multi-target series, the
tid-reuse.exp testcase manages to create a duplicate thread in the
thread list.  Or rather, two threads with the same PTID.

add_thread_silent has code in place to detect the case of a new thread
reusing some older thread's ptid, but it doesn't work correctly
anymore when the old thread is NOT the current thread and it has a
refcount higher than 0.  Either condition prevents a thread from being
deleted, but the refcount case wasn't being considered.  I think the
reason that case wasn't considered is that that code predates
thread_info refcounting.  Back when it was originally written,
delete_thread always deleted the thread.

That add_thread_silent code in question has some now-unnecessary
warts, BTW.  For instance, this:

  /* Make switch_to_thread not read from the thread.  */
  new_thr->state = THREAD_EXITED;

... used to be required because switch_to_thread would update
'stop_pc' otherwise.  I.e., it would read registers from an exited
thread otherwise.  switch_to_thread no longer reads the stop_pc, since:

  commit f2ffa92bbce9dd5fbedc138ac2a3bc8a88327d09
  Author:     Pedro Alves <palves@redhat.com>
  AuthorDate: Thu Jun 28 20:18:24 2018 +0100

      gdb: Eliminate the 'stop_pc' global

Also, if the ptid of the now-gone current thread is reused, we
currently return from add_thread_silent with the current thread
pointing at the _new_ thread.  Either pointing at the old thread, or
at no thread selected would be reasonable.  But pointing at an
unrelated thread (the new thread that happens to reuse the ptid) is
just broken.  Seems like I was the one who wrote it like that but I
have no clue why, FWIW.

Currently, an exited thread kept in the thread list still holds its
original ptid.  The idea was that we need the ptid to be able to
temporarily switch to another thread and then switch back to the
original thread, because thread switching is really inferior_ptid
switching.  Switching back to the original thread requires a ptid
lookup.

Now, in order to avoid exited threads with the same ptid as a live
thread in the same thread list, one thing I considered (and tried) was
to change an exited thread's ptid to minus_one_ptid.  However, with
that, there's a case that we won't handle well, which is if we end up
with more than one exited thread in the list, since then all exited
threads will all have the same ptid.  Since inferior_thread() relies
on inferior_ptid, may well return the wrong thread.

My next attempt to address this, was to switch an exited thread's ptid
to a globally unique "exited" ptid, which is a ptid with pid == -1 and
tid == 'the thread's global GDB thread number'.  Note that GDB assumes
that the GDB global thread number is monotonically increasing and
doesn't wrap around.  (We should probably make GDB thread numbers
64-bit to prevent that happening in practice; they're currently signed
32-bit.)  This attempt went a long way, but still ran into a number of
issues.  It was a major hack too, obviously.

My next attempt is the one that I'm proposing, which is to bite the
bullet and break the connection between inferior_ptid and
inferior_thread(), aka the current thread.  I.e., make the current
thread be a global thread_info pointer that is written to directly by
switch_to_thread, etc., and making inferior_thread() return that
pointer, instead of having inferior_thread() lookup up the
inferior_ptid thread, by ptid_t.  You can look at this as a
continuation of the effort of using more thread_info pointers instead
of ptids when possible.

By making the current thread a global thread_info pointer, we can make
switch_to_thread simply write to the global thread pointer, which
makes scoped_restore_current_thread able to restore back to an exited
thread without relying on unrelyable ptid look ups.  I.e., this makes
it not a real problem to have more than one thread with the same ptid
in the thread list.  There will always be only one live thread with a
given ptid, so code that looks up a live thread by ptid will always be
able to find the right one.

This change required auditing the whole codebase for places where we
were writing to inferior_ptid directly to change the current thread,
and change them to use switch_to_thread instead or one of its
siblings, because otherwise inferior_thread() would return a thread
unrelated to the changed-to inferior_ptid.  That was all (hopefully)
done in previous patches.

After this, inferior_ptid is mainly used by target backend code.  It
is also relied on by a number of target methods.  E.g., the
target_resume interface and the memory reading routines -- we still
need it there because we need to be able to access memory off of
processes for which we don't have a corresponding inferior/thread
object, like when handling forks.  Maybe we could pass down a context
explicitly to target_read_memory, etc.

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

PR gdb/25412
* gdbthread.h (delete_thread, delete_thread_silent)
(find_thread_ptid): Update comments.
* thread.c (current_thread_): New global.
(is_current_thread): Move higher, and reimplement.
(inferior_thread): Reimplement.
(set_thread_exited): Use bool.  Add assertions.
(add_thread_silent): Simplify thread-reuse handling by always
calling delete_thread.
(delete_thread): Remove intro comment.
(find_thread_ptid): Skip exited threads.
(switch_to_thread_no_regs): Write to current_thread_.
(switch_to_no_thread): Check CURRENT_THREAD_ instead of
INFERIOR_PTID.  Clear current_thread_.

4 years agoDon't write to inferior_ptid in aix-thread.c
Pedro Alves [Thu, 18 Jun 2020 20:28:36 +0000 (21:28 +0100)]
Don't write to inferior_ptid in aix-thread.c

There are other writes in the file, but they seem more harmless.  This
one is changing the current thread permanently.

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* aix-thread.c (pd_update): Use switch_to_thread.

4 years agoDon't write to inferior_ptid in ravenscar-thread.c
Pedro Alves [Thu, 18 Jun 2020 20:28:36 +0000 (21:28 +0100)]
Don't write to inferior_ptid in ravenscar-thread.c

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* ravenscar-thread.c (ravenscar_thread_target): Update.
(ravenscar_thread_target::update_inferior_ptid): Rename to ...
(ravenscar_thread_target::add_active_thread): ... this.  Don't
set m_base_ptid here.  Update to avoid referencing inferior_ptid.
(ravenscar_thread_target::wait): Don't write to inferior_ptid.

4 years agoDon't write to inferior_ptid in windows-nat.c, part II
Pedro Alves [Thu, 18 Jun 2020 20:28:35 +0000 (21:28 +0100)]
Don't write to inferior_ptid in windows-nat.c, part II

Writing to inferior_ptid in
windows_nat_target::get_windows_debug_event is just incorrect and not
necessary.  We'll report the event to GDB's core, which then takes
care of switching inferior_ptid / current thread.

Related (see windows_nat_target::get_windows_debug_event), there's
also a "current_windows_thread" global that is just begging to get out
of sync with core GDB's current thread.  This patch removes it.
gdbserver already does not have an equivalent global in win32-low.cc.

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* nat/windows-nat.c (current_windows_thread): Remove.
* nat/windows-nat.h (current_windows_thread): Remove.
* windows-nat.c (windows_nat_target::stopped_by_sw_breakpoint):
Adjust.
(display_selectors): Adjust to fetch the current
windows_thread_info based on inferior_ptid.
(fake_create_process): No longer write to current_windows_thread.
(windows_nat_target::get_windows_debug_event):
Don't set inferior_ptid or current_windows_thread.
(windows_nat_target::wait): Adjust to not rely on
current_windows_thread.
(do_initial_windows_stuff): Now a method of windows_nat_target.
Switch to the last_ptid thread.
(windows_nat_target::attach): Adjust.
(windows_nat_target::detach): Use switch_to_no_thread instead of
writing to inferior_ptid directly.
(windows_nat_target::create_inferior): Adjust.

4 years agoDon't write to inferior_ptid in windows-nat.c, part I
Pedro Alves [Thu, 18 Jun 2020 20:28:34 +0000 (21:28 +0100)]
Don't write to inferior_ptid in windows-nat.c, part I

The inferior_ptid hack in do_initial_win32_stuff, added back in 2008:

  https://sourceware.org/ml/gdb-patches/2008-10/msg00012.html

with:

  commit 9f9d052e600ed9436f9fd558d62a189c8cc3d43e
  Author:     Pierre Muller <muller@sourceware.org>
  AuthorDate: Thu Oct 2 14:20:07 2008 +0000

      * win32-nat.c (do_initial_win32_stuff): Set inferior_ptid.

is no longer needed.  Back then, current_inferior looked like this:

  struct inferior*
  current_inferior (void)
  {
    struct inferior *inf = find_inferior_pid (ptid_get_pid (inferior_ptid));
    gdb_assert (inf);
    return inf;
  }

Nowadays, current_inferior() just returns the global current_inferior_
pointer, which didn't exist back then.

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* windows-nat.c (do_initial_windows_stuff): No longer set inferior_ptid.

4 years agoDon't write to inferior_ptid in go32-nat.c
Pedro Alves [Thu, 18 Jun 2020 20:28:33 +0000 (21:28 +0100)]
Don't write to inferior_ptid in go32-nat.c

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* go32-nat.c (go32_nat_target::create_inferior): Switch to thread
after creating it, instead of writing to inferior_ptid.  Don't
write to inferior_ptid.

4 years agoDon't write to inferior_ptid in fork-child.c
Pedro Alves [Thu, 18 Jun 2020 20:28:32 +0000 (21:28 +0100)]
Don't write to inferior_ptid in fork-child.c

This is no longer necessary.  All targets that call fork_inferior now
also call switch_to_thread as soon as they add the main thread.

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* fork-child.c (postfork_hook): Don't write to inferior_ptid.

4 years agoDon't write to inferior_ptid in bsd-kvm.c
Pedro Alves [Thu, 18 Jun 2020 20:28:32 +0000 (21:28 +0100)]
Don't write to inferior_ptid in bsd-kvm.c

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* bsd-kvm.c (bsd_kvm_target_open): Switch to thread after adding
it, instead of writing to inferior_ptid.

4 years agoDon't write to inferior_ptid in btrace_fetch
Pedro Alves [Thu, 18 Jun 2020 20:28:31 +0000 (21:28 +0100)]
Don't write to inferior_ptid in btrace_fetch

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* btrace.c (btrace_fetch): Use switch_to_thread instead of writing
to inferior_ptid.

4 years agoDon't write to inferior_ptid in bsd-kvm.c
Pedro Alves [Thu, 18 Jun 2020 20:28:30 +0000 (21:28 +0100)]
Don't write to inferior_ptid in bsd-kvm.c

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* bsd-kvm.c (bsd_kvm_target::close): Use switch_to_no_thread
instead of writing to inferior_ptid directly.

4 years agoDon't write to inferior_ptid in corelow.c
Pedro Alves [Thu, 18 Jun 2020 20:28:29 +0000 (21:28 +0100)]
Don't write to inferior_ptid in corelow.c

gdb/ChangeLog:
2020-06-18  Pedro Alves  <palves@redhat.com>

* corelow.c (core_target::close): Use switch_to_no_thread instead
of writing to inferior_ptid directly.
(add_to_thread_list, core_target_open): Use switch_to_thread
instead of writing to inferior_ptid directly.