Usually i start debug a java program by type jdb in terminal, then it will enter debugging mode, then i can input something like “stop at com.android.contacts.dirtyImport.DirtyImportManager:95” to tell jdb to stop at certain line.
Now here is the question: how can i combine these two cmds input one. Something like “jdb < stop at com.android.contacts.dirtyImport.DirtyImportManager:95”. The reason i have this requirement is that i want to let vim automatic generate debug info and enter debug mode, stop make breakpoint.
One option is to prepend a line to the standard input:
This starts a subshell (
{}) that first prints the given line withechoand then reads the standard input and prints the read lines to the standard output (cat). The whole input is piped into jdb.This, however, confuses some programs that distinguish between terminal input and pipe input. In this case, you’ll want to have a look at the program’s reference, as debuggers often support executing commands from a file (as
gdbwith-x).