2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Authors: Nathan Binkert
32 * Copyright (c) 1990, 1993 The Regents of the University of California
35 * This software was developed by the Computer Systems Engineering group
36 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
37 * contributed to Berkeley.
39 * All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Lawrence Berkeley Laboratories.
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions
47 * 1. Redistributions of source code must retain the above copyright
48 * notice, this list of conditions and the following disclaimer.
49 * 2. Redistributions in binary form must reproduce the above copyright
50 * notice, this list of conditions and the following disclaimer in the
51 * documentation and/or other materials provided with the distribution.
52 * 3. All advertising materials mentioning features or use of this software
53 * must display the following acknowledgement:
54 * This product includes software developed by the University of
55 * California, Berkeley and its contributors.
56 * 4. Neither the name of the University nor the names of its contributors
57 * may be used to endorse or promote products derived from this software
58 * without specific prior written permission.
60 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
76 * Copyright (c) 2001 The NetBSD Foundation, Inc.
77 * All rights reserved.
79 * This code is derived from software contributed to The NetBSD Foundation
82 * Redistribution and use in source and binary forms, with or without
83 * modification, are permitted provided that the following conditions
85 * 1. Redistributions of source code must retain the above copyright
86 * notice, this list of conditions and the following disclaimer.
87 * 2. Redistributions in binary form must reproduce the above copyright
88 * notice, this list of conditions and the following disclaimer in the
89 * documentation and/or other materials provided with the distribution.
90 * 3. All advertising materials mentioning features or use of this software
91 * must display the following acknowledgement:
92 * This product includes software developed by the NetBSD
93 * Foundation, Inc. and its contributors.
94 * 4. Neither the name of The NetBSD Foundation nor the names of its
95 * contributors may be used to endorse or promote products derived
96 * from this software without specific prior written permission.
98 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
99 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
100 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
101 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
102 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
103 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
104 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
105 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
106 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
107 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
108 * POSSIBILITY OF SUCH DAMAGE.
112 * $NetBSD: kgdb_stub.c,v 1.8 2001/07/07 22:58:00 wdk Exp $
116 * "Stub" to allow remote cpu to debug over a serial line using gdb.
120 #include <sys/signal.h>
126 #include "arch/vtophys.hh"
127 #include "base/intmath.hh"
128 #include "base/remote_gdb.hh"
129 #include "base/socket.hh"
130 #include "base/trace.hh"
131 #include "config/the_isa.hh"
132 #include "cpu/static_inst.hh"
133 #include "cpu/thread_context.hh"
134 #include "debug/GDBAll.hh"
135 #include "mem/port.hh"
136 #include "mem/fs_translating_port_proxy.hh"
137 #include "mem/se_translating_port_proxy.hh"
138 #include "sim/full_system.hh"
139 #include "sim/system.hh"
142 using namespace Debug
;
143 using namespace TheISA
;
146 vector
<BaseRemoteGDB
*> debuggers
;
151 static int current_debugger
= -1;
152 if (current_debugger
>= 0 && current_debugger
< (int)debuggers
.size()) {
153 BaseRemoteGDB
*gdb
= debuggers
[current_debugger
];
154 if (!gdb
->isattached())
155 gdb
->listener
->accept();
156 if (gdb
->isattached())
162 ///////////////////////////////////////////////////////////
167 GDBListener::Event::Event(GDBListener
*l
, int fd
, int e
)
168 : PollEvent(fd
, e
), listener(l
)
172 GDBListener::Event::process(int revent
)
177 GDBListener::GDBListener(BaseRemoteGDB
*g
, int p
)
178 : event(NULL
), gdb(g
), port(p
)
180 assert(!gdb
->listener
);
181 gdb
->listener
= this;
184 GDBListener::~GDBListener()
193 return gdb
->name() + ".listener";
197 GDBListener::listen()
199 if (ListenSocket::allDisabled()) {
200 warn_once("Sockets disabled, not accepting gdb connections");
204 while (!listener
.listen(port
, true)) {
205 DPRINTF(GDBMisc
, "Can't bind port %d\n", port
);
209 event
= new Event(this, listener
.getfd(), POLLIN
);
210 pollQueue
.schedule(event
);
213 gdb
->number
= debuggers
.size();
214 debuggers
.push_back(gdb
);
218 ccprintf(cerr
, "%d: %s: listening for remote gdb #%d on port %d\n",
219 curTick(), name(), gdb
->number
, port
);
221 ccprintf(cerr
, "%d: %s: listening for remote gdb on port %d\n",
222 curTick(), name(), port
);
227 GDBListener::accept()
229 if (!listener
.islistening())
230 panic("GDBListener::accept(): cannot accept if we're not listening!");
232 int sfd
= listener
.accept(true);
235 if (gdb
->isattached())
242 BaseRemoteGDB::Event::Event(BaseRemoteGDB
*g
, int fd
, int e
)
243 : PollEvent(fd
, e
), gdb(g
)
247 BaseRemoteGDB::Event::process(int revent
)
251 else if (revent
& POLLNVAL
)
255 BaseRemoteGDB::BaseRemoteGDB(System
*_system
, ThreadContext
*c
, size_t cacheSize
)
256 : event(NULL
), listener(NULL
), number(-1), fd(-1),
257 active(false), attached(false),
258 system(_system
), context(c
),
261 memset(gdbregs
.regs
, 0, gdbregs
.bytes());
264 BaseRemoteGDB::~BaseRemoteGDB()
271 BaseRemoteGDB::name()
273 return system
->name() + ".remote_gdb";
277 BaseRemoteGDB::isattached()
281 BaseRemoteGDB::attach(int f
)
285 event
= new Event(this, fd
, POLLIN
);
286 pollQueue
.schedule(event
);
289 DPRINTFN("remote gdb attached\n");
293 BaseRemoteGDB::detach()
299 pollQueue
.remove(event
);
300 DPRINTFN("remote gdb detached\n");
304 BaseRemoteGDB::gdb_command(char cmd
)
307 case GDBSignal
: return "KGDB_SIGNAL";
308 case GDBSetBaud
: return "KGDB_SET_BAUD";
309 case GDBSetBreak
: return "KGDB_SET_BREAK";
310 case GDBCont
: return "KGDB_CONT";
311 case GDBAsyncCont
: return "KGDB_ASYNC_CONT";
312 case GDBDebug
: return "KGDB_DEBUG";
313 case GDBDetach
: return "KGDB_DETACH";
314 case GDBRegR
: return "KGDB_REG_R";
315 case GDBRegW
: return "KGDB_REG_W";
316 case GDBSetThread
: return "KGDB_SET_THREAD";
317 case GDBCycleStep
: return "KGDB_CYCLE_STEP";
318 case GDBSigCycleStep
: return "KGDB_SIG_CYCLE_STEP";
319 case GDBKill
: return "KGDB_KILL";
320 case GDBMemW
: return "KGDB_MEM_W";
321 case GDBMemR
: return "KGDB_MEM_R";
322 case GDBSetReg
: return "KGDB_SET_REG";
323 case GDBReadReg
: return "KGDB_READ_REG";
324 case GDBQueryVar
: return "KGDB_QUERY_VAR";
325 case GDBSetVar
: return "KGDB_SET_VAR";
326 case GDBReset
: return "KGDB_RESET";
327 case GDBStep
: return "KGDB_STEP";
328 case GDBAsyncStep
: return "KGDB_ASYNC_STEP";
329 case GDBThreadAlive
: return "KGDB_THREAD_ALIVE";
330 case GDBTargetExit
: return "KGDB_TARGET_EXIT";
331 case GDBBinaryDload
: return "KGDB_BINARY_DLOAD";
332 case GDBClrHwBkpt
: return "KGDB_CLR_HW_BKPT";
333 case GDBSetHwBkpt
: return "KGDB_SET_HW_BKPT";
334 case GDBStart
: return "KGDB_START";
335 case GDBEnd
: return "KGDB_END";
336 case GDBGoodP
: return "KGDB_GOODP";
337 case GDBBadP
: return "KGDB_BADP";
338 default: return "KGDB_UNKNOWN";
342 /////////////////////////
347 BaseRemoteGDB::getbyte()
350 if (::read(fd
, &b
, 1) != 1)
351 warn("could not read byte from debugger");
356 BaseRemoteGDB::putbyte(uint8_t b
)
358 if (::write(fd
, &b
, 1) != 1)
359 warn("could not write byte to debugger");
362 // Send a packet to gdb
364 BaseRemoteGDB::send(const char *bp
)
369 DPRINTF(GDBSend
, "send: %s\n", bp
);
373 //Start sending a packet
375 //Send the contents, and also keep a check sum.
376 for (csum
= 0; (c
= *p
); p
++) {
380 //Send the ending character.
383 putbyte(i2digit(csum
>> 4));
384 putbyte(i2digit(csum
));
385 //Try transmitting over and over again until the other end doesn't send an
387 } while ((c
= getbyte() & 0x7f) == GDBBadP
);
390 // Receive a packet from gdb
392 BaseRemoteGDB::recv(char *bp
, int maxlen
)
401 //Find the beginning of a packet
402 while ((c
= getbyte()) != GDBStart
)
405 //Read until you find the end of the data in the packet, and keep
406 //track of the check sum.
407 while ((c
= getbyte()) != GDBEnd
&& len
< maxlen
) {
414 //Mask the check sum, and terminate the command string.
418 //If the command was too long, report an error.
424 //Bring in the checksum. If the check sum matches, csum will be 0.
425 csum
-= digit2i(getbyte()) * 16;
426 csum
-= digit2i(getbyte());
428 //If the check sum was correct
430 //Report that the packet was received correctly
437 memcpy(bp
, bp
+3, len
);
441 //Otherwise, report that there was a mistake.
445 DPRINTF(GDBRecv
, "recv: %s: %s\n", gdb_command(*bp
), bp
);
450 // Read bytes from kernel address space for debugger.
452 BaseRemoteGDB::read(Addr vaddr
, size_t size
, char *data
)
454 static Addr lastaddr
= 0;
455 static size_t lastsize
= 0;
458 DPRINTF(GDBRead
, "read: reading memory location zero!\n");
459 vaddr
= lastaddr
+ lastsize
;
462 DPRINTF(GDBRead
, "read: addr=%#x, size=%d", vaddr
, size
);
465 FSTranslatingPortProxy
&proxy
= context
->getVirtProxy();
466 proxy
.readBlob(vaddr
, (uint8_t*)data
, size
);
468 SETranslatingPortProxy
&proxy
= context
->getMemProxy();
469 proxy
.readBlob(vaddr
, (uint8_t*)data
, size
);
473 if (DTRACE(GDBRead
)) {
474 if (DTRACE(GDBExtra
)) {
476 mem2hex(buf
, data
, size
);
477 DPRINTFNR(": %s\n", buf
);
486 // Write bytes to kernel address space for debugger.
488 BaseRemoteGDB::write(Addr vaddr
, size_t size
, const char *data
)
490 static Addr lastaddr
= 0;
491 static size_t lastsize
= 0;
494 DPRINTF(GDBWrite
, "write: writing memory location zero!\n");
495 vaddr
= lastaddr
+ lastsize
;
498 if (DTRACE(GDBWrite
)) {
499 DPRINTFN("write: addr=%#x, size=%d", vaddr
, size
);
500 if (DTRACE(GDBExtra
)) {
502 mem2hex(buf
, data
, size
);
503 DPRINTFNR(": %s\n", buf
);
508 FSTranslatingPortProxy
&proxy
= context
->getVirtProxy();
509 proxy
.writeBlob(vaddr
, (uint8_t*)data
, size
);
511 SETranslatingPortProxy
&proxy
= context
->getMemProxy();
512 proxy
.writeBlob(vaddr
, (uint8_t*)data
, size
);
518 PCEventQueue
*BaseRemoteGDB::getPcEventQueue()
520 return &system
->pcEventQueue
;
523 BaseRemoteGDB::HardBreakpoint::HardBreakpoint(BaseRemoteGDB
*_gdb
, Addr pc
)
524 : PCEvent(_gdb
->getPcEventQueue(), "HardBreakpoint Event", pc
),
525 gdb(_gdb
), refcount(0)
527 DPRINTF(GDBMisc
, "creating hardware breakpoint at %#x\n", evpc
);
531 BaseRemoteGDB::HardBreakpoint::process(ThreadContext
*tc
)
533 DPRINTF(GDBMisc
, "handling hardware breakpoint at %#x\n", pc());
535 if (tc
== gdb
->context
)
540 BaseRemoteGDB::insertSoftBreak(Addr addr
, size_t len
)
542 if (len
!= sizeof(TheISA::MachInst
))
543 panic("invalid length\n");
545 return insertHardBreak(addr
, len
);
549 BaseRemoteGDB::removeSoftBreak(Addr addr
, size_t len
)
551 if (len
!= sizeof(MachInst
))
552 panic("invalid length\n");
554 return removeHardBreak(addr
, len
);
558 BaseRemoteGDB::insertHardBreak(Addr addr
, size_t len
)
560 if (len
!= sizeof(MachInst
))
561 panic("invalid length\n");
563 DPRINTF(GDBMisc
, "inserting hardware breakpoint at %#x\n", addr
);
565 HardBreakpoint
*&bkpt
= hardBreakMap
[addr
];
567 bkpt
= new HardBreakpoint(this, addr
);
575 BaseRemoteGDB::removeHardBreak(Addr addr
, size_t len
)
577 if (len
!= sizeof(MachInst
))
578 panic("invalid length\n");
580 DPRINTF(GDBMisc
, "removing hardware breakpoint at %#x\n", addr
);
582 break_iter_t i
= hardBreakMap
.find(addr
);
583 if (i
== hardBreakMap
.end())
586 HardBreakpoint
*hbp
= (*i
).second
;
587 if (--hbp
->refcount
== 0) {
589 hardBreakMap
.erase(i
);
596 BaseRemoteGDB::setTempBreakpoint(Addr bkpt
)
598 DPRINTF(GDBMisc
, "setTempBreakpoint: addr=%#x\n", bkpt
);
599 insertHardBreak(bkpt
, sizeof(TheISA::MachInst
));
603 BaseRemoteGDB::clearTempBreakpoint(Addr
&bkpt
)
605 DPRINTF(GDBMisc
, "setTempBreakpoint: addr=%#x\n", bkpt
);
606 removeHardBreak(bkpt
, sizeof(TheISA::MachInst
));
611 BaseRemoteGDB::break_type(char c
)
614 case '0': return "software breakpoint";
615 case '1': return "hardware breakpoint";
616 case '2': return "write watchpoint";
617 case '3': return "read watchpoint";
618 case '4': return "access watchpoint";
619 default: return "unknown breakpoint/watchpoint";
623 // This function does all command processing for interfacing to a
624 // remote gdb. Note that the error codes are ignored by gdb at
625 // present, but might eventually become meaningful. (XXX) It might
626 // makes sense to use POSIX errno values, because that is what the
627 // gdb/remote.c functions want to return.
629 BaseRemoteGDB::trap(int type
)
633 char data
[GDBPacketBufLen
+ 1];
637 char command
, subcmd
;
644 bufferSize
= gdbregs
.bytes() * 2 + 256;
645 buffer
= (char*)malloc(bufferSize
);
647 DPRINTF(GDBMisc
, "trap: PC=%s\n", context
->pcState());
652 * The first entry to this function is normally through
653 * a breakpoint trap in kgdb_connect(), in which case we
654 * must advance past the breakpoint because gdb will not.
656 * On the first entry here, we expect that gdb is not yet
657 * listening to us, so just enter the interaction loop.
658 * After the debugger is "active" (connected) it will be
659 * waiting for a "signaled" message from us.
664 // Tell remote host that an exception has occurred.
665 snprintf((char *)buffer
, bufferSize
, "S%02x", type
);
668 // Stick frame regs into our reg cache.
672 datalen
= recv(data
, sizeof(data
));
673 data
[sizeof(data
) - 1] = 0; // Sentinel
680 // if this command came from a running gdb, answer it --
681 // the other guy has no way of knowing if we're in or out
682 // of this loop when he issues a "remote-signal".
683 snprintf((char *)buffer
, bufferSize
,
689 if (2 * gdbregs
.bytes() > bufferSize
)
690 panic("buffer too small");
692 mem2hex(buffer
, gdbregs
.regs
, gdbregs
.bytes());
697 p
= hex2mem(gdbregs
.regs
, p
, gdbregs
.bytes());
698 if (p
== NULL
|| *p
!= '\0')
713 if (val
< 0 && val
>= KGDB_NUMREGS
) {
718 gdbregs
.regs
[val
] = hex2i(&p
);
736 if (len
> bufferSize
) {
740 if (!acc(val
, len
)) {
745 if (read(val
, (size_t)len
, (char *)buffer
)) {
746 // variable length array would be nice, but C++ doesn't
747 // officially support those...
748 char *temp
= new char[2*len
+1];
749 mem2hex(temp
, buffer
, len
);
768 if (len
> datalen
- (p
- data
)) {
772 p
= hex2mem(buffer
, p
, bufferSize
);
777 if (!acc(val
, len
)) {
781 if (write(val
, (size_t)len
, (char *)buffer
))
807 context
->pcState(val
);
813 if (p
- data
< (ptrdiff_t)datalen
) {
815 context
->pcState(val
);
824 context
->pcState(val
);
830 if (p
- data
< (ptrdiff_t)datalen
) {
832 context
->pcState(val
);
839 if (*p
++ != ',') send("E0D");
841 if (*p
++ != ',') send("E0D");
844 DPRINTF(GDBMisc
, "clear %s, addr=%#x, len=%d\n",
845 break_type(subcmd
), val
, len
);
850 case '0': // software breakpoint
851 ret
= removeSoftBreak(val
, len
);
854 case '1': // hardware breakpoint
855 ret
= removeHardBreak(val
, len
);
858 case '2': // write watchpoint
859 case '3': // read watchpoint
860 case '4': // access watchpoint
866 send(ret
? "OK" : "E0C");
871 if (*p
++ != ',') send("E0D");
873 if (*p
++ != ',') send("E0D");
876 DPRINTF(GDBMisc
, "set %s, addr=%#x, len=%d\n",
877 break_type(subcmd
), val
, len
);
882 case '0': // software breakpoint
883 ret
= insertSoftBreak(val
, len
);
886 case '1': // hardware breakpoint
887 ret
= insertHardBreak(val
, len
);
890 case '2': // write watchpoint
891 case '3': // read watchpoint
892 case '4': // access watchpoint
898 send(ret
? "OK" : "E0C");
902 var
= string(p
, datalen
- 1);
913 case GDBSigCycleStep
:
920 // Unsupported command
921 DPRINTF(GDBMisc
, "Unsupported command: %s\n",
922 gdb_command(command
));
923 DDUMP(GDBMisc
, (uint8_t *)data
, datalen
);
929 DPRINTF(GDBMisc
, "Unknown command: %c(%#x)\n",
943 // Convert a hex digit into an integer.
944 // This returns -1 if the argument passed is no valid hex digit.
946 BaseRemoteGDB::digit2i(char c
)
948 if (c
>= '0' && c
<= '9')
950 else if (c
>= 'a' && c
<= 'f')
951 return (c
- 'a' + 10);
952 else if (c
>= 'A' && c
<= 'F')
954 return (c
- 'A' + 10);
959 // Convert the low 4 bits of an integer into an hex digit.
961 BaseRemoteGDB::i2digit(int n
)
963 return ("0123456789abcdef"[n
& 0x0f]);
966 // Convert a byte array into an hex string.
968 BaseRemoteGDB::mem2hex(void *vdst
, const void *vsrc
, int len
)
970 char *dst
= (char *)vdst
;
971 const char *src
= (const char *)vsrc
;
974 *dst
++ = i2digit(*src
>> 4);
975 *dst
++ = i2digit(*src
++);
980 // Convert an hex string into a byte array.
981 // This returns a pointer to the character following the last valid
982 // hex digit. If the string ends in the middle of a byte, NULL is
985 BaseRemoteGDB::hex2mem(void *vdst
, const char *src
, int maxlen
)
987 char *dst
= (char *)vdst
;
990 while (*src
&& maxlen
--) {
991 msb
= digit2i(*src
++);
994 lsb
= digit2i(*src
++);
997 *dst
++ = (msb
<< 4) | lsb
;
1002 // Convert an hex string into an integer.
1003 // This returns a pointer to the character following the last valid
1006 BaseRemoteGDB::hex2i(const char **srcp
)
1008 const char *src
= *srcp
;
1012 while ((nibble
= digit2i(*src
)) >= 0) {