FIX: NOBUG_LOG env parsing error
[nobug.git] / doc / dumping.txt
blobb6fd182799be0153891f45d8d9d72a76a39f1055
1 HEAD- Dumping Data Structures; dumping; dump complete datastructures
3 One can write functions to dump complex data structures using the NoBug
4 facilities. This is done by writing a custom function for each
5 data structure to be dumped, which may recursively call other dumping
6 functions. There are macros that can log within such a dumper function
7 and to initialise a dump of a given data structure.
9 A dump function has the prototype:
11 [source,c]
12 -------------------------------------------------------
13 void
14 nobug_NAME_dump (const struct NAME* POINTER,
15                  const int DEPTH,
16                  const struct nobug_context context,
17                  void* EXTRA);
18 -------------------------------------------------------
20 where 'NAME' is the identifier for what you want to dump, 'POINTER' is a pointer
21 to the data to be dumped, 'DEPTH' is an integer which will be decremented when
22 recursing into the data structure dumper (your dump function does that, see
23 below) to limit the recursion depth, 'context' is a source context generated by
24 nobug when you call DUMP() and 'EXTRA' is a pointer transparently passed around
25 that you can use to store some additional state. The 'context' variable must
26 be named `context` because the `DUMP_LOG()` macro relies on this.