Deleted Added
sdiff udiff text old ( 3918:1f9a98d198e8 ) new ( 3960:1dca397b2bab )
full compact
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;

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

116 * "Stub" to allow remote cpu to debug over a serial line using gdb.
117 */
118
119#include <sys/signal.h>
120
121#include <string>
122#include <unistd.h>
123
124#include "arch/vtophys.hh"
125#include "base/intmath.hh"
126#include "base/remote_gdb.hh"
127#include "base/socket.hh"
128#include "base/trace.hh"
129#include "config/full_system.hh"
130#include "cpu/thread_context.hh"
131#include "cpu/static_inst.hh"
132#include "mem/physical.hh"
133#include "mem/port.hh"
134#include "sim/system.hh"
135
136using namespace std;
137using namespace TheISA;
138
139#ifndef NDEBUG
140vector<BaseRemoteGDB *> debuggers;
141

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

443
444 if (vaddr < 10) {
445 DPRINTF(GDBRead, "read: reading memory location zero!\n");
446 vaddr = lastaddr + lastsize;
447 }
448
449 DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size);
450
451 VirtualPort *vp = context->getVirtPort(context);
452 vp->readBlob(vaddr, (uint8_t*)data, size);
453 context->delVirtPort(vp);
454
455#if TRACING_ON
456 if (DTRACE(GDBRead)) {
457 if (DTRACE(GDBExtra)) {
458 char buf[1024];
459 mem2hex(buf, data, size);
460 DPRINTFNR(": %s\n", buf);
461 } else

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

482 DPRINTFN("write: addr=%#x, size=%d", vaddr, size);
483 if (DTRACE(GDBExtra)) {
484 char buf[1024];
485 mem2hex(buf, data, size);
486 DPRINTFNR(": %s\n", buf);
487 } else
488 DPRINTFNR("\n");
489 }
490 VirtualPort *vp = context->getVirtPort(context);
491 vp->writeBlob(vaddr, (uint8_t*)data, size);
492 context->delVirtPort(vp);
493
494 return true;
495}
496
497PCEventQueue *BaseRemoteGDB::getPcEventQueue()
498{
499 return &system->pcEventQueue;
500}

--- 104 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;
614 const char *p;
615 char command, subcmd;
616 string var;
617 bool ret;
618
619 if (!attached)
620 return false;
621
622 buffer = (char*)malloc(gdbregs.bytes() * 2 + 256);
623
624 DPRINTF(GDBMisc, "trap: PC=%#x NPC=%#x\n",
625 context->readPC(), context->readNextPC());
626
627 clearSingleStep();
628
629 /*
630 * The first entry to this function is normally through
631 * a breakpoint trap in kgdb_connect(), in which case we

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

913 send("");
914 continue;
915
916
917 }
918 }
919
920 out:
921 free(buffer);
922 return true;
923}
924
925// Convert a hex digit into an integer.
926// This returns -1 if the argument passed is no valid hex digit.
927int
928BaseRemoteGDB::digit2i(char c)
929{

--- 73 unchanged lines hidden ---