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-2021 Free Software Foundation, Inc. 4 5Permission is granted to copy, distribute and/or modify this document 6under the terms of the GNU Free Documentation License, Version 1.3 or 7any later version published by the Free Software Foundation; with the 8Invariant Sections being "Free Software" and "Free Software Needs 9Free Documentation", with the Front-Cover Texts being "A GNU Manual," 10and with the Back-Cover Texts as in (a) below. 11 12(a) The FSF's Back-Cover Text is: "You are free to copy and modify 13this GNU Manual. Buying copies from GNU Press supports the FSF in 14developing GNU and promoting software freedom." --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>Debugging with GDB: Architectures In Python</title> 18 19<meta name="description" content="Debugging with GDB: Architectures In Python"> 20<meta name="keywords" content="Debugging with GDB: Architectures In Python"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="Python-API.html#Python-API" rel="up" title="Python API"> 29<link href="Registers-In-Python.html#Registers-In-Python" rel="next" title="Registers In Python"> 30<link href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python" rel="previous" title="Lazy Strings In Python"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Architectures-In-Python"></a> 65<div class="header"> 66<p> 67Next: <a href="Registers-In-Python.html#Registers-In-Python" accesskey="n" rel="next">Registers In Python</a>, Previous: <a href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python" accesskey="p" rel="previous">Lazy Strings In Python</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python API</a> [<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> 68</div> 69<hr> 70<a name="Python-representation-of-architectures"></a> 71<h4 class="subsubsection">23.2.2.33 Python representation of architectures</h4> 72<a name="index-Python-architectures"></a> 73 74<p><small>GDB</small> uses architecture specific parameters and artifacts in a 75number of its various computations. An architecture is represented 76by an instance of the <code>gdb.Architecture</code> class. 77</p> 78<p>A <code>gdb.Architecture</code> class has the following methods: 79</p> 80<dl> 81<dt><a name="index-Architecture_002ename"></a>Function: <strong>Architecture.name</strong> <em>()</em></dt> 82<dd><p>Return the name (string value) of the architecture. 83</p></dd></dl> 84 85<dl> 86<dt><a name="index-Architecture_002edisassemble"></a>Function: <strong>Architecture.disassemble</strong> <em>(<var>start_pc</var> <span class="roman">[</span>, <var>end_pc</var> <span class="roman">[</span>, <var>count</var><span class="roman">]]</span>)</em></dt> 87<dd><p>Return a list of disassembled instructions starting from the memory 88address <var>start_pc</var>. The optional arguments <var>end_pc</var> and 89<var>count</var> determine the number of instructions in the returned list. 90If both the optional arguments <var>end_pc</var> and <var>count</var> are 91specified, then a list of at most <var>count</var> disassembled instructions 92whose start address falls in the closed memory address interval from 93<var>start_pc</var> to <var>end_pc</var> are returned. If <var>end_pc</var> is not 94specified, but <var>count</var> is specified, then <var>count</var> number of 95instructions starting from the address <var>start_pc</var> are returned. If 96<var>count</var> is not specified but <var>end_pc</var> is specified, then all 97instructions whose start address falls in the closed memory address 98interval from <var>start_pc</var> to <var>end_pc</var> are returned. If neither 99<var>end_pc</var> nor <var>count</var> are specified, then a single instruction at 100<var>start_pc</var> is returned. For all of these cases, each element of the 101returned list is a Python <code>dict</code> with the following string keys: 102</p> 103<dl compact="compact"> 104<dt><code>addr</code></dt> 105<dd><p>The value corresponding to this key is a Python long integer capturing 106the memory address of the instruction. 107</p> 108</dd> 109<dt><code>asm</code></dt> 110<dd><p>The value corresponding to this key is a string value which represents 111the instruction with assembly language mnemonics. The assembly 112language flavor used is the same as that specified by the current CLI 113variable <code>disassembly-flavor</code>. See <a href="Machine-Code.html#Machine-Code">Machine Code</a>. 114</p> 115</dd> 116<dt><code>length</code></dt> 117<dd><p>The value corresponding to this key is the length (integer value) of the 118instruction in bytes. 119</p> 120</dd> 121</dl> 122</dd></dl> 123 124<a name="gdbpy_005farchitecture_005fregisters"></a><dl> 125<dt><a name="index-Architecture_002eregisters"></a>Function: <strong>Architecture.registers</strong> <em>(<span class="roman">[</span> <var>reggroup</var> <span class="roman">]</span>)</em></dt> 126<dd><p>Return a <code>gdb.RegisterDescriptorIterator</code> (see <a href="Registers-In-Python.html#Registers-In-Python">Registers In Python</a>) for all of the registers in <var>reggroup</var>, a string that is 127the name of a register group. If <var>reggroup</var> is omitted, or is the 128empty string, then the register group ‘<samp>all</samp>’ is assumed. 129</p></dd></dl> 130 131<a name="gdbpy_005farchitecture_005freggroups"></a><dl> 132<dt><a name="index-Architecture_002eregister_005fgroups"></a>Function: <strong>Architecture.register_groups</strong> <em>()</em></dt> 133<dd><p>Return a <code>gdb.RegisterGroupsIterator</code> (see <a href="Registers-In-Python.html#Registers-In-Python">Registers In Python</a>) for all of the register groups available for the 134<code>gdb.Architecture</code>. 135</p></dd></dl> 136 137<hr> 138<div class="header"> 139<p> 140Next: <a href="Registers-In-Python.html#Registers-In-Python" accesskey="n" rel="next">Registers In Python</a>, Previous: <a href="Lazy-Strings-In-Python.html#Lazy-Strings-In-Python" accesskey="p" rel="previous">Lazy Strings In Python</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python API</a> [<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> 141</div> 142 143 144 145</body> 146</html> 147