johnfredcee wrote
on October 5th, 2007 at 10:03 am

Change Class

I recently had a similar dilemma parsing elf files.

Once I'd read all the sections of the file, I had an array of elf-section objects. Some of the sections have quite complicated semantics (eg relocation entries referencing symbols, symbol names, and some other code/data section) that couldn't really be accounted for while the sections were being read.

So I had two options - do a second pass over the sections, chaging them to a more specialised type than elf-section and have specific methods specialise on these for symbol lookup, or string lookup or whatever, or just have a number of different methods for retreiving different things specialised only to the base section type.

I went with this but I'm beginning to think it was the wrong decision in terms of long-term extensibility - it would be better to have the sections specialise themselves as there are many possible types: ultimately it's a means of reducing the combinatorial explosion becaue the section-entry acessors specialise only on what they have to and not on the general case and validate they are used correctly.



(Read Comments)

No HTML allowed in subject

  
 
   
 

Notice! This user has turned on the option that logs your IP address when posting. 

(will be screened)

August 2014

S M T W T F S
     12
3456789
10111213141516
17181920212223
24252627282930
31      
Powered by LiveJournal.com