static const gchar *
get_error_string (AppError error)
{
  const gchar *str;

#define DEFINE_ERROR(error, error_string)       \
    case APP_ERROR_##error:                     \
        str = error_string;                     \
        break

  switch (error) {
      DEFINE_ERROR (NONE, "<none>");
      DEFINE_ERROR (DECODER, "decoder");
      DEFINE_ERROR (RENDERER, "renderer");
    default:
      str = "unknown";
      break;
  }
#undef DEFINE_ERROR

  return str;
}
#include "libelf.h"
#include <stdio.h>
#include <string.h>

#include "_libelf.h"

ELFTC_VCSID("$Id: elf_errmsg.c 2225 2011-11-26 18:55:54Z jkoshy $");

/*
 * Retrieve a human readable translation for an error message.
 */

const char *_libelf_errors[] = {
#define	DEFINE_ERROR(N,S)	[ELF_E_##N] = S
	DEFINE_ERROR(NONE,	"No Error"),
	DEFINE_ERROR(ARCHIVE,	"Malformed ar(1) archive"),
	DEFINE_ERROR(ARGUMENT,	"Invalid argument"),
	DEFINE_ERROR(CLASS,	"ELF class mismatch"),
	DEFINE_ERROR(DATA,	"Invalid data buffer descriptor"),
	DEFINE_ERROR(HEADER,	"Missing or malformed ELF header"),
	DEFINE_ERROR(IO,	"I/O error"),
	DEFINE_ERROR(LAYOUT,	"Layout constraint violation"),
	DEFINE_ERROR(MODE,	"Incorrect ELF descriptor mode"),
	DEFINE_ERROR(RANGE,	"Value out of range of target"),
	DEFINE_ERROR(RESOURCE,	"Resource exhaustion"),
	DEFINE_ERROR(SECTION,	"Invalid section descriptor"),
	DEFINE_ERROR(SEQUENCE,	"API calls out of sequence"),
	DEFINE_ERROR(UNIMPL,	"Unimplemented feature"),
	DEFINE_ERROR(VERSION,	"Unknown ELF API version"),
	DEFINE_ERROR(NUM,	"Unknown error")
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: src/lib/libdwarf/dwarf_errmsg.c,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
 */

#if HAVE_NBTOOL_CONFIG_H
# include "nbtool_config.h"
#endif

#include <stdio.h>
#include "_libdwarf.h"

const char *_libdwarf_errors[] = {
#define	DEFINE_ERROR(N,S)		[DWARF_E_##N] = S
	DEFINE_ERROR(NONE,		"No Error"),
	DEFINE_ERROR(ERROR,		"An error"),
	DEFINE_ERROR(NO_ENTRY,		"No entry found"),
	DEFINE_ERROR(ARGUMENT,		"Invalid argument"),
	DEFINE_ERROR(DEBUG_INFO,	"Debug info NULL"),
	DEFINE_ERROR(MEMORY,		"Insufficient memory"),
	DEFINE_ERROR(ELF,		"ELF error"),
	DEFINE_ERROR(INVALID_CU,	"Invalid compilation unit data"),
	DEFINE_ERROR(CU_VERSION,	"Wrong CU version. Only 2 and 3 supported"),
	DEFINE_ERROR(MISSING_ABBREV,	"Abbrev not found"),
	DEFINE_ERROR(NOT_IMPLEMENTED,	"Unimplemented code at"),
	DEFINE_ERROR(CU_CURRENT,	"No current compilation unit"),
	DEFINE_ERROR(BAD_FORM,		"Wrong form type for attribute value"),
	DEFINE_ERROR(INVALID_EXPR,	"Invalid DWARF expression"),
	DEFINE_ERROR(NUM,		"Unknown DWARF error")
#undef	DEFINE_ERROR
Beispiel #4
0
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include "_libdwarf.h"

ELFTC_VCSID("$Id: dwarf_errmsg.c 2576 2012-09-13 09:16:11Z jkoshy $");

static const char *_libdwarf_errors[] = {
#define	DEFINE_ERROR(N,S)		[DW_DLE_##N] = S
	DEFINE_ERROR(NONE, "No Error"),
	DEFINE_ERROR(ERROR, "An error"),
	DEFINE_ERROR(NO_ENTRY, "No entry found"),
	DEFINE_ERROR(ARGUMENT, "Invalid argument"),
	DEFINE_ERROR(DEBUG_INFO_NULL, "Debug info NULL"),
	DEFINE_ERROR(MEMORY, "Insufficient memory"),
	DEFINE_ERROR(ELF, "ELF error"),
	DEFINE_ERROR(CU_LENGTH_ERROR, "Invalid compilation unit data"),
	DEFINE_ERROR(VERSION_STAMP_ERROR, "Unsupported version"),
	DEFINE_ERROR(DEBUG_ABBREV_NULL, "Abbrev not found"),
	DEFINE_ERROR(DIE_NO_CU_CONTEXT,	"No current compilation unit"),
	DEFINE_ERROR(LOC_EXPR_BAD, "Invalid location expression"),
	DEFINE_ERROR(EXPR_LENGTH_BAD, "Invalid DWARF expression length"),
	DEFINE_ERROR(DEBUG_LOC_SECTION_SHORT, "Loclist section too short"),
	DEFINE_ERROR(ATTR_FORM_BAD, "Invalid attribute form"),
	DEFINE_ERROR(DEBUG_LINE_LENGTH_BAD, "Line info section too short"),