aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-06-20 00:16:02 +0000
committerPedro Alves <palves@redhat.com>2009-06-20 00:16:02 +0000
commit0763ab812686d5587c7db200cb84ccafd655e243 (patch)
tree60fb52b71b6b34a8922c25c7e64db73d71573d24
parent9f74293adbdf8829d95a97c09d5a703f1f8d1daf (diff)
downloadgdb-0763ab812686d5587c7db200cb84ccafd655e243.zip
gdb-0763ab812686d5587c7db200cb84ccafd655e243.tar.gz
gdb-0763ab812686d5587c7db200cb84ccafd655e243.tar.bz2
* solib-svr4.c (IGNORE_FIRST_LINK_MAP_ENTRY): Avoid dereferencing
NULL pointer. (scan_dyntag): Skip if input bfd isn't elf flavoured. (locate_base): Call elf_locate_base even without an exec_bfd.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/solib-svr4.c14
2 files changed, 15 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 517f6e0..9e255c7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2009-06-20 Aleksandar Ristovski <aristovski@qnx.com>
+ Pedro Alves <pedro@codesourcery.com>
+
+ * solib-svr4.c (IGNORE_FIRST_LINK_MAP_ENTRY): Avoid dereferencing
+ NULL pointer.
+ (scan_dyntag): Skip if input bfd isn't elf flavoured.
+ (locate_base): Call elf_locate_base even without an exec_bfd.
+
2009-06-19 Samuel Bronson <naesten@gmail.com>
PR cli/9903:
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 9c2fdda..29ccbb6 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -266,7 +266,7 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so)
/* Assume that everything is a library if the dynamic loader was loaded
late by a static executable. */
- if (bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
+ if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
return 0;
return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
@@ -600,9 +600,13 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
if (abfd == NULL)
return 0;
+
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return 0;
+
arch_size = bfd_get_arch_size (abfd);
if (arch_size == -1)
- return 0;
+ return 0;
/* Find the start address of the .dynamic section. */
sect = bfd_get_section_by_name (abfd, ".dynamic");
@@ -825,11 +829,7 @@ locate_base (struct svr4_info *info)
though if we don't have some link map offsets to work with. */
if (info->debug_base == 0 && svr4_have_link_map_offsets ())
- {
- if (exec_bfd != NULL
- && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
- info->debug_base = elf_locate_base ();
- }
+ info->debug_base = elf_locate_base ();
return info->debug_base;
}