mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)
Use this instead of uintptr_t throughout the codebase. This makes it possible to pass a FlatPtr to something that has u32 and u64 overloads.
This commit is contained in:
parent
b98d8ad5b0
commit
b1058b33fb
36 changed files with 164 additions and 161 deletions
|
@ -42,8 +42,8 @@ public:
|
|||
RemoteObject* parent { nullptr };
|
||||
NonnullOwnPtrVector<RemoteObject> children;
|
||||
|
||||
uintptr_t address { 0 };
|
||||
uintptr_t parent_address { 0 };
|
||||
FlatPtr address { 0 };
|
||||
FlatPtr parent_address { 0 };
|
||||
String class_name;
|
||||
String name;
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ void RemoteObjectPropertyModel::update()
|
|||
void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& new_value)
|
||||
{
|
||||
auto& property = m_properties[index.row()];
|
||||
uintptr_t address = m_object.address;
|
||||
FlatPtr address = m_object.address;
|
||||
RemoteProcess::the().set_property(address, property.name.to_string(), new_value.to_string());
|
||||
property.value = new_value.to_string();
|
||||
did_update();
|
||||
|
|
|
@ -65,14 +65,14 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response)
|
|||
auto& object_array = objects.as_array();
|
||||
|
||||
NonnullOwnPtrVector<RemoteObject> remote_objects;
|
||||
HashMap<uintptr_t, RemoteObject*> objects_by_address;
|
||||
HashMap<FlatPtr, RemoteObject*> objects_by_address;
|
||||
|
||||
for (auto& value : object_array.values()) {
|
||||
ASSERT(value.is_object());
|
||||
auto& object = value.as_object();
|
||||
auto remote_object = make<RemoteObject>();
|
||||
remote_object->address = object.get("address").to_number<uintptr_t>();
|
||||
remote_object->parent_address = object.get("parent").to_number<uintptr_t>();
|
||||
remote_object->address = object.get("address").to_number<FlatPtr>();
|
||||
remote_object->parent_address = object.get("parent").to_number<FlatPtr>();
|
||||
remote_object->name = object.get("name").to_string();
|
||||
remote_object->class_name = object.get("class_name").to_string();
|
||||
remote_object->json = object;
|
||||
|
@ -105,7 +105,7 @@ void RemoteProcess::send_request(const JsonObject& request)
|
|||
m_socket->write(serialized);
|
||||
}
|
||||
|
||||
void RemoteProcess::set_inspected_object(uintptr_t address)
|
||||
void RemoteProcess::set_inspected_object(FlatPtr address)
|
||||
{
|
||||
JsonObject request;
|
||||
request.set("type", "SetInspectedObject");
|
||||
|
@ -113,7 +113,7 @@ void RemoteProcess::set_inspected_object(uintptr_t address)
|
|||
send_request(request);
|
||||
}
|
||||
|
||||
void RemoteProcess::set_property(uintptr_t object, const StringView& name, const JsonValue& value)
|
||||
void RemoteProcess::set_property(FlatPtr object, const StringView& name, const JsonValue& value)
|
||||
{
|
||||
JsonObject request;
|
||||
request.set("type", "SetProperty");
|
||||
|
|
|
@ -45,9 +45,9 @@ public:
|
|||
RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; }
|
||||
const NonnullOwnPtrVector<RemoteObject>& roots() const { return m_roots; }
|
||||
|
||||
void set_inspected_object(uintptr_t);
|
||||
void set_inspected_object(FlatPtr);
|
||||
|
||||
void set_property(uintptr_t object, const StringView& name, const JsonValue& value);
|
||||
void set_property(FlatPtr object, const StringView& name, const JsonValue& value);
|
||||
|
||||
Function<void()> on_update;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ void Profile::rebuild_tree()
|
|||
return new_root;
|
||||
};
|
||||
|
||||
HashTable<uintptr_t> live_allocations;
|
||||
HashTable<FlatPtr> live_allocations;
|
||||
|
||||
for (auto& event : m_events) {
|
||||
if (has_timestamp_filter_range()) {
|
||||
|
@ -207,10 +207,10 @@ OwnPtr<Profile> Profile::load_from_perfcore_file(const StringView& path)
|
|||
event.type = perf_event.get("type").to_string();
|
||||
|
||||
if (event.type == "malloc") {
|
||||
event.ptr = perf_event.get("ptr").to_number<uintptr_t>();
|
||||
event.ptr = perf_event.get("ptr").to_number<FlatPtr>();
|
||||
event.size = perf_event.get("size").to_number<size_t>();
|
||||
} else if (event.type == "free") {
|
||||
event.ptr = perf_event.get("ptr").to_number<uintptr_t>();
|
||||
event.ptr = perf_event.get("ptr").to_number<FlatPtr>();
|
||||
}
|
||||
|
||||
auto stack_array = perf_event.get("stack").as_array();
|
||||
|
@ -239,7 +239,7 @@ OwnPtr<Profile> Profile::load_from_perfcore_file(const StringView& path)
|
|||
if (event.frames.size() < 2)
|
||||
continue;
|
||||
|
||||
uintptr_t innermost_frame_address = event.frames.at(1).address;
|
||||
FlatPtr innermost_frame_address = event.frames.at(1).address;
|
||||
event.in_kernel = innermost_frame_address >= 0xc0000000;
|
||||
|
||||
events.append(move(event));
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
struct Event {
|
||||
u64 timestamp { 0 };
|
||||
String type;
|
||||
uintptr_t ptr { 0 };
|
||||
FlatPtr ptr { 0 };
|
||||
size_t size { 0 };
|
||||
bool in_kernel { false };
|
||||
Vector<Frame> frames;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue