size_t
ParseInstructions (const ExecutionContext *exe_ctx,
- const AddressRange &range);
+ const AddressRange &range,
+ Stream *error_strm_ptr);
size_t
ParseInstructions (const ExecutionContext *exe_ctx,
bytes_read = target->ReadMemory(address, false, data_sp->GetBytes (), data_sp->GetByteSize(), error);
if (bytes_read == 0)
{
- result.AppendWarningWithFormat("Read from 0x%llx failed.\n", addr);
- result.AppendError(error.AsCString());
+ const char *error_cstr = error.AsCString();
+ if (error_cstr && error_cstr[0])
+ {
+ result.AppendError(error_cstr);
+ }
+ else
+ {
+ result.AppendErrorWithFormat("failed to read memory from 0x%llx.\n", addr);
+ }
result.SetStatus(eReturnStatusFailed);
return false;
}
if (disasm_sp)
{
- size_t bytes_disassembled = disasm_sp->ParseInstructions (&exe_ctx, range);
+ size_t bytes_disassembled = disasm_sp->ParseInstructions (&exe_ctx, range, NULL);
if (bytes_disassembled == 0)
disasm_sp.reset();
}
ResolveAddress (exe_ctx, disasm_range.GetBaseAddress(), range.GetBaseAddress());
range.SetByteSize (disasm_range.GetByteSize());
- size_t bytes_disassembled = disasm_ap->ParseInstructions (&exe_ctx, range);
+ size_t bytes_disassembled = disasm_ap->ParseInstructions (&exe_ctx, range, &strm);
if (bytes_disassembled == 0)
return false;
Disassembler::ParseInstructions
(
const ExecutionContext *exe_ctx,
- const AddressRange &range
+ const AddressRange &range,
+ Stream *error_strm_ptr
)
{
if (exe_ctx)
m_arch.GetAddressByteSize());
return DecodeInstructions (range.GetBaseAddress(), data, 0, UINT32_MAX, false);
}
+ else if (error_strm_ptr)
+ {
+ const char *error_cstr = error.AsCString();
+ if (error_cstr)
+ {
+ error_strm_ptr->Printf("error: %s\n", error_cstr);
+ }
+ }
+ }
+ else if (error_strm_ptr)
+ {
+ error_strm_ptr->PutCString("error: invalid execution context\n");
}
return 0;
}
// If the contents of this section are encrypted, the on-disk file is unusuable. Read only from live memory.
if (section_sp->IsEncrypted())
{
+ error.SetErrorString("section is encrypted");
return 0;
}
ModuleSP module_sp (section_sp->GetModule());