mirror of
https://github.com/intel/llvm.git
synced 2026-01-29 12:53:33 +08:00
[lldb] Introduce StackFrameRecognizer [take 2]
This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345686
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/Target/StackFrameRecognizer.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
#include "lldb/Utility/RegisterValue.h"
|
||||
@@ -58,7 +59,8 @@ StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
|
||||
m_id(pc, cfa, nullptr), m_frame_code_addr(pc), m_sc(), m_flags(),
|
||||
m_frame_base(), m_frame_base_error(), m_cfa_is_valid(cfa_is_valid),
|
||||
m_stack_frame_kind(kind), m_variable_list_sp(),
|
||||
m_variable_list_value_objects(), m_disassembly(), m_mutex() {
|
||||
m_variable_list_value_objects(), m_recognized_frame_sp(), m_disassembly(),
|
||||
m_mutex() {
|
||||
// If we don't have a CFA value, use the frame index for our StackID so that
|
||||
// recursive functions properly aren't confused with one another on a history
|
||||
// stack.
|
||||
@@ -82,7 +84,8 @@ StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
|
||||
m_frame_code_addr(pc), m_sc(), m_flags(), m_frame_base(),
|
||||
m_frame_base_error(), m_cfa_is_valid(true),
|
||||
m_stack_frame_kind(StackFrame::Kind::Regular), m_variable_list_sp(),
|
||||
m_variable_list_value_objects(), m_disassembly(), m_mutex() {
|
||||
m_variable_list_value_objects(), m_recognized_frame_sp(), m_disassembly(),
|
||||
m_mutex() {
|
||||
if (sc_ptr != nullptr) {
|
||||
m_sc = *sc_ptr;
|
||||
m_flags.Set(m_sc.GetResolvedMask());
|
||||
@@ -107,7 +110,8 @@ StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx,
|
||||
m_frame_code_addr(pc_addr), m_sc(), m_flags(), m_frame_base(),
|
||||
m_frame_base_error(), m_cfa_is_valid(true),
|
||||
m_stack_frame_kind(StackFrame::Kind::Regular), m_variable_list_sp(),
|
||||
m_variable_list_value_objects(), m_disassembly(), m_mutex() {
|
||||
m_variable_list_value_objects(), m_recognized_frame_sp(), m_disassembly(),
|
||||
m_mutex() {
|
||||
if (sc_ptr != nullptr) {
|
||||
m_sc = *sc_ptr;
|
||||
m_flags.Set(m_sc.GetResolvedMask());
|
||||
@@ -1952,3 +1956,11 @@ bool StackFrame::GetStatus(Stream &strm, bool show_frame_info, bool show_source,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
RecognizedStackFrameSP StackFrame::GetRecognizedFrame() {
|
||||
if (!m_recognized_frame_sp) {
|
||||
m_recognized_frame_sp =
|
||||
StackFrameRecognizerManager::RecognizeFrame(CalculateStackFrame());
|
||||
}
|
||||
return m_recognized_frame_sp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user