Removing tabs.
[oota-llvm.git] / docs / SourceLevelDebugging.html
index 7916a0e0551321781fca7dd29c77b0653013b820..172ede02e6afd19bbed7a9a607243a23ad398045 100644 (file)
@@ -66,7 +66,7 @@ height="369">
 
 <div class="doc_author">
   <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
-            and <a href="mailto:jlaskey@apple.com">Jim Laskey</a></p>
+            and <a href="mailto:jlaskey@mac.com">Jim Laskey</a></p>
 </div>
 
 
@@ -130,7 +130,7 @@ href="http://www.eagercon.com/dwarf/dwarf3std.htm">Dwarf 3 standard</a>).</p>
 <p>When a program is being debugged, a debugger interacts with the user and
 turns the stored debug information into source-language specific information. 
 As such, a debugger must be aware of the source-language, and is thus tied to
-a specific language of family of languages.</p>
+a specific language or family of languages.</p>
 
 </div>
 
@@ -142,7 +142,7 @@ a specific language of family of languages.</p>
 <div class="doc_text">
 <p>The role of debug information is to provide meta information normally
 stripped away during the compilation process.  This meta information provides an
-llvm user a relationship between generated code and the original program source
+LLVM user a relationship between generated code and the original program source
 code.</p>
 
 <p>Currently, debug information is consumed by the DwarfWriter to produce dwarf
@@ -175,12 +175,12 @@ source-level state of the program</b>, regardless of which LLVM optimizations
 have been run, and without any modification to the optimizations themselves.
 However, some optimizations may impact the ability to modify the current state
 of the program with a debugger, such as setting program variables, or calling
-function that have been deleted.</li>
+functions that have been deleted.</li>
 
 <li>LLVM optimizations gracefully interact with debugging information.  If they
 are not aware of debug information, they are automatically disabled as necessary
 in the cases that would invalidate the debug info.  This retains the LLVM
-features making it easy to write new transformations.</li>
+features, making it easy to write new transformations.</li>
 
 <li>As desired, LLVM optimizations can be upgraded to be aware of the LLVM
 debugging information, allowing them to update the debugging information as they
@@ -281,7 +281,7 @@ source-language is allowed to define its own objects, by using unreserved tag
 numbers.  We recommend using with tags in the range 0x1000 thru 0x2000 (there is
 a defined enum DW_TAG_user_base = 0x1000.)</p>
 
-<p>The fields of debug descriptors used internally by LLVM (MachineDebugInfo)
+<p>The fields of debug descriptors used internally by LLVM (MachineModuleInfo)
 are restricted to only the simple data types <tt>int</tt>, <tt>uint</tt>,
 <tt>bool</tt>, <tt>float</tt>, <tt>double</tt>, <tt>sbyte*</tt> and <tt> { }*
 </tt>.  References to arbitrary values are handled using a <tt> { }* </tt> and a
@@ -301,7 +301,7 @@ 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 = 4 << 16 or 0x40000.)</a></p>
+current debug version (LLVMDebugVersion = 4 << 16 or 0x40000 or 262144.)</a></p>
 
 <p>The details of the various descriptors follow.</p>  
 
@@ -389,6 +389,8 @@ line correspondence.</p>
     {  }*,  ;; Global variable anchor = cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_global_variables">llvm.dbg.global_variables</a> to {  }*),  
     {  }*,  ;; Reference to context descriptor
     sbyte*, ;; Name
+    sbyte*, ;; Display name (fully qualified C++ name)
+    sbyte*, ;; MIPS linkage name (for C++)
     {  }*,  ;; Reference to compile unit where defined
     uint,   ;; Line number where defined
     {  }*,  ;; Reference to type descriptor
@@ -416,6 +418,8 @@ provide details such as name, type and where the variable is defined.</p>
     {  }*,  ;; Subprogram anchor = cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_subprograms">llvm.dbg.subprograms</a> to {  }*),  
     {  }*,  ;; Reference to context descriptor
     sbyte*, ;; Name
+    sbyte*, ;; Display name (fully qualified C++ name)
+    sbyte*, ;; MIPS linkage name (for C++)
     {  }*,  ;; Reference to compile unit where defined
     uint,   ;; Line number where defined
     {  }*,  ;; Reference to type descriptor
@@ -590,6 +594,8 @@ are possible tag values;</p>
   DW_TAG_structure_type = 19
   DW_TAG_union_type = 23
   DW_TAG_vector_type = 259
+  DW_TAG_subroutine_type = 46
+  DW_TAG_inheritance = 26
 </pre>
 
 <p>The vector flag indicates that an array type is a native packed vector.</p>
@@ -610,6 +616,21 @@ href="#format_basic_type">basic</a>, <a href="#format_derived_type">derived</a>
 or <a href="#format_composite_type">composite</a> type descriptors, each
 representing a field member of the structure or union.</p>
 
+<p>For C++ classes (tag = <tt>DW_TAG_structure_type</tt>), member descriptors
+provide information about base classes, static members and member functions. If
+a member is a <a href="#format_derived_type">derived type descriptor</a> and has
+a tag of <tt>DW_TAG_inheritance</tt>, then the type represents a base class. If
+the member of is a <a href="#format_global_variables">global variable
+descriptor</a> then it represents a static member.  And, if the member is a <a
+href="#format_subprograms">subprogram descriptor</a> then it represents a member
+function.  For static members and member functions, <tt>getName()</tt> returns
+the members link or the C++ mangled name.  <tt>getDisplayName()</tt> the
+simplied version of the name.</p>
+
+<p>The first member of subroutine (tag = <tt>DW_TAG_subroutine_type</tt>)
+type elements is the return type for the subroutine.  The remaining
+elements are the formal arguments to the subroutine.</p>
+
 <p><a href="#format_composite_type">Composite type</a> location can be
 determined from the compile unit and line number.  The size, alignment and
 offset are expressed in bits and can be 64 bit values.  The alignment is used to
@@ -726,7 +747,7 @@ provide debug information at various points in generated code.</p>
 
 <p>This intrinsic is used to provide correspondence between the source file and
 the generated code.  The first argument is the line number (base 1), second
-argument si the column number (0 if unknown) and the third argument the source
+argument is the column number (0 if unknown) and the third argument the source
 <tt>%<a href="#format_compile_units">llvm.dbg.compile_unit</a>*</tt> cast to a
 <tt>{ }*</tt>.  Code following a call to this intrinsic will have been defined
 in close proximity of the line, column and file.  This information holds until
@@ -746,10 +767,13 @@ href="#format_common_stoppoint">lvm.dbg.stoppoint</a></tt>.</p>
 </pre>
 
 <p>This intrinsic is used to link the debug information in <tt>%<a
-href="#format_subprograms">llvm.dbg.subprogram</a></tt> to the function. It also
-defines the beginning of the function's declarative region (scope.)  The
-intrinsic should be called early in the function after the all the alloca
-instructions.  It should be paired off with a closing <tt>%<a
+href="#format_subprograms">llvm.dbg.subprogram</a></tt> to the function. It
+defines the beginning of the function's declarative region (scope). It also
+implies a call to %<tt><a
+href="#format_common_stoppoint">llvm.dbg.stoppoint</a></tt> which defines a
+source line "stop point". The intrinsic should be called early in the function
+after the all the alloca instructions.  It should be paired off with a closing
+<tt>%<a
 href="#format_common_region_end">llvm.dbg.region.end</a></tt>.  The function's
 single argument is the <tt>%<a
 href="#format_subprograms">llvm.dbg.subprogram.type</a></tt>.</p>
@@ -970,7 +994,7 @@ another scope).</p>
 
 <p>It is worth noting that this scoping mechanism is used to control scoping of
 all declarations, not just variable declarations.  For example, the scope of a
-C++ using declaration is controlled with this couldchange how name lookup is
+C++ using declaration is controlled with this and could change how name lookup is
 performed.</p>
 
 </div>
@@ -1123,6 +1147,7 @@ int MyGlobal = 100;
     {  }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_global_variables">llvm.dbg.global_variables</a> to {  }*), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([9 x sbyte]* %str1, int 0, int 0), 
+    sbyte* getelementptr ([1 x sbyte]* %str2, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     uint 1,
     {  }* cast (%<a href="#format_basic_type">llvm.dbg.basictype.type</a>* %<a href="#format_basic_type">llvm.dbg.basictype</a> to {  }*), 
@@ -1137,7 +1162,7 @@ int MyGlobal = 100;
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
     uint add(uint 36, uint 262144), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
-    sbyte* getelementptr ([4 x sbyte]* %str2, int 0, int 0), 
+    sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0), 
     {  }* null, 
     int 0, 
     uint 32, 
@@ -1149,7 +1174,8 @@ int MyGlobal = 100;
 ;; Define the names of the global variable and basic type.
 ;;
 %str1 = internal constant [9 x sbyte] c"MyGlobal\00", section "llvm.metadata"
-%str2 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
+%str2 = internal constant [1 x sbyte] c"\00", section "llvm.metadata"
+%str3 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
 </pre>
 
 </div>
@@ -1196,6 +1222,7 @@ int main(int argc, char *argv[]) {
     {  }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_subprograms">llvm.dbg.subprograms</a> to {  }*), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
+    sbyte* getelementptr ([1 x sbyte]* %str2, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*),
     uint 1,
     {  }* null, 
@@ -1206,6 +1233,7 @@ int main(int argc, char *argv[]) {
 ;; Define the name of the subprogram.
 ;;
 %str1 = internal constant [5 x sbyte] c"main\00", section "llvm.metadata"
+%str2 = internal constant [1 x sbyte] c"\00", section "llvm.metadata"
 
 ;;
 ;; Define the subprogram itself.