I use jdb
for my Java development. For my application I have two classes: WordUniverseTest
and WordUniverse
, and the main method is contained in WordUniverseTest
. When I execute WordUniverseTest
inside of jdb
, I construct a WordUniverse
object called obj
inside of the main
method.
But I do not know how to have jdb
leave the WordUniverseTest
class and step inside WordUniverse
while obj
is being constructed. How do I do this?
You can put a regular breakpoint there stop at
and then when you are actually on the line (call list
to verify), you can call step into
.
As long as all your classes are known to jdb, it is going to work, I tested it.
I found the answer, and although Gergely Bacso didn't give the full answer, he did lead me to find the full answer.
jdb
uses a different procedure for stepping into methods versus stepping into constructors. To step into a method, you have to do what Gergely Basco said, which is set a breakpoint at where the method is called and then step into
. But for stepping into a constructor you must say stop in ClassName.<init>
(with brackets). Saying that command will take you inside of the constructor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.