forked from srinirad/IA1-Revision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3debuglog.txt
115 lines (114 loc) · 2.74 KB
/
p3debuglog.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
gcc -g p3final.c
gdb a.out
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 a.out...done.
(gdb) b main
Breakpoint 1 at 0x85a: file p3final.c, line 29.
(gdb) r
Starting program: /home/runner/IA1-Revision/a.out
warning: Error disabling address space randomization: Operation not permitted
Breakpoint 1, main () at p3final.c:29
29 int n,sum=0;
(gdb) n
30 n=input_n();
(gdb) s
input_n () at p3final.c:3
3 {
(gdb) n
5 printf("enter the maximum number\n");
(gdb) n
enter the maximum number
6 scanf("%d",&n);
(gdb) n
5
7 return n;
(gdb) n
8 }
(gdb) p n
$1 = 5
(gdb) n
main () at p3final.c:31
31 sum=sum_n(n);
(gdb) s
sum_n (n=5) at p3final.c:11
11 int sum=0;
(gdb) n
12 for(int i=1;i<=n;i++)
(gdb) n
14 sum=sum+i;
(gdb) n
12 for(int i=1;i<=n;i++)
(gdb) n
14 sum=sum+i;
(gdb) n
12 for(int i=1;i<=n;i++)
(gdb) n
14 sum=sum+i;
(gdb) n
12 for(int i=1;i<=n;i++)
(gdb) n
14 sum=sum+i;
(gdb) n
12 for(int i=1;i<=n;i++)
(gdb) n
14 sum=sum+i;
(gdb) n
12 for(int i=1;i<=n;i++)
(gdb) n
16 return sum;
(gdb) n
17 }
(gdb) n
main () at p3final.c:32
32 output(n,sum);
(gdb) s
output (n=5, sum=15) at p3final.c:20
20 printf("sum of ");
(gdb) n
21 for(int i=1;i<n;i++)
(gdb) n
23 printf("%d+",i);
(gdb) n
21 for(int i=1;i<n;i++)
(gdb) n
23 printf("%d+",i);
(gdb) n
21 for(int i=1;i<n;i++)
(gdb) n
23 printf("%d+",i);
(gdb) n
21 for(int i=1;i<n;i++)
(gdb) n
23 printf("%d+",i);
(gdb) n
21 for(int i=1;i<n;i++)
(gdb) n
25 printf("%d is %d",n,sum);
(gdb) n
26 }
(gdb) n
main () at p3final.c:33
33 return 0;
(gdb) n
34 }(gdb) p sum
$2 = 15
(gdb) n
__libc_start_main (main=0x55a9b8600852 <main>, argc=1, argv=0x7ffff2060948,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7ffff2060938) at ../csu/libc-start.c:344
344 ../csu/libc-start.c: No such file or directory.
(gdb) n
sum of 1+2+3+4+5 is 15[Inferior 1 (process 504) exited normally]