This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
Re: Patch: fix up Syscall a bit
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: tromey at redhat dot com
- Cc: Frysk Hackers <frysk at sourceware dot org>
- Date: Mon, 18 Sep 2006 11:27:15 -0500
- Subject: Re: Patch: fix up Syscall a bit
- References: <m3bqpfnztb.fsf@localhost.localdomain>
My only general concern is the over-use of throwing exceptions in
syscall look-ups. (I realize, Tom., that you just changed the Exception
and did not put the original Exception in there). I thought this would
be a good place to ask the question as it is in the patch. In the location:
@@ -259,24 +260,21 @@
syscallList = task.getIsa().getSyscallList ();
unknownSyscalls = task.getIsa().getUnknownSyscalls ();
}
- catch (Exception e)
+ catch (TaskException e)
{
- throw new RuntimeException ("Could not get the isa");
+ throw new RuntimeException ("Could not get the isa", e);
}
if (num < 0)
{
- throw new RuntimeException ("Negative Syscall Number:" +
- Integer.toString(num));
+ throw new RuntimeException ("Negative syscall number: " + num);
}
else if (num >= syscallList.length)
{
- synchronized (Syscall.class)
+ synchronized (unknownSyscalls)
{
Integer key = new Integer(num);
- if (unknownSyscalls == null)
- unknownSyscalls = new HashMap();
- else if (unknownSyscalls.containsKey(key))
+ if (unknownSyscalls.containsKey(key))
return (Syscall) unknownSyscalls.get(key);
class UnknownSyscall
And here:
@@ -327,9 +324,9 @@
{
syscall = task.getIsa().syscallByName(name);
}
- catch (Exception e)
+ catch (TaskException e)
{
- throw new RuntimeException ("Could not get the name of isa");
+ throw new RuntimeException ("Could not get the name of isa", e);
}
return syscall;
This exception will stop the event loop for implementing clients (and as
the exception is unchecked, very hard to check on the severity). Would
it be better to return null in these places instead of completely
aborting with a throw?
Regards
Phil