[Lldb-commits] [lldb] r111877 - in /lldb/trunk: include/lldb/Core/ include/lldb/Symbol/ include/lldb/Target/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Symbol/ source/Target/
Greg Clayton
gclayton at apple.com
Mon Aug 23 17:45:41 PDT 2010
Author: gclayton
Date: Mon Aug 23 19:45:41 2010
New Revision: 111877
URL: http://llvm.org/viewvc/llvm-project?rev=111877&view=rev
Log:
Added support for inlined stack frames being represented as real stack frames
which is now on by default. Frames are gotten from the unwinder as concrete
frames, then if inline frames are to be shown, extra information to track
and reconstruct these frames is cached with each Thread and exanded as needed.
I added an inline height as part of the lldb_private::StackID class, the class
that helps us uniquely identify stack frames. This allows for two frames to
shared the same call frame address, yet differ only in inline height.
Fixed setting breakpoint by address to not require addresses to resolve.
A quick example:
% cat main.cpp
% ./build/Debug/lldb test/stl/a.out
Current executable set to 'test/stl/a.out' (x86_64).
(lldb) breakpoint set --address 0x0000000100000d31
Breakpoint created: 1: address = 0x0000000100000d31, locations = 1
(lldb) r
Launching 'a.out' (x86_64)
(lldb) Process 38031 Stopped
* thread #1: tid = 0x2e03, pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280, stop reason = breakpoint 1.1, queue = com.apple.main-thread
277
278 _CharT*
279 _M_data() const
280 -> { return _M_dataplus._M_p; }
281
282 _CharT*
283 _M_data(_CharT* __p)
(lldb) bt
thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread
frame #0: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280
frame #1: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_rep() const at /usr/include/c++/4.2.1/bits/basic_string.h:288
frame #2: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::size() const at /usr/include/c++/4.2.1/bits/basic_string.h:606
frame #3: pc = 0x0000000100000d31, where = a.out`main [inlined] operator<< <char, std::char_traits<char>, std::allocator<char> > at /usr/include/c++/4.2.1/bits/basic_string.h:2414
frame #4: pc = 0x0000000100000d31, where = a.out`main + 33 at /Volumes/work/gclayton/Documents/src/lldb/test/stl/main.cpp:14
frame #5: pc = 0x0000000100000d08, where = a.out`start + 52
Each inline frame contains only the variables that they contain and each inlined
stack frame is treated as a single entity.
Modified:
lldb/trunk/include/lldb/Core/VMRange.h
lldb/trunk/include/lldb/Symbol/Block.h
lldb/trunk/include/lldb/Symbol/Function.h
lldb/trunk/include/lldb/Symbol/SymbolContext.h
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/include/lldb/Target/StackID.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/source/API/SBBlock.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Commands/CommandObjectImage.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectVariable.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Core/VMRange.cpp
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/trunk/source/Symbol/Block.cpp
lldb/trunk/source/Symbol/Function.cpp
lldb/trunk/source/Symbol/SymbolContext.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/StackID.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp
Modified: lldb/trunk/include/lldb/Core/VMRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/VMRange.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/VMRange.h (original)
+++ lldb/trunk/include/lldb/Core/VMRange.h Mon Aug 23 19:45:41 2010
@@ -148,6 +148,11 @@
static bool
ContainsRange(const VMRange::collection& coll, const VMRange& range);
+ // Returns a valid index into coll when a match is found, else UINT32_MAX
+ // is returned
+ static uint32_t
+ FindRangeIndexThatContainsValue (const VMRange::collection& coll, lldb::addr_t value);
+
protected:
lldb::addr_t m_base_addr;
lldb::addr_t m_byte_size;
Modified: lldb/trunk/include/lldb/Symbol/Block.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Block.h (original)
+++ lldb/trunk/include/lldb/Symbol/Block.h Mon Aug 23 19:45:41 2010
@@ -181,6 +181,9 @@
//------------------------------------------------------------------
Block *
GetParent () const;
+
+ Block *
+ GetInlinedParent () const;
//------------------------------------------------------------------
/// Get the sibling block for this block.
@@ -243,6 +246,11 @@
/// If \b true, all variables from all parent blocks will be
/// added to the variable list.
///
+ /// @param[in] stop_if_block_is_inlined_function
+ /// If \b true, all variables from all parent blocks will be
+ /// added to the variable list until there are no parent blocks
+ /// or the parent block has inlined function info.
+ ///
/// @param[in/out] variable_list
/// All variables in this block, and optionally all parent
/// blocks will be added to this list.
@@ -252,7 +260,10 @@
/// variable_list.
//------------------------------------------------------------------
uint32_t
- AppendVariables(bool can_create, bool get_parent_variables, VariableList *variable_list);
+ AppendVariables (bool can_create,
+ bool get_parent_variables,
+ bool stop_if_block_is_inlined_function,
+ VariableList *variable_list);
//------------------------------------------------------------------
/// Get accessor for any inlined function information.
@@ -352,6 +363,10 @@
Block *
FindBlockByID (lldb::user_id_t block_id);
+ bool
+ GetRangeContainingAddress (const Address& addr, AddressRange &range);
+
+
protected:
typedef std::vector<lldb::BlockSP> collection;
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Symbol/Function.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Function.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Function.h (original)
+++ lldb/trunk/include/lldb/Symbol/Function.h Mon Aug 23 19:45:41 2010
@@ -241,6 +241,9 @@
void
DumpStopContext (Stream *s) const;
+ const ConstString &
+ GetName () const;
+
//------------------------------------------------------------------
/// Get accessor for the call site declaration information.
///
Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Mon Aug 23 19:45:41 2010
@@ -163,7 +163,8 @@
DumpStopContext (Stream *s,
ExecutionContextScope *exe_scope,
const Address &so_addr,
- bool show_module = true) const;
+ bool show_module,
+ bool show_inlined_frames) const;
//------------------------------------------------------------------
/// Get the address range contained within a symbol context.
@@ -190,6 +191,10 @@
lldb::DescriptionLevel level,
Process *process) const;
+ uint32_t
+ GetResolvedMask () const;
+
+
//------------------------------------------------------------------
/// Find a function matching the given name, working out from this
/// symbol context.
Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Mon Aug 23 19:45:41 2010
@@ -27,15 +27,15 @@
namespace lldb_private {
class StackFrame :
- public UserID,
public ExecutionContextScope
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- StackFrame (lldb::user_id_t frame_idx, Thread &thread, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr = NULL);
- StackFrame (lldb::user_id_t frame_idx, Thread &thread, lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr = NULL);
+ StackFrame (lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, Thread &thread, lldb::addr_t cfa, uint32_t inline_height, lldb::addr_t pc, const SymbolContext *sc_ptr);
+ StackFrame (lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, Thread &thread, const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, uint32_t inline_height, lldb::addr_t pc, const SymbolContext *sc_ptr);
+ StackFrame (lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, Thread &thread, const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa, uint32_t inline_height, const Address& pc, const SymbolContext *sc_ptr);
virtual ~StackFrame ();
Thread &
@@ -64,6 +64,12 @@
RegisterContext *
GetRegisterContext ();
+ const lldb::RegisterContextSP &
+ GetRegisterContextSP () const
+ {
+ return m_reg_context_sp;
+ }
+
VariableList *
GetVariableList ();
@@ -79,6 +85,17 @@
void
Dump (Stream *strm, bool show_frame_index);
+ uint32_t
+ GetFrameIndex () const
+ {
+ return m_frame_index;
+ }
+
+ uint32_t
+ GetConcreteFrameIndex () const
+ {
+ return m_concrete_frame_index;
+ }
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
@@ -108,6 +125,8 @@
// For StackFrame only
//------------------------------------------------------------------
Thread &m_thread;
+ uint32_t m_frame_index;
+ uint32_t m_concrete_frame_index;
lldb::RegisterContextSP m_reg_context_sp;
StackID m_id;
Address m_pc; // PC as a section/offset address
Modified: lldb/trunk/include/lldb/Target/StackID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackID.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackID.h (original)
+++ lldb/trunk/include/lldb/Target/StackID.h Mon Aug 23 19:45:41 2010
@@ -26,20 +26,34 @@
// Constructors and Destructors
//------------------------------------------------------------------
StackID ();
- explicit StackID (lldb::addr_t cfa);
- StackID (const Address& start_address, lldb::addr_t cfa);
+ explicit StackID (lldb::addr_t cfa, uint32_t inline_id);
+ StackID (const Address& start_address, lldb::addr_t cfa, uint32_t inline_id);
StackID (const StackID& rhs);
virtual ~StackID();
const Address&
- GetStartAddress() const;
+ GetStartAddress() const
+ {
+ return m_start_address;
+ }
void
- SetStartAddress(const Address& start_address);
+ SetStartAddress(const Address& start_address)
+ {
+ m_start_address = start_address;
+ }
lldb::addr_t
- GetCallFrameAddress() const;
-
+ GetCallFrameAddress() const
+ {
+ return m_cfa;
+ }
+
+ uint32_t
+ GetInlineHeight () const
+ {
+ return m_inline_height;
+ }
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
@@ -53,7 +67,10 @@
Address m_start_address; // The address range for the function for this frame
lldb::addr_t m_cfa; // The call frame address (stack pointer) value
// at the beginning of the function that uniquely
- // identifies this frame
+ // identifies this frame (along with m_inline_height below)
+ uint32_t m_inline_height; // The inline height of a stack frame. Zero is the actual
+ // value for the place where a thread stops, 1 and above
+ // are for the inlined frames above the concrete base frame.
};
bool operator== (const StackID& lhs, const StackID& rhs);
Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Mon Aug 23 19:45:41 2010
@@ -328,7 +328,8 @@
virtual void
ClearStackFrames ()
{
- m_frames.Clear();
+ m_concrete_frames.Clear();
+ m_inlined_frames.Clear();
}
void
@@ -665,6 +666,13 @@
virtual lldb_private::Unwind *
GetUnwinder () = 0;
+ typedef struct InlinedFrameInfo
+ {
+ uint32_t concrete_frame_index;
+ uint32_t inline_height;
+ Block *block;
+ } InlinedFrameInfo;
+ typedef std::vector<InlinedFrameInfo> InlinedFrameInfoCollection;
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
//------------------------------------------------------------------
@@ -678,9 +686,11 @@
plan_stack m_immediate_plan_stack; ///< The plans that need to get executed before any other work gets done.
plan_stack m_completed_plan_stack; ///< Plans that have been completed by this stop. They get deleted when the thread resumes.
plan_stack m_discarded_plan_stack; ///< Plans that have been discarded by this stop. They get deleted when the thread resumes.
- mutable Mutex m_state_mutex; ///< Multithreaded protection for m_state.
- StackFrameList m_frames; ///< The stack frames that get lazily populated after a thread stops.
- uint32_t m_current_frame_idx;///< The current frame for this thread
+ mutable Mutex m_state_mutex; ///< Multithreaded protection for m_state.
+ StackFrameList m_concrete_frames; ///< The stack frames that get lazily populated after a thread stops.
+ StackFrameList m_inlined_frames; ///< The stack frames that get lazily populated after a thread stops.
+ InlinedFrameInfoCollection m_inlined_frame_info;
+ bool m_show_inlined_frames;
int m_resume_signal; ///< The signal that should be used when continuing this thread.
lldb::StateType m_resume_state; ///< The state that indicates what this thread should do when the process is resumed.
std::auto_ptr<lldb_private::Unwind> m_unwinder_ap;
Modified: lldb/trunk/source/API/SBBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBlock.cpp (original)
+++ lldb/trunk/source/API/SBBlock.cpp Mon Aug 23 19:45:41 2010
@@ -39,7 +39,8 @@
{
if (IsValid())
{
- m_opaque_ptr->AppendVariables (can_create, get_parent_variables, var_list);
+ bool show_inline = true;
+ m_opaque_ptr->AppendVariables (can_create, get_parent_variables, show_inline, var_list);
}
}
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Mon Aug 23 19:45:41 2010
@@ -116,7 +116,7 @@
SBFrame::GetFrameID () const
{
if (m_opaque_sp)
- return m_opaque_sp->GetID();
+ return m_opaque_sp->GetFrameIndex ();
else
return UINT32_MAX;
}
Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Mon Aug 23 19:45:41 2010
@@ -288,7 +288,7 @@
frame_idx,
GetThreadID(),
(long long)pc);
- sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress());
+ sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress(), true, false);
fprintf (out, "\n");
success = true;
}
Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Mon Aug 23 19:45:41 2010
@@ -285,7 +285,7 @@
if (level == lldb::eDescriptionLevelFull)
{
s->PutCString("where = ");
- sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address);
+ sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, true, false);
}
else
{
Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Mon Aug 23 19:45:41 2010
@@ -341,7 +341,7 @@
strm.PutCString(" in ");
}
}
- sc.DumpStopContext(&strm, interpreter.GetDebugger().GetExecutionContext().process, sc.line_entry.range.GetBaseAddress());
+ sc.DumpStopContext(&strm, interpreter.GetDebugger().GetExecutionContext().process, sc.line_entry.range.GetBaseAddress(), true, false);
}
}
strm.IndentLess ();
Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Mon Aug 23 19:45:41 2010
@@ -162,7 +162,7 @@
true, // Dump the stop reason?
true, // Dump the thread name?
true, // Dump the queue name?
- 0); // Dump info for stack frame zero
+ num_frames > 1 ? UINT32_MAX : first_frame); // Dump info for the first stack frame if we are showing only on frame
strm.EOL();
strm.IndentMore();
Modified: lldb/trunk/source/Commands/CommandObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectVariable.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectVariable.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectVariable.cpp Mon Aug 23 19:45:41 2010
@@ -255,7 +255,7 @@
s.Printf ("Variable{0x%8.8x}: ", variable->GetID());
if (!expr_success)
- s.Printf ("%s = ERROR (%s)", variable->GetName().AsCString(NULL), expr_error.AsCString());
+ s.Printf ("%s = ERROR: %s\n", variable->GetName().AsCString(NULL), expr_error.AsCString());
else
{
Value::ValueType expr_value_type = expr_result.GetValueType();
@@ -318,8 +318,8 @@
}
break;
}
+ s.EOL();
}
- s.EOL();
}
}
@@ -484,9 +484,10 @@
{
VariableList variable_list;
+ bool show_inlined = true; // TODO: Get this from the process
SymbolContext frame_sc = exe_ctx.frame->GetSymbolContext (eSymbolContextEverything);
if (exe_ctx.frame && frame_sc.block)
- frame_sc.block->AppendVariables(true, true, &variable_list);
+ frame_sc.block->AppendVariables(true, true, show_inlined, &variable_list);
VariableSP var_sp;
ValueObjectSP valobj_sp;
//ValueObjectList &valobj_list = exe_ctx.frame->GetValueObjectList();
Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Mon Aug 23 19:45:41 2010
@@ -553,7 +553,7 @@
#endif
Address cstr_addr(*this);
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
- func_sc.DumpStopContext(s, exe_scope, so_addr, true);
+ func_sc.DumpStopContext(s, exe_scope, so_addr, true, false);
if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
{
#if VERBOSE_OUTPUT
@@ -636,7 +636,7 @@
if (pointer_sc.function || pointer_sc.symbol)
{
s->PutCString(": ");
- pointer_sc.DumpStopContext(s, exe_scope, so_addr, false);
+ pointer_sc.DumpStopContext(s, exe_scope, so_addr, false, false);
}
}
}
@@ -675,7 +675,7 @@
{
// We have a function or a symbol from the same
// sections as this address.
- sc.DumpStopContext(s, exe_scope, *this, show_module);
+ sc.DumpStopContext(s, exe_scope, *this, show_module, false);
}
else
{
Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Mon Aug 23 19:45:41 2010
@@ -238,7 +238,7 @@
if (offset != 0)
strm.EOL();
- sc.DumpStopContext(&strm, process, addr);
+ sc.DumpStopContext(&strm, process, addr, true, false);
if (sc.comp_unit && sc.line_entry.IsValid())
{
Modified: lldb/trunk/source/Core/VMRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/VMRange.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Core/VMRange.cpp (original)
+++ lldb/trunk/source/Core/VMRange.cpp Mon Aug 23 19:45:41 2010
@@ -40,6 +40,17 @@
return false;
}
+uint32_t
+VMRange::FindRangeIndexThatContainsValue (const VMRange::collection& coll, lldb::addr_t value)
+{
+ ValueInRangeUnaryPredicate in_range_predicate(value);
+ VMRange::const_iterator begin = coll.begin();
+ VMRange::const_iterator end = coll.end();
+ VMRange::const_iterator pos = std::find_if (begin, end, in_range_predicate);
+ if (pos != end)
+ return std::distance (begin, pos);
+ return UINT32_MAX;
+}
void
VMRange::Dump(Stream *s, lldb::addr_t offset, uint32_t addr_width) const
Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Mon Aug 23 19:45:41 2010
@@ -791,7 +791,7 @@
}
}
if (error_ptr)
- error_ptr->SetErrorStringWithFormat("Out of scope.\n", pc);
+ error_ptr->SetErrorStringWithFormat("Out of scope.");
return false;
}
@@ -995,7 +995,7 @@
// 1 - uint8_t that specifies the size of the data to dereference.
// DESCRIPTION: Behaves like the DW_OP_xderef operation: the entry at
// the top of the stack is treated as an address. The second stack
- // entry is treated as an âaddress space identifierâ for those
+ // entry is treated as an "address space identifier" for those
// architectures that support multiple address spaces. The top two
// stack elements are popped, a data item is retrieved through an
// implementation-defined address calculation and pushed as the new
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLibUnwind.cpp Mon Aug 23 19:45:41 2010
@@ -65,7 +65,7 @@
RegisterContext *
UnwindLibUnwind::CreateRegisterContextForFrame (StackFrame *frame)
{
- uint32_t idx = frame->GetID();
+ uint32_t idx = frame->GetConcreteFrameIndex ();
const uint32_t frame_count = GetFrameCount();
if (idx < frame_count)
return new LibUnwindRegisterContext (m_thread, frame, m_cursors[idx]);
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp Mon Aug 23 19:45:41 2010
@@ -66,7 +66,7 @@
RegisterContext *
UnwindMacOSXFrameBackchain::CreateRegisterContextForFrame (StackFrame *frame)
{
- uint32_t idx = frame->GetID();
+ uint32_t idx = frame->GetConcreteFrameIndex ();
const uint32_t frame_count = GetFrameCount();
if (idx < frame_count)
return new RegisterContextMacOSXFrameBackchain (m_thread, frame, m_cursors[idx]);
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Mon Aug 23 19:45:41 2010
@@ -177,11 +177,11 @@
uint32_t frame_idx = 0;
if (frame)
- frame_idx = frame->GetID();
+ frame_idx = frame->GetFrameIndex ();
if (frame_idx == 0)
return new GDBRemoteRegisterContext (*this, frame, GetGDBProcess().m_register_info, read_all_registers_at_once);
- else if (m_unwinder_ap.get() && frame_idx < m_unwinder_ap->GetFrameCount())
+ else if (m_unwinder_ap.get())
return m_unwinder_ap->CreateRegisterContextForFrame (frame);
return NULL;
}
Modified: lldb/trunk/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Block.cpp (original)
+++ lldb/trunk/source/Symbol/Block.cpp Mon Aug 23 19:45:41 2010
@@ -225,6 +225,52 @@
return NULL;
}
+Block *
+Block::GetInlinedParent () const
+{
+ Block *parent_block = GetParent ();
+ if (parent_block)
+ {
+ if (parent_block->InlinedFunctionInfo())
+ return parent_block;
+ else
+ return parent_block->GetInlinedParent();
+ }
+ return NULL;
+}
+
+
+bool
+Block::GetRangeContainingAddress (const Address& addr, AddressRange &range)
+{
+ SymbolContext sc;
+ CalculateSymbolContext(&sc);
+ if (sc.function)
+ {
+ const AddressRange &func_range = sc.function->GetAddressRange();
+ if (addr.GetSection() == func_range.GetBaseAddress().GetSection())
+ {
+ const addr_t addr_offset = addr.GetOffset();
+ const addr_t func_offset = func_range.GetBaseAddress().GetOffset();
+ if (addr_offset >= func_offset && addr_offset < func_offset + func_range.GetByteSize())
+ {
+ addr_t offset = addr_offset - func_offset;
+
+ uint32_t range_idx = VMRange::FindRangeIndexThatContainsValue (m_ranges, offset);
+ if (range_idx < m_ranges.size())
+ {
+ range.GetBaseAddress() = func_range.GetBaseAddress();
+ range.GetBaseAddress().SetOffset(func_offset + m_ranges[range_idx].GetBaseAddress());
+ range.SetByteSize(m_ranges[range_idx].GetByteSize());
+ return true;
+ }
+ }
+ }
+ }
+ range.Clear();
+ return false;
+}
+
void
Block::AddRange(addr_t start_offset, addr_t end_offset)
{
@@ -330,22 +376,32 @@
}
uint32_t
-Block::AppendVariables (bool can_create, bool get_parent_variables, VariableList *variable_list)
+Block::AppendVariables
+(
+ bool can_create,
+ bool get_parent_variables,
+ bool stop_if_block_is_inlined_function,
+ VariableList *variable_list
+)
{
uint32_t num_variables_added = 0;
VariableListSP variable_list_sp(GetVariableList(false, can_create));
+ bool is_inlined_function = InlinedFunctionInfo() != NULL;
if (variable_list_sp.get())
{
num_variables_added = variable_list_sp->GetSize();
variable_list->AddVariables(variable_list_sp.get());
}
-
+
if (get_parent_variables)
{
+ if (stop_if_block_is_inlined_function && is_inlined_function)
+ return num_variables_added;
+
Block* parent_block = GetParent();
if (parent_block)
- num_variables_added += parent_block->AppendVariables (can_create, get_parent_variables, variable_list);
+ num_variables_added += parent_block->AppendVariables (can_create, get_parent_variables, stop_if_block_is_inlined_function, variable_list);
}
return num_variables_added;
}
Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Mon Aug 23 19:45:41 2010
@@ -148,6 +148,16 @@
s->PutCString (m_name.AsCString());
}
+
+const ConstString &
+InlineFunctionInfo::GetName () const
+{
+ if (m_mangled)
+ return m_mangled.GetName();
+ return m_name;
+}
+
+
Declaration &
InlineFunctionInfo::GetCallSite ()
{
Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Mon Aug 23 19:45:41 2010
@@ -114,7 +114,8 @@
Stream *s,
ExecutionContextScope *exe_scope,
const Address &addr,
- bool show_module
+ bool show_module,
+ bool show_inlined_frames
) const
{
if (show_module && module_sp)
@@ -127,6 +128,30 @@
if (function->GetMangled().GetName())
function->GetMangled().GetName().Dump(s);
+
+ if (show_inlined_frames && block)
+ {
+ InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
+ if (inline_info == NULL)
+ {
+ Block *parent_inline_block = block->GetInlinedParent();
+ if (parent_inline_block)
+ inline_info = parent_inline_block->InlinedFunctionInfo();
+ }
+
+ if (inline_info)
+ {
+ s->PutCString(" [inlined] ");
+ inline_info->GetName().Dump(s);
+
+ if (line_entry.IsValid())
+ {
+ s->PutCString(" at ");
+ line_entry.DumpStopContext(s);
+ }
+ return;
+ }
+ }
const addr_t function_offset = addr.GetOffset() - function->GetAddressRange().GetBaseAddress().GetOffset();
if (function_offset)
s->Printf(" + %llu", function_offset);
@@ -237,6 +262,19 @@
}
}
+uint32_t
+SymbolContext::GetResolvedMask () const
+{
+ uint32_t resolved_mask = 0;
+ if (target_sp) resolved_mask |= eSymbolContextTarget;
+ if (module_sp) resolved_mask |= eSymbolContextModule;
+ if (comp_unit) resolved_mask |= eSymbolContextCompUnit;
+ if (function) resolved_mask |= eSymbolContextFunction;
+ if (block) resolved_mask |= eSymbolContextBlock;
+ if (line_entry.IsValid()) resolved_mask |= eSymbolContextLineEntry;
+ if (symbol) resolved_mask |= eSymbolContextSymbol;
+ return resolved_mask;
+}
void
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Mon Aug 23 19:45:41 2010
@@ -35,38 +35,118 @@
#define FRAME_IS_OBSOLETE (GOT_FRAME_BASE << 1)
#define RESOLVED_VARIABLES (FRAME_IS_OBSOLETE << 1)
-StackFrame::StackFrame (lldb::user_id_t frame_idx, Thread &thread, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr) :
- UserID (frame_idx),
+StackFrame::StackFrame
+(
+ lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_index,
+ Thread &thread,
+ lldb::addr_t cfa,
+ uint32_t inline_height,
+ lldb::addr_t pc,
+ const SymbolContext *sc_ptr
+) :
+ m_frame_index (frame_idx),
+ m_concrete_frame_index (concrete_frame_index),
m_thread (thread),
- m_reg_context_sp(),
- m_id(cfa),
- m_pc(NULL, pc),
- m_sc(),
- m_flags(),
- m_frame_base(),
- m_frame_base_error(),
+ m_reg_context_sp (),
+ m_id (cfa, inline_height),
+ m_pc (NULL, pc),
+ m_sc (),
+ m_flags (),
+ m_frame_base (),
+ m_frame_base_error (),
m_variable_list_sp (),
m_value_object_list ()
{
if (sc_ptr != NULL)
+ {
m_sc = *sc_ptr;
+ m_flags.Set(m_sc.GetResolvedMask ());
+ }
}
-StackFrame::StackFrame (lldb::user_id_t frame_idx, Thread &thread, RegisterContextSP ®_context_sp, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr) :
- UserID (frame_idx),
+StackFrame::StackFrame
+(
+ lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_index,
+ Thread &thread,
+ const RegisterContextSP ®_context_sp,
+ lldb::addr_t cfa,
+ uint32_t inline_height,
+ lldb::addr_t pc,
+ const SymbolContext *sc_ptr
+) :
+ m_frame_index (frame_idx),
+ m_concrete_frame_index (concrete_frame_index),
m_thread (thread),
- m_reg_context_sp(reg_context_sp),
- m_id(cfa),
- m_pc(NULL, pc),
- m_sc(),
- m_flags(),
- m_frame_base(),
- m_frame_base_error(),
+ m_reg_context_sp (reg_context_sp),
+ m_id (cfa, inline_height),
+ m_pc (NULL, pc),
+ m_sc (),
+ m_flags (),
+ m_frame_base (),
+ m_frame_base_error (),
m_variable_list_sp (),
m_value_object_list ()
{
if (sc_ptr != NULL)
+ {
m_sc = *sc_ptr;
+ m_flags.Set(m_sc.GetResolvedMask ());
+ }
+
+ if (reg_context_sp && !m_sc.target_sp)
+ {
+ m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().GetSP();
+ m_flags.Set (eSymbolContextTarget);
+ }
+}
+
+StackFrame::StackFrame
+(
+ lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_index,
+ Thread &thread,
+ const RegisterContextSP ®_context_sp,
+ lldb::addr_t cfa,
+ uint32_t inline_height,
+ const Address& pc_addr,
+ const SymbolContext *sc_ptr
+) :
+ m_frame_index (frame_idx),
+ m_concrete_frame_index (concrete_frame_index),
+ m_thread (thread),
+ m_reg_context_sp (reg_context_sp),
+ m_id (cfa, inline_height),
+ m_pc (pc_addr),
+ m_sc (),
+ m_flags (),
+ m_frame_base (),
+ m_frame_base_error (),
+ m_variable_list_sp (),
+ m_value_object_list ()
+{
+ if (sc_ptr != NULL)
+ {
+ m_sc = *sc_ptr;
+ m_flags.Set(m_sc.GetResolvedMask ());
+ }
+
+ if (m_sc.target_sp.get() == NULL && reg_context_sp)
+ {
+ m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().GetSP();
+ m_flags.Set (eSymbolContextTarget);
+ }
+
+ if (m_sc.module_sp.get() == NULL && pc_addr.GetSection())
+ {
+ Module *pc_module = pc_addr.GetSection()->GetModule();
+ if (pc_module)
+ {
+ m_sc.module_sp = pc_module->GetSP();
+ m_flags.Set (eSymbolContextModule);
+ }
+ }
}
@@ -213,7 +293,7 @@
// instruction following the function call instruction...
Address lookup_addr(GetPC());
- if (GetID() > 0 && lookup_addr.IsValid())
+ if (m_frame_index > 0 && lookup_addr.IsValid())
{
addr_t offset = lookup_addr.GetOffset();
if (offset > 0)
@@ -225,11 +305,65 @@
// We have something in our stack frame symbol context, lets check
// if we haven't already tried to lookup one of those things. If we
// haven't then we will do the query.
- if ((m_sc.comp_unit == NULL && (resolve_scope & eSymbolContextCompUnit ) && m_flags.IsClear(eSymbolContextCompUnit )) ||
- (m_sc.function == NULL && (resolve_scope & eSymbolContextFunction ) && m_flags.IsClear(eSymbolContextFunction )) ||
- (m_sc.block == NULL && (resolve_scope & eSymbolContextBlock ) && m_flags.IsClear(eSymbolContextBlock )) ||
- (m_sc.symbol == NULL && (resolve_scope & eSymbolContextSymbol ) && m_flags.IsClear(eSymbolContextSymbol )) ||
- (!m_sc.line_entry.IsValid() && (resolve_scope & eSymbolContextLineEntry) && m_flags.IsClear(eSymbolContextLineEntry )))
+
+ uint32_t actual_resolve_scope = 0;
+
+ if (resolve_scope & eSymbolContextCompUnit)
+ {
+ if (m_flags.IsClear (eSymbolContextCompUnit))
+ {
+ if (m_sc.comp_unit)
+ m_flags.Set (eSymbolContextCompUnit);
+ else
+ actual_resolve_scope |= eSymbolContextCompUnit;
+ }
+ }
+
+ if (resolve_scope & eSymbolContextFunction)
+ {
+ if (m_flags.IsClear (eSymbolContextFunction))
+ {
+ if (m_sc.function)
+ m_flags.Set (eSymbolContextFunction);
+ else
+ actual_resolve_scope |= eSymbolContextFunction;
+ }
+ }
+
+ if (resolve_scope & eSymbolContextBlock)
+ {
+ if (m_flags.IsClear (eSymbolContextBlock))
+ {
+ if (m_sc.block)
+ m_flags.Set (eSymbolContextBlock);
+ else
+ actual_resolve_scope |= eSymbolContextBlock;
+ }
+ }
+
+ if (resolve_scope & eSymbolContextSymbol)
+ {
+ if (m_flags.IsClear (eSymbolContextSymbol))
+ {
+ if (m_sc.symbol)
+ m_flags.Set (eSymbolContextSymbol);
+ else
+ actual_resolve_scope |= eSymbolContextSymbol;
+ }
+ }
+
+ if (resolve_scope & eSymbolContextLineEntry)
+ {
+ if (m_flags.IsClear (eSymbolContextLineEntry))
+ {
+ if (m_sc.line_entry.IsValid())
+ m_flags.Set (eSymbolContextLineEntry);
+ else
+ actual_resolve_scope |= eSymbolContextLineEntry;
+ }
+ }
+
+ if (actual_resolve_scope)
{
// We might be resolving less information than what is already
// in our current symbol context so resolve into a temporary
@@ -237,7 +371,10 @@
// already found in "m_sc"
SymbolContext sc;
// Set flags that indicate what we have tried to resolve
- const uint32_t resolved = m_sc.module_sp->ResolveSymbolContextForAddress (lookup_addr, resolve_scope, sc);
+ const uint32_t resolved = m_sc.module_sp->ResolveSymbolContextForAddress (lookup_addr, actual_resolve_scope, sc);
+ // Only replace what we didn't already have as we may have
+ // information for an inlined function scope that won't match
+ // what a standard lookup by address would match
if (resolved & eSymbolContextCompUnit) m_sc.comp_unit = sc.comp_unit;
if (resolved & eSymbolContextFunction) m_sc.function = sc.function;
if (resolved & eSymbolContextBlock) m_sc.block = sc.block;
@@ -387,10 +524,13 @@
return;
if (show_frame_index)
- strm->Printf("frame #%u: ", GetID());
+ strm->Printf("frame #%u: ", m_frame_index);
strm->Printf("pc = 0x%0*llx", m_thread.GetProcess().GetAddressByteSize() * 2, GetRegisterContext()->GetPC());
SymbolContext sc (GetSymbolContext(eSymbolContextEverything));
strm->PutCString(", where = ");
- sc.DumpStopContext(strm, &m_thread.GetProcess(), GetPC());
+ // TODO: need to get the
+ const bool show_module = true;
+ const bool show_inline = true;
+ sc.DumpStopContext(strm, &m_thread.GetProcess(), GetPC(), show_module, show_inline);
}
Modified: lldb/trunk/source/Target/StackID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackID.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackID.cpp (original)
+++ lldb/trunk/source/Target/StackID.cpp Mon Aug 23 19:45:41 2010
@@ -21,22 +21,25 @@
//----------------------------------------------------------------------
StackID::StackID() :
m_start_address(),
- m_cfa()
+ m_cfa (0),
+ m_inline_height (0)
{
}
//----------------------------------------------------------------------
// StackID constructor with args
//----------------------------------------------------------------------
-StackID::StackID (const Address& start_address, lldb::addr_t cfa) :
+StackID::StackID (const Address& start_address, lldb::addr_t cfa, uint32_t inline_id) :
m_start_address (start_address),
- m_cfa (cfa)
+ m_cfa (cfa),
+ m_inline_height (inline_id)
{
}
-StackID::StackID (lldb::addr_t cfa) :
+StackID::StackID (lldb::addr_t cfa, uint32_t inline_id) :
m_start_address (),
- m_cfa (cfa)
+ m_cfa (cfa),
+ m_inline_height (inline_id)
{
}
@@ -45,7 +48,8 @@
//----------------------------------------------------------------------
StackID::StackID(const StackID& rhs) :
m_start_address (rhs.m_start_address),
- m_cfa (rhs.m_cfa)
+ m_cfa (rhs.m_cfa),
+ m_inline_height (rhs.m_inline_height)
{
}
@@ -59,6 +63,7 @@
{
m_start_address = rhs.m_start_address;
m_cfa = rhs.m_cfa;
+ m_inline_height = rhs.m_inline_height;
}
return *this;
}
@@ -70,36 +75,20 @@
{
}
-
-const Address&
-StackID::GetStartAddress() const
-{
- return m_start_address;
-}
-
-void
-StackID::SetStartAddress(const Address& start_address)
-{
- m_start_address = start_address;
-}
-
-lldb::addr_t
-StackID::GetCallFrameAddress() const
-{
- return m_cfa;
-}
-
-
bool
lldb_private::operator== (const StackID& lhs, const StackID& rhs)
{
- return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() && lhs.GetStartAddress() == rhs.GetStartAddress();
+ return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() &&
+ lhs.GetInlineHeight() == rhs.GetInlineHeight() &&
+ lhs.GetStartAddress() == rhs.GetStartAddress();
}
bool
lldb_private::operator!= (const StackID& lhs, const StackID& rhs)
{
- return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() || lhs.GetStartAddress() != rhs.GetStartAddress();
+ return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() ||
+ lhs.GetInlineHeight() != rhs.GetInlineHeight() ||
+ lhs.GetStartAddress() != rhs.GetStartAddress();
}
bool
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Aug 23 19:45:41 2010
@@ -156,16 +156,22 @@
BreakpointSP
-Target::CreateBreakpoint (lldb::addr_t load_addr, bool internal)
+Target::CreateBreakpoint (lldb::addr_t addr, bool internal)
{
- BreakpointSP bp_sp;
Address so_addr;
// Attempt to resolve our load address if possible, though it is ok if
// it doesn't resolve to section/offset.
Process *process = GetProcessSP().get();
- if (process && process->ResolveLoadAddress(load_addr, so_addr))
- bp_sp = CreateBreakpoint(so_addr, internal);
+ // Try and resolve as a load address if possible
+ if (process)
+ process->ResolveLoadAddress(addr, so_addr);
+ if (!so_addr.IsValid())
+ {
+ // The address didn't resolve, so just set this as an absolute address
+ so_addr.SetOffset (addr);
+ }
+ BreakpointSP bp_sp (CreateBreakpoint(so_addr, internal));
return bp_sp;
}
Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=111877&r1=111876&r2=111877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Mon Aug 23 19:45:41 2010
@@ -49,8 +49,10 @@
m_immediate_plan_stack(),
m_completed_plan_stack(),
m_state_mutex (Mutex::eMutexTypeRecursive),
- m_frames (),
- m_current_frame_idx (0),
+ m_concrete_frames (),
+ m_inlined_frames (),
+ m_inlined_frame_info (),
+ m_show_inlined_frames (true),
m_resume_signal (LLDB_INVALID_SIGNAL_NUMBER),
m_resume_state (eStateRunning),
m_unwinder_ap ()
@@ -798,7 +800,69 @@
{
Unwind *unwinder = GetUnwinder ();
if (unwinder)
- return unwinder->GetFrameCount();
+ {
+ if (m_show_inlined_frames)
+ {
+ if (m_inlined_frame_info.empty())
+ {
+ // If we are going to show inlined stack frames as actual frames,
+ // we need to calculate all concrete frames first, then iterate
+ // through all of them and count up how many inlined functions are
+ // in each frame. We can then fill in m_inlined_frame_info with
+ // the concrete frame index and inlined depth
+ const uint32_t concrete_frame_count = unwinder->GetFrameCount();
+
+ addr_t pc, cfa;
+ InlinedFrameInfo inlined_frame_info;
+
+ StackFrameSP frame_sp;
+ for (uint32_t idx=0; idx<concrete_frame_count; ++idx)
+ {
+ if (idx == 0)
+ {
+ GetRegisterContext();
+ assert (m_reg_context_sp.get());
+ frame_sp.reset (new StackFrame (0, 0, *this, m_reg_context_sp, m_reg_context_sp->GetSP(), 0, m_reg_context_sp->GetPC(), NULL));
+ }
+ else
+ {
+ const bool success = unwinder->GetFrameInfoAtIndex(idx, cfa, pc);
+ assert (success);
+ frame_sp.reset (new StackFrame (m_inlined_frame_info.size(), idx, *this, cfa, 0, pc, NULL));
+ }
+ m_concrete_frames.SetFrameAtIndex(idx, frame_sp);
+ Block *block = frame_sp->GetSymbolContext (eSymbolContextBlock).block;
+
+ inlined_frame_info.concrete_frame_index = idx;
+ inlined_frame_info.inline_height = 0;
+ inlined_frame_info.block = block;
+ m_inlined_frame_info.push_back (inlined_frame_info);
+
+ if (block)
+ {
+ Block *inlined_block;
+ if (block->InlinedFunctionInfo())
+ inlined_block = block;
+ else
+ inlined_block = block->GetInlinedParent ();
+
+ while (inlined_block)
+ {
+ inlined_frame_info.block = inlined_block;
+ inlined_frame_info.inline_height++;
+ m_inlined_frame_info.push_back (inlined_frame_info);
+ inlined_block = inlined_block->GetInlinedParent ();
+ }
+ }
+ }
+ }
+ return m_inlined_frame_info.size();
+ }
+ else
+ {
+ return unwinder->GetFrameCount();
+ }
+ }
return 0;
}
@@ -806,7 +870,12 @@
Thread::GetStackFrameAtIndex (uint32_t idx)
{
- StackFrameSP frame_sp (m_frames.GetFrameAtIndex(idx));
+ StackFrameSP frame_sp;
+
+ if (m_show_inlined_frames)
+ frame_sp = m_inlined_frames.GetFrameAtIndex(idx);
+ else
+ frame_sp = m_concrete_frames.GetFrameAtIndex(idx);
if (frame_sp.get())
return frame_sp;
@@ -827,38 +896,95 @@
// context with the stack frame at index zero.
GetRegisterContext();
assert (m_reg_context_sp.get());
- frame_sp.reset (new StackFrame (idx, *this, m_reg_context_sp, m_reg_context_sp->GetSP(), m_reg_context_sp->GetPC()));
+ frame_sp.reset (new StackFrame (0, 0, *this, m_reg_context_sp, m_reg_context_sp->GetSP(), 0, m_reg_context_sp->GetPC(), NULL));
}
else if (idx < GetStackFrameCount())
{
- Unwind *unwinder = GetUnwinder ();
- if (unwinder)
+ if (m_show_inlined_frames)
{
- addr_t pc, cfa;
- if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc))
- frame_sp.reset (new StackFrame (idx, *this, cfa, pc));
+ if (m_inlined_frame_info[idx].inline_height == 0)
+ {
+ // Same as the concrete stack frame if block is NULL
+ frame_sp = m_concrete_frames.GetFrameAtIndex (m_inlined_frame_info[idx].concrete_frame_index);
+ }
+ else
+ {
+ // We have blocks that were above an inlined function. Inlined
+ // functions are represented as blocks with non-NULL inline
+ // function info. Here we must reconstruct a frame by looking
+ // at the block
+ StackFrameSP previous_frame_sp (GetStackFrameAtIndex (idx-1));
+
+ SymbolContext inline_sc;
+
+ Block *inlined_parent_block = m_inlined_frame_info[idx].block->GetInlinedParent();
+
+ if (inlined_parent_block)
+ inlined_parent_block->CalculateSymbolContext (&inline_sc);
+ else
+ {
+ Block *parent_block = m_inlined_frame_info[idx].block->GetParent();
+ parent_block->CalculateSymbolContext(&inline_sc);
+ }
+
+ InlineFunctionInfo* inline_info = m_inlined_frame_info[idx].block->InlinedFunctionInfo();
+ assert (inline_info);
+ inline_sc.line_entry.range.GetBaseAddress() = previous_frame_sp->GetPC();
+ inline_sc.line_entry.file = inline_info->GetCallSite().GetFile();
+ inline_sc.line_entry.line = inline_info->GetCallSite().GetLine();
+ inline_sc.line_entry.column = inline_info->GetCallSite().GetColumn();
+
+ StackFrameSP concrete_frame_sp (m_concrete_frames.GetFrameAtIndex (m_inlined_frame_info[idx].concrete_frame_index));
+ assert (previous_frame_sp.get());
+ AddressRange range;
+ m_inlined_frame_info[idx].block->GetRangeContainingAddress (previous_frame_sp->GetPC(), range);
+
+ frame_sp.reset (new StackFrame (idx,
+ m_inlined_frame_info[idx].concrete_frame_index,
+ *this,
+ concrete_frame_sp->GetRegisterContextSP (),
+ concrete_frame_sp->GetStackID().GetCallFrameAddress(), // CFA
+ m_inlined_frame_info[idx].inline_height, // Inline height
+ range.GetBaseAddress(),
+ &inline_sc)); // The symbol context for this inline frame
+
+ }
+
+ }
+ else
+ {
+ Unwind *unwinder = GetUnwinder ();
+ if (unwinder)
+ {
+ addr_t pc, cfa;
+ if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc))
+ frame_sp.reset (new StackFrame (idx, idx, *this, cfa, 0, pc, NULL));
+ }
}
}
- m_frames.SetFrameAtIndex(idx, frame_sp);
+ if (m_show_inlined_frames)
+ m_inlined_frames.SetFrameAtIndex(idx, frame_sp);
+ else
+ m_concrete_frames.SetFrameAtIndex(idx, frame_sp);
return frame_sp;
}
lldb::StackFrameSP
Thread::GetCurrentFrame ()
{
- return GetStackFrameAtIndex (m_frames.GetCurrentFrameIndex());
+ return GetStackFrameAtIndex (m_concrete_frames.GetCurrentFrameIndex());
}
uint32_t
Thread::SetCurrentFrame (lldb_private::StackFrame *frame)
{
- return m_frames.SetCurrentFrame(frame);
+ return m_concrete_frames.SetCurrentFrame(frame);
}
void
-Thread::SetCurrentFrameByIndex (uint32_t frame_idx)
+Thread::SetCurrentFrameByIndex (uint32_t idx)
{
- m_frames.SetCurrentFrameByIndex(frame_idx);
+ m_concrete_frames.SetCurrentFrameByIndex(idx);
}
void
@@ -868,14 +994,14 @@
bool show_stop_reason,
bool show_name,
bool show_queue,
- uint32_t frame_idx
+ uint32_t idx
)
{
strm.Printf("thread #%u: tid = 0x%4.4x", GetIndexID(), GetID());
- if (frame_idx != LLDB_INVALID_INDEX32)
+ if (idx != LLDB_INVALID_INDEX32)
{
- StackFrameSP frame_sp(GetStackFrameAtIndex (frame_idx));
+ StackFrameSP frame_sp(GetStackFrameAtIndex (idx));
if (frame_sp)
{
strm.PutCString(", ");
More information about the lldb-commits
mailing list