Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad debug line info on sub-expression #2090

Open
JohanEngelen opened this Issue May 3, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@JohanEngelen
Copy link
Member

JohanEngelen commented May 3, 2017

The line info on the bar(1) call inside foo is wrong:

extern(C): // just to disable mangling
int bar(int a) { return a; }
int foo()
{  
    return 8329423
    + bar(1); // line 6
}

generates this LLVM IR:

define i32 @foo() #0 !dbg !15 {
  %1 = call i32 @bar(i32 1) #0, !dbg !16          ; [#uses = 1] [debug line = 5:5] [display name = save_optimization_record.bar]
  %2 = add i32 8329423, %1, !dbg !16              ; [#uses = 1] [debug line = 5:5]
  ret i32 %2, !dbg !16                            ; [debug line = 5:5]
}

Note the wrong debug line = 5:5 on the call. (also on the +)

@JohanEngelen

This comment has been minimized.

Copy link
Member Author

JohanEngelen commented Dec 23, 2018

@kinke while working on this I got to these changes: JohanEngelen@654aa25
But... I don't think it's the right path. Perhaps we need to add location information onto a DValue and upon loading it we need to emit the debug location. That would solve a number of issues with debug location and then we only need to make sure we tag the instructions in-between loads.

@kinke

This comment has been minimized.

Copy link
Member

kinke commented Dec 23, 2018

I'm not familiar with the EmitStopPoint() stuff. To be honest, I wouldn't even expect subexpressions not to be tied to the (first) LoC of their statement, but maybe that's just my experience with VS (I can't even say OTOH whether this works in VC++).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.