public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Make core executables sysroot aware.
@ 2008-04-18 20:08 scox
  0 siblings, 0 replies; only message in thread
From: scox @ 2008-04-18 20:08 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  47fe8d4b087a852370e31e21eb2c2e3c7a0e274b (commit)
      from  44f60a8d0ce962747244b9404a91ec96d9dda975 (commit)

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

- Log -----------------------------------------------------------------
commit 47fe8d4b087a852370e31e21eb2c2e3c7a0e274b
Author: Stan Cox <scox@redhat.com>
Date:   Fri Apr 18 16:03:44 2008 -0400

    Make core executables sysroot aware.
    
    * CoreCommand.java (interpret): Use exePath instead of exeFile.
    * LinuxCoreFactory.java (createProc): Add SysRoot to signature.
    * LinuxCoreInfo.java (LinuxCoreInfo): Likewise.
    * (getExeFile): Likewise.

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

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog                   |    4 ++++
 frysk-core/frysk/hpd/CoreCommand.java            |   11 +++++------
 frysk-core/frysk/proc/dead/ChangeLog             |    6 ++++++
 frysk-core/frysk/proc/dead/LinuxCoreFactory.java |   22 +++++++++++++++++-----
 frysk-core/frysk/proc/dead/LinuxCoreInfo.java    |   16 ++++++++++------
 5 files changed, 42 insertions(+), 17 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index bfe7075..20cd689 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-18  Stan Cox  <scox@redhat.com>
+
+	* CoreCommand.java (interpret): Use exePath instead of exeFile.
+
 2008-04-18  Mark Wielaard  <mwielaard@redhat.com>
 
 	* TestFhpdStepping.java: Don't mark unresolved. Adjust to new
