remote_gdb.cc (3550:515e876568b4) remote_gdb.cc (3579:e9976b62c259)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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;

--- 233 unchanged lines hidden (view full) ---

242}
243
244BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c, size_t cacheSize)
245 : event(NULL), listener(NULL), number(-1), fd(-1),
246 active(false), attached(false),
247 system(_system), pmem(_system->physmem), context(c),
248 gdbregs(cacheSize)
249{
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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;

--- 233 unchanged lines hidden (view full) ---

242}
243
244BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c, size_t cacheSize)
245 : event(NULL), listener(NULL), number(-1), fd(-1),
246 active(false), attached(false),
247 system(_system), pmem(_system->physmem), context(c),
248 gdbregs(cacheSize)
249{
250 memset(gdbregs.regs, 0, gdbregs.size);
250 memset(gdbregs.regs, 0, gdbregs.bytes());
251}
252
253BaseRemoteGDB::~BaseRemoteGDB()
254{
255 if (event)
256 delete event;
257}
258

--- 346 unchanged lines hidden (view full) ---

605// makes sense to use POSIX errno values, because that is what the
606// gdb/remote.c functions want to return.
607bool
608BaseRemoteGDB::trap(int type)
609{
610 uint64_t val;
611 size_t datalen, len;
612 char data[GDBPacketBufLen + 1];
251}
252
253BaseRemoteGDB::~BaseRemoteGDB()
254{
255 if (event)
256 delete event;
257}
258

--- 346 unchanged lines hidden (view full) ---

605// makes sense to use POSIX errno values, because that is what the
606// gdb/remote.c functions want to return.
607bool
608BaseRemoteGDB::trap(int type)
609{
610 uint64_t val;
611 size_t datalen, len;
612 char data[GDBPacketBufLen + 1];
613 char buffer[gdbregs.size * 2 + 256];
613 char buffer[gdbregs.bytes() * 2 + 256];
614 const char *p;
615 char command, subcmd;
616 string var;
617 bool ret;
618
619 if (!attached)
620 return false;
621

--- 35 unchanged lines hidden (view full) ---

657 // the other guy has no way of knowing if we're in or out
658 // of this loop when he issues a "remote-signal".
659 snprintf((char *)buffer, sizeof(buffer),
660 "S%02x", type);
661 send(buffer);
662 continue;
663
664 case GDBRegR:
614 const char *p;
615 char command, subcmd;
616 string var;
617 bool ret;
618
619 if (!attached)
620 return false;
621

--- 35 unchanged lines hidden (view full) ---

657 // the other guy has no way of knowing if we're in or out
658 // of this loop when he issues a "remote-signal".
659 snprintf((char *)buffer, sizeof(buffer),
660 "S%02x", type);
661 send(buffer);
662 continue;
663
664 case GDBRegR:
665 if (2 * gdbregs.size > sizeof(buffer))
665 if (2 * gdbregs.bytes() > sizeof(buffer))
666 panic("buffer too small");
667
666 panic("buffer too small");
667
668 mem2hex(buffer, gdbregs.regs, gdbregs.size);
668 mem2hex(buffer, gdbregs.regs, gdbregs.bytes());
669 send(buffer);
670 continue;
671
672 case GDBRegW:
669 send(buffer);
670 continue;
671
672 case GDBRegW:
673 p = hex2mem(gdbregs.regs, p, gdbregs.size);
673 p = hex2mem(gdbregs.regs, p, gdbregs.bytes());
674 if (p == NULL || *p != '\0')
675 send("E01");
676 else {
677 setregs();
678 send("OK");
679 }
680 continue;
681

--- 318 unchanged lines hidden ---
674 if (p == NULL || *p != '\0')
675 send("E01");
676 else {
677 setregs();
678 send("OK");
679 }
680 continue;
681

--- 318 unchanged lines hidden ---