From 1e0099a33f395566af782f8044f8b56cd9642bdf Mon Sep 17 00:00:00 2001 From: Guy Lichtman Date: Fri, 31 Jan 2014 12:08:49 -0800 Subject: [PATCH] Added info on offset extraction for Debian distros. --- Troubleshooting.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Troubleshooting.md b/Troubleshooting.md index e6dc33b..19fd2fe 100644 --- a/Troubleshooting.md +++ b/Troubleshooting.md @@ -75,4 +75,27 @@ Then try installing the AUDIT plugin either via plugin-load configuration option ./offset-extract.sh /usr/sbin/mysqld /usr/lib/debug/usr/sbin/mysqld.debug -Notice that the mysqld debug symbols may be named also: `/usr/lib/debug/usr/sbin/mysqld` (no `.debug`). Make sure not to confuse this with `mysqld-debug`, which is a separate executable. \ No newline at end of file +Notice that the mysqld debug symbols may be named also: `/usr/lib/debug/usr/sbin/mysqld` (no `.debug`). Make sure not to confuse this with `mysqld-debug`, which is a separate executable. + +**Offsets on Debian distributions:** On Debian (and Ubuntu) distributions debug symbols are not shipped with the mysql server distribution. There is need to compile from source in order to extract the offsets. Example steps for compiling from source with debug symbols: + +* Download source code by running: `apt-get source mysql-server` +* Extract source: `dpkg-source -x mysql-.dsc` +* Change into extract dir: `mysql-` +* Modify `debian/rules` file to add "-g" flag to CFLAGS and CXXFLAGS passed to cmake. Example diff of modifications: + +``` +#diff debian/rules debian/rules.org +93c93 +< CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-g -O2 -DBIG_JOINS=1 ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \ +--- +> CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -DBIG_JOINS=1 ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \ +95c95 +< CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-g -O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \ +--- +> CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \ + +``` + +* Build mysql with "nostrip" option: `DEB_BUILD_OPTIONS="nostrip" dpkg-buildpackage -b -uc` +* Resulting mysqld file available at: `builddir/sql/mysqld` now contains debug symbols and you can extract the offsets from this binary.