2003-07-11 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gcore.c
index 25d1ed70e2494f29b5944c40f7938f3cc8ded3a6..6a0edbf51e1d58adefabe24f54fc6a6116a5a75e 100644 (file)
@@ -1,5 +1,6 @@
 /* Generate a core file for the inferior process.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,9 +24,9 @@
 #include "inferior.h"
 #include "gdbcore.h"
 #include "elf-bfd.h"
-#include <sys/procfs.h>
 #include "symfile.h"
 #include "objfiles.h"
+#include "infcall.h"
 
 static char                  *default_gcore_target (void);
 static enum bfd_architecture  default_gcore_arch (void);
@@ -158,25 +159,14 @@ default_gcore_target (void)
     return bfd_get_target (exec_bfd);
 }
 
-/*
- * Default method for stack segment (preemptable by target).
- */
-
-static int (*override_derive_stack_segment) (bfd_vma *, bfd_vma *);
-
-extern void
-preempt_derive_stack_segment (int (*override_func) (bfd_vma *, bfd_vma *))
-{
-  override_derive_stack_segment = override_func;
-}
+/* Function: derive_stack_segment
 
-/* Function: default_derive_stack_segment
    Derive a reasonable stack segment by unwinding the target stack. 
    
    Returns 0 for failure, 1 for success.  */
 
 static int 
-default_derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
+derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
 {
   bfd_vma tmp_vma;
   struct frame_info *fi, *tmp_fi;
@@ -191,7 +181,7 @@ default_derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
     return 0;  /* Can't succeed without current frame. */
 
   /* Save frame pointer of TOS frame. */
-  *top = fi->frame;
+  *top = get_frame_base (fi);
   /* If current stack pointer is more "inner", use that instead. */
   if (INNER_THAN (read_sp (), *top))
     *top = read_sp ();
@@ -201,7 +191,7 @@ default_derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
     fi = tmp_fi;
 
   /* Save frame pointer of prev-most frame. */
-  *bottom = fi->frame;
+  *bottom = get_frame_base (fi);
 
   /* Now canonicalize their order, so that 'bottom' is a lower address
    (as opposed to a lower stack frame). */
@@ -215,36 +205,15 @@ default_derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
   return 1;    /* success */
 }
 
-static int
-derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
-{
-  if (override_derive_stack_segment)
-    return override_derive_stack_segment (bottom, top);
-  else
-    return default_derive_stack_segment (bottom, top);
-}
-
-/*
- * Default method for heap segment (preemptable by target).
- */
+/* Function: derive_heap_segment
 
-static int (*override_derive_heap_segment) (bfd *, bfd_vma *, bfd_vma *);
-
-extern void
-preempt_derive_heap_segment (int (*override_func) (bfd *, 
-                                                  bfd_vma *, bfd_vma *))
-{
-  override_derive_heap_segment = override_func;
-}
-
-/* Function: default_derive_heap_segment
    Derive a reasonable heap segment by looking at sbrk and
    the static data sections.
    
    Returns 0 for failure, 1 for success.  */
 
 static int 
-default_derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
+derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
 {
   bfd_vma top_of_data_memory = 0;
   bfd_vma top_of_heap = 0;
@@ -308,15 +277,6 @@ default_derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
     return 0;  /* No additional heap space needs to be saved. */
 }
 
-static int
-derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
-{
-  if (override_derive_heap_segment)
-    return override_derive_heap_segment (abfd, bottom, top);
-  else
-    return default_derive_heap_segment (abfd, bottom, top);
-}
-
 /* ARGSUSED */
 static void
 make_output_phdrs (bfd *obfd, asection *osec, void *ignored)
This page took 0.02467 seconds and 4 git commands to generate.