MpHash
is a closed hash table, whose entries
are linked lists of MpEntry
entities (see
Section 4.4.3). Each entry represents one
breakpoint or watchpoint. Five types of matchpoint are supported:
BP_MEMORY
literal>. A memory (soft)
breakpoint.
BP_HARDWARE
. A hardware breakpoint
WP_WRITE
. A hardware write watchpoint
WP_READ
. A hardware read watchpoint
WP_ACCESS
. A hardware access (read or write)
watchpoint.
Entries are keyed on both the address and type of the matchpoint. It is quite possible to have both a breakpoint and watchpoint on the same location, but they are separate entities.
Note | |
---|---|
Although all five matchpoint types are supported in the matchpoint table, the current implementation of the GDB server does not provide an implementation for hardware breakpoints or any watchpoints. |
The public interface to MpHash
is as follows:
MpHash
. The constructor. Takes an optional
argument specifying the size of hash table to allocate (default
value 1021). Allocates a new array for the hash table in private
variable hashTab
(an array of pointers to
MpEntry
) and sets all the pointers to
NULL
to mark the table as empty.
~MpHash
. Destructor. Deletes the allocated
hash table.
add
. Adds a new entry to the hash table if
it isn't already there. If it is there already it does nothing.
lookup
. Look for an entry in the hash
table. If the entry is found, return a pointer to its
MpEntry
, if not return
NULL
.
remove
. Remove an entry from the hash
table. Return true
if the entry was found and
deleted, false
otherwise.