TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Debugging: When depth-first vs. breadth-first?

1 点作者 jes超过 2 年前
Hello -<p>[ I&#x27;m interested in general advice here, yet wish to give an example to set it up. ]<p>You have a complex software package that runs on Linux, macOS and Windows. Let&#x27;s say it also interfaces with a complex piece of hardware via PCIe.<p>When you test the software on Linux, you get output about, say, an I&#x2F;O page fault. There are some details, but you&#x27;re not an experienced kernel hacker, so progress is slow if you try to dig in on it.<p>Some of your colleagues suggest that you stay focused on debugging the problem on Linux. Others suggest running the same test case on macOS and Windows, to see what happens, and if that sheds any light on the problem.<p>I&#x27;m interested in your thoughts on which approach you would take, with whatever qualifiers you wish to add, and why.<p>The more general question here is when you have a bug roughly like the one described above, is your preference to stay with one particular set-up and dig for all the details you can (call this &quot;depth-first&quot; debugging, maybe) or do you prefer to go breadth-first (when you can) to try to narrow things down?

4 条评论

iforgotpassword超过 2 年前
While I do have some experience with kernel code, if there isn&#x27;t something jumping right at me after some hour of staring at code and maybe inserting some debug statements on a hunch, I might try the other OSes just as a sort of sanity check to see if the issue even exists at all, or if everything works flawlessly. Or maybe it will break in another way and I&#x27;ll suddenly have a lightbulb moment that helps me identifying the problem better. Could it be a hardware issue? Could it be that just my device is faulty? Just some revisions of it?<p>Generally I switch between approaches as I see fit, on a hunch you could say. There&#x27;s no point in banging your head against a wall in some dead end for two hours.
jstx1超过 2 年前
&gt; Some of your colleagues suggest that you stay focused on debugging the problem on Linux. Others suggest running the same test case on macOS and Windows, to see what happens, and if that sheds any light on the problem.<p>The latter option seems clearly better to me but I don&#x27;t know if that makes for general advice. It&#x27;s also easy to pick that option when the alternative isn&#x27;t specified at all (we don&#x27;t know what &quot;keep debugging on Linux&quot; means).
AnimalMuppet超过 2 年前
It depends.<p>Do I have a red-hot &quot;it&#x27;s probably this&quot; idea that I have some confidence in? If so, I probably chase that one in depth first, at least to the point of being able to confirm or disprove.<p>In the exact scenario you gave, I&#x27;d probably do breadth-first, because I don&#x27;t know if it&#x27;s OS-specific or not, and the possible causes are different depending on whether it&#x27;s Linux-only or not.
gjvc超过 2 年前
this nomenclature does not make things any clearer -- in fact, quite the opposite.