- Reindented code such that it uses three spaces for indentation instead
  of two. The indentation of the DRD source code is now consistent with
  the other Valgrind source files.
- Added emacs mode line with indentation settings.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9496 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_main.c b/drd/drd_main.c
index f580a82..b37dfce 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -1,3 +1,4 @@
+/* -*- mode: C; c-basic-offset: 3; -*- */
 /*
   This file is part of drd, a thread error detector.
 
@@ -64,102 +65,103 @@
  */
 static Bool DRD_(process_cmd_line_option)(Char* arg)
 {
-  int check_stack_accesses   = -1;
-  int exclusive_threshold_ms = -1;
-  int report_signal_unlocked = -1;
-  int segment_merging        = -1;
-  int shared_threshold_ms    = -1;
-  int show_confl_seg         = -1;
-  int trace_barrier          = -1;
-  int trace_clientobj        = -1;
-  int trace_cond             = -1;
-  int trace_csw              = -1;
-  int trace_fork_join        = -1;
-  int trace_conflict_set     = -1;
-  int trace_mutex            = -1;
-  int trace_rwlock           = -1;
-  int trace_segment          = -1;
-  int trace_semaphore        = -1;
-  int trace_suppression      = -1;
-  Char* trace_address        = 0;
+   int check_stack_accesses   = -1;
+   int exclusive_threshold_ms = -1;
+   int report_signal_unlocked = -1;
+   int segment_merging        = -1;
+   int shared_threshold_ms    = -1;
+   int show_confl_seg         = -1;
+   int trace_barrier          = -1;
+   int trace_clientobj        = -1;
+   int trace_cond             = -1;
+   int trace_csw              = -1;
+   int trace_fork_join        = -1;
+   int trace_conflict_set     = -1;
+   int trace_mutex            = -1;
+   int trace_rwlock           = -1;
+   int trace_segment          = -1;
+   int trace_semaphore        = -1;
+   int trace_suppression      = -1;
+   Char* trace_address        = 0;
 
-  if     VG_BOOL_CLO(arg, "--check-stack-var",     check_stack_accesses) {}
-  else if VG_BOOL_CLO(arg, "--drd-stats",           DRD_(s_print_stats)) {}
-  else if VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked) {}
-  else if VG_BOOL_CLO(arg, "--segment-merging",     segment_merging) {}
-  else if VG_BOOL_CLO(arg, "--show-confl-seg",      show_confl_seg) {}
-  else if VG_BOOL_CLO(arg, "--show-stack-usage",    DRD_(s_show_stack_usage)) {}
-  else if VG_BOOL_CLO(arg, "--trace-barrier",       trace_barrier) {}
-  else if VG_BOOL_CLO(arg, "--trace-clientobj",     trace_clientobj) {}
-  else if VG_BOOL_CLO(arg, "--trace-cond",          trace_cond) {}
-  else if VG_BOOL_CLO(arg, "--trace-conflict-set",  trace_conflict_set) {}
-  else if VG_BOOL_CLO(arg, "--trace-csw",           trace_csw) {}
-  else if VG_BOOL_CLO(arg, "--trace-fork-join",     trace_fork_join) {}
-  else if VG_BOOL_CLO(arg, "--trace-mutex",         trace_mutex) {}
-  else if VG_BOOL_CLO(arg, "--trace-rwlock",        trace_rwlock) {}
-  else if VG_BOOL_CLO(arg, "--trace-segment",       trace_segment) {}
-  else if VG_BOOL_CLO(arg, "--trace-semaphore",     trace_semaphore) {}
-  else if VG_BOOL_CLO(arg, "--trace-suppr",         trace_suppression) {}
-  else if VG_BOOL_CLO(arg, "--var-info",            DRD_(s_var_info)) {}
-  else if VG_INT_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms) {}
-  else if VG_INT_CLO (arg, "--shared-threshold",    shared_threshold_ms)    {}
-  else if VG_STR_CLO (arg, "--trace-addr",          trace_address) {}
-  else
-    return VG_(replacement_malloc_process_cmd_line_option)(arg);
+   if      VG_BOOL_CLO(arg, "--check-stack-var",     check_stack_accesses) {}
+   else if VG_BOOL_CLO(arg, "--drd-stats",           DRD_(s_print_stats)) {}
+   else if VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked) {}
+   else if VG_BOOL_CLO(arg, "--segment-merging",     segment_merging) {}
+   else if VG_BOOL_CLO(arg, "--show-confl-seg",      show_confl_seg) {}
+   else if VG_BOOL_CLO(arg, "--show-stack-usage",
+                       DRD_(s_show_stack_usage)) {}
+   else if VG_BOOL_CLO(arg, "--trace-barrier",       trace_barrier) {}
+   else if VG_BOOL_CLO(arg, "--trace-clientobj",     trace_clientobj) {}
+   else if VG_BOOL_CLO(arg, "--trace-cond",          trace_cond) {}
+   else if VG_BOOL_CLO(arg, "--trace-conflict-set",  trace_conflict_set) {}
+   else if VG_BOOL_CLO(arg, "--trace-csw",           trace_csw) {}
+   else if VG_BOOL_CLO(arg, "--trace-fork-join",     trace_fork_join) {}
+   else if VG_BOOL_CLO(arg, "--trace-mutex",         trace_mutex) {}
+   else if VG_BOOL_CLO(arg, "--trace-rwlock",        trace_rwlock) {}
+   else if VG_BOOL_CLO(arg, "--trace-segment",       trace_segment) {}
+   else if VG_BOOL_CLO(arg, "--trace-semaphore",     trace_semaphore) {}
+   else if VG_BOOL_CLO(arg, "--trace-suppr",         trace_suppression) {}
+   else if VG_BOOL_CLO(arg, "--var-info",            DRD_(s_var_info)) {}
+   else if VG_INT_CLO (arg, "--exclusive-threshold", exclusive_threshold_ms) {}
+   else if VG_INT_CLO (arg, "--shared-threshold",    shared_threshold_ms)    {}
+   else if VG_STR_CLO (arg, "--trace-addr",          trace_address) {}
+   else
+      return VG_(replacement_malloc_process_cmd_line_option)(arg);
 
-  if (check_stack_accesses != -1)
-    DRD_(set_check_stack_accesses)(check_stack_accesses);
-  if (exclusive_threshold_ms != -1)
-  {
-    DRD_(mutex_set_lock_threshold)(exclusive_threshold_ms);
-    DRD_(rwlock_set_exclusive_threshold)(exclusive_threshold_ms);
-  }
-  if (report_signal_unlocked != -1)
-  {
-    DRD_(cond_set_report_signal_unlocked)(report_signal_unlocked);
-  }
-  if (shared_threshold_ms != -1)
-  {
-    DRD_(rwlock_set_shared_threshold)(shared_threshold_ms);
-  }
-  if (segment_merging != -1)
-    DRD_(thread_set_segment_merging)(segment_merging);
-  if (show_confl_seg != -1)
-    DRD_(set_show_conflicting_segments)(show_confl_seg);
-  if (trace_address)
-  {
-    const Addr addr = VG_(strtoll16)(trace_address, 0);
-    DRD_(start_tracing_address_range)(addr, addr + 1);
-  }
-  if (trace_barrier != -1)
-    DRD_(barrier_set_trace)(trace_barrier);
-  if (trace_clientobj != -1)
-    DRD_(clientobj_set_trace)(trace_clientobj);
-  if (trace_cond != -1)
-    DRD_(cond_set_trace)(trace_cond);
-  if (trace_csw != -1)
-    DRD_(thread_trace_context_switches)(trace_csw);
-  if (trace_fork_join != -1)
-    DRD_(thread_set_trace_fork_join)(trace_fork_join);
-  if (trace_conflict_set != -1)
-    DRD_(thread_trace_conflict_set)(trace_conflict_set);
-  if (trace_mutex != -1)
-    DRD_(mutex_set_trace)(trace_mutex);
-  if (trace_rwlock != -1)
-    DRD_(rwlock_set_trace)(trace_rwlock);
-  if (trace_segment != -1)
-    DRD_(sg_set_trace)(trace_segment);
-  if (trace_semaphore != -1)
-    DRD_(semaphore_set_trace)(trace_semaphore);
-  if (trace_suppression != -1)
-    DRD_(suppression_set_trace)(trace_suppression);
+   if (check_stack_accesses != -1)
+      DRD_(set_check_stack_accesses)(check_stack_accesses);
+   if (exclusive_threshold_ms != -1)
+   {
+      DRD_(mutex_set_lock_threshold)(exclusive_threshold_ms);
+      DRD_(rwlock_set_exclusive_threshold)(exclusive_threshold_ms);
+   }
+   if (report_signal_unlocked != -1)
+   {
+      DRD_(cond_set_report_signal_unlocked)(report_signal_unlocked);
+   }
+   if (shared_threshold_ms != -1)
+   {
+      DRD_(rwlock_set_shared_threshold)(shared_threshold_ms);
+   }
+   if (segment_merging != -1)
+      DRD_(thread_set_segment_merging)(segment_merging);
+   if (show_confl_seg != -1)
+      DRD_(set_show_conflicting_segments)(show_confl_seg);
+   if (trace_address)
+   {
+      const Addr addr = VG_(strtoll16)(trace_address, 0);
+      DRD_(start_tracing_address_range)(addr, addr + 1);
+   }
+   if (trace_barrier != -1)
+      DRD_(barrier_set_trace)(trace_barrier);
+   if (trace_clientobj != -1)
+      DRD_(clientobj_set_trace)(trace_clientobj);
+   if (trace_cond != -1)
+      DRD_(cond_set_trace)(trace_cond);
+   if (trace_csw != -1)
+      DRD_(thread_trace_context_switches)(trace_csw);
+   if (trace_fork_join != -1)
+      DRD_(thread_set_trace_fork_join)(trace_fork_join);
+   if (trace_conflict_set != -1)
+      DRD_(thread_trace_conflict_set)(trace_conflict_set);
+   if (trace_mutex != -1)
+      DRD_(mutex_set_trace)(trace_mutex);
+   if (trace_rwlock != -1)
+      DRD_(rwlock_set_trace)(trace_rwlock);
+   if (trace_segment != -1)
+      DRD_(sg_set_trace)(trace_segment);
+   if (trace_semaphore != -1)
+      DRD_(semaphore_set_trace)(trace_semaphore);
+   if (trace_suppression != -1)
+      DRD_(suppression_set_trace)(trace_suppression);
 
-  return True;
+   return True;
 }
 
 static void DRD_(print_usage)(void)
 {
-  VG_(printf)(
+   VG_(printf)(
 "    --check-stack-var=yes|no  Whether or not to report data races on\n"
 "                              stack variables [no].\n"
 "    --exclusive-threshold=<n> Print an error message if any mutex or\n"
@@ -192,20 +194,20 @@
 "    --trace-mutex=yes|no      Trace all mutex activity [no].\n"
 "    --trace-rwlock=yes|no     Trace all reader-writer lock activity[no].\n"
 "    --trace-semaphore=yes|no  Trace all semaphore activity [no].\n"
-              );
+);
    VG_(replacement_malloc_print_usage)();
 }
 
 static void DRD_(print_debug_usage)(void)
 {  
-  VG_(printf)(
+   VG_(printf)(
 "    --drd-stats=yes|no        Print statistics about DRD activity [no].\n"
 "    --trace-clientobj=yes|no  Trace all client object activity [no].\n"
 "    --trace-csw=yes|no        Trace all scheduler context switches [no].\n"
 "    --trace-conflict-set=yes|no Trace all conflict set updates [no].\n"
 "    --trace-segment=yes|no    Trace segment actions [no].\n"
 "    --trace-suppr=yes|no      Trace all address suppression actions [no].\n"
-              );
+);
    VG_(replacement_malloc_print_debug_usage)();
 }
 
