public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Refactor fauxv to use ProcStopUtil.
@ 2008-02-08 17:15 tthomas
  0 siblings, 0 replies; only message in thread
From: tthomas @ 2008-02-08 17:15 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  bad8ca2da62d066388ebc05d03240d02c5156b82 (commit)
      from  804d992e99f52887737f4e329db5460485aced04 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit bad8ca2da62d066388ebc05d03240d02c5156b82
Author: Teresa <tthomas@redhat.com>
Date:   Fri Feb 8 11:58:25 2008 -0500

    Refactor fauxv to use ProcStopUtil.
    
    frysk-core/frysk/bindir/ChangeLog
    2008-02-08  Teresa Thomas  <tthomas@redhat.com>
    
    	* fauxv.java: Refactor to use ProcStopUtil.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog  |    4 +
 frysk-core/frysk/bindir/fauxv.java |  132 +++++++-----------------------------
 2 files changed, 29 insertions(+), 107 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index ee65d19..2fc1199 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-08  Teresa Thomas  <tthomas@redhat.com>
+
+	* fauxv.java: Refactor to use ProcStopUtil.
+
 2008-02-07  Teresa Thomas  <tthomas@redhat.com>
 
 	* fmaps.java: Refactor to use ProcStopUtil.
diff --git a/frysk-core/frysk/bindir/fauxv.java b/frysk-core/frysk/bindir/fauxv.java
index d00944f..7fa2b37 100644
--- a/frysk-core/frysk/bindir/fauxv.java
+++ b/frysk-core/frysk/bindir/fauxv.java
@@ -39,123 +39,41 @@
 
 package frysk.bindir;
 
-import java.io.File;
-
-import frysk.event.Event;
-import frysk.proc.Manager;
+import frysk.event.ProcEvent;
 import frysk.proc.Proc;
-import frysk.proc.ProcBlockAction;
-import frysk.proc.ProcId;
-import frysk.proc.ProcObserver;
-import frysk.proc.Task;
 import frysk.util.AuxvStringBuilder;
-import frysk.util.CommandlineParser;
-import frysk.util.CoreExePair;
-import frysk.util.Util;
+import frysk.util.ProcStopUtil;
 
 public class fauxv {
 
     static Proc proc = null;
 
     public static void main (String[] args) {
-	// Parse command line. Check pid provided.
-
-	CommandlineParser parser = new CommandlineParser("fauxv") {
-
-	    public void parseCores (CoreExePair[] corePairs) {
-		for (int i = 0; i < corePairs.length; i++) {
-		    File coreFile = corePairs[i].coreFile;
-		    File exeFile = corePairs[i].exeFile;
-		    if (exeFile == null)
-			proc = Util.getProcFromCoreFile(coreFile);
-		    else
-			proc = Util.getProcFromCoreFile(coreFile, exeFile);
-		    PrintAuxvEvent auxvPrint = new PrintAuxvEvent(proc);
-		    auxvPrint.execute();
-		    System.exit(0);
-		}
-	    }
-
-	    public void parsePids (ProcId[] pids) {
-		for (int i= 0; i< pids.length; i++) {
-		    ProcId id = pids[i];
-		    proc = Util.getProcFromPid(id);
-		    new ProcBlockAction(proc, new RichAuxvDump(proc));
-		    Manager.eventLoop.run();
-		    System.exit(0);
-		}
-	    }
-
-
-	};
-
-
-	parser.setHeader("Usage: fauxv <PID>  || fauxv <COREFILE> [<EXEFILE>]");
-	parser.parse(args);
-
-	//If we got here, we didn't find a pid.
-	System.err.println("Error: No PID or COREFILE.");
-	parser.printHelp();
-	System.exit(1);
+        ProcStopUtil fauxv = new ProcStopUtil("fauxv", args, 
+                                               new PrintAuxvEvent());
+        fauxv.setUsage("Usage: fauxv <PID>  || fauxv <COREFILE> [<EXEFILE>] " +
+        	       "|| fauvx <COREFILE> [<EXEFILE>]");  
+        fauxv.execute();
     }   
 
-    private static class PrintAuxvEvent implements Event
+    private static class PrintAuxvEvent implements ProcEvent
     {
-
-	private Proc proc = null;
-	public PrintAuxvEvent(Proc proc)
-	{
-	    this.proc = proc;
-	}
-	public void execute() {
-	    class BuildAuxv extends AuxvStringBuilder {
-
-		public StringBuffer auxvData = new StringBuffer();
-		public void buildLine(String type, String desc, String value) {
-		    auxvData.append(type+" (" + desc+") : " + value+"\n");
-		}
-	    }	
-
-	    BuildAuxv buildAuxv = new BuildAuxv();
-	    buildAuxv.construct(proc.getAuxv(), proc);
-
-	    System.out.print(buildAuxv.auxvData.toString());
-
-	    System.exit(0);
-	}
-
-
-    }
-
-
-
-    private static class RichAuxvDump implements ProcObserver.ProcAction {
-
-	private Proc proc;
-
-
-	public RichAuxvDump(Proc proc)
-	{
-	    this.proc = proc;
-	}
-
-	public void allExistingTasksCompleted() {
-	    Manager.eventLoop.add(new PrintAuxvEvent(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) {
-	}
+        public void execute(Proc proc) {
+            class BuildAuxv extends AuxvStringBuilder {
+
+        	public StringBuffer auxvData = new StringBuffer();
+        	public void buildLine(String type, String desc, String value) {
+        	    auxvData.append(type+" (" + desc+") : " + value+"\n");
+        	}
+            }
+            BuildAuxv buildAuxv = new BuildAuxv();
+
+            if (proc.getAuxv() == null)
+        	System.out.println ("No auxv information available");
+            else {
+        	buildAuxv.construct(proc.getAuxv(), proc);
+        	System.out.print(buildAuxv.auxvData.toString());
+            }
+        }
     }
 }


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-08 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 17:15 [SCM] master: Refactor fauxv to use ProcStopUtil tthomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).