Community
Participate
Working Groups
From Bug 402054 comment #6: > An exit code only happens when a process terminates on its own. Currently, > in such a case, the process will simply disappear from the debug session (or > the session will terminate if the correct preference is enabled). I think > it would be more user-friendly to let the user know the process has > terminated. The idea is not simply to show the exit code of the process, but also to indicate to the user that a process terminated on its own. Currently, having the process simply disappear can cause confusion. When a user presses terminate or detach, they expect the process to disappear, but when there is no user action and the process disappears, it does not feel user-friendly. The other aspect of this is to allow the user to remove the exited process from the debug view once they are aware that it terminated. I first thought of using the platform's "Remove all terminated launches" but that action is not re-targettable, so changes would be required in platform. Other options would be to add a new button. But maybe re-using the terminate and/or disconnect buttons when the exited process is selected would make sense to the user. Beyond showing the exited process and its exit code, it may be nice to show the time at which it exited. I believe CDI does this. If the process is terminated or disconnected from by the user, we should not keep it in the debug view; we should only keep processes that exit on their own.
New Gerrit change created: https://git.eclipse.org/r/45070
(In reply to Eclipse Genie from comment #1) > New Gerrit change created: https://git.eclipse.org/r/45070 This patch allows to keep showing exited processes in the DV. To easily try it, you should allow GDB to continue running after the process terminates (unselect preferences->C/C++->Debug->GDB->"Terminate GDB when last process exits"). 1- works for GDB >= 7.0 2- shows terminated processes of any kind (exited on their own, user clicked "terminate", user clicked "disconnect"). 3- with GDB 7.9, exit code is shown when process exited on its own 4- allows to restart an exited process (I thought that was cool) 5- works with multi-process 6- currently no way to remove those entries Todo: 1- test with all launch configuration types 2- support removing exited entries 3- add JUnit tests 4- should we only show processes that exited on their own, or also terminated processes? Probably shouldn't show processes that we disconnected from 5- should we show date and time of exit as CDI does? 6- should the label say "terminated" instead of "exited" (I just noticed this) 7- is this feature desirable? If so, do we want a pref to turn it off? Comments welcomed.
(In reply to Marc Khouzam from comment #2) > > New Gerrit change created: https://git.eclipse.org/r/45070 I pushed patchset 4 which I believe is complete, except for JUnit tests. I'm hoping that we can commit this before feature freeze next Monday. > This patch allows to keep showing exited processes in the DV. To easily try > it, you should allow GDB to continue running after the process terminates > (unselect preferences->C/C++->Debug->GDB->"Terminate GDB when last process > exits"). 1- works for GDB >= 7.0 2- shows terminated processes that exited on their own and once for which the user clicked "terminate" (if the user clicked "disconnect", we don't show them). 3- with GDB 7.9, exit code is shown when process exited on its own 4- allows to restart an exited process (I thought that was cool) 5- works with multi-process 6- user can press terminate or disconnect on "exited processes" to remove them from the Debug view. Multi-select works. I tried to align the "exited process" entry with the one shown when doing a Run and the process terminates. That means the label is like Run and the icon used too. I think the only thing left, besides getting it reviewed, is for me to add JUnit tests.
As described in the review, Alvaro testing with a program that uses fork() and we noticed that in those cases, GDB automatically cleans up old inferiors. My original solution was counting on GDB always providing the exit code of exited processes through -list-thread-groups, but if GDB cleans those up, then we lose access to the exit code. My first thought was to simply cache the exit code. This may be sufficient, but I'm wondering if we could face a race condition if GDB were to cleanup the old inferior before CDT sent the -list-thread-groups command. A better option would be to use the exit code from the event =thread-group-exited. I'll try that out. Now, GDB decided to cleanup old inferiors in the case they were created using fork(); this is surely because in that case, _many_ inferiors could be created. This is true for CDT also, where the exited processes would accumulate in the debug view. We could add a preference to disable showing the exited processes, but I prefer not adding yet another preference. Instead, I suggest limiting the number of exited processes shown to 5. It won't overcrowd the view, will still allow the user to notice a process has exited, and will avoid the accumulation of too many exited processes. If this turns to be too limiting for someone, we can revisit.
Created attachment 252966 [details] Screenshot showing exited processes Here is what the changes looks like in the Debug view when there are processes that exited.
Gerrit change https://git.eclipse.org/r/45070 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d533adec3c6b23c36f06890dc1f2ab3a058f4c3e
Committed to master. Thanks Alvaro for the quick review. I'll update the N&N