public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Remove class name from Elf error messages. Date: Wed, 27 Feb 2008 02:56:00 -0000 [thread overview] Message-ID: <20080227025607.2431.qmail@sourceware.org> (raw) The branch, master has been updated via 13eaab0224ce71fe031becc059a0d342b6047a4e (commit) from 06bc3d3173c673eb2486c917fa60396893931a9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 13eaab0224ce71fe031becc059a0d342b6047a4e Author: Andrew Cagney <cagney@redhat.com> Date: Tue Feb 26 21:55:04 2008 -0500 Remove class name from Elf error messages. frysk-core/frysk/util/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * CommandlineParser.java: Add logging; check for null getMessage(). frysk-sys/frysk/rsl/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * Log.java (dump(Throwable)): Use toString(), not getMessage(); print the causes not the excetion. frysk-sys/frysk/sys/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * Errno.java-sh: New. * Errno.java: Delete. * cni/Errno.cxx (throwErrno): Delete. frysk-sys/lib/dwfl/ChangeLog 2008-02-26 Andrew Cagney <cagney@redhat.com> * ElfException.java: Use the cause's getMessage. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/util/ChangeLog | 3 + frysk-core/frysk/util/CommandlineParser.java | 20 ++- frysk-sys/frysk/rsl/ChangeLog | 3 + frysk-sys/frysk/rsl/Log.java | 14 +- frysk-sys/frysk/sys/ChangeLog | 6 + frysk-sys/frysk/sys/Errno.java | 157 -------------------- .../frysk/sys/Errno.java-sh | 56 +++++--- frysk-sys/frysk/sys/cni/Errno.cxx | 17 +-- frysk-sys/lib/dwfl/ChangeLog | 4 + frysk-sys/lib/dwfl/ElfException.java | 2 +- 10 files changed, 82 insertions(+), 200 deletions(-) delete mode 100644 frysk-sys/frysk/sys/Errno.java copy frysk-core/frysk/testbed/IsaTestbed.java => frysk-sys/frysk/sys/Errno.java-sh (69%) First 500 lines of diff: diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog index 0a32f31..b129829 100644 --- a/frysk-core/frysk/util/ChangeLog +++ b/frysk-core/frysk/util/ChangeLog @@ -1,5 +1,8 @@ 2008-02-26 Andrew Cagney <cagney@redhat.com> + * CommandlineParser.java: Add logging; check for null + getMessage(). + * CommandlineParser.java (parse(String[])): Catch any exception. * ProcStopUtil.java (parseCores(Proc[])): Replace parseCoresFIXME(CoreExePair[]). diff --git a/frysk-core/frysk/util/CommandlineParser.java b/frysk-core/frysk/util/CommandlineParser.java index 7d04366..d5cedd3 100644 --- a/frysk-core/frysk/util/CommandlineParser.java +++ b/frysk-core/frysk/util/CommandlineParser.java @@ -49,20 +49,22 @@ import gnu.classpath.tools.getopt.OptionException; import gnu.classpath.tools.getopt.Parser; import frysk.Config; import frysk.EventLogger; +import frysk.rsl.Log; import frysk.proc.dead.LinuxCoreFactory; import frysk.proc.dead.LinuxExeFactory; import frysk.proc.Proc; /** - * CommandlineParser extends the getopt {@link Parser} class with common options - * for Frysk command-line applications. It adds the {@link EventLogger} options. + * CommandlineParser extends the getopt {@link Parser} class with + * common options for Frysk command-line applications. It adds the + * {@link EventLogger} options. */ public class CommandlineParser { - Parser parser; + private final Log fine = Log.fine(CommandlineParser.class); + private final Parser parser; public CommandlineParser(String name, String version) { parser = new Parser(name, version, true); - EventLogger.addConsoleOptions(parser); } @@ -134,11 +136,16 @@ public class CommandlineParser { public String[] parse(String[] args) { try { + fine.log(this, "parse", args); String[] result = doParse(args); validate(); return result; } catch (Exception e) { - System.err.println("Error: " + e.getMessage()); + fine.log(this, "parse failed", e); + if (e.getMessage() == null) + System.err.println("Error: " + e.toString()); + else + System.err.println("Error: " + e.getMessage()); System.exit(1); return null; // To fool Java } @@ -164,6 +171,7 @@ public class CommandlineParser { throw new OptionException("Please don't mix pids with core files or executables"); } } + fine.log(this, "parse pids", procs); parsePids(procs); return result; } catch (NumberFormatException e) { @@ -190,11 +198,13 @@ public class CommandlineParser { } CoreExePair[] coreExePairs = new CoreExePair[coreExeFiles.size()]; coreExeFiles.toArray(coreExePairs); + fine.log(this, "parse cores", coreExePairs); parseCoresFIXME(coreExePairs); return result; } // If not above, then this is an executable command. + fine.log(this, "parse command", result); parseCommandFIXME(result); return result; } diff --git a/frysk-sys/frysk/rsl/ChangeLog b/frysk-sys/frysk/rsl/ChangeLog index e8b3e35..fea2b6f 100644 --- a/frysk-sys/frysk/rsl/ChangeLog +++ b/frysk-sys/frysk/rsl/ChangeLog @@ -1,5 +1,8 @@ 2008-02-26 Andrew Cagney <cagney@redhat.com> + * Log.java (dump(Throwable)): Use toString(), not getMessage(); + print the causes not the excetion. + * Log.java: Add more log methods. * package.html (Implementing a Custom Log): New. diff --git a/frysk-sys/frysk/rsl/Log.java b/frysk-sys/frysk/rsl/Log.java index 7736aa4..2a657af 100644 --- a/frysk-sys/frysk/rsl/Log.java +++ b/frysk-sys/frysk/rsl/Log.java @@ -222,13 +222,13 @@ public final class Log { * causes. */ private void dump(Throwable t) { - out.print("<<exception"); - Throwable cause = t; - do { - out.print(":"); - out.print(t.getMessage()); - cause = cause.getCause(); - } while (cause != null); + out.print("<<exception "); + out.print(t.toString()); + for (Throwable cause = t.getCause(); cause != null; + cause = cause.getCause()) { + out.print(" <caused-by> "); + out.print(cause.toString()); + } out.print(">>"); } private void dump(String s) { diff --git a/frysk-sys/frysk/sys/ChangeLog b/frysk-sys/frysk/sys/ChangeLog index 3cd9398..11393e8 100644 --- a/frysk-sys/frysk/sys/ChangeLog +++ b/frysk-sys/frysk/sys/ChangeLog @@ -1,3 +1,9 @@ +2008-02-26 Andrew Cagney <cagney@redhat.com> + + * Errno.java-sh: New. + * Errno.java: Delete. + * cni/Errno.cxx (throwErrno): Delete. + 2008-02-19 Chris Moller <cmoller@redhat.com> * Fork.java: diff --git a/frysk-sys/frysk/sys/Errno.java b/frysk-sys/frysk/sys/Errno.java deleted file mode 100644 index 9390d10..0000000 --- a/frysk-sys/frysk/sys/Errno.java +++ /dev/null @@ -1,157 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2005, Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// 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 -// exception. - -package frysk.sys; - -/** - * Host Errors, thrown by this directory. - */ - -public class Errno - extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - protected Errno (String message) { - super(message); - } - - /** - * Bad file descriptor. - */ - static public class Ebadf - extends Errno - { - private static final long serialVersionUID = 1L; - - protected Ebadf (String message) - { - super (message); - } - } - /** - * Not enough space. - */ - static public class Enomem - extends Errno - { - private static final long serialVersionUID = 1L; - - protected Enomem (String message) - { - super (message); - } - } - /** - * Bad address. - */ - static public class Efault - extends Errno - { - private static final long serialVersionUID = 1L; - - protected Efault (String message) - { - super (message); - } - } - /** - * Invalid argument. - */ - static public class Einval - extends Errno - { - private static final long serialVersionUID = 1L; - - protected Einval (String message) - { - super (message); - } - } - /** - * No such process. - */ - static public class Esrch - extends Errno - { - private static final long serialVersionUID = 1L; - - protected Esrch (String message) - { - super (message); - } - } - /** - * No child process. - */ - static public class Echild - extends Errno - { - private static final long serialVersionUID = 1L; - protected Echild (String message) - { - super (message); - } - } - - /** - * Operation not permitted - */ - static public class Eperm - extends Errno - { - private static final long serialVersionUID = 1L; - protected Eperm (String message) - { - super (message); - } - } - - /** - * Input/Output Error. - */ - static public class Eio extends Errno { - private static final long serialVersionUID = 1L; - protected Eio (String message) { - super (message); - } - } - - static native void throwErrno (int err, String prefix); -} diff --git a/frysk-core/frysk/testbed/IsaTestbed.java b/frysk-sys/frysk/sys/Errno.java-sh similarity index 69% copy from frysk-core/frysk/testbed/IsaTestbed.java copy to frysk-sys/frysk/sys/Errno.java-sh index 5ea3c66..fdbf585 100644 --- a/frysk-core/frysk/testbed/IsaTestbed.java +++ b/frysk-sys/frysk/sys/Errno.java-sh @@ -1,3 +1,5 @@ +#!/bin/sh +cat <<EOF // This file is part of the program FRYSK. // // Copyright 2008, Red Hat Inc. @@ -36,37 +38,53 @@ // modification, you must delete this exception statement from your // version and license this file solely under the GPL without // exception. +EOF -package frysk.testbed; +cat <<EOF -import frysk.isa.ISA; -import frysk.isa.ElfMap; -import frysk.Config; +package frysk.sys; /** - * Return the ISA being used by the testbed. + * Unix Host Errors. + * + * Do not confuse this with target errors and target error numbers. */ +public class Errno extends RuntimeException { + static final long serialVersionUID = 0; -public class IsaTestbed { - - /** - * Return the default isa being used for testing. - */ - public static ISA getISA() { - return ElfMap.getISA(Config.getPkgLibFile("funit-slave")); + private final String message; + private Errno(String message) { + super(message); + this.message = message; } - /** - * Return the 32-bit isa being used for 32-on-64 testing. + * Create an error corresponding to errno (use when the more specific + * errno hasn't available). */ - public static ISA getISA32() { - return ElfMap.getISA(Config.getPkgLib32File("funit-slave")); + public Errno(int num, String message) { + this(message + " (errno " + num + ")"); } /** - * Return the 64-bit isa being used for 32-on-64 testing. + * Return the error message (without any decoration). */ - public static ISA getISA64() { - return ElfMap.getISA(Config.getPkgLib64File("funit-slave")); + public String getMessage() { + return message; } +EOF + +for e in badf nomem fault inval srch child perm io noent +do cat <<EOF + + public static class E${e} extends Errno { + static final long serialVersionUID = 0; + E${e}(String message) { + super(message); + } + } +EOF +done + +cat <<EOF } +EOF diff --git a/frysk-sys/frysk/sys/cni/Errno.cxx b/frysk-sys/frysk/sys/cni/Errno.cxx index 14095fb..d2878c1 100644 --- a/frysk-sys/frysk/sys/cni/Errno.cxx +++ b/frysk-sys/frysk/sys/cni/Errno.cxx @@ -60,6 +60,7 @@ #include "frysk/sys/Errno$Echild.h" #include "frysk/sys/Errno$Esrch.h" #include "frysk/sys/Errno$Eperm.h" +#include "frysk/sys/Errno$Enoent.h" #include "frysk/sys/Errno$Eio.h" #include "frysk/sys/GarbageCollect.h" #include "frysk/sys/cni/Errno.hxx" @@ -133,8 +134,12 @@ throwErrno (int err, jstring jmessage) case EIO: throw new frysk::sys::Errno$Eio (jmessage); #endif +#ifdef ENOENT + case ENOENT: + throw new frysk::sys::Errno$Enoent (jmessage); +#endif default: - throw new frysk::sys::Errno (jmessage); + throw new frysk::sys::Errno(err, jmessage); } } @@ -158,16 +163,6 @@ throwErrno (int err, const char *prefix) } void -frysk::sys::Errno::throwErrno (jint err, jstring prefix) -{ - int len = JvGetStringUTFLength(prefix); - char string[len + 1]; - JvGetStringUTFRegion (prefix, 0, prefix->length (), string); - string[len] = '\0'; - ::throwErrno (err, string); -} - -void throwRuntimeException (const char *message) { throw new java::lang::RuntimeException diff --git a/frysk-sys/lib/dwfl/ChangeLog b/frysk-sys/lib/dwfl/ChangeLog index f09947a..eae4976 100644 --- a/frysk-sys/lib/dwfl/ChangeLog +++ b/frysk-sys/lib/dwfl/ChangeLog @@ -1,3 +1,7 @@ +2008-02-26 Andrew Cagney <cagney@redhat.com> + + * ElfException.java: Use the cause's getMessage. + 2008-02-19 Andrew Cagney <cagney@redhat.com> * ElfFileException.java (ElfFileException(String)): Delete. diff --git a/frysk-sys/lib/dwfl/ElfException.java b/frysk-sys/lib/dwfl/ElfException.java index 2fcb01a..86306e8 100644 --- a/frysk-sys/lib/dwfl/ElfException.java +++ b/frysk-sys/lib/dwfl/ElfException.java @@ -48,7 +48,7 @@ public class ElfException extends RuntimeException { private static final long serialVersionUID = 400112389738713948L; ElfException(Throwable t) { - super(t); + super(t.getMessage(), t); } public ElfException(String s){ super(s); hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-02-27 2:56 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=20080227025607.2431.qmail@sourceware.org \ --to=cagney@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).