Improved Memcheck's error checking messages in two significant ways:

- All memory-related errors are now clear whether they are caused by
  unaddressable or uninitialised memory.  (Previously, writes were
  clearly addressability errors, but reads could be either.)  Mostly
  done by replacing the 'isWrite' field in MAC_Error with 'isUnaddr'.
  Also, mc_check_readable() now indicates not just if an error occurred,
  but what kind of error (ie. addressability or definedness).

- Put machinery into place in the core to inform tools when registers
  are being read by the core -- ie. a 'pre_reg_read' event.  Most
  notably, this facilitates syscall scalar arg definedness checking for
  Memcheck.  Currently this is only working for read(), write(), exit()
  and exit_group(), but it will be extended as the syscalls are
  overhauled as part of the arch-abstraction work.

  A consequence of this is that the ParamErr messages have changed.  This:

    Syscall param write(buf) contains uninitialised byte(s)

  now means that the pointer 'buf' is partially undefined.  If the memory
  pointed to by 'buf' is partially undefined or unaddressable, it says one of:

    Syscall param write(buf) points to uninitialised byte(s)
    Syscall param write(buf) points to unaddressable byte(s)

  The docs have been updated accordingly.

  I also added a couple of regression tests.

These two change sare notable for being the first improvements to
Memcheck's checking/errors in a long time.

I also folded mc_clientreqs.c into mc_main.c, which saves exporting a
whole bunch of things that are not used anywhere else.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2949 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/mac_shared.h b/memcheck/mac_shared.h
index 922c34c..9d6e80f 100644
--- a/memcheck/mac_shared.h
+++ b/memcheck/mac_shared.h
@@ -47,12 +47,13 @@
 /* The classification of a faulting address. */
 typedef 
    enum { 
-      Undescribed,  /* as-yet unclassified */
+      Undescribed,   // as-yet unclassified
       Stack, 
-      Unknown,      /* classification yielded nothing useful */
+      Unknown,       // classification yielded nothing useful
       Freed, Mallocd, 
-      UserG,        /* in a user-defined block; Addrcheck & Memcheck only */
-      Mempool,      /* in a mempool; Addrcheck & Memcheck only */
+      UserG,         // in a user-defined block
+      Mempool,       // in a mempool
+      Register,      // in a register;  for Param errors only
    }
    AddrKind;
 
@@ -61,7 +62,7 @@
    struct {                   // Used by:
       AddrKind akind;         //   ALL
       SizeT blksize;          //   Freed, Mallocd
-      SSizeT rwoffset;        //   Freed, Mallocd
+      OffT rwoffset;          //   Freed, Mallocd
       ExeContext* lastchange; //   Freed, Mallocd
       ThreadId stack_tid;     //   Stack
       Bool maybe_gcc;         // True if just below %esp -- could be a gcc bug.
@@ -110,7 +111,7 @@
       AxsKind axskind;     //   AddrErr
       Int size;            //   AddrErr, ValueErr
       AddrInfo addrinfo;   //   {Addr,Free,FreeMismatch,Param,User}Err
-      Bool isWrite;        //   ParamErr, UserErr, CoreMemErr
+      Bool isUnaddr;       //   {CoreMem,Param,User}Err
    }
    MAC_Error;
 
@@ -316,10 +317,10 @@
 
 extern void MAC_(record_address_error)     ( ThreadId tid, Addr a,
                                              Int size, Bool isWrite );
-extern void MAC_(record_core_mem_error)    ( ThreadId tid, Bool isWrite,
+extern void MAC_(record_core_mem_error)    ( ThreadId tid, Bool isUnaddr,
                                              Char* s );
-extern void MAC_(record_param_error)       ( ThreadId tid, Addr a,   
-                                             Bool isWriteLack, Char* msg );
+extern void MAC_(record_param_error)       ( ThreadId tid, Addr a, Bool isReg,
+                                             Bool isUnaddr, Char* msg );
 extern void MAC_(record_jump_error)        ( ThreadId tid, Addr a );
 extern void MAC_(record_free_error)        ( ThreadId tid, Addr a );
 extern void MAC_(record_freemismatch_error)( ThreadId tid, Addr a );