Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Lerner2012-03-14 01:40:22 +0000
committerEugene Tarassov2012-03-26 17:23:53 +0000
commitc6474fc26b1888e2197e4bbda8927a1442420cd7 (patch)
tree27e1d3fa95ffb8d0906082014fecc9e753246dae /agent/system/GNU/Linux/tcf/context-linux.c
parente03ef06ec0630c26fec412b27df0e1b491d4addb (diff)
downloadorg.eclipse.tcf.agent-c6474fc26b1888e2197e4bbda8927a1442420cd7.tar.gz
org.eclipse.tcf.agent-c6474fc26b1888e2197e4bbda8927a1442420cd7.tar.xz
org.eclipse.tcf.agent-c6474fc26b1888e2197e4bbda8927a1442420cd7.zip
linux: Generalize for additional processor architectures
This commit makes 2 changes that enables adding support for new processor types: 1) the next value of the PC to use to continue after trap breakpoint must be adjusted differently depending on the processor architecture. It is not always the (pc-break_size) value where pc is from retrieved registers on all architectures. The code was changed to adjust the pc by a per-architecture defined value 'TRAP_OFFSET' 2) retrieving registers after receiving PTRACE_EVENT_EXIT is not allowed on some architectures and should not be tried on any architecture. Signed-off-by: Dave Lerner <dave.lerner@windriver.com> Signed-off-by: Eugene Tarassov<eugene.tarassov@windriver.com>
Diffstat (limited to 'agent/system/GNU/Linux/tcf/context-linux.c')
-rw-r--r--agent/system/GNU/Linux/tcf/context-linux.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/agent/system/GNU/Linux/tcf/context-linux.c b/agent/system/GNU/Linux/tcf/context-linux.c
index e9da67d6..2101ad05 100644
--- a/agent/system/GNU/Linux/tcf/context-linux.c
+++ b/agent/system/GNU/Linux/tcf/context-linux.c
@@ -50,6 +50,17 @@
#include <tcf/services/tcf_elf.h>
#include <system/GNU/Linux/tcf/regset.h>
+#if !defined(TRAP_OFFSET)
+#define TRAP_OFFSET -1
+#endif
+
+#if !defined(PTRACE_GETFPXREGS) && !defined(PT_GETFPXREGS)
+#define PTRACE_GETFPXREGS 18
+#endif
+#if !defined(PTRACE_SETFPXREGS) && !defined(PT_SETFPXREGS)
+#define PTRACE_SETFPXREGS 19
+#endif
+
#if !defined(PTRACE_SETOPTIONS)
#define PTRACE_SETOPTIONS 0x4200
#define PTRACE_GETEVENTMSG 0x4201
@@ -1214,6 +1225,11 @@ static void event_pid_stopped(pid_t pid, int signal, int event, int syscall) {
pc0 = get_regs_PC(ctx);
}
+#if defined(__powerpc__) || defined(__powerpc64__)
+ /* Don't retrieve registers from an exiting process,
+ causes kernel critical messages */
+ if (event != PTRACE_EVENT_EXIT)
+#endif
memset(ext->regs_valid, 0, sizeof(REG_SET));
pc1 = get_regs_PC(ctx);
@@ -1262,9 +1278,9 @@ static void event_pid_stopped(pid_t pid, int signal, int event, int syscall) {
if (signal == SIGTRAP && event == 0 && !syscall) {
size_t break_size = 0;
get_break_instruction(ctx, &break_size);
- ctx->stopped_by_bp = !ext->regs_error && is_breakpoint_address(ctx, pc1 - break_size);
+ ctx->stopped_by_bp = !ext->regs_error && is_breakpoint_address(ctx, pc1 + TRAP_OFFSET);
ext->end_of_step = !ctx->stopped_by_cb && !ctx->stopped_by_bp && ext->pending_step;
- if (ctx->stopped_by_bp) set_regs_PC(ctx, pc1 - break_size);
+ if (ctx->stopped_by_bp) set_regs_PC(ctx, pc1 + TRAP_OFFSET);
}
ext->pending_step = 0;
send_context_stopped_event(ctx);

Back to the top