Jump to content

User:Elukey/Ops/JavaDebug

From Wikitech

JDB applied to a JAR

Context: https://phabricator.wikimedia.org/T278665

The jar contains a CLI that led to a NullPointer.

jar -xf /srv/analytics-wmde/graphite/src/toolkit-analyzer-build/toolkit-analyzer.jar

jdb -sourcepath . -classpath /srv/analytics-wmde/graphite/src/toolkit-analyzer-build/toolkit-analyzer.jar

> run org.etc.class -parameters

> print variable x

JDB applied to a running jvm

sudo sysctl -w kernel.yama.ptrace_scope=0

ps aux | grep what-I-want-to-debug

sudo -u $user jdb -connect sun.jvm.hotspot.jdi.SAPIDAttachingConnector:pid=$pid-from-ps-before