Skip to content

Commit 5d1f779

Browse files
committed
[clang][Interp][NFC] Add Dump debug op
This is often useful for debugging and dumps the current stack contents.
1 parent c7db450 commit 5d1f779

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/AST/Interp/Interp.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,11 @@ inline bool FinishInit(InterpState &S, CodePtr OpPC) {
13331333
return true;
13341334
}
13351335

1336+
inline bool Dump(InterpState &S, CodePtr OpPC) {
1337+
S.Stk.dump();
1338+
return true;
1339+
}
1340+
13361341
inline bool VirtBaseHelper(InterpState &S, CodePtr OpPC, const RecordDecl *Decl,
13371342
const Pointer &Ptr) {
13381343
Pointer Base = Ptr;

clang/lib/AST/Interp/Opcodes.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,3 +723,8 @@ def CheckNonNullArg : Opcode {
723723
}
724724

725725
def Memcpy : Opcode;
726+
727+
//===----------------------------------------------------------------------===//
728+
// Debugging.
729+
//===----------------------------------------------------------------------===//
730+
def Dump : Opcode;

0 commit comments

Comments
 (0)