public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: pmuldoon@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM] frysk system monitor/debugger branch, master, updated. 6c1b2134a1081b7d65f0656fcc13a9ae85d964f9
Date: Tue, 06 Nov 2007 14:58:00 -0000	[thread overview]
Message-ID: <20071106145806.11940.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  6c1b2134a1081b7d65f0656fcc13a9ae85d964f9 (commit)
      from  7c185652b3cca2ab1cbfeeb45482ec772d1b4c5b (commit)

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

- Log -----------------------------------------------------------------
commit 6c1b2134a1081b7d65f0656fcc13a9ae85d964f9
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Tue Nov 6 14:57:57 2007 +0000

    Rework how corefiles and executables pair. Build a corefile status object. Return much richer information to CoreCommand.
    
    2007-11-06  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* LinuxProc.java (LinuxProc): Do not search for exe beyond pwd.
    	* LinuxHost.java (LinuxHost): Build a CorefileStatus.
    	(getStatus): New.
    	(DeconstructCoreFile.update): Build status from Proc.
    	* CorefileStatus.java: New
    
    2007-11-06  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* CoreCommand.java (interpret): Rewrite corefile model.
    	Give much richer information back on corefile building.

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

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog                     |    5 ++
 frysk-core/frysk/hpd/CoreCommand.java              |   45 ++++++++++++++++++--
 frysk-core/frysk/proc/dead/ChangeLog               |    8 ++++
 .../dead/{DeadHost.java => CorefileStatus.java}    |   20 ++++-----
 frysk-core/frysk/proc/dead/LinuxHost.java          |   30 ++++++++++++-
 frysk-core/frysk/proc/dead/LinuxProc.java          |   21 +--------
 6 files changed, 94 insertions(+), 35 deletions(-)
 copy frysk-core/frysk/proc/dead/{DeadHost.java => CorefileStatus.java} (88%)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 324823d..9987008 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-06  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* CoreCommand.java (interpret): Rewrite corefile model.
+	Give much richer information back on corefile building.
+
 2007-11-01  Andrew Cagney  <cagney@redhat.com>
 
 	* Command.java (complete(CLI,Input,int,List)): Remove comment
diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java
index 0b23e18..3173ef6 100644
--- a/frysk-core/frysk/hpd/CoreCommand.java
+++ b/frysk-core/frysk/hpd/CoreCommand.java
@@ -44,6 +44,9 @@ import java.util.Iterator;
 import frysk.debuginfo.DebugInfo;
 import frysk.debuginfo.DebugInfoFrame;
 import frysk.debuginfo.DebugInfoStackFactory;
+import frysk.proc.dead.CorefileStatus;
+import frysk.proc.dead.LinuxHost;
+import frysk.proc.Manager;
 import frysk.proc.Proc;
 import frysk.proc.Task;
 
@@ -68,16 +71,50 @@ public class CoreCommand extends Command {
 	File coreFile = new File(cmd.parameter(0));
 
 	Proc coreProc;
+	File exeFile = null;
+	LinuxHost coreHost = null;
 	if (cmd.size() == 1)
-	    coreProc = frysk.util.Util.getProcFromCoreFile(coreFile);
+		coreHost = new LinuxHost(Manager.eventLoop, coreFile);
 	else {
-	    File exeFile = new File(cmd.parameter(1));
-	    coreProc = frysk.util.Util.getProcFromCoreFile(coreFile, exeFile);
+	    exeFile = new File(cmd.parameter(1));
+		coreHost = new LinuxHost(Manager.eventLoop, coreFile, exeFile);
+	}
+	
+	Iterator i = coreHost.getProcIterator(); 
+	
+	if (i.hasNext())
+		coreProc = (Proc) i.next();
+	else {
+		cli.addMessage("Cannot find a process in corefile: '" + coreFile.getAbsolutePath()+"'. This may not be a valid ELF corefile.", Message.TYPE_ERROR);
+		return;
+	}
+	if (i.hasNext()) {
+	    cli.addMessage("There appears to be two or more processes in corefile: '" + coreFile.getAbsolutePath()+"'. This is not valid for an ELF corefile", Message.TYPE_ERROR);
+	    return;
+	}
+	CorefileStatus status = coreHost.getStatus();
+	if (status.hasExe == false)
+	{
+		String message = "The corefile: '"+coreFile.getAbsolutePath()+"' has no executable associated with it. The executable name ";
+		String exeName = "";
+		if (exeFile != null) 
+		{
+			exeName = exeFile.getAbsolutePath();
+			message += "specified by the user on the Core command was: '" + exeName;
+		}
+		else
+		{
+			exeName = coreProc.getExe();
+			message += "automatically read from the corefile was: '" + exeName;
+		}
+		message+="'. This executable could not be read. Please specifiy an executable on the 'core' command (eg core core.1234 exenamedFile) for richer metadata.";
+		
+		cli.addMessage(message,Message.TYPE_WARNING);
 	}
-
 	int procID = cli.idManager.reserveProcID();
 	cli.idManager.manageProc(coreProc, procID);
 		
+
 	Iterator foo = cli.targetset.getTasks();
 	while (foo.hasNext()) {
 	    Task task = (Task) foo.next();
diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog
index 9d5d3e6..c11c271 100644
--- a/frysk-core/frysk/proc/dead/ChangeLog
+++ b/frysk-core/frysk/proc/dead/ChangeLog
@@ -1,3 +1,11 @@
+2007-11-06  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* LinuxProc.java (LinuxProc): Do not search for exe beyond pwd.
+	* LinuxHost.java (LinuxHost): Build a CorefileStatus.
+	(getStatus): New.
+	(DeconstructCoreFile.update): Build status from Proc.
+	* CorefileStatus.java: New
+
 2007-10-18  Rick Moseley  <rmoseley@redhat.com>
 
 	* LinuxExeHost.java: Add DeconstructExeFile class and update
diff --git a/frysk-core/frysk/proc/dead/DeadHost.java b/frysk-core/frysk/proc/dead/CorefileStatus.java
similarity index 88%
copy from frysk-core/frysk/proc/dead/DeadHost.java
copy to frysk-core/frysk/proc/dead/CorefileStatus.java
index 29a077e..b99e1fc 100644
--- a/frysk-core/frysk/proc/dead/DeadHost.java
+++ b/frysk-core/frysk/proc/dead/CorefileStatus.java
@@ -33,20 +33,18 @@
 // this exception. If you modify this file, you may extend this
 // exception to your version of the file, but you are not obligated to
 // do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
+// modification, you must delete this exception statement from your// version and license this file solely under the GPL without
 // exception.
 
-package frysk.proc.dead;
-
-import frysk.proc.Host;
 
-/**
- * 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.
- */
+package frysk.proc.dead;
 
-abstract class DeadHost extends Host {
+public class CorefileStatus {
 
+	public boolean hasExe = false;
+	public boolean hasCore = true;
+	public String exeName = "";
+	public String coreName = "";
+	public boolean hasExeProblem = false;
+	public String message = "";
 }
diff --git a/frysk-core/frysk/proc/dead/LinuxHost.java b/frysk-core/frysk/proc/dead/LinuxHost.java
index aa2e1e3..3bc2eeb 100644
--- a/frysk-core/frysk/proc/dead/LinuxHost.java
+++ b/frysk-core/frysk/proc/dead/LinuxHost.java
@@ -58,6 +58,7 @@ import frysk.proc.FindProc;
 
 public class LinuxHost extends DeadHost {
 
+  CorefileStatus status = new CorefileStatus();
   boolean hasRefreshed = false;
   boolean exeSetToNull = false;
   protected File coreFile = null;
@@ -93,11 +94,28 @@ public class LinuxHost extends DeadHost {
   {
       this(eventLoop, coreFile, false);
       if (exeFile == null)
-	  exeSetToNull = true;
-      this.exeFile = exeFile;
+    	  exeSetToNull = true;
+      
+      if (exeFile.canRead() && exeFile.exists())
+    	  this.exeFile = exeFile;
+      else
+      {
+    	  status.hasExe = false;
+    	  status.hasExeProblem = true;
+    	  status.message = "The user provided executable: " 
+    		  	+ exeFile.getAbsolutePath() + 
+    		  	" could not be accessed";
+      }
       this.sendRefresh(true);
+      
+      
   }
 
+  public CorefileStatus getStatus()
+  {
+	  return status;
+  }
+  
   protected void sendRefresh(boolean refreshAll) 
   {
 
@@ -172,6 +190,7 @@ public class LinuxHost extends DeadHost {
     DeconstructCoreFile(Elf coreFileElf)
     {
       this.coreFileElf =  coreFileElf;
+      status.coreName = coreFile.getAbsolutePath();
       ElfEHeader eHeader = this.coreFileElf.getEHeader();
       
       // Get number of program header entries.
@@ -210,6 +229,13 @@ public class LinuxHost extends DeadHost {
 
       addedProcs.add(proc);
 
+      if  (exeFile == null) 
+    	  status.hasExe = false;
+      else
+      {
+    	  status.hasExe = true;
+    	  status.exeName = exeFile.getAbsolutePath();
+      }
       return proc;
     }
       
diff --git a/frysk-core/frysk/proc/dead/LinuxProc.java b/frysk-core/frysk/proc/dead/LinuxProc.java
index 1db4019..69f0d84 100644
--- a/frysk-core/frysk/proc/dead/LinuxProc.java
+++ b/frysk-core/frysk/proc/dead/LinuxProc.java
@@ -90,24 +90,9 @@ public class LinuxProc extends DeadProc {
     // as it is written in the corefile. 
     if ((host.exeFile == null) && (host.exeSetToNull == false))
       {
-	File exeFileName = new File(sendrecExe());
-	// XXX: Hack here, some processes do not have path information
-	// in the name. 
-	if ((exeFileName.exists()) && (exeFileName.canRead()))
-	  host.exeFile = exeFileName;
-	else
-	  {
-	    String commonLocations[] = {"/bin/","/usr/bin/"};
-	    for (int i=0; i<commonLocations.length; i++)
-	      {
-		exeFileName = new File(commonLocations[i]+sendrecExe());
-		if ((exeFileName.exists()) && (exeFileName.canRead()))
-		  {
-		    host.exeFile = new File(commonLocations[i]+sendrecExe());
-		    break;
-		  }
-	      }
-	  }
+    	File exeFileName = new File(sendrecExe());
+    	if ((exeFileName.exists()) && (exeFileName.canRead()))
+    		host.exeFile = exeFileName;
 	
       }
     this.exefileBackEnd = host.exeFile;


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


                 reply	other threads:[~2007-11-06 14:58 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=20071106145806.11940.qmail@sourceware.org \
    --to=pmuldoon@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).