Sysinternals / ProcDump-for-Linux

A Linux version of the ProcDump Sysinternals tool
MIT License
2.95k stars 306 forks source link

Profiler build fails on ppc64le #163

Open mgrabovsky opened 1 year ago

mgrabovsky commented 1 year ago

Expected behavior

All of the components are built successfully and work properly on a ppc64le-based machine or VM.

Actual behavior

Build of the profiler fails on the ppc64le architecture with the following errors (abridged; for full logs, see the build task):

clang++ -o obj/ProcDumpProfiler.so -DELPP_NO_DEFAULT_LOG_FILE -DELPP_THREAD_SAFE -g -pthread -shared --no-undefined -Wno-invalid-noreturn -Wno-pragma-pack -Wno-writable-strings -Wno-format-security -fPIC -fms-extensions -DHOST_64BIT -DBIT64 -DPAL_STDCPP_COMPAT -DPLATFORM_UNIX -std=c++11 -I profiler/inc profiler/src/ClassFactory.cpp profiler/src/ProcDumpProfiler.cpp profiler/src/dllmain.cpp profiler/src/corprof_i.cpp profiler/src/easylogging++.cc
In file included from profiler/src/ClassFactory.cpp:4:
In file included from profiler/inc/ClassFactory.h:6:
In file included from profiler/inc/unknwn.h:12:
In file included from profiler/inc/rpc.h:15:
In file included from profiler/inc/palrt.h:136:
profiler/inc/pal.h:2312:2: error: Unknown architecture for defining CONTEXT.
#error Unknown architecture for defining CONTEXT.
 ^
profiler/inc/pal.h:2321:17: error: unknown type name 'LPCONTEXT'
         IN OUT LPCONTEXT lpContext);
                ^
profiler/inc/pal.h:2328:19: error: unknown type name 'CONTEXT'
         IN CONST CONTEXT *lpContext);
                  ^
profiler/inc/pal.h:2421:41: error: unknown type name 'CONTEXT'
PALIMPORT BOOL PALAPI PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers);
                                        ^
profiler/inc/pal.h:2421:59: error: unknown type name 'KNONVOLATILE_CONTEXT_POINTERS'
PALIMPORT BOOL PALAPI PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers);
                                                          ^
profiler/inc/pal.h:2423:50: error: unknown type name 'CONTEXT'
PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback);
                                                 ^
profiler/inc/pal.h:2423:68: error: unknown type name 'KNONVOLATILE_CONTEXT_POINTERS'
PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback);
                                                                   ^
profiler/inc/pal.h:2458:2: warning:  [-W#warnings]
#warning
 ^
profiler/inc/pal.h:2459:2: error: PAL_CS_NATIVE_DATA_SIZE is not defined for this architecture
#error  PAL_CS_NATIVE_DATA_SIZE is not defined for this architecture
 ^
profiler/inc/pal.h:2477:34: error: use of undeclared identifier 'PAL_CS_NATIVE_DATA_SIZE'
        BYTE rgNativeDataStorage[PAL_CS_NATIVE_DATA_SIZE];
                                 ^
profiler/inc/pal.h:2939:5: error: unknown type name 'PCONTEXT'
    PCONTEXT ContextRecord;
    ^
profiler/inc/pal.h:3096:8: error: unknown type name 'PCONTEXT'
    IN PCONTEXT pContextRecord,
       ^
profiler/inc/pal.h:3667:6: error: unknown type name 'PCONTEXT'
  IN PCONTEXT ContextRecord,
     ^
profiler/inc/pal.h:3675:7: error: unknown type name 'PCONTEXT'
  OUT PCONTEXT ContextRecord
      ^
profiler/inc/pal.h:3683:40: error: unknown type name 'CONTEXT'
typedef void (*PAL_ActivationFunction)(CONTEXT *context);
                                       ^
profiler/inc/pal.h:4429:6: error: unknown type name 'CONTEXT'
  IN CONTEXT *contextRecord);
     ^
profiler/inc/pal.h:4471:58: error: unknown type name 'CONTEXT'
    PAL_SEHException(EXCEPTION_RECORD *pExceptionRecord, CONTEXT *pContextRecord, bool onStack = false)
                                                         ^
profiler/inc/pal.h:4519:5: error: unknown type name 'CONTEXT'
    CONTEXT* GetContextRecord()
    ^
profiler/inc/pal.h:4554:59: error: unknown type name 'PCONTEXT'
typedef BOOL (*PHARDWARE_EXCEPTION_SAFETY_CHECK_FUNCTION)(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord);
                                                          ^
profiler/inc/pal.h:4575:8: error: unknown type name 'CONTEXT'
    IN CONTEXT* context,
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
[...]

It appears that the profiler/inc/pal.h header file is missing definitions for the ppc64le archicture.

Steps to reproduce the behavior

  1. Run the build on a ppc64le machine.

System information (e.g., distro, kernel version, etc.)

MarioHewardt commented 1 year ago

We haven't updated the profiler to support ppc64le yet. The profiler is used specifically when the target is a .NET process and I believe ppc64le support was added in .NET7 (released end of 2022). I'll look into enabling support for this.