Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--agent/tcf/services/symbols_elf.c31
-rw-r--r--server/tcf/services/context-proxy.c5
2 files changed, 15 insertions, 21 deletions
diff --git a/agent/tcf/services/symbols_elf.c b/agent/tcf/services/symbols_elf.c
index 41d6625f..ded5d7ad 100644
--- a/agent/tcf/services/symbols_elf.c
+++ b/agent/tcf/services/symbols_elf.c
@@ -757,18 +757,12 @@ static int symbol_equ_comparator(const void * x, const void * y) {
static int symbol_prt_comparator(const void * x, const void * y) {
Symbol * sx = *(Symbol **)x;
Symbol * sy = *(Symbol **)y;
- int sx_addr = 0;
- int sy_addr = 0;
+ int sx_addr = has_symbol_address(sx);
+ int sy_addr = has_symbol_address(sy);
/* symbols with no address have lower priority */
-
- if (has_symbol_address(sx))
- sx_addr = 1;
- if (has_symbol_address(sy))
- sy_addr = 1;
-
- if ((sx_addr) && (!sy_addr)) return +1;
- if ((sy_addr) && (!sx_addr)) return -1;
+ if (sx_addr && !sy_addr) return +1;
+ if (sy_addr && !sx_addr) return -1;
/* Symbols order by priority, from low to high,
* most likely match must be last */
@@ -1135,7 +1129,6 @@ static void find_by_name_in_sym_table(ELF_File * file, const char * name, int gl
}
int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char * name, Symbol ** res) {
-#define CONTINUE_SEARCH (error == 0 && (find_symbol_list == NULL || has_symbol_list_no_location_info()))
int error = 0;
ELF_File * curr_file = NULL;
@@ -1159,7 +1152,9 @@ int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char
}
}
- if (CONTINUE_SEARCH) {
+ assert(sym_ctx == ctx);
+
+ if (error == 0 && has_symbol_list_no_location_info()) {
/* Search in pub names of the current file */
ELF_File * file = elf_list_first(sym_ctx, sym_ip, sym_ip);
if (file == NULL) error = errno;
@@ -1182,7 +1177,7 @@ int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char
elf_list_done(sym_ctx);
}
- if (CONTINUE_SEARCH) {
+ if (error == 0 && has_symbol_list_no_location_info()) {
/* Check if the name is one of well known C/C++ names */
Trap trap;
if (set_trap(&trap)) {
@@ -1232,7 +1227,7 @@ int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char
}
}
- if (CONTINUE_SEARCH) {
+ if (error == 0 && has_symbol_list_no_location_info()) {
/* Search in pub names of all other files */
ELF_File * file = elf_list_first(sym_ctx, 0, ~(ContextAddress)0);
if (file == NULL) error = errno;
@@ -1265,7 +1260,7 @@ int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char
elf_list_done(sym_ctx);
}
- if (CONTINUE_SEARCH) {
+ if (error == 0 && has_symbol_list_no_location_info()) {
unsigned i = 0;
while (type_pseudo_symbols[i].name) {
if (strcmp(name, type_pseudo_symbols[i].name) == 0) {
@@ -1282,7 +1277,7 @@ int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char
}
#if defined(_WRS_KERNEL)
- if (error == 0 && find_symbol_list == NULL) {
+ if (error == 0 && has_symbol_list_no_location_info()) {
char * ptr;
SYM_TYPE type;
@@ -1336,7 +1331,7 @@ int find_symbol_in_scope(Context * ctx, int frame, ContextAddress ip, Symbol * s
find_symbol_list = NULL;
if (get_sym_context(ctx, frame, ip) < 0) error = errno;
- if (!error && scope == NULL && sym_ip != 0) {
+ if (error == 0 && scope == NULL && sym_ip != 0) {
Trap trap;
if (set_trap(&trap)) {
ELF_File * file = NULL;
@@ -1357,7 +1352,7 @@ int find_symbol_in_scope(Context * ctx, int frame, ContextAddress ip, Symbol * s
}
}
- if (!error && find_symbol_list == NULL && scope != NULL && scope->obj != NULL) {
+ if (error == 0 && find_symbol_list == NULL && scope != NULL && scope->obj != NULL) {
Trap trap;
if (set_trap(&trap)) {
find_in_object_tree(scope->obj, 2, NULL, name);
diff --git a/server/tcf/services/context-proxy.c b/server/tcf/services/context-proxy.c
index a0e5e2ac..46fda0a0 100644
--- a/server/tcf/services/context-proxy.c
+++ b/server/tcf/services/context-proxy.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2014 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.
@@ -1430,12 +1430,11 @@ static ContextCache * get_memory_map_cache(Context * ctx) {
Channel * c = cache->peer->target;
Trap trap;
+ assert(cache->ctx == ctx);
if (!set_trap(&trap)) return NULL;
if (is_channel_closed(c)) exception(ERR_CHANNEL_CLOSED);
if (cache->peer != NULL && !cache->peer->rc_done) cache_wait(&cache->peer->rc_cache);
- cache = *EXT(ctx);
- assert(cache->ctx == ctx);
if (cache->pending_get_mmap != NULL) cache_wait(&cache->mmap_cache);
if (cache->mmap_is_valid == 0 && cache->peer != NULL) {
cache->pending_get_mmap = protocol_send_command(c, MEMORY_MAP, "get", validate_memory_map_cache, cache);

Back to the top