Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomprehensible error #318

Closed
muttering-oldman opened this issue Jul 24, 2020 · 9 comments
Closed

Incomprehensible error #318

muttering-oldman opened this issue Jul 24, 2020 · 9 comments

Comments

@muttering-oldman
Copy link

Hi guys!

I've been trying to run the debugger for two days, but still got no result.

I'm using st-link + stm32f407vet6.

Running OpenOCD and GDB from terminals everything works. I can do "next", "step", etc.

But an error is happening in vscode. The openocd server starts up normally, but when gdb is connected it says:

Reading symbols from .....
0x000032f6 in <stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayUs<u32>>::delay_us (self = 0x1000ff9c, us = 200000) at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\stm32f4xx-hal-0.8.3\src/delay.rs: 69
69 while! Self.syst.has_wrapped () {}
Not implemented stop reason (assuming exception): undefined

The line that begins with the address 0x000032f6 in ... changes with every start.

In this case, breakpoints are ignored wherever I put them.

Sometimes after starting the debugger, execution stops for some reason at line 489 (pub unsafe ...) in the cortex-m-rt-0.6.12/src/lib.rs file:

// ...
# [doc (hidden)]
# [no_mangle]
pub unsafe extern "C" fn Reset () ->! {
    extern "C" {

        // These symbols come from `link.x`
        static mut __sbss: u32;
        static mut __ebss: u32;

        static mut __sdata: u32;
        static mut __edata: u32;
        static __sidata: u32;

    }
    // ...

There is a stop in other files, but very rarely.

Maybe I'm doing something wrong, but I've tried everything and it still doesn't work.

Debug console from start to stop on the line pub unsafe extern "C"

Reading symbols from 'D:\stm32\projects\p-blink-01\target\thumbv7em-none-eabihf\debug\p-blink-01'
Finished reading symbols
Please check OUTPUT tab (Adapter Output) for output from openocd.exe
Launching server: "openocd.exe" "-c" "gdb_port 50000" "-s" "D:\stm32\projects\p-blink-01" "-f" "interface/stlink.cfg" "-f" "target/stm32f4x.cfg" "-c" "tpiu config internal C:/Users/User/AppData/Local/Temp/tmp-9020Q7ai8AYVF28L uart off 48000000 2000000"
Launching GDB: "arm-none-eabi-gdb.exe" "-q" "--interpreter=mi2"
1-gdb-set target-async on
2-interpreter-exec console "source c:/Users/User/.vscode/extensions/marus25.cortex-debug-0.3.7/support/gdbsupport.init"
3-target-select extended-remote localhost:50000
4-interpreter-exec console "monitor reset halt"
5-target-download
6-interpreter-exec console "monitor reset halt"
7-enable-pretty-printing
8-interpreter-exec console "EnableITMAccess"
9-interpreter-exec console "BaseSWOSetup 23"
10-interpreter-exec console "SetITMId 1"
11-interpreter-exec console "ITMDWTTransferEnable"
12-interpreter-exec console "DisableITMPorts 0xFFFFFFFF"
13-interpreter-exec console "EnableITMPorts 0x1"
14-interpreter-exec console "EnableDWTSync"
15-interpreter-exec console "ITMSyncEnable"
16-interpreter-exec console "ITMGlobalEnable"
17-interpreter-exec console "DisablePCSample"
undefinedC:\Program Files (x86)\GNU Arm Embedded Toolchain\9 2020-q2-update\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-added","output":[["id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reading symbols from D:\\stm32\\projects\\p-blink-01\\target\\thumbv7em-none-eabihf\\debug\\p-blink-01...\n"}]}
Reading symbols from D:\stm32\projects\p-blink-01\target\thumbv7em-none-eabihf\debug\p-blink-01...
GDB -> App: {"token":1,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":2,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-started","output":[["id","i1"],["pid","42000"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-created","output":[["id","1"],["group-id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reset () at C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs:489\n"}]}
Reset () at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\cortex-m-rt-0.6.12\src\lib.rs:489
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"489\tpub unsafe extern \"C\" fn Reset() -> ! {\n"}]}
489	pub unsafe extern "C" fn Reset() -> ! {
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["frame",[["addr","0x0000475a"],["func","Reset"],["args",[]],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]],["thread-id","1"],["stopped-threads","all"]]}]}
Not implemented stop reason (assuming exception): undefined
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"connected","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 2000 kHz, using 1800 kHz\n"}]}
Unable to match requested speed 2000 kHz, using 1800 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 2000 kHz, using 1800 kHz\n"}]}
Unable to match requested speed 2000 kHz, using 1800 kHz
18-thread-list-ids
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0x01000000 pc: 0x0000475a msp: 0x10010000\n"}]}
xPSR: 0x01000000 pc: 0x0000475a msp: 0x10010000
GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
19-thread-list-ids
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["address","0x475a"],["load-size","21748"],["transfer-rate","878704"],["write-rate","5437"]]}}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 2000 kHz, using 1800 kHz\n"}]}
Unable to match requested speed 2000 kHz, using 1800 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 2000 kHz, using 1800 kHz\n"}]}
Unable to match requested speed 2000 kHz, using 1800 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0x01000000 pc: 0x0000475a msp: 0x10010000\n"}]}
xPSR: 0x01000000 pc: 0x0000475a msp: 0x10010000
GDB -> App: {"token":6,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":7,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Warning: the current language does not match this frame.\n"}]}
Warning: the current language does not match this frame.
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe000edfc"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000fb0"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":8,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0040304"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe00400f0"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0040010"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0001000"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0001000"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":9,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e80"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e80"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":10,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e80"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":11,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e00"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":12,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e00"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":13,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0001000"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":14,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e80"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":15,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0000e80"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":16,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","c"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0xe0001000"],["len","0x4"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","language"],["value","auto"]]}]}
GDB -> App: {"token":17,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
20-break-insert "d:\\stm32\\projects\\p-blink-01\\src\\main.rs:38"
GDB -> App: {"token":18,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
21-thread-info 1
GDB -> App: {"token":19,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
22-thread-info 1
GDB -> App: {"token":20,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","1"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x0000030c"],["func","p_blink_01::__cortex_m_rt_main"],["file","src\\main.rs"],["fullname","D:\\stm32\\projects\\p-blink-01\\src\\main.rs"],["line","38"],["thread-groups",["i1"]],["times","0"],["original-location","d:\\stm32\\projects\\p-blink-01\\src\\main.rs:38"]]]]}}
GDB -> App: {"token":21,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["args",[]],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]],["state","stopped"]]]]]}}
GDB -> App: {"token":22,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["args",[]],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]],["state","stopped"]]]]]}}
23-stack-info-depth --thread 1 10000
GDB -> App: {"token":23,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
24-stack-list-frames --thread 1 0 0
GDB -> App: {"token":24,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]]]]]}}
25-thread-list-ids
26-data-list-register-names
GDB -> App: {"token":25,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
27-thread-info 1
GDB -> App: {"token":26,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["register-names",["r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12","sp","lr","pc","","","","","","","","","","xPSR","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14","d15","","","","","","","","","","","","","","","","","fpscr","msp","psp","primask","basepri","faultmask","control","s0","s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","s12","s13","s14","s15","s16","s17","s18","s19","s20","s21","s22","s23","s24","s25","s26","s27","s28","s29","s30","s31"]]]}}
GDB -> App: {"token":27,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["args",[]],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]],["state","stopped"]]]]]}}
28-thread-list-ids
GDB -> App: {"token":28,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
29-thread-info 1
GDB -> App: {"token":29,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["args",[]],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]],["state","stopped"]]]]]}}
30-stack-info-depth --thread 1 10000
31-stack-info-depth --thread 1 10000
32-data-list-register-values N
GDB -> App: {"token":30,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
33-stack-list-frames --thread 1 0 0
GDB -> App: {"token":31,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
34-stack-list-frames --thread 1 0 0
35-stack-list-variables --thread 1 --frame 0 --simple-values
GDB -> App: {"token":32,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["register-values",[[["number","0"],["value","0"]],[["number","1"],["value","0"]],[["number","2"],["value","0"]],[["number","3"],["value","0"]],[["number","4"],["value","0"]],[["number","5"],["value","0"]],[["number","6"],["value","0"]],[["number","7"],["value","0"]],[["number","8"],["value","0"]],[["number","9"],["value","0"]],[["number","10"],["value","0"]],[["number","11"],["value","0"]],[["number","12"],["value","0"]],[["number","13"],["value","0x10010000"]],[["number","14"],["value","-1"]],[["number","15"],["value","0x475a <Reset>"]],[["number","25"],["value","16777216"]],[["number","58"],["value","0"]],[["number","59"],["value","0"]],[["number","60"],["value","0"]],[["number","61"],["value","0"]],[["number","62"],["value","0"]],[["number","63"],["value","0"]],[["number","64"],["value","0"]],[["number","65"],["value","0"]],[["number","66"],["value","0"]],[["number","67"],["value","0"]],[["number","68"],["value","0"]],[["number","69"],["value","0"]],[["number","70"],["value","0"]],[["number","71"],["value","0"]],[["number","72"],["value","0"]],[["number","73"],["value","0"]],[["number","90"],["value","0"]],[["number","91"],["value","0x10010000"]],[["number","92"],["value","0x0 <core::fmt::builders::DebugList::entries>"]],[["number","93"],["value","0"]],[["number","94"],["value","0"]],[["number","95"],["value","0"]],[["number","96"],["value","0"]],[["number","97"],["value","0"]],[["number","98"],["value","0"]],[["number","99"],["value","0"]],[["number","100"],["value","0"]],[["number","101"],["value","0"]],[["number","102"],["value","0"]],[["number","103"],["value","0"]],[["number","104"],["value","0"]],[["number","105"],["value","0"]],[["number","106"],["value","0"]],[["number","107"],["value","0"]],[["number","108"],["value","0"]],[["number","109"],["value","0"]],[["number","110"],["value","0"]],[["number","111"],["value","0"]],[["number","112"],["value","0"]],[["number","113"],["value","0"]],[["number","114"],["value","0"]],[["number","115"],["value","0"]],[["number","116"],["value","0"]],[["number","117"],["value","0"]],[["number","118"],["value","0"]],[["number","119"],["value","0"]],[["number","120"],["value","0"]],[["number","121"],["value","0"]],[["number","122"],["value","0"]],[["number","123"],["value","0"]],[["number","124"],["value","0"]],[["number","125"],["value","0"]],[["number","126"],["value","0"]],[["number","127"],["value","0"]],[["number","128"],["value","0"]]]]]}}
GDB -> App: {"token":33,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]]]]]}}
GDB -> App: {"token":34,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x0000475a"],["func","Reset"],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cortex-m-rt-0.6.12\\src\\lib.rs"],["line","489"],["arch","armv7e-m"]]]]]]}}
GDB -> App: {"token":35,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["variables",[]]]}}
36-stack-list-variables --thread 1 --frame 0 --simple-values
GDB -> App: {"token":36,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["variables",[]]]}}

Continuation after clicking "continue"

37-exec-continue --thread 1
GDB -> App: {"token":37,"outOfBandRecord":[],"resultRecords":{"resultClass":"running","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"running","output":[["thread-id","all"]]}]}

Adapter output:

Open On-Chip Debugger 0.10.0 (2020-07-01) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Info : STLINK V2J36S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 6.414718
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Info : device id = 0x10076413
Info : flash size = 512 kbytes
Info : flash size = 512 bytes
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000475a msp: 0x10010000
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000475a msp: 0x10010000

openock.cfg :

transport select hla_swd

adapter_khz 2000

source [find interface/stlink.cfg]

source [find target/stm32f4x.cfg]

reset_config none separate

launch.json :

{
  "type": "cortex-debug",
  "preLaunchTask": "cargo build",
  "request": "launch",
  "showDevDebugOutput": true,
  "servertype": "openocd",
  "cwd": "${workspaceRoot}",
  "executable": "./target/thumbv7em-none-eabihf/debug/p-blink-01",
  "name": "Debug (OpenOCD)",
  "device": "STM32F407VET6",
  "configFiles": [
    "interface/stlink.cfg",
    "target/stm32f4x.cfg"
  ],
  "svdFile": "${workspaceRoot}/.vscode/STM32F407.svd",
  "swoConfig": {
    "enabled": true,
    "cpuFrequency": 48000000,
    "swoFrequency": 2000000,
    "source": "probe",
    "decoders": [
      {
        "type": "console",
        "label": "ITM",
        "port": 0
      }
    ]
  },
}

Let me know if you need any more information on this error, I'll try to get it.

@Marus
Copy link
Owner

Marus commented Jul 24, 2020

Unfortunately, I don't know too much about rust (I want to learn more - but there is never enough time) - and why it might not be able to interpret things properly when run through the extension (we do some things were we parse things from objdump which may break if something ends up in a format we didn't expect - but I wouldn't have expected this to effect simply setting/hitting breakpoints).

I know some people (@Samonitari and @perlindgren have I believe) had used it in the past with rust - although maybe something has changed that has caused it to stop working. Don't know if they might have any feedback about what they may have been doing differently.

@haneefdm
Copy link
Collaborator

I did modify the parser for the objdump output to handle de-mangled names for C++ and Rust and to handle IAR generated excutables.. @muttering-oldman Can you provide just the executable and take a look. And, what do the list of breakpoints look like.

Not implemented stop reason (assuming exception): undefined

I have seen this all the time because when a reset happens, it appears like a breakpoint be hit or a hard fault but the reason gdb receives is unknown reason. It is not fatal.

But from this issue, I don't understand what is actually not working. gdb may not be liking the elf file produced to enable breakpoints?!?!

@muttering-oldman
Copy link
Author

muttering-oldman commented Jul 24, 2020

@haneefdm I'm afraid I didn't quite get it about the breakpoint list. Where do I need to look? Is this an extension output?
Could you please tell me in more details what exactly should I do?

This is what I see after setting a new breakpoint:

38-exec-interrupt
GDB -> App: {"token":38,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"\nProgram"}]}

Program
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":" received signal SIGINT, Interrupt.\n"}]}
 received signal SIGINT, Interrupt.
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"<stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayUs<u32>>::delay_us (self=0x1000ff9c, us=500000) at C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\stm32f4xx-hal-0.8.3\\src/delay.rs:69\n"}]}
<stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayUs<u32>>::delay_us (self=0x1000ff9c, us=500000) at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\stm32f4xx-hal-0.8.3\src/delay.rs:69
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"69\t            while !self.syst.has_wrapped() {}\n"}]}
69	            while !self.syst.has_wrapped() {}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["reason","signal-received"],["signal-name","SIGINT"],["signal-meaning","Interrupt"],["frame",[["addr","0x00003308"],["func","<stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayUs<u32>>::delay_us"],["args",[[["name","self"],["value","0x1000ff9c"]],[["name","us"],["value","500000"]]]],["file","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\stm32f4xx-hal-0.8.3\\src/delay.rs"],["fullname","C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\stm32f4xx-hal-0.8.3\\src\\delay.rs"],["line","69"],["arch","armv7e-m"]]],["thread-id","1"],["stopped-threads","all"]]}]}
39-break-delete 1
GDB -> App: {"token":39,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
40-break-insert "d:\\stm32\\projects\\p-blink-01\\src\\main.rs:34"
41-break-insert "d:\\stm32\\projects\\p-blink-01\\src\\main.rs:36"
GDB -> App: {"token":40,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","2"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x000002be"],["func","p_blink_01::__cortex_m_rt_main"],["file","src\\main.rs"],["fullname","D:\\stm32\\projects\\p-blink-01\\src\\main.rs"],["line","34"],["thread-groups",["i1"]],["times","0"],["original-location","d:\\stm32\\projects\\p-blink-01\\src\\main.rs:34"]]]]}}
GDB -> App: {"token":41,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","3"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x000002ee"],["func","p_blink_01::__cortex_m_rt_main"],["file","src\\main.rs"],["fullname","D:\\stm32\\projects\\p-blink-01\\src\\main.rs"],["line","36"],["thread-groups",["i1"]],["times","0"],["original-location","d:\\stm32\\projects\\p-blink-01\\src\\main.rs:36"]]]]}}
42-exec-continue
GDB -> App: {"token":42,"outOfBandRecord":[],"resultRecords":{"resultClass":"running","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"running","output":[["thread-id","all"]]}]}

Noticed that the paths in some places have a strange look. Pay attention to the "/" at the end.

C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\stm32f4xx-hal-0.8.3\\src/delay.rs:69\n
C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\stm32f4xx-hal-0.8.3\src/delay.rs:69
C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\stm32f4xx-hal-0.8.3\\src\\delay.rs
C:\\Users\\User\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\stm32f4xx-hal-0.8.3\\src/delay.rs

I've noticed four variants of the same path. Maybe that's the reason?

@haneefdm
Copy link
Collaborator

haneefdm commented Jul 24, 2020

Hmmm, unless it comes from disassembly, we don't mess with path names or line numbers. They go directly to gdb and itinterprets them.

The double back-slashes and forward slash are generally okay. Even multiple of them. They are generally collapsed into one

From your last attachment, everything seems to have worked. gdb did not fail, did it? So, what is not working?

@muttering-oldman
Copy link
Author

muttering-oldman commented Jul 24, 2020

Breakpoints do not interrupt program execution. I put them everywhere in the code, but none of them worked. Maybe I'm doing something wrong.

@haneefdm
Copy link
Collaborator

In the debug console, can you do a info breakpoints and then continue. It might show you the addresses where the breakpoint is actually set. We need to make sure those addresses are valid. This can happen if source does not match the executable being debugged which may not match what is actually programmed in the device. Everything has to be in sync

@muttering-oldman
Copy link
Author

muttering-oldman commented Jul 25, 2020

After connecting, I executed the command "load".
Then I executed "bt" to view the stack.
I proceeded with "continue" and then my console was locked. I pressed ctrl+c to stop and ran "bt" again to view the stack.
Then I set two breakpoints to "b main.rs:34" and "b main.rs:37", and then I executed "info b" to view all breakpoints.

But unfortunately the breakpoints are ignored and the execution is not interrupted. I'll continue researching and supplement the information.

$ arm-none-eabi-gdb -q target\thumbv7em-none-eabihf\debug\p-blink-01
Reading symbols from target\thumbv7em-none-eabihf\debug\p-blink-01...
(gdb) target remote :3333
Remote debugging using :3333
0x000013ee in cortex_m::peripheral::syst::<impl cortex_m::peripheral::SYST>::has_wrapped (
    self=0x16e36000)
    at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\cortex-m-0.6.3\src\peripheral/syst.rs:136
136             self.csr.read() & SYST_CSR_COUNTFLAG != 0
(gdb) load
Loading section .vector_table, size 0x1a8 lma 0x0
Loading section .text, size 0x475c lma 0x1a8
Loading section .rodata, size 0xbf0 lma 0x4910
Start address 0x475a, load size 21748
Transfer rate: 98 KB/sec, 5437 bytes/write.
(gdb) bt
#0  Reset ()
    at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\cortex-m-rt-0.6.12\src\lib.rs:489
(gdb) continue
Continuing.

Program received signal SIGINT, Interrupt.
0x000032fa in <stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayUs<u32>>::delay_us (
    self=0x1000fe14, us=500000)
    at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\stm32f4xx-hal-0.8.3\src/delay.rs:69 69                  while !self.syst.has_wrapped() {}
(gdb) bt
#0  0x000032fa in <stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayUs<u32>>::delay_us (self=0x1000fe14, us=500000)
    at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\stm32f4xx-hal-0.8.3\src/delay.rs:69 #1  0x00003240 in <stm32f4xx_hal::delay::Delay as embedded_hal::blocking::delay::DelayMs<u32>>::delay_ms (self=0x1000fe14, ms=500)
    at C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\stm32f4xx-hal-0.8.3\src/delay.rs:32 #2  0x000002f2 in p_blink_01::__cortex_m_rt_main () at src\main.rs:36
#3  0x00000208 in main () at src\main.rs:15
(gdb) b main.rs:34
Breakpoint 1 at 0x2be: file src\main.rs, line 34.
(gdb) b main.rs:37
Breakpoint 2 at 0x2f6: file src\main.rs, line 37.
(gdb) info b
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x000002be in p_blink_01::__cortex_m_rt_main at src\main.rs:34
2       breakpoint     keep y   0x000002f6 in p_blink_01::__cortex_m_rt_main at src\main.rs:37

I think when I use "objcopy" to convert raw ELF to bin something happens that disrupts the order in which the device performs.
I've set the flag to disable optimizations when compiling rust code.
When I set breakpoints, GDB correctly outputs the path to the file in response.
When setting "break main", it outputs the same line number as in rust code.

@haneefdm
Copy link
Collaborator

Looks like the program is in some sort of a blocking delay loop when you interrupted the program

Is it possible you have an infinite loop or the delay is too large? If gdb cannot stop at a breakpoint, then there is not much Cortex-Debug can do.

@haneefdm
Copy link
Collaborator

haneefdm commented Jul 25, 2020

I should close this issue because the message is coming due to OpenOCD and it does not impede anything and it has always been there on a reset. We know that gdb stopped but it doesn't know what the reason is and we are reporting back to you.

I think we are mixing up multiple issues and the message may be incomprehensible but what else should it say? The bug is really with OpenOCD where if the program stops, it should always give a reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants