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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sourceware - gdb list mailing list
../../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 ?

(gdb) record
(gdb) si

Thread 1 "iron-elf-gdb" hit Breakpoint 1,
process_stratum_target::thread_architecture (this=<optimized out>,
ptid=...) at ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47
47        gdb_assert (inf != NULL);
=> 0x00005555557cd709
<process_stratum_target::thread_architecture(ptid_t)+25>: 48 83 c4 20
   add    $0x20,%rsp
   0x00005555557cd70d
<process_stratum_target::thread_architecture(ptid_t)+29>: 48 85 c0
   test   %rax,%rax
   0x00005555557cd710
<process_stratum_target::thread_architecture(ptid_t)+32>: 74 0c   je
  0x5555557cd71e
<process_stratum_target::thread_architecture(ptid_t)+46>
(gdb) p inf
$2 = (inferior *) 0x555555cc3d90
(gdb) bt
#0  process_stratum_target::thread_architecture (this=<optimized out>,
ptid=...) at ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47
#1  0x00005555557df091 in record_full_target::resume
(this=0x555555bc8fb0 <record_full_ops>, ptid=..., step=0,
signal=GDB_SIGNAL_0) at
../../iron-toolchain/binutils/gdb/record-full.c:1078
#2  0x0000555555865670 in target_resume (ptid=..., step=0,
signal=GDB_SIGNAL_0) at
../../iron-toolchain/binutils/gdb/target.h:1326
#3  0x00005555557531ab in do_target_resume (resume_ptid=..., step=0,
sig=GDB_SIGNAL_0) at ../../iron-toolchain/binutils/gdb/infrun.c:2264
#4  0x000055555575af02 in resume_1 (sig=GDB_SIGNAL_0) at
../../iron-toolchain/binutils/gdb/infrun.c:2653
#5  resume (sig=GDB_SIGNAL_0) at ../../iron-toolchain/binutils/gdb/infrun.c:2666
#6  0x000055555575bca0 in keep_going_pass_signal (ecs=0x7fffffffd870)
at ../../iron-toolchain/binutils/gdb/infrun.c:8044
#7  0x000055555575bfd1 in start_step_over () at
../../iron-toolchain/binutils/gdb/infrun.c:2049
#8  0x0000555555761f1e in proceed
(addr=addr@entry=18446744073709551615,
siggnal=siggnal@entry=GDB_SIGNAL_DEFAULT) at
../../iron-toolchain/binutils/gdb/infrun.c:3130
#9  0x000055555574b091 in step_1 (skip_subroutines=0,
single_inst=<optimized out>, count_string=<optimized out>) at
../../iron-toolchain/binutils/gdb/infcmd.c:1047
#10 0x000055555566125a in cmd_func (cmd=<optimized out>,
args=<optimized out>, from_tty=<optimized out>) at
../../iron-toolchain/binutils/gdb/cli/cli-decode.c:2004
#11 0x0000555555880073 in execute_command (p=<optimized out>,
p@entry=0x555555e2ec70 "si", from_tty=1) at
../../iron-toolchain/binutils/gdb/top.c:655
#12 0x000055555570c755 in command_handler (command=0x555555e2ec70
"si") at ../../iron-toolchain/binutils/gdb/event-top.c:588
#13 0x000055555570d631 in command_line_handler (rl=...) at
../../iron-toolchain/binutils/gdb/event-top.c:773
#14 0x000055555570cfcc in gdb_rl_callback_handler (rl=0x555555ccfb60
"si") at /usr/include/c++/9/bits/unique_ptr.h:153
#15 0x000055555590ffe8 in rl_callback_read_char () at
../../../iron-toolchain/binutils/readline/readline/callback.c:281
#16 0x000055555570c276 in gdb_rl_callback_read_char_wrapper_noexcept
() at ../../iron-toolchain/binutils/gdb/event-top.c:177
#17 0x000055555570ce85 in gdb_rl_callback_read_char_wrapper
(client_data=<optimized out>) at
../../iron-toolchain/binutils/gdb/event-top.c:193
#18 0x000055555570c198 in stdin_event_handler (error=<optimized out>,
client_data=0x555555c087e0) at
../../iron-toolchain/binutils/gdb/event-top.c:516
#19 0x0000555555993226 in gdb_wait_for_event (block=block@entry=1) at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:673
#20 0x000055555599349b in gdb_wait_for_event (block=1) at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:569
#21 gdb_do_one_event () at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:215
#22 0x00005555557856a5 in start_event_loop () at
../../iron-toolchain/binutils/gdb/main.c:356
#23 captured_command_loop () at ../../iron-toolchain/binutils/gdb/main.c:416
#24 0x00005555557875e5 in captured_main (data=<optimized out>) at
../../iron-toolchain/binutils/gdb/main.c:1254
#25 gdb_main (args=<optimized out>) at
../../iron-toolchain/binutils/gdb/main.c:1269
#26 0x00005555555da2b0 in main (argc=<optimized out>, argv=<optimized
out>) at ../../iron-toolchain/binutils/gdb/gdb.c:32
(gdb) c
Continuing.
iron-gdb: iron_process_record: addr == 0x1f448

Thread 1 "iron-elf-gdb" hit Breakpoint 1,
process_stratum_target::thread_architecture (this=<optimized out>,
ptid=...) at ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47
47        gdb_assert (inf != NULL);
=> 0x00005555557cd709
<process_stratum_target::thread_architecture(ptid_t)+25>: 48 83 c4 20
   add    $0x20,%rsp
   0x00005555557cd70d
<process_stratum_target::thread_architecture(ptid_t)+29>: 48 85 c0
   test   %rax,%rax
   0x00005555557cd710
<process_stratum_target::thread_architecture(ptid_t)+32>: 74 0c   je
  0x5555557cd71e
<process_stratum_target::thread_architecture(ptid_t)+46>
(gdb) p inf
$3 = (inferior *) 0x555555cc3d90
(gdb) bt
#0  process_stratum_target::thread_architecture (this=<optimized out>,
ptid=...) at ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47
#1  0x00005555557e56e3 in get_thread_regcache (target=0x555555bc9060
<gdbsim_ops>, ptid=...) at
../../iron-toolchain/binutils/gdb/regcache.c:373
#2  0x00005555557e57c4 in get_thread_regcache (thread=<optimized out>)
at ../../iron-toolchain/binutils/gdb/target.h:1323
#3  0x000055555575e507 in handle_signal_stop (ecs=0x7fffffffde10) at
../../iron-toolchain/binutils/gdb/infrun.c:5874
#4  0x000055555576061c in handle_inferior_event (ecs=<optimized out>)
at ../../iron-toolchain/binutils/gdb/infrun.c:5585
#5  0x00005555557615bd in fetch_inferior_event (client_data=<optimized
out>) at ../../iron-toolchain/binutils/gdb/infrun.c:4027
#6  0x000055555560b43a in check_async_event_handlers () at
../../iron-toolchain/binutils/gdb/async-event.c:295
#7  0x000055555599345b in gdb_do_one_event () at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:194
#8  0x00005555557856a5 in start_event_loop () at
../../iron-toolchain/binutils/gdb/main.c:356
#9  captured_command_loop () at ../../iron-toolchain/binutils/gdb/main.c:416
#10 0x00005555557875e5 in captured_main (data=<optimized out>) at
../../iron-toolchain/binutils/gdb/main.c:1254
#11 gdb_main (args=<optimized out>) at
../../iron-toolchain/binutils/gdb/main.c:1269
#12 0x00005555555da2b0 in main (argc=<optimized out>, argv=<optimized
out>) at ../../iron-toolchain/binutils/gdb/gdb.c:32
(gdb) c
Continuing.
0x0001f44a      713             struct task_struct *tsk = current;
=> 0x0001f44a <do_exit+14>:     f6 51   ld32 %5, %1
   0x0001f44c <do_exit+16>:     82 44   li8 %4, 0x24 # 36
   0x0001f44e <do_exit+18>:     b8 40   add %4, %sp
   0x0001f450 <do_exit+20>:     f2 54   st32 %5, %4
