转载自:https://dev.mysql.com/doc/internals/en/guided-tour-major-directories-test.html
To run a test named some.test
with the debugger in embedded mode you could do this:
-
Run
libmysqld/examples/test_run --gdb some.test
. This creates alibmysqld/examples/test-gdbinit
file which contains the required parameters for mysqltest. -
Make a copy of the
test-gdbinit
file (call it, for example,some-gdbinit
). Thetest-gdbinit
file will be removed aftertest-run --gdb
has finished. -
Load
libmysqld/examples/mysqltest_embedded
into your favorite debugger, for example:gdb mysqltest_embedded
. -
In the debugger, for example in
gdb
, do:--sou some-gdbinit
Now some.test
is running, and you can see if it's passing or not.
If you just want to debug some queries with the embedded server (not the test), it's easier to just run libmysqld/examples/mysql
. It's the embedded server-based clone of the usual mysql tool, and works fine under gdb or whatever your favorite debugger is.