headers/bsd: Add sys/queue.h.
[haiku.git] / src / kits / debugger / model / Watchpoint.cpp
blob5c324d00c59952badad018c307eff117a52a8534
1 /*
2 * Copyright 2012, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "Watchpoint.h"
9 Watchpoint::Watchpoint(target_addr_t address, uint32 type, int32 length)
11 fAddress(address),
12 fType(type),
13 fLength(length),
14 fInstalled(false),
15 fEnabled(false)
20 Watchpoint::~Watchpoint()
25 void
26 Watchpoint::SetInstalled(bool installed)
28 fInstalled = installed;
32 void
33 Watchpoint::SetEnabled(bool enabled)
35 fEnabled = enabled;
39 bool
40 Watchpoint::Contains(target_addr_t address) const
42 return address >= fAddress && address <= (fAddress + fLength);
46 int
47 Watchpoint::CompareWatchpoints(const Watchpoint* a, const Watchpoint* b)
49 if (a->Address() < b->Address())
50 return -1;
51 return a->Address() == b->Address() ? 0 : 1;
55 int
56 Watchpoint::CompareAddressWatchpoint(const target_addr_t* address,
57 const Watchpoint* watchpoint)
59 if (*address < watchpoint->Address())
60 return -1;
61 return *address == watchpoint->Address() ? 0 : 1;