私は 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.
それにブレークポイントを設定しようとすると。明らかに、不明なので壊れていません。
何か助けはありますか?前もって感謝します。