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: [PATCH] Fix mi-detach.exp on native-gdbserver


On 09/02/2015 10:24 PM, Simon Marchi wrote:
> The =thread-exited event did not appear when detaching from a process
> with "target remote".
> 
> When mourning an inferior, target remote takes a different path than
> target extended_remote.  target remote calls unpush_target first which
> calls remote_close in order to close the "remote" target.  remote_close
> calls discard_all_inferiors, which exits all inferiors with
> exit_inferior_silent.  Because it's the _silent version, we don't see
> the MI event.
> 
> extended_remote_mourn calls generic_mourn_inferior, which calls
> exit_inferior.  Since it's the non-silent version, we see the MI event.

Please try enabling "set print inferior-events on".  With native
debugging, we currently get:

 (gdb) detach
 Detaching from program: /home/pedro/gdb/tests/main, process 15759
 [Inferior 15759 detached]
                 ^^^^^^^^

However, with target extended-remote, we get:

 (gdb) tar extended-remote :9999
 (gdb) detach
 Detaching from program: /home/pedro/gdb/tests/main, process 15789
 [Inferior 15789 exited]
                 ^^^^^^

And with target remote, we get nothing:

 (gdb) tar remote :9999
 0x0000003615a011f0 in _start () from target:/lib64/ld-linux-x86-64.so.2
 (gdb) detach
 Detaching from program: /home/pedro/gdb/tests/main, process 15767
 Ending remote debugging.
 (gdb)

With your patch, we'll print "exited" in the remote case too,
when it seems to me that in both extended-remote and remote
we should be saying "detached" like in the native case.

Also, if the user does "disconnect", after your patch gdb will
say the inferiors we were debugging "exited" while they were
left running on the target side.  Is that confusing?

Thanks,
Pedro Alves


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