Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2018-10-12 17:38:52 +0000
committerEugene Tarassov2018-10-12 17:38:52 +0000
commitfbec6a75581fb9f538993aabd6ba52a8673a4a3f (patch)
treeae793187ee9ef4b0d998358141aca69f674765e9
parent3443602041c2dd032038c3d018b8f80938f102c7 (diff)
downloadorg.eclipse.tcf.agent-fbec6a75581fb9f538993aabd6ba52a8673a4a3f.tar.gz
org.eclipse.tcf.agent-fbec6a75581fb9f538993aabd6ba52a8673a4a3f.tar.xz
org.eclipse.tcf.agent-fbec6a75581fb9f538993aabd6ba52a8673a4a3f.zip
TCF Agent: context dispatcher: better default for context_write_mem/context_read_mem
-rw-r--r--agent/tcf/framework/context-dispatcher.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/agent/tcf/framework/context-dispatcher.c b/agent/tcf/framework/context-dispatcher.c
index e3a04b5a..ffd25e5b 100644
--- a/agent/tcf/framework/context-dispatcher.c
+++ b/agent/tcf/framework/context-dispatcher.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2016 Wind River Systems, Inc. and others.
+ * Copyright (c) 2013-2018 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -31,6 +31,10 @@ static MemoryErrorInfo mem_err_info;
static int get_err_info_errno;
#endif
+#if ENABLE_MemoryAccessModes
+static MemoryAccessMode def_mem_access_mode = { 0, 0, 0, 0 };
+#endif
+
static size_t context_extension_offset = 0;
/* Set memory error info structure. Each underlying context (TOS, physical context) handles its
@@ -132,13 +136,29 @@ int context_single_step(Context * ctx) {
int context_write_mem(Context * ctx, ContextAddress address, void * buf, size_t size) {
ContextExtensionMux * ext = EXT(ctx);
- if (ext->ctx_iface == NULL || ext->ctx_iface->context_write_mem == NULL) return set_mem_error_info_unsupported(size);
+ if (ext->ctx_iface == NULL) return set_mem_error_info_unsupported(size);
+ if (ext->ctx_iface->context_write_mem == NULL) {
+#if ENABLE_MemoryAccessModes
+ if (ext->ctx_iface->context_write_mem_ext != NULL) {
+ return set_mem_error_info(ext, ext->ctx_iface->context_write_mem_ext(ctx, &def_mem_access_mode, address, buf, size));
+ }
+#endif
+ return set_mem_error_info_unsupported(size);
+ }
return set_mem_error_info(ext, ext->ctx_iface->context_write_mem(ctx, address, buf, size));
}
int context_read_mem(Context * ctx, ContextAddress address, void * buf, size_t size) {
ContextExtensionMux * ext = EXT(ctx);
- if (ext->ctx_iface == NULL || ext->ctx_iface->context_read_mem == NULL) return set_mem_error_info_unsupported(size);
+ if (ext->ctx_iface == NULL) return set_mem_error_info_unsupported(size);
+ if (ext->ctx_iface->context_read_mem == NULL) {
+#if ENABLE_MemoryAccessModes
+ if (ext->ctx_iface->context_read_mem_ext != NULL) {
+ return set_mem_error_info(ext, ext->ctx_iface->context_read_mem_ext(ctx, &def_mem_access_mode, address, buf, size));
+ }
+#endif
+ return set_mem_error_info_unsupported(size);
+ }
return set_mem_error_info(ext, ext->ctx_iface->context_read_mem(ctx, address, buf, size));
}

Back to the top