public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: pmuldoon@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Refactor Auxv test, move AuxvStringBuilder to utils. Date: Fri, 07 Dec 2007 12:13:00 -0000 [thread overview] Message-ID: <20071207121327.6926.qmail@sourceware.org> (raw) The branch, master has been updated via 108636b93367206922bef95b14494b4cb7dbe244 (commit) from af8def376f0ce3d3f216c3704bca8aec55843927 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 108636b93367206922bef95b14494b4cb7dbe244 Author: Phil Muldoon <pmuldoon@redhat.com> Date: Fri Dec 7 12:13:18 2007 +0000 Refactor Auxv test, move AuxvStringBuilder to utils. 2007-12-07 Phil Muldoon <pmuldoon@redhat.com> * AuxvStringBuilder.java: New. 2007-12-07 Phil Muldoon <pmuldoon@redhat.com> * AuxvCommand.java: Move AuxvStringBuilder from here to frysk.util. * TestAuxvCommand.java (testAuxVCoreCommand): Rewrite. Extract auxv from live process, generate core, test against fhpd represention of core auxv data. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/AuxvCommand.java | 30 +----------- frysk-core/frysk/hpd/ChangeLog | 9 +++ frysk-core/frysk/hpd/TestAuxvCommand.java | 52 ++++++++++++-------- .../frysk/util/AuxvStringBuilder.java | 46 +++++++++-------- frysk-core/frysk/util/ChangeLog | 4 ++ 5 files changed, 71 insertions(+), 70 deletions(-) copy frysk-sys/lib/dwfl/DwarfException.java => frysk-core/frysk/util/AuxvStringBuilder.java (77%) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/AuxvCommand.java b/frysk-core/frysk/hpd/AuxvCommand.java index 79f52fd..41d2fa1 100644 --- a/frysk-core/frysk/hpd/AuxvCommand.java +++ b/frysk-core/frysk/hpd/AuxvCommand.java @@ -39,11 +39,11 @@ package frysk.hpd; -import inua.elf.AT; import java.util.Iterator; import java.util.List; import frysk.proc.Auxv; import frysk.proc.Proc; +import frysk.util.AuxvStringBuilder; public class AuxvCommand extends ParameterizedCommand { @@ -89,31 +89,5 @@ public class AuxvCommand extends ParameterizedCommand { int completer(CLI cli, Input input, int cursor, List completions) { return -1; - } - - abstract class AuxvStringBuilder - { - protected AuxvStringBuilder() { - } - - public final void construct (Auxv[] rawAuxv) { - String value; - for (int i=0; i < rawAuxv.length; i++) { - switch (rawAuxv[i].type) { - case 33: - case 16: - case 3: - case 9: - case 15: - value = "0x"+Long.toHexString(rawAuxv[i].val); - break; - default: - value = ""+rawAuxv[i].val; - } - buildLine(AT.toString(rawAuxv[i].type), AT.toPrintString(rawAuxv[i].type), value); - } - } - - abstract public void buildLine(String type, String desc, String value); - } + } } diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 7e612de..cbd0566 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,12 @@ +2007-12-07 Phil Muldoon <pmuldoon@redhat.com> + + * AuxvCommand.java: Move AuxvStringBuilder from here + to frysk.util. + * TestAuxvCommand.java (testAuxVCoreCommand): Rewrite. + Extract auxv from live process, generate core, test + against fhpd represention of core auxv data. + + 2007-12-06 Phil Muldoon <pmuldoon@redhat.com> * TopLevelCommand.java(TopLevelCommand): add auxv command. diff --git a/frysk-core/frysk/hpd/TestAuxvCommand.java b/frysk-core/frysk/hpd/TestAuxvCommand.java index 35fad72..a0f9c59 100644 --- a/frysk-core/frysk/hpd/TestAuxvCommand.java +++ b/frysk-core/frysk/hpd/TestAuxvCommand.java @@ -39,34 +39,46 @@ package frysk.hpd; -import frysk.Config; +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; + +import frysk.proc.Auxv; +import frysk.proc.Proc; +import frysk.proc.dead.TestLinuxCore; +import frysk.testbed.DaemonBlockedAtSignal; +import frysk.util.AuxvStringBuilder; public class TestAuxvCommand extends TestLib { public void testAuxVCoreCommand() { + + Proc proc = (new DaemonBlockedAtSignal("funit-stacks")).getMainTask().getProc(); + Auxv[] liveAuxv = proc.getAuxv(); + + TestLinuxCore tester = new TestLinuxCore(); + File core = new File(tester.constructCore(proc)); + core.deleteOnExit(); + class BuildAuxv extends AuxvStringBuilder { + + public ArrayList auxvData = new ArrayList(); + public void buildLine(String type, String desc, String value) { + auxvData.add(type+" : " + value+"\n"); + } + } + + BuildAuxv buildAuxv = new BuildAuxv(); + buildAuxv.construct(liveAuxv); + + e = new HpdTestbed(); - e.send("core " + Config.getPkgDataFile("test-core-x86").getPath() + e.send("core " + core.getPath() + " -noexe\n"); e.expect(5, "Attached to core file.*"); e.send("auxv\n"); - e.expect("AT_SYSINFO : 6464512"); - e.expect("AT_SYSINFO_EHDR : 0x62a000"); - e.expect("AT_HWCAP : 0xafe9f1bf"); - e.expect("AT_PAGESZ : 4096"); - e.expect("AT_CLKTCK : 100"); - e.expect("AT_PHDR : 0x8048034"); - e.expect("AT_PHENT : 32"); - e.expect("AT_PHNUM : 8"); - e.expect("AT_BASE : 0"); - e.expect("AT_FLAGS : 0"); - e.expect("AT_ENTRY : 0x80483e0"); - e.expect("AT_UID : 500"); - e.expect("AT_EUID : 500"); - e.expect("AT_GID : 500"); - e.expect("AT_EGID : 500"); - e.expect("AT_0x17 : 0"); - e.expect("AT_PLATFORM : 0xbfcfee4b"); - e.expect("AT_NULL : 0"); + Iterator i = buildAuxv.auxvData.iterator(); + while (i.hasNext()) + e.equals((String)i.next()); e.close(); } } diff --git a/frysk-sys/lib/dwfl/DwarfException.java b/frysk-core/frysk/util/AuxvStringBuilder.java similarity index 77% copy from frysk-sys/lib/dwfl/DwarfException.java copy to frysk-core/frysk/util/AuxvStringBuilder.java index 1f804ad..02ce064 100644 --- a/frysk-sys/lib/dwfl/DwarfException.java +++ b/frysk-core/frysk/util/AuxvStringBuilder.java @@ -36,33 +36,35 @@ // modification, you must delete this exception statement from your // version and license this file solely under the GPL without // exception. +package frysk.util; -package lib.dwfl; +import inua.elf.AT; +import frysk.proc.Auxv; -public class DwarfException - extends RuntimeException + +public abstract class AuxvStringBuilder { - static public final long serialVersionUID = 200703231604l; - public DwarfException() - { - super(); + protected AuxvStringBuilder() { } - public DwarfException(String message) - { - super(message); - } - - public DwarfException(String message, Throwable cause) - { - super(message, cause); - } - - public DwarfException(Throwable cause) - { - super(cause); + public final void construct (Auxv[] rawAuxv) { + String value; + for (int i=0; i < rawAuxv.length; i++) { + switch (rawAuxv[i].type) { + case 33: + case 16: + case 3: + case 9: + case 15: + value = "0x"+Long.toHexString(rawAuxv[i].val); + break; + default: + value = ""+rawAuxv[i].val; + } + buildLine(AT.toString(rawAuxv[i].type), AT.toPrintString(rawAuxv[i].type), value); + } } + + abstract public void buildLine(String type, String desc, String value); } - - diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog index cde359d..c404a5b 100644 --- a/frysk-core/frysk/util/ChangeLog +++ b/frysk-core/frysk/util/ChangeLog @@ -1,3 +1,7 @@ +2007-12-07 Phil Muldoon <pmuldoon@redhat.com> + + * AuxvStringBuilder.java: New. + 2007-12-04 Andrew Cagney <cagney@redhat.com> Merge frysk.sys.Sig into frysk.sys.Signal. hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-12-07 12:13 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=20071207121327.6926.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).