Skip to content

Native debugging with symbols is broken on Linux/arm64 #34108

@echesakov

Description

@echesakov

It appears that #33716 causes the following issues on Linux/arm64 (it could be on other architectures as well)

This is what shows up when I run gdb

warning: the debug information found in "/home/robox/echesako/33749/artifacts/tests/coreclr/Linux.arm64.Checked/Tests/Core_Root/libclrjit.so.dbg" does not match "/home/robox/echesako/33749/artifacts/tests/coreclr/Linux.arm64.Checked/Tests/Core_Root/libclrjit.so" (CRC mismatch).

and this is output of bt command in lldb

(lldb) bt
* thread #12, name = 'corerun', stop reason = signal SIGTRAP
  * frame #0: 0x0000ffffb3644c0c libclrjit.so`DBG_DebugBreak
    frame #1: 0x0000ffffb35e6120 libclrjit.so`DebugBreak + 708
    frame #2: 0x0000ffffb33bdab8 libclrjit.so`assertAbort + 268
    frame #3: 0x0000ffffb339e334 libclrjit.so`Compiler::compInitOptions(JitFlags*) + 2064
    frame #4: 0x0000ffffb33a311c libclrjit.so`Compiler::compCompileHelper(CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) + 240
    frame #5: 0x0000ffffb33a2580 libclrjit.so`Compiler::compCompile(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) + 1824
    frame #6: 0x0000ffffb33a44f0 libclrjit.so`jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) + 436
    frame #7: 0x0000ffffb33ae384 libclrjit.so`CILJit::compileMethod(ICorJitInfo*, CORINFO_METHOD_INFO*, unsigned int, unsigned char**, unsigned int*) + 292

As you can see there is no information about the source files.

If I manually disable stripping the symbols by commenting out the following lines

add_custom_command(
TARGET ${targetName}
POST_BUILD
VERBATIM
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file}
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
)

everything goes back to normal

(lldb) bt
* thread #12, name = 'corerun', stop reason = signal SIGTRAP
  * frame #0: 0x0000ffffb3644c0c libclrjit.so`DBG_DebugBreak at debugbreak.S:8
    frame #1: 0x0000ffffb35e6120 libclrjit.so`::DebugBreak() at debug.cpp:405:9
    frame #2: 0x0000ffffb33bdab8 libclrjit.so`::assertAbort(why=0x0000ffffb3671ca1, file=0x0000ffffb3671880, line=2910) at error.cpp:295:9
    frame #3: 0x0000ffffb339e334 libclrjit.so`Compiler::compInitOptions(this=0x0000aaaaab3f0e28, jitFlags=0x0000fffee7ff99a0) at compiler.cpp:2910:9
    frame #4: 0x0000ffffb33a311c libclrjit.so`Compiler::compCompileHelper(this=0x0000aaaaab3f0e28, classPtr=0x0000ffff453ae3a8, compHnd=0x0000fffee7ff9cd8, methodInfo=0x0000fffee7ff9b90, methodCodePtr=0x0000fffee7ff9988, methodCodeSize=0x0000fffee7ff9b5c, compileFlags=0x0000fffee7ff99a0) at compiler.cpp:5785:5
    frame #5: 0x0000ffffb33a2580 libclrjit.so`Compiler::compCompile(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) at compiler.cpp:5392:28
    frame #6: 0x0000ffffb33a2564 libclrjit.so`Compiler::compCompile(this=0x0000aaaaab3f0e28, methodHnd=<unavailable>, classPtr=0x0000ffff453ae3a8, compHnd=0x0000fffee7ff9cd8, methodInfo=0x0000fffee7ff9b90, methodCodePtr=0x0000fffee7ff9988, methodCodeSize=0x0000fffee7ff9b5c, compileFlags=0x0000fffee7ff99a0) at compiler.cpp:5411
    frame #7: 0x0000ffffb33a44f0 libclrjit.so`jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) at compiler.cpp:6693:32
    frame #8: 0x0000ffffb33a4444 libclrjit.so`jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) at compiler.cpp:6718
    frame #9: 0x0000ffffb33a4440 libclrjit.so`jitNativeCode(methodHnd=0x0000ffff454d4080, classPtr=0x0000ffff453ae3a8, compHnd=0x0000fffee7ff9cd8, methodInfo=0x0000fffee7ff9b90, methodCodePtr=0x0000fffee7ff9988, methodCodeSize=0x0000fffee7ff9b5c, compileFlags=0x0000fffee7ff99a0, inlineInfoPtr=0x0000000000000000) at compiler.cpp:6720
    frame #10: 0x0000ffffb33ae384 libclrjit.so`CILJit::compileMethod(this=<unavailable>, compHnd=0x0000fffee7ff9cd8, methodInfo=0x0000fffee7ff9b90, flags=<unavailable>, entryAddress=0x0000fffee7ff9b60, nativeSizeOfCode=0x0000fffee7ff9b5c) at ee_il_dll.cpp:304:14

cc @janvorli @am11

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions