-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfo_checkpoints.htm
87 lines (79 loc) · 3.23 KB
/
info_checkpoints.htm
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Referensi Perintah GDB - Perintah info checkpoints</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="main">
<h2>Perintah info checkpoints</h2>
<p>Menampilkan daftar checkpoint yang dibuat.</p>
<h4>Sintaks</h4>
<div class="syntax">
<b>info</b> checkpoints<br />
</div>
<p></p>
<h4>Keterangan</h4>
<p>Lihat deskripsi dari perintah <a href="checkpoint.htm"><b>checkpoint</b></a> untuk gambaran umum tentang checkpoint GDB. Gunakan perintah <a href="restart.htm"><b>restart</b></a> untuk kembali ke checkpoint.</p>
<p></p>
<h4>Contoh</h4>
<p>Kami akan menunjukkan penggunaan perintah <b>info checkpoints</b> menggunakan program C++ dasar yang melakukan iterasi dari 0 hingga 9 dan menampilkan pesan dalam setiap iterasi:</p>
<p></p>
<pre>
<code>
#include <stdio.h>
int main(int argc, char **argv)
{
for (int i = 0; i < argc; i++)
printf("Arg %d: %s\n", i, argv[i]);
return 0;
}
</code>
</pre>
<p>Kami akan membuat beberapa checkpoint pada tahapan-tahapan yang berbeda dari eksekusi dan menggunakan perintah <b>info checkpoints</b> untuk menampilkan informasi tentang mereka.</p>
<pre>
<code>
(gdb) start
Temporary breakpoint 1 at 0x804847a: file test.cpp, line 11.
Starting program: /home/bazis/test
Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:11
11 for (int i = 0; i < 10; i++)
(gdb) checkpoint
checkpoint: fork returned pid 2059.
(gdb) step
12 report(i);
(gdb) checkpoint
checkpoint: fork returned pid 2060.
(gdb) step
report (iteration=0) at test.cpp:6
6 printf("Pid %d, iteration %d\n", getpid(), iteration);
(gdb) checkpoint
checkpoint: fork returned pid 2061.
(gdb) info checkpoints
3 process 2061 at 0x8048453, file test.cpp, line 6
2 process 2060 at 0x8048484, file test.cpp, line 12
1 process 2059 at 0x804847a, file test.cpp, line 11
* 0 process 2055 (main process) at 0x8048453, file test.cpp, line 6
(gdb) backtrace
#0 report (iteration=0) at test.cpp:6
#1 0x08048490 in main (argc=1, argv=0xbffff064) at test.cpp:12
(gdb) restart 1
Switching to process 2059
#0 main (argc=1, argv=0xbffff064) at test.cpp:11
11 for (int i = 0; i < 10; i++)
(gdb) backtrace
#0 main (argc=1, argv=0xbffff064) at test.cpp:11
(gdb) restart 0
Switching to process 2055
#0 report (iteration=0) at test.cpp:6
6 printf("Pid %d, iteration %d\n", getpid(), iteration);
</code>
</pre>
</div>
</div>
</div>
</div>
</body>
</html>