public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Add maps command
@ 2007-12-07 14:31 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2007-12-07 14:31 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  1428e86f7a48aceaee478725a9a8c641d502f7db (commit)
      from  108636b93367206922bef95b14494b4cb7dbe244 (commit)

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

- Log -----------------------------------------------------------------
commit 1428e86f7a48aceaee478725a9a8c641d502f7db
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Fri Dec 7 14:31:03 2007 +0000

    Add maps command
    
    2007-12-07  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* AuxvCommand.java (interpret): Return nothing when
    	main task cannot be found.
    	* MapsCommand.java: New.
    	* TestMapsCommand: New.
    	* TopLevelCommand.java (TopLevelCommand): Add maps command.

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

Summary of changes:
 frysk-core/frysk/hpd/AuxvCommand.java              |    3 +
 frysk-core/frysk/hpd/ChangeLog                     |    6 +++
 .../hpd/{AuxvCommand.java => MapsCommand.java}     |   47 ++++++-------------
 .../DeadProc.java => hpd/TestMapsCommand.java}     |   30 +++++++-----
 frysk-core/frysk/hpd/TopLevelCommand.java          |    1 +
 5 files changed, 42 insertions(+), 45 deletions(-)
 copy frysk-core/frysk/hpd/{AuxvCommand.java => MapsCommand.java} (72%)
 copy frysk-core/frysk/{proc/dead/DeadProc.java => hpd/TestMapsCommand.java} (80%)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/AuxvCommand.java b/frysk-core/frysk/hpd/AuxvCommand.java
index 41d2fa1..33b6554 100644
--- a/frysk-core/frysk/hpd/AuxvCommand.java
+++ b/frysk-core/frysk/hpd/AuxvCommand.java
@@ -66,7 +66,10 @@ public class AuxvCommand extends ParameterizedCommand {
     PTSet ptset = cli.getCommandPTSet(cmd);
     Iterator taskDataIterator = ptset.getTaskData();
     if (taskDataIterator.hasNext() == false)
+    {
       cli.addMessage("Cannot find main task. Cannot print out auxv", Message.TYPE_ERROR);
+      return;
+    }
     Proc mainProc = ((TaskData) taskDataIterator.next()).getTask().getProc();
     Auxv[] liveAux = mainProc.getAuxv();
     
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index cbd0566..000ee62 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,5 +1,11 @@
 2007-12-07  Phil Muldoon  <pmuldoon@redhat.com>
 
+	* AuxvCommand.java (interpret): Return nothing when
+	main task cannot be found.
+	* MapsCommand.java: New.
+	* TestMapsCommand: New.
+	* TopLevelCommand.java (TopLevelCommand): Add maps command.
+
 	* AuxvCommand.java: Move AuxvStringBuilder from here
 	to frysk.util.
 	* TestAuxvCommand.java (testAuxVCoreCommand): Rewrite.
diff --git a/frysk-core/frysk/hpd/AuxvCommand.java b/frysk-core/frysk/hpd/MapsCommand.java
similarity index 72%
copy from frysk-core/frysk/hpd/AuxvCommand.java
copy to frysk-core/frysk/hpd/MapsCommand.java
index 41d2fa1..1c1b212 100644
--- a/frysk-core/frysk/hpd/AuxvCommand.java
+++ b/frysk-core/frysk/hpd/MapsCommand.java
@@ -41,24 +41,16 @@ package frysk.hpd;
 
 import java.util.Iterator;
 import java.util.List;
-import frysk.proc.Auxv;
+import frysk.proc.MemoryMap;
 import frysk.proc.Proc;
-import frysk.util.AuxvStringBuilder;
 
-public class AuxvCommand extends ParameterizedCommand {
+public class MapsCommand extends ParameterizedCommand {
   
   boolean verbose = false;
   
-  public AuxvCommand() {
-    super("Print process auxiliary", "auxv [-verbose]", 
-	  "Print out the process auxiliary data for this "
-	  + "process.");
-    
-    add(new CommandOption("verbose", "Print out known auxv descriptions ") {
-	void parse(String argument, Object options) {
-	  verbose = true;
-	}
-      });
+  public MapsCommand() {
+    super("Print process maps", "maps", 
+	  "Print out the process maps table.");
     
   }
   
@@ -66,28 +58,19 @@ public class AuxvCommand extends ParameterizedCommand {
     PTSet ptset = cli.getCommandPTSet(cmd);
     Iterator taskDataIterator = ptset.getTaskData();
     if (taskDataIterator.hasNext() == false)
-      cli.addMessage("Cannot find main task. Cannot print out auxv", Message.TYPE_ERROR);
-    Proc mainProc = ((TaskData) taskDataIterator.next()).getTask().getProc();
-    Auxv[] liveAux = mainProc.getAuxv();
-    
-    class BuildAuxv extends AuxvStringBuilder {
-      
-      public StringBuffer auxvData = new StringBuffer();
-      public void buildLine(String type, String desc, String value) {
-	if (verbose)
-	  auxvData.append(type+" (" + desc+") : " + value+"\n");
-	else
-	  auxvData.append(type+" : " + value+"\n");	
-      }
+    {
+      cli.addMessage("Cannot find main task. Cannot print out process maps.", Message.TYPE_ERROR);
+      return;
     }
+    Proc mainProc = ((TaskData) taskDataIterator.next()).getTask().getProc();
+    MemoryMap[] maps = mainProc.getMaps();
     
-    BuildAuxv buildAuxv = new BuildAuxv();
-    buildAuxv.construct(liveAux);
-    
-    cli.outWriter.println(buildAuxv.auxvData.toString());
+    for (int i=0; i<maps.length; i++)
+    	cli.outWriter.println(maps[i].toString());
   }
   
   int completer(CLI cli, Input input, int cursor, List completions) {
     return -1;
-  }  
-}
+  }
+  
+}
\ No newline at end of file
diff --git a/frysk-core/frysk/proc/dead/DeadProc.java b/frysk-core/frysk/hpd/TestMapsCommand.java
similarity index 80%
copy from frysk-core/frysk/proc/dead/DeadProc.java
copy to frysk-core/frysk/hpd/TestMapsCommand.java
index 56232b2..51380af 100644
--- a/frysk-core/frysk/proc/dead/DeadProc.java
+++ b/frysk-core/frysk/hpd/TestMapsCommand.java
@@ -37,20 +37,24 @@
 // version and license this file solely under the GPL without
 // exception.
 
-package frysk.proc.dead;
+package frysk.hpd;
 
+import frysk.proc.MemoryMap;
 import frysk.proc.Proc;
-import frysk.proc.ProcId;
-import frysk.proc.Host;
+import frysk.testbed.DaemonBlockedAtSignal;
 
-/**
- * A dead Host/Proc/Task is characterised by its lack of state, and an
- * in ability to respond to stateful requests such as add/remove
- * observers.
- */
-
-abstract class DeadProc extends Proc {
-    DeadProc(Host host, Proc parent, ProcId id) {
-	super(host, parent, id);
-    }
+public class TestMapsCommand extends TestLib {
+  
+  public void testMapsCommand() {
+	  
+    Proc proc = (new DaemonBlockedAtSignal("funit-stacks")).getMainTask().getProc();
+    MemoryMap[] liveMaps = proc.getMaps();
+        
+    e = new HpdTestbed();
+    e.send("attach " + proc.getPid() +"\n");
+    e.send("maps\n");
+    for (int i=0; i< liveMaps.length; i++)
+      e.equals(liveMaps[i].toString());
+    e.close();
+  }
 }
diff --git a/frysk-core/frysk/hpd/TopLevelCommand.java b/frysk-core/frysk/hpd/TopLevelCommand.java
index 875836a..e133e7c 100644
--- a/frysk-core/frysk/hpd/TopLevelCommand.java
+++ b/frysk-core/frysk/hpd/TopLevelCommand.java
@@ -97,6 +97,7 @@ public class TopLevelCommand extends MultiLevelCommand {
         add(new Help(), "help");
         add(new ListCommand(), "l|ist");
         add(new LoadCommand(), "load");
+	add(new MapsCommand(), "maps");
         add(new PeekCommand(), "peek");
 	Command quit = new QuitCommand();
         add(quit, "exit");


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


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

only message in thread, other threads:[~2007-12-07 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-07 14:31 [SCM] master: Add maps command pmuldoon

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).