You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

257 lines
11KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Process Information (Debugging with GDB)</title>
  17. <meta name="description" content="Process Information (Debugging with GDB)">
  18. <meta name="keywords" content="Process Information (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Native.html#Native" rel="up" title="Native">
  26. <link href="DJGPP-Native.html#DJGPP-Native" rel="next" title="DJGPP Native">
  27. <link href="BSD-libkvm-Interface.html#BSD-libkvm-Interface" rel="prev" title="BSD libkvm Interface">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Process-Information"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="DJGPP-Native.html#DJGPP-Native" accesskey="n" rel="next">DJGPP Native</a>, Previous: <a href="BSD-libkvm-Interface.html#BSD-libkvm-Interface" accesskey="p" rel="prev">BSD libkvm Interface</a>, Up: <a href="Native.html#Native" accesskey="u" rel="up">Native</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Process-Information-1"></a>
  64. <h4 class="subsection">21.1.2 Process Information</h4>
  65. <a name="index-_002fproc"></a>
  66. <a name="index-examine-process-image"></a>
  67. <a name="index-process-info-via-_002fproc"></a>
  68. <p>Some operating systems provide interfaces to fetch additional
  69. information about running processes beyond memory and per-thread
  70. register state. If <small>GDB</small> is configured for an operating system
  71. with a supported interface, the command <code>info proc</code> is available
  72. to report information about the process running your program, or about
  73. any process running on your system.
  74. </p>
  75. <p>One supported interface is a facility called &lsquo;<samp>/proc</samp>&rsquo; that can be
  76. used to examine the image of a running process using file-system
  77. subroutines. This facility is supported on <small>GNU</small>/Linux and Solaris
  78. systems.
  79. </p>
  80. <p>On FreeBSD and NetBSD systems, system control nodes are used to query
  81. process information.
  82. </p>
  83. <p>In addition, some systems may provide additional process information
  84. in core files. Note that a core file may include a subset of the
  85. information available from a live process. Process information is
  86. currently available from cores created on <small>GNU</small>/Linux and FreeBSD
  87. systems.
  88. </p>
  89. <dl compact="compact">
  90. <dd><a name="index-info-proc"></a>
  91. <a name="index-process-ID"></a>
  92. </dd>
  93. <dt><code>info proc</code></dt>
  94. <dt><code>info proc <var>process-id</var></code></dt>
  95. <dd><p>Summarize available information about a process. If a
  96. process ID is specified by <var>process-id</var>, display information about
  97. that process; otherwise display information about the program being
  98. debugged. The summary includes the debugged process ID, the command
  99. line used to invoke it, its current working directory, and its
  100. executable file&rsquo;s absolute file name.
  101. </p>
  102. <p>On some systems, <var>process-id</var> can be of the form
  103. &lsquo;<samp>[<var>pid</var>]/<var>tid</var></samp>&rsquo; which specifies a certain thread ID
  104. within a process. If the optional <var>pid</var> part is missing, it means
  105. a thread from the process being debugged (the leading &lsquo;<samp>/</samp>&rsquo; still
  106. needs to be present, or else <small>GDB</small> will interpret the number as
  107. a process ID rather than a thread ID).
  108. </p>
  109. </dd>
  110. <dt><code>info proc cmdline</code></dt>
  111. <dd><a name="index-info-proc-cmdline"></a>
  112. <p>Show the original command line of the process. This command is
  113. supported on <small>GNU</small>/Linux, FreeBSD and NetBSD.
  114. </p>
  115. </dd>
  116. <dt><code>info proc cwd</code></dt>
  117. <dd><a name="index-info-proc-cwd"></a>
  118. <p>Show the current working directory of the process. This command is
  119. supported on <small>GNU</small>/Linux, FreeBSD and NetBSD.
  120. </p>
  121. </dd>
  122. <dt><code>info proc exe</code></dt>
  123. <dd><a name="index-info-proc-exe"></a>
  124. <p>Show the name of executable of the process. This command is supported
  125. on <small>GNU</small>/Linux, FreeBSD and NetBSD.
  126. </p>
  127. </dd>
  128. <dt><code>info proc files</code></dt>
  129. <dd><a name="index-info-proc-files"></a>
  130. <p>Show the file descriptors open by the process. For each open file
  131. descriptor, <small>GDB</small> shows its number, type (file, directory,
  132. character device, socket), file pointer offset, and the name of the
  133. resource open on the descriptor. The resource name can be a file name
  134. (for files, directories, and devices) or a protocol followed by socket
  135. address (for network connections). This command is supported on
  136. FreeBSD.
  137. </p>
  138. <p>This example shows the open file descriptors for a process using a
  139. tty for standard input and output as well as two network sockets:
  140. </p>
  141. <div class="smallexample">
  142. <pre class="smallexample">(gdb) info proc files 22136
  143. process 22136
  144. Open files:
  145. FD Type Offset Flags Name
  146. text file - r-------- /usr/bin/ssh
  147. ctty chr - rw------- /dev/pts/20
  148. cwd dir - r-------- /usr/home/john
  149. root dir - r-------- /
  150. 0 chr 0x32933a4 rw------- /dev/pts/20
  151. 1 chr 0x32933a4 rw------- /dev/pts/20
  152. 2 chr 0x32933a4 rw------- /dev/pts/20
  153. 3 socket 0x0 rw----n-- tcp4 10.0.1.2:53014 -&gt; 10.0.1.10:22
  154. 4 socket 0x0 rw------- unix stream:/tmp/ssh-FIt89oAzOn5f/agent.2456
  155. </pre></div>
  156. </dd>
  157. <dt><code>info proc mappings</code></dt>
  158. <dd><a name="index-memory-address-space-mappings"></a>
  159. <p>Report the memory address space ranges accessible in a process. On
  160. Solaris, FreeBSD and NetBSD systems, each memory range includes information
  161. on whether the process has read, write, or execute access rights to each
  162. range. On <small>GNU</small>/Linux, FreeBSD and NetBSD systems, each memory range
  163. includes the object file which is mapped to that range.
  164. </p>
  165. </dd>
  166. <dt><code>info proc stat</code></dt>
  167. <dt><code>info proc status</code></dt>
  168. <dd><a name="index-process-detailed-status-information"></a>
  169. <p>Show additional process-related information, including the user ID and
  170. group ID; virtual memory usage; the signals that are pending, blocked,
  171. and ignored; its TTY; its consumption of system and user time; its
  172. stack size; its &lsquo;<samp>nice</samp>&rsquo; value; etc. These commands are supported
  173. on <small>GNU</small>/Linux, FreeBSD and NetBSD.
  174. </p>
  175. <p>For <small>GNU</small>/Linux systems, see the &lsquo;<samp>proc</samp>&rsquo; man page for more
  176. information (type <kbd>man 5 proc</kbd> from your shell prompt).
  177. </p>
  178. <p>For FreeBSD and NetBSD systems, <code>info proc stat</code> is an alias for
  179. <code>info proc status</code>.
  180. </p>
  181. </dd>
  182. <dt><code>info proc all</code></dt>
  183. <dd><p>Show all the information about the process described under all of the
  184. above <code>info proc</code> subcommands.
  185. </p>
  186. </dd>
  187. <dt><code>set procfs-trace</code></dt>
  188. <dd><a name="index-set-procfs_002dtrace"></a>
  189. <a name="index-procfs-API-calls"></a>
  190. <p>This command enables and disables tracing of <code>procfs</code> API calls.
  191. </p>
  192. </dd>
  193. <dt><code>show procfs-trace</code></dt>
  194. <dd><a name="index-show-procfs_002dtrace"></a>
  195. <p>Show the current state of <code>procfs</code> API call tracing.
  196. </p>
  197. </dd>
  198. <dt><code>set procfs-file <var>file</var></code></dt>
  199. <dd><a name="index-set-procfs_002dfile"></a>
  200. <p>Tell <small>GDB</small> to write <code>procfs</code> API trace to the named
  201. <var>file</var>. <small>GDB</small> appends the trace info to the previous
  202. contents of the file. The default is to display the trace on the
  203. standard output.
  204. </p>
  205. </dd>
  206. <dt><code>show procfs-file</code></dt>
  207. <dd><a name="index-show-procfs_002dfile"></a>
  208. <p>Show the file to which <code>procfs</code> API trace is written.
  209. </p>
  210. </dd>
  211. <dt><code>proc-trace-entry</code></dt>
  212. <dt><code>proc-trace-exit</code></dt>
  213. <dt><code>proc-untrace-entry</code></dt>
  214. <dt><code>proc-untrace-exit</code></dt>
  215. <dd><a name="index-proc_002dtrace_002dentry"></a>
  216. <a name="index-proc_002dtrace_002dexit"></a>
  217. <a name="index-proc_002duntrace_002dentry"></a>
  218. <a name="index-proc_002duntrace_002dexit"></a>
  219. <p>These commands enable and disable tracing of entries into and exits
  220. from the <code>syscall</code> interface.
  221. </p>
  222. </dd>
  223. <dt><code>info pidlist</code></dt>
  224. <dd><a name="index-info-pidlist"></a>
  225. <a name="index-process-list_002c-QNX-Neutrino"></a>
  226. <p>For QNX Neutrino only, this command displays the list of all the
  227. processes and all the threads within each process.
  228. </p>
  229. </dd>
  230. <dt><code>info meminfo</code></dt>
  231. <dd><a name="index-info-meminfo"></a>
  232. <a name="index-mapinfo-list_002c-QNX-Neutrino"></a>
  233. <p>For QNX Neutrino only, this command displays the list of all mapinfos.
  234. </p></dd>
  235. </dl>
  236. <hr>
  237. <div class="header">
  238. <p>
  239. Next: <a href="DJGPP-Native.html#DJGPP-Native" accesskey="n" rel="next">DJGPP Native</a>, Previous: <a href="BSD-libkvm-Interface.html#BSD-libkvm-Interface" accesskey="p" rel="prev">BSD libkvm Interface</a>, Up: <a href="Native.html#Native" accesskey="u" rel="up">Native</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  240. </div>
  241. </body>
  242. </html>