[lldb] Fix thread backtrace --count
(#83602)
#8316
Merged
+38
−15
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.
The help output for
thread backtrace
specifies that you can pass -1 to--count
to display all the frames.However, that doesn't work:
The problem is that we store the option value as an unsigned and the code to parse the string correctly rejects it. There's two ways to fix this:
m_count
a signed value so that it accepts negative values and appease the parser. The function that prints the frames takes an unsigned so a negative value will just become a really large positive value, which is what the current implementation relies on.m_count
unsigned and instead use 0 the magic value to show all frames. I don't really see a point in not showing any frames at all, plus that's already broken (error: error displaying backtrace for thread: "0x0001"
).This patch implements (2) and at the same time improve the error reporting so that we print the invalid value when we cannot parse it.
rdar://123881767
(cherry picked from commit af00945)