Details
Diff Detail
Event Timeline
Thanks!
- please include testcases
- there probably needs to be a Verifier change as well
As you probably noticed the other binary operators (like DW_OP_plus) are currently accepting their RHS argument as an "argument" rather than using the top-of-stack (-1). I consider this a bug, so I'm fine with these new operators behaving the way they are (using the stack) in this patch.
Done.
- there probably needs to be a Verifier change as well
Isn't Verifier calling DIExpression::isValid()?
As you probably noticed the other binary operators (like DW_OP_plus) are currently accepting their RHS argument as an "argument" rather than using the top-of-stack (-1). I consider this a bug, so I'm fine with these new operators behaving the way they are (using the stack) in this patch.
Do you know if there is bugzilla for it or if someone is working on fixing this bug?
Thanks.
I'd like to request one more feature:
isValid() should reject
!DIExpression(DW_OP_swap)
because there is only one (implicit) element on the stack.
lib/IR/DebugInfoMetadata.cpp | ||
---|---|---|
622 | I was just going to comment that a better way to implement this would be to add a local variable that keeps track of the stack depth. But I realize that we can't actually do that without introducing something like a DW_LLVM_OP_implicit_location as a placeholder for the location this DIExpression is attached to, or else pass the number of implicit stack elements into isValid (isValid(unsigned StackDepth). For example: !DIExpression(DW_OP_constu 1, DW_OP_swap, DW_OP_xderef) is fine when attached to a llvm.dbg.value (with one implicit stack element). This is not necessarily something we need to fix in this patch. It might be nice to add a FIXME about the limitation here. |
I was just going to comment that a better way to implement this would be to add a local variable that keeps track of the stack depth. But I realize that we can't actually do that without introducing something like a DW_LLVM_OP_implicit_location as a placeholder for the location this DIExpression is attached to, or else pass the number of implicit stack elements into isValid (isValid(unsigned StackDepth).
For example:
!DIExpression(DW_OP_constu 1, DW_OP_swap, DW_OP_xderef)
is fine when attached to a llvm.dbg.value (with one implicit stack element).
But it would be wrong if attached to a !DIGlobalVariableExpression that is describing a constant (with no implicit stack elements).
This is not necessarily something we need to fix in this patch. It might be nice to add a FIXME about the limitation here.