2010-06-09 00:52:24 +08:00
//===-- Block.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/Symbol/Block.h"
2011-09-30 07:41:34 +08:00
# include "lldb/lldb-private-log.h"
# include "lldb/Core/Log.h"
2010-06-09 00:52:24 +08:00
# include "lldb/Core/Module.h"
# include "lldb/Core/Section.h"
2011-09-30 07:41:34 +08:00
# include "lldb/Symbol/Function.h"
2011-08-06 07:43:37 +08:00
# include "lldb/Symbol/SymbolFile.h"
2010-06-09 00:52:24 +08:00
# include "lldb/Symbol/SymbolVendor.h"
# include "lldb/Symbol/VariableList.h"
using namespace lldb ;
using namespace lldb_private ;
2010-08-21 10:22:51 +08:00
Block : : Block ( lldb : : user_id_t uid ) :
2010-06-09 00:52:24 +08:00
UserID ( uid ) ,
2010-08-21 10:22:51 +08:00
m_parent_scope ( NULL ) ,
m_children ( ) ,
m_ranges ( ) ,
m_inlineInfoSP ( ) ,
2010-08-25 05:05:24 +08:00
m_variable_list_sp ( ) ,
2010-08-21 10:22:51 +08:00
m_parsed_block_info ( false ) ,
m_parsed_block_variables ( false ) ,
m_parsed_child_blocks ( false )
2010-06-09 00:52:24 +08:00
{
}
Block : : ~ Block ( )
{
}
2010-06-29 05:30:43 +08:00
void
2010-09-15 07:36:40 +08:00
Block : : GetDescription ( Stream * s , Function * function , lldb : : DescriptionLevel level , Target * target ) const
2010-06-29 05:30:43 +08:00
{
2010-09-10 09:30:46 +08:00
* s < < " id = " < < ( ( const UserID & ) * this ) ;
2011-10-08 08:49:15 +08:00
size_t num_ranges = m_ranges . GetSize ( ) ;
if ( num_ranges > 0 )
2010-06-29 05:30:43 +08:00
{
addr_t base_addr = LLDB_INVALID_ADDRESS ;
2010-09-15 07:36:40 +08:00
if ( target )
base_addr = function - > GetAddressRange ( ) . GetBaseAddress ( ) . GetLoadAddress ( target ) ;
2010-06-29 05:30:43 +08:00
if ( base_addr = = LLDB_INVALID_ADDRESS )
2010-08-21 10:22:51 +08:00
base_addr = function - > GetAddressRange ( ) . GetBaseAddress ( ) . GetFileAddress ( ) ;
2010-06-29 05:30:43 +08:00
2010-09-10 09:30:46 +08:00
s - > Printf ( " , range%s = " , num_ranges > 1 ? " s " : " " ) ;
2011-10-08 08:49:15 +08:00
for ( size_t i = 0 ; i < num_ranges ; + + i )
{
const Range & range = m_ranges . GetEntryRef ( i ) ;
s - > AddressRange ( base_addr + range . GetRangeBase ( ) , base_addr + range . GetRangeEnd ( ) , 4 ) ;
}
2010-06-29 05:30:43 +08:00
}
if ( m_inlineInfoSP . get ( ) ! = NULL )
2010-09-15 13:51:24 +08:00
{
bool show_fullpaths = ( level = = eDescriptionLevelVerbose ) ;
m_inlineInfoSP - > Dump ( s , show_fullpaths ) ;
}
2010-06-29 05:30:43 +08:00
}
2010-06-09 00:52:24 +08:00
void
Block : : Dump ( Stream * s , addr_t base_addr , int32_t depth , bool show_context ) const
{
if ( depth < 0 )
{
2010-08-21 10:22:51 +08:00
Block * parent = GetParent ( ) ;
if ( parent )
{
// We have a depth that is less than zero, print our parent blocks
// first
parent - > Dump ( s , base_addr , depth + 1 , show_context ) ;
}
2010-06-09 00:52:24 +08:00
}
2011-09-21 05:44:10 +08:00
s - > Printf ( " %p: " , this ) ;
2010-06-09 00:52:24 +08:00
s - > Indent ( ) ;
* s < < " Block " < < ( ( const UserID & ) * this ) ;
2010-06-29 05:30:43 +08:00
const Block * parent_block = GetParent ( ) ;
if ( parent_block )
2010-06-09 00:52:24 +08:00
{
2011-10-20 02:09:39 +08:00
s - > Printf ( " , parent = {0x%8.8llx} " , parent_block - > GetID ( ) ) ;
2010-06-09 00:52:24 +08:00
}
if ( m_inlineInfoSP . get ( ) ! = NULL )
2010-09-15 13:51:24 +08:00
{
bool show_fullpaths = false ;
m_inlineInfoSP - > Dump ( s , show_fullpaths ) ;
}
2010-06-09 00:52:24 +08:00
2011-10-08 08:49:15 +08:00
if ( ! m_ranges . IsEmpty ( ) )
2010-06-09 00:52:24 +08:00
{
* s < < " , ranges = " ;
2011-10-08 08:49:15 +08:00
size_t num_ranges = m_ranges . GetSize ( ) ;
for ( size_t i = 0 ; i < num_ranges ; + + i )
2010-06-09 00:52:24 +08:00
{
2011-10-08 08:49:15 +08:00
const Range & range = m_ranges . GetEntryRef ( i ) ;
if ( parent_block ! = NULL & & parent_block - > Contains ( range ) = = false )
2010-06-09 00:52:24 +08:00
* s < < ' ! ' ;
else
* s < < ' ' ;
2011-10-08 08:49:15 +08:00
s - > AddressRange ( base_addr + range . GetRangeBase ( ) , base_addr + range . GetRangeEnd ( ) , 4 ) ;
2010-06-09 00:52:24 +08:00
}
}
s - > EOL ( ) ;
if ( depth > 0 )
{
s - > IndentMore ( ) ;
2010-08-25 05:05:24 +08:00
if ( m_variable_list_sp . get ( ) )
2010-06-09 00:52:24 +08:00
{
2010-08-25 05:05:24 +08:00
m_variable_list_sp - > Dump ( s , show_context ) ;
2010-06-09 00:52:24 +08:00
}
2011-09-30 05:19:25 +08:00
collection : : const_iterator pos , end = m_children . end ( ) ;
for ( pos = m_children . begin ( ) ; pos ! = end ; + + pos )
( * pos ) - > Dump ( s , base_addr , depth - 1 , show_context ) ;
2010-06-09 00:52:24 +08:00
s - > IndentLess ( ) ;
}
}
2010-08-21 10:22:51 +08:00
Block *
Block : : FindBlockByID ( user_id_t block_id )
{
if ( block_id = = GetID ( ) )
return this ;
Block * matching_block = NULL ;
2011-09-30 05:19:25 +08:00
collection : : const_iterator pos , end = m_children . end ( ) ;
for ( pos = m_children . begin ( ) ; pos ! = end ; + + pos )
2010-08-21 10:22:51 +08:00
{
2011-09-30 05:19:25 +08:00
matching_block = ( * pos ) - > FindBlockByID ( block_id ) ;
2010-08-21 10:22:51 +08:00
if ( matching_block )
break ;
}
return matching_block ;
}
2010-06-09 00:52:24 +08:00
void
2010-08-25 05:05:24 +08:00
Block : : CalculateSymbolContext ( SymbolContext * sc )
2010-06-09 00:52:24 +08:00
{
2010-08-21 10:22:51 +08:00
if ( m_parent_scope )
m_parent_scope - > CalculateSymbolContext ( sc ) ;
2010-06-09 00:52:24 +08:00
sc - > block = this ;
}
2011-08-13 05:40:01 +08:00
Module *
Block : : CalculateSymbolContextModule ( )
{
if ( m_parent_scope )
return m_parent_scope - > CalculateSymbolContextModule ( ) ;
return NULL ;
}
CompileUnit *
Block : : CalculateSymbolContextCompileUnit ( )
{
if ( m_parent_scope )
return m_parent_scope - > CalculateSymbolContextCompileUnit ( ) ;
return NULL ;
}
Function *
Block : : CalculateSymbolContextFunction ( )
{
if ( m_parent_scope )
return m_parent_scope - > CalculateSymbolContextFunction ( ) ;
return NULL ;
}
Block *
Block : : CalculateSymbolContextBlock ( )
{
return this ;
}
2010-06-09 00:52:24 +08:00
void
Block : : DumpSymbolContext ( Stream * s )
{
2011-08-13 05:40:01 +08:00
Function * function = CalculateSymbolContextFunction ( ) ;
if ( function )
function - > DumpSymbolContext ( s ) ;
2011-10-20 02:09:39 +08:00
s - > Printf ( " , Block{0x%8.8llx} " , GetID ( ) ) ;
2010-06-09 00:52:24 +08:00
}
2010-09-20 13:20:02 +08:00
void
Block : : DumpAddressRanges ( Stream * s , lldb : : addr_t base_addr )
{
2011-10-08 08:49:15 +08:00
if ( ! m_ranges . IsEmpty ( ) )
2010-09-20 13:20:02 +08:00
{
2011-10-08 08:49:15 +08:00
size_t num_ranges = m_ranges . GetSize ( ) ;
for ( size_t i = 0 ; i < num_ranges ; + + i )
{
const Range & range = m_ranges . GetEntryRef ( i ) ;
s - > AddressRange ( base_addr + range . GetRangeBase ( ) , base_addr + range . GetRangeEnd ( ) , 4 ) ;
}
2010-09-20 13:20:02 +08:00
}
}
2010-06-09 00:52:24 +08:00
bool
Block : : Contains ( addr_t range_offset ) const
{
2011-10-08 08:49:15 +08:00
return m_ranges . FindEntryThatContains ( range_offset ) ! = NULL ;
2010-06-09 00:52:24 +08:00
}
2010-09-03 05:44:10 +08:00
bool
Block : : Contains ( const Block * block ) const
{
if ( this = = block )
2010-09-14 11:16:58 +08:00
return false ; // This block doesn't contain itself...
2010-09-03 05:44:10 +08:00
2010-09-14 11:16:58 +08:00
// Walk the parent chain for "block" and see if any if them match this block
2010-09-03 05:44:10 +08:00
const Block * block_parent ;
for ( block_parent = block - > GetParent ( ) ;
block_parent ! = NULL ;
block_parent = block_parent - > GetParent ( ) )
{
2010-09-14 11:16:58 +08:00
if ( this = = block_parent )
return true ; // One of the parents of "block" is this object!
2010-09-03 05:44:10 +08:00
}
return false ;
}
2010-06-09 00:52:24 +08:00
bool
2011-10-08 08:49:15 +08:00
Block : : Contains ( const Range & range ) const
2010-06-09 00:52:24 +08:00
{
2011-10-08 08:49:15 +08:00
return m_ranges . FindEntryThatContains ( range ) ! = NULL ;
2010-06-09 00:52:24 +08:00
}
2010-08-21 10:22:51 +08:00
Block *
Block : : GetParent ( ) const
2010-06-09 00:52:24 +08:00
{
2010-08-21 10:22:51 +08:00
if ( m_parent_scope )
2011-08-13 05:40:01 +08:00
return m_parent_scope - > CalculateSymbolContextBlock ( ) ;
2010-08-21 10:22:51 +08:00
return NULL ;
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
Block *
2010-08-25 05:05:24 +08:00
Block : : GetContainingInlinedBlock ( )
{
2010-09-07 12:20:48 +08:00
if ( GetInlinedFunctionInfo ( ) )
2010-08-25 05:05:24 +08:00
return this ;
return GetInlinedParent ( ) ;
}
Block *
Block : : GetInlinedParent ( )
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
{
Block * parent_block = GetParent ( ) ;
if ( parent_block )
{
2010-09-07 12:20:48 +08:00
if ( parent_block - > GetInlinedFunctionInfo ( ) )
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
return parent_block ;
else
return parent_block - > GetInlinedParent ( ) ;
}
return NULL ;
}
2010-08-25 05:05:24 +08:00
bool
2011-10-08 08:49:15 +08:00
Block : : GetRangeContainingOffset ( const addr_t offset , Range & range )
2010-08-25 05:05:24 +08:00
{
2011-10-08 08:49:15 +08:00
const Range * range_ptr = m_ranges . FindEntryThatContains ( offset ) ;
if ( range_ptr )
2010-08-25 05:05:24 +08:00
{
2011-10-08 08:49:15 +08:00
range = * range_ptr ;
2010-08-25 05:05:24 +08:00
return true ;
}
range . Clear ( ) ;
return false ;
}
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
bool
2011-10-08 08:49:15 +08:00
Block : : GetRangeContainingAddress ( const Address & addr , AddressRange & range )
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
{
2011-08-13 05:40:01 +08:00
Function * function = CalculateSymbolContextFunction ( ) ;
if ( function )
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
{
2011-08-13 05:40:01 +08:00
const AddressRange & func_range = function - > GetAddressRange ( ) ;
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 ( addr . GetSection ( ) = = func_range . GetBaseAddress ( ) . GetSection ( ) )
{
const addr_t addr_offset = addr . GetOffset ( ) ;
const addr_t func_offset = func_range . GetBaseAddress ( ) . GetOffset ( ) ;
if ( addr_offset > = func_offset & & addr_offset < func_offset + func_range . GetByteSize ( ) )
{
addr_t offset = addr_offset - func_offset ;
2011-10-08 08:49:15 +08:00
const Range * range_ptr = m_ranges . FindEntryThatContains ( offset ) ;
if ( range_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
{
range . GetBaseAddress ( ) = func_range . GetBaseAddress ( ) ;
2011-10-08 08:49:15 +08:00
range . GetBaseAddress ( ) . SetOffset ( func_offset + range_ptr - > GetRangeBase ( ) ) ;
range . SetByteSize ( range_ptr - > GetByteSize ( ) ) ;
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
return true ;
}
}
}
}
range . Clear ( ) ;
return false ;
}
2011-10-08 08:49:15 +08:00
uint32_t
Block : : GetRangeIndexContainingAddress ( const Address & addr )
{
Function * function = CalculateSymbolContextFunction ( ) ;
if ( function )
{
const AddressRange & func_range = function - > GetAddressRange ( ) ;
if ( addr . GetSection ( ) = = func_range . GetBaseAddress ( ) . GetSection ( ) )
{
const addr_t addr_offset = addr . GetOffset ( ) ;
const addr_t func_offset = func_range . GetBaseAddress ( ) . GetOffset ( ) ;
if ( addr_offset > = func_offset & & addr_offset < func_offset + func_range . GetByteSize ( ) )
{
addr_t offset = addr_offset - func_offset ;
return m_ranges . FindEntryIndexThatContains ( offset ) ;
}
}
}
return UINT32_MAX ;
}
2011-04-23 10:04:55 +08:00
bool
Block : : GetRangeAtIndex ( uint32_t range_idx , AddressRange & range )
{
2011-10-08 08:49:15 +08:00
if ( range_idx < m_ranges . GetSize ( ) )
2011-04-23 10:04:55 +08:00
{
2011-08-13 05:40:01 +08:00
Function * function = CalculateSymbolContextFunction ( ) ;
if ( function )
2011-04-23 10:04:55 +08:00
{
2011-10-08 08:49:15 +08:00
const Range & vm_range = m_ranges . GetEntryRef ( range_idx ) ;
2011-08-13 05:40:01 +08:00
range . GetBaseAddress ( ) = function - > GetAddressRange ( ) . GetBaseAddress ( ) ;
2011-10-08 08:49:15 +08:00
range . GetBaseAddress ( ) . Slide ( vm_range . GetRangeBase ( ) ) ;
range . SetByteSize ( vm_range . GetByteSize ( ) ) ;
2011-04-23 10:04:55 +08:00
return true ;
}
}
return false ;
}
2010-11-14 08:22:48 +08:00
bool
Block : : GetStartAddress ( Address & addr )
{
2011-10-08 08:49:15 +08:00
if ( m_ranges . IsEmpty ( ) )
2010-11-14 08:22:48 +08:00
return false ;
2011-08-13 05:40:01 +08:00
Function * function = CalculateSymbolContextFunction ( ) ;
if ( function )
2010-11-14 08:22:48 +08:00
{
2011-08-13 05:40:01 +08:00
addr = function - > GetAddressRange ( ) . GetBaseAddress ( ) ;
2011-10-08 08:49:15 +08:00
addr . Slide ( m_ranges . GetEntryRef ( 0 ) . GetRangeBase ( ) ) ;
2010-11-14 08:22:48 +08:00
return true ;
}
return false ;
}
2010-06-09 00:52:24 +08:00
void
2011-10-08 08:49:15 +08:00
Block : : FinalizeRanges ( )
{
m_ranges . Sort ( ) ;
m_ranges . CombineConsecutiveRanges ( ) ;
}
void
Block : : AddRange ( const Range & range )
2010-06-09 00:52:24 +08:00
{
2011-09-30 07:41:34 +08:00
Block * parent_block = GetParent ( ) ;
2011-10-08 08:49:15 +08:00
if ( parent_block & & ! parent_block - > Contains ( range ) )
2011-09-30 07:41:34 +08:00
{
LogSP log ( lldb_private : : GetLogIfAllCategoriesSet ( LIBLLDB_LOG_SYMBOLS ) ) ;
if ( log )
{
Module * module = m_parent_scope - > CalculateSymbolContextModule ( ) ;
Function * function = m_parent_scope - > CalculateSymbolContextFunction ( ) ;
const addr_t function_file_addr = function - > GetAddressRange ( ) . GetBaseAddress ( ) . GetFileAddress ( ) ;
2011-10-08 08:49:15 +08:00
const addr_t block_start_addr = function_file_addr + range . GetRangeBase ( ) ;
const addr_t block_end_addr = function_file_addr + range . GetRangeEnd ( ) ;
2011-09-30 07:41:34 +08:00
Type * func_type = function - > GetType ( ) ;
const Declaration & func_decl = func_type - > GetDeclaration ( ) ;
if ( func_decl . GetLine ( ) )
{
2011-10-20 02:09:39 +08:00
log - > Printf ( " warning: %s/%s:%u block {0x%8.8llx} has range[%u] [0x%llx - 0x%llx) which is not contained in parent block {0x%8.8llx} in function {0x%8.8llx} from %s/%s " ,
2011-09-30 07:41:34 +08:00
func_decl . GetFile ( ) . GetDirectory ( ) . GetCString ( ) ,
func_decl . GetFile ( ) . GetFilename ( ) . GetCString ( ) ,
func_decl . GetLine ( ) ,
GetID ( ) ,
2011-10-08 08:49:15 +08:00
( uint32_t ) m_ranges . GetSize ( ) ,
2011-09-30 07:41:34 +08:00
block_start_addr ,
block_end_addr ,
parent_block - > GetID ( ) ,
function - > GetID ( ) ,
module - > GetFileSpec ( ) . GetDirectory ( ) . GetCString ( ) ,
module - > GetFileSpec ( ) . GetFilename ( ) . GetCString ( ) ) ;
}
else
{
2011-10-20 02:09:39 +08:00
log - > Printf ( " warning: block {0x%8.8llx} has range[%u] [0x%llx - 0x%llx) which is not contained in parent block {0x%8.8llx} in function {0x%8.8llx} from %s/%s " ,
2011-09-30 07:41:34 +08:00
GetID ( ) ,
2011-10-08 08:49:15 +08:00
( uint32_t ) m_ranges . GetSize ( ) ,
2011-09-30 07:41:34 +08:00
block_start_addr ,
block_end_addr ,
parent_block - > GetID ( ) ,
function - > GetID ( ) ,
module - > GetFileSpec ( ) . GetDirectory ( ) . GetCString ( ) ,
module - > GetFileSpec ( ) . GetFilename ( ) . GetCString ( ) ) ;
}
}
2011-10-08 08:49:15 +08:00
parent_block - > AddRange ( range ) ;
2011-09-30 07:41:34 +08:00
}
2011-10-08 08:49:15 +08:00
m_ranges . Append ( range ) ;
2010-06-09 00:52:24 +08:00
}
// Return the current number of bytes that this object occupies in memory
size_t
Block : : MemorySize ( ) const
{
2011-10-08 08:49:15 +08:00
size_t mem_size = sizeof ( Block ) + m_ranges . GetSize ( ) * sizeof ( Range ) ;
2010-06-09 00:52:24 +08:00
if ( m_inlineInfoSP . get ( ) )
mem_size + = m_inlineInfoSP - > MemorySize ( ) ;
2010-08-25 05:05:24 +08:00
if ( m_variable_list_sp . get ( ) )
mem_size + = m_variable_list_sp - > MemorySize ( ) ;
2010-06-09 00:52:24 +08:00
return mem_size ;
}
2010-08-21 10:22:51 +08:00
void
Block : : AddChild ( const BlockSP & child_block_sp )
2010-06-09 00:52:24 +08:00
{
2010-08-21 10:22:51 +08:00
if ( child_block_sp )
{
child_block_sp - > SetParentScope ( this ) ;
m_children . push_back ( child_block_sp ) ;
}
2010-06-09 00:52:24 +08:00
}
void
Block : : SetInlinedFunctionInfo ( const char * name , const char * mangled , const Declaration * decl_ptr , const Declaration * call_decl_ptr )
{
m_inlineInfoSP . reset ( new InlineFunctionInfo ( name , mangled , decl_ptr , call_decl_ptr ) ) ;
}
2010-08-19 03:29:16 +08:00
VariableListSP
2011-06-18 06:10:16 +08:00
Block : : GetBlockVariableList ( bool can_create )
2010-08-19 03:29:16 +08:00
{
2010-08-21 10:22:51 +08:00
if ( m_parsed_block_variables = = false )
2010-08-19 03:29:16 +08:00
{
2010-08-25 05:05:24 +08:00
if ( m_variable_list_sp . get ( ) = = NULL & & can_create )
2010-08-21 10:22:51 +08:00
{
m_parsed_block_variables = true ;
SymbolContext sc ;
CalculateSymbolContext ( & sc ) ;
assert ( sc . module_sp ) ;
sc . module_sp - > GetSymbolVendor ( ) - > ParseVariablesForContext ( sc ) ;
}
2010-08-19 03:29:16 +08:00
}
2011-06-18 06:10:16 +08:00
return m_variable_list_sp ;
}
2010-08-19 03:29:16 +08:00
2011-06-18 06:10:16 +08:00
uint32_t
Block : : AppendBlockVariables ( bool can_create ,
bool get_child_block_variables ,
bool stop_if_child_block_is_inlined_function ,
VariableList * variable_list )
{
uint32_t num_variables_added = 0 ;
VariableList * block_var_list = GetBlockVariableList ( can_create ) . get ( ) ;
if ( block_var_list )
2010-08-19 03:29:16 +08:00
{
2011-06-18 06:10:16 +08:00
num_variables_added + = block_var_list - > GetSize ( ) ;
variable_list - > AddVariables ( block_var_list ) ;
}
if ( get_child_block_variables )
{
2011-09-30 05:19:25 +08:00
collection : : const_iterator pos , end = m_children . end ( ) ;
for ( pos = m_children . begin ( ) ; pos ! = end ; + + pos )
{
Block * child_block = pos - > get ( ) ;
2011-06-18 06:10:16 +08:00
if ( stop_if_child_block_is_inlined_function = = false | |
child_block - > GetInlinedFunctionInfo ( ) = = NULL )
{
num_variables_added + = child_block - > AppendBlockVariables ( can_create ,
get_child_block_variables ,
stop_if_child_block_is_inlined_function ,
variable_list ) ;
2010-08-19 03:29:16 +08:00
}
}
}
2011-06-18 06:10:16 +08:00
return num_variables_added ;
2010-08-19 03:29:16 +08:00
}
uint32_t
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
Block : : AppendVariables
(
bool can_create ,
bool get_parent_variables ,
bool stop_if_block_is_inlined_function ,
VariableList * variable_list
)
2010-08-19 03:29:16 +08:00
{
uint32_t num_variables_added = 0 ;
2011-06-18 06:10:16 +08:00
VariableListSP variable_list_sp ( GetBlockVariableList ( can_create ) ) ;
2010-08-19 03:29:16 +08:00
2010-09-07 12:20:48 +08:00
bool is_inlined_function = GetInlinedFunctionInfo ( ) ! = NULL ;
2010-08-19 03:29:16 +08:00
if ( variable_list_sp . get ( ) )
{
num_variables_added = variable_list_sp - > GetSize ( ) ;
variable_list - > AddVariables ( variable_list_sp . get ( ) ) ;
}
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-08-19 03:29:16 +08:00
if ( get_parent_variables )
{
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 ( stop_if_block_is_inlined_function & & is_inlined_function )
return num_variables_added ;
2010-08-19 03:29:16 +08:00
Block * parent_block = GetParent ( ) ;
if ( parent_block )
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
num_variables_added + = parent_block - > AppendVariables ( can_create , get_parent_variables , stop_if_block_is_inlined_function , variable_list ) ;
2010-08-19 03:29:16 +08:00
}
return num_variables_added ;
}
2011-08-06 07:43:37 +08:00
clang : : DeclContext *
Block : : GetClangDeclContextForInlinedFunction ( )
{
SymbolContext sc ;
CalculateSymbolContext ( & sc ) ;
if ( ! sc . module_sp )
return NULL ;
SymbolVendor * sym_vendor = sc . module_sp - > GetSymbolVendor ( ) ;
if ( ! sym_vendor )
return NULL ;
SymbolFile * sym_file = sym_vendor - > GetSymbolFile ( ) ;
if ( ! sym_file )
return NULL ;
return sym_file - > GetClangDeclContextForTypeUID ( sc , m_uid ) ;
}
2010-06-09 00:52:24 +08:00
void
2010-08-21 10:22:51 +08:00
Block : : SetBlockInfoHasBeenParsed ( bool b , bool set_children )
2010-06-09 00:52:24 +08:00
{
2010-08-21 10:22:51 +08:00
m_parsed_block_info = b ;
if ( set_children )
2010-06-09 00:52:24 +08:00
{
2010-08-21 10:22:51 +08:00
m_parsed_child_blocks = true ;
2011-09-30 05:19:25 +08:00
collection : : const_iterator pos , end = m_children . end ( ) ;
for ( pos = m_children . begin ( ) ; pos ! = end ; + + pos )
( * pos ) - > SetBlockInfoHasBeenParsed ( b , true ) ;
2010-06-09 00:52:24 +08:00
}
}
2011-06-18 06:10:16 +08:00
void
Block : : SetDidParseVariables ( bool b , bool set_children )
{
m_parsed_block_variables = b ;
if ( set_children )
{
2011-09-30 05:19:25 +08:00
collection : : const_iterator pos , end = m_children . end ( ) ;
for ( pos = m_children . begin ( ) ; pos ! = end ; + + pos )
( * pos ) - > SetDidParseVariables ( b , true ) ;
}
}
Block *
Block : : GetSibling ( ) const
{
if ( m_parent_scope )
{
2011-09-30 07:41:34 +08:00
Block * parent_block = GetParent ( ) ;
2011-09-30 05:19:25 +08:00
if ( parent_block )
return parent_block - > GetSiblingForChild ( this ) ;
2011-06-18 06:10:16 +08:00
}
2011-09-30 05:19:25 +08:00
return NULL ;
}
// A parent of child blocks can be asked to find a sibling block given
// one of its child blocks
Block *
Block : : GetSiblingForChild ( const Block * child_block ) const
{
if ( ! m_children . empty ( ) )
{
collection : : const_iterator pos , end = m_children . end ( ) ;
for ( pos = m_children . begin ( ) ; pos ! = end ; + + pos )
{
if ( pos - > get ( ) = = child_block )
{
if ( + + pos ! = end )
return pos - > get ( ) ;
break ;
}
}
}
return NULL ;
2011-06-18 06:10:16 +08:00
}