[comp.sys.hp] a dissassembler for the unix-pc

alex@umbc3.UMD.EDU (Alex S. Crain) (10/06/88)

	I took the COFF version of the unc program that lenny posted last 
week and taught it about SGS (specifically 3b1) syntax, and a few other 
things. It now does the following things:

	1) Generates valid SGS assembly code, with all available symbols.
	2) Copes with the shared library. code compile with the shared
	library will have the shared library symbols appear in the output,
	addresses > 0x300000 are considered constants.
	3) Replace valid pc reletive addresses with labels, so that
			jsr 66(%pc)
			...
			link %fp,&4
	becomes
			jsr TL133
			...
		TL133:
			link %fp,&4
	4) Decode Switch statements. the unixpc assembler requires an illegal
	instruction to preceed jump tables, which would decode to tas &<xxx>,
	where xxx is the size of the table offset. the dissassembler uses this
	to realize that a jump table is happening and insert labels at all the
	appropriate places.

	The dissassembler surely still has one or two bugs, but I don't have
anymore time right now, so out it goes. I was able to do

		% unstrip ln
		% dis a.out > ln.s
		% vi ln.s 	# have to insert a global _start symbol
				# at the start of the file.
		% as ln.s
		% ld /lib/shlib.ifile ln.o -o ln

the resulting file worked fine. I didn't pursue the concept of rebuilding
the world with this thing any furthur :-). I will gladly accept bug reports
and will post patches as I create them.

	The dissassembler should work fine for any SGS/COFF file, although
the shlib and swbeg stuff is unix-pc specific. Should be ok for the small
hp-9k machines (no 680[23]0 support).

	I have posted the files to unix-pc.sources. I wonder about the
distribution of that group, and I really don't want to distribute this
thing by mail, so if I get a bunch of requests from people for the source,
I will send it off the comp.sources.misc.


-- 
					:alex.
					Systems Programmer
nerwin!alex@umbc3.umd.edu		UMBC
alex@umbc3.umd.edu

richard@uhccux.uhcc.hawaii.edu (Richard Foulk) (10/07/88)

} 	I have posted the files to unix-pc.sources. I wonder about the
} distribution of that group, and I really don't want to distribute this
} thing by mail, so if I get a bunch of requests from people for the source,
} I will send it off the comp.sources.misc.

I know it's not strictly a sources group but since comp.sys.att enjoys
much wider readership than unix-pc.sources it would seem to make
sense to cross-post sources there.  That follows the general conventions
used with other groups.

Waiting for things to make it through the moderated sources groups
is a real pain.

Richard