TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Debugging a Mixed Python and C Language Stack

152 pointsby quasibenabout 2 years ago

6 comments

zdevitoabout 2 years ago
When developing PyTorch, we also run into a lot of mixed Python&#x2F;C++ language situations. We&#x27;ve recently been experimenting with in-process &#x27;combined&#x27; Python&#x2F;C++&#x2F;PyTorch 2.0 stack traces to make it easier to understand where code is executing (<a href="https:&#x2F;&#x2F;dev-discuss.pytorch.org&#x2F;t&#x2F;fast-combined-c-python-torchscript-inductor-tracebacks&#x2F;1158" rel="nofollow">https:&#x2F;&#x2F;dev-discuss.pytorch.org&#x2F;t&#x2F;fast-combined-c-python-tor...</a>).
评论 #35708075 未加载
fmajidabout 2 years ago
GDB can decode Python stack traces as Python code, as long as you have have python-gdb.py from the Python source distribution in the same place as your Python executable.
评论 #35711719 未加载
评论 #35711289 未加载
评论 #35709797 未加载
评论 #35707907 未加载
评论 #35715412 未加载
评论 #35710350 未加载
PaulHouleabout 2 years ago
That reminds me of the time I debugged some code (also neural network) that was in both Java and C++ and I was able to attach both gdb and jdb to the same process but had to disable the segfault trap on gdb because the jvm segfaults all the time in normal operation.
评论 #35711831 未加载
评论 #35711212 未加载
jazaabout 2 years ago
An inspiring, albeit daunting, write-up for someone like me, who has been a python coder for over 10 years, but who has never professionally coded in C or C++. I&#x27;d be pleasantly surprised with myself if I could one day debug like that.<p>Also somewhat depressing that, yet again, the GIL was to blame, and that after all that impressive investigatory work, the fix was (spoiler alert!) &quot;rewrite the offending function in C&quot;.
评论 #35713044 未加载
vaughanabout 2 years ago
It&#x27;s unfortunate that no one thinks about the debugging experience with anything they build today. It&#x27;s always a &quot;strap yourself in&quot; experience like in the post.<p>I dream of an IDE that is one-click, full-stack, local debug.<p>I dropped some ideas here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35650253" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35650253</a>
nightpoolabout 2 years ago
Awesome to see some more Excalidraw diagrams on the front page, feels like it&#x27;s really taking off.