@@ -220,10 +222,10 @@
                              const Addr a,
                              const SizeT size)
 {
-  if (size > 0)
-  {
-    DRD_(trace_load)(a, size);
-  }
+   if (size > 0)
+   {
+      DRD_(trace_load)(a, size);
+   }
 }
 
 static void drd_pre_mem_read_asciiz(const CorePart part,
@@ -231,22 +233,22 @@
                                     Char* const s,
                                     const Addr a)
 {
-  const char* p = (void*)a;
-  SizeT size = 0;
+   const char* p = (void*)a;
+   SizeT size = 0;
 
-  /* Note: the expression '*p' reads client memory and may crash if the */
-  /* client provided an invalid pointer !                               */
-  while (*p)
-  {
-    p++;
-    size++;
-  }
-  // To do: find out what a reasonable upper limit on 'size' is.
-  tl_assert(size < 4096);
-  if (size > 0)
-  {
-    DRD_(trace_load)(a, size);
-  }
+   /* Note: the expression '*p' reads client memory and may crash if the */
+   /* client provided an invalid pointer !                               */
+   while (*p)
+   {
+      p++;
+      size++;
+   }
+   // To do: find out what a reasonable upper limit on 'size' is.
+   tl_assert(size < 4096);
+   if (size > 0)
+   {
+      DRD_(trace_load)(a, size);
+   }
 }
 
 static void drd_post_mem_write(const CorePart part,
@@ -254,62 +256,62 @@
                                const Addr a,
                                const SizeT size)
 {
-  DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
-  if (size > 0)
-  {
-    DRD_(trace_store)(a, size);
-  }
+   DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
+   if (size > 0)
+   {
+      DRD_(trace_store)(a, size);
+   }
 }
 
 static __inline__
 void drd_start_using_mem(const Addr a1, const SizeT len)
 {
-  tl_assert(a1 < a1 + len);
+   tl_assert(a1 < a1 + len);
 
-  if (UNLIKELY(DRD_(any_address_is_traced)()))
-  {
-    DRD_(trace_mem_access)(a1, len, eStart);
-  }
+   if (UNLIKELY(DRD_(any_address_is_traced)()))
+   {
+      DRD_(trace_mem_access)(a1, len, eStart);
+   }
 }
 
 static void drd_start_using_mem_w_ecu(const Addr a1,
                                       const SizeT len,
                                       UInt ec_uniq)
 {
-  drd_start_using_mem(a1, len);
+   drd_start_using_mem(a1, len);
 }
 
 static void drd_start_using_mem_w_tid(const Addr a1,
                                       const SizeT len,
                                       ThreadId tid)
 {
-  drd_start_using_mem(a1, len);
+   drd_start_using_mem(a1, len);
 }
 
 static __inline__
 void drd_stop_using_mem(const Addr a1, const SizeT len,
                         const Bool is_stack_mem)
 {
-  const Addr a2 = a1 + len;
+   const Addr a2 = a1 + len;
 
-  tl_assert(a1 < a2);
+   tl_assert(a1 < a2);
 
-  if (UNLIKELY(DRD_(any_address_is_traced)()))
-  {
-    DRD_(trace_mem_access)(a1, len, eEnd);
-  }
-  if (! is_stack_mem || DRD_(get_check_stack_accesses)())
-  {
-    DRD_(thread_stop_using_mem)(a1, a2);
-    DRD_(clientobj_stop_using_mem)(a1, a2);
-    DRD_(suppression_stop_using_mem)(a1, a2);
-  }
+   if (UNLIKELY(DRD_(any_address_is_traced)()))
+   {
+      DRD_(trace_mem_access)(a1, len, eEnd);
+   }
+   if (! is_stack_mem || DRD_(get_check_stack_accesses)())
+   {
+      DRD_(thread_stop_using_mem)(a1, a2);
+      DRD_(clientobj_stop_using_mem)(a1, a2);
+      DRD_(suppression_stop_using_mem)(a1, a2);
+   }
 }
 
 static __inline__
 void drd_stop_using_nonstack_mem(const Addr a1, const SizeT len)
 {
-  drd_stop_using_mem(a1, len, False);
+   drd_stop_using_mem(a1, len, False);
 }
 
 /**
@@ -318,9 +320,9 @@
  */
 void DRD_(clean_memory)(const Addr a1, const SizeT len)
 {
-  const Bool is_stack_memory = DRD_(thread_address_on_any_stack)(a1);
-  drd_stop_using_mem(a1, len, is_stack_memory);
-  drd_start_using_mem(a1, len);
+   const Bool is_stack_memory = DRD_(thread_address_on_any_stack)(a1);
+   drd_stop_using_mem(a1, len, is_stack_memory);
+   drd_start_using_mem(a1, len);
 }
 
 /**
@@ -335,41 +337,41 @@
  */
 static void DRD_(suppress_relocation_conflicts)(const Addr a, const SizeT len)
 {
-  const DebugInfo* di;
+   const DebugInfo* di;
 
 #if 0
-  VG_(printf)("Evaluating range @ 0x%lx size %ld\n", a, len);
+   VG_(printf)("Evaluating range @ 0x%lx size %ld\n", a, len);
 #endif
 
-  for (di = VG_(next_seginfo)(0); di; di = VG_(next_seginfo)(di))
-  {
-    Addr  avma;
-    SizeT size;
+   for (di = VG_(next_seginfo)(0); di; di = VG_(next_seginfo)(di))
+   {
+      Addr  avma;
+      SizeT size;
 
-    avma = VG_(seginfo_get_plt_avma)(di);
-    size = VG_(seginfo_get_plt_size)(di);
-    tl_assert((avma && size) || (avma == 0 && size == 0));
-    if (size > 0)
-    {
+      avma = VG_(seginfo_get_plt_avma)(di);
+      size = VG_(seginfo_get_plt_size)(di);
+      tl_assert((avma && size) || (avma == 0 && size == 0));
+      if (size > 0)
+      {
 #if 0
-      VG_(printf)("Suppressing .plt @ 0x%lx size %ld\n", avma, size);
+         VG_(printf)("Suppressing .plt @ 0x%lx size %ld\n", avma, size);
 #endif
-      tl_assert(VG_(seginfo_sect_kind)(NULL, 0, avma) == Vg_SectPLT);
-      DRD_(start_suppression)(avma, avma + size, ".plt");
-    }
+         tl_assert(VG_(seginfo_sect_kind)(NULL, 0, avma) == Vg_SectPLT);
+         DRD_(start_suppression)(avma, avma + size, ".plt");
+      }
 
-    avma = VG_(seginfo_get_gotplt_avma)(di);
-    size = VG_(seginfo_get_gotplt_size)(di);
-    tl_assert((avma && size) || (avma == 0 && size == 0));
-    if (size > 0)
-    {
+      avma = VG_(seginfo_get_gotplt_avma)(di);
+      size = VG_(seginfo_get_gotplt_size)(di);
+      tl_assert((avma && size) || (avma == 0 && size == 0));
+      if (size > 0)
+      {
 #if 0
-      VG_(printf)("Suppressing .got.plt @ 0x%lx size %ld\n", avma, size);
+         VG_(printf)("Suppressing .got.plt @ 0x%lx size %ld\n", avma, size);
 #endif
-      tl_assert(VG_(seginfo_sect_kind)(NULL, 0, avma) == Vg_SectGOTPLT);
-      DRD_(start_suppression)(avma, avma + size, ".gotplt");
-    }
-  }
+         tl_assert(VG_(seginfo_sect_kind)(NULL, 0, avma) == Vg_SectGOTPLT);
+         DRD_(start_suppression)(avma, avma + size, ".gotplt");
+      }
+   }
 }
 
 static
@@ -377,11 +379,11 @@
                                  const Bool rr, const Bool ww, const Bool xx,
                                  ULong di_handle)
 {
-  DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
+   DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
 
-  drd_start_using_mem(a, len);
+   drd_start_using_mem(a, len);
 
-  DRD_(suppress_relocation_conflicts)(a, len);
+   DRD_(suppress_relocation_conflicts)(a, len);
 }
 
 /* Called by the core when the stack of a thread grows, to indicate that */
@@ -390,10 +392,10 @@
 static __inline__
 void drd_start_using_mem_stack(const Addr a, const SizeT len)
 {
-  DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(),
-                             a - VG_STACK_REDZONE_SZB);
-  drd_start_using_mem(a - VG_STACK_REDZONE_SZB, 
-                      len + VG_STACK_REDZONE_SZB);
+   DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(),
+                              a - VG_STACK_REDZONE_SZB);
+   drd_start_using_mem(a - VG_STACK_REDZONE_SZB, 
+                       len + VG_STACK_REDZONE_SZB);
 }
 
 /* Called by the core when the stack of a thread shrinks, to indicate that */
@@ -402,41 +404,49 @@
 static __inline__
 void drd_stop_using_mem_stack(const Addr a, const SizeT len)
 {
-  DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(),
-                             a + len - VG_STACK_REDZONE_SZB);
-  drd_stop_using_mem(a - VG_STACK_REDZONE_SZB, len + VG_STACK_REDZONE_SZB,
-                     True);
+   DRD_(thread_set_stack_min)(DRD_(thread_get_running_tid)(),
+                              a + len - VG_STACK_REDZONE_SZB);
+   drd_stop_using_mem(a - VG_STACK_REDZONE_SZB, len + VG_STACK_REDZONE_SZB,
+                      True);
 }
 
-static void drd_start_using_mem_stack_signal(
-               const Addr a, const SizeT len,
-               ThreadId tid_for_whom_the_signal_frame_is_being_constructed)
+/**
+ * Callback function called by the Valgrind core before a stack area is
+ * being used by a signal handler.
+ *
+ * @param[in] a   Start of address range.
+ * @param[in] len Address range length.
+ * @param[in] tid Valgrind thread ID for whom the signal frame is being
+ *                constructed.
+ */
+static void drd_start_using_mem_stack_signal(const Addr a, const SizeT len,
+                                             ThreadId tid)
 {
-  DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
-  drd_start_using_mem(a, len);
+   DRD_(thread_set_vg_running_tid)(VG_(get_running_tid)());
+   drd_start_using_mem(a, len);
 }
 
 static void drd_stop_using_mem_stack_signal(Addr a, SizeT len)
 {
-  drd_stop_using_mem(a, len, True);
+   drd_stop_using_mem(a, len, True);
 }
 
 static
 void drd_pre_thread_create(const ThreadId creator, const ThreadId created)
 {
-  const DrdThreadId drd_creator = DRD_(VgThreadIdToDrdThreadId)(creator);
-  tl_assert(created != VG_INVALID_THREADID);
-  DRD_(thread_pre_create)(drd_creator, created);
-  if (DRD_(IsValidDrdThreadId)(drd_creator))
-  {
-    DRD_(thread_new_segment)(drd_creator);
-  }
-  if (DRD_(thread_get_trace_fork_join)())
-  {
-    VG_(message)(Vg_DebugMsg,
-                 "drd_pre_thread_create creator = %d/%d, created = %d",
-                 creator, drd_creator, created);
-  }
+   const DrdThreadId drd_creator = DRD_(VgThreadIdToDrdThreadId)(creator);
+   tl_assert(created != VG_INVALID_THREADID);
+   DRD_(thread_pre_create)(drd_creator, created);
+   if (DRD_(IsValidDrdThreadId)(drd_creator))
+   {
+      DRD_(thread_new_segment)(drd_creator);
+   }
+   if (DRD_(thread_get_trace_fork_join)())
+   {
+      VG_(message)(Vg_DebugMsg,
+                   "drd_pre_thread_create creator = %d/%d, created = %d",
+                   creator, drd_creator, created);
+   }
 }
 
 /* Called by Valgrind's core before any loads or stores are performed on */
@@ -445,69 +455,69 @@
 static
 void drd_post_thread_create(const ThreadId vg_created)
 {
-  DrdThreadId drd_created;
+   DrdThreadId drd_created;
 
-  tl_assert(vg_created != VG_INVALID_THREADID);
+   tl_assert(vg_created != VG_INVALID_THREADID);
 
-  drd_created = DRD_(thread_post_create)(vg_created);
-  if (DRD_(thread_get_trace_fork_join)())
-  {
-    VG_(message)(Vg_DebugMsg,
-                 "drd_post_thread_create created = %d/%d",
-                 vg_created, drd_created);
-  }
-  if (! DRD_(get_check_stack_accesses)())
-  {
-    DRD_(start_suppression)(DRD_(thread_get_stack_max)(drd_created)
-                            - DRD_(thread_get_stack_size)(drd_created),
-                            DRD_(thread_get_stack_max)(drd_created),
-                            "stack");
-  }
+   drd_created = DRD_(thread_post_create)(vg_created);
+   if (DRD_(thread_get_trace_fork_join)())
+   {
+      VG_(message)(Vg_DebugMsg,
+                   "drd_post_thread_create created = %d/%d",
+                   vg_created, drd_created);
+   }
+   if (! DRD_(get_check_stack_accesses)())
+   {
+      DRD_(start_suppression)(DRD_(thread_get_stack_max)(drd_created)
+                              - DRD_(thread_get_stack_size)(drd_created),
+                              DRD_(thread_get_stack_max)(drd_created),
+                              "stack");
+   }
 }
 
 /* Called after a thread has performed its last memory access. */
 static void drd_thread_finished(ThreadId vg_tid)
 {
-  DrdThreadId drd_tid;
+   DrdThreadId drd_tid;
 
-  tl_assert(VG_(get_running_tid)() == vg_tid);
+   tl_assert(VG_(get_running_tid)() == vg_tid);
 
-  drd_tid = DRD_(VgThreadIdToDrdThreadId)(vg_tid);
-  if (DRD_(thread_get_trace_fork_join)())
-  {
-    VG_(message)(Vg_DebugMsg,
-                 "drd_thread_finished tid = %d/%d%s",
-                 vg_tid,
-                 drd_tid,
-                 DRD_(thread_get_joinable)(drd_tid)
-                 ? ""
-                 : " (which is a detached thread)");
-  }
-  if (DRD_(s_show_stack_usage))
-  {
-    const SizeT stack_size = DRD_(thread_get_stack_size)(drd_tid);
-    const SizeT used_stack
-      = (DRD_(thread_get_stack_max)(drd_tid)
-         - DRD_(thread_get_stack_min_min)(drd_tid));
-    VG_(message)(Vg_UserMsg,
-                 "thread %d/%d%s finished and used %ld bytes out of %ld"
-                 " on its stack. Margin: %ld bytes.",
-                 vg_tid,
-                 drd_tid,
-                 DRD_(thread_get_joinable)(drd_tid)
-                 ? ""
-                 : " (which is a detached thread)",
-                 used_stack,
-                 stack_size,
-                 stack_size - used_stack);
+   drd_tid = DRD_(VgThreadIdToDrdThreadId)(vg_tid);
+   if (DRD_(thread_get_trace_fork_join)())
+   {
+      VG_(message)(Vg_DebugMsg,
+                   "drd_thread_finished tid = %d/%d%s",
+                   vg_tid,
+                   drd_tid,
+                   DRD_(thread_get_joinable)(drd_tid)
+                   ? ""
+                   : " (which is a detached thread)");
+   }
+   if (DRD_(s_show_stack_usage))
+   {
+      const SizeT stack_size = DRD_(thread_get_stack_size)(drd_tid);
+      const SizeT used_stack
+         = (DRD_(thread_get_stack_max)(drd_tid)
+            - DRD_(thread_get_stack_min_min)(drd_tid));
+      VG_(message)(Vg_UserMsg,
+                   "thread %d/%d%s finished and used %ld bytes out of %ld"
+                   " on its stack. Margin: %ld bytes.",
+                   vg_tid,
+                   drd_tid,
+                   DRD_(thread_get_joinable)(drd_tid)
+                   ? ""
+                   : " (which is a detached thread)",
+                   used_stack,
+                   stack_size,
+                   stack_size - used_stack);
 
-  }
-  drd_stop_using_mem(DRD_(thread_get_stack_min)(drd_tid),
-                     DRD_(thread_get_stack_max)(drd_tid)
-                     - DRD_(thread_get_stack_min)(drd_tid),
-                     True);
-  DRD_(thread_stop_recording)(drd_tid);
-  DRD_(thread_finished)(drd_tid);
+   }
+   drd_stop_using_mem(DRD_(thread_get_stack_min)(drd_tid),
+                      DRD_(thread_get_stack_max)(drd_tid)
+                      - DRD_(thread_get_stack_min)(drd_tid),
+                      True);
+   DRD_(thread_stop_recording)(drd_tid);
+   DRD_(thread_finished)(drd_tid);
 }
 
 //
@@ -516,124 +526,124 @@
 
 static void DRD_(post_clo_init)(void)
 {
-#  if defined(VGP_x86_linux) || defined(VGP_amd64_linux) \
-      || defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
-  /* fine */
+#  if defined(VGP_x86_linux) || defined(VGP_amd64_linux)        \
+   || defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
+   /* fine */
 #  else
-  VG_(printf)("\nWARNING: DRD has only been tested on Linux.\n\n");
+   VG_(printf)("\nWARNING: DRD has only been tested on Linux.\n\n");
 #  endif
 
-  if (DRD_(s_var_info))
-  {
-    VG_(needs_var_info)();
-  }
+   if (DRD_(s_var_info))
+   {
+      VG_(needs_var_info)();
+   }
 }
 
 static void drd_start_client_code(const ThreadId tid, const ULong bbs_done)
 {
-  tl_assert(tid == VG_(get_running_tid)());
-  DRD_(thread_set_vg_running_tid)(tid);
+   tl_assert(tid == VG_(get_running_tid)());
+   DRD_(thread_set_vg_running_tid)(tid);
 }
 
 static void DRD_(fini)(Int exitcode)
 {
-  // thread_print_all();
-  if (VG_(clo_verbosity) > 1 || DRD_(s_print_stats))
-  {
-    ULong update_conflict_set_count;
-    ULong dsnsc;
-    ULong dscvc;
+   // thread_print_all();
+   if (VG_(clo_verbosity) > 1 || DRD_(s_print_stats))
+   {
+      ULong update_conflict_set_count;
+      ULong dsnsc;
+      ULong dscvc;
 
-    update_conflict_set_count
-      = DRD_(thread_get_update_conflict_set_count)(&dsnsc, &dscvc);
+      update_conflict_set_count
+         = DRD_(thread_get_update_conflict_set_count)(&dsnsc, &dscvc);
 
-    VG_(message)(Vg_UserMsg,
-                 "   thread: %lld context switches"
-                 " / %lld updates of the conflict set",
-                 DRD_(thread_get_context_switch_count)(),
-                 update_conflict_set_count);
-    VG_(message)(Vg_UserMsg,
-                 "           (%lld new sg + %lld combine vc + %lld csw).",
-                 dsnsc,
-                 dscvc,
-                 update_conflict_set_count - dsnsc - dscvc);
-    VG_(message)(Vg_UserMsg,
-                 " segments: created %lld segments, max %lld alive,"
-                 " %lld discard points.",
-                 DRD_(sg_get_segments_created_count)(),
-                 DRD_(sg_get_max_segments_alive_count)(),
-                 DRD_(thread_get_discard_ordered_segments_count)());
-    VG_(message)(Vg_UserMsg,
-                 "           (%lld m, %lld rw, %lld s, %lld b)",
-                 DRD_(get_mutex_segment_creation_count)(),
-                 DRD_(get_rwlock_segment_creation_count)(),
-                 DRD_(get_semaphore_segment_creation_count)(),
-                 DRD_(get_barrier_segment_creation_count)());
-    VG_(message)(Vg_UserMsg,
-                 "  bitmaps: %lld level 1 / %lld level 2 bitmap refs",
-                 DRD_(bm_get_bitmap_creation_count)(),
-                 DRD_(bm_get_bitmap2_node_creation_count)());
-    VG_(message)(Vg_UserMsg,
-                 "           and %lld level 2 bitmaps were allocated.",
-                 DRD_(bm_get_bitmap2_creation_count)());
-    VG_(message)(Vg_UserMsg,
-                 "    mutex: %lld non-recursive lock/unlock events.",
-                 DRD_(get_mutex_lock_count)());
-    DRD_(print_malloc_stats)();
-  }
+      VG_(message)(Vg_UserMsg,
+                   "   thread: %lld context switches"
+                   " / %lld updates of the conflict set",
+                   DRD_(thread_get_context_switch_count)(),
+                   update_conflict_set_count);
+      VG_(message)(Vg_UserMsg,
+                   "           (%lld new sg + %lld combine vc + %lld csw).",
+                   dsnsc,
+                   dscvc,
+                   update_conflict_set_count - dsnsc - dscvc);
+      VG_(message)(Vg_UserMsg,
+                   " segments: created %lld segments, max %lld alive,"
+                   " %lld discard points.",
+                   DRD_(sg_get_segments_created_count)(),
+                   DRD_(sg_get_max_segments_alive_count)(),
+                   DRD_(thread_get_discard_ordered_segments_count)());
+      VG_(message)(Vg_UserMsg,
+                   "           (%lld m, %lld rw, %lld s, %lld b)",
+                   DRD_(get_mutex_segment_creation_count)(),
+                   DRD_(get_rwlock_segment_creation_count)(),
+                   DRD_(get_semaphore_segment_creation_count)(),
+                   DRD_(get_barrier_segment_creation_count)());
+      VG_(message)(Vg_UserMsg,
+                   "  bitmaps: %lld level 1 / %lld level 2 bitmap refs",
+                   DRD_(bm_get_bitmap_creation_count)(),
+                   DRD_(bm_get_bitmap2_node_creation_count)());
+      VG_(message)(Vg_UserMsg,
+                   "           and %lld level 2 bitmaps were allocated.",
+                   DRD_(bm_get_bitmap2_creation_count)());
+      VG_(message)(Vg_UserMsg,
+                   "    mutex: %lld non-recursive lock/unlock events.",
+                   DRD_(get_mutex_lock_count)());
+      DRD_(print_malloc_stats)();
+   }
 }
 
 static
 void drd_pre_clo_init(void)
 {
-  // Basic tool stuff.
+   // Basic tool stuff.
 
-  VG_(details_name)            ("drd");
-  VG_(details_version)         (NULL);
-  VG_(details_description)     ("a thread error detector");
-  VG_(details_copyright_author)("Copyright (C) 2006-2009, and GNU GPL'd,"
-                                " by Bart Van Assche.");
-  VG_(details_bug_reports_to)  (VG_BUGS_TO);
+   VG_(details_name)            ("drd");
+   VG_(details_version)         (NULL);
+   VG_(details_description)     ("a thread error detector");
+   VG_(details_copyright_author)("Copyright (C) 2006-2009, and GNU GPL'd,"
+                                 " by Bart Van Assche.");
+   VG_(details_bug_reports_to)  (VG_BUGS_TO);
 
-  VG_(basic_tool_funcs)        (DRD_(post_clo_init),
-                                DRD_(instrument),
-                                DRD_(fini));
+   VG_(basic_tool_funcs)        (DRD_(post_clo_init),
+                                 DRD_(instrument),
+                                 DRD_(fini));
 
-  // Command line stuff.
-  VG_(needs_command_line_options)(DRD_(process_cmd_line_option),
-                                  DRD_(print_usage),
-                                  DRD_(print_debug_usage));
+   // Command line stuff.
+   VG_(needs_command_line_options)(DRD_(process_cmd_line_option),
+                                   DRD_(print_usage),
+                                   DRD_(print_debug_usage));
 
-  // Error handling.
-  DRD_(register_error_handlers)();
+   // Error handling.
+   DRD_(register_error_handlers)();
 
-  // Core event tracking.
-  VG_(track_pre_mem_read)         (drd_pre_mem_read);
-  VG_(track_pre_mem_read_asciiz)  (drd_pre_mem_read_asciiz);
-  VG_(track_post_mem_write)       (drd_post_mem_write);
-  VG_(track_new_mem_brk)          (drd_start_using_mem_w_tid);
-  VG_(track_new_mem_mmap)         (drd_start_using_mem_w_perms);
-  VG_(track_new_mem_stack)        (drd_start_using_mem_stack);
-  VG_(track_new_mem_stack_signal) (drd_start_using_mem_stack_signal);
-  VG_(track_new_mem_startup)      (drd_start_using_mem_w_perms);
-  VG_(track_die_mem_brk)          (drd_stop_using_nonstack_mem);
-  VG_(track_die_mem_munmap)       (drd_stop_using_nonstack_mem);
-  VG_(track_die_mem_stack)        (drd_stop_using_mem_stack);
-  VG_(track_die_mem_stack_signal) (drd_stop_using_mem_stack_signal);
-  VG_(track_start_client_code)    (drd_start_client_code);
-  VG_(track_pre_thread_ll_create) (drd_pre_thread_create);
-  VG_(track_pre_thread_first_insn)(drd_post_thread_create);
-  VG_(track_pre_thread_ll_exit)   (drd_thread_finished);
+   // Core event tracking.
+   VG_(track_pre_mem_read)         (drd_pre_mem_read);
+   VG_(track_pre_mem_read_asciiz)  (drd_pre_mem_read_asciiz);
+   VG_(track_post_mem_write)       (drd_post_mem_write);
+   VG_(track_new_mem_brk)          (drd_start_using_mem_w_tid);
+   VG_(track_new_mem_mmap)         (drd_start_using_mem_w_perms);
+   VG_(track_new_mem_stack)        (drd_start_using_mem_stack);
+   VG_(track_new_mem_stack_signal) (drd_start_using_mem_stack_signal);
+   VG_(track_new_mem_startup)      (drd_start_using_mem_w_perms);
+   VG_(track_die_mem_brk)          (drd_stop_using_nonstack_mem);
+   VG_(track_die_mem_munmap)       (drd_stop_using_nonstack_mem);
+   VG_(track_die_mem_stack)        (drd_stop_using_mem_stack);
+   VG_(track_die_mem_stack_signal) (drd_stop_using_mem_stack_signal);
+   VG_(track_start_client_code)    (drd_start_client_code);
+   VG_(track_pre_thread_ll_create) (drd_pre_thread_create);
+   VG_(track_pre_thread_first_insn)(drd_post_thread_create);
+   VG_(track_pre_thread_ll_exit)   (drd_thread_finished);
 
-  // Other stuff.
-  DRD_(register_malloc_wrappers)(drd_start_using_mem_w_ecu,
-                                 drd_stop_using_nonstack_mem);
+   // Other stuff.
+   DRD_(register_malloc_wrappers)(drd_start_using_mem_w_ecu,
+                                  drd_stop_using_nonstack_mem);
 
-  DRD_(clientreq_init)();
+   DRD_(clientreq_init)();
 
-  DRD_(suppression_init)();
+   DRD_(suppression_init)();
 
-  DRD_(clientobj_init)();
+   DRD_(clientobj_init)();
 }