hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/perf/ui/gtk/annotate.c
....@@ -1,8 +1,12 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include "gtk.h"
3
+#include "util/sort.h"
34 #include "util/debug.h"
45 #include "util/annotate.h"
56 #include "util/evsel.h"
7
+#include "util/map.h"
8
+#include "util/dso.h"
9
+#include "util/symbol.h"
610 #include "ui/helpline.h"
711 #include <inttypes.h>
812 #include <signal.h>
....@@ -50,10 +54,10 @@
5054 return ret;
5155 }
5256
53
-static int perf_gtk__get_offset(char *buf, size_t size, struct symbol *sym,
54
- struct map *map, struct disasm_line *dl)
57
+static int perf_gtk__get_offset(char *buf, size_t size, struct map_symbol *ms,
58
+ struct disasm_line *dl)
5559 {
56
- u64 start = map__rip_2objdump(map, sym->start);
60
+ u64 start = map__rip_2objdump(ms->map, ms->sym->start);
5761
5862 strcpy(buf, "");
5963
....@@ -87,10 +91,11 @@
8791 return ret;
8892 }
8993
90
-static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
91
- struct map *map, struct perf_evsel *evsel,
94
+static int perf_gtk__annotate_symbol(GtkWidget *window, struct map_symbol *ms,
95
+ struct evsel *evsel,
9296 struct hist_browser_timer *hbt __maybe_unused)
9397 {
98
+ struct symbol *sym = ms->sym;
9499 struct disasm_line *pos, *n;
95100 struct annotation *notes;
96101 GType col_types[MAX_ANN_COLS];
....@@ -125,8 +130,8 @@
125130
126131 gtk_list_store_append(store, &iter);
127132
128
- if (perf_evsel__is_group_event(evsel)) {
129
- for (i = 0; i < evsel->nr_members; i++) {
133
+ if (evsel__is_group_event(evsel)) {
134
+ for (i = 0; i < evsel->core.nr_members; i++) {
130135 ret += perf_gtk__get_percent(s + ret,
131136 sizeof(s) - ret,
132137 sym, pos,
....@@ -140,7 +145,7 @@
140145
141146 if (ret)
142147 gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1);
143
- if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos))
148
+ if (perf_gtk__get_offset(s, sizeof(s), ms, pos))
144149 gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1);
145150 if (perf_gtk__get_line(s, sizeof(s), pos))
146151 gtk_list_store_set(store, &iter, ANN_COL__LINE, s, -1);
....@@ -149,30 +154,30 @@
149154 gtk_container_add(GTK_CONTAINER(window), view);
150155
151156 list_for_each_entry_safe(pos, n, &notes->src->source, al.node) {
152
- list_del(&pos->al.node);
157
+ list_del_init(&pos->al.node);
153158 disasm_line__free(pos);
154159 }
155160
156161 return 0;
157162 }
158163
159
-static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
160
- struct perf_evsel *evsel,
164
+static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
161165 struct hist_browser_timer *hbt)
162166 {
167
+ struct symbol *sym = ms->sym;
163168 GtkWidget *window;
164169 GtkWidget *notebook;
165170 GtkWidget *scrolled_window;
166171 GtkWidget *tab_label;
167172 int err;
168173
169
- if (map->dso->annotate_warned)
174
+ if (ms->map->dso->annotate_warned)
170175 return -1;
171176
172
- err = symbol__annotate(sym, map, evsel, 0, &annotation__default_options, NULL);
177
+ err = symbol__annotate(ms, evsel, &annotation__default_options, NULL);
173178 if (err) {
174179 char msg[BUFSIZ];
175
- symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
180
+ symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
176181 ui__error("Couldn't annotate %s: %s\n", sym->name, msg);
177182 return -1;
178183 }
....@@ -230,15 +235,15 @@
230235 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window,
231236 tab_label);
232237
233
- perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt);
238
+ perf_gtk__annotate_symbol(scrolled_window, ms, evsel, hbt);
234239 return 0;
235240 }
236241
237242 int hist_entry__gtk_annotate(struct hist_entry *he,
238
- struct perf_evsel *evsel,
243
+ struct evsel *evsel,
239244 struct hist_browser_timer *hbt)
240245 {
241
- return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt);
246
+ return symbol__gtk_annotate(&he->ms, evsel, hbt);
242247 }
243248
244249 void perf_gtk__show_annotations(void)