1 /* src/native/jvmti/dbg.c - jvmti os/architecture support
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Martin Platter
32 $Id: cacao.c,v 3.165 2006/01/03 23:44:38 twisti Exp $
36 /* at the moment linux/i386 is the only plattform available */
37 #if defined(__LINUX__) && defined (__I386__)
40 #include <sys/ptrace.h>
41 #include <linux/user.h>
45 void* getip(pid_t pid) {
46 struct user_regs_struct regs;
49 return (void*)regs.eip;
52 void setip(pid_t pid, void* ip) {
53 struct user_regs_struct regs;
57 ptrace(PTRACE_SETREGS, pid, 0, ®s);
60 void setbrk(pid_t pid, void* addr, long* orig) {
63 *orig = GETMEM(pid,addr);
65 ins = (*orig & ~0x000000FF) | TRAPINS;
67 fprintf (stderr,"pid %d set brk at %p orig: %X new: %X\n",pid,addr,*orig,ins);
68 if (ptrace(PTRACE_POKEDATA, pid, (caddr_t) addr, ins)==-1)
69 perror("setbrk error ");
75 * These are local overrides for various environment variables in Emacs.
76 * Please do not remove this and leave it at the end of the file, where
77 * Emacs will automagically detect them.
78 * ---------------------------------------------------------------------