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>


   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.


  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * isa-dependent portions of the kmdb target
  31  */
  32 
  33 #include <mdb/mdb_kreg_impl.h>
  34 #include <mdb/mdb_debug.h>
  35 #include <mdb/mdb_modapi.h>
  36 #include <mdb/mdb_v9util.h>
  37 #include <mdb/mdb_target_impl.h>
  38 #include <mdb/mdb_err.h>
  39 #include <mdb/mdb_umem.h>
  40 #include <kmdb/kmdb_kdi.h>
  41 #include <kmdb/kmdb_dpi.h>
  42 #include <kmdb/kmdb_promif.h>
  43 #include <kmdb/kmdb_asmutil.h>
  44 #include <kmdb/kvm.h>
  45 #include <mdb/mdb.h>
  46 
  47 #include <sys/types.h>
  48 #include <sys/stack.h>


 360                 *p = o7 + 2 * sizeof (mdb_instr_t);
 361         else {
 362                 mdb_instr_t instr;
 363 
 364                 if (mdb_tgt_vread(t, &instr, sizeof (instr), pc) !=
 365                     sizeof (instr)) {
 366                         warn("failed to read instruction at %p for step out",
 367                             (void *)pc);
 368                         return (-1);
 369                 }
 370 
 371                 if (OP(instr) == OP_ARITH && OP3(instr) == OP3_SAVE)
 372                         *p = o7 + 2 * sizeof (mdb_instr_t);
 373                 else
 374                         *p = i7 + 2 * sizeof (mdb_instr_t);
 375         }
 376 
 377         return (0);
 378 }
 379 
 380 /*ARGSUSED*/
 381 int
 382 kmt_step_branch(mdb_tgt_t *t)
 383 {
 384         return (set_errno(EMDB_TGTHWNOTSUP));
 385 }
 386 
 387 static const char *
 388 regno2name(int idx)
 389 {
 390         const mdb_tgt_regdesc_t *rd;
 391 
 392         for (rd = mdb_sparcv9_kregs; rd->rd_name != NULL; rd++) {
 393                 if (idx == rd->rd_num)
 394                         return (rd->rd_name);
 395         }
 396 
 397         ASSERT(rd->rd_name != NULL);
 398 
 399         return ("unknown");
 400 }
 401 
 402 /*
 403  * Step over call and jmpl by returning the address of the position where a
 404  * temporary breakpoint can be set to catch return from the control transfer.
 405  * This function does not currently provide advanced decoding of DCTI couples
 406  * or any other complex special case; we just fall back to single-step.




   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Copyright 2018 Joyent, Inc.
  27  */
  28 


  29 /*
  30  * isa-dependent portions of the kmdb target
  31  */
  32 
  33 #include <mdb/mdb_kreg_impl.h>
  34 #include <mdb/mdb_debug.h>
  35 #include <mdb/mdb_modapi.h>
  36 #include <mdb/mdb_v9util.h>
  37 #include <mdb/mdb_target_impl.h>
  38 #include <mdb/mdb_err.h>
  39 #include <mdb/mdb_umem.h>
  40 #include <kmdb/kmdb_kdi.h>
  41 #include <kmdb/kmdb_dpi.h>
  42 #include <kmdb/kmdb_promif.h>
  43 #include <kmdb/kmdb_asmutil.h>
  44 #include <kmdb/kvm.h>
  45 #include <mdb/mdb.h>
  46 
  47 #include <sys/types.h>
  48 #include <sys/stack.h>


 360                 *p = o7 + 2 * sizeof (mdb_instr_t);
 361         else {
 362                 mdb_instr_t instr;
 363 
 364                 if (mdb_tgt_vread(t, &instr, sizeof (instr), pc) !=
 365                     sizeof (instr)) {
 366                         warn("failed to read instruction at %p for step out",
 367                             (void *)pc);
 368                         return (-1);
 369                 }
 370 
 371                 if (OP(instr) == OP_ARITH && OP3(instr) == OP3_SAVE)
 372                         *p = o7 + 2 * sizeof (mdb_instr_t);
 373                 else
 374                         *p = i7 + 2 * sizeof (mdb_instr_t);
 375         }
 376 
 377         return (0);
 378 }
 379 







 380 static const char *
 381 regno2name(int idx)
 382 {
 383         const mdb_tgt_regdesc_t *rd;
 384 
 385         for (rd = mdb_sparcv9_kregs; rd->rd_name != NULL; rd++) {
 386                 if (idx == rd->rd_num)
 387                         return (rd->rd_name);
 388         }
 389 
 390         ASSERT(rd->rd_name != NULL);
 391 
 392         return ("unknown");
 393 }
 394 
 395 /*
 396  * Step over call and jmpl by returning the address of the position where a
 397  * temporary breakpoint can be set to catch return from the control transfer.
 398  * This function does not currently provide advanced decoding of DCTI couples
 399  * or any other complex special case; we just fall back to single-step.