General structure of disassembler
- From: "[jongware]" <jongware@xxxxxxxxxxxxxxxxx>
- Date: Mon, 30 Jan 2006 01:53:23 +0100
Hi all
I have a lot of hobbies, and one of these is writing disassemblers for
various CPUs and data file formats. Unfortunately I always seem to run into
the same problem: data representation!
The usual approach is to start with a fixed amount of undifferentiated
'source' -- usually large to *very* large (well in the Mb's). I want to
display this, and have the user (or the program itself) group bytes together
as opcodes, strings, data, whatever.
Additionally, I'd like to insert comments next to this defined bytes as well
as 'any' text on the lines immediately above or below (think labels and
such).
I have experimented both with flags connected directly to the source bytes,
and dumping the whole source into a linked list structure. The pro of the
first option is that display-to-offset is 1-1 -- the con being that (a)
either it is impossible to insert additional lines, or (b) with a flag
'additional lines available', each source byte has to be scanned for this
value whenever the cursor moves up or down a few lines. The pro of the
linked lists is that it's indifferent to line insertions. Each linked list
item knows to which source byte it points and how many of these are
'included' into its line -- a number which also may be zero. The con is,
we're talking about MBs here! On loading a large file creating the initial
(untagged) state costs seconds, even on my 3GHz, and when that's done moving
down to the end also takes a long time.
I have an idea about combining the two approaches (linked lists which may
also span multiple lines, thus circumventing the initial load delay) but I
foresee that when nearing complete disassembly almost every single byte will
have its own link -- again, thousands and thousands of linked list items, so
while initially the program may run like hell, at the end it will... run
like hell, I suppose.
Any idea's?
[Jongware]
.
- Follow-Ups:
- Re: General structure of disassembler
- From: [Jongware]
- Re: General structure of disassembler
- Prev by Date: Re: Retired programmer wants to learn programming
- Next by Date: Re: Retired programmer wants to learn programming
- Previous by thread: Web based graphical GNU diff
- Next by thread: Re: General structure of disassembler
- Index(es):
Relevant Pages
|