| 1 | = The BOINC diagnostics API = |
| 2 | |
| 3 | BOINC applications can call |
| 4 | {{{ |
| 5 | int boinc_init_diagnostics(int flags) |
| 6 | }}} |
| 7 | to initialize various diagnostic functions. '''This call should be made early in the program - before `boinc_init()` - so that error info is routed appropriately.''' `flags` is formed by or'ing together a subset of the following flags: |
| 8 | {{{ |
| 9 | #define BOINC_DIAG_DUMPCALLSTACKENABLED 0x00000001L |
| 10 | #define BOINC_DIAG_HEAPCHECKENABLED 0x00000002L |
| 11 | #define BOINC_DIAG_MEMORYLEAKCHECKENABLED 0x00000004L |
| 12 | #define BOINC_DIAG_ARCHIVESTDERR 0x00000008L |
| 13 | #define BOINC_DIAG_ARCHIVESTDOUT 0x00000010L |
| 14 | #define BOINC_DIAG_REDIRECTSTDERR 0x00000020L |
| 15 | #define BOINC_DIAG_REDIRECTSTDOUT 0x00000040L |
| 16 | #define BOINC_DIAG_REDIRECTSTDERROVERWRITE 0x00000080L |
| 17 | #define BOINC_DIAG_REDIRECTSTDOUTOVERWRITE 0x00000100L |
| 18 | #define BOINC_DIAG_TRACETOSTDERR 0x00000200L |
| 19 | #define BOINC_DIAG_TRACETOSTDOUT 0x00000400L |
| 20 | }}} |
| 21 | |
| 22 | The flags are as follows. Applications are advised to use at least `BOINC_DIAG_DUMPCALLSTACKENABLED`, `BOINC_DIAG_REDIRECTSTDERR`, and `BOINC_DIAG_TRACETOSTDERR`. |
| 23 | |
| 24 | '''BOINC_DIAG_DUMPCALLSTACKENABLED ''':: |
| 25 | If the application crashes, write a symbolic call stack to stderr. If you use this in a Windows app, you must include lib/stackwalker_win.cpp in the compile, and you must include the .pdb (symbol) file in your app version bundle. |
| 26 | '''BOINC_DIAG_HEAPCHECKENABLED''':: |
| 27 | Check the integrity of the malloc heap every N allocations. (N is line 120 in diagnostics.C; default 1024). |
| 28 | '''BOINC_DIAG_MEMORYLEAKCHECKENABLED''':: |
| 29 | When process exits, write descriptions of any outstanding memory allocations to stderr. |
| 30 | '''BOINC_DIAG_ARCHIVESTDERR''':: |
| 31 | Rename stderr.txt to stderr.old on startup. |
| 32 | '''BOINC_DIAG_ARCHIVESTDOUT''':: |
| 33 | Rename stdout.txt to stdout.old on startup. |
| 34 | '''BOINC_DIAG_REDIRECTSTDERR''':: |
| 35 | Redirect stderr to stderr.txt. |
| 36 | '''BOINC_DIAG_REDIRECTSTDOUT''':: |
| 37 | Redirect stdout to stdout.txt. |
| 38 | '''BOINC_DIAG_REDIRECTSTDERROVERWRITE''':: |
| 39 | Overwrite stderr.txt (default is to append). |
| 40 | '''BOINC_DIAG_REDIRECTSTDOUTOVERWRITE''':: |
| 41 | Overwrite stdout.txt (default is to append). |
| 42 | '''BOINC_DIAG_TRACETOSTDERR''':: |
| 43 | Write TRACE macros to stderr (Windows specific). |
| 44 | '''BOINC_DIAG_TRACETOSTDOUT''':: |
| 45 | Write TRACE macros to stdout (Windows specific). |