taalhaataahir0102 wrote:
Hi David!
I've updated the feedback. I got your point of somehow embedding the use-color
and name in a single argument. Now we're doing the following:
In the very first function (`LookupSymbolInModule`) which calls other dump:
```
bool use_color = interpreter.GetDebugger().GetUseColor();
if (name && use_color){
DumpAddress(
interpreter.GetExecutionContext().GetBestExecutionContextScope(),
symbol->GetAddressRef(), verbose, all_ranges, strm, name);
}
else{
DumpAddress(
interpreter.GetExecutionContext().GetBestExecutionContextScope(),
symbol->GetAddressRef(), verbose, all_ranges, strm);
}
```
As the program should only go inside the re-pattern (new name of printRed ;-)
function if use-color is true and name is not null. Hence if this condition
`if (name && use_color)`
is not true, I'm using the Dump function which has `nullptr` as the default
value of variable name.
Plus I've also updated the test cases and re-pattern function according to the
feedback. Just 2 things are left:
1. Writing a test case for no symbol match.
> Also just for sanity checking, add one where you don't match anything at all.
> It shouldn't do any matching or even attempt to, so the test would just
> ensure that it doesn't try and end up crashing.
>
> The classic "nothing in, nothing out" test case. So it will match 0 symbols
> but that's what we expect.
Was facing some issues while checking for empty string using:
```
# RUN: %lldb %t -b -o 'settings set use-color true' -o 'image lookup -r -s
.*o132we$' | FileCheck %s --check-prefix CHECK5
# CHECK5-EMPTY:
```
But getting this error:
```
error: found non-empty check string for empty check with prefix 'CHECK5:'
# CHECK5-EMPTY:
```
2. Avoiding string copy in re-pattern function
> You can avoid some string copies by:
>
> 1. Passing the StringRef to this function, instead of converting it to
> std::string and then getting a char* from that.
> 2. Then using StringRef's `.begin` and `.end` in the `next` iterator. If it
> doesn't like the type you can build the begin/end from `.bytes_begin` and
> `.bytes_end` instead. Those give you char* instead.
>
> Basically StringRef is a "view" onto a string, so as long as we know where it
> ends we can iterate over that instead of a new copy of it.
Was having issues while using both `.begin()` and `.bytes_begin()`
But I'll look into both of these remaining things. For the test case maybe I
will try to check the length of the output to be zero and for String reference
I'll look more in to the `begin` and `bytes_begin` functions. Will update you
shortly on these two.
Other than that can you please provide feedback on this commit and any other
stuff which needs to be done :)
https://github.com/llvm/llvm-project/pull/69422
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits