Print this page
11626 introduce /etc/versions/build
11627 clean up UUID code for ::status

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c
          +++ new/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2013 by Delphix. All rights reserved.
  24   24   *
  25      - * Copyright 2018 Joyent, Inc.
       25 + * Copyright 2019 Joyent, Inc.
  26   26   */
  27   27  
  28   28  #include <kmdb/kmdb_kvm.h>
  29   29  #include <kmdb/kvm.h>
  30   30  #include <kmdb/kmdb_kdi.h>
  31   31  #include <kmdb/kmdb_promif.h>
  32   32  #include <kmdb/kmdb_module.h>
  33   33  #include <kmdb/kmdb_asmutil.h>
  34   34  #include <mdb/mdb_types.h>
  35   35  #include <mdb/mdb_conf.h>
↓ open down ↓ 6 lines elided ↑ open up ↑
  42   42  #include <mdb/mdb_kreg_impl.h>
  43   43  #include <mdb/mdb_ks.h>
  44   44  #include <mdb/mdb.h>
  45   45  
  46   46  #include <strings.h>
  47   47  #include <dlfcn.h>
  48   48  #include <sys/isa_defs.h>
  49   49  #include <sys/kobj.h>
  50   50  #include <sys/kobj_impl.h>
  51   51  #include <sys/bitmap.h>
       52 +#include <sys/uuid.h>
  52   53  #include <vm/as.h>
  53   54  
  54   55  static const char KMT_RTLD_NAME[] = "krtld";
  55   56  static const char KMT_MODULE[] = "mdb_ks";
  56   57  static const char KMT_CTFPARENT[] = "genunix";
  57   58  
  58   59  static mdb_list_t kmt_defbp_list;       /* List of current deferred bp's */
  59   60  static int kmt_defbp_lock;              /* For list, running kernel holds */
  60   61  static uint_t kmt_defbp_modchg_isload;  /* Whether mod change is load/unload */
  61   62  static struct modctl *kmt_defbp_modchg_modctl; /* modctl for defbp checking */
↓ open down ↓ 483 lines elided ↑ open up ↑
 545  546                  mdb_printf("\n");
 546  547  
 547  548          return (n);
 548  549  }
 549  550  
 550  551  /*ARGSUSED*/
 551  552  static int
 552  553  kmt_status_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 553  554  {
 554  555          struct utsname uts;
 555      -        char uuid[37];
      556 +        char uuid[UUID_PRINTABLE_STRING_LENGTH];
 556  557          kreg_t tt;
 557  558  
 558  559          if (mdb_tgt_readsym(mdb.m_target, MDB_TGT_AS_VIRT, &uts, sizeof (uts),
 559  560              "unix", "utsname") != sizeof (uts)) {
 560  561                  warn("failed to read 'utsname' struct from kernel\n");
 561  562                  bzero(&uts, sizeof (uts));
 562  563                  (void) strcpy(uts.nodename, "unknown machine");
 563  564          }
 564  565  
 565  566          mdb_printf("debugging live kernel (%d-bit) on %s\n",
 566  567              (int)(sizeof (void *) * NBBY),
 567  568              (*uts.nodename == '\0' ? "(not set)" : uts.nodename));
 568  569          mdb_printf("operating system: %s %s (%s)\n",
 569  570              uts.release, uts.version, uts.machine);
 570  571  
 571      -        if (mdb_tgt_readsym(mdb.m_target, MDB_TGT_AS_VIRT, uuid, sizeof (uuid),
 572      -            "genunix", "dump_osimage_uuid") != sizeof (uuid)) {
 573      -                warn("failed to read 'dump_osimage_uuid' string from kernel\n");
 574      -                (void) strcpy(uuid, "(error)");
 575      -        } else if (*uuid == '\0') {
 576      -                (void) strcpy(uuid, "(not set)");
 577      -        } else if (uuid[36] != '\0') {
 578      -                (void) strcpy(uuid, "(invalid)");
      572 +        mdb_print_buildversion();
      573 +
      574 +        if (mdb_readsym(uuid, sizeof (uuid),
      575 +            "dump_osimage_uuid") == sizeof (uuid) &&
      576 +            uuid[sizeof (uuid) - 1] == '\0') {
      577 +                mdb_printf("image uuid: %s\n", uuid[0] != '\0' ?
      578 +                    uuid : "(not set)");
 579  579          }
 580      -        mdb_printf("image uuid: %s\n", uuid);
 581  580  
 582  581          mdb_printf("DTrace state: %s\n", (kmdb_kdi_dtrace_get_state() ==
 583  582              KDI_DTSTATE_DTRACE_ACTIVE ? "active (debugger breakpoints cannot "
 584  583              "be armed)" : "inactive"));
 585  584  
 586  585          (void) kmdb_dpi_get_register("tt", &tt);
 587  586          mdb_printf("stopped on: %s\n", kmt_trapname(tt));
 588  587  
 589  588          (void) kmt_dmod_status("pending dmod loads:", KMDB_MC_STATE_LOADING);
 590  589          (void) kmt_dmod_status("pending dmod unloads:",
↓ open down ↓ 1984 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX