forked from srinirad/pps-IA1-practice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p4debuglog.txt
138 lines (137 loc) · 3.23 KB
/
p4debuglog.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
gcc -g p4original.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 0x8f6: file p4original.c, line 35.
(gdb) r
Starting program: /home/runner/pps-IA1-practice-2/a.out
warning: Error disabling address space randomization: Operation not permitted
Breakpoint 1, main () at p4original.c:35
35 {
(gdb) n
37 n=input_array_size();
(gdb) s
input_array_size () at p4original.c:3
3 {
(gdb) n
5 printf("enter array size\n");
(gdb) n
enter array size
6 scanf("%d",&n);
(gdb) n
4
7 return n;
(gdb) n
8 }
(gdb) n
main () at p4original.c:38
38 int a[n];
(gdb) p n
$1 = 4
(gdb) n
39 input_array( n, a);
(gdb) s
input_array (n=4, a=0x7ffd8346b590) at p4original.c:11
11 printf("enter array elements");
(gdb) n
12 for(int i=0;i<n;i++)
(gdb) n
14 scanf("%d",&a[i]);
(gdb) n
enter array elements1
12 for(int i=0;i<n;i++)
(gdb) 6
Undefined command: "6". Try "help".
(gdb) n
14 scanf("%d",&a[i]);
(gdb) n
4
12 for(int i=0;i<n;i++)
(gdb) n
14 scanf("%d",&a[i]);
(gdb) n
7
12 for(int i=0;i<n;i++)
(gdb) n
14 scanf("%d",&a[i]);
(gdb) n
8
12 for(int i=0;i<n;i++)
(gdb) n
16 }
(gdb) n
main () at p4original.c:40
40 sum=sum_n_arrays( n , a);
(gdb) s
sum_n_arrays (n=4, a=0x7ffd8346b590) at p4original.c:19
19 int sum=0;
(gdb) n
20 for(int i=0;i<n;i++)
(gdb) n
22 sum=sum+a[i];
(gdb) n
20 for(int i=0;i<n;i++)
(gdb) n
22 sum=sum+a[i];
(gdb) n
20 for(int i=0;i<n;i++)
(gdb) n
22 sum=sum+a[i];
(gdb) n
20 for(int i=0;i<n;i++)
(gdb) n
22 sum=sum+a[i];
(gdb) n
20 for(int i=0;i<n;i++)
(gdb) n
24 return sum;
(gdb) n
25 }
(gdb) n
main () at p4original.c:41
41 out_put( n, a, sum);
(gdb) s
out_put (n=4, a=0x7ffd8346b590, sum=20) at p4original.c:28
28 for(int i=0;i<n-1;i++)
(gdb) n
30 printf("%d+",a[i]);
(gdb) n
28 for(int i=0;i<n-1;i++)
(gdb) n
30 printf("%d+",a[i]);
(gdb) n
28 for(int i=0;i<n-1;i++)
(gdb) n
30 printf("%d+",a[i]);
(gdb) n
28 for(int i=0;i<n-1;i++)
(gdb) n
32 printf("%d is %d",a[n-1],sum);
(gdb) n
33 }
(gdb) n
main () at p4original.c:42
42 return 0;
(gdb) n
43 }(gdb) n
__libc_start_main (main=0x55c2c7c008e5 <main>, argc=1, argv=0x7ffd8346b6e8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7ffd8346b6d8) at ../csu/libc-start.c:344
344 ../csu/libc-start.c: No such file or directory.
(gdb) n
1+4+7+8 is 20[Inferior 1 (process 357) exited normally]
(gdb)