From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2474 invoked by alias); 27 Feb 2008 02:56:10 -0000 Received: (qmail 2448 invoked by uid 367); 27 Feb 2008 02:56:07 -0000 Date: Wed, 27 Feb 2008 02:56:00 -0000 Message-ID: <20080227025607.2431.qmail@sourceware.org> From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Remove class name from Elf error messages. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 06bc3d3173c673eb2486c917fa60396893931a9c X-Git-Newrev: 13eaab0224ce71fe031becc059a0d342b6047a4e Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00259.txt.bz2 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 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 * CommandlineParser.java: Add logging; check for null getMessage(). frysk-sys/frysk/rsl/ChangeLog 2008-02-26 Andrew Cagney * Log.java (dump(Throwable)): Use toString(), not getMessage(); print the causes not the excetion. frysk-sys/frysk/sys/ChangeLog 2008-02-26 Andrew Cagney * Errno.java-sh: New. * Errno.java: Delete. * cni/Errno.cxx (throwErrno): Delete. frysk-sys/lib/dwfl/ChangeLog 2008-02-26 Andrew Cagney * 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 + * 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 + * 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("< "); + 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 + + * Errno.java-sh: New. + * Errno.java: Delete. + * cni/Errno.cxx (throwErrno): Delete. + 2008-02-19 Chris Moller * 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 <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 + + * ElfException.java: Use the cause's getMessage. + 2008-02-19 Andrew Cagney * 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