gdb 調試MySQL

來源:互聯網
上載者:User

在編譯安裝完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)

表明設定斷點成功。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.