The gcore program creates a core file image of the process specified by pid. The resulting core file can be used with a debugger, e.g. lldb, to examine the state of the process.