PetscAttachDebugger — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscAttachDebugger

Attaches the debugger to the running process.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscAttachDebugger(void)

Not Collective

## Options Database Keys

- -start_in_debugger [noxterm,lldb or gdb] [- display name] [-debugger_ranks m,n] - set debugger debug_terminal xterm or Terminal (for Apple)

- -on_error_attach_debugger [noxterm,dbx,xxgdb,xdb,xldb,gdb] [- display name] - Activates debugger attachment

- -stop_for_debugger - print a message on how to attach the process with a debugger and then wait for the user to attach

## Note

If you get the message “ stdin is not a tty, hence unable to attach debugger, see PetscAttachDebugger()”, this means the application is likely running in a batch system and you do not have terminal access to the process. You can try running with `-start_in_debugger` without the `noxterm` argument or `-stop_for_debugger`

## Developer Note

Since this can be called by the error handler, should it be calling `SETERRQ()` and `PetscCall()`?

## See Also

`PetscSetDebugger()`, `PetscSetDefaultDebugger()`, `PetscSetDebugTerminal()`, `PetscAttachDebuggerErrorHandler()`, `PetscStopForDebugger()`

## Level

advanced

## Location

src/sys/error/adebug.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages