aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdb_bfd.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 150b29a..3ef965c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-27 Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
+
+ * gdb_bfd.c (gdb_bfd_section_index): Fix off-by-one for special
+ sections.
+
2015-03-26 Joel Brobecker <brobecker@adacore.com>
* dtrace-probe.c (dtrace_process_dof_probe): Contain any
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 7543dae..3f89d3a 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -616,13 +616,13 @@ gdb_bfd_section_index (bfd *abfd, asection *section)
if (section == NULL)
return -1;
else if (section == bfd_com_section_ptr)
- return bfd_count_sections (abfd) + 1;
+ return bfd_count_sections (abfd);
else if (section == bfd_und_section_ptr)
- return bfd_count_sections (abfd) + 2;
+ return bfd_count_sections (abfd) + 1;
else if (section == bfd_abs_section_ptr)
- return bfd_count_sections (abfd) + 3;
+ return bfd_count_sections (abfd) + 2;
else if (section == bfd_ind_section_ptr)
- return bfd_count_sections (abfd) + 4;
+ return bfd_count_sections (abfd) + 3;
return section->index;
}