[erlang-questions] Linked-in Driver Debugging

Alceste Scalas <>
Thu Sep 4 11:01:37 CEST 2008


Il giorno gio, 04/09/2008 alle 08.48 +0100, Peter McCarthy ha scritto:
> Does anyone know if it's possible to set breakpoints in the driver and
> attach to ERTS, so that when port command messages are sent to the
> driver, these breakpoint are hit?

You can surely do it with GDB (on Unix-like systems, at least):

     1. start the Erlang virtual machine, and look for its system PID;
     2. start GDB, and attach it to the running VM (using the 'attach'
        command);
     3. put all the breakpoints you need (if the function you want to
        monitor does not exist, GDB will prompt for making "the
        breakpoint pending on future shared library load");
     4. use the GDB 'continue' command to let the VM run.  GDB will
        notify when new libraries (or Erlang linked-in drivers) are
        loaded, and pending breakpoints become active.

Have fun,
-- 
Alceste Scalas <>
CRS4 - http://www.crs4.it/




More information about the erlang-questions mailing list