How do you debug a running process or a library that is being called?

strace -p PID
ltrace libraryfile