Project

General

Profile

Debugging your sensor

This section provide some tips you might find useful for sensor debugging.

Making your program abort when an error is displayed

When your program use libprelude in a way that doesn't conform to libprelude API usage, libprelude (0.9.15 or higher) will raise a warning:

18 Aug 23:53:18 (process:6744) CRITICAL: assertion 'ptr' failed (idmef-tree-wrap.c:13974 idmef_analyzer_get_name)

This usually mean that you did something wrong, in the above case: calling idmef_analyzer_get_name() with a NULL analyzer argument.

You can use the LIBPRELUDE_ABORT environment variable to force your application to abort if a critical assertion trigger.
Before starting your program, use:

export LIBPRELUDE_ABORT=CRIT

Then if a critical assertion is raised, your program will abort:

$ ./your_program
18 Aug 23:53:18 (process:6744) CRITICAL: assertion 'xxx' failed (filename:line function)
Aborted (core dumped)
You can set the LIBPRELUDE_ABORT environment variable to any available logging priority:
  • CRIT
  • ERROR
  • WARN
  • INFO
  • DEBUG

The CRIT priority will be used in case LIBPRELUDE_ABORT is set to an empty value.