Although there are many unclear debugging tutorials, but still did not find which article written by the articles, and the sure yourself try to write their own Some use habits or experiences, I hope that children who are not very understanding to use breakpoints have some help
What is breakpoint action
Do the small end development Partners, perhaps this breakpoint is not very familiar. However, if you ask other languages (such as C, C, C, C ++, C #, etc.), they should be very familiar with breakpoint operation, which is provided in IDEs such as Xcode or Visual Studio.
The following words comes from ZhizhiThe meaning of the breakpoint operation is to set the trackpoint. The tracking point is equivalent to a temporary breakpoint that prints the message to the Output window.
Check the continuation execution of the following, when the TRACEPOINT hits Debugger will not stop, otherwise it will stop here. In both cases, the message will be printed.
Imagine a scenario, I hope that when the program is running, you can observe someone on a certain line. Variables or expressions of the expression. You will say that this is not very simple:
Dynamically inserts Console.log code.
It seems that the second way is a better way. Dynamic insertion code can of course use Chrome’s Live Edit function. At that time, we would like to have a way that does not directly modify the code. At this point you may think, then set a breakpoint to operate.
Didn’t tell you XX.
Don’t worry about it, and listen to us slowly. When the Chrome breakpoint is commissioned, the conditional breakpoint can be used, so-called condition breakpoint, specify a condition, when conforming to this condition. The execution will stop at the breakpoint, otherwise it will be executed directly down. As shown below, click Right-click on Line Number, select Add ConditionNal Breakpoint
, then input conditions, such as params.value == ‘value’ Such conditions, as shown below:
For the condition breakpoint description, if you are still not very familiar, You can refer to relevant information more.
Therefore, in the conditional input box of the condition breakpoint, we can enter the breakpoint operation we want to perform. Yes, such as Console.log. As shown
Since the console.log return value is undefined (final converted to false), the code will not be stopped here, but will be directly Under the implementation, this is equivalent to explaining the continuation of the concept of breakpoint operation. If you need to stop here, you can set the following expression:
The design of the conditional breakpoint is not designed for this purpose. So this is a HACK, not a standard mode, not the original design. However, isn’t it a lot of WEB development? It is convenient to use it.
Many students like to use console.log directly in the project so that when they are actually released, they will eventually delete these console.log code, and increase the workload. In this way, perhaps it can be reducedCONSLE.log in the product code.
Use this way, it is also possible to dynamically change the value of some variables. We know that some bugs can only be recovering in some specific values, which may be the server push, and the value of debugging at this time may depend on the value of the rear end. In fact, in this way, in this way, in this way, it can be enforced certain values, making the bug resent without relying on the value of the background.
https: // www. JB51.Net/Article/147623.htm
The above is the full content of this article. I hope this paper has a certain reference value for everyone’s learning or work. If you have any questions, please Message exchange, thank you for your support of Tumi Cloud.