This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ptid from core section


On Friday 05 June 2009 15:53:00, Aleksandar Ristovski wrote:

> Here is a new patch. I made sure it works even if 
> core_gdbarch is NULL. 

Sorry, we're going a bit in circles.  The way you've now
implemented it, there are three ways to get a ptid
from a core reg section, but two of them are mostly
the same --- the default gdbarch fallbacks, and the 
case of core_gdbarch being NULL handled in corelow.c itself.

On Friday 05 June 2009 14:44:37, Pedro Alves wrote:
> change adds some unconditional accesses.  The path of
> least resistence to fix this, is to move the callback defaults
> to corelow.c, make the new callbacks optional, and check
> for 'core_gdbarch && gdbarch_foo_p (core_gdbarch)' predicates
> before calling the optional callbacks.

This meant:

On Friday 05 June 2009 15:53:00, Aleksandar Ristovski wrote:
> +static ptid_t
> +default_ptid_from_core_section_name (struct gdbarch *gdbarch, const bfd *abfd,
> +                                    const char *name)
> +{
> +  int thread_id;
> +  ptid_t ptid;
> +  const char *pos;
> +
> +  pos = strchr (name, '/'); 
> +  if (pos == NULL)
> +    pos = name + strlen (name);
> +  else
> +    pos++;
> +  thread_id = atoi (pos);
> +  ptid = ptid_build (ptid_get_pid (inferior_ptid), thread_id, 0);
> +  return ptid;
> +}
> +
> +static char *
> +default_core_section_name_from_ptid (struct gdbarch *gdbarch, 
> +                                    const bfd *abfd,
> +                                    const char *name,
> +                                    ptid_t ptid)
> +{
> +  if (ptid_get_lwp (ptid))
> +    return xstrprintf ("%s/%ld", name, ptid_get_lwp (ptid));
> +  else
> +    return xstrdup (name);
> +}

Moving these functions to corelow.c, and making the gdbarch callbacks
optional.  Wouldn't that look cleaner?  Something like the patch below.

But, at this point, I'm now confused, and I have to re-ask:
What is it that gets confused on nto when core files store
the thread id in the lwp field of ptids instead of on the tid
field?  Your original patch only took care to adjust to
read tids from the tid field in default_core_section_from_ptid,
but didn't do anything to make ptids that stored the tid
in the tid field in default_ptid_from_core_section?  While
your latest patch didn't even do that in
default_ptid_from_core_section_name?  I can't see how you
avoid adding gdbarch callbacks for nto.

> I also fixed my previous patch for  
> target signal by checking if there is a core_gdbarch.

Could you go ahead, and check in just that bit
split out from the rest please?  Thanks.

-- 
Pedro Alves

---
 gdb/amd64-sol2-tdep.c   |    5 ++
 gdb/corelow.c           |   84 ++++++++++++++++++++++++++++++------------------
 gdb/gdbarch.c           |   70 ++++++++++++++++++++++++++++++++--------
 gdb/gdbarch.h           |   23 ++++++++++---
 gdb/gdbarch.sh          |   13 ++++---
 gdb/i386-sol2-tdep.c    |    5 ++
 gdb/sol2-tdep.c         |   31 +++++++++++++++++
 gdb/sol2-tdep.h         |    7 ++++
 gdb/sparc-sol2-tdep.c   |    5 ++
 gdb/sparc64-sol2-tdep.c |    5 ++
 10 files changed, 190 insertions(+), 58 deletions(-)

Index: src/gdb/corelow.c
===================================================================
--- src.orig/gdb/corelow.c	2009-06-05 16:16:28.000000000 +0100
+++ src/gdb/corelow.c	2009-06-05 16:56:32.000000000 +0100
@@ -232,6 +232,37 @@ core_close_cleanup (void *ignore)
   core_close (0/*ignored*/);
 }
 
