This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: fix crash when inferior exits during "continue"


On Tue, 07 Feb 2012 20:13:54 +0100, Tom Tromey wrote:
> Built and regtested on x86-64 Fedora 15.

It does crash for me on F-15 but it does not crash on either F-16 or F-17.


> b/gdb/ChangeLog:

Missing testsuite/ ChangeLog.


> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/inferior-died.exp
> @@ -0,0 +1,56 @@
> +# Copyright 2012 Free Software Foundation, Inc.
> +
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +if { [is_remote target] || ![isnative] } then {

"isnative" is excessive"; but linux-nat cannot be cross-target anyway.

> +    unsupported "inferior-died.exp"
> +    continue
> +}
> +
> +# Until "set follow-fork-mode" and "catch fork" are implemented on
> +# other targets...
> +#
> +if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-*-linux*"]} then {
> +    unsupported "inferior-died.exp"
> +    continue
> +}
> +
> +if { ![support_displaced_stepping] } {
> +    unsupported "inferior-died.exp"
> +    return -1
> +}
> +
[...]
> --- a/gdb/thread.c
> +++ b/gdb/thread.c
[...]
> @@ -1091,8 +1101,15 @@ do_restore_current_thread_cleanup (void *arg)
>      restore_current_thread (old->inferior_ptid);
>    else
>      {
> +      struct inferior *inf = find_inferior_id (old->inf_id);
> +
>        restore_current_thread (null_ptid);
> -      set_current_inferior (find_inferior_id (old->inf_id));
> +
> +      /* If the inferior was deleted, choose some other inferior.  */

Maybe during make_cleanup_restore_current_thread temporarily remember + clear
inferior->removable instead.


> +      if (inf == NULL)
> +	inf = iterate_over_inferiors (choose_first_inferior, NULL);
> +
> +      set_current_inferior (inf);
>      }
>  
>    /* The running state of the originally selected thread may have


Thanks,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]