diff options
author | johnlev <none@none> | 2006-09-13 11:29:23 -0700 |
---|---|---|
committer | johnlev <none@none> | 2006-09-13 11:29:23 -0700 |
commit | e824d57f8160a27ac5e650005c7a4f037109c2be (patch) | |
tree | 0377a5089265cc3a883aea1b1d36228d73671239 /usr/src/tools/ctf/cvt/util.c | |
parent | c62a497d57b723da895936c9a5d3b193efe0a3e2 (diff) | |
download | illumos-gate-e824d57f8160a27ac5e650005c7a4f037109c2be.tar.gz |
6338238 DWARF parser can't handle anon struct/union
6415645 cpu_t hack isn't working as expected
6441836 ctffindmod.sh still talks about ia64
6458224 genassym could handle blank lines better
--HG--
rename : usr/src/tools/ctf/cvt/st_bugs.c => usr/src/tools/ctf/cvt/fixup_tdescs.c
Diffstat (limited to 'usr/src/tools/ctf/cvt/util.c')
-rw-r--r-- | usr/src/tools/ctf/cvt/util.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/usr/src/tools/ctf/cvt/util.c b/usr/src/tools/ctf/cvt/util.c index c7857fb1ab..799ca1279c 100644 --- a/usr/src/tools/ctf/cvt/util.c +++ b/usr/src/tools/ctf/cvt/util.c @@ -47,7 +47,7 @@ static void (*terminate_cleanup)() = NULL; /* returns 1 if s1 == s2, 0 otherwise */ int -streq(char *s1, char *s2) +streq(const char *s1, const char *s2) { if (s1 == NULL) { if (s2 != NULL) @@ -93,6 +93,27 @@ findelfsecidx(Elf *elf, const char *file, const char *tofind) return (-1); } +size_t +elf_ptrsz(Elf *elf) +{ + GElf_Ehdr ehdr; + + if (gelf_getehdr(elf, &ehdr) == NULL) { + terminate("failed to read ELF header: %s\n", + elf_errmsg(-1)); + } + + if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) + return (4); + else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) + return (8); + else + terminate("unknown ELF class %d\n", ehdr.e_ident[EI_CLASS]); + + /*NOTREACHED*/ + return (0); +} + /*PRINTFLIKE2*/ static void whine(char *type, char *format, va_list ap) |