Thread: amxxdump
View Single Post
Author Message
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 03-21-2007 , 12:03   amxxdump
Reply With Quote #1

This is just a small tool I was working on for personal use, but I figured a couple people may find it useful so I made it a bit easier to use and got it to build on Windows.

This program is an amxmodx specific plugin disassembler. Specifically, plugins built with amxmodx 1.5+ (previous ones will not load).

This is meant to compliment Wraith's disassembler, not entirely replace it. My data section examination implementation is very poor (did it in about 5 minutes...), so it's better to use his for that regard. His also makes pseudo labels for jumps, this one just displays the address. Also his is in a nice GUI, this one is entirely console driven.

The biggest difference between the two disassemblers is this one was built with the sole purpose of looking up the plugin's symbol table. The symbol table (to my knowledge) was not in Small when Wraith made his disassembler.

For disassembly the symbol table is complete hax. You can view a variables exact offsets, the scope of the variable, the name, tags for it, dimensions, etc.

General usage:

As stated previous, this is ENTIRELY console driven. There is no GUI for this.

amxxdump file.amxx [ parameters ]

Here are the switches:

Quote:
-a Suppress address locations in most places.
-c Suppress all comments from disassembly.
-x List all public and stock functions and their parameters.
-n List all natives used by the plugin.
-D <name> Disassemble the provided function.
-d Disassemble the entire code section of the script.
-s Show all symbols.
-m Show required modules.
-r <name> Search for all references to the named function.
-R <name> Search for all references to the named native.
-v <val> Display the value of an address in the data section.
-A <size> In addition to -v, this dumps <size> many cells as an output.
-V <val> Display the value of an address in the data section as a string.
-F <val> Display the value of an address in the data section as a float.
-f Output the name of every file that included code (stocks).
-l Output line number and filename as comment on BREAK ops.
-j Output jump labels as comments for jumps, switches and case tables.
-e Attempt to estimate some data from push.c/const.pri ops. Do not read data literally.
-E Attempt to list parameters of standard native calls. Not all will work, requires include files.
-N Suppresses the variable dimensions, tags, and default values in the native guesser output. Implies -E
-g List all global variables. A pawn compiler bug will make not-used stock variables display as well.
-h Hide parameter numbers and addresses, useful for comparing with diffs.

-! Display this program's license.

-? This help screen.
For example, to output the assembly of the "cmdSlap" function in admincmd.amxx, I would do:

amxxdump admincmd.amxx -D cmdSlap

As stated before, the data viewing portion is very poorly implemented.

Just a warning, I haven't extensively tested the Windows build. The vast majority of my work has been with the Linux version.

v1.01, now with (hopefully!) less crashes on Windows, -f and -l (run with -? for details)
v1.02, now with -c (suppress all comments) and -j (generate pseudo labels for jumps)
v1.3, now with better Windows support, very basic SourceMod plugin support, and now with native parsing.
v1.3.1, fixed a few small quirks with the native parser
v1.3.2, fixed a few more quirks with the native parser
v1.4, more tweaks to the native parser, added comments to STACK and FILL ops, added comment when a variable scope begins. Added -g.
v1.5, fixed some crashes with the native parser on some awkward natives. Added -h, -N, and -A (consult -? for more details). Changed most address output (except for the disassembly itself) to be 0x%08X instead of 0x%X. Changed -m to give better output.
Attached Files
File Type: zip amxxdump.zip (424.7 KB, 12490 views)

Last edited by sawce the snail; 04-01-2007 at 10:33.
sawce is offline