橡皮擦擦

运行dlv提示:could not attach to pid 28294: could not open debug info

Golang

原因:
RPM包的安装方式会造成二进制文件debug字节头丢失,dlv无法接入进程
判断方法:

root@ubuntu:/home/action/ustats# readelf -S ./bin/ustats
There are 50 section headers, starting at offset 0x2e62c20:
 
Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400270  00000270
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             000000000040028c  0000028c
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.go.buildid  NOTE             00000000004002ac  000002ac
       0000000000000064  0000000000000000   A       0     0     4
  [ 4] .note.gnu.build-i NOTE             0000000000400310  00000310
       0000000000000024  0000000000000000   A       0     0     4
  [ 5] .gnu.hash         GNU_HASH         0000000000400338  00000338
       0000000000000c54  0000000000000000   A       6     0     8
  [ 6] .dynsym           DYNSYM           0000000000400f90  00000f90
       0000000000002df0  0000000000000018   A       7     1     8
  [ 7] .dynstr           STRTAB           0000000000403d80  00003d80
       00000000000024b2  0000000000000000   A       0     0     1
  [ 8] .gnu.version      VERSYM           0000000000406232  00006232
       00000000000003d4  0000000000000002   A       6     0     2
  [ 9] .gnu.version_r    VERNEED          0000000000406608  00006608
       00000000000000a0  0000000000000000   A       7     3     8
  [10] .rela.dyn         RELA             00000000004066a8  000066a8
       0000000000000240  0000000000000018   A       6     0     8
  [11] .rela.plt         RELA             00000000004068e8  000068e8
       0000000000000708  0000000000000018  AI       6    29     8
  [12] .init             PROGBITS         0000000000406ff0  00006ff0
       0000000000000017  0000000000000000  AX       0     0     4
  [13] .plt              PROGBITS         0000000000407010  00007010
       00000000000004c0  0000000000000010  AX       0     0     16
  [14] .plt.got          PROGBITS         00000000004074d0  000074d0
       0000000000000008  0000000000000008  AX       0     0     8
  [15] .text             PROGBITS         00000000004074e0  000074e0
       00000000012c9650  0000000000000000  AX       0     0     16
  [16] .fini             PROGBITS         00000000016d0b30  012d0b30
       0000000000000009  0000000000000000  AX       0     0     4
  [17] .rodata           PROGBITS         00000000016d0b40  012d0b40
       0000000000892030  0000000000000000   A       0     0     32
  [18] .typelink         PROGBITS         0000000001f62b80  01b62b80
       000000000000afa4  0000000000000000   A       0     0     32
  [19] .itablink         PROGBITS         0000000001f6db28  01b6db28
       0000000000003cd8  0000000000000000   A       0     0     8
  [20] .gopclntab        PROGBITS         0000000001f71800  01b71800
       0000000000929025  0000000000000000   A       0     0     32
  [21] .eh_frame_hdr     PROGBITS         000000000289a828  0249a828
       00000000000036cc  0000000000000000   A       0     0     4
  [22] .eh_frame         PROGBITS         000000000289def8  0249def8
       00000000000163d8  0000000000000000   A       0     0     8
  [23] .tbss             NOBITS           0000000002ab4a50  024b4a50
       0000000000000008  0000000000000000 WAT       0     0     8
  [24] .init_array       INIT_ARRAY       0000000002ab4a50  024b4a50
       0000000000000008  0000000000000008  WA       0     0     8
  [25] .fini_array       FINI_ARRAY       0000000002ab4a58  024b4a58
       0000000000000008  0000000000000008  WA       0     0     8
  [26] .data.rel.ro      PROGBITS         0000000002ab4a60  024b4a60
       0000000000002388  0000000000000000  WA       0     0     32
  [27] .dynamic          DYNAMIC          0000000002ab6de8  024b6de8
       00000000000001f0  0000000000000010  WA       7     0     8
  [28] .got              PROGBITS         0000000002ab6fd8  024b6fd8
       0000000000000028  0000000000000008  WA       0     0     8
  [29] .got.plt          PROGBITS         0000000002ab7000  024b7000
       0000000000000270  0000000000000008  WA       0     0     8
  [30] .data             PROGBITS         0000000002ab7280  024b7280
       0000000000034438  0000000000000000  WA       0     0     32
  [31] .go.buildinfo     PROGBITS         0000000002aeb6c0  024eb6c0
       0000000000000020  0000000000000000  WA       0     0     16
  [32] .noptrdata        PROGBITS         0000000002aeb6e0  024eb6e0
       00000000000ee932  0000000000000000  WA       0     0     32
  [33] .bss              NOBITS           0000000002bda020  025da012
       0000000000033f80  0000000000000000  WA       0     0     32
  [34] .noptrbss         NOBITS           0000000002c0dfa0  025da012
       0000000000008058  0000000000000000  WA       0     0     32
  [35] .comment          PROGBITS         0000000000000000  025da012
       0000000000000029  0000000000000001  MS       0     0     1
  [36] .zdebug_aranges   PROGBITS         0000000000000000  029898f0
       000000000000027d  0000000000000000           0     0     16
  [37] .zdebug_pubnames  PROGBITS         0000000000000000  02989b6d
       000000000000d388  0000000000000000           0     0     1
  [38] .zdebug_info      PROGBITS         0000000000000000  02996ef5
       000000000025c0d6  0000000000000000           0     0     1
  [39] .zdebug_abbrev    PROGBITS         0000000000000000  02bf2fcb
       0000000000000bd4  0000000000000000           0     0     1
  [40] .zdebug_line      PROGBITS         0000000000000000  02bf3b9f
       000000000012867c  0000000000000000           0     0     1
  [41] .zdebug_frame     PROGBITS         0000000000000000  02d1c21b
       0000000000063362  0000000000000000           0     0     1
  [42] .zdebug_str       PROGBITS         0000000000000000  02d7f57d
       000000000000983d  0000000000000001  MS       0     0     1
  [43] .zdebug_loc       PROGBITS         0000000000000000  02d88dba
       000000000007326d  0000000000000000           0     0     1
  [44] .zdebug_pubtypes  PROGBITS         0000000000000000  02dfc027
       0000000000034fda  0000000000000000           0     0     1
  [45] .zdebug_ranges    PROGBITS         0000000000000000  02e31001
       00000000000319e0  0000000000000000           0     0     1
  [46] .debug_gdb_script PROGBITS         0000000000000000  02e629e1
       000000000000002f  0000000000000000           0     0     1
  [47] .symtab           SYMTAB           0000000000000000  025da040
       000000000012e550  0000000000000018          48   51109     8
  [48] .strtab           STRTAB           0000000000000000  02708590
       0000000000281351  0000000000000000           0     0     1
  [49] .shstrtab         STRTAB           0000000000000000  02e62a10
       0000000000000210  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

如果存在debug_gbd_script,则表示该文件支持dlv监听

点我评论
打赏本文
二维码


51

文章

6

分类