After compiling and installing MySQL, you can use gdb to track the execution of the mysql server.
Gdb -- args/usr/local/mysql/libexec/mysqld
(Gdb) B mysql_select
Breakpoint 1 at 0x8228b7d: file SQL _select.cc, line 2315.
(Gdb) B my_net_read
Breakpoint 2 at 0x81a13e4: file net_serv.cc, line 993.
(Gdb) run
Starting program:/usr/local/mysql/libexec/mysqld
[Thread debugging using libthread_db enabled]
[New Thread 0xb7feeb70 (LWP 1373)]
[Thread 0xb7feeb70 (LWP 1373) exited]
[New Thread 0xb77edb70 (LWP 1374)]
110225 22:36:33 [Note] Event schedents: Loaded 0 events
110225 22:36:33 [Note]/usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5. 1.34-debug' socket: '/tmp/mysql. sock' port: 3306 Source distribution
Log on to the client and run the mysql client through another shelll.
Gdb displays the following information:
[New Thread 0xb77ccb70 (LWP 1410)]
[Switching to Thread 0xb77ccb70 (LWP 1410)]
Breakpoint 2, my_net_read (net = 0x85610bc) at net_serv.cc: 993
993 if (! Net-> compress)
(Gdb)
Indicates that the breakpoint is successfully set.