gdb/target/waitstatus.c - gdb

Functions defined

Source code

  1. /* Target waitstatus implementations.

  2.    Copyright (C) 1990-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #include "common-defs.h"
  15. #include "waitstatus.h"

  16. /* Return a pretty printed form of target_waitstatus.
  17.    Space for the result is malloc'd, caller must free.  */

  18. char *
  19. target_waitstatus_to_string (const struct target_waitstatus *ws)
  20. {
  21.   const char *kind_str = "status->kind = ";

  22.   switch (ws->kind)
  23.     {
  24.     case TARGET_WAITKIND_EXITED:
  25.       return xstrprintf ("%sexited, status = %d",
  26.                          kind_str, ws->value.integer);
  27.     case TARGET_WAITKIND_STOPPED:
  28.       return xstrprintf ("%sstopped, signal = %s",
  29.                          kind_str,
  30.                          gdb_signal_to_symbol_string (ws->value.sig));
  31.     case TARGET_WAITKIND_SIGNALLED:
  32.       return xstrprintf ("%ssignalled, signal = %s",
  33.                          kind_str,
  34.                          gdb_signal_to_symbol_string (ws->value.sig));
  35.     case TARGET_WAITKIND_LOADED:
  36.       return xstrprintf ("%sloaded", kind_str);
  37.     case TARGET_WAITKIND_FORKED:
  38.       return xstrprintf ("%sforked", kind_str);
  39.     case TARGET_WAITKIND_VFORKED:
  40.       return xstrprintf ("%svforked", kind_str);
  41.     case TARGET_WAITKIND_EXECD:
  42.       return xstrprintf ("%sexecd", kind_str);
  43.     case TARGET_WAITKIND_VFORK_DONE:
  44.       return xstrprintf ("%svfork-done", kind_str);
  45.     case TARGET_WAITKIND_SYSCALL_ENTRY:
  46.       return xstrprintf ("%sentered syscall", kind_str);
  47.     case TARGET_WAITKIND_SYSCALL_RETURN:
  48.       return xstrprintf ("%sexited syscall", kind_str);
  49.     case TARGET_WAITKIND_SPURIOUS:
  50.       return xstrprintf ("%sspurious", kind_str);
  51.     case TARGET_WAITKIND_IGNORE:
  52.       return xstrprintf ("%signore", kind_str);
  53.     case TARGET_WAITKIND_NO_HISTORY:
  54.       return xstrprintf ("%sno-history", kind_str);
  55.     case TARGET_WAITKIND_NO_RESUMED:
  56.       return xstrprintf ("%sno-resumed", kind_str);
  57.     default:
  58.       return xstrprintf ("%sunknown???", kind_str);
  59.     }
  60. }