The branch, master has been updated via a7b96009e7ad2f2cf0b5c5b1687f8e71de99adac (commit) via 870c86d1ce1e4d5383b3a822bc20b6f6b710b77b (commit) from f13cb684cd4a80a3c1080cbc5b2823ba5e4b65d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit a7b96009e7ad2f2cf0b5c5b1687f8e71de99adac Author: Mark Wielaard <mjw@redhat.com> Date: Fri Mar 20 21:17:17 2009 +0100 Work around compiler being too smart and noticing o == null. commit 870c86d1ce1e4d5383b3a822bc20b6f6b710b77b Author: Mark Wielaard <mjw@redhat.com> Date: Fri Mar 20 21:14:23 2009 +0100 * TestDebugInfoStackTrace.java (pushPopAssertions): Initialize line. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/debuginfo/ChangeLog | 5 +++++ .../frysk/debuginfo/TestDebugInfoStackTrace.java | 2 +- frysk-core/frysk/pkglibdir/ChangeLog | 5 +++++ .../frysk/pkglibdir/FunitSimpleInterfaceTest.java | 2 ++ 4 files changed, 13 insertions(+), 1 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog index 37736fc..cfcade3 100644 --- a/frysk-core/frysk/debuginfo/ChangeLog +++ b/frysk-core/frysk/debuginfo/ChangeLog @@ -1,3 +1,8 @@ +2008-03-20 Mark Wielaard <mark@klomp.org> + + * TestDebugInfoStackTrace.java (pushPopAssertions): Make sure + line is initialized. + 2008-06-15 Andrew Cagney <cagney@redhat.com> * gen-type-expect-tests.py (open_file): Use assert, not if/println diff --git a/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java b/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java index 35e2737..9f1d953 100644 --- a/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java +++ b/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java @@ -500,7 +500,7 @@ public class TestDebugInfoStackTrace public void pushPopAssertions () { DebugInfoFrame sFrame = DebugInfoStackFactory.createDebugInfoStackTrace(myTask); - SourceLocation line = null; + SourceLocation line = sFrame.getLine(); if (this.testState == PUSH || this.testState == POP) { diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog index 0c4b20f..9b88513 100644 --- a/frysk-core/frysk/pkglibdir/ChangeLog +++ b/frysk-core/frysk/pkglibdir/ChangeLog @@ -1,3 +1,8 @@ +2009-03-20 Mark Wielaard <mark@klomp.org> + + * FunitSimpleInterfaceTest.java (main): Work around compiler being + too smart...and noticing o == null. + 2008-06-17 Teresa Thomas <tthomas@redhat.com> * funit-ctypes.c: Write to float_. diff --git a/frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java b/frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java index dd2504e..3bb9de4 100644 --- a/frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java +++ b/frysk-core/frysk/pkglibdir/FunitSimpleInterfaceTest.java @@ -43,6 +43,8 @@ public class FunitSimpleInterfaceTest implements FunitSimpleInterface{ FunitSimpleInterface inter = new FunitSimpleInterfaceTest(); // Crash Object o = null; + if (o == inter) // Work around compiler being too smart... + o = inter; o.toString(); inter.simpleMethod(); } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via f13cb684cd4a80a3c1080cbc5b2823ba5e4b65d0 (commit) from 44038d6b0cfa52d6ee37adc061cb4142997d99b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit f13cb684cd4a80a3c1080cbc5b2823ba5e4b65d0 Author: Andrew Cagney <cagney@redhat.com> Date: Mon Jul 7 11:15:53 2008 -0400 Remove utrace stubs. ----------------------------------------------------------------------- Summary of changes: frysk-sys/frysk/sys/ChangeLog | 8 ++ frysk-sys/frysk/sys/Fork.java | 26 ----- frysk-sys/frysk/sys/cni/Fork.cxx | 10 -- frysk-sys/frysk/sys/cni/Fork.hxx | 1 - frysk-sys/frysk/sys/jni/Fork.cxx | 11 -- frysk-sys/frysk/sys/jni/Fork.hxx | 1 - frysk-sys/frysk/sys/ptrace/ChangeLog | 7 ++ frysk-sys/frysk/sys/ptrace/TestUtrace.java | 156 ---------------------------- frysk-sys/frysk/sys/ptrace/Utrace.java | 123 ---------------------- frysk-sys/frysk/sys/ptrace/cni/Utrace.cxx | 91 ---------------- frysk-sys/frysk/sys/ptrace/jni/Utrace.cxx | 40 ------- 11 files changed, 15 insertions(+), 459 deletions(-) delete mode 100644 frysk-sys/frysk/sys/ptrace/TestUtrace.java delete mode 100644 frysk-sys/frysk/sys/ptrace/Utrace.java delete mode 100644 frysk-sys/frysk/sys/ptrace/cni/Utrace.cxx delete mode 100644 frysk-sys/frysk/sys/ptrace/jni/Utrace.cxx First 500 lines of diff: diff --git a/frysk-sys/frysk/sys/ChangeLog b/frysk-sys/frysk/sys/ChangeLog index 30c807d..a96417f 100644 --- a/frysk-sys/frysk/sys/ChangeLog +++ b/frysk-sys/frysk/sys/ChangeLog @@ -1,3 +1,11 @@ +2008-07-07 Andrew Cagney <cagney@redhat.com> + + * cni/Fork.hxx: Remove utrace stubs. + * Fork.java: Ditto. + * jni/Fork.hxx: Ditto. + * jni/Fork.cxx: Ditto. + * cni/Fork.cxx: Ditto. + 2008-06-20 Andrew Cagney <cagney@redhat.com> * Poll.java: Move to frysk.sys.poll. diff --git a/frysk-sys/frysk/sys/Fork.java b/frysk-sys/frysk/sys/Fork.java index 7e2f39c..46c98cb 100644 --- a/frysk-sys/frysk/sys/Fork.java +++ b/frysk-sys/frysk/sys/Fork.java @@ -53,9 +53,6 @@ public final class Fork { private static native int ptrace(String exe, String in, String out, String err, String[] args, String[] environ); - private static native int utrace(String exe, - String in, String out, String err, - String[] args, String[] environ); private static native int daemon(String exe, String in, String out, String err, String[] args, String[] environ); @@ -118,29 +115,6 @@ public final class Fork { } /** - * Create a child process running EXE with arguments ARGS[0...]; - * mark the process for utracing. - * - * Also wire up IN, OUT, and ERR. - */ - public static ProcessIdentifier utrace(File exe, - String in, String out, - String err, String[] args) { - return ProcessIdentifierFactory.create(utrace(exe.getPath(), - in, out, err, - args, null)); - } - /** - * Create a child process running ARGS[0] with arguments - * ARGV[0...]; mark the process for utracing. - */ - public static ProcessIdentifier utrace(String[] args) { - return ProcessIdentifierFactory.create(utrace(args[0], - null, null, null, - args, null)); - } - - /** * Create a "daemon" process running ARGV[0] with arguments * ARGV[1...]; a daemon has process ID 1 as its parent. */ diff --git a/frysk-sys/frysk/sys/cni/Fork.cxx b/frysk-sys/frysk/sys/cni/Fork.cxx index 9d35ffd..ef6e3a8 100644 --- a/frysk-sys/frysk/sys/cni/Fork.cxx +++ b/frysk-sys/frysk/sys/cni/Fork.cxx @@ -115,9 +115,6 @@ spawn(tracing trace, redirect& redirection, exec& execute) { ::_exit(errno); } break; - case UTRACE: - fprintf(stderr, "\n\n>>>>> in spawn(...utrace)\n\n"); - break; case CHILD: break; case DAEMON: @@ -188,13 +185,6 @@ frysk::sys::Fork::ptrace(jstring exe, } jint -frysk::sys::Fork::utrace(jstring exe, - jstring in, jstring out, jstring err, - jstringArray args, jstringArray environ) { - return ::spawn(exe, in, out, err, args, environ, UTRACE); -} - -jint frysk::sys::Fork::daemon (jstring exe, jstring in, jstring out, jstring err, jstringArray args, jstringArray environ) { return ::spawn(exe, in, out, err, args, environ, DAEMON); diff --git a/frysk-sys/frysk/sys/cni/Fork.hxx b/frysk-sys/frysk/sys/cni/Fork.hxx index a4b8438..2cc021b 100644 --- a/frysk-sys/frysk/sys/cni/Fork.hxx +++ b/frysk-sys/frysk/sys/cni/Fork.hxx @@ -41,7 +41,6 @@ enum tracing { CHILD, DAEMON, PTRACE, - UTRACE, }; /** diff --git a/frysk-sys/frysk/sys/jni/Fork.cxx b/frysk-sys/frysk/sys/jni/Fork.cxx index 02d9799..bb1549b 100644 --- a/frysk-sys/frysk/sys/jni/Fork.cxx +++ b/frysk-sys/frysk/sys/jni/Fork.cxx @@ -115,9 +115,6 @@ spawn(jnixx::env env, tracing trace, redirect& redirection, exec& execute) { ::_exit(errno); } break; - case UTRACE: - fprintf(stderr, "\n\n>>>>> in spawn(...utrace)\n\n"); - break; case CHILD: break; case DAEMON: @@ -199,14 +196,6 @@ frysk::sys::Fork::ptrace(jnixx::env env, String exe, } jint -frysk::sys::Fork::utrace(jnixx::env env, String exe, - String in, String out, String err, - jnixx::array<String> args, - jnixx::array<String> environ) { - return ::spawn(env, exe, in, out, err, args, environ, UTRACE); -} - -jint frysk::sys::Fork::daemon(jnixx::env env, String exe, String in, String out, String err, jnixx::array<String> args, diff --git a/frysk-sys/frysk/sys/jni/Fork.hxx b/frysk-sys/frysk/sys/jni/Fork.hxx index 2df12a4..6bf9dd1 100644 --- a/frysk-sys/frysk/sys/jni/Fork.hxx +++ b/frysk-sys/frysk/sys/jni/Fork.hxx @@ -41,7 +41,6 @@ enum tracing { CHILD, DAEMON, PTRACE, - UTRACE, }; /** diff --git a/frysk-sys/frysk/sys/ptrace/ChangeLog b/frysk-sys/frysk/sys/ptrace/ChangeLog index 740dbac..0a363c5 100644 --- a/frysk-sys/frysk/sys/ptrace/ChangeLog +++ b/frysk-sys/frysk/sys/ptrace/ChangeLog @@ -1,3 +1,10 @@ +2008-07-07 Andrew Cagney <cagney@redhat.com> + + * Utrace.java: Delete stub. + * jni/Utrace.java: Delete stub. + * cni/Utrace.java: Delete stub. + * TestUtrace.java: Delete stub. + 2008-07-04 Andrew Cagney <cagney@redhat.com> * jni/ByteSpace.cxx: Rename jni/AddressSpace.java. diff --git a/frysk-sys/frysk/sys/ptrace/TestUtrace.java b/frysk-sys/frysk/sys/ptrace/TestUtrace.java deleted file mode 100644 index e04c5be..0000000 --- a/frysk-sys/frysk/sys/ptrace/TestUtrace.java +++ /dev/null @@ -1,156 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2005, 2007, 2008, Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// this exception. If you modify this file, you may extend this -// exception to your version of the file, but you are not obligated to -// do so. If you do not wish to provide this exception without -// modification, you must delete this exception statement from your -// version and license this file solely under the GPL without -// exception. - -package frysk.sys.ptrace; - -import frysk.sys.ProcessIdentifier; -import frysk.junit.TestCase; -import frysk.testbed.TearDownProcess; -import frysk.sys.Fork; -//import frysk.sys.Itimer; -//import frysk.sys.Execute; -//import frysk.sys.Errno; -//import frysk.sys.DaemonFactory; -//import frysk.sys.Wait; -//import frysk.sys.Signal; -//import frysk.sys.UnhandledWaitBuilder; - -/** - * Check the plumming of Ptrace. - */ - -public class TestUtrace extends TestCase { - /** - * Rip down everything related to PID. - */ - public void tearDown() { - TearDownProcess.tearDown (); - } - - public void testChildContinue() { - final ProcessIdentifier pid - = Fork.utrace(new String[] { - "/bin/true" - }); - System.err.println("pid = " + pid); - /***************** kill for now - assertTrue("pid", pid.intValue() > 0); - TearDownProcess.add(pid); - - // The initial stop. - Wait.waitOnce(pid, new UnhandledWaitBuilder() { - private final ProcessIdentifier id = pid; - protected void unhandled(String why) { - fail (why); - } - public void stopped(ProcessIdentifier pid, Signal signal) { - assertSame("stopped pid", id, pid); - assertSame("stopped sig", Signal.TRAP, signal); - } - }); - - Utrace.singleStep(pid, Signal.NONE); - Wait.waitOnce(pid, new UnhandledWaitBuilder() { - private final ProcessIdentifier id = pid; - protected void unhandled(String why) { - fail (why); - } - public void stopped(ProcessIdentifier pid, Signal signal) { - assertSame("stopped pid", id, pid); - assertSame("stopped sig", Signal.TRAP, signal); - } - }); - - Utrace.cont(pid, Signal.TERM); - Wait.waitOnce(pid, new UnhandledWaitBuilder() { - private final ProcessIdentifier id = pid; - protected void unhandled(String why) { - fail (why); - } - public void terminated(ProcessIdentifier pid, Signal signal, - int status, boolean coreDumped) { - assertSame("terminated pid", id, pid); - assertSame("terminated signal", Signal.TERM, signal); - assertEquals("terminated status", -Signal.TERM.intValue(), - status); - } - }); - ********************/ - } - - /** - * Check attach (to oneself). - */ - /********************** kill it for now - public void testAttachDetach() { - final ProcessIdentifier pid = DaemonFactory.create(new Execute() { - public void execute() { - Itimer.sleep (TestCase.getTimeoutSeconds()); - } - }); - TearDownProcess.add(pid); - assertTrue ("pid", pid.intValue() > 0); - - Utrace.attach(pid); - Wait.waitOnce(pid, new UnhandledWaitBuilder() { - private final ProcessIdentifier id = pid; - protected void unhandled(String why) { - fail (why); - } - public void stopped(ProcessIdentifier pid, Signal signal) { - assertSame("stopped pid", id, pid); - assertSame("stopped sig", Signal.STOP, signal); - } - }); - - Utrace.detach(pid, Signal.NONE); - Errno errno = null; - try { - Wait.waitOnce(pid, new UnhandledWaitBuilder() { - protected void unhandled(String why) { - fail (why); - } - }); - } catch (Errno e) { - errno = e; - } - assertEquals("Errno", Errno.Echild.class, errno.getClass()); - } - **********************************/ -} diff --git a/frysk-sys/frysk/sys/ptrace/Utrace.java b/frysk-sys/frysk/sys/ptrace/Utrace.java deleted file mode 100644 index 89efccf..0000000 --- a/frysk-sys/frysk/sys/ptrace/Utrace.java +++ /dev/null @@ -1,123 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// this exception. If you modify this file, you may extend this -// exception to your version of the file, but you are not obligated to -// do so. If you do not wish to provide this exception without -// modification, you must delete this exception statement from your -// version and license this file solely under the GPL without -// exception. - -package frysk.sys.ptrace; - -import frysk.rsl.Log; -import frysk.sys.ProcessIdentifier; -import frysk.sys.Signal; - -/** - * Trace a process. - */ - -public class Utrace { - private static final Log fine = Log.fine(Utrace.class); - - /** - * Attach to the process specified by PID. - */ - public static void attach(ProcessIdentifier pid) { - fine.log("attach", pid); - attach(pid.intValue()); - } - private static native void attach(int pid); - - /** - * Detach from the process specified by PID. - */ - public static void detach(ProcessIdentifier pid, Signal signal) { - fine.log("detach", pid, "signal", signal); - detach(pid.intValue(), signal.intValue()); - } - private static native void detach(int pid, int sig); - - /** - * Single-step (instruction step) the process specified by PID, if - * SIG is non-zero, deliver the signal. - */ - public static void singleStep(ProcessIdentifier pid, Signal signal) { - fine.log("signleStep", pid, "signal", signal); - singleStep(pid.intValue(), signal.intValue()); - } - private static native void singleStep(int pid, int sig); - - /** - * Continue the process specified by PID, if SIG is non-zero, - * deliver the signal. - */ - public static void cont(ProcessIdentifier pid, Signal signal) { - fine.log("cont", pid, "signal", signal); - cont(pid.intValue(), signal.intValue()); - } - private static native void cont(int pid, int signal); - - /** - * Continue the process specified by PID, stopping when there is a - * system-call; if SIG is non-zero deliver the signal. - */ - public static void sysCall(ProcessIdentifier pid, Signal signal) { - fine.log("sysCall", pid, "signal", signal); - sysCall(pid.intValue(), signal.intValue()); - } - private static native void sysCall(int pid, int sig); - - /** - * Fetch the auxilary information associated with PID's last WAIT - * event. - */ - public static long getEventMsg(ProcessIdentifier pid) { - fine.log("getEventMsg", pid, "..."); - long ret = getEventMsg(pid.intValue()); - fine.log("... getEventMsg", pid, "returns", ret); - return ret; - } - private static native long getEventMsg(int pid); - - /** - * Set PID's trace options. OPTIONS is formed by or'ing the - * values returned by the option* methods below. - */ - public static void setOptions(ProcessIdentifier pid, long options) { - fine.log("setOptions", pid, "options", options); - setOptions(pid.intValue(), options); - } - private static native void setOptions (int pid, long options); - -} diff --git a/frysk-sys/frysk/sys/ptrace/cni/Utrace.cxx b/frysk-sys/frysk/sys/ptrace/cni/Utrace.cxx deleted file mode 100644 index cdc0ac7..0000000 --- a/frysk-sys/frysk/sys/ptrace/cni/Utrace.cxx +++ /dev/null @@ -1,91 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// this exception. If you modify this file, you may extend this -// exception to your version of the file, but you are not obligated to -// do so. If you do not wish to provide this exception without -// modification, you must delete this exception statement from your -// version and license this file solely under the GPL without -// exception. - -#include <errno.h> -#include <stdio.h> -#include <sys/ptrace.h> -#include "linux.ptrace.h" - -#include <gcj/cni.h> - -#include "frysk/sys/cni/Errno.hxx" hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 44038d6b0cfa52d6ee37adc061cb4142997d99b1 (commit) from 6a0ea520d3eaebb371820f312c3bb40666c60265 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 44038d6b0cfa52d6ee37adc061cb4142997d99b1 Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jul 4 16:35:00 2008 -0400 Rename RegisterSet to BlockSpace and AddressSpace to ByteSpace. It turns out that there are more block transferable spaces then just the register sets. ----------------------------------------------------------------------- Summary of changes: ...etByteBuffer.java => BlockSpaceByteBuffer.java} | 27 +-- ...aceByteBuffer.java => ByteSpaceByteBuffer.java} | 84 ++++---- frysk-core/frysk/proc/live/ChangeLog | 9 + frysk-core/frysk/proc/live/LinuxPtraceTask.java | 7 +- .../frysk/proc/live/LogicalMemoryBuffer.java | 172 +++++++-------- .../proc/live/PtraceRegisterBanksFactory.java | 20 +- frysk-core/frysk/proc/live/TestByteBuffer.java | 242 +++++++++----------- .../ptrace/{RegisterSet.java => BlockSpace.java} | 23 +- .../ptrace/{AddressSpace.java => ByteSpace.java} | 22 +- frysk-sys/frysk/sys/ptrace/ChangeLog | 11 + frysk-sys/frysk/sys/ptrace/TestAddressSpace.java | 60 +++--- frysk-sys/frysk/sys/ptrace/TestRegisterSet.java | 8 +- .../ptrace/cni/{RegisterSet.cxx => BlockSpace.cxx} | 34 ++-- .../ptrace/cni/{AddressSpace.cxx => ByteSpace.cxx} | 48 ++-- .../ptrace/jni/{RegisterSet.cxx => BlockSpace.cxx} | 26 +- .../ptrace/jni/{AddressSpace.cxx => ByteSpace.cxx} | 48 ++-- frysk-sys/frysk/testbed/ChangeLog | 4 + frysk-sys/frysk/testbed/LocalMemory.java | 4 +- 18 files changed, 419 insertions(+), 430 deletions(-) rename frysk-core/frysk/proc/live/{RegisterSetByteBuffer.java => BlockSpaceByteBuffer.java} (86%) rename frysk-core/frysk/proc/live/{AddressSpaceByteBuffer.java => ByteSpaceByteBuffer.java} (80%) rename frysk-sys/frysk/sys/ptrace/{RegisterSet.java => BlockSpace.java} (82%) rename frysk-sys/frysk/sys/ptrace/{AddressSpace.java => ByteSpace.java} (89%) rename frysk-sys/frysk/sys/ptrace/cni/{RegisterSet.cxx => BlockSpace.cxx} (77%) rename frysk-sys/frysk/sys/ptrace/cni/{AddressSpace.cxx => ByteSpace.cxx} (83%) rename frysk-sys/frysk/sys/ptrace/jni/{RegisterSet.cxx => BlockSpace.cxx} (84%) rename frysk-sys/frysk/sys/ptrace/jni/{AddressSpace.cxx => ByteSpace.cxx} (82%) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/live/RegisterSetByteBuffer.java b/frysk-core/frysk/proc/live/BlockSpaceByteBuffer.java similarity index 86% rename from frysk-core/frysk/proc/live/RegisterSetByteBuffer.java rename to frysk-core/frysk/proc/live/BlockSpaceByteBuffer.java index 6b2c1ff..84b2c8a 100644 --- a/frysk-core/frysk/proc/live/RegisterSetByteBuffer.java +++ b/frysk-core/frysk/proc/live/BlockSpaceByteBuffer.java @@ -39,7 +39,7 @@ package frysk.proc.live; -import frysk.sys.ptrace.RegisterSet; +import frysk.sys.ptrace.BlockSpace; import frysk.event.Request; import frysk.proc.Manager; import inua.eio.ByteBuffer; @@ -50,23 +50,23 @@ import frysk.sys.ProcessIdentifier; * be read or written all at once e.g., the registers or floating * point registers. */ -public class RegisterSetByteBuffer +public class BlockSpaceByteBuffer extends ByteBuffer { private final ProcessIdentifier pid; - private final RegisterSet registerSet; + private final BlockSpace registerSet; private final byte[] bytes; - private RegisterSetByteBuffer(ProcessIdentifier pid, - RegisterSet registerSet, - long lowerExtreem, long upperExtreem) { + private BlockSpaceByteBuffer(ProcessIdentifier pid, + BlockSpace registerSet, + long lowerExtreem, long upperExtreem) { super(lowerExtreem, upperExtreem); this.pid = pid; this.registerSet = registerSet; bytes = new byte[registerSet.length()]; } - public RegisterSetByteBuffer(ProcessIdentifier pid, - RegisterSet registerSet) { + public BlockSpaceByteBuffer(ProcessIdentifier pid, + BlockSpace registerSet) { this(pid, registerSet, 0, registerSet.length()); } @@ -121,11 +121,10 @@ public class RegisterSetByteBuffer return len; } - protected ByteBuffer subBuffer (ByteBuffer parent, long lowerExtreem, - long upperExtreem) - { - RegisterSetByteBuffer up = (RegisterSetByteBuffer)parent; - return new RegisterSetByteBuffer (up.pid, up.registerSet, - lowerExtreem, upperExtreem); + protected ByteBuffer subBuffer(ByteBuffer parent, long lowerExtreem, + long upperExtreem) { + BlockSpaceByteBuffer up = (BlockSpaceByteBuffer)parent; + return new BlockSpaceByteBuffer(up.pid, up.registerSet, + lowerExtreem, upperExtreem); } } diff --git a/frysk-core/frysk/proc/live/AddressSpaceByteBuffer.java b/frysk-core/frysk/proc/live/ByteSpaceByteBuffer.java similarity index 80% rename from frysk-core/frysk/proc/live/AddressSpaceByteBuffer.java rename to frysk-core/frysk/proc/live/ByteSpaceByteBuffer.java index adc0723..7cd405e 100644 --- a/frysk-core/frysk/proc/live/AddressSpaceByteBuffer.java +++ b/frysk-core/frysk/proc/live/ByteSpaceByteBuffer.java @@ -42,34 +42,35 @@ package frysk.proc.live; import inua.eio.ByteBuffer; import frysk.sys.Errno; import frysk.sys.ProcessIdentifier; -import frysk.sys.ptrace.AddressSpace; +import frysk.sys.ptrace.ByteSpace; import frysk.sys.proc.Mem; import frysk.event.Request; import frysk.proc.Manager; -public class AddressSpaceByteBuffer extends ByteBuffer { - protected final AddressSpace addressSpace; +public class ByteSpaceByteBuffer extends ByteBuffer { + protected final ByteSpace addressSpace; protected final ProcessIdentifier pid; // Direct files access if possible, or null otherwise. private Mem mem; - protected AddressSpaceByteBuffer (ProcessIdentifier pid, - AddressSpace addressSpace, - long lowerExtreem, long upperExtreem) { + protected ByteSpaceByteBuffer (ProcessIdentifier pid, + ByteSpace addressSpace, + long lowerExtreem, long upperExtreem) { super (lowerExtreem, upperExtreem); this.pid = pid; this.addressSpace = addressSpace; peekRequest = new PeekRequest(); pokeRequest = new PokeRequest(); - if (addressSpace == AddressSpace.TEXT - || addressSpace == AddressSpace.DATA) + if (addressSpace == ByteSpace.TEXT + || addressSpace == ByteSpace.DATA) { // Try to use /proc; but if any error occures clear it and // revert back to ptrace. mem = new Mem(pid); + } } - public AddressSpaceByteBuffer(ProcessIdentifier pid, - AddressSpace addressSpace) { + public ByteSpaceByteBuffer(ProcessIdentifier pid, + ByteSpace addressSpace) { this(pid, addressSpace, 0, addressSpace.length()); } @@ -79,22 +80,21 @@ public class AddressSpaceByteBuffer extends ByteBuffer { { private long index; private int value; - PeekRequest() - { + PeekRequest() { super(Manager.eventLoop); } - public void execute () - { + public void execute() { value = addressSpace.peek(pid, index); } - public int request (long index) - { + public int request(long index) { if (isEventLoopThread()) return addressSpace.peek(pid, index); - else synchronized (this) { - this.index = index; - request(); - return value; + else { + synchronized (this) { + this.index = index; + request(); + return value; + } } } } @@ -108,22 +108,21 @@ public class AddressSpaceByteBuffer extends ByteBuffer { { private long index; private int value; - PokeRequest() - { + PokeRequest() { super(Manager.eventLoop); } - public void execute () - { + public void execute() { addressSpace.poke(pid, index, value); } - public void request (long index, int value) - { + public void request(long index, int value) { if (isEventLoopThread()) addressSpace.poke(pid, index, value); - else synchronized (this) { - this.index = index; - this.value = value; - request(); + else { + synchronized (this) { + this.index = index; + this.value = value; + request(); + } } } } @@ -167,13 +166,15 @@ public class AddressSpaceByteBuffer extends ByteBuffer { boolean write) { if (isEventLoopThread()) transfer(index, bytes, offset, length, write); - else synchronized (this) { - this.index = index; - this.bytes = bytes; - this.offset = offset; - this.length = length; - this.write = write; - super.request(); + else { + synchronized (this) { + this.index = index; + this.bytes = bytes; + this.offset = offset; + this.length = length; + this.write = write; + super.request(); + } } } } @@ -189,10 +190,9 @@ public class AddressSpaceByteBuffer extends ByteBuffer { } protected ByteBuffer subBuffer (ByteBuffer parent, long lowerExtreem, - long upperExtreem) - { - AddressSpaceByteBuffer up = (AddressSpaceByteBuffer)parent; - return new AddressSpaceByteBuffer (up.pid, up.addressSpace, - lowerExtreem, upperExtreem); + long upperExtreem) { + ByteSpaceByteBuffer up = (ByteSpaceByteBuffer)parent; + return new ByteSpaceByteBuffer(up.pid, up.addressSpace, + lowerExtreem, upperExtreem); } } diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog index 0d40328..49838f5 100644 --- a/frysk-core/frysk/proc/live/ChangeLog +++ b/frysk-core/frysk/proc/live/ChangeLog @@ -1,3 +1,12 @@ +2008-07-04 Andrew Cagney <cagney@redhat.com> + + * ByteSpaceByteBuffer.java: Rename AddressSpaceByteBuffer. + * BlockSpaceByteBuffer.java: Rename RegisterSetByteBuffer.. + * LogicalMemoryBuffer.java: Update. + * LinuxPtraceTask.java: Update. + * PtraceRegisterBanksFactory.java: Update. + * TestByteBuffer.java: Update. + 2008-06-16 Phil Muldoon <pmuldoon@redhat.com> * LinuxPtraceTaskState.java (Running.checkWatchpoint): Rewrite to use diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTask.java b/frysk-core/frysk/proc/live/LinuxPtraceTask.java index 0ecadb3..8dc5c78 100644 --- a/frysk-core/frysk/proc/live/LinuxPtraceTask.java +++ b/frysk-core/frysk/proc/live/LinuxPtraceTask.java @@ -60,7 +60,7 @@ import inua.eio.ByteOrder; import frysk.sys.Errno; import frysk.sys.ProcessIdentifier; import frysk.sys.ptrace.Ptrace; -import frysk.sys.ptrace.AddressSpace; +import frysk.sys.ptrace.ByteSpace; import frysk.sys.Signal; import frysk.isa.syscalls.Syscall; import frysk.isa.ISA; @@ -140,8 +140,7 @@ public class LinuxPtraceTask extends LiveTask { ByteBuffer getRawMemory() { fine.log(this, "Begin fillMemory"); ByteOrder byteOrder = getISA().order(); - ByteBuffer memory = new AddressSpaceByteBuffer(tid, - AddressSpace.DATA); + ByteBuffer memory = new ByteSpaceByteBuffer(tid, ByteSpace.DATA); memory.order(byteOrder); fine.log(this, "End fillMemory"); return memory; @@ -155,7 +154,7 @@ public class LinuxPtraceTask extends LiveTask { fine.log(this, "exiting get memory"); ByteOrder byteOrder = getISA().order(); BreakpointAddresses breakpoints = ((LinuxPtraceProc)getProc()).breakpoints; - memory = new LogicalMemoryBuffer(tid, AddressSpace.DATA, + memory = new LogicalMemoryBuffer(tid, ByteSpace.DATA, breakpoints); memory.order(byteOrder); } diff --git a/frysk-core/frysk/proc/live/LogicalMemoryBuffer.java b/frysk-core/frysk/proc/live/LogicalMemoryBuffer.java index 5d1330b..3227a5f 100644 --- a/frysk-core/frysk/proc/live/LogicalMemoryBuffer.java +++ b/frysk-core/frysk/proc/live/LogicalMemoryBuffer.java @@ -42,7 +42,7 @@ package frysk.proc.live; import frysk.sys.ProcessIdentifier; import java.util.Iterator; import inua.eio.ByteBuffer; -import frysk.sys.ptrace.AddressSpace; +import frysk.sys.ptrace.ByteSpace; /** * MemorySpaceByteBuffer that filters out anything the frysk core @@ -51,16 +51,15 @@ import frysk.sys.ptrace.AddressSpace; * replace the bytes with the logical bytes as the user would normally * see them from the process. */ -class LogicalMemoryBuffer extends AddressSpaceByteBuffer -{ - // The breakpoints associated with the process address space. - private final BreakpointAddresses breakpoints; +class LogicalMemoryBuffer extends ByteSpaceByteBuffer { + // The breakpoints associated with the process address space. + private final BreakpointAddresses breakpoints; /** * Private constructor used by subBuffer() */ private LogicalMemoryBuffer(ProcessIdentifier tid, - AddressSpace addressSpace, + ByteSpace addressSpace, BreakpointAddresses breakpoints, long lower, long upper) { super(tid, addressSpace, lower, upper); @@ -72,99 +71,90 @@ class LogicalMemoryBuffer extends AddressSpaceByteBuffer * memory space for a task when requested. */ LogicalMemoryBuffer(ProcessIdentifier tid, - AddressSpace addressSpace, + ByteSpace addressSpace, BreakpointAddresses breakpoints) { super(tid, addressSpace); this.breakpoints = breakpoints; } - protected int peek(long caret) - { - Breakpoint breakpoint = breakpoints.getBreakpoint(caret); - if (breakpoint != null) - { - // This really shouldn't happen, it means the breakpoint - // is already uninstalled. - Instruction instruction = breakpoint.getInstruction(); - if (instruction != null) - { - byte[] ibs = instruction.getBytes(); - return ibs[0] & 0xff; - } - } - return super.peek(caret); - } - - protected int peek(long index, byte[] bytes, int offset, int length) - { - synchronized (breakpoints) - { - Iterator it; - it = breakpoints.getBreakpoints(index, index + length); - int r = 0; - while (it.hasNext()) - { - Breakpoint breakpoint = (Breakpoint) it.next(); - // address - index falls inside the byte[] so will be at most - // a positive int apart. - int l = (int) (breakpoint.getAddress() - index) - r; - // Do we need to be worried about "short peeks"? - r += super.peek(index + r, bytes, offset + r, l); - - byte b; - Instruction instruction = breakpoint.getInstruction(); + protected int peek(long caret) + { + Breakpoint breakpoint = breakpoints.getBreakpoint(caret); + if (breakpoint != null) { // This really shouldn't happen, it means the breakpoint // is already uninstalled. - if (instruction != null) - b = instruction.getBytes()[0]; - else - b = (byte) super.peek(index + r); - bytes[offset + r] = b; - r++; - } - return super.peek(index + r, bytes, offset + r, length - r) + r; - } - } - - /** - * Pokes the value at the given index. Unless a breakpoint is set at - * that location (FIXME: this limitation should be lifted). - */ - protected void poke (long index, int value) - { - Breakpoint breakpoint = breakpoints.getBreakpoint(index); - if (breakpoint != null) - throw new UnsupportedOperationException("breakpoint set at: " + index); - - super.poke(index, value); - } + Instruction instruction = breakpoint.getInstruction(); + if (instruction != null) { + byte[] ibs = instruction.getBytes(); + return ibs[0] & 0xff; + } + } + return super.peek(caret); + } - /** - * Pokes the given bytes from offset at the index plus the given - * lenght. Unless a breakpoint is set in that range (FIXME: this - * limitation should be lifted). - */ - protected int poke(long index, byte[] bytes, int offset, int length) - { - synchronized (breakpoints) - { - Iterator it; - it = breakpoints.getBreakpoints(index, index + length); - if (it.hasNext()) - throw new UnsupportedOperationException("breakpoint set between " - + index + " and " - + index + length); - } + protected int peek(long index, byte[] bytes, int offset, int length) { + synchronized (breakpoints) { + Iterator it; + it = breakpoints.getBreakpoints(index, index + length); + int r = 0; + while (it.hasNext()) { + Breakpoint breakpoint = (Breakpoint) it.next(); + // address - index falls inside the byte[] so will be at most + // a positive int apart. + int l = (int) (breakpoint.getAddress() - index) - r; + // Do we need to be worried about "short peeks"? + r += super.peek(index + r, bytes, offset + r, l); + + byte b; + Instruction instruction = breakpoint.getInstruction(); + // This really shouldn't happen, it means the breakpoint + // is already uninstalled. + if (instruction != null) + b = instruction.getBytes()[0]; + else + b = (byte) super.peek(index + r); + bytes[offset + r] = b; + r++; + } + return super.peek(index + r, bytes, offset + r, length - r) + r; + } + } + + /** + * Pokes the value at the given index. Unless a breakpoint is set + * at that location (FIXME: this limitation should be lifted). + */ + protected void poke(long index, int value) { + Breakpoint breakpoint = breakpoints.getBreakpoint(index); + if (breakpoint != null) + throw new UnsupportedOperationException("breakpoint set at: " + index); - return super.poke(index, bytes, offset, length); - } + super.poke(index, value); + } + + /** + * Pokes the given bytes from offset at the index plus the given + * lenght. Unless a breakpoint is set in that range (FIXME: this + * limitation should be lifted). + */ + protected int poke(long index, byte[] bytes, int offset, int length) { + synchronized (breakpoints) { + Iterator it; + it = breakpoints.getBreakpoints(index, index + length); + if (it.hasNext()) + throw new UnsupportedOperationException("breakpoint set between " + + index + " and " + + index + length); + } + + return super.poke(index, bytes, offset, length); + } - protected ByteBuffer subBuffer(ByteBuffer parent, - long lower, long upper) - { - LogicalMemoryBuffer sub = (LogicalMemoryBuffer) parent; - return new LogicalMemoryBuffer (sub.pid, sub.addressSpace, - sub.breakpoints, - lower, upper); - } + protected ByteBuffer subBuffer(ByteBuffer parent, + long lower, long upper) { + LogicalMemoryBuffer sub = (LogicalMemoryBuffer) parent; + return new LogicalMemoryBuffer (sub.pid, sub.addressSpace, + sub.breakpoints, + lower, upper); + } } diff --git a/frysk-core/frysk/proc/live/PtraceRegisterBanksFactory.java b/frysk-core/frysk/proc/live/PtraceRegisterBanksFactory.java index daa86d9..dea7c53 100644 --- a/frysk-core/frysk/proc/live/PtraceRegisterBanksFactory.java +++ b/frysk-core/frysk/proc/live/PtraceRegisterBanksFactory.java @@ -44,8 +44,8 @@ import inua.eio.ByteBuffer; import inua.eio.ByteOrder; import frysk.isa.ISA; import frysk.sys.ProcessIdentifier; -import frysk.sys.ptrace.RegisterSet; -import frysk.sys.ptrace.AddressSpace; +import frysk.sys.ptrace.BlockSpace; +import frysk.sys.ptrace.ByteSpace; import frysk.isa.banks.RegisterBanks; import frysk.isa.banks.X86BankRegisters; import frysk.isa.banks.PPCBankRegisters; @@ -60,9 +60,9 @@ class PtraceRegisterBanksFactory { private static ByteBuffer[] x8664Banks(ProcessIdentifier pid) { ByteBuffer[] bankBuffers = new ByteBuffer[] { - new RegisterSetByteBuffer(pid, RegisterSet.REGS), - new RegisterSetByteBuffer(pid, RegisterSet.FPREGS), - new AddressSpaceByteBuffer(pid, AddressSpace.USR) hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 6a0ea520d3eaebb371820f312c3bb40666c60265 (commit) from fbcdfd6bd19693304caf613b79fd1d69fa1eca67 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 6a0ea520d3eaebb371820f312c3bb40666c60265 Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jul 4 11:24:41 2008 -0400 frysk-sys/inua/ChangeLog 2008-07-04 Andrew Cagney <cagney@redhat.com> * eio/ByteBuffer.java: Throw InternalException. * eio/BufferUnderflowException.java: Extend UserException. ----------------------------------------------------------------------- Summary of changes: frysk-sys/inua/ChangeLog | 5 ++ frysk-sys/inua/eio/BufferUnderflowException.java | 10 ++- frysk-sys/inua/eio/ByteBuffer.java | 74 ++++++++++------------ 3 files changed, 45 insertions(+), 44 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/inua/ChangeLog b/frysk-sys/inua/ChangeLog index 1827bf2..16ae59b 100644 --- a/frysk-sys/inua/ChangeLog +++ b/frysk-sys/inua/ChangeLog @@ -1,3 +1,8 @@ +2008-07-04 Andrew Cagney <cagney@redhat.com> + + * eio/ByteBuffer.java: Throw InternalException. + * eio/BufferUnderflowException.java: Extend UserException. + 2008-06-05 Andrew Cagney <cagney@redhat.com> * eio/ByteBuffer.java: Add missing indexed word get/put methods. diff --git a/frysk-sys/inua/eio/BufferUnderflowException.java b/frysk-sys/inua/eio/BufferUnderflowException.java index a17063d..2f9f7ed 100644 --- a/frysk-sys/inua/eio/BufferUnderflowException.java +++ b/frysk-sys/inua/eio/BufferUnderflowException.java @@ -34,10 +34,14 @@ // modification, you must delete this exception statement from your // version and license this file solely under the GPL without // exception. + package inua.eio; -public class BufferUnderflowException - extends java.nio.BufferUnderflowException -{ +import frysk.UserException; + +public class BufferUnderflowException extends UserException { private static final long serialVersionUID = 1L; + BufferUnderflowException(long address) { + super("Address 0x" + Long.toHexString(address) + " out of bounds"); + } } diff --git a/frysk-sys/inua/eio/ByteBuffer.java b/frysk-sys/inua/eio/ByteBuffer.java index 6549a58..873e481 100644 --- a/frysk-sys/inua/eio/ByteBuffer.java +++ b/frysk-sys/inua/eio/ByteBuffer.java @@ -40,9 +40,10 @@ * A ByteBuffer. Just like {@link java.nio.ByteBuffer} only 64-bit. */ - package inua.eio; +import frysk.InternalException; + public abstract class ByteBuffer extends Buffer { @@ -293,9 +294,8 @@ public abstract class ByteBuffer * Given BUFFER, return a new subBuffer. Used by {@link #slice}. */ protected ByteBuffer subBuffer (ByteBuffer buffer, long lowerExtreem, - long upperExtreem) - { - throw new RuntimeException("not implemented"); + long upperExtreem) { + throw new InternalException("not implemented"); } public ByteBuffer slice (long off, long len) @@ -321,14 +321,12 @@ public abstract class ByteBuffer return (byte) peek(lowWater + index); } - public ByteBuffer get (long index, byte[] dst, int off, int len) - throws BufferUnderflowException - { - if (ULong.GT(index + len, limit())) - throw new BufferUnderflowException(); - peekFully(lowWater + index,dst,off,len); - return this; - } + public ByteBuffer get(long index, byte[] dst, int off, int len) { + if (ULong.GT(index + len, limit())) + throw new BufferUnderflowException(index + len); + peekFully(lowWater + index,dst,off,len); + return this; + } public int safeGet (long index, byte[] dst, int off, int len) { @@ -339,35 +337,29 @@ public abstract class ByteBuffer return maxLen; } - public ByteBuffer get (byte[] dst, int off, int len) - throws BufferUnderflowException - { - if (ULong.GT(len, remaining())) - throw new BufferUnderflowException(); - peek(cursor, dst, off, len); - cursor += len; - return this; - } + public ByteBuffer get(byte[] dst, int off, int len) { + if (ULong.GT(len, remaining())) + throw new BufferUnderflowException(len); + peek(cursor, dst, off, len); + cursor += len; + return this; + } - public final ByteBuffer get (byte[] dst) throws BufferUnderflowException - { - return get(dst, 0, dst.length); - } + public final ByteBuffer get (byte[] dst) { + return get(dst, 0, dst.length); + } - public ByteBuffer put (byte[] src, int off, int len) - throws BufferUnderflowException - { - if (ULong.GT(len, remaining())) - throw new BufferUnderflowException(); - poke(cursor, src, off, len); - cursor += len; - return this; - } + public ByteBuffer put (byte[] src, int off, int len) { + if (ULong.GT(len, remaining())) + throw new BufferUnderflowException(len); + poke(cursor, src, off, len); + cursor += len; + return this; + } - public final ByteBuffer put (byte[] src) throws BufferUnderflowException - { - return put(src, 0, src.length); - } + public final ByteBuffer put (byte[] src) { + return put(src, 0, src.length); + } protected ByteOrdered byteOrdered; hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via fbcdfd6bd19693304caf613b79fd1d69fa1eca67 (commit) from 6769775d04e116c60ba53d52d7e509ceb4cbbbdb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit fbcdfd6bd19693304caf613b79fd1d69fa1eca67 Author: Teresa Thomas <tthomas@redhat.com> Date: Thu Jul 3 13:18:34 2008 -0400 Add myself to the Frysk team webpage. ----------------------------------------------------------------------- Summary of changes: htdocs/people/index.html | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) First 500 lines of diff: diff --git a/htdocs/people/index.html b/htdocs/people/index.html index c825940..81fd68f 100644 --- a/htdocs/people/index.html +++ b/htdocs/people/index.html @@ -147,6 +147,14 @@ Professional Experience Year Program. </p> Technlogy Center. Currently contributes with PPC-related code to the Frysk Project. He also has contributions to GDB and binutils as well. </p> +<h3>Teresa Thomas</h3> + +<p>Teresa is a Computer Engineering student at the University of Toronto, +currently working as an intern at Red Hat Canada Ltd. She has worked +on various aspects of Frysk's core, including the expression parser +and evaluator, high level watchpoint implementation, IEEE 754/854 +floating point support and the DWARF location evaluator. </p> + <h3>Sami Wagiaalla</h3> <p>Sami is an intern at Red Hat from the University of Alberta. He is hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 6769775d04e116c60ba53d52d7e509ceb4cbbbdb (commit) from 4ee203efb3be5d328cfe419d1f9c24f17e7ea32e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 6769775d04e116c60ba53d52d7e509ceb4cbbbdb Author: Rick Moseley <rmoseley@localhost.localdomain> Date: Thu Jun 26 13:16:38 2008 -0500 Fix bz 6696(problem with kill command). * CLI.java: Fix bz 6696. * DetachCommand.java: Ditto. * KillCommand.java: Ditto. * TestKillCommand.java: Add test for fix. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/CLI.java | 4 +++ frysk-core/frysk/hpd/ChangeLog | 8 +++++++ frysk-core/frysk/hpd/DetachCommand.java | 7 ++++- frysk-core/frysk/hpd/KillCommand.java | 12 +++++----- frysk-core/frysk/hpd/TestKillCommand.java | 31 +++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 8 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/CLI.java b/frysk-core/frysk/hpd/CLI.java index dd1f97f..eb1533c 100644 --- a/frysk-core/frysk/hpd/CLI.java +++ b/frysk-core/frysk/hpd/CLI.java @@ -185,6 +185,10 @@ public class CLI { // Assign this proc to the passed in procID else idManager.manageProc(proc, this.taskID); + // Add this process to the runningProcs table + synchronized (this) { + this.runningProcs.add(proc); + } } /** diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 5678226..87a1322 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,11 @@ +2008-06-26 Rick Moseley <rmoseley@redhat.com> + + * CLI.java: Fix bz 6696. + * DetachCommand.java: Ditto. + * KillCommand.java: Ditto. + * TestKillCommand.java: Add test for fix. + + 2008-06-17 Teresa Thomas <tthomas@redhat.com> * TestWatchCommand.java (testWritePrevValue): New test. diff --git a/frysk-core/frysk/hpd/DetachCommand.java b/frysk-core/frysk/hpd/DetachCommand.java index b76a603..e98e5a3 100644 --- a/frysk-core/frysk/hpd/DetachCommand.java +++ b/frysk-core/frysk/hpd/DetachCommand.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2006, 2007 Red Hat Inc. +// Copyright 2005, 2006, 2007, 2008 Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -72,12 +72,15 @@ class DetachCommand extends ParameterizedCommand { synchronized (cli) { startedByRun = cli.runningProcs.contains(proc); } - if (startedByRun) + if (!startedByRun) continue; // Delete all breakpoints. if (cli.steppingObserver != null) cli.getSteppingEngine().removeObserver(cli.steppingObserver, proc, true); + synchronized (cli) { + cli.runningProcs.remove(proc); + } } } diff --git a/frysk-core/frysk/hpd/KillCommand.java b/frysk-core/frysk/hpd/KillCommand.java index a05f1cf..cf7dabc 100644 --- a/frysk-core/frysk/hpd/KillCommand.java +++ b/frysk-core/frysk/hpd/KillCommand.java @@ -156,6 +156,9 @@ public class KillCommand extends ParameterizedCommand { procPID = proc.getPid(); // Now, call the Proc object to kill off the executable(s) proc.requestKill(); + synchronized (cli) { + cli.runningProcs.remove(proc); + } if ((pid > 0)) return true; } @@ -202,17 +205,14 @@ public class KillCommand extends ParameterizedCommand { + " that was created from " + proc.getExeFile().getSysRootedPath(), Message.TYPE_NORMAL); proc.requestKill(); + synchronized (cli) { + cli.runningProcs.remove(proc); + } tempId = procId; returnProc = true; } } } - if (returnProc) { - synchronized (cli) { - // Clear the running procs set - cli.runningProcs.clear(); - } - } return returnProc; } diff --git a/frysk-core/frysk/hpd/TestKillCommand.java b/frysk-core/frysk/hpd/TestKillCommand.java index 4a5446c..e3711d9 100644 --- a/frysk-core/frysk/hpd/TestKillCommand.java +++ b/frysk-core/frysk/hpd/TestKillCommand.java @@ -196,6 +196,37 @@ java.lang.NullPointerException } /** + * Test killing of a single proc NOT using the PID + */ + public void testKillAfterAttach() { + SlaveOffspring newProc = SlaveOffspring.createDaemon(); + int pid = newProc.getPid().intValue(); + e = new HpdTestbed(); + e.sendCommandExpectPrompt("attach " + pid, "Attached to process " + pid + ".*"); + e.sendCommandExpectPrompt("kill", "Killing process " + pid + ".*"); + try { Thread.sleep(500); } catch (Exception e) { } + e.send("quit\n"); + e.expect("Quitting\\.\\.\\..*"); + e.close(); + } + + /** + * Test killing of a single proc and then running + */ + public void testKillAfterAttachThenRun() { + SlaveOffspring newProc = SlaveOffspring.createDaemon(); + int pid = newProc.getPid().intValue(); + e = new HpdTestbed(); + e.sendCommandExpectPrompt("attach " + pid, "Attached to process " + pid + ".*"); + e.sendCommandExpectPrompt("kill", "Killing process " + pid + ".*"); + try { Thread.sleep(500); } catch (Exception e) { } + e.sendCommandExpectPrompt("run", "running with this command.*"); + e.send("quit\n"); + e.expect("Quitting\\.\\.\\..*"); + e.close(); + } + + /** * Test entering a non-integer as a PID */ public void testKillError() { hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 4ee203efb3be5d328cfe419d1f9c24f17e7ea32e (commit) from 0bab10e95e305d3fe1b83ea9bde5a8782175118c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 4ee203efb3be5d328cfe419d1f9c24f17e7ea32e Author: Rick Moseley <rmoseley@dhcp-215.hsv.redhat.com> Date: Tue Jun 24 15:05:09 2008 -0500 Correct misspelling. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/proc/live/LinuxWaitBuilder.java | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/live/LinuxWaitBuilder.java b/frysk-core/frysk/proc/live/LinuxWaitBuilder.java index 39ce518..0943eb9 100644 --- a/frysk-core/frysk/proc/live/LinuxWaitBuilder.java +++ b/frysk-core/frysk/proc/live/LinuxWaitBuilder.java @@ -113,7 +113,7 @@ class LinuxWaitBuilder implements WaitBuilder { private void logMissing(String what, ProcessIdentifier pid) { String warning = ("No task for " + what + " pid " + pid + " possibly caused by earlier [test] code" - + " failing to clean up all childen"); + + " failing to clean up all children"); System.out.println("WARNING: " + warning); fine.log(warning); } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 0bab10e95e305d3fe1b83ea9bde5a8782175118c (commit) from f9e790bb9dea8d3d188cbcc995bc7fed8d42ff0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 0bab10e95e305d3fe1b83ea9bde5a8782175118c Author: Phil Muldoon <pmuldoon@redhat.com> Date: Tue Jun 24 08:13:52 2008 +0100 Really return watchpoint minimum length. 2008-06-24 Phil Muldoon <pmuldoon@redhat.com> * WatchpointFunctions.java (getWatchpointMinLength): Really return the minimum length. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/isa/watchpoints/ChangeLog | 5 +++++ .../frysk/isa/watchpoints/WatchpointFunctions.java | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/isa/watchpoints/ChangeLog b/frysk-core/frysk/isa/watchpoints/ChangeLog index 74e9127..cc0ef21 100644 --- a/frysk-core/frysk/isa/watchpoints/ChangeLog +++ b/frysk-core/frysk/isa/watchpoints/ChangeLog @@ -1,3 +1,8 @@ +2008-06-24 Phil Muldoon <pmuldoon@redhat.com> + + * WatchpointFunctions.java (getWatchpointMinLength): Really + return the minimum length. + 2008-06-16 Phil Muldoon <pmuldoon@redhat.com> * WatchpointFunctions.java (getTriggeredWatchpoints): New. diff --git a/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java index 2196016..973678f 100644 --- a/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java +++ b/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java @@ -191,7 +191,7 @@ public abstract class WatchpointFunctions { * @return int minimum length */ public final int getWatchpointMinLength() { - return watchpointMaxLength; + return watchpointMinLength; } } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via f9e790bb9dea8d3d188cbcc995bc7fed8d42ff0e (commit) from 5539327049ca4af57908f6bd0e90196a20378395 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit f9e790bb9dea8d3d188cbcc995bc7fed8d42ff0e Author: Rick Moseley <rmoseley@localhost.localdomain> Date: Mon Jun 23 16:35:31 2008 -0500 Add "load" command to UI. * SourceBuffer.java: Call getEntryPoint to get address. * SourceWindow.java: Add "load" capability. * SourceWindowFactory.java: Add loadExecutable method. * DynamicSegment.java: Make getEntryPoint public. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/solib/ChangeLog | 5 + frysk-core/frysk/solib/DynamicSegment.java | 4 +- frysk-gui/frysk/gui/srcwin/ChangeLog | 6 + frysk-gui/frysk/gui/srcwin/SourceBuffer.java | 10 ++ frysk-gui/frysk/gui/srcwin/SourceWindow.java | 139 +++++++++++++++++--- .../frysk/gui/srcwin/SourceWindowFactory.java | 33 ++++-- 6 files changed, 167 insertions(+), 30 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/solib/ChangeLog b/frysk-core/frysk/solib/ChangeLog index c1f7205..529a5a1 100644 --- a/frysk-core/frysk/solib/ChangeLog +++ b/frysk-core/frysk/solib/ChangeLog @@ -1,3 +1,8 @@ +2008-06-23 Rick Moseley <rmoseley@redhat.com> + + * DynamicSegment.java: Made getEntryPoint public. + + 2008-03-10 Andrew Cagney <cagney@redhat.com> * MemoryMapFactory.java: Update to match MemoryMap. diff --git a/frysk-core/frysk/solib/DynamicSegment.java b/frysk-core/frysk/solib/DynamicSegment.java index e773894..d9a98c5 100644 --- a/frysk-core/frysk/solib/DynamicSegment.java +++ b/frysk-core/frysk/solib/DynamicSegment.java @@ -51,7 +51,7 @@ import frysk.proc.Auxv; * to extract the information are all closed. */ -class DynamicSegment { +public class DynamicSegment { private static final Log fine = Log.fine(DynamicSegment.class); final long addr; @@ -99,7 +99,7 @@ class DynamicSegment { * Helper function to locate and report the backing Executables * entry point */ - private static long getEntryPoint(Elf exeElf) { + public static long getEntryPoint(Elf exeElf) { fine.log("getEntryPoint", exeElf); ElfEHeader eHeader = exeElf.getEHeader(); if (eHeader == null) diff --git a/frysk-gui/frysk/gui/srcwin/ChangeLog b/frysk-gui/frysk/gui/srcwin/ChangeLog index 1c0eb0d..fe5f98f 100644 --- a/frysk-gui/frysk/gui/srcwin/ChangeLog +++ b/frysk-gui/frysk/gui/srcwin/ChangeLog @@ -1,3 +1,9 @@ +2008-06-23 Rick Moseley <rmoseley@redhat.com> + + * SourceBuffer.java: Call getEntryPoint to get address. + * SourceWindow.java: Add "load" capability. + * SourceWindowFactory.java: Add loadExecutable method. + 2008-06-10 Andrew Cagney <cagney@redhat.com> * CurrentStackView.java (STACK_OPTIONS): New. Pass to diff --git a/frysk-gui/frysk/gui/srcwin/SourceBuffer.java b/frysk-gui/frysk/gui/srcwin/SourceBuffer.java index 0957b49..5950415 100644 --- a/frysk-gui/frysk/gui/srcwin/SourceBuffer.java +++ b/frysk-gui/frysk/gui/srcwin/SourceBuffer.java @@ -50,6 +50,8 @@ import java.util.List; import lib.dwfl.Disassembler; import lib.dwfl.Instruction; +import lib.dwfl.Elf; +import lib.dwfl.ElfCommand; import org.gnu.gdk.Color; import org.gnu.glib.JGException; @@ -80,6 +82,7 @@ import frysk.gui.srcwin.prefs.SyntaxPreference.SyntaxPreferenceListener; import frysk.proc.Task; import frysk.rt.LineXXX; import frysk.scopes.SourceLocation; +import frysk.solib.DynamicSegment; import frysk.value.Value; /** @@ -850,10 +853,17 @@ public class SourceBuffer extends TextBuffer { task.getMemory()); long address = frame.getAddress(); + // If the address is 0, use the entry point as the address to disassemble + if (address == 0) { + Elf elf = new Elf(task.getProc().getExeFile().getFile(), + ElfCommand.ELF_C_READ); + address = DynamicSegment.getEntryPoint(elf); + } this.deleteText(this.getStartIter(), this.getEndIter()); List instructionsList = diss.disassembleInstructions(address, 40); + Iterator iter = instructionsList.iterator(); while (iter.hasNext()) { diff --git a/frysk-gui/frysk/gui/srcwin/SourceWindow.java b/frysk-gui/frysk/gui/srcwin/SourceWindow.java index dfc8124..06a7a9e 100644 --- a/frysk-gui/frysk/gui/srcwin/SourceWindow.java +++ b/frysk-gui/frysk/gui/srcwin/SourceWindow.java @@ -167,6 +167,8 @@ public class SourceWindow extends Window { private Action close; private Action open_core; + + private Action open_load; private Action open_executable; @@ -580,7 +582,7 @@ public class SourceWindow extends Window { /** * Populates the stack browser window * - * @param frames An array of DebugInfoFrames used to popuate information + * @param frames An array of DebugInfoFrames used to populate information * inside the stack frame window. */ public void populateStackBrowser(DebugInfoFrame[][] frames) { @@ -886,7 +888,8 @@ public class SourceWindow extends Window { Proc[] newSwProc = new Proc[numProcs]; DOMFactory.clearDOMSourceMap(this.swProc[this.current]); - this.steppingEngine.detachProc(this.swProc[this.current], kill); + if (this.swProc[this.current].getPid() != 0) + this.steppingEngine.detachProc(this.swProc[this.current], kill); int j = 0; for (int i = 0; i < oldSize; i++) { @@ -916,7 +919,7 @@ public class SourceWindow extends Window { /*********************************************************************** * Getters and Setters **********************************************************************/ - + public Proc getSwProc() { if (this.swProc.length > 0) return this.swProc[this.current]; @@ -986,7 +989,7 @@ public class SourceWindow extends Window { this.open_core = new Action("open", "Examine core file...", "Examine core file", GtkStockItem.OPEN.getString()); this.open_core.setAccelGroup(ag); - this.open_core.setAccelPath("<sourceWin>/File/Examine core file..."); + this.open_core.setAccelPath("<sourceWin>/Processes/Examine core file..."); this.open_core.addListener(new org.gnu.gtk.event.ActionListener() { public void actionEvent(ActionEvent action) { // SourceWindow.this.glade.getWidget(SOURCE_WINDOW).destroy(); @@ -1023,7 +1026,7 @@ public class SourceWindow extends Window { // to // select a file name public void fileActivated(FileChooserEvent event) { - examineCoreFile(chooser.getFilename()); + examineCoreFile(); } }); setDefaultIcon(IconManager.windowIcon); @@ -1036,15 +1039,84 @@ public class SourceWindow extends Window { // The OK button was clicked, go open a source window for this // core file else if (response == ResponseType.OK.getValue()) { - examineCoreFile(chooser.getFilename()); + examineCoreFile(); chooser.destroy(); } } }); - AccelMap.changeEntry("<sourceWin>/File/Examine core file...", + AccelMap.changeEntry("<sourceWin>/Processes/Examine core file...", KeyValue.o, ModifierType.CONTROL_MASK, true); this.open_core.connectAccelerator(); + + // Load executable action + this.open_load = new Action("Load an executable", + "Load a process...", "Load a process from a file", + GtkStockItem.OPEN.getString()); + this.open_load.setAccelGroup(ag); + this.open_load + .setAccelPath("<sourceWin>/Processes/Load a process..."); + this.open_load.addListener(new ActionListener() { + public void actionEvent(ActionEvent action) { + try { + glade_fc = new LibGlade(Prefix.gladeFile(FILECHOOSER_GLADE).getAbsolutePath(), null); + fc = (FileChooserDialog) glade_fc + .getWidget("frysk_filechooserdialog"); + fc.addListener(new LifeCycleListener() { + public void lifeCycleEvent(LifeCycleEvent event) { + } + + public boolean lifeCycleQuery(LifeCycleEvent event) { + if (event.isOfType(LifeCycleEvent.Type.DELETE) + || event + .isOfType(LifeCycleEvent.Type.DESTROY)) + fc.destroy(); + return false; + } + }); + fc.addListener(new FileChooserListener() { + public void currentFolderChanged(FileChooserEvent event) { + } + + public void selectionChanged(FileChooserEvent event) { + } + + public void updatePreview(FileChooserEvent event) { + } + + // This method is called when the "Enter" key is pressed + // to + // select a file name in the chooser + public void fileActivated(FileChooserEvent event) { + loadExecutableFile(); + } + }); + fc.setIcon(IconManager.windowIcon); + fc.setDefaultResponse(FileChooserEvent.Type.FILE_ACTIVATED + .getID()); + fc.setCurrentFolder(System.getProperty("user.home")); + CheckButton term_activate = (CheckButton) glade_fc + .getWidget("term_activate"); + term_activate.setSensitive(false); + gtk_widget_set_size_request(fc.getHandle(), 300, 600); + int response = fc.open(); + // "OK" key has been clicked + if (response == ResponseType.OK.getValue()) + loadExecutableFile(); + // "Cancel" key has been clicked + if (response == ResponseType.CANCEL.getValue()) + fc.destroy(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }); + + AccelMap.changeEntry("<sourceWin>/Processes/Load executable file...", + KeyValue.l, ModifierType.CONTROL_MASK, true); + this.open_load.connectAccelerator(); + + // Close action this.close = new Action("close", "Close", "Close Window", GtkStockItem.CLOSE.getString()); @@ -1345,9 +1417,11 @@ public class SourceWindow extends Window { fc.setDefaultResponse(FileChooserEvent.Type.FILE_ACTIVATED .getID()); fc.setCurrentFolder(System.getProperty("user.home")); - gtk_widget_set_size_request(fc.getHandle(), 300, 300); + CheckButton term_activate = (CheckButton) glade_fc + .getWidget("term_activate"); + term_activate.setSensitive(false); + gtk_widget_set_size_request(fc.getHandle(), 300, 1000); int response = fc.open(); - gtk_widget_set_size_request(fc.getHandle(), 300, 300); // "OK" key has been clicked if (response == ResponseType.OK.getValue()) activateProc(); @@ -1570,17 +1644,41 @@ public class SourceWindow extends Window { } /** - * This method will activate a window to allow the user to exemaine a + * This method will activate a window to allow the user to examine a * core file * * @param filename - * String containing the path to the core file * */ - private void examineCoreFile(String filename) { + private void examineCoreFile() { + Entry task_options = (Entry) glade_fc.getWidget("task_options"); + String task_opt = task_options.getText(); + String filename = fc.getFilename(); + fc.destroy(); + String[] stds = { "/dev/null", "/dev/null", "/dev/null" }; + addProc(filename, "", task_opt, stds[0], stds[1], stds[2]); SourceWindowFactory.attachToCore(new File(filename)); - this.destroy(); } + + /** + * This method will activate a window to allow the user to load an + * executable file + * + * @param filename - + * String containing the path to the executable file + * + */ + private void loadExecutableFile() { + Entry task_options = (Entry) glade_fc.getWidget("task_options"); + String task_opt = task_options.getText(); + String filename = fc.getFilename(); + fc.destroy(); + String[] stds = { "/dev/null", "/dev/null", "/dev/null" }; + addProc(filename, "", task_opt, stds[0], stds[1], stds[2]); + SourceWindowFactory.loadExecutable(new File(filename), null); + //this.destroy(); +} /** * Creates the toolbar menus with initialized Actions. @@ -1589,11 +1687,14 @@ public class SourceWindow extends Window { // File menu MenuItem menu = new MenuItem("File", true); - // MenuItem mi = (MenuItem) this.open_core.createMenuItem(); + /* MenuItem mi = (MenuItem) this.open_core.createMenuItem(); + Menu tmp = new Menu(); + tmp.append(mi); + mi = (MenuItem) this.open_load.createMenuItem(); + tmp.append(mi); + mi = new MenuItem(); // Separator + tmp.append(mi); */ Menu tmp = new Menu(); - // tmp.append(mi); - // mi = new MenuItem(); // Separator - // tmp.append(mi); MenuItem mi = (MenuItem) this.close.createMenuItem(); tmp.append(mi); @@ -1686,14 +1787,16 @@ public class SourceWindow extends Window { menu = new MenuItem("Processes", false); tmp = new Menu(); - mi = (MenuItem) this.open_executable.createMenuItem(); + mi = (MenuItem) this.attach_proc.createMenuItem(); tmp.append(mi); mi = new MenuItem(); // Separator tmp.append(mi); - mi = (MenuItem) this.attach_proc.createMenuItem(); + mi = (MenuItem) this.open_executable.createMenuItem(); tmp.append(mi); mi = (MenuItem) this.open_core.createMenuItem(); tmp.append(mi); + mi = (MenuItem) this.open_load.createMenuItem(); + tmp.append(mi); menu.setSubmenu(tmp); ((MenuBar) this.glade.getWidget("menubar")).append(menu); diff --git a/frysk-gui/frysk/gui/srcwin/SourceWindowFactory.java b/frysk-gui/frysk/gui/srcwin/SourceWindowFactory.java index e662bb7..652ee6c 100644 --- a/frysk-gui/frysk/gui/srcwin/SourceWindowFactory.java +++ b/frysk-gui/frysk/gui/srcwin/SourceWindowFactory.java @@ -51,6 +51,7 @@ import org.gnu.gtk.event.LifeCycleListener; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; import frysk.proc.dead.LinuxCoreFactory; +import frysk.proc.dead.LinuxExeFactory; import frysk.config.Prefix; import frysk.proc.TaskAttachedObserverXXX; import frysk.debuginfo.DebugInfoFrame; @@ -140,16 +141,28 @@ public class SourceWindowFactory public static void attachToCore(File coreFile) { Proc proc = LinuxCoreFactory.createProc(coreFile); - LinkedList tasks = proc.getTasks(); - DebugInfoFrame[] framez = new DebugInfoFrame[tasks.size()]; - Iterator iter = tasks.iterator(); - for (int i = 0; iter.hasNext(); i++) - { - Task task = (Task) iter.next(); - framez[i] = DebugInfoStackFactory.createDebugInfoStackTrace(task); - } - createSourceWindow(framez); - } + LinkedList tasks = proc.getTasks(); + DebugInfoFrame[] framez = new DebugInfoFrame[tasks.size()]; + Iterator iter = tasks.iterator(); + for (int i = 0; iter.hasNext(); i++) { + Task task = (Task) iter.next(); + framez[i] = DebugInfoStackFactory.createDebugInfoStackTrace(task); + } + createSourceWindow(framez); + } + + public static void loadExecutable(File exeFile, String[] args) { + Proc proc = LinuxExeFactory.createProc(exeFile, args); + + LinkedList tasks = proc.getTasks(); + DebugInfoFrame[] framez = new DebugInfoFrame[tasks.size()]; + Iterator iter = tasks.iterator(); + for (int i = 0; iter.hasNext(); i++) { + Task task = (Task) iter.next(); + framez[i] = DebugInfoStackFactory.createDebugInfoStackTrace(task); + } + createSourceWindow(framez); + } public static AttachedObserver startNewProc(String file, String env_variables, String options, String stdin, String stdout, String stderr) hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 5539327049ca4af57908f6bd0e90196a20378395 (commit) from 96412cf7f66a603e6ba048433317aed31c8b1543 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 5539327049ca4af57908f6bd0e90196a20378395 Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 23:38:33 2008 -0400 In ProcBuilder, catch any Throwable; Make FileElements return NULL when no file. frysk-sys/frysk/sys/proc/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * jni/ProcBuilder.cxx (ProcBuilder::construct): Catch a Throwable. * jni/ProcBuilder.cxx (ProcBuilder::construct): Ditto. frysk-sys/jnixx/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * elements.hxx (slurp): Return the BUF. (FileElements::slurp): Update. * elements.cxx (slurp): Update; when file-not-found return NULL. ----------------------------------------------------------------------- Summary of changes: frysk-sys/frysk/sys/proc/ChangeLog | 5 +++++ frysk-sys/frysk/sys/proc/cni/ProcBuilder.cxx | 4 ++-- frysk-sys/frysk/sys/proc/jni/ProcBuilder.cxx | 4 ++-- frysk-sys/jnixx/ChangeLog | 6 ++++++ frysk-sys/jnixx/elements.cxx | 14 +++++++------- frysk-sys/jnixx/elements.hxx | 11 ++++++++--- 6 files changed, 30 insertions(+), 14 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/frysk/sys/proc/ChangeLog b/frysk-sys/frysk/sys/proc/ChangeLog index 79c61d4..b6ac106 100644 --- a/frysk-sys/frysk/sys/proc/ChangeLog +++ b/frysk-sys/frysk/sys/proc/ChangeLog @@ -1,3 +1,8 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * jni/ProcBuilder.cxx (ProcBuilder::construct): Catch a Throwable. + * jni/ProcBuilder.cxx (ProcBuilder::construct): Ditto. + 2008-06-12 Andrew Cagney <cagney@redhat.com> * Exe.java (getName): Rename get. diff --git a/frysk-sys/frysk/sys/proc/cni/ProcBuilder.cxx b/frysk-sys/frysk/sys/proc/cni/ProcBuilder.cxx index 20c09e6..2b0bc85 100644 --- a/frysk-sys/frysk/sys/proc/cni/ProcBuilder.cxx +++ b/frysk-sys/frysk/sys/proc/cni/ProcBuilder.cxx @@ -97,9 +97,9 @@ frysk::sys::proc::ProcBuilder::construct(jint pid, frysk::rsl::Log* warning) { try { build(frysk::sys::ProcessIdentifierFactory::create(id)); - } catch (java::lang::RuntimeException *e) { + } catch (java::lang::Throwable *t) { ::closedir(proc); - throw e; + throw t; } } diff --git a/frysk-sys/frysk/sys/proc/jni/ProcBuilder.cxx b/frysk-sys/frysk/sys/proc/jni/ProcBuilder.cxx index 866dfd1..2cc52ae 100644 --- a/frysk-sys/frysk/sys/proc/jni/ProcBuilder.cxx +++ b/frysk-sys/frysk/sys/proc/jni/ProcBuilder.cxx @@ -92,9 +92,9 @@ frysk::sys::proc::ProcBuilder::construct(::jnixx::env env, jint pid, try { build(env, frysk::sys::ProcessIdentifierFactory::create(env, id)); - } catch (java::lang::RuntimeException *e) { + } catch (java::lang::Throwable t) { ::closedir(proc); - throw e; + throw t; } } diff --git a/frysk-sys/jnixx/ChangeLog b/frysk-sys/jnixx/ChangeLog index 8a2673e..d9ce902 100644 --- a/frysk-sys/jnixx/ChangeLog +++ b/frysk-sys/jnixx/ChangeLog @@ -1,3 +1,9 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * elements.hxx (slurp): Return the BUF. + (FileElements::slurp): Update. + * elements.cxx (slurp): Update; when file-not-found return NULL. + 2008-06-12 Andrew Cagney <cagney@redhat.com> * exceptions.cxx (userException): Implement. diff --git a/frysk-sys/jnixx/elements.cxx b/frysk-sys/jnixx/elements.cxx index 4a432ae..4200f2f 100644 --- a/frysk-sys/jnixx/elements.cxx +++ b/frysk-sys/jnixx/elements.cxx @@ -102,12 +102,13 @@ chars2strings(::jnixx::env env, char** argv) { return strings; } -void -slurp(jnixx::env env, const char file[], jbyte*& buf, jsize& len) { +jbyte* +slurp(jnixx::env env, const char file[], jsize& len) { // Attempt to open the file. int fd = ::open(file, O_RDONLY); if (fd < 0) { - errnoException(env, errno, "open", "file %s", file); + len = 0; + return NULL; } // Initially allocate space for two BUFSIZE reads (and an extra NUL @@ -117,7 +118,7 @@ slurp(jnixx::env env, const char file[], jbyte*& buf, jsize& len) { // reads are needed to confirm EOF. Allocating 2&BUFSIZE ensures // that there's always space for at least two reads. Ref SW #3370 jsize allocated = BUFSIZ * 2 + 1; - buf = (jbyte*) ::malloc(allocated); + jbyte* buf = (jbyte*) ::malloc(allocated); if (buf == NULL) { errnoException(env, errno, "malloc"); } @@ -131,9 +132,8 @@ slurp(jnixx::env env, const char file[], jbyte*& buf, jsize& len) { ::close(fd); ::free(buf); // Abandon the read with elements == NULL. - buf = NULL; len = 0; - return; + return NULL; } else if (size == 0) { break; } @@ -149,7 +149,6 @@ slurp(jnixx::env env, const char file[], jbyte*& buf, jsize& len) { int err = errno; ::close(fd); ::free(buf); - buf = NULL; len = 0; errnoException(env, err, "realloc"); } @@ -162,4 +161,5 @@ slurp(jnixx::env env, const char file[], jbyte*& buf, jsize& len) { // Guarentee that the buffer is NUL terminated; but don't count that // as part of the buffer. buf[len] = '\0'; + return buf; } diff --git a/frysk-sys/jnixx/elements.hxx b/frysk-sys/jnixx/elements.hxx index 75f137f..dcf8109 100644 --- a/frysk-sys/jnixx/elements.hxx +++ b/frysk-sys/jnixx/elements.hxx @@ -49,7 +49,13 @@ extern char** strings2chars(::jnixx::env, ::jnixx::array<java::lang::String>); extern ::jnixx::array<java::lang::String> chars2strings(::jnixx::env, char**); -extern void slurp(::jnixx::env, const char[], jbyte* (&), jsize&); + +/** + * Attempt to read the entire contents of the specified file. Return + * BUF and set LEN, or NULL should the open fail. The BUF will be NUL + * terminated but the NUL will not be included in the character count. + */ +extern jbyte* slurp(::jnixx::env, const char file[], jsize& len); class StringArrayChars { private: @@ -239,9 +245,8 @@ public: } protected: void slurp(jnixx::env& env, type* (&buf), jsize &len) { - jbyte* buffer; jsize length; - ::slurp(env, file, buffer, length); + jbyte* buffer = ::slurp(env, file, length); buf = (type*)buffer; len = length / sizeof(type); } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 96412cf7f66a603e6ba048433317aed31c8b1543 (commit) from 75e76209d2bde38c31b45978fcda6aa863547aeb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 96412cf7f66a603e6ba048433317aed31c8b1543 Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 17:13:03 2008 -0400 (Re-)implement frysk.sys.poll, fixing JNI failures. Number of things: - move frysk.sys.Poll to its own package - make the nexted Poll$Fds class first class - Use FileDescriptor, instead of <<int fd>> in parameters This also fixes the JNI frysk.event failures. frysk-core/frysk/event/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * PollEventLoop.java: Update; Poll et.al., moved to frysk.sys.poll. frysk-sys/frysk/sys/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * Poll.java: Move to frysk.sys.poll. * PollBuilder.java: Ditto. * jni/Poll.cxx: Ditto. * cni/Poll.cxx: Ditto. frysk-sys/frysk/sys/poll/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * Poll.java: Moved from frysk.sys. * PollBuilder.java: Ditto. * jni/Poll.cxx: Ditto. * cni/Poll.cxx: Ditto. * PollFileDescriptors.java: Extract from Poll.java. * jni/PollFileDescriptors.java: Extract from jni/Poll.cxx. * cni/PollFileDescriptors.java: Similar. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/event/ChangeLog | 5 + frysk-core/frysk/event/PollEventLoop.java | 13 ++-- frysk-sys/frysk/sys/ChangeLog | 7 ++ frysk-sys/frysk/sys/poll/ChangeLog | 16 ++++ frysk-sys/frysk/sys/{ => poll}/Poll.java | 47 +++++------- frysk-sys/frysk/sys/{ => poll}/PollBuilder.java | 9 ++- .../PollFileDescriptors.java} | 37 ++++++++-- frysk-sys/frysk/sys/{ => poll}/cni/Poll.cxx | 80 +++++--------------- .../cni/PollFileDescriptors.cxx} | 45 +++++++++-- frysk-sys/frysk/sys/{ => poll}/jni/Poll.cxx | 72 ++++-------------- .../jni/PollFileDescriptors.cxx} | 45 +++++++++-- 11 files changed, 198 insertions(+), 178 deletions(-) create mode 100644 frysk-sys/frysk/sys/poll/ChangeLog rename frysk-sys/frysk/sys/{ => poll}/Poll.java (81%) copy frysk-sys/frysk/sys/{ => poll}/PollBuilder.java (92%) copy frysk-sys/frysk/sys/{PollBuilder.java => poll/PollFileDescriptors.java} (71%) rename frysk-sys/frysk/sys/{ => poll}/cni/Poll.cxx (77%) copy frysk-sys/frysk/sys/{PollBuilder.java => poll/cni/PollFileDescriptors.cxx} (67%) rename frysk-sys/frysk/sys/{ => poll}/jni/Poll.cxx (79%) rename frysk-sys/frysk/sys/{PollBuilder.java => poll/jni/PollFileDescriptors.cxx} (66%) First 500 lines of diff: diff --git a/frysk-core/frysk/event/ChangeLog b/frysk-core/frysk/event/ChangeLog index b457707..13ecd79 100644 --- a/frysk-core/frysk/event/ChangeLog +++ b/frysk-core/frysk/event/ChangeLog @@ -1,3 +1,8 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * PollEventLoop.java: Update; Poll et.al., moved to + frysk.sys.poll. + 2008-05-23 Teresa Thomas <tthomas@redhat.com> * ActionPointEvent.java: New file. diff --git a/frysk-core/frysk/event/PollEventLoop.java b/frysk-core/frysk/event/PollEventLoop.java index 8b841f9..31a09be 100644 --- a/frysk-core/frysk/event/PollEventLoop.java +++ b/frysk-core/frysk/event/PollEventLoop.java @@ -39,8 +39,9 @@ package frysk.event; -import frysk.sys.Poll; -import frysk.sys.PollBuilder; +import frysk.sys.FileDescriptor; +import frysk.sys.poll.Poll; +import frysk.sys.poll.PollBuilder; import frysk.sys.Signal; import frysk.sys.Wait; import frysk.sys.WaitBuilder; @@ -101,10 +102,8 @@ class PollEventLoop extends EventLoop { add (new PollWaitOnSigChild (waitBuilder)); } - private PollBuilder pollObserver = new PollBuilder () - { - public String toString () - { + private PollBuilder pollObserver = new PollBuilder() { + public String toString() { return ("{" + super.toString () + "}"); } public void signal(Signal sig) { @@ -112,7 +111,7 @@ class PollEventLoop extends EventLoop { processSignal (sig); } // Not yet using file descriptors. - public void pollIn (int fd) { + public void pollIn(FileDescriptor fd) { throw new RuntimeException ("should not happen"); } }; diff --git a/frysk-sys/frysk/sys/ChangeLog b/frysk-sys/frysk/sys/ChangeLog index aec7679..30c807d 100644 --- a/frysk-sys/frysk/sys/ChangeLog +++ b/frysk-sys/frysk/sys/ChangeLog @@ -1,3 +1,10 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * Poll.java: Move to frysk.sys.poll. + * PollBuilder.java: Ditto. + * jni/Poll.cxx: Ditto. + * cni/Poll.cxx: Ditto. + 2008-06-12 Andrew Cagney <cagney@redhat.com> * cni/Errno.cxx (throwUserException): New. diff --git a/frysk-sys/frysk/sys/poll/ChangeLog b/frysk-sys/frysk/sys/poll/ChangeLog new file mode 100644 index 0000000..236b189 --- /dev/null +++ b/frysk-sys/frysk/sys/poll/ChangeLog @@ -0,0 +1,16 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * Poll.java: Moved from frysk.sys. + * PollBuilder.java: Ditto. + * jni/Poll.cxx: Ditto. + * cni/Poll.cxx: Ditto. + * PollFileDescriptors.java: Extract from Poll.java. + * jni/PollFileDescriptors.java: Extract from jni/Poll.cxx. + * cni/PollFileDescriptors.java: Similar. +\f +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/frysk-sys/frysk/sys/Poll.java b/frysk-sys/frysk/sys/poll/Poll.java similarity index 81% rename from frysk-sys/frysk/sys/Poll.java rename to frysk-sys/frysk/sys/poll/Poll.java index 8496fd8..bef9c0a 100644 --- a/frysk-sys/frysk/sys/Poll.java +++ b/frysk-sys/frysk/sys/poll/Poll.java @@ -37,7 +37,10 @@ // version and license this file solely under the GPL without // exception. -package frysk.sys; +package frysk.sys.poll; + +import frysk.sys.SignalSet; +import frysk.sys.Signal; /** * Poll like interface for waiting on kernel events. @@ -49,56 +52,42 @@ package frysk.sys; * methods. */ -public final class Poll -{ +public final class Poll { /** * Set of signals checked during poll. */ static protected SignalSet signalSet = new SignalSet (); - private static native void addSignalHandler (Signal sig); /** * Add Sig to the set of signals checked during poll. */ - public static void add (Signal sig) { + public static void add(Signal sig) { signalSet.add(sig); addSignalHandler(sig); } + private static native void addSignalHandler(Signal sig); /** * Empty the set of signals, and file descriptors, checked during * poll. */ - public static void empty () - { + public static void empty() { // Note that this doesn't restore any signal handlers. signalSet.empty (); } /** - * Manage the file descriptors watched by the poll call. - */ - public static final class Fds { - long fds; - public Fds() { - fds = malloc(); - } - protected void finalize() { - free(fds); - } - private static native long malloc(); - private static native void free(long fds); - public void addPollIn(int fd) { - fds = addPollIn(fds, fd); - } - private static native long addPollIn(long fds, int fd); - } - static protected Fds pollFds = new Fds (); - - /** * Poll the system for either FD, or signal events. Block for * timeout milliseconds (if timeout is +ve or zero), or until the * next event (if timeout is -ve). Return when an event might * have occured. */ - public static native void poll (PollBuilder observer, - long timeout); + public static void poll(PollBuilder observer, long timeout) { + poll(observer, timeout, pollFds.pollFds, pollFds.fds.toArray()); + } + private static native void poll(PollBuilder observer, long timeout, + long pollFds, Object[] fds); + + /** + * Set of pollfdS. + */ + static protected PollFileDescriptors pollFds = new PollFileDescriptors(); } diff --git a/frysk-sys/frysk/sys/PollBuilder.java b/frysk-sys/frysk/sys/poll/PollBuilder.java similarity index 92% copy from frysk-sys/frysk/sys/PollBuilder.java copy to frysk-sys/frysk/sys/poll/PollBuilder.java index 8c13aab..d3f6c3d 100644 --- a/frysk-sys/frysk/sys/PollBuilder.java +++ b/frysk-sys/frysk/sys/poll/PollBuilder.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2007, Red Hat Inc. +// Copyright 2005, 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -37,12 +37,15 @@ // version and license this file solely under the GPL without // exception. -package frysk.sys; +package frysk.sys.poll; + +import frysk.sys.Signal; +import frysk.sys.FileDescriptor; /** * Notify client of Poll events. */ public interface PollBuilder { void signal(Signal sig); - void pollIn (int fd); + void pollIn(FileDescriptor fd); } diff --git a/frysk-sys/frysk/sys/PollBuilder.java b/frysk-sys/frysk/sys/poll/PollFileDescriptors.java similarity index 71% copy from frysk-sys/frysk/sys/PollBuilder.java copy to frysk-sys/frysk/sys/poll/PollFileDescriptors.java index 8c13aab..0f1380e 100644 --- a/frysk-sys/frysk/sys/PollBuilder.java +++ b/frysk-sys/frysk/sys/poll/PollFileDescriptors.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2007, Red Hat Inc. +// Copyright 2005, 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -37,12 +37,37 @@ // version and license this file solely under the GPL without // exception. -package frysk.sys; +package frysk.sys.poll; + +import frysk.sys.FileDescriptor; + +import java.util.ArrayList; /** - * Notify client of Poll events. + * Manage the file descriptors watched by the poll call. */ -public interface PollBuilder { - void signal(Signal sig); - void pollIn (int fd); +public class PollFileDescriptors { + long pollFds = malloc(); + private static native long malloc(); + final ArrayList fds = new ArrayList(); + + public PollFileDescriptors() { + } + + protected void finalize() { + free(pollFds); + } + private static native void free(long pollFds); + + public void addPollIn(FileDescriptor fd) { + int i = fds.indexOf(fd); + if (i >= 0) { + setPollIn(pollFds, i); + } else { + fds.add(fd); + pollFds = addPollIn(pollFds, fds.size(), fd.getFd()); + } + } + private static native void setPollIn(long pollFds, int pos); + private static native long addPollIn(long pollFds, int pos, int fd); } diff --git a/frysk-sys/frysk/sys/cni/Poll.cxx b/frysk-sys/frysk/sys/poll/cni/Poll.cxx similarity index 77% rename from frysk-sys/frysk/sys/cni/Poll.cxx rename to frysk-sys/frysk/sys/poll/cni/Poll.cxx index 1cffb92..5d6f367 100644 --- a/frysk-sys/frysk/sys/cni/Poll.cxx +++ b/frysk-sys/frysk/sys/poll/cni/Poll.cxx @@ -52,18 +52,19 @@ _syscall2(int, tkill, pid_t, tid, int, sig); #include <gcj/cni.h> -#include <gnu/gcj/RawDataManaged.h> #include "frysk/sys/cni/Errno.hxx" #include "frysk/sys/ProcessIdentifier.h" +#include "frysk/sys/FileDescriptor.h" #include "frysk/sys/Tid.h" -#include "frysk/sys/Poll.h" #include "frysk/sys/Signal.h" #include "frysk/sys/SignalSet.h" #include "frysk/sys/cni/SignalSet.hxx" -#include "frysk/sys/Poll$Fds.h" -#include "frysk/sys/PollBuilder.h" +#include "frysk/sys/poll/Poll.h" +#include "frysk/sys/poll/PollBuilder.h" +using namespace java::lang; +using namespace frysk::sys::poll; // If there's a signal abort the wait() function using a longjmp (and // return the signal). Should the jmpbuf be per-thread? @@ -96,8 +97,7 @@ handler (int signum, siginfo_t *siginfo, void *context) } void -frysk::sys::Poll::addSignalHandler (frysk::sys::Signal* sig) -{ +Poll::addSignalHandler (frysk::sys::Signal* sig) { int signum = sig->hashCode (); // Make certain that the signal is masked (this is ment to be // process wide). @@ -121,52 +121,12 @@ frysk::sys::Poll::addSignalHandler (frysk::sys::Signal* sig) \f -jlong -frysk::sys::Poll$Fds::malloc() { - // Allocate a non-empty buffer, marked with a sentinel. - struct pollfd* fds = (struct pollfd*) JvMalloc(sizeof (struct pollfd)); - fds->fd = -1; // sentinel - return (jlong)(long) fds; -} - -void -frysk::sys::Poll$Fds::free(jlong fds) { - JvFree((struct pollfd*)(long)fds); -} - -static jlong -addPollFd(jlong pollFds, int fd, short event) { - struct pollfd* ufds = (struct pollfd*) pollFds; - // If the FD is alreay listed, just add the event; end up with a - // count of fds. - int numFds; - for (numFds = 0; ufds[numFds].fd >= 0; numFds++) { - if (ufds[numFds].fd == fd) { - ufds[numFds].events |= event; - return pollFds; - } - } - // Create space for the new fd (and retain space for the sentinel). - ufds = (struct pollfd*) JvRealloc(ufds, (numFds + 2) * sizeof (struct pollfd)); - ufds[numFds + 0].fd = fd; - ufds[numFds + 0].events = event; - ufds[numFds + 1].fd = -1; - return (jlong) (long) ufds; -} - -jlong -frysk::sys::Poll$Fds::addPollIn(jlong fds, jint fd) { - return addPollFd(fds, fd, POLLIN); -} - -\f +#define POLLFDS ((struct pollfd*)pollFds) void -frysk::sys::Poll::poll(frysk::sys::PollBuilder* pollObserver, jlong timeout) { - // Compute the current number of poll fds. - struct pollfd* fds = (struct pollfd*)pollFds->fds; - int numFds; - for (numFds = 0; fds[numFds].fd >= 0; numFds++); +Poll::poll(PollBuilder* pollObserver, jlong timeout, jlong pollFds, + jobjectArray fds) { + int nfds = fds->length; // Set up a SIGSETJMP call that jumps back to here when any watched // signal is delivered. The signals are accumulated in a sigset, @@ -201,12 +161,12 @@ frysk::sys::Poll::poll(frysk::sys::PollBuilder* pollObserver, jlong timeout) { errno = ::pthread_sigmask (SIG_UNBLOCK, &mask, 0); if (errno != 0) throwErrno (errno, "pthread_sigmask.UNBLOCK"); - int status = ::poll (fds, numFds, timeout); + int status = ::poll(POLLFDS, nfds, timeout); if (status < 0) status = -errno; // Save the errno across the next system call. - errno = ::pthread_sigmask (SIG_BLOCK, &mask, NULL); + errno = ::pthread_sigmask(SIG_BLOCK, &mask, NULL); if (errno != 0) - throwErrno (errno, "pthread_sigmask.BLOCK"); + throwErrno(errno, "pthread_sigmask.BLOCK"); // Did something go wrong? if (status < 0) { @@ -214,7 +174,7 @@ frysk::sys::Poll::poll(frysk::sys::PollBuilder* pollObserver, jlong timeout) { case EINTR: break; default: - throwErrno (-status, "poll"); + throwErrno(-status, "poll"); } } @@ -226,20 +186,18 @@ frysk::sys::Poll::poll(frysk::sys::PollBuilder* pollObserver, jlong timeout) { // Find the signal object. frysk::sys::Signal* sig = frysk::sys::Signal::valueOf (i); // Notify the client of the signal. - pollObserver->signal (sig); + pollObserver->signal(sig); } } // Did a file descriptor fire, status when +ve, contains the number // of file descriptors that fired one or more events. - struct pollfd* pollfd = (struct pollfd*) pollFds; - while (status > 0) { - if (pollfd->revents != 0) { - if (pollfd->revents & POLLIN) - pollObserver->pollIn (pollfd->fd); + for (int i = 0; i < nfds && status > 0; i++) { + if (POLLFDS[i].revents != 0) { + if (POLLFDS[i].revents & POLLIN) + pollObserver->pollIn((frysk::sys::FileDescriptor*)(elements(fds)[i])); status--; } - pollfd++; } } diff --git a/frysk-sys/frysk/sys/PollBuilder.java b/frysk-sys/frysk/sys/poll/cni/PollFileDescriptors.cxx similarity index 67% copy from frysk-sys/frysk/sys/PollBuilder.java copy to frysk-sys/frysk/sys/poll/cni/PollFileDescriptors.cxx index 8c13aab..e03424b 100644 --- a/frysk-sys/frysk/sys/PollBuilder.java +++ b/frysk-sys/frysk/sys/poll/cni/PollFileDescriptors.cxx @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2007, Red Hat Inc. +// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -37,12 +37,41 @@ // version and license this file solely under the GPL without // exception. -package frysk.sys; +#include <poll.h> -/** - * Notify client of Poll events. - */ -public interface PollBuilder { - void signal(Signal sig); - void pollIn (int fd); +#include <gcj/cni.h> + +#include "frysk/sys/FileDescriptor.h" +#include "frysk/sys/poll/PollFileDescriptors.h" + +using namespace java::lang; +using namespace frysk::sys::poll; + +#define POLLFDS ((struct pollfd*)pollFds) + +jlong +PollFileDescriptors::malloc() { + // Allocate a non-empty buffer, marked with a sentinel. + struct pollfd* pollFds = (struct pollfd*) JvMalloc(sizeof (struct pollfd)); + return (jlong)(long)pollFds; +} + +void +PollFileDescriptors::free(jlong pollFds) { + JvFree(POLLFDS); +} + +void +PollFileDescriptors::setPollIn(jlong pollFds, jint pos) { + POLLFDS[pos].events |= POLLIN; +} + +jlong +PollFileDescriptors::addPollIn(jlong pollFds, jint pos, jint fd) { + // Create space for the new fd (and retain space for the sentinel). + struct pollfd* ufds + = (struct pollfd*) JvRealloc(POLLFDS, (pos + 1)*sizeof (struct pollfd)); + ufds[pos].fd = fd; + ufds[pos].events = POLLIN; + return (jlong) (long) ufds; } diff --git a/frysk-sys/frysk/sys/jni/Poll.cxx b/frysk-sys/frysk/sys/poll/jni/Poll.cxx similarity index 79% rename from frysk-sys/frysk/sys/jni/Poll.cxx rename to frysk-sys/frysk/sys/poll/jni/Poll.cxx index a0f0eaa..85950c0 100644 --- a/frysk-sys/frysk/sys/jni/Poll.cxx +++ b/frysk-sys/frysk/sys/poll/jni/Poll.cxx @@ -58,7 +58,7 @@ #include "frysk/sys/jni/SignalSet.hxx" using namespace java::lang; -using namespace frysk::sys; +using namespace frysk::sys::poll; // If there's a signal abort the wait() function using a longjmp (and // return the signal). Should the jmpbuf be per-thread? @@ -114,52 +114,12 @@ Poll::addSignalHandler(jnixx::env env, Signal sig) { hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 75e76209d2bde38c31b45978fcda6aa863547aeb (commit) from 50ae71ea90cbbb3d8822fa7929a08322247cd24c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 75e76209d2bde38c31b45978fcda6aa863547aeb Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 15:21:02 2008 -0400 Throw/catch UserExceptions, not RuntimeExceptions in unwinder. This first gets the stack code catching just user (i.e., not bad frysk code) exceptions; and secondly, for jni, gets it catching them correctly. frysk-core/frysk/proc/dead/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * CorefileByteBuffer.java: Throw UserException, not RuntimeException. frysk-sys/lib/unwind/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * jni/UnwindH.hxx (access_mem): Catch Throwable and then use instanceof to identify a UserException. * cni/UnwindH.hxx (access_mem): Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/proc/dead/ChangeLog | 5 ++ frysk-core/frysk/proc/dead/CorefileByteBuffer.java | 46 ++++++++++--------- frysk-sys/lib/unwind/ChangeLog | 6 +++ frysk-sys/lib/unwind/cni/UnwindH.hxx | 15 ++++-- frysk-sys/lib/unwind/jni/UnwindH.hxx | 14 ++++-- 5 files changed, 54 insertions(+), 32 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog index 83851a5..d2b8beb 100644 --- a/frysk-core/frysk/proc/dead/ChangeLog +++ b/frysk-core/frysk/proc/dead/ChangeLog @@ -1,3 +1,8 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * CorefileByteBuffer.java: Throw UserException, not + RuntimeException. + 2008-06-11 Andrew Cagney <cagney@redhat.com> * TestLinuxCore.java: Update to match stack trace output. diff --git a/frysk-core/frysk/proc/dead/CorefileByteBuffer.java b/frysk-core/frysk/proc/dead/CorefileByteBuffer.java index 0abed3b..86274e6 100644 --- a/frysk-core/frysk/proc/dead/CorefileByteBuffer.java +++ b/frysk-core/frysk/proc/dead/CorefileByteBuffer.java @@ -39,6 +39,7 @@ package frysk.proc.dead; +import frysk.UserException; import frysk.sys.StatelessFile; import java.io.File; import java.util.ArrayList; @@ -92,10 +93,9 @@ public class CorefileByteBuffer extends ByteBuffer { closeCoreFileElf(elf); } - protected void poke(long arg0, int arg1) - { - throw new RuntimeException("Cannot poke into a corefile!"); - } + protected void poke(long arg0, int arg1) { + throw new UserException("Cannot poke into a corefile!"); + } protected int peek(long address) { @@ -120,20 +120,22 @@ public class CorefileByteBuffer extends ByteBuffer { long offset = metaLine.solibOffset + (address - metaLine.vaddr); temp.pread(offset, buffer,0,1); } else { - throw new RuntimeException("CorefileByteBuffer: Cannot peek() at address 0x"+ - Long.toHexString(address)+". Offset exists in file: " + - metaLine.name+" but that file cannot be accessed."); + throw new UserException + ("CorefileByteBuffer: Cannot peek() at address 0x" + + Long.toHexString(address)+". Offset exists in file: " + + metaLine.name+" but that file cannot be accessed."); } } } - else - throw new RuntimeException("CorefileByteBuffer: Cannot peek() " + - "at address 0x" + - Long.toHexString(address)+"." + - " Address location is unknown " + - " (not in corefile, executable or "+ - " mapped solibs)."); + else { + throw new UserException("CorefileByteBuffer: Cannot peek() " + + "at address 0x" + + Long.toHexString(address)+"." + + " Address location is unknown " + + " (not in corefile, executable or "+ + " mapped solibs)."); + } return buffer[0]; } @@ -236,14 +238,14 @@ public class CorefileByteBuffer extends ByteBuffer { //XXX: the boolean gate indicates offset not found. if (!foundOffset) - throw new RuntimeException("Cannot find file offset for given address 0x" - + Long.toHexString(address)); + throw new UserException("Cannot find file offset for given address 0x" + + Long.toHexString(address)); if (!presentInFile) - throw new RuntimeException("Cannot read file offset for given address 0x" - + Long.toHexString(address) + - ". It is elided from the core file"); + throw new UserException("Cannot read file offset for given address 0x" + + Long.toHexString(address) + + ". It is elided from the core file"); return offset; } @@ -295,9 +297,9 @@ public class CorefileByteBuffer extends ByteBuffer { "",0x1000)); } } - } - else - throw new RuntimeException("Cannot IO access " + this.coreFile.getPath()); + } else { + throw new UserException("Cannot IO access " + this.coreFile.getPath()); + } return (MapAddressHeader[]) localList.toArray(new MapAddressHeader[localList.size()]); } diff --git a/frysk-sys/lib/unwind/ChangeLog b/frysk-sys/lib/unwind/ChangeLog index 39bcd79..5e72c59 100644 --- a/frysk-sys/lib/unwind/ChangeLog +++ b/frysk-sys/lib/unwind/ChangeLog @@ -1,3 +1,9 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * jni/UnwindH.hxx (access_mem): Catch Throwable and then use + instanceof to identify a UserException. + * cni/UnwindH.hxx (access_mem): Ditto. + 2008-05-26 Andrew Cagney <cagney@redhat.com> * jni/ElfImage.cxx: Delete. diff --git a/frysk-sys/lib/unwind/cni/UnwindH.hxx b/frysk-sys/lib/unwind/cni/UnwindH.hxx index 925b8af..1469bcd 100644 --- a/frysk-sys/lib/unwind/cni/UnwindH.hxx +++ b/frysk-sys/lib/unwind/cni/UnwindH.hxx @@ -62,6 +62,7 @@ #include <java/lang/ArrayIndexOutOfBoundsException.h> #include "inua/eio/ByteBuffer.h" +#include "frysk/UserException.h" #include "frysk/rsl/Log.h" #include "frysk/rsl/cni/Log.hxx" #include "lib/dwfl/Dwfl.h" @@ -149,11 +150,15 @@ access_mem(::unw_addr_space_t as, ::unw_word_t addr, tmp, (jboolean) write); memcpy(valp, elements(tmp), JvGetArrayLength(tmp)); return ret; - } catch (RuntimeException *t) { - // We have to catch all RuntimeExceptions here since there - // is no indicator for just "invalid memory location". - // Core files might have "holes" in their memory. - return -UNW_EINVAL; + } catch (Throwable *t) { + if (frysk::UserException::class$.isInstance(t)) { + // We have to catch all RuntimeExceptions here since there + // is no indicator for just "invalid memory location". + // Core files might have "holes" in their memory. + return -UNW_EINVAL; + } else { + throw t; + } } } diff --git a/frysk-sys/lib/unwind/jni/UnwindH.hxx b/frysk-sys/lib/unwind/jni/UnwindH.hxx index 3f42723..76e57b7 100644 --- a/frysk-sys/lib/unwind/jni/UnwindH.hxx +++ b/frysk-sys/lib/unwind/jni/UnwindH.hxx @@ -147,11 +147,15 @@ access_mem(::unw_addr_space_t as, ::unw_word_t addr, tmp.release(); jtmp.DeleteLocalRef(env); return ret; - } catch (RuntimeException *t) { - // We have to catch all RuntimeExceptions here since there - // is no indicator for just "invalid memory location". - // Core files might have "holes" in their memory. - return -UNW_EINVAL; + } catch (Throwable t) { + if (t.IsInstanceOf(env, frysk::UserException::_class_(env))) { + // We have to catch all RuntimeExceptions here since there is no + // indicator for just "invalid memory location". Core files + // might have "holes" in their memory. + return -UNW_EINVAL; + } else { + throw t; + } } } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 50ae71ea90cbbb3d8822fa7929a08322247cd24c (commit) from 9147b4bdb1a382b221dcdc340365ebd3f411f694 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 50ae71ea90cbbb3d8822fa7929a08322247cd24c Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 15:07:07 2008 -0400 Add more tracing to ptrace code (unfortunatly fprintf). frysk-sys/frysk/sys/ptrace/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * jni/AddressSpace.cxx: Simplify debug code. * cni/AddressSpace.cxx: Ditto. * jni/Ptrace.hxx (ptraceOpToString(int)): Declare. * cni/Ptrace.hxx (ptraceOpToString(int)): Ditto. * jni/Ptrace.cxx (ptraceOpToString): Rename op_as_string. * cni/Ptrace.cxx (ptraceOpToString): Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-sys/frysk/sys/ptrace/ChangeLog | 9 +++ frysk-sys/frysk/sys/ptrace/cni/AddressSpace.cxx | 88 ++++++++++------------- frysk-sys/frysk/sys/ptrace/cni/Ptrace.cxx | 18 ++++-- frysk-sys/frysk/sys/ptrace/cni/Ptrace.hxx | 1 + frysk-sys/frysk/sys/ptrace/jni/AddressSpace.cxx | 88 ++++++++++------------- frysk-sys/frysk/sys/ptrace/jni/Ptrace.cxx | 18 ++++-- frysk-sys/frysk/sys/ptrace/jni/Ptrace.hxx | 1 + 7 files changed, 113 insertions(+), 110 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/frysk/sys/ptrace/ChangeLog b/frysk-sys/frysk/sys/ptrace/ChangeLog index 9484163..30c1ac0 100644 --- a/frysk-sys/frysk/sys/ptrace/ChangeLog +++ b/frysk-sys/frysk/sys/ptrace/ChangeLog @@ -1,3 +1,12 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * jni/AddressSpace.cxx: Simplify debug code. + * cni/AddressSpace.cxx: Ditto. + * jni/Ptrace.hxx (ptraceOpToString(int)): Declare. + * cni/Ptrace.hxx (ptraceOpToString(int)): Ditto. + * jni/Ptrace.cxx (ptraceOpToString): Rename op_as_string. + * cni/Ptrace.cxx (ptraceOpToString): Ditto. + 2008-05-25 Andrew Cagney <cagney@redhat.com> * jni/AddressSpace.cxx: Use jbyteArrayElements. diff --git a/frysk-sys/frysk/sys/ptrace/cni/AddressSpace.cxx b/frysk-sys/frysk/sys/ptrace/cni/AddressSpace.cxx index 232e1f3..b8d0af7 100644 --- a/frysk-sys/frysk/sys/ptrace/cni/AddressSpace.cxx +++ b/frysk-sys/frysk/sys/ptrace/cni/AddressSpace.cxx @@ -37,6 +37,9 @@ // version and license this file solely under the GPL without // exception. +#define DEBUG 0 + +#include <stdio.h> #include <stdint.h> #include <sys/types.h> #include <sys/ptrace.h> @@ -61,21 +64,17 @@ jint frysk::sys::ptrace::AddressSpace::peek(jint pid, jlong addr) { union word w; long paddr = addr & -sizeof(long); -#if DEBUG - fprintf(stderr, "peek 0x%lx paddr 0x%lx", (long)addr, paddr); -#endif + if (DEBUG) + fprintf(stderr, "peek 0x%lx paddr 0x%lx", (long)addr, paddr); w.l = ptraceOp(ptPeek, pid, (void*)paddr, 0); -#if DEBUG - fprintf(stderr, " word 0x%lx", w.l); -#endif + if (DEBUG) + fprintf(stderr, " word 0x%lx", w.l); int index = addr & (sizeof(long) - 1); -#if DEBUG - fprintf(stderr, " index %d", index); -#endif + if (DEBUG) + fprintf(stderr, " index %d", index); uint8_t byte = w.b[index]; -#if DEBUG - fprintf(stderr, " byte %d/0x%x\n", byte, byte); -#endif + if (DEBUG) + fprintf(stderr, " byte %d/0x%x\n", byte, byte); return byte; } @@ -83,25 +82,20 @@ void frysk::sys::ptrace::AddressSpace::poke(jint pid, jlong addr, jint data) { // Implement read-modify-write union word w; -#if DEBUG - fprintf(stderr, "poke 0x%x", (int)(data & 0xff)); -#endif + if (DEBUG) + fprintf(stderr, "poke 0x%x", (int)(data & 0xff)); long paddr = addr & -sizeof(long); -#if DEBUG - fprintf(stderr, " addr 0x%lx paddr 0x%lx", (long)addr, paddr); -#endif + if (DEBUG) + fprintf(stderr, " addr 0x%lx paddr 0x%lx", (long)addr, paddr); w.l = ptraceOp(ptPeek, pid, (void*)paddr, 0); -#if DEBUG - fprintf(stderr, " word 0x%lx", w.l); -#endif + if (DEBUG) + fprintf(stderr, " word 0x%lx", w.l); int index = addr & (sizeof(long) - 1); -#if DEBUG - fprintf (stderr, " index %d", index); -#endif + if (DEBUG) + fprintf (stderr, " index %d", index); w.b[index] = data; -#if DEBUG - fprintf(stderr, " word 0x%lx\n", w.l); -#endif + if (DEBUG) + fprintf(stderr, " word 0x%lx\n", w.l); ptraceOp(ptPoke, pid, (void*)(addr & -sizeof(long)), w.l); } @@ -112,13 +106,11 @@ frysk::sys::ptrace::AddressSpace::transfer(jint op, jint pid, jlong addr, verifyBounds(bytes, offset, length); // Somewhat more clueful implementation for (jlong i = 0; i < length;) { -#if DEBUG - fprintf(stderr, - "transfer pid %d addr 0x%lx length %d offset %d op %d (%s)", - (int)pid, (long)addr, (int)length, (int)offset, - (int)op, op_as_string(op)); -#endif - + if (DEBUG) + fprintf(stderr, + "transfer pid %d addr 0x%lx length %d offset %d op %d (%s) ...", + (int)pid, (long)addr, (int)length, (int)offset, + (int)op, ptraceOpToString(op)); union word w; unsigned long waddr = addr & -sizeof(long); unsigned long woff = (addr - waddr); @@ -130,37 +122,33 @@ frysk::sys::ptrace::AddressSpace::transfer(jint op, jint pid, jlong addr, wend = woff + remaining; long wlen = wend - woff; -#if DEBUG - fprintf(stderr, - " i %ld waddr 0x%lx woff %lu wend %lu remaining %lu wlen %lu", - (long)i, waddr, woff, wend, remaining, wlen); -#endif + if (DEBUG) + fprintf(stderr, + " i %ld waddr 0x%lx woff %lu wend %lu remaining %lu wlen %lu ...", + (long)i, waddr, woff, wend, remaining, wlen); // Either a peek; or a partial write requiring read/modify/write. if (op == ptPeek || woff != 0 || wend != sizeof(long)) { - w.l = ptraceOp(ptPeek, pid, (void*)waddr, 0); -#if DEBUG - fprintf(stderr, " peek 0x%lx", w.l); -#endif - } + w.l = ptraceOp(ptPeek, pid, (void*)waddr, 0); + if (DEBUG) + fprintf(stderr, " peek 0x%lx ...", w.l); + } // extract or modify if (op == ptPeek) memcpy(offset + i + elements(bytes), &w.b[woff], wlen); else { memcpy(&w.b[woff], offset + i + elements(bytes), wlen); -#if DEBUG - fprintf(stderr, " poke 0x%lx", w.l); -#endif + if (DEBUG) + fprintf(stderr, " poke 0x%lx ...", w.l); w.l = ptraceOp(ptPoke, pid, (void*)waddr, w.l); } i += wlen; addr += wlen; -#if DEBUG - fprintf(stderr, "\n"); -#endif + if (DEBUG) + fprintf(stderr, "\n"); } } diff --git a/frysk-sys/frysk/sys/ptrace/cni/Ptrace.cxx b/frysk-sys/frysk/sys/ptrace/cni/Ptrace.cxx index 4aa12eb..3375efd 100644 --- a/frysk-sys/frysk/sys/ptrace/cni/Ptrace.cxx +++ b/frysk-sys/frysk/sys/ptrace/cni/Ptrace.cxx @@ -37,6 +37,10 @@ // version and license this file solely under the GPL without // exception. +#define DEBUG 0 + +#include <stdio.h> +#include <string.h> #include <errno.h> #include <sys/ptrace.h> #include "linux.ptrace.h" @@ -47,8 +51,8 @@ #include "frysk/sys/ptrace/Ptrace.h" #include "frysk/sys/ptrace/cni/Ptrace.hxx" -static const char* -op_as_string(int op) { +const char* +ptraceOpToString(int op) { switch(op) { #define OP(NAME) case NAME: return #NAME OP(PTRACE_ATTACH); @@ -82,10 +86,14 @@ op_as_string(int op) { long ptraceOp(int op, int pid, void* addr, long data) { errno = 0; - long result = ::ptrace ((enum __ptrace_request) op, pid, addr, data); - if (errno != 0) + long result = ::ptrace((enum __ptrace_request) op, pid, addr, data); + if (errno != 0) { + int err = errno; + if (DEBUG) + fprintf(stderr, "throwing %s\n", strerror(err)); throwErrno(errno, "ptrace", "op 0x%x (%s), pid %d, addr 0x%lx, data 0x%lx", - op, op_as_string(op), pid, (long)addr, data); + op, ptraceOpToString(op), pid, (long)addr, data); + } return result; } diff --git a/frysk-sys/frysk/sys/ptrace/cni/Ptrace.hxx b/frysk-sys/frysk/sys/ptrace/cni/Ptrace.hxx index 78bda4d..1da0f03 100644 --- a/frysk-sys/frysk/sys/ptrace/cni/Ptrace.hxx +++ b/frysk-sys/frysk/sys/ptrace/cni/Ptrace.hxx @@ -38,3 +38,4 @@ // exception. extern long ptraceOp(int, int, void*, long); +extern const char *ptraceOpToString(int op); diff --git a/frysk-sys/frysk/sys/ptrace/jni/AddressSpace.cxx b/frysk-sys/frysk/sys/ptrace/jni/AddressSpace.cxx index 598d8cc..9600657 100644 --- a/frysk-sys/frysk/sys/ptrace/jni/AddressSpace.cxx +++ b/frysk-sys/frysk/sys/ptrace/jni/AddressSpace.cxx @@ -37,6 +37,9 @@ // version and license this file solely under the GPL without // exception. +#define DEBUG 0 + +#include <stdio.h> #include <stdint.h> #include <sys/types.h> #include <sys/ptrace.h> @@ -60,21 +63,17 @@ jint frysk::sys::ptrace::AddressSpace::peek(::jnixx::env env, jint pid, jlong addr) { union word w; long paddr = addr & -sizeof(long); -#if DEBUG - fprintf(stderr, "peek 0x%lx paddr 0x%lx", (long)addr, paddr); -#endif + if (DEBUG) + fprintf(stderr, "peek 0x%lx paddr 0x%lx", (long)addr, paddr); w.l = ptraceOp(env, GetPtPeek(env), pid, (void*)paddr, 0); -#if DEBUG - fprintf(stderr, " word 0x%lx", w.l); -#endif + if (DEBUG) + fprintf(stderr, " word 0x%lx", w.l); int index = addr & (sizeof(long) - 1); -#if DEBUG - fprintf(stderr, " index %d", index); -#endif + if (DEBUG) + fprintf(stderr, " index %d", index); uint8_t byte = w.b[index]; -#if DEBUG - fprintf(stderr, " byte %d/0x%x\n", byte, byte); -#endif + if (DEBUG) + fprintf(stderr, " byte %d/0x%x\n", byte, byte); return byte; } @@ -82,25 +81,20 @@ void frysk::sys::ptrace::AddressSpace::poke(::jnixx::env env, jint pid, jlong addr, jint data) { // Implement read-modify-write union word w; -#if DEBUG - fprintf(stderr, "poke 0x%x", (int)(data & 0xff)); -#endif + if (DEBUG) + fprintf(stderr, "poke 0x%x", (int)(data & 0xff)); long paddr = addr & -sizeof(long); -#if DEBUG - fprintf(stderr, " addr 0x%lx paddr 0x%lx", (long)addr, paddr); -#endif + if (DEBUG) + fprintf(stderr, " addr 0x%lx paddr 0x%lx", (long)addr, paddr); w.l = ptraceOp(env, GetPtPeek(env), pid, (void*)paddr, 0); -#if DEBUG - fprintf(stderr, " word 0x%lx", w.l); -#endif + if (DEBUG) + fprintf(stderr, " word 0x%lx", w.l); int index = addr & (sizeof(long) - 1); -#if DEBUG - fprintf (stderr, " index %d", index); -#endif + if (DEBUG) + fprintf (stderr, " index %d", index); w.b[index] = data; -#if DEBUG - fprintf(stderr, " word 0x%lx\n", w.l); -#endif + if (DEBUG) + fprintf(stderr, " word 0x%lx\n", w.l); ptraceOp(env, GetPtPoke(env), pid, (void*)(addr & -sizeof(long)), w.l); } @@ -114,13 +108,11 @@ frysk::sys::ptrace::AddressSpace::transfer(::jnixx::env env, verifyBounds(env, byteArray, offset, length); // Somewhat more clueful implementation for (jlong i = 0; i < length;) { -#if DEBUG - fprintf(stderr, - "transfer pid %d addr 0x%lx length %d offset %d op %d (%s)", - (int)pid, (long)addr, (int)length, (int)offset, - (int)op, op_as_string(op)); -#endif - + if (DEBUG) + fprintf(stderr, + "transfer pid %d addr 0x%lx length %d offset %d op %d (%s) ...", + (int)pid, (long)addr, (int)length, (int)offset, + (int)op, ptraceOpToString(op)); union word w; unsigned long waddr = addr & -sizeof(long); unsigned long woff = (addr - waddr); @@ -132,19 +124,17 @@ frysk::sys::ptrace::AddressSpace::transfer(::jnixx::env env, wend = woff + remaining; long wlen = wend - woff; -#if DEBUG - fprintf(stderr, - " i %ld waddr 0x%lx woff %lu wend %lu remaining %lu wlen %lu", - (long)i, waddr, woff, wend, remaining, wlen); -#endif + if (DEBUG) + fprintf(stderr, + " i %ld waddr 0x%lx woff %lu wend %lu remaining %lu wlen %lu ...", + (long)i, waddr, woff, wend, remaining, wlen); // Either a peek; or a partial write requiring read/modify/write. if (op == ptPeek || woff != 0 || wend != sizeof(long)) { - w.l = ptraceOp(env, ptPeek, pid, (void*)waddr, 0); -#if DEBUG - fprintf(stderr, " peek 0x%lx", w.l); -#endif - } + w.l = ptraceOp(env, ptPeek, pid, (void*)waddr, 0); + if (DEBUG) + fprintf(stderr, " peek 0x%lx ...", w.l); + } // extract or modify jbyteArrayElements bytes = jbyteArrayElements(env, byteArray); @@ -152,9 +142,8 @@ frysk::sys::ptrace::AddressSpace::transfer(::jnixx::env env, memcpy(offset + i + bytes.elements(), &w.b[woff], wlen); else { memcpy(&w.b[woff], offset + i + bytes.elements(), wlen); -#if DEBUG - fprintf(stderr, " poke 0x%lx", w.l); -#endif + if (DEBUG) + fprintf(stderr, " poke 0x%lx ...", w.l); w.l = ptraceOp(env, ptPoke, pid, (void*)waddr, w.l); } bytes.release(); @@ -162,9 +151,8 @@ frysk::sys::ptrace::AddressSpace::transfer(::jnixx::env env, i += wlen; addr += wlen; -#if DEBUG - fprintf(stderr, "\n"); -#endif + if (DEBUG) + fprintf(stderr, "\n"); } } diff --git a/frysk-sys/frysk/sys/ptrace/jni/Ptrace.cxx b/frysk-sys/frysk/sys/ptrace/jni/Ptrace.cxx index 1a7c13f..dce86e5 100644 --- a/frysk-sys/frysk/sys/ptrace/jni/Ptrace.cxx +++ b/frysk-sys/frysk/sys/ptrace/jni/Ptrace.cxx @@ -37,6 +37,10 @@ // version and license this file solely under the GPL without // exception. +#define DEBUG 0 + +#include <stdio.h> +#include <string.h> #include <errno.h> #include <sys/ptrace.h> #include "linux.ptrace.h" @@ -47,8 +51,8 @@ #include "jnixx/exceptions.hxx" -static const char* -op_as_string(int op) { +const char* +ptraceOpToString(int op) { switch(op) { #define OP(NAME) case NAME: return #NAME OP(PTRACE_ATTACH); @@ -82,11 +86,15 @@ op_as_string(int op) { long ptraceOp(::jnixx::env env, int op, int pid, void* addr, long data) { errno = 0; - long result = ::ptrace ((enum __ptrace_request) op, pid, addr, data); - if (errno != 0) + long result = ::ptrace((enum __ptrace_request) op, pid, addr, data); + if (errno != 0) { + int err = errno; + if (DEBUG) + fprintf(stderr, "throwing %s\n", strerror(err)); errnoException(env, errno, "ptrace", "op 0x%x (%s), pid %d, addr 0x%lx, data 0x%lx", - op, op_as_string(op), pid, (long)addr, data); + op, ptraceOpToString(op), pid, (long)addr, data); + } return result; } diff --git a/frysk-sys/frysk/sys/ptrace/jni/Ptrace.hxx b/frysk-sys/frysk/sys/ptrace/jni/Ptrace.hxx index be134ef..46e2edd 100644 --- a/frysk-sys/frysk/sys/ptrace/jni/Ptrace.hxx +++ b/frysk-sys/frysk/sys/ptrace/jni/Ptrace.hxx @@ -38,3 +38,4 @@ // exception. extern long ptraceOp(::jnixx::env, int, int, void*, long); +extern const char *ptraceOpToString(int op); hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 9147b4bdb1a382b221dcdc340365ebd3f411f694 (commit) via bec4e629bf34a5ac515aaeb1fbabdc04c39f9f2b (commit) from 0e2c16ad37aefb00338a1e50800df5359982a74f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 9147b4bdb1a382b221dcdc340365ebd3f411f694 Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 13:34:18 2008 -0400 Avoid % rule, explicitly specify the target for libfrysk-sys-jni.so. There were two candidates for libfrysk-sys-jni.so: .a.so: and %-jni.so:%-jni.a, since make took either, just be explicit. frysk-common/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * Makefile.rules (lib$(GEN_DIRNAME)-jni.so): Replace less explicit %-jni.so target. commit bec4e629bf34a5ac515aaeb1fbabdc04c39f9f2b Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 13:16:53 2008 -0400 When logging an exception, include the inner most frame. frysk-sys/frysk/rsl/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * Printer.java: Include the inner most stack frame when printing exceptions. ----------------------------------------------------------------------- Summary of changes: frysk-common/ChangeLog | 3 +++ frysk-common/Makefile.rules | 3 ++- frysk-sys/frysk/rsl/ChangeLog | 5 +++++ frysk-sys/frysk/rsl/Printer.java | 20 ++++++++++++++++---- 4 files changed, 26 insertions(+), 5 deletions(-) First 500 lines of diff: diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog index 266b0f2..10dc607 100644 --- a/frysk-common/ChangeLog +++ b/frysk-common/ChangeLog @@ -1,5 +1,8 @@ 2008-06-20 Andrew Cagney <cagney@redhat.com> + * Makefile.rules (lib$(GEN_DIRNAME)-jni.so): Replace less explicit + %-jni.so target. + * Makefile.rules (Runner): Delete LD_PRELOAD hack. 2008-06-19 Andrew Cagney <cagney@redhat.com> diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules index 233bbde..c80b81c 100644 --- a/frysk-common/Makefile.rules +++ b/frysk-common/Makefile.rules @@ -473,7 +473,8 @@ JNI_LIBRARY_LIST = # A list of extra object files that should be added to the .so. JNI_OBJECT_LIST = -%-jni.so: %-jni.a $(JNI_ARCHIVE_LIST) $(JNI_OBJECT_LIST) +lib$(GEN_DIRNAME)-jni.so: $(JNI_ARCHIVE_LIST) $(JNI_OBJECT_LIST) +lib$(GEN_DIRNAME)-jni.so: lib$(GEN_DIRNAME)-jni.a soname=`basename $@` ; \ $(CC) -shared -o $@.tmp \ -Wl,--whole-archive \ diff --git a/frysk-sys/frysk/rsl/ChangeLog b/frysk-sys/frysk/rsl/ChangeLog index a37407d..87484e4 100644 --- a/frysk-sys/frysk/rsl/ChangeLog +++ b/frysk-sys/frysk/rsl/ChangeLog @@ -1,3 +1,8 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * Printer.java: Include the inner most stack frame when printing + exceptions. + 2008-06-19 Andrew Cagney <cagney@redhat.com> * Log.java: Add more methods. diff --git a/frysk-sys/frysk/rsl/Printer.java b/frysk-sys/frysk/rsl/Printer.java index a8e926d..5ebec05 100644 --- a/frysk-sys/frysk/rsl/Printer.java +++ b/frysk-sys/frysk/rsl/Printer.java @@ -158,11 +158,23 @@ public final class Printer { */ private void dump(Throwable t) { out.print("<<exception "); - out.print(t.toString()); - for (Throwable cause = t.getCause(); cause != null; - cause = cause.getCause()) { + while (true) { + out.print(t.toString()); + StackTraceElement[] stack = t.getStackTrace(); + for (int i = 0; i < stack.length; i++) { + if (i >= 1) { + // XXX: the cap is some what arbitrary + out.print(" ..."); + break; + } else { + out.print(" <at> "); + out.print(stack[i].toString()); + } + } + t = t.getCause(); + if (t == null) + break; out.print(" <caused-by> "); - out.print(cause.toString()); } out.print(">>"); } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 0e2c16ad37aefb00338a1e50800df5359982a74f (commit) from 99f1e6c3225f69f6559e33ed19a00eb2e01ca745 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 0e2c16ad37aefb00338a1e50800df5359982a74f Author: Andrew Cagney <cagney@redhat.com> Date: Fri Jun 20 10:38:18 2008 -0400 Delete LD_PRELOAD hack. frysk-common/ChangeLog 2008-06-20 Andrew Cagney <cagney@redhat.com> * Makefile.rules (Runner): Delete LD_PRELOAD hack. ----------------------------------------------------------------------- Summary of changes: frysk-common/ChangeLog | 4 ++++ frysk-common/Makefile.rules | 13 ------------- 2 files changed, 4 insertions(+), 13 deletions(-) First 500 lines of diff: diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog index a44bebe..266b0f2 100644 --- a/frysk-common/ChangeLog +++ b/frysk-common/ChangeLog @@ -1,3 +1,7 @@ +2008-06-20 Andrew Cagney <cagney@redhat.com> + + * Makefile.rules (Runner): Delete LD_PRELOAD hack. + 2008-06-19 Andrew Cagney <cagney@redhat.com> * Makefile.gen.sh (jni): Delete. diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules index 3292bb8..233bbde 100644 --- a/frysk-common/Makefile.rules +++ b/frysk-common/Makefile.rules @@ -400,21 +400,8 @@ Runner: echo "" >> $@.tmp echo "# some pre-definitions" >> $@.tmp echo "elfutils=$(frysk_imports)/elfutils" >> $@.tmp - echo "libunwind=$(frysk_imports)/libunwind" >> $@.tmp echo "java=\"$(JAVA) $(GEN_GCJ_NO_SIGCHLD_FLAGS)\"" >> $@.tmp echo "" >> $@.tmp - echo "# Hack to pull in JNI dependences" >> $@.tmp - echo "export LD_PRELOAD=\\" >> $@.tmp - echo "\$${elfutils}/libelf/libelf.so\\ \\" >> $@.tmp - echo "\$${elfutils}/libdw/libdw.so\\ \\" >> $@.tmp - echo "\$${elfutils}/libasm/libasm.so\\ \\" >> $@.tmp - echo "\$${libunwind}-i386/src/.libs/libunwind-x86.so\\ \\" >> $@.tmp - echo "\$${libunwind}-ppc32/src/.libs/libunwind-ppc32.so\\ \\" >> $@.tmp - echo "\$${libunwind}-ppc64/src/.libs/libunwind-ppc64.so\\ \\" >> $@.tmp - echo "\$${libunwind}-x86_64/src/.libs/libunwind-x86_64.so\\ \\" >> $@.tmp - echo "libstdc++.so.6\\ \\" >> $@.tmp - echo "libaudit.so" >> $@.tmp - echo "" >> $@.tmp echo "# hack to hopefully find the right libstdc++.so" >> $@.tmp echo "export LD_LIBRARY_PATH=$(frysk_sys)\\" >> $@.tmp echo ":\$${elfutils}/backends\\" >> $@.tmp hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 99f1e6c3225f69f6559e33ed19a00eb2e01ca745 (commit) from c69c6ceede39e0ffa06f94321447a25e0d0e2b4d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 99f1e6c3225f69f6559e33ed19a00eb2e01ca745 Author: Petr Machata <pmachata@redhat.com> Date: Fri Jun 20 16:37:27 2008 +0200 Support periods in ftrace symbol names * Not possible for C expressions, otherwise #MAIN#a.b would become a pain to write. In ftrace we don't care about expressions, and periods are occasionally used in low-level symbol names (e.g. __i686.get_pc_thunk.bx) * So glob for "all symbols with period" is *.* -- MS-DOS anyone? ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/expr/CExpr.g | 2 +- frysk-core/frysk/expr/ChangeLog | 10 +++++++ frysk-core/frysk/expr/FQIdentParser.java | 39 ++++++++++++++++++----------- 3 files changed, 35 insertions(+), 16 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/expr/CExpr.g b/frysk-core/frysk/expr/CExpr.g index 0f528be..2654a89 100644 --- a/frysk-core/frysk/expr/CExpr.g +++ b/frysk-core/frysk/expr/CExpr.g @@ -416,7 +416,7 @@ tokens { final FQIdentParser fqIdParser - = new FQIdentParser(this, true, false, true); + = new FQIdentParser(this, true, false, true, false); } AMPERSAND : '&' ; diff --git a/frysk-core/frysk/expr/ChangeLog b/frysk-core/frysk/expr/ChangeLog index 2257a31..9816cdf 100644 --- a/frysk-core/frysk/expr/ChangeLog +++ b/frysk-core/frysk/expr/ChangeLog @@ -1,3 +1,13 @@ +2008-06-20 Petr Machata <pmachata@redhat.com> + + * FQIdentParser.java (ctor): Take extra argument + allowPeriodInSymbol. + (parseFtraceIdentifier): Pass true for the new argument. + (parseFQIdentifier): Likewise. + (symbolPattern, globPattern): Unstatic. + (symbolRe): Kill. + * CExpr.g (fqIdParser): Pass false for the new argument. + 2008-06-13 Petr Machata <pmachata@redhat.com> * FQIdentParser.java (containsGlobChar): Rename to diff --git a/frysk-core/frysk/expr/FQIdentParser.java b/frysk-core/frysk/expr/FQIdentParser.java index de521f9..2aa9ce2 100644 --- a/frysk-core/frysk/expr/FQIdentParser.java +++ b/frysk-core/frysk/expr/FQIdentParser.java @@ -70,17 +70,8 @@ public class FQIdentParser { private final boolean allowGlobs; private final boolean expectMoreTokens; - // This pattern deliberately doesn't check for initial letter. - // Relevant code checks this explicitly. This way, if user makes - // a mistake and writes e.g. something#123+b, we recognize "123" - // as a typo, while leaving out the part after a "+", which is - // certainly irrelevant. - final static String symbolRe = "[a-zA-Z0-9_$]+"; - - private final static Pattern symbolPattern = Pattern.compile(symbolRe); - private final static Pattern globPattern - = Pattern.compile("(\\[(\\^?\\][^\\]]*|\\^[^\\]]+|[^^\\]][^\\]]*|\\^?\\[:[^:]+:\\])\\]|" - + symbolRe + "|\\*)+"); + private final Pattern symbolPattern; + private final Pattern globPattern; /** * @param allowDynamic Whether the [pid.tid#frame] portion of the @@ -101,12 +92,28 @@ public class FQIdentParser { FQIdentParser(CharScanner scanner, boolean allowDynamic, boolean allowGlobs, - boolean expectMoreTokens) { + boolean expectMoreTokens, + boolean allowPeriodInSymbol) { this.scanner = scanner; this.allowDynamic = allowDynamic; this.allowGlobs = allowGlobs; this.expectMoreTokens = expectMoreTokens; + + // This pattern deliberately doesn't check for initial letter. + // Relevant code checks this explicitly. This way, if user makes + // a mistake and writes e.g. something#123+b, we recognize "123" + // as a typo, while leaving out the part after a "+", which is + // certainly irrelevant. + String symbolRe = "[a-zA-Z0-9_$" + (allowPeriodInSymbol + ? "." : "") + "]+"; + this.symbolPattern = Pattern.compile(symbolRe); + this.globPattern + = Pattern.compile("(\\[(\\^?\\][^\\]]*" + // handles []abc] and [^]abc] + "|\\^[^\\]]+" + // handles [^abc] + "|[^^\\]][^\\]]*" + // handles [abc], and [ab^c] (cases where ^ isn't an operator) + "|\\^?\\[:[^:]+:\\]"+ // handles [[:abc:]] and [^[:abc:]] + ")\\]|" + symbolRe + "|\\*)+"); } private char fqLA(int i) throws CharStreamException { @@ -383,7 +390,8 @@ public class FQIdentParser { parseFQIdentifier(String str, boolean allowDynamic, boolean allowGlobs, - boolean expectMoreTokens) + boolean expectMoreTokens, + boolean allowPeriodInSymbol) throws ExtraGarbageException, InvalidTokenException { try { @@ -395,7 +403,8 @@ public class FQIdentParser { }; FQIdentParser parser = new FQIdentParser(scanner, allowDynamic, - allowGlobs, expectMoreTokens); + allowGlobs, expectMoreTokens, + allowPeriodInSymbol); FQIdentToken tok = parser.parse(""); if (scanner.LA(1) != CharScanner.EOF_CHAR) @@ -415,6 +424,6 @@ public class FQIdentParser { public static FQIdentifier parseFtraceIdentifier(String str) throws ExtraGarbageException, InvalidTokenException { - return parseFQIdentifier(str, false, true, false); + return parseFQIdentifier(str, false, true, false, true); } } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via c69c6ceede39e0ffa06f94321447a25e0d0e2b4d (commit) from 0f35edb5f6c7423f39c875d47182ff3708419e7d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit c69c6ceede39e0ffa06f94321447a25e0d0e2b4d Author: Petr Machata <pmachata@redhat.com> Date: Fri Jun 20 15:54:16 2008 +0200 Fix chained tracing * i.e. the case when regular entry is hit right after PLT entry for the same symbol is hit. In such a case these two entry points share the same return breakpoint, and the situation has to be handled specially. This used to be implemented, but got lost during the migration to Frysk breakpoint structures. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/ftrace/ChangeLog | 10 +++++++++- frysk-core/frysk/ftrace/Ftrace.java | 22 +++++++--------------- frysk-core/frysk/ftrace/TaskTracer.java | 18 +++++++++++++++++- 3 files changed, 33 insertions(+), 17 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog index 3fe6e9b..e2943d3 100644 --- a/frysk-core/frysk/ftrace/ChangeLog +++ b/frysk-core/frysk/ftrace/ChangeLog @@ -1,6 +1,14 @@ 2008-06-20 Petr Machata <pmachata@redhat.com> - * Ftrace.java: Keep a list of event entry tokens, and align + * Ftrace.java (getDriversForTask): Drop. + (driversForTask): Actually use it as a map(task->driver), instead + of map(task->map(mapping_path->driver)). + * TaskTracer.java (FunctionReturnObserver.add): Compare symbol + names via .equals, instead of comparing symbol pointers. + +2008-06-20 Petr Machata <pmachata@redhat.com> + + * Reporter.java: Keep a list of event entry tokens, and align eventLeave with matching eventEntry. 2008-06-10 Andrew Cagney <cagney@redhat.com> diff --git a/frysk-core/frysk/ftrace/Ftrace.java b/frysk-core/frysk/ftrace/Ftrace.java index 17d81ba..b19c39e 100644 --- a/frysk-core/frysk/ftrace/Ftrace.java +++ b/frysk-core/frysk/ftrace/Ftrace.java @@ -654,15 +654,6 @@ public class Ftrace { return ObjectFile.buildFromFile(mapping.path); } - private Map getDriversForTask(Task task) { - Map drivers = (Map)driversForTask.get(task); - if (drivers == null) { - drivers = new HashMap(); - driversForTask.put(task, drivers); - } - return drivers; - } - public Action updateMappedFile(Task task, MemoryMapping mapping) { if (traceMmapUnmap) @@ -677,10 +668,12 @@ public class Ftrace { DwflModule module = getModuleForFile(task, mapping.path); - Map drivers = getDriversForTask(task); - Driver driver = new TaskTracer(Ftrace.this, task); - drivers.put(mapping.path, driver); - this.tracingController.fileMapped(task, objf, module, driver); + Driver driver = (Driver)driversForTask.get(task); + if (driver == null) { + driver = new TaskTracer(Ftrace.this, task); + driversForTask.put(task, driver); + } + tracingController.fileMapped(task, objf, module, driver); task.requestUnblock(this); return Action.BLOCK; @@ -700,8 +693,7 @@ public class Ftrace { DwflModule module = getModuleForFile(task, mapping.path); - Map drivers = getDriversForTask(task); - Driver driver = (Driver)drivers.get(mapping.path); + Driver driver = (Driver)driversForTask.get(task); if (driver == null) throw new AssertionError("There should be a driver for `" + mapping.path + "'."); diff --git a/frysk-core/frysk/ftrace/TaskTracer.java b/frysk-core/frysk/ftrace/TaskTracer.java index 0ae6b0f..1aff7b6 100644 --- a/frysk-core/frysk/ftrace/TaskTracer.java +++ b/frysk-core/frysk/ftrace/TaskTracer.java @@ -81,6 +81,7 @@ class TaskTracer private final Ftrace ftrace; public TaskTracer(Ftrace ftrace, Task task) { + fine.log("New TaskTracer for", task); this.arch = ArchFactory.instance.getArch(task); this.ftrace = ftrace; } @@ -89,7 +90,20 @@ class TaskTracer { private final DwflSymbol symbol; private final boolean isPlt; + + /** + * TracePoint is chained when it shares return breakpoint with + * other breakpoint. When such a breakpoint is hit, it is + * assumed that both tracepoints have "left". This is used + * when both PLT and regular entry point are traced for one + * symbol. If PLT entry point hits, and regular entry point + * for the same symbol hits immediately after that, the two + * are chained. + */ private boolean chained = false; + + // When the TracePoint is frozen, it can't be chained to + // another TracePoint anymore. private boolean frozen = false; public TracePoint(DwflSymbol symbol) { @@ -119,6 +133,7 @@ class TaskTracer } public void setChained() { + fine.log("chained tracePoint", this); this.chained = true; } @@ -169,7 +184,8 @@ class TaskTracer TracePoint previous = (TracePoint)symbolList.getLast(); if (!previous.isFrozen() && previous.isPlt() && !tracePoint.isPlt() - && previous.getSymbol() == tracePoint.getSymbol()) + && previous.getSymbol().getName().equals + (tracePoint.getSymbol().getName())) tracePoint.setChained(); previous.freeze(); hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 0f35edb5f6c7423f39c875d47182ff3708419e7d (commit) from ba8ffe9b1b7d9c253c93b958a7d8202c4addfa5e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 0f35edb5f6c7423f39c875d47182ff3708419e7d Author: Petr Machata <pmachata@redhat.com> Date: Fri Jun 20 14:16:36 2008 +0200 Align correctly even stray items ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/ftrace/Reporter.java | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/ftrace/Reporter.java b/frysk-core/frysk/ftrace/Reporter.java index 6233c3f..876fc77 100644 --- a/frysk-core/frysk/ftrace/Reporter.java +++ b/frysk-core/frysk/ftrace/Reporter.java @@ -158,10 +158,16 @@ class Reporter public void eventLeave(Task task, Object item, String eventType, String eventName, Object retVal) { + String stray = ""; + ArrayList tokens = getTokens(task); - int i = tokens.size(); - while (tokens.remove(--i) != item) { - } + int i = tokens.size() - 1; + while (i >= 0 && tokens.get(i) != item) + --i; + if (i < 0) + stray = "stray "; + else + tokens.subList(i, tokens.size()).clear(); if (!myLineOpened(task, item)) { if (lineOpened()) @@ -169,7 +175,7 @@ class Reporter String spaces = ArchFormatter.repeat(' ', tokens.size()); writer.print(pidInfo(task) + " " + formatTaskPC(task) - + spaces + eventType + + spaces + stray + eventType + " " + eventName); } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via ba8ffe9b1b7d9c253c93b958a7d8202c4addfa5e (commit) from a9eb3c2804253d3206bc429404bffc78ecb83b4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit ba8ffe9b1b7d9c253c93b958a7d8202c4addfa5e Author: Petr Machata <pmachata@redhat.com> Date: Fri Jun 20 13:29:15 2008 +0200 Align mismatched eventLeaves correctly * of course it would be ideal to fix underlying bugs, but for the time being, this serves the purpose of presenting the data to the user ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/ftrace/ChangeLog | 5 ++++ frysk-core/frysk/ftrace/Reporter.java | 42 +++++++++++++++++--------------- 2 files changed, 27 insertions(+), 20 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog index a6f9abb..3fe6e9b 100644 --- a/frysk-core/frysk/ftrace/ChangeLog +++ b/frysk-core/frysk/ftrace/ChangeLog @@ -1,3 +1,8 @@ +2008-06-20 Petr Machata <pmachata@redhat.com> + + * Ftrace.java: Keep a list of event entry tokens, and align + eventLeave with matching eventEntry. + 2008-06-10 Andrew Cagney <cagney@redhat.com> * Ftrace.java: Use PrintDebugInfoStackOptions. diff --git a/frysk-core/frysk/ftrace/Reporter.java b/frysk-core/frysk/ftrace/Reporter.java index cbc95bd..6233c3f 100644 --- a/frysk-core/frysk/ftrace/Reporter.java +++ b/frysk-core/frysk/ftrace/Reporter.java @@ -40,6 +40,7 @@ package frysk.ftrace; import java.util.HashMap; +import java.util.ArrayList; import inua.util.PrintWriter; @@ -53,7 +54,10 @@ class Reporter private PrintWriter writer; private Object lastItem = null; private Task lastTask = null; - private HashMap levelMap = new HashMap(); + + // HashMap<Task, ArrayList<Object>> -- array of entry tokens for each taks + private final HashMap tokenMap = new HashMap(); + private final PrintDebugInfoStackOptions stackPrintOptions; private final boolean showPC; @@ -65,18 +69,14 @@ class Reporter this.showPC = show; } - private int getLevel(Task task) + private ArrayList getTokens(Task task) { - int level = 0; - Integer l = (Integer)levelMap.get(task); - if (l != null) - level = l.intValue(); - return level; - } - - private void setLevel(Task task, int level) - { - levelMap.put(task, new Integer(level)); + ArrayList l = (ArrayList)tokenMap.get(task); + if (l == null) { + l = new ArrayList(); + tokenMap.put(task, l); + } + return l; } private boolean lineOpened() @@ -138,9 +138,9 @@ class Reporter public void eventEntry(Task task, Object item, String eventType, String eventName, Object[] args) { - int level = this.getLevel(task); - String spaces = ArchFormatter.repeat(' ', level); - this.setLevel(task, ++level); + ArrayList tokens = getTokens(task); + String spaces = ArchFormatter.repeat(' ', tokens.size()); + tokens.add(item); if (lineOpened()) writer.println('\\'); @@ -158,13 +158,15 @@ class Reporter public void eventLeave(Task task, Object item, String eventType, String eventName, Object retVal) { - int level = this.getLevel(task); - this.setLevel(task, --level); + ArrayList tokens = getTokens(task); + int i = tokens.size(); + while (tokens.remove(--i) != item) { + } if (!myLineOpened(task, item)) { if (lineOpened()) writer.println(); - String spaces = ArchFormatter.repeat(' ', level); + String spaces = ArchFormatter.repeat(' ', tokens.size()); writer.print(pidInfo(task) + " " + formatTaskPC(task) + spaces + eventType @@ -184,12 +186,12 @@ class Reporter public void eventSingle(Task task, String eventName, Object[] args) { - int level = this.getLevel(task); + ArrayList tokens = getTokens(task); if (lineOpened()) writer.println("\\"); writer.print(pidInfo(task) + " " + formatTaskPC(task) - + ArchFormatter.repeat(' ', level) + + ArchFormatter.repeat(' ', tokens.size()) + eventName); if (args != null) hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via a9eb3c2804253d3206bc429404bffc78ecb83b4e (commit) from c739492c8f74c2ac21aee9dd17f7bad43cd413c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit a9eb3c2804253d3206bc429404bffc78ecb83b4e Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 22:34:21 2008 -0400 Fix lookup where there is no symbol. frysk-core/frysk/symtab/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * TestSymbol.java (testNoSymbolAfterGlobal()): Enable. (testNoSymbolAfterLocal()): Enable. (testAfterGlobalContiningSize0()): Enable. (testAfterLocalContiningSize0()): Enable. frysk-imports/elfutils/libdwfl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * dwfl_module_addrsym.c (dwfl_module_addrsym): Correctly update min_label. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/symtab/ChangeLog | 5 ++++ frysk-core/frysk/symtab/TestSymbol.java | 8 ------- frysk-imports/elfutils/libdwfl/ChangeLog | 5 ++++ .../elfutils/libdwfl/dwfl_module_addrsym.c | 21 +++++++++++++++---- 4 files changed, 26 insertions(+), 13 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/symtab/ChangeLog b/frysk-core/frysk/symtab/ChangeLog index a7910a0..33bc6fb 100644 --- a/frysk-core/frysk/symtab/ChangeLog +++ b/frysk-core/frysk/symtab/ChangeLog @@ -1,5 +1,10 @@ 2008-06-19 Andrew Cagney <cagney@redhat.com> + * TestSymbol.java (testNoSymbolAfterGlobal()): Enable. + (testNoSymbolAfterLocal()): Enable. + (testAfterGlobalContiningSize0()): Enable. + (testAfterLocalContiningSize0()): Enable. + * TestSymbol.java: Re-number arg param so that matching funit-symbols.S is easier. diff --git a/frysk-core/frysk/symtab/TestSymbol.java b/frysk-core/frysk/symtab/TestSymbol.java index a94c2ae..a0228b3 100644 --- a/frysk-core/frysk/symtab/TestSymbol.java +++ b/frysk-core/frysk/symtab/TestSymbol.java @@ -149,13 +149,9 @@ public class TestSymbol } public void testNoSymbolAfterGlobal() { - if (unresolved(5941)) - return; symbolTest(12, unknown, false, false); } public void testNoSymbolAfterLocal() { - if (unresolved(5941)) - return; symbolTest(13, unknown, false, false); } @@ -195,13 +191,9 @@ public class TestSymbol } public void testAfterGlobalContiningSize0() { - if (unresolved(5941)) - return; symbolTest(24, unknown, false, false); } public void testAfterLocalContiningSize0() { - if (unresolved(5941)) - return; symbolTest(25, unknown, false, false); } } diff --git a/frysk-imports/elfutils/libdwfl/ChangeLog b/frysk-imports/elfutils/libdwfl/ChangeLog index ac95d68..e1d00f1 100644 --- a/frysk-imports/elfutils/libdwfl/ChangeLog +++ b/frysk-imports/elfutils/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2008-06-19 Andrew Cagney <cagney@redhat.com> + + * dwfl_module_addrsym.c (dwfl_module_addrsym): Correctly update + min_label. + 2008-06-07 Andrew Cagney <cagney@redhat.com> * dwfl_module_getdwarf.c (open_elf): Don't align the module's load diff --git a/frysk-imports/elfutils/libdwfl/dwfl_module_addrsym.c b/frysk-imports/elfutils/libdwfl/dwfl_module_addrsym.c index c34a31b..77033a6 100644 --- a/frysk-imports/elfutils/libdwfl/dwfl_module_addrsym.c +++ b/frysk-imports/elfutils/libdwfl/dwfl_module_addrsym.c @@ -49,10 +49,13 @@ #include "libdwflP.h" +#include <stdio.h> + const char * dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, GElf_Sym *closest_sym, GElf_Word *shndxp) { + // fprintf(stderr, "looking up %lx\n", (long) addr); int syments = INTUSE(dwfl_module_getsymtab) (mod); if (syments < 0) return NULL; @@ -116,15 +119,20 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, GElf_Sym sym; GElf_Word shndx; const char *name = INTUSE(dwfl_module_getsym) (mod, i, &sym, &shndx); + // fprintf(stderr, "symbol %s at 0x%lx 0x%ld\n", name, (long) sym.st_value, (long) sym.st_size); + /* Even if we don't choose this symbol, its existence excludes + any sizeless symbol (assembly label) that is below its upper + bound. */ + if (name != NULL && sym.st_value <= addr + && sym.st_value + sym.st_size > min_label) { + min_label = sym.st_value + sym.st_size; + // fprintf(stderr, " min to %s size ends at %lx\n", name, (long) min_label); + } if (name != NULL && sym.st_value <= addr && (sym.st_size == 0 || addr - sym.st_value < sym.st_size)) { - /* Even if we don't choose this symbol, its existence - excludes any sizeless symbol (assembly label) that - is inside its bounds. */ - if (sym.st_value + sym.st_size > addr) - min_label = sym.st_value + sym.st_size; + // fprintf(stderr, " candidate %s at 0x%lx 0x%ld\n", name, (long) sym.st_value, (long) sym.st_size); /* This symbol is a better candidate than the current one if it's a named symbol, not a section or file symbol, @@ -140,6 +148,7 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, { if (sym.st_size != 0) { + // fprintf(stderr, " closest %s at %lx\n", name, (long)sym.st_value); *closest_sym = sym; closest_shndx = shndx; closest_name = name; @@ -155,6 +164,7 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, || (sizeless_sym.st_value == sym.st_value && strcmp(name, sizeless_name) < 0)) { + // fprintf(stderr, " sizeless %s at %lx\n", name, (long)sym.st_value); sizeless_sym = sym; sizeless_shndx = shndx; sizeless_name = name; @@ -171,6 +181,7 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, || (closest_sym->st_size == sym.st_size && strcmp(name, closest_name) < 0))) { + // fprintf(stderr, " alt closest %s at %lx\n", name, (long)sym.st_value); *closest_sym = sym; closest_shndx = shndx; closest_name = name; hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via c739492c8f74c2ac21aee9dd17f7bad43cd413c5 (commit) from 847c1c52413c34619621fad761bc8e47c897c978 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit c739492c8f74c2ac21aee9dd17f7bad43cd413c5 Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 21:59:09 2008 -0400 Better match TestSymbol and funit-symbols.S. frysk-core/frysk/symtab/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * TestSymbol.java: Re-number arg param so that matching funit-symbols.S is easier. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/symtab/ChangeLog | 5 ++ frysk-core/frysk/symtab/TestSymbol.java | 78 +++++++++++++++--------------- 2 files changed, 44 insertions(+), 39 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/symtab/ChangeLog b/frysk-core/frysk/symtab/ChangeLog index ba96d4e..a7910a0 100644 --- a/frysk-core/frysk/symtab/ChangeLog +++ b/frysk-core/frysk/symtab/ChangeLog @@ -1,3 +1,8 @@ +2008-06-19 Andrew Cagney <cagney@redhat.com> + + * TestSymbol.java: Re-number arg param so that matching + funit-symbols.S is easier. + 2008-06-05 Andrew Cagney <cagney@redhat.com> * DwflSymbol.java: Use DwflDie. diff --git a/frysk-core/frysk/symtab/TestSymbol.java b/frysk-core/frysk/symtab/TestSymbol.java index 79bf39a..a94c2ae 100644 --- a/frysk-core/frysk/symtab/TestSymbol.java +++ b/frysk-core/frysk/symtab/TestSymbol.java @@ -46,13 +46,13 @@ import frysk.testbed.DaemonBlockedAtSignal; public class TestSymbol extends TestLib { - private void symbolTest (String command, int numberOfArgs, - String name, boolean addressValid, - boolean sizeValid) { - // Construct an argument list containing numberOfArgs dummy - // arguments. The inferior program just looks at ARGC to - // determine what to do. - String[] fullCommand = new String[numberOfArgs + 1]; + private void symbolTest(String command, int numberOfArgs, + String name, boolean addressValid, + boolean sizeValid) { + // Construct an argument list numberOfArgs long (including + // arg[0] the program). The inferior program just looks at + // ARGC to determine what to do. + String[] fullCommand = new String[numberOfArgs]; fullCommand[0] = getExecPath (command); for (int i = 1; i < fullCommand.length; i++) { fullCommand[i] = Integer.toString(i); @@ -80,128 +80,128 @@ public class TestSymbol private String unknown = SymbolFactory.UNKNOWN.getName (); public void testDebug () { - symbolTest("funit-symbols", 1, "global_st_size", true, true); + symbolTest("funit-symbols", 2, "global_st_size", true, true); } public void testNoDebug () { - symbolTest("funit-symbols-nodebug", 1, "global_st_size", true, true); + symbolTest("funit-symbols-nodebug", 2, "global_st_size", true, true); } public void testStripped () { - symbolTest("funit-symbols-stripped", 1, unknown, false, false); + symbolTest("funit-symbols-stripped", 2, unknown, false, false); } public void testStaticDebug () { - symbolTest("funit-symbols", 2, "local_st_size", true, true); + symbolTest("funit-symbols", 3, "local_st_size", true, true); } public void testStaticNoDebug () { - symbolTest("funit-symbols-nodebug", 2, "local_st_size", true, true); + symbolTest("funit-symbols-nodebug", 3, "local_st_size", true, true); } public void testStaticStripped () { - symbolTest("funit-symbols-stripped", 2, unknown, false, false); + symbolTest("funit-symbols-stripped", 3, unknown, false, false); } public void testNoSize() { - symbolTest("funit-symbols", 3, "global_st_size_0", true, false); + symbolTest("funit-symbols", 4, "global_st_size_0", true, false); } public void testNoDebugNoSize() { - symbolTest("funit-symbols-nodebug", 3, "global_st_size_0", + symbolTest("funit-symbols-nodebug", 4, "global_st_size_0", true, false); } public void testStrippedNoSize() { - symbolTest("funit-symbols-stripped", 3, unknown, false, false); + symbolTest("funit-symbols-stripped", 4, unknown, false, false); } public void testStaticNoSize() { - symbolTest("funit-symbols", 4, "local_st_size_0", true, false); + symbolTest("funit-symbols", 5, "local_st_size_0", true, false); } public void testStaticNoDebugNoSize() { - symbolTest("funit-symbols-nodebug", 4, "local_st_size_0", true, false); + symbolTest("funit-symbols-nodebug", 5, "local_st_size_0", true, false); } public void testStaticStrippedNoSize() { - symbolTest("funit-symbols-stripped", 4, unknown, false, false); + symbolTest("funit-symbols-stripped", 5, unknown, false, false); } public void testGlobalInGlobal() { - symbolTest(5, "global_in_global", true, true); + symbolTest(6, "global_in_global", true, true); } public void testLocalInGlobal() { if (unresolved(5941)) return; - symbolTest(6, "local_in_global", true, true); + symbolTest(7, "local_in_global", true, true); } public void testGlobalInLocal() { - symbolTest(7, "global_in_local", true, true); + symbolTest(8, "global_in_local", true, true); } public void testLocalInLocal() { - symbolTest(8, "local_in_local", true, true); + symbolTest(9, "local_in_local", true, true); } public void testGlobalAfterNested() { - symbolTest(9, "global_outer", true, true); + symbolTest(10, "global_outer", true, true); } public void testLocalAfterNested() { - symbolTest(10, "local_outer", true, true); + symbolTest(11, "local_outer", true, true); } public void testNoSymbolAfterGlobal() { if (unresolved(5941)) return; - symbolTest(11, unknown, false, false); + symbolTest(12, unknown, false, false); } public void testNoSymbolAfterLocal() { if (unresolved(5941)) return; - symbolTest(12, unknown, false, false); + symbolTest(13, unknown, false, false); } public void testGlobalSize0InGlobal() { - symbolTest(13, "global_after_0", true, true); + symbolTest(14, "global_after_0", true, true); } public void testLocalSize0InGlobal() { - symbolTest(14, "global_after_0", true, true); + symbolTest(15, "global_after_0", true, true); } public void testGlobalSize0InLocal() { - symbolTest(15, "local_after_0", true, true); + symbolTest(16, "local_after_0", true, true); } public void testLocalSize0InLocal() { - symbolTest(16, "local_after_0", true, true); + symbolTest(17, "local_after_0", true, true); } public void testGlobalAfterNestedSize0() { - symbolTest(17, "global_after_0", true, true); + symbolTest(18, "global_after_0", true, true); } public void testLocalAfterNestedSize0() { - symbolTest(18, "local_after_0", true, true); + symbolTest(19, "local_after_0", true, true); } public void testSmallGlobalAtLargeGlobal() { - symbolTest(19, "small_global_at_large_global", true, true); + symbolTest(20, "small_global_at_large_global", true, true); } public void testSmallLocalAtLargeGlobal() { if (unresolved(5941)) return; - symbolTest(20, "small_local_at_large_global", true, true); + symbolTest(21, "small_local_at_large_global", true, true); } public void testSmallGlobalAtLargeLocal() { - symbolTest(21, "small_global_at_large_local", true, true); + symbolTest(22, "small_global_at_large_local", true, true); } public void testSmallLocalAtLargeLocal() { - symbolTest(22, "small_local_at_large_local", true, true); + symbolTest(23, "small_local_at_large_local", true, true); } public void testAfterGlobalContiningSize0() { if (unresolved(5941)) return; - symbolTest(23, unknown, false, false); + symbolTest(24, unknown, false, false); } public void testAfterLocalContiningSize0() { if (unresolved(5941)) return; - symbolTest(24, unknown, false, false); + symbolTest(25, unknown, false, false); } } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 847c1c52413c34619621fad761bc8e47c897c978 (commit) from edfa23da73934bf0ab40697a13b0731feabb337c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 847c1c52413c34619621fad761bc8e47c897c978 Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 21:54:27 2008 -0400 Add missing dependencies for libfrysk-sys-jni.so, add generic jni target. frysk-common/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * Makefile.gen.sh (jni): Delete. * Makefile.rules (%-jni.so): Depend on $(JNI_ARCHIVE_LIST) and $(JNI_OBJECT_LIST). (jni): New phony target. ----------------------------------------------------------------------- Summary of changes: frysk-common/ChangeLog | 5 +++++ frysk-common/Makefile.gen.sh | 3 +-- frysk-common/Makefile.rules | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) First 500 lines of diff: diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog index 2c22c3d..a44bebe 100644 --- a/frysk-common/ChangeLog +++ b/frysk-common/ChangeLog @@ -1,5 +1,10 @@ 2008-06-19 Andrew Cagney <cagney@redhat.com> + * Makefile.gen.sh (jni): Delete. + * Makefile.rules (%-jni.so): Depend on $(JNI_ARCHIVE_LIST) and + $(JNI_OBJECT_LIST). + (jni): New phony target. + * Makefile.rules (JNI_OBJECT_LIST): Define. (JNI_LIBRARY_LIST): Define. (JNI_ARCHIVE_LIST): Define. diff --git a/frysk-common/Makefile.gen.sh b/frysk-common/Makefile.gen.sh index a9dc667..6e7c3ab 100755 --- a/frysk-common/Makefile.gen.sh +++ b/frysk-common/Makefile.gen.sh @@ -895,8 +895,7 @@ noinst_LIBRARIES += lib${GEN_DIRNAME}-jni.a lib${GEN_MAKENAME}_jni_so_SOURCES = solib_PROGRAMS += lib${GEN_DIRNAME}-jni.so lib${GEN_DIRNAME}-jni.so: lib${GEN_DIRNAME}-jni.a -.PHONY: jni -jni: lib${GEN_DIRNAME}-jni.so ${GEN_DIRNAME}.jar +jni: lib${GEN_DIRNAME}-jni.so lib${GEN_MAKENAME}_jni_a_SOURCES += jni.cxx jnixx_sources = \$(wildcard \$(root_srcdir)/frysk-sys/jnixx/*.java) CLEANFILES += jni.hxx jni.cxx jni.hxx.gch diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules index 3c7d8fc..3292bb8 100644 --- a/frysk-common/Makefile.rules +++ b/frysk-common/Makefile.rules @@ -190,6 +190,10 @@ AM_CCASFLAGS = \ $(ZZZ) \f +# Just build the jar / jni dependencies files. +.PHONY: jni +jni: ${GEN_DIRNAME}.jar +\f # Within the BUILT_SOURCES, need to force some dependencies. For # instance: JAVAH isn't run until all script-generated files it may # need to import have been generated. @@ -482,7 +486,7 @@ JNI_LIBRARY_LIST = # A list of extra object files that should be added to the .so. JNI_OBJECT_LIST = -%-jni.so: %-jni.a +%-jni.so: %-jni.a $(JNI_ARCHIVE_LIST) $(JNI_OBJECT_LIST) soname=`basename $@` ; \ $(CC) -shared -o $@.tmp \ -Wl,--whole-archive \ hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via edfa23da73934bf0ab40697a13b0731feabb337c (commit) from bd2d28691caa79f3434474ae2bb1537b428aaf41 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit edfa23da73934bf0ab40697a13b0731feabb337c Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 15:51:27 2008 -0400 Include VDSO in address map. frysk-sys/lib/dwfl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * cni/Dwfl.cxx (dwfl_frysk_proc_find_elf): Always set file_name so elfutils realises that the ELF was set. * jni/Dwfl.cxx: Ditto. * TestDwfl.java (testMapContainsVdso): Check the vdso's elf. * Dwfl.java (mapModule): Include segments starting with "[". ----------------------------------------------------------------------- Summary of changes: frysk-sys/lib/dwfl/ChangeLog | 6 +++++ frysk-sys/lib/dwfl/Dwfl.java | 5 +--- frysk-sys/lib/dwfl/TestDwfl.java | 3 +- frysk-sys/lib/dwfl/cni/Dwfl.cxx | 41 ++++++++++++--------------------- frysk-sys/lib/dwfl/cni/DwflModule.cxx | 21 +++++++--------- frysk-sys/lib/dwfl/jni/Dwfl.cxx | 19 +++++++-------- 6 files changed, 41 insertions(+), 54 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog index f9e9ea0..43dc64a 100644 --- a/frysk-sys/lib/dwfl/ChangeLog +++ b/frysk-sys/lib/dwfl/ChangeLog @@ -1,5 +1,11 @@ 2008-06-19 Andrew Cagney <cagney@redhat.com> + * cni/Dwfl.cxx (dwfl_frysk_proc_find_elf): Always set file_name so + elfutils realises that the ELF was set. + * jni/Dwfl.cxx: Ditto. + * TestDwfl.java (testMapContainsVdso): Check the vdso's elf. + * Dwfl.java (mapModule): Include segments starting with "[". + * DwflTestbed.java (createFromSelf()): Pass LocalMemory to the Dwfl. * cni/DwflModule.cxx (DwflModule::setUserData): Delete. * jni/DwflModule.cxx (DwflModule::setUserData): Delete. diff --git a/frysk-sys/lib/dwfl/Dwfl.java b/frysk-sys/lib/dwfl/Dwfl.java index ef77a05..f540e9f 100644 --- a/frysk-sys/lib/dwfl/Dwfl.java +++ b/frysk-sys/lib/dwfl/Dwfl.java @@ -266,10 +266,7 @@ public class Dwfl { finest.log(this, "ignoring empty name"); } else if (name.indexOf("(deleted") >= 0) { finest.log(this, "ignoring deleted", name); - } else if (!name.startsWith("/")) { - // XXX: This is too agressive, it ignores [vdso], on - // the other hand, if vdso is included this leads to - // segmentation faults. + } else if (!name.startsWith("/") && !name.equals("[vdso]")) { finest.log(this, "ignoring non-file", name); } else { // A new map, save it, will be reported later. diff --git a/frysk-sys/lib/dwfl/TestDwfl.java b/frysk-sys/lib/dwfl/TestDwfl.java index 2aee367..2d2bcc4 100644 --- a/frysk-sys/lib/dwfl/TestDwfl.java +++ b/frysk-sys/lib/dwfl/TestDwfl.java @@ -234,8 +234,6 @@ public class TestDwfl extends TestCase { } public void testMapContainsVdso() { - if (unresolved(6626)) - return; Dwfl dwfl = DwflTestbed.createFromSelf(); DwflModule[] modules = dwfl.getModules(); DwflModule vdso = null; @@ -248,5 +246,6 @@ public class TestDwfl extends TestCase { } } assertNotNull("vdso", vdso); + assertNotNull("elf", vdso.getElf()); } } diff --git a/frysk-sys/lib/dwfl/cni/Dwfl.cxx b/frysk-sys/lib/dwfl/cni/Dwfl.cxx index 167653d..e17af96 100644 --- a/frysk-sys/lib/dwfl/cni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/cni/Dwfl.cxx @@ -79,7 +79,6 @@ read_proc_memory (void *arg, void *data, GElf_Addr address, size_t minread, size_t maxread) { inua::eio::ByteBuffer* memory = (inua::eio::ByteBuffer *) arg; - jbyteArray bytes = JvNewByteArray(maxread); ssize_t nread = memory->safeGet((off64_t) address, bytes, 0, maxread); memcpy(data, elements(bytes), nread); @@ -94,34 +93,24 @@ dwfl_frysk_proc_find_elf (Dwfl_Module *mod, const char *module_name, Dwarf_Addr base, char **file_name, Elf **elfp) { - // There is an edge case here that was tripped by a corefile case. In that case the - // specified executable was defined as a relative path (ie ../foo/bar). And that is - // perfectly valid path name. However when the corefile created its maps it did not - // convert that path to an absolute path, causing the test below to fail and consider - // the file ../foo/bar to be an in memory elf image. - if (module_name[0] == '/') - { - int fd = open64 (module_name, O_RDONLY); - if (fd >= 0) - { - *file_name = strdup (module_name); - if (*file_name == NULL) - { - close (fd); - return ENOMEM; - } - } - return fd; - } - else - { + // There is an edge case here that was tripped by a corefile + // case. In that case the specified executable was defined as a + // relative path (ie ../foo/bar). And that is perfectly valid path + // name. However when the corefile created its maps it did not + // convert that path to an absolute path, causing the test below to + // fail and consider the file ../foo/bar to be an in memory elf + // image. + if (module_name[0] == '/') { + // Pass back the file name and let dwfl take care of the rest. + *file_name = strdup (module_name); + return -1; + } else { *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, *userdata); - + if (*elfp != NULL) { + *file_name = ::strdup(module_name); + } return -1; } - - //abort (); - return -1; } jlong diff --git a/frysk-sys/lib/dwfl/cni/DwflModule.cxx b/frysk-sys/lib/dwfl/cni/DwflModule.cxx index 5d7a41a..97892ff 100644 --- a/frysk-sys/lib/dwfl/cni/DwflModule.cxx +++ b/frysk-sys/lib/dwfl/cni/DwflModule.cxx @@ -68,18 +68,15 @@ #define DWFL_MODULE_POINTER ((Dwfl_Module *) pointer) lib::dwfl::ModuleElfBias* -lib::dwfl::DwflModule::module_getelf() -{ - Dwarf_Addr bias = 0; - ::Elf *elf = dwfl_module_getelf(DWFL_MODULE_POINTER, &bias); - if(elf == NULL) - return NULL; - - lib::dwfl::ModuleElfBias *ret = new lib::dwfl::ModuleElfBias(); - ret->elf = new lib::dwfl::Elf((jlong) elf); - ret->bias = (jlong) bias; - - return ret; +lib::dwfl::DwflModule::module_getelf() { + Dwarf_Addr bias = 0; + ::Elf *elf = dwfl_module_getelf(DWFL_MODULE_POINTER, &bias); + if(elf == NULL) + return NULL; + lib::dwfl::ModuleElfBias *ret = new lib::dwfl::ModuleElfBias(); + ret->elf = new lib::dwfl::Elf((jlong) elf); + ret->bias = (jlong) bias; + return ret; } typedef JArray<lib::dwfl::DwflLine *> DwflLineArray; diff --git a/frysk-sys/lib/dwfl/jni/Dwfl.cxx b/frysk-sys/lib/dwfl/jni/Dwfl.cxx index a04b9b8..7be62a5 100644 --- a/frysk-sys/lib/dwfl/jni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/jni/Dwfl.cxx @@ -107,21 +107,20 @@ dwfl_frysk_proc_find_elf(Dwfl_Module *mod, // that path to an absolute path, causing the test below to fail and // consider the file ../foo/bar to be an in memory elf image. if (module_name[0] == '/') { - int fd = ::open64(module_name, O_RDONLY); - if (fd >= 0) { - *file_name = ::strdup(module_name); - if (*file_name == NULL) { - ::close(fd); - return ENOMEM; - } - } - return fd; + // Return the file name, and then let elfutils decide what to do. + *file_name = ::strdup(module_name); + return -1; } else { // dwfl passes in the address of the Dwfl_Module user pointer // contained within. That pointer has been previously stuffed // with our "userdata". *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, *userdata); - return 0; + if (*elfp != NULL) { + // Poke something into FILE_NAME so that the caller notices that + // we've done something to ELF. + *file_name = ::strdup(module_name); + } + return -1; } } hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via bd2d28691caa79f3434474ae2bb1537b428aaf41 (commit) from 5c0013016a63729e15b30738625df8f21e1bfd51 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit bd2d28691caa79f3434474ae2bb1537b428aaf41 Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 14:05:28 2008 -0400 Make memory accessable from all dwfl-modules. Rather than try to pick out the [vdso] map, just make the target's memory available from all Dwfl_Modules. frysk-core/frysk/dwfl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * DwflCache.java (getDwfl()): Pass the task's memory to the Dwfl and down to the native code, don't pass the vdso address. * DwflFactory.java (updateDwfl): Don't set the module's memory. frysk-sys/lib/dwfl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * DwflTestbed.java (createFromSelf()): Pass LocalMemory to the Dwfl. * cni/DwflModule.cxx (DwflModule::setUserData): Delete. * jni/DwflModule.cxx (DwflModule::setUserData): Delete. * Dwfl.java (Dwfl(String,ByteBuffer)): New. * DwflModule.java (setUserData(Object)): Delete. * jni/Dwfl.cxx: Update. * cni/Dwfl.cxx: Update. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/dwfl/ChangeLog | 6 ++ frysk-core/frysk/dwfl/DwflCache.java | 2 +- frysk-core/frysk/dwfl/DwflFactory.java | 13 +---- frysk-sys/lib/dwfl/ChangeLog | 8 +++ frysk-sys/lib/dwfl/Dwfl.java | 38 ++++++++++---- frysk-sys/lib/dwfl/DwflModule.java | 7 ++- frysk-sys/lib/dwfl/DwflTestbed.java | 3 +- frysk-sys/lib/dwfl/cni/Dwfl.cxx | 41 ++++++++++----- frysk-sys/lib/dwfl/cni/DwflModule.cxx | 11 ---- frysk-sys/lib/dwfl/jni/Dwfl.cxx | 90 +++++++++++++++++++------------- frysk-sys/lib/dwfl/jni/DwflModule.cxx | 9 --- 11 files changed, 132 insertions(+), 96 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/dwfl/ChangeLog b/frysk-core/frysk/dwfl/ChangeLog index 542bf50..6ea8bf2 100644 --- a/frysk-core/frysk/dwfl/ChangeLog +++ b/frysk-core/frysk/dwfl/ChangeLog @@ -1,3 +1,9 @@ +2008-06-19 Andrew Cagney <cagney@redhat.com> + + * DwflCache.java (getDwfl()): Pass the task's memory to the Dwfl + and down to the native code, don't pass the vdso address. + * DwflFactory.java (updateDwfl): Don't set the module's memory. + 2008-06-03 Andrew Cagney <cagney@redhat.com> * DwflFactory.java (updateDwfl): Simplify by using Dwfl.mapBegin, diff --git a/frysk-core/frysk/dwfl/DwflCache.java b/frysk-core/frysk/dwfl/DwflCache.java index 15ffde3..4825f94 100644 --- a/frysk-core/frysk/dwfl/DwflCache.java +++ b/frysk-core/frysk/dwfl/DwflCache.java @@ -132,7 +132,7 @@ public class DwflCache { fine.log("creating new dwfl for task", task); File sysrootFile = (File)SysRootCache.getSysRoot(task); File relativeSysroot = getRelativeSysRoot(task.getProc().getExeFile().getSysRootedPath(), sysrootFile); - Dwfl dwfl = new Dwfl(relativeSysroot.getPath()); + Dwfl dwfl = new Dwfl(relativeSysroot.getPath(), task.getMemory()); DwflFactory.updateDwfl(dwfl, task); Mod mod = new Mod(dwfl, task.getMod()); modMap.put(task, mod); diff --git a/frysk-core/frysk/dwfl/DwflFactory.java b/frysk-core/frysk/dwfl/DwflFactory.java index 0f17713..eabb0c6 100644 --- a/frysk-core/frysk/dwfl/DwflFactory.java +++ b/frysk-core/frysk/dwfl/DwflFactory.java @@ -45,7 +45,6 @@ import frysk.proc.Proc; import frysk.proc.Task; import frysk.rsl.Log; import lib.dwfl.Dwfl; -import lib.dwfl.DwflModule; /** * Factory for creating Dwfl objects for Procs and Tasks. @@ -96,23 +95,15 @@ public class DwflFactory { static Dwfl updateDwfl(Dwfl dwfl, Task task) { Proc proc = task.getProc(); MemoryMap[] maps = proc.getMaps(); - long vdso = VDSOAddressLow(proc); - dwfl.mapBegin(vdso); + dwfl.mapBegin(); for (int i = 0; i < maps.length; i++) { MemoryMap map = maps[i]; dwfl.mapModule(map.name, map.addressLow, map.addressHigh, map.devMajor, map.devMinor, map.inode); } dwfl.mapEnd(); - DwflModule module = dwfl.getModule(vdso); fine.log("updateDwfl main task", proc.getMainTask(), - "memory", proc.getMainTask().getMemory(), - "dwfl module", module); - // XXX: Should this method instead have this block of memory - // pre-fetched and passed in? - if (module != null) { - module.setUserData(task.getMemory()); - } + "memory", proc.getMainTask().getMemory()); return dwfl; } } diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog index 692ac0d..f9e9ea0 100644 --- a/frysk-sys/lib/dwfl/ChangeLog +++ b/frysk-sys/lib/dwfl/ChangeLog @@ -1,5 +1,13 @@ 2008-06-19 Andrew Cagney <cagney@redhat.com> + * DwflTestbed.java (createFromSelf()): Pass LocalMemory to the Dwfl. + * cni/DwflModule.cxx (DwflModule::setUserData): Delete. + * jni/DwflModule.cxx (DwflModule::setUserData): Delete. + * Dwfl.java (Dwfl(String,ByteBuffer)): New. + * DwflModule.java (setUserData(Object)): Delete. + * jni/Dwfl.cxx: Update. + * cni/Dwfl.cxx: Update. + * Dwfl.java (mapModule): Correctly add maps such as [vdso]. * TestDwfl.java (testMapContainsVdso()): New. * DwflTestbed.java (VdsoBuilder): Delete. diff --git a/frysk-sys/lib/dwfl/Dwfl.java b/frysk-sys/lib/dwfl/Dwfl.java index cba6ede..ef77a05 100644 --- a/frysk-sys/lib/dwfl/Dwfl.java +++ b/frysk-sys/lib/dwfl/Dwfl.java @@ -43,25 +43,37 @@ import java.util.LinkedHashMap; import java.util.LinkedList; import frysk.rsl.Log; import inua.eio.ULong; +import inua.eio.ByteBuffer; public class Dwfl { private static final Log fine = Log.fine(Dwfl.class); private static final Log finest = Log.finest(Dwfl.class); + private long userdata; private long pointer; private long callbacks; protected final DwarfDieFactory factory = DwarfDieFactory.getFactory(); /** - * Create a dwfl with the specified debug-info search path. + * Create a dwfl with the specified debug-info search path and + * memory. + */ + public Dwfl(String debugInfoPath, ByteBuffer memory) { + callbacks = dwfl_callbacks_begin(debugInfoPath); + userdata = dwfl_userdata_begin(memory); + pointer = dwfl_begin(callbacks); + } + private static native long dwfl_callbacks_begin(String debugInfoSearchPath); + private static native long dwfl_userdata_begin(ByteBuffer memory); + private static native long dwfl_begin(long callbacks); + /** + * Create a dwfl with the specified debug-info search path and + * memory. */ public Dwfl(String debugInfoPath) { - callbacks = callbacksBegin(debugInfoPath); - pointer = dwflBegin(callbacks); + this(debugInfoPath, null); } - private static native long callbacksBegin(String debugInfoSearchPath); - private static native long dwflBegin(long callbacks); protected void finalize () { if (this.pointer != 0) { @@ -71,14 +83,16 @@ public class Dwfl { } public void close() { if (this.pointer != 0) { - dwflEnd(pointer); + dwfl_end(pointer); this.pointer = 0; - callbacksEnd(callbacks); + dwfl_userdata_end(userdata); + dwfl_callbacks_end(callbacks); this.callbacks = 0; } } - private static native void dwflEnd(long pointer); - private static native void callbacksEnd(long callbacks); + private static native void dwfl_end(long pointer); + private static native void dwfl_userdata_end(long userdata); + private static native void dwfl_callbacks_end(long callbacks); public DwflLine getSourceLine (long addr) { DwflModule module = getModule(addr); @@ -183,7 +197,8 @@ public class Dwfl { */ public void reportModule(String moduleName, long low, long high) { fine.log(this, "reportModule", moduleName, "low", low, "high", high); - long modulePointer = dwfl_report_module(pointer, moduleName, low, high); + long modulePointer = dwfl_report_module(pointer, moduleName, low, high, + userdata); for (int i = 0; i < modulesArray.length; i++) { DwflModule module = modulesArray[i]; if (module.getName().equals(moduleName) @@ -204,7 +219,8 @@ public class Dwfl { } private static native long dwfl_report_module(long pointer, String moduleName, - long low, long high); + long low, long high, + long userdata); private String name; private long low; diff --git a/frysk-sys/lib/dwfl/DwflModule.java b/frysk-sys/lib/dwfl/DwflModule.java index 01b728c..b73d3c6 100644 --- a/frysk-sys/lib/dwfl/DwflModule.java +++ b/frysk-sys/lib/dwfl/DwflModule.java @@ -66,7 +66,10 @@ public class DwflModule { public String toString() { - return name + " pointer: 0x" + Long.toHexString(pointer); + return name + + " 0x" + Long.toHexString(low) + + "..0x" + Long.toHexString(high) + + " pointer=0x" + Long.toHexString(pointer); } public long lowAddress() { @@ -133,8 +136,6 @@ public class DwflModule { public native void getSymbolByName(String name, SymbolBuilder symbolBuilder); - - public native void setUserData(Object data); /** * Get the debuginfo path for DwflModule diff --git a/frysk-sys/lib/dwfl/DwflTestbed.java b/frysk-sys/lib/dwfl/DwflTestbed.java index fdbad8d..3c931bf 100644 --- a/frysk-sys/lib/dwfl/DwflTestbed.java +++ b/frysk-sys/lib/dwfl/DwflTestbed.java @@ -39,6 +39,7 @@ package lib.dwfl; +import frysk.testbed.LocalMemory; import frysk.sys.proc.MapsBuilder; import frysk.sys.Pid; @@ -75,7 +76,7 @@ public class DwflTestbed { * Create a dwfl from this process. */ static Dwfl createFromSelf() { - Dwfl dwfl = new Dwfl(""); + Dwfl dwfl = new Dwfl("", LocalMemory.getByteBuffer()); ModuleBuilder maps = new ModuleBuilder(dwfl); dwfl.mapBegin(); maps.construct(Pid.get()); diff --git a/frysk-sys/lib/dwfl/cni/Dwfl.cxx b/frysk-sys/lib/dwfl/cni/Dwfl.cxx index b0e8ba5..167653d 100644 --- a/frysk-sys/lib/dwfl/cni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/cni/Dwfl.cxx @@ -115,10 +115,7 @@ dwfl_frysk_proc_find_elf (Dwfl_Module *mod, } else { - /* Special case for in-memory ELF image. */ - inua::eio::ByteBuffer * memory = (inua::eio::ByteBuffer *) *userdata; - - *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, memory); + *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, *userdata); return -1; } @@ -128,7 +125,16 @@ dwfl_frysk_proc_find_elf (Dwfl_Module *mod, } jlong -lib::dwfl::Dwfl::callbacksBegin(jstring debugInfoPath) { +lib::dwfl::Dwfl::dwfl_userdata_begin(inua::eio::ByteBuffer *memory) { + return (jlong)memory; +} + +void +lib::dwfl::Dwfl::dwfl_userdata_end(jlong userdata) { +} + +jlong +lib::dwfl::Dwfl::dwfl_callbacks_begin(jstring debugInfoPath) { char** path = (char**) JvMalloc(sizeof (char*)); int len = JvGetStringUTFLength(debugInfoPath); *path = (char*)JvMalloc(len + 1); @@ -145,19 +151,19 @@ lib::dwfl::Dwfl::callbacksBegin(jstring debugInfoPath) { } void -lib::dwfl::Dwfl::callbacksEnd(jlong callbacks) { +lib::dwfl::Dwfl::dwfl_callbacks_end(jlong callbacks) { JvFree(*DWFL_CALLBACKS->debuginfo_path); JvFree(DWFL_CALLBACKS->debuginfo_path); JvFree(DWFL_CALLBACKS); } jlong -lib::dwfl::Dwfl::dwflBegin(jlong callbacks) { +lib::dwfl::Dwfl::dwfl_begin(jlong callbacks) { return (jlong) ::dwfl_begin(DWFL_CALLBACKS); } void -lib::dwfl::Dwfl::dwflEnd(jlong pointer){ +lib::dwfl::Dwfl::dwfl_end(jlong pointer){ ::dwfl_end(DWFL_POINTER); } @@ -174,16 +180,25 @@ lib::dwfl::Dwfl::dwfl_report_end(jlong pointer) { jlong lib::dwfl::Dwfl::dwfl_report_module(jlong pointer, jstring moduleName, - jlong low, jlong high) { + jlong low, jlong high, jlong userdata) { jsize len = JvGetStringUTFLength(moduleName); char modName[len+1]; JvGetStringUTFRegion(moduleName, 0, len, modName); modName[len] = '\0'; - - return (jlong) ::dwfl_report_module(DWFL_POINTER, modName, - (::Dwarf_Addr) low, - (::Dwarf_Addr) high); + + Dwfl_Module* module = ::dwfl_report_module(DWFL_POINTER, modName, + (::Dwarf_Addr) low, + (::Dwarf_Addr) high); + if (userdata != 0) { + // Get the address of the module's userdata, and store a global + // reference to memory in there. The global ref is detroyed along + // with the Dwfl. + void **userdatap; + ::dwfl_module_info(module, &userdatap, NULL, NULL, NULL, NULL, NULL, NULL); + *userdatap = (void*)userdata; + } + return (jlong) module; } extern "C" int moduleCounter(Dwfl_Module *, void **, const char *, diff --git a/frysk-sys/lib/dwfl/cni/DwflModule.cxx b/frysk-sys/lib/dwfl/cni/DwflModule.cxx index 7f252bc..5d7a41a 100644 --- a/frysk-sys/lib/dwfl/cni/DwflModule.cxx +++ b/frysk-sys/lib/dwfl/cni/DwflModule.cxx @@ -340,17 +340,6 @@ lib::dwfl::DwflModule::getSymbolByName(jstring name, } } -void -lib::dwfl::DwflModule::setUserData(jobject data) -{ - void **userdata = NULL; - dwfl_module_info(DWFL_MODULE_POINTER, &userdata, NULL, NULL, NULL, NULL, NULL, - NULL); - - *userdata = data; - -} - /* * Get the DebugInfo paths if present */ diff --git a/frysk-sys/lib/dwfl/jni/Dwfl.cxx b/frysk-sys/lib/dwfl/jni/Dwfl.cxx index 60a3ed3..a04b9b8 100644 --- a/frysk-sys/lib/dwfl/jni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/jni/Dwfl.cxx @@ -70,34 +70,28 @@ extern "C" { // Assume the method was parameterised with POINTER. #define DWFL_POINTER ((::Dwfl *)pointer) -// Ditto for callbacks pointer. -#define DWFL_CALLBACKS ((::Dwfl_Callbacks*)callbacks) +\f -struct proc_memory_context { - jnixx::env env; - inua::eio::ByteBuffer memory; - proc_memory_context(jnixx::env env, inua::eio::ByteBuffer memory) { - this->env = env; - this->memory = memory; - } -}; +// Our data associated with the dwfl (well actually the Dwfl_Module). +// Need to make memory available so that, in the case of the vdso, it +// can be slurped from memory. static ssize_t -read_proc_memory(void *arg, void *data, GElf_Addr address, +read_proc_memory(void *userdata, void *data, GElf_Addr address, size_t minread, size_t maxread) { - fprintf(stderr, "wft does data %p get set? - perhaps it isn't called\n", - data); - proc_memory_context* context = (proc_memory_context*) arg; - jnixx::jbyteArray bytes - = jnixx::jbyteArray::NewByteArray(context->env, maxread); - ssize_t nread - = context->memory.safeGet(context->env, (off64_t) address, bytes, 0, - maxread); - jbyteArrayElements bytesp = jbyteArrayElements(context->env, bytes); + // Get the current thread's ENV; can't save it in dwfl_userdata + // since can't determine, ahead of time, which thread will call this + // code. + ::jnixx::env env = Object::_env_(); + ::inua::eio::ByteBuffer memory + = ::inua::eio::ByteBuffer(env, (jobject)userdata); + jnixx::jbyteArray bytes = jnixx::jbyteArray::NewByteArray(env, maxread); + ssize_t nread = memory.safeGet(env, (off64_t) address, bytes, 0, maxread); + jbyteArrayElements bytesp = jbyteArrayElements(env, bytes); memcpy(data, bytesp.elements(), nread); if (nread > 0 && (size_t) nread < minread) nread = 0; - bytes.DeleteLocalRef(context->env); + bytes.DeleteLocalRef(env); return nread; } @@ -123,18 +117,31 @@ dwfl_frysk_proc_find_elf(Dwfl_Module *mod, } return fd; } else { - /* Special case for in-memory ELF image. */ - fprintf(stderr, "wft does userdata %p get set? - perhaps it isn't called\n", *userdata); - proc_memory_context* context = (proc_memory_context*) *userdata; - *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, context); - return -1; + // dwfl passes in the address of the Dwfl_Module user pointer + // contained within. That pointer has been previously stuffed + // with our "userdata". + *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, *userdata); + return 0; } - //abort (); - return -1; } jlong -lib::dwfl::Dwfl::callbacksBegin(jnixx::env env, String jdebugInfoPath) { +lib::dwfl::Dwfl::dwfl_userdata_begin(jnixx::env env, + inua::eio::ByteBuffer memory) { + return (jlong) env.NewGlobalRef(memory._object); +} + +void +lib::dwfl::Dwfl::dwfl_userdata_end(jnixx::env env, jlong userdata) { + env.DeleteGlobalRef((jobject)userdata); +} + +\f + +#define DWFL_CALLBACKS ((::Dwfl_Callbacks*)callbacks) + +jlong +lib::dwfl::Dwfl::dwfl_callbacks_begin(jnixx::env env, String jdebugInfoPath) { jstringUTFChars debugInfoPath = jstringUTFChars(env, jdebugInfoPath); char** path = (char**) ::malloc(sizeof (char*)); if (path == NULL) { @@ -150,19 +157,19 @@ lib::dwfl::Dwfl::callbacksBegin(jnixx::env env, String jdebugInfoPath) { } void -lib::dwfl::Dwfl::callbacksEnd(jnixx::env env, jlong callbacks) { +lib::dwfl::Dwfl::dwfl_callbacks_end(jnixx::env env, jlong callbacks) { ::free(*DWFL_CALLBACKS->debuginfo_path); ::free(DWFL_CALLBACKS->debuginfo_path); ::free(DWFL_CALLBACKS); } jlong -lib::dwfl::Dwfl::dwflBegin(jnixx::env env, jlong callbacks) { +lib::dwfl::Dwfl::dwfl_begin(jnixx::env env, jlong callbacks) { return (jlong) ::dwfl_begin(DWFL_CALLBACKS); } void -lib::dwfl::Dwfl::dwflEnd(jnixx::env env, jlong pointer) { +lib::dwfl::Dwfl::dwfl_end(jnixx::env env, jlong pointer) { ::dwfl_end(DWFL_POINTER); } @@ -179,9 +186,20 @@ lib::dwfl::Dwfl::dwfl_report_end(jnixx::env env, jlong pointer) { jlong lib::dwfl::Dwfl::dwfl_report_module(jnixx::env env, jlong pointer, - String jmoduleName, jlong low, jlong high) { + String jmoduleName, jlong low, jlong high, + jlong userdata) { jstringUTFChars moduleName = jstringUTFChars(env, jmoduleName); - return (jlong) ::dwfl_report_module(DWFL_POINTER, moduleName.elements(), - (::Dwarf_Addr) low, - (::Dwarf_Addr) high); + Dwfl_Module *module = ::dwfl_report_module(DWFL_POINTER, + moduleName.elements(), + (::Dwarf_Addr) low, + (::Dwarf_Addr) high); + if (userdata != 0) { + // Get the address of the module's userdata, and store a global + // reference to memory in there. The global ref is detroyed along + // with the Dwfl. + void **userdatap; + ::dwfl_module_info(module, &userdatap, NULL, NULL, NULL, NULL, NULL, NULL); + *userdatap = (void*)userdata; + } + return (jlong)module; } diff --git a/frysk-sys/lib/dwfl/jni/DwflModule.cxx b/frysk-sys/lib/dwfl/jni/DwflModule.cxx index ca42e43..d730d49 100644 --- a/frysk-sys/lib/dwfl/jni/DwflModule.cxx +++ b/frysk-sys/lib/dwfl/jni/DwflModule.cxx @@ -301,15 +301,6 @@ lib::dwfl::DwflModule::getSymbolByName(jnixx::env env, String jname, } } -void -lib::dwfl::DwflModule::setUserData(jnixx::env env, Object data) { - void **userdata = NULL; - fprintf(stderr, "user data is %p\n", userdata); - dwfl_module_info(DWFL_MODULE_POINTER_FIXME, &userdata, NULL, NULL, NULL, NULL, NULL, - NULL); - *userdata = data._object; -} - /* * Get the DebugInfo paths if present */ hooks/post-receive -- frysk system monitor/debugger
The branch, master has been updated via 5c0013016a63729e15b30738625df8f21e1bfd51 (commit) from a0d0cc59f7dcc4377aee0568bcc4b890e8b55e6b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 5c0013016a63729e15b30738625df8f21e1bfd51 Author: Andrew Cagney <cagney@redhat.com> Date: Thu Jun 19 13:41:00 2008 -0400 Add test for [vdso], fail for moment. frysk-sys/frysk/rsl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * Log.java: Add more methods. frysk-sys/frysk/testbed/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * TestLocalMemory.java (testMemoryByteBuffer()): New. * LocalMemory.java (getByteBuffer()): New. * jni/LocalMemory.cxx (LocalMemory::peek): Implement. * cni/LocalMemory.cxx (LocalMemory::peek): Implement. frysk-sys/lib/dwfl/ChangeLog 2008-06-19 Andrew Cagney <cagney@redhat.com> * Dwfl.java (mapModule): Correctly add maps such as [vdso]. * TestDwfl.java (testMapContainsVdso()): New. * DwflTestbed.java (VdsoBuilder): Delete. (createFromSelf()): Don't pass in the vdso. ----------------------------------------------------------------------- Summary of changes: frysk-sys/frysk/rsl/ChangeLog | 4 ++ frysk-sys/frysk/rsl/Log.java | 7 ++++ frysk-sys/frysk/testbed/ChangeLog | 7 ++++ frysk-sys/frysk/testbed/LocalMemory.java | 19 +++++++++++ frysk-sys/frysk/testbed/TestLocalMemory.java | 15 ++++++-- frysk-sys/frysk/testbed/cni/LocalMemory.cxx | 7 +++- frysk-sys/frysk/testbed/jni/LocalMemory.cxx | 5 +++ frysk-sys/lib/dwfl/ChangeLog | 7 ++++ frysk-sys/lib/dwfl/Dwfl.java | 45 +++++++++++++++---------- frysk-sys/lib/dwfl/DwflTestbed.java | 19 +---------- frysk-sys/lib/dwfl/TestDwfl.java | 17 ++++++++++ frysk-sys/lib/dwfl/cni/Dwfl.cxx | 8 ++-- frysk-sys/lib/dwfl/jni/Dwfl.cxx | 8 ++-- 13 files changed, 119 insertions(+), 49 deletions(-) First 500 lines of diff: diff --git a/frysk-sys/frysk/rsl/ChangeLog b/frysk-sys/frysk/rsl/ChangeLog index f611e11..a37407d 100644 --- a/frysk-sys/frysk/rsl/ChangeLog +++ b/frysk-sys/frysk/rsl/ChangeLog @@ -1,3 +1,7 @@ +2008-06-19 Andrew Cagney <cagney@redhat.com> + + * Log.java: Add more methods. + 2008-06-04 Andrew Cagney <cagney@redhat.com> * Log.java (finest(Class)): New. diff --git a/frysk-sys/frysk/rsl/Log.java b/frysk-sys/frysk/rsl/Log.java index 1557332..27f1245 100644 --- a/frysk-sys/frysk/rsl/Log.java +++ b/frysk-sys/frysk/rsl/Log.java @@ -421,6 +421,13 @@ public final class Log { prefix(self).print(p1).print(p2).print(p3).print(p4).print(p5).print(p6).print(p7).print(p8).print(p9).print(p10).print(p11).suffix(); } + // dynamic 12 parameters + public void log(Object self, String p1, Object p2, String p3, long p4, String p5, long p6, String p7, int p8, String p9, int p10, String p11, int p12) { + if (!logging) + return; + prefix(self).print(p1).print(p2).print(p3).print(p4).print(p5).print(p6).print(p7).print(p8).print(p9).print(p10).print(p11).print(p12).suffix(); + } + /** * Assuming the use: <tt>log("caller", log.CALLER)</tt> prints the diff --git a/frysk-sys/frysk/testbed/ChangeLog b/frysk-sys/frysk/testbed/ChangeLog index ff3c2a9..136395e 100644 --- a/frysk-sys/frysk/testbed/ChangeLog +++ b/frysk-sys/frysk/testbed/ChangeLog @@ -1,3 +1,10 @@ +2008-06-19 Andrew Cagney <cagney@redhat.com> + + * TestLocalMemory.java (testMemoryByteBuffer()): New. + * LocalMemory.java (getByteBuffer()): New. + * jni/LocalMemory.cxx (LocalMemory::peek): Implement. + * cni/LocalMemory.cxx (LocalMemory::peek): Implement. + 2008-06-12 Andrew Cagney <cagney@redhat.com> * TearDownExpect.java (TearDownExpect()): Add. diff --git a/frysk-sys/frysk/testbed/LocalMemory.java b/frysk-sys/frysk/testbed/LocalMemory.java index c79f331..fdb0eaa 100644 --- a/frysk-sys/frysk/testbed/LocalMemory.java +++ b/frysk-sys/frysk/testbed/LocalMemory.java @@ -39,6 +39,9 @@ package frysk.testbed; +import inua.eio.ByteBuffer; +import frysk.sys.ptrace.AddressSpace; + /** * Provide access to known local areas of memory. * @@ -102,4 +105,20 @@ public class LocalMemory { * will be so large that it is negative. */ public static native void constructStack(StackBuilder builder); + + /** + * Return a byte-buffer capable of reading any address of this + * thread's memory. + */ + public static ByteBuffer getByteBuffer() { + return new ByteBuffer(0, AddressSpace.DATA.length()) { + protected int peek(long offset) { + return LocalMemory.peek(offset); + } + protected void poke(long offset, int b) { + // do nothing + } + }; + } + private static native int peek(long addr); } diff --git a/frysk-sys/frysk/testbed/TestLocalMemory.java b/frysk-sys/frysk/testbed/TestLocalMemory.java index f378d55..4d4447c 100644 --- a/frysk-sys/frysk/testbed/TestLocalMemory.java +++ b/frysk-sys/frysk/testbed/TestLocalMemory.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -40,13 +40,12 @@ package frysk.testbed; import frysk.junit.TestCase; +import inua.eio.ByteBuffer; /** * Check that LocalMemory addresses are pointing where expected. */ -public class TestLocalMemory - extends TestCase -{ +public class TestLocalMemory extends TestCase { /** * Check that the stack address changes as new stack frames are * created. @@ -96,4 +95,12 @@ public class TestLocalMemory byte[] bytes = LocalMemory.getDataBytes(); assertEquals("data byte[0]", 43, bytes[0]); } + + + public void testMemoryByteBuffer() { + ByteBuffer memory = LocalMemory.getByteBuffer(); + assertEquals("data", LocalMemory.getDataBytes()[0], + memory.get(LocalMemory.getDataAddr())); + } + } diff --git a/frysk-sys/frysk/testbed/cni/LocalMemory.cxx b/frysk-sys/frysk/testbed/cni/LocalMemory.cxx index f2944ea..8afd4af 100644 --- a/frysk-sys/frysk/testbed/cni/LocalMemory.cxx +++ b/frysk-sys/frysk/testbed/cni/LocalMemory.cxx @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2006, 2007, 2008 Red Hat Inc. +// Copyright 2005, 2006, 2007, 2008, 2008 Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -130,3 +130,8 @@ LocalMemory::getModuleName() { // be deleted. return JvNewStringUTF("TestRunner"); } + +jint +LocalMemory::peek(jlong addr) { + return *(unsigned char*)addr; +} diff --git a/frysk-sys/frysk/testbed/jni/LocalMemory.cxx b/frysk-sys/frysk/testbed/jni/LocalMemory.cxx index 840e129..9324cf2 100644 --- a/frysk-sys/frysk/testbed/jni/LocalMemory.cxx +++ b/frysk-sys/frysk/testbed/jni/LocalMemory.cxx @@ -127,3 +127,8 @@ String LocalMemory::getModuleName(::jnixx::env env) { return String::NewStringUTF(env, "libfrysk-sys-jni.so"); } + +jint +LocalMemory::peek(::jnixx::env env, jlong addr) { + return *(unsigned char*)addr; +} diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog index 6e7a384..692ac0d 100644 --- a/frysk-sys/lib/dwfl/ChangeLog +++ b/frysk-sys/lib/dwfl/ChangeLog @@ -1,3 +1,10 @@ +2008-06-19 Andrew Cagney <cagney@redhat.com> + + * Dwfl.java (mapModule): Correctly add maps such as [vdso]. + * TestDwfl.java (testMapContainsVdso()): New. + * DwflTestbed.java (VdsoBuilder): Delete. + (createFromSelf()): Don't pass in the vdso. + 2008-06-16 Andrew Cagney <cagney@redhat.com> * DwflModule.java (get_cu_dies): Add pointer parameter. diff --git a/frysk-sys/lib/dwfl/Dwfl.java b/frysk-sys/lib/dwfl/Dwfl.java index 9e9ef82..cba6ede 100644 --- a/frysk-sys/lib/dwfl/Dwfl.java +++ b/frysk-sys/lib/dwfl/Dwfl.java @@ -158,32 +158,32 @@ public class Dwfl { */ public void reportBegin() { fine.log(this, "reportBegin"); - reportBegin(pointer); + dwfl_report_begin(pointer); // fill modulesArray with the current modules and then clear // the set. Will iterate over the old modules so that they // are re-used. getModules(); modules.clear(); } - private static native void reportBegin(long pointer); + private static native void dwfl_report_begin(long pointer); /** * Finish a refresh of the address map. */ public void reportEnd() { fine.log(this, "reportEnd"); - reportEnd(pointer); + dwfl_report_end(pointer); // Finished; scrub references to old modules. modulesArray = null; } - private static native void reportEnd(long pointer); + private static native void dwfl_report_end(long pointer); /** * Report a mapped component. */ public void reportModule(String moduleName, long low, long high) { fine.log(this, "reportModule", moduleName, "low", low, "high", high); - long modulePointer = reportModule(pointer, moduleName, low, high); + long modulePointer = dwfl_report_module(pointer, moduleName, low, high); for (int i = 0; i < modulesArray.length; i++) { DwflModule module = modulesArray[i]; if (module.getName().equals(moduleName) @@ -202,8 +202,9 @@ public class Dwfl { finest.log(this, "reportModule creating", module); modules.put(new Long(modulePointer), module); } - private static native long reportModule(long pointer, String moduleName, - long low, long high); + private static native long dwfl_report_module(long pointer, + String moduleName, + long low, long high); private String name; private long low; @@ -211,14 +212,12 @@ public class Dwfl { private int devMajor; private int devMinor; private int inode; - private long vdso; /** * Start refreshing the address map using raw information * extracted from /proc/pid/maps. */ - public void mapBegin(long vdso) { + public void mapBegin() { reportBegin(); - this.vdso = vdso; name = null; } /** @@ -226,28 +225,38 @@ public class Dwfl { */ public void mapModule(String name, long low, long high, int devMajor, int devMinor, int inode) { - if (this.name != null && this.name.equals(name) + finest.log(this, "mapModule", name, "low", low, "high", high, + "devMajor", devMajor, "devMinor", devMinor, "inode", inode); + if (this.name != null + && this.name.equals(name) && this.devMajor == devMajor && this.devMinor == devMinor && this.inode == inode ) { + finest.log(this, "extending to", high); // A repeat of a previous map (but with more addresses) // extend the address range. this.high = high; } else { if (this.name != null) { // There's a previous map, report and flush it. + finest.log(this, "reporting", this.name); reportModule(this.name, this.low, this.high); this.name = null; } - if (name.equals("") - || (devMajor == 0 && devMinor == 0 && inode == 0)) { - // An empty map, do nothing. - } else if (this.vdso == low) { - // A vdso, report it immediatly. - reportModule(name, low, high); + if (name == null) { + finest.log(this, "ignoring null name"); + } else if (name.equals("")) { + finest.log(this, "ignoring empty name"); + } else if (name.indexOf("(deleted") >= 0) { + finest.log(this, "ignoring deleted", name); + } else if (!name.startsWith("/")) { + // XXX: This is too agressive, it ignores [vdso], on + // the other hand, if vdso is included this leads to + // segmentation faults. + finest.log(this, "ignoring non-file", name); } else { - // A new map, save it. + // A new map, save it, will be reported later. this.name = name; this.low = low; this.high = high; diff --git a/frysk-sys/lib/dwfl/DwflTestbed.java b/frysk-sys/lib/dwfl/DwflTestbed.java index 80aed86..fdbad8d 100644 --- a/frysk-sys/lib/dwfl/DwflTestbed.java +++ b/frysk-sys/lib/dwfl/DwflTestbed.java @@ -41,24 +41,9 @@ package lib.dwfl; import frysk.sys.proc.MapsBuilder; import frysk.sys.Pid; -import frysk.sys.proc.AuxvBuilder; public class DwflTestbed { - private static class VdsoBuilder extends AuxvBuilder { - long address; - public void buildBuffer(byte[] auxv) { - } - public void buildDimensions(int wordSize, boolean bigEndian, - int numberElements) { - } - public void buildAuxiliary(int index, int type, long value) { - if (type == inua.elf.AT.SYSINFO_EHDR) { - address = value; - } - } - } - private static class ModuleBuilder extends MapsBuilder { private final Dwfl dwfl; ModuleBuilder(Dwfl dwfl) { @@ -92,9 +77,7 @@ public class DwflTestbed { static Dwfl createFromSelf() { Dwfl dwfl = new Dwfl(""); ModuleBuilder maps = new ModuleBuilder(dwfl); - VdsoBuilder vdso = new VdsoBuilder(); - vdso.construct(Pid.get()); - dwfl.mapBegin(vdso.address); + dwfl.mapBegin(); maps.construct(Pid.get()); dwfl.mapEnd(); return dwfl; diff --git a/frysk-sys/lib/dwfl/TestDwfl.java b/frysk-sys/lib/dwfl/TestDwfl.java index d8076d2..2aee367 100644 --- a/frysk-sys/lib/dwfl/TestDwfl.java +++ b/frysk-sys/lib/dwfl/TestDwfl.java @@ -232,4 +232,21 @@ public class TestDwfl extends TestCase { } assertTrue(foundAddress); } + + public void testMapContainsVdso() { + if (unresolved(6626)) + return; + Dwfl dwfl = DwflTestbed.createFromSelf(); + DwflModule[] modules = dwfl.getModules(); + DwflModule vdso = null; + for (int i = 0; i < modules.length; i++) { + DwflModule module = modules[i]; + finest.log("module", i, "name", module); + if (module.getName().equals("[vdso]")) { + vdso = module; + break; + } + } + assertNotNull("vdso", vdso); + } } diff --git a/frysk-sys/lib/dwfl/cni/Dwfl.cxx b/frysk-sys/lib/dwfl/cni/Dwfl.cxx index ceb76aa..b0e8ba5 100644 --- a/frysk-sys/lib/dwfl/cni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/cni/Dwfl.cxx @@ -162,19 +162,19 @@ lib::dwfl::Dwfl::dwflEnd(jlong pointer){ } void -lib::dwfl::Dwfl::reportBegin(jlong pointer) { +lib::dwfl::Dwfl::dwfl_report_begin(jlong pointer) { ::dwfl_report_begin(DWFL_POINTER); } void -lib::dwfl::Dwfl::reportEnd(jlong pointer) { +lib::dwfl::Dwfl::dwfl_report_end(jlong pointer) { ::dwfl_report_end(DWFL_POINTER, NULL, NULL); } jlong -lib::dwfl::Dwfl::reportModule(jlong pointer, jstring moduleName, - jlong low, jlong high) { +lib::dwfl::Dwfl::dwfl_report_module(jlong pointer, jstring moduleName, + jlong low, jlong high) { jsize len = JvGetStringUTFLength(moduleName); char modName[len+1]; diff --git a/frysk-sys/lib/dwfl/jni/Dwfl.cxx b/frysk-sys/lib/dwfl/jni/Dwfl.cxx index c984daa..60a3ed3 100644 --- a/frysk-sys/lib/dwfl/jni/Dwfl.cxx +++ b/frysk-sys/lib/dwfl/jni/Dwfl.cxx @@ -167,19 +167,19 @@ lib::dwfl::Dwfl::dwflEnd(jnixx::env env, jlong pointer) { } void -lib::dwfl::Dwfl::reportBegin(jnixx::env env, jlong pointer) { +lib::dwfl::Dwfl::dwfl_report_begin(jnixx::env env, jlong pointer) { ::dwfl_report_begin(DWFL_POINTER); } void -lib::dwfl::Dwfl::reportEnd(jnixx::env env, jlong pointer) { +lib::dwfl::Dwfl::dwfl_report_end(jnixx::env env, jlong pointer) { ::dwfl_report_end(DWFL_POINTER, NULL, NULL); } jlong -lib::dwfl::Dwfl::reportModule(jnixx::env env, jlong pointer, - String jmoduleName, jlong low, jlong high) { +lib::dwfl::Dwfl::dwfl_report_module(jnixx::env env, jlong pointer, + String jmoduleName, jlong low, jlong high) { jstringUTFChars moduleName = jstringUTFChars(env, jmoduleName); return (jlong) ::dwfl_report_module(DWFL_POINTER, moduleName.elements(), (::Dwarf_Addr) low, hooks/post-receive -- frysk system monitor/debugger