remote_gdb.cc (10598:3d7653a2538b) remote_gdb.cc (10599:910fc5624d68)
1/*
2 * Copyright 2014 Google, Inc.
3 * Copyright (c) 2002-2005 The Regents of The University of Michigan
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

136#include "debug/GDBAll.hh"
137#include "mem/port.hh"
138#include "mem/fs_translating_port_proxy.hh"
139#include "mem/se_translating_port_proxy.hh"
140#include "sim/full_system.hh"
141#include "sim/system.hh"
142
143using namespace std;
1/*
2 * Copyright 2014 Google, Inc.
3 * Copyright (c) 2002-2005 The Regents of The University of Michigan
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

136#include "debug/GDBAll.hh"
137#include "mem/port.hh"
138#include "mem/fs_translating_port_proxy.hh"
139#include "mem/se_translating_port_proxy.hh"
140#include "sim/full_system.hh"
141#include "sim/system.hh"
142
143using namespace std;
144using namespace Debug;
145using namespace TheISA;
146
147#ifndef NDEBUG
148vector<BaseRemoteGDB *> debuggers;
149
150void
151debugger()
152{

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

243
244BaseRemoteGDB::InputEvent::InputEvent(BaseRemoteGDB *g, int fd, int e)
245 : PollEvent(fd, e), gdb(g)
246{}
247
248void
249BaseRemoteGDB::InputEvent::process(int revent)
250{
144using namespace TheISA;
145
146#ifndef NDEBUG
147vector<BaseRemoteGDB *> debuggers;
148
149void
150debugger()
151{

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

242
243BaseRemoteGDB::InputEvent::InputEvent(BaseRemoteGDB *g, int fd, int e)
244 : PollEvent(fd, e), gdb(g)
245{}
246
247void
248BaseRemoteGDB::InputEvent::process(int revent)
249{
251 BaseCPU *cpu = gdb->context->getCpuPtr();
252 EventQueue *eq = cpu->comInstEventQueue[gdb->context->threadId()];
253 if (revent & POLLIN) {
254 gdb->trapEvent.type(SIGILL);
250 if (revent & POLLIN) {
251 gdb->trapEvent.type(SIGILL);
255 // Here "ticks" aren't simulator ticks which measure time, they're
256 // instructions committed by the CPU.
257 eq->schedule(&gdb->trapEvent, eq->getCurTick());
252 gdb->scheduleInstCommitEvent(&gdb->trapEvent, 0);
258 } else if (revent & POLLNVAL) {
253 } else if (revent & POLLNVAL) {
259 if (gdb->trapEvent.scheduled())
260 eq->deschedule(&gdb->trapEvent);
254 gdb->descheduleInstCommitEvent(&gdb->trapEvent);
261 gdb->detach();
262 }
263}
264
265void
266BaseRemoteGDB::TrapEvent::process()
267{
268 gdb->trap(_type);

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

531 return true;
532}
533
534PCEventQueue *BaseRemoteGDB::getPcEventQueue()
535{
536 return &system->pcEventQueue;
537}
538
255 gdb->detach();
256 }
257}
258
259void
260BaseRemoteGDB::TrapEvent::process()
261{
262 gdb->trap(_type);

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

525 return true;
526}
527
528PCEventQueue *BaseRemoteGDB::getPcEventQueue()
529{
530 return &system->pcEventQueue;
531}
532
533EventQueue *
534BaseRemoteGDB::getComInstEventQueue()
535{
536 BaseCPU *cpu = context->getCpuPtr();
537 return cpu->comInstEventQueue[context->threadId()];
538}
539
540void
541BaseRemoteGDB::scheduleInstCommitEvent(Event *ev, int delta)
542{
543 EventQueue *eq = getComInstEventQueue();
544 // Here "ticks" aren't simulator ticks which measure time, they're
545 // instructions committed by the CPU.
546 eq->schedule(ev, eq->getCurTick() + delta);
547}
548
549void
550BaseRemoteGDB::descheduleInstCommitEvent(Event *ev)
551{
552 if (ev->scheduled())
553 getComInstEventQueue()->deschedule(ev);
554}
555
539bool
540BaseRemoteGDB::checkBpLen(size_t len)
541{
542 return len == sizeof(MachInst);
543}
544
545BaseRemoteGDB::HardBreakpoint::HardBreakpoint(BaseRemoteGDB *_gdb, Addr pc)
546 : PCEvent(_gdb->getPcEventQueue(), "HardBreakpoint Event", pc),

--- 497 unchanged lines hidden ---
556bool
557BaseRemoteGDB::checkBpLen(size_t len)
558{
559 return len == sizeof(MachInst);
560}
561
562BaseRemoteGDB::HardBreakpoint::HardBreakpoint(BaseRemoteGDB *_gdb, Addr pc)
563 : PCEvent(_gdb->getPcEventQueue(), "HardBreakpoint Event", pc),

--- 497 unchanged lines hidden ---