Print this page
4785 mdb crashes in ::ldi_handle

@@ -22,12 +22,10 @@
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/types.h>
 #include <sys/sysmacros.h>
 #include <sys/dditypes.h>
 #include <sys/ddi_impldefs.h>
 #include <sys/ddipropdefs.h>

@@ -364,26 +362,26 @@
 ldi_handle(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 {
         int                     ident = 0;
         int                     refs = 1;
 
-        if (mdb_getopts(argc, argv,
-            'i', MDB_OPT_SETBITS, TRUE, &ident) != argc)
-                return (DCMD_USAGE);
-
-        if (ident)
-                refs = 0;
-
         /* Determine if there is an ldi handle address */
         if (!(flags & DCMD_ADDRSPEC)) {
                 if (mdb_walk_dcmd("ldi_handle", "ldi_handle",
                     argc, argv) == -1) {
                         mdb_warn("can't walk ldi handles");
                         return (DCMD_ERR);
                 } return (DCMD_OK);
         }
 
+        if (mdb_getopts(argc, argv,
+            'i', MDB_OPT_SETBITS, TRUE, &ident) != argc)
+                return (DCMD_USAGE);
+
+        if (ident)
+                refs = 0;
+
         /* display the header line */
         if (DCMD_HDRSPEC(flags))
                 ldi_handle_header(refs, ident);
 
         /* display the ldi handle */