[all-commits] [llvm/llvm-project] c90cb6: [lldb] colorize symbols in image lookup with a reg...

taalhaataahir0102 via All-commits all-commits at lists.llvm.org
Fri Dec 8 03:09:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c90cb6eee8296953c097fcc9fc6e61f739c0dad3
      https://github.com/llvm/llvm-project/commit/c90cb6eee8296953c097fcc9fc6e61f739c0dad3
  Author: taalhaataahir0102 <77788288+taalhaataahir0102 at users.noreply.github.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M lldb/include/lldb/Core/Address.h
    M lldb/include/lldb/Core/Debugger.h
    M lldb/include/lldb/Symbol/Symbol.h
    M lldb/include/lldb/Symbol/SymbolContext.h
    M lldb/include/lldb/Utility/Stream.h
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Core/Address.cpp
    M lldb/source/Core/CoreProperties.td
    M lldb/source/Core/Debugger.cpp
    M lldb/source/Symbol/Symbol.cpp
    M lldb/source/Symbol/SymbolContext.cpp
    M lldb/source/Utility/Stream.cpp
    A lldb/test/Shell/Commands/command-image-lookup-color.test

  Log Message:
  -----------
  [lldb] colorize symbols in image lookup with a regex pattern (#69422)

Fixes https://github.com/llvm/llvm-project/issues/57372

Previously some work has already been done on this. A PR was generated
but it remained in review:
https://reviews.llvm.org/D136462

In short previous approach was following:
Changing the symbol names (making the searched part colorized) ->
printing them -> restoring the symbol names back in their original form.

The reviewers suggested that instead of changing the symbol table, this
colorization should be done in the dump functions itself. Our strategy
involves passing the searched regex pattern to the existing dump
functions responsible for printing information about the searched
symbol. This pattern is propagated until it reaches the line in the dump
functions responsible for displaying symbol information on screen.

At this point, we've introduced a new function called
"PutCStringColorHighlighted," which takes the searched pattern, a prefix and suffix,
and the text and applies colorization to highlight the pattern in the
output. This approach aims to streamline the symbol search process to
improve readability of search results.

Co-authored-by: José L. Junior <josejunior at 10xengineers.ai>




More information about the All-commits mailing list