< prev index next >
src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
Print this page
*** 33,47 ****
// ----------------------------------------------------
// functions for symbol lookups
// ----------------------------------------------------
- struct elf_section {
- ELF_SHDR *c_shdr;
- void *c_data;
- };
-
struct elf_symbol {
char *name;
uintptr_t offset;
uintptr_t size;
};
--- 33,42 ----
*** 156,196 ****
close(fd);
return -1;
}
}
- /* Find an ELF section. */
- static struct elf_section *find_section_by_name(char *name,
- int fd,
- ELF_EHDR *ehdr,
- struct elf_section *scn_cache)
- {
- char *strtab;
- int cnt;
- int strtab_size;
-
- // Section cache have to already contain data for e_shstrndx section.
- // If it's not true - elf file is broken, so just bail out
- if (scn_cache[ehdr->e_shstrndx].c_data == NULL) {
- return NULL;
- }
-
- strtab = scn_cache[ehdr->e_shstrndx].c_data;
- strtab_size = scn_cache[ehdr->e_shstrndx].c_shdr->sh_size;
-
- for (cnt = 0; cnt < ehdr->e_shnum; ++cnt) {
- if (scn_cache[cnt].c_shdr->sh_name < strtab_size) {
- if (strcmp(scn_cache[cnt].c_shdr->sh_name + strtab, name) == 0) {
- scn_cache[cnt].c_data = read_section_data(fd, ehdr, scn_cache[cnt].c_shdr);
- return &scn_cache[cnt];
- }
- }
- }
-
- return NULL;
- }
-
/* Look for a ".gnu_debuglink" section. If one exists, try to open a
suitable debuginfo file. */
static int open_file_from_debug_link(const char *name,
int fd,
ELF_EHDR *ehdr,
--- 151,160 ----
< prev index next >