Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.51
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
runtime /
[ HOME SHELL ]
Name
Size
Permission
Action
cgo
[ DIR ]
drwxr-xr-x
debug
[ DIR ]
drwxr-xr-x
internal
[ DIR ]
drwxr-xr-x
msan
[ DIR ]
drwxr-xr-x
pprof
[ DIR ]
drwxr-xr-x
race
[ DIR ]
drwxr-xr-x
testdata
[ DIR ]
drwxr-xr-x
trace
[ DIR ]
drwxr-xr-x
HACKING.md
13.07
KB
-rw-r--r--
Makefile
178
B
-rw-r--r--
alg.go
10.18
KB
-rw-r--r--
asm.s
1.16
KB
-rw-r--r--
asm_386.s
40.2
KB
-rw-r--r--
asm_amd64.s
45.78
KB
-rw-r--r--
asm_arm.s
30.89
KB
-rw-r--r--
asm_arm64.s
33.12
KB
-rw-r--r--
asm_mips64x.s
22.45
KB
-rw-r--r--
asm_mipsx.s
24.72
KB
-rw-r--r--
asm_ppc64x.h
1023
B
-rw-r--r--
asm_ppc64x.s
29.39
KB
-rw-r--r--
asm_riscv64.s
17.38
KB
-rw-r--r--
asm_s390x.s
26.35
KB
-rw-r--r--
asm_wasm.s
9.65
KB
-rw-r--r--
atomic_arm64.s
259
B
-rw-r--r--
atomic_mips64x.s
296
B
-rw-r--r--
atomic_mipsx.s
258
B
-rw-r--r--
atomic_pointer.go
2.62
KB
-rw-r--r--
atomic_ppc64x.s
433
B
-rw-r--r--
atomic_riscv64.s
307
B
-rw-r--r--
auxv_none.go
358
B
-rw-r--r--
callers_test.go
7.7
KB
-rw-r--r--
cgo.go
2.01
KB
-rw-r--r--
cgo_mmap.go
2.38
KB
-rw-r--r--
cgo_ppc64x.go
411
B
-rw-r--r--
cgo_sigaction.go
3.09
KB
-rw-r--r--
cgocall.go
21.38
KB
-rw-r--r--
cgocallback.go
317
B
-rw-r--r--
cgocheck.go
6.8
KB
-rw-r--r--
chan.go
19.71
KB
-rw-r--r--
chan_test.go
21.27
KB
-rw-r--r--
chanbarrier_test.go
1.4
KB
-rw-r--r--
checkptr.go
2.5
KB
-rw-r--r--
checkptr_test.go
1.27
KB
-rw-r--r--
closure_test.go
936
B
-rw-r--r--
compiler.go
413
B
-rw-r--r--
complex.go
1.59
KB
-rw-r--r--
complex_test.go
1.05
KB
-rw-r--r--
cpuflags.go
740
B
-rw-r--r--
cpuflags_amd64.go
533
B
-rw-r--r--
cpuprof.go
6.65
KB
-rw-r--r--
cputicks.go
478
B
-rw-r--r--
crash_cgo_test.go
13.71
KB
-rw-r--r--
crash_nonunix_test.go
385
B
-rw-r--r--
crash_test.go
20.24
KB
-rw-r--r--
crash_unix_test.go
8.89
KB
-rw-r--r--
debug.go
1.63
KB
-rw-r--r--
debug_test.go
6.16
KB
-rw-r--r--
debugcall.go
2.83
KB
-rw-r--r--
debuglog.go
17.08
KB
-rw-r--r--
debuglog_off.go
356
B
-rw-r--r--
debuglog_on.go
1.09
KB
-rw-r--r--
debuglog_test.go
4.56
KB
-rw-r--r--
defer_test.go
9.98
KB
-rw-r--r--
defs1_linux.go
844
B
-rw-r--r--
defs1_netbsd_386.go
2.84
KB
-rw-r--r--
defs1_netbsd_amd64.go
3.07
KB
-rw-r--r--
defs1_netbsd_arm.go
2.96
KB
-rw-r--r--
defs1_netbsd_arm64.go
3.18
KB
-rw-r--r--
defs1_solaris_amd64.go
4.02
KB
-rw-r--r--
defs2_linux.go
3.51
KB
-rw-r--r--
defs3_linux.go
1.09
KB
-rw-r--r--
defs_aix.go
4.16
KB
-rw-r--r--
defs_aix_ppc64.go
3.61
KB
-rw-r--r--
defs_arm_linux.go
2.67
KB
-rw-r--r--
defs_darwin.go
3.84
KB
-rw-r--r--
defs_darwin_386.go
5.98
KB
-rw-r--r--
defs_darwin_amd64.go
6.07
KB
-rw-r--r--
defs_darwin_arm.go
3.78
KB
-rw-r--r--
defs_darwin_arm64.go
3.84
KB
-rw-r--r--
defs_dragonfly.go
2.54
KB
-rw-r--r--
defs_dragonfly_amd64.go
3.25
KB
-rw-r--r--
defs_freebsd.go
3.84
KB
-rw-r--r--
defs_freebsd_386.go
4.35
KB
-rw-r--r--
defs_freebsd_amd64.go
4.62
KB
-rw-r--r--
defs_freebsd_arm.go
3.68
KB
-rw-r--r--
defs_freebsd_arm64.go
4
KB
-rw-r--r--
defs_illumos_amd64.go
285
B
-rw-r--r--
defs_linux.go
3.04
KB
-rw-r--r--
defs_linux_386.go
4.05
KB
-rw-r--r--
defs_linux_amd64.go
4.56
KB
-rw-r--r--
defs_linux_arm.go
3.31
KB
-rw-r--r--
defs_linux_arm64.go
3.23
KB
-rw-r--r--
defs_linux_mips64x.go
3.04
KB
-rw-r--r--
defs_linux_mipsx.go
3.18
KB
-rw-r--r--
defs_linux_ppc64.go
3.28
KB
-rw-r--r--
defs_linux_ppc64le.go
3.28
KB
-rw-r--r--
defs_linux_riscv64.go
3.27
KB
-rw-r--r--
defs_linux_s390x.go
2.76
KB
-rw-r--r--
defs_netbsd.go
2.74
KB
-rw-r--r--
defs_netbsd_386.go
854
B
-rw-r--r--
defs_netbsd_amd64.go
1.01
KB
-rw-r--r--
defs_netbsd_arm.go
763
B
-rw-r--r--
defs_openbsd.go
2.6
KB
-rw-r--r--
defs_openbsd_386.go
2.63
KB
-rw-r--r--
defs_openbsd_amd64.go
2.83
KB
-rw-r--r--
defs_openbsd_arm.go
2.74
KB
-rw-r--r--
defs_openbsd_arm64.go
2.34
KB
-rw-r--r--
defs_plan9_386.go
1.47
KB
-rw-r--r--
defs_plan9_amd64.go
1.66
KB
-rw-r--r--
defs_plan9_arm.go
1.73
KB
-rw-r--r--
defs_solaris.go
3.33
KB
-rw-r--r--
defs_solaris_amd64.go
1003
B
-rw-r--r--
defs_windows.go
2.07
KB
-rw-r--r--
defs_windows_386.go
3.75
KB
-rw-r--r--
defs_windows_amd64.go
4.51
KB
-rw-r--r--
defs_windows_arm.go
3.59
KB
-rw-r--r--
duff_386.s
8.24
KB
-rw-r--r--
duff_amd64.s
5.53
KB
-rw-r--r--
duff_arm.s
7.11
KB
-rw-r--r--
duff_arm64.s
5.25
KB
-rw-r--r--
duff_mips64x.s
11.28
KB
-rw-r--r--
duff_ppc64x.s
2.45
KB
-rw-r--r--
duff_s390x.s
507
B
-rw-r--r--
env_plan9.go
855
B
-rw-r--r--
env_posix.go
1.82
KB
-rw-r--r--
env_test.go
1.28
KB
-rw-r--r--
error.go
7.26
KB
-rw-r--r--
example_test.go
1.34
KB
-rw-r--r--
export_aix_test.go
204
B
-rw-r--r--
export_arm_test.go
226
B
-rw-r--r--
export_darwin_test.go
351
B
-rw-r--r--
export_debug_test.go
5.28
KB
-rw-r--r--
export_debuglog_test.go
1.27
KB
-rw-r--r--
export_futex_test.go
529
B
-rw-r--r--
export_linux_test.go
429
B
-rw-r--r--
export_mmap_test.go
481
B
-rw-r--r--
export_solaris_test.go
282
B
-rw-r--r--
export_test.go
23.58
KB
-rw-r--r--
export_unix_test.go
2.28
KB
-rw-r--r--
export_windows_test.go
652
B
-rw-r--r--
extern.go
11.6
KB
-rw-r--r--
fastlog2.go
1.22
KB
-rw-r--r--
fastlog2_test.go
784
B
-rw-r--r--
fastlog2table.go
904
B
-rw-r--r--
float.go
1.35
KB
-rw-r--r--
funcdata.h
2.44
KB
-rw-r--r--
futex_test.go
2.1
KB
-rw-r--r--
gc_test.go
13.22
KB
-rw-r--r--
gcinfo_test.go
6.18
KB
-rw-r--r--
go_tls.h
366
B
-rw-r--r--
hash32.go
2.51
KB
-rw-r--r--
hash64.go
2.6
KB
-rw-r--r--
hash_test.go
17.54
KB
-rw-r--r--
heapdump.go
17.1
KB
-rw-r--r--
iface.go
15.78
KB
-rw-r--r--
iface_test.go
6.81
KB
-rw-r--r--
lfstack.go
1.77
KB
-rw-r--r--
lfstack_32bit.go
522
B
-rw-r--r--
lfstack_64bit.go
2.15
KB
-rw-r--r--
lfstack_test.go
2.78
KB
-rw-r--r--
libfuzzer.go
2.58
KB
-rw-r--r--
libfuzzer_amd64.s
940
B
-rw-r--r--
libfuzzer_arm64.s
751
B
-rw-r--r--
lock_futex.go
5.06
KB
-rw-r--r--
lock_js.go
5.45
KB
-rw-r--r--
lock_sema.go
6.6
KB
-rw-r--r--
malloc.go
48.32
KB
-rw-r--r--
malloc_test.go
9.37
KB
-rw-r--r--
map.go
42.13
KB
-rw-r--r--
map_benchmark_test.go
10.16
KB
-rw-r--r--
map_fast32.go
12.18
KB
-rw-r--r--
map_fast64.go
12.37
KB
-rw-r--r--
map_faststr.go
13.82
KB
-rw-r--r--
map_test.go
27.11
KB
-rw-r--r--
mbarrier.go
12.14
KB
-rw-r--r--
mbitmap.go
67.53
KB
-rw-r--r--
mcache.go
5.61
KB
-rw-r--r--
mcentral.go
7.14
KB
-rw-r--r--
mem_aix.go
1.93
KB
-rw-r--r--
mem_bsd.go
2.05
KB
-rw-r--r--
mem_darwin.go
1.88
KB
-rw-r--r--
mem_js.go
2.32
KB
-rw-r--r--
mem_linux.go
5.58
KB
-rw-r--r--
mem_plan9.go
4.53
KB
-rw-r--r--
mem_windows.go
3.86
KB
-rw-r--r--
memclr_386.s
2.4
KB
-rw-r--r--
memclr_amd64.s
3.65
KB
-rw-r--r--
memclr_arm.s
2.44
KB
-rw-r--r--
memclr_arm64.s
3.48
KB
-rw-r--r--
memclr_mips64x.s
785
B
-rw-r--r--
memclr_mipsx.s
1.24
KB
-rw-r--r--
memclr_plan9_386.s
905
B
-rw-r--r--
memclr_plan9_amd64.s
433
B
-rw-r--r--
memclr_ppc64x.s
4.2
KB
-rw-r--r--
memclr_riscv64.s
848
B
-rwxr-xr-x
memclr_s390x.s
1.89
KB
-rw-r--r--
memclr_wasm.s
544
B
-rw-r--r--
memmove_386.s
4.45
KB
-rw-r--r--
memmove_amd64.s
12.33
KB
-rw-r--r--
memmove_arm.s
5.9
KB
-rw-r--r--
memmove_arm64.s
3.56
KB
-rw-r--r--
memmove_linux_amd64_test.go
1.61
KB
-rw-r--r--
memmove_mips64x.s
1.82
KB
-rw-r--r--
memmove_mipsx.s
4.39
KB
-rw-r--r--
memmove_plan9_386.s
3.06
KB
-rw-r--r--
memmove_plan9_amd64.s
3.04
KB
-rw-r--r--
memmove_ppc64x.s
3.33
KB
-rw-r--r--
memmove_riscv64.s
1.81
KB
-rwxr-xr-x
memmove_s390x.s
2.92
KB
-rw-r--r--
memmove_test.go
10.97
KB
-rw-r--r--
memmove_wasm.s
1.74
KB
-rw-r--r--
mfinal.go
14.8
KB
-rw-r--r--
mfinal_test.go
5.85
KB
-rw-r--r--
mfixalloc.go
2.72
KB
-rw-r--r--
mgc.go
74.87
KB
-rw-r--r--
mgcmark.go
46.5
KB
-rw-r--r--
mgcscavenge.go
30.95
KB
-rw-r--r--
mgcscavenge_test.go
12.34
KB
-rw-r--r--
mgcstack.go
10.55
KB
-rw-r--r--
mgcsweep.go
14.79
KB
-rw-r--r--
mgcsweepbuf.go
5.98
KB
-rw-r--r--
mgcwork.go
14.24
KB
-rw-r--r--
mheap.go
61.5
KB
-rw-r--r--
mkduff.go
6.23
KB
-rw-r--r--
mkfastlog2table.go
1.32
KB
-rw-r--r--
mkpreempt.go
13.33
KB
-rw-r--r--
mksizeclasses.go
8.62
KB
-rw-r--r--
mmap.go
847
B
-rw-r--r--
mpagealloc.go
35.25
KB
-rw-r--r--
mpagealloc_32bit.go
3.75
KB
-rw-r--r--
mpagealloc_64bit.go
6.51
KB
-rw-r--r--
mpagealloc_test.go
28.88
KB
-rw-r--r--
mpagecache.go
5.03
KB
-rw-r--r--
mpagecache_test.go
9.93
KB
-rw-r--r--
mpallocbits.go
10.69
KB
-rw-r--r--
mpallocbits_test.go
12.93
KB
-rw-r--r--
mprof.go
24.06
KB
-rw-r--r--
mranges.go
5.41
KB
-rw-r--r--
msan.go
1.39
KB
-rw-r--r--
msan0.go
647
B
-rw-r--r--
msan_amd64.s
2.03
KB
-rw-r--r--
msan_arm64.s
1.69
KB
-rw-r--r--
msize.go
785
B
-rw-r--r--
mstats.go
22.62
KB
-rw-r--r--
mwbbuf.go
10.07
KB
-rw-r--r--
nbpipe_fcntl_libc_test.go
463
B
-rw-r--r--
nbpipe_fcntl_unix_test.go
445
B
-rw-r--r--
nbpipe_pipe.go
411
B
-rw-r--r--
nbpipe_pipe2.go
509
B
-rw-r--r--
nbpipe_test.go
2.17
KB
-rw-r--r--
net_plan9.go
645
B
-rw-r--r--
netpoll.go
14.46
KB
-rw-r--r--
netpoll_aix.go
4.64
KB
-rw-r--r--
netpoll_epoll.go
4
KB
-rw-r--r--
netpoll_fake.go
648
B
-rw-r--r--
netpoll_kqueue.go
4.39
KB
-rw-r--r--
netpoll_solaris.go
10.56
KB
-rw-r--r--
netpoll_stub.go
1.3
KB
-rw-r--r--
netpoll_windows.go
4.51
KB
-rw-r--r--
norace_linux_test.go
888
B
-rw-r--r--
norace_test.go
979
B
-rw-r--r--
numcpu_freebsd_test.go
381
B
-rw-r--r--
os2_aix.go
20.67
KB
-rw-r--r--
os2_freebsd.go
302
B
-rw-r--r--
os2_openbsd.go
296
B
-rw-r--r--
os2_plan9.go
1.48
KB
-rw-r--r--
os2_solaris.go
320
B
-rw-r--r--
os3_plan9.go
3.99
KB
-rw-r--r--
os3_solaris.go
16.92
KB
-rw-r--r--
os_aix.go
8.29
KB
-rw-r--r--
os_android.go
463
B
-rw-r--r--
os_darwin.go
10.59
KB
-rw-r--r--
os_darwin_arm.go
749
B
-rw-r--r--
os_darwin_arm64.go
416
B
-rw-r--r--
os_dragonfly.go
6.2
KB
-rw-r--r--
os_freebsd.go
10.97
KB
-rw-r--r--
os_freebsd2.go
478
B
-rw-r--r--
os_freebsd_amd64.go
529
B
-rw-r--r--
os_freebsd_arm.go
1.32
KB
-rw-r--r--
os_freebsd_arm64.go
2.97
KB
-rw-r--r--
os_freebsd_noauxv.go
254
B
-rw-r--r--
os_illumos.go
3.93
KB
-rw-r--r--
os_js.go
2.93
KB
-rw-r--r--
os_linux.go
13.16
KB
-rw-r--r--
os_linux_arm.go
1.35
KB
-rw-r--r--
os_linux_arm64.go
1.02
KB
-rw-r--r--
os_linux_be64.go
816
B
-rw-r--r--
os_linux_generic.go
916
B
-rw-r--r--
os_linux_mips64x.go
999
B
-rw-r--r--
os_linux_mipsx.go
1.05
KB
-rw-r--r--
os_linux_noauxv.go
307
B
-rw-r--r--
os_linux_novdso.go
298
B
-rw-r--r--
os_linux_ppc64x.go
527
B
-rw-r--r--
os_linux_riscv64.go
198
B
-rw-r--r--
os_linux_s390x.go
455
B
-rw-r--r--
os_linux_x86.go
2.69
KB
-rw-r--r--
os_netbsd.go
8.49
KB
-rw-r--r--
os_netbsd_386.go
588
B
-rw-r--r--
os_netbsd_amd64.go
585
B
-rw-r--r--
os_netbsd_arm.go
1.13
KB
-rw-r--r--
os_netbsd_arm64.go
827
B
-rw-r--r--
os_nonopenbsd.go
436
B
-rw-r--r--
os_only_solaris.go
356
B
-rw-r--r--
os_openbsd.go
7.81
KB
-rw-r--r--
os_openbsd_arm.go
749
B
-rw-r--r--
os_openbsd_arm64.go
714
B
-rw-r--r--
os_plan9.go
9.3
KB
-rw-r--r--
os_plan9_arm.go
462
B
-rw-r--r--
os_solaris.go
6.49
KB
-rw-r--r--
os_windows.go
37.01
KB
-rw-r--r--
os_windows_arm.go
511
B
-rw-r--r--
panic.go
42.23
KB
-rw-r--r--
panic32.go
4.79
KB
-rw-r--r--
plugin.go
4.16
KB
-rw-r--r--
preempt.go
14.72
KB
-rw-r--r--
preempt_386.s
983
B
-rw-r--r--
preempt_amd64.s
1.62
KB
-rw-r--r--
preempt_arm.s
1.48
KB
-rw-r--r--
preempt_arm64.s
2.8
KB
-rw-r--r--
preempt_mips64x.s
2.71
KB
-rw-r--r--
preempt_mipsx.s
2.68
KB
-rw-r--r--
preempt_nonwindows.go
289
B
-rw-r--r--
preempt_ppc64x.s
2.71
KB
-rw-r--r--
preempt_riscv64.s
197
B
-rw-r--r--
preempt_s390x.s
1.01
KB
-rw-r--r--
preempt_wasm.s
176
B
-rw-r--r--
print.go
5.98
KB
-rw-r--r--
proc.go
149.75
KB
-rw-r--r--
proc_runtime_test.go
820
B
-rw-r--r--
proc_test.go
22.89
KB
-rw-r--r--
profbuf.go
18.26
KB
-rw-r--r--
profbuf_test.go
8.65
KB
-rw-r--r--
proflabel.go
1.52
KB
-rw-r--r--
race.go
18.11
KB
-rw-r--r--
race0.go
2.61
KB
-rw-r--r--
race_amd64.s
13.59
KB
-rw-r--r--
race_arm64.s
13.53
KB
-rw-r--r--
race_ppc64le.s
17.93
KB
-rw-r--r--
rand_test.go
783
B
-rw-r--r--
rdebug.go
553
B
-rw-r--r--
relax_stub.go
597
B
-rw-r--r--
rt0_aix_ppc64.s
4.33
KB
-rw-r--r--
rt0_android_386.s
822
B
-rw-r--r--
rt0_android_amd64.s
754
B
-rw-r--r--
rt0_android_arm.s
843
B
-rw-r--r--
rt0_android_arm64.s
941
B
-rw-r--r--
rt0_darwin_386.s
452
B
-rw-r--r--
rt0_darwin_amd64.s
399
B
-rw-r--r--
rt0_darwin_arm.s
290
B
-rw-r--r--
rt0_darwin_arm64.s
2.32
KB
-rw-r--r--
rt0_dragonfly_amd64.s
448
B
-rw-r--r--
rt0_freebsd_386.s
454
B
-rw-r--r--
rt0_freebsd_amd64.s
442
B
-rw-r--r--
rt0_freebsd_arm.s
298
B
-rw-r--r--
rt0_freebsd_arm64.s
2.46
KB
-rw-r--r--
rt0_illumos_amd64.s
311
B
-rw-r--r--
rt0_js_wasm.s
2.3
KB
-rw-r--r--
rt0_linux_386.s
450
B
-rw-r--r--
rt0_linux_amd64.s
307
B
-rw-r--r--
rt0_linux_arm.s
1007
B
-rw-r--r--
rt0_linux_arm64.s
2.39
KB
-rw-r--r--
rt0_linux_mips64x.s
1015
B
-rw-r--r--
rt0_linux_mipsx.s
798
B
-rw-r--r--
rt0_linux_ppc64.s
705
B
-rw-r--r--
rt0_linux_ppc64le.s
3.72
KB
-rw-r--r--
rt0_linux_riscv64.s
370
B
-rw-r--r--
rt0_linux_s390x.s
676
B
-rw-r--r--
rt0_netbsd_386.s
452
B
-rw-r--r--
rt0_netbsd_amd64.s
309
B
-rw-r--r--
rt0_netbsd_arm.s
296
B
-rw-r--r--
rt0_netbsd_arm64.s
2.39
KB
-rw-r--r--
rt0_openbsd_386.s
454
B
-rw-r--r--
rt0_openbsd_amd64.s
311
B
-rw-r--r--
rt0_openbsd_arm.s
298
B
-rw-r--r--
rt0_openbsd_arm64.s
2.42
KB
-rw-r--r--
rt0_plan9_386.s
523
B
-rw-r--r--
rt0_plan9_amd64.s
481
B
-rw-r--r--
rt0_plan9_arm.s
397
B
-rw-r--r--
rt0_solaris_amd64.s
311
B
-rw-r--r--
rt0_windows_386.s
1.28
KB
-rw-r--r--
rt0_windows_amd64.s
1.15
KB
-rw-r--r--
rt0_windows_arm.s
386
B
-rw-r--r--
runtime-gdb.py
14.83
KB
-rw-r--r--
runtime-gdb_test.go
16.85
KB
-rw-r--r--
runtime-lldb_test.go
5.09
KB
-rw-r--r--
runtime.go
1.42
KB
-rw-r--r--
runtime1.go
11.97
KB
-rw-r--r--
runtime2.go
37.85
KB
-rw-r--r--
runtime_linux_test.go
1.46
KB
-rw-r--r--
runtime_mmap_test.go
1.82
KB
-rw-r--r--
runtime_test.go
7.81
KB
-rw-r--r--
runtime_unix_test.go
1.2
KB
-rw-r--r--
rwmutex.go
3.4
KB
-rw-r--r--
rwmutex_test.go
4.03
KB
-rw-r--r--
select.go
13.24
KB
-rw-r--r--
sema.go
15.95
KB
-rw-r--r--
sema_test.go
2.41
KB
-rw-r--r--
semasleep_test.go
1.62
KB
-rw-r--r--
sigaction.go
460
B
-rw-r--r--
signal_386.go
2.14
KB
-rw-r--r--
signal_aix_ppc64.go
3.55
KB
-rw-r--r--
signal_amd64.go
2.56
KB
-rw-r--r--
signal_arm.go
2.63
KB
-rw-r--r--
signal_arm64.go
3.12
KB
-rw-r--r--
signal_darwin.go
2.13
KB
-rw-r--r--
signal_darwin_386.go
2.33
KB
-rw-r--r--
signal_darwin_amd64.go
3.85
KB
-rw-r--r--
signal_darwin_arm.go
2.71
KB
-rw-r--r--
signal_darwin_arm64.go
3.6
KB
-rw-r--r--
signal_dragonfly.go
2.17
KB
-rw-r--r--
signal_dragonfly_amd64.go
2.01
KB
-rw-r--r--
signal_freebsd.go
2.2
KB
-rw-r--r--
signal_freebsd_386.go
1.55
KB
-rw-r--r--
signal_freebsd_amd64.go
2.03
KB
-rw-r--r--
signal_freebsd_arm.go
2.18
KB
-rw-r--r--
signal_freebsd_arm64.go
3.23
KB
-rw-r--r--
signal_linux_386.go
1.59
KB
-rw-r--r--
signal_linux_amd64.go
2.05
KB
-rw-r--r--
signal_linux_arm.go
2.13
KB
-rw-r--r--
signal_linux_arm64.go
2.95
KB
-rw-r--r--
signal_linux_mips64x.go
3.35
KB
-rw-r--r--
signal_linux_mipsx.go
3.67
KB
-rw-r--r--
signal_linux_ppc64x.go
3.42
KB
-rw-r--r--
signal_linux_riscv64.go
2.92
KB
-rw-r--r--
signal_linux_s390x.go
4.45
KB
-rw-r--r--
signal_mips64x.go
3.16
KB
-rw-r--r--
signal_mipsx.go
3.05
KB
-rw-r--r--
signal_netbsd.go
2.18
KB
-rw-r--r--
signal_netbsd_386.go
1.76
KB
-rw-r--r--
signal_netbsd_amd64.go
2.33
KB
-rw-r--r--
signal_netbsd_arm.go
2.3
KB
-rw-r--r--
signal_netbsd_arm64.go
3.4
KB
-rw-r--r--
signal_openbsd.go
2.15
KB
-rw-r--r--
signal_openbsd_386.go
1.58
KB
-rw-r--r--
signal_openbsd_amd64.go
2.04
KB
-rw-r--r--
signal_openbsd_arm.go
2.12
KB
-rw-r--r--
signal_openbsd_arm64.go
3.38
KB
-rw-r--r--
signal_plan9.go
1.93
KB
-rw-r--r--
signal_ppc64x.go
3.61
KB
-rw-r--r--
signal_riscv64.go
2.45
KB
-rw-r--r--
signal_solaris.go
4.5
KB
-rw-r--r--
signal_solaris_amd64.go
2.47
KB
-rw-r--r--
signal_unix.go
35.95
KB
-rw-r--r--
signal_windows.go
8.54
KB
-rw-r--r--
signal_windows_test.go
1.6
KB
-rw-r--r--
sigqueue.go
7.69
KB
-rw-r--r--
sigqueue_note.go
654
B
-rw-r--r--
sigqueue_plan9.go
3.31
KB
-rw-r--r--
sigtab_aix.go
11.3
KB
-rw-r--r--
sigtab_linux_generic.go
3.49
KB
-rw-r--r--
sigtab_linux_mipsx.go
5.89
KB
-rw-r--r--
sizeclasses.go
7.9
KB
-rw-r--r--
sizeof_test.go
839
B
-rw-r--r--
slice.go
6.88
KB
-rw-r--r--
slice_test.go
8.78
KB
-rw-r--r--
softfloat64.go
10.7
KB
-rw-r--r--
softfloat64_test.go
4.05
KB
-rw-r--r--
stack.go
39.14
KB
-rw-r--r--
stack_test.go
19.9
KB
-rw-r--r--
string.go
11.52
KB
-rw-r--r--
string_test.go
10.35
KB
-rw-r--r--
stubs.go
13.08
KB
-rw-r--r--
stubs2.go
1.04
KB
-rw-r--r--
stubs3.go
289
B
-rw-r--r--
stubs32.go
393
B
-rw-r--r--
stubs_386.go
490
B
-rw-r--r--
stubs_amd64.go
348
B
-rw-r--r--
stubs_arm.go
454
B
-rw-r--r--
stubs_arm64.go
256
B
-rw-r--r--
stubs_linux.go
646
B
-rw-r--r--
stubs_mips64x.go
283
B
-rw-r--r--
stubs_mipsx.go
279
B
-rw-r--r--
stubs_nonlinux.go
297
B
-rw-r--r--
stubs_ppc64x.go
296
B
-rw-r--r--
stubs_s390x.go
256
B
-rw-r--r--
symtab.go
28.32
KB
-rw-r--r--
symtab_test.go
4.1
KB
-rw-r--r--
sys_aix_ppc64.s
7.17
KB
-rw-r--r--
sys_arm.go
521
B
-rw-r--r--
sys_arm64.go
469
B
-rw-r--r--
sys_darwin.go
15.96
KB
-rw-r--r--
sys_darwin_32.go
533
B
-rw-r--r--
sys_darwin_386.s
18.55
KB
-rw-r--r--
sys_darwin_64.go
513
B
-rw-r--r--
sys_darwin_amd64.s
18.07
KB
-rw-r--r--
sys_darwin_arm.s
13.7
KB
-rw-r--r--
sys_darwin_arm64.s
15.84
KB
-rw-r--r--
sys_dragonfly_amd64.s
8.32
KB
-rw-r--r--
sys_freebsd_386.s
8.92
KB
-rw-r--r--
sys_freebsd_amd64.s
10.72
KB
-rw-r--r--
sys_freebsd_arm.s
10.64
KB
-rw-r--r--
sys_freebsd_arm64.s
10.75
KB
-rw-r--r--
sys_linux_386.s
17.57
KB
-rw-r--r--
sys_linux_amd64.s
17.07
KB
-rw-r--r--
sys_linux_arm.s
14.9
KB
-rw-r--r--
sys_linux_arm64.s
14.32
KB
-rw-r--r--
sys_linux_mips64x.s
12
KB
-rw-r--r--
sys_linux_mipsx.s
11.13
KB
-rw-r--r--
sys_linux_ppc64x.s
14.71
KB
-rw-r--r--
sys_linux_riscv64.s
10.38
KB
-rw-r--r--
sys_linux_s390x.s
10.52
KB
-rw-r--r--
sys_mips64x.go
496
B
-rw-r--r--
sys_mipsx.go
492
B
-rw-r--r--
sys_netbsd_386.s
10.04
KB
-rw-r--r--
sys_netbsd_amd64.s
10.03
KB
-rw-r--r--
sys_netbsd_arm.s
10.85
KB
-rw-r--r--
sys_netbsd_arm64.s
10.13
KB
-rw-r--r--
sys_nonppc64x.go
241
B
-rw-r--r--
sys_openbsd_386.s
9.1
KB
-rw-r--r--
sys_openbsd_amd64.s
8.83
KB
-rw-r--r--
sys_openbsd_arm.s
9.63
KB
-rw-r--r--
sys_openbsd_arm64.s
9.55
KB
-rw-r--r--
sys_plan9_386.s
4.41
KB
-rw-r--r--
sys_plan9_amd64.s
4.47
KB
-rw-r--r--
sys_plan9_arm.s
7.03
KB
-rw-r--r--
sys_ppc64x.go
528
B
-rw-r--r--
sys_riscv64.go
469
B
-rw-r--r--
sys_s390x.go
469
B
-rw-r--r--
sys_solaris_amd64.s
6.69
KB
-rw-r--r--
sys_wasm.go
806
B
-rw-r--r--
sys_wasm.s
2.48
KB
-rw-r--r--
sys_windows_386.s
11.55
KB
-rw-r--r--
sys_windows_amd64.s
12.14
KB
-rw-r--r--
sys_windows_arm.s
18.38
KB
-rw-r--r--
sys_x86.go
624
B
-rw-r--r--
syscall2_solaris.go
1.73
KB
-rw-r--r--
syscall_aix.go
5.99
KB
-rw-r--r--
syscall_solaris.go
8.26
KB
-rw-r--r--
syscall_windows.go
6.83
KB
-rw-r--r--
syscall_windows_test.go
27.09
KB
-rw-r--r--
textflag.h
1.46
KB
-rw-r--r--
time.go
29.12
KB
-rw-r--r--
time_fake.go
2.67
KB
-rw-r--r--
time_nofake.go
631
B
-rw-r--r--
time_test.go
1.9
KB
-rw-r--r--
timeasm.go
382
B
-rw-r--r--
timestub.go
497
B
-rw-r--r--
timestub2.go
309
B
-rw-r--r--
tls_arm.s
3.37
KB
-rw-r--r--
tls_arm64.h
985
B
-rw-r--r--
tls_arm64.s
1.07
KB
-rw-r--r--
tls_mips64x.s
729
B
-rw-r--r--
tls_mipsx.s
705
B
-rw-r--r--
tls_ppc64x.s
1.51
KB
-rw-r--r--
tls_riscv64.s
454
B
-rw-r--r--
tls_s390x.s
1.55
KB
-rw-r--r--
trace.go
37.73
KB
-rw-r--r--
traceback.go
44.11
KB
-rw-r--r--
type.go
18.27
KB
-rw-r--r--
typekind.go
742
B
-rw-r--r--
utf8.go
3.39
KB
-rw-r--r--
vdso_elf32.go
2.76
KB
-rw-r--r--
vdso_elf64.go
2.79
KB
-rw-r--r--
vdso_freebsd.go
2.44
KB
-rw-r--r--
vdso_freebsd_arm.go
454
B
-rw-r--r--
vdso_freebsd_arm64.go
443
B
-rw-r--r--
vdso_freebsd_x86.go
1.85
KB
-rw-r--r--
vdso_in_none.go
379
B
-rw-r--r--
vdso_linux.go
7.68
KB
-rw-r--r--
vdso_linux_386.go
669
B
-rw-r--r--
vdso_linux_amd64.go
748
B
-rw-r--r--
vdso_linux_arm.go
669
B
-rw-r--r--
vdso_linux_arm64.go
670
B
-rw-r--r--
vdso_linux_mips64x.go
851
B
-rw-r--r--
vdso_linux_ppc64x.go
673
B
-rw-r--r--
vlop_386.s
2.02
KB
-rw-r--r--
vlop_arm.s
7.06
KB
-rw-r--r--
vlop_arm_test.go
3.75
KB
-rw-r--r--
vlrt.go
6.09
KB
-rw-r--r--
wincallback.go
2.53
KB
-rw-r--r--
write_err.go
290
B
-rw-r--r--
write_err_android.go
4.65
KB
-rw-r--r--
zcallback_windows.go
155
B
-rw-r--r--
zcallback_windows.s
63.02
KB
-rw-r--r--
zcallback_windows_arm.s
89.32
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : traceback.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package runtime import ( "runtime/internal/atomic" "runtime/internal/sys" "unsafe" ) // The code in this file implements stack trace walking for all architectures. // The most important fact about a given architecture is whether it uses a link register. // On systems with link registers, the prologue for a non-leaf function stores the // incoming value of LR at the bottom of the newly allocated stack frame. // On systems without link registers, the architecture pushes a return PC during // the call instruction, so the return PC ends up above the stack frame. // In this file, the return PC is always called LR, no matter how it was found. // // To date, the opposite of a link register architecture is an x86 architecture. // This code may need to change if some other kind of non-link-register // architecture comes along. // // The other important fact is the size of a pointer: on 32-bit systems the LR // takes up only 4 bytes on the stack, while on 64-bit systems it takes up 8 bytes. // Typically this is ptrSize. // // As an exception, amd64p32 had ptrSize == 4 but the CALL instruction still // stored an 8-byte return PC onto the stack. To accommodate this, we used regSize // as the size of the architecture-pushed return PC. // // usesLR is defined below in terms of minFrameSize, which is defined in // arch_$GOARCH.go. ptrSize and regSize are defined in stubs.go. const usesLR = sys.MinFrameSize > 0 var skipPC uintptr func tracebackinit() { // Go variable initialization happens late during runtime startup. // Instead of initializing the variables above in the declarations, // schedinit calls this function so that the variables are // initialized and available earlier in the startup sequence. skipPC = funcPC(skipPleaseUseCallersFrames) } // Traceback over the deferred function calls. // Report them like calls that have been invoked but not started executing yet. func tracebackdefers(gp *g, callback func(*stkframe, unsafe.Pointer) bool, v unsafe.Pointer) { var frame stkframe for d := gp._defer; d != nil; d = d.link { fn := d.fn if fn == nil { // Defer of nil function. Args don't matter. frame.pc = 0 frame.fn = funcInfo{} frame.argp = 0 frame.arglen = 0 frame.argmap = nil } else { frame.pc = fn.fn f := findfunc(frame.pc) if !f.valid() { print("runtime: unknown pc in defer ", hex(frame.pc), "\n") throw("unknown pc") } frame.fn = f frame.argp = uintptr(deferArgs(d)) var ok bool frame.arglen, frame.argmap, ok = getArgInfoFast(f, true) if !ok { frame.arglen, frame.argmap = getArgInfo(&frame, f, true, fn) } } frame.continpc = frame.pc if !callback((*stkframe)(noescape(unsafe.Pointer(&frame))), v) { return } } } const sizeofSkipFunction = 256 // This function is defined in asm.s to be sizeofSkipFunction bytes long. func skipPleaseUseCallersFrames() // Generic traceback. Handles runtime stack prints (pcbuf == nil), // the runtime.Callers function (pcbuf != nil), as well as the garbage // collector (callback != nil). A little clunky to merge these, but avoids // duplicating the code and all its subtlety. // // The skip argument is only valid with pcbuf != nil and counts the number // of logical frames to skip rather than physical frames (with inlining, a // PC in pcbuf can represent multiple calls). If a PC is partially skipped // and max > 1, pcbuf[1] will be runtime.skipPleaseUseCallersFrames+N where // N indicates the number of logical frames to skip in pcbuf[0]. func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max int, callback func(*stkframe, unsafe.Pointer) bool, v unsafe.Pointer, flags uint) int { if skip > 0 && callback != nil { throw("gentraceback callback cannot be used with non-zero skip") } // Don't call this "g"; it's too easy get "g" and "gp" confused. if ourg := getg(); ourg == gp && ourg == ourg.m.curg { // The starting sp has been passed in as a uintptr, and the caller may // have other uintptr-typed stack references as well. // If during one of the calls that got us here or during one of the // callbacks below the stack must be grown, all these uintptr references // to the stack will not be updated, and gentraceback will continue // to inspect the old stack memory, which may no longer be valid. // Even if all the variables were updated correctly, it is not clear that // we want to expose a traceback that begins on one stack and ends // on another stack. That could confuse callers quite a bit. // Instead, we require that gentraceback and any other function that // accepts an sp for the current goroutine (typically obtained by // calling getcallersp) must not run on that goroutine's stack but // instead on the g0 stack. throw("gentraceback cannot trace user goroutine on its own stack") } level, _, _ := gotraceback() var ctxt *funcval // Context pointer for unstarted goroutines. See issue #25897. if pc0 == ^uintptr(0) && sp0 == ^uintptr(0) { // Signal to fetch saved values from gp. if gp.syscallsp != 0 { pc0 = gp.syscallpc sp0 = gp.syscallsp if usesLR { lr0 = 0 } } else { pc0 = gp.sched.pc sp0 = gp.sched.sp if usesLR { lr0 = gp.sched.lr } ctxt = (*funcval)(gp.sched.ctxt) } } nprint := 0 var frame stkframe frame.pc = pc0 frame.sp = sp0 if usesLR { frame.lr = lr0 } waspanic := false cgoCtxt := gp.cgoCtxt printing := pcbuf == nil && callback == nil // If the PC is zero, it's likely a nil function call. // Start in the caller's frame. if frame.pc == 0 { if usesLR { frame.pc = *(*uintptr)(unsafe.Pointer(frame.sp)) frame.lr = 0 } else { frame.pc = uintptr(*(*sys.Uintreg)(unsafe.Pointer(frame.sp))) frame.sp += sys.RegSize } } f := findfunc(frame.pc) if !f.valid() { if callback != nil || printing { print("runtime: unknown pc ", hex(frame.pc), "\n") tracebackHexdump(gp.stack, &frame, 0) } if callback != nil { throw("unknown pc") } return 0 } frame.fn = f var cache pcvalueCache lastFuncID := funcID_normal n := 0 for n < max { // Typically: // pc is the PC of the running function. // sp is the stack pointer at that program counter. // fp is the frame pointer (caller's stack pointer) at that program counter, or nil if unknown. // stk is the stack containing sp. // The caller's program counter is lr, unless lr is zero, in which case it is *(uintptr*)sp. f = frame.fn if f.pcsp == 0 { // No frame information, must be external function, like race support. // See golang.org/issue/13568. break } // Found an actual function. // Derive frame pointer and link register. if frame.fp == 0 { // Jump over system stack transitions. If we're on g0 and there's a user // goroutine, try to jump. Otherwise this is a regular call. if flags&_TraceJumpStack != 0 && gp == gp.m.g0 && gp.m.curg != nil { switch f.funcID { case funcID_morestack: // morestack does not return normally -- newstack() // gogo's to curg.sched. Match that. // This keeps morestack() from showing up in the backtrace, // but that makes some sense since it'll never be returned // to. frame.pc = gp.m.curg.sched.pc frame.fn = findfunc(frame.pc) f = frame.fn frame.sp = gp.m.curg.sched.sp cgoCtxt = gp.m.curg.cgoCtxt case funcID_systemstack: // systemstack returns normally, so just follow the // stack transition. frame.sp = gp.m.curg.sched.sp cgoCtxt = gp.m.curg.cgoCtxt } } frame.fp = frame.sp + uintptr(funcspdelta(f, frame.pc, &cache)) if !usesLR { // On x86, call instruction pushes return PC before entering new function. frame.fp += sys.RegSize } } var flr funcInfo if topofstack(f, gp.m != nil && gp == gp.m.g0) { frame.lr = 0 flr = funcInfo{} } else if usesLR && f.funcID == funcID_jmpdefer { // jmpdefer modifies SP/LR/PC non-atomically. // If a profiling interrupt arrives during jmpdefer, // the stack unwind may see a mismatched register set // and get confused. Stop if we see PC within jmpdefer // to avoid that confusion. // See golang.org/issue/8153. if callback != nil { throw("traceback_arm: found jmpdefer when tracing with callback") } frame.lr = 0 } else { var lrPtr uintptr if usesLR { if n == 0 && frame.sp < frame.fp || frame.lr == 0 { lrPtr = frame.sp frame.lr = *(*uintptr)(unsafe.Pointer(lrPtr)) } } else { if frame.lr == 0 { lrPtr = frame.fp - sys.RegSize frame.lr = uintptr(*(*sys.Uintreg)(unsafe.Pointer(lrPtr))) } } flr = findfunc(frame.lr) if !flr.valid() { // This happens if you get a profiling interrupt at just the wrong time. // In that context it is okay to stop early. // But if callback is set, we're doing a garbage collection and must // get everything, so crash loudly. doPrint := printing if doPrint && gp.m.incgo && f.funcID == funcID_sigpanic { // We can inject sigpanic // calls directly into C code, // in which case we'll see a C // return PC. Don't complain. doPrint = false } if callback != nil || doPrint { print("runtime: unexpected return pc for ", funcname(f), " called from ", hex(frame.lr), "\n") tracebackHexdump(gp.stack, &frame, lrPtr) } if callback != nil { throw("unknown caller pc") } } } frame.varp = frame.fp if !usesLR { // On x86, call instruction pushes return PC before entering new function. frame.varp -= sys.RegSize } // If framepointer_enabled and there's a frame, then // there's a saved bp here. if frame.varp > frame.sp && (framepointer_enabled && GOARCH == "amd64" || GOARCH == "arm64") { frame.varp -= sys.RegSize } // Derive size of arguments. // Most functions have a fixed-size argument block, // so we can use metadata about the function f. // Not all, though: there are some variadic functions // in package runtime and reflect, and for those we use call-specific // metadata recorded by f's caller. if callback != nil || printing { frame.argp = frame.fp + sys.MinFrameSize var ok bool frame.arglen, frame.argmap, ok = getArgInfoFast(f, callback != nil) if !ok { frame.arglen, frame.argmap = getArgInfo(&frame, f, callback != nil, ctxt) } } ctxt = nil // ctxt is only needed to get arg maps for the topmost frame // Determine frame's 'continuation PC', where it can continue. // Normally this is the return address on the stack, but if sigpanic // is immediately below this function on the stack, then the frame // stopped executing due to a trap, and frame.pc is probably not // a safe point for looking up liveness information. In this panicking case, // the function either doesn't return at all (if it has no defers or if the // defers do not recover) or it returns from one of the calls to // deferproc a second time (if the corresponding deferred func recovers). // In the latter case, use a deferreturn call site as the continuation pc. frame.continpc = frame.pc if waspanic { if frame.fn.deferreturn != 0 { frame.continpc = frame.fn.entry + uintptr(frame.fn.deferreturn) + 1 // Note: this may perhaps keep return variables alive longer than // strictly necessary, as we are using "function has a defer statement" // as a proxy for "function actually deferred something". It seems // to be a minor drawback. (We used to actually look through the // gp._defer for a defer corresponding to this function, but that // is hard to do with defer records on the stack during a stack copy.) // Note: the +1 is to offset the -1 that // stack.go:getStackMap does to back up a return // address make sure the pc is in the CALL instruction. } else { frame.continpc = 0 } } if callback != nil { if !callback((*stkframe)(noescape(unsafe.Pointer(&frame))), v) { return n } } if pcbuf != nil { pc := frame.pc // backup to CALL instruction to read inlining info (same logic as below) tracepc := pc // Normally, pc is a return address. In that case, we want to look up // file/line information using pc-1, because that is the pc of the // call instruction (more precisely, the last byte of the call instruction). // Callers expect the pc buffer to contain return addresses and do the // same -1 themselves, so we keep pc unchanged. // When the pc is from a signal (e.g. profiler or segv) then we want // to look up file/line information using pc, and we store pc+1 in the // pc buffer so callers can unconditionally subtract 1 before looking up. // See issue 34123. // The pc can be at function entry when the frame is initialized without // actually running code, like runtime.mstart. if (n == 0 && flags&_TraceTrap != 0) || waspanic || pc == f.entry { pc++ } else { tracepc-- } // If there is inlining info, record the inner frames. if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil { inltree := (*[1 << 20]inlinedCall)(inldata) for { ix := pcdatavalue(f, _PCDATA_InlTreeIndex, tracepc, &cache) if ix < 0 { break } if inltree[ix].funcID == funcID_wrapper && elideWrapperCalling(lastFuncID) { // ignore wrappers } else if skip > 0 { skip-- } else if n < max { (*[1 << 20]uintptr)(unsafe.Pointer(pcbuf))[n] = pc n++ } lastFuncID = inltree[ix].funcID // Back up to an instruction in the "caller". tracepc = frame.fn.entry + uintptr(inltree[ix].parentPc) pc = tracepc + 1 } } // Record the main frame. if f.funcID == funcID_wrapper && elideWrapperCalling(lastFuncID) { // Ignore wrapper functions (except when they trigger panics). } else if skip > 0 { skip-- } else if n < max { (*[1 << 20]uintptr)(unsafe.Pointer(pcbuf))[n] = pc n++ } lastFuncID = f.funcID n-- // offset n++ below } if printing { // assume skip=0 for printing. // // Never elide wrappers if we haven't printed // any frames. And don't elide wrappers that // called panic rather than the wrapped // function. Otherwise, leave them out. // backup to CALL instruction to read inlining info (same logic as below) tracepc := frame.pc if (n > 0 || flags&_TraceTrap == 0) && frame.pc > f.entry && !waspanic { tracepc-- } // If there is inlining info, print the inner frames. if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil { inltree := (*[1 << 20]inlinedCall)(inldata) for { ix := pcdatavalue(f, _PCDATA_InlTreeIndex, tracepc, nil) if ix < 0 { break } if (flags&_TraceRuntimeFrames) != 0 || showframe(f, gp, nprint == 0, inltree[ix].funcID, lastFuncID) { name := funcnameFromNameoff(f, inltree[ix].func_) file, line := funcline(f, tracepc) print(name, "(...)\n") print("\t", file, ":", line, "\n") nprint++ } lastFuncID = inltree[ix].funcID // Back up to an instruction in the "caller". tracepc = frame.fn.entry + uintptr(inltree[ix].parentPc) } } if (flags&_TraceRuntimeFrames) != 0 || showframe(f, gp, nprint == 0, f.funcID, lastFuncID) { // Print during crash. // main(0x1, 0x2, 0x3) // /home/rsc/go/src/runtime/x.go:23 +0xf // name := funcname(f) file, line := funcline(f, tracepc) if name == "runtime.gopanic" { name = "panic" } print(name, "(") argp := (*[100]uintptr)(unsafe.Pointer(frame.argp)) for i := uintptr(0); i < frame.arglen/sys.PtrSize; i++ { if i >= 10 { print(", ...") break } if i != 0 { print(", ") } print(hex(argp[i])) } print(")\n") print("\t", file, ":", line) if frame.pc > f.entry { print(" +", hex(frame.pc-f.entry)) } if gp.m != nil && gp.m.throwing > 0 && gp == gp.m.curg || level >= 2 { print(" fp=", hex(frame.fp), " sp=", hex(frame.sp), " pc=", hex(frame.pc)) } print("\n") nprint++ } lastFuncID = f.funcID } n++ if f.funcID == funcID_cgocallback_gofunc && len(cgoCtxt) > 0 { ctxt := cgoCtxt[len(cgoCtxt)-1] cgoCtxt = cgoCtxt[:len(cgoCtxt)-1] // skip only applies to Go frames. // callback != nil only used when we only care // about Go frames. if skip == 0 && callback == nil { n = tracebackCgoContext(pcbuf, printing, ctxt, n, max) } } waspanic = f.funcID == funcID_sigpanic injectedCall := waspanic || f.funcID == funcID_asyncPreempt // Do not unwind past the bottom of the stack. if !flr.valid() { break } // Unwind to next frame. frame.fn = flr frame.pc = frame.lr frame.lr = 0 frame.sp = frame.fp frame.fp = 0 frame.argmap = nil // On link register architectures, sighandler saves the LR on stack // before faking a call. if usesLR && injectedCall { x := *(*uintptr)(unsafe.Pointer(frame.sp)) frame.sp += sys.MinFrameSize if GOARCH == "arm64" { // arm64 needs 16-byte aligned SP, always frame.sp += sys.PtrSize } f = findfunc(frame.pc) frame.fn = f if !f.valid() { frame.pc = x } else if funcspdelta(f, frame.pc, &cache) == 0 { frame.lr = x } } } if printing { n = nprint } // Note that panic != nil is okay here: there can be leftover panics, // because the defers on the panic stack do not nest in frame order as // they do on the defer stack. If you have: // // frame 1 defers d1 // frame 2 defers d2 // frame 3 defers d3 // frame 4 panics // frame 4's panic starts running defers // frame 5, running d3, defers d4 // frame 5 panics // frame 5's panic starts running defers // frame 6, running d4, garbage collects // frame 6, running d2, garbage collects // // During the execution of d4, the panic stack is d4 -> d3, which // is nested properly, and we'll treat frame 3 as resumable, because we // can find d3. (And in fact frame 3 is resumable. If d4 recovers // and frame 5 continues running, d3, d3 can recover and we'll // resume execution in (returning from) frame 3.) // // During the execution of d2, however, the panic stack is d2 -> d3, // which is inverted. The scan will match d2 to frame 2 but having // d2 on the stack until then means it will not match d3 to frame 3. // This is okay: if we're running d2, then all the defers after d2 have // completed and their corresponding frames are dead. Not finding d3 // for frame 3 means we'll set frame 3's continpc == 0, which is correct // (frame 3 is dead). At the end of the walk the panic stack can thus // contain defers (d3 in this case) for dead frames. The inversion here // always indicates a dead frame, and the effect of the inversion on the // scan is to hide those dead frames, so the scan is still okay: // what's left on the panic stack are exactly (and only) the dead frames. // // We require callback != nil here because only when callback != nil // do we know that gentraceback is being called in a "must be correct" // context as opposed to a "best effort" context. The tracebacks with // callbacks only happen when everything is stopped nicely. // At other times, such as when gathering a stack for a profiling signal // or when printing a traceback during a crash, everything may not be // stopped nicely, and the stack walk may not be able to complete. if callback != nil && n < max && frame.sp != gp.stktopsp { print("runtime: g", gp.goid, ": frame.sp=", hex(frame.sp), " top=", hex(gp.stktopsp), "\n") print("\tstack=[", hex(gp.stack.lo), "-", hex(gp.stack.hi), "] n=", n, " max=", max, "\n") throw("traceback did not unwind completely") } return n } // reflectMethodValue is a partial duplicate of reflect.makeFuncImpl // and reflect.methodValue. type reflectMethodValue struct { fn uintptr stack *bitvector // ptrmap for both args and results argLen uintptr // just args } // getArgInfoFast returns the argument frame information for a call to f. // It is short and inlineable. However, it does not handle all functions. // If ok reports false, you must call getArgInfo instead. // TODO(josharian): once we do mid-stack inlining, // call getArgInfo directly from getArgInfoFast and stop returning an ok bool. func getArgInfoFast(f funcInfo, needArgMap bool) (arglen uintptr, argmap *bitvector, ok bool) { return uintptr(f.args), nil, !(needArgMap && f.args == _ArgsSizeUnknown) } // getArgInfo returns the argument frame information for a call to f // with call frame frame. // // This is used for both actual calls with active stack frames and for // deferred calls or goroutines that are not yet executing. If this is an actual // call, ctxt must be nil (getArgInfo will retrieve what it needs from // the active stack frame). If this is a deferred call or unstarted goroutine, // ctxt must be the function object that was deferred or go'd. func getArgInfo(frame *stkframe, f funcInfo, needArgMap bool, ctxt *funcval) (arglen uintptr, argmap *bitvector) { arglen = uintptr(f.args) if needArgMap && f.args == _ArgsSizeUnknown { // Extract argument bitmaps for reflect stubs from the calls they made to reflect. switch funcname(f) { case "reflect.makeFuncStub", "reflect.methodValueCall": // These take a *reflect.methodValue as their // context register. var mv *reflectMethodValue var retValid bool if ctxt != nil { // This is not an actual call, but a // deferred call or an unstarted goroutine. // The function value is itself the *reflect.methodValue. mv = (*reflectMethodValue)(unsafe.Pointer(ctxt)) } else { // This is a real call that took the // *reflect.methodValue as its context // register and immediately saved it // to 0(SP). Get the methodValue from // 0(SP). arg0 := frame.sp + sys.MinFrameSize mv = *(**reflectMethodValue)(unsafe.Pointer(arg0)) // Figure out whether the return values are valid. // Reflect will update this value after it copies // in the return values. retValid = *(*bool)(unsafe.Pointer(arg0 + 3*sys.PtrSize)) } if mv.fn != f.entry { print("runtime: confused by ", funcname(f), "\n") throw("reflect mismatch") } bv := mv.stack arglen = uintptr(bv.n * sys.PtrSize) if !retValid { arglen = uintptr(mv.argLen) &^ (sys.PtrSize - 1) } argmap = bv } } return } // tracebackCgoContext handles tracing back a cgo context value, from // the context argument to setCgoTraceback, for the gentraceback // function. It returns the new value of n. func tracebackCgoContext(pcbuf *uintptr, printing bool, ctxt uintptr, n, max int) int { var cgoPCs [32]uintptr cgoContextPCs(ctxt, cgoPCs[:]) var arg cgoSymbolizerArg anySymbolized := false for _, pc := range cgoPCs { if pc == 0 || n >= max { break } if pcbuf != nil { (*[1 << 20]uintptr)(unsafe.Pointer(pcbuf))[n] = pc } if printing { if cgoSymbolizer == nil { print("non-Go function at pc=", hex(pc), "\n") } else { c := printOneCgoTraceback(pc, max-n, &arg) n += c - 1 // +1 a few lines down anySymbolized = true } } n++ } if anySymbolized { arg.pc = 0 callCgoSymbolizer(&arg) } return n } func printcreatedby(gp *g) { // Show what created goroutine, except main goroutine (goid 1). pc := gp.gopc f := findfunc(pc) if f.valid() && showframe(f, gp, false, funcID_normal, funcID_normal) && gp.goid != 1 { printcreatedby1(f, pc) } } func printcreatedby1(f funcInfo, pc uintptr) { print("created by ", funcname(f), "\n") tracepc := pc // back up to CALL instruction for funcline. if pc > f.entry { tracepc -= sys.PCQuantum } file, line := funcline(f, tracepc) print("\t", file, ":", line) if pc > f.entry { print(" +", hex(pc-f.entry)) } print("\n") } func traceback(pc, sp, lr uintptr, gp *g) { traceback1(pc, sp, lr, gp, 0) } // tracebacktrap is like traceback but expects that the PC and SP were obtained // from a trap, not from gp->sched or gp->syscallpc/gp->syscallsp or getcallerpc/getcallersp. // Because they are from a trap instead of from a saved pair, // the initial PC must not be rewound to the previous instruction. // (All the saved pairs record a PC that is a return address, so we // rewind it into the CALL instruction.) // If gp.m.libcall{g,pc,sp} information is available, it uses that information in preference to // the pc/sp/lr passed in. func tracebacktrap(pc, sp, lr uintptr, gp *g) { if gp.m.libcallsp != 0 { // We're in C code somewhere, traceback from the saved position. traceback1(gp.m.libcallpc, gp.m.libcallsp, 0, gp.m.libcallg.ptr(), 0) return } traceback1(pc, sp, lr, gp, _TraceTrap) } func traceback1(pc, sp, lr uintptr, gp *g, flags uint) { // If the goroutine is in cgo, and we have a cgo traceback, print that. if iscgo && gp.m != nil && gp.m.ncgo > 0 && gp.syscallsp != 0 && gp.m.cgoCallers != nil && gp.m.cgoCallers[0] != 0 { // Lock cgoCallers so that a signal handler won't // change it, copy the array, reset it, unlock it. // We are locked to the thread and are not running // concurrently with a signal handler. // We just have to stop a signal handler from interrupting // in the middle of our copy. atomic.Store(&gp.m.cgoCallersUse, 1) cgoCallers := *gp.m.cgoCallers gp.m.cgoCallers[0] = 0 atomic.Store(&gp.m.cgoCallersUse, 0) printCgoTraceback(&cgoCallers) } var n int if readgstatus(gp)&^_Gscan == _Gsyscall { // Override registers if blocked in system call. pc = gp.syscallpc sp = gp.syscallsp flags &^= _TraceTrap } // Print traceback. By default, omits runtime frames. // If that means we print nothing at all, repeat forcing all frames printed. n = gentraceback(pc, sp, lr, gp, 0, nil, _TracebackMaxFrames, nil, nil, flags) if n == 0 && (flags&_TraceRuntimeFrames) == 0 { n = gentraceback(pc, sp, lr, gp, 0, nil, _TracebackMaxFrames, nil, nil, flags|_TraceRuntimeFrames) } if n == _TracebackMaxFrames { print("...additional frames elided...\n") } printcreatedby(gp) if gp.ancestors == nil { return } for _, ancestor := range *gp.ancestors { printAncestorTraceback(ancestor) } } // printAncestorTraceback prints the traceback of the given ancestor. // TODO: Unify this with gentraceback and CallersFrames. func printAncestorTraceback(ancestor ancestorInfo) { print("[originating from goroutine ", ancestor.goid, "]:\n") for fidx, pc := range ancestor.pcs { f := findfunc(pc) // f previously validated if showfuncinfo(f, fidx == 0, funcID_normal, funcID_normal) { printAncestorTracebackFuncInfo(f, pc) } } if len(ancestor.pcs) == _TracebackMaxFrames { print("...additional frames elided...\n") } // Show what created goroutine, except main goroutine (goid 1). f := findfunc(ancestor.gopc) if f.valid() && showfuncinfo(f, false, funcID_normal, funcID_normal) && ancestor.goid != 1 { printcreatedby1(f, ancestor.gopc) } } // printAncestorTraceback prints the given function info at a given pc // within an ancestor traceback. The precision of this info is reduced // due to only have access to the pcs at the time of the caller // goroutine being created. func printAncestorTracebackFuncInfo(f funcInfo, pc uintptr) { name := funcname(f) if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil { inltree := (*[1 << 20]inlinedCall)(inldata) ix := pcdatavalue(f, _PCDATA_InlTreeIndex, pc, nil) if ix >= 0 { name = funcnameFromNameoff(f, inltree[ix].func_) } } file, line := funcline(f, pc) if name == "runtime.gopanic" { name = "panic" } print(name, "(...)\n") print("\t", file, ":", line) if pc > f.entry { print(" +", hex(pc-f.entry)) } print("\n") } func callers(skip int, pcbuf []uintptr) int { sp := getcallersp() pc := getcallerpc() gp := getg() var n int systemstack(func() { n = gentraceback(pc, sp, 0, gp, skip, &pcbuf[0], len(pcbuf), nil, nil, 0) }) return n } func gcallers(gp *g, skip int, pcbuf []uintptr) int { return gentraceback(^uintptr(0), ^uintptr(0), 0, gp, skip, &pcbuf[0], len(pcbuf), nil, nil, 0) } // showframe reports whether the frame with the given characteristics should // be printed during a traceback. func showframe(f funcInfo, gp *g, firstFrame bool, funcID, childID funcID) bool { g := getg() if g.m.throwing > 0 && gp != nil && (gp == g.m.curg || gp == g.m.caughtsig.ptr()) { return true } return showfuncinfo(f, firstFrame, funcID, childID) } // showfuncinfo reports whether a function with the given characteristics should // be printed during a traceback. func showfuncinfo(f funcInfo, firstFrame bool, funcID, childID funcID) bool { level, _, _ := gotraceback() if level > 1 { // Show all frames. return true } if !f.valid() { return false } if funcID == funcID_wrapper && elideWrapperCalling(childID) { return false } name := funcname(f) // Special case: always show runtime.gopanic frame // in the middle of a stack trace, so that we can // see the boundary between ordinary code and // panic-induced deferred code. // See golang.org/issue/5832. if name == "runtime.gopanic" && !firstFrame { return true } return contains(name, ".") && (!hasPrefix(name, "runtime.") || isExportedRuntime(name)) } // isExportedRuntime reports whether name is an exported runtime function. // It is only for runtime functions, so ASCII A-Z is fine. func isExportedRuntime(name string) bool { const n = len("runtime.") return len(name) > n && name[:n] == "runtime." && 'A' <= name[n] && name[n] <= 'Z' } // elideWrapperCalling reports whether a wrapper function that called // function id should be elided from stack traces. func elideWrapperCalling(id funcID) bool { // If the wrapper called a panic function instead of the // wrapped function, we want to include it in stacks. return !(id == funcID_gopanic || id == funcID_sigpanic || id == funcID_panicwrap) } var gStatusStrings = [...]string{ _Gidle: "idle", _Grunnable: "runnable", _Grunning: "running", _Gsyscall: "syscall", _Gwaiting: "waiting", _Gdead: "dead", _Gcopystack: "copystack", _Gpreempted: "preempted", } func goroutineheader(gp *g) { gpstatus := readgstatus(gp) isScan := gpstatus&_Gscan != 0 gpstatus &^= _Gscan // drop the scan bit // Basic string status var status string if 0 <= gpstatus && gpstatus < uint32(len(gStatusStrings)) { status = gStatusStrings[gpstatus] } else { status = "???" } // Override. if gpstatus == _Gwaiting && gp.waitreason != waitReasonZero { status = gp.waitreason.String() } // approx time the G is blocked, in minutes var waitfor int64 if (gpstatus == _Gwaiting || gpstatus == _Gsyscall) && gp.waitsince != 0 { waitfor = (nanotime() - gp.waitsince) / 60e9 } print("goroutine ", gp.goid, " [", status) if isScan { print(" (scan)") } if waitfor >= 1 { print(", ", waitfor, " minutes") } if gp.lockedm != 0 { print(", locked to thread") } print("]:\n") } func tracebackothers(me *g) { level, _, _ := gotraceback() // Show the current goroutine first, if we haven't already. g := getg() gp := g.m.curg if gp != nil && gp != me { print("\n") goroutineheader(gp) traceback(^uintptr(0), ^uintptr(0), 0, gp) } lock(&allglock) for _, gp := range allgs { if gp == me || gp == g.m.curg || readgstatus(gp) == _Gdead || isSystemGoroutine(gp, false) && level < 2 { continue } print("\n") goroutineheader(gp) // Note: gp.m == g.m occurs when tracebackothers is // called from a signal handler initiated during a // systemstack call. The original G is still in the // running state, and we want to print its stack. if gp.m != g.m && readgstatus(gp)&^_Gscan == _Grunning { print("\tgoroutine running on other thread; stack unavailable\n") printcreatedby(gp) } else { traceback(^uintptr(0), ^uintptr(0), 0, gp) } } unlock(&allglock) } // tracebackHexdump hexdumps part of stk around frame.sp and frame.fp // for debugging purposes. If the address bad is included in the // hexdumped range, it will mark it as well. func tracebackHexdump(stk stack, frame *stkframe, bad uintptr) { const expand = 32 * sys.PtrSize const maxExpand = 256 * sys.PtrSize // Start around frame.sp. lo, hi := frame.sp, frame.sp // Expand to include frame.fp. if frame.fp != 0 && frame.fp < lo { lo = frame.fp } if frame.fp != 0 && frame.fp > hi { hi = frame.fp } // Expand a bit more. lo, hi = lo-expand, hi+expand // But don't go too far from frame.sp. if lo < frame.sp-maxExpand { lo = frame.sp - maxExpand } if hi > frame.sp+maxExpand { hi = frame.sp + maxExpand } // And don't go outside the stack bounds. if lo < stk.lo { lo = stk.lo } if hi > stk.hi { hi = stk.hi } // Print the hex dump. print("stack: frame={sp:", hex(frame.sp), ", fp:", hex(frame.fp), "} stack=[", hex(stk.lo), ",", hex(stk.hi), ")\n") hexdumpWords(lo, hi, func(p uintptr) byte { switch p { case frame.fp: return '>' case frame.sp: return '<' case bad: return '!' } return 0 }) } // Does f mark the top of a goroutine stack? func topofstack(f funcInfo, g0 bool) bool { return f.funcID == funcID_goexit || f.funcID == funcID_mstart || f.funcID == funcID_mcall || f.funcID == funcID_morestack || f.funcID == funcID_rt0_go || f.funcID == funcID_externalthreadhandler || // asmcgocall is TOS on the system stack because it // switches to the system stack, but in this case we // can come back to the regular stack and still want // to be able to unwind through the call that appeared // on the regular stack. (g0 && f.funcID == funcID_asmcgocall) } // isSystemGoroutine reports whether the goroutine g must be omitted // in stack dumps and deadlock detector. This is any goroutine that // starts at a runtime.* entry point, except for runtime.main, // runtime.handleAsyncEvent (wasm only) and sometimes runtime.runfinq. // // If fixed is true, any goroutine that can vary between user and // system (that is, the finalizer goroutine) is considered a user // goroutine. func isSystemGoroutine(gp *g, fixed bool) bool { // Keep this in sync with cmd/trace/trace.go:isSystemGoroutine. f := findfunc(gp.startpc) if !f.valid() { return false } if f.funcID == funcID_runtime_main || f.funcID == funcID_handleAsyncEvent { return false } if f.funcID == funcID_runfinq { // We include the finalizer goroutine if it's calling // back into user code. if fixed { // This goroutine can vary. In fixed mode, // always consider it a user goroutine. return false } return !fingRunning } return hasPrefix(funcname(f), "runtime.") } // SetCgoTraceback records three C functions to use to gather // traceback information from C code and to convert that traceback // information into symbolic information. These are used when printing // stack traces for a program that uses cgo. // // The traceback and context functions may be called from a signal // handler, and must therefore use only async-signal safe functions. // The symbolizer function may be called while the program is // crashing, and so must be cautious about using memory. None of the // functions may call back into Go. // // The context function will be called with a single argument, a // pointer to a struct: // // struct { // Context uintptr // } // // In C syntax, this struct will be // // struct { // uintptr_t Context; // }; // // If the Context field is 0, the context function is being called to // record the current traceback context. It should record in the // Context field whatever information is needed about the current // point of execution to later produce a stack trace, probably the // stack pointer and PC. In this case the context function will be // called from C code. // // If the Context field is not 0, then it is a value returned by a // previous call to the context function. This case is called when the // context is no longer needed; that is, when the Go code is returning // to its C code caller. This permits the context function to release // any associated resources. // // While it would be correct for the context function to record a // complete a stack trace whenever it is called, and simply copy that // out in the traceback function, in a typical program the context // function will be called many times without ever recording a // traceback for that context. Recording a complete stack trace in a // call to the context function is likely to be inefficient. // // The traceback function will be called with a single argument, a // pointer to a struct: // // struct { // Context uintptr // SigContext uintptr // Buf *uintptr // Max uintptr // } // // In C syntax, this struct will be // // struct { // uintptr_t Context; // uintptr_t SigContext; // uintptr_t* Buf; // uintptr_t Max; // }; // // The Context field will be zero to gather a traceback from the // current program execution point. In this case, the traceback // function will be called from C code. // // Otherwise Context will be a value previously returned by a call to // the context function. The traceback function should gather a stack // trace from that saved point in the program execution. The traceback // function may be called from an execution thread other than the one // that recorded the context, but only when the context is known to be // valid and unchanging. The traceback function may also be called // deeper in the call stack on the same thread that recorded the // context. The traceback function may be called multiple times with // the same Context value; it will usually be appropriate to cache the // result, if possible, the first time this is called for a specific // context value. // // If the traceback function is called from a signal handler on a Unix // system, SigContext will be the signal context argument passed to // the signal handler (a C ucontext_t* cast to uintptr_t). This may be // used to start tracing at the point where the signal occurred. If // the traceback function is not called from a signal handler, // SigContext will be zero. // // Buf is where the traceback information should be stored. It should // be PC values, such that Buf[0] is the PC of the caller, Buf[1] is // the PC of that function's caller, and so on. Max is the maximum // number of entries to store. The function should store a zero to // indicate the top of the stack, or that the caller is on a different // stack, presumably a Go stack. // // Unlike runtime.Callers, the PC values returned should, when passed // to the symbolizer function, return the file/line of the call // instruction. No additional subtraction is required or appropriate. // // On all platforms, the traceback function is invoked when a call from // Go to C to Go requests a stack trace. On linux/amd64, linux/ppc64le, // and freebsd/amd64, the traceback function is also invoked when a // signal is received by a thread that is executing a cgo call. The // traceback function should not make assumptions about when it is // called, as future versions of Go may make additional calls. // // The symbolizer function will be called with a single argument, a // pointer to a struct: // // struct { // PC uintptr // program counter to fetch information for // File *byte // file name (NUL terminated) // Lineno uintptr // line number // Func *byte // function name (NUL terminated) // Entry uintptr // function entry point // More uintptr // set non-zero if more info for this PC // Data uintptr // unused by runtime, available for function // } // // In C syntax, this struct will be // // struct { // uintptr_t PC; // char* File; // uintptr_t Lineno; // char* Func; // uintptr_t Entry; // uintptr_t More; // uintptr_t Data; // }; // // The PC field will be a value returned by a call to the traceback // function. // // The first time the function is called for a particular traceback, // all the fields except PC will be 0. The function should fill in the // other fields if possible, setting them to 0/nil if the information // is not available. The Data field may be used to store any useful // information across calls. The More field should be set to non-zero // if there is more information for this PC, zero otherwise. If More // is set non-zero, the function will be called again with the same // PC, and may return different information (this is intended for use // with inlined functions). If More is zero, the function will be // called with the next PC value in the traceback. When the traceback // is complete, the function will be called once more with PC set to // zero; this may be used to free any information. Each call will // leave the fields of the struct set to the same values they had upon // return, except for the PC field when the More field is zero. The // function must not keep a copy of the struct pointer between calls. // // When calling SetCgoTraceback, the version argument is the version // number of the structs that the functions expect to receive. // Currently this must be zero. // // The symbolizer function may be nil, in which case the results of // the traceback function will be displayed as numbers. If the // traceback function is nil, the symbolizer function will never be // called. The context function may be nil, in which case the // traceback function will only be called with the context field set // to zero. If the context function is nil, then calls from Go to C // to Go will not show a traceback for the C portion of the call stack. // // SetCgoTraceback should be called only once, ideally from an init function. func SetCgoTraceback(version int, traceback, context, symbolizer unsafe.Pointer) { if version != 0 { panic("unsupported version") } if cgoTraceback != nil && cgoTraceback != traceback || cgoContext != nil && cgoContext != context || cgoSymbolizer != nil && cgoSymbolizer != symbolizer { panic("call SetCgoTraceback only once") } cgoTraceback = traceback cgoContext = context cgoSymbolizer = symbolizer // The context function is called when a C function calls a Go // function. As such it is only called by C code in runtime/cgo. if _cgo_set_context_function != nil { cgocall(_cgo_set_context_function, context) } } var cgoTraceback unsafe.Pointer var cgoContext unsafe.Pointer var cgoSymbolizer unsafe.Pointer // cgoTracebackArg is the type passed to cgoTraceback. type cgoTracebackArg struct { context uintptr sigContext uintptr buf *uintptr max uintptr } // cgoContextArg is the type passed to the context function. type cgoContextArg struct { context uintptr } // cgoSymbolizerArg is the type passed to cgoSymbolizer. type cgoSymbolizerArg struct { pc uintptr file *byte lineno uintptr funcName *byte entry uintptr more uintptr data uintptr } // cgoTraceback prints a traceback of callers. func printCgoTraceback(callers *cgoCallers) { if cgoSymbolizer == nil { for _, c := range callers { if c == 0 { break } print("non-Go function at pc=", hex(c), "\n") } return } var arg cgoSymbolizerArg for _, c := range callers { if c == 0 { break } printOneCgoTraceback(c, 0x7fffffff, &arg) } arg.pc = 0 callCgoSymbolizer(&arg) } // printOneCgoTraceback prints the traceback of a single cgo caller. // This can print more than one line because of inlining. // Returns the number of frames printed. func printOneCgoTraceback(pc uintptr, max int, arg *cgoSymbolizerArg) int { c := 0 arg.pc = pc for c <= max { callCgoSymbolizer(arg) if arg.funcName != nil { // Note that we don't print any argument // information here, not even parentheses. // The symbolizer must add that if appropriate. println(gostringnocopy(arg.funcName)) } else { println("non-Go function") } print("\t") if arg.file != nil { print(gostringnocopy(arg.file), ":", arg.lineno, " ") } print("pc=", hex(pc), "\n") c++ if arg.more == 0 { break } } return c } // callCgoSymbolizer calls the cgoSymbolizer function. func callCgoSymbolizer(arg *cgoSymbolizerArg) { call := cgocall if panicking > 0 || getg().m.curg != getg() { // We do not want to call into the scheduler when panicking // or when on the system stack. call = asmcgocall } if msanenabled { msanwrite(unsafe.Pointer(arg), unsafe.Sizeof(cgoSymbolizerArg{})) } call(cgoSymbolizer, noescape(unsafe.Pointer(arg))) } // cgoContextPCs gets the PC values from a cgo traceback. func cgoContextPCs(ctxt uintptr, buf []uintptr) { if cgoTraceback == nil { return } call := cgocall if panicking > 0 || getg().m.curg != getg() { // We do not want to call into the scheduler when panicking // or when on the system stack. call = asmcgocall } arg := cgoTracebackArg{ context: ctxt, buf: (*uintptr)(noescape(unsafe.Pointer(&buf[0]))), max: uintptr(len(buf)), } if msanenabled { msanwrite(unsafe.Pointer(&arg), unsafe.Sizeof(arg)) } call(cgoTraceback, noescape(unsafe.Pointer(&arg))) }
Close