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/01 Report--
In this issue, the editor will bring you what are the coquettish operations about IDEA debugging. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
First, this technique is often used in conditional breakpoint loops, for example, when traversing a large List, you want to make the breakpoint stop at a specific value.
Referring to the figure above, at the location of the breakpoint, right-click the little red dot next to the breakpoint, and an interface will come out. Fill in the breakpoint condition here in Condition, so that when debugging, it will automatically stop at the location of iTunes 10.
Second, go back to the scene where the "previous step" technique is most suitable for particularly complex methods. It is not easy to run, accidentally shake your hand, and the breakpoint has passed. I want to look back at the value of the variable just now. If I don't know the skill, I can only run again. Referring to the figure above, the method1 method calls method2, and the location of the current breakpoint is jack100. After clicking the Drop Frame icon at the location of the red arrow above, time travels back to the time when method1 was first called, and the variable I became 99. Is it all right, brothers, is it very 6:) 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 look through JVM's books. Inside JVM, the running state of the thread is saved in terms of stack frames, and drop frame throws away the currently running stack frames, so that the current "pointer" position naturally reaches the position of the previous frame. Third, multithreading debugging when multithreading runs at the same time, who executes first and who executes later, it all depends on the mood of CPU, unable to control the sequence, there may be no problem when running, but it is more troublesome when debugging, the most obvious is that the breakpoint jumps randomly, stopping this thread and stopping in another thread, such as the following picture: if you want the next breakpoint to be the second verse You may be disappointed: if you want a thread to do whatever it wants when debugging, you can right-click on the little red dot of the three breakpoints in the figure, that is, Suspend hangs on a per-thread basis, not All. After setting all three breakpoints in this way, try again and notice the position of the red box in the picture above. When the breakpoint stops, the drop-down box can see each thread. (note: it is a good habit to give a thread an easily recognizable name! ), we can choose the thread "birds in the sky" breakpoint to stop at the second poem as desired. 4. Remote debugging this is also a sharp weapon to install B, the machine does not need to start the project, as long as it has the source code, you can debug the code on the server directly on the local machine. The opening posture is as follows: 1. When the project starts, allow remote debugging of 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: technically speaking, remote debugging is to establish scoket communication between the local machine and the remote, so the port should not conflict, and the local machine should allow access to the remote port. To set up remote debugging in the first 2, idea of-jar or ${main_class}, you can debug as long as the machine has the source code of the project, make a breakpoint where you need it, and then visit a remote url to try, and the breakpoint will stop. 5. Temporarily execute expressions / modify the running values of variables when debugging, you can execute some expressions temporarily, refer to the following figure: after clicking on any one of these two icons, you can click the + sign, you can enter the expression in the newly appeared input box, such as iDiver5 and enter, you can see the results immediately. Of course, if you want to dynamically change the value of the variable during debugging, it is also easy to right-click on the variable. Then choose Set Value, and everyone knows the rest. These are the coquettish operations of IDEA debugging that Xiaobian shared for you. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.