go - 如何在 GO 中生成混合源和汇编列表?

标签 go

我知道如何获得 Go 程序的汇编表示,但是如何在 Go 中获得这样的混合列表?

    0:helloworld.c  **** #include <stdio.h>
    1:helloworld.c  ****
    2:helloworld.c  **** int main()
    3:helloworld.c  **** {
    19                            .loc 1 4 0
    20                            .cfi_startproc
    21 0000 55                    pushq   %rbp
    22                    .LCFI0:
    23                            .cfi_def_cfa_offset 16
    24 0001 4889E5                movq    %rsp, %rbp
    25                            .cfi_offset 6, -16
    26                    .LCFI1:
    27                            .cfi_def_cfa_register 6
    4:helloworld.c  ****   printf("Hello world!\n");
    28                            .loc 1 5 0
    29 0004 BF000000              movl    $.LC0, %edi
    29      00
    ...

最佳答案

假装我们 build 了o.exe使用 go build -o o.exe 从 Go 源执行.
以下命令打印 strconv.Atoi 的混合源+反汇编功能:gdb -batch -ex "set disassembly-flavor intel" -ex "disassemble /s 'strconv.Atoi'" o.exe

关于go - 如何在 GO 中生成混合源和汇编列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63464335/

相关文章:

Golang 类型断言/转换为中间结构

go - 单个 go 项目使用的 go 包的正确文件夹结构

json - 使用 golang 解析 CSV 文件中的嵌套 JSON 对象

json - 取消具有可变数量的相似字段的 JSON 对象

go - 为什么 defer 对周围函数中定义的变量的行为与命名结果不同?

rest - gin-gonic 无法分配请求的地址

go - 如何在多个包之间共享单个数据库连接

go - 我可以在 Golang 中将变量类型与 .(type) 进行比较吗?

go - 使用运算符代替函数

ajax - 当我使用 POSTMAN 在 golang api 上执行 POST 请求时,我成功地收到了 jwt token 作为 cookie,但是当我从浏览器执行此操作时,我没有收到任何 cookie