[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 25 09:25:04 PDT 2024


jimingham wrote:

You can't get from a TypeSystem to a Target directly, because TypeSystem's live in Modules and Modules live outside any particular target in the global module cache.  Maybe you need to pass this in to the call to dump the functions.  The command-line will always have a current target, and if you are doing this through the SB API you probably want local control of whether to use colors or not anyway.

Jim

> On Mar 25, 2024, at 7:35 AM, Michael Buch ***@***.***> wrote:
> 
> 
> What happens if you have colors disabled in your terminal? Does this do nothing? Or does it start inserting ANSI escape codes in plain text?
> 
> Yea good question, was about to try this out. It does whatever clang's ast-dump would do if colors aren't turned off
> 
> That keys off of the output stream supporting colors, but LLDB also allows you to disable colors globally. Please also try lldb --no-use-colors and see if that behaves correctly (it might if we set the properties of the stream correctly). If it doesn't you'll need to read debugger.GetUseColor().
> 
> It behaves correctly for the target modules dump ast case because that uses the LLDB streams, as you mentioned. For other diagnostics we would have to use the GetUseColor API, though we'd have to plumb the target through to TypeSystemClang::CreateASTContext first, to get access to the debugger object. Will try that instead
> 
>> Reply to this email directly, view it on GitHub <https://github.com/llvm/llvm-project/pull/86159#issuecomment-2018147670>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADUPVW7P36SEQCHKWC6KEETY2AY2XAVCNFSM6AAAAABFB5XJ76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJYGE2DONRXGA>.
> You are receiving this because you are on a team that was mentioned.
> 



https://github.com/llvm/llvm-project/pull/86159


More information about the lldb-commits mailing list