1 | 1. Add GDB initilization to your target's code: |
---|
2 | |
---|
3 | a) include file: |
---|
4 | |
---|
5 | #include <uart.h> |
---|
6 | |
---|
7 | b) declare this variable: |
---|
8 | |
---|
9 | extern int BSPConsolePort; |
---|
10 | |
---|
11 | c) To start-up GDB, run this: |
---|
12 | |
---|
13 | /* Init GDB glue */ |
---|
14 | |
---|
15 | if(BSPConsolePort != BSP_UART_COM2) |
---|
16 | { |
---|
17 | /* |
---|
18 | * If com2 is not used as console use it for |
---|
19 | * debugging |
---|
20 | */ |
---|
21 | i386_stub_glue_init(BSP_UART_COM2); |
---|
22 | } |
---|
23 | else |
---|
24 | { |
---|
25 | /* Otherwise use com1 */ |
---|
26 | i386_stub_glue_init(BSP_UART_COM1); |
---|
27 | } |
---|
28 | |
---|
29 | /* Init GDB stub itself */ |
---|
30 | set_debug_traps(); |
---|
31 | |
---|
32 | /* |
---|
33 | * Init GDB break in capability, |
---|
34 | * has to be called after |
---|
35 | * set_debug_traps |
---|
36 | */ |
---|
37 | i386_stub_glue_init_breakin(); |
---|
38 | |
---|
39 | /* Put breakpoint in */ |
---|
40 | breakpoint(); |
---|
41 | |
---|
42 | d) This is all you need to do for the target. |
---|
43 | |
---|
44 | 2. Edit cmds: specify path to current directory and device used for debugging |
---|
45 | example of cmds is attached below. Make sure your paths are correct. |
---|
46 | 3. type 'make' |
---|
47 | 4. Boot o-pc386/<test>.exe on target computer, where <test> has the code from step 1. ( I modified and recompiled base_sp as the <test> ) |
---|
48 | 5. run 'i396-rtems-gdb --nx --command=./cmds o-pc386/<test>.coff |
---|
49 | |
---|
50 | =========================== example cmds ============================== |
---|
51 | /usr1/rtems/work/rtems/cpukit/ada |
---|
52 | /usr1/rtems/work/rtems/cpukit/itron/inline/rtems/itron |
---|
53 | /usr1/rtems/work/rtems/cpukit/itron/src |
---|
54 | /usr1/rtems/work/rtems/cpukit/libblock/src |
---|
55 | /usr1/rtems/work/rtems/cpukit/libcsupport/src |
---|
56 | /usr1/rtems/work/rtems/cpukit/libfs/src/dosfs |
---|
57 | /usr1/rtems/work/rtems/cpukit/libfs/src/imfs |
---|
58 | /usr1/rtems/work/rtems/cpukit/libmisc/capture |
---|
59 | /usr1/rtems/work/rtems/cpukit/libmisc/cpuuse |
---|
60 | /usr1/rtems/work/rtems/cpukit/libmisc/devnull |
---|
61 | /usr1/rtems/work/rtems/cpukit/libmisc/dummy |
---|
62 | /usr1/rtems/work/rtems/cpukit/libmisc/dumpbuf |
---|
63 | /usr1/rtems/work/rtems/cpukit/libmisc/monitor |
---|
64 | /usr1/rtems/work/rtems/cpukit/libmisc/mw-fb |
---|
65 | /usr1/rtems/work/rtems/cpukit/libmisc/rtmonuse |
---|
66 | /usr1/rtems/work/rtems/cpukit/libmisc/serdbg |
---|
67 | /usr1/rtems/work/rtems/cpukit/libmisc/shell |
---|
68 | /usr1/rtems/work/rtems/cpukit/libmisc/stackchk |
---|
69 | /usr1/rtems/work/rtems/cpukit/libmisc/untar |
---|
70 | /usr1/rtems/work/rtems/cpukit/libnetworking/arpa |
---|
71 | /usr1/rtems/work/rtems/cpukit/libnetworking/kern |
---|
72 | /usr1/rtems/work/rtems/cpukit/libnetworking/lib |
---|
73 | /usr1/rtems/work/rtems/cpukit/libnetworking/libc |
---|
74 | /usr1/rtems/work/rtems/cpukit/libnetworking/machine |
---|
75 | /usr1/rtems/work/rtems/cpukit/libnetworking/net |
---|
76 | /usr1/rtems/work/rtems/cpukit/libnetworking/netinet |
---|
77 | /usr1/rtems/work/rtems/cpukit/libnetworking/nfs |
---|
78 | /usr1/rtems/work/rtems/cpukit/libnetworking/rtems |
---|
79 | /usr1/rtems/work/rtems/cpukit/libnetworking/sys |
---|
80 | /usr1/rtems/work/rtems/cpukit/libnetworking/vm |
---|
81 | /usr1/rtems/work/rtems/cpukit/librpc/src/rpc |
---|
82 | /usr1/rtems/work/rtems/cpukit/librpc/src/xdr |
---|
83 | /usr1/rtems/work/rtems/cpukit/posix/src |
---|
84 | /usr1/rtems/work/rtems/cpukit/posix/inline/rtems/posix |
---|
85 | /usr1/rtems/work/rtems/cpukit/rtems/inline/rtems/rtems |
---|
86 | /usr1/rtems/work/rtems/cpukit/rtems/src |
---|
87 | /usr1/rtems/work/rtems/cpukit/sapi/inline/rtems |
---|
88 | /usr1/rtems/work/rtems/cpukit/sapi/src |
---|
89 | /usr1/rtems/work/rtems/cpukit/score/cpu/i386 |
---|
90 | /usr1/rtems/work/rtems/cpukit/score/cpu/i386/rtems/score |
---|
91 | /usr1/rtems/work/rtems/cpukit/score/src |
---|
92 | /usr1/rtems/work/rtems/cpukit/score/inline/rtems/score |
---|
93 | set remotebaud 38400 |
---|
94 | target remote /dev/ttyS1 |
---|