17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate #include <mdb/mdb_signal.h>
287c478bd9Sstevel@tonic-gate #include <mdb/mdb_err.h>
297c478bd9Sstevel@tonic-gate #include <mdb/mdb.h>
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate #include <thread_db.h>
327c478bd9Sstevel@tonic-gate #include <rtld_db.h>
337c478bd9Sstevel@tonic-gate #include <libctf.h>
347c478bd9Sstevel@tonic-gate #include <strings.h>
357c478bd9Sstevel@tonic-gate #include <stdlib.h>
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate static const char *const _mdb_errlist[] = {
387c478bd9Sstevel@tonic-gate "unknown symbol name", /* EMDB_NOSYM */
397c478bd9Sstevel@tonic-gate "unknown object file name", /* EMDB_NOOBJ */
407c478bd9Sstevel@tonic-gate "no mapping for address", /* EMDB_NOMAP */
417c478bd9Sstevel@tonic-gate "unknown dcmd name", /* EMDB_NODCMD */
427c478bd9Sstevel@tonic-gate "unknown walk name", /* EMDB_NOWALK */
437c478bd9Sstevel@tonic-gate "dcmd name already in use", /* EMDB_DCMDEXISTS */
447c478bd9Sstevel@tonic-gate "walk name already in use", /* EMDB_WALKEXISTS */
457c478bd9Sstevel@tonic-gate "no support for platform", /* EMDB_NOPLAT */
467c478bd9Sstevel@tonic-gate "no process active", /* EMDB_NOPROC */
477c478bd9Sstevel@tonic-gate "specified name is too long", /* EMDB_NAME2BIG */
487c478bd9Sstevel@tonic-gate "specified name contains illegal characters", /* EMDB_NAMEBAD */
497c478bd9Sstevel@tonic-gate "failed to allocate needed memory", /* EMDB_ALLOC */
507c478bd9Sstevel@tonic-gate "specified module is not loaded", /* EMDB_NOMOD */
517c478bd9Sstevel@tonic-gate "cannot unload built-in module", /* EMDB_BUILTINMOD */
527c478bd9Sstevel@tonic-gate "no walk is currently active", /* EMDB_NOWCB */
537c478bd9Sstevel@tonic-gate "invalid walk state argument", /* EMDB_BADWCB */
547c478bd9Sstevel@tonic-gate "walker does not accept starting address", /* EMDB_NOWALKLOC */
557c478bd9Sstevel@tonic-gate "walker requires starting address", /* EMDB_NOWALKGLOB */
567c478bd9Sstevel@tonic-gate "failed to initialize walk", /* EMDB_WALKINIT */
577c478bd9Sstevel@tonic-gate "walker cannot be layered on itself", /* EMDB_WALKLOOP */
587c478bd9Sstevel@tonic-gate "i/o stream is read-only", /* EMDB_IORO */
597c478bd9Sstevel@tonic-gate "i/o stream is write-only", /* EMDB_IOWO */
607c478bd9Sstevel@tonic-gate "no symbol corresponds to address", /* EMDB_NOSYMADDR */
617c478bd9Sstevel@tonic-gate "unknown disassembler name", /* EMDB_NODIS */
627c478bd9Sstevel@tonic-gate "disassembler name already in use", /* EMDB_DISEXISTS */
637c478bd9Sstevel@tonic-gate "no such software event specifier", /* EMDB_NOSESPEC */
647c478bd9Sstevel@tonic-gate "no such xdata available", /* EMDB_NOXD */
657c478bd9Sstevel@tonic-gate "xdata name already in use", /* EMDB_XDEXISTS */
667c478bd9Sstevel@tonic-gate "operation not supported by target", /* EMDB_TGTNOTSUP */
677c478bd9Sstevel@tonic-gate "target is not open for writing", /* EMDB_TGTRDONLY */
687c478bd9Sstevel@tonic-gate "invalid register name", /* EMDB_BADREG */
697c478bd9Sstevel@tonic-gate "no register set available for thread", /* EMDB_NOREGS */
707c478bd9Sstevel@tonic-gate "stack address is not properly aligned", /* EMDB_STKALIGN */
717c478bd9Sstevel@tonic-gate "no executable file is open", /* EMDB_NOEXEC */
727c478bd9Sstevel@tonic-gate "failed to evaluate command", /* EMDB_EVAL */
737c478bd9Sstevel@tonic-gate "command cancelled by user", /* EMDB_CANCEL */
747c478bd9Sstevel@tonic-gate "only %lu of %lu bytes could be read", /* EMDB_PARTIAL */
757c478bd9Sstevel@tonic-gate "dcmd failed", /* EMDB_DCFAIL */
767c478bd9Sstevel@tonic-gate "improper dcmd usage", /* EMDB_DCUSAGE */
777c478bd9Sstevel@tonic-gate "target error", /* EMDB_TGT */
787c478bd9Sstevel@tonic-gate "invalid system call number", /* EMDB_BADSYSNUM */
797c478bd9Sstevel@tonic-gate "invalid signal number", /* EMDB_BADSIGNUM */
807c478bd9Sstevel@tonic-gate "invalid fault number", /* EMDB_BADFLTNUM */
817c478bd9Sstevel@tonic-gate "target is currently executing", /* EMDB_TGTBUSY */
827c478bd9Sstevel@tonic-gate "target has completed execution", /* EMDB_TGTZOMB */
837c478bd9Sstevel@tonic-gate "target is a core file", /* EMDB_TGTCORE */
847c478bd9Sstevel@tonic-gate "debugger lost control of target", /* EMDB_TGTLOST */
857c478bd9Sstevel@tonic-gate "libthread_db call failed unexpectedly", /* EMDB_TDB */
867c478bd9Sstevel@tonic-gate "failed to dlopen library", /* EMDB_RTLD */
877c478bd9Sstevel@tonic-gate "librtld_db call failed unexpectedly", /* EMDB_RTLD_DB */
887c478bd9Sstevel@tonic-gate "runtime linker data not available", /* EMDB_NORTLD */
897c478bd9Sstevel@tonic-gate "invalid thread identifier", /* EMDB_NOTHREAD */
907c478bd9Sstevel@tonic-gate "event specifier disabled", /* EMDB_SPECDIS */
917c478bd9Sstevel@tonic-gate "unknown link map id", /* EMDB_NOLMID */
927c478bd9Sstevel@tonic-gate "failed to determine return address", /* EMDB_NORETADDR */
937c478bd9Sstevel@tonic-gate "watchpoint size exceeds address space limit", /* EMDB_WPRANGE */
947c478bd9Sstevel@tonic-gate "conflict with existing watchpoint", /* EMDB_WPDUP */
957c478bd9Sstevel@tonic-gate "address not aligned on an instruction boundary", /* EMDB_BPALIGN */
967c478bd9Sstevel@tonic-gate "library is missing demangler entry point", /* EMDB_NODEM */
977c478bd9Sstevel@tonic-gate "cannot read past current end of file", /* EMDB_EOF */
987c478bd9Sstevel@tonic-gate "no symbolic debug information available for module", /* EMDB_NOCTF */
997c478bd9Sstevel@tonic-gate "libctf call failed unexpectedly", /* EMDB_CTF */
1007c478bd9Sstevel@tonic-gate "thread local storage has not yet been allocated", /* EMDB_TLS */
1017c478bd9Sstevel@tonic-gate "object does not support thread local storage", /* EMDB_NOTLS */
1027c478bd9Sstevel@tonic-gate "no such member of structure or union", /* EMDB_CTFNOMEMB */
1037c478bd9Sstevel@tonic-gate "inappropriate context for action", /* EMDB_CTX */
1047c478bd9Sstevel@tonic-gate "module incompatible with target", /* EMDB_INCOMPAT */
1057c478bd9Sstevel@tonic-gate "operation not supported by target on this platform",
1067c478bd9Sstevel@tonic-gate /* EMDB_TGTHWNOTSUP */
1077c478bd9Sstevel@tonic-gate "kmdb is not loaded", /* EMDB_KINACTIVE */
1087c478bd9Sstevel@tonic-gate "kmdb is loading", /* EMDB_KACTIVATING */
1097c478bd9Sstevel@tonic-gate "kmdb is already loaded", /* EMDB_KACTIVE */
1107c478bd9Sstevel@tonic-gate "kmdb is unloading", /* EMDB_KDEACTIVATING */
1117c478bd9Sstevel@tonic-gate "kmdb could not be loaded", /* EMDB_KNOLOAD */
1127c478bd9Sstevel@tonic-gate "boot-loaded kmdb cannot be unloaded", /* EMDB_KNOUNLOAD */
1137c478bd9Sstevel@tonic-gate "too many enabled watchpoints for this machine", /* EMDB_WPTOOMANY */
1147c478bd9Sstevel@tonic-gate "DTrace is active", /* EMDB_DTACTIVE */
1150b453801SGordon Ross "boot-loaded module cannot be unloaded", /* EMDB_KMODNOUNLOAD */
116*64e4e50aSKeith M Wesolowski "stack frame pointer is invalid", /* EMDB_STKFRAME */
117*64e4e50aSKeith M Wesolowski "unexpected short write" /* EMDB_SHORTWRITE */
1180b453801SGordon Ross
1197c478bd9Sstevel@tonic-gate };
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate static const int _mdb_nerr = sizeof (_mdb_errlist) / sizeof (_mdb_errlist[0]);
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gate static size_t errno_rbytes; /* EMDB_PARTIAL actual bytes read */
1247c478bd9Sstevel@tonic-gate static size_t errno_nbytes; /* EMDB_PARTIAL total bytes requested */
1257c478bd9Sstevel@tonic-gate static int errno_libctf; /* EMDB_CTF underlying error code */
1267c478bd9Sstevel@tonic-gate #ifndef _KMDB
1277c478bd9Sstevel@tonic-gate static int errno_rtld_db; /* EMDB_RTLD_DB underlying error code */
1287c478bd9Sstevel@tonic-gate #endif
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gate const char *
mdb_strerror(int err)1317c478bd9Sstevel@tonic-gate mdb_strerror(int err)
1327c478bd9Sstevel@tonic-gate {
1337c478bd9Sstevel@tonic-gate static char buf[256];
1347c478bd9Sstevel@tonic-gate const char *str;
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate if (err >= EMDB_BASE && (err - EMDB_BASE) < _mdb_nerr)
1377c478bd9Sstevel@tonic-gate str = _mdb_errlist[err - EMDB_BASE];
1387c478bd9Sstevel@tonic-gate else
1397c478bd9Sstevel@tonic-gate str = strerror(err);
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate switch (err) {
1427c478bd9Sstevel@tonic-gate case EMDB_PARTIAL:
1437c478bd9Sstevel@tonic-gate (void) mdb_iob_snprintf(buf, sizeof (buf), str,
1447c478bd9Sstevel@tonic-gate errno_rbytes, errno_nbytes);
1457c478bd9Sstevel@tonic-gate str = buf;
1467c478bd9Sstevel@tonic-gate break;
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate #ifndef _KMDB
1497c478bd9Sstevel@tonic-gate case EMDB_RTLD_DB:
1507c478bd9Sstevel@tonic-gate if (rd_errstr(errno_rtld_db) != NULL)
1517c478bd9Sstevel@tonic-gate str = rd_errstr(errno_rtld_db);
1527c478bd9Sstevel@tonic-gate break;
1537c478bd9Sstevel@tonic-gate #endif
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate case EMDB_CTF:
1567c478bd9Sstevel@tonic-gate if (ctf_errmsg(errno_libctf) != NULL)
1577c478bd9Sstevel@tonic-gate str = ctf_errmsg(errno_libctf);
1587c478bd9Sstevel@tonic-gate break;
1597c478bd9Sstevel@tonic-gate }
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gate return (str ? str : "unknown error");
1627c478bd9Sstevel@tonic-gate }
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gate void
vwarn(const char * format,va_list alist)1657c478bd9Sstevel@tonic-gate vwarn(const char *format, va_list alist)
1667c478bd9Sstevel@tonic-gate {
1677c478bd9Sstevel@tonic-gate int err = errno;
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gate mdb_iob_printf(mdb.m_err, "%s: ", mdb.m_pname);
1707c478bd9Sstevel@tonic-gate mdb_iob_vprintf(mdb.m_err, format, alist);
1717c478bd9Sstevel@tonic-gate
1727c478bd9Sstevel@tonic-gate if (strchr(format, '\n') == NULL)
1737c478bd9Sstevel@tonic-gate mdb_iob_printf(mdb.m_err, ": %s\n", mdb_strerror(err));
1747c478bd9Sstevel@tonic-gate }
1757c478bd9Sstevel@tonic-gate
1767c478bd9Sstevel@tonic-gate void
vdie(const char * format,va_list alist)1777c478bd9Sstevel@tonic-gate vdie(const char *format, va_list alist)
1787c478bd9Sstevel@tonic-gate {
1797c478bd9Sstevel@tonic-gate vwarn(format, alist);
1807c478bd9Sstevel@tonic-gate mdb_destroy();
1817c478bd9Sstevel@tonic-gate exit(1);
1827c478bd9Sstevel@tonic-gate }
1837c478bd9Sstevel@tonic-gate
1847c478bd9Sstevel@tonic-gate void
vfail(const char * format,va_list alist)1857c478bd9Sstevel@tonic-gate vfail(const char *format, va_list alist)
1867c478bd9Sstevel@tonic-gate {
1877c478bd9Sstevel@tonic-gate extern const char *volatile _mdb_abort_str;
1887c478bd9Sstevel@tonic-gate static char buf[256];
1897c478bd9Sstevel@tonic-gate static int nfail;
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gate if (_mdb_abort_str == NULL) {
1927c478bd9Sstevel@tonic-gate _mdb_abort_str = buf; /* Do this first so we don't recurse */
1937c478bd9Sstevel@tonic-gate (void) mdb_iob_vsnprintf(buf, sizeof (buf), format, alist);
1947c478bd9Sstevel@tonic-gate
1957c478bd9Sstevel@tonic-gate nfail = 1;
1967c478bd9Sstevel@tonic-gate }
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gate /*
1997c478bd9Sstevel@tonic-gate * We'll try to print failure messages twice. Any more than that,
2007c478bd9Sstevel@tonic-gate * and we're probably hitting an assertion or some other problem in
2017c478bd9Sstevel@tonic-gate * the printing routines, and will recurse until we run out of stack.
2027c478bd9Sstevel@tonic-gate */
2037c478bd9Sstevel@tonic-gate if (nfail++ < 3) {
2047c478bd9Sstevel@tonic-gate mdb_iob_printf(mdb.m_err, "%s ABORT: ", mdb.m_pname);
2057c478bd9Sstevel@tonic-gate mdb_iob_vprintf(mdb.m_err, format, alist);
2067c478bd9Sstevel@tonic-gate mdb_iob_flush(mdb.m_err);
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gate (void) mdb_signal_blockall();
2097c478bd9Sstevel@tonic-gate (void) mdb_signal_raise(SIGABRT);
2107c478bd9Sstevel@tonic-gate (void) mdb_signal_unblock(SIGABRT);
2117c478bd9Sstevel@tonic-gate }
2127c478bd9Sstevel@tonic-gate
2137c478bd9Sstevel@tonic-gate exit(1);
2147c478bd9Sstevel@tonic-gate }
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
2177c478bd9Sstevel@tonic-gate void
warn(const char * format,...)2187c478bd9Sstevel@tonic-gate warn(const char *format, ...)
2197c478bd9Sstevel@tonic-gate {
2207c478bd9Sstevel@tonic-gate va_list alist;
2217c478bd9Sstevel@tonic-gate
2227c478bd9Sstevel@tonic-gate va_start(alist, format);
2237c478bd9Sstevel@tonic-gate vwarn(format, alist);
2247c478bd9Sstevel@tonic-gate va_end(alist);
2257c478bd9Sstevel@tonic-gate }
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
2287c478bd9Sstevel@tonic-gate void
die(const char * format,...)2297c478bd9Sstevel@tonic-gate die(const char *format, ...)
2307c478bd9Sstevel@tonic-gate {
2317c478bd9Sstevel@tonic-gate va_list alist;
2327c478bd9Sstevel@tonic-gate
2337c478bd9Sstevel@tonic-gate va_start(alist, format);
2347c478bd9Sstevel@tonic-gate vdie(format, alist);
2357c478bd9Sstevel@tonic-gate va_end(alist);
2367c478bd9Sstevel@tonic-gate }
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
2397c478bd9Sstevel@tonic-gate void
fail(const char * format,...)2407c478bd9Sstevel@tonic-gate fail(const char *format, ...)
2417c478bd9Sstevel@tonic-gate {
2427c478bd9Sstevel@tonic-gate va_list alist;
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate va_start(alist, format);
2457c478bd9Sstevel@tonic-gate vfail(format, alist);
2467c478bd9Sstevel@tonic-gate va_end(alist);
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate
2497c478bd9Sstevel@tonic-gate int
set_errbytes(size_t rbytes,size_t nbytes)2507c478bd9Sstevel@tonic-gate set_errbytes(size_t rbytes, size_t nbytes)
2517c478bd9Sstevel@tonic-gate {
2527c478bd9Sstevel@tonic-gate errno_rbytes = rbytes;
2537c478bd9Sstevel@tonic-gate errno_nbytes = nbytes;
2547c478bd9Sstevel@tonic-gate errno = EMDB_PARTIAL;
2557c478bd9Sstevel@tonic-gate return (-1);
2567c478bd9Sstevel@tonic-gate }
2577c478bd9Sstevel@tonic-gate
2587c478bd9Sstevel@tonic-gate int
set_errno(int err)2597c478bd9Sstevel@tonic-gate set_errno(int err)
2607c478bd9Sstevel@tonic-gate {
2617c478bd9Sstevel@tonic-gate errno = err;
2627c478bd9Sstevel@tonic-gate return (-1);
2637c478bd9Sstevel@tonic-gate }
2647c478bd9Sstevel@tonic-gate
2657c478bd9Sstevel@tonic-gate int
ctf_to_errno(int err)2667c478bd9Sstevel@tonic-gate ctf_to_errno(int err)
2677c478bd9Sstevel@tonic-gate {
2687c478bd9Sstevel@tonic-gate errno_libctf = err;
2697c478bd9Sstevel@tonic-gate return (EMDB_CTF);
2707c478bd9Sstevel@tonic-gate }
2717c478bd9Sstevel@tonic-gate
2727c478bd9Sstevel@tonic-gate #ifndef _KMDB
2737c478bd9Sstevel@tonic-gate /*
2747c478bd9Sstevel@tonic-gate * The libthread_db interface is a superfund site and provides no strerror
2757c478bd9Sstevel@tonic-gate * equivalent for us to call: we try to provide some sensible handling for its
2767c478bd9Sstevel@tonic-gate * garbage bin of error return codes here. First of all, we don't bother
2777c478bd9Sstevel@tonic-gate * interpreting all of the possibilities, since many of them aren't even used
2787c478bd9Sstevel@tonic-gate * in the implementation anymore. We try to map thread_db errors we may see
2797c478bd9Sstevel@tonic-gate * to UNIX errnos or mdb errnos as appropriate.
2807c478bd9Sstevel@tonic-gate */
2817c478bd9Sstevel@tonic-gate int
tdb_to_errno(int err)2827c478bd9Sstevel@tonic-gate tdb_to_errno(int err)
2837c478bd9Sstevel@tonic-gate {
2847c478bd9Sstevel@tonic-gate switch (err) {
2857c478bd9Sstevel@tonic-gate case TD_OK:
2867c478bd9Sstevel@tonic-gate case TD_PARTIALREG:
2877c478bd9Sstevel@tonic-gate return (0);
2887c478bd9Sstevel@tonic-gate case TD_NOCAPAB:
2897c478bd9Sstevel@tonic-gate return (ENOTSUP);
2907c478bd9Sstevel@tonic-gate case TD_BADPH:
2917c478bd9Sstevel@tonic-gate case TD_BADTH:
2927c478bd9Sstevel@tonic-gate case TD_BADSH:
2937c478bd9Sstevel@tonic-gate case TD_BADTA:
2947c478bd9Sstevel@tonic-gate case TD_BADKEY:
2957c478bd9Sstevel@tonic-gate case TD_NOEVENT:
2967c478bd9Sstevel@tonic-gate return (EINVAL);
2977c478bd9Sstevel@tonic-gate case TD_NOFPREGS:
2987c478bd9Sstevel@tonic-gate case TD_NOXREGS:
2997c478bd9Sstevel@tonic-gate return (EMDB_NOREGS);
3007c478bd9Sstevel@tonic-gate case TD_NOTHR:
3017c478bd9Sstevel@tonic-gate return (EMDB_NOTHREAD);
3027c478bd9Sstevel@tonic-gate case TD_MALLOC:
3037c478bd9Sstevel@tonic-gate return (EMDB_ALLOC);
3047c478bd9Sstevel@tonic-gate case TD_TLSDEFER:
3057c478bd9Sstevel@tonic-gate return (EMDB_TLS);
3067c478bd9Sstevel@tonic-gate case TD_NOTLS:
3077c478bd9Sstevel@tonic-gate return (EMDB_NOTLS);
3087c478bd9Sstevel@tonic-gate case TD_DBERR:
3097c478bd9Sstevel@tonic-gate case TD_ERR:
3107c478bd9Sstevel@tonic-gate default:
3117c478bd9Sstevel@tonic-gate return (EMDB_TDB);
3127c478bd9Sstevel@tonic-gate }
3137c478bd9Sstevel@tonic-gate }
3147c478bd9Sstevel@tonic-gate
3157c478bd9Sstevel@tonic-gate int
rdb_to_errno(int err)3167c478bd9Sstevel@tonic-gate rdb_to_errno(int err)
3177c478bd9Sstevel@tonic-gate {
3187c478bd9Sstevel@tonic-gate errno_rtld_db = err;
3197c478bd9Sstevel@tonic-gate return (EMDB_RTLD_DB);
3207c478bd9Sstevel@tonic-gate }
3217c478bd9Sstevel@tonic-gate #endif /* _KMDB */
322