Пример #1
0
bool SearchFilter::FunctionPasses(Function &function) {
  // This is a slightly cheesy job, but since we don't have finer grained 
  // filters yet, just checking that the start address passes is probably
  // good enough for the base class behavior.
  Address addr = function.GetAddressRange().GetBaseAddress();
  return AddressPasses(addr);
}
Пример #2
0
bool
Variable::LocationIsValidForFrame (StackFrame *frame)
{
    // Is the variable is described by a single location?
    if (!m_location.IsLocationList())
    {
        // Yes it is, the location is valid. 
        return true;
    }

    if (frame)
    {
        Function *function = frame->GetSymbolContext(eSymbolContextFunction).function;
        if (function)
        {
            TargetSP target_sp (frame->CalculateTarget());
            
            addr_t loclist_base_load_addr = function->GetAddressRange().GetBaseAddress().GetLoadAddress (target_sp.get());
            if (loclist_base_load_addr == LLDB_INVALID_ADDRESS)
                return false;
            // It is a location list. We just need to tell if the location
            // list contains the current address when converted to a load
            // address
            return m_location.LocationListContainsAddress (loclist_base_load_addr, 
                                                           frame->GetFrameCodeAddress().GetLoadAddress (target_sp.get()));
        }
    }
    return false;
}
Пример #3
0
bool
Block::GetRangeContainingAddress (const Address& addr, AddressRange &range)
{
    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;
                
                const Range *range_ptr = m_ranges.FindEntryThatContains (offset);

                if (range_ptr)
                {
                    range.GetBaseAddress() = func_range.GetBaseAddress();
                    range.GetBaseAddress().SetOffset(func_offset + range_ptr->GetRangeBase());
                    range.SetByteSize(range_ptr->GetByteSize());
                    return true;
                }
            }
        }
    }
    range.Clear();
    return false;
}
Пример #4
0
bool
Block::GetStartAddress (Address &addr)
{
    if (m_ranges.IsEmpty())
        return false;

    Function *function = CalculateSymbolContextFunction();
    if (function)
    {
        addr = function->GetAddressRange().GetBaseAddress();
        addr.Slide(m_ranges.GetEntryRef(0).GetRangeBase ());
        return true;
    }
    return false;
}
Пример #5
0
void
Block::AddRange (const Range& range)
{
    Block *parent_block = GetParent ();
    if (parent_block && !parent_block->Contains(range))
    {
        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
        if (log)
        {
            ModuleSP module_sp (m_parent_scope->CalculateSymbolContextModule());
            Function *function = m_parent_scope->CalculateSymbolContextFunction();
            const addr_t function_file_addr = function->GetAddressRange().GetBaseAddress().GetFileAddress();
            const addr_t block_start_addr = function_file_addr + range.GetRangeBase ();
            const addr_t block_end_addr = function_file_addr + range.GetRangeEnd ();
            Type *func_type = function->GetType();
            
            const Declaration &func_decl = func_type->GetDeclaration();
            if (func_decl.GetLine())
            {
                log->Printf ("warning: %s:%u block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 ") which is not contained in parent block {0x%8.8" PRIx64 "} in function {0x%8.8" PRIx64 "} from %s",
                             func_decl.GetFile().GetPath().c_str(),
                             func_decl.GetLine(),
                             GetID(),
                             (uint32_t)m_ranges.GetSize(),
                             block_start_addr,
                             block_end_addr,
                             parent_block->GetID(),
                             function->GetID(),
                             module_sp->GetFileSpec().GetPath().c_str());
            }
            else
            {
                log->Printf ("warning: block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 ") which is not contained in parent block {0x%8.8" PRIx64 "} in function {0x%8.8" PRIx64 "} from %s",
                             GetID(),
                             (uint32_t)m_ranges.GetSize(),
                             block_start_addr,
                             block_end_addr,
                             parent_block->GetID(),
                             function->GetID(),
                             module_sp->GetFileSpec().GetPath().c_str());
            }
        }
        parent_block->AddRange (range);
    }
    m_ranges.Append(range);
}
Пример #6
0
bool
Block::GetRangeAtIndex (uint32_t range_idx, AddressRange &range)
{
    if (range_idx < m_ranges.GetSize())
    {
        Function *function = CalculateSymbolContextFunction();
        if (function)
        {
            const Range &vm_range = m_ranges.GetEntryRef(range_idx);
            range.GetBaseAddress() = function->GetAddressRange().GetBaseAddress();
            range.GetBaseAddress().Slide(vm_range.GetRangeBase ());
            range.SetByteSize (vm_range.GetByteSize());
            return true;
        }
    }
    return false;
}
Пример #7
0
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;
}