|
From: <sv...@va...> - 2007-07-10 00:18:50
|
Author: sewardj
Date: 2007-07-10 01:18:46 +0100 (Tue, 10 Jul 2007)
New Revision: 6765
Log:
All platforms: make it clearer that missing syscalls constitute
reportable bugs.
AIX only: print name of missing syscall as well as number -- important
because there is no fixed name/number binding.
Modified:
trunk/coregrind/m_syswrap/syswrap-main.c
trunk/coregrind/m_vkiscnums.c
trunk/coregrind/pub_core_vkiscnums.h
Modified: trunk/coregrind/m_syswrap/syswrap-main.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-main.c 2007-07-09 23:13:07 UTC (rev 6764)
+++ trunk/coregrind/m_syswrap/syswrap-main.c 2007-07-10 00:18:46 UTC (rev 6765)
@@ -682,6 +682,11 @@
{
VG_(message)
(Vg_DebugMsg,"WARNING: unhandled syscall: %llu", (ULong)args->sysno);
+# if defined(VGO_aix5)
+ VG_(message)
+ (Vg_DebugMsg," name of syscall: \"%s\"",
+ VG_(aix5_sysno_to_sysname)(args->sysno));
+# endif
if (VG_(clo_verbosity) > 1) {
VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
}
@@ -689,6 +694,10 @@
(Vg_DebugMsg,"You may be able to write your own handler.");
VG_(message)
(Vg_DebugMsg,"Read the file README_MISSING_SYSCALL_OR_IOCTL.");
+ VG_(message)
+ (Vg_DebugMsg,"Nevertheless we consider this a bug. Please report");
+ VG_(message)
+ (Vg_DebugMsg,"it at http://valgrind.org/support/bug_reports.html.");
SET_STATUS_Failure(VKI_ENOSYS);
}
Modified: trunk/coregrind/m_vkiscnums.c
===================================================================
--- trunk/coregrind/m_vkiscnums.c 2007-07-09 23:13:07 UTC (rev 6764)
+++ trunk/coregrind/m_vkiscnums.c 2007-07-10 00:18:46 UTC (rev 6765)
@@ -563,17 +563,28 @@
Int VG_(aix5_NR_FAKE_SIGRETURN) = __NR_AIX5_UNKNOWN;
-static Bool local_streq ( UChar* s1, UChar* s2 )
-{
- while (True) {
- if (*s1 == 0 && *s2 == 0) return True;
- if (*s1 == 0) return False;
- if (*s2 == 0) return False;
- if (*s1 != *s2) return False;
- s1++; s2++;
- }
+
+/* Also make a record of the registered syscalls, so we can print the
+ name in bad_before() (syswrap-main.c) if needed. The obvious
+ approach would be to dump them in an XArray, but that requires
+ dynamic memory allocation, and syscall registration is done before
+ dynamic memory allocation is available. So just use a fixed size
+ array and hope it doesn't fill up. */
+#define N_BINDINGS 2000
+static Int bindings_used = 0;
+static Int bindings_sysno[N_BINDINGS];
+static UChar* bindings_sysname[N_BINDINGS];
+
+UChar* VG_(aix5_sysno_to_sysname)( Int sysno ) {
+ Int i;
+ for (i = 0; i < bindings_used; i++)
+ if (bindings_sysno[i] == sysno)
+ return bindings_sysname[i];
+ return "(unknown name)";
}
+static Bool local_streq ( UChar* s1, UChar* s2 ); /* fwds */
+
Bool VG_(aix5_register_syscall)( Int sysno, UChar* sysname )
{
/* Establish the FAKE_SIGRETURN number. */
@@ -581,8 +592,15 @@
VG_(aix5_NR_FAKE_SIGRETURN) = sysno + 10000;
else
if (sysno + 10000 > VG_(aix5_NR_FAKE_SIGRETURN))
- VG_(aix5_NR_FAKE_SIGRETURN) = sysno + 10000;
+ VG_(aix5_NR_FAKE_SIGRETURN) = sysno + 10000;
+ /* Note the name, just in case bad_before() needs to complain. */
+ if (bindings_used < N_BINDINGS) {
+ bindings_sysno[bindings_used] = sysno;
+ bindings_sysname[bindings_used] = sysname;
+ bindings_used++;
+ }
+
/* Now do the normal name-to-number binding checks. */
# define XXX(name) \
if (local_streq(sysname, #name)) { \
@@ -1092,6 +1110,18 @@
return False;
}
+
+static Bool local_streq ( UChar* s1, UChar* s2 )
+{
+ while (True) {
+ if (*s1 == 0 && *s2 == 0) return True;
+ if (*s1 == 0) return False;
+ if (*s2 == 0) return False;
+ if (*s1 != *s2) return False;
+ s1++; s2++;
+ }
+}
+
#endif /* defined(VGO_aix5) */
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/pub_core_vkiscnums.h
===================================================================
--- trunk/coregrind/pub_core_vkiscnums.h 2007-07-09 23:13:07 UTC (rev 6764)
+++ trunk/coregrind/pub_core_vkiscnums.h 2007-07-10 00:18:46 UTC (rev 6765)
@@ -51,6 +51,9 @@
/* Bind the given syscall name to the given number. Returns True if
successful, False if the name is unknown. */
extern Bool VG_(aix5_register_syscall)( Int, UChar* );
+/* Look up in said binding later, for the purposes of making error
+ messages. */
+extern UChar* VG_(aix5_sysno_to_sysname)( Int sysno );
#endif
#endif /* !defined(VG_IN_ASSEMBLY_SOURCE) */
|