From owner-p4-projects@FreeBSD.ORG Wed Aug 16 01:32:20 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5633216A4E1; Wed, 16 Aug 2006 01:32:20 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3515116A4DE for ; Wed, 16 Aug 2006 01:32:20 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D87A143D46 for ; Wed, 16 Aug 2006 01:32:19 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7G1WJEP094621 for ; Wed, 16 Aug 2006 01:32:19 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7G1WJkq094618 for perforce@freebsd.org; Wed, 16 Aug 2006 01:32:19 GMT (envelope-from jb@freebsd.org) Date: Wed, 16 Aug 2006 01:32:19 GMT Message-Id: <200608160132.k7G1WJkq094618@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 104168 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2006 01:32:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=104168 Change 104168 by jb@jb_freebsd2 on 2006/08/16 01:31:26 Report ELF class, data type and OS ABI. Affected files ... .. //depot/projects/dtrace/src/lib/libelf/elf_dump.c#2 edit .. //depot/projects/dtrace/src/lib/libelf/libelf_dump.c#2 edit Differences ... ==== //depot/projects/dtrace/src/lib/libelf/elf_dump.c#2 (text+ko) ==== @@ -37,6 +37,53 @@ #include "_libelf.h" static const char * +ei_class_str(u_int ei_class) +{ + switch (ei_class) { + case ELFCLASSNONE: return("ELFCLASSNONE"); + case ELFCLASS32: return("ELFCLASS32"); + case ELFCLASS64: return("ELFCLASS64"); + default: return (NULL); + } +} + +static const char * +ei_data_str(u_int ei_data) +{ + switch (ei_data) { + case ELFDATANONE: return("ELFDATANONE"); + case ELFDATA2LSB: return("ELFDATA2LSB"); + case ELFDATA2MSB: return("ELFDATA2MSB"); + default: return (NULL); + } +} + +static const char * +ei_osabi_str(u_int ei_osabi) +{ + switch (ei_osabi) { + case ELFOSABI_NONE: return("ELFOSABI_NONE"); + case ELFOSABI_86OPEN: return("ELFOSABI_86OPEN"); + case ELFOSABI_AIX: return("ELFOSABI_AIX"); + case ELFOSABI_ARM: return("ELFOSABI_ARM"); + case ELFOSABI_FREEBSD: return("ELFOSABI_FREEBSD"); + case ELFOSABI_HPUX: return("ELFOSABI_HPUX"); + case ELFOSABI_HURD: return("ELFOSABI_HURD"); + case ELFOSABI_IRIX: return("ELFOSABI_IRIX"); + case ELFOSABI_LINUX: return("ELFOSABI_LINUX"); + case ELFOSABI_MODESTO: return("ELFOSABI_MODESTO"); + case ELFOSABI_NETBSD: return("ELFOSABI_NETBSD"); + case ELFOSABI_NSK: return("ELFOSABI_NSK"); + case ELFOSABI_OPENBSD: return("ELFOSABI_OPENBSD"); + case ELFOSABI_OPENVMS: return("ELFOSABI_OPENVMS"); + case ELFOSABI_SOLARIS: return("ELFOSABI_SOLARIS"); + case ELFOSABI_STANDALONE: return("ELFOSABI_STANDALONE"); + case ELFOSABI_TRU64: return("ELFOSABI_TRU64"); + default: return (NULL); + } +} + +static const char * et_str(u_int e_type) { switch (e_type) { ==== //depot/projects/dtrace/src/lib/libelf/libelf_dump.c#2 (text+ko) ==== @@ -48,12 +48,27 @@ if ((flags & ELF_DUMP_EHDR) != 0) { printf("\nelf header:\n\n"); - printf("\te_ident: "); + printf("\te_ident:"); + if ((s = ei_class_str(ehdr->e_ident[EI_CLASS])) == NULL) { + snprintf(s1, sizeof(s1), "%u", ehdr->e_ident[EI_CLASS]); + s = s1; + } + printf(" %s", s); + if ((s = ei_data_str(ehdr->e_ident[EI_DATA])) == NULL) { + snprintf(s1, sizeof(s1), "%u", ehdr->e_ident[EI_DATA]); + s = s1; + } + printf(" %s", s); + if ((s = ei_osabi_str(ehdr->e_ident[EI_OSABI])) == NULL) { + snprintf(s1, sizeof(s1), "%u", ehdr->e_ident[EI_OSABI]); + s = s1; + } + printf(" %s\n", s); if ((s = et_str(ehdr->e_type)) == NULL) { snprintf(s1, sizeof(s1), "%hu", ehdr->e_type); s = s1; } - printf("\n\te_type: %s\n", s); + printf("\te_type: %s\n", s); if ((s = em_str(ehdr->e_machine)) == NULL) { snprintf(s1, sizeof(s1), "%hu", ehdr->e_machine); s = s1;