Can't parse this DWP file: InvalidIndexSlotCount
mstange opened this issue · comments
Markus Stange commented
The dwp file in this directory doesn't parse successfully:
% cargo run --bin dwarfdump -- --dwp ~/code/samply/fixtures/other/simple-example/out/with-dwp/main.dwp --dwo-parent ~/code/samply/fixtures/other/simple-example/out/with-dwp/main
Failed to dump '/home/ubuntu/code/samply/fixtures/other/simple-example/out/with-dwp/main.dwp': GimliError(InvalidIndexSlotCount)
It returns a GimliError(InvalidIndexSlotCount)
from this code:
Lines 166 to 171 in 7294ff0
section_count
, unit_count
and slot_count
are all zero for this dwp file.
I generated the dwp file with dwp version 2.34 on Ubuntu 20.04.4 LTS in an aarch64 VM, with gcc version 9.4.0.
Here's the script I used to generate it:
#!/bin/bash
mkdir -p out/with-dwp
# Compile source files into object files
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/main.cpp -o out/with-dwp/main.o
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file1.cpp -o out/with-dwp/file1.o
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file2.cpp -o out/with-dwp/file2.o
g++ -c -g -Os -Wall -Wextra -gsplit-dwarf src/file3.cpp -o out/with-dwp/file3.o
# Create libfile23.a from file2.o and file3.o
ar rcs out/with-dwp/libfile23.a out/with-dwp/file2.o out/with-dwp/file3.o
# Link libraries into executable
g++ out/with-dwp/main.o out/with-dwp/file1.o out/with-dwp/libfile23.a -o out/with-dwp/main
# Make dwp file
dwp -e out/with-dwp/main
# Remove .dwo, .o, .a files
rm out/with-dwp/*.dwo out/with-dwp/*.o out/with-dwp/*.a
The source code is here: https://github.com/mstange/samply/tree/f78bbae04b27e8c77e2a77ef8d8aed6c76abbc7a/fixtures/other/simple-example/src