diff --git a/frysk-core/frysk/hpd/CoreCommand.java b/frysk-core/frysk/hpd/CoreCommand.java
index 909ff31..7603099 100644
--- a/frysk-core/frysk/hpd/CoreCommand.java
+++ b/frysk-core/frysk/hpd/CoreCommand.java
@@ -83,7 +83,7 @@ public class CoreCommand extends ParameterizedCommand {
     void interpret(CLI cli, Input cmd, Object optionsObject) {
 	Options options = (Options)optionsObject;
 	File coreFile;
-	File exeFile;
+	String exePath;
 
 	switch (cmd.size()) {
 	case 0:
@@ -92,11 +92,11 @@ public class CoreCommand extends ParameterizedCommand {
 	case 1:
 	    // <core>
 	    coreFile = new File(cmd.parameter(0));
-	    exeFile = null;
+	    exePath = null;
 	    break;
 	case 2:
 	    coreFile = new File(cmd.parameter(0));
-	    exeFile = new File(cmd.parameter(1));
+	    exePath = cmd.parameter(1);
 	    break;
 	default:
 	    throw new InvalidCommandException
@@ -106,14 +106,13 @@ public class CoreCommand extends ParameterizedCommand {
 	// Make paths canonical (keeps elfutils working).
 	try {
 	    coreFile = coreFile.getCanonicalFile();
-	    if (exeFile != null)
-		exeFile = exeFile.getCanonicalFile();
 	} catch (IOException e) {
 	    throw new RuntimeException(e);
 	}
 
 	// Build Core. Move any exceptions up to cli and print to user.
-	Proc coreProc = LinuxCoreFactory.createProc(coreFile, exeFile,
+	Proc coreProc = LinuxCoreFactory.createProc(coreFile, exePath, 
+						    options.sysroot,
 						    options.loadMetaData);
 
 	load(coreProc, cli, options.sysroot);
diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog
index 324f201..79d6c6b 100644
--- a/frysk-core/frysk/proc/dead/ChangeLog
+++ b/frysk-core/frysk/proc/dead/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-18  Stan Cox  <scox@redhat.com>
+
+	* LinuxCoreFactory.java (createProc): Add SysRoot to signature.
+	* LinuxCoreInfo.java (LinuxCoreInfo): Likewise.
+	* (getExeFile): Likewise. 
+
 2008-04-17  Andrew Cagney  <cagney@redhat.com>
 
 	* TestCorefileByteBuffer.java: Use frysk.config.Prefix.
diff --git a/frysk-core/frysk/proc/dead/LinuxCoreFactory.java b/frysk-core/frysk/proc/dead/LinuxCoreFactory.java
index 5683a4c..7453127 100644
--- a/frysk-core/frysk/proc/dead/LinuxCoreFactory.java
+++ b/frysk-core/frysk/proc/dead/LinuxCoreFactory.java
@@ -41,6 +41,8 @@ package frysk.proc.dead;
 
 import java.io.File;
 
+import frysk.sysroot.SysRoot;
+
 /**
  * Data needed to construct a core file; shared between the core Host,
  * Proc And task.
@@ -54,20 +56,30 @@ public class LinuxCoreFactory {
      *
      * All File paths <b>must</b> be canonical.
      */
-    public static DeadProc createProc(File coreFile, File exeFile,
+    public static DeadProc createProc(File coreFile, File exeFile, String sysroot,
 				      boolean extendedMetaData) {
-	LinuxCoreInfo core = new LinuxCoreInfo(coreFile, exeFile,
+	LinuxCoreInfo core = new LinuxCoreInfo(coreFile, exeFile, sysroot,
 					       extendedMetaData);
 	LinuxCoreHost host = new LinuxCoreHost(core);
 	return host.getProc();
     }
+    public static DeadProc createProc(File coreFile, String exePath, String sysroot,
+	    			      boolean extendedMetaData) {
+	SysRoot sysRoot = new SysRoot(sysroot);
+	File exe;
+	if (exePath != null)
+	    exe = sysRoot.getPathViaSysRoot(exePath).getFile();
+	else
+	    exe = null;
+	return createProc(coreFile, exe, sysroot, extendedMetaData);
+    }
     /**
      * Construct a core file without extended meta data.
      *
      * All File paths <b>must</b> be canonical.
      */
     public static DeadProc createProc(File coreFile) {
-	return createProc(coreFile, null, false);
+	return createProc(coreFile, (File)null, "/", false);
     }
     /**
      * Construct a core file, possibly with extended meta data.
@@ -75,7 +87,7 @@ public class LinuxCoreFactory {
      * All File paths <b>must</b> be canonical.
      */
     public static DeadProc createProc(File coreFile, boolean extendedMetaData) {
-	return createProc(coreFile, null, extendedMetaData);
+	return createProc(coreFile, (File)null, "/", extendedMetaData);
     }
     /**
      * Construct a core file with extended meta data taken from the
@@ -84,6 +96,6 @@ public class LinuxCoreFactory {
      * All File paths <b>must</b> be canonical.
      */
     public static DeadProc createProc(File coreFile, File exeFile) {
-	return createProc(coreFile, exeFile, true);
+	return createProc(coreFile, exeFile, "/", true);
     }
 }
diff --git a/frysk-core/frysk/proc/dead/LinuxCoreInfo.java b/frysk-core/frysk/proc/dead/LinuxCoreInfo.java
index ed6aa2f..84144b1 100644
--- a/frysk-core/frysk/proc/dead/LinuxCoreInfo.java
+++ b/frysk-core/frysk/proc/dead/LinuxCoreInfo.java
@@ -57,6 +57,7 @@ import lib.dwfl.ElfPrpsinfo;
 import frysk.rsl.Log;
 import frysk.proc.Auxv;
 import frysk.sys.proc.AuxvBuilder;
+import frysk.sysroot.SysRoot;
 import frysk.proc.MemoryMap;
 import frysk.solib.LinkMapFactory;
 import frysk.solib.LinkMap;
@@ -90,7 +91,7 @@ class LinuxCoreInfo {
      * Unpack the core file extracting everything needed to create a
      * host, proc, and tasks.
      */
-    LinuxCoreInfo(File coreParam, File exeParam, boolean extendedMetaData) {
+    LinuxCoreInfo(File coreParam, File exeParam, String sysroot, boolean extendedMetaData) {
 	Elf coreElf = null;
 	Elf exeElf = null;
 	try {
@@ -118,7 +119,7 @@ class LinuxCoreInfo {
 
 	    // Define the real exe file (dependant on parameters might
 	    // have to extract this from the process information).
-	    this.exeFile = getExeFile(exeParam, args, prpsInfo);
+	    this.exeFile = getExeFile(exeParam, args, sysroot, prpsInfo);
 	    if (extendedMetaData)
 		exeElf = new Elf(this.exeFile, ElfCommand.ELF_C_READ);
 
@@ -181,19 +182,22 @@ class LinuxCoreInfo {
     /**
      *
      */
-    private static File getExeFile(File exeParam, String[] args,
+    private static File getExeFile(File exeParam, String[] args, String sysroot,
 				   ElfPrpsinfo prpsInfo) {
+	String exePath;
 	if (exeParam == null) {
 	    // Only place to find full path + exe is in the args
 	    // list. Remove ./ if present.
 	    if (args.length > 0) {
 		if (args[0].startsWith("./"))
-		    exeParam = new File(args[0].substring(2));
+		    exePath = args[0].substring(2);
 		else
-		    exeParam = new File(args[0]);
+		    exePath = args[0];
 	    } else {
-		exeParam = new File(prpsInfo.getPrFname());
+		exePath = prpsInfo.getPrFname();
 	    }
+	    SysRoot sysRoot = new SysRoot(sysroot);
+	    exeParam= sysRoot.getPathViaSysRoot(exePath).getFile();
 	    fine.log("exe from core", exeParam);
 	} else {
 	    fine.log("exe for core", exeParam);


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


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

only message in thread, other threads:[~2008-04-18 20:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-18 20:08 [SCM] master: Make core executables sysroot aware scox

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