I’m not sure where this should be posted. I generate llvm-ir via text, use clang to compile it and look at the results in GDB.
I figured out variable length arrays on the stack. Essentially I use llvm.dbg.declare to say a variable hase the base type of DW_TAG_array_type and use elements to give it a DISubrange. I had success with DISubrange being a constant and a (stack) variable
The problem I’ve having now is how do I implement this when the variables are all in a struct? For example assume struct C has a pointer and length, I would want to allow seeing this in the debugger a->b->c->vla. I know how to say the member variable vla has a base type using DW_TAG_array_type but I don’t know how to use subrange to the member variable next to vla is the length. I noticed subrange will accept a DIExpression but I have no idea how to use that. I can’t seem to find examples of how to use DIExpression online.