Page MenuHomePhabricator

[DebugInfo] Fix the type of the formated variable
ClosedPublic

Authored by mstojanovic on Feb 20 2019, 7:51 AM.

Details

Summary

Change the format type of *Personality and *LSDAAddress to PRIx64 since they are of type uint64_t.
The problem was detected on mips builds, where it was printing junk values and causing test failure.

Diff Detail

Repository
rL LLVM

Event Timeline

mstojanovic created this revision.Feb 20 2019, 7:51 AM

Please add a test.

lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
303 ↗(On Diff #187585)

Well, that looks like an improvement, but if the address is 64-bit, won't this print only the low-order half?

mstojanovic added inline comments.Feb 21 2019, 5:51 AM
lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
303 ↗(On Diff #187585)

This doesn't truncate so it would print the whole address but it's true that if the address can be 64-bit the output should be padded with the appropriate number of zeroes to indicate that.
I didn't change this because I assumed that the previous code was correct in guarantying a 32-bit output. Printing only 32 bits of a 64 bit variable isn't unique to this code and can be seen in other pars of LLVM as well, which leads me to believe that variables being 64-bit doesn't necessarily mean that there is a possibility they could hold a 64-bit value while being printed.
@rafauler Do you know if these addresses could be 64-bit here?

mstojanovic edited the summary of this revision. (Show Details)Feb 21 2019, 5:52 AM

Set the address output to 64-bit and fixed the test.

probinson accepted this revision.Mar 7 2019, 6:20 AM

LGTM. It would be nice if we picked a width to print based on the width we read in, but this is fine.

This revision is now accepted and ready to land.Mar 7 2019, 6:20 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2019, 8:30 AM