Debugger Issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debugger Issue

657 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Thu Jun 11 13:32:07 MST 2015
Custom LPC1778 Board -- Win7-64

I have been sucessfully debugging away for quite a while when a F5 single step (instruction trace mode is on) in the disassemby window
cause the debugger to (apparently) loose control. It goes to running:step mode and does not seem to reach the next instruction.
Also, the suspend option does not do anything. The disassembly window is cleared. Fortunately, I have a disassembly file.

As you can see from the gdb traces, the debugger is trying to read a location past the end of sram and reports a failure.
Fair enough. But WHY would it even ATTEMPT to read that location. And having failed, why won't it even try to halt the processor.

I am sticking with version 7.4 for stability reasons.

The problem instruction is at 0x10002D88 [in SRAM] and at that point the SP is 0x1000F2B4 as shown in the screen shots etc.

Disassembly extract
10002d50 WaitInsert:
10002d50:e92d 4ff0 stmdbsp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
10002d54:4db3      ldrr5, [pc, #716]; (10003024 WaitInsert+0x2d4)
10002d56:4cb4      ldrr4, [pc, #720]; (10003028 WaitInsert+0x2d8)
10002d58:682b      ldrr3, [r5, #0]
10002d5a:68a2      ldrr2, [r4, #8]
10002d5c:f5ad 6d3c sub.wsp, sp, #3008; 0xbc0
10002d60:429a      cmpr2, r3
10002d62:b087      subsp, #28
10002d64:d010      beq.n10002d88 WaitInsert+0x38
10002d66:6829      ldrr1, [r5, #0]
10002d68:68e0      ldrr0, [r4, #12]
10002d6a:60a1      strr1, [r4, #8]
10002d6c:b990      cbnzr0, 10002d94 WaitInsert+0x44
10002d6e:6829      ldrr1, [r5, #0]
10002d70:4bae      ldrr3, [pc, #696]; (1000302c WaitInsert+0x2dc)
10002d72:4aaf      ldrr2, [pc, #700]; (10003030 WaitInsert+0x2e0)
10002d74:2900      cmpr1, #0
10002d76:bf0c      iteeq
10002d78:4611      moveqr1, r2
10002d7a:4619      movner1, r3
10002d7c:f7fd fe6e bl10000a5c SioPutString
10002d80:6828      ldrr0, [r5, #0]
10002d82:b960      cbnzr0, 10002d9e WaitInsert+0x4e
10002d84:49ab      ldrr1, [pc, #684]; (10003034 WaitInsert+0x2e4)
10002d86:6021      strr1, [r4, #0]
10002d88:f50d 7d77 add.wsp, sp, #988; 0x3dc   ==== press 'F5' and debugger goes to la-la land!
10002d8c:f50d 6d00 add.wsp, sp, #2048; 0x800   NB: sp = 0x1000F2B4 on entry to line above
10002d90:e8bd 8ff0 ldmia.wsp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc}


gdb traces ...
gdb traces :

635,279 3003^done,depth="5"
635,279 (gdb) 
635,306 3005-thread-info 1
635,306 3006-list-thread-groups
636,329 3004^done,asm_insns=[{address="0x10002d88",func-name="WaitInsert",offset="56",opcodes="0d f5\
 77 7d",inst="add.w\tsp, sp, #988\t; 0x3dc"},{address="0x10002d8c",func-name="WaitInsert",offset="60\
",opcodes="0d f5 00 6d",inst="add.w\tsp, sp, #2048\t; 0x800"},{address="0x10002d90",func-name="WaitI\
nsert",offset="64",opcodes="bd e8 f0 8f",inst="ldmia.w\tsp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc}"\
},{address="0x10002d94",func-name="WaitInsert",offset="68",opcodes="00 20",inst="movs\tr0, #0"},{add\
ress="0x10002d96",func-name="WaitInsert",offset="70",opcodes="e0 60",inst="str\tr0, [r4, #12]"},{add\
ress="0x10002d98",func-name="WaitInsert",offset="72",opcodes="28 68",inst="ldr\tr0, [r5, #0]"},{addr\
ess="0x10002d9a",func-name="WaitInsert",offset="74",opcodes="00 28",inst="cmp\tr0, #0"},{address="0x\
10002d9c",func-name="WaitInsert",offset="76",opcodes="f2 d0",inst="beq.n\t0x10002d84 <WaitInsert+52>\
"},{address="0x10002d9e",func-name="WaitInsert",offset="78",opcodes="00 20",inst="movs\tr0, #0"},{ad\
dress="0x10002da0",func-name="WaitInsert",offset="80",opcodes="a5 49",inst="ldr\tr1, [pc, #660]\t; (\
0x10003038 <WaitInsert+744>)"},{address="0x10002da2",func-name="WaitInsert",offset="82",opcodes="fd \
f7 5b fe",inst="bl\t0x10000a5c <SioPutString>"},{address="0x10002da6",func-name="WaitInsert",offset=\
"86",opcodes="fe f7 5b fb",inst="bl\t0x10001460 <UsbEnum>"},{address="0x10002daa",func-name="WaitIns\
ert",offset="90",opcodes="0d f5 34 65",inst="add.w\tr5, sp, #2880\t; 0xb40"},{address="0x10002dae",f\
unc-name="WaitInsert",offset="94",opcodes="18 35",inst="adds\tr5, #24"},{address="0x10002db0",func-n\
ame="WaitInsert",offset="96",opcodes="00 28",inst="cmp\tr0, #0"},{address="0x10002db2",func-name="Wa\
itInsert",offset="98",opcodes="40 f0 6f 81",inst="bne.w\t0x10003094 <WaitInsert+836>"},{address="0x1\
0002db6",func-name="WaitInsert",offset="102",opcodes="a1 4e",inst="ldr\tr6, [pc, #644]\t; (0x1000303\
c <WaitInsert+748>)"},{address="0x10002db8",func-name="WaitInsert",offset="104",opcodes="a1 49",inst\
="ldr\tr1, [pc, #644]\t; (0x10003040 <WaitInsert+752>)"},{address="0x10002dba",func-name="WaitInsert\
",offset="106",opcodes="28 46",inst="mov\tr0, r5"},{address="0x10002dbc",func-name="WaitInsert",offs\
et="108",opcodes="fe f7 76 f9",inst="bl\t0x100010ac <strcpy>"},{address="0x10002dc0",func-name="Wait\
Insert",offset="112",opcodes="0d f5 34 60",inst="add.w\tr0, sp, #2880\t; 0xb40"},{address="0x10002dc\
4",func-name="WaitInsert",offset="116",opcodes="32 68",inst="ldr\tr2, [r6, #0]"},{address="0x10002dc\
6",func-name="WaitInsert",offset="118",opcodes="04 21",inst="movs\tr1, #4"},{address="0x10002dc8",fu\
nc-name="WaitInsert",offset="120",opcodes="1c 30",inst="adds\tr0, #28"},{address="0x10002dca",func-n\
ame="WaitInsert",offset="122",opcodes="fe f7 4d f9",inst="bl\t0x10001068 <strhex>"}]
636,330 (gdb) 
636,331 3007-stack-list-frames --thread 1 0 4
636,339 3005^done,threads=[{id="1",target-id="Thread <main>",frame={level="0",addr="0x10002d88",func\
="WaitInsert",args=[],file="Main.c",fullname="D:\\Src\\NXP\\USB266\\Main.c",line="357"},state="stopp\
ed"}]
636,339 (gdb) 
636,339 3006^done,groups=[{id="i1",type="process",pid="42000",executable="D:\\Src\\NXP\\USB266\\USB2\
66.elf"}]
636,339 (gdb) 
636,339 3007^done,stack=[frame={level="0",addr="0x10002d88",func="WaitInsert",file="Main.c",fullname\
="D:\\Src\\NXP\\USB266\\Main.c",line="357"},frame={level="1",addr="0x100034f8",func="MainEntry",file\
="Main.c",fullname="D:\\Src\\NXP\\USB266\\Main.c",line="166"},frame={level="2",addr="0x100034f8",fun\
c="AppInit",file="Main.c",fullname="D:\\Src\\NXP\\USB266\\Main.c",line="119"},frame={level="3",addr=\
"0x10000126",func="LibInit2",file="LibInit.s",fullname="D:\\Src\\NXP\\USB266\\LibInit.s",line="205"}\
,frame={level="4",addr="0x10000126",func="LibInit2",file="LibInit.s",fullname="D:\\Src\\NXP\\USB266\\
\LibInit.s",line="205"}]
636,339 (gdb) 
636,412 3008-stack-list-frames --thread 1
636,419 3008^done,stack=[frame={level="0",addr="0x10002d88",func="WaitInsert",file="Main.c",fullname\
="D:\\Src\\NXP\\USB266\\Main.c",line="357"},frame={level="1",addr="0x100034f8",func="MainEntry",file\
="Main.c",fullname="D:\\Src\\NXP\\USB266\\Main.c",line="166"},frame={level="2",addr="0x100034f8",fun\
c="AppInit",file="Main.c",fullname="D:\\Src\\NXP\\USB266\\Main.c",line="119"},frame={level="3",addr=\
"0x10000126",func="LibInit2",file="LibInit.s",fullname="D:\\Src\\NXP\\USB266\\LibInit.s",line="205"}\
,frame={level="4",addr="0x10000126",func="LibInit2",file="LibInit.s",fullname="D:\\Src\\NXP\\USB266\\
\LibInit.s",line="205"}]
636,419 (gdb) 
703,001 3009-data-read-memory-bytes --thread-group i1 268498272 688
703,026 3009^done,memory=[{begin="0x1000f560",offset="0x00000000",end="0x1000f810",contents="999c010\
09a9c01009b9c01009c9c01009d9c01009e9c01009f9c0100a09c0100a19c0100a29c0100a39c0100a49c0100a59c0100a69\
c0100a79c0100a89c0100a99c0100aa9c0100ab9c0100ac9c0100ad9c0100ae9c0100af9c0100b09c0100b19c0100b29c010\
0b39c0100b49c0100b59c0100b69c0100b79c0100b89c0100b99c0100ba9c0100bb9c0100bc9c0100bd9c0100be9c0100bf9\
c0100c09c0100c19c0100c29c0100c39c0100c49c0100c59c0100c69c0100c79c0100c89c0100c99c0100ca9c0100cb9c010\
0cc9c0100cd9c0100ce9c0100cf9c0100d09c0100d19c0100d29c0100d39c0100d49c0100d59c0100d69c0100d79c0100d89\
c0100d99c0100da9c0100db9c0100dc9c0100dd9c0100de9c0100df9c0100e09c0100e19c0100e29c0100e39c0100e49c010\
0e59c0100e69c0100e79c0100e89c0100e99c0100ea9c0100eb9c0100ec9c0100ed9c0100ee9c0100ef9c0100f09c0100f19\
c0100f29c0100f39c0100f49c0100f59c0100f69c0100f79c0100f89c0100f99c0100fa9c0100fb9c0100fc9c0100fd9c010\
0fe9c0100ff9c0100009d0100019d0100029d0100039d0100049d0100059d0100069d0100079d0100089d0100099d01000a9\
d01000b9d01000c9d01000d9d01000e9d01000f9d0100109d0100119d0100129d0100139d0100149d0100159d0100169d010\
0179d0100189d0100199d01001a9d01001b9d01001c9d01001d9d01001e9d01001f9d0100209d0100219d0100229d0100239\
d0100249d0100259d0100269d0100279d0100289d0100299d01002a9d01002b9d01002c9d01002d9d01002e9d01002f9d010\
0309d0100319d0100329d0100339d0100349d0100359d0100369d0100379d0100389d0100399d01003a9d01003b9d01003c9\
d01003d9d01003e9d01003f9d0100409d0100419d0100429d0100439d0100449d0100"}]
703,027 (gdb) 
728,787 3010-exec-step-instruction --thread 1 1
728,808 3010^running
728,808 *running,thread-id="all"
728,808 (gdb) 
728,918 3010^error,msg="Cannot access memory at address 0x1001028c"
728,918 (gdb) 


Screenshots ...







Labels (1)
0 Kudos
5 Replies

615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Thu Jun 11 17:02:52 MST 2015
Thanks for your input.
0 Kudos

615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jun 11 15:13:00 MST 2015

Quote: MikeSimmonds
This is RedLink Server
I don't want to update past 7.4 because ...
there are a lot of issues reported in the forums with later releases
and 7.8 is a new quantity with CMSIS-DAP and extra USB endpoints etc. etc.
Admittedly mainly with win 8.1, but why take the chance?

Normally, "If it ain't broke, don't fix it"



Mike,

You have the one F8 workaround. I can test the behavior with a later release, but LPCXpresso 7.4.0 is not maintained. If you want to review the LPCXpresso updates since 7.4.0, look here:

http://www.lpcware.com/content/forum/lpcxpresso-latest-release

There have been numerous product updates, which includes the GNU tools, and GDB in particular.

LPCXpresso Support
0 Kudos

615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Thu Jun 11 14:38:58 MST 2015
Additional.

Terminateing the debug session and starting another regains control, but my memory windows are then lost.

Mike
0 Kudos

615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Thu Jun 11 14:35:17 MST 2015
This is RedLink Server
I don't want to update past 7.4 because ...
there are a lot of issues reported in the forums with later releases
and 7.8 is a new quantity with CMSIS-DAP and extra USB endpoints etc. etc.
Admittedly mainly with win 8.1, but why take the chance?

Normally, "If it ain't broke, don't fix it"

This is my first application that copies itself to ram to execute.
According to the map file, a smidgeon over 32K of SRAM is used for code/data/bss leaving 32K for stack.
Big buffers go into SDRAM [32 MB at 0xA0000000]

BTW, an ugly workround is to put a breakpoint on the following instruction and run (F8) instead of step.
0 Kudos

615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jun 11 14:01:00 MST 2015
Please confirm the debug emulator you're using. GDB often "brackets" memory read requests. In other words, it may attempt to cache memory before and after the requested address. Sometimes, these may fall outside of a valid memory region. Normally, this is benign. Given the LPCXpresso 7.4.0 release is 9 months old, you should consider installing the latest release.

LPCXpresso Support
0 Kudos