Open honggyukim opened 5 years ago
We can reuse all the tree representation same as current TUI graph.
We may be able to draw type tree even for Linux kernel and its device driver modules because it doesn't have to be executed.
Here is an imaginary type tree in TUI mode. It only represents struct debug_info
and its child types.
There are some repeated types so they are folded here.
(1) uftrace
└─(1) struct debug_info
├─(1) Dwarf *dw
│ └─(1) <incomplete type>
│
├─(1) uint64_t offset;
│
├─(1) struct rb_root args;
│ └─(1) struct rb_node *rb_node;
│ ├─(1) unsigned long rb_parent_color;
│ │
│ ├▶(1) struct rb_node *rb_right;
│ │
│ └▶(1) struct rb_node *rb_left;
│
├▶(1) struct rb_root rets;
│
├▶(1) struct rb_root enums;
│
├─(1) struct list_head files;
│ ├▶(1) struct list_head *prev;
│ │
│ └▶(1) struct list_head *next;
│
├─(1) struct debug_location *locs;
│ ├─(1) struct sym *sym;
│ │ ├─(1) uint64_t addr;
│ │ │
│ │ ├─(1) unsigned int size;
│ │ │
│ │ ├─(1) enum symtype type;
│ │ │
│ │ └─(1) char *name;
│ │
│ └─(1) struct debug_file *file;
│ ├▶(1) struct list_head list;
│ │
│ └─(1) char *name;
│
├─(1) int nr_locs;
│
└─(1) int nr_locs_used;
If the above tree is collapsed, it may look like.
(1) uftrace
└─(1) struct debug_info
├▶(1) Dwarf *dw
│
├─(1) uint64_t offset;
│
├▶(1) struct rb_root args;
│
├▶(1) struct rb_root rets;
│
├▶(1) struct rb_root enums;
│
├▶(1) struct list_head files;
│
├▶(1) struct debug_location *locs;
│
├─(1) int nr_locs;
│
└─(1) int nr_locs_used;
The original type is as follows:
struct debug_info {
Dwarf *dw;
uint64_t offset;
struct rb_root args;
struct rb_root rets;
struct rb_root enums;
struct list_head files;
struct debug_location *locs;
int nr_locs;
int nr_locs_used;
};
There's another idea to add useful info to TUI. I think it'd be great to have the following tree information especially in TUI.
dlopen
ed libraries.type tree might not for uftrace, because it can be done solely based on binary itself if it has dwarf info. I know that but it'd be really useful as well as runtime trace info.
I'm just leaving a note for later reference although it's not urgent at all.