Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sourceware.org
Subject: [patch] core: use core_pid
Date: Tue, 26 Feb 2008 19:45:00 -0000	[thread overview]
Message-ID: <47C46A96.9060105@qnx.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

Hello,

This patch fixes minor issue: in corelow.c (add_to_thread_list) we use thread_id 
as pid and we ignore core_pid which is available. This gives confusing output 
from "info threads" since threads appear to belong to different processes.

The patch rectifies this situation.



Thanks,

Aleksandar Ristovski
QNX Software Systems



2008-02-26  Aleksandar Ristovski  <aristovski@qnx.com>

	* Makefile.in (corelow.o): Add elf_bfd_h.
	* corelow.c (elf-bfd.h): Add include.
	(add_to_thread_list): Use core_pid instead of using tid as pid.
	(get_core_register_section): Use tid from inferior_ptid instead of pid.
	

[-- Attachment #2: corelow.c.diff --]
[-- Type: text/plain, Size: 2501 bytes --]

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.984
diff -u -p -r1.984 Makefile.in
--- gdb/Makefile.in	20 Feb 2008 15:45:20 -0000	1.984
+++ gdb/Makefile.in	26 Feb 2008 19:20:38 -0000
@@ -1996,7 +1996,7 @@ corelow.o: corelow.c $(defs_h) $(arch_ut
 	$(inferior_h) $(symtab_h) $(command_h) $(bfd_h) $(target_h) \
 	$(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \
 	$(exec_h) $(readline_h) $(gdb_assert_h) \
-	$(exceptions_h) $(solib_h) $(filenames_h)
+	$(exceptions_h) $(solib_h) $(filenames_h) $(elf_bfd_h)
 core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \
 	$(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(gregset_h)
 cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \
Index: gdb/corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.73
diff -u -p -r1.73 corelow.c
--- gdb/corelow.c	9 Feb 2008 13:45:33 -0000	1.73
+++ gdb/corelow.c	26 Feb 2008 19:20:43 -0000
@@ -45,6 +45,7 @@
 #include "exceptions.h"
 #include "solib.h"
 #include "filenames.h"
+#include "elf-bfd.h"
 
 
 #ifndef O_LARGEFILE
@@ -232,20 +233,22 @@ static void
 add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
 {
   int thread_id;
+  ptid_t ptid;
   asection *reg_sect = (asection *) reg_sect_arg;
 
   if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
     return;
 
   thread_id = atoi (bfd_section_name (abfd, asect) + 5);
-
-  add_thread (pid_to_ptid (thread_id));
+  gdb_assert (abfd != NULL && elf_tdata (abfd) != NULL);
+  ptid = ptid_build (elf_tdata (abfd)->core_pid, 0, thread_id);
+  add_thread (ptid);
 
 /* Warning, Will Robinson, looking at BFD private data! */
 
   if (reg_sect != NULL
       && asect->filepos == reg_sect->filepos)	/* Did we find .reg? */
-    inferior_ptid = pid_to_ptid (thread_id);	/* Yes, make it current */
+    inferior_ptid = ptid;	/* Yes, make it current */
 }
 
 /* This routine opens and sets up the core file bfd.  */
@@ -424,8 +427,8 @@ get_core_register_section (struct regcac
   char *contents;
 
   xfree (section_name);
-  if (PIDGET (inferior_ptid))
-    section_name = xstrprintf ("%s/%d", name, PIDGET (inferior_ptid));
+  if (ptid_get_tid (inferior_ptid))
+    section_name = xstrprintf ("%s/%ld", name, ptid_get_tid (inferior_ptid));
   else
     section_name = xstrdup (name);
 

             reply	other threads:[~2008-02-26 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 19:45 Aleksandar Ristovski [this message]
2008-02-26 19:53 ` Daniel Jacobowitz
2008-02-26 20:15   ` Aleksandar Ristovski
2008-04-10 15:16     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C46A96.9060105@qnx.com \
    --to=aristovski@qnx.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox