[Bug gdb/24445] New: dwz multifile index not written to index cache

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Thu Apr 11 12:25:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=24445

            Bug ID: 24445
           Summary: dwz multifile index not written to index cache
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Spin-off of PR24438 comment 2. ]

Consider the debug script debug.sh:
...
$ cat debug.sh
#!/bin/sh

orig=true
#orig=false
if $orig; then
    exec=build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache.orig
    file $exec
else
    exec=build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache
    file $exec
    dwz=build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache.dwz
    file $dwz
fi

rm -f ~/.cache/gdb/*

echo "One:"

./build/gdb/gdb \
    -iex "set index-cache on" \
    -iex "set debug index-cache" \
    $exec \
    -ex "show index-cache stats" \
    -batch

ls -la ~/.cache/gdb

echo "Two:"

./build/gdb/gdb \
    -iex "set index-cache on" \
    -iex "set debug index-cache" \
    $exec \
    -ex "show index-cache stats" \
    -batch
...

With orig == true, I run the script on the original executable, with orig ==
false, I run it on the dwz -m modified version.

With orig == true, I get:
...
build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache.orig: ELF 64-bit
LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter
/lib64/l, for GNU/Linux 3.2.0,
BuildID[sha1]=7481d8a114be967ca8c6581017a68e9586c265c7, with debug_info, not
stripped
One:
index cache: trying to read
/home/vries/.cache/gdb/7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index
index cache: couldn't read
/home/vries/.cache/gdb/7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index:
open: Bestand of map bestaat niet.
index cache: writing index cache for objfile
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache.orig
  Cache hits (this session): 0
Cache misses (this session): 1
totaal 16
drwx------  2 vries users   64 11 apr 14:14 .
drwxr-xr-x 40 vries users 4096 10 apr 18:10 ..
-rw-------  1 vries users 8681 11 apr 14:14
7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index
Two:
index cache: trying to read
/home/vries/.cache/gdb/7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index
  Cache hits (this session): 1
Cache misses (this session): 0
...

With orig == false, I get:
...
build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache: ELF 64-bit LSB
executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l,
for GNU/Linux 3.2.0, BuildID[sha1]=7481d8a114be967ca8c6581017a68e9586c265c7,
with debug_info, not stripped
build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache.dwz: ELF 64-bit
LSB relocatable, x86-64, version 1 (SYSV),
BuildID[sha1]=d33c79ccf37ba8e54bdd0f9e02b631a1595f4926, stripped
One:
index cache: trying to read
/home/vries/.cache/gdb/7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index
index cache: couldn't read
/home/vries/.cache/gdb/7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index:
open: Bestand of map bestaat niet.
index cache: writing index cache for objfile
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache
  Cache hits (this session): 0
Cache misses (this session): 1
totaal 16
drwx------  2 vries users   64 11 apr 14:15 .
drwxr-xr-x 40 vries users 4096 10 apr 18:10 ..
-rw-------  1 vries users 8681 11 apr 14:15
7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index
Two:
index cache: trying to read
/home/vries/.cache/gdb/7481d8a114be967ca8c6581017a68e9586c265c7.gdb-index
index cache: trying to read
/home/vries/.cache/gdb/d33c79ccf37ba8e54bdd0f9e02b631a1595f4926.gdb-index
index cache: couldn't read
/home/vries/.cache/gdb/d33c79ccf37ba8e54bdd0f9e02b631a1595f4926.gdb-index:
open: Bestand of map bestaat niet.
index cache: writing index cache for objfile
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache
  Cache hits (this session): 0
Cache misses (this session): 1
...

So, AFAIU:
- when loading the original executable, gdb:
  - cannot find a cached index in the clean directory, then
  - saves one, and then 
  - can find the saved one
- when loading the dwz-m-ed executable, gdb:
  - cannot find a cached index in the clean directory, then
  - saves one for the executable but not for the .gnu_debugaltlink file,
    and then
  - cannot load the saved one because it requires the cached index for the
    .gnu_debugaltlink file.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list