Skip to content

Commit 8d3ff60

Browse files
committed
Fix symbolizer markup backtrace build/test.
This corrects a Darwin build failure due to a missing stub and an environment-specific Linux test failure due to an overly restrictive test regex. This also backs out of the previous fix attempt; %p is intended to be printed and parsed with the semantics of #.
1 parent 0f8bab8 commit 8d3ff60

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

llvm/lib/Support/Unix/Signals.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public:
539539
uintptr_t StartAddress = Info->dlpi_addr + Phdr->p_vaddr;
540540
uintptr_t ModuleRelativeAddress = Phdr->p_vaddr;
541541
std::array<char, 4> ModeStr = modeStrFromFlags(Phdr->p_flags);
542-
OS << format("{{{mmap:%016x:%x:load:%d:%s:%016x}}}\n", StartAddress,
542+
OS << format("{{{mmap:%#016x:%#x:load:%d:%s:%#016x}}}\n", StartAddress,
543543
Phdr->p_memsz, ModuleCount, &ModeStr[0],
544544
ModuleRelativeAddress);
545545
}
@@ -656,6 +656,10 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth,
656656
return true;
657657
}
658658

659+
static bool printMarkupContext(llvm::raw_ostream &OS,
660+
const char *MainExecutableName) {
661+
return false;
662+
}
659663
#else
660664
/// Backtraces are not enabled or we don't yet know how to find all loaded DSOs
661665
/// on this platform.

llvm/unittests/Support/SignalsTest.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ using testing::Not;
2525

2626
#define TAG_BEGIN "\\{\\{\\{"
2727
#define TAG_END "\\}\\}\\}"
28+
// %p in the Symbolizer Markup Format spec
29+
#define P_REGEX "(0+|0x[0-9a-fA-F]+)"
30+
// %i in the Symbolizer Markup Format spec
31+
#define I_REGEX "(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)"
2832

2933
#if defined(HAVE_BACKTRACE) && ENABLE_BACKTRACES && HAVE_LINK_H && \
3034
(defined(__linux__) || defined(__FreeBSD__) || \
@@ -43,14 +47,10 @@ TEST(SignalsTest, PrintsSymbolizerMarkup) {
4347
"module:0:[^:]*SupportTests:elf:[0-9a-f]+" TAG_END
4448
".*"));
4549
// Text segment for main binary
46-
EXPECT_THAT(
47-
Res,
48-
MatchesRegex(".*" TAG_BEGIN
49-
"mmap:[0-9a-f]+:[0-9a-f]+:load:0:rx:[0-9a-f]+" TAG_END
50-
".*"));
50+
EXPECT_THAT(Res, MatchesRegex(".*" TAG_BEGIN "mmap:" P_REGEX ":" I_REGEX
51+
":load:0:rx:" P_REGEX TAG_END ".*"));
5152
// Backtrace line
52-
EXPECT_THAT(Res, MatchesRegex(".*" TAG_BEGIN "bt:0:[0-9a-f]+"
53-
".*"));
53+
EXPECT_THAT(Res, MatchesRegex(".*" TAG_BEGIN "bt:0:" P_REGEX ".*"));
5454
}
5555

5656
TEST(SignalsTest, SymbolizerMarkupDisabled) {

0 commit comments

Comments
 (0)