Skip to content

Commit 9d33b92

Browse files
authored
Revert "[LLDB][ELF Core] Support all the Generic (Negative) SI Codes." (#141645)
Reverts #140150 Broke the Darwin tests, but they pass on Linux. Reverting to make the build healthy while I investigate
1 parent 20f1e35 commit 9d33b92

File tree

10 files changed

+230
-295
lines changed

10 files changed

+230
-295
lines changed

lldb/include/lldb/Target/Platform.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "lldb/Core/UserSettingsController.h"
2222
#include "lldb/Host/File.h"
2323
#include "lldb/Interpreter/Options.h"
24-
#include "lldb/Target/StopInfo.h"
2524
#include "lldb/Utility/ArchSpec.h"
2625
#include "lldb/Utility/ConstString.h"
2726
#include "lldb/Utility/FileSpec.h"
@@ -961,8 +960,6 @@ class Platform : public PluginInterface {
961960

962961
virtual CompilerType GetSiginfoType(const llvm::Triple &triple);
963962

964-
virtual lldb::StopInfoSP GetStopInfoFromSiginfo(Thread &thread) { return {}; }
965-
966963
virtual Args GetExtraStartupCommands();
967964

968965
typedef std::function<Status(const ModuleSpec &module_spec,

lldb/include/lldb/Target/UnixSignals.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ class UnixSignals {
3636
std::optional<int32_t> code = std::nullopt,
3737
std::optional<lldb::addr_t> addr = std::nullopt,
3838
std::optional<lldb::addr_t> lower = std::nullopt,
39-
std::optional<lldb::addr_t> upper = std::nullopt,
40-
std::optional<uint32_t> pid = std::nullopt,
41-
std::optional<uint32_t> uid = std::nullopt) const;
39+
std::optional<lldb::addr_t> upper = std::nullopt) const;
4240

4341
bool SignalIsValid(int32_t signo) const;
4442

@@ -107,7 +105,7 @@ class UnixSignals {
107105
llvm::StringRef description,
108106
llvm::StringRef alias = llvm::StringRef());
109107

110-
enum SignalCodePrintOption { None, Address, Bounds, Sender };
108+
enum SignalCodePrintOption { None, Address, Bounds };
111109

112110
// Instead of calling this directly, use a ADD_SIGCODE macro to get compile
113111
// time checks when on the native platform.

lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <sys/utsname.h>
1515
#endif
1616

17-
#include "Plugins/Process/Utility/LinuxSignals.h"
1817
#include "Utility/ARM64_DWARF_Registers.h"
1918
#include "lldb/Core/Debugger.h"
2019
#include "lldb/Core/PluginManager.h"
@@ -481,107 +480,3 @@ CompilerType PlatformLinux::GetSiginfoType(const llvm::Triple &triple) {
481480
ast->CompleteTagDeclarationDefinition(siginfo_type);
482481
return siginfo_type;
483482
}
484-
485-
static std::string GetDescriptionFromSiginfo(lldb::ValueObjectSP siginfo_sp) {
486-
if (!siginfo_sp)
487-
return "";
488-
489-
lldb_private::LinuxSignals linux_signals;
490-
int code = siginfo_sp->GetChildMemberWithName("si_code")->GetValueAsSigned(0);
491-
int signo =
492-
siginfo_sp->GetChildMemberWithName("si_signo")->GetValueAsSigned(-1);
493-
494-
auto sifields = siginfo_sp->GetChildMemberWithName("_sifields");
495-
if (!sifields)
496-
return linux_signals.GetSignalDescription(signo, code);
497-
498-
// declare everything that we can populate later.
499-
std::optional<lldb::addr_t> addr;
500-
std::optional<lldb::addr_t> upper;
501-
std::optional<lldb::addr_t> lower;
502-
std::optional<uint32_t> pid;
503-
std::optional<uint32_t> uid;
504-
505-
// The negative si_codes are special and mean this signal was sent from user
506-
// space not the kernel. These take precedence because they break some of the
507-
// invariants around kernel sent signals. Such as SIGSEGV won't have an
508-
// address.
509-
if (code < 0) {
510-
auto sikill = sifields->GetChildMemberWithName("_kill");
511-
if (sikill) {
512-
auto pid_sp = sikill->GetChildMemberWithName("si_pid");
513-
if (pid_sp)
514-
pid = pid_sp->GetValueAsUnsigned(-1);
515-
auto uid_sp = sikill->GetChildMemberWithName("si_uid");
516-
if (uid_sp)
517-
uid = uid_sp->GetValueAsUnsigned(-1);
518-
}
519-
} else {
520-
521-
switch (signo) {
522-
case SIGILL:
523-
case SIGFPE:
524-
case SIGBUS: {
525-
auto sigfault = sifields->GetChildMemberWithName("_sigfault");
526-
if (!sigfault)
527-
break;
528-
529-
auto addr_sp = sigfault->GetChildMemberWithName("si_addr");
530-
if (addr_sp)
531-
addr = addr_sp->GetValueAsUnsigned(-1);
532-
break;
533-
}
534-
case SIGSEGV: {
535-
auto sigfault = sifields->GetChildMemberWithName("_sigfault");
536-
if (!sigfault)
537-
break;
538-
539-
auto addr_sp = sigfault->GetChildMemberWithName("si_addr");
540-
if (addr_sp)
541-
addr = addr_sp->GetValueAsUnsigned(-1);
542-
543-
auto bounds_sp = sigfault->GetChildMemberWithName("_bounds");
544-
if (!bounds_sp)
545-
break;
546-
547-
auto addr_bnds_sp = bounds_sp->GetChildMemberWithName("_addr_bnd");
548-
if (!addr_bnds_sp)
549-
break;
550-
551-
auto lower_sp = addr_bnds_sp->GetChildMemberWithName("_lower");
552-
if (lower_sp)
553-
lower = lower_sp->GetValueAsUnsigned(-1);
554-
555-
auto upper_sp = addr_bnds_sp->GetChildMemberWithName("_upper");
556-
if (upper_sp)
557-
upper = upper_sp->GetValueAsUnsigned(-1);
558-
559-
break;
560-
}
561-
default:
562-
break;
563-
}
564-
}
565-
566-
return linux_signals.GetSignalDescription(signo, code, addr, lower, upper,
567-
uid, pid);
568-
}
569-
570-
lldb::StopInfoSP PlatformLinux::GetStopInfoFromSiginfo(Thread &thread) {
571-
ValueObjectSP siginfo_sp = thread.GetSiginfoValue();
572-
if (!siginfo_sp)
573-
return {};
574-
auto signo_sp = siginfo_sp->GetChildMemberWithName("si_signo");
575-
auto sicode_sp = siginfo_sp->GetChildMemberWithName("si_code");
576-
if (!signo_sp || !sicode_sp)
577-
return {};
578-
579-
std::string siginfo_description = GetDescriptionFromSiginfo(siginfo_sp);
580-
if (siginfo_description.empty())
581-
return StopInfo::CreateStopReasonWithSignal(
582-
thread, signo_sp->GetValueAsUnsigned(-1));
583-
584-
return StopInfo::CreateStopReasonWithSignal(
585-
thread, signo_sp->GetValueAsUnsigned(-1), siginfo_description.c_str(),
586-
sicode_sp->GetValueAsUnsigned(0));
587-
}

lldb/source/Plugins/Platform/Linux/PlatformLinux.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ class PlatformLinux : public PlatformPOSIX {
6262

6363
CompilerType GetSiginfoType(const llvm::Triple &triple) override;
6464

65-
lldb::StopInfoSP GetStopInfoFromSiginfo(Thread &thread) override;
66-
6765
std::vector<ArchSpec> m_supported_architectures;
6866

6967
private:

0 commit comments

Comments
 (0)