Debug MySQL using gdb

Source: Internet
Author: User
After compiling and installing MySQL, you can use gdb to track the execution of the mysql server.

After compiling and installing MySQL, you can use gdb to track the execution of the mysql server.

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.