ctf_error.c revision e083a0c2c99cea982dcf8e12ec3452cc575b5663
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync/*
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync * CDDL HEADER START
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync *
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync * The contents of this file are subject to the terms of the
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync * Common Development and Distribution License, Version 1.0 only
78a072e1b56619e3230735ae073668311232ec94vboxsync * (the "License"). You may not use this file except in compliance
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync * with the License.
78a072e1b56619e3230735ae073668311232ec94vboxsync *
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync * or http://www.opensolaris.org/os/licensing.
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync * See the License for the specific language governing permissions
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync * and limitations under the License.
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync *
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync * When distributing Covered Code, include this CDDL HEADER in each
2f139cbf73f9adba01382892f33558ad7bcb40cbvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
78a072e1b56619e3230735ae073668311232ec94vboxsync * If applicable, add the following below this CDDL HEADER, with the
78a072e1b56619e3230735ae073668311232ec94vboxsync * fields enclosed by brackets "[]" replaced with your own identifying
78a072e1b56619e3230735ae073668311232ec94vboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
78a072e1b56619e3230735ae073668311232ec94vboxsync *
78a072e1b56619e3230735ae073668311232ec94vboxsync * CDDL HEADER END
78a072e1b56619e3230735ae073668311232ec94vboxsync */
78a072e1b56619e3230735ae073668311232ec94vboxsync/*
78a072e1b56619e3230735ae073668311232ec94vboxsync * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
78a072e1b56619e3230735ae073668311232ec94vboxsync * Use is subject to license terms.
78a072e1b56619e3230735ae073668311232ec94vboxsync */
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync#pragma ident "%Z%%M% %I% %E% SMI"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync#include <ctf_impl.h>
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncstatic const char *const _ctf_errlist[] = {
78a072e1b56619e3230735ae073668311232ec94vboxsync "File is not in CTF or ELF format", /* ECTF_FMT */
78a072e1b56619e3230735ae073668311232ec94vboxsync "File uses more recent ELF version than libctf", /* ECTF_ELFVERS */
78a072e1b56619e3230735ae073668311232ec94vboxsync "File uses more recent CTF version than libctf", /* ECTF_CTFVERS */
78a072e1b56619e3230735ae073668311232ec94vboxsync "File is a different endian-ness than libctf", /* ECTF_ENDIAN */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Symbol table uses invalid entry size", /* ECTF_SYMTAB */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Symbol table data buffer is not valid", /* ECTF_SYMBAD */
78a072e1b56619e3230735ae073668311232ec94vboxsync "String table data buffer is not valid", /* ECTF_STRBAD */
78a072e1b56619e3230735ae073668311232ec94vboxsync "File data structure corruption detected", /* ECTF_CORRUPT */
78a072e1b56619e3230735ae073668311232ec94vboxsync "File does not contain CTF data", /* ECTF_NOCTFDATA */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Buffer does not contain CTF data", /* ECTF_NOCTFBUF */
1a4f596ce75683d6e0b330ac39510b2e177f3b43vboxsync "Symbol table information is not available", /* ECTF_NOSYMTAB */
5c65eaa08f2ec993a19c9bef6e5463918e40e0ebvboxsync "Type information is in parent and unavailable", /* ECTF_NOPARENT */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Cannot import types with different data model", /* ECTF_DMODEL */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Failed to mmap a needed data section", /* ECTF_MMAP */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Decompression package SUNWzlib not installed", /* ECTF_ZMISSING */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Failed to initialize decompression library", /* ECTF_ZINIT */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Failed to allocate decompression buffer", /* ECTF_ZALLOC */
78a072e1b56619e3230735ae073668311232ec94vboxsync "Failed to decompress CTF data", /* ECTF_DECOMPRESS */
78a072e1b56619e3230735ae073668311232ec94vboxsync "External string table is not available", /* ECTF_STRTAB */
"String name offset is corrupt", /* ECTF_BADNAME */
"Invalid type identifier", /* ECTF_BADID */
"Type is not a struct or union", /* ECTF_NOTSOU */
"Type is not an enum", /* ECTF_NOTENUM */
"Type is not a struct, union, or enum", /* ECTF_NOTSUE */
"Type is not an integer or float", /* ECTF_NOTINTFP */
"Type is not an array", /* ECTF_NOTARRAY */
"Type does not reference another type", /* ECTF_NOTREF */
"Input buffer is too small for type name", /* ECTF_NAMELEN */
"No type information available for that name", /* ECTF_NOTYPE */
"Syntax error in type name", /* ECTF_SYNTAX */
"Symbol table entry is not a function", /* ECTF_NOTFUNC */
"No function information available for symbol", /* ECTF_NOFUNCDAT */
"Symbol table entry is not a data object", /* ECTF_NOTDATA */
"No type information available for symbol", /* ECTF_NOTYPEDAT */
"No label information available for that name", /* ECTF_NOLABEL */
"File does not contain any labels", /* ECTF_NOLABELDATA */
"Feature not supported", /* ECTF_NOTSUP */
"Invalid enum element name", /* ECTF_NOENUMNAM */
"Invalid member name", /* ECTF_NOMEMBNAM */
"CTF container is read-only", /* ECTF_RDONLY */
"Limit on number of dynamic type members reached", /* ECTF_DTFULL */
"Limit on number of dynamic types reached", /* ECTF_FULL */
"Duplicate member name definition", /* ECTF_DUPMEMBER */
"Conflicting type is already defined", /* ECTF_CONFLICT */
};
static const int _ctf_nerr = sizeof (_ctf_errlist) / sizeof (_ctf_errlist[0]);
const char *
ctf_errmsg(int error)
{
const char *str;
if (error >= ECTF_BASE && (error - ECTF_BASE) < _ctf_nerr)
str = _ctf_errlist[error - ECTF_BASE];
else
str = ctf_strerror(error);
return (str ? str : "Unknown error");
}
int
ctf_errno(ctf_file_t *fp)
{
return (fp->ctf_errno);
}