Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No entries for mach-O symbol stubs #276

Open
mstange opened this issue Sep 12, 2021 · 0 comments
Open

No entries for mach-O symbol stubs #276

mstange opened this issue Sep 12, 2021 · 0 comments

Comments

@mstange
Copy link
Collaborator

mstange commented Sep 12, 2021

The profiler has sampled address 0x77d58 in this libmozglue.dylib. Here's the corresponding binary.

According to the .sym file, this address is outside of any known code:

[...]
FUNC m 77c90 ac 0 bool double_conversion::Advance<char*>(char**, unsigned short, int, char*&)
77c94 4 191 95
77c98 44 195 95
77cdc 4 206 95
77ce0 8 192 95
77ce8 c 193 95
77cf4 4 206 95
77cf8 c 201 95
77d04 20 202 95
77d24 4 203 95
77d28 10 205 95
77d38 4 206 95
STACK CFI INIT 64a8 288 .cfa: $x29 16 + $x29: .cfa -16 + ^ .ra: .cfa -8 + ^ $x19: .cfa -24 + ^ $x20: .cfa -32 + ^ $x21: .cfa -40 + ^ $x22: .cfa -48 + ^
STACK CFI INIT 6730 ec .cfa: $x29 16 + $x29: .cfa -16 + ^ .ra: .cfa -8 + ^
[...]

But according to Hopper, it is inside imp___stubs__OSSpinLockLock:


        ; ================ B E G I N N I N G   O F   P R O C E D U R E ================


                     __ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_:        // bool double_conversion::Advance<char*>(char**, unsigned short, int, char*&)
0000000000077c90         ldr        x10, [x0]                                   ; CODE XREF=__ZNK17double_conversion23StringToDoubleConverter14StringToDoubleEPKciPi+868, __ZNK17double_conversion23StringToDoubleConverter14StringToDoubleEPKciPi+1052, __ZNK17double_conversion23StringToDoubleConverter14StringToDoubleEPKciPi+2124, __ZNK17double_conversion23StringToDoubleConverter14StringToDoubleEPKciPi+2260
0000000000077c94         cbz        w1, loc_77ce0

0000000000077c98         mov        x8, x10
0000000000077c9c         ldrsb      w14, [x8], #0x1
0000000000077ca0         cmp        w14, #0x38
0000000000077ca4         cset       w11, lt
0000000000077ca8         sub        w15, w14, #0x30
0000000000077cac         cmp        w15, #0xa
0000000000077cb0         cset       w12, lo
0000000000077cb4         str        x8, [x0]
0000000000077cb8         ldr        x9, [x2]
0000000000077cbc         cmp        x8, x9
0000000000077cc0         cset       w13, eq
0000000000077cc4         cmp        w14, #0x37
0000000000077cc8         ccmp       w15, #0x9, #0x2
0000000000077ccc         ccmp       x8, x9, #0x4
0000000000077cd0         b.ne       loc_77cf8

0000000000077cd4         and        w8, w11, w12
0000000000077cd8         orr        w0, w13, w8
0000000000077cdc         ret
                        ; endp

                     loc_77ce0:
0000000000077ce0         add        x8, x10, #0x1                               ; CODE XREF=__ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_+4
0000000000077ce4         str        x8, [x0]
0000000000077ce8         ldr        x9, [x2]

                     loc_77cec:
0000000000077cec         cmp        x8, x9                                      ; CODE XREF=__ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_+124, __ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_+144, __ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_+160
0000000000077cf0         cset       w0, eq
0000000000077cf4         ret
                        ; endp

                     loc_77cf8:
0000000000077cf8         add        x10, x10, #0x2                              ; CODE XREF=__ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_+64
0000000000077cfc         cmp        x10, x9
0000000000077d00         b.eq       loc_77d34

0000000000077d04         ldrsb      w11, [x8]
0000000000077d08         cmp        w11, w1
0000000000077d0c         b.ne       loc_77cec

