1 #ifndef _library__memorysearch__hpp__included__
2 #define _library__memorysearch__hpp__included__
4 #include "memoryspace.hpp"
15 * Context for memory search. Each individual context is independent.
21 * Creates a new memory search context with all addresses.
23 * Parameter space: The memory space.
25 memory_search(memory_space
& space
) throw(std::bad_alloc
);
28 * Reset the context so all addresses are candidates again.
30 void reset() throw(std::bad_alloc
);
33 * This searches the memory space, leaving those addresses for which condition object returns true.
35 * Parameter obj The condition to search for.
37 template<class T
> void search(const T
& obj
) throw();
40 * DQ a range of addresses (inclusive on both ends!).
42 void dq_range(uint64_t first
, uint64_t last
);
45 * Search for all bytes (update values)
47 void update() throw();
50 * Get number of memory addresses that are still candidates
52 uint64_t get_candidate_count() throw();
55 * Returns list of all candidates. This function isn't lazy, so be careful when calling with many candidates.
57 std::list
<uint64_t> get_candidates() throw(std::bad_alloc
);
59 * Is specified address a candidate?
61 bool is_candidate(uint64_t addr
) throw();
63 * Next candidate in VMA.
65 uint64_t cycle_candidate_vma(uint64_t addr
, bool next
) throw();
67 template<typename T
> void s_value(T value
) throw();
68 template<typename T
> void s_difference(T value
) throw();
69 template<typename T
> void s_lt() throw();
70 template<typename T
> void s_le() throw();
71 template<typename T
> void s_eq() throw();
72 template<typename T
> void s_ne() throw();
73 template<typename T
> void s_ge() throw();
74 template<typename T
> void s_gt() throw();
75 template<typename T
> void s_seqlt() throw();
76 template<typename T
> void s_seqle() throw();
77 template<typename T
> void s_seqge() throw();
78 template<typename T
> void s_seqgt() throw();
79 template<typename T
> T
v_read(uint64_t addr
) throw();
80 template<typename T
> T
v_readold(uint64_t addr
) throw();
81 template<typename T
> void v_write(uint64_t addr
, T val
) throw();
83 static bool searchable_region(memory_space::region
* r
)
85 return (r
&& !r
->readonly
&& !r
->special
);
99 void savestate(std::vector
<char>& buffer
, enum savestate_type type
) const;
103 void loadstate(const std::vector
<char>& buffer
);
105 memory_space
& mspace
;
106 std::vector
<uint8_t> previous_content
;
107 std::vector
<uint64_t> still_in
;