Print this page
4785 mdb crashes in ::ldi_handle

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/genunix/ldi.c
          +++ new/usr/src/cmd/mdb/common/modules/genunix/ldi.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  #include <sys/types.h>
  30   28  #include <sys/sysmacros.h>
  31   29  #include <sys/dditypes.h>
  32   30  #include <sys/ddi_impldefs.h>
  33   31  #include <sys/ddipropdefs.h>
  34   32  #include <sys/modctl.h>
  35   33  #include <sys/file.h>
  36   34  #include <sys/sunldi_impl.h>
  37   35  
  38   36  #include <mdb/mdb_modapi.h>
↓ open down ↓ 320 lines elided ↑ open up ↑
 359  357          /* display the entire ident  */
 360  358          return (ldi_ident_print((uintptr_t)lh.lh_ident, refs));
 361  359  }
 362  360  
 363  361  int
 364  362  ldi_handle(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 365  363  {
 366  364          int                     ident = 0;
 367  365          int                     refs = 1;
 368  366  
 369      -        if (mdb_getopts(argc, argv,
 370      -            'i', MDB_OPT_SETBITS, TRUE, &ident) != argc)
 371      -                return (DCMD_USAGE);
 372      -
 373      -        if (ident)
 374      -                refs = 0;
 375      -
 376  367          /* Determine if there is an ldi handle address */
 377  368          if (!(flags & DCMD_ADDRSPEC)) {
 378  369                  if (mdb_walk_dcmd("ldi_handle", "ldi_handle",
 379  370                      argc, argv) == -1) {
 380  371                          mdb_warn("can't walk ldi handles");
 381  372                          return (DCMD_ERR);
 382  373                  } return (DCMD_OK);
 383  374          }
 384  375  
      376 +        if (mdb_getopts(argc, argv,
      377 +            'i', MDB_OPT_SETBITS, TRUE, &ident) != argc)
      378 +                return (DCMD_USAGE);
      379 +
      380 +        if (ident)
      381 +                refs = 0;
      382 +
 385  383          /* display the header line */
 386  384          if (DCMD_HDRSPEC(flags))
 387  385                  ldi_handle_header(refs, ident);
 388  386  
 389  387          /* display the ldi handle */
 390  388          if (ldi_handle_print(addr, ident, refs))
 391  389                  return (DCMD_ERR);
 392  390  
 393  391          return (DCMD_OK);
 394  392  }
↓ open down ↓ 20 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX