Page MenuHomePhabricator

[OCaml] Add OCaml APIs to access DebugInfo
Needs ReviewPublic

Authored by jberdine on Apr 19 2019, 8:06 AM.

Details

Summary

This diff adds a debuginfo sublibrary to the ocaml bindings
library. This is used to expose the DebugInfo API, mostly as declared
in include/llvm-c/DebugInfo.h. Currently this is incomplete: only
containing the functions needed to obtain the debug location
directory, filename, line, and column of instructions, global
variables, and functions.

Diff Detail

Event Timeline

jberdine created this revision.Apr 19 2019, 8:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2019, 8:06 AM

This is an alternative to D52239 which adds OCaml wrappers of the C API that are as thin as I see how to make them. I added a new sublibrary since the exposed functions come from DebugInfo.h instead of Core.h, and that seemed to be the pattern for the other sublibraries. Does this seem like the right approach?

To test this I have an OCaml client (a slightly modified version of https://github.com/facebook/infer/blob/master/sledge/src/llair/frontend.ml) that reads and prints the debug info using the functions in llvm_debuginfo.mli for all of the .bc and .ll files under the test directory, as well as a number of larger internal compilation units.