gdb's (or gdbserver's) own signal handling should not interfere with
the signal dispositions their spawned children inherit. However, it
currently does. For example, some paths in gdb cause SIGPIPE to be
set to SIG_IGN, and as consequence, the child starts with SIGPIPE to
set to SIG_IGN too, even though gdb was started with SIGPIPE set to
SIG_DFL.
This is because the exec family of functions does not reset the signal
disposition of signals that are set to SIG_IGN:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/execve.html
Signals set to the default action (SIG_DFL) in the calling process
image are set to the default action in the new process
image. Signals set to be ignored (SIG_IGN) by the calling process
image are set to be ignored by the new process image. Signals set to
be caught by the calling process image are set to the default action
in the new process image (see <signal.h>).
And neither does it reset signal masks or flags.
In order to be transparent, when spawning new child processes to debug
(with "run", etc.), reset signal actions and mask back to what was
originally inherited from gdb/gdbserver's parent, just before execing
the target program to debug.
gdb/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
* Makefile.in (SFILES): Add
common/signals-state-save-restore.c.
(HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h.
(COMMON_OBS): Add signals-state-save-restore.o.
(signals-state-save-restore.o): New rule.
* configure: Regenerate.
* fork-child.c: Include "signals-state-save-restore.h".
(fork_inferior): Call restore_original_signals_state.
* main.c: Include "signals-state-save-restore.h".
(captured_main): Call save_original_signals_state.
* common/common.m4: Add sigaction to AC_CHECK_FUNCS checks.
* common/signals-state-save-restore.c: New file.
* common/signals-state-save-restore.h: New file.
gdb/gdbserver/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
* Makefile.in (OBS): Add signals-state-save-restore.o.
(signals-state-save-restore.o): New rule.
* config.in: Regenerate.
* configure: Regenerate.
* linux-low.c: Include "signals-state-save-restore.h".
(linux_create_inferior): Call
restore_original_signals_state.
* server.c: Include "dispositions-save-restore.h".
(captured_main): Call save_original_signals_state.
gdb/testsuite/ChangeLog:
2016-08-09 Pedro Alves <palves@redhat.com>
PR gdb/18653
* gdb.base/signals-state-child.c: New file.
* gdb.base/signals-state-child.exp: New file.
* gdb.gdb/selftest.exp (do_steps_and_nexts): Add new pattern.
We build by default with a C++ compiler, but "configure --help" still
says "--enable-build-with-cxx", which hints that it is by default
disabled. Update the --help text.
gdb/ChangeLog:
2016-08-05 Pedro Alves <palves@redhat.com>
* build-with-cxx.m4: Change help string to be in terms of
--disable-build-with-cxx.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2016-08-05 Pedro Alves <palves@redhat.com>
* configure: Regenerate.
This makes --enable-build-with-cxx be "yes" by default.
One must now configure with --enable-build-with-cxx=no in order to
build with a C compiler.
gdb/ChangeLog:
2016-04-20 Pedro Alves <palves@redhat.com>
* build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Default to yes.
* configure: Renegerate.
gdb/gdbserver/ChangeLog:
2016-04-20 Pedro Alves <palves@redhat.com>
* configure: Renegerate.
The ptrace args/return types detection doesn't work properly in C++
mode, on non-GNU/Linux hosts. For example, on gcc70 (NetBSD 5.1),
where the prototype is:
int ptrace(int, __pid_t, void*, int);
configure misdetects it as:
$ grep PTRACE_TYPE config.h
#define PTRACE_TYPE_ARG1 int
#define PTRACE_TYPE_ARG3 int *
#define PTRACE_TYPE_ARG4 int
/* #undef PTRACE_TYPE_ARG5 */
#define PTRACE_TYPE_RET int
resulting in:
../../src/gdb/amd64bsd-nat.c: In function 'void amd64bsd_fetch_inferior_registers(target_ops*, regcache*, int)':
../../src/gdb/amd64bsd-nat.c:56: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../src/gdb/amd64bsd-nat.c: In function 'void amd64bsd_store_inferior_registers(target_ops*, regcache*, int)':
../../src/gdb/amd64bsd-nat.c:104: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../src/gdb/amd64bsd-nat.c:110: warning: dereferencing type-punned pointer will break strict-aliasing rules
We could address this [1], however despite ptrace.m4's claim:
# Needs to be tested in C++ mode, to detect whether we need to cast
# the first argument to enum __ptrace_request.
it appears that there's actually no need to test in C++ mode. Always
running the ptrace tests in C mode works just the same on GNU/Linux.
I remember experimenting with several different ways to handle the
original issue back then, and maybe that was needed in some other
attempt and then I didn't realize it ended up not really necessary.
Confirmed that this fixes the NetBSD 5.1 C++ build, and confirmed that
C and C++ builds on Fedora 23 are unaffected.
[1] - https://sourceware.org/ml/gdb-patches/2016-04/msg00374.html
gdb/ChangeLog:
2016-04-18 Pedro Alves <palves@redhat.com>
* ptrace.m4 (GDB_AC_PTRACE): Don't run tests in C++ mode.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2016-04-18 Pedro Alves <palves@redhat.com>
* configure: Regenerate.
Using AC_OUTPUT with arguments has been deprecated for some time in
autoconf, even in version 2.64, which we are using. This change should
not affect functionality.
I also removed the "exit 0"'s, they shouldn't be necessary.
gdb/ChangeLog:
* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
to AC_OUTPUT. Remove "exit 0" at the end.
* configure: Regenerate.
gdb/testsuite/ChangeLog:
* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
to AC_OUTPUT.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
to AC_OUTPUT.
* configure: Regenerate.
Currently, even when built with --enable-build-with-cxx, gdb uses
CFLAGS instead of CXXFLAGS. This commit fixes it.
CXXFLAGS set in the environment when configure was run is now honored
in the generated gdb/Makefile, and you can also override CXXFLAGS in
the command like at make time, with the usual 'make CXXFLAGS="..."'
Objects built with a C compiler (e.g., gnulib) still honor CFLAGS
instead.
gdb/ChangeLog:
2016-01-21 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER_CFLAGS): New.
(CXXFLAGS): Get it from configure.
(INTERNAL_CFLAGS_BASE, INTERNAL_LDFLAGS): Use COMPILER_CFLAGS
instead of CFLAGS.
* build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Set and AC_SUBST
COMPILER_CFLAGS.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2016-01-21 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER_CFLAGS, CXXFLAGS): New.
(INTERNAL_CFLAGS_BASE): Use COMPILER_CFLAGS instead of CFLAGS.
* configure: Regenerate.
This commit fixes nat/linux-namespaces.c to build correctly on
targets without fork.
gdb/ChangeLog:
* nat/linux-namespaces.c (do_fork): New function.
(linux_mntns_get_helper): Use the above.
gdb/gdbserver/ChangeLog:
* configure.ac (AC_FUNC_FORK): New check.
* config.in: Regenerate.
* configure: Likewise.
We need to use -Wno-missing-prototypes for now as much of the code
sticks externs in local files and not in common headers.
2016-01-11 Mike Frysinger <vapier@gentoo.org>
* acinclude.m4: Include new ../warning.m4 file.
* configure: Regenerated.
* configure.ac: Replace all warning logic with AM_GDB_WARNINGS.
Ref: https://sourceware.org/ml/gdb/2015-12/msg00024.html
We have code in configure.ac that tries to detect whether the compiler
supports each warning and suppress it if not, but that doesn't work
with "-Wno-" options, because gcc doesn't error out for
-Wno-unknown-warning unless other diagnostics are being produced.
See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html.
Handle this by checking whether -Wfoo works when we actually want
-Wno-foo.
gdb/ChangeLog:
2015-12-16 Pedro Alves <palves@redhat.com>
* configure.ac (compiler warning flags): When testing a
-Wno-foo option, check whether -Wfoo works instead.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-12-16 Pedro Alves <palves@redhat.com>
* configure.ac (compiler warning flags): When testing a
-Wno-foo option, check whether -Wfoo works instead.
* configure: Regenerate.
See the comment added in configure.ac for more details behind
this change.
gdb/gdbserver/ChangeLog:
* configure.ac: Do not call AC_CHECK_TYPES for Elf32_auxv_t
and Elf64_auxv_t if the target is Android.
Both x86_64 GNU/Linux and x86_64 mingw-w64 build cleanly with
--enable-targets=all. This enables -Werror by default in C++ mode
too, in order to let the buildbot catch C++ build regressions for us.
gdb/ChangeLog:
2015-11-19 Pedro Alves <palves@redhat.com>
* configure.ac (ERROR_ON_WARNING): Don't check whether in C++
mode.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-11-19 Pedro Alves <palves@redhat.com>
* configure.ac (ERROR_ON_WARNING): Don't check whether in C++
mode.
* configure: Regenerate.
Both x86_64 GNU/Linux and x86_64 mingw-w64 build cleanly with
--enable-targets=all. Let's drop the -fpermissive hack, in order to
let the buildbot catch C++ build regressions for us.
gdb/ChangeLog:
2015-11-19 Pedro Alves <palves@redhat.com>
* build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Remove -fpermissive.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-11-19 Pedro Alves <palves@redhat.com>
* configure: Regenerate.
Building in C++ mode issues ~40 warnings like this:
../../src/gdb/linux-nat.c: In function ‘int linux_handle_extended_wait(lwp_info*, int, int)’:
../../src/gdb/linux-nat.c:2016:51: warning: invalid conversion from ‘int’ to ‘__ptrace_request’ [-fpermissive]
ptrace (PTRACE_GETEVENTMSG, pid, 0, &new_pid);
The issue is that in glibc, ptrace's first parameter is an enum.
That's not a problem if we pick the PTRACE_XXX requests from
sys/ptrace.h, as those will be values of the corresponding enum.
However, we have fallback definitions for PTRACE_XXX symbols when the
system headers miss them (such as PTRACE_GETEVENTMSG above), and those
are plain integer constants. E.g., nat/linux-ptrace.h:
#define PTRACE_GETEVENTMSG 0x4201
One idea would be to fix this by defining those fallbacks like:
-#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETEVENTMSG ((enum __ptrace_request) 0x4201)
However, while glibc's ptrace uses enum __ptrace_request for first
parameter:
extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
other libc's, like e.g., Android's bionic do not -- in that case, the
first parameter is int:
long ptrace(int request, pid_t pid, void * addr, void * data);
So the fix I came up is to make configure/ptrace.m4 also detect the
type of the ptrace's first parameter and defin PTRACE_TYPE_ARG1, as
already does the for parameters 3-4, and then simply wrap ptrace with
a macro that casts the first argument to the detected type. (I'm
leaving adding a nicer wrapper for when we drop building in C).
While this adds the wrapper, GNU/Linux files won't use it until the
next patch, which makes all native GNU/Linux files include
gdb_ptrace.h.
gdb/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* ptrace.m4 (ptrace tests): Test in C++ mode. Try with 'enum
__ptrace_request as first parameter type instead of int.
(PTRACE_TYPE_ARG1): Define.
* nat/gdb_ptrace.h [!PTRACE_TYPE_ARG5] (ptrace): Define as wrapper
that casts first argument to PTRACE_TYPE_ARG1.
* config.in: Regenerate.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* config.in: Regenerate.
* configure: Regenerate.
This factors the ptrace checks out of gdb's configure.ac to a new
ptrace.m4 file, and then makes gdbserver's configure.ac source it too.
gdb/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include ptrace.m4.
* configure.ac: Call GDB_AC_PTRACE and move ptrace checks ...
* ptrace.m4: ... to this new file.
gdb/gdbserver/ChangeLog:
2015-07-24 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include ../ptrace.m4.
* configure.ac: Call GDB_AC_PTRACE.
* config.in, configure: Regenerate.
Later patches need regex support also in gdbserver.
gdb/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to
common/gdb_regex.h.
(COMMON_OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex,
--without-included-regex and USE_INCLUDED_REGEX.
* common/gdb_regex.c: New file from utils.c functions.
* common/gdb_regex.h: Move it here from gdb_regex.h, update include
file wrapping define name.
* configure: Rebuilt.
* configure.ac (gdb_use_included_regex, --without-included-regex)
(USE_INCLUDED_REGEX): Move them to common/common.m4.
* gdb_regex.h: Move it to common/gdb_regex.h.
* utils.c: Remove include gdb_regex.h.
(do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error)
(compile_rx_or_error): Move them to common/gdb_regex.c.
gdb/gdbserver/ChangeLog
2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* config.in: Rebuilt.
* configure: Rebuilt.
The following patch...
| proc-service, extern "C"
|
| libthread_db.so calls symbols in the client (GDB), through the
| proc-service interface. These routines must have extern "C" linkage
| so their symbol names are not mangled when GDB is built as a C++
| program. On the GDBserver side, we were missing fallback declarations for
| all these symbols.
|
| gdb/ChangeLog:
|
| * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
|
| gdb/gdbserver/ChangeLog:
| 2015-02-27 Pedro Alves <palves@redhat.com>
|
| * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP.
| [!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare.
| [!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread)
| ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs)
| (ps_lsetfpregs, ps_getpid)
| (ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue)
| (ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs)
| (ps_lsetxregs, ps_plog): Declare.
... added a number of declarations which do not compile when cross-
compiling GDBserver on arm-android. The problem comes from type
prfpregset_t not being declared:
/[...]/gdbserver/gdb_proc_service.h:98:47:
error: unknown type name 'prfpregset_t'
After searching through the includes of the install we have,
I could not find that type being declared anywhere. So I did
the same as for prgregset_t, and created the typedef if the
type isn't declared.
gdb/gdbserver/ChangeLog:
* configure.ac: Add prfpregset_t BFD_HAVE_SYS_PROCFS_TYPE check.
* configure, config.in: Regenerate.
* gdb_proc_service.h [HAVE_PRFPREGSET_T] (prfpregset_t):
Declare typedef.
Whoops, these are C specific, but I somehow missed the warnings before:
cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wmissing-parameter-type’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wold-style-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wold-style-definition’ is valid for C/ObjC but not for C++ [enabled by default]
gdb/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
* configure.ac (build_warnings): Move -Wmissing-prototypes
-Wdeclaration-after-statement -Wmissing-parameter-type
-Wold-style-declaration -Wold-style-definition to the C-specific
set.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
* configure.ac (build_warnings): Move
-Wdeclaration-after-statement to the C-specific set.
* configure: Regenerate.
This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ (98/03)
compiler.
The name of the switch should be familiar to those who followed GCC's
own C++ conversion process.
. Adding -fpermissive to COMPILER in C++ mode (see the new
build-with-cxx.m4 file) makes errors like these be warnings instead:
gdb/infrun.c:6597:1: error: initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive]
sig_print_info (enum gdb_signal oursig)
^
gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’:
gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive]
restore_infcall_suspend_state (state);
^
so that the compiler carries on compiling the file. -Werror still
catches the warnings, so nothing is lost, only our lifes are made
easier by concentrating on getting other more important things out of
the way first.
There's no way to quiet those warnings. Until they're all fixed, when
building in C++ mode, -Werror is disabled by default.
. Adding -Wno-narrowing suppresses thousands of instances of this warning:
gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
We can defer handling those until we target C++11.
. Adding -Wno-sign-compare suppresses thousands of instances of this warning:
gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (tmpulongest == tdep->fcntl_F_GETLK64)
^
. Adding -Wno-write-strings suppresses thousands of instances of this warning:
gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’:
gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
attstr = "editable";
^
gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
attstr = "noneditable";
^
For now, it's best to hide these warnings from view until we're
'-fpermissive'-clean, and can thus start building with -Werror.
The C compiler has always managed to build working GDBs with these
issues in the code, so a C++ compiler should too.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER): New, get it from autoconf.
(COMPILE.pre, CC_LD): Use COMPILER.
(CXX): Get from autoconf instead.
(CXX_FOR_TARGET): Default to g++ instead of gcc.
* acinclude.m4: Include build-with-cxx.m4.
* build-with-cxx.m4: New file.
* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
Disable -Werror by default if building in C++ mode.
(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
-Wno-narrowing in C++ mode. Only enable -Wpointer-sign in C mode.
Run supported-warning-flags tests with the C++ compiler.
Save/restore CXXFLAGS too.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* Makefile.in (COMPILER): New, get it from autoconf.
(CXX): Get from autoconf instead.
(COMPILE.pre): Use COMPILER.
(CC-LD): Rename to ...
(CC_LD): ... this. Use COMPILER.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust.
(CXX_FOR_TARGET): Default to g++ instead of gcc.
* acinclude.m4: Include build-with-cxx.m4.
* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
Disable -Werror by default if building in C++ mode.
(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
-Wno-narrowing in C++ mode. Run supported-warning-flags tests with
the C++ compiler. Save/restore CXXFLAGS too.
* configure: Regenerate.
Converting GDB to be a C++ program, I stumbled on 'basename' issues,
like:
src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’
/usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’
which I believe led to this bit in gold's configure.ac:
dnl We have to check these in C, not C++, because autoconf generates
dnl tests which have no type information, and current glibc provides
dnl multiple declarations of functions like basename when compiling
dnl with C++.
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
These checks IIUC intend to generate all the HAVE_DECL_FOO symbols
that libiberty.h and ansidecl.h check.
GDB is missing these checks currently, which results in the conflict
shown above.
This adds an m4 file that both GDB and GDBserver's configury use to
pull in the autoconf checks that libiberty clients needs done in order
to use these libiberty.h/ansidecl.h.
gdb/ChangeLog:
2015-02-27 Pedro Alves <palves@redhat.com>
* libiberty.m4: New file.
* acinclude.m4: Include libiberty.m4.
* configure.ac: Call libiberty_INIT.
* config.in, configure: Regenerate.
gdb/gdbserver/
2015-02-27 Pedro Alves <palves@redhat.com>
* acinclude.m4: Include libiberty.m4.
* configure.ac: Call libiberty_INIT.
* config.in, configure: Regenerate.
This patch moves safe_strerror from the gdb/{posix,mingw}-hdep.c files
to the respective common/{posix,mingw}-strerror.c files. This is a
preparation for the next patch, which shares a common code (to disable
address space randomization when creating a new inferior).
The patch has been regtested on Fedora 20 x86_64, and no regressions
were found.
gdb/ChangeLog
2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (ALLDEPFILES): Including common/mingw-strerror.c and
common/posix-strerror.c.
(posix-strerror.o): New rule.
(mingw-strerror.o): Likewise.
* common/common-utils.h (safe_strerror): Move prototype to here,
from utils.h.
* common/common.host: New file.
* common/mingw-strerror.c: Likewise.
* common/posix-strerror.c: Likewise.
* configure: Regenerated.
* configure.ac: Source common/common.host. Add variable
common_host_obs to gdb_host_obs.
* contrib/ari/gdb_ari.sh: Mention gdb/common/mingw-strerror.c and
gdb/common/posix-strerror.c when warning about the use of
strerror.
* mingw-hdep.c (safe_strerror): Remove definition; move it to
common/mingw-strerror.c.
* posix-hdep.c (safe_strerror): Remove definition; move it to
common/posix-hdep.c.
* utils.h (safe_strerror): Remove prototype; move to
common/common-utils.h.
gdb/gdbserver/ChangeLog
2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (posix-strerror.o): New rule.
(mingw-strerror.o): Likewise.
* configure: Regenerated.
* configure.ac: Source file ../common/common.host. Initialize new
variable srv_host_obs. Add srv_host_obs to GDBSERVER_DEPFILES.
This patch is to teach both GDB and GDBServer to detect 64-bit inferior
correctly. We find a problem that GDBServer is unable to detect on a
e5500 core processor. Current GDBServer assumes that MSR is a 64-bit
register, but MSR is a 32-bit register in Book III-E. This patch is
to fix this problem by checking the right bit in MSR, in order to handle
both Book III-S and Book III-E. In order to detect Book III-S and
Book III-E, we check the PPC_FEATURE_BOOKE from the host's HWCAP (by
getauxval on glibc >= 2.16. If getauxval doesn't exist, we implement
the fallback by parsing /proc/self/auxv), because it should an invariant
on the same machine cross different processes.
In order to share code, I add nat/ppc-linux.c for both GDB and
GDBserver side.
gdb:
2015-01-14 Yao Qi <yao@codesourcery.com>
* Makefile.in (ppc-linux.o): New rule.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Add ppc-linux.o.
* configure.ac: AC_CHECK_FUNCS(getauxval).
* config.in: Re-generated.
* configure: Re-generated.
* nat/ppc-linux.h [__powerpc64__] (ppc64_64bit_inferior_p):
Declare.
* nat/ppc-linux.c: New file.
* ppc-linux-nat.c (ppc_linux_target_wordsize) [__powerpc64__]:
Call ppc64_64bit_inferior_p.
gdb/gdbserver:
2015-01-14 Yao Qi <yao@codesourcery.com>
* Makefile.in (SFILES): Add nat/ppc-linux.c.
(ppc-linux.o): New rule.
* configure.srv (powerpc*-*-linux*): Add ppc-linux.o.
* configure.ac: AC_CHECK_FUNCS(getauxval).
* config.in: Re-generated.
* configure: Re-generated.
* linux-ppc-low.c (ppc_arch_setup) [__powerpc64__]: Call
ppc64_64bit_inferior_p
This patch mostly aims at fixing a GDB build failure on 32bit Solaris
systems (Sparc and x86), due to a recent gnulib update adding the
readlink module. But it might also fix related issues when configuring
with --disable-largefile.
A side-effect of the gnulib readlink module addition is that it caused
largefile support to be added as well, and in particular
gnulib/import/m4/largefile.m4 introduced the following new #define in
gnulib's config.in:
| +/* Number of bits in a file offset, on hosts where this is settable. */
| +#undef _FILE_OFFSET_BITS
When defined to 64, it triggers an issue with procfs.h while trying
to build sparc-sol2-nat.c:
| #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
| #error "Cannot use procfs in the large file compilation environment"
| #endif
As it turns out, this is a fairly familiar problem, and one of
the reasons behind ACX_LARGEFILE having been created. In that macro,
we have some code which disables largefile support on solaris hosts:
| sparc-*-solaris*|i[3-7]86-*-solaris*)
| changequote([,])dnl
| # On native 32bit sparc and ia32 solaris, large-file and procfs support
| # are mutually exclusive; and without procfs support, the bfd/ elf module
| # cannot provide certain routines such as elfcore_write_prpsinfo
| # or elfcore_write_prstatus. So unless the user explicitly requested
| # large-file support through the --enable-largefile switch, disable
| # large-file support in favor of procfs support.
| test "${target}" = "${host}" -a "x$plugins" = xno \
| && : ${enable_largefile="no"}
| ;;
But gnulib ignores this fact, and so tries to determine how to
enable large-file support irrespective of whether we want it or not.
This patch fixes the issue by passing --disable-largefile to gnulib's
configure when large-file support in GDB is disabled. This is done
by first enhancing ACX_CONFIGURE_DIR to allow us to pass extra
arguments to be passed to the configure command, and then by modifying
GDB's configure to pass --disable-largefile if large-file support
is disabled.
gdb/ChangeLog:
* acx_configure_dir.m4 (ACX_CONFIGURE_DIR): Add support for
new "EXTRA-ARGS" parameter.
* configure.ac: If large-file support is disabled in GDB,
pass --disable-largefile to ACX_CONFIGURE_DIR call for "gnulib".
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
* configure.ac: If large-file support is disabled in GDBserver,
pass --disable-largefile to ACX_CONFIGURE_DIR call for "gnulib".
* configure: Regenerate.
Tested by rebuilding on sparc-solaris and x86_64-linux (with gdbserver).
This fixes the build failure on sparc-solaris. I also verified in
gnulib's config.log file that we pass --disable-largefile in the solaris
case, while we do not in the GNU/Linux case.
Since readlink module is imported, we can use it unconditionally.
This patch is to remove configure checks and HAVE_READLINK checks in
code. It was mentioned in the patch below
[RFA/commit] gdbserver: return ENOSYS if readlink not supported.
https://sourceware.org/ml/gdb-patches/2012-02/msg00148.html
to use readlink in gdbserver, but we chose something simple at that
moment.
gdb:
2014-11-28 Yao Qi <yao@codesourcery.com>
* configure.ac (AC_CHECK_FUNCS): Remove readlink.
* config.in, configure: Re-generate.
* inf-child.c (inf_child_fileio_readlink): Don't check
HAVE_READLINK is defined.
gdb/gdbserver:
2014-11-28 Yao Qi <yao@codesourcery.com>
* configure.ac(AC_CHECK_FUNCS): Remove readlink.
* config.in, configure: Re-generate.
* hostio.c (handle_unlink): Remove code checking HAVE_READLINK
is defined.
Since gnulib alloca module was imported, we can include alloca.h in
both gdb and gdbserver unconditionally, so this patch adds inclusion
of alloca.h in common-defs.h. This patch also removes AC_FUNC_ALLOCA
in configure.ac because we don't need to check alloca any more.
This patch below is removed in fact.
[RFA/commit] include alloca.h if available.
https://www.sourceware.org/ml/gdb-patches/2010-08/msg00566.html
Since alloca.h is from gnulib now, we don't have to check malloc.h in
configure and include malloc.h in code. This patch also remove them
too.
gdb:
2014-11-21 Yao Qi <yao@codesourcery.com>
* common/common-defs.h: Include alloca.h
* configure.ac: Don't invoke AC_FUNC_ALLOCA.
* configure: Re-generated.
* defs.h: Remove code handling alloca.
* utils.c (gdb_realpath): Don't check HAVE_ALLOCA is defined
or not.
gdb/gdbserver:
2014-11-21 Yao Qi <yao@codesourcery.com>
* configure.ac: Don't invoke AC_FUNC_ALLOCA.
(AC_CHECK_HEADERS): Remove malloc.h.
* configure: Re-generated.
* config.in: Re-generated.
* server.h: Don't include alloca.h and malloc.h.
* gdbreplay.c: Don't check HAVE_ALLOCA_H is defined.
Don't include malloc.h.
This commit creates a new file, common/gdb_setjmp.h, to hold some
portability macros for setjmp/longjmp et al. that are used by the
exceptions subsystem and by the demangler crash catcher.
gdb/ChangeLog:
* common/gdb_setjmp.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_setjmp.h.
* configure.ac: Move sigsetjmp check...
* common/common.m4: ...here.
* configure: Regenerate.
* cp-support.c (SIGJMP_BUF): Delete.
(SIGSETJMP): Likewise.
(SIGLONGJMP): Likewise.
* exceptions.h (gdb_setjmp.h): Include.
(setjmp.h): Do not include.
(EXCEPTIONS_SIGJMP_BUF): Delete.
(EXCEPTIONS_SIGSETJMP): Likewise.
(EXCEPTIONS_SIGLONGJMP): Likewise.
Replace all uses of EXCEPTIONS_SIG* macros with SIG* macros
from gdb_setjmp.h.
* exceptions.c: Likewise.
gdb/gdbserver/ChangeLog:
* config.in: Regenerate.
* configure: Likewise.
This commit moves the inclusion of errno.h to common-defs.h and
removes all other inclusions. Note that prior to this commit
server.h included errno.h protected by "#ifdef HAVE_ERRNO_H".
This protection was added with the Windows CE port, which is
currently broken. Since no other platform needs this, I have
removed the protection and the configury to support it.
gdb/
2014-08-07 Gary Benson <gbenson@redhat.com>
* common/common-defs.h: Include errno.h.
* defs.h: Do not include errno.h.
* ada-typeprint.c: Likewise.
* c-typeprint.c: Likewise.
* core-regset.c: Likewise.
* corefile.c: Likewise.
* corelow.c: Likewise.
* event-loop.c: Likewise.
* f-typeprint.c: Likewise.
* gnu-nat.c: Likewise.
* go32-nat.c: Likewise.
* i386gnu-nat.c: Likewise.
* m2-typeprint.c: Likewise.
* nat/linux-btrace.c: Likewise.
* p-typeprint.c: Likewise.
* procfs.c: Likewise.
* remote-sim.c: Likewise.
* rs6000-nat.c: Likewise.
* target.c: Likewise.
* typeprint.c: Likewise.
* ui-file.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
gdb/gdbserver/
2014-08-07 Gary Benson <gbenson@redhat.com>
* configure.ac (AC_CHECK_HEADERS): Remove errno.h.
* configure: Regenerate.
* config.in: Likewise.
* server.h: Do not include errno.h.
* event-loop.c: Likewise.
* hostio-errno.c: Likewise.
* linux-low.c: Likewise.
* remote-utils.c: Likewise.
* spu-low.c: Likewise.
* utils.c: Likewise.
* gdbreplay.c: Unconditionally include errno.h.
The recent libiberty patch caused issues when cross building
gdbserver. The Makefile ends invoking the build machine's "ar"
instead of the --host version:
ar ./libiberty.a \
./regex.o (...)
ar: illegal option -- .
Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
ar -M [<mri-script]
The libiberty configure script does probe for and finds an appropriate
AR. However, gdbserver's configure does not probe for AR and
overrides the AR used in the libiberty build by explicitly passing AR
to the sub-builds.
gdb/gdbserver/
2014-06-20 Marcus Shawcroft <marcus.shawcroft@arm.com>
* configure.ac: Invoke. AC_CHECK_TOOL(AR, ar).
* Makefile.in (AR, AR_FLAGS): Define.
* configure: Regenerate.
This builds a libiberty just for gdbserver and arranges for gdbserver
to use it. I've tripped across the lack of libiberty in gdbserver at
least once, and I have seen other threads where it would have been
useful.
2014-06-12 Tom Tromey <tromey@redhat.com>
* debug.c (debug_printf): Remove HAVE_GETTIMEOFDAY checks.
* server.c (monitor_show_help): Remove HAVE_GETTIMEOFDAY check.
(parse_debug_format_options): Likewise.
(gdbserver_usage): Likewise.
* Makefile.in (LIBIBERTY_BUILDDIR, LIBIBERTY): New variables.
(SUBDIRS, REQUIRED_SUBDIRS): Add libiberty.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Depend on and link
against libiberty.
($(LIBGNU)): Depend on libiberty.
(all-lib): Recurse into all subdirs.
(install-only): Invoke "install" target in subdirs.
(vasprintf.o, vsnprintf.o, safe-ctype.o, lbasename.o): Remove
targets.
* configure: Rebuild.
* configure.ac: Add ACX_CONFIGURE_DIR for libiberty. Don't check
for vasprintf, vsnprintf, or gettimeofday.
* configure.srv: Don't add safe-ctype.o or lbasename.o to
srv_tgtobj.
The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.
GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).
This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).
bfd/ChangeLog:
* development.sh: New file.
* warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
Make -Werror the default with GCC only if DEVELOPMENT is true.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
$(srcdir)/development.sh.
* Makefile.in, configure: Regenerate.
binutils/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gas/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gold/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
* Makefile.in, configure: Regenerate.
gprof/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
ld/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
opcodes/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gdb/ChangeLog:
* development.sh: Delete.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure.ac: Adjust development.sh source call.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
* configure.ac: Adjust development.sh source call.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure: Regenerate.
Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.
On GDB release branches, we change $development in gdb/development.sh
to false, in order to build the GDB release without -Werror by default,
thus avoiding harmless compiler warnings from breaking the build of
someone who's only interested in building GDB rather than working
on it.
This patch implements the same strategy for gdbserver, using the exact
same method.
gdb/gdbserver/ChangeLog:
* configure.ac: Only use -Werror by default when DEVELOPMENT
is true.
* configure: Regenerate.
Tested on x86_64-linux, by rebuilding GDBserver first with development
set to true, and then doing it again with development set to false.
Werror was used in the first case, but not in the second.
stdlib.h is universal as well, so there is no need to check for it.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for stdlib.h
* defs.h: Include stdlib.h unconditionally.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* configure.ac: Don't check for stdlib.h.
* gdbreplay.c: Unconditionally include stdlib.h.
This removes gdb_dirent.h and updates the code to use dirent.h
instead. It also removes the now-useless configure checks.
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/common.m4 (GDB_AC_COMMON): Don't use AC_HEADER_DIRENT.
* common/gdb_dirent.h: Remove.
* common/filestuff.c: Use dirent.h.
* common/linux-osdata.c: Use dirent.h.
(NAMELEN): Define.
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't use AC_HEADER_DIRENT.
* linux-fork.c: Use dirent.h
* linux-nat.c: Use dirent.h.
* nto-procfs.c: Use dirent.h.
* procfs.c: Use dirent.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't use AC_HEADER_DIRENT.
Now that we are using the gnulib string.h module, we don't need to
check for string.h or strings.h. This removes the last few checks
from the source and from the configure scripts.
2013-11-18 Tom Tromey <tromey@redhat.com>
* configure: Rebuild.
* common/common.m4 (GDB_AC_COMMON): Don't check for string.h or
strings.h.
2013-11-18 Tom Tromey <tromey@redhat.com>
* server.h: Don't check HAVE_STRING_H.
* gdbreplay.c: Don't check HAVE_STRING_H.
* configure: Rebuild.
It has bothered me for a while that files in common/ use macros
defined via autoconf checks, but rely on each configure.ac doing the
proper checks independently.
This patch introduces common/common.m4 which consolidates the checks
assumed by code in common.
The rule I propose is that if something is needed or used by common,
it should be checked for by common.m4. However, if the check is also
needed by gdb or gdbserver, then it should be duplicated there.
Built and regtested on x86-64 Fedora 18 (though this is hardly the
most strenuous case) and using the Fedora 18 mingw cross compilers. I
also examined the config.in diffs to ensure that symbols did not go
missing.
2013-11-08 Tom Tromey <tromey@redhat.com>
* acinclude.m4: Include common.m4.
* common/common.m4: New file.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.
2013-11-08 Tom Tromey <tromey@redhat.com>
* acinclude.m4: Include common.m4, codeset.m4.
* configure, config.in: Rebuild.
* configure.ac: Use GDB_AC_COMMON.
It is possible to have a build of glibc where SYS_perf_event_open is not
defined (because when the glibc was compiled, the syscall did not exist),
but have newer kernel headers installed so that linux/perf_event.h is
available. In this setup, you get a build failure:
./common/linux-btrace.c: In function 'kernel_supports_btrace':
./common/linux-btrace.c:316:23: error: 'SYS_perf_event_open' undeclared (first use in this function)
Update the ifdef check to also see if the syscall is available.
URL: https://bugs.gentoo.org/473522
Reported-by: William Throwe <wtt6@cornell.edu>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-07-04 Yao Qi <yao@codesourcery.com>
Revert:
2013-06-27 Yao Qi <yao@codesourcery.com>
* common/create-version.sh: Update comments. Handle the case
that TARGET_ALIAS is empty.
gdb/gdbserver/
2013-07-04 Yao Qi <yao@codesourcery.com>
* Makefile.in (host_alias): Use @host_noncanonical@.
(target_alias): Use @target_noncanonical@.
* configure.ac: Use ACX_NONCANONICAL_TARGET and
ACX_NONCANONICAL_HOST.
* configure: Regenerated.
Revert:
2013-06-28 Mircea Gherzan <mircea.gherzan@intel.com>
* configure.ac (version_host, version_target): Set and AC_SUBST them.
* configure: Rebuild.
* Makefile.in (version_host, version_target): Get from configure.
(version.c): Use $(version_host) and $(version_target).
This factors --enable-libmcheck related bits from GDB's configure.ac
and makes GDBserver use them too. Specifically, the 'development'
global is moved to a separate script to it can be sourced by both GDB
and GDBserver, and the --enable-libmcheck/--disable-libmcheck bits
proper are moved to a new m4 file.
I started out by defining 'development' in the m4 file, but in the end
decided against it, as a separate script has the advantage that
changing it in release branches does not require regenerating
configure, unlike today.
I had also started out by making the new GDB_AC_LIBMCHECK itself
handle the yes/no default fallback depending on release/developement,
but since I had split out 'development' to a separate script, and, GDB
needs the python checks anyway (hence we'd need to do the python
checks in gdb's configure.ac, and pass in a 'default lmcheck yes/no'
parameter to GDB_AC_LIBMCHECK anyway), I ended up keeping
GDB_AC_LIBMCHECK isolated from the 'development' global. IOW, it's
the caller's business to handle it.
Tested on x86_64 Fedora 17. Built GDB and GDBserver with and without
--enable-libmcheck, and observed --enable-libmcheck overrides the
disablement of -lmcheck caused by python supporting threads, and that
GDBserver links with -lmcheck when expected. Also observed that
changing the 'development' global, and issuing "make" triggers a
relink, and '-lmcheck' is included or not from the link accordingly.
gdb/
2013-07-03 Pedro Alves <palves@redhat.com>
* Makefile.in (config.status): Depend on development.sh.
(aclocal_m4_deps): Add libmcheck.m4.
* acinclude.m4: Include libmcheck.m4.
* configure.ac: Source development.sh instead of setting
'development' here. --enable-libmcheck/--disable-libmcheck code
factored out to GDB_AC_LIBMCHECK. Run it.
* development.sh: New file.
* libmcheck.m4: New file.
* configure: Regenerate.
gdb/gdbserver/
2013-07-03 Pedro Alves <palves@redhat.com>
* Makefile.in (config.status): Depend on development.sh.
* acinclude.m4: Include libmcheck.m4.
* configure: Regenerate.
With gnulib's unistd module, we can assume unistd.h is always present, and that
STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO are always defined.
Don't remove unistd.h from GDB's configure.ac, as later tests in the
file use HAVE_UNISTD_H checks.
gdb/
2013-07-01 Pedro Alves <palves@redhat.com>
* defs.h: Don't check HAVE_UNISTD_H before including <unistd.h>.
(STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Delete.
* tracepoint.c: Don't check HAVE_UNISTD_H before including
<unistd.h>.
gdb/gdbserver/
2013-07-01 Pedro Alves <palves@redhat.com>
* event-loop.c: Don't check HAVE_UNISTD_H before including
<unistd.h>.
* gdbreplay.c: Likewise.
* remote-utils.c: Likewise.
* server.c: Likewise.
* configure.ac: Don't check for unistd.h.
* configure: Regenerate.
When directly invoking gdb/gdbserver/configure && make, the build will
fail because the $(host_alias) is empty and thus create-version.sh does
not get enough parameters.
The output of gdbserver --version without this patch (built like above):
[...]
This gdbserver was configured as ""
After applying this patch:
[...]
This gdbserver was configured as "x86_64-unknown-linux-gnu"
2013-06-28 Mircea Gherzan <mircea.gherzan@intel.com>
gdbserver:
* configure.ac (version_host, version_target): Set and AC_SUBST
them.
* configure: Rebuild.
* Makefile.in (version_host, version_target): Get from
configure.
(version.c): Use $(version_host) and $(version_target).
Change-Id: Id48240532ad3d624ec78867a6db5ebd4c09583ff
Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
We define the following packets:
Qbtrace:bts enable branch tracing for the current thread
returns "OK" or "Enn"
Qbtrace:off disable branch tracing for the current thread
returns "OK" or "Enn"
qXfer:btrace:read read the full branch trace data for the current thread
gdb/
* target.h (enum target_object): Add TARGET_OBJECT_BTRACE.
* remote.c: Include btrace.h.
(struct btrace_target_info): New struct.
(remote_supports_btrace): New function.
(send_Qbtrace): New function.
(remote_enable_btrace): New function.
(remote_disable_btrace): New function.
(remote_teardown_btrace): New function.
(remote_read_btrace): New function.
(init_remote_ops): Add btrace ops.
(enum <unnamed>): Add btrace packets.
(struct protocol_feature remote_protocol_features[]): Add btrace packets.
(_initialize_remote): Add packet configuration for branch tracing.
gdbserver/
* target.h (struct target_ops): Add btrace ops.
(target_supports_btrace): New macro.
(target_enable_btrace): New macro.
(target_disable_btrace): New macro.
(target_read_btrace): New macro.
* gdbthread.h (struct thread_info): Add btrace field.
* server.c: Include btrace-common.h.
(handle_btrace_general_set): New function.
(handle_btrace_enable): New function.
(handle_btrace_disable): New function.
(handle_general_set): Call handle_btrace_general_set.
(handle_qxfer_btrace): New function.
(struct qxfer qxfer_packets[]): Add btrace entry.
* inferiors.c (remove_thread): Disable btrace.
* linux-low: Include linux-btrace.h.
(linux_low_enable_btrace): New function.
(linux_low_read_btrace): New function.
(linux_target_ops): Add btrace ops.
* configure.srv (i[34567]86-*-linux*): Add linux-btrace.o.
Add srv_linux_btrace=yes.
(x86_64-*-linux*): Add linux-btrace.o.
Add srv_linux_btrace=yes.
* configure.ac: Define HAVE_LINUX_BTRACE.
* config.in: Regenerated.
* configure: Regenerated.