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

Andrew Burgess andrew.burgess@embecosm.com
Sun May 24 10:40:46 GMT 2020


* William Tambe <tambewilliam@gmail.com> [2020-05-17 12:49:21 -0400]:

> On Sun, May 17, 2020 at 10:09 AM William Tambe <tambewilliam@gmail.com> wrote:
> >
> > On Sun, May 17, 2020 at 4:12 AM Andrew Burgess
> > <andrew.burgess@embecosm.com> wrote:
> > >
> > > * William Tambe via Gdb <gdb@sourceware.org> [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 <andrew.burgess@embecosm.com>
> > > 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)
> > >          {
> > >
> > >
> > >


More information about the Gdb mailing list