+static ptid_t
+default_ptid_from_core_section_name (const bfd *abfd, const char *name)
+{
+  int lwpid;
+  const char *pos;
+
+  pos = strchr (name, '/');
+
+  /* Our caller filters sections whose name starts with ".reg/".  */
+  gdb_assert (pos != NULL);
+
+  pos++;
+
+  /* Note that this returns a legitimate 0, in case the section name
+     didn't really have a lwp/tid specifier (e.g., it was just
+     ".reg".  */
+  lwpid = atoi (pos);
+
+  return ptid_build (ptid_get_pid (inferior_ptid), lwpid, 0);
+}
+
+static char *
+default_core_section_name_from_ptid (const bfd *abfd,
+				     const char *name, ptid_t ptid)
+{
+  if (ptid_get_lwp (ptid))
+    return xstrprintf ("%s/%ld", name, ptid_get_lwp (ptid));
+  else
+    return xstrdup (name);
+}
+
 /* Look for sections whose names start with `.reg/' so that we can extract the
    list of threads in a core file.  */
 
@@ -241,23 +272,20 @@ add_to_thread_list (bfd *abfd, asection 
   ptid_t ptid;
   int thread_id;
   asection *reg_sect = (asection *) reg_sect_arg;
+  const char *section_name = bfd_section_name (abfd, asect);
 
-  if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
+  if (strncmp (section_name, ".reg/", 5) != 0)
     return;
 
-  thread_id = atoi (bfd_section_name (abfd, asect) + 5);
-
-  if (core_gdbarch
-      && gdbarch_core_reg_section_encodes_pid (core_gdbarch))
-    {
-      uint32_t merged_pid = thread_id;
-      ptid = ptid_build (merged_pid & 0xffff,
-			 merged_pid >> 16, 0);
-    }
+  if (core_gdbarch != NULL
+      && gdbarch_ptid_from_core_section_name_p (core_gdbarch))
+    ptid = gdbarch_ptid_from_core_section_name (core_gdbarch,
+						abfd, section_name);
   else
-    ptid = ptid_build (ptid_get_pid (inferior_ptid), thread_id, 0);
+    ptid = default_ptid_from_core_section_name (abfd, section_name);
 
-  if (ptid_get_lwp (inferior_ptid) == 0)
+  if (ptid_get_lwp (inferior_ptid) == 0
+      && ptid_get_tid (inferior_ptid) == 0)
     /* The main thread has already been added before getting here, and
        this is the first time we hear about a thread id.  Assume this
        is the main thread.  */
@@ -464,11 +492,11 @@ deprecated_core_resize_section_table (in
    them to core_vec->core_read_registers, as the register set numbered
    WHICH.
 
-   If inferior_ptid's lwp member is zero, do the single-threaded
-   thing: look for a section named NAME.  If inferior_ptid's lwp
-   member is non-zero, do the multi-threaded thing: look for a section
-   named "NAME/LWP", where LWP is the shortest ASCII decimal
-   representation of inferior_ptid's lwp member.
+   Architecture supplied function determines if NAME needs to be encoded
+   with process/thread information.  Many architectures will, depending
+   on inferior_ptid, append "/LWP" or "/TID" where LWP and TID are the shortest
+   ASCII decimal representation of inferior_ptid's lwp/tid member.  Some
+   architectures however, encode both process id and lwp/tid.
 
    HUMAN_NAME is a human-readable name for the kind of registers the
    NAME section contains, for use in error messages.
@@ -490,20 +518,16 @@ get_core_register_section (struct regcac
 
   xfree (section_name);
 
-  if (core_gdbarch
-      && gdbarch_core_reg_section_encodes_pid (core_gdbarch))
-    {
-      uint32_t merged_pid;
-
-      merged_pid = ptid_get_lwp (inferior_ptid);
-      merged_pid = merged_pid << 16 | ptid_get_pid (inferior_ptid);
-
-      section_name = xstrprintf ("%s/%s", name, plongest (merged_pid));
-    }
-  else if (ptid_get_lwp (inferior_ptid))
-    section_name = xstrprintf ("%s/%ld", name, ptid_get_lwp (inferior_ptid));
+  if (core_gdbarch != NULL
+      && gdbarch_core_section_name_from_ptid_p (core_gdbarch))
+    section_name = gdbarch_core_section_name_from_ptid (core_gdbarch,
+							core_bfd,
+							name,
+							inferior_ptid);
   else
-    section_name = xstrdup (name);
+    section_name = default_core_section_name_from_ptid (core_bfd,
+							name,
+							inferior_ptid);
 
   section = bfd_get_section_by_name (core_bfd, section_name);
   if (! section)
Index: src/gdb/gdbarch.h
===================================================================
--- src.orig/gdb/gdbarch.h	2009-06-05 16:16:28.000000000 +0100
+++ src/gdb/gdbarch.h	2009-06-05 16:29:05.000000000 +0100
@@ -651,12 +651,25 @@ extern void set_gdbarch_regset_from_core
 
 /* When creating core dumps, some systems encode the PID in addition
    to the LWP id in core file register section names.  In those cases, the
-   "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID].  This setting
-   is set to true for such architectures; false if "XXX" represents an LWP
-   or thread id with no special encoding. */
+   "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID].  Others have thread_id
+   but no LWP.  This let's different architectures provide their own
+   ptid for a given section. */
 
-extern int gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch);
-extern void set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch, int core_reg_section_encodes_pid);
+extern int gdbarch_ptid_from_core_section_name_p (struct gdbarch *gdbarch);
+
+typedef ptid_t (gdbarch_ptid_from_core_section_name_ftype) (struct gdbarch *gdbarch, const bfd *abfd, const char *name);
+extern ptid_t gdbarch_ptid_from_core_section_name (struct gdbarch *gdbarch, const bfd *abfd, const char *name);
+extern void set_gdbarch_ptid_from_core_section_name (struct gdbarch *gdbarch, gdbarch_ptid_from_core_section_name_ftype *ptid_from_core_section_name);
+
+/* Mirror function of ptid_from_core_section_name, returns architecture-specific
+   section name given NAME base.  For example if NAME is ".reg" resulting
+   name may be ".reg/42" where 42 is thread ID, or LWP or [LWPID << 16 | PID]. */
+
+extern int gdbarch_core_section_name_from_ptid_p (struct gdbarch *gdbarch);
+
+typedef char * (gdbarch_core_section_name_from_ptid_ftype) (struct gdbarch *gdbarch, const bfd *abfd, const char *name, ptid_t ptid);
+extern char * gdbarch_core_section_name_from_ptid (struct gdbarch *gdbarch, const bfd *abfd, const char *name, ptid_t ptid);
+extern void set_gdbarch_core_section_name_from_ptid (struct gdbarch *gdbarch, gdbarch_core_section_name_from_ptid_ftype *core_section_name_from_ptid);
 
 /* Supported register notes in a core file. */
 
Index: src/gdb/gdbarch.c
===================================================================
--- src.orig/gdb/gdbarch.c	2009-06-05 16:16:27.000000000 +0100
+++ src/gdb/gdbarch.c	2009-06-05 16:29:11.000000000 +0100
@@ -223,7 +223,8 @@ struct gdbarch
   gdbarch_register_reggroup_p_ftype *register_reggroup_p;
   gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
   gdbarch_regset_from_core_section_ftype *regset_from_core_section;
-  int core_reg_section_encodes_pid;
+  gdbarch_ptid_from_core_section_name_ftype *ptid_from_core_section_name;
+  gdbarch_core_section_name_from_ptid_ftype *core_section_name_from_ptid;
   struct core_regset_section * core_regset_sections;
   gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
   gdbarch_core_pid_to_str_ftype *core_pid_to_str;
@@ -360,7 +361,8 @@ struct gdbarch startup_gdbarch =
   default_register_reggroup_p,  /* register_reggroup_p */
   0,  /* fetch_pointer_argument */
   0,  /* regset_from_core_section */
-  0,  /* core_reg_section_encodes_pid */
+  0,  /* ptid_from_core_section_name */
+  0,  /* core_section_name_from_ptid */
   0,  /* core_regset_sections */
   0,  /* core_xfer_shared_libraries */
   0,  /* core_pid_to_str */
@@ -617,7 +619,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of register_reggroup_p, invalid_p == 0 */
   /* Skip verify of fetch_pointer_argument, has predicate */
   /* Skip verify of regset_from_core_section, has predicate */
-  /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */
+  /* Skip verify of ptid_from_core_section_name, has predicate */
+  /* Skip verify of core_section_name_from_ptid, has predicate */
   /* Skip verify of core_xfer_shared_libraries, has predicate */
   /* Skip verify of core_pid_to_str, has predicate */
   /* Skip verify of vtable_function_descriptors, invalid_p == 0 */
@@ -754,12 +757,15 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: core_read_description = <%s>\n",
                       host_address_to_string (gdbarch->core_read_description));
   fprintf_unfiltered (file,
-                      "gdbarch_dump: core_reg_section_encodes_pid = %s\n",
-                      plongest (gdbarch->core_reg_section_encodes_pid));
-  fprintf_unfiltered (file,
                       "gdbarch_dump: core_regset_sections = %s\n",
                       host_address_to_string (gdbarch->core_regset_sections));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_core_section_name_from_ptid_p() = %d\n",