0000000000077d10         ldrsb      w11, [x10]
0000000000077d14         sub        w12, w11, #0x30
0000000000077d18         cmp        w11, #0x37
0000000000077d1c         ccmp       w12, #0x9, #0x2
0000000000077d20         b.hi       loc_77cec

0000000000077d24         str        x10, [x0]
0000000000077d28         ldr        x9, [x2]
0000000000077d2c         mov        x8, x10
0000000000077d30         b          loc_77cec

                     loc_77d34:
0000000000077d34         movz       w0, #0x0                                    ; CODE XREF=__ZN17double_conversionL7AdvanceIPcEEbPT_tiRS2_+112
0000000000077d38         ret
                        ; endp


        ; Section __stubs
        ; Range: [0x77d3c; 0x783c0[ (1668 bytes)
        ; File offset : [490812; 492480[ (1668 bytes)
        ; Flags: 0x80000408
        ;   S_SYMBOL_STUBS
        ;   S_ATTR_PURE_INSTRUCTIONS
        ;   S_ATTR_SOME_INSTRUCTIONS



        ; ================ B E G I N N I N G   O F   P R O C E D U R E ================


                     imp___stubs__NXGetArchInfoFromCpuType:        // NXGetArchInfoFromCpuType
0000000000077d3c         nop                                                    ; CODE XREF=__ZN7mozilla12baseprofiler21AppendSharedLibrariesERNS_10JSONWriterE+1268
0000000000077d40         ldr        x16, #_NXGetArchInfoFromCpuType_ptr         ; _NXGetArchInfoFromCpuType
0000000000077d44         br         x16                                         ; _NXGetArchInfoFromCpuType
                        ; endp


        ; ================ B E G I N N I N G   O F   P R O C E D U R E ================


                     imp___stubs__OSSpinLockLock:        // OSSpinLockLock
0000000000077d48         nop                                                    ; CODE XREF=__ZL13chunk_deallocPvm9ChunkType+68, __ZL13chunk_deallocPvm9ChunkType+356, __ZL13chunk_deallocPvm9ChunkType+396, __ZL13chunk_deallocPvm9ChunkType+748, __ZL13chunk_deallocPvm9ChunkType+920, __ZL11chunk_allocmmbPb+96, __ZL11chunk_allocmmbPb+416, __ZL11chunk_allocmmbPb+784, __ZL11chunk_allocmmbPb+1544, __ZN7arena_t11MallocLargeEmb+76, __ZN7arena_t10PallocHugeEmmb+104
0000000000077d4c         ldr        x16, #_OSSpinLockLock_ptr                   ; _OSSpinLockLock
0000000000077d50         br         x16                                         ; _OSSpinLockLock
                        ; endp


        ; ================ B E G I N N I N G   O F   P R O C E D U R E ================


                     imp___stubs__OSSpinLockUnlock:        // OSSpinLockUnlock
0000000000077d54         nop                                                    ; CODE XREF=__ZL13chunk_deallocPvm9ChunkType+264, __ZL13chunk_deallocPvm9ChunkType+380, __ZL13chunk_deallocPvm9ChunkType+676, __ZL13chunk_deallocPvm9ChunkType+768, __ZL13chunk_deallocPvm9ChunkType+912, __ZL13chunk_deallocPvm9ChunkType+1024, __ZL11chunk_allocmmbPb+332, __ZL11chunk_allocmmbPb+608, __ZL11chunk_allocmmbPb+680, __ZL11chunk_allocmmbPb+776, __ZL11chunk_allocmmbPb+1520
0000000000077d58         ldr        x16, #_OSSpinLockUnlock_ptr                 ; _OSSpinLockUnlock
0000000000077d5c         br         x16                                         ; _OSSpinLockUnlock
                        ; endp

It would be great if dump_syms could emit symbols for these stubs.

See also gimli-rs/object#377 where I've asked how to obtain this type of symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant