Fixed LLVMExamples>>example7_factorial_with_debug_info
Pass DIFile instead of DICompileUnit to #createTypeFunctionIn:parameterTypes:
Fixed #createParameterVariable: - parameters are numbered starting with 1.
--- a/LLVMDIBuilder.st Thu Sep 17 17:09:43 2015 +0100
+++ b/LLVMDIBuilder.st Thu Sep 17 17:17:56 2015 +0100
@@ -192,10 +192,10 @@
self assertIsIntegerUnsigned: index.
self assertIsBoolean: preserve.
- ^ LLVMCEXT DIBuilderCreateParameterVariable: self _: scope _: name _: file _: line _: type _: (preserve ifTrue:[1] ifFalse:[0]) _: flags _: index - 1
+ ^ LLVMCEXT DIBuilderCreateParameterVariable: self _: scope _: name _: file _: line _: type _: (preserve ifTrue:[1] ifFalse:[0]) _: flags _: index
"Created: / 14-08-2015 / 13:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 17-09-2015 / 17:01:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-09-2015 / 17:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
createTypeFunctionIn: file parameterTypes: parameterTypes
--- a/LLVMExamples.st Thu Sep 17 17:09:43 2015 +0100
+++ b/LLVMExamples.st Thu Sep 17 17:17:56 2015 +0100
@@ -416,30 +416,27 @@
example7_factorial_with_debug_info
"A simple factorial using recursive algorithm
with debug info attached.
-
-
-
"
| module functionType function asm
"Variables" result i
"Blocks" entry loop loopBody exit
- "Debug Info Metadata" dib diFile compilationUnitDI functionTypeDI functionDI intptrDI resultDI iDI
+ "Debug Info Metadata" dib fileDI compilationUnitDI functionTypeDI functionDI intptrDI resultDI iDI
jit externalFunction |
module := LLVMModule newWithName:testSelector.
dib := module debugInfoBuilder.
- diFile := dib createFile: Filename currentDirectory / 'factorial.lang'.
+ fileDI := dib createFile: Filename currentDirectory / 'factorial.lang'.
compilationUnitDI := dib createCompilationUnit: Filename currentDirectory / 'factorial.lang' language: LLVM_DW_LANG_lo_user + 10 producer: self class name.
functionType := LLVMType function:{ LLVMType intptr } returning:LLVMType intptr.
intptrDI := dib createTypeScalar: 'intptr' type: LLVMType intptr encoding: LLVM_DW_ATE_signed.
- functionTypeDI := dib createTypeFunctionIn: compilationUnitDI
+ functionTypeDI := dib createTypeFunctionIn: fileDI
parameterTypes: { intptrDI }.
function := module addFunctionNamed:'factorial' type:functionType.
- functionDI := dib createFunction: 'factorial' in: compilationUnitDI file: diFile line: 03 type: functionTypeDI function: function local: false definition: true optimized: false.
- dib createParameterVariable: 'v' in: functionDI file: diFile line: 03 type: intptrDI flags: 0 index: 1.
+ functionDI := dib createFunction: 'factorial' in: compilationUnitDI file: fileDI line: 03 type: functionTypeDI function: function local: false definition: true optimized: false.
+ dib createParameterVariable: 'v' in: functionDI file: fileDI line: 03 type: intptrDI flags: 0 index: 1.
asm := LLVMIRBuilder new.
entry := function entry.
loop := function addBasicBlockNamed:'loop'.
@@ -457,12 +454,12 @@
asm block:entry.
asm line: 4 column: 3 scope: functionDI.
result := asm alloca:LLVMType intptr as:'result'.
- resultDI := dib createAutomaticVariable: 'result' in: functionDI file: diFile line: 4 type: intptrDI.
+ resultDI := dib createAutomaticVariable: 'result' in: functionDI file: fileDI line: 4 type: intptrDI.
dib insertDeclare: result variable: resultDI expression: dib createExpression location: asm location atEndOf: entry.
asm line: 5 column: 3 scope: functionDI.
i := asm alloca:LLVMType intptr as:'i'.
- iDI := dib createAutomaticVariable: 'i' in: functionDI file: diFile line: 4 type: intptrDI.
+ iDI := dib createAutomaticVariable: 'i' in: functionDI file: fileDI line: 4 type: intptrDI.
dib insertDeclare: i variable: iDI expression: dib createExpression location: asm location atEndOf: entry.
asm line: 6 column: 3 scope: functionDI.
@@ -565,6 +562,6 @@
LLVMExamples example7_factorial_with_debug_info"
"Created: / 14-08-2015 / 06:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 17-08-2015 / 08:52:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-09-2015 / 17:13:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !