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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
|
@c \input texinfo @c -*-texinfo-*-
@c @c %**start of header
@c @setfilename gdbmi.info
@c @settitle GDB/MI Machine Interface
@c @setchapternewpage off
@c @c %**end of header
@c @ifinfo
@c This file documents GDB/MI, a Machine Interface to GDB.
@c Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
@c Contributed by Cygnus Solutions.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.1 or
@c any later version published by the Free Software Foundation; with no
@c Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
@c and with the Back-Cover Texts as in (a) below.
@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
@c this GNU Manual, like GNU software. Copies published by the Free
@c Software Foundation raise funds for GNU development.''
@c @end ifinfo
@c @c This title page illustrates only one of the
@c @c two methods of forming a title page.
@c @titlepage
@c @title GDB/MI
@c @subtitle Version 0.3
@c @subtitle Apr 2001
@c @author Andrew Cagney, Fernando Nasser and Elena Zannoni
@c @c The following two commands
@c @c start the copyright page.
@c @page
@c @vskip 0pt plus 1filll
@c Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.1 or
@c any later version published by the Free Software Foundation; with no
@c Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
@c and with the Back-Cover Texts as in (a) below.
@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
@c this GNU Manual, like GNU software. Copies published by the Free
@c Software Foundation raise funds for GNU development.''
@c @end titlepage
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% CHAPTER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI
@chapter The @sc{gdb/mi} Interface
@unnumberedsec Function and Purpose
@cindex @sc{gdb/mi}, its purpose
@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is
specifically intended to support the development of systems which use
the debugger as just one small component of a larger system.
This chapter is a specification of the @sc{gdb/mi} interface. It is written
in the form of a reference manual.
Note that @sc{gdb/mi} is still under construction, so some of the
features described below are incomplete and subject to change.
@unnumberedsec Notation and Terminology
@cindex notational conventions, for @sc{gdb/mi}
This chapter uses the following notation:
@itemize @bullet
@item
@code{|} separates two alternatives.
@item
@code{[ @var{something} ]} indicates that @var{something} is optional:
it may or may not be given.
@item
@code{( @var{group} )*} means that @var{group} inside the parentheses
may repeat zero or more times.
@item
@code{( @var{group} )+} means that @var{group} inside the parentheses
may repeat one or more times.
@item
@code{"@var{string}"} means a literal @var{string}.
@end itemize
@ignore
@heading Dependencies
@end ignore
@heading Acknowledgments
In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
Elena Zannoni.
@menu
* GDB/MI Command Syntax::
* GDB/MI Compatibility with CLI::
* GDB/MI Output Records::
* GDB/MI Command Description Format::
* GDB/MI Breakpoint Table Commands::
* GDB/MI Data Manipulation::
* GDB/MI Program Control::
* GDB/MI Miscellaneous Commands::
@ignore
* GDB/MI Kod Commands::
* GDB/MI Memory Overlay Commands::
* GDB/MI Signal Handling Commands::
@end ignore
* GDB/MI Stack Manipulation::
* GDB/MI Symbol Query::
* GDB/MI Target Manipulation::
* GDB/MI Thread Commands::
* GDB/MI Tracepoint Commands::
* GDB/MI Variable Objects::
@end menu
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Command Syntax
@section @sc{gdb/mi} Command Syntax
@menu
* GDB/MI Input Syntax::
* GDB/MI Output Syntax::
* GDB/MI Simple Examples::
@end menu
@node GDB/MI Input Syntax
@subsection @sc{gdb/mi} Input Syntax
@cindex input syntax for @sc{gdb/mi}
@cindex @sc{gdb/mi}, input syntax
@table @code
@item @var{command} @expansion{}
@code{@var{cli-command} | @var{mi-command}}
@item @var{cli-command} @expansion{}
@code{[ @var{token} ] @var{cli-command} @var{nl}}, where
@var{cli-command} is any existing @value{GDBN} CLI command.
@item @var{mi-command} @expansion{}
@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
@item @var{token} @expansion{}
"any sequence of digits"
@item @var{option} @expansion{}
@code{"-" @var{parameter} [ " " @var{parameter} ]}
@item @var{parameter} @expansion{}
@code{@var{non-blank-sequence} | @var{c-string}}
@item @var{operation} @expansion{}
@emph{any of the operations described in this chapter}
@item @var{non-blank-sequence} @expansion{}
@emph{anything, provided it doesn't contain special characters such as
"-", @var{nl}, """ and of course " "}
@item @var{c-string} @expansion{}
@code{""" @var{seven-bit-iso-c-string-content} """}
@item @var{nl} @expansion{}
@code{CR | CR-LF}
@end table
@noindent
Notes:
@itemize @bullet
@item
The CLI commands are still handled by the @sc{mi} interpreter; their
output is described below.
@item
The @code{@var{token}}, when present, is passed back when the command
finishes.
@item
Some @sc{mi} commands accept optional arguments as part of the parameter
list. Each option is identified by a leading @samp{-} (dash) and may be
followed by an optional argument parameter. Options occur first in the
parameter list and can be delimited from normal parameters using
@samp{--} (this is useful when some parameters begin with a dash).
@end itemize
Pragmatics:
@itemize @bullet
@item
We want easy access to the existing CLI syntax (for debugging).
@item
We want it to be easy to spot a @sc{mi} operation.
@end itemize
@node GDB/MI Output Syntax
@subsection @sc{gdb/mi} Output Syntax
@cindex output syntax of @sc{gdb/mi}
@cindex @sc{gdb/mi}, output syntax
The output from @sc{gdb/mi} consists of zero or more out-of-band records
followed, optionally, by a single result record. This result record
is for the most recent command. The sequence of output records is
terminated by @samp{(@value{GDBP})}.
If an input command was prefixed with a @code{@var{token}} then the
corresponding output for that command will also be prefixed by that same
@var{token}.
@table @code
@item @var{output} @expansion{}
@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
@item @var{result-record} @expansion{}
@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
@item @var{out-of-band-record} @expansion{}
@code{@var{async-record} | @var{stream-record}}
@item @var{async-record} @expansion{}
@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}}
@item @var{exec-async-output} @expansion{}
@code{[ @var{token} ] "*" @var{async-output}}
@item @var{status-async-output} @expansion{}
@code{[ @var{token} ] "+" @var{async-output}}
@item @var{notify-async-output} @expansion{}
@code{[ @var{token} ] "=" @var{async-output}}
@item @var{async-output} @expansion{}
@code{@var{async-class} ( "," @var{result} )* @var{nl}}
@item @var{result-class} @expansion{}
@code{"done" | "running" | "connected" | "error" | "exit"}
@item @var{async-class} @expansion{}
@code{"stopped" | @var{others}} (where @var{others} will be added
depending on the needs---this is still in development).
@item @var{result} @expansion{}
@code{ @var{variable} "=" @var{value}}
@item @var{variable} @expansion{}
@code{ @var{string} }
@item @var{value} @expansion{}
@code{ @var{const} | @var{tuple} | @var{list} }
@item @var{const} @expansion{}
@code{@var{c-string}}
@item @var{tuple} @expansion{}
@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" }
@item @var{list} @expansion{}
@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "["
@var{result} ( "," @var{result} )* "]" }
@item @var{stream-record} @expansion{}
@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
@item @var{console-stream-output} @expansion{}
@code{"~" @var{c-string}}
@item @var{target-stream-output} @expansion{}
@code{"@@" @var{c-string}}
@item @var{log-stream-output} @expansion{}
@code{"&" @var{c-string}}
@item @var{nl} @expansion{}
@code{CR | CR-LF}
@item @var{token} @expansion{}
@emph{any sequence of digits}.
@end table
@noindent
Notes:
@itemize @bullet
@item
All output sequences end in a single line containing a period.
@item
The @code{@var{token}} is from the corresponding request. If an execution
command is interrupted by the @samp{-exec-interrupt} command, the
@var{token} associated with the @samp{*stopped} message is the one of the
original execution command, not the one of the interrupt command.
@item
@cindex status output in @sc{gdb/mi}
@var{status-async-output} contains on-going status information about the
progress of a slow operation. It can be discarded. All status output is
prefixed by @samp{+}.
@item
@cindex async output in @sc{gdb/mi}
@var{exec-async-output} contains asynchronous state change on the target
(stopped, started, disappeared). All async output is prefixed by
@samp{*}.
@item
@cindex notify output in @sc{gdb/mi}
@var{notify-async-output} contains supplementary information that the
client should handle (e.g., a new breakpoint information). All notify
output is prefixed by @samp{=}.
@item
@cindex console output in @sc{gdb/mi}
@var{console-stream-output} is output that should be displayed as is in the
console. It is the textual response to a CLI command. All the console
output is prefixed by @samp{~}.
@item
@cindex target output in @sc{gdb/mi}
@var{target-stream-output} is the output produced by the target program.
All the target output is prefixed by @samp{@@}.
@item
@cindex log output in @sc{gdb/mi}
@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
instance messages that should be displayed as part of an error log. All
the log output is prefixed by @samp{&}.
@item
@cindex list output in @sc{gdb/mi}
New @sc{gdb/mi} commands should only output @var{lists} containing
@var{values}.
@end itemize
@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more
details about the various output records.
@node GDB/MI Simple Examples
@subsection Simple Examples of @sc{gdb/mi} Interaction
@cindex @sc{gdb/mi}, simple examples
This subsection presents several simple examples of interaction using
the @sc{gdb/mi} interface. In these examples, @samp{->} means that the
following line is passed to @sc{gdb/mi} as input, while @samp{<-} means
the output received from @sc{gdb/mi}.
@subsubheading Target Stop
@c Ummm... There is no "-stop" command. This assumes async, no?
Here's an example of stopping the inferior process:
@example
-> -stop
<- (@value{GDBP})
@end example
@noindent
and later:
@example
<- *stop,reason="stop",address="0x123",source="a.c:123"
<- (@value{GDBP})
@end example
@subsubheading Simple CLI Command
Here's an example of a simple CLI command being passed through
@sc{gdb/mi} and on to the CLI.
@example
-> print 1+2
<- &"print 1+2\n"
<- ~"$1 = 3\n"
<- ^done
<- (@value{GDBP})
@end example
@subsubheading Command With Side Effects
@example
-> -symbol-file xyz.exe
<- *breakpoint,nr="3",address="0x123",source="a.c:123"
<- (@value{GDBP})
@end example
@subsubheading A Bad Command
Here's what happens if you pass a non-existent command:
@example
-> -rubbish
<- ^error,msg="Undefined MI command: rubbish"
<- (@value{GDBP})
@end example
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Compatibility with CLI
@section @sc{gdb/mi} Compatibility with CLI
@cindex compatibility, @sc{gdb/mi} and CLI
@cindex @sc{gdb/mi}, compatibility with CLI
To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
accepts existing CLI commands. As specified by the syntax, such
commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
respond.
This mechanism is provided as an aid to developers of @sc{gdb/mi}
clients and not as a reliable interface into the CLI. Since the command
is being interpreteted in an environment that assumes @sc{gdb/mi}
behaviour, the exact output of such commands is likely to end up being
an un-supported hybrid of @sc{gdb/mi} and CLI output.
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Output Records
@section @sc{gdb/mi} Output Records
@menu
* GDB/MI Result Records::
* GDB/MI Stream Records::
* GDB/MI Out-of-band Records::
@end menu
@node GDB/MI Result Records
@subsection @sc{gdb/mi} Result Records
@cindex result records in @sc{gdb/mi}
@cindex @sc{gdb/mi}, result records
In addition to a number of out-of-band notifications, the response to a
@sc{gdb/mi} command includes one of the following result indications:
@table @code
@findex ^done
@item "^done" [ "," @var{results} ]
The synchronous operation was successful, @code{@var{results}} are the return
values.
@item "^running"
@findex ^running
@c Is this one correct? Should it be an out-of-band notification?
The asynchronous operation was successfully started. The target is
running.
@item "^error" "," @var{c-string}
@findex ^error
The operation failed. The @code{@var{c-string}} contains the corresponding
error message.
@end table
@node GDB/MI Stream Records
@subsection @sc{gdb/mi} Stream Records
@cindex @sc{gdb/mi}, stream records
@cindex stream records in @sc{gdb/mi}
@value{GDBN} internally maintains a number of output streams: the console, the
target, and the log. The output intended for each of these streams is
funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
Each stream record begins with a unique @dfn{prefix character} which
identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
Syntax}). In addition to the prefix, each stream record contains a
@code{@var{string-output}}. This is either raw text (with an implicit new
line) or a quoted C string (which does not contain an implicit newline).
@table @code
@item "~" @var{string-output}
The console output stream contains text that should be displayed in the
CLI console window. It contains the textual responses to CLI commands.
@item "@@" @var{string-output}
The target output stream contains any textual output from the running
target.
@item "&" @var{string-output}
The log stream contains debugging messages being produced by @value{GDBN}'s
internals.
@end table
@node GDB/MI Out-of-band Records
@subsection @sc{gdb/mi} Out-of-band Records
@cindex out-of-band records in @sc{gdb/mi}
@cindex @sc{gdb/mi}, out-of-band records
@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of
additional changes that have occurred. Those changes can either be a
consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of
target activity (e.g., target stopped).
The following is a preliminary list of possible out-of-band records.
@table @code
@item "*" "stop"
@end table
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Command Description Format
@section @sc{gdb/mi} Command Description Format
The remaining sections describe blocks of commands. Each block of
commands is laid out in a fashion similar to this section.
Note the the line breaks shown in the examples are here only for
readability. They don't appear in the real output.
Also note that the commands with a non-available example (N.A.@:) are
not yet implemented.
@subheading Motivation
The motivation for this collection of commands.
@subheading Introduction
A brief introduction to this collection of commands as a whole.
@subheading Commands
For each command in the block, the following is described:
@subsubheading Synopsis
@example
-command @var{args}@dots{}
@end example
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} CLI command.
@subsubheading Result
@subsubheading Out-of-band
@subsubheading Notes
@subsubheading Example
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Breakpoint Table Commands
@section @sc{gdb/mi} Breakpoint table commands
@cindex breakpoint commands for @sc{gdb/mi}
@cindex @sc{gdb/mi}, breakpoint commands
This section documents @sc{gdb/mi} commands for manipulating
breakpoints.
@subheading The @code{-break-after} Command
@findex -break-after
@subsubheading Synopsis
@example
-break-after @var{number} @var{count}
@end example
The breakpoint number @var{number} is not in effect until it has been
hit @var{count} times. To see how this is reflected in the output of
the @samp{-break-list} command, see the description of the
@samp{-break-list} command below.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{ignore}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-insert main
^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
(@value{GDBP})
-break-after 1 3
~
^done
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
ignore="3"@}]@}
(@value{GDBP})
@end smallexample
@ignore
@subheading The @code{-break-catch} Command
@findex -break-catch
@subheading The @code{-break-commands} Command
@findex -break-commands
@end ignore
@subheading The @code{-break-condition} Command
@findex -break-condition
@subsubheading Synopsis
@example
-break-condition @var{number} @var{expr}
@end example
Breakpoint @var{number} will stop the program only if the condition in
@var{expr} is true. The condition becomes part of the
@samp{-break-list} output (see the description of the @samp{-break-list}
command below).
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{condition}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-condition 1 1
^done
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
times="0",ignore="3"@}]@}
(@value{GDBP})
@end smallexample
@subheading The @code{-break-delete} Command
@findex -break-delete
@subsubheading Synopsis
@example
-break-delete ( @var{breakpoint} )+
@end example
Delete the breakpoint(s) whose number(s) are specified in the argument
list. This is obviously reflected in the breakpoint list.
@subsubheading @value{GDBN} command
The corresponding @value{GDBN} command is @samp{delete}.
@subsubheading Example
@example
(@value{GDBP})
-break-delete 1
^done
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[]@}
(@value{GDBP})
@end example
@subheading The @code{-break-disable} Command
@findex -break-disable
@subsubheading Synopsis
@example
-break-disable ( @var{breakpoint} )+
@end example
Disable the named @var{breakpoint}(s). The field @samp{enabled} in the
break list is now set to @samp{n} for the named @var{breakpoint}(s).
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{disable}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-disable 2
^done
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
(@value{GDBP})
@end smallexample
@subheading The @code{-break-enable} Command
@findex -break-enable
@subsubheading Synopsis
@example
-break-enable ( @var{breakpoint} )+
@end example
Enable (previously disabled) @var{breakpoint}(s).
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{enable}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-enable 2
^done
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
(@value{GDBP})
@end smallexample
@subheading The @code{-break-info} Command
@findex -break-info
@subsubheading Synopsis
@example
-break-info @var{breakpoint}
@end example
@c REDUNDANT???
Get information about a single breakpoint.
@subsubheading @value{GDBN} command
The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
@subsubheading Example
N.A.
@subheading The @code{-break-insert} Command
@findex -break-insert
@subsubheading Synopsis
@example
-break-insert [ -t ] [ -h ] [ -r ]
[ -c @var{condition} ] [ -i @var{ignore-count} ]
[ -p @var{thread} ] [ @var{line} | @var{addr} ]
@end example
@noindent
If specified, @var{line}, can be one of:
@itemize @bullet
@item function
@c @item +offset
@c @item -offset
@c @item linenum
@item filename:linenum
@item filename:function
@item *address
@end itemize
The possible optional parameters of this command are:
@table @samp
@item -t
Insert a tempoary breakpoint.
@item -h
Insert a hardware breakpoint.
@item -c @var{condition}
Make the breakpoint conditional on @var{condition}.
@item -i @var{ignore-count}
Initialize the @var{ignore-count}.
@item -r
Insert a regular breakpoint in all the functions whose names match the
given regular expression. Other flags are not applicable to regular
expresson.
@end table
@subsubheading Result
The result is in the form:
@example
^done,bkptno="@var{number}",func="@var{funcname}",
file="@var{filename}",line="@var{lineno}"
@end example
@noindent
where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
is the name of the function where the breakpoint was inserted,
@var{filename} is the name of the source file which contains this
function, and @var{lineno} is the source line number within that file.
Note: this format is open to change.
@c An out-of-band breakpoint instead of part of the result?
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-insert main
^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
(@value{GDBP})
-break-insert -t foo
^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
(@value{GDBP})
-break-insert -r foo.*
~int foo(int, int);
^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
(@value{GDBP})
@end smallexample
@subheading The @code{-break-list} Command
@findex -break-list
@subsubheading Synopsis
@example
-break-list
@end example
Displays the list of inserted breakpoints, showing the following fields:
@table @samp
@item Number
number of the breakpoint
@item Type
type of the breakpoint: @samp{breakpoint} or @samp{watchpoint}
@item Disposition
should the breakpoint be deleted or disabled when it is hit: @samp{keep}
or @samp{nokeep}
@item Enabled
is the breakpoint enabled or no: @samp{y} or @samp{n}
@item Address
memory location at which the breakpoint is set
@item What
logical location of the breakpoint, expressed by function name, file
name, line number
@item Times
number of times the breakpoint has been hit
@end table
If there are no breakpoints or watchpoints, the @code{BreakpointTable}
@code{body} field is an empty list.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info break}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
(@value{GDBP})
@end smallexample
Here's an example of the result when there are no breakpoints:
@smallexample
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[]@}
(@value{GDBP})
@end smallexample
@subheading The @code{-break-watch} Command
@findex -break-watch
@subsubheading Synopsis
@example
-break-watch [ -a | -r ]
@end example
Create a watchpoint. With the @samp{-a} option it will create an
@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a
read from or on a write to the memory location. With the @samp{-r}
option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will
trigger only when the memory location is accessed for reading. Without
either of the options, the watchpoint created is a regular watchpoint,
i.e. it will trigger when the memory location is accessed for writing.
@xref{Set Watchpoints, , Setting watchpoints}.
Note that @samp{-break-list} will report a single list of watchpoints and
breakpoints inserted.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
@samp{rwatch}.
@subsubheading Example
Setting a watchpoint on a variable in the @code{main} function:
@smallexample
(@value{GDBP})
-break-watch x
^done,wpt=@{number="2",exp="x"@}
(@value{GDBP})
-exec-continue
^running
^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
value=@{old="-268439212",new="55"@},
frame=@{func="main",args=[],file="recursive2.c",line="5"@}
(@value{GDBP})
@end smallexample
Setting a watchpoint on a variable local to a function. @value{GDBN} will stop
the program execution twice: first for the variable changing value, then
for the watchpoint going out of scope.
@smallexample
(@value{GDBP})
-break-watch C
^done,wpt=@{number="5",exp="C"@}
(@value{GDBP})
-exec-continue
^running
^done,reason="watchpoint-trigger",
wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
frame=@{func="callee4",args=[],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
(@value{GDBP})
-exec-continue
^running
^done,reason="watchpoint-scope",wpnum="5",
frame=@{func="callee3",args=[@{name="strarg",
value="0x11940 \"A string argument.\""@}],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
(@value{GDBP})
@end smallexample
Listing breakpoints and watchpoints, at different points in the program
execution. Note that once the watchpoint goes out of scope, it is
deleted.
@smallexample
(@value{GDBP})
-break-watch C
^done,wpt=@{number="2",exp="C"@}
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00010734",func="callee4",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
bkpt=@{number="2",type="watchpoint",disp="keep",
enabled="y",addr="",what="C",times="0"@}]@}
(@value{GDBP})
-exec-continue
^running
^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
value=@{old="-276895068",new="3"@},
frame=@{func="callee4",args=[],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00010734",func="callee4",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
bkpt=@{number="2",type="watchpoint",disp="keep",
enabled="y",addr="",what="C",times="-5"@}]@}
(@value{GDBP})
-exec-continue
^running
^done,reason="watchpoint-scope",wpnum="2",
frame=@{func="callee3",args=[@{name="strarg",
value="0x11940 \"A string argument.\""@}],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
(@value{GDBP})
-break-list
^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
@{width="40",alignment="2",col_name="what",colhdr="What"@}],
body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
addr="0x00010734",func="callee4",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
(@value{GDBP})
@end smallexample
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Data Manipulation
@section @sc{gdb/mi} Data Manipulation
@cindex data manipulation, in @sc{gdb/mi}
@cindex @sc{gdb/mi}, data manipulation
This section describes the @sc{gdb/mi} commands that manipulate data:
examine memory and registers, evaluate expressions, etc.
@c REMOVED FROM THE INTERFACE.
@c @subheading -data-assign
@c Change the value of a program variable. Plenty of side effects.
@c @subsubheading GDB command
@c set variable
@c @subsubheading Example
@c N.A.
@subheading The @code{-data-disassemble} Command
@findex -data-disassemble
@subsubheading Synopsis
@example
-data-disassemble
[ -s @var{start-addr} -e @var{end-addr} ]
| [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
-- @var{mode}
@end example
@noindent
Where:
@table @samp
@item @var{start-addr}
is the beginning address (or @code{$pc})
@item @var{end-addr}
is the end address
@item @var{filename}
is the name of the file to disassemble
@item @var{linenum}
is the line number to disassemble around
@item @var{lines}
is the the number of disassembly lines to be produced. If it is -1,
the whole function will be disassembled, in case no @var{end-addr} is
specified. If @var{end-addr} is specified as a non-zero value, and
@var{lines} is lower than the number of disassembly lines between
@var{start-addr} and @var{end-addr}, only @var{lines} lines are
displayed; if @var{lines} is higher than the number of lines between
@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr}
are displayed.
@item @var{mode}
is either 0 (meaning only disassembly) or 1 (meaning mixed source and
disassembly).
@end table
@subsubheading Result
The output for each instruction is composed of four fields:
@itemize @bullet
@item Address
@item Func-name
@item Offset
@item Instruction
@end itemize
Note that whatever included in the instruction field, is not manipulated
directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
@subsubheading @value{GDBN} Command
There's no direct mapping from this command to the CLI.
@subsubheading Example
Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
@smallexample
(@value{GDBP})
-data-disassemble -s $pc -e "$pc + 20" -- 0
^done,
asm_insns=[
@{address="0x000107c0",func-name="main",offset="4",
inst="mov 2, %o0"@},
@{address="0x000107c4",func-name="main",offset="8",
inst="sethi %hi(0x11800), %o2"@},
@{address="0x000107c8",func-name="main",offset="12",
inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@},
@{address="0x000107cc",func-name="main",offset="16",
inst="sethi %hi(0x11800), %o2"@},
@{address="0x000107d0",func-name="main",offset="20",
inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}]
(@value{GDBP})
@end smallexample
Disassemble the whole @code{main} function. Line 32 is part of
@code{main}.
@smallexample
-data-disassemble -f basics.c -l 32 -- 0
^done,asm_insns=[
@{address="0x000107bc",func-name="main",offset="0",
inst="save %sp, -112, %sp"@},
@{address="0x000107c0",func-name="main",offset="4",
inst="mov 2, %o0"@},
@{address="0x000107c4",func-name="main",offset="8",
inst="sethi %hi(0x11800), %o2"@},
[@dots{}]
@{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
@{address="0x00010820",func-name="main",offset="100",inst="restore "@}]
(@value{GDBP})
@end smallexample
Disassemble 3 instructions from the start of @code{main}:
@smallexample
(@value{GDBP})
-data-disassemble -f basics.c -l 32 -n 3 -- 0
^done,asm_insns=[
@{address="0x000107bc",func-name="main",offset="0",
inst="save %sp, -112, %sp"@},
@{address="0x000107c0",func-name="main",offset="4",
inst="mov 2, %o0"@},
@{address="0x000107c4",func-name="main",offset="8",
inst="sethi %hi(0x11800), %o2"@}]
(@value{GDBP})
@end smallexample
Disassemble 3 instructions from the start of @code{main} in mixed mode:
@smallexample
(@value{GDBP})
-data-disassemble -f basics.c -l 32 -n 3 -- 1
^done,asm_insns=[
src_and_asm_line=@{line="31",
file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
testsuite/gdb.mi/basics.c",line_asm_insn=[
@{address="0x000107bc",func-name="main",offset="0",
inst="save %sp, -112, %sp"@}]@},
src_and_asm_line=@{line="32",
file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
testsuite/gdb.mi/basics.c",line_asm_insn=[
@{address="0x000107c0",func-name="main",offset="4",
inst="mov 2, %o0"@},
@{address="0x000107c4",func-name="main",offset="8",
inst="sethi %hi(0x11800), %o2"@}]@}]
(@value{GDBP})
@end smallexample
@subheading The @code{-data-evaluate-expression} Command
@findex -data-evaluate-expression
@subsubheading Synopsis
@example
-data-evaluate-expression @var{expr}
@end example
Evaluate @var{expr} as an expression. The expression could contain an
inferior function call. The function call will execute synchronously.
If the expression contains spaces, it must be enclosed in double quotes.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
@samp{call}. In @code{gdbtk} only, there's a corresponding
@samp{gdb_eval} command.
@subsubheading Example
In the following example, the numbers that precede the commands are the
@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its
output.
@smallexample
211-data-evaluate-expression A
211^done,value="1"
(@value{GDBP})
311-data-evaluate-expression &A
311^done,value="0xefffeb7c"
(@value{GDBP})
411-data-evaluate-expression A+3
411^done,value="4"
(@value{GDBP})
511-data-evaluate-expression "A + 3"
511^done,value="4"
(@value{GDBP})
@end smallexample
@subheading The @code{-data-list-changed-registers} Command
@findex -data-list-changed-registers
@subsubheading Synopsis
@example
-data-list-changed-registers
@end example
Display a list of the registers that have changed.
@subsubheading @value{GDBN} Command
@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
has the corresponding command @samp{gdb_changed_register_list}.
@subsubheading Example
On a PPC MBX board:
@smallexample
(@value{GDBP})
-exec-continue
^running
(@value{GDBP})
*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
args=[],file="try.c",line="5"@}
(@value{GDBP})
-data-list-changed-registers
^done,changed-registers=["0","1","2","4","5","6","7","8","9",
"10","11","13","14","15","16","17","18","19","20","21","22","23",
"24","25","26","27","28","30","31","64","65","66","67","69"]
(@value{GDBP})
@end smallexample
@subheading The @code{-data-list-register-names} Command
@findex -data-list-register-names
@subsubheading Synopsis
@example
-data-list-register-names [ ( @var{regno} )+ ]
@end example
Show a list of register names for the current target. If no arguments
are given, it shows a list of the names of all the registers. If
integer numbers are given as arguments, it will print a list of the
names of the registers corresponding to the arguments. To ensure
consistency between a register name and its number, the output list may
include empty register names.
@subsubheading @value{GDBN} Command
@value{GDBN} does not have a command which corresponds to
@samp{-data-list-register-names}. In @code{gdbtk} there is a
corresponding command @samp{gdb_regnames}.
@subsubheading Example
For the PPC MBX board:
@smallexample
(@value{GDBP})
-data-list-register-names
^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
"", "pc","ps","cr","lr","ctr","xer"]
(@value{GDBP})
-data-list-register-names 1 2 3
^done,register-names=["r1","r2","r3"]
(@value{GDBP})
@end smallexample
@subheading The @code{-data-list-register-values} Command
@findex -data-list-register-values
@subsubheading Synopsis
@example
-data-list-register-values @var{fmt} [ ( @var{regno} )*]
@end example
Display the registers' contents. @var{fmt} is the format according to
which the registers' contents are to be returned, followed by an optional
list of numbers specifying the registers to display. A missing list of
numbers indicates that the contents of all the registers must be returned.
Allowed formats for @var{fmt} are:
@table @code
@item x
Hexadecimal
@item o
Octal
@item t
Binary
@item d
Decimal
@item r
Raw
@item N
Natural
@end table
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
@subsubheading Example
For a PPC MBX board (note: line breaks are for readability only, they
don't appear in the actual output):
@smallexample
(@value{GDBP})
-data-list-register-values r 64 65
^done,register-values=[@{number="64",value="0xfe00a300"@},
@{number="65",value="0x00029002"@}]
(@value{GDBP})
-data-list-register-values x
^done,register-values=[@{number="0",value="0xfe0043c8"@},
@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
@{number="3",value="0x0"@},@{number="4",value="0xa"@},
@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@},
@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@},
@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@},
@{number="11",value="0x1"@},@{number="12",value="0x0"@},
@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@},
@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@},
@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@},
@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@},
@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@},
@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@},
@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@},
@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@},
@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@},
@{number="31",value="0x0"@},@{number="32",value="0x0"@},
@{number="33",value="0x0"@},@{number="34",value="0x0"@},
@{number="35",value="0x0"@},@{number="36",value="0x0"@},
@{number="37",value="0x0"@},@{number="38",value="0x0"@},
@{number="39",value="0x0"@},@{number="40",value="0x0"@},
@{number="41",value="0x0"@},@{number="42",value="0x0"@},
@{number="43",value="0x0"@},@{number="44",value="0x0"@},
@{number="45",value="0x0"@},@{number="46",value="0x0"@},
@{number="47",value="0x0"@},@{number="48",value="0x0"@},
@{number="49",value="0x0"@},@{number="50",value="0x0"@},
@{number="51",value="0x0"@},@{number="52",value="0x0"@},
@{number="53",value="0x0"@},@{number="54",value="0x0"@},
@{number="55",value="0x0"@},@{number="56",value="0x0"@},
@{number="57",value="0x0"@},@{number="58",value="0x0"@},
@{number="59",value="0x0"@},@{number="60",value="0x0"@},
@{number="61",value="0x0"@},@{number="62",value="0x0"@},
@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@},
@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
@{number="69",value="0x20002b03"@}]
(@value{GDBP})
@end smallexample
@subheading The @code{-data-read-memory} Command
@findex -data-read-memory
@subsubheading Synopsis
@example
-data-read-memory [ -o @var{byte-offset} ]
@var{address} @var{word-format} @var{word-size}
@var{nr-rows} @var{nr-cols} [ @var{aschar} ]
@end example
@noindent
where:
@table @samp
@item @var{address}
An expression specifying the address of the first memory word to be
read. Complex expressions containing embedded white space should be
quoted using the C convention.
@item @var{word-format}
The format to be used to print the memory words. The notation is the
same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
,Output formats}).
@item @var{word-size}
The size of each memory word in bytes.
@item @var{nr-rows}
The number of rows in the output table.
@item @var{nr-cols}
The number of columns in the output table.
@item @var{aschar}
If present, indicates that each row should include an @sc{ascii} dump. The
value of @var{aschar} is used as a padding character when a byte is not a
member of the printable @sc{ascii} character set (printable @sc{ascii}
characters are those whose code is between 32 and 126, inclusively).
@item @var{byte-offset}
An offset to add to the @var{address} before fetching memory.
@end table
This command displays memory contents as a table of @var{nr-rows} by
@var{nr-cols} words, each word being @var{word-size} bytes. In total,
@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read
(returned as @samp{total-bytes}). Should less than the requested number
of bytes be returned by the target, the missing words are identified
using @samp{N/A}. The number of bytes read from the target is returned
in @samp{nr-bytes} and the starting address used to read memory in
@samp{addr}.
The address of the next/previous row or page is available in
@samp{next-row} and @samp{prev-row}, @samp{next-page} and
@samp{prev-page}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has
@samp{gdb_get_mem} memory read command.
@subsubheading Example
Read six bytes of memory starting at @code{bytes+6} but then offset by
@code{-6} bytes. Format as three rows of two columns. One byte per
word. Display each word in hex.
@smallexample
(@value{GDBP})
9-data-read-memory -o -6 -- bytes+6 x 1 3 2
9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
prev-page="0x0000138a",memory=[
@{addr="0x00001390",data=["0x00","0x01"]@},
@{addr="0x00001392",data=["0x02","0x03"]@},
@{addr="0x00001394",data=["0x04","0x05"]@}]
(@value{GDBP})
@end smallexample
Read two bytes of memory starting at address @code{shorts + 64} and
display as a single word formatted in decimal.
@smallexample
(@value{GDBP})
5-data-read-memory shorts+64 d 2 1 1
5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
next-row="0x00001512",prev-row="0x0000150e",
next-page="0x00001512",prev-page="0x0000150e",memory=[
@{addr="0x00001510",data=["128"]@}]
(@value{GDBP})
@end smallexample
Read thirty two bytes of memory starting at @code{bytes+16} and format
as eight rows of four columns. Include a string encoding with @samp{x}
used as the non-printable character.
@smallexample
(@value{GDBP})
4-data-read-memory bytes+16 x 1 8 4 x
4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
next-row="0x000013c0",prev-row="0x0000139c",
next-page="0x000013c0",prev-page="0x00001380",memory=[
@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
(@value{GDBP})
@end smallexample
@subheading The @code{-display-delete} Command
@findex -display-delete
@subsubheading Synopsis
@example
-display-delete @var{number}
@end example
Delete the display @var{number}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{delete display}.
@subsubheading Example
N.A.
@subheading The @code{-display-disable} Command
@findex -display-disable
@subsubheading Synopsis
@example
-display-disable @var{number}
@end example
Disable display @var{number}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{disable display}.
@subsubheading Example
N.A.
@subheading The @code{-display-enable} Command
@findex -display-enable
@subsubheading Synopsis
@example
-display-enable @var{number}
@end example
Enable display @var{number}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{enable display}.
@subsubheading Example
N.A.
@subheading The @code{-display-insert} Command
@findex -display-insert
@subsubheading Synopsis
@example
-display-insert @var{expression}
@end example
Display @var{expression} every time the program stops.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{display}.
@subsubheading Example
N.A.
@subheading The @code{-display-list} Command
@findex -display-list
@subsubheading Synopsis
@example
-display-list
@end example
List the displays. Do not show the current values.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info display}.
@subsubheading Example
N.A.
@subheading The @code{-environment-cd} Command
@findex -environment-cd
@subsubheading Synopsis
@example
-environment-cd @var{pathdir}
@end example
Set @value{GDBN}'s working directory.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{cd}.
@subsubheading Example
@smallexample
(@value{GDBP})
-environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
^done
(@value{GDBP})
@end smallexample
@subheading The @code{-environment-directory} Command
@findex -environment-directory
@subsubheading Synopsis
@example
-environment-directory [ -r ] [ @var{pathdir} ]+
@end example
Add directories @var{pathdir} to beginning of search path for source files.
If the @samp{-r} option is used, the search path is reset to the default
search path. If directories @var{pathdir} are supplied in addition to the
@samp{-r} option, the search path is first reset and then addition
occurs as normal.
Multiple directories may be specified, separated by blanks. Specifying
multiple directories in a single command
results in the directories added to the beginning of the
search path in the same order they were presented in the command.
If blanks are needed as
part of a directory name, double-quotes should be used around
the name. In the command output, the path will show up separated
by the system directory-separator character. The directory-seperator
character must not be used
in any directory name.
If no directories are specified, the current search path is displayed.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{dir}.
@subsubheading Example
@smallexample
(@value{GDBP})
-environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
(@value{GDBP})
-environment-directory ""
^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
(@value{GDBP})
-environment-directory -r /home/jjohnstn/src/gdb /usr/src
^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
(@value{GDBP})
-environment-directory -r
^done,source-path="$cdir:$cwd"
(@value{GDBP})
@end smallexample
@subheading The @code{-environment-path} Command
@findex -environment-path
@subsubheading Synopsis
@example
-environment-path [ -r ] [ @var{pathdir} ]+
@end example
Add directories @var{pathdir} to beginning of search path for object files.
If the @samp{-r} option is used, the search path is reset to the original
search path that existed at gdb start-up. If directories @var{pathdir} are
supplied in addition to the
@samp{-r} option, the search path is first reset and then addition
occurs as normal.
Multiple directories may be specified, separated by blanks. Specifying
multiple directories in a single command
results in the directories added to the beginning of the
search path in the same order they were presented in the command.
If blanks are needed as
part of a directory name, double-quotes should be used around
the name. In the command output, the path will show up separated
by the system directory-separator character. The directory-seperator
character must not be used
in any directory name.
If no directories are specified, the current path is displayed.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{path}.
@subsubheading Example
@smallexample
(@value{GDBP})
-environment-path
^done,path="/usr/bin"
(@value{GDBP})
-environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
(@value{GDBP})
-environment-path -r /usr/local/bin
^done,path="/usr/local/bin:/usr/bin"
(@value{GDBP})
@end smallexample
@subheading The @code{-environment-pwd} Command
@findex -environment-pwd
@subsubheading Synopsis
@example
-environment-pwd
@end example
Show the current working directory.
@subsubheading @value{GDBN} command
The corresponding @value{GDBN} command is @samp{pwd}.
@subsubheading Example
@smallexample
(@value{GDBP})
-environment-pwd
^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
(@value{GDBP})
@end smallexample
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Program Control
@section @sc{gdb/mi} Program control
@subsubheading Program termination
As a result of execution, the inferior program can run to completion, if
it doesn't encounter any breakpoints. In this case the output will
include an exit code, if the program has exited exceptionally.
@subsubheading Examples
@noindent
Program exited normally:
@smallexample
(@value{GDBP})
-exec-run
^running
(@value{GDBP})
x = 55
*stopped,reason="exited-normally"
(@value{GDBP})
@end smallexample
@noindent
Program exited exceptionally:
@smallexample
(@value{GDBP})
-exec-run
^running
(@value{GDBP})
x = 55
*stopped,reason="exited",exit-code="01"
(@value{GDBP})
@end smallexample
Another way the program can terminate is if it receives a signal such as
@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
@smallexample
(@value{GDBP})
*stopped,reason="exited-signalled",signal-name="SIGINT",
signal-meaning="Interrupt"
@end smallexample
@subheading The @code{-exec-abort} Command
@findex -exec-abort
@subsubheading Synopsis
@example
-exec-abort
@end example
Kill the inferior running program.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{kill}.
@subsubheading Example
N.A.
@subheading The @code{-exec-arguments} Command
@findex -exec-arguments
@subsubheading Synopsis
@example
-exec-arguments @var{args}
@end example
Set the inferior program arguments, to be used in the next
@samp{-exec-run}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{set args}.
@subsubheading Example
@c FIXME!
Don't have one around.
@subheading The @code{-exec-continue} Command
@findex -exec-continue
@subsubheading Synopsis
@example
-exec-continue
@end example
Asynchronous command. Resumes the execution of the inferior program
until a breakpoint is encountered, or until the inferior exits.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} corresponding is @samp{continue}.
@subsubheading Example
@smallexample
-exec-continue
^running
(@value{GDBP})
@@Hello world
*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
file="hello.c",line="13"@}
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-finish} Command
@findex -exec-finish
@subsubheading Synopsis
@example
-exec-finish
@end example
Asynchronous command. Resumes the execution of the inferior program
until the current function is exited. Displays the results returned by
the function.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{finish}.
@subsubheading Example
Function returning @code{void}.
@smallexample
-exec-finish
^running
(@value{GDBP})
@@hello from foo
*stopped,reason="function-finished",frame=@{func="main",args=[],
file="hello.c",line="7"@}
(@value{GDBP})
@end smallexample
Function returning other than @code{void}. The name of the internal
@value{GDBN} variable storing the result is printed, together with the
value itself.
@smallexample
-exec-finish
^running
(@value{GDBP})
*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
args=[@{name="a",value="1"],@{name="b",value="9"@}@},
file="recursive2.c",line="14"@},
gdb-result-var="$1",return-value="0"
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-interrupt} Command
@findex -exec-interrupt
@subsubheading Synopsis
@example
-exec-interrupt
@end example
Asynchronous command. Interrupts the background execution of the target.
Note how the token associated with the stop message is the one for the
execution command that has been interrupted. The token for the interrupt
itself only appears in the @samp{^done} output. If the user is trying to
interrupt a non-running program, an error message will be printed.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{interrupt}.
@subsubheading Example
@smallexample
(@value{GDBP})
111-exec-continue
111^running
(@value{GDBP})
222-exec-interrupt
222^done
(@value{GDBP})
111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
(@value{GDBP})
(@value{GDBP})
-exec-interrupt
^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-next} Command
@findex -exec-next
@subsubheading Synopsis
@example
-exec-next
@end example
Asynchronous command. Resumes execution of the inferior program, stopping
when the beginning of the next source line is reached.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{next}.
@subsubheading Example
@smallexample
-exec-next
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",line="8",file="hello.c"
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-next-instruction} Command
@findex -exec-next-instruction
@subsubheading Synopsis
@example
-exec-next-instruction
@end example
Asynchronous command. Executes one machine instruction. If the
instruction is a function call continues until the function returns. If
the program stops at an instruction in the middle of a source line, the
address will be printed as well.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{nexti}.
@subsubheading Example
@smallexample
(@value{GDBP})
-exec-next-instruction
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",
addr="0x000100d4",line="5",file="hello.c"
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-return} Command
@findex -exec-return
@subsubheading Synopsis
@example
-exec-return
@end example
Makes current function return immediately. Doesn't execute the inferior.
Displays the new current frame.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{return}.
@subsubheading Example
@smallexample
(@value{GDBP})
200-break-insert callee4
200^done,bkpt=@{number="1",addr="0x00010734",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
(@value{GDBP})
000-exec-run
000^running
(@value{GDBP})
000*stopped,reason="breakpoint-hit",bkptno="1",
frame=@{func="callee4",args=[],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
(@value{GDBP})
205-break-delete
205^done
(@value{GDBP})
111-exec-return
111^done,frame=@{level="0",func="callee3",
args=[@{name="strarg",
value="0x11940 \"A string argument.\""@}],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-run} Command
@findex -exec-run
@subsubheading Synopsis
@example
-exec-run
@end example
Asynchronous command. Starts execution of the inferior from the
beginning. The inferior executes until either a breakpoint is
encountered or the program exits.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{run}.
@subsubheading Example
@smallexample
(@value{GDBP})
-break-insert main
^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
(@value{GDBP})
-exec-run
^running
(@value{GDBP})
*stopped,reason="breakpoint-hit",bkptno="1",
frame=@{func="main",args=[],file="recursive2.c",line="4"@}
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-show-arguments} Command
@findex -exec-show-arguments
@subsubheading Synopsis
@example
-exec-show-arguments
@end example
Print the arguments of the program.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{show args}.
@subsubheading Example
N.A.
@c @subheading -exec-signal
@subheading The @code{-exec-step} Command
@findex -exec-step
@subsubheading Synopsis
@example
-exec-step
@end example
Asynchronous command. Resumes execution of the inferior program, stopping
when the beginning of the next source line is reached, if the next
source line is not a function call. If it is, stop at the first
instruction of the called function.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{step}.
@subsubheading Example
Stepping into a function:
@smallexample
-exec-step
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",
frame=@{func="foo",args=[@{name="a",value="10"@},
@{name="b",value="0"@}],file="recursive2.c",line="11"@}
(@value{GDBP})
@end smallexample
Regular stepping:
@smallexample
-exec-step
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-step-instruction} Command
@findex -exec-step-instruction
@subsubheading Synopsis
@example
-exec-step-instruction
@end example
Asynchronous command. Resumes the inferior which executes one machine
instruction. The output, once @value{GDBN} has stopped, will vary depending on
whether we have stopped in the middle of a source line or not. In the
former case, the address at which the program stopped will be printed as
well.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{stepi}.
@subsubheading Example
@smallexample
(@value{GDBP})
-exec-step-instruction
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",
frame=@{func="foo",args=[],file="try.c",line="10"@}
(@value{GDBP})
-exec-step-instruction
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",
frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
(@value{GDBP})
@end smallexample
@subheading The @code{-exec-until} Command
@findex -exec-until
@subsubheading Synopsis
@example
-exec-until [ @var{location} ]
@end example
Asynchronous command. Executes the inferior until the @var{location}
specified in the argument is reached. If there is no argument, the inferior
executes until a source line greater than the current one is reached.
The reason for stopping in this case will be @samp{location-reached}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{until}.
@subsubheading Example
@smallexample
(@value{GDBP})
-exec-until recursive2.c:6
^running
(@value{GDBP})
x = 55
*stopped,reason="location-reached",frame=@{func="main",args=[],
file="recursive2.c",line="6"@}
(@value{GDBP})
@end smallexample
@ignore
@subheading -file-clear
Is this going away????
@end ignore
@subheading The @code{-file-exec-and-symbols} Command
@findex -file-exec-and-symbols
@subsubheading Synopsis
@example
-file-exec-and-symbols @var{file}
@end example
Specify the executable file to be debugged. This file is the one from
which the symbol table is also read. If no file is specified, the
command clears the executable and symbol information. If breakpoints
are set when using this command with no arguments, @value{GDBN} will produce
error messages. Otherwise, no output is produced, except a completion
notification.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{file}.
@subsubheading Example
@smallexample
(@value{GDBP})
-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
^done
(@value{GDBP})
@end smallexample
@subheading The @code{-file-exec-file} Command
@findex -file-exec-file
@subsubheading Synopsis
@example
-file-exec-file @var{file}
@end example
Specify the executable file to be debugged. Unlike
@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
from this file. If used without argument, @value{GDBN} clears the information
about the executable file. No output is produced, except a completion
notification.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{exec-file}.
@subsubheading Example
@smallexample
(@value{GDBP})
-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
^done
(@value{GDBP})
@end smallexample
@subheading The @code{-file-list-exec-sections} Command
@findex -file-list-exec-sections
@subsubheading Synopsis
@example
-file-list-exec-sections
@end example
List the sections of the current executable file.
@subsubheading @value{GDBN} Command
The @value{GDBN} command @samp{info file} shows, among the rest, the same
information as this command. @code{gdbtk} has a corresponding command
@samp{gdb_load_info}.
@subsubheading Example
N.A.
@subheading The @code{-file-list-exec-source-files} Command
@findex -file-list-exec-source-files
@subsubheading Synopsis
@example
-file-list-exec-source-files
@end example
List the source files for the current executable.
@subsubheading @value{GDBN} Command
There's no @value{GDBN} command which directly corresponds to this one.
@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
@subsubheading Example
N.A.
@subheading The @code{-file-list-shared-libraries} Command
@findex -file-list-shared-libraries
@subsubheading Synopsis
@example
-file-list-shared-libraries
@end example
List the shared libraries in the program.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info shared}.
@subsubheading Example
N.A.
@subheading The @code{-file-list-symbol-files} Command
@findex -file-list-symbol-files
@subsubheading Synopsis
@example
-file-list-symbol-files
@end example
List symbol files.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info file} (part of it).
@subsubheading Example
N.A.
@subheading The @code{-file-symbol-file} Command
@findex -file-symbol-file
@subsubheading Synopsis
@example
-file-symbol-file @var{file}
@end example
Read symbol table info from the specified @var{file} argument. When
used without arguments, clears @value{GDBN}'s symbol table info. No output is
produced, except for a completion notification.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{symbol-file}.
@subsubheading Example
@smallexample
(@value{GDBP})
-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
^done
(@value{GDBP})
@end smallexample
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Miscellaneous Commands
@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
@c @subheading -gdb-complete
@subheading The @code{-gdb-exit} Command
@findex -gdb-exit
@subsubheading Synopsis
@example
-gdb-exit
@end example
Exit @value{GDBN} immediately.
@subsubheading @value{GDBN} Command
Approximately corresponds to @samp{quit}.
@subsubheading Example
@smallexample
(@value{GDBP})
-gdb-exit
@end smallexample
@subheading The @code{-gdb-set} Command
@findex -gdb-set
@subsubheading Synopsis
@example
-gdb-set
@end example
Set an internal @value{GDBN} variable.
@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{set}.
@subsubheading Example
@smallexample
(@value{GDBP})
-gdb-set $foo=3
^done
(@value{GDBP})
@end smallexample
@subheading The @code{-gdb-show} Command
@findex -gdb-show
@subsubheading Synopsis
@example
-gdb-show
@end example
Show the current value of a @value{GDBN} variable.
@subsubheading @value{GDBN} command
The corresponding @value{GDBN} command is @samp{show}.
@subsubheading Example
@smallexample
(@value{GDBP})
-gdb-show annotate
^done,value="0"
(@value{GDBP})
@end smallexample
@c @subheading -gdb-source
@subheading The @code{-gdb-version} Command
@findex -gdb-version
@subsubheading Synopsis
@example
-gdb-version
@end example
Show version information for @value{GDBN}. Used mostly in testing.
@subsubheading @value{GDBN} Command
There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
information when you start an interactive session.
@subsubheading Example
@c This example modifies the actual output from GDB to avoid overfull
@c box in TeX.
@smallexample
(@value{GDBP})
-gdb-version
~GNU gdb 5.2.1
~Copyright 2000 Free Software Foundation, Inc.
~GDB is free software, covered by the GNU General Public License, and
~you are welcome to change it and/or distribute copies of it under
~ certain conditions.
~Type "show copying" to see the conditions.
~There is absolutely no warranty for GDB. Type "show warranty" for
~ details.
~This GDB was configured as
"--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
^done
(@value{GDBP})
@end smallexample
@subheading The @code{-interpreter-exec} Command
@findex -interpreter-exec
@subheading Synopsis
@smallexample
-interpreter-exec @var{interpreter} @var{command}
@end smallexample
Execute the specified @var{command} in the given @var{interpreter}.
@subheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{interpreter-exec}.
@subheading Example
@smallexample
(@value{GDBP})
-interpreter-exec console "break main"
&"During symbol reading, couldn't parse type; debugger out of date?.\n"
&"During symbol reading, bad structure-type format.\n"
~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
^done
(@value{GDBP})
@end smallexample
@ignore
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Kod Commands
@section @sc{gdb/mi} Kod Commands
The Kod commands are not implemented.
@c @subheading -kod-info
@c @subheading -kod-list
@c @subheading -kod-list-object-types
@c @subheading -kod-show
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Memory Overlay Commands
@section @sc{gdb/mi} Memory Overlay Commands
The memory overlay commands are not implemented.
@c @subheading -overlay-auto
@c @subheading -overlay-list-mapping-state
@c @subheading -overlay-list-overlays
@c @subheading -overlay-map
@c @subheading -overlay-off
@c @subheading -overlay-on
@c @subheading -overlay-unmap
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Signal Handling Commands
@section @sc{gdb/mi} Signal Handling Commands
Signal handling commands are not implemented.
@c @subheading -signal-handle
@c @subheading -signal-list-handle-actions
@c @subheading -signal-list-signal-types
@end ignore
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Stack Manipulation
@section @sc{gdb/mi} Stack Manipulation Commands
@subheading The @code{-stack-info-frame} Command
@findex -stack-info-frame
@subsubheading Synopsis
@example
-stack-info-frame
@end example
Get info on the current frame.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
(without arguments).
@subsubheading Example
N.A.
@subheading The @code{-stack-info-depth} Command
@findex -stack-info-depth
@subsubheading Synopsis
@example
-stack-info-depth [ @var{max-depth} ]
@end example
Return the depth of the stack. If the integer argument @var{max-depth}
is specified, do not count beyond @var{max-depth} frames.
@subsubheading @value{GDBN} Command
There's no equivalent @value{GDBN} command.
@subsubheading Example
For a stack with frame levels 0 through 11:
@smallexample
(@value{GDBP})
-stack-info-depth
^done,depth="12"
(@value{GDBP})
-stack-info-depth 4
^done,depth="4"
(@value{GDBP})
-stack-info-depth 12
^done,depth="12"
(@value{GDBP})
-stack-info-depth 11
^done,depth="11"
(@value{GDBP})
-stack-info-depth 13
^done,depth="12"
(@value{GDBP})
@end smallexample
@subheading The @code{-stack-list-arguments} Command
@findex -stack-list-arguments
@subsubheading Synopsis
@example
-stack-list-arguments @var{show-values}
[ @var{low-frame} @var{high-frame} ]
@end example
Display a list of the arguments for the frames between @var{low-frame}
and @var{high-frame} (inclusive). If @var{low-frame} and
@var{high-frame} are not provided, list the arguments for the whole call
stack.
The @var{show-values} argument must have a value of 0 or 1. A value of
0 means that only the names of the arguments are listed, a value of 1
means that both names and values of the arguments are printed.
@subsubheading @value{GDBN} Command
@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
@samp{gdb_get_args} command which partially overlaps with the
functionality of @samp{-stack-list-arguments}.
@subsubheading Example
@smallexample
(@value{GDBP})
-stack-list-frames
^done,
stack=[
frame=@{level="0",addr="0x00010734",func="callee4",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
frame=@{level="1",addr="0x0001076c",func="callee3",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
frame=@{level="2",addr="0x0001078c",func="callee2",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
frame=@{level="3",addr="0x000107b4",func="callee1",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
frame=@{level="4",addr="0x000107e0",func="main",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
(@value{GDBP})
-stack-list-arguments 0
^done,
stack-args=[
frame=@{level="0",args=[]@},
frame=@{level="1",args=[name="strarg"]@},
frame=@{level="2",args=[name="intarg",name="strarg"]@},
frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@},
frame=@{level="4",args=[]@}]
(@value{GDBP})
-stack-list-arguments 1
^done,
stack-args=[
frame=@{level="0",args=[]@},
frame=@{level="1",
args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
frame=@{level="2",args=[
@{name="intarg",value="2"@},
@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
@{frame=@{level="3",args=[
@{name="intarg",value="2"@},
@{name="strarg",value="0x11940 \"A string argument.\""@},
@{name="fltarg",value="3.5"@}]@},
frame=@{level="4",args=[]@}]
(@value{GDBP})
-stack-list-arguments 0 2 2
^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
(@value{GDBP})
-stack-list-arguments 1 2 2
^done,stack-args=[frame=@{level="2",
args=[@{name="intarg",value="2"@},
@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
(@value{GDBP})
@end smallexample
@c @subheading -stack-list-exception-handlers
@subheading The @code{-stack-list-frames} Command
@findex -stack-list-frames
@subsubheading Synopsis
@example
-stack-list-frames [ @var{low-frame} @var{high-frame} ]
@end example
List the frames currently on the stack. For each frame it displays the
following info:
@table @samp
@item @var{level}
The frame number, 0 being the topmost frame, i.e. the innermost function.
@item @var{addr}
The @code{$pc} value for that frame.
@item @var{func}
Function name.
@item @var{file}
File name of the source file where the function lives.
@item @var{line}
Line number corresponding to the @code{$pc}.
@end table
If invoked without arguments, this command prints a backtrace for the
whole stack. If given two integer arguments, it shows the frames whose
levels are between the two arguments (inclusive). If the two arguments
are equal, it shows the single frame at the corresponding level.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
@subsubheading Example
Full stack backtrace:
@smallexample
(@value{GDBP})
-stack-list-frames
^done,stack=
[frame=@{level="0",addr="0x0001076c",func="foo",
file="recursive2.c",line="11"@},
frame=@{level="1",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="2",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="3",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="4",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="5",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="6",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="7",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="8",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="9",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="10",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="11",addr="0x00010738",func="main",
file="recursive2.c",line="4"@}]
(@value{GDBP})
@end smallexample
Show frames between @var{low_frame} and @var{high_frame}:
@smallexample
(@value{GDBP})
-stack-list-frames 3 5
^done,stack=
[frame=@{level="3",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="4",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@},
frame=@{level="5",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@}]
(@value{GDBP})
@end smallexample
Show a single frame:
@smallexample
(@value{GDBP})
-stack-list-frames 3 3
^done,stack=
[frame=@{level="3",addr="0x000107a4",func="foo",
file="recursive2.c",line="14"@}]
(@value{GDBP})
@end smallexample
@subheading The @code{-stack-list-locals} Command
@findex -stack-list-locals
@subsubheading Synopsis
@example
-stack-list-locals @var{print-values}
@end example
Display the local variable names for the current frame. With an
argument of 0 prints only the names of the variables, with argument of 1
prints also their values.
@subsubheading @value{GDBN} Command
@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
@subsubheading Example
@smallexample
(@value{GDBP})
-stack-list-locals 0
^done,locals=[name="A",name="B",name="C"]
(@value{GDBP})
-stack-list-locals 1
^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
@{name="C",value="3"@}]
(@value{GDBP})
@end smallexample
@subheading The @code{-stack-select-frame} Command
@findex -stack-select-frame
@subsubheading Synopsis
@example
-stack-select-frame @var{framenum}
@end example
Change the current frame. Select a different frame @var{framenum} on
the stack.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
@subsubheading Example
@smallexample
(@value{GDBP})
-stack-select-frame 2
^done
(@value{GDBP})
@end smallexample
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Symbol Query
@section @sc{gdb/mi} Symbol Query Commands
@subheading The @code{-symbol-info-address} Command
@findex -symbol-info-address
@subsubheading Synopsis
@example
-symbol-info-address @var{symbol}
@end example
Describe where @var{symbol} is stored.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info address}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-info-file} Command
@findex -symbol-info-file
@subsubheading Synopsis
@example
-symbol-info-file
@end example
Show the file for the symbol.
@subsubheading @value{GDBN} Command
There's no equivalent @value{GDBN} command. @code{gdbtk} has
@samp{gdb_find_file}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-info-function} Command
@findex -symbol-info-function
@subsubheading Synopsis
@example
-symbol-info-function
@end example
Show which function the symbol lives in.
@subsubheading @value{GDBN} Command
@samp{gdb_get_function} in @code{gdbtk}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-info-line} Command
@findex -symbol-info-line
@subsubheading Synopsis
@example
-symbol-info-line
@end example
Show the core addresses of the code for a source line.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} comamnd is @samp{info line}.
@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
@subsubheading Example
N.A.
@subheading The @code{-symbol-info-symbol} Command
@findex -symbol-info-symbol
@subsubheading Synopsis
@example
-symbol-info-symbol @var{addr}
@end example
Describe what symbol is at location @var{addr}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{info symbol}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-list-functions} Command
@findex -symbol-list-functions
@subsubheading Synopsis
@example
-symbol-list-functions
@end example
List the functions in the executable.
@subsubheading @value{GDBN} Command
@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
@samp{gdb_search} in @code{gdbtk}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-list-types} Command
@findex -symbol-list-types
@subsubheading Synopsis
@example
-symbol-list-types
@end example
List all the type names.
@subsubheading @value{GDBN} Command
The corresponding commands are @samp{info types} in @value{GDBN},
@samp{gdb_search} in @code{gdbtk}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-list-variables} Command
@findex -symbol-list-variables
@subsubheading Synopsis
@example
-symbol-list-variables
@end example
List all the global and static variable names.
@subsubheading @value{GDBN} Command
@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-locate} Command
@findex -symbol-locate
@subsubheading Synopsis
@example
-symbol-locate
@end example
@subsubheading @value{GDBN} Command
@samp{gdb_loc} in @code{gdbtk}.
@subsubheading Example
N.A.
@subheading The @code{-symbol-type} Command
@findex -symbol-type
@subsubheading Synopsis
@example
-symbol-type @var{variable}
@end example
Show type of @var{variable}.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
@samp{gdb_obj_variable}.
@subsubheading Example
N.A.
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Target Manipulation
@section @sc{gdb/mi} Target Manipulation Commands
@subheading The @code{-target-attach} Command
@findex -target-attach
@subsubheading Synopsis
@example
-target-attach @var{pid} | @var{file}
@end example
Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
@subsubheading @value{GDBN} command
The corresponding @value{GDBN} command is @samp{attach}.
@subsubheading Example
N.A.
@subheading The @code{-target-compare-sections} Command
@findex -target-compare-sections
@subsubheading Synopsis
@example
-target-compare-sections [ @var{section} ]
@end example
Compare data of section @var{section} on target to the exec file.
Without the argument, all sections are compared.
@subsubheading @value{GDBN} Command
The @value{GDBN} equivalent is @samp{compare-sections}.
@subsubheading Example
N.A.
@subheading The @code{-target-detach} Command
@findex -target-detach
@subsubheading Synopsis
@example
-target-detach
@end example
Disconnect from the remote target. There's no output.
@subsubheading @value{GDBN} command
The corresponding @value{GDBN} command is @samp{detach}.
@subsubheading Example
@smallexample
(@value{GDBP})
-target-detach
^done
(@value{GDBP})
@end smallexample
@subheading The @code{-target-download} Command
@findex -target-download
@subsubheading Synopsis
@example
-target-download
@end example
Loads the executable onto the remote target.
It prints out an update message every half second, which includes the fields:
@table @samp
@item section
The name of the section.
@item section-sent
The size of what has been sent so far for that section.
@item section-size
The size of the section.
@item total-sent
The total size of what was sent so far (the current and the previous sections).
@item total-size
The size of the overall executable to download.
@end table
@noindent
Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
@sc{gdb/mi} Output Syntax}).
In addition, it prints the name and size of the sections, as they are
downloaded. These messages include the following fields:
@table @samp
@item section
The name of the section.
@item section-size
The size of the section.
@item total-size
The size of the overall executable to download.
@end table
@noindent
At the end, a summary is printed.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{load}.
@subsubheading Example
Note: each status message appears on a single line. Here the messages
have been broken down so that they can fit onto a page.
@smallexample
(@value{GDBP})
-target-download
+download,@{section=".text",section-size="6668",total-size="9880"@}
+download,@{section=".text",section-sent="512",section-size="6668",
total-sent="512",total-size="9880"@}
+download,@{section=".text",section-sent="1024",section-size="6668",
total-sent="1024",total-size="9880"@}
+download,@{section=".text",section-sent="1536",section-size="6668",
total-sent="1536",total-size="9880"@}
+download,@{section=".text",section-sent="2048",section-size="6668",
total-sent="2048",total-size="9880"@}
+download,@{section=".text",section-sent="2560",section-size="6668",
total-sent="2560",total-size="9880"@}
+download,@{section=".text",section-sent="3072",section-size="6668",
total-sent="3072",total-size="9880"@}
+download,@{section=".text",section-sent="3584",section-size="6668",
total-sent="3584",total-size="9880"@}
+download,@{section=".text",section-sent="4096",section-size="6668",
total-sent="4096",total-size="9880"@}
+download,@{section=".text",section-sent="4608",section-size="6668",
total-sent="4608",total-size="9880"@}
+download,@{section=".text",section-sent="5120",section-size="6668",
total-sent="5120",total-size="9880"@}
+download,@{section=".text",section-sent="5632",section-size="6668",
total-sent="5632",total-size="9880"@}
+download,@{section=".text",section-sent="6144",section-size="6668",
total-sent="6144",total-size="9880"@}
+download,@{section=".text",section-sent="6656",section-size="6668",
total-sent="6656",total-size="9880"@}
+download,@{section=".init",section-size="28",total-size="9880"@}
+download,@{section=".fini",section-size="28",total-size="9880"@}
+download,@{section=".data",section-size="3156",total-size="9880"@}
+download,@{section=".data",section-sent="512",section-size="3156",
total-sent="7236",total-size="9880"@}
+download,@{section=".data",section-sent="1024",section-size="3156",
total-sent="7748",total-size="9880"@}
+download,@{section=".data",section-sent="1536",section-size="3156",
total-sent="8260",total-size="9880"@}
+download,@{section=".data",section-sent="2048",section-size="3156",
total-sent="8772",total-size="9880"@}
+download,@{section=".data",section-sent="2560",section-size="3156",
total-sent="9284",total-size="9880"@}
+download,@{section=".data",section-sent="3072",section-size="3156",
total-sent="9796",total-size="9880"@}
^done,address="0x10004",load-size="9880",transfer-rate="6586",
write-rate="429"
(@value{GDBP})
@end smallexample
@subheading The @code{-target-exec-status} Command
@findex -target-exec-status
@subsubheading Synopsis
@example
-target-exec-status
@end example
Provide information on the state of the target (whether it is running or
not, for instance).
@subsubheading @value{GDBN} Command
There's no equivalent @value{GDBN} command.
@subsubheading Example
N.A.
@subheading The @code{-target-list-available-targets} Command
@findex -target-list-available-targets
@subsubheading Synopsis
@example
-target-list-available-targets
@end example
List the possible targets to connect to.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{help target}.
@subsubheading Example
N.A.
@subheading The @code{-target-list-current-targets} Command
@findex -target-list-current-targets
@subsubheading Synopsis
@example
-target-list-current-targets
@end example
Describe the current target.
@subsubheading @value{GDBN} Command
The corresponding information is printed by @samp{info file} (among
other things).
@subsubheading Example
N.A.
@subheading The @code{-target-list-parameters} Command
@findex -target-list-parameters
@subsubheading Synopsis
@example
-target-list-parameters
@end example
@c ????
@subsubheading @value{GDBN} Command
No equivalent.
@subsubheading Example
N.A.
@subheading The @code{-target-select} Command
@findex -target-select
@subsubheading Synopsis
@example
-target-select @var{type} @var{parameters @dots{}}
@end example
Connect @value{GDBN} to the remote target. This command takes two args:
@table @samp
@item @var{type}
The type of target, for instance @samp{async}, @samp{remote}, etc.
@item @var{parameters}
Device names, host names and the like. @xref{Target Commands, ,
Commands for managing targets}, for more details.
@end table
The output is a connection notification, followed by the address at
which the target program is, in the following form:
@smallexample
^connected,addr="@var{address}",func="@var{function name}",
args=[@var{arg list}]
@end smallexample
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{target}.
@subsubheading Example
@smallexample
(@value{GDBP})
-target-select async /dev/ttya
^connected,addr="0xfe00a300",func="??",args=[]
(@value{GDBP})
@end smallexample
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Thread Commands
@section @sc{gdb/mi} Thread Commands
@subheading The @code{-thread-info} Command
@findex -thread-info
@subsubheading Synopsis
@example
-thread-info
@end example
@subsubheading @value{GDBN} command
No equivalent.
@subsubheading Example
N.A.
@subheading The @code{-thread-list-all-threads} Command
@findex -thread-list-all-threads
@subsubheading Synopsis
@example
-thread-list-all-threads
@end example
@subsubheading @value{GDBN} Command
The equivalent @value{GDBN} command is @samp{info threads}.
@subsubheading Example
N.A.
@subheading The @code{-thread-list-ids} Command
@findex -thread-list-ids
@subsubheading Synopsis
@example
-thread-list-ids
@end example
Produces a list of the currently known @value{GDBN} thread ids. At the
end of the list it also prints the total number of such threads.
@subsubheading @value{GDBN} Command
Part of @samp{info threads} supplies the same information.
@subsubheading Example
No threads present, besides the main process:
@smallexample
(@value{GDBP})
-thread-list-ids
^done,thread-ids=@{@},number-of-threads="0"
(@value{GDBP})
@end smallexample
Several threads:
@smallexample
(@value{GDBP})
-thread-list-ids
^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
number-of-threads="3"
(@value{GDBP})
@end smallexample
@subheading The @code{-thread-select} Command
@findex -thread-select
@subsubheading Synopsis
@example
-thread-select @var{threadnum}
@end example
Make @var{threadnum} the current thread. It prints the number of the new
current thread, and the topmost frame for that thread.
@subsubheading @value{GDBN} Command
The corresponding @value{GDBN} command is @samp{thread}.
@subsubheading Example
@smallexample
(@value{GDBP})
-exec-next
^running
(@value{GDBP})
*stopped,reason="end-stepping-range",thread-id="2",line="187",
file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
(@value{GDBP})
-thread-list-ids
^done,
thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
number-of-threads="3"
(@value{GDBP})
-thread-select 3
^done,new-thread-id="3",
frame=@{level="0",func="vprintf",
args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
(@value{GDBP})
@end smallexample
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Tracepoint Commands
@section @sc{gdb/mi} Tracepoint Commands
The tracepoint commands are not yet implemented.
@c @subheading -trace-actions
@c @subheading -trace-delete
@c @subheading -trace-disable
@c @subheading -trace-dump
@c @subheading -trace-enable
@c @subheading -trace-exists
@c @subheading -trace-find
@c @subheading -trace-frame-number
@c @subheading -trace-info
@c @subheading -trace-insert
@c @subheading -trace-list
@c @subheading -trace-pass-count
@c @subheading -trace-save
@c @subheading -trace-start
@c @subheading -trace-stop
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@node GDB/MI Variable Objects
@section @sc{gdb/mi} Variable Objects
@subheading Motivation for Variable Objects in @sc{gdb/mi}
For the implementation of a variable debugger window (locals, watched
expressions, etc.), we are proposing the adaptation of the existing code
used by @code{Insight}.
The two main reasons for that are:
@enumerate 1
@item
It has been proven in practice (it is already on its second generation).
@item
It will shorten development time (needless to say how important it is
now).
@end enumerate
The original interface was designed to be used by Tcl code, so it was
slightly changed so it could be used through @sc{gdb/mi}. This section
describes the @sc{gdb/mi} operations that will be available and gives some
hints about their use.
@emph{Note}: In addition to the set of operations described here, we
expect the @sc{gui} implementation of a variable window to require, at
least, the following operations:
@itemize @bullet
@item @code{-gdb-show} @code{output-radix}
@item @code{-stack-list-arguments}
@item @code{-stack-list-locals}
@item @code{-stack-select-frame}
@end itemize
@subheading Introduction to Variable Objects in @sc{gdb/mi}
@cindex variable objects in @sc{gdb/mi}
The basic idea behind variable objects is the creation of a named object
to represent a variable, an expression, a memory location or even a CPU
register. For each object created, a set of operations is available for
examining or changing its properties.
Furthermore, complex data types, such as C structures, are represented
in a tree format. For instance, the @code{struct} type variable is the
root and the children will represent the struct members. If a child
is itself of a complex type, it will also have children of its own.
Appropriate language differences are handled for C, C@t{++} and Java.
When returning the actual values of the objects, this facility allows
for the individual selection of the display format used in the result
creation. It can be chosen among: binary, decimal, hexadecimal, octal
and natural. Natural refers to a default format automatically
chosen based on the variable type (like decimal for an @code{int}, hex
for pointers, etc.).
The following is the complete set of @sc{gdb/mi} operations defined to
access this functionality:
@multitable @columnfractions .4 .6
@item @strong{Operation}
@tab @strong{Description}
@item @code{-var-create}
@tab create a variable object
@item @code{-var-delete}
@tab delete the variable object and its children
@item @code{-var-set-format}
@tab set the display format of this variable
@item @code{-var-show-format}
@tab show the display format of this variable
@item @code{-var-info-num-children}
@tab tells how many children this object has
@item @code{-var-list-children}
@tab return a list of the object's children
@item @code{-var-info-type}
@tab show the type of this variable object
@item @code{-var-info-expression}
@tab print what this variable object represents
@item @code{-var-show-attributes}
@tab is this variable editable? does it exist here?
@item @code{-var-evaluate-expression}
@tab get the value of this variable
@item @code{-var-assign}
@tab set the value of this variable
@item @code{-var-update}
@tab update the variable and its children
@end multitable
In the next subsection we describe each operation in detail and suggest
how it can be used.
@subheading Description And Use of Operations on Variable Objects
@subheading The @code{-var-create} Command
@findex -var-create
@subsubheading Synopsis
@example
-var-create @{@var{name} | "-"@}
@{@var{frame-addr} | "*"@} @var{expression}
@end example
This operation creates a variable object, which allows the monitoring of
a variable, the result of an expression, a memory cell or a CPU
register.
The @var{name} parameter is the string by which the object can be
referenced. It must be unique. If @samp{-} is specified, the varobj
system will generate a string ``varNNNNNN'' automatically. It will be
unique provided that one does not specify @var{name} on that format.
The command fails if a duplicate name is found.
The frame under which the expression should be evaluated can be
specified by @var{frame-addr}. A @samp{*} indicates that the current
frame should be used.
@var{expression} is any expression valid on the current language set (must not
begin with a @samp{*}), or one of the following:
@itemize @bullet
@item
@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
@item
@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
@item
@samp{$@var{regname}} --- a CPU register name
@end itemize
@subsubheading Result
This operation returns the name, number of children and the type of the
object created. Type is returned as a string as the ones generated by
the @value{GDBN} CLI:
@example
name="@var{name}",numchild="N",type="@var{type}"
@end example
@subheading The @code{-var-delete} Command
@findex -var-delete
@subsubheading Synopsis
@example
-var-delete @var{name}
@end example
Deletes a previously created variable object and all of its children.
Returns an error if the object @var{name} is not found.
@subheading The @code{-var-set-format} Command
@findex -var-set-format
@subsubheading Synopsis
@example
-var-set-format @var{name} @var{format-spec}
@end example
Sets the output format for the value of the object @var{name} to be
@var{format-spec}.
The syntax for the @var{format-spec} is as follows:
@example
@var{format-spec} @expansion{}
@{binary | decimal | hexadecimal | octal | natural@}
@end example
@subheading The @code{-var-show-format} Command
@findex -var-show-format
@subsubheading Synopsis
@example
-var-show-format @var{name}
@end example
Returns the format used to display the value of the object @var{name}.
@example
@var{format} @expansion{}
@var{format-spec}
@end example
@subheading The @code{-var-info-num-children} Command
@findex -var-info-num-children
@subsubheading Synopsis
@example
-var-info-num-children @var{name}
@end example
Returns the number of children of a variable object @var{name}:
@example
numchild=@var{n}
@end example
@subheading The @code{-var-list-children} Command
@findex -var-list-children
@subsubheading Synopsis
@example
-var-list-children @var{name}
@end example
Returns a list of the children of the specified variable object:
@example
numchild=@var{n},children=[@{name=@var{name},
numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
@end example
@subheading The @code{-var-info-type} Command
@findex -var-info-type
@subsubheading Synopsis
@example
-var-info-type @var{name}
@end example
Returns the type of the specified variable @var{name}. The type is
returned as a string in the same format as it is output by the
@value{GDBN} CLI:
@example
type=@var{typename}
@end example
@subheading The @code{-var-info-expression} Command
@findex -var-info-expression
@subsubheading Synopsis
@example
-var-info-expression @var{name}
@end example
Returns what is represented by the variable object @var{name}:
@example
lang=@var{lang-spec},exp=@var{expression}
@end example
@noindent
where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
@subheading The @code{-var-show-attributes} Command
@findex -var-show-attributes
@subsubheading Synopsis
@example
-var-show-attributes @var{name}
@end example
List attributes of the specified variable object @var{name}:
@example
status=@var{attr} [ ( ,@var{attr} )* ]
@end example
@noindent
where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
@subheading The @code{-var-evaluate-expression} Command
@findex -var-evaluate-expression
@subsubheading Synopsis
@example
-var-evaluate-expression @var{name}
@end example
Evaluates the expression that is represented by the specified variable
object and returns its value as a string in the current format specified
for the object:
@example
value=@var{value}
@end example
Note that one must invoke @code{-var-list-children} for a variable
before the value of a child variable can be evaluated.
@subheading The @code{-var-assign} Command
@findex -var-assign
@subsubheading Synopsis
@example
-var-assign @var{name} @var{expression}
@end example
Assigns the value of @var{expression} to the variable object specified
by @var{name}. The object must be @samp{editable}. If the variable's
value is altered by the assign, the variable will show up in any
subsequent @code{-var-update} list.
@subsubheading Example
@example
(@value{GDBP})
-var-assign var1 3
^done,value="3"
(@value{GDBP})
-var-update *
^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
(@value{GDBP})
@end example
@subheading The @code{-var-update} Command
@findex -var-update
@subsubheading Synopsis
@example
-var-update @{@var{name} | "*"@}
@end example
Update the value of the variable object @var{name} by evaluating its
expression after fetching all the new values from memory or registers.
A @samp{*} causes all existing variable objects to be updated.
|