1<html lang="en"> 2<head> 3<title>Symbol Tables In Python - Debugging with GDB</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Debugging with GDB"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Python-API.html#Python-API" title="Python API"> 9<link rel="prev" href="Symbols-In-Python.html#Symbols-In-Python" title="Symbols In Python"> 10<link rel="next" href="Breakpoints-In-Python.html#Breakpoints-In-Python" title="Breakpoints In Python"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1988-2013 Free Software Foundation, Inc. 14 15Permission is granted to copy, distribute and/or modify this document 16under the terms of the GNU Free Documentation License, Version 1.3 or 17any later version published by the Free Software Foundation; with the 18Invariant Sections being ``Free Software'' and ``Free Software Needs 19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 20and with the Back-Cover Texts as in (a) below. 21 22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 23this GNU Manual. Buying copies from GNU Press supports the FSF in 24developing GNU and promoting software freedom.'' 25--> 26<meta http-equiv="Content-Style-Type" content="text/css"> 27<style type="text/css"><!-- 28 pre.display { font-family:inherit } 29 pre.format { font-family:inherit } 30 pre.smalldisplay { font-family:inherit; font-size:smaller } 31 pre.smallformat { font-family:inherit; font-size:smaller } 32 pre.smallexample { font-size:smaller } 33 pre.smalllisp { font-size:smaller } 34 span.sc { font-variant:small-caps } 35 span.roman { font-family:serif; font-weight:normal; } 36 span.sansserif { font-family:sans-serif; font-weight:normal; } 37--></style> 38<link rel="stylesheet" type="text/css" href="../cs.css"> 39</head> 40<body> 41<div class="node"> 42<a name="Symbol-Tables-In-Python"></a> 43<p> 44Next: <a rel="next" accesskey="n" href="Breakpoints-In-Python.html#Breakpoints-In-Python">Breakpoints In Python</a>, 45Previous: <a rel="previous" accesskey="p" href="Symbols-In-Python.html#Symbols-In-Python">Symbols In Python</a>, 46Up: <a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a> 47<hr> 48</div> 49 50<h5 class="subsubsection">23.2.2.23 Symbol table representation in Python.</h5> 51 52<p><a name="index-symbol-tables-in-python-2132"></a><a name="index-gdb_002eSymtab-2133"></a><a name="index-gdb_002eSymtab_005fand_005fline-2134"></a> 53Access to symbol table data maintained by <span class="sc">gdb</span> on the inferior 54is exposed to Python via two objects: <code>gdb.Symtab_and_line</code> and 55<code>gdb.Symtab</code>. Symbol table and line data for a frame is returned 56from the <code>find_sal</code> method in <code>gdb.Frame</code> object. 57See <a href="Frames-In-Python.html#Frames-In-Python">Frames In Python</a>. 58 59 <p>For more information on <span class="sc">gdb</span>'s symbol table management, see 60<a href="Symbols.html#Symbols">Examining the Symbol Table</a>, for more information. 61 62 <p>A <code>gdb.Symtab_and_line</code> object has the following attributes: 63 64<div class="defun"> 65— Variable: <b>Symtab_and_line.symtab</b><var><a name="index-Symtab_005fand_005fline_002esymtab-2135"></a></var><br> 66<blockquote><p>The symbol table object (<code>gdb.Symtab</code>) for this frame. 67This attribute is not writable. 68</p></blockquote></div> 69 70<div class="defun"> 71— Variable: <b>Symtab_and_line.pc</b><var><a name="index-Symtab_005fand_005fline_002epc-2136"></a></var><br> 72<blockquote><p>Indicates the start of the address range occupied by code for the 73current source line. This attribute is not writable. 74</p></blockquote></div> 75 76<div class="defun"> 77— Variable: <b>Symtab_and_line.last</b><var><a name="index-Symtab_005fand_005fline_002elast-2137"></a></var><br> 78<blockquote><p>Indicates the end of the address range occupied by code for the current 79source line. This attribute is not writable. 80</p></blockquote></div> 81 82<div class="defun"> 83— Variable: <b>Symtab_and_line.line</b><var><a name="index-Symtab_005fand_005fline_002eline-2138"></a></var><br> 84<blockquote><p>Indicates the current line number for this object. This 85attribute is not writable. 86</p></blockquote></div> 87 88 <p>A <code>gdb.Symtab_and_line</code> object has the following methods: 89 90<div class="defun"> 91— Function: <b>Symtab_and_line.is_valid</b> ()<var><a name="index-Symtab_005fand_005fline_002eis_005fvalid-2139"></a></var><br> 92<blockquote><p>Returns <code>True</code> if the <code>gdb.Symtab_and_line</code> object is valid, 93<code>False</code> if not. A <code>gdb.Symtab_and_line</code> object can become 94invalid if the Symbol table and line object it refers to does not 95exist in <span class="sc">gdb</span> any longer. All other 96<code>gdb.Symtab_and_line</code> methods will throw an exception if it is 97invalid at the time the method is called. 98</p></blockquote></div> 99 100 <p>A <code>gdb.Symtab</code> object has the following attributes: 101 102<div class="defun"> 103— Variable: <b>Symtab.filename</b><var><a name="index-Symtab_002efilename-2140"></a></var><br> 104<blockquote><p>The symbol table's source filename. This attribute is not writable. 105</p></blockquote></div> 106 107<div class="defun"> 108— Variable: <b>Symtab.objfile</b><var><a name="index-Symtab_002eobjfile-2141"></a></var><br> 109<blockquote><p>The symbol table's backing object file. See <a href="Objfiles-In-Python.html#Objfiles-In-Python">Objfiles In Python</a>. 110This attribute is not writable. 111</p></blockquote></div> 112 113 <p>A <code>gdb.Symtab</code> object has the following methods: 114 115<div class="defun"> 116— Function: <b>Symtab.is_valid</b> ()<var><a name="index-Symtab_002eis_005fvalid-2142"></a></var><br> 117<blockquote><p>Returns <code>True</code> if the <code>gdb.Symtab</code> object is valid, 118<code>False</code> if not. A <code>gdb.Symtab</code> object can become invalid if 119the symbol table it refers to does not exist in <span class="sc">gdb</span> any 120longer. All other <code>gdb.Symtab</code> methods will throw an exception 121if it is invalid at the time the method is called. 122</p></blockquote></div> 123 124<div class="defun"> 125— Function: <b>Symtab.fullname</b> ()<var><a name="index-Symtab_002efullname-2143"></a></var><br> 126<blockquote><p>Return the symbol table's source absolute file name. 127</p></blockquote></div> 128 129<div class="defun"> 130— Function: <b>Symtab.global_block</b> ()<var><a name="index-Symtab_002eglobal_005fblock-2144"></a></var><br> 131<blockquote><p>Return the global block of the underlying symbol table. 132See <a href="Blocks-In-Python.html#Blocks-In-Python">Blocks In Python</a>. 133</p></blockquote></div> 134 135<div class="defun"> 136— Function: <b>Symtab.static_block</b> ()<var><a name="index-Symtab_002estatic_005fblock-2145"></a></var><br> 137<blockquote><p>Return the static block of the underlying symbol table. 138See <a href="Blocks-In-Python.html#Blocks-In-Python">Blocks In Python</a>. 139</p></blockquote></div> 140 141 </body></html> 142 143