DEBUG+TRACE mode: provide a complete call stack trace on console / debug.log#1934
Closed
tlaurion wants to merge 1 commit intolinuxboot:masterfrom
Closed
DEBUG+TRACE mode: provide a complete call stack trace on console / debug.log#1934tlaurion wants to merge 1 commit intolinuxboot:masterfrom
tlaurion wants to merge 1 commit intolinuxboot:masterfrom
Conversation
…k traces in output Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Comment on lines
549
to
563
| DEBUG_STACK() { | ||
| local FRAMES | ||
| FRAMES="${#FUNCNAME[@]}" | ||
| DEBUG "call stack: ($((FRAMES - 1)) frames)" | ||
| # Don't print DEBUG_STACK itself, start from 1 | ||
| for i in $(seq 1 "$((FRAMES - 1))"); do | ||
| DEBUG "- $((i - 1)) - ${BASH_SOURCE[$i]}(${BASH_LINENO[$((i - 1))]}): ${FUNCNAME[$i]}" | ||
| local SKIP_FIRST=0 | ||
|
|
||
| # If TRACE_FUNC called DEBUG_STACK, remove it from the stack to avoid redundancy. | ||
| [[ "${FUNCNAME[1]}" == "TRACE_FUNC" ]] && SKIP_FIRST=1 | ||
|
|
||
| # Get the total number of stack frames | ||
| local FRAMES="${#FUNCNAME[@]}" | ||
| DEBUG "call stack: ($((FRAMES - 1 - SKIP_FIRST)) frames)" | ||
|
|
||
| # Iterate through the stack and print each function call with file and line number | ||
| for i in $(seq $((1 + SKIP_FIRST)) "$((FRAMES - 1))"); do | ||
| DEBUG "- $((i - 1 - SKIP_FIRST)) - ${BASH_SOURCE[$i]}(${BASH_LINENO[$((i - 1))]}): ${FUNCNAME[$i]}" | ||
| done | ||
| } |
Collaborator
There was a problem hiding this comment.
This looks like an artifact from some earlier implementation - TRACE_FUNC doesn't call DEBUG_STACK in the final version, so I think you should revert this
Collaborator
Author
|
Included and cleaned up under #1935 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When board/runtime configuration settings have DEBUG+TRACE turned on, to ease understanding where things are happening/producing output, its not always easy to understand the call trace. This Pull requests addresses that.
DEBUG+TRACE mode is default for qemu boards variants that are not "production" variants.
End users/devels can turn this on through Configuration Settings, since the default is quiet mode.
Before:
After: