From mboxrd@z Thu Jan 1 00:00:00 1970 From: Motoya Kurotsu To: ecos-discuss@sources.redhat.com Subject: [ECOS] diag_printf, long long Date: Thu, 12 Jul 2001 20:35:00 -0000 Message-id: <20010713122744.A1139@white.office1> X-SW-Source: 2001-07/msg00393.html Hi, I guess that diag_printf can't handle long long type of integers, at least as far as with the gcc for 32 bit mips. Below is the program to prove it. #include // diag_printf #include // printf void cyg_user_start(void) { unsigned long t1=0xaa00aa00; unsigned long long t2=0x22002200bb00bb00; unsigned long long t3=0x33003300cc00cc00; diag_printf("diag : t1:%16lx t1:%16llx t3:%16llx\n",t1,t2,t3); printf("stdio: t1:%16lx t1:%16llx t3:%16llx\n",t1,t2,t3); diag_printf("diag : t2:%16llx t1:%16lx t3:%16llx\n",t2,t1,t3); printf("stdio: t2:%16llx t1:%16lx t3:%16llx\n",t2,t1,t3); diag_printf("diag : t2:%16llx t3:%16llx t1:%16lx\n",t2,t3,t1); printf("stdio: t2:%16llx t3:%16llx t1:%16lx\n",t2,t3,t1); for(;;); } The attachment is my patch for this problem. I think this works with 32-bit compiler. But I suspect it does so with 64 bit compiler. If you find anything or have better idea, please suggest me. Thank you in advance. Regards, Motoya Kurotsu Alilled Telesis K.K. ----------------------------------------------- --- diag.cxx.orig Thu Jul 12 13:53:32 2001 +++ diag.cxx Thu Jul 12 14:34:56 2001 @@ -262,6 +262,9 @@ externC void diag_vprintf( const char *fmt, CYG_ADDRWORD *args) { + + cyg_bool pad = true; + if( !diag_check_string(fmt) ) { int i; @@ -309,6 +312,13 @@ } } + if (long_op) { + if(pad) args++; + pad=false; + } else { + pad=!pad; + } + switch( c ) { case 'd':