我正在尝试了解有关 malloc 和 free 的更多信息,因此我创建了一个实现这些功能的 dylib,并且我正在加载到一个通用系统二进制文件中。但是,它有错误,我正在尝试调试它们。
- malloc.dylib 是我的动态库
这是 gdb 输出:
(gdb) set env DYLD_INSERT_LIBRARIES malloc.dylib
(gdb) break malloc_error_break
Function "malloc_error_break" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) r
Starting program: /bin/ls
[+] init()
[-] myMalloc requesting: 4096 bytes
[-] memory address: 200000
bash(2035) malloc: *** error for object 0x200000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Program terminated with signal SIGABRT, Aborted.
The program no longer exists.
(gdb)
我感到困惑的是消息
Function "malloc_error_break" not defined.
当我尝试在其上设置断点时。显然,它不会因为未知而崩溃。
有什么帮助吗?提前致谢。