|
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2010 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can | |
4 * be found in the LICENSE file. | |
5 */ | |
6 | |
7 // This module provides an object for handling RSP responsibilities of | |
noelallen_use_chromium
2010/12/07 23:04:44
Is this comment a DUP? It doesn't make clear that
| |
8 // the host side of the connection. The host behaves like a cache, and | |
9 // is responsible for syncronization of state between the Target and Host. | |
10 // For example, the Host is responsible for updating the thread context | |
11 // before restarting the Target, and for updating it's internal array of | |
12 // threads whenever the Target stops. | |
13 | |
14 #ifndef SRC_TRUSTED_GDB_RSP_HOST_MOCK_H_ | |
15 #define SRC_TRUSTED_GDB_RSP_HOST_MOCK_H_ 1 | |
noelallen_use_chromium
2010/12/07 23:04:44
NATIVE_CLIENT_xxx
| |
16 | |
17 #include <list> | |
18 #include <map> | |
19 #include <string> | |
20 #include <vector> | |
21 | |
22 #include "native_client/src/trusted/port/std_types.h" | |
23 | |
24 namespace gdb_rsp { | |
25 | |
26 class Abi; | |
27 class Packet; | |
28 class Session; | |
29 | |
30 class HostMock : public Host { | |
31 public: | |
32 HostMock(); | |
33 ~HostMock(); | |
34 | |
35 /* Mocked functions */ | |
noelallen_use_chromium
2010/12/07 23:04:44
Should probably be '//' we should be consistent on
| |
36 bool Init(); | |
37 bool WaitForBreak(); | |
38 bool Break(); | |
39 bool Detach(); | |
40 bool Step(); | |
41 bool Continue(); | |
42 bool GetMemory(void *dst, uint64_t addr, uint32_t size); | |
43 bool SetMemory(const void *src, uint64_t addr, uint32_t size); | |
44 bool Request(const std::string &req, std::string *resp); | |
45 | |
46 /* Unmocked functions, don't call */ | |
47 bool Update() { | |
48 throw "Not Implemented."; | |
49 return false; | |
50 } | |
51 | |
52 virtual bool HasProperty(const char *name) const { | |
53 throw "Not Implemented."; | |
54 return false; | |
55 } | |
56 | |
57 virtual bool ReadProperty(const char *name, std::string *val) const { | |
58 throw "Not implemented."; | |
59 return false; | |
60 } | |
61 | |
62 virtual bool ReadObject(const char *type, | |
63 const char *name, | |
64 std::string *val) { | |
65 throw "Not implemented."; | |
66 return false; | |
67 } | |
68 | |
69 /* | |
70 * Both a helper, and real function. Use this to populate memory | |
71 * that GetMemory will return. | |
72 */ | |
73 bool SetMemory(const void *src, uint64_t addr, uint32_t size); | |
74 | |
75 /* Helpers for setting up the pseudo thread */ | |
76 Thread* CreateThread(uint32_t id); | |
77 void RemoveThread(uint32_t id); | |
78 | |
79 /* Helpers for target properites */ | |
80 void SetRequest(const std::string &req, const std::string &resp); | |
81 | |
82 | |
83 /* Helpers for queing up pseduo signals */ | |
84 void AddSignal(int32_t signal, uint32_t thread); | |
85 void AddSignalAbs(int32_t signal, uint32_t thread, uint64_t ip); | |
86 void AddSignalDelta(int32_t signal, uint32_t thread, int64_t delta); | |
87 | |
88 | |
89 protected: | |
90 struct SignalMock { | |
noelallen_use_chromium
2010/12/07 23:04:44
What this is fairly obvious we should probably add
| |
91 int32_t sig; | |
92 uint32_t thread; | |
93 uint32_t rel; | |
94 uint64_t ip; | |
95 }; | |
96 std::map<uint64_t, char *> memory_; | |
97 std::list<SignalMock *> signals_; | |
98 PropertyMap_t requests_; | |
99 }; | |
100 | |
101 | |
noelallen_use_chromium
2010/12/07 23:04:44
Too many empty lines. Shouldn't do more than two
| |
102 | |
103 | |
104 } // namespace gdb_rsp | |
105 | |
106 #endif // SRC_TRUSTED_GDB_RSP_HOST_MOCK_H_ | |
107 | |
OLD | NEW |