时间:2021-07-01 10:21:17 帮助过:107人阅读
在编译安装完MySQL后,就可以使用gdb来跟踪mysql服务器的执行了。
在编译安装完MySQL后,,就可以使用gdb来跟踪mysql服务器的执行了。
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 Scheduler: 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
此时在登陆客户端,通过另外一个shelll运行mysql客户端
gdb会出现如下信息:
[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)
表明设置断点成功。