[all-commits] [llvm/llvm-project] 3256aa: [lldb] Add support for DW_AT_calling_convention to...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Oct 11 04:44:37 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3256aa8fe6fd785df12cc39f95e55bef0bc371c2
      https://github.com/llvm/llvm-project/commit/3256aa8fe6fd785df12cc39f95e55bef0bc371c2
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-10-11 (Mon, 11 Oct 2021)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    A lldb/test/API/lang/c/calling-conventions/Makefile
    A lldb/test/API/lang/c/calling-conventions/TestCCallingConventions.py
    A lldb/test/API/lang/c/calling-conventions/fastcall.c
    A lldb/test/API/lang/c/calling-conventions/ms_abi.c
    A lldb/test/API/lang/c/calling-conventions/pascal.c
    A lldb/test/API/lang/c/calling-conventions/regcall.c
    A lldb/test/API/lang/c/calling-conventions/stdcall.c
    A lldb/test/API/lang/c/calling-conventions/sysv_abi.c
    A lldb/test/API/lang/c/calling-conventions/vectorcall.c
    M lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

  Log Message:
  -----------
  [lldb] Add support for DW_AT_calling_convention to the DWARF parser

This adds support for parsing DW_AT_calling_convention in the DWARF parser.

The generic DWARF parsing code already support extracting this attribute from A
DIE and TypeSystemClang already offers a parameter to add a calling convention
to a function type (as the PDB parser supports calling convention parsing), so
this patch just converts the DWARF enum value to the Clang enum value and adds a
few tests.

There are two tests in this patch.:

* A unit test for the added DWARF parsing code that should run on all platforms.

* An API tests that covers the whole expression evaluation machinery by trying
to call functions with non-standard calling conventions. The specific subtests
are target specific as some calling conventions only work on e.g. win32 (or, if
they work on other platforms they only really have observable differences on a
specific target).  The tests are also highly compiler-specific, so if GCC or
Clang tell us that they don't support a specific calling convention then we just
skip the test.

Note that some calling conventions are supported by Clang but aren't implemented
in LLVM (e.g. `pascal`), so there we just test that if this ever gets
implemented in LLVM that LLDB works too. There are also some more tricky/obscure
conventions that are left out such as the different swift* conventions, some
planned Obj-C conventions (`Preserve*`), AAPCS* conventions (as the DWARF->Clang
conversion is ambiguous for AAPCS and APPCS-VFP) and conventions only used for
OpenCL etc.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D108629




More information about the All-commits mailing list