mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 23:52:57 +00:00
LibDebug+Everywhere: Avoid void* -> FlatPtr -> void* dance
And limit the `void*` to the functions that interface the system (i.e. ptrace wrappers). This generally makes the code less riddled with casts.
This commit is contained in:
parent
b27b22a68c
commit
6d64b13a1b
Notes:
sideshowbarker
2024-07-17 20:03:58 +09:00
Author: https://github.com/alimpfard
Commit: 6d64b13a1b
Pull-request: https://github.com/SerenityOS/serenity/pull/12153
15 changed files with 97 additions and 96 deletions
|
@ -53,7 +53,7 @@ JS::ThrowCompletionOr<bool> DebuggerGlobalJSObject::internal_set(JS::PropertyKey
|
|||
auto& target_variable = **it;
|
||||
auto debugger_value = js_to_debugger(value, target_variable);
|
||||
if (debugger_value.has_value())
|
||||
return Debugger::the().session()->poke((u32*)target_variable.location_data.address, debugger_value.value());
|
||||
return Debugger::the().session()->poke(target_variable.location_data.address, debugger_value.value());
|
||||
auto error_string = String::formatted("Cannot convert JS value {} to variable {} of type {}", value.to_string_without_side_effects(), property_name.as_string(), target_variable.type_name);
|
||||
return vm().throw_completion<JS::TypeError>(const_cast<DebuggerGlobalJSObject&>(*this), move(error_string));
|
||||
}
|
||||
|
@ -66,19 +66,19 @@ Optional<JS::Value> DebuggerGlobalJSObject::debugger_to_js(const Debug::DebugInf
|
|||
auto variable_address = variable.location_data.address;
|
||||
|
||||
if (variable.is_enum_type() || variable.type_name == "int") {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
auto value = Debugger::the().session()->peek(variable_address);
|
||||
VERIFY(value.has_value());
|
||||
return JS::Value((i32)value.value());
|
||||
}
|
||||
|
||||
if (variable.type_name == "char") {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
auto value = Debugger::the().session()->peek(variable_address);
|
||||
VERIFY(value.has_value());
|
||||
return JS::Value((char)value.value());
|
||||
}
|
||||
|
||||
if (variable.type_name == "bool") {
|
||||
auto value = Debugger::the().session()->peek((u32*)variable_address);
|
||||
auto value = Debugger::the().session()->peek(variable_address);
|
||||
VERIFY(value.has_value());
|
||||
return JS::Value(value.value() != 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue