From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id 393833851C2C for ; Fri, 29 May 2020 22:03:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 393833851C2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@gnu.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 4E1A9D669; Sat, 30 May 2020 00:03:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y1UVYu4O7bbg; Sat, 30 May 2020 00:03:51 +0200 (CEST) Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr [86.234.239.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0BD997886; Sat, 30 May 2020 00:03:51 +0200 (CEST) Received: from samy by function with local (Exim 4.93) (envelope-from ) id 1jen6U-008KH3-CH; Sat, 30 May 2020 00:03:50 +0200 Date: Sat, 30 May 2020 00:03:50 +0200 From: Samuel Thibault To: gdb-patches@sourceware.org, Simon Marchi Cc: Thomas Schwinge , thomas@schwinge.name, bug-hurd@gnu.org Subject: [PATCHv2 6/7] hurd: add gnu_target pointer to fix thread API calls Message-ID: <20200529220350.k4g6kca42vs7y3r6@function> Mail-Followup-To: gdb-patches@sourceware.org, Simon Marchi , Thomas Schwinge , thomas@schwinge.name, bug-hurd@gnu.org References: <20200529220049.gm7vt7gvtw7if6lg@function> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200529220049.gm7vt7gvtw7if6lg@function> User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 22:03:54 -0000 Fixes ../../gdb/gnu-nat.c:1110:28: error: cannot convert ‘ptid_t’ to ‘process_stratum_target*’ 1110 | thread_change_ptid (inferior_ptid, ptid); and others related to 5b6d1e4fa ("Multi-target support") gdb/ChangeLog: 2020-05-29 Samuel Thibault * gnu-nat.h (gnu_target): New variable declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Initialize gnu_target. * gnu-nat.c (gnu_target): New variable. (inf_validate_procs): Pass gnu_target to thread_change_ptid, add_thread_silent, and add_thread calls. (gnu_nat_target::create_inferior): Pass gnu_target to add_thread_silent, thread_change_ptid call. (gnu_nat_target::detach): Pass gnu_target to detach_inferior call. diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h index 77c57817b2..7c36778394 100644 --- a/gdb/gnu-nat.h +++ b/gdb/gnu-nat.h @@ -150,4 +150,7 @@ struct gnu_nat_target : public inf_child_target void stop (ptid_t) override; }; +/* The final/concrete instance. */ +extern gnu_nat_target *gnu_target; + #endif /* GNU_NAT_H */ diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c index afbe8eff49..6382ca8acb 100644 --- a/gdb/i386-gnu-nat.c +++ b/gdb/i386-gnu-nat.c @@ -439,6 +439,8 @@ _initialize_i386gnu_nat () x86_set_debug_register_length (4); #endif /* i386_DEBUG_STATE */ + gnu_target = &the_i386_gnu_nat_target; + /* Register the target. */ add_inf_child_target (&the_i386_gnu_nat_target); } diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 3b438a9a43..78e9ab7f71 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -84,6 +85,8 @@ extern "C" #include "msg_U.h" } +struct gnu_nat_target *gnu_target; + static process_t proc_server = MACH_PORT_NULL; /* If we've sent a proc_wait_request to the proc server, the pid of the @@ -1106,12 +1109,12 @@ inf_validate_procs (struct inf *inf) if (inferior_ptid == ptid_t (inf->pid)) /* This is the first time we're hearing about thread ids, after a fork-child. */ - thread_change_ptid (inferior_ptid, ptid); + thread_change_ptid (gnu_target, inferior_ptid, ptid); else if (inf->pending_execs != 0) /* This is a shell thread. */ - add_thread_silent (ptid); + add_thread_silent (gnu_target, ptid); else - add_thread (ptid); + add_thread (gnu_target, ptid); } } @@ -2149,7 +2152,7 @@ gnu_nat_target::create_inferior (const char *exec_file, /* We have something that executes now. We'll be running through the shell at this point (if startup-with-shell is true), but the pid shouldn't change. */ - add_thread_silent (ptid_t (pid)); + add_thread_silent (gnu_target, ptid_t (pid)); /* Attach to the now stopped child, which is actually a shell... */ inf_debug (inf, "attaching to child: %d", pid); @@ -2167,7 +2170,7 @@ gnu_nat_target::create_inferior (const char *exec_file, inf_resume (inf); /* We now have thread info. */ - thread_change_ptid (inferior_ptid, + thread_change_ptid (gnu_target, inferior_ptid, ptid_t (inf->pid, inf_pick_first_thread (), 0)); gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED); @@ -2273,7 +2276,7 @@ gnu_nat_target::detach (inferior *inf, int from_tty) inf_detach (gnu_current_inf); inferior_ptid = null_ptid; - detach_inferior (find_inferior_pid (pid)); + detach_inferior (find_inferior_pid (gnu_target, pid)); maybe_unpush_target (); }