< prev index next >
src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -33,15 +33,10 @@
// ----------------------------------------------------
// 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;
};
@@ -156,41 +151,10 @@
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,
< prev index next >