Download Debugging with DDD - ftp
Transcript
80 Debugging with DDD As yet another alternative, you can select ‘Source ⇒ Breakpoints’. Click on the ‘Break’ button and enter the location. (If you find this number of alternatives confusing, be aware that ddd users fall into three categories, which must all be supported. Novice users explore ddd and may prefer to use one single mouse button. Advanced users know how to use shortcuts and prefer popup menus. Experienced users prefer the command line interface.) Breakpoints are indicated by a plain stop sign, or as ‘#n’, where n is the breakpoint number. A greyed out stop sign (or ‘_n_’) indicates a disabled breakpoint. A stop sign with a question mark (or ‘?n?’) indicates a conditional breakpoint or a breakpoint with an ignore count set. If you set a breakpoint by mistake, use ‘Edit ⇒ Undo’ to delete it again. 5.1.1.2 Setting Breakpoints by Name If the function name is visible, click with mouse button 1 on the function name. The function name is then copied to the argument field. Click on the ‘Break’ button to set a breakpoint there. As a shorter alternative, you can simply press mouse button 3 on the function name and select the ‘Break at’ item from the popup menu. As yet another alternative, you can click on ‘Break...’ from the Breakpoint editor (invoked through ‘Source ⇒ Breakpoints’) and enter the function name. 5.1.1.3 Setting Regexp Breakpoints Using gdb, you can also set a breakpoint on all functions that match a given string. ‘Break ⇒ Set Breakpoints at Regexp ()’ sets a breakpoint on all functions whose name matches the regular expression given in ‘()’. Here are some examples: • To set a breakpoint on every function that starts with ‘Xm’, set ‘()’ to ‘^Xm’. • To set a breakpoint on every member of class ‘Date’, set ‘()’ to ‘^Date::’. • To set a breakpoint on every function whose name contains ‘_fun’, set ‘()’ to ‘_fun’. • To set a breakpoint on every function that ends in ‘_test’, set ‘()’ to ‘_test$’. 5.1.2 Deleting Breakpoints To delete a visible breakpoint, click with mouse button 1 on the breakpoint. The breakpoint location is copied to the argument field. Click on the ‘Clear’ button to delete all breakpoints there. If the function name is visible, click with mouse button 1 on the function name. The function name is copied to the argument field. Click on the ‘Clear’ button to clear all breakpoints there. As a faster alternative, you can simply press mouse button 3 on the breakpoint and select the ‘Delete Breakpoint’ item from the popup menu. As yet another alternative, you can select the breakpoint and click on ‘Delete’ in the Breakpoint editor (invoked through ‘Source ⇒ Breakpoints’). As an even faster alternative, you can simply double-click on the breakpoint while holding hCtrli.