8274039: codestrings gtest fails when hsdis is present

Reviewed-by: shade
This commit is contained in:
Patric Hedlin 2021-09-22 14:20:17 +00:00
parent 33df388a24
commit c9de80635e

View File

@ -37,10 +37,13 @@ static const char* replace_addr_expr(const char* str)
{
// Remove any address expression "0x0123456789abcdef" found in order to
// aid string comparison. Also remove any trailing printout from a padded
// buffer.
// buffer (too brittle?).
std::basic_string<char> tmp = std::regex_replace(str, std::regex("0x[0-9a-fA-F]+"), "<addr>");
std::basic_string<char> red = std::regex_replace(tmp, std::regex("\\s+<addr>:\\s+\\.inst\\t<addr> ; undefined"), "");
std::basic_string<char> tmp1 = std::regex_replace(str, std::regex("0x[0-9a-fA-F]+"), "<addr>");
// Padding: aarch64
std::basic_string<char> tmp2 = std::regex_replace(tmp1, std::regex("\\s+<addr>:\\s+\\.inst\\t<addr> ; undefined"), "");
// Padding: x64
std::basic_string<char> red = std::regex_replace(tmp2, std::regex("\\s+<addr>:\\s+hlt[ \\t]+(?!\\n\\s+;;)"), "");
return os::strdup(red.c_str());
}