mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 12:17:35 +00:00
Inspector: Add a GUI tool for viewing a remote process's CObject graph
Here comes the foundation for a neat remote debugging tool. Right now, it connects to a remote process's CEventLoop RPC socket and retreives the remote object graph JSON dump. The remote object graph is then reconstructed and exposed through a GModel subclass, which is then displayed in a GTreeView. It's pretty cool, I think. :^)
This commit is contained in:
parent
5c7bb09a73
commit
05cd178477
6 changed files with 215 additions and 0 deletions
41
DevTools/Inspector/main.cpp
Normal file
41
DevTools/Inspector/main.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "RemoteObjectGraphModel.h"
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GTreeView.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <stdio.h>
|
||||
|
||||
[[noreturn]] static void print_usage_and_exit()
|
||||
{
|
||||
printf("usage: Inspector <pid>\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
print_usage_and_exit();
|
||||
|
||||
bool ok;
|
||||
pid_t pid = String(argv[1]).to_int(ok);
|
||||
if (!ok)
|
||||
print_usage_and_exit();
|
||||
|
||||
GApplication app(argc, argv);
|
||||
|
||||
auto* window = new GWindow;
|
||||
window->set_title("Inspector");
|
||||
window->set_rect(150, 150, 300, 500);
|
||||
|
||||
auto* widget = new GWidget;
|
||||
window->set_main_widget(widget);
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
|
||||
auto* tree_view = new GTreeView(widget);
|
||||
tree_view->set_model(RemoteObjectGraphModel::create_with_pid(pid));
|
||||
tree_view->model()->update();
|
||||
|
||||
window->show();
|
||||
return app.exec();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue