[uClibc] printf() (and others?) hang
Mark S. Mathews
mark at linux-wlan.com
Mon Jun 20 19:13:45 UTC 2005
One additional data point: we're hanging in _ppfs_prepargs() .
-M
On Fri, 17 Jun 2005, Mark S. Mathews wrote:
> Hi Folks,
>
> I've got a freescale mpc8541 target that's giving me fits. Basically any
> calls to *printf() hang (process appears to be lost in an infinite loop).
>
> I'm building the toolchain using buildroot (pulled from uclibc.org on
> 2005-02-11).
>
> Here's a description string of the toolchain:
> gcc-3.4.3-uClibc-0.9.27-binutils-2.15.91.0.2-linux-2.4.27-powerpc
>
> I've used this same toolchain successfully on x86, xscale, AMCC 405EP, and
> MPC850 targets. The 405 and 850 targets use the same toolchain binaries as
> the one I'm trying to use here.
>
> I've been through a lot of testing identifying what the problem is not:
>
> - kernel:
> nope, a rootfs built using a gnu libc based toolchain works just fine
> - blockdev or filesystem:
> nope, mtdblock+squashfs and nfsroot exhibit the same behavior
> - syscall or I/O problems (bad /dev files etc.)
> nope, open()/write()/close() and fwrite(stdout|stderr) all work
> - and the ever popular va_args...
> nope, the following program listed at the end of this mail works just
> fine all the way up to the printf(), staticly or dynamically linked.
> (I suppose the program could give a little more coverage of different
> types etc, this is how far I've gotten up to now)
> - newer uclibc:
> nope, rebuilt the toolchain using todays snapshot, same behavior.
>
> I have a couple of questions:
> - Has anyone seen anything like this before?
> - Are there any pointers for doing uClibc development, debugging,
> testing without having to do a full toolchain rebuild every time I
> change something? I'd like to add a little instrumentation to
> vfprintf to figure out where we're getting stuck, but it's getting a
> little time consuming. ;-)
>
> Thanks for listening,
> -Mark
>
> ------------------------------------------------------------
>
> // va_arg test program
>
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <stdarg.h>
>
> int f(int a, ...)
> {
> va_list ap;
> va_list ap1;
> int b;
> int i;
> char out[3];
>
> va_start(ap, a);
> va_copy(ap1, ap);
> for (i=0 ; i < a ; i++) {
> b=va_arg(ap1, int);
> out[0]='0'+b;
> out[1]='\n';
> out[2]='\0';
> fwrite(out,strlen(out), 1, stdout);
> }
> va_end(ap1);
> va_end(ap);
> return 0;
> }
>
> main()
> {
> int ttyS1;
> char avsstr1[]="(write)Running hello!\n";
> char avsstr2[]="(fwrite)Running hello!\n";
> char avsstr3[]="(fwrite,stderr)Running hello!\n";
> ttyS1=open("/dev/ttyS1", O_RDWR);
> write(ttyS1,avsstr1, strlen(avsstr1));
> close(ttyS1);
> f(1,1);
> f(2,1,2);
> f(3,1,2,3);
> f(4,1,2,3,4);
> f(5,1,2,3,4,5);
> f(6,1,2,3,4,5,6);
> f(7,1,2,3,4,5,6,7);
> f(8,1,2,3,4,5,6,7,8);
> f(9,1,2,3,4,5,6,7,8,9);
> f(10,1,2,3,4,5,6,7,8,9,10);
> fwrite(avsstr2, strlen(avsstr2), 1, stdout);
> fwrite(avsstr3, strlen(avsstr3), 1, stderr);
> printf("(stdout)Running hello!%d\n", 1);
> }
>
>
>
>
--
Mark S. Mathews
AbsoluteValue Systems Web: http://www.linux-wlan.com
721-D North Drive e-mail: mark at linux-wlan.com
Melbourne, FL 32934 Phone: 321.259.0737
USA Fax: 321.259.0286
More information about the uClibc
mailing list