diff options
author | Eugene Tarassov | 2011-12-30 17:55:13 +0000 |
---|---|---|
committer | Eugene Tarassov | 2011-12-30 17:55:13 +0000 |
commit | 93188425e70f3d1a1c256e8d6fc7d1fe230670d6 (patch) | |
tree | 11d462d92c7c87453dfe2efd7532acc611fe082c /agent/tcf/services/symbols_win32.c | |
parent | 866417fda66e11b1686d3e95581f544dea1af9ac (diff) | |
download | org.eclipse.tcf.agent-93188425e70f3d1a1c256e8d6fc7d1fe230670d6.tar.gz org.eclipse.tcf.agent-93188425e70f3d1a1c256e8d6fc7d1fe230670d6.tar.xz org.eclipse.tcf.agent-93188425e70f3d1a1c256e8d6fc7d1fe230670d6.zip |
TCF Agent: implemented remote execution of DWRF expressions; more C++ support in DWARF reader.
Diffstat (limited to 'agent/tcf/services/symbols_win32.c')
-rw-r--r-- | agent/tcf/services/symbols_win32.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/agent/tcf/services/symbols_win32.c b/agent/tcf/services/symbols_win32.c index 3b2c8d7a..0e5a4791 100644 --- a/agent/tcf/services/symbols_win32.c +++ b/agent/tcf/services/symbols_win32.c @@ -121,6 +121,7 @@ static size_t context_extension_offset = 0; static char * tmp_buf = NULL; static int tmp_buf_size = 0; +static LocationInfo * location_info = NULL; #define SYMBOL_MAGIC 0x34875234 @@ -590,6 +591,11 @@ int get_symbol_index_type(const Symbol * sym, Symbol ** type) { return 0; } +int get_symbol_containing_type(const Symbol * sym, Symbol ** containing_type) { + errno = ERR_UNSUPPORTED; + return -1; +} + int get_symbol_length(const Symbol * sym, ContextAddress * length) { DWORD res = 0; Symbol type = *sym; @@ -1136,6 +1142,61 @@ ContextAddress is_plt_section(Context * ctx, ContextAddress addr) { return 0; } +static LocationExpressionCommand * add_location_command(int op) { + LocationExpressionCommand * cmd = NULL; + if (location_info->cmds_cnt >= location_info->cmds_max) { + location_info->cmds_max += 4; + location_info->cmds = (LocationExpressionCommand *)tmp_realloc(location_info->cmds, + sizeof(LocationExpressionCommand) * location_info->cmds_max); + } + cmd = location_info->cmds + location_info->cmds_cnt++; + memset(cmd, 0, sizeof(LocationExpressionCommand)); + cmd->cmd = op; + return cmd; +} + +int get_location_info(const Symbol * sym, LocationInfo ** loc) { + DWORD dword = 0; + SYMBOL_INFO * info = NULL; + + assert(sym->magic == SYMBOL_MAGIC); + *loc = location_info = (LocationInfo *)tmp_alloc_zero(sizeof(LocationInfo)); + + if (sym->address != 0) { + add_location_command(SFT_CMD_NUMBER)->args.num = sym->address; + return 0; + } + + if (sym->base || sym->info) { + errno = ERR_INV_CONTEXT; + return -1; + } + + if (get_type_info(sym, TI_GET_OFFSET, &dword) == 0) { + add_location_command(SFT_CMD_ARG)->args.arg_no = 0; + add_location_command(SFT_CMD_NUMBER)->args.num = dword; + add_location_command(SFT_CMD_ADD); + return 0; + } + + if (get_sym_info(sym, sym->index, &info) < 0) return -1; + + if (is_register(info)) { + set_errno(ERR_INV_CONTEXT, "Register variable"); + return -1; + } + + if (is_frame_relative(info)) { + add_location_command(SFT_CMD_FP); + add_location_command(SFT_CMD_NUMBER)->args.num = info->Address - sizeof(ContextAddress) * 2; + add_location_command(SFT_CMD_ADD); + return 0; + } + + add_location_command(SFT_CMD_NUMBER)->args.num = info->Address; + return 0; +} + int get_stack_tracing_info(Context * ctx, ContextAddress addr, StackTracingInfo ** info) { *info = NULL; return 0; |