From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12703 invoked by alias); 8 Aug 2008 02:03:53 -0000 Received: (qmail 12689 invoked by uid 22791); 8 Aug 2008 02:03:51 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 08 Aug 2008 02:03:17 +0000 Received: (qmail 2971 invoked from network); 8 Aug 2008 02:03:14 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Aug 2008 02:03:14 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Make remote-m32r-sdi target already register a main thread Date: Fri, 08 Aug 2008 02:03:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Lm6mIZG6x2KXGHs" Message-Id: <200808080303.55454.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00177.txt.bz2 --Boundary-00=_Lm6mIZG6x2KXGHs Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 265 This adjust the remote-m32r-sdi target to add a thread to gdb's thread table. I've no means to test this, although the changes are very similar to what I've done to monitor.c, and remote-sim.c, the latter I did test at the time I changed it. OK? -- Pedro Alves --Boundary-00=_Lm6mIZG6x2KXGHs Content-Type: text/x-diff; charset="utf-8"; name="remote-m32r-sdi_always_a_thread.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="remote-m32r-sdi_always_a_thread.diff" Content-length: 2692 2008-08-08 Pedro Alves * remote-m32r-sdi.c (remote_m32r_ptid): New. (m32r_close): Delete the main thread. (m32r_resume): Set inferior_ptid toA remote_m32r_ptid. Add the main thread. (m32r_kill, m32r_load, sdireset_command): Delete the main thread. (_initialize_remote_m32r): Initialize remote_m32r_ptid. --- gdb/remote-m32r-sdi.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) Index: src/gdb/remote-m32r-sdi.c =================================================================== --- src.orig/gdb/remote-m32r-sdi.c 2008-08-07 20:58:31.000000000 +0100 +++ src/gdb/remote-m32r-sdi.c 2008-08-08 02:57:01.000000000 +0100 @@ -84,6 +84,11 @@ static int interrupted = 0; /* Forward data declarations */ extern struct target_ops m32r_ops; +/* This is the ptid we use while we're connected to the remote. Its + value is arbitrary, as the target doesn't have a notion of + processes or threads, but we need something non-null to place in + inferior_ptid. */ +static ptid_t remote_m32r_ptid; /* Commands */ #define SDI_OPEN 1 @@ -432,6 +437,7 @@ m32r_close (int quitting) } inferior_ptid = null_ptid; + delete_thread_silent (remote_m32r_ptid); return; } @@ -667,7 +673,8 @@ m32r_resume (ptid_t ptid, int step, enum target is active. These functions should be split out into seperate variables, especially since GDB will someday have a notion of debugging several processes. */ - inferior_ptid = pid_to_ptid (32); + inferior_ptid = remote_m32r_ptid; + add_thread_silent (remote_m32r_ptid); return; } @@ -1127,6 +1134,7 @@ m32r_kill (void) fprintf_unfiltered (gdb_stdlog, "m32r_kill()\n"); inferior_ptid = null_ptid; + delete_thread_silent (remote_m32r_ptid); return; } @@ -1366,6 +1374,7 @@ m32r_load (char *args, int from_tty) write_pc (bfd_get_start_address (exec_bfd)); inferior_ptid = null_ptid; /* No process now */ + delete_thread_silent (remote_m32r_ptid); /* This is necessary because many things were based on the PC at the time that we attached to the monitor, which is no longer valid now that we @@ -1490,6 +1499,7 @@ sdireset_command (char *args, int from_t send_cmd (SDI_OPEN); inferior_ptid = null_ptid; + delete_thread_silent (remote_m32r_ptid); } @@ -1648,4 +1658,8 @@ _initialize_remote_m32r (void) _("Set breakpoints by IB break.")); add_com ("use_dbt_break", class_obscure, use_dbt_breakpoints_command, _("Set breakpoints by dbt.")); + + /* Yes, 42000 is arbitrary. The only sense out of it, is that it + isn't 0. */ + remote_m32r_ptid = ptid_build (42000, 0, 42000); } --Boundary-00=_Lm6mIZG6x2KXGHs--