X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FSourceLevelDebugging.html;h=e4c84606107b47369d51cde12f9accaa2f08ada7;hb=b53985239c856464c1a904dc4371904394c4da91;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 first field of a descriptor is always an - uint containing a tag value identifying the content of the + i32 containing a tag value identifying the content of the descriptor. The remaining fields are specific to the descriptor. The values of tags are loosely bound to the tag values of DWARF information entries. However, that does not restrict the use of the information supplied to DWARF targets. To facilitate versioning of debug information, the tag is augmented - with the current debug version (LLVMDebugVersion = 8 << 16 or 0x80000 or + with the current debug version (LLVMDebugVersion = 8 << 16 or 0x80000 or 524288.)

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();
+ }
+