From the title I assume you’re asking how to step into
VisitExpr. If the question is to skip the
VisitExpr and break at the start of
WithFields, then I would say the easiest way is to just set a breakpoint as
b WithFields and keep pressing
continue until you reach that function. Note that once you’ve set the breakpoint on the
WithFields function, gdb automatically tracks all functions/members named
WithFields, its guaranteed to stop there if you just keep continuing.
As for stepping into the right
VisitExpr, the same trick can probably be used, but an easier way might be to understand the visitor pattern hierarchy in TVM.
TLDR Just set a breakpoint in all
VisitExpr_ member functions inside the surrounding class
A slightly detailed explanation
At a high level, any class that wishes to traverse the AST can do it by inheriting from classes in
stmt_functor.cc. There are 2 types of visitors, which are Visitor and Mutator and the difference between them is just that Mutator allows the AST to be modified as part of its traversal.
The way this works is that the inheriting class, can override any specific
VisitStmt_ functions (note that these functions are overloaded based on the type of node passed as argument) in their class, and when that particular type of node is visited in the AST, the overridden version is called, but in all other cases, the default implementations in their parent classes are called.
You can learn how visitors work in detailed from the documentation here
Anyway, in case of
de_duplicate.cc, we see that they’ve defined a class
DeDupMutator that inherits from
PatternMutator. So for any call to
VisitExpr, based on the type of the expression in question, it has to visit one of the 3
VisitExpr_ overridden functions in that class as only those are going to do anything interesting with respect to that class.
All this explanation was just to say that you can set the breakpoint in all the
VisitExpr_ member functions in its surrounding class, and it will break in one of those functions.
For all other types of nodes, the parent class is just going to visit the attributes in the appropriate order and return without doing anything.