-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LLDB][ProcessELFCore] Add Description to ProcessELFCore/ELFThread stop reasons #110065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ce87c9d
Add the addr info when appropriate for NIX' crash signals
Jlalond ebc02c4
Drop test as we can't yamilize the pt_note content
Jlalond d17c412
Run GCF
Jlalond f9e5cee
remove addr from threaddata
Jlalond c3691a8
Refactor to not depend ont the SIG enums, and use lldb::addr_t
Jlalond 2598427
Fix tests for the entire string and run GCF
Jlalond b6b46ae
Python formatting
Jlalond 2eec5fb
Use unix signals from process instead of reinventing the wheel
Jlalond 4a225c9
Drop reinterpret cast
Jlalond 4cacf29
Copy the siginfo_t structure with as minimal differences as possible,…
Jlalond 202b768
Switch to const reference
Jlalond babd0e1
Start migrating away from threaddata containing the signal data
Jlalond a4b7b3f
Move all the ELF Nix' flavors to the SigInfo, but don't emit unless …
Jlalond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ class ProcessInstanceInfo; | |
#undef si_signo | ||
#undef si_code | ||
#undef si_errno | ||
#undef si_addr | ||
#undef si_addr_lsb | ||
|
||
struct ELFLinuxPrStatus { | ||
int32_t si_signo; | ||
|
@@ -76,14 +78,36 @@ static_assert(sizeof(ELFLinuxPrStatus) == 112, | |
"sizeof ELFLinuxPrStatus is not correct!"); | ||
|
||
struct ELFLinuxSigInfo { | ||
int32_t si_signo; | ||
int32_t si_code; | ||
|
||
int32_t si_signo; // Order matters for the first 3. | ||
int32_t si_errno; | ||
int32_t si_code; | ||
// Copied from siginfo_t so we don't have to include signal.h on non 'Nix | ||
// builds. | ||
struct { | ||
lldb::addr_t si_addr; /* faulting insn/memory ref. */ | ||
short int si_addr_lsb; /* Valid LSB of the reported address. */ | ||
union { | ||
/* used when si_code=SEGV_BNDERR */ | ||
struct { | ||
lldb::addr_t _lower; | ||
lldb::addr_t _upper; | ||
} _addr_bnd; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to struct line:
|
||
/* used when si_code=SEGV_PKUERR */ | ||
uint32_t _pkey; | ||
} bounds; | ||
} sigfault; | ||
|
||
enum { eUnspecified, eNT_SIGINFO } note_type; | ||
|
||
ELFLinuxSigInfo(); | ||
|
||
lldb_private::Status Parse(const lldb_private::DataExtractor &data, | ||
const lldb_private::ArchSpec &arch); | ||
const lldb_private::ArchSpec &arch, | ||
const lldb_private::UnixSignals &unix_signals); | ||
|
||
std::string | ||
GetDescription(const lldb_private::UnixSignals &unix_signals) const; | ||
|
||
// Return the bytesize of the structure | ||
// 64 bit - just sizeof | ||
|
@@ -93,7 +117,7 @@ struct ELFLinuxSigInfo { | |
static size_t GetSize(const lldb_private::ArchSpec &arch); | ||
}; | ||
|
||
static_assert(sizeof(ELFLinuxSigInfo) == 12, | ||
static_assert(sizeof(ELFLinuxSigInfo) == 56, | ||
"sizeof ELFLinuxSigInfo is not correct!"); | ||
|
||
// PRPSINFO structure's size differs based on architecture. | ||
|
@@ -142,10 +166,9 @@ struct ThreadData { | |
lldb_private::DataExtractor gpregset; | ||
std::vector<lldb_private::CoreNote> notes; | ||
lldb::tid_t tid; | ||
int signo = 0; | ||
int code = 0; | ||
int prstatus_sig = 0; | ||
std::string name; | ||
ELFLinuxSigInfo siginfo; | ||
int prstatus_sig = 0; | ||
}; | ||
|
||
class ThreadElfCore : public lldb_private::Thread { | ||
|
@@ -176,16 +199,17 @@ class ThreadElfCore : public lldb_private::Thread { | |
m_thread_name.clear(); | ||
} | ||
|
||
void CreateStopFromSigInfo(const ELFLinuxSigInfo &siginfo, | ||
const lldb_private::UnixSignals &unix_signals); | ||
|
||
protected: | ||
// Member variables. | ||
std::string m_thread_name; | ||
lldb::RegisterContextSP m_thread_reg_ctx_sp; | ||
|
||
int m_signo; | ||
int m_code; | ||
|
||
lldb_private::DataExtractor m_gpregset_data; | ||
std::vector<lldb_private::CoreNote> m_notes; | ||
ELFLinuxSigInfo m_siginfo; | ||
|
||
bool CalculateStopInfo() override; | ||
}; | ||
|
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should still make an anonymous union here for if/when we add more entries that overlap like in
siginfo_t
. Since this isn't C code, we should also put the_sigfault
at the top: