I post a patch for Linux PPC :
There is a bug in main() which cause an infinite loop since C type 'char' is unsigned on PPC.
Second is a bad use of va_start/va_end in std_sprintf() which crash on PPC.
Here is the patch (cannot post attachments ?):
diff -ru dbg_client-2.11.30/dbg/main.cpp dbg_client-2.11.30.jc/dbg/main.cpp
--- dbg_client-2.11.30/dbg/main.cpp 2004-09-07 14:01:58.000000000 +0200
+++ dbg_client-2.11.30.jc/dbg/main.cpp 2004-10-31 15:45:50.000000000 +0100
@@ -91,7 +91,7 @@
char c;
c = getopt_long_only (argc, argv, "", long_options, &option_index);
- if (c == EOF) break;
+ if (c == (char)EOF) break;
if (c == 0 && long_options[option_index].flag == 0) {
c = long_options[option_index].val;
diff -ru dbg_client-2.11.30/dbgbase/dbgbase_globals.cpp dbg_client-2.11.30.jc/dbgbase/dbgbase_globals.cpp
--- dbg_client-2.11.30/dbgbase/dbgbase_globals.cpp 2004-09-07 14:08:08.000000000 +0200
+++ dbg_client-2.11.30.jc/dbgbase/dbgbase_globals.cpp 2004-10-31 15:45:38.000000000 +0100
@@ -145,10 +145,11 @@
int sz, ret_val, i;
char *cbuf = NULL;
- va_start(args, format);
for (sz=512, i=0; i < 16; i++, sz=sz*2) {
cbuf = new char[sz];
+ va_start(args, format);
ret_val = vsnprintf(cbuf, sz, format, args);
+ va_end(args);
if (ret_val >= 0 && ret_val < sz) break;
delete cbuf;
cbuf = NULL;
@@ -159,7 +160,6 @@
} else {
buf = "";
}
- va_end(args);
return buf.length();
} |