From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70066 invoked by alias); 20 Jan 2020 15:13:59 -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 70055 invoked by uid 89); 20 Jan 2020 15:13:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Jan 2020 15:13:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579533227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WSlGra0K6cmBzTXFmBVmS89jM79M/VLnilAKFGciAlY=; b=el9xPD+pxde8oddPP8fSBPsxy+zuyUO2S5kkOfH6HyTAO1+AavEUgrIYByMgT0AsEe+Ke/ eRqef/YTKa12klqFk2/KAdw93xxDEWxXQOXNRtimHuw9GiZotKcuBkwYSGj8WhdLGWKmls XJoEptyTfal4lbYyuh/EZZ3flYje1B0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-aS7ShIXgNxWP1RBCRj-RTQ-1; Mon, 20 Jan 2020 10:13:45 -0500 Received: by mail-wm1-f72.google.com with SMTP id s25so2142759wmj.3 for ; Mon, 20 Jan 2020 07:13:42 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id w19sm4273194wmc.22.2020.01.20.07.13.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jan 2020 07:13:41 -0800 (PST) Subject: Re: [PATCH] sim: don't rely on inferior_ptid in gdbsim_target::wait To: Simon Marchi , Andrew Burgess References: <20200119035557.5975-1-simon.marchi@polymtl.ca> <20200119211217.GE3865@embecosm.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <25d128db-0f20-b812-a4e9-dbdc183986a2@redhat.com> Date: Mon, 20 Jan 2020 15:28:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-01/txt/msg00607.txt.bz2 On 1/20/20 12:48 AM, Simon Marchi wrote: > On 2020-01-19 4:12 p.m., Andrew Burgess wrote: >> * 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 > > Thanks, I pushed it. Thanks for doing this. This was a recent assertion I added with the multi-target work. It's possibly (and likely) that other ports will need similar adjustments, but it's hard to tell with actually running into the issue. Thanks, Pedro Alves