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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@111706 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/Function.cpp b/source/Symbol/Function.cpp
index eda63d6..73a09ea 100644
--- a/source/Symbol/Function.cpp
+++ b/source/Symbol/Function.cpp
@@ -191,16 +191,18 @@
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 @@
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 @@
{
}
-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 @@
}
}
-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 @@
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 @@
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;
}