(gdb) si

Thread 1 "iron-elf-gdb" hit Breakpoint 1,
process_stratum_target::thread_architecture (this=<optimized out>,
ptid=...) at ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47
47        gdb_assert (inf != NULL);
=> 0x00005555557cd709
<process_stratum_target::thread_architecture(ptid_t)+25>: 48 83 c4 20
   add    $0x20,%rsp
   0x00005555557cd70d
<process_stratum_target::thread_architecture(ptid_t)+29>: 48 85 c0
   test   %rax,%rax
   0x00005555557cd710
<process_stratum_target::thread_architecture(ptid_t)+32>: 74 0c   je
  0x5555557cd71e
<process_stratum_target::thread_architecture(ptid_t)+46>
(gdb) p inf
$4 = (inferior *) 0x0
(gdb) bt
#0  process_stratum_target::thread_architecture (this=<optimized out>,
ptid=...) at ../../iron-toolchain/binutils/gdb/process-stratum-target.c:47
#1  0x00005555557df091 in record_full_target::resume
(this=0x555555bc8fb0 <record_full_ops>, ptid=..., step=0,
signal=GDB_SIGNAL_0) at
../../iron-toolchain/binutils/gdb/record-full.c:1078
#2  0x0000555555865670 in target_resume (ptid=..., step=0,
signal=GDB_SIGNAL_0) at
../../iron-toolchain/binutils/gdb/target.h:1326
#3  0x00005555557531ab in do_target_resume (resume_ptid=..., step=0,
sig=GDB_SIGNAL_0) at ../../iron-toolchain/binutils/gdb/infrun.c:2264
#4  0x000055555575af02 in resume_1 (sig=GDB_SIGNAL_0) at
../../iron-toolchain/binutils/gdb/infrun.c:2653
#5  resume (sig=GDB_SIGNAL_0) at ../../iron-toolchain/binutils/gdb/infrun.c:2666
#6  0x000055555575bca0 in keep_going_pass_signal (ecs=0x7fffffffdac0)
at ../../iron-toolchain/binutils/gdb/infrun.c:8044
#7  0x000055555576254b in proceed
(addr=addr@entry=18446744073709551615,
siggnal=siggnal@entry=GDB_SIGNAL_DEFAULT) at
../../iron-toolchain/binutils/gdb/infrun.c:3198
#8  0x000055555574b091 in step_1 (skip_subroutines=0,
single_inst=<optimized out>, count_string=<optimized out>) at
../../iron-toolchain/binutils/gdb/infcmd.c:1047
#9  0x000055555566125a in cmd_func (cmd=<optimized out>,
args=<optimized out>, from_tty=<optimized out>) at
../../iron-toolchain/binutils/gdb/cli/cli-decode.c:2004
#10 0x0000555555880073 in execute_command (p=<optimized out>,
p@entry=0x5555560cdcd0 "si", from_tty=1) at
../../iron-toolchain/binutils/gdb/top.c:655
#11 0x000055555570c755 in command_handler (command=0x5555560cdcd0
"si") at ../../iron-toolchain/binutils/gdb/event-top.c:588
#12 0x000055555570d631 in command_line_handler (rl=...) at
../../iron-toolchain/binutils/gdb/event-top.c:773
#13 0x000055555570cfcc in gdb_rl_callback_handler (rl=0x5555560ca130
"si") at /usr/include/c++/9/bits/unique_ptr.h:153
#14 0x000055555590ffe8 in rl_callback_read_char () at
../../../iron-toolchain/binutils/readline/readline/callback.c:281
#15 0x000055555570c276 in gdb_rl_callback_read_char_wrapper_noexcept
() at ../../iron-toolchain/binutils/gdb/event-top.c:177
#16 0x000055555570ce85 in gdb_rl_callback_read_char_wrapper
(client_data=<optimized out>) at
../../iron-toolchain/binutils/gdb/event-top.c:193
#17 0x000055555570c198 in stdin_event_handler (error=<optimized out>,
client_data=0x555555c087e0) at
../../iron-toolchain/binutils/gdb/event-top.c:516
#18 0x0000555555993226 in gdb_wait_for_event (block=block@entry=1) at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:673
#19 0x000055555599349b in gdb_wait_for_event (block=1) at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:569
#20 gdb_do_one_event () at
../../iron-toolchain/binutils/gdbsupport/event-loop.cc:215
#21 0x00005555557856a5 in start_event_loop () at
../../iron-toolchain/binutils/gdb/main.c:356
#22 captured_command_loop () at ../../iron-toolchain/binutils/gdb/main.c:416
#23 0x00005555557875e5 in captured_main (data=<optimized out>) at
../../iron-toolchain/binutils/gdb/main.c:1254
#24 gdb_main (args=<optimized out>) at
../../iron-toolchain/binutils/gdb/main.c:1269
#25 0x00005555555da2b0 in main (argc=<optimized out>, argv=<optimized
out>) at ../../iron-toolchain/binutils/gdb/gdb.c:32
(gdb) c
Continuing.
../../iron-toolchain/binutils/gdb/process-stratum-target.c:47:
internal-error: virtual gdbarch*
process_stratum_target::thread_architecture(ptid_t): Assertion `inf !=
NULL' failed.
Reply | Threaded
Open this post in threaded view
|

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

Andrew Burgess
* William Tambe via Gdb <[hidden email]> [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.

I need to clean this up and get it merged at some point.

Hope this helps,
Thanks,
Andrew


---

commit ecc84c55f926c5a3d7c0dd16b8f46df597ed3f5f
Author: Andrew Burgess <[hidden email]>
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)
         {



Reply | Threaded
Open this post in threaded view
|

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

Sourceware - gdb list mailing list
On Sun, May 17, 2020 at 4:12 AM Andrew Burgess
<[hidden email]> wrote:

>
> * William Tambe via Gdb <[hidden email]> [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" ?

>
> I need to clean this up and get it merged at some point.
>
> Hope this helps,
> Thanks,
> Andrew
>
>
> ---
>
> commit ecc84c55f926c5a3d7c0dd16b8f46df597ed3f5f
> Author: Andrew Burgess <[hidden email]>
> 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)
>          {
>
>
>
Reply | Threaded
Open this post in threaded view
|

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

Sourceware - gdb list mailing list
On Sun, May 17, 2020 at 10:09 AM William Tambe <[hidden email]> wrote:

>
> On Sun, May 17, 2020 at 4:12 AM Andrew Burgess
> <[hidden email]> wrote:
> >
> > * William Tambe via Gdb <[hidden email]> [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 <[hidden email]>
> > 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)
> >          {
> >
> >
> >
Reply | Threaded
Open this post in threaded view
|

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

Andrew Burgess
* William Tambe <[hidden email]> [2020-05-17 12:49:21 -0400]:

> On Sun, May 17, 2020 at 10:09 AM William Tambe <[hidden email]> wrote:
> >
> > On Sun, May 17, 2020 at 4:12 AM Andrew Burgess
> > <[hidden email]> wrote:
> > >
> > > * William Tambe via Gdb <[hidden email]> [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 <[hidden email]>
> > > 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)
> > >          {
> > >
> > >
> > >
Reply | Threaded
Open this post in threaded view
|

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

Sourceware - gdb list mailing list
On Sun, May 24, 2020 at 6:40 AM Andrew Burgess
<[hidden email]> wrote:

>
> * William Tambe <[hidden email]> [2020-05-17 12:49:21 -0400]:
>
> > On Sun, May 17, 2020 at 10:09 AM William Tambe <[hidden email]> wrote:
> > >
> > > On Sun, May 17, 2020 at 4:12 AM Andrew Burgess
> > > <[hidden email]> wrote:
> > > >
> > > > * William Tambe via Gdb <[hidden email]> [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 <[hidden email]>
> > > > 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)
> > > >          {
> > > >
> > > >
> > > >