It is currently Mon Oct 20, 2014 5:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Active disassembler
PostPosted: Thu Jun 04, 2009 10:32 am 
Offline
User avatar
 Profile

Joined: Thu Jun 04, 2009 10:12 am
Posts: 11
Hello world!

Having spoken to people about lost source code at the RCM do I got to thinking. What about a disassembler that ran as your program did?

Imagine an emulator which output disassembled source to a database (in the loose sense) whilst the target code was running. It could do dynamic analysis of the code's behaviour as well as simply showing the listing. Data regions would be obvious. Other less obvious metadata would emerge: it would know destinations of calculated jumps, where areas of self-modifying code live, the memory ranges that particular code touches, and a few other real neat things that I forgot in all the excitement.

At the end of an instrumented run there may be a few holes in the listing/map. These could then be filled in using a static disassembly from the original binary.

Just a thought.

-Charlie


Top
 
 Post subject: Re: Active disassembler
PostPosted: Thu Jun 04, 2009 12:00 pm 
Offline
User avatar
 WWW  Profile

Joined: Thu Apr 03, 2008 2:49 pm
Posts: 277
Location: Antarctica
Not a bad idea, be nice to have some profiling stuff on the go, I have a few, ahem, performance problems myself at the moment.

Rich did a fancy disassembler which included labels and what not a while back - perhaps that could be of some help?

I've also got a modified version of BeebAsm which prints out cycle counts used by instructions - potentially could use some of that data to feed into your tool? I dunno.

Welcome aboard anyway, nice to meet you the other day too :)


Top
 
 Post subject: Re: Active disassembler
PostPosted: Thu Jun 04, 2009 12:55 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
It was my friend Matt who did most of the work actually, I just contributed design ideas.

I'm just asking him now if he'd be happy for me to release it as it stands - i.e. unfinished, executable-only, with no documentation. However I can throw in the beginnings of a disassembly I started for Chuckie Egg, which would hopefully demonstrate to some degree how it should be used.

I don't have the C# source code at the moment, but of course I'd throw it in if it gets a proper release, and maybe someone can finish it off.


Top
 
 Post subject: Re: Active disassembler
PostPosted: Thu Jun 04, 2009 2:07 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
And here is the old thread.

The idea of a disassembler / profiler which builds its output by literally running the game is an interesting one, and it would certainly get around a few of the shortcomings of traditional labelling disassemblers, whilst throwing in a bit of profiling for free!

The Windows app that Matt wrote allows you to load an executable file from a Beeb disc image, relocate it by hand to the appropriate place in memory, and then start disassembling from one or more entry points as chosen by the user. It performs a very basic type of execution, in that it follows jumps and branches, but nothing more clever (so it can't, for example, work out the jump destination of a self-modified JMP).

Anyway, Matt's given me his blessing to release what there is, so without further ado, I present:

6502Dis!!!

I've thrown in a project file for Chuckie Egg which I started to create. Maybe it'll be enough to show you how it's designed to work. Note that you can mark operands as the LSB or MSB of a label, and can also mark appropriate parts of the executable as 'strings', 'byte data' or 'word data'. Anyone struggling to understand how it works, add your questions below :)

Sometime I'll add a proper wiki entry for it, and all that stuff.

Edit: Just to say, that there'll be a 'proper' release one day with full C# source, so that anyone so inclined can finish it off and add essentials like 'output as assembler source code' and suchlike.


Attachments:
File comment: 6502Dis, a labelling 6502 disassembler for Windows, by Matt Godbolt.
6502Dis.zip [513.63 KiB]
Downloaded 33 times


Last edited by RichTW on Thu Jun 04, 2009 2:28 pm, edited 1 time in total.
Top
 
 Post subject: Re: Active disassembler
PostPosted: Thu Jun 04, 2009 2:15 pm 
Offline
User avatar
 WWW  Profile

Joined: Thu Apr 03, 2008 2:49 pm
Posts: 277
Location: Antarctica
Excellent, good work Rich!

I've just emailed you the source for the cycle counts on BeebAsm, I dunno whether you'll dictate it to be of any use or not, but have a shufty....


Top
 
 Post subject: Re: Active disassembler
PostPosted: Fri Jun 05, 2009 9:37 am 
Offline
User avatar
 Profile

Joined: Thu Jun 04, 2009 10:12 am
Posts: 11
Excellent, I (heart) chuckie egg!

(doesn't everyone? 8-) )

I'll enjoy having a play with this. I'll put it to the last chunk of 6502 that I wrote - being the firmware for the atom mmc interface - and drive it that way. I know the code so it will help with the unfamiliarity of the new tool. Always best to have at least one known value in an equation, eh?!

Having metadata associated with the disassembly allows really neat stuff - like call graphs and profiling.

Automatically generating this data gives the volume, and having a manual side to it will assure the quality - so i think a hybrid approach is necessary (see: Google search results - the machines scrape it, the humanoids clean it up). Maybe this tool can form the core?

<scratches chin>

Anyone got a time dilator?


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron