OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 12:47 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: LLDB doesn't correlate my frame with source code.
PostPosted: Fri Mar 08, 2024 11:30 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
Hello, I have an corp dump of a crashed program in my OS. (I'm forcing the crash, so I know what it is. I want help debugging getting lldb to work.)

I load the core dump into lldb via:

Code:
target create --core "temp/CoreDumps/Dump1.dmp" "temp/Perception-debug/Applications/Storage Manager/Storage Manager.app"


No errors.

When I type "bt", it prints just the raw addresses, no code references or symbols:

Code:
* thread #1, name = 'Storage Manager', stop reason = signal SIGSTOP
  * frame #0: 0x00000000002342fa
    frame #1: 0x0000000000235b4f
    frame #2: 0x0000000000234cfb
    frame #3: 0x0000000000291d53
    frame #4: 0x0000000000290122
    frame #5: 0x000000000028feaf
    frame #6: 0x000000000028ce22
    frame #7: 0x0000000000289396
    frame #8: 0x000000000000a360


But the symbols have loaded, because if I type "image lookup -va $pc" I get the exact line of code and the parameters to the C++ method:
Code:
      Address: Storage Manager.app[0x00000000002342fa] (Storage Manager.app.PT_LOAD[1]..text + 14506)
      Summary: Storage Manager.app`MemoryMappedFile::MemoryMappedFile(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<File, std::_LIBCPP_ABI_NAMESPACE::default_delete<File>>, unsigned long, unsigned long, unsigned long) + 154 at memory_mapped_file.cc:58:12
       Module: file = "/Users/andrewaprice/Documents/GitHub/Perception/Build/temp/Perception-debug/Applications/Storage Manager/Storage Manager.app", arch = "x86_64"
  CompileUnit: id = {0x00000003}, file = "/Users/andrewaprice/Documents/GitHub/Perception/Applications/Storage Manager/source/memory_mapped_file.cc", language = "c++14"
     Function: id = {0x00031fe9}, name = "MemoryMappedFile::MemoryMappedFile(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<File, std::_LIBCPP_ABI_NAMESPACE::default_delete<File>>, unsigned long, unsigned long, unsigned long)", mangled = "_ZN16MemoryMappedFileC2ENSt21_LIBCPP_ABI_NAMESPACE10unique_ptrI4FileNS0_14default_deleteIS2_EEEEmmm", range = [0x0000000000234260-0x000000000023445b)
     FuncType: id = {0x00031fe9}, byte-size = 0, decl = memory_mapped_file.h:24, compiler_type = "void (class std::unique_ptr<class File>, size_t, size_t, perception::ProcessId)"
       Blocks: id = {0x00031fe9}, range = [0x00234260-0x0023445b)
               id = {0x0003211b}, ranges = [0x002342f3-0x002343ea)[0x002343fe-0x0023441e)
    LineEntry: [0x00000000002342f3-0x0000000000234300): /Users/andrewaprice/Documents/GitHub/Perception/Applications/Storage Manager/source/memory_mapped_file.cc:58:12
       Symbol: id = {0x00000b9c}, range = [0x0000000000234260-0x000000000023445b), name="MemoryMappedFile::MemoryMappedFile(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<File, std::_LIBCPP_ABI_NAMESPACE::default_delete<File>>, unsigned long, unsigned long, unsigned long)", mangled="_ZN16MemoryMappedFileC2ENSt21_LIBCPP_ABI_NAMESPACE10unique_ptrI4FileNS0_14default_deleteIS2_EEEEmmm"
     Variable: id = {0x0003211e}, name = "grant_request", type = "GrantStorageDevicePermissionToAllocateSharedMemoryPagesRequest", valid ranges = <block>, location = DW_OP_fbreg -160, decl = memory_mapped_file.cc:71
     Variable: id = {0x0003201e}, name = "this", type = "MemoryMappedFile *", valid ranges = <block>, location = [0x0000000000234285, 0x00000000002343ef) -> DW_OP_reg3 RBX, decl =
     Variable: id = {0x00032026}, name = "file", type = "unique_ptr<File, std::_LIBCPP_ABI_NAMESPACE::default_delete<File> >", valid ranges = <block>, location = [0x0000000000234285, 0x00000000002343f3) -> DW_OP_breg13 R13+0, decl = memory_mapped_file.cc:46
     Variable: id = {0x00032031}, name = "length_of_file", type = "size_t", valid ranges = <block>, location = [0x0000000000234285, 0x000000000023433d) -> DW_OP_reg15 R15, decl = memory_mapped_file.cc:47
     Variable: id = {0x0003203c}, name = "optimal_operation_size", type = "size_t", valid ranges = <block>, location = [0x0000000000234285, 0x0000000000234316) -> DW_OP_reg12 R12, decl = memory_mapped_file.cc:48
     Variable: id = {0x00032047}, name = "allowed_process", type = "perception::ProcessId", valid ranges = <block>, location = [0x00000000002342f3, 0x000000000023445b) -> DW_OP_entry_value(DW_OP_reg8 R8), DW_OP_stack_value, decl = memory_mapped_file.cc:49


"frame info" returns very little detail:
Code:
frame #0: 0x00000000002342fa


"frame variable" returns nothing.

If I call "frame select" (e.g. "frame select 1") I get this output:
Code:
frame #1: 0x0000000000235b4f
error: 0xffffffffffffffff can't be resolved


What does 0xffffffffffffffff mean?

My registers with "register read -all" look sane:
Code:
General Purpose Registers:
       rax = 0x000000000000000a
       rbx = 0x0000000000025430
       rcx = 0x000000000028cff6
       rdx = 0x0000000000000000
       rdi = 0x0000000000000020
       rsi = 0x0000000000656c69
       rbp = 0x0000000000013bb0
       rsp = 0x0000000000013b10
        r8 = 0x0000000000000000
        r9 = 0x0000000000000000
       r10 = 0x0000000000000000
       r11 = 0x0000000000200246
       r12 = 0x0000000000200000
       r13 = 0x0000000000013bd0
       r14 = 0x0000000000025458
       r15 = 0x0000000000b19b78
       rip = 0x00000000002342fa
    rflags = 0x0000000000200246
        cs = 0x0000000000000023
        fs = 0x0000000000000010
        gs = 0x0000000000000010
        ss = 0x000000000000001b
   fs_base = 0x0000000000000000
   gs_base = 0x0000000000000000
        ds = 0x000000000000001b
        es = 0x000000000000001b
       eax = 0x0000000a
       ebx = 0x00025430
       ecx = 0x0028cff6
       edx = 0x00000000
       edi = 0x00000020
       esi = 0x00656c69
       ebp = 0x00013bb0
       esp = 0x00013b10
       r8d = 0x00000000
       r9d = 0x00000000
      r10d = 0x00000000
      r11d = 0x00200246
      r12d = 0x00200000
      r13d = 0x00013bd0
      r14d = 0x00025458
      r15d = 0x00b19b78
        ax = 0x000a
        bx = 0x5430
        cx = 0xcff6
        dx = 0x0000
        di = 0x0020
        si = 0x6c69
        bp = 0x3bb0
        sp = 0x3b10
       r8w = 0x0000
       r9w = 0x0000
      r10w = 0x0000
      r11w = 0x0246
      r12w = 0x0000
      r13w = 0x3bd0
      r14w = 0x5458
      r15w = 0x9b78
        ah = 0x00
        bh = 0x54
        ch = 0xcf
        dh = 0x00
        al = 0x0a
        bl = 0x30
        cl = 0xf6
        dl = 0x00
       dil = 0x20
       sil = 0x69
       bpl = 0xb0
       spl = 0x10
       r8l = 0x00
       r9l = 0x00
      r10l = 0x00
      r11l = 0x46
      r12l = 0x00
      r13l = 0xd0
      r14l = 0x58
      r15l = 0x78

Floating Point Registers:
     fctrl = 0x0000
     fstat = 0x0000
      ftag = 0x0000
       fop = 0x0000
     fiseg = 0x00000000
     fioff = 0x00000000
       fip = 0x0000000000000000
     foseg = 0x00000000
     fooff = 0x00000000
       fdp = 0x0000000000000000
     mxcsr = 0x00000000
  mxcsrmask = 0x0000ffff
       st0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       st7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
       mm0 = 0x0000000000000000
       mm1 = 0x0000000000000000
       mm2 = 0x0000000000000000
       mm3 = 0x0000000000000000
       mm4 = 0x0000000000000000
       mm5 = 0x0000000000000000
       mm6 = 0x0000000000000000
       mm7 = 0x0000000000000000
      xmm0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm8 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
      xmm9 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
     xmm10 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
     xmm11 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
     xmm12 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
     xmm13 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
     xmm14 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
     xmm15 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}

Advanced Vector Extensions:
16 registers were unavailable.


So.. the symbols are loaded and I can query them via "image lookup", but for some reason lldb doesn't think my frame addresses correlate with these symbols?

This is my code that creates and dumps the core-dump: https://github.com/AndrewAPrice/Percept ... re_dump.cc

My binaries are elf-x86_64, and the program is linked with lld (llvm's linker) with the following arguments: "-g -nostdlib --gc-sections -z max-page-size=1". I've tried removing "--gc-sections" and it hasn't helped.

Does anybody have advice on how I can debug this?

_________________
My OS is Perception.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group