* [9fans] Drawterm on Linux/PowerPC @ 2006-01-13 11:38 Sven Moritz Hallberg 2006-01-13 12:29 ` Eric Van Hensbergen 2006-01-13 13:57 ` erik quanstrom 0 siblings, 2 replies; 5+ messages in thread From: Sven Moritz Hallberg @ 2006-01-13 11:38 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 1690 bytes --] Hello 9fans, I've tried to get drawterm to work on my Linux/PowerPC machine. I _think_ I have "dt2k". I got it from this CVS repo: :pserver:anoncvs@cvs.pdos.csail.mit.edu/cvs drawterm (BTW, it was kind of hard to confirm that this -- appearently -- is in fact dt2k...) Unfortunately it doesn't work. The fmtprint functions seem to do stuff with va_lists that my system doesn't like. Specifically, fmtprint and many other functions try to assign va_list's to fields in a Fmt structure. This is simply rejected by my GCC (I tried versions 3.3, 3.4, and 4.0.2): gcc -Wall -Wno-missing-braces -ggdb -I.. -I../include -I../kern -c -I/usr/X11R6/include -D_THREAD_SAFE -pthread -O2 fmtprint.c fmtprint.c: In function 'fmtprint': fmtprint.c:20: error: incompatible types in assignment I tried to replace all the offending assignments with calls to memcpy: /* va = f->args; */ memcpy(&va, &(f->args), sizeof(va_list)); This results in successfull compilation, but immediately crashes drawterm: $ gdb ./drawterm [..snip..] (gdb) runStarting program: /home/pesco/Halde/drawterm/drawterm [Thread debugging using libthread_db enabled] [New Thread 805479776 (LWP 12368)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 805479776 (LWP 12368)] 0x10048500 in _runefmt (f=0x7fb7f3f8) at dofmt.c:234 234 x[0] = va_arg(f->args, int); I've read in http://www.cs.bell-labs.com/wiki/plan9/THM_2005-06-23_Summary/ that "[Ericvh] has [dt2k] working in ppc-linux". So: Eric, can I have your code? When will this find its way into the drawterm CVS? How can I help? Greetings, Sven Moritz [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 264 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] Drawterm on Linux/PowerPC 2006-01-13 11:38 [9fans] Drawterm on Linux/PowerPC Sven Moritz Hallberg @ 2006-01-13 12:29 ` Eric Van Hensbergen 2006-01-13 15:24 ` Sven Moritz Hallberg 2006-01-13 13:57 ` erik quanstrom 1 sibling, 1 reply; 5+ messages in thread From: Eric Van Hensbergen @ 2006-01-13 12:29 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On 1/13/06, Sven Moritz Hallberg <sm@khjk.org> wrote: > Hello 9fans, > > I've tried to get drawterm to work on my Linux/PowerPC machine. I > _think_ I have "dt2k". I got it from this CVS repo: > > :pserver:anoncvs@cvs.pdos.csail.mit.edu/cvs drawterm > > (BTW, it was kind of hard to confirm that this -- appearently -- is in > fact dt2k...) > > Unfortunately it doesn't work. The fmtprint functions seem to do stuff > with va_lists that my system doesn't like. Specifically, fmtprint and > many other functions try to assign va_list's to fields in a Fmt > structure. This is simply rejected by my GCC (I tried versions 3.3, 3.4, > and 4.0.2): > > gcc -Wall -Wno-missing-braces -ggdb -I.. -I../include -I../kern -c > -I/usr/X11R6/include -D_THREAD_SAFE -pthread -O2 fmtprint.c > fmtprint.c: In function 'fmtprint': > fmtprint.c:20: error: incompatible types in assignment > > I tried to replace all the offending assignments with calls to memcpy: > > /* va = f->args; */ > memcpy(&va, &(f->args), sizeof(va_list)); > > This results in successfull compilation, but immediately crashes drawterm: > > $ gdb ./drawterm > [..snip..] > (gdb) runStarting program: /home/pesco/Halde/drawterm/drawterm > [Thread debugging using libthread_db enabled] > [New Thread 805479776 (LWP 12368)] > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 805479776 (LWP 12368)] > 0x10048500 in _runefmt (f=0x7fb7f3f8) at dofmt.c:234 > 234 x[0] = va_arg(f->args, int); > > I've read in > > http://www.cs.bell-labs.com/wiki/plan9/THM_2005-06-23_Summary/ > > that "[Ericvh] has [dt2k] working in ppc-linux". So: > > > Eric, can I have your code? > > When will this find its way into the drawterm CVS? > > How can I help? > I'll dig up what I have and see about reving into to the most recent versions of drawterm and then sending a patch here. Essentially you were on the right path, but the wrong solution. man va_copy and look at the plan9ports fmtprint code for how to do this right on ppc/linux. I'll try to send something out today. -eric ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] Drawterm on Linux/PowerPC 2006-01-13 12:29 ` Eric Van Hensbergen @ 2006-01-13 15:24 ` Sven Moritz Hallberg 2006-01-13 22:38 ` C H Forsyth 0 siblings, 1 reply; 5+ messages in thread From: Sven Moritz Hallberg @ 2006-01-13 15:24 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs [-- Attachment #1.1: Type: text/plain, Size: 560 bytes --] Eric Van Hensbergen schrieb: > Essentially you were on the right path, but the wrong solution. > man va_copy and look at the plan9ports fmtprint code for how to do > this right on ppc/linux. Hah, I'm such an idiot, overlooked va_copy although it's right in the manpage. Anyway, I've replace the assignments with va_copy/va_end pairs, as in plan9ports and drawterm seems to work! At least it compiles, starts, and complains that I didn't tell it any server... :) Attached is the output of cvs diff. Thanks alot for the pointer, Sven Moritz [-- Attachment #1.2: drawterm-va_copy-patch.diff --] [-- Type: text/x-patch, Size: 2624 bytes --] Index: libc/fmtprint.c =================================================================== RCS file: /cvs/drawterm/libc/fmtprint.c,v retrieving revision 1.1 diff -r1.1 fmtprint.c 20c20,21 < va = f->args; --- > va_copy(va, f->args); > va_end(f->args); 27c28,29 < f->args = va; --- > va_copy(f->args, va); > va_end(va); Index: libc/fmtvprint.c =================================================================== RCS file: /cvs/drawterm/libc/fmtvprint.c,v retrieving revision 1.1 diff -r1.1 fmtvprint.c 20,21c20,23 < va = f->args; < f->args = args; --- > va_copy(va, f->args); > va_end(f->args); > va_copy(f->args, args); > va_end(args); 26c28,29 < f->args = va; --- > va_copy(f->args, va); > va_end(va); Index: libc/runevseprint.c =================================================================== RCS file: /cvs/drawterm/libc/runevseprint.c,v retrieving revision 1.1 diff -r1.1 runevseprint.c 18c18,19 < f.args = args; --- > va_copy(f.args, args); > va_end(args); Index: libc/runevsmprint.c =================================================================== RCS file: /cvs/drawterm/libc/runevsmprint.c,v retrieving revision 1.1 diff -r1.1 runevsmprint.c 60c60,61 < f.args = args; --- > va_copy(f.args, args); > va_end(args); Index: libc/runevsnprint.c =================================================================== RCS file: /cvs/drawterm/libc/runevsnprint.c,v retrieving revision 1.1 diff -r1.1 runevsnprint.c 18c18,19 < f.args = args; --- > va_copy(f.args, args); > va_end(args); Index: libc/vfprint.c =================================================================== RCS file: /cvs/drawterm/libc/vfprint.c,v retrieving revision 1.1 diff -r1.1 vfprint.c 29c29,30 < f.args = args; --- > va_copy(f.args, args); > va_end(args); Index: libc/vseprint.c =================================================================== RCS file: /cvs/drawterm/libc/vseprint.c,v retrieving revision 1.1 diff -r1.1 vseprint.c 18c18,19 < f.args = args; --- > va_copy(f.args, args); > va_end(args); Index: libc/vsmprint.c =================================================================== RCS file: /cvs/drawterm/libc/vsmprint.c,v retrieving revision 1.1 diff -r1.1 vsmprint.c 60c60,61 < f.args = args; --- > va_copy(f.args, args); > va_end(args); Index: libc/vsnprint.c =================================================================== RCS file: /cvs/drawterm/libc/vsnprint.c,v retrieving revision 1.1 diff -r1.1 vsnprint.c 18c18,19 < f.args = args; --- > va_copy(f.args, args); > va_end(args); [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 264 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] Drawterm on Linux/PowerPC 2006-01-13 15:24 ` Sven Moritz Hallberg @ 2006-01-13 22:38 ` C H Forsyth 0 siblings, 0 replies; 5+ messages in thread From: C H Forsyth @ 2006-01-13 22:38 UTC (permalink / raw) To: 9fans >Hah, I'm such an idiot, overlooked va_copy although it's right in the you're not an idiot. it's a late addition, very late (and i'm not so sure about the people that forced it to be added). ^ permalink raw reply [flat|nested] 5+ messages in thread
* [9fans] Drawterm on Linux/PowerPC 2006-01-13 11:38 [9fans] Drawterm on Linux/PowerPC Sven Moritz Hallberg 2006-01-13 12:29 ` Eric Van Hensbergen @ 2006-01-13 13:57 ` erik quanstrom 1 sibling, 0 replies; 5+ messages in thread From: erik quanstrom @ 2006-01-13 13:57 UTC (permalink / raw) To: 9fans, Sven Moritz Hallberg Sven Moritz Hallberg <sm@khjk.org> writes [...] | gcc -Wall -Wno-missing-braces -ggdb -I.. -I../include -I../kern -c | -I/usr/X11R6/include -D_THREAD_SAFE -pthread -O2 fmtprint.c | fmtprint.c: In function 'fmtprint': | fmtprint.c:20: error: incompatible types in assignment | | I tried to replace all the offending assignments with calls to memcpy: | | /* va = f->args; */ | memcpy(&va, &(f->args), sizeof(va_list)); try: (from plan9port) int fmtprint(Fmt *f, char *fmt, ...) { va_list va; int n; f->flags = 0; f->width = 0; f->prec = 0; va_copy(va, f->args); va_end(f->args); va_start(f->args, fmt); n = dofmt(f, fmt); va_end(f->args); f->flags = 0; f->width = 0; f->prec = 0; va_copy(f->args,va); va_end(va); if(n >= 0) return 0; return n; } - erik ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-01-13 22:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-01-13 11:38 [9fans] Drawterm on Linux/PowerPC Sven Moritz Hallberg 2006-01-13 12:29 ` Eric Van Hensbergen 2006-01-13 15:24 ` Sven Moritz Hallberg 2006-01-13 22:38 ` C H Forsyth 2006-01-13 13:57 ` erik quanstrom
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).