<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://elinux.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://elinux.org/index.php?title=GDB_Tips&amp;feed=atom&amp;action=history</id>
		<title>GDB Tips - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://elinux.org/index.php?title=GDB_Tips&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=GDB_Tips&amp;action=history"/>
		<updated>2013-05-24T08:43:07Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21alpha</generator>

	<entry>
		<id>http://elinux.org/index.php?title=GDB_Tips&amp;diff=74479&amp;oldid=prev</id>
		<title>Peter Huewe at 11:39, 28 October 2011</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=GDB_Tips&amp;diff=74479&amp;oldid=prev"/>
				<updated>2011-10-28T11:39:37Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:39, 28 October 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 33:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 33:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; (gdb) p/d &amp;amp;((struct poll_wqueues *)0)[1]-&amp;gt;pt&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; (gdb) p/d &amp;amp;((struct poll_wqueues *)0)[1]-&amp;gt;pt&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $3 = 604&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; $3 = 604&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category: Tips and Tricks]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key elinux:diff:version:1.11a:oldid:74413:newid:74479 --&gt;
&lt;/table&gt;</summary>
		<author><name>Peter Huewe</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=GDB_Tips&amp;diff=74413&amp;oldid=prev</id>
		<title>Peter Huewe at 11:27, 28 October 2011</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=GDB_Tips&amp;diff=74413&amp;oldid=prev"/>
				<updated>2011-10-28T11:27:05Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:27, 28 October 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;== get element size ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sometimes, with complex structures (arrays of structs containing nested structs or arrays), it is&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sometimes, with complex structures (arrays of structs containing nested structs or arrays), it is&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;hard to determine the actual size of a particular element.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;hard to determine the actual size of a particular element.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key elinux:diff:version:1.11a:oldid:74407:newid:74413 --&gt;
&lt;/table&gt;</summary>
		<author><name>Peter Huewe</name></author>	</entry>

	<entry>
		<id>http://elinux.org/index.php?title=GDB_Tips&amp;diff=74407&amp;oldid=prev</id>
		<title>Peter Huewe: Created page with &quot;Sometimes, with complex structures (arrays of structs containing nested structs or arrays), it is hard to determine the actual size of a particular element.  You can use gdb with...&quot;</title>
		<link rel="alternate" type="text/html" href="http://elinux.org/index.php?title=GDB_Tips&amp;diff=74407&amp;oldid=prev"/>
				<updated>2011-10-28T11:26:33Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Sometimes, with complex structures (arrays of structs containing nested structs or arrays), it is hard to determine the actual size of a particular element.  You can use gdb with...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sometimes, with complex structures (arrays of structs containing nested structs or arrays), it is&lt;br /&gt;
hard to determine the actual size of a particular element.&lt;br /&gt;
&lt;br /&gt;
You can use gdb with a program image to get the size of structures, by looking at the offset&lt;br /&gt;
of an element of the structure relative to an address of zero:&lt;br /&gt;
&lt;br /&gt;
Here are some examples:&lt;br /&gt;
   ${CROSS_COMPILE}gdb vmlinux&lt;br /&gt;
 GNU gdb (GDB) 7.2&lt;br /&gt;
 Copyright (C) 2010 Free Software Foundation, Inc.&lt;br /&gt;
 License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;&lt;br /&gt;
 This is free software: you are free to change and redistribute it.&lt;br /&gt;
 There is NO WARRANTY, to the extent permitted by law.  Type &amp;quot;show copying&amp;quot;&lt;br /&gt;
 and &amp;quot;show warranty&amp;quot; for details.&lt;br /&gt;
 This GDB was configured as &amp;quot;--host=i686-pc-linux-gnu --target=arm-sony-linux-gnueabi&amp;quot;.&lt;br /&gt;
 For bug reporting instructions, please see:&lt;br /&gt;
 &amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;.&lt;br /&gt;
 (gdb) p &amp;amp;((struct poll_wqueues *)0)-&amp;gt;polling_task&lt;br /&gt;
 $6 = (struct task_struct **) 0xc&lt;br /&gt;
 (gdb) p/d &amp;amp;((struct poll_wqueues *)0)-&amp;gt;error&lt;br /&gt;
 $4 = 20&lt;br /&gt;
&lt;br /&gt;
the second example could be read as: &amp;quot;print, in decimal, the address (offset)&lt;br /&gt;
of the element error using address 0 cast as a pointer to struct poll_wqueues&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'pt' is the first element of struct poll_wqueues.&lt;br /&gt;
Here is an example using array offsets, showing that struct poll_wqueues is 604 bytes long.&lt;br /&gt;
&lt;br /&gt;
 (gdb) p/d &amp;amp;((struct poll_wqueues *)0)[0]-&amp;gt;pt&lt;br /&gt;
 $2 = 0&lt;br /&gt;
 (gdb) p/d &amp;amp;((struct poll_wqueues *)0)[1]-&amp;gt;pt&lt;br /&gt;
 $3 = 604&lt;/div&gt;</summary>
		<author><name>Peter Huewe</name></author>	</entry>

	</feed>