+                      gdbarch_core_section_name_from_ptid_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: core_section_name_from_ptid = <%s>\n",
+                      host_address_to_string (gdbarch->core_section_name_from_ptid));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
                       gdbarch_core_xfer_shared_libraries_p (gdbarch));
   fprintf_unfiltered (file,
@@ -976,6 +982,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: pseudo_register_write = <%s>\n",
                       host_address_to_string (gdbarch->pseudo_register_write));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_ptid_from_core_section_name_p() = %d\n",
+                      gdbarch_ptid_from_core_section_name_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: ptid_from_core_section_name = <%s>\n",
+                      host_address_to_string (gdbarch->ptid_from_core_section_name));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: ptr_bit = %s\n",
                       plongest (gdbarch->ptr_bit));
   fprintf_unfiltered (file,
@@ -2930,20 +2942,51 @@ set_gdbarch_regset_from_core_section (st
 }
 
 int
-gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch)
+gdbarch_ptid_from_core_section_name_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */
+  return gdbarch->ptid_from_core_section_name != NULL;
+}
+
+ptid_t
+gdbarch_ptid_from_core_section_name (struct gdbarch *gdbarch, const bfd *abfd, const char *name)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->ptid_from_core_section_name != NULL);
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_core_reg_section_encodes_pid called\n");
-  return gdbarch->core_reg_section_encodes_pid;
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_ptid_from_core_section_name called\n");
+  return gdbarch->ptid_from_core_section_name (gdbarch, abfd, name);
 }
 
 void
