home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / gdb / config / nm-m3.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-04  |  3.4 KB  |  121 lines

  1. /* Mach 3.0 common definitions and global vars.
  2.  
  3.    Copyright (C) 1992 Free Software Foundation, Inc.
  4.  
  5. This file is part of GDB.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef NM_M3_H
  22. #define NM_M3_H
  23.  
  24. #include <mach.h>
  25.  
  26. /* Mach3 doesn't declare errno in <errno.h>.  */
  27. extern int errno;
  28.  
  29. /* Task port of our debugged inferior. */
  30.  
  31. extern task_t inferior_task;
  32.  
  33. /* Thread port of the current thread in the inferior. */
  34.  
  35. extern thread_t current_thread;
  36.  
  37. /* If nonzero, we must suspend/abort && resume threads
  38.  * when setting or getting the state.
  39.  */
  40. extern int must_suspend_thread;
  41.  
  42. #define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it)
  43.  
  44. /* Try to get the privileged host port for authentication to machid
  45.  *
  46.  * If you can get this, you may debug anything on this host.
  47.  *
  48.  * If you can't, gdb gives it's own task port as the
  49.  * authentication port
  50.  */
  51. #define  mach_privileged_host_port() task_by_pid(-1)
  52.  
  53. /*
  54.  * This is the MIG ID number of the emulator/server bsd_execve() RPC call.
  55.  *
  56.  * It SHOULD never change, but if it does, gdb `run'
  57.  * command won't work until you fix this define.
  58.  * 
  59.  */
  60. #define MIG_EXEC_SYSCALL_ID        101000
  61.  
  62. /* If our_message_port gets a msg with this ID,
  63.  * GDB suspends it's inferior and enters command level.
  64.  * (Useful at least if ^C does not work)
  65.  */
  66. #define GDB_MESSAGE_ID_STOP            0x41151
  67.  
  68. /* wait3 WNOHANG is defined in <sys/wait.h> but
  69.  * for some reason gdb does not want to include
  70.  * that file.
  71.  *
  72.  * If your system defines WNOHANG differently, this has to be changed.
  73.  */
  74. #define WNOHANG 1
  75.  
  76. /* Before storing, we need to read all the registers.  */
  77.  
  78. #define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES)
  79.  
  80. /* Check if the inferior exists */
  81. #define MACH_ERROR_NO_INFERIOR \
  82.   do if (!MACH_PORT_VALID (inferior_task)) \
  83.       error ("Inferior task does not exist."); while(0)
  84.  
  85. /* Error handler for mach calls */
  86. #define CHK(str,ret)    \
  87.   do if (ret != KERN_SUCCESS) \
  88.        error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \
  89.           mach_error_string(ret)); while(0)
  90.  
  91. /* This is from POE9 emulator/emul_stack.h
  92.  */
  93. /*
  94.  * Top of emulator stack holds link and reply port.
  95.  */
  96. struct emul_stack_top {
  97.     struct emul_stack_top    *link;
  98.     mach_port_t        reply_port;
  99. };
  100.  
  101. #define EMULATOR_STACK_SIZE (4096*4)
  102.  
  103. #define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid)
  104.  
  105. #define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg)
  106.  
  107. #define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid)
  108.  
  109. #define ATTACH_TO_THREAD attach_to_thread
  110.  
  111. /* Do Mach 3 dependent operations when ^C or a STOP is requested */
  112. #define DO_QUIT() mach3_quit ()
  113.  
  114. #if 0
  115. /* This is bogus.  It is NOT OK to quit out of target_wait.  */
  116. /* If in mach_msg() and ^C is typed set immediate_quit */
  117. #define REQUEST_QUIT() mach3_request_quit ()
  118. #endif
  119.  
  120. #endif /* NM_M3_H */
  121.