Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2017-01-09 16:24:29 -0500
committerEugene Tarassov2017-01-09 16:24:29 -0500
commitb27e8148d29b3edd1a7f72de1fe75ae97ed6a0f1 (patch)
tree874670c5c3012b07b5468c641004e06365dbfacc
parent9139b665476795a63f21163846cd23f0ce5616c8 (diff)
downloadorg.eclipse.tcf.agent-b27e8148d29b3edd1a7f72de1fe75ae97ed6a0f1.tar.gz
org.eclipse.tcf.agent-b27e8148d29b3edd1a7f72de1fe75ae97ed6a0f1.tar.xz
org.eclipse.tcf.agent-b27e8148d29b3edd1a7f72de1fe75ae97ed6a0f1.zip
TCF Agent: fixed MSVC warnings: declaration of '...' hides global declaration
-rw-r--r--agent/tcf/services/processes.c10
-rw-r--r--agent/tcf/services/profiler_sst.c39
-rw-r--r--agent/tcf/services/symbols_common.c3
3 files changed, 27 insertions, 25 deletions
diff --git a/agent/tcf/services/processes.c b/agent/tcf/services/processes.c
index d0da6377..0f9c1f85 100644
--- a/agent/tcf/services/processes.c
+++ b/agent/tcf/services/processes.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2014 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2017 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.
@@ -1102,11 +1102,11 @@ static int start_process_imp(Channel * c, char ** envp, const char * dir, const
hi = (SYSTEM_HANDLE_INFORMATION *)tmp_realloc(hi, size);
}
if (status == 0) {
- ULONG i;
+ ULONG l;
DWORD id = GetCurrentProcessId();
- for (i = 0; i < hi->Count; i++) {
- if (hi->Handles[i].ProcessId != id) continue;
- SetHandleInformation((HANDLE)(uintptr_t)hi->Handles[i].Handle, HANDLE_FLAG_INHERIT, FALSE);
+ for (l = 0; l < hi->Count; l++) {
+ if (hi->Handles[l].ProcessId != id) continue;
+ SetHandleInformation((HANDLE)(uintptr_t)hi->Handles[l].Handle, HANDLE_FLAG_INHERIT, FALSE);
}
}
else {
diff --git a/agent/tcf/services/profiler_sst.c b/agent/tcf/services/profiler_sst.c
index fa4f460c..56037527 100644
--- a/agent/tcf/services/profiler_sst.c
+++ b/agent/tcf/services/profiler_sst.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Xilinx, Inc. and others.
+ * Copyright (c) 2013, 2017 Xilinx, 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.
@@ -77,8 +77,8 @@ static size_t context_extension_offset = 0;
#define link_core2prf(x) ((ProfilerSST *)((char *)(x) - offsetof(ProfilerSST, link_core)))
#define EXT(ctx) ((ContextExtensionPrfSST *)((char *)(ctx) + context_extension_offset))
-static ContextAddress * buf;
-static unsigned buf_pos;
+static ContextAddress * stk_buf;
+static unsigned stk_buf_pos;
static void get_stack_trace(ProfilerSST * prf) {
StackFrame * info = NULL;
@@ -92,37 +92,37 @@ static void get_stack_trace(ProfilerSST * prf) {
if (info == NULL) return;
reg_pc = get_PC_definition(prf->ctx);
if (read_reg_value(info, reg_pc, &pc) < 0) return;
- buf = (ContextAddress *)tmp_alloc(sizeof(ContextAddress) * buf_max);
- buf[buf_pos++] = (ContextAddress)pc;
- while (buf_pos < buf_max) {
+ stk_buf = (ContextAddress *)tmp_alloc(sizeof(ContextAddress) * buf_max);
+ stk_buf[stk_buf_pos++] = (ContextAddress)pc;
+ while (stk_buf_pos < buf_max) {
frame = get_prev_frame(prf->ctx, frame);
get_frame_info(prf->ctx, frame, &info);
if (info == NULL) break;
if (read_reg_value(info, reg_pc, &pc) < 0) break;
- buf[buf_pos++] = (ContextAddress)pc;
+ stk_buf[stk_buf_pos++] = (ContextAddress)pc;
}
}
static SampleStackTrace * find_stack_trace(ProfilerSST * prf) {
SampleStackTrace * stk = NULL;
- if (buf_pos > 0) {
+ if (stk_buf_pos > 0) {
unsigned i = 0;
unsigned h = 0;
- for (i = 0; i < buf_pos; i++) {
- h = (h + (unsigned)(buf[i] >> 4)) % STRACE_HASH_SIZE;
+ for (i = 0; i < stk_buf_pos; i++) {
+ h = (h + (unsigned)(stk_buf[i] >> 4)) % STRACE_HASH_SIZE;
}
stk = prf->strace_hash[h];
while (stk != NULL) {
- if (stk->len == buf_pos && memcmp(stk->pc, buf, buf_pos * sizeof(ContextAddress)) == 0) {
+ if (stk->len == stk_buf_pos && memcmp(stk->pc, stk_buf, stk_buf_pos * sizeof(ContextAddress)) == 0) {
return stk;
}
stk = stk->next;
}
- stk = (SampleStackTrace *)loc_alloc_zero(sizeof(SampleStackTrace) + sizeof(ContextAddress) * (buf_pos - 1));
- memcpy(stk->pc, buf, buf_pos * sizeof(ContextAddress));
+ stk = (SampleStackTrace *)loc_alloc_zero(sizeof(SampleStackTrace) + sizeof(ContextAddress) * (stk_buf_pos - 1));
+ memcpy(stk->pc, stk_buf, stk_buf_pos * sizeof(ContextAddress));
stk->next = prf->strace_hash[h];
prf->strace_hash[h] = stk;
- stk->len = buf_pos;
+ stk->len = stk_buf_pos;
}
return stk;
}
@@ -155,20 +155,23 @@ static void add_to_sample_array(ProfilerSST * prf, ContextAddress pc, SampleStac
static void add_sample_cache_client(void * x) {
ProfilerSST * prf = *(ProfilerSST **)x;
- buf_pos = 0;
- buf = NULL;
+ int error = 0;
+ stk_buf_pos = 0;
+ stk_buf = NULL;
if (prf->frame_cnt > 1) {
if (!prf->ctx->stopped) {
prf->stop_pending = 1;
context_stop(prf->ctx);
}
+ else if (get_PC(prf->ctx, &prf->pc) < 0) {
+ error = errno;
+ }
else {
- prf->pc = get_regs_PC(prf->ctx);
get_stack_trace(prf);
}
}
cache_exit();
- if (!prf->disposed && !prf->stop_pending) {
+ if (error == 0 && !prf->disposed && !prf->stop_pending) {
SampleStackTrace * stk = find_stack_trace(prf);
add_to_sample_array(prf, prf->pc, stk);
}
diff --git a/agent/tcf/services/symbols_common.c b/agent/tcf/services/symbols_common.c
index be0ab5ca..579cdda3 100644
--- a/agent/tcf/services/symbols_common.c
+++ b/agent/tcf/services/symbols_common.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2016 Wind River Systems, Inc. and others.
+ * Copyright (c) 2012, 2017 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.
@@ -79,7 +79,6 @@ int get_symbol_address(const Symbol * sym, ContextAddress * address) {
}
int get_symbol_offset(const Symbol * sym, ContextAddress * offset) {
- LocationInfo * loc_info = NULL;
if (get_location_info(sym, &loc_info) < 0) return -1;
if (loc_info->args_cnt == 1) {
/* Relative location. Only static offset can be returned.

Back to the top