Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: gdb/gdbserver/target.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/gdbserver/target.h ('k') | gdb/gdbserver/tdesc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/gdbserver/target.c
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 753947647c34dae6acc0bd493cd680b74b300fd0..d4a2a98721a9bfa2ee2cc092c66d3fe32ea21e52 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -1,6 +1,5 @@
/* Target operations for the remote server for GDB.
- Copyright (C) 2002, 2004-2005, 2007-2012 Free Software Foundation,
- Inc.
+ Copyright (C) 2002-2013 Free Software Foundation, Inc.
Contributed by MontaVista Software.
@@ -20,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+#include "tracepoint.h"
struct target_ops *the_target;
@@ -82,13 +82,22 @@ mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options,
ret = (*the_target->wait) (ptid, ourstatus, options);
- if (ourstatus->kind == TARGET_WAITKIND_EXITED)
- fprintf (stderr,
- "\nChild exited with status %d\n", ourstatus->value.integer);
- else if (ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
- fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
- gdb_signal_to_host (ourstatus->value.sig),
- gdb_signal_to_name (ourstatus->value.sig));
+ /* If GDB is connected through TCP/serial, then GDBserver will most
+ probably be running on its own terminal/console, so it's nice to
+ print there why is GDBserver exiting. If however, GDB is
+ connected through stdio, then there's no need to spam the GDB
+ console with this -- the user will already see the exit through
+ regular GDB output, in that same terminal. */
+ if (!remote_connection_is_stdio ())
+ {
+ if (ourstatus->kind == TARGET_WAITKIND_EXITED)
+ fprintf (stderr,
+ "\nChild exited with status %d\n", ourstatus->value.integer);
+ else if (ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
+ fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
+ gdb_signal_to_host (ourstatus->value.sig),
+ gdb_signal_to_name (ourstatus->value.sig));
+ }
if (connected_wait)
server_waiting = 0;
@@ -141,44 +150,10 @@ target_pid_to_str (ptid_t ptid)
return buf;
}
-/* Return a pretty printed form of target_waitstatus. */
-
-const char *
-target_waitstatus_to_string (const struct target_waitstatus *ws)
+int
+kill_inferior (int pid)
{
- static char buf[200];
- const char *kind_str = "status->kind = ";
+ gdb_agent_about_to_close (pid);
- switch (ws->kind)
- {
- case TARGET_WAITKIND_EXITED:
- sprintf (buf, "%sexited, status = %d",
- kind_str, ws->value.integer);
- break;
- case TARGET_WAITKIND_STOPPED:
- sprintf (buf, "%sstopped, signal = %s",
- kind_str, gdb_signal_to_name (ws->value.sig));
- break;
- case TARGET_WAITKIND_SIGNALLED:
- sprintf (buf, "%ssignalled, signal = %s",
- kind_str, gdb_signal_to_name (ws->value.sig));
- break;
- case TARGET_WAITKIND_LOADED:
- sprintf (buf, "%sloaded", kind_str);
- break;
- case TARGET_WAITKIND_EXECD:
- sprintf (buf, "%sexecd", kind_str);
- break;
- case TARGET_WAITKIND_SPURIOUS:
- sprintf (buf, "%sspurious", kind_str);
- break;
- case TARGET_WAITKIND_IGNORE:
- sprintf (buf, "%signore", kind_str);
- break;
- default:
- sprintf (buf, "%sunknown???", kind_str);
- break;
- }
-
- return buf;
+ return (*the_target->kill) (pid);
}
« no previous file with comments | « gdb/gdbserver/target.h ('k') | gdb/gdbserver/tdesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698