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

The branch, master has been updated
       via  0fb13e7cc5f975675b50a0e349db34cbcdb0470d (commit)
      from  ec5156efde7f08f2adc5c459155e5abf4ea8477f (commit)

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

- Log -----------------------------------------------------------------
commit 0fb13e7cc5f975675b50a0e349db34cbcdb0470d
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Thu Feb 7 13:58:58 2008 -0500

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

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

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog  |    8 +++-
 frysk-core/frysk/bindir/fmaps.java |   65 +++++++++---------------------------
 2 files changed, 22 insertions(+), 51 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index 56e7592..5525a65 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -1,7 +1,11 @@
-2008-02-07  Andrew Cagney  <cagney@redhat.com>
+2008-02-07  Teresa Thomas  <tthomas@redhat.com>
 
-	* fstep.java: Update to use Host.requestProc(int,FindProc).
+	* fmaps.java: Refactor to use ProcStopUtil.
 
+2008-02-07  Andrew Cagney  <cagney@redhat.com>
+	
+	* fstep.java: Update to use Host.requestProc(int,FindProc).
+	
 2008-02-06  Teresa Thomas  <tthomas@redhat.com>
 
 	* fdebuginfo.java: Refactor, use ProcStopUtil.
diff --git a/frysk-core/frysk/bindir/fmaps.java b/frysk-core/frysk/bindir/fmaps.java
index d9d80c9..7a328b1 100644
--- a/frysk-core/frysk/bindir/fmaps.java
+++ b/frysk-core/frysk/bindir/fmaps.java
@@ -39,60 +39,27 @@
 
 package frysk.bindir;
 
-import frysk.util.CommandlineParser;
-import frysk.util.Util;
+import frysk.util.ProcStopUtil;
+import frysk.event.ProcEvent;
 import frysk.proc.Proc;
-import frysk.proc.ProcId;
 import frysk.proc.MemoryMap;
-import java.io.File;
-import frysk.util.CoreExePair;
 
 public class fmaps {
     
     public static void main (String[] args) {
-	// Parse command line. Check pid provided.
-	
-	CommandlineParser parser = new CommandlineParser("fexe") {
-		
-		public void parseCores (CoreExePair[] corePairs) {
-		    for (int i = 0; i < corePairs.length; i++) {
-			File coreFile = corePairs[i].coreFile;
-			File exeFile = corePairs[i].exeFile;
-			Proc proc;
-			
-			if (exeFile == null)
-			    proc = Util.getProcFromCoreFile(coreFile);
-			else
-			    proc = Util.getProcFromCoreFile(coreFile, exeFile);
-			printMaps(proc.getMaps());
-		    }
-		    
-		    System.exit(0);
-		}
-		
-		public void parsePids (ProcId[] pids) {
-		    for (int i= 0; i< pids.length; i++) {
-			ProcId id = pids[i];
-			Proc proc = Util.getProcFromPid(id);
-			printMaps(proc.getMaps());
-		    }
-		    System.exit(0);
-		}
-		
-		private void printMaps(MemoryMap[] maps)
-		{
-		    for(int i=0; i<maps.length; i++)
-			System.out.println(maps[i].toString());
-		}
-		
-	    };
-	
-	parser.setHeader("Usage: fmaps <PID>  || fmaps <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 fmaps = new ProcStopUtil("fmaps", args, 
+		                               new PrintMapsEvent());
+	fmaps.setUsage("Usage: fmaps <PID> || fmaps <EXEFILE> " +
+	               "|| fmaps <COREFILE> [<EXEFILE>]");   
+	fmaps.execute();
+    }
+    
+    private static class PrintMapsEvent implements ProcEvent
+    {
+	public void execute(Proc proc) {
+	    MemoryMap[] maps = proc.getMaps();
+	    for(int i=0; i<maps.length; i++)
+		System.out.println(maps[i].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-07 19:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-07 19:24 [SCM] master: Refactor fmaps 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).