delve/_fixtures/issue2319/README.txt
Than McIntosh dceffacb89
pkg/proc: fix for file reference handling with DWARF 5 compilation units (#2327)
Add a helper method for collecting line table file references that
does the correct thing for DWARF 5 vs DWARF 4 (in the latter case you
have an implicit 0 entry which is the comp dir, whereas in the former
case you do not). This is to avoid out-of-bounds errors when examining
the file table section of a DWARF 5 compilation unit's line table.

Included is a new linux/amd-only test that includes a precompiled C
object file with a DWARF-5 section that triggers the bug in question.

Fixes #2319
2021-01-29 09:23:52 -08:00

58 lines
1.2 KiB
Plaintext

Note:
-----
cfile-linux-amd64.syso was generated from the C source file that appears below.
Build with Clang version 10:
$ clang-10 -O -gdwarf-5 -c cfile.c -o cfile.syso
The DWARF of interest is for the function "qtop". Triggering the bug
requires that the source file in question appears as the first item
in the DWARF line table file section, e.g.
$ llvm-dwarfdump-10 --debug-line cfile.syso
....
standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
standard_opcode_lengths[DW_LNS_set_isa] = 1
include_directories[ 0] = "/ssd2/go1/src/tmp/dlvbug"
file_names[ 0]:
name: "cfile.c"
dir_index: 0
md5_checksum: ...
// ------------------------begin source code for cfile.c----------------
#include <stdlib.h>
#include <string.h>
int glob = 99;
inline int qleaf(int lx, int ly, int *lv)
{
lv[lx&3] += 3;
return lv[ly&3];
}
int qmid(int mx, int my, int *lv, int *mv)
{
mv[mx&3] += qleaf(mx, my, lv);
return mv[my&3];
}
int qtop(int mx, int my)
{
int mv[64], lv[66], n = (mx < 64 ? 64 : mx);
memset(&mv[0], 9, sizeof(mv));
memset(&lv[0], 11, sizeof(mv));
return qmid(mx, my, lv, mv) + qleaf(mx, my, lv);
}
void Cfunc(int x) {
glob += qtop(x, 43);
}