/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/debugging/gdb/flow.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Stopping an application
 
2
-----------------------
 
3
 * BreakPoints
 
4
 * WatchPoints - expression value changes
 
5
 * CatchPoints - C++ try/catch/
 
6
 * Signals - Stop/Print/Pass
 
7
 
 
8
 Stepping
 
9
 ========
 
10
    cont(c) [count]             - Continue execution (count specifies number of
 
11
                                times (+1 - current) to skip breakpoint on
 
12
                                curent position
 
13
 
 
14
    jump <linespec|*addr>       - Continue execution in the specified place
 
15
    return [expr]               - cancels execution of current function, 
 
16
                                returning specified expression.
 
17
 
 
18
    next(n) [count]             - step over
 
19
    step(s) [count]             - step into ('count' times)
 
20
    set step-mode on/off        - 'off' (default) steps over a functions 
 
21
                                containing no debug information
 
22
 
 
23
    stepi(si) [count]           - executes one machine instruction
 
24
    nexti(ni) [count]           - steps over function calls
 
25
 
 
26
 
 
27
    finish              - continue until current function returns, outputs 
 
28
                        return  ralue.
 
29
    advance [loc]       - Continue running the program up to the given location
 
30
                        or 'finish' ('loc' in break format)
 
31
    until [loc]         - continue running until specified location (next line
 
32
                        if omited) or 'finish' (used to avoid single stepping
 
33
                        a loop more than once).
 
34
 
 
35
   * For breaking executing application from keyboard, see signals.
 
36
 
 
37
 Managing
 
38
 ========
 
39
    info break/watch            - Lists breakpoints/... 
 
40
 
 
41
    clear                       - deletes breakpoints at the next instruction
 
42
    clear  mrandom.c:235
 
43
 
 
44
    delete [breakpoints] <range>
 
45
     - Deletes breakpoints with specified IDs, example:
 
46
        delete (delete all breakpoints), delete 3, delete 1-5   
 
47
 
 
48
    disable [breakpoints] <range>
 
49
    enable [breakpoints] <range>
 
50
    enable [breakpoints] once <range>
 
51
    enable [breakpoints] detele <range>         - works once, then deleted
 
52
 
 
53
 BreakPoints
 
54
 ===========
 
55
    break randomRun             - break on function call
 
56
        + Doesn't work with inline functions
 
57
        + Could be set prior the function is loaded from shared library (plugin)
 
58
        + Breakpoints should be set prior to program enter block
 
59
    break function(types)       - to handle C++ overloaded functions. 
 
60
        + If omited, it is possible to break on whole family.
 
61
    break mrandom.c:235         - break on line number
 
62
    break *address              - the command at specified address is executed
 
63
    break                       - next command
 
64
    break ... if <cond>         - breaks only if 'cond'ition evaluates true
 
65
 
 
66
    tbreak ...          - Temporary. triggers once (then deleted)
 
67
    hbreak ...          - Hardware assisted (EPROM/ROM debugging)
 
68
    thbreak ...         - Temporary Hardware
 
69
    
 
70
    rbreak <regex>      - Set breakpoints on all functions matching regex.
 
71
 
 
72
 WatchPoints
 
73
 ===========
 
74
    watch <expr>        - Breaks when epxression is written into by the program
 
75
                        and its value is changed (see expecting variables).
 
76
        + If program left the block where the expression is valid, watchpoint
 
77
        removed (for example 'local variable' expressions on return statement). 
 
78
    rwatch <expr>       - Breaks when expression is read by program
 
79
    awatch <expr>       - Access = Read-or-Write    
 
80
 
 
81
    - GDB will not trigger if the expression modified from another thread.
 
82
    - GDB uses hardware for read watch points. Depending on architecture there
 
83
    are certain limitations:
 
84
     + Hardware watchpoints are not working due to the GCC Optimizations
 
85
     + Hardware watchpoints are not supported.
 
86
     + On the size of types for which hardware watchpoitns can be set.
 
87
     + On the amount of hardware watchpoints.
 
88
 
 
89
 CatchPoints
 
90
 ===========
 
91
    catch <event>
 
92
        throw   - Throwing of a C++ exception
 
93
        catch   - Catching C++ exception
 
94
    tcatch              - Once
 
95
 
 
96
    - To stop just before an exception handler is called, the knowledge of the 
 
97
    implementation is required. In the case of GNU C++, exceptions are raised 
 
98
    by 'void __raise_exception(void **addr, void *id)'
 
99
        addr    - is where the exception identifier is stored
 
100
        id      - is the exception identifier
 
101
    With a conditional breakpoint that depends on the value of id, it is 
 
102
    possible to stop program when a specific exception is raised.
 
103
 
 
104
 
 
105