From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30230 invoked by alias); 7 Jan 2009 23:23:42 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 30160 invoked by uid 9674); 7 Jan 2009 23:23:41 -0000 Date: Wed, 07 Jan 2009 23:23:00 -0000 Message-ID: <20090107232341.30145.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-type-refcount: Merge commit 'origin/master' into archer-jankratochvil-type-refcount X-Git-Refname: refs/heads/archer-jankratochvil-type-refcount X-Git-Reftype: branch X-Git-Oldrev: 874e2c44163b54be7e44f16797a9b7725908efa6 X-Git-Newrev: 36c59ca86e4ed5765b3fef856ca5269084e0c20e X-SW-Source: 2009-q1/txt/msg00012.txt.bz2 List-Id: The branch, archer-jankratochvil-type-refcount has been updated via 36c59ca86e4ed5765b3fef856ca5269084e0c20e (commit) via 26af839fdd5cd7143867acff0012473537ecc667 (commit) via 3bdc07d2a6f44070a5ef57b305a2e4c816b0a820 (commit) via 0bd695e5a4e79c240a67ea794cb83a7324584a8d (commit) via d8e475b5ea302f7de5665e5bb54112f53d95bc75 (commit) via 60a61846f7a1d6129b24be2f9e6b38d3311a47b9 (commit) via 64f8419f28ea32be7ea4a8e99de688395995a0dd (commit) via 410508e4968402499d97466db958ceca88670e71 (commit) via 8b2893e01420fef3503f6245618a2c00675a6bc3 (commit) via 52490b0fd88bbeab9705526edae4ba9490b35e58 (commit) via 9ace673c7b26ef35fabe462a4d92a01383d7cfa0 (commit) via 529823bb9b73f202c72324e975016d3a2fc559ce (commit) via 40bd160e942a5a85f46b9e5cdc20e8e7e70b9ffe (commit) via 56266baf7d36c96b16217eab3a797a3fd73646c1 (commit) via 55a1b5a021b9a566f2dea68563c8b6c772155f20 (commit) from 874e2c44163b54be7e44f16797a9b7725908efa6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 36c59ca86e4ed5765b3fef856ca5269084e0c20e Merge: 874e2c44163b54be7e44f16797a9b7725908efa6 26af839fdd5cd7143867acff0012473537ecc667 Author: Jan Kratochvil Date: Thu Jan 8 00:22:27 2009 +0100 Merge commit 'origin/master' into archer-jankratochvil-type-refcount ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 4 + bfd/config.bfd | 2 +- bfd/version.h | 2 +- gdb/ChangeLog | 33 + gdb/NEWS | 8 + gdb/cli/cli-cmds.c | 4 +- gdb/doc/ChangeLog | 6 + gdb/doc/gdb.texinfo | 30 + gdb/gdbserver/ChangeLog | 10 + gdb/gdbserver/gdbreplay.c | 2 +- gdb/gdbserver/linux-low.c | 37 +- gdb/gdbserver/server.c | 2 +- gdb/inflow.c | 26 +- gdb/linux-nat.c | 6 +- gdb/main.c | 12 +- gdb/mi/mi-cmd-env.c | 5 +- gdb/ser-tcp.c | 244 +++++-- gdb/top.c | 3 - gdb/ui-file.c | 8 +- gdb/utils.c | 14 +- gdb/version.in | 2 +- opcodes/ChangeLog | 1231 ++--------------------------- opcodes/{ChangeLog => ChangeLog-2008} | 5 - opcodes/i386-dis.c | 848 +++++++------------- opcodes/i386-gen.c | 6 +- opcodes/i386-init.h | 3 +- opcodes/i386-opc.h | 7 +- opcodes/i386-opc.tbl | 197 +++--- opcodes/i386-tbl.h | 1423 +++++++++++++-------------------- sim/m32c/ChangeLog | 4 + sim/m32c/m32c.opc | 4 +- sim/m32c/r8c.opc | 4 +- 32 files changed, 1421 insertions(+), 2771 deletions(-) copy opcodes/{ChangeLog => ChangeLog-2008} (99%) First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4e2726d..c114076 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2009-01-05 Joel Sherrill + + * config.bfd: Add lm32-*-rtems*. + 2009-01-03 H.J. Lu * coff-ppc.c: Add 2009 to Copyright. diff --git a/bfd/config.bfd b/bfd/config.bfd index 452f25d..e3d2b86 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -728,7 +728,7 @@ case "${targ}" in targ_defvec=bfd_elf32_iq2000_vec ;; - lm32-*-elf) + lm32-*-elf | lm32-*-rtems*) targ_defvec=bfd_elf32_lm32_vec targ_selvecs=bfd_elf32_lm32fdpic_vec ;; diff --git a/bfd/version.h b/bfd/version.h index 26c4d87..65dbb42 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20090105 +#define BFD_VERSION_DATE 20090106 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b959e9a..8c93b4a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,36 @@ +2009-01-06 Jim Blandy + + Check return values of functions declared with warn_unused_result + attribute in GLIBC 2.8. + * cli/cli-cmds.c (pwd_command): Check return value from getcwd. + * inflow.c (check_syscall): New function. + (new_tty): Use check_syscall to check return values from open and dup. + * linux-nat.c (linux_nat_info_proc_cmd): Check return value from fgets. + * main.c (captured_main): Call cwd after setting up gdb_stderr; + check for errors from getcwd. + * mi/mi-cmd-env.c (mi_cmd_env_pwd): Check return value from getcwd. + * ui-file.c (stdio_file_write): Ignore return value from fwrite. + (stdio_file_fputs): Same. + * utils.c (internal_vproblem): abort if last-ditch error message + write fails. + + * top.c (gdb_init): Don't set the current directory here; that's + already been done in captured_main. + +2009-01-06 Sandra Loosemore + + * ser-tcp.c: Adjust includes. + (tcp_set_cmdlist, tcp_show_cmdlist): Declare. + (tcp_auto_retry, tcp_retry_limit): Declare. + (TIMEOUT): Remove, in favor of tcp_retry_limit. + (POLL_INTERVAL): Increase to 5, in favor of backoff logic. + (wait_for_connect): New function. + (net_open): Use it. Add auto-retry logic. + (set_tcp_cmd, show_tcp_cmd): New functions. + (_initialize_ser_tcp): Initialize new "set/show tcp auto-retry" + and "set/show tcp connect-timeout" commands. + * NEWS: Document new commands. + 2009-01-05 Tom Tromey * python/python-internal.h (Py_ssize_t): Define as int. diff --git a/gdb/NEWS b/gdb/NEWS index 415a4be..4532f9e 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -169,6 +169,14 @@ set target-async with GDB while the target is running. "show target-async" displays the current state of asynchronous execution of the target. +set tcp auto-retry (on|off) +show tcp auto-retry +set tcp connect-timeout +show tcp connect-timeout + These commands allow GDB to retry failed TCP connections to a remote stub + with a specified timeout period; this is useful if the stub is launched + in parallel with GDB but may not be ready to accept connections immediately. + macro define macro list macro undef diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index de35e1a..b391e30 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -320,7 +320,9 @@ pwd_command (char *args, int from_tty) { if (args) error (_("The \"pwd\" command does not take an argument: %s"), args); - getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); + if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) + error (_("Error finding name of working directory: %s"), + safe_strerror (errno)); if (strcmp (gdb_dirbuf, current_directory) != 0) printf_unfiltered (_("Working directory %s\n (canonically %s).\n"), diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index b79252c..dfe9526 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2009-01-06 Sandra Loosemore + + * gdb.texinfo (Remote Configuration): Document new + "set/show tcp auto-retry" and "set/show tcp connect-timeout" + commands. + 2008-12-28 Pedro Alves * gdbint.texinfo (gdbarch_cannot_fetch_register): Don't mention diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 6ef124c..f6b7a1c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -14206,6 +14206,36 @@ Select the file used for @code{run} with @code{target extended-remote}. This should be set to a filename valid on the target system. If it is not set, the target will use a default filename (e.g.@: the last program run). + +@kindex set tcp +@kindex show tcp +@item set tcp auto-retry on +@cindex auto-retry, for remote TCP target +Enable auto-retry for remote TCP connections. This is useful if the remote +debugging agent is launched in parallel with @value{GDBN}; there is a race +condition because the agent may not become ready to accept the connection +before @value{GDBN} attempts to connect. When auto-retry is +enabled, if the initial attempt to connect fails, @value{GDBN} reattempts +to establish the connection using the timeout specified by +@code{set tcp connect-timeout}. + +@item set tcp auto-retry off +Do not auto-retry failed TCP connections. + +@item show tcp auto-retry +Show the current auto-retry setting. + +@item set tcp connect-timeout @var{seconds} +@cindex connection timeout, for remote TCP target +@cindex timeout, for remote target connection +Set the timeout for establishing a TCP connection to the remote target to +@var{seconds}. The timeout affects both polling to retry failed connections +(enabled by @code{set tcp auto-retry on}) and waiting for connections +that are merely slow to complete, and represents an approximate cumulative +value. + +@item show tcp connect-timeout +Show the current connection timeout setting. @end table @cindex remote packets, enabling and disabling diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 7c4d073..b745986 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,13 @@ +2009-01-06 Joel Brobecker + + * gdbreplay.c (gdbreplay_version): Update copyright year. + * server.c (gdbserver_version): Likewise. + +2009-01-05 Doug Evans + + * linux-low.c (linux_attach_lwp): Add some comments/fixmes. + (handle_extended_wait): Improve comment. + 2008-12-13 Doug Evans * utils.c (xmalloc,xcalloc,xstrdup): New fns. diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c index 9bb9e0d..aec45a5 100644 --- a/gdb/gdbserver/gdbreplay.c +++ b/gdb/gdbserver/gdbreplay.c @@ -395,7 +395,7 @@ static void gdbreplay_version (void) { printf ("GNU gdbreplay %s%s\n" - "Copyright (C) 2008 Free Software Foundation, Inc.\n" + "Copyright (C) 2009 Free Software Foundation, Inc.\n" "gdbreplay is free software, covered by the GNU General Public License.\n" "This gdbreplay was configured as \"%s\"\n", PKGVERSION, version, host_name); diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index c8b07eb..3fa06ec 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -180,7 +180,7 @@ handle_extended_wait (struct process_info *event_child, int wstat) /* Normally we will get the pending SIGSTOP. But in some cases we might get another signal delivered to the group first. - If we do, be sure not to lose it. */ + If we do get another signal, be sure not to lose it. */ if (WSTOPSIG (status) == SIGSTOP) { if (stopping_threads) @@ -326,6 +326,8 @@ linux_attach_lwp (unsigned long pid) strerror (errno), errno); } + /* FIXME: This intermittently fails. + We need to wait for SIGSTOP first. */ ptrace (PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACECLONE); new_process = (struct process_info *) add_process (pid); @@ -333,15 +335,36 @@ linux_attach_lwp (unsigned long pid) new_thread_notify (thread_id_to_gdb_id (new_process->lwpid)); /* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH - brings it to a halt. We should ignore that SIGSTOP and resume the process - (unless this is the first process, in which case the flag will be cleared - in linux_attach). + brings it to a halt. + + There are several cases to consider here: + + 1) gdbserver has already attached to the process and is being notified + of a new thread that is being created. + In this case we should ignore that SIGSTOP and resume the process. + This is handled below by setting stop_expected = 1. + + 2) This is the first thread (the process thread), and we're attaching + to it via attach_inferior. + In this case we want the process thread to stop. + This is handled by having linux_attach clear stop_expected after + we return. + ??? If the process already has several threads we leave the other + threads running. + + 3) GDB is connecting to gdbserver and is requesting an enumeration of all + existing threads. + In this case we want the thread to stop. + FIXME: This case is currently not properly handled. + We should wait for the SIGSTOP but don't. Things work apparently + because enough time passes between when we ptrace (ATTACH) and when + gdb makes the next ptrace call on the thread. On the other hand, if we are currently trying to stop all threads, we should treat the new thread as if we had sent it a SIGSTOP. This works - because we are guaranteed that add_process added us to the end of the - list, and so the new thread has not yet reached wait_for_sigstop (but - will). */ + because we are guaranteed that the add_process call above added us to the + end of the list, and so the new thread has not yet reached + wait_for_sigstop (but will). */ if (! stopping_threads) new_process->stop_expected = 1; } diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 6e13657..f2e9b05 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1255,7 +1255,7 @@ static void gdbserver_version (void) { printf ("GNU gdbserver %s%s\n" - "Copyright (C) 2007 Free Software Foundation, Inc.\n" + "Copyright (C) 2009 Free Software Foundation, Inc.\n" "gdbserver is free software, covered by the GNU General Public License.\n" "This gdbserver was configured as \"%s\"\n", PKGVERSION, version, host_name); diff --git a/gdb/inflow.c b/gdb/inflow.c index a7cb25f..972b52e 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -523,6 +523,20 @@ new_tty_prefork (const char *ttyname) inferior_thisrun_terminal = ttyname; } + +/* If RESULT, assumed to be the return value from a system call, is + negative, print the error message indicated by errno and exit. + MSG should identify the operation that failed. */ +static void +check_syscall (const char *msg, int result) +{ + if (result < 0) + { + print_sys_errmsg (msg, errno); + _exit (1); + } +} + void new_tty (void) { @@ -549,27 +563,23 @@ new_tty (void) /* Now open the specified new terminal. */ tty = open (inferior_thisrun_terminal, O_RDWR | O_NOCTTY); - if (tty == -1) - { - print_sys_errmsg (inferior_thisrun_terminal, errno); - _exit (1); - } + check_syscall (inferior_thisrun_terminal, tty); /* Avoid use of dup2; doesn't exist on all systems. */ if (tty != 0) { close (0); - dup (tty); + check_syscall ("dup'ing tty into fd 0", dup (tty)); } if (tty != 1) { close (1); - dup (tty); + check_syscall ("dup'ing tty into fd 1", dup (tty)); } if (tty != 2) { close (2); - dup (tty); + check_syscall ("dup'ing tty into fd 2", dup (tty)); } #ifdef TIOCSCTTY diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index dfa7ef2..9a7e39c 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -3684,8 +3684,10 @@ linux_nat_info_proc_cmd (char *args, int from_tty) if ((procfile = fopen (fname1, "r")) != NULL) { struct cleanup *cleanup = make_cleanup_fclose (procfile); - fgets (buffer, sizeof (buffer), procfile); - printf_filtered ("cmdline = '%s'\n", buffer); + if (fgets (buffer, sizeof (buffer), procfile)) + printf_filtered ("cmdline = '%s'\n", buffer); + else + warning (_("unable to read '%s'"), fname1); do_cleanups (cleanup); } else diff --git a/gdb/main.c b/gdb/main.c index ccd5e46..0eb9596 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -188,9 +188,6 @@ captured_main (void *data) line[0] = '\0'; /* Terminate saved (now empty) cmd line */ instream = stdin; - getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); - current_directory = gdb_dirbuf; - gdb_stdout = stdio_fileopen (stdout); gdb_stderr = stdio_fileopen (stderr); gdb_stdlog = gdb_stderr; /* for moment */ @@ -199,6 +196,15 @@ captured_main (void *data) gdb_stdtargerr = gdb_stderr; /* for moment */ gdb_stdtargin = gdb_stdin; /* for moment */ + if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) + /* Don't use *_filtered or warning() (which relies on + current_target) until after initialize_all_files(). */ + fprintf_unfiltered (gdb_stderr, + _("%s: warning: error finding working directory: %s\n"), + argv[0], safe_strerror (errno)); + + current_directory = gdb_dirbuf; + /* Set the sysroot path. */ #ifdef TARGET_SYSTEM_ROOT_RELOCATABLE gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT); diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index b40fac4..cbc9bdb 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -79,7 +79,10 @@ mi_cmd_env_pwd (char *command, char **argv, int argc) /* Otherwise the mi level is 2 or higher. */ - getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); + if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) + error (_("mi_cmd_env_pwd: error finding name of working directory: %s"), + safe_strerror (errno)); + ui_out_field_string (uiout, "cwd", gdb_dirbuf); } diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index e3cf970..7792133 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -22,6 +22,9 @@ #include "serial.h" #include "ser-base.h" #include "ser-tcp.h" +#include "gdbcmd.h" +#include "cli/cli-decode.h" +#include "cli/cli-setshow.h" #include @@ -49,6 +52,7 @@ #include #include "gdb_string.h" +#include "gdb_select.h" #ifndef HAVE_SOCKLEN_T typedef int socklen_t; @@ -56,10 +60,93 @@ typedef int socklen_t; void _initialize_ser_tcp (void); -/* seconds to wait for connect */ -#define TIMEOUT 15 +/* For "set tcp" and "show tcp". */ + +static struct cmd_list_element *tcp_set_cmdlist; +static struct cmd_list_element *tcp_show_cmdlist; + +/* Whether to auto-retry refused connections. */ + +static int tcp_auto_retry = 1; + +/* Timeout period for connections, in seconds. */ + +static int tcp_retry_limit = 15; + /* how many times per second to poll deprecated_ui_loop_hook */ -#define POLL_INTERVAL 2 + +#define POLL_INTERVAL 5 + +/* Helper function to wait a while. If SCB is non-null, wait on its + file descriptor. Otherwise just wait on a timeout, updating *POLLS. + Returns -1 on timeout or interrupt, otherwise the value of select. */ + +static int +wait_for_connect (struct serial *scb, int *polls) +{ + struct timeval t; + int n; + + /* While we wait for the connect to complete, + poll the UI so it can update or the user can + interrupt. */ + if (deprecated_ui_loop_hook && deprecated_ui_loop_hook (0)) + { + errno = EINTR; + return -1; + } + + /* Check for timeout. */ + if (*polls > tcp_retry_limit * POLL_INTERVAL) + { + errno = ETIMEDOUT; + return -1; + } + + /* Back off to polling once per second after the first POLL_INTERVAL + polls. */ + if (*polls < POLL_INTERVAL) + { + t.tv_sec = 0; + t.tv_usec = 1000000 / POLL_INTERVAL; + } + else + { + t.tv_sec = 1; + t.tv_usec = 0; + } + + if (scb) + { + fd_set rset, wset, eset; + FD_ZERO (&rset); + FD_SET (scb->fd, &rset); + wset = rset; + eset = rset; + + /* POSIX systems return connection success or failure by signalling + wset. Windows systems return success in wset and failure in + eset. + + We must call select here, rather than gdb_select, because + the serial structure has not yet been initialized - the + MinGW select wrapper will not know that this FD refers + to a socket. */ + n = select (scb->fd + 1, &rset, &wset, &eset, &t); + } + else + /* Use gdb_select here, since we have no file descriptors, and on + Windows, plain select doesn't work in that case. */ hooks/post-receive -- Repository for Project Archer.