Skip to contentSkip to conversation

Documentation: add debugging doc

PATCH In review Davidlohr Bueso 3 participants 5 messages Aug 7, 2011 – Aug 23, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: add debugging doc

From: Davidlohr Bueso <[email protected]>

Layout the base for tips on debugging util-linux programs/wrappers.

---
 Documentation/README.debug |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/README.debug
Documentation/README.debug new file +30 -0
new file mode 100644
index 0000000..7ead12f
@@ -0,0 +1,30 @@
+Debugging util-linux programs
+-----------------------------
+
+There are considerations to be made when profiling or debugging some programs found
+in the util-linux package. Because wrapper scripts are used for the binaries to make
+sure all library dependencies are met, you cannot use tools such as gdb or valgrind
+directly with them.
+
+Let's take for example the mount command:
+
+$> file /path/util-linux/mount/mount
+mount: Bourne-Again shell script text executable
+
+The binary itself is located in the .libs/ dir:
+
+$> file /path/util-linux/mount/.libs/mount
+mount: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
+
+When this command is run, there's a library dependency error:
+./mount: /lib/x86_64-linux-gnu/libblkid.so.1: version `BLKID_2.20' not found (required by ./mount)
+
+To overcome this we need set the LD_LIBRARY_PATH variable to read the path of the shared lib found in
+the sources, and not system-wide:
+
+$> export LD_LIBRARY_PATH=/path/util-linux/libblkid/src/.libs/:$LD_LIBRARY_PATH
+
+Now external debugging tools can be run on the binary.
+
+Happy hacking!
+Davidlohr Bueso, August 2011
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw
Quoted 9 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

Layout the base for tips on debugging util-linux programs/wrappers.

---
 Documentation/README.debug |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/README.debug

I'll merge this change after v2.20 stable release. The v2.20 will be without the Documentation/ directory.

Quoted 2 lines

+When this command is run, there's a library dependency error:
+./mount: /lib/x86_64-linux-gnu/libblkid.so.1: version `BLKID_2.20' not found (required by ./mount)

BTW, for mount I sometimes use --enable-static-programs and then mount/mount.static which is out of the libtool control :-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer
#2 lore raw
In reply to Davidlohr Bueso

Semi, could you add howto-debug to your docs branch?

Karel

Quoted 56 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

Layout the base for tips on debugging util-linux programs/wrappers.

---
 Documentation/README.debug |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/README.debug
Documentation/README.debug new file +30 -0
new file mode 100644
index 0000000..7ead12f
@@ -0,0 +1,30 @@
+Debugging util-linux programs
+-----------------------------
+
+There are considerations to be made when profiling or debugging some programs found
+in the util-linux package. Because wrapper scripts are used for the binaries to make
+sure all library dependencies are met, you cannot use tools such as gdb or valgrind
+directly with them.
+
+Let's take for example the mount command:
+
+$> file /path/util-linux/mount/mount
+mount: Bourne-Again shell script text executable
+
+The binary itself is located in the .libs/ dir:
+
+$> file /path/util-linux/mount/.libs/mount
+mount: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
+
+When this command is run, there's a library dependency error:
+./mount: /lib/x86_64-linux-gnu/libblkid.so.1: version `BLKID_2.20' not found (required by ./mount)
+
+To overcome this we need set the LD_LIBRARY_PATH variable to read the path of the shared lib found in
+the sources, and not system-wide:
+
+$> export LD_LIBRARY_PATH=/path/util-linux/libblkid/src/.libs/:$LD_LIBRARY_PATH
+
+Now external debugging tools can be run on the binary.
+
+Happy hacking!
+Davidlohr Bueso, August 2011
Signature · 8 lines
1.7.4.1



--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com