From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by sourceware.org (Postfix) with ESMTPS id 07E18386F432 for ; Sun, 17 May 2020 16:49:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 07E18386F432 Received: by mail-lj1-x241.google.com with SMTP id b6so7312718ljj.1 for ; Sun, 17 May 2020 09:49:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x8qzFY00A/4dAnCRehEAzIj1b5LnOcBssNEi5TGWQ/U=; b=bK0A8ADfOzD4/GZ06hZDlCzyfsezadqPss/UyzpEcjLpEqpwz6VXwLR0q+HE2musTv yiVldPVFcxkJVxMGTbRf644iPuGFJTbWvTV3HWlGtbbOp5QUclJe0XEn1DtErrj39GFG HeTdBXS57VMJjPT069Getc2yqeTQEfKE0680aqroC1yv0/fN/mlZpLN7o5hIpCH2EKKy qstHxMOdprSaa6qxhQXVxuLSePHq1K1UKNeAufEsNIIL0087IqInEQM3N7VlqaDOti8W oVVnrJ4qL7xO5O7DePXRLZloDHd4t1F3bFGEwo8Yp5ggQ15vxluuIa1rY+Kf2tPWSVv4 l43Q== X-Gm-Message-State: AOAM5315Wu5Askoj/9WgQMhdSp9ZM+KiTDY/9p+Pvxj8VKKKrt8TIbAw 39QW0UX9pxQzHW7Mbe3PWmJlQLXOayDqo9+iWBYW3D71 X-Google-Smtp-Source: ABdhPJwY77gujatzfVsTkozdNZMg9FqwnbOPpxtwWsSV9b25oAM9cqfEaT+SWtxddd2mDsKIzBS5FMsFghaGkqyDYnk= X-Received: by 2002:a2e:9e97:: with SMTP id f23mr7874455ljk.228.1589734173503; Sun, 17 May 2020 09:49:33 -0700 (PDT) MIME-Version: 1.0 References: <20200517081205.GE2242921@embecosm.com> In-Reply-To: From: William Tambe Date: Sun, 17 May 2020 12:49:21 -0400 Message-ID: Subject: Re: Target sim crashes when recording for reverse debugging; find_inferior_ptid returns null To: Andrew Burgess Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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, 17 May 2020 16:49:36 -0000 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" ? > > > > > 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) > > { > > > > > >