]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
All platforms: make it clearer that missing syscalls constitute
authorJulian Seward <jseward@acm.org>
Tue, 10 Jul 2007 00:18:46 +0000 (00:18 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 10 Jul 2007 00:18:46 +0000 (00:18 +0000)
reportable bugs.

AIX only: print name of missing syscall as well as number -- important
because there is no fixed name/number binding.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6765

coregrind/m_syswrap/syswrap-main.c
coregrind/m_vkiscnums.c
coregrind/pub_core_vkiscnums.h

index 21f3a35c5360d0d89377cb900969f05754450429..9e8a92ee7f10bc93a29d9fb99f877b3a6d262e66 100644 (file)
@@ -682,6 +682,11 @@ void bad_before ( ThreadId              tid,
 {
    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 @@ void bad_before ( ThreadId              tid,
       (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);
 }
index 40ae70cd4e0ac8014bb95322d3893d6a690eba05..ca83319ea70daf67573f07cdeb45bad8d6e811c0 100644 (file)
@@ -563,17 +563,28 @@ Int VG_(aix5_NR_kunload64) = __NR_AIX5_UNKNOWN;
 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,7 +592,14 @@ Bool VG_(aix5_register_syscall)( Int sysno, UChar* sysname )
       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)                            \
@@ -1092,6 +1110,18 @@ Bool VG_(aix5_register_syscall)( Int sysno, UChar* sysname )
    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) */
 
 /*--------------------------------------------------------------------*/
index 29ace099c15e0d092bf9f408392d4e2b5396b93e..1b3a61581dfceb153366ad38a4bf402a6b7973ad 100644 (file)
@@ -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) */