aboutsummaryrefslogtreecommitdiff
path: root/elfcpp/elfcpp_file.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-11-09 23:18:16 +0000
committerIan Lance Taylor <iant@google.com>2007-11-09 23:18:16 +0000
commitf2f3f783381d38edadb126e8d9f79a7dc4a8847f (patch)
treeee3a175a1f964d0ea7adf45c231c38c136386239 /elfcpp/elfcpp_file.h
parent4c50553d987166e6f2ee3aa56e286dc4b9e82cbc (diff)
downloadgdb-f2f3f783381d38edadb126e8d9f79a7dc4a8847f.zip
gdb-f2f3f783381d38edadb126e8d9f79a7dc4a8847f.tar.gz
gdb-f2f3f783381d38edadb126e8d9f79a7dc4a8847f.tar.bz2
From Craig Silverstein: Implement section_info.
Diffstat (limited to 'elfcpp/elfcpp_file.h')
-rw-r--r--elfcpp/elfcpp_file.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/elfcpp/elfcpp_file.h b/elfcpp/elfcpp_file.h
index 7462bb8..3228332 100644
--- a/elfcpp/elfcpp_file.h
+++ b/elfcpp/elfcpp_file.h
@@ -143,6 +143,11 @@ class Elf_file
Elf_Word
section_link(unsigned int shndx);
+ // Return the info field of section SHNDX.
+ Elf_Word
+ section_info(unsigned int shndx);
+
+
private:
// Shared constructor code.
void
@@ -348,6 +353,25 @@ Elf_file<size, big_endian, File>::section_link(unsigned int shndx)
return shdr.get_sh_link();
}
+// Return the sh_info field of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+Elf_Word
+Elf_file<size, big_endian, File>::section_info(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_info: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_info();
+}
+
} // End namespace elfcpp.
#endif // !defined(ELFCPP_FILE_H)