Project

General

Profile

Bug #10823

should ignore DW_TAG_subprogram with DW_AT_declaration tags

Added by John Levon 8 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2019-04-18
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

http://smartos.org/bugview/OS-7733

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.

History

#1

Updated by Electric Monk 7 months ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit 6ef284f1d464c08bc420048a0b211080cb9fe009

commit  6ef284f1d464c08bc420048a0b211080cb9fe009
Author: John Levon <john.levon@joyent.com>
Date:   2019-05-03T09:15:58.000Z

    10823 should ignore DW_TAG_subprogram with DW_AT_declaration tags
    10824 GCC7-derived CTF can double qualifiers on arrays
    10825 ctfdump -c drops last type
    10826 ctfdump -c goes off the rails with a missing parent
    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: Gordon Ross <gwr@nexenta.com>

Also available in: Atom PDF