2010-06-09 00:52:24 +08:00
|
|
|
//===-- StackFrame.cpp ------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Target/StackFrame.h"
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
|
|
|
#include "lldb/Core/Module.h"
|
2010-10-04 09:05:56 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Disassembler.h"
|
|
|
|
#include "lldb/Core/Value.h"
|
2010-09-02 10:59:18 +08:00
|
|
|
#include "lldb/Core/ValueObjectVariable.h"
|
2010-12-15 13:08:08 +08:00
|
|
|
#include "lldb/Core/ValueObjectConstResult.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/Function.h"
|
2010-09-02 10:59:18 +08:00
|
|
|
#include "lldb/Symbol/VariableList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/RegisterContext.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
// The first bits in the flags are reserved for the SymbolContext::Scope bits
|
|
|
|
// so we know if we have tried to look up information in our internal symbol
|
|
|
|
// context (m_sc) already.
|
2010-08-31 02:11:35 +08:00
|
|
|
#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextEverything + 1))
|
2010-09-03 05:44:10 +08:00
|
|
|
#define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_CODE_ADDR << 1)
|
2010-08-31 02:11:35 +08:00
|
|
|
#define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
|
|
|
|
#define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1)
|
2010-11-01 12:38:59 +08:00
|
|
|
#define RESOLVED_GLOBAL_VARIABLES (RESOLVED_VARIABLES << 1)
|
2010-06-09 00:52:24 +08:00
|
|
|
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
StackFrame::StackFrame
|
|
|
|
(
|
|
|
|
lldb::user_id_t frame_idx,
|
2010-08-31 02:11:35 +08:00
|
|
|
lldb::user_id_t unwind_frame_index,
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
Thread &thread,
|
|
|
|
lldb::addr_t cfa,
|
|
|
|
lldb::addr_t pc,
|
|
|
|
const SymbolContext *sc_ptr
|
|
|
|
) :
|
2011-01-26 07:55:37 +08:00
|
|
|
m_thread (thread),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_frame_index (frame_idx),
|
2011-01-07 06:15:06 +08:00
|
|
|
m_concrete_frame_index (unwind_frame_index),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_reg_context_sp (),
|
2010-09-03 05:44:10 +08:00
|
|
|
m_id (pc, cfa, NULL),
|
2010-08-27 06:05:43 +08:00
|
|
|
m_frame_code_addr (NULL, pc),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_sc (),
|
|
|
|
m_flags (),
|
|
|
|
m_frame_base (),
|
|
|
|
m_frame_base_error (),
|
2010-06-09 00:52:24 +08:00
|
|
|
m_variable_list_sp (),
|
2011-01-26 07:55:37 +08:00
|
|
|
m_variable_list_value_objects (),
|
|
|
|
m_disassembly ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
if (sc_ptr != NULL)
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
{
|
2010-06-09 00:52:24 +08:00
|
|
|
m_sc = *sc_ptr;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_flags.Set(m_sc.GetResolvedMask ());
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
StackFrame::StackFrame
|
|
|
|
(
|
|
|
|
lldb::user_id_t frame_idx,
|
2010-08-31 02:11:35 +08:00
|
|
|
lldb::user_id_t unwind_frame_index,
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
Thread &thread,
|
|
|
|
const RegisterContextSP ®_context_sp,
|
|
|
|
lldb::addr_t cfa,
|
|
|
|
lldb::addr_t pc,
|
|
|
|
const SymbolContext *sc_ptr
|
|
|
|
) :
|
2011-01-26 07:55:37 +08:00
|
|
|
m_thread (thread),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_frame_index (frame_idx),
|
2011-01-07 06:15:06 +08:00
|
|
|
m_concrete_frame_index (unwind_frame_index),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_reg_context_sp (reg_context_sp),
|
2010-09-03 05:44:10 +08:00
|
|
|
m_id (pc, cfa, NULL),
|
2010-08-27 06:05:43 +08:00
|
|
|
m_frame_code_addr (NULL, pc),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_sc (),
|
|
|
|
m_flags (),
|
|
|
|
m_frame_base (),
|
|
|
|
m_frame_base_error (),
|
2010-06-09 00:52:24 +08:00
|
|
|
m_variable_list_sp (),
|
2011-01-26 07:55:37 +08:00
|
|
|
m_variable_list_value_objects (),
|
|
|
|
m_disassembly ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
if (sc_ptr != NULL)
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
{
|
2010-06-09 00:52:24 +08:00
|
|
|
m_sc = *sc_ptr;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
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,
|
2010-08-31 02:11:35 +08:00
|
|
|
lldb::user_id_t unwind_frame_index,
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
Thread &thread,
|
|
|
|
const RegisterContextSP ®_context_sp,
|
|
|
|
lldb::addr_t cfa,
|
|
|
|
const Address& pc_addr,
|
|
|
|
const SymbolContext *sc_ptr
|
|
|
|
) :
|
2011-01-26 07:55:37 +08:00
|
|
|
m_thread (thread),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_frame_index (frame_idx),
|
2011-01-07 06:15:06 +08:00
|
|
|
m_concrete_frame_index (unwind_frame_index),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_reg_context_sp (reg_context_sp),
|
2010-09-15 07:36:40 +08:00
|
|
|
m_id (pc_addr.GetLoadAddress (&thread.GetProcess().GetTarget()), cfa, NULL),
|
2010-08-27 06:05:43 +08:00
|
|
|
m_frame_code_addr (pc_addr),
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
m_sc (),
|
|
|
|
m_flags (),
|
|
|
|
m_frame_base (),
|
|
|
|
m_frame_base_error (),
|
|
|
|
m_variable_list_sp (),
|
2011-01-26 07:55:37 +08:00
|
|
|
m_variable_list_value_objects (),
|
|
|
|
m_disassembly ()
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-09-13 12:34:30 +08:00
|
|
|
Module *pc_module = pc_addr.GetModule();
|
|
|
|
if (m_sc.module_sp.get() == NULL || m_sc.module_sp.get() != pc_module)
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
{
|
|
|
|
if (pc_module)
|
|
|
|
{
|
|
|
|
m_sc.module_sp = pc_module->GetSP();
|
|
|
|
m_flags.Set (eSymbolContextModule);
|
|
|
|
}
|
2010-09-13 12:34:30 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_sc.module_sp.reset();
|
|
|
|
}
|
|
|
|
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
StackFrame::~StackFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
StackID&
|
|
|
|
StackFrame::GetStackID()
|
|
|
|
{
|
2010-09-03 05:44:10 +08:00
|
|
|
// Make sure we have resolved the StackID object's symbol context scope if
|
|
|
|
// we already haven't looked it up.
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-08-31 02:11:35 +08:00
|
|
|
if (m_flags.IsClear (RESOLVED_FRAME_ID_SYMBOL_SCOPE))
|
|
|
|
{
|
2010-09-04 01:10:42 +08:00
|
|
|
if (m_id.GetSymbolContextScope ())
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-09-07 12:20:48 +08:00
|
|
|
// We already have a symbol context scope, we just don't have our
|
|
|
|
// flag bit set.
|
2010-08-31 02:11:35 +08:00
|
|
|
m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
|
2010-08-25 05:05:24 +08:00
|
|
|
}
|
2010-08-31 02:11:35 +08:00
|
|
|
else
|
2010-08-25 05:05:24 +08:00
|
|
|
{
|
2010-09-07 12:20:48 +08:00
|
|
|
// Calculate the frame block and use this for the stack ID symbol
|
|
|
|
// context scope if we have one.
|
|
|
|
SymbolContextScope *scope = GetFrameBlock ();
|
|
|
|
if (scope == NULL)
|
2010-08-31 02:11:35 +08:00
|
|
|
{
|
2010-09-07 12:20:48 +08:00
|
|
|
// We don't have a block, so use the symbol
|
|
|
|
if (m_flags.IsClear (eSymbolContextSymbol))
|
|
|
|
GetSymbolContext (eSymbolContextSymbol);
|
|
|
|
|
|
|
|
// It is ok if m_sc.symbol is NULL here
|
|
|
|
scope = m_sc.symbol;
|
2010-08-31 02:11:35 +08:00
|
|
|
}
|
2010-09-07 12:20:48 +08:00
|
|
|
// Set the symbol context scope (the accessor will set the
|
|
|
|
// RESOLVED_FRAME_ID_SYMBOL_SCOPE bit in m_flags).
|
|
|
|
SetSymbolContextScope (scope);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
2010-08-31 02:11:35 +08:00
|
|
|
void
|
|
|
|
StackFrame::SetSymbolContextScope (SymbolContextScope *symbol_scope)
|
|
|
|
{
|
|
|
|
m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
|
|
|
|
m_id.SetSymbolContextScope (symbol_scope);
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
Address&
|
2010-08-25 05:05:24 +08:00
|
|
|
StackFrame::GetFrameCodeAddress()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-08-31 02:11:35 +08:00
|
|
|
if (m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR) && !m_frame_code_addr.IsSectionOffset())
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-08-31 02:11:35 +08:00
|
|
|
m_flags.Set (RESOLVED_FRAME_CODE_ADDR);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// Resolve the PC into a temporary address because if ResolveLoadAddress
|
|
|
|
// fails to resolve the address, it will clear the address object...
|
|
|
|
Address resolved_pc;
|
2010-09-15 07:36:40 +08:00
|
|
|
if (m_thread.GetProcess().GetTarget().GetSectionLoadList().ResolveLoadAddress(m_frame_code_addr.GetOffset(), resolved_pc))
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-08-27 06:05:43 +08:00
|
|
|
m_frame_code_addr = resolved_pc;
|
|
|
|
const Section *section = m_frame_code_addr.GetSection();
|
2010-06-09 00:52:24 +08:00
|
|
|
if (section)
|
|
|
|
{
|
|
|
|
Module *module = section->GetModule();
|
|
|
|
if (module)
|
|
|
|
{
|
|
|
|
m_sc.module_sp = module->GetSP();
|
|
|
|
if (m_sc.module_sp)
|
|
|
|
m_flags.Set(eSymbolContextModule);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-08-27 06:05:43 +08:00
|
|
|
return m_frame_code_addr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StackFrame::ChangePC (addr_t pc)
|
|
|
|
{
|
2010-08-27 06:05:43 +08:00
|
|
|
m_frame_code_addr.SetOffset(pc);
|
|
|
|
m_frame_code_addr.SetSection(NULL);
|
2010-06-09 00:52:24 +08:00
|
|
|
m_sc.Clear();
|
2010-10-27 11:32:59 +08:00
|
|
|
m_flags.Reset(0);
|
2010-06-09 00:52:24 +08:00
|
|
|
m_thread.ClearStackFrames ();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
StackFrame::Disassemble ()
|
|
|
|
{
|
|
|
|
if (m_disassembly.GetSize() == 0)
|
|
|
|
{
|
|
|
|
ExecutionContext exe_ctx;
|
2010-10-04 09:05:56 +08:00
|
|
|
CalculateExecutionContext(exe_ctx);
|
2010-06-23 09:19:29 +08:00
|
|
|
Target &target = m_thread.GetProcess().GetTarget();
|
|
|
|
Disassembler::Disassemble (target.GetDebugger(),
|
|
|
|
target.GetArchitecture(),
|
2011-03-26 02:03:16 +08:00
|
|
|
NULL,
|
2010-06-09 00:52:24 +08:00
|
|
|
exe_ctx,
|
|
|
|
0,
|
2011-03-22 09:48:42 +08:00
|
|
|
0,
|
2010-07-01 07:03:03 +08:00
|
|
|
false,
|
2011-03-11 07:35:12 +08:00
|
|
|
false,
|
2010-06-09 00:52:24 +08:00
|
|
|
m_disassembly);
|
|
|
|
if (m_disassembly.GetSize() == 0)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return m_disassembly.GetData();
|
|
|
|
}
|
|
|
|
|
2010-09-07 12:20:48 +08:00
|
|
|
Block *
|
|
|
|
StackFrame::GetFrameBlock ()
|
|
|
|
{
|
|
|
|
if (m_sc.block == NULL && m_flags.IsClear (eSymbolContextBlock))
|
|
|
|
GetSymbolContext (eSymbolContextBlock);
|
|
|
|
|
|
|
|
if (m_sc.block)
|
|
|
|
{
|
|
|
|
Block *inline_block = m_sc.block->GetContainingInlinedBlock();
|
|
|
|
if (inline_block)
|
|
|
|
{
|
|
|
|
// Use the block with the inlined function info
|
|
|
|
// as the frame block we want this frame to have only the variables
|
|
|
|
// for the inlined function and its non-inlined block child blocks.
|
|
|
|
return inline_block;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This block is not contained withing any inlined function blocks
|
|
|
|
// with so we want to use the top most function block.
|
|
|
|
return &m_sc.function->GetBlock (false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Get the symbol context if we already haven't done so by resolving the
|
|
|
|
// PC address as much as possible. This way when we pass around a
|
|
|
|
// StackFrame object, everyone will have as much information as
|
|
|
|
// possible and no one will ever have to look things up manually.
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const SymbolContext&
|
|
|
|
StackFrame::GetSymbolContext (uint32_t resolve_scope)
|
|
|
|
{
|
|
|
|
// Copy our internal symbol context into "sc".
|
2010-10-27 11:32:59 +08:00
|
|
|
if ((m_flags.Get() & resolve_scope) != resolve_scope)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
// Resolve our PC to section offset if we haven't alreday done so
|
|
|
|
// and if we don't have a module. The resolved address section will
|
|
|
|
// contain the module to which it belongs
|
2010-08-31 02:11:35 +08:00
|
|
|
if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR))
|
2010-08-25 05:05:24 +08:00
|
|
|
GetFrameCodeAddress();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// If this is not frame zero, then we need to subtract 1 from the PC
|
|
|
|
// value when doing address lookups since the PC will be on the
|
|
|
|
// instruction following the function call instruction...
|
|
|
|
|
2010-08-25 05:05:24 +08:00
|
|
|
Address lookup_addr(GetFrameCodeAddress());
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
if (m_frame_index > 0 && lookup_addr.IsValid())
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
addr_t offset = lookup_addr.GetOffset();
|
|
|
|
if (offset > 0)
|
|
|
|
lookup_addr.SetOffset(offset - 1);
|
|
|
|
}
|
|
|
|
|
2010-08-25 05:05:24 +08:00
|
|
|
|
|
|
|
uint32_t resolved = 0;
|
2010-06-09 00:52:24 +08:00
|
|
|
if (m_sc.module_sp)
|
|
|
|
{
|
|
|
|
// 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.
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
|
|
|
|
uint32_t actual_resolve_scope = 0;
|
|
|
|
|
|
|
|
if (resolve_scope & eSymbolContextCompUnit)
|
|
|
|
{
|
|
|
|
if (m_flags.IsClear (eSymbolContextCompUnit))
|
|
|
|
{
|
|
|
|
if (m_sc.comp_unit)
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= eSymbolContextCompUnit;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
else
|
|
|
|
actual_resolve_scope |= eSymbolContextCompUnit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resolve_scope & eSymbolContextFunction)
|
|
|
|
{
|
|
|
|
if (m_flags.IsClear (eSymbolContextFunction))
|
|
|
|
{
|
|
|
|
if (m_sc.function)
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= eSymbolContextFunction;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
else
|
|
|
|
actual_resolve_scope |= eSymbolContextFunction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resolve_scope & eSymbolContextBlock)
|
|
|
|
{
|
|
|
|
if (m_flags.IsClear (eSymbolContextBlock))
|
|
|
|
{
|
|
|
|
if (m_sc.block)
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= eSymbolContextBlock;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
else
|
|
|
|
actual_resolve_scope |= eSymbolContextBlock;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resolve_scope & eSymbolContextSymbol)
|
|
|
|
{
|
|
|
|
if (m_flags.IsClear (eSymbolContextSymbol))
|
|
|
|
{
|
|
|
|
if (m_sc.symbol)
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= eSymbolContextSymbol;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
else
|
|
|
|
actual_resolve_scope |= eSymbolContextSymbol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resolve_scope & eSymbolContextLineEntry)
|
|
|
|
{
|
|
|
|
if (m_flags.IsClear (eSymbolContextLineEntry))
|
|
|
|
{
|
|
|
|
if (m_sc.line_entry.IsValid())
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= eSymbolContextLineEntry;
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
else
|
|
|
|
actual_resolve_scope |= eSymbolContextLineEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actual_resolve_scope)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
// We might be resolving less information than what is already
|
|
|
|
// in our current symbol context so resolve into a temporary
|
|
|
|
// symbol context "sc" so we don't clear out data we have
|
|
|
|
// already found in "m_sc"
|
|
|
|
SymbolContext sc;
|
|
|
|
// Set flags that indicate what we have tried to resolve
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= m_sc.module_sp->ResolveSymbolContextForAddress (lookup_addr, actual_resolve_scope, sc);
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
// 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
|
2010-08-25 05:05:24 +08:00
|
|
|
if ((resolved & eSymbolContextCompUnit) && m_sc.comp_unit == NULL)
|
|
|
|
m_sc.comp_unit = sc.comp_unit;
|
|
|
|
if ((resolved & eSymbolContextFunction) && m_sc.function == NULL)
|
|
|
|
m_sc.function = sc.function;
|
|
|
|
if ((resolved & eSymbolContextBlock) && m_sc.block == NULL)
|
|
|
|
m_sc.block = sc.block;
|
|
|
|
if ((resolved & eSymbolContextSymbol) && m_sc.symbol == NULL)
|
|
|
|
m_sc.symbol = sc.symbol;
|
|
|
|
if ((resolved & eSymbolContextLineEntry) && !m_sc.line_entry.IsValid())
|
|
|
|
m_sc.line_entry = sc.line_entry;
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// If we don't have a module, then we can't have the compile unit,
|
|
|
|
// function, block, line entry or symbol, so we can safely call
|
|
|
|
// ResolveSymbolContextForAddress with our symbol context member m_sc.
|
2010-08-25 05:05:24 +08:00
|
|
|
resolved |= m_thread.GetProcess().GetTarget().GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// If the target was requested add that:
|
|
|
|
if (m_sc.target_sp.get() == NULL)
|
2010-08-25 05:05:24 +08:00
|
|
|
{
|
2010-06-09 00:52:24 +08:00
|
|
|
m_sc.target_sp = CalculateProcess()->GetTarget().GetSP();
|
2010-08-25 05:05:24 +08:00
|
|
|
if (m_sc.target_sp)
|
|
|
|
resolved |= eSymbolContextTarget;
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// Update our internal flags so we remember what we have tried to locate so
|
|
|
|
// we don't have to keep trying when more calls to this function are made.
|
2010-08-25 05:05:24 +08:00
|
|
|
// We might have dug up more information that was requested (for example
|
|
|
|
// if we were asked to only get the block, we will have gotten the
|
|
|
|
// compile unit, and function) so set any additional bits that we resolved
|
|
|
|
m_flags.Set (resolve_scope | resolved);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Return the symbol context with everything that was possible to resolve
|
|
|
|
// resolved.
|
|
|
|
return m_sc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VariableList *
|
2010-09-02 10:59:18 +08:00
|
|
|
StackFrame::GetVariableList (bool get_file_globals)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
if (m_flags.IsClear(RESOLVED_VARIABLES))
|
|
|
|
{
|
|
|
|
m_flags.Set(RESOLVED_VARIABLES);
|
|
|
|
|
2010-09-07 12:20:48 +08:00
|
|
|
Block *frame_block = GetFrameBlock();
|
|
|
|
|
|
|
|
if (frame_block)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-09-07 12:20:48 +08:00
|
|
|
const bool get_child_variables = true;
|
|
|
|
const bool can_create = true;
|
2011-06-18 06:10:16 +08:00
|
|
|
const bool stop_if_child_block_is_inlined_function = true;
|
|
|
|
m_variable_list_sp.reset(new VariableList());
|
|
|
|
frame_block->AppendBlockVariables(can_create, get_child_variables, stop_if_child_block_is_inlined_function, m_variable_list_sp.get());
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-11-01 12:38:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_flags.IsClear(RESOLVED_GLOBAL_VARIABLES) &&
|
|
|
|
get_file_globals)
|
|
|
|
{
|
|
|
|
m_flags.Set(RESOLVED_GLOBAL_VARIABLES);
|
|
|
|
|
|
|
|
if (m_flags.IsClear (eSymbolContextCompUnit))
|
|
|
|
GetSymbolContext (eSymbolContextCompUnit);
|
2010-09-02 10:59:18 +08:00
|
|
|
|
2010-11-01 12:38:59 +08:00
|
|
|
if (m_sc.comp_unit)
|
2010-09-02 10:59:18 +08:00
|
|
|
{
|
2010-11-01 12:38:59 +08:00
|
|
|
VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
|
|
|
|
if (m_variable_list_sp)
|
|
|
|
m_variable_list_sp->AddVariables (global_variable_list_sp.get());
|
|
|
|
else
|
|
|
|
m_variable_list_sp = global_variable_list_sp;
|
2010-09-02 10:59:18 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-11-01 12:38:59 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return m_variable_list_sp.get();
|
|
|
|
}
|
|
|
|
|
2010-12-14 10:59:59 +08:00
|
|
|
ValueObjectSP
|
2011-05-04 11:43:18 +08:00
|
|
|
StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|
|
|
lldb::DynamicValueType use_dynamic,
|
|
|
|
uint32_t options,
|
|
|
|
lldb::VariableSP &var_sp,
|
|
|
|
Error &error)
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2010-12-15 13:08:08 +08:00
|
|
|
|
|
|
|
if (var_expr_cstr && var_expr_cstr[0])
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2011-01-21 03:27:18 +08:00
|
|
|
const bool check_ptr_vs_member = (options & eExpressionPathOptionCheckPtrVsMember) != 0;
|
|
|
|
const bool no_fragile_ivar = (options & eExpressionPathOptionsNoFragileObjcIvar) != 0;
|
2010-12-15 13:08:08 +08:00
|
|
|
error.Clear();
|
|
|
|
bool deref = false;
|
|
|
|
bool address_of = false;
|
|
|
|
ValueObjectSP valobj_sp;
|
|
|
|
const bool get_file_globals = true;
|
|
|
|
VariableList *variable_list = GetVariableList (get_file_globals);
|
|
|
|
|
|
|
|
if (variable_list)
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2010-12-15 13:08:08 +08:00
|
|
|
// If first character is a '*', then show pointer contents
|
|
|
|
const char *var_expr = var_expr_cstr;
|
|
|
|
if (var_expr[0] == '*')
|
|
|
|
{
|
|
|
|
deref = true;
|
|
|
|
var_expr++; // Skip the '*'
|
|
|
|
}
|
|
|
|
else if (var_expr[0] == '&')
|
|
|
|
{
|
|
|
|
address_of = true;
|
|
|
|
var_expr++; // Skip the '&'
|
|
|
|
}
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
std::string var_path (var_expr);
|
|
|
|
size_t separator_idx = var_path.find_first_of(".-[=+~|&^%#@!/?,<>{}");
|
|
|
|
StreamString var_expr_path_strm;
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
ConstString name_const_string;
|
|
|
|
if (separator_idx == std::string::npos)
|
|
|
|
name_const_string.SetCString (var_path.c_str());
|
|
|
|
else
|
|
|
|
name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2011-05-04 11:43:18 +08:00
|
|
|
var_sp = variable_list->FindVariable(name_const_string);
|
2010-12-15 13:08:08 +08:00
|
|
|
if (var_sp)
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2011-05-04 11:43:18 +08:00
|
|
|
valobj_sp = GetValueObjectForFrameVariable (var_sp, use_dynamic);
|
2011-04-16 08:01:13 +08:00
|
|
|
if (!valobj_sp)
|
|
|
|
return valobj_sp;
|
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
var_path.erase (0, name_const_string.GetLength ());
|
|
|
|
// We are dumping at least one child
|
|
|
|
while (separator_idx != std::string::npos)
|
|
|
|
{
|
|
|
|
// Calculate the next separator index ahead of time
|
|
|
|
ValueObjectSP child_valobj_sp;
|
|
|
|
const char separator_type = var_path[0];
|
|
|
|
switch (separator_type)
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
case '-':
|
|
|
|
if (var_path.size() >= 2 && var_path[1] != '>')
|
2010-12-14 10:59:59 +08:00
|
|
|
return ValueObjectSP();
|
|
|
|
|
2011-01-21 03:27:18 +08:00
|
|
|
if (no_fragile_ivar)
|
|
|
|
{
|
|
|
|
// Make sure we aren't trying to deref an objective
|
|
|
|
// C ivar if this is not allowed
|
|
|
|
const uint32_t pointer_type_flags = ClangASTContext::GetTypeInfo (valobj_sp->GetClangType(), NULL, NULL);
|
|
|
|
if ((pointer_type_flags & ClangASTContext::eTypeIsObjC) &&
|
|
|
|
(pointer_type_flags & ClangASTContext::eTypeIsPointer))
|
|
|
|
{
|
|
|
|
// This was an objective C object pointer and
|
|
|
|
// it was requested we skip any fragile ivars
|
|
|
|
// so return nothing here
|
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
var_path.erase (0, 1); // Remove the '-'
|
|
|
|
// Fall through
|
|
|
|
case '.':
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2010-12-15 13:08:08 +08:00
|
|
|
const bool expr_is_ptr = var_path[0] == '>';
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
var_path.erase (0, 1); // Remove the '.' or '>'
|
|
|
|
separator_idx = var_path.find_first_of(".-[");
|
|
|
|
ConstString child_name;
|
|
|
|
if (separator_idx == std::string::npos)
|
|
|
|
child_name.SetCString (var_path.c_str());
|
2010-12-14 10:59:59 +08:00
|
|
|
else
|
2010-12-15 13:08:08 +08:00
|
|
|
child_name.SetCStringWithLength(var_path.c_str(), separator_idx);
|
|
|
|
|
|
|
|
if (check_ptr_vs_member)
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2010-12-15 13:08:08 +08:00
|
|
|
// We either have a pointer type and need to verify
|
|
|
|
// valobj_sp is a pointer, or we have a member of a
|
|
|
|
// class/union/struct being accessed with the . syntax
|
|
|
|
// and need to verify we don't have a pointer.
|
|
|
|
const bool actual_is_ptr = valobj_sp->IsPointerType ();
|
|
|
|
|
|
|
|
if (actual_is_ptr != expr_is_ptr)
|
|
|
|
{
|
|
|
|
// Incorrect use of "." with a pointer, or "->" with
|
|
|
|
// a class/union/struct instance or reference.
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
2010-12-15 13:08:08 +08:00
|
|
|
if (actual_is_ptr)
|
|
|
|
error.SetErrorStringWithFormat ("\"%s\" is a pointer and . was used to attempt to access \"%s\". Did you mean \"%s->%s\"?",
|
|
|
|
var_expr_path_strm.GetString().c_str(),
|
|
|
|
child_name.GetCString(),
|
|
|
|
var_expr_path_strm.GetString().c_str(),
|
|
|
|
var_path.c_str());
|
|
|
|
else
|
|
|
|
error.SetErrorStringWithFormat ("\"%s\" is not a pointer and -> was used to attempt to access \"%s\". Did you mean \"%s.%s\"?",
|
|
|
|
var_expr_path_strm.GetString().c_str(),
|
|
|
|
child_name.GetCString(),
|
|
|
|
var_expr_path_strm.GetString().c_str(),
|
|
|
|
var_path.c_str());
|
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
2010-12-14 10:59:59 +08:00
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
child_valobj_sp = valobj_sp->GetChildMemberWithName (child_name, true);
|
2010-12-14 10:59:59 +08:00
|
|
|
if (!child_valobj_sp)
|
|
|
|
{
|
2010-12-15 13:08:08 +08:00
|
|
|
// No child member with name "child_name"
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
2010-12-15 13:08:08 +08:00
|
|
|
if (child_name)
|
|
|
|
{
|
|
|
|
error.SetErrorStringWithFormat ("\"%s\" is not a member of \"(%s) %s\"",
|
|
|
|
child_name.GetCString(),
|
|
|
|
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
|
|
|
var_expr_path_strm.GetString().c_str());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
error.SetErrorStringWithFormat ("incomplete expression path after \"%s\" in \"%s\"",
|
|
|
|
var_expr_path_strm.GetString().c_str(),
|
|
|
|
var_expr_cstr);
|
|
|
|
}
|
|
|
|
|
2010-12-14 10:59:59 +08:00
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
// Remove the child name from the path
|
|
|
|
var_path.erase(0, child_name.GetLength());
|
2011-05-04 11:43:18 +08:00
|
|
|
if (use_dynamic != lldb::eNoDynamicValues)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2011-05-04 11:43:18 +08:00
|
|
|
ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
|
2011-04-16 08:01:13 +08:00
|
|
|
if (dynamic_value_sp)
|
|
|
|
child_valobj_sp = dynamic_value_sp;
|
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
}
|
|
|
|
break;
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
case '[':
|
|
|
|
// Array member access, or treating pointer as an array
|
|
|
|
if (var_path.size() > 2) // Need at least two brackets and a number
|
|
|
|
{
|
|
|
|
char *end = NULL;
|
2011-01-26 07:55:37 +08:00
|
|
|
long child_index = ::strtol (&var_path[1], &end, 0);
|
2010-12-15 13:08:08 +08:00
|
|
|
if (end && *end == ']')
|
|
|
|
{
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
if (valobj_sp->IsPointerType ())
|
|
|
|
{
|
|
|
|
child_valobj_sp = valobj_sp->GetSyntheticArrayMemberFromPointer (child_index, true);
|
|
|
|
if (!child_valobj_sp)
|
|
|
|
{
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
2010-12-15 13:08:08 +08:00
|
|
|
error.SetErrorStringWithFormat ("failed to use pointer as array for index %i for \"(%s) %s\"",
|
|
|
|
child_index,
|
|
|
|
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
|
|
|
var_expr_path_strm.GetString().c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ClangASTContext::IsArrayType (valobj_sp->GetClangType(), NULL, NULL))
|
|
|
|
{
|
2011-04-16 08:01:13 +08:00
|
|
|
// Pass false to dynamic_value here so we can tell the difference between
|
|
|
|
// no dynamic value and no member of this type...
|
2010-12-15 13:08:08 +08:00
|
|
|
child_valobj_sp = valobj_sp->GetChildAtIndex (child_index, true);
|
|
|
|
if (!child_valobj_sp)
|
|
|
|
{
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
2010-12-15 13:08:08 +08:00
|
|
|
error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"",
|
|
|
|
child_index,
|
|
|
|
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
|
|
|
var_expr_path_strm.GetString().c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
2010-12-15 13:08:08 +08:00
|
|
|
error.SetErrorStringWithFormat ("\"(%s) %s\" is not an array type",
|
|
|
|
valobj_sp->GetTypeName().AsCString("<invalid type>"),
|
|
|
|
var_expr_path_strm.GetString().c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!child_valobj_sp)
|
|
|
|
{
|
|
|
|
// Invalid array index...
|
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Erase the array member specification '[%i]' where
|
|
|
|
// %i is the array index
|
|
|
|
var_path.erase(0, (end - var_path.c_str()) + 1);
|
|
|
|
separator_idx = var_path.find_first_of(".-[");
|
2011-05-04 11:43:18 +08:00
|
|
|
if (use_dynamic != lldb::eNoDynamicValues)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2011-05-04 11:43:18 +08:00
|
|
|
ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
|
2011-04-16 08:01:13 +08:00
|
|
|
if (dynamic_value_sp)
|
|
|
|
child_valobj_sp = dynamic_value_sp;
|
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
// Break out early from the switch since we were
|
|
|
|
// able to find the child member
|
|
|
|
break;
|
|
|
|
}
|
2010-12-14 10:59:59 +08:00
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
return ValueObjectSP();
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
default:
|
|
|
|
// Failure...
|
|
|
|
{
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
valobj_sp->GetExpressionPath (var_expr_path_strm, false);
|
2010-12-15 13:08:08 +08:00
|
|
|
error.SetErrorStringWithFormat ("unexpected char '%c' encountered after \"%s\" in \"%s\"",
|
|
|
|
separator_type,
|
|
|
|
var_expr_path_strm.GetString().c_str(),
|
|
|
|
var_path.c_str());
|
|
|
|
|
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
|
|
|
}
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
if (child_valobj_sp)
|
|
|
|
valobj_sp = child_valobj_sp;
|
2010-12-14 10:59:59 +08:00
|
|
|
|
2010-12-15 13:08:08 +08:00
|
|
|
if (var_path.empty())
|
|
|
|
break;
|
2010-12-14 10:59:59 +08:00
|
|
|
|
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
if (valobj_sp)
|
2010-12-14 10:59:59 +08:00
|
|
|
{
|
2010-12-15 13:08:08 +08:00
|
|
|
if (deref)
|
|
|
|
{
|
2010-12-21 04:49:23 +08:00
|
|
|
ValueObjectSP deref_valobj_sp (valobj_sp->Dereference(error));
|
2010-12-15 13:08:08 +08:00
|
|
|
valobj_sp = deref_valobj_sp;
|
|
|
|
}
|
|
|
|
else if (address_of)
|
|
|
|
{
|
|
|
|
ValueObjectSP address_of_valobj_sp (valobj_sp->AddressOf(error));
|
|
|
|
valobj_sp = address_of_valobj_sp;
|
|
|
|
}
|
2010-12-14 10:59:59 +08:00
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
return valobj_sp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-05-04 11:43:18 +08:00
|
|
|
error.SetErrorStringWithFormat("no variable named '%s' found in this frame",
|
|
|
|
name_const_string.GetCString());
|
2010-12-14 10:59:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-15 13:08:08 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
error.SetErrorStringWithFormat("invalid variable path '%s'", var_expr_cstr);
|
|
|
|
}
|
2010-12-14 10:59:59 +08:00
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
bool
|
|
|
|
StackFrame::GetFrameBaseValue (Scalar &frame_base, Error *error_ptr)
|
|
|
|
{
|
|
|
|
if (m_flags.IsClear(GOT_FRAME_BASE))
|
|
|
|
{
|
|
|
|
if (m_sc.function)
|
|
|
|
{
|
|
|
|
m_frame_base.Clear();
|
|
|
|
m_frame_base_error.Clear();
|
|
|
|
|
|
|
|
m_flags.Set(GOT_FRAME_BASE);
|
|
|
|
ExecutionContext exe_ctx (&m_thread.GetProcess(), &m_thread, this);
|
|
|
|
Value expr_value;
|
2010-09-14 10:20:48 +08:00
|
|
|
addr_t loclist_base_addr = LLDB_INVALID_ADDRESS;
|
|
|
|
if (m_sc.function->GetFrameBaseExpression().IsLocationList())
|
2010-09-15 07:36:40 +08:00
|
|
|
loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (&m_thread.GetProcess().GetTarget());
|
2010-09-14 10:20:48 +08:00
|
|
|
|
2011-01-26 07:55:37 +08:00
|
|
|
if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, NULL, NULL, NULL, NULL, loclist_base_addr, NULL, expr_value, &m_frame_base_error) == false)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
// We should really have an error if evaluate returns, but in case
|
|
|
|
// we don't, lets set the error to something at least.
|
|
|
|
if (m_frame_base_error.Success())
|
|
|
|
m_frame_base_error.SetErrorString("Evaluation of the frame base expression failed.");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_frame_base = expr_value.ResolveValue(&exe_ctx, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_frame_base_error.SetErrorString ("No function in symbol context.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_frame_base_error.Success())
|
|
|
|
frame_base = m_frame_base;
|
|
|
|
|
|
|
|
if (error_ptr)
|
|
|
|
*error_ptr = m_frame_base_error;
|
|
|
|
return m_frame_base_error.Success();
|
|
|
|
}
|
|
|
|
|
2011-01-07 06:15:06 +08:00
|
|
|
RegisterContextSP
|
2010-06-09 00:52:24 +08:00
|
|
|
StackFrame::GetRegisterContext ()
|
|
|
|
{
|
2011-01-07 06:15:06 +08:00
|
|
|
if (!m_reg_context_sp)
|
|
|
|
m_reg_context_sp = m_thread.CreateRegisterContextForFrame (this);
|
|
|
|
return m_reg_context_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
StackFrame::HasDebugInformation ()
|
|
|
|
{
|
2010-08-25 05:05:24 +08:00
|
|
|
GetSymbolContext (eSymbolContextLineEntry);
|
2010-06-09 00:52:24 +08:00
|
|
|
return m_sc.line_entry.IsValid();
|
|
|
|
}
|
|
|
|
|
2010-09-02 10:59:18 +08:00
|
|
|
|
|
|
|
ValueObjectSP
|
2011-05-04 11:43:18 +08:00
|
|
|
StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-09-02 10:59:18 +08:00
|
|
|
ValueObjectSP valobj_sp;
|
|
|
|
VariableList *var_list = GetVariableList (true);
|
|
|
|
if (var_list)
|
|
|
|
{
|
|
|
|
// Make sure the variable is a frame variable
|
|
|
|
const uint32_t var_idx = var_list->FindIndexForVariable (variable_sp.get());
|
|
|
|
const uint32_t num_variables = var_list->GetSize();
|
|
|
|
if (var_idx < num_variables)
|
|
|
|
{
|
|
|
|
valobj_sp = m_variable_list_value_objects.GetValueObjectAtIndex (var_idx);
|
|
|
|
if (valobj_sp.get() == NULL)
|
|
|
|
{
|
|
|
|
if (m_variable_list_value_objects.GetSize() < num_variables)
|
|
|
|
m_variable_list_value_objects.Resize(num_variables);
|
2011-04-23 07:53:53 +08:00
|
|
|
valobj_sp = ValueObjectVariable::Create (this, variable_sp);
|
2010-09-02 10:59:18 +08:00
|
|
|
m_variable_list_value_objects.SetValueObjectAtIndex (var_idx, valobj_sp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-04 11:43:18 +08:00
|
|
|
if (use_dynamic != lldb::eNoDynamicValues && valobj_sp)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2011-05-04 11:43:18 +08:00
|
|
|
ValueObjectSP dynamic_sp = valobj_sp->GetDynamicValue (use_dynamic);
|
2011-04-16 08:01:13 +08:00
|
|
|
if (dynamic_sp)
|
|
|
|
return dynamic_sp;
|
|
|
|
}
|
2010-09-02 10:59:18 +08:00
|
|
|
return valobj_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
ValueObjectSP
|
2011-05-04 11:43:18 +08:00
|
|
|
StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
|
2010-09-02 10:59:18 +08:00
|
|
|
{
|
|
|
|
// Check to make sure we aren't already tracking this variable?
|
2011-04-16 08:01:13 +08:00
|
|
|
ValueObjectSP valobj_sp (GetValueObjectForFrameVariable (variable_sp, use_dynamic));
|
2010-09-02 10:59:18 +08:00
|
|
|
if (!valobj_sp)
|
|
|
|
{
|
|
|
|
// We aren't already tracking this global
|
|
|
|
VariableList *var_list = GetVariableList (true);
|
|
|
|
// If this frame has no variables, create a new list
|
|
|
|
if (var_list == NULL)
|
|
|
|
m_variable_list_sp.reset (new VariableList());
|
|
|
|
|
|
|
|
// Add the global/static variable to this frame
|
|
|
|
m_variable_list_sp->AddVariable (variable_sp);
|
|
|
|
|
|
|
|
// Now make a value object for it so we can track its changes
|
2011-04-16 08:01:13 +08:00
|
|
|
valobj_sp = GetValueObjectForFrameVariable (variable_sp, use_dynamic);
|
2010-09-02 10:59:18 +08:00
|
|
|
}
|
|
|
|
return valobj_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-08-27 04:44:45 +08:00
|
|
|
bool
|
|
|
|
StackFrame::IsInlined ()
|
|
|
|
{
|
2010-08-31 02:11:35 +08:00
|
|
|
if (m_sc.block == NULL)
|
|
|
|
GetSymbolContext (eSymbolContextBlock);
|
|
|
|
if (m_sc.block)
|
|
|
|
return m_sc.block->GetContainingInlinedBlock() != NULL;
|
|
|
|
return false;
|
2010-08-27 04:44:45 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
Target *
|
|
|
|
StackFrame::CalculateTarget ()
|
|
|
|
{
|
|
|
|
return m_thread.CalculateTarget();
|
|
|
|
}
|
|
|
|
|
|
|
|
Process *
|
|
|
|
StackFrame::CalculateProcess ()
|
|
|
|
{
|
|
|
|
return m_thread.CalculateProcess();
|
|
|
|
}
|
|
|
|
|
|
|
|
Thread *
|
|
|
|
StackFrame::CalculateThread ()
|
|
|
|
{
|
|
|
|
return &m_thread;
|
|
|
|
}
|
|
|
|
|
|
|
|
StackFrame *
|
|
|
|
StackFrame::CalculateStackFrame ()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2010-10-04 09:05:56 +08:00
|
|
|
StackFrame::CalculateExecutionContext (ExecutionContext &exe_ctx)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-10-04 09:05:56 +08:00
|
|
|
m_thread.CalculateExecutionContext (exe_ctx);
|
2010-06-09 00:52:24 +08:00
|
|
|
exe_ctx.frame = this;
|
|
|
|
}
|
|
|
|
|
2010-10-04 09:05:56 +08:00
|
|
|
void
|
|
|
|
StackFrame::DumpUsingSettingsFormat (Stream *strm)
|
|
|
|
{
|
|
|
|
if (strm == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetSymbolContext(eSymbolContextEverything);
|
|
|
|
ExecutionContext exe_ctx;
|
|
|
|
CalculateExecutionContext(exe_ctx);
|
|
|
|
const char *end = NULL;
|
|
|
|
StreamString s;
|
|
|
|
const char *frame_format = m_thread.GetProcess().GetTarget().GetDebugger().GetFrameFormat();
|
|
|
|
if (frame_format && Debugger::FormatPrompt (frame_format, &m_sc, &exe_ctx, NULL, s, &end))
|
|
|
|
{
|
|
|
|
strm->Write(s.GetData(), s.GetSize());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Dump (strm, true, false);
|
|
|
|
strm->EOL();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void
|
2010-09-03 05:44:10 +08:00
|
|
|
StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
if (strm == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (show_frame_index)
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
strm->Printf("frame #%u: ", m_frame_index);
|
2011-02-16 05:59:32 +08:00
|
|
|
strm->Printf("0x%0*llx ", m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess().GetTarget()));
|
2010-08-25 05:05:24 +08:00
|
|
|
GetSymbolContext(eSymbolContextEverything);
|
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.
llvm-svn: 111877
2010-08-24 08:45:41 +08:00
|
|
|
const bool show_module = true;
|
|
|
|
const bool show_inline = true;
|
2010-09-03 05:44:10 +08:00
|
|
|
m_sc.DumpStopContext(strm, &m_thread.GetProcess(), GetFrameCodeAddress(), show_fullpaths, show_module, show_inline);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-08-28 02:24:16 +08:00
|
|
|
void
|
2010-08-31 02:11:35 +08:00
|
|
|
StackFrame::UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
|
2010-08-28 02:24:16 +08:00
|
|
|
{
|
2010-08-31 02:11:35 +08:00
|
|
|
assert (GetStackID() == prev_frame.GetStackID()); // TODO: remove this after some testing
|
|
|
|
m_variable_list_sp = prev_frame.m_variable_list_sp;
|
2010-09-02 10:59:18 +08:00
|
|
|
m_variable_list_value_objects.Swap (prev_frame.m_variable_list_value_objects);
|
2010-08-28 05:47:54 +08:00
|
|
|
if (!m_disassembly.GetString().empty())
|
|
|
|
m_disassembly.GetString().swap (m_disassembly.GetString());
|
2010-08-28 02:24:16 +08:00
|
|
|
}
|
2010-08-28 05:47:54 +08:00
|
|
|
|
|
|
|
|
2010-08-31 02:11:35 +08:00
|
|
|
void
|
|
|
|
StackFrame::UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame)
|
|
|
|
{
|
2010-09-04 01:10:42 +08:00
|
|
|
assert (GetStackID() == curr_frame.GetStackID()); // TODO: remove this after some testing
|
|
|
|
m_id.SetPC (curr_frame.m_id.GetPC()); // Update the Stack ID PC value
|
2010-08-31 02:11:35 +08:00
|
|
|
assert (&m_thread == &curr_frame.m_thread);
|
|
|
|
m_frame_index = curr_frame.m_frame_index;
|
2011-01-07 06:15:06 +08:00
|
|
|
m_concrete_frame_index = curr_frame.m_concrete_frame_index;
|
2010-08-31 02:11:35 +08:00
|
|
|
m_reg_context_sp = curr_frame.m_reg_context_sp;
|
|
|
|
m_frame_code_addr = curr_frame.m_frame_code_addr;
|
|
|
|
assert (m_sc.target_sp.get() == NULL || curr_frame.m_sc.target_sp.get() == NULL || m_sc.target_sp.get() == curr_frame.m_sc.target_sp.get());
|
|
|
|
assert (m_sc.module_sp.get() == NULL || curr_frame.m_sc.module_sp.get() == NULL || m_sc.module_sp.get() == curr_frame.m_sc.module_sp.get());
|
|
|
|
assert (m_sc.comp_unit == NULL || curr_frame.m_sc.comp_unit == NULL || m_sc.comp_unit == curr_frame.m_sc.comp_unit);
|
|
|
|
assert (m_sc.function == NULL || curr_frame.m_sc.function == NULL || m_sc.function == curr_frame.m_sc.function);
|
|
|
|
m_sc = curr_frame.m_sc;
|
|
|
|
m_flags.Clear(GOT_FRAME_BASE | eSymbolContextEverything);
|
|
|
|
m_flags.Set (m_sc.GetResolvedMask());
|
|
|
|
m_frame_base.Clear();
|
|
|
|
m_frame_base_error.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-04 01:10:42 +08:00
|
|
|
bool
|
|
|
|
StackFrame::HasCachedData () const
|
|
|
|
{
|
|
|
|
if (m_variable_list_sp.get())
|
|
|
|
return true;
|
|
|
|
if (m_variable_list_value_objects.GetSize() > 0)
|
|
|
|
return true;
|
|
|
|
if (!m_disassembly.GetString().empty())
|
|
|
|
return true;
|
|
|
|
return false;
|
2010-09-24 01:40:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::StackFrameSP
|
|
|
|
StackFrame::GetSP ()
|
|
|
|
{
|
|
|
|
return m_thread.GetStackFrameSPForStackFramePtr (this);
|
2011-01-26 07:55:37 +08:00
|
|
|
}
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
StackFrame::GetStatus (Stream& strm,
|
|
|
|
bool show_frame_info,
|
|
|
|
bool show_source,
|
|
|
|
uint32_t source_lines_before,
|
|
|
|
uint32_t source_lines_after)
|
|
|
|
{
|
|
|
|
if (show_frame_info)
|
|
|
|
{
|
|
|
|
strm.Indent();
|
|
|
|
DumpUsingSettingsFormat (&strm);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (show_source)
|
|
|
|
{
|
|
|
|
GetSymbolContext(eSymbolContextCompUnit | eSymbolContextLineEntry);
|
|
|
|
|
|
|
|
if (m_sc.comp_unit && m_sc.line_entry.IsValid())
|
|
|
|
{
|
2011-04-23 10:04:55 +08:00
|
|
|
Target &target = GetThread().GetProcess().GetTarget();
|
|
|
|
target.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (
|
|
|
|
&target,
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
m_sc.line_entry.file,
|
|
|
|
m_sc.line_entry.line,
|
|
|
|
3,
|
|
|
|
3,
|
|
|
|
"->",
|
|
|
|
&strm);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|