aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/ErrorTest.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2024-03-01 11:06:58 -0800
committerGitHub <noreply@github.com>2024-03-01 11:06:58 -0800
commitaf009451ec439593554f03bc714e46ad2cd41738 (patch)
tree1ba6a135bda18c5d5147029f0ec181f48a93a539 /llvm/unittests/Support/ErrorTest.cpp
parent00570c36a3a982f9cf8b30f366a07e6c70014383 (diff)
downloadllvm-af009451ec439593554f03bc714e46ad2cd41738.zip
llvm-af009451ec439593554f03bc714e46ad2cd41738.tar.gz
llvm-af009451ec439593554f03bc714e46ad2cd41738.tar.bz2
[lldb] Fix `thread backtrace --count` (#83602)
The help output for `thread backtrace` specifies that you can pass -1 to `--count` to display all the frames. ``` -c <count> ( --count <count> ) How many frames to display (-1 for all) ``` However, that doesn't work: ``` (lldb) thread backtrace --count -1 error: invalid integer value for option 'c' ``` 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: 1. Make `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. 2. Keep `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
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
0 files changed, 0 insertions, 0 deletions