*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / corelow.c
index fa2431fd231742520fd6397468181ae649620ef9..039573fa1105e04d8c04eadaa33243ab124f8e57 100644 (file)
@@ -1,7 +1,7 @@
 /* Core dump and executable file functions below target vector, for GDB.
 
    Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -45,6 +45,7 @@
 #include "exceptions.h"
 #include "solib.h"
 #include "filenames.h"
+#include "progspace.h"
 
 
 #ifndef O_LARGEFILE
@@ -208,7 +209,7 @@ core_close (int quitting)
     {
       int pid = ptid_get_pid (inferior_ptid);
       inferior_ptid = null_ptid;       /* Avoid confusion from thread stuff */
-      delete_inferior_silent (pid);
+      exit_inferior_silent (pid);
 
       /* Clear out solib state while the bfd is still open. See
          comments in clear_solib in solib.c. */
@@ -260,7 +261,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
       lwpid = merged_pid >> 16;
 
       /* This can happen on solaris core, for example, if we don't
-        find a NT_PRSTATUS note in the core, but do find NT_LWPSTATUS
+        find a NT_PSTATUS note in the core, but do find NT_LWPSTATUS
         notes.  */
       if (pid == 0)
        {
@@ -275,8 +276,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
       lwpid = core_tid;
     }
 
-  if (!in_inferior_list (pid))
-    add_inferior_silent (pid);
+  if (current_inferior ()->pid == 0)
+    inferior_appeared (current_inferior (), pid);
 
   ptid = ptid_build (pid, lwpid, 0);
 
@@ -301,7 +302,6 @@ core_open (char *filename, int from_tty)
   bfd *temp_bfd;
   int scratch_chan;
   int flags;
-  int corelow_pid = CORELOW_PID;
 
   target_preopen (from_tty);
   if (!filename)
@@ -421,7 +421,7 @@ core_open (char *filename, int from_tty)
       struct thread_info *thread = first_thread_of_process (-1);
       if (thread == NULL)
        {
-         add_inferior_silent (CORELOW_PID);
+         inferior_appeared (current_inferior (), CORELOW_PID);
          inferior_ptid = pid_to_ptid (CORELOW_PID);
          add_thread_silent (inferior_ptid);
        }
@@ -508,9 +508,9 @@ deprecated_core_resize_section_table (int num_added)
 
 static void
 get_core_register_section (struct regcache *regcache,
-                          char *name,
+                          const char *name,
                           int which,
-                          char *human_name,
+                          const char *human_name,
                           int required)
 {
   static char *section_name = NULL;
@@ -591,6 +591,7 @@ static void
 get_core_registers (struct target_ops *ops,
                    struct regcache *regcache, int regno)
 {
+  struct core_regset_section *sect_list;
   int i;
 
   if (!(core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
@@ -601,16 +602,30 @@ get_core_registers (struct target_ops *ops,
       return;
     }
 
-  get_core_register_section (regcache,
-                            ".reg", 0, "general-purpose", 1);
-  get_core_register_section (regcache,
-                            ".reg2", 2, "floating-point", 0);
-  get_core_register_section (regcache,
-                            ".reg-xfp", 3, "extended floating-point", 0);
-  get_core_register_section (regcache,
-                            ".reg-ppc-vmx", 3, "ppc Altivec", 0);
-  get_core_register_section (regcache,
-                            ".reg-ppc-vsx", 4, "POWER7 VSX", 0);
+  sect_list = gdbarch_core_regset_sections (get_regcache_arch (regcache));
+  if (sect_list)
+    while (sect_list->sect_name != NULL)
+      {
+        if (strcmp (sect_list->sect_name, ".reg") == 0)
+         get_core_register_section (regcache, sect_list->sect_name,
+                                    0, sect_list->human_name, 1);
+        else if (strcmp (sect_list->sect_name, ".reg2") == 0)
+         get_core_register_section (regcache, sect_list->sect_name,
+                                    2, sect_list->human_name, 0);
+       else
+         get_core_register_section (regcache, sect_list->sect_name,
+                                    3, sect_list->human_name, 0);
+
+       sect_list++;
+      }
+
+  else
+    {
+      get_core_register_section (regcache,
+                                ".reg", 0, "general-purpose", 1);
+      get_core_register_section (regcache,
+                                ".reg2", 2, "floating-point", 0);
+    }
 
   /* Supply dummy value for all registers not found in the core.  */
   for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
This page took 0.027442 seconds and 4 git commands to generate.