Re: Target sim crashes when recording for reverse debugging; find_inferior_ptid returns null

William Tambe via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAF8i9mN-Ga29jg2hh2LT8EGVkUZw9JvX2aGgHDp6LfK-17k7AA@mail.gmail.com>
On Sun, May 17, 2020 at 10:09 AM William Tambe <[email protected]> wrote:
>
> On Sun, May 17, 2020 at 4:12 AM Andrew Burgess
> <[email protected]> wrote:
> >
> > * William Tambe via Gdb <[email protected]> [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 <[email protected]>
> > 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)
> >          {
> >
> >
> >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.