zoukankan      html  css  js  c++  java
  • Setting Up MySQL Debugging Environment

    Setting Up MySQL Debugging Environment

    Setting Up MySQL Debugging Environment

    It is strongly recommened to refer to the mysql documentation for debugging and compiling mysql sources. After configuring the debugging environment, I write this post to make further environment setting easier with just few scirpts running for others who are trying to understanding the internals of MySQL.

    In the following setting, I assume you are working on a linux machine, and you are carrying on with the process of "modifying-recompiling-testing" the functions of mysql. So I suggest installing the mysql binaries into a tempory directory, /dev/shm, which is backed by DRAM, you will get good performance.

    1 Get the source files from mysql.

    I will leave out the details of this step, follow the guidelines from the mysql website.

    2 Compile & Install with cmake/make.

    The latest mysql uses cmake to configure the features of mysql and uses make to compile and install. Using the following scirpts to automate the configuring and installation.

    In the topmost directory of mysql source tree, issue the following commands:

    mkdir bld
    cd bld
    #this makes the bld directory hold the output files
    cmake .. -DCMAKE_BUILD_TYPE=Debug
    make -j16
    rm -rf /dev/shm/usr
    #install to the shm directory
    make install DESTDIR="/dev/shm"
    #Install the system tables
    /dev/shm/usr/local/mysql/scripts/mysql_install_db –basedir=/dev/shm/usr/local/mysql –datadir=/dev/shm/usr/local/mysql/data

    Alternatively, you can copy the contents of the above commands into a shell, and execute that script each time you modify the source files.

    3 Start mysqld, the server.

    We use gdb to start the mysqld process so that we can debug the code.

    gdb –args /run/shm/usr/local/mysql/bin/mysqld –basedir=/run/shm/usr/local/mysql –datadir=/run/shm/usr/local/mysql/data –skip-networking

    http://images2015.cnblogs.com/blog/598435/201605/598435-20160510101857093-1666773433.jpg

    Add a breakpoint:

    http://images2015.cnblogs.com/blog/598435/201605/598435-20160510101858327-2079619364.jpg

    Issue run command in gdb window, to start the server process.

    http://images2015.cnblogs.com/blog/598435/201605/598435-20160510101859999-1508786007.jpg

    The message in red box shows the client can connect to the server with the socket.

    4 Start another termial window, and start a client.

    /dev/shm/usr/local/mysql/bin/mysql -S /tmp/mysql.sock

    Now the server is stopped at the breakpoint.

    http://images2015.cnblogs.com/blog/598435/201605/598435-20160510101901171-118050993.jpg

    5 Enjoy it!

    Author: wujing

    Created: 2016-05-10 Tue 10:19

    Emacs 24.5.1 (Org mode 8.2.10)

  • 相关阅读:
    FCKeditor 2.3 在ASP.NET中的设置和使用
    如何去掉重复记录的Sql语句写法
    asp.net如何去掉HTML标记
    Asp.net中如何删除cookie?
    怎样得到select所有option里的值
    HttpModule是如何工作的
    Asp.net2.0下的表单验证Cookieless属性
    FreeTextBox实现机制
    ajax实现动态从数据库模糊查询显示到下拉框中(ajax方法返回Dataset的例子)
    新浪博客自动发表程序,请勿用于非法用途
  • 原文地址:https://www.cnblogs.com/wujingcqu/p/5476845.html
Copyright © 2011-2022 走看看