Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8244182

Use root node as default for find_node when called from debugger

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 11, 12, 13, 14, 15
    • Fix Version/s: 15
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b22

      Description

      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);
      }




        Attachments

          Activity

            People

            • Assignee:
              chagedorn Christian Hagedorn
              Reporter:
              chagedorn Christian Hagedorn
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: