From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by sourceware.org (Postfix) with ESMTPS id 57B2C38708F7 for ; Sun, 24 May 2020 14:00:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57B2C38708F7 Received: by mail-lj1-x244.google.com with SMTP id m18so18027617ljo.5 for ; Sun, 24 May 2020 07:00:14 -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=KdkboWX7U2UBryAbMGH60XO6BuF+HosndG5g9x1D4cg=; b=hc+LKmLtTU38NG5wygAsmfzSNubDKMObSCFvAMLsVe2evs4Sw+Cj5KCvKAUFkCH/K2 EM0xFAYzBPEQc5OPAcxsYcn9dsGBS0H9i0L1KCWeiIk8QKZpI+jRP+AVkwu8nLtgDUaz 8AhTGREw8jLlYD8Pe8W1P5iJD3zeq+nSfYy53SHUuIwPNZP9MU8w3z0DezAYu13fRlSY DTmzx3tG1sCefVvqEJnbR51BGJl+N+q9O2HJqndoKG3WmmiXx04EgGp/DmBX/6XVQwwc GDD27JsL792hZPW1W4SDY6y/MVzqKtvKa0d6EDfeZUiDD6wzR1zJw6hd1r6NK+CkvJTn GqPQ== X-Gm-Message-State: AOAM530Hbcb53wcOZE1qXL008R9fLUfh0t5eRlT7gIAPSRNncMcW7WhE 1JnjVfpHsgkvHXw1a6TzX9UZ0wTWIUXEHjcJue1/nxaG9c0= X-Google-Smtp-Source: ABdhPJwFEziSAH39sf4o33Vbk8idE0EHR+ILnQNTBgJJS7LUKQVNsHWWYJCGJ1mfghksOHrT9FJupkl5utwjGkunegc= X-Received: by 2002:a2e:80c1:: with SMTP id r1mr10812962ljg.115.1590328813184; Sun, 24 May 2020 07:00:13 -0700 (PDT) MIME-Version: 1.0 References: <20200517081205.GE2242921@embecosm.com> <20200524104046.GH2242921@embecosm.com> In-Reply-To: <20200524104046.GH2242921@embecosm.com> From: William Tambe Date: Sun, 24 May 2020 10:00:01 -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.4 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, 24 May 2020 14:00:15 -0000 On Sun, May 24, 2020 at 6:40 AM Andrew Burgess wrote: > > * 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. Great, thanks! > > 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) > > > > { > > > > > > > > > > > >