简体   繁体   English

Chrome DevTools 不允许我在某些行上设置断点

[英]Chrome DevTools won't let me set breakpoints on certain lines

在此处输入图像描述

In the image above, I tried setting breakpoints on every line from line 437 to line 443. However, I cannot set breakpoints on lines 439 and 440. When the function runs, the breakpoints on lines 437, 438, 441, and 442 are ignored.在上图中,我尝试在第437行到第443行的每一行设置断点。但是,我无法在第439行和第440行设置断点。当function运行时,第437、438、441和442行的断点被忽略. Chrome breaks on line 443. This means that I cannot do some debugging before the first conditional runs. Chrome 在第 443 行中断。这意味着我无法在第一次条件运行之前进行一些调试。

When I click on lines 439 or 440, the breakpoint appears for half a second and jumps to line 443.当我点击第 439 或 440 行时,断点出现半秒并跳转到第 443 行。

Is this a bug or am I missing something?这是一个错误还是我遗漏了什么? How do I set a breakpoint at or before line 439?如何在第 439 行或之前设置断点?

如果您正在使用 js 缩小和源映射,请确保它们与您的源代码保持同步。

I have same problem in chrome dev tool source panel snippets when I write some codes to test my idea.当我编写一些代码来测试我的想法时,我在 chrome 开发工具源面板片段中遇到了同样的问题。

Only way for me worked is close dev tool panel and refresh page then reopen我工作的唯一方法是关闭开发工具面板并刷新页面然后重新打开

This problem happened after I modified codes in debug mode这个问题发生在我在调试模式下修改代码之后

This was frustrating for me today but I found the problem.今天这让我很沮丧,但我发现了问题。 I was trying to place a breakpoint inside an orphan function (nothing was calling it).我试图在孤立函数中放置一个断点(没有调用它)。 As soon as I fixed it, all was well.一旦我修好它,一切都很好。 Smart - but wish there was even a tiny hint that this was the case.聪明——但希望有一点点暗示就是这种情况。

This recently became an issue for me, running System.js and Babel, and with plain ES6 transpiling, I haven't gotten to minifying/mapping yet.这最近对我来说成了一个问题,运行 System.js 和 Babel,并且使用简单的 ES6 转译,我还没有开始缩小/映射。 A workaround seems to be to add your breakpoint to the !transpiled file, a matching breakpoint will automagically appear in the corresponding line in the raw file.一种解决方法似乎是将断点添加到 !transpiled 文件中,匹配的断点将自动出现在原始文件的相应行中。

I think that my classmate and I had this issue as well today.我想我和我的同学今天也有这个问题。 We made our changes and then hit Ctrl + S (or Cmd + S) to save the changes in the debugger and then we were able to add the breakpoints.我们进行了更改,然后按 Ctrl + S(或 Cmd + S)将更改保存在调试器中,然后我们就可以添加断点了。

就我而言,我无法在调用函数行上设置断点,但它在函数中起作用……很奇怪,但至少它起作用了。

I just had that problem and realized that what I saw in the dev tools source was not the code that actually ran in the browser.我刚刚遇到了这个问题,并意识到我在开发工具源代码中看到的并不是浏览器中实际运行的代码。

Make sure you empty your cache and reload and have the up to date code.确保清空缓存并重新加载并拥有最新的代码。

My problems where in sourcemaps definitions.我在源映射定义中的问题。 I solved my chrome debugging problems with this article: https://www.mistergoodcat.com/post/the-joy-that-is-source-maps-with-vuejs-and-typescript我用这篇文章解决了我的 chrome 调试问题: https ://www.mistergoodcat.com/post/the-joy-that-is-source-maps-with-vuejs-and-typescript

I was allmost there, all i had to change was at vue.config.js: devtool: "inline-source-map" -> devtool: "eval-source-map"我几乎在那里,我只需要更改 vue.config.js: devtool: "inline-source-map" -> devtool: "eval-source-map"

In my case it was, most likely, a bug in the devtools.就我而言,这很可能是 devtools 中的一个错误。 When I clicked to set a breakpoint inside an async function nothing seemed to happen, no visual indication of the breakpoint.当我单击在异步函数中设置断点时,似乎什么也没发生,断点没有视觉指示。 Although outside the function it showed the blue mark correctly.尽管在功能之外,它正确显示了蓝色标记。

But when I ran the code it turned out that all the breakpoints had been set actually.但是当我运行代码时发现实际上所有的断点都已经设置好了。

In my case, it turned out the function I was trying to add a breakpoint in, was never called but I'm not sure why it didn't allow me to add a breakpoint that would never hit anyway.就我而言,事实证明我试图在其中添加断点的 function 从未被调用过,但我不确定为什么它不允许我添加一个无论如何都不会命中的断点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM