[SCM] master: Add fauxv command.

pmuldoon@sourceware.org pmuldoon@sourceware.org
Tue Dec 11 10:09:00 GMT 2007


The branch, master has been updated
       via  5f078697788883be959202a9643d29430587e182 (commit)
      from  14f35178d5566764b7d964bdddd18b5f2287a58b (commit)

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

- Log -----------------------------------------------------------------
commit 5f078697788883be959202a9643d29430587e182
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Tue Dec 11 10:09:26 2007 +0000

    Add fauxv command.
    
    2007-12-11  Phil Muldoon  <pmuldoon@redhat.com>
    
            * faux.java: New.
            * TestFauxv.java: New.
            * faux.xml: New.

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

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog                  |    7 +++
 .../bindir/{TestFmaps.java => TestFauxv.java}      |   53 +++++++++++---------
 frysk-core/frysk/bindir/{fmaps.java => fauxv.java} |   30 ++++++++---
 frysk-core/frysk/bindir/{fmaps.xml => fauxv.xml}   |   14 +++---
 4 files changed, 65 insertions(+), 39 deletions(-)
 copy frysk-core/frysk/bindir/{TestFmaps.java => TestFauxv.java} (64%)
 copy frysk-core/frysk/bindir/{fmaps.java => fauxv.java} (81%)
 copy frysk-core/frysk/bindir/{fmaps.xml => fauxv.xml} (93%)

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index 63c0dd4..3dae751 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-11  Phil Muldoon  <pmuldoon@redhat.com>
+
+
+	* faux.java: New.
+	* TestFauxv.java: New.
+	* faux.xml: New.
+	
 2007-12-10  Phil Muldoon  <pmuldoon@redhat.com>
 
 	* fmaps.java: Indent.
diff --git a/frysk-core/frysk/bindir/TestFmaps.java b/frysk-core/frysk/bindir/TestFauxv.java
similarity index 64%
copy from frysk-core/frysk/bindir/TestFmaps.java
copy to frysk-core/frysk/bindir/TestFauxv.java
index 66705be..060361a 100644
--- a/frysk-core/frysk/bindir/TestFmaps.java
+++ b/frysk-core/frysk/bindir/TestFauxv.java
@@ -44,38 +44,45 @@ import frysk.expunit.Expect;
 import frysk.Config;
 import java.io.File;
 import frysk.testbed.TearDownExpect;
-import frysk.testbed.CoreFileAtSignal;
 
