Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: go32-nat, always a thread
Date: Fri, 08 Aug 2008 03:39:00 -0000	[thread overview]
Message-ID: <200808080439.17254.pedro@codesourcery.com> (raw)

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

This patch makes the go32 (djgpp) target always register the main thread
in GDB's thread table.

Anyone able to test this?  Eli?

I think this is fairly low risk, and very easy to fix
if I missed something.

OK?

-- 
Pedro Alves

[-- Attachment #2: go32-always_a_thread.diff --]
[-- Type: text/x-diff, Size: 2193 bytes --]

2008-08-08  Pedro Alves  <pedro@codesourcery.com>

	* go32-nat.c: Include "gdbthread.h".
	(go32_stop, go32_kill_inferior): Delete the main thread.
	(go32_create_inferior): Add it.
	(go32_thread_alive, go32_pid_to_str): New.
	(init_go32_ops): Register go32_thread_alive and go32_pid_to_str.

---
 gdb/go32-nat.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Index: src/gdb/go32-nat.c
===================================================================
--- src.orig/gdb/go32-nat.c	2008-08-07 19:38:07.000000000 +0100
+++ src/gdb/go32-nat.c	2008-08-08 04:34:44.000000000 +0100
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "inferior.h"
+#include "gdbthread.h"
 #include "gdb_wait.h"
 #include "gdbcore.h"
 #include "command.h"
@@ -562,9 +563,12 @@ go32_files_info (struct target_ops *targ
 static void
 go32_stop (ptid_t ptid)
 {
+  ptid_t ptid;
   normal_stop ();
   cleanup_client ();
+  ptid = inferior_ptid;
   inferior_ptid = null_ptid;
+  delete_thread_silent (ptid);
   prog_has_started = 0;
 }
 
@@ -574,6 +578,8 @@ go32_kill_inferior (void)
   redir_cmdline_delete (&child_cmd);
   resume_signal = -1;
   resume_is_step = 0;
+  if (!ptid_equal (inferior_ptid, null_ptid))
+    delete_thread_silent (inferior_ptid);
   unpush_target (&go32_ops);
 }
 
@@ -656,6 +662,9 @@ go32_create_inferior (char *exec_file, c
 
   inferior_ptid = pid_to_ptid (SOME_PID);
   push_target (&go32_ops);
+
+  add_thread_silent (inferior_ptid);
+
   clear_proceed_status ();
   insert_breakpoints ();
   prog_has_started = 1;
@@ -846,6 +855,20 @@ go32_terminal_ours (void)
   }
 }
 
+static int
+go32_thread_alive (ptid_t ptid)
+{
+  return 1;
+}
+
+static char *
+go32_pid_to_str (ptid_t ptid)
+{
+  static char buf[64];
+  xsnprintf (buf, sizeof buf, "Thread <main>");
+  return buf;
+}
+
 static void
 init_go32_ops (void)
 {
@@ -876,6 +899,8 @@ init_go32_ops (void)
   go32_ops.to_mourn_inferior = go32_mourn_inferior;
   go32_ops.to_can_run = go32_can_run;
   go32_ops.to_stop = go32_stop;
+  go32_ops.to_stop = go32_thread_alive;
+  go32_ops.to_stop = go32_pid_to_str;
   go32_ops.to_stratum = process_stratum;
   go32_ops.to_has_all_memory = 1;
   go32_ops.to_has_memory = 1;

             reply	other threads:[~2008-08-08  3:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08  3:39 Pedro Alves [this message]
2008-08-08  3:41 ` Pedro Alves
2008-08-08  8:01 ` Eli Zaretskii
2008-08-08 12:43   ` Daniel Jacobowitz
2008-08-08 12:47     ` Eli Zaretskii
2008-08-08 12:55       ` Daniel Jacobowitz
2008-08-09 17:54   ` Pedro Alves
2008-08-09 18:06     ` Tom Tromey
2008-08-09 18:15       ` Pedro Alves
2008-08-09 18:22       ` Daniel Jacobowitz
2008-08-09 18:55     ` Eli Zaretskii
2008-08-09 19:18       ` Mark Kettenis
2008-08-09 19:31         ` Daniel Jacobowitz
2008-08-09 21:32           ` Eli Zaretskii
2008-08-09 21:33       ` Pedro Alves

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=200808080439.17254.pedro@codesourcery.com \
    --to=pedro@codesourcery.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