Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-02-21 23:30:09 -0500
committerEugene Tarassov2013-02-21 23:30:09 -0500
commit676ca676eeb8a8afc0b0b34ad23ca918cd5f1849 (patch)
treea563d1cc0216ecd11bbe9c3b0f360d39d44a8a8f
parente0f4b918b1f2e8068acdc0b0b993058b325d3ebe (diff)
downloadorg.eclipse.tcf.agent-676ca676eeb8a8afc0b0b34ad23ca918cd5f1849.tar.gz
org.eclipse.tcf.agent-676ca676eeb8a8afc0b0b34ad23ca918cd5f1849.tar.xz
org.eclipse.tcf.agent-676ca676eeb8a8afc0b0b34ad23ca918cd5f1849.zip
TCF Agent: fixed: LineNumbers proxy returns error when client does not provide LineNumber service, it should return empty list of areas instead
-rw-r--r--agent/tcf/services/linenumbers_proxy.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/agent/tcf/services/linenumbers_proxy.c b/agent/tcf/services/linenumbers_proxy.c
index 7b55d6bf..7689af2d 100644
--- a/agent/tcf/services/linenumbers_proxy.c
+++ b/agent/tcf/services/linenumbers_proxy.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2013 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.
@@ -42,6 +42,7 @@ typedef struct LineNumbersCache {
Channel * channel;
LINK link_root;
LINK link_entries[HASH_SIZE];
+ int service_available;
} LineNumbersCache;
/* Cache entry */
@@ -67,6 +68,8 @@ typedef struct LineNumbersCacheEntry {
#define root2cache(A) ((LineNumbersCache *)((char *)(A) - offsetof(LineNumbersCache, link_root)))
#define cache2entry(A) ((LineNumbersCacheEntry *)((char *)(A) - offsetof(LineNumbersCacheEntry, link_cache)))
+static const char * LINENUMBERS = "LineNumbers";
+
static LINK root = TCF_LIST_INIT(root);
static int code_area_cnt = 0;
@@ -130,6 +133,9 @@ static LineNumbersCache * get_line_numbers_cache(void) {
list_init(cache->link_entries + i);
}
channel_lock(c);
+ for (i = 0; i < c->peer_service_cnt; i++) {
+ if (strcmp(c->peer_service_list[i], LINENUMBERS) == 0) cache->service_available = 1;
+ }
}
return cache;
}
@@ -218,6 +224,11 @@ int line_to_address(Context * ctx, char * file, int line, int column,
h = calc_hash(ctx, file, line, column, 0);
cache = get_line_numbers_cache();
assert(cache->magic == LINE_NUMBERS_CACHE_MAGIC);
+ if (!cache->service_available) {
+ clear_trap(&trap);
+ return 0;
+ }
+
for (l = cache->link_entries[h].next; l != cache->link_entries + h; l = l->next) {
LineNumbersCacheEntry * c = cache2entry(l);
if (c->ctx == ctx && c->line == line && c->column == column && c->file && strcmp(c->file, file) == 0) {
@@ -279,6 +290,11 @@ int address_to_line(Context * ctx, ContextAddress addr0, ContextAddress addr1, L
h = calc_hash(ctx, NULL, 0, 0, addr0);
cache = get_line_numbers_cache();
assert(cache->magic == LINE_NUMBERS_CACHE_MAGIC);
+ if (!cache->service_available) {
+ clear_trap(&trap);
+ return 0;
+ }
+
for (l = cache->link_entries[h].next; l != cache->link_entries + h; l = l->next) {
LineNumbersCacheEntry * c = cache2entry(l);
if (c->ctx == ctx && c->file == NULL && c->addr0 == addr0 && c->addr1 == addr1) {

Back to the top