From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79586 invoked by alias); 19 Jan 2020 21:12:22 -0000 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 Received: (qmail 79578 invoked by uid 89); 19 Jan 2020 21:12:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.1 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=H*RU:209.85.128.68, HX-Spam-Relays-External:209.85.128.68 X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 19 Jan 2020 21:12:20 +0000 Received: by mail-wm1-f68.google.com with SMTP id 20so12737803wmj.4 for ; Sun, 19 Jan 2020 13:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=boLq6LzfQ+1sym0UL9WnYxeFIxvLIgQMZczv1LO0G4w=; b=a4aE6gGROzQX3XItG4gtAOr1CVVPl7urc4pgQGT2fpeVIlt9o1MzkxMSjfTgYaRF75 9FaH8ibidF0zxC5OZlStjdB9v0/4qprEaqd2Z1l7VYAevdztuapmsSDJaoTHYwJRVjSX Z4BkDADEjXNvXOJVg8ToljcohhoaqSSbg+HhsnMaux4rGLnFarAt6fGDFZLwxYFMud58 ZqZKv27oOpWwSSp8uEEt+SVx0f58RNc9HtzXMD1RD4ux8NLzMPAnIu87JPNJe0+J2zmi z9+Q9WIHtZmoCk00s9nPQ428597okdCRpO1w13wyHRLLcrAmTWPdoDbUU58QgvKc2PI8 q7DQ== Return-Path: Received: from localhost (host86-191-239-73.range86-191.btcentralplus.com. [86.191.239.73]) by smtp.gmail.com with ESMTPSA id i10sm45355506wru.16.2020.01.19.13.12.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 Jan 2020 13:12:18 -0800 (PST) Date: Sun, 19 Jan 2020 23:23:00 -0000 From: Andrew Burgess To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] sim: don't rely on inferior_ptid in gdbsim_target::wait Message-ID: <20200119211217.GE3865@embecosm.com> References: <20200119035557.5975-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200119035557.5975-1-simon.marchi@polymtl.ca> X-Fortune: An adequate bootstrap is a contradiction in terms. X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00598.txt.bz2 * Simon Marchi [2020-01-18 22:55:57 -0500]: > When running a program with the simulator target, I get: > > /home/simark/src/binutils-gdb/gdb/inferior.c:279: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed. > > This can be reproduced by building a GDB for --target=arm-none-gnueabi, > and running with > > $ ./gdb -nx --data-directory=data-directory a.out -ex "target sim" -ex load -ex "b main" -ex r > > Where a.out is any program with a main. > > The problem is that gdbsim_target::wait assumes that inferior_ptid has > the value of the thread it wants to report an event for. > > Actually, it's the target's responsibility to come up with the ptid of > the thread the event is for. In the sim target, that ptid is stored in > sim_inferior_data::remote_sim_ptid, so return that instead of > inferior_ptid. > > ChangeLog: > > * remote-sim.c (gdbsim_target::wait): Return > sim_data->remote_sim_ptid instead of inferior_ptid. This makes sense. LGTM. Thanks, Andrew > --- > gdb/remote-sim.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c > index fb05786d4e28..d43648bd5171 100644 > --- a/gdb/remote-sim.c > +++ b/gdb/remote-sim.c > @@ -1016,7 +1016,7 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options) > break; > } > > - return inferior_ptid; > + return sim_data->remote_sim_ptid; > } > > /* Get ready to modify the registers array. On machines which store > -- > 2.24.1 >