Change the --track-fds code to use VG_AR_CORE rather than
VG_(malloc)/(strdup), which puts things into VG_AR_SKIN.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2117 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c
index 1fe9d97..5931db9 100644
--- a/coregrind/vg_mylibc.c
+++ b/coregrind/vg_mylibc.c
@@ -968,8 +968,15 @@
 __inline__ Char* VG_(arena_strdup) ( ArenaId aid, const Char* s )
 {
    Int   i;
-   Int   len = VG_(strlen)(s) + 1;
-   Char* res = VG_(arena_malloc) (aid, len);
+   Int   len;
+   Char* res;
+
+   if (s == NULL)
+      return NULL;
+
+   len = VG_(strlen)(s) + 1;
+   res = VG_(arena_malloc) (aid, len);
+
    for (i = 0; i < len; i++)
       res[i] = s[i];
    return res;
diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c
index 44a8f0c..0d16dc1 100644
--- a/coregrind/vg_syscalls.c
+++ b/coregrind/vg_syscalls.c
@@ -291,7 +291,7 @@
    if(VG_(readlink)(tmp, buf, PATH_MAX) == -1)
       return NULL;
 
-   return ((buf[0] == '/') ? VG_(strdup)(buf) : NULL);
+   return ((buf[0] == '/') ? VG_(arena_strdup)(VG_AR_CORE, buf) : NULL);
 }
 
 
@@ -311,8 +311,8 @@
          if(i->next)
             i->next->prev = i->prev;
          if(i->pathname) 
-            VG_(free) (i->pathname);
-         VG_(free) (i);
+            VG_(arena_free) (VG_AR_CORE, i->pathname);
+         VG_(arena_free) (VG_AR_CORE, i);
          fd_count--;
          break;
       }
@@ -339,7 +339,7 @@
    i = allocated_fds;
    while (i) {
       if (i->fd == fd) {
-         if (i->pathname) VG_(free)(i->pathname);
+         if (i->pathname) VG_(arena_free)(VG_AR_CORE, i->pathname);
          break;
       }
       i = i->next;
@@ -347,7 +347,7 @@
 
    /* Not already one: allocate an OpenFd */
    if (i == NULL) {
-      i = VG_(malloc)(sizeof(OpenFd));
+      i = VG_(arena_malloc)(VG_AR_CORE, sizeof(OpenFd));
 
       i->prev = NULL;
       i->next = allocated_fds;
@@ -3350,7 +3350,7 @@
       res = -VKI_EMFILE;
    } else {
       if(VG_(clo_track_fds))
-         record_fd_open(tid, res, VG_(strdup)((Char*)arg1));
+         record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1));
    }
    MAYBE_PRINTF("%d\n",res);
 }
@@ -3394,7 +3394,7 @@
       res = -VKI_EMFILE;
    } else {
       if(VG_(clo_track_fds))
-         record_fd_open(tid, res, VG_(strdup)((Char*)arg1));
+         record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1));
    }
    MAYBE_PRINTF("%d\n",res);
 }