@@ -116,8 +116,8 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
116116 unsigned offset = dimsOffset;
117117 const unsigned indexSize = dimsSize / 3 ;
118118 for ([[maybe_unused]] auto _ : seqTy.getShape ()) {
119- // For each dimension, find the offset of count and lower bound in the
120- // descriptor and generate the dwarf expression to extract it.
119+ // For each dimension, find the offset of count, lower bound and stride in
120+ // the descriptor and generate the dwarf expression to extract it.
121121 // FIXME: If `indexSize` happens to be bigger than address size on the
122122 // system then we may have to change 'DW_OP_deref' here.
123123 addOp (llvm::dwarf::DW_OP_push_object_address, {});
@@ -139,10 +139,18 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
139139 mlir::LLVM::DIExpressionAttr::get (context, ops);
140140 ops.clear ();
141141
142+ addOp (llvm::dwarf::DW_OP_push_object_address, {});
143+ addOp (llvm::dwarf::DW_OP_plus_uconst,
144+ {offset + (indexSize * kDimStridePos )});
145+ addOp (llvm::dwarf::DW_OP_deref, {});
146+ // stride[i] = *(base_addr + offset + (indexSize * kDimStridePos))
147+ mlir::LLVM::DIExpressionAttr strideAttr =
148+ mlir::LLVM::DIExpressionAttr::get (context, ops);
149+ ops.clear ();
150+
142151 offset += dimsSize;
143152 mlir::LLVM::DISubrangeAttr subrangeTy = mlir::LLVM::DISubrangeAttr::get (
144- context, countAttr, lowerAttr, /* upperBound=*/ nullptr ,
145- /* stride=*/ nullptr );
153+ context, countAttr, lowerAttr, /* upperBound=*/ nullptr , strideAttr);
146154 elements.push_back (subrangeTy);
147155 }
148156 return mlir::LLVM::DICompositeTypeAttr::get (
0 commit comments