Print this page
9210 remove KMDB branch debugging support
9211 ::crregs could do with cr2/cr3 support
9209 ::ttrace should be able to filter by thread
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright (c) 2012 by Delphix. All rights reserved.
  29  * Copyright (c) 2015 Joyent, Inc. All rights reserved.
  30  * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  31  * Copyright (c) 2015, 2017 by Delphix. All rights reserved.
  32  */
  33 
  34 #include <sys/elf.h>
  35 #include <sys/elf_SPARC.h>
  36 
  37 #include <libproc.h>
  38 #include <stdlib.h>
  39 #include <string.h>
  40 #include <fcntl.h>
  41 #include <errno.h>
  42 #include <alloca.h>
  43 #include <libctf.h>
  44 #include <ctype.h>
  45 
  46 #include <mdb/mdb_string.h>
  47 #include <mdb/mdb_argvec.h>
  48 #include <mdb/mdb_nv.h>
  49 #include <mdb/mdb_fmt.h>


2726                 if (errno != EMDB_TGT)
2727                         mdb_warn("failed to %s target", name);
2728                 return (DCMD_ERR);
2729         }
2730 
2731         return (tgt_status(&st));
2732 }
2733 
2734 static int
2735 cmd_step(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2736 {
2737         int (*func)(mdb_tgt_t *, mdb_tgt_status_t *) = &mdb_tgt_step;
2738         const char *name = "single-step";
2739 
2740         if (argc > 0 && argv->a_type == MDB_TYPE_STRING) {
2741                 if (strcmp(argv->a_un.a_str, "out") == 0) {
2742                         func = &mdb_tgt_step_out;
2743                         name = "step (out)";
2744                         argv++;
2745                         argc--;
2746                 } else if (strcmp(argv->a_un.a_str, "branch") == 0) {
2747                         func = &mdb_tgt_step_branch;
2748                         name = "step (branch)";
2749                         argv++;
2750                         argc--;
2751                 } else if (strcmp(argv->a_un.a_str, "over") == 0) {
2752                         func = &mdb_tgt_next;
2753                         name = "step (over)";
2754                         argv++;
2755                         argc--;
2756                 }
2757         }
2758 
2759         return (cmd_cont_common(addr, flags, argc, argv, func, name));
2760 }
2761 
2762 static int
2763 cmd_step_out(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2764 {
2765         return (cmd_cont_common(addr, flags, argc, argv,
2766             &mdb_tgt_step_out, "step (out)"));
2767 }
2768 
2769 static int
2770 cmd_next(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)




   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright (c) 2012 by Delphix. All rights reserved.
  29  * Copyright (c) 2018 Joyent, Inc. All rights reserved.
  30  * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  31  * Copyright (c) 2015, 2017 by Delphix. All rights reserved.
  32  */
  33 
  34 #include <sys/elf.h>
  35 #include <sys/elf_SPARC.h>
  36 
  37 #include <libproc.h>
  38 #include <stdlib.h>
  39 #include <string.h>
  40 #include <fcntl.h>
  41 #include <errno.h>
  42 #include <alloca.h>
  43 #include <libctf.h>
  44 #include <ctype.h>
  45 
  46 #include <mdb/mdb_string.h>
  47 #include <mdb/mdb_argvec.h>
  48 #include <mdb/mdb_nv.h>
  49 #include <mdb/mdb_fmt.h>


2726                 if (errno != EMDB_TGT)
2727                         mdb_warn("failed to %s target", name);
2728                 return (DCMD_ERR);
2729         }
2730 
2731         return (tgt_status(&st));
2732 }
2733 
2734 static int
2735 cmd_step(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2736 {
2737         int (*func)(mdb_tgt_t *, mdb_tgt_status_t *) = &mdb_tgt_step;
2738         const char *name = "single-step";
2739 
2740         if (argc > 0 && argv->a_type == MDB_TYPE_STRING) {
2741                 if (strcmp(argv->a_un.a_str, "out") == 0) {
2742                         func = &mdb_tgt_step_out;
2743                         name = "step (out)";
2744                         argv++;
2745                         argc--;





2746                 } else if (strcmp(argv->a_un.a_str, "over") == 0) {
2747                         func = &mdb_tgt_next;
2748                         name = "step (over)";
2749                         argv++;
2750                         argc--;
2751                 }
2752         }
2753 
2754         return (cmd_cont_common(addr, flags, argc, argv, func, name));
2755 }
2756 
2757 static int
2758 cmd_step_out(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2759 {
2760         return (cmd_cont_common(addr, flags, argc, argv,
2761             &mdb_tgt_step_out, "step (out)"));
2762 }
2763 
2764 static int
2765 cmd_next(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)