Building gdb with --host=i586-pc-msdosdjgpp ends up with:
i586-pc-msdosdjgpp-gcc -g -O2 -I../../src/gdb/config/djgpp -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I./../intl -I../../src/gdb/gnulib/import -Ibuild-gnulib/import -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Werror -c -o filestuff.o -MT filestuff.o -MMD -MP -MF .deps/filestuff.Tpo ../../src/gdb/common/filestuff.c
../../src/gdb/common/filestuff.c:38:24: fatal error: sys/socket.h: No such file or directory
There are no sockets on djgpp. This #ifdef's out the bits in the file
that use sockets, depending on whether winsock or sys/socket.h is
available.
As alternative approach, given ser-tcp.c, ser-pipe.c, etc. are split
into separate files, and which to use is selected by configure.ac:
dnl Figure out which of the many generic ser-*.c files the _host_ supports.
SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
case ${host} in
*go32* ) SER_HARDWIRE=ser-go32.o ;;
*djgpp* ) SER_HARDWIRE=ser-go32.o ;;
*mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
esac
AC_SUBST(SER_HARDWIRE)
... I considered splitting filestuff.c similarly. But I quickly gave
up on the idea, as it looked like a lot more complication over this
approach, for no real gain. Plus, there are uses of these functions
outside the ser*.c framework.
gdbserver's configure.ac is already checking for sys/socket.h.
gdb/
2013-05-23 Pedro Alves <palves@redhat.com>
* common/filestuff.c [USE_WIN32API]: Define HAVE_SOCKETS.
[HAVE_SYS_SOCKET_H]: Define HAVE_SOCKETS.
(socket_mark_cloexec, gdb_socketpair_cloexec, gdb_socket_cloexec):
Only define if HAVE_SOCKETS is defined.
* configure.ac: Check for sys/socket.h.
* config.in, configure: Regenerate.
Tom Tromey <tromey@redhat.com>
* common/filestuff.c (mark_fd_no_cloexec, unmark_fd_no_cloexec):
New functions.
* common/filestuff.c (mark_fd_no_cloexec, unmark_fd_no_cloexec):
Declare.
* darwin-nat.c (darwin_pre_ptrace): Use mark_fd_no_cloexec.
(darwin_ptrace_him): Use unmark_fd_no_cloexec.
* inf-ttrace.c (do_cleanup_pfds): Use unmark_fd_no_cloexec.
(inf_ttrace_prepare): Use mark_fd_no_cloexec.
Similarly to the remote code, agent commands are mostly ascii. Cast to
gdb_byte when treating the command buffer as raw memory bytes.
2013-04-19 Pedro Alves <palves@redhat.com>
* common/agent.c (agent_run_command): Add cast to gdb_byte *.
Attempting to build gdbserver with our copy of thread_db.h yields:
In file included from ../../../src/gdb/gdbserver/../common/gdb_thread_db.h:4:0,
from ../../../src/gdb/gdbserver/thread-db.c:30:
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:108:3: error: unknown type name ‘uint32_t’
In file included from ../../../src/gdb/gdbserver/../common/gdb_thread_db.h:4:0,
from ../../../src/gdb/gdbserver/thread-db.c:30:
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:199:5: error: unknown type name ‘uintptr_t’
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:269:3: error: unknown type name ‘intptr_t’
../../../src/gdb/gdbserver/../common/glibc_thread_db.h:270:3: error: unknown type name ‘intptr_t’
We used to have a workaround for this, but the patch to import
gnulib's stdint.h removed it:
http://www.sourceware.org/ml/gdb-patches/2008-06/msg00050.html
and defs.h made to always include stdint.h. However, gdbserver
doesn't include stdint.h in its equivalent server.h.
Rather than working around the issue, I've imported a more recent
version from glibc, which itself includes <stdint.h>. Other than
copyright years and FSF snail mail address, the file hasn't been
touched since 2003 in glibc. AFAICS, our version was updated last in
2000-09-03.
A note on the apparent license change: before the previous patch, this
file's contents were part of gdb_thread_db.h, and we can see that its
license's text was changed in this patch
<http://sourceware.org/ml/gdb-patches/2009-03/msg00251.html>. That
was certainly just an easy to overlook grep/sed mistake that fell
through the cracks.
gdb/common/
2013-04-16 Pedro Alves <palves@redhat.com>
* glibc_thread_db.h: Update from upstream glibc
(git 568035b7874a099087b77f7bba3e36a1173787b0).
Having this on a separate file makes it easier to import a new version
-- one can just copy over instead of having to care about preserving
the GDB-specific bits.
2013-04-16 Pedro Alves <palves@redhat.com>
* common/gdb_thread_db.h [!HAVE_THREAD_DB_H]: Factor out to ...
* common/glibc_thread_db.h: ... this new file ...
* common/gdb_thread_db.h [!HAVE_THREAD_DB_H]: ... and include it.
This patch:
http://sourceware.org/ml/gdb-patches/2009-04/msg00115.html
Changed behaviour by only defining LIBTHREAD_DB_SO if thread_db.h exists. The
definition of LIBTHREAD_DB_SO and LIBTHREAD_DB_SEARCH_PATH should be moved
outside of #ifdef HAVE_THREAD_DB_H.
This is based on a patch attached to the PR, however, it needed a
tweak, as it was it broke the HAVE_THREAD_DB_H path.
2013-04-16 Will Newton <will.newton@gmail.com>
Pedro Alves <palves@redhat.com>
PR build/11881
* common/gdb_thread_db.h (LIBTHREAD_DB_SO)
(LIBTHREAD_DB_SEARCH_PATH): Move outside of #ifdef
HAVE_THREAD_DB_H.
pointer to expression string to parse_exp_1.
(create_excep_cond_exprs): Likewise.
* ax-gdb.c (agent_eval_command_one): Likewise.
(maint_agent_printf_command): Likewise.
Constify much of the string handling/parsing.
* breakpoint.c (set_breakpoint_condition): Pass const
pointer to expression string to parse_exp_1.
(update_watchpoint): Likewise.
(parse_cmd_to_aexpr): Constify string handling.
Pass const pointer to parse_exp_1.
(init_breakpoint_sal): Pass const pointer to parse_exp_1.
(find_condition_and_thread): Likewise.
Make TOK const.
(watch_command_1): Make "arg" const.
Constify string handling.
Copy the expression string instead of changing the input
string.
(update_breakpoint_location): Pass const pointer to
parse_exp_1.
* eval.c (parse_and_eval_address): Make "exp" const.
(parse_to_comma_and_eval): Make "expp" const.
(parse_and_eval): Make "exp" const.
* expression.h (parse_expression): Make argument const.
(parse_exp_1): Make first argument const.
* findcmd.c (parse_find_args): Treat "args" as const.
* linespec.c (parse_linespec): Pass const pointer to
linespec_expression_to_pc.
(linespec_expression_to_pc): Make "exp_ptr" const.
* parse.c (parse_exp_1): Make "stringptr" const.
Make a copy of the expression to pass to parse_exp_in_context until
this whole interface can be constified.
(parse_expression): Make "string" const.
* printcmd.c (ui_printf): Treat "arg" as const.
Handle const strings.
* tracepoint.c (validate_actionline): Pass const pointer to
all calls to parse_exp_1.
(encode_actions_1): Likewise.
* value.h (parse_to_comma_and_eval): Make argument const.
(parse_and_eval_address): Likewise.
(parse_and_eval): Likewise.
* varobj.c (varobj_create): Pass const pointer to parse_exp_1.
(varobj_set_value): Likewise.
* cli/cli-cmds.c (disassemble_command): Treat "arg" as const and
constify string handling.
Pass const pointers to parse_and_eval_address and
parse_to_comman_and_eval.
* cli/cli-utils.c (skip_to_space): Rename to ...
(skip_to_space_const): ... this. Handle const strings.
* cli/cli-utils.h (skip_to_space): Turn into macro which invokes
skip_to_space_const.
(skip_to_space_const): Declare.
* common/format.c (parse_format_string): Make "arg" const.
Handle const strings.
* common/format.h (parse_format_string): Make "arg" const.
* gdbserver/ax.c (ax_printf): Make "format" const.
* python/python.c (gdbpy_parse_and_eval): Do not make a copy
of the expression string.
EIST transition, T-states, C1E, or Adaptive Thermal Throttling (AAJ122).
This results in sporadic test fails. Disable btrace on those processors.
gdb/
* common/linux-btrace.c: Include sys/ptrace, sys/types, sys/wait.h,
and signal.h.
(linux_supports_btrace): Add kernel and
cpuid check.
(kernel_supports_btrace): New function.
(cpu_supports_btrace): New function.
(intel_supports_btrace): New function.
* common/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Call also kill
for CHILD, ignore PTRACE_KILL errors, move the inner block variable
kill_status to outer block.
The "you have broken" bit of this text reads to me as if I had broken
it myself somehow. This patch eliminates that ambiguity.
2013-02-25 Pedro Alves <palves@redhat.com>
* common/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Change
warning text.
This makes gdbserver share gdb's savestring, instead of baking its own.
Tested on x86_64 Fedora 17.
gdb/
2013-02-14 Pedro Alves <palves@redhat.com>
* utils.c (savestring): Don't #undef it. Move function to
common/common-utils.c.
* common/common-utils.c: Include gdb_string.h.
(savestring): Move here from utils.c.
* common/common-utils.h (savestring): Declare.
gdb/gdbserver/
2013-02-14 Pedro Alves <palves@redhat.com>
* tracepoint.c (save_string): Delete.
(add_tracepoint_action): Use savestring instead of save_string.
We need to cast the pointer up to 64bits so that the push works on x32
targets. For 64bit targets, this makes no difference.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
2012-11-26 Maxime Villard <rustyBSD@gmx.fr>
Pedro Alves <palves@redhat.com>
* common/linux-osdata.c (linux_xfer_osdata_fds): Decrease buffer
size parameter passed to readlink by one byte.
* fbsd-nat.c (fbsd_pid_to_exec_file): Ditto.
* linux-nat.c (linux_child_pid_to_exec_file): Ditto.
* nbsd-nat.c (nbsd_pid_to_exec_file): Ditto.
* inf-child.c (inf_child_fileio_readlink): Decrease local buffer's
size by one byte.
gdb/gdbserver/
2012-11-26 Maxime Villard <rustyBSD@gmx.fr>
* hostio.c (handle_readlink): Decrease buffer size
parameter passed to readlink by one byte.
ARI fixes: move gdb_wait and gdb_stat headers to common subdirectory.
* gdb_stat.h: Delete. Moved to common directory.
* common/gdb_stat.h: New file.
* gdb_wait.h: Delete. Moved to common directory.
* common/gdb_wait.h: New file.
* Makefile.in (H_FILES_NO_SRC): Adapt to new header
location.
* contrib/ari/gdb_ari.sh (wait.h rule): Adapt to new gdb_wait.h
location.
(stat.h rule): Adapt to new gdb_stat.h location.
* common/linux-osdata.c: Include "gdb_stat.h" header instead of
<sys/stat.h> header.
* common/linux-ptrace.c: Include "gdb_wait.h" header instead of
<sys/wait.h> header.
gdbserver ChangeLog entry:
2012-11-15 Pierre Muller <muller@sourceware.org>
* configure.ac (AC_CHECK_HEADERS): Add wait.h header.
* config.in: Regenerate.
* configure: Regenerate.
* linux-low.c: Use "gdb_stat.h" header instead of <sys/stat.h> header.
Use "gdb_wait.h" header instead of <sys/wait.h> header.
* lynx-low.c: Use "gdb_wait.h" header instead of <sys/wait.h> header.
* remote-utils.c: Use "gdb_stat.h" header instead of <sys/stat.h>
header.
* server.c: Remove HAVE_WAIT_H conditional. Use "gdb_wait.h" header
instead of <sys/wait.h> header.
* spu-low.c: Use "gdb_wait.h" header instead of <sys/wait.h> header.
* common/linux-ptrace.c: Change __i386__ to __i386__ || __x86_64__.
(linux_ptrace_test_ret_to_nx): Extend comment for x86_64. Change
__i386__ to __i386__ || __x86_64__. Extend code also for __x86_64__.
Extend code also for PaX support. Convert all gdb_assert to warning
calls.
The command line completion has spoiled me. Thus the lack of completion with
the "handle" command annoys me. Patch!
This does a few things:
- adds a VEC_merge helper
- adds a generic signal completer
- adds a completion handler for the "handle" command
- sets the completion handler for the "signal" command
URL: http://sourceware.org/bugzilla/show_bug.cgi?id=10436
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* common/gdb_string.h: ... here.
* common/vec.h: Remove #ifndef GDBSERVER conditional inclusion of
gdb_string.h and gdb_assert.h.
gdbserver/
* configure.ac: Add check for strstr.
* config.in: Regenerate.
* configure: Regenerate.
* linux-thread-db.c: #include "gdb_vecs.h".
(try_thread_db_load_from_pdir_1): New arg "subdir". All callers
updated.
(try_thread_db_load_from_pdir): New arg "subdir". All callers updated.
(thread_db_load_search): Use a vector to iterate over path elements.
Handle text appearing after "$pdir".
gdbserver/
* Makefile.in (SFILES): Add gdb_vecs.c.
(OBS): Add gdb_vecs.o.
(gdb_vecs_h, host_defs_h): New variables.
(thread-db.o): Add $(gdb_vecs_h) dependency.
(gdb_vecs.o): New rule.
* thread-db.c: #include "gdb_vecs.h".
(thread_db_load_search): Use a vector to iterate over path elements.
Handle text appearing after "$pdir".
* common/gdb_vecs.c: New file, contents from utils.c.
* common/host-defs.h: New file, contents from defs.h.
* utils.h: New file, contents from defs.h.
* defs.h: Move all declarations of objects defined in utils.c
to utils.h (except QUIT() and related).
#include "utils.h", "host-defs.h".
* probe.h (probe_p): Move here from gdb_vecs.h.
* symfile.c: #include "probe.h" instead of "gdb_vecs.h".
* utils.c (free_char_ptr_vec): Moved to common/gdb_vecs.c.
(dirnames_to_char_ptr_vec_append, dirnames_to_char_ptr_vec): Ditto.
* Makefile.in (SFILES): Add common/gdb_vecs.c.
(HFILES_NO_SRCDIR): Add common/gdb_vecs.h, common/host-defs.h, utils.h.
(COMMON_OBS): Add gdb_vecs.o.
(gdb_vecs.o): New rule.
from non-MI uses.
* common/linux-osdata.c (struct osdata_type): Add title field.
(osdata_table): Add titles to each entry.
(linux_command_xfer_osdata): Add a column for title data.
* gdb.texinfo (Miscellaneous GDB/MI Commands): Update -info-os
example, add note about title column.
Kwok Cheung Yeung <kcy@codesourcery.com>
* NEWS: Describe new info os commands.
* common/linux-osdata.c (PID_T, TIME_T): Define.
(MAX_PID_T_STRLEN): New.
(linux_common_core_of_thread): Add comment. Change to use PID_T and
MAX_PID_T_STRLEN.
(command_from_pid): Add comment. Change to use PID_T.
(commandline_from_pid): Change to use PID_T.
(user_from_pid): Add comment.
(get_process_owner): Add comment. Change to use PID_T and
MAX_PID_T_STRLEN.
(get_number_of_cpu_cores): Add comment.
(get_cores_used_by_process): Add comment. Change to use PID_T and
MAX_PID_T_STRLEN.
(linux_xfer_osdata_processes): Change to use PID_T and
MAX_PID_T_STRLEN.
(compare_processes): New function.
(linux_xfer_osdata_processgroups): New function.
(linux_xfer_osdata_threads): Change to use PID_T.
(linux_xfer_osdata_fds): New function.
(format_socket_state, print_sockets): New functions.
(union socket_addr): New union.
(linux_xfer_osdata_isockets): New function.
(time_from_time_t, group_from_gid): New functions.
(linux_xfer_osdata_shm): New function.
(linux_xfer_osdata_sem): New function.
(linux_xfer_osdata_msg): New function.
(linux_xfer_osdata_modules): New function.
(osdata_table): Add new entries.
* common/buffer.c (buffer_xml_printf): Add support for long and
long long format specifiers.
* gdb.texinfo (Operating System Auxiliary Information): Document new
'info os' subcommands.
* gdb.base/info-os.exp: New file.
* gdb.base/info-os.c: New file.
* common/linux-procfs.c (linux_proc_get_int): New, from
linux_proc_get_tgid, change its LWPID type to pid_t, add parameter
field.
(linux_proc_get_tgid): Only call linux_proc_get_int.
(linux_proc_get_tracerpid): New.
(linux_proc_pid_has_state): New, from linux_proc_pid_is_zombie.
(linux_proc_pid_is_stopped, linux_proc_pid_is_zombie): Only call
linux_proc_pid_has_state.
* common/linux-procfs.h (linux_proc_get_tracerpid): New declaration.
* common/linux-ptrace.c: Include linux-procfs.h and buffer.h.
(linux_ptrace_attach_warnings): New.
* common/linux-ptrace.h (struct buffer, linux_ptrace_attach_warnings):
New declaration.
* linux-nat.c: Include exceptions.h, linux-ptrace.h and buffer.h.
(linux_nat_attach): New variables ex, buffer, message and message_s.
Wrap to_attach by TRY_CATCH and call linux_ptrace_attach_warnings.
gdb/gdbserver/
* linux-low.c (linux_attach_lwp_1): New variable buffer. Call
linux_ptrace_attach_warnings.
gdb/testsuite/
* gdb.base/attach-twice.c: New files.
* gdb.base/attach-twice.exp: New files.