[PATCH] D41762: [DWARF] Incorrect prologue end line record.

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 04:34:19 PST 2018


CarlosAlbertoEnciso created this revision.
CarlosAlbertoEnciso added reviewers: aprantl, dblaikie, probinson, tberghammer.

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);
  3
  4 int main()
  5 {
  6 int a;
  7 func(get_arg());
  8 }
  9

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

Notes:

- This patch does not change the LLDB test cases that were failing with a previous patch.

- As per reference, there are 2 previous related revisions:

https://reviews.llvm.org/D37625

Closed by commit https://reviews.llvm.org/rL313047
Reverted in https://reviews.llvm.org/rL313057 as it was causing buildbot failure (lldb inline stepping tests).

https://reviews.llvm.org/D39283

Patch with the required changes to the failing tests.
After some discussions with Tamas, it was clear that changing the test cases was not an optimal solution.
This revision should be abandoned.


Repository:
  rL LLVM

https://reviews.llvm.org/D41762

Files:
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/Target/X86/X86ExpandPseudo.cpp
  lib/Target/X86/X86FrameLowering.cpp
  lib/Target/X86/X86FrameLowering.h
  test/DebugInfo/X86/invalid-prologue-end.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41762.128717.patch
Type: text/x-patch
Size: 8203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180105/dac563eb/attachment.bin>


More information about the llvm-commits mailing list