I've created a plugin for the popular freeware debugger OllyDbg (www.ollydbg.de). It detects most main PowerBasic commands and makes disassemblies a lot easier to read and figure out where in your source code you are. Simply copy pbanalyzer.dll to your OllyDbg directory, then from within OllyDbg click on the Plugins > PowerBasic Analyzer menu, then Analyze (after you've loaded an executable of course).
If you've never tried OllyDbg before I highly recommend it! It is an amazingly advanced debugger (especially considering that it's freeware and written by just one very dedicated man). It really does make usermode-level debugging very easy - there's rarely a day that goes by when I don't use it.
The source is included in posts below, or there is an attachment at the very end of this post which can be downloaded. Because of the nature of this plugin I've decided not to include a pre-compiled DLL, so that if you want to use this plugin you must have the PB WIN compiler in order to compile the DLL yourself (this is a tool for PowerBasic developers, not non-PB'ers who simply want to make exe analysis easier).
The plugin itself only looks at compiled PB executables - it doesn't use source code files, so it doesn't matter whether or not you have the source code to the executable.
So how does it work, what does it do?
Consider for example the following program ...
It's a very simple program, yet the initial disassembly doesn't make anything too obvious about what it does:

However, after we apply the PB Analyzer it becomes a lot easier to see what it's doing (including the parameters being parsed to each function):

And here I've used Photoshop to help show the relationship between the source code and compilation:

Soon I hope to add string detection, so that for example this:
mov edx, pbexe.00431025
would be shown as this:
mov edx, pbexe.00431025 ;String "c:\file.txt"
(It's easy enough to determine from the address as to whether it's code or possible data such as a string)
If you've never tried OllyDbg before I highly recommend it! It is an amazingly advanced debugger (especially considering that it's freeware and written by just one very dedicated man). It really does make usermode-level debugging very easy - there's rarely a day that goes by when I don't use it.
The source is included in posts below, or there is an attachment at the very end of this post which can be downloaded. Because of the nature of this plugin I've decided not to include a pre-compiled DLL, so that if you want to use this plugin you must have the PB WIN compiler in order to compile the DLL yourself (this is a tool for PowerBasic developers, not non-PB'ers who simply want to make exe analysis easier).
The plugin itself only looks at compiled PB executables - it doesn't use source code files, so it doesn't matter whether or not you have the source code to the executable.
So how does it work, what does it do?
Consider for example the following program ...
Code:
FUNCTION PBMAIN () AS LONG LOCAL hFile AS DWORD hFile = FREEFILE OPEN "c:\file.txt" FOR OUTPUT AS #hFile PRINT #hFile, "The length of 'test' is " & TRIM$(STR$(LEN("test"))) CLOSE #hFile MSGBOX "Done!" END FUNCTION

However, after we apply the PB Analyzer it becomes a lot easier to see what it's doing (including the parameters being parsed to each function):

And here I've used Photoshop to help show the relationship between the source code and compilation:

Soon I hope to add string detection, so that for example this:
mov edx, pbexe.00431025
would be shown as this:
mov edx, pbexe.00431025 ;String "c:\file.txt"
(It's easy enough to determine from the address as to whether it's code or possible data such as a string)
Comment