Print this page
2676 'mdb -f vmdump.0' ignores the -f
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
  */
 
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/priocntl.h>

@@ -801,10 +802,13 @@
                         bcopy(&tgt_argv[c], tgt_argv,
                             sizeof (const char *) * (tgt_argc - c));
                         tgt_argc -= c;
                 }
 
+                if (fflag)
+                        goto tcreate; /* skip re-exec and just create target */
+
                 /*
                  * If we just have an object file name, and that file doesn't
                  * exist, and it's a string of digits, infer it to be a
                  * sequence number referring to a pair of crash dump files.
                  */

@@ -864,12 +868,11 @@
                  * If the target is unknown or is not the rawfile target, do
                  * a gelf_check to determine if the file is an ELF file.  If
                  * it is not and the target is unknown, use the rawfile tgt.
                  * Otherwise an ELF-based target is needed, so we must abort.
                  */
-                if (tgt_ctor != mdb_rawfile_tgt_create &&
-                    mdb_gelf_check(io, &ehdr, ET_NONE) == -1) {
+                if (mdb_gelf_check(io, &ehdr, ET_NONE) == -1) {
                         if (tgt_ctor != NULL) {
                                 (void) mdb_gelf_check(io, &ehdr, ET_EXEC);
                                 mdb_io_destroy(io);
                                 terminate(1);
                         } else

@@ -876,12 +879,11 @@
                                 tgt_ctor = mdb_rawfile_tgt_create;
                 }
 
                 mdb_io_destroy(io);
 
-                if (identify_xvm_file(tgt_argv[0], &longmode) == 1 &&
-                    !fflag) {
+                if (identify_xvm_file(tgt_argv[0], &longmode) == 1) {
 #ifdef _LP64
                         if (!longmode)
                                 goto reexec;
 #else
                         if (longmode)

@@ -889,13 +891,10 @@
 #endif
                         tgt_ctor = mdb_kvm_tgt_create;
                         goto tcreate;
                 }
 
-                if (tgt_ctor == mdb_rawfile_tgt_create)
-                        goto tcreate; /* skip re-exec and just create target */
-
                 /*
                  * The object file turned out to be a user core file (ET_CORE),
                  * and no other arguments were specified, swap 0 and 1.  The
                  * proc target will infer the executable for us.
                  */