Guang Chen via llvm-dev
2018-Aug-13 06:12 UTC
[llvm-dev] Use LLVM C API for reading metadata
Hi everyone, I’m looking forward to reading metadata by C API. Currently I can get the metadata reference but I cannot find any API for determine its type (e.g. DILocation, DIVariable) nor find any API for reading its field (e.g. DILocation’s line and column). The only walk around is us LLVMPrintValueToString method and parse the string manually. However, I’m using JNI to call the C API and this method is very slow. For a program with 30K LOC, printing the metadata as string may take about 5 minutes. It is not acceptable since we need to analysis program with millions LOC. So is there any possibility to get the metadata information easily like in C++? Guang Chen -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: Message signed with OpenPGP URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180813/bc2d5c8a/attachment.sig>
Jeremy Morse via llvm-dev
2018-Aug-17 14:15 UTC
[llvm-dev] Use LLVM C API for reading metadata
Hi Guang, The upcoming 7.0 release has more debug-info exposed by the C API, including reading line and column information from DILocation's, as seen here [0]. As for determining types, I believe all debug metadata attached directly to instructions are DILocations, but navigating further into the debug info structures isn't directly exposed by the C API. [0] https://github.com/llvm-mirror/llvm/blob/1d13545e10c5574a40821115d10c54c16f7c47be/include/llvm-c/DebugInfo.h#L396 -- Thanks, Jeremy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180817/bad06925/attachment.html>