本文整理汇总了C++中Process::IsAlive方法的典型用法代码示例。如果您正苦于以下问题:C++ Process::IsAlive方法的具体用法?C++ Process::IsAlive怎么用?C++ Process::IsAlive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process::IsAlive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
uint32_t
TargetList::SignalIfRunning (lldb::pid_t pid, int signo)
{
uint32_t num_signals_sent = 0;
Process *process = NULL;
if (pid == LLDB_INVALID_PROCESS_ID)
{
// Signal all processes with signal
Mutex::Locker locker(m_target_list_mutex);
collection::iterator pos, end = m_target_list.end();
for (pos = m_target_list.begin(); pos != end; ++pos)
{
process = (*pos)->GetProcessSP().get();
if (process)
{
if (process->IsAlive())
{
++num_signals_sent;
process->Signal (signo);
}
}
}
}
else
{
// Signal a specific process with signal
TargetSP target_sp(FindTargetWithProcessID (pid));
if (target_sp.get())
{
process = target_sp->GetProcessSP().get();
if (process)
{
if (process->IsAlive())
{
++num_signals_sent;
process->Signal (signo);
}
}
}
}
return num_signals_sent;
}
示例2: AbortAllProcesses
void ProcessManager::AbortAllProcesses(bool immediate)
{
ProcessList::iterator it = m_processList.begin();
while (it != m_processList.end())
{
ProcessList::iterator tempIt = it;
it++;
Process* pProcess = *tempIt;
if (pProcess->IsAlive())
{
pProcess->SetState(Process::ABORTED);
if (immediate)
{
pProcess->VOnAbort();
m_processList.erase(tempIt);
}
}
}
}
示例3: if
Error
Value::GetValueAsData (ExecutionContext *exe_ctx,
DataExtractor &data,
uint32_t data_offset,
Module *module)
{
data.Clear();
Error error;
lldb::addr_t address = LLDB_INVALID_ADDRESS;
AddressType address_type = eAddressTypeFile;
Address file_so_addr;
const CompilerType &ast_type = GetCompilerType();
switch (m_value_type)
{
case eValueTypeVector:
if (ast_type.IsValid())
data.SetAddressByteSize (ast_type.GetPointerByteSize());
else
data.SetAddressByteSize(sizeof(void *));
data.SetData(m_vector.bytes, m_vector.length, m_vector.byte_order);
break;
case eValueTypeScalar:
{
data.SetByteOrder (endian::InlHostByteOrder());
if (ast_type.IsValid())
data.SetAddressByteSize (ast_type.GetPointerByteSize());
else
data.SetAddressByteSize(sizeof(void *));
uint32_t limit_byte_size = UINT32_MAX;
if (ast_type.IsValid() && ast_type.IsScalarType())
{
uint64_t type_encoding_count = 0;
lldb::Encoding type_encoding = ast_type.GetEncoding(type_encoding_count);
if (type_encoding == eEncodingUint || type_encoding == eEncodingSint)
limit_byte_size = ast_type.GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
}
if (m_value.GetData (data, limit_byte_size))
return error; // Success;
error.SetErrorStringWithFormat("extracting data from value failed");
break;
}
case eValueTypeLoadAddress:
if (exe_ctx == NULL)
{
error.SetErrorString ("can't read load address (no execution context)");
}
else
{
Process *process = exe_ctx->GetProcessPtr();
if (process == NULL || !process->IsAlive())
{
Target *target = exe_ctx->GetTargetPtr();
if (target)
{
// Allow expressions to run and evaluate things when the target
// has memory sections loaded. This allows you to use "target modules load"
// to load your executable and any shared libraries, then execute
// commands where you can look at types in data sections.
const SectionLoadList &target_sections = target->GetSectionLoadList();
if (!target_sections.IsEmpty())
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (target_sections.ResolveLoadAddress(address, file_so_addr))
{
address_type = eAddressTypeLoad;
data.SetByteOrder(target->GetArchitecture().GetByteOrder());
data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
}
else
address = LLDB_INVALID_ADDRESS;
}
// else
// {
// ModuleSP exe_module_sp (target->GetExecutableModule());
// if (exe_module_sp)
// {
// address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
// if (address != LLDB_INVALID_ADDRESS)
// {
// if (exe_module_sp->ResolveFileAddress(address, file_so_addr))
// {
// data.SetByteOrder(target->GetArchitecture().GetByteOrder());
// data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
// address_type = eAddressTypeFile;
// }
// else
// {
// address = LLDB_INVALID_ADDRESS;
// }
// }
// }
// }
}
//.........这里部分代码省略.........
示例4: range
bool
Disassembler::Disassemble
(
Debugger &debugger,
const ArchSpec &arch,
const ExecutionContext &exe_ctx,
const AddressRange &disasm_range,
uint32_t num_mixed_context_lines,
bool show_bytes,
Stream &strm
)
{
if (disasm_range.GetByteSize())
{
Disassembler *disassembler = Disassembler::FindPlugin(arch);
if (disassembler)
{
AddressRange range(disasm_range);
Process *process = exe_ctx.process;
// If we weren't passed in a section offset address range,
// try and resolve it to something
if (range.GetBaseAddress().IsSectionOffset() == false)
{
if (process && process->IsAlive())
{
process->ResolveLoadAddress (range.GetBaseAddress().GetOffset(), range.GetBaseAddress());
}
else if (exe_ctx.target)
{
exe_ctx.target->GetImages().ResolveFileAddress (range.GetBaseAddress().GetOffset(), range.GetBaseAddress());
}
}
DataExtractor data;
size_t bytes_disassembled = disassembler->ParseInstructions (&exe_ctx, range, data);
if (bytes_disassembled == 0)
{
return false;
}
else
{
// We got some things disassembled...
size_t num_instructions = disassembler->GetInstructionList().GetSize();
uint32_t offset = 0;
SymbolContext sc;
SymbolContext prev_sc;
AddressRange sc_range;
if (num_mixed_context_lines)
strm.IndentMore ();
Address addr(range.GetBaseAddress());
// We extract the section to make sure we don't transition out
// of the current section when disassembling
const Section *addr_section = addr.GetSection();
Module *range_module = range.GetBaseAddress().GetModule();
for (size_t i=0; i<num_instructions; ++i)
{
Disassembler::Instruction *inst = disassembler->GetInstructionList().GetInstructionAtIndex (i);
if (inst)
{
addr_t file_addr = addr.GetFileAddress();
if (addr_section == NULL || addr_section->ContainsFileAddress (file_addr) == false)
{
if (range_module)
range_module->ResolveFileAddress (file_addr, addr);
else if (exe_ctx.target)
exe_ctx.target->GetImages().ResolveFileAddress (file_addr, addr);
addr_section = addr.GetSection();
}
prev_sc = sc;
if (addr_section)
{
Module *module = addr_section->GetModule();
uint32_t resolved_mask = module->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
if (resolved_mask)
{
if (prev_sc.function != sc.function || prev_sc.symbol != sc.symbol)
{
if (prev_sc.function || prev_sc.symbol)
strm.EOL();
strm << sc.module_sp->GetFileSpec().GetFilename();
if (sc.function)
strm << '`' << sc.function->GetMangled().GetName();
else if (sc.symbol)
strm << '`' << sc.symbol->GetMangled().GetName();
strm << ":\n";
}
//.........这里部分代码省略.........
示例5: exe_ctx
bool
ValueObjectVariable::UpdateValue ()
{
SetValueIsValid (false);
m_error.Clear();
Variable *variable = m_variable_sp.get();
DWARFExpression &expr = variable->LocationExpression();
if (variable->GetLocationIsConstantValueData())
{
// expr doesn't contain DWARF bytes, it contains the constant variable
// value bytes themselves...
if (expr.GetExpressionData(m_data))
m_value.SetContext(Value::eContextTypeVariable, variable);
else
m_error.SetErrorString ("empty constant data");
// constant bytes can't be edited - sorry
m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
}
else
{
lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
ExecutionContext exe_ctx (GetExecutionContextRef());
Target *target = exe_ctx.GetTargetPtr();
if (target)
{
m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
}
if (expr.IsLocationList())
{
SymbolContext sc;
variable->CalculateSymbolContext (&sc);
if (sc.function)
loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (target);
}
Value old_value(m_value);
if (expr.Evaluate (&exe_ctx, NULL, NULL, NULL, loclist_base_load_addr, NULL, m_value, &m_error))
{
m_resolved_value = m_value;
m_value.SetContext(Value::eContextTypeVariable, variable);
ClangASTType clang_type = GetClangType();
if (clang_type.IsValid())
m_value.SetClangType(clang_type);
Value::ValueType value_type = m_value.GetValueType();
switch (value_type)
{
case Value::eValueTypeFileAddress:
SetAddressTypeOfChildren(eAddressTypeFile);
break;
case Value::eValueTypeHostAddress:
SetAddressTypeOfChildren(eAddressTypeHost);
break;
case Value::eValueTypeLoadAddress:
case Value::eValueTypeScalar:
case Value::eValueTypeVector:
SetAddressTypeOfChildren(eAddressTypeLoad);
break;
}
switch (value_type)
{
case Value::eValueTypeVector:
// fall through
case Value::eValueTypeScalar:
// The variable value is in the Scalar value inside the m_value.
// We can point our m_data right to it.
m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
break;
case Value::eValueTypeFileAddress:
case Value::eValueTypeLoadAddress:
case Value::eValueTypeHostAddress:
// The DWARF expression result was an address in the inferior
// process. If this variable is an aggregate type, we just need
// the address as the main value as all child variable objects
// will rely upon this location and add an offset and then read
// their own values as needed. If this variable is a simple
// type, we read all data for it into m_data.
// Make sure this type has a value before we try and read it
// If we have a file address, convert it to a load address if we can.
Process *process = exe_ctx.GetProcessPtr();
if (value_type == Value::eValueTypeFileAddress && process && process->IsAlive())
{
lldb::addr_t file_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
if (file_addr != LLDB_INVALID_ADDRESS)
{
SymbolContext var_sc;
variable->CalculateSymbolContext(&var_sc);
if (var_sc.module_sp)
{
ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
if (objfile)
//.........这里部分代码省略.........