delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
To: | cygwin AT cygwin DOT com |
X-Injected-Via-Gmane: | http://gmane.org/ |
Path: | not-for-mail |
From: | Joe Buehler <jbuehler AT hekimian DOT com> |
Subject: | [SCRIPT] Windows system dll function addresses |
Date: | Fri, 13 Dec 2002 09:16:58 -0500 |
Lines: | 50 |
Message-ID: | <atcq4b$erk$1@main.gmane.org> |
NNTP-Posting-Host: | 64.47.34.2 |
Mime-Version: | 1.0 |
X-Trace: | main.gmane.org 1039789003 15220 64.47.34.2 (13 Dec 2002 14:16:43 GMT) |
X-Complaints-To: | usenet AT main DOT gmane DOT org |
NNTP-Posting-Date: | Fri, 13 Dec 2002 14:16:43 +0000 (UTC) |
User-Agent: | Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2) Gecko/20021126 |
X-Accept-Language: | en-us, en |
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 #!/usr/bin/perl # # 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); } closedir(SYSDIR); print sort @out; -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |