Skip to content

Commit 0236cb6

Browse files
authored
[lldb] Enable "frame diagnose" on linux (#123217)
.. by changing the signal stop reason format 🤦 The reason this did not work is because the code in `StopInfo::GetCrashingDereference` was looking for the string "address=" to extract the address of the crash. Macos stop reason strings have the form ``` EXC_BAD_ACCESS (code=1, address=0xdead) ``` while on linux they look like: ``` signal SIGSEGV: address not mapped to object (fault address: 0xdead) ``` Extracting the address from a string sounds like a bad idea, but I suppose there's some value in using a consistent format across platforms, so this patch changes the signal format to use the equals sign as well. All of the diagnose tests pass except one, which appears to fail due to something similar #115453 (disassembler reports unrelocated call targets). I've left the tests disabled on windows, as the stop reason reporting code works very differently there, and I suspect it won't work out of the box. If I'm wrong -- the XFAIL will let us know.
1 parent 3ea2b54 commit 0236cb6

File tree

18 files changed

+46
-28
lines changed

18 files changed

+46
-28
lines changed

lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ void NativeThreadLinux::AnnotateSyncTagCheckFault(lldb::addr_t fault_addr) {
326326
}
327327

328328
// We assume that the stop description is currently:
329-
// signal SIGSEGV: sync tag check fault (fault address: <addr>)
329+
// signal SIGSEGV: sync tag check fault (fault address=<addr>)
330330
// Remove the closing )
331331
m_stop_description.pop_back();
332332

333333
std::stringstream ss;
334334
std::unique_ptr<MemoryTagManager> manager(std::move(details->manager));
335335

336-
ss << " logical tag: 0x" << std::hex << manager->GetLogicalTag(fault_addr);
336+
ss << " logical tag=0x" << std::hex << manager->GetLogicalTag(fault_addr);
337337

338338
std::vector<uint8_t> allocation_tag_data;
339339
// The fault address may not be granule aligned. ReadMemoryTags will granule
@@ -347,7 +347,7 @@ void NativeThreadLinux::AnnotateSyncTagCheckFault(lldb::addr_t fault_addr) {
347347
llvm::Expected<std::vector<lldb::addr_t>> allocation_tag =
348348
manager->UnpackTagsData(allocation_tag_data, 1);
349349
if (allocation_tag) {
350-
ss << " allocation tag: 0x" << std::hex << allocation_tag->front() << ")";
350+
ss << " allocation tag=0x" << std::hex << allocation_tag->front() << ")";
351351
} else {
352352
llvm::consumeError(allocation_tag.takeError());
353353
ss << ")";

lldb/source/Target/UnixSignals.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ UnixSignals::GetSignalDescription(int32_t signo, std::optional<int32_t> code,
163163
break;
164164
case SignalCodePrintOption::Address:
165165
if (addr)
166-
strm << " (fault address: 0x" << std::hex << *addr << ")";
166+
strm << " (fault address=0x" << std::hex << *addr << ")";
167167
break;
168168
case SignalCodePrintOption::Bounds:
169169
if (lower && upper && addr) {
@@ -172,9 +172,9 @@ UnixSignals::GetSignalDescription(int32_t signo, std::optional<int32_t> code,
172172
else
173173
strm << "upper bound violation ";
174174

175-
strm << "(fault address: 0x" << std::hex << *addr;
176-
strm << ", lower bound: 0x" << std::hex << *lower;
177-
strm << ", upper bound: 0x" << std::hex << *upper;
175+
strm << "(fault address=0x" << std::hex << *addr;
176+
strm << ", lower bound=0x" << std::hex << *lower;
177+
strm << ", upper bound=0x" << std::hex << *upper;
178178
strm << ")";
179179
} else
180180
strm << sc.m_description.str();

lldb/test/API/commands/frame/diagnose/array/TestArray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestArray(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/bad-reference/TestBadReference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestBadReference(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/complicated-expression/TestComplicatedExpression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestDiagnoseDereferenceArgument(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestDiagnoseDereferenceArgument(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestDiagnoseDereferenceFunctionReturn(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=no_match(lldbplatformutil.getDarwinOSTriples()))
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/dereference-this/TestDiagnoseDereferenceThis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestDiagnoseDereferenceThis(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/inheritance/TestDiagnoseInheritance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestDiagnoseInheritance(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

lldb/test/API/commands/frame/diagnose/local-variable/TestLocalVariable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestLocalVariable(TestBase):
13-
@skipUnlessDarwin
13+
@expectedFailureAll(oslist=["windows"])
1414
@skipIf(
1515
archs=no_match(["x86_64"])
1616
) # <rdar://problem/33842388> frame diagnose doesn't work for armv7 or arm64

0 commit comments

Comments
 (0)