title: GDB / "malloc_error_break" not defined
body: <p>I'm trying to learn more about malloc &amp; free, so I've created a dylib that implements those functions, and I'm loading into a common system binary. However, it has bugs and I'm trying to debug them.</p>
  
  <ul>
  <li>malloc.dylib is my dynamic library</li>
  </ul>
  
  <p>Here's the gdb output:</p>
  
  <pre><code>(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) 
  </code></pre>
  
  <p>What I'm confused about is the message</p>
  
  <pre><code>Function "malloc_error_break" not defined.
  </code></pre>
  
  <p>When I try to set a breakpoint on it. Clearly, it's not breaking because it's unknown.</p>
  
  <p>Any help? Thanks in advance.</p>