mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:17:35 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -68,7 +68,7 @@ Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(const Debug::
|
|||
|
||||
frames.append({ name, current_instruction, current_ebp });
|
||||
auto frame_info = Debug::StackFrameUtils::get_info(*Debugger::the().session(), current_ebp);
|
||||
ASSERT(frame_info.has_value());
|
||||
VERIFY(frame_info.has_value());
|
||||
current_instruction = frame_info.value().return_address;
|
||||
current_ebp = frame_info.value().next_ebp;
|
||||
} while (current_ebp && current_instruction);
|
||||
|
|
|
@ -33,7 +33,7 @@ static Debugger* s_the;
|
|||
|
||||
Debugger& Debugger::the()
|
||||
{
|
||||
ASSERT(s_the);
|
||||
VERIFY(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,10 @@ void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointC
|
|||
|
||||
if (change_type == BreakpointChange::Added) {
|
||||
bool success = session->insert_breakpoint(reinterpret_cast<void*>(address.value().address));
|
||||
ASSERT(success);
|
||||
VERIFY(success);
|
||||
} else {
|
||||
bool success = session->remove_breakpoint(reinterpret_cast<void*>(address.value().address));
|
||||
ASSERT(success);
|
||||
VERIFY(success);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,14 +113,14 @@ int Debugger::start_static()
|
|||
void Debugger::start()
|
||||
{
|
||||
m_debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root);
|
||||
ASSERT(!!m_debug_session);
|
||||
VERIFY(!!m_debug_session);
|
||||
|
||||
for (const auto& breakpoint : m_breakpoints) {
|
||||
dbgln("inserting breakpoint at: {}:{}", breakpoint.file_path, breakpoint.line_number);
|
||||
auto address = m_debug_session->get_address_from_source_position(breakpoint.file_path, breakpoint.line_number);
|
||||
if (address.has_value()) {
|
||||
bool success = m_debug_session->insert_breakpoint(reinterpret_cast<void*>(address.value().address));
|
||||
ASSERT(success);
|
||||
VERIFY(success);
|
||||
} else {
|
||||
dbgln("couldn't insert breakpoint");
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ void Debugger::start()
|
|||
|
||||
int Debugger::debugger_loop()
|
||||
{
|
||||
ASSERT(m_debug_session);
|
||||
VERIFY(m_debug_session);
|
||||
|
||||
m_debug_session->run(Debug::DebugSession::DesiredInitialDebugeeState::Running, [this](Debug::DebugSession::DebugBreakReason reason, Optional<PtraceRegisters> optional_regs) {
|
||||
if (reason == Debug::DebugSession::DebugBreakReason::Exited) {
|
||||
|
@ -140,7 +140,7 @@ int Debugger::debugger_loop()
|
|||
return Debug::DebugSession::DebugDecision::Detach;
|
||||
}
|
||||
remove_temporary_breakpoints();
|
||||
ASSERT(optional_regs.has_value());
|
||||
VERIFY(optional_regs.has_value());
|
||||
const PtraceRegisters& regs = optional_regs.value();
|
||||
|
||||
auto source_position = m_debug_session->get_source_position(regs.eip);
|
||||
|
@ -151,7 +151,7 @@ int Debugger::debugger_loop()
|
|||
if (source_position.value().file_path.ends_with(".S"))
|
||||
return Debug::DebugSession::DebugDecision::SingleStep;
|
||||
|
||||
ASSERT(source_position.has_value());
|
||||
VERIFY(source_position.has_value());
|
||||
if (m_state.get() == Debugger::DebuggingState::SingleStepping) {
|
||||
if (m_state.should_stop_single_stepping(source_position.value())) {
|
||||
m_state.set_normal();
|
||||
|
@ -196,7 +196,7 @@ int Debugger::debugger_loop()
|
|||
dbgln("Debugger exiting");
|
||||
return Debug::DebugSession::DebugDecision::Detach;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
});
|
||||
m_debug_session.clear();
|
||||
return 0;
|
||||
|
@ -216,16 +216,16 @@ void Debugger::DebuggingState::set_single_stepping(Debug::DebugInfo::SourcePosit
|
|||
|
||||
bool Debugger::DebuggingState::should_stop_single_stepping(const Debug::DebugInfo::SourcePosition& current_source_position) const
|
||||
{
|
||||
ASSERT(m_state == State::SingleStepping);
|
||||
VERIFY(m_state == State::SingleStepping);
|
||||
return m_original_source_position.value() != current_source_position;
|
||||
}
|
||||
|
||||
void Debugger::remove_temporary_breakpoints()
|
||||
{
|
||||
for (auto breakpoint_address : m_state.temporary_breakpoints()) {
|
||||
ASSERT(m_debug_session->breakpoint_exists((void*)breakpoint_address));
|
||||
VERIFY(m_debug_session->breakpoint_exists((void*)breakpoint_address));
|
||||
bool rc = m_debug_session->remove_breakpoint((void*)breakpoint_address);
|
||||
ASSERT(rc);
|
||||
VERIFY(rc);
|
||||
}
|
||||
m_state.clear_temporary_breakpoints();
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ void Debugger::do_step_over(const PtraceRegisters& regs)
|
|||
dbgln("cannot perform step_over, failed to find containing function of: {:p}", regs.eip);
|
||||
return;
|
||||
}
|
||||
ASSERT(current_function.has_value());
|
||||
VERIFY(current_function.has_value());
|
||||
auto lines_in_current_function = lib->debug_info->source_lines_in_scope(current_function.value());
|
||||
for (const auto& line : lines_in_current_function) {
|
||||
insert_temporary_breakpoint(line.address_of_first_statement.value() + lib->base_address);
|
||||
|
@ -270,7 +270,7 @@ void Debugger::do_step_over(const PtraceRegisters& regs)
|
|||
void Debugger::insert_temporary_breakpoint_at_return_address(const PtraceRegisters& regs)
|
||||
{
|
||||
auto frame_info = Debug::StackFrameUtils::get_info(*m_debug_session, regs.ebp);
|
||||
ASSERT(frame_info.has_value());
|
||||
VERIFY(frame_info.has_value());
|
||||
u32 return_address = frame_info.value().return_address;
|
||||
insert_temporary_breakpoint(return_address);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void Debugger::insert_temporary_breakpoint(FlatPtr address)
|
|||
if (m_debug_session->breakpoint_exists((void*)address))
|
||||
return;
|
||||
bool success = m_debug_session->insert_breakpoint(reinterpret_cast<void*>(address));
|
||||
ASSERT(success);
|
||||
VERIFY(success);
|
||||
m_state.add_temporary_breakpoint(address);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con
|
|||
auto symbol = elf->find_symbol(containing_function.value().address_low);
|
||||
if (!symbol.has_value())
|
||||
return;
|
||||
ASSERT(symbol.has_value());
|
||||
VERIFY(symbol.has_value());
|
||||
|
||||
auto view = symbol.value().raw_data();
|
||||
|
||||
|
@ -104,7 +104,7 @@ String DisassemblyModel::column_name(int column) const
|
|||
case Column::Disassembly:
|
||||
return "Disassembly";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ String RegistersModel::column_name(int column) const
|
|||
case Column::Value:
|
||||
return "Value";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,14 +52,14 @@ GUI::ModelIndex VariablesModel::parent_index(const GUI::ModelIndex& index) const
|
|||
for (size_t row = 0; row < m_variables.size(); row++)
|
||||
if (m_variables.ptr_at(row).ptr() == parent)
|
||||
return create_index(row, 0, parent);
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
for (size_t row = 0; row < parent->parent->members.size(); row++) {
|
||||
Debug::DebugInfo::VariableInfo* child_at_row = parent->parent->members.ptr_at(row).ptr();
|
||||
if (child_at_row == parent)
|
||||
return create_index(row, 0, parent);
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
int VariablesModel::row_count(const GUI::ModelIndex& index) const
|
||||
|
@ -79,29 +79,29 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var
|
|||
|
||||
if (variable.is_enum_type()) {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
ASSERT(value.has_value());
|
||||
VERIFY(value.has_value());
|
||||
auto it = variable.type->members.find_if([&enumerator_value = value.value()](const auto& enumerator) {
|
||||
return enumerator->constant_data.as_u32 == enumerator_value;
|
||||
});
|
||||
ASSERT(!it.is_end());
|
||||
VERIFY(!it.is_end());
|
||||
return String::formatted("{}::{}", variable.type_name, (*it)->name);
|
||||
}
|
||||
|
||||
if (variable.type_name == "int") {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
ASSERT(value.has_value());
|
||||
VERIFY(value.has_value());
|
||||
return String::formatted("{}", static_cast<int>(value.value()));
|
||||
}
|
||||
|
||||
if (variable.type_name == "char") {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
ASSERT(value.has_value());
|
||||
VERIFY(value.has_value());
|
||||
return String::formatted("'{0:c}' ({0:d})", value.value());
|
||||
}
|
||||
|
||||
if (variable.type_name == "bool") {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
ASSERT(value.has_value());
|
||||
VERIFY(value.has_value());
|
||||
return (value.value() & 1) ? "true" : "false";
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, const Stri
|
|||
|
||||
if (value.has_value()) {
|
||||
auto success = Debugger::the().session()->poke((u32*)variable->location_data.address, value.value());
|
||||
ASSERT(success);
|
||||
VERIFY(success);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ RefPtr<ProjectTemplate> NewProjectDialog::selected_template()
|
|||
}
|
||||
|
||||
auto project_template = m_model->template_for_index(m_icon_view->selection().first());
|
||||
ASSERT(!project_template.is_null());
|
||||
VERIFY(!project_template.is_null());
|
||||
|
||||
return project_template;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ String ProjectTemplatesModel::column_name(int column) const
|
|||
case Column::Name:
|
||||
return "Name";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
GUI::Variant ProjectTemplatesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
|
|
|
@ -385,7 +385,7 @@ const Gfx::Bitmap& Editor::current_position_icon_bitmap()
|
|||
const CodeDocument& Editor::code_document() const
|
||||
{
|
||||
const auto& doc = document();
|
||||
ASSERT(doc.is_code_document());
|
||||
VERIFY(doc.is_code_document());
|
||||
return static_cast<const CodeDocument&>(doc);
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ CodeDocument& Editor::code_document()
|
|||
|
||||
void Editor::set_document(GUI::TextDocument& doc)
|
||||
{
|
||||
ASSERT(doc.is_code_document());
|
||||
VERIFY(doc.is_code_document());
|
||||
GUI::TextEditor::set_document(doc);
|
||||
|
||||
set_override_cursor(Gfx::StandardCursor::IBeam);
|
||||
|
@ -487,7 +487,7 @@ void Editor::on_edit_action(const GUI::Command& command)
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void Editor::undo()
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
case Column::MatchedText:
|
||||
return "Text";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
void remove(GUI::Widget& widget)
|
||||
{
|
||||
ASSERT(m_widgets.contains(&widget));
|
||||
VERIFY(m_widgets.contains(&widget));
|
||||
m_widgets.remove(&widget);
|
||||
if (m_hooks_enabled && on_remove)
|
||||
on_remove(widget);
|
||||
|
|
|
@ -86,7 +86,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event)
|
|||
right_y_offset += line_height();
|
||||
}
|
||||
|
||||
ASSERT(left_y_offset == right_y_offset);
|
||||
VERIFY(left_y_offset == right_y_offset);
|
||||
y_offset = left_y_offset;
|
||||
}
|
||||
for (size_t i = current_original_line_index; i < m_original_lines.size(); ++i) {
|
||||
|
|
|
@ -75,7 +75,7 @@ void GitFilesView::mousedown_event(GUI::MouseEvent& event)
|
|||
|
||||
auto data = model()->index(item_index, model_column()).data();
|
||||
|
||||
ASSERT(data.is_string());
|
||||
VERIFY(data.is_string());
|
||||
m_action_callback(LexicalPath(data.to_string()));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ RefPtr<GitRepo> GitRepo::initialize_repository(const LexicalPath& repository_roo
|
|||
if (res.is_null())
|
||||
return {};
|
||||
|
||||
ASSERT(git_repo_exists(repository_root));
|
||||
VERIFY(git_repo_exists(repository_root));
|
||||
return adopt(*new GitRepo(repository_root));
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ bool GitWidget::initialize()
|
|||
return true;
|
||||
}
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ void GitWidget::refresh()
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT(!m_git_repo.is_null());
|
||||
VERIFY(!m_git_repo.is_null());
|
||||
|
||||
m_unstaged_files->set_model(GitFilesModel::create(m_git_repo->unstaged_files()));
|
||||
m_staged_files->set_model(GitFilesModel::create(m_git_repo->staged_files()));
|
||||
|
@ -138,7 +138,7 @@ void GitWidget::stage_file(const LexicalPath& file)
|
|||
{
|
||||
dbgln("staging: {}", file);
|
||||
bool rc = m_git_repo->stage(file);
|
||||
ASSERT(rc);
|
||||
VERIFY(rc);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ void GitWidget::unstage_file(const LexicalPath& file)
|
|||
{
|
||||
dbgln("unstaging: {}", file);
|
||||
bool rc = m_git_repo->unstage(file);
|
||||
ASSERT(rc);
|
||||
VERIFY(rc);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ void GitWidget::show_diff(const LexicalPath& file_path)
|
|||
auto file = Core::File::construct(file_path.string());
|
||||
if (!file->open(Core::IODevice::ReadOnly)) {
|
||||
perror("open");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
auto content = file->read_all();
|
||||
|
@ -182,7 +182,7 @@ void GitWidget::show_diff(const LexicalPath& file_path)
|
|||
}
|
||||
const auto& original_content = m_git_repo->original_file_content(file_path);
|
||||
const auto& diff = m_git_repo->unstaged_diff(file_path);
|
||||
ASSERT(original_content.has_value() && diff.has_value());
|
||||
VERIFY(original_content.has_value() && diff.has_value());
|
||||
m_view_diff_callback(original_content.value(), diff.value());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ void HackStudioWidget::open_project(const String& root_path)
|
|||
exit(1);
|
||||
}
|
||||
m_project = Project::open_with_root_path(root_path);
|
||||
ASSERT(m_project);
|
||||
VERIFY(m_project);
|
||||
if (m_project_tree_view) {
|
||||
m_project_tree_view->set_model(m_project->model());
|
||||
m_project_tree_view->update();
|
||||
|
@ -222,7 +222,7 @@ void HackStudioWidget::open_file(const String& full_filename)
|
|||
|
||||
if (!currently_open_file().is_empty()) {
|
||||
// Since the file is previously open, it should always be in m_open_files.
|
||||
ASSERT(m_open_files.find(currently_open_file()) != m_open_files.end());
|
||||
VERIFY(m_open_files.find(currently_open_file()) != m_open_files.end());
|
||||
auto previous_open_project_file = m_open_files.get(currently_open_file()).value();
|
||||
|
||||
// Update the scrollbar values of the previous_open_project_file and save them to m_open_files.
|
||||
|
@ -272,7 +272,7 @@ void HackStudioWidget::open_file(const String& full_filename)
|
|||
|
||||
EditorWrapper& HackStudioWidget::current_editor_wrapper()
|
||||
{
|
||||
ASSERT(m_current_editor_wrapper);
|
||||
VERIFY(m_current_editor_wrapper);
|
||||
return *m_current_editor_wrapper;
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ void HackStudioWidget::set_edit_mode(EditMode mode)
|
|||
} else if (mode == EditMode::Diff) {
|
||||
m_right_hand_stack->set_active_widget(m_diff_viewer);
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
m_right_hand_stack->active_widget()->update();
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ void HackStudioWidget::initialize_debugger()
|
|||
Debugger::initialize(
|
||||
m_project->root_path(),
|
||||
[this](const PtraceRegisters& regs) {
|
||||
ASSERT(Debugger::the().session());
|
||||
VERIFY(Debugger::the().session());
|
||||
const auto& debug_session = *Debugger::the().session();
|
||||
auto source_position = debug_session.get_source_position(regs.eip);
|
||||
if (!source_position.has_value()) {
|
||||
|
@ -610,7 +610,7 @@ void HackStudioWidget::initialize_debugger()
|
|||
String HackStudioWidget::get_full_path_of_serenity_source(const String& file)
|
||||
{
|
||||
auto path_parts = LexicalPath(file).parts();
|
||||
ASSERT(path_parts[0] == "..");
|
||||
VERIFY(path_parts[0] == "..");
|
||||
path_parts.remove(0);
|
||||
StringBuilder relative_path_builder;
|
||||
relative_path_builder.join("/", path_parts);
|
||||
|
|
|
@ -117,7 +117,7 @@ void LanguageClient::set_active_client()
|
|||
|
||||
void LanguageClient::on_server_crash()
|
||||
{
|
||||
ASSERT(m_server_connection);
|
||||
VERIFY(m_server_connection);
|
||||
auto project_path = m_server_connection->projcet_path();
|
||||
ServerConnection::remove_instance_for_project(project_path);
|
||||
m_server_connection = nullptr;
|
||||
|
|
|
@ -105,14 +105,14 @@ public:
|
|||
: m_server_connection(move(connection))
|
||||
{
|
||||
m_previous_client = m_server_connection->language_client();
|
||||
ASSERT(m_previous_client.ptr() != this);
|
||||
VERIFY(m_previous_client.ptr() != this);
|
||||
m_server_connection->attach(*this);
|
||||
}
|
||||
|
||||
virtual ~LanguageClient()
|
||||
{
|
||||
m_server_connection->detach();
|
||||
ASSERT(m_previous_client.ptr() != this);
|
||||
VERIFY(m_previous_client.ptr() != this);
|
||||
if (m_previous_client)
|
||||
m_server_connection->attach(*m_previous_client);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ String FileDB::to_absolute_path(const String& file_name) const
|
|||
if (LexicalPath { file_name }.is_absolute()) {
|
||||
return file_name;
|
||||
}
|
||||
ASSERT(!m_project_root.is_null());
|
||||
VERIFY(!m_project_root.is_null());
|
||||
return LexicalPath { String::formatted("{}/{}", m_project_root, file_name) }.string();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ Vector<GUI::AutocompleteProvider::Entry> LexerAutoComplete::get_suggestions(cons
|
|||
|
||||
StringView LexerAutoComplete::text_of_token(const Vector<String>& lines, const Cpp::Token& token)
|
||||
{
|
||||
ASSERT(token.m_start.line == token.m_end.line);
|
||||
ASSERT(token.m_start.column <= token.m_end.column);
|
||||
VERIFY(token.m_start.line == token.m_end.line);
|
||||
VERIFY(token.m_start.column <= token.m_end.column);
|
||||
return lines[token.m_start.line].substring_view(token.m_start.column, token.m_end.column - token.m_start.column + 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,14 +53,14 @@ const ParserAutoComplete::DocumentData& ParserAutoComplete::get_document_data(co
|
|||
{
|
||||
auto absolute_path = filedb().to_absolute_path(file);
|
||||
auto document_data = m_documents.get(absolute_path);
|
||||
ASSERT(document_data.has_value());
|
||||
VERIFY(document_data.has_value());
|
||||
return *document_data.value();
|
||||
}
|
||||
|
||||
OwnPtr<ParserAutoComplete::DocumentData> ParserAutoComplete::create_document_data_for(const String& file)
|
||||
{
|
||||
auto document = filedb().get(file);
|
||||
ASSERT(document);
|
||||
VERIFY(document);
|
||||
auto content = document->text();
|
||||
auto document_data = make<DocumentData>(document->text(), file);
|
||||
auto root = document_data->parser.parse();
|
||||
|
@ -107,7 +107,7 @@ Vector<GUI::AutocompleteProvider::Entry> ParserAutoComplete::get_suggestions(con
|
|||
}
|
||||
|
||||
if (is_empty_property(document, *node, position)) {
|
||||
ASSERT(node->is_member_expression());
|
||||
VERIFY(node->is_member_expression());
|
||||
return autocomplete_property(document, (MemberExpression&)(*node), "");
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ String ParserAutoComplete::type_of(const DocumentData& document, const Expressio
|
|||
return type_of_property(document, *member_expression.m_property);
|
||||
}
|
||||
if (!expression.is_identifier()) {
|
||||
ASSERT_NOT_REACHED(); // TODO
|
||||
VERIFY_NOT_REACHED(); // TODO
|
||||
}
|
||||
|
||||
auto& identifier = (const Identifier&)expression;
|
||||
|
@ -350,7 +350,7 @@ RefPtr<Declaration> ParserAutoComplete::find_declaration_of(const DocumentData&
|
|||
}
|
||||
if (is_property(node) && decl.is_struct_or_class()) {
|
||||
for (auto& member : ((Cpp::StructOrClassDeclaration&)decl).m_members) {
|
||||
ASSERT(node.is_identifier());
|
||||
VERIFY(node.is_identifier());
|
||||
if (member.m_name == ((const Identifier&)node).m_name)
|
||||
return member;
|
||||
}
|
||||
|
|
|
@ -55,15 +55,15 @@ void TerminalWrapper::run_command(const String& command)
|
|||
int ptm_fd = posix_openpt(O_RDWR | O_CLOEXEC);
|
||||
if (ptm_fd < 0) {
|
||||
perror("posix_openpt");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
if (grantpt(ptm_fd) < 0) {
|
||||
perror("grantpt");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
if (unlockpt(ptm_fd) < 0) {
|
||||
perror("unlockpt");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
m_terminal_widget->set_pty_master_fd(ptm_fd);
|
||||
|
@ -72,7 +72,7 @@ void TerminalWrapper::run_command(const String& command)
|
|||
int rc = waitpid(m_pid, &wstatus, 0);
|
||||
if (rc < 0) {
|
||||
perror("waitpid");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
if (WIFEXITED(wstatus)) {
|
||||
m_terminal_widget->inject_string(String::formatted("\033[{};1m(Command exited with code {})\033[0m\n", wstatus == 0 ? 32 : 31, WEXITSTATUS(wstatus)));
|
||||
|
@ -147,7 +147,7 @@ void TerminalWrapper::run_command(const String& command)
|
|||
setenv("TERM", "xterm", true);
|
||||
|
||||
auto parts = command.split(' ');
|
||||
ASSERT(!parts.is_empty());
|
||||
VERIFY(!parts.is_empty());
|
||||
const char** args = (const char**)calloc(parts.size() + 1, sizeof(const char*));
|
||||
for (size_t i = 0; i < parts.size(); i++) {
|
||||
args[i] = parts[i].characters();
|
||||
|
@ -157,7 +157,7 @@ void TerminalWrapper::run_command(const String& command)
|
|||
perror("execve");
|
||||
exit(1);
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// (In parent process)
|
||||
|
@ -166,7 +166,7 @@ void TerminalWrapper::run_command(const String& command)
|
|||
|
||||
void TerminalWrapper::kill_running_command()
|
||||
{
|
||||
ASSERT(m_pid != -1);
|
||||
VERIFY(m_pid != -1);
|
||||
|
||||
// Kill our child process and its whole process group.
|
||||
[[maybe_unused]] auto rc = killpg(m_pid, SIGTERM);
|
||||
|
|
|
@ -69,7 +69,7 @@ GUI::ModelIndex WidgetTreeModel::parent_index(const GUI::ModelIndex& index) cons
|
|||
++grandparent_child_index;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ int main(int argc, char** argv)
|
|||
if (lexer.peek() != ch)
|
||||
warnln("assert_specific: wanted '{}', but got '{}' at index {}", ch, lexer.peek(), lexer.tell());
|
||||
bool saw_expected = lexer.consume_specific(ch);
|
||||
ASSERT(saw_expected);
|
||||
VERIFY(saw_expected);
|
||||
};
|
||||
|
||||
auto consume_whitespace = [&] {
|
||||
|
@ -153,7 +153,7 @@ int main(int argc, char** argv)
|
|||
else if (type == '|')
|
||||
message.is_synchronous = false;
|
||||
else
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
consume_whitespace();
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde
|
|||
if (&m_process.roots()[row] == remote_object.parent)
|
||||
return create_index(row, 0, remote_object.parent);
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde
|
|||
return create_index(row, 0, remote_object.parent);
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ String RemoteObjectPropertyModel::column_name(int column) const
|
|||
case Column::Value:
|
||||
return "Value";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
|
|
|
@ -52,7 +52,7 @@ RemoteProcess::RemoteProcess(pid_t pid)
|
|||
void RemoteProcess::handle_identify_response(const JsonObject& response)
|
||||
{
|
||||
int pid = response.get("pid").to_int();
|
||||
ASSERT(pid == m_pid);
|
||||
VERIFY(pid == m_pid);
|
||||
|
||||
m_process_name = response.get("process_name").as_string_or({});
|
||||
|
||||
|
@ -70,7 +70,7 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response)
|
|||
HashMap<FlatPtr, RemoteObject*> objects_by_address;
|
||||
|
||||
for (auto& value : object_array.values()) {
|
||||
ASSERT(value.is_object());
|
||||
VERIFY(value.is_object());
|
||||
auto& object = value.as_object();
|
||||
auto remote_object = make<RemoteObject>();
|
||||
remote_object->address = object.get("address").to_number<FlatPtr>();
|
||||
|
@ -169,12 +169,12 @@ void RemoteProcess::update()
|
|||
remaining_bytes -= packet.size();
|
||||
}
|
||||
|
||||
ASSERT(data.size() == length);
|
||||
VERIFY(data.size() == length);
|
||||
dbgln("Got data size {} and read that many bytes", length);
|
||||
|
||||
auto json_value = JsonValue::from_string(data);
|
||||
ASSERT(json_value.has_value());
|
||||
ASSERT(json_value.value().is_object());
|
||||
VERIFY(json_value.has_value());
|
||||
VERIFY(json_value.value().is_object());
|
||||
|
||||
dbgln("Got JSON response {}", json_value.value());
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ static const Gfx::Bitmap& heat_gradient()
|
|||
|
||||
static Color color_for_percent(int percent)
|
||||
{
|
||||
ASSERT(percent >= 0 && percent <= 100);
|
||||
VERIFY(percent >= 0 && percent <= 100);
|
||||
return heat_gradient().get_pixel(percent, 0);
|
||||
}
|
||||
|
||||
|
@ -77,14 +77,14 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
|
|||
base_address = library_data->base;
|
||||
}
|
||||
|
||||
ASSERT(elf != nullptr);
|
||||
VERIFY(elf != nullptr);
|
||||
|
||||
auto symbol = elf->find_symbol(node.address() - base_address);
|
||||
if (!symbol.has_value()) {
|
||||
dbgln("DisassemblyModel: symbol not found");
|
||||
return;
|
||||
}
|
||||
ASSERT(symbol.has_value());
|
||||
VERIFY(symbol.has_value());
|
||||
|
||||
auto view = symbol.value().raw_data();
|
||||
|
||||
|
@ -132,7 +132,7 @@ String DisassemblyModel::column_name(int column) const
|
|||
case Column::Disassembly:
|
||||
return "Disassembly";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
{
|
||||
if (child.m_parent == this)
|
||||
return;
|
||||
ASSERT(!child.m_parent);
|
||||
VERIFY(!child.m_parent);
|
||||
child.m_parent = this;
|
||||
m_children.append(child);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const
|
|||
return create_index(row, index.column(), node.parent());
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const
|
|||
return create_index(row, index.column(), node.parent());
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ String ProfileModel::column_name(int column) const
|
|||
case Column::StackFrame:
|
||||
return "Stack Frame";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static Emulator* s_the;
|
|||
|
||||
Emulator& Emulator::the()
|
||||
{
|
||||
ASSERT(s_the);
|
||||
VERIFY(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ Emulator::Emulator(const String& executable_path, const Vector<String>& argument
|
|||
|
||||
m_range_allocator.initialize_with_range(VirtualAddress(base), userspace_range_ceiling - base);
|
||||
|
||||
ASSERT(!s_the);
|
||||
VERIFY(!s_the);
|
||||
s_the = this;
|
||||
// setup_stack(arguments, environment);
|
||||
register_signal_handlers();
|
||||
|
@ -190,7 +190,7 @@ bool Emulator::load_elf()
|
|||
|
||||
if (!executable_elf.is_dynamic()) {
|
||||
// FIXME: Support static objects
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
String interpreter_path;
|
||||
|
@ -199,18 +199,18 @@ bool Emulator::load_elf()
|
|||
return false;
|
||||
}
|
||||
|
||||
ASSERT(!interpreter_path.is_null());
|
||||
VERIFY(!interpreter_path.is_null());
|
||||
dbgln("interpreter: {}", interpreter_path);
|
||||
|
||||
auto interpreter_file_or_error = MappedFile::map(interpreter_path);
|
||||
ASSERT(!interpreter_file_or_error.is_error());
|
||||
VERIFY(!interpreter_file_or_error.is_error());
|
||||
auto interpreter_image_data = interpreter_file_or_error.value()->bytes();
|
||||
ELF::Image interpreter_image(interpreter_image_data);
|
||||
|
||||
constexpr FlatPtr interpreter_load_offset = 0x08000000;
|
||||
interpreter_image.for_each_program_header([&](const ELF::Image::ProgramHeader& program_header) {
|
||||
// Loader is not allowed to have its own TLS regions
|
||||
ASSERT(program_header.type() != PT_TLS);
|
||||
VERIFY(program_header.type() != PT_TLS);
|
||||
|
||||
if (program_header.type() == PT_LOAD) {
|
||||
auto region = make<SimpleRegion>(program_header.vaddr().offset(interpreter_load_offset).get(), program_header.size_in_memory());
|
||||
|
@ -983,7 +983,7 @@ int Emulator::virt$pipe(FlatPtr vm_pipefd, int flags)
|
|||
u32 Emulator::virt$munmap(FlatPtr address, u32 size)
|
||||
{
|
||||
auto* region = mmu().find_region({ 0x23, address });
|
||||
ASSERT(region);
|
||||
VERIFY(region);
|
||||
if (region->size() != round_up_to_power_of_two(size, PAGE_SIZE))
|
||||
TODO();
|
||||
m_range_allocator.deallocate(region->range());
|
||||
|
@ -1024,7 +1024,7 @@ u32 Emulator::virt$mmap(u32 params_addr)
|
|||
auto region = MmapRegion::create_file_backed(final_address, final_size, params.prot, params.flags, params.fd, params.offset, name_str);
|
||||
if (region->name() == "libc.so: .text (Emulated)") {
|
||||
bool rc = find_malloc_symbols(*region);
|
||||
ASSERT(rc);
|
||||
VERIFY(rc);
|
||||
}
|
||||
mmu().add_region(move(region));
|
||||
}
|
||||
|
@ -1040,7 +1040,7 @@ FlatPtr Emulator::virt$mremap(FlatPtr params_addr)
|
|||
if (auto* region = mmu().find_region({ m_cpu.ds(), params.old_address })) {
|
||||
if (!is<MmapRegion>(*region))
|
||||
return -EINVAL;
|
||||
ASSERT(region->size() == params.old_size);
|
||||
VERIFY(region->size() == params.old_size);
|
||||
auto& mmap_region = *(MmapRegion*)region;
|
||||
auto* ptr = mremap(mmap_region.data(), mmap_region.size(), mmap_region.size(), params.flags);
|
||||
if (ptr == MAP_FAILED)
|
||||
|
@ -1089,7 +1089,7 @@ u32 Emulator::virt$mprotect(FlatPtr base, size_t size, int prot)
|
|||
if (auto* region = mmu().find_region({ m_cpu.ds(), base })) {
|
||||
if (!is<MmapRegion>(*region))
|
||||
return -EINVAL;
|
||||
ASSERT(region->size() == size);
|
||||
VERIFY(region->size() == size);
|
||||
auto& mmap_region = *(MmapRegion*)region;
|
||||
mmap_region.set_prot(prot);
|
||||
return 0;
|
||||
|
@ -1420,7 +1420,7 @@ enum class DefaultSignalAction {
|
|||
|
||||
static DefaultSignalAction default_signal_action(int signal)
|
||||
{
|
||||
ASSERT(signal && signal < NSIG);
|
||||
VERIFY(signal && signal < NSIG);
|
||||
|
||||
switch (signal) {
|
||||
case SIGHUP:
|
||||
|
@ -1460,7 +1460,7 @@ static DefaultSignalAction default_signal_action(int signal)
|
|||
case SIGTTOU:
|
||||
return DefaultSignalAction::Stop;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void Emulator::dispatch_one_pending_signal()
|
||||
|
@ -1471,7 +1471,7 @@ void Emulator::dispatch_one_pending_signal()
|
|||
if (m_pending_signals & mask)
|
||||
break;
|
||||
}
|
||||
ASSERT(signum != -1);
|
||||
VERIFY(signum != -1);
|
||||
m_pending_signals &= ~(1 << signum);
|
||||
|
||||
auto& handler = m_signal_handler[signum];
|
||||
|
@ -1516,7 +1516,7 @@ void Emulator::dispatch_one_pending_signal()
|
|||
m_cpu.push32(shadow_wrap_as_initialized(handler.handler));
|
||||
m_cpu.push32(shadow_wrap_as_initialized(0u));
|
||||
|
||||
ASSERT((m_cpu.esp().value() % 16) == 0);
|
||||
VERIFY((m_cpu.esp().value() % 16) == 0);
|
||||
|
||||
m_cpu.set_eip(m_signal_trampoline);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t siz
|
|||
if (m_emulator.is_in_loader_code())
|
||||
return;
|
||||
auto* region = m_emulator.mmu().find_region({ 0x23, address });
|
||||
ASSERT(region);
|
||||
ASSERT(is<MmapRegion>(*region));
|
||||
VERIFY(region);
|
||||
VERIFY(is<MmapRegion>(*region));
|
||||
auto& mmap_region = static_cast<MmapRegion&>(*region);
|
||||
|
||||
// Mark the containing mmap region as a malloc block!
|
||||
|
@ -71,7 +71,7 @@ void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t siz
|
|||
memset(shadow_bits, 0, size);
|
||||
|
||||
if (auto* existing_mallocation = find_mallocation(address)) {
|
||||
ASSERT(existing_mallocation->freed);
|
||||
VERIFY(existing_mallocation->freed);
|
||||
existing_mallocation->size = size;
|
||||
existing_mallocation->freed = false;
|
||||
existing_mallocation->malloc_backtrace = m_emulator.raw_backtrace();
|
||||
|
@ -110,7 +110,7 @@ ALWAYS_INLINE size_t MallocRegionMetadata::chunk_index_for_address(FlatPtr addre
|
|||
return 0;
|
||||
}
|
||||
auto chunk_offset = address - (this->address + sizeof(ChunkedBlock));
|
||||
ASSERT(this->chunk_size);
|
||||
VERIFY(this->chunk_size);
|
||||
return chunk_offset / this->chunk_size;
|
||||
}
|
||||
|
||||
|
@ -143,15 +143,15 @@ void MallocTracer::target_did_realloc(Badge<SoftCPU>, FlatPtr address, size_t si
|
|||
if (m_emulator.is_in_loader_code())
|
||||
return;
|
||||
auto* region = m_emulator.mmu().find_region({ 0x23, address });
|
||||
ASSERT(region);
|
||||
ASSERT(is<MmapRegion>(*region));
|
||||
VERIFY(region);
|
||||
VERIFY(is<MmapRegion>(*region));
|
||||
auto& mmap_region = static_cast<MmapRegion&>(*region);
|
||||
|
||||
ASSERT(mmap_region.is_malloc_block());
|
||||
VERIFY(mmap_region.is_malloc_block());
|
||||
|
||||
auto* existing_mallocation = find_mallocation(address);
|
||||
ASSERT(existing_mallocation);
|
||||
ASSERT(!existing_mallocation->freed);
|
||||
VERIFY(existing_mallocation);
|
||||
VERIFY(!existing_mallocation->freed);
|
||||
|
||||
size_t old_size = existing_mallocation->size;
|
||||
|
||||
|
@ -296,7 +296,7 @@ void MallocTracer::audit_write(const Region& region, FlatPtr address, size_t siz
|
|||
|
||||
bool MallocTracer::is_reachable(const Mallocation& mallocation) const
|
||||
{
|
||||
ASSERT(!mallocation.freed);
|
||||
VERIFY(!mallocation.freed);
|
||||
|
||||
bool reachable = false;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ ALWAYS_INLINE Mallocation* MallocTracer::find_mallocation(const Region& region,
|
|||
auto& mallocation = malloc_data->mallocation_for_address(address);
|
||||
if (!mallocation.used)
|
||||
return nullptr;
|
||||
ASSERT(mallocation.contains(address));
|
||||
VERIFY(mallocation.contains(address));
|
||||
return &mallocation;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32
|
|||
region->m_name = name;
|
||||
}
|
||||
region->m_data = (u8*)mmap_with_name(nullptr, size, prot, flags, fd, offset, name.is_empty() ? nullptr : name.characters());
|
||||
ASSERT(region->m_data != MAP_FAILED);
|
||||
VERIFY(region->m_data != MAP_FAILED);
|
||||
return region;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ ValueWithShadow<u8> MmapRegion::read8(FlatPtr offset)
|
|||
tracer->audit_read(*this, base() + offset, 1);
|
||||
}
|
||||
|
||||
ASSERT(offset < size());
|
||||
VERIFY(offset < size());
|
||||
return { *reinterpret_cast<const u8*>(m_data + offset), *reinterpret_cast<const u8*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ ValueWithShadow<u16> MmapRegion::read16(u32 offset)
|
|||
tracer->audit_read(*this, base() + offset, 2);
|
||||
}
|
||||
|
||||
ASSERT(offset + 1 < size());
|
||||
VERIFY(offset + 1 < size());
|
||||
return { *reinterpret_cast<const u16*>(m_data + offset), *reinterpret_cast<const u16*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ ValueWithShadow<u32> MmapRegion::read32(u32 offset)
|
|||
tracer->audit_read(*this, base() + offset, 4);
|
||||
}
|
||||
|
||||
ASSERT(offset + 3 < size());
|
||||
VERIFY(offset + 3 < size());
|
||||
return { *reinterpret_cast<const u32*>(m_data + offset), *reinterpret_cast<const u32*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ ValueWithShadow<u64> MmapRegion::read64(u32 offset)
|
|||
tracer->audit_read(*this, base() + offset, 8);
|
||||
}
|
||||
|
||||
ASSERT(offset + 7 < size());
|
||||
VERIFY(offset + 7 < size());
|
||||
return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ void MmapRegion::write8(u32 offset, ValueWithShadow<u8> value)
|
|||
tracer->audit_write(*this, base() + offset, 1);
|
||||
}
|
||||
|
||||
ASSERT(offset < size());
|
||||
VERIFY(offset < size());
|
||||
*reinterpret_cast<u8*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u8*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void MmapRegion::write16(u32 offset, ValueWithShadow<u16> value)
|
|||
tracer->audit_write(*this, base() + offset, 2);
|
||||
}
|
||||
|
||||
ASSERT(offset + 1 < size());
|
||||
VERIFY(offset + 1 < size());
|
||||
*reinterpret_cast<u16*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u16*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
@ -186,8 +186,8 @@ void MmapRegion::write32(u32 offset, ValueWithShadow<u32> value)
|
|||
tracer->audit_write(*this, base() + offset, 4);
|
||||
}
|
||||
|
||||
ASSERT(offset + 3 < size());
|
||||
ASSERT(m_data != m_shadow_data);
|
||||
VERIFY(offset + 3 < size());
|
||||
VERIFY(m_data != m_shadow_data);
|
||||
*reinterpret_cast<u32*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u32*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
@ -205,8 +205,8 @@ void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value)
|
|||
tracer->audit_write(*this, base() + offset, 8);
|
||||
}
|
||||
|
||||
ASSERT(offset + 7 < size());
|
||||
ASSERT(m_data != m_shadow_data);
|
||||
VERIFY(offset + 7 < size());
|
||||
VERIFY(m_data != m_shadow_data);
|
||||
*reinterpret_cast<u64*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace UserspaceEmulator {
|
|||
|
||||
Vector<Range, 2> Range::carve(const Range& taken)
|
||||
{
|
||||
ASSERT((taken.size() % PAGE_SIZE) == 0);
|
||||
VERIFY((taken.size() % PAGE_SIZE) == 0);
|
||||
Vector<Range, 2> parts;
|
||||
if (taken == *this)
|
||||
return {};
|
||||
|
|
|
@ -61,11 +61,11 @@ void RangeAllocator::dump() const
|
|||
void RangeAllocator::carve_at_index(int index, const Range& range)
|
||||
{
|
||||
auto remaining_parts = m_available_ranges[index].carve(range);
|
||||
ASSERT(remaining_parts.size() >= 1);
|
||||
ASSERT(m_total_range.contains(remaining_parts[0]));
|
||||
VERIFY(remaining_parts.size() >= 1);
|
||||
VERIFY(m_total_range.contains(remaining_parts[0]));
|
||||
m_available_ranges[index] = remaining_parts[0];
|
||||
if (remaining_parts.size() == 2) {
|
||||
ASSERT(m_total_range.contains(remaining_parts[1]));
|
||||
VERIFY(m_total_range.contains(remaining_parts[1]));
|
||||
m_available_ranges.insert(index + 1, move(remaining_parts[1]));
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ Optional<Range> RangeAllocator::allocate_randomized(size_t size, size_t alignmen
|
|||
if (!size)
|
||||
return {};
|
||||
|
||||
ASSERT((size % PAGE_SIZE) == 0);
|
||||
ASSERT((alignment % PAGE_SIZE) == 0);
|
||||
VERIFY((size % PAGE_SIZE) == 0);
|
||||
VERIFY((alignment % PAGE_SIZE) == 0);
|
||||
|
||||
// FIXME: I'm sure there's a smarter way to do this.
|
||||
static constexpr size_t maximum_randomization_attempts = 1000;
|
||||
|
@ -100,8 +100,8 @@ Optional<Range> RangeAllocator::allocate_anywhere(size_t size, size_t alignment)
|
|||
if (!size)
|
||||
return {};
|
||||
|
||||
ASSERT((size % PAGE_SIZE) == 0);
|
||||
ASSERT((alignment % PAGE_SIZE) == 0);
|
||||
VERIFY((size % PAGE_SIZE) == 0);
|
||||
VERIFY((alignment % PAGE_SIZE) == 0);
|
||||
|
||||
#ifdef VM_GUARD_PAGES
|
||||
// NOTE: We pad VM allocations with a guard page on each side.
|
||||
|
@ -128,7 +128,7 @@ Optional<Range> RangeAllocator::allocate_anywhere(size_t size, size_t alignment)
|
|||
FlatPtr aligned_base = round_up_to_power_of_two(initial_base, alignment);
|
||||
|
||||
Range allocated_range(VirtualAddress(aligned_base), size);
|
||||
ASSERT(m_total_range.contains(allocated_range));
|
||||
VERIFY(m_total_range.contains(allocated_range));
|
||||
|
||||
if (available_range == allocated_range) {
|
||||
m_available_ranges.remove(i);
|
||||
|
@ -146,13 +146,13 @@ Optional<Range> RangeAllocator::allocate_specific(VirtualAddress base, size_t si
|
|||
if (!size)
|
||||
return {};
|
||||
|
||||
ASSERT(base.is_page_aligned());
|
||||
ASSERT((size % PAGE_SIZE) == 0);
|
||||
VERIFY(base.is_page_aligned());
|
||||
VERIFY((size % PAGE_SIZE) == 0);
|
||||
|
||||
Range allocated_range(base, size);
|
||||
for (size_t i = 0; i < m_available_ranges.size(); ++i) {
|
||||
auto& available_range = m_available_ranges[i];
|
||||
ASSERT(m_total_range.contains(allocated_range));
|
||||
VERIFY(m_total_range.contains(allocated_range));
|
||||
if (!available_range.contains(base, size))
|
||||
continue;
|
||||
if (available_range == allocated_range) {
|
||||
|
@ -167,11 +167,11 @@ Optional<Range> RangeAllocator::allocate_specific(VirtualAddress base, size_t si
|
|||
|
||||
void RangeAllocator::deallocate(const Range& range)
|
||||
{
|
||||
ASSERT(m_total_range.contains(range));
|
||||
ASSERT(range.size());
|
||||
ASSERT((range.size() % PAGE_SIZE) == 0);
|
||||
ASSERT(range.base() < range.end());
|
||||
ASSERT(!m_available_ranges.is_empty());
|
||||
VERIFY(m_total_range.contains(range));
|
||||
VERIFY(range.size());
|
||||
VERIFY((range.size() % PAGE_SIZE) == 0);
|
||||
VERIFY(range.base() < range.end());
|
||||
VERIFY(!m_available_ranges.is_empty());
|
||||
|
||||
size_t nearby_index = 0;
|
||||
auto* existing_range = binary_search(
|
||||
|
|
|
@ -45,52 +45,52 @@ SimpleRegion::~SimpleRegion()
|
|||
|
||||
ValueWithShadow<u8> SimpleRegion::read8(FlatPtr offset)
|
||||
{
|
||||
ASSERT(offset < size());
|
||||
VERIFY(offset < size());
|
||||
return { *reinterpret_cast<const u8*>(m_data + offset), *reinterpret_cast<const u8*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u16> SimpleRegion::read16(u32 offset)
|
||||
{
|
||||
ASSERT(offset + 1 < size());
|
||||
VERIFY(offset + 1 < size());
|
||||
return { *reinterpret_cast<const u16*>(m_data + offset), *reinterpret_cast<const u16*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u32> SimpleRegion::read32(u32 offset)
|
||||
{
|
||||
ASSERT(offset + 3 < size());
|
||||
VERIFY(offset + 3 < size());
|
||||
return { *reinterpret_cast<const u32*>(m_data + offset), *reinterpret_cast<const u32*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
ValueWithShadow<u64> SimpleRegion::read64(u32 offset)
|
||||
{
|
||||
ASSERT(offset + 7 < size());
|
||||
VERIFY(offset + 7 < size());
|
||||
return { *reinterpret_cast<const u64*>(m_data + offset), *reinterpret_cast<const u64*>(m_shadow_data + offset) };
|
||||
}
|
||||
|
||||
void SimpleRegion::write8(u32 offset, ValueWithShadow<u8> value)
|
||||
{
|
||||
ASSERT(offset < size());
|
||||
VERIFY(offset < size());
|
||||
*reinterpret_cast<u8*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u8*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void SimpleRegion::write16(u32 offset, ValueWithShadow<u16> value)
|
||||
{
|
||||
ASSERT(offset + 1 < size());
|
||||
VERIFY(offset + 1 < size());
|
||||
*reinterpret_cast<u16*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u16*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void SimpleRegion::write32(u32 offset, ValueWithShadow<u32> value)
|
||||
{
|
||||
ASSERT(offset + 3 < size());
|
||||
VERIFY(offset + 3 < size());
|
||||
*reinterpret_cast<u32*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u32*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
||||
void SimpleRegion::write64(u32 offset, ValueWithShadow<u64> value)
|
||||
{
|
||||
ASSERT(offset + 7 < size());
|
||||
VERIFY(offset + 7 < size());
|
||||
*reinterpret_cast<u64*>(m_data + offset) = value.value();
|
||||
*reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow();
|
||||
}
|
||||
|
|
|
@ -124,14 +124,14 @@ void SoftCPU::did_receive_secret_data()
|
|||
if (auto* tracer = m_emulator.malloc_tracer())
|
||||
tracer->target_did_realloc({}, m_secret_data[2], m_secret_data[1]);
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void SoftCPU::update_code_cache()
|
||||
{
|
||||
auto* region = m_emulator.mmu().find_region({ cs(), eip() });
|
||||
ASSERT(region);
|
||||
VERIFY(region);
|
||||
|
||||
if (!region->is_executable()) {
|
||||
reportln("SoftCPU::update_code_cache: Non-executable region @ {:p}", eip());
|
||||
|
@ -146,7 +146,7 @@ void SoftCPU::update_code_cache()
|
|||
|
||||
ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address)
|
||||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read8(address);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory8: @{:04x}:{:08x} -> {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
|
@ -156,7 +156,7 @@ ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address)
|
|||
|
||||
ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address)
|
||||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read16(address);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory16: @{:04x}:{:08x} -> {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
|
@ -166,7 +166,7 @@ ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address)
|
|||
|
||||
ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address)
|
||||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read32(address);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory32: @{:04x}:{:08x} -> {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
|
@ -176,7 +176,7 @@ ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address)
|
|||
|
||||
ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
|
||||
{
|
||||
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
auto value = m_emulator.mmu().read64(address);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mread_memory64: @{:04x}:{:08x} -> {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
|
@ -186,7 +186,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
|
|||
|
||||
void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory8: @{:04x}:{:08x} <- {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
|
@ -195,7 +195,7 @@ void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> val
|
|||
|
||||
void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory16: @{:04x}:{:08x} <- {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
|
@ -204,7 +204,7 @@ void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> v
|
|||
|
||||
void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory32: @{:04x}:{:08x} <- {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
|
@ -213,7 +213,7 @@ void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> v
|
|||
|
||||
void SoftCPU::write_memory64(X86::LogicalAddress address, ValueWithShadow<u64> value)
|
||||
{
|
||||
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
VERIFY(address.selector() == 0x23 || address.selector() == 0x2b);
|
||||
#if MEMORY_DEBUG
|
||||
outln("\033[36;1mwrite_memory64: @{:04x}:{:08x} <- {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
|
||||
#endif
|
||||
|
@ -363,7 +363,7 @@ ALWAYS_INLINE static T op_xor(SoftCPU& cpu, const T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -395,7 +395,7 @@ ALWAYS_INLINE static T op_or(SoftCPU& cpu, const T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -427,7 +427,7 @@ ALWAYS_INLINE static T op_sub(SoftCPU& cpu, const T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -464,7 +464,7 @@ ALWAYS_INLINE static T op_sbb_impl(SoftCPU& cpu, const T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -505,7 +505,7 @@ ALWAYS_INLINE static T op_add(SoftCPU& cpu, T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -542,7 +542,7 @@ ALWAYS_INLINE static T op_adc_impl(SoftCPU& cpu, T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -583,7 +583,7 @@ ALWAYS_INLINE static T op_and(SoftCPU& cpu, const T& dest, const T& src)
|
|||
: "=a"(result)
|
||||
: "a"(dest.value()), "c"(src.value()));
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
asm volatile(
|
||||
|
@ -1152,7 +1152,7 @@ ALWAYS_INLINE void BTx_RM16_imm8(SoftCPU& cpu, const X86::Instruction& insn, Op
|
|||
unsigned bit_index = insn.imm8() & (X86::TypeTrivia<u16>::mask);
|
||||
|
||||
// FIXME: Support higher bit indices
|
||||
ASSERT(bit_index < 16);
|
||||
VERIFY(bit_index < 16);
|
||||
|
||||
auto original = insn.modrm().read16(cpu, insn);
|
||||
u16 bit_mask = 1 << bit_index;
|
||||
|
@ -1169,7 +1169,7 @@ ALWAYS_INLINE void BTx_RM32_imm8(SoftCPU& cpu, const X86::Instruction& insn, Op
|
|||
unsigned bit_index = insn.imm8() & (X86::TypeTrivia<u32>::mask);
|
||||
|
||||
// FIXME: Support higher bit indices
|
||||
ASSERT(bit_index < 32);
|
||||
VERIFY(bit_index < 32);
|
||||
|
||||
auto original = insn.modrm().read32(cpu, insn);
|
||||
u32 bit_mask = 1 << bit_index;
|
||||
|
@ -1551,7 +1551,7 @@ void SoftCPU::FLD_RM32(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FXCH(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
auto tmp = fpu_get(0);
|
||||
fpu_set(0, fpu_get(insn.modrm().register_index()));
|
||||
fpu_set(insn.modrm().register_index(), tmp);
|
||||
|
@ -1559,7 +1559,7 @@ void SoftCPU::FXCH(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FST_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
float f32 = (float)fpu_get(0);
|
||||
// FIXME: Respect shadow values
|
||||
insn.modrm().write32(*this, insn, shadow_wrap_as_initialized(bit_cast<u32>(f32)));
|
||||
|
@ -1645,7 +1645,7 @@ void SoftCPU::FCOS(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FIADD_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, fpu_get(0) + (long double)m32int);
|
||||
|
@ -1655,7 +1655,7 @@ void SoftCPU::FCMOVB(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FIMUL_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, fpu_get(0) * (long double)m32int);
|
||||
|
@ -1675,7 +1675,7 @@ void SoftCPU::FCMOVU(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FISUB_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, fpu_get(0) - (long double)m32int);
|
||||
|
@ -1683,7 +1683,7 @@ void SoftCPU::FISUB_RM32(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FISUBR_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, (long double)m32int - fpu_get(0));
|
||||
|
@ -1693,7 +1693,7 @@ void SoftCPU::FUCOMPP(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FIDIV_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
// FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
|
||||
|
@ -1702,7 +1702,7 @@ void SoftCPU::FIDIV_RM32(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FIDIVR_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
// FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
|
||||
|
@ -1711,7 +1711,7 @@ void SoftCPU::FIDIVR_RM32(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FILD_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m32int = (i32)insn.modrm().read32(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_push((long double)m32int);
|
||||
|
@ -1723,7 +1723,7 @@ void SoftCPU::FCMOVNE(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FIST_RM32(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto f = fpu_get(0);
|
||||
// FIXME: Respect rounding mode in m_fpu_cw.
|
||||
auto i32 = static_cast<int32_t>(f);
|
||||
|
@ -1871,7 +1871,7 @@ void SoftCPU::FDIVR_RM64(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FLD_RM64(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto new_f64 = insn.modrm().read64(*this, insn);
|
||||
// FIXME: Respect shadow values
|
||||
fpu_push(bit_cast<double>(new_f64.value()));
|
||||
|
@ -1905,7 +1905,7 @@ void SoftCPU::FNSTSW(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FIADD_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, fpu_get(0) + (long double)m16int);
|
||||
|
@ -1913,14 +1913,14 @@ void SoftCPU::FIADD_RM16(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FADDP(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) + fpu_get(0));
|
||||
fpu_pop();
|
||||
}
|
||||
|
||||
void SoftCPU::FIMUL_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, fpu_get(0) * (long double)m16int);
|
||||
|
@ -1928,7 +1928,7 @@ void SoftCPU::FIMUL_RM16(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FMULP(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) * fpu_get(0));
|
||||
fpu_pop();
|
||||
}
|
||||
|
@ -1939,7 +1939,7 @@ void SoftCPU::FCOMPP(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FISUB_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, fpu_get(0) - (long double)m16int);
|
||||
|
@ -1947,14 +1947,14 @@ void SoftCPU::FISUB_RM16(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FSUBRP(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
fpu_set(insn.modrm().register_index(), fpu_get(0) - fpu_get(insn.modrm().register_index()));
|
||||
fpu_pop();
|
||||
}
|
||||
|
||||
void SoftCPU::FISUBR_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_set(0, (long double)m16int - fpu_get(0));
|
||||
|
@ -1962,14 +1962,14 @@ void SoftCPU::FISUBR_RM16(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FSUBP(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) - fpu_get(0));
|
||||
fpu_pop();
|
||||
}
|
||||
|
||||
void SoftCPU::FIDIV_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
// FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
|
||||
|
@ -1978,7 +1978,7 @@ void SoftCPU::FIDIV_RM16(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FDIVRP(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
// FIXME: Raise IA on + infinity / +-infinitiy, +-0 / +-0, raise Z on finite / +-0
|
||||
fpu_set(insn.modrm().register_index(), fpu_get(0) / fpu_get(insn.modrm().register_index()));
|
||||
fpu_pop();
|
||||
|
@ -1986,7 +1986,7 @@ void SoftCPU::FDIVRP(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FIDIVR_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
// FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
|
||||
|
@ -1995,7 +1995,7 @@ void SoftCPU::FIDIVR_RM16(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FDIVP(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.modrm().is_register());
|
||||
VERIFY(insn.modrm().is_register());
|
||||
// FIXME: Raise IA on + infinity / +-infinitiy, +-0 / +-0, raise Z on finite / +-0
|
||||
fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) / fpu_get(0));
|
||||
fpu_pop();
|
||||
|
@ -2003,7 +2003,7 @@ void SoftCPU::FDIVP(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FILD_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m16int = (i16)insn.modrm().read16(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_push((long double)m16int);
|
||||
|
@ -2014,7 +2014,7 @@ void SoftCPU::FISTTP_RM16(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FIST_RM16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto f = fpu_get(0);
|
||||
// FIXME: Respect rounding mode in m_fpu_cw.
|
||||
auto i16 = static_cast<int16_t>(f);
|
||||
|
@ -2033,7 +2033,7 @@ void SoftCPU::FNSTSW_AX(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::FILD_RM64(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto m64int = (i64)insn.modrm().read64(*this, insn).value();
|
||||
// FIXME: Respect shadow values
|
||||
fpu_push((long double)m64int);
|
||||
|
@ -2055,7 +2055,7 @@ void SoftCPU::FCOMIP(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::FISTP_RM64(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.modrm().is_register());
|
||||
VERIFY(!insn.modrm().is_register());
|
||||
auto f = fpu_pop();
|
||||
// FIXME: Respect rounding mode in m_fpu_cw.
|
||||
auto i64 = static_cast<int64_t>(f);
|
||||
|
@ -2241,7 +2241,7 @@ void SoftCPU::INTO(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::INT_imm8(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(insn.imm8() == 0x82);
|
||||
VERIFY(insn.imm8() == 0x82);
|
||||
// FIXME: virt_syscall should take ValueWithShadow and whine about uninitialized arguments
|
||||
set_eax(shadow_wrap_as_initialized(m_emulator.virt_syscall(eax().value(), edx().value(), ecx().value(), ebx().value())));
|
||||
}
|
||||
|
@ -2745,7 +2745,7 @@ void SoftCPU::PUSH_imm32(const X86::Instruction& insn)
|
|||
|
||||
void SoftCPU::PUSH_imm8(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.has_operand_size_override_prefix());
|
||||
VERIFY(!insn.has_operand_size_override_prefix());
|
||||
push32(shadow_wrap_as_initialized<u32>(sign_extended_to<i32>(insn.imm8())));
|
||||
}
|
||||
|
||||
|
@ -2872,7 +2872,7 @@ void SoftCPU::RDTSC(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::RET(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.has_operand_size_override_prefix());
|
||||
VERIFY(!insn.has_operand_size_override_prefix());
|
||||
auto ret_address = pop32();
|
||||
warn_if_uninitialized(ret_address, "ret");
|
||||
set_eip(ret_address.value());
|
||||
|
@ -2883,7 +2883,7 @@ void SoftCPU::RETF_imm16(const X86::Instruction&) { TODO_INSN(); }
|
|||
|
||||
void SoftCPU::RET_imm16(const X86::Instruction& insn)
|
||||
{
|
||||
ASSERT(!insn.has_operand_size_override_prefix());
|
||||
VERIFY(!insn.has_operand_size_override_prefix());
|
||||
auto ret_address = pop32();
|
||||
warn_if_uninitialized(ret_address, "ret imm16");
|
||||
set_eip(ret_address.value());
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
case X86::RegisterDH:
|
||||
return { m_gpr[X86::RegisterEDX].high_u8, m_gpr_shadow[X86::RegisterEDX].high_u8 };
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ValueWithShadow<u8> const_gpr8(X86::RegisterIndex8 reg) const
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
case X86::RegisterDH:
|
||||
return { m_gpr[X86::RegisterEDX].high_u8, m_gpr_shadow[X86::RegisterEDX].high_u8 };
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ValueWithShadow<u16> const_gpr16(X86::RegisterIndex16 reg) const
|
||||
|
@ -431,7 +431,7 @@ public:
|
|||
case 15:
|
||||
return !((sf() ^ of()) | zf()); // NLE, G
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1140,12 +1140,12 @@ private:
|
|||
}
|
||||
long double fpu_get(int i)
|
||||
{
|
||||
ASSERT(i >= 0 && i <= m_fpu_top);
|
||||
VERIFY(i >= 0 && i <= m_fpu_top);
|
||||
return m_fpu[m_fpu_top - i];
|
||||
}
|
||||
void fpu_set(int i, long double n)
|
||||
{
|
||||
ASSERT(i >= 0 && i <= m_fpu_top);
|
||||
VERIFY(i >= 0 && i <= m_fpu_top);
|
||||
m_fpu[m_fpu_top - i] = n;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ SoftMMU::SoftMMU(Emulator& emulator)
|
|||
|
||||
void SoftMMU::add_region(NonnullOwnPtr<Region> region)
|
||||
{
|
||||
ASSERT(!find_region({ 0x23, region->base() }));
|
||||
VERIFY(!find_region({ 0x23, region->base() }));
|
||||
|
||||
size_t first_page_in_region = region->base() / PAGE_SIZE;
|
||||
size_t last_page_in_region = (region->base() + region->size() - 1) / PAGE_SIZE;
|
||||
|
@ -63,7 +63,7 @@ void SoftMMU::remove_region(Region& region)
|
|||
|
||||
void SoftMMU::set_tls_region(NonnullOwnPtr<Region> region)
|
||||
{
|
||||
ASSERT(!m_tls_region);
|
||||
VERIFY(!m_tls_region);
|
||||
m_tls_region = move(region);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue