The debugger plugin closes the debugging section if you try to do a [Step in] to any glibc sys function.
GDB throws an exception with "No such file or directory." and the debugging section is then stopped or closed.
We need a way to pass to the debugger plugin where the source code of glibc is, so no exception is raised.
Example:
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./minicom...done.
(gdb) b 77
Breakpoint 1 at 0x5365: file minicom.c, line 77.
(gdb) s
The program is not being run.
(gdb) run
Starting program: /apps/minicom-2.7.1/debian/minicom/usr/bin/minicom -D /dev/ttyUSB1
Lockfile is stale. Overriding it..
Breakpoint 1, port_init () at minicom.c:77
77 m_setparms(portfd, P_BAUDRATE, P_PARITY, P_BITS, P_STOPB,
(gdb) s
78 P_HASRTS[0] == 'Y', P_HASXON[0] == 'Y');
(gdb) s
77 m_setparms(portfd, P_BAUDRATE, P_PARITY, P_BITS, P_STOPB,
(gdb) s
m_setparms (fd=3, baudr=0x5555557866e0 <mpars+4032> "1500000",
par=0x555555786800 <mpars+4320> "N", bits=0x555555786770 <mpars+4176> "8",
stopb=0x555555786890 <mpars+4464> "1", hwf=1, swf=0) at sysdep1.c:396
396 {
(gdb) s
397 int spd = -1;
(gdb) s
399 int bit = bits[0];
(gdb) s
408 if (portfd_is_socket)
(gdb) s
413 tcgetattr(fd, &tty);
(gdb) s
__GI___tcgetattr (fd=3, termios_p=0x7fffffffde30)
at ../sysdeps/unix/sysv/linux/tcgetattr.c:34
34 ../sysdeps/unix/sysv/linux/tcgetattr.c: No such file or directory.
(gdb) s
38 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
34 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
38 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
40 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
46 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
63 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
42 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
63 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) s
42 in ../sysdeps/unix/sysv/linux/tcgetattr.c
(gdb) n
Warning:
Cannot insert breakpoint 0.
Cannot access memory at address 0x1ec4635941ad2a3e
__longjmp () at ../sysdeps/x86_64/__longjmp.S:45
45 ../sysdeps/x86_64/__longjmp.S: No such file or directory.
(gdb)
With GDB you can pass a parameter informing where to search for glibc source code, here is how:
-d "directory to search"
sudo gdb -d /apps/libc6/glibc-2.27/stamp-dir --args ./minicom -D /dev/ttyUSB1
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./minicom...done.
(gdb) show directories
Source directories searched: /apps/libc6/glibc-2.27/stamp-dir:$cdir:$cwd
(gdb) b 77
Breakpoint 1 at 0x5365: file minicom.c, line 77.
(gdb) run
Starting program: /apps/minicom-2.7.1/debian/minicom/usr/bin/minicom -D /dev/ttyUSB1
Lockfile is stale. Overriding it..
Breakpoint 1, port_init () at minicom.c:77
77 m_setparms(portfd, P_BAUDRATE, P_PARITY, P_BITS, P_STOPB,
(gdb) s
78 P_HASRTS[0] == 'Y', P_HASXON[0] == 'Y');
(gdb) s
77 m_setparms(portfd, P_BAUDRATE, P_PARITY, P_BITS, P_STOPB,
(gdb) s
m_setparms (fd=3, baudr=0x5555557866e0 <mpars+4032> "1500000",
par=0x555555786800 <mpars+4320> "N", bits=0x555555786770 <mpars+4176> "8",
stopb=0x555555786890 <mpars+4464> "1", hwf=1, swf=0) at sysdep1.c:396
396 {
(gdb) s
397 int spd = -1;
(gdb) s
399 int bit = bits[0];
(gdb) s
408 if (portfd_is_socket)
(gdb) s
413 tcgetattr(fd, &tty);
(gdb) s
__GI___tcgetattr (fd=3, termios_p=0x7fffffffde10)
at ../sysdeps/unix/sysv/linux/tcgetattr.c:34
34 {
(gdb) s
38 retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
(gdb) s
34 {
(gdb) info source
Current source file is ../sysdeps/unix/sysv/linux/tcgetattr.c
Compilation directory is /build/glibc-CVJwZb/glibc-2.27/termios
Located in /apps/libc6/glibc-2.27/sysdeps/unix/sysv/linux/tcgetattr.c
Contains 80 lines.
Source language is c.
Producer is GNU C11 7.5.0 -mtune=generic -march=x86-64 -g -O2 -O3 -std=gnu11 -fgnu89-inline -fmerge-all-constants -frounding-math -fstack-protector-strong -fPIC -ftls-model=initial-exec -fstack-protector-strong.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb)
I think there must be a way to tell the debugger plugin to pass the directory to search, so the debugging section is not closed.
I am still searching if is not possible to export a variable previous to debug with Geany to bypass the error.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.