Bug 1343988 - Missed function parameters in the eu-readelf debug info output
Summary: Missed function parameters in the eu-readelf debug info output
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 25
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-08 12:47 UTC by Andrey Ponomarenko
Modified: 2017-12-12 10:40 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Fedora 21, x86_64
Last Closed: 2017-12-12 10:40:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andrey Ponomarenko 2016-06-08 12:47:31 UTC
Description of problem:

eu-readelf --debug-dump=info libdw-0.164.so missed parameter "match_file" of the function "dwarf_getscopevar":

[ 2ef22]    subprogram
             external             (flag_present) Yes
             name                 (strp) "dwarf_getscopevar"
             decl_file            (data1) 1
             decl_line            (data1) 66
             prototyped           (flag_present) Yes
             type                 (ref4) [ 2def1]
             low_pc               (addr) +0x000000000000fedc <dwarf_getscopevar>
             high_pc              (data8) 629 (+0x0000000000010151 <dwarf_linesrc>)
             frame_base           (exprloc) 
              [   0] call_frame_cfa
             GNU_all_call_sites   (flag_present) Yes
             sibling              (ref4) [ 2f2a6]
 [ 2ef43]      formal_parameter
               name                 (strp) "scopes"
               decl_file            (data1) 1
               decl_line            (data1) 66
               type                 (ref4) [ 2ee79]
               location             (sec_offset) location list [ 12cba]
 [ 2ef52]      formal_parameter
               name                 (strp) "nscopes"
               decl_file            (data1) 1
               decl_line            (data1) 66
               type                 (ref4) [ 2def1]
               location             (sec_offset) location list [ 12d2c]
 [ 2ef61]      formal_parameter
               name                 (strp) "name"
               decl_file            (data1) 1
               decl_line            (data1) 67
               type                 (ref4) [ 2def8]
               location             (sec_offset) location list [ 12d78]
 [ 2ef70]      formal_parameter
               name                 (strp) "skip_shadows"
               decl_file            (data1) 1
               decl_line            (data1) 67
               type                 (ref4) [ 2def1]
               location             (sec_offset) location list [ 12dc4]
 [ 2ef7f]      formal_parameter
               name                 (strp) "match_lineno"
               decl_file            (data1) 1
               decl_line            (data1) 68
               type                 (ref4) [ 2def1]
               location             (sec_offset) location list [ 12e4c]
 [ 2ef8e]      formal_parameter
               name                 (strp) "match_linecol"
               decl_file            (data1) 1
               decl_line            (data1) 68
               type                 (ref4) [ 2def1]
               location             (exprloc) 
                [   0] fbreg 0
 [ 2ef9c]      formal_parameter
               name                 (strp) "result"
               decl_file            (data1) 1
               decl_line            (data1) 69
               type                 (ref4) [ 2ee79]
               location             (exprloc) 
                [   0] fbreg 8

The function signature from header:

extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
                              const char *name, int skip_shadows,
                              const char *match_file,
                              int match_lineno, int match_linecol,
                              Dwarf_Die *result);

Version-Release number of selected component (if applicable): eu-readelf from elfutils-0.166


How reproducible: always


Steps to Reproduce:
1. Download elfutils-0.164
2. Configure with CFLAGS="-g -Og" CXXFLAGS="-g -Og"
3. eu-readelf --debug-dump=info libdw-0.164.so > OUT
4. Search for dwarf_getscopevar parameters in the output

Actual results:
Missed match_file parameter in the debug info output

Expected results:
The match_file parameter is present in the debug info output

Additional info: Fedora 21/x86_64 environment.

Thank you.

Comment 1 Mark Wielaard 2016-06-08 13:02:16 UTC
I don't have a F21 environment here, but note that F21 is out of support since last year and contains elfutils 0.163.

I don't see this issue on newer Fedora releases. e.g eu-readelf --debug-dump=info /usr/lib/debug/usr/lib64/libdw.so.debug on from elfutils-debuginfo-0.166-1.fc23.x86_64:

 [ 15eb0]    subprogram
             external             (flag_present) Yes
             name                 (strp) "dwarf_getscopevar"
             decl_file            (data1) 1
             decl_line            (data1) 86
             prototyped           (flag_present) Yes
             type                 (GNU_ref_alt) [    14]
             low_pc               (addr) +0x0000000000011520 <dwarf_getscopevar>
             high_pc              (udata) 925 (+0x00000000000118bd)
             frame_base           (exprloc) 
              [   0] call_frame_cfa
             GNU_all_call_sites   (flag_present) Yes
             sibling              (ref_udata) [ 162b6]
[...]
 [ 15ef6]      formal_parameter
               name                 (strp) "skip_shadows"
               decl_file            (data1) 1
               decl_line            (data1) 87
               type                 (GNU_ref_alt) [    14]
               location             (sec_offset) location list [ 1a4b9]
 [ 15f05]      formal_parameter
               name                 (strp) "match_file"
               decl_file            (data1) 1
               decl_line            (data1) 88
               type                 (GNU_ref_alt) [   4d7]
               location             (sec_offset) location list [ 1a502]
 [ 15f14]      formal_parameter
               name                 (strp) "match_lineno"
               decl_file            (data1) 1
               decl_line            (data1) 88
               type                 (GNU_ref_alt) [    14]
               location             (sec_offset) location list [ 1a562]
 [ 15f23]      formal_parameter
               name                 (strp) "match_linecol"
               decl_file            (data1) 1
               decl_line            (data1) 88
               type                 (GNU_ref_alt) [    14]
               location             (exprloc) 
                [   0] fbreg 0
 [ 15f31]      formal_parameter
               name                 (GNU_strp_alt) "result"
               decl_file            (data1) 1
               decl_line            (data1) 89
               type                 (ref_addr) [  2879]
               location             (exprloc) 
                [   0] fbreg 8

I think this might be an issue with the compiler you are using. eu-readelf --debug-dump=info just shows what the DWARF generator produced as output.

Comment 2 Andrey Ponomarenko 2016-06-08 14:31:14 UTC
It works on the elfutils-0.166 as input. The issue is reproduced on the elfutils-0.164 as input only:

eu-readelf-0.166 --debug-dump=info libdw-0.164.so

Unfortunately, my notebook is not supported by f22 and f23 anymore. I've upgraded elfutils to 0.166 manually, but this didn't solve the issue.

I need to analyze previous releases of the elfutils library using eu-readelf from the latest elfutils. See http://abi-laboratory.pro/tracker/timeline/elfutils/ project. The eu-readelf is used to extract ABI interface structure from all releases of the library including 0.164.

I'll try to upgrade the GCC.

Thank you.

Comment 3 Andrey Ponomarenko 2016-06-08 14:50:01 UTC
The issue persists with GCC 5.1.0. Why GCC doesn't generate debug info for this parameter?

Please try to check for the parameter in the 0.164 version of libdw in your environment: https://fedorahosted.org/releases/e/l/elfutils/0.164/elfutils-0.164.tar.bz2

Thank you.

Comment 4 Mark Wielaard 2016-06-13 12:24:23 UTC
Interesting. You are right. Just building the elfutils-0.164 with a simple configure && make with GNU C99 5.3.1 20160406 (Red Hat 5.3.1-6) does indeed not output DWARF for the match_file formal_parameter in the dwarf_getscopevar function. While it does output all other formal_parameters. I have no idea how that happens. But it is a bug in GCC (the producer), not eu-readelf (the consumer) of the data.

Comment 5 Mark Wielaard 2016-06-13 13:33:37 UTC
Found something interesting. Same compiler building dwarf_getscopevar.c against elfutils git gets you all formal_parameters as expected.

The difference between the 0.164 and current git version is that  the dwarf_getscopevar () function had an inner function that was moved to an static file scoped function in git.

Comment 6 Mark Wielaard 2016-07-05 07:54:48 UTC
This is a GCC DWARF producer bug. In this case one of the DW_TAG_formal_parameters is missing if the function has an inner function.

The issue can be seen by building elfutils-0.164 vs elfutils-0.165 and comparing the debuginfo created for the dwarf_getscopevar function in libdw/dwarf_getscopevar.o

Comment 7 Alexandre Oliva 2016-07-08 23:04:37 UTC
FWIW, it's not exactly missing, it is rather emitted as a regular variable, presumably as a consequence of the transformations that variables used by inner functions undergo in order to make the static chain.

Comment 8 Jan Kurik 2016-07-26 04:22:03 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 9 Andrey Ponomarenko 2017-04-04 05:51:07 UTC
Posted to GCC Bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80300

Comment 10 Fedora End Of Life 2017-11-16 19:50:39 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 11 Fedora End Of Life 2017-12-12 10:40:14 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.