In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
IDEA Debug debugging tips Tongnan County, in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
1. Multithreading debugging breakpoints
Intellij IDEA debug breakpoint debugging has a mode choice, like the following figure, we usually use the default ALL (the default is thread mode in Eclipse), this mode we can only cut off one thread, but other threads have already been executed; and after changing it to Thread, multiple threads can be broken, and can easily switch the thread execution process, this is multi-thread debugging.
In the debug console, you can easily view the execution status of a thread, or you can easily select a thread to execute:
Second, return to the breakpoint
I do not know if we have encountered such a problem, when we carry out debug, we usually do not enter the implementation of a certain method step by step, but selectively skip it; when you want to go back and observe the worthwhile change of a variable, and you just don't follow it, skip this method, at this time, the variable is assigned, and our usual practice is to do it all over again.
In fact, the debugging function of IDEA is very powerful, let's take a look at the familiar debugging window:
Use the red box to indicate which block and which part of the current program, you can try to click with the mouse, you will find that the editor will jump to the corresponding code, of course, the location of the current breakpoint is usually at the first of the list. Then we use the right-click, and you can see the following figure:
Or you can find Drop Frame in the following figure:
In IDEA, the so-called fallback is called Drop Frame. After selecting Drop Frame, the program will jump back to the place where the current method is called. Of course, the changed value will not be restored. But when the method is called again, you can observe when a variable is changed, at least we don't have to run the program again.
Conditional breakpoint
A conditional breakpoint is a debug breakpoint that takes effect only when a certain condition (usually an expression) is met; debug is very useful in a loop; for example, we want to debug in the body of a loop: when a variable meets a condition, a breakpoint is needed to debug to see the detailed execution flow and changes.
As we said, the debug function in IDEA is very powerful, and it is very easy to use conditional breakpoints. The content in Condition in the following picture represents that when name is eamon:23, the program stops at the breakpoint.
With conditional breakpoints, code that is irrelevant and we don't care about can be skipped.
IV. Temporary breakpoint
The so-called temporary breakpoint is that it is broken only once, and the IDEA default breakpoint will exist consistently. If you only need to pause once, it is more convenient to use a temporary breakpoint, because after a pause, the breakpoint automatically disappears and does not have to be cancelled manually.
Temporary breakpoints can be created by holding down the Alt or option key while breaking the point. You can also select more and select Remove once hit in the window by right-clicking the breakpoint.
5. Evaluation and calculation
Evaluation function in our debug process, we can easily view the value of all variables in the program, but also temporarily modify the value of variables in the program, this function can help us to debug the code to a certain extent.
This feature can be turned on in the debug window during debug:
After opening it, it looks like this:
Then you can enter the actions you want in the expression input box, such as viewing variables, modifying variables (temporarily), calling a method, etc.; the results of these actions will be output in the Result window below.
The answer to the question about IDEA Debug debugging tips in Tongnan County is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.