Module Printexc.Slot
Contents
Instructions: Use this module in your project
In the IDE (CLion, Visual Studio Code, Xcode, etc.) you use for your DkSDK project:
Add the following to your project's
dependencies/CMakeLists.txt:DkSDKProject_DeclareAvailable(ocaml CONSTRAINT "= 4.14.0" FINDLIBS str unix runtime_events threads dynlink) DkSDKProject_MakeAvailable(ocaml)Add the
Findlib::ocamllibrary to any desired targets insrc/*/CMakeLists.txt:target_link_libraries(YourPackage_YourLibraryName # ... existing libraries, if any ... Findlib::ocaml)Click your IDE's
Buildbutton
Not using DkSDK?
FIRST, do one or all of the following:
Run:
opam install ocaml.4.14.0Edit your
dune-projectand add:(package (name YourExistingPackage) (depends ; ... existing dependenices ... (ocaml (>= 4.14.0))))Then run:
dune build *.opam # if this fails, run: dune buildEdit your
<package>.opamfile and add:depends: [ # ... existing dependencies ... "ocaml" {>= "4.14.0"} ]Then run:
opam install . --deps-only
FINALLY, add the library to any desired (library)and/or (executable) targets in your **/dune files:
(library
(name YourLibrary)
; ... existing library options ...
(libraries
; ... existing libraries ...
))
(executable
(name YourExecutable)
; ... existing executable options ...
(libraries
; ... existing libraries ...
))typet`` =backtrace_slot
valis_raise :t->bool
is_raise slot is true when slot refers to a raising point in the
code, and false when it comes from a simple function call.
- since 4.02
valis_inline :t->bool
is_inline slot is true when slot refers to a call that got inlined
by the compiler, and false when it comes from any other context.
- since 4.04.0
location slot returns the location information of the slot, if
available, and None otherwise.
Some possible reasons for failing to return a location are as follow:
-
the slot corresponds to a compiler-inserted raise
-
the slot corresponds to a part of the program that has not been compiled with debug information (
-g) -
since 4.02
valname :t->``string option
name slot returns the name of the function or definition enclosing the
location referred to by the slot.
name slot returns None if the name is unavailable, which may happen
for the same reasons as location returning None.
- since 4.11
valformat : ``int->t->``string option
format pos slot returns the string representation of slot as
raw_backtrace_to_string would format it, assuming it is the pos-th
element of the backtrace: the 0-th element is pretty-printed
differently than the others.
Whole-backtrace printing functions also skip some uninformative slots;
in that case, format pos slot returns None.
- since 4.02
