Process-Information.html 11 KB

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