[<<][arm][>>][..]
Wed Jun 22 02:29:57 CEST 2011

$pc not reset after soft_reset_halt

Is this because of GDB?  I.e GDB's cache of the register values gets
out of sync with the machine?  Note that "mon reg" does seem to give
the correct values.

(gdb) mon soft_reset_halt
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x00000000
(gdb) info registers
r0             0x0      0
r1             0x6f     111
r2             0x204714 2115348
r3             0x10000002       268435458
r4             0x2006a8 2098856
r5             0x13     19
r6             0x20388c 2111628
r7             0x1d     29
r8             0x20384c 2111564
r9             0x200750 2099024
r10            0x2006e0 2098912
r11            0x20384c 2111564
r12            0x2008d8 2099416
sp             0x203800 0x203800
lr             0x1143a4 1131428
pc             0x11e4a8 0x11e4a8
fps            0x0      0
cpsr           0x20000013       536870931


It happened again on a stepi.  Indeed it seems to be just that gdb's
idea of the registers gets messed up, so it will set them according to
a previously saved state before stepping.

The following is the OpenOCD debug output when stepping after a
soft_reset_halt.  The PC is supposed to be at 0, but somehow it gets
set at 0x001100f0 which was the state before soft_reset_halt.

The problem does not go away with restarting gdb.  Restarting OpenOCD
however does fix it.


Debug: 56656 3980801 gdb_server.c:2201 gdb_input_inner(): received packet: 's'
Debug: 56657 3980801 target.c:1062 target_call_event_callbacks(): target event 7 (gdb-start)
Debug: 56658 3980801 gdb_server.c:1455 gdb_step_continue_packet(): -
Debug: 56659 3980801 gdb_server.c:1475 gdb_step_continue_packet(): step
Debug: 56660 3980801 arm7_9_common.c:2270 arm7_9_read_memory(): address: 0x00000000, size: 0x00000004, count: 0x00000001
Debug: 56661 3980811 target.c:1605 target_read_u32(): address: 0x00000000, value: 0xe59ff018
Debug: 56662 3980811 arm7_9_common.c:2270 arm7_9_read_memory(): address: 0x00000020, size: 0x00000004, count: 0x00000001
Debug: 56663 3980822 target.c:1605 target_read_u32(): address: 0x00000020, value: 0x001100f0
Debug: 56664 3980822 arm7_9_common.c:1615 arm7_9_restore_context(): -
Debug: 56665 3980822 arm7_9_common.c:1638 arm7_9_restore_context(): examining Supervisor mode
Debug: 56666 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r0
Debug: 56667 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r1
Debug: 56668 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r2
Debug: 56669 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r3
Debug: 56670 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r4
Debug: 56671 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r5
Debug: 56672 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r6
Debug: 56673 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r7
Debug: 56674 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r8
Debug: 56675 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r9
Debug: 56676 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r10
Debug: 56677 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r11
Debug: 56678 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: r12
Debug: 56679 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: pc
Debug: 56680 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: cpsr
Debug: 56681 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 0 mode Supervisor with value 0xffffffff
Debug: 56682 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 1 mode Supervisor with value 0xffffffff
Debug: 56683 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 2 mode Supervisor with value 0xffffffff
Debug: 56684 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 3 mode Supervisor with value 0xffffffff
Debug: 56685 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 4 mode Supervisor with value 0xffffffff
Debug: 56686 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 5 mode Supervisor with value 0xffffffff
Debug: 56687 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 6 mode Supervisor with value 0xffffffff
Debug: 56688 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 7 mode Supervisor with value 0xffffffff
Debug: 56689 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 8 mode Supervisor with value 0xffffffff
Debug: 56690 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 9 mode Supervisor with value 0xffffffff
Debug: 56691 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 10 mode Supervisor with value 0xffffffff
Debug: 56692 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 11 mode Supervisor with value 0xffffffff
Debug: 56693 3980822 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 12 mode Supervisor with value 0xffffffff
Debug: 56694 3980822 arm7_9_common.c:1638 arm7_9_restore_context(): examining Supervisor mode
Debug: 56695 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: pc
Debug: 56696 3980822 arm7_9_common.c:1638 arm7_9_restore_context(): examining Supervisor mode
Debug: 56697 3980822 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: pc
Debug: 56698 3980822 arm7_9_common.c:1638 arm7_9_restore_context(): examining Supervisor mode
Debug: 56699 3980823 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: sp_svc
Debug: 56700 3980823 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: lr_svc
Debug: 56701 3980823 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: pc
Debug: 56702 3980823 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 13 mode Supervisor with value 0xffffffff
Debug: 56703 3980823 arm7_9_common.c:1704 arm7_9_restore_context(): writing register 14 mode Supervisor with value 0xffffffff
Debug: 56704 3980823 arm7_9_common.c:1638 arm7_9_restore_context(): examining Supervisor mode
Debug: 56705 3980823 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: pc
Debug: 56706 3980823 arm7_9_common.c:1638 arm7_9_restore_context(): examining Supervisor mode
Debug: 56707 3980823 arm7_9_common.c:1652 arm7_9_restore_context(): examining dirty reg: pc
Debug: 56708 3980823 arm7_9_common.c:1738 arm7_9_restore_context(): writing cpsr with value 0x200000d3
Debug: 56709 3980823 arm7tdmi.c:414 arm7tdmi_write_xpsr(): xpsr: 200000d3, spsr: 0
Debug: 56710 3980823 arm7_9_common.c:1748 arm7_9_restore_context(): writing PC with value 0x00000000
Debug: 56711 3980823 embeddedice.c:501 embeddedice_write_reg(): 9: 0xffffffff
Debug: 56712 3980823 embeddedice.c:501 embeddedice_write_reg(): 11: 0xffffffff
Debug: 56713 3980823 embeddedice.c:501 embeddedice_write_reg(): 12: 0x00000100
Debug: 56714 3980823 embeddedice.c:501 embeddedice_write_reg(): 13: 0x00000077
Debug: 56715 3980823 embeddedice.c:501 embeddedice_write_reg(): 16: 0x00000000
Debug: 56716 3980823 embeddedice.c:501 embeddedice_write_reg(): 17: 0x00000000
Debug: 56717 3980823 embeddedice.c:501 embeddedice_write_reg(): 19: 0xffffffff
Debug: 56718 3980823 embeddedice.c:501 embeddedice_write_reg(): 20: 0x00000000
Debug: 56719 3980823 embeddedice.c:501 embeddedice_write_reg(): 21: 0x000000f7
Debug: 56720 3980823 target.c:1062 target_call_event_callbacks(): target event 4 (resumed)
Debug: 56721 3980849 embeddedice.c:501 embeddedice_write_reg(): 9: 0x00000003
Debug: 56722 3980849 embeddedice.c:501 embeddedice_write_reg(): 11: 0xffffffff
Debug: 56723 3980849 embeddedice.c:501 embeddedice_write_reg(): 12: 0x00000000
Debug: 56724 3980849 embeddedice.c:501 embeddedice_write_reg(): 13: 0x000000f7
Debug: 56725 3980849 embeddedice.c:501 embeddedice_write_reg(): 16: 0x00000000
Debug: 56726 3980849 embeddedice.c:501 embeddedice_write_reg(): 17: 0x00000000
Debug: 56727 3980849 embeddedice.c:501 embeddedice_write_reg(): 19: 0x00000000
Debug: 56728 3980849 embeddedice.c:501 embeddedice_write_reg(): 21: 0x00000000
Debug: 56729 3980849 embeddedice.c:501 embeddedice_write_reg(): 20: 0x00000000
Debug: 56730 3980849 embeddedice.c:501 embeddedice_write_reg(): 0: 0x00000005
Debug: 56731 3980849 embeddedice.c:501 embeddedice_write_reg(): 12: 0x00000000
Debug: 56732 3980851 arm7_9_common.c:1410 arm7_9_debug_entry(): target entered debug from ARM state
Debug: 56733 3980866 armv4_5.c:397 arm_set_cpsr(): set CPSR 0x200000d3: Supervisor mode, ARM state
Debug: 56734 3980866 arm7_9_common.c:1438 arm7_9_debug_entry(): target entered debug state in Supervisor mode
Debug: 56735 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r0: 0xffffffff
Debug: 56736 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r1: 0xffffffff
Debug: 56737 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r2: 0xffffffff
Debug: 56738 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r3: 0xffffffff
Debug: 56739 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r4: 0xffffffff
Debug: 56740 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r5: 0xffffffff
Debug: 56741 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r6: 0xffffffff
Debug: 56742 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r7: 0xffffffff
Debug: 56743 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r8: 0xffffffff
Debug: 56744 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r9: 0xffffffff
Debug: 56745 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r10: 0xffffffff
Debug: 56746 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r11: 0xffffffff
Debug: 56747 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r12: 0xffffffff
Debug: 56748 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r13: 0xffffffff
Debug: 56749 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r14: 0xffffffff
Debug: 56750 3980866 arm7_9_common.c:1460 arm7_9_debug_entry(): r15: 0x001100f0
Debug: 56751 3980866 arm7_9_common.c:1468 arm7_9_debug_entry(): entered debug state at PC 0x1100f0
Debug: 56752 3980870 target.c:1062 target_call_event_callbacks(): target event 2 (gdb-halt)
Debug: 56753 3980870 target.c:1062 target_call_event_callbacks(): target event 3 (halted)
Debug: 56754 3980870 target.c:1062 target_call_event_callbacks(): target event 8 (gdb-end)
Debug: 56755 3980870 arm7_9_common.c:2121 arm7_9_step(): target stepped
Debug: 56756 3980872 gdb_server.c:2201 gdb_input_inner(): received packet: 'g'
Debug: 56757 3980873 gdb_server.c:2201 gdb_input_inner(): received packet: 'm1100f0,4'
Debug: 56758 3980873 gdb_server.c:1278 gdb_read_memory_packet(): addr: 0x001100f0, len: 0x00000004
Debug: 56759 3980873 target.c:1443 target_read_buffer(): reading buffer of 4 byte at 0x001100f0
Debug: 56760 3980873 arm7_9_common.c:2270 arm7_9_read_memory(): address: 0x001100f0, size: 0x00000004, count: 0x00000001
Debug: 56761 3980885 gdb_server.c:2201 gdb_input_inner(): received packet: 'mffffffff,4'
Debug: 56762 3980885 gdb_server.c:1278 gdb_read_memory_packet(): addr: 0xffffffff, len: 0x00000004
Debug: 56763 3980885 target.c:1443 target_read_buffer(): reading buffer of 4 byte at 0xffffffff
Error: 56764 3980885 target.c:1460 target_read_buffer(): address + size wrapped(0xffffffff, 0x00000004)


Using only OpenOCD commands, the we get the following weirdness:

(gdb) mon reg pc 0
pc (/32): 0x00000000
(gdb) mon step
target state: halted
target halted in ARM state due to single-step, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x001100f0



[Reply][About]
[<<][arm][>>][..]