|
From: Jeremy F. <je...@go...> - 2003-12-16 01:49:27
|
CVS commit by fitzhardinge:
Change the --track-fds code to use VG_AR_CORE rather than
VG_(malloc)/(strdup), which puts things into VG_AR_SKIN.
M +9 -2 vg_mylibc.c 1.59
M +7 -7 vg_syscalls.c 1.66
--- valgrind/coregrind/vg_mylibc.c #1.58:1.59
@@ -969,6 +969,13 @@ __inline__ Char* VG_(arena_strdup) ( Are
{
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];
--- valgrind/coregrind/vg_syscalls.c #1.65:1.66
@@ -292,5 +292,5 @@ Char *resolve_fname(Int fd)
return NULL;
- return ((buf[0] == '/') ? VG_(strdup)(buf) : NULL);
+ return ((buf[0] == '/') ? VG_(arena_strdup)(VG_AR_CORE, buf) : NULL);
}
@@ -312,6 +312,6 @@ void record_fd_close(Int tid, Int fd)
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;
@@ -340,5 +340,5 @@ void record_fd_open(Int tid, Int fd, cha
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;
}
@@ -348,5 +348,5 @@ void record_fd_open(Int tid, Int fd, cha
/* 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;
@@ -3351,5 +3351,5 @@ POST(open)
} 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);
@@ -3395,5 +3395,5 @@ POST(creat)
} 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);
|