remote_gdb.cc (10559:62f5f7363197) remote_gdb.cc (10589:5962812f80fe)
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;

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

515 return true;
516}
517
518PCEventQueue *BaseRemoteGDB::getPcEventQueue()
519{
520 return &system->pcEventQueue;
521}
522
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;

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

515 return true;
516}
517
518PCEventQueue *BaseRemoteGDB::getPcEventQueue()
519{
520 return &system->pcEventQueue;
521}
522
523bool
524BaseRemoteGDB::checkBpLen(size_t len)
525{
526 return len == sizeof(MachInst);
527}
528
523BaseRemoteGDB::HardBreakpoint::HardBreakpoint(BaseRemoteGDB *_gdb, Addr pc)
524 : PCEvent(_gdb->getPcEventQueue(), "HardBreakpoint Event", pc),
525 gdb(_gdb), refcount(0)
526{
527 DPRINTF(GDBMisc, "creating hardware breakpoint at %#x\n", evpc);
528}
529
530void
531BaseRemoteGDB::HardBreakpoint::process(ThreadContext *tc)
532{
533 DPRINTF(GDBMisc, "handling hardware breakpoint at %#x\n", pc());
534
535 if (tc == gdb->context)
536 gdb->trap(SIGTRAP);
537}
538
539bool
540BaseRemoteGDB::insertSoftBreak(Addr addr, size_t len)
541{
529BaseRemoteGDB::HardBreakpoint::HardBreakpoint(BaseRemoteGDB *_gdb, Addr pc)
530 : PCEvent(_gdb->getPcEventQueue(), "HardBreakpoint Event", pc),
531 gdb(_gdb), refcount(0)
532{
533 DPRINTF(GDBMisc, "creating hardware breakpoint at %#x\n", evpc);
534}
535
536void
537BaseRemoteGDB::HardBreakpoint::process(ThreadContext *tc)
538{
539 DPRINTF(GDBMisc, "handling hardware breakpoint at %#x\n", pc());
540
541 if (tc == gdb->context)
542 gdb->trap(SIGTRAP);
543}
544
545bool
546BaseRemoteGDB::insertSoftBreak(Addr addr, size_t len)
547{
542 if (len != sizeof(TheISA::MachInst))
548 if (!checkBpLen(len))
543 panic("invalid length\n");
544
545 return insertHardBreak(addr, len);
546}
547
548bool
549BaseRemoteGDB::removeSoftBreak(Addr addr, size_t len)
550{
549 panic("invalid length\n");
550
551 return insertHardBreak(addr, len);
552}
553
554bool
555BaseRemoteGDB::removeSoftBreak(Addr addr, size_t len)
556{
551 if (len != sizeof(MachInst))
557 if (!checkBpLen(len))
552 panic("invalid length\n");
553
554 return removeHardBreak(addr, len);
555}
556
557bool
558BaseRemoteGDB::insertHardBreak(Addr addr, size_t len)
559{
558 panic("invalid length\n");
559
560 return removeHardBreak(addr, len);
561}
562
563bool
564BaseRemoteGDB::insertHardBreak(Addr addr, size_t len)
565{
560 if (len != sizeof(MachInst))
566 if (!checkBpLen(len))
561 panic("invalid length\n");
562
563 DPRINTF(GDBMisc, "inserting hardware breakpoint at %#x\n", addr);
564
565 HardBreakpoint *&bkpt = hardBreakMap[addr];
566 if (bkpt == 0)
567 bkpt = new HardBreakpoint(this, addr);
568
569 bkpt->refcount++;
570
571 return true;
572}
573
574bool
575BaseRemoteGDB::removeHardBreak(Addr addr, size_t len)
576{
567 panic("invalid length\n");
568
569 DPRINTF(GDBMisc, "inserting hardware breakpoint at %#x\n", addr);
570
571 HardBreakpoint *&bkpt = hardBreakMap[addr];
572 if (bkpt == 0)
573 bkpt = new HardBreakpoint(this, addr);
574
575 bkpt->refcount++;
576
577 return true;
578}
579
580bool
581BaseRemoteGDB::removeHardBreak(Addr addr, size_t len)
582{
577 if (len != sizeof(MachInst))
583 if (!checkBpLen(len))
578 panic("invalid length\n");
579
580 DPRINTF(GDBMisc, "removing hardware breakpoint at %#x\n", addr);
581
582 break_iter_t i = hardBreakMap.find(addr);
583 if (i == hardBreakMap.end())
584 return false;
585

--- 436 unchanged lines hidden ---
584 panic("invalid length\n");
585
586 DPRINTF(GDBMisc, "removing hardware breakpoint at %#x\n", addr);
587
588 break_iter_t i = hardBreakMap.find(addr);
589 if (i == hardBreakMap.end())
590 return false;
591

--- 436 unchanged lines hidden ---