-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcf5235-gdbinit-script
58 lines (53 loc) · 1.3 KB
/
mcf5235-gdbinit-script
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
#
# Connect to the target.
#
target remote | m68k-bdm-gdbserver pipe 253-005
#target remote | m68k-bdm-gdbserver pipe /dev/tblcf1
#target remote :7777
#target remote me:7777
#target remote lapdog:7777
#
# The console loop in the Axman dbug monitor. Found by trial and error
# with the debugger.
#
thb *0xffe254c0
#
# Show the exception stack frame.
#
define show-exception-sframe
set $frsr = *(unsigned short *)((unsigned long)$sp + 2)
set $frpc = *(unsigned long *)((unsigned long)$sp + 4)
set $frfvo = *(unsigned short *)((unsigned long)$sp + 0)
set $frcode = $frfvo >> 12
set $frvect = ($frfvo & 0xFFF) >> 2
set $frstatus = ((($frfvo >> 10) & 3) << 2) | ($frfvo & 3)
printf "EXCEPTION -- SR:0x%X PC:0x%X FRAME:0x%x VECTOR:%d STATUS:%d\n", $frsr, $frpc, $frcode, $frvect, $frstatus
if $frstatus == 4
printf " Fault Type: Error on instruction fetch"
end
if $frstatus == 8
printf " Fault Type: Error on operand write"
end
if $frstatus == 12
printf " Fault Type: Error on operand read"
end
if $frstatus == 9
printf " Fault Type: Attempted write to write-protected space"
end
end
#
# Run to initialise the RAM. The target will stop when the
# breakpoint is hit. Load the program.
#
c
load
#
# Break on an exception.
#
b _uhoh
b rtems_fatal_error_occurred
#
# Travel to main then stop.
#
tb main
c