Bug 308341 - vgdb should report process exit (or fatal signal)
Summary: vgdb should report process exit (or fatal signal)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.9.0.SVN
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-13 19:30 UTC by Mark Wielaard
Modified: 2012-10-17 21:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch and testcases for gdbserver exit reporting (19.54 KB, patch)
2012-10-13 20:12 UTC, Mark Wielaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2012-10-13 19:30:25 UTC
The valgrind gdbserver doesn't report final process exit or fatal signal end. It just closes the remote connection causing gdb to report an error (Remote connection closed). This makes it hard to script (using gdb -x) since gdb will report an error end stop the script at that point (meaning no clean shutdown is possible).

Reproducible: Always
Comment 1 Mark Wielaard 2012-10-13 20:12:34 UTC
Created attachment 74526 [details]
Patch and testcases for gdbserver exit reporting

Luckily the code was already mostly prepared to handle this case, just the final reporting was missing. valgrind_wait () already had a comment that it could return the exit code (but didn't). So all that had to be done was add an exit/fatal signal reporting function to gdbserver and invoke that before shutting down the gdbserver. And making sure that as soon as an exit process exit is reported we stop gdbserver processing. Some new test cases included for normal exit, exit code non-zero and abort signal. Existing testcases were modified to no longer expect a "Remote connection closed" on stderrB, but "Program exited normally." on stdoutB.

Tested against GDB 7.4.50.20120120-50.fc17, 7.2-56.el6 and 7.0.1-42.el5 (which showed gdb reported normal and exit code end of process slightly differently for remote targets, a small change to filter_gdb accounts for that).
Comment 2 Philippe Waroquiers 2012-10-17 21:34:11 UTC
Fixed in revision 13052.
Thanks for the patch (slightly modified before applying e.g. to prefix
the new tests with the 2 letters indicating the tool used for the test).