Blame tests/run-readelf-loc.sh

Packit 032894
#! /bin/sh
Packit 032894
# Copyright (C) 2013 Red Hat, Inc.
Packit 032894
# This file is part of elfutils.
Packit 032894
#
Packit 032894
# This file is free software; you can redistribute it and/or modify
Packit 032894
# it under the terms of the GNU General Public License as published by
Packit 032894
# the Free Software Foundation; either version 3 of the License, or
Packit 032894
# (at your option) any later version.
Packit 032894
#
Packit 032894
# elfutils is distributed in the hope that it will be useful, but
Packit 032894
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 032894
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 032894
# GNU General Public License for more details.
Packit 032894
#
Packit 032894
# You should have received a copy of the GNU General Public License
Packit 032894
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 032894
Packit 032894
. $srcdir/test-subr.sh
Packit 032894
Packit 032894
# - hello.c
Packit 032894
# int say (const char *prefix);
Packit 032894
#
Packit 032894
# static char *
Packit 032894
# subject (char *word, int count)
Packit 032894
# {
Packit 032894
#   return count > 0 ? word : (word + count);
Packit 032894
# }
Packit 032894
#
Packit 032894
# int
Packit 032894
# main (int argc, char **argv)
Packit 032894
# {
Packit 032894
#    return say (subject (argv[0], argc));
Packit 032894
# }
Packit 032894
#
Packit 032894
# - world.c
Packit 032894
# static int
Packit 032894
# sad (char c)
Packit 032894
# {
Packit 032894
#   return c > 0 ? c : c + 1;
Packit 032894
# }
Packit 032894
#
Packit 032894
# static int
Packit 032894
# happy (const char *w)
Packit 032894
# {
Packit 032894
#   return sad (w[1]);
Packit 032894
# }
Packit 032894
#
Packit 032894
# int
Packit 032894
# say (const char *prefix)
Packit 032894
# {
Packit 032894
#   const char *world = "World";
Packit 032894
#   return prefix ? sad (prefix[0]) : happy (world);
Packit 032894
# }
Packit 032894
#
Packit 032894
# gcc -g -O2 -c hello.c
Packit 032894
# gcc -g -O2 -c world.c
Packit 032894
# gcc -g -o testfileloc hello.o world.o
Packit 032894
Packit 032894
testfiles testfileloc
Packit 032894
Packit 032894
# Process values as offsets from base addresses and resolve to symbols.
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc --debug-dump=ranges \
Packit 032894
  testfileloc<<\EOF
Packit 032894
Packit 032894
DWARF section [33] '.debug_loc' at offset 0xd2a:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400480 <main>
Packit 032894
 [     0] range 0, d
Packit 032894
          0x0000000000400480 <main>..
Packit 032894
          0x000000000040048c <main+0xc>
Packit 032894
           [ 0] reg5
Packit 032894
 [    23] range 5, d
Packit 032894
          0x0000000000400485 <main+0x5>..
Packit 032894
          0x000000000040048c <main+0xc>
Packit 032894
           [ 0] reg5
Packit 032894
Packit 032894
 CU [    e0] base: 0x00000000004004a0 <say>
Packit 032894
 [    46] range 12, 1a
Packit 032894
          0x00000000004004b2 <say+0x12>..
Packit 032894
          0x00000000004004b9 <say+0x19>
Packit 032894
           [ 0] breg5 0
Packit 032894
Packit 032894
DWARF section [34] '.debug_ranges' at offset 0xd94:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400480 <main>
Packit 032894
 [     0] range 0, 2
Packit 032894
          0x0000000000400480 <main>..
Packit 032894
          0x0000000000400481 <main+0x1>
Packit 032894
          range 5, d
Packit 032894
          0x0000000000400485 <main+0x5>..
Packit 032894
          0x000000000040048c <main+0xc>
Packit 032894
Packit 032894
 CU [    e0] base: 0x00000000004004a0 <say>
Packit 032894
 [    30] range d, f
Packit 032894
          0x00000000004004ad <say+0xd>..
Packit 032894
          0x00000000004004ae <say+0xe>
Packit 032894
          range 12, 1a
Packit 032894
          0x00000000004004b2 <say+0x12>..
Packit 032894
          0x00000000004004b9 <say+0x19>
Packit 032894
EOF
Packit 032894
Packit 032894
# Don't resolve addresses to symbols.
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf -N --debug-dump=loc --debug-dump=ranges \
Packit 032894
  testfileloc<<\EOF
Packit 032894
Packit 032894
DWARF section [33] '.debug_loc' at offset 0xd2a:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400480
Packit 032894
 [     0] range 0, d
Packit 032894
          0x0000000000400480..
Packit 032894
          0x000000000040048c
Packit 032894
           [ 0] reg5
Packit 032894
 [    23] range 5, d
Packit 032894
          0x0000000000400485..
Packit 032894
          0x000000000040048c
Packit 032894
           [ 0] reg5
Packit 032894
Packit 032894
 CU [    e0] base: 0x00000000004004a0
Packit 032894
 [    46] range 12, 1a
Packit 032894
          0x00000000004004b2..
Packit 032894
          0x00000000004004b9
Packit 032894
           [ 0] breg5 0
Packit 032894
Packit 032894
DWARF section [34] '.debug_ranges' at offset 0xd94:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400480
Packit 032894
 [     0] range 0, 2
Packit 032894
          0x0000000000400480..
Packit 032894
          0x0000000000400481
Packit 032894
          range 5, d
Packit 032894
          0x0000000000400485..
Packit 032894
          0x000000000040048c
Packit 032894
Packit 032894
 CU [    e0] base: 0x00000000004004a0
Packit 032894
 [    30] range d, f
Packit 032894
          0x00000000004004ad..
Packit 032894
          0x00000000004004ae
Packit 032894
          range 12, 1a
Packit 032894
          0x00000000004004b2..
Packit 032894
          0x00000000004004b9
Packit 032894
EOF
Packit 032894
Packit 032894
# Produce "raw" unprocessed content.
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf -U --debug-dump=loc --debug-dump=ranges \
Packit 032894
  testfileloc<<\EOF
Packit 032894
Packit 032894
DWARF section [33] '.debug_loc' at offset 0xd2a:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400480
Packit 032894
 [     0] range 0, d
Packit 032894
           [ 0] reg5
Packit 032894
 [    23] range 5, d
Packit 032894
           [ 0] reg5
Packit 032894
Packit 032894
 CU [    e0] base: 0x00000000004004a0
Packit 032894
 [    46] range 12, 1a
Packit 032894
           [ 0] breg5 0
Packit 032894
Packit 032894
DWARF section [34] '.debug_ranges' at offset 0xd94:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400480
Packit 032894
 [     0] range 0, 2
Packit 032894
          range 5, d
Packit 032894
Packit 032894
 CU [    e0] base: 0x00000000004004a0
Packit 032894
 [    30] range d, f
Packit 032894
          range 12, 1a
Packit 032894
EOF
Packit 032894
Packit 032894
# .debug_rnglists (DWARF5), see tests/testfile-dwarf-45.source
Packit 032894
testfiles testfile-dwarf-5
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc testfile-dwarf-5<<\EOF
Packit 032894
Packit 032894
DWARF section [31] '.debug_loclists' at offset 0x1c0c:
Packit 032894
Table at Offset 0x0:
Packit 032894
Packit 032894
 Length:               96
Packit 032894
 DWARF version:         5
Packit 032894
 Address size:          8
Packit 032894
 Segment size:          0
Packit 032894
 Offset entries:        0
Packit 032894
 CU [     c] base: 0x0000000000400510 <foo>
Packit 032894
Packit 032894
  Offset: c, Index: 0
Packit 032894
    offset_pair 0, a
Packit 032894
      0x0000000000400510 <foo>..
Packit 032894
      0x0000000000400519 <foo+0x9>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair a, 34
Packit 032894
      0x000000000040051a <foo+0xa>..
Packit 032894
      0x0000000000400543 <foo+0x33>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 1a, Index: e
Packit 032894
    offset_pair 1b, 2d
Packit 032894
      0x000000000040052b <foo+0x1b>..
Packit 032894
      0x000000000040053c <foo+0x2c>
Packit 032894
        [ 0] addr 0x601038 <m>
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 28, Index: 1c
Packit 032894
    offset_pair 1b, 21
Packit 032894
      0x000000000040052b <foo+0x1b>..
Packit 032894
      0x0000000000400530 <foo+0x20>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 2e, Index: 22
Packit 032894
    offset_pair 1b, 27
Packit 032894
      0x000000000040052b <foo+0x1b>..
Packit 032894
      0x0000000000400536 <foo+0x26>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair 29, 2d
Packit 032894
      0x0000000000400539 <foo+0x29>..
Packit 032894
      0x000000000040053c <foo+0x2c>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 39, Index: 2d
Packit 032894
    offset_pair 21, 27
Packit 032894
      0x0000000000400531 <foo+0x21>..
Packit 032894
      0x0000000000400536 <foo+0x26>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair 29, 2d
Packit 032894
      0x0000000000400539 <foo+0x29>..
Packit 032894
      0x000000000040053c <foo+0x2c>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 44, Index: 38
Packit 032894
    offset_pair 21, 2d
Packit 032894
      0x0000000000400531 <foo+0x21>..
Packit 032894
      0x000000000040053c <foo+0x2c>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 4a, Index: 3e
Packit 032894
    offset_pair 2d, 33
Packit 032894
      0x000000000040053d <foo+0x2d>..
Packit 032894
      0x0000000000400542 <foo+0x32>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 50, Index: 44
Packit 032894
    offset_pair 40, 4f
Packit 032894
      0x0000000000400550 <baz>..
Packit 032894
      0x000000000040055e <baz+0xe>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair 4f, 51
Packit 032894
      0x000000000040055f <baz+0xf>..
Packit 032894
      0x0000000000400560 <baz+0x10>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 5e, Index: 52
Packit 032894
    offset_pair 40, 50
Packit 032894
      0x0000000000400550 <baz>..
Packit 032894
      0x000000000040055f <baz+0xf>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
Table at Offset 0x64:
Packit 032894
Packit 032894
 Length:              159
Packit 032894
 DWARF version:         5
Packit 032894
 Address size:          8
Packit 032894
 Segment size:          0
Packit 032894
 Offset entries:        0
Packit 032894
 CU [   218] base: 000000000000000000
Packit 032894
Packit 032894
  Offset: 70, Index: 0
Packit 032894
    base_address 0x400410
Packit 032894
      0x0000000000400410 <main>
Packit 032894
    offset_pair 0, 14
Packit 032894
      0x0000000000400410 <main>..
Packit 032894
      0x0000000000400423 <main+0x13>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair 14, 20
Packit 032894
      0x0000000000400424 <main+0x14>..
Packit 032894
      0x000000000040042f <main+0x1f>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 87, Index: 17
Packit 032894
    base_address 0x400410
Packit 032894
      0x0000000000400410 <main>
Packit 032894
    offset_pair 0, 18
Packit 032894
      0x0000000000400410 <main>..
Packit 032894
      0x0000000000400427 <main+0x17>
Packit 032894
        [ 0] reg4
Packit 032894
    offset_pair 18, 20
Packit 032894
      0x0000000000400428 <main+0x18>..
Packit 032894
      0x000000000040042f <main+0x1f>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg4
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 9e, Index: 2e
Packit 032894
    start_length 0x400421, 7
Packit 032894
      0x0000000000400421 <main+0x11>..
Packit 032894
      0x0000000000400427 <main+0x17>
Packit 032894
        [ 0] reg0
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: ab, Index: 3b
Packit 032894
    base_address 0x400570
Packit 032894
      0x0000000000400570 <calc>
Packit 032894
    offset_pair 0, 8
Packit 032894
      0x0000000000400570 <calc>..
Packit 032894
      0x0000000000400577 <calc+0x7>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair 8, 2b
Packit 032894
      0x0000000000400578 <calc+0x8>..
Packit 032894
      0x000000000040059a <calc+0x2a>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: c2, Index: 52
Packit 032894
    start_length 0x400588, b
Packit 032894
      0x0000000000400588 <calc+0x18>..
Packit 032894
      0x0000000000400592 <calc+0x22>
Packit 032894
        [ 0] reg0
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: cf, Index: 5f
Packit 032894
    base_address 0x400588
Packit 032894
      0x0000000000400588 <calc+0x18>
Packit 032894
    offset_pair 0, 2
Packit 032894
      0x0000000000400588 <calc+0x18>..
Packit 032894
      0x0000000000400589 <calc+0x19>
Packit 032894
        [ 0] reg1
Packit 032894
    offset_pair 2, 7
