You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Newer OCaml 4.x versions provide more details about a backtrace:
* the location within a line (column), this is useful when you have a
long `|>` pipeline for example
* the name of the function (useful for a quick glance at what could be
wrong)
Previously `xapi-backtrace` used to parse the string formatted
exceptions, and tried to extract file and line number information from
it. Use the newer functions in `Printexc` to do this instead.
String formatting needs to remain in the our `backtrace` module, because
we want to consistently format backtraces from other languages too.
This is an example of how the backtrace would look like after these
changes:
```
Raised Db_exn.DBCache_NotFound("missing table", "Observer", "")
1/4 /opt/xensource/bin/xapi @ xrtmia-13-01 Raised at Xapi_database__Db_cache_types.TableSet.find in file "ocaml/database/db_cache_types.ml", line 298, characters 22-73
2/4 /opt/xensource/bin/xapi @ xrtmia-13-01 Called from Xapi_database__Db_cache_impl.read_refs in file "ocaml/database/db_cache_impl.ml", line 314, characters 12-70
3/4 /opt/xensource/bin/xapi @ xrtmia-13-01 Called from Db_actions.DB_Action.Observer.get_all in file "ocaml/xapi/db_actions.ml", line 23053, characters 40-69
4/4 /opt/xensource/bin/xapi @ xrtmia-13-01 Called from Xapi_observer_components.is_component_enabled.(fun) in file "ocaml/xapi/xapi_observer_components.ml", line 83, characters 26-56
```
Also prevent long `List.map` sequences in a backtrace, by deduplicating
adjacent identical entries in a backtrace.
These changes also speed up calls to `Backtrace.is_important` ~10x,
although performance isn't the main goal here (raising exceptions
shouldn't be on the common path)
0 commit comments