-public class TestFmaps
-  extends TestCase
+public class TestFauxv
+    extends TestCase
 {
-  
-  /**
-   * Start fmaps with both a core file and an executable; avoids
-   * problems with Linux's bone-head COREFILE format storing only
-   * the first 50 characters of the executable.
-   */
-    private Expect fmaps(String program, String[] args) {
-	File coreExe = Config.getPkgLibFile(program);
-	File coreFile = CoreFileAtSignal.constructCore(coreExe);
-	String[] argv = new String[args.length + 3];
+    
+    private Expect fauxv(File coreFile) {
+	String[] argv = new String[2];
 	int argc = 0;
-	argv[argc++] = Config.getBinFile("fmaps").getAbsolutePath();
+	argv[argc++] = Config.getBinFile("fauxv").getAbsolutePath();
 	argv[argc++] = coreFile.getAbsolutePath();
-	argv[argc++] = coreExe.getAbsolutePath();
-	for (int i = 0; i < args.length; i++) {
-	    argv[argc + i] = args[i];
-	}
 	Expect e = new Expect(argv);
+	System.out.println(argv[0]+" " +argv[1]);
 	TearDownExpect.add(e);
 	return e;
     }
     
-    // Basic sniff test, are we getting output that looks like a map?
-    // getMaps is tested in the frysk-core/proc namespalce
-    public void testExeOfPid() {
-	Expect e  = fmaps("funit-stack-outlined", new String[0]);
-	e.expect("funit-stack-outlined");
+    // Basic sniff test, are we getting output that looks like a auuv?
+    // getAuxv is tested in the frysk-core/proc namespace/
+    public void testAuxvCore() {
+	Expect e  = fauxv(Config.getPkgDataFile("test-core-x86"));
+	
+	e.expect("AT_SYSINFO \\(SYSINFO\\) : 6464512");
+	e.expect("AT_SYSINFO_EHDR \\(SYSINFO EHDR\\) : 0x62a000");
+	e.expect("AT_HWCAP \\(Machine dependent hints about\\) : 0xafe9f1bf");
+	e.expect("AT_PAGESZ \\(System page size\\) : 4096");
+	e.expect("AT_CLKTCK \\(Frequency of times\\(\\)\\) : 100");
+	e.expect("AT_PHDR \\(Program headers for program\\) : 0x8048034");
+	e.expect("AT_PHENT \\(Size of program header entry\\) : 32");
+	e.expect("AT_PHNUM \\(Number of program headers\\) : 8");
+	e.expect("AT_BASE \\(Base address of interpreter\\) : 0");
+	e.expect("AT_FLAGS \\(Flags\\) : 0");
+	e.expect("AT_ENTRY \\(Entry point of program\\) : 0x80483e0");
+	e.expect("AT_UID \\(Real uid\\) : 500");
+	e.expect("AT_EUID \\(Effective uid\\) : 500");
+	e.expect("AT_GID \\(Real gid\\) : 500");
+	e.expect("AT_EGID \\(Effective gid\\) : 500");
+	e.expect("AT_0x17 \\(AT_0x17\\) : 0");
+	e.expect("AT_PLATFORM \\(String identifying platform.\\) : 0xbfcfee4b");
+	e.expect("AT_NULL \\(End of vector\\) : 0");
 	
     }
 }
diff --git a/frysk-core/frysk/bindir/fmaps.java b/frysk-core/frysk/bindir/fauxv.java
similarity index 81%
copy from frysk-core/frysk/bindir/fmaps.java
copy to frysk-core/frysk/bindir/fauxv.java
index d9d80c9..8930bb0 100644
--- a/frysk-core/frysk/bindir/fmaps.java
+++ b/frysk-core/frysk/bindir/fauxv.java
@@ -41,18 +41,19 @@ package frysk.bindir;
 
 import frysk.util.CommandlineParser;
 import frysk.util.Util;
+import frysk.util.AuxvStringBuilder;
 import frysk.proc.Proc;
 import frysk.proc.ProcId;
-import frysk.proc.MemoryMap;
+import frysk.proc.Auxv;
 import java.io.File;
 import frysk.util.CoreExePair;
 
-public class fmaps {
+public class fauxv {
     
     public static void main (String[] args) {
 	// Parse command line. Check pid provided.
 	
-	CommandlineParser parser = new CommandlineParser("fexe") {
+	CommandlineParser parser = new CommandlineParser("fauxv") {
 		
 		public void parseCores (CoreExePair[] corePairs) {
 		    for (int i = 0; i < corePairs.length; i++) {
@@ -64,7 +65,7 @@ public class fmaps {
 			    proc = Util.getProcFromCoreFile(coreFile);
 			else
 			    proc = Util.getProcFromCoreFile(coreFile, exeFile);
-			printMaps(proc.getMaps());
+			printAuxv(proc.getAuxv());
 		    }
 		    
 		    System.exit(0);
@@ -74,20 +75,31 @@ public class fmaps {
 		    for (int i= 0; i< pids.length; i++) {
 			ProcId id = pids[i];
 			Proc proc = Util.getProcFromPid(id);
-			printMaps(proc.getMaps());
+			printAuxv(proc.getAuxv());
 		    }
 		    System.exit(0);
 		}
 		
-		private void printMaps(MemoryMap[] maps)
+		private void printAuxv(Auxv[] auxv)
 		{
-		    for(int i=0; i<maps.length; i++)
-			System.out.println(maps[i].toString());
+		    
+		    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(auxv);
+		    
+		    System.out.println(buildAuxv.auxvData.toString());
 		}
 		
 	    };
 	
-	parser.setHeader("Usage: fmaps <PID>  || fmaps <COREFILE> [<EXEFILE>]");
+	parser.setHeader("Usage: fauxv <PID>  || fmaps <COREFILE> [<EXEFILE>]");
 	parser.parse(args);
 	
 	//If we got here, we didn't find a pid.
diff --git a/frysk-core/frysk/bindir/fmaps.xml b/frysk-core/frysk/bindir/fauxv.xml
similarity index 93%
copy from frysk-core/frysk/bindir/fmaps.xml
copy to frysk-core/frysk/bindir/fauxv.xml
index ec08dad..54b5e6e 100644
--- a/frysk-core/frysk/bindir/fmaps.xml
+++ b/frysk-core/frysk/bindir/fauxv.xml
@@ -51,18 +51,18 @@
 <refentry id="fmaps">
 
   <refentryinfo>
-    <title>fmaps</title>
+    <title>fauxv</title>
     <date>December 10 2007</date>
   </refentryinfo>
   
   <refmeta>
-    <refentrytitle>fmaps</refentrytitle>
+    <refentrytitle>fauxv</refentrytitle>
     <manvolnum>1</manvolnum>
   </refmeta>
 
   <refnamediv>
     <refname>fmaps</refname>
-    <refpurpose>Prints out a process or a corefile's maps.</refpurpose>
+    <refpurpose>Prints out a process or a corefile's auxv data.</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
@@ -83,9 +83,9 @@
   <refsect1>
     <title>DESCRIPTION</title>
 
-    <para><function>fmaps</function> Executes the frysk map dump utility.</para>
+    <para><function>fmaps</function> Executes the frysk axuv dump utility.</para>
 
-    <para>fmaps is a utility that prints out a process or a corefile's maps. </para>
+    <para>fmaps is a utility that prints out a process or a corefile's auxv data. </para>
 
     <variablelist>
       <varlistentry>
@@ -126,7 +126,7 @@
   
   <refsect1>
     <title>EXAMPLE</title>
-    <screen>fcore pid [...]</screen>
+    <screen>fauxv pid [...]</screen>
   </refsect1>
    
   <!-- refsect1>
@@ -141,7 +141,7 @@
 
   <refsect1>
     <title>SEE ALSO</title>
-    <para>fexe(1) funit(8) fcatch(1) fhpd(1) fstack(1) fstep(1) ftrace(1)</para>
+    <para>fmaps(1) fexe(1) funit(8) fcatch(1) fhpd(1) fstack(1) fstep(1) ftrace(1)</para>
   </refsect1>
   
   <!-- refsect1>


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



More information about the Frysk-cvs mailing list