VIM Browser for DLL and JAR

155 views
Skip to first unread message

gfu...@cox.net

unread,
Oct 15, 2007, 2:45:31 PM10/15/07
to vim_use
I often need to browse the contents of a DLL or jar file ("object
browser") - take a look at the classes, methods, etc., but don't
always have access to the help/javadoc or source code. Most of the
VIM stuff I've found relies on CTAGS, which I believe needs source
code to work on.

What do people do in this situation. Is there some command line or
vim utility I've missed? Thanks!

Fuzzy Logic

unread,
Oct 15, 2007, 2:53:51 PM10/15/07
to vim...@googlegroups.com
I'm a little confused.

In both cases, it's quite possible that the class and function/method
names have been either mangled or obfuscated, so Vim will not be able
to make anything of it for you.

I'm not sure what kind of data you are looking to get from the object files.

Fuzzy

Hari Krishna Dara

unread,
Oct 15, 2007, 3:20:38 PM10/15/07
to vim_use

Here is an idea. Since Vim already supports browsing zip files, and jar
files are essentially zip files, you can configure Vim to handle them
just like zip files. Here is what I do:

" Have the zip plugin treat a few other types as zip files.
au BufReadCmd *.jar,*.ear,*.war call zip#Browse(expand("<amatch>"))--

When you find the .class file that interests you, you can open the file
and run jad or some other decompiler to see the decompiled source. You
might also try a plugin
(http://www.vim.org/scripts/script.php?script_id=446) on vim.org that
claims to do this automatically, which means simply hitting "o" on the
class that you are interested should get you the Java code.

Once you are viewing the source, you should be able to configure
whichever tags browser that you use to detect that the buffer contains
Java code and show the appropriate tags.

--
HTH,
Hari

>
>
> >
>

Charles E Campbell Jr

unread,
Oct 15, 2007, 3:32:26 PM10/15/07
to vim...@googlegroups.com
Hari Krishna Dara wrote:

>" Have the zip plugin treat a few other types as zip files.
>au BufReadCmd *.jar,*.ear,*.war call zip#Browse(expand("<amatch>"))--
>
>

The updated zip plugin already treats *.jar files as *.zip files. I
think I've already sent a copy on to Bram, too; however, you may also
get a copy from
http://mysite.verizon.net/astronaut/vim/index.html#ZIP

Of course, zip.vim doesn't invoke jad.

Regards,
Chip Campbell

gfu...@cox.net

unread,
Oct 15, 2007, 8:41:33 PM10/15/07
to vim_use
Thanks all.

I just know, for example, when I'm using VBA in Word or when I was
using Eclipse with Java, I would frequently just need to see "what
were the classes, method's, and attributes in package/dll/etc X"

Tony Mechelynck

unread,
Oct 16, 2007, 10:18:49 AM10/16/07
to vim...@googlegroups.com

A DLL is a binary library which can be invoked at run-time by executable
programs and shared between them. You can try to use the xxd utility
(distributed with Vim, see ":help hex-editing") but you will still have to
know how the binary library is structured to make any sense of it. I don't.

A .jar file (or an .xpi file) is just (IIUC) a zipfile under another name. To
look at their contents, you can temporarily rename foobar.jar (or foobar.xpi)
to foobar.zip. Vim has a standard plugin for zipfiles but I think it relies on
an external program (such as unzip or pkunzip) not distributed with Vim.


Best regards,
Tony.
--
No matter what other nations may say about the United States,
immigration is still the sincerest form of flattery.

Ben Schmidt

unread,
Oct 18, 2007, 7:24:41 PM10/18/07
to vim...@googlegroups.com
> I just know, for example, when I'm using VBA in Word or when I was
> using Eclipse with Java, I would frequently just need to see "what
> were the classes, method's, and attributes in package/dll/etc X"

The 'nm' commandline utility on Unix does this kind of thing for DLLs and I'm
pretty sure it's included with Cygwin or MinGW or something. Probably part of
binutils or something like that--whatever the linker, ld, is included with, I
reckon. If you have GCC working, you probably have nm anyway.

But it's nasty, as you see mangled names, and so on. Still, it can sometimes help
track down various bits and pieces.

I believe the equivalent tool for Java is javap, and suspect its output will be
nicer than nm, too--less mangling and things.

Ben.

Send instant messages to your online friends http://au.messenger.yahoo.com

Reply all
Reply to author
Forward
0 new messages