Hi Alan,


I might be able to help:

Could you provide a list of what order you give GDB/OpenOCD commands and which 
GDB-Remote commands/responses you see?

If you haven't already, I suggest putting packet prints into gdb_put_packet() 
and gdb_input_inner().



Attached is a trace from my system with FreeRTOS.



The way I did it in the RTOS's was that if the current thread was set to 0 or 1 
then it returned the current running context (i.e. the true register values). 
This seems to avoid the problem you're having.





Some notes regarding RTOS awareness:

*         You may need to fix the GDB bug described in 
http://sourceware.org/bugzilla/show_bug.cgi?id=12648

*         Generally you will want to make your OpenOCD script blank the device 
memory so that the RTOS awareness does not read old, invalid thread information



Regards,



Evan Hunter













Date: Tue, 24 May 2011 21:59:55 +0100

From: Alan Bowman 
<alan.michael.bow...@gmail.com<mailto:alan.michael.bow...@gmail.com>>

To: 
openocd-development@lists.berlios.de<mailto:openocd-development@lists.berlios.de>

Subject: [Openocd-development] Provisional eCos RTOS support

Message-ID: 
<banlktinhpe7tfzax78cuk1w_2z0_3yk...@mail.gmail.com<mailto:banlktinhpe7tfzax78cuk1w_2z0_3yk...@mail.gmail.com>>

Content-Type: text/plain; charset="iso-8859-1"



I have been trying to add eCos/Cortex-M3 RTOS support to OpenOCD, and

have some code that seems to go some way toward doing the right thing.

The first patch adds that support - it contains a new file (based

heavily on the existing ThreadX/FreeRTOS model) to parse the thread

list.  It's not the most efficient - it iterates over a linked list

twice - once to count the entries and once to parse out the

information.  I couldn't see an explicit thread count variable to

parse, and I wanted to keep the code as similar to previous to

minimise my chances of making mistakes.  I have also added a different

register-stacking structure in another file.



With that first patch in place, I found GDB would display the thread

list with "info threads" but would then become unstable (as described

in a previous email).  I found that when GDB requested the current

thread ("qC") OpenOCD always replied with a generic response ("QC0").

I altered this to try to report the actual current thread, as in the

second patch.  The first time GDB runs up, the instability still

occurs, since the request is sent before OpenOCD has parsed the thread

data.  Stopping GDB and restarting it then seems to work OK, since a

current thread value is retained in OpenOCD's rtos data structure from

the last session.  This seems like the wrong behaviour, but is

coincidentally sufficient to prevent GDB from complaining.  I'd be

interested to hear if anyone has seen similar behaviour with other

RTOSs.



Testing for these patches has been performed using top-of-trunk eCos

running in a ROM startup configuration from a board like an

STM3210E-EVAL (but only using internal RAM).  I've been using the

thread<x> test programs that are part of the kernel test suite as test

applications.



I'm not sure how to take this further - I'm not sufficiently familiar

with GDB to diagnose the problem I'm seeing with the current-thread

reporting, but I want to put eCos support in front of others to get

some feedback.



Alan

-------------- next part --------------

A non-text attachment was scrubbed...

Name: 0001-Add-eCos-Cortex-RTOS-support.patch

Type: application/octet-stream

Size: 19262 bytes

Desc: not available

URL: 
<https://lists.berlios.de/pipermail/openocd-development/attachments/20110524/2396f62b/attachment.obj>

-------------- next part --------------

A non-text attachment was scrubbed...

Name: 0002-Report-actual-current-thread.patch

Type: application/octet-stream

Size: 950 bytes

Desc: not available

URL: 
<https://lists.berlios.de/pipermail/openocd-development/attachments/20110524/2396f62b/attachment-0001.obj>



------------------------------

req  : qSupported
reply: 
PacketSize=3fff;qXfer:memory-map:read+;qXfer:features:read-;QStartNoAckMode+
req  : QStartNoAckMode
reply: OK
req  : Hg0
reply: OK
req  : ?
reply: S02
req  : Hc-1
reply: OK
req  : qC
reply: QC0
req  : qAttached
reply: 1
req  : qOffsets
reply: Text=0;Data=0;Bss=0
req  : g
reply: 
00000000a5a5a5a5a5a5a5a501000000a5a5a5a5a5a5a5a5a5a5a5a5c8460020a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5700a0020ffffffff31010008000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000020000001Z
req  : qXfer:memory-map:read::0,fff
reply: l<memory-map>
<memory type="ram" start="0x0" length="0x8000000"/>
<memory type="flash" start="0x8000000" length="0x80000">
<property name="blocksize">0x800</property>
</memory>
<memory type="ram" start="0x8080000" length="0xf7f80000"/>
</memory-map>

req  : m8000130,4
reply: 00f072b8
req  : qSymbol::
reply: qSymbol:5f74785f7468726561645f63757272656e745f707472
req  : qSymbol::5f74785f7468726561645f63757272656e745f707472
reply: qSymbol:5f74785f7468726561645f637265617465645f707472
req  : qSymbol::5f74785f7468726561645f637265617465645f707472
reply: qSymbol:5f74785f7468726561645f637265617465645f636f756e74
req  : qSymbol::5f74785f7468726561645f637265617465645f636f756e74
reply: qSymbol:707843757272656e74544342
req  : qSymbol:20000ab0:707843757272656e74544342
reply: qSymbol:707852656164795461736b734c69737473
req  : qSymbol:20000ab4:707852656164795461736b734c69737473
reply: qSymbol:7844656c617965645461736b4c69737431
req  : qSymbol:20000b18:7844656c617965645461736b4c69737431
reply: qSymbol:7844656c617965645461736b4c69737432
req  : qSymbol:20000b2c:7844656c617965645461736b4c69737432
reply: qSymbol:707844656c617965645461736b4c697374
req  : qSymbol:20000b40:707844656c617965645461736b4c697374
reply: qSymbol:70784f766572666c6f7744656c617965645461736b4c697374
req  : qSymbol:20000b44:70784f766572666c6f7744656c617965645461736b4c697374
reply: qSymbol:7850656e64696e6752656164794c697374
req  : qSymbol:20000b48:7850656e64696e6752656164794c697374
reply: qSymbol:785461736b7357616974696e675465726d696e6174696f6e
req  : qSymbol:20000b5c:785461736b7357616974696e675465726d696e6174696f6e
reply: qSymbol:7853757370656e6465645461736b4c697374
req  : qSymbol:20000b74:7853757370656e6465645461736b4c697374
reply: qSymbol:757843757272656e744e756d6265724f665461736b73
req  : qSymbol:20000b88:757843757272656e744e756d6265724f665461736b73
reply: OK
req  : qfThreadInfo
reply: m0000000000000001
req  : qsThreadInfo
reply: l
req  : qThreadExtraInfo,1
reply: 43757272656e7420457865637574696f6e
req  : vCont?
reply:
req  : Hc0
reply: OK
req  : c
reply: T02
req  : g
reply: 
00000000a5a5a5a5a5a5a5a501000000a5a5a5a5a5a5a5a5a5a5a5a5c8460020a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5c8460020892900089d290008000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000020000061!
req  : m800299c,4
reply: f2e700bf
req  : m200046c0,40
reply: 
c846002089290008a5a5a5a500000000a5a5a5a500000000a5a5a5a5090400004f627461696e696e6720495020616464726573732076696120444843500d0a53
req  : T1
reply: E01
req  : qfThreadInfo
reply: m0000000020004600,0000000020005108,0000000020004bb8,00000000200031b0
req  : qsThreadInfo
reply: l
req  : qThreadExtraInfo,200031b0
reply: 6170705f746872656164
req  : Hg200031b0
reply: OK
req  : g
reply: 
00000000b43100200000001004ed00e0a5a5a5a5a5a5a5a5a5a5a5a5f4440020a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a500000000f444002091160008f82c0008000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000061
req  : m8002cf8,4
reply: 80bc7047
req  : qThreadExtraInfo,20004bb8
reply: 74637069705f746872656164
req  : Hg20004bb8
reply: OK
req  : g
reply: 
00000000bc4b00200000001004ed00e0a5a5a5a5a5a5a5a5a5a5a5a5f44e0020a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5e8000020f44e002091160008f82c0008000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000061
req  : m8002cf8,4
reply: 80bc7047
req  : qThreadExtraInfo,20005108
reply: 5749434544
req  : Hg20005108
reply: OK
req  : g
reply: 
000000000c5100200000001004ed00e0a5a5a5a5a5a5a5a5a5a5a5a5f4520020a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a550310020f452002091160008f82c0008000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000061
req  : m8002cf8,4
reply: 80bc7047
req  : qThreadExtraInfo,20004600
reply: 49444c45203a20203a2052756e6e696e67
req  : Hg20004600
reply: OK
req  : g
reply: 
00000000a5a5a5a5a5a5a5a501000000a5a5a5a5a5a5a5a5a5a5a5a5c8460020a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5c8460020892900089d290008000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000020000061!
req  : m800299c,4
reply: f2e700bf
req  : m200046c0,40
reply: 
c846002089290008a5a5a5a500000000a5a5a5a500000000a5a5a5a5090400004f627461696e696e6720495020616464726573732076696120444843500d0a53
arm-none-eabi-gdb XXXXX.elf

GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from XXXXX.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
reset_handler () at XXXXX.s:141
141       b _start
(gdb)
(gdb) info threads
* 1 Thread 1 (Current Execution)  reset_handler () at XXXXX.s:141
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
prvIdleTask (pvParameters=0x0) at RTOS/FreeRTOS/ver6.1.0/Source/tasks.c:1864
1864            }
(gdb) info threads
[New Thread 536888832]
[New Thread 536891656]
[New Thread 536890296]
[New Thread 536883632]
  5 Thread 536883632 (app_thread)  0x08002cf8 in vPortYieldFromISR () at 
RTOS/FreeRTOS/ver6.1.0/Source/portable/GCC/ARM_CM3/port.c:198
  4 Thread 536890296 (tcpip_thread)  0x08002cf8 in vPortYieldFromISR () at 
RTOS/FreeRTOS/ver6.1.0/Source/portable/GCC/ARM_CM3/port.c:198
  3 Thread 536891656 (WICED)  0x08002cf8 in vPortYieldFromISR () at 
RTOS/FreeRTOS/ver6.1.0/Source/portable/GCC/ARM_CM3/port.c:198
  2 Thread 536888832 (IDLE :  : Running)  prvIdleTask (pvParameters=0x0) at 
RTOS/FreeRTOS/ver6.1.0/Source/tasks.c:1864

The current thread <Thread ID 1> has terminated.  See `help thread'.
(gdb)









































































































































































































































































































































































_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to