Previously, this was implemented using a horrible GDB script (because
there is no such thing as a non-horrible GDB script). This GDB script
often broke with newer versions of GDB for mysterious reasons. Port
the test script to GDB's Python API, which makes the code much cleaner
and, hopefully, more stable.
(cherry picked from commit
cbbda62258360f035894cff9dfd66c60b0cc707f)
Conflicts:
test/T380-atomicity.sh