I am (slowly) progressing with eCos thread support, and I have found
another possible bug that I'd like to check.

At the start of rtos_get_gdb_reg_list() in src/rtos/rtos.c, the if()
statement checks a series of conditions, including that
current_threadid is neither 0 or 1.  I think that the 0 is the case
where the current thread has not been updated, but I'm not sure why
the test for 1.  Should it instead be a test for -1 (the
initialisation value for the global variable) to check whether it has
been updated at all?  If so, the attached patch corrects the test.

I noticed this because I am using the unique_id parameter in eCos
threads as the thread_id, as opposed to the address of the task
control block as is used in the FreeRTOS example.  I assume this is a
valid value - I assumed that any unique number could be used to
represent the threads.  Is there a reason why GDB should care?  The
first time I issue "info threads" to GDB having stopped my target
while several threads are running, it will print a list of threads
with the correct name and state.  However, the current location seems
wrong for some (if not all) of them, and none of them have an asterisk
to show which thread is current.  GDB dies immediately after that, and
I'm a little confused why.  I can only think that it's expecting
information about some other thread that it thinks is the current one.
 There are no other threads than those it lists.  thread0 is current
at this point.

The text it shows is below:

(gdb) info threads
[New Thread 4]
[New Thread 1]
[New Thread 2]
[New Thread 3]
  5 Thread 3 (thread 0 :  : Running)  entry0 (data=222) at
/home/alan/ecos-tools/ecos_hg/packages/kernel/current/tests/thread1.cxx:94
  4 Thread 2 (main :  : Running)  Cyg_HardwareThread::thread_entry
(thread=0x2000504c) at
/home/alan/ecos-tools/ecos_hg/packages/kernel/current/src/common/thread.cxx:84
  3 Thread 1 (Idle Thread :  : Running)
Cyg_HardwareThread::thread_entry (thread=0x20002efc) at
/home/alan/ecos-tools/ecos_hg/packages/kernel/current/src/common/thread.cxx:84
  2 Thread 4 (thread 1 :  : Suspended)
Cyg_HardwareThread::thread_entry (thread=0x200025b4) at
/home/alan/ecos-tools/ecos_hg/packages/kernel/current/src/common/thread.cxx:84
/home/test/src/toolchains/gdb/gdb-6.8.50.20080706/gdb/thread.c:561:
internal-error: print_thread_info: Assertion `current_thread != -1 ||
!thread_list' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

If anyone can offer any suggestions I'd appreciate it.

Alan

Attachment: 0001-Corrected-test-for-invalid-current_threadid.patch
Description: Binary data

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

Reply via email to