Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Date: Fri, 13 Dec 2002 07:58:01 -0800 (PST) From: Elfyn McBratney To: cygwin AT cygwin DOT com Subject: Re: [SCRIPT] Windows system dll function addresses Reply-To: cygwin AT cygwin DOT com X-Originating-Ip: [195.92.67.76] Message-Id: <20021213155801.994E244F4@sitemail.everyone.net> 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 ;) Elfyn elfyn AT exposure DOT org DOT uk --- 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 > >#!/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 () { > 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/ _____________________________________________________________ www.smokeJet.com - Free UK Internet Services _____________________________________________________________ Select your own custom email address for FREE! Get you AT yourchoice DOT com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag -- 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/