diff options
author | Benoit Perrin | 2016-04-01 10:40:43 +0000 |
---|---|---|
committer | Eugene Tarassov | 2016-04-04 18:04:36 +0000 |
commit | f52cfca061873a488cfdd3b873aabc6f3b6b40cf (patch) | |
tree | 8db1c829f34c03f10ba1ad940d23a7e82338f88d | |
parent | 69ce4e095f317e124601c657c8d6cd78712c7f1b (diff) | |
download | org.eclipse.tcf.agent-f52cfca061873a488cfdd3b873aabc6f3b6b40cf.tar.gz org.eclipse.tcf.agent-f52cfca061873a488cfdd3b873aabc6f3b6b40cf.tar.xz org.eclipse.tcf.agent-f52cfca061873a488cfdd3b873aabc6f3b6b40cf.zip |
Bug 490893 - Support expressions evaluation APIs without Expressions service
Update Expressions service code to enable the expressions evaluation APIs
without enabling the Expressions service.
Also, add the ability to include the Expressions service in a value add
if required with limited functionality, for now, compared to the case
it is located in the agent: unable to write expression value to
registers ...
Signed-off-by: Benoit Perrin <benoit.perrin@windriver.com>
-rw-r--r-- | agent/tcf/config.h | 4 | ||||
-rw-r--r-- | agent/tcf/services/expressions.c | 43 | ||||
-rw-r--r-- | agent/tcf/services/expressions.h | 10 | ||||
-rw-r--r-- | server/tcf/config.h | 6 | ||||
-rw-r--r-- | server/tcf/main/server.c | 6 |
5 files changed, 52 insertions, 17 deletions
diff --git a/agent/tcf/config.h b/agent/tcf/config.h index a55f4d47..7a847a34 100644 --- a/agent/tcf/config.h +++ b/agent/tcf/config.h @@ -202,6 +202,10 @@ # define ENABLE_LineNumbers (ENABLE_LineNumbersProxy || SERVICE_LineNumbers) #endif +#if !defined(ENABLE_Expressions) +# define ENABLE_Expressions (SERVICE_Expressions) +#endif + #if !defined(ENABLE_ELF) # define ENABLE_ELF (TARGET_UNIX && (SERVICE_Symbols || SERVICE_LineNumbers)) #endif diff --git a/agent/tcf/services/expressions.c b/agent/tcf/services/expressions.c index 568b25a9..5c8d2708 100644 --- a/agent/tcf/services/expressions.c +++ b/agent/tcf/services/expressions.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2016 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. @@ -27,7 +27,11 @@ #include <tcf/config.h> -#if SERVICE_Expressions +#if !defined(ENABLE_Expressions) +# define ENABLE_Expressions (SERVICE_Expressions) +#endif + +#if ENABLE_Expressions #include <stdlib.h> #include <stdarg.h> @@ -3786,6 +3790,9 @@ static int evaluate_script(int mode, char * s, int load, Value * v) { } int evaluate_expression(Context * ctx, int frame, ContextAddress addr, char * s, int load, Value * v) { +#if !defined(SERVICE_Expressions) + big_endian = big_endian_host(); +#endif expression_context = ctx; expression_frame = frame; expression_addr = addr; @@ -3832,6 +3839,8 @@ int value_to_double(Value * v, double *res) { return 0; } +#if SERVICE_Expressions + /********************** Commands **************************/ typedef struct CommandArgs { @@ -4139,7 +4148,7 @@ static void command_get_context(char * token, Channel * c) { cache_enter(get_context_cache_client, c, &args, sizeof(args)); } -#if ENABLE_Symbols && SERVICE_StackTrace +#if ENABLE_Symbols && (SERVICE_StackTrace || ENABLE_ContextProxy) static int sym_cnt = 0; static int sym_max = 0; @@ -4161,7 +4170,7 @@ static void get_children_cache_client(void * x) { int err = 0; /* TODO: Expressions.getChildren - structures */ -#if ENABLE_Symbols && SERVICE_StackTrace +#if ENABLE_Symbols && (SERVICE_StackTrace || ENABLE_ContextProxy) char parent_id[256]; { Context * ctx; @@ -4195,7 +4204,7 @@ static void get_children_cache_client(void * x) { write_errno(&c->out, err); write_stream(&c->out, '['); -#if ENABLE_Symbols && SERVICE_StackTrace +#if ENABLE_Symbols && (SERVICE_StackTrace || ENABLE_ContextProxy) { int i; for (i = 0; i < sym_cnt; i++) { @@ -4696,6 +4705,8 @@ static void on_channel_close(Channel * c) { } } +#endif /* SERVICE_Expressions */ + void add_identifier_callback(ExpressionIdentifierCallBack * callback) { if (id_callback_cnt >= id_callback_max) { id_callback_max += 8; @@ -4705,6 +4716,8 @@ void add_identifier_callback(ExpressionIdentifierCallBack * callback) { id_callbacks[id_callback_cnt++] = callback; } +#if SERVICE_Expressions + #if ENABLE_FuncCallInjection static void context_intercepted(Context * ctx, void * args) { LINK * l = func_call_state.next; @@ -4724,16 +4737,21 @@ static void context_intercepted(Context * ctx, void * args) { #endif void ini_expressions_service(Protocol * proto) { - unsigned i; + static int init = 0; + if (init == 0) { + unsigned i; #if ENABLE_FuncCallInjection - static RunControlEventListener rc_listener = { context_intercepted, NULL }; - add_run_control_event_listener(&rc_listener, NULL); + static RunControlEventListener rc_listener = { context_intercepted, NULL }; + add_run_control_event_listener(&rc_listener, NULL); #endif #if ENABLE_ExpressionSerialization - list_init(&cmd_queue); + list_init(&cmd_queue); #endif - for (i = 0; i < ID2EXP_HASH_SIZE; i++) list_init(id2exp + i); - add_channel_close_listener(on_channel_close); + for (i = 0; i < ID2EXP_HASH_SIZE; i++) list_init(id2exp + i); + add_channel_close_listener(on_channel_close); + big_endian = big_endian_host(); + init = 1; + } add_command_handler(proto, EXPRESSIONS, "getContext", command_get_context); add_command_handler(proto, EXPRESSIONS, "getChildren", command_get_children); add_command_handler(proto, EXPRESSIONS, "create", command_create); @@ -4741,8 +4759,7 @@ void ini_expressions_service(Protocol * proto) { add_command_handler(proto, EXPRESSIONS, "evaluate", command_evaluate); add_command_handler(proto, EXPRESSIONS, "assign", command_assign); add_command_handler(proto, EXPRESSIONS, "dispose", command_dispose); - - big_endian = big_endian_host(); } #endif /* if SERVICE_Expressions */ +#endif /* if ENABLE_Expressions */ diff --git a/agent/tcf/services/expressions.h b/agent/tcf/services/expressions.h index b1b52ccf..cb8a6b6b 100644 --- a/agent/tcf/services/expressions.h +++ b/agent/tcf/services/expressions.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2016 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. @@ -25,7 +25,11 @@ #include <tcf/framework/context.h> #include <tcf/services/symbols.h> -#if SERVICE_Expressions +#if !defined(ENABLE_Expressions) +# define ENABLE_Expressions (SERVICE_Expressions) +#endif + +#if ENABLE_Expressions /* Expression evaluation modes: */ #define EXPRESSION_MODE_NORMAL 0 /* All attributes of expression value are computed */ @@ -117,6 +121,6 @@ extern void add_identifier_callback(ExpressionIdentifierCallBack * callback); extern void ini_expressions_service(Protocol * proto); -#endif /* SERVICE_Expressions */ +#endif /* ENABLE_Expressions */ #endif /* D_expressions */ diff --git a/server/tcf/config.h b/server/tcf/config.h index 8f31d92a..f4815849 100644 --- a/server/tcf/config.h +++ b/server/tcf/config.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2014 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2016 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. @@ -86,6 +86,10 @@ # define ENABLE_LineNumbers (ENABLE_LineNumbersProxy || SERVICE_LineNumbers) #endif +#if !defined(ENABLE_Expressions) +# define ENABLE_Expressions (SERVICE_Expressions) +#endif + #if !defined(ENABLE_MemoryMap) # define ENABLE_MemoryMap ((ENABLE_DebugContext && ENABLE_ContextProxy) || SERVICE_MemoryMap) #endif diff --git a/server/tcf/main/server.c b/server/tcf/main/server.c index 0c723a50..881d44e4 100644 --- a/server/tcf/main/server.c +++ b/server/tcf/main/server.c @@ -23,6 +23,9 @@ #include <tcf/framework/json.h> #include <tcf/framework/myalloc.h> #include <tcf/framework/proxy.h> +#if SERVICE_Expressions +#include <tcf/services/expressions.h> +#endif #include <tcf/services/linenumbers.h> #include <tcf/services/symbols.h> #include <tcf/services/pathmap.h> @@ -125,6 +128,9 @@ static void channel_redirection_listener(Channel * host, Channel * target) { #if SERVICE_Disassembly if (!service_da) ini_disassembly_service(host->protocol); #endif +#if SERVICE_Expressions + ini_expressions_service(host->protocol); +#endif #if ENABLE_DebugContext && ENABLE_ContextProxy create_context_proxy(host, target, forward_pm); #endif |