Make sure existing entries can be found by userid
[heimdal.git] / cf / w32-list-externs-from-objs.pl
blobebc7767449424f89692955153605f96fd6070416
1 my $show_module_name = 1;
2 my $use_indent = 1;
3 my $strip_leading_underscore = 0;
5 # Dump all symbols for the given object file that are defined and have
6 # external scope.
8 sub dump_symbols_for_file($)
10 $fn = shift;
12 print STDERR "Opening dump of object [$fn]\n";
14 open(SP, '-|', "dumpbin /symbols \"".$fn."\"") or die "Can't open pipe for $fn";
16 LINE:
17 while (<SP>) {
18 # 008 00000000 SECT3 notype () External | _encode_AccessDescription
20 /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+(?:\(\)| )\s+(\w+)\s+\|\s+(\w+)$/ && do {
21 my ($section, $visibility, $symbol) = ($1, $2, $3);
23 if ($section ne "UNDEF" && $visibility eq "External") {
24 print $fn if $show_module_name;
25 print "\t" if $use_indent || $show_module_name;
27 if ($strip_leading_underscore && $symbol =~ /_(.*)/) {
28 $symbol = $1;
30 print $symbol;
31 print "\n";
36 close SP;
39 sub use_response_file($)
41 $fn = shift;
43 open (RF, '<', $fn) or die "Can't open response file $fn";
45 while (<RF>) {
46 /(\S+)/ && do {
47 dump_symbols_for_file($1);
50 close RF;
53 for (@ARGV) {
54 ARG: {
55 /-q/ && do {
56 $show_module_name = 0;
57 last ARG;
60 /-1/ && do {
61 $use_indent = 0;
62 last ARG;
65 /-u/ && do {
66 $strip_leading_underscore = 1;
67 last ARG;
70 /@(.*)/ && do {
71 use_response_file($1);
72 last ARG;
75 dump_symbols_for_file($_);