debug_frame section not generated for Windows 64bit

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

debug_frame section not generated for Windows 64bit

Manuel Klimek via cfe-dev
Hi togehter,

I am currently switching from MinGW-w64 to clang. I am running into a problem with the debug information generated by clang, though. When building with mingw, there will always be an .eh_frame or a .debug_frame section. This is also true for 64bit windows. When I build the same files with clang for the target triple "x86_64-pc-windows-gnu" neither a .debug_frame nor an .eh_frame section is generated.

I there a way for me to explicitly specify via command line that such a section shall be generated?
If not, is there a way to change the llvm/clang source code in a way such that these sections will be generated for the specified target?

Best Regards,
Jayvee

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: debug_frame section not generated for Windows 64bit

Manuel Klimek via cfe-dev
Clang defaults to emitting SEH unwind information on Win64, since it is required by the ABI. DWARF EH tables would be redundant, but you can request them with -fdwarf-exceptions.


On Thu, Mar 22, 2018 at 4:05 PM Jayvee Neumann via cfe-dev <[hidden email]> wrote:
Hi togehter,

I am currently switching from MinGW-w64 to clang. I am running into a problem with the debug information generated by clang, though. When building with mingw, there will always be an .eh_frame or a .debug_frame section. This is also true for 64bit windows. When I build the same files with clang for the target triple "x86_64-pc-windows-gnu" neither a .debug_frame nor an .eh_frame section is generated.

I there a way for me to explicitly specify via command line that such a section shall be generated?
If not, is there a way to change the llvm/clang source code in a way such that these sections will be generated for the specified target?

Best Regards,
Jayvee
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: debug_frame section not generated for Windows 64bit

Manuel Klimek via cfe-dev
Hi Reid,

your suggestion is not a solution to the problem I have. I still want to use SEH on 64bit Windows because it is, as you also pointed out, required by the ABI. I need a .debug_frame or .eh_frame section in addition to the SEH .pdata section. I am aware that the exception handling data would be redundant. Information about e.g. the CFA, which is required by some DWARF-expressions/locations, would not be redundant though.

Is there a way to request both, a .pdata section for SEH style exceptions and a .debug_frame sections, in the same or a similar way to MinGW-w64?

Best Regards
Jayvee

2018-03-23 0:22 GMT+01:00 Reid Kleckner <[hidden email]>:
Clang defaults to emitting SEH unwind information on Win64, since it is required by the ABI. DWARF EH tables would be redundant, but you can request them with -fdwarf-exceptions.


On Thu, Mar 22, 2018 at 4:05 PM Jayvee Neumann via cfe-dev <[hidden email]> wrote:
Hi togehter,

I am currently switching from MinGW-w64 to clang. I am running into a problem with the debug information generated by clang, though. When building with mingw, there will always be an .eh_frame or a .debug_frame section. This is also true for 64bit windows. When I build the same files with clang for the target triple "x86_64-pc-windows-gnu" neither a .debug_frame nor an .eh_frame section is generated.

I there a way for me to explicitly specify via command line that such a section shall be generated?
If not, is there a way to change the llvm/clang source code in a way such that these sections will be generated for the specified target?

Best Regards,
Jayvee
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: debug_frame section not generated for Windows 64bit

Manuel Klimek via cfe-dev
Got it. I think the CFA is always the address of the return address, so such a DWARF consumer could be retrofitted to parse .xdata, find the caller's return address, and evaluate expressions using the CFA from there.

I don't think it's possible to get LLVM to emit DWARF CFI and Win CFI at the same time. The booleans in the prologue emission suggest that they are mutually exlusive:
  bool IsWin64Prologue = MF.getTarget().getMCAsmInfo()->usesWindowsCFI();
  ...
  bool NeedsDwarfCFI =
      !IsWin64Prologue && (MMI.hasDebugInfo() || Fn.needsUnwindTableEntry());

NeedsDwarfCFI controls the emission of the DWARF .cfi_* directives, which normally produce the .eh_frame or .debug_frame sections.

Shoaib, I think you have users of DWARF on Windows? How do they deal with this problem?


On Fri, Mar 23, 2018 at 12:06 AM Jayvee Neumann via cfe-dev <[hidden email]> wrote:
Hi Reid,

