compiler-explorer icon indicating copy to clipboard operation
compiler-explorer copied to clipboard

[REQUEST]: map string constants to source code

Open verhovsky opened this issue 1 year ago • 3 comments

When I put my cursor in "hello world\n" here in this code, it should highlight the string in the source code and vice-versa when I put my cursor in "hello world\n" in the C code it should highlight it in the assembly. Currently, neither works.

Screenshot 2024-09-21 at 14 33 58

This is probably a feature request issue for LLVM

verhovsky avatar Sep 20 '24 04:09 verhovsky

Currently we only highlight using the debug information the compiler gives us; I'm not sure we get info here. Additionally it seems here that even the regular highlighting isn't working at all. Can you share a link with us?

mattgodbolt avatar Sep 21 '24 20:09 mattgodbolt

I had rainbow lines disabled. I updated the screenshot to the default configuration.

verhovsky avatar Sep 21 '24 20:09 verhovsky

Data generally doesn't have any reference to code, this is because it's stored separately and can be reused by other pieces of code. We could infer it by the use of the labels in other parts of the assembly that's connected to user source.

In this case however the label information is also missing, mainly because it's not easy to get it right for the X amount of architectures and asm types that we support - unless we know for sure that what we're parsing is the correct thing.

I'm sure we can improve the situation somewhat, but I don't think we can ever get it right.

partouf avatar Sep 22 '24 14:09 partouf