Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
Created December 12, 2011 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rednaxelafx/1466953 to your computer and use it in GitHub Desktop.
Save rednaxelafx/1466953 to your computer and use it in GitHub Desktop.
Notes on debugging the HotSpot VM from a native debugger

Found some interesting helper functions in utilities/debug.cpp:

void help() {
  Command c("help");
  tty->print_cr("basic");
  tty->print_cr("  pp(void* p)   - try to make sense of p");
  tty->print_cr("  pv(intptr_t p)- ((PrintableResourceObj*) p)->print()");
  tty->print_cr("  ps()          - print current thread stack");
  tty->print_cr("  pss()         - print all thread stacks");
  tty->print_cr("  pm(int pc)    - print methodOop given compiled PC");
  tty->print_cr("  findm(intptr_t pc) - finds methodOop");
  tty->print_cr("  find(intptr_t x)   - finds & prints nmethod/stub/bytecode/oop based on pointer into it");

  tty->print_cr("misc.");
  tty->print_cr("  flush()       - flushes the log file");
  tty->print_cr("  events()      - dump last 50 events");


  tty->print_cr("compiler debugging");
  tty->print_cr("  debug()       - to set things up for compiler debugging");
  tty->print_cr("  ndebug()      - undo debug");
}

More commands such as "dump_vtable", "nm", "disnm", etc., are available in the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment