This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

re: pthreads on i686 PC.


> pthread_create(&thread_id, NULL, callFunction,
NULL);

I recently had a very similar problem.  

pthread_create() crashed my system when a pthread was
created with the NULL attribute ... if the parent was 
not a pthread. The problem seemed to lie with the
inheritance of attributes from the parent thread to
the child thread when using a NULL attribute (bad
pointer dereferences).

I'm using a rather old version of eCos. A patch was
applied around June 2003 that may have changed the
behavior (an assert instead of a crash, if I remember
correctly).

Cheers,
Tim.



-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On
Behalf Of Jason Thomas
Sent: Friday, March 19, 2004 10:12 AM
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] pthreads on i686 PC.


   I'm trying to use pthreads on eCos for a Xycom i686
PC. The normal cyg threading routines work perfectly,
but very simply pthread examples crash on
pthread_create.

Here is my source:
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
void* callFunction(void*);
void cyg_user_start(void)
{

  pthread_t thread_id;
  void* thread_result;
  puts("Here");
  pthread_create(&thread_id, NULL, callFunction,
NULL);
}
void* callFunction(void* arg)
{
  puts("I've been called!");
  return arg;
}


Also, I tried using gdb remotely to try to figure out
what exactly was going on, but for some odd reason the
symbol table never gets loaded.

I run i386-elf-gdb

(gdb) file Test.srec
Reading symbols from Test.srec...done.
(gdb) target remote <ip>:9000
Remote debugging using 155.101.22.185:9000
0x0000c158 in ?? ()
(gdb) load
Loading section .sec1, size 0x33642 lma 0x108000
Loading section .sec2, size 0x2bdc lma 0x13b648
Loading section .sec3, size 0xff8 lma 0x13e228
Start address 0x108000, load size 225814
Transfer rate: 258073 bits/sec, 319 bytes/write.
(gdb) break callFunction
No symbol table is loaded.  Use the "file" command.

I build all of my source using the -g command.

Also, a clue towards what might be happening is if I
stick "pthread_exit(NULL)" in "callFunction," the
computer hard resets. Maybe the main-thread of
execution somehow gets killed by this call?

Thanks in advance for any help!
-Jason Thomas.

-- 
Before posting, please read the FAQ:
http://ecos.sourceware.org/fom/ecos
and search the list archive:
http://ecos.sourceware.org/ml/ecos-discuss



__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]