Dear Maintainer,
I could reproduce using linux-perf-5.2 and it is
also visible in linux-perf-5.4 5.4.8-1,
by just pressing enter.

The crash happens because in line 3172
function hist_browser__selected_entry returns
browser->he_selection, which is at this time a
null pointer.
This null pointer gets dereferenced to
access the res_samples member.

Upstream seems to have fixed other occourences [1]
of browser->he_selection being null, but this is
already contained in 5.4 while a crash still happens.

Kind regards,
Bernhard



Program received signal SIGSEGV, Segmentation fault.
(rr) bt
#0  perf_evsel__hists_browse (evsel=0x55e794ebcb40, 
nr_events=nr_events@entry=1, helpline=helpline@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", 
left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, min_pcnt=<optimized out>, 
env=env@entry=0x55e794eb54f0, warn_lost_event=true, 
annotation_opts=0x7ffcc3063dc8) at ui/browsers/hists.c:3170
#1  0x000055e79385cce9 in perf_evlist__tui_browse_hists 
(evlist=evlist@entry=0x55e794ebc0c0, help=help@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", hbt=hbt@entry=0x0, 
min_pcnt=<optimized out>, env=env@entry=0x55e794eb54f0, 
warn_lost_event=warn_lost_event@entry=true, 
annotation_opts=annotation_opts@entry=0x7ffcc3063dc8) at 
ui/browsers/hists.c:3422
#2  0x000055e7936f1ece in report__browse_hists (rep=0x7ffcc3063c30) at 
builtin-report.c:585
#3  __cmd_report (rep=0x7ffcc3063c30) at builtin-report.c:930
#4  cmd_report (argc=<optimized out>, argv=<optimized out>) at 
builtin-report.c:1475
#5  0x000055e79375b823 in run_builtin (p=0x55e793a9ef90 <commands+240>, argc=2, 
argv=0x7ffcc30661f0) at perf.c:312
#6  0x000055e7936d6a2c in handle_internal_command (argv=<optimized out>, 
argc=<optimized out>) at perf.c:364
#7  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:408
#8  main (argc=2, argv=0x7ffcc30661f0) at perf.c:538


https://sources.debian.org/src/linux/5.4.8-1/tools/perf/ui/browsers/hists.c/#L2217
    2217 static struct hist_entry *hist_browser__selected_entry(struct 
hist_browser *browser)
    2218 {
    2219        return browser->he_selection;
    2220 }

https://sources.debian.org/src/linux/5.4.8-1/tools/perf/ui/browsers/hists.c/#L3170
    3170                nr_options += add_res_sample_opt(browser, 
&actions[nr_options],
    3171                                                 &options[nr_options],
    3172                                 
hist_browser__selected_entry(browser)->res_samples,
    3173                                 evsel, A_NORMAL);


[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/perf/ui/browsers/hists.c?id=ceb75476db1617a88cc29b09839acacb69aa076e
# Bullseye/testing amd64 qemu VM 2020-01-13


apt update
apt dist-upgrade


apt install systemd-coredump mc colorized-logs gdb rr linux-perf-5.4 
linux-perf-5.4-dbgsym


perf record ls
perf report perf.data
# Press enter


###########



# 5.2.17-1+b1


wget 
https://snapshot.debian.org/archive/debian/20191006T205801Z/pool/main/l/linux/linux-perf-5.2_5.2.17-1%2Bb1_amd64.deb
wget 
https://snapshot.debian.org/archive/debian/20191006T205801Z/pool/main/l/linux/linux-image-5.2.0-3-amd64-unsigned_5.2.17-1%2Bb1_amd64.deb
wget 
https://snapshot.debian.org/archive/debian-debug/20191006T210740Z/pool/main/l/linux/linux-perf-5.2-dbgsym_5.2.17-1%2Bb1_amd64.deb

dpkg -i linux-image-5.2.0-3-amd64-unsigned_5.2.17-1+b1_amd64.deb 
linux-perf-5.2_5.2.17-1+b1_amd64.deb

reboot


root@debian:~# uname -a
Linux debian 5.2.0-3-amd64 #1 SMP Debian 5.2.17-1 (2019-10-06) x86_64 GNU/Linux

root@debian:~# perf record ls
...
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0,009 MB perf.data (2 samples) ]

