OS-7279: DWARF->CTF enum conversion needs to be careful of sign

Details

Issue Type:Bug
Priority:4 - Normal
Status:Resolved
Created at:2018-10-03T11:33:42.662Z
Updated at:2018-10-23T09:00:38.511Z

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: 2018-10-23T09:00:38.495Z)

Fix Versions

2018-10-25 Dot Com (Release Date: 2018-10-25)

Description

Previously, our enumeration conversion simply used ctf_dwarf_signed(DW_AT_const_value. However, with newer GCC versions, this will produce - for example - -32768 when the real enum value is 32768.

Instead, we should check ctf_dwarf_unsigned() first - this fails for negative-valued enums, so we will end up with the right value whether it's positive or negative.

Comments

Comment by Former user
Created at 2018-10-03T13:51:55.185Z

For the old tools this is https://www.illumos.org/issues/9864


Comment by Former user
Created at 2018-10-04T11:50:08.726Z

I tested this with both gcc4 and gcc7, and verified that the same enum CTF is generated on both now.


Comment by Jira Bot
Created at 2018-10-12T13:42:54.099Z

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

OS-7270 ctfconvert doesn't handle DW_AT_specification
OS-7275 ctfdump could generate C-style output
OS-7279 DWARF->CTF enum conversion needs to be careful of sign
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>


Comment by Former user
Created at 2018-10-12T17:36:27.230Z

backed out


Comment by Jira Bot
Created at 2018-10-22T18:28:49.314Z

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

OS-7270 ctfconvert doesn't handle DW_AT_specification
OS-7275 ctfdump could generate C-style output
OS-7279 DWARF->CTF enum conversion needs to be careful of sign
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>