Index: src/trusted/gdb_rsp/host_mock.h |
=================================================================== |
--- src/trusted/gdb_rsp/host_mock.h (revision 0) |
+++ src/trusted/gdb_rsp/host_mock.h (revision 0) |
@@ -0,0 +1,107 @@ |
+/* |
+ * Copyright 2010 The Native Client Authors. All rights reserved. |
+ * Use of this source code is governed by a BSD-style license that can |
+ * be found in the LICENSE file. |
+ */ |
+ |
+// 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
|
+// the host side of the connection. The host behaves like a cache, and |
+// is responsible for syncronization of state between the Target and Host. |
+// For example, the Host is responsible for updating the thread context |
+// before restarting the Target, and for updating it's internal array of |
+// threads whenever the Target stops. |
+ |
+#ifndef SRC_TRUSTED_GDB_RSP_HOST_MOCK_H_ |
+#define SRC_TRUSTED_GDB_RSP_HOST_MOCK_H_ 1 |
noelallen_use_chromium
2010/12/07 23:04:44
NATIVE_CLIENT_xxx
|
+ |
+#include <list> |
+#include <map> |
+#include <string> |
+#include <vector> |
+ |
+#include "native_client/src/trusted/port/std_types.h" |
+ |
+namespace gdb_rsp { |
+ |
+class Abi; |
+class Packet; |
+class Session; |
+ |
+class HostMock : public Host { |
+ public: |
+ HostMock(); |
+ ~HostMock(); |
+ |
+ /* Mocked functions */ |
noelallen_use_chromium
2010/12/07 23:04:44
Should probably be '//' we should be consistent on
|
+ bool Init(); |
+ bool WaitForBreak(); |
+ bool Break(); |
+ bool Detach(); |
+ bool Step(); |
+ bool Continue(); |
+ bool GetMemory(void *dst, uint64_t addr, uint32_t size); |
+ bool SetMemory(const void *src, uint64_t addr, uint32_t size); |
+ bool Request(const std::string &req, std::string *resp); |
+ |
+ /* Unmocked functions, don't call */ |
+ bool Update() { |
+ throw "Not Implemented."; |
+ return false; |
+ } |
+ |
+ virtual bool HasProperty(const char *name) const { |
+ throw "Not Implemented."; |
+ return false; |
+ } |
+ |
+ virtual bool ReadProperty(const char *name, std::string *val) const { |
+ throw "Not implemented."; |
+ return false; |
+ } |
+ |
+ virtual bool ReadObject(const char *type, |
+ const char *name, |
+ std::string *val) { |
+ throw "Not implemented."; |
+ return false; |
+ } |
+ |
+ /* |
+ * Both a helper, and real function. Use this to populate memory |
+ * that GetMemory will return. |
+ */ |
+ bool SetMemory(const void *src, uint64_t addr, uint32_t size); |
+ |
+ /* Helpers for setting up the pseudo thread */ |
+ Thread* CreateThread(uint32_t id); |
+ void RemoveThread(uint32_t id); |
+ |
+ /* Helpers for target properites */ |
+ void SetRequest(const std::string &req, const std::string &resp); |
+ |
+ |
+ /* Helpers for queing up pseduo signals */ |
+ void AddSignal(int32_t signal, uint32_t thread); |
+ void AddSignalAbs(int32_t signal, uint32_t thread, uint64_t ip); |
+ void AddSignalDelta(int32_t signal, uint32_t thread, int64_t delta); |
+ |
+ |
+ protected: |
+ struct SignalMock { |
noelallen_use_chromium
2010/12/07 23:04:44
What this is fairly obvious we should probably add
|
+ int32_t sig; |
+ uint32_t thread; |
+ uint32_t rel; |
+ uint64_t ip; |
+ }; |
+ std::map<uint64_t, char *> memory_; |
+ std::list<SignalMock *> signals_; |
+ PropertyMap_t requests_; |
+}; |
+ |
+ |
noelallen_use_chromium
2010/12/07 23:04:44
Too many empty lines. Shouldn't do more than two
|
+ |
+ |
+} // namespace gdb_rsp |
+ |
+#endif // SRC_TRUSTED_GDB_RSP_HOST_MOCK_H_ |
+ |
Property changes on: src\trusted\gdb_rsp\host_mock.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |