Skip to content

Commit 6b08e4d

Browse files
authored
[docs] SourceLevelDebugging: fix metadata references (llvm#101187)
The metadata was off-by-one in a couple of places, making the explanatory text incorrect.
1 parent dcb4399 commit 6b08e4d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

llvm/docs/SourceLevelDebugging.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,12 @@ Compiled to LLVM, this function would be represented like this:
389389
%X = alloca i32, align 4
390390
%Y = alloca i32, align 4
391391
%Z = alloca i32, align 4
392-
#dbg_declare(ptr %X, !11, !DIExpression(), !14)
393-
store i32 21, i32* %X, align 4, !dbg !14
394-
#dbg_declare(ptr %Y, !15, !DIExpression(), !16)
395-
store i32 22, i32* %Y, align 4, !dbg !16
396-
#dbg_declare(ptr %Z, !17, !DIExpression(), !19)
397-
store i32 23, i32* %Z, align 4, !dbg !19
392+
#dbg_declare(ptr %X, !11, !DIExpression(), !13)
393+
store i32 21, i32* %X, align 4, !dbg !13
394+
#dbg_declare(ptr %Y, !14, !DIExpression(), !15)
395+
store i32 22, i32* %Y, align 4, !dbg !15
396+
#dbg_declare(ptr %Z, !16, !DIExpression(), !18)
397+
store i32 23, i32* %Z, align 4, !dbg !18
398398
%0 = load i32, i32* %X, align 4, !dbg !20
399399
store i32 %0, i32* %Z, align 4, !dbg !21
400400
%1 = load i32, i32* %Y, align 4, !dbg !22
@@ -427,9 +427,9 @@ Compiled to LLVM, this function would be represented like this:
427427
!15 = !DILocation(line: 3, column: 9, scope: !4)
428428
!16 = !DILocalVariable(name: "Z", scope: !18, file: !1, line: 5, type: !12)
429429
!17 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5)
430-
!18 = !DILocation(line: 5, column: 11, scope: !18)
431-
!29 = !DILocation(line: 6, column: 11, scope: !18)
432-
!20 = !DILocation(line: 6, column: 9, scope: !18)
430+
!18 = !DILocation(line: 5, column: 11, scope: !17)
431+
!29 = !DILocation(line: 6, column: 11, scope: !17)
432+
!20 = !DILocation(line: 6, column: 9, scope: !17)
433433
!21 = !DILocation(line: 8, column: 9, scope: !4)
434434
!22 = !DILocation(line: 8, column: 7, scope: !4)
435435
!23 = !DILocation(line: 9, column: 3, scope: !4)
@@ -443,21 +443,21 @@ variable definitions, and the code used to implement the function.
443443

444444
.. code-block:: llvm
445445
446-
#dbg_declare(ptr %X, !11, !DIExpression(), !14)
447-
; [debug line = 2:7] [debug variable = X]
446+
#dbg_declare(ptr %X, !11, !DIExpression(), !13)
447+
; [debug line = 2:9] [debug variable = X]
448448
449449
The first record ``#dbg_declare`` encodes debugging information for the
450-
variable ``X``. The location ``!14`` at the end of the record provides
450+
variable ``X``. The location ``!13`` at the end of the record provides
451451
scope information for the variable ``X``.
452452

453453
.. code-block:: text
454454
455-
!14 = !DILocation(line: 2, column: 9, scope: !4)
455+
!13 = !DILocation(line: 2, column: 9, scope: !4)
456456
!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5,
457457
isLocal: false, isDefinition: true, scopeLine: 1,
458458
isOptimized: false, retainedNodes: !2)
459459
460-
Here ``!14`` is metadata providing `location information
460+
Here ``!13`` is metadata providing `location information
461461
<LangRef.html#dilocation>`_. In this example, scope is encoded by ``!4``, a
462462
`subprogram descriptor <LangRef.html#disubprogram>`_. This way the location
463463
information parameter to the records indicates that the variable ``X`` is
@@ -467,20 +467,20 @@ Now lets take another example.
467467

468468
.. code-block:: llvm
469469
470-
#dbg_declare(ptr %Z, !17, !DIExpression(), !19)
471-
; [debug line = 5:9] [debug variable = Z]
470+
#dbg_declare(ptr %Z, !16, !DIExpression(), !18)
471+
; [debug line = 5:11] [debug variable = Z]
472472
473473
The third record ``#dbg_declare`` encodes debugging information for
474-
variable ``Z``. The metadata ``!19`` at the end of the record provides
474+
variable ``Z``. The metadata ``!18`` at the end of the record provides
475475
scope information for the variable ``Z``.
476476

477477
.. code-block:: text
478478
479-
!18 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5)
480-
!19 = !DILocation(line: 5, column: 11, scope: !18)
479+
!17 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5)
480+
!18 = !DILocation(line: 5, column: 11, scope: !17)
481481
482-
Here ``!19`` indicates that ``Z`` is declared at line number 5 and column
483-
number 11 inside of lexical scope ``!18``. The lexical scope itself resides
482+
Here ``!18`` indicates that ``Z`` is declared at line number 5 and column
483+
number 11 inside of lexical scope ``!17``. The lexical scope itself resides
484484
inside of subprogram ``!4`` described above.
485485

486486
The scope information attached with each instruction provides a straightforward

0 commit comments

Comments
 (0)