Updat README on debugging
@@ -702,11 +702,22 @@ aligned fields.
### Debugging a Buffer
-When accessing a buffer yields unexpected results, the first line of
-defense is to ensure that the the code beingi tested is linked against
-`flatccrt_d`, the debug build of the runtime library. This will ensure
-that builder calls are balanced and that required fields are set
-otherwise an assertion is raised.
+When reading a FlatBuffer does not provide the expected results, the
+first line of defense is to ensure that the the code being tested is
+linked against `flatccrt_d`, the debug build of the runtime library.
+This will ensure that builder calls are balanced and that required
+fields are set otherwise an assertion is raised.
+
+This typically also finds non-obvious runtime errors that are not
+normally checked by user code because they don't happen with correct API
+usage. For example adding a table field with an field ID that is out of
+range.
+
+Strings and tables might be returned as null pointers without this
+necessarily being an error. Perhaps the user code just need to check for
+this. Setting the `required` property in the schema would ensure this
+fields are present in the buffer, or assert in debug while building the
+buffer.
To dig further into a buffer, call the buffer verifier and see if the
buffer is actually valid with respect to the expected buffer type.
@@ -723,6 +734,12 @@ the `flatcc_rtconfig.h` file.
When reporting bugs, output from the above might also prove helpful.
+Using the JSON parser and printer can also be used to quickly create new
+buffer content without the uncertainty of user code being used
+corrrectly because the parser will know the schema and use it correctly.
+The [test_json_parser.c] has test function that might be adapted for
+custom tests.
+
## File and Type Identifiers
@@ -1670,6 +1687,7 @@ See [Benchmarks]
[Builder Interface Reference]: https://github.com/dvidelabs/flatcc/blob/master/doc/builder.md
[Benchmarks]: https://github.com/dvidelabs/flatcc/blob/master/doc/benchmarks.md
[monster_test.c]: https://github.com/dvidelabs/flatcc/blob/master/test/monster_test/monster_test.c
+[test_json_parser.c]: https://github.com/dvidelabs/flatcc/blob/master/test/json_test/test_json_parser.c
[flatcc_builder.h]: https://github.com/dvidelabs/flatcc/blob/master/include/flatcc/flatcc_builder.h
[flatcc_emitter.h]: https://github.com/dvidelabs/flatcc/blob/master/include/flatcc/flatcc_emitter.h
[flatcc-help.md]: https://github.com/dvidelabs/flatcc/blob/master/doc/flatcc-help.md
