public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: tthomas@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Refactor fauxv to use ProcStopUtil.
Date: Fri, 08 Feb 2008 17:15:00 -0000	[thread overview]
Message-ID: <20080208171518.6107.qmail@sourceware.org> (raw)

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


                 reply	other threads:[~2008-02-08 17:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080208171518.6107.qmail@sourceware.org \
    --to=tthomas@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).