bedroomCod3r
September 30th, 2011, 05:42 AM
Hi,
I'm having a problem regarding gdb. The gdb keeps on displaying no such file or directory every time I use step command in printf();. This surprise me because I don't have this problem on my previous installation (lucid). I don't know whats going on.
Below is the log of the session.
******@g****:~/programs/any$ gdb ./myprg
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/carl/programs/any/myprg...done.
(gdb) list
1 /* This simple program purpose is to test the debugger */
2 #include <stdio.h>
3 #define MAX 32
4 int main()
5 {
6 int num = 0;
7 int i, ch;
8 char name[MAX];
9
10 printf("%s", "Enter String here: ");
(gdb)
11 for(i = 0;(ch = getchar()) != '\n' && i < 32;++i)
12 name[i] = ch;
13 name[i] = '\0';
14
15 printf("%s", "Enter number: ");
16 scanf("%d", &num);
17
18 printf("%s%s\n", "Your name is ", name);
19 printf("%s%d\n", "Your inputed number is ", num);
20
(gdb)
21 return 0;
22 }
(gdb) break 10
Breakpoint 1 at 0x80484c1: file myprg.c, line 10.
(gdb) run
Starting program: /home/****/programs/any/myprg
Breakpoint 1, main () at myprg.c:10
10 printf("%s", "Enter String here: ");
(gdb) step
__printf (format=0x8048650 "%s") at printf.c:29
29 printf.c: No such file or directory.
in printf.c
(gdb) q
A debugging session is active.
Inferior 1 [process 1948] will be killed.
Quit anyway? (y or n) y
***@****:~/programs/any$
Tried some simple troubleshooting by adding -d flag but no luck
****@*****:~/programs/any$ gdb -d /usr/include/ ./myprg
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/****/programs/any/myprg...done.
(gdb) list
1 /* This simple program purpose is to test the debugger */
2 #include <stdio.h>
3 #define MAX 32
4 int main()
5 {
6 int num = 0;
7 int i, ch;
8 char name[MAX];
9
10 printf("%s", "Enter String here: ");
(gdb)
11 for(i = 0;(ch = getchar()) != '\n' && i < 32;++i)
12 name[i] = ch;
13 name[i] = '\0';
14
15 printf("%s", "Enter number: ");
16 scanf("%d", &num);
17
18 printf("%s%s\n", "Your name is ", name);
19 printf("%s%d\n", "Your inputed number is ", num);
20
(gdb)
21 return 0;
22 }
(gdb) break 10
Breakpoint 1 at 0x80484c1: file myprg.c, line 10.
(gdb) step
The program is not being run.
(gdb) run
Starting program: /home/***/programs/any/myprg
Breakpoint 1, main () at myprg.c:10
10 printf("%s", "Enter String here: ");
(gdb) step
__printf (format=0x8048650 "%s") at printf.c:29
29 printf.c: No such file or directory.
in printf.c
(gdb) q
A debugging session is active.
Inferior 1 [process 2128] will be killed.
Quit anyway? (y or n) y
*****@*****:~/programs/any$
Need your guidance,
Thank you
I'm having a problem regarding gdb. The gdb keeps on displaying no such file or directory every time I use step command in printf();. This surprise me because I don't have this problem on my previous installation (lucid). I don't know whats going on.
Below is the log of the session.
******@g****:~/programs/any$ gdb ./myprg
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/carl/programs/any/myprg...done.
(gdb) list
1 /* This simple program purpose is to test the debugger */
2 #include <stdio.h>
3 #define MAX 32
4 int main()
5 {
6 int num = 0;
7 int i, ch;
8 char name[MAX];
9
10 printf("%s", "Enter String here: ");
(gdb)
11 for(i = 0;(ch = getchar()) != '\n' && i < 32;++i)
12 name[i] = ch;
13 name[i] = '\0';
14
15 printf("%s", "Enter number: ");
16 scanf("%d", &num);
17
18 printf("%s%s\n", "Your name is ", name);
19 printf("%s%d\n", "Your inputed number is ", num);
20
(gdb)
21 return 0;
22 }
(gdb) break 10
Breakpoint 1 at 0x80484c1: file myprg.c, line 10.
(gdb) run
Starting program: /home/****/programs/any/myprg
Breakpoint 1, main () at myprg.c:10
10 printf("%s", "Enter String here: ");
(gdb) step
__printf (format=0x8048650 "%s") at printf.c:29
29 printf.c: No such file or directory.
in printf.c
(gdb) q
A debugging session is active.
Inferior 1 [process 1948] will be killed.
Quit anyway? (y or n) y
***@****:~/programs/any$
Tried some simple troubleshooting by adding -d flag but no luck
****@*****:~/programs/any$ gdb -d /usr/include/ ./myprg
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/****/programs/any/myprg...done.
(gdb) list
1 /* This simple program purpose is to test the debugger */
2 #include <stdio.h>
3 #define MAX 32
4 int main()
5 {
6 int num = 0;
7 int i, ch;
8 char name[MAX];
9
10 printf("%s", "Enter String here: ");
(gdb)
11 for(i = 0;(ch = getchar()) != '\n' && i < 32;++i)
12 name[i] = ch;
13 name[i] = '\0';
14
15 printf("%s", "Enter number: ");
16 scanf("%d", &num);
17
18 printf("%s%s\n", "Your name is ", name);
19 printf("%s%d\n", "Your inputed number is ", num);
20
(gdb)
21 return 0;
22 }
(gdb) break 10
Breakpoint 1 at 0x80484c1: file myprg.c, line 10.
(gdb) step
The program is not being run.
(gdb) run
Starting program: /home/***/programs/any/myprg
Breakpoint 1, main () at myprg.c:10
10 printf("%s", "Enter String here: ");
(gdb) step
__printf (format=0x8048650 "%s") at printf.c:29
29 printf.c: No such file or directory.
in printf.c
(gdb) q
A debugging session is active.
Inferior 1 [process 2128] will be killed.
Quit anyway? (y or n) y
*****@*****:~/programs/any$
Need your guidance,
Thank you