1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   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 2001-2002 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Copyright 2017 Jason King.
  27  */
  28 
  29 #ifndef _MDB_DEMANGLE_H
  30 #define _MDB_DEMANGLE_H
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #ifdef  _MDB
  37 
  38 #include <sys/types.h>
  39 #include <sys/param.h>
  40 #include <mdb/mdb_modapi.h>
  41 #include <sysdemangle.h>
  42 
  43 typedef struct mdb_demangler {
  44         sysdem_lang_t dm_lang;          /* language to demangle */
  45         char *dm_buf;                   /* demangling buffer */
  46         size_t dm_len;                  /* size of dm_buf in bytes */
  47         char *dm_dem;                   /* start of demangled string (in buf) */
  48         uint_t dm_flags;                /* convert flags (see below) */
  49 } mdb_demangler_t;
  50 
  51 #define MDB_DM_QUAL     0x1             /* show static/const/volatile */
  52 #define MDB_DM_SCOPE    0x2             /* show function scope specifiers */
  53 #define MDB_DM_FUNCARG  0x4             /* show function arguments */
  54 #define MDB_DM_MANGLED  0x8             /* show mangled name */
  55 #define MDB_DM_ALL      0xf             /* mask of all valid flags */
  56 
  57 extern mdb_demangler_t *mdb_dem_load(void);
  58 extern void mdb_dem_unload(mdb_demangler_t *);
  59 extern const char *mdb_dem_convert(mdb_demangler_t *, const char *);
  60 
  61 extern int cmd_demangle(uintptr_t, uint_t, int, const mdb_arg_t *);
  62 extern int cmd_demflags(uintptr_t, uint_t, int, const mdb_arg_t *);
  63 extern int cmd_demstr(uintptr_t, uint_t, int, const mdb_arg_t *);
  64 
  65 #endif  /* _MDB */
  66 
  67 #ifdef  __cplusplus
  68 }
  69 #endif
  70 
  71 #endif  /* _MDB_DEMANGLE_H */