From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26023 invoked by alias); 29 Jan 2008 15:51:08 -0000 Received: (qmail 25972 invoked by uid 9708); 29 Jan 2008 15:51:07 -0000 Date: Tue, 29 Jan 2008 15:51:00 -0000 Message-ID: <20080129155107.25956.qmail@sourceware.org> From: tthomas@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Stop task before gathering debugging info. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: d13d270db639ffc6eb17e537380ef01496d49f91 X-Git-Newrev: f86b535baf401af5fb2ff146202109be5a964282 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00140.txt.bz2 The branch, master has been updated via f86b535baf401af5fb2ff146202109be5a964282 (commit) from d13d270db639ffc6eb17e537380ef01496d49f91 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit f86b535baf401af5fb2ff146202109be5a964282 Author: Teresa Thomas Date: Tue Jan 29 10:49:53 2008 -0500 Stop task before gathering debugging info. frysk-core/frysk/bindir/ChangeLog 2008-01-28 Teresa Thomas * fdebuginfo.java (PrintDebuginfoEvent): New. (PrintDebuginfoAction): New. (.parseCores, .parseCommand): Use PrintDebuginfoEvent. (.parsePids): Use PrintDebuginfoAction. * TestFdebuginfo.java (testPathListing): Remove unresolved. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/bindir/ChangeLog | 8 +++ frysk-core/frysk/bindir/TestFdebuginfo.java | 2 - frysk-core/frysk/bindir/fdebuginfo.java | 67 ++++++++++++++++++++------- 3 files changed, 58 insertions(+), 19 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog index 5163684..e4741e9 100644 --- a/frysk-core/frysk/bindir/ChangeLog +++ b/frysk-core/frysk/bindir/ChangeLog @@ -1,3 +1,11 @@ +2008-01-28 Teresa Thomas + + * fdebuginfo.java (PrintDebuginfoEvent): New. + (PrintDebuginfoAction): New. + (.parseCores, .parseCommand): Use PrintDebuginfoEvent. + (.parsePids): Use PrintDebuginfoAction. + * TestFdebuginfo.java (testPathListing): Remove unresolved. + 2008-01-25 Teresa Thomas * TestFdebuginfo.java (testBadArguments): Update. diff --git a/frysk-core/frysk/bindir/TestFdebuginfo.java b/frysk-core/frysk/bindir/TestFdebuginfo.java index a68a209..1ca9caa 100644 --- a/frysk-core/frysk/bindir/TestFdebuginfo.java +++ b/frysk-core/frysk/bindir/TestFdebuginfo.java @@ -52,8 +52,6 @@ import frysk.testbed.SlaveOffspring; public class TestFdebuginfo extends TestLib { public void testPathListing() { - if (unresolved(5671)) - return; // Create an unattached child process. SlaveOffspring child = SlaveOffspring.createChild(); Task task = child.findTaskUsingRefresh(true); diff --git a/frysk-core/frysk/bindir/fdebuginfo.java b/frysk-core/frysk/bindir/fdebuginfo.java index ff5e5fd..40f3e8f 100644 --- a/frysk-core/frysk/bindir/fdebuginfo.java +++ b/frysk-core/frysk/bindir/fdebuginfo.java @@ -42,10 +42,13 @@ package frysk.bindir; import java.io.File; +import frysk.event.Event; import frysk.proc.Host; import frysk.proc.Manager; +import frysk.proc.ProcBlockAction; import frysk.proc.ProcId; import frysk.proc.Proc; +import frysk.proc.ProcObserver; import frysk.proc.Task; import frysk.proc.dead.LinuxExeHost; @@ -59,20 +62,6 @@ public final class fdebuginfo private static CommandlineParser parser; /** - * Function that gets and prints the debuginfo install paths - * - * @param proc - pid - */ - private static void printDebuginfo (Proc proc) - { - Task task = proc.getMainTask(); - DebuginfoPaths dbg = new DebuginfoPaths(task); - String dInfo = dbg.getDebuginfo(); - if (dInfo!=null) - System.out.print(dInfo); - } - - /** * Entry function for fdebuginfo * * @param args - pid of the process(es) or corefile @@ -88,7 +77,7 @@ public final class fdebuginfo for (int i = 0; i < coreExePairs.length; i++) { Proc proc = Util.getProcFromCoreExePair(coreExePairs[i]); - printDebuginfo(proc); + new PrintDebuginfoEvent (proc).execute(); } System.exit(0); } @@ -99,7 +88,8 @@ public final class fdebuginfo for (int i= 0; i< pids.length; i++) { Proc proc = Util.getProcFromPid(pids[i]); - printDebuginfo(proc); + new ProcBlockAction(proc, new PrintDebuginfoAction(proc)); + Manager.eventLoop.run(); } System.exit(0); } @@ -115,7 +105,7 @@ public final class fdebuginfo Manager.eventLoop.start(); Host exeHost = new LinuxExeHost(Manager.eventLoop, exeFile); Proc exeProc = Util.getProcFromExeFile(exeHost); - printDebuginfo(exeProc); + new PrintDebuginfoEvent(exeProc).execute(); } System.exit(0); } @@ -130,5 +120,48 @@ public final class fdebuginfo parser.printHelp(); System.exit(1); } + + private static class PrintDebuginfoEvent implements Event + { + private Proc proc = null; + + public PrintDebuginfoEvent(Proc proc) { + this.proc = proc; + } + + public void execute() { + /* Get and print the debuginfo install paths. + */ + Task task = proc.getMainTask(); + DebuginfoPaths dbg = new DebuginfoPaths(task); + String dInfo = dbg.getDebuginfo(); + if (dInfo!=null) + System.out.print(dInfo); + System.exit(0); + } + } + + private static class PrintDebuginfoAction implements ProcObserver.ProcAction + { + private Proc proc; + + public PrintDebuginfoAction(Proc proc) { + this.proc = proc; + } + + public void allExistingTasksCompleted() { + Manager.eventLoop.add(new PrintDebuginfoEvent(this.proc)); + } + public void taskAddFailed(Object task, Throwable w) { + } + public void existingTask(Task task) { + } + public void addFailed(Object observable, Throwable w) { + } + public void addedTo(Object observable) { + } + public void deletedFrom(Object observable) { + } + } } hooks/post-receive -- frysk system monitor/debugger