Eclipse debug plugin for ChibiOS/RT

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by barthess »

Hi Giovanni,
I have tested debug plugin on my Gentoo linux box with Eclipse Indigo Service Release 1. Works fine. Thanks for you work.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

I suspected you were the Gentoo kind of geek :-)
GSE
Posts: 3
Joined: Fri May 29, 2015 10:04 am

Re: Eclipse debug plugin for ChibiOS/RT

Post by GSE »

Permanently got "error reading memory at 536......." with "p_stklimit" address from one of last threads in rlist order.

When I using just a few threads (9-10 threads) Debug plugin works fine. When I start increasing thread count in my app (11-13 threads) - always got "error reading memory at" with "p_stklimit" value from one of last thread (in rlist order).
Check MCU memory - seems ok (no stack overflow or thread structure corruption). Checking rlist manually from "watch view" didn't help, all seems ok.
When I change running threads number or reduce stack size for some threads - it doesn't help.
But reducing stack size for each thread helps - I can successfully press "refresh" button on "threads" tab, but only once. Next pressing following with error message. Some times eclipse "freeze" after pressing plugin's "refresh".

Seems that some exception happens while execution scanStack function in package org.chibios.tools.eclipse.debug.utils. But which exception?
Also OOCD log show errors about NULL stack pointer but all threads are running without any problems. Why OOCD show this error?
Please, help to find what's wrong.

I use:
ChibiStudio 10
Open On-Chip Debugger 0.9.0-dev-00268-ga9c90a0 (2015-02-08-10:38) (Auto-detected RTOS: ChibiOS) (Trying to use x64 and x32 versions of OOCD)
STM32F205
STLINK v2 JTAG v20 API v2 SWIM v4 VID 0x0483 PID 0x3748
All threads allocated using static memory allocation
Thread stack size vary from 256 bytes to 3000 bytes

OOCD log:

Code: Select all

jtag_ntrst_delay
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v20 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.197918
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x20036411
Info : flash size = 512kbytes
Info : Auto-detected RTOS: ChibiOS
Info : Successfully loaded memory map of ChibiOS/RT target running version 2.6.5
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001090 msp: 0x20000400
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001090 msp: 0x20000400
Info : Padding image section 0 with 12 bytes
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000042 msp: 0x20000400
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (5034). Workaround: increase "set remotetimeout" in GDB
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08001090 msp: 0x20000400
Error: Error: null stack pointer in thread
Error: Error: null stack pointer in thread
Error: Error: null stack pointer in thread
Error: Error: null stack pointer in thread
Error: Error: null stack pointer in thread
Error: address + size wrapped(0xffffffff, 0x00000024)
Error: Error reading stack frame from thread


GDB log showing that read was successful (CHIBIOS DEBUG View showing "error reading memory at 536879112"):

Code: Select all

