paulfloyd / macos_valgrind

Official Valgrind source merged with Louis Brunner's github repo
GNU General Public License v2.0
2 stars 0 forks source link

dyld cache #3

Closed paulfloyd closed 1 year ago

paulfloyd commented 1 year ago

Louis Brunner has a branch macos_11pp2 that has initial code to implement "mmap notify" from memory.

This gets triggered from stat64 (since I presume there is no file mmap). I'll add comments here on how this is done by gdb and lldb but obviously they can use library calls.

I also wonder how dr memory does this?

Some links

https://stackoverflow.com/questions/69758584/library-not-loaded-usr-lib-libc-1-dylib-when-executing-valgrind-on-clion-edi

https://worthdoingbadly.com/dscextract/

https://lapcatsoftware.com/articles/bigsur.html

paulfloyd commented 1 year ago

lldb

source/Host/macosx/objcxx/HostInfoMacOSX.mm: _dyld_get_shared_cache_uuid(dsc_uuid);

source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: DataExtractor dsc_header_data(DscData, byte_order, addr_byte_size);

paulfloyd commented 1 year ago

gdb

gdb doesn't seem to do anything with the dyld shared cache. Rather it seems to just read memory. solib-darwin.c stuff like darwin_read_exec_load_addr_at_init darwin_current_sos maybe darwin-nat.c

paulfloyd commented 1 year ago

Seems fixed by Louis.