Print this page
3992 mdb ::stacks segv

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/genunix/findstack.c
          +++ new/usr/src/cmd/mdb/common/modules/genunix/findstack.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 2013, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  24   25   */
  25   26  
  26   27  #include <mdb/mdb_modapi.h>
  27   28  #include <mdb/mdb_ctf.h>
  28   29  
  29   30  #include <sys/types.h>
  30   31  #include <sys/regset.h>
  31   32  #include <sys/stack.h>
  32   33  #include <sys/thread.h>
  33   34  #include <sys/modctl.h>
↓ open down ↓ 299 lines elided ↑ open up ↑
 333  334                                  }
 334  335                                  next = cur->se_next;
 335  336                                  stacks_hash[idx] = next;
 336  337                                  mdb_free(cur, STACKS_ENTRY_SIZE(cur->se_depth));
 337  338                          }
 338  339                  }
 339  340                  if (stacks_array != NULL)
 340  341                          mdb_free(stacks_array,
 341  342                              stacks_array_size * sizeof (*stacks_array));
 342  343  
      344 +                mdb_free(stacks_hash, STACKS_HSIZE * sizeof (*stacks_hash));
      345 +
 343  346          } else if (stacks_array != NULL) {
 344  347                  for (idx = 0; idx < stacks_array_size; idx++) {
 345  348                          if ((cur = stacks_array[idx]) != NULL) {
 346  349                                  while ((next = cur->se_dup) != NULL) {
 347  350                                          cur->se_dup = next->se_dup;
 348  351                                          mdb_free(next,
 349  352                                              STACKS_ENTRY_SIZE(next->se_depth));
 350  353                                  }
 351  354                                  stacks_array[idx] = NULL;
 352  355                                  mdb_free(cur, STACKS_ENTRY_SIZE(cur->se_depth));
 353  356                          }
 354  357                  }
 355  358                  mdb_free(stacks_array,
 356  359                      stacks_array_size * sizeof (*stacks_array));
 357  360          }
 358  361  
 359  362          stacks_findstack_cleanup();
 360  363  
 361  364          stacks_array_size = 0;
 362  365          stacks_state = STACKS_STATE_CLEAN;
      366 +        stacks_hash = NULL;
      367 +        stacks_array = NULL;
 363  368  }
 364  369  
 365  370  /*ARGSUSED*/
 366  371  int
 367  372  stacks_thread_cb(uintptr_t addr, const void *ignored, void *cbarg)
 368  373  {
 369  374          stacks_info_t *sip = cbarg;
 370  375          findstack_info_t *fsip = &sip->si_fsi;
 371  376  
 372  377          stacks_entry_t **sepp, *nsep, *sep;
↓ open down ↓ 530 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX