2002-04-12 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Fri, 12 Apr 2002 23:09:48 +0000 (23:09 +0000)
committerMichael Snyder <msnyder@vmware.com>
Fri, 12 Apr 2002 23:09:48 +0000 (23:09 +0000)
* gcore.c (default_derive_heap_segment): Use bfd_section_name.
If no symbol found for "sbrk", try "_sbrk".
(make_output_phdrs): Use bfd_section_name.
(gcore_copy_callback): Use bfd_section_name.

gdb/ChangeLog
gdb/gcore.c

index dd443f68b59cb0010cf40a114e78e5eb1826fcff..37db04c91dcfa0b41588d9c20074bce4bf29eeb7 100644 (file)
 
 2002-04-12  Michael Snyder  <msnyder@redhat.com>
 
+       * gcore.c (default_derive_heap_segment): Use bfd_section_name.
+       If no symbol found for "sbrk", try "_sbrk".
+       (make_output_phdrs): Use bfd_section_name.
+       (gcore_copy_callback): Use bfd_section_name.
        * eval.c: Indentation fix-ups.
        * d10v-tdep.c (d10v_make_iaddr): Make it idempotent,
        in case it gets applied to an address that is already
index 494efad460835e647dde2945af198bd7bb02bd04..25d1ed70e2494f29b5944c40f7938f3cc8ded3a6 100644 (file)
@@ -269,7 +269,7 @@ default_derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
   for (sec = abfd->sections; sec; sec = sec->next)
     {
       if (bfd_get_section_flags (abfd, sec) & SEC_DATA ||
-         strcmp (".bss", bfd_get_section_name (abfd, sec)) == 0)
+         strcmp (".bss", bfd_section_name (abfd, sec)) == 0)
        {
          sec_vaddr = bfd_get_section_vma (abfd, sec);
          sec_size = bfd_get_section_size_before_reloc (sec);
@@ -278,8 +278,19 @@ default_derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
        }
     }
   /* Now get the top-of-heap by calling sbrk in the inferior.  */
-  if ((sbrk = find_function_in_inferior ("sbrk")) == NULL)
+  if (lookup_minimal_symbol ("sbrk", NULL, NULL) != NULL)
+    {
+      if ((sbrk = find_function_in_inferior ("sbrk")) == NULL)
+       return 0;
+    }
+  else if (lookup_minimal_symbol ("_sbrk", NULL, NULL) != NULL)
+    {
+      if ((sbrk = find_function_in_inferior ("_sbrk")) == NULL)
+       return 0;
+    }
+  else
     return 0;
+
   if ((zero = value_from_longest (builtin_type_int, (LONGEST) 0)) == NULL)
     return 0;
   if ((sbrk = call_function_by_hand (sbrk, 1, &zero)) == NULL)
@@ -314,7 +325,7 @@ make_output_phdrs (bfd *obfd, asection *osec, void *ignored)
   int p_type;
 
   /* FIXME: these constants may only be applicable for ELF.  */
-  if (strncmp (osec->name, "load", 4) == 0)
+  if (strncmp (bfd_section_name (obfd, osec), "load", 4) == 0)
     p_type = PT_LOAD;
   else
     p_type = PT_NOTE;
@@ -452,7 +463,7 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
   if (size == 0)
     return;    /* Read-only sections are marked as zero-size.
                   We don't have to copy their contents. */
-  if (strncmp ("load", bfd_get_section_name (obfd, osec), 4) != 0)
+  if (strncmp ("load", bfd_section_name (obfd, osec), 4) != 0)
     return;    /* Only interested in "load" sections. */
 
   if ((memhunk = xmalloc (size)) == NULL)
This page took 0.027859 seconds and 4 git commands to generate.