never@3156: /* never@3156: * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. never@3156: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. never@3156: * never@3156: * This code is free software; you can redistribute it and/or modify it never@3156: * under the terms of the GNU General Public License version 2 only, as never@3156: * published by the Free Software Foundation. never@3156: * never@3156: * This code is distributed in the hope that it will be useful, but WITHOUT never@3156: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or never@3156: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License never@3156: * version 2 for more details (a copy is included in the LICENSE file that never@3156: * accompanied this code). never@3156: * never@3156: * You should have received a copy of the GNU General Public License version never@3156: * 2 along with this work; if not, write to the Free Software Foundation, never@3156: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. never@3156: * never@3156: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA never@3156: * or visit www.oracle.com if you need additional information or have any never@3156: * questions. never@3156: * never@3156: */ never@3156: never@3156: #ifndef _SYMTAB_H_ never@3156: #define _SYMTAB_H_ never@3156: never@3156: #include never@3156: never@3156: // interface to manage ELF symbol tables never@3156: never@3156: struct symtab; never@3156: never@3156: // build symbol table for a given ELF file descriptor never@3156: struct symtab* build_symtab(int fd); never@3156: never@3156: // destroy the symbol table never@3156: void destroy_symtab(struct symtab* symtab); never@3156: never@3156: // search for symbol in the given symbol table. Adds offset never@3156: // to the base uintptr_t supplied. Returns NULL if not found. never@3156: uintptr_t search_symbol(struct symtab* symtab, uintptr_t base, never@3156: const char *sym_name, int *sym_size); never@3156: never@3156: // look for nearest symbol for a given offset (not address - base never@3156: // subtraction done by caller never@3156: const char* nearest_symbol(struct symtab* symtab, uintptr_t offset, never@3156: uintptr_t* poffset); never@3156: never@3156: #endif /*_SYMTAB_H_*/