Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the role of runtime-gdb.py in Go language?

Tags:

python

go

I just created my first "Hello World" program in Go language, built it and created the binary file. Upon inspecting the binary, I came across reference to this python script inside the binary file.

The description of this script reads

This script is loaded by GDB when it finds a .debug_gdb_scripts section in the compiled binary. The [68]l linkers emit this with a path to this file based on the path to the runtime package.

I don't understand the meaning of this clearly. So, what is runtime-gdb.py and how is it related to Go language?

like image 727
Beginner Avatar asked Jan 29 '23 19:01

Beginner


1 Answers

If you use the gdb debugger to debug your program, loading that script improves its features for working with Go programs, such as being able to look at the values inside of maps and slices (instead of seeing them as opaque pointers) and being able to list and inspect goroutines (instead of native threads). gdb uses Python for extensions.

like image 138
hobbs Avatar answered Feb 01 '23 09:02

hobbs