RE: Patch for non-stop remote assertion

Marc Khouzam
2011-04-25T18:31:22Z

> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Sent: Monday, April 25, 2011 2:12 PM
> To: Marc Khouzam
> Cc: 'sami wagiaalla'; 'gdb-patches@sourceware.org'
> Subject: Re: Patch for non-stop remote assertion
>
> >>>>> "Marc" == Marc Khouzam <marc.khouzam@ericsson.com> writes:
>
> Marc> #7 0x081b79b6 in is_thread_state (ptid=...,
> state=THREAD_EXITED) at ../../src/gdb/thread.c:620
> Marc> #8 0x081b7a17 in is_exited (ptid=...) at
> ../../src/gdb/thread.c:633
> Marc> #9 0x080a5143 in has_stack_frames () at
> ../../src/gdb/frame.c:1336
> Marc> #10 0x081ce2f4 in get_current_arch () at
> ../../src/gdb/arch-utils.c:757
> Marc> #11 0x08132b48 in python_on_resume (ptid=...) at
> ../../src/gdb/python/py-inferior.c:103
>
> I think the last time this came up, we established that it is
> not ok to
> call get_current_arch at this point.
>
> Basically, this is a botch in the Python API -- we designed it
> improperly :(
>
> Maybe this code (and a few associated functions) could use
> target_gdbarch for the time being. That is safer and
> probably will not
> lead to reduced functionality.
>
> Could you try the appended?

Thanks! That works. No more assertion and I can do
extended-remote debugging.

I noticed a third use of get_current_arch () in that file,
within method python_on_normal_stop (). Should that one be
changed also?

How do you want to move forward with this?

Thanks again

Marc

>
> Tom
>
> diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
> index b9df394..45f5f04 100644
> --- a/gdb/python/py-inferior.c
> +++ b/gdb/python/py-inferior.c
> @@ -100,7 +100,7 @@ python_on_resume (ptid_t ptid)
> {
> struct cleanup *cleanup;
>
> - cleanup = ensure_python_env (get_current_arch (),
> current_language);
> + cleanup = ensure_python_env (target_gdbarch, current_language);
>
> if (emit_continue_event (ptid) < 0)
> gdbpy_print_stack ();
> @@ -116,7 +116,7 @@ python_inferior_exit (struct inferior *inf)
> ptid_t ptidp;
> struct target_waitstatus status;
>
> - cleanup = ensure_python_env (get_current_arch (),
> current_language);
> + cleanup = ensure_python_env (target_gdbarch, current_language);
>
> get_last_target_status (&ptidp, &status);
>
>