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 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January 9, 2010 by texi2html 1.82
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>BASH Debugger</title>
<meta name="description" content="BASH Debugger">
<meta name="keywords" content="BASH Debugger">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<p>This file documents the <small>BASH</small> debugger <acronym>BASH</acronym>.
</p>
<p>This is the 4.0-0.4 Edition, 26 June 2009,
of <cite>Debugging with BASHDB: the <small>GNU</small> Source-Level Debugger</cite>
for BASH
</p>
<p>Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009 Rocky Bernstein for the Free Software Foundation.
</p>
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
</p>
<a name="Top"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugging-with-the-BASH-debugger"></a>
<h1 class="settitle">Debugging with the <acronym>BASH</acronym> debugger</h1>
<p>This file describes the <acronym>BASH</acronym> debugger, the <small>BASH</small> symbolic debugger.
</p>
<p>This is the 4.0-0.4 Edition, 26 June 2009, for BASH.
</p>
<p>Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009 Rocky Bernstein
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Summary">1. Summary of the BASH Debugger</a></td><td> </td><td align="left" valign="top"> Overview of Debugger with a sample session
</td></tr>
<tr><td align="left" valign="top"><a href="#Invocation">2. Getting in and out</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Running">3. Script Setup inside the BASH Debugger</a></td><td> </td><td align="left" valign="top"> Script setup inside the BASH debugger
</td></tr>
<tr><td align="left" valign="top"><a href="#Debugger-Command-Reference">4. BASH Debugger Command Reference</a></td><td> </td><td align="left" valign="top"> BASH debugger command reference
</td></tr>
<tr><td align="left" valign="top"><a href="#Front-Ends">5. Using the <acronym>BASH</acronym> debugger from a front-end user interface</a></td><td> </td><td align="left" valign="top"> Using the Debugger from a front-end user interface
</td></tr>
<tr><td align="left" valign="top"><a href="#BASH-Debugger-Bugs">6. Reporting Bugs</a></td><td> </td><td align="left" valign="top"> Reporting bugs
</td></tr>
<tr><td align="left" valign="top"><a href="#History-and-Acknowledgments">7. History and Acknowledgments</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Appendices
</pre></th></tr><tr><td align="left" valign="top"><a href="#Copying">A. GNU GENERAL PUBLIC LICENSE</a></td><td> </td><td align="left" valign="top"> GNU General Public License says
how you can copy and share bashdb
</td></tr>
<tr><td align="left" valign="top"><a href="#GNU-Free-Documentation-License">B. GNU Free Documentation License</a></td><td> </td><td align="left" valign="top"> The license for this documentation
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Indexes (nodes containing large menus)
</pre></th></tr><tr><td align="left" valign="top"><a href="#Function-Index">Function Index</a></td><td> </td><td align="left" valign="top"> An item for each function name.
</td></tr>
<tr><td align="left" valign="top"><a href="#Command-Index">Command Index</a></td><td> </td><td align="left" valign="top"> An item for each command name.
</td></tr>
<tr><td align="left" valign="top"><a href="#Variable-Index">Variable Index</a></td><td> </td><td align="left" valign="top"> An item for each documented variable.
</td></tr>
<tr><td align="left" valign="top"><a href="#General-Index">General Index</a></td><td> </td><td align="left" valign="top"> An item for each concept.
</td></tr>
</table>
<hr size="1">
<a name="Summary"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Sample-Session" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Summary-of-the-BASH-Debugger"></a>
<h1 class="chapter">1. Summary of the BASH Debugger</h1>
<p>The purpose of a debugger such as the <acronym>BASH</acronym> debugger is to allow you to see what is
going on “inside” a bash script while it executes.
</p>
<p>the <acronym>BASH</acronym> debugger can do four main kinds of things (plus other things in support of
these) to help you catch bugs in the act:
</p>
<ul>
<li>
Start your script, specifying anything that might affect its behavior.
</li><li>
Make your script stop on specified conditions.
</li><li>
Examine what has happened, when your script has stopped.
</li><li>
Change things in your script, so you can experiment with correcting the
effects of one bug and go on to learn about another.
</li></ul>
<p>Although you can use the <acronym>BASH</acronym> debugger to debug scripts
written in <acronym>BASH</acronym>, it can also be used just as a front-end
for learning more about programming in <acronym>BASH</acronym>. As an
additional aid, the debugger can be used within the context of an
existing script with its functions and variables that have already
been initialized; fragments of the existing can be experimented with
by entering them inside the debugger.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Sample-Session">1.1 A Sample BASH Debugger Session</a></td><td> </td><td align="left" valign="top"> A Sample BASH Debugger session
</td></tr>
<tr><td align="left" valign="top"><a href="#Interactive-Line-Tracing-Session">1.2 Interactive Line Tracing Session</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Sample-Session"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Summary" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Interactive-Line-Tracing-Session" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Summary" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Summary" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="A-Sample-BASH-Debugger-Session"></a>
<h2 class="section">1.1 A Sample BASH Debugger Session</h2>
<p>You can use this manual at your leisure to read all about the <acronym>BASH</acronym> debugger.
However, a handful of commands are enough to get started using the
debugger. This chapter illustrates those commands.
</p>
<p>Below we will debug a script that contains a function to compute the
factorial of a number: fact(0) is 1 and fact(n) is n*fact(n-1).
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>bashdb -L . /tmp/fact.sh</b>
Bourne-Again Shell Debugger, release bash-4.0-0.4
Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009 Rocky Bernstein
This 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.
(/tmp/fact.sh:9):
9: echo fact 0 is: `fact 0`
bashdb<0> <b>-</b>
1: #!/usr/local/bin/bash
2: fact() {
3: ((n==0)) && echo 1 && return
4: ((nm1=n-1))
5: ((result=n*`fact $nm1`))
6: echo $result
7: }
8:
9:==> echo fact 0 is: `fact 0`
bashdb<1> <b>list</b>
10: echo fact 3 is: $(fact 3)
</pre></td></tr></table>
<p>The command invocation uses the option “-L .” Here we assume that
the <code>bashdb</code> script and the debugger files are in the same
location. If you are running from the source code, this will be the
case. However if bashdb has been installed this probably won’t be true
and here you probably don’t need to use “-L .” Instead you would
type simply <code>bashdb /tmp/fact.sh</code>.
</p>
<p>Position information consists of a filename and line number,
e.g. <code>(/tmp/fact.sh:9)</code> and is given parenthesis. This position
format is similar to that used by the Perl debugger and is also in the
same format used by my GNU make debugger
(<a href="http://bashdb.sourceforge.net/remake">http://bashdb.sourceforge.net/remake</a>) the Extended Python
Debugger <a href="http://remake.sourceforge.net/pydb">http://remake.sourceforge.net/pydb</a>, and one for Ruby
(<a href="http://bashdb.sorceforge.net/ruby-debug.html">http://bashdb.sorceforge.net/ruby-debug.html</a>). GNU Emacs and
DDD can parse this and in fact the same regular expression is used on
the 3 debuggers.
</p>
<p>The first debugger command we gave <kbd>-</kbd>, we listed a window of
lines <em>before</em> where we were executing. Because the window, 10
lines, is larger than the number of lines to the top of the file we
printed only 9 lines here. The next command, <code>list</code>, starts from
the current line and again wants to print 10 lines but because there
are only one remaining line, that is what is printed.
</p>
<table><tr><td> </td><td><table class="cartouche" border="1"><tr><td>
<pre class="smallexample">bashdb<2> <b>step</b>
(/tmp/fact.sh:9):
fact 0
9: echo fact 0 is: `fact 0`
bashdb<(3)> <b><RET></b>
2: fact() {
bashdb<(4)> <b><RET></b>
3: ((n==0)) && echo 1 && return
bashdb<(5)> <b>print $n</b>
bashdb<(6)>
</pre></td></tr></table>
</td></tr></table>
<p>Ooops... The variable <kbd>n</kbd> isn’t initialized.<a name="DOCF1" href="#FOOT1">(1)</a>
</p>
<p>The first <kbd>step</kbd> command steps the script one instruction. It may
seem odd that the line printed is exactly the same one as before. What
has happened though is that we’ve “stepped” into the subshell needed
to run <kbd>`fact 0`</kbd>; we haven’t however started running anything
inside that subshell yet though.
</p>
<p>To indicate that which piece of the multi-part line <code>echo fact 0
is: `fact 0`</code> we show that part all by itself <kbd>fact 0</kbd>. If nothing
is shown then it means we are running the beginning statement or in
this case the outermost statement.
</p>
<p>To indicate that we are now nested in a subshell, notice that the
command number, starting with 3, or the third command entered, now
appears in parenthesis. Each subshell nesting adds a set of
parenthesis.
</p>
<p>The first <kbd>step</kbd> command steps the script one instruction; it
didn’t advance the line number, 9, at all. That is because we were
stopping before the command substitution or backtick is to take
place. The second command we entered was just hitting the return key;
bashdb remembers that you entered <code>step</code> previously, so it runs
the step rather than <kbd>next</kbd>, the other alternative when you hit
<RET>. Step one more instruction and we are just before running
the first statement of the function.
</p>
<p>Next, we print the value of the variable <kbd>n</kbd>. Notice we need to add
a preceding dollar simple to get the substitution or value of n. As we
will see later, if the <kbd>pe</kbd> command were used this would not be
necessary.
</p>
<p>We now modify the file to add an assignment to local variable <kbd>n</kbd> and
restart.
</p>
<table><tr><td> </td><td><table class="cartouche" border="1"><tr><td>
<pre class="smallexample">bashdb<6> <b>restart</b>
Restarting with: /usr/local/bin/bashdb -L . fact.sh
(/tmp/fact.sh:10):
10: echo fact 0 is: `fact 0`
bashdb<0> <b>list 1</b>
1: #!/usr/local/bin/bash
2: fact() {
3: local -i n=${1:0}
4: ((n==0)) && echo 1 && return
5: ((nm1=n-1))
6: ((result=n*`fact $nm1`))
7: echo $result
8: }
9:
10:==> echo fact 0 is: `fact 0`
bashdb<1> <b>s 3</b>
(/tmp/fact.sh:3):
3: local -i n=${1:0}
bashdb<(2)> <b>step</b>
(/tmp/fact.sh:4):
4: ((n==0)) && echo 1 && return
bashdb<(3)> <b>print $n</b>
print $n
0
</pre></td></tr></table>
</td></tr></table>
<p>This time we use the <code>list</code> debugger command to list the lines in
the file. From before we know it takes three <code>step</code> commands
before we get into the fact() function, so we add a count onto the
<code>step</code> command. Notice we abbreviate <code>step</code> with <code>s</code>;
we could have done likewise and abbreviated <code>list</code> with <code>l</code>.
</p>
<table><tr><td> </td><td><table class="cartouche" border="1"><tr><td>
<pre class="smallexample">bashdb<(4)> <b><RET></b>
(/tmp/fact.sh:4):
4: ((n==0)) && echo 1 && return
echo 1
bashdb<(5)> <b><RET></b>
(/tmp/fact.sh:4):
4: ((n==0)) && echo 1 && return
return
</pre></td></tr></table>
</td></tr></table>
<p>Again we just use <RET> to repeat the last <code>step</code>
commands. And again the fact that we are staying on the same line 4
means that the next condition in the line is about to be
executed. Notice that we see the command (<code>echo 1</code> or
<code>return</code>) listed when we stay on the same line which has multiple
stopping points in it. Given the information above, we know that the
value echo’ed on return will be 1.
</p>
<table><tr><td> </td><td><table class="cartouche" border="1"><tr><td>
<pre class="smallexample">bashdb<(6)> <b><RET></b>
fact 0 is: 1
(/tmp/fact.sh:12):
12: echo fact 3 is: $(fact 3)
bashdb<(7)> <b>break 5</b>
Breakpoint 1 set in file fact.sh, line 5.
bashdb<(8)> <b>continue</b>
</pre></td></tr></table>
</td></tr></table>
<p>We saw that we could step with a count into the function
fact(). However above took another approach: we set a stopping point or
“breakpoint” at line 5 to get us a little ways into the fact()
subroutine. Just before line 5 is to executed, we will get back into
the debugger. The <code>continue</code> command just resumes execution until
the next stopping point which has been set up in some way.
</p>
<table><tr><td> </td><td><table class="cartouche" border="1"><tr><td>
<pre class="smallexample">(/tmp/fact.sh:5):
5: ((nm1=n-1))
Breakpoint 1 hit(1 times).
bashdb<(8)> <b>x n-1</b>
2
bashdb<(9)> <b>s</b>
(/tmp/fact.sh:5):
6: ((result=n*`fact $nm1`))
bashdb<(10)> <b>c</b>
fact.sh: line 6: ((: result=n*: syntax error: operand expected (error token is "*")
bashdb<(7)> <b>R</b>
Restarting with: bash --debugger fact.sh
11: echo fact 0 is: `fact 0`
bashdb<0> <b>l fact</b>
2: fact ()
3: {
4: local -i n=${1:0};
5: (( "n==0" )) && echo 1 && return;
6: (( nm1=n-1 ));
7: ((fact_nm1=`fact $nm1`))
8: (( "result=n*fact_nm1" ));
9: echo $result
10: }
</pre></td></tr></table>
</td></tr></table>
<p>In addition to listing by line numbers, we can also list giving a
function name. Below, instead of setting a breakpoint at line 5 and
running “<code>continue</code>” as we did above, we try something slightly
shorter and slightly different. We give the line number on the
“continue” statement. This is a little different in that a one-time
break is made on line 5. Once that statement is reached the breakpoint
is removed.
</p>
<table><tr><td> </td><td><table class="cartouche" border="1"><tr><td>
<pre class="smallexample">bashdb<1> <b>continue 5</b>
One-time breakpoint 1 set in file fact.sh, line 5.
fact 0 is: 1
(/tmp/fact.sh:5):
5: ((nm1=n-1))
bashdb<(2)> <b>s</b>
6: ((fact_nm1=`fact $nm1`))
bashdb<(3)> <b>s</b>
2: fact() {
bashdb<(4)> <b>T</b>
->0 in file `fact.sh' at line 2
##1 fact("3") called from file `fact.sh' at line 12
##2 source("fact.sh") called from file `/usr/local/bin/bashdb' at line 154
##3 main("fact.sh") called from file `/usr/local/bin/bashdb' at line 0
bashdb<(5)> <b>c</b>
fact 3 is: 6
Debugged program terminated normally. Use q to quit or R to restart.
</pre></td></tr></table>
</td></tr></table>
<p>When we stop at line 5 above, we have already run fact(0) and output
the correct results. The output from the program “fact 0 is: 1” is
intermixed with the debugger output. The <code>T</code> command above
requests call stack output and this confirms that we are not in the
fact(0) call but in the fact(3) call. There are 4 lines listed in the
stack trace even though there is just one call from the main
program. The top line of the trace doesn’t really represent a call,
it’s just where we currently are in the program. That last line is an
artifact of invoking bash from the bashdb script rather than running
<code>bash --debugger</code>.
</p>
<p>The last message in the output above ‘<samp>Debugged program exited
normally.</samp>’ is from the <acronym>BASH</acronym> debugger; it indicates script has finished
executing. We can end our bashdb session with the bashdb
<code>quit</code> command.
</p>
<p>Above we did our debugging session on the command line. If you are a
GNU Emacs user, you can do your debugging inside that. Also there is
a(nother) GUI interface called DDD that supports the <acronym>BASH</acronym> debugger.
</p>
<hr size="6">
<a name="Interactive-Line-Tracing-Session"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Sample-Session" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Summary" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Summary" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Interactive-Line-Tracing-Session-1"></a>
<h2 class="section">1.2 Interactive Line Tracing Session</h2>
<p><a name="PS4"></a>
<a name="index-_0024PS4"></a>
</p>
<p>One of the things I had found disappointing about the
default <code>set -x</code> tracing behavior is that no position information
is given in the trace output, in particular the line number and the file
name. However with the introduction in Bash 3.0 of the introspection
variables, aslo needed to support the debugger, one can set
<code>$PS4</code> to rectify this. (I became of this in a defunct blog
<a href="http://raz.cx/blog/2005/08/handy-bash-debugging-trick.html">http://raz.cx/blog/2005/08/handy-bash-debugging-trick.html</a>.)
</p>
<p>Here’s what I use:
</p><table><tr><td> </td><td><pre class="smallexample"> PS4='(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]} - [${SHLVL},${BASH_SUBSHELL}, $?]
'
</pre></td></tr></table>
<p>Note that the string is in single quotes, not double quotes and there
is a newline in the string. By using single quotes, variables which
have a dollar in front of them in the string are expanded in the
current environment of the line that is about to be run rather than at
the time the variable <code>PS4</code> is set.
</p>
<p>You might want to add this in your shell’s start-up script, e.g.,
<code>.bashrc</code>, or <code>.profile</code>.
</p>
<p>There is also facility inside the bash debugger showing position
information when tracing a script. Here’s a simple session.
</p>
<table><tr><td> </td><td><pre class="smallexample"><b>/usr/local/bin/bashdb /tmp/fact.sh</b>
Bourne-Again Shell Debugger, release bash-4.0-0.4
Copyright 2002, 2003, 2004, 2006, 2007, 2008 Rocky Bernstein
This 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.
(/tmp/fact.sh:11):
11: echo fact 0 is: `fact 0`
bashdb<0> <b>set linetrace on</b>
bashdb<1> <b>cont</b>
(/tmp/fact.sh:11):
level 1, subshell 1, depth 0: echo fact 0 is: `fact 0`
fact 0
(/tmp/fact.sh:2):
level 1, subshell 1, depth 1: fact() {
(/tmp/fact.sh:3):
level 1, subshell 1, depth 1: local -i n=${1:0}
(/tmp/fact.sh:4):
level 1, subshell 1, depth 1: ((n==0)) && echo 1 && return
(/tmp/fact.sh:4):
level 1, subshell 1, depth 1: ((n==0)) && echo 1 && return
echo 1
(/tmp/fact.sh:4):
level 1, subshell 1, depth 1: ((n==0)) && echo 1 && return
return
fact 0 is: 1
(/tmp/fact.sh:13):
level 1, subshell 0, depth 0: echo fact 3 is: $(fact 3)
(/tmp/fact.sh:13):
level 1, subshell 1, depth 0: echo fact 3 is: $(fact 3)
fact 3
(/tmp/fact.sh:2):
level 1, subshell 1, depth 1: fact() {
(/tmp/fact.sh:3):
level 1, subshell 1, depth 1: local -i n=${1:0}
(/tmp/fact.sh:4):
level 1, subshell 1, depth 1: ((n==0)) && echo 1 && return
(/tmp/fact.sh:5):
level 1, subshell 1, depth 1: ((nm1=n-1))
(/tmp/fact.sh:6):
level 1, subshell 1, depth 1: ((fact_nm1=`fact $nm1`))
(/tmp/fact.sh:6):
level 1, subshell 2, depth 1: ((fact_nm1=`fact $nm1`))
fact $nm1
(/tmp/fact.sh:2):
level 1, subshell 2, depth 2: fact() {
...
level 1, subshell 4, depth 4: fact() {
(/tmp/fact.sh:3):
level 1, subshell 4, depth 4: local -i n=${1:}
(/tmp/fact.sh:4):
level 1, subshell 4, depth 4: ((n==0)) && echo 1 && return
(/tmp/fact.sh:4):
level 1, subshell 4, depth 4: ((n==0)) && echo 1 && return
echo 1
(/tmp/fact.sh:4):
level 1, subshell 4, depth 4: ((n==0)) && echo 1 && return
return
(/tmp/fact.sh:7):
level 1, subshell 3, depth 3: ((result=n*fact_nm1))
(/tmp/fact.sh:8):
level 1, subshell 3, depth 3: echo $result
(/tmp/fact.sh:7):
level 1, subshell 2, depth 2: ((result=n*fact_nm1))
(/tmp/fact.sh:8):
level 1, subshell 2, depth 2: echo $result
(/tmp/fact.sh:7):
level 1, subshell 1, depth 1: ((result=n*fact_nm1))
(/tmp/fact.sh:8):
level 1, subshell 1, depth 1: echo $result
fact 3 is: 6
(/usr/local/bin/bashdb:260):
level 1, subshell 0, depth -1:
Debugged program terminated normally. Use q to quit or R to restart.
bashdb<2>
</pre></td></tr></table>
<p>An explanation of the output. The <em>level</em> is how many invocations
of <acronym>BASH</acronym> are in effect before the statement shown is
executed. The <em>subshell</em> is how many subshells you are nested
in. Subshells are used by command substitution—<code>`..'</code> and
<code>$(...)</code>—as well as arithmetic expressions <code>((...))</code>. The
<em>depth</em> is the function depth or how many calls you are nested
in. A “source” command also increases this depth.
</p>
<p>Notice also that in contrast to <code>set -x</code> tracing, the line shown
is exactly as you entered it in the source. So if you indented
statements in a meaningful way, it will help you understand the
statement nesting level. But as before, if a line contains multiple
statements, you are <em>not</em> executing the first statement in the
line and <code>set showcommand</code> is not turned off (by default it is
on), that statement is shown in addition below the multi-statement
line. Such an example can be seen right at the beginning where
<code>fact 0</code> is shown.
</p>
<p>If what you want to do is trace the <em>entire</em> script as was done
above (and not stop in the debugger when the script is over), you can
get the same effect by using the <code>-X</code> or <code>--trace</code> option on
the <code>bashdb</code> command:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b>/usr/local/bin/bashdb -X /tmp/fact.sh</b>
Bourne-Again Shell Debugger, release bash-4.0-0.4
Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009 Rocky Bernstein
This 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.
(/usr/local/bin/bashdb:272):
level 1, subshell 0, depth -1: . $_source_file
(/tmp/fact.sh:11):
level 1, subshell 0, depth 0: echo fact 0 is: `fact 0`
(/tmp/fact.sh:11):
level 1, subshell 1, depth 0: echo fact 0 is: `fact 0`
fact 0
(/tmp/fact.sh:2):
level 1, subshell 1, depth 1: fact() {
(/tmp/fact.sh:3):
level 1, subshell 1, depth 1: local -i n=${1:0}
...
level 1, subshell 2, depth 2: echo $result
(/tmp/fact.sh:7):
level 1, subshell 1, depth 1: ((result=n*fact_nm1))
(/tmp/fact.sh:8):
level 1, subshell 1, depth 1: echo $result
fact 3 is: 6
(/usr/local/bin/bashdb:285):
level 1, subshell 0, depth -1:
</pre></td></tr></table>
<p>If you issue a break (e.g. send a <code>SIGINT</code> signal) while the
program is running you will go into the debugger (assuming your
program doesn’t trap <code>SIGINT</code>).
</p>
<hr size="6">
<a name="Invocation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Interactive-Line-Tracing-Session" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Starting-the-BASH-debugger" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Summary" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Getting-in-and-out"></a>
<h1 class="chapter">2. Getting in and out</h1>
<p>This chapter discusses how to start the <acronym>BASH</acronym> debugger, and how to get out of it.
The essentials are:
</p><ul>
<li>
type ‘<samp>bash --debugger <em>script-name</em></samp>’ or ‘<samp>bashdb
<em>script-name</em></samp>’ to start the <acronym>BASH</acronym> debugger. Or...
</li><li>
type ‘<samp>bashdb -c <em>command string</em></samp>’ to give a string to run
under the debugger. Or ..
</li><li>
modify your program to enter the debugger at a particular point:
<code>source ../bashdb-trace</code> and <code>_Dbg_debugger</code>.
</li><li>
type <kbd>quit</kbd> or <kbd>C-d</kbd> inside the debugger to exit.
</li></ul>
<p>There are also two front-ends available as well. One can also
enter the debugger inside emacs via the command <code>M-x bashdb</code>
after loading Emacs’ Grand Unified Debugger, <code>gud</code>. See
<a href="#Emacs">Using the BASH debugger from <small>GNU</small> Emacs</a>. And there is
support in a <acronym>DDD</acronym> for bash.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Starting-the-BASH-debugger">2.1 Starting the BASH debugger</a></td><td> </td><td align="left" valign="top"> How to enter the BASH debugger
</td></tr>
<tr><td align="left" valign="top"><a href="#Quitting-the-BASH-debugger">2.2 Quitting the BASH debugger</a></td><td> </td><td align="left" valign="top"> How to leave the BASH debugger
</td></tr>
<tr><td align="left" valign="top"><a href="#Calling-from-Program">2.3 Calling the BASH debugger from inside your program</a></td><td> </td><td align="left" valign="top"> Calling the debugger from inside your program
</td></tr>
</table>
<hr size="6">
<a name="Starting-the-BASH-debugger"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Invocation" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Options-for-the-bashdb-script" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Starting-the-BASH-debugger-1"></a>
<h2 class="section">2.1 Starting the BASH debugger</h2>
<p><em>Note: it is important to use a debugger-enabled bash. You will
get an error message if the debugger is run under a version of BASH
that does not have debugging support.</em>
</p>
<p>As mentioned above, one can enter the <acronym>BASH</acronym> debugger via Emacs or
DDD. However you don’t have to use either of these. And these still
need a way on their own to get things started.
</p>
<p>There are in fact two <em>other</em> ways to start the <acronym>BASH</acronym> debugger. The
first way is to pass the ‘<samp>--debugger</samp>’ option to bash with the
name of your script the scripts arguments following that, or with a
command string (<code>-c</code>).
</p>
<table><tr><td> </td><td><pre class="example">bash --debugger <var>script</var> <var>script-arguments...</var>
bash --debugger -c <var>command-string</var>...
</pre></td></tr></table>
<p>This calls a debugger initialization script. It works much like a
<acronym>BASH</acronym> login profile which may set variables and define
functions. But this shell profile is customized for debugging and as
such arranges for itself to get called before each statement is
executed. Although there are some problems at present in I/O
redirection that the method described next doesn’t have, it is
expected that over time more features will be enabled in bash when the
‘<samp>--debugger</samp>’ option is in effect. By default, both debugging in
Emacs via GUD (<a href="#Emacs">Using the BASH debugger under Emacs</a>) and
debugging via <acronym>DDD</acronym> work via this method.
</p>
<p>The form ‘<samp>bash --debugger -c ...</samp>’ can be used to get into the
debugger without having to give a script name to debug. Sometimes you
may want to do this just to see how the debugger works: try some
debugger commands or maybe get online help. If you run <code>ddd
--bash</code> without giving a script name, it in fact uses this form.
</p>
<p>In order for the ‘<samp>--debugger</samp>’ option to work however, you must
have the debugger scripts installed in a place where the <acronym>BASH</acronym> debugger can find
them. For this reason, in developing the <acronym>BASH</acronym> debugger, I use a second
method more often; it doesn’t require the bash debugger to be
installed. This method uses another script called <code>bashdb</code> which
allows for giving its own options, the final option is signaled by
adding <code>--</code>). After this, the name of the script to debugged and
any the arguments to pass to that script are given. Using this method,
one would start the debugger like this:
</p>
<table><tr><td> </td><td><pre class="example">bash <var>path-to-bashdb</var>/bashdb <var>bashdb-options</var> -- <var>script</var> <var>script-arguments...</var>
</pre></td></tr></table>
<p>If you don’t need to pass dash options to your program which might get
confused with the debugger options, then you don’t need to add the
<code>--</code>.<a name="DOCF2" href="#FOOT2">(2)</a>
</p>
<p>As with the first method, <code>bash</code> should be a debugger-enabled
bash. If <code>bashdb</code> has the path to bash in it at the top (e.g. via
<code>#!</code>), and <code>bashdb</code> can be found in your program-search
path, then this might be equivalent to the above:
</p>
<table><tr><td> </td><td><pre class="example">bashdb <var>bashdb-options</var> -- <var>script</var> <var>script-arguments...</var>
</pre></td></tr></table>
<p>There are two or three disadvantages however of running a debugger
this way. First <code>$0</code> will have the value <code>bashdb</code> rather
than the script you are trying to run. For some scripts this may
change the behavior of the debugged script. Second a traceback will
contain additional lines showing the “source”-ing of the debugged
script from <code>bashdb</code>. And third, although this way works better
than the first method, over time this way may come into disuse.
</p>
<p>An option that you’ll probably need to use if bashdb isn’t installed
but run out of the source code directory is ‘<samp>-L</samp>’ which specifies
the directory that contains the debugger script files.
</p>
<p>You can further control how bashdb starts up by using command-line
options. bashdb itself can remind you of the options available.
</p>
<p>Type
</p>
<table><tr><td> </td><td><pre class="example">bashdb -h
</pre></td></tr></table>
<p>to display all available options and briefly describe their use.
</p>
<p>When the bash debugger is invoked either by the <code>bashdb</code>
front-end script or <code>bash --debugging</code>, the first argument that
does not have an associated option flag for <code>bashdb</code> or
<code>bash</code> (as the case may be) is used as the name a the script file
to be debugged, and any following options get passed the debugged
script.
</p>
<p>Options for the <code>bashdb</code> front-end are shown in the
following list.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td><td> </td><td align="left" valign="top"> Options you can pass in starting bashdb
</td></tr>
</table>
<hr size="6">
<a name="Options-for-the-bashdb-script"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Starting-the-BASH-debugger" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Quitting-the-BASH-debugger" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Starting-the-BASH-debugger" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command_002dline-options-for-bashdb-script"></a>
<h3 class="subsection">2.1.1 Command-line options for <code>bashdb</code> script</h3>
<p>You can run the <acronym>BASH</acronym> debugger in various alternative modes—for example, in batch
mode or quiet mode.
</p>
<dl compact="compact">
<dt> <code>-h | --help</code></dt>
<dd><a name="index-_002dh"></a>
<a name="index-_002d_002dhelp"></a>
<p>This option causes the <acronym>BASH</acronym> debugger to print some basic help and exit.
</p>
</dd>
<dt> <code>-V | --version</code></dt>
<dd><a name="index-_002dV"></a>
<p>This option causes the <acronym>BASH</acronym> debugger to print its version number,
no-warranty blurb, and exit.
</p>
</dd>
<dt> <code>-A | --annodate <var>level</var></code></dt>
<dd><a name="index-_002dA"></a>
<a name="index-_002d_002dannotate"></a>
<p>Add additional output which allows front-ends to track what’s going on
without having to poll for such vital information. The default
annotation level is 0 (none). If you are running inside GNU Emacs
using the Emacs code from this package, an annotation level 3 when set
will allow for automatic tracking of frames and
breakpoints. See section <a href="#Annotate">Annotation Level (‘<samp>set annotate</samp>’)</a>.
</p>
</dd>
<dt> <code>-c | --command <var>cmd</var></code></dt>
<dd><a name="index-_002dc"></a>
<a name="index-_002d_002dcommand"></a>
<p>Run the string instead of running a script
</p>
</dd>
<dt> <code>-B | --basename</code></dt>
<dd><a name="index-_002dB"></a>
<a name="index-_002d_002dbasename"></a>
<p>This option causes the <acronym>BASH</acronym> debugger to print its version number and
no-warranty blurb, and exit.
</p>
</dd>
<dt> <code>-n | --nx | --no-init</code></dt>
<dd><a name="index-_002dn"></a>
<a name="index-_002d_002dnx"></a>
<a name="index-_002d_002dno_002dinit"></a>
<p>Do not execute commands found in any initialization files. Normally,
<acronym>BASH</acronym> executes the commands in these files after all the command
options and arguments have been processed. See section <a href="#Command-Files">Command files</a>.
</p>
</dd>
<dt> <code>-q | --quiet</code></dt>
<dd><a name="index-_002dq"></a>
<a name="index-_002d_002dquiet"></a>
<p>“Quiet”. Do not print the introductory and copyright messages. These
messages are also suppressed in batch mode.
</p>
</dd>
<dt> <code>-t | --terminal | --tty <var>tty</var></code></dt>
<dd><a name="index-_002dt"></a>
<a name="index-_002d_002dterminal"></a>
<a name="index-_002d_002dtty"></a>
<p>“Terminal output”. Set the file or terminal that you want debugger command
output to go to. Note that the debugger output is independent of the
debugged script output.
</p>
</dd>
<dt> <code>-x | --eval-command</code></dt>
<dd><a name="index-_002dx"></a>
<a name="index-_002d_002deval_002dcommand-cmdfile"></a>
<p>execute debugger commands from <var>cmdfile</var>.
</p></dd>
<dt> <code>-L | --library <var>directory</var></code></dt>
<dd>
<a name="index-_002dL"></a>
<a name="index-_002d_002dlibrary"></a>
<p>Set directory where debugger files reside to <var>directory</var>. The
default location is <code>../lib/bashdb</code> relative to the place that
the bashdb script is located. For example if bashdb is located in
<code>/usr/bin/bashdb</code>, the default library location will be
<code>/usr/lib/bashdb</code> which may or may not exist. If it doesn’t
you’ll get an error when you run bashdb. Only if the default location
is incorrect, should you need to use the <code>-L</code> option.
</p>
</dd>
<dt> <code>-T | --tempdir <var>directory</var></code></dt>
<dd><a name="index-_002dT"></a>
<a name="index-_002d_002dtempdir"></a>
<p>Set directory to use for writing temporary files.
</p>
</dd>
</dl>
<hr size="6">
<a name="Quitting-the-BASH-debugger"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Options-for-the-bashdb-script" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Calling-from-Program" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Quitting-the-BASH-debugger-1"></a>
<h2 class="section">2.2 Quitting the BASH debugger</h2>
<a name="index-interrupt"></a>
<p>An interrupt (often <kbd>C-c</kbd>) does not exit from the <acronym>BASH</acronym> debugger, but
rather terminates the action of any the <acronym>BASH</acronym> debugger command that is in
progress and returns to the <acronym>BASH</acronym> debugger command level. Inside a debugger
command interpreter, use <code>quit</code> command (see section <a href="#Quit">Quitting the BASH debugger</a>).
</p>
<p>There way to terminate the debugger is to use the <code>kill</code>
command. This does more forceful <code>kill -9</code>. It can be used in
cases where <code>quit</code> doesn’t work.
</p>
<hr size="6">
<a name="Calling-from-Program"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Quitting-the-BASH-debugger" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging-a-Running-Shell-Script" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Calling-the-BASH-debugger-from-inside-your-program"></a>
<h2 class="section">2.3 Calling the BASH debugger from inside your program</h2>
<p>Running a program from the debugger adds a bit of overhead and slows
down your program quite a bit. Addressing this better would mean some
serious changes to <acronym>BASH</acronym> internals, and judging from experience
in other languages there still the slowdown is still noticeable. If
you have a <code>configure</code> script generated by autoconf, and you want
to stop in the middle of the script, it can take quite a while.
</p>
<p>Furthermore, by necessity, debuggers change the operation of the
program they are debugging. And this can lead to unexpected and
unwanted differences. It has happened so often that the term
“Heisenbugs” (see <a href="http://en.wikipedia.org/wiki/Heisenbug">http://en.wikipedia.org/wiki/Heisenbug</a>) was
coined to describe the situation where the addition of the use of a
debugger (among other possibilities) changes behavior of the program
so that the bug doesn’t manifest itself anymore.
</p>
<p>There is another way to get into the debugger aside from calling
<code>bashdb</code> from the outset, and this adds no overhead or slowdown
until you reach the point at which you want to start
debugging. However for this method you must change the script. Because
the debugger isn’t involved before the first call, there is no
overhead; the script will run at the same speed as if there were no
debugger up to the point where it is first invoked.
</p><table class="menu" border="0" cellspacing="0">
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">* Debugging a Running Shell Script
</pre></th></tr><tr><td align="left" valign="top"><a href="#Program_002dControlled-Line-Tracing">2.3.2 Program-Controlled Line Tracing</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr size="6">
<a name="Debugging-a-Running-Shell-Script"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Calling-from-Program" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Explicit-Debugging-Calls_002e" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Calling-from-Program" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">2.3.1 Debugging a Running Shell Script</h3>
<p>In this section we’ll show how to modify your script so that it enters
the debugger when you send it a signal, and then we will show how you
can call the debugger directly.
</p>
<p>In either case, you’ll need to modify the script to load some the
debugger code. The name of file to load is <code>bashdb-trace</code> and it
is located in the directory where the other bash debugger files
live. For example on GNU/Linux if it is in directory
<code>/usr/local/share/bashdb</code>, you would first add to a <acronym>BASH</acronym>
script the line:
</p>
<table><tr><td> </td><td><pre class="smallexample"> source /usr/local/share/bashdb/bashdb-trace
</pre></td></tr></table>
<p>Although I said that running under the debugger adds overhead which
slows down you program, the above command in of itself will <em>not</em>
cause any slowdown. If possible, it’s best to put this somewhere in
the main-line code rather than in a function or in a subshell. If it
is put in a function of subshell and you step outside of that,
some of the global variables set up in <code>bashdb-trace</code> may be
lost. One the other hand if you know your debugging will be confined
to just the scope of the <code>source</code> command there is no problem.
</p>
<p>Here’s a complete example. In file ‘<tt>debugit.sh</tt>’
</p><table><tr><td> </td><td><pre class="smallexample"># This is my extra debug hook
source <em>/usr/share/bashdb/bashdb-trace</em> # adjust location
echo $$
while : ; do
date=$(date)
echo "$date"
sleep 2
done
</pre></td></tr></table>
<p>Now run:
</p><table><tr><td> </td><td><pre class="smallexample"> $ <b>bash ./debugit.sh</b>
Bourne-Again Shell Debugger, release bash-3.1-0.08
Copyright 2002, 2003, 2004, 2006 Rocky Bernstein
This 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.
9435
Thu Jun 19 02:43:06 EDT 2008
Thu Jun 19 02:43:08 EDT 2008
</pre></td></tr></table>
<p>Sent it an "interrupt" signal
</p><table><tr><td> </td><td><pre class="smallexample"> <b>kill -INT 9435</b>
</pre></td></tr></table>
<p>And back to the running program:
</p>
<table><tr><td> </td><td><pre class="smallexample"> Program received signal SIGINT (2)...
->0 in file `./debugit.sh' at line 251 # not sure where 251 came from!
##1 main() called from file `./debugit.sh' at line 0
bashdb<0> where
->0 in file `./debugit.sh' at line 9 # but this line number is now right
##1 main() called from file `./debugit.sh' at line 0
bashdb<1> <b>list 1</b>
1: # Set up some interrupt handlers to go into the debugger
2: source /usr/share/bashdb/bashdb-trace
3:
4: echo $$
5: while : ; do
6: date=$(date)
7: echo "$date"
8: sleep 2
9:==>done
bashdb<2> <b>step</b>
(./debugit.sh:5):
5: while : ; do
bashdb<3> <b>step</b>
(./debugit.sh:6):
6: date=$(date)
bashdb<4> <b>continue -</b>
</pre></td></tr></table>
<p>The command <code>continue -</code> not only continues execution but it
removes the debug trap allowing the program to run at full speed. It
is suitable only if there are no breakpoints that you care to stop at.
</p>
<p>By default, <code>bashdb-trace</code> sets up a handler for the ‘<samp>INT</samp>’
exception. If you down’t want this or you want enter the debugger on a
different signal to be use, <code>_Dbg_handler</code>. With this function
you can specify whether to show a call stack, stop (enter the
debugger) and/or print an indication that the a signal was seen.
</p>
<p>Here are some examples:
</p><table><tr><td> </td><td><pre class="smallexample"> _Dbg_handler INT print showstack nostop # this is the default
_Dbg_handler INT # same thing
_Dbg_hander # same thing
_Dbg_handler HUP print stop # stop in debugger when getting
</pre></td></tr></table>
<hr size="6">
<a name="Explicit-Debugging-Calls_002e"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugging-a-Running-Shell-Script" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Program_002dControlled-Line-Tracing" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging-a-Running-Shell-Script" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h4 class="subsubsection">2.3.1.1 Explicit Debugging Calls.</h4>
<p>As we saw in the last section <code>bashdb-trace</code> installs some signal
handlers. However you can make an explicit call to the debugger
</p><table><tr><td> </td><td><pre class="smallexample"> _Dbg_debugger
</pre></td></tr></table>
<p>Let’s show an example of that. We’ll even do it under a condition:
</p><table><tr><td> </td><td><pre class="smallexample"> for ((i=1; i<=10; i++)) ;
(( 5 == i )) && { _Dbg_debugger }
date=$(date)
echo "$date"
sleep 2
done
</pre></td></tr></table>
<p>The debugger will be called on the 5th iteration of this loop, when
<code>i</code> has the value 5.
</p>
<p>You can also supply the number of statements to skip and the options to
<code>_Dbg_debugger</code> just as you would to the debugger itself. All of
the options listed in <a href="#Options-for-the-bashdb-script">Command-line options for <code>bashdb</code> script</a> can be used
with the exception of <code>-c</code> (run a command) and of course you
don’t supply the name of a <acronym>BASH</acronym> script.
</p>
<p>For example to stop at the next line and suppress the banner you could
use <code>_Dbg_debugger 1 -q</code> in the above example.
</p>
<hr size="6">
<a name="Program_002dControlled-Line-Tracing"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Explicit-Debugging-Calls_002e" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Calling-from-Program" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Program_002dControlled-Line-Tracing-1"></a>
<h3 class="subsection">2.3.2 Program-Controlled Line Tracing</h3>
<p>You can also turn on and off line tracing. Here’s an example
</p>
<table><tr><td> </td><td><pre class="smallexample"> source <em>path-to-program</em>/bashdb-trace # modify location
...
_Dbg_linetrace_on
for i in `seq 10` ; do
echo $i
done
_Dbg_linetrace_off
_Dbg_QUIT_ON_QUIT=1
</pre></td></tr></table>
<p>The <code>_Dbg_QUIT_ON_QUIT</code> variable make sure the program doesn’t
stay inside the debugger after it quits. It can also be set earlier in
the program.
</p>
<p>Again <code><path-to-program></code> is whatever path needed to located
<code><bashdb-trace></code>. For example it might be <code></usr/local/share></code>
on some GNU/Linux installations.
</p>
<hr size="6">
<a name="Running"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Program_002dControlled-Line-Tracing" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Starting" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Script-Setup-inside-the-BASH-Debugger"></a>
<h1 class="chapter">3. Script Setup inside the BASH Debugger</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Starting">3.1 Starting your script</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Command-Files">3.2 Command files</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Arguments">3.3 Your script’s arguments</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Script_002fDebugger-Interaction">3.5 Script/Debugger Interaction</a></td><td> </td><td align="left" valign="top"> Keeping out of each other’s harm
</td></tr>
</table>
<hr size="6">
<a name="Starting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Running" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Files" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Running" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Starting-your-script"></a>
<h2 class="section">3.1 Starting your script</h2>
<a name="index-starting"></a>
<a name="index-running"></a>
<p>After invoking the debugger you should be on the first stoppable line
of your program to be debugged. At this point you can issue debugger
commands to set breakpoints (see section <a href="#Set-Breaks">Setting breakpoints</a>), or watchpoints (see section <a href="#Set-Watchpoints">Setting watchpoints</a>), or start continue the execution of the program
(see section <a href="#Resuming-Execution">Resuming Execution</a>).
</p>
<dl compact="compact">
<dd><a name="index-restart-_005bargs_005d"></a>
<a name="index-run-_0028restart_0029"></a>
<a name="index-R-_0028restart_0029"></a>
</dd>
<dt> <code>restart <span class="roman">[</span><var>args</var><span class="roman">]</span></code></dt>
<dt> <code>run <span class="roman">[</span><var>args</var><span class="roman">]</span></code></dt>
<dt> <code>R <span class="roman">[</span><var>args</var><span class="roman">]</span></code></dt>
<dd><p>Use the <code>restart</code> command to restart your script under
the <acronym>BASH</acronym> debugger. Without any arguments, the script name and parameters
from the last invocation are used. The <acronym>BASH</acronym> debugger tries to maintain the
settings, watchpoints, breakpoints, actions and so on. Internally it
uses line numbers and filenames to record he position of interesting
places in your porgram; so if your program changes some or all of
these numbers may be off. Environment variable
<code>DBG_RESTART_FILE</code> is and a temporary file are used to signal
a restart, so you shouldn’t uset <code>DBG_RESTART_FILE</code> (or any
environment variable starting with <code>BASHDB_</code>.
</p>
</dd>
</dl>
<hr size="6">
<a name="Command-Files"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Starting" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Arguments" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Running" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-files"></a>
<h2 class="section">3.2 Command files</h2>
<a name="index-command-files"></a>
<p>A command file for the <acronym>BASH</acronym> debugger is a file of lines that are the <acronym>BASH</acronym> debugger
commands. Comments (lines starting with <kbd>#</kbd>) may also be included.
An empty line in a command file does nothing; it does not mean to repeat
the last command, as it would from the terminal.
</p>
<a name="index-init-file"></a>
<a name="index-_002ebashdbinit"></a>
<a name="index-bashdb_002eini"></a>
<p>When you start the <acronym>BASH</acronym> debugger, it automatically executes commands from its
<em>init files</em>, normally called ‘<tt>.bashdbinit</tt>’<a name="DOCF3" href="#FOOT3">(3)</a>.
During startup, the <acronym>BASH</acronym> debugger does the following:
</p>
<ol>
<li>
Reads the init file (if any) in your home directory<a name="DOCF4" href="#FOOT4">(4)</a>.
</li><li>
Processes command line options and operands.
</li><li>
Reads the init file (if any) in the current working directory.
</li><li>
Reads command files specified by the ‘<samp>-x</samp>’ option.
</li></ol>
<p>The init file in your home directory can set options (such as ‘<samp>set
complaints</samp>’) that affect subsequent processing of command line options
and operands. Init files are not executed if you use the ‘<samp>-x</samp>’
option (see section <a href="#Options-for-the-bashdb-script">bashdb script options</a>).
</p>
<a name="index-init-file-name"></a>
<p>On some configurations of the <acronym>BASH</acronym> debugger, the init file is known by a
different name (these are typically environments where a specialized
form of the <acronym>BASH</acronym> debugger may need to coexist with other forms, hence a
different name for the specialized version’s init file). These are the
environments with special init file names:
</p>
<p>You can also request the execution of a command file with the
<code>source</code> command:
</p>
<dl compact="compact">
<dd><a name="index-source"></a>
</dd>
<dt> <code>source <var>filename</var></code></dt>
<dd><p>Execute the command file <var>filename</var>.
</p></dd>
</dl>
<p>The lines in a command file are executed sequentially. They are not
printed as they are executed. If there is an error, execution
proceeds to the next command in the file.
</p>
<hr size="6">
<a name="Arguments"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-Files" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Input_002fOutput" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Running" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Your-script_0027s-arguments"></a>
<h2 class="section">3.3 Your script’s arguments</h2>
<a name="index-arguments-_0028to-your-script_0029"></a>
<p>The arguments to your script can be specified by the arguments of the
<code>restart</code> command.
They are passed to a shell, which expands wildcard characters and
performs redirection of I/O, and thence to your script.
</p>
<p><code>restart</code> with no arguments uses the same arguments used by the previous
<code>restart</code>, or those set by the <code>set args</code> command..
</p>
<dl compact="compact">
<dd><a name="index-set-args"></a>
</dd>
<dt> <code>set args</code></dt>
<dd><p>Specify the arguments to be used if your program is rerun. If
<code>set args</code> has no arguments, <code>restart</code> executes your program
with no arguments. Once you have run your program with arguments,
using <code>set args</code> before the next <code>restart</code> is the only way to run
it again without arguments.
</p>
<a name="index-show-args"></a>
</dd>
<dt> <code>show args</code></dt>
<dd><p>Show the arguments to give your program when it is started.
</p></dd>
</dl>
<hr size="6">
<a name="Input_002fOutput"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Arguments" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Script_002fDebugger-Interaction" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Running" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Your-script_0027s-input-and-output"></a>
<h2 class="section">3.4 Your script’s input and output</h2>
<a name="index-redirection"></a>
<a name="index-I_002fO"></a>
<a name="index-terminal"></a>
<p>By default, the script you run under the <acronym>BASH</acronym> debugger does
input and output to the same terminal that <acronym>BASH</acronym> uses.
Before running the script to be debugged, the debugger records the tty
that was in effect. All of its output is then written to that.
However you can change this when using the ‘<samp>bashdb</samp>’ script using
the ‘<samp>-t</samp>’ option.
</p>
<dl compact="compact">
<dd><a name="index-info-terminal"></a>
</dd>
<dt> <code>info terminal</code></dt>
<dd><p>Displays information recorded by the <acronym>BASH</acronym> debugger about the terminal modes your
program is using.
</p></dd>
</dl>
<a name="index-tty"></a>
<a name="index-controlling-terminal"></a>
<p>Another way to specify where your script should do input and output is
with the <code>tty</code> command. This command accepts a file name as
argument, and causes this file to be the default for future <code>restart</code>
commands. It also resets the controlling terminal for the child
process, for future <code>restart</code> commands. For example,
</p>
<table><tr><td> </td><td><pre class="example">tty /dev/ttyb
</pre></td></tr></table>
<p>directs that processes started with subsequent <code>restart</code> commands
default to do input and output on the terminal ‘<tt>/dev/ttyb</tt>’ and have
that as their controlling terminal.
</p>
<p>An explicit redirection in <code>restart</code> overrides the <code>tty</code> command’s
effect on the input/output device, but not its effect on the controlling
terminal.
</p>
<p>When you use the <code>tty</code> command or redirect input in the <code>restart</code>
command, only the input <em>for your script</em> is affected. The input
for the <acronym>BASH</acronym> debugger still comes from your terminal.
</p>
<hr size="6">
<a name="Script_002fDebugger-Interaction"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Input_002fOutput" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Running" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Running" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Script_002fDebugger-Interaction-1"></a>
<h2 class="section">3.5 Script/Debugger Interaction</h2>
<p>The <acronym>BASH</acronym> debugger and your program live in the same variable space so to
speak. <acronym>BASH</acronym> does not have a notion of module scoping or
lexical hiding (yet) as is found in modern programming langauges and
in modern versions of the Korn shell. This then imposes some
additional care and awareness.
</p>
<p>Most of the variables and functions used inside the <acronym>BASH</acronym> debugger start
<code>_Dbg_</code>, so please don’t use variables or functions with these
names in your program.
</p>
<p><em>Note: there are some other variables that begin with just an
underscore (<code>_</code>); over time these will be phased out. But until
then, avoid those or consult what is used by the debugger. Run
‘<samp>bashdb --debugger -c "declare -p"</samp>’ to list all the variables in
use including those used by the debugger.</em>
</p>
<p>A number of environment variables are also reserved for use; these
start with <code>DBG_</code>. For example: <code>DBG_INPUT</code>,
<code>DBG_LEVEL</code> and, <code>_Dbg_QUIT_ON_QUIT</code> (see section <a href="#Debug">Debug</a>), <code>DBG_RESTART_FILE</code> (see section <a href="#Starting">Starting</a>), to
name a few. Finally, there are some <acronym>BASH</acronym> environment
dynamic variables and these start with <code>BASH_</code>. For example
<code>BASH_SUBSHELL</code> (see section <a href="#Debug">Debug</a>), <code>BASH_COMMAND</code>
(see section <a href="#Command-Display">Command Display</a>), <code>BASH_LINENO</code>, and
<code>BASH_SOURCE</code> to name a few.
</p>
<p>Inside the debugger some variables may be redefined. In particular
<code>IFS</code> and <code>PS4</code>, and various dollar variables <code>$?</code>,
<code>$1</code>, <code>$2</code>, etc. The values before entering the debugger are
saved and those variables have their old values restroed when leaving
the debugger. However you may notice these difference in various
debugger commands. For example <code>examine PS4</code> might not return the
same value as <code>eval declare -p PS4</code>. The former is picking the debugger
value while the <code>eval</code> is careful to restore the value to what
it was before entering the debugger.
</p>
<p>In order to do its work The <acronym>BASH</acronym> debugger sets up a <code>DEBUG</code>
trap. Consequently a script shouldn’t reset this or the debugger will
lose control. The <acronym>BASH</acronym> debugger also sets up an <code>EXIT</code> handler so that
it can gain control after the script finishes. Another signal
intercepted is the an interrupt or <code>INT</code> signal. For more
information about signal handling, see section <a href="#Signals">Signals</a>
</p>
<hr size="6">
<a name="Debugger-Command-Reference"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Script_002fDebugger-Interaction" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Running" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="BASH-Debugger-Command-Reference"></a>
<h1 class="chapter">4. BASH Debugger Command Reference</h1>
<p>You can abbreviate the long name of the <acronym>BASH</acronym> debugger command to the first
few letters of the command name, if that abbreviation is unambiguous;
and you can repeat the <code>next</code> o r<code>step</code> commands by typing
just <RET>. Some commands which require a parameter, such as
<code>print</code> remember the argument that was given to them.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Command-Syntax">4.1 Command syntax</a></td><td> </td><td align="left" valign="top"> How to give commands to the BASH debugger
</td></tr>
<tr><td align="left" valign="top"><a href="#Help">4.2 Getting help (‘<samp>help</samp>’)</a></td><td> </td><td align="left" valign="top"> How to ask for help (help)
</td></tr>
<tr><td align="left" valign="top"><a href="#Quit">4.3 Quitting the BASH debugger (‘<samp>quit</samp>’, ‘<samp>kill</samp>’)</a></td><td> </td><td align="left" valign="top"> Leaving the debugger (quit, kill)
</td></tr>
<tr><td align="left" valign="top"><a href="#Program-Information">4.5 Status and Debugger Settings (‘<samp>info</samp>’, ‘<samp>show</samp>’)</a></td><td> </td><td align="left" valign="top"> Status and Debugger settings (info, show)
</td></tr>
<tr><td align="left" valign="top"><a href="#Stopping">4.4 Stopping and Resuming Execution</a></td><td> </td><td align="left" valign="top"> Stopping and continuing (break, watch, step, cont...)
</td></tr>
<tr><td align="left" valign="top"><a href="#Stack">4.6 Examining the Stack Frame (‘<samp>where</samp>’, ‘<samp>frame</samp>’, ‘<samp>up</samp>’, ‘<samp>down</samp>’)</a></td><td> </td><td align="left" valign="top"> Examining the stack frame (where, up, down, frame)
</td></tr>
<tr><td align="left" valign="top"><a href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></td><td> </td><td align="left" valign="top"> Printing source files (list)
</td></tr>
<tr><td align="left" valign="top"><a href="#Edit">4.8 Editing Source files (‘<samp>edit</samp>’)</a></td><td> </td><td align="left" valign="top"> Editing source files (edit)
</td></tr>
<tr><td align="left" valign="top"><a href="#Search">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</a></td><td> </td><td align="left" valign="top"> Searching source files (/pat/ ?pat?)
</td></tr>
<tr><td align="left" valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td><td> </td><td align="left" valign="top"> Examining data (print, examine, info variables)
</td></tr>
<tr><td align="left" valign="top"><a href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></td><td> </td><td align="left" valign="top"> Arbitrary execution (eval, shell)
</td></tr>
<tr><td align="left" valign="top"><a href="#Interfacing-to-the-OS">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</a></td><td> </td><td align="left" valign="top"> Interfacing to the OS (cd, pwd)
</td></tr>
<tr><td align="left" valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td><td> </td><td align="left" valign="top"> Executing expressions on stop (display, undisplay)
</td></tr>
<tr><td align="left" valign="top"><a href="#Controlling-bashdb">4.14 Controlling bashdb (‘<samp>set</samp>’, ‘<samp>file</samp>’, ‘<samp>prompt</samp>’, ‘<samp>history</samp>’...)</a></td><td> </td><td align="left" valign="top"> Controlling bashdb (annotate, file, prompt, history...)
</td></tr>
</table>
<hr size="6">
<a name="Command-Syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Help" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-syntax"></a>
<h2 class="section">4.1 Command syntax</h2>
<p>A <acronym>BASH</acronym> debugger command is a single line of input. There is
no limit on how long it can be. It starts with a command name, which
is followed by arguments whose meaning depends on the command name.
For example, the command <code>step</code> accepts an argument which is the
number of times to step, as in ‘<samp>step 5</samp>’. You can also use the
<code>step</code> command with no arguments. Some commands do not allow any
arguments.
</p>
<a name="index-repeating-next_002fstep-commands"></a>
<a name="index-RET-_0028repeat-last-command_0029"></a>
<p>A blank line as input to the <acronym>BASH</acronym> debugger (typing just <RET>) means to
repeat the previous next or step command.
</p>
<a name="index-_0023-_0028a-comment_0029"></a>
<a name="index-comment"></a>
<p>Any text from a <kbd>#</kbd> to the end of the line is a comment; it does
nothing. This is useful mainly in command files (see section <a href="#Command-Files">Command files</a>).
</p>
<hr size="6">
<a name="Help"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-Syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Quit" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Getting-help-_0028help_0029"></a>
<h2 class="section">4.2 Getting help (‘<samp>help</samp>’)</h2>
<a name="index-online-documentation"></a>
<p>Once inside the <acronym>BASH</acronym> debugger, you can always ask it for
information on its commands, using the command <code>help</code>.
</p>
<dl compact="compact">
<dd><a name="index-h-_0028help_0029"></a>
</dd>
<dt> <code>help</code></dt>
<dt> <code>h</code></dt>
<dd><p>You can use <code>help</code> (abbreviated <code>h</code>) with no arguments to
display a short list of named classes of commands:
</p></dd>
</dl>
<table><tr><td> </td><td><pre class="smallexample">bashdb<0> <b>help</b>
Available commands:
/ debug enable help next show step- untrace
alias delete eval history print signal tbreak up
break disable examine info pwd skip trace watch
commands display file kill quit source tty where
condition down frame list restart step unalias
continue edit handle load set step+ undisplay
Readline command line editing (emacs/vi mode) is available.
Type "help" followed by command name for full documentation.
</pre></td></tr></table>
<dl compact="compact">
<dt> <code>help <var>command</var></code></dt>
<dd><p>With a command name as <code>help</code> argument, the <acronym>BASH</acronym>
debugger displays short information on how to use that command.
</p>
<table><tr><td> </td><td><pre class="example">bashdb<0> <b>help list</b>
l linespec List window lines starting at linespec.
l min incr List incr lines starting at 'min' linespec.
l List next window of lines.
l . Same as above.
Long command name: list.
</pre></td></tr></table>
<p>In addition to <code>help</code>, you can use the debugger command
<code>info</code> to inquire about the state of your script, or the state of
the <acronym>BASH</acronym> debugger itself. The listings under <code>info</code> in the Index
point to all the sub-commands. See section <a href="#Command-Index">Command Index</a>.
</p></dd>
</dl>
<dl compact="compact">
<dd><a name="index-info"></a>
<a name="index-i-_0028info_0029"></a>
</dd>
<dt> <code>info</code></dt>
<dd><p>This command (abbreviated <code>i</code>) is for describing the state of
your program. For example, you can list the arguments given to your
script with <code>info args</code>, or list the breakpoints you have set
with <code>info breakpoints</code>. You can get a complete list of the
<code>info</code> sub-commands with <code>help info</code>.
</p>
<table><tr><td> </td><td><pre class="example">bashdb<0> <b>help info</b>
List of info subcommands:
info args -- Argument variables (e.g. $1, $2, ...) of the current stack frame.
info breakpoints -- Status of user-settable breakpoints
info display -- Show all display expressions
info files -- Source files in the program
info functions -- All function names
info line -- list current line number and and file name
info program -- Execution status of the program.
info signals -- What debugger does when program gets various signals
info source -- Information about the current source file
info stack -- Backtrace of the stack
info terminal -- Print terminal device
info variables -- All global and static variable names
info warranty -- Various kinds of warranty you do not have
bashdb<1> <b>info source</b>
Current script file is parm.sh
Contains 34 lines.
</pre></td></tr></table>
</dd>
</dl>
<hr size="6">
<a name="Quit"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Help" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Stopping" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Quitting-the-BASH-debugger-_0028quit_002c-kill_0029"></a>
<h2 class="section">4.3 Quitting the BASH debugger (‘<samp>quit</samp>’, ‘<samp>kill</samp>’)</h2>
<dl compact="compact">
<dd><a name="index-quit-_005bexpression-_005bsubshell_002dlevels_005d_005d"></a>
<a name="index-q-_0028quit_0029"></a>
</dd>
<dt> <code>quit <span class="roman">[</span><var>expression</var><span class="roman">]</span></code></dt>
<dt> <code>quit <span class="roman">[</span><var>expression</var> <span class="roman">[</span><var>subshell-levels</var><span class="roman">]</span><span class="roman">]</span></code></dt>
<dt> <code>q</code></dt>
<dd>
<p>To exit the <acronym>BASH</acronym> debugger, use the <code>quit</code> command (abbreviated
<code>q</code>), or type an end-of-file character (usually <kbd>C-d</kbd>). If
you do not supply <var>expression</var>, the <acronym>BASH</acronym> debugger will try to terminate
normally or with exit code 0. Otherwise it will terminate using the
result of <var>expression</var> as the exit code.
</p>
<p>A simple <code>quit</code> tries to terminate all nested subshells that may
be in effect. If you are nested a subshell, this is normally
indicated in a debugger prompt by the number of parentheses that the
history number is inside — no parenthesis means there is no subshell
in effect. The dynamic variable <code>BASH_SUBSHELL</code> also contains the
number of subshells in effect.
</p>
<p>If you want only to terminate some number of subshells but not all of
them, you can give a count of the number of subshells to leave after
the return-code expression. To leave just one level of subshell
<code>return</code> does almost the same thing. (See see section <a href="#Returning">Returning</a>) There is a subtle difference between the two though:
<code>return</code> will leave you at the beginning of the next statement
while <code>quit</code> may leave you at the place the subshell was invoked
which may be in the middle of another command such as an assingment
statement or condition test.
</p>
<p>If the environment variable <code>_Dbg_QUIT_ON_QUIT</code> is set, when the
program terminates, the debugger will also terminate too. This may be
useful if you are debugging a script which calls another script and
you want this inner script just to return to the outer script.
</p>
</dd>
<dt> <code>kill</code></dt>
<dd><a name="index-k-_0028kill_0029"></a>
</dd>
<dt> <code>k</code></dt>
<dd><p>In situations where <code>quit</code> doesn’t work we provide an alternative
and more forceful quit command: <code>kill</code>. This sends to the OS
non-maskable KILL signal with the debugger process number. No cleanup
of temporary files is done by the program.
</p></dd>
</dl>
<hr size="6">
<a name="Stopping"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Quit" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Stopping-and-Resuming-Execution"></a>
<h2 class="section">4.4 Stopping and Resuming Execution</h2>
<p>One important use of a debugger is to stop your program <em>before</em> it
terminates so that if your script might run into trouble, you can
investigate and find out why. However should your script accidently
continue to termination, the <acronym>BASH</acronym> debugger has arranged for it not to leave the
debugger without your explicit instruction. That way, you can restart
the program using the same command arguments.
</p>
<p>Inside the <acronym>BASH</acronym> debugger, your script may stop for any of several reasons,
such as a signal, a breakpoint, or reaching a new line after a
debugger command such as <code>step</code>. You may then examine and
change variables, set new breakpoints or remove old ones, and then
continue execution.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td><td> </td><td align="left" valign="top"> Breakpoints, watchpoints (break, tbreak, watch, watche, clear)
</td></tr>
<tr><td align="left" valign="top"><a href="#Resuming-Execution">4.4.2 Resuming Execution (‘<samp>step</samp>’, ‘<samp>next</samp>’, ‘<samp>finish</samp>’, ‘<samp>skip</samp>’, ‘<samp>continue</samp>’, ‘<samp>debug</samp>’, ‘<samp>return</samp>’)</a></td><td> </td><td align="left" valign="top"> Resuming execution (continue, step, next, skip, finish, return, debug)
</td></tr>
<tr><td align="left" valign="top"><a href="#Signals">4.4.3 Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’, ‘<samp>signal</samp>’)</a></td><td> </td><td align="left" valign="top"> Signals
</td></tr>
</table>
<hr size="6">
<a name="Breakpoints"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Stopping" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Set-Breaks" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Stopping" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Breakpoints_002c-watchpoints-_0028break_002c-tbreak_002c-watch_002c-watche_002e_002e_002e_0029"></a>
<h3 class="subsection">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</h3>
<a name="index-breakpoints"></a>
<p>A <em>breakpoint</em> makes your script stop whenever a certain point in
the program is reached. For each breakpoint, you can add conditions to
control in finer detail whether your script stops.
</p>
<p>You specify the place where your script should stop with the <code>break</code>
command and its variants (see section <a href="#Set-Breaks">Setting breakpoints</a>). These commands allow own to specify the location by
line number and file name or function name.
</p>
<a name="index-watchpoints"></a>
<a name="index-breakpoint-on-variable-modification"></a>
<p>A <em>watchpoint</em> is a special breakpoint that stops your script when
the value of an expression changes. There is a different command to
set watchpoints (see section <a href="#Set-Watchpoints">Setting watchpoints</a>).
</p>
<p>But aside from that, you can manage a watchpoint like any other
breakpoint: you delete enable, and disable both breakpoints and
watchpoints using the same commands.
</p>
<p>You can arrange to have values from your program displayed automatically
whenever <acronym>BASH</acronym> stops at a breakpoint. See section <a href="#Auto-Display">Automatic display</a>.
</p>
<a name="index-breakpoint-numbers"></a>
<a name="index-numbers-for-breakpoints"></a>
<p>The <acronym>BASH</acronym> debugger assigns a number to each breakpoint when you create it;
these numbers are successive integers starting with one. In many of
the commands for controlling various features of breakpoints you use
the breakpoint number to say which breakpoint you want to change.
Each breakpoint may be <em>enabled</em> or <em>disabled</em>; if disabled,
it has no effect on your script until you enable it again.
</p>
<a name="index-watchpoints-numbers"></a>
<a name="index-numbers-for-watchpoints"></a>
<p>Watchpoint numbers however are distinguished from breakpoint numbers by
virtue of their being suffixed with the either an upper- or lower-case
‘W’. For example, to enable breakpoint entry 0 along with watchpoint
entry 1 you would write ‘<samp>enable 1 2w</samp>’, the “2w” refers to the
watchpoint; “2W” would work just as well.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td><td> </td><td align="left" valign="top"> Setting breakpoints (break, tbreak)
</td></tr>
<tr><td align="left" valign="top"><a href="#Set-Watchpoints">4.4.1.2 Setting watchpoints (‘<samp>watch</samp>’, ‘<samp>watche</samp>’)</a></td><td> </td><td align="left" valign="top"> Setting watchpoints (watch, watche)
</td></tr>
<tr><td align="left" valign="top"><a href="#Break-Commands">4.4.1.3 Breakpoint command lists (‘<samp>commands</samp>’)</a></td><td> </td><td align="left" valign="top"> Breakpoint command lists (command)
</td></tr>
<tr><td align="left" valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td><td> </td><td align="left" valign="top"> Deleting breakpoints (delete, clear)
</td></tr>
<tr><td align="left" valign="top"><a href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></td><td> </td><td align="left" valign="top"> Disabling breakpoints (disable, enable)
</td></tr>
<tr><td align="left" valign="top"><a href="#Conditions">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</a></td><td> </td><td align="left" valign="top"> Break conditions (condition)
</td></tr>
</table>
<hr size="6">
<a name="Set-Breaks"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Breakpoints" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Set-Watchpoints" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Setting-breakpoints-_0028break-tbreak_0029"></a>
<h4 class="subsubsection">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</h4>
<a name="index-break"></a>
<a name="index-b-_0028break_0029"></a>
<a name="index-latest-breakpoint"></a>
<p>Breakpoints are set with the <code>break</code> command (abbreviated
<code>b</code>).
</p>
<dl compact="compact">
<dt> <code>break <var>function</var></code></dt>
<dd><p>Set a breakpoint at entry to function <var>function</var>.
</p>
</dd>
<dt> <code>break <var>linenum</var></code></dt>
<dd><p>Set a breakpoint at line <var>linenum</var> in the current source file.
The current source file is the last file whose source text was printed.
The breakpoint will stop your script just before it executes any of the
code on that line.
</p>
</dd>
<dt> <code>break <var>filename</var>:<var>linenum</var></code></dt>
<dd><p>Set a breakpoint at line <var>linenum</var> in source file <var>filename</var>;
<var>filename</var> has to be one of the files previously read in and has
to be specified exactly as the name used when read in. For a list of
read-in files, use the ‘<samp>info files</samp>’ command.
</p>
</dd>
<dt> <code>break … if <var>cond</var></code></dt>
<dd><p>Set a breakpoint with condition <var>cond</var>; evaluate the expression
<var>cond</var> each time the breakpoint is reached, and stop only if the
value is nonzero—that is, if <var>cond</var> evaluates as true. The
expression is evaluated via the <code>let</code> builtin funtion.
‘<samp>…</samp>’ stands for one of the possible arguments described
above (or no argument) specifying where to break. The word “if” is
often optional and is necessary only ‘<samp>…</samp>’ is
omitted. See section <a href="#Conditions">Break conditions</a>, for more information on
breakpoint conditions.
</p>
<p>Examples:
</p><table><tr><td> </td><td><pre class="example">bashdb<0> <b>break fn1</b>
Breakpoint 1 set in file parm.sh, line 3.
bashdb<1> <b>break 28</b>
Breakpoint 2 set in file parm.sh, line 28.
bashdb<2> <b>break parm.sh:29</b>
Breakpoint 3 set in file parm.sh, line 29.
bashdb<3> <b>break 28 if x==5</b>
Breakpoint 4 set in file parm.sh, line 28.
</pre></td></tr></table>
<a name="index-tbreak"></a>
</dd>
<dt> <code>tbreak <var>args</var></code></dt>
<dd><p>Set a breakpoint enabled only for one stop. <var>args</var> are the
same as for the <code>break</code> command, and the breakpoint is set in the same
way, but the breakpoint is automatically deleted after the first time your
program stops there. See section <a href="#Disabling">Disabling breakpoints</a>.
</p>
<a name="index-info-breakpoints"></a>
<a name="index-_0024_005f-and-info-breakpoints"></a>
</dd>
<dt> <code>info breakpoints <span class="roman">[</span><var>n</var><span class="roman">]</span></code></dt>
<dt> <code>info break <span class="roman">[</span><var>n</var><span class="roman">]</span></code></dt>
<dt> <code>info watchpoints <span class="roman">[</span><var>n</var><span class="roman">]</span></code></dt>
<dd><p>Print a table of all breakpoints, watchpoints set and not deleted,
with the following columns for each breakpoint:
</p>
<dl compact="compact">
<dt> <em>Breakpoint Numbers (‘<samp>Num</samp>’)</em></dt>
<dt> <em>Enabled or Disabled (‘<samp>Enb</samp>’)</em></dt>
<dd><p>Enabled breakpoints are marked with ‘<samp>1</samp>’. ‘<samp>0</samp>’ marks breakpoints
that are disabled (not enabled).
</p></dd>
<dt> <em>Count</em></dt>
<dd><p>The number of times that breakpoint or watchpoint has been hit.
</p></dd>
<dt> <em>File and Line (‘<samp>file:line</samp>’)</em></dt>
<dd><p>The filename and line number inside that file where of breakpoint in
the script. The file and line are separated with a colon.
</p></dd>
<dt> <em>Condition</em></dt>
<dd><p>A condition (an arithmetic expression) which when true causes the
breakpoint to take effect.
</p></dd>
</dl>
<p>If a breakpoint is conditional, <code>info break</code> shows the condition on
the line following the affected breakpoint; breakpoint commands, if any,
are listed after that.
</p>
<p><code>info break</code> displays a count of the number of times the breakpoint
has been hit.
</p>
<p><code>info break</code> with a breakpoint number <var>n</var> as argument lists
only that breakpoint.
</p>
<p>Examples:
</p><table><tr><td> </td><td><pre class="example">bashdb<4> <b>info break</b>
Breakpoints at following places:
Num Type Disp Enb What
1 breakpoint keep y parm.sh:3
2 breakpoint keep y parm.sh:28
3 breakpoint keep y parm.sh:29
4 breakpoint keep y parm.sh:28
No watch expressions have been set.
bashdb<5> <b>info break 4</b>
Num Type Disp Enb What
4 breakpoint keep y parm.sh:28
No watch expressions have been set.
</pre></td></tr></table>
</dd>
</dl>
<p>the <acronym>BASH</acronym> debugger allows you to set any number of breakpoints at the same place in
your script. There is nothing silly or meaningless about this. When
the breakpoints are conditional, this is even useful
(see section <a href="#Conditions">Break conditions</a>).
</p>
<hr size="6">
<a name="Set-Watchpoints"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Set-Breaks" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Break-Commands" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Setting-watchpoints-_0028watch_002c-watche_0029"></a>
<h4 class="subsubsection">4.4.1.2 Setting watchpoints (‘<samp>watch</samp>’, ‘<samp>watche</samp>’)</h4>
<a name="index-setting-watchpoints"></a>
<p>You can use a watchpoint to stop execution whenever the value of an
expression changes, without having to predict a particular place where
this may happen. As with the <code>print</code> (see section <a href="#Data">Examining Data</a>), the idiosyncracies of a <acronym>BASH</acronym> or any POSIX shell
derivative suggest using two commands. The <code>watch</code> command is
just for a single variables; the <code>watche</code> command uses the
builtin “let” command to evaluate an expression. If the variable you
are tracking can take a string value, issuing something like
‘<samp>watch foo</samp>’ will not have the desired effect—any string
assignment to <code>foo</code> will have a value 0 when it is assigned via
“let.”
</p>
<dl compact="compact">
<dd><a name="index-watch"></a>
</dd>
<dt> <code>watch <var>var</var></code></dt>
<dd><p>Set a watchpoint for a variable. the <acronym>BASH</acronym> debugger will break when the
value of <var>var</var> changes. In this command do not add a leading
dollar symbol to <var>var</var>.
</p>
</dd>
<dt> <code>watche <var>expr</var></code></dt>
<dd><p>Set a watchpoint for an expression via the builtin “let” command.
the <acronym>BASH</acronym> debugger will break when <var>expr</var> is written into by the program
and its value changes. Not that this may not work for tracking
arbitrary string value changes. For that use <code>watch</code> described
earlier.
</p></dd>
</dl>
<hr size="6">
<a name="Break-Commands"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Set-Watchpoints" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Delete-Breaks" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Breakpoint-command-lists-_0028commands_0029"></a>
<h4 class="subsubsection">4.4.1.3 Breakpoint command lists (‘<samp>commands</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-commands"></a>
<a name="index-end"></a>
</dd>
<dt> <code>commands <span class="roman">[</span><var>bnum</var><span class="roman">]</span></code></dt>
<dt> <code>… <var>command-list</var> …</code></dt>
<dt> <code>end</code></dt>
<dd><p>Specify a list of commands for breakpoint number <var>bnum</var>. The commands
themselves appear on the following lines. Type a line containing just
<code>end</code> to terminate the commands.
</p>
<p>To remove all commands from a breakpoint, type <code>commands</code> and
follow it immediately with <code>end</code>; that is, give no commands.
</p>
<p>With no <var>bnum</var> argument, <code>commands</code> refers to the last
breakpoint, watchpoint, or catchpoint set (not to the breakpoint most
recently encountered).
</p></dd>
</dl>
<p>Pressing <RET> as a means of repeating the last debugger command is
disabled within a <var>command-list</var>.
</p>
<p>You can use breakpoint commands to start your program up again. Simply
use the <code>continue</code> command, or <code>step</code>, or any other command
that resumes execution.
</p>
<p>Any other commands in the command list, after a command that resumes
execution, are ignored. This is because any time you resume execution
(even with a simple <code>next</code> or <code>step</code>), you may encounter
another breakpoint—which could have its own command list, leading to
ambiguities about which list to execute.
</p>
<a name="index-silent"></a>
<p>If the first command you specify in a command list is <code>silent</code>, the
usual message about stopping at a breakpoint is not printed. This may
be desirable for breakpoints that are to print a specific message and
then continue. If none of the remaining commands print anything, you
see no sign that the breakpoint was reached. <code>silent</code> is
meaningful only at the beginning of a breakpoint command list.
</p>
<p>The commands <code>echo</code>, <code>output</code>, and <code>printf</code> allow you to
print precisely controlled output, and are often useful in silent
breakpoints.
</p>
<p>For example, here is how you could use breakpoint commands to print the
value of <code>x</code> at entry to <code>foo</code> whenever <code>x</code> is positive.
</p>
<table><tr><td> </td><td><pre class="smallexample">break foo if x>0
commands
silent
printf "x is %d\n",x
cont
end
</pre></td></tr></table>
<p>One application for breakpoint commands is to compensate for one bug so
you can test for another. Put a breakpoint just after the erroneous line
of code, give it a condition to detect the case in which something
erroneous has been done, and give it commands to assign correct values
to any variables that need them. End with the <code>continue</code> command
so that your program does not stop, and start with the <code>silent</code>
command so that no output is produced. Here is an example:
</p>
<table><tr><td> </td><td><pre class="smallexample">break 403
commands
silent
set x = y + 4
cont
end
</pre></td></tr></table>
<hr size="6">
<a name="Delete-Breaks"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Break-Commands" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Disabling" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Deleting-breakpoints-_0028clear_002c-delete_0029"></a>
<h4 class="subsubsection">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</h4>
<a name="index-clearing-breakpoints_002c-watchpoints"></a>
<a name="index-deleting-breakpoints_002c-watchpoints"></a>
<p>It may desirable to eliminate a breakpoint or watchpoint once it
has done its job and you no longer want your script to stop there.
This is called <em>deleting</em> the breakpoint. A breakpoint that has
been deleted no longer exists; it is forgotten.
</p>
<p>With the <code>clear</code> command you can delete breakpoints according to
where they are in your script. With the <code>delete</code> command you can
delete individual breakpoints, or watchpoints by specifying their
breakpoint numbers. <em>Note: as described below under the “clear”
command, “d” is an alias for “clear”, not “delete”. </em>
</p>
<p>It is not necessary to delete a breakpoint to proceed past it. the <acronym>BASH</acronym> debugger
automatically ignores breakpoints on the first instruction to be executed
when you continue execution.
</p>
<dl compact="compact">
<dd><a name="index-clear"></a>
<a name="index-d-_0028clear_0029"></a>
</dd>
<dt> <code>clear</code></dt>
<dd><p>Delete any breakpoints at the next instruction to be executed in the
selected stack frame (see section <a href="#Selection">Selecting a frame</a>). When
the innermost frame is selected, this is a good way to delete a
breakpoint where your script just stopped.
</p>
<p>It may seem odd that we have an alias “d” for “clear.” It so
happens that Perl’s debugger use “d” for its delete command and the
delete concept in Perl’s debugger corresponds to “clear” in
GDB. (Perl doesn’t have a notion of breakpoint entry numbers). So in
order to be compatible with both debugger interfaces, “d” is used as
an alias for “clear.” Clear?
</p>
</dd>
<dt> <code>clear <var>function</var></code></dt>
<dt> <code>clear <var>filename</var>:<var>function</var></code></dt>
<dd><p>Delete any breakpoints set at entry to the function <var>function</var>.
</p>
</dd>
<dt> <code>clear <var>linenum</var></code></dt>
<dt> <code>d <var>linenum</var></code></dt>
<dd><p>Delete any breakpoints set at or within the code of the specified line.
</p>
<a name="index-delete-breakpoints"></a>
<a name="index-delete"></a>
<a name="index-de-_0028delete_0029"></a>
</dd>
<dt> <code>delete <span class="roman">[</span><var>breakpoints</var><span class="roman">]</span></code></dt>
<dd><p>Delete the breakpoints, watchpoints specified as arguments.
</p>
<p>If no argument is specified, delete all breakpoints (the <acronym>BASH</acronym> debugger asks
confirmation, unless you have <code>set confirm off</code>). You can
abbreviate this command as <code>de</code>.
</p>
<p>Note that for compatibility with Perl’s debugger, <code>d</code> means
something else: <code>clear</code>.
</p>
</dd>
</dl>
<hr size="6">
<a name="Disabling"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Delete-Breaks" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Conditions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Disabling-breakpoints-_0028disable_002c-enable_0029"></a>
<h4 class="subsubsection">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</h4>
<p>Rather than deleting a breakpoint or watchpoint, you might
prefer to <em>disable</em> it. This makes the breakpoint inoperative as if
it had been deleted, but remembers the information on the breakpoint so
that you can <em>enable</em> it again later.
</p>
<p>You disable and enable breakpoints, watchpoints, and catchpoints with
the <code>enable</code> and <code>disable</code> commands, optionally specifying one
or more breakpoint numbers as arguments. Use <code>info break</code> or
<code>info watch</code> to print a list of breakpoints, watchpoints, and
catchpoints if you do not know which numbers to use.
</p>
<p>A breakpoint, watchpoint, or catchpoint can have any of four different
states of enablement:
</p>
<ul>
<li>
Enabled. The breakpoint stops your program. A breakpoint set
with the <code>break</code> command starts out in this state.
</li><li>
Disabled. The breakpoint has no effect on your program.
</li><li>
Enabled once. The breakpoint stops your program, but then becomes
disabled.
</li><li>
Enabled for deletion. The breakpoint stops your program, but
immediately after it does so it is deleted permanently. A breakpoint
set with the <code>tbreak</code> command starts out in this state.
</li></ul>
<p>You can use the following commands to enable or disable breakpoints,
watchpoints, and catchpoints:
</p>
<dl compact="compact">
<dd><a name="index-disable-breakpoints"></a>
<a name="index-disable"></a>
<a name="index-dis-_0028disable_0029"></a>
</dd>
<dt> <code>disable <span class="roman">[</span><var>breakpoints</var><span class="roman">]</span></code></dt>
<dd><p>Disable the specified breakpoints—or all breakpoints, if none are
listed. A disabled breakpoint has no effect but is not forgotten. All
options such as ignore-counts, conditions and commands are remembered in
case the breakpoint is enabled again later. You may abbreviate
<code>disable</code> as <code>dis</code>.
</p>
<a name="index-enable-breakpoints"></a>
<a name="index-enable"></a>
</dd>
<dt> <code>enable <span class="roman">[</span><var>breakpoints</var><span class="roman">]</span></code></dt>
<dd><p>Enable the specified breakpoints (or all defined breakpoints). They
become effective once again in stopping your program.
</p></dd>
</dl>
<p>Except for a breakpoint set with <code>tbreak</code> (see section <a href="#Set-Breaks">Setting breakpoints</a>), breakpoints that you set are initially enabled;
subsequently, they become disabled or enabled only when you use one of
the commands above. (The command <code>until</code> can set and delete a
breakpoint of its own, but it does not change the state of your other
breakpoints; see <a href="#Resuming-Execution">Resuming Execution</a>.)
</p>
<hr size="6">
<a name="Conditions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Disabling" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Breakpoints" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Break-conditions-_0028condition_0029"></a>
<h4 class="subsubsection">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</h4>
<a name="index-conditional-breakpoints"></a>
<a name="index-breakpoint-conditions"></a>
<p>The simplest sort of breakpoint breaks every time your script reaches
a specified place. You can also specify a <em>condition</em> for a
breakpoint. A condition is just a <acronym>BASH</acronym> expression.
</p>
<p>Break conditions can be specified when a breakpoint is set, by using
‘<samp>if</samp>’ in the arguments to the <code>break</code> command. See section <a href="#Set-Breaks">Setting breakpoints</a>. A breakpoint with a condition
evaluates the expression each time your script reaches it, and your
script stops only if the condition is <em>true</em>. They can also be
changed at any time with the <code>condition</code> command.
</p>
<a name="index-one_002dtime-breakpoints"></a>
<p>There is also a notion of a “one-time” breakpoint which gets deleted
as soon as it is hit, so that that breakpoint is executed once only.
</p>
<p>Conditions are also accepted for watchpoints; you may not need them,
since a watchpoint is inspecting the value of an expression anyhow—but
it might be simpler, say, to just set a watchpoint on a variable name,
and specify a condition that tests whether the new value is an interesting
one.
</p>
<dl compact="compact">
<dd><a name="index-condition"></a>
</dd>
<dt> <code>condition <var>bnum</var> <var>expression</var></code></dt>
<dd><p>Specify <var>expression</var> as the break condition for breakpoint
<var>bnum</var>. After you set a condition, breakpoint <var>bnum</var> stops
your program only if the value of <var>expression</var> is true (nonzero).
</p>
</dd>
<dt> <code>condition <var>bnum</var></code></dt>
<dd><p>Remove the condition from breakpoint number <var>bnum</var>. It becomes
an ordinary unconditional breakpoint.
</p></dd>
</dl>
<p><acronym>BASH</acronym> does
not actually evaluate <var>expression</var> at the time the <code>condition</code>
command (or a command that sets a breakpoint with a condition, like
<code>break if …</code>) is given, however.
</p>
<p>Examples;
</p><table><tr><td> </td><td><pre class="example">condition 1 x>5 # Stop on breakpoint 0 only if x>5 is true.
condition 1 # Change that! Unconditinally stop on breakpoint 1.
</pre></td></tr></table>
<hr size="6">
<a name="Resuming-Execution"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Conditions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Step" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Stopping" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Resuming-Execution-_0028step_002c-next_002c-finish_002c-skip_002c-continue_002c-debug_002c-return_0029"></a>
<h3 class="subsection">4.4.2 Resuming Execution (‘<samp>step</samp>’, ‘<samp>next</samp>’, ‘<samp>finish</samp>’, ‘<samp>skip</samp>’, ‘<samp>continue</samp>’, ‘<samp>debug</samp>’, ‘<samp>return</samp>’)</h3>
<p>A typical technique for using stepping is to set a breakpoint
(see section <a href="#Breakpoints">Breakpoints; watchpoints</a>) at the
beginning of the function or the section of your script where a problem
is believed to lie, run your script until it stops at that breakpoint,
and then step through the suspect area, examining the variables that are
interesting, until you see the problem happen.
</p>
<a name="index-stepping"></a>
<a name="index-continuing"></a>
<a name="index-resuming-execution"></a>
<p><em>Continuing</em> means resuming program execution until your script
completes normally. In contrast, <em>stepping</em> means executing just
one more “step” of your script, where “step” may mean either one
line of source code. Either when continuing or when stepping,
your script may stop even sooner, due to a breakpoint or a signal.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Step">4.4.2.1 Step (‘<samp>step</samp>’)</a></td><td> </td><td align="left" valign="top"> running the next statement (step)
</td></tr>
<tr><td align="left" valign="top"><a href="#Next">4.4.2.2 Next (‘<samp>next</samp>’)</a></td><td> </td><td align="left" valign="top"> running the next statement skipping over functions (next)
</td></tr>
<tr><td align="left" valign="top"><a href="#Finish">4.4.2.3 Finish (‘<samp>finish</samp>’)</a></td><td> </td><td align="left" valign="top"> running until the return of a function or “source” (finish)
</td></tr>
<tr><td align="left" valign="top"><a href="#Skip">4.4.2.4 Skip (‘<samp>skip</samp>’)</a></td><td> </td><td align="left" valign="top"> skipping the next statement (skip)
</td></tr>
<tr><td align="left" valign="top"><a href="#Continue">4.4.2.5 Continue (‘<samp>continue</samp>’)</a></td><td> </td><td align="left" valign="top"> continuing execution (continue)
</td></tr>
<tr><td align="left" valign="top"><a href="#Debug">4.4.2.6 Debug (‘<samp>debug</samp>’)</a></td><td> </td><td align="left" valign="top"> debugging into another program (debug)
</td></tr>
<tr><td align="left" valign="top"><a href="#Returning">4.4.2.7 Returning from a function, sourced file, or subshell (‘<samp>return</samp>’)</a></td><td> </td><td align="left" valign="top"> returning
</td></tr>
</table>
<hr size="6">
<a name="Step"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Resuming-Execution" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Next" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Step-_0028step_0029"></a>
<h4 class="subsubsection">4.4.2.1 Step (‘<samp>step</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-step"></a>
<a name="index-s-_0028step_0029"></a>
</dd>
<dt> <code>step<span class="roman">[</span><var>+|-</var><span class="roman">]</span> <span class="roman">[</span><var>count</var><span class="roman">]</span></code></dt>
<dd><p>Continue running your script until control reaches a different source
line, then stop it and return control to the <acronym>BASH</acronym> debugger. An default
alias alias for this is <code>s</code>.
</p>
<p>The <code>step</code> command only stops at the first instruction of a source
line. This prevents the multiple stops that could otherwise occur in
<code>switch</code> statements, <code>for</code> loops, etc. <code>step</code> continues
to stop if a function that has debugging information is called within
the line. In other words, <code>step</code> <em>steps inside</em> any functions
called within the line.
</p>
<p>Sometimes you want to step ensure that the next line is different from
the one you currently are on. To do this, add the <code>+</code> suffix. And
if you find you want to do this all of the time there is a setting
<code>force</code> that will have this be the default behavior. On the other
hand if you want to be explicit about not having this behavior even
when <code>force</code> is in effect add the <code>-</code> suffix.
</p>
<p>With a count, continue running as in <code>step</code>, but do so
<var>count</var> times. If a breakpoint is reached, or a signal not
related to stepping occurs before <var>count</var> steps, stepping stops
right away.
</p></dd>
</dl>
<hr size="6">
<a name="Next"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Step" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Finish" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Next-_0028next_0029"></a>
<h4 class="subsubsection">4.4.2.2 Next (‘<samp>next</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-next"></a>
<a name="index-n-_0028next_0029"></a>
</dd>
<dt> <code>next <span class="roman">[</span><var>count</var><span class="roman">]</span></code></dt>
<dd><p>Continue to the next source line in the current (innermost) stack frame.
This is similar to <code>step</code>, but function calls that appear within
the line of code are executed without stopping. Execution stops when
control reaches a different line of code at the original stack level
that was executing when you gave the <code>next</code> command. This command
is abbreviated <code>n</code>.
</p>
<p>An argument <var>count</var> is a repeat count, as for <code>step</code>.
</p></dd>
</dl>
<hr size="6">
<a name="Finish"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Next" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Skip" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Finish-_0028finish_0029"></a>
<h4 class="subsubsection">4.4.2.3 Finish (‘<samp>finish</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-finish"></a>
</dd>
<dt> <code>finish</code></dt>
<dd><p>Continue running until just after function returns. <em>Currently,
the line shown on a return is the function header, unless the
<code>return</code> builtin function is executed in which case it is the
line number of the <code>return</code> function.</em>
</p>
<p>Contrast this with the <code>return</code> command (see section <a href="#Returning">Returning from a function</a>) and the <code>quit</code> (see section <a href="#Quitting-the-BASH-debugger">Quitting the BASH debugger</a>).
</p>
</dd>
</dl>
<hr size="6">
<a name="Skip"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Finish" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Continue" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Skip-_0028skip_0029"></a>
<h4 class="subsubsection">4.4.2.4 Skip (‘<samp>skip</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-skip"></a>
</dd>
<dt> <code>skip <span class="roman">[</span><var>count</var><span class="roman">]</span></code></dt>
<dd><p>Skip execution of the next source line.
This may be useful if you have an action that “fixes” existing code in
the script. The <code>debug</code> command internally uses the <code>skip</code> command
to skip over existing non-debugged invocation that was presumably just
run.
</p></dd>
</dl>
<hr size="6">
<a name="Continue"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Skip" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debug" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Continue-_0028continue_0029"></a>
<h4 class="subsubsection">4.4.2.5 Continue (‘<samp>continue</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-continue"></a>
<a name="index-c-_0028continue_0029"></a>
</dd>
<dt> <code>continue <span class="roman">[</span><var>- | line-specification</var><span class="roman">]</span></code></dt>
<dt> <code>c <span class="roman">[</span><var>line-specification</var><span class="roman">]</span></code></dt>
<dd><p>Resume program execution, at the address where your script last
stopped; any breakpoints set at that address are bypassed.
</p>
<p>The optional argument <var>line-specification</var> allows you to specify a
location (a line number, function, or filename linenumber combination)
to set a one-time breakpoint which is deleted when that breakpoint is
reached. Should the program stop before that breakpoint is reached, in
a listing of the breakpoints you will see this entry with the
condition 9999 which indicates a one-time breakpoint.
</p>
<p>If instead of a line specification you enter <code>-</code>, debugging will be
turned of after continuing causing the program to run at full speed.
</p></dd>
</dl>
<p>To resume execution at a different place, you can use <code>return</code>
(see section <a href="#Returning">Returning from a function</a>) to go back to the
calling function or sourced script. If you are nested inside a
subshell, <code>quit</code> with a value for the number of subshells to
exit also functions like a return.
</p>
<hr size="6">
<a name="Debug"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Continue" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Returning" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debug-_0028debug_0029"></a>
<h4 class="subsubsection">4.4.2.6 Debug (‘<samp>debug</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-debug"></a>
</dd>
<dt> <code>debug <span class="roman">[</span><var>script-name</var><span class="roman">]</span></code></dt>
<dd><p>Debug into <var>script-name</var>. If no name is given the current source line
is used. In either case the options are prepended to cause the
debugger to run.
</p>
<p>The nesting level of the debugger is saved inside environment variable
<code>_Dbg_DEBUGGER_LEVEL</code>. The debugger prompt indicates the level of nesting
by enclosing the history in that many nestings of <code><></code> symbols.
</p>
</dd>
</dl>
<hr size="6">
<a name="Returning"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debug" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Signals" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Resuming-Execution" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Returning-from-a-function_002c-sourced-file_002c-or-subshell-_0028return_0029"></a>
<h4 class="subsubsection">4.4.2.7 Returning from a function, sourced file, or subshell (‘<samp>return</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-returning-from-a-function_002c-sourced-file-or-subshell"></a>
<a name="index-return"></a>
</dd>
<dt> <code>return</code></dt>
<dd><p>You can cancel execution of a function call or a subshell with the
<code>return</code> command.
</p></dd>
</dl>
<p>The <code>return</code> command does not resume execution; it leaves the
program stopped in the state that would exist if the function had just
returned. See also the <code>quit</code> command (<a href="#Quit">Quitting the BASH debugger</a>). In some situations <code>return</code> is similar to
<code>quit</code>: in particular when the script is <em>not</em> currenlty
inside in a function and the number of subshells in effect is 0, or
when a subshell count of 1 is given on the <code>quit</code> command.
</p>
<p>In contrast, the <code>finish</code> command (see section <a href="#Finish">Finish</a>)
resumes execution until the selected stack frame returns naturally.
</p>
<hr size="6">
<a name="Signals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Returning" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#handle" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Stopping" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Signals-_0028handle_002c-info-handle_002c-signal_0029"></a>
<h3 class="subsection">4.4.3 Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’, ‘<samp>signal</samp>’)</h3>
<a name="index-signals"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#handle">4.4.3.1 Intercepting Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’)</a></td><td> </td><td align="left" valign="top"> Specify which signals to handle and show what’s been set
</td></tr>
<tr><td align="left" valign="top"><a href="#signal">4.4.3.2 Sending your program a signal (‘<samp>signal</samp>’)</a></td><td> </td><td align="left" valign="top"> Send a signal to your program
</td></tr>
</table>
<p>A signal is an asynchronous event that can happen in a program. The
operating system defines the possible kinds of signals, and gives each
kind a name and a number. For example, in Unix <code>SIGINT</code> is the
signal a program gets when you type an interrupt character (often
<kbd>C-c</kbd>); <code>SIGALRM</code> occurs when the alarm clock timer goes off
(which happens only if your program has requested an alarm).
</p>
<p>Some signal handlers are installed and changed for the <acronym>BASH</acronym> debugger’s
normal use: <code>SIGDEBUG</code> and <code>SIGEXIT</code>. <code>SIGDEBUG</code> is
used by the debugger to potentially stop your program before execution
of each statement occurs, and <code>SIGEXIT</code> is used to catch your
program just before it is set to leave so you have the option of
restarting the program with the same options (and not leave the
debugger) or let the program quit.
</p>
<p>Signal handlers that the debugged script might have installed are
saved and called before the corresponding debugger handler. Thus, the
debugged program should work roughly in the same fashion as when it is
not debugged. However there are some call-stack variables which
inevitably will differ. To try to hedge this a little so the behaviour
is the same, the <acronym>BASH</acronym> debugger will modify arguments to the traps if it
finds one of the call-stack that change as a result of the debugger
being in place. In particluar <code>$LINENO</code> will get replaced with
<code>${BASH_LINENO[0]}</code>; also <code>${BASH_LINENO[0]}</code> and
<code>${BASH_SOURCE[0]}</code> get replaced with
<code>${BASH_LINENO[1]}</code> and <code>${BASH_SOURCE[1]}</code>
respectively.
</p>
<p>The debugger also installs an interrupt handler <code>SIGINT</code> so that
errant programs can be interrupted and you can find out where the
program was when you interrupted it.
</p>
<a name="index-fatal-signals"></a>
<p>Some signals, including <code>SIGALRM</code>, are a normal part of the
functioning of your program. Others, such as <code>SIGSEGV</code>, indicate
errors; these signals are <em>fatal</em> (they kill your program immediately) if the
program has not specified in advance some other way to handle the signal.
<code>SIGINT</code> does not indicate an error in your program, but it is normally
fatal so it can carry out the purpose of the interrupt: to kill the program.
</p>
<p><acronym>BASH</acronym> has the ability to detect any occurrence of a signal in your
program. You can tell <acronym>BASH</acronym> in advance what to do for each kind of
signal.
</p>
<a name="index-handling-signals"></a>
<p>Normally, <acronym>BASH</acronym> is set up to let the non-erroneous signals like
<code>SIGALRM</code> be silently passed to your program
(so as not to interfere with their role in the program’s functioning)
but to stop your program immediately whenever an error signal happens.
You can change these settings with the <code>handle</code> command.
</p>
<hr size="6">
<a name="handle"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Signals" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#signal" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Signals" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Intercepting-Signals-_0028handle_002c-info-handle_0029"></a>
<h4 class="subsubsection">4.4.3.1 Intercepting Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-handle"></a>
</dd>
<dt> <code>handle <var>signal</var> <var>keywords</var>…</code></dt>
<dd><p>Change the way <acronym>BASH</acronym> handles signal <var>signal</var>. <var>signal</var>
can be the number of a signal or its name (with or without the
‘<samp>SIG</samp>’ at the beginning). The <var>keywords</var> say what change to make.
<a name="index-info-signals"></a>
</p></dd>
<dt> <code>info signals</code></dt>
<dt> <code>info handle</code></dt>
<dd><p>Print a table of all the kinds of signals and how <acronym>BASH</acronym> has been told to
handle each one. You can use this to see the signal numbers of all
the defined types of signals.
</p>
<p><code>info handle</code> is an alias for <code>info signals</code>.
</p>
</dd>
</dl>
<p>The keywords allowed by the <code>handle</code> command can be abbreviated.
Their full names are:
</p>
<dl compact="compact">
<dt> <code>stop</code></dt>
<dd><p><acronym>BASH</acronym> should stop your program when this signal happens. This implies
the <code>print</code> keyword as well.
</p>
</dd>
<dt> <code>nostop</code></dt>
<dd><p><acronym>BASH</acronym> should not stop your program when this signal happens. It may
still print a message telling you that the signal has come in.
</p>
</dd>
<dt> <code>print</code></dt>
<dd><p><acronym>BASH</acronym> should print a message when this signal happens.
</p>
</dd>
<dt> <code>noprint</code></dt>
<dd><p><acronym>BASH</acronym> should not mention the occurrence of the signal at all.
</p>
</dd>
<dt> <code>stack</code></dt>
<dd><p><acronym>BASH</acronym> should print a stack trace when this signal happens.
</p>
</dd>
<dt> <code>nostack</code></dt>
<dd><p><acronym>BASH</acronym> should not print a stack trace when this signal occurs.
</p>
</dd>
</dl>
<hr size="6">
<a name="signal"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#handle" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Signals" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Sending-your-program-a-signal-_0028signal_0029"></a>
<h4 class="subsubsection">4.4.3.2 Sending your program a signal (‘<samp>signal</samp>’)</h4>
<dl compact="compact">
<dd><a name="index-signal"></a>
</dd>
<dt> <code>signal <span class="roman"><var>signal-name</var> | <var>signal-number</var></span></code></dt>
<dd><p>You can use the <code>signal</code> command send a signal to your
program. Supply either the signal name, e.g. <code>SIGINT</code>, or the
signal number <code>15</code>.
</p></dd>
</dl>
<hr size="6">
<a name="Program-Information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#signal" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Info" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Status-and-Debugger-Settings-_0028info_002c-show_0029"></a>
<h2 class="section">4.5 Status and Debugger Settings (‘<samp>info</samp>’, ‘<samp>show</samp>’)</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td><td> </td><td align="left" valign="top"> Showing information about the program being debugged
</td></tr>
<tr><td align="left" valign="top"><a href="#Show">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</a></td><td> </td><td align="left" valign="top"> Show information about the debugger
</td></tr>
</table>
<p>In addition to <code>help</code>, you can use the <acronym>BASH</acronym> commands <code>info</code>
and <code>show</code> to inquire about the state of your program, or the
state of <acronym>BASH</acronym> itself. Each command supports many topics of inquiry;
here we introduce each of them in the appropriate context. The
listings under <code>info</code> and under <code>show</code> in the Index point to
all the sub-commands. See section <a href="#Command-Index">Command Index</a>.
</p>
<hr size="6">
<a name="Info"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Program-Information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Show" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Information" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Showing-information-about-the-program-being-debugged-_0028info_0029"></a>
<h3 class="subsection">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</h3>
<p>This <code>info</code> command (abbreviated <code>i</code>) is for describing the state of
your program. For example, you can list the current <code>$1</code>, <code>$2</code>
parameters with <code>info args</code>, or list the breakpoints you have set
with <code>info breakpoints</code> or <code>info watchpoints</code>. You can get
a complete list of the <code>info</code> sub-commands with <code>help
info</code>.
</p>
<dl compact="compact">
<dd><a name="index-info-args"></a>
</dd>
<dt> <code>info args</code></dt>
<dd><p>Argument variables (e.g. $1, $2, ...) of the current stack frame.
<a name="index-info-breakpoints-1"></a>
</p></dd>
<dt> <code>info breakpoints</code></dt>
<dd><p>Status of user-settable breakpoints
<a name="index-info-display"></a>
</p></dd>
<dt> <code>info display</code></dt>
<dd><p>Show all display expressions
<a name="index-info-files"></a>
</p></dd>
<dt> <code>info files</code></dt>
<dd><p>Source files in the program
<a name="index-info-functions"></a>
</p></dd>
<dt> <code>info functions</code></dt>
<dd><p>All function names
<a name="index-info-line"></a>
</p></dd>
<dt> <code>info line</code></dt>
<dd><p>list current line number and and file name
<a name="index-info-program"></a>
</p></dd>
<dt> <code>info program</code></dt>
<dd><p>Execution status of the program.
<a name="index-info-signals-1"></a>
</p></dd>
<dt> <code>info signals</code></dt>
<dd><p>What debugger does when program gets various signals
<a name="index-info-source"></a>
</p></dd>
<dt> <code>info source</code></dt>
<dd><p>Information about the current source file
<a name="index-info-stack"></a>
</p></dd>
<dt> <code>info stack</code></dt>
<dd><p>Backtrace of the stack
<a name="index-info-terminal-1"></a>
</p></dd>
<dt> <code>info terminal</code></dt>
<dd><p>Print terminal device
<a name="index-info-variables"></a>
</p></dd>
<dt> <code>info variables</code></dt>
<dd><p>All global and static variable names
</p></dd>
</dl>
<hr size="6">
<a name="Show"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Info" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Stack" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Information" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Show-information-about-the-debugger-_0028show_0029"></a>
<h3 class="subsection">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</h3>
<p>In contrast to <code>info</code>, <code>show</code> is for describing the state of
<acronym>BASH</acronym> itself. You can change most of the things you can
<code>show</code>, by using the related command <code>set</code>;
</p>
<p>The distinction between <code>info</code> and <code>show</code> however is a bit
fuzzy and is kept here to try to follow the GDB interface.
For example, to list the arguments given to your script use
<code>show args</code>; <code>info args</code> does something different.
</p>
<p>Here are three miscellaneous <code>show</code> subcommands, all of which are
exceptional in lacking corresponding <code>set</code> commands:
</p>
<dl compact="compact">
<dd><a name="index-show-version"></a>
<a name="index-version-number"></a>
</dd>
<dt> <code>show version</code></dt>
<dd><p>Show what version of <acronym>BASH</acronym> is running. You should include this
information in <acronym>BASH</acronym> bug-reports. If multiple versions of
<acronym>BASH</acronym> are in use at your site, you may need to determine which
version of <acronym>BASH</acronym> you are running; as <acronym>BASH</acronym> evolves, new
commands are introduced, and old ones may wither away. Also, many
system vendors ship variant versions of <acronym>BASH</acronym>, and there are
variant versions of <acronym>BASH</acronym> in <small>GNU</small>/Linux distributions as well.
The version number is the same as the one announced when you start
<acronym>BASH</acronym>.
</p>
<a name="index-show-copying"></a>
</dd>
<dt> <code>show copying</code></dt>
<dd><p>Display information about permission for copying <acronym>BASH</acronym>.
</p>
</dd>
<dt> <code>show linetrace</code></dt>
<dd>
<p>Show if line tracing is enabled. See also <a href="#Line-Tracing">Show position information as statements are executed (‘<samp>set linetrace</samp>’)</a>.
</p>
</dd>
<dt> <code>show logging</code></dt>
<dd>
<p>Show summary information of logging variables which can be set via
<code>set logging</code>. See also <a href="#Logging">Logging output (‘<samp>set logging</samp>’, ‘<samp>set logging file</samp>’...)</a>.
</p>
</dd>
<dt> <code>show logging file</code></dt>
<dd>
<p>Show the current logging file.
</p>
</dd>
<dt> <code>show logging overwrite</code></dt>
<dd>
<p>Show whether logging overwrites or appends to the log file.
</p>
<a name="index-show-warranty"></a>
</dd>
<dt> <code>show warranty</code></dt>
<dd><p>Display the <small>GNU</small> “NO WARRANTY” statement, or a warranty,
if your version of the <acronym>BASH</acronym> debugger comes with one.
</p>
</dd>
</dl>
<hr size="6">
<a name="Stack"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Show" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Frames" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Examining-the-Stack-Frame-_0028where_002c-frame_002c-up_002c-down_0029"></a>
<h2 class="section">4.6 Examining the Stack Frame (‘<samp>where</samp>’, ‘<samp>frame</samp>’, ‘<samp>up</samp>’, ‘<samp>down</samp>’)</h2>
<p>When your script has stopped, one thing you’ll probably want to know
is where it stopped and some idea of how it got there.
</p>
<a name="index-call-stack"></a>
<p>Each time your script performs a function call (either as part of a
command substitution or not), or ‘source’s a file, information about
this action is saved. The call stack then is this a history of the
calls that got you to the point that you are currently stopped at.
</p>
<a name="index-selected-frame"></a>
<p>One of the stack frames is <em>selected</em> by the <acronym>BASH</acronym> debugger and many
the <acronym>BASH</acronym> debugger commands refer implicitly to the selected frame. In
particular, whenever you ask the <acronym>BASH</acronym> debugger to list lines without giving
a line number or location the value is found in the selected frame.
There are special the <acronym>BASH</acronym> debugger commands to select whichever frame you
are interested in. See section <a href="#Selection">Selecting a frame</a>.
</p>
<p>When your program stops, <acronym>BASH</acronym> automatically selects the
currently executing frame and describes it briefly, similar to the
<code>frame</code> command.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Frames">4.6.1 Stack frames</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td><td> </td><td align="left" valign="top"> Backtraces (where)
</td></tr>
<tr><td align="left" valign="top"><a href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></td><td> </td><td align="left" valign="top"> Selecting a frame (up, down, frame)
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr></table>
<hr size="6">
<a name="Frames"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Stack" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Backtrace" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Stack" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Stack-frames"></a>
<h3 class="subsection">4.6.1 Stack frames</h3>
<a name="index-frame_002c-definition"></a>
<a name="index-stack-frame"></a>
<p>The call stack is divided up into contiguous pieces called <em>stack
frames</em>, or <em>frames</em> for short; each frame is the data associated
with one call to one function. The frame contains the line number of
the caller of the function, the source-file name that the line refers
to a function name (which could be the built-in name “source”)..
</p>
<a name="index-initial-frame"></a>
<a name="index-outermost-frame"></a>
<a name="index-innermost-frame"></a>
<p>When your script is started, the stack has only one frame, that of the
function <code>main</code>. This is called the <em>initial</em> frame or the
<em>outermost</em> frame. Each time a function is called, a new frame is
made. Each time a function returns, the frame for that function invocation
is eliminated. If a function is recursive, there can be many frames for
the same function. The frame for the function in which execution is
actually occurring is called the <em>innermost</em> frame. This is the most
recently created of all the stack frames that still exist.
</p>
<a name="index-frame-number"></a>
<p>the <acronym>BASH</acronym> debugger assigns numbers to all existing stack frames, starting with
zero for the innermost frame, one for the frame that called it,
and so on upward. These numbers do not really exist in your script;
they are assigned by the <acronym>BASH</acronym> debugger to give you a way of designating stack
frames in the <acronym>BASH</acronym> debugger commands.
</p>
<hr size="6">
<a name="Backtrace"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Frames" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Selection" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Stack" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Backtraces-_0028where_0029"></a>
<h3 class="subsection">4.6.2 Backtraces (‘<samp>where</samp>’)</h3>
<a name="index-backtraces"></a>
<a name="index-tracebacks"></a>
<a name="index-stack-traces"></a>
<p>A backtrace is essentially the same as the call stack: a summary of
how your script got where it is. It shows one line per frame, for
many frames, starting with the place that you sare stopped at (frame
zero), followed by its caller (frame one), and on up the stack.
</p>
<dl compact="compact">
<dd><a name="index-backtrace"></a>
<a name="index-bt-_0028backtrace_0029"></a>
</dd>
<dt> <code>backtrace</code></dt>
<dt> <code>bt</code></dt>
<dt> <code>where</code></dt>
<dt> <code>T</code></dt>
<dd><p>Print a backtrace of the entire stack: one line per frame for all
frames in the stack.
</p>
</dd>
<dt> <code>backtrace <var>n</var></code></dt>
<dt> <code>bt <var>n</var></code></dt>
<dt> <code>where <var>n</var></code></dt>
<dt> <code>T <var>n</var></code></dt>
<dd><p>Similar, but print only the innermost <var>n</var> frames.
</p>
</dd>
</dl>
<a name="index-where"></a>
<p>The names <code>where</code> and <code>T</code> are additional aliases for
<code>backtrace</code>.
</p>
<p>Each line in the backtrace shows the frame number and the function
name, the source file name and line number, as well as the function name.
</p>
<p>Here is an example of a backtrace taken a program in the
regression-tests ‘<tt>parm.sh</tt>’.
</p>
<table><tr><td> </td><td><pre class="smallexample">% ../bashdb -n -L .. parm.sh
Bourne-Again Shell Debugger, release 4.0-0.4
Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009 Rocky Bernstein
This 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.
(./parm.sh:21):
21: fn1 5
bashdb<0> <b>continue fn3</b>
One-time breakpoint 1 set in file ./parm.sh, line 17.
fn2: testing 1 2 3
(./parm.sh:17):
17: fn3() {
bashdb<1> <b>where</b>
->0 in file `./parm.sh' at line 14
##1 fn3() called from file `./parm.sh' at line 14
##2 fn2("testing 1", "2 3") called from file `parm.sh' at line 5
##3 fn1("0") called from file `parm.sh' at line 9
##4 fn1("1") called from file `parm.sh' at line 9
##5 fn1("2") called from file `parm.sh' at line 9
##6 fn1("3") called from file `parm.sh' at line 9
##7 fn1("4") called from file `parm.sh' at line 9
##8 fn1("5") called from file `parm.sh' at line 21
##9 source("parm.sh") called from file `bashdb' at line 143
##10 main("-n", "-L", "..", "parm.sh") called from file `bashdb' at line 0
</pre></td></tr></table>
<p>The display for “frame” zero isn’t a frame at all, although it has
the same information minus a function name; it just indicates that
your script has stopped at the code for line <code>14</code>
of <code>./parm.sh</code>.
</p>
<hr size="6">
<a name="Selection"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Backtrace" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#List" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Stack" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Selecting-a-frame-_0028up_002c-down_002c-frame_0029"></a>
<h3 class="subsection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</h3>
<p>Commands for listing source code in your script work on whichever
stack frame is selected at the moment. Here are the commands for
selecting a stack frame; all of them finish by printing a brief
description of the stack frame just selected.
</p>
<dl compact="compact">
<dd><a name="index-up-_005bn_005d"></a>
</dd>
<dt> <code>up <span class="roman">[</span><var>n</var><span class="roman">]</span></code></dt>
<dd><p>Move <var>n</var> frames up the stack. For positive numbers <var>n</var>, this
advances toward the outermost frame, to higher frame numbers, to
frames that have existed longer. Using a negative <var>n</var> is the same
as issuing a <code>down</code> command of the absolute value of the <var>n</var>.
Using zero for <var>n</var> does no frame adjustment, but since the current
position is redisplayed, it may trigger a resyncronization if there is
a front end also watching over things.
</p>
<p><var>n</var> defaults to one. You may appreviate <code>up</code> as <code>u</code>.
</p>
<a name="index-down"></a>
<a name="index-do-_0028down_0029"></a>
</dd>
<dt> <code>down <span class="roman">[</span><var>n</var><span class="roman">]</span></code></dt>
<dd><p>Move <var>n</var> frames down the stack. For positive numbers <var>n</var>, this
advances toward the innermost frame, to lower frame numbers, to frames
that were created more recently. Using a negative <var>n</var> is the same
as issuing a <code>up</code> command of the absolute value of the <var>n</var>.
Using zero for <var>n</var> does no frame adjustment, but since the current
position is redisplayed, it may trigger a resyncronization if there is
a front end also watching over things.
</p>
<p><var>n</var> defaults to one. You may abbreviate <code>down</code> as <code>do</code>.
</p></dd>
</dl>
<p>All of these commands end by printing two lines of output describing the
frame. The first line shows the frame number, the function name, the
arguments, and the source file and line number of execution in that
frame. The second line shows the text of that source line.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">bashdb<8> <b>up</b>
19: sourced_fn
bashdb<8> <b>T</b>
##0 in file `./bashtest-sourced' at line 8
->1 sourced_fn() called from file `bashtest-sourced' at line 19
##2 source() called from file `bashdb-test1' at line 23
##3 fn2() called from file `bashdb-test1' at line 33
##4 fn1() called from file `bashdb-test1' at line 42
##5 main() called from file `bashdb-test1' at line 0
</pre></td></tr></table>
<p>After such a printout, the <code>list</code> command with no arguments
prints ten lines centered on the point of execution in the frame.
See section <a href="#List">Printing source lines</a>.
</p>
<dl compact="compact">
<dd><a name="index-frame"></a>
<a name="index-current-stack-frame"></a>
</dd>
<dt> <code>frame <var>args</var></code></dt>
<dd><p>The <code>frame</code> command allows you to move from one stack frame to
another, and to print the stack frame you select. <var>args</var> is the
the stack frame number; <code>frame 0</code> then will always show the
current and most recent stack frame.
</p>
<p>If a negative number is given, counting is from the other end of the
stack frame, so <code>frame -1</code> shows the least-recent, outermost or
most “main” stack frame.
</p>
<p>Without an argument, <code>frame</code> prints the current stack
frame. Since the current position is redisplayed, it may trigger a
resyncronization if there is a front end also watching over
things.
</p></dd>
</dl>
<hr size="6">
<a name="List"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Selection" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Edit" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Examining-Source-Files-_0028list_0029"></a>
<h2 class="section">4.7 Examining Source Files (‘<samp>list</samp>’)</h2>
<p>the <acronym>BASH</acronym> debugger can print parts of your script’s source. When your
script stops, the <acronym>BASH</acronym> debugger spontaneously prints the line where it
stopped. Likewise, when you select a stack frame (see section <a href="#Selection">Selecting a frame</a>), the <acronym>BASH</acronym> debugger prints the line where execution in
that frame has stopped. You can print other portions of source files
by explicit command.
</p>
<p>If you use the <acronym>BASH</acronym> debugger through its <small>GNU</small> Emacs interface, you may
prefer to use Emacs facilities to view source; see <a href="#Emacs">Using the <acronym>BASH</acronym> debugger under <small>GNU</small> Emacs</a>.
</p>
<a name="index-list"></a>
<a name="index-l-_0028list_0029"></a>
<p>To print lines from a source file, use the <code>list</code> command
(abbreviated <code>l</code>). By default, ten lines are printed.
There are several ways to specify what part of the file you want to print.
</p>
<p>Here are the forms of the <code>list</code> command most commonly used:
</p>
<dl compact="compact">
<dt> <code>list <var>linenum</var></code></dt>
<dt> <code>l <var>linenum</var></code></dt>
<dd><p>Print lines centered around line number <var>linenum</var> in the
current source file.
</p>
</dd>
<dt> <code>list <var>function</var></code></dt>
<dt> <code>l <var>function</var></code></dt>
<dd><p>Print the text of <var>function</var>.
</p>
</dd>
<dt> <code>list</code></dt>
<dt> <code>l</code></dt>
<dd><p>Print more lines. If the last lines printed were printed with a
<code>list</code> command, this prints lines following the last lines
printed; however, if the last line printed was a solitary line printed
as part of displaying a stack frame (see section <a href="#Stack">Examining the Stack</a>), this prints lines centered around that line.
</p>
</dd>
<dt> <code>list -</code></dt>
<dt> <code>l -</code></dt>
<dd><p>Print lines just before the lines last printed.
</p></dd>
</dl>
<p>By default, the <acronym>BASH</acronym> debugger prints ten source lines with any of these forms of
the <code>list</code> command.
You can change this using <code>set listsize</code>:
</p>
<dl compact="compact">
<dd><a name="index-set-listsize"></a>
</dd>
<dt> <code>set listsize <var>count</var></code></dt>
<dd><p>Make the <code>list</code> command display <var>count</var> source lines (unless
the <code>list</code> argument explicitly specifies some other number).
</p>
<a name="index-show-listsize"></a>
</dd>
<dt> <code>show listsize</code></dt>
<dd><p>Display the number of lines that <code>list</code> prints.
</p>
</dd>
</dl>
<p>Repeating a <code>list</code> command with <RET> discards the argument,
so it is equivalent to typing just <code>list</code>. This is more useful
than listing the same lines again. An exception is made for an
argument of ‘<samp>-</samp>’; that argument is preserved in repetition so that
each repetition moves up in the source file.
</p>
<a name="index-linespec"></a>
<p>In general, the <code>list</code> command expects you to supply a
<em>linespecs</em>. Linespecs specify source lines; there are several ways
of writing them, but the effect is always to specify some source line.
</p>
<p>Here is a complete description of the possible arguments for <code>list</code>:
</p>
<dl compact="compact">
<dt> <code>list <var>linespec</var></code></dt>
<dd><p>Print lines centered around the line specified by <var>linespec</var>.
</p>
</dd>
<dt> <code>list <var>first</var> <var>increment</var></code></dt>
<dd><p>Print <var>increment</var> lines starting from <var>first</var>
</p>
</dd>
<dt> <code>list <var>first</var></code></dt>
<dd><p>Print lines starting with <var>first</var>.
</p>
</dd>
<dt> <code>list -</code></dt>
<dd><p>Print lines just before the lines last printed.
</p>
</dd>
<dt> <code>list .</code></dt>
<dd><p>Print lines after where the script is stopped.
</p>
</dd>
<dt> <code>list</code></dt>
<dd><p>As described in the preceding table.
</p></dd>
</dl>
<p>Here are the ways of specifying a single source line—all the
kinds of linespec.
</p>
<dl compact="compact">
<dt> <code><var>number</var></code></dt>
<dd><p>Specifies line <var>number</var> of the current source file.
When a <code>list</code> command has two linespecs, this refers to
the same source file as the first linespec.
</p>
</dd>
<dt> <code><var>filename</var>:<var>number</var></code></dt>
<dd><p>Specifies line <var>number</var> in the source file <var>filename</var>.
</p>
</dd>
<dt> <code><var>function</var></code></dt>
<dd><p>Specifies the line that function <var>function</var> is listed on.
</p>
</dd>
</dl>
<hr size="6">
<a name="Edit"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#List" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Search" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Editing-Source-files-_0028edit_0029"></a>
<h2 class="section">4.8 Editing Source files (‘<samp>edit</samp>’)</h2>
<p>To edit the lines in a source file, use the <code>edit</code> command. The
editing program of your choice is invoked with the current line set to
the active line in the program. Alternatively, you can give a line
specification to specify what part of the file you want to print if
you want to see other parts of the program.
</p>
<p>You can customize to use any editor you want by using the
<code>EDITOR</code> environment variable. The only restriction is that your
editor (say <code>ex</code>), recognizes the following command-line syntax:
</p><table><tr><td> </td><td><pre class="smallexample">ex +<var>number</var> file
</pre></td></tr></table>
<p>The optional numeric value +<var>number</var> specifies the number of the
line in the file where to start editing. For example, to configure
the <acronym>BASH</acronym> debugger to use the <code>vi</code> editor, you could use these commands
with the <code>sh</code> shell:
</p><table><tr><td> </td><td><pre class="smallexample">EDITOR=/usr/bin/vi
export EDITOR
gdb …
</pre></td></tr></table>
<p>or in the <code>csh</code> shell,
</p><table><tr><td> </td><td><pre class="smallexample">setenv EDITOR /usr/bin/vi
gdb …
</pre></td></tr></table>
<dl compact="compact">
<dd><a name="index-edit-_005bline_002dspecification_005d"></a>
</dd>
<dt> <code>edit <span class="roman">[</span><var>line specification</var><span class="roman">]</span></code></dt>
<dd><p>Edit line specification using the editor specified by the
<code>EDITOR</code> environment variable.
</p></dd>
</dl>
<hr size="6">
<a name="Search"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Edit" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Data" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Searching-source-files-_0028search_002c-reverse_002c-_002f_002e_002e_002e_002f_002c-_003f_002e_002e_003f_0029"></a>
<h2 class="section">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</h2>
<a name="index-searching"></a>
<a name="index-reverse_002dsearch"></a>
<p>There are two commands for searching through the current source file
for a <acronym>BASH</acronym> extended pattern-matching expression.
</p>
<dl compact="compact">
<dd><a name="index-search"></a>
<a name="index-forward"></a>
</dd>
<dt> <code>forward <var>bash-pattern</var></code></dt>
<dt> <code>search <var>bash-pattern</var></code></dt>
<dd><p>The command ‘<samp>forward <var>bash-pattern</var></samp>’ checks each line,
starting with the one following the current line, for a match for
<var>bash-pattern</var> which is an extended bash pattern-matching
expression. It lists the line that is found. You can use the synonym
‘<samp>search <var>bash-pattern</var></samp>’ or abbreviate the command name as
<code>fo</code> or <code>/<var>pat</var>/</code>.
</p>
</dd>
<dt> <code>reverse <var>bash-pattern</var></code></dt>
<dd><p>The command ‘<samp>reverse <var>bash-pattern</var></samp>’ checks each line, starting
with the one before the last line listed and going backward, for a match
for <var>bash-pattern</var>. It lists the line that is found. You can abbreviate
this command as <code>rev</code> or <code>?<var>bash-pattern</var>?</code>.
</p></dd>
</dl>
<hr size="6">
<a name="Data"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Search" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Evaluation_002fExecution" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Examining-Data-_0028print_002c-examine_002c-info-variables_0029"></a>
<h2 class="section">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</h2>
<a name="index-printing-data"></a>
<a name="index-examining-data"></a>
<a name="index-print"></a>
<p>One way to examine string data in your script is with the <code>print</code>
command (abbreviated <code>p</code>). However a more versatile print command
is <code>x</code>; it can print variable and function definitions and can do
arithmetic computations. Finally, the most general method would be
via <code>eval echo</code>.
</p>
<dl compact="compact">
<dd><a name="index-print-1"></a>
<a name="index-p-_0028print_0029"></a>
</dd>
<dt> <code>print <var>expr</var></code></dt>
<dd>
<p>Use <code>print</code> to display strings as you would from <code>echo</code>. And
as such, variable names to be substituted have to be preceded with a
dollar sign. As with echo, filename expansion, e.g. tilde expansion,
is performed on unquoted strings. So for example if you want to print
a *, you would write ‘<samp>print "*"</samp>’, not ‘<samp>print *</samp>’. If you want
to have the special characters dollars sign appear, use a backslash.
</p>
<table><tr><td> </td><td><pre class="smallexample">bashdb<0> <b>print the value of x is $x</b>
the value of x is 22
bashdb<1> <b>p The home directory for root is ~root</b>
The home directory for root is /root
bashdb<2> <b>p '*** You may have won $$$ ***'</b>
*** You may have won $$$ ***
bashdb<3> # Note the use of the single quotes.
bashdb<3> # Compare what happens with double quotes or no quotes
</pre></td></tr></table>
</dd>
<dt> <code>print</code></dt>
<dt> <code>p</code></dt>
<dd><p>If you omit <var>expr</var>, the <acronym>BASH</acronym> debugger displays the last expression again.
</p>
</dd>
<dt> <code>x <var>variable1</var> <span class="roman">[</span><var>variable2...</var><span class="roman">]</span></code></dt>
<dt> <code>x <var>expr</var></code></dt>
<dd><a name="index-x-_0028examine_0029"></a>
<a name="index-examine"></a>
<p>This is a smarter, more versatile “print” command, and although sometimes
it might not be what you want, and you may want to resort to either
<code>print</code> or <code>eval echo...</code>.
</p>
<p>As with <code>print</code>, if you omit <var>expr</var>, the <acronym>BASH</acronym> debugger displays
the last expression again.
</p>
<p>The <code>x</code> command first checks if <var>expr</var> is variable or a list
of variables delimited by spaces. If it is, the definition(s) and
value(s) of each printed via <acronym>BASH</acronym>’s <code>declare -p</code>
command. This will show the variable’s attributes such as if it is
read only or if it is an integer. If the variable is an array, that is
show and the array values are printed.
</p>
<p>If instead <var>expr</var> is a function, the function definition is
printed via <acronym>BASH</acronym>’s <code>declare -f</code> command. If <var>expr</var>
was neither a variable nor an expression, then we try to get a value
via <code>let</code>. And if this returns an error, as a last resort we call
<code>print</code> and give what it outputs.
</p>
<p>Since <code>let</code> may be used internally and since (to my thinking)
<code>let</code> does funny things, the results may seem odd unless you
understand the sequence tried above and how <code>let</code> works. For
“example if the variable <code>foo</code> has value 5, then ‘<samp>x foo</samp>’
shows the definition of foo with value 5, and ‘<samp>x foo+5</samp>’ prints 10
as expected. So far so good. However if <code>foo</code> is has the value
‘<samp>alpha</samp>’, ‘<samp>x foo+5</samp>’ prints 5 because <code>let</code> has converted
the string ‘<samp>alpha</samp>’ into the numeric value 0. So ‘<samp>p foo+5</samp>’ will
simply print “foo+5”; if you want the value of “foo” substituted
inside a string, for example you expect “the value of foo is $foo”
to come out “the value of foo is 5”, then the right command to use
is <code>print</code> rather than <code>x</code>, making sure you add the dollar
onto the beginning of the variable.
</p>
<table><tr><td> </td><td><pre class="smallexample">bashdb<0> <b>examine x y</b>
declare -- x="22"
declare -- y="23"
bashdb<1> <b>examine x+y</b>
45
bashdb<2> <b>x fn1</b>
fn1 ()
{
echo "fn1 here";
x=5;
fn3
}
bashdb<2> <b>x FUNCNAME</b>
declare -a FUNCNAME='([0]="_Dbg_cmd_x" [1]="_Dbg_cmdloop" [2]="_Dbg_debug_trap_handler" [3]="main")'
</pre></td></tr></table>
</dd>
<dt> <code>V <span class="roman">[</span><var>!</var><span class="roman">]</span><span class="roman">[</span><var>pattern</var><span class="roman">]</span></code></dt>
<dd><a name="index-V-_0028info-variables_0029"></a>
<a name="index-info-variables-1"></a>
<p>If you want to all list variables and values or a set of
variables by pattern, use this command.
</p>
<table><tr><td> </td><td><pre class="smallexample">bashdb<0> <b>V dq*</b>
dq_args="dq_*"
dq_cmd="V"
bashdb<1> <b>V FUNCNAME</b>
FUNCNAME='([0]="_Dbg_cmd_list_variables" [1]="_Dbg_cmdloop" [2]="_Dbg_debug_trap_handler" [3]="main")'
</pre></td></tr></table>
</dd>
</dl>
<hr size="6">
<a name="Evaluation_002fExecution"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Data" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Interfacing-to-the-OS" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Running-Arbitrary-BASH-and-Shell-commands-_0028eval_002c-shell_0029"></a>
<h2 class="section">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</h2>
<p>The two most general commands and most “low-level” are <code>eval</code>
and <code>shell</code>.
</p>
<dl compact="compact">
<dt> <code>eval</code></dt>
<dt> <code>e</code></dt>
<dd><a name="index-e-_0028eval_0029"></a>
<a name="index-eval"></a>
<p>In contrast to the commands of the last section the most general way
to examine data is through <code>eval</code>. But you do much more with
this; you can change the values of variables, since, you are just
evaluating <acronym>BASH</acronym> code.
</p>
<p>If you expect output, you should arrange that in the command, such as
via <code>echo</code> or <code>printf</code>. For example, to print the value of
<var>foo</var>, you would type ‘<samp>e echo $foo</samp>’. This is bit longer than
‘<samp>p $foo</samp>’ or (when possible) ‘<samp>x foo</samp>’. However suppose you
wanted to find out how the builtin test operator ‘<samp>[</samp>’ works with
the ‘<samp>-z</samp>’ test condition. You could use <code>eval</code> to do this
such as ‘<samp>e [ -z "$foo"] && echo "yes"</samp>’.
</p>
<a name="index-shell"></a>
<a name="index-_0021_0021-_0028shell_0029"></a>
<a name="index-shell-escape"></a>
</dd>
<dt> <code>shell <var>command string</var></code></dt>
<dt> <code>!!</code></dt>
<dd>
<p>If you need to execute occasional shell commands during your
debugging session, there is no need to leave or suspend the <acronym>BASH</acronym> debugger; you can
just use the <code>shell</code> command or its alias <code>!!</code>.
</p>
<p>Invoke a shell to execute <var>command string</var>.
</p>
</dd>
</dl>
<hr size="6">
<a name="Interfacing-to-the-OS"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Evaluation_002fExecution" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Auto-Display" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Interfacing-to-the-OS-_0028cd_002c-pwd_0029"></a>
<h2 class="section">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</h2>
<dl compact="compact">
<dd><a name="index-cd-_005bdirectory_005d"></a>
<a name="index-change-working-directory"></a>
</dd>
<dt> <code>cd</code></dt>
<dd>
<p>Set working directory to <var>directory</var> for debugger and program
being debugged. Tilde expansion, variable and filename expansion is
performed on <var>directory</var>. If no directory is given, we print out the
current directory which is really the same things as running
<code>pwd</code>.
</p>
<p>Note that <code>gdb</code> is a little different in that it peforms tilde expansion
but not filename or variable expansion and the directory argument is
not optional as it is here.
</p>
<a name="index-pwd"></a>
<a name="index-print-working-directory"></a>
</dd>
<dt> <code>pwd</code></dt>
<dd>
<p>Prints the working directory as the program sees things.
</p>
</dd>
</dl>
<hr size="6">
<a name="Auto-Display"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Interfacing-to-the-OS" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Automatic-display-_0028display_002c-undisplay_0029"></a>
<h2 class="section">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</h2>
<a name="index-automatic-display"></a>
<a name="index-display-of-expressions"></a>
<p>If you find that you want to print the value of an expression
frequently (to see how it changes), you might want to add it to the
<em>automatic display list</em> so that the <acronym>BASH</acronym> debugger evaluates a
statement each time your program stops. Each expression added to the
list is given a number to identify it; to remove an expression from
the list, you specify that number. The automatic display looks like
this:
</p>
<table><tr><td> </td><td><pre class="example">2 (echo $x): 38
</pre></td></tr></table>
<p>This display shows item numbers, expressions and their current values.
</p>
<dl compact="compact">
<dd><a name="index-display"></a>
</dd>
<dt> <code>display <var>expr</var></code></dt>
<dd><p>Add the expression <var>expr</var> to the list of expressions to display
each time your program stops.
</p>
</dd>
<dt> <code>display</code></dt>
<dd><p>Display the current values of the expressions on the list, just as is
done when your program stops.
</p>
<a name="index-delete-display"></a>
<a name="index-undisplay-dnums_2026"></a>
</dd>
<dt> <code>undisplay <var>dnums</var>…</code></dt>
<dt> <code>delete display <var>dnums</var>…</code></dt>
<dd><p>Remove item numbers <var>dnums</var> from the list of expressions to display.
</p>
<p><code>undisplay</code> does not repeat if you press <RET> after using it.
(Otherwise you would just get the error ‘<samp>No display number …</samp>’.)
</p>
<a name="index-disable-display"></a>
</dd>
<dt> <code>disable display <var>dnums</var>…</code></dt>
<dd><p>Disable the display of item numbers <var>dnums</var>. A disabled display
item is not printed automatically, but is not forgotten. It may be
enabled again later.
</p>
<a name="index-enable-display"></a>
</dd>
<dt> <code>enable display <var>dnums</var>…</code></dt>
<dd><p>Enable display of item numbers <var>dnums</var>. It becomes effective once
again in auto display of its expression, until you specify otherwise.
</p>
<a name="index-info-display-1"></a>
</dd>
<dt> <code>info display</code></dt>
<dd><p>Print the list of expressions previously set up to display
automatically, each one with its item number, but without showing the
values. This includes disabled expressions, which are marked as such.
It also includes expressions which would not be displayed right now
because they refer to automatic variables not currently available.
</p></dd>
</dl>
<hr size="6">
<a name="Controlling-bashdb"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Auto-Display" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Alias" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Controlling-bashdb-_0028set_002c-file_002c-prompt_002c-history_002e_002e_002e_0029"></a>
<h2 class="section">4.14 Controlling bashdb (‘<samp>set</samp>’, ‘<samp>file</samp>’, ‘<samp>prompt</samp>’, ‘<samp>history</samp>’...)</h2>
<p>You can alter the way <acronym>BASH</acronym>
interacts with you in various ways given below.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Alias">4.14.1 Debugger Command Aliases (‘<samp>alias</samp>’)</a></td><td> </td><td align="left" valign="top"> Debugger Command aliases
</td></tr>
<tr><td align="left" valign="top"><a href="#Annotate">4.14.2 Annotation Level (‘<samp>set annotate</samp>’)</a></td><td> </td><td align="left" valign="top"> Annotation Level (set annotate)
</td></tr>
<tr><td align="left" valign="top"><a href="#Autoeval">4.14.3 Set/Show auto-eval (‘<samp>set autoeval</samp>’)</a></td><td> </td><td align="left" valign="top"> Evaluate unrecognized commands
</td></tr>
<tr><td align="left" valign="top"><a href="#Basename">4.14.4 File basename (‘<samp>set basename</samp>’)</a></td><td> </td><td align="left" valign="top"> Show basenames of file names only (set basename)
</td></tr>
<tr><td align="left" valign="top"><a href="#Debugger">4.14.5 Allow Debugging the debugger (‘<samp>set debugger</samp>’)</a></td><td> </td><td align="left" valign="top"> Allow debugging the debugger (set debugger)
</td></tr>
<tr><td align="left" valign="top"><a href="#File">4.14.6 Specifying a Script-File Association (‘<samp>file</samp>’)</a></td><td> </td><td align="left" valign="top"> Specifying a Script-File Associaton (set file)
</td></tr>
<tr><td align="left" valign="top"><a href="#Line-Tracing">4.14.7 Show position information as statements are executed (‘<samp>set linetrace</samp>’)</a></td><td> </td><td align="left" valign="top"> Show position information (set linetrace)
</td></tr>
<tr><td align="left" valign="top"><a href="#Logging">4.14.8 Logging output (‘<samp>set logging</samp>’, ‘<samp>set logging file</samp>’...)</a></td><td> </td><td align="left" valign="top"> Specifying where to write debugger output
</td></tr>
<tr><td align="left" valign="top"><a href="#Prompt">4.14.9 Prompt (‘<samp>set prompt</samp>’, ‘<samp>show prompt</samp>’)</a></td><td> </td><td align="left" valign="top"> Prompt (set prompt, show prompt)
</td></tr>
<tr><td align="left" valign="top"><a href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></td><td> </td><td align="left" valign="top"> Command editing (set editing, show editing)
</td></tr>
<tr><td align="left" valign="top"><a href="#Command_002dTracing">4.14.11 Debugger Commands Tracing (‘<samp>set trace-commands</samp>’, ‘<samp>show trace-commands</samp>’)</a></td><td> </td><td align="left" valign="top"> Showing commands as they run (set/show trace-commands)
</td></tr>
<tr><td align="left" valign="top"><a href="#Command-Display">4.14.12 Command Display (‘<samp>set showcommand</samp>’)</a></td><td> </td><td align="left" valign="top"> Command display (set showcommand)
</td></tr>
<tr><td align="left" valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td><td> </td><td align="left" valign="top"> Command history (history, !, H)
</td></tr>
<tr><td align="left" valign="top"><a href="#Command-Completion">4.14.14 Command Completion (‘<samp>complete</samp>’)</a></td><td> </td><td align="left" valign="top"> Command completion (complete)
</td></tr>
</table>
<hr size="6">
<a name="Alias"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Annotate" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugger-Command-Aliases-_0028alias_0029"></a>
<h3 class="subsection">4.14.1 Debugger Command Aliases (‘<samp>alias</samp>’)</h3>
<dl compact="compact">
<dd><a name="index-alias-name-command"></a>
</dd>
<dt> <code>alias <var>name</var> <var>command</var></code></dt>
<dd><p>Add <var>name</var> as an alias for <var>command</var>
</p>
<a name="index-unalias-name-command"></a>
<p>Remove <var>name</var> as an alias for <var>command</var>
</p></dd>
<dt> <code>unalias <var>name</var> <var>command</var></code></dt>
</dl>
<hr size="6">
<a name="Annotate"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Alias" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Autoeval" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Annotation-Level-_0028set-annotate_0029"></a>
<h3 class="subsection">4.14.2 Annotation Level (‘<samp>set annotate</samp>’)</h3>
<dl compact="compact">
<dd><a name="index-set-annotate"></a>
</dd>
<dt> <code>set annotate <var>integer</var></code></dt>
<dd><p>The annotation level controls how much information the <acronym>BASH</acronym> debugger prints
in its prompt; right new it just controls whether we show full
filenames in output or the base part of the filename without path
information. Level 0 is the normal, level 1 is for use when
the <acronym>BASH</acronym> debugger is run as a subprocess of <small>GNU</small> Emacs of <acronym>DDD</acronym>,
level 2 is the maximum annotation suitable for programs that control
the <acronym>BASH</acronym> debugger.
</p></dd>
</dl>
<hr size="6">
<a name="Autoeval"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Annotate" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Basename" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Set_002fShow-auto_002deval-_0028set-autoeval_0029"></a>
<h3 class="subsection">4.14.3 Set/Show auto-eval (‘<samp>set autoeval</samp>’)</h3>
<dl compact="compact">
<dd><a name="index-set-autoeval-_005b-on-_007c-1-_007c-off-_007c-0-_005d"></a>
</dd>
<dt> <code>set autoeval <span class="roman">[</span> on | 1 | off | 0 <span class="roman">]</span></code></dt>
<dd><p>Specify that debugger input that isn’t recognized as a command should
be passed to Ruby for evaluation (using the current debugged program
namespace). Note however that we <em>first</em> check input to see if it
is a debugger command and <em>only</em> if it is not do we consider it
as Ruby code. This means for example that if you have variable called
<code>n</code> and you want to see its value, you could use <code>p n</code>,
because just entering <code>n</code> will be interpreted as the debugger
“next” command.
</p>
<p>When autoeval is set on, you’ll get a different error message when you
invalid commands are encountered. Here’s a session fragment to show
the difference
</p><table><tr><td> </td><td><pre class="smallexample">bashdb<1> <b>stepp</b>
Unknown command
bashdb<2> <b>set autoeval on</b>
autoeval is on.
bashdb<3> <b>stepp</b>
NameError Exception: undefined local variable or method `stepp' for ...
</pre></td></tr></table>
<a name="index-show-autoeval"></a>
</dd>
<dt> <code>show args</code></dt>
<dd><p>Shows whether Ruby evaluation of debugger input should occur or not.
</p></dd>
</dl>
<hr size="6">
<a name="Basename"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Autoeval" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugger" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="File-basename-_0028set-basename_0029"></a>
<h3 class="subsection">4.14.4 File basename (‘<samp>set basename</samp>’)</h3>
<dl compact="compact">
<dd><a name="index-set-basename"></a>
</dd>
<dt> <code>set basename <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>When set on, source filenames are shown as the shorter “basename”
only. (Directory paths are omitted). This is useful in running the
regression tests and may useful in showing debugger examples as in
this text. You may also just want less verbose filename display.
</p>
</dd>
<dt> <code>set basename <span class="roman">[</span> off | 0 <span class="roman">]</span></code></dt>
<dd><p>Source filenames are shown as with their full path. This is the default.
</p></dd>
</dl>
<hr size="6">
<a name="Debugger"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Basename" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#File" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Allow-Debugging-the-debugger-_0028set-debugger_0029"></a>
<h3 class="subsection">4.14.5 Allow Debugging the debugger (‘<samp>set debugger</samp>’)</h3>
<dl compact="compact">
<dd><a name="index-set-debugger"></a>
</dd>
<dt> <code>set debugger <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>Allow the possibility of debugging this debugger. Somewhat of an
arcane thing to do. For gurus, and even he doesn’t use it all that
much.
</p></dd>
<dt> <code>set debugger <span class="roman">[</span> off | 0 <span class="roman">]</span></code></dt>
<dd><p>Don’t allow debugging into the debugger. This is the default.
</p></dd>
</dl>
<hr size="6">
<a name="File"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugger" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Line-Tracing" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Specifying-a-Script_002dFile-Association-_0028file_0029"></a>
<h3 class="subsection">4.14.6 Specifying a Script-File Association (‘<samp>file</samp>’)</h3>
<p>Sometimes the <acronym>BASH</acronym> debugger gets confused about where to find the script
source file for the name reported to it by bash. To resolve relative
file names that bash supplies via <code>BASH_SOURCE</code>, the <acronym>BASH</acronym> debugger uses
the current working directory when the debugged script was started as
well as the current working directory now (which might be different
if a “cd” command was issued to change the working directory).
</p>
<p>However somethimes this doesn’t work and there is a way to
override this.
</p>
<dl compact="compact">
<dd><a name="index-file"></a>
</dd>
<dt> <code>file <var>script-file</var></code></dt>
<dd><p>Directs the <acronym>BASH</acronym> debugger to use <var>script-file</var> whenever bash would have
it refers to the filename given in <code>BASH_SOURCE</code>. The filename
specified in <code>BASH_SOURCE</code> that gets overriden is shown when is
this command is issued.
</p></dd>
</dl>
<hr size="6">
<a name="Line-Tracing"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#File" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Logging" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Show-position-information-as-statements-are-executed-_0028set-linetrace_0029"></a>
<h3 class="subsection">4.14.7 Show position information as statements are executed (‘<samp>set linetrace</samp>’)</h3>
<p><acronym>BASH</acronym> has “<code>set -x</code>” tracing to show commands as they are
run. However missing from this is file and line position
information. So the debugger compensates here for what I think is
deficiency of <acronym>BASH</acronym> by providing this information. The downside
is that this tracing is slower than the built-in tracing of
<acronym>BASH</acronym>.
</p>
<p>The status of whether line tracing is enabled can be show via
<code>show linetrace</code>.
</p>
<dl compact="compact">
<dd><a name="index-set-linetrace"></a>
</dd>
<dt> <code>set linetrace <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>Turn on line tracing.
</p></dd>
<dt> <code>set linetrace <span class="roman">[</span> off | 0 <span class="roman">]</span></code></dt>
<dd><p>Turn off line tracing.
</p></dd>
</dl>
<hr size="6">
<a name="Logging"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Line-Tracing" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Prompt" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Logging-output-_0028set-logging_002c-set-logging-file_002e_002e_002e_0029"></a>
<h3 class="subsection">4.14.8 Logging output (‘<samp>set logging</samp>’, ‘<samp>set logging file</samp>’...)</h3>
<p>You may want to save the output of the debugger commands to a file.
There are several commands to control the debuggers’s logging.
</p>
<dl compact="compact">
<dt> <code>set logging</code></dt>
<dd><p>Prints <code>set logging</code> usage.
<a name="index-set-logging"></a>
</p></dd>
<dt> <code>set logging <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>Enable or Disable logging.
</p></dd>
<dt> <code>set logging file <var>filename</var></code></dt>
<dd><p>Change the name of the current logfile. The default logfile is
‘<tt>bashdb.txt</tt>’.
</p></dd>
<dt> <code>set logging overwrite <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>By default, the debugger will append to the logfile. Set
<code>overwrite</code> if you want <code>set logging on</code> to overwrite the
logfile instead.
</p></dd>
<dt> <code>set logging redirect <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>By default, the debugger output will go to both the terminal and the
logfile. Set <code>redirect</code> if you want output to go only to the log
file.
</p></dd>
<dt> <code>show logging</code></dt>
<dd><p>Show the current values of the logging settings.
</p></dd>
</dl>
<hr size="6">
<a name="Prompt"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Logging" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Editing" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Prompt-_0028set-prompt_002c-show-prompt_0029"></a>
<h3 class="subsection">4.14.9 Prompt (‘<samp>set prompt</samp>’, ‘<samp>show prompt</samp>’)</h3>
<a name="index-prompt"></a>
<p>The <acronym>BASH</acronym> debugger indicates its readiness to read a command by printing a
string called the <em>prompt</em>. This string is normally:
</p><table><tr><td> </td><td><pre class="example">bashdb${_Dbg_less}${#_Dbg_history[@]}${_Dbg_greater}$_Dbg_space
</pre></td></tr></table>
<p>When variables inside the the prompt string are evaluated, the above
becomes something like ‘<samp>bashdb<5></samp>’ if this is the fifth command
executed or perhaps ‘<samp>bashdb<<2>></samp>’ if you have called the debugger
from inside a debugger session and this is the second command inside
the debugger session or perhaps ‘<samp>bashdb<(6)></samp>’ if you
entered a subshell after the fifth command.
</p>
<p>You can change the prompt string with the <code>set prompt</code> command,
although it is not normally advisable to do so without understanding
the implications. If you are using the <acronym>DDD</acronym> GUI, it changes the
changes the prompt and should not do so. In certain other
circumstances (such as writing a GUI like <acronym>DDD</acronym>), it may be is useful
to change the prompt.
</p>
<p><em>Note:</em> <code>set prompt</code> does not add a space for you after the
prompt you set. This allows you to set a prompt which ends in a space
or a prompt that does not. Furthermore due to a implementation
limitation (resulting from a limitation of the bash built-in function
“read”), to put a space at the end of the prompt use the
‘<samp>$_Dbg_space</samp>’ variable.
</p>
<dl compact="compact">
<dd><a name="index-set-prompt"></a>
</dd>
<dt> <code>set prompt <var>newprompt</var></code></dt>
<dd><p>Directs the <acronym>BASH</acronym> debugger to use <var>newprompt</var> as its prompt string
henceforth.
</p>
<p><em>Warning: changing the prompt can <acronym>DDD</acronym>’s ability to
understand when the debugger is waiting for input.</em>
</p>
<a name="index-show-prompt"></a>
</dd>
<dt> <code>show prompt</code></dt>
<dd><p>Prints a line of the form: ‘<samp>bashdb's prompt is: <var>your-prompt</var></samp>’
</p></dd>
</dl>
<hr size="6">
<a name="Editing"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Prompt" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command_002dTracing" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-editing-_0028set-editing_002c-show-editing_0029"></a>
<h3 class="subsection">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</h3>
<a name="index-readline"></a>
<a name="index-command-line-editing"></a>
<p>the <acronym>BASH</acronym> debugger reads its input commands through bash which uses via the
<em>readline</em> interface. This <small>GNU</small> library provides consistent
behavior for programs which provide a command line interface to the
user. Advantages are <small>GNU</small> Emacs-style or <em>vi</em>-style inline
editing of commands, <code>csh</code>-like history substitution, and a
storage and recall of command history across debugging sessions.
</p>
<p>You may control the behavior of command line editing in <acronym>BASH</acronym> with the
command <code>set</code>.
</p>
<dl compact="compact">
<dd><a name="index-set-editing"></a>
<a name="index-editing"></a>
</dd>
<dt> <code>set editing</code></dt>
<dt> <code>set editing <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>Enable command line editing (enabled by default).
</p>
</dd>
<dt> <code>set editing <span class="roman">[</span> off | 0 <span class="roman">]</span></code></dt>
<dd><p>Disable command line editing.
</p>
<a name="index-show-editing"></a>
</dd>
<dt> <code>show editing</code></dt>
<dd><p>Show whether command line editing is enabled.
</p></dd>
</dl>
<hr size="6">
<a name="Command_002dTracing"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Editing" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Display" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugger-Commands-Tracing-_0028set-trace_002dcommands_002c-show-trace_002dcommands_0029"></a>
<h3 class="subsection">4.14.11 Debugger Commands Tracing (‘<samp>set trace-commands</samp>’, ‘<samp>show trace-commands</samp>’)</h3>
<a name="index-tracing-debugger-commands"></a>
<p>If you need to debug user-defined commands or sourced files you may find it
useful to enable <em>command tracing</em>. In this mode each command will be
printed as it is executed, prefixed with one or more ‘<samp>+</samp>’ symbols, the
quantity denoting the call depth of each command.
</p>
<dl compact="compact">
<dd><a name="index-set-trace_002dcommands"></a>
<a name="index-command-scripts_002c-debugging"></a>
</dd>
<dt> <code>set trace-commands on</code></dt>
<dd><p>Enable command tracing.
</p></dd>
<dt> <code>set trace-commands off</code></dt>
<dd><p>Disable command tracing.
</p></dd>
<dt> <code>show trace-commands</code></dt>
<dd><p>Display the current state of command tracing.
</p></dd>
</dl>
<hr size="6">
<a name="Command-Display"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command_002dTracing" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#History" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-Display-_0028set-showcommand_0029"></a>
<h3 class="subsection">4.14.12 Command Display (‘<samp>set showcommand</samp>’)</h3>
<p>The debugger normally lists the line number and source line of the for
the statement to be next executed. Often this line contains one
expression or one statement and it is clear from this line what’s
going to happen. However <acronym>BASH</acronym> allows many expressions or
statements to be put on a single source line; some lines
contain several units of execution. Some examples of this
behavior are listed below:
</p>
<table><tr><td> </td><td><pre class="smallexample">x=1; y=2; x=3
(( x > 5 )) && x=5
y=`echo *`
</pre></td></tr></table>
<p>In the first line of the example above, we have three assignment
statements on a single line. In the second line of the example above
we have a statement which gets run only if a condition tests true. And
in the third line of the example above, we have a command that gets
run and then the output of that is substituted in an assignemnt
statement. If you were single stepping inside the debugger, each line
might get listed more than once before each of the actions that might
get performed. (In the case of the conditional statement, the
line gets listed only once when the condition is false.)
</p>
<p>In order to assist understanding where you are, the enhanced version
of <acronym>BASH</acronym> maintains a dynamic variable <code>BASH_COMMAND</code> that
contains piece of code next to be run (or is currently being run). The
debugger has arranged to save this and can display this information
or not. This is controlled by <code>set showcommand</code>.
</p>
<dl compact="compact">
<dd><a name="index-set-showcommand"></a>
</dd>
<dt> <code>set showcommand <span class="roman">[</span>auto | on | 1 | off | 0 <span class="roman">]</span></code></dt>
<dd><p>controls whether or not to show the saved <code>BASH_COMMAND</code> for the
command next to be executed.
</p></dd>
</dl>
<p>When the value is <code>auto</code> the following heuristic is used to
determine whether or not to display the saved <code>BASH_COMMAND</code>. If
the last time you stopped you were at the same place and the command
string has changed, then show the command. When the value <code>on</code> is
used, the debugger always shows <code>BASH_COMMAND</code> and when
<code>off</code> is used, the debugger nevers shows
<code>BASH_COMMAND</code>. Note that listing the text of the source line is
independent of whether or not the command is also listed.
</p>
<p>Some examples:
</p><table><tr><td> </td><td><pre class="smallexample">set showcommand auto <b>This is the default</b>
set showcommand on <b>Always show the next command to be executed</b>
set showcommand off <b>Never show the next command to be executed</b>
</pre></td></tr></table>
<hr size="6">
<a name="History"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-Display" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Completion" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-history-_0028H_002c-history_002c-_0021_0029"></a>
<h3 class="subsection">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</h3>
<p>The <acronym>BASH</acronym> debugger can keep track of the commands you type during your
debugging sessions, so that you can be certain of precisely what
happened. If the prompt has not been changed (see <a href="#Prompt">Prompt</a>), the history number that will be in use next is by default
listed in the debugger prompt. Invalid commands and history commands
are not saved on the history stack.
</p>
<dl compact="compact">
<dd><a name="index-H-_005bstart_002dnumber-_005bend_002dnumber_005d_005d"></a>
</dd>
<dt> <code>H <span class="roman">[</span><var>start-number</var> <span class="roman">[</span><var>end-number</var><span class="roman">]</span><span class="roman">]</span></code></dt>
<dt> <code>H <span class="roman">[</span><var>-count</var><span class="roman">]</span></code></dt>
<dt> <code>!<span class="roman">[</span>-<span class="roman">]</span><var>n</var>:p</code></dt>
<dd>
<p>You can list what is in the history stack with <code>H</code>. Debugger
commands in ths history stack are listed from most recent to least recent.
If no <var>start-number</var> is given we start with the most recently
executed command and end with the first entry in the history stack.
If <var>start-number</var> is given, that history number is listed first. If
<var>end-number</var> is given, that history number is listed last. If a
single negative number is given list that many history commands.
</p>
<p>An alternate form is <code>!<em>n</em>:p</code> or <code>!-<em>n</em>:p</code> where
<em>n</em> is an integer. If a minus sign is used, <em>n</em> is taken as
the count to go back from the end rather than as a absolute history
number. In contrast <code>H</code>, this form only prints a <em>single</em>
history item.
</p>
<p>Some examples:
</p><table><tr><td> </td><td><pre class="smallexample">H <b>List entire history</b>
H -2 <b>List the last two history items</b>
!-2:p <b>List a single history item starting at the same place as above</b>
H 5 <b>List history from history number 5 to the begining (number 0)</b>
H 5 0 <b>Same as above</b>
H 5 3 <b>List history from history number 5 down to history number 3</b>
!5:p <b>List a single history item 5</b>
</pre></td></tr></table>
<a name="index-history-_005b_002d_005d_005bn_005d"></a>
<a name="index-_0021_005b_002d_005dn-_0028history_0029"></a>
</dd>
<dt> <code>history <span class="roman">[</span><span class="roman">[</span>-<span class="roman">]</span><var>n</var><span class="roman">]</span></code></dt>
<dt> <code>!<span class="roman">[</span>-<span class="roman">]</span><var>n</var></code></dt>
<dd>
<p>Use this command to reexecute a given history number. If no number is
given, the last debugger command in the history is executed.
</p>
<p>An alternate form is <code>!<em>n</em></code> or <code>!-<em>n</em></code> where
<em>n</em> is an integer.
</p>
<p>If a minus sign is used in in either form, <em>n</em> is taken as the
count to go back from the end rather than as a absolute history
number.
</p>
</dd>
</dl>
<p>Use these commands to manage the the <acronym>BASH</acronym> debugger command
history facility.
</p>
<dl compact="compact">
<dd>
<a name="index-history-save"></a>
<a name="index-set-history-save"></a>
</dd>
<dt> <code>set history save</code></dt>
<dt> <code>set history save <span class="roman">[</span> on | 1 <span class="roman">]</span></code></dt>
<dd><p>Record command history in a file, whose name may be specified with the
<code>set history filename</code> command. By default, this option is enabled.
</p>
</dd>
<dt> <code>set history save <span class="roman">[</span> off | 0 <span class="roman">]</span></code></dt>
<dd><p>Stop recording command history in a file.
</p>
<a name="index-history-size"></a>
<a name="index-set-history-size"></a>
</dd>
<dt> <code>set history size <var>size</var></code></dt>
<dd><p>Set the number of commands which <acronym>BASH</acronym> keeps in its history list.
This defaults to the value of the environment variable
<code>HISTSIZE</code>, or to 256 if this variable is not set.
</p></dd>
</dl>
<dl compact="compact">
<dd>
<a name="index-show-history"></a>
</dd>
<dt> <code>show history</code></dt>
<dt> <code>show history save</code></dt>
<dt> <code>show history size</code></dt>
<dd><p>These commands display the state of the <acronym>BASH</acronym> history parameters.
<code>show history</code> by itself displays all states.
</p></dd>
</dl>
<dl compact="compact">
<dd><a name="index-shows"></a>
</dd>
<dt> <code>show commands</code></dt>
<dd><p>Display the last ten commands in the command history.
</p>
</dd>
<dt> <code>show commands <var>n</var></code></dt>
<dd><p>Print ten commands centered on command number <var>n</var>.
</p>
</dd>
<dt> <code>show commands +</code></dt>
<dd><p>Print ten commands just after the commands last printed.
</p></dd>
</dl>
<hr size="6">
<a name="Command-Completion"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#History" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Controlling-bashdb" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-Completion-_0028complete_0029"></a>
<h3 class="subsection">4.14.14 Command Completion (‘<samp>complete</samp>’)</h3>
<p>The <code>complete <var>args</var></code> command lists all the possible
completions for the beginning of a command. We can also show
completions for <code>set</code>, <code>show</code> and <code>info</code>
subcommands. Use <var>args</var> to specify the beginning of the command
you want completed. For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">complete d
</pre></td></tr></table>
<p>results in:
</p>
<table><tr><td> </td><td><pre class="smallexample">d
debug
delete
disable
display
deleteall
down
</pre></td></tr></table>
<p>And
</p><table><tr><td> </td><td><pre class="smallexample">complete set a
</pre></td></tr></table>
<p>results in:
</p>
<table><tr><td> </td><td><pre class="smallexample">set args
set annotate
</pre></td></tr></table>
<p>This is intended for use by front-ends such as <small>GNU</small>
Emacs and <small>DDD</small>.
</p>
<hr size="6">
<a name="Front-Ends"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-Completion" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugger-Command-Reference" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Using-the-BASH-debugger-from-a-front_002dend-user-interface"></a>
<h1 class="chapter">5. Using the <acronym>BASH</acronym> debugger from a front-end user interface</h1>
<p>There are some front-ends that can use the <acronym>BASH</acronym> debugger as a back-end
debugger.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Emacs">5.1 Using the <acronym>BASH</acronym> debugger from <small>GNU</small> Emacs</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#DDD">5.2 Using the <acronym>BASH</acronym> debugger from <acronym>DDD</acronym></a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Emacs"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Front-Ends" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GUD" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Using-the-BASH-debugger-from-GNU-Emacs"></a>
<h2 class="section">5.1 Using the <acronym>BASH</acronym> debugger from <small>GNU</small> Emacs</h2>
<a name="index-Emacs"></a>
<a name="index-GNU-Emacs"></a>
<p>A special interface allows you to use <small>GNU</small> Emacs to view (and
edit) the source files for the program you are debugging with
the <acronym>BASH</acronym> debugger. However you must be using <small>GNU</small> Emacs version 21 or
greater. (<code>M-x show-emacs-version</code> inside <small>GNU</small> Emacs will
tell you what version you are running.)
</p>
<p>To use this interface, use the command <kbd>M-x bashdb</kbd> in <small>GNU</small>
Emacs. Give the executable file you want to debug as an
argument. Make sure to use the version that comes with this package as
this is newer than that supplied with <small>GNU</small> Emacs.
</p>
<p>The <kbd>bashdb</kbd> command starts the <acronym>BASH</acronym> debugger as a subprocess of Emacs,
with input and output through a newly created Emacs buffer.
</p>
<p>Using the <acronym>BASH</acronym> debugger under Emacs is just like using the <acronym>BASH</acronym> debugger
normally except for two things:
</p>
<ul>
<li>
All “terminal” input and output goes through the GNU Emacs buffer.
</li></ul>
<p>This applies both to the <acronym>BASH</acronym> debugger commands and their output, and to the input
and output done by the program you are debugging.
</p>
<p>This is useful because it means that you can copy the text of previous
commands and input them again; you can even use parts of the output
in this way.
</p>
<p>All the facilities of GNU Emacs’ Shell mode are available for interacting
with your script. In particular, you can send signals the usual
way—for example, <kbd>C-c C-c</kbd> for an interrupt, <kbd>C-c C-z</kbd> for a
stop.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#GUD">5.1.1 Commands from the GUD buffer</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Emacs-Source">5.1.2 Commands from the source script</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Emacs-Shell">5.1.3 the <acronym>BASH</acronym> debugger from a <small>GNU</small> Emacs Shell</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="GUD"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Emacs" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs-Source" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Commands-from-the-GUD-buffer"></a>
<h3 class="subsection">5.1.1 Commands from the GUD buffer</h3>
<ul>
<li>
the <acronym>BASH</acronym> debugger displays source code through Emacs.
</li></ul>
<p>Each time the <acronym>BASH</acronym> debugger displays a stack frame, Emacs automatically finds the
source file for that frame and puts an arrow (‘<samp>=></samp>’) at the
left margin of the current line. Emacs uses a separate buffer for
source display, and splits the screen to show both your the <acronym>BASH</acronym> debugger session
and the source.
</p>
<p>Explicit the <acronym>BASH</acronym> debugger <code>list</code> or search commands still produce output as
usual, but you probably have no reason to use them from GNU Emacs.
</p>
<blockquote><p><em>Warning:</em> If the directory where your script resides is not your
current directory, it can be easy to confuse Emacs about the location of
the source files, in which case the auxiliary display buffer does not
appear to show your source. the <acronym>BASH</acronym> debugger can find programs by searching your
environment’s <code>PATH</code> variable, so the the <acronym>BASH</acronym> debugger input and output
session proceeds normally; but Emacs does not get enough information
back from the <acronym>BASH</acronym> debugger to locate the source files in this situation. To
avoid this problem, either start the <acronym>BASH</acronym> debugger mode from the directory where
your script resides, or specify an absolute file name when prompted for the
<kbd>M-x gdb</kbd> argument.
</p>
<p>A similar confusion can result if you use the the <acronym>BASH</acronym> debugger <code>file</code> command to
switch to debugging a program in some other location, from an existing
the <acronym>BASH</acronym> debugger buffer in Emacs.
</p></blockquote>
<p>By default, <kbd>M-x bashdb</kbd> calls the <code>bash --debugger</code>. If you
need to call the <acronym>BASH</acronym> debugger by a different name (for example, if you
keep several configurations around, with different names) you can set
the Emacs variable <code>gud-bashdb-command-name</code>; for example,
</p>
<table><tr><td> </td><td><pre class="example">(setq gud-bashdb-command-name "bash --debugger")
</pre></td></tr></table>
<p>(preceded by <kbd>M-:</kbd> or <kbd>ESC :</kbd>, or typed in the <code>*scratch*</code> buffer, or
in your ‘<tt>.emacs</tt>’ file) makes Emacs call the program named
“<code>bash-debugger</code>” instead.
</p>
<p>In the the <acronym>BASH</acronym> debugger I/O buffer, you can use the Emacs commands listed
below in addition to the standard Shell mode commands. The I/O buffer
name name is usually <code>*gud-</code><em>script-name</em><code>*</code>, where
<em>script-name</em> is the name of the script you are debugging.
</p>
<p>Many of the commands listed below are also bound to a second key
sequence which also can be used in the also be used in the source
script. These are listed in <a href="#Emacs-Source">Commands from the source script</a>.
</p>
<dl compact="compact">
<dt> <kbd>C-h m</kbd></dt>
<dd><p>Describe the features of Emacs’ the <acronym>BASH</acronym> debugger Mode.
</p>
</dd>
<dt> <kbd>C-c C-f</kbd></dt>
<dd><p>Execute until exit from the selected stack frame. The Same as the <acronym>BASH</acronym> debugger
<code>finish</code> command. The <small>GNU</small> Emacs command name is
<code>gud-finish</code> and <code>C-x C-a f C-f</code> is an alternate binding
which also can be used in the source script. See section <a href="#Finish">Finish (‘<samp>finish</samp>’)</a>.
</p>
</dd>
<dt> <kbd>C-c C-l</kbd></dt>
<dd><p>Resynchronize the current position with the source window. The
<small>GNU</small> Emacs command name is <code>gud-refresh</code> and <code>C-x C-a
C-l</code> is an alternate binding which also can be used in the source script.
</p>
</dd>
<dt> <kbd>C-c C-n</kbd></dt>
<dd><p>Execute to next source line in this function, skipping all function
calls. Same as the <acronym>BASH</acronym> debugger <code>next</code> command. The <small>GNU</small> Emacs
command name is <code>gud-next</code> and <code>C-x C-a n</code> is an
alternate binding which also can be used in the source script. See section <a href="#Next">Next (‘<samp>next</samp>’)</a>.
</p>
<p>With a numeric argument, run that many times.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
</dd>
<dt> <kbd>C-c C-r</kbd></dt>
<dd><p>Continue execution of your script Same as the <acronym>BASH</acronym> debugger <code>continue</code>
command. The <small>GNU</small> Emacs command name is <code>gud-cont</code> and
<code>C-x C-a C-r</code> is an alternate binding which also can be used in the
source script. See <a href="#Continue">Continue (‘<samp>continue</samp>’)</a>.
</p>
</dd>
<dt> <kbd>C-c C-s</kbd></dt>
<dd><p>Step one source line. Same as the <acronym>BASH</acronym> debugger <code>step</code> command. The
<small>GNU</small> Emacs command name is <code>gud-step</code> and <code>C-x C-a C-s</code>
is an alternate binding which can be used in the source
script. See section <a href="#Step">Step (‘<samp>step</samp>’)</a>.
</p>
<p>With a numeric argument, run that many times.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
</dd>
<dt> <kbd>C-c ></kbd></dt>
<dd><p>Go down a stack frame. Same as the <acronym>BASH</acronym> debugger <code>down</code>.
With a numeric argument, go down that many stack frames.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>The <small>GNU</small> Emacs command name is
<code>gud-down</code> and <code>C-x C-a ></code> is an alternate binding
which can be used in the source script.
</p>
</dd>
<dt> <kbd>C-c <</kbd></dt>
<dd><p>Go up a stack frame. With a numeric argument, go up that many
stack frames. Same the <acronym>BASH</acronym> debugger <code>up</code> command.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>The <small>GNU</small> Emacs command name is
<code>gud-up</code> and <code>C-x C-a <</code> is an alternate binding
which can be used in the source script.
</p>
</dd>
<dt> <kbd>C-c a</kbd></dt>
<dd><p>Shows argument variables (e.g. <code>$1</code>, <code>$2</code>) of the current
stack frame. Same as the <acronym>BASH</acronym> debugger <code>info args</code> command. The
<small>GNU</small> Emacs command name is <code>gud-args</code> and <code>C-x C-a a</code> is
an alternate binding which also can be used in the source script.
</p>
</dd>
<dt> <kbd>C-c R</kbd></dt>
<dd><p>Restart or run the script. Same as the <acronym>BASH</acronym> debugger <code>run</code> command. The
<small>GNU</small> Emacs command name is <code>gud-finish</code> and <code>C-x C-a R</code>
is an alternate binding which also can be used in the source script.
</p>
</dd>
<dt> <kbd>C-c T</kbd></dt>
<dd><p>Show stack trace. Same as the <acronym>BASH</acronym> debugger <code>where</code> command. The
<small>GNU</small> Emacs command name is <code>gud-where</code> and <code>C-x C-a T</code> is
an alternate binding which can be used in the source
script. See section <a href="#Backtrace">Backtraces (‘<samp>where</samp>’)</a>.
</p>
</dd>
</dl>
<p>In any source file, the Emacs command <kbd>C-x SPC</kbd> (<code>gud-break</code>)
tells the <acronym>BASH</acronym> debugger to set a breakpoint on the source line point is on.
</p>
<p>If you accidentally delete the source-display buffer, an easy way to get
it back is to type the command <code>frame</code> in the the <acronym>BASH</acronym> debugger buffer, to
request a frame display; when you run under Emacs, this recreates
the source buffer if necessary to show you the context of the current
frame.
</p>
<p>The source files displayed in Emacs are in ordinary Emacs buffers
which are visiting the source files in the usual way. You can edit
the files with these buffers if you wish; but keep in mind that the <acronym>BASH</acronym> debugger
communicates with Emacs in terms of line numbers. If you add or
delete lines from the text, the line numbers that the <acronym>BASH</acronym> debugger knows cease
to correspond properly with the code.
</p>
<p>See <a href="Emacs.html#Debugger-Operation">(Emacs)Debugger Operation</a> section ‘Debugger Operation’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<hr size="6">
<a name="Emacs-Source"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GUD" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs-Shell" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Commands-from-the-source-script"></a>
<h3 class="subsection">5.1.2 Commands from the source script</h3>
<dl compact="compact">
<dt> <kbd>C-x SPC</kbd></dt>
<dd>
<p>tells the <acronym>BASH</acronym> debugger to set a breakpoint on the source
line point is on. (<code>gud-break</code>)
</p>
</dd>
<dt> <kbd>C-x C-a t</kbd> </dt>
<dd>
<p><code>gud-linetrace</code>
</p>
</dd>
<dt> <kbd>C-x C-a C-f</kbd></dt>
<dd><p>Restart or run the script. Same as the <acronym>BASH</acronym> debugger <code>run</code> command. The
<small>GNU</small> Emacs command name is <code>gud-finish</code>. In the corresponding
I/O buffer, <code>C-c R</code> is an alternate binding.
</p>
</dd>
<dt> <kbd>C-x C-a T</kbd> </dt>
<dd><p>Show stack trace. Same as the <acronym>BASH</acronym> debugger <code>where</code> command. In the
corresponding I/O buffer, <code>C-c T</code> is an alternate
binding. See section <a href="#Backtrace">Backtraces (‘<samp>where</samp>’)</a>.
</p>
</dd>
<dt> <kbd>C-x C-a <</kbd> </dt>
<dd>
<p>Go up a stack frame. With a numeric argument, go up that many
stack frames. Same the <acronym>BASH</acronym> debugger <code>up</code> command.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>The <small>GNU</small> Emacs command name is <code>gud-up</code>. In the corresponding
I/O buffer, <code>C-c <</code> is an alternate binding.
</p>
</dd>
<dt> <kbd>C-x C-a ></kbd> </dt>
<dd>
<p>Go down a stack frame. Same as the <acronym>BASH</acronym> debugger <code>down</code>.
With a numeric argument, go down that many stack frames.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>The <small>GNU</small> Emacs command name is <code>gud-down</code>. In the
corresponding I/O buffer, <code>C-c ></code> is an alternate binding.
</p>
</dd>
<dt> <kbd>C-x C-a C-t</kbd></dt>
<dd>
<p><code>gud-tbreak</code>
</p>
</dd>
<dt> <kbd>C-x C-a C-s</kbd></dt>
<dd>
<p>Step one source line. Same as the <acronym>BASH</acronym> debugger <code>step</code>
command. See section <a href="#Step">Step (‘<samp>step</samp>’)</a>.
</p>
<p>With a numeric argument, run that many times.
See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>The <small>GNU</small> Emacs command name is <code>gud-step</code>. In the
corresponding I/O buffer, <code>C-c C-s</code> is an alternate binding.
</p>
</dd>
<dt> <kbd>C-x C-a C-e</kbd></dt>
<dd>
<p><code>gud-statement</code>
</p>
</dd>
<dt> <kbd>C-x C-a R</kbd> </dt>
<dd><p>Restart or run the script. Same as the <acronym>BASH</acronym> debugger <code>run</code> command. The
<small>GNU</small> Emacs command name is <code>gud-run</code>. In the corresponding I/O
buffer, <code>C-c R</code> is an alternate binding.
</p>
</dd>
<dt> <kbd>C-x C-a C-d</kbd></dt>
<dd><p>Delete breakpoint. <code>gud-remove</code>
</p>
</dd>
<dt> <kbd>C-x C-a C-p</kbd></dt>
<dd>
<p><code>gud-print</code>
</p>
</dd>
<dt> <kbd>C-x C-a C-n</kbd></dt>
<dd>
<p>Execute to next source line in this function, skipping all function
calls. Same as the <acronym>BASH</acronym> debugger <code>next</code> command. With a numeric
argument, run that many times. See <a href="Emacs.html#Arguments">(Emacs)Arguments</a> section ‘Numeric Arguments’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>The <small>GNU</small> Emacs command name is <code>gud-next</code>. In the
corresponding I/O buffer, <code>C-c C-n</code> is an alternate binding.
</p>
</dd>
<dt> <kbd>C-x C-a f C-f</kbd></dt>
<dd>
<p><code>gud-finish</code>
</p>
</dd>
<dt> <kbd>C-x C-a C-r</kbd></dt>
<dd><p>Continue execution of your script Same as the <acronym>BASH</acronym> debugger <code>continue</code>
command. The <small>GNU</small> Emacs command name is <code>gud-cont</code>. In the
corresponding I/O buffer, <code>C-c C-r</code> is an alternate binding. See
<a href="#Continue">Continue (‘<samp>continue</samp>’)</a>.
</p>
</dd>
<dt> <kbd>C-x C-a C-b</kbd></dt>
<dd>
<p><code>gud-break</code>
</p>
</dd>
<dt> <kbd>C-x C-a a</kbd> </dt>
<dd>
<p><code>gud-args</code>
Shows argument variables (e.g. <code>$1</code>, <code>$2</code>) of the current
stack frame. Same as the <acronym>BASH</acronym> debugger <code>info args</code> command. The
<small>GNU</small> Emacs command name is <code>gud-args</code>. In the corresponding
I/O buffer, <code>C-c a</code> is an alternate binding which also can be
used in the source script.
</p>
</dd>
<dt> <kbd>C-x C-a C-l</kbd></dt>
<dd><p>Move to current position in this source window. The <small>GNU</small> Emacs
command name is <code>gud-refresh</code>. In the corresponding I/O buffer,
<code>C-c C-l</code> is an alternate binding.
</p>
</dd>
</dl>
<hr size="6">
<a name="Emacs-Shell"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Emacs-Source" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#DDD" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="the-BASH-debugger-from-a-GNU-Emacs-Shell"></a>
<h3 class="subsection">5.1.3 the <acronym>BASH</acronym> debugger from a <small>GNU</small> Emacs Shell</h3>
<p>It is also possible in GNU emacs to use a regular (“comint”) shell
and set a mode to watch for the <acronym>BASH</acronym> debugger prompts. See <a href="Emacs.html#Interactive-Shell">(Emacs)Interactive Shell</a> section ‘Shell’ in <cite>The <small>GNU</small> Emacs Manual</cite>.
</p>
<p>To run bash in a shell in Emacs but track source lines this, issue the
the command (from M-x) <code>turn-on-bashdbtrack</code>. There is some
overhead involved in scanning output, so if you are not debugging bash
programs you probably want to turn this off which can be done via the
M-x <code>turn-off-bashdbtrack</code> command.
</p>
<hr size="6">
<a name="DDD"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Emacs-Shell" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Using-the-BASH-debugger-from-DDD"></a>
<h2 class="section">5.2 Using the <acronym>BASH</acronym> debugger from <acronym>DDD</acronym></h2>
<a name="index-DDD"></a>
<p>the <acronym>BASH</acronym> debugger support is rather new in <acronym>DDD</acronym>. As a programming
language, the <acronym>BASH</acronym> debugger is not feature rich: there are no record
structures or hash tables (yet), no pointers, package variable scoping
or methods. So much of the data display and visualization features of
<acronym>DDD</acronym> are disabled.
</p>
<p>As with any scripting or interpreted language (e.g. Perl), one can’t
step by a single machine-language instruction. So the ddd Stepi/Nexti
commands are disabled.
</p>
<p>Some <acronym>BASH</acronym> settings are essential for <acronym>DDD</acronym> to work
correctly. These settings with their correct values are:
</p>
<table><tr><td> </td><td><pre class="example">set annotate 1
set prompt set prompt bashdb$_Dbg_less$_Dbg_greater$_Dbg_space
</pre></td></tr></table>
<p><acronym>DDD</acronym> sets these values automatically when invoking
<acronym>BASH</acronym>; if these values are changed, there may be some
malfunctions.
</p>
<p>Pay special attention when the prompt has extra angle brackets (a
nested shell) or has any parenthesis (is in a subshell). Quitting may
merely exit out of one of these nested (sub)shells rather than leave
the program.
</p>
<hr size="6">
<a name="BASH-Debugger-Bugs"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#DDD" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Bug-Criteria" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Front-Ends" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#History-and-Acknowledgments" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Reporting-Bugs"></a>
<h1 class="chapter">6. Reporting Bugs</h1>
<a name="index-bugs"></a>
<a name="index-reporting-bugs"></a>
<p>Your bug reports play an essential role in making the <acronym>BASH</acronym>
debugger reliable.
</p>
<p>Reporting a bug may help you by bringing a solution to your problem, or it
may not. But in any case the principal function of a bug report is to help
the entire community by making the next version of the <acronym>BASH</acronym> debugger work better. Bug
reports are your contribution to the maintenance of the <acronym>BASH</acronym> debugger.
</p>
<p>In order for a bug report to serve its purpose, you must include the
information that enables us to fix the bug.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Bug-Reporting">6.2 How to report bugs</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Bug-Criteria"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Bug-Reporting" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#History-and-Acknowledgments" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Have-you-found-a-bug_003f"></a>
<h2 class="section">6.1 Have you found a bug?</h2>
<a name="index-bug-criteria"></a>
<p>If you are not sure whether you have found a bug, here are some guidelines:
</p>
<ul>
<li><a name="index-fatal-signal"></a>
<a name="index-debugger-crash"></a>
<a name="index-crash-of-debugger"></a>
</li><li>
If the debugger gets a fatal signal, for any input whatever, that is a
the <acronym>BASH</acronym> debugger bug. Reliable debuggers never crash.
<a name="index-error-on-valid-input"></a>
</li><li>
If the <acronym>BASH</acronym> debugger produces an error message for valid input, that is a
bug. (Note that if you’re cross debugging, the problem may also be
somewhere in the connection to the target.)
<a name="index-invalid-input"></a>
</li><li>
If the <acronym>BASH</acronym> debugger does not produce an error message for invalid input,
that is a bug. However, you should note that your idea of
“invalid input” might be our idea of “an extension” or “support
for traditional practice”.
</li><li>
If you are an experienced user of debugging tools, your suggestions
for improvement of the <acronym>BASH</acronym> debugger are welcome in any case.
</li></ul>
<hr size="6">
<a name="Bug-Reporting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Bug-Criteria" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#History-and-Acknowledgments" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#History-and-Acknowledgments" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="How-to-report-bugs"></a>
<h2 class="section">6.2 How to report bugs</h2>
<a name="index-bug-reports"></a>
<a name="index-BASH-debugger-bugs_002c-reporting"></a>
<p>Bug reports can sent via the sourceforge bug tracking mechansim at
<a href="http://sourceforge.net/tracker/?group_id=61395&atid=497159">http://sourceforge.net/tracker/?group_id=61395&atid=497159</a>. Of
course patches are very much welcome too. Those can also be sent via
the same mechanism.
</p>
<p>The fundamental principle of reporting bugs usefully is this:
<strong>report all the facts</strong>. If you are not sure whether to state a
fact or leave it out, state it!
</p>
<p>Often people omit facts because they think they know what causes the
problem and assume that some details do not matter. Thus, you might
assume that the name of the variable you use in an example does not matter.
Well, probably it does not, but one cannot be sure. Perhaps the bug is a
stray memory reference which happens to fetch from the location where that
name is stored in memory; perhaps, if the name were different, the contents
of that location would fool the debugger into doing the right thing despite
the bug. Play it safe and give a specific, complete example. That is the
easiest thing for you to do, and the most helpful.
</p>
<p>Keep in mind that the purpose of a bug report is to enable us to fix the
bug. It may be that the bug has been reported previously, but neither
you nor we can know that unless your bug report is complete and
self-contained.
</p>
<p>Sometimes people give a few sketchy facts and ask, “Does this ring a
bell?” Those bug reports are useless, and we urge everyone to
<em>refuse to respond to them</em> except to chide the sender to report
bugs properly.
</p>
<p>To enable us to fix the bug, you should include all these things:
</p>
<ul>
<li>
The version of the <acronym>BASH</acronym> debugger. the <acronym>BASH</acronym> debugger announces it if you start
with no arguments; you can also print it at any time using <code>version</code>
command.
<p>Without this, we will not know whether there is any point in looking for
the bug in the current version of the <acronym>BASH</acronym> debugger.
</p>
</li><li>
The type of machine you are using, and the operating system name and
version number.
</li><li>
What compiler (and its version) was used to compile BASH—e.g.
“gcc 3.4”.
</li><li>
The command arguments you gave the compiler to compile your example and
observe the bug. For example, did you use ‘<samp>-O</samp>’? To guarantee
you will not omit something important, list them all. A copy of the
Makefile (or the output from make) is sufficient.
<p>If we were to try to guess the arguments, we would probably guess wrong
and then we might not encounter the bug.
</p>
</li><li>
A complete input script, and all necessary source files, that will
reproduce the bug.
</li><li>
A description of what behavior you observe that you believe is
incorrect. For example, “It gets a fatal signal.”
<p>Of course, if the bug is that the <acronym>BASH</acronym> debugger gets a fatal signal, then we
will certainly notice it. But if the bug is incorrect output, we might
not notice unless it is glaringly wrong. You might as well not give us
a chance to make a mistake.
</p>
<p>Even if the problem you experience is a fatal signal, you should still
say so explicitly. Suppose something strange is going on, such as, your
copy of the <acronym>BASH</acronym> debugger is out of synch, or you have encountered a bug in
the C library on your system. (This has happened!) Your copy might
crash and ours would not. If you told us to expect a crash, then when
ours fails to crash, we would know that the bug was not happening for
us. If you had not told us to expect a crash, then we would not be able
to draw any conclusion from our observations.
</p>
</li><li>
If you wish to suggest changes to the the <acronym>BASH</acronym> debugger source, send us context
diffs. If you even discuss something in the the <acronym>BASH</acronym> debugger source, refer to
it by context, not by line number.
<p>The line numbers in our development sources will not match those in your
sources. Your line numbers would convey no useful information to us.
</p>
</li></ul>
<p>Here are some things that are not necessary:
</p>
<ul>
<li>
A description of the envelope of the bug.
<p>Often people who encounter a bug spend a lot of time investigating
which changes to the input file will make the bug go away and which
changes will not affect it.
</p>
<p>This is often time consuming and not very useful, because the way we
will find the bug is by running a single example under the debugger
with breakpoints, not by pure deduction from a series of examples.
We recommend that you save your time for something else.
</p>
<p>Of course, if you can find a simpler example to report <em>instead</em>
of the original one, that is a convenience for us. Errors in the
output will be easier to spot, running under the debugger will take
less time, and so on.
</p>
<p>However, simplification is not vital; if you do not want to do this,
report the bug anyway and send us the entire test case you used.
</p>
</li><li>
A patch for the bug.
<p>A patch for the bug does help us if it is a good one. But do not omit
the necessary information, such as the test case, on the assumption that
a patch is all we need. We might see problems with your patch and decide
to fix the problem another way, or we might not understand it at all.
</p>
<p>Sometimes with a program as complicated as the <acronym>BASH</acronym> debugger it is very hard to
construct an example that will make the program follow a certain path
through the code. If you do not send us the example, we will not be able
to construct one, so we will not be able to verify that the bug is fixed.
</p>
<p>And if we cannot understand what bug you are trying to fix, or why your
patch should be an improvement, we will not install it. A test case will
help us to understand.
</p>
</li><li>
A guess about what the bug is or what it depends on.
<p>Such guesses are usually wrong. Even we cannot guess right about such
things without first using the debugger to find the facts.
</p></li></ul>
<hr size="6">
<a name="History-and-Acknowledgments"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Bug-Reporting" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Copying" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#BASH-Debugger-Bugs" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Copying" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="History-and-Acknowledgments-1"></a>
<h1 class="chapter">7. History and Acknowledgments</h1>
<p>The suggestion for a debugger for a Bourne-like shell came from the book
“Learning the Korn Shell”, by Bill Rosenblatt Copyright (C) 1993 by
O’Reilly and Associates, Inc. Others such as Cigy Cyriac, Chet Ramey,
Rocky Bernstein, and Gary V. Vaughan expanded and improved on that.
</p>
<p>However Bourne-Shell debuggers rely on a signal mechanism
(<code>SIGDEBUG</code>) to call a debugger routine. In the Korn shell as
well as <small>BASH</small> in versions prior to 2.05, there was a fundamental
flaw: the routine that you registered in the trap, got called
<em>after</em> the statement was executed. It takes little imagination
to realize that this is a bit too late to find and correct errors,
especially if the offending command happens to do serious damage like
remove filesystems or reboot a server. As a horrible hack, these
debuggers added one to the line number that was just executed on the
wishful thinking that this would then be the line of next statement to
execute. Sometimes this was correct, but it was too often wrong, such
as in loops and conditionals, comments, or commands that are continued
on the next line.
</p>
<p>Another failing of these debuggers was the inability to debug into
functions or into sourced files, provide a stack trace, dynamically
skip a statement to be run, unconditionally trace into a function or
subshell, or stop when a subroutine, sourced file, or subshell
completed. In truth, the crux of the problem lay in debugging support
in BASH. Given that there was limited bash debugging support, it is
not surprising that these debuggers could not do any of the things
listed above and could debug only a single shell in a single source
file: lines could be listed only from a single text, breakpoints were
set into the text which was in fact a copy of the script name
prepended with debugger routines.
</p>
<p>In version 2.04 of BASH, Rocky Bernstein started hacking on BASH to
add call-stack information, source file information, allow for
debugging into functions and for reporting line numbers in functions
as relative to the file rather than the beginning of a function whose
origin line number was not accessible from BASH. He started changing
the user commands in bashdb to be like other more-advanced debuggers,
in particular <code>perl5db</code> and <code>gdb</code>. However he gave up on
this project when realizing that stopping before a line was crucial. A
patch for this was nontrivial and wildly changed
semantics. Furthermore the chance of getting his other patches into
BASH was was not going to happen in version 2.04.
</p>
<p>In version 2.05, the fundamental necessary change to the semantics of
<code>SIGDEBUG</code> trap handling (suggested at least two years earlier)
was made. Also, version 2.05 changed the line-number reporting in a
function to be relative to the beginning of the file rather than the
beginning of a function—sometimes. Rocky then picked up where he
left off and this then became this debugger. A complete rewrite of the
debugger, some of which started in 2.04 was undertaken. Debugger
internals were changed to support multiple file names, save and
restore the calling environment (such as variables <code>$1</code> and
<code>$?</code>) and install debugger signal handlers. Work was also done on
the BASH in conjunction with the debugger to save stack trace
information, provide a means for stopping after a routine finished,
debugging into a subshell and so on. And a number of changes were made
to BASH just to improve the accuracy of the line number reporting
which is crucial in a debugger.
</p>
<p>This documentation was modified from the GNU Debugger (GDB) Reference
manual.
</p>
<blockquote><p>Additions to this section are particularly welcome. If you or your
friends (or enemies, to be evenhanded) have been unfairly omitted from
this list, we would like to add your names!
</p></blockquote>
<p>The following have contributed directly or indrectly to bashdb:
</p>
<p>Rocky Bernstein (initial full-featured bashdb with stack tracing and
multi-file support)
</p>
<p>Masatake YAMATO (help to merge Rocky’s hack to the official bash source tree)
</p>
<p>Bill Rosenblatt (kshdb),
Michael Loukides (kshdb),
Cigy Cyriac (proto bashdb),
Chet Ramey (proto bashdb),
and
Gary V. Vaughan (proto bashdb).
</p>
<p>Authors of per5ldb:
</p>
<p>Ray Lischner,
Johan Vromans,
and
Ilya Zakharevich.
</p>
<p>Authors of GDB:
</p>
<p>Richard Stallman,
Andrew Cagney,
Jim Blandy,
Jason Molenda,
Stan Shebs,
Fred Fish,
Stu Grossman,
John Gilmore,
Jim Kingdon,
and
Randy Smith (to name just a few).
</p>
<p>Authors of GUD:
</p>
<p>Eric S. Raymond.
</p>
<hr size="6">
<a name="Copying"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#History-and-Acknowledgments" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#History-and-Acknowledgments" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="GNU-GENERAL-PUBLIC-LICENSE"></a>
<h1 class="appendix">A. GNU GENERAL PUBLIC LICENSE</h1>
<p align="center"> Version 2, June 1991
</p>
<table><tr><td> </td><td><pre class="display">Copyright © 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
On Debian systems the full text of the latest General Public License (GPL) can
be found at /usr/share/common-licenses/GPL.
</pre></td></tr></table>
<hr size="6">
<a name="GNU-Free-Documentation-License"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Copying" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Copying" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="GNU-Free-Documentation-License-1"></a>
<h1 class="appendix">B. GNU Free Documentation License</h1>
<p align="center"> Version 1.1, March 2000
</p>
<table><tr><td> </td><td><pre class="display">On Debian systems the full text of the latest Free Documentation License (FDL) can
be found at /usr/share/common-licenses/FDL.
</pre></td></tr></table>
<hr size="6">
<a name="Function-Index"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Index" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Index" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Function-Index-1"></a>
<h1 class="unnumbered">Function Index</h1>
<hr size="6">
<a name="Command-Index"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Function-Index" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Variable-Index" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Variable-Index" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-Index-1"></a>
<h1 class="unnumbered">Command Index</h1>
<table><tr><th valign="top">Jump to: </th><td><a href="#Command-Index-1_ky_symbol-1" class="summary-letter"><b>!</b></a>
<a href="#Command-Index-1_ky_symbol-2" class="summary-letter"><b>#</b></a>
<br>
<a href="#Command-Index-1_ky_letter-A" class="summary-letter"><b>A</b></a>
<a href="#Command-Index-1_ky_letter-B" class="summary-letter"><b>B</b></a>
<a href="#Command-Index-1_ky_letter-C" class="summary-letter"><b>C</b></a>
<a href="#Command-Index-1_ky_letter-D" class="summary-letter"><b>D</b></a>
<a href="#Command-Index-1_ky_letter-E" class="summary-letter"><b>E</b></a>
<a href="#Command-Index-1_ky_letter-F" class="summary-letter"><b>F</b></a>
<a href="#Command-Index-1_ky_letter-H" class="summary-letter"><b>H</b></a>
<a href="#Command-Index-1_ky_letter-I" class="summary-letter"><b>I</b></a>
<a href="#Command-Index-1_ky_letter-K" class="summary-letter"><b>K</b></a>
<a href="#Command-Index-1_ky_letter-L" class="summary-letter"><b>L</b></a>
<a href="#Command-Index-1_ky_letter-N" class="summary-letter"><b>N</b></a>
<a href="#Command-Index-1_ky_letter-P" class="summary-letter"><b>P</b></a>
<a href="#Command-Index-1_ky_letter-Q" class="summary-letter"><b>Q</b></a>
<a href="#Command-Index-1_ky_letter-R" class="summary-letter"><b>R</b></a>
<a href="#Command-Index-1_ky_letter-S" class="summary-letter"><b>S</b></a>
<a href="#Command-Index-1_ky_letter-T" class="summary-letter"><b>T</b></a>
<a href="#Command-Index-1_ky_letter-U" class="summary-letter"><b>U</b></a>
<a href="#Command-Index-1_ky_letter-V" class="summary-letter"><b>V</b></a>
<a href="#Command-Index-1_ky_letter-W" class="summary-letter"><b>W</b></a>
<a href="#Command-Index-1_ky_letter-X" class="summary-letter"><b>X</b></a>
</td></tr></table>
<table border="0" class="index-ky">
<tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_symbol-1">!</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0021_0021-_0028shell_0029"><code>!! <span class="roman">(<code>shell</code>)</span></code></a></td><td valign="top"><a href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0021_005b_002d_005dn-_0028history_0029"><code>!<span class="roman">[</span>-<span class="roman">]</span><var>n</var> <span class="roman">(<code>history</code>)</span></code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_symbol-2">#</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0023-_0028a-comment_0029"><code># <span class="roman">(a comment)</span></code></a></td><td valign="top"><a href="#Command-Syntax">4.1 Command syntax</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-alias-name-command"><code>alias <var>name</var> <var>command</var></code></a></td><td valign="top"><a href="#Alias">4.14.1 Debugger Command Aliases (‘<samp>alias</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-b-_0028break_0029"><code>b <span class="roman">(<code>break</code>)</span></code></a></td><td valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-backtrace"><code>backtrace</code></a></td><td valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-break"><code>break</code></a></td><td valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bt-_0028backtrace_0029"><code>bt <span class="roman">(<code>backtrace</code>)</span></code></a></td><td valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-c-_0028continue_0029"><code>c <span class="roman">(<code>continue</code>)</span></code></a></td><td valign="top"><a href="#Continue">4.4.2.5 Continue (‘<samp>continue</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cd-_005bdirectory_005d"><code>cd <span class="roman">[</span><var>directory</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#Interfacing-to-the-OS">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clear"><code>clear</code></a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-commands"><code>commands</code></a></td><td valign="top"><a href="#Break-Commands">4.4.1.3 Breakpoint command lists (‘<samp>commands</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition"><code>condition</code></a></td><td valign="top"><a href="#Conditions">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continue"><code>continue</code></a></td><td valign="top"><a href="#Continue">4.4.2.5 Continue (‘<samp>continue</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-d-_0028clear_0029"><code>d <span class="roman">(<code>clear</code>)</span></code></a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-de-_0028delete_0029"><code>de <span class="roman">(<code>delete</code>)</span></code></a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug"><code>debug</code></a></td><td valign="top"><a href="#Debug">4.4.2.6 Debug (‘<samp>debug</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-delete"><code>delete</code></a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-delete-display"><code>delete display</code></a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dis-_0028disable_0029"><code>dis <span class="roman">(<code>disable</code>)</span></code></a></td><td valign="top"><a href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disable"><code>disable</code></a></td><td valign="top"><a href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disable-breakpoints"><code>disable breakpoints</code></a></td><td valign="top"><a href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disable-display"><code>disable display</code></a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display"><code>display</code></a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-do-_0028down_0029"><code>do <span class="roman">(<code>down</code>)</span></code></a></td><td valign="top"><a href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-down"><code>down</code></a></td><td valign="top"><a href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-e-_0028eval_0029"><code>e <span class="roman">(<code>eval</code>)</span></code></a></td><td valign="top"><a href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-edit-_005bline_002dspecification_005d"><code>edit <span class="roman">[</span><var>line-specification</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#Edit">4.8 Editing Source files (‘<samp>edit</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enable"><code>enable</code></a></td><td valign="top"><a href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enable-breakpoints"><code>enable breakpoints</code></a></td><td valign="top"><a href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enable-display"><code>enable display</code></a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-end"><code>end</code></a></td><td valign="top"><a href="#Break-Commands">4.4.1.3 Breakpoint command lists (‘<samp>commands</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-eval"><code>eval</code></a></td><td valign="top"><a href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-examine"><code>examine</code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-file"><code>file</code></a></td><td valign="top"><a href="#File">4.14.6 Specifying a Script-File Association (‘<samp>file</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-finish"><code>finish</code></a></td><td valign="top"><a href="#Finish">4.4.2.3 Finish (‘<samp>finish</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-forward"><code>forward</code></a></td><td valign="top"><a href="#Search">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frame"><code>frame</code></a></td><td valign="top"><a href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-h-_0028help_0029"><code>h <span class="roman">(<code>help</code>)</span></code></a></td><td valign="top"><a href="#Help">4.2 Getting help (‘<samp>help</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-H-_005bstart_002dnumber-_005bend_002dnumber_005d_005d"><code>H <span class="roman">[</span><var>start-number</var> <span class="roman">[</span><var>end-number</var><span class="roman">]</span><span class="roman">]</span></code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-handle"><code>handle</code></a></td><td valign="top"><a href="#handle">4.4.3.1 Intercepting Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-history-_005b_002d_005d_005bn_005d"><code>history <span class="roman">[</span>-<span class="roman">]</span><span class="roman">[</span><var>n</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-i-_0028info_0029"><code>i <span class="roman">(<code>info</code>)</span></code></a></td><td valign="top"><a href="#Help">4.2 Getting help (‘<samp>help</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info"><code>info</code></a></td><td valign="top"><a href="#Help">4.2 Getting help (‘<samp>help</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-args"><code>info args</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-breakpoints"><code>info breakpoints</code></a></td><td valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-breakpoints-1"><code>info breakpoints</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-display"><code>info display</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-display-1"><code>info display</code></a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-files"><code>info files</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-functions"><code>info functions</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-line"><code>info line</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-program"><code>info program</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-signals"><code>info signals</code></a></td><td valign="top"><a href="#handle">4.4.3.1 Intercepting Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-signals-1"><code>info signals</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-source"><code>info source</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-stack"><code>info stack</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-terminal"><code>info terminal</code></a></td><td valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-terminal-1"><code>info terminal</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-variables"><code>info variables</code></a></td><td valign="top"><a href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-info-variables-1"><code>info variables</code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-K">K</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-k-_0028kill_0029"><code>k <span class="roman">(<code>kill</code>)</span></code></a></td><td valign="top"><a href="#Quit">4.3 Quitting the BASH debugger (‘<samp>quit</samp>’, ‘<samp>kill</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-l-_0028list_0029"><code>l <span class="roman">(<code>list</code>)</span></code></a></td><td valign="top"><a href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list"><code>list</code></a></td><td valign="top"><a href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-n-_0028next_0029"><code>n <span class="roman">(<code>next</code>)</span></code></a></td><td valign="top"><a href="#Next">4.4.2.2 Next (‘<samp>next</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-next"><code>next</code></a></td><td valign="top"><a href="#Next">4.4.2.2 Next (‘<samp>next</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-p-_0028print_0029"><code>p <span class="roman">(<code>print</code>)</span></code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-print"><code>print</code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-print-1"><code>print</code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pwd"><code>pwd</code></a></td><td valign="top"><a href="#Interfacing-to-the-OS">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-Q">Q</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-q-_0028quit_0029"><code>q <span class="roman">(<code>quit</code>)</span></code></a></td><td valign="top"><a href="#Quit">4.3 Quitting the BASH debugger (‘<samp>quit</samp>’, ‘<samp>kill</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-quit-_005bexpression-_005bsubshell_002dlevels_005d_005d"><code>quit <span class="roman">[</span><var>expression</var> <span class="roman">[</span><var>subshell-levels</var><span class="roman">]</span><span class="roman">]</span></code></a></td><td valign="top"><a href="#Quit">4.3 Quitting the BASH debugger (‘<samp>quit</samp>’, ‘<samp>kill</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-R-_0028restart_0029"><code>R <span class="roman">(<code>restart</code>)</span></code></a></td><td valign="top"><a href="#Starting">3.1 Starting your script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-restart-_005bargs_005d"><code>restart <span class="roman">[</span><var>args</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#Starting">3.1 Starting your script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-RET-_0028repeat-last-command_0029"><code>RET <span class="roman">(repeat last command)</span></code></a></td><td valign="top"><a href="#Command-Syntax">4.1 Command syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-return"><code>return</code></a></td><td valign="top"><a href="#Returning">4.4.2.7 Returning from a function, sourced file, or subshell (‘<samp>return</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reverse_002dsearch"><code>reverse-search</code></a></td><td valign="top"><a href="#Search">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-run-_0028restart_0029"><code>run <span class="roman">(<code>restart</code>)</span></code></a></td><td valign="top"><a href="#Starting">3.1 Starting your script</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-s-_0028step_0029"><code>s <span class="roman">(<code>step</code>)</span></code></a></td><td valign="top"><a href="#Step">4.4.2.1 Step (‘<samp>step</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-search"><code>search</code></a></td><td valign="top"><a href="#Search">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-annotate"><code>set annotate</code></a></td><td valign="top"><a href="#Annotate">4.14.2 Annotation Level (‘<samp>set annotate</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-args"><code>set args</code></a></td><td valign="top"><a href="#Arguments">3.3 Your script’s arguments</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-autoeval-_005b-on-_007c-1-_007c-off-_007c-0-_005d"><code>set autoeval <span class="roman">[</span> on | 1 | off | 0 <span class="roman">]</span></code></a></td><td valign="top"><a href="#Autoeval">4.14.3 Set/Show auto-eval (‘<samp>set autoeval</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-basename"><code>set basename</code></a></td><td valign="top"><a href="#Basename">4.14.4 File basename (‘<samp>set basename</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-debugger"><code>set debugger</code></a></td><td valign="top"><a href="#Debugger">4.14.5 Allow Debugging the debugger (‘<samp>set debugger</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-editing"><code>set editing</code></a></td><td valign="top"><a href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-history-save"><code>set history save</code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-history-size"><code>set history size</code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-linetrace"><code>set linetrace</code></a></td><td valign="top"><a href="#Line-Tracing">4.14.7 Show position information as statements are executed (‘<samp>set linetrace</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-listsize"><code>set listsize</code></a></td><td valign="top"><a href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-logging"><code>set logging</code></a></td><td valign="top"><a href="#Logging">4.14.8 Logging output (‘<samp>set logging</samp>’, ‘<samp>set logging file</samp>’...)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-prompt"><code>set prompt</code></a></td><td valign="top"><a href="#Prompt">4.14.9 Prompt (‘<samp>set prompt</samp>’, ‘<samp>show prompt</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-showcommand"><code>set showcommand</code></a></td><td valign="top"><a href="#Command-Display">4.14.12 Command Display (‘<samp>set showcommand</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set-trace_002dcommands"><code>set trace-commands</code></a></td><td valign="top"><a href="#Command_002dTracing">4.14.11 Debugger Commands Tracing (‘<samp>set trace-commands</samp>’, ‘<samp>show trace-commands</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-shell"><code>shell</code></a></td><td valign="top"><a href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-args"><code>show args</code></a></td><td valign="top"><a href="#Arguments">3.3 Your script’s arguments</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-autoeval"><code>show autoeval</code></a></td><td valign="top"><a href="#Autoeval">4.14.3 Set/Show auto-eval (‘<samp>set autoeval</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-copying"><code>show copying</code></a></td><td valign="top"><a href="#Show">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-editing"><code>show editing</code></a></td><td valign="top"><a href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-history"><code>show history</code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-listsize"><code>show listsize</code></a></td><td valign="top"><a href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-prompt"><code>show prompt</code></a></td><td valign="top"><a href="#Prompt">4.14.9 Prompt (‘<samp>set prompt</samp>’, ‘<samp>show prompt</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-version"><code>show version</code></a></td><td valign="top"><a href="#Show">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-show-warranty"><code>show warranty</code></a></td><td valign="top"><a href="#Show">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-shows"><code>shows</code></a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-signal"><code>signal</code></a></td><td valign="top"><a href="#signal">4.4.3.2 Sending your program a signal (‘<samp>signal</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-silent"><code>silent</code></a></td><td valign="top"><a href="#Break-Commands">4.4.1.3 Breakpoint command lists (‘<samp>commands</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-skip"><code>skip</code></a></td><td valign="top"><a href="#Skip">4.4.2.4 Skip (‘<samp>skip</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-source"><code>source</code></a></td><td valign="top"><a href="#Command-Files">3.2 Command files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-step"><code>step</code></a></td><td valign="top"><a href="#Step">4.4.2.1 Step (‘<samp>step</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-tbreak"><code>tbreak</code></a></td><td valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty"><code>tty</code></a></td><td valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-unalias-name-command"><code>unalias <var>name</var> <var>command</var></code></a></td><td valign="top"><a href="#Alias">4.14.1 Debugger Command Aliases (‘<samp>alias</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-undisplay-dnums_2026"><code>undisplay <var>dnums</var>…</code></a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-up-_005bn_005d"><code>up <span class="roman">[</span><var>n</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-V-_0028info-variables_0029"><code>V <span class="roman">(<code>info variables</code>)</span></code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-watch"><code>watch</code></a></td><td valign="top"><a href="#Set-Watchpoints">4.4.1.2 Setting watchpoints (‘<samp>watch</samp>’, ‘<samp>watche</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-where"><code>where</code></a></td><td valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Command-Index-1_ky_letter-X">X</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-x-_0028examine_0029"><code>x <span class="roman">(<code>examine</code>)</span></code></a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: </th><td><a href="#Command-Index-1_ky_symbol-1" class="summary-letter"><b>!</b></a>
<a href="#Command-Index-1_ky_symbol-2" class="summary-letter"><b>#</b></a>
<br>
<a href="#Command-Index-1_ky_letter-A" class="summary-letter"><b>A</b></a>
<a href="#Command-Index-1_ky_letter-B" class="summary-letter"><b>B</b></a>
<a href="#Command-Index-1_ky_letter-C" class="summary-letter"><b>C</b></a>
<a href="#Command-Index-1_ky_letter-D" class="summary-letter"><b>D</b></a>
<a href="#Command-Index-1_ky_letter-E" class="summary-letter"><b>E</b></a>
<a href="#Command-Index-1_ky_letter-F" class="summary-letter"><b>F</b></a>
<a href="#Command-Index-1_ky_letter-H" class="summary-letter"><b>H</b></a>
<a href="#Command-Index-1_ky_letter-I" class="summary-letter"><b>I</b></a>
<a href="#Command-Index-1_ky_letter-K" class="summary-letter"><b>K</b></a>
<a href="#Command-Index-1_ky_letter-L" class="summary-letter"><b>L</b></a>
<a href="#Command-Index-1_ky_letter-N" class="summary-letter"><b>N</b></a>
<a href="#Command-Index-1_ky_letter-P" class="summary-letter"><b>P</b></a>
<a href="#Command-Index-1_ky_letter-Q" class="summary-letter"><b>Q</b></a>
<a href="#Command-Index-1_ky_letter-R" class="summary-letter"><b>R</b></a>
<a href="#Command-Index-1_ky_letter-S" class="summary-letter"><b>S</b></a>
<a href="#Command-Index-1_ky_letter-T" class="summary-letter"><b>T</b></a>
<a href="#Command-Index-1_ky_letter-U" class="summary-letter"><b>U</b></a>
<a href="#Command-Index-1_ky_letter-V" class="summary-letter"><b>V</b></a>
<a href="#Command-Index-1_ky_letter-W" class="summary-letter"><b>W</b></a>
<a href="#Command-Index-1_ky_letter-X" class="summary-letter"><b>X</b></a>
</td></tr></table>
<hr size="6">
<a name="Variable-Index"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-Index" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#General-Index" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Command-Index" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#General-Index" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Variable-Index-1"></a>
<h1 class="unnumbered">Variable Index</h1>
<hr size="6">
<a name="General-Index"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Variable-Index" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[ > ]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Variable-Index" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[ >> ]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="General-Index-1"></a>
<h1 class="unnumbered">General Index</h1>
<table><tr><th valign="top">Jump to: </th><td><a href="#General-Index-1_cp_symbol-1" class="summary-letter"><b>$</b></a>
<a href="#General-Index-1_cp_symbol-2" class="summary-letter"><b>-</b></a>
<a href="#General-Index-1_cp_symbol-3" class="summary-letter"><b>.</b></a>
<br>
<a href="#General-Index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
<a href="#General-Index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
<a href="#General-Index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
<a href="#General-Index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
<a href="#General-Index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
<a href="#General-Index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
<a href="#General-Index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
<a href="#General-Index-1_cp_letter-H" class="summary-letter"><b>H</b></a>
<a href="#General-Index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
<a href="#General-Index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
<a href="#General-Index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
<a href="#General-Index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
<a href="#General-Index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
<a href="#General-Index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
<a href="#General-Index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
<a href="#General-Index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
<a href="#General-Index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
<a href="#General-Index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
</td></tr></table>
<table border="0" class="index-cp">
<tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_symbol-1">$</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0024PS4"><code>$PS4</code></a></td><td valign="top"><a href="#Interactive-Line-Tracing-Session">1.2 Interactive Line Tracing Session</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0024_005f-and-info-breakpoints"><code>$_</code> and <code>info breakpoints</code></a></td><td valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_symbol-2">-</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dannotate"><code>--annotate</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dbasename"><code>--basename</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dcommand"><code>--command</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002deval_002dcommand-cmdfile"><code>--eval-command</code> <var>cmdfile</var></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dhelp"><code>--help</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dlibrary"><code>--library</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dno_002dinit"><code>--no-init</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dnx"><code>--nx</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dquiet"><code>--quiet</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dtempdir"><code>--tempdir</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dterminal"><code>--terminal</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dtty"><code>--tty</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dA"><code>-A</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dB"><code>-B</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dc"><code>-c</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dh"><code>-h</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dL"><code>-L</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dn"><code>-n</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dq"><code>-q</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dT"><code>-T</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dt"><code>-t</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dV"><code>-V</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dx"><code>-x</code></a></td><td valign="top"><a href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_symbol-3">.</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ebashdbinit">‘<tt>.bashdbinit</tt>’</a></td><td valign="top"><a href="#Command-Files">3.2 Command files</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-arguments-_0028to-your-script_0029">arguments (to your script)</a></td><td valign="top"><a href="#Arguments">3.3 Your script’s arguments</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-automatic-display">automatic display</a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-backtraces">backtraces</a></td><td valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-BASH-debugger-bugs_002c-reporting">BASH debugger bugs, reporting</a></td><td valign="top"><a href="#Bug-Reporting">6.2 How to report bugs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bashdb_002eini">‘<tt>bashdb.ini</tt>’</a></td><td valign="top"><a href="#Command-Files">3.2 Command files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-breakpoint-conditions">breakpoint conditions</a></td><td valign="top"><a href="#Conditions">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-breakpoint-numbers">breakpoint numbers</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-breakpoint-on-variable-modification">breakpoint on variable modification</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-breakpoints">breakpoints</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bug-criteria">bug criteria</a></td><td valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bug-reports">bug reports</a></td><td valign="top"><a href="#Bug-Reporting">6.2 How to report bugs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bugs">bugs</a></td><td valign="top"><a href="#BASH-Debugger-Bugs">6. Reporting Bugs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-call-stack">call stack</a></td><td valign="top"><a href="#Stack">4.6 Examining the Stack Frame (‘<samp>where</samp>’, ‘<samp>frame</samp>’, ‘<samp>up</samp>’, ‘<samp>down</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-change-working-directory">change working directory</a></td><td valign="top"><a href="#Interfacing-to-the-OS">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clearing-breakpoints_002c-watchpoints">clearing breakpoints, watchpoints</a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command-files">command files</a></td><td valign="top"><a href="#Command-Files">3.2 Command files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command-line-editing">command line editing</a></td><td valign="top"><a href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command-scripts_002c-debugging">command scripts, debugging</a></td><td valign="top"><a href="#Command_002dTracing">4.14.11 Debugger Commands Tracing (‘<samp>set trace-commands</samp>’, ‘<samp>show trace-commands</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-comment">comment</a></td><td valign="top"><a href="#Command-Syntax">4.1 Command syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conditional-breakpoints">conditional breakpoints</a></td><td valign="top"><a href="#Conditions">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continuing">continuing</a></td><td valign="top"><a href="#Resuming-Execution">4.4.2 Resuming Execution (‘<samp>step</samp>’, ‘<samp>next</samp>’, ‘<samp>finish</samp>’, ‘<samp>skip</samp>’, ‘<samp>continue</samp>’, ‘<samp>debug</samp>’, ‘<samp>return</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-controlling-terminal">controlling terminal</a></td><td valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-crash-of-debugger">crash of debugger</a></td><td valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current-stack-frame">current stack frame</a></td><td valign="top"><a href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-DDD">DDD</a></td><td valign="top"><a href="#DDD">5.2 Using the <acronym>BASH</acronym> debugger from <acronym>DDD</acronym></a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debugger-crash">debugger crash</a></td><td valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-delete-breakpoints">delete breakpoints</a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deleting-breakpoints_002c-watchpoints">deleting breakpoints, watchpoints</a></td><td valign="top"><a href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display-of-expressions">display of expressions</a></td><td valign="top"><a href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-editing">editing</a></td><td valign="top"><a href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Emacs">Emacs</a></td><td valign="top"><a href="#Emacs">5.1 Using the <acronym>BASH</acronym> debugger from <small>GNU</small> Emacs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-on-valid-input">error on valid input</a></td><td valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-examining-data">examining data</a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-fatal-signal">fatal signal</a></td><td valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fatal-signals">fatal signals</a></td><td valign="top"><a href="#Signals">4.4.3 Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’, ‘<samp>signal</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frame-number">frame number</a></td><td valign="top"><a href="#Frames">4.6.1 Stack frames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frame_002c-definition">frame, definition</a></td><td valign="top"><a href="#Frames">4.6.1 Stack frames</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-GNU-Emacs"><small>GNU</small> Emacs</a></td><td valign="top"><a href="#Emacs">5.1 Using the <acronym>BASH</acronym> debugger from <small>GNU</small> Emacs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-handling-signals">handling signals</a></td><td valign="top"><a href="#Signals">4.4.3 Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’, ‘<samp>signal</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-history-save">history save</a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-history-size">history size</a></td><td valign="top"><a href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-I_002fO">I/O</a></td><td valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-init-file">init file</a></td><td valign="top"><a href="#Command-Files">3.2 Command files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-init-file-name">init file name</a></td><td valign="top"><a href="#Command-Files">3.2 Command files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-initial-frame">initial frame</a></td><td valign="top"><a href="#Frames">4.6.1 Stack frames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-innermost-frame">innermost frame</a></td><td valign="top"><a href="#Frames">4.6.1 Stack frames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interrupt">interrupt</a></td><td valign="top"><a href="#Quitting-the-BASH-debugger">2.2 Quitting the BASH debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-invalid-input">invalid input</a></td><td valign="top"><a href="#Bug-Criteria">6.1 Have you found a bug?</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-latest-breakpoint">latest breakpoint</a></td><td valign="top"><a href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-linespec">linespec</a></td><td valign="top"><a href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-numbers-for-breakpoints">numbers for breakpoints</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-numbers-for-watchpoints">numbers for watchpoints</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-one_002dtime-breakpoints">one-time breakpoints</a></td><td valign="top"><a href="#Conditions">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-online-documentation">online documentation</a></td><td valign="top"><a href="#Help">4.2 Getting help (‘<samp>help</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-outermost-frame">outermost frame</a></td><td valign="top"><a href="#Frames">4.6.1 Stack frames</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-print-working-directory">print working directory</a></td><td valign="top"><a href="#Interfacing-to-the-OS">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-printing-data">printing data</a></td><td valign="top"><a href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-prompt">prompt</a></td><td valign="top"><a href="#Prompt">4.14.9 Prompt (‘<samp>set prompt</samp>’, ‘<samp>show prompt</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-readline">readline</a></td><td valign="top"><a href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-redirection">redirection</a></td><td valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-repeating-next_002fstep-commands">repeating next/step commands</a></td><td valign="top"><a href="#Command-Syntax">4.1 Command syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reporting-bugs">reporting bugs</a></td><td valign="top"><a href="#BASH-Debugger-Bugs">6. Reporting Bugs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-resuming-execution">resuming execution</a></td><td valign="top"><a href="#Resuming-Execution">4.4.2 Resuming Execution (‘<samp>step</samp>’, ‘<samp>next</samp>’, ‘<samp>finish</samp>’, ‘<samp>skip</samp>’, ‘<samp>continue</samp>’, ‘<samp>debug</samp>’, ‘<samp>return</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-returning-from-a-function_002c-sourced-file-or-subshell">returning from a function, sourced file or subshell</a></td><td valign="top"><a href="#Returning">4.4.2.7 Returning from a function, sourced file, or subshell (‘<samp>return</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-running">running</a></td><td valign="top"><a href="#Starting">3.1 Starting your script</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-searching">searching</a></td><td valign="top"><a href="#Search">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-selected-frame">selected frame</a></td><td valign="top"><a href="#Stack">4.6 Examining the Stack Frame (‘<samp>where</samp>’, ‘<samp>frame</samp>’, ‘<samp>up</samp>’, ‘<samp>down</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setting-watchpoints">setting watchpoints</a></td><td valign="top"><a href="#Set-Watchpoints">4.4.1.2 Setting watchpoints (‘<samp>watch</samp>’, ‘<samp>watche</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-shell-escape">shell escape</a></td><td valign="top"><a href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-signals">signals</a></td><td valign="top"><a href="#Signals">4.4.3 Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’, ‘<samp>signal</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stack-frame">stack frame</a></td><td valign="top"><a href="#Frames">4.6.1 Stack frames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stack-traces">stack traces</a></td><td valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-starting">starting</a></td><td valign="top"><a href="#Starting">3.1 Starting your script</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stepping">stepping</a></td><td valign="top"><a href="#Resuming-Execution">4.4.2 Resuming Execution (‘<samp>step</samp>’, ‘<samp>next</samp>’, ‘<samp>finish</samp>’, ‘<samp>skip</samp>’, ‘<samp>continue</samp>’, ‘<samp>debug</samp>’, ‘<samp>return</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-terminal">terminal</a></td><td valign="top"><a href="#Input_002fOutput">3.4 Your script’s input and output</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tracebacks">tracebacks</a></td><td valign="top"><a href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tracing-debugger-commands">tracing debugger commands</a></td><td valign="top"><a href="#Command_002dTracing">4.14.11 Debugger Commands Tracing (‘<samp>set trace-commands</samp>’, ‘<samp>show trace-commands</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-version-number">version number</a></td><td valign="top"><a href="#Show">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-Index-1_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-watchpoints">watchpoints</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-watchpoints-numbers">watchpoints numbers</a></td><td valign="top"><a href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: </th><td><a href="#General-Index-1_cp_symbol-1" class="summary-letter"><b>$</b></a>
<a href="#General-Index-1_cp_symbol-2" class="summary-letter"><b>-</b></a>
<a href="#General-Index-1_cp_symbol-3" class="summary-letter"><b>.</b></a>
<br>
<a href="#General-Index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
<a href="#General-Index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
<a href="#General-Index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
<a href="#General-Index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
<a href="#General-Index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
<a href="#General-Index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
<a href="#General-Index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
<a href="#General-Index-1_cp_letter-H" class="summary-letter"><b>H</b></a>
<a href="#General-Index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
<a href="#General-Index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
<a href="#General-Index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
<a href="#General-Index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
<a href="#General-Index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
<a href="#General-Index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
<a href="#General-Index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
<a href="#General-Index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
<a href="#General-Index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
<a href="#General-Index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
</td></tr></table>
<hr size="6">
<a name="SEC_Foot"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>Footnotes</h1>
<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
<p>Recall that
variables in <acronym>BASH</acronym> don’t need to be declared before they are
referred to and that the default value would be the a null value which
here prints as an empty string.
</p><h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p>And in the interest of full disclosure, although
this was not shown in the example it is possible to add the <code>--</code>
<em>after</em> the script name to be debugged but before the first
program option with a dash.
</p><h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
<p>The DJGPP
port of the <acronym>BASH</acronym> debugger uses the name ‘<tt>bashdb.ini</tt>’ instead, due to the
limitations of file names imposed by DOS filesystems.
</p><h3><a name="FOOT4" href="#DOCF4">(4)</a></h3>
<p>On
DOS/Windows systems, the home directory is the one pointed to by the
<code>HOME</code> environment variable.
</p><hr size="1">
<a name="SEC_Contents"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>Table of Contents</h1>
<div class="contents">
<ul class="toc">
<li><a name="toc-Summary-of-the-BASH-Debugger" href="#Summary">1. Summary of the BASH Debugger</a>
<ul class="toc">
<li><a name="toc-A-Sample-BASH-Debugger-Session" href="#Sample-Session">1.1 A Sample BASH Debugger Session</a></li>
<li><a name="toc-Interactive-Line-Tracing-Session-1" href="#Interactive-Line-Tracing-Session">1.2 Interactive Line Tracing Session</a></li>
</ul></li>
<li><a name="toc-Getting-in-and-out" href="#Invocation">2. Getting in and out</a>
<ul class="toc">
<li><a name="toc-Starting-the-BASH-debugger-1" href="#Starting-the-BASH-debugger">2.1 Starting the BASH debugger</a>
<ul class="toc">
<li><a name="toc-Command_002dline-options-for-bashdb-script" href="#Options-for-the-bashdb-script">2.1.1 Command-line options for <code>bashdb</code> script</a></li>
</ul></li>
<li><a name="toc-Quitting-the-BASH-debugger-1" href="#Quitting-the-BASH-debugger">2.2 Quitting the BASH debugger</a></li>
<li><a name="toc-Calling-the-BASH-debugger-from-inside-your-program" href="#Calling-from-Program">2.3 Calling the BASH debugger from inside your program</a>
<ul class="toc">
<li><a name="toc-Debugging-a-Running-Shell-Script" href="#Debugging-a-Running-Shell-Script">2.3.1 Debugging a Running Shell Script</a>
<ul class="toc">
<li><a name="toc-Explicit-Debugging-Calls_002e" href="#Explicit-Debugging-Calls_002e">2.3.1.1 Explicit Debugging Calls.</a></li>
</ul></li>
<li><a name="toc-Program_002dControlled-Line-Tracing-1" href="#Program_002dControlled-Line-Tracing">2.3.2 Program-Controlled Line Tracing</a></li>
</ul>
</li>
</ul></li>
<li><a name="toc-Script-Setup-inside-the-BASH-Debugger" href="#Running">3. Script Setup inside the BASH Debugger</a>
<ul class="toc">
<li><a name="toc-Starting-your-script" href="#Starting">3.1 Starting your script</a></li>
<li><a name="toc-Command-files" href="#Command-Files">3.2 Command files</a></li>
<li><a name="toc-Your-script_0027s-arguments" href="#Arguments">3.3 Your script’s arguments</a></li>
<li><a name="toc-Your-script_0027s-input-and-output" href="#Input_002fOutput">3.4 Your script’s input and output</a></li>
<li><a name="toc-Script_002fDebugger-Interaction-1" href="#Script_002fDebugger-Interaction">3.5 Script/Debugger Interaction</a></li>
</ul></li>
<li><a name="toc-BASH-Debugger-Command-Reference" href="#Debugger-Command-Reference">4. BASH Debugger Command Reference</a>
<ul class="toc">
<li><a name="toc-Command-syntax" href="#Command-Syntax">4.1 Command syntax</a></li>
<li><a name="toc-Getting-help-_0028help_0029" href="#Help">4.2 Getting help (‘<samp>help</samp>’)</a></li>
<li><a name="toc-Quitting-the-BASH-debugger-_0028quit_002c-kill_0029" href="#Quit">4.3 Quitting the BASH debugger (‘<samp>quit</samp>’, ‘<samp>kill</samp>’)</a></li>
<li><a name="toc-Stopping-and-Resuming-Execution" href="#Stopping">4.4 Stopping and Resuming Execution</a>
<ul class="toc">
<li><a name="toc-Breakpoints_002c-watchpoints-_0028break_002c-tbreak_002c-watch_002c-watche_002e_002e_002e_0029" href="#Breakpoints">4.4.1 Breakpoints, watchpoints (‘<samp>break</samp>’, ‘<samp>tbreak</samp>’, ‘<samp>watch</samp>’, ‘<samp>watche</samp>’...)</a>
<ul class="toc">
<li><a name="toc-Setting-breakpoints-_0028break-tbreak_0029" href="#Set-Breaks">4.4.1.1 Setting breakpoints (‘<samp>break</samp>’ ‘<samp>tbreak</samp>’)</a></li>
<li><a name="toc-Setting-watchpoints-_0028watch_002c-watche_0029" href="#Set-Watchpoints">4.4.1.2 Setting watchpoints (‘<samp>watch</samp>’, ‘<samp>watche</samp>’)</a></li>
<li><a name="toc-Breakpoint-command-lists-_0028commands_0029" href="#Break-Commands">4.4.1.3 Breakpoint command lists (‘<samp>commands</samp>’)</a></li>
<li><a name="toc-Deleting-breakpoints-_0028clear_002c-delete_0029" href="#Delete-Breaks">4.4.1.4 Deleting breakpoints (‘<samp>clear</samp>’, ‘<samp>delete</samp>’)</a></li>
<li><a name="toc-Disabling-breakpoints-_0028disable_002c-enable_0029" href="#Disabling">4.4.1.5 Disabling breakpoints (‘<samp>disable</samp>’, ‘<samp>enable</samp>’)</a></li>
<li><a name="toc-Break-conditions-_0028condition_0029" href="#Conditions">4.4.1.6 Break conditions (‘<samp>condition</samp>’)</a></li>
</ul></li>
<li><a name="toc-Resuming-Execution-_0028step_002c-next_002c-finish_002c-skip_002c-continue_002c-debug_002c-return_0029" href="#Resuming-Execution">4.4.2 Resuming Execution (‘<samp>step</samp>’, ‘<samp>next</samp>’, ‘<samp>finish</samp>’, ‘<samp>skip</samp>’, ‘<samp>continue</samp>’, ‘<samp>debug</samp>’, ‘<samp>return</samp>’)</a>
<ul class="toc">
<li><a name="toc-Step-_0028step_0029" href="#Step">4.4.2.1 Step (‘<samp>step</samp>’)</a></li>
<li><a name="toc-Next-_0028next_0029" href="#Next">4.4.2.2 Next (‘<samp>next</samp>’)</a></li>
<li><a name="toc-Finish-_0028finish_0029" href="#Finish">4.4.2.3 Finish (‘<samp>finish</samp>’)</a></li>
<li><a name="toc-Skip-_0028skip_0029" href="#Skip">4.4.2.4 Skip (‘<samp>skip</samp>’)</a></li>
<li><a name="toc-Continue-_0028continue_0029" href="#Continue">4.4.2.5 Continue (‘<samp>continue</samp>’)</a></li>
<li><a name="toc-Debug-_0028debug_0029" href="#Debug">4.4.2.6 Debug (‘<samp>debug</samp>’)</a></li>
<li><a name="toc-Returning-from-a-function_002c-sourced-file_002c-or-subshell-_0028return_0029" href="#Returning">4.4.2.7 Returning from a function, sourced file, or subshell (‘<samp>return</samp>’)</a></li>
</ul></li>
<li><a name="toc-Signals-_0028handle_002c-info-handle_002c-signal_0029" href="#Signals">4.4.3 Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’, ‘<samp>signal</samp>’)</a>
<ul class="toc">
<li><a name="toc-Intercepting-Signals-_0028handle_002c-info-handle_0029" href="#handle">4.4.3.1 Intercepting Signals (‘<samp>handle</samp>’, ‘<samp>info handle</samp>’)</a></li>
<li><a name="toc-Sending-your-program-a-signal-_0028signal_0029" href="#signal">4.4.3.2 Sending your program a signal (‘<samp>signal</samp>’)</a></li>
</ul>
</li>
</ul></li>
<li><a name="toc-Status-and-Debugger-Settings-_0028info_002c-show_0029" href="#Program-Information">4.5 Status and Debugger Settings (‘<samp>info</samp>’, ‘<samp>show</samp>’)</a>
<ul class="toc">
<li><a name="toc-Showing-information-about-the-program-being-debugged-_0028info_0029" href="#Info">4.5.1 Showing information about the program being debugged (‘<samp>info</samp>’)</a></li>
<li><a name="toc-Show-information-about-the-debugger-_0028show_0029" href="#Show">4.5.2 Show information about the debugger (‘<samp>show</samp>’)</a></li>
</ul></li>
<li><a name="toc-Examining-the-Stack-Frame-_0028where_002c-frame_002c-up_002c-down_0029" href="#Stack">4.6 Examining the Stack Frame (‘<samp>where</samp>’, ‘<samp>frame</samp>’, ‘<samp>up</samp>’, ‘<samp>down</samp>’)</a>
<ul class="toc">
<li><a name="toc-Stack-frames" href="#Frames">4.6.1 Stack frames</a></li>
<li><a name="toc-Backtraces-_0028where_0029" href="#Backtrace">4.6.2 Backtraces (‘<samp>where</samp>’)</a></li>
<li><a name="toc-Selecting-a-frame-_0028up_002c-down_002c-frame_0029" href="#Selection">4.6.3 Selecting a frame (‘<samp>up</samp>’, ‘<samp>down</samp>’, ‘<samp>frame</samp>’)</a></li>
</ul></li>
<li><a name="toc-Examining-Source-Files-_0028list_0029" href="#List">4.7 Examining Source Files (‘<samp>list</samp>’)</a></li>
<li><a name="toc-Editing-Source-files-_0028edit_0029" href="#Edit">4.8 Editing Source files (‘<samp>edit</samp>’)</a></li>
<li><a name="toc-Searching-source-files-_0028search_002c-reverse_002c-_002f_002e_002e_002e_002f_002c-_003f_002e_002e_003f_0029" href="#Search">4.9 Searching source files (‘<samp>search</samp>’, ‘<samp>reverse</samp>’, ‘<samp>/.../</samp>’, ‘<samp>?..?</samp>’)</a></li>
<li><a name="toc-Examining-Data-_0028print_002c-examine_002c-info-variables_0029" href="#Data">4.10 Examining Data (‘<samp>print</samp>’, ‘<samp>examine</samp>’, ‘<samp>info variables</samp>’)</a></li>
<li><a name="toc-Running-Arbitrary-BASH-and-Shell-commands-_0028eval_002c-shell_0029" href="#Evaluation_002fExecution">4.11 Running Arbitrary BASH and Shell commands (‘<samp>eval</samp>’, ‘<samp>shell</samp>’)</a></li>
<li><a name="toc-Interfacing-to-the-OS-_0028cd_002c-pwd_0029" href="#Interfacing-to-the-OS">4.12 Interfacing to the OS (‘<samp>cd</samp>’, ‘<samp>pwd</samp>’)</a></li>
<li><a name="toc-Automatic-display-_0028display_002c-undisplay_0029" href="#Auto-Display">4.13 Automatic display (‘<samp>display</samp>’, ‘<samp>undisplay</samp>’)</a></li>
<li><a name="toc-Controlling-bashdb-_0028set_002c-file_002c-prompt_002c-history_002e_002e_002e_0029" href="#Controlling-bashdb">4.14 Controlling bashdb (‘<samp>set</samp>’, ‘<samp>file</samp>’, ‘<samp>prompt</samp>’, ‘<samp>history</samp>’...)</a>
<ul class="toc">
<li><a name="toc-Debugger-Command-Aliases-_0028alias_0029" href="#Alias">4.14.1 Debugger Command Aliases (‘<samp>alias</samp>’)</a></li>
<li><a name="toc-Annotation-Level-_0028set-annotate_0029" href="#Annotate">4.14.2 Annotation Level (‘<samp>set annotate</samp>’)</a></li>
<li><a name="toc-Set_002fShow-auto_002deval-_0028set-autoeval_0029" href="#Autoeval">4.14.3 Set/Show auto-eval (‘<samp>set autoeval</samp>’)</a></li>
<li><a name="toc-File-basename-_0028set-basename_0029" href="#Basename">4.14.4 File basename (‘<samp>set basename</samp>’)</a></li>
<li><a name="toc-Allow-Debugging-the-debugger-_0028set-debugger_0029" href="#Debugger">4.14.5 Allow Debugging the debugger (‘<samp>set debugger</samp>’)</a></li>
<li><a name="toc-Specifying-a-Script_002dFile-Association-_0028file_0029" href="#File">4.14.6 Specifying a Script-File Association (‘<samp>file</samp>’)</a></li>
<li><a name="toc-Show-position-information-as-statements-are-executed-_0028set-linetrace_0029" href="#Line-Tracing">4.14.7 Show position information as statements are executed (‘<samp>set linetrace</samp>’)</a></li>
<li><a name="toc-Logging-output-_0028set-logging_002c-set-logging-file_002e_002e_002e_0029" href="#Logging">4.14.8 Logging output (‘<samp>set logging</samp>’, ‘<samp>set logging file</samp>’...)</a></li>
<li><a name="toc-Prompt-_0028set-prompt_002c-show-prompt_0029" href="#Prompt">4.14.9 Prompt (‘<samp>set prompt</samp>’, ‘<samp>show prompt</samp>’)</a></li>
<li><a name="toc-Command-editing-_0028set-editing_002c-show-editing_0029" href="#Editing">4.14.10 Command editing (‘<samp>set editing</samp>’, ‘<samp>show editing</samp>’)</a></li>
<li><a name="toc-Debugger-Commands-Tracing-_0028set-trace_002dcommands_002c-show-trace_002dcommands_0029" href="#Command_002dTracing">4.14.11 Debugger Commands Tracing (‘<samp>set trace-commands</samp>’, ‘<samp>show trace-commands</samp>’)</a></li>
<li><a name="toc-Command-Display-_0028set-showcommand_0029" href="#Command-Display">4.14.12 Command Display (‘<samp>set showcommand</samp>’)</a></li>
<li><a name="toc-Command-history-_0028H_002c-history_002c-_0021_0029" href="#History">4.14.13 Command history (‘<samp>H</samp>’, ‘<samp>history</samp>’, ‘<samp>!</samp>’)</a></li>
<li><a name="toc-Command-Completion-_0028complete_0029" href="#Command-Completion">4.14.14 Command Completion (‘<samp>complete</samp>’)</a></li>
</ul>
</li>
</ul></li>
<li><a name="toc-Using-the-BASH-debugger-from-a-front_002dend-user-interface" href="#Front-Ends">5. Using the <acronym>BASH</acronym> debugger from a front-end user interface</a>
<ul class="toc">
<li><a name="toc-Using-the-BASH-debugger-from-GNU-Emacs" href="#Emacs">5.1 Using the <acronym>BASH</acronym> debugger from <small>GNU</small> Emacs</a>
<ul class="toc">
<li><a name="toc-Commands-from-the-GUD-buffer" href="#GUD">5.1.1 Commands from the GUD buffer</a></li>
<li><a name="toc-Commands-from-the-source-script" href="#Emacs-Source">5.1.2 Commands from the source script</a></li>
<li><a name="toc-the-BASH-debugger-from-a-GNU-Emacs-Shell" href="#Emacs-Shell">5.1.3 the <acronym>BASH</acronym> debugger from a <small>GNU</small> Emacs Shell</a></li>
</ul></li>
<li><a name="toc-Using-the-BASH-debugger-from-DDD" href="#DDD">5.2 Using the <acronym>BASH</acronym> debugger from <acronym>DDD</acronym></a></li>
</ul></li>
<li><a name="toc-Reporting-Bugs" href="#BASH-Debugger-Bugs">6. Reporting Bugs</a>
<ul class="toc">
<li><a name="toc-Have-you-found-a-bug_003f" href="#Bug-Criteria">6.1 Have you found a bug?</a></li>
<li><a name="toc-How-to-report-bugs" href="#Bug-Reporting">6.2 How to report bugs</a></li>
</ul></li>
<li><a name="toc-History-and-Acknowledgments-1" href="#History-and-Acknowledgments">7. History and Acknowledgments</a></li>
<li><a name="toc-GNU-GENERAL-PUBLIC-LICENSE" href="#Copying">A. GNU GENERAL PUBLIC LICENSE</a></li>
<li><a name="toc-GNU-Free-Documentation-License-1" href="#GNU-Free-Documentation-License">B. GNU Free Documentation License</a></li>
<li><a name="toc-Function-Index-1" href="#Function-Index">Function Index</a></li>
<li><a name="toc-Command-Index-1" href="#Command-Index">Command Index</a></li>
<li><a name="toc-Variable-Index-1" href="#Variable-Index">Variable Index</a></li>
<li><a name="toc-General-Index-1" href="#General-Index">General Index</a></li>
</ul>
</div>
<hr size="1">
<a name="SEC_About"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Function-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>About This Document</h1>
<p>
This document was generated by <em>OM</em> on <em>January 9, 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</p>
<p>
The buttons in the navigation panels have the following meaning:
</p>
<table border="1">
<tr>
<th> Button </th>
<th> Name </th>
<th> Go to </th>
<th> From 1.2.3 go to</th>
</tr>
<tr>
<td align="center"> [ < ] </td>
<td align="center">Back</td>
<td>Previous section in reading order</td>
<td>1.2.2</td>
</tr>
<tr>
<td align="center"> [ > ] </td>
<td align="center">Forward</td>
<td>Next section in reading order</td>
<td>1.2.4</td>
</tr>
<tr>
<td align="center"> [ << ] </td>
<td align="center">FastBack</td>
<td>Beginning of this chapter or previous chapter</td>
<td>1</td>
</tr>
<tr>
<td align="center"> [ Up ] </td>
<td align="center">Up</td>
<td>Up section</td>
<td>1.2</td>
</tr>
<tr>
<td align="center"> [ >> ] </td>
<td align="center">FastForward</td>
<td>Next chapter</td>
<td>2</td>
</tr>
<tr>
<td align="center"> [Top] </td>
<td align="center">Top</td>
<td>Cover (top) of document</td>
<td> </td>
</tr>
<tr>
<td align="center"> [Contents] </td>
<td align="center">Contents</td>
<td>Table of contents</td>
<td> </td>
</tr>
<tr>
<td align="center"> [Index] </td>
<td align="center">Index</td>
<td>Index</td>
<td> </td>
</tr>
<tr>
<td align="center"> [ ? ] </td>
<td align="center">About</td>
<td>About (help)</td>
<td> </td>
</tr>
</table>
<p>
where the <strong> Example </strong> assumes that the current position is at <strong> Subsubsection One-Two-Three </strong> of a document of the following structure:
</p>
<ul>
<li> 1. Section One
<ul>
<li>1.1 Subsection One-One
<ul>
<li>...</li>
</ul>
</li>
<li>1.2 Subsection One-Two
<ul>
<li>1.2.1 Subsubsection One-Two-One</li>
<li>1.2.2 Subsubsection One-Two-Two</li>
<li>1.2.3 Subsubsection One-Two-Three
<strong><== Current Position </strong></li>
<li>1.2.4 Subsubsection One-Two-Four</li>
</ul>
</li>
<li>1.3 Subsection One-Three
<ul>
<li>...</li>
</ul>
</li>
<li>1.4 Subsection One-Four</li>
</ul>
</li>
</ul>
<hr size="1">
<p>
<font size="-1">
This document was generated by <em>OM</em> on <em>January 9, 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</p>
</body>
</html>
|