pdbdec - palm database decompiler
pdbdec [-h -V -o file -w[01] -v[0-4] -l linebytes -F formatspec] file
pdbdec decompiles a binary Palm DataBase (PDB) file into text source file.
The text source file is in the pdbc(1) format.
- --help | -h | -?
-
Simple help text
- --verbose=0 | -v0
-
Verbose: off
- --verbose=1 | -v1
-
Verbose: normal level (default)
- --verbose=2 | -v2
-
Verbose: more info
- --verbose=3 | -v3
-
Verbose: a lot of info
- --verbose=4 | -v4
-
Verbose: way too much info
- --version | -V
-
Version information
- --warnings=1 | -w0
-
Supress warnings
- --warnings=1 | -w1
-
Don't supress warnings (default)
- --out=file | -o file
-
Output file
- --line-length=linebytes | -l linebytes
-
Number of bytes per line in data blocks (default=8)
- --format=formatspec | -F formatspec
-
Specifies the format of the decompiled data in the records.
The syntax of the formatspec is explained in detail below.
- --date-format=d | -Dd
-
In this mode all dates in the fileheader attributes are given in the
symbolic form: YYYY/mm/dd HH:MM:SS
- --date-format=v | -Dv
-
In this mode all dates in the fileheader attributes are given as
integer values.
- --template=template-file | -t template-file
-
Use file as template for the decompilation. (not yet implemented)
The -F option demands as argument a formatspec string.
The formatspec is a comma separated list of key=value pairs.
It specifies the format of the decompiled data in the records.
- value=byte (default)
-
Data is shown as a series of byte values.
- value=word
-
Data is shown as a series of word values (2 bytes).
- value=long
-
Data is shown as a series of long values (4 bytes).
- value=char
-
Data is shown as a series of ASCII characters (backslash escaped
if necessary).
- value=float
-
Data is shown as a series of float values (4 byte floating point).
- value=double
-
Data is shown as a series of double values (8 byte floating point).
- base=bin
-
Values are shown in binary format (base 2).
This is ignored if the 'value' specifier is not byte/word/long.
- base=oct
-
Values are shown in octal format (base 8).
This is ignored if the 'value' specifier is not byte/word/long.
- base=dec
-
Values are shown in decimal format (base 10).
This is ignored if the 'value' specifier is not byte/word/long.
- base=hex (default)
-
Values are shown in hexadecimal format (base 16).
This is ignored if the 'value' specifier is not byte/word/long.
- base=2-16
-
Values are shown in given base.
This is ignored if the 'value' specifier is not byte/word/long.
- comment=ascii (default)
-
After the values a comment showing the ASCII representation
is printed in a // comment.
Unprintable characters are shown as dot '.'.
This is similar to the way many hexdump tools show data.
This is ignored if the 'value' specifier is not byte/word/long.
- comment=none
-
No comment is printed.
- string=none (default)
-
Automatic string recognition is off.
- string=0-99
-
Automatic string recognition is on.
In this mode ASCII strings in the data are recognized by a simple heuristic.
If at least 'n' printable ASCII characters are found then they are
shown as a single quoted 'string'.
A value of 0 is equivalent to 'none'.
This is similar to the 'strings' tool on UNIX.
- stringchars=escaped
-
In this mode the automatic string recognition will treat the
backslash escapable characters () as ASCII chars and show them
in the single quoted strings.
This is especially useful if you have a lot of multiline
strings in the data.
This is ignored if the 'string' specifier is not 1-99.
- stringchars=standard
-
In this mode the automatic string recognition will treat the
backslash escapable characters () as unprintable data and show them
as integer values.
This is especially useful if you have a lot of singleline
strings in the data.
This is ignored if the 'string' specifier is not 1-99.
- date=date (default)
-
In this mode all dates in the fileheader attributes are given in the
symbolic form: YYYY/mm/dd HH:MM:SS
- date=value
-
In this mode all dates in the fileheader attributes are given as
integer values.
- linelen=0-999 (default=8)
-
On each line 'n' values our shown.
The automatic string recognition will start a new line
every time it switches from 'string' to integer representation.
A PDB file has some attributes
(e.g. a filename, creator and type id, ...)
and zero or more data records.
Optionally it can have 2 special data chunks
--- the appinfo and the sortinfo blocks.
Each data record has some record attributes and the
user data.
pdbdec converts binary PDB file into an ascii text source file.
For the syntax of the source file format consult pdbc(4).
Possible exit status values:
- Exit 0
-
Successful completion
- Exit 1
-
Missing sourcefile argument
- Exit 2
-
Unknown commandline option
- Exit 3
-
Commandline option error (e.g. missing option argument)
- Exit 4
-
Misc errors (e.g. missing files, file permissions)
- Exit 5
-
Error in binary PDB file.
- pdbdec -V
-
pdbdec 1.0
- pdbdec mystuff.pdb
-
pdbc(4),
pdbc(1),
EBNF Syntax of pdbc(4)
-
Option -t template-file is not yet implemented.
The idea of a template file is to write the decompiled output
in the form given by the template file.
The format of the template file is basically the same as
a normal source file.
Records from the binary pdb file are then decompiled in the
same form as a matching record given in the template file.
The values in the template file are then only place-holders
for the real values encountered in the binary pdb file.
Several extension to the normal pdbc file format will be
necessary to make template files useful.
Here some ideas:
- record matching.
Defines which template record matches a record in the pdb file.
- do, while, for, if, else.
Constructs to decompile complex structures correctly.
- variables, filled from the binary pdb file.
Allows complex structures (e.g. arrays) depending
on the data.
Please note: this is a brainstorm of a nice-to-have feature, not a promise.
Eric Obermuhlner (eric@obermuhlner.com)