/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/remote.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2015-08-21 03:52:00 UTC
  • Revision ID: csa@suren.me-20150821035200-xu1zh22cqlk2omcq
Profiling

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Starting GDB Server
2
 
===================
3
 
 - gdbserver localhost:port --attach <pid>
4
 
    + Imideatly attaches to process and stops execution
5
 
    + Do not need sources, debugging information, it should resist on client
6
 
    side
7
 
    
8
 
Connecting GDB Server
9
 
=====================
10
 
 gdb
11
 
  file <executable name>                - mandatory
12
 
  target remote host:port               - connecting
13
 
  detach                                - disconnecting (terminates server)
14
 
  disconnect                            - disconnecting (keeping server)
15
 
 
16
 
SlickEdit
17
 
=========
18
 
 - shipped "bin/gdb" is 32bit executable and should be replaced by system
19
 
 64bit version (otherwise complains on unreckognized executable format)
20
 
 - Debug/Attach Debugger/Attach to Remote Process
21
 
    + Set appropriate executable        - mandatory!!
22
 
    + In Remote Options set "address size" to 64 bit
23
 
 
24
 
 
25
 
Stubs
26
 
=====
27
 
 The remote stubs allowing to compile gdbserver protocol support into the 
28
 
 existing application. The stubs are specific to architecture, stubs for
29
 
 some architectures are shiped with gdb. Other should be implemented starting
30
 
 from 'sparc-stub.c' as an example.
31
 
 
32
 
 The following stub functions should be called from main program:
33
 
  + set_debug_traps - Should be called in the beginning of the program, in 
34
 
  order to arrange calling of 'handle_exception' function when the program 
35
 
  stops.
36
 
  + breakpoint - artificial breakpoint in application. May be required if there
37
 
  no other ways of making applications stop (on certain architectures this is
38
 
  achieved by sending character to UART which generates interruput, or by 
39
 
  special interrupt button )
40
 
 
41
 
 The following functions should be implemented by application
42
 
    + int getDebugChar()
43
 
    + void putDebugChar(int)
44
 
    + void exceptionHandler (int exception_number, void *exception_address)
45
 
        Installs exception_address in the exception handling tables.
46
 
    + void flush_i_cache() [ On SPARC only ]
47
 
 
48
 
Tracepoints
49
 
===========
50
 
 For real-time applications it is important debugging will not prevent app from
51
 
 meeting deadlines. Using tracepoints it possible to evaluate and store 
52
 
 arbitrary expressions when those tracepoints are reached.
53
 
  - Only supports on remote targets
54
 
  - Not supported on x86/amd64
55
 
  - Even not supported by any of gdb shipped stubs
56
 
 
57
 
  - Commands
58
 
    info tracepoints
59
 
    trace <linespec>
60
 
    delete / enable / disable <#tpnum>
61
 
    passcount 5 <#tpnum>                -  Stop on the every 5th execution
62
 
    actions <#tpnum> ... end
63
 
        - collect <expr1>, <expr2>, ...
64
 
            + $regs [ all registers ]
65
 
            + $args [ all function arguments ]
66
 
            + $locals [ all local variables ]
67
 
        - while-stepping #n ... end
68
 
            Perform n single-step traces after the tracepoint, collecting new 
69
 
            data at each step. The command is followed by the list of what to
70
 
            collect while stepping.
71
 
    tsart / tstop / tstatus             - Starting / Stopping collection
72
 
    tfind                               - Find snapshot
73
 
        start                   - first snapshot
74
 
        no argument             - next snapshot
75
 
        -                       - previous snapshot
76
 
        tracepoint <#tpnum>     - next associated with specified tracenum
77
 
        tfind line [file:]n     - next associated with specified linespec
78
 
        tfind pc <addr>         - next taken on the specified address
79
 
        tfind range <addr1>, <addr2>    - Within range
80
 
        tfind outside <addr1>, <addr2>  - Outside of the range
81
 
        none / end              - stop tracing, resume live debugging
82
 
    tdump                               - Dump found snapshot
83
 
    save-tracepoints filename