1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-08-17 03:07:50 +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:
Andreas Kling 2021-02-23 20:42:32 +01:00
parent b33a6a443e
commit 5d180d1f99
725 changed files with 3448 additions and 3448 deletions

View file

@ -57,7 +57,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_elapsed_timer.start();
m_download = Web::ResourceLoader::the().protocol_client().start_download("GET", url.to_string());
ASSERT(m_download);
VERIFY(m_download);
m_download->on_progress = [this](Optional<u32> total_size, u32 downloaded_size) {
did_progress(total_size.value(), downloaded_size);
};
@ -109,7 +109,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_cancel_button->set_fixed_size(100, 22);
m_cancel_button->on_click = [this](auto) {
bool success = m_download->stop();
ASSERT(success);
VERIFY(success);
window()->close();
};

View file

@ -54,13 +54,13 @@ URL History::current() const
void History::go_back()
{
ASSERT(can_go_back());
VERIFY(can_go_back());
m_current--;
}
void History::go_forward()
{
ASSERT(can_go_forward());
VERIFY(can_go_forward());
m_current++;
}

View file

@ -318,7 +318,7 @@ Tab::Tab(Type type)
auto view_source_action = GUI::Action::create(
"View source", { Mod_Ctrl, Key_U }, [this](auto&) {
if (m_type == Type::InProcessWebView) {
ASSERT(m_page_view->document());
VERIFY(m_page_view->document());
auto url = m_page_view->document()->url().to_string();
auto source = m_page_view->document()->source();
view_source(url, source);

View file

@ -35,13 +35,13 @@ static WindowActions* s_the;
WindowActions& WindowActions::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
WindowActions::WindowActions(GUI::Window& window)
{
ASSERT(!s_the);
VERIFY(!s_the);
s_the = this;
m_create_new_tab_action = GUI::Action::create(
"New tab", { Mod_Ctrl, Key_T }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"), [this](auto&) {

View file

@ -158,7 +158,7 @@ int main(int argc, char** argv)
auto& tab_widget = *widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto default_favicon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png");
ASSERT(default_favicon);
VERIFY(default_favicon);
tab_widget.on_change = [&](auto& active_widget) {
auto& tab = static_cast<Browser::Tab&>(active_widget);

View file

@ -42,7 +42,7 @@ double Calculator::begin_operation(Operation operation, double argument)
switch (operation) {
case Operation::None:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
case Operation::Add:
case Operation::Subtract:
@ -128,7 +128,7 @@ double Calculator::finish_operation(double argument)
case Operation::MemRecall:
case Operation::MemSave:
case Operation::MemAdd:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
clear_operation();

View file

@ -47,8 +47,8 @@ void Keypad::type_digit(int digit)
m_frac_length = 0;
break;
case State::TypingInteger:
ASSERT(m_frac_value == 0);
ASSERT(m_frac_length == 0);
VERIFY(m_frac_value == 0);
VERIFY(m_frac_length == 0);
m_int_value *= 10;
m_int_value += digit;
break;
@ -72,8 +72,8 @@ void Keypad::type_decimal_point()
m_frac_length = 0;
break;
case State::TypingInteger:
ASSERT(m_frac_value == 0);
ASSERT(m_frac_length == 0);
VERIFY(m_frac_value == 0);
VERIFY(m_frac_length == 0);
m_state = State::TypingDecimal;
break;
case State::TypingDecimal:
@ -97,12 +97,12 @@ void Keypad::type_backspace()
m_frac_length--;
break;
}
ASSERT(m_frac_value == 0);
VERIFY(m_frac_value == 0);
m_state = State::TypingInteger;
[[fallthrough]];
case State::TypingInteger:
ASSERT(m_frac_value == 0);
ASSERT(m_frac_length == 0);
VERIFY(m_frac_value == 0);
VERIFY(m_frac_length == 0);
m_int_value /= 10;
if (m_int_value == 0)
m_negative = false;

View file

@ -135,7 +135,7 @@ String AddEventDialog::MonthListModel::column_name(int column) const
case Column::Month:
return "Month";
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -147,7 +147,7 @@ GUI::Variant AddEventDialog::MonthListModel::data(const GUI::ModelIndex& index,
case Column::Month:
return month;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
return {};

View file

@ -227,7 +227,7 @@ int main(int argc, char** argv)
return Debug::DebugSession::DebugDecision::Detach;
}
ASSERT(optional_regs.has_value());
VERIFY(optional_regs.has_value());
const PtraceRegisters& regs = optional_regs.value();
auto symbol_at_ip = g_debug_session->symbolicate(regs.eip);

View file

@ -100,7 +100,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
} else if (m_desktop_wallpaper_mode == "stretch") {
screen_painter.draw_scaled_bitmap(screen_bitmap->rect(), *m_desktop_wallpaper_bitmap, m_desktop_wallpaper_bitmap->rect());
} else {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -333,7 +333,7 @@ void DirectoryView::set_view_mode(ViewMode mode)
set_active_widget(m_icon_view);
return;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void DirectoryView::add_path_to_history(const StringView& path)
@ -479,7 +479,7 @@ Vector<String> DirectoryView::selected_file_paths() const
void DirectoryView::do_delete(bool should_confirm)
{
auto paths = selected_file_paths();
ASSERT(!paths.is_empty());
VERIFY(!paths.is_empty());
FileUtils::delete_paths(paths, should_confirm, window());
}
@ -531,7 +531,7 @@ void DirectoryView::setup_actions()
return;
}
rc = close(fd);
ASSERT(rc >= 0);
VERIFY(rc >= 0);
}
});

View file

@ -107,7 +107,7 @@ public:
case ViewMode::Icon:
return *m_icon_view;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -47,7 +47,7 @@ PropertiesWindow::PropertiesWindow(const String& path, bool disable_rename, Wind
: Window(parent_window)
{
auto lexical_path = LexicalPath(path);
ASSERT(lexical_path.is_valid());
VERIFY(lexical_path.is_valid());
auto& main_widget = set_main_widget<GUI::Widget>();
main_widget.set_layout<GUI::VerticalBoxLayout>();
@ -122,7 +122,7 @@ PropertiesWindow::PropertiesWindow(const String& path, bool disable_rename, Wind
perror("readlink");
} else {
auto link_directory = LexicalPath(link_destination);
ASSERT(link_directory.is_valid());
VERIFY(link_directory.is_valid());
auto link_parent = URL::create_with_file_protocol(link_directory.dirname());
properties.append({ "Link target:", link_destination, Optional(link_parent) });
}

View file

@ -130,7 +130,7 @@ int main(int argc, char** argv)
void do_copy(const Vector<String>& selected_file_paths, FileUtils::FileOperation file_operation)
{
if (selected_file_paths.is_empty())
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
StringBuilder copy_text;
if (file_operation == FileUtils::FileOperation::Cut) {
@ -227,7 +227,7 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config)
auto paths = directory_view.selected_file_paths();
if (paths.is_empty())
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
do_copy(paths, FileUtils::FileOperation::Copy);
},
@ -239,7 +239,7 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config)
auto paths = directory_view.selected_file_paths();
if (paths.is_empty())
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
do_copy(paths, FileUtils::FileOperation::Cut);
},
@ -539,7 +539,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
paths = tree_view_selected_file_paths();
if (paths.is_empty())
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
do_copy(paths, FileUtils::FileOperation::Copy);
refresh_tree_view();
@ -555,7 +555,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
paths = tree_view_selected_file_paths();
if (paths.is_empty())
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
do_copy(paths, FileUtils::FileOperation::Cut);
refresh_tree_view();

View file

@ -42,13 +42,13 @@ String History::current()
void History::go_back()
{
ASSERT(can_go_back());
VERIFY(can_go_back());
m_current_history_item--;
}
void History::go_forward()
{
ASSERT(can_go_forward());
VERIFY(can_go_forward());
m_current_history_item++;
}

View file

@ -134,14 +134,14 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const
for (size_t row = 0; row < sizeof(s_sections) / sizeof(s_sections[0]); row++)
if (&s_sections[row] == parent)
return create_index(row, 0, parent);
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
for (size_t row = 0; row < parent->parent()->children().size(); row++) {
ManualNode* child_at_row = &parent->parent()->children()[row];
if (child_at_row == parent)
return create_index(row, 0, parent);
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
int ManualModel::row_count(const GUI::ModelIndex& index) const

View file

@ -167,7 +167,7 @@ int main(int argc, char* argv[])
String html;
{
auto md_document = Markdown::Document::parse(source);
ASSERT(md_document);
VERIFY(md_document);
html = md_document->render_to_html();
}

View file

@ -101,7 +101,7 @@ Result<ByteBuffer, String> FindDialog::process_input(String text_value, OptionId
}
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -418,8 +418,8 @@ void HexEditor::hex_mode_keydown_event(GUI::KeyEvent& event)
if ((event.key() >= KeyCode::Key_0 && event.key() <= KeyCode::Key_9) || (event.key() >= KeyCode::Key_A && event.key() <= KeyCode::Key_F)) {
if (m_buffer.is_empty())
return;
ASSERT(m_position >= 0);
ASSERT(m_position < static_cast<int>(m_buffer.size()));
VERIFY(m_position >= 0);
VERIFY(m_position < static_cast<int>(m_buffer.size()));
// yes, this is terrible... but it works.
auto value = (event.key() >= KeyCode::Key_0 && event.key() <= KeyCode::Key_9)
@ -447,8 +447,8 @@ void HexEditor::text_mode_keydown_event(GUI::KeyEvent& event)
{
if (m_buffer.is_empty())
return;
ASSERT(m_position >= 0);
ASSERT(m_position < static_cast<int>(m_buffer.size()));
VERIFY(m_position >= 0);
VERIFY(m_position < static_cast<int>(m_buffer.size()));
if (event.code_point() == 0) // This is a control key
return;

View file

@ -50,7 +50,7 @@ IRCAppWindow& IRCAppWindow::the()
IRCAppWindow::IRCAppWindow(String server, int port)
: m_client(IRCClient::construct(server, port))
{
ASSERT(!s_the);
VERIFY(!s_the);
s_the = this;
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-irc-client.png"));
@ -100,7 +100,7 @@ void IRCAppWindow::setup_client()
}
update_title();
bool success = m_client->connect();
ASSERT(success);
VERIFY(success);
}
void IRCAppWindow::setup_actions()

View file

@ -54,7 +54,7 @@ String IRCChannelMemberListModel::column_name(int column) const
case Column::Name:
return "Name";
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
GUI::Variant IRCChannelMemberListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const

View file

@ -116,7 +116,7 @@ void IRCClient::on_socket_connected()
bool IRCClient::connect()
{
if (m_socket->is_connected())
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
m_socket->on_connected = [this] { on_socket_connected(); };
@ -132,7 +132,7 @@ void IRCClient::receive_from_server()
outln("IRCClient: Connection closed!");
exit(1);
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
process_line(line);
}

View file

@ -102,7 +102,7 @@ public:
if (m_windows[i] == &window)
return i;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void did_part_from_channel(Badge<IRCChannel>, IRCChannel&);

View file

@ -53,7 +53,7 @@ String IRCWindowListModel::column_name(int column) const
case Column::Name:
return "Name";
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
GUI::Variant IRCWindowListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const

View file

@ -69,10 +69,10 @@ void KeyboardMapperWidget::create_frame()
String value;
if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecOK) {
int i = m_keys.find_first_index(&tmp_button).value_or(0);
ASSERT(i > 0);
VERIFY(i > 0);
auto index = keys[i].map_index;
ASSERT(index > 0);
VERIFY(index > 0);
tmp_button.set_text(value);
u32* map;
@ -88,7 +88,7 @@ void KeyboardMapperWidget::create_frame()
} else if (m_current_map_name == "shift_altgr_map") {
map = m_character_map.shift_altgr_map;
} else {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (value.length() == 0)
@ -146,7 +146,7 @@ void KeyboardMapperWidget::create_frame()
void KeyboardMapperWidget::load_from_file(String file_name)
{
auto result = Keyboard::CharacterMapFile::load_from_file(file_name);
ASSERT(result.has_value());
VERIFY(result.has_value());
m_file_name = file_name;
m_character_map = result.value();
@ -163,7 +163,7 @@ void KeyboardMapperWidget::load_from_file(String file_name)
void KeyboardMapperWidget::load_from_system()
{
auto result = Keyboard::CharacterMap::fetch_system_map();
ASSERT(!result.is_error());
VERIFY(!result.is_error());
m_file_name = String::formatted("/res/keymaps/{}.json", result.value().character_map_name());
m_character_map = result.value().character_map_data();
@ -274,7 +274,7 @@ void KeyboardMapperWidget::set_current_map(const String current_map)
} else if (m_current_map_name == "shift_altgr_map") {
map = m_character_map.shift_altgr_map;
} else {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
for (unsigned k = 0; k < KEY_COUNT; k++) {

View file

@ -50,8 +50,8 @@ public:
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
{
ASSERT(index.is_valid());
ASSERT(index.column() == 0);
VERIFY(index.is_valid());
VERIFY(index.column() == 0);
if (role == GUI::ModelRole::Display)
return m_file_names.at(index.row());

View file

@ -82,12 +82,12 @@ int main(int argc, char** argv)
auto proc_keymap = Core::File::construct("/proc/keymap");
if (!proc_keymap->open(Core::IODevice::OpenMode::ReadOnly))
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
auto json = JsonValue::from_string(proc_keymap->read_all());
ASSERT(json.has_value());
VERIFY(json.has_value());
JsonObject keymap_object = json.value().as_object();
ASSERT(keymap_object.has("keymap"));
VERIFY(keymap_object.has("keymap"));
String current_keymap = keymap_object.get("keymap").to_string();
dbgln("KeyboardSettings thinks the current keymap is: {}", current_keymap);
@ -110,7 +110,7 @@ int main(int argc, char** argv)
if (character_map_files[i].equals_ignoring_case(current_keymap))
initial_keymap_index = i;
}
ASSERT(initial_keymap_index < character_map_files.size());
VERIFY(initial_keymap_index < character_map_files.size());
auto window = GUI::Window::construct();
window->set_title("Keyboard Settings");

View file

@ -58,7 +58,7 @@ void KeysWidget::set_key(int key, Switch switch_key)
if (m_key_on[key] >= 1)
--m_key_on[key];
}
ASSERT(m_key_on[key] <= 2);
VERIFY(m_key_on[key] <= 2);
m_track_manager.set_note_current_octave(key, switch_key);
}

View file

@ -82,7 +82,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_octave = octave_max - value;
if (m_change_underlying)
m_main_widget.set_octave_and_ensure_note_change(new_octave);
ASSERT(new_octave == m_track_manager.octave());
VERIFY(new_octave == m_track_manager.octave());
m_octave_value->set_text(String::number(new_octave));
};
@ -94,7 +94,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_wave = last_wave - value;
if (m_change_underlying)
m_track_manager.current_track().set_wave(new_wave);
ASSERT(new_wave == m_track_manager.current_track().wave());
VERIFY(new_wave == m_track_manager.current_track().wave());
m_wave_value->set_text(wave_strings[new_wave]);
};
@ -106,7 +106,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_attack = max_attack - value;
if (m_change_underlying)
m_track_manager.current_track().set_attack(new_attack);
ASSERT(new_attack == m_track_manager.current_track().attack());
VERIFY(new_attack == m_track_manager.current_track().attack());
m_attack_value->set_text(String::number(new_attack));
};
@ -118,7 +118,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_decay = max_decay - value;
if (m_change_underlying)
m_track_manager.current_track().set_decay(new_decay);
ASSERT(new_decay == m_track_manager.current_track().decay());
VERIFY(new_decay == m_track_manager.current_track().decay());
m_decay_value->set_text(String::number(new_decay));
};
@ -130,7 +130,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_sustain = max_sustain - value;
if (m_change_underlying)
m_track_manager.current_track().set_sustain(new_sustain);
ASSERT(new_sustain == m_track_manager.current_track().sustain());
VERIFY(new_sustain == m_track_manager.current_track().sustain());
m_sustain_value->set_text(String::number(new_sustain));
};
@ -142,7 +142,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_release = max_release - value;
if (m_change_underlying)
m_track_manager.current_track().set_release(new_release);
ASSERT(new_release == m_track_manager.current_track().release());
VERIFY(new_release == m_track_manager.current_track().release());
m_release_value->set_text(String::number(new_release));
};
@ -153,7 +153,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
int new_delay = max_delay - value;
if (m_change_underlying)
m_track_manager.current_track().set_delay(new_delay);
ASSERT(new_delay == m_track_manager.current_track().delay());
VERIFY(new_delay == m_track_manager.current_track().delay());
m_delay_value->set_text(String::number(new_delay));
};
}

View file

@ -83,7 +83,7 @@ void Track::fill_sample(Sample& sample)
}
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
Audio::Sample note_sample;
@ -107,7 +107,7 @@ void Track::fill_sample(Sample& sample)
note_sample = recorded_sample(note);
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
new_sample.left += note_sample.left * m_power[note] * volume;
new_sample.right += note_sample.right * m_power[note] * volume;
@ -242,7 +242,7 @@ static inline double calculate_step(double distance, int milliseconds)
void Track::set_note(int note, Switch switch_note)
{
ASSERT(note >= 0 && note < note_count);
VERIFY(note >= 0 && note < note_count);
if (switch_note == On) {
if (m_note_on[note] == 0) {
@ -260,8 +260,8 @@ void Track::set_note(int note, Switch switch_note)
}
}
ASSERT(m_note_on[note] != NumericLimits<u8>::max());
ASSERT(m_power[note] >= 0);
VERIFY(m_note_on[note] != NumericLimits<u8>::max());
VERIFY(m_power[note] >= 0);
}
void Track::sync_roll(int note)
@ -277,9 +277,9 @@ void Track::set_roll_note(int note, u32 on_sample, u32 off_sample)
{
RollNote new_roll_note = { on_sample, off_sample };
ASSERT(note >= 0 && note < note_count);
ASSERT(new_roll_note.off_sample < roll_length);
ASSERT(new_roll_note.length() >= 2);
VERIFY(note >= 0 && note < note_count);
VERIFY(new_roll_note.off_sample < roll_length);
VERIFY(new_roll_note.length() >= 2);
for (auto it = m_roll_notes[note].begin(); !it.is_end();) {
if (it->on_sample > new_roll_note.off_sample) {
@ -310,7 +310,7 @@ void Track::set_roll_note(int note, u32 on_sample, u32 off_sample)
void Track::set_wave(int wave)
{
ASSERT(wave >= first_wave && wave <= last_wave);
VERIFY(wave >= first_wave && wave <= last_wave);
m_wave = wave;
}
@ -327,21 +327,21 @@ void Track::set_wave(Direction direction)
void Track::set_attack(int attack)
{
ASSERT(attack >= 0);
VERIFY(attack >= 0);
m_attack = attack;
m_attack_step = calculate_step(1, m_attack);
}
void Track::set_decay(int decay)
{
ASSERT(decay >= 0);
VERIFY(decay >= 0);
m_decay = decay;
m_decay_step = calculate_step(1 - m_sustain_level, m_decay);
}
void Track::set_sustain_impl(int sustain)
{
ASSERT(sustain >= 0);
VERIFY(sustain >= 0);
m_sustain = sustain;
m_sustain_level = sustain / 1000.0;
}
@ -354,13 +354,13 @@ void Track::set_sustain(int sustain)
void Track::set_release(int release)
{
ASSERT(release >= 0);
VERIFY(release >= 0);
m_release = release;
}
void Track::set_delay(int delay)
{
ASSERT(delay >= 0);
VERIFY(delay >= 0);
m_delay = delay;
m_delay_samples = m_delay == 0 ? 0 : (sample_rate / (beats_per_minute / 60)) / m_delay;
m_delay_buffer.resize(m_delay_samples);

View file

@ -55,7 +55,7 @@ static float color_distance_squared(const Gfx::Color& lhs, const Gfx::Color& rhs
static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::IntPoint& start_position, Color target_color, Color fill_color, int threshold)
{
ASSERT(bitmap.bpp() == 32);
VERIFY(bitmap.bpp() == 32);
if (target_color == fill_color)
return;

View file

@ -50,7 +50,7 @@ void EllipseTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& ellipse_
painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), m_thickness);
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -168,7 +168,7 @@ void Image::export_png(const String& file_path)
void Image::add_layer(NonnullRefPtr<Layer> layer)
{
for (auto& existing_layer : m_layers) {
ASSERT(&existing_layer != layer.ptr());
VERIFY(&existing_layer != layer.ptr());
}
m_layers.append(move(layer));
@ -206,7 +206,7 @@ size_t Image::index_of(const Layer& layer) const
if (&m_layers.at(i) == &layer)
return i;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void Image::move_layer_to_back(Layer& layer)
@ -255,8 +255,8 @@ void Image::move_layer_up(Layer& layer)
void Image::change_layer_index(size_t old_index, size_t new_index)
{
ASSERT(old_index < m_layers.size());
ASSERT(new_index < m_layers.size());
VERIFY(old_index < m_layers.size());
VERIFY(new_index < m_layers.size());
auto layer = m_layers.take(old_index);
m_layers.insert(new_index, move(layer));
did_modify_layer_stack();
@ -290,13 +290,13 @@ void Image::select_layer(Layer* layer)
void Image::add_client(ImageClient& client)
{
ASSERT(!m_clients.contains(&client));
VERIFY(!m_clients.contains(&client));
m_clients.set(&client);
}
void Image::remove_client(ImageClient& client)
{
ASSERT(m_clients.contains(&client));
VERIFY(m_clients.contains(&client));
m_clients.remove(&client);
}

View file

@ -341,7 +341,7 @@ Color ImageEditor::color_for(GUI::MouseButton button) const
return m_primary_color;
if (button == GUI::MouseButton::Right)
return m_secondary_color;
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
Color ImageEditor::color_for(const GUI::MouseEvent& event) const
@ -350,7 +350,7 @@ Color ImageEditor::color_for(const GUI::MouseEvent& event) const
return m_primary_color;
if (event.buttons() & GUI::MouseButton::Right)
return m_secondary_color;
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void ImageEditor::set_primary_color(Color color)

View file

@ -161,7 +161,7 @@ void LayerListWidget::mousemove_event(GUI::MouseEvent& event)
auto delta = event.position() - m_moving_event_origin;
auto& gadget = m_gadgets[m_moving_gadget_index.value()];
ASSERT(gadget.is_moving);
VERIFY(gadget.is_moving);
gadget.movement_delta = delta;
relayout_gadgets();
}
@ -221,7 +221,7 @@ static constexpr int vertical_step = gadget_height + gadget_spacing;
size_t LayerListWidget::hole_index_during_move() const
{
ASSERT(is_moving_gadget());
VERIFY(is_moving_gadget());
auto& moving_gadget = m_gadgets[m_moving_gadget_index.value()];
int center_y_of_moving_gadget = moving_gadget.rect.translated(0, moving_gadget.movement_delta.y()).center().y();
return center_y_of_moving_gadget / vertical_step;

View file

@ -56,7 +56,7 @@ void RectangleTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& rect)
painter.fill_rect_with_gradient(rect, m_editor->primary_color(), m_editor->secondary_color());
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -66,7 +66,7 @@ void SprayTool::paint_it()
auto& bitmap = layer->bitmap();
GUI::Painter painter(bitmap);
ASSERT(bitmap.bpp() == 32);
VERIFY(bitmap.bpp() == 32);
m_editor->update();
const double minimal_radius = 2;
const double base_radius = minimal_radius * m_thickness;

View file

@ -201,7 +201,7 @@ int main(int argc, char** argv)
auto& edit_menu = menubar->add_menu("Edit");
auto paste_action = GUI::CommonActions::make_paste_action([&](auto&) {
ASSERT(image_editor.image());
VERIFY(image_editor.image());
auto bitmap = GUI::Clipboard::the().bitmap();
if (!bitmap)
return;
@ -217,13 +217,13 @@ int main(int argc, char** argv)
edit_menu.add_action(paste_action);
auto undo_action = GUI::CommonActions::make_undo_action([&](auto&) {
ASSERT(image_editor.image());
VERIFY(image_editor.image());
image_editor.undo();
});
edit_menu.add_action(undo_action);
auto redo_action = GUI::CommonActions::make_redo_action([&](auto&) {
ASSERT(image_editor.image());
VERIFY(image_editor.image());
image_editor.redo();
});
edit_menu.add_action(redo_action);

View file

@ -99,7 +99,7 @@ static void fill_mounts(Vector<MountInfo>& output)
auto content = df->read_all();
auto json = JsonValue::from_string(content);
ASSERT(json.has_value());
VERIFY(json.has_value());
json.value().as_array().for_each([&output](auto& value) {
auto filesystem_object = value.as_object();
@ -150,7 +150,7 @@ struct QueueEntry {
static void populate_filesize_tree(TreeNode& root, Vector<MountInfo>& mounts, HashMap<int, int>& error_accumulator)
{
ASSERT(!root.m_name.ends_with("/"));
VERIFY(!root.m_name.ends_with("/"));
Queue<QueueEntry> queue;
queue.enqueue(QueueEntry(root.m_name, &root));
@ -247,7 +247,7 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg
static bool is_removable(const String& absolute_path)
{
ASSERT(!absolute_path.is_empty());
VERIFY(!absolute_path.is_empty());
int access_result = access(absolute_path.characters(), W_OK);
if (access_result != 0 && errno != EACCES)
perror("access");
@ -353,7 +353,7 @@ int main(int argc, char* argv[])
// Configure event handlers.
breadcrumbbar.on_segment_click = [&](size_t index) {
ASSERT(index < treemapwidget.path_size());
VERIFY(index < treemapwidget.path_size());
treemapwidget.set_viewpoint(index);
};
treemapwidget.on_path_change = [&]() {

View file

@ -73,7 +73,7 @@ void Cell::set_type(const StringView& name)
return set_type(cell_type);
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void Cell::set_type_metadata(CellTypeMetadata&& metadata)

View file

@ -56,7 +56,7 @@ Vector<StringView> CellType::names()
CellType::CellType(const StringView& name)
: m_name(name)
{
ASSERT(!s_cell_types.contains(name));
VERIFY(!s_cell_types.contains(name));
s_cell_types.set(name, this);
}

View file

@ -52,7 +52,7 @@ namespace Spreadsheet {
CellTypeDialog::CellTypeDialog(const Vector<Position>& positions, Sheet& sheet, GUI::Window* parent)
: GUI::Dialog(parent)
{
ASSERT(!positions.is_empty());
VERIFY(!positions.is_empty());
StringBuilder builder;
@ -239,7 +239,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
m_horizontal_alignment = HorizontalAlignment::Right;
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
};
}
@ -271,7 +271,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
m_vertical_alignment = VerticalAlignment::Bottom;
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
};
}
@ -444,7 +444,7 @@ ConditionsView::ConditionsView()
void ConditionsView::set_formats(Vector<ConditionalFormat>* formats)
{
ASSERT(!m_formats);
VERIFY(!m_formats);
m_formats = formats;
@ -454,7 +454,7 @@ void ConditionsView::set_formats(Vector<ConditionalFormat>* formats)
void ConditionsView::add_format()
{
ASSERT(m_formats);
VERIFY(m_formats);
m_formats->empend();
auto& last = m_formats->last();
@ -466,7 +466,7 @@ void ConditionsView::add_format()
void ConditionsView::remove_top()
{
ASSERT(m_formats);
VERIFY(m_formats);
if (m_formats->is_empty())
return;

View file

@ -100,7 +100,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
m_webview = splitter.add<Web::OutOfProcessWebView>();
m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
ASSERT(url.protocol() == "spreadsheet");
VERIFY(url.protocol() == "spreadsheet");
if (url.host() == "example") {
auto entry = LexicalPath(url.path()).basename();
auto doc_option = m_docs.get(entry);
@ -159,19 +159,19 @@ HelpWindow::HelpWindow(GUI::Window* parent)
String HelpWindow::render(const StringView& key)
{
auto doc_option = m_docs.get(key);
ASSERT(doc_option.is_object());
VERIFY(doc_option.is_object());
auto& doc = doc_option.as_object();
auto name = doc.get("name").to_string();
auto argc = doc.get("argc").to_u32(0);
auto argnames_value = doc.get("argnames");
ASSERT(argnames_value.is_array());
VERIFY(argnames_value.is_array());
auto& argnames = argnames_value.as_array();
auto docstring = doc.get("doc").to_string();
auto examples_value = doc.get_or("examples", JsonObject {});
ASSERT(examples_value.is_object());
VERIFY(examples_value.is_object());
auto& examples = examples_value.as_object();
StringBuilder markdown_builder;

View file

@ -243,9 +243,9 @@ XSV::Field XSV::read_one_unquoted_field()
StringView XSV::Row::operator[](StringView name) const
{
ASSERT(!m_xsv.m_names.is_empty());
VERIFY(!m_xsv.m_names.is_empty());
auto it = m_xsv.m_names.find_if([&](const auto& entry) { return name == entry; });
ASSERT(!it.is_end());
VERIFY(!it.is_end());
return (*this)[it.index()];
}
@ -265,7 +265,7 @@ const XSV::Row XSV::operator[](size_t index) const
XSV::Row XSV::operator[](size_t index)
{
ASSERT(m_rows.size() > index);
VERIFY(m_rows.size() > index);
return Row { *this, index };
}

View file

@ -98,7 +98,7 @@ public:
ENUMERATE_READ_ERRORS();
#undef E
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
size_t size() const { return m_rows.size(); }

View file

@ -103,7 +103,7 @@ static String convert_to_string(size_t value, unsigned base = 26, StringView map
if (map.is_null())
map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ASSERT(base >= 2 && base <= map.length());
VERIFY(base >= 2 && base <= map.length());
// The '8 bits per byte' assumption may need to go?
Array<char, round_up_to_power_of_two(sizeof(size_t) * 8 + 1, 2)> buffer;
@ -130,7 +130,7 @@ static size_t convert_from_string(StringView str, unsigned base = 26, StringView
if (map.is_null())
map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ASSERT(base >= 2 && base <= map.length());
VERIFY(base >= 2 && base <= map.length());
size_t value = 0;
for (size_t i = str.length(); i > 0; --i) {
@ -295,7 +295,7 @@ Optional<Position> Sheet::position_from_url(const URL& url) const
}
// FIXME: Figure out a way to do this cross-process.
ASSERT(url.path() == String::formatted("/{}", getpid()));
VERIFY(url.path() == String::formatted("/{}", getpid()));
return parse_cell_name(url.fragment());
}

View file

@ -106,12 +106,12 @@ public:
for (size_t i = column_count(); i < index; ++i)
add_column();
ASSERT(column_count() > index);
VERIFY(column_count() > index);
return m_columns[index];
}
const String& column(size_t index) const
{
ASSERT(column_count() > index);
VERIFY(column_count() > index);
return m_columns[index];
}

View file

@ -132,7 +132,7 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
first = false;
});
ASSERT(cursor);
VERIFY(cursor);
Position cursor_position { m_sheet->column(cursor->column()), (size_t)cursor->row() };
auto new_data = String::formatted("{}\n{}",

View file

@ -284,7 +284,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
if (event.mime_data().has_text()) {
auto* target_cell = m_sheet->at({ m_sheet->column(index.column()), (size_t)index.row() });
ASSERT(target_cell);
VERIFY(target_cell);
target_cell->set_data(event.text());
return;

View file

@ -96,7 +96,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s
m_tab_context_menu = GUI::Menu::construct();
auto rename_action = GUI::Action::create("Rename...", [this](auto&) {
ASSERT(m_tab_context_menu_sheet_view);
VERIFY(m_tab_context_menu_sheet_view);
auto& sheet = m_tab_context_menu_sheet_view->sheet();
String new_name;
@ -321,7 +321,7 @@ void SpreadsheetWidget::add_sheet()
void SpreadsheetWidget::add_sheet(NonnullRefPtr<Sheet>&& sheet)
{
ASSERT(m_workbook == &sheet->workbook());
VERIFY(m_workbook == &sheet->workbook());
NonnullRefPtrVector<Sheet> new_sheets;
new_sheets.append(move(sheet));

View file

@ -109,7 +109,7 @@ public:
ENUMERATE_WRITE_ERRORS();
#undef E
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
private:

View file

@ -165,7 +165,7 @@ int main(int argc, char* argv[])
/// - currently selected cell
/// - selected cell+
auto& cells = spreadsheet_widget.current_worksheet().selected_cells();
ASSERT(!cells.is_empty());
VERIFY(!cells.is_empty());
StringBuilder text_builder, url_builder;
bool first = true;
auto cursor = spreadsheet_widget.current_selection_cursor();
@ -201,7 +201,7 @@ int main(int argc, char* argv[])
ScopeGuard update_after_paste { [&] { spreadsheet_widget.update(); } };
auto& cells = spreadsheet_widget.current_worksheet().selected_cells();
ASSERT(!cells.is_empty());
VERIFY(!cells.is_empty());
const auto& data = GUI::Clipboard::the().data_and_type();
if (auto spreadsheet_data = data.metadata.get("text/x-spreadsheet-data"); spreadsheet_data.has_value()) {
Vector<Spreadsheet::Position> source_positions, target_positions;

View file

@ -69,13 +69,13 @@ String DevicesModel::column_name(int column) const
case Column::Type:
return "Type";
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
ASSERT(is_valid(index));
VERIFY(is_valid(index));
if (role == GUI::ModelRole::TextAlignment) {
switch (index.column()) {
@ -107,7 +107,7 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
case Column::Type:
return device.type;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -129,10 +129,10 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
case DeviceInfo::Type::Character:
return "Character";
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -143,10 +143,10 @@ void DevicesModel::update()
{
auto proc_devices = Core::File::construct("/proc/devices");
if (!proc_devices->open(Core::IODevice::OpenMode::ReadOnly))
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
auto json = JsonValue::from_string(proc_devices->read_all());
ASSERT(json.has_value());
VERIFY(json.has_value());
m_devices.clear();
json.value().as_array().for_each([this](auto& value) {
@ -163,7 +163,7 @@ void DevicesModel::update()
else if (type_str == "character")
device_info.type = DeviceInfo::Type::Character;
else
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
m_devices.append(move(device_info));
});
@ -175,7 +175,7 @@ void DevicesModel::update()
auto path = String::formatted("{}/{}", dir, name);
struct stat statbuf;
if (lstat(path.characters(), &statbuf) != 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (!S_ISBLK(statbuf.st_mode) && !S_ISCHR(statbuf.st_mode))
continue;

View file

@ -88,7 +88,7 @@ void GraphWidget::paint_event(GUI::PaintEvent& event)
Gfx::IntPoint current_point { x, inner_rect.bottom() - (int)scaled_value };
m_calculated_points.append(current_point);
}
ASSERT(m_calculated_points.size() <= m_values.size());
VERIFY(m_calculated_points.size() <= m_values.size());
if (format.graph_color_role != ColorRole::Base) {
// Fill the background for the area we have values for
Gfx::Path path;
@ -100,8 +100,8 @@ void GraphWidget::paint_event(GUI::PaintEvent& event)
if (!started_path)
return;
if (points_in_path > 1) {
ASSERT(current_point);
ASSERT(first_point);
VERIFY(current_point);
VERIFY(first_point);
path.line_to({ current_point->x() - 1, inner_rect.bottom() + 1 });
path.line_to({ first_point->x() + 1, inner_rect.bottom() + 1 });
path.close();

View file

@ -48,7 +48,7 @@ MemoryStatsWidget* MemoryStatsWidget::the()
MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph)
: m_graph(graph)
{
ASSERT(!s_the);
VERIFY(!s_the);
s_the = this;
set_fixed_height(110);
@ -98,11 +98,11 @@ void MemoryStatsWidget::refresh()
{
auto proc_memstat = Core::File::construct("/proc/memstat");
if (!proc_memstat->open(Core::IODevice::OpenMode::ReadOnly))
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
auto file_contents = proc_memstat->read_all();
auto json_result = JsonValue::from_string(file_contents);
ASSERT(json_result.has_value());
VERIFY(json_result.has_value());
auto json = json_result.value().as_object();
[[maybe_unused]] unsigned kmalloc_eternal_allocated = json.get("kmalloc_eternal_allocated").to_u32();

View file

@ -55,7 +55,7 @@ public:
else if (c == 'P') // Physical (a resident page)
color = Color::Black;
else
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
painter.draw_line({ x, rect.top() }, { x, rect.bottom() }, color);
}

View file

@ -35,13 +35,13 @@ static ProcessModel* s_the;
ProcessModel& ProcessModel::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
ProcessModel::ProcessModel()
{
ASSERT(!s_the);
VERIFY(!s_the);
s_the = this;
m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png");
@ -138,7 +138,7 @@ String ProcessModel::column_name(int column) const
case Column::Veil:
return "Veil";
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -149,7 +149,7 @@ static String pretty_byte_size(size_t size)
GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
{
ASSERT(is_valid(index));
VERIFY(is_valid(index));
if (role == GUI::ModelRole::TextAlignment) {
switch (index.column()) {
@ -186,7 +186,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
case Column::IPv4SocketWriteBytes:
return Gfx::TextAlignment::CenterRight;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -256,7 +256,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
case Column::Veil:
return thread.current_state.veil;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (role == GUI::ModelRole::Display) {
@ -391,7 +391,7 @@ void ProcessModel::update()
m_threads.set(thread.tid, make<Thread>());
}
auto pit = m_threads.find(thread.tid);
ASSERT(pit != m_threads.end());
VERIFY(pit != m_threads.end());
(*pit).value->previous_state = (*pit).value->current_state;
(*pit).value->current_state = state;

View file

@ -171,7 +171,7 @@ static pid_t run_command(int ptm_fd, String command)
perror("execve");
exit(1);
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
return pid;

View file

@ -150,9 +150,9 @@ public:
void track_cursor_globally()
{
ASSERT(window());
VERIFY(window());
auto window_id = window()->window_id();
ASSERT(window_id >= 0);
VERIFY(window_id >= 0);
set_global_cursor_tracking(true);
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetGlobalCursorTracking>(window_id, true);

View file

@ -37,9 +37,9 @@ EyesWidget::~EyesWidget()
void EyesWidget::track_cursor_globally()
{
ASSERT(window());
VERIFY(window());
auto window_id = window()->window_id();
ASSERT(window_id >= 0);
VERIFY(window_id >= 0);
set_global_cursor_tracking(true);
GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetGlobalCursorTracking>(window_id, true);
@ -124,7 +124,7 @@ Gfx::IntPoint EyesWidget::pupil_center(Gfx::IntRect& eyeball_bounds) const
(slope_squared / width_squared + 1 / height_squared)
);
} else {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
// clang-format on

View file

@ -110,7 +110,7 @@ void Canvas::draw(Gfx::Painter& painter)
// grid does not have an alpha channel.
auto grid = Gfx::Bitmap::load_from_file("/res/wallpapers/grid.png");
ASSERT(!grid->has_alpha_channel());
VERIFY(!grid->has_alpha_channel());
painter.fill_rect({ 25, 122, 62, 20 }, Color::Green);
painter.blit({ 25, 122 }, *grid, { (grid->width() - 62) / 2, (grid->height() - 20) / 2 + 40, 62, 20 }, 0.9);

View file

@ -66,8 +66,8 @@ public:
virtual int column_count(const GUI::ModelIndex&) const override { return 1; }
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
{
ASSERT(index.is_valid());
ASSERT(index.column() == 0);
VERIFY(index.is_valid());
VERIFY(index.column() == 0);
if (role == GUI::ModelRole::Display)
return m_model_items.at(index.row());
return {};

View file

@ -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);

View file

@ -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);
}

View file

@ -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 {};
}
}

View file

@ -87,7 +87,7 @@ String RegistersModel::column_name(int column) const
case Column::Value:
return "Value";
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
return {};
}
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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

View file

@ -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()

View file

@ -69,7 +69,7 @@ public:
case Column::MatchedText:
return "Text";
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -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);

View file

@ -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) {

View file

@ -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()));
}

View file

@ -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));
}

View file

@ -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());
}
}

View file

@ -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);

View file

@ -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;

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);

View file

@ -69,7 +69,7 @@ GUI::ModelIndex WidgetTreeModel::parent_index(const GUI::ModelIndex& index) cons
++grandparent_child_index;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
return {};
}

View file

@ -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();

View file

@ -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 {};
}

View file

@ -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

View file

@ -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());

View file

@ -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 {};
}
}

View file

@ -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);
}

View file

@ -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 {};
}
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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 {};

View file

@ -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(

View file

@ -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();
}

View file

@ -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());

View file

@ -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;
}

Some files were not shown because too many files have changed in this diff Show more