In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "IntelliJ IDEA debugging skills". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
This technique is often used in conditional breakpoint loops, such as traversing a large List and wanting the breakpoint to stop at a specific value.
Refer to the figure above. At the breakpoint position, right click the red dot next to the breakpoint, and an interface will appear. Fill in the breakpoint condition here, so that when debugging, it will automatically stop at the position i=10.
II. Go back to the "previous step" This skill is most suitable for the scene of a particularly complex method set. It is not easy to run up. If you accidentally shake your hand, the breakpoint has passed. If you want to look back at the variable value just now, if you don't know the skill, you can only run it again.
Referring to the above figure, method1 method calls method2, the current breakpoint position j=100, click the Drop Frame icon at the red arrow position in the above figure, and the time passes.
When method1 was first called, variable i became 99, no problem, old iron, isn't it very 6 :).
WeChat search "programmer's growth path" after attention reply "2048" keyword, free access to 5T technology learning resources! Including but not limited to: C/C++, Linux, Python, Java, PHP, artificial intelligence, MCU, Raspberry Pi, etc. Note: Curiosity is the ladder of human progress. If you want to know why this function is called Drop Frame, rather than something like Back To Previous, you can go through the JVM book. The JVM stores the running state of the thread in stack frame units. Drop frame means throwing away the currently running stack frame, so that the current "pointer" position naturally reaches the position of the previous frame. Third, multi-threaded debugging multi-threaded running at the same time, who first execution, who after execution, completely depends on the CPU mood, can not control the order, running may not have any problem, but debugging is more troublesome, the most obvious is the breakpoint jump, a while stop this thread, a while stop in another thread, such as the following figure: If you want to hope that the next breakpoint position is the second verse, you may be disappointed:
If you want a thread to stop at whatever thread you want when debugging, you can right-click on the red dots of the three breakpoints in the figure.
Suspend suspends on a per-thread basis, not All. After setting all three breakpoints in this way, try again.
Notice the red box in the image above. When the breakpoint stops, this drop-down box shows the threads (note: it's a good habit to give threads easy to recognize names!), We can choose the thread "birds in the sky."
The breakpoint stops at the second verse as desired. IV. Remote Debugging This is also a weapon of B. This machine does not need to start the project. As long as there is source code, you can directly Remote Debugging the code on the server on this machine. The opening posture is as follows: 4.1 When the project starts, first allow Remote Debugging java -server -Xms512m -Xmx512m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9081 -Djava.ext.dirs=. ${main_class} works -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9081 Note: Remote Debugging technically means to establish scoket communication between local and remote computers, so ports should not conflict, and this will allow access to remote ports. In addition, this paragraph of parameters should be placed before-jar or ${main_class}. 4.2 Set Remote Debugging in idea
Then you can debug it.
If you have the source code for your project, hit a breakpoint where you need it, and then try visiting a remote url, the breakpoint will stop. 5. Temporary execution of expressions/modification of running values of variables When debugging, you can temporarily execute some expressions, refer to the following figure: Click any one of these two icons. Clicking on the + sign allows you to enter expressions into the new input box, such as i+5.
Then enter and see the results immediately.
Of course, if you want to dynamically modify the value of a variable during debugging, it's also easy. Right-click on the variable and select Set Value. The rest is known to everyone on Earth.
"IntelliJ IDEA debugging skills" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.