Packit 032894
      0x000000000040058a <calc+0x1a>..
Packit 032894
      0x000000000040058e <calc+0x1e>
Packit 032894
        [ 0] reg5
Packit 032894
    offset_pair 7, b
Packit 032894
      0x000000000040058f <calc+0x1f>..
Packit 032894
      0x0000000000400592 <calc+0x22>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] deref_size 1
Packit 032894
        [ 5] const1u 56
Packit 032894
        [ 7] shl
Packit 032894
        [ 8] const1u 56
Packit 032894
        [10] shra
Packit 032894
        [11] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: f3, Index: 83
Packit 032894
    base_address 0x400588
Packit 032894
      0x0000000000400588 <calc+0x18>
Packit 032894
    offset_pair 0, 2
Packit 032894
      0x0000000000400588 <calc+0x18>..
Packit 032894
      0x0000000000400589 <calc+0x19>
Packit 032894
        [ 0] reg1
Packit 032894
    offset_pair 2, b
Packit 032894
      0x000000000040058a <calc+0x1a>..
Packit 032894
      0x0000000000400592 <calc+0x22>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
EOF
Packit 032894
Packit 032894
# Same as above, but for DWARF4, note completely different encoding, but
Packit 032894
# the information is the same (check with diff -uwb).
Packit 032894
testfiles testfile-dwarf-4
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc testfile-dwarf-4<<\EOF
Packit 032894
Packit 032894
DWARF section [31] '.debug_loc' at offset 0x1c86:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000400510 <foo>
Packit 032894
 [     0] range 0, a
Packit 032894
          0x0000000000400510 <foo>..
Packit 032894
          0x0000000000400519 <foo+0x9>
Packit 032894
           [ 0] reg5
Packit 032894
          range a, 34
Packit 032894
          0x000000000040051a <foo+0xa>..
Packit 032894
          0x0000000000400543 <foo+0x33>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [    39] range 1b, 2d
Packit 032894
          0x000000000040052b <foo+0x1b>..
Packit 032894
          0x000000000040053c <foo+0x2c>
Packit 032894
           [ 0] addr 0x601038 <m>
Packit 032894
 [    64] range 1b, 21
Packit 032894
          0x000000000040052b <foo+0x1b>..
Packit 032894
          0x0000000000400530 <foo+0x20>
Packit 032894
           [ 0] reg5
Packit 032894
 [    87] range 1b, 27
Packit 032894
          0x000000000040052b <foo+0x1b>..
Packit 032894
          0x0000000000400536 <foo+0x26>
Packit 032894
           [ 0] reg5
Packit 032894
          range 29, 2d
Packit 032894
          0x0000000000400539 <foo+0x29>..
Packit 032894
          0x000000000040053c <foo+0x2c>
Packit 032894
           [ 0] reg5
Packit 032894
 [    bd] range 21, 27
Packit 032894
          0x0000000000400531 <foo+0x21>..
Packit 032894
          0x0000000000400536 <foo+0x26>
Packit 032894
           [ 0] reg5
Packit 032894
          range 29, 2d
Packit 032894
          0x0000000000400539 <foo+0x29>..
Packit 032894
          0x000000000040053c <foo+0x2c>
Packit 032894
           [ 0] reg5
Packit 032894
 [    f3] range 21, 2d
Packit 032894
          0x0000000000400531 <foo+0x21>..
Packit 032894
          0x000000000040053c <foo+0x2c>
Packit 032894
           [ 0] reg5
Packit 032894
 [   116] range 2d, 33
Packit 032894
          0x000000000040053d <foo+0x2d>..
Packit 032894
          0x0000000000400542 <foo+0x32>
Packit 032894
           [ 0] reg5
Packit 032894
 [   139] range 40, 4f
Packit 032894
          0x0000000000400550 <baz>..
Packit 032894
          0x000000000040055e <baz+0xe>
Packit 032894
           [ 0] reg5
Packit 032894
          range 4f, 51
Packit 032894
          0x000000000040055f <baz+0xf>..
Packit 032894
          0x0000000000400560 <baz+0x10>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [   172] range 40, 50
Packit 032894
          0x0000000000400550 <baz>..
Packit 032894
          0x000000000040055f <baz+0xf>
Packit 032894
           [ 0] reg5
Packit 032894
Packit 032894
 CU [   21c] base: 000000000000000000
Packit 032894
 [   195] range 400410, 400424
Packit 032894
          0x0000000000400410 <main>..
Packit 032894
          0x0000000000400423 <main+0x13>
Packit 032894
           [ 0] reg5
Packit 032894
          range 400424, 400430
Packit 032894
          0x0000000000400424 <main+0x14>..
Packit 032894
          0x000000000040042f <main+0x1f>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [   1ce] range 400410, 400428
Packit 032894
          0x0000000000400410 <main>..
Packit 032894
          0x0000000000400427 <main+0x17>
Packit 032894
           [ 0] reg4
Packit 032894
          range 400428, 400430
Packit 032894
          0x0000000000400428 <main+0x18>..
Packit 032894
          0x000000000040042f <main+0x1f>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg4
Packit 032894
           [ 3] stack_value
Packit 032894
 [   207] range 400421, 400428
Packit 032894
          0x0000000000400421 <main+0x11>..
Packit 032894
          0x0000000000400427 <main+0x17>
Packit 032894
           [ 0] reg0
Packit 032894
 [   22a] range 400570, 400578
Packit 032894
          0x0000000000400570 <calc>..
Packit 032894
          0x0000000000400577 <calc+0x7>
Packit 032894
           [ 0] reg5
Packit 032894
          range 400578, 40059b
Packit 032894
          0x0000000000400578 <calc+0x8>..
Packit 032894
          0x000000000040059a <calc+0x2a>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [   263] range 400588, 400593
Packit 032894
          0x0000000000400588 <calc+0x18>..
Packit 032894
          0x0000000000400592 <calc+0x22>
Packit 032894
           [ 0] reg0
Packit 032894
 [   286] range 400588, 40058a
Packit 032894
          0x0000000000400588 <calc+0x18>..
Packit 032894
          0x0000000000400589 <calc+0x19>
Packit 032894
           [ 0] reg1
Packit 032894
          range 40058a, 40058f
Packit 032894
          0x000000000040058a <calc+0x1a>..
Packit 032894
          0x000000000040058e <calc+0x1e>
Packit 032894
           [ 0] reg5
Packit 032894
          range 40058f, 400593
Packit 032894
          0x000000000040058f <calc+0x1f>..
Packit 032894
          0x0000000000400592 <calc+0x22>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] deref_size 1
Packit 032894
           [ 5] const1u 56
Packit 032894
           [ 7] shl
Packit 032894
           [ 8] const1u 56
Packit 032894
           [10] shra
Packit 032894
           [11] stack_value
Packit 032894
 [   2da] range 400588, 40058a
Packit 032894
          0x0000000000400588 <calc+0x18>..
Packit 032894
          0x0000000000400589 <calc+0x19>
Packit 032894
           [ 0] reg1
Packit 032894
          range 40058a, 400593
Packit 032894
          0x000000000040058a <calc+0x1a>..
Packit 032894
          0x0000000000400592 <calc+0x22>
Packit 032894
           [ 0] reg5
Packit 032894
EOF
Packit 032894
Packit 032894
# Split DWARF5 variant. Note that the .debug_loclists moved to the .dwo file
Packit 032894
# and now uses an index and addrx indirections.
Packit 032894
testfiles testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc --dwarf-skeleton=testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo <<\EOF
Packit 032894
Packit 032894
testfile-hello5.dwo:
Packit 032894
Packit 032894
Packit 032894
DWARF section [ 3] '.debug_loclists.dwo' at offset 0x236:
Packit 032894
Table at Offset 0x0:
Packit 032894
Packit 032894
 Length:              125
Packit 032894
 DWARF version:         5
Packit 032894
 Address size:          8
Packit 032894
 Segment size:          0
Packit 032894
 Offset entries:        9
Packit 032894
 CU [    14] base: 0x0000000000401160 <foo>
Packit 032894
Packit 032894
  Offsets starting at 0xc:
Packit 032894
   [     0] 0x24
Packit 032894
   [     1] 0x32
Packit 032894
   [     2] 0x39
Packit 032894
   [     3] 0x3f
Packit 032894
   [     4] 0x4a
Packit 032894
   [     5] 0x55
Packit 032894
   [     6] 0x5b
Packit 032894
   [     7] 0x61
Packit 032894
   [     8] 0x6f
Packit 032894
Packit 032894
  Offset: 30, Index: 24
Packit 032894
    startx_length f, a
Packit 032894
      0x0000000000401160 <foo>..
Packit 032894
      0x0000000000401169 <foo+0x9>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length 0, 2a
Packit 032894
      0x000000000040116a <foo+0xa>..
Packit 032894
      0x0000000000401193 <foo+0x33>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 3e, Index: 32
Packit 032894
    startx_length 11, 12
Packit 032894
      0x000000000040117b <foo+0x1b>..
Packit 032894
      0x000000000040118c <foo+0x2c>
Packit 032894
        [ 0] addrx [18] 0x404038 <m>
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 45, Index: 39
Packit 032894
    startx_length 11, 6
Packit 032894
      0x000000000040117b <foo+0x1b>..
Packit 032894
      0x0000000000401180 <foo+0x20>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 4b, Index: 3f
Packit 032894
    startx_length 11, c
Packit 032894
      0x000000000040117b <foo+0x1b>..
Packit 032894
      0x0000000000401186 <foo+0x26>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length 1, 4
Packit 032894
      0x0000000000401189 <foo+0x29>..
Packit 032894
      0x000000000040118c <foo+0x2c>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 56, Index: 4a
Packit 032894
    startx_length 4, 6
Packit 032894
      0x0000000000401181 <foo+0x21>..
Packit 032894
      0x0000000000401186 <foo+0x26>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length 1, 4
Packit 032894
      0x0000000000401189 <foo+0x29>..
Packit 032894
      0x000000000040118c <foo+0x2c>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 61, Index: 55
Packit 032894
    startx_length 4, c
Packit 032894
      0x0000000000401181 <foo+0x21>..
Packit 032894
      0x000000000040118c <foo+0x2c>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 67, Index: 5b
Packit 032894
    startx_length 2, 6
Packit 032894
      0x000000000040118d <foo+0x2d>..
Packit 032894
      0x0000000000401192 <foo+0x32>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 6d, Index: 61
Packit 032894
    startx_length 9, f
Packit 032894
      0x00000000004011a0 <baz>..
Packit 032894
      0x00000000004011ae <baz+0xe>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length 5, 2
Packit 032894
      0x00000000004011af <baz+0xf>..
Packit 032894
      0x00000000004011b0 <baz+0x10>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 7b, Index: 6f
Packit 032894
    startx_length 9, 10
Packit 032894
      0x00000000004011a0 <baz>..
Packit 032894
      0x00000000004011af <baz+0xf>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
Packit 032894
testfile-world5.dwo:
Packit 032894
Packit 032894
Packit 032894
DWARF section [ 3] '.debug_loclists.dwo' at offset 0x217:
Packit 032894
Table at Offset 0x0:
Packit 032894
Packit 032894
 Length:              128
Packit 032894
 DWARF version:         5
Packit 032894
 Address size:          8
Packit 032894
 Segment size:          0
Packit 032894
 Offset entries:        7
Packit 032894
 CU [    14] base: 000000000000000000
Packit 032894
Packit 032894
  Offsets starting at 0xc:
Packit 032894
   [     0] 0x1c
Packit 032894
   [     1] 0x2a
Packit 032894
   [     2] 0x38
Packit 032894
   [     3] 0x3e
Packit 032894
   [     4] 0x4c
Packit 032894
   [     5] 0x52
Packit 032894
   [     6] 0x6d
Packit 032894
Packit 032894
  Offset: 28, Index: 1c
Packit 032894
    startx_length 2, 14
Packit 032894
      0x0000000000401060 <main>..
Packit 032894
      0x0000000000401073 <main+0x13>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length 4, c
Packit 032894
      0x0000000000401074 <main+0x14>..
Packit 032894
      0x000000000040107f <main+0x1f>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 36, Index: 2a
Packit 032894
    startx_length 2, 18
Packit 032894
      0x0000000000401060 <main>..
Packit 032894
      0x0000000000401077 <main+0x17>
Packit 032894
        [ 0] reg4
Packit 032894
    startx_length 7, 6
Packit 032894
      0x0000000000401078 <main+0x18>..
Packit 032894
      0x000000000040107d <main+0x1d>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg4
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 44, Index: 38
Packit 032894
    startx_length 3, 7
Packit 032894
      0x0000000000401071 <main+0x11>..
