runtime-gdb.py在Go语言中的作用是什么?

huangapple go评论97阅读模式
英文:

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

问题

我刚刚用Go语言创建了我的第一个“Hello World”程序,构建并生成了二进制文件。在检查二进制文件时,我发现了对该二进制文件内的这个Python脚本的引用。

这个脚本的描述如下:

当GDB在编译的二进制文件中找到一个.debug_gdb_scripts部分时,它会加载这个脚本。[68]l链接器会根据运行时包的路径将其发射到这个文件的路径。

我不太清楚这个的含义。那么,runtime-gdb.py是什么,它与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?

答案1

得分: 6

如果您使用gdb调试器来调试您的程序,加载该脚本可以改进其与Go程序一起使用的功能,例如能够查看映射和切片内部的值(而不是将它们视为不透明指针),以及能够列出和检查goroutine(而不是本机线程)。gdb使用Python进行扩展。

英文:

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.

答案2

得分: 2

gdb可以使用Python进行脚本编写。这是一个用于支持Golang的脚本。

英文:

gdb is scriptable in python. This is a script for golang support.

huangapple
  • 本文由 发表于 2017年8月9日 23:02:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/45594286.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定