From patchwork Tue Feb 4 16:47:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 37678 Received: (qmail 70075 invoked by alias); 4 Feb 2020 16:47:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 70065 invoked by uid 89); 4 Feb 2020 16:47:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2145, PUSHED X-HELO: mail-wm1-f43.google.com Received: from mail-wm1-f43.google.com (HELO mail-wm1-f43.google.com) (209.85.128.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Feb 2020 16:47:38 +0000 Received: by mail-wm1-f43.google.com with SMTP id m10so2604434wmc.0 for ; Tue, 04 Feb 2020 08:47:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id; bh=97rv1AZzXUpDjPXhj7SHsVgBdZUkimLq4XdL3geiK40=; b=eeEKLmB/JLyXC19hyjTI5E5ACSZmX2PD4xp6CELwoBY7jFE4zBn/0iNofJmY/0o21n ltaWjm8/dpUAjfQeDrRlIiM4Ih8GZBLJ9cgBzucj1bcA2HoyzF2rBTOR4dBwNGN89qd9 IXa6Xs9DXaDUT7mgibh0b40MAbZxN39CmgXzCIhg1ZRmCUIo1UbVOGe/Kg9VkuW/LAp0 1In0YHjtjZYJNCXm6PziKVHdBP2RciIktbfn7ATYgfxp95SXrZh0Ew7V6iiC2rjFfDPY wnGaEX9Rna1AhJFrRq3bviTkrPDGFOe6OBY44/qj6OksUfDmCblInh0phehyAkvqpjvh 4U5Q== Return-Path: Received: from localhost ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id y1sm18304624wrq.16.2020.02.04.08.47.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Feb 2020 08:47:35 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED] gdb/sim: Assert that the simulator ptid is not null_ptid Date: Tue, 4 Feb 2020 16:47:33 +0000 Message-Id: <20200204164733.12564-1-andrew.burgess@embecosm.com> X-IsSubscribed: yes We assign the simulator inferior a fake ptid. If this ptid is ever set to null_ptid then we are going to run into problems - the simulator ptid is what we return from gdbsim_target::wait, and this in turn is used to look up the inferior data with a call to find_inferior_pid, which asserts the pid is not 0 (which it is in null_pid). This commit adds an assert that the simulator's fake pid is not null_ptid. There should be no user visible changes after this commit. gdb/ChangeLog: * remote-sim.c (sim_inferior_data::sim_inferior_data): Assert that we don't set the fake simulator ptid to the null_ptid. Change-Id: I6e08effe70e70855aea13c9caf4fd6913d5af56d --- gdb/ChangeLog | 5 +++++ gdb/remote-sim.c | 1 + 2 files changed, 6 insertions(+) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 281232cc4e5..b7ce4672a1a 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -86,6 +86,7 @@ struct sim_inferior_data { : gdbsim_desc (desc), remote_sim_ptid (next_pid, 0, next_pid) { + gdb_assert (remote_sim_ptid != null_ptid); ++next_pid; }