Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: experimental/windows_debugger/debugger/core/debuggee_process_mock.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #ifndef DEBUGGER_CORE_DEBUGGEE_PROCESS_MOCK_H_
5 #define DEBUGGER_CORE_DEBUGGEE_PROCESS_MOCK_H_
6 #include <deque>
7 #include "debugger/core/debug_event.h"
8 #include "debugger/core/debuggee_iprocess.h"
9
10 namespace debug {
11 /// Mock of DebuggeeProcess.
12 ///
13 /// Used in DebuggeeBreakpoint and DebuggeeThread unit tests.
14 /// Provides ReadMemory and WriteMemory methods that access
15 /// internal buffer, not debuggee process memory.
16 /// Other methods are stubs.
17 class DebuggeeProcessMock : public IDebuggeeProcess {
18 public:
19 /// Mock memory buffer is filled with this character.
20 static const unsigned char kFillChar = 0xA7;
21 static const int kMemSize = 1000;
22
23 /// Fills mock memory buffer is filled with kFillChar.
24 explicit DebuggeeProcessMock(DebugAPI* debug_api);
25
26 virtual DebugAPI& debug_api() { return *debug_api_; }
27
28 /// Reads bytes from |buff_|.
29 /// @return false if it tries to read outside of |buff_|.
30 virtual bool ReadMemory(const void* addr, size_t size, void* destination);
31
32 /// Writes bytes to |buff_|.
33 /// @return false if it tries to write outside of |buff_|.
34 virtual bool WriteMemory(const void* addr, size_t size, const void* source);
35
36 virtual int id() const { return 0;}
37 virtual State state() const { return kDead; }
38 virtual bool IsHalted() const { return kHalted == state(); }
39 virtual const DebugEvent& last_debug_event() const { return debug_event_; }
40 virtual void* nexe_mem_base() const { return nexe_mem_base_; }
41 virtual void set_nexe_mem_base(void* addr) { nexe_mem_base_ = addr; }
42 virtual void* nexe_entry_point() const { return nexe_entry_point_; }
43 virtual void set_nexe_entry_point(void* addr) { nexe_entry_point_ = addr; }
44 virtual int GetWordSizeInBits() { return 0; }
45 virtual bool IsWoW() { return 0;}
46 virtual bool Continue() { return false; }
47 virtual bool ContinueAndPassExceptionToDebuggee() { return false; }
48 virtual bool SingleStep() { return false; }
49 virtual bool Break() { return false; }
50 virtual bool Kill() { return false; }
51 virtual bool Detach() { return false; }
52 virtual DebuggeeThread* GetThread(int id) { return NULL; }
53 virtual DebuggeeThread* GetHaltedThread() { return NULL; }
54 virtual void GetThreadIds(std::deque<int>* threads) const {}
55 virtual bool SetBreakpoint(void* addr) { return false; }
56 virtual bool RemoveBreakpoint(void* addr) { return false; }
57 virtual Breakpoint* GetBreakpoint(void* addr) { return NULL; }
58 virtual void GetBreakpoints(std::deque<Breakpoint*>* breakpoints) {}
59 virtual void OnDebugEvent(DebugEvent* debug_event) {}
60 virtual DebuggeeThread* AddThread(int id, HANDLE handle) { return NULL; }
61 virtual void* FromNexeToFlatAddress(void* ptr) const { return NULL; }
62
63 private:
64 char buff_[kMemSize];
65 DebugAPI* debug_api_;
66 void* nexe_mem_base_;
67 void* nexe_entry_point_;
68 DebugEvent debug_event_;
69 };
70
71 } // namespace debug
72
73 #endif // DEBUGGER_CORE_DEBUGGEE_PROCESS_MOCK_H_
74
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698