|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: R T
Length: 4865 (0x1301) Types: TextFile Names: »READMETHREE«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦3f75c1919⟧ »EurOpenD3/utils/decomp.tar.Z« └─⟦510c4d5ee⟧ └─⟦this⟧ »decomp/READMETHREE«
Return-Path: reuter%cookie.DEC@decwrl.dec.com Received: by june.cs.washington.edu (5.52.1/6.11) id AA11965; Thu, 14 Jan 88 08:33:32 PST Received: by decwrl.dec.com (5.54.4/4.7.34) id AA21398; Thu, 14 Jan 88 08:33:06 PST Date: Thu, 14 Jan 88 08:33:06 PST Message-Id: <8801141633.AA21398@decwrl.dec.com> From: reuter%cookie.DEC@decwrl.dec.com (Chocolate helps prevent cavities!) To: pardo@june.cs.washington.edu Subject: decomp fixes Goodness. Believe it or not, I never tried decompiling a linked C program. I only worked with object modules. The problem is that the decompiler does not recognize the "exit" system call as a basic block terminator. This would have been just fine if the exception handling cases had been written correctly, but they weren't. Here are the fixes to the exception code, supplied as "diff -c" output for the modules "blocks.c" and "nodes.c". Jim *** blocks.c.old Wed Jan 13 12:40:46 1988 --- blocks.c Wed Jan 13 12:43:37 1988 *************** *** 14,19 #include "objfile.h" #include "vartab.h" #include "nodes.h" static int op_argval[6]; --- 14,20 ----- #include "objfile.h" #include "vartab.h" #include "nodes.h" + #include <setjmp.h> + extern jmp_buf badbranch; + static int op_argval[6]; *************** *** 294,300 } } /* no more code in function */ ! if ( cur_address > node_entry ) fprintf( stderr, "Dangling function end\n" ); } --- 297,303 ----- } } /* no more code in function */ ! if ( cur_address > node_entry ) { fprintf( stderr, "Dangling function end\n" ); + longjmp( badbranch, 1 ); + } } *** nodes.c.old Wed Jan 13 12:41:03 1988 --- nodes.c Wed Jan 13 12:35:59 1988 *************** *** 79,84 register struct node *n; register int i, j; node_max = node_count * 4; node_array = (struct node **) malloc( node_max * sizeof( struct node * ) ); if ( node_array == NULL ) { --- 79,89 ----- register struct node *n; register int i, j; + if ( node_count <= 0 ) { + fprintf( stderr, "Bad node_count in array_nodes()\n" ); + longjmp( badbranch, 1 ); + } + node_max = node_count * 4; node_array = (struct node **) malloc( node_max * sizeof( struct node * ) ); if ( node_array == NULL ) { Return-Path: ucsd!spsd!felix!art@beaver Received: from beaver.cs.washington.edu by june.cs.washington.edu (5.61/7.0j) id AA22653; Mon, 2 Oct 89 12:27:47 -0700 Received: by beaver.cs.washington.edu (5.61/7.0) id AA19694; Mon, 2 Oct 89 12:27:37 -0700 Received: from spsd.UUCP by ucsd.edu; id AA26715 sendmail 5.61/UCSD-2.0-sun via UUCP Mon, 2 Oct 89 11:45:39 -0700 for june.cs.washington.edu!pardo Received: by spsd.CEO.DG.COM (smail2.5) id AA21848; 30 Sep 89 11:49:07 PDT (Sat) Received: from fritz.UUCP (fritz.ARPA) by felix.UUCP (4.12/5.17) id AA22718; Sat, 30 Sep 89 07:27:59 pdt Received: by fritz.UUCP (1.2/5.17) id AA03974; Sat, 30 Sep 89 07:26:42 pdt From: ucsd!felix!art@beaver (Art Dederick) Message-Id: <8909301426.AA03974@fritz.UUCP> To: spsd!ucsd!uw-beaver!june.cs.washington.edu!pardo@beaver Subject: Re: decomp, #2 Date: Sat, 30 Sep 89 07:26:41 PDT Second try on this message, not sure you got the first attempt. Send me an ACK if you get either message. Thanks. Found the segmentation bug. I was very stupid and didn't save the original code so I can't make diffs, sorry about that. The fix was easy, just add the following code to the beginning of free_nodes(): if (node_count && node_array == NULL) { fprintf(stderr, "free_nodes: node_count > 0 && node_array == NULL\n"); return; } I don't know why the node count would be non-zero but the node array by empty. You could probably explain it (hint hint :-). In addition, I added code to remove .o file usage from an a.out file. I kept getting function names like foo.o() instead of main(). Add the following code to decomp(): for (i = 0; i < nsym / sizeof(struct nlist); i++) { if ( ((symtab+i)->n_type & ~1) == 4 ) { | char *p, *rindex(); | | p = rindex(&strtab[(symtab+i)->n_un.n_strx], 'o'); | if (!p || p[-1] != '.') glb_add( (symtab+i)->n_value, i, 1 - ((symtab+i)->n_type & 1) ); } } This code will skip all entries in the symbol table that have a ".o" suffix. Another area I am currently trying to improve is function calling labels when decompiling a.out files. Currently only when a .o file is decompiled will references to functions use the name of the function. What I am attempting to do is search for the functions address in the symbol table when a call is made and use the name instead of the 'Gnnnn' label. So far I'm stumped. __ __ / ) _/_ / ) / / /--/ __ / / / _ __/ _ __ o _. /_ / (_/ (_<__ /__/_</_(_/_</_/ (_<_(__/ <_ felix!art (714)966-3618