/[gxemul]/upstream/0.4.3/doc/gdb_remote.html
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/0.4.3/doc/gdb_remote.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (show annotations)
Mon Oct 8 16:21:06 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/html
File size: 5480 byte(s)
0.4.3
1 <html><head><title>Gavare's eXperimental Emulator:&nbsp;&nbsp;&nbsp;GDB remote serial protocol connection</title>
2 <meta name="robots" content="noarchive,nofollow,noindex"></head>
3 <body bgcolor="#f8f8f8" text="#000000" link="#4040f0" vlink="#404040" alink="#ff0000">
4 <table border=0 width=100% bgcolor="#d0d0d0"><tr>
5 <td width=100% align=center valign=center><table border=0 width=100%><tr>
6 <td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6">
7 <b>Gavare's eXperimental Emulator:</b></font><br>
8 <font color="#000000" size="6"><b>GDB remote serial protocol connection</b>
9 </font></td></tr></table></td></tr></table><p>
10
11 <!--
12
13 $Id: gdb_remote.html,v 1.11 2006/05/22 04:53:52 debug Exp $
14
15 Copyright (C) 2006 Anders Gavare. All rights reserved.
16
17 Redistribution and use in source and binary forms, with or without
18 modification, are permitted provided that the following conditions are met:
19
20 1. Redistributions of source code must retain the above copyright
21 notice, this list of conditions and the following disclaimer.
22 2. Redistributions in binary form must reproduce the above copyright
23 notice, this list of conditions and the following disclaimer in the
24 documentation and/or other materials provided with the distribution.
25 3. The name of the author may not be used to endorse or promote products
26 derived from this software without specific prior written permission.
27
28 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
29 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
32 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 SUCH DAMAGE.
39
40 -->
41
42 <a href="./">Back to the index</a>
43
44 <p><br>
45 <h2>GDB remote serial protocol connection</h2>
46
47 <p>
48 <ul>
49 <li><a href="#intro">Introduction</a>
50 <li><a href="#prerequisites">Prerequisites</a>
51 <li><a href="#example">Example session</a>
52 </ul>
53
54
55
56
57
58
59 <p><br>
60 <a name="intro"></a>
61 <h3>Introduction:</h3>
62
63 Starting with release 0.4.0, GXemul has (very rudimentary) GDB serial
64 protocol support. This means that you can start up GDB, or a front-end
65 program which in turn uses GDB, and connect it to a running GXemul
66 instance.
67
68 <p>The GDB front-end I use in this example is the <a
69 href="http://www.gnu.org/software/ddd/">Data Display Debugger (DDD)</a>.
70
71 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
72 <a href="20060504-gdb-64bit-mips.png"><img src="20060504-gdb-64bit-mips_small.png"></a>
73
74 <p>The screenshot above shows DDD connected to GXemul, running the Hello
75 World demo program compiled for mips64-unknown-elf, on a FreeBSD/amd64 host.
76
77
78
79
80
81
82 <p><br>
83 <a name="prerequisites"></a>
84 <h3>Prerequisites:</h3>
85
86 <ul>
87 <li>Build and install GDB for your target. You should use the same
88 configuration as you did when you compiled your compiler (e.g.
89 mips64-unknown-elf). Assuming you use <tt>~/crossdev</tt> for all
90 your cross-development tools:<pre>
91 # <b>wget <a href="http://ftp.gnu.org/gnu/gdb/gdb-6.4.tar.gz">http://ftp.gnu.org/gnu/gdb/gdb-6.4.tar.gz</a></b>
92 # <b>tar zxf gdb-6.4.tar.gz</b>
93 # <b>cd gdb-6.4</b>
94 # <b>./configure --prefix=$HOME/crossdev --target=mips64-unknown-elf</b>
95 # <b>gmake install</b>
96 </pre>
97 Remember to include <tt>~/crossdev/bin</tt> in your PATH.
98 <p>
99 <li>Optionally, but highly recommended: Install a front-end for GDB, such
100 as DDD. In FreeBSD, this is done by:<pre>
101 # <b>pkg_add -r ddd</b>
102 </pre>
103 Other operating systems that have DDD available as a pre-compiled
104 package have similar methods of installing it; otherwise you could
105 try compiling DDD from source.
106 </ul>
107
108 You can still run a bare GDB session without a GUI front-end if you like.
109
110
111
112
113
114 <p><br>
115 <a name="example"></a>
116 <h3>Example session:</h3>
117
118 <ol>
119 <li>Start up GXemul, and tell it to wait for an incoming GDB connection
120 on a certain port:<pre>
121 # <b>gxemul -x -E testmips -G 10000 hello_mips</b>
122
123 </pre>
124 <p>
125 <li>Start the DDD, using a GDB configured for this specific target,
126 and also give the name of the binary/kernel. (This binary
127 should have been compiled with <tt>-g</tt>.)<pre>
128 # <b>ddd --debugger mips64-unknown-elf-gdb hello_mips</b>
129
130 </pre>
131 <p>
132 <li>At the <tt>(gdb)</tt> prompt in DDD, type:<pre>
133 (gdb) <b>target remote localhost:10000</b>
134
135 </pre>
136 <p>
137 <li>Press F9 (Continue) to start. Press ESC when you wish to interrupt.
138 You can also use F5 (Step) to single-step one instruction at a time.
139 </ol>
140
141
142
143 <p><br><b><u>Notes:</u></b>
144
145 <p>
146 <ul>
147 <li>The remote GDB functionality in GXemul is quite hack-ish, very
148 unstable, very slow, and does not support any fancy features
149 such as breakpoints or watchpoints yet.
150 <li>For 64-bit MIPS targets, you might have to fiddle with
151 MIPS-related GDB settings, to make GDB send correct commands
152 to GXemul. Otherwise, GDB only sends the lowest 32 bits
153 of memory addresses, which is incorrect.
154 <li>When remote-debugging PowerPC targets using DDD, you might have to
155 press F9 <i>twice</i> to get it to start. I am not sure why.
156 </ul>
157
158 </p>
159
160
161 <p><br>
162
163
164 </body>
165 </html>

  ViewVC Help
Powered by ViewVC 1.1.26