your suggestion is not a solution to the problem I have. I still want to use SEH on 64bit Windows because it is, as you also pointed out, required by the ABI. I need a .debug_frame or .eh_frame section in addition to the SEH .pdata section. I am aware that the exception handling data would be redundant. Information about e.g. the CFA, which is required by some DWARF-expressions/locations, would not be redundant though.

Is there a way to request both, a .pdata section for SEH style exceptions and a .debug_frame sections, in the same or a similar way to MinGW-w64?

Best Regards
Jayvee

2018-03-23 0:22 GMT+01:00 Reid Kleckner <[hidden email]>:
Clang defaults to emitting SEH unwind information on Win64, since it is required by the ABI. DWARF EH tables would be redundant, but you can request them with -fdwarf-exceptions.


On Thu, Mar 22, 2018 at 4:05 PM Jayvee Neumann via cfe-dev <[hidden email]> wrote:
Hi togehter,

I am currently switching from MinGW-w64 to clang. I am running into a problem with the debug information generated by clang, though. When building with mingw, there will always be an .eh_frame or a .debug_frame section. This is also true for 64bit windows. When I build the same files with clang for the target triple "x86_64-pc-windows-gnu" neither a .debug_frame nor an .eh_frame section is generated.

I there a way for me to explicitly specify via command line that such a section shall be generated?
If not, is there a way to change the llvm/clang source code in a way such that these sections will be generated for the specified target?

Best Regards,
Jayvee
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: debug_frame section not generated for Windows 64bit

Manuel Klimek via cfe-dev

Sorry, I missed this.

 

We don't have a solution to this, to the best of my knowledge. We just accept the loss of fidelity.

 

From: Reid Kleckner <[hidden email]>
Date: Friday, March 23, 2018 at 11:10 AM
To: "[hidden email]" <[hidden email]>, Shoaib Meenai <[hidden email]>
Cc: cfe-dev <[hidden email]>
Subject: Re: [cfe-dev] debug_frame section not generated for Windows 64bit

 

Got it. I think the CFA is always the address of the return address, so such a DWARF consumer could be retrofitted to parse .xdata, find the caller's return address, and evaluate expressions using the CFA from there.

 

I don't think it's possible to get LLVM to emit DWARF CFI and Win CFI at the same time. The booleans in the prologue emission suggest that they are mutually exlusive:

  bool IsWin64Prologue = MF.getTarget().getMCAsmInfo()->usesWindowsCFI();

  ...

  bool NeedsDwarfCFI =

      !IsWin64Prologue && (MMI.hasDebugInfo() || Fn.needsUnwindTableEntry());

 

NeedsDwarfCFI controls the emission of the DWARF .cfi_* directives, which normally produce the .eh_frame or .debug_frame sections.

 

Shoaib, I think you have users of DWARF on Windows? How do they deal with this problem?

 

On Fri, Mar 23, 2018 at 12:06 AM Jayvee Neumann via cfe-dev <[hidden email]> wrote:

Hi Reid,

your suggestion is not a solution to the problem I have. I still want to use SEH on 64bit Windows because it is, as you also pointed out, required by the ABI. I need a .debug_frame or .eh_frame section in addition to the SEH .pdata section. I am aware that the exception handling data would be redundant. Information about e.g. the CFA, which is required by some DWARF-expressions/locations, would not be redundant though.

Is there a way to request both, a .pdata section for SEH style exceptions and a .debug_frame sections, in the same or a similar way to MinGW-w64?

Best Regards
Jayvee

 

2018-03-23 0:22 GMT+01:00 Reid Kleckner <[hidden email]>:

Clang defaults to emitting SEH unwind information on Win64, since it is required by the ABI. DWARF EH tables would be redundant, but you can request them with -fdwarf-exceptions.

 

On Thu, Mar 22, 2018 at 4:05 PM Jayvee Neumann via cfe-dev <[hidden email]> wrote:

Hi togehter,

I am currently switching from MinGW-w64 to clang. I am running into a problem with the debug information generated by clang, though. When building with mingw, there will always be an .eh_frame or a .debug_frame section. This is also true for 64bit windows. When I build the same files with clang for the target triple "x86_64-pc-windows-gnu" neither a .debug_frame nor an .eh_frame section is generated.

I there a way for me to explicitly specify via command line that such a section shall be generated?
If not, is there a way to change the llvm/clang source code in a way such that these sections will be generated for the specified target?

Best Regards,
Jayvee

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev