Objdump

In this article. The Microsoft COFF Binary File Dumper (DUMPBIN.EXE) displays information about Common Object File Format (COFF) binary files. You can use DUMPBIN to examine COFF object files, standard libraries of COFF objects, executable files, and dynamic-link libraries (DLLs). Objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work. Objfile are the object files to be examined. Objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work. Objfile are the object files to be examined. Dump an object to memory or save to file for later use. OutputVar:= ObjDump (Object, Compress, Password) Function Example: size:= ObjDump(obj, var) Parameters OutputVar. The name of the variable in which to store the size of dumped object. The object to be dumped to memory. Compress (optional).

ObjDump is a very small framework that extracts the internals fromany Java object and dumps them to a String. The String can then be usedin whatever way needed.

Download

Objdump

Visit the sourceforge project area.

Examples

Objdump

Given two classes:

class TSomeClass
{
publicint fInt = 0;
publicString fSomeString = ';
public TSomeOtherClass fSc = null;
}
class TSomeOtherClass
{
public double fDbl = 3.2;
}

and a method:

void test ()
{
TSomeClass foo = new TSomeClass ();
foo.fInt = 10;
foo.fSomeString = 'hello world';
foo.fSc = new TSomeOtherClass ();
foo.fSc.fDbl = 102.7;
String objDumpTxtConcise = GetObjectDumpTextConcise (foo);
String objDumpTxtDetailed = GetObjectDumpTextDetailed (foo);
StringobjDumpXML = GetObjectDumpXML (foo, 0);
}


The three variables objDumpTxtConcise, objDumpTxtDetailed, objDumpXML would be set to the following content:

objDumpTxtConcise

org.rww.debug.TSomeClass anonymous = 'object' (id = 173a10f)
public java.lang.Integer fInt = '10' (id = a)
public java.lang.String fSomeString = 'hello world' (id = 6aefe2c4)
public org.rww.debug.TSomeOtherClass fSc = 'object' (id = a62fc3)
public java.lang.Double fDbl = '102.7' (id = 8c956001)

objDumpTxtDetailed

--------------------------------------------------------------------------------------------
Object dump:
--------------------------------------------------------------------------------------------
| object ID : 173a10f
| modifiers :
| declared type : org.rww.debug.TSomeClass
| actual type : org.rww.debug.TSomeClass
| field name : anonymous
| value : object
| extra info :
--------------------------------------------------------------------------------------------
| | object ID : a
| | modifiers : public
| | declared type : int
| | actual type : java.lang.Integer
| | field name : fInt
| | value : 10
| | extra info :
--------------------------------------------------------------------------------------------
| | object ID : 6aefe2c4
| | modifiers : public
| | declared type : java.lang.String
| | actual type : java.lang.String
| | field name : fSomeString
| | value : hello world
| | extra info :
--------------------------------------------------------------------------------------------
| | object ID : a62fc3
| | modifiers : public
| | declared type : org.rww.debug.TSomeOtherClass
| | actual type :org.rww.debug.TSomeOtherClass
| | field name : fSc
| | value : object
| | extra info :
--------------------------------------------------------------------------------------------
| | | object ID : 8c956001
| | | modifiers : public
| | | declared type : double
| | | actual type :java.lang.Double
| | | field name :fDbl
| | | value : 102.7
| | | extra info :
--------------------------------------------------------------------------------------------

Objdump optionsObjdump

objDumpXML

<object-dump>
<object>
<info>
<object-id>173a10f</object-id>
<modifiers></modifiers>
<declared-type>org.rww.debug.TSomeClass</declared-type>
<actual-type>org.rww.debug.TSomeClass</actual-type>
<field-name>anonymous</field-name>
<value>object</value>
<extra-info></extra-info>
<is-array>false</is-array>
<is-leaf>false</is-leaf>
<is-null>false</is-null>
<is-primitive>false</is-primitive>
</info>
<fields>
<object>
<info>
<object-id>a</object-id>
<modifiers>public </modifiers>
<declared-type>int</declared-type>
<actual-type>java.lang.Integer</actual-type>
<field-name>fInt</field-name>
<value>10</value>
<extra-info></extra-info>
<is-array>false</is-array>
<is-leaf>true</is-leaf>
<is-null>false</is-null>
<is-primitive>true</is-primitive>
</info>
<fields>
</fields>
</object>
<object>
<info>
<object-id>6aefe2c4</object-id>
<modifiers>public </modifiers>
<declared-type>java.lang.String</declared-type>
<actual-type>java.lang.String</actual-type>
<field-name>fSomeString</field-name>
<value>hello world</value>
<extra-info></extra-info>
<is-array>false</is-array>
<is-leaf>true</is-leaf>
<is-null>false</is-null>
<is-primitive>true</is-primitive>
</info>
<fields>
</fields>
</object>
<object>
<info>
<object-id>a62fc3</object-id>
<modifiers>public </modifiers>
<declared-type>org.rww.debug.TSomeOtherClass</declared-type>
<actual-type>org.rww.debug.TSomeOtherClass</actual-type>
<field-name>fSc</field-name>
<value>object</value>
<extra-info></extra-info>
<is-array>false</is-array>
<is-leaf>false</is-leaf>
<is-null>false</is-null>
<is-primitive>false</is-primitive>
</info>
<fields>
<object>
<info>
<object-id>8c956001</object-id>
<modifiers>public </modifiers>
<declared-type>double</declared-type>
<actual-type>java.lang.Double</actual-type>
<field-name>fDbl</field-name>
<value>102.7</value>
<extra-info></extra-info>
<is-array>false</is-array>
<is-leaf>true</is-leaf>
<is-null>false</is-null>
<is-primitive>true</is-primitive>
</info>
<fields>
</fields>
</object>
</fields>
</object>
</fields>
</object>
</object-dump>

Features

ObjDump provides:
* Different output formats,
* Automatic detection of circular references by using a cache mechanism,
* Automatic limitation of recursion depth.


I hope to be able to introduce further features in the future. Suggestions welcome!

Critique

If you have any suggestions, improvements, comments - feel free to submit them using the sourceforge project area.

History

During work on a Java project I found that I needed something whichwould allow me to dump the contents of a Java object to a string. Ilooked on the internet, but it wasn't very easy to find something.After some search I found a page on the internet that showed the sourcecode of what I looked for. It was the Object dumpermade by Tobias Dezulian. It was already an excellent piece of software,and very easy to use (one statement only). The listing had a paragraphat the top saying,


This Software is freeware.
Feel free to use/modify/distribute.

Objdump -b


which was ideal. So I integrated the file into the Java project I wasworking on. Unfortunately I found out that the object dumper wouldn'tdump those parts of an object that were arrays. And my project usedarrays. So, at the end I decided that I would write my ownimplementation of an object dumper which would be capable of dumpingarrays as well. I also threw in a few extra features such as differentoutput formats. The resulting software seemed to work quite well in thejava project, and I greatly enjoyed developing something like this;especially as I haven't worked with the Java reflection API before.
Since the software is quite new, I gave it a version ID of 0.1 anddeclared it as beta software, just to be on the safe side. However, Ihave tested it on a few objects and was happy with the result. And fromlooking at the source code I didn't see any major defects either. but Ihaven't run any extensive tests on the software. However, If it provesto run stable, and I find time, I may put some more features in and itmay reach 1.0 stage.

Donations

In my view, the best donation possible is when the project is usedand helps people. I don't need anything else - my bills are paid, Ihave a roof over my head, and have enough food and clothes available.So - simply use the software and enjoy it. I can't think of any greaterreward than that people find the software useful. It's also a great joyto me if people take the software apart and look into it 'how itworks'. I myself enjoy to look at a system and to understand it - evenif it's only for the 'Wow! That's cool!' factor.

Objdump Download

If you are still desperate to donate, I have two suggestions:

Donate kindness to other people.

Sometimes the tone on some of the mailing lists can get quite rude,especially with newcomers. No-one was born with extensive knowledge incomputing. So, if you find that someone wrote a question on a mailinglist that appears to be too simple - don't give unkind answers.
Kindness goes the other way as well. Some people may be tempted to usea mailing list as the quick way to get a problem solved. You may findthat searching on google brings you the solution you need. I cannotcount the times that I have benefitted from some research on google.There is also a guidefrom Eric Raymond on 'how to ask questions the smart way'. This articledescribes how to ask questions on mailing lists and gives you someinsight on why some questions can yield unfriendly answers.


Donate thankfulness.

I once found a plugin for the firefox web browser (for Windows) thatallowed people to upgrade their Operating system via the Windowsupgrade. The author wrote it and shared it. It was really sad to seesome of the other user's reaction to that plugin; they wrote negativecomments about it (how useless this plugin is since it's just aduplication of a Windows feature etc.). I don't think that suchreactions are very encouraging to the author. At least it's detrimentalto other people who want to contribute plugins. But it's reallyencouraging if people are thankful, at least for the efforts ofsomebody.

And finally...

many thanks to the host of this project, sourceforge.netfor their excellent service. I would have put this page as homepagethere, but unfortunately I wasn't able to successfully connect to theirservers due to limitations with my computer setup. So, for the timebeing, this is the project's homepage.

Objdump Disassemble


Objdump Output