summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/Function.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-08-21 02:22:51 +0000
committerGreg Clayton <gclayton@apple.com>2010-08-21 02:22:51 +0000
commit0b76a2c21f18e78c47f2eef92256debc3a035e54 (patch)
tree0e1b907bd3d0106c726c510bd75e759a7a8789b0 /lldb/source/Symbol/Function.cpp
parenta94e3d1124666470d6bdde8d66ab88fe5264afc5 (diff)
downloadbcm5719-llvm-0b76a2c21f18e78c47f2eef92256debc3a035e54.tar.gz
bcm5719-llvm-0b76a2c21f18e78c47f2eef92256debc3a035e54.zip
Modified the host process monitor callback function Host::StartMonitoringChildProcess
to spawn a thread for each process that is being monitored. Previously LLDB would spawn a single thread that would wait for any child process which isn't ok to do as a shared library (LLDB.framework on Mac OSX, or lldb.so on linux). The old single thread used to call wait4() with a pid of -1 which could cause it to reap child processes that it shouldn't have. Re-wrote the way Function blocks are handles. Previously I attempted to keep all blocks in a single memory allocation (in a std::vector). This made the code somewhat efficient, but hard to work with. I got rid of the old BlockList class, and went to a straight parent with children relationship. This new approach will allow for partial parsing of the blocks within a function. llvm-svn: 111706
Diffstat (limited to 'lldb/source/Symbol/Function.cpp')
-rw-r--r--lldb/source/Symbol/Function.cpp77
1 files changed, 32 insertions, 45 deletions
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index eda63d603da..73a09eae24f 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -191,16 +191,18 @@ Function::Function
Type * type,
const AddressRange& range
) :
- UserID(func_uid),
- m_comp_unit(comp_unit),
- m_type_uid(type_uid),
- m_type(type),
- m_mangled(mangled),
- m_blocks(this, range),
- m_frame_base(),
- m_flags(),
- m_prologue_byte_size(0)
-{
+ UserID (func_uid),
+ m_comp_unit (comp_unit),
+ m_type_uid (type_uid),
+ m_type (type),
+ m_mangled (mangled),
+ m_block (func_uid),
+ m_range (range),
+ m_frame_base (),
+ m_flags (),
+ m_prologue_byte_size (0)
+{
+ m_block.SetParentScope(this);
assert(comp_unit != NULL);
}
@@ -213,16 +215,18 @@ Function::Function
Type *type,
const AddressRange &range
) :
- UserID(func_uid),
- m_comp_unit(comp_unit),
- m_type_uid(type_uid),
- m_type(type),
- m_mangled(mangled, true),
- m_blocks(this, range),
- m_frame_base(),
- m_flags(),
- m_prologue_byte_size(0)
-{
+ UserID (func_uid),
+ m_comp_unit (comp_unit),
+ m_type_uid (type_uid),
+ m_type (type),
+ m_mangled (mangled, true),
+ m_block (func_uid),
+ m_range (range),
+ m_frame_base (),
+ m_flags (),
+ m_prologue_byte_size (0)
+{
+ m_block.SetParentScope(this);
assert(comp_unit != NULL);
}
@@ -231,24 +235,6 @@ Function::~Function()
{
}
-const AddressRange &
-Function::GetAddressRange()
-{
- return GetBlocks(true).GetAddressRange();
-}
-
-bool
-Function::IsInlined()
-{
- Block *root_block = GetBlocks(true).GetBlockByID(Block::RootID);
- if (root_block)
- {
- if (root_block->InlinedFunctionInfo() != NULL)
- return true;
- }
- return false;
-
-}
void
Function::GetStartLineSourceInfo (FileSpec &source_file, uint32_t &line_no)
{
@@ -301,17 +287,18 @@ Function::GetEndLineSourceInfo (FileSpec &source_file, uint32_t &line_no)
}
}
-BlockList &
-Function::GetBlocks(bool can_create)
+Block &
+Function::GetBlock (bool can_create)
{
- if (m_blocks.IsEmpty() && can_create)
+ if (!m_block.BlockInfoHasBeenParsed() && can_create)
{
SymbolContext sc;
CalculateSymbolContext(&sc);
assert(sc.module_sp);
sc.module_sp->GetSymbolVendor()->ParseFunctionBlocks(sc);
+ m_block.SetBlockInfoHasBeenParsed (true, true);
}
- return m_blocks;
+ return m_block;
}
CompileUnit*
@@ -358,8 +345,8 @@ Function::Dump(Stream *s, bool show_context) const
s->EOL();
// Dump the root object
- if (!m_blocks.IsEmpty())
- m_blocks.Dump(s, Block::RootID, INT_MAX, show_context);
+ if (m_block.BlockInfoHasBeenParsed ())
+ m_block.Dump(s, m_range.GetBaseAddress().GetFileAddress(), INT_MAX, show_context);
}
@@ -380,7 +367,7 @@ Function::DumpSymbolContext(Stream *s)
size_t
Function::MemorySize () const
{
- size_t mem_size = sizeof(Function) + m_blocks.MemorySize();
+ size_t mem_size = sizeof(Function) + m_block.MemorySize();
return mem_size;
}
OpenPOWER on IntegriCloud