-set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch,
-                                          int core_reg_section_encodes_pid)
+set_gdbarch_ptid_from_core_section_name (struct gdbarch *gdbarch,
+                                         gdbarch_ptid_from_core_section_name_ftype ptid_from_core_section_name)
 {
-  gdbarch->core_reg_section_encodes_pid = core_reg_section_encodes_pid;
+  gdbarch->ptid_from_core_section_name = ptid_from_core_section_name;
+}
+
+int
+gdbarch_core_section_name_from_ptid_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->core_section_name_from_ptid != NULL;
+}
+
+char *
+gdbarch_core_section_name_from_ptid (struct gdbarch *gdbarch, const bfd *abfd, const char *name, ptid_t ptid)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->core_section_name_from_ptid != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_core_section_name_from_ptid called\n");
+  return gdbarch->core_section_name_from_ptid (gdbarch, abfd, name, ptid);
+}
+
+void
+set_gdbarch_core_section_name_from_ptid (struct gdbarch *gdbarch,
+                                         gdbarch_core_section_name_from_ptid_ftype core_section_name_from_ptid)
+{
+  gdbarch->core_section_name_from_ptid = core_section_name_from_ptid;
 }
 
 struct core_regset_section *
@@ -3405,7 +3448,6 @@ set_gdbarch_has_global_breakpoints (stru
   gdbarch->has_global_breakpoints = has_global_breakpoints;
 }
 
-
 /* Keep a registry of per-architecture data-pointers required by GDB
    modules. */
 
Index: src/gdb/sol2-tdep.h
===================================================================
--- src.orig/gdb/sol2-tdep.h	2009-06-05 16:16:28.000000000 +0100
+++ src/gdb/sol2-tdep.h	2009-06-05 16:18:32.000000000 +0100
@@ -26,4 +26,11 @@ CORE_ADDR sol2_skip_solib_resolver (stru
 
 char *sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
 
+ptid_t sol2_ptid_from_core_section_name (struct gdbarch *, const bfd *,
+					 const char *);
+
+char *sol2_core_section_name_from_ptid (struct gdbarch *, const bfd *,
+					const char *,
+					ptid_t);
+
 #endif /* sol2-tdep.h */
Index: src/gdb/sol2-tdep.c
===================================================================
--- src.orig/gdb/sol2-tdep.c	2009-06-05 16:16:28.000000000 +0100
+++ src/gdb/sol2-tdep.c	2009-06-05 17:05:09.000000000 +0100
@@ -47,3 +47,34 @@ sol2_core_pid_to_str (struct gdbarch *gd
   xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
   return buf;
 }
+
+ptid_t
+sol2_ptid_from_core_section_name (struct gdbarch *gdbarch, const bfd *abfd,
+				  const char *name)
+{
+  uint32_t merged_pid;
+  const char *pos;
+
+  gdb_assert (name != NULL);
+  pos = strchr (name, '/');
+
+  /* Our caller only passes us sections whose name starts with ".reg/".  */
+  gdb_assert (pos != NULL);
+
+  pos++;
+
+  merged_pid = strtoul (pos, NULL, 10);
+  return ptid_build (merged_pid & 0xffff, 0, merged_pid >> 16);
+}
+
+char *
+sol2_core_section_name_from_ptid (struct gdbarch *gdbarch, const bfd *abfd,
+				  const char *name,
+				  ptid_t ptid)
+{
+  uint32_t merged_pid;
+
+  merged_pid = ptid_get_lwp (ptid);
+  merged_pid = merged_pid << 16 | ptid_get_pid (ptid);
+  return xstrprintf ("%s/%s", name, plongest (merged_pid));
+}
Index: src/gdb/amd64-sol2-tdep.c
===================================================================
--- src.orig/gdb/amd64-sol2-tdep.c	2009-06-05 16:16:28.000000000 +0100
+++ src/gdb/amd64-sol2-tdep.c	2009-06-05 16:18:32.000000000 +0100
@@ -116,7 +116,10 @@ amd64_sol2_init_abi (struct gdbarch_info
 
   /* Solaris encodes the pid of the inferior in regset section
      names.  */
-  set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
+  set_gdbarch_ptid_from_core_section_name (gdbarch,
+					   sol2_ptid_from_core_section_name);
+  set_gdbarch_core_section_name_from_ptid (gdbarch,
+					   sol2_core_section_name_from_ptid);
 
   /* How to print LWP PTIDs from core files.  */
   set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
Index: src/gdb/sparc-sol2-tdep.c
===================================================================
--- src.orig/gdb/sparc-sol2-tdep.c	2009-06-05 16:16:27.000000000 +0100
+++ src/gdb/sparc-sol2-tdep.c	2009-06-05 16:18:32.000000000 +0100
@@ -234,7 +234,10 @@ sparc32_sol2_init_abi (struct gdbarch_in
 
   /* Solaris encodes the pid of the inferior in regset section
      names.  */
-  set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
+  set_gdbarch_ptid_from_core_section_name (gdbarch,
+					   sol2_ptid_from_core_section_name);
+  set_gdbarch_core_section_name_from_ptid (gdbarch,
+					   sol2_core_section_name_from_ptid);
 
   /* How to print LWP PTIDs from core files.  */
   set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
Index: src/gdb/sparc64-sol2-tdep.c
===================================================================
--- src.orig/gdb/sparc64-sol2-tdep.c	2009-06-05 16:16:27.000000000 +0100
+++ src/gdb/sparc64-sol2-tdep.c	2009-06-05 16:18:32.000000000 +0100
@@ -183,7 +183,10 @@ sparc64_sol2_init_abi (struct gdbarch_in
 
   /* Solaris encodes the pid of the inferior in regset section
      names.  */
-  set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
+  set_gdbarch_ptid_from_core_section_name (gdbarch,
+					   sol2_ptid_from_core_section_name);
+  set_gdbarch_core_section_name_from_ptid (gdbarch,
+					   sol2_core_section_name_from_ptid);
 
   /* How to print LWP PTIDs from core files.  */
   set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
Index: src/gdb/i386-sol2-tdep.c
===================================================================
--- src.orig/gdb/i386-sol2-tdep.c	2009-06-05 16:16:28.000000000 +0100
+++ src/gdb/i386-sol2-tdep.c	2009-06-05 16:18:32.000000000 +0100
@@ -138,7 +138,10 @@ i386_sol2_init_abi (struct gdbarch_info 
 
   /* Solaris encodes the pid of the inferior in regset section
      names.  */
-  set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
+  set_gdbarch_ptid_from_core_section_name (gdbarch,
+					   sol2_ptid_from_core_section_name);
+  set_gdbarch_core_section_name_from_ptid (gdbarch,
+					   sol2_core_section_name_from_ptid);
 
   /* How to print LWP PTIDs from core files.  */
   set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
Index: src/gdb/gdbarch.sh
===================================================================
--- src.orig/gdb/gdbarch.sh	2009-05-25 13:45:58.000000000 +0100
+++ src/gdb/gdbarch.sh	2009-06-05 16:28:57.000000000 +0100
@@ -602,10 +602,14 @@ M:const struct regset *:regset_from_core
 
 # When creating core dumps, some systems encode the PID in addition
 # to the LWP id in core file register section names.  In those cases, the
-# "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID].  This setting
-# is set to true for such architectures; false if "XXX" represents an LWP
-# or thread id with no special encoding.
-v:int:core_reg_section_encodes_pid:::0:0::0
+# "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID].  Others have thread_id
+# but no LWP.  This let's different architectures provide their own
+# ptid for a given section.
+M:ptid_t:ptid_from_core_section_name:const bfd *abfd, const char *name:abfd, name
+# Mirror function of ptid_from_core_section_name, returns architecture-specific
+# section name given NAME base.  For example if NAME is ".reg" resulting
+# name may be ".reg/42" where 42 is thread ID, or LWP or [LWPID << 16 | PID].
+M:char *:core_section_name_from_ptid:const bfd *abfd, const char *name, ptid_t ptid:abfd, name, ptid
 
 # Supported register notes in a core file.
 v:struct core_regset_section *:core_regset_sections:const char *name, int len::::::host_address_to_string (gdbarch->core_regset_sections)
@@ -1663,7 +1667,6 @@ done
 # All the trailing guff
 cat <<EOF
 
-
 /* Keep a registry of per-architecture data-pointers required by GDB
    modules. */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]