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. b0fe6a24f1b83254fd0a74c4fad2e72a46b49b26 Date: Wed, 07 Nov 2007 10:43:00 -0000 [thread overview] Message-ID: <20071107104304.1117.qmail@sourceware.org> (raw) The branch, master has been updated via b0fe6a24f1b83254fd0a74c4fad2e72a46b49b26 (commit) from 56f7ede3726faf57106e3b509f5f7c7073546517 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit b0fe6a24f1b83254fd0a74c4fad2e72a46b49b26 Author: Phil Muldoon <pmuldoon@redhat.com> Date: Wed Nov 7 10:42:47 2007 +0000 Reformat to SUN Style ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/proc/dead/LinuxHost.java | 355 +++++++++++++--------------- 1 files changed, 165 insertions(+), 190 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/proc/dead/LinuxHost.java b/frysk-core/frysk/proc/dead/LinuxHost.java index 52e7263..827cdff 100644 --- a/frysk-core/frysk/proc/dead/LinuxHost.java +++ b/frysk-core/frysk/proc/dead/LinuxHost.java @@ -33,7 +33,8 @@ // 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; @@ -58,197 +59,171 @@ import frysk.proc.FindProc; public class LinuxHost extends DeadHost { - CorefileStatus status = new CorefileStatus(); - boolean hasRefreshed = false; - boolean exeSetToNull = false; - protected File coreFile = null; - protected File exeFile = null; - Elf corefileElf; - EventLoop eventLoop; - - private LinuxHost(EventLoop eventLoop, File coreFile, boolean doRefresh) - { - this.coreFile = coreFile; - this.eventLoop = eventLoop; - try - { - this.corefileElf = new Elf (coreFile.getPath(), ElfCommand.ELF_C_READ); - } - catch (Exception e) - { - System.out.println("Not in this exception"); - throw new RuntimeException("Corefile " + this.coreFile + " is "+ - "not a valid ELF core file."); - } - - if (corefileElf.getEHeader().type != ElfEHeader.PHEADER_ET_CORE) { - this.corefileElf.close(); - throw new RuntimeException("'"+this.coreFile.getAbsolutePath()+"' is not a corefile."); - } - - if (doRefresh) - this.sendRefresh(true); - } - - public LinuxHost(EventLoop eventLoop, File coreFile) - { - this(eventLoop, coreFile, true); - } - - - public LinuxHost(EventLoop eventLoop, File coreFile, File exeFile) - { - this(eventLoop, coreFile, false); - if (exeFile == null) - 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) - { - - if (this.hasRefreshed) - return; - // Iterate (build) the /proc tree, passing each found PID to - // procChanges where it can update the /proc tree. - new DeconstructCoreFile(this.corefileElf); - // Changes individual process. - for (Iterator i = procPool.values().iterator(); i.hasNext();) - { - LinuxProc proc = (LinuxProc) i.next(); - proc.sendRefresh(); - } - this.hasRefreshed = true; - } - - protected void sendRefresh (final ProcId procId, final FindProc finder) - { - - // Core files nevers never change - if (!(procPool.containsKey(procId))) - { - eventLoop.add(new Event() - { - public void execute () - { - finder.procNotFound(procId, new RuntimeException( - "Couldn't find the proc" - + procId)); - } - }); - return; - } - - - LinuxProc proc = (LinuxProc) getProc(procId); - proc.sendRefresh(); - - eventLoop.add(new Event() - { - - public void execute () - { - finder.procFound(procId); - } - }); - - } - - - protected void sendCreateAttachedProc(String stdin, String stdout, - String stderr, String[] args, - TaskObserver.Attached attached) - { - } - - - protected Proc sendrecSelf() - { - return null; - } - - - private class DeconstructCoreFile - { - List addedProcs = new LinkedList(); - //HashMap removedProcs = (HashMap) ((HashMap) procPool).clone(); - Elf coreFileElf; - ElfData noteData = null; - - DeconstructCoreFile(Elf coreFileElf) - { - this.coreFileElf = coreFileElf; - status.coreName = coreFile.getAbsolutePath(); - ElfEHeader eHeader = this.coreFileElf.getEHeader(); - - // Get number of program header entries. - long phSize = eHeader.phnum; - for (int i=0; i<phSize; i++) - { - // Test if pheader is of types notes.. - ElfPHeader pHeader = coreFileElf.getPHeader(i); - if (pHeader.type == ElfPHeader.PTYPE_NOTE) - { - // if so, copy, break an leave. - noteData = coreFileElf.getRawData(pHeader.offset,pHeader.filesz); - break; - } + CorefileStatus status = new CorefileStatus(); + + boolean hasRefreshed = false; + + boolean exeSetToNull = false; + + protected File coreFile = null; + + protected File exeFile = null; + + Elf corefileElf; + + EventLoop eventLoop; + + private LinuxHost(EventLoop eventLoop, File coreFile, boolean doRefresh) { + this.coreFile = coreFile; + this.eventLoop = eventLoop; + try { + this.corefileElf = new Elf(coreFile.getPath(), + ElfCommand.ELF_C_READ); + } catch (Exception e) { + throw new RuntimeException("Corefile " + this.coreFile + " is " + + "not a valid ELF core file."); + } + + if (corefileElf.getEHeader().type != ElfEHeader.PHEADER_ET_CORE) { + this.corefileElf.close(); + throw new RuntimeException("'" + this.coreFile.getAbsolutePath() + + "' is not a corefile."); + } + + if (doRefresh) + this.sendRefresh(true); + } + + public LinuxHost(EventLoop eventLoop, File coreFile) { + this(eventLoop, coreFile, true); + } + + public LinuxHost(EventLoop eventLoop, File coreFile, File exeFile) { + this(eventLoop, coreFile, false); + if (exeFile == null) + 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; } - if (noteData != null) - update(noteData); - } - - Proc update (ElfData proc_pid) - { - final ElfPrpsinfo coreProc = ElfPrpsinfo.decode(proc_pid); - final ProcId procId = new ProcId(coreProc.getPrPid()); - // Currently there can only be one process per core file. - // What happens when we have two core files denoting the same - // process/pid? Leave the test here for now. - - Proc proc = (Proc) procPool.get(procId); - if (proc == null) - { - // core file processes have no parents as thy are captured - // in isolation, and reconstructed. - proc = new LinuxProc(proc_pid,LinuxHost.this,procId); + protected void sendRefresh(boolean refreshAll) { + + if (this.hasRefreshed) + return; + // Iterate (build) the /proc tree, passing each found PID to + // procChanges where it can update the /proc tree. + new DeconstructCoreFile(this.corefileElf); + // Changes individual process. + for (Iterator i = procPool.values().iterator(); i.hasNext();) { + LinuxProc proc = (LinuxProc) i.next(); + proc.sendRefresh(); + } + this.hasRefreshed = true; } - addedProcs.add(proc); - - if (exeFile == null) - status.hasExe = false; - else - { - status.hasExe = true; - status.exeName = exeFile.getAbsolutePath(); - } - return proc; - } - - } - - protected void finalize () throws Throwable - { - corefileElf = null; - } + protected void sendRefresh(final ProcId procId, final FindProc finder) { + + // Core files nevers never change + if (!(procPool.containsKey(procId))) { + eventLoop.add(new Event() { + public void execute() { + finder.procNotFound(procId, new RuntimeException( + "Couldn't find the proc" + procId)); + } + }); + return; + } + + LinuxProc proc = (LinuxProc) getProc(procId); + proc.sendRefresh(); + + eventLoop.add(new Event() { + + public void execute() { + finder.procFound(procId); + } + }); + + } + + protected void sendCreateAttachedProc(String stdin, String stdout, + String stderr, String[] args, TaskObserver.Attached attached) { + } + + protected Proc sendrecSelf() { + return null; + } + + private class DeconstructCoreFile { + List addedProcs = new LinkedList(); + + //HashMap removedProcs = (HashMap) ((HashMap) procPool).clone(); + Elf coreFileElf; + + ElfData noteData = null; + + DeconstructCoreFile(Elf coreFileElf) { + this.coreFileElf = coreFileElf; + status.coreName = coreFile.getAbsolutePath(); + ElfEHeader eHeader = this.coreFileElf.getEHeader(); + + // Get number of program header entries. + long phSize = eHeader.phnum; + for (int i = 0; i < phSize; i++) { + // Test if pheader is of types notes.. + ElfPHeader pHeader = coreFileElf.getPHeader(i); + if (pHeader.type == ElfPHeader.PTYPE_NOTE) { + // if so, copy, break an leave. + noteData = coreFileElf.getRawData(pHeader.offset, + pHeader.filesz); + break; + } + } + + if (noteData != null) + update(noteData); + } + + Proc update(ElfData proc_pid) { + final ElfPrpsinfo coreProc = ElfPrpsinfo.decode(proc_pid); + final ProcId procId = new ProcId(coreProc.getPrPid()); + // Currently there can only be one process per core file. + // What happens when we have two core files denoting the same + // process/pid? Leave the test here for now. + + Proc proc = (Proc) procPool.get(procId); + if (proc == null) { + // core file processes have no parents as thy are captured + // in isolation, and reconstructed. + proc = new LinuxProc(proc_pid, LinuxHost.this, procId); + } + + addedProcs.add(proc); + + if (exeFile == null) + status.hasExe = false; + else { + status.hasExe = true; + status.exeName = exeFile.getAbsolutePath(); + } + return proc; + } + + } + + protected void finalize() throws Throwable { + corefileElf = null; + } } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-11-07 10:43 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=20071107104304.1117.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: linkBe 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).