X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FSourceLevelDebugging.html;h=e4c84606107b47369d51cde12f9accaa2f08ada7;hb=070c1abbc9b78fd8eef9365c5e776a13b64b9631;hp=66a9a2e34ef8a36a43d00caac5671eb2e42982b4;hpb=b34500fae586a3fb09ba9d169297409b4ab3bbec;p=oota-llvm.git diff --git a/docs/SourceLevelDebugging.html b/docs/SourceLevelDebugging.html index 66a9a2e34ef..e4c84606107 100644 --- a/docs/SourceLevelDebugging.html +++ b/docs/SourceLevelDebugging.html @@ -144,7 +144,7 @@ height="369"> an LLVM user a relationship between generated code and the original program source code.
-Currently, debug information is consumed by the DwarfWriter to produce dwarf +
Currently, debug information is consumed by DwarfDebug to produce dwarf information used by the gdb debugger. Other targets could use the same information to produce stabs or other debug forms.
@@ -289,26 +289,25 @@ height="369"> 0x1000.)The fields of debug descriptors used internally by LLVM - are restricted to only the simple data types int, uint, - bool, float, double, mdstring and - mdnode.
+ are restricted to only the simple data types i32, i1, + float, double, mdstring and mdnode.!1 = metadata !{ - uint, ;; A tag + i32, ;; A tag ... }
The details of the various descriptors follow.
@@ -829,8 +828,8 @@ DW_TAG_return_variable = 258 rules.In order to handle this, the LLVM debug format uses the metadata attached to - llvm instructions to encode line nuber and scoping information. Consider the - following C fragment, for example:
+ llvm instructions to encode line number and scoping information. Consider + the following C fragment, for example:@@ -1069,6 +1068,18 @@ int main(int argc, char *argv[]) {
llvm::Instruction provides easy access to metadata attached with an +instruction. One can extract line number information encoded in LLVM IR +using Instruction::getMetadata() and +DILocation::getLineNumber(). +
+ if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction + DILocation Loc(N); // DILocation is in DebugInfo.h + unsigned Line = Loc.getLineNumber(); + StringRef File = Loc.getFilename(); + StringRef Dir = Loc.getDirectory(); + } +