-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: print compact stack traces if debug info is empty / not useful #6976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: print compact stack traces if debug info is empty / not useful #6976
Conversation
WalkthroughThe change updates GetCrashInfoStr in src/stacktraces.cpp to use a stricter check for useful debug data. It computes hasUsefulInfo by scanning stackframeInfos for any frame with a non-empty filename or function. If no useful info is found, GetCrashInfoStrNoDebugInfo(ci) is used; if at least one frame has data, the existing debug-output path is retained. No public signatures were changed. Sequence Diagram(s)sequenceDiagram
participant Caller
participant GetCrashInfoStr
participant hasUsefulInfo
participant GCS_Debug as GetCrashInfoStr (debug)
participant GCS_NoDebug as GetCrashInfoStrNoDebugInfo
Caller->>GetCrashInfoStr: call with CrashInfo
GetCrashInfoStr->>hasUsefulInfo: scan stackframeInfos (filename|function non-empty)
alt hasUsefulInfo == true
hasUsefulInfo-->>GetCrashInfoStr: true
GetCrashInfoStr->>GCS_Debug: generate debug info string
GCS_Debug-->>Caller: return debug string
else hasUsefulInfo == false
hasUsefulInfo-->>GetCrashInfoStr: false
GetCrashInfoStr->>GCS_NoDebug: generate no-debug string
GCS_NoDebug-->>Caller: return non-debug string
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-11-14T23:17:08.477ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/stacktraces.cpp (1)
472-486: LGTM! Consider usingstd::any_offor more idiomatic C++.The logic correctly addresses the PR objective by detecting when debug information is present but not useful (all frames have empty filename and function). The IIFE lambda pattern works, but could be replaced with a more conventional approach.
Apply this diff for a more idiomatic implementation:
- // Check if we have any useful debug information at all - // libbacktrace may return stackframe_info entries but with empty filenames and functions - // when it can find the binary but can't resolve symbols - bool hasUsefulInfo = [&ci]() { - for (const auto& si : ci.stackframeInfos) { - if (!si.filename.empty() || !si.function.empty()) { - return true; - } - } - return false; - }(); + // Check if we have any useful debug information at all + // libbacktrace may return stackframe_info entries but with empty filenames and functions + // when it can find the binary but can't resolve symbols + bool hasUsefulInfo = std::any_of(ci.stackframeInfos.begin(), ci.stackframeInfos.end(), + [](const auto& si) { return !si.filename.empty() || !si.function.empty(); }); if (!hasUsefulInfo) { return GetCrashInfoStrNoDebugInfo(ci); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/stacktraces.cpp(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
Co-authored-by: UdjinM6 <[email protected]>
UdjinM6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK c4971dc
How compact format looks? can you post an example? Also; addresses are quite useful, aren't they? |
kwvg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK c4971dc
|
@knst it looks like: |
knst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK c4971dc
Issue being fixed or feature implemented
Sometimes we see "stack traces" like;
This isn't helpful; if we have no useful info; let's print the compact format
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
Go over all the following points, and put an
xin all the boxes that apply.