Add elf_get_section_named

Document elf_get_section_* in ChangeLog
diff --git a/ChangeLog b/ChangeLog
index 1955506..d7dcf56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-30  Petr Machata  <pmachata@redhat.com>
+
+	* ltrace-elf.h (elf_get_section_named): New function.
+	(elf_get_section_covering, elf_get_section_type): Likewise.
+
 2012-04-26  Petr Machata  <pmachata@redhat.com>
 
 	* common.h (arch_breakpoint_init, arch_breakpoint_destroy)
diff --git a/ltrace-elf.c b/ltrace-elf.c
index 3f0c636..19f1c64 100644
--- a/ltrace-elf.c
+++ b/ltrace-elf.c
@@ -143,6 +143,33 @@
 				  &type_p, &type);
 }
 
+struct section_named_data {
+	struct ltelf *lte;
+	const char *name;
+};
+
+static int
+name_p(Elf_Scn *scn, GElf_Shdr *shdr, void *d)
+{
+	struct section_named_data *data = d;
+	const char *name = elf_strptr(data->lte->elf,
+				      data->lte->ehdr.e_shstrndx,
+				      shdr->sh_name);
+	return strcmp(name, data->name) == 0;
+}
+
+int
+elf_get_section_named(struct ltelf *lte, const char *name,
+		     Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr)
+{
+	struct section_named_data data = {
+		.lte = lte,
+		.name = name,
+	};
+	return elf_get_section_if(lte, tgt_sec, tgt_shdr,
+				  &name_p, &data);
+}
+
 static int
 need_data(Elf_Data *data, GElf_Xword offset, GElf_Xword size)
 {
diff --git a/ltrace-elf.h b/ltrace-elf.h
index 54a5386..64d1cb8 100644
--- a/ltrace-elf.h
+++ b/ltrace-elf.h
@@ -63,6 +63,8 @@
 			     Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr);
 int elf_get_section_type(struct ltelf *lte, GElf_Word type,
 			 Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr);
+int elf_get_section_named(struct ltelf *lte, const char *name,
+			  Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr);
 
 /* Read, respectively, 2, 4, or 8 bytes from Elf data at given OFFSET,
  * and store it in *RETP.  Returns 0 on success or a negative value if