Replies: 3 comments
-
historically the useful metaphor for me was to consider ignored code as builtin V8 code.
the idea is that pausing inside the ignored code should not be possible- it helps avoid complicated semantics for stepping from this line. what is about debugger statement? should it have the same semantics as the breakpoint set from UI? |
Beta Was this translation helpful? Give feedback.
-
I would love to see a consistent behaviour for the stepping functions. By optimising for the best scenario it would become really hard to understand what the button will actually do. I think the problem can be solved by doing these:
DevTools could have a consistent default behaviour when it comes to the stepping buttons: they either always ignore or respect the ignored files (I prefer the first option). In order to change that behaviour for all the buttons a user could apply a modifier key ( That way users won't have to guess what the button will do and can control the behaviour depending on their current needs (which may differ from the best scenario). |
Beta Was this translation helpful? Give feedback.
-
It is been a while! We're closing this RFC as we have collect enough feedback both online and offline. |
Beta Was this translation helpful? Give feedback.
-
Author: Eric Leese (@EricSL), Jecelyn Yeen (@jecfish), Meysam Sarabadani (@Meysamsarabadani)
Posted: Jul 21, 2023
Status: Open
Chrome bug tracker: https://crbug.com/1442855
The goal of this RFC is to validate the design with the community, solicit feedback on open questions.
Complete: This RFC is now complete. See a summary (comment).
Motivation
By default, Chrome DevTools (the debugger) skips over code that is configured to be ignored during debugging.
However, what if there are exceptions in those ignored files? Should the debugger stop, continue, or show hints? In this RFC, we will share a few tricky scenarios and discuss the expected behaviors.
Goals
Background: What is the ignore list?
(Skip to the next section if you already know what the ignore list is.)
Here is a demo application. When debugging a button click in a web application built with frameworks (e.g. React, Vue, Angular), it may first lead you to the framework or third-party code in the
node_modules
which could be irrelevant to you.Left: frames from your code. Right: frames from third-party libraries.
Stepping into irrelevant code is annoying and may slow down your debugging process. From Chrome 112 onwards, you can tell the debugger to ignore irrelevant code by right clicking on the frame in the call stack or the folder in the page tree, select Add script/ directory to ignore list. DevTools also work with tools like Vite, Rollup Nuxt and Angular to configure the ignore list by default.
Left: Ignore a frame in the call stack. Right: Add script or directory to the ignore list.
Once you do that, DevTools will skip the ignored code, and hide those frames in the Call Stack. You can enable the Show ignore-listed frames checkbox to view the ignored frames if you want to, and those frames are grayed out by default.
Left: Hide ignored frames in the Call Stack. Right: Show ignored frames in the Call Stack.
In any situation, if you want to debug the ignored files, you can remove it from the ignore list by:
You can remove a file from the ignore list in the page tree and in the file warning dialog.
Proposal / Design
Here is how we structure the proposal to facilitate the discussion. We will share 4 main scenarios with some additional “what if” scenarios⚠️ .
For each scenario, we will first explain what and why, then show a demo, followed by some questions:
Scenarios
Case 1: What happens when you set a breakpoint in an ignored file?
In this case, we focus specifically on line of code breakpoint and conditional breakpoint.
Setting a breakpoint and a conditional breakpoint in an ignored file.
From the conditional breakpoint, what happens when you start stepping?
✳️ Here is what we propose:
🤔 Why:
-No clear signals. However, if you step (in and out) to a different function, the ignore-list rules take precedence.
Step over: In the screenshot above, the debugger will move from line 274 to line 278
callWithAsyncErrorHandling
if you step over.Step over form the conditional breakpoint to the next line in the same function.
Step in: Click step in from
callWithAsyncErrorHandling
will jump to line 285 instead ofpatchStopImediatePropagation
(line 289) because thepatchStopImediatePropagation
is in the ignored file and it is outside of the current function.Skip the ignore code during step in and step into next line in the current function.
Step out: The debugger cannot find the next breakpoint or non-ignored frames, so the debugging session ends.
🙋🏽♀️ Questions:
Case 2: What happens when you set an event listener breakpoint, and the breakpoint is an ignored file?
Add a mouse click event listener breakpoint.
node_modules
is disabled, the mouse click breakpoint will pause at line 13 in theListPage.vue
file (your code), instead of random files in thenode_modules
(e.g.runtime-dom…js
)node_modules
andsrc
, then click on a coffee.Case 3: What happens when you toggle the “Show ignore listed frames” in the call stack?
Before and after enabling the Show ignore-listed frames checkbox.
node_modules
, set a mouse click event listener, then click on a coffee.Case 4: What happens when there are exceptions thrown in ignored code given you enable the pause on exceptions breakpoints?
Enabled the two “pause on exceptions” checkboxes.
✳️ Here is what we propose:
🤔 No clear signal that developers always want to stop in ignored files even if there are exceptions.
In this example below, the error is thrown in the ignored file
library.js
>throwException
and caught in the same ignored file aterrorWrapper
. In this case we will not stop on the exception because every function it passed through was ignored.A call stack with consecutive ignored frames.
In this example below, the error is thrown in the ignored file
library.js
>throwException
and caught in the same ignored file inerrorWrapper
. However, there are non-ignored functions on the call stack between where the exception is thrown and where it is caught. In this case, the debugger will stop atlibrary.js:15
.A call stack with non-ignored frames interspersed with ignored frames.
🙋🏽♀️ Questions:
doWithError
instead ofthrowException
. However, the behavior of stepping may be confusing because you might end up stopping in a totally different place that you intended to. (we are stepping from the hidden frame on top of the call stack instead of the frame that we selected to show the user.)Additional resources
The scenarios we show above are a compressed list of all the complex scenarios we are working on. Here is a longer list of test cases for various stopping behaviors.
-- THE END --
Beta Was this translation helpful? Give feedback.
All reactions