root@debian:~# perf report perf.data
perf: Speicherzugriffsfehler
-------- backtrace --------
perf_5.2(+0x322d14)[0x5631251b2d14]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a0ff)[0x7f88ec6ee0ff]
perf_5.2(+0x32021e)[0x5631251b021e]
perf_5.2(+0x3211c8)[0x5631251b11c8]
perf_5.2(+0x1bb4f5)[0x56312504b4f5]
perf_5.2(+0x222072)[0x5631250b2072]
perf_5.2(+0x1a0a13)[0x563125030a13]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7f88ec6dabba]
perf_5.2(+0x1a0c69)[0x563125030c69]



root@debian:~# gdb -q --args perf_5.2 report perf.data
Reading symbols from perf_5.2...
(No debugging symbols found in perf_5.2)
(gdb) set width 0
(gdb) set pagination off
(gdb) run
...
rogram received signal SIGSEGV, Segmentation fault.
                                                   0x000055555587421e in ?? ()
(gdb) bt
#0  0x000055555587421e in ?? ()
#1  0x00005555558751c9 in ?? ()
#2  0x000055555570f4f6 in ?? ()
#3  0x0000555555776073 in ?? ()
#4  0x00005555556f4a14 in ?? ()
#5  0x00007ffff758abbb in __libc_start_main (main=0x5555556f43b0, argc=3, 
argv=0x7fffffffecf8, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffece8) at ../csu/libc-start.c:308
#6  0x00005555556f4c6a in ?? ()
(gdb) generate-core /root/core-perf_5.2
warning: target file /proc/800/cmdline contained unexpected null characters
Saved corefile /root/core-perf_5.2

root@debian:~# dpkg -i linux-perf-5.2-dbgsym_5.2.17-1+b1_amd64.deb


root@debian:~# gdb -q /usr/bin/perf_5.2 --core /root/core-perf_5.2
Reading symbols from /usr/bin/perf_5.2...
Reading symbols from 
/usr/lib/debug/.build-id/bd/5fcb2f83a4026fe81411cf5617863b68cd4553.debug...
[New LWP 800]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/bin/perf_5.2 report perf.data'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055555587421e in add_res_sample_opt (browser=<optimized out>, 
type=<optimized out>, evsel=<optimized out>, res_sample=<optimized out>, 
optstr=<optimized out>, act=<optimized out>)
    at ui/browsers/hists.c:3159
3159    ui/browsers/hists.c: Datei oder Verzeichnis nicht gefunden.
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0x000055555587421e in add_res_sample_opt (browser=<optimized out>, 
type=<optimized out>, evsel=<optimized out>, res_sample=<optimized out>, 
optstr=<optimized out>, act=<optimized out>) at ui/browsers/hists.c:3159
#1  perf_evsel__hists_browse (evsel=0x555555c09a90, 
nr_events=nr_events@entry=1, helpline=helpline@entry=0x555555ccb5e0 "Tip: To 
record callchains for each sample: perf record -g", 
left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, min_pcnt=<optimized out>, 
env=env@entry=0x555555c02470, warn_lost_event=true, 
annotation_opts=0x7fffffffca00) at ui/browsers/hists.c:3159
#2  0x00005555558751c9 in perf_evlist__tui_browse_hists 
(evlist=evlist@entry=0x555555c09020, help=0x555555ccb5e0 "Tip: To record 
callchains for each sample: perf record -g", hbt=hbt@entry=0x0, 
min_pcnt=<optimized out>, env=env@entry=0x555555c02470, 
warn_lost_event=warn_lost_event@entry=true, 
annotation_opts=annotation_opts@entry=0x7fffffffca00) at 
ui/browsers/hists.c:3411
#3  0x000055555570f4f6 in report__browse_hists (rep=0x7fffffffc890) at 
builtin-report.c:564
#4  __cmd_report (rep=0x7fffffffc890) at builtin-report.c:909
#5  cmd_report (argc=<optimized out>, argv=<optimized out>) at 
builtin-report.c:1444
#6  0x0000555555776073 in run_builtin (p=0x555555a9aa50 <commands+240>, argc=2, 
argv=0x7fffffffed00) at perf.c:303
#7  0x00005555556f4a14 in handle_internal_command (argv=<optimized out>, 
argc=<optimized out>) at perf.c:355
#8  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:399
#9  main (argc=2, argv=0x7fffffffed00) at perf.c:521

(gdb) display/i $pc
1: x/i $pc
=> 0x55555587421e <perf_evsel__hists_browse+5054>:      cmpq   $0x0,0x128(%rax)

(gdb) print/x $rax
$1 = 0x0





############




root@debian:~# uname -a
Linux debian 5.4.0-2-amd64 #1 SMP Debian 5.4.8-1 (2020-01-05) x86_64 GNU/Linux
root@debian:~# perf record ls
...
[ perf record: Woken up 1 times to write data ]
way too many cpu caches..[ perf record: Captured and wrote 0,009 MB perf.data 
(1 samples) ]

root@debian:~# perf report perf.data
perf: Speicherzugriffsfehler
-------- backtrace --------
perf_5.4(+0x332844)[0x5628ad129844]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a0ff)[0x7f42cc5a90ff]
perf_5.4(+0x32fd4e)[0x5628ad126d4e]
perf_5.4(+0x330ce8)[0x5628ad127ce8]
perf_5.4(+0x1c5ecd)[0x5628acfbcecd]
perf_5.4(+0x22f822)[0x5628ad026822]
perf_5.4(+0x1aaa2b)[0x5628acfa1a2b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7f42cc595bba]
perf_5.4(+0x1aac89)[0x5628acfa1c89]



root@debian:~# uname -a
Linux debian 5.4.0-2-amd64 #1 SMP Debian 5.4.8-1 (2020-01-05) x86_64 GNU/Linux
root@debian:~# perf record ls
perf.data
[ perf record: Woken up 1 times to write data ]
way too many cpu caches..[ perf record: Captured and wrote 0,009 MB perf.data 
(1 samples) ]
root@debian:~# perf report perf.data
perf: Speicherzugriffsfehler
-------- backtrace --------
perf_5.4(+0x332844)[0x5596a509a844]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a0ff)[0x7fc685b3c0ff]
perf_5.4(+0x32fd4e)[0x5596a5097d4e]
perf_5.4(+0x330ce8)[0x5596a5098ce8]
perf_5.4(+0x1c5ecd)[0x5596a4f2decd]
perf_5.4(+0x22f822)[0x5596a4f97822]
perf_5.4(+0x1aaa2b)[0x5596a4f12a2b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7fc685b28bba]
perf_5.4(+0x1aac89)[0x5596a4f12c89]

root@debian:~# gdb -q --args perf_5.4 report perf.data
Reading symbols from perf_5.4...
(No debugging symbols found in perf_5.4)
(gdb) set width 0
(gdb) set pagination off
(gdb) run

rogram received signal SIGSEGV, Segmentation fault.
                                                   0x0000555555883d4e in ?? ()
(gdb) bt
#0  0x0000555555883d4e in ?? ()
#1  0x0000555555884ce9 in ?? ()
#2  0x0000555555719ece in ?? ()
#3  0x0000555555783823 in ?? ()
#4  0x00005555556fea2c in ?? ()
#5  0x00007ffff758abbb in __libc_start_main (main=0x5555556fe3b0, argc=3, 
argv=0x7fffffffecf8, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffece8) at ../csu/libc-start.c:308
#6  0x00005555556fec8a in ?? ()
(gdb) generate-core /root/core-perf_5.4
warning: target file /proc/634/cmdline contained unexpected null characters
Saved corefile /root/core-perf_5.4


root@debian:~# gdb -q /usr/bin/perf_5.4 --core /root/core-perf_5.4
Reading symbols from /usr/bin/perf_5.4...
Reading symbols from 
/usr/lib/debug/.build-id/b0/e42553e7a20a14ec5bcac6ca13d988215cf5eb.debug...
[New LWP 634]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/bin/perf_5.4 report perf.data'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000555555883d4e in add_res_sample_opt (browser=<optimized out>, 
type=<optimized out>, evsel=<optimized out>, res_sample=<optimized out>, 
optstr=<optimized out>, act=<optimized out>)
    at ui/browsers/hists.c:3170
3170    ui/browsers/hists.c: Datei oder Verzeichnis nicht gefunden.
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0x0000555555883d4e in add_res_sample_opt (browser=<optimized out>, 
type=<optimized out>, evsel=<optimized out>, res_sample=<optimized out>, 
optstr=<optimized out>, act=<optimized out>) at ui/browsers/hists.c:3170
#1  perf_evsel__hists_browse (evsel=0x555555c3cac0, 
nr_events=nr_events@entry=1, helpline=helpline@entry=0x555555cfe180 "Tip: Print 
event counts in CSV format with: perf stat -x,", 
left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, min_pcnt=<optimized out>, 
env=env@entry=0x555555c35470, warn_lost_event=true, 
annotation_opts=0x7fffffffc8d8) at ui/browsers/hists.c:3170
#2  0x0000555555884ce9 in perf_evlist__tui_browse_hists 
(evlist=evlist@entry=0x555555c3c040, help=help@entry=0x555555cfe180 "Tip: Print 
event counts in CSV format with: perf stat -x,", hbt=hbt@entry=0x0, 
min_pcnt=<optimized out>, env=env@entry=0x555555c35470, 
warn_lost_event=warn_lost_event@entry=true, 
annotation_opts=annotation_opts@entry=0x7fffffffc8d8) at 
ui/browsers/hists.c:3422
#3  0x0000555555719ece in report__browse_hists (rep=0x7fffffffc740) at 
builtin-report.c:585
#4  __cmd_report (rep=0x7fffffffc740) at builtin-report.c:930
#5  cmd_report (argc=<optimized out>, argv=<optimized out>) at 
builtin-report.c:1475
#6  0x0000555555783823 in run_builtin (p=0x555555ac6f90 <commands+240>, argc=2, 
argv=0x7fffffffed00) at perf.c:312
#7  0x00005555556fea2c in handle_internal_command (argv=<optimized out>, 
argc=<optimized out>) at perf.c:364
#8  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:408
#9  main (argc=2, argv=0x7fffffffed00) at perf.c:538

(gdb) display/i $pc
1: x/i $pc
=> 0x555555883d4e <perf_evsel__hists_browse+5134>:      cmpq   $0x0,0x130(%rax)

(gdb) print/x $rax
$1 = 0x0

(gdb) disassemble add_res_sample_opt
Dump of assembler code for function perf_evsel__hists_browse:
   0x0000555555882940 <+0>:     push   %rbp
...
   0x0000555555883d44 <+5124>:  mov    0x90(%rbx),%rax
   0x0000555555883d4b <+5131>:  movslq %r15d,%r12
=> 0x0000555555883d4e <+5134>:  cmpq   $0x0,0x130(%rax)
...

(gdb) print/x $rbx
$2 = 0x55555668fdb0






############


# With rr


root@debian:~# perf_5.4 record ls
perf.data  perf.data.old
[ perf record: Woken up 1 times to write data ]
way too many cpu caches..[ perf record: Captured and wrote 0,012 MB perf.data 
(44 samples) ]

root@debian:~# echo 1 > /proc/sys/kernel/perf_event_paranoid

root@debian:~# rr perf_5.4 report perf.data
rr: Saving execution to trace directory `/root/.local/share/rr/perf_5.4-0'.
perf: Speicherzugriffsfehler
-------- backtrace --------
perf_5.4(+0x332844)[0x55e79385e844]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a0ff)[0x7fdf3f0ee0ff]
perf_5.4(+0x32fd4e)[0x55e79385bd4e]
perf_5.4(+0x330ce8)[0x55e79385cce8]
perf_5.4(+0x1c5ecd)[0x55e7936f1ecd]
perf_5.4(+0x22f822)[0x55e79375b822]
perf_5.4(+0x1aaa2b)[0x55e7936d6a2b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7fdf3f0dabba]
perf_5.4(+0x1aac89)[0x55e7936d6c89]


root@debian:~# script
Script started, file is typescript
...

root@debian:~# cat typescript | ansi2txt

root@debian:~# rr replay /root/.local/share/rr/perf_5.4-0
GNU gdb (Debian 8.3.1-1) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from 
/root/.local/share/rr/perf_5.4-0/mmap_hardlink_3_perf_5.4...
Reading symbols from 
/usr/lib/debug/.build-id/b0/e42553e7a20a14ec5bcac6ca13d988215cf5eb.debug...
Really redefine built-in command "restart"? (y or n) [answered Y; input not 
from terminal]
Remote debugging using 127.0.0.1:837
Reading symbols from /lib64/ld-linux-x86-64.so.2...
Reading symbols from 
/usr/lib/debug/.build-id/63/4d7e79f67a625214f5f5e1d1ffd260b6481c2f.debug...
0x00007fdf3fb23090 in _start () from /lib64/ld-linux-x86-64.so.2
(rr) set width 0
(rr) set pagination off
(rr) cont
Continuing.
...

Program received signal SIGSEGV, Segmentation fault.
perf_evsel__hists_browse (evsel=0x55e794ebcb40, nr_events=nr_events@entry=1, 
helpline=helpline@entry=0x55e794f7c040 "Tip: System-wide collection from all 
CPUs: perf record -a", left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, 
min_pcnt=<optimized out>, env=env@entry=0x55e794eb54f0, warn_lost_event=true, 
annotation_opts=0x7ffcc3063dc8) at ui/browsers/hists.c:3170
3170    ui/browsers/hists.c: Datei oder Verzeichnis nicht gefunden.
(rr) bt
#0  perf_evsel__hists_browse (evsel=0x55e794ebcb40, 
nr_events=nr_events@entry=1, helpline=helpline@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", 
left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, min_pcnt=<optimized out>, 
env=env@entry=0x55e794eb54f0, warn_lost_event=true, 
annotation_opts=0x7ffcc3063dc8) at ui/browsers/hists.c:3170
#1  0x000055e79385cce9 in perf_evlist__tui_browse_hists 
(evlist=evlist@entry=0x55e794ebc0c0, help=help@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", hbt=hbt@entry=0x0, 
min_pcnt=<optimized out>, env=env@entry=0x55e794eb54f0, 
warn_lost_event=warn_lost_event@entry=true, 
annotation_opts=annotation_opts@entry=0x7ffcc3063dc8) at 
ui/browsers/hists.c:3422
#2  0x000055e7936f1ece in report__browse_hists (rep=0x7ffcc3063c30) at 
builtin-report.c:585
#3  __cmd_report (rep=0x7ffcc3063c30) at builtin-report.c:930
#4  cmd_report (argc=<optimized out>, argv=<optimized out>) at 
builtin-report.c:1475
#5  0x000055e79375b823 in run_builtin (p=0x55e793a9ef90 <commands+240>, argc=2, 
argv=0x7ffcc30661f0) at perf.c:312
#6  0x000055e7936d6a2c in handle_internal_command (argv=<optimized out>, 
argc=<optimized out>) at perf.c:364
#7  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:408
#8  main (argc=2, argv=0x7ffcc30661f0) at perf.c:538

(rr) display/i $pc
1: x/i $pc
=> 0x55e79385bd4e <perf_evsel__hists_browse+5134>:      cmpq   $0x0,0x130(%rax)
(rr) print/x $rax
$1 = 0x0
(rr) display/x $rax
2: /x $rax = 0x0

(rr) reverse-stepi
Program received signal SIGSEGV, Segmentation fault.
0x000055e79385bd4e in add_res_sample_opt (browser=<optimized out>, 
type=<optimized out>, evsel=<optimized out>, res_sample=<optimized out>, 
optstr=<optimized out>, act=<optimized out>) at ui/browsers/hists.c:3170
3170    in ui/browsers/hists.c
1: x/i $pc
=> 0x55e79385bd4e <perf_evsel__hists_browse+5134>:      cmpq   $0x0,0x130(%rax)
2: /x $rax = 0x0

(rr) 
0x000055e79385bd4b in perf_evsel__hists_browse (evsel=0x55e794ebcb40, 
nr_events=nr_events@entry=1, helpline=helpline@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", 
left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, min_pcnt=<optimized out>, 
env=env@entry=0x55e794eb54f0, warn_lost_event=true, 
annotation_opts=0x7ffcc3063dc8) at ui/browsers/hists.c:3170
3170    in ui/browsers/hists.c
1: x/i $pc
=> 0x55e79385bd4b <perf_evsel__hists_browse+5131>:      movslq %r15d,%r12
2: /x $rax = 0x0

(rr) 
3170    in ui/browsers/hists.c
1: x/i $pc
=> 0x55e79385bd44 <perf_evsel__hists_browse+5124>:      mov    0x90(%rbx),%rax
2: /x $rax = 0x1
(rr) print/x $rbx
$2 = 0x55e7958f5260
(rr) undisp 2
(rr) display/x $rbx
3: /x $rbx = 0x55e7958f5260

(rr) reverse-stepi
0x000055e79385bd41      3168    in ui/browsers/hists.c
1: x/i $pc
=> 0x55e79385bd41 <perf_evsel__hists_browse+5121>:      add    %eax,%r15d
3: /x $rbx = 0x55e7958f5260

(rr) 
0x000055e79385bd3a      3168    in ui/browsers/hists.c
1: x/i $pc
=> 0x55e79385bd3a <perf_evsel__hists_browse+5114>:      mov    
-0x25d8(%rbp),%r13
3: /x $rbx = 0x55e7958f5260

(rr) 
0x000055e793858eef in add_script_opt (browser=browser@entry=0x55e7958f5260, 
act=<optimized out>, act@entry=0x7ffcc30612d0, optstr=<optimized out>, 
thread=thread@entry=0x0, sym=sym@entry=0x0, evsel=evsel@entry=0x55e794ebcb40) 
at ui/browsers/hists.c:2655
2655    in ui/browsers/hists.c
1: x/i $pc
=> 0x55e793858eef <add_script_opt+495>: retq   
3: /x $rbx = 0x55e7958f5260

(rr) print browser
$3 = (struct hist_browser *) 0x55e7958f5260

(rr) print *browser
$4 = {b = {index = 0, top_idx = 0, top = 0x55e795de7ba8, entries = 
0x55e794ebcd58, y = 1, x = 0, width = 204, height = 60, rows = 59, columns = 4, 
horiz_scroll = 0, extra_title_lines = 1 '\001', current_color = 52, priv = 0x0, 
title = 0x7ffcc3061070 "Samples: 44 \002", helpline = 0x0, no_samples_msg = 
0x0, refresh_dimensions = 0x55e7938553d0 <hist_browser__refresh_dimensions>, 
refresh = 0x55e7938586f0 <hist_browser__refresh>, write = 0x0, seek = 
0x55e793857b90 <ui_browser__hists_seek>, filter = 0x0, nr_entries = 0, 
navkeypressed = false, use_navkeypressed = true}, hists = 0x55e794ebcd30, 
he_selection = 0x0, selection = 0x0, hbt = 0x0, pstack = 0x55e795dbfdb0, env = 
0x55e794eb54f0, annotation_opts = 0x7ffcc3063dc8, print_seq = 0, show_dso = 
false, show_headers = true, min_pcnt = 0, nr_non_filtered_entries = 0, 
nr_hierarchy_entries = 0, nr_callchain_rows = 0, c2c_filter = false, title = 
0x55e793855580 <hists_browser__scnprintf_title>}

(rr) ptype /o struct hist_browser
/* offset    |  size */  type = struct hist_browser {
/*    0      |   136 */    struct ui_browser {
/*    0      |     8 */        u64 index;
...
/*  133      |     1 */        _Bool use_navkeypressed;
/* XXX  2-byte padding */

                               /* total size (bytes):  136 */
                           } b;
/*  136      |     8 */    struct hists *hists;
/*  144      |     8 */    struct hist_entry *he_selection;                     
 <<<<<<<<<<<
/*  152      |     8 */    struct map_symbol *selection;
...
/*  240      |     8 */    int (*title)(struct hist_browser *, char *, size_t);

                           /* total size (bytes):  248 */
                         }
(rr) print 0x90
$5 = 144
(rr) print browser->he_selection
$6 = (struct hist_entry *) 0x0

(rr) bt
#0  0x000055e793858eef in add_script_opt (browser=browser@entry=0x55e7958f5260, 
act=<optimized out>, act@entry=0x7ffcc30612d0, optstr=<optimized out>, 
thread=thread@entry=0x0, sym=sym@entry=0x0, evsel=evsel@entry=0x55e794ebcb40) 
at ui/browsers/hists.c:2655
#1  0x000055e79385bd3a in perf_evsel__hists_browse (evsel=0x55e794ebcb40, 
nr_events=nr_events@entry=1, helpline=helpline@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", 
left_exits=left_exits@entry=false, hbt=hbt@entry=0x0, min_pcnt=<optimized out>, 
env=env@entry=0x55e794eb54f0, warn_lost_event=true, 
annotation_opts=0x7ffcc3063dc8) at ui/browsers/hists.c:3168
#2  0x000055e79385cce9 in perf_evlist__tui_browse_hists 
(evlist=evlist@entry=0x55e794ebc0c0, help=help@entry=0x55e794f7c040 "Tip: 
System-wide collection from all CPUs: perf record -a", hbt=hbt@entry=0x0, 
min_pcnt=<optimized out>, env=env@entry=0x55e794eb54f0, 
warn_lost_event=warn_lost_event@entry=true, 
annotation_opts=annotation_opts@entry=0x7ffcc3063dc8) at 
ui/browsers/hists.c:3422
#3  0x000055e7936f1ece in report__browse_hists (rep=0x7ffcc3063c30) at 
builtin-report.c:585
#4  __cmd_report (rep=0x7ffcc3063c30) at builtin-report.c:930
#5  cmd_report (argc=<optimized out>, argv=<optimized out>) at 
builtin-report.c:1475
#6  0x000055e79375b823 in run_builtin (p=0x55e793a9ef90 <commands+240>, argc=2, 
argv=0x7ffcc30661f0) at perf.c:312
#7  0x000055e7936d6a2c in handle_internal_command (argv=<optimized out>, 
argc=<optimized out>) at perf.c:364
#8  run_argv (argcp=<optimized out>, argv=<optimized out>) at perf.c:408
#9  main (argc=2, argv=0x7ffcc30661f0) at perf.c:538



https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/perf/ui/browsers/hists.c?id=ceb75476db1617a88cc29b09839acacb69aa076e



https://sources.debian.org/src/linux/5.4.8-1/tools/perf/ui/browsers/hists.c/#L2217
    2217 static struct hist_entry *hist_browser__selected_entry(struct 
hist_browser *browser)
    2218 {
    2219        return browser->he_selection;
    2220 }

https://sources.debian.org/src/linux/5.4.8-1/tools/perf/ui/browsers/hists.c/#L3170
    3170                nr_options += add_res_sample_opt(browser, 
&actions[nr_options],
    3171                                                 &options[nr_options],
    3172                                 
hist_browser__selected_entry(browser)->res_samples,
    3173                                 evsel, A_NORMAL);

Reply via email to