From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by sourceware.org (Postfix) with ESMTPS id BCD0E3851C0B for ; Sun, 24 May 2020 10:40:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BCD0E3851C0B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x441.google.com with SMTP id t18so503955wru.6 for ; Sun, 24 May 2020 03:40:49 -0700 (PDT) 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; bh=aBiyc28WeNSkmpPu7dB+7E3m4ZOj1BpH5wqIPmwIMHM=; b=XOyxLGPxbof/anLZhmV/odBG9btuTGLrSQBwcJrq5j62kn/bURwMSVzzm0IC0Kps5z wtsqJRc5JStH7VPsqrd5ApmCVHbdrn6vjxfNZa5Wsxg0bPskTbp5bmgtD1fSgd+tb6pr jPt2VybpwFkN1PN5pPB4dX0Kod6kz7oNCurQqVO7zUJJCZrEbaItQQ5svKZgwi7FYu5Z o7dPJDSSGGk4s8tGd0xKAwWeQJGuFzpPfGKcUImcJ7PXlUxiptUGCIn8AChkfTWKGyea 5RVhYhnYgkF8Abc0V7fAPMo34O0aFXZ6lK02JbGBSYWF4xnJ1sdcPCgr8Vnp6dDrBQMK D9Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aBiyc28WeNSkmpPu7dB+7E3m4ZOj1BpH5wqIPmwIMHM=; b=ax4la9PxpYh96D2qelsU15KAS5hPojeA0+5E1o2Wg+HEsIrv1fXYI0G0TK7gK5ZKdo bfFULV/VkO5nfrmAp7sbiHa+j/6M/+Nkt/xw2fVg3mc7hDnzWmB3thH453exeOWPZGKc jCmqN4EuoKziRx/4bzlWZULr6GMAmiy8r+8CmsY9b7N8yPzEhamOqpzlGj0zNRMgqL0E zjuqG2cZmUxIeVzj+CPkg5gbShbv6RDv5vzqMuO/bQjCf9iZ/ZCJ9zf9Dm9Qaod9nT0i 9oPAmWw1rkIB7asevXayvlXwRvU4HgaAX65ynQLl9lhBE+yntvtkDvHhScaL1QWHljIL 2FYg== X-Gm-Message-State: AOAM533+sen/cAZ/nDBm5i2Huy9dPxvC+AkGhH1/DxmPBbl2zQJDym16 qObOx22qygBE7ay1xLwgS6XXTQ== X-Google-Smtp-Source: ABdhPJwmcChQTS6WbdlpLpYgRcKfxbNP+C+kSO3D75uDkB9mtY9ODfLfOVRag3SOZfBWddh3DGfobw== X-Received: by 2002:adf:d089:: with SMTP id y9mr10506617wrh.26.1590316848837; Sun, 24 May 2020 03:40:48 -0700 (PDT) Received: from localhost (host86-128-12-16.range86-128.btcentralplus.com. [86.128.12.16]) by smtp.gmail.com with ESMTPSA id 10sm14856067wmw.26.2020.05.24.03.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 03:40:47 -0700 (PDT) Date: Sun, 24 May 2020 11:40:46 +0100 From: Andrew Burgess To: William Tambe Cc: gdb@sourceware.org Subject: Re: Target sim crashes when recording for reverse debugging; find_inferior_ptid returns null Message-ID: <20200524104046.GH2242921@embecosm.com> References: <20200517081205.GE2242921@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux/5.5.17-200.fc31.x86_64 (x86_64) X-Uptime: 11:40:25 up 34 days, 1:15, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2020 10:40:51 -0000 * William Tambe [2020-05-17 12:49:21 -0400]: > On Sun, May 17, 2020 at 10:09 AM William Tambe wrote: > > > > On Sun, May 17, 2020 at 4:12 AM Andrew Burgess > > wrote: > > > > > > * William Tambe via Gdb [2020-05-16 08:56:20 -0400]: > > > > > > > ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47: > > > > internal-error: virtual gdbarch* > > > > process_stratum_target::thread_architecture(ptid_t): Assertion `inf != > > > > NULL' failed. > > > > > > > > Above is the crash that occur after issuing following gdb commands: > > > > target sim > > > > load > > > > record > > > > si > > > > > > > > The crash occurs because find_inferior_ptid() returns NULL. > > > > From below backtrace, is it possible to determine what could be the > > > > cause of find_inferior_ptid() returning NULL ? > > > > > > I've been running with the patch below in place for doing reverse > > > debugging on a simulator. > > > > Should I revert this change if I need to use "target exec" ? > > In other words, is this change ok for both "target sim" and "target > exec" ? It should be fine for all targets. Thanks, Andrew > > > > > > > > > I need to clean this up and get it merged at some point. > > > > > > Hope this helps, > > > Thanks, > > > Andrew > > > > > > > > > --- > > > > > > commit ecc84c55f926c5a3d7c0dd16b8f46df597ed3f5f > > > Author: Andrew Burgess > > > Date: Mon Oct 21 21:17:00 2019 +0100 > > > > > > gdb: Avoid target_thread_architecture > > > > > > Don't call target_thread_architecture, get gdbarch from regcache > > > instead. > > > > > > diff --git a/gdb/record-full.c b/gdb/record-full.c > > > index 51b7beabf66..8c83b017b26 100644 > > > --- a/gdb/record-full.c > > > +++ b/gdb/record-full.c > > > @@ -1074,9 +1074,10 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal) > > > > > > if (!RECORD_FULL_IS_REPLAY) > > > { > > > - struct gdbarch *gdbarch = target_thread_architecture (ptid); > > > + struct regcache *regcache = get_current_regcache (); > > > + struct gdbarch *gdbarch = regcache->arch (); > > > > > > - record_full_message (get_current_regcache (), signal); > > > + record_full_message (regcache, signal); > > > > > > if (!step) > > > { > > > > > > > > >