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.

189 line
8.7KB

  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>Symbol Tables In Python (Debugging with GDB)</title>
  17. <meta name="description" content="Symbol Tables In Python (Debugging with GDB)">
  18. <meta name="keywords" content="Symbol Tables In Python (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="Python-API.html#Python-API" rel="up" title="Python API">
  26. <link href="Line-Tables-In-Python.html#Line-Tables-In-Python" rel="next" title="Line Tables In Python">
  27. <link href="Symbols-In-Python.html#Symbols-In-Python" rel="prev" title="Symbols In Python">
  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="Symbol-Tables-In-Python"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Line-Tables-In-Python.html#Line-Tables-In-Python" accesskey="n" rel="next">Line Tables In Python</a>, Previous: <a href="Symbols-In-Python.html#Symbols-In-Python" accesskey="p" rel="prev">Symbols In Python</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python 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="Symbol-table-representation-in-Python"></a>
  64. <h4 class="subsubsection">23.2.2.28 Symbol table representation in Python</h4>
  65. <a name="index-symbol-tables-in-python"></a>
  66. <a name="index-gdb_002eSymtab"></a>
  67. <a name="index-gdb_002eSymtab_005fand_005fline"></a>
  68. <p>Access to symbol table data maintained by <small>GDB</small> on the inferior
  69. is exposed to Python via two objects: <code>gdb.Symtab_and_line</code> and
  70. <code>gdb.Symtab</code>. Symbol table and line data for a frame is returned
  71. from the <code>find_sal</code> method in <code>gdb.Frame</code> object.
  72. See <a href="Frames-In-Python.html#Frames-In-Python">Frames In Python</a>.
  73. </p>
  74. <p>For more information on <small>GDB</small>&rsquo;s symbol table management, see
  75. <a href="Symbols.html#Symbols">Examining the Symbol Table</a>, for more information.
  76. </p>
  77. <p>A <code>gdb.Symtab_and_line</code> object has the following attributes:
  78. </p>
  79. <dl>
  80. <dt><a name="index-Symtab_005fand_005fline_002esymtab"></a>Variable: <strong>Symtab_and_line.symtab</strong></dt>
  81. <dd><p>The symbol table object (<code>gdb.Symtab</code>) for this frame.
  82. This attribute is not writable.
  83. </p></dd></dl>
  84. <dl>
  85. <dt><a name="index-Symtab_005fand_005fline_002epc"></a>Variable: <strong>Symtab_and_line.pc</strong></dt>
  86. <dd><p>Indicates the start of the address range occupied by code for the
  87. current source line. This attribute is not writable.
  88. </p></dd></dl>
  89. <dl>
  90. <dt><a name="index-Symtab_005fand_005fline_002elast"></a>Variable: <strong>Symtab_and_line.last</strong></dt>
  91. <dd><p>Indicates the end of the address range occupied by code for the current
  92. source line. This attribute is not writable.
  93. </p></dd></dl>
  94. <dl>
  95. <dt><a name="index-Symtab_005fand_005fline_002eline"></a>Variable: <strong>Symtab_and_line.line</strong></dt>
  96. <dd><p>Indicates the current line number for this object. This
  97. attribute is not writable.
  98. </p></dd></dl>
  99. <p>A <code>gdb.Symtab_and_line</code> object has the following methods:
  100. </p>
  101. <dl>
  102. <dt><a name="index-Symtab_005fand_005fline_002eis_005fvalid"></a>Function: <strong>Symtab_and_line.is_valid</strong> <em>()</em></dt>
  103. <dd><p>Returns <code>True</code> if the <code>gdb.Symtab_and_line</code> object is valid,
  104. <code>False</code> if not. A <code>gdb.Symtab_and_line</code> object can become
  105. invalid if the Symbol table and line object it refers to does not
  106. exist in <small>GDB</small> any longer. All other
  107. <code>gdb.Symtab_and_line</code> methods will throw an exception if it is
  108. invalid at the time the method is called.
  109. </p></dd></dl>
  110. <p>A <code>gdb.Symtab</code> object has the following attributes:
  111. </p>
  112. <dl>
  113. <dt><a name="index-Symtab_002efilename"></a>Variable: <strong>Symtab.filename</strong></dt>
  114. <dd><p>The symbol table&rsquo;s source filename. This attribute is not writable.
  115. </p></dd></dl>
  116. <dl>
  117. <dt><a name="index-Symtab_002eobjfile"></a>Variable: <strong>Symtab.objfile</strong></dt>
  118. <dd><p>The symbol table&rsquo;s backing object file. See <a href="Objfiles-In-Python.html#Objfiles-In-Python">Objfiles In Python</a>.
  119. This attribute is not writable.
  120. </p></dd></dl>
  121. <dl>
  122. <dt><a name="index-Symtab_002eproducer"></a>Variable: <strong>Symtab.producer</strong></dt>
  123. <dd><p>The name and possibly version number of the program that
  124. compiled the code in the symbol table.
  125. The contents of this string is up to the compiler.
  126. If no producer information is available then <code>None</code> is returned.
  127. This attribute is not writable.
  128. </p></dd></dl>
  129. <p>A <code>gdb.Symtab</code> object has the following methods:
  130. </p>
  131. <dl>
  132. <dt><a name="index-Symtab_002eis_005fvalid"></a>Function: <strong>Symtab.is_valid</strong> <em>()</em></dt>
  133. <dd><p>Returns <code>True</code> if the <code>gdb.Symtab</code> object is valid,
  134. <code>False</code> if not. A <code>gdb.Symtab</code> object can become invalid if
  135. the symbol table it refers to does not exist in <small>GDB</small> any
  136. longer. All other <code>gdb.Symtab</code> methods will throw an exception
  137. if it is invalid at the time the method is called.
  138. </p></dd></dl>
  139. <dl>
  140. <dt><a name="index-Symtab_002efullname"></a>Function: <strong>Symtab.fullname</strong> <em>()</em></dt>
  141. <dd><p>Return the symbol table&rsquo;s source absolute file name.
  142. </p></dd></dl>
  143. <dl>
  144. <dt><a name="index-Symtab_002eglobal_005fblock"></a>Function: <strong>Symtab.global_block</strong> <em>()</em></dt>
  145. <dd><p>Return the global block of the underlying symbol table.
  146. See <a href="Blocks-In-Python.html#Blocks-In-Python">Blocks In Python</a>.
  147. </p></dd></dl>
  148. <dl>
  149. <dt><a name="index-Symtab_002estatic_005fblock"></a>Function: <strong>Symtab.static_block</strong> <em>()</em></dt>
  150. <dd><p>Return the static block of the underlying symbol table.
  151. See <a href="Blocks-In-Python.html#Blocks-In-Python">Blocks In Python</a>.
  152. </p></dd></dl>
  153. <dl>
  154. <dt><a name="index-Symtab_002elinetable"></a>Function: <strong>Symtab.linetable</strong> <em>()</em></dt>
  155. <dd><p>Return the line table associated with the symbol table.
  156. See <a href="Line-Tables-In-Python.html#Line-Tables-In-Python">Line Tables In Python</a>.
  157. </p></dd></dl>
  158. <hr>
  159. <div class="header">
  160. <p>
  161. Next: <a href="Line-Tables-In-Python.html#Line-Tables-In-Python" accesskey="n" rel="next">Line Tables In Python</a>, Previous: <a href="Symbols-In-Python.html#Symbols-In-Python" accesskey="p" rel="prev">Symbols In Python</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python 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>
  162. </div>
  163. </body>
  164. </html>