Ironically, viewing the user space stack of a process or thread seems harder to do on a typical Linux distro (as opposed to viewing the kernel-mode stack, as we just saw in the previous section). There is a utility to do so: gstack(1). In reality, it's just a simple wrapper over a script that invokes gdb(1) in batch mode, getting gdb to invoke its backtrace command.
Unfortunately, on Ubuntu (18.04 LTS at least), there seems to be an issue; the gstack program was not found in any native package. (Ubuntu does have a pstack(1) utility, but, at least on my test VM, it failed to work well.) A workaround is to simply use gdb directly (you can always attach <PID> and issue the [thread apply all] bt command to view the user mode stack(s)).
On my x86_64 Fedora 29 guest system, though, the gstack(1) utility cleanly installs and runs well; an example is as follows (our Bash process' PID here happens to...