-
Enhancement
-
Resolution: Fixed
-
P5
-
11, 12, 13, 14, 15
-
b22
I often find myself calling find_node(Node* n, int idx) from gdb using the following command:
(gdb) p find_node(C->_root, 42)
$1 = (Node *) 0x7ffff08cab68
When C is not defined I need to search for a different node to use in the same method which is an additional effort. Moreover, there is sometimes no node and then I either need to go up in the current stack until C is defined or use Compile::current()->_root. But that does not work with gdb and neither does Compile::current()->root():
(gdb) p find_node(Compile::current()->_root, 42)
A syntax error in expression, near `()->_root, 42)'.
(gdb) p find_node(Compile::current()->root(), 42)
A syntax error in expression, near `()->root(), 42)'.
As a workaround I do the following which is quite tedious:
(gdb) p Compile::current()->_root
$2 = (RootNode *) 0x7fffa8072ae0
(gdb) p find_node((RootNode *) 0x7fffa8072ae0, 42)
$3 = (Node *) 0x7ffff08cab68
Therefore, I suggest to add a default to use the root node which is probably the most likely use case:
// call this from debugger with root node as default:
Node* find_node(int idx) {
return Compile::current()->root()->find(idx);
}
(gdb) p find_node(C->_root, 42)
$1 = (Node *) 0x7ffff08cab68
When C is not defined I need to search for a different node to use in the same method which is an additional effort. Moreover, there is sometimes no node and then I either need to go up in the current stack until C is defined or use Compile::current()->_root. But that does not work with gdb and neither does Compile::current()->root():
(gdb) p find_node(Compile::current()->_root, 42)
A syntax error in expression, near `()->_root, 42)'.
(gdb) p find_node(Compile::current()->root(), 42)
A syntax error in expression, near `()->root(), 42)'.
As a workaround I do the following which is quite tedious:
(gdb) p Compile::current()->_root
$2 = (RootNode *) 0x7fffa8072ae0
(gdb) p find_node((RootNode *) 0x7fffa8072ae0, 42)
$3 = (Node *) 0x7ffff08cab68
Therefore, I suggest to add a default to use the root node which is probably the most likely use case:
// call this from debugger with root node as default:
Node* find_node(int idx) {
return Compile::current()->root()->find(idx);
}