Page MenuHomePhabricator

DebugInfo: Make -no-dwarf-ranges-section just emit no address range rather than a bogus/partial one
AbandonedPublic

Authored by dblaikie on Dec 17 2020, 5:25 PM.

Details

Reviewers
ABataev
Summary

First implemented in r328030 / 858a7dd6d70bfed500e0e2a5137f25dd71b90f19 and I
speculated in this review about what exactly we should be doing here - and now
I've come across some changes I'm making that trip over the somewhat arbitrary
behavior we chose here & deciding to revisit it for more correctness/less
arbitrariness.

With that previous commit, we made a single contiguous range (high/low_pc) from
the first and last entry in the range list - that's not correct, especially at
the CU level where this address range might then span multiple sections (maybe
even not sections that would all be unified by the linker, even - if you have
functions in special sections). Instead, just don't emit any addresses (ranges
or low/high) for such an entity.

I made the change for nested constructs (not just the CU) as well, though there
doesn't seem to be test coverage for that - I can add that if folks think it's
worthwhile. (probably should, I'm just being lazy) This could still hit the
multiple different sections issue in cases like -fbasic-block-sections.

Alexey - a question I had on the orginal patch: Any idea what other compilers
have done in this case? Is it the original behavior implemented here (beginning
of the first range to the end of the last, sort of paving over any address
holes).

Diff Detail

Event Timeline

dblaikie created this revision.Dec 17 2020, 5:25 PM
dblaikie requested review of this revision.Dec 17 2020, 5:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2020, 5:25 PM
dblaikie updated this revision to Diff 312673.Dec 17 2020, 7:38 PM

Fix some obvious bug I left in here - and fix up one test case

What I saw with the nvcc that it generated the debug info just like in the tests before. So, I just tried to mimic this behavior, since ptxas is very fragile and can be broken very easily. I would try to test it using ptxas/cuda-gdb to check that it does not break anything.

What I saw with the nvcc that it generated the debug info just like in the tests before. So, I just tried to mimic this behavior, since ptxas is very fragile and can be broken very easily. I would try to test it using ptxas/cuda-gdb to check that it does not break anything.

Oh, huh - interesting. Is it possible for me to reproduce/play around with this behavior in some way? (I've never used nvcc, not sure where to download/install it from, etc)

What I saw with the nvcc that it generated the debug info just like in the tests before. So, I just tried to mimic this behavior, since ptxas is very fragile and can be broken very easily. I would try to test it using ptxas/cuda-gdb to check that it does not break anything.

Oh, huh - interesting. Is it possible for me to reproduce/play around with this behavior in some way? (I've never used nvcc, not sure where to download/install it from, etc)

You need a system with NVidia GPU to test cuda-gdb. I think you can get nvcc here https://developer.nvidia.com/cuda-downloads. I suggest to try some older versions, like 9 or 10, since some of the users can still use it.

dblaikie abandoned this revision.Dec 22 2020, 6:31 PM

What I saw with the nvcc that it generated the debug info just like in the tests before. So, I just tried to mimic this behavior, since ptxas is very fragile and can be broken very easily. I would try to test it using ptxas/cuda-gdb to check that it does not break anything.

Oh, huh - interesting. Is it possible for me to reproduce/play around with this behavior in some way? (I've never used nvcc, not sure where to download/install it from, etc)

You need a system with NVidia GPU to test cuda-gdb. I think you can get nvcc here https://developer.nvidia.com/cuda-downloads. I suggest to try some older versions, like 9 or 10, since some of the users can still use it.

Hmm - that might be beyond me, but if you had a chance to provide some more specific details/a recipe for this, I'd love to poke it further.

For now I think I'll abandon this change - I'd hoped it'd make another change a bit tidier, but it's not a huge deal/just a rather complicated if condition, not worth too much work on this side.