================
@@ -1506,13 +1513,39 @@ static bool LookupAddressInModule(CommandInterpreter
&interpreter, Stream &strm,
ExecutionContextScope *exe_scope =
interpreter.GetExecutionContext().GetBestExecutionContextScope();
- DumpAddress(exe_scope, so_addr, verbose, all_ranges, strm);
+ DumpAddress(exe_scope, so_addr, verbose, all_ranges, strm, nullptr);
return true;
}
return false;
}
+//===========================================================================================
+
+// This function is the one which colorizes the regex symbol searched
+static void PrintRed(Stream &strm, const char *text, const char *name) {
+ const std::string red_start = ANSI_ESC_START +
std::to_string(ANSI_FG_COLOR_RED) + ANSI_ESC_END;
+ const std::string reset_color = ANSI_ESC_START +
std::to_string(ANSI_CTRL_NORMAL) + ANSI_ESC_END;
+
+ const char *match = text;
+ size_t name_len = strlen(name);
----------------
DavidSpickett wrote:
https://en.cppreference.com/w/c/string/byte/strlen
Specifically:
```
The behavior is undefined if str is not a pointer to a null-terminated byte
string.
```
I won't go into what that means according to the standard but here
specifically, if clang knew a call to PrintRed took a nullptr always, it could
make essentially choose the result of strlen to be almost anything. Which is
not what we want.
So, as you suggested in your comment on the PR page, starting with some `if a
nullptr then just print it out normally` is a good idea.
https://github.com/llvm/llvm-project/pull/69422
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits