Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2017-01-09 16:33:02 -0500
committerEugene Tarassov2017-01-09 16:33:02 -0500
commit74bbaf553d1f05dfc790f6fc8c810555ca06392f (patch)
treec5c6e3c0c2702bcb67b0dcb12e9d55b9ffc8c39f /agent/system/Darwin/tcf/context-darwin.c
parentb27e8148d29b3edd1a7f72de1fe75ae97ed6a0f1 (diff)
downloadorg.eclipse.tcf.agent-74bbaf553d1f05dfc790f6fc8c810555ca06392f.tar.gz
org.eclipse.tcf.agent-74bbaf553d1f05dfc790f6fc8c810555ca06392f.tar.xz
org.eclipse.tcf.agent-74bbaf553d1f05dfc790f6fc8c810555ca06392f.zip
TCF Agent: removed unneeded/unwanted definitions of TRAP_OFFSET
Diffstat (limited to 'agent/system/Darwin/tcf/context-darwin.c')
-rw-r--r--agent/system/Darwin/tcf/context-darwin.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/agent/system/Darwin/tcf/context-darwin.c b/agent/system/Darwin/tcf/context-darwin.c
index a91b59cf..8f8ac9e7 100644
--- a/agent/system/Darwin/tcf/context-darwin.c
+++ b/agent/system/Darwin/tcf/context-darwin.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 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.
@@ -623,23 +623,18 @@ static void event_pid_stopped(pid_t pid, int signal, int event, int syscall) {
ctx->stopped_by_exception = stopped_by_exception;
ctx->stopped = 1;
+ get_PC(ctx, &pc0);
if (EXT(ctx)->regs_error) {
release_error_report(EXT(ctx)->regs_error);
EXT(ctx)->regs_error = NULL;
}
- else {
- pc0 = get_regs_PC(ctx);
- }
-
if (thread_get_state(EXT(ctx)->pid, x86_THREAD_STATE32, EXT(ctx)->regs, &state_count) != KERN_SUCCESS) {
assert(errno != 0);
EXT(ctx)->regs_error = get_error_report(errno);
trace(LOG_ALWAYS, "error: thread_get_state failed; id %s, error %d %s",
ctx->id, errno, errno_to_str(errno));
}
- else {
- pc1 = get_regs_PC(ctx);
- }
+ get_PC(ctx, &pc1);
if (!EXT(ctx)->syscall_enter || EXT(ctx)->regs_error || pc0 != pc1) {
EXT(ctx)->syscall_enter = 0;
@@ -650,11 +645,18 @@ static void event_pid_stopped(pid_t pid, int signal, int event, int syscall) {
trace(LOG_EVENTS, "event: pid %d stopped at PC = %#lx", pid, pc1);
if (signal == SIGTRAP && event == 0 && !syscall) {
+#ifdef TRAP_OFFSET
+ offs = -(TRAP_OFFSET);
+#else
size_t break_size = 0;
get_break_instruction(ctx, &break_size);
- ctx->stopped_by_bp = !EXT(ctx)->regs_error && is_breakpoint_address(ctx, pc1 - break_size);
+ offs = break_size;
+#endif
+ ctx->stopped_by_bp = !EXT(ctx)->regs_error && is_breakpoint_address(ctx, pc1 - offs);
+ if (offs != 0 && ctx->stopped_by_bp && set_PC(ctx, pc1 - offs) < 0) {
+ trace(LOG_ALWAYS, "Cannot adjust PC after breakpoint: %s", errno_to_str(errno));
+ }
EXT(ctx)->end_of_step = !ctx->stopped_by_bp && EXT(ctx)->pending_step;
- if (ctx->stopped_by_bp) set_regs_PC(ctx, pc1 - break_size);
}
EXT(ctx)->pending_step = 0;
send_context_stopped_event(ctx);

Back to the top