399-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_name"
399^done,value="134463820"
(gdb)
400-data-read-memory 134463820 x 1 1 16 .
400^done,addr="0x0803c14c",nr-bytes="16",total-bytes="16",next-row="0x0803c15c",prev-row="0x0803c13c",next-page="0x0803c15c",prev-page="0x0803c13c",memory=[{addr="0x0803c14c",data=["0x73","0x69","0x6d","0x5f","0x69","0x64","0x6c","0x65","0x5f","0x70","0x61","0x72","0x73","0x65","0x72","0x00"],ascii="sim_idle_parser."}]
(gdb)
401-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_state"
401^done,value="6"
(gdb)
402-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_flags"
402^done,value="0"
(gdb)
403-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_prio"
403^done,value="64"
(gdb)
404-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_refs"
404^error,msg="There is no member named p_refs."
(gdb)
405-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_time"
405^done,value="0"
(gdb)
406-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_u.wtobjp"
406^done,value="4294967295"
(gdb)
407-data-evaluate-expression "(uint32_t)((Thread *)536882000)->p_newer"
407^done,value="536879040"
(gdb)
408-data-evaluate-expression "(uint32_t)((Thread *)536879040)->p_older"
408^done,value="536882000"
(gdb)
409-data-evaluate-expression "(uint32_t)((Thread *)536879040)->p_stklimit"
409^done,value="536879112"
(gdb)
410-data-evaluate-expression "(uint32_t)((Thread *)536879040)->p_ctx.r13"
410^done,value="536879396"
(gdb)
411-data-read-memory 536879112 x 4 1 284 .
411^done,addr="0x20002008",nr-bytes="1136",total-bytes="1136",next-row="0x20002478",prev-row="0x20001b98",next-page="0x20002478",prev-page="0x20001b98",memory=[{addr="0x20002008",data=["0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x0800131e","0x01000000","0x20001f58","0x08008ac1","0x20001f58","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x08001d1b","0x00000002","0x02001f58","0x00000008","0x20001fc0","0x00000020","0x08008b2f","0x00000000","0x20001f58","0x00000000","0x01008ac1","0x00000008","0x50000000","0x20001f58","0x04000000","0x20001fc0","0x08001353","0x20001fc0","0x08001f6d","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00002221","0x00000000","0x40002800","0x00000002","0x20000840","0x00000064","0x03938700","0x40000400","0x00000002","0x08043cf0","0x20002458","0x40004400","0x08000006","0x08043a0c","0x08043a18","0x000000ff","0x00000002","0x08043e90","0x00000000","0x40004c00","0x08002806","0x080439e8","0x08043a00","0x00000000","0x20003fac","0x2000292c","0x00000000","0x0800b761","0x00000000","0x0a07006a","0x03b40005","0x00000673","0x102710ad","0x00f30001","0x00010a64","0x00000000","0x00000000","0x20001e34","0x20001e34","0x00000040","0x200022f4","0x20003758","0x20004968","0x0803bf70","0x20002280","0xff140006","0x00000000","0xffffffff","0x20002264","0x20002268","0x20002268","0xffffffff","0x00000000","0x00000000","0x00000040","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x0800b9e1","0x00000000","0x0800b9e1","0x00000000","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x55555555","0x08001d1b","0x0000006d","0x0600233c","0x00000006","0x20002238","0x00000006","0x08001dff","0x0000012c","0x06002cd4","0x20001e24","0x2000552c","0x2000329c","0x0000003b","0x08001d21","0x20002238","0x00000020","0x080022ef","0x55555555","0x0000012c","0x00000000","0x0800ba8f","0x00000000","0x00000000","0x55555555","0x0255000a","0x20002238","0x08001353","0x20002238","0x08001d1b","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x00000000","0x20002458","0x20002458","0x00000001","0x20002464","0x20002464","0x00000001","0x20002470","0x20002470"],ascii="UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU........X.. ....X.. ................................X..........  .../.......X.. ...............PX.. ....... S...... m.......................!\".......(.@....@.. d..........@.....<..X$. .D.@.....:...:...........>.......L.@.(...9...:.......?. ,). ....a.......j.......s.....'.....d...........4.. 4.. @....\". X7. hI. p....\". ............d\". h\". h\". ............@...UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU................UUUUUUUUUUUUUUUUUUUUUUUU....m...<#......8\". ........,....,..$.. ,U. .2. ;...!...8\".  ....\"..UUUU,...................UUUU..U.8\". S...8\". ....................................................................................................................................................................................................................X$. X$. ....d$. d$. ....p$. p$. "}]
(gdb) 
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Eclipse debug plugin for ChibiOS/RT

Post by Giovanni »

Hard to tell, is it possible you are using more than the available RAM?

Make sure to enable debug options in chconf.h and see if something is caughts. Please also update to a more recent release, 2.6.8 or 3.0.0.

Giovanni
GSE
Posts: 3
Joined: Fri May 29, 2015 10:04 am

Re: Eclipse debug plugin for ChibiOS/RT

Post by GSE »

Try to test with 2.6.9 - same result.
All debug options in chconf.h was enabled.
RAM - ok.

Seems that happens one of unknown MIException while

Code: Select all

getMemories()[0].getData()
or

Code: Select all

(i < data.length)


Seems it would be a good idea to print MIException string with the "error reading memory at " .
Because seems that this problem inherited from org.eclipse.cdt.debug.mi.core.output.

Code: Select all

  public long scanStack(long base, long end, long pattern)
      throws DebugProxyException {
    if (mi_session.getMIInferior().isRunning())
      return -1;
    if (end > base) {
      MIDataReadMemory mem = cmd_factory.createMIDataReadMemory(0,
          Long.toString(base),
          MIFormat.HEXADECIMAL,
          4,
          1,
          (int)(end - base),
          '.');
      try {
        mi_session.postCommand(mem);
         MIDataReadMemoryInfo info = mem.getMIDataReadMemoryInfo();
         if (info != null) {
           long[] data = info.getMemories()[0].getData();
           int i = 0;
           while ((i < data.length) && (data[i] == pattern))
               i++;
           return i * 4;
         }
      } catch (MIException e) {}
      throw new DebugProxyException("error reading memory at " +
          base);
    }
    return 0;
  }
Post Reply