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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/mdb/mdb_main.c
          +++ new/usr/src/cmd/mdb/common/mdb/mdb_main.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   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
  24   25   */
  25   26  
  26   27  #include <sys/types.h>
  27   28  #include <sys/mman.h>
  28   29  #include <sys/priocntl.h>
  29   30  #include <sys/rtpriocntl.h>
  30   31  #include <sys/resource.h>
  31   32  #include <sys/termios.h>
  32   33  #include <sys/param.h>
  33   34  #include <sys/regset.h>
↓ open down ↓ 762 lines elided ↑ open up ↑
 796  797                  /*
 797  798                   * If special "-" tokens preceded an argument, shift the entire
 798  799                   * argument list to the left to remove the leading "-" args.
 799  800                   */
 800  801                  if (c > 0) {
 801  802                          bcopy(&tgt_argv[c], tgt_argv,
 802  803                              sizeof (const char *) * (tgt_argc - c));
 803  804                          tgt_argc -= c;
 804  805                  }
 805  806  
      807 +                if (fflag)
      808 +                        goto tcreate; /* skip re-exec and just create target */
      809 +
 806  810                  /*
 807  811                   * If we just have an object file name, and that file doesn't
 808  812                   * exist, and it's a string of digits, infer it to be a
 809  813                   * sequence number referring to a pair of crash dump files.
 810  814                   */
 811  815                  if (tgt_argc == 1 && access(tgt_argv[0], F_OK) == -1 &&
 812  816                      strisnum(tgt_argv[0])) {
 813  817  
 814  818                          size_t len = strlen(tgt_argv[0]) + 8;
 815  819                          const char *object = tgt_argv[0];
↓ open down ↓ 43 lines elided ↑ open up ↑
 859  863                                  terminate(0);
 860  864                          }
 861  865                  }
 862  866  
 863  867                  /*
 864  868                   * If the target is unknown or is not the rawfile target, do
 865  869                   * a gelf_check to determine if the file is an ELF file.  If
 866  870                   * it is not and the target is unknown, use the rawfile tgt.
 867  871                   * Otherwise an ELF-based target is needed, so we must abort.
 868  872                   */
 869      -                if (tgt_ctor != mdb_rawfile_tgt_create &&
 870      -                    mdb_gelf_check(io, &ehdr, ET_NONE) == -1) {
      873 +                if (mdb_gelf_check(io, &ehdr, ET_NONE) == -1) {
 871  874                          if (tgt_ctor != NULL) {
 872  875                                  (void) mdb_gelf_check(io, &ehdr, ET_EXEC);
 873  876                                  mdb_io_destroy(io);
 874  877                                  terminate(1);
 875  878                          } else
 876  879                                  tgt_ctor = mdb_rawfile_tgt_create;
 877  880                  }
 878  881  
 879  882                  mdb_io_destroy(io);
 880  883  
 881      -                if (identify_xvm_file(tgt_argv[0], &longmode) == 1 &&
 882      -                    !fflag) {
      884 +                if (identify_xvm_file(tgt_argv[0], &longmode) == 1) {
 883  885  #ifdef _LP64
 884  886                          if (!longmode)
 885  887                                  goto reexec;
 886  888  #else
 887  889                          if (longmode)
 888  890                                  goto reexec;
 889  891  #endif
 890  892                          tgt_ctor = mdb_kvm_tgt_create;
 891  893                          goto tcreate;
 892  894                  }
 893  895  
 894      -                if (tgt_ctor == mdb_rawfile_tgt_create)
 895      -                        goto tcreate; /* skip re-exec and just create target */
 896      -
 897  896                  /*
 898  897                   * The object file turned out to be a user core file (ET_CORE),
 899  898                   * and no other arguments were specified, swap 0 and 1.  The
 900  899                   * proc target will infer the executable for us.
 901  900                   */
 902  901                  if (ehdr.e_type == ET_CORE) {
 903  902                          tgt_argv[tgt_argc++] = tgt_argv[0];
 904  903                          tgt_argv[0] = NULL;
 905  904                          tgt_ctor = mdb_proc_tgt_create;
 906  905                  }
↓ open down ↓ 202 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX