OS-7733: should ignore DW_TAG_subprogram with DW_AT_declaration tags

Details

Issue Type:Bug
Priority:4 - Normal
Status:Resolved
Created at:2019-04-11T13:31:46.349Z
Updated at:2019-05-03T13:28:44.282Z

People

Created by:Former user
Reported by:Former user
Assigned to:Former user

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2019-04-17T16:00:31.680Z)

Fix Versions

2019-04-25 Queen of Jordan (Release Date: 2019-04-25)

Description

While inspecting CTF diffs for GCC7, I noticed this in dockerexec:

f905ddb5-9113-c52a-d3ce-d0db83321d72:dockerinit $ ctfdump -c ./build/dockerexec  | grep custr_alloc\(
extern void custr_alloc(void);

What's happening here is this DWARF:

 <1><1f12>: Abbrev Number: 80 (DW_TAG_subprogram)
    <1f13>   DW_AT_external    : 1
    <1f14>   DW_AT_declaration : 1
    <1f15>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x600): custr_alloc
    <1f19>   DW_AT_name        : (indirect string, offset: 0x600): custr_alloc
    <1f1d>   DW_AT_decl_file   : 28
    <1f1e>   DW_AT_decl_line   : 35
 <1><1f1f>: Abbrev Number: 80 (DW_TAG_subprogram)

Note the lack of any formal parameter children. GCC4 doesn't generate these. But they don't seem useful at all.

So for dockerexec, we end up generating an argument-less entry. Later, when we see the real custr_alloc(), we do parse it fine, but we end up keeping the wrong version.

The fix is most likely to ignore these DW_AT_declaration entries.

Comments

Comment by Former user
Created at 2019-04-17T00:40:54.709Z

I did a few spot-checks of this problem to verify it didn't occur, alongside the testing of OS-7700


Comment by Jira Bot
Created at 2019-04-17T15:55:48.029Z

illumos-joyent commit adeaa2b6918d69fe48c140f0ca1779a3275f195f (branch master, by John Levon)

OS-7689 ctfdump -c goes off the rails with a missing parent
OS-7694 ctfdump -c drops last type
OS-7700 GCC7-derived CTF can double qualifiers on arrays
OS-7733 should ignore DW_TAG_subprogram with DW_AT_declaration tags
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Jason King <jason.king@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>