This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SCRIPT] Windows system dll function addresses

Cool this is exactly what I need to debug something I've written. I had a gui app that did this but it was *very* slow...

Thanks for sharing ;)


--- Joe Buehler <> wrote:
>Sometimes it is useful to be able to tell what Windows
>DLL functions are at the top of a stack trace in gdb
>(not everyone can remember functions by address instead
>of name).
>Here is a perl script to dump a sorted list of symbol
>addresses from the dlls on a Windows system.  You need
>dumpbin to run this.  Only tested on Windows NT --
>dumpbin may have different output on other versions, in
>which case this may break.
>Oh, one thing -- I have a mount point named "/sys" that is the
>directory where the dlls reside.  I think I made that myself.
>You will have to substitute whatever the appropriate path is
>on your machine.
>Joe Buehler
># dump symbols and absolute address from Windows system dlls
># You need dumpbin for this to work.
># You also need to change /sys to whatever is appropriate.
>opendir(SYSDIR, "/sys");
>while ($dll = readdir(SYSDIR)) {
>	next unless $dll =~ /[.]dll$/io;
>	next unless -f "/sys/$dll";
>	open(DUMPBIN, qq{ cd /sys && dumpbin /headers /exports $dll | });
>	while (<DUMPBIN>) {
>		s/\r*\n//o;
>		next if /^\s*$/o;
>		if (/^\s*(\S+)\s+image\s+base\s*$/io) {
>			$image_base_address = hex $1;
>		} elsif (/^\s+ordinal\s+hint\s+RVA\s+name\s*$/io .. /^\S/o) {
>			next if /^\s+ordinal\s+hint\s+RVA\s+name\s*$/io;
>			next if /^\S/io;
>			next unless ($ordinal, $hint, $RVA, $name) = /^\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/o;
>			$RVA = hex $RVA;
>			push(@out, sprintf("0x%08x %16s %s\n", $image_base_address + $RVA, $dll, $name));
>		}
>	}
>	close(DUMPBIN);
>print sort @out;
>Unsubscribe info:
>Bug reporting:

_____________________________________________________________ - Free UK Internet Services

Select your own custom email address for FREE! Get w/No Ads, 6MB, POP & more!

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]