Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMircea Gherzan2019-10-28 21:12:29 +0000
committerEugene Tarassov2019-10-29 16:33:50 +0000
commite6d55a9d4cec2895c69421fa8b4a2e90ce4f97c0 (patch)
treed64469b539d8a349d21c676824b0f96acf65bdd5 /agent/tcf/services
parentf1dad9e4c02ebdecbbd651b121f74ccd0452733e (diff)
downloadorg.eclipse.tcf.agent-e6d55a9d4cec2895c69421fa8b4a2e90ce4f97c0.tar.gz
org.eclipse.tcf.agent-e6d55a9d4cec2895c69421fa8b4a2e90ce4f97c0.tar.xz
org.eclipse.tcf.agent-e6d55a9d4cec2895c69421fa8b4a2e90ce4f97c0.zip
TCF Agent: make MemoryMap cache-friendly
The "get" command has to run as a cache client. Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com> Change-Id: Ib0ffe8a3a7f80aba4dc1ca92dedf2454f0c211e4
Diffstat (limited to 'agent/tcf/services')
-rw-r--r--agent/tcf/services/memorymap.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/agent/tcf/services/memorymap.c b/agent/tcf/services/memorymap.c
index eb1c70e3..bab8214a 100644
--- a/agent/tcf/services/memorymap.c
+++ b/agent/tcf/services/memorymap.c
@@ -437,25 +437,29 @@ static void write_map_region(OutputStream * out, MemoryRegion * m) {
write_stream(out, '}');
}
-static void command_get(char * token, Channel * c) {
+typedef struct CommandGetArgs {
+ char token[256];
char id[256];
- int err = 0;
+} CommandGetArgs;
+
+static void command_get_cache_client(void * x) {
+ CommandGetArgs * args = (CommandGetArgs *)x;
+ Channel * c = cache_channel();
Context * ctx = NULL;
MemoryMap * client_map = NULL;
MemoryMap * target_map = NULL;
+ int err = 0;
- json_read_string(&c->inp, id, sizeof(id));
- json_test_char(&c->inp, MARKER_EOA);
- json_test_char(&c->inp, MARKER_EOM);
-
- ctx = id2ctx(id);
+ ctx = id2ctx(args->id);
if (ctx == NULL) err = ERR_INV_CONTEXT;
else ctx = get_mem_context(ctx);
if (!err && memory_map_get(ctx, &client_map, &target_map) < 0) err = errno;
+ cache_exit();
+
write_stringz(&c->out, "R");
- write_stringz(&c->out, token);
+ write_stringz(&c->out, args->token);
write_errno(&c->out, err);
if (err) {
write_stringz(&c->out, "null");
@@ -481,6 +485,20 @@ static void command_get(char * token, Channel * c) {
write_stream(&c->out, MARKER_EOM);
}
+static void command_get(char * token, Channel * c) {
+ char id[256];
+ CommandGetArgs args;
+
+ json_read_string(&c->inp, id, sizeof(id));
+ json_test_char(&c->inp, MARKER_EOA);
+ json_test_char(&c->inp, MARKER_EOM);
+
+ strlcpy(args.token, token, sizeof(token));
+ strlcpy(args.id, id, sizeof(args.id));
+
+ cache_enter(command_get_cache_client, c, &args, sizeof(args));
+}
+
static void read_map_attribute(InputStream * inp, const char * name, void * args) {
MemoryRegion * r = (MemoryRegion *)args;
if (strcmp(name, "Addr") == 0) r->addr = (ContextAddress)json_read_uint64(inp);

Back to the top