Packit 032894
      0x0000000000401077 <main+0x17>
Packit 032894
        [ 0] reg0
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 4a, Index: 3e
Packit 032894
    startx_length d, 8
Packit 032894
      0x00000000004011c0 <calc>..
Packit 032894
      0x00000000004011c7 <calc+0x7>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length e, 23
Packit 032894
      0x00000000004011c8 <calc+0x8>..
Packit 032894
      0x00000000004011ea <calc+0x2a>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 58, Index: 4c
Packit 032894
    startx_length f, b
Packit 032894
      0x00000000004011d8 <calc+0x18>..
Packit 032894
      0x00000000004011e2 <calc+0x22>
Packit 032894
        [ 0] reg0
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 5e, Index: 52
Packit 032894
    startx_length f, 2
Packit 032894
      0x00000000004011d8 <calc+0x18>..
Packit 032894
      0x00000000004011d9 <calc+0x19>
Packit 032894
        [ 0] reg1
Packit 032894
    startx_length 10, 5
Packit 032894
      0x00000000004011da <calc+0x1a>..
Packit 032894
      0x00000000004011de <calc+0x1e>
Packit 032894
        [ 0] reg5
Packit 032894
    startx_length 0, 4
Packit 032894
      0x00000000004011df <calc+0x1f>..
Packit 032894
      0x00000000004011e2 <calc+0x22>
Packit 032894
        [ 0] entry_value:
Packit 032894
             [ 0] reg5
Packit 032894
        [ 3] deref_size 1
Packit 032894
        [ 5] const1u 56
Packit 032894
        [ 7] shl
Packit 032894
        [ 8] const1u 56
Packit 032894
        [10] shra
Packit 032894
        [11] stack_value
Packit 032894
    end_of_list
Packit 032894
Packit 032894
  Offset: 79, Index: 6d
Packit 032894
    startx_length f, 2
Packit 032894
      0x00000000004011d8 <calc+0x18>..
Packit 032894
      0x00000000004011d9 <calc+0x19>
Packit 032894
        [ 0] reg1
Packit 032894
    startx_length 10, 9
Packit 032894
      0x00000000004011da <calc+0x1a>..
Packit 032894
      0x00000000004011e2 <calc+0x22>
Packit 032894
        [ 0] reg5
Packit 032894
    end_of_list
Packit 032894
Packit 032894
EOF
Packit 032894
Packit 032894
# GNU DebugFission split-dwarf variant. Still uses .debug_loc, but now in
Packit 032894
# .dwo file, with somewhat similar, but different encoding from DWARF5.
Packit 032894
testfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=loc --dwarf-skeleton=testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo <<\EOF
Packit 032894
Packit 032894
testfile-hello4.dwo:
Packit 032894
Packit 032894
Packit 032894
DWARF section [ 3] '.debug_loc.dwo' at offset 0x253:
Packit 032894
Packit 032894
 CU [     b] base: 0x0000000000401160 <foo>
Packit 032894
 [     0] range 401160, 40116a
Packit 032894
          0x0000000000401160 <foo>..
Packit 032894
          0x0000000000401169 <foo+0x9>
Packit 032894
           [ 0] reg5
Packit 032894
          range 40116a, 401194
Packit 032894
          0x000000000040116a <foo+0xa>..
Packit 032894
          0x0000000000401193 <foo+0x33>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [    16] range 40117b, 40118d
Packit 032894
          0x000000000040117b <foo+0x1b>..
Packit 032894
          0x000000000040118c <foo+0x2c>
Packit 032894
           [ 0] GNU_addr_index [18] 0x404038 <m>
Packit 032894
 [    21] range 40117b, 401181
Packit 032894
          0x000000000040117b <foo+0x1b>..
Packit 032894
          0x0000000000401180 <foo+0x20>
Packit 032894
           [ 0] reg5
Packit 032894
 [    2b] range 40117b, 401187
Packit 032894
          0x000000000040117b <foo+0x1b>..
Packit 032894
          0x0000000000401186 <foo+0x26>
Packit 032894
           [ 0] reg5
Packit 032894
          range 401189, 40118d
Packit 032894
          0x0000000000401189 <foo+0x29>..
Packit 032894
          0x000000000040118c <foo+0x2c>
Packit 032894
           [ 0] reg5
Packit 032894
 [    3e] range 401181, 401187
Packit 032894
          0x0000000000401181 <foo+0x21>..
Packit 032894
          0x0000000000401186 <foo+0x26>
Packit 032894
           [ 0] reg5
Packit 032894
          range 401189, 40118d
Packit 032894
          0x0000000000401189 <foo+0x29>..
Packit 032894
          0x000000000040118c <foo+0x2c>
Packit 032894
           [ 0] reg5
Packit 032894
 [    51] range 401181, 40118d
Packit 032894
          0x0000000000401181 <foo+0x21>..
Packit 032894
          0x000000000040118c <foo+0x2c>
Packit 032894
           [ 0] reg5
Packit 032894
 [    5b] range 40118d, 401193
Packit 032894
          0x000000000040118d <foo+0x2d>..
Packit 032894
          0x0000000000401192 <foo+0x32>
Packit 032894
           [ 0] reg5
Packit 032894
 [    65] range 4011a0, 4011af
Packit 032894
          0x00000000004011a0 <baz>..
Packit 032894
          0x00000000004011ae <baz+0xe>
Packit 032894
           [ 0] reg5
Packit 032894
          range 4011af, 4011b1
Packit 032894
          0x00000000004011af <baz+0xf>..
Packit 032894
          0x00000000004011b0 <baz+0x10>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [    7b] range 4011a0, 4011b0
Packit 032894
          0x00000000004011a0 <baz>..
Packit 032894
          0x00000000004011af <baz+0xf>
Packit 032894
           [ 0] reg5
Packit 032894
Packit 032894
testfile-world4.dwo:
Packit 032894
Packit 032894
Packit 032894
DWARF section [ 3] '.debug_loc.dwo' at offset 0x225:
Packit 032894
Packit 032894
 CU [     b] base: 000000000000000000
Packit 032894
 [     0] range 401060, 401074
Packit 032894
          0x0000000000401060 <main>..
Packit 032894
          0x0000000000401073 <main+0x13>
Packit 032894
           [ 0] reg5
Packit 032894
          range 401074, 401080
Packit 032894
          0x0000000000401074 <main+0x14>..
Packit 032894
          0x000000000040107f <main+0x1f>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [    16] range 401060, 401078
Packit 032894
          0x0000000000401060 <main>..
Packit 032894
          0x0000000000401077 <main+0x17>
Packit 032894
           [ 0] reg4
Packit 032894
          range 401078, 40107e
Packit 032894
          0x0000000000401078 <main+0x18>..
Packit 032894
          0x000000000040107d <main+0x1d>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg4
Packit 032894
           [ 3] stack_value
Packit 032894
 [    2c] range 401071, 401078
Packit 032894
          0x0000000000401071 <main+0x11>..
Packit 032894
          0x0000000000401077 <main+0x17>
Packit 032894
           [ 0] reg0
Packit 032894
 [    36] range 4011c0, 4011c8
Packit 032894
          0x00000000004011c0 <calc>..
Packit 032894
          0x00000000004011c7 <calc+0x7>
Packit 032894
           [ 0] reg5
Packit 032894
          range 4011c8, 4011eb
Packit 032894
          0x00000000004011c8 <calc+0x8>..
Packit 032894
          0x00000000004011ea <calc+0x2a>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
 [    4c] range 4011d8, 4011e3
Packit 032894
          0x00000000004011d8 <calc+0x18>..
Packit 032894
          0x00000000004011e2 <calc+0x22>
Packit 032894
           [ 0] reg0
Packit 032894
 [    56] range 4011d8, 4011da
Packit 032894
          0x00000000004011d8 <calc+0x18>..
Packit 032894
          0x00000000004011d9 <calc+0x19>
Packit 032894
           [ 0] reg1
Packit 032894
          range 4011da, 4011df
Packit 032894
          0x00000000004011da <calc+0x1a>..
Packit 032894
          0x00000000004011de <calc+0x1e>
Packit 032894
           [ 0] reg5
Packit 032894
          range 4011df, 4011e3
Packit 032894
          0x00000000004011df <calc+0x1f>..
Packit 032894
          0x00000000004011e2 <calc+0x22>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] deref_size 1
Packit 032894
           [ 5] const1u 56
Packit 032894
           [ 7] shl
Packit 032894
           [ 8] const1u 56
Packit 032894
           [10] shra
Packit 032894
           [11] stack_value
Packit 032894
 [    7d] range 4011d8, 4011da
Packit 032894
          0x00000000004011d8 <calc+0x18>..
Packit 032894
          0x00000000004011d9 <calc+0x19>
Packit 032894
           [ 0] reg1
Packit 032894
          range 4011da, 4011e3
Packit 032894
          0x00000000004011da <calc+0x1a>..
Packit 032894
          0x00000000004011e2 <calc+0x22>
Packit 032894
           [ 0] reg5
Packit 032894
EOF
Packit 032894
Packit 032894
# Partial dwarf-4 and partial GNU DebugFission split-dwarf.
Packit 032894
#
Packit 032894
# = popcount.c =
Packit 032894
#
Packit 032894
# int popcount (unsigned char u)
Packit 032894
# {
Packit 032894
#   int c = 0;
Packit 032894
#   while (u != 0)
Packit 032894
#     {
Packit 032894
#       if ((u & 1) == 1)
Packit 032894
#         c++;
Packit 032894
#       u >>= 1;
Packit 032894
#     }
Packit 032894
#   return c;
Packit 032894
# }
Packit 032894
#
Packit 032894
# = splitdwarf4-not-split4.c =
Packit 032894
#
Packit 032894
# extern int popcount (unsigned char);
Packit 032894
#
Packit 032894
# int main (int argc, char **argv)
Packit 032894
# {
Packit 032894
#   int i;
Packit 032894
#   int p = argc;
Packit 032894
#   for (i = 0; i < argc;  ++i)
Packit 032894
#     p += popcount (argv[i][0]);
Packit 032894
#   i += p;
Packit 032894
#   return i;
Packit 032894
# }
Packit 032894
#
Packit 032894
# gcc -gdwarf-4 -O2 -c popcount.c
Packit 032894
# gcc -gdwarf-4 -gsplit-dwarf -O2 -c splitdwarf4-not-split4.c
Packit 032894
# gcc -o testfile-splitdwarf4-not-split4 splitdwarf4-not-split4.o popcount.o
Packit 032894
# eu-strip -f testfile-splitdwarf4-not-split4.debug \
Packit 032894
#   testfile-splitdwarf4-not-split4
Packit 032894
Packit 032894
testfiles testfile-splitdwarf4-not-split4.debug
Packit 032894
testfiles splitdwarf4-not-split4.dwo
Packit 032894
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --debug-dump=info+ --debug-dump=loc testfile-splitdwarf4-not-split4.debug <<\EOF
Packit 032894
Packit 032894
DWARF section [28] '.debug_info' at offset 0x330:
Packit 032894
 [Offset]
Packit 032894
 Compilation unit at offset 0:
Packit 032894
 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
Packit 032894
 Unit type: skeleton (4), Unit id: 0x3d909d7bd0e69c0b
Packit 032894
 [     b]  compile_unit         abbrev: 1
Packit 032894
           ranges               (sec_offset) range list [     0]
Packit 032894
           low_pc               (addr) 000000000000000000
Packit 032894
           stmt_list            (sec_offset) 0
Packit 032894
           GNU_dwo_name         (strp) "splitdwarf4-not-split4.dwo"
Packit 032894
           comp_dir             (strp) "/tmp"
Packit 032894
           GNU_pubnames         (flag_present) yes
Packit 032894
           GNU_addr_base        (sec_offset) address base [     0]
Packit 032894
           GNU_dwo_id           (data8) 0x3d909d7bd0e69c0b
Packit 032894
           GNU_ranges_base      (sec_offset) 0
Packit 032894
 Split compilation unit at offset 0:
Packit 032894
 Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
Packit 032894
 Unit type: skeleton (4), Unit id: 0x3d909d7bd0e69c0b
Packit 032894
 {     b}  compile_unit         abbrev: 1
Packit 032894
           producer             (GNU_str_index) "GNU C17 9.0.0 20180528 (experimental) -mtune=generic -march=x86-64 -gdwarf-4 -gsplit-dwarf -O2"
Packit 032894
           language             (data1) C99 (12)
Packit 032894
           name                 (GNU_str_index) "splitdwarf4-not-split4.c"
Packit 032894
           comp_dir             (GNU_str_index) "/tmp"
Packit 032894
           GNU_dwo_id           (data8) 0x3d909d7bd0e69c0b
Packit 032894
 {    18}    subprogram           abbrev: 2
Packit 032894
             external             (flag_present) yes
Packit 032894
             name                 (GNU_str_index) "main"
Packit 032894
             decl_file            (data1) splitdwarf4-not-split4.c (1)
Packit 032894
             decl_line            (data1) 3
Packit 032894
             decl_column          (data1) 5
Packit 032894
             prototyped           (flag_present) yes
Packit 032894
             type                 (ref4) {    6d}
Packit 032894
             low_pc               (GNU_addr_index) [4] 0x0000000000401050 <main>
Packit 032894
             high_pc              (data8) 76 (0x000000000040109c <_start>)
Packit 032894
             frame_base           (exprloc) 
Packit 032894
              [ 0] call_frame_cfa
Packit 032894
             GNU_all_call_sites   (flag_present) yes
Packit 032894
             sibling              (ref4) {    6d}
Packit 032894
 {    30}      formal_parameter     abbrev: 3
Packit 032894
               name                 (GNU_str_index) "argc"
Packit 032894
               decl_file            (data1) splitdwarf4-not-split4.c (1)
Packit 032894
               decl_line            (data1) 3
Packit 032894
               decl_column          (data1) 15
Packit 032894
               type                 (ref4) {    6d}
Packit 032894
               location             (sec_offset) location list [     0]
Packit 032894
 {    3d}      formal_parameter     abbrev: 3
Packit 032894
               name                 (GNU_str_index) "argv"
Packit 032894
               decl_file            (data1) splitdwarf4-not-split4.c (1)
Packit 032894
               decl_line            (data1) 3
Packit 032894
               decl_column          (data1) 28
Packit 032894
               type                 (ref4) {    74}
Packit 032894
               location             (sec_offset) location list [    28]
Packit 032894
 {    4a}      variable             abbrev: 4
Packit 032894
               name                 (string) "i"
Packit 032894
               decl_file            (data1) splitdwarf4-not-split4.c (1)
Packit 032894
               decl_line            (data1) 5
Packit 032894
               decl_column          (data1) 7
Packit 032894
               type                 (ref4) {    6d}
Packit 032894
               location             (sec_offset) location list [    47]
Packit 032894
 {    58}      variable             abbrev: 4
Packit 032894
               name                 (string) "p"
Packit 032894
               decl_file            (data1) splitdwarf4-not-split4.c (1)
Packit 032894
               decl_line            (data1) 6
Packit 032894
               decl_column          (data1) 7
Packit 032894
               type                 (ref4) {    6d}
Packit 032894
               location             (sec_offset) location list [    73]
Packit 032894
 {    66}      GNU_call_site        abbrev: 5
Packit 032894
               low_pc               (GNU_addr_index) [1] 0x000000000040107f <main+0x2f>
Packit 032894
               abstract_origin      (ref4) {    84}
Packit 032894
 {    6d}    base_type            abbrev: 6
Packit 032894
             byte_size            (data1) 4
Packit 032894
             encoding             (data1) signed (5)
Packit 032894
             name                 (string) "int"
Packit 032894
 {    74}    pointer_type         abbrev: 7
Packit 032894
             byte_size            (data1) 8
Packit 032894
             type                 (ref4) {    7a}
Packit 032894
 {    7a}    pointer_type         abbrev: 7
Packit 032894
             byte_size            (data1) 8
Packit 032894
             type                 (ref4) {    80}
Packit 032894
 {    80}    base_type            abbrev: 8
Packit 032894
             byte_size            (data1) 1
Packit 032894
             encoding             (data1) signed_char (6)
Packit 032894
             name                 (GNU_str_index) "char"
Packit 032894
 {    84}    subprogram           abbrev: 9
Packit 032894
             external             (flag_present) yes
Packit 032894
             declaration          (flag_present) yes
Packit 032894
             linkage_name         (GNU_str_index) "popcount"
Packit 032894
             name                 (GNU_str_index) "popcount"
Packit 032894
             decl_file            (data1) splitdwarf4-not-split4.c (1)
Packit 032894
             decl_line            (data1) 1
Packit 032894
             decl_column          (data1) 12
Packit 032894
 Compilation unit at offset 52:
Packit 032894
 Version: 4, Abbreviation section offset: 29, Address size: 8, Offset size: 4
Packit 032894
 [    3f]  compile_unit         abbrev: 1
Packit 032894
           producer             (strp) "GNU C17 9.0.0 20180528 (experimental) -mtune=generic -march=x86-64 -gdwarf-4 -O2"
Packit 032894
           language             (data1) C99 (12)
Packit 032894
           name                 (strp) "popcount.c"
Packit 032894
           comp_dir             (strp) "/tmp"
Packit 032894
           low_pc               (addr) 0x0000000000401180 <popcount>
Packit 032894
           high_pc              (data8) 33 (0x00000000004011a1)
Packit 032894
           stmt_list            (sec_offset) 145
Packit 032894
 [    61]    subprogram           abbrev: 2
Packit 032894
             external             (flag_present) yes
Packit 032894
             name                 (strp) "popcount"
Packit 032894
             decl_file            (data1) popcount.c (1)
Packit 032894
             decl_line            (data1) 1
Packit 032894
             decl_column          (data1) 5
Packit 032894
             prototyped           (flag_present) yes
Packit 032894
             type                 (ref4) [    a0]
Packit 032894
             low_pc               (addr) 0x0000000000401180 <popcount>
Packit 032894
             high_pc              (data8) 33 (0x00000000004011a1)
Packit 032894
             frame_base           (exprloc) 
Packit 032894
              [ 0] call_frame_cfa
Packit 032894
             GNU_all_call_sites   (flag_present) yes
Packit 032894
             sibling              (ref4) [    a0]
Packit 032894
 [    83]      formal_parameter     abbrev: 3
Packit 032894
               name                 (string) "u"
Packit 032894
               decl_file            (data1) popcount.c (1)
Packit 032894
               decl_line            (data1) 1
Packit 032894
               decl_column          (data1) 29
Packit 032894
               type                 (ref4) [    a7]
Packit 032894
               location             (sec_offset) location list [     0]
Packit 032894
 [    91]      variable             abbrev: 4
Packit 032894
               name                 (string) "c"
Packit 032894
               decl_file            (data1) popcount.c (1)
Packit 032894
               decl_line            (data1) 3
Packit 032894
               decl_column          (data1) 7
Packit 032894
               type                 (ref4) [    a0]
Packit 032894
               location             (sec_offset) location list [    60]
Packit 032894
 [    a0]    base_type            abbrev: 5
Packit 032894
             byte_size            (data1) 4
Packit 032894
             encoding             (data1) signed (5)
Packit 032894
             name                 (string) "int"
Packit 032894
 [    a7]    base_type            abbrev: 6
Packit 032894
             byte_size            (data1) 1
Packit 032894
             encoding             (data1) unsigned_char (8)
Packit 032894
             name                 (strp) "unsigned char"
Packit 032894
Packit 032894
DWARF section [32] '.debug_loc' at offset 0x5ef:
Packit 032894
Packit 032894
 CU [    3f] base: 0x0000000000401180 <popcount>
Packit 032894
 [     0] range 0, 9
Packit 032894
          0x0000000000401180 <popcount>..
Packit 032894
          0x0000000000401188 <popcount+0x8>
Packit 032894
           [ 0] reg5
Packit 032894
          range 9, 1b
Packit 032894
          0x0000000000401189 <popcount+0x9>..
Packit 032894
          0x000000000040119a <popcount+0x1a>
Packit 032894
           [ 0] reg1
Packit 032894
          range 1b, 1d
Packit 032894
          0x000000000040119b <popcount+0x1b>..
Packit 032894
          0x000000000040119c <popcount+0x1c>
Packit 032894
           [ 0] breg1 0
Packit 032894
           [ 2] lit1
Packit 032894
           [ 3] shr
Packit 032894
           [ 4] stack_value
Packit 032894
          range 1d, 21
Packit 032894
          0x000000000040119d <popcount+0x1d>..
Packit 032894
          0x00000000004011a0 <popcount+0x20>
Packit 032894
           [ 0] reg1
Packit 032894
 [    60] range 0, 9
Packit 032894
          0x0000000000401180 <popcount>..
Packit 032894
          0x0000000000401188 <popcount+0x8>
Packit 032894
           [ 0] lit0
Packit 032894
           [ 1] stack_value
Packit 032894
          range 9, 20
Packit 032894
          0x0000000000401189 <popcount+0x9>..
Packit 032894
          0x000000000040119f <popcount+0x1f>
Packit 032894
           [ 0] reg0
Packit 032894
          range 20, 21
Packit 032894
          0x00000000004011a0 <popcount+0x20>..
Packit 032894
          0x00000000004011a0 <popcount+0x20>
Packit 032894
           [ 0] lit0
Packit 032894
           [ 1] stack_value
Packit 032894
EOF
Packit 032894
Packit 032894
testrun_compare ${abs_top_builddir}/src/readelf --dwarf-skeleton=testfile-splitdwarf4-not-split4.debug --debug-dump=loc splitdwarf4-not-split4.dwo <<\EOF
Packit 032894
Packit 032894
DWARF section [ 3] '.debug_loc.dwo' at offset 0x15b:
Packit 032894
Packit 032894
 CU [     b] base: 000000000000000000
Packit 032894
 [     0] range 401050, 40106e
Packit 032894
          0x0000000000401050 <main>..
Packit 032894
          0x000000000040106d <main+0x1d>
Packit 032894
           [ 0] reg5
Packit 032894
          range 40106e, 401086
Packit 032894
          0x000000000040106e <main+0x1e>..
Packit 032894
          0x0000000000401085 <main+0x35>
Packit 032894
           [ 0] reg12
Packit 032894
          range 401086, 401095
Packit 032894
          0x0000000000401086 <main+0x36>..
Packit 032894
          0x0000000000401094 <main+0x44>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg5
Packit 032894
           [ 3] stack_value
Packit 032894
          range 401095, 40109c
Packit 032894
          0x0000000000401095 <main+0x45>..
Packit 032894
          0x000000000040109b <main+0x4b>
Packit 032894
           [ 0] reg5
Packit 032894
 [    28] range 401050, 40106e
Packit 032894
          0x0000000000401050 <main>..
Packit 032894
          0x000000000040106d <main+0x1d>
Packit 032894
           [ 0] reg4
Packit 032894
          range 40106e, 401095
Packit 032894
          0x000000000040106e <main+0x1e>..
Packit 032894
          0x0000000000401094 <main+0x44>
Packit 032894
           [ 0] GNU_entry_value:
Packit 032894
                [ 0] reg4
Packit 032894
           [ 3] stack_value
Packit 032894
          range 401095, 40109c
Packit 032894
          0x0000000000401095 <main+0x45>..
Packit 032894
          0x000000000040109b <main+0x4b>
Packit 032894
           [ 0] reg4
Packit 032894
 [    47] range 401050, 40106e
Packit 032894
          0x0000000000401050 <main>..
Packit 032894
          0x000000000040106d <main+0x1d>
Packit 032894
           [ 0] lit0
Packit 032894
           [ 1] stack_value
Packit 032894
          range 401086, 40108e
Packit 032894
          0x0000000000401086 <main+0x36>..
Packit 032894
          0x000000000040108d <main+0x3d>
Packit 032894
           [ 0] breg12 0
Packit 032894
           [ 2] breg6 0
Packit 032894
           [ 4] plus
Packit 032894
           [ 5] stack_value
Packit 032894
          range 40108e, 401095
Packit 032894
          0x000000000040108e <main+0x3e>..
Packit 032894
          0x0000000000401094 <main+0x44>
Packit 032894
           [ 0] reg0
Packit 032894
          range 401095, 40109c
Packit 032894
          0x0000000000401095 <main+0x45>..
Packit 032894
          0x000000000040109b <main+0x4b>
Packit 032894
           [ 0] lit0
Packit 032894
           [ 1] stack_value
Packit 032894
 [    73] range 401050, 40106e
Packit 032894
          0x0000000000401050 <main>..
Packit 032894
          0x000000000040106d <main+0x1d>
Packit 032894
           [ 0] reg5
Packit 032894
          range 40106e, 401090
Packit 032894
          0x000000000040106e <main+0x1e>..
Packit 032894
          0x000000000040108f <main+0x3f>
Packit 032894
           [ 0] reg6
Packit 032894
          range 401095, 40109c
Packit 032894
          0x0000000000401095 <main+0x45>..
Packit 032894
          0x000000000040109b <main+0x4b>
Packit 032894
           [ 0] reg5
Packit 032894
EOF
Packit 032894
Packit 032894
exit 0