#107 Error in the 'Other Options' field of the OpenOCD section under the Debugger tab results in debug launch hang up

Next release
closed-fixed
None
5
2015-03-21
2014-04-25
No

Hi,

Sorry to drop this on you on a Friday evening!

While testing the latest GNU ARM OpenOCD Debug support (version 1.2.2) on Windows, I get a launch hang-up when entering a bad set of options under the 'Other Options' field of the OpenOCD section under the Debugger tab.

For example, if I create a new configuration and I enter the follow line under 'Other Options' of the OpenOCD section under the Debugger tab:

-c "interface cmsis-dap" -f target\kl25z.cfg

There's an error in the line (which I noticed following the issue I am about to describe). It should be kl25.cfg and not kl25z.cfg.

Anyhow, when I hit debug to launch it, it get's stuck in the "Initializing debugger services" phase at 62% in the progress view. I'm also unable to cancel the operation in the progress view. I have to close down the IDE and reopen it.

Once I fix up the command line above it's OK and I reach main in the debugger.

In previous versions I would see an error reported (GDB unable to connect to remote GDB server) in such a case.

Cheers,

Stephen

Discussion

  • Liviu Ionescu (ilg)

    could you run the flolowing tests:
    - run the openocd process manually, and let me know if it hangs or returns immediately in the error case
    - check the exit code of the openocd process, in both cases, and let me know if it is non zero in error case and zero normally?

     
  • Liviu Ionescu (ilg)

    • status: open --> open-accepted
    • assigned_to: Liviu Ionescu (ilg)
     
  • Stephen Davey

    Stephen Davey - 2014-04-28

    Hi Liviu,

    Hope you had a good weekend. Sorry for the delay in answering your question.

    When I run the openocd process manually from the command line it returns immediately when a bad command line options is passed.

    C:\Freescale\KDS_1.0.1\openocd\bin>openocd.exe -c "interface cmsis-dap" -f target\kl25z.cfg
    Open On-Chip Debugger 0.8.0-dev-dirty (2014-04-24-21:18)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
    Info : only one transport option; autoselect 'cmsis-dap'
    Info : CMSIS-DAP: SWD Supported
    Info : CMSIS-DAP: Interface Initialised (SWD)
    Runtime Error: embedded:startup.tcl:47: Can't find target\kl25z.cfg
    in procedure 'script'
    at file "embedded:startup.tcl", line 47

    I'm not sure which error code is returned. How can I check this?

    Thanks

    Stephen

     
  • Liviu Ionescu (ilg)

    I'm not sure which error code is returned. How can I check this?

    I mean the process exit status, the value used as return for main() and passed back to the calling shell.

    the command to display it is shell specific, for example for bash it is 'echo $?'; I do not know for windows.

    the point is that we have to identify somehow that the openocd process failed, and one way to do it is to check the process error code.

     
  • Stephen Davey

    Stephen Davey - 2014-04-28

    Hi Liviu,

    Just found out the you can use echo %ERRORLEVEL% under DOS. So I get error '1' when it fails because of a bad option passed on the command line and it returns '0' when all is OK.

    See below.

    C:\Freescale\KDS_1.0.1\openocd\bin>openocd.exe -c "interface cmsis-dap" -f targe
    t\kl25z.cfg
    Open On-Chip Debugger 0.8.0-dev-dirty (2014-04-24-21:18)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
    Info : only one transport option; autoselect 'cmsis-dap'
    Info : CMSIS-DAP: SWD Supported
    Info : CMSIS-DAP: Interface Initialised (SWD)
    Runtime Error: embedded:startup.tcl:47: Can't find target\kl25z.cfg
    in procedure 'script'
    at file "embedded:startup.tcl", line 47

    C:\Freescale\KDS_1.0.1\openocd\bin>echo %ERRORLEVEL%
    1

    C:\Freescale\KDS_1.0.1\openocd\bin>openocd.exe -c "interface cmsis-dap" -f targe
    t\kl25.cfg
    Open On-Chip Debugger 0.8.0-dev-dirty (2014-04-24-21:18)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
    Info : only one transport option; autoselect 'cmsis-dap'
    Info : CMSIS-DAP: SWD Supported
    Info : CMSIS-DAP: Interface Initialised (SWD)
    Info : add flash_bank kinetis kl25.flash
    cortex_m reset_config sysresetreq
    adapter speed: 50 kHz
    Info : CMSIS-DAP: FW Version = 1.0
    Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
    Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
    Info : CMSIS-DAP: Interface ready
    Info : clock speed 50 kHz
    Info : IDCODE 0x0bc11477
    Info : kl25.cpu: hardware has 2 breakpoints, 2 watchpoints

    C:\Freescale\KDS_1.0.1\openocd\bin>echo %ERRORLEVEL%
    0

    Moreover, it's only recently that I see the hand. Previously I would get an error in eclipse indicating a problem with GDB trying to connect to the remote target.

    Cheers

    Stephen

     
  • Liviu Ionescu (ilg)

    I tried to reproduce the problem on my machine, but it seems OS X is not affected, since using a wrong filename ended in an error message box and the debug session was properly terminated.

    If you find a fix for this problem, please let me know and I'll consider it for inclusion.

     
  • Liviu Ionescu (ilg)

    a small correction, OS X is also affected, but when I run the test in the development environment, the bug does not show up.

    it looks like a bad timing problem, if openocd quits immediately, the monitoring thread does not detect this and hangs.

     
  • Liviu Ionescu (ilg)

    Stephen,

    Do you have any news on this issue? I'm considering a new release and maybe we can address this bug too.

     
  • John Moule

    John Moule - 2014-06-25

    Hi Liviu,

    unfortunately Stephen no longer works here so I'll take over any of his outstanding trackers. Is it possible to replace Stephen's email with mine or add me as cc please?

    I'll do some more investigation on this issue and see if it still reproduces.

    cheers john

     
  • Liviu Ionescu (ilg)

    Is it possible to replace Stephen's email with mine or add me as cc please?

    you can subscribe to any tracked issue with your address.

     
  • John Moule

    John Moule - 2014-07-11

    Hi,

    To try this (Windows 8) I specified an incorrect parameter in the "Config options":

    -f kinetisXXX.cfg

    When I launch I don't see a hang. Instead I see the following error dialog:

    [Problem Occurred]
    Launching <project> has encountered a problem
    Error in services launch sequence
    GDB prompt not read

    Which is not very helpful.

    If I specify a log file in the launch configuration the contents of the log are much more helpful:

    Runtime Error: embedded:startup.tcl:47: Can't find kinetisXXX.cfg
    in procedure 'script'
    at file "embedded:startup.tcl", line 47

    Would it be possible to use some of this error message in the error dialog above?

    I can enter a new tracker for this bug if it helps?

    cheers john

     
  • Liviu Ionescu (ilg)

    did you try this with the pre-release version?

     
  • John Moule

    John Moule - 2014-07-11

    Tried with git (stable) from earlier.
    Just tried again after a git pull just now (2037 GMT+1)
    commit c900e075fc42e3bdb365e40a9c16f2b9c9ec0c93

     
  • Liviu Ionescu (ilg)

    you mean you used a debug version? could you try in exactly the same condition the release version (from updates-test), in a fresh workspace?

    it looks like a race condition, somehwere in the debug session startup code. I currently have no windows machine to test (I need to reinstall one of the VMs, probably tomorrow), but on a friend's machine it behaved as expected, it did not hang, but reported an error.

     
  • John Moule

    John Moule - 2014-07-13

    Tried this in Version 2.3.1-201407120554 from gnuarmeclipse.sourceforge.net/updates.

    I get the same behaviour as reported on Friday. That is, no hang, but "GDB prompt not read" error dialog.

     
  • Liviu Ionescu (ilg)

    yes, it seems that if the command line is wrong, the behaviour is not very stable, I get different results in different runs. :-(

     
  • Liviu Ionescu (ilg)

    the expected result is an error message like:

    "OpenOCD did not start, check configuration options."

    on my Mac I get it most of the times, but it seems there are moments when things go wrong and the test does not catch the problem.

    the problem is that openocd response time is variable. if the if it quits with error before starting the client, I trigger that error and the session is not started.

    if not, I start the client, but soon openocd will be dead and the connection to port 3333 will sometimes hang, sometimes timeout.

    I currently have no easy fix for this.

     
  • John Moule

    John Moule - 2014-07-14

    Would it be possible to display the contents of what would be written to the log file in the error dialog, if you do get a log for that launch instance. It would probably be better than the current msg (GDB prompt not read)

     
    • Liviu Ionescu (ilg)

      the openocd output should be available via some i/o streams to Eclipse, but the current implementation does not work very well when openocd crashes, since the output is not flushed and is lost.

      mandating the use of a log file, to be later displayed in the error window, is not very elegant.

      time permitting I'll try to improve the error processing for openocd, but personally I do not think openocd is worth the effort.

       
  • John Moule

    John Moule - 2014-07-15

    Many thanks for investigating.
    cheers john

     
  • Liviu Ionescu (ilg)

    could you check if this problem was solved by the latest update?

     
  • Liviu Ionescu (ilg)

    fixed since 2.7.1-201503211846

     
  • Liviu Ionescu (ilg)

    • status: open-accepted --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks