Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Symbols-In-Guile.html 15KB

před 3 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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>Symbols In Guile (Debugging with GDB)</title>
  17. <meta name="description" content="Symbols In Guile (Debugging with GDB)">
  18. <meta name="keywords" content="Symbols In Guile (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="Guile-API.html#Guile-API" rel="up" title="Guile API">
  26. <link href="Symbol-Tables-In-Guile.html#Symbol-Tables-In-Guile" rel="next" title="Symbol Tables In Guile">
  27. <link href="Blocks-In-Guile.html#Blocks-In-Guile" rel="prev" title="Blocks In Guile">
  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="Symbols-In-Guile"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Symbol-Tables-In-Guile.html#Symbol-Tables-In-Guile" accesskey="n" rel="next">Symbol Tables In Guile</a>, Previous: <a href="Blocks-In-Guile.html#Blocks-In-Guile" accesskey="p" rel="prev">Blocks In Guile</a>, Up: <a href="Guile-API.html#Guile-API" accesskey="u" rel="up">Guile API</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="Guile-representation-of-Symbols_002e"></a>
  64. <h4 class="subsubsection">23.3.3.17 Guile representation of Symbols.</h4>
  65. <a name="index-symbols-in-guile"></a>
  66. <a name="index-_003cgdb_003asymbol_003e"></a>
  67. <p><small>GDB</small> represents every variable, function and type as an
  68. entry in a symbol table. See <a href="Symbols.html#Symbols">Examining the Symbol Table</a>.
  69. Guile represents these symbols in <small>GDB</small> with the
  70. <code>&lt;gdb:symbol&gt;</code> object.
  71. </p>
  72. <p>The following symbol-related procedures are provided by the
  73. <code>(gdb)</code> module:
  74. </p>
  75. <dl>
  76. <dt><a name="index-symbol_003f"></a>Scheme Procedure: <strong>symbol?</strong> <em>object</em></dt>
  77. <dd><p>Return <code>#t</code> if <var>object</var> is an object of type <code>&lt;gdb:symbol&gt;</code>.
  78. Otherwise return <code>#f</code>.
  79. </p></dd></dl>
  80. <dl>
  81. <dt><a name="index-symbol_002dvalid_003f"></a>Scheme Procedure: <strong>symbol-valid?</strong> <em>symbol</em></dt>
  82. <dd><p>Return <code>#t</code> if the <code>&lt;gdb:symbol&gt;</code> object is valid,
  83. <code>#f</code> if not. A <code>&lt;gdb:symbol&gt;</code> object can become invalid if
  84. the symbol it refers to does not exist in <small>GDB</small> any longer.
  85. All other <code>&lt;gdb:symbol&gt;</code> procedures will throw an exception if it is
  86. invalid at the time the procedure is called.
  87. </p></dd></dl>
  88. <dl>
  89. <dt><a name="index-symbol_002dtype"></a>Scheme Procedure: <strong>symbol-type</strong> <em>symbol</em></dt>
  90. <dd><p>Return the type of <var>symbol</var> or <code>#f</code> if no type is recorded.
  91. The result is an object of type <code>&lt;gdb:type&gt;</code>.
  92. See <a href="Types-In-Guile.html#Types-In-Guile">Types In Guile</a>.
  93. </p></dd></dl>
  94. <dl>
  95. <dt><a name="index-symbol_002dsymtab"></a>Scheme Procedure: <strong>symbol-symtab</strong> <em>symbol</em></dt>
  96. <dd><p>Return the symbol table in which <var>symbol</var> appears.
  97. The result is an object of type <code>&lt;gdb:symtab&gt;</code>.
  98. See <a href="Symbol-Tables-In-Guile.html#Symbol-Tables-In-Guile">Symbol Tables In Guile</a>.
  99. </p></dd></dl>
  100. <dl>
  101. <dt><a name="index-symbol_002dline"></a>Scheme Procedure: <strong>symbol-line</strong> <em>symbol</em></dt>
  102. <dd><p>Return the line number in the source code at which <var>symbol</var> was defined.
  103. This is an integer.
  104. </p></dd></dl>
  105. <dl>
  106. <dt><a name="index-symbol_002dname"></a>Scheme Procedure: <strong>symbol-name</strong> <em>symbol</em></dt>
  107. <dd><p>Return the name of <var>symbol</var> as a string.
  108. </p></dd></dl>
  109. <dl>
  110. <dt><a name="index-symbol_002dlinkage_002dname"></a>Scheme Procedure: <strong>symbol-linkage-name</strong> <em>symbol</em></dt>
  111. <dd><p>Return the name of <var>symbol</var>, as used by the linker (i.e., may be mangled).
  112. </p></dd></dl>
  113. <dl>
  114. <dt><a name="index-symbol_002dprint_002dname"></a>Scheme Procedure: <strong>symbol-print-name</strong> <em>symbol</em></dt>
  115. <dd><p>Return the name of <var>symbol</var> in a form suitable for output. This is either
  116. <code>name</code> or <code>linkage_name</code>, depending on whether the user
  117. asked <small>GDB</small> to display demangled or mangled names.
  118. </p></dd></dl>
  119. <dl>
  120. <dt><a name="index-symbol_002daddr_002dclass"></a>Scheme Procedure: <strong>symbol-addr-class</strong> <em>symbol</em></dt>
  121. <dd><p>Return the address class of the symbol. This classifies how to find the value
  122. of a symbol. Each address class is a constant defined in the
  123. <code>(gdb)</code> module and described later in this chapter.
  124. </p></dd></dl>
  125. <dl>
  126. <dt><a name="index-symbol_002dneeds_002dframe_003f"></a>Scheme Procedure: <strong>symbol-needs-frame?</strong> <em>symbol</em></dt>
  127. <dd><p>Return <code>#t</code> if evaluating <var>symbol</var>&rsquo;s value requires a frame
  128. (see <a href="Frames-In-Guile.html#Frames-In-Guile">Frames In Guile</a>) and <code>#f</code> otherwise. Typically,
  129. local variables will require a frame, but other symbols will not.
  130. </p></dd></dl>
  131. <dl>
  132. <dt><a name="index-symbol_002dargument_003f"></a>Scheme Procedure: <strong>symbol-argument?</strong> <em>symbol</em></dt>
  133. <dd><p>Return <code>#t</code> if <var>symbol</var> is an argument of a function.
  134. Otherwise return <code>#f</code>.
  135. </p></dd></dl>
  136. <dl>
  137. <dt><a name="index-symbol_002dconstant_003f"></a>Scheme Procedure: <strong>symbol-constant?</strong> <em>symbol</em></dt>
  138. <dd><p>Return <code>#t</code> if <var>symbol</var> is a constant.
  139. Otherwise return <code>#f</code>.
  140. </p></dd></dl>
  141. <dl>
  142. <dt><a name="index-symbol_002dfunction_003f"></a>Scheme Procedure: <strong>symbol-function?</strong> <em>symbol</em></dt>
  143. <dd><p>Return <code>#t</code> if <var>symbol</var> is a function or a method.
  144. Otherwise return <code>#f</code>.
  145. </p></dd></dl>
  146. <dl>
  147. <dt><a name="index-symbol_002dvariable_003f"></a>Scheme Procedure: <strong>symbol-variable?</strong> <em>symbol</em></dt>
  148. <dd><p>Return <code>#t</code> if <var>symbol</var> is a variable.
  149. Otherwise return <code>#f</code>.
  150. </p></dd></dl>
  151. <dl>
  152. <dt><a name="index-symbol_002dvalue"></a>Scheme Procedure: <strong>symbol-value</strong> <em>symbol <span class="roman">[</span>#:frame frame<span class="roman">]</span></em></dt>
  153. <dd><p>Compute the value of <var>symbol</var>, as a <code>&lt;gdb:value&gt;</code>. For
  154. functions, this computes the address of the function, cast to the
  155. appropriate type. If the symbol requires a frame in order to compute
  156. its value, then <var>frame</var> must be given. If <var>frame</var> is not
  157. given, or if <var>frame</var> is invalid, then an exception is thrown.
  158. </p></dd></dl>
  159. <dl>
  160. <dt><a name="index-lookup_002dsymbol"></a>Scheme Procedure: <strong>lookup-symbol</strong> <em>name <span class="roman">[</span>#:block block<span class="roman">]</span> <span class="roman">[</span>#:domain domain<span class="roman">]</span></em></dt>
  161. <dd><p>This function searches for a symbol by name. The search scope can be
  162. restricted to the parameters defined in the optional domain and block
  163. arguments.
  164. </p>
  165. <p><var>name</var> is the name of the symbol. It must be a string. The
  166. optional <var>block</var> argument restricts the search to symbols visible
  167. in that <var>block</var>. The <var>block</var> argument must be a
  168. <code>&lt;gdb:block&gt;</code> object. If omitted, the block for the current frame
  169. is used. The optional <var>domain</var> argument restricts
  170. the search to the domain type. The <var>domain</var> argument must be a
  171. domain constant defined in the <code>(gdb)</code> module and described later
  172. in this chapter.
  173. </p>
  174. <p>The result is a list of two elements.
  175. The first element is a <code>&lt;gdb:symbol&gt;</code> object or <code>#f</code> if the symbol
  176. is not found.
  177. If the symbol is found, the second element is <code>#t</code> if the symbol
  178. is a field of a method&rsquo;s object (e.g., <code>this</code> in C<tt>++</tt>),
  179. otherwise it is <code>#f</code>.
  180. If the symbol is not found, the second element is <code>#f</code>.
  181. </p></dd></dl>
  182. <dl>
  183. <dt><a name="index-lookup_002dglobal_002dsymbol"></a>Scheme Procedure: <strong>lookup-global-symbol</strong> <em>name <span class="roman">[</span>#:domain domain<span class="roman">]</span></em></dt>
  184. <dd><p>This function searches for a global symbol by name.
  185. The search scope can be restricted by the domain argument.
  186. </p>
  187. <p><var>name</var> is the name of the symbol. It must be a string.
  188. The optional <var>domain</var> argument restricts the search to the domain type.
  189. The <var>domain</var> argument must be a domain constant defined in the <code>(gdb)</code>
  190. module and described later in this chapter.
  191. </p>
  192. <p>The result is a <code>&lt;gdb:symbol&gt;</code> object or <code>#f</code> if the symbol
  193. is not found.
  194. </p></dd></dl>
  195. <p>The available domain categories in <code>&lt;gdb:symbol&gt;</code> are represented
  196. as constants in the <code>(gdb)</code> module:
  197. </p>
  198. <dl compact="compact">
  199. <dt><code>SYMBOL_UNDEF_DOMAIN</code>
  200. <a name="index-SYMBOL_005fUNDEF_005fDOMAIN-1"></a>
  201. </dt>
  202. <dd><p>This is used when a domain has not been discovered or none of the
  203. following domains apply. This usually indicates an error either
  204. in the symbol information or in <small>GDB</small>&rsquo;s handling of symbols.
  205. </p>
  206. </dd>
  207. <dt><code>SYMBOL_VAR_DOMAIN</code>
  208. <a name="index-SYMBOL_005fVAR_005fDOMAIN-1"></a>
  209. </dt>
  210. <dd><p>This domain contains variables, function names, typedef names and enum
  211. type values.
  212. </p>
  213. </dd>
  214. <dt><code>SYMBOL_STRUCT_DOMAIN</code>
  215. <a name="index-SYMBOL_005fSTRUCT_005fDOMAIN-1"></a>
  216. </dt>
  217. <dd><p>This domain holds struct, union and enum type names.
  218. </p>
  219. </dd>
  220. <dt><code>SYMBOL_LABEL_DOMAIN</code>
  221. <a name="index-SYMBOL_005fLABEL_005fDOMAIN-1"></a>
  222. </dt>
  223. <dd><p>This domain contains names of labels (for gotos).
  224. </p>
  225. </dd>
  226. <dt><code>SYMBOL_VARIABLES_DOMAIN</code>
  227. <a name="index-SYMBOL_005fVARIABLES_005fDOMAIN"></a>
  228. </dt>
  229. <dd><p>This domain holds a subset of the <code>SYMBOLS_VAR_DOMAIN</code>; it
  230. contains everything minus functions and types.
  231. </p>
  232. </dd>
  233. <dt><code>SYMBOL_FUNCTIONS_DOMAIN</code>
  234. <a name="index-SYMBOL_005fFUNCTIONS_005fDOMAIN"></a>
  235. </dt>
  236. <dd><p>This domain contains all functions.
  237. </p>
  238. </dd>
  239. <dt><code>SYMBOL_TYPES_DOMAIN</code>
  240. <a name="index-SYMBOL_005fTYPES_005fDOMAIN"></a>
  241. </dt>
  242. <dd><p>This domain contains all types.
  243. </p></dd>
  244. </dl>
  245. <p>The available address class categories in <code>&lt;gdb:symbol&gt;</code> are represented
  246. as constants in the <code>gdb</code> module:
  247. </p>
  248. <dl compact="compact">
  249. <dt><code>SYMBOL_LOC_UNDEF</code>
  250. <a name="index-SYMBOL_005fLOC_005fUNDEF-1"></a>
  251. </dt>
  252. <dd><p>If this is returned by address class, it indicates an error either in
  253. the symbol information or in <small>GDB</small>&rsquo;s handling of symbols.
  254. </p>
  255. </dd>
  256. <dt><code>SYMBOL_LOC_CONST</code>
  257. <a name="index-SYMBOL_005fLOC_005fCONST-1"></a>
  258. </dt>
  259. <dd><p>Value is constant int.
  260. </p>
  261. </dd>
  262. <dt><code>SYMBOL_LOC_STATIC</code>
  263. <a name="index-SYMBOL_005fLOC_005fSTATIC-1"></a>
  264. </dt>
  265. <dd><p>Value is at a fixed address.
  266. </p>
  267. </dd>
  268. <dt><code>SYMBOL_LOC_REGISTER</code>
  269. <a name="index-SYMBOL_005fLOC_005fREGISTER-1"></a>
  270. </dt>
  271. <dd><p>Value is in a register.
  272. </p>
  273. </dd>
  274. <dt><code>SYMBOL_LOC_ARG</code>
  275. <a name="index-SYMBOL_005fLOC_005fARG-1"></a>
  276. </dt>
  277. <dd><p>Value is an argument. This value is at the offset stored within the
  278. symbol inside the frame&rsquo;s argument list.
  279. </p>
  280. </dd>
  281. <dt><code>SYMBOL_LOC_REF_ARG</code>
  282. <a name="index-SYMBOL_005fLOC_005fREF_005fARG-1"></a>
  283. </dt>
  284. <dd><p>Value address is stored in the frame&rsquo;s argument list. Just like
  285. <code>LOC_ARG</code> except that the value&rsquo;s address is stored at the
  286. offset, not the value itself.
  287. </p>
  288. </dd>
  289. <dt><code>SYMBOL_LOC_REGPARM_ADDR</code>
  290. <a name="index-SYMBOL_005fLOC_005fREGPARM_005fADDR-1"></a>
  291. </dt>
  292. <dd><p>Value is a specified register. Just like <code>LOC_REGISTER</code> except
  293. the register holds the address of the argument instead of the argument
  294. itself.
  295. </p>
  296. </dd>
  297. <dt><code>SYMBOL_LOC_LOCAL</code>
  298. <a name="index-SYMBOL_005fLOC_005fLOCAL-1"></a>
  299. </dt>
  300. <dd><p>Value is a local variable.
  301. </p>
  302. </dd>
  303. <dt><code>SYMBOL_LOC_TYPEDEF</code>
  304. <a name="index-SYMBOL_005fLOC_005fTYPEDEF-1"></a>
  305. </dt>
  306. <dd><p>Value not used. Symbols in the domain <code>SYMBOL_STRUCT_DOMAIN</code> all
  307. have this class.
  308. </p>
  309. </dd>
  310. <dt><code>SYMBOL_LOC_BLOCK</code>
  311. <a name="index-SYMBOL_005fLOC_005fBLOCK-1"></a>
  312. </dt>
  313. <dd><p>Value is a block.
  314. </p>
  315. </dd>
  316. <dt><code>SYMBOL_LOC_CONST_BYTES</code>
  317. <a name="index-SYMBOL_005fLOC_005fCONST_005fBYTES-1"></a>
  318. </dt>
  319. <dd><p>Value is a byte-sequence.
  320. </p>
  321. </dd>
  322. <dt><code>SYMBOL_LOC_UNRESOLVED</code>
  323. <a name="index-SYMBOL_005fLOC_005fUNRESOLVED-1"></a>
  324. </dt>
  325. <dd><p>Value is at a fixed address, but the address of the variable has to be
  326. determined from the minimal symbol table whenever the variable is
  327. referenced.
  328. </p>
  329. </dd>
  330. <dt><code>SYMBOL_LOC_OPTIMIZED_OUT</code>
  331. <a name="index-SYMBOL_005fLOC_005fOPTIMIZED_005fOUT-1"></a>
  332. </dt>
  333. <dd><p>The value does not actually exist in the program.
  334. </p>
  335. </dd>
  336. <dt><code>SYMBOL_LOC_COMPUTED</code>
  337. <a name="index-SYMBOL_005fLOC_005fCOMPUTED-2"></a>
  338. </dt>
  339. <dd><p>The value&rsquo;s address is a computed location.
  340. </p></dd>
  341. </dl>
  342. <hr>
  343. <div class="header">
  344. <p>
  345. Next: <a href="Symbol-Tables-In-Guile.html#Symbol-Tables-In-Guile" accesskey="n" rel="next">Symbol Tables In Guile</a>, Previous: <a href="Blocks-In-Guile.html#Blocks-In-Guile" accesskey="p" rel="prev">Blocks In Guile</a>, Up: <a href="Guile-API.html#Guile-API" accesskey="u" rel="up">Guile API</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>
  346. </div>
  347. </body>
  348. </html>