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
This commit is contained in:
Jeremy Fitzhardinge 2003-12-16 01:48:38 +00:00
parent 7a664bc301
commit 6d535b779d
2 changed files with 16 additions and 9 deletions

View File

@ -968,8 +968,15 @@ Char VG_(toupper) ( Char c )
__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;

View File

@ -291,7 +291,7 @@ Char *resolve_fname(Int fd)
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 @@ void record_fd_close(Int tid, Int fd)
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 @@ void record_fd_open(Int tid, Int fd, char *pathname)
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 @@ void record_fd_open(Int tid, Int fd, char *pathname)
/* 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 @@ POST(open)
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 @@ POST(creat)
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);
}