[macos] Add sample to PstackWatcher

As of now, PstackWatcher is not working on macOS. None of the utilized
tools (gdb, pstack, gstack) work on macOS. ‘sample’ is an OSX specific
command-line tool, which can collect call stacks of all threads in a
process. [1] To get the instantaneous call stack of a process, one can
call: ‘sample $PID 0’. This patch adds sample to PstackWatcher. With
sample added, the PstackWatcher tests are enabled and running
successfully on macOS. I tested it on my M1 MacBook Pro.

The origin of this investigation has been the memory_gc-itest, which was
failing on my M1 MacBook Pro, with the following error message:
“Couldn't dump stacks: Service unavailable: Neither gdb, pstack, nor
gstack appear to be installed.”. Using this patch the test still fails,
however now I obtain a proper call stack dump, which is valuable for
future investigations.

[1] https://www.unix.com/man-page/osx/1/sample/

Change-Id: I59cea0e8dc99ceb00901f13805a43ec4f11d0a64
Reviewed-on: http://gerrit.cloudera.org:8080/18971
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <alexey@apache.org>
3 files changed