本文整理汇总了C++中Address::SetRawAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::SetRawAddress方法的具体用法?C++ Address::SetRawAddress怎么用?C++ Address::SetRawAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::SetRawAddress方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exe_ctx
bool
JavaLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &dynamic_address,
Value::ValueType &value_type)
{
class_type_or_name.Clear();
// null references don't have a dynamic type
if (in_value.IsNilReference())
return false;
ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
Target *target = exe_ctx.GetTargetPtr();
if (!target)
return false;
ConstString linkage_name;
CompilerType in_type = in_value.GetCompilerType();
if (in_type.IsPossibleDynamicType(nullptr, false, false))
linkage_name = GetDynamicTypeId(&exe_ctx, target, in_value);
else
linkage_name = JavaASTContext::GetLinkageName(in_type);
if (!linkage_name)
return false;
class_type_or_name.SetName(in_type.GetNonReferenceType().GetTypeName());
SymbolContext sc;
TypeList class_types;
llvm::DenseSet<SymbolFile *> searched_symbol_files;
size_t num_matches = target->GetImages().FindTypes(sc, linkage_name,
true, // name_is_fully_qualified
UINT32_MAX, searched_symbol_files, class_types);
for (size_t i = 0; i < num_matches; ++i)
{
TypeSP type_sp = class_types.GetTypeAtIndex(i);
CompilerType compiler_type = type_sp->GetFullCompilerType();
if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava)
continue;
if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType())
{
class_type_or_name.SetTypeSP(type_sp);
Value &value = in_value.GetValue();
value_type = value.GetValueType();
dynamic_address.SetRawAddress(value.GetScalar().ULongLong(0));
return true;
}
}
return false;
}
示例2: guard
break_id_t
SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr)
{
break_id_t break_id = LLDB_INVALID_BREAK_ID;
if (m_opaque_sp && vm_addr != LLDB_INVALID_ADDRESS)
{
std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
Address address;
Target &target = m_opaque_sp->GetTarget();
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address))
{
address.SetRawAddress (vm_addr);
}
break_id = m_opaque_sp->FindLocationIDByAddress (address);
}
return break_id;
}
示例3: api_locker
break_id_t
SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr)
{
break_id_t break_id = LLDB_INVALID_BREAK_ID;
if (m_opaque_sp && vm_addr != LLDB_INVALID_ADDRESS)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
Address address;
Target &target = m_opaque_sp->GetTarget();
if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false)
{
address.SetRawAddress (vm_addr);
}
break_id = m_opaque_sp->FindLocationIDByAddress (address);
}
return break_id;
}
示例4: class_descriptor
// for V1 runtime we just try to return a class name as that is the minimum level of support
// required for the data formatters to work
bool
AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address)
{
class_type_or_name.Clear();
if (CouldHaveDynamicValue(in_value))
{
auto class_descriptor(GetClassDescriptor(in_value));
if (class_descriptor && class_descriptor->IsValid() && class_descriptor->GetClassName())
{
const addr_t object_ptr = in_value.GetPointerValue();
address.SetRawAddress(object_ptr);
class_type_or_name.SetName(class_descriptor->GetClassName());
}
}
return class_type_or_name.IsEmpty() == false;
}
示例5: module_sp
static bool
ReadAddress (ExecutionContextScope *exe_scope, const Address &address, uint32_t pointer_size, Address &deref_so_addr)
{
if (exe_scope == NULL)
return false;
bool success = false;
addr_t deref_addr = ReadUIntMax64 (exe_scope, address, pointer_size, success);
if (success)
{
ExecutionContext exe_ctx;
exe_scope->CalculateExecutionContext(exe_ctx);
// If we have any sections that are loaded, try and resolve using the
// section load list
Target *target = exe_ctx.GetTargetPtr();
if (target && !target->GetSectionLoadList().IsEmpty())
{
if (target->GetSectionLoadList().ResolveLoadAddress (deref_addr, deref_so_addr))
return true;
}
else
{
// If we were not running, yet able to read an integer, we must
// have a module
ModuleSP module_sp (address.GetModule());
assert (module_sp);
if (module_sp->ResolveFileAddress(deref_addr, deref_so_addr))
return true;
}
// We couldn't make "deref_addr" into a section offset value, but we were
// able to read the address, so we return a section offset address with
// no section and "deref_addr" as the offset (address).
deref_so_addr.SetRawAddress(deref_addr);
return true;
}
return false;
}
示例6: GetDynamicTypeAndAddress
bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(
ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &dynamic_address,
Value::ValueType &value_type) {
// For Itanium, if the type has a vtable pointer in the object, it will be at
// offset 0
// in the object. That will point to the "address point" within the vtable
// (not the beginning of the
// vtable.) We can then look up the symbol containing this "address point"
// and that symbol's name
// demangled will contain the full class name.
// The second pointer above the "address point" is the "offset_to_top". We'll
// use that to get the
// start of the value object which holds the dynamic type.
//
class_type_or_name.Clear();
value_type = Value::ValueType::eValueTypeScalar;
// Only a pointer or reference type can have a different dynamic and static
// type:
if (CouldHaveDynamicValue(in_value)) {
// First job, pull out the address at 0 offset from the object.
AddressType address_type;
lldb::addr_t original_ptr = in_value.GetPointerValue(&address_type);
if (original_ptr == LLDB_INVALID_ADDRESS)
return false;
ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
Process *process = exe_ctx.GetProcessPtr();
if (process == nullptr)
return false;
Error error;
const lldb::addr_t vtable_address_point =
process->ReadPointerFromMemory(original_ptr, error);
if (!error.Success() || vtable_address_point == LLDB_INVALID_ADDRESS) {
return false;
}
class_type_or_name = GetTypeInfoFromVTableAddress(in_value, original_ptr,
vtable_address_point);
if (class_type_or_name) {
TypeSP type_sp = class_type_or_name.GetTypeSP();
// There can only be one type with a given name,
// so we've just found duplicate definitions, and this
// one will do as well as any other.
// We don't consider something to have a dynamic type if
// it is the same as the static type. So compare against
// the value we were handed.
if (type_sp) {
if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(),
type_sp->GetForwardCompilerType())) {
// The dynamic type we found was the same type,
// so we don't have a dynamic type here...
return false;
}
// The offset_to_top is two pointers above the vtable pointer.
const uint32_t addr_byte_size = process->GetAddressByteSize();
const lldb::addr_t offset_to_top_location =
vtable_address_point - 2 * addr_byte_size;
// Watch for underflow, offset_to_top_location should be less than
// vtable_address_point
if (offset_to_top_location >= vtable_address_point)
return false;
const int64_t offset_to_top = process->ReadSignedIntegerFromMemory(
offset_to_top_location, addr_byte_size, INT64_MIN, error);
if (offset_to_top == INT64_MIN)
return false;
// So the dynamic type is a value that starts at offset_to_top
// above the original address.
lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
if (!process->GetTarget().GetSectionLoadList().ResolveLoadAddress(
dynamic_addr, dynamic_address)) {
dynamic_address.SetRawAddress(dynamic_addr);
}
return true;
}
}
}
return class_type_or_name.IsEmpty() == false;
}
示例7: exe_ctx
//.........这里部分代码省略.........
if (log)
{
for (i = 0; i < num_matches; i++)
{
type_sp = class_types.GetTypeAtIndex(i);
if (type_sp)
{
if (log)
log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types: uid={0x%" PRIx64 "}, type-name='%s'\n",
original_ptr,
in_value.GetTypeName().AsCString(),
type_sp->GetID(),
type_sp->GetName().GetCString());
}
}
}
for (i = 0; i < num_matches; i++)
{
type_sp = class_types.GetTypeAtIndex(i);
if (type_sp)
{
if (type_sp->GetClangFullType().IsCXXClassType())
{
if (log)
log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types, picking this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
original_ptr,
in_value.GetTypeName().AsCString(),
type_sp->GetID(),
type_sp->GetName().GetCString());
class_type_or_name.SetTypeSP(type_sp);
break;
}
}
}
if (i == num_matches)
{
if (log)
log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types, didn't find a C++ match\n",
original_ptr,
in_value.GetTypeName().AsCString());
return false;
}
}
// There can only be one type with a given name,
// so we've just found duplicate definitions, and this
// one will do as well as any other.
// We don't consider something to have a dynamic type if
// it is the same as the static type. So compare against
// the value we were handed.
if (type_sp)
{
if (ClangASTContext::AreTypesSame (in_value.GetClangType(),
type_sp->GetClangFullType()))
{
// The dynamic type we found was the same type,
// so we don't have a dynamic type here...
return false;
}
// The offset_to_top is two pointers above the address.
Address offset_to_top_address = address_point_address;
int64_t slide = -2 * ((int64_t) target->GetArchitecture().GetAddressByteSize());
offset_to_top_address.Slide (slide);
Error error;
lldb::addr_t offset_to_top_location = offset_to_top_address.GetLoadAddress(target);
size_t bytes_read = process->ReadMemory (offset_to_top_location,
memory_buffer,
address_byte_size,
error);
if (!error.Success() || (bytes_read != address_byte_size))
{
return false;
}
offset = 0;
int64_t offset_to_top = data.GetMaxS64(&offset, process->GetAddressByteSize());
// So the dynamic type is a value that starts at offset_to_top
// above the original address.
lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
if (!target->GetSectionLoadList().ResolveLoadAddress (dynamic_addr, dynamic_address))
{
dynamic_address.SetRawAddress(dynamic_addr);
}
return true;
}
}
}
}
}
}
return class_type_or_name.IsEmpty() == false;
}