[lldb][Linux] Show si_addr for SIGBUS signals - #207718
Merged
Merged
Conversation
The general rule is if si_addr is the same as the PC, we don't show it because it doesn't add any new information. SIGBUS signals are caused by an instruction trying to do something, but si_addr is not the address of the instruction. It's some virtual address, which is the important bit so add it to the description. Before: * thread #1, name = 'test.o', stop reason = signal SIGBUS: illegal address frame #0: 0x0000aaaaaaaa0b80 test.o`main at test.c:42:13 After: * thread #1, name = 'test.o', stop reason = signal SIGBUS: illegal address (fault address=0xfffff7ff6000) frame #0: 0x0000aaaaaaaa0b80 test.o`main at test.c:42:13 I am not adding test cases for this because: * They would be architecture specific. * Relibably generating BUS_OBJERR seems difficult. * Signal reporting has good coverage as it is, so we know that si_code/si_addr are handled correctly.
|
@llvm/pr-subscribers-lldb Author: David Spickett (DavidSpickett) ChangesThe general rule is if si_addr is the same as the PC, we don't show it because it doesn't add any new information. SIGBUS signals are caused by an instruction trying to do something, but si_addr is not the address of the instruction. It's some virtual address, which is the important bit so add it to the description. Before:
After:
I am not adding test cases for this because:
Full diff: https://github.com/llvm/llvm-project/pull/207718.diff 1 Files Affected:
diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
index 0f6b2b2ca767a..a71bde9532915 100644
--- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
+++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp
@@ -119,9 +119,9 @@ void LinuxSignals::Reset() {
ADD_LINUX_SIGNAL(6, "SIGABRT", false, true, true, "abort()/IOT trap", "SIGIOT");
ADD_LINUX_SIGNAL(7, "SIGBUS", false, true, true, "bus error");
- ADD_SIGCODE(SIGBUS, 7, BUS_ADRALN, 1, "illegal alignment");
- ADD_SIGCODE(SIGBUS, 7, BUS_ADRERR, 2, "illegal address");
- ADD_SIGCODE(SIGBUS, 7, BUS_OBJERR, 3, "hardware error");
+ ADD_SIGCODE(SIGBUS, 7, BUS_ADRALN, 1, "illegal alignment", SignalCodePrintOption::Address);
+ ADD_SIGCODE(SIGBUS, 7, BUS_ADRERR, 2, "illegal address", SignalCodePrintOption::Address);
+ ADD_SIGCODE(SIGBUS, 7, BUS_OBJERR, 3, "hardware error", SignalCodePrintOption::Address);
ADD_LINUX_SIGNAL(8, "SIGFPE", false, true, true, "floating point exception");
ADD_SIGCODE(SIGFPE, 8, FPE_INTDIV, 1, "integer divide by zero");
|
bulbazord
approved these changes
Jul 6, 2026
JDevlieghere
approved these changes
Jul 6, 2026
aobolensk
pushed a commit
to aobolensk/llvm-project
that referenced
this pull request
Jul 8, 2026
The general rule is if si_addr is the same as the PC, we don't show it because it doesn't add any new information. SIGBUS signals are caused by an instruction trying to do something, but si_addr is not the address of the instruction. It's some virtual address, which is the important bit so add it to the description. https://man7.org/linux/man-pages/man7/signal.7.html > SIGBUS <...> Bus error (bad memory access) Before: ``` * thread llvm#1, name = 'test.o', stop reason = signal SIGBUS: illegal address * frame #0: 0x0000aaaaaaaa0b80 test.o`main at test.c:42:13 ``` After: ``` * thread llvm#1, name = 'test.o', stop reason = signal SIGBUS: illegal address (fault address=0xfffff7ff6000) * frame #0: 0x0000aaaaaaaa0b80 test.o`main at test.c:42:13 ``` I am not adding test cases for this because: * They would be architecture specific. * Reliably generating BUS_OBJERR seems difficult. * Signal reporting has good coverage as it is, so we know that si_code/si_addr are handled correctly.
gandhi56
pushed a commit
that referenced
this pull request
Jul 9, 2026
The general rule is if si_addr is the same as the PC, we don't show it because it doesn't add any new information. SIGBUS signals are caused by an instruction trying to do something, but si_addr is not the address of the instruction. It's some virtual address, which is the important bit so add it to the description. https://man7.org/linux/man-pages/man7/signal.7.html > SIGBUS <...> Bus error (bad memory access) Before: ``` * thread #1, name = 'test.o', stop reason = signal SIGBUS: illegal address * frame #0: 0x0000aaaaaaaa0b80 test.o`main at test.c:42:13 ``` After: ``` * thread #1, name = 'test.o', stop reason = signal SIGBUS: illegal address (fault address=0xfffff7ff6000) * frame #0: 0x0000aaaaaaaa0b80 test.o`main at test.c:42:13 ``` I am not adding test cases for this because: * They would be architecture specific. * Reliably generating BUS_OBJERR seems difficult. * Signal reporting has good coverage as it is, so we know that si_code/si_addr are handled correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The general rule is if si_addr is the same as the PC, we don't show it because it doesn't add any new information.
SIGBUS signals are caused by an instruction trying to do something, but si_addr is not the address of the instruction. It's some virtual address, which is the important bit so add it to the description.
https://man7.org/linux/man-pages/man7/signal.7.html
Before:
After:
I am not adding test cases for this because: