perf hists browser: Handle browsing empty hists tree
Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
d7603d5122
commit
60098917c0
|
@ -639,6 +639,9 @@ static void ui_browser__hists_seek(struct ui_browser *self,
|
||||||
struct rb_node *nd;
|
struct rb_node *nd;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
if (self->nr_entries == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (whence) {
|
switch (whence) {
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
nd = hists__filter_entries(rb_first(self->entries));
|
nd = hists__filter_entries(rb_first(self->entries));
|
||||||
|
@ -820,8 +823,8 @@ int hists__browse(struct hists *self, const char *helpline,
|
||||||
hists__browser_title(self, msg, sizeof(msg), ev_name,
|
hists__browser_title(self, msg, sizeof(msg), ev_name,
|
||||||
dso_filter, thread_filter);
|
dso_filter, thread_filter);
|
||||||
while (1) {
|
while (1) {
|
||||||
const struct thread *thread;
|
const struct thread *thread = NULL;
|
||||||
const struct dso *dso;
|
const struct dso *dso = NULL;
|
||||||
char *options[16];
|
char *options[16];
|
||||||
int nr_options = 0, choice = 0, i,
|
int nr_options = 0, choice = 0, i,
|
||||||
annotate = -2, zoom_dso = -2, zoom_thread = -2,
|
annotate = -2, zoom_dso = -2, zoom_thread = -2,
|
||||||
|
@ -829,8 +832,10 @@ int hists__browse(struct hists *self, const char *helpline,
|
||||||
|
|
||||||
key = hist_browser__run(browser, msg);
|
key = hist_browser__run(browser, msg);
|
||||||
|
|
||||||
thread = hist_browser__selected_thread(browser);
|
if (browser->he_selection != NULL) {
|
||||||
dso = browser->selection->map ? browser->selection->map->dso : NULL;
|
thread = hist_browser__selected_thread(browser);
|
||||||
|
dso = browser->selection->map ? browser->selection->map->dso : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case NEWT_KEY_TAB:
|
case NEWT_KEY_TAB:
|
||||||
|
@ -841,7 +846,8 @@ int hists__browse(struct hists *self, const char *helpline,
|
||||||
*/
|
*/
|
||||||
goto out_free_stack;
|
goto out_free_stack;
|
||||||
case 'a':
|
case 'a':
|
||||||
if (browser->selection->map == NULL &&
|
if (browser->selection == NULL ||
|
||||||
|
browser->selection->map == NULL ||
|
||||||
browser->selection->map->dso->annotate_warned)
|
browser->selection->map->dso->annotate_warned)
|
||||||
continue;
|
continue;
|
||||||
goto do_annotate;
|
goto do_annotate;
|
||||||
|
@ -887,7 +893,8 @@ int hists__browse(struct hists *self, const char *helpline,
|
||||||
goto out_free_stack;
|
goto out_free_stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser->selection->sym != NULL &&
|
if (browser->selection != NULL &&
|
||||||
|
browser->selection->sym != NULL &&
|
||||||
!browser->selection->map->dso->annotate_warned &&
|
!browser->selection->map->dso->annotate_warned &&
|
||||||
asprintf(&options[nr_options], "Annotate %s",
|
asprintf(&options[nr_options], "Annotate %s",
|
||||||
browser->selection->sym->name) > 0)
|
browser->selection->sym->name) > 0)
|
||||||
|
@ -906,7 +913,8 @@ int hists__browse(struct hists *self, const char *helpline,
|
||||||
(dso->kernel ? "the Kernel" : dso->short_name)) > 0)
|
(dso->kernel ? "the Kernel" : dso->short_name)) > 0)
|
||||||
zoom_dso = nr_options++;
|
zoom_dso = nr_options++;
|
||||||
|
|
||||||
if (browser->selection->map != NULL &&
|
if (browser->selection != NULL &&
|
||||||
|
browser->selection->map != NULL &&
|
||||||
asprintf(&options[nr_options], "Browse map details") > 0)
|
asprintf(&options[nr_options], "Browse map details") > 0)
|
||||||
browse_map = nr_options++;
|
browse_map = nr_options++;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue