The prologue-end line record must be emitted after the last instruction that is part of the function frame setup code and before the instruction that marks the beginning of the function body.
For the below test:
1 extern int get_arg();
2 extern void func(int x);
4 int main()
6 int a;
The prologue-end line record is emitted with an incorrect associated address, which causes a debugger to show the beginning of function body to be inside the prologue.
This can be seen in the following trimmed assembler output:
main: ... .loc 1 7 0 prologue_end pushq %rax .Lcfi0: .cfi_def_cfa_offset 16 callq _Z7get_argv ... retq
The instruction 'pushq %rax' is part of the frame setup code.
The correct location for the prologue-end line information is just before the call to '_Z7get_argv', as illustrated in the following trimmed assembler output:
main: ... pushq %rax .Lcfi0: .cfi_def_cfa_offset 16 .loc 1 7 0 prologue_end callq _Z7get_argv ... retq