This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch dj/malloc updated. glibc-2.23-552-gfcf17bd


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, dj/malloc has been updated
       via  fcf17bd0d948d19c84ab72ba0a57688f4533327d (commit)
      from  0eacff38a33d1d8e0f2899f53422c567061cc075 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fcf17bd0d948d19c84ab72ba0a57688f4533327d

commit fcf17bd0d948d19c84ab72ba0a57688f4533327d
Author: DJ Delorie <dj@delorie.com>
Date:   Fri Jul 15 18:26:14 2016 -0400

    Fix NULL return value handling
    
    Decided that a call that returns NULL should be encoded in the
    workload but that the simulator should just skip those calls,
    rather than skip them in the converter.

diff --git a/malloc/trace2wl.cc b/malloc/trace2wl.cc
index aa53fb3..5fe7b55 100644
--- a/malloc/trace2wl.cc
+++ b/malloc/trace2wl.cc
@@ -276,14 +276,17 @@ main(int argc, char **argv)
 	case __MTB_TYPE_MALLOC:
 	case __MTB_TYPE_CALLOC:
 	  acq_ptr (thread, pa2);
-	  if (pa2->valid)
+	  if (pa2 && pa2->valid)
 	    printf ("%d: pointer %p malloc'd again?  %d:%s\n", i, pa2->ptr, pa2->reason_idx, pa2->reason);
 	  thread->add (r->type == __MTB_TYPE_MALLOC ? C_MALLOC : C_CALLOC);
-	  thread->add_int (pa2->idx);
+	  thread->add_int (pa2 ? pa2->idx : 0);
 	  thread->add_int (r->size);
-	  pa2->valid = 1;
-	  pa2->reason = "malloc";
-	  pa2->reason_idx = i;
+	  if (pa2)
+	    {
+	      pa2->valid = 1;
+	      pa2->reason = "malloc";
+	      pa2->reason_idx = i;
+	    }
 	  break;
 
 	case __MTB_TYPE_FREE:
diff --git a/malloc/trace_run.c b/malloc/trace_run.c
index a42e81d..e64b189 100644
--- a/malloc/trace_run.c
+++ b/malloc/trace_run.c
@@ -242,6 +242,9 @@ thread_common (void *my_data_v)
 	  p2 = get_int (&cp);
 	  sz = get_int (&cp);
 	  dprintf("op %d:%ld %ld = MALLOC %ld\n", (int)me, cp-data, p2, sz);
+	  /* we can't force malloc to return NULL (fail), so just skip it.  */
+	  if (p2 == 0)
+	    break;
 	  if (p2 > n_ptrs)
 	    myabort();
 	  stime = rdtsc_s();
@@ -271,6 +274,9 @@ thread_common (void *my_data_v)
 	  p2 = get_int (&cp);
 	  sz = get_int (&cp);
 	  dprintf("op %d:%ld %ld = CALLOC %ld\n", (int)me, cp-data, p2, sz);
+	  /* we can't force calloc to return NULL (fail), so just skip it.  */
+	  if (p2 == 0)
+	    break;
 	  if (p2 > n_ptrs)
 	    myabort();
 	  if (ptrs[p2])
@@ -303,6 +309,16 @@ thread_common (void *my_data_v)
 	  if (ptrs[p1])
 	    atomic_rss (-sizes[p1]);
 	  free_wipe(p1);
+	  /* we can't force realloc to return NULL (fail), so just skip it.  */
+	  if (p2 == 0)
+	    {
+	      if (p1)
+		{
+		  free ((void *)ptrs[p1]);
+		  ptrs[p1] = 0;
+		}
+	      break;
+	    }
 	  stime = rdtsc_s();
 	  Q1;
 #ifdef MDEBUG

-----------------------------------------------------------------------

Summary of changes:
 malloc/trace2wl.cc |   13 ++++++++-----
 malloc/trace_run.c |   16 ++++++++++++++++
 2 files changed, 24 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]