I'm trying to hook up jdb on my computer to a process (any process really) on my Android device, but it doesn't work at all.
So the commands I used are straight off the Google ADB Documentation. First I do
adb forward tcp:3456 jdwp:pid
Then after that I try to use jdb to try to hook up
jdb -attach emulatorIP:3456
But I get the following error:
java.io.IOException: shmemBase_attach failed: The system cannot find the file specified
at com.sun.tools.jdi.SharedMemoryTransportService.attach0(Native Method)
at com.sun.tools.jdi.SharedMemoryTransportService.attach(SharedMemoryTransportService.java:108)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SharedMemoryAttachingConnector.attach(SharedMemoryAttachingConnector.java:63)
at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
at com.sun.tools.example.debug.tty.Env.init(Env.java:63)
at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1066)
Fatal error:
Unable to attach to target VM.
EDIT: I have more leads, but I'm nowhere close to an actual solution.
JDB -attach for some reason defaults to debugging using the shared memory method despite all documentation insisting that specifying hostname:port as the -attach parameters will force it to use sockets for remote debugging. To force it, you use the command provided by ykw's answer, but it fails anyway ostensibly due to some connection error.
After further investigation it appears that JDB and ADB conflict with each other on some unknown resource causing the various socket connection errors. My current workaround is to shut down ADB completely and run JDB, then when I'm done with the JDB, I get the ADB back online. Not acceptable by any means and I'm hoping this helps someone with a more in-depth knowledge pinpoint what's wrong!