Do we document the history of .gosymtab and .gopclntab, and the differences with .symtab and .debug_line, .debug_frame?

83 views
Skip to first unread message

Kn

unread,
Nov 26, 2020, 2:50:31 PM11/26/20
to golang-nuts
Hi, I am writing a golang debugger and some documents to show others the knowledge about how to develop a golang debugger.

I notice go debug/elf, debug/gosym is enough for the occasions like lookup symbol, pcToLn, lnToPC, maybe even for backtrace?

I want to know why go generate .gosymtab (now it is empty) and .gopclntab, why don't we use the .symtab or .debug_line, debug_frame, etc? Does it have relations about plan9 object  symtab? Are the generated .debug_* sections generated for common utilities, like readelf, etc?

Ian Lance Taylor

unread,
Nov 26, 2020, 4:10:18 PM11/26/20
to Kn, golang-nuts
The .gopclntab section is loaded into memory at run time and used to
do stack tracebacks and by functions like runtime.Callers. The
.symtab and .debug sections are not loaded into memory; they are
available to debuggers, but not to the running programs. They used by
debuggers like delve and gdb.

The .gopclntab format was once based on the Plan 9 format, but it has
changed significantly over time.

Ian

Kn

unread,
Nov 26, 2020, 6:54:46 PM11/26/20
to golang-nuts
Ian, I understand now. Thanks you! :)
Reply all
Reply